remove unused variables

This commit is contained in:
Chris Cromer 2019-05-01 18:12:24 -04:00
parent 17a570b5c1
commit 39fe98c900
Signed by: cromer
GPG Key ID: 39CC813FF3C8708A
6 changed files with 146 additions and 161 deletions

View File

@ -268,7 +268,7 @@ int copy(char *src,char *dest)
return 1; return 1;
} }
} }
fclose(filew); fclose(filew);
fclose(filer); fclose(filer);
return 0; return 0;
@ -1180,10 +1180,10 @@ static unsigned int input_code(byte **input)
static void expand(byte *input, byte *output, int fileLength) static void expand(byte *input, byte *output, int fileLength)
{ {
int next_code, new_code, old_code; int next_code, new_code, old_code;
int character, /* counter=0, index, */ BITSFull /*, i */; int character /* counter=0, index, */ /*, i */;
byte *string, *endAddr; byte *string, *endAddr;
BITSFull = setBITS(START_BITS); /* Starts at 9-bits */ setBITS(START_BITS); /* Starts at 9-bits */
next_code = 257; /* Next available code to define */ next_code = 257; /* Next available code to define */
endAddr = (byte *)((long)output + (long)fileLength); endAddr = (byte *)((long)output + (long)fileLength);
@ -1196,7 +1196,7 @@ static void expand(byte *input, byte *output, int fileLength)
if (new_code == 0x100) { /* Code to "start over" */ if (new_code == 0x100) { /* Code to "start over" */
next_code = 258; next_code = 258;
BITSFull = setBITS(START_BITS); setBITS(START_BITS);
old_code = input_code(&input); old_code = input_code(&input);
character = old_code; character = old_code;
*output++ = (char)character; *output++ = (char)character;
@ -1216,7 +1216,7 @@ static void expand(byte *input, byte *output, int fileLength)
*output++ = *string--; *output++ = *string--;
if (next_code > MAX_CODE) if (next_code > MAX_CODE)
BITSFull = setBITS(BITS + 1); setBITS(BITS + 1);
prefix_code[next_code] = old_code; prefix_code[next_code] = old_code;
append_character[next_code] = character; append_character[next_code] = character;

View File

@ -638,7 +638,6 @@ void Logic::ReadArgs(bool CommandIsIf, byte CmdNum)
string ThisMessage; string ThisMessage;
int ThisMessageNum; int ThisMessageNum;
string ThisInvObjectName; string ThisInvObjectName;
int ThisInvObjectNum;
int i; int i;
SkipSpaces(); SkipSpaces();
@ -745,7 +744,6 @@ void Logic::ReadArgs(bool CommandIsIf, byte CmdNum)
else{ else{
for(i=0;i<objlist->ItemNames.num;i++){ for(i=0;i<objlist->ItemNames.num;i++){
if(objlist->ItemNames.at(i)==ThisInvObjectName){ if(objlist->ItemNames.at(i)==ThisInvObjectName){
ThisInvObjectNum = i;
WriteByte(i); WriteByte(i);
break; break;
} }

View File

@ -908,11 +908,9 @@ void PCanvas::setPixsize(int s)
//********************************************* //*********************************************
void PCanvas::viewportMousePressEvent(QMouseEvent* event) void PCanvas::viewportMousePressEvent(QMouseEvent* event)
{ {
int x,y,xx,yy; int x,y;
viewportToContents( event->x(), event->y(), x, y ); viewportToContents( event->x(), event->y(), x, y );
xx=x;
yy=y;
x-=x0; x-=x0;
y-=y0; y-=y0;
@ -944,11 +942,9 @@ void PCanvas::viewportMousePressEvent(QMouseEvent* event)
//********************************************* //*********************************************
void PCanvas::viewportMouseMoveEvent(QMouseEvent* event) void PCanvas::viewportMouseMoveEvent(QMouseEvent* event)
{ {
int x,y,xx,yy; int x,y;
viewportToContents( event->x(), event->y(), x, y ); viewportToContents( event->x(), event->y(), x, y );
xx=x;
yy=y;
x-=x0; x-=x0;
y-=y0; y-=y0;
@ -1025,8 +1021,8 @@ void PCanvas::update()
if(pri_lines){ if(pri_lines){
QPen pen; QPen pen;
pen.setStyle(Qt::DashLine); pen.setStyle(Qt::DashLine);
pen.setWidth(1); pen.setWidth(1);
//p.setPen(Qt::white); //p.setPen(Qt::white);
// p.setRasterOp(XorROP); // p.setRasterOp(XorROP);
int i=4; int i=4;

View File

@ -717,7 +717,6 @@ void Picture::refill( struct picCodeNode *temp_fill_start, struct picCodeNode *t
struct picCodeNode *temp,*picPos0,*temp_pic=0,*temp_pri=0; struct picCodeNode *temp,*picPos0,*temp_pic=0,*temp_pri=0;
int col_pic_orig,col_pri_orig,col_pic_new,col_pri_new; int col_pic_orig,col_pri_orig,col_pic_new,col_pri_new;
bool picDrawEnabled_orig,priDrawEnabled_orig; bool picDrawEnabled_orig,priDrawEnabled_orig;
bool picDrawEnabled_new,priDrawEnabled_new;
bool draw_pic_orig,draw_pri_orig,draw_pic_new,draw_pri_new; bool draw_pic_orig,draw_pri_orig,draw_pic_new,draw_pri_new;
picDrawEnabled_orig=priDrawEnabled_orig=false; picDrawEnabled_orig=priDrawEnabled_orig=false;
@ -833,7 +832,6 @@ void Picture::refill( struct picCodeNode *temp_fill_start, struct picCodeNode *t
temp = temp_fill_end; temp = temp_fill_end;
picDrawEnabled_new=priDrawEnabled_new=false;
col_pic_new=col_pri_new=-1; col_pic_new=col_pri_new=-1;
draw_pic_new=draw_pri_new = false; draw_pic_new=draw_pri_new = false;
if(temp){ if(temp){
@ -841,14 +839,12 @@ void Picture::refill( struct picCodeNode *temp_fill_start, struct picCodeNode *t
switch(temp->node){ switch(temp->node){
case 0xf0: case 0xf0:
col_pic_new = (temp->next)->node; col_pic_new = (temp->next)->node;
picDrawEnabled_new=true;
break; break;
case 0xf1: case 0xf1:
col_pic_new = -2; col_pic_new = -2;
break; break;
case 0xf2: case 0xf2:
col_pri_new = (temp->next)->node; col_pri_new = (temp->next)->node;
priDrawEnabled_new=true;
break; break;
case 0xf3: case 0xf3:
col_pri_new = -2; col_pri_new = -2;

View File

@ -604,7 +604,7 @@ void PreviewView::draw(int ResNum)
//***************************************** //*****************************************
void PreviewView::show_description() void PreviewView::show_description()
{ {
int x,y,w,h,W,H,n; int y,w,h,W,H,n;
unsigned int maxcol; unsigned int maxcol;
preview->description->hide(); preview->description->hide();
@ -614,7 +614,6 @@ void PreviewView::show_description()
W=preview->width(); W=preview->width();
H=preview->height(); H=preview->height();
x=this->x();
y=this->y(); y=this->y();
preview->description->setGeometry(10,y+h+10,W-20,H-(y+h+20)); preview->description->setGeometry(10,y+h+10,W-20,H-(y+h+20));

View File

@ -34,11 +34,11 @@
#include <ctype.h> #include <ctype.h>
#include <qapplication.h> #include <qapplication.h>
#include <qsplitter.h> #include <qsplitter.h>
#include <q3frame.h> #include <q3frame.h>
#include <qmessagebox.h> #include <qmessagebox.h>
#include <q3filedialog.h> #include <q3filedialog.h>
#include <qstringlist.h> #include <qstringlist.h>
#include <qlayout.h> #include <qlayout.h>
#include <qpixmap.h> #include <qpixmap.h>
#include <qpainter.h> #include <qpainter.h>
@ -115,7 +115,7 @@ ViewEdit::ViewEdit( QWidget *parent, const char *name,int win_num, ResourcesWin
loop->insertItem( "Delete", this, SLOT(delete_loop()) ); loop->insertItem( "Delete", this, SLOT(delete_loop()) );
loop->insertItem( "Clear", this, SLOT(clear_loop()) ); loop->insertItem( "Clear", this, SLOT(clear_loop()) );
Q3PopupMenu *cel = new Q3PopupMenu( this ); Q3PopupMenu *cel = new Q3PopupMenu( this );
Q_CHECK_PTR( cel ); Q_CHECK_PTR( cel );
@ -133,7 +133,7 @@ ViewEdit::ViewEdit( QWidget *parent, const char *name,int win_num, ResourcesWin
cel->insertItem( "Flip Horizontally", this, SLOT(fliph_cel()) ); cel->insertItem( "Flip Horizontally", this, SLOT(fliph_cel()) );
cel->insertItem( "Flip Vertically", this, SLOT(flipv_cel()) ); cel->insertItem( "Flip Vertically", this, SLOT(flipv_cel()) );
QMenuBar *menu = new QMenuBar(this); QMenuBar *menu = new QMenuBar(this);
Q_CHECK_PTR( menu ); Q_CHECK_PTR( menu );
menu->insertItem( "File", file ); menu->insertItem( "File", file );
menu->insertItem( "Edit", edit ); menu->insertItem( "Edit", edit );
@ -147,7 +147,7 @@ ViewEdit::ViewEdit( QWidget *parent, const char *name,int win_num, ResourcesWin
Q3BoxLayout *left = new Q3VBoxLayout(all,1); Q3BoxLayout *left = new Q3VBoxLayout(all,1);
QPixmap pright=QPixmap(right_x); QPixmap pright=QPixmap(right_x);
QPixmap pleft=QPixmap(left_x); QPixmap pleft=QPixmap(left_x);
@ -159,7 +159,7 @@ ViewEdit::ViewEdit( QWidget *parent, const char *name,int win_num, ResourcesWin
frame1->setMargin(10); frame1->setMargin(10);
left->addWidget(frame1); left->addWidget(frame1);
int maxrow1 = 9,maxcol1 = 4; int maxrow1 = 9,maxcol1 = 4;
Q3GridLayout *grid1 = new Q3GridLayout( frame1, maxrow1,maxcol1, 1 ); Q3GridLayout *grid1 = new Q3GridLayout( frame1, maxrow1,maxcol1, 1 );
@ -174,7 +174,7 @@ ViewEdit::ViewEdit( QWidget *parent, const char *name,int win_num, ResourcesWin
grid1->setRowStretch(i,1); grid1->setRowStretch(i,1);
grid1->addRowSpacing(i,2); grid1->addRowSpacing(i,2);
} }
int row=1;int col=0; int row=1;int col=0;
@ -217,7 +217,7 @@ ViewEdit::ViewEdit( QWidget *parent, const char *name,int win_num, ResourcesWin
// celright->setFocusPolicy(ClickFocus); // celright->setFocusPolicy(ClickFocus);
connect( celright, SIGNAL(clicked()), SLOT(next_cel()) ); connect( celright, SIGNAL(clicked()), SLOT(next_cel()) );
grid1->addWidget(celright,row,col,Qt::AlignLeft); col++; grid1->addWidget(celright,row,col,Qt::AlignLeft); col++;
row++;col=0; row++;col=0;
QLabel *lwidth = new QLabel("Width:",frame1); QLabel *lwidth = new QLabel("Width:",frame1);
@ -244,7 +244,7 @@ ViewEdit::ViewEdit( QWidget *parent, const char *name,int win_num, ResourcesWin
grid1->addWidget(widthright,row,col,Qt::AlignLeft); col++; grid1->addWidget(widthright,row,col,Qt::AlignLeft); col++;
row++;col=0; row++;col=0;
QLabel *lheight = new QLabel("Height:",frame1); QLabel *lheight = new QLabel("Height:",frame1);
grid1->addWidget(lheight,row,col,Qt::AlignRight); col++; grid1->addWidget(lheight,row,col,Qt::AlignRight); col++;
@ -274,8 +274,8 @@ ViewEdit::ViewEdit( QWidget *parent, const char *name,int win_num, ResourcesWin
// is_descriptor->setFocusPolicy(ClickFocus); // is_descriptor->setFocusPolicy(ClickFocus);
connect( is_descriptor, SIGNAL(clicked()), SLOT(is_descriptor_cb()) ); connect( is_descriptor, SIGNAL(clicked()), SLOT(is_descriptor_cb()) );
grid1->addMultiCellWidget(is_descriptor,row,row,0,2,Qt::AlignCenter); grid1->addMultiCellWidget(is_descriptor,row,row,0,2,Qt::AlignCenter);
edit_descriptor = new QPushButton(frame1); edit_descriptor = new QPushButton(frame1);
// edit_descriptor->setFocusPolicy(ClickFocus); // edit_descriptor->setFocusPolicy(ClickFocus);
edit_descriptor->setText("Edit"); edit_descriptor->setText("Edit");
@ -291,7 +291,7 @@ ViewEdit::ViewEdit( QWidget *parent, const char *name,int win_num, ResourcesWin
QLabel *mirrorloop = new QLabel("This loop mirrors: ", frame1, 0); QLabel *mirrorloop = new QLabel("This loop mirrors: ", frame1, 0);
grid1->addMultiCellWidget(mirrorloop,row,row,0,maxcol1-1,Qt::AlignCenter); grid1->addMultiCellWidget(mirrorloop,row,row,0,maxcol1-1,Qt::AlignCenter);
row++;col=0; row++;col=0;
@ -299,9 +299,9 @@ ViewEdit::ViewEdit( QWidget *parent, const char *name,int win_num, ResourcesWin
mirror_loop->insertItem(" no other loop "); mirror_loop->insertItem(" no other loop ");
mirror_loop->setMinimumSize(100,20); mirror_loop->setMinimumSize(100,20);
connect( mirror_loop, SIGNAL(activated(int)), this, SLOT(change_mirror(int)) ); connect( mirror_loop, SIGNAL(activated(int)), this, SLOT(change_mirror(int)) );
grid1->addMultiCellWidget(mirror_loop,row,row,0,maxcol1-1,Qt::AlignCenter); grid1->addMultiCellWidget(mirror_loop,row,row,0,maxcol1-1,Qt::AlignCenter);
Q3Frame *frame2 = new Q3Frame(this); Q3Frame *frame2 = new Q3Frame(this);
frame2->setFrameStyle(Q3Frame::Box | Q3Frame::Sunken); frame2->setFrameStyle(Q3Frame::Box | Q3Frame::Sunken);
@ -337,17 +337,17 @@ ViewEdit::ViewEdit( QWidget *parent, const char *name,int win_num, ResourcesWin
zoom_plus->setPixmap(QPixmap(zoom_plus_x)); zoom_plus->setPixmap(QPixmap(zoom_plus_x));
connect( zoom_plus, SIGNAL(clicked()), SLOT(zoom_plus()) ); connect( zoom_plus, SIGNAL(clicked()), SLOT(zoom_plus()) );
grid2->addWidget(zoom_plus,0,1,Qt::AlignRight); grid2->addWidget(zoom_plus,0,1,Qt::AlignRight);
view_draw = new QRadioButton("Draw",frame2); view_draw = new QRadioButton("Draw",frame2);
// view_draw->setFocusPolicy(ClickFocus); // view_draw->setFocusPolicy(ClickFocus);
view_draw->setChecked(true); view_draw->setChecked(true);
drawing_mode=V_DRAW; drawing_mode=V_DRAW;
grid2->addMultiCellWidget(view_draw,1,1,0,1,Qt::AlignLeft); grid2->addMultiCellWidget(view_draw,1,1,0,1,Qt::AlignLeft);
view_fill = new QRadioButton("Fill",frame2); view_fill = new QRadioButton("Fill",frame2);
// view_fill->setFocusPolicy(ClickFocus); // view_fill->setFocusPolicy(ClickFocus);
grid2->addMultiCellWidget(view_fill,2,2,0,1,Qt::AlignLeft); grid2->addMultiCellWidget(view_fill,2,2,0,1,Qt::AlignLeft);
Q3ButtonGroup *bg = new Q3ButtonGroup(frame2); Q3ButtonGroup *bg = new Q3ButtonGroup(frame2);
@ -375,25 +375,25 @@ ViewEdit::ViewEdit( QWidget *parent, const char *name,int win_num, ResourcesWin
view_up->setPixmap(QPixmap(uparrow_x)); view_up->setPixmap(QPixmap(uparrow_x));
connect( view_up, SIGNAL(clicked()), SLOT(shift_up()) ); connect( view_up, SIGNAL(clicked()), SLOT(shift_up()) );
grid3->addWidget(view_up,0,1,Qt::AlignBottom|Qt::AlignHCenter); grid3->addWidget(view_up,0,1,Qt::AlignBottom|Qt::AlignHCenter);
QPushButton *view_left = new QPushButton(frame2); QPushButton *view_left = new QPushButton(frame2);
// view_left->setFocusPolicy(ClickFocus); // view_left->setFocusPolicy(ClickFocus);
view_left->setPixmap(QPixmap(leftarrow_x)); view_left->setPixmap(QPixmap(leftarrow_x));
connect( view_left, SIGNAL(clicked()), SLOT(shift_left()) ); connect( view_left, SIGNAL(clicked()), SLOT(shift_left()) );
grid3->addWidget(view_left,1,0,Qt::AlignRight|Qt::AlignVCenter); grid3->addWidget(view_left,1,0,Qt::AlignRight|Qt::AlignVCenter);
QPushButton *view_right = new QPushButton(frame2); QPushButton *view_right = new QPushButton(frame2);
// view_right->setFocusPolicy(ClickFocus); // view_right->setFocusPolicy(ClickFocus);
view_right->setPixmap(QPixmap(rightarrow_x)); view_right->setPixmap(QPixmap(rightarrow_x));
connect( view_right, SIGNAL(clicked()), SLOT(shift_right()) ); connect( view_right, SIGNAL(clicked()), SLOT(shift_right()) );
grid3->addWidget(view_right,1,2,Qt::AlignLeft|Qt::AlignVCenter); grid3->addWidget(view_right,1,2,Qt::AlignLeft|Qt::AlignVCenter);
QPushButton *view_down = new QPushButton(frame2); QPushButton *view_down = new QPushButton(frame2);
// view_down->setFocusPolicy(ClickFocus); // view_down->setFocusPolicy(ClickFocus);
view_down->setPixmap(QPixmap(downarrow_x)); view_down->setPixmap(QPixmap(downarrow_x));
connect( view_down, SIGNAL(clicked()), SLOT(shift_down()) ); connect( view_down, SIGNAL(clicked()), SLOT(shift_down()) );
grid3->addWidget(view_down,2,1,Qt::AlignTop|Qt::AlignHCenter); grid3->addWidget(view_down,2,1,Qt::AlignTop|Qt::AlignHCenter);
Q3Frame *frame3 = new Q3Frame(this); Q3Frame *frame3 = new Q3Frame(this);
@ -402,7 +402,7 @@ ViewEdit::ViewEdit( QWidget *parent, const char *name,int win_num, ResourcesWin
frame3->setMinimumSize(420,300); frame3->setMinimumSize(420,300);
frame3->setMargin(4); frame3->setMargin(4);
all->addWidget(frame3,1); all->addWidget(frame3,1);
Q3BoxLayout *right = new Q3VBoxLayout(frame3,10); Q3BoxLayout *right = new Q3VBoxLayout(frame3,10);
@ -419,11 +419,11 @@ ViewEdit::ViewEdit( QWidget *parent, const char *name,int win_num, ResourcesWin
frame4->setMinimumSize(400,80); frame4->setMinimumSize(400,80);
frame4->setMargin(10); frame4->setMargin(10);
right->addWidget(frame4); right->addWidget(frame4);
int maxcol2 = 6; int maxcol2 = 6;
Q3GridLayout *grid4 = new Q3GridLayout( frame4, 2, maxcol2, 2); Q3GridLayout *grid4 = new Q3GridLayout( frame4, 2, maxcol2, 2);
for(i=0;i<maxcol2;i++){ for(i=0;i<maxcol2;i++){
grid4->setColStretch(i,1); grid4->setColStretch(i,1);
grid4->addColSpacing(i,4); grid4->addColSpacing(i,4);
@ -433,17 +433,17 @@ ViewEdit::ViewEdit( QWidget *parent, const char *name,int win_num, ResourcesWin
grid4->addRowSpacing(i,2); grid4->addRowSpacing(i,2);
} }
QLabel *trans_color = new QLabel("Transparency colour:",frame4); QLabel *trans_color = new QLabel("Transparency colour:",frame4);
trans_color->setMaximumHeight(20); trans_color->setMaximumHeight(20);
grid4->addWidget(trans_color,0,0,Qt::AlignLeft); grid4->addWidget(trans_color,0,0,Qt::AlignLeft);
transcolor = new QWidget(frame4); transcolor = new QWidget(frame4);
transcolor->setPalette( QPalette( egacolor[0] ) ); transcolor->setPalette( QPalette( egacolor[0] ) );
transcolor->setMinimumSize(40,16); transcolor->setMinimumSize(40,16);
transcolor->setMaximumSize(100,30); transcolor->setMaximumSize(100,30);
grid4->addWidget(transcolor,0,1,Qt::AlignCenter); grid4->addWidget(transcolor,0,1,Qt::AlignCenter);
QPushButton *set_trans_color = new QPushButton(frame4); QPushButton *set_trans_color = new QPushButton(frame4);
// set_trans_color->setFocusPolicy(ClickFocus); // set_trans_color->setFocusPolicy(ClickFocus);
@ -454,7 +454,7 @@ ViewEdit::ViewEdit( QWidget *parent, const char *name,int win_num, ResourcesWin
QWidget *dummy = new QWidget(frame4); QWidget *dummy = new QWidget(frame4);
grid4->addMultiCellWidget(dummy,0,3,maxcol2-1,Qt::AlignCenter); grid4->addMultiCellWidget(dummy,0,3,maxcol2-1,Qt::AlignCenter);
palette = new Palette(frame4); palette = new Palette(frame4);
palette->setMinimumSize(250,40); palette->setMinimumSize(250,40);
palette->setMaximumSize(350,80); palette->setMaximumSize(350,80);
@ -488,7 +488,7 @@ void ViewEdit::display()
showlooppar(); showlooppar();
showcelpar(); showcelpar();
if(view->Description != ""){ if(view->Description != ""){
is_descriptor->setChecked(true); is_descriptor->setChecked(true);
edit_descriptor->setEnabled(true); edit_descriptor->setEnabled(true);
@ -496,7 +496,7 @@ void ViewEdit::display()
else{ else{
is_descriptor->setChecked(false); is_descriptor->setChecked(false);
edit_descriptor->setEnabled(false); edit_descriptor->setEnabled(false);
} }
if(description)description->hide(); if(description)description->hide();
DisplayView(); DisplayView();
show(); show();
@ -505,7 +505,7 @@ void ViewEdit::display()
//********************************************* //*********************************************
void ViewEdit::open(int ResNum) void ViewEdit::open(int ResNum)
{ {
if(view->open(ResNum))return ; if(view->open(ResNum))return ;
ViewNum = ResNum; ViewNum = ResNum;
sprintf(tmp,"View editor: view.%d",ViewNum); sprintf(tmp,"View editor: view.%d",ViewNum);
@ -522,20 +522,16 @@ void ViewEdit::open(char *filename)
if(view->open(filename))return; if(view->open(filename))return;
ViewNum = -1; ViewNum = -1;
sprintf(tmp,"View editor"); sprintf(tmp,"View editor");
setCaption(tmp); setCaption(tmp);
changed=false; changed=false;
display(); display();
} }
//********************************************* //*********************************************
void ViewEdit::DisplayView() void ViewEdit::DisplayView()
{ {
int w,h;
w = canvas->x0+canvas->cur_w*canvas->pixsize*2+10;
h = canvas->y0+canvas->cur_h*canvas->pixsize+10;
int i=view->loops[view->CurLoop].mirror; int i=view->loops[view->CurLoop].mirror;
if(i!=-1){ if(i!=-1){
canvas->DrawCel(view->loops[i].cels[view->CurCel].width,view->loops[i].cels[view->CurCel].height,view->loops[i].cels[view->CurCel].data,true); canvas->DrawCel(view->loops[i].cels[view->CurCel].width,view->loops[i].cels[view->CurCel].height,view->loops[i].cels[view->CurCel].data,true);
} }
else{ else{
canvas->DrawCel(view->loops[view->CurLoop].cels[view->CurCel].width,view->loops[view->CurLoop].cels[view->CurCel].height,view->loops[view->CurLoop].cels[view->CurCel].data,false); canvas->DrawCel(view->loops[view->CurLoop].cels[view->CurCel].width,view->loops[view->CurLoop].cels[view->CurCel].height,view->loops[view->CurLoop].cels[view->CurCel].data,false);
@ -561,7 +557,7 @@ void ViewEdit::DisplayView(int pixsize)
int i=view->loops[view->CurLoop].mirror; int i=view->loops[view->CurLoop].mirror;
if(i!=-1){ if(i!=-1){
canvas->DrawCel(view->loops[i].cels[view->CurCel].width,view->loops[i].cels[view->CurCel].height,view->loops[i].cels[view->CurCel].data,true,pixsize); canvas->DrawCel(view->loops[i].cels[view->CurCel].width,view->loops[i].cels[view->CurCel].height,view->loops[i].cels[view->CurCel].data,true,pixsize);
} }
else{ else{
canvas->DrawCel(view->loops[view->CurLoop].cels[view->CurCel].width,view->loops[view->CurLoop].cels[view->CurCel].height,view->loops[view->CurLoop].cels[view->CurCel].data,false,pixsize); canvas->DrawCel(view->loops[view->CurLoop].cels[view->CurCel].width,view->loops[view->CurLoop].cels[view->CurCel].height,view->loops[view->CurLoop].cels[view->CurCel].data,false,pixsize);
@ -575,7 +571,7 @@ void ViewEdit::DisplayView(int pixsize)
//********************************************* //*********************************************
void ViewEdit::showlooppar() void ViewEdit::showlooppar()
{ {
sprintf(tmp,"%d/%d",view->CurLoop,view->NumLoops-1); sprintf(tmp,"%d/%d",view->CurLoop,view->NumLoops-1);
loopnum->setText(tmp); loopnum->setText(tmp);
showmirror(); showmirror();
@ -641,7 +637,7 @@ void ViewEdit::deinit()
//********************************************* //*********************************************
void ViewEdit::hideEvent( QHideEvent * ) void ViewEdit::hideEvent( QHideEvent * )
{ {
if(description){ if(description){
description->close(true); description->close(true);
description=NULL; description=NULL;
@ -661,16 +657,16 @@ void ViewEdit::showEvent( QShowEvent * )
//*********************************************** //***********************************************
void ViewEdit::closeEvent( QCloseEvent *e ) void ViewEdit::closeEvent( QCloseEvent *e )
{ {
if(changed){ if(changed){
if(ViewNum != -1){ if(ViewNum != -1){
sprintf(tmp,"Save changes to view.%d ?",ViewNum); sprintf(tmp,"Save changes to view.%d ?",ViewNum);
} }
else{ else{
sprintf(tmp,"Save changes to view ?"); sprintf(tmp,"Save changes to view ?");
} }
strcat(tmp,"\n(view will be saved to game)"); strcat(tmp,"\n(view will be saved to game)");
switch ( QMessageBox::warning( this, "View editor", switch ( QMessageBox::warning( this, "View editor",
tmp, tmp,
"Yes", "Yes",
@ -692,8 +688,8 @@ void ViewEdit::closeEvent( QCloseEvent *e )
default: // cancel default: // cancel
e->ignore(); e->ignore();
break; break;
} }
} }
else{ else{
deinit(); deinit();
@ -706,10 +702,10 @@ void ViewEdit::closeEvent( QCloseEvent *e )
//********************************************* //*********************************************
void ViewEdit::open_file() void ViewEdit::open_file()
{ {
Q3FileDialog *f = new Q3FileDialog(0,"Open",true); Q3FileDialog *f = new Q3FileDialog(0,"Open",true);
const char *filters[] = {"view*.*","All files (*)",NULL}; const char *filters[] = {"view*.*","All files (*)",NULL};
f->setFilters(filters); f->setFilters(filters);
f->setCaption("Open view"); f->setCaption("Open view");
f->setMode(Q3FileDialog::ExistingFile); f->setMode(Q3FileDialog::ExistingFile);
@ -724,7 +720,7 @@ void ViewEdit::open_file()
//********************************************* //*********************************************
void ViewEdit::open() void ViewEdit::open()
{ {
setCaption("View editor"); setCaption("View editor");
view->newView(); view->newView();
ViewNum = -1; ViewNum = -1;
@ -740,9 +736,9 @@ void ViewEdit::save_file()
{ {
Q3FileDialog *f = new Q3FileDialog(0,"Save",true); Q3FileDialog *f = new Q3FileDialog(0,"Save",true);
const char *filters[] = {"view*.*","All files (*)",NULL}; const char *filters[] = {"view*.*","All files (*)",NULL};
f->setFilters(filters); f->setFilters(filters);
f->setCaption("Save view"); f->setCaption("Save view");
f->setMode(Q3FileDialog::AnyFile); f->setMode(Q3FileDialog::AnyFile);
@ -774,25 +770,25 @@ void ViewEdit::save_to_game()
void ViewEdit::save_to_game_as() void ViewEdit::save_to_game_as()
{ {
AskNumber *view_number = new AskNumber(0,0,"View number","Enter view number: [0-255]"); AskNumber *view_number = new AskNumber(0,0,"View number","Enter view number: [0-255]");
if(!view_number->exec())return; if(!view_number->exec())return;
QString str = view_number->num->text(); QString str = view_number->num->text();
int num = atoi((char *)str.latin1()); int num = atoi((char *)str.latin1());
if(num<0||num>255){ if(num<0||num>255){
menu->errmes("View number must be between 0 and 255 !"); menu->errmes("View number must be between 0 and 255 !");
return ; return ;
} }
if(game->ResourceInfo[VIEW][num].Exists){ if(game->ResourceInfo[VIEW][num].Exists){
sprintf(tmp,"Resource view.%d already exists. Replace it ?",num); sprintf(tmp,"Resource view.%d already exists. Replace it ?",num);
switch( QMessageBox::warning( this, "View", tmp, switch( QMessageBox::warning( this, "View", tmp,
"Replace", "Cancel", "Replace", "Cancel",
0, // Enter == button 0 0, // Enter == button 0
1 ) ) { // Escape == button 1 1 ) ) { // Escape == button 1
case 0: case 0:
view->save(num); view->save(num);
changed=false; changed=false;
ViewNum = num; ViewNum = num;
@ -801,7 +797,7 @@ void ViewEdit::save_to_game_as()
resources_win->preview->open(ViewNum,VIEW); resources_win->preview->open(ViewNum,VIEW);
} }
break; break;
case 1: case 1:
break; break;
} }
} }
@ -830,7 +826,7 @@ void ViewEdit::delete_view()
"Delete", "Cancel", "Delete", "Cancel",
0, // Enter == button 0 0, // Enter == button 0
1 ) ) { // Escape == button 1 1 ) ) { // Escape == button 1
case 0: case 0:
game->DeleteResource(VIEW,ViewNum); game->DeleteResource(VIEW,ViewNum);
if(resources_win){ if(resources_win){
k = resources_win->list->currentItem(); k = resources_win->list->currentItem();
@ -838,16 +834,16 @@ void ViewEdit::delete_view()
resources_win->list->setCurrentItem(k); resources_win->list->setCurrentItem(k);
} }
break; break;
case 1: case 1:
break; break;
} }
} }
//********************************************* //*********************************************
void ViewEdit::flipv_cel() void ViewEdit::flipv_cel()
{ {
view->loops[curIndex()].cels[view->CurCel].mirrorv(); view->loops[curIndex()].cels[view->CurCel].mirrorv();
DisplayView(); DisplayView();
changed=true; changed=true;
@ -856,7 +852,7 @@ void ViewEdit::flipv_cel()
//********************************************* //*********************************************
void ViewEdit::fliph_cel() void ViewEdit::fliph_cel()
{ {
view->loops[curIndex()].cels[view->CurCel].mirrorh(); view->loops[curIndex()].cels[view->CurCel].mirrorh();
DisplayView(); DisplayView();
changed=true; changed=true;
@ -942,7 +938,7 @@ void ViewEdit::insert_loop_before()
view->insertLoop_before(); view->insertLoop_before();
showlooppar(); showlooppar();
showcelpar(); showcelpar();
DisplayView(); DisplayView();
changed=true; changed=true;
} }
else{ else{
@ -959,7 +955,7 @@ void ViewEdit::insert_loop_after()
view->insertLoop_after(); view->insertLoop_after();
showlooppar(); showlooppar();
showcelpar(); showcelpar();
DisplayView(); DisplayView();
changed=true; changed=true;
} }
else{ else{
@ -975,7 +971,7 @@ void ViewEdit::append_loop()
view->appendLoop(); view->appendLoop();
showlooppar(); showlooppar();
showcelpar(); showcelpar();
DisplayView(); DisplayView();
changed=true; changed=true;
} }
else{ else{
@ -995,7 +991,7 @@ void ViewEdit::delete_loop()
} }
showlooppar(); showlooppar();
showcelpar(); showcelpar();
DisplayView(); DisplayView();
changed=true; changed=true;
} }
} }
@ -1007,17 +1003,17 @@ void ViewEdit::clear_loop()
view->loops[view->CurLoop].clear(); view->loops[view->CurLoop].clear();
if(view->loops[view->CurLoop].mirror != -1){ if(view->loops[view->CurLoop].mirror != -1){
view->loops[view->loops[view->CurLoop].mirror].clear(); view->loops[view->loops[view->CurLoop].mirror].clear();
} }
showlooppar(); showlooppar();
showcelpar(); showcelpar();
DisplayView(); DisplayView();
changed=true; changed=true;
} }
//********************************************* //*********************************************
void ViewEdit::change_mirror(int i) void ViewEdit::change_mirror(int i)
{ {
if(i==0){ if(i==0){
@ -1050,7 +1046,7 @@ void ViewEdit::change_mirror(int i)
view->setMirror(view->CurLoop,k); view->setMirror(view->CurLoop,k);
} }
} }
showlooppar(); showlooppar();
DisplayView(); DisplayView();
@ -1079,7 +1075,7 @@ void ViewEdit::next_cel_cycle()
view->CurCel++; view->CurCel++;
} }
else{ else{
view->CurCel=0; view->CurCel=0;
} }
showcelpar(); showcelpar();
DisplayView(); DisplayView();
@ -1143,7 +1139,7 @@ void ViewEdit::insert_cel_before()
view->loops[view->loops[view->CurLoop].mirror].insertCel_before(view->CurCel); view->loops[view->loops[view->CurLoop].mirror].insertCel_before(view->CurCel);
} }
showcelpar(); showcelpar();
DisplayView(); DisplayView();
changed=true; changed=true;
} }
else{ else{
@ -1161,7 +1157,7 @@ void ViewEdit::insert_cel_after()
view->loops[view->loops[view->CurLoop].mirror].insertCel_after(view->CurCel); view->loops[view->loops[view->CurLoop].mirror].insertCel_after(view->CurCel);
} }
showcelpar(); showcelpar();
DisplayView(); DisplayView();
changed=true; changed=true;
} }
else{ else{
@ -1179,7 +1175,7 @@ void ViewEdit::append_cel()
view->loops[view->loops[view->CurLoop].mirror].appendCel(); view->loops[view->loops[view->CurLoop].mirror].appendCel();
} }
showcelpar(); showcelpar();
DisplayView(); DisplayView();
changed=true; changed=true;
} }
else{ else{
@ -1200,7 +1196,7 @@ void ViewEdit::delete_cel()
if(view->CurCel>=view->loops[view->CurLoop].NumCels) if(view->CurCel>=view->loops[view->CurLoop].NumCels)
view->CurCel--; view->CurCel--;
showcelpar(); showcelpar();
DisplayView(); DisplayView();
changed=true; changed=true;
} }
} }
@ -1293,7 +1289,7 @@ void ViewEdit::change_width_height()
//********************************************* //*********************************************
void ViewEdit::shift_right() void ViewEdit::shift_right()
{ {
if(view->loops[view->CurLoop].mirror==-1){ if(view->loops[view->CurLoop].mirror==-1){
view->loops[view->CurLoop].cels[view->CurCel].right(); view->loops[view->CurLoop].cels[view->CurCel].right();
} }
@ -1337,20 +1333,20 @@ void ViewEdit::shift_down()
void ViewEdit::fillCel(int x,int y,byte color) void ViewEdit::fillCel(int x,int y,byte color)
{ {
saveundo(); saveundo();
view->loops[curIndex()].cels[view->CurCel].fill(x,y,color); view->loops[curIndex()].cels[view->CurCel].fill(x,y,color);
DisplayView(); DisplayView();
changed=true; changed=true;
} }
//********************************************* //*********************************************
void ViewEdit::clear_cel() void ViewEdit::clear_cel()
{ {
saveundo(); saveundo();
view->loops[curIndex()].cels[view->CurCel].clear(); view->loops[curIndex()].cels[view->CurCel].clear();
DisplayView(); DisplayView();
changed=true; changed=true;
} }
//********************************************* //*********************************************
void ViewEdit::saveundo() void ViewEdit::saveundo()
@ -1422,7 +1418,7 @@ void ViewEdit::is_descriptor_cb()
void ViewEdit::set_transcolor() void ViewEdit::set_transcolor()
{ {
transcolor->setPalette( QPalette( egacolor[palette->left] ) ); transcolor->setPalette( QPalette( egacolor[palette->left] ) );
transcol=palette->left; transcol=palette->left;
view->loops[view->CurLoop].cels[view->CurCel].transcol = transcol; view->loops[view->CurLoop].cels[view->CurCel].transcol = transcol;
} }
@ -1431,7 +1427,7 @@ void ViewEdit::set_transcolor()
void ViewEdit::set_transcolor(int col) void ViewEdit::set_transcolor(int col)
{ {
transcolor->setPalette( QPalette( egacolor[col] ) ); transcolor->setPalette( QPalette( egacolor[col] ) );
transcol=col; transcol=col;
view->loops[view->CurLoop].cels[view->CurCel].transcol = transcol; view->loops[view->CurLoop].cels[view->CurCel].transcol = transcol;
} }
@ -1458,7 +1454,7 @@ void ViewEdit::zoom_plus()
} }
/*******************************************************/ /*******************************************************/
bool ViewEdit::focusNextPrevChild ( bool ) bool ViewEdit::focusNextPrevChild ( bool )
{ {
if(width->hasFocus()){ if(width->hasFocus()){
@ -1516,7 +1512,7 @@ Animate::Animate( QWidget *parent, const char *name, Preview *p, ViewEdit *v)
close->setText("Close"); close->setText("Close");
b2->addWidget(close); b2->addWidget(close);
connect(close,SIGNAL(clicked()),SLOT(hide())); connect(close,SIGNAL(clicked()),SLOT(hide()));
timer = new QTimer(this); timer = new QTimer(this);
connect(timer,SIGNAL(timeout()), SLOT(next_cel()) ); connect(timer,SIGNAL(timeout()), SLOT(next_cel()) );
@ -1535,7 +1531,7 @@ void Animate::start_stop()
num = atoi((char *)str.latin1()); num = atoi((char *)str.latin1());
button->setText("Stop"); button->setText("Stop");
fwd = forward->isChecked(); fwd = forward->isChecked();
timer->start(num); timer->start(num);
} }
} }
@ -1562,7 +1558,7 @@ void Animate::next_cel()
/*******************************************************/ /*******************************************************/
void Animate::closeall() void Animate::closeall()
{ {
if(timer->isActive())timer->stop(); if(timer->isActive())timer->stop();
close(true); close(true);
} }
@ -1577,7 +1573,7 @@ Description::Description( QWidget *parent, const char *name , ViewEdit *v)
Q3BoxLayout *d1 = new Q3VBoxLayout(this,10); Q3BoxLayout *d1 = new Q3VBoxLayout(this,10);
d1->addSpacing(10); d1->addSpacing(10);
smallview = new ViewIcon(this,0,viewedit); smallview = new ViewIcon(this,0,viewedit);
smallview->setMinimumSize(64,64); smallview->setMinimumSize(64,64);
@ -1585,22 +1581,22 @@ Description::Description( QWidget *parent, const char *name , ViewEdit *v)
desc = new Q3MultiLineEdit(this); desc = new Q3MultiLineEdit(this);
desc->setMinimumSize(300,100); desc->setMinimumSize(300,100);
d1->addWidget(desc,1); d1->addWidget(desc,1);
Q3BoxLayout *d2 = new Q3HBoxLayout(d1,10); Q3BoxLayout *d2 = new Q3HBoxLayout(d1,10);
d2->addSpacing(10); d2->addSpacing(10);
QPushButton *ok = new QPushButton(this); QPushButton *ok = new QPushButton(this);
ok->setText("OK"); ok->setText("OK");
ok->setMaximumWidth(80); ok->setMaximumWidth(80);
connect( ok, SIGNAL(clicked()), SLOT(ok_cb()) ); connect( ok, SIGNAL(clicked()), SLOT(ok_cb()) );
d2->addWidget(ok); d2->addWidget(ok);
QPushButton *cancel = new QPushButton(this); QPushButton *cancel = new QPushButton(this);
cancel->setText("Cancel"); cancel->setText("Cancel");
cancel->setMaximumWidth(80); cancel->setMaximumWidth(80);
connect( cancel, SIGNAL(clicked()), SLOT(cancel_cb()) ); connect( cancel, SIGNAL(clicked()), SLOT(cancel_cb()) );
d2->addWidget(cancel); d2->addWidget(cancel);
adjustSize(); adjustSize();
hide(); hide();
@ -1610,7 +1606,7 @@ Description::Description( QWidget *parent, const char *name , ViewEdit *v)
//********************************************* //*********************************************
void Description::getmaxcol() void Description::getmaxcol()
//get maximum number of columns on screen (approx.) //get maximum number of columns on screen (approx.)
//to wrap the long lines //to wrap the long lines
{ {
@ -1633,10 +1629,10 @@ void Description::set()
desc->clear(); desc->clear();
if(viewedit->view->Description == ""){ if(viewedit->view->Description == ""){
return; return;
} }
string ThisLine = ""; string ThisLine = "";
string ThisMessage = viewedit->view->Description; string ThisMessage = viewedit->view->Description;
@ -1645,7 +1641,7 @@ void Description::set()
n = maxcol - ThisLine.length(); n = maxcol - ThisLine.length();
do{ n--; }while(!(n == 0 || ThisMessage[n]==' ')); do{ n--; }while(!(n == 0 || ThisMessage[n]==' '));
if (n <= 0)n = maxcol-ThisLine.length(); if (n <= 0)n = maxcol-ThisLine.length();
ThisLine += ThisMessage.substr(0,n); ThisLine += ThisMessage.substr(0,n);
ThisMessage = (n < (int)ThisMessage.length())?ThisMessage.substr(n+1):""; ThisMessage = (n < (int)ThisMessage.length())?ThisMessage.substr(n+1):"";
desc->insertLine(ThisLine.c_str(),-1); desc->insertLine(ThisLine.c_str(),-1);
ThisLine = ""; ThisLine = "";
@ -1653,13 +1649,13 @@ void Description::set()
else{ else{
ThisLine += ThisMessage; ThisLine += ThisMessage;
ThisMessage = ""; ThisMessage = "";
} }
}while(ThisMessage != ""); }while(ThisMessage != "");
if(ThisLine != ""){ if(ThisLine != ""){
desc->insertLine(ThisLine.c_str(),-1); desc->insertLine(ThisLine.c_str(),-1);
} }
} }
//********************************************* //*********************************************
@ -1724,9 +1720,9 @@ void Canvas::viewportMousePressEvent(QMouseEvent* event)
if (event->button() & Qt::LeftButton){ if (event->button() & Qt::LeftButton){
CurColor = viewedit->palette->left; CurColor = viewedit->palette->left;
} }
else if (event->button() & Qt::RightButton){ else if (event->button() & Qt::RightButton){
CurColor = viewedit->palette->right; CurColor = viewedit->palette->right;
} }
UpdateCel(x-x0,y-y0); UpdateCel(x-x0,y-y0);
viewedit->changed=true; viewedit->changed=true;
@ -1737,18 +1733,18 @@ void Canvas::viewportMouseMoveEvent(QMouseEvent* event)
{ {
int x, y; int x, y;
viewportToContents( event->x(), event->y(), x, y ); viewportToContents( event->x(), event->y(), x, y );
UpdateCel(x-x0,y-y0); UpdateCel(x-x0,y-y0);
} }
//********************************************* //*********************************************
void Canvas::drawContents(QPainter* p, int , int , int, int ) void Canvas::drawContents(QPainter* p, int , int , int, int )
{ {
if(cur_w==0 ||cur_h==0)return;
p->drawPixmap( x0, y0, pixmap );
} if(cur_w==0 ||cur_h==0)return;
p->drawPixmap( x0, y0, pixmap );
}
//********************************************* //*********************************************
void Canvas::DrawCel(int w,int h,byte *celdata,bool mirror, int size) void Canvas::DrawCel(int w,int h,byte *celdata,bool mirror, int size)
@ -1764,20 +1760,20 @@ void Canvas::DrawCel(int w,int h,byte *celdata,bool mirror, int size)
ww=(x0+w)*2*pixsize; ww=(x0+w)*2*pixsize;
hh=(y0+h)*pixsize; hh=(y0+h)*pixsize;
QPainter p(&pixmap); QPainter p(&pixmap);
data=celdata; data=celdata;
if(mirror){ if(mirror){
for(y=0;y<h;y++){ for(y=0;y<h;y++){
for(x=0;x<w*2;x+=2){ for(x=0;x<w*2;x+=2){
p.fillRect(x*pixsize,y*pixsize,pixsize*2,pixsize,egacolor[data[y*w*2+w*2-2-x]]); p.fillRect(x*pixsize,y*pixsize,pixsize*2,pixsize,egacolor[data[y*w*2+w*2-2-x]]);
} }
} }
} }
else{ else{
for(y=0;y<h;y++){ for(y=0;y<h;y++){
for(x=0;x<w*2;x+=2){ for(x=0;x<w*2;x+=2){
p.fillRect(x*pixsize,y*pixsize,pixsize*2,pixsize,egacolor[data[y*w*2+x]]); p.fillRect(x*pixsize,y*pixsize,pixsize*2,pixsize,egacolor[data[y*w*2+x]]);
} }
} }
@ -1808,21 +1804,21 @@ void Canvas::DrawCel(int w,int h,byte *celdata,bool mirror)
ww=(x0+w)*2*pixsize; ww=(x0+w)*2*pixsize;
hh=(y0+h)*pixsize; hh=(y0+h)*pixsize;
QPainter p(&pixmap); QPainter p(&pixmap);
cur_mirror = mirror; cur_mirror = mirror;
data = celdata; data = celdata;
if(mirror){ if(mirror){
for(y=0;y<h;y++){ for(y=0;y<h;y++){
for(x=0;x<w*2;x+=2){ for(x=0;x<w*2;x+=2){
p.fillRect(x*pixsize,y*pixsize,pixsize*2,pixsize,egacolor[data[y*w*2+w*2-2-x]]); p.fillRect(x*pixsize,y*pixsize,pixsize*2,pixsize,egacolor[data[y*w*2+w*2-2-x]]);
} }
} }
} }
else{ else{
for(y=0;y<h;y++){ for(y=0;y<h;y++){
for(x=0;x<w*2;x+=2){ for(x=0;x<w*2;x+=2){
p.fillRect(x*pixsize,y*pixsize,pixsize*2,pixsize,egacolor[data[y*w*2+x]]); p.fillRect(x*pixsize,y*pixsize,pixsize*2,pixsize,egacolor[data[y*w*2+x]]);
} }
} }
@ -1839,15 +1835,15 @@ void Canvas::UpdateCel(int x,int y){
int xn=x/pixsize/2; int xn=x/pixsize/2;
int yn=y/pixsize; int yn=y/pixsize;
if(xn>=0&&xn<cur_w && yn>=0&&yn<cur_h){ if(xn>=0&&xn<cur_w && yn>=0&&yn<cur_h){
QPainter p(&pixmap); QPainter p(&pixmap);
if(viewedit->drawing_mode == V_DRAW){ if(viewedit->drawing_mode == V_DRAW){
x=xn*2*pixsize; x=xn*2*pixsize;
y=yn*pixsize; y=yn*pixsize;
p.fillRect(x,y,pixsize*2,pixsize,egacolor[CurColor]); p.fillRect(x,y,pixsize*2,pixsize,egacolor[CurColor]);
repaintContents(x0+x,y0+y,pixsize*2,pixsize,false); repaintContents(x0+x,y0+y,pixsize*2,pixsize,false);
if(cur_mirror){ if(cur_mirror){
@ -1859,22 +1855,22 @@ void Canvas::UpdateCel(int x,int y){
data[yn*cur_w*2+xn*2+1]=CurColor; data[yn*cur_w*2+xn*2+1]=CurColor;
} }
} }
else{ //FILL else{ //FILL
if(cur_mirror) if(cur_mirror)
viewedit->fillCel(cur_w-1-xn,yn,CurColor); viewedit->fillCel(cur_w-1-xn,yn,CurColor);
else else
viewedit->fillCel(xn,yn,CurColor); viewedit->fillCel(xn,yn,CurColor);
} }
} }
} }
//********************************************* //*********************************************
void Canvas::keyPressEvent( QKeyEvent *k ) void Canvas::keyPressEvent( QKeyEvent *k )
{ {
// printf("key ! %d\n",k->key()); // printf("key ! %d\n",k->key());
switch(k->key()){ switch(k->key()){
case Qt::Key_Q: case Qt::Key_Q:
viewedit->previous_loop(); viewedit->previous_loop();
@ -1923,9 +1919,9 @@ void Canvas::keyPressEvent( QKeyEvent *k )
} }
//********************************************* //*********************************************
bool Canvas::focusNextPrevChild ( bool ) bool Canvas::focusNextPrevChild ( bool )
{ {
setFocus(); setFocus();
return true; return true;
@ -1959,25 +1955,25 @@ void ViewIcon::paintEvent(QPaintEvent *)
// if(pixsize*w*2>width() || pixsize*h>height()){ // if(pixsize*w*2>width() || pixsize*h>height()){
// resize(pixsize*w*2,pixsize*h); // resize(pixsize*w*2,pixsize*h);
if(mirror){ if(mirror){
for(y=0;y<h;y++){ for(y=0;y<h;y++){
for(x=0;x<w*2;x+=2){ for(x=0;x<w*2;x+=2){
p.fillRect(x*pixsize,y*pixsize,pixsize*2,pixsize,egacolor[data[y*w*2+w*2-2-x]]); p.fillRect(x*pixsize,y*pixsize,pixsize*2,pixsize,egacolor[data[y*w*2+w*2-2-x]]);
} }
} }
} }
else{ else{
for(y=0;y<h;y++){ for(y=0;y<h;y++){
for(x=0;x<w*2;x+=2){ for(x=0;x<w*2;x+=2){
p.fillRect(x*pixsize,y*pixsize,pixsize*2,pixsize,egacolor[data[y*w*2+x]]); p.fillRect(x*pixsize,y*pixsize,pixsize*2,pixsize,egacolor[data[y*w*2+x]]);
} }
} }
} }
}
}