Commit 6f9a56e1 authored by Mike Kremer's avatar Mike Kremer

Added checkbox to context menu of coordinate system that allows to turn on/off rotation lock.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9198 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 25df1f56
......@@ -382,27 +382,27 @@ void setFixedView(int _mode, int _viewer ) {
switch ( _mode ){
case VIEW_TOP : //TOP
PluginFunctions::viewingDirection( ACG::Vec3d(0.0, -1.0, 0.0), ACG::Vec3d(0.0, 0.0, -1.0), _viewer );
PluginFunctions::allowRotation(false, _viewer);
PluginFunctions::allowRotation(!PluginFunctions::viewerProperties().rotationLocked(), _viewer);
break;
case VIEW_BOTTOM : //BOTTOM
PluginFunctions::viewingDirection( ACG::Vec3d(0.0, 1.0, 0.0), ACG::Vec3d(0.0, 0.0, -1.0), _viewer );
PluginFunctions::allowRotation(false, _viewer);
PluginFunctions::allowRotation(!PluginFunctions::viewerProperties().rotationLocked(), _viewer);
break;
case VIEW_LEFT : //LEFT
PluginFunctions::viewingDirection( ACG::Vec3d(1.0, 0.0, 0.0), ACG::Vec3d(0.0, 1.0, 0.0), _viewer );
PluginFunctions::allowRotation(false, _viewer);
PluginFunctions::allowRotation(!PluginFunctions::viewerProperties().rotationLocked(), _viewer);
break;
case VIEW_RIGHT : //RIGHT
PluginFunctions::viewingDirection( ACG::Vec3d(-1.0, 0.0, 0.0), ACG::Vec3d(0.0, 1.0, 0.0), _viewer );
PluginFunctions::allowRotation(false, _viewer);
PluginFunctions::allowRotation(!PluginFunctions::viewerProperties().rotationLocked(), _viewer);
break;
case VIEW_FRONT : //FRONT
PluginFunctions::viewingDirection( ACG::Vec3d(0.0, 0.0, -1.0), ACG::Vec3d(0.0, 1.0, 0.0), _viewer );
PluginFunctions::allowRotation(false, _viewer);
PluginFunctions::allowRotation(!PluginFunctions::viewerProperties().rotationLocked(), _viewer);
break;
case VIEW_BACK : //BACK
PluginFunctions::viewingDirection( ACG::Vec3d(0.0, 0.0, 1.0), ACG::Vec3d(0.0, 1.0, 0.0), _viewer );
PluginFunctions::allowRotation(false, _viewer);
PluginFunctions::allowRotation(!PluginFunctions::viewerProperties().rotationLocked(), _viewer);
break;
default : //Free View
PluginFunctions::allowRotation(true, _viewer);
......@@ -576,8 +576,15 @@ void allowRotation(bool _mode, int _viewer ) {
examiner_widgets_[i]->allowRotation(_mode);
else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
examiner_widgets_[_viewer]->allowRotation(_mode);
else
else {
std::cerr << "Requested illegal viewer for allowRotation!!" << std::endl;
return;
}
if ( _viewer == ACTIVE_VIEWER )
viewerProperties(activeExaminer()).rotationLocked( !_mode );
else
viewerProperties( _viewer ).rotationLocked( !_mode );
}
bool allowRotation( int _viewer ) {
......
......@@ -72,7 +72,8 @@ namespace Viewer {
multisampling_(true),
animation_(false),
glState_(0),
objectMarker_(0)
objectMarker_(0),
rotationLocked_(false)
{
}
......@@ -117,6 +118,14 @@ namespace Viewer {
void ViewerProperties::currentViewingDirection(int _dir){
currentViewingDirection_ = _dir;
}
bool ViewerProperties::rotationLocked(){
return rotationLocked_;
}
void ViewerProperties::rotationLocked(bool _locked){
rotationLocked_ = _locked;
}
}
......@@ -373,6 +373,16 @@ namespace Viewer {
private:
int currentViewingDirection_;
//===========================================================================
public:
bool rotationLocked();
void rotationLocked(bool _lock);
private:
bool rotationLocked_;
//===========================================================================
......
......@@ -255,9 +255,22 @@ void CoreWidget::updatePopupMenuCoordsysNode(QMenu* _menu , const int /*_part*/
viewAction->setChecked( PluginFunctions::viewerProperties().currentViewingDirection() == PluginFunctions::VIEW_BACK );
viewingDirectionMenu->addAction( viewAction );
dirGroup->addAction(viewAction);
viewingDirectionMenu->addSeparator();
connect( dirGroup, SIGNAL(triggered(QAction*)), this, SLOT(slotSetViewingDirection(QAction*) ) );
//===========================================================================
// Check box to determine whether rotation should be locked or not
QAction* lockAction = viewingDirectionMenu->addAction("Lock rotation");
lockAction->setCheckable( true );
lockAction->setToolTip(tr("Lock rotation in current examiner"));
lockAction->setChecked( PluginFunctions::viewerProperties().rotationLocked() );
viewingDirectionMenu->addAction( lockAction );
connect( lockAction, SIGNAL(triggered(bool)), this, SLOT(slotLockRotation(bool) ) );
//====================================================================================================
// Other Toplevel Action
//====================================================================================================
......
......@@ -991,6 +991,9 @@ public:
/// Change the Viewing direction from context-menu
void slotSetViewingDirection(QAction* _action);
/// Lock rotation in current examiner widget
void slotLockRotation(bool _lock);
/// Set the animation Mode for all viewers
......
......@@ -626,6 +626,11 @@ void CoreWidget::slotSetViewingDirection(QAction* _action) {
PluginFunctions::setFixedView( _action->data().toInt() );
}
void CoreWidget::slotLockRotation(bool _lock) {
PluginFunctions::allowRotation( !_lock, PluginFunctions::activeExaminer() );
}
void CoreWidget::moveBack() {
examiner_widgets_[PluginFunctions::activeExaminer()]->moveBack();
}
......
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