From 0c70ddf59500ba0d8e3eafc58451c6ea6f412b41 Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 30 Dec 2011 20:49:59 +0000 Subject: [PATCH] + implement primitive dialog as task panel git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5367 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d --- src/Mod/Part/App/AppPart.cpp | 2 +- src/Mod/Part/App/PrimitiveFeature.cpp | 12 +- src/Mod/Part/App/PrimitiveFeature.h | 8 +- src/Mod/Part/Gui/DlgPrimitives.cpp | 9 +- src/Mod/Part/Gui/DlgPrimitives.ui | 455 +++++++++++++++----------- 5 files changed, 276 insertions(+), 210 deletions(-) diff --git a/src/Mod/Part/App/AppPart.cpp b/src/Mod/Part/App/AppPart.cpp index f4a1d4093..3905c2644 100644 --- a/src/Mod/Part/App/AppPart.cpp +++ b/src/Mod/Part/App/AppPart.cpp @@ -157,7 +157,7 @@ void PartExport initPart() Part::Polygon ::init(); Part::Circle ::init(); Part::Vertex ::init(); - Part::Edge ::init(); + Part::Line ::init(); Part::Ellipsoid ::init(); Part::Plane ::init(); Part::Sphere ::init(); diff --git a/src/Mod/Part/App/PrimitiveFeature.cpp b/src/Mod/Part/App/PrimitiveFeature.cpp index 9a4deb390..004166532 100644 --- a/src/Mod/Part/App/PrimitiveFeature.cpp +++ b/src/Mod/Part/App/PrimitiveFeature.cpp @@ -163,9 +163,9 @@ void Vertex::onChanged(const App::Property* prop) Part::Feature::onChanged(prop); } -PROPERTY_SOURCE(Part::Edge, Part::Primitive) +PROPERTY_SOURCE(Part::Line, Part::Primitive) -Edge::Edge() +Line::Line() { ADD_PROPERTY_TYPE(X1,(0.0f),"Vertex 1 - Start",App::Prop_None,"X value of the start vertex"); ADD_PROPERTY_TYPE(Y1,(0.0f),"Vertex 1 - Start",App::Prop_None,"Y value of the Start vertex"); @@ -175,11 +175,11 @@ Edge::Edge() ADD_PROPERTY_TYPE(Z2,(1.0f),"Vertex 2 - Finish",App::Prop_None,"Z value of the finish vertex"); } -Edge::~Edge() +Line::~Line() { } -short Edge::mustExecute() const +short Line::mustExecute() const { if (X1.isTouched() || Y1.isTouched() || @@ -191,7 +191,7 @@ short Edge::mustExecute() const return Part::Feature::mustExecute(); } -App::DocumentObjectExecReturn *Edge::execute(void) +App::DocumentObjectExecReturn *Line::execute(void) { gp_Pnt point1; point1.SetX(this->X1.getValue()); @@ -212,7 +212,7 @@ App::DocumentObjectExecReturn *Edge::execute(void) return App::DocumentObject::StdReturn; } -void Edge::onChanged(const App::Property* prop) +void Line::onChanged(const App::Property* prop) { if (!isRestoring()) { if (prop == &X1 || prop == &Y1 || prop == &Z1 || prop == &X2 || prop == &Y2 || prop == &Z2){ diff --git a/src/Mod/Part/App/PrimitiveFeature.h b/src/Mod/Part/App/PrimitiveFeature.h index 7100b2ecd..250bf1564 100644 --- a/src/Mod/Part/App/PrimitiveFeature.h +++ b/src/Mod/Part/App/PrimitiveFeature.h @@ -70,13 +70,13 @@ public: //@} }; -class PartExport Edge : public Part::Primitive +class PartExport Line : public Part::Primitive { - PROPERTY_HEADER(Part::Edge); + PROPERTY_HEADER(Part::Line); public: - Edge(); - virtual ~Edge(); + Line(); + virtual ~Line(); App::PropertyFloat X1; App::PropertyFloat Y1; diff --git a/src/Mod/Part/Gui/DlgPrimitives.cpp b/src/Mod/Part/Gui/DlgPrimitives.cpp index 8b5339832..30cdb79d1 100644 --- a/src/Mod/Part/Gui/DlgPrimitives.cpp +++ b/src/Mod/Part/Gui/DlgPrimitives.cpp @@ -114,7 +114,7 @@ DlgPrimitives::DlgPrimitives(QWidget* parent) ui.vertexX->setMinimum(INT_MIN); ui.vertexY->setMinimum(INT_MIN); ui.vertexZ->setMinimum(INT_MIN); - // edge + // line ui.edgeX1->setMaximum(INT_MAX); ui.edgeX1->setMinimum(INT_MIN); ui.edgeY1->setMaximum(INT_MAX); @@ -326,10 +326,10 @@ void DlgPrimitives::createPrimitive(const QString& placement) .arg(ui.vertexZ->value(),0,'f',2) .arg(placement); } - else if (ui.comboBox1->currentIndex() == 11) { // edge - name = QString::fromAscii(doc->getUniqueObjectName("Edge").c_str()); + else if (ui.comboBox1->currentIndex() == 11) { // line + name = QString::fromAscii(doc->getUniqueObjectName("Line").c_str()); cmd = QString::fromAscii( - "App.ActiveDocument.addObject(\"Part::Edge\",\"%1\")\n" + "App.ActiveDocument.addObject(\"Part::Line\",\"%1\")\n" "App.ActiveDocument.%1.X1=%2\n" "App.ActiveDocument.%1.Y1=%3\n" "App.ActiveDocument.%1.Z1=%4\n" @@ -506,6 +506,7 @@ TaskPrimitives::TaskPrimitives() location = new Location(); taskbox = new Gui::TaskView::TaskBox(QPixmap(), location->windowTitle(),true, 0); taskbox->groupLayout()->addWidget(location); + taskbox->hideGroupBox(); Content.push_back(taskbox); } diff --git a/src/Mod/Part/Gui/DlgPrimitives.ui b/src/Mod/Part/Gui/DlgPrimitives.ui index 648ea6406..5423a5de0 100644 --- a/src/Mod/Part/Gui/DlgPrimitives.ui +++ b/src/Mod/Part/Gui/DlgPrimitives.ui @@ -6,8 +6,8 @@ 0 0 - 258 - 331 + 285 + 370 @@ -86,12 +86,12 @@ - Vertex + Point - Edge + Line @@ -953,134 +953,179 @@ - + - - - X min - - - - - - - - - - x max - - - - - - - 10.000000000000000 - - + + + + + X min/max: + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + 10.000000000000000 + + + + + + + Y min/max: + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + 10.000000000000000 + + + + + + + Z min/max: + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + 10.000000000000000 + + + + + + + X2 min/max: + + + + + + + + 0 + 0 + + + + 2.000000000000000 + + + + + + + + 0 + 0 + + + + 8.000000000000000 + + + + + + + Z2 min/max: + + + + + + + + 0 + 0 + + + + 2.000000000000000 + + + + + + + + 0 + 0 + + + + 8.000000000000000 + + + + - - - Y min + + + Qt::Vertical - - - - - - - - - Y max + + + 20 + 81 + - - - - - - 10.000000000000000 - - - - - - - Z min - - - - - - - - - - Z max - - - - - - - 10.000000000000000 - - - - - - - X2 min - - - - - - - 2.000000000000000 - - - - - - - X2 max - - - - - - - 8.000000000000000 - - - - - - - Z2 min - - - - - - - 2.000000000000000 - - - - - - - Z2 max - - - - - - - 8.000000000000000 - - + @@ -1167,7 +1212,7 @@ - Angle - 0 for cyl + Angle: @@ -1221,7 +1266,7 @@ - Angle0 + Angle 1: @@ -1238,7 +1283,7 @@ - Angle1 + Angle 2: @@ -1276,57 +1321,64 @@ - - - - 10 - 10 - 201 - 76 - - - - - - - - - - - - - - - - X Value: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - Y Value: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - Z Value: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - + + + + + + + + + + + + + + + + X: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Y: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Z: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + Qt::Vertical + + + + 20 + 139 + + + + + @@ -1335,30 +1387,30 @@ - X + X: - Qt::AlignCenter + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - Y + Y: - Qt::AlignCenter + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - Z + Z: - Qt::AlignCenter + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -1372,7 +1424,7 @@ - Finish Vertex + End point Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -1382,37 +1434,37 @@ - Start Vertex + Start point - X + X: - Qt::AlignCenter + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - Y + Y: - Qt::AlignCenter + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - Z + Z: - Qt::AlignCenter + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -1463,6 +1515,19 @@ + + + + Qt::Vertical + + + + 20 + 0 + + + +