Added Std_Edit FreeCAD command
That command (located in the Edit menu) toggles (enters or leaves) the Edit mode of a selected object.
This commit is contained in:
@@ -52,6 +52,8 @@
|
||||
#include "Placement.h"
|
||||
#include "WaitCursor.h"
|
||||
#include "ViewProvider.h"
|
||||
#include <Gui/View3DInventor.h>
|
||||
#include <Gui/View3DInventorViewer.h>
|
||||
#include "MergeDocuments.h"
|
||||
|
||||
using namespace Gui;
|
||||
@@ -1022,6 +1024,46 @@ bool StdCmdPlacement::isActive(void)
|
||||
return (Gui::Control().activeDialog()==0);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Std_Edit
|
||||
//===========================================================================
|
||||
DEF_STD_CMD_A(StdCmdEdit);
|
||||
|
||||
StdCmdEdit::StdCmdEdit()
|
||||
:Command("Std_Edit")
|
||||
{
|
||||
sGroup = QT_TR_NOOP("Edit");
|
||||
sMenuText = QT_TR_NOOP("Toggle &Editmode");
|
||||
sToolTipText = QT_TR_NOOP("Toggles the selected object's edit mode");
|
||||
sWhatsThis = "Std_Edit";
|
||||
sStatusTip = QT_TR_NOOP("Enters or leaves the selected object's edit mode");
|
||||
#if QT_VERSION >= 0x040200
|
||||
sPixmap = "edit-edit";
|
||||
#endif
|
||||
eType = ForEdit;
|
||||
}
|
||||
|
||||
void StdCmdEdit::activated(int iMsg)
|
||||
{
|
||||
Gui::MDIView* view = Gui::getMainWindow()->activeWindow();
|
||||
if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) {
|
||||
Gui::View3DInventorViewer* viewer = static_cast<Gui::View3DInventor*>(view)->getViewer();
|
||||
if (viewer->isEditingViewProvider()) {
|
||||
doCommand(Command::Gui,"Gui.activeDocument().resetEdit()");
|
||||
} else {
|
||||
if (Selection().getCompleteSelection().size() > 0) {
|
||||
SelectionSingleton::SelObj obj = Selection().getCompleteSelection()[0];
|
||||
doCommand(Command::Gui,"Gui.activeDocument().setEdit(\"%s\",0)",obj.FeatName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool StdCmdEdit::isActive(void)
|
||||
{
|
||||
return (Selection().getCompleteSelection().size() > 0) || (Gui::Control().activeDialog() != 0);
|
||||
}
|
||||
|
||||
|
||||
namespace Gui {
|
||||
|
||||
@@ -1054,6 +1096,7 @@ void CreateDocCommands(void)
|
||||
rcCmdMgr.addCommand(new StdCmdRefresh());
|
||||
rcCmdMgr.addCommand(new StdCmdTransform());
|
||||
rcCmdMgr.addCommand(new StdCmdPlacement());
|
||||
rcCmdMgr.addCommand(new StdCmdEdit());
|
||||
}
|
||||
|
||||
} // namespace Gui
|
||||
|
||||
149
src/Gui/Icons/edit-edit.svg
Normal file
149
src/Gui/Icons/edit-edit.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 6.6 KiB |
@@ -45,6 +45,7 @@
|
||||
<file>edit-select-all.svg</file>
|
||||
<file>edit-redo.svg</file>
|
||||
<file>edit-undo.svg</file>
|
||||
<file>edit-edit.svg</file>
|
||||
<file>help-browser.svg</file>
|
||||
<file>preferences-system.svg</file>
|
||||
<file>window-new.svg</file>
|
||||
|
||||
@@ -440,7 +440,7 @@ MenuItem* StdWorkbench::setupMenuBar() const
|
||||
*edit << "Std_Undo" << "Std_Redo" << "Separator" << "Std_Cut" << "Std_Copy"
|
||||
<< "Std_Paste" << "Std_DuplicateSelection" << "Separator"
|
||||
<< "Std_Refresh" << "Std_SelectAll" << "Std_Delete" << "Std_Placement"
|
||||
<< "Separator" << "Std_DlgPreferences";
|
||||
<< "Std_Edit" << "Separator" << "Std_DlgPreferences";
|
||||
|
||||
// Standard views
|
||||
MenuItem* stdviews = new MenuItem;
|
||||
|
||||
Reference in New Issue
Block a user