void ScatterCtrl::DoMouseAction(bool down, Point pt, ScatterAction action, int value) { if (!down) { Scrolling(false, pt); LabelPopUp(false, pt); ZoomWindow(false, pt); } switch (action) { case SCROLL: Scrolling(down, pt); break; case ZOOM_H_ENL: case ZOOM_H_RED: MouseZoom(value, true, false); break; case ZOOM_V_ENL: case ZOOM_V_RED: MouseZoom(value, false, true); break; case SHOW_COORDINATES: LabelPopUp(down, pt); break; case ZOOM_WINDOW: ZoomWindow(down, pt); break; case CONTEXT_MENU: if(showContextMenu) MenuBar::Execute(THISBACK(ContextMenu)); break; case NO_ACTION: ; } }
/****************************************************************************** * ZoomExtentsOfComponentsMargin */ short API::ZoomExtentsOfComponentsMargin(LPCTSTR compNames, short margin) { if (apiView == NULL) return RC_NO_ACTIVE_DOC; CCEtoODBDoc *doc = apiView->GetDocument(); double xmin, xmax, ymin, ymax; int Select_component = TRUE; if (!ComponentsExtents(doc, compNames, &xmin, &xmax, &ymin, &ymax, Select_component)) return RC_GENERAL_ERROR; double pageWidth = doc->getSettings().getXmax() - doc->getSettings().getXmin(); double pageHeight = doc->getSettings().getYmax() - doc->getSettings().getYmin(); double pageSize = max(pageWidth, pageWidth); double marginSize = pageSize * margin / 100; xmin -= marginSize; xmax += marginSize; ymin -= marginSize; ymax += marginSize; ZoomWindow(xmin, ymin, xmax, ymax); return RC_SUCCESS; }
/****************************************************************************** * ZoomExtentsOfComponents */ short API::ZoomExtentsOfComponents(LPCTSTR compNames) { if (apiView == NULL) return RC_NO_ACTIVE_DOC; CCEtoODBDoc *doc = apiView->GetDocument(); double xmin, xmax, ymin, ymax; int Select_component = TRUE; if (!ComponentsExtents(doc, compNames, &xmin, &xmax, &ymin, &ymax, Select_component)) return RC_GENERAL_ERROR; double margin = (xmax - xmin) * doc->getSettings().ExtentMargin / 200; xmin -= margin; xmax += margin; margin = (ymax - ymin) * doc->getSettings().ExtentMargin / 200; ymin -= margin; ymax += margin; ZoomWindow(xmin, ymin, xmax, ymax); return RC_SUCCESS; }
void wxTopLevelWindowMac::Maximize(bool maximize) { wxMacPortStateHelper help( (GrafPtr) GetWindowPort( (WindowRef) m_macWindow) ) ; wxMacWindowClipper clip (this); ZoomWindow( (WindowRef)m_macWindow , maximize ? inZoomOut : inZoomIn , false ) ; Rect tempRect ; GrafPtr port ; GetPort( &port ) ; Point pt = { 0, 0 } ; SetPortWindowPort((WindowRef)m_macWindow) ; LocalToGlobal( &pt ) ; SetPort( port ) ; GetWindowPortBounds((WindowRef)m_macWindow, &tempRect ) ; SetSize( pt.h , pt.v , tempRect.right-tempRect.left , tempRect.bottom-tempRect.top, wxSIZE_USE_EXISTING); }
void DoEvent(EventRecord *event) { short part; Boolean hit; char key; Rect tempRect; WindowRef whichWindow; switch (event->what) { case mouseDown: part = FindWindow(event->where, &whichWindow); switch (part) { case inMenuBar: /* process a moused menu command */ DoMenuCommand(MenuSelect(event->where)); break; case inSysWindow: break; case inContent: if (whichWindow != FrontWindow()) SelectWindow(whichWindow); break; case inDrag: /* pass screenBits.bounds */ GetRegionBounds(GetGrayRgn(), &tempRect); DragWindow(whichWindow, event->where, &tempRect); break; case inGrow: break; case inGoAway: DisposeWindow(whichWindow); ExitToShell(); break; case inZoomIn: case inZoomOut: hit = TrackBox(whichWindow, event->where, part); if (hit) { SetPort(GetWindowPort(whichWindow)); // window must be current port EraseRect(GetWindowPortBounds(whichWindow, &tempRect)); // inval/erase because of ZoomWindow bug ZoomWindow(whichWindow, part, true); InvalWindowRect(whichWindow, GetWindowPortBounds(whichWindow, &tempRect)); } break; } break; case keyDown: case autoKey: key = event->message & charCodeMask; if (event->modifiers & cmdKey) if (event->what == keyDown) DoMenuCommand(MenuKey(key)); case activateEvt: /* if you needed to do something special */ break; case updateEvt: DrawWindow((WindowRef) event->message); break; case kHighLevelEvent: AEProcessAppleEvent( event ); break; case diskEvt: break; } }
/*
static void process_event( EventRecord *event) { WindowPtr window; short part_code; Rect size_rect; long new_size; GrafPtr old_port; switch(event->what) { case kHighLevelEvent: AEProcessAppleEvent(event); break; case mouseDown: /* Did we hit one of the floaters? */ part_code= FindWindow(event->where, &window); switch (part_code) { case inSysWindow: break; case inMenuBar: do_menu_command(MenuSelect(event->where)); break; case inContent: if(window != FrontWindow()) SelectWindow(window); click_in_log_window(window,event->where,(event->modifiers & shiftKey) != 0); break; case inDrag: #ifdef OP_PLATFORM_MAC_CARBON_FLAG { Rect tempRect; GetRegionBounds(GetGrayRgn(), &tempRect); DragWindow(window, event->where, &tempRect); } #else DragWindow(window, event->where, &qd.screenBits.bounds); #endif break; case inGrow: #ifdef OP_PLATFORM_MAC_CARBON_FLAG GetRegionBounds(GetGrayRgn(), &size_rect); #else size_rect = qd.screenBits.bounds; #endif InsetRect(&size_rect, 4, 4); new_size= GrowWindow(window, event->where, &size_rect); if(new_size) { /* Resize the window */ SizeWindow(window, LoWord(new_size), HiWord(new_size), true); } break; case inGoAway: if(TrackGoAway(window, event->where)) { /* Close the window... */ handle_close(window); } break; case inZoomIn: case inZoomOut: if(TrackBox(window, event->where, part_code)) { GetPort(&old_port); SetPortWindowPort(window); #ifdef OP_PLATFORM_MAC_CARBON_FLAG { Rect windowBounds; GetWindowPortBounds(window, &windowBounds); EraseRect(&windowBounds); } #else EraseRect(&window->portRect); #endif ZoomWindow(window, part_code, true); SetPort(old_port); } break; } break; case keyDown: case autoKey: if(!process_key(event, event->message&charCodeMask)) { /* Not handled by anyone.. */ SysBeep(-1); } break; case updateEvt: /* Update the window.. */ update_window((WindowPtr)event->message); break; case activateEvt: /* Activate event->message, event->modifiers&activeFlag.. */ break; case osEvt: switch ((event->message>>24) & 0xff) { case suspendResumeMessage: if (event->message&resumeFlag) { /* resume */ #ifdef OP_PLATFORM_MAC_CARBON_FLAG { Cursor arrowCursor; SetCursor(GetQDGlobalsArrow(&arrowCursor)); } #else SetCursor(&qd.arrow); #endif } else { /* suspend */ } break; case mouseMovedMessage: break; } break; } return; }
void GBWindow::ZoomIn() { ZoomWindow(window, inZoomIn, false); //view->SetSize(GetSize()); }