move disabling of some commands to task panel

This commit is contained in:
wmayer 2016-10-09 19:45:30 +02:00
parent 0704ad0b71
commit f712e1cfc3
2 changed files with 9 additions and 11 deletions

View File

@ -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"
@ -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);
}

View File

@ -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>
@ -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()
@ -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)));
}
@ -121,11 +124,14 @@ 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();
}
@ -133,7 +139,7 @@ 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());