void TB_SaveSelect::Draw(void) { if (!fVisible) return; // handle user input Run_Input(); // draw frame TextBox::DrawFrame(fCoords.x, fCoords.y, fCoords.w, fCoords.h); // draw selectors/options int x = fCoords.x + 16; int y = fCoords.y + 15; for(int i=0;i<fNumFiles;i++) { DrawProfile(x, y, i); y += (sprites[SPR_SAVESELECTOR_MIDDLE].h + 10); } // draw extended info for current selection if (fHaveProfile[fCurSel]) DrawExtendedInfo(); }
static void DoProfilePrint( void * junk ) { coOrd size, p[4]; int copies; WDOUBLE_T w, h, screenRatio, printRatio, titleH; wFont_p fp; coOrd screenSize; coOrd textsize; if (!wPrintDocStart( _("Profile"), 1, &copies )) return; printProfileD.d = wPrintPageStart(); if (printProfileD.d == NULL) return; printProfileD.dpi = wDrawGetDPI( printProfileD.d ); wPrintGetPageSize( &w, &h ); printProfileD.orig.x = -PBL; printProfileD.orig.y = -PBB(printProfileFontSize); printProfileD.angle = 0.0; screenRatio = screenProfileD.size.y/screenProfileD.size.x; screenSize.x = prof.totalD*prof.scaleX; screenSize.y = GetDim(prof.maxC-prof.minC)*prof.scaleY; screenRatio = screenSize.y/screenSize.x; printProfileD.size.x = w; printProfileD.size.y = h; sprintf( message, _("%s Profile: %s"), sProdName, Title1 ); fp = wStandardFont( F_TIMES, FALSE, FALSE ); DrawTextSize( &mainD, message, fp, 24, FALSE, &textsize ); titleH = textsize.y + 6.0/mainD.dpi; if (screenRatio < 1.0 && w < h ) { /* Landscape -> Portrait */ printProfileD.angle = -90.0; printProfileD.orig.x += h; size.x = h; size.y = w; } else if (screenRatio > 1.0 && w > h ) { /* Portrait -> Landscape */ printProfileD.angle = 90.0; printProfileD.orig.y += w; size.x = h; size.y = w; } else { size.x = w; size.y = h; } size.y -= titleH+(printVert?PBT*2:PBT)+PBB(printProfileFontSize); size.x -= 4.0/mainD.dpi+PBL+(printVert?PBR/4.0:PBR); printRatio = size.y/size.x; if (printRatio < screenRatio) { printProfileD.scale = screenSize.y/size.y; size.x = screenSize.x/printProfileD.scale; } else { printProfileD.scale = screenSize.x/size.x; printProfileD.orig.y -= size.y; size.y = screenSize.y/printProfileD.scale; printProfileD.orig.y += size.y; } #define PRINT_ABS2PAGEX(X) (((X)*printProfileD.scale)/prof.scaleX) #define PRINT_ABS2PAGEY(Y) (((Y)*printProfileD.scale)/prof.scaleY+prof.minE) p[0].y = PRINT_ABS2PAGEY(size.y+(printVert?PBT*2:PBT)+0.05); p[0].x = PRINT_ABS2PAGEX((size.x-textsize.x)/2.0); if ( p[0].x < 0 ) p[0].x = 0; DrawString( &printProfileD, p[0], 0, message, fp, 24*printProfileD.scale, borderColor ); p[0].x = p[3].x = PRINT_ABS2PAGEX((-PBL)+2.0/mainD.dpi); p[0].y = p[1].y = PRINT_ABS2PAGEY(-PBB(printProfileFontSize)); p[1].x = p[2].x = PRINT_ABS2PAGEX(size.x+(printVert?PBR/4.0:PBR)); p[2].y = p[3].y = PRINT_ABS2PAGEY(size.y+(printVert?PBT*2:PBT)); DrawLine( &printProfileD, p[0], p[1], 0, drawColorBlack ); DrawLine( &printProfileD, p[1], p[2], 0, drawColorBlack ); DrawLine( &printProfileD, p[2], p[3], 0, drawColorBlack ); DrawLine( &printProfileD, p[3], p[0], 0, drawColorBlack ); DrawProfile( &printProfileD, printProfileFontSize, printVert ); wPrintPageEnd( printProfileD.d ); wPrintDocEnd(); }
static void RedrawProfileW( void ) { wPos_t ww, hh; coOrd size; int inx, divC; DIST_T maxE, rngE; profElem_t *p; wFont_p fp; POS_T w; coOrd textsize; wDrawClear( screenProfileD.d ); wDrawGetSize( screenProfileD.d, &ww, &hh ); screenProfileD.size.x = (ww)/screenProfileD.dpi; screenProfileD.size.y = (hh)/screenProfileD.dpi; screenProfileD.orig.x = -PBL; screenProfileD.orig.y = -PBB(screenProfileFontSize); /* Calculate usable dimension of canvas */ size = screenProfileD.size; size.x -= (PBL); size.y -= (PBB(screenProfileFontSize)); #ifdef WINDOWS if (printVert) { size.x -= PBR/4.0; size.y -= PBT; } else #endif { size.x -= PBR; size.y -= PBT; } if ( size.x < 0.1 || size.y < 0.1 ) return; /* Calculate range of data values */ if (profElem_da.cnt<=0) { prof.totalD = 0.0; prof.minE = 0.0; maxE = 1.0; } else { maxE = prof.minE = profElem(0).elev; prof.totalD = profElem(profElem_da.cnt-1).dist; for (inx=1; inx<profElem_da.cnt; inx++ ) { p = &profElem(inx); if (p->elev<prof.minE) prof.minE = p->elev; if (p->elev>maxE) maxE = p->elev; } } /* Calculate number of grid lines */ prof.minC = (int)floor(PutDim(prof.minE)); prof.maxC = (int)ceil(PutDim(maxE)); if ( prof.maxC-prof.minC <= 0 ) prof.maxC = prof.minC+1; divC = (int)floor(size.y/labelH); if ( divC < 1 ) divC = 1; prof.incrC = (prof.maxC-prof.minC+divC-1)/divC; if ( prof.incrC < 1 ) prof.incrC = 1; prof.maxC = prof.minC + (prof.maxC-prof.minC+prof.incrC-1)/prof.incrC * prof.incrC; /* Reset bounds based on intergal values */ prof.minE = GetDim(prof.minC); rngE = GetDim(prof.maxC) - prof.minE; if (rngE < 1.0) rngE = 1.0; /* Compute vert scale */ prof.scaleY = size.y/rngE; sprintf( message, "%0.2f", maxE ); fp = wStandardFont( F_HELV, FALSE, FALSE ); DrawTextSize( &mainD, message, fp, screenProfileFontSize, FALSE, &textsize ); w = textsize.x; w -= PBT; w += 4.0/screenProfileD.dpi; w -= (GetDim(prof.maxC)-maxE)*prof.scaleY; if (w > 0) { size.y -= w; prof.scaleY = size.y/rngE; } /* Compute horz scale */ if (prof.totalD <= 0.1) { prof.totalD = size.x; } prof.scaleX = size.x/prof.totalD; #ifdef LATER D->size.x /= prof.scaleX; D->size.x -= D->orig.x; D->size.y /= prof.scaleY; D->size.y -= D->orig.y; D->size.y += prof.minE; #endif DrawProfile( &screenProfileD, screenProfileFontSize, #ifdef WINDOWS printVert #else FALSE #endif ); }