Gui: Add alignToSelection() method and command

This commit is contained in:
Bas Ruigrok
2024-05-12 14:45:16 +02:00
parent f7078d13d4
commit 52b6f4f5ad
4 changed files with 70 additions and 0 deletions

View File

@@ -4076,6 +4076,33 @@ bool StdRecallWorkingView::isActive()
return view && view->getViewer()->hasHomePosition();
}
//===========================================================================
// Std_AlignToSelection
//===========================================================================
DEF_STD_CMD_A(StdCmdAlignToSelection)
StdCmdAlignToSelection::StdCmdAlignToSelection()
: Command("Std_AlignToSelection")
{
sGroup = "Standard-View";
sMenuText = QT_TR_NOOP("Align to selection");
sToolTipText = QT_TR_NOOP("Align the view with the selection");
sWhatsThis = "Std_AlignToSelection";
eType = Alter3DView;
}
void StdCmdAlignToSelection::activated(int iMsg)
{
Q_UNUSED(iMsg);
doCommand(Command::Gui,"Gui.SendMsgToActiveView(\"AlignToSelection\")");
}
bool StdCmdAlignToSelection::isActive()
{
return getGuiApplication()->sendHasMsgToActiveView("AlignToSelection");
}
//===========================================================================
// Instantiation
//===========================================================================
@@ -4107,6 +4134,7 @@ void CreateViewStdCommands()
rcCmdMgr.addCommand(new StdStoreWorkingView());
rcCmdMgr.addCommand(new StdRecallWorkingView());
rcCmdMgr.addCommand(new StdCmdViewGroup());
rcCmdMgr.addCommand(new StdCmdAlignToSelection());
rcCmdMgr.addCommand(new StdCmdViewExample1());
rcCmdMgr.addCommand(new StdCmdViewExample2());