void CMeter2DGraphView::contextMenuEvent( QContextMenuEvent* anEvent ) { TRACE_FUN( Routine, "CMeter2DGraphView::contextMenuEvent" ); CAbstractMeterView::contextMenuEvent( anEvent ); Activate(); deviceView().UpdateMeterMenu( true ); _popupMenu.clear(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////// QMenu* measureUnitsMenu( deviceView().mainWindow().menuBarManager().menu( CMenuBarManager::mMeterMeasureUnits )->menu() ); if( !measureUnitsMenu->isEmpty() ) { _popupMenu.addMenu( measureUnitsMenu ); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// _popupMenu.addAction( deviceView().mainWindow().menuBarManager().menu( CMenuBarManager::mMeterGraph ) ); if( !_popupMenu.isEmpty() ) { _popupMenu.popup( anEvent->globalPos() ); } }
CMeter2DGraphView::CMeter2DGraphView( const Diagnostic::CUnitKey& aKey, CECUDeviceView& aView ) : CAbstractMeterView( aKey, aView ), _popupMenu( this ) { TRACE_FUN( Routine, "CMeter2DGraphView::CMeter2DGraphView" ); _timerId = -1; _normalFont = aView.font(); _boldFont = _normalFont; _boldFont.setBold( true ); _bkgValueFont = _normalFont; _bkgValueFont.setPointSize( 32 ); _bkgUnitFont = _normalFont; _bkgUnitFont.setPointSize( 10 ); _bkgUnitFont.setBold( true ); _menuSessionId = deviceView().mainWindow().menuBarManager().OpenSession(); SetModel( new CMeter2DGraphModel( key(), aView, *this ) ); setAutoFillBackground( false ); _timerId = startTimer( CMeter2DGraphView::_timerInterval ); }
void redraw() { if (redrawPending >= 0) { redrawPending++; } else { CALL_VIEW(deviceView()->redraw()); // 将调用dynDraw } }
CMeter2DGraphView::~CMeter2DGraphView() { TRACE_FUN( Routine, "CMeter2DGraphView::~CMeter2DGraphView" ); killTimer( _timerId ); glDeleteLists( _meshList, 1 ); gluDeleteNurbsRenderer( _nurbsRenderer ); deviceView().mainWindow().menuBarManager().CloseSession( _menuSessionId ); }
bool showContextActions(int /*selState*/, const int* actions, const Box2d& selbox, const MgShape*) { int n = 0; for (; actions && actions[n] > 0; n++) {} if (n > 0 && motion.pressDrag && isContextActionsVisible()) { return false; } mgvector<int> arr(actions, n); mgvector<float> pos(2 * n); calcContextButtonPosition(pos, n, selbox); return CALL_VIEW2(deviceView()->showContextActions(arr, pos, selbox.xmin, selbox.ymin, selbox.width(), selbox.height()), false); }
bool isContextActionsVisible() { return CALL_VIEW2(deviceView()->isContextActionsVisible(), false); }
bool useFinger() { return CALL_VIEW2(deviceView()->useFinger(), true); }
void selectionChanged() { CALL_VIEW(deviceView()->selectionChanged()); }
void commandChanged() { CALL_VIEW(deviceView()->commandChanged()); }