/* Display a clickable form */ void formDisplayClickable(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours) { UDWORD x0,y0,x1,y1; W_CLICKFORM *psForm; psForm = (W_CLICKFORM *)psWidget; x0 = psWidget->x + xOffset; y0 = psWidget->y + yOffset; x1 = x0 + psWidget->width; y1 = y0 + psWidget->height; /* Fill the background */ pie_BoxFill(x0 + 1, y0 + 1, x1 - 1, y1 - 1, pColours[WCOL_BKGRND]); /* Display the border */ if (psForm->state & (WCLICK_DOWN | WCLICK_LOCKED | WCLICK_CLICKLOCK)) { /* Form down */ iV_Line(x0,y1,x0,y0, pColours[WCOL_DARK]); iV_Line(x0,y0,x1,y0, pColours[WCOL_DARK]); iV_Line(x1,y0,x1,y1, pColours[WCOL_LIGHT]); iV_Line(x1,y1,x0,y1, pColours[WCOL_LIGHT]); } else { /* Form up */ iV_Line(x0,y1,x0,y0, pColours[WCOL_LIGHT]); iV_Line(x0,y0,x1,y0, pColours[WCOL_LIGHT]); iV_Line(x1,y0,x1,y1, pColours[WCOL_DARK]); iV_Line(x1,y1,x0,y1, pColours[WCOL_DARK]); } }
/* Display a form */ void formDisplay(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours) { UDWORD x0,y0,x1,y1; if (!(psWidget->style & WFORM_INVISIBLE)) { x0 = psWidget->x + xOffset; y0 = psWidget->y + yOffset; x1 = x0 + psWidget->width; y1 = y0 + psWidget->height; pie_BoxFill(x0 + 1, y0 + 1, x1 - 1, y1 - 1, pColours[WCOL_BKGRND]); iV_Line(x0,y1,x0,y0, pColours[WCOL_LIGHT]); iV_Line(x0,y0,x1,y0, pColours[WCOL_LIGHT]); iV_Line(x1,y0,x1,y1, pColours[WCOL_DARK]); iV_Line(x1,y1,x0,y1, pColours[WCOL_DARK]); } }
/* Draw bottom tabs */ static void formDisplayBTabs(W_TABFORM *psForm,SDWORD x0, SDWORD y0, UDWORD width, UDWORD height, UDWORD number, UDWORD selected, UDWORD hilite, PIELIGHT *pColours,UDWORD TabType,UDWORD TabGap) { SDWORD x,x1, y1; UDWORD i; #if NO_DISPLAY_SINGLE_TABS if (number == 1) { /* Don't display single tabs */ return; } #endif x = x0 + 2; x1 = x + width - 2; y1 = y0 + height; for (i=0; i < number; i++) { if(psForm->pTabDisplay) { psForm->pTabDisplay((WIDGET*)psForm,TabType,WFORM_TABBOTTOM,i,i==selected,i==hilite,x,y0,width,height); } else { if (i == selected) { /* Fill in the tab */ pie_BoxFill(x + 1, y0, x1 - 1, y1 - 1, pColours[WCOL_BKGRND]); /* Draw the outline */ iV_Line(x,y0, x,y1-1, pColours[WCOL_LIGHT]); iV_Line(x,y1, x1-3,y1, pColours[WCOL_DARK]); iV_Line(x1-2,y1, x1,y1-2, pColours[WCOL_DARK]); iV_Line(x1,y1-3, x1,y0+1, pColours[WCOL_DARK]); } else { /* Fill in the tab */ pie_BoxFill(x + 1, y0 + 1, x1 - 1, y1 - 2, pColours[WCOL_BKGRND]); /* Draw the outline */ iV_Line(x,y0+1, x,y1-1, pColours[WCOL_LIGHT]); iV_Line(x+1,y1-1, x1-3,y1-1, pColours[WCOL_DARK]); iV_Line(x1-2,y1-1, x1,y1-3, pColours[WCOL_DARK]); iV_Line(x1,y1-4, x1,y0+1, pColours[WCOL_DARK]); } if (i == hilite) { /* Draw the hilite box */ iV_Box(x+2,y0+3, x1-3, y1-4, pColours[WCOL_HILITE]); } } x += width + TabGap; x1 += width + TabGap; } }
/* The simple bar graph display function */ void barGraphDisplay(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pColours) { SDWORD x0,y0, x1,y1; W_BARGRAPH *psBGraph; psBGraph = (W_BARGRAPH *)psWidget; /* figure out which way the bar graph fills */ switch (psBGraph->barPos) { case WBAR_LEFT: x0 = xOffset + psWidget->x; y0 = yOffset + psWidget->y; x1 = x0 + psWidget->width * psBGraph->majorSize / WBAR_SCALE; y1 = y0 + psWidget->height; break; case WBAR_RIGHT: y0 = yOffset + psWidget->y; x1 = xOffset + psWidget->x + psWidget->width; x0 = x1 - psWidget->width * psBGraph->majorSize / WBAR_SCALE; y1 = y0 + psWidget->height; break; case WBAR_TOP: x0 = xOffset + psWidget->x; y0 = yOffset + psWidget->y; x1 = x0 + psWidget->width; y1 = y0 + psWidget->height * psBGraph->majorSize / WBAR_SCALE; break; case WBAR_BOTTOM: x0 = xOffset + psWidget->x; x1 = x0 + psWidget->width; y1 = yOffset + psWidget->y + psWidget->height; y0 = y1 - psWidget->height * psBGraph->majorSize / WBAR_SCALE; break; } /* Now draw the graph */ pie_BoxFillIndex(x0,y0, x1,y1,psBGraph->majorCol); iV_Line(x0,y1, x0,y0,*(pColours + WCOL_LIGHT)); iV_Line(x0,y0, x1,y0,*(pColours + WCOL_LIGHT)); iV_Line(x1,y0, x1,y1,*(pColours + WCOL_DARK)); iV_Line(x0,y1, x1,y1,*(pColours + WCOL_DARK)); }
/* The slider display function */ void sliderDisplay(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours) { W_SLIDER *psSlider; SWORD x0,y0, x1,y1; UWORD width = 0, height = 0; psSlider = (W_SLIDER *)psWidget; switch (psSlider->orientation) { case WSLD_LEFT: case WSLD_RIGHT: /* Draw the line */ x0 = (SWORD)(psSlider->x + xOffset + psSlider->barSize/(SWORD)2); y0 = (SWORD)(psSlider->y + yOffset + psSlider->height/(SWORD)2); x1 = (SWORD)(x0 + psSlider->width - psSlider->barSize); iV_Line(x0,y0, x1,y0, pColours[WCOL_DARK]); iV_Line(x0,y0+1, x1,y0+1, pColours[WCOL_LIGHT]); /* Now Draw the bar */ sliderGetBarBox(psSlider, &x0,&y0, &width,&height); x0 = (SWORD)(x0 + psSlider->x + xOffset); y0 = (SWORD)(y0 + psSlider->y + yOffset); x1 = (SWORD)(x0 + width); y1 = (SWORD)(y0 + height); pie_BoxFill(x0, y0, x1, y1, pColours[WCOL_BKGRND]); iV_Line(x0,y0, x1,y0, pColours[WCOL_LIGHT]); iV_Line(x0,y0, x0,y1, pColours[WCOL_LIGHT]); iV_Line(x1,y0, x1,y1, pColours[WCOL_DARK]); iV_Line(x0,y1, x1,y1, pColours[WCOL_DARK]); break; case WSLD_TOP: case WSLD_BOTTOM: /* Draw the line */ x0 = (SWORD)(psSlider->x + xOffset + psSlider->width/(SWORD)2); y0 = (SWORD)(psSlider->y + yOffset + psSlider->barSize/(SWORD)2); y1 = (SWORD)(y0 + psSlider->height - psSlider->barSize); iV_Line(x0,y0, x0,y1, pColours[WCOL_DARK]); iV_Line(x0+1,y0, x0+1,y1, pColours[WCOL_LIGHT]); /* Now Draw the bar */ sliderGetBarBox(psSlider, &x0,&y0, &width,&height); x0 = (SWORD)(x0 + psSlider->x + xOffset); y0 = (SWORD)(y0 + psSlider->y + yOffset); x1 = (SWORD)(x0 + width); y1 = (SWORD)(y0 + height); pie_BoxFill(x0, y0, x1, y1, pColours[WCOL_BKGRND]); iV_Line(x0,y0, x1,y0, pColours[WCOL_LIGHT]); iV_Line(x0,y0, x0,y1, pColours[WCOL_LIGHT]); iV_Line(x1,y0, x1,y1, pColours[WCOL_DARK]); iV_Line(x0,y1, x1,y1, pColours[WCOL_DARK]); break; } if (psSlider->state & SLD_HILITE) { x0 = (SWORD)(psWidget->x + xOffset - 2); y0 = (SWORD)(psWidget->y + yOffset - 2); x1 = (SWORD)(x0 + psWidget->width + 4); y1 = (SWORD)(y0 + psWidget->height + 4); iV_Line(x0,y0, x1,y0, pColours[WCOL_HILITE]); iV_Line(x1,y0, x1,y1, pColours[WCOL_HILITE]); iV_Line(x0,y1, x1,y1, pColours[WCOL_HILITE]); iV_Line(x0,y0, x0,y1, pColours[WCOL_HILITE]); } }
/* Display a button */ void buttonDisplay(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours) { W_BUTTON *psButton; SDWORD x0,y0,x1,y1, fx,fy,fw; int CurrFontID; ASSERT(psWidget != NULL && pColours != NULL, "Invalid pointers"); if (!psWidget || !pColours) { return; } psButton = (W_BUTTON *)psWidget; CurrFontID = psButton->FontID; x0=psButton->x + xOffset; y0=psButton->y + yOffset; x1=x0 + psButton->width; y1=y0 + psButton->height; if (psButton->state & (WBUTS_DOWN | WBUTS_LOCKED | WBUTS_CLICKLOCK)) { /* Display the button down */ pie_BoxFill(x0, y0, x1, y1, pColours[WCOL_BKGRND]); iV_Line(x0,y0, x1,y0, pColours[WCOL_DARK]); iV_Line(x0,y0, x0,y1, pColours[WCOL_DARK]); iV_Line(x0,y1, x1,y1, pColours[WCOL_LIGHT]); iV_Line(x1,y1, x1,y0, pColours[WCOL_LIGHT]); if (psButton->pText) { iV_SetFont(psButton->FontID); iV_SetTextColour(pColours[WCOL_TEXT]); fw = iV_GetTextWidth(psButton->pText); if(psButton->style & WBUT_NOCLICKMOVE) { fx = x0 + (psButton->width - fw) / 2 + 1; fy = y0 + 1 + (psButton->height - iV_GetTextLineSize())/2 - iV_GetTextAboveBase(); } else { fx = x0 + (psButton->width - fw) / 2; fy = y0 + (psButton->height - iV_GetTextLineSize())/2 - iV_GetTextAboveBase(); } iV_DrawText(psButton->pText,fx,fy); } if (psButton->state & WBUTS_HILITE) { /* Display the button hilite */ iV_Line(x0+3,y0+3, x1-2,y0+3, pColours[WCOL_HILITE]); iV_Line(x0+3,y0+3, x0+3,y1-2, pColours[WCOL_HILITE]); iV_Line(x0+3,y1-2, x1-2,y1-2, pColours[WCOL_HILITE]); iV_Line(x1-2,y1-2, x1-2,y0+3, pColours[WCOL_HILITE]); } } else if (psButton->state & WBUTS_GREY) { /* Display the disabled button */ pie_BoxFill(x0, y0, x1, y1, pColours[WCOL_BKGRND]); iV_Line(x0,y0, x1,y0, pColours[WCOL_LIGHT]); iV_Line(x0,y0, x0,y1, pColours[WCOL_LIGHT]); iV_Line(x0,y1, x1,y1, pColours[WCOL_DARK]); iV_Line(x1,y1, x1,y0, pColours[WCOL_DARK]); if (psButton->pText) { iV_SetFont(psButton->FontID); fw = iV_GetTextWidth(psButton->pText); fx = x0 + (psButton->width - fw) / 2; fy = y0 + (psButton->height - iV_GetTextLineSize())/2 - iV_GetTextAboveBase(); iV_SetTextColour(pColours[WCOL_LIGHT]); iV_DrawText(psButton->pText, fx+1, fy+1); iV_SetTextColour(pColours[WCOL_DISABLE]); iV_DrawText(psButton->pText, fx, fy); } if (psButton->state & WBUTS_HILITE) { /* Display the button hilite */ iV_Line(x0+2,y0+2, x1-3,y0+2, pColours[WCOL_HILITE]); iV_Line(x0+2,y0+2, x0+2,y1-3, pColours[WCOL_HILITE]); iV_Line(x0+2,y1-3, x1-3,y1-3, pColours[WCOL_HILITE]); iV_Line(x1-3,y1-3, x1-3,y0+2, pColours[WCOL_HILITE]); } } else { /* Display the button up */ pie_BoxFill(x0, y0, x1, y1, pColours[WCOL_BKGRND]); iV_Line(x0,y0, x1,y0, pColours[WCOL_LIGHT]); iV_Line(x0,y0, x0,y1, pColours[WCOL_LIGHT]); iV_Line(x0,y1, x1,y1, pColours[WCOL_DARK]); iV_Line(x1,y1, x1,y0, pColours[WCOL_DARK]); if (psButton->pText) { iV_SetFont(psButton->FontID); iV_SetTextColour(pColours[WCOL_TEXT]); fw = iV_GetTextWidth(psButton->pText); fx = x0 + (psButton->width - fw) / 2; fy = y0 + (psButton->height - iV_GetTextLineSize())/2 - iV_GetTextAboveBase(); iV_DrawText(psButton->pText, fx, fy); } if (psButton->state & WBUTS_HILITE) { /* Display the button hilite */ iV_Line(x0+2,y0+2, x1-3,y0+2, pColours[WCOL_HILITE]); iV_Line(x0+2,y0+2, x0+2,y1-3, pColours[WCOL_HILITE]); iV_Line(x0+2,y1-3, x1-3,y1-3, pColours[WCOL_HILITE]); iV_Line(x1-3,y1-3, x1-3,y0+2, pColours[WCOL_HILITE]); } } }
/* Display a button */ void buttonDisplay(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pColours) { W_BUTTON *psButton; SDWORD x0,y0,x1,y1, fx,fy,fw; // PROP_FONT *psCurrFont; int CurrFontID; ASSERT((PTRVALID(psWidget, sizeof(W_BUTTON)), "buttonDisplay: Invalid widget pointer")); psButton = (W_BUTTON *)psWidget; // psCurrFont = psButton->psFont; CurrFontID = psButton->FontID; x0=psButton->x + xOffset; y0=psButton->y + yOffset; x1=x0 + psButton->width; y1=y0 + psButton->height; if (psButton->state & (WBUTS_DOWN | WBUTS_LOCKED | WBUTS_CLICKLOCK)) { /* Display the button down */ pie_BoxFillIndex(x0,y0,x1,y1,WCOL_BKGRND); iV_Line(x0,y0, x1,y0,*(pColours + WCOL_DARK)); iV_Line(x0,y0, x0,y1,*(pColours + WCOL_DARK)); iV_Line(x0,y1, x1,y1,*(pColours + WCOL_LIGHT)); iV_Line(x1,y1, x1,y0,*(pColours + WCOL_LIGHT)); if (psButton->pText) { iV_SetFont(psButton->FontID); iV_SetTextColour((UWORD)*(pColours + WCOL_TEXT)); fw = iV_GetTextWidth(psButton->pText); if(psButton->style & WBUT_NOCLICKMOVE) { fx = x0 + (psButton->width - fw) / 2 + 1; fy = y0 + 1 + (psButton->height - iV_GetTextLineSize())/2 - iV_GetTextAboveBase(); } else { fx = x0 + (psButton->width - fw) / 2; fy = y0 + (psButton->height - iV_GetTextLineSize())/2 - iV_GetTextAboveBase(); } iV_DrawText(psButton->pText,fx,fy); } if (psButton->state & WBUTS_HILITE) { /* Display the button hilite */ iV_Line(x0+3,y0+3, x1-2,y0+3,*(pColours + WCOL_HILITE)); iV_Line(x0+3,y0+3, x0+3,y1-2,*(pColours + WCOL_HILITE)); iV_Line(x0+3,y1-2, x1-2,y1-2,*(pColours + WCOL_HILITE)); iV_Line(x1-2,y1-2, x1-2,y0+3,*(pColours + WCOL_HILITE)); } } else if (psButton->state & WBUTS_GREY) { /* Display the disabled button */ pie_BoxFillIndex(x0,y0,x1,y1,WCOL_BKGRND); iV_Line(x0,y0, x1,y0,*(pColours + WCOL_LIGHT)); iV_Line(x0,y0, x0,y1,*(pColours + WCOL_LIGHT)); iV_Line(x0,y1, x1,y1,*(pColours + WCOL_DARK)); iV_Line(x1,y1, x1,y0,*(pColours + WCOL_DARK)); if (psButton->pText) { iV_SetFont(psButton->FontID); fw = iV_GetTextWidth(psButton->pText); fx = x0 + (psButton->width - fw) / 2; fy = y0 + (psButton->height - iV_GetTextLineSize())/2 - iV_GetTextAboveBase(); iV_SetTextColour((UWORD)*(pColours + WCOL_LIGHT)); iV_DrawText(psButton->pText,fx+1,fy+1); iV_SetTextColour((UWORD)*(pColours + WCOL_DISABLE)); iV_DrawText(psButton->pText,fx,fy); } if (psButton->state & WBUTS_HILITE) { /* Display the button hilite */ iV_Line(x0+2,y0+2, x1-3,y0+2,*(pColours + WCOL_HILITE)); iV_Line(x0+2,y0+2, x0+2,y1-3,*(pColours + WCOL_HILITE)); iV_Line(x0+2,y1-3, x1-3,y1-3,*(pColours + WCOL_HILITE)); iV_Line(x1-3,y1-3, x1-3,y0+2,*(pColours + WCOL_HILITE)); } } else { /* Display the button up */ pie_BoxFillIndex(x0,y0,x1,y1,WCOL_BKGRND); iV_Line(x0,y0, x1,y0,*(pColours + WCOL_LIGHT)); iV_Line(x0,y0, x0,y1,*(pColours + WCOL_LIGHT)); iV_Line(x0,y1, x1,y1,*(pColours + WCOL_DARK)); iV_Line(x1,y1, x1,y0,*(pColours + WCOL_DARK)); //if (0) if (psButton->pText) { iV_SetFont(psButton->FontID); iV_SetTextColour((UWORD)*(pColours + WCOL_TEXT)); fw = iV_GetTextWidth(psButton->pText); fx = x0 + (psButton->width - fw) / 2; fy = y0 + (psButton->height - iV_GetTextLineSize())/2 - iV_GetTextAboveBase(); iV_DrawText(psButton->pText,fx,fy); } if (psButton->state & WBUTS_HILITE) { /* Display the button hilite */ iV_Line(x0+2,y0+2, x1-3,y0+2,*(pColours + WCOL_HILITE)); iV_Line(x0+2,y0+2, x0+2,y1-3,*(pColours + WCOL_HILITE)); iV_Line(x0+2,y1-3, x1-3,y1-3,*(pColours + WCOL_HILITE)); iV_Line(x1-3,y1-3, x1-3,y0+2,*(pColours + WCOL_HILITE)); } } }
/* The edit box display function */ void editBoxDisplay(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours) { W_EDITBOX *psEdBox; SDWORD x0,y0,x1,y1, fx,fy, cx,cy; enum iV_fonts CurrFontID; #if CURSOR_BLINK bool blink; #endif psEdBox = (W_EDITBOX *)psWidget; CurrFontID = psEdBox->FontID; x0=psEdBox->x + xOffset; y0=psEdBox->y + yOffset; x1=x0 + psEdBox->width; y1=y0 + psEdBox->height; if(psEdBox->pBoxDisplay) { psEdBox->pBoxDisplay((WIDGET *)psEdBox, xOffset, yOffset, pColours); } else { pie_BoxFill(x0, y0, x1, y1, pColours[WCOL_BKGRND]); iV_Line(x0,y0, x1,y0, pColours[WCOL_DARK]); iV_Line(x0,y0, x0,y1, pColours[WCOL_DARK]); iV_Line(x0,y1, x1,y1, pColours[WCOL_LIGHT]); iV_Line(x1,y1, x1,y0, pColours[WCOL_LIGHT]); } fx = x0 + WEDB_XGAP;// + (psEdBox->width - fw) / 2; iV_SetFont(CurrFontID); iV_SetTextColour(pColours[WCOL_TEXT]); fy = y0 + (psEdBox->height - iV_GetTextLineSize())/2 - iV_GetTextAboveBase(); /* If there is more text than will fit into the box, display the bit with the cursor in it */ QString tmp = psEdBox->aText; tmp.remove(0, psEdBox->printStart); // Erase anything there isn't room to display. tmp.remove(psEdBox->printChars, tmp.length()); // if(psEdBox->pFontDisplay) { // psEdBox->pFontDisplay(fx,fy, pPrint); // } else { iV_DrawText(tmp.toUtf8().constData(), fx, fy); // } // Display the cursor if editing #if CURSOR_BLINK blink = !(((wzGetTicks() - psEdBox->blinkOffset)/WEDB_BLINKRATE) % 2); if ((psEdBox->state & WEDBS_MASK) == WEDBS_INSERT && blink) #else if ((psEdBox->state & WEDBS_MASK) == WEDBS_INSERT) #endif { // insert mode QString tmp = psEdBox->aText; tmp.remove(psEdBox->insPos, tmp.length()); // Erase from the cursor on, to find where the cursor should be. tmp.remove(0, psEdBox->printStart); cx = x0 + WEDB_XGAP + iV_GetTextWidth(tmp.toUtf8().constData()); cx += iV_GetTextWidth("-"); cy = fy; iV_Line(cx, cy + iV_GetTextAboveBase(), cx, cy - iV_GetTextBelowBase(), pColours[WCOL_CURSOR]); } #if CURSOR_BLINK else if ((psEdBox->state & WEDBS_MASK) == WEDBS_OVER && blink) #else else if ((psEdBox->state & WEDBS_MASK) == WEDBS_OVER) #endif { // overwrite mode QString tmp = psEdBox->aText; tmp.remove(psEdBox->insPos, tmp.length()); // Erase from the cursor on, to find where the cursor should be. tmp.remove(0, psEdBox->printStart); cx = x0 + WEDB_XGAP + iV_GetTextWidth(tmp.toUtf8().constData()); cy = fy; iV_Line(cx, cy, cx + WEDB_CURSORSIZE, cy, pColours[WCOL_CURSOR]); } if(psEdBox->pBoxDisplay == NULL) { if (psEdBox->state & WEDBS_HILITE) { /* Display the button hilite */ iV_Line(x0-2,y0-2, x1+2,y0-2, pColours[WCOL_HILITE]); iV_Line(x0-2,y0-2, x0-2,y1+2, pColours[WCOL_HILITE]); iV_Line(x0-2,y1+2, x1+2,y1+2, pColours[WCOL_HILITE]); iV_Line(x1+2,y1+2, x1+2,y0-2, pColours[WCOL_HILITE]); } } }
static void displayExtraGubbins(UDWORD height) { char str[128]; //draw grid iV_Line(MULTIMENU_FORM_X+MULTIMENU_C0 -6 , MULTIMENU_FORM_Y, MULTIMENU_FORM_X+MULTIMENU_C0 -6 , MULTIMENU_FORM_Y+height, WZCOL_BLACK); iV_Line(MULTIMENU_FORM_X+MULTIMENU_C8 -6 , MULTIMENU_FORM_Y, MULTIMENU_FORM_X+MULTIMENU_C8 -6 , MULTIMENU_FORM_Y+height, WZCOL_BLACK); iV_Line(MULTIMENU_FORM_X+MULTIMENU_C9 -6 , MULTIMENU_FORM_Y, MULTIMENU_FORM_X+MULTIMENU_C9 -6 , MULTIMENU_FORM_Y+height, WZCOL_BLACK); iV_Line(MULTIMENU_FORM_X+MULTIMENU_C10 -6 , MULTIMENU_FORM_Y, MULTIMENU_FORM_X+MULTIMENU_C10 -6 , MULTIMENU_FORM_Y+height, WZCOL_BLACK); iV_Line(MULTIMENU_FORM_X+MULTIMENU_C11 -6 , MULTIMENU_FORM_Y, MULTIMENU_FORM_X+MULTIMENU_C11 -6 , MULTIMENU_FORM_Y+height, WZCOL_BLACK); iV_Line(MULTIMENU_FORM_X , MULTIMENU_FORM_Y+MULTIMENU_PLAYER_H, MULTIMENU_FORM_X+MULTIMENU_FORM_W, MULTIMENU_FORM_Y+MULTIMENU_PLAYER_H, WZCOL_BLACK); iV_SetFont(font_regular); // font iV_SetTextColour(WZCOL_TEXT_BRIGHT); // main wz text color // draw timer getAsciiTime(str, gameTime); iV_DrawText(str, MULTIMENU_FORM_X+MULTIMENU_C2, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET) ; // draw titles. iV_DrawText(_("Alliances"), MULTIMENU_FORM_X+MULTIMENU_C0, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET); iV_DrawText(_("Score"), MULTIMENU_FORM_X+MULTIMENU_C8, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET); iV_DrawText(_("Kills"), MULTIMENU_FORM_X+MULTIMENU_C9, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET); if(getDebugMappingStatus()) { // shows # units for *all* players in debug mode ONLY! iV_DrawText(_("Units"), MULTIMENU_FORM_X+MULTIMENU_C10, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET); iV_DrawText(_("Power"), MULTIMENU_FORM_X+MULTIMENU_C11, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET); } else { // shows # units for *yourself* (+ team member?) only. iV_DrawText(_("Units"), MULTIMENU_FORM_X+MULTIMENU_C10, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET); // ping is useless for non MP games, so display something useful depending on mode. if (runningMultiplayer()) { iV_DrawText(_("Ping"), MULTIMENU_FORM_X+MULTIMENU_C11, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET); } else { iV_DrawText(_("Structs"), MULTIMENU_FORM_X+MULTIMENU_C11, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET); } } #ifdef DEBUG { unsigned int width; sprintf(str,"Traf: %u/%u", NETgetBytesSent(), NETgetBytesRecvd()); width = iV_GetTextWidth(str); iV_DrawText(str, MULTIMENU_FORM_X, MULTIMENU_FORM_Y + MULTIMENU_FORM_H); sprintf(str,"Pack: %u/%u", NETgetPacketsSent(), NETgetPacketsRecvd()); iV_DrawText(str, MULTIMENU_FORM_X + 20 + width, MULTIMENU_FORM_Y + MULTIMENU_FORM_H); } #endif return; }
void W_EDITBOX::display(int xOffset, int yOffset) { int x0 = x() + xOffset; int y0 = y() + yOffset; int x1 = x0 + width(); int y1 = y0 + height(); if (pBoxDisplay != nullptr) { pBoxDisplay(this, xOffset, yOffset); } else { iV_ShadowBox(x0, y0, x1, y1, 0, boxColourFirst, boxColourSecond, boxColourBackground); } int fx = x0 + WEDB_XGAP;// + (psEdBox->width - fw) / 2; iV_SetTextColour(WZCOL_FORM_TEXT); int fy = y0 + (height() - iV_GetTextLineSize(FontID)) / 2 - iV_GetTextAboveBase(FontID); /* If there is more text than will fit into the box, display the bit with the cursor in it */ QString tmp = aText; tmp.remove(0, printStart); // Erase anything there isn't room to display. tmp.remove(printChars, tmp.length()); iV_DrawText(tmp.toUtf8().constData(), fx, fy, FontID); // Display the cursor if editing #if CURSOR_BLINK bool blink = !(((wzGetTicks() - blinkOffset) / WEDB_BLINKRATE) % 2); if ((state & WEDBS_MASK) == WEDBS_INSERT && blink) #else if ((state & WEDBS_MASK) == WEDBS_INSERT) #endif { // insert mode QString tmp = aText; tmp.remove(insPos, tmp.length()); // Erase from the cursor on, to find where the cursor should be. tmp.remove(0, printStart); int cx = x0 + WEDB_XGAP + iV_GetTextWidth(tmp.toUtf8().constData(), FontID); cx += iV_GetTextWidth("-", FontID); int cy = fy; iV_Line(cx, cy + iV_GetTextAboveBase(FontID), cx, cy - iV_GetTextBelowBase(FontID), WZCOL_FORM_CURSOR); } #if CURSOR_BLINK else if ((state & WEDBS_MASK) == WEDBS_OVER && blink) #else else if ((state & WEDBS_MASK) == WEDBS_OVER) #endif { // overwrite mode QString tmp = aText; tmp.remove(insPos, tmp.length()); // Erase from the cursor on, to find where the cursor should be. tmp.remove(0, printStart); int cx = x0 + WEDB_XGAP + iV_GetTextWidth(tmp.toUtf8().constData(), FontID); int cy = fy; iV_Line(cx, cy, cx + WEDB_CURSORSIZE, cy, WZCOL_FORM_CURSOR); } if (pBoxDisplay == nullptr) { if ((state & WEDBS_HILITE) != 0) { /* Display the button hilite */ iV_Box(x0 - 2, y0 - 2, x1 + 2, y1 + 2, WZCOL_FORM_HILITE); } } }
/* Draw top tabs */ static void formDisplayTTabs(W_TABFORM *psForm,SDWORD x0, SDWORD y0, UDWORD width, UDWORD height, UDWORD number, UDWORD selected, UDWORD hilite, PIELIGHT *pColours,UDWORD TabType,UDWORD TabGap) { SDWORD x,x1, y1; UDWORD i, drawnumber; #if NO_DISPLAY_SINGLE_TABS if (number == 1) { /* Don't display single tabs */ return; } #endif x = x0 + 2; x1 = x + width - 2; y1 = y0 + height; if (number > psForm->maxTabsShown) //we can display 8 tabs fine with no extra voodoo. { // We do NOT want to draw all the tabs once we have drawn 7 tabs // Both selected & hilite are converted from virtual tab range, to a range // that is seen on the form itself. This would be 0-6 (7 tabs) // We also fix drawnumber, so we don't display too many tabs since the pages // will be empty. drawnumber = (number - (( psForm->TabMultiplier -1) * psForm->maxTabsShown)); if (drawnumber > psForm->maxTabsShown) drawnumber = psForm->maxTabsShown ; selected = (selected % psForm->maxTabsShown); //Go from Virtual range, to our range if(hilite != 65535) //sigh. Don't blame me for this!It is THEIR 'hack'. hilite = hilite % psForm->maxTabsShown; //we want to hilite tab 0 - 6. } else { // normal draw drawnumber = number; } for (i=0; i < drawnumber; i++) { if(psForm->pTabDisplay) { psForm->pTabDisplay((WIDGET*)psForm,TabType,WFORM_TABTOP,i,i==selected,i==hilite,x,y0,width,height); } else { if (i == selected) { /* Fill in the tab */ pie_BoxFill(x + 1, y0 + 1, x1 - 1, y1, pColours[WCOL_BKGRND]); /* Draw the outline */ iV_Line(x,y0+2, x,y1-1, pColours[WCOL_LIGHT]); iV_Line(x,y0+2, x+2,y0, pColours[WCOL_LIGHT]); iV_Line(x+2,y0, x1-1,y0, pColours[WCOL_LIGHT]); iV_Line(x1,y0+1, x1,y1, pColours[WCOL_DARK]); } else { /* Fill in the tab */ pie_BoxFill(x + 1, y0 + 2, x1 - 1, y1 - 1, pColours[WCOL_BKGRND]); /* Draw the outline */ iV_Line(x,y0+3, x,y1-1, pColours[WCOL_LIGHT]); iV_Line(x,y0+3, x+2,y0+1, pColours[WCOL_LIGHT]); iV_Line(x+2,y0+1, x1-1,y0+1, pColours[WCOL_LIGHT]); iV_Line(x1,y0+2, x1,y1-1, pColours[WCOL_DARK]); } if (i == hilite) { /* Draw the hilite box */ iV_Box(x+2,y0+4, x1-3, y1-3, pColours[WCOL_HILITE]); } } x += width + TabGap; x1 += width + TabGap; } }
/* Update and possibly display the tip */ void tipDisplay() { SDWORD newMX, newMY; SDWORD currTime; SDWORD fw, topGap; switch (tipState) { case TIP_WAIT: /* See if the tip has to be shown */ newMX = mouseX(); newMY = mouseY(); currTime = wzGetTicks(); if (newMX == mx && newMY == my && (currTime - startTime > TIP_PAUSE)) { /* Activate the tip */ tipState = TIP_ACTIVE; /* Calculate the size of the tip box */ topGap = TIP_VGAP; iV_SetFont(FontID); lineHeight = iV_GetTextLineSize(); fw = 0; for (int n = 0; n < pTip.size(); ++n) { fw = std::max<int>(fw, iV_GetTextWidth(pTip[n].toUtf8().constData())); } tw = fw + TIP_HGAP * 2; th = topGap * 2 + lineHeight * pTip.size() + iV_GetTextBelowBase(); /* Position the tip box */ tx = clip(wx + ww / 2, 0, screenWidth - tw - 1); ty = std::max(wy + wh + TIP_VGAP, 0); if (ty + th >= (int)screenHeight) { /* Position the tip above the button */ ty = wy - th - TIP_VGAP; } /* Position the text */ fx = tx + TIP_HGAP; fy = ty + (th - lineHeight * pTip.size()) / 2 - iV_GetTextAboveBase(); /* Note the time */ startTime = wzGetTicks(); } else if (newMX != mx || newMY != my || mousePressed(MOUSE_LMB)) { mx = newMX; my = newMY; startTime = currTime; } break; case TIP_ACTIVE: /* Draw the tool tip */ pie_BoxFill(tx, ty, tx + tw, ty + th, WZCOL_FORM_TIP_BACKGROUND); iV_Line(tx + 1, ty + th - 2, tx + 1, ty + 1, WZCOL_FORM_DARK); iV_Line(tx + 2, ty + 1, tx + tw - 2, ty + 1, WZCOL_FORM_DARK); iV_Line(tx, ty + th, tx + tw, ty + th, WZCOL_FORM_DARK); iV_Line(tx + tw, ty + th - 1, tx + tw, ty, WZCOL_FORM_DARK); iV_Box(tx, ty, tx + tw - 1, ty + th - 1, WZCOL_FORM_LIGHT); iV_SetFont(FontID); iV_SetTextColour(TipColour); for (int n = 0; n < pTip.size(); ++n) { iV_DrawText(pTip[n].toUtf8().constData(), fx, fy + lineHeight * n); } break; default: break; } }
/* The trough bar graph display function */ void barGraphDisplayTrough(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pColours) { SDWORD x0,y0, x1,y1; // Position of the bar SDWORD tx0,ty0, tx1,ty1; // Position of the trough W_BARGRAPH *psBGraph; BOOL showBar=TRUE, showTrough=TRUE; psBGraph = (W_BARGRAPH *)psWidget; /* figure out which way the bar graph fills */ switch (psBGraph->barPos) { case WBAR_LEFT: x0 = xOffset + psWidget->x; y0 = yOffset + psWidget->y; x1 = x0 + psWidget->width * psBGraph->majorSize / WBAR_SCALE; y1 = y0 + psWidget->height; if (x0 == x1) { showBar = FALSE; } tx0 = x1+1; ty0 = y0; tx1 = x0 + psWidget->width; ty1 = y1; if (tx0 >= tx1) { showTrough = FALSE; } break; case WBAR_RIGHT: y0 = yOffset + psWidget->y; x1 = xOffset + psWidget->x + psWidget->width; x0 = x1 - psWidget->width * psBGraph->majorSize / WBAR_SCALE; y1 = y0 + psWidget->height; if (x0 == x1) { showBar = FALSE; } tx0 = xOffset + psWidget->x; ty0 = y0; tx1 = x0-1; ty1 = y1; if (tx0 >= tx1) { showTrough = FALSE; } break; case WBAR_TOP: x0 = xOffset + psWidget->x; y0 = yOffset + psWidget->y; x1 = x0 + psWidget->width; y1 = y0 + psWidget->height * psBGraph->majorSize / WBAR_SCALE; if (y0 == y1) { showBar = FALSE; } tx0 = x0; ty0 = y1+1; tx1 = x1; ty1 = y0 + psWidget->height; if (ty0 >= ty1) { showTrough = FALSE; } break; case WBAR_BOTTOM: x0 = xOffset + psWidget->x; x1 = x0 + psWidget->width; y1 = yOffset + psWidget->y + psWidget->height; y0 = y1 - psWidget->height * psBGraph->majorSize / WBAR_SCALE; if (y0 == y1) { showBar = FALSE; } tx0 = x0; ty0 = yOffset + psWidget->y; tx1 = x1; ty1 = y0-1; if (ty0 >= ty1) { showTrough = FALSE; } break; } /* Now draw the graph */ if (showBar) { pie_BoxFillIndex(x0,y0, x1,y1,psBGraph->majorCol); } if (showTrough) { pie_BoxFillIndex(tx0,ty0, tx1,ty1,WCOL_BKGRND); iV_Line(tx0,ty1, tx0,ty0,*(pColours + WCOL_DARK)); iV_Line(tx0,ty0, tx1,ty0,*(pColours + WCOL_DARK)); iV_Line(tx1,ty0, tx1,ty1,*(pColours + WCOL_LIGHT)); iV_Line(tx0,ty1, tx1,ty1,*(pColours + WCOL_LIGHT)); } }
/* The double bar graph display function */ void barGraphDisplayDouble(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pColours) { SDWORD x0,y0, x1,y1, x2,y2, x3,y3; W_BARGRAPH *psBGraph; psBGraph = (W_BARGRAPH *)psWidget; /* figure out which way the bar graph fills */ switch (psBGraph->barPos) { case WBAR_LEFT: /* Calculate the major bar */ x0 = xOffset + psWidget->x; y0 = yOffset + psWidget->y; x1 = x0 + psWidget->width * psBGraph->majorSize / WBAR_SCALE; y1 = y0 + 2*psWidget->height/3; /* Calculate the minor bar */ x2 = x0; y2 = y0 + psWidget->height/3; x3 = x2 + psWidget->width * psBGraph->minorSize / WBAR_SCALE; y3 = y0 + psWidget->height; break; case WBAR_RIGHT: /* Calculate the major bar */ y0 = yOffset + psWidget->y; x1 = xOffset + psWidget->x + psWidget->width; x0 = x1 - psWidget->width * psBGraph->majorSize / WBAR_SCALE; y1 = y0 + 2*psWidget->height/3; /* Calculate the minor bar */ x3 = x1; y2 = y0 + psWidget->height/3; x2 = x3 - psWidget->width * psBGraph->minorSize / WBAR_SCALE; y3 = y0 + psWidget->height; break; case WBAR_TOP: /* Calculate the major bar */ x0 = xOffset + psWidget->x; y0 = yOffset + psWidget->y; x1 = x0 + 2*psWidget->width/3; y1 = y0 + psWidget->height * psBGraph->majorSize / WBAR_SCALE; /* Calculate the minor bar */ x2 = x0 + psWidget->width/3; y2 = y0; x3 = x0 + psWidget->width; y3 = y2 + psWidget->height * psBGraph->minorSize / WBAR_SCALE; break; case WBAR_BOTTOM: /* Calculate the major bar */ x0 = xOffset + psWidget->x; x1 = x0 + 2*psWidget->width/3; y1 = yOffset + psWidget->y + psWidget->height; y0 = y1 - psWidget->height * psBGraph->majorSize / WBAR_SCALE; /* Calculate the minor bar */ x2 = x0 + psWidget->width/3; x3 = x0 + psWidget->width; y3 = y1; y2 = y3 - psWidget->height * psBGraph->minorSize / WBAR_SCALE; break; } /* Draw the minor bar graph */ if (psBGraph->minorSize > 0) { pie_BoxFillIndex(x2,y2, x3,y3,psBGraph->minorCol); iV_Line(x2,y3, x2,y2,*(pColours + WCOL_LIGHT)); iV_Line(x2,y2, x3,y2,*(pColours + WCOL_LIGHT)); iV_Line(x3,y2, x3,y3,*(pColours + WCOL_DARK)); iV_Line(x2,y3, x3,y3,*(pColours + WCOL_DARK)); } /* Draw the major bar graph */ pie_BoxFillIndex(x0,y0, x1,y1,psBGraph->majorCol); iV_Line(x0,y1, x0,y0,*(pColours + WCOL_LIGHT)); iV_Line(x0,y0, x1,y0,*(pColours + WCOL_LIGHT)); iV_Line(x1,y0, x1,y1,*(pColours + WCOL_DARK)); iV_Line(x0,y1, x1,y1,*(pColours + WCOL_DARK)); }
static void displayExtraGubbins(UDWORD height) { char str[128]; //draw grid iV_Line(MULTIMENU_FORM_X+MULTIMENU_C0 -6 , MULTIMENU_FORM_Y, MULTIMENU_FORM_X+MULTIMENU_C0 -6 , MULTIMENU_FORM_Y+height, WZCOL_BLACK); iV_Line(MULTIMENU_FORM_X+MULTIMENU_C8 -6 , MULTIMENU_FORM_Y, MULTIMENU_FORM_X+MULTIMENU_C8 -6 , MULTIMENU_FORM_Y+height, WZCOL_BLACK); iV_Line(MULTIMENU_FORM_X+MULTIMENU_C9 -6 , MULTIMENU_FORM_Y, MULTIMENU_FORM_X+MULTIMENU_C9 -6 , MULTIMENU_FORM_Y+height, WZCOL_BLACK); iV_Line(MULTIMENU_FORM_X+MULTIMENU_C10 -6 , MULTIMENU_FORM_Y, MULTIMENU_FORM_X+MULTIMENU_C10 -6 , MULTIMENU_FORM_Y+height, WZCOL_BLACK); iV_Line(MULTIMENU_FORM_X+MULTIMENU_C11 -6 , MULTIMENU_FORM_Y, MULTIMENU_FORM_X+MULTIMENU_C11 -6 , MULTIMENU_FORM_Y+height, WZCOL_BLACK); iV_Line(MULTIMENU_FORM_X , MULTIMENU_FORM_Y+MULTIMENU_PLAYER_H, MULTIMENU_FORM_X+MULTIMENU_FORM_W, MULTIMENU_FORM_Y+MULTIMENU_PLAYER_H, WZCOL_BLACK); iV_SetFont(font_regular); // font iV_SetTextColour(WZCOL_TEXT_BRIGHT); // main wz text color // draw timer getAsciiTime(str, gameTime); iV_DrawText(str, MULTIMENU_FORM_X+MULTIMENU_C2, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET) ; // draw titles. iV_DrawText(_("Alliances"), MULTIMENU_FORM_X+MULTIMENU_C0, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET); iV_DrawText(_("Score"), MULTIMENU_FORM_X+MULTIMENU_C8, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET); iV_DrawText(_("Kills"), MULTIMENU_FORM_X+MULTIMENU_C9, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET); iV_DrawText(_("Units"), MULTIMENU_FORM_X+MULTIMENU_C10, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET); if (getDebugMappingStatus()) { iV_DrawText(_("Power"), MULTIMENU_FORM_X+MULTIMENU_C11, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET); } else { // ping is useless for non MP games, so display something useful depending on mode. if (runningMultiplayer()) { iV_DrawText(_("Ping"), MULTIMENU_FORM_X+MULTIMENU_C11, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET); } else { iV_DrawText(_("Structs"), MULTIMENU_FORM_X+MULTIMENU_C11, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET); } } #ifdef DEBUG iV_SetFont(font_small); for (unsigned q = 0; q < 2; ++q) { unsigned xPos = 0; unsigned yPos = q*12; bool isTotal = q != 0; char const *srText[2] = {_("Sent/Received per sec —"), _("Total Sent/Received —")}; sprintf(str, srText[q]); iV_DrawText(str, MULTIMENU_FORM_X + xPos, MULTIMENU_FORM_Y + height + yPos); xPos += iV_GetTextWidth(str) + 20; sprintf(str, _("Traf: %u/%u"), NETgetStatistic(NetStatisticRawBytes, true, isTotal), NETgetStatistic(NetStatisticRawBytes, false, isTotal)); iV_DrawText(str, MULTIMENU_FORM_X + xPos, MULTIMENU_FORM_Y + height + yPos); xPos += iV_GetTextWidth(str) + 20; sprintf(str, _("Uncompressed: %u/%u"), NETgetStatistic(NetStatisticUncompressedBytes, true, isTotal), NETgetStatistic(NetStatisticUncompressedBytes, false, isTotal)); iV_DrawText(str, MULTIMENU_FORM_X + xPos, MULTIMENU_FORM_Y + height + yPos); xPos += iV_GetTextWidth(str) + 20; sprintf(str, _("Pack: %u/%u"), NETgetStatistic(NetStatisticPackets, true, isTotal), NETgetStatistic(NetStatisticPackets, false, isTotal)); iV_DrawText(str, MULTIMENU_FORM_X + xPos, MULTIMENU_FORM_Y + height + yPos); } #endif return; }