Developer Documentation

MenuBar.cc
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4 * Copyright (c) 2001-2015, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openflipper.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenFlipper. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41
42
43
44
45
46 //=============================================================================
47 //
48 // CLASS CoreWidget - IMPLEMENTATION
49 //
50 //=============================================================================
51
52
53 //== INCLUDES =================================================================
54
55 #include "CoreWidget.hh"
56
57 //== IMPLEMENTATION ==========================================================
58
59
60
61 void CoreWidget::slotAddMenubarAction( QAction* _action , QString _name ) {
62
63 if (!menus_.contains(_name))
64 return;
65
66 if (_name == FILEMENU) {
67 fileMenu_->insertSeparator(fileMenuEnd_);
68 fileMenu_->insertAction(fileMenuEnd_, _action);
69 } else if (_name == ALGORITHMMENU) {
70
71 // We insert the algorithms menu if it is not available yet
72 if ( menuBar()->actions().contains(helpMenu_->menuAction()) )
73 menuBar()->insertMenu(helpMenu_->menuAction(), algorithmMenu_);
74
75 menus_[_name]->addAction(_action);
76 } else {
77 menus_[_name]->addAction(_action);
78 }
79
80 }
81
82 void CoreWidget::slotAddMenubarActions( std::vector<QAction*> _actions , QString _name ) {
83
84 if (!menus_.contains(_name))
85 return;
86
87 if (_name == FILEMENU) {
88 fileMenu_->insertSeparator(fileMenuEnd_);
89 for (std::vector<QAction*>::iterator it = _actions.begin(); it != _actions.end(); ++it )
90 fileMenu_->insertAction(fileMenuEnd_, *it);
91 } else if (_name == ALGORITHMMENU) {
92
93 // We insert the algorithms menu if it is not available yet
94 if ( menuBar()->actions().contains(helpMenu_->menuAction()) )
95 menuBar()->insertMenu(helpMenu_->menuAction(), algorithmMenu_);
96
97 for (std::vector<QAction*>::iterator it = _actions.begin(); it != _actions.end(); ++it )
98 menus_[_name]->addAction(*it);
99 } else {
100 for (std::vector<QAction*>::iterator it = _actions.begin(); it != _actions.end(); ++it )
101 menus_[_name]->addAction(*it);
102 }
103
104 }
105
106 //=============================================================================
107
108 void CoreWidget::slotGetMenubarMenu (QString _name, QMenu *& _menu, bool _create)
109 {
110 //if menu already exists, return it
111 if (menus_.contains (_name))
112 _menu = menus_[_name];
113 //otherwise create a new one
114 else if (_create)
115 {
116 _menu = new QMenu(_name);
117 menus_[_name] = _menu;
118 //we have to install an event filter to get event information (e.g. what this)
119 _menu->installEventFilter(this);
120 //guarantee that helpMenu_ is always at the end of all menus
121 menuBar()->insertAction(helpMenu_->menuAction() ,_menu->menuAction ());
122 }
123 //otherwise no menu was found
124 else
125 _menu = NULL;
126 }
127
128
129 //=============================================================================
130
131 bool CoreWidget::eventFilter(QObject *_obj, QEvent *_event)
132 {
133 //WhatsThisClicked event for hyperlinks in 'whats this' boxes
134 if( _event->type() == QEvent::WhatsThisClicked )
135 {
136 QWhatsThisClickedEvent *wtcEvent = static_cast<QWhatsThisClickedEvent*>(_event);
137 QWhatsThis::hideText();
138 this->showHelpBrowser(wtcEvent->href());
139 return true;
140 }
141
142 return _obj->event(_event);
143 }
144
145 //=============================================================================
146
147 void CoreWidget::showReducedMenuBar(bool reduced) {
148 for (std::vector<QAction*>::iterator it = extended_actions.begin(); it != extended_actions.end(); ++it) {
149 (*it)->setVisible(!reduced);
150 }
151 }
152
153 void CoreWidget::setupMenuBar()
154 {
155
156 // ======================================================================
157 // File Menu
158 // ======================================================================
159 fileMenu_ = new QMenu( FILEMENU );
160 menuBar()->addMenu( fileMenu_ );
161 menus_[tr("File")] = fileMenu_;
162
163 //Clear all
164 QAction* AC_clear_all = new QAction(tr("Clear All"), this);;
165 AC_clear_all->setStatusTip(tr("Clear all Objects"));
166 AC_clear_all->setWhatsThis(tr("Close all open Objects"));
167 AC_clear_all->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"edit-clear.png"));
168 connect(AC_clear_all, SIGNAL(triggered()), this, SIGNAL(clearAll()));
169 fileMenu_->addAction(AC_clear_all);
170
171 fileMenu_->addSeparator();
172
173 //Load object
174 QAction* AC_Load = new QAction(tr("Load Object"), this);
175 AC_Load->setStatusTip(tr("Load an object"));
176 AC_Load->setWhatsThis(tr("Load a new object"));
177 AC_Load->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"document-open.png"));
178 connect(AC_Load, SIGNAL(triggered()), this, SIGNAL(loadMenu()));
179 fileMenu_->addAction(AC_Load);
180
181 //Add empty object
182 QAction* AC_AddEmpty = new QAction(tr("Add Empty Object"), this);
183 AC_AddEmpty->setStatusTip(tr("Add an empty object"));
184 AC_AddEmpty->setWhatsThis(tr("Creates a new empty object of a given type"));
185 AC_AddEmpty->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"add-empty-object.png"));
186 connect(AC_AddEmpty, SIGNAL(triggered()), this, SIGNAL(addEmptyObjectMenu()));
187 fileMenu_->addAction(AC_AddEmpty);
188 extended_actions.push_back(AC_AddEmpty);
189 extended_actions.push_back(fileMenu_->addSeparator());
190
191 //Save object
192 QAction* AC_Save = new QAction(tr("Save Objects"), this);
193 // AC_Save->setShortcut (Qt::CTRL + Qt::Key_S);
194 AC_Save->setStatusTip(tr("Save current objects"));
195 AC_Save->setWhatsThis(tr("Save current objects"));
196 AC_Save->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"document-save.png"));
197 connect(AC_Save, SIGNAL(triggered()), this, SIGNAL(saveMenu()));
198 fileMenu_->addAction(AC_Save);
199 extended_actions.push_back(AC_Save);
200
201 //Save object to
202 QAction* AC_Save_to = new QAction(tr("Save Objects to"), this);
203 AC_Save_to->setStatusTip(tr("Save current Object(s) to"));
204 AC_Save_to->setWhatsThis(tr("Save current Object(s) under a new name"));
205 AC_Save_to->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"document-save-as.png"));
206 connect(AC_Save_to, SIGNAL(triggered()), this, SIGNAL(saveToMenu()));
207 fileMenu_->addAction(AC_Save_to);
208
209 extended_actions.push_back(fileMenu_->addSeparator());
210
211 //Load ini
212 QAction* AC_load_ini = new QAction(tr("Load Settings"), this);
213 AC_load_ini->setStatusTip(tr("Load Settings from INI file"));
214 AC_load_ini->setWhatsThis(tr("Load a previous settings from file (objects,colors,...)"));
215 AC_load_ini->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"load-settings.png"));
216 connect(AC_load_ini, SIGNAL(triggered()), this, SIGNAL(loadIniMenu()));
217 fileMenu_->addAction(AC_load_ini);
218 extended_actions.push_back(AC_load_ini);
219
220 //Save ini
221 QAction* AC_save_ini = new QAction(tr("Save Settings"), this);
222 AC_save_ini->setStatusTip(tr("Save current settings to INI file"));
223 AC_save_ini->setWhatsThis(tr("Save settings to file (objects,colors,...)"));
224 AC_save_ini->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"save-settings.png"));
225 connect(AC_save_ini, SIGNAL(triggered()), this, SIGNAL(saveIniMenu()));
226 fileMenu_->addAction(AC_save_ini);
227 extended_actions.push_back(AC_save_ini);
228
229 extended_actions.push_back(fileMenu_->addSeparator());
230
231 //Options
232 QAction* AC_Options = new QAction(tr("Options"), this);
233 AC_Options->setStatusTip(tr("Edit OpenFlipper Options"));
234 AC_Options->setWhatsThis(tr("Edit OpenFlipper Options"));
235 AC_Options->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"options.png"));
236 connect(AC_Options, SIGNAL(triggered()), this, SLOT(showOptionsWidget()));
237 fileMenu_->addAction(AC_Options);
238
239 //Remember entry of menu (required for adding File Menu entries from plugins)
240 fileMenuEnd_ = fileMenu_->addSeparator();
241
242 //Recent files
243 recentFilesMenu_ = new QMenu(tr("Recent Files"));
244 recentFilesMenu_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"document-open-recent.png"));
245 recentFilesMenu_->setWhatsThis(tr("Open recent files"));
246 connect(recentFilesMenu_,SIGNAL(triggered(QAction*)),this,SIGNAL(recentOpen(QAction*)));
247 fileMenu_->addMenu(recentFilesMenu_);
248
249 fileMenu_->addSeparator();
250
251 //Main Application exit menu entry
252 QAction* AC_exit = new QAction(tr("Exit"), this);;
253 AC_exit->setShortcut (Qt::CTRL + Qt::Key_Q);
254 AC_exit->setStatusTip(tr("Exit Application"));
255 recentFilesMenu_->setWhatsThis(tr("Close OpenFlipper"));
256 AC_exit->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"application-exit.png"));
257 connect(AC_exit, SIGNAL(triggered()), this, SIGNAL(exit()));
258 fileMenu_->addAction(AC_exit);
259
260 // ======================================================================
261 // View Menu
262 // ======================================================================
263 viewMenu_ = new QMenu( VIEWMENU );
264 menuBar()->addMenu(viewMenu_ );
265 menus_[tr("View")] = viewMenu_;
266
267 slotUpdateGlobalDrawMenu();
268 extended_actions.push_back(
269 viewMenu_->addMenu(globalDrawMenu_));
270
271 //============================================================================================================
272 // Rendering options Menu
273 //============================================================================================================
274
275 QMenu* renderingOptionsMenu = new QMenu(tr("Global Rendering Options"),viewMenu_);
276 renderingOptionsMenu->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"core_renderingOptions.png") );
277 extended_actions.push_back(
278 viewMenu_->addMenu(renderingOptionsMenu));
279
280 orthogonalProjectionAction_ = new QAction( tr("Switch Viewers to Orthogonal Projection"), renderingOptionsMenu );;
281 orthogonalProjectionAction_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"orthogonal.png") );
282 orthogonalProjectionAction_->setCheckable( false );
283 orthogonalProjectionAction_->setToolTip( tr("Switch to orthogonal projection mode."));
284 orthogonalProjectionAction_->setWhatsThis( tr("Switch projection mode<br><br>"
285 "Switch to <b>orthogonal</b> projection mode."));
286 connect( orthogonalProjectionAction_,SIGNAL( triggered() ), this, SLOT( slotGlobalOrthographicProjection() ) );
287 renderingOptionsMenu->addAction( orthogonalProjectionAction_);
288
289 perspectiveProjectionAction_ = new QAction( tr("Switch Viewers to Perspective Projection"), viewMenu_ );;
290 perspectiveProjectionAction_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"perspective.png") );
291 perspectiveProjectionAction_->setCheckable( false );
292 perspectiveProjectionAction_->setStatusTip( tr("Switch to perspective projection mode."));
293 perspectiveProjectionAction_->setWhatsThis( tr("Switch projection mode<br><br>"
294 "Switch to <b>perspective</b> projection mode."));
295 connect( perspectiveProjectionAction_,SIGNAL( triggered() ), this, SLOT( slotGlobalPerspectiveProjection() ) );
296 renderingOptionsMenu->addAction( perspectiveProjectionAction_);
297
298 // =====================
299
300 globalAnimationAction_ = renderingOptionsMenu->addAction(tr("Global Animation"));
301 globalAnimationAction_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"animation.png") );
302 connect(globalAnimationAction_, SIGNAL(triggered(bool)), this , SLOT( slotGlobalToggleAnimation() ) );
303
304 //======================
305
306 globalBackfaceCullingAction_ = renderingOptionsMenu->addAction(tr("Global Backface Culling"));
307 globalBackfaceCullingAction_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"backFaceCulling.png") );
308 connect(globalBackfaceCullingAction_, SIGNAL(triggered(bool)), this , SLOT( slotGlobalToggleBackFaceCulling() ) );
309
310 //======================
311
312 globalTwosidedLightingAction_ = renderingOptionsMenu->addAction(tr("Global Two-sided Lighting"));
313 globalTwosidedLightingAction_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"twosidedLighting.png") );
314 connect(globalTwosidedLightingAction_, SIGNAL(triggered(bool)), this , SLOT( slotGlobalToggleTwoSidedLighting() ) );
315
316 //======================
317
318 globalMultisamplingAction_ = renderingOptionsMenu->addAction(tr("Global Multisampling"));
319 globalMultisamplingAction_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"multisampling.png") );
320 connect(globalMultisamplingAction_, SIGNAL(triggered(bool)), this , SLOT( slotGlobalToggleMultisampling()) );
321 //======================
322
323 globalMipmappingAction_ = renderingOptionsMenu->addAction(tr("Global Mipmapping"));
324 globalMipmappingAction_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"mipmapping.png") );
325 connect(globalMipmappingAction_, SIGNAL(triggered(bool)), this , SLOT( slotGlobalToggleMipmapping()) );
326
327
328 //============================================================================================================
329 // Global renderer menu
330 //============================================================================================================
331
332 slotUpdateRendererMenu();
333
334 //============================================================================================================
335 // Other toplevel actions
336 //============================================================================================================
337
338 viewMenu_->addSeparator();
339
340 //============================================================================================================
341 // Post processor Manager
342 //============================================================================================================
343
344 QString iconPath = OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator();
345 QAction* showPostProcessorDialog = new QAction(tr("Show post processor manager"),this);
346 showPostProcessorDialog->setIcon(QIcon(iconPath+"postprocessors.png"));
347 connect(showPostProcessorDialog,SIGNAL(triggered()),this,SLOT(slotShowPostProcessorManager()));
348 viewMenu_->addAction(showPostProcessorDialog);
349
350 viewMenu_->addSeparator();
351
352 //====================================================================================================
353
354
355 QAction* navigationSwitchAction = new QAction( tr("First-person Navigation"), viewMenu_ );
356 navigationSwitchAction->setCheckable( true );
357 navigationSwitchAction->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"core_firstPersonMode.png") );
358 navigationSwitchAction->setStatusTip( tr("Switch between normal and first-person navigation mode."));
359 navigationSwitchAction->setWhatsThis( tr("Switch between normal and first-person navigation mode."));
360 navigationSwitchAction->setChecked( false );
361
362 connect( navigationSwitchAction, SIGNAL( toggled(bool) ), this, SLOT( slotSwitchNavigation(bool) ) );
363 viewMenu_->addAction( navigationSwitchAction);
364 extended_actions.push_back(navigationSwitchAction);
365
366 viewMenu_->addSeparator();
367
368 connect( viewMenu_,SIGNAL( aboutToShow() ), this, SLOT( slotViewMenuAboutToShow() ) );
369
370 QAction* homeAction = new QAction(tr("Restore Home View"),viewMenu_);
371 homeAction->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"go-home.png") );
372 homeAction->setCheckable( false );
373 homeAction->setStatusTip( tr("Restore <b>home</b> view."));
374 homeAction->setWhatsThis( tr("Restore home view<br><br>"
375 "Resets the view to the home view"));
376 viewMenu_->addAction( homeAction );
377 connect( homeAction,SIGNAL( triggered() ), this, SLOT( slotGlobalHomeView() ) );
378
379
380 QAction* setHomeAction = new QAction( tr("Set Home View") , viewMenu_ );
381 setHomeAction->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"set-home.png") );
382 setHomeAction->setCheckable( false );
383 setHomeAction->setStatusTip( tr("Set <b>home</b> view"));
384 setHomeAction->setWhatsThis( tr("Store home view<br><br>"
385 "Stores the current view as the home view"));
386 viewMenu_->addAction( setHomeAction);
387 connect( setHomeAction,SIGNAL( triggered() ), this, SLOT( slotGlobalSetHomeView() ) );
388
389 QAction* viewAllAction = new QAction( tr("View all"), viewMenu_ );
390 viewAllAction->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"viewall.png") );
391 viewAllAction->setCheckable( false );
392 viewAllAction->setStatusTip( tr("View all.") );
393 viewAllAction->setWhatsThis( tr("View all<br><br>"
394 "Move the objects in the scene so that"
395 " the whole scene is visible."));
396 connect( viewAllAction,SIGNAL( triggered() ), this, SLOT( slotGlobalViewAll() ) );
397 viewMenu_->addAction( viewAllAction);
398
399 viewMenu_->addSeparator();
400
401 QAction* snapShotAction = new QAction( tr("Viewer Snapshot"), viewMenu_ );
402 snapShotAction->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"viewerSnapshot.png") );
403 snapShotAction->setCheckable( false );
404 snapShotAction->setStatusTip( tr("Take a snapshot from all viewers."));
405 snapShotAction->setWhatsThis( tr("Viewer Snapshot<br><br>"
406 "Take a snapshot of all viewers at once."));
407 snapShotAction->setShortcut (Qt::Key_F2);
408 connect( snapShotAction,SIGNAL( triggered() ), this, SLOT( viewerSnapshotDialog() ) );
409 viewMenu_->addAction( snapShotAction);
410
411 QAction* appSnapShotAction = new QAction( tr("Application Snapshot"), viewMenu_ );
412 appSnapShotAction->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"snapshot.png") );
413 appSnapShotAction->setCheckable( false );
414 appSnapShotAction->setStatusTip( tr("Take a snapshot from OpenFlipper."));
415 appSnapShotAction->setWhatsThis( tr("Snapshot<br><br>"
416 "Take a snapshot from OpenFlipper."));
417 connect( appSnapShotAction,SIGNAL( triggered() ), this, SLOT( applicationSnapshotDialog() ) );
418 viewMenu_->addAction( appSnapShotAction);
419
420 viewMenu_->addSeparator();
421
422 QAction* wheelSwitchAction = new QAction( tr("Show / hide wheels"), viewMenu_ );
423 wheelSwitchAction->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"core_wheels.png") );
424 wheelSwitchAction->setCheckable( true );
425 wheelSwitchAction->setStatusTip( tr("Show / hide navigation wheels in viewer widget."));
426 wheelSwitchAction->setWhatsThis( tr("Show / hide navigation wheels in viewer widget.<br><br>"
427 " These wheels appear in the corners of the viewports. "
428 " Use wheels to rotate and scale scene."));
429
430 if(OpenFlipperSettings().value("Core/Gui/glViewer/showControlWheels").toBool() )
431 wheelSwitchAction->setChecked(true);
432
433 connect( wheelSwitchAction,SIGNAL( toggled(bool) ), this, SLOT( slotSwitchWheels(bool) ) );
434 viewMenu_->addAction( wheelSwitchAction);
435
436 QAction* coordSys = viewMenu_->addAction(tr("Coordinate Systems"));
437 coordSys->setCheckable(true);
438 coordSys->setChecked(true);
439 coordSys->setStatusTip(tr("Toggle visibility of the coordinate systems"));
440 coordSys->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"coordsys.png") );
441 connect(coordSys, SIGNAL(triggered(bool)), this, SLOT( slotCoordSysVisibility(bool) ) );
442
443 viewMenu_->addSeparator();
444
445 QAction* setGlobalBackgroundColor = new QAction(tr("Set Background Color"), this);;
446 setGlobalBackgroundColor->setToolTip(tr("Set Background Color for all viewers"));
447 setGlobalBackgroundColor->setStatusTip(tr("Set Background Color for all viewers"));
448 setGlobalBackgroundColor->setWhatsThis(tr("Set Background Color for all viewers"));
449 setGlobalBackgroundColor->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"BackgroundColor.png") );
450 connect(setGlobalBackgroundColor, SIGNAL(triggered()), this, SLOT(slotSetGlobalBackgroundColor()));
451 viewMenu_->addAction(setGlobalBackgroundColor);
452
453 //===========================================================================================================================
454 // Tools Menu
455 //===========================================================================================================================
456
457 toolsMenu_ = new QMenu( TOOLSMENU );
458 menuBar()->addMenu(toolsMenu_ );
459 menus_[tr("Tools")] = toolsMenu_;
460
461 QAction* sceneGraphAction = new QAction( tr("Show SceneGraph ") ,toolsMenu_ );
462 sceneGraphAction->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"scenegraph.png") );
463 sceneGraphAction->setCheckable( false );
464 sceneGraphAction->setToolTip( tr("Show scene graph viewer.") );
465 sceneGraphAction->setWhatsThis( tr("Toggle scene graph viewer<br><br>"
466 "The scene graph viewer enables you to examine the "
467 "displayed scene graph and to modify certain nodes.<br><br>" ) );
468 QObject::connect( sceneGraphAction, SIGNAL( triggered() ),
469 this, SLOT( slotShowSceneGraphDialog() ) );
470 toolsMenu_->addAction( sceneGraphAction);
471 extended_actions.push_back(sceneGraphAction);
472
473 toolsMenu_->addSeparator();
474
475 QAction* startVideoCaptureAction = new QAction( tr("Start Video Capture ") ,toolsMenu_ );
476 startVideoCaptureAction->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"video-start.png") );
477 startVideoCaptureAction->setCheckable( false );
478 startVideoCaptureAction->setToolTip( tr("Start video capturing.") );
479 startVideoCaptureAction->setWhatsThis( tr("Start to capture a video sequence of the user actions")) ;
480 toolsMenu_->addAction( startVideoCaptureAction );
481 connect(startVideoCaptureAction, SIGNAL(triggered()), this, SLOT(startVideoCaptureDialog()) );
482
483 QAction* stopVideoCaptureAction = new QAction( tr("Stop Video Capture ") ,toolsMenu_ );
484 stopVideoCaptureAction->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"video-stop.png") );
485 stopVideoCaptureAction->setCheckable( false );
486 stopVideoCaptureAction->setToolTip( tr("Stop video capturing." ));
487 stopVideoCaptureAction->setWhatsThis( tr("Stop Video capturing" ));
488
489 toolsMenu_->addAction( stopVideoCaptureAction);
490 connect(stopVideoCaptureAction, SIGNAL(triggered()), this, SIGNAL(stopVideoCapture()) );
491
492 extended_actions.push_back(startVideoCaptureAction);
493 extended_actions.push_back(stopVideoCaptureAction);
494
495 toolsMenu_->addSeparator();
496
497 //show plugins
498 QAction* AC_Plugins = new QAction(tr("Plugins"), this);
499 AC_Plugins->setStatusTip(tr("Show loaded plugins"));
500 AC_Plugins->setWhatsThis(tr("Show loaded plugins"));
501 AC_Plugins->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"network-connect.png"));
502 connect(AC_Plugins, SIGNAL(triggered()), this, SIGNAL(showPlugins()));
503 toolsMenu_->addAction(AC_Plugins);
504
505 // ======================================================================
506 // Window Menu
507 // ======================================================================
508 windowMenu_ = new QMenu(tr("Windows"));
509 menuBar()->addMenu(windowMenu_);
510 menus_[tr("Windows")] = windowMenu_;
511
512
513 // Show or Hide the View Mode Controls
514 AC_ShowViewModeControls_ = new QAction(tr("Show View Mode Controls"), this);
515 AC_ShowViewModeControls_->setStatusTip(tr("Show or Hide View Mode Control Widget"));
516 // AC_HelpBrowser->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"help-browser.png"));
517 AC_ShowViewModeControls_->setWhatsThis(tr("Show or Hide View Mode Control Widget"));
518 AC_ShowViewModeControls_->setCheckable(true);
519 AC_ShowViewModeControls_->setChecked( ! OpenFlipperSettings().value("Core/Gui/TaskSwitcher/Hide",false).toBool() );
520 connect(AC_ShowViewModeControls_, SIGNAL(toggled( bool )), this, SLOT(showViewModeControls(bool)));
521 windowMenu_->addAction(AC_ShowViewModeControls_);
522 extended_actions.push_back(AC_ShowViewModeControls_);
523
524 // Show or Hide the View Mode Controls
525 QAction* AC_ShowToolbox = new QAction(tr("Show Toolboxes"), this);
526 AC_ShowToolbox->setStatusTip(tr("Show or Hide the Toolbox Widget"));
527 // AC_HelpBrowser->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"help-browser.png"));
528 AC_ShowToolbox->setWhatsThis(tr("Show or Hide the Toolbox Widget"));
529 AC_ShowToolbox->setCheckable(true);
530 AC_ShowToolbox->setChecked( ! OpenFlipperSettings().value("Core/Gui/ToolBoxes/hidden",false).toBool() );
531 connect(AC_ShowToolbox, SIGNAL( triggered()), this, SLOT(toggleToolbox()));
532 connect(this,SIGNAL(toolBoxVisChanged(bool)),AC_ShowToolbox,SLOT(setChecked(bool)));
533 windowMenu_->addAction(AC_ShowToolbox);
534
535 // Show or Hide the Status bar
536 QAction* AC_ShowStatusBar = new QAction(tr("Show Statusbar"), this);
537 AC_ShowStatusBar->setStatusTip(tr("Show or Hide the Statusbar"));
538 AC_ShowStatusBar->setWhatsThis(tr("Show or Hide the Statusbar"));
539 AC_ShowStatusBar->setCheckable(true);
540 AC_ShowStatusBar->setChecked( !OpenFlipperSettings().value("Core/Gui/StatusBar/hidden",false).toBool());
541 connect(AC_ShowStatusBar,SIGNAL(triggered()),this,SLOT(toggleStatusBar()));
542 connect(this,SIGNAL(statusBarVisChanged(bool)),AC_ShowStatusBar,SLOT(setChecked(bool)));
543 windowMenu_->addAction(AC_ShowStatusBar);
544
545 // Show or Hide the Menu bar
546 QAction* AC_ShowMenuBar = new QAction(tr("Show Menubar"), this);
547 AC_ShowMenuBar->setStatusTip(tr("Show or Hide the Menubar"));
548 AC_ShowMenuBar->setWhatsThis(tr("Show or Hide the Menubar"));
549 AC_ShowMenuBar->setCheckable(true);
550 AC_ShowMenuBar->setChecked( !OpenFlipperSettings().value("Core/Gui/MenuBar/hidden",false).toBool());
551 connect(AC_ShowMenuBar,SIGNAL(triggered()),this,SLOT(toggleMenuBar()));
552 connect(this,SIGNAL(menuBarVisChanged(bool)),AC_ShowMenuBar,SLOT(setChecked(bool)));
553 windowMenu_->addAction(AC_ShowMenuBar);
554 extended_actions.push_back(AC_ShowMenuBar);
555
556 // Show or Hide the Tool bar
557 QAction* AC_ShowToolBar = new QAction(tr("Show Toolbar"), this);
558 AC_ShowToolBar->setStatusTip(tr("Show or Hide the Toolbar"));
559 AC_ShowToolBar->setWhatsThis(tr("Show or Hide the Toolbar"));
560 AC_ShowToolBar->setCheckable(true);
561 AC_ShowToolBar->setChecked( !OpenFlipperSettings().value("Core/Gui/ToolBar/hidden",false).toBool());
562 connect(AC_ShowToolBar,SIGNAL(triggered()),this,SLOT(toggleToolBar()));
563 connect(this,SIGNAL(toolBarVisChanged(bool)),AC_ShowToolBar,SLOT(setChecked(bool)));
564 windowMenu_->addAction(AC_ShowToolBar);
565
566 // Enable or Disable Fullscreen Mode
567 QAction* AC_Fullscreen = new QAction(tr("Fullscreen"), this);
568 AC_Fullscreen->setStatusTip(tr("Enable or Disable the Fullscreen"));
569 AC_Fullscreen->setWhatsThis(tr("Enable or Disable the Fullscreen"));
570 AC_Fullscreen->setCheckable(true);
571 AC_Fullscreen->setChecked( OpenFlipperSettings().value("Core/Gui/fullscreen", false ).toBool() );
572 connect(AC_Fullscreen,SIGNAL(triggered()),this,SLOT(toggleFullscreen()));
573 connect(this,SIGNAL(fullScreenChanged(bool)),AC_Fullscreen,SLOT(setChecked(bool)));
574 windowMenu_->addAction(AC_Fullscreen);
575
576 // ======================================================================
577 // Algorithms Menu
578 // ======================================================================
579 algorithmMenu_ = new QMenu( ALGORITHMMENU );
580 menus_[tr("Algorithms")] = algorithmMenu_;
581
582 // ======================================================================
583 // Python Menu
584 // ======================================================================
585 #ifdef PYTHON_ENABLED
586 pythonMenu_ = new QMenu( PYTHONMENU );
587 menuBar()->addMenu(pythonMenu_ );
588 menus_[tr("Python")] = pythonMenu_;
589
590 //Open Python Widget
591 QAction* AC_PythonWidget = new QAction(tr("Python Script"), this);
592 AC_PythonWidget->setStatusTip(tr("Open Python Script Interpreter"));
593 AC_PythonWidget->setWhatsThis(tr("Open the <b>Python Script Interpreter</b>"));
594 connect(AC_PythonWidget, SIGNAL(triggered()), this, SLOT(showPythonScriptInterpreter()));
595 pythonMenu_->addAction(AC_PythonWidget);
596 #endif
597
598 // ======================================================================
599 // help Menu
600 // ======================================================================
601 helpMenu_ = new QMenu(tr("Help"));
602 menuBar()->addMenu(helpMenu_);
603 menus_[tr("Help")] = helpMenu_;
604
605 //Open Help Browser
606 QAction* AC_HelpBrowser = new QAction(tr("Help"), this);
607 AC_HelpBrowser->setStatusTip(tr("Open Help Browser with Documentation"));
608 AC_HelpBrowser->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"help-browser.png"));
609 AC_HelpBrowser->setWhatsThis(tr("Open the <b>Help Browser</b>"));
610 connect(AC_HelpBrowser, SIGNAL(triggered()), this, SLOT(showHelpBrowser()));
611 helpMenu_->addAction(AC_HelpBrowser);
612
613 //Switch to whats this mode
614 QAction* AC_Whats_this = QWhatsThis::createAction ( this );
615 AC_Whats_this->setStatusTip(tr("Enter What's this Mode"));
616 AC_Whats_this->setWhatsThis(tr("Get information about a specific Button/Widget/..."));
617 helpMenu_->addAction(AC_Whats_this);
618
619 helpMenu_->addSeparator();
620
621 //About Action
622 QAction* AC_About = new QAction(tr("About"), this);
623 AC_About->setStatusTip(tr("About OpenFlipper"));
624 AC_About->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"help-about.png"));
625 AC_About->setWhatsThis(tr("This entry shows information about <b>OpenFlipper</b>"));
626 connect(AC_About, SIGNAL(triggered()), this, SLOT(showAboutWidget()));
627 helpMenu_->addAction(AC_About);
628
629 // Add Menu entries to the main Toolbar
630 mainToolbar_->addAction(AC_Load);
631 mainToolbar_->addAction(AC_AddEmpty);
632 mainToolbar_->addSeparator();
633 mainToolbar_->addAction(AC_Save);
634 mainToolbar_->addAction(AC_Save_to);
635 mainToolbar_->addSeparator();
636 mainToolbar_->addAction(AC_load_ini);
637 mainToolbar_->addAction(AC_save_ini);
638
639
640 // install event filters for what is this event
641 // todo: why doesn't go any event through CoreWidget::event from menus? i don't get it
642 fileMenu_->installEventFilter(this);
643 viewMenu_->installEventFilter(this);
644 toolsMenu_->installEventFilter(this);
645 windowMenu_->installEventFilter(this);
646 algorithmMenu_->installEventFilter(this);
647 helpMenu_->installEventFilter(this);
648
649
650
651
652 }
653
654
655 void CoreWidget::slotViewMenuAboutToShow() {
656
657 uint enabledCount = 0;
658
659 for ( int i = 0 ; i< PluginFunctions::viewers(); ++i ) {
660 if ( PluginFunctions::viewerProperties(i).animation() )
661 enabledCount++;
662 }
663
664 if ( enabledCount != 0 ) {
665 globalAnimationAction_->setToolTip(tr("Disable animation for all viewers"));
666 globalAnimationAction_->setStatusTip(tr("Disable animation for all viewers"));
667 globalAnimationAction_->setText(tr("Disable animation"));
668 } else {
669 globalAnimationAction_->setToolTip(tr("Enable animation for all viewers"));
670 globalAnimationAction_->setStatusTip(tr("Enable animation for all viewers"));
671 globalAnimationAction_->setText(tr("Enable animation"));
672 }
673
674 //=============================================================================================================================
675
676 enabledCount = 0;
677
678 for ( int i = 0 ; i< PluginFunctions::viewers(); ++i ) {
679 if ( PluginFunctions::viewerProperties(i).backFaceCulling() )
680 enabledCount++;
681 }
682
683 if ( enabledCount != 0 ) {
684 globalBackfaceCullingAction_->setToolTip(tr("Disable backface culling for all viewers"));
685 globalBackfaceCullingAction_->setStatusTip(tr("Disable backface culling for all viewers"));
686 globalBackfaceCullingAction_->setText(tr("Disable backface culling"));
687 } else {
688 globalBackfaceCullingAction_->setToolTip(tr("Enable backface culling for all viewers"));
689 globalBackfaceCullingAction_->setStatusTip(tr("Enable backface culling for all viewers"));
690 globalBackfaceCullingAction_->setText(tr("Enable backface culling"));
691 }
692
693 //=============================================================================================================================
694
695 enabledCount = 0;
696
697 for ( int i = 0 ; i< PluginFunctions::viewers(); ++i ) {
698 if ( PluginFunctions::viewerProperties(i).twoSidedLighting() )
699 enabledCount++;
700 }
701
702 if ( enabledCount != 0 ) {
703 globalTwosidedLightingAction_->setToolTip(tr("Disable two-sided lighting for all viewers"));
704 globalTwosidedLightingAction_->setStatusTip(tr("Disable two-sided lighting for all viewers"));
705 globalTwosidedLightingAction_->setText(tr("Disable two-sided lighting"));
706 } else {
707 globalTwosidedLightingAction_->setToolTip(tr("Enable two-sided lighting for all viewers"));
708 globalTwosidedLightingAction_->setStatusTip(tr("Enable two-sided lighting for all viewers"));
709 globalTwosidedLightingAction_->setText(tr("Enable two-sided lighting"));
710 }
711
712 //=============================================================================================================================
713
714 enabledCount = 0;
715
716 for ( int i = 0 ; i< PluginFunctions::viewers(); ++i ) {
717 if ( PluginFunctions::viewerProperties(i).multisampling() )
718 enabledCount++;
719 }
720
721 if ( enabledCount != 0 ) {
722 globalMultisamplingAction_->setToolTip(tr("Disable multisampling for all viewers"));
723 globalMultisamplingAction_->setStatusTip(tr("Disable multisampling for all viewers"));
724 globalMultisamplingAction_->setText(tr("Disable multisampling"));
725 } else {
726 globalMultisamplingAction_->setToolTip(tr("Enable multisampling for all viewers"));
727 globalMultisamplingAction_->setStatusTip(tr("Enable multisampling for all viewers"));
728 globalMultisamplingAction_->setText(tr("Enable multisampling"));
729 }
730
731 //=============================================================================================================================
732
733 enabledCount = 0;
734
735 for ( int i = 0 ; i< PluginFunctions::viewers(); ++i ) {
736 if ( PluginFunctions::viewerProperties(i).mipmapping() )
737 enabledCount++;
738 }
739
740 if ( enabledCount != 0 ) {
741 globalMipmappingAction_->setToolTip(tr("Disable mipmapping for all viewers"));
742 globalMipmappingAction_->setStatusTip(tr("Disable mipmapping for all viewers"));
743 globalMipmappingAction_->setText(tr("Disable mipmapping"));
744 } else {
745 globalMipmappingAction_->setToolTip(tr("Enable mipmapping for all viewers"));
746 globalMipmappingAction_->setStatusTip(tr("Enable mipmapping for all viewers"));
747 globalMipmappingAction_->setText(tr("Enable mipmapping"));
748 }
749
750 //=============================================================================================================================
751
752 int perspectiveCount = 0;
753 int orthogonalCount = 0;
754
755 for ( int i = 0 ; i < PluginFunctions::viewers() ; ++i ) {
756 if ( examiner_widgets_[ i ]->projectionMode() == glViewer::PERSPECTIVE_PROJECTION )
757 perspectiveCount++;
758 else
759 orthogonalCount++;
760 }
761
762 if ( perspectiveCount == PluginFunctions::viewers() )
763 perspectiveProjectionAction_->setVisible(false);
764 else
765 perspectiveProjectionAction_->setVisible(true);
766
767 if ( orthogonalCount == PluginFunctions::viewers() )
768 orthogonalProjectionAction_->setVisible(false);
769 else
770 orthogonalProjectionAction_->setVisible(true);
771
772 }
773
774 void CoreWidget::slotUpdateRendererMenu() {
775
776 // Add the menu if it does not exist yet
777 if ( rendererMenu_ == 0 ) {
778
779 QString iconPath = OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator();
780
781 rendererMenu_ = new QMenu(tr("Global Renderer"),viewMenu_);
782 rendererMenu_->setIcon(QIcon(iconPath+"renderers.png"));
783 extended_actions.push_back(viewMenu_->addMenu(rendererMenu_));
784
785
786 connect(rendererMenu_,SIGNAL(aboutToShow () ) , this, SLOT(slotUpdateRendererMenu() ) );
787 }
788
789 // delete the old renerer group if it exists
790 if ( rendererGroup_ ) {
791
792 disconnect( rendererGroup_ , SIGNAL( triggered( QAction * ) ),
793 this , SLOT( slotGlobalRendererMenu( QAction * ) ) );
794
795 delete( rendererGroup_ );
796 rendererGroup_ = 0;
797
798 }
799
800 // Recreate actionGroup
801 rendererGroup_ = new QActionGroup( this );
802 rendererGroup_->setExclusive( true );
803
804 // // Add the options for all active renderers
805 // for ( int i = 0 ; i < PluginFunctions::viewers() ; ++i) {
806 //
807 // //Get the options action for the currently active renderer
808 // if( renderManager()[ renderManager().activeId( i )]->optionsAction != 0 ) {
809 // rendererMenu_->addAction(renderManager()[ renderManager().activeId(i) ]->optionsAction );
810 // }
811 // }
812
813 // rendererMenu_->addSeparator();
814
815 // Add the renderers
816 for ( unsigned int i = 0 ; i < renderManager().available() ; ++i) {
817
818 // Add a new Action with the renderer name
819 QAction * action = new QAction( renderManager()[i]->name, rendererGroup_ );
820 action->setCheckable( true );
821
822 // Check if this processor is currently active
823 if ( renderManager().activeId(PluginFunctions::activeExaminer() ) == i )
824 action->setChecked(true);
825
826 // Remember the id for the processor
827 action->setData(QVariant(i));
828 }
829
830 // Remove old data
831 rendererMenu_->clear();
832
833 // Add render objects action
834 QAction* showRendererObjectWidget = new QAction(tr("Show render objects"), this);
835 connect(showRendererObjectWidget, SIGNAL(triggered()), this, SLOT(slotShowRenderObjectWidget()));
836 rendererMenu_->addAction(showRendererObjectWidget);
837
838 rendererMenu_->addSeparator();
839
840 // Add all new actions from the group to the menu
841 rendererMenu_->addActions( rendererGroup_->actions() );
842
843 // Connect signal of group to our managing slot
844 connect( rendererGroup_ , SIGNAL( triggered( QAction * ) ),
845 this , SLOT( slotGlobalRendererMenu( QAction * ) ) );
846
847
848 }
849
850 void CoreWidget::slotUpdateGlobalDrawMenu() {
851 if ( drawGroup_ ) {
852
853 disconnect( drawGroup_ , SIGNAL( triggered( QAction * ) ),
854 this , SLOT( slotGlobalDrawMenu( QAction * ) ) );
855 delete( drawGroup_ );
856 drawGroup_ = 0;
857
858 }
859
860 // Recreate drawGroup
861 drawGroup_ = new QActionGroup( this );
862 drawGroup_->setExclusive( false );
863
864 connect( drawGroup_ , SIGNAL( triggered( QAction * ) ),
865 this , SLOT( slotGlobalDrawMenu( QAction * ) ) );
866
867 if ( !globalDrawMenu_ ) {
868
869 QIcon icon;
870 icon.addFile(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"drawModes.png");
871 globalDrawMenu_ = new QMenu(tr("Set Global DrawMode"));
872 globalDrawMenu_->setTearOffEnabled(true);
873 globalDrawMenu_->setIcon(icon);
874
875 connect(globalDrawMenu_,SIGNAL(aboutToShow () ) , this, SLOT(slotUpdateGlobalDrawMenu() ) );
876 }
877
878 // Collect available draw Modes
879 // Single pass action, draw modes independent from multipass rendering
880 ACG::SceneGraph::CollectDrawModesAction actionAvailable;
881 ACG::SceneGraph::traverse( PluginFunctions::getRootNode() , actionAvailable);
882 availableGlobalDrawModes_ = actionAvailable.drawModes();
883
884 // Get currently active drawModes
885 activeDrawModes_ = PluginFunctions::drawMode(0);
886 for ( int i = 1 ; i < PluginFunctions::viewers(); ++i )
887 activeDrawModes_ &= PluginFunctions::drawMode(i);
888
889 // Convert to ids
890 std::vector< ACG::SceneGraph::DrawModes::DrawMode > availDrawModeIds;
891 availDrawModeIds = availableGlobalDrawModes_.getAtomicDrawModes() ;
892
893 globalDrawMenu_->clear();
894
895 for ( unsigned int i = 0; i < availDrawModeIds.size(); ++i )
896 {
897 ACG::SceneGraph::DrawModes::DrawMode id = availDrawModeIds[i];
898 std::string descr = id.description();
899
900 QAction * action = new QAction( descr.c_str(), drawGroup_ );
901 action->setCheckable( true );
902 action->setChecked( activeDrawModes_.containsAtomicDrawMode(id) );
903 }
904
905 globalDrawMenu_->addActions( drawGroup_->actions() );
906
907 }
908
909 void CoreWidget::slotGlobalRendererMenu(QAction * _action) {
910
911 unsigned int mode = _action->data().toUInt();
912
913 QString defaultRendererName = renderManager()[mode]->name;
914
915 // Set renderer for all viewers
916 for ( int i = 0 ; i < PluginFunctions::viewers() ; ++i)
917 {
918 renderManager().setActive(mode,i);
919 QString defaultRendererKey = "Viewer" + QString::number(i)+"/DefaultRenderer";
920 OpenFlipperSettings().setValue(defaultRendererKey,defaultRendererName);
921 }
922
923 }
924
925 void CoreWidget::slotGlobalPostProcessorMenu(QAction * _action) {
926
927 unsigned int mode = _action->data().toUInt();
928
929 // Set postprocessor for all viewers
930 for ( int i = 0 ; i < PluginFunctions::viewers() ; ++i)
931 postProcessorManager().setActive(mode,i);
932
933 }
934
935 void CoreWidget::slotGlobalDrawMenu(QAction * _action) {
936
937 //======================================================================================
938 // Get the mode toggled
939 //======================================================================================
940 ACG::SceneGraph::DrawModes::DrawMode mode(ACG::SceneGraph::DrawModes::NONE);
941 std::vector< ACG::SceneGraph::DrawModes::DrawMode > availDrawModeIds;
942 availDrawModeIds = availableGlobalDrawModes_.getAtomicDrawModes();
943 for ( unsigned int i = 0; i < availDrawModeIds.size(); ++i )
944 {
945 QString descr = QString( ( availDrawModeIds[i].description() ).c_str() );
946
947 if ( descr == _action->text() ) {
948 mode = availDrawModeIds[i];
949 break;
950 }
951 }
952
953 if ( qApp->keyboardModifiers() & Qt::ShiftModifier )
954 activeDrawModes_ = ( activeDrawModes_ ^ mode);
955 else
956 activeDrawModes_ = mode ;
957
958 PluginFunctions::setDrawMode( activeDrawModes_ );
959 }
960
961
962 //=============================================================================
CoreWidget::globalMipmappingAction_
QAction * globalMipmappingAction_
Action to globally set mipmapping.
Definition: CoreWidget.hh:896
RenderManager::available
size_t available()
number of available renderers
Definition: RendererInfo.cc:140
OpenFlipperSettings
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
Definition: GlobalOptions.cc:1038
CoreWidget::slotGlobalDrawMenu
void slotGlobalDrawMenu(QAction *_action)
Called when the global drawMode is selected.
Definition: MenuBar.cc:935
CoreWidget::helpMenu_
QMenu * helpMenu_
Help Menu.
Definition: CoreWidget.hh:698
CoreWidget::slotShowRenderObjectWidget
void slotShowRenderObjectWidget()
Shows the widget containing the current render objects.
Definition: rendererDialog.cc:69
CoreWidget::menus_
QMap< QString, QMenu * > menus_
All available menus.
Definition: CoreWidget.hh:812
PYTHONMENU
#define PYTHONMENU
The Menu will be added inside the Python Menu.
Definition: MenuInterface.hh:63
CoreWidget::toggleFullscreen
void toggleFullscreen()
Set application to Fullscreen and back.
Definition: CoreWidget.cc:670
CoreWidget::slotGlobalToggleTwoSidedLighting
void slotGlobalToggleTwoSidedLighting()
If two-sided lighting is disabled in all viewers, enable it in all viewers. Otherwise disable it...
Definition: viewerControl.cc:278
CoreWidget::toolBoxVisChanged
void toolBoxVisChanged(bool _state)
will be emitted if the visibility of the toolbox is changed
CoreWidget::viewerSnapshotDialog
void viewerSnapshotDialog()
Create a snapshot of the whole app with fileDialog.
Definition: viewerControl.cc:746
CoreWidget::slotGlobalToggleMultisampling
void slotGlobalToggleMultisampling()
If multisampling is disabled in all viewers, enable it in all viewers. Otherwise disable it...
Definition: viewerControl.cc:302
CoreWidget::showAboutWidget
void showAboutWidget()
Display the about widget.
Definition: About.cc:87
CoreWidget::showViewModeControls
void showViewModeControls(bool _show)
Hide or show the View Mode controls.
Definition: CoreWidget.cc:700
Core::stopVideoCapture
void stopVideoCapture()
Stop video capturing.
Definition: Video.cc:104
CoreWidget::toggleStatusBar
void toggleStatusBar()
Change visibility of the Status Bar.
Definition: StatusBar.cc:144
CoreWidget::globalMultisamplingAction_
QAction * globalMultisamplingAction_
Action to globally set multisampling.
Definition: CoreWidget.hh:893
glViewer::PERSPECTIVE_PROJECTION
perspective
Definition: QtBaseViewer.hh:198
PluginFunctions::activeExaminer
unsigned int activeExaminer()
Get the id of the examiner which got the last mouse events.
Definition: PluginFunctions.cc:194
CoreWidget::showOptionsWidget
void showOptionsWidget()
Display the Options Browser.
Definition: CoreWidget.cc:911
CoreWidget::slotGlobalToggleAnimation
void slotGlobalToggleAnimation()
If animation is disabled in all viewers, enable it in all viewers. Otherwise disable it...
Definition: viewerControl.cc:229
CoreWidget::slotUpdateGlobalDrawMenu
void slotUpdateGlobalDrawMenu()
Setup and update the global draw menu.
Definition: MenuBar.cc:850
CoreWidget::globalAnimationAction_
QAction * globalAnimationAction_
Action to globally set animation.
Definition: CoreWidget.hh:884
CoreWidget::toggleToolBar
void toggleToolBar()
Hide or show current toolbar.
Definition: CoreWidget.cc:811
Viewer::ViewerProperties::twoSidedLighting
void twoSidedLighting(bool _state)
set 2-sided lighting on/off
Definition: ViewerProperties.cc:283
CoreWidget::showHelpBrowser
void showHelpBrowser(const QString &page=homePage_)
Display the help Browser.
Definition: Help.cc:65
CoreWidget::slotShowSceneGraphDialog
void slotShowSceneGraphDialog()
Definition: CoreWidget.cc:1009
CoreWidget::slotAddMenubarAction
void slotAddMenubarAction(QAction *_action, QString _name)
File Menu.
Definition: MenuBar.cc:61
CoreWidget::showReducedMenuBar
void showReducedMenuBar(bool reduced)
typedefs
Definition: MenuBar.cc:147
ACG::SceneGraph::CollectDrawModesAction::drawModes
DrawModes::DrawMode drawModes() const
Get the collected draw modes.
Definition: SceneGraph.hh:582
OpenFlipperQSettings::setValue
void setValue(const QString &key, const QVariant &value)
Wrapper function which makes it possible to enable Debugging output with -DOPENFLIPPER_SETTINGS_DEBUG...
Definition: OpenFlipperQSettings.cc:61
Viewer::ViewerProperties::animation
void animation(bool _state)
set 2-sided lighting on/off
Definition: ViewerProperties.cc:309
PluginFunctions::viewers
int viewers()
Get the number of viewers.
Definition: PluginFunctions.cc:144
Viewer::ViewerProperties::multisampling
void multisampling(bool _state)
set multisampling on/off
Definition: ViewerProperties.cc:292
CoreWidget::slotUpdateRendererMenu
void slotUpdateRendererMenu()
Setup and update the global renderer menu.
Definition: MenuBar.cc:774
CoreWidget::recentFilesMenu_
QMenu * recentFilesMenu_
QMenu containing the recently opened files.
Definition: CoreWidget.hh:692
PluginFunctions::setDrawMode
void setDrawMode(const ACG::SceneGraph::DrawModes::DrawMode &_mode, int _viewer)
Set the draw Mode of a Viewer. .
Definition: PluginFunctions.cc:431
CoreWidget::orthogonalProjectionAction_
QAction * orthogonalProjectionAction_
This variable holds the global draw menu.
Definition: CoreWidget.hh:881
PostProcessorManager::setActive
void setActive(unsigned int _active, int _viewerId)
set the active post processor for viewer
Definition: RendererInfo.cc:278
CoreWidget::algorithmMenu_
QMenu * algorithmMenu_
Algorithms Menu.
Definition: CoreWidget.hh:695
CoreWidget::AC_ShowViewModeControls_
QAction * AC_ShowViewModeControls_
Action for View Mode Widget Conrol in Menu.
Definition: CoreWidget.hh:704
CoreWidget::slotGetMenubarMenu
void slotGetMenubarMenu(QString _name, QMenu *&_menu, bool _create)
File Menu.
Definition: MenuBar.cc:108
CoreWidget::menuBarVisChanged
void menuBarVisChanged(bool _state)
will be emitted if the visibility of the menubar is changed
CoreWidget.hh
PluginFunctions::getRootNode
ACG::SceneGraph::BaseNode * getRootNode()
Get the root node for data objects.
Definition: PluginFunctions.cc:961
CoreWidget::rendererGroup_
QActionGroup * rendererGroup_
Group for all renderers.
Definition: CoreWidget.hh:875
CoreWidget::slotSwitchNavigation
void slotSwitchNavigation(bool _egomode)
Switch navigation mode.
Definition: viewerControl.cc:137
Core::clearAll
void clearAll()
Clear all data objects.
Definition: Core.cc:998
CoreWidget::toolsMenu_
QMenu * toolsMenu_
Tools Menu.
Definition: CoreWidget.hh:806
CoreWidget::rendererMenu_
QMenu * rendererMenu_
This variable holds the global renderer menu.
Definition: CoreWidget.hh:870
PluginFunctions::viewerProperties
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
Definition: PluginFunctions.cc:609
CoreWidget::slotGlobalPerspectiveProjection
void slotGlobalPerspectiveProjection()
Toggle projection mode of all viewers to perspective projection.
Definition: viewerControl.cc:216
CoreWidget::slotGlobalHomeView
void slotGlobalHomeView()
Set the viewer to home position.
Definition: viewerControl.cc:147
CoreWidget::applicationSnapshotDialog
void applicationSnapshotDialog()
Create a snapshot of the whole app with fileDialog.
Definition: viewerControl.cc:491
CoreWidget::slotAddMenubarActions
void slotAddMenubarActions(std::vector< QAction *> _actions, QString _name)
File Menu.
Definition: MenuBar.cc:82
CoreWidget::slotSetGlobalBackgroundColor
void slotSetGlobalBackgroundColor()
Set Background Color for all viewers at once.
Definition: viewerControl.cc:92
ACG::SceneGraph::DrawModes::NONE
DrawMode NONE
not a valid draw mode
Definition: DrawModes.cc:71
CoreWidget::slotCoordSysVisibility
void slotCoordSysVisibility(bool _visible)
Hide coordinate systems in all viewers.
Definition: viewerControl.cc:1093
CoreWidget::statusBarVisChanged
void statusBarVisChanged(bool _state)
will be emitted if the visibility of the statusbar is changed
ACG::SceneGraph::CollectDrawModesAction
Definition: SceneGraph.hh:569
Viewer::ViewerProperties::mipmapping
void mipmapping(bool _state)
set mipmapping on/off
Definition: ViewerProperties.cc:301
ACG::SceneGraph::DrawModes::DrawMode::getAtomicDrawModes
std::vector< DrawMode > getAtomicDrawModes() const
Separates this drawMode into a list of all separate atomic draw modes.
Definition: DrawModes.cc:495
TOOLSMENU
#define TOOLSMENU
The Menu will be added inside the Tools Menu.
Definition: MenuInterface.hh:57
CoreWidget::drawGroup_
QActionGroup * drawGroup_
This variable holds the global draw menu.
Definition: CoreWidget.hh:872
PluginFunctions::drawMode
ACG::SceneGraph::DrawModes::DrawMode drawMode(int _viewer)
Get the current draw Mode of a Viewer.
Definition: PluginFunctions.cc:450
CoreWidget::mainToolbar_
QToolBar * mainToolbar_
Called by Plugins to add a Toolbar.
Definition: CoreWidget.hh:1260
ACG::SceneGraph::DrawModes::DrawMode
Specifies a DrawMode.
Definition: DrawModes.hh:288
RenderManager::setActive
void setActive(unsigned int _active, int _id)
set the active renderer
Definition: RendererInfo.cc:145
Viewer::ViewerProperties::backFaceCulling
bool backFaceCulling()
Get current state of backface culling.
Definition: ViewerProperties.cc:274
VIEWMENU
#define VIEWMENU
The Menu will be added inside the View Menu.
Definition: MenuInterface.hh:54
CoreWidget::slotSwitchWheels
void slotSwitchWheels(bool _state)
Show / hide wheels.
Definition: viewerControl.cc:129
ALGORITHMMENU
#define ALGORITHMMENU
The Menu will be added inside the Algorithms Menu.
Definition: MenuInterface.hh:60
CoreWidget::globalDrawMenu_
QMenu * globalDrawMenu_
This variable holds the global draw menu.
Definition: CoreWidget.hh:867
CoreWidget::globalBackfaceCullingAction_
QAction * globalBackfaceCullingAction_
Action to globally set backface culling.
Definition: CoreWidget.hh:887
CoreWidget::extended_actions
std::vector< QAction * > extended_actions
Definition: CoreWidget.hh:1589
CoreWidget::slotViewMenuAboutToShow
void slotViewMenuAboutToShow()
Called before the view Menu is shown.
Definition: MenuBar.cc:655
CoreWidget::fileMenu_
QMenu * fileMenu_
File Menu.
Definition: CoreWidget.hh:797
CoreWidget::fullScreenChanged
void fullScreenChanged(bool _state)
will be emitted if the fullscreen state is changed (_state = true => in fullscreen) ...
ACG::SceneGraph::traverse
void traverse(BaseNode *_node, Action &_action)
Definition: SceneGraph.hh:137
CoreWidget::fileMenuEnd_
QAction * fileMenuEnd_
First entry after all relevant parts of the File Menu.
Definition: CoreWidget.hh:809
CoreWidget::examiner_widgets_
std::vector< glViewer *> examiner_widgets_
Examiner Widget.
Definition: CoreWidget.hh:677
CoreWidget::pythonMenu_
QMenu * pythonMenu_
Python Menu.
Definition: CoreWidget.hh:803
FILEMENU
#define FILEMENU
The Menu will be added inside the File Menu.
Definition: MenuInterface.hh:51
CoreWidget::windowMenu_
QMenu * windowMenu_
Window Menu.
Definition: CoreWidget.hh:701
CoreWidget::availableGlobalDrawModes_
ACG::SceneGraph::DrawModes::DrawMode availableGlobalDrawModes_
This variable holds the global draw menu.
Definition: CoreWidget.hh:900
CoreWidget::toggleToolbox
void toggleToolbox()
Hide or show toolbox area.
Definition: CoreWidget.cc:729
CoreWidget::showPythonScriptInterpreter
void showPythonScriptInterpreter()
Pointer to the OptionsWidget.
Definition: Python.cc:3
CoreWidget::activeDrawModes_
ACG::SceneGraph::DrawModes::DrawMode activeDrawModes_
This variable holds the global draw menu.
Definition: CoreWidget.hh:898
CoreWidget::slotGlobalSetHomeView
void slotGlobalSetHomeView()
Set the home position for all viewers.
Definition: viewerControl.cc:159
CoreWidget::slotGlobalToggleBackFaceCulling
void slotGlobalToggleBackFaceCulling()
If backface culling is disabled in all viewers, enable it in all viewers. Otherwise disable it...
Definition: viewerControl.cc:253
CoreWidget::toggleMenuBar
void toggleMenuBar()
Hide or show menu bar.
Definition: CoreWidget.cc:803
CoreWidget::slotGlobalViewAll
void slotGlobalViewAll()
Change view on all viewers to view complete scene.
Definition: viewerControl.cc:171
CoreWidget::slotGlobalOrthographicProjection
void slotGlobalOrthographicProjection()
Toggle projection mode of all viewers to orthographic projection.
Definition: viewerControl.cc:222
CoreWidget::eventFilter
bool eventFilter(QObject *_obj, QEvent *_event)
typedefs
Definition: MenuBar.cc:131
ACG::SceneGraph::DrawModes::DrawMode::containsAtomicDrawMode
bool containsAtomicDrawMode(const DrawMode &_atomicDrawMode) const
Check whether an Atomic DrawMode is active in this draw Mode.
Definition: DrawModes.cc:520
CoreWidget::setupMenuBar
void setupMenuBar()
Setup the main menubar.
Definition: MenuBar.cc:153
CoreWidget::toolBarVisChanged
void toolBarVisChanged(bool _state)
will be emitted if the visibility of the toolbar is changed
CoreWidget::viewMenu_
QMenu * viewMenu_
View Menu.
Definition: CoreWidget.hh:800
CoreWidget::slotGlobalRendererMenu
void slotGlobalRendererMenu(QAction *_action)
Called when the global renderer is selected.
Definition: MenuBar.cc:909
CoreWidget::globalTwosidedLightingAction_
QAction * globalTwosidedLightingAction_
Action to globally set two-sided lighting.
Definition: CoreWidget.hh:890
CoreWidget::perspectiveProjectionAction_
QAction * perspectiveProjectionAction_
This variable holds the global draw menu.
Definition: CoreWidget.hh:880
CoreWidget::slotGlobalToggleMipmapping
void slotGlobalToggleMipmapping()
If mipmapping is disabled in all viewers, enable it in all viewers. Otherwise disable it...
Definition: viewerControl.cc:326
CoreWidget::slotGlobalPostProcessorMenu
void slotGlobalPostProcessorMenu(QAction *_action)
Called when the global postprocessor is selected.
Definition: MenuBar.cc:925