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;
}
}
fclose(filew);
fclose(filer);
return 0;
@ -1180,10 +1180,10 @@ static unsigned int input_code(byte **input)
static void expand(byte *input, byte *output, int fileLength)
{
int next_code, new_code, old_code;
int character, /* counter=0, index, */ BITSFull /*, i */;
int character /* counter=0, index, */ /*, i */;
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 */
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" */
next_code = 258;
BITSFull = setBITS(START_BITS);
setBITS(START_BITS);
old_code = input_code(&input);
character = old_code;
*output++ = (char)character;
@ -1216,7 +1216,7 @@ static void expand(byte *input, byte *output, int fileLength)
*output++ = *string--;
if (next_code > MAX_CODE)
BITSFull = setBITS(BITS + 1);
setBITS(BITS + 1);
prefix_code[next_code] = old_code;
append_character[next_code] = character;

View File

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

View File

@ -908,11 +908,9 @@ void PCanvas::setPixsize(int s)
//*********************************************
void PCanvas::viewportMousePressEvent(QMouseEvent* event)
{
int x,y,xx,yy;
int x,y;
viewportToContents( event->x(), event->y(), x, y );
xx=x;
yy=y;
x-=x0;
y-=y0;
@ -944,11 +942,9 @@ void PCanvas::viewportMousePressEvent(QMouseEvent* event)
//*********************************************
void PCanvas::viewportMouseMoveEvent(QMouseEvent* event)
{
int x,y,xx,yy;
int x,y;
viewportToContents( event->x(), event->y(), x, y );
xx=x;
yy=y;
x-=x0;
y-=y0;
@ -1025,8 +1021,8 @@ void PCanvas::update()
if(pri_lines){
QPen pen;
pen.setStyle(Qt::DashLine);
pen.setWidth(1);
pen.setWidth(1);
//p.setPen(Qt::white);
// p.setRasterOp(XorROP);
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;
int col_pic_orig,col_pri_orig,col_pic_new,col_pri_new;
bool picDrawEnabled_orig,priDrawEnabled_orig;
bool picDrawEnabled_new,priDrawEnabled_new;
bool draw_pic_orig,draw_pri_orig,draw_pic_new,draw_pri_new;
picDrawEnabled_orig=priDrawEnabled_orig=false;
@ -833,7 +832,6 @@ void Picture::refill( struct picCodeNode *temp_fill_start, struct picCodeNode *t
temp = temp_fill_end;
picDrawEnabled_new=priDrawEnabled_new=false;
col_pic_new=col_pri_new=-1;
draw_pic_new=draw_pri_new = false;
if(temp){
@ -841,14 +839,12 @@ void Picture::refill( struct picCodeNode *temp_fill_start, struct picCodeNode *t
switch(temp->node){
case 0xf0:
col_pic_new = (temp->next)->node;
picDrawEnabled_new=true;
break;
case 0xf1:
col_pic_new = -2;
break;
case 0xf2:
col_pri_new = (temp->next)->node;
priDrawEnabled_new=true;
break;
case 0xf3:
col_pri_new = -2;

View File

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

View File

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