/* * Fonction pour VScrollBar */ void DrawThumbV(struct XObj *xobj, XEvent *evp) { int x,y,w,h; XSegment segm; char str[20]; x = xobj->width/2 - 10; y = 2 + (xobj->height - 36)*(xobj->value - xobj->value3) / (xobj->value2 - xobj->value3); w = 20; h = 32; DrawReliefRect(x, y, w, h, xobj, hili, shad); segm.x1 = x + 3; segm.y1 = y + 15; segm.x2 = x + w - 3; segm.y2 = y + 15; XSetForeground(dpy, xobj->gc, xobj->TabColor[shad]); XDrawSegments(dpy, xobj->win, xobj->gc, &segm, 1); segm.x1 = x + 3; segm.y1 = y + 16; segm.x2 = x + w - 3; segm.y2 = y + 16; XSetForeground(dpy, xobj->gc, xobj->TabColor[hili]); XDrawSegments(dpy, xobj->win, xobj->gc, &segm, 1); XSetForeground(dpy, xobj->gc, xobj->TabColor[fore]); sprintf(str, "%d", xobj->value); x = x-FlocaleTextWidth(xobj->Ffont, str, strlen(str))-6; y = y + 13 + xobj->Ffont->ascent/2; MyDrawString(dpy, xobj, xobj->win, x, y, str, fore, hili, back, !xobj->flags[1], NULL, evp); }
void DrawContourLevelValue(short x, short y, double level) { char numstr[40]; RGBColor savecolor; MyNumToStr(level,numstr); GetForeColor(&savecolor); RGBForeColor(&colors[RED]); MyDrawString(/*CENTERED,*/x,y,numstr,true,POINTDRAWFLAG); RGBForeColor(&savecolor); }
void DrawPopupMenu(struct XObj *xobj, XEvent *evp) { XSegment segm[4]; char* str; int x,y; int asc = xobj->Ffont->ascent; DrawReliefRect(0, 0, xobj->width, xobj->height, xobj, hili, shad); /* Dessin de la fleche / arrow drawing */ segm[0].x1 = 7; segm[0].y1 = asc; segm[0].x2 = 19; segm[0].y2 = asc; segm[1].x1 = 8; segm[1].y1 = asc; segm[1].x2 = 13; segm[1].y2 = 5 + asc; segm[2].x1 = 6; segm[2].y1 = asc - 1; segm[2].x2 = 19; segm[2].y2 = 0 + asc -1; segm[3].x1 = 7; segm[3].y1 = asc; segm[3].x2 = 12; segm[3].y2 = 5 +asc; XSetForeground(dpy, xobj->gc, xobj->TabColor[shad]); XDrawSegments(dpy, xobj->win, xobj->gc, segm, 4); segm[0].x1 = 17; segm[0].y1 = asc + 1; segm[0].x2 = 13; segm[0].y2 = 5 + asc; segm[1].x1 = 19; segm[1].y1 = asc; segm[1].x2 = 14; segm[1].y2 = 5 + asc; XSetForeground(dpy, xobj->gc, xobj->TabColor[hili]); XDrawSegments(dpy, xobj->win, xobj->gc, segm, 2); /* Dessin du titre du popup menu */ str = (char*)GetMenuTitle(xobj->title, xobj->value); y = asc + 5; x = GetXTextPosition(xobj,xobj->width, FlocaleTextWidth(xobj->Ffont,str,strlen(str)), 25,8,8); MyDrawString(dpy, xobj, xobj->win, x, y, str, fore, hili, back, !xobj->flags[1], NULL, evp); free(str); }
void DrawVScrollBar(struct XObj *xobj, XEvent *evp) { int x,y,w,h; char str[20]; /* Calcul de la taille de l'ascenseur */ x = xobj->width/2 - 12; y = 0; w = 24; h = xobj->height; DrawThumbV(xobj, evp); DrawReliefRect(x, y, w, h, xobj, shad, hili); /* Ecriture des valeurs */ x = x + 26; y = xobj->Ffont->ascent + 2; sprintf(str, "%d", xobj->value3); MyDrawString(dpy, xobj, xobj->win, x, y, str, fore, hili, back, !xobj->flags[1], NULL, evp); sprintf(str, "%d", xobj->value2); y = h - xobj->Ffont->descent - 2; MyDrawString(dpy, xobj, xobj->win, x, y, str, fore, hili, back, !xobj->flags[1], NULL, evp); }
static void X_flush(aa_context * c) { struct xdriverdata *d=c->driverdata; int x, y, attr; int xs = 0, ys = 0; int l, same; int s = 0; int pos; attr = AA_NORMAL; alloctables(d); drawed = 0; area = 0; nrectangles[0] = 0; nrectangles[1] = 0; nrectangles[2] = 0; nrectangles[3] = 0; if (d->previoust == NULL) { d->previoust = malloc(d->width * d->height); d->previousa = calloc(d->width * d->height, 1); memset(d->previoust, ' ', d->width * d->height); } for (y = 0; y < aa_scrheight(c); y++) { s = l = 0; xs = 0; ys = y; for (x = 0; x < aa_scrwidth(c); x++) { pos = x + y * aa_scrwidth(c); if (s > 5 || (c->attrbuffer[pos] != attr && (c->textbuffer[pos] != ' ' || Black[c->attrbuffer[pos]] || Black[attr]))) { if (l - s) MyDrawString(d,attr, xs, ys, &c->textbuffer[xs + ys * aa_scrwidth(c)], l - s); attr = c->attrbuffer[pos]; s = l = 0; xs = x; ys = y; } if ((d->previoust[pos] == c->textbuffer[pos] && d->previousa[pos] == c->attrbuffer[pos]) || (!Black[attr] && d->previoust[pos] == ' ' && c->textbuffer[pos] == ' ' && !Black[d->previousa[pos]])) same = 1; else same = 0; if (xs == x && same) xs++; else { if (same) s++; else s = 0; l++; } } if (l - s) MyDrawString(d,attr, xs, ys, &c->textbuffer[xs + ys * aa_scrwidth(c)], l - s); } if (drawed) { memcpy(d->previousa, c->attrbuffer, d->width * d->height); memcpy(d->previoust, c->textbuffer, d->width * d->height); if (nrectangles[0]) XFillRectangles(d->dp, dr, d->blackGC, &rectangles(0, 0), nrectangles[0]); if (nrectangles[1]) XFillRectangles(d->dp, dr, d->normalGC, &rectangles(1, 0), nrectangles[1]); if (nrectangles[2]) XFillRectangles(d->dp, dr, d->specialGC, &rectangles(2, 0), nrectangles[2]); if (d->cvisible) XDrawLine(d->dp, dr, d->normalGC, d->Xpos * d->realfontwidth, (d->Ypos + 1) * d->fontheight - 1, (d->Xpos + 1) * d->realfontwidth - 1, (d->Ypos + 1) * d->fontheight - 1); for (y = 0; y < d->height; y++) { for (x = 0; x < NATT; x++) { if (nitem[y][x]) { X_setattr(d,x); XDrawText(d->dp, dr, d->currGC, 0, (y + 1) * d->fontheight - d->font_s->descent, &texty(y, x, 0), nitem[y][x]); if (x == 4) XDrawText(d->dp, dr, d->currGC, 1, (y + 1) * d->fontheight - d->font_s->descent, &texty(y, x, 0), nitem[y][x]); } } } if (d->pixmapmode) { if (nrectangles[3] && area < d->width*d->height/2 && nrectangles[3] < 5) { int i; /*fprintf (stderr, "%i %i\n",nrectangles[3], area);*/ for (i = 0; i < nrectangles[3]; i++) XClearArea (d->dp, d->wi, rectangles(3, i).x, rectangles(3,i).y, rectangles(3,i).width, rectangles(3,i).height, 0); } else XClearWindow(d->dp, d->wi); } /*if(!d->pixmapmode) */ XSync(d->dp, 0); } freetables(); }
static int MyPaintSplash (HWND pmSplashWindow, BOOL pmDraw) { SplashWindowInfoPtr myInfo; HDC myDisplayContext, myMemDC; PAINTSTRUCT myPaintStruct; BITMAP myBitmap; HBITMAP myOldBitmap; HPALETTE myPalette, myOldPalette; POINT myPoint, myOrigin; int myY; myInfo = MyGetSplashWindowInfo (pmSplashWindow); myDisplayContext = BeginPaint (pmSplashWindow, &myPaintStruct); if (pmDraw && myInfo -> usePicture) { myMemDC = CreateCompatibleDC (NULL); myOldBitmap = SelectBitmap (myMemDC, myInfo -> picture); GetObject (myInfo -> picture, sizeof(BITMAP), (LPSTR) &myBitmap); myPoint.x = myBitmap.bmWidth; myPoint.y = myBitmap.bmHeight; DPtoLP (myDisplayContext, &myPoint, 1); myOrigin.x = 0; myOrigin.y = 0; DPtoLP (myMemDC, &myOrigin, 1); // // We need to perform all sorts of stuff to get the palette right... // // If the DIBSection is 256 color or less, it has a color table if ((myBitmap.bmBitsPixel * myBitmap.bmPlanes) <= 8) { RGBQUAD myClrTbl [256]; LPLOGPALETTE myLogPal; WORD cnt; // Get the DIBSection's color table GetDIBColorTable (myMemDC, 0, 256, myClrTbl); // Create a palette from the color tabl myLogPal = (LOGPALETTE *) malloc (sizeof(LOGPALETTE) + (256 * sizeof(PALETTEENTRY))); myLogPal -> palVersion = 0x300; myLogPal -> palNumEntries = 256; for (cnt = 0 ; cnt < 256 ; cnt++) { myLogPal -> palPalEntry [cnt].peRed = myClrTbl [cnt].rgbRed; myLogPal -> palPalEntry [cnt].peGreen = myClrTbl [cnt].rgbGreen; myLogPal -> palPalEntry [cnt].peBlue = myClrTbl [cnt].rgbBlue; myLogPal -> palPalEntry [cnt].peFlags = 0; } myPalette = CreatePalette (myLogPal); free (myLogPal); // Select Palette myOldPalette = SelectPalette (myDisplayContext, myPalette, FALSE); RealizePalette (myDisplayContext); } if (gProgram.isTuring) { BitBlt (myDisplayContext, 0, 0, myPoint.x, myPoint.y, myMemDC, myOrigin.x, myOrigin.y, SRCCOPY); } else { BitBlt (myDisplayContext, MARGIN, 0, myPoint.x, myPoint.y, myMemDC, myOrigin.x, myOrigin.y, SRCCOPY); } SelectObject (myMemDC, myOldBitmap); if ((myBitmap.bmBitsPixel * myBitmap.bmPlanes) <= 8) { SelectPalette (myDisplayContext, myOldPalette, FALSE); DeleteObject (myPalette); } DeleteDC (myMemDC); } // Place Ministry message over top of the Sun if (gProgram.assistedByIBM && gProgram.isTuring) { // // Output "Ministry of Education License Message" // myY = LARGE_GAP; MyDrawString (myInfo, myDisplayContext, myInfo -> versionFont, myInfo -> miniEdMsg [0], &myY, pmDraw, FALSE); myY += SMALL_GAP; MyDrawStrings (myInfo, myDisplayContext, myInfo -> chiefProgrammerFont, &myInfo -> miniEdMsg [1], 9, &myY, pmDraw, FALSE); } // if (gProgram.assistedByIBM) if (myInfo -> usePicture) { // The starting Y position myY = myInfo -> bitmapHeight + MARGIN; } else { myY = SMALL_GAP; MyDrawStrings (myInfo, myDisplayContext, myInfo -> productNameFont, myInfo -> productNameMsg, myInfo -> productNameLines, &myY, pmDraw, TRUE); myY += LARGE_GAP; } // // Output "Created By Holt Software Associates Inc." // MyDrawString (myInfo, myDisplayContext, myInfo -> createdByFont, myInfo -> createdByMsg, &myY, pmDraw, TRUE); if (gProgram.assistedByIBM && gProgram.isJava) { // // Output "Development Assisted by IBM Corp." // MyDrawString (myInfo, myDisplayContext, myInfo -> createdByFont, myInfo -> assistedByMsg, &myY, pmDraw, TRUE); } // if (gProgram.assistedByIBM) // // // Output "Lead Programmer: Tom West" // if (gProgram.isJava) { MyDrawString (myInfo, myDisplayContext, myInfo -> chiefProgrammerFont, myInfo -> leadProgrammerMsg, &myY, pmDraw, TRUE); } // if (gProgram.isJava) // // Output version number // myY += SMALL_GAP; MyDrawString (myInfo, myDisplayContext, myInfo -> versionFont, myInfo -> versionString, &myY, pmDraw, TRUE); // // Output install kind specific info if (gProgram.miniVersion) { // // Output: Licensed to xxx. // This version cannot compile programs of greater than 100 lines in length // myY += SMALL_GAP; MyDrawStrings (myInfo, myDisplayContext, myInfo -> chiefProgrammerFont, myInfo -> miniMsg, 3, &myY, pmDraw, TRUE); } else if (gProgram.installKind == INSTALL_KIND_EVAL) { // // Output: This version is for personal evaluation purposes only. // It may not be redistributed or used for teaching purposes. // See the "Help" menu for information on obtaining Ready. // This version is time limited and will not execute Java programs after xxx // or // // Output: This version is for personal evaluation purposes only. // It may not be redistributed or used for teaching purposes. // See the "Help" menu for information on obtaining Ready. // This demonstration version of the software is restricted and // (1) Cannot save programs, // (2) Cannot compile programs of greater than 100 lines in length, and // (3) Will not execute programs after xxx // myY += SMALL_GAP; if (gProgram.restrictedVersion) { MyDrawStrings (myInfo, myDisplayContext, myInfo -> chiefProgrammerFont, myInfo -> evalMsg, 3, &myY, pmDraw, TRUE); myY += SMALL_GAP; MyDrawStrings (myInfo, myDisplayContext, myInfo -> chiefProgrammerFont, myInfo -> restrictMsg, 4, &myY, pmDraw, TRUE); } else { MyDrawStrings (myInfo, myDisplayContext, myInfo -> chiefProgrammerFont, myInfo -> evalMsg, 4, &myY, pmDraw, TRUE); } } else if (gProgram.installKind == INSTALL_KIND_BETA) { // // Output: This version is for personal beta test purposes only. // It may not be redistributed or used for teaching purposes. // Please report all bugs found in this software to [email protected] // This version of the software will not execute programs after xxx // myY += SMALL_GAP; MyDrawStrings (myInfo, myDisplayContext, myInfo -> chiefProgrammerFont, myInfo -> betaMsg, 4, &myY, pmDraw, TRUE); } else if (gProgram.installKind == INSTALL_KIND_PERSONAL) { myY += SMALL_GAP; MyDrawString (myInfo, myDisplayContext, myInfo -> chiefProgrammerFont, myInfo -> personalMsg, &myY, pmDraw, TRUE); } else if (gProgram.installKind == INSTALL_KIND_SITE) { myY += SMALL_GAP; MyDrawString (myInfo, myDisplayContext, myInfo -> chiefProgrammerFont, myInfo -> siteMsg, &myY, pmDraw, TRUE); } else if (gProgram.installKind == INSTALL_KIND_REDISTRIB) { myY += SMALL_GAP; MyDrawString (myInfo, myDisplayContext, myInfo -> chiefProgrammerFont, myInfo -> redistribMsg, &myY, pmDraw, TRUE); } if (gProgram.isJava) { // // Output "Using IBM's Jikes Java Compiler" // myY += SMALL_GAP; MyDrawString (myInfo, myDisplayContext, myInfo -> usingJikesFont, myInfo -> usingJikesMsg, &myY, pmDraw, TRUE); myY += SMALL_GAP; if (gProgram.operatingSystem == WIN_95) { MyDrawString (myInfo, myDisplayContext, myInfo -> trademarkFont, myInfo -> win95Msg, &myY, pmDraw, TRUE); } else { MyDrawString (myInfo, myDisplayContext, myInfo -> trademarkFont, myInfo -> jreLevelMsg, &myY, pmDraw, TRUE); } // // Output trademark information // myY += SMALL_GAP; MyDrawString (myInfo, myDisplayContext, myInfo -> trademarkFont, myInfo -> trademarkMsg, &myY, pmDraw, TRUE); } // if (gProgram.isJava) EndPaint (pmSplashWindow, &myPaintStruct); return myY; } // MyPaintSplash