Merge branch 'master' of ssh://free-cad.git.sourceforge.net/gitroot/free-cad/free-cad

This commit is contained in:
wmayer 2012-02-14 02:09:33 +01:00
commit c709eeba89
7 changed files with 200 additions and 11 deletions

View File

@ -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
View File

@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64"
height="64"
id="svg4025"
version="1.1"
inkscape:version="0.48.1 r9760"
sodipodi:docname="edit-edit.svg">
<defs
id="defs4027">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 16 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="32 : 16 : 1"
inkscape:persp3d-origin="16 : 10.666667 : 1"
id="perspective4033" />
<inkscape:perspective
id="perspective4010"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4095"
id="linearGradient3999"
gradientUnits="userSpaceOnUse"
x1="901.1875"
y1="1190.875"
x2="1267.9062"
y2="1190.875"
gradientTransform="matrix(0.10456791,0,0,0.10456791,420.90006,31.02362)" />
<linearGradient
id="linearGradient4095">
<stop
style="stop-color:#0044be;stop-opacity:1;"
offset="0"
id="stop4097" />
<stop
style="stop-color:#2b90cc;stop-opacity:1;"
offset="1"
id="stop4099" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4095"
id="linearGradient2979"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.13878644,0,0,0.1266123,-121.41255,-154.04118)"
x1="901.1875"
y1="1190.875"
x2="1267.9062"
y2="1190.875" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.9795105"
inkscape:cx="-43.110306"
inkscape:cy="48.878745"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:window-width="1280"
inkscape:window-height="757"
inkscape:window-x="0"
inkscape:window-y="20"
inkscape:window-maximized="1" />
<metadata
id="metadata4030">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer"
transform="translate(0,32)">
<path
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000621;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 50.997977,1.1344967 3.432738,3.3992652 c 0,0 1.210331,6.8306391 1.815497,10.2459571 0.605165,3.415319 1.815494,10.245958 1.815494,10.245958 0,0 -7.757014,-1.057726 -11.316388,-1.815656 -3.559372,-0.757933 -10.039854,-2.731932 -10.039854,-2.731932 l -4.999305,-4.90932"
id="path3385-6"
sodipodi:nodetypes="cczczcc"
inkscape:export-filename="/home/yorik/Documents/Lab/Draft/icons/draft.png"
inkscape:export-xdpi="6.2926431"
inkscape:export-ydpi="6.2926431"
inkscape:connector-curvature="0" />
<path
style="fill:url(#linearGradient2979);fill-opacity:1;fill-rule:evenodd;stroke:#000621;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 22.71718,-26.934304 c 0,0 -6.207288,-0.559419 -12.046285,5.299332 -5.8389965,5.858751 -6.3169063,10.151334 -6.3169063,10.151334 L 36.600148,20.410791 c -0.276624,-0.52502 -0.429376,-1.105486 -0.429376,-1.717188 0,-2.329777 1.221359,-4.975527 3.968622,-4.975527 0.743862,0 1.44788,0.139443 2.081797,0.387739 l 0.299267,-0.253217 c -0.09276,-0.321979 -0.143125,-0.659396 -0.143125,-1.004974 0,-2.329801 2.47993,-4.4743223 5.227207,-4.4743223 0.422165,0 0.831524,0.046264 1.223062,0.1305676 l 1.040912,-0.8744134 c -0.05799,-0.256209 -0.09104,-0.5210491 -0.09104,-0.7913281 0,-1.8379317 3.033164,-1.5039843 4.968355,-2.082003 L 22.717225,-26.934304 z"
id="rect2390-8"
inkscape:export-filename="/home/yorik/Documents/Lab/Draft/icons/draft.png"
inkscape:export-xdpi="6.2926431"
inkscape:export-ydpi="6.2926431"
sodipodi:nodetypes="czccssccssccsccc"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000621;stroke-width:1.32559693;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="M 48.544883,7.6133709 15.050897,-24.733532"
id="path3373-7"
inkscape:export-filename="/home/yorik/Documents/Lab/Draft/icons/draft.png"
inkscape:export-xdpi="6.2926431"
inkscape:export-ydpi="6.2926431"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="fill:none;stroke:#000621;stroke-width:1.32559693;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="M 41.787708,13.237662 9.4859605,-19.489738"
id="path3375-9"
inkscape:export-filename="/home/yorik/Documents/Lab/Draft/icons/draft.png"
inkscape:export-xdpi="6.2926431"
inkscape:export-ydpi="6.2926431"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="fill:#000621;fill-opacity:1;fill-rule:evenodd;stroke:#000621;stroke-width:0.13255970000000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 56.215108,14.884285 c 0,0 -3.733918,2.191368 -5.205971,3.44903 -1.472051,1.257659 -3.626343,4.096932 -3.626343,4.096932 l 11.075451,2.557967 -2.243137,-10.103929 z"
id="path3387-0"
inkscape:export-filename="/home/yorik/Documents/Lab/Draft/icons/draft.png"
inkscape:export-xdpi="6.2926431"
inkscape:export-ydpi="6.2926431"
sodipodi:nodetypes="czccc"
inkscape:connector-curvature="0" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -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>

View 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;

View File

@ -340,10 +340,9 @@ class _AxisTaskPanel:
self.obj.Angles = a
FreeCAD.ActiveDocument.recompute()
def finish(self):
def accept(self):
self.resetObject()
if self.obj:
self.obj.ViewObject.finishEditing()
FreeCADGui.ActiveDocument.resetEdit()
def retranslateUi(self, TaskPanel):
TaskPanel.setWindowTitle(QtGui.QApplication.translate("Arch", "Axes", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -222,8 +222,7 @@ class ComponentTaskPanel:
def accept(self):
FreeCAD.ActiveDocument.recompute()
if self.obj:
self.obj.ViewObject.finishEditing()
FreeCADGui.ActiveDocument.resetEdit()
return True
def editObject(self,wid,col):
@ -308,7 +307,7 @@ class ViewProviderComponent:
def unsetEdit(self,vobj,mode):
FreeCADGui.Control.closeDialog()
return
return False
class ArchSelectionObserver:
def __init__(self,origin,watched):

View File

@ -147,12 +147,10 @@ class DraftTaskPanel:
def getStandardButtons(self):
return int(QtGui.QDialogButtonBox.Cancel)
def accept(self):
if FreeCAD.activeDraftCommand:
FreeCAD.activeDraftCommand.finish()
FreeCADGui.ActiveDocument.resetEdit()
return True
def reject(self):
if FreeCAD.activeDraftCommand:
FreeCAD.activeDraftCommand.finish()
FreeCADGui.ActiveDocument.resetEdit()
return True
class DraftToolBar: