Fix 2889 Toggle Frames for DrawViewSymbol
This commit is contained in:
parent
18cd5b5166
commit
2c31b01ffe
|
@ -291,7 +291,7 @@ void CmdTechDrawToggleFrame::activated(int iMsg)
|
|||
bool CmdTechDrawToggleFrame::isActive(void)
|
||||
{
|
||||
bool havePage = DrawGuiUtil::needPage(this);
|
||||
bool haveView = DrawGuiUtil::needView(this);
|
||||
bool haveView = DrawGuiUtil::needView(this,false);
|
||||
return (havePage && haveView);
|
||||
}
|
||||
|
||||
|
|
|
@ -121,15 +121,23 @@ bool DrawGuiUtil::needPage(Gui::Command* cmd)
|
|||
return active;
|
||||
}
|
||||
|
||||
bool DrawGuiUtil::needView(Gui::Command* cmd)
|
||||
bool DrawGuiUtil::needView(Gui::Command* cmd, bool partOnly)
|
||||
{
|
||||
bool haveView = false;
|
||||
if (cmd->hasActiveDocument()) {
|
||||
if (partOnly) {
|
||||
auto drawPartType (TechDraw::DrawViewPart::getClassTypeId());
|
||||
auto selParts = cmd->getDocument()->getObjectsOfType(drawPartType);
|
||||
if (!selParts.empty()) {
|
||||
haveView = true;
|
||||
}
|
||||
} else {
|
||||
auto drawViewType (TechDraw::DrawView::getClassTypeId());
|
||||
auto selParts = cmd->getDocument()->getObjectsOfType(drawViewType);
|
||||
if (!selParts.empty()) {
|
||||
haveView = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return haveView;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ class TechDrawGuiExport DrawGuiUtil {
|
|||
public:
|
||||
static TechDraw::DrawPage* findPage(Gui::Command* cmd);
|
||||
static bool needPage(Gui::Command* cmd);
|
||||
static bool needView(Gui::Command* cmd);
|
||||
static bool needView(Gui::Command* cmd, bool partOnly = true);
|
||||
};
|
||||
|
||||
} //end namespace TechDrawGui
|
||||
|
|
Loading…
Reference in New Issue
Block a user