issue #0002687: zoomin/out during transform

This commit is contained in:
wmayer 2016-10-09 18:32:18 +02:00
parent c1b1646e2e
commit ff1b9dde41
3 changed files with 21 additions and 7 deletions

View File

@ -217,6 +217,7 @@ Command::Command(const char* name)
sAppModule = "FreeCAD";
sGroup = QT_TR_NOOP("Standard");
eType = AlterDoc | Alter3DView | AlterSelection;
bEnabled = true;
}
Command::~Command()
@ -331,14 +332,15 @@ void Command::invoke(int i)
void Command::testActive(void)
{
if (!_pcAction) return;
if (!_pcAction)
return;
if (_blockCmd) {
if (_blockCmd || !bEnabled) {
_pcAction->setEnabled(false);
return;
}
if (!(eType & ForEdit)) // special case for commands which are only in some edit modes active
if (!(eType & ForEdit)) { // special case for commands which are only in some edit modes active
if ((!Gui::Control().isAllowedAlterDocument() && eType & AlterDoc) ||
(!Gui::Control().isAllowedAlterView() && eType & Alter3DView) ||
@ -346,11 +348,20 @@ void Command::testActive(void)
_pcAction->setEnabled(false);
return;
}
}
bool bActive = isActive();
_pcAction->setEnabled(bActive);
}
void Command::setEnabled(bool on)
{
if (_pcAction) {
bEnabled = on;
_pcAction->setEnabled(on);
}
}
//--------------------------------------------------------------------------
// Helper methods
//--------------------------------------------------------------------------

View File

@ -177,6 +177,8 @@ public:
friend class CommandManager;
/// Get somtile called to check the state of the command
void testActive(void);
/// Enables or disables the command
void setEnabled(bool);
/// get called by the QAction
void invoke (int);
/// adds this command to arbitrary widgets
@ -319,6 +321,7 @@ protected:
int eType;
//@}
private:
bool bEnabled;
static bool _blockCmd;
};

View File

@ -811,14 +811,14 @@ SoFCCSysDragger::SoFCCSysDragger()
this->setUpConnections(TRUE, TRUE);
//we can't have user switching camera types while dragger is shown.
Gui::Application::Instance->commandManager().getCommandByName("Std_OrthographicCamera")->blockCommand(true);
Gui::Application::Instance->commandManager().getCommandByName("Std_PerspectiveCamera")->blockCommand(true);
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")->blockCommand(false);
Gui::Application::Instance->commandManager().getCommandByName("Std_PerspectiveCamera")->blockCommand(false);
Gui::Application::Instance->commandManager().getCommandByName("Std_OrthographicCamera")->setEnabled(true);
Gui::Application::Instance->commandManager().getCommandByName("Std_PerspectiveCamera")->setEnabled(true);
}