Commit 08d60a7b authored by Jan Möbius's avatar Jan Möbius

ContextMenu and Menubar reorganization

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5234 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 09876ff5
......@@ -130,8 +130,11 @@ Core() :
//init ViewerProperties (always for 4 Viewers!)
std::vector< Viewer::ViewerProperties* > viewerProperties;
for (int i=0; i < 4; i++)
viewerProperties.push_back( new Viewer::ViewerProperties() );
for (int i=0; i < 4; i++) {
Viewer::ViewerProperties* viewerProperty = new Viewer::ViewerProperties();
viewerProperty->snapshotBaseFileName("snap-Viewer-" + QString::number(i) + ".png");
viewerProperties.push_back( viewerProperty );
}
PluginFunctions::setViewerProperties(viewerProperties);
......
This diff is collapsed.
......@@ -77,9 +77,9 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
sceneGraphDialog_(0),
fileMenu_(0),
viewMenu_(0),
toolsMenu_(0),
fileMenuEnd_(0),
stereoButton_(0),
projectionButton_(0),
moveButton_(0),
lightButton_(0),
pickButton_(0),
......@@ -87,11 +87,13 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
globalDrawMenu_(0),
drawGroup_(0),
viewGroup_(0),
perspectiveProjectionAction_(0),
activeDrawModes_(0),
availableGlobalDrawModes_(0),
contextMenu_(0),
functionMenu_(0),
contextSelectionMenu_(0),
drawGroupViewer_(0),
viewerDrawMenu_(0),
stackMenu_(0),
helpBrowserDeveloper_(0),
helpBrowserUser_(0),
......@@ -336,92 +338,6 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
viewerToolbar_->addSeparator();
QToolButton* homeButton = new QToolButton( viewerToolbar_ );
homeButton->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"go-home.png") );
homeButton->setMinimumSize( 16, 16 );
homeButton->setMaximumSize( 32, 32 );
homeButton->setCheckable( false );
homeButton->setToolTip("Restore <b>home</b> view.");
homeButton->setWhatsThis(
"Restore home view<br><br>"
"Resets the view to the home view");
for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
connect( homeButton,SIGNAL( clicked() ), examiner_widgets_[i], SLOT( home() ) );
viewerToolbar_->addWidget( homeButton)->setText("Home");
QToolButton* setHomeButton = new QToolButton( viewerToolbar_ );
setHomeButton->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"set-home.png") );
setHomeButton->setMinimumSize( 16, 16 );
setHomeButton->setMaximumSize( 32, 32 );
setHomeButton->setCheckable( false );
setHomeButton->setToolTip("Set <b>home</b> view");
setHomeButton->setWhatsThis(
"Store home view<br><br>"
"Stores the current view as the home view");
for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
connect( setHomeButton,SIGNAL( clicked() ), examiner_widgets_[i], SLOT( setHome() ) );
viewerToolbar_->addWidget( setHomeButton)->setText("Set Home");
QToolButton* viewAllButton = new QToolButton( viewerToolbar_ );
viewAllButton->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"viewall.png") );
viewAllButton->setMinimumSize( 16, 16 );
viewAllButton->setMaximumSize( 32, 32 );
viewAllButton->setCheckable( false );
viewAllButton->setToolTip("View all.");
viewAllButton->setWhatsThis(
"View all<br><br>"
"Move the objects in the scene so that"
" the whole scene is visible.");
for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
connect( viewAllButton,SIGNAL( clicked() ), examiner_widgets_[i], SLOT( viewAll() ) );
viewerToolbar_->addWidget( viewAllButton)->setText("View all");
projectionButton_ = new QToolButton( viewerToolbar_ );
projectionButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"perspective.png") );
projectionButton_->setMinimumSize( 16, 16 );
projectionButton_->setMaximumSize( 32, 32 );
projectionButton_->setCheckable( false );
projectionButton_->setToolTip(
"Switch between <b>perspective</b> and "
"<b>parrallel</b> projection mode.");
projectionButton_->setWhatsThis(
"Switch projection modes<br><br>"
"Switch between <b>perspective</b> and "
"<b>parrallel</b> projection mode.");
for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
connect( projectionButton_,SIGNAL( clicked() ), examiner_widgets_[i], SLOT( toggleProjectionMode() ) );
connect( examiner_widgets_[i],SIGNAL( projectionModeChanged( bool ) ), this , SLOT( slotProjectionModeChanged( bool ) ) );
}
viewerToolbar_->addWidget( projectionButton_)->setText( "Projection" );
viewerToolbar_->addSeparator();
QToolButton* sceneGraphButton = new QToolButton( viewerToolbar_ );
sceneGraphButton->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"scenegraph.png") );
sceneGraphButton->setMinimumSize( 16, 16 );
sceneGraphButton->setMaximumSize( 32, 32 );
sceneGraphButton->setCheckable( false );
sceneGraphButton->setToolTip("Toggle scene graph viewer.");
sceneGraphButton->setWhatsThis(
"Toggle scene graph viewer<br><br>"
"The scene graph viewer enables you to examine the "
"displayed scene graph and to modify certain nodes.<br><br>"
"There are three modi for the scene graph viewer:"
"<ul><li><b>hidden</b></li>"
"<li><b>split</b>: share space</li>"
"<li><b>dialog</b>: own dialog window</li></ul>"
"This button toggles between these modi.");
QObject::connect( sceneGraphButton, SIGNAL( clicked() ),
this, SLOT( slotShowSceneGraphDialog() ) );
viewerToolbar_->addWidget( sceneGraphButton)->setText( "SceneGraph" );
if (OpenFlipper::Options::stereo())
{
stereoButton_ = new QToolButton( viewerToolbar_ );
......
......@@ -466,6 +466,9 @@ public:
/// View Menu
QMenu *viewMenu_;
/// Tools Menu
QMenu *toolsMenu_;
/// First entry after all relevant parts of the File Menu
QAction* fileMenuEnd_;
......@@ -481,7 +484,6 @@ public:
int toolbarCount_;
QToolButton* stereoButton_;
QToolButton* projectionButton_;
QToolButton* moveButton_;
QToolButton* lightButton_;
QToolButton* pickButton_;
......@@ -502,6 +504,9 @@ public:
/// Called when the global drawMode is selected
void slotGlobalDrawMenu(QAction * _action);
/// Called before the view Menu is shown
void slotViewMenuAboutToShow();
private:
/// This variable holds the global draw menu
QMenu* globalDrawMenu_;
......@@ -511,6 +516,9 @@ public:
/// Group for all menu items
QActionGroup* viewGroup_;
QAction* perspectiveProjectionAction_;
QAction* orthogonalProjectionAction_;
int activeDrawModes_;
int availableGlobalDrawModes_;
......@@ -536,15 +544,6 @@ public:
/// called by plugins to add a real context menu depending on DataType
void slotAddContextMenu( QMenu* _menu , DataType _dataType ,ContextMenuType type_);
/// change the animation setting
void slotChangeAnimation(bool _animation);
/// change the backFaceCulling setting
void slotChangeBackFaceCulling(bool _backFaceCulling);
/// change the twoSidedLighting setting
void slotChangeTwoSidedLighting(bool _lighting);
/// Paste the view to the last active examiner
void slotPasteView( );
......@@ -557,6 +556,12 @@ public:
/// Set the snapShot name for all examiners
void slotSnapshotName();
/// Called when a coordsys drawMode has been changed
void slotViewerDrawMenu( QAction * _action );
/// Creates a draw Menu for the currently active Viewer
void slotUpdateViewerDrawMenu();
private :
/** Update the contextmenu for the given position inside an examiner widget
*
......@@ -572,9 +577,6 @@ public:
/// context Menu for the gl area
QMenu* contextMenu_;
/// Function Menu
QMenu* functionMenu_;
/// Context Menu containing all selection elements
QMenu* contextSelectionMenu_;
......@@ -584,6 +586,12 @@ public:
/// All real context menu entries
std::vector< MenuInfo > contextMenus_;
/// DrawGroup for per Viewer Draw Modes
QActionGroup* drawGroupViewer_;
/// Draw Menu for per Viewer Draw Modes
QMenu* viewerDrawMenu_;
/** @} */
//===========================================================================
......@@ -738,20 +746,73 @@ public:
/// Enable or disable Stereo
void slotToggleStereoMode();
/// Change icons if the stereo mode has changed in the examiner
void slotProjectionModeChanged( bool _ortho );
/// Change Icons if action mode is changed in an examiner
void slotActionModeChanged( Viewer::ActionMode _mode );
/// Called when the functionMenu has to be updated
void slotFunctionMenuUpdate();
/// Set Background Color for all viewers at once.
void slotSetGlobalBackgroundColor();
/// Set Background Color for one viewer.
void slotSetLocalBackgroundColor();
void slotSetContextBackgroundColor();
/// Set the active viewer to home position
void slotContextHomeView();
/// Set the viewer to home position
void slotGlobalHomeView();
/// Set the active viewers home position
void slotContextSetHomeView();
/// Set the home position for all viewers
void slotGlobalSetHomeView();
/// Change view on active viewer to view complete scene
void slotContextViewAll();
/// Change view on all viewers to view complete scene
void slotGlobalViewAll();
/// Toggle projection Mode of the active viewer.
void slotContextSwitchProjection();
/// Toggle projection Mode of all viewers to perspective projection
void slotGlobalPerspectiveProjection();
/// Toggle projection Mode of all viewers to orthographic projection
void slotGlobalOrthographicProjection();
/// Set the animation Mode for all viewers
void slotGlobalChangeAnimation(bool _animation);
/// Set the animation Mode for active viewer
void slotLocalChangeAnimation(bool _animation);
/// Set Backface culling for all viewers
void slotGlobalChangeBackFaceCulling(bool _backFaceCulling);
/// Set Backface culling for active viewer
void slotLocalChangeBackFaceCulling(bool _backFaceCulling);
/// Set two sided lighting for all viewers
void slotGlobalChangeTwoSidedLighting(bool _lighting);
/// Set two sided lighting for active viewer
void slotLocalChangeTwoSidedLighting(bool _lighting);
private :
bool stereoActive_;
......
This diff is collapsed.
......@@ -68,14 +68,6 @@ void CoreWidget::slotToggleStereoMode()
examiner_widgets_[i]->setStereoMode(stereoActive_);
}
void CoreWidget::slotProjectionModeChanged( bool _ortho ) {
if ( !_ortho )
projectionButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"perspective.png") );
else
projectionButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"orthogonal.png") );
}
void CoreWidget::slotActionModeChanged( Viewer::ActionMode _mode ) {
moveButton_->setDown(false);
lightButton_->setDown(false);
......@@ -113,24 +105,6 @@ void CoreWidget::slotActionModeChanged( Viewer::ActionMode _mode ) {
}
}
void CoreWidget::slotFunctionMenuUpdate() {
std::cerr << "DF" <<std::endl;
if ( examiner_widgets_.empty() )
return;
QList< QAction *> allActions = functionMenu_->actions();
for ( int i = 0 ; i < allActions.size(); ++i ) {
if ( allActions[i]->text() == "Animation" )
allActions[i]->setChecked(PluginFunctions::viewerProperties().animation());
else if ( allActions[i]->text() == "Backface Culling" )
allActions[i]->setChecked(PluginFunctions::viewerProperties().backFaceCulling());
else if ( allActions[i]->text() == "Two-sided Lighting" )
allActions[i]->setChecked(PluginFunctions::viewerProperties().twoSidedLighting());
}
}
void CoreWidget::slotSetGlobalBackgroundColor() {
ACG::Vec4f bc = PluginFunctions::viewerProperties().backgroundColor() * 255.0;
......@@ -148,7 +122,7 @@ void CoreWidget::slotSetGlobalBackgroundColor() {
}
void CoreWidget::slotSetLocalBackgroundColor() {
void CoreWidget::slotSetContextBackgroundColor() {
ACG::Vec4f bc = PluginFunctions::viewerProperties().backgroundColor() * 255.0;
QColor backCol((int)bc[0], (int)bc[1], (int)bc[2], (int)bc[3]);
......@@ -162,6 +136,108 @@ void CoreWidget::slotSetLocalBackgroundColor() {
}
/// Set the viewer to home position
void CoreWidget::slotContextHomeView() {
examiner_widgets_[PluginFunctions::activeExaminer()]->home();
}
/// Set the viewer to home position
void CoreWidget::slotGlobalHomeView() {
for ( int i = 0 ; i < PluginFunctions::viewers() ; ++i )
examiner_widgets_[i]->home();
}
/// Set the viewers home position
void CoreWidget::slotContextSetHomeView() {
examiner_widgets_[PluginFunctions::activeExaminer()]->setHome();
}
/// Set the home position for all viewers
void CoreWidget::slotGlobalSetHomeView() {
for ( int i = 0 ; i < PluginFunctions::viewers() ; ++i )
examiner_widgets_[i]->setHome();
}
/// Change view on active viewer to view complete scene
void CoreWidget::slotContextViewAll() {
examiner_widgets_[PluginFunctions::activeExaminer()]->viewAll();
}
/// Change view on all viewers to view complete scene
void CoreWidget::slotGlobalViewAll() {
for ( int i = 0 ; i < PluginFunctions::viewers() ; ++i )
examiner_widgets_[i]->viewAll();
}
/// Toggle projection Mode of the active viewer
void CoreWidget::slotContextSwitchProjection() {
examiner_widgets_[PluginFunctions::activeExaminer()]->toggleProjectionMode();
}
/// Toggle projection Mode of all viewers to perspective projection
void CoreWidget::slotGlobalPerspectiveProjection() {
for ( int i = 0 ; i < PluginFunctions::viewers() ; ++i )
examiner_widgets_[i]->perspectiveProjection();
}
/// Toggle projection Mode of all viewers to orthogonal projection
void CoreWidget::slotGlobalOrthographicProjection() {
for ( int i = 0 ; i < PluginFunctions::viewers() ; ++i )
examiner_widgets_[i]->orthographicProjection();
}
/// Set the animation Mode for all viewers
void CoreWidget::slotGlobalChangeAnimation(bool _animation){
for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
PluginFunctions::viewerProperties(i).animation(_animation);
}
/// Set the animation Mode for active viewer
void CoreWidget::slotLocalChangeAnimation(bool _animation){
PluginFunctions::viewerProperties().animation(_animation);
}
/// Set Backface culling for all viewers
void CoreWidget::slotGlobalChangeBackFaceCulling(bool _backFaceCulling){
for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
PluginFunctions::viewerProperties(i).backFaceCulling(_backFaceCulling);
}
/// Set Backface culling for active viewer
void CoreWidget::slotLocalChangeBackFaceCulling(bool _backFaceCulling){
PluginFunctions::viewerProperties().backFaceCulling(_backFaceCulling);
}
/// Set two sided lighting for all viewers
void CoreWidget::slotGlobalChangeTwoSidedLighting(bool _lighting) {
for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
PluginFunctions::viewerProperties(i).twoSidedLighting(_lighting);
}
/// Set two sided lighting for active viewer
void CoreWidget::slotLocalChangeTwoSidedLighting(bool _lighting) {
PluginFunctions::viewerProperties().twoSidedLighting(_lighting);
}
void CoreWidget::slotSnapshot() {
examiner_widgets_[PluginFunctions::activeExaminer()]->snapshot();
}
void CoreWidget::slotPasteView( ) {
examiner_widgets_[PluginFunctions::activeExaminer()]->actionPasteView();
}
void CoreWidget::slotCopyView( ) {
examiner_widgets_[PluginFunctions::activeExaminer()]->actionCopyView();
}
//=============================================================================
......@@ -193,6 +193,8 @@ glViewer::glViewer( QtGLGraphicsScene* _scene,
slotPropertiesUpdated();
setAcceptDrops(true);
setHome();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment