Skip to content

Commit

Permalink
move disabling of some commands to task panel
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Oct 9, 2016
1 parent 0704ad0 commit f712e1c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
8 changes: 0 additions & 8 deletions src/Gui/SoFCCSysDragger.cpp
Expand Up @@ -49,8 +49,6 @@

#include <Base/Quantity.h>
#include <Gui/MainWindow.h>
#include <Gui/Application.h>
#include <Gui/Command.h>
#include "SoFCDB.h"
#include "SoFCCSysDragger.h"

Expand Down Expand Up @@ -809,16 +807,10 @@ SoFCCSysDragger::SoFCCSysDragger()
this->addFinishCallback(&SoFCCSysDragger::finishDragCB, this);

this->setUpConnections(TRUE, TRUE);

//we can't have user switching camera types while dragger is shown.
Gui::Application::Instance->commandManager().getCommandByName("Std_OrthographicCamera")->setEnabled(false);
Gui::Application::Instance->commandManager().getCommandByName("Std_PerspectiveCamera")->setEnabled(false);
}

SoFCCSysDragger::~SoFCCSysDragger()
{
Gui::Application::Instance->commandManager().getCommandByName("Std_OrthographicCamera")->setEnabled(true);
Gui::Application::Instance->commandManager().getCommandByName("Std_PerspectiveCamera")->setEnabled(true);
}


Expand Down
12 changes: 9 additions & 3 deletions src/Gui/TaskCSysDragger.cpp
Expand Up @@ -33,6 +33,7 @@
#include <Gui/TaskView/TaskView.h>
#include "QuantitySpinBox.h"
#include <Gui/Application.h>
#include <Gui/Command.h>
#include <Gui/Document.h>
#include <Gui/BitmapFactory.h>
#include <Gui/ViewProviderGeometryObject.h>
Expand Down Expand Up @@ -70,6 +71,8 @@ TaskCSysDragger::TaskCSysDragger(Gui::ViewProviderGeometryObject* vpObjectIn, Gu
TaskCSysDragger::~TaskCSysDragger()
{
dragger->unref();
Gui::Application::Instance->commandManager().getCommandByName("Std_OrthographicCamera")->setEnabled(true);
Gui::Application::Instance->commandManager().getCommandByName("Std_PerspectiveCamera")->setEnabled(true);
}

void TaskCSysDragger::setupGui()
Expand Down Expand Up @@ -104,7 +107,7 @@ void TaskCSysDragger::setupGui()

incrementsBox->groupLayout()->addLayout(gridLayout);
Content.push_back(incrementsBox);

connect(tSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onTIncrementSlot(double)));
connect(rSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onRIncrementSlot(double)));
}
Expand All @@ -121,19 +124,22 @@ void TaskCSysDragger::onRIncrementSlot(double freshValue)

void TaskCSysDragger::open()
{
//we can't have user switching camera types while dragger is shown.
Gui::Application::Instance->commandManager().getCommandByName("Std_OrthographicCamera")->setEnabled(false);
Gui::Application::Instance->commandManager().getCommandByName("Std_PerspectiveCamera")->setEnabled(false);
// dragger->translationIncrement.setValue(lastTranslationIncrement);
// dragger->rotationIncrement.setValue(lastRotationIncrement);
tSpinBox->setValue(lastTranslationIncrement);
rSpinBox->setValue(radiansToDegrees(lastRotationIncrement));

Gui::TaskView::TaskDialog::open();
}

bool TaskCSysDragger::accept()
{
lastTranslationIncrement = dragger->translationIncrement.getValue();
lastRotationIncrement = dragger->rotationIncrement.getValue();

App::DocumentObject* dObject = vpObject.getObject();
if (dObject) {
Gui::Document* document = Gui::Application::Instance->getDocument(dObject->getDocument());
Expand Down

0 comments on commit f712e1c

Please sign in to comment.