static void mac_groweventlog(WindowPtr window, EventRecord *event) { Session *s = mac_windowsession(window); Rect limits; long grow_result; #if TARGET_API_MAC_CARBON Rect rect; Point cellsize; #else GrafPtr saveport; #endif SetRect(&limits, 15, 0, SHRT_MAX, SHRT_MAX); grow_result = GrowWindow(window, event->where, &limits); if (grow_result == 0) return; SizeWindow(window, LoWord(grow_result), HiWord(grow_result), TRUE); LSize(LoWord(grow_result) - 15, HiWord(grow_result), s->eventlog); mac_adjusteventlogscrollbar(s); /* We would use SetListCellSize in Carbon, but it's missing. */ (*s->eventlog)->cellSize.h = LoWord(grow_result) - 15; #if TARGET_API_MAC_CARBON cellsize.h = LoWord(grow_result) - 15; GetListViewBounds(s->eventlog, &rect); InvalWindowRect(window, &rect); #else GetPort(&saveport); SetPort(window); InvalRect(&(*s->eventlog)->rView); SetPort(saveport); #endif }
void DoVolume() { short lastAmp=mac_amplitude; //SndCommand theCmd; Point p; SetPortWindowPort(win.ref); GetMouse(&p); /*GlobalToLocal(&p);*/ if( PtInRect(p, &rVol) && FrontWindow()==win.ref ) { mac_amplitude=255*((double)rVol.bottom-10-p.v)/(rVol.bottom-rVol.top-20); if( mac_amplitude<0 ) mac_amplitude=0; if( mac_amplitude>255 ) mac_amplitude=255; if( lastAmp!=mac_amplitude ) { //theCmd.cmd=ampCmd; //theCmd.param1=mac_amplitude; //SndDoImmediate(gSndCannel, &theCmd); mac_setVolume(mac_amplitude); InvalRect(&rVol); } } }
/* -----------------------------------------------------------------------------*/ static void InvalPortArea () { short top = topPortArea(myWindow); Rect r; SetRect (&r, kPortLeft, top, kPortLeft + kPortArea, top + kPortArea); InvalRect (&r); }
/******************************************************************************* 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); }
void ShowLogo(Boolean bEraseRect) { short reserr; Rect derefd, logoRect; PicHandle logoPicH; Handle logoRectH; /* draw the image well */ ControlHandle imgWellH = GetNewControl(rLogoImgWell, gWPtr); if (!imgWellH) { ErrorHandler(eMem, nil); return; } /* initialize Netscape logo */ logoPicH = GetPicture(rNSLogo); reserr = ResError(); if (reserr == noErr) { /* draw Netscape logo */ if (logoPicH != nil) { logoRectH = GetResource('RECT', rNSLogoBox); reserr = ResError(); if (reserr == noErr && logoRectH) { HLock(logoRectH); derefd = (Rect) **((Rect**)logoRectH); SetRect(&logoRect, derefd.left, derefd.top, derefd.right, derefd.bottom); HUnlock(logoRectH); reserr = ResError(); if (reserr == noErr) { if (bEraseRect) { EraseRect(&logoRect); InvalRect(&logoRect); } DrawPicture(logoPicH, &logoRect); ReleaseResource((Handle)logoPicH); } ReleaseResource((Handle)logoRectH); } } } if (reserr != noErr) ErrorHandler(reserr, nil); }
void dogrowwin (Point start, WindowPtr wp) { Rect r; long newsize; /* todo: find out what is normally done when there is no maximum size that needs to be enforced */ SetRect (&r, ICONWIDTHUSED, ICONHEIGHTUSED, 32767, 32767); newsize = GrowWindow (wp, start, &r); SizeWindow (wp, LoWord (newsize), HiWord (newsize), true); InvalRect (&wp->portRect); straightenwindow (wp); }
void HandleMouseDown(EventRecord *event) { short part; WindowRef window; MacWindow *macwin; Rect growRect={100,100,32000,32000}; long size; part=FindWindow(event->where, &window); macwin = (MacWindow*)GetWRefCon(window); switch(part) { case inMenuBar: mac_AdjustMenus(event->modifiers); mac_HandleMenuSelect(MenuSelect(event->where), event->modifiers); HiliteMenu(0); break; case inContent: SetPortWindowPort(window); SelectWindow(window); GlobalToLocal(&event->where); if(macwin) macwin->click(event->where, event->modifiers); break; case inDrag: DragWindow(window, event->where, &qd.screenBits.bounds); break; case inGrow: SetPortWindowPort(window); size=GrowWindow(window, event->where, &growRect); if( size ) { SizeWindow(window, size&0x0000FFFF, size>>16, 0); EraseRect(&GetWindowPort(window)->portRect); InvalRect(&GetWindowPort(window)->portRect); if( macwin ) macwin->message(MW_GROW, size); } break; case inGoAway: if( TrackGoAway(window, event->where) ){ if( macwin ){ macwin->goaway(macwin); } } break; //case inZoomIn: //case inZoomOut: // break; } }
void mark_for_update( GrafPtr port, Rect *rectangle) { GrafPtr old_port; GetPort(&old_port); SetPort(port); if (!rectangle) rectangle= &port->portRect; EraseRect(rectangle); InvalRect(rectangle); SetPort(old_port); return; }
void XConfigureWindow( Display* display, /* Display. */ Window w, /* Window. */ unsigned int value_mask, XWindowChanges* values) { MacDrawable *macWin = (MacDrawable *) w; TkWindow *winPtr = macWin->winPtr; display->request++; /* * Change the shape and/or position of the window. */ if (value_mask & (CWX|CWY|CWWidth|CWHeight)) { XMoveResizeWindow(display, w, winPtr->changes.x, winPtr->changes.y, winPtr->changes.width, winPtr->changes.height); } /* * Change the stacking order of the window. Tk actuall keeps all * the information we need for stacking order. All we need to do * is make sure the clipping regions get updated and generate damage * that will ensure things get drawn correctly. */ if (value_mask & CWStackMode) { Rect bounds; GWorldPtr destPort; destPort = TkMacGetDrawablePort(w); if (destPort != NULL) { SetPort((GrafPtr) destPort); TkMacInvalClipRgns(winPtr->parentPtr); TkMacWinBounds(winPtr, &bounds); InvalRect(&bounds); } } /* TkGenWMMoveRequestEvent(macWin->winPtr, macWin->winPtr->changes.x, macWin->winPtr->changes.y); */ }
static void click_PlayerWin(Point p, short /*modifiers*/) { if( PtInRect(p, &rStop)){ mac_rc=RC_QUIT; ctl_current_time(0,0); } else if( PtInRect(p, &rPlay)){ mac_rc=RC_CONTINUE; } else if( PtInRect(p, &rPause)){ mac_rc=RC_TOGGLE_PAUSE; } else if( PtInRect(p, &rPrevious)){ mac_rc=RC_PREVIOUS; } else if( PtInRect(p, &rForward)){ mac_rc=RC_NEXT; } else if( PtInRect(p, &rEject)){ if( skin_state==PLAYING ) mac_rc=RC_QUIT; skin_state=WAITING; mac_n_files=nPlaying=0; fileStr[0]=timeStr[0]=0; init_ListWin(); update_PlayerWin(); } else if( PtInRect(p, &rLoop)){ skin_f_repeat=!skin_f_repeat; SetPortWindowPort(win.ref); InvalRect(&rLoop); return; } /* don't call mac_HandleControl();*/ else if( PtInRect(p, &rVol)) DoVolume(); else return; /* no button click*/ /* if button clicked */ mac_HandleControl(); }
void XMoveWindow( Display* display, /* Display. */ Window window, /* Window. */ int x, int y) { MacDrawable *macWin = (MacDrawable *) window; GWorldPtr destPort; destPort = TkMacGetDrawablePort(window); if (destPort == NULL) { return; } SetPort((GrafPtr) destPort); if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { /* * NOTE: we are not adding the new space to the update * region. It is currently assumed that Tk will need * to completely redraw anway. */ tkMacMoveWindow((WindowRef) destPort, x, y); /* TODO: is the following right? */ TkMacInvalidateWindow(macWin, TK_WINDOW_ONLY); TkMacInvalClipRgns(macWin->winPtr); } else { int deltaX, deltaY, parentBorderwidth; Rect bounds; MacDrawable *macParent; /* * Find the Parent window - * For an embedded window this will be its container. */ if (Tk_IsEmbedded(macWin->winPtr)) { TkWindow *contWinPtr; contWinPtr = TkpGetOtherWindow(macWin->winPtr); if (contWinPtr == NULL) { panic("XMoveWindow could not find container"); } macParent = contWinPtr->privatePtr; /* * NOTE: Here we should handle out of process embedding. */ } else { macParent = macWin->winPtr->parentPtr->privatePtr; if (macParent == NULL) { return; /* TODO: Probably should be a panic */ } } TkMacInvalClipRgns(macParent->winPtr); TkMacInvalidateWindow(macWin, TK_PARENT_WINDOW); deltaX = - macWin->xOff; deltaY = - macWin->yOff; /* * If macWin->winPtr is an embedded window, don't offset by its * parent's borderwidth... */ if (!Tk_IsEmbedded(macWin->winPtr)) { parentBorderwidth = macWin->winPtr->parentPtr->changes.border_width; } else { parentBorderwidth = 0; } deltaX += macParent->xOff + parentBorderwidth + macWin->winPtr->changes.x; deltaY += macParent->yOff + parentBorderwidth + macWin->winPtr->changes.y; UpdateOffsets(macWin->winPtr, deltaX, deltaY); TkMacWinBounds(macWin->winPtr, &bounds); InvalRect(&bounds); } }
Int2 Main (void) { EntrezInfoPtr eip; PaneL p; RecT r; Char str [16]; Int2 val; WindoW w; /* #if defined(WIN16) #else PRGD prgdDict; #endif */ ErrSetFatalLevel (SEV_MAX); ErrClearOptFlags (EO_SHOW_USERSTR); ProcessUpdatesFirst (FALSE); /* if (! GetAppParam ("NCBI", "NCBI", NULL, NULL, str, sizeof (str) - 1)) { if (Message (MSG_YN, configMessage) == ANS_YES) { ShowNetConfigForm (ConfigFormActivated, ConfigFormMessage, ConfigAccepted, ConfigCancelled); ProcessEvents (); return 0; } else { Message (MSG_FATAL, "Entrez cannot run without ncbi configuration file"); } return 0; } if (! GetAppParam ("NCBI", "NCBI", NULL, NULL, str, sizeof (str) - 1)) { Message (MSG_FATAL, "Entrez cannot find ncbi configuration file"); return 0; } */ UseLocalAsnloadDataAndErrMsg (); SetupAppProperties (); SetupCommonFonts (); entrezRelease [0] = '\0'; sprintf (entrezVersion, "Entrez Application Version %s", ENTREZ_APP_VERSION); w = FixedWindow (-50, -33, -10, -10, "Entrez", NULL); p = SimplePanel (w, AboutBoxWidth (), 14 * stdLineHeight, DrawAbout); Show (w); #ifdef WIN_MOTIF Select (w); ObjectRect (p, &r); Select (p); InsetRect (&r, 3, 3); InvalRect (&r); #endif Update (); WatchCursor (); SetTitle (w, "Finding Entrez Data"); if (! EntrezBioseqFetchEnable ("Entrez", TRUE)) { ArrowCursor (); /* Message (MSG_FATAL, "Unable to connect to Entrez databases"); */ if (Message (MSG_YN, configMessage) == ANS_YES) { ShowNetConfigForm (ConfigFormActivated, ConfigFormMessage, ConfigAccepted, ConfigCancelled, NULL, TRUE); ProcessEvents (); return 0; } else { Message (MSG_FATAL, "Entrez cannot run connection to the data server"); } return 0; } ID1BioseqFetchEnable ("Entrez", TRUE); LocalSeqFetchInit (FALSE); #ifdef WIN_MAC SetDeactivate (NULL, MacDeactProc); SetupMacMenus (); #endif eip = EntrezGetInfo (); if (eip != NULL) { /* { AsnIoPtr aip; aip = AsnIoOpen ("eip", "w"); if (aip != NULL) { EntrezInfoAsnWrite (eip, aip, NULL); AsnIoClose (aip); } } */ sprintf (entrezRelease, "Entrez Data Release %d.%d", (int) eip->version, (int) eip->issue); Select (p); ObjectRect (p, &r); InsetRect (&r, 3, 3); InvalRect (&r); Update (); } SetTitle (w, "Loading parse tables"); if (! AllObjLoad ()) { ArrowCursor (); Message (MSG_FATAL, "AllObjLoad failed"); return 0; } if (! SubmitAsnLoad ()) { ArrowCursor (); Message (MSG_FATAL, "SubmitAsnLoad failed"); return 0; } SetTitle (w, "Loading print templates"); if (! PrintTemplateSetLoad ("objprt.prt")) { ArrowCursor (); Message (MSG_FATAL, "PrintTemplateSetLoad objprt.prt failed"); return 0; } if (! PrintTemplateSetLoad ("asn2ff.prt")) { ArrowCursor (); Message (MSG_FATAL, "PrintTemplateSetLoad asn2ff.prt failed"); return 0; } /* if (! PrintTemplateSetLoad ("makerpt.prt")) { ArrowCursor (); Message (MSG_FATAL, "PrintTemplateSetLoad makerpt.prt failed"); return 0; } */ SetTitle (w, "Loading sequence alphabet converter"); if (! SeqCodeSetLoad ()) { ArrowCursor (); Message (MSG_FATAL, "SeqCodeSetLoad failed"); return 0; } SetTitle (w, "Loading feature definitions"); if (! FeatDefSetLoad ()) { ArrowCursor (); Message (MSG_FATAL, "FeatDefSetLoad failed"); return 0; } if (! SetupPrintOptions ()) { ArrowCursor (); Message (MSG_FATAL, "StdPrintOptionsNew failed"); return 0; } /* #ifndef WIN16 SetTitle (w, "Loading structure dictionary"); if (OpenMMDBAPI ((POWER_VIEW ^ FETCH_ENTREZ), NULL)) { prgdDict = GetPRGDDictionary (); Cn3DWin_Entrez(NULL, TRUE); } #endif */ SetTitle (w, "Creating menus"); REGISTER_MEDLINE_VIEW; REGISTER_NEW_SEQENTRY_VIEW; VSMFileInit (); VSeqMgrInit (FALSE); SetTitle (w, "Creating window"); InitMuskStyles (); if (GetEntrezAppParam ("PREFERENCES", "DEFAULTSTYLE", "", str, sizeof (str))) { if (StrToInt (str, &val) && val >= 0) { SetMuskCurrentSt (GetMuskStyleName (val)); } } /* SetTitle (w, "Creating help window"); if (helpForm == NULL) { helpForm = CreateHelpForm (-95, -5, "Entrez Help", "entrez.hlp", HideHelpForm, HelpActivateProc); } */ SetTitle (w, "Creating initial window"); termListForm = CreateTermListForm (-70, -70, "Entrez1 Query", TermSelectionActivateProc, TermSelectionFormMessage); Remove (w); ArrowCursor (); if (termListForm != NULL) { Show (termListForm); Select (termListForm); Update (); docSumForm = CreateDocSumForm (-90, -10, "Entrez1 Document", DocumentSummaryActivateProc, DocumentSummaryFormMessage); UseDelayedNeighbor (docSumForm, TRUE); if (docSumForm != NULL) { ProcessEvents (); } else { Message (MSG_FATAL, "Unable to create document window"); } } else { Message (MSG_FATAL, "Unable to create term list window"); } WatchCursor (); val = GetMuskCurrentSt (); if (val < 0) { val = 0; } if (val >= GetMuskTotalSt ()) { val = 0; } if (val > 0) { sprintf (str, "%d", (int) val); SetEntrezAppParam ("PREFERENCES", "DEFAULTSTYLE", str); } else { SetEntrezAppParam ("PREFERENCES", "DEFAULTSTYLE", "0"); } CleanupEntrez (); ArrowCursor (); return 0; }
void InTerminalContent(EventRecord* evt, WindowPtr wCurrPtr) { Point localPt; Rect r; ControlPartCode part; ControlHandle currCntl; short checkboxVal; GrafPtr oldPort; GetPort(&oldPort); SetPort(wCurrPtr); localPt = evt->where; GlobalToLocal( &localPt); if (gControls->tw->siteSelector) { HLock((Handle)gControls->tw->siteSelector); r = (**(gControls->tw->siteSelector)).contrlRect; HUnlock((Handle)gControls->tw->siteSelector); if (PtInRect(localPt, &r)) { part = FindControl(localPt, gWPtr, &currCntl); part = TrackControl(currCntl, localPt, (ControlActionUPP) -1); gControls->opt->siteChoice = GetControlValue(currCntl); return; } } if (gControls->tw->saveBitsCheckbox) { HLock((Handle)gControls->tw->saveBitsCheckbox); r = (**(gControls->tw->saveBitsCheckbox)).contrlRect; HUnlock((Handle)gControls->tw->saveBitsCheckbox); if (PtInRect(localPt, &r)) { part = FindControl(localPt, gWPtr, &currCntl); part = TrackControl(currCntl, localPt, (ControlActionUPP) -1); checkboxVal = GetControlValue(currCntl); SetControlValue(currCntl, 1 - checkboxVal); if (checkboxVal) // was selected so now toggling off gControls->opt->saveBits = false; else // was not selected so now toggling on gControls->opt->saveBits = true; return; } } if (gControls->tw->proxySettingsBtn) { HLock((Handle)gControls->tw->proxySettingsBtn); r = (**(gControls->tw->proxySettingsBtn)).contrlRect; HUnlock((Handle)gControls->tw->proxySettingsBtn); if (PtInRect(localPt, &r)) { part = TrackControl(gControls->tw->proxySettingsBtn, evt->where, NULL); if (part != 0) OpenProxySettings(); return; } } HLock((Handle)gControls->backB); SetRect(&r, (**(gControls->backB)).contrlRect.left, (**(gControls->backB)).contrlRect.top, (**(gControls->backB)).contrlRect.right, (**(gControls->backB)).contrlRect.bottom); HUnlock((Handle)gControls->backB); if (PtInRect( localPt, &r)) { part = TrackControl(gControls->backB, evt->where, NULL); if (part) { /* before install has started */ if (gControls->state == eInstallNotStarted) { KillControls(gWPtr); if (&gControls->tw->startMsgBox) { EraseRect(&gControls->tw->startMsgBox); InvalRect(&gControls->tw->startMsgBox); } else { ErrorHandler(eParam, nil); return; } ClearSaveBitsMsg(); /* treat last setup type selection as custom */ if (gControls->opt->instChoice == gControls->cfg->numSetupTypes) { if (gControls->cfg->bAdditionsExist) ShowAdditionsWin(); else ShowComponentsWin(); } else ShowSetupTypeWin(); return; } /* pause button pressed */ else if (gControls->state == eDownloading || gControls->state == eResuming) { SetPausedState(); } } } HLock((Handle)gControls->nextB); SetRect(&r, (**(gControls->nextB)).contrlRect.left, (**(gControls->nextB)).contrlRect.top, (**(gControls->nextB)).contrlRect.right, (**(gControls->nextB)).contrlRect.bottom); HUnlock((Handle)gControls->nextB); if (PtInRect( localPt, &r)) { part = TrackControl(gControls->nextB, evt->where, NULL); if (part) { BeginInstall(); } } SetPort(oldPort); }