add command to select visible objects
This commit is contained in:
parent
5abb99b37f
commit
9b33f4130b
|
@ -906,6 +906,47 @@ bool StdCmdHideSelection::isActive(void)
|
|||
return (Gui::Selection().size() != 0);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Std_SelectVisibleObjects
|
||||
//===========================================================================
|
||||
DEF_STD_CMD_A(StdCmdSelectVisibleObjects)
|
||||
|
||||
StdCmdSelectVisibleObjects::StdCmdSelectVisibleObjects()
|
||||
: Command("Std_SelectVisibleObjects")
|
||||
{
|
||||
sGroup = QT_TR_NOOP("Standard-View");
|
||||
sMenuText = QT_TR_NOOP("Select visible objects");
|
||||
sToolTipText = QT_TR_NOOP("Select visible objects in the active document");
|
||||
sStatusTip = QT_TR_NOOP("Select visible objects in the active document");
|
||||
sWhatsThis = "Std_SelectVisibleObjects";
|
||||
eType = Alter3DView;
|
||||
}
|
||||
|
||||
void StdCmdSelectVisibleObjects::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
// go through active document
|
||||
Gui::Document* doc = Application::Instance->activeDocument();
|
||||
App::Document* app = doc->getDocument();
|
||||
const std::vector<App::DocumentObject*> obj = app->getObjectsOfType
|
||||
(App::DocumentObject::getClassTypeId());
|
||||
|
||||
std::vector<App::DocumentObject*> visible;
|
||||
visible.reserve(obj.size());
|
||||
for (std::vector<App::DocumentObject*>::const_iterator it=obj.begin();it!=obj.end();++it) {
|
||||
if (doc->isShow((*it)->getNameInDocument()))
|
||||
visible.push_back(*it);
|
||||
}
|
||||
|
||||
SelectionSingleton& rSel = Selection();
|
||||
rSel.setSelection(app->getName(), visible);
|
||||
}
|
||||
|
||||
bool StdCmdSelectVisibleObjects::isActive(void)
|
||||
{
|
||||
return App::GetApplication().getActiveDocument();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Std_ToggleObjects
|
||||
//===========================================================================
|
||||
|
@ -2649,6 +2690,7 @@ void CreateViewStdCommands(void)
|
|||
rcCmdMgr.addCommand(new StdCmdToggleSelectability());
|
||||
rcCmdMgr.addCommand(new StdCmdShowSelection());
|
||||
rcCmdMgr.addCommand(new StdCmdHideSelection());
|
||||
rcCmdMgr.addCommand(new StdCmdSelectVisibleObjects());
|
||||
rcCmdMgr.addCommand(new StdCmdToggleObjects());
|
||||
rcCmdMgr.addCommand(new StdCmdShowObjects());
|
||||
rcCmdMgr.addCommand(new StdCmdHideObjects());
|
||||
|
|
|
@ -531,6 +531,7 @@ MenuItem* StdWorkbench::setupMenuBar() const
|
|||
MenuItem* visu = new MenuItem;
|
||||
visu->setCommand("Visibility");
|
||||
*visu << "Std_ToggleVisibility" << "Std_ShowSelection" << "Std_HideSelection"
|
||||
<< "Std_SelectVisibleObjects"
|
||||
<< "Separator" << "Std_ToggleObjects" << "Std_ShowObjects" << "Std_HideObjects"
|
||||
<< "Separator" << "Std_ToggleSelectability"
|
||||
<< "Separator" << "View_Measure_Toggle_All" << "View_Measure_Clear_All";
|
||||
|
|
Loading…
Reference in New Issue
Block a user