#include <QtxToolBar.h>
#include <QtxMultiAction.h>
+#include <QtxActionToolMgr.h>
#include <SUIT_Desktop.h>
#include <SUIT_Session.h>
setBackgroundColor( Qt::white );
layout->addWidget( vp );
- myToolBar = new QtxToolBar( true, tr("LBL_TOOLBAR_LABEL"), this );
-
createActions();
createToolBar();
}
*/
void GLViewer_ViewFrame::createActions()
{
- if (!myActionsMap.isEmpty()) return;
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
QtxAction* aAction;
tr( "MNU_DUMP_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_DUMP_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onViewDump()));
- myActionsMap[ DumpId ] = aAction;
+ toolMgr()->registerAction( aAction, DumpId );
// FitAll
aAction = new QtxAction(tr("MNU_FITALL"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_FITALL" ) ),
tr( "MNU_FITALL" ), 0, this);
aAction->setStatusTip(tr("DSC_FITALL"));
connect(aAction, SIGNAL(activated()), this, SLOT(onViewFitAll()));
- myActionsMap[ FitAllId ] = aAction;
+ toolMgr()->registerAction( aAction, FitAllId );
// FitRect
aAction = new QtxAction(tr("MNU_FITRECT"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_FITAREA" ) ),
tr( "MNU_FITRECT" ), 0, this);
aAction->setStatusTip(tr("DSC_FITRECT"));
connect(aAction, SIGNAL(activated()), this, SLOT(onViewFitArea()));
- myActionsMap[ FitRectId ] = aAction;
+ toolMgr()->registerAction( aAction, FitRectId );
// FitSelect
aAction = new QtxAction(tr("MNU_FITSELECT"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_FITSELECT" ) ),
tr( "MNU_FITSELECT" ), 0, this);
aAction->setStatusTip(tr("DSC_FITSELECT"));
connect(aAction, SIGNAL(activated()), this, SLOT(onViewFitSelect()));
- myActionsMap[ FitSelectId ] = aAction;
+ toolMgr()->registerAction( aAction, FitSelectId );
// Zoom
aAction = new QtxAction(tr("MNU_ZOOM_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_ZOOM" ) ),
tr( "MNU_ZOOM_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_ZOOM_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onViewZoom()));
- myActionsMap[ ZoomId ] = aAction;
+ toolMgr()->registerAction( aAction, ZoomId );
// Panning
aAction = new QtxAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_PAN" ) ),
tr( "MNU_PAN_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_PAN_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onViewPan()));
- myActionsMap[ PanId ] = aAction;
+ toolMgr()->registerAction( aAction, PanId );
// Global Panning
aAction = new QtxAction(tr("MNU_GLOBALPAN_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_GLOBALPAN" ) ),
tr( "MNU_GLOBALPAN_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_GLOBALPAN_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onViewGlobalPan()));
- myActionsMap[ GlobalPanId ] = aAction;
+ toolMgr()->registerAction( aAction, GlobalPanId );
aAction = new QtxAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_RESET" ) ),
tr( "MNU_RESET_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_RESET_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onViewReset()));
- myActionsMap[ ResetId ] = aAction;
+ toolMgr()->registerAction( aAction, ResetId );
}
/*!
*/
void GLViewer_ViewFrame::createToolBar()
{
- myToolBar->addAction( myActionsMap[DumpId] );
+ int tid = toolMgr()->createToolBar( tr("LBL_TOOLBAR_LABEL") );
+ toolMgr()->append( DumpId, tid );
QtxMultiAction* aScaleAction = new QtxMultiAction( this );
- aScaleAction->insertAction( myActionsMap[FitAllId] );
- aScaleAction->insertAction( myActionsMap[FitRectId] );
- aScaleAction->insertAction( myActionsMap[FitSelectId] );
- aScaleAction->insertAction( myActionsMap[ZoomId] );
- myToolBar->addAction( aScaleAction );
+ aScaleAction->insertAction( toolMgr()->action( FitAllId ) );
+ aScaleAction->insertAction( toolMgr()->action( FitRectId ) );
+ aScaleAction->insertAction( toolMgr()->action( FitSelectId ) );
+ aScaleAction->insertAction( toolMgr()->action( ZoomId ) );
+ toolMgr()->append( aScaleAction, tid );
QtxMultiAction* aPanAction = new QtxMultiAction( this );
- aPanAction->insertAction( myActionsMap[PanId] );
- aPanAction->insertAction( myActionsMap[GlobalPanId] );
- myToolBar->addAction( aPanAction );
+ aPanAction->insertAction( toolMgr()->action( PanId ) );
+ aPanAction->insertAction( toolMgr()->action( GlobalPanId ) );
+ toolMgr()->append( aPanAction, tid );
- myToolBar->addAction( myActionsMap[ResetId] );
+ toolMgr()->append( toolMgr()->action( ResetId ), tid );
}
/*!
{
Q_OBJECT
+public:
+ //! Actions ID
+ enum { DumpId, FitAllId, FitRectId, FitSelectId, ZoomId, PanId, GlobalPanId, ResetId };
+
public:
GLViewer_ViewFrame( SUIT_Desktop* , GLViewer_Viewer* );
~GLViewer_ViewFrame();
private:
void createActions();
void createToolBar();
-
-private:
- //! Actions ID
- enum { DumpId, FitAllId, FitRectId, FitSelectId, ZoomId, PanId, GlobalPanId, ResetId };
- typedef QMap<int, QtxAction*> ActionsMap;
-
-private:
- ActionsMap myActionsMap;
- QToolBar* myToolBar;
};
#include "SUIT_Desktop.h"
#include "SUIT_Session.h"
+#include "QtxActionToolMgr.h"
+
#include <QPainter>
#include <QApplication>
#include <QColorDialog>
thePopup->addSeparator();
OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*)(myViewManager->getActiveView());
- if ( aView && !aView->getToolBar()->isVisible() )
- thePopup->addAction( tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) );
+
+ //Support of several toolbars in the popup menu
+ QList<QToolBar*> lst = qFindChildren<QToolBar*>( aView );
+ QList<QToolBar*>::const_iterator it = lst.begin(), last = lst.end();
+ for( ; it!=last; it++ )
+ thePopup->addAction( (*it)->toggleViewAction() );
}
/*!
aViewPort3d->setBackgroundColor(selColor);
}
-/*!
- SLOT: called when popup item "Show toolbar" is activated, shows toolbar of active view window
-*/
-void OCCViewer_Viewer::onShowToolbar() {
- OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*)(myViewManager->getActiveView());
- if ( aView )
- aView->getToolBar()->show();
-}
-
/*!
Updates OCC 3D viewer
*/
void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
void onDumpView();
- void onShowToolbar();
void onChangeBgColor();
private:
#include <SUIT_ResourceMgr.h>
#include <SUIT_MessageBox.h>
-#include <QtxToolBar.h>
+#include <QtxActionToolMgr.h>
#include <QtxMultiAction.h>
#include <QPainter>
setTransformRequested ( NOTHING );
setTransformInProcess ( false );
- myToolBar = new QtxToolBar( true, tr( "LBL_TOOLBAR_LABEL" ), this );
-
createActions();
createToolBar();
}
*/
void OCCViewer_ViewWindow::createActions()
{
- if (!myActionsMap.isEmpty()) return;
-
+ if( !toolMgr()->isEmpty() )
+ return;
+
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
QtxAction* aAction;
tr( "MNU_DUMP_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_DUMP_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onDumpView()));
- myActionsMap[ DumpId ] = aAction;
+ toolMgr()->registerAction( aAction, DumpId );
// FitAll
aAction = new QtxAction(tr("MNU_FITALL"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_FITALL" ) ),
tr( "MNU_FITALL" ), 0, this);
aAction->setStatusTip(tr("DSC_FITALL"));
connect(aAction, SIGNAL(activated()), this, SLOT(onFitAll()));
- myActionsMap[ FitAllId ] = aAction;
+ toolMgr()->registerAction( aAction, FitAllId );
// FitRect
aAction = new QtxAction(tr("MNU_FITRECT"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_FITAREA" ) ),
tr( "MNU_FITRECT" ), 0, this);
aAction->setStatusTip(tr("DSC_FITRECT"));
connect(aAction, SIGNAL(activated()), this, SLOT(activateWindowFit()));
- myActionsMap[ FitRectId ] = aAction;
-
+ toolMgr()->registerAction( aAction, FitRectId );
+
// Zoom
aAction = new QtxAction(tr("MNU_ZOOM_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_ZOOM" ) ),
tr( "MNU_ZOOM_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_ZOOM_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(activateZoom()));
- myActionsMap[ ZoomId ] = aAction;
+ toolMgr()->registerAction( aAction, ZoomId );
// Panning
aAction = new QtxAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_PAN" ) ),
tr( "MNU_PAN_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_PAN_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(activatePanning()));
- myActionsMap[ PanId ] = aAction;
+ toolMgr()->registerAction( aAction, PanId );
// Global Panning
aAction = new QtxAction(tr("MNU_GLOBALPAN_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_GLOBALPAN" ) ),
tr( "MNU_GLOBALPAN_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_GLOBALPAN_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(activateGlobalPanning()));
- myActionsMap[ GlobalPanId ] = aAction;
+ toolMgr()->registerAction( aAction, GlobalPanId );
// Rotation Point
mySetRotationPointAction = new QtxAction(tr("MNU_CHANGINGROTATIONPOINT_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_ROTATION_POINT" ) ),
mySetRotationPointAction->setStatusTip(tr("DSC_CHANGINGROTATIONPOINT_VIEW"));
mySetRotationPointAction->setCheckable( true );
connect(mySetRotationPointAction, SIGNAL(toggled( bool )), this, SLOT(onSetRotationPoint( bool )));
- myActionsMap[ ChangeRotationPointId ] = mySetRotationPointAction;
+ toolMgr()->registerAction( mySetRotationPointAction, ChangeRotationPointId );
// Rotation
aAction = new QtxAction(tr("MNU_ROTATE_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_ROTATE" ) ),
tr( "MNU_ROTATE_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_ROTATE_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(activateRotation()));
- myActionsMap[ RotationId ] = aAction;
+ toolMgr()->registerAction( aAction, RotationId );
// Projections
aAction = new QtxAction(tr("MNU_FRONT_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_FRONT" ) ),
tr( "MNU_FRONT_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_FRONT_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onFrontView()));
- myActionsMap[ FrontId ] = aAction;
+ toolMgr()->registerAction( aAction, FrontId );
aAction = new QtxAction(tr("MNU_BACK_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_BACK" ) ),
tr( "MNU_BACK_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_BACK_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onBackView()));
- myActionsMap[ BackId ] = aAction;
+ toolMgr()->registerAction( aAction, BackId );
aAction = new QtxAction(tr("MNU_TOP_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_TOP" ) ),
tr( "MNU_TOP_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_TOP_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onTopView()));
- myActionsMap[ TopId ] = aAction;
+ toolMgr()->registerAction( aAction, TopId );
aAction = new QtxAction(tr("MNU_BOTTOM_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_BOTTOM" ) ),
tr( "MNU_BOTTOM_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_BOTTOM_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onBottomView()));
- myActionsMap[ BottomId ] = aAction;
+ toolMgr()->registerAction( aAction, BottomId );
aAction = new QtxAction(tr("MNU_LEFT_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_LEFT" ) ),
tr( "MNU_LEFT_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_LEFT_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onLeftView()));
- myActionsMap[ LeftId ] = aAction;
+ toolMgr()->registerAction( aAction, LeftId );
aAction = new QtxAction(tr("MNU_RIGHT_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_RIGHT" ) ),
tr( "MNU_RIGHT_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_RIGHT_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onRightView()));
- myActionsMap[ RightId ] = aAction;
+ toolMgr()->registerAction( aAction, RightId );
// Reset
aAction = new QtxAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_RESET" ) ),
tr( "MNU_RESET_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_RESET_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onResetView()));
- myActionsMap[ ResetId ] = aAction;
+ toolMgr()->registerAction( aAction, ResetId );
// Reset
aAction = new QtxAction(tr("MNU_CLONE_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CLONE_VIEW" ) ),
tr( "MNU_CLONE_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_CLONE_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onCloneView()));
- myActionsMap[ CloneId ] = aAction;
+ toolMgr()->registerAction( aAction, CloneId );
myClippingAction = new QtxAction(tr("MNU_CLIPPING"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CLIPPING" ) ),
tr( "MNU_CLIPPING" ), 0, this);
myClippingAction->setStatusTip(tr("DSC_CLIPPING"));
myClippingAction->setCheckable( true );
connect(myClippingAction, SIGNAL(toggled( bool )), this, SLOT(onClipping( bool )));
- myActionsMap[ ClippingId ] = myClippingAction;
+ toolMgr()->registerAction( myClippingAction, CloneId );
aAction = new QtxAction(tr("MNU_SHOOT_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_SHOOT_VIEW" ) ),
tr( "MNU_SHOOT_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_SHOOT_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onMemorizeView()));
- myActionsMap[ MemId ] = aAction;
+ toolMgr()->registerAction( aAction, MemId );
aAction = new QtxAction(tr("MNU_PRESETS_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_PRESETS_VIEW" ) ),
tr( "MNU_PRESETS_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_PRESETS_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onRestoreView()));
- myActionsMap[ RestoreId ] = aAction;
+ toolMgr()->registerAction( aAction, RestoreId );
if (myModel->trihedronActivated()) {
aAction = new QtxAction(tr("MNU_SHOW_TRIHEDRE"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_TRIHEDRON" ) ),
tr( "MNU_SHOW_TRIHEDRE" ), 0, this);
aAction->setStatusTip(tr("DSC_SHOW_TRIHEDRE"));
connect(aAction, SIGNAL(activated()), this, SLOT(onTrihedronShow()));
- myActionsMap[ TrihedronShowId ] = aAction;
+ toolMgr()->registerAction( aAction, TrihedronShowId );
}
}
*/
void OCCViewer_ViewWindow::createToolBar()
{
- myToolBar->addAction( myActionsMap[DumpId] );
- if ( myModel->trihedronActivated() )
- myToolBar->addAction( myActionsMap[TrihedronShowId] );
+ int tid = toolMgr()->createToolBar( tr( "LBL_TOOLBAR_LABEL" ) );
+
+ toolMgr()->append( DumpId, tid );
+ if( myModel->trihedronActivated() )
+ toolMgr()->append( TrihedronShowId, tid );
QtxMultiAction* aScaleAction = new QtxMultiAction( this );
- aScaleAction->insertAction( myActionsMap[FitAllId] );
- aScaleAction->insertAction( myActionsMap[FitRectId] );
- aScaleAction->insertAction( myActionsMap[ZoomId] );
- myToolBar->addAction( aScaleAction );
+ aScaleAction->insertAction( toolMgr()->action( FitAllId ) );
+ aScaleAction->insertAction( toolMgr()->action( FitRectId ) );
+ aScaleAction->insertAction( toolMgr()->action( ZoomId ) );
+ toolMgr()->append( aScaleAction, tid );
QtxMultiAction* aPanningAction = new QtxMultiAction( this );
- aPanningAction->insertAction( myActionsMap[PanId] );
- aPanningAction->insertAction( myActionsMap[GlobalPanId] );
- myToolBar->addAction( aPanningAction );
-
- myToolBar->addAction( myActionsMap[ChangeRotationPointId] );
+ aPanningAction->insertAction( toolMgr()->action( PanId ) );
+ aPanningAction->insertAction( toolMgr()->action( GlobalPanId ) );
+ toolMgr()->append( aPanningAction, tid );
- myToolBar->addAction( myActionsMap[RotationId] );
+ toolMgr()->append( ChangeRotationPointId, tid );
+ toolMgr()->append( RotationId, tid );
QtxMultiAction* aViewsAction = new QtxMultiAction( this );
- aViewsAction->insertAction( myActionsMap[FrontId] );
- aViewsAction->insertAction( myActionsMap[BackId] );
- aViewsAction->insertAction( myActionsMap[TopId] );
- aViewsAction->insertAction( myActionsMap[BottomId] );
- aViewsAction->insertAction( myActionsMap[LeftId] );
- aViewsAction->insertAction( myActionsMap[RightId] );
- myToolBar->addAction( aViewsAction );
+ aViewsAction->insertAction( toolMgr()->action( FrontId ) );
+ aViewsAction->insertAction( toolMgr()->action( BackId ) );
+ aViewsAction->insertAction( toolMgr()->action( TopId ) );
+ aViewsAction->insertAction( toolMgr()->action( BottomId ) );
+ aViewsAction->insertAction( toolMgr()->action( LeftId ) );
+ aViewsAction->insertAction( toolMgr()->action( RightId ) );
+ toolMgr()->append( aViewsAction, tid );
- myToolBar->addAction( myActionsMap[ResetId] );
+ toolMgr()->append( ResetId, tid );
QtxMultiAction* aMemAction = new QtxMultiAction( this );
- aMemAction->insertAction( myActionsMap[MemId] );
- aMemAction->insertAction( myActionsMap[RestoreId] );
- myToolBar->addAction( aMemAction );
-
- myToolBar->addSeparator();
- myToolBar->addAction( myActionsMap[CloneId] );
-
- myToolBar->addSeparator();
- myToolBar->addAction( myActionsMap[ClippingId] );
+ aMemAction->insertAction( toolMgr()->action( MemId ) );
+ aMemAction->insertAction( toolMgr()->action( RestoreId ) );
+ toolMgr()->append( aMemAction, tid );
+
+ toolMgr()->append( toolMgr()->separator(), tid );
+ toolMgr()->append( CloneId, tid );
+
+ toolMgr()->append( toolMgr()->separator(), tid );
+ toolMgr()->append( ClippingId, tid );
}
/*!
void OCCViewer_ViewWindow::onClipping( bool on )
{
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
- if ( on )
+ /*if ( on )
myActionsMap[ ClippingId ]->setIcon(aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CLIPPING_PRESSED" )));
else
myActionsMap[ ClippingId ]->setIcon(aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CLIPPING" )));
-
+ */
if ( on )
{
if ( !myClippingDlg )
aViewMgr->getOCCViewer()->performSelectionChanged();
}
}
+
+OCCViewer_ViewPort3d* OCCViewer_ViewWindow::getViewPort()
+{
+ return myViewPort;
+}
+
+bool OCCViewer_ViewWindow::transformRequested() const
+{
+ return ( myOperation != NOTHING );
+}
+
+bool OCCViewer_ViewWindow::transformInProcess() const
+{
+ return myEventStarted;
+}
+
+void OCCViewer_ViewWindow::setTransformInProcess( bool bOn )
+{
+ myEventStarted = bOn;
+}
#ifndef OCCVIEWER_VIEWWINDOW_H
#define OCCVIEWER_VIEWWINDOW_H
-#include "OCCViewer_ViewModel.h"
-
+#include "OCCViewer.h"
#include "SUIT_ViewWindow.h"
-
-#include "QtxAction.h"
-
-#include <QCursor>
-#include <QList>
+#include <gp_Pnt.hxx>
class QRubberBand;
-
class SUIT_Desktop;
class OCCViewer_ViewPort3d;
class OCCViewer_ViewSketcher;
-
class OCCViewer_ClippingDlg;
class OCCViewer_SetRotationPointDlg;
+class OCCViewer_Viewer;
+class viewAspect;
+class QtxAction;
#ifdef WIN32
#pragma warning( disable:4251 )
Q_OBJECT
public:
+ enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId,
+ ChangeRotationPointId, RotationId,
+ FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, CloneId, ClippingId, MemId, RestoreId,
+ TrihedronShowId };
+
enum OperationType{ NOTHING, PANVIEW, ZOOMVIEW, ROTATE,
PANGLOBAL, WINDOWFIT, FITALLVIEW, RESETVIEW,
FRONTVIEW, BACKVIEW, TOPVIEW, BOTTOMVIEW, LEFTVIEW, RIGHTVIEW };
OCCViewer_ViewWindow(SUIT_Desktop* theDesktop, OCCViewer_Viewer* theModel);
virtual ~OCCViewer_ViewWindow();
- OCCViewer_ViewPort3d* getViewPort() { return myViewPort; }
+ OCCViewer_ViewPort3d* getViewPort();
bool eventFilter(QObject* watched, QEvent* e);
- QToolBar* getToolBar() { return myToolBar; }
-
void performRestoring( const viewAspect& );
virtual void initLayout();
void Hide( QHideEvent * );
protected:
- enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId,
- ChangeRotationPointId, RotationId,
- FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, CloneId, ClippingId, MemId, RestoreId,
- TrihedronShowId };
-
- typedef QMap<int, QtxAction*> ActionsMap;
-
QImage dumpView();
/* Transformation selected but not started yet */
- bool transformRequested() const { return ( myOperation != NOTHING ); }
- void setTransformRequested ( OperationType op );
+ bool transformRequested() const;
+ void setTransformRequested ( OperationType );
/* Transformation is selected and already started */
- bool transformInProcess() const { return myEventStarted; }
- void setTransformInProcess( bool bOn ) { myEventStarted = bOn; }
+ bool transformInProcess() const;
+ void setTransformInProcess( bool );
void vpMousePressEvent(QMouseEvent* theEvent);
void vpMouseReleaseEvent(QMouseEvent* theEvent);
QCursor myCursor;
- QToolBar* myToolBar;
- ActionsMap myActionsMap;
-
double myCurScale;
private:
#include <QtxAction.h>
#include <QtxMultiAction.h>
+#include <QtxActionToolMgr.h>
#include <QStatusBar>
#include <QLayout>
myViewFrame = new Plot2d_ViewFrame( this, "plotView" );
setCentralWidget( myViewFrame );
- myToolBar = addToolBar( tr("LBL_TOOLBAR_LABEL") );
-
createActions();
createToolBar();
*/
QToolBar* Plot2d_ViewWindow::getToolBar()
{
- return myToolBar;
+ return toolMgr()->toolBar( myToolBar );
}
/*!
*/
void Plot2d_ViewWindow::contextMenuPopup( QMenu* thePopup )
{
+ QtxActionToolMgr* mgr = toolMgr();
// scaling
QMenu* scalingPopup = thePopup->addMenu( tr( "SCALING_POPUP" ) );
- scalingPopup->addAction( myActionsMap[ PModeXLinearId ] );
- scalingPopup->addAction( myActionsMap[ PModeXLogarithmicId ] );
+ scalingPopup->addAction( mgr->action( PModeXLinearId ) );
+ scalingPopup->addAction( mgr->action( PModeXLogarithmicId ) );
scalingPopup->addSeparator();
- scalingPopup->addAction( myActionsMap[ PModeYLinearId ] );
- scalingPopup->addAction( myActionsMap[ PModeYLogarithmicId ] );
+ scalingPopup->addAction( mgr->action( PModeYLinearId ) );
+ scalingPopup->addAction( mgr->action( PModeYLogarithmicId ) );
// fit data
thePopup->addAction( tr( "TOT_PLOT2D_FITDATA" ), myViewFrame, SLOT( onFitData() ) );
// curve type
QMenu* curTypePopup = thePopup->addMenu( tr( "CURVE_TYPE_POPUP" ) );
- curTypePopup->addAction( myActionsMap[ CurvPointsId ] );
- curTypePopup->addAction( myActionsMap[ CurvLinesId ] );
- curTypePopup->addAction( myActionsMap[ CurvSplinesId ] );
+ curTypePopup->addAction( mgr->action( CurvPointsId ) );
+ curTypePopup->addAction( mgr->action( CurvLinesId ) );
+ curTypePopup->addAction( mgr->action( CurvSplinesId ) );
// legend
- thePopup->addAction( myActionsMap[ LegendId ] );
+ thePopup->addAction( mgr->action( LegendId ) );
// settings
- thePopup->addAction( myActionsMap[ CurvSettingsId ] );
+ thePopup->addAction( mgr->action( CurvSettingsId ) );
}
/*!
*/
void Plot2d_ViewWindow::createActions()
{
- if ( !myActionsMap.isEmpty() )
- return;
-
+ QtxActionToolMgr* mgr = toolMgr();
QtxAction* aAction;
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
0, this);
aAction->setStatusTip( tr( "DSC_DUMP_VIEW" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onDumpView() ) );
- myActionsMap[ DumpId ] = aAction;
+ mgr->registerAction( aAction, DumpId );
// 2. Scaling operations
0, this);
aAction->setStatusTip( tr( "DSC_FITALL" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onFitAll() ) );
- myActionsMap[ FitAllId ] = aAction;
+ mgr->registerAction( aAction, FitAllId );
// 2.2. Fit Rect
aAction = new QtxAction( tr( "MNU_FITRECT" ),
0, this);
aAction->setStatusTip( tr( "DSC_FITRECT" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onFitRect() ) );
- myActionsMap[ FitRectId ] = aAction;
+ mgr->registerAction( aAction, FitRectId );
// 2.3. Zoom
aAction = new QtxAction( tr( "MNU_ZOOM_VIEW" ),
0, this);
aAction->setStatusTip( tr( "DSC_ZOOM_VIEW" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onZoom() ) );
- myActionsMap[ ZoomId ] = aAction;
+ mgr->registerAction( aAction, ZoomId );
// 2.4. Create multi-action for scaling operations
QtxMultiAction* aScaleAction = new QtxMultiAction( this );
- aScaleAction->insertAction( myActionsMap[ FitAllId ] );
- aScaleAction->insertAction( myActionsMap[ FitRectId ] );
- aScaleAction->insertAction( myActionsMap[ ZoomId ] );
- myActionsMap[ ScaleOpId ] = aScaleAction;
+ aScaleAction->insertAction( mgr->action( FitAllId ) );
+ aScaleAction->insertAction( mgr->action( FitRectId ) );
+ aScaleAction->insertAction( mgr->action( ZoomId ) );
+ mgr->registerAction( aAction, ScaleOpId );
// 3. Moving operations
0, this);
aAction->setStatusTip( tr( "DSC_PAN_VIEW" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onPanning() ) );
- myActionsMap[ PanId ] = aAction;
+ mgr->registerAction( aAction, PanId );
// 3.2. Global Panning
aAction = new QtxAction( tr( "MNU_GLOBALPAN_VIEW" ),
0, this);
aAction->setStatusTip( tr( "DSC_GLOBALPAN_VIEW" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onGlobalPanning() ) );
- myActionsMap[ GlobalPanId ] = aAction;
+ mgr->registerAction( aAction, GlobalPanId );
// 3.3. Create multi-action for moving operations
QtxMultiAction* aPanAction = new QtxMultiAction( this );
- aPanAction->insertAction( myActionsMap[ PanId ] );
- aPanAction->insertAction( myActionsMap[ GlobalPanId ] );
- myActionsMap[ MoveOpId ] = aPanAction;
+ aPanAction->insertAction( mgr->action( PanId ) );
+ aPanAction->insertAction( mgr->action( GlobalPanId ) );
+ mgr->registerAction( aAction, MoveOpId );
// 4. Curve type operations
0, this );
aAction->setStatusTip( tr( "PRP_PLOT2D_CURVES_POINTS" ) );
aAction->setCheckable( true );
- myActionsMap[ CurvPointsId ] = aAction;
+ mgr->registerAction( aAction, CurvPointsId );
// 4.2. Lines
aAction = new QtxAction( tr( "TOT_PLOT2D_CURVES_LINES" ),
0, this );
aAction->setStatusTip( tr( "PRP_PLOT2D_CURVES_LINES" ) );
aAction->setCheckable( true );
- myActionsMap[ CurvLinesId ] = aAction;
+ mgr->registerAction( aAction, CurvLinesId );
// 4.3. Splines
aAction = new QtxAction( tr( "TOT_PLOT2D_CURVES_SPLINES" ),
0, this );
aAction->setStatusTip( tr( "PRP_PLOT2D_CURVES_SPLINES" ) );
aAction->setCheckable( true );
- myActionsMap[ CurvSplinesId ] = aAction;
+ mgr->registerAction( aAction, CurvSplinesId );
// 4.4. Create action group for curve type operations
QActionGroup* aCurveGroup = new QActionGroup( this );
- aCurveGroup->addAction( myActionsMap[ CurvPointsId ] );
- aCurveGroup->addAction( myActionsMap[ CurvLinesId ] );
- aCurveGroup->addAction( myActionsMap[ CurvSplinesId ] );
+ aCurveGroup->addAction( mgr->action( CurvPointsId ) );
+ aCurveGroup->addAction( mgr->action( CurvLinesId ) );
+ aCurveGroup->addAction( mgr->action( CurvSplinesId ) );
connect( aCurveGroup, SIGNAL( triggered( QAction* ) ), this, SLOT( onCurves() ) );
// 5. Horizontal scaling mode operations
aAction->setStatusTip( tr( "PRP_PLOT2D_MODE_LINEAR_HOR" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewHorMode() ) );
aAction->setCheckable( true );
- myActionsMap[ PModeXLinearId ] = aAction;
+ mgr->registerAction( aAction, PModeXLinearId );
// 5.2. Logarithmic
aAction = new QtxAction( tr( "TOT_PLOT2D_MODE_LOGARITHMIC_HOR" ),
aAction->setStatusTip( tr( "PRP_PLOT2D_MODE_LOGARITHMIC_HOR" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewHorMode() ) );
aAction->setCheckable( true );
- myActionsMap[ PModeXLogarithmicId ] = aAction;
+ mgr->registerAction( aAction, PModeXLogarithmicId );
// 5.3. Create action group for horizontal scaling mode operations
QActionGroup* aHorGroup = new QActionGroup( this );
- aHorGroup->addAction( myActionsMap[ PModeXLinearId ] );
- aHorGroup->addAction( myActionsMap[ PModeXLogarithmicId ] );
+ aHorGroup->addAction( mgr->action( PModeXLinearId ) );
+ aHorGroup->addAction( mgr->action( PModeXLogarithmicId ) );
// 6. Vertical scaling mode operations
aAction->setStatusTip( tr( "PRP_PLOT2D_MODE_LINEAR_VER" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewVerMode() ) );
aAction->setCheckable( true );
- myActionsMap[ PModeYLinearId ] = aAction;
+ mgr->registerAction( aAction, PModeYLinearId );
// 6.2. Logarithmic
aAction = new QtxAction( tr( "TOT_PLOT2D_MODE_LOGARITHMIC_VER" ),
aAction->setStatusTip( tr( "PRP_PLOT2D_MODE_LOGARITHMIC_VER" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewVerMode() ) );
aAction->setCheckable( true );
- myActionsMap[ PModeYLogarithmicId ] = aAction;
+ mgr->registerAction( aAction, PModeYLogarithmicId );
// 6.3. Create action group for vertical scaling mode operations
QActionGroup* aVerGroup = new QActionGroup( this );
- aVerGroup->addAction( myActionsMap[ PModeYLinearId ] );
- aVerGroup->addAction( myActionsMap[ PModeYLogarithmicId ] );
+ aVerGroup->addAction( mgr->action( PModeYLinearId ) );
+ aVerGroup->addAction( mgr->action( PModeYLogarithmicId ) );
// 7. Legend
aAction = new QtxAction( tr( "TOT_PLOT2D_SHOW_LEGEND" ),
aAction->setStatusTip( tr( "PRP_PLOT2D_SHOW_LEGEND" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onLegend() ) );
aAction->setCheckable( true );
- myActionsMap[ LegendId ] = aAction;
+ mgr->registerAction( aAction, LegendId );
// 8. Settings
aAction = new QtxAction( tr( "TOT_PLOT2D_SETTINGS" ),
0, this );
aAction->setStatusTip( tr( "PRP_PLOT2D_SETTINGS" ) );
connect( aAction, SIGNAL( triggered( bool ) ), myViewFrame, SLOT( onSettings() ) );
- myActionsMap[ CurvSettingsId ] = aAction;
+ mgr->registerAction( aAction, CurvSettingsId );
// 9. Clone
aAction = new QtxAction( tr( "MNU_CLONE_VIEW" ),
0, this);
aAction->setStatusTip( tr( "DSC_CLONE_VIEW" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SIGNAL( cloneView() ) );
- myActionsMap[ CloneId ] = aAction;
+ mgr->registerAction( aAction, CloneId );
// Set initial values
onChangeCurveMode();
*/
void Plot2d_ViewWindow::createToolBar()
{
- myToolBar->addAction( myActionsMap[ DumpId ] );
- myToolBar->addAction( myActionsMap[ ScaleOpId ] );
- myToolBar->addAction( myActionsMap[ MoveOpId ] );
- myToolBar->addSeparator();
- myToolBar->addAction( myActionsMap[ CurvPointsId ] );
- myToolBar->addAction( myActionsMap[ CurvLinesId ] );
- myToolBar->addAction( myActionsMap[ CurvSplinesId ] );
- myToolBar->addSeparator();
- myToolBar->addAction( myActionsMap[ PModeXLinearId ] );
- myToolBar->addAction( myActionsMap[ PModeXLogarithmicId ] );
- myToolBar->addSeparator();
- myToolBar->addAction( myActionsMap[ PModeYLinearId ] );
- myToolBar->addAction( myActionsMap[ PModeYLogarithmicId ] );
- myToolBar->addSeparator();
- myToolBar->addAction( myActionsMap[ LegendId ] );
- myToolBar->addAction( myActionsMap[ CurvSettingsId ] );
- myToolBar->addAction( myActionsMap[ CloneId ] );
+ QtxActionToolMgr* mgr = toolMgr();
+ myToolBar = mgr->createToolBar( tr( "LBL_TOOLBAR_LABEL" ) );
+ mgr->append( DumpId, myToolBar );
+ mgr->append( ScaleOpId, myToolBar );
+ mgr->append( MoveOpId, myToolBar );
+ mgr->append( toolMgr()->separator(), myToolBar );
+ mgr->append( CurvPointsId, myToolBar );
+ mgr->append( CurvLinesId, myToolBar );
+ mgr->append( CurvSplinesId, myToolBar );
+ mgr->append( toolMgr()->separator(), myToolBar );
+ mgr->append( PModeXLinearId, myToolBar );
+ mgr->append( PModeXLogarithmicId, myToolBar );
+ mgr->append( toolMgr()->separator(), myToolBar );
+ mgr->append( PModeYLinearId, myToolBar );
+ mgr->append( PModeYLogarithmicId, myToolBar );
+ mgr->append( toolMgr()->separator(), myToolBar );
+ mgr->append( LegendId, myToolBar );
+ mgr->append( CurvSettingsId, myToolBar );
+ mgr->append( CloneId, myToolBar );
}
/*!
bool aVerLinear = myViewFrame->isModeVerLinear();
if ( aHorLinear )
- myActionsMap[ PModeXLinearId ]->setChecked( true );
+ toolMgr()->action( PModeXLinearId )->setChecked( true );
else
- myActionsMap[ PModeXLogarithmicId ]->setChecked( true );
+ toolMgr()->action( PModeXLogarithmicId )->setChecked( true );
- myActionsMap[ GlobalPanId ]->setEnabled( aHorLinear && aVerLinear );
+ toolMgr()->action( GlobalPanId )->setEnabled( aHorLinear && aVerLinear );
}
/*!
bool aVerLinear = myViewFrame->isModeVerLinear();
if ( aVerLinear )
- myActionsMap[ PModeYLinearId ]->setChecked( true );
+ toolMgr()->action( PModeYLinearId )->setChecked( true );
else
- myActionsMap[ PModeYLogarithmicId ]->setChecked( true );
+ toolMgr()->action( PModeYLogarithmicId )->setChecked( true );
- myActionsMap[ GlobalPanId ]->setEnabled( aHorLinear && aVerLinear );
+ toolMgr()->action( GlobalPanId )->setEnabled( aHorLinear && aVerLinear );
}
/*!
{
switch ( myViewFrame->getCurveType() ) {
case 0:
- myActionsMap[ CurvPointsId ]->setChecked( true );
+ toolMgr()->action( CurvPointsId )->setChecked( true );
break;
case 1:
- myActionsMap[ CurvLinesId ]->setChecked( true );
+ toolMgr()->action( CurvLinesId )->setChecked( true );
break;
case 2:
- myActionsMap[ CurvSplinesId ]->setChecked( true );
+ toolMgr()->action( CurvSplinesId )->setChecked( true );
break;
default:
break;
*/
void Plot2d_ViewWindow::onChangeLegendMode()
{
- myActionsMap[ LegendId ]->setChecked( myViewFrame->isLegendShow() );
+ toolMgr()->action( LegendId )->setChecked( myViewFrame->isLegendShow() );
}
/*!
*/
void Plot2d_ViewWindow::onViewHorMode()
{
- myViewFrame->setHorScaleMode( myActionsMap[ PModeXLinearId ]->isChecked() ? 0 : 1 );
+ myViewFrame->setHorScaleMode( toolMgr()->action( PModeXLinearId )->isChecked() ? 0 : 1 );
}
/*!
*/
void Plot2d_ViewWindow::onViewVerMode()
{
- myViewFrame->setVerScaleMode( myActionsMap[ PModeYLinearId ]->isChecked() ? 0 : 1 );
+ myViewFrame->setVerScaleMode( toolMgr()->action( PModeYLinearId )->isChecked() ? 0 : 1 );
}
/*!
*/
void Plot2d_ViewWindow::onCurves()
{
- if( myActionsMap[ CurvPointsId ]->isChecked() )
+ if( toolMgr()->action( CurvPointsId )->isChecked() )
myViewFrame->setCurveType( 0 );
- else if ( myActionsMap[ CurvLinesId ]->isChecked() )
+ else if ( toolMgr()->action( CurvLinesId )->isChecked() )
myViewFrame->setCurveType( 1 );
- else if ( myActionsMap[ CurvSplinesId ]->isChecked() )
+ else if ( toolMgr()->action( CurvSplinesId )->isChecked() )
myViewFrame->setCurveType( 2 );
}
{
Q_OBJECT
+public:
+ enum { DumpId,
+ ScaleOpId, FitAllId, FitRectId, ZoomId,
+ MoveOpId, PanId, GlobalPanId,
+ PModeXLinearId, PModeXLogarithmicId,
+ PModeYLinearId, PModeYLogarithmicId,
+ CurvPointsId, CurvLinesId, CurvSplinesId,
+ LegendId,
+ CurvSettingsId,
+ CloneId };
+
public:
Plot2d_ViewWindow( SUIT_Desktop*, Plot2d_Viewer* );
virtual ~Plot2d_ViewWindow();
void onDumpView();
-protected:
- enum { DumpId,
- ScaleOpId, FitAllId, FitRectId, ZoomId,
- MoveOpId, PanId, GlobalPanId,
- PModeXLinearId, PModeXLogarithmicId,
- PModeYLinearId, PModeYLogarithmicId,
- CurvPointsId, CurvLinesId, CurvSplinesId,
- LegendId,
- CurvSettingsId,
- CloneId };
-
- typedef QMap<int, QtxAction*> ActionsMap;
- ActionsMap myActionsMap;
-
protected:
virtual QImage dumpView();
virtual bool dumpViewToFormat( const QImage&,
private:
Plot2d_Viewer* myModel;
Plot2d_ViewFrame* myViewFrame;
- QToolBar* myToolBar;
+ int myToolBar;
QImage myDumpImage;
};
#include <QtxAction.h>
#include <QtxMultiAction.h>
#include <QtxToolBar.h>
+#include <QtxActionToolMgr.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ViewWindow.h>
setObjectName(theName);
setWindowFlags( windowFlags() & ~Qt::Window );
- myToolBar = new QtxToolBar( true, tr("LBL_TOOLBAR_LABEL"), this );
+ myToolBar = myViewWindow->toolMgr()->createToolBar( tr("LBL_TOOLBAR_LABEL"), -1, this );
createActions(theResourceMgr);
createToolBar();
myInteractor->setFocus();
setFocusProxy(myInteractor);
- myUpdateRateDlg = new SVTK_UpdateRateDlg(myActionsMap[UpdateRate],this,"SVTK_UpdateRateDlg");
- myNonIsometricDlg = new SVTK_NonIsometricDlg(myActionsMap[NonIsometric],this,"SVTK_NonIsometricDlg");
- myCubeAxesDlg = new SVTK_CubeAxesDlg(myActionsMap[GraduatedAxes],this,"SVTK_CubeAxesDlg");
- mySetRotationPointDlg = new SVTK_SetRotationPointDlg(myActionsMap[ChangeRotationPointId],this,"SVTK_SetRotationPointDlg");
+ myUpdateRateDlg = new SVTK_UpdateRateDlg( action( UpdateRate ), this, "SVTK_UpdateRateDlg" );
+ myNonIsometricDlg = new SVTK_NonIsometricDlg( action( NonIsometric ), this, "SVTK_NonIsometricDlg" );
+ myCubeAxesDlg = new SVTK_CubeAxesDlg( action( GraduatedAxes ), this, "SVTK_CubeAxesDlg" );
+ mySetRotationPointDlg = new SVTK_SetRotationPointDlg
+ ( action( ChangeRotationPointId ), this, "SVTK_SetRotationPointDlg" );
}
/*!
SVTK_MainWindow
::getToolBar()
{
- return myToolBar;
+ return myViewWindow->toolMgr()->toolBar( myToolBar );
}
void
SVTK_MainWindow
::createActions(SUIT_ResourceMgr* theResourceMgr)
{
- if(!myActionsMap.isEmpty())
- return;
-
QtxAction* anAction;
+ QtxActionToolMgr* mgr = myViewWindow->toolMgr();
// Dump view
anAction = new QtxAction(tr("MNU_DUMP_VIEW"),
tr( "MNU_DUMP_VIEW" ), 0, this);
anAction->setStatusTip(tr("DSC_DUMP_VIEW"));
connect(anAction, SIGNAL(activated()), myViewWindow, SLOT(onDumpView()));
- myActionsMap[ DumpId ] = anAction;
+ mgr->registerAction( anAction, DumpId );
// FitAll
anAction = new QtxAction(tr("MNU_FITALL"),
tr( "MNU_FITALL" ), 0, this);
anAction->setStatusTip(tr("DSC_FITALL"));
connect(anAction, SIGNAL(activated()), this, SLOT(onFitAll()));
- myActionsMap[ FitAllId ] = anAction;
+ mgr->registerAction( anAction, FitAllId );
// FitRect
anAction = new QtxAction(tr("MNU_FITRECT"),
tr( "MNU_FITRECT" ), 0, this);
anAction->setStatusTip(tr("DSC_FITRECT"));
connect(anAction, SIGNAL(activated()), this, SLOT(activateWindowFit()));
- myActionsMap[ FitRectId ] = anAction;
+ mgr->registerAction( anAction, FitRectId );
// Zoom
anAction = new QtxAction(tr("MNU_ZOOM_VIEW"),
tr( "MNU_ZOOM_VIEW" ), 0, this);
anAction->setStatusTip(tr("DSC_ZOOM_VIEW"));
connect(anAction, SIGNAL(activated()), this, SLOT(activateZoom()));
- myActionsMap[ ZoomId ] = anAction;
+ mgr->registerAction( anAction, ZoomId );
// Panning
anAction = new QtxAction(tr("MNU_PAN_VIEW"),
tr( "MNU_PAN_VIEW" ), 0, this);
anAction->setStatusTip(tr("DSC_PAN_VIEW"));
connect(anAction, SIGNAL(activated()), this, SLOT(activatePanning()));
- myActionsMap[ PanId ] = anAction;
+ mgr->registerAction( anAction, PanId );
// Global Panning
anAction = new QtxAction(tr("MNU_GLOBALPAN_VIEW"),
tr( "MNU_GLOBALPAN_VIEW" ), 0, this);
anAction->setStatusTip(tr("DSC_GLOBALPAN_VIEW"));
connect(anAction, SIGNAL(activated()), this, SLOT(activateGlobalPanning()));
- myActionsMap[ GlobalPanId ] = anAction;
+ mgr->registerAction( anAction, GlobalPanId );
// Change rotation point
anAction = new QtxAction(tr("MNU_CHANGINGROTATIONPOINT_VIEW"),
anAction->setStatusTip(tr("DSC_CHANGINGROTATIONPOINT_VIEW"));
anAction->setCheckable(true);
connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onChangeRotationPoint(bool)));
- myActionsMap[ ChangeRotationPointId ] = anAction;
+ mgr->registerAction( anAction, ChangeRotationPointId );
// Rotation
anAction = new QtxAction(tr("MNU_ROTATE_VIEW"),
tr( "MNU_ROTATE_VIEW" ), 0, this);
anAction->setStatusTip(tr("DSC_ROTATE_VIEW"));
connect(anAction, SIGNAL(activated()), this, SLOT(activateRotation()));
- myActionsMap[ RotationId ] = anAction;
+ mgr->registerAction( anAction, RotationId );
// Projections
anAction = new QtxAction(tr("MNU_FRONT_VIEW"),
tr( "MNU_FRONT_VIEW" ), 0, this);
anAction->setStatusTip(tr("DSC_FRONT_VIEW"));
connect(anAction, SIGNAL(activated()), this, SLOT(onFrontView()));
- myActionsMap[ FrontId ] = anAction;
+ mgr->registerAction( anAction, FrontId );
anAction = new QtxAction(tr("MNU_BACK_VIEW"),
theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BACK" ) ),
tr( "MNU_BACK_VIEW" ), 0, this);
anAction->setStatusTip(tr("DSC_BACK_VIEW"));
connect(anAction, SIGNAL(activated()), this, SLOT(onBackView()));
- myActionsMap[ BackId ] = anAction;
+ mgr->registerAction( anAction, BackId );
anAction = new QtxAction(tr("MNU_TOP_VIEW"),
theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_TOP" ) ),
tr( "MNU_TOP_VIEW" ), 0, this);
anAction->setStatusTip(tr("DSC_TOP_VIEW"));
connect(anAction, SIGNAL(activated()), this, SLOT(onTopView()));
- myActionsMap[ TopId ] = anAction;
+ mgr->registerAction( anAction, TopId );
anAction = new QtxAction(tr("MNU_BOTTOM_VIEW"),
theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BOTTOM" ) ),
tr( "MNU_BOTTOM_VIEW" ), 0, this);
anAction->setStatusTip(tr("DSC_BOTTOM_VIEW"));
connect(anAction, SIGNAL(activated()), this, SLOT(onBottomView()));
- myActionsMap[ BottomId ] = anAction;
+ mgr->registerAction( anAction, BottomId );
anAction = new QtxAction(tr("MNU_LEFT_VIEW"),
theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_LEFT" ) ),
tr( "MNU_LEFT_VIEW" ), 0, this);
anAction->setStatusTip(tr("DSC_LEFT_VIEW"));
connect(anAction, SIGNAL(activated()), this, SLOT(onLeftView()));
- myActionsMap[ LeftId ] = anAction;
+ mgr->registerAction( anAction, LeftId );
anAction = new QtxAction(tr("MNU_RIGHT_VIEW"),
theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RIGHT" ) ),
tr( "MNU_RIGHT_VIEW" ), 0, this);
anAction->setStatusTip(tr("DSC_RIGHT_VIEW"));
connect(anAction, SIGNAL(activated()), this, SLOT(onRightView()));
- myActionsMap[ RightId ] = anAction;
+ mgr->registerAction( anAction, RightId );
// Reset
anAction = new QtxAction(tr("MNU_RESET_VIEW"),
tr( "MNU_RESET_VIEW" ), 0, this);
anAction->setStatusTip(tr("DSC_RESET_VIEW"));
connect(anAction, SIGNAL(activated()), this, SLOT(onResetView()));
- myActionsMap[ ResetId ] = anAction;
+ mgr->registerAction( anAction, ResetId );
// onViewTrihedron: Shows - Hides Trihedron
anAction = new QtxAction(tr("MNU_SHOW_TRIHEDRON"),
tr( "MNU_SHOW_TRIHEDRON" ), 0, this);
anAction->setStatusTip(tr("DSC_SHOW_TRIHEDRON"));
connect(anAction, SIGNAL(activated()), this, SLOT(onViewTrihedron()));
- myActionsMap[ ViewTrihedronId ] = anAction;
+ mgr->registerAction( anAction, ViewTrihedronId );
// onNonIsometric: Manage non-isometric params
anAction = new QtxAction(tr("MNU_SVTK_SCALING"),
anAction->setStatusTip(tr("DSC_SVTK_SCALING"));
anAction->setCheckable(true);
connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onNonIsometric(bool)));
- myActionsMap[ NonIsometric ] = anAction;
+ mgr->registerAction( anAction, NonIsometric );
// onGraduatedAxes: Manage graduated axes params
anAction = new QtxAction(tr("MNU_SVTK_GRADUATED_AXES"),
anAction->setStatusTip(tr("DSC_SVTK_GRADUATED_AXES"));
anAction->setCheckable(true);
connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onGraduatedAxes(bool)));
- myActionsMap[ GraduatedAxes ] = anAction;
+ mgr->registerAction( anAction, GraduatedAxes );
// onGraduatedAxes: Manage graduated axes params
anAction = new QtxAction(tr("MNU_SVTK_UPDATE_RATE"),
anAction->setStatusTip(tr("DSC_SVTK_UPDATE_RATE"));
anAction->setCheckable(true);
connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onUpdateRate(bool)));
- myActionsMap[ UpdateRate ] = anAction;
+ mgr->registerAction( anAction, UpdateRate );
}
#if defined(WIN32) && !defined(_DEBUG)
SVTK_MainWindow
::createToolBar()
{
- myToolBar->addAction( myActionsMap[DumpId] );
- myToolBar->addAction( myActionsMap[ViewTrihedronId] );
+ QtxActionToolMgr* mgr = myViewWindow->toolMgr();
+
+ mgr->append( DumpId, myToolBar );
+ mgr->append( ViewTrihedronId, myToolBar );
QtxMultiAction* aScaleAction = new QtxMultiAction( this );
- aScaleAction->insertAction( myActionsMap[FitAllId] );
- aScaleAction->insertAction( myActionsMap[FitRectId] );
- aScaleAction->insertAction( myActionsMap[ZoomId] );
- myToolBar->addAction( aScaleAction );
+ aScaleAction->insertAction( action( FitAllId ) );
+ aScaleAction->insertAction( action( FitRectId ) );
+ aScaleAction->insertAction( action( ZoomId ) );
+ mgr->append( aScaleAction, myToolBar );
QtxMultiAction* aPanningAction = new QtxMultiAction( this );
- aPanningAction->insertAction( myActionsMap[PanId] );
- aPanningAction->insertAction( myActionsMap[GlobalPanId] );
- myToolBar->addAction( aPanningAction );
+ aPanningAction->insertAction( action( PanId ) );
+ aPanningAction->insertAction( action( GlobalPanId ) );
+ mgr->append( aPanningAction, myToolBar );
- myToolBar->addAction( myActionsMap[ChangeRotationPointId] );
+ mgr->append( ChangeRotationPointId, myToolBar );
- myToolBar->addAction( myActionsMap[RotationId] );
+ mgr->append( RotationId, myToolBar );
QtxMultiAction* aViewsAction = new QtxMultiAction( this );
- aViewsAction->insertAction( myActionsMap[FrontId] );
- aViewsAction->insertAction( myActionsMap[BackId] );
- aViewsAction->insertAction( myActionsMap[TopId] );
- aViewsAction->insertAction( myActionsMap[BottomId] );
- aViewsAction->insertAction( myActionsMap[LeftId] );
- aViewsAction->insertAction( myActionsMap[RightId] );
- myToolBar->addAction( aViewsAction );
+ aViewsAction->insertAction( action( FrontId ) );
+ aViewsAction->insertAction( action( BackId ) );
+ aViewsAction->insertAction( action( TopId ) );
+ aViewsAction->insertAction( action( BottomId ) );
+ aViewsAction->insertAction( action( LeftId ) );
+ aViewsAction->insertAction( action( RightId ) );
+ mgr->append( aViewsAction, myToolBar );
- myToolBar->addAction( myActionsMap[ResetId] );
+ mgr->append( ResetId, myToolBar );
- myToolBar->addAction( myActionsMap[UpdateRate] );
- myToolBar->addAction( myActionsMap[NonIsometric] );
- myToolBar->addAction( myActionsMap[GraduatedAxes] );
+ mgr->append( UpdateRate, myToolBar );
+ mgr->append( NonIsometric, myToolBar );
+ mgr->append( GraduatedAxes, myToolBar );
}
/*!
QPixmap px = QPixmap::grabWindow( GetInteractor()->winId() );
return px.toImage();
}
+
+/*!
+ \return action by it's id
+*/
+QtxAction* SVTK_MainWindow::action( int id ) const
+{
+ return dynamic_cast<QtxAction*>( myViewWindow->toolMgr()->action( id ) );
+}
#include "SVTK.h"
#include "SVTK_Selection.h"
-#include <vtkSmartPointer.h>
-
#include <QMainWindow>
-#include <QMap>
-class QtxAction;
+#include <vtkSmartPointer.h>
class vtkObject;
class vtkRenderer;
class vtkInteractorStyle;
class vtkRenderWindowInteractor;
+class QtxAction;
+
class SUIT_ResourceMgr;
class SUIT_ViewWindow;
class SVTK_CubeAxesActor2D;
class SVTK_CubeAxesDlg;
class SVTK_SetRotationPointDlg;
-
-class VTKViewer_Trihedron;
-class VTKViewer_Actor;
-
class SVTK_Renderer;
class SVTK_Selector;
+class VTKViewer_Trihedron;
+class VTKViewer_Actor;
//! The class is a container for #SVTK_RenderWindowInteractor.
/*!
void
SetEventDispatcher(vtkObject* theDispatcher);
+ QtxAction* action( int ) const;
+
enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId,
ChangeRotationPointId, RotationId,
FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId,
ViewTrihedronId, NonIsometric, GraduatedAxes, UpdateRate};
- typedef QMap<int, QtxAction*> TActionsMap;
SUIT_ViewWindow* myViewWindow;
SVTK_SetRotationPointDlg* mySetRotationPointDlg;
vtkSmartPointer<vtkObject> myEventDispatcher;
- TActionsMap myActionsMap;
- QToolBar* myToolBar;
+ int myToolBar;
SVTK_RenderWindowInteractor* myInteractor;
};