59 #include <OpenFlipper/common/RecentFiles.hh> 60 #include <OpenFlipper/BasePlugin/PluginFunctionsCore.hh> 62 #include <OpenFlipper/widgets/videoCaptureDialog/VideoCaptureDialog.hh> 65 #include <ACG/GL/ShaderCache.hh> 72 #define WIDGET_HEIGHT 800 73 #define WIDGET_WIDTH 800 77 PickMode::PickMode(
const std::string& _n,
const bool _t,
const bool _v, QCursor _c, QToolBar *_tb ) :
135 QList< SlotInfo >& _coreSlots ) :
137 coreSlots_(_coreSlots),
138 shiftPressed_(false),
139 viewModes_(_viewModes),
147 AC_ShowViewModeControls_(0),
148 pickToolBarExternal_(0),
150 sceneGraphDialog_(0),
151 viewModeChangePopupAction_(0),
167 perspectiveProjectionAction_(0),
169 availableGlobalDrawModes_(0),
171 contextSelectionMenu_(0),
174 viewerDrawMenuWidget_(0),
180 postProcessorDialog_(0),
182 rendererObjectWidget_(0),
183 stereoSettingsWidget_(0),
187 stereoActive_(false),
188 actionMode_(
Viewer::PickingMode),
189 lastActionMode_(
Viewer::ExamineMode),
219 OpenFlipper::Options::glStereo(
glWidget_->format().stereo(),
true);
222 glView_->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
224 glView_->setFrameStyle(QFrame::NoFrame);
249 logWidget_->setSizePolicy( QSizePolicy ( QSizePolicy::Preferred , QSizePolicy::Preferred ) );
261 if (OpenFlipper::Options::loggerState() == OpenFlipper::Options::InScene) {
267 }
else if (OpenFlipper::Options::loggerState() == OpenFlipper::Options::Hidden) {
282 unsigned int maxPases = 1;
286 if ( !
OpenFlipperSettings().value(
"Core/Gui/glViewer/useMultipleViewers",
true).toBool() ) {
305 for (
unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
314 this, SLOT(
getPickMode(std::string&) ),Qt::DirectConnection );
316 this, SLOT(
setPickMode(
const std::string) ),Qt::DirectConnection );
326 for (
unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
349 for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
361 statusBar_, SLOT(showMessage(
const QString&,
int)));
389 moveButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"transform-move.png") );
393 moveButton_->setToolTip( tr(
"Switch to <b>move</b> mode.") );
395 "Switch to <b>move</b> mode.<br>" 396 "<ul><li><b>Rotate</b> using <b>left</b> mouse button.</li>" 397 "<li><b>Translate</b> using <b>middle</b> mouse button.</li>" 398 "<li><b>Zoom</b> using <b>left+middle</b> mouse buttons.</li></ul>" ));
410 pickButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"pick.png") );
414 pickButton_->setToolTip(tr(
"Switch to <b>picking</b> mode."));
416 "Switch to <b>picking</b> mode.<br>" 417 "Use picking functions like flipping edges.<br>" 418 "To change the mode use the right click<br>" 419 "context menu in the viewer."));
425 questionButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"help-about.png") );
429 questionButton_->setToolTip(tr(
"Switch to <b>identification</b> mode."));
431 "Switch to <b>identification</b> mode.<br>" 432 "Use identification mode to get information " 433 "about objects. Click on an object and see " 434 "the log output for information about the " 444 "Switch <b>viewer layout</b>.<br>" 445 "Select the desired viewer layout. " 446 "Possible layouts are: " 448 "<li>Single viewer</li>" 449 "<li>Double viewer</li>" 450 "<li>Multiple viewers (grid)</li>" 451 "<li>Multiple viewers (hsplit)</li>" 454 viewerLayoutBox_->addItem(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"singleviewmode.png"),
"");
455 viewerLayoutBox_->addItem(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"doubleviewmode.png"),
"");
456 viewerLayoutBox_->addItem(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"multiviewmode1.png"),
"");
457 viewerLayoutBox_->addItem(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"multiviewmode2.png"),
"");
467 if (OpenFlipper::Options::stereo())
470 stereoButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"mono.png") );
478 "Toggle stereo mode<br><br>" 479 "Use this button to switch between stereo " 480 "and mono view. To use this feature you need " 481 "a stereo capable graphics card and a stereo " 482 "display/projection system."));
487 stereoAction->setText( tr(
"Stereo"));
497 if(wsizes.size() > 1) {
511 QHBoxLayout *hLayout =
new QHBoxLayout;
522 viewModePopupBtn_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"preferences.png"));
530 SIGNAL(changeView(QString, QStringList, QStringList, QStringList)),
532 SLOT(
slotChangeView(QString, QStringList, QStringList, QStringList)));
539 hLayout->setContentsMargins(0, 0, 0, 0);
540 hLayout->addStretch(1);
557 QVBoxLayout *vLayout =
new QVBoxLayout;
560 vLayout->setContentsMargins(0, 0, 0, 0);
561 vLayout->setSpacing(0);
574 if (
OpenFlipperSettings().value(
"Core/Gui/ToolBoxes/ToolBoxOnTheRight",
true).toBool() ) {
596 for (
unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
597 connect(
examiner_widgets_[i] , SIGNAL(signalCustomContextMenuRequested(
const QPoint&) ) ,
606 statusBar_->showMessage(tr(
"Ready"), 5000);
612 setWindowIcon( OpenFlipper::Options::OpenFlipperIcon() );
662 return PluginStorage::plugins();
684 setWindowState( windowState() | Qt::WindowFullScreen);
686 if ( windowState() & Qt::WindowFullScreen )
687 setWindowState( windowState() ^ Qt::WindowFullScreen);
702 if ( OpenFlipper::Options::gui() && ( !_show !=
OpenFlipperSettings().value(
"Core/Gui/TaskSwitcher/Hide",
false).toBool() ) ) {
788 for (uint p=0; p <
plugins().size(); p++)
789 for ( uint j = 0 ; j <
plugins()[p].toolbars.size(); ++j ) {
790 if ( !
plugins()[p].toolbars[j].second->isFloating() )
791 plugins()[p].toolbars[j].second->hide();
797 setViewMode( OpenFlipper::Options::currentViewMode() );
826 if ( _toolBoxRight != currentstate ) {
844 QSettings windowStates(QDir::home().absolutePath() + OpenFlipper::Options::dirSeparator() +
".OpenFlipper" +
845 OpenFlipper::Options::dirSeparator() +
"WindowStates.dat", QSettings::IniFormat);
847 windowStates.value(
"Core/ToolSplitter");
863 if ( OpenFlipper::Options::sceneGraphUpdatesBlocked() )
return;
865 OpenFlipper::Options::addRecentFile(_filename, _type);
884 for (
int i = 0 ; i < recentFiles.size() ; ++i ) {
886 QFileInfo fi(recentFiles[i]);
888 QAction* newAction = 0;
890 if (fi.suffix() ==
"ini") {
891 newAction =
recentFilesMenu_->addAction(QIcon(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator()+
"Settings-Icon.png"), recentFiles[i]);
892 newAction->setData( QVariant( QString(
"Unknown") ) );
895 newAction->setData( QVariant( recentTypes[i]) );
913 if ( OpenFlipper::Options::nogui() )
920 connect(
optionsWidget_,SIGNAL(addKeyMapping(
int,Qt::KeyboardModifiers,QObject*,
int)),
923 optionsWidget_->setWindowIcon( OpenFlipper::Options::OpenFlipperIcon() );
928 center.setX( x() + width() / 2 );
929 center.setY( y() + height() / 2 );
943 case QtMultiViewLayout::SingleView:
950 case QtMultiViewLayout::DoubleView:
957 case QtMultiViewLayout::Grid:
964 case QtMultiViewLayout::HSplit:
999 emit log(
LOGERR,tr(
"Requested illegal multiview mode!"));
1017 for (
unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
1044 CoreWidget::startVideoCaptureDialog(){
1047 dialog->setModal(
false);
1049 connect(dialog, SIGNAL(startVideoCapture(QString,
int,
bool)),
this, SIGNAL(startVideoCapture(QString,
int,
bool)) );
1050 connect(dialog, SIGNAL(resizeViewers(
int,
int)),
this, SIGNAL(resizeViewers(
int,
int)) );
1051 connect(dialog, SIGNAL(resizeApplication(
int,
int)),
this, SIGNAL(resizeApplication(
int,
int)) );
1065 for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
1070 if (postProcessorDialog_)
1071 postProcessorDialog_->
refresh();
1091 if( _event->type() == QEvent::WhatsThisClicked )
1093 QWhatsThisClickedEvent *wtcEvent =
static_cast<QWhatsThisClickedEvent*
>(_event);
1094 QWhatsThis::hideText();
1099 return QMainWindow::event(_event);
void slotActivateExaminer()
void setViewMode(QString _mode, bool _expandAll=false)
Set the view Mode to the given Mode.
QToolButton * viewModePopupBtn_
view mode gear icon at the upper left of the tool box
static ShaderCache * getInstance()
Return instance of the ShaderCache singleton.
LoggerWidget * logWidget_
Textedit at the bottom for log messages.
void slotViewModeDialog()
Show a dialog in which the viewMode can be edited.
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
void setPrimary(unsigned int _i)
Sets primary element for SingleView and HSplit.
void closeChangeViewModePopup()
Closes the change view mode popup.
QComboBox * viewerLayoutBox_
Called by Plugins to add a Toolbar.
void slotAddKeyMapping(int _key, Qt::KeyboardModifiers _modifiers, QObject *_plugin, int _keyBindingID)
add a new key Mapping
void toggleFullscreen()
Set application to Fullscreen and back.
bool visible() const
PickMode visible.
void toolBoxVisChanged(bool _state)
will be emitted if the visibility of the toolbox is changed
void slotChangeView(QString _mode, QStringList _toolboxWidgets, QStringList _toolbars, QStringList _contextmenus, bool _expandAll=false)
Slot for Changing visible toolWidgets.
QGraphicsWidget * centerWidget_
center widged
QSplitter * splitter_
Spliter between toplevel objects and the textedit at the bottom.
void shareGLWidget(OFGLWidget *_widget)
Sets the main QGLWidget for gl data sharing.
void setToolBoxOrientationOnTheRight(bool _toolBoxRight)
Set orientation of tool box (either on the right or the left side of the screen)
void showViewModeControls(bool _show)
Hide or show the View Mode controls.
QToolButton * stereoButton_
Called by Plugins to add a Toolbar.
QWidget * toolBoxArea_
Widget for toolBox.
void closeEvent(QCloseEvent *event)
Called on applications close.
CursorPainter * cursorPainter_
Cursor handling.
QToolButton * moveButton_
Called by Plugins to add a Toolbar.
unsigned int activeExaminer()
Get the id of the examiner which got the last mouse events.
void showOptionsWidget()
Display the Options Browser.
void setViewers(std::vector< glViewer * > _viewerWidgets)
Set the internal Viewer pointer ( DO NOT USE!! )
void addRecent(QString _filename, DataType _type)
Add a recent file and update menu.
void toggleToolBar()
Hide or show current toolbar.
void showHelpBrowser(const QString &page=homePage_)
Display the help Browser.
StereoSettingsWidget * stereoSettingsWidget_
Widget to change stereo settings.
void slotShowSceneGraphDialog()
void registerViewer(glViewer *_viewer)
Add a glViewer that will use this CursorPainter.
void updateRecent()
Update the recent files menu.
void setForceNativeCursor(bool _state)
Use native or gl painted cursor.
void setValue(const QString &key, const QVariant &value)
Wrapper function which makes it possible to enable Debugging output with -DOPENFLIPPER_SETTINGS_DEBUG...
ACG::QtWidgets::QtSceneGraphDialog * sceneGraphDialog_
Handle to picking toolbar.
QtGLGraphicsScene * glScene_
graphics scene used to paint gl context and widgets
QWidget * viewModeControlBox_
Group box containing Task Switcher Controls.
std::vector< PluginInfo > & plugins()
Convenient way to access plugin list.
void setActionMode(const Viewer::ActionMode _am)
void setDebugOutputDir(const char *_outputDir)
Enable debug output of generated shaders to specified directory.
bool stereoActive_
The viewer with id _viewerId changed its draw Mode.
SideArea * toolBox_
Toolbox.
void setTimeCheck(bool _on)
enable or disable checking of the time step of each file
void getPickMode(std::string &_name)
void slotAddToolbar(QToolBar *_toolbar)
Called by Plugins to add a Toolbar.
void setViewerLayout(int _idx)
Change viewer layout that was selected in the combo box.
QMenu * recentFilesMenu_
QMenu containing the recently opened files.
void setActiveExaminer(const unsigned int _id)
Set the active id of the examiner which got the last mouse events.
void setMode(MultiViewMode _mode)
Sets layout mode.
QAction * AC_ShowViewModeControls_
Action for View Mode Widget Conrol in Menu.
void menuBarVisChanged(bool _state)
will be emitted if the visibility of the menubar is changed
void addCoreLicenseInfo()
Add license information about core parts.
QAction * viewModeButton_
a List of all widgets in the toolbar
QMenu * contextSelectionMenu_
Context Menu containing all selection elements.
void refresh()
refreshes the content of the dialog with current examiner
ActionMode
Enum listing action modes of the viewers.
void analyzeSceneGraph(ACG::SceneGraph::BaseNode *_root, unsigned int &_maxPasses, ACG::Vec3d &_bbmin, ACG::Vec3d &_bbmax)
Analyze the SceneGraph <ACG/Scenegraph/SceneGraphAnalysis.hh>
static const QString homePage_
Pointer to the help Browser.
void stereoButtonContextMenu(const QPoint &_pos)
Creates custom context menu for stereo viewer settings.
QSize defaultIconSize_
Show logger in splitter or not.
void showToolbox(bool _state)
Show or hide toolbox.
void dropEvent(QDropEvent *_event)
QToolBar * toolbar() const
PickMode toolbar.
int originalLoggerSize_
Size of the logging window ( defaults to 240 )
QMenu * contextMenu_
context Menu for the gl area
void slotApplyStereoSettings(int _tmpParam=0)
QScrollArea * toolBoxScroll_
Toolbox scroll area.
std::vector< KeyBinding > coreKeys_
vector of keys registered to the core
bool tracking() const
PickMode mouse tracking.
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
bool event(QEvent *event)
typedefs
OptionsWidget * optionsWidget_
Pointer to the OptionsWidget.
DLLEXPORT QIcon & typeIcon(DataType _id)
Get an QIcon associated with the given DataType.
QWidgetAction * viewModeChangePopupAction_
Handle to picking toolbar.
void changeHelpSite(QUrl)
Pointer to the help Browser.
void addItem(QGraphicsWidget *_item, unsigned int _pos)
Adds Widget to Layout.
QToolButton * pickButton_
Called by Plugins to add a Toolbar.
void sceneGraph(ACG::SceneGraph::BaseNode *_root, unsigned int _maxPasses, ACG::Vec3d _bbmin, ACG::Vec3d _bbmax, const bool _resetTrackBall=false)
void sceneRectChanged(const QRectF &rect)
void dragEnterEvent(QDragEnterEvent *_event)
viewModeChangeWidget * modeChangeWidget
Handle to picking toolbar.
std::string name() const
PickMode Name.
QToolBar * mainToolbar_
Called by Plugins to add a Toolbar.
void setFullscreen(bool _state)
Enable or disable fullscreen mode.
OFGLWidget * glWidget_
gl widget used as drawing area to paint the graphics scene
void setPickMode(const std::string &_name)
void updateGeometry()
recalculate geometry
std::string name_
Name of the pickMode.
QtSlideWindow * slidingLogger_
Class that holds the animated log widget.
CoreWidget(QVector< ViewMode *> &_viewModes, QList< SlotInfo > &_coreSlots)
constructor
void getActionMode(Viewer::ActionMode &_am)
void setEnabled(bool _enabled)
Enabled/Disables gl cursor painting.
void registerCoreKeys()
Register all events related to the core.
std::vector< QAction * > extended_actions
QToolButton * questionButton_
Called by Plugins to add a Toolbar.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
void setForceNative(bool _enabled)
Enabled/Disables native cursors.
void saveOptions()
Pointer to the OptionsWidget.
void fullScreenChanged(bool _state)
will be emitted if the fullscreen state is changed (_state = true => in fullscreen) ...
OpenFlipper::Options::LoggerState loggerState_
Show logger in splitter or not.
InverseKeyMap invKeys_
mapping of all registered keys and the corresponding plugins to currently assigned keys ...
std::vector< glViewer *> examiner_widgets_
Examiner Widget.
HelpWidget * helpWidget_
Pointer to the help Browser.
void toggleToolbox()
Hide or show toolbox area.
QtMultiViewLayout * baseLayout_
Base layout that holds gl views.
MultiViewMode mode() const
Retruns current layout modes.
std::vector< StackWidgetInfo > stackWidgetList_
QMenu containing the recently opened files.
void setGeneratorMap(QMap< std::string, SceneGraphWidgetGenerator * > _map)
Set a complete generator map (this will overwrite the existing one!
void toggleMenuBar()
Hide or show menu bar.
QStackedWidget * stackedWidget_
Container widget for holding multiple views.
void applyOptions()
Pointer to the OptionsWidget.
QtGLGraphicsView * glView_
graphics view that holds the gl scene
QToolBar * viewerToolbar_
Called by Plugins to add a Toolbar.
void slotToggleStereoMode()
Enable or disable Stereo.
QVector< ViewMode * > & viewModes_
List of currently available viewModes.
void showLoggerInSplitView(bool _show)
Show logger in splitter or not.
void setupMenuBar()
Setup the main menubar.
void toolBarVisChanged(bool _state)
will be emitted if the visibility of the toolbar is changed
PickMode(const std::string &_n, const bool _t, const bool _v, QCursor _c, QToolBar *_tb=0)
Constructor.
Implementation of the logger Widget.
DLLEXPORT DataType typeId(QString _name)
Given a dataType Identifier string this function will return the id of the datatype.
void startDrag(QMouseEvent *_event)
void drawModeChanged(int _viewerId)
The viewer with id _viewerId changed its draw Mode.
void showMenuBar(bool _state)
Show or hide menubar.
QSplitter * toolSplitter_
Spliter between toplevel objects and toolbox.
void showToolBar(bool _state)
Show or hide toolbar, emits toolBarToggled( bool _state )
ACG::SceneGraph::BaseNode * getSceneGraphRootNode()
get scenegraph root node
void attachWidget(QWidget *_m)
attach a child widget
void slotCustomContextMenu(const QPoint &_point)
This slot is called by the examiner widgets gl area when a context menu is requested.
QCursor cursor() const
PickMode cursor.
void nextViewerLayout()
Switches over to the next view mode.