#include "SALOME_Event.hxx"
// QT Includes
+#include <qaccel.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qmessagebox.h>
# include <string.h>
}
+enum { voPanLeft,
+ voPanRight,
+ voPanUp,
+ voPanDown,
+ voZoomIn,
+ voZoomOut,
+ voZoomFit,
+ voRotateLeft,
+ voRotateRight,
+ voRotateUp,
+ voRotateDown };
+
QAD_ResourceMgr* QAD_Desktop::resourceMgr = 0;
QPalette* QAD_Desktop::palette = 0;
QAD_ASSERT( connect( helpAboutAction, SIGNAL(activated()), this, SLOT( onHelpAbout() )));
helpAboutAction->addTo( &myHelpPopup );
myStdActions.insert(HelpAboutId, helpAboutAction );
+
+ /* additional key accelerators */
+ QAccel* accel = new QAccel( this );
+ // pan left
+ myAccelMap[ accel->insertItem( CTRL+Key_Left ) ] = voPanLeft;
+ // pan right
+ myAccelMap[ accel->insertItem( CTRL+Key_Right ) ] = voPanRight;
+ // pan up
+ myAccelMap[ accel->insertItem( CTRL+Key_Up ) ] = voPanUp;
+ // pan down
+ myAccelMap[ accel->insertItem( CTRL+Key_Down ) ] = voPanDown;
+ // zoom in
+ myAccelMap[ accel->insertItem( CTRL+Key_Plus ) ] = voZoomIn;
+ // zoom out
+ myAccelMap[ accel->insertItem( CTRL+Key_Minus ) ] = voZoomOut;
+ // zoom in
+ myAccelMap[ accel->insertItem( CTRL+Key_Equal ) ] = voZoomIn;
+ // fit all
+ myAccelMap[ accel->insertItem( CTRL+Key_Asterisk ) ] = voZoomFit;
+ // rotate left
+ myAccelMap[ accel->insertItem( ALT+Key_Left ) ] = voRotateLeft;
+ // rotate right
+ myAccelMap[ accel->insertItem( ALT+Key_Right ) ] = voRotateRight;
+ // rotate up
+ myAccelMap[ accel->insertItem( ALT+Key_Up ) ] = voRotateUp;
+ // rotate down
+ myAccelMap[ accel->insertItem( ALT+Key_Down ) ] = voRotateDown;
+ // connect signal to slot
+ connect( accel, SIGNAL( activated(int) ), this, SLOT( onKeyAccel(int) ) );
}
updateActions();
}
}
}
+/* Processes additinal key accelerators, e.g. viewer incremental transfomrations */
+void QAD_Desktop::onKeyAccel( int id )
+{
+ if ( myAccelMap.find( id ) != myAccelMap.end() ) {
+ int cmd = myAccelMap[ id ];
+ if ( myActiveApp != 0 && myActiveApp->getActiveStudy() != 0 && myActiveApp->getActiveStudy()->getActiveStudyFrame() != 0 ) {
+ QAD_ViewFrame* vf = myActiveApp->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame();
+ switch ( cmd ) {
+ case voPanLeft:
+ vf->onPanLeft();
+ break;
+ case voPanRight:
+ vf->onPanRight();
+ break;
+ case voPanUp:
+ vf->onPanUp();
+ break;
+ case voPanDown:
+ vf->onPanDown();
+ break;
+ case voZoomIn:
+ vf->onZoomIn();
+ break;
+ case voZoomOut:
+ vf->onZoomOut();
+ break;
+ case voZoomFit:
+ vf->onViewFitAll();
+ break;
+ case voRotateLeft:
+ vf->onRotateLeft();
+ break;
+ case voRotateRight:
+ vf->onRotateRight();
+ break;
+ case voRotateUp:
+ vf->onRotateUp();
+ break;
+ case voRotateDown:
+ vf->onRotateDown();
+ break;
+ }
+ }
+ }
+}
+
/*********************************************************************
** Class: AppSelectionDlg
** Descr: Dialog for the selection of the application when several
void Desktop_AppSelectionDlg::onHelp()
{
}
-
virtual void Activate( QAD_Study* ) {}
// this method is called when parent window of view frame is activated
-protected slots:
+public slots:
+ /* basic view operations,
+ most of them are pure virtual
+ and should be redefined in derived classes
+ */
virtual void onViewPan() = 0;
virtual void onViewZoom() = 0;
virtual void onViewFitAll() = 0;
virtual void onViewTrihedron() = 0;
virtual void onViewDump();
+ /* view incremental transformation operations.
+ virtual, can be redefined in derived classes
+ */
+ virtual void onPanLeft() {}
+ virtual void onPanRight() {}
+ virtual void onPanUp() {}
+ virtual void onPanDown() {}
+ virtual void onZoomIn() {}
+ virtual void onZoomOut() {}
+ virtual void onRotateLeft() {}
+ virtual void onRotateRight() {}
+ virtual void onRotateUp() {}
+ virtual void onRotateDown() {}
};
#endif