00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 #include "CoreWidget.hh"
00057 #include <OpenFlipper/common/GlobalOptions.hh>
00058 #include <OpenFlipper/BasePlugin/PluginFunctions.hh>
00059 #include <OpenFlipper/BasePlugin/MenuInterface.hh>
00060
00061
00062
00063
00064
00065 void CoreWidget::slotAddMenubarAction( QAction* _action , QString _name ) {
00066
00067 if (!menus_.contains (_name))
00068 return;
00069
00070 if (_name == FILEMENU)
00071 {
00072 fileMenu_->insertSeparator(fileMenuEnd_);
00073 fileMenu_->insertAction( fileMenuEnd_ , _action );
00074 }
00075 else
00076 menus_[_name]->addAction (_action);
00077 }
00078
00079
00080
00081 void CoreWidget::slotGetMenubarMenu (QString _name, QMenu *& _menu, bool _create)
00082 {
00083 if (menus_.contains (_name))
00084 _menu = menus_[_name];
00085 else if (_create)
00086 {
00087 _menu = new QMenu(_name);
00088 menus_[_name] = _menu;
00089 menuBar()->insertAction(helpMenu_->menuAction() ,_menu->menuAction ());
00090 } else
00091 _menu = NULL;
00092 }
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117 void CoreWidget::setupMenuBar()
00118 {
00119
00120
00121
00122
00123
00124
00125 fileMenu_ = new QMenu( FILEMENU );
00126 menuBar()->addMenu(fileMenu_ );
00127 menus_[tr("File")] = fileMenu_;
00128
00129
00130 QAction* AC_clear_all = new QAction(tr("Clear All"), this);;
00131 AC_clear_all->setStatusTip(tr("Clear all Objects"));
00132 AC_clear_all->setWhatsThis(tr("Close all open Objects"));
00133 AC_clear_all->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"edit-clear.png"));
00134 connect(AC_clear_all, SIGNAL(triggered()), this, SIGNAL(clearAll()));
00135 fileMenu_->addAction(AC_clear_all);
00136
00137 fileMenu_->addSeparator();
00138
00139
00140 QAction* AC_Load = new QAction(tr("Load Object"), this);
00141 AC_Load->setStatusTip(tr("Load an object"));
00142 AC_Load->setWhatsThis(tr("Load a new object"));
00143 AC_Load->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"document-open.png"));
00144
00145 connect(AC_Load, SIGNAL(triggered()), this, SIGNAL(loadMenu()));
00146 fileMenu_->addAction(AC_Load);
00147
00148
00149 QAction* AC_AddEmpty = new QAction(tr("Add Empty Object"), this);
00150 AC_AddEmpty->setStatusTip(tr("Add an empty object"));
00151 AC_AddEmpty->setWhatsThis(tr("Creates a new empty object of a given type"));
00152 AC_AddEmpty->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"add-empty-object.png"));
00153 connect(AC_AddEmpty, SIGNAL(triggered()), this, SIGNAL(addEmptyObjectMenu()));
00154 fileMenu_->addAction(AC_AddEmpty);
00155
00156 fileMenu_->addSeparator();
00157
00158
00159 QAction* AC_Save = new QAction(tr("Save Object"), this);
00160
00161 AC_Save->setStatusTip(tr("Save currently selected objects"));
00162 AC_Save->setWhatsThis(tr("Saves all currently selected objects"));
00163 AC_Save->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"document-save.png"));
00164 connect(AC_Save, SIGNAL(triggered()), this, SIGNAL(saveMenu()));
00165 fileMenu_->addAction(AC_Save);
00166
00167
00168 QAction* AC_Save_to = new QAction(tr("Save Object To"), this);
00169 AC_Save_to->setStatusTip(tr("Save current Object(s) To"));
00170 AC_Save_to->setWhatsThis(tr("Saves all currently selected objects under a new name"));
00171 AC_Save_to->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"document-save-as.png"));
00172 connect(AC_Save_to, SIGNAL(triggered()), this, SIGNAL(saveToMenu()));
00173 fileMenu_->addAction(AC_Save_to);
00174
00175 fileMenu_->addSeparator();
00176
00177
00178 QAction* AC_load_ini = new QAction(tr("Load Settings"), this);
00179 AC_load_ini->setStatusTip(tr("Load Settings from INI file"));
00180 AC_load_ini->setWhatsThis(tr("Load a previous settings from file (objects,colors,...)"));
00181 AC_load_ini->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"load-settings.png"));
00182 connect(AC_load_ini, SIGNAL(triggered()), this, SIGNAL(loadIniMenu()));
00183 fileMenu_->addAction(AC_load_ini);
00184
00185
00186 QAction* AC_save_ini = new QAction(tr("Save Settings"), this);
00187 AC_save_ini->setStatusTip(tr("Save current settings to INI file"));
00188 AC_save_ini->setWhatsThis(tr("Save settings to file (objects,colors,...)"));
00189 AC_save_ini->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"save-settings.png"));
00190 connect(AC_save_ini, SIGNAL(triggered()), this, SIGNAL(saveIniMenu()));
00191 fileMenu_->addAction(AC_save_ini);
00192
00193 fileMenu_->addSeparator();
00194
00195
00196 QAction* AC_Options = new QAction(tr("Options"), this);
00197 AC_Options->setStatusTip(tr("Edit OpenFlipper Options"));
00198 AC_Options->setWhatsThis(tr("Edit OpenFlipper Options"));
00199 AC_Options->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"options.png"));
00200 connect(AC_Options, SIGNAL(triggered()), this, SLOT(showOptionsWidget()));
00201 fileMenu_->addAction(AC_Options);
00202
00203
00204 fileMenuEnd_ = fileMenu_->addSeparator();
00205
00206
00207 recentFilesMenu_ = new QMenu(tr("Recent Files"));
00208 recentFilesMenu_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"document-open-recent.png"));
00209 recentFilesMenu_->setWhatsThis(tr("Open recent files"));
00210 connect(recentFilesMenu_,SIGNAL(triggered(QAction*)),this,SIGNAL(recentOpen(QAction*)));
00211 fileMenu_->addMenu(recentFilesMenu_);
00212
00213 fileMenu_->addSeparator();
00214
00215
00216 QAction* AC_exit = new QAction(tr("Exit"), this);;
00217 AC_exit->setShortcut (Qt::CTRL + Qt::Key_Q);
00218 AC_exit->setStatusTip(tr("Exit Application"));
00219 recentFilesMenu_->setWhatsThis(tr("Close OpenFlipper"));
00220 AC_exit->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"application-exit.png"));
00221 connect(AC_exit, SIGNAL(triggered()), this, SIGNAL(exit()));
00222 fileMenu_->addAction(AC_exit);
00223
00224
00225
00226
00227
00228 viewMenu_ = new QMenu( VIEWMENU );
00229 menuBar()->addMenu(viewMenu_ );
00230 menus_[tr("View")] = viewMenu_;
00231
00232 slotUpdateGlobalDrawMenu();
00233 viewMenu_->addMenu(globalDrawMenu_);
00234
00235
00236
00237
00238
00239 QMenu* renderingOptionsMenu = new QMenu(tr("Rendering Options"),viewMenu_);
00240 renderingOptionsMenu->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"core_renderingOptions.png") );
00241 viewMenu_->addMenu(renderingOptionsMenu);
00242
00243 orthogonalProjectionAction_ = new QAction( tr("Switch Viewers to Orthogonal Projection"), renderingOptionsMenu );;
00244 orthogonalProjectionAction_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"orthogonal.png") );
00245 orthogonalProjectionAction_->setCheckable( false );
00246 orthogonalProjectionAction_->setToolTip( tr("Switch to orthogonal projection mode."));
00247 orthogonalProjectionAction_->setWhatsThis( tr("Switch projection mode<br><br>"
00248 "Switch to <b>orthogonal</b> projection mode."));
00249 connect( orthogonalProjectionAction_,SIGNAL( triggered() ), this, SLOT( slotGlobalOrthographicProjection() ) );
00250 renderingOptionsMenu->addAction( orthogonalProjectionAction_);
00251
00252
00253
00254 globalAnimationAction_ = renderingOptionsMenu->addAction(tr("Animation"));
00255 globalAnimationAction_->setCheckable( true );
00256 globalAnimationAction_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"animation.png") );
00257 connect(globalAnimationAction_, SIGNAL(triggered(bool)), this , SLOT( slotGlobalChangeAnimation(bool) ) );
00258
00259
00260
00261 globalBackfaceCullingAction_ = renderingOptionsMenu->addAction(tr("Backface Culling"));
00262 globalBackfaceCullingAction_->setCheckable( true );
00263 globalBackfaceCullingAction_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"backFaceCulling.png") );
00264 connect(globalBackfaceCullingAction_, SIGNAL(triggered(bool)), this , SLOT( slotGlobalChangeBackFaceCulling(bool) ) );
00265
00266
00267
00268 globalTwosidedLightingAction_ = renderingOptionsMenu->addAction(tr("Two-sided Lighting"));
00269 globalTwosidedLightingAction_->setCheckable( true );
00270 globalTwosidedLightingAction_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"twosidedLighting.png") );
00271 connect(globalTwosidedLightingAction_, SIGNAL(triggered(bool)), this , SLOT( slotGlobalChangeTwoSidedLighting(bool) ) );
00272
00273
00274
00275 globalMultisamplingAction_ = renderingOptionsMenu->addAction(tr("Multisampling"));
00276 globalMultisamplingAction_->setCheckable( true );
00277
00278
00279 connect(globalMultisamplingAction_, SIGNAL(triggered(bool)), this , SLOT( slotGlobalChangeMultisampling(bool)) );
00280
00281
00282
00283
00284
00285 viewMenu_->addSeparator();
00286
00287 QAction* navigationSwitchAction = new QAction( tr("First-person Navigation"), viewMenu_ );
00288 navigationSwitchAction->setCheckable( true );
00289 navigationSwitchAction->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"core_firstPersonMode.png") );
00290 navigationSwitchAction->setStatusTip( tr("Switch between normal and first-person navigation mode."));
00291 navigationSwitchAction->setWhatsThis( tr("Switch between normal and first-person navigation mode."));
00292 navigationSwitchAction->setChecked( false );
00293
00294 connect( navigationSwitchAction, SIGNAL( toggled(bool) ), this, SLOT( slotSwitchNavigation(bool) ) );
00295 viewMenu_->addAction( navigationSwitchAction);
00296
00297 viewMenu_->addSeparator();
00298
00299 connect( viewMenu_,SIGNAL( aboutToShow() ), this, SLOT( slotViewMenuAboutToShow() ) );
00300
00301 QAction* homeAction = new QAction(tr("Restore Home View"),viewMenu_);
00302 homeAction->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"go-home.png") );
00303 homeAction->setCheckable( false );
00304 homeAction->setStatusTip( tr("Restore <b>home</b> view."));
00305 homeAction->setWhatsThis( tr("Restore home view<br><br>"
00306 "Resets the view to the home view"));
00307 viewMenu_->addAction( homeAction );
00308 connect( homeAction,SIGNAL( triggered() ), this, SLOT( slotGlobalHomeView() ) );
00309
00310
00311 QAction* setHomeAction = new QAction( tr("Set Home View") , viewMenu_ );
00312 setHomeAction->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"set-home.png") );
00313 setHomeAction->setCheckable( false );
00314 setHomeAction->setStatusTip( tr("Set <b>home</b> view"));
00315 setHomeAction->setWhatsThis( tr("Store home view<br><br>"
00316 "Stores the current view as the home view"));
00317 viewMenu_->addAction( setHomeAction);
00318 connect( setHomeAction,SIGNAL( triggered() ), this, SLOT( slotGlobalSetHomeView() ) );
00319
00320 QAction* viewAllAction = new QAction( tr("View all"), viewMenu_ );
00321 viewAllAction->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"viewall.png") );
00322 viewAllAction->setCheckable( false );
00323 viewAllAction->setStatusTip( tr("View all.") );
00324 viewAllAction->setWhatsThis( tr("View all<br><br>"
00325 "Move the objects in the scene so that"
00326 " the whole scene is visible."));
00327 connect( viewAllAction,SIGNAL( triggered() ), this, SLOT( slotGlobalViewAll() ) );
00328 viewMenu_->addAction( viewAllAction);
00329
00330 viewMenu_->addSeparator();
00331
00332 QAction* snapShotAction = new QAction( tr("Viewer Snapshot"), viewMenu_ );
00333 snapShotAction->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"viewerSnapshot.png") );
00334 snapShotAction->setCheckable( false );
00335 snapShotAction->setStatusTip( tr("Take a snapshot from all viewers."));
00336 snapShotAction->setWhatsThis( tr("Viewer Snapshot<br><br>"
00337 "Take a snapshot of all viewers at once."));
00338 connect( snapShotAction,SIGNAL( triggered() ), this, SLOT( viewerSnapshotDialog() ) );
00339 viewMenu_->addAction( snapShotAction);
00340
00341 QAction* appSnapShotAction = new QAction( tr("Application Snapshot"), viewMenu_ );
00342 appSnapShotAction->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"snapshot.png") );
00343 appSnapShotAction->setCheckable( false );
00344 appSnapShotAction->setStatusTip( tr("Take a snapshot from OpenFlipper."));
00345 appSnapShotAction->setWhatsThis( tr("Snapshot<br><br>"
00346 "Take a snapshot from OpenFlipper."));
00347 connect( appSnapShotAction,SIGNAL( triggered() ), this, SLOT( applicationSnapshotDialog() ) );
00348 viewMenu_->addAction( appSnapShotAction);
00349
00350 perspectiveProjectionAction_ = new QAction( tr("Switch Viewers to Perspective Projection"), viewMenu_ );;
00351 perspectiveProjectionAction_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"perspective.png") );
00352 perspectiveProjectionAction_->setCheckable( false );
00353 perspectiveProjectionAction_->setStatusTip( tr("Switch to perspective projection mode."));
00354 perspectiveProjectionAction_->setWhatsThis( tr("Switch projection mode<br><br>"
00355 "Switch to <b>perspective</b> projection mode."));
00356 connect( perspectiveProjectionAction_,SIGNAL( triggered() ), this, SLOT( slotGlobalPerspectiveProjection() ) );
00357 viewMenu_->addAction( perspectiveProjectionAction_);
00358
00359 viewMenu_->addSeparator();
00360
00361 QAction* wheelSwitchAction = new QAction( tr("Show / hide wheels"), viewMenu_ );
00362 wheelSwitchAction->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"core_wheels.png") );
00363 wheelSwitchAction->setCheckable( true );
00364 wheelSwitchAction->setStatusTip( tr("Show / hide navigation wheels in viewer widget."));
00365 wheelSwitchAction->setWhatsThis( tr("Show / hide navigation wheels in viewer widget.<br><br>"
00366 " These wheels appear in the corners of the viewports. "
00367 " Use wheels to rotate and scale scene."));
00368
00369 if(OpenFlipperSettings().value("Core/Gui/glViewer/showControlWheels").toBool() )
00370 wheelSwitchAction->setChecked(true);
00371
00372 connect( wheelSwitchAction,SIGNAL( toggled(bool) ), this, SLOT( slotSwitchWheels(bool) ) );
00373 viewMenu_->addAction( wheelSwitchAction);
00374
00375 QAction* coordSys = viewMenu_->addAction(tr("Coordinate Systems"));
00376 coordSys->setCheckable(true);
00377 coordSys->setChecked(true);
00378 coordSys->setStatusTip(tr("Toggle visibility of the coordinate systems"));
00379 coordSys->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"coordsys.png") );
00380 connect(coordSys, SIGNAL(triggered(bool)), this, SLOT( slotCoordSysVisibility(bool) ) );
00381
00382 viewMenu_->addSeparator();
00383
00384 QAction* setGlobalBackgroundColor = new QAction(tr("Set Background Color"), this);;
00385 setGlobalBackgroundColor->setToolTip(tr("Set Background Color for all viewers"));
00386 setGlobalBackgroundColor->setStatusTip(tr("Set Background Color for all viewers"));
00387 setGlobalBackgroundColor->setWhatsThis(tr("Set Background Color for all viewers"));
00388 setGlobalBackgroundColor->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"BackgroundColor.png") );
00389 connect(setGlobalBackgroundColor, SIGNAL(triggered()), this, SLOT(slotSetGlobalBackgroundColor()));
00390 viewMenu_->addAction(setGlobalBackgroundColor);
00391
00392
00393
00394
00395
00396 toolsMenu_ = new QMenu( TOOLSMENU );
00397 menuBar()->addMenu(toolsMenu_ );
00398 menus_[tr("Tools")] = toolsMenu_;
00399
00400 QAction* sceneGraphAction = new QAction( tr("Show SceneGraph ") ,toolsMenu_ );
00401 sceneGraphAction->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"scenegraph.png") );
00402 sceneGraphAction->setCheckable( false );
00403 sceneGraphAction->setToolTip( tr("Show scene graph viewer.") );
00404 sceneGraphAction->setWhatsThis( tr("Toggle scene graph viewer<br><br>"
00405 "The scene graph viewer enables you to examine the "
00406 "displayed scene graph and to modify certain nodes.<br><br>" ) );
00407 QObject::connect( sceneGraphAction, SIGNAL( triggered() ),
00408 this, SLOT( slotShowSceneGraphDialog() ) );
00409 toolsMenu_->addAction( sceneGraphAction);
00410
00411 toolsMenu_->addSeparator();
00412
00413 QAction* startVideoCaptureAction = new QAction( tr("Start Video Capture ") ,toolsMenu_ );
00414 startVideoCaptureAction->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"recordVideo.png") );
00415 startVideoCaptureAction->setCheckable( false );
00416 startVideoCaptureAction->setToolTip( tr("Start video capturing.") );
00417 startVideoCaptureAction->setWhatsThis( tr("Start to capture a video sequence of the user actions")) ;
00418 toolsMenu_->addAction( startVideoCaptureAction );
00419 connect(startVideoCaptureAction, SIGNAL(triggered()), this, SLOT(startVideoCaptureDialog()) );
00420
00421 QAction* stopVideoCaptureAction = new QAction( tr("Stop Video Capture ") ,toolsMenu_ );
00422 stopVideoCaptureAction->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"stopVideoCapture.png") );
00423 stopVideoCaptureAction->setCheckable( false );
00424 stopVideoCaptureAction->setToolTip( tr("Stop video capturing." ));
00425 stopVideoCaptureAction->setWhatsThis( tr("Stop Video capturing" ));
00426
00427 toolsMenu_->addAction( stopVideoCaptureAction);
00428 connect(stopVideoCaptureAction, SIGNAL(triggered()), this, SIGNAL(stopVideoCapture()) );
00429
00430 toolsMenu_->addSeparator();
00431
00432
00433 QAction* AC_Plugins = new QAction(tr("Plugins"), this);
00434 AC_Plugins->setStatusTip(tr("Show loaded plugins"));
00435 AC_Plugins->setWhatsThis(tr("Show loaded plugins"));
00436 AC_Plugins->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"network-connect.png"));
00437 connect(AC_Plugins, SIGNAL(triggered()), this, SIGNAL(showPlugins()));
00438 toolsMenu_->addAction(AC_Plugins);
00439
00440
00441
00442
00443 helpMenu_ = new QMenu(tr("Help"));
00444 menuBar()->addMenu(helpMenu_);
00445 menus_[tr("Help")] = helpMenu_;
00446
00447
00448 QAction* AC_HelpBrowser = new QAction(tr("Help"), this);
00449 AC_HelpBrowser->setStatusTip(tr("Open Help Browser with Documentation"));
00450 AC_HelpBrowser->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"help-browser.png"));
00451 AC_HelpBrowser->setWhatsThis(tr("Open the <b>Help Browser</b>"));
00452 connect(AC_HelpBrowser, SIGNAL(triggered()), this, SLOT(showHelpBrowser()));
00453 helpMenu_->addAction(AC_HelpBrowser);
00454
00455
00456 QAction* AC_Whats_this = QWhatsThis::createAction ( this );
00457 AC_Whats_this->setStatusTip(tr("Enter What's this Mode"));
00458 AC_Whats_this->setWhatsThis(tr("Get information about a specific Button/Widget/..."));
00459 helpMenu_->addAction(AC_Whats_this);
00460
00461 helpMenu_->addSeparator();
00462
00463
00464 QAction* AC_About = new QAction(tr("About"), this);
00465 AC_About->setStatusTip(tr("About OpenFlipper"));
00466 AC_About->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"help-about.png"));
00467 AC_About->setWhatsThis(tr("This entry shows information about <b>OpenFlipper</b>"));
00468 connect(AC_About, SIGNAL(triggered()), this, SLOT(showAboutWidget()));
00469 helpMenu_->addAction(AC_About);
00470
00471
00472 mainToolbar_->addAction(AC_Load);
00473 mainToolbar_->addAction(AC_AddEmpty);
00474 mainToolbar_->addSeparator();
00475 mainToolbar_->addAction(AC_Save);
00476 mainToolbar_->addAction(AC_Save_to);
00477 mainToolbar_->addSeparator();
00478 mainToolbar_->addAction(AC_load_ini);
00479 mainToolbar_->addAction(AC_save_ini);
00480 }
00481
00482
00483 void CoreWidget::slotViewMenuAboutToShow() {
00484
00485 uint enabledCount = 0;
00486 uint disabledCount = 0;
00487
00488 for ( int i = 0 ; i< PluginFunctions::viewers(); ++i ) {
00489 if ( PluginFunctions::viewerProperties(i).animation() )
00490 enabledCount++;
00491 else
00492 disabledCount++;
00493 }
00494
00495 if ( enabledCount != 0 && disabledCount != 0 ) {
00496 globalAnimationAction_->setChecked(Qt::PartiallyChecked);
00497 globalAnimationAction_->setToolTip(tr("Disable animation for all viewers"));
00498 globalAnimationAction_->setStatusTip(tr("Disable animation for all viewers"));
00499 globalAnimationAction_->setText(tr("Disable animation"));
00500 } else if ( enabledCount == 4 ) {
00501 globalAnimationAction_->setChecked( Qt::Checked );
00502 globalAnimationAction_->setToolTip(tr("Disable animation for all viewers"));
00503 globalAnimationAction_->setStatusTip(tr("Disable animation for all viewers"));
00504 globalAnimationAction_->setText(tr("Disable animation"));
00505 } else {
00506 globalAnimationAction_->setChecked( Qt::Unchecked );
00507 globalAnimationAction_->setToolTip(tr("Enable animation for all viewers"));
00508 globalAnimationAction_->setStatusTip(tr("Enable animation for all viewers"));
00509 globalAnimationAction_->setText(tr("Enable animation"));
00510 }
00511
00512
00513
00514 enabledCount = 0;
00515 disabledCount = 0;
00516
00517 for ( int i = 0 ; i< PluginFunctions::viewers(); ++i ) {
00518 if ( PluginFunctions::viewerProperties(i).backFaceCulling() )
00519 enabledCount++;
00520 else
00521 disabledCount++;
00522 }
00523
00524 if ( enabledCount != 0 && disabledCount != 0 ) {
00525 globalBackfaceCullingAction_->setChecked(Qt::PartiallyChecked);
00526 globalBackfaceCullingAction_->setToolTip(tr("Disable backface culling for all viewers"));
00527 globalBackfaceCullingAction_->setStatusTip(tr("Disable backface culling for all viewers"));
00528 globalBackfaceCullingAction_->setText(tr("Disable backface culling"));
00529 } else if ( enabledCount == 4 ) {
00530 globalBackfaceCullingAction_->setChecked( Qt::Checked );
00531 globalBackfaceCullingAction_->setToolTip(tr("Disable backface culling for all viewers"));
00532 globalBackfaceCullingAction_->setStatusTip(tr("Disable backface culling for all viewers"));
00533 globalBackfaceCullingAction_->setText(tr("Disable backface culling"));
00534 } else {
00535 globalBackfaceCullingAction_->setChecked( Qt::Unchecked );
00536 globalBackfaceCullingAction_->setToolTip(tr("Enable backface culling for all viewers"));
00537 globalBackfaceCullingAction_->setStatusTip(tr("Enable backface culling for all viewers"));
00538 globalBackfaceCullingAction_->setText(tr("Enable backface culling"));
00539 }
00540
00541
00542
00543 enabledCount = 0;
00544 disabledCount = 0;
00545
00546 for ( int i = 0 ; i< PluginFunctions::viewers(); ++i ) {
00547 if ( PluginFunctions::viewerProperties(i).twoSidedLighting() )
00548 enabledCount++;
00549 else
00550 disabledCount++;
00551 }
00552
00553 if ( enabledCount != 0 && disabledCount != 0 ) {
00554 globalTwosidedLightingAction_->setChecked(Qt::PartiallyChecked);
00555 globalTwosidedLightingAction_->setToolTip(tr("Disable two-sided lighting for all viewers"));
00556 globalTwosidedLightingAction_->setStatusTip(tr("Disable two-sided lighting for all viewers"));
00557 globalTwosidedLightingAction_->setText(tr("Disable two-sided lighting"));
00558 } else if ( enabledCount == 4 ) {
00559 globalTwosidedLightingAction_->setChecked( Qt::Checked );
00560 globalTwosidedLightingAction_->setToolTip(tr("Disable two-sided lighting for all viewers"));
00561 globalTwosidedLightingAction_->setStatusTip(tr("Disable two-sided lighting for all viewers"));
00562 globalTwosidedLightingAction_->setText(tr("Disable two-sided lighting"));
00563 } else {
00564 globalTwosidedLightingAction_->setChecked( Qt::Unchecked );
00565 globalTwosidedLightingAction_->setToolTip(tr("Enable two-sided lighting for all viewers"));
00566 globalTwosidedLightingAction_->setStatusTip(tr("Enable two-sided lighting for all viewers"));
00567 globalTwosidedLightingAction_->setText(tr("Enable two-sided lighting"));
00568 }
00569
00570
00571
00572 enabledCount = 0;
00573 disabledCount = 0;
00574
00575
00576 for ( int i = 0 ; i< PluginFunctions::viewers(); ++i ) {
00577 if ( PluginFunctions::viewerProperties(i).multisampling() )
00578 enabledCount++;
00579 else
00580 disabledCount++;
00581 }
00582
00583 if ( enabledCount != 0 && disabledCount != 0 ) {
00584 globalMultisamplingAction_->setChecked(Qt::PartiallyChecked);
00585 globalMultisamplingAction_->setToolTip(tr("Disable Multisampling for all viewers"));
00586 globalMultisamplingAction_->setStatusTip(tr("Disable Multisampling for all viewers"));
00587 globalMultisamplingAction_->setText(tr("Disable Multisampling"));
00588 } else if ( enabledCount == 4 ) {
00589 globalMultisamplingAction_->setChecked( Qt::Checked );
00590 globalMultisamplingAction_->setToolTip(tr("Disable Multisampling for all viewers"));
00591 globalMultisamplingAction_->setStatusTip(tr("Disable Multisampling for all viewers"));
00592 globalMultisamplingAction_->setText(tr("Disable Multisampling"));
00593 } else {
00594 globalMultisamplingAction_->setChecked( Qt::Unchecked );
00595 globalMultisamplingAction_->setToolTip(tr("Enable Multisampling for all viewers"));
00596 globalMultisamplingAction_->setStatusTip(tr("Enable Multisampling for all viewers"));
00597 globalMultisamplingAction_->setText(tr("Enable Multisampling"));
00598 }
00599
00600 uint perspectiveCount = 0;
00601 uint orthogonalCount = 0;
00602
00603 for ( int i = 0 ; i < PluginFunctions::viewers() ; ++i ) {
00604 if ( examiner_widgets_[ i ]->projectionMode() == glViewer::PERSPECTIVE_PROJECTION )
00605 perspectiveCount++;
00606 else
00607 orthogonalCount++;
00608 }
00609
00610 if ( perspectiveCount == 4 )
00611 perspectiveProjectionAction_->setVisible(false);
00612 else
00613 perspectiveProjectionAction_->setVisible(true);
00614
00615 if ( orthogonalCount == 4 )
00616 orthogonalProjectionAction_->setVisible(false);
00617 else
00618 orthogonalProjectionAction_->setVisible(true);
00619
00620 }
00621
00622 void CoreWidget::slotUpdateGlobalDrawMenu() {
00623 if ( drawGroup_ ) {
00624
00625 disconnect( drawGroup_ , SIGNAL( triggered( QAction * ) ),
00626 this , SLOT( slotGlobalDrawMenu( QAction * ) ) );
00627 delete( drawGroup_ );
00628 drawGroup_ = 0;
00629
00630 }
00631
00632
00633 drawGroup_ = new QActionGroup( this );
00634 drawGroup_->setExclusive( false );
00635
00636 connect( drawGroup_ , SIGNAL( triggered( QAction * ) ),
00637 this , SLOT( slotGlobalDrawMenu( QAction * ) ) );
00638
00639 if ( !globalDrawMenu_ ) {
00640
00641 QIcon icon;
00642 icon.addFile(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"drawModes.png");
00643 globalDrawMenu_ = new QMenu(tr("Set Global DrawMode"));
00644 globalDrawMenu_->setTearOffEnabled(true);
00645 globalDrawMenu_->setIcon(icon);
00646
00647 connect(globalDrawMenu_,SIGNAL(aboutToShow () ) , this, SLOT(slotUpdateGlobalDrawMenu() ) );
00648 }
00649
00650
00651
00652 ACG::SceneGraph::CollectDrawModesAction actionAvailable;
00653 ACG::SceneGraph::traverse( PluginFunctions::getRootNode() , actionAvailable);
00654 availableGlobalDrawModes_ = actionAvailable.drawModes();
00655
00656
00657
00658 activeDrawModes_ = PluginFunctions::drawMode(0);
00659 for ( int i = 1 ; i < PluginFunctions::viewers(); ++i )
00660 activeDrawModes_ &= PluginFunctions::drawMode(i);
00661
00662
00663 std::vector< ACG::SceneGraph::DrawModes::DrawMode > availDrawModeIds;
00664 availDrawModeIds = availableGlobalDrawModes_.getAtomicDrawModes() ;
00665
00666 globalDrawMenu_->clear();
00667
00668 for ( unsigned int i = 0; i < availDrawModeIds.size(); ++i )
00669 {
00670 ACG::SceneGraph::DrawModes::DrawMode id = availDrawModeIds[i];
00671 std::string descr = id.description();
00672
00673 QAction * action = new QAction( descr.c_str(), drawGroup_ );
00674 action->setCheckable( true );
00675 action->setChecked( activeDrawModes_.containsAtomicDrawMode(id) );
00676 }
00677
00678 globalDrawMenu_->addActions( drawGroup_->actions() );
00679
00680 }
00681
00682 void CoreWidget::slotGlobalDrawMenu(QAction * _action) {
00683
00684
00685
00686
00687 ACG::SceneGraph::DrawModes::DrawMode mode(ACG::SceneGraph::DrawModes::NONE);
00688 std::vector< ACG::SceneGraph::DrawModes::DrawMode > availDrawModeIds;
00689 availDrawModeIds = availableGlobalDrawModes_.getAtomicDrawModes();
00690 for ( unsigned int i = 0; i < availDrawModeIds.size(); ++i )
00691 {
00692 QString descr = QString( ( availDrawModeIds[i].description() ).c_str() );
00693
00694 if ( descr == _action->text() ) {
00695 mode = availDrawModeIds[i];
00696 break;
00697 }
00698 }
00699
00700 if ( qApp->keyboardModifiers() & Qt::ShiftModifier )
00701 activeDrawModes_ = ( activeDrawModes_ ^ mode);
00702 else
00703 activeDrawModes_ = mode ;
00704
00705 PluginFunctions::setDrawMode( activeDrawModes_ );
00706 slotUpdateGlobalDrawMenu();
00707 }
00708
00709
00710