Commit 9daa0b9d authored by Jan Möbius's avatar Jan Möbius

Removed function Menu from local examiner and move it to corewidget

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@4464 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 0ca38467
......@@ -204,92 +204,95 @@ void CoreWidget::updatePopupMenu(const QPoint& _point, unsigned int _examinerId)
// Add a functions menu
QAction* action;
QMenu* functionMenu = new QMenu("&Functions",contextMenu_);
if ( functionMenu_ == 0 ) {
functionMenu_ = new QMenu("&Functions",contextMenu_);
//====================================================================================================
//====================================================================================================
action = functionMenu->addAction("Set Background Color");
action->setToolTip("Set the background color for the viewer");
connect(action, SIGNAL(triggered()), this, SLOT(changeBackgroundColor()) );
action = functionMenu_->addAction("Set Background Color");
action->setToolTip("Set the background color for the viewer");
connect(action, SIGNAL(triggered()), this, SLOT(changeBackgroundColor()) );
//====================================================================================================
//====================================================================================================
functionMenu->addSeparator();
functionMenu_->addSeparator();
//====================================================================================================
//====================================================================================================
action = functionMenu->addAction("Snapshot");
action->setToolTip("Make a snapshot");
connect(action, SIGNAL(triggered()), this, SLOT( slotSnapshot() ) );
action = functionMenu_->addAction("Snapshot");
action->setToolTip("Make a snapshot");
connect(action, SIGNAL(triggered()), this, SLOT( slotSnapshot() ) );
//====================================================================================================
//====================================================================================================
action = functionMenu->addAction("Set Snapshot Name");
action->setToolTip("Set a name for snapshots");
connect(action, SIGNAL(triggered()), this, SLOT(slotSnapshotName()) );
action = functionMenu_->addAction("Set Snapshot Name");
action->setToolTip("Set a name for snapshots");
connect(action, SIGNAL(triggered()), this, SLOT(slotSnapshotName()) );
//====================================================================================================
//====================================================================================================
functionMenu->addSeparator();
functionMenu_->addSeparator();
//====================================================================================================
//====================================================================================================
action = functionMenu->addAction("Copy View");
action->setToolTip("Copy current view to clipboard");
connect(action, SIGNAL(triggered()), this, SLOT(slotCopyView()) );
action = functionMenu_->addAction("Copy View");
action->setToolTip("Copy current view to clipboard");
connect(action, SIGNAL(triggered()), this, SLOT(slotCopyView()) );
//====================================================================================================
//====================================================================================================
action = functionMenu->addAction("Paste View");
action->setToolTip("Paste current view from clipboard");
connect(action, SIGNAL(triggered()), this , SLOT( slotPasteView( ) ) );
action = functionMenu_->addAction("Paste View");
action->setToolTip("Paste current view from clipboard");
connect(action, SIGNAL(triggered()), this , SLOT( slotPasteView( ) ) );
//====================================================================================================
//====================================================================================================
functionMenu->addSeparator();
functionMenu_->addSeparator();
//====================================================================================================
//====================================================================================================
action = functionMenu->addAction("Synchronization");
action->setToolTip("Synchronize two different viewers");
action->setCheckable( true );
action->setChecked( OpenFlipper::Options::synchronization() );
for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
connect(action, SIGNAL(triggered(bool)), examiner_widgets_[i], SLOT(actionSynchronize(bool)) );
connect(action, SIGNAL(triggered(bool)), this, SLOT(updateGlobalOptions(bool)) );
action = functionMenu_->addAction("Synchronization");
action->setToolTip("Synchronize two different viewers");
action->setCheckable( true );
action->setChecked( OpenFlipper::Options::synchronization() );
for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
connect(action, SIGNAL(triggered(bool)), examiner_widgets_[i], SLOT(setSynchronization(bool)) );
connect(action, SIGNAL(triggered(bool)), this, SLOT(updateGlobalOptions(bool)) );
//====================================================================================================
//====================================================================================================
action = functionMenu->addAction("Animation");
action->setToolTip("Animate rotation of objects");
action->setCheckable( true );
action->setChecked( OpenFlipper::Options::animation() );
for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
connect(action, SIGNAL(triggered(bool)), examiner_widgets_[i], SLOT(actionAnimation(bool)) );
connect(action, SIGNAL(triggered(bool)), this, SLOT(updateGlobalOptions(bool)) );
action = functionMenu_->addAction("Animation");
action->setToolTip("Animate rotation of objects");
action->setCheckable( true );
action->setChecked( OpenFlipper::Options::animation() );
for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
connect(action, SIGNAL(triggered(bool)), examiner_widgets_[i], SLOT(animation(bool)) );
connect(action, SIGNAL(triggered(bool)), this, SLOT(updateGlobalOptions(bool)) );
//====================================================================================================
//====================================================================================================
action = functionMenu->addAction("Backface Culling");
action->setToolTip("Enable backface culling");
action->setCheckable( true );
action->setChecked( OpenFlipper::Options::backfaceCulling() );
for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
connect(action, SIGNAL(triggered(bool)), examiner_widgets_[i], SLOT(actionBackfaceCulling(bool)) );
connect(action, SIGNAL(triggered(bool)), this, SLOT(updateGlobalOptions(bool)) );
action = functionMenu_->addAction("Backface Culling");
action->setToolTip("Enable backface culling");
action->setCheckable( true );
action->setChecked( OpenFlipper::Options::backfaceCulling() );
for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
connect(action, SIGNAL(triggered(bool)), examiner_widgets_[i], SLOT(backFaceCulling(bool)) );
connect(action, SIGNAL(triggered(bool)), this, SLOT(updateGlobalOptions(bool)) );
//====================================================================================================
//====================================================================================================
action = functionMenu->addAction("Two-sided Lighting");
action->setToolTip("Enable two-sided lighting");
action->setCheckable( true );
action->setChecked( OpenFlipper::Options::twoSidedLighting() );
for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
connect(action, SIGNAL(triggered(bool)), examiner_widgets_[i], SLOT(actionTwoSidedLighting(bool)) );
connect(action, SIGNAL(triggered(bool)), this, SLOT(updateGlobalOptions(bool)) );
action = functionMenu_->addAction("Two-sided Lighting");
action->setToolTip("Enable two-sided lighting");
action->setCheckable( true );
action->setChecked( OpenFlipper::Options::twoSidedLighting() );
for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
connect(action, SIGNAL(triggered(bool)), examiner_widgets_[i], SLOT(twoSidedLighting(bool)) );
connect(action, SIGNAL(triggered(bool)), this, SLOT(updateGlobalOptions(bool)) );
functionMenu->setTearOffEnabled(true);
contextMenu_->addMenu(functionMenu );
functionMenu_->setTearOffEnabled(true);
}
contextMenu_->addMenu(functionMenu_ );
if ( ( examiner_widgets_[0]->getDrawMenu() != NULL ) && OpenFlipper::Options::drawModesInContextMenu() ) {
......
......@@ -77,7 +77,14 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
fileMenu_(0),
viewMenu_(0),
fileMenuEnd_(0),
stereoButton_(0),
projectionButton_(0),
moveButton_(0),
lightButton_(0),
pickButton_(0),
questionButton_(0),
contextMenu_(0),
functionMenu_(0),
contextSelectionMenu_(0),
stackMenu_(0),
stackedWidget_(0),
......@@ -131,7 +138,6 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
examinerWidget->disableKeyHandling(true);
examinerWidget->sceneGraph( PluginFunctions::getSceneGraphRootNode() );
examinerWidget->enablePopupMenu(false);
stackedWidget_->addWidget(examinerWidget);
......@@ -164,7 +170,6 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
// Initialize all examiners
for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
examiner_widgets_[i]->sceneGraph( PluginFunctions::getSceneGraphRootNode() );
examiner_widgets_[i]->enablePopupMenu(false);
examiner_widgets_[i]->disableKeyHandling(true);
}
......
......@@ -460,6 +460,9 @@ public:
/// context Menu for the gl area
QMenu* contextMenu_;
/// Function Menu
QMenu* functionMenu_;
/// Context Menu containing all selection elements
QMenu* contextSelectionMenu_;
......@@ -629,6 +632,9 @@ public:
/// Change Icons if action mode is changed in an examiner
void slotActionModeChanged( QtBaseViewer::ActionMode _mode );
/// Called when the functionMenu has to be updated
void slotFunctionMenuUpdate();
private :
bool stereoActive_;
......
......@@ -113,4 +113,25 @@ void CoreWidget::slotActionModeChanged( QtBaseViewer::ActionMode _mode ) {
}
}
void CoreWidget::slotFunctionMenuUpdate() {
std::cerr << "DF" <<std::endl;
if ( examiner_widgets_.empty() )
return;
QList< QAction *> allActions = functionMenu_->actions();
for ( int i = 0 ; i < allActions.size(); ++i ) {
if ( allActions[i]->text() == "Synchronization" )
allActions[i]->setChecked(examiner_widgets_[0]->synchronization());
else if ( allActions[i]->text() == "Animation" )
allActions[i]->setChecked(examiner_widgets_[0]->animation());
else if ( allActions[i]->text() == "Backface Culling" )
allActions[i]->setChecked(examiner_widgets_[0]->backFaceCulling());
else if ( allActions[i]->text() == "Two-sided Lighting" )
allActions[i]->setChecked(examiner_widgets_[0]->twoSidedLighting());
}
}
//=============================================================================
This diff is collapsed.
......@@ -259,18 +259,18 @@ public:
/// Is animation enabled?
bool animation() const { return animation_; }
/// Set animation enabled.
void animation(bool _b);
/// Enable/disable mouse tracking (move events with no button press)
void trackMouse(bool _track);
/// Enable/disable right button draw mode menu (default: enabled)
void enablePopupMenu(bool _enable);
public slots:
/// Set animation enabled.
void animation(bool _b);
signals :
void functionMenuUpdate();
public:
/// Enable/disable mouse tracking (move events with no button press)
void trackMouse(bool _track);
/// Returns: root node of scene graph
......@@ -369,13 +369,19 @@ public:
/// get face orientation
FaceOrientation faceOrientation() const { return faceOrientation_; }
/// set backface culling on/off
void backFaceCulling( bool _b );
public slots:
/// set backface culling on/off
void backFaceCulling( bool _b );
public:
/// is backface culling enabled?
bool backFaceCulling() const { return backFaceCulling_; }
public slots:
/// set 2-sided lighting on/off
void twoSidedLighting( bool _b );
public:
/// is 2-sided lighing enabled?
bool twoSidedLighting() const { return twoSidedLighting_; }
......@@ -470,7 +476,6 @@ public:
/// Get the menu pointers (required to add them to the menubar as a temp workaround for a qt 4.3 bug
QMenu * getPickMenu() { return pickMenu_; };
QMenu * getFuncMenu() { return funcMenu_; };
QMenu * getDrawMenu() { return drawMenu_; };
......@@ -534,22 +539,14 @@ public slots:
virtual void setView( const ACG::GLMatrixd& _modelview,
const ACG::GLMatrixd& _inverse_modelview );
void actionBackground();
void actionCopyView();
void actionPasteView();
void actionPasteDropSize();
void actionSynchronize();
void actionAnimation();
void actionBackfaceCulling();
void actionTwoSidedLighting();
void actionSynchronize(bool _enable);
void actionAnimation(bool _enable);
void actionBackfaceCulling(bool _enable);
void actionTwoSidedLighting(bool _enable);
void actionDrawMenu( QAction * _action );
void actionPickMenu( QAction * _action );
void actionSnapshotName();
void actionSnapshot();
void actionPasteView();
void actionCopyView();
......@@ -682,21 +679,6 @@ private slots:
//----------------------------------------------------------- private functions
private:
// IDs for \c funcMenu_
enum FuncMenuID {
M_CopyView=0x100,
M_PasteView,
M_PasteDropSize,
M_Animation,
M_BackfaceCulling,
M_TwoSidedLighting,
M_Background,
M_Snapshot,
M_SnapshotName,
M_SnapshotSavesView,
M_Synchronize
};
/// Copy constructor. Never used!
QtBaseViewer(const QtBaseViewer&);
/// Assignment operator. Never used!
......@@ -772,13 +754,11 @@ private:
// helper
bool trackMouse_;
bool popupEnabled_;
bool glareaGrabbed_;
double frame_time_;
QMenu * pickMenu_;
QMenu * funcMenu_;
QMenu * drawMenu_;
// scenegraph stuff
......@@ -824,9 +804,6 @@ private:
// translate along z-axis
ACG::QtWidgets::QtWheel* wheelZ_;
// all actions
QMap< QString, QAction * > action_;
// vector of current draw mode actions
std::vector< QAction * > drawMenuActions_;
......@@ -987,8 +964,7 @@ private:
/// unsync two sync_connect()ed QtBaseViewer's
void sync_disconnect(const QtBaseViewer*);
/// toggle global synchronization
virtual void setSynchronization(bool _b);
/// add host to synchronize with, given by its name
bool add_sync_host(const QString& _name);
......@@ -997,6 +973,11 @@ private:
bool synchronization();
public slots:
/// toggle global synchronization
virtual void setSynchronization(bool _b);
private slots:
void sync_receive();
......@@ -1043,18 +1024,6 @@ private:
*/
virtual void snapshot();
/** This action triggers a snapshot
*/
void actionSnapshot();
/** This action creates a widget for entering the snapshots name.
*/
void actionSnapshotName();
/** Doesn't do anything at the moment. Widget shows a checkbox for that.
*/
void actionSnapshotSavesView();
private:
QString snapshotName_;
......
......@@ -94,12 +94,12 @@ void QtBaseViewer::snapshot()
if (rval)
{
statusbar_->showMessage(QString("snapshot: ")+fname,5000);
if ( action_["SnapshotSavesView"]->isChecked() )
{
QString view; encodeView(view);
QFile f(fname+".view"); f.open(QIODevice::WriteOnly|QIODevice::Truncate);
QTextStream sf(&f); sf << view; f.close();
}
// if ( action_["SnapshotSavesView"]->isChecked() )
// {
// QString view; encodeView(view);
// QFile f(fname+".view"); f.open(QIODevice::WriteOnly|QIODevice::Truncate);
// QTextStream sf(&f); sf << view; f.close();
// }
}
else
{
......@@ -139,12 +139,6 @@ void QtBaseViewer::actionSnapshotName()
}
//-----------------------------------------------------------------------------
void QtBaseViewer::actionSnapshotSavesView()
{
}
//=============================================================================
//=============================================================================
......@@ -148,13 +148,15 @@ void QtBaseViewer::sync_receive()
glstate_->set_modelview(m);
if (w>0 && h>0 &&
action_["PasteDropSize"]->isChecked() )
{
glstate_->set_projection(p);
glView_->setFixedSize(w,h);
updateGeometry();
}
std::cerr << "Todo : Checkbox if size should be applied to" << std::endl;
// if (w>0 && h>0 &&
// action_["PasteDropSize"]->isChecked() )
// {
// glstate_->set_projection(p);
// glView_->setFixedSize(w,h);
// updateGeometry();
// }
blockSignals(false);
......@@ -167,8 +169,9 @@ void QtBaseViewer::sync_receive()
void QtBaseViewer::setSynchronization(bool _b)
{
emit functionMenuUpdate();
synchronized_ = _b;
action_["Synchronize"]->setChecked( synchronized_ );
if (synchronized_)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment