Skip to content

Commit

Permalink
Fix 2889 Toggle Frames for DrawViewSymbol
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan committed Feb 6, 2017
1 parent c47d043 commit 70049da
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Mod/TechDraw/Gui/CommandDecorate.cpp
Expand Up @@ -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);
}

Expand Down
18 changes: 13 additions & 5 deletions src/Mod/TechDraw/Gui/DrawGuiUtil.cpp
Expand Up @@ -121,14 +121,22 @@ 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()) {
auto drawPartType (TechDraw::DrawViewPart::getClassTypeId());
auto selParts = cmd->getDocument()->getObjectsOfType(drawPartType);
if (!selParts.empty()) {
haveView = true;
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;
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/TechDraw/Gui/DrawGuiUtil.h
Expand Up @@ -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
Expand Down

0 comments on commit 70049da

Please sign in to comment.