[Standard Views] add Home view command. Default shortcut is 'Home' key. Restores camera orientation to current home view, configurable in edit menu -> preferences -> display -> navigation -> New Document Camera Orientation / Home view.
This commit is contained in:
committed by
Yorik van Havre
parent
ce18f6afdb
commit
78cd1790df
@@ -1115,6 +1115,34 @@ bool StdCmdSetAppearance::isActive(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Std_ViewHome
|
||||
//===========================================================================
|
||||
DEF_3DV_CMD(StdCmdViewHome)
|
||||
|
||||
StdCmdViewHome::StdCmdViewHome()
|
||||
: Command("Std_ViewHome")
|
||||
{
|
||||
sGroup = QT_TR_NOOP("Standard-View");
|
||||
sMenuText = QT_TR_NOOP("Home");
|
||||
sToolTipText = QT_TR_NOOP("Set to default home view");
|
||||
sWhatsThis = "Std_ViewHome";
|
||||
sStatusTip = QT_TR_NOOP("Set to default home view");
|
||||
//sPixmap = "view-home";
|
||||
sAccel = "Home";
|
||||
eType = Alter3DView;
|
||||
}
|
||||
|
||||
void StdCmdViewHome::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
|
||||
auto hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
|
||||
std::string default_view = hGrp->GetASCII("NewDocumentCameraOrientation","Top");
|
||||
doCommand(Command::Gui,"Gui.activeDocument().activeView().viewDefaultOrientation('%s',0)",default_view.c_str());
|
||||
doCommand(Command::Gui,"Gui.SendMsgToActiveView(\"ViewFit\")");
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Std_ViewBottom
|
||||
//===========================================================================
|
||||
@@ -3474,6 +3502,7 @@ void CreateViewStdCommands(void)
|
||||
|
||||
// views
|
||||
rcCmdMgr.addCommand(new StdCmdViewBottom());
|
||||
rcCmdMgr.addCommand(new StdCmdViewHome());
|
||||
rcCmdMgr.addCommand(new StdCmdViewFront());
|
||||
rcCmdMgr.addCommand(new StdCmdViewLeft());
|
||||
rcCmdMgr.addCommand(new StdCmdViewRear());
|
||||
|
||||
@@ -234,7 +234,7 @@ Turntable: the part will be rotated around the z-axis.</string>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="newDocViewLabel">
|
||||
<property name="text">
|
||||
<string>New document camera orientation</string>
|
||||
<string>New document camera orientation / Home view</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -253,7 +253,7 @@ Turntable: the part will be rotated around the z-axis.</string>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Camera orientation for new documents</string>
|
||||
<string>Camera orientation for new documents and Home view</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -529,7 +529,7 @@ void StdWorkbench::setupContextMenu(const char* recipient, MenuItem* item) const
|
||||
MenuItem* StdViews = new MenuItem;
|
||||
StdViews->setCommand( "Standard views" );
|
||||
|
||||
*StdViews << "Std_ViewIsometric" << "Separator" << "Std_ViewFront" << "Std_ViewTop" << "Std_ViewRight"
|
||||
*StdViews << "Std_ViewIsometric" << "Separator" << "Std_ViewHome" << "Std_ViewFront" << "Std_ViewTop" << "Std_ViewRight"
|
||||
<< "Std_ViewRear" << "Std_ViewBottom" << "Std_ViewLeft"
|
||||
<< "Separator" << "Std_ViewRotateLeft" << "Std_ViewRotateRight";
|
||||
|
||||
@@ -599,7 +599,7 @@ MenuItem* StdWorkbench::setupMenuBar() const
|
||||
MenuItem* stdviews = new MenuItem;
|
||||
stdviews->setCommand("Standard views");
|
||||
*stdviews << "Std_ViewFitAll" << "Std_ViewFitSelection" << axoviews
|
||||
<< "Separator" << "Std_ViewFront" << "Std_ViewTop"
|
||||
<< "Separator" << "Std_ViewHome" << "Std_ViewFront" << "Std_ViewTop"
|
||||
<< "Std_ViewRight" << "Separator" << "Std_ViewRear"
|
||||
<< "Std_ViewBottom" << "Std_ViewLeft"
|
||||
<< "Separator" << "Std_ViewRotateLeft" << "Std_ViewRotateRight";
|
||||
|
||||
Reference in New Issue
Block a user