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 shareGLWidget(OFGLWidget *_widget)
Sets the main QGLWidget for gl data sharing.
bool visible() const
PickMode visible.
void setEnabled(bool _enabled)
Enabled/Disables gl cursor painting.
void updateGeometry()
recalculate geometry
void setDebugOutputDir(const char *_outputDir)
Enable debug output of generated shaders to specified directory.
ActionMode
Enum listing action modes of the viewers.
void setPrimary(unsigned int _i)
Sets primary element for SingleView and HSplit.
void setTimeCheck(bool _on)
enable or disable checking of the time step of each file
ACG::SceneGraph::BaseNode * getSceneGraphRootNode()
get scenegraph root node
unsigned int activeExaminer()
Get the id of the examiner which got the last mouse events.
QToolBar * toolbar() const
PickMode toolbar.
static ShaderCache * getInstance()
Return instance of the ShaderCache singleton.
void refresh()
refreshes the content of the dialog with current examiner
void setMode(MultiViewMode _mode)
Sets layout mode.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
void analyzeSceneGraph(ACG::SceneGraph::BaseNode *_root, unsigned int &_maxPasses, ACG::Vec3d &_bbmin, ACG::Vec3d &_bbmax)
Analyze the SceneGraph <ACG/Scenegraph/SceneGraphAnalysis.hh>
void addItem(QGraphicsWidget *_item, unsigned int _pos)
Adds Widget to Layout.
void registerViewer(glViewer *_viewer)
Add a glViewer that will use this CursorPainter.
void setViewers(const std::vector< glViewer * > &_viewerWidgets)
Set the internal Viewer pointer ( DO NOT USE!! )
void attachWidget(QWidget *_m)
attach a child widget
std::string name_
Name of the pickMode.
void setActiveExaminer(const unsigned int _id)
Set the active id of the examiner which got the last mouse events.
QCursor cursor() const
PickMode cursor.
void setForceNative(bool _enabled)
Enabled/Disables native cursors.
PickMode(const std::string &_n, const bool _t, const bool _v, QCursor _c, QToolBar *_tb=0)
Constructor.
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
MultiViewMode mode() const
Retruns current layout modes.
void setValue(const QString &key, const QVariant &value)
Wrapper function which makes it possible to enable Debugging output with -DOPENFLIPPER_SETTINGS_DEBUG...
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
std::string name() const
PickMode Name.
DLLEXPORT QIcon & typeIcon(DataType _id)
Get an QIcon associated with the given DataType.
void sceneGraph(ACG::SceneGraph::BaseNode *_root, unsigned int _maxPasses, ACG::Vec3d _bbmin, ACG::Vec3d _bbmax, const bool _resetTrackBall=false)
DLLEXPORT DataType typeId(QString _name)
Given a dataType Identifier string this function will return the id of the datatype.
bool tracking() const
PickMode mouse tracking.