+ 0000144: Add several tools to Part module
+ fix file guard in TaskShapeBuilder.h git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5028 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
parent
174b75c2f7
commit
25fa55d155
|
@ -167,6 +167,7 @@ void PartExport initPart()
|
|||
Part::Part2DObject ::init();
|
||||
Part::Part2DObjectPython ::init();
|
||||
Part::RuledSurface ::init();
|
||||
Part::Loft ::init();
|
||||
|
||||
// Geometry types
|
||||
Part::Geometry ::init();
|
||||
|
|
|
@ -101,3 +101,67 @@ App::DocumentObjectExecReturn *RuledSurface::execute(void)
|
|||
return new App::DocumentObjectExecReturn(e->GetMessageString());
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
PROPERTY_SOURCE(Part::Loft, Part::Feature)
|
||||
|
||||
Loft::Loft()
|
||||
{
|
||||
ADD_PROPERTY_TYPE(Sections,(0),"Loft",App::Prop_None,"List of sections");
|
||||
Sections.setSize(0);
|
||||
ADD_PROPERTY_TYPE(Solid,(false),"Loft",App::Prop_None,"Create solid");
|
||||
ADD_PROPERTY_TYPE(Ruled,(false),"Loft",App::Prop_None,"Ruled surface");
|
||||
}
|
||||
|
||||
short Loft::mustExecute() const
|
||||
{
|
||||
if (Sections.isTouched())
|
||||
return 1;
|
||||
if (Solid.isTouched())
|
||||
return 1;
|
||||
if (Ruled.isTouched())
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Loft::onChanged(const App::Property* prop)
|
||||
{
|
||||
Part::Feature::onChanged(prop);
|
||||
}
|
||||
|
||||
App::DocumentObjectExecReturn *Loft::execute(void)
|
||||
{
|
||||
if (Sections.getSize() == 0)
|
||||
return new App::DocumentObjectExecReturn("No sections linked.");
|
||||
|
||||
try {
|
||||
TopTools_ListOfShape profiles;
|
||||
const std::vector<App::DocumentObject*>& shapes = Sections.getValues();
|
||||
std::vector<App::DocumentObject*>::const_iterator it;
|
||||
for (it = shapes.begin(); it != shapes.end(); ++it) {
|
||||
if (!(*it)->isDerivedFrom(Part::Feature::getClassTypeId()))
|
||||
return new App::DocumentObjectExecReturn("Linked object is not a shape.");
|
||||
const TopoDS_Shape& shape = static_cast<Part::Feature*>(*it)->Shape.getValue();
|
||||
if (shape.IsNull())
|
||||
return new App::DocumentObjectExecReturn("Linked shape is invalid.");
|
||||
if (shape.ShapeType() == TopAbs_WIRE)
|
||||
profiles.Append(shape);
|
||||
else if (shape.ShapeType() == TopAbs_EDGE)
|
||||
profiles.Append(shape);
|
||||
else
|
||||
return new App::DocumentObjectExecReturn("Linked shape is neither a vertex nor a wire.");
|
||||
}
|
||||
|
||||
Standard_Boolean isSolid = Solid.getValue() ? Standard_True : Standard_False;
|
||||
Standard_Boolean isRuled = Ruled.getValue() ? Standard_True : Standard_False;
|
||||
|
||||
TopoShape myShape;
|
||||
this->Shape.setValue(myShape.makeLoft(profiles, isSolid, isRuled));
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle_Standard_Failure e = Standard_Failure::Caught();
|
||||
return new App::DocumentObjectExecReturn(e->GetMessageString());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,28 @@ protected:
|
|||
void onChanged (const App::Property* prop);
|
||||
};
|
||||
|
||||
class Loft : public Part::Feature
|
||||
{
|
||||
PROPERTY_HEADER(Part::Loft);
|
||||
|
||||
public:
|
||||
Loft();
|
||||
|
||||
App::PropertyLinkList Sections;
|
||||
App::PropertyBool Solid;
|
||||
App::PropertyBool Ruled;
|
||||
|
||||
/** @name methods override feature */
|
||||
//@{
|
||||
/// recalculate the feature
|
||||
App::DocumentObjectExecReturn *execute(void);
|
||||
short mustExecute() const;
|
||||
//@}
|
||||
|
||||
protected:
|
||||
void onChanged (const App::Property* prop);
|
||||
};
|
||||
|
||||
} //namespace Part
|
||||
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ set(PartGui_MOC_HDRS
|
|||
DlgSettingsGeneral.h
|
||||
TaskFaceColors.h
|
||||
TaskShapeBuilder.h
|
||||
TaskLoft.h
|
||||
)
|
||||
fc_wrap_cpp(PartGui_MOC_SRCS ${PartGui_MOC_HDRS})
|
||||
SOURCE_GROUP("Moc" FILES ${PartGui_MOC_SRCS})
|
||||
|
@ -62,6 +63,7 @@ set(PartGui_UIC_SRCS
|
|||
DlgSettingsGeneral.ui
|
||||
TaskFaceColors.ui
|
||||
TaskShapeBuilder.ui
|
||||
TaskLoft.ui
|
||||
)
|
||||
qt4_wrap_ui(PartGui_UIC_HDRS ${PartGui_UIC_SRCS})
|
||||
|
||||
|
@ -148,6 +150,9 @@ SET(PartGui_SRCS
|
|||
TaskShapeBuilder.cpp
|
||||
TaskShapeBuilder.h
|
||||
TaskShapeBuilder.ui
|
||||
TaskLoft.cpp
|
||||
TaskLoft.h
|
||||
TaskLoft.ui
|
||||
)
|
||||
|
||||
SET(PartGui_Scripts
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
#include "Mirroring.h"
|
||||
#include "ViewProvider.h"
|
||||
#include "TaskShapeBuilder.h"
|
||||
#include "TaskLoft.h"
|
||||
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
@ -903,6 +904,31 @@ bool CmdPartBuilder::isActive(void)
|
|||
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
DEF_STD_CMD_A(CmdPartLoft);
|
||||
|
||||
CmdPartLoft::CmdPartLoft()
|
||||
: Command("Part_Loft")
|
||||
{
|
||||
sAppModule = "Part";
|
||||
sGroup = QT_TR_NOOP("Part");
|
||||
sMenuText = QT_TR_NOOP("Loft...");
|
||||
sToolTipText = QT_TR_NOOP("Advanced utility to lofts");
|
||||
sWhatsThis = sToolTipText;
|
||||
sStatusTip = sToolTipText;
|
||||
}
|
||||
|
||||
void CmdPartLoft::activated(int iMsg)
|
||||
{
|
||||
Gui::Control().showDialog(new PartGui::TaskLoft());
|
||||
}
|
||||
|
||||
bool CmdPartLoft::isActive(void)
|
||||
{
|
||||
return (hasActiveDocument() && !Gui::Control().activeDialog());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
DEF_STD_CMD_A(CmdShapeInfo);
|
||||
|
||||
CmdShapeInfo::CmdShapeInfo()
|
||||
|
@ -1133,5 +1159,6 @@ void CreatePartCommands(void)
|
|||
rcCmdMgr.addCommand(new CmdShapeInfo());
|
||||
rcCmdMgr.addCommand(new CmdPartRuledSurface());
|
||||
rcCmdMgr.addCommand(new CmdPartBuilder());
|
||||
rcCmdMgr.addCommand(new CmdPartLoft());
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ BUILT_SOURCES=\
|
|||
ui_Mirroring.h \
|
||||
ui_TaskFaceColors.h \
|
||||
ui_TaskShapeBuilder.h \
|
||||
ui_TaskLoft.h \
|
||||
moc_CrossSections.cpp \
|
||||
moc_DlgBooleanOperation.cpp \
|
||||
moc_DlgExtrusion.cpp \
|
||||
|
@ -32,6 +33,7 @@ BUILT_SOURCES=\
|
|||
moc_Mirroring.cpp \
|
||||
moc_TaskFaceColors.cpp \
|
||||
moc_TaskShapeBuilder.cpp \
|
||||
moc_TaskLoft.cpp \
|
||||
qrc_Part.cpp
|
||||
|
||||
libPartGui_la_SOURCES=\
|
||||
|
@ -68,6 +70,8 @@ libPartGui_la_SOURCES=\
|
|||
TaskFaceColors.h \
|
||||
TaskShapeBuilder.cpp \
|
||||
TaskShapeBuilder.h \
|
||||
TaskLoft.cpp \
|
||||
TaskLoft.h \
|
||||
PreCompiled.cpp \
|
||||
PreCompiled.h \
|
||||
SoBrepShape.cpp \
|
||||
|
@ -215,6 +219,7 @@ EXTRA_DIST = \
|
|||
Mirroring.ui \
|
||||
TaskFaceColors.ui \
|
||||
TaskShapeBuilder.ui \
|
||||
TaskLoft.ui \
|
||||
Resources/Part.qrc \
|
||||
Resources/translations/Part_af.qm \
|
||||
Resources/translations/Part_af.ts \
|
||||
|
|
270
src/Mod/Part/Gui/TaskLoft.cpp
Normal file
270
src/Mod/Part/Gui/TaskLoft.cpp
Normal file
|
@ -0,0 +1,270 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2011 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <QMessageBox>
|
||||
# include <QTextStream>
|
||||
#endif
|
||||
|
||||
#include "ui_TaskLoft.h"
|
||||
#include "TaskLoft.h"
|
||||
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/Selection.h>
|
||||
#include <Gui/ViewProvider.h>
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Interpreter.h>
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
|
||||
|
||||
using namespace PartGui;
|
||||
|
||||
class LoftWidget::Private
|
||||
{
|
||||
public:
|
||||
Ui_TaskLoft ui;
|
||||
std::string document;
|
||||
Private()
|
||||
{
|
||||
}
|
||||
~Private()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/* TRANSLATOR PartGui::LoftWidget */
|
||||
|
||||
LoftWidget::LoftWidget(QWidget* parent)
|
||||
: d(new Private())
|
||||
{
|
||||
Gui::Application::Instance->runPythonCode("from FreeCAD import Base");
|
||||
Gui::Application::Instance->runPythonCode("import Part");
|
||||
|
||||
d->ui.setupUi(this);
|
||||
connect(d->ui.treeWidgetWire, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
|
||||
this, SLOT(onCurrentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));
|
||||
connect(d->ui.treeWidgetLoft, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
|
||||
this, SLOT(onCurrentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));
|
||||
findShapes();
|
||||
}
|
||||
|
||||
LoftWidget::~LoftWidget()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void LoftWidget::findShapes()
|
||||
{
|
||||
App::Document* activeDoc = App::GetApplication().getActiveDocument();
|
||||
Gui::Document* activeGui = Gui::Application::Instance->getDocument(activeDoc);
|
||||
if (!activeGui) return;
|
||||
d->document = activeDoc->getName();
|
||||
|
||||
std::vector<Part::Feature*> objs = activeDoc->getObjectsOfType<Part::Feature>();
|
||||
|
||||
for (std::vector<Part::Feature*>::iterator it = objs.begin(); it!=objs.end(); ++it) {
|
||||
const TopoDS_Shape& shape = (*it)->Shape.getValue();
|
||||
if (shape.IsNull()) continue;
|
||||
|
||||
if (shape.ShapeType() == TopAbs_WIRE || shape.ShapeType() == TopAbs_VERTEX) {
|
||||
QString label = QString::fromUtf8((*it)->Label.getValue());
|
||||
QString name = QString::fromAscii((*it)->getNameInDocument());
|
||||
|
||||
QTreeWidgetItem* child = new QTreeWidgetItem();
|
||||
child->setText(0, label);
|
||||
child->setToolTip(0, label);
|
||||
child->setData(0, Qt::UserRole, name);
|
||||
Gui::ViewProvider* vp = activeGui->getViewProvider(*it);
|
||||
if (vp) child->setIcon(0, vp->getIcon());
|
||||
d->ui.treeWidgetWire->addTopLevelItem(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool LoftWidget::accept()
|
||||
{
|
||||
QString list, solid, ruled;
|
||||
if (d->ui.checkSolid->isChecked())
|
||||
solid = QString::fromAscii("True");
|
||||
else
|
||||
solid = QString::fromAscii("False");
|
||||
|
||||
if (d->ui.checkRuledSurface->isChecked())
|
||||
ruled = QString::fromAscii("True");
|
||||
else
|
||||
ruled = QString::fromAscii("False");
|
||||
|
||||
QTextStream str(&list);
|
||||
|
||||
int count = d->ui.treeWidgetLoft->topLevelItemCount();
|
||||
if (count < 2) {
|
||||
QMessageBox::critical(this, tr("Too few elements"), tr("At least two vertices or wires are rquired."));
|
||||
return false;
|
||||
}
|
||||
for (int i=0; i<count; i++) {
|
||||
QTreeWidgetItem* child = d->ui.treeWidgetLoft->topLevelItem(i);
|
||||
QString name = child->data(0, Qt::UserRole).toString();
|
||||
str << "App.getDocument('" << d->document.c_str() << "')." << name << ", ";
|
||||
}
|
||||
|
||||
try {
|
||||
QString cmd;
|
||||
cmd = QString::fromAscii(
|
||||
"App.getDocument('%4').addObject('Part::Loft','Loft')\n"
|
||||
"App.getDocument('%4').ActiveObject.Sections=[%1]\n"
|
||||
"App.getDocument('%4').ActiveObject.Solid=%2\n"
|
||||
"App.getDocument('%4').ActiveObject.Ruled=%3\n"
|
||||
).arg(list).arg(solid).arg(ruled).arg(QString::fromAscii(d->document.c_str()));
|
||||
|
||||
Gui::Document* doc = Gui::Application::Instance->getDocument(d->document.c_str());
|
||||
if (!doc) throw Base::Exception("Document doesn't exist anymore");
|
||||
doc->openCommand("Loft");
|
||||
Gui::Application::Instance->runPythonCode((const char*)cmd.toAscii(), false, false);
|
||||
doc->commitCommand();
|
||||
doc->getDocument()->recompute();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LoftWidget::reject()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void LoftWidget::onCurrentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous)
|
||||
{
|
||||
if (previous) {
|
||||
Gui::Selection().rmvSelection(d->document.c_str(),
|
||||
(const char*)previous->data(0,Qt::UserRole).toByteArray());
|
||||
}
|
||||
if (current) {
|
||||
Gui::Selection().addSelection(d->document.c_str(),
|
||||
(const char*)current->data(0,Qt::UserRole).toByteArray());
|
||||
}
|
||||
}
|
||||
|
||||
void LoftWidget::on_addButton_clicked()
|
||||
{
|
||||
QTreeWidgetItem* item = d->ui.treeWidgetWire->currentItem();
|
||||
if (item) {
|
||||
int index = d->ui.treeWidgetWire->indexOfTopLevelItem(item);
|
||||
item = d->ui.treeWidgetWire->takeTopLevelItem(index);
|
||||
d->ui.treeWidgetWire->setCurrentItem(0);
|
||||
d->ui.treeWidgetLoft->addTopLevelItem(item);
|
||||
d->ui.treeWidgetLoft->setCurrentItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
void LoftWidget::on_removeButton_clicked()
|
||||
{
|
||||
QTreeWidgetItem* item = d->ui.treeWidgetLoft->currentItem();
|
||||
if (item) {
|
||||
int index = d->ui.treeWidgetLoft->indexOfTopLevelItem(item);
|
||||
item = d->ui.treeWidgetLoft->takeTopLevelItem(index);
|
||||
d->ui.treeWidgetLoft->setCurrentItem(0);
|
||||
d->ui.treeWidgetWire->addTopLevelItem(item);
|
||||
d->ui.treeWidgetWire->setCurrentItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
void LoftWidget::on_upButton_clicked()
|
||||
{
|
||||
QTreeWidgetItem* item = d->ui.treeWidgetLoft->currentItem();
|
||||
if (item && d->ui.treeWidgetLoft->isItemSelected(item)) {
|
||||
int index = d->ui.treeWidgetLoft->indexOfTopLevelItem(item);
|
||||
if (index > 0) {
|
||||
d->ui.treeWidgetLoft->takeTopLevelItem(index);
|
||||
d->ui.treeWidgetLoft->insertTopLevelItem(index-1, item);
|
||||
d->ui.treeWidgetLoft->setCurrentItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LoftWidget::on_downButton_clicked()
|
||||
{
|
||||
QTreeWidgetItem* item = d->ui.treeWidgetLoft->currentItem();
|
||||
if (item && d->ui.treeWidgetLoft->isItemSelected(item)) {
|
||||
int index = d->ui.treeWidgetLoft->indexOfTopLevelItem(item);
|
||||
if (index < d->ui.treeWidgetLoft->topLevelItemCount()-1) {
|
||||
d->ui.treeWidgetLoft->takeTopLevelItem(index);
|
||||
d->ui.treeWidgetLoft->insertTopLevelItem(index+1, item);
|
||||
d->ui.treeWidgetLoft->setCurrentItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LoftWidget::changeEvent(QEvent *e)
|
||||
{
|
||||
QWidget::changeEvent(e);
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
d->ui.retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* TRANSLATOR PartGui::TaskLoft */
|
||||
|
||||
TaskLoft::TaskLoft()
|
||||
{
|
||||
widget = new LoftWidget();
|
||||
taskbox = new Gui::TaskView::TaskBox(
|
||||
QPixmap(), widget->windowTitle(), true, 0);
|
||||
taskbox->groupLayout()->addWidget(widget);
|
||||
Content.push_back(taskbox);
|
||||
}
|
||||
|
||||
TaskLoft::~TaskLoft()
|
||||
{
|
||||
}
|
||||
|
||||
void TaskLoft::open()
|
||||
{
|
||||
}
|
||||
|
||||
void TaskLoft::clicked(int)
|
||||
{
|
||||
}
|
||||
|
||||
bool TaskLoft::accept()
|
||||
{
|
||||
return widget->accept();
|
||||
}
|
||||
|
||||
bool TaskLoft::reject()
|
||||
{
|
||||
return widget->reject();
|
||||
}
|
||||
|
||||
#include "moc_TaskLoft.cpp"
|
85
src/Mod/Part/Gui/TaskLoft.h
Normal file
85
src/Mod/Part/Gui/TaskLoft.h
Normal file
|
@ -0,0 +1,85 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2011 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef PARTGUI_TASKLOFT_H
|
||||
#define PARTGUI_TASKLOFT_H
|
||||
|
||||
#include <Gui/TaskView/TaskView.h>
|
||||
#include <Gui/TaskView/TaskDialog.h>
|
||||
|
||||
class QTreeWidgetItem;
|
||||
|
||||
namespace PartGui {
|
||||
|
||||
class LoftWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LoftWidget(QWidget* parent = 0);
|
||||
~LoftWidget();
|
||||
|
||||
bool accept();
|
||||
bool reject();
|
||||
|
||||
private Q_SLOTS:
|
||||
void on_addButton_clicked();
|
||||
void on_removeButton_clicked();
|
||||
void on_upButton_clicked();
|
||||
void on_downButton_clicked();
|
||||
void onCurrentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*);
|
||||
|
||||
private:
|
||||
void changeEvent(QEvent *e);
|
||||
void findShapes();
|
||||
|
||||
private:
|
||||
class Private;
|
||||
Private* d;
|
||||
};
|
||||
|
||||
class TaskLoft : public Gui::TaskView::TaskDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TaskLoft();
|
||||
~TaskLoft();
|
||||
|
||||
public:
|
||||
void open();
|
||||
bool accept();
|
||||
bool reject();
|
||||
void clicked(int);
|
||||
|
||||
QDialogButtonBox::StandardButtons getStandardButtons() const
|
||||
{ return QDialogButtonBox::Ok|QDialogButtonBox::Cancel; }
|
||||
|
||||
private:
|
||||
LoftWidget* widget;
|
||||
Gui::TaskView::TaskBox* taskbox;
|
||||
};
|
||||
|
||||
} //namespace PartGui
|
||||
|
||||
#endif // PARTGUI_TASKLOFT_H
|
204
src/Mod/Part/Gui/TaskLoft.ui
Normal file
204
src/Mod/Part/Gui/TaskLoft.ui
Normal file
|
@ -0,0 +1,204 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PartGui::TaskLoft</class>
|
||||
<widget class="QWidget" name="PartGui::TaskLoft">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>324</width>
|
||||
<height>326</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Loft</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QTreeWidget" name="treeWidgetWire">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Vertex/Wire</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<spacer name="spacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>33</width>
|
||||
<height>58</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Move right</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><b>Move the selected item one level down.</b><p>This will also change the level of the parent item.</p></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../Gui/Icons/resource.qrc">
|
||||
<normaloff>:/icons/button_right.xpm</normaloff>:/icons/button_right.xpm</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="removeButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Move left</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><b>Move the selected item one level up.</b><p>This will also change the level of the parent item.</p></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../Gui/Icons/resource.qrc">
|
||||
<normaloff>:/icons/button_left.xpm</normaloff>:/icons/button_left.xpm</iconset>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="upButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Move up</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><b>Move the selected item up.</b><p>The item will be moved within the hierarchy level.</p></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../Gui/Icons/resource.qrc">
|
||||
<normaloff>:/icons/button_up.xpm</normaloff>:/icons/button_up.xpm</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="downButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Move down</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><b>Move the selected item down.</b><p>The item will be moved within the hierarchy level.</p></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../Gui/Icons/resource.qrc">
|
||||
<normaloff>:/icons/button_down.xpm</normaloff>:/icons/button_down.xpm</iconset>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>33</width>
|
||||
<height>57</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QTreeWidget" name="treeWidgetLoft">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Loft</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="checkSolid">
|
||||
<property name="text">
|
||||
<string>Create solid</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="checkRuledSurface">
|
||||
<property name="text">
|
||||
<string>Ruled surface</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../../Gui/Icons/resource.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -99,7 +99,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/* TRANSLATOR PartGui::TaskShapeBuilder */
|
||||
/* TRANSLATOR PartGui::ShapeBuilderWidget */
|
||||
|
||||
ShapeBuilderWidget::ShapeBuilderWidget(QWidget* parent)
|
||||
: d(new Private())
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef PARTGUI_TASKSETCOLORS_H
|
||||
#define PARTGUI_TASKSETCOLORS_H
|
||||
#ifndef PARTGUI_TASKSHAPEBUILDER_H
|
||||
#define PARTGUI_TASKSHAPEBUILDER_H
|
||||
|
||||
#include <Gui/TaskView/TaskView.h>
|
||||
#include <Gui/TaskView/TaskDialog.h>
|
||||
|
@ -80,4 +80,4 @@ private:
|
|||
|
||||
} //namespace PartGui
|
||||
|
||||
#endif // PARTGUI_TASKSETCOLORS_H
|
||||
#endif // PARTGUI_TASKSHAPEBUILDER_H
|
||||
|
|
|
@ -66,7 +66,8 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
|||
<< "Part_MakeSolid" << "Part_ReverseShape" << "Part_SimpleCopy" << "Separator"
|
||||
<< "Part_Boolean" << "Part_CrossSections" << "Part_Extrude"
|
||||
<< "Part_Revolve" << "Part_Mirror" << "Part_Fillet"
|
||||
<< "Part_RuledSurface" << "Part_Builder" << "Separator" << "Part_ShapeInfo";
|
||||
<< "Part_RuledSurface" << "Part_Loft"
|
||||
<< "Part_Builder" << "Separator" << "Part_ShapeInfo";
|
||||
|
||||
Gui::MenuItem* partSimple = new Gui::MenuItem;
|
||||
root->insertItem(item, partSimple);
|
||||
|
|
Loading…
Reference in New Issue
Block a user