widget: Replace intOpenPlainForm, intDisplayPlainForm and intClosePlainForm with IntFormAnimated class.

Animation variables are no longer part of W_FORM.
master
Cyp 2013-02-28 08:29:08 +01:00
parent d372a818bd
commit 6a71410927
19 changed files with 353 additions and 824 deletions

View File

@ -57,9 +57,6 @@ W_FORMINIT::W_FORMINIT()
W_FORM::W_FORM(W_FORMINIT const *init)
: WIDGET(init, WIDG_FORM)
, disableChildren(init->disableChildren)
, Ax0(0), Ay0(0), Ax1(0), Ay1(0) // These assignments were previously done by a memset.
, animCount(0)
, startTime(0) // This assignment was previously done by a memset.
{
ASSERT((init->style & ~(WFORM_TABBED | WFORM_INVISIBLE | WFORM_CLICKABLE | WFORM_NOCLICKMOVE | WFORM_NOPRIMARY | WFORM_SECONDARY | WIDG_HIDDEN)) == 0, "Unknown style bit");
ASSERT((init->style & WFORM_TABBED) == 0 || (init->style & (WFORM_INVISIBLE | WFORM_CLICKABLE)) == 0, "Tabbed form cannot be invisible or clickable");
@ -70,9 +67,6 @@ W_FORM::W_FORM(W_FORMINIT const *init)
W_FORM::W_FORM(WIDGET *parent)
: WIDGET(parent, WIDG_FORM)
, disableChildren(false)
, Ax0(0), Ay0(0), Ax1(0), Ay1(0)
, animCount(0)
, startTime(0)
{}
W_CLICKFORM::W_CLICKFORM(W_FORMINIT const *init)

View File

@ -38,9 +38,6 @@ struct W_FORM : public WIDGET
void display(int xOffset, int yOffset);
bool disableChildren; ///< Disable all child widgets if true
UWORD Ax0, Ay0, Ax1, Ay1; ///< Working coords for animations.
UDWORD animCount; ///< Animation counter.
UDWORD startTime; ///< Animation start time
};
/* The tabbed form data structure */

View File

@ -118,6 +118,7 @@ struct WIDGET
int height() const { return dim.height(); }
void move(int x, int y) { dim.moveTo(x, y); }
void setGeometry(int x, int y, int w, int h) { dim.setRect(x, y, w, h); }
void setGeometry(QRect const &r) { dim = r; }
void attach(WIDGET *widget);
void detach(WIDGET *widget);

View File

@ -169,29 +169,22 @@ bool addChallenges()
psRequestScreen = new W_SCREEN; // init the screen
WIDGET *parent = psRequestScreen->psForm;
/* add a form to place the tabbed form on */
W_FORMINIT sFormInit;
sFormInit.formID = 0; //this adds the blue background, and the "box" behind the buttons -Q
sFormInit.id = CHALLENGE_FORM;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = (SWORD) CHALLENGE_X;
sFormInit.y = (SWORD) CHALLENGE_Y;
sFormInit.width = CHALLENGE_W;
// we need the form to be long enough for all resolutions, so we take the total number of items * height
// and * the gaps, add the banner, and finally, the fudge factor ;)
sFormInit.height = (slotsInColumn * CHALLENGE_ENTRY_H + CHALLENGE_HGAP * slotsInColumn) + CHALLENGE_BANNER_DEPTH + 20;
sFormInit.disableChildren = true;
sFormInit.pDisplay = intOpenPlainForm;
widgAddForm(psRequestScreen, &sFormInit);
IntFormAnimated *challengeForm = new IntFormAnimated(parent);
challengeForm->id = CHALLENGE_FORM;
challengeForm->setGeometry(CHALLENGE_X, CHALLENGE_Y, CHALLENGE_W, (slotsInColumn * CHALLENGE_ENTRY_H + CHALLENGE_HGAP * slotsInColumn) + CHALLENGE_BANNER_DEPTH + 20);
// Add Banner
W_FORMINIT sFormInit;
sFormInit.formID = CHALLENGE_FORM;
sFormInit.id = CHALLENGE_BANNER;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = CHALLENGE_HGAP;
sFormInit.y = CHALLENGE_VGAP;
sFormInit.width = CHALLENGE_W - (2 * CHALLENGE_HGAP);
sFormInit.height = CHALLENGE_BANNER_DEPTH;
sFormInit.disableChildren = false;
sFormInit.pDisplay = displayLoadBanner;
sFormInit.UserData = 0;
widgAddForm(psRequestScreen, &sFormInit);

View File

@ -396,19 +396,12 @@ static bool _intAddDesign(bool bShowCentreScreen)
bRender3DOnly = false;
}
WIDGET *parent = psWScreen->psForm;
/* Add the main design form */
sFormInit.formID = 0;
sFormInit.id = IDDES_FORM;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = (SWORD)DES_CENTERFORMX; //0;
sFormInit.y = (SWORD)DES_CENTERFORMY; //0;
sFormInit.width = DES_CENTERFORMWIDTH; //DISP_WIDTH-1;
sFormInit.height = DES_CENTERFORMHEIGHT; //DES_BASEHEIGHT;
sFormInit.pDisplay = intDisplayPlainForm;
if (!widgAddForm(psWScreen, &sFormInit))
{
return false;
}
IntFormAnimated *desForm = new IntFormAnimated(parent, false);
desForm->id = IDDES_FORM;
desForm->setGeometry(DES_CENTERFORMX, DES_CENTERFORMY, DES_CENTERFORMWIDTH, DES_CENTERFORMHEIGHT);
/* add the edit name box */
sEdInit.formID = IDDES_FORM;
@ -589,18 +582,9 @@ static bool _intAddDesign(bool bShowCentreScreen)
}
/* add central stats form */
sFormInit.formID = 0;
sFormInit.id = IDDES_STATSFORM;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = (SWORD)DES_STATSFORMX;
sFormInit.y = (SWORD)DES_STATSFORMY;
sFormInit.width = DES_STATSFORMWIDTH;
sFormInit.height = DES_STATSFORMHEIGHT;
sFormInit.pDisplay = intDisplayPlainForm;
if (!widgAddForm(psWScreen, &sFormInit))
{
return false;
}
IntFormAnimated *statsForm = new IntFormAnimated(parent, false);
statsForm->id = IDDES_STATSFORM;
statsForm->setGeometry(DES_STATSFORMX, DES_STATSFORMY, DES_STATSFORMWIDTH, DES_STATSFORMHEIGHT);
/* Add the body form */
sFormInit.formID = IDDES_STATSFORM;
@ -788,11 +772,8 @@ static bool _intAddDesign(bool bShowCentreScreen)
intSetDesignMode(IDES_BODY);
/* hide design and component forms until required */
if (bShowCentreScreen == false)
{
widgHide(psWScreen, IDDES_FORM);
}
widgHide(psWScreen, IDDES_STATSFORM);
desForm->show(bShowCentreScreen);
statsForm->hide();
widgHide(psWScreen, IDDES_RIGHTBASE);
return true;
@ -838,23 +819,15 @@ static bool _intAddTemplateForm(DROID_TEMPLATE *psSelected)
((DES_LEFTFORMHEIGHT - DES_TABTHICKNESS - DES_TABBUTGAP) /
(DES_TABBUTHEIGHT + DES_TABBUTGAP));
WIDGET *parent = psWScreen->psForm;
/* add a form to place the tabbed form on */
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = IDDES_TEMPLBASE;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = (SWORD)RET_X;
sFormInit.y = (SWORD)DESIGN_Y;
sFormInit.width = RET_FORMWIDTH;
sFormInit.height = DES_LEFTFORMHEIGHT + 4;
sFormInit.pDisplay = intDisplayPlainForm;
if (!widgAddForm(psWScreen, &sFormInit))
{
return false;
}
IntFormAnimated *templbaseForm = new IntFormAnimated(parent, false);
templbaseForm->id = IDDES_TEMPLBASE;
templbaseForm->setGeometry(RET_X, DESIGN_Y, RET_FORMWIDTH, DES_LEFTFORMHEIGHT + 4);
/* Add the design templates form */
sFormInit = W_FORMINIT();
W_FORMINIT sFormInit;
sFormInit.formID = IDDES_TEMPLBASE; //IDDES_FORM;
sFormInit.id = IDDES_TEMPLFORM;
sFormInit.style = WFORM_TABBED;
@ -1904,20 +1877,12 @@ static bool intAddComponentForm(UDWORD numButtons)
{
unsigned butPerForm = DES_BUTSPERFORM;
WIDGET *parent = psWScreen->psForm;
/* add a form to place the tabbed form on */
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = IDDES_RIGHTBASE;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = (SWORD)(RADTLX - 2);
sFormInit.y = (SWORD)DESIGN_Y;
sFormInit.width = RET_FORMWIDTH;
sFormInit.height = DES_RIGHTFORMHEIGHT + 4;
sFormInit.pDisplay = intDisplayPlainForm;
if (!widgAddForm(psWScreen, &sFormInit))
{
return false;
}
IntFormAnimated *rightBase = new IntFormAnimated(parent, false);
rightBase->id = IDDES_RIGHTBASE;
rightBase->setGeometry(RADTLX - 2, DESIGN_Y, RET_FORMWIDTH, DES_RIGHTFORMHEIGHT + 4);
/* Calculate how many buttons will go on a form */
//================== adds L/R Scroll buttons ===================================
@ -1957,7 +1922,7 @@ static bool intAddComponentForm(UDWORD numButtons)
}
//now a single form
sFormInit = W_FORMINIT();
W_FORMINIT sFormInit;
sFormInit.formID = IDDES_RIGHTBASE;
sFormInit.id = IDDES_COMPFORM;
sFormInit.style = WFORM_TABBED;

View File

@ -1724,36 +1724,26 @@ void addBackdrop(void)
// ////////////////////////////////////////////////////////////////////////////
void addTopForm(void)
{
W_FORMINIT sFormInit;
WIDGET *parent = widgGetFromID(psWScreen, FRONTEND_BACKDROP);
sFormInit.formID = FRONTEND_BACKDROP;
sFormInit.id = FRONTEND_TOPFORM;
sFormInit.style = WFORM_PLAIN;
if(titleMode == MULTIOPTION)
IntFormAnimated *topForm = new IntFormAnimated(parent, false);
topForm->id = FRONTEND_TOPFORM;
if (titleMode == MULTIOPTION)
{
sFormInit.x = FRONTEND_TOPFORM_WIDEX;
sFormInit.y = FRONTEND_TOPFORM_WIDEY;
sFormInit.width = FRONTEND_TOPFORM_WIDEW;
sFormInit.height= FRONTEND_TOPFORM_WIDEH;
topForm->setGeometry(FRONTEND_TOPFORM_WIDEX, FRONTEND_TOPFORM_WIDEY, FRONTEND_TOPFORM_WIDEW, FRONTEND_TOPFORM_WIDEH);
}
else
{
sFormInit.x = FRONTEND_TOPFORMX;
sFormInit.y = FRONTEND_TOPFORMY;
sFormInit.width = FRONTEND_TOPFORMW;
sFormInit.height= FRONTEND_TOPFORMH;
topForm->setGeometry(FRONTEND_TOPFORMX, FRONTEND_TOPFORMY, FRONTEND_TOPFORMW, FRONTEND_TOPFORMH);
}
sFormInit.pDisplay = intDisplayPlainForm;
widgAddForm(psWScreen, &sFormInit);
W_FORMINIT sFormInit;
sFormInit.formID= FRONTEND_TOPFORM;
sFormInit.id = FRONTEND_LOGO;
int imgW = iV_GetImageWidth(FrontImages, IMAGE_FE_LOGO);
int imgH = iV_GetImageHeight(FrontImages, IMAGE_FE_LOGO);
int dstW = sFormInit.width;
int dstH = sFormInit.height;
int dstW = topForm->width();
int dstH = topForm->height();
if (imgW*dstH < imgH*dstW) // Want to set aspect ratio dstW/dstH = imgW/imgH.
{
dstW = imgW * dstH/imgH; // Too wide.
@ -1762,8 +1752,8 @@ void addTopForm(void)
{
dstH = imgH * dstW/imgW; // Too high.
}
sFormInit.x = (sFormInit.width - dstW)/2;
sFormInit.y = (sFormInit.height - dstH)/2;
sFormInit.x = (topForm->width() - dstW)/2;
sFormInit.y = (topForm->height() - dstH)/2;
sFormInit.width = dstW;
sFormInit.height = dstH;
sFormInit.pDisplay= displayLogo;
@ -1773,20 +1763,11 @@ void addTopForm(void)
// ////////////////////////////////////////////////////////////////////////////
void addBottomForm(void)
{
W_FORMINIT sFormInit;
WIDGET *parent = widgGetFromID(psWScreen, FRONTEND_BACKDROP);
sFormInit.formID = FRONTEND_BACKDROP;
sFormInit.id = FRONTEND_BOTFORM;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = FRONTEND_BOTFORMX;
sFormInit.y = FRONTEND_BOTFORMY;
sFormInit.width = FRONTEND_BOTFORMW;
sFormInit.height = FRONTEND_BOTFORMH;
sFormInit.pDisplay = intOpenPlainForm;
sFormInit.disableChildren = true;
widgAddForm(psWScreen, &sFormInit);
IntFormAnimated *botForm = new IntFormAnimated(parent);
botForm->id = FRONTEND_BOTFORM;
botForm->setGeometry(FRONTEND_BOTFORMX, FRONTEND_BOTFORMY, FRONTEND_BOTFORMW, FRONTEND_BOTFORMH);
}
// ////////////////////////////////////////////////////////////////////////////

View File

@ -2809,30 +2809,22 @@ bool intAddReticule()
{
return true; // all fine
}
WIDGET *parent = psWScreen->psForm;
/* Create the basic form */
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = IDRET_FORM;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = RET_X;
sFormInit.y = RET_Y;
sFormInit.width = RET_FORMWIDTH;
sFormInit.height = RET_FORMHEIGHT;
sFormInit.pDisplay = intDisplayPlainForm;
if (!widgAddForm(psWScreen, &sFormInit))
{
return false;
}
else // normal reticule
{
setReticuleBut(RETBUT_COMMAND, _("Commanders (F6)"), IMAGE_COMMANDDROID_UP, WBUT_PLAIN);
setReticuleBut(RETBUT_INTELMAP, _("Intelligence Display (F5)"), IMAGE_INTELMAP_UP, WBUT_SECONDARY);
setReticuleBut(RETBUT_FACTORY, _("Manufacture (F1)"), IMAGE_MANUFACTURE_UP, WBUT_SECONDARY);
setReticuleBut(RETBUT_DESIGN, _("Design (F4)"), IMAGE_DESIGN_UP, WBUT_PLAIN);
setReticuleBut(RETBUT_RESEARCH, _("Research (F2)"), IMAGE_RESEARCH_UP, WBUT_PLAIN);
setReticuleBut(RETBUT_BUILD, _("Build (F3)"), IMAGE_BUILD_UP, WBUT_PLAIN);
setReticuleBut(RETBUT_CANCEL, _("Close"), IMAGE_CANCEL_UP, WBUT_PLAIN);
}
IntFormAnimated *retForm = new IntFormAnimated(parent, false);
retForm->id = IDRET_FORM;
retForm->setGeometry(RET_X, RET_Y, RET_FORMWIDTH, RET_FORMHEIGHT);
// normal reticule
setReticuleBut(RETBUT_COMMAND, _("Commanders (F6)"), IMAGE_COMMANDDROID_UP, WBUT_PLAIN);
setReticuleBut(RETBUT_INTELMAP, _("Intelligence Display (F5)"), IMAGE_INTELMAP_UP, WBUT_SECONDARY);
setReticuleBut(RETBUT_FACTORY, _("Manufacture (F1)"), IMAGE_MANUFACTURE_UP, WBUT_SECONDARY);
setReticuleBut(RETBUT_DESIGN, _("Design (F4)"), IMAGE_DESIGN_UP, WBUT_PLAIN);
setReticuleBut(RETBUT_RESEARCH, _("Research (F2)"), IMAGE_RESEARCH_UP, WBUT_PLAIN);
setReticuleBut(RETBUT_BUILD, _("Build (F3)"), IMAGE_BUILD_UP, WBUT_PLAIN);
setReticuleBut(RETBUT_CANCEL, _("Close"), IMAGE_CANCEL_UP, WBUT_PLAIN);
ReticuleUp = true;
return true;
}
@ -3192,21 +3184,12 @@ static bool intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,
/* Reset the current object and store the current list */
psObjSelected = NULL;
/* Create the basic form */
WIDGET *parent = psWScreen->psForm;
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = IDOBJ_FORM;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = (SWORD)OBJ_BACKX;
sFormInit.y = (SWORD)OBJ_BACKY;
sFormInit.width = OBJ_BACKWIDTH;
sFormInit.height = OBJ_BACKHEIGHT;
sFormInit.pDisplay = intDisplayPlainForm;
if (!widgAddForm(psWScreen, &sFormInit))
{
return false;
}
/* Create the basic form */
IntFormAnimated *objForm = new IntFormAnimated(parent, false);
objForm->id = IDOBJ_FORM;
objForm->setGeometry(OBJ_BACKX, OBJ_BACKY, OBJ_BACKWIDTH, OBJ_BACKHEIGHT);
/* Add the close button */
W_BUTINIT sButInit;
@ -3225,7 +3208,7 @@ static bool intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,
}
/*add the tabbed form */
sFormInit = W_FORMINIT();
W_FORMINIT sFormInit;
sFormInit.formID = IDOBJ_FORM;
sFormInit.id = IDOBJ_TABFORM;
sFormInit.style = WFORM_TABBED;
@ -3731,18 +3714,14 @@ static bool intUpdateObject(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected, boo
/* Remove the build widgets from the widget screen */
void intRemoveObject(void)
{
W_TABFORM *Form;
widgDelete(psWScreen, IDOBJ_TABFORM);
widgDelete(psWScreen, IDOBJ_CLOSE);
// Start the window close animation.
Form = (W_TABFORM *)widgGetFromID(psWScreen, IDOBJ_FORM);
IntFormAnimated *Form = (IntFormAnimated *)widgGetFromID(psWScreen, IDOBJ_FORM);
if (Form)
{
Form->displayFunction = intClosePlainForm;
Form->disableChildren = true;
Form->pUserData = NULL; // Used to signal when the close anim has finished.
Form->closeAnimate();
ClosingObject = true;
}
@ -3776,18 +3755,14 @@ static void intRemoveObjectNoAnim(void)
/* Remove the stats widgets from the widget screen */
void intRemoveStats(void)
{
W_TABFORM *Form;
widgDelete(psWScreen, IDSTAT_CLOSE);
widgDelete(psWScreen, IDSTAT_TABFORM);
// Start the window close animation.
Form = (W_TABFORM *)widgGetFromID(psWScreen, IDSTAT_FORM);
IntFormAnimated *Form = (IntFormAnimated *)widgGetFromID(psWScreen, IDSTAT_FORM);
if (Form)
{
Form->displayFunction = intClosePlainForm;
Form->pUserData = NULL; // Used to signal when the close anim has finished.
Form->disableChildren = true;
Form->closeAnimate();
ClosingStats = true;
}
@ -4162,22 +4137,12 @@ static bool intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
ClearStatBuffers();
/* Create the basic form */
WIDGET *parent = psWScreen->psForm;
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = IDSTAT_FORM;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = STAT_X;
sFormInit.y = (SWORD)STAT_Y;
sFormInit.width = STAT_WIDTH;
sFormInit.height = STAT_HEIGHT;
sFormInit.pDisplay = intDisplayPlainForm;
if (!widgAddForm(psWScreen, &sFormInit))
{
debug(LOG_ERROR, "intAddStats: Failed to add form");
return false;
}
/* Create the basic form */
IntFormAnimated *theStatForm = new IntFormAnimated(parent, false); // Called theStatForm since there's already a statForm parameter to this function
theStatForm->id = IDSTAT_FORM;
theStatForm->setGeometry(STAT_X, STAT_Y, STAT_WIDTH, STAT_HEIGHT);
W_LABINIT sLabInit;
@ -4314,7 +4279,7 @@ static bool intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
}
//==============buttons before tabbed form!==========================
// Add the tabbed form
sFormInit = W_FORMINIT();
W_FORMINIT sFormInit;
sFormInit.formID = IDSTAT_FORM;
sFormInit.id = IDSTAT_TABFORM;
sFormInit.style = WFORM_TABBED;

View File

@ -95,32 +95,21 @@ static bool addQuitOptions(void)
widgDelete(psWScreen, INTINGAMEPOPUP); // get rid of the old stuff.
}
W_FORMINIT sFormInit;
// add form
sFormInit.formID = 0;
sFormInit.id = INTINGAMEOP;
sFormInit.style = WFORM_PLAIN;
sFormInit.width = INTINGAMEOP3_W;
sFormInit.height = INTINGAMEOP3_H;;
sFormInit.x = (SWORD)INTINGAMEOP3_X;
sFormInit.y = (SWORD)INTINGAMEOP3_Y;
sFormInit.pDisplay = intOpenPlainForm;
sFormInit.disableChildren= true;
WIDGET *parent = psWScreen->psForm;
widgAddForm(psWScreen, &sFormInit);
// add form
IntFormAnimated *inGameOp = new IntFormAnimated(parent);
inGameOp->id = INTINGAMEOP;
inGameOp->setGeometry(INTINGAMEOP3_W, INTINGAMEOP3_H, INTINGAMEOP3_X, INTINGAMEOP3_Y);
addIGTextButton(INTINGAMEOP_RESUME, INTINGAMEOP_1_X, INTINGAMEOP_1_Y, INTINGAMEOP_OP_W, _("Resume Game"), OPALIGN);
addIGTextButton(INTINGAMEOP_QUIT_CONFIRM, INTINGAMEOP_1_X, INTINGAMEOP_2_Y, INTINGAMEOP_OP_W, _("Quit"), OPALIGN);
if (NetPlay.isHost && bMultiPlayer && NetPlay.bComms) // only show for real MP games
{
sFormInit.id = INTINGAMEPOPUP;
sFormInit.width = 600;
sFormInit.height = 26;
sFormInit.x = (SWORD)(20+D_W); // center it
sFormInit.y = (SWORD) 130;
widgAddForm(psWScreen, &sFormInit);
IntFormAnimated *inGamePopup = new IntFormAnimated(parent);
inGamePopup->id = INTINGAMEOP;
inGamePopup->setGeometry(600, 26, 20 + D_W, 130);
W_BUTINIT sButInit;
@ -148,21 +137,12 @@ static bool addSlideOptions(void)
widgDelete(psWScreen, INTINGAMEOP); // get rid of the old stuff.
}
W_FORMINIT sFormInit;
WIDGET *parent = psWScreen->psForm;
// add form
sFormInit.formID = 0;
sFormInit.id = INTINGAMEOP;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = (SWORD)INTINGAMEOP2_X;
sFormInit.y = (SWORD)INTINGAMEOP2_Y;
sFormInit.width = INTINGAMEOP2_W;
sFormInit.height = INTINGAMEOP2_H;
sFormInit.pDisplay = intOpenPlainForm;
sFormInit.disableChildren= true;
widgAddForm(psWScreen, &sFormInit);
IntFormAnimated *ingameOp = new IntFormAnimated(parent);
ingameOp->id = INTINGAMEOP;
ingameOp->setGeometry(INTINGAMEOP2_X, INTINGAMEOP2_Y, INTINGAMEOP2_W, INTINGAMEOP2_H);
// fx vol
addIGTextButton(INTINGAMEOP_FXVOL, INTINGAMEOP_2_X, INTINGAMEOP_1_Y, INTINGAMEOP_OP_W, _("Voice Volume"), WBUT_PLAIN);
@ -227,39 +207,17 @@ static bool _intAddInGameOptions(void)
kf_TogglePauseMode();
}
W_FORMINIT sFormInit;
sFormInit.width = INTINGAMEOP_W;
WIDGET *parent = psWScreen->psForm;
bool s = (bMultiPlayer && NetPlay.bComms != 0) || bInTutorial;
// add form
sFormInit.formID = 0;
sFormInit.id = INTINGAMEOP;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = (SWORD)INTINGAMEOP_X;
sFormInit.y = (SWORD)INTINGAMEOP_Y;
sFormInit.height = INTINGAMEOP_H;
if ((!bMultiPlayer || (NetPlay.bComms == 0)) && !bInTutorial)
{
}
else
{
sFormInit.height = INTINGAMEOP_HS;
}
sFormInit.pDisplay = intOpenPlainForm;
sFormInit.disableChildren= true;
widgAddForm(psWScreen, &sFormInit);
IntFormAnimated *ingameOp = new IntFormAnimated(parent);
ingameOp->id = INTINGAMEOP;
ingameOp->setGeometry(INTINGAMEOP_X, INTINGAMEOP_Y, INTINGAMEOP_W, s? INTINGAMEOP_HS : INTINGAMEOP_H);
// add 'quit' text
if ((!bMultiPlayer || (NetPlay.bComms == 0)) && !bInTutorial)
{
addIGTextButton(INTINGAMEOP_QUIT, INTINGAMEOP_1_X, INTINGAMEOP_5_Y, INTINGAMEOP_OP_W, _("Quit"), OPALIGN);
}
else
{
addIGTextButton(INTINGAMEOP_QUIT, INTINGAMEOP_1_X, INTINGAMEOP_3_Y, INTINGAMEOP_OP_W, _("Quit"), OPALIGN);
}
addIGTextButton(INTINGAMEOP_QUIT, INTINGAMEOP_1_X, s? INTINGAMEOP_3_Y : INTINGAMEOP_5_Y, INTINGAMEOP_OP_W, _("Quit"), OPALIGN);
// add 'resume'
addIGTextButton(INTINGAMEOP_RESUME, INTINGAMEOP_1_X, INTINGAMEOP_1_Y, INTINGAMEOP_OP_W, _("Resume Game"), OPALIGN);
@ -267,7 +225,7 @@ static bool _intAddInGameOptions(void)
// add 'options'
addIGTextButton(INTINGAMEOP_OPTIONS, INTINGAMEOP_1_X, INTINGAMEOP_2_Y, INTINGAMEOP_OP_W, _("Audio Options"), OPALIGN);
if ((!bMultiPlayer || (NetPlay.bComms == 0)) && !bInTutorial)
if (!s)
{
if (!bMultiPlayer)
{
@ -319,19 +277,11 @@ void intAddInGamePopup(void)
kf_TogglePauseMode(); // Pause the game.
}
W_FORMINIT sFormInit;
WIDGET *parent = psWScreen->psForm;
sFormInit.formID = 0;
sFormInit.id = INTINGAMEPOPUP;
sFormInit.style = WFORM_PLAIN;
sFormInit.width = 600;
sFormInit.height = 160;
sFormInit.x = (SWORD)(20+D_W);
sFormInit.y = (SWORD)((240-(160/2))+D_H);
sFormInit.pDisplay = intOpenPlainForm;
sFormInit.disableChildren= true;
widgAddForm(psWScreen, &sFormInit);
IntFormAnimated *ingamePopup = new IntFormAnimated(parent);
ingamePopup->id = INTINGAMEPOPUP;
ingamePopup->setGeometry(600, 160, 20 + D_W, (240 - 160/2) + D_H);
// add the text "buttons" now
W_BUTINIT sButInit;
@ -407,9 +357,6 @@ void intCloseInGameOptionsNoAnim(bool bResetMissionWidgets)
bool intCloseInGameOptions(bool bPutUpLoadSave, bool bResetMissionWidgets)
{
W_TABFORM *Form;
WIDGET *widg;
if (NetPlay.isHost)
{
widgDelete(psWScreen, INTINGAMEPOPUP);
@ -417,7 +364,7 @@ bool intCloseInGameOptions(bool bPutUpLoadSave, bool bResetMissionWidgets)
if(bPutUpLoadSave)
{
widg = widgGetFromID(psWScreen,INTINGAMEOP);
WIDGET *widg = widgGetFromID(psWScreen, INTINGAMEOP);
if(widg)
{
widgDelete(psWScreen,INTINGAMEOP);
@ -430,21 +377,20 @@ bool intCloseInGameOptions(bool bPutUpLoadSave, bool bResetMissionWidgets)
{
// close the form.
// Start the window close animation.
IntFormAnimated *form;
if (isInGamePopupUp) // FIXME: we hijack this routine for the popup close.
{
Form = (W_TABFORM*)widgGetFromID(psWScreen,INTINGAMEPOPUP);
form = (IntFormAnimated *)widgGetFromID(psWScreen, INTINGAMEPOPUP);
isInGamePopupUp = false;
}
else
{
Form = (W_TABFORM*)widgGetFromID(psWScreen,INTINGAMEOP);
form = (IntFormAnimated *)widgGetFromID(psWScreen, INTINGAMEOP);
}
if(Form)
if (form)
{
Form->displayFunction = intClosePlainForm;
Form->pUserData = NULL; // Used to signal when the close anim has finished.
Form->disableChildren= true;
form->closeAnimate();
ClosingInGameOp = true; // like orderup/closingorder
InGameOpUp = false;
}

View File

@ -1123,153 +1123,96 @@ static void AdjustTabFormSize(W_TABFORM *Form, int *x0, int *y0, int *x1, int *y
}
}
// Widget callback function to do the open form animation. Doesn't just open Plain Forms!!
//
void intOpenPlainForm(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
IntFormAnimated::IntFormAnimated(WIDGET *parent, bool openAnimate)
: W_FORM(parent)
, startTime(0)
, currentAction(openAnimate? 0 : 2)
{
W_TABFORM *Form = (W_TABFORM *)psWidget;
UDWORD Tx0, Ty0, Tx1, Ty1;
UDWORD Range;
UDWORD Duration;
UDWORD APos;
SDWORD Ay0, Ay1;
Tx0 = xOffset + Form->x();
Ty0 = yOffset + Form->y();
Tx1 = Tx0 + Form->width();
Ty1 = Ty0 + Form->height();
if (Form->animCount == 0)
{
if ((FormOpenAudioID >= 0) && (FormOpenCount == 0))
{
audio_PlayTrack(FormOpenAudioID);
FormOpenCount++;
}
Form->Ax0 = (UWORD)Tx0;
Form->Ax1 = (UWORD)Tx1;
Form->Ay0 = (UWORD)(Ty0 + (Form->height() / 2) - 4);
Form->Ay1 = (UWORD)(Ty0 + (Form->height() / 2) + 4);
Form->startTime = realTime;
}
else
{
FormOpenCount = 0;
}
RenderWindowFrame(FRAME_NORMAL, Form->Ax0, Form->Ay0, Form->Ax1 - Form->Ax0, Form->Ay1 - Form->Ay0);
Form->animCount++;
Range = (Form->height() / 2) - 4;
Duration = (realTime - Form->startTime) << 16 ;
APos = (Range * (Duration / FORM_OPEN_ANIM_DURATION)) >> 16;
Ay0 = Ty0 + (Form->height() / 2) - 4 - APos;
Ay1 = Ty0 + (Form->height() / 2) + 4 + APos;
if (Ay0 <= (SDWORD)Ty0)
{
Ay0 = Ty0;
}
if (Ay1 >= (SDWORD)Ty1)
{
Ay1 = Ty1;
}
Form->Ay0 = (UWORD)Ay0;
Form->Ay1 = (UWORD)Ay1;
if ((Form->Ay0 == Ty0) && (Form->Ay1 == Ty1))
{
if (Form->pUserData != NULL)
{
Form->displayFunction = (WIDGET_DISPLAY)Form->pUserData;
}
else
{
//default to display
Form->displayFunction = intDisplayPlainForm;
}
Form->disableChildren = false;
Form->animCount = 0;
}
disableChildren = openAnimate;
}
// Widget callback function to do the close form animation.
//
void intClosePlainForm(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
void IntFormAnimated::closeAnimate()
{
W_TABFORM *Form = (W_TABFORM *)psWidget;
UDWORD Ty0, Ty1;
UDWORD Range;
UDWORD Duration;
UDWORD APos;
currentAction = 3;
disableChildren = true;
pUserData = nullptr; // Used to signal when the close anim has finished.
}
Ty0 = yOffset + Form->y() + (Form->height() / 2) - 4;
Ty1 = yOffset + Form->y() + (Form->height() / 2) + 4;
bool IntFormAnimated::isClosed() const
{
return currentAction == 5;
}
if (Form->animCount == 0)
void IntFormAnimated::display(int xOffset, int yOffset)
{
QRect aOpen(xOffset + x(), yOffset + y(), width(), height());
QRect aClosed(aOpen.x(), aOpen.y() + aOpen.height()/2 - 4, aOpen.width(), 8);
QRect aBegin;
QRect aEnd;
switch (currentAction)
{
if ((FormCloseAudioID >= 0) && (FormCloseCount == 0))
case 1: FormOpenCount = 0; break;
case 4: FormCloseCount = 0; break;
}
switch (currentAction)
{
case 0: // Start opening.
if (FormOpenAudioID >= 0 && FormOpenCount == 0)
{
audio_PlayTrack(FormOpenAudioID);
++FormOpenCount;
}
startTime = realTime;
++currentAction;
// No break.
case 1: // Continue opening.
aBegin = aClosed;
aEnd = aOpen;
break;
case 2: // Open.
aBegin = aOpen;
aEnd = aOpen;
startTime = realTime;
break;
case 3: // Start closing.
if (FormCloseAudioID >= 0 && FormCloseCount == 0)
{
audio_PlayTrack(FormCloseAudioID);
FormCloseCount++;
}
startTime = realTime;
++currentAction;
// No break.
case 4: // Continue closing.
aBegin = aOpen;
aEnd = aClosed;
break;
case 5: // Closed.
aBegin = aClosed;
aEnd = aClosed;
startTime = realTime;
break;
}
int den = FORM_OPEN_ANIM_DURATION;
int num = std::min<unsigned>(realTime - startTime, den);
if (num == den)
{
++currentAction;
switch (currentAction)
{
audio_PlayTrack(FormCloseAudioID);
FormCloseCount++;
case 2: disableChildren = false; break;
case 5: pUserData = (void *)1; break;
}
Form->Ax0 = (UWORD)(xOffset + Form->x());
Form->Ay0 = (UWORD)(yOffset + Form->y());
Form->Ax1 = (UWORD)(Form->Ax0 + Form->width());
Form->Ay1 = (UWORD)(Form->Ay0 + Form->height());
Form->startTime = realTime;
}
else
{
FormCloseCount = 0;
}
RenderWindowFrame(FRAME_NORMAL, Form->Ax0, Form->Ay0, Form->Ax1 - Form->Ax0, Form->Ay1 - Form->Ay0);
QRect aCur = QRect(aBegin.x() + (aEnd.x() - aBegin.x()) *num/den,
aBegin.y() + (aEnd.y() - aBegin.y()) *num/den,
aBegin.width() + (aEnd.width() - aBegin.width()) *num/den,
aBegin.height() + (aEnd.height() - aBegin.height())*num/den);
Form->animCount++;
Range = (Form->height() / 2) - 4;
Duration = (realTime - Form->startTime) << 16 ;
APos = (Range * (Duration / FORM_OPEN_ANIM_DURATION)) >> 16;
Form->Ay0 = (UWORD)(yOffset + Form->y() + APos);
Form->Ay1 = (UWORD)(yOffset + Form->y() + Form->height() - APos);
if (Form->Ay0 >= Ty0)
{
Form->Ay0 = (UWORD)Ty0;
}
if (Form->Ay1 <= Ty1)
{
Form->Ay1 = (UWORD)Ty1;
}
if ((Form->Ay0 == Ty0) && (Form->Ay1 == Ty1))
{
Form->pUserData = (void *)1;
Form->animCount = 0;
}
RenderWindowFrame(FRAME_NORMAL, aCur.x(), aCur.y(), aCur.width(), aCur.height());
}
void intDisplayPlainForm(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
{
W_TABFORM *Form = (W_TABFORM *)psWidget;
int x0 = xOffset + Form->x();
int y0 = yOffset + Form->y();
int x1 = x0 + Form->width();
int y1 = y0 + Form->height();
RenderWindowFrame(FRAME_NORMAL, x0, y0, x1 - x0, y1 - y0);
}
void intDisplayStatsForm(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
{
W_TABFORM *Form = (W_TABFORM *)psWidget;

View File

@ -153,11 +153,22 @@ void intDisplayStatsButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset);
void intDisplayStatsForm(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset);
void intOpenPlainForm(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset);
/// Form which animates opening/closing.
struct IntFormAnimated : public W_FORM
{
IntFormAnimated(WIDGET *parent, bool openAnimate = true);
void intClosePlainForm(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset);
void display(int xOffset, int yOffset);
void intDisplayPlainForm(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset);
void closeAnimate();
bool isClosed() const;
private:
void displayOpening(int xOffset, int yOffset);
unsigned startTime; ///< Animation start time
int currentAction; ///< Opening/open/closing/closed.
};
void intDisplayImage(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset);

View File

@ -242,35 +242,12 @@ bool intAddIntelMap(void)
//set pause states before putting the interface up
setIntelligencePauseState();
W_FORMINIT sFormInit;
WIDGET *parent = psWScreen->psForm;
// Add the main Intelligence Map form
sFormInit.formID = 0;
sFormInit.id = IDINTMAP_FORM;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = (SWORD)INTMAP_X;
sFormInit.y = (SWORD)INTMAP_Y;
sFormInit.width = INTMAP_WIDTH;
sFormInit.height = INTMAP_HEIGHT;
// If the window was closed then do open animation.
if(Animate)
{
sFormInit.pDisplay = intOpenPlainForm;
sFormInit.disableChildren = true;
}
else
{
// otherwise just recreate it.
sFormInit.pDisplay = intDisplayPlainForm;
}
//sFormInit.pDisplay = intDisplayPlainForm;
if (!widgAddForm(psWScreen, &sFormInit))
{
return false;
}
IntFormAnimated *intMapForm = new IntFormAnimated(parent, Animate); // Do not animate the opening, if the window was already open.
intMapForm->id = IDINTMAP_FORM;
intMapForm->setGeometry(INTMAP_X, INTMAP_Y, INTMAP_WIDTH, INTMAP_HEIGHT);
if (!intAddMessageForm(playCurrent))
{
@ -477,39 +454,17 @@ bool intAddMessageView(MESSAGE * psMessage)
intCloseMultiMenuNoAnim();
}
/* Add the base form */
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = IDINTMAP_MSGVIEW;
sFormInit.style = WFORM_PLAIN;
//size and position depends on the type of message - ONLY RESEARCH now
sFormInit.width = INTMAP_RESEARCHWIDTH;
sFormInit.height = INTMAP_RESEARCHHEIGHT;
sFormInit.x = (SWORD)INTMAP_RESEARCHX;
sFormInit.y = (SWORD)INTMAP_RESEARCHY;
WIDGET *parent = psWScreen->psForm;
// If the window was closed then do open animation.
if(Animate)
{
sFormInit.pDisplay = intOpenPlainForm;
sFormInit.disableChildren = true;
}
else
{
// otherwise just display it.
sFormInit.pDisplay = intDisplayPlainForm;
}
if (!widgAddForm(psWScreen, &sFormInit))
{
return false;
}
IntFormAnimated *intMapMsgView = new IntFormAnimated(parent, Animate); // Do not animate the opening, if the window was already open.
intMapMsgView->id = IDINTMAP_MSGVIEW;
intMapMsgView->setGeometry(INTMAP_RESEARCHX, INTMAP_RESEARCHY, INTMAP_RESEARCHWIDTH, INTMAP_RESEARCHHEIGHT);
/* Add the close box */
W_BUTINIT sButInit;
sButInit.formID = IDINTMAP_MSGVIEW;
sButInit.id = IDINTMAP_CLOSE;
sButInit.x = (SWORD)(sFormInit.width - OPT_GAP - CLOSE_SIZE);
sButInit.x = intMapMsgView->width() - OPT_GAP - CLOSE_SIZE;
sButInit.y = OPT_GAP;
sButInit.width = CLOSE_SIZE;
sButInit.height = CLOSE_SIZE;
@ -530,8 +485,7 @@ bool intAddMessageView(MESSAGE * psMessage)
psViewReplay = (VIEW_REPLAY *)((VIEWDATA *)psMessage->pViewData)->pData;
/* Add a big tabbed text box for the subtitle text */
sFormInit = W_FORMINIT();
W_FORMINIT sFormInit;
sFormInit.id = IDINTMAP_SEQTEXT;
sFormInit.formID = IDINTMAP_MSGVIEW;
sFormInit.style = WFORM_TABBED;
@ -615,8 +569,7 @@ bool intAddMessageView(MESSAGE * psMessage)
}
/*Add the PIE box*/
sFormInit = W_FORMINIT();
W_FORMINIT sFormInit;
sFormInit.formID = IDINTMAP_MSGVIEW;
sFormInit.id = IDINITMAP_PIEVIEW;
sFormInit.style = WFORM_PLAIN;
@ -1004,23 +957,18 @@ static void intCleanUpIntelMap(void)
/* Remove the Intelligence Map widgets from the screen */
void intRemoveIntelMap(void)
{
WIDGET *Widg;
W_TABFORM *Form;
//remove 3dView if still there
Widg = widgGetFromID(psWScreen,IDINTMAP_MSGVIEW);
WIDGET *Widg = widgGetFromID(psWScreen, IDINTMAP_MSGVIEW);
if(Widg)
{
intRemoveMessageView(false);
}
// Start the window close animation.
Form = (W_TABFORM*)widgGetFromID(psWScreen,IDINTMAP_FORM);
if(Form)
IntFormAnimated *form = (IntFormAnimated *)widgGetFromID(psWScreen, IDINTMAP_FORM);
if (form)
{
Form->displayFunction = intClosePlainForm;
Form->disableChildren = true;
Form->pUserData = NULL; // Used to signal when the close anim has finished.
form->closeAnimate();
}
ClosingIntelMap = true;
//remove the text label
@ -1061,36 +1009,29 @@ void intRemoveIntelMapNoAnim(void)
/* Remove the Message View from the Intelligence screen */
void intRemoveMessageView(bool animated)
{
W_TABFORM *Form;
VIEW_RESEARCH *psViewResearch;
//remove 3dView if still there
Form = (W_TABFORM*)widgGetFromID(psWScreen,IDINTMAP_MSGVIEW);
if(Form)
IntFormAnimated *form = (IntFormAnimated *)widgGetFromID(psWScreen, IDINTMAP_MSGVIEW);
if (form == nullptr)
{
return;
}
//stop the video
psViewResearch = (VIEW_RESEARCH *)Form->pUserData;
seq_RenderVideoToBuffer(psViewResearch->sequenceName, SEQUENCE_KILL);
//stop the video
VIEW_RESEARCH *psViewResearch = (VIEW_RESEARCH *)form->pUserData;
seq_RenderVideoToBuffer(psViewResearch->sequenceName, SEQUENCE_KILL);
if (animated)
{
if (animated)
{
widgDelete(psWScreen, IDINTMAP_CLOSE);
widgDelete(psWScreen, IDINTMAP_CLOSE);
// Start the window close animation.
Form->displayFunction = intClosePlainForm;
Form->disableChildren = true;
Form->pUserData = NULL; // Used to signal when the close anim has finished.
ClosingMessageView = true;
}
else
{
//remove without the animating close window
widgDelete(psWScreen, IDINTMAP_MSGVIEW);
}
// Start the window close animation.
form->closeAnimate();
ClosingMessageView = true;
}
else
{
//remove without the animating close window
delete form;
}
}

View File

@ -441,7 +441,6 @@ bool intAddOrder(BASE_OBJECT *psObj)
bool Animate = true;
SECONDARY_STATE State;
UWORD OrdIndex;
W_FORM *Form;
UWORD Height, NumDisplayedOrders;
UWORD NumButs;
UWORD NumJustifyButs, NumCombineButs, NumCombineBefore;
@ -535,28 +534,12 @@ bool intAddOrder(BASE_OBJECT *psObj)
}
}
/* Create the basic form */
WIDGET *parent = psWScreen->psForm;
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = IDORDER_FORM;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = ORDER_X;
sFormInit.y = ORDER_Y;
sFormInit.width = ORDER_WIDTH;
sFormInit.height = ORDER_HEIGHT;
// If the window was closed then do open animation.
if(Animate) {
sFormInit.pDisplay = intOpenPlainForm;
sFormInit.disableChildren = true;
} else {
// otherwise just recreate it.
sFormInit.pDisplay = intDisplayPlainForm;
}
if (!widgAddForm(psWScreen, &sFormInit))
{
return false;
}
/* Create the basic form */
IntFormAnimated *orderForm = new IntFormAnimated(parent, Animate); // Do not animate the opening, if the window was already open.
orderForm->id = IDORDER_FORM;
orderForm->setGeometry(ORDER_X, ORDER_Y, ORDER_WIDTH, ORDER_HEIGHT);
// Add the close button.
W_BUTINIT sButInit;
@ -621,15 +604,15 @@ bool intAddOrder(BASE_OBJECT *psObj)
break;
case ORD_JUSTIFY_RIGHT:
sButInit.x = (SWORD)(sFormInit.width - ORDER_BUTX -
( ((NumJustifyButs * GetImageWidth(IntImages,OrderButtons[OrdIndex].ButImageID[0])) +
((NumJustifyButs-1) * ORDER_BUTGAP ) ) ));
sButInit.x = orderForm->width() - ORDER_BUTX -
(NumJustifyButs * GetImageWidth(IntImages, OrderButtons[OrdIndex].ButImageID[0]) +
(NumJustifyButs - 1) * ORDER_BUTGAP);
break;
case ORD_JUSTIFY_CENTER:
sButInit.x = ((SWORD)((sFormInit.width ) -
( ((NumJustifyButs * GetImageWidth(IntImages,OrderButtons[OrdIndex].ButImageID[0])) +
((NumJustifyButs-1) * ORDER_BUTGAP ) ))))/2;
sButInit.x = (orderForm->width() -
(NumJustifyButs * GetImageWidth(IntImages, OrderButtons[OrdIndex].ButImageID[0]) +
(NumJustifyButs - 1) * ORDER_BUTGAP))/2;
break;
case ORD_JUSTIFY_COMBINE:
@ -667,9 +650,9 @@ bool intAddOrder(BASE_OBJECT *psObj)
else
{
// center the buttons
sButInit.x = (SWORD)((sFormInit.width / 2) -
( ((NumCombineButs * GetImageWidth(IntImages,OrderButtons[OrdIndex].ButImageID[0])) +
((NumCombineButs-1) * ORDER_BUTGAP ) ) / 2 ));
sButInit.x = orderForm->width()/2 -
(NumCombineButs * GetImageWidth(IntImages, OrderButtons[OrdIndex].ButImageID[0]) +
(NumCombineButs - 1) * ORDER_BUTGAP)/2;
sButInit.x = (SWORD)(sButInit.x +
(GetImageWidth(IntImages,OrderButtons[OrdIndex].ButImageID[0]) + ORDER_BUTGAP ) * NumCombineBefore);
}
@ -774,8 +757,7 @@ bool intAddOrder(BASE_OBJECT *psObj)
// Now we know how many orders there are we can resize the form accordingly.
int newHeight = Height + CLOSE_HEIGHT + ORDER_BUTGAP;
Form = (W_FORM*)widgGetFromID(psWScreen,IDORDER_FORM);
Form->setGeometry(Form->x(), ORDER_BOTTOMY - newHeight, Form->width(), newHeight);
orderForm->setGeometry(orderForm->x(), ORDER_BOTTOMY - newHeight, orderForm->width(), newHeight);
OrderUp = true;
@ -1094,17 +1076,13 @@ bool intRefreshOrder(void)
//
void intRemoveOrder(void)
{
W_TABFORM *Form;
widgDelete(psWScreen, IDORDER_CLOSE);
// Start the window close animation.
Form = (W_TABFORM*)widgGetFromID(psWScreen,IDORDER_FORM);
if (Form)
IntFormAnimated *form = (IntFormAnimated *)widgGetFromID(psWScreen, IDORDER_FORM);
if (form != nullptr)
{
Form->displayFunction = intClosePlainForm;
Form->pUserData = NULL; // Used to signal when the close anim has finished.
Form->disableChildren = true;
form->closeAnimate();
ClosingOrder = true;
OrderUp = false;
SelectedDroids.clear();

View File

@ -306,16 +306,12 @@ bool startKeyMapEditor(bool first)
{
loadKeyMap(); // get the current mappings.
}
W_FORMINIT sFormInit;
sFormInit.formID = FRONTEND_BACKDROP;
sFormInit.id = KM_FORM;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = KM_X;
sFormInit.y = KM_Y;
sFormInit.width = KM_W;
sFormInit.height = KM_H;
sFormInit.pDisplay = intDisplayPlainForm;
widgAddForm(psWScreen, &sFormInit);
WIDGET *parent = widgGetFromID(psWScreen, FRONTEND_BACKDROP);
IntFormAnimated *kmForm = new IntFormAnimated(parent, false);
kmForm->id = KM_FORM;
kmForm->setGeometry(KM_X, KM_Y, KM_W, KM_H);
addMultiBut(psWScreen,KM_FORM,KM_RETURN, // return button.
8,5,
@ -349,7 +345,7 @@ bool startKeyMapEditor(bool first)
}
// add tab form..
sFormInit = W_FORMINIT();
W_FORMINIT sFormInit;
sFormInit.formID = KM_FORM;
sFormInit.id = KM_FORM_TABS;
sFormInit.style = WFORM_TABBED;

View File

@ -195,29 +195,23 @@ bool addLoadSave(LOADSAVE_MODE savemode, const char *title)
psRequestScreen = new W_SCREEN;
WIDGET *parent = psRequestScreen->psForm;
/* add a form to place the tabbed form on */
W_FORMINIT sFormInit;
sFormInit.formID = 0; //this adds the blue background, and the "box" behind the buttons -Q
sFormInit.id = LOADSAVE_FORM;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = (SWORD) LOADSAVE_X;
sFormInit.y = (SWORD) LOADSAVE_Y;
sFormInit.width = LOADSAVE_W;
// we need the form to be long enough for all resolutions, so we take the total number of items * height
// and * the gaps, add the banner, and finally, the fudge factor ;)
sFormInit.height = (slotsInColumn * LOADENTRY_H + LOADSAVE_HGAP* slotsInColumn)+ LOADSAVE_BANNER_DEPTH+20;
sFormInit.disableChildren = true;
sFormInit.pDisplay = intOpenPlainForm;
widgAddForm(psRequestScreen, &sFormInit);
IntFormAnimated *loadSaveForm = new IntFormAnimated(parent);
loadSaveForm->id = LOADSAVE_FORM;
loadSaveForm->setGeometry(LOADSAVE_X, LOADSAVE_Y, LOADSAVE_W, slotsInColumn*(LOADENTRY_H + LOADSAVE_HGAP) + LOADSAVE_BANNER_DEPTH + 20);
// Add Banner
W_FORMINIT sFormInit;
sFormInit.formID = LOADSAVE_FORM;
sFormInit.id = LOADSAVE_BANNER;
sFormInit.x = LOADSAVE_HGAP;
sFormInit.y = LOADSAVE_VGAP;
sFormInit.width = LOADSAVE_W-(2*LOADSAVE_HGAP);
sFormInit.height = LOADSAVE_BANNER_DEPTH;
sFormInit.disableChildren = false;
sFormInit.pDisplay = displayLoadBanner;
sFormInit.UserData = bLoad;
widgAddForm(psRequestScreen, &sFormInit);

View File

@ -2251,48 +2251,19 @@ static bool _intAddMissionResult(bool result, bool bPlaySuccess)
sFormInit.formID = 0;
sFormInit.id = IDMISSIONRES_BACKFORM;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = (SWORD)(0 + D_W);
sFormInit.y = (SWORD)(0 + D_H);
sFormInit.width = 640;
sFormInit.height = 480;
sFormInit.pDisplay = intDisplayMissionBackDrop;
if (!widgAddForm(psWScreen, &sFormInit))
{
return false;
}
W_FORM *missionResBackForm = widgAddForm(psWScreen, &sFormInit);
missionResBackForm->setGeometry(0 + D_W, 0 + D_H, 640, 480);
// TITLE
sFormInit.formID = IDMISSIONRES_BACKFORM;
sFormInit.id = IDMISSIONRES_TITLE;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = MISSIONRES_TITLE_X;
sFormInit.y = MISSIONRES_TITLE_Y;
sFormInit.width = MISSIONRES_TITLE_W;
sFormInit.height = MISSIONRES_TITLE_H;
sFormInit.disableChildren = true;
sFormInit.pDisplay = intOpenPlainForm; //intDisplayPlainForm;
if (!widgAddForm(psWScreen, &sFormInit))
{
return false;
}
IntFormAnimated *missionResTitle = new IntFormAnimated(missionResBackForm);
missionResTitle->id = IDMISSIONRES_TITLE;
missionResTitle->setGeometry(MISSIONRES_TITLE_X, MISSIONRES_TITLE_Y, MISSIONRES_TITLE_W, MISSIONRES_TITLE_H);
// add form
sFormInit.formID = IDMISSIONRES_BACKFORM;
sFormInit.id = IDMISSIONRES_FORM;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = MISSIONRES_X;
sFormInit.y = MISSIONRES_Y;
sFormInit.width = MISSIONRES_W;
sFormInit.height = MISSIONRES_H;
sFormInit.disableChildren = true;
sFormInit.pDisplay = intOpenPlainForm; //intDisplayPlainForm;
if (!widgAddForm(psWScreen, &sFormInit))
{
return false;
}
IntFormAnimated *missionResForm = new IntFormAnimated(missionResBackForm);
missionResForm->id = IDMISSIONRES_FORM;
missionResForm->setGeometry(MISSIONRES_X, MISSIONRES_Y, MISSIONRES_W, MISSIONRES_H);
// description of success/fail
W_LABINIT sLabInit;

View File

@ -1202,21 +1202,12 @@ void startGameFind(void)
{
addBackdrop(); //background image
W_FORM *parent = (W_FORM *)widgGetFromID(psWScreen, FRONTEND_BACKDROP);
WIDGET *parent = widgGetFromID(psWScreen, FRONTEND_BACKDROP);
// draws the background of the games listed
W_FORMINIT sFormInit;
sFormInit.formID = FRONTEND_BACKDROP;
sFormInit.id = FRONTEND_BOTFORM;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = MULTIOP_OPTIONSX;
sFormInit.y = MULTIOP_OPTIONSY;
sFormInit.width = MULTIOP_CHATBOXW;
sFormInit.height = 415; // FIXME: Add box at bottom for server messages
sFormInit.pDisplay = intOpenPlainForm;
sFormInit.disableChildren = true;
widgAddForm(psWScreen, &sFormInit);
IntFormAnimated *botForm = new IntFormAnimated(parent);
botForm->id = FRONTEND_BOTFORM;
botForm->setGeometry(MULTIOP_OPTIONSX, MULTIOP_OPTIONSY, MULTIOP_CHATBOXW, 415); // FIXME: Add box at bottom for server messages
addSideText(FRONTEND_SIDETEXT, MULTIOP_OPTIONSX-3, MULTIOP_OPTIONSY,_("GAMES"));
@ -1243,11 +1234,9 @@ void startGameFind(void)
// Password stuff. Hidden by default.
// draws the background of the password box
W_FORM *passwordForm = new W_FORM(parent);
IntFormAnimated *passwordForm = new IntFormAnimated(parent);
passwordForm->id = FRONTEND_PASSWORDFORM;
passwordForm->setGeometry(FRONTEND_BOTFORMX, 160, FRONTEND_TOPFORMW, FRONTEND_TOPFORMH - 40);
passwordForm->displayFunction = intOpenPlainForm;
passwordForm->disableChildren = true;
// password label.
W_LABEL *enterPasswordLabel = new W_LABEL(passwordForm);
@ -1394,16 +1383,12 @@ static void addGameOptions()
iV_SetFont(font_regular);
W_FORMINIT sFormInit; // draw options box.
sFormInit.formID = FRONTEND_BACKDROP;
sFormInit.id = MULTIOP_OPTIONS;
sFormInit.x = MULTIOP_OPTIONSX;
sFormInit.y = MULTIOP_OPTIONSY;
sFormInit.style = WFORM_PLAIN;
sFormInit.width = MULTIOP_OPTIONSW;
sFormInit.height = MULTIOP_OPTIONSH;
sFormInit.pDisplay = intDisplayPlainForm;
widgAddForm(psWScreen, &sFormInit);
WIDGET *parent = widgGetFromID(psWScreen, FRONTEND_BACKDROP);
// draw options box.
IntFormAnimated *optionsForm = new IntFormAnimated(parent, false);
optionsForm->id = MULTIOP_OPTIONS;
optionsForm->setGeometry(MULTIOP_OPTIONSX, MULTIOP_OPTIONSY, MULTIOP_OPTIONSW, MULTIOP_OPTIONSH);
addSideText(FRONTEND_SIDETEXT3, MULTIOP_OPTIONSX-3 , MULTIOP_OPTIONSY,_("OPTIONS"));
@ -1678,16 +1663,11 @@ static void addDifficultyChooser(int player)
widgDelete(psWScreen, FRONTEND_SIDETEXT2);
difficultyChooserUp = player;
W_FORMINIT sFormInit;
sFormInit.formID = FRONTEND_BACKDROP;
sFormInit.id = MULTIOP_AI_FORM; // reuse
sFormInit.x = MULTIOP_PLAYERSX;
sFormInit.y = MULTIOP_PLAYERSY;
sFormInit.style = WFORM_PLAIN;
sFormInit.width = MULTIOP_PLAYERSW;
sFormInit.height = MULTIOP_PLAYERSH;
sFormInit.pDisplay = intDisplayPlainForm;
widgAddForm(psWScreen, &sFormInit);
WIDGET *parent = widgGetFromID(psWScreen, FRONTEND_BACKDROP);
IntFormAnimated *aiForm = new IntFormAnimated(parent, false);
aiForm->id = MULTIOP_AI_FORM;
aiForm->setGeometry(MULTIOP_PLAYERSX, MULTIOP_PLAYERSY, MULTIOP_PLAYERSW, MULTIOP_PLAYERSH);
addSideText(FRONTEND_SIDETEXT2, MULTIOP_PLAYERSX - 3, MULTIOP_PLAYERSY, _("DIFFICULTY"));
@ -1723,16 +1703,11 @@ static void addAiChooser(int player)
widgDelete(psWScreen, FRONTEND_SIDETEXT2);
aiChooserUp = player;
W_FORMINIT sFormInit;
sFormInit.formID = FRONTEND_BACKDROP;
sFormInit.id = MULTIOP_AI_FORM;
sFormInit.x = MULTIOP_PLAYERSX;
sFormInit.y = MULTIOP_PLAYERSY;
sFormInit.style = WFORM_PLAIN;
sFormInit.width = MULTIOP_PLAYERSW;
sFormInit.height = MULTIOP_PLAYERSH;
sFormInit.pDisplay = intDisplayPlainForm;
widgAddForm(psWScreen, &sFormInit);
WIDGET *parent = widgGetFromID(psWScreen, FRONTEND_BACKDROP);
IntFormAnimated *aiForm = new IntFormAnimated(parent, false);
aiForm->id = MULTIOP_AI_FORM;
aiForm->setGeometry(MULTIOP_PLAYERSX, MULTIOP_PLAYERSY, MULTIOP_PLAYERSW, MULTIOP_PLAYERSH);
addSideText(FRONTEND_SIDETEXT2, MULTIOP_PLAYERSX - 3, MULTIOP_PLAYERSY, _("CHOOSE AI"));
@ -2334,16 +2309,12 @@ void addPlayerBox(bool players)
return;
}
W_FORMINIT sFormInit; // draw player window
sFormInit.formID = FRONTEND_BACKDROP;
sFormInit.id = MULTIOP_PLAYERS;
sFormInit.x = MULTIOP_PLAYERSX;
sFormInit.y = MULTIOP_PLAYERSY;
sFormInit.style = WFORM_PLAIN;
sFormInit.width = MULTIOP_PLAYERSW;
sFormInit.height = MULTIOP_PLAYERSH;
sFormInit.pDisplay = intDisplayPlainForm;
widgAddForm(psWScreen, &sFormInit);
// draw player window
WIDGET *parent = widgGetFromID(psWScreen, FRONTEND_BACKDROP);
IntFormAnimated *playersForm = new IntFormAnimated(parent, false);
playersForm->id = MULTIOP_PLAYERS;
playersForm->setGeometry(MULTIOP_PLAYERSX, MULTIOP_PLAYERSY, MULTIOP_PLAYERSW, MULTIOP_PLAYERSH);
addSideText(FRONTEND_SIDETEXT2, MULTIOP_PLAYERSX-3, MULTIOP_PLAYERSY,_("PLAYERS"));
@ -2526,18 +2497,11 @@ static void addChatBox(void)
return;
}
W_FORMINIT sFormInit;
WIDGET *parent = widgGetFromID(psWScreen, FRONTEND_BACKDROP);
sFormInit.formID = FRONTEND_BACKDROP; // add the form
sFormInit.id = MULTIOP_CHATBOX;
sFormInit.x = MULTIOP_CHATBOXX;
sFormInit.y = MULTIOP_CHATBOXY;
sFormInit.style = WFORM_PLAIN;
sFormInit.width = MULTIOP_CHATBOXW;
sFormInit.height = MULTIOP_CHATBOXH;
sFormInit.disableChildren = true; // wait till open!
sFormInit.pDisplay = intOpenPlainForm;//intDisplayPlainForm;
widgAddForm(psWScreen, &sFormInit);
IntFormAnimated *chatBox = new IntFormAnimated(parent);
chatBox->id = MULTIOP_CHATBOX;
chatBox->setGeometry(MULTIOP_CHATBOXX, MULTIOP_CHATBOXY, MULTIOP_CHATBOXW, MULTIOP_CHATBOXH);
addSideText(FRONTEND_SIDETEXT4,MULTIOP_CHATBOXX-3,MULTIOP_CHATBOXY,_("CHAT"));
@ -2589,18 +2553,11 @@ static void addConsoleBox(void)
return;
}
W_FORMINIT sFormInit;
WIDGET *parent = widgGetFromID(psWScreen, FRONTEND_BACKDROP);
sFormInit.formID = FRONTEND_BACKDROP; // add the form
sFormInit.id = MULTIOP_CONSOLEBOX;
sFormInit.x = MULTIOP_CONSOLEBOXX;
sFormInit.y = MULTIOP_CONSOLEBOXY;
sFormInit.style = WFORM_PLAIN;
sFormInit.width = MULTIOP_CONSOLEBOXW;
sFormInit.height = MULTIOP_CONSOLEBOXH;
sFormInit.disableChildren = true; // wait till open!
sFormInit.pDisplay = intOpenPlainForm;
widgAddForm(psWScreen, &sFormInit);
IntFormAnimated *consoleBox = new IntFormAnimated(parent);
consoleBox->id = MULTIOP_CONSOLEBOX;
consoleBox->setGeometry(MULTIOP_CONSOLEBOXX, MULTIOP_CONSOLEBOXY, MULTIOP_CONSOLEBOXW, MULTIOP_CONSOLEBOXH);
flushConsoleMessages(); // add the chatbox.
initConsoleMessages();

View File

@ -164,16 +164,11 @@ bool startLimitScreen(void)
addSideText(FRONTEND_SIDETEXT1,LIMITSX-2,LIMITSY,"LIMITS"); // draw sidetext...
W_FORMINIT sFormInit;
sFormInit.formID = FRONTEND_BACKDROP;
sFormInit.id = IDLIMITS;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = LIMITSX;
sFormInit.y = LIMITSY;
sFormInit.width = LIMITSW;
sFormInit.height = LIMITSH;
sFormInit.pDisplay = intDisplayPlainForm;
widgAddForm(psWScreen, &sFormInit);
WIDGET *parent = widgGetFromID(psWScreen, FRONTEND_BACKDROP);
IntFormAnimated *limitsForm = new IntFormAnimated(parent, false);
limitsForm->id = IDLIMITS;
limitsForm->setGeometry(LIMITSX, LIMITSY, LIMITSW, LIMITSH);
// return button.
addMultiBut(psWScreen,IDLIMITS,IDLIMITS_RETURN,
@ -203,7 +198,7 @@ bool startLimitScreen(void)
if(numButtons >(4*BUTPERFORM)) numButtons =(4*BUTPERFORM);
// add tab form..
sFormInit = W_FORMINIT();
W_FORMINIT sFormInit;
sFormInit.formID = IDLIMITS;
sFormInit.id = IDLIMITS_TABS;
sFormInit.style = WFORM_TABBED;

View File

@ -421,21 +421,15 @@ void addMultiRequest(const char* searchDir, const char* fileExtension, UDWORD mo
/* Calculate how many buttons will go on a single form */
butPerForm = ((M_REQUEST_W - 0 - 4) / (R_BUT_W +4)) * ((M_REQUEST_H - 0- 4) / (R_BUT_H+ 4));
WIDGET *parent = psRScreen->psForm;
/* add a form to place the tabbed form on */
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = M_REQUEST;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = (SWORD)(M_REQUEST_X+D_W);
sFormInit.y = (SWORD)(M_REQUEST_Y+D_H);
sFormInit.width = M_REQUEST_W;
sFormInit.height = M_REQUEST_H;
sFormInit.disableChildren = true;
sFormInit.pDisplay = intOpenPlainForm;
widgAddForm(psRScreen, &sFormInit);
IntFormAnimated *requestForm = new IntFormAnimated(parent);
requestForm->id = M_REQUEST;
requestForm->setGeometry(M_REQUEST_X + D_W, M_REQUEST_Y + D_H, M_REQUEST_W, M_REQUEST_H);
/* Add the tabs */
sFormInit = W_FORMINIT();
W_FORMINIT sFormInit;
sFormInit.formID = M_REQUEST;
sFormInit.id = M_REQUEST_TAB;
sFormInit.style = WFORM_TABBED;
@ -1203,22 +1197,12 @@ bool addDebugMenu(bool bAdd)
formHeight += DEBUGMENU_ENTRY_H;
}
// add form
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = DEBUGMENU;
sFormInit.style = WFORM_PLAIN;
sFormInit.x =(SWORD)(DEBUGMENU_FORM_X);
sFormInit.y =(SWORD)(DEBUGMENU_FORM_Y);
sFormInit.width = DEBUGMENU_FORM_W;
sFormInit.height = formHeight;
sFormInit.pDisplay = intOpenPlainForm;
sFormInit.disableChildren = true;
WIDGET *parent = psWScreen->psForm;
if (!widgAddForm(psWScreen, &sFormInit))
{
return false;
}
// add form
IntFormAnimated *debugMenu = new IntFormAnimated(parent);
debugMenu->id = DEBUGMENU;
debugMenu->setGeometry(DEBUGMENU_FORM_X, DEBUGMENU_FORM_Y, DEBUGMENU_FORM_W, formHeight);
// add debug info
pos = 0;
@ -1227,7 +1211,7 @@ bool addDebugMenu(bool bAdd)
if(strcmp(debugMenuEntry[i],""))
{
// add form
sFormInit = W_FORMINIT();
W_FORMINIT sFormInit;
sFormInit.formID = DEBUGMENU;
sFormInit.id = DEBUGMENU_CLOSE + pos + 1;
sFormInit.style = WFORM_PLAIN;
@ -1282,22 +1266,12 @@ bool intAddMultiMenu(void)
intResetScreen(false);
}
// add form
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = MULTIMENU_FORM;
sFormInit.style = WFORM_PLAIN;
sFormInit.x =(SWORD)(MULTIMENU_FORM_X);
sFormInit.y =(SWORD)(MULTIMENU_FORM_Y);
sFormInit.width = MULTIMENU_FORM_W;
sFormInit.height = MULTIMENU_PLAYER_H*game.maxPlayers + MULTIMENU_PLAYER_H + 7;
sFormInit.pDisplay = intOpenPlainForm;
sFormInit.disableChildren = true;
WIDGET *parent = psWScreen->psForm;
if (!widgAddForm(psWScreen, &sFormInit))
{
return false;
}
// add form
IntFormAnimated *multiMenuForm = new IntFormAnimated(parent);
multiMenuForm->id = MULTIMENU_FORM;
multiMenuForm->setGeometry(MULTIMENU_FORM_X, MULTIMENU_FORM_Y, MULTIMENU_FORM_W, MULTIMENU_PLAYER_H*game.maxPlayers + MULTIMENU_PLAYER_H + 7);
// add any players
for(i=0;i<MAX_PLAYERS;i++)
@ -1354,8 +1328,6 @@ void intCloseMultiMenuNoAnim(void)
// ////////////////////////////////////////////////////////////////////////////
bool intCloseMultiMenu(void)
{
W_TABFORM *Form;
if (!MultiMenuUp)
{
return true;
@ -1364,11 +1336,10 @@ bool intCloseMultiMenu(void)
widgDelete(psWScreen, MULTIMENU_CLOSE);
// Start the window close animation.
Form = (W_TABFORM*)widgGetFromID(psWScreen,MULTIMENU_FORM);
if(Form) {
Form->displayFunction = intClosePlainForm;
Form->pUserData = NULL; // Used to signal when the close anim has finished.
Form->disableChildren = true;
IntFormAnimated *form = (IntFormAnimated *)widgGetFromID(psWScreen, MULTIMENU_FORM);
if (form != nullptr)
{
form->closeAnimate();
ClosingMultiMenu = true;
MultiMenuUp = false;
}

View File

@ -219,30 +219,11 @@ static bool _intAddTransporter(DROID *psSelected, bool offWorld)
Animate = false;
}
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = IDTRANS_FORM;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = (SWORD)TRANS_X;
sFormInit.y = (SWORD)TRANS_Y;
sFormInit.width = TRANS_WIDTH;
sFormInit.height = TRANS_HEIGHT;
// If the window was closed then do open animation.
if (Animate)
{
sFormInit.pDisplay = intOpenPlainForm;
sFormInit.disableChildren = true;
}
else
{
// otherwise just recreate it.
sFormInit.pDisplay = intDisplayPlainForm;
}
WIDGET *parent = psWScreen->psForm;
if (!widgAddForm(psWScreen, &sFormInit))
{
return false;
}
IntFormAnimated *transForm = new IntFormAnimated(parent, Animate); // Do not animate the opening, if the window was already open.
transForm->id = IDTRANS_FORM;
transForm->setGeometry(TRANS_X, TRANS_Y, TRANS_WIDTH, TRANS_HEIGHT);
/* Add the close button */
W_BUTINIT sButInit;
@ -300,30 +281,11 @@ bool intAddTransporterContents(void)
Animate = false;
}
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = IDTRANS_CONTENTFORM;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = (SWORD)TRANSCONT_X;
sFormInit.y = (SWORD)TRANSCONT_Y;
sFormInit.width = TRANSCONT_WIDTH;
sFormInit.height = TRANSCONT_HEIGHT;
// If the window was closed then do open animation.
if (Animate)
{
sFormInit.pDisplay = intOpenPlainForm;
sFormInit.disableChildren = true;
}
else
{
// otherwise just recreate it.
sFormInit.pDisplay = intDisplayPlainForm;
}
WIDGET *parent = psWScreen->psForm;
if (!widgAddForm(psWScreen, &sFormInit))
{
return false;
}
IntFormAnimated *transContentForm = new IntFormAnimated(parent, Animate); // Do not animate the opening, if the window was already open.
transContentForm->id = IDTRANS_CONTENTFORM;
transContentForm->setGeometry(TRANSCONT_X, TRANSCONT_Y, TRANSCONT_WIDTH, TRANSCONT_HEIGHT);
/* Add the close button */
W_BUTINIT sButInit;
@ -730,32 +692,12 @@ bool intAddDroidsAvailForm(void)
Animate = false;
}
WIDGET *parent = psWScreen->psForm;
/* Add the droids available form */
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = IDTRANS_DROIDS;
sFormInit.style = WFORM_PLAIN;
sFormInit.width = TRANSDROID_WIDTH;
sFormInit.height = TRANSDROID_HEIGHT;
sFormInit.x = (SWORD)TRANSDROID_X;
sFormInit.y = (SWORD)TRANSDROID_Y;
// If the window was closed then do open animation.
if (Animate)
{
sFormInit.pDisplay = intOpenPlainForm;
sFormInit.disableChildren = true;
}
else
{
// otherwise just recreate it.
sFormInit.pDisplay = intDisplayPlainForm;
}
if (!widgAddForm(psWScreen, &sFormInit))
{
return false;
}
IntFormAnimated *transDroids = new IntFormAnimated(parent, Animate); // Do not animate the opening, if the window was already open.
transDroids->id = IDTRANS_DROIDS;
transDroids->setGeometry(TRANSDROID_WIDTH, TRANSDROID_HEIGHT, TRANSDROID_X, TRANSDROID_Y);
/* Add the close button */
W_BUTINIT sButInit;
@ -774,7 +716,7 @@ bool intAddDroidsAvailForm(void)
}
//now add the tabbed droids available form
sFormInit = W_FORMINIT();
W_FORMINIT sFormInit;
sFormInit.formID = IDTRANS_DROIDS;
sFormInit.id = IDTRANS_DROIDTAB;
sFormInit.style = WFORM_TABBED;
@ -1088,15 +1030,11 @@ static void _intProcessTransporter(UDWORD id)
/* Remove the Transporter widgets from the screen */
void intRemoveTrans(void)
{
W_TABFORM *Form;
// Start the window close animation.
Form = (W_TABFORM *)widgGetFromID(psWScreen, IDTRANS_FORM);
if (Form)
IntFormAnimated *form = (IntFormAnimated *)widgGetFromID(psWScreen, IDTRANS_FORM);
if (form)
{
Form->displayFunction = intClosePlainForm;
Form->disableChildren = true;
Form->pUserData = NULL; // Used to signal when the close anim has finished.
form->closeAnimate();
ClosingTrans = true;
}
@ -1118,15 +1056,11 @@ void intRemoveTransNoAnim(void)
/* Remove the Transporter Content widgets from the screen */
void intRemoveTransContent(void)
{
W_TABFORM *Form;
// Start the window close animation.
Form = (W_TABFORM *)widgGetFromID(psWScreen, IDTRANS_CONTENTFORM);
if (Form)
IntFormAnimated *form = (IntFormAnimated *)widgGetFromID(psWScreen, IDTRANS_CONTENTFORM);
if (form)
{
Form->displayFunction = intClosePlainForm;
Form->disableChildren = true;
Form->pUserData = NULL; // Used to signal when the close anim has finished.
form->closeAnimate();
ClosingTransCont = true;
}
}
@ -1141,15 +1075,11 @@ void intRemoveTransContentNoAnim(void)
/* Remove the Transporter Droids Avail widgets from the screen */
void intRemoveTransDroidsAvail(void)
{
W_TABFORM *Form;
// Start the window close animation.
Form = (W_TABFORM *)widgGetFromID(psWScreen, IDTRANS_DROIDS);
if (Form)
IntFormAnimated *form = (IntFormAnimated *)widgGetFromID(psWScreen, IDTRANS_DROIDS);
if (form)
{
Form->displayFunction = intClosePlainForm;
Form->disableChildren = true;
Form->pUserData = NULL; // Used to signal when the close anim has finished.
form->closeAnimate();
ClosingTransDroids = true;
//remember which tab we were on
widgGetTabs(psWScreen, IDTRANS_DROIDTAB, &objMajor);