static void drawcolorpopup (Rect menurect) { short i, j; Rect r; pushforecolor (&lightbluecolor); PaintRect (&menurect); for (i = 0; i < 8; i++) { for (j = 0; j < 32; j++) { getitemrect (i * 32 + j + 1, &r); OffsetRect (&r, menurect.left, menurect.top); RGBForeColor (&blackcolor); InsetRect (&r, 1, 1); PaintRect (&r); InsetRect (&r, 1, 1); RGBForeColor (&(*ctable) [i * 32 + j].rgb); PaintRect (&r); } /*for*/ } /*for*/ popforecolor (); } /*drawcolorpopup*/
static int OneButtonBox (char *text, char *button1) { DialogPtr theDialog; short itemHit,itemType; Handle item; Rect box; char buffer[256]; theDialog = GetNewDialog(oneButtonDialog,NULL,(WindowPtr) -1); /* draw OK Button */ GetDialogItem(theDialog,OKButton,&itemType,&item,&box); SetPort((GrafPtr) theDialog); PenSize(3,3); InsetRect(&box,-4,-4); FrameRoundRect(&box,16,16); /* change text of button 1 */ strcpy(buffer,button1); SetControlTitle((ControlHandle) item,c2pstr(buffer)); GetDialogItem(theDialog,2,&itemType,&item,&box); strcpy(buffer,text); SetDialogItemText(item,c2pstr(buffer)); itemHit=0; while (itemHit!=OKButton) { ModalDialog(NULL,&itemHit); } DisposeDialog(theDialog); return(itemHit); }
void cPict::draw(){ RGBColor store_color; Rect rect = frame; GrafPtr cur_port; GetPort(&cur_port); SetPortWindowPort(parent->win); if(!visible){ // Erase it InsetRect(&rect, -3, -3); tileImage(rect,bg_gworld,bg[parent->bg]); return; } if(picNum < 0) { // Just fill with black GetForeColor(&store_color); ForeColor(blackColor); PaintRect(&rect); RGBForeColor(&store_color); return; } GetBackColor(&store_color); BackColor(whiteColor); drawPict()[picType](picNum,rect); if(drawFramed) drawFrame(2,0); SetPort(cur_port); }
int main () { int ret; Rect windRect; long start,end,amount; /* Initialize all the needed managers. */ InitGraf(&qd.thePort); InitFonts(); InitWindows(); InitMenus(); TEInit(); InitDialogs(nil); InitCursor(); //ProfilerInit(collectDetailed, bestTimeBase, 1000, 50); //ProfilerSetStatus(true); windRect = qd.screenBits.bounds; InsetRect(&windRect, 50, 50); pWindow = NewCWindow(nil, &windRect, "\pMpeg", true, documentProc, (WindowPtr) -1, false, 0); start = TickCount(); main2(); end = TickCount(); amount = end - start; fprintf(stderr, "Time taken %d memoryAllocator %d \n", amount,counter); // ProfilerDump("\pProfile.out"); do { } while (!Button()); }
/******************************************************************************* Function : DDV_GetCurrentDispRange() Purpose : compute the size (row/col) of the DDV panel Return value : see arguments (zero-based values) *******************************************************************************/ extern void DDV_GetCurrentDispRange(PaneL hWndDDV,UnDViewerGraphDataPtr GrData, Int4 LengthAli,Int4Ptr from_col,Int4Ptr to_col,Int4Ptr from_row, Int4Ptr to_row) { RecT rcP; DdvMainPtr dmp; dmp = (DdvMainPtr) GetObjectExtra(hWndDDV); if (dmp==NULL) return; /*panel size*/ ObjectRect(hWndDDV,&rcP); InsetRect(&rcP,4,4); /*drawing region:*/ DDV_AdjustDrawingRect(&rcP,&(GrData->udv_font),dmp); rcP.left+=GrData->udv_panel.cxName+GrData->udv_scale.cxLeftScale; rcP.top+=GrData->udv_panel.cyScale; *from_col=0; *to_col=(rcP.right-rcP.left)/GrData->udv_font.ColWidth-1; *from_col+=GrData->udv_hscrl.ScrollPos; *to_col+=GrData->udv_hscrl.ScrollPos; if (*to_col>LengthAli) *to_col=LengthAli-1; if (*from_col>LengthAli) *from_col=LengthAli-1; *from_row=0; *to_row=(rcP.bottom-rcP.top)/GrData->udv_font.LineHeight-1; *from_row+=GrData->udv_vscrl.ScrollPos; *to_row+=GrData->udv_vscrl.ScrollPos; if (*from_row>(GrData->udv_panel.nTotLines-1)) *from_row=GrData->udv_panel.nTotLines-1; if (*to_row>(GrData->udv_panel.nTotLines-1)) *to_row=GrData->udv_panel.nTotLines-1; }
static void DOT_DrawAbout (PaneL p) { RecT r; Char str [60]; FonT titleFont=NULL; if (titleFont == NULL) { #ifdef WIN_MAC titleFont = GetFont ("Geneva", 18, TRUE, TRUE, FALSE, ""); #endif #ifdef WIN_MSWIN titleFont = GetFont ("Arial", 24, TRUE, TRUE, FALSE, ""); #endif #ifdef WIN_MOTIF titleFont = GetFont ("Courier", 24, TRUE, TRUE, FALSE, ""); #endif } sprintf (str, "Beta 1.05 [%s - %s]", date_of_compilation, time_of_compilation); ObjectRect (p, &r); InsetRect (&r, 4, 4); r.top += 10; Magenta (); DOT_CenterString (&r, " ~ D-Viewer ~", titleFont, 5); /* DOT_CenterString (&r, str, programFont, 10); */ /* CenterString (&r, "National Center for Biotechnology Information", systemFont, 5); CenterString (&r, "National Library of Medicine", systemFont, 5); CenterString (&r, "National Institutes of Health", systemFont, 10); */ }
void LCD_resize(Lcd *x) { Rect r; short hor,ver; #ifdef debug post("LCD_Resize"); #endif r = x->lcd_box.b_rect; hor = x->cols = FixRound(FixRatio(((r.right-r.left-(2*BORDER_WIDTH))),x->f_width)); ver = x->rows = FixRound(FixRatio(((r.bottom-r.top-(2*BORDER_HEIGHT))),x->f_height)); #ifdef FORCEDResize x->lcd_box.b_rect.right = r.left + (2*BORDER_WIDTH) + hor*x->f_width; x->lcd_box.b_rect.bottom = r.top + (2*BORDER_HEIGHT) + ver*x->f_height; #endif if (x->lcd_region) DisposeRgn(x->lcd_region); x->lcd_oldRect = r = x->lcd_box.b_rect; InsetRect(&r,1,1); x->lcd_region = NewRgn(); RectRgn(x->lcd_region,&r); /* DDZ simpler way to make a rectangular region */ }
static pascal void colormenuhandler (short msg, MenuHandle hmenu, Rect *menurect, Point pt, short *item) { switch (msg) { case mDrawMsg: drawcolorpopup (*menurect); break; case mChooseMsg: { short x; Rect rinset; rinset = *menurect; InsetRect (&rinset, OUTSETSIZE, OUTSETSIZE); if (!PtInRect (pt, &rinset)) x = 0; else { x = 32L * ((pt.v - (*menurect).top - OUTSETSIZE) / ITEMSIZE) + (pt.h - (*menurect).left - OUTSETSIZE) / ITEMSIZE + 1; if (x < 0) x = 0; } if (*item == x) /*already highlighted*/ break; frameitem (*item, *menurect); /*unhighlight the original item*/ frameitem (x, *menurect); /*highlight the newly selected item*/ *item = x; break; } case mSizeMsg: (**hmenu).menuHeight = 8L * ITEMSIZE + 2; (**hmenu).menuWidth = 32L * ITEMSIZE + 2; break; case mPopupMsg: (*menurect).top = pt.h; (*menurect).right = pt.v; (*menurect).bottom = (*menurect).top + (**hmenu).menuHeight; (*menurect).left = (*menurect).right - (**hmenu).menuWidth; break; } /*switch*/ } /*colormenuhandler*/
static void HandleMouseDown(EventRecord *pevent) { WindowPtr hWnd; Rect rDrag; switch(FindWindow(pevent->where, &hWnd)) { case inMenuBar: if (np2running) { soundmng_stop(); mousemng_disable(MOUSEPROC_MACUI); HandleMenuChoice(MenuSelect(pevent->where)); mousemng_enable(MOUSEPROC_MACUI); soundmng_play(); } break; case inDrag: #if TARGET_API_MAC_CARBON { BitMap gscreenBits; GetQDGlobalsScreenBits(&gscreenBits); rDrag = gscreenBits.bounds; InsetRect(&rDrag, DRAG_THRESHOLD, DRAG_THRESHOLD); DragWindow(hWnd, pevent->where, &rDrag); } #else rDrag = qd.screenBits.bounds; InsetRect(&rDrag, DRAG_THRESHOLD, DRAG_THRESHOLD); DragWindow(hWnd, pevent->where, &rDrag); #endif break; case inContent: mousemng_buttonevent((pevent->modifiers & (1 << 12)) ?MOUSEMNG_RIGHTDOWN:MOUSEMNG_LEFTDOWN); break; case inGoAway: if (TrackGoAway(hWnd, pevent->where)) { } np2running = FALSE; break; } }
void cPict::drawPresetTer(short num, Rect to_rect){ printf("Getting terrain icon from sheet %i.\n",num / 50); if(!isSheetSet(SHEET_TER,num / 50)) throw xMissingSheet(SHEET_TER,num / 50); GWorldPtr from_gw = ter[num / 50]; num = num % 50; Rect from_rect = calc_rect(num % 10, num / 10); if (to_rect.right - to_rect.left > 28) InsetRect(&to_rect,4,0); rect_draw_some_item(from_gw, from_rect, to_rect, (Point){0,0}); }
void LCD_clear_area(Lcd *x) /* erase the area occupied by the LCD */ { Rect r; r = x->lcd_oldRect; InsetRect(&r,1,1); EraseRect(&r); x->lcd_row = 0; x->lcd_col = 0; }
/******************************************************************************* Function : DDV_InvalRegion() Purpose : invalidate a specific region of DDV panel Note : disp_from,disp_to,disp_row are display coordinates. disp_from,disp_to are zero-based. disp_row is one-based Return value : the sequence *******************************************************************************/ extern void DDV_InvalRegion(PaneL hWndDDV,UnDViewerGraphDataPtr GrData, Int4 disp_from,Int4 disp_to,Int4 disp_row,Boolean IsSelect) { DdvMainPtr dmp; RecT rcP,rc; Int2 from_x,to_x,from_y,to_y; WindoW temport; dmp = (DdvMainPtr) GetObjectExtra(hWndDDV); if (dmp==NULL) return; /*convert disp coord to pixel positions*/ /*left of the first letter in the range*/ from_x=(Int2)((disp_from-GrData->udv_hscrl.ScrollPos)*GrData->udv_font.ColWidth); /*right of the last letter in the range*/ to_x=(Int2)((disp_to-GrData->udv_hscrl.ScrollPos+1)*GrData->udv_font.ColWidth); /*just above the row*/ from_y=(Int2)((disp_row-GrData->udv_vscrl.ScrollPos-1)*GrData->udv_font.LineHeight); /*just below the row*/ to_y=(Int2)(from_y+2*GrData->udv_font.LineHeight); /*adjust the values according to the PaneL RecT position*/ /*panel size*/ temport=SavePort(ParentWindow(hWndDDV)); Select(hWndDDV); ObjectRect(hWndDDV,&rcP); InsetRect(&rcP,4,4); /*drawing region:*/ DDV_AdjustDrawingRect(&rcP,&(GrData->udv_font),dmp); rcP.left+=GrData->udv_panel.cxName+GrData->udv_scale.cxLeftScale; rcP.top+=3*GrData->udv_panel.cyScale/2; from_x+=rcP.left-1; to_x+=rcP.left; from_y+=rcP.top+1; to_y+=rcP.top; rc.left=from_x-2; rc.top=from_y-2; rc.right=to_x+2; rc.bottom=to_y+2; /*InvalRect(&rc);*/ /*DDV_DrawPanelContent_H (hWndDDV,dmp,&rc,IsSelect);*/ if (!IsSelect){ /*printf("invalRect\n");*/ InvalRect(&rc); } else{ DDV_DrawPanelContent_H (hWndDDV,dmp,&rc,IsSelect); } /* Update();*/ RestorePort(temport); }
static void update_PlayerWin() { short y=((double)mac_amplitude/255)*(rVol.bottom-rVol.top-20); Rect rFrame,rTab; SetPortWindowPort(win.ref); DrawButton(); skin_f_repeat? PlotCIcon(&rLoop, iconLoop):PlotCIcon(&rLoop, iconNotLoop); PlotCIcon(&rVol, iconVol); SetRect(&rTab, rVol.left+2, rVol.top+49-y, rVol.right-2, rVol.top+59-y); PlotCIcon(&rTab, iconTab); rFrame=rFileName; InsetRect(&rFrame, -2, -2); DrawPicture(GetPicture(129), &rFrame); rFrame=rTime; InsetRect(&rFrame, -2, -2); DrawPicture(GetPicture(130), &rFrame); DrawPicture(logo, &rLogo); DrawTimeStr(); DrawFileStr(); }
void cPict::drawPresetTerAnim(short num, Rect to_rect){ Rect from_rect = calc_rect(4 * (num / 5) + animFrame, num % 5); if(!isSheetSet(SHEET_TER_ANIM)) throw xMissingSheet(SHEET_TER_ANIM); GWorldPtr from_gw = teranim; printf("Getting animated terrain graphic %i from sheet 20", num); if (to_rect.right - to_rect.left > 28) { InsetRect(&to_rect,4,0); to_rect.right = to_rect.left + 28; } rect_draw_some_item(from_gw, from_rect, to_rect, (Point){0,0}); }
static void handledrag (EventRecord *ev, WindowPtr w) { Rect r; r = qd.screenBits.bounds; r.top = r.top + GetMBarHeight (); InsetRect (&r, 4, 4); DragWindow (w, (*ev).where, &r); } /*handledrag*/
static pascal void drawProc(ControlRef inControl, SInt16 inPart) { #pragma unused(inControl, inPart) int i; RGBColor saveForeColor; RGBColor saveBackColor; PenState savePenState; GetForeColor(&saveForeColor); GetBackColor(&saveBackColor); GetPenState(&savePenState); RGBForeColor(&rgbBlack); RGBBackColor(&rgbWhite); PenNormal(); for (i = 0; i < sNumMonitors; i++) { RGBForeColor(&rgbGray); PaintRect(&sMonitors[i].scaledRect); if (sMonitors[i].isMain) { Rect r = sMonitors[i].scaledRect; InsetRect(&r, 1, 1); r.bottom = r.top + 6; RGBForeColor(&rgbWhite); PaintRect(&r); RGBForeColor(&rgbBlack); PenSize(1,1); MoveTo(r.left, r.bottom); LineTo(r.right, r.bottom); } if (sMonitors[i].device == sSelectedDevice) { PenSize(3,3); RGBForeColor(&rgbBlack); FrameRect(&sMonitors[i].scaledRect); } else { PenSize(1,1); RGBForeColor(&rgbBlack); FrameRect(&sMonitors[i].scaledRect); } } // restore the original pen state and colors RGBForeColor(&saveForeColor); RGBBackColor(&saveBackColor); SetPenState(&savePenState); }
/* restores former dialog size and (on Mac) position */ bool CDlgItemProperties::RestoreState() { wxConfigBase* pConfig = wxConfigBase::Get(FALSE); int iWidth, iHeight; wxASSERT(pConfig); if (!pConfig) return false; pConfig->SetPath(m_strBaseConfigLocation); pConfig->Read(wxT("Width"), &iWidth, wxDefaultCoord); pConfig->Read(wxT("Height"), &iHeight, wxDefaultCoord); #ifndef __WXMAC__ // Set size to saved values or defaults if no saved values SetSize(iWidth, iHeight); #else int iTop, iLeft; pConfig->Read(wxT("YPos"), &iTop, wxDefaultCoord); pConfig->Read(wxT("XPos"), &iLeft, wxDefaultCoord); // If either co-ordinate is less then 0 then set it equal to 0 to ensure // it displays on the screen. if ((iLeft < 0) && (iLeft != wxDefaultCoord)) iLeft = 30; if ((iTop < 0) && (iTop != wxDefaultCoord)) iTop = 30; // Set size and position to saved values or defaults if no saved values SetSize(iLeft, iTop, iWidth, iHeight, wxSIZE_USE_EXISTING); // Now make sure window is on screen GetScreenPosition(&iLeft, &iTop); GetSize(&iWidth, &iHeight); Rect titleRect = {iTop, iLeft, iTop+22, iLeft+iWidth }; InsetRect(&titleRect, 5, 5); // Make sure at least a 5X5 piece visible RgnHandle displayRgn = NewRgn(); CopyRgn(GetGrayRgn(), displayRgn); // Region encompassing all displays Rect menuRect = ((**GetMainDevice())).gdRect; menuRect.bottom = GetMBarHeight() + menuRect.top; RgnHandle menuRgn = NewRgn(); RectRgn(menuRgn, &menuRect); // Region hidden by menu bar DiffRgn(displayRgn, menuRgn, displayRgn); // Subtract menu bar region if (!RectInRgn(&titleRect, displayRgn)) { iTop = iLeft = 30; SetSize(iLeft, iTop, iWidth, iHeight, wxSIZE_USE_EXISTING); } DisposeRgn(menuRgn); DisposeRgn(displayRgn); #endif return true; }
void cPict::drawCustomMissile(short num, Rect to_rect){ num += animFrame % 4; Rect from_rect; short n = get_custom_rect(num,from_rect); if(!isSheetSet(SHEET_CUSTOM,n)) throw xMissingSheet(SHEET_CUSTOM,n); GWorldPtr from_gw = customSheets[n]; from_rect.right = from_rect.left + 18; from_rect.bottom = from_rect.top + 18; if(animFrame >= 4) OffsetRect(&from_rect, 0, 18); PaintRect(&to_rect); InsetRect(&to_rect,5,9); rect_draw_some_item(from_gw, from_rect, to_rect, (Point){0,0}, transparent); }
/* calculate a new stdState rectangle based on the maximum bounds, positioned on the device which the given window overlaps most */ void build_zoom_rectangle( WindowPtr window, Rect *bounds) { GDHandle device; WStateDataHandle window_state; Rect zoomed, unzoomed; Rect device_bounds; short bias; window_state= (WStateDataHandle) (((CWindowRecord *)window)->dataHandle); zoomed= (*window_state)->stdState; unzoomed= (*window_state)->userState; /* official Apple source sends the title bar along with this rectangle, but that isnÕt useful */ device= MostDevice(&unzoomed); if (!device) device= GetMainDevice(); bias= unzoomed.top-(*((WindowPeek)window)->strucRgn)->rgnBBox.top-1; if (device==GetMainDevice()) bias+= GetMBarHeight(); device_bounds= (*device)->gdRect; InsetRect(&device_bounds, 3, 3); device_bounds.top+= bias; zoomed= *bounds; OffsetRect(&zoomed, unzoomed.left-zoomed.left, unzoomed.top-zoomed.top); if (RECTANGLE_HEIGHT(&zoomed)>RECTANGLE_HEIGHT(&device_bounds)) { zoomed.top= device_bounds.top; zoomed.bottom= device_bounds.bottom; } else { if (zoomed.bottom>device_bounds.bottom) OffsetRect(&zoomed, 0, device_bounds.bottom-zoomed.bottom); if (zoomed.top<device_bounds.top) OffsetRect(&zoomed, 0, device_bounds.top-zoomed.top); } if (RECTANGLE_WIDTH(&zoomed)>RECTANGLE_WIDTH(&device_bounds)) { zoomed.left= device_bounds.left; zoomed.right= device_bounds.right; } else { if (zoomed.right>device_bounds.right) OffsetRect(&zoomed, device_bounds.right-zoomed.right, 0); if (zoomed.left<device_bounds.left) OffsetRect(&zoomed, device_bounds.left-zoomed.left, 0); } (*window_state)->stdState= zoomed; return; }
void CDlgMessages::RestoreWindowDimensions() { wxString strBaseConfigLocation = wxString(wxT("/Simple/Messages")); wxConfigBase* pConfig = wxConfigBase::Get(FALSE); bool bWindowIconized = false; bool bWindowMaximized = false; int iHeight = 0; int iWidth = 0; int iTop = 0; int iLeft = 0; wxASSERT(pConfig); pConfig->SetPath(strBaseConfigLocation); pConfig->Read(wxT("YPos"), &iTop, 30); pConfig->Read(wxT("XPos"), &iLeft, 30); pConfig->Read(wxT("Width"), &iWidth, 640); pConfig->Read(wxT("Height"), &iHeight, 480); pConfig->Read(wxT("WindowIconized"), &bWindowIconized, false); pConfig->Read(wxT("WindowMaximized"), &bWindowMaximized, false); #ifndef __WXMAC__ Iconize(bWindowIconized); Maximize(bWindowMaximized); if (!IsIconized() && !IsMaximized()) { SetSize(-1, -1, iWidth, iHeight); } #else // ! __WXMAC__ // If the user has changed the arrangement of multiple // displays, make sure the window title bar is still on-screen. Rect titleRect = {iTop, iLeft, iTop+22, iLeft+iWidth }; InsetRect(&titleRect, 5, 5); // Make sure at least a 5X5 piece visible RgnHandle displayRgn = NewRgn(); CopyRgn(GetGrayRgn(), displayRgn); // Region encompassing all displays Rect menuRect = ((**GetMainDevice())).gdRect; menuRect.bottom = GetMBarHeight() + menuRect.top; RgnHandle menuRgn = NewRgn(); RectRgn(menuRgn, &menuRect); // Region hidden by menu bar DiffRgn(displayRgn, menuRgn, displayRgn); // Subtract menu bar retion if (!RectInRgn(&titleRect, displayRgn)) iTop = iLeft = 30; DisposeRgn(menuRgn); DisposeRgn(displayRgn); SetSize(iLeft, iTop, iWidth, iHeight); #endif // ! __WXMAC__ }
int disk_error_handler(int errval, int ax, int bp, int si) { rect R, R2; char tbuf[128]; int err; int centerx = sR.Xmax / 2; int centery = sR.Ymax / 2; int height = 2 * FontHeight + 10; int width = sR.Xmax / 2; R.Xmin = sR.Xmax / 4; R.Xmax = R.Xmin + width; R.Ymin = centery - height / 2; R.Ymax = R.Ymin + height; PushRect(&R, &err); if (ax < 0) sprintf(tbuf, "Device error %x: %x %p", errval, ax, MK_FP(bp, si)); else sprintf(tbuf, "Disk error on drive %c", 'A' + (ax & 0xff)); PenColor(MENUBACK); PaintRect(&R); PenColor(MENUTEXT); BackColor(MENUBACK); R2 = R; InsetRect(&R2, 2, 2); FrameRect(&R2); TextAlign(alignCenter, alignTop); MoveTo(centerx, R.Ymin + 4); DrawString(tbuf); MoveTo(centerx, R.Ymin + FontHeight + 4); DrawString("Hit any key to continue"); getch(); PopRect(&err); hardretn(-1); #pragma warn -rvl }
void box_d_item(DialogPtr dp, short item) { Rect r; Handle h; short itemType; GetDItem (dp, item, &itemType, &h, &r); PenNormal (); PenSize (2, 2); InsetRect (&r, -2, -2); FrameRect (&r); PenNormal (); }
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*/
void cPict::drawPresetItem(short num, Rect to_rect){ to_rect.right = to_rect.left + 28; to_rect.bottom = to_rect.top + 36; PaintRect(&to_rect); GWorldPtr from_gw; Rect from_rect = {0,0,18,18}; if (num < 45) { if(!isSheetSet(SHEET_ITEM)) throw xMissingSheet(SHEET_ITEM); from_gw = item; from_rect = calc_rect(num % 5, num / 5); }else{ if(!isSheetSet(SHEET_TINY_ITEM)) throw xMissingSheet(SHEET_TINY_ITEM); from_gw = tinyItem; InsetRect(&to_rect,5,9); OffsetRect(&from_rect,18 * (num % 10), 18 * (num / 10)); } rect_draw_some_item(from_gw, from_rect, to_rect, (Point){0,0}, transparent); }
static void DrawAbout (PaneL p) { RecT r; ObjectRect (p, &r); InsetRect (&r, 4, 4); r.top += 10; Blue (); CenterString (&r, "Entrez", titleFont, 5); CenterString (&r, entrezVersion, programFont, 5); CenterString (&r, entrezRelease, programFont, 10); CenterString (&r, "National Center for Biotechnology Information", systemFont, 5); CenterString (&r, "National Library of Medicine", systemFont, 5); CenterString (&r, "National Institutes of Health", systemFont, 10); CenterString (&r, "(301) 496-2475", systemFont, 5); CenterString (&r, "*****@*****.**", systemFont, 0); }
void drawSourceImage() { Rect rect; Rect outlineRect; Rect tempRect1; GetPortBounds(gGWorld, &tempRect1); SetRect( &rect, 20, 37, 20 + tempRect1.right, 37 + tempRect1.bottom); outlineRect = rect; InsetRect( &outlineRect, -5, -5 ); drawDeepBox( &outlineRect ); ForeColor( blackColor ); BackColor( whiteColor ); CopyBits( (BitMap *)(*(GetPortPixMap(gGWorld))), GetPortBitMapForCopyBits(GetWindowPort(gWindow)), &((**(GetPortPixMap(gGWorld))).bounds), &rect, srcCopy, nil ); }
static void ListRules (DoC doc, CommentRulePtr rule_list, FonT font) { CommentRulePtr cr; RecT r; Reset (doc); ObjectRect (doc, &r); InsetRect (&r, 4, 4); if (font == NULL) font = programFont; for (cr = rule_list; cr != NULL; cr = cr->next) { AppendText (doc, cr->prefix == NULL ? "" : cr->prefix, NULL, NULL, font); } AppendText (doc, "Click here to add new rule", NULL, NULL, font); UpdateDocument (doc, 0, 0); }
void drawChargeButton(void) { /* This one is a bit sneaky. We might not have a single charge... */ int i; HideCursor(); set_samecharges(); if (samecharges) { if (charge_thing == DIFFERENT) { RasterOp(zREPz); PenColor(BLUE); PaintRect(&chargeR); tools[0].t->value = chargeunit; CreateNumberToolTitle(tools[0].t, tools[0].text,WHITE,BLUE); mainR[5] = &tools[0].t->TB.nR; mainR[6] = &tools[0].t->mR; mainR[7] = &tools[0].t->pR; } else drawone(&ChargeTool,chargeunit); charge_thing = SAME; } else { if (charge_thing == SAME) { rect R = chargeR; RasterOp(zREPz); InsetRect(&R,-2,0); PenColor(BLUE); PaintRect(&R); PaintRadioButton(&chargeR,false,false,chargemsg); for(i=0;i<3;i++) mainR[i+5] = &chargeR; } charge_thing = DIFFERENT; } ShowCursor(); }
ENDDISPATCH /* XGPopControl::DoInlineClose * * Handle inline close operation. This is only sent when a * popup control is created... */ long XGPopControl::DoInlineClose(long, void *parg) { XGSPopupInline *p = (XGSPopupInline *)parg; XRect r,s; if (fPop) { fPop = NULL; /* * Alter my value */ fValue = p->value; DoDispatch(KXGPopValue,GetViewID(),NULL); /* * Reddraw me in the 'up' position */ XGDraw draw(this); fFont->Attach(); draw.SetFont(fFont); r = GetContentRect(); draw.Draw3DRect(r,KXGEButton); s = r; s.left = s.right - (s.bottom - s.top); InsetRect(&s,2,2); draw.Draw3DRect(s,KXGEOutset); } return 0; }
/* DisplayDialogCmd(theDialog, dlogItemNo, cmd) Displays the command in an IGOR-style dialog. See GBLoadWaveDialog.c for an example. dlogItemNo is the item number of the dialog item in which the command is to be displayed. On the Macintosh, this must be a user item. On Windows, it must be an EDITTEXT item. Thread Safety: DisplayDialogCmd is not thread-safe. */ void DisplayDialogCmd(DialogPtr theDialog, int dlogItemNo, const char* cmd) { WindowRef theWindow; CGrafPtr thePort; Rect box; int font, size; int lineHeight; FontInfo info; RgnHandle saveClipRgnH; theWindow = GetDialogWindow(theDialog); thePort = GetWindowPort(theWindow); font = GetPortTextFont(thePort); // Save text characteristics. size = GetPortTextSize(thePort); TextFont(kFontIDMonaco); TextSize(9); GetFontInfo(&info); lineHeight = info.ascent + info.descent + info.leading; GetDBox(theDialog, dlogItemNo, &box); saveClipRgnH = NewRgn(); if (saveClipRgnH != NULL) { GetClip(saveClipRgnH); ClipRect(&box); InsetRect(&box, 2, 2); EraseRect(&box); if (*cmd != 0) { MoveTo(box.left+2, box.top + info.ascent + 2); DrawDialogCmd(cmd, lineHeight); } SetClip(saveClipRgnH); DisposeRgn(saveClipRgnH); } TextFont(font); // Restore font, size, style. TextSize(size); }