void panel_draw(PANEL *p, int x, int y, int width, int height) { FUNC(); pushclip(x, y, width, height); if(p->type) { drawfunc[p->type - 1](p, x, y, width, height); } else { if(p->drawfunc) { p->drawfunc(x, y, width, height); } } PANEL **pp = p->child, *subp; if(pp) { while((subp = *pp++)) { if(!subp->disabled) { panel_draw_sub(subp, x, y, width, height); } } } popclip(); enddraw(x, y, width, height); }
static void panel_draw_core(PANEL *p, int x, int y, int width, int height) { FIX_XY_CORDS_FOR_SUBPANELS(); if (p->content_scroll) { pushclip(x, y, width, height); y -= scroll_gety(p->content_scroll, height); } if (p->type) { drawfunc[p->type - 1](p, x, y, width, height); } else { if (p->drawfunc) { p->drawfunc(x, y, width, height); } } PANEL **pp = p->child; if (pp) { PANEL *subp; while ((subp = *pp++)) { if (!subp->disabled) { panel_draw_core(subp, x, y, width, height); } } } if (p->content_scroll) { popclip(); } }
static void panel_draw_sub(PANEL *p, int x, int y, int width, int height) { FUNC(); if(p->content_scroll) { pushclip(x, y, width, height); y -= scroll_gety(p->content_scroll, height); } if(p->type) { drawfunc[p->type - 1](p, x, y, width, height); } else { if(p->drawfunc) { p->drawfunc(x, y, width, height); } } PANEL **pp = p->child, *subp; if(pp) { while((subp = *pp++)) { if(!subp->disabled) { panel_draw_sub(subp, x, y, width, height); } } } if(p->content_scroll) { popclip(); } }
static boolean ccdrawmsg (void) { /* 2.1b5 dmb: don't need flbitmapactive logic; openbitmap will return false if one's already open. */ register hdlcancoonrecord hc = cancoonglobals; //register hdlwindowinfo hw = aboutwindowinfo; register hdlstring hstring; register boolean flbitmap = false; bigstring bs; Rect r; if (hc == nil || aboutdata == nil) return (false); pushaboutstyle (); ccgetmsgrect (&r); flbitmap = openbitmap (r, aboutwindow); if (!flbitmap) pushclip (r); eraserect (r); /* grayframerect (r); */ hstring = (**hc).hprimarymsg; /* if (hstring == nil) /%no primary message, display file name%/ hstring = (**hw).hfilename; */ copyheapstring (hstring, bs); // centerstring (r, bs); movepento (r.left, r.top + globalfontinfo.ascent); pendrawstring (bs); popstyle (); if (flbitmap) closebitmap (aboutwindow); else popclip (); return (true); } /*ccdrawmsg*/
void disablescrollbar (hdlscrollbar hscrollbar) { hdlscrollbar h = hscrollbar; if (h == nil) /*defensive driving*/ return; scrollbarpushclip (h); HiliteControl (h, -1); /*validscrollbar (h);*/ popclip (); } /*disablescrollbar*/
boolean aboutsetmiscstring (bigstring bsmisc) { #ifdef WIN95VERSION extern DWORD ixthreadglobalsgrabcount; // Tls index of counter for nest globals grabbing long grabcount = (long) TlsGetValue (ixthreadglobalsgrabcount); #endif // register hdlcancoonrecord hc = cancoonglobals; // hdlwindowinfo hinfo; copystring (bsmisc, bsmiscinfo); // if (!findaboutwindow (&hinfo) || !shellpushglobals ((**hinfo).macwindow)) // return (false); #ifdef WIN95VERSION if (grabcount > 0) #endif if (aboutport != nil && flhavemiscrect) { //Code change by Timothy Paustian Monday, August 21, 2000 4:17:36 PM //We cannot just pass a window or dialog ptr to pushport. It's doing //an implicit cast. This will not work on OS X CGrafPtr thePort; #if TARGET_API_MAC_CARBON == 1 thePort = GetWindowPort((WindowRef) aboutport); #else thePort = (CGrafPtr)aboutport; #endif pushport(thePort); pushclip (miscinforect); eraserect (miscinforect); movepento (miscinforect.left, miscinforect.top + globalfontinfo.ascent); pendrawstring (bsmisc); popclip (); popport (); } // shellpopglobals (); return (true); } /*aboutsetmiscstring*/
void edit_draw(EDIT *edit, int x, int y, int width, int height) { if((width - 4 * SCALE - SCROLL_WIDTH) < 0) { return; } if(utox_window_baseline && y > utox_window_baseline - font_small_lineheight - 4 * SCALE) { y = utox_window_baseline - font_small_lineheight - 4 * SCALE; } edit->width = width -4 * SCALE - (edit->multiline ? SCROLL_WIDTH : 0); edit->height = height - 4 * SCALE; if(!edit->noborder) { framerect(x, y, x + width, y + height, (edit == active_edit) ? BLUE : (edit->mouseover ? C_GRAY2 : C_GRAY)); } drawrect(x + 1, y + 1, x + width - 1, y + height - 1, WHITE); setfont(FONT_TEXT); setcolor(COLOR_TEXT); int yy = y; if(edit->multiline) { pushclip(x + 1, y + 1, width - 2, height - 2); SCROLLABLE *scroll = edit->scroll; scroll->content_height = text_height(width - 4 * SCALE - SCROLL_WIDTH, font_small_lineheight, edit->data, edit->length) + 4 * SCALE; scroll_draw(scroll, x, y, width, height); yy -= scroll_gety(scroll, height); } if(!edit->length && maybe_i18nal_string_is_valid(&edit->empty_str)) { STRING* empty_str_text = maybe_i18nal_string_get(&edit->empty_str); setcolor(C_GRAY2); drawtext(x + 2 * SCALE, yy + 2 * SCALE, empty_str_text->str, empty_str_text->length); } _Bool a = (edit == active_edit); drawtextmultiline(x + 2 * SCALE, x + width - 2 * SCALE - (edit->multiline ? SCROLL_WIDTH : 0), yy + 2 * SCALE, y, y + height, font_small_lineheight, edit->data, edit->length, a ? edit_sel.start : STRING_IDX_MAX, a ? edit_sel.length : STRING_IDX_MAX, edit->multiline); if(edit->multiline) { popclip(); } }
void appdrawmessage (hdlappwindow appwindow) { if (app.hasmessagearea) { hdlappwindow ha = appwindow; WindowPtr w = (**ha).macwindow; Rect r = (**ha).messagerect; Rect rerase, rtext; bigstring bs; boolean flbitmap = false; pushmacport (w); /*flbitmap = openbitmap (r, w);*/ pushclip (r); rerase = r; rerase.top++; rerase.right--; eraserect (rerase); pushforecolor (&blackcolor); MoveTo (r.left, r.top); LineTo (r.right, r.top); popforecolor (); texthandletostring ((**ha).hmessage, bs); pushstyle (messagefont, messagesize, messagestyle); rtext = r; InsetRect (&rtext, 1, 1); centerstring (rtext, bs); popstyle (); popclip (); if (flbitmap) closebitmap (w); popmacport (); } } /*appdrawmessage*/
boolean aboutsetmiscstring (bigstring bsmisc) { #ifdef WIN95VERSION extern DWORD ixthreadglobalsgrabcount; // Tls index of counter for nest globals grabbing long grabcount = (long) TlsGetValue (ixthreadglobalsgrabcount); #endif // register hdlcancoonrecord hc = cancoonglobals; // hdlwindowinfo hinfo; copystring (bsmisc, bsmiscinfo); // if (!findaboutwindow (&hinfo) || !shellpushglobals ((**hinfo).macwindow)) // return (false); #ifdef WIN95VERSION if (grabcount > 0) #endif if (aboutport != nil && flhavemiscrect) { pushport (aboutport); pushclip (miscinforect); eraserect (miscinforect); movepento (miscinforect.left, miscinforect.top + globalfontinfo.ascent); pendrawstring (bsmisc); popclip (); popport (); } // shellpopglobals (); return (true); } /*aboutsetmiscstring*/
void enablescrollbar (hdlscrollbar hscrollbar) { hdlscrollbar h = hscrollbar; if (h == nil) /*defensive driving*/ return; if (!(**h).contrlRfCon) { /*the window containing the scrollbar is inactive*/ disablescrollbar (h); return; } scrollbarpushclip (h); HiliteControl (h, 0); /*validscrollbar (h);*/ popclip (); } /*enablescrollbar*/
void shellupdatewindow (WindowPtr w) { /* 1/17/91 dmb: draw scrollbars, buttons, etc. before window contents */ hdlwindowinfo hinfo; register hdlwindowinfo hw; getwindowinfo (w, &hinfo); hw = hinfo; /*copy into register*/ if ((hinfo == nil) || (**hinfo).fldisposewhenpopped) { #ifdef MACVERSION BeginUpdate (w); EndUpdate (w); #endif return; } BeginUpdate (w); if (!shellpushglobals (w)) goto exit; //Code change by Timothy Paustian Monday, August 21, 2000 4:31:49 PM //Must pass a CGrafPtr to pushport on OS X to avoid a crash { CGrafPtr thePort; #if TARGET_API_MAC_CARBON == 1 thePort = GetWindowPort(w); #else thePort = (CGrafPtr)w; #endif pushport (thePort);/*7/7/90 DW: this probably is not necessary, shellpushglobals does it*/ } #ifdef MACVERSION if (!config.fldialog) /*if it's a dialog, the callback routine re-drew the controls*/ DrawControls (w); if (config.flvertscroll) showscrollbar ((**hw).vertscrollbar); /*make sure it is visible*/ shelldrawgrowicon (hw); if (config.flhorizscroll) showscrollbar ((**hw).horizscrollbar); //Code change by Timothy Paustian Saturday, April 29, 2000 11:07:46 PM //Changed to Opaque call for Carbon //This is working, but it is giving bact the coordinates in local not //global. It seems to make more sense to me so leave it. #if ACCESSOR_CALLS_ARE_FUNCTIONS == 1 { CGrafPtr thePort = GetWindowPort(w); (**hw).drawrgn = NewRgn(); //note we delete this below (**hw).drawrgn = GetPortVisibleRegion(thePort, (**hw).drawrgn); } #else //old code (**hw).drawrgn = (*w).visRgn; /*so updater knows what needs drawing*/ #endif #endif #ifdef WIN95VERSION // (**hw).drawrgn = getvisregion (w); pushcliprgn ((**hw).drawrgn, false); #endif if (shellrectneedsupdate (&(**hw).buttonsrect)) /*if window has an attached button list, draw it*/ shelldrawbuttons (); drawwindowmessage (w); // 4.11.97 dmb: it appears that under Windows we need to push the clipk here. // Most likely, we should be establishing this wider clip soon arter window // creation, one time. if (shellrectneedsupdate (&(**hw).contentrect)) (*shellglobals.updateroutine) (); #ifdef WIN95VERSION popclip (); DeleteObject ((**hw).drawrgn); #endif #ifdef MACVERSION //Code change by Timothy Paustian Saturday, April 29, 2000 11:11:12 PM //Changed to Opaque call for Carbon //Get rid of the drawrgn to prevent a memory leak #if ACCESSOR_CALLS_ARE_FUNCTIONS == 1 DisposeRgn((**hw).drawrgn); #endif #endif (**hw).drawrgn = nil; /*this is a temp, keep it nil normally*/ popport (); /*7/7/90 DW: see comment for pusport, above*/ shellpopglobals (); exit: EndUpdate (w); } /*shellupdatewindow*/
void shellupdatecontent (Rect contentrect) { /* update the portion of contectrect in shellwindow that needs updating, and validate the area updated 2/11/91 dmb: it turns out that we usually want to update the scroll bars at this time too, before redrawing contectrect 12/9/91 dmb: quick bail-out if update rgn is empty 9/22/92 dmb: don't draw scrollbars when update rgn is empty */ register hdlwindowinfo hw = shellwindowinfo; register hdlregion contentrgn, updatergn; hdlregion actualupdatergn; actualupdatergn = getupdateregion (shellwindow); if (EmptyRgn (actualupdatergn)) { #ifdef WIN95VERSION DeleteObject (actualupdatergn); #endif return; } shellupdatescrollbars (hw); updatergn = NewRgn (); CopyRgn (actualupdatergn, updatergn); /*window's update rgn is global*/ globaltolocalrgn (updatergn); #ifdef MACVERSION RectRgn (contentrgn = NewRgn (), &contentrect); #if ACCESSOR_CALLS_ARE_FUNCTIONS == 1 //in carbon a copy of the update region is returned. DisposeRgn(actualupdatergn); actualupdatergn = nil; #endif #endif #ifdef WIN95VERSION DeleteObject (actualupdatergn); insetrect (&contentrect, -1, -1); contentrgn = CreateRectRgn (contentrect.left, contentrect.top, contentrect.right, contentrect.bottom); #endif SectRgn (contentrgn, updatergn, contentrgn); /*re-use contentrgn*/ #if defined(WIN95VERSION) && fldebug /****** DEBUG CODE *********/ if (false) { RECT rrr; GetClientRect (shellwindow, &rrr); DeleteObject(contentrgn); contentrgn = CreateRectRgn (rrr.left, rrr.top, rrr.right, rrr.bottom); FillRect (getport(), &rrr, GetStockObject (WHITE_BRUSH)); } #endif if (!EmptyRgn (contentrgn)) { (**hw).drawrgn = contentrgn; /*for display routines to refer to*/ //Code change by Timothy Paustian Monday, June 19, 2000 3:09:46 PM //Changed to Opaque call for Carbon #ifdef MACVERSION #if TARGET_API_MAC_CARBON == 1 ValidWindowRgn((WindowRef) hw, contentrgn); #else ValidRgn (contentrgn); /*no need to draw it again. do now to simulate beginupdate*/ #endif #endif #ifdef WIN95VERSION ValidateRgn (shellwindow, contentrgn); #endif pushcliprgn (contentrgn, false); (*shellglobals.updateroutine) (); popclip (); (**hw).drawrgn = nil; /*keep it neat, this guy is a temp*/ } DisposeRgn (updatergn); DisposeRgn (contentrgn); } /*shellupdatecontent*/