PartGui: add ExplodeCompound to menu and toolbars
This commit is contained in:
@@ -758,6 +758,114 @@ bool CmdPartCompSplitFeatures::isActive(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Part_CompCompoundTools (dropdown toolbar button for BooleanFragments, Slice)
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_ACL(CmdPartCompCompoundTools);
|
||||
|
||||
CmdPartCompCompoundTools::CmdPartCompCompoundTools()
|
||||
: Command("Part_CompCompoundTools")
|
||||
{
|
||||
sAppModule = "Part";
|
||||
sGroup = QT_TR_NOOP("Part");
|
||||
sMenuText = QT_TR_NOOP("Counpound tools");
|
||||
sToolTipText = QT_TR_NOOP("Compound tools: working with lists of shapes.");
|
||||
sWhatsThis = "Part_CompCompoundTools";
|
||||
sStatusTip = sToolTipText;
|
||||
}
|
||||
|
||||
void CmdPartCompCompoundTools::activated(int iMsg)
|
||||
{
|
||||
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
if (iMsg==0)
|
||||
rcCmdMgr.runCommandByName("Part_Compound");
|
||||
else if (iMsg==1)
|
||||
rcCmdMgr.runCommandByName("Part_ExplodeCompound");
|
||||
else if (iMsg==2)
|
||||
rcCmdMgr.runCommandByName("Part_CompoundFilter");
|
||||
else
|
||||
return;
|
||||
|
||||
// Since the default icon is reset when enabing/disabling the command we have
|
||||
// to explicitly set the icon of the used command.
|
||||
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
|
||||
QList<QAction*> a = pcAction->actions();
|
||||
|
||||
assert(iMsg < a.size());
|
||||
pcAction->setIcon(a[iMsg]->icon());
|
||||
}
|
||||
|
||||
Gui::Action * CmdPartCompCompoundTools::createAction(void)
|
||||
{
|
||||
Gui::ActionGroup* pcAction = new Gui::ActionGroup(this, Gui::getMainWindow());
|
||||
pcAction->setDropDownMenu(true);
|
||||
applyCommandData(this->className(), pcAction);
|
||||
|
||||
QAction* cmd0 = pcAction->addAction(QString());
|
||||
cmd0->setIcon(Gui::BitmapFactory().pixmap("Part_Compound"));
|
||||
QAction* cmd1 = pcAction->addAction(QString());
|
||||
cmd1->setIcon(Gui::BitmapFactory().pixmap("Part_ExplodeCompound"));
|
||||
QAction* cmd2 = pcAction->addAction(QString());
|
||||
cmd2->setIcon(Gui::BitmapFactory().pixmap("Part_CompoundFilter"));
|
||||
|
||||
_pcAction = pcAction;
|
||||
languageChange();
|
||||
|
||||
pcAction->setIcon(cmd0->icon());
|
||||
int defaultId = 0;
|
||||
pcAction->setProperty("defaultAction", QVariant(defaultId));
|
||||
|
||||
return pcAction;
|
||||
}
|
||||
|
||||
void CmdPartCompCompoundTools::languageChange()
|
||||
{
|
||||
Command::languageChange();
|
||||
|
||||
if (!_pcAction)
|
||||
return;
|
||||
|
||||
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
|
||||
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
|
||||
QList<QAction*> a = pcAction->actions();
|
||||
|
||||
Gui::Command* cmdCompound = rcCmdMgr.getCommandByName("Part_Compound");
|
||||
if (cmdCompound) {
|
||||
QAction* cmd0 = a[0];
|
||||
cmd0->setText(QApplication::translate("CmdPartCompound", cmdCompound->getMenuText()));
|
||||
cmd0->setToolTip(QApplication::translate("CmdPartCompound", cmdCompound->getToolTipText()));
|
||||
cmd0->setStatusTip(QApplication::translate("CmdPartCompound", cmdCompound->getStatusTip()));
|
||||
}
|
||||
|
||||
Gui::Command* cmdExplode = rcCmdMgr.getCommandByName("Part_ExplodeCompound");
|
||||
if (cmdExplode) {
|
||||
QAction* cmd1 = a[1];
|
||||
cmd1->setText(QApplication::translate("Part_CompoundTools", cmdExplode->getMenuText()));
|
||||
cmd1->setToolTip(QApplication::translate("Part_CompoundTools", cmdExplode->getToolTipText()));
|
||||
cmd1->setStatusTip(QApplication::translate("Part_CompoundTools", cmdExplode->getStatusTip()));
|
||||
}
|
||||
|
||||
Gui::Command* cmdCompoundFilter = rcCmdMgr.getCommandByName("Part_CompoundFilter");
|
||||
if (cmdCompoundFilter) {
|
||||
QAction* cmd2 = a[2];
|
||||
cmd2->setText(QApplication::translate("Part_CompoundTools", cmdCompoundFilter->getMenuText()));
|
||||
cmd2->setToolTip(QApplication::translate("Part_CompoundTools", cmdCompoundFilter->getToolTipText()));
|
||||
cmd2->setStatusTip(QApplication::translate("Part_CompoundTools", cmdCompoundFilter->getStatusTip()));
|
||||
}
|
||||
}
|
||||
|
||||
bool CmdPartCompCompoundTools::isActive(void)
|
||||
{
|
||||
if (getActiveGuiDocument())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// Part_Compound
|
||||
//===========================================================================
|
||||
@@ -2271,6 +2379,7 @@ void CreatePartCommands(void)
|
||||
rcCmdMgr.addCommand(new CmdPartFuse());
|
||||
rcCmdMgr.addCommand(new CmdPartCompJoinFeatures());
|
||||
rcCmdMgr.addCommand(new CmdPartCompSplitFeatures());
|
||||
rcCmdMgr.addCommand(new CmdPartCompCompoundTools());
|
||||
rcCmdMgr.addCommand(new CmdPartCompound());
|
||||
rcCmdMgr.addCommand(new CmdPartSection());
|
||||
//rcCmdMgr.addCommand(new CmdPartBox2());
|
||||
|
||||
@@ -92,6 +92,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
||||
Gui::MenuItem* compound = new Gui::MenuItem;
|
||||
compound->setCommand("Compound");
|
||||
*compound << "Part_Compound"
|
||||
<< "Part_ExplodeCompound"
|
||||
<< "Part_CompoundFilter";
|
||||
|
||||
Gui::MenuItem* part = new Gui::MenuItem;
|
||||
@@ -188,7 +189,8 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
||||
|
||||
Gui::ToolBarItem* boolop = new Gui::ToolBarItem(root);
|
||||
boolop->setCommand("Boolean");
|
||||
*boolop << "Part_Boolean"
|
||||
*boolop << "Part_CompCompoundTools"
|
||||
<< "Part_Boolean"
|
||||
<< "Part_Cut"
|
||||
<< "Part_Fuse"
|
||||
<< "Part_Common"
|
||||
|
||||
Reference in New Issue
Block a user