[TD] add dialog for hatches
as discussed in the forum, the hatch feature misses a dialog. So here it is. The code is more or less just the one of the existing GeomHatch dialog
This commit is contained in:
@@ -59,16 +59,16 @@ DrawHatch::DrawHatch(void)
|
||||
{
|
||||
static const char *vgroup = "Hatch";
|
||||
|
||||
ADD_PROPERTY_TYPE(DirProjection ,(0,0,1.0) ,vgroup,App::Prop_None,"Projection direction when Hatch was defined"); //sb RO?
|
||||
ADD_PROPERTY_TYPE(Source,(0),vgroup,(App::PropertyType)(App::Prop_None),"The View + Face to be hatched");
|
||||
ADD_PROPERTY_TYPE(DirProjection, (0,0,1.0), vgroup, App::Prop_None, "Projection direction when Hatch was defined"); //sb RO?
|
||||
ADD_PROPERTY_TYPE(Source, (0), vgroup, (App::PropertyType)(App::Prop_None), "The View + Face to be hatched");
|
||||
Source.setScope(App::LinkScope::Global);
|
||||
ADD_PROPERTY_TYPE(HatchPattern ,(prefSvgHatch()),vgroup,App::Prop_None,"The hatch pattern file for this area");
|
||||
ADD_PROPERTY_TYPE(HatchPattern, (prefSvgHatch()), vgroup, App::Prop_None, "The hatch pattern file for this area");
|
||||
ADD_PROPERTY_TYPE(SvgIncluded, (""), vgroup,App::Prop_None,
|
||||
"Embedded Svg hatch file. System use only."); // n/a to end users
|
||||
"Embedded SVG hatch file. System use only."); // n/a to end users
|
||||
|
||||
DirProjection.setStatus(App::Property::ReadOnly,true);
|
||||
|
||||
std::string svgFilter("Svg files (*.svg *.SVG);;All files (*)");
|
||||
std::string svgFilter("SVG files (*.svg *.SVG);;All files (*)");
|
||||
HatchPattern.setFilter(svgFilter);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ set(TechDrawGui_MOC_HDRS
|
||||
DlgTemplateField.h
|
||||
TaskSectionView.h
|
||||
TaskGeomHatch.h
|
||||
TaskHatch.h
|
||||
TaskLeaderLine.h
|
||||
TaskRichAnno.h
|
||||
TaskCosVertex.h
|
||||
@@ -98,6 +99,7 @@ set(TechDrawGui_UIC_SRCS
|
||||
DlgTemplateField.ui
|
||||
TaskSectionView.ui
|
||||
TaskGeomHatch.ui
|
||||
TaskHatch.ui
|
||||
TaskLeaderLine.ui
|
||||
TaskRichAnno.ui
|
||||
mrichtextedit.ui
|
||||
@@ -185,6 +187,9 @@ SET(TechDrawGui_SRCS
|
||||
TaskGeomHatch.ui
|
||||
TaskGeomHatch.cpp
|
||||
TaskGeomHatch.h
|
||||
TaskHatch.ui
|
||||
TaskHatch.cpp
|
||||
TaskHatch.h
|
||||
TaskLeaderLine.ui
|
||||
TaskLeaderLine.cpp
|
||||
TaskLeaderLine.h
|
||||
@@ -347,10 +352,10 @@ SET(TechDrawGuiViewProvider_SRCS
|
||||
ViewProviderSpreadsheet.h
|
||||
ViewProviderViewClip.cpp
|
||||
ViewProviderViewClip.h
|
||||
ViewProviderHatch.cpp
|
||||
ViewProviderHatch.h
|
||||
ViewProviderGeomHatch.cpp
|
||||
ViewProviderGeomHatch.h
|
||||
ViewProviderHatch.cpp
|
||||
ViewProviderHatch.h
|
||||
ViewProviderImage.cpp
|
||||
ViewProviderImage.h
|
||||
ViewProviderLeader.cpp
|
||||
@@ -375,6 +380,7 @@ SET(TechDrawGuiTaskDlgs_SRCS
|
||||
TaskLinkDim.ui
|
||||
TaskSectionView.ui
|
||||
TaskGeomHatch.ui
|
||||
TaskHatch.ui
|
||||
TaskLeaderLine.ui
|
||||
TaskRichAnno.ui
|
||||
TaskCosVertex.ui
|
||||
|
||||
@@ -59,9 +59,11 @@
|
||||
#include "DrawGuiUtil.h"
|
||||
#include "MDIViewPage.h"
|
||||
#include "TaskGeomHatch.h"
|
||||
#include "TaskHatch.h"
|
||||
//#include "TaskLeaderLine.h"
|
||||
//#include "TaskRichAnno.h"
|
||||
#include "ViewProviderGeomHatch.h"
|
||||
#include "ViewProviderHatch.h"
|
||||
#include "ViewProviderPage.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
@@ -281,9 +283,19 @@ void CmdTechDrawHatch::activated(int iMsg)
|
||||
auto hatch( static_cast<TechDraw::DrawHatch *>(getDocument()->getObject(FeatName.c_str())) );
|
||||
hatch->Source.setValue(partFeat, subNames);
|
||||
|
||||
Gui::ViewProvider* vp = Gui::Application::Instance->getDocument(getDocument())->getViewProvider(hatch);
|
||||
TechDrawGui::ViewProviderHatch* hvp = dynamic_cast<TechDrawGui::ViewProviderHatch*>(vp);
|
||||
if (!hvp) {
|
||||
Base::Console().Log("ERROR - CommandDecorate - Hatch has no ViewProvider\n");
|
||||
return;
|
||||
}
|
||||
|
||||
//should this be: doCommand(Doc,"App..Feat..Source = [(App...%s,%s),(App..%s,%s),...]",objs[0]->getNameInDocument(),subs[0],...);
|
||||
//seems very unwieldy
|
||||
|
||||
// dialog to fill in hatch values
|
||||
Gui::Control().showDialog(new TaskDlgHatch(hatch, hvp, true));
|
||||
|
||||
commitCommand();
|
||||
|
||||
//Horrible hack to force Tree update ??still required??
|
||||
@@ -353,8 +365,7 @@ void CmdTechDrawGeometricHatch::activated(int iMsg)
|
||||
}
|
||||
|
||||
// dialog to fill in hatch values
|
||||
Gui::Control().showDialog(new TaskDlgGeomHatch(geomhatch,hvp,true));
|
||||
|
||||
Gui::Control().showDialog(new TaskDlgGeomHatch(geomhatch, hvp, true));
|
||||
|
||||
commitCommand();
|
||||
|
||||
|
||||
218
src/Mod/TechDraw/Gui/TaskHatch.cpp
Normal file
218
src/Mod/TechDraw/Gui/TaskHatch.cpp
Normal file
@@ -0,0 +1,218 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2020 FreeCAD Developers *
|
||||
* Author: Uwe Stöhr <uwestoehr@lyx.org> *
|
||||
* *
|
||||
* 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 <cmath>
|
||||
#endif // #ifndef _PreComp_
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Vector3D.h>
|
||||
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/Selection.h>
|
||||
#include <Gui/ViewProvider.h>
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawView.h>
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
|
||||
#include "ViewProviderHatch.h"
|
||||
#include "TaskHatch.h"
|
||||
#include <Mod/TechDraw/Gui/ui_TaskHatch.h>
|
||||
|
||||
using namespace Gui;
|
||||
using namespace TechDraw;
|
||||
using namespace TechDrawGui;
|
||||
|
||||
TaskHatch::TaskHatch(TechDraw::DrawHatch* inHatch, TechDrawGui::ViewProviderHatch* inVp, bool mode) :
|
||||
ui(new Ui_TaskHatch),
|
||||
m_hatch(inHatch),
|
||||
m_Vp(inVp),
|
||||
m_createMode(mode)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
connect(ui->fcFile, SIGNAL(fileNameSelected( const QString & )), this, SLOT(onFileChanged(void)));
|
||||
|
||||
m_source = m_hatch->Source.getValue();
|
||||
getParameters();
|
||||
initUi();
|
||||
}
|
||||
|
||||
TaskHatch::~TaskHatch()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void TaskHatch::initUi()
|
||||
{
|
||||
ui->fcFile->setFileName(QString::fromUtf8(m_file.data(), m_file.size()));
|
||||
ui->sbScale->setValue(m_scale);
|
||||
ui->sbScale->setSingleStep(0.1);
|
||||
connect(ui->sbScale, SIGNAL(valueChanged(double)), this, SLOT(onScaleChanged()));
|
||||
ui->ccColor->setColor(m_color.asValue<QColor>());
|
||||
connect(ui->ccColor, SIGNAL(changed()), this, SLOT(onColorChanged()));
|
||||
}
|
||||
|
||||
//move values from screen to DocObjs
|
||||
void TaskHatch::updateValues()
|
||||
{
|
||||
m_file = (ui->fcFile->fileName()).toUtf8().constData();
|
||||
m_hatch->HatchPattern.setValue(m_file);
|
||||
m_scale = ui->sbScale->value().getValue();
|
||||
m_Vp->HatchScale.setValue(m_scale);
|
||||
m_color.setValue<QColor>(ui->ccColor->color());
|
||||
m_Vp->HatchColor.setValue(m_color);
|
||||
}
|
||||
|
||||
QStringList TaskHatch::listToQ(std::vector<std::string> in)
|
||||
{
|
||||
QStringList result;
|
||||
for (auto& s: in) {
|
||||
QString qs = QString::fromUtf8(s.data(), s.size());
|
||||
result.append(qs);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void TaskHatch::onFileChanged(void)
|
||||
{
|
||||
m_file = ui->fcFile->fileName().toUtf8().constData();
|
||||
m_hatch->HatchPattern.setValue(m_file);
|
||||
m_source->getDocument()->recompute();
|
||||
}
|
||||
|
||||
bool TaskHatch::accept()
|
||||
{
|
||||
updateValues();
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.ActiveDocument.resetEdit()");
|
||||
m_source->touch();
|
||||
m_source->getDocument()->recompute();
|
||||
return true;
|
||||
}
|
||||
|
||||
void TaskHatch::onScaleChanged()
|
||||
{
|
||||
m_Vp->HatchScale.setValue(ui->sbScale->value().getValue());
|
||||
m_source->getDocument()->recompute();
|
||||
}
|
||||
|
||||
void TaskHatch::onColorChanged()
|
||||
{
|
||||
App::Color ac;
|
||||
ac.setValue<QColor>(ui->ccColor->color());
|
||||
m_Vp->HatchColor.setValue(ac);
|
||||
m_source->getDocument()->recompute();
|
||||
}
|
||||
|
||||
bool TaskHatch::reject()
|
||||
{
|
||||
if (getCreateMode()) {
|
||||
std::string HatchName = m_hatch->getNameInDocument();
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"App.activeDocument().removeObject('%s')",HatchName.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.ActiveDocument.resetEdit()");
|
||||
m_source->touch();
|
||||
m_source->getDocument()->recompute();
|
||||
} else {
|
||||
m_hatch->HatchPattern.setValue(m_origFile);
|
||||
m_Vp->HatchScale.setValue(m_origScale);
|
||||
m_Vp->HatchColor.setValue(m_origColor);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void TaskHatch::getParameters()
|
||||
{
|
||||
m_file = m_hatch->HatchPattern.getValue();
|
||||
m_scale = m_Vp->HatchScale.getValue();
|
||||
m_color = m_Vp->HatchColor.getValue();
|
||||
if (!getCreateMode()) {
|
||||
m_origFile = m_hatch->HatchPattern.getValue();
|
||||
m_origScale = m_Vp->HatchScale.getValue();
|
||||
m_origColor = m_Vp->HatchColor.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
void TaskHatch::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
TaskDlgHatch::TaskDlgHatch(TechDraw::DrawHatch* inHatch, TechDrawGui::ViewProviderHatch* inVp, bool mode) :
|
||||
TaskDialog(),
|
||||
viewProvider(nullptr)
|
||||
{
|
||||
widget = new TaskHatch(inHatch, inVp, mode);
|
||||
taskbox = new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("TechDraw_Tree_View"),
|
||||
widget->windowTitle(), true, 0);
|
||||
taskbox->groupLayout()->addWidget(widget);
|
||||
Content.push_back(taskbox);
|
||||
}
|
||||
|
||||
TaskDlgHatch::~TaskDlgHatch()
|
||||
{
|
||||
}
|
||||
|
||||
void TaskDlgHatch::setCreateMode(bool b)
|
||||
{
|
||||
widget->setCreateMode(b);
|
||||
}
|
||||
|
||||
void TaskDlgHatch::update()
|
||||
{
|
||||
//widget->updateTask();
|
||||
}
|
||||
|
||||
//==== calls from the TaskView ===============================================================
|
||||
void TaskDlgHatch::open()
|
||||
{
|
||||
}
|
||||
|
||||
void TaskDlgHatch::clicked(int i)
|
||||
{
|
||||
Q_UNUSED(i);
|
||||
}
|
||||
|
||||
bool TaskDlgHatch::accept()
|
||||
{
|
||||
widget->accept();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TaskDlgHatch::reject()
|
||||
{
|
||||
widget->reject();
|
||||
return true;
|
||||
}
|
||||
|
||||
#include <Mod/TechDraw/Gui/moc_TaskHatch.cpp>
|
||||
127
src/Mod/TechDraw/Gui/TaskHatch.h
Normal file
127
src/Mod/TechDraw/Gui/TaskHatch.h
Normal file
@@ -0,0 +1,127 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2020 FreeCAD Developers *
|
||||
* Author: Uwe Stöhr <uwestoehr@lyx.org> *
|
||||
* *
|
||||
* 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 GUI_TASKVIEW_TASKHATCH_H
|
||||
#define GUI_TASKVIEW_TASKHATCH_H
|
||||
|
||||
#include <App/Material.h>
|
||||
#include <Gui/TaskView/TaskDialog.h>
|
||||
#include <Gui/TaskView/TaskView.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawHatch.h>
|
||||
#include <Mod/TechDraw/Gui/ui_TaskHatch.h>
|
||||
|
||||
|
||||
class Ui_TaskHatch;
|
||||
|
||||
namespace App
|
||||
{
|
||||
class DocumentObject;
|
||||
}
|
||||
|
||||
namespace TechDrawGui
|
||||
{
|
||||
class ViewProviderHatch;
|
||||
|
||||
class TaskHatch : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TaskHatch(TechDraw::DrawHatch* inHatch,TechDrawGui::ViewProviderHatch* inVp, bool mode);
|
||||
~TaskHatch();
|
||||
|
||||
public:
|
||||
virtual bool accept();
|
||||
virtual bool reject();
|
||||
void setCreateMode(bool b) { m_createMode = b;}
|
||||
bool getCreateMode() { return m_createMode; }
|
||||
|
||||
protected Q_SLOTS:
|
||||
void onFileChanged(void);
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
void initUi();
|
||||
// bool resetUi();
|
||||
void updateValues();
|
||||
void getParameters();
|
||||
QStringList listToQ(std::vector<std::string> in);
|
||||
|
||||
private Q_SLOTS:
|
||||
void onScaleChanged();
|
||||
void onColorChanged();
|
||||
|
||||
private:
|
||||
Ui_TaskHatch * ui;
|
||||
TechDraw::DrawHatch* m_hatch;
|
||||
TechDrawGui::ViewProviderHatch* m_Vp;
|
||||
App::DocumentObject* m_source;
|
||||
std::string m_file;
|
||||
double m_scale;
|
||||
App::Color m_color;
|
||||
std::string m_origFile;
|
||||
double m_origScale;
|
||||
App::Color m_origColor;
|
||||
|
||||
bool m_createMode;
|
||||
|
||||
};
|
||||
|
||||
class TaskDlgHatch : public Gui::TaskView::TaskDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TaskDlgHatch(TechDraw::DrawHatch* inHatch,TechDrawGui::ViewProviderHatch* inVp, bool mode);
|
||||
~TaskDlgHatch();
|
||||
const ViewProviderHatch * getViewProvider() const { return viewProvider; }
|
||||
|
||||
public:
|
||||
/// is called the TaskView when the dialog is opened
|
||||
virtual void open();
|
||||
/// is called by the framework if an button is clicked which has no accept or reject role
|
||||
virtual void clicked(int);
|
||||
/// is called by the framework if the dialog is accepted (Ok)
|
||||
virtual bool accept();
|
||||
/// is called by the framework if the dialog is rejected (Cancel)
|
||||
virtual bool reject();
|
||||
/// is called by the framework if the user presses the help button
|
||||
virtual void helpRequested() { return;}
|
||||
virtual bool isAllowedAlterDocument(void) const
|
||||
{ return false; }
|
||||
void setCreateMode(bool b);
|
||||
|
||||
void update();
|
||||
|
||||
protected:
|
||||
const ViewProviderHatch *viewProvider;
|
||||
|
||||
private:
|
||||
TaskHatch * widget;
|
||||
Gui::TaskView::TaskBox* taskbox;
|
||||
};
|
||||
|
||||
} //namespace TechDrawGui
|
||||
|
||||
#endif // #ifndef GUI_TASKVIEW_TASKHATCH_H
|
||||
163
src/Mod/TechDraw/Gui/TaskHatch.ui
Normal file
163
src/Mod/TechDraw/Gui/TaskHatch.ui
Normal file
@@ -0,0 +1,163 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TechDrawGui::TaskHatch</class>
|
||||
<widget class="QWidget" name="TechDrawGui::TaskHatch">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>342</width>
|
||||
<height>135</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Apply Hatch to Face</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Define your pattern</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_3" columnstretch="0,1">
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::FileChooser" name="fcFile">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The PAT file containing your pattern</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Pattern File</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2" columnstretch="1,0,0">
|
||||
<item row="2" column="2">
|
||||
<widget class="Gui::ColorButton" name="ccColor">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Color of pattern lines</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Line Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="Gui::QuantitySpinBox" name="sbScale">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Enlarges/shrinks the pattern</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.001000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Pattern Scale</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Gui::FileChooser</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>Gui/FileDialog.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gui::QuantitySpinBox</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>Gui/QuantitySpinBox.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gui::ColorButton</class>
|
||||
<extends>QPushButton</extends>
|
||||
<header>Gui/Widgets.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="Resources/TechDraw.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -37,9 +37,12 @@
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Control.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawHatch.h>
|
||||
#include <Mod/TechDraw/App/DrawViewPart.h>
|
||||
|
||||
#include "TaskHatch.h"
|
||||
#include "ViewProviderHatch.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
@@ -93,6 +96,45 @@ std::vector<std::string> ViewProviderHatch::getDisplayModes(void) const
|
||||
return StrList;
|
||||
}
|
||||
|
||||
bool ViewProviderHatch::setEdit(int ModNum)
|
||||
{
|
||||
Q_UNUSED(ModNum);
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
TaskDlgHatch *projDlg = qobject_cast<TaskDlgHatch *>(dlg);
|
||||
if (projDlg && (projDlg->getViewProvider() != this))
|
||||
projDlg = 0; // somebody left task panel open
|
||||
|
||||
// clear the selection (convenience)
|
||||
Gui::Selection().clearSelection();
|
||||
|
||||
// start the edit dialog
|
||||
if (projDlg) {
|
||||
projDlg->setCreateMode(false);
|
||||
Gui::Control().showDialog(projDlg);
|
||||
}
|
||||
else {
|
||||
Gui::Control().showDialog(new TaskDlgHatch(getViewObject(), this, false));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ViewProviderHatch::unsetEdit(int ModNum)
|
||||
{
|
||||
if (ModNum == ViewProvider::Default) {
|
||||
Gui::Control().closeDialog();
|
||||
}
|
||||
else {
|
||||
ViewProviderDocumentObject::unsetEdit(ModNum);
|
||||
}
|
||||
}
|
||||
|
||||
bool ViewProviderHatch::doubleClicked(void)
|
||||
{
|
||||
setEdit(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
void ViewProviderHatch::onChanged(const App::Property* prop)
|
||||
{
|
||||
if ((prop == &HatchScale) ||
|
||||
|
||||
@@ -53,6 +53,9 @@ public:
|
||||
/// returns a list of all possible modes
|
||||
virtual std::vector<std::string> getDisplayModes(void) const override;
|
||||
virtual void onChanged(const App::Property* prop) override;
|
||||
virtual bool setEdit(int ModNum) override;
|
||||
virtual void unsetEdit(int ModNum) override;
|
||||
virtual bool doubleClicked(void) override;
|
||||
virtual void updateData(const App::Property*) override;
|
||||
virtual bool canDelete(App::DocumentObject* obj) const override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user