65 #include <OpenFlipper/common/RecentFiles.hh> 66 #include <OpenFlipper/BasePlugin/PluginFunctionsCore.hh> 68 #include <OpenFlipper/widgets/videoCaptureDialog/VideoCaptureDialog.hh> 71 #include <ACG/GL/ShaderCache.hh> 76 #define WIDGET_HEIGHT 800 77 #define WIDGET_WIDTH 800 81 PickMode::PickMode(
const std::string& _n,
const bool _t,
const bool _v, QCursor _c, QToolBar *_tb ) :
139 std::vector<PluginInfo>& _plugins,
140 QList< SlotInfo >& _coreSlots ) :
142 coreSlots_(_coreSlots),
143 shiftPressed_(false),
144 viewModes_(_viewModes),
152 AC_ShowViewModeControls_(0),
153 pickToolBarExternal_(0),
155 sceneGraphDialog_(0),
156 viewModeChangePopupAction_(0),
171 perspectiveProjectionAction_(0),
173 availableGlobalDrawModes_(0),
175 contextSelectionMenu_(0),
178 viewerDrawMenuWidget_(0),
184 postProcessorDialog_(0),
186 rendererObjectWidget_(0),
187 stereoSettingsWidget_(0),
191 stereoActive_(false),
192 actionMode_(
Viewer::PickingMode),
193 lastActionMode_(
Viewer::ExamineMode),
210 QGLFormat format = QGLFormat::defaultFormat();
213 format.setStereo(
false);
215 format.setStereo( OpenFlipper::Options::stereo() );
217 format.setAlpha(
true);
218 format.setStencil(
true);
219 format.setSampleBuffers(
true);
220 QGLFormat::setDefaultFormat(format);
231 QGLWidget*
test =
new QGLWidget(format);
232 if ( ! test->format().stereo() ) {
234 format.setStereo(
false);
235 QGLFormat::setDefaultFormat(format);
244 format.setProfile(QGLFormat::CompatibilityProfile);
246 #if QT_VERSION >= 0x050000 249 format.setVersion(4,3);
259 OpenFlipper::Options::glStereo(
glWidget_->format().stereo());
262 glView_->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
264 glView_->setFrameStyle(QFrame::NoFrame);
289 logWidget_->setSizePolicy( QSizePolicy ( QSizePolicy::Preferred , QSizePolicy::Preferred ) );
301 if (OpenFlipper::Options::loggerState() == OpenFlipper::Options::InScene) {
307 }
else if (OpenFlipper::Options::loggerState() == OpenFlipper::Options::Hidden) {
322 unsigned int maxPases = 1;
326 if ( !
OpenFlipperSettings().value(
"Core/Gui/glViewer/useMultipleViewers",
true).toBool() ) {
345 for (
unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
354 this, SLOT(
getPickMode(std::string&) ),Qt::DirectConnection );
356 this, SLOT(
setPickMode(
const std::string) ),Qt::DirectConnection );
366 for (
unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
389 for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
401 statusBar_, SLOT(showMessage(
const QString&,
int)));
429 moveButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"transform-move.png") );
433 moveButton_->setToolTip( tr(
"Switch to <b>move</b> mode.") );
435 "Switch to <b>move</b> mode.<br>" 436 "<ul><li><b>Rotate</b> using <b>left</b> mouse button.</li>" 437 "<li><b>Translate</b> using <b>middle</b> mouse button.</li>" 438 "<li><b>Zoom</b> using <b>left+middle</b> mouse buttons.</li></ul>" ));
450 pickButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"pick.png") );
454 pickButton_->setToolTip(tr(
"Switch to <b>picking</b> mode."));
456 "Switch to <b>picking</b> mode.<br>" 457 "Use picking functions like flipping edges.<br>" 458 "To change the mode use the right click<br>" 459 "context menu in the viewer."));
465 questionButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"help-about.png") );
469 questionButton_->setToolTip(tr(
"Switch to <b>identification</b> mode."));
471 "Switch to <b>identification</b> mode.<br>" 472 "Use identification mode to get information " 473 "about objects. Click on an object and see " 474 "the log output for information about the " 484 "Switch <b>viewer layout</b>.<br>" 485 "Select the desired viewer layout. " 486 "Possible layouts are: " 488 "<li>Single viewer</li>" 489 "<li>Double viewer</li>" 490 "<li>Multiple viewers (grid)</li>" 491 "<li>Multiple viewers (hsplit)</li>" 494 viewerLayoutBox_->addItem(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"singleviewmode.png"),
"");
495 viewerLayoutBox_->addItem(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"doubleviewmode.png"),
"");
496 viewerLayoutBox_->addItem(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"multiviewmode1.png"),
"");
497 viewerLayoutBox_->addItem(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"multiviewmode2.png"),
"");
507 if (OpenFlipper::Options::stereo())
510 stereoButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"mono.png") );
518 "Toggle stereo mode<br><br>" 519 "Use this button to switch between stereo " 520 "and mono view. To use this feature you need " 521 "a stereo capable graphics card and a stereo " 522 "display/projection system."));
527 stereoAction->setText( tr(
"Stereo"));
537 if(wsizes.size() > 1) {
551 QHBoxLayout *hLayout =
new QHBoxLayout;
562 viewModePopupBtn_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"preferences.png"));
570 SIGNAL(changeView(QString, QStringList, QStringList, QStringList)),
572 SLOT(
slotChangeView(QString, QStringList, QStringList, QStringList)));
579 hLayout->setContentsMargins(0, 0, 0, 0);
580 hLayout->addStretch(1);
597 QVBoxLayout *vLayout =
new QVBoxLayout;
600 vLayout->setContentsMargins(0, 0, 0, 0);
601 vLayout->setSpacing(0);
614 if (
OpenFlipperSettings().value(
"Core/Gui/ToolBoxes/ToolBoxOnTheRight",
true).toBool() ) {
636 for (
unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
637 connect(
examiner_widgets_[i] , SIGNAL(signalCustomContextMenuRequested(
const QPoint&) ) ,
646 statusBar_->showMessage(tr(
"Ready"), 5000);
652 setWindowIcon( OpenFlipper::Options::OpenFlipperIcon() );
717 setWindowState( windowState() | Qt::WindowFullScreen);
719 if ( windowState() & Qt::WindowFullScreen )
720 setWindowState( windowState() ^ Qt::WindowFullScreen);
735 if ( OpenFlipper::Options::gui() && ( !_show !=
OpenFlipperSettings().value(
"Core/Gui/TaskSwitcher/Hide",
false).toBool() ) ) {
821 for (uint p=0; p < plugins_.size(); p++)
822 for ( uint j = 0 ; j < plugins_[p].toolbars.size(); ++j ) {
823 if ( ! plugins_[p].toolbars[j].second->isFloating() )
824 plugins_[p].toolbars[j].second->hide();
830 setViewMode( OpenFlipper::Options::currentViewMode() );
859 if ( _toolBoxRight != currentstate ) {
877 QSettings windowStates(QDir::home().absolutePath() + OpenFlipper::Options::dirSeparator() +
".OpenFlipper" +
878 OpenFlipper::Options::dirSeparator() +
"WindowStates.dat", QSettings::IniFormat);
880 windowStates.value(
"Core/ToolSplitter");
896 if ( OpenFlipper::Options::sceneGraphUpdatesBlocked() )
return;
898 OpenFlipper::Options::addRecentFile(_filename, _type);
917 for (
int i = 0 ; i < recentFiles.size() ; ++i ) {
919 QFileInfo fi(recentFiles[i]);
921 QAction* newAction = 0;
923 if (fi.suffix() ==
"ini") {
924 newAction =
recentFilesMenu_->addAction(QIcon(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator()+
"Settings-Icon.png"), recentFiles[i]);
925 newAction->setData( QVariant( QString(
"Unknown") ) );
928 newAction->setData( QVariant( recentTypes[i]) );
942 if ( OpenFlipper::Options::nogui() )
949 connect(
optionsWidget_,SIGNAL(addKeyMapping(
int,Qt::KeyboardModifiers,QObject*,
int)),
952 optionsWidget_->setWindowIcon( OpenFlipper::Options::OpenFlipperIcon() );
957 center.setX( x() + width() / 2 );
958 center.setY( y() + height() / 2 );
972 case QtMultiViewLayout::SingleView:
979 case QtMultiViewLayout::DoubleView:
986 case QtMultiViewLayout::Grid:
993 case QtMultiViewLayout::HSplit:
1008 if (
OpenFlipperSettings().value(
"Core/Gui/glViewer/useMultipleViewers",
true).toBool() ) {
1028 emit log(
LOGERR,tr(
"Requested illegal multiview mode!"));
1046 for (
unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
1073 CoreWidget::startVideoCaptureDialog(){
1076 dialog->setModal(
false);
1078 connect(dialog, SIGNAL(startVideoCapture(QString,
int,
bool)),
this, SIGNAL(startVideoCapture(QString,
int,
bool)) );
1079 connect(dialog, SIGNAL(resizeViewers(
int,
int)),
this, SIGNAL(resizeViewers(
int,
int)) );
1080 connect(dialog, SIGNAL(resizeApplication(
int,
int)),
this, SIGNAL(resizeApplication(
int,
int)) );
1094 for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
1099 if (postProcessorDialog_)
1100 postProcessorDialog_->
refresh();
1120 if( _event->type() == QEvent::WhatsThisClicked )
1122 QWhatsThisClickedEvent *wtcEvent =
static_cast<QWhatsThisClickedEvent*
>(_event);
1123 QWhatsThis::hideText();
1128 return QMainWindow::event(_event);
void sceneGraph(ACG::SceneGraph::BaseNode *_root, unsigned int _maxPasses, ACG::Vec3d _bbmin, ACG::Vec3d _bbmax, const bool _resetTrackBall=false)
bool visible() const
PickMode visible.
std::vector< QAction * > extended_actions
void updateGeometry()
recalculate geometry
LoggerWidget * logWidget_
Textedit at the bottom for log messages.
QToolBar * viewerToolbar_
Called by Plugins to add a Toolbar.
void registerViewer(glViewer *_viewer)
Add a glViewer that will use this CursorPainter.
void setEnabled(bool _enabled)
Enabled/Disables gl cursor painting.
void setToolBoxOrientationOnTheRight(bool _toolBoxRight)
Set orientation of tool box (either on the right or the left side of the screen)
DLLEXPORT DataType typeId(QString _name)
Given a dataType Identifier string this function will return the id of the datatype.
void getPickMode(std::string &_name)
void fullScreenChanged(bool _state)
will be emitted if the fullscreen state is changed (_state = true => in fullscreen) ...
Add normals to mesh item (vertices/faces)
void showLoggerInSplitView(bool _show)
Show logger in splitter or not.
void addRecent(QString _filename, DataType _type)
Add a recent file and update menu.
QtGLGraphicsScene * glScene_
graphics scene used to paint gl context and widgets
bool stereoActive_
The viewer with id _viewerId changed its draw Mode.
QMenu * contextMenu_
context Menu for the gl area
static ShaderCache * getInstance()
Return instance of the ShaderCache singleton.
QtMultiViewLayout * baseLayout_
Base layout that holds gl views.
void showToolbox(bool _state)
Show or hide toolbox.
QToolButton * questionButton_
Called by Plugins to add a Toolbar.
void slotApplyStereoSettings(int _tmpParam=0)
QMenu * contextSelectionMenu_
Context Menu containing all selection elements.
void showHelpBrowser(const QString &page=homePage_)
Display the help Browser.
QSplitter * toolSplitter_
Spliter between toplevel objects and toolbox.
QSize defaultIconSize_
Show logger in splitter or not.
bool event(QEvent *event)
typedefs
void setActiveExaminer(const unsigned int _id)
Set the active id of the examiner which got the last mouse events.
void dropEvent(QDropEvent *_event)
Implementation of the logger Widget.
std::vector< KeyBinding > coreKeys_
vector of keys registered to the core
void updateRecent()
Update the recent files menu.
void setForceNativeCursor(bool _state)
Use native or gl painted cursor.
QtGLGraphicsView * glView_
graphics view that holds the gl scene
void addCoreLicenseInfo()
Add license information about core parts.
void setFullscreen(bool _state)
Enable or disable fullscreen mode.
void toggleFullscreen()
Set application to Fullscreen and back.
StereoSettingsWidget * stereoSettingsWidget_
Widget to change stereo settings.
void toolBarVisChanged(bool _state)
will be emitted if the visibility of the toolbar is changed
void setPickMode(const std::string &_name)
QGraphicsWidget * centerWidget_
center widged
SideArea * toolBox_
Toolbox.
void slotActivateExaminer()
void closeChangeViewModePopup()
Closes the change view mode popup.
void setViewMode(QString _mode, bool _expandAll=false)
Set the view Mode to the given Mode.
void addItem(QGraphicsWidget *_item, unsigned int _pos)
Adds Widget to Layout.
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
void slotViewModeDialog()
Show a dialog in which the viewMode can be edited.
void attachWidget(QWidget *_m)
attach a child widget
void menuBarVisChanged(bool _state)
will be emitted if the visibility of the menubar is changed
QAction * AC_ShowViewModeControls_
Action for View Mode Widget Conrol in Menu.
void setupMenuBar()
Setup the main menubar.
void setGeneratorMap(QMap< std::string, SceneGraphWidgetGenerator * > _map)
Set a complete generator map (this will overwrite the existing one!
void shareGLWidget(QGLWidget *_widget)
Sets the main QGLWidget for gl data sharing.
void toggleToolBar()
Hide or show current toolbar.
void slotChangeView(QString _mode, QStringList _toolboxWidgets, QStringList _toolbars, QStringList _contextmenus, bool _expandAll=false)
Slot for Changing visible toolWidgets.
QSplitter * splitter_
Spliter between toplevel objects and the textedit at the bottom.
QStackedWidget * stackedWidget_
Container widget for holding multiple views.
ACG::QtWidgets::QtSceneGraphDialog * sceneGraphDialog_
Handle to picking toolbar.
QWidget * toolBoxArea_
Widget for toolBox.
QGLWidget * glWidget_
gl widget used as drawing area to paint the graphics scene
void toolBoxVisChanged(bool _state)
will be emitted if the visibility of the toolbox is changed
CoreWidget(QVector< ViewMode * > &_viewModes, std::vector< PluginInfo > &_plugins, QList< SlotInfo > &_coreSlots)
constructor
QWidget * viewModeControlBox_
Group box containing Task Switcher Controls.
QToolButton * moveButton_
Called by Plugins to add a Toolbar.
void dragEnterEvent(QDragEnterEvent *_event)
void setViewerLayout(int _idx)
Change viewer layout that was selected in the combo box.
QWidgetAction * viewModeChangePopupAction_
Handle to picking toolbar.
CursorPainter * cursorPainter_
Cursor handling.
void setValue(const QString &key, const QVariant &value)
Wrapper function which makes it possible to enable Debugging output with -DOPENFLIPPER_SETTINGS_DEBUG...
QAction * viewModeButton_
a List of all widgets in the toolbar
QToolBar * mainToolbar_
Called by Plugins to add a Toolbar.
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
InverseKeyMap invKeys_
mapping of all registered keys and the corresponding plugins to currently assigned keys ...
viewModeChangeWidget * modeChangeWidget
Handle to picking toolbar.
void setTimeCheck(bool _on)
enable or disable checking of the time step of each file
PickMode(const std::string &_n, const bool _t, const bool _v, QCursor _c, QToolBar *_tb=0)
Constructor.
void analyzeSceneGraph(ACG::SceneGraph::BaseNode *_root, unsigned int &_maxPasses, ACG::Vec3d &_bbmin, ACG::Vec3d &_bbmax)
Analyze the SceneGraph <ACG/Scenegraph/SceneGraphAnalysis.hh>
void slotToggleStereoMode()
Enable or disable Stereo.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
std::string name_
Name of the pickMode.
QToolButton * stereoButton_
Called by Plugins to add a Toolbar.
void showMenuBar(bool _state)
Show or hide menubar.
OpenFlipper::Options::LoggerState loggerState_
Show logger in splitter or not.
void setPrimary(unsigned int _i)
Sets primary element for SingleView and HSplit.
MultiViewMode mode() const
Retruns current layout modes.
void setMode(MultiViewMode _mode)
Sets layout mode.
static const QString homePage_
Pointer to the help Browser.
QToolButton * viewModePopupBtn_
view mode gear icon at the upper left of the tool box
HelpWidget * helpWidget_
Pointer to the help Browser.
unsigned int activeExaminer()
Get the id of the examiner which got the last mouse events.
void showToolBar(bool _state)
Show or hide toolbar, emits toolBarToggled( bool _state )
void slotCustomContextMenu(const QPoint &_point)
This slot is called by the examiner widgets gl area when a context menu is requested.
void slotAddToolbar(QToolBar *_toolbar)
Called by Plugins to add a Toolbar.
QComboBox * viewerLayoutBox_
Called by Plugins to add a Toolbar.
QCursor cursor() const
PickMode cursor.
void setViewers(std::vector< glViewer * > _viewerWidgets)
Set the internal Viewer pointer ( DO NOT USE!! )
void refresh()
refreshes the content of the dialog with current examiner
int originalLoggerSize_
Size of the logging window ( defaults to 240 )
void slotShowSceneGraphDialog()
void applyOptions()
Pointer to the OptionsWidget.
ActionMode
Enum listing action modes of the viewers.
QToolBar * toolbar() const
PickMode toolbar.
std::vector< glViewer * > examiner_widgets_
Examiner Widget.
void setForceNative(bool _enabled)
Enabled/Disables native cursors.
std::string name() const
PickMode Name.
void registerCoreKeys()
Register all events related to the core.
void setDebugOutputDir(const char *_outputDir)
Enable debug output of generated shaders to specified directory.
void sceneRectChanged(const QRectF &rect)
void showOptionsWidget()
Display the Options Browser.
QMenu * recentFilesMenu_
QMenu containing the recently opened files.
void toggleToolbox()
Hide or show toolbox area.
OptionsWidget * optionsWidget_
Pointer to the OptionsWidget.
QScrollArea * toolBoxScroll_
Toolbox scroll area.
void closeEvent(QCloseEvent *event)
Called on applications close.
ACG::SceneGraph::BaseNode * getSceneGraphRootNode()
get scenegraph root node
void drawModeChanged(int _viewerId)
The viewer with id _viewerId changed its draw Mode.
QMap< std::string,ACG::QtWidgets::SceneGraphWidgetGenerator * > getSceneGraphGeneratorList()
Add a scenegraph generator ( the handled type will be extracted from the generator) ...
void stereoButtonContextMenu(const QPoint &_pos)
Creates custom context menu for stereo viewer settings.
void nextViewerLayout()
Switches over to the next view mode.
QtSlideWindow * slidingLogger_
Class that holds the animated log widget.
void startDrag(QMouseEvent *_event)
void setActionMode(const Viewer::ActionMode _am)
std::vector< StackWidgetInfo > stackWidgetList_
QMenu containing the recently opened files.
DLLEXPORT QIcon & typeIcon(DataType _id)
Get an QIcon associated with the given DataType.
void changeHelpSite(QUrl)
Pointer to the help Browser.
void saveOptions()
Pointer to the OptionsWidget.
void getActionMode(Viewer::ActionMode &_am)
void toggleMenuBar()
Hide or show menu bar.
void slotAddKeyMapping(int _key, Qt::KeyboardModifiers _modifiers, QObject *_plugin, int _keyBindingID)
add a new key Mapping
QVector< ViewMode * > & viewModes_
List of currently available viewModes.
bool tracking() const
PickMode mouse tracking.
void showViewModeControls(bool _show)
Hide or show the View Mode controls.
QToolButton * pickButton_
Called by Plugins to add a Toolbar.