1
/***************************************************************************
2
* Copyright (c) 2016 WandererFan <wandererfan@gmail.com> *
4
* This file is part of the FreeCAD CAx development system. *
6
* This library is free software; you can redistribute it and/or *
7
* modify it under the terms of the GNU Library General Public *
8
* License as published by the Free Software Foundation; either *
9
* version 2 of the License, or (at your option) any later version. *
11
* This library is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
* GNU Library General Public License for more details. *
16
* You should have received a copy of the GNU Library General Public *
17
* License along with this library; see the file COPYING.LIB. If not, *
18
* write to the Free Software Foundation, Inc., 59 Temple Place, *
19
* Suite 330, Boston, MA 02111-1307, USA *
21
***************************************************************************/
23
#include "PreCompiled.h"
27
#endif// #ifndef _PreComp_
29
#include "Widgets/CompassWidget.h"
30
#include "Widgets/VectorEditWidget.h"
31
#include <App/Document.h>
32
#include <App/DocumentObject.h>
33
#include <Base/Console.h>
34
#include <Base/Tools.h>
35
#include <Gui/BitmapFactory.h>
36
#include <Gui/Command.h>
37
#include <Gui/Control.h>
38
#include <Gui/MainWindow.h>
39
#include <Gui/Selection.h>
40
#include <Gui/ViewProvider.h>
41
#include <Gui/WaitCursor.h>
42
#include <Mod/TechDraw/App/DrawPage.h>
43
#include <Mod/TechDraw/App/DrawViewPart.h>
44
#include <Mod/TechDraw/App/DrawViewSection.h>
47
#include "ui_TaskSectionView.h"
48
#include "TaskSectionView.h"
53
using namespace TechDraw;
54
using namespace TechDrawGui;
57
TaskSectionView::TaskSectionView(TechDraw::DrawViewPart* base) :
58
ui(new Ui_TaskSectionView),
67
m_directionIsSet(false),
68
m_modelIsDirty(false),
71
//existence of base is guaranteed by CmdTechDrawSectionView (Command.cpp)
73
m_sectionName = std::string();
74
m_doc = m_base->getDocument();
76
m_saveBaseName = m_base->getNameInDocument();
77
m_savePageName = m_base->findParentPage()->getNameInDocument();
82
m_applyDeferred = 0;//setting the direction widgets causes an increment of the deferred count,
83
//so we reset the counter and the message.
87
TaskSectionView::TaskSectionView(TechDraw::DrawViewSection* section) :
88
ui(new Ui_TaskSectionView),
96
m_directionIsSet(true),
97
m_modelIsDirty(false),
100
//existence of section is guaranteed by ViewProviderViewSection.setEdit
102
m_doc = m_section->getDocument();
103
m_sectionName = m_section->getNameInDocument();
104
App::DocumentObject* newObj = m_section->BaseView.getValue();
105
m_base = dynamic_cast<TechDraw::DrawViewPart*>(newObj);
106
if (!newObj || !m_base) {
107
throw Base::RuntimeError("TaskSectionView - BaseView not found");
110
m_saveBaseName = m_base->getNameInDocument();
111
m_savePageName = m_base->findParentPage()->getNameInDocument();
115
m_dirName = m_section->SectionDirection.getValueAsString();
119
m_applyDeferred = 0;//setting the direction widgets causes an increment of the deferred count,
120
//so we reset the counter and the message.
121
ui->lPendingUpdates->setText(QString());
124
void TaskSectionView::setUiPrimary()
126
// Base::Console().Message("TSV::setUiPrimary()\n");
127
setWindowTitle(QObject::tr("Create Section View"));
129
// note DPGI will have a custom scale type and scale = 1.0. In this case,
130
// we need the values from the parent DPG!
131
ui->sbScale->setValue(m_base->getScale());
133
ui->cmbScaleType->setCurrentIndex(m_base->getScaleType());
135
//Allow or prevent scale changing initially
136
if (m_base->getScaleType() == 2) {
138
ui->sbScale->setEnabled(true);
141
ui->sbScale->setEnabled(false);
144
Base::Vector3d origin = m_base->getOriginalCentroid();
147
m_compass->setDialAngle(0.0);
148
m_viewDirectionWidget->setValueNoNotify(Base::Vector3d(1.0, 0.0, 0.0));
150
//don't allow updates until a direction is picked
151
ui->pbUpdateNow->setEnabled(false);
152
ui->cbLiveUpdate->setEnabled(false);
154
QString::fromUtf8(QT_TRANSLATE_NOOP("TaskSectionView", "No direction set"));
155
ui->lPendingUpdates->setText(msgLiteral);
158
void TaskSectionView::setUiEdit()
160
// Base::Console().Message("TSV::setUiEdit()\n");
161
setWindowTitle(QObject::tr("Edit Section View"));
162
std::string temp = m_section->SectionSymbol.getValue();
163
QString qTemp = Base::Tools::fromStdString(temp);
164
ui->leSymbol->setText(qTemp);
166
ui->sbScale->setValue(m_section->getScale());
167
ui->cmbScaleType->setCurrentIndex(m_section->getScaleType());
168
//Allow or prevent scale changing initially
169
if (m_section->ScaleType.isValue("Custom")) {
170
ui->sbScale->setEnabled(true);
173
ui->sbScale->setEnabled(false);
176
Base::Vector3d origin = m_section->SectionOrigin.getValue();
179
// convert section normal to view angle
180
Base::Vector3d sectionNormalVec = m_section->SectionNormal.getValue();
181
sectionNormalVec.Normalize();
182
Base::Vector3d projectedViewDirection = m_base->projectPoint(sectionNormalVec, false);
183
projectedViewDirection.Normalize();
184
double viewAngle = atan2(-projectedViewDirection.y, -projectedViewDirection.x);
185
m_compass->setDialAngle(viewAngle * 180.0 / M_PI);
186
m_viewDirectionWidget->setValueNoNotify(sectionNormalVec * -1.0);
189
void TaskSectionView::setUiCommon(Base::Vector3d origin)
191
std::string temp = m_base->getNameInDocument();
192
QString qTemp = Base::Tools::fromStdString(temp);
193
ui->leBaseView->setText(qTemp);
195
ui->sbOrgX->setUnit(Base::Unit::Length);
196
ui->sbOrgX->setValue(origin.x);
197
ui->sbOrgY->setUnit(Base::Unit::Length);
198
ui->sbOrgY->setValue(origin.y);
199
ui->sbOrgZ->setUnit(Base::Unit::Length);
200
ui->sbOrgZ->setValue(origin.z);
204
connect(ui->leSymbol, &QLineEdit::editingFinished, this, &TaskSectionView::onIdentifierChanged);
206
//TODO: use event filter instead of keyboard tracking to capture enter/return keys
207
// the UI file uses keyboardTracking = false so that a recomputation
208
// will only be triggered when the arrow keys of the spinboxes are used
209
//if this is not done, recomputes are triggered on each key press giving
211
connect(ui->sbScale, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &TaskSectionView::onScaleChanged);
212
connect(ui->sbOrgX, qOverload<double>(&QuantitySpinBox::valueChanged), this, &TaskSectionView::onXChanged);
213
connect(ui->sbOrgY, qOverload<double>(&QuantitySpinBox::valueChanged), this, &TaskSectionView::onYChanged);
214
connect(ui->sbOrgZ, qOverload<double>(&QuantitySpinBox::valueChanged), this, &TaskSectionView::onZChanged);
216
connect(ui->cmbScaleType, qOverload<int>(&QComboBox::currentIndexChanged), this, &TaskSectionView::scaleTypeChanged);
218
connect(ui->pbUp, &QToolButton::clicked, this, &TaskSectionView::onUpClicked);
219
connect(ui->pbDown, &QToolButton::clicked, this, &TaskSectionView::onDownClicked);
220
connect(ui->pbRight, &QToolButton::clicked, this, &TaskSectionView::onRightClicked);
221
connect(ui->pbLeft, &QToolButton::clicked, this, &TaskSectionView::onLeftClicked);
223
connect(ui->pbUpdateNow, &QToolButton::clicked, this, &TaskSectionView::updateNowClicked);
224
connect(ui->cbLiveUpdate, &QToolButton::clicked, this, &TaskSectionView::liveUpdateClicked);
226
m_compass = new CompassWidget(this);
227
auto layout = ui->compassLayout;
228
layout->addWidget(m_compass);
229
connect(m_compass, &CompassWidget::angleChanged, this, &TaskSectionView::slotChangeAngle);
231
m_viewDirectionWidget = new VectorEditWidget(this);
232
m_viewDirectionWidget->setLabel(QObject::tr("Current View Direction"));
233
m_viewDirectionWidget->setToolTip(QObject::tr("The view direction in BaseView coordinates"));
234
auto editLayout = ui->viewDirectionLayout;
235
editLayout->addWidget(m_viewDirectionWidget);
236
connect(m_viewDirectionWidget, &VectorEditWidget::valueChanged, this,
237
&TaskSectionView::slotViewDirectionChanged);
240
//save the start conditions
241
void TaskSectionView::saveSectionState()
243
// Base::Console().Message("TSV::saveSectionState()\n");
245
m_saveSymbol = m_section->SectionSymbol.getValue();
246
m_saveScale = m_section->getScale();
247
m_saveScaleType = m_section->getScaleType();
248
m_saveNormal = m_section->SectionNormal.getValue();
249
m_normal = m_saveNormal;
250
m_saveDirection = m_section->Direction.getValue();
251
m_saveOrigin = m_section->SectionOrigin.getValue();
252
m_saveDirName = m_section->SectionDirection.getValueAsString();
257
//restore the start conditions
258
void TaskSectionView::restoreSectionState()
260
// Base::Console().Message("TSV::restoreSectionState()\n");
264
m_section->SectionSymbol.setValue(m_saveSymbol);
265
m_section->Scale.setValue(m_saveScale);
266
m_section->ScaleType.setValue(m_saveScaleType);
267
m_section->SectionNormal.setValue(m_saveNormal);
268
m_section->Direction.setValue(m_saveDirection);
269
m_section->SectionOrigin.setValue(m_saveOrigin);
270
m_section->SectionDirection.setValue(m_saveDirName.c_str());
273
//the VectorEditWidget reports a change in direction
274
void TaskSectionView::slotViewDirectionChanged(Base::Vector3d newDirection)
276
// Base::Console().Message("TSV::slotViewDirectionChanged(%s)\n",
277
// DrawUtil::formatVector(newDirection).c_str());
278
Base::Vector3d projectedViewDirection = m_base->projectPoint(newDirection, false);
279
projectedViewDirection.Normalize();
280
double viewAngle = atan2(projectedViewDirection.y, projectedViewDirection.x);
281
m_compass->setDialAngle(viewAngle * 180.0 / M_PI);
286
//the CompassWidget reports that the view direction angle has changed
287
void TaskSectionView::slotChangeAngle(double newAngle)
289
// Base::Console().Message("TSV::slotChangeAngle(%.3f)\n", newAngle);
290
double angleRadians = newAngle * M_PI / 180.0;
291
double unitX = cos(angleRadians);
292
double unitY = sin(angleRadians);
293
Base::Vector3d localUnit(unitX, unitY, 0.0);
294
m_viewDirectionWidget->setValueNoNotify(localUnit);
299
//preset view directions
300
void TaskSectionView::onUpClicked()
302
// Base::Console().Message("TSV::onUpClicked()\n");
304
m_compass->setToNorth();
305
m_viewDirectionWidget->setValueNoNotify(Base::Vector3d(0.0, 1.0, 0.0));
309
void TaskSectionView::onDownClicked()
311
// Base::Console().Message("TSV::onDownClicked()\n");
313
m_compass->setToSouth();
314
m_viewDirectionWidget->setValueNoNotify(Base::Vector3d(0.0, -1.0, 0.0));
318
void TaskSectionView::onLeftClicked()
320
// Base::Console().Message("TSV::onLeftClicked()\n");
322
m_compass->setToWest();
323
m_viewDirectionWidget->setValueNoNotify(Base::Vector3d(-1.0, 0.0, 0.0));
327
void TaskSectionView::onRightClicked()
329
// Base::Console().Message("TSV::onRightClicked()\n");
331
m_compass->setToEast();
332
m_viewDirectionWidget->setValueNoNotify(Base::Vector3d(1.0, 0.0, 0.0));
336
void TaskSectionView::onIdentifierChanged()
342
void TaskSectionView::onScaleChanged()
344
m_scaleEdited = true;
350
//SectionOrigin changed
351
void TaskSectionView::onXChanged()
356
void TaskSectionView::onYChanged()
361
void TaskSectionView::onZChanged()
367
void TaskSectionView::scaleTypeChanged(int index)
371
ui->sbScale->setEnabled(false);
372
if (m_base->findParentPage()) {
373
ui->sbScale->setValue(m_base->findParentPage()->Scale.getValue());
374
ui->sbScale->setEnabled(false);
377
else if (index == 1) {
378
// Automatic Scale Type
379
ui->sbScale->setEnabled(false);
381
ui->sbScale->setValue(m_section->autoScale());
384
else if (index == 2) {
386
ui->sbScale->setEnabled(true);
388
ui->sbScale->setValue(m_section->Scale.getValue());
389
ui->sbScale->setEnabled(true);
397
void TaskSectionView::checkAll(bool check)
399
ui->pbUp->setChecked(check);
400
ui->pbDown->setChecked(check);
401
ui->pbRight->setChecked(check);
402
ui->pbLeft->setChecked(check);
405
void TaskSectionView::enableAll(bool enable)
407
ui->leSymbol->setEnabled(enable);
408
ui->sbScale->setEnabled(enable);
409
ui->sbOrgX->setEnabled(enable);
410
ui->sbOrgY->setEnabled(enable);
411
ui->sbOrgZ->setEnabled(enable);
412
ui->cmbScaleType->setEnabled(enable);
413
QString qScaleType = ui->cmbScaleType->currentText();
414
//Allow or prevent scale changing initially
415
if (qScaleType == QString::fromUtf8("Custom")) {
416
ui->sbScale->setEnabled(true);
419
ui->sbScale->setEnabled(false);
423
void TaskSectionView::liveUpdateClicked() { apply(true); }
425
void TaskSectionView::updateNowClicked() { apply(true); }
427
//******************************************************************************
428
bool TaskSectionView::apply(bool forceUpdate)
430
// Base::Console().Message("TSV::apply() - liveUpdate: %d force: %d deferred: %d\n",
431
// ui->cbLiveUpdate->isChecked(), forceUpdate, m_applyDeferred);
432
if (!ui->cbLiveUpdate->isChecked() && !forceUpdate) {
435
ui->lPendingUpdates->setText(tr("%n update(s) pending", "", m_applyDeferred));
440
m_modelIsDirty = true;
442
if (m_dirName.empty()) {
443
//this should never happen
445
Base::Tools::toStdString(tr("Nothing to apply. No section direction picked yet"));
446
Base::Console().Error((msg + "\n").c_str());
450
m_section = createSectionView();
453
if (isSectionValid()) {
460
m_section->recomputeFeature();
462
m_base->requestPaint();
470
ui->lPendingUpdates->setText(QString());
474
void TaskSectionView::applyQuick(std::string dir)
476
// Base::Console().Message("TSV::applyQuick(%s)\n", dir.c_str());
482
void TaskSectionView::applyAligned()
484
// Base::Console().Message("TSV::applyAligned()\n");
485
m_dirName = "Aligned";
487
m_directionIsSet = true;
488
ui->pbUpdateNow->setEnabled(true);
489
ui->cbLiveUpdate->setEnabled(true);
493
//*********************************************************************
495
TechDraw::DrawViewSection* TaskSectionView::createSectionView(void)
497
// Base::Console().Message("TSV::createSectionView()\n");
498
if (!isBaseValid()) {
503
std::string baseName = m_base->getNameInDocument();
505
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Create SectionView"));
507
const std::string objectName("SectionView");
508
m_sectionName = m_base->getDocument()->getUniqueObjectName(objectName.c_str());
509
Command::doCommand(Command::Doc, "App.ActiveDocument.addObject('TechDraw::DrawViewSection', '%s')",
510
m_sectionName.c_str());
512
// section labels (Section A-A) are not unique, and are not the same as the object name (SectionView)
513
// we pluck the generated suffix from the object name and append it to "Section" to generate
515
QString qTemp = ui->leSymbol->text();
516
std::string temp = Base::Tools::toStdString(qTemp);
517
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.SectionSymbol = '%s'",
518
m_sectionName.c_str(), temp.c_str());
520
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.Label = '%s'",
521
m_sectionName.c_str(),
522
makeSectionLabel(qTemp).c_str());
523
Command::doCommand(Command::Doc, "App.activeDocument().%s.translateLabel('DrawViewSection', 'Section', '%s')",
524
m_sectionName.c_str(), makeSectionLabel(qTemp).c_str());
527
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.addView(App.ActiveDocument.%s)",
528
m_savePageName.c_str(), m_sectionName.c_str());
529
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.BaseView = App.ActiveDocument.%s",
530
m_sectionName.c_str(), baseName.c_str());
531
Command::doCommand(Command::Doc,
532
"App.ActiveDocument.%s.Source = App.ActiveDocument.%s.Source",
533
m_sectionName.c_str(), baseName.c_str());
534
Command::doCommand(Command::Doc,
535
"App.ActiveDocument.%s.SectionOrigin = FreeCAD.Vector(%.6f, %.6f, %.6f)",
536
m_sectionName.c_str(), ui->sbOrgX->value().getValue(),
537
ui->sbOrgY->value().getValue(), ui->sbOrgZ->value().getValue());
539
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.Scale = %0.7f",
540
m_sectionName.c_str(), ui->sbScale->value());
542
int scaleType = ui->cmbScaleType->currentIndex();
543
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.ScaleType = %d",
544
m_sectionName.c_str(), scaleType);
545
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.SectionDirection = '%s'",
546
m_sectionName.c_str(), m_dirName.c_str());
548
App::DocumentObject* newObj = m_base->getDocument()->getObject(m_sectionName.c_str());
549
m_section = dynamic_cast<TechDraw::DrawViewSection*>(newObj);
550
if (!newObj || !m_section) {
551
throw Base::RuntimeError("TaskSectionView - new section object not found");
553
Base::Vector3d localUnit = m_viewDirectionWidget->value();
554
localUnit.Normalize();
555
if (m_dirName == "Aligned") {
556
//localUnit is a view direction so we need to reverse it to make a
558
m_section->setCSFromBase(localUnit * -1.0);
561
//Note: DirectionName is to be deprecated in the future
562
m_section->setCSFromBase(m_dirName.c_str());
564
//auto orientation of view relative to base view
565
double viewDirectionAngle = m_compass->positiveValue();
566
double rotation = requiredRotation(viewDirectionAngle);
567
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.Rotation = %.6f",
568
m_sectionName.c_str(), rotation);
571
Gui::Command::commitCommand();
575
void TaskSectionView::updateSectionView()
577
// Base::Console().Message("TSV::updateSectionView() - m_sectionName: %s\n", m_sectionName.c_str());
578
if (!isSectionValid()) {
583
const std::string objectName("SectionView");
584
std::string baseName = m_base->getNameInDocument();
586
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Edit SectionView"));
588
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.SectionDirection = '%s'",
589
m_sectionName.c_str(), m_dirName.c_str());
590
Command::doCommand(Command::Doc,
591
"App.ActiveDocument.%s.SectionOrigin = FreeCAD.Vector(%.3f, %.3f, %.3f)",
592
m_sectionName.c_str(), ui->sbOrgX->value().getValue(),
593
ui->sbOrgY->value().getValue(), ui->sbOrgZ->value().getValue());
595
QString qTemp = ui->leSymbol->text();
596
std::string temp = Base::Tools::toStdString(qTemp);
597
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.SectionSymbol = '%s'",
598
m_sectionName.c_str(), temp.c_str());
600
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.Label = '%s'",
601
m_sectionName.c_str(),
602
makeSectionLabel(qTemp).c_str());
603
Command::doCommand(Command::Doc, "App.activeDocument().%s.translateLabel('DrawViewSection', 'Section', '%s')",
604
m_sectionName.c_str(), makeSectionLabel(qTemp).c_str());
606
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.Scale = %0.7f",
607
m_sectionName.c_str(), ui->sbScale->value());
609
int scaleType = ui->cmbScaleType->currentIndex();
610
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.ScaleType = %d",
611
m_sectionName.c_str(), scaleType);
612
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.SectionDirection = '%s'",
613
m_sectionName.c_str(), m_dirName.c_str());
614
Base::Vector3d localUnit = m_viewDirectionWidget->value();
615
localUnit.Normalize();
616
if (m_dirName == "Aligned") {
617
//localUnit is a view direction so we need to reverse it to make a
619
m_section->setCSFromBase(localUnit * -1.0);
622
//Note: DirectionName is to be deprecated in the future
623
m_section->setCSFromBase(m_dirName.c_str());
625
//auto orientation of view relative to base view
626
double viewDirectionAngle = m_compass->positiveValue();
627
double rotation = requiredRotation(viewDirectionAngle);
628
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.Rotation = %.6f",
629
m_sectionName.c_str(), rotation);
631
Gui::Command::commitCommand();
634
std::string TaskSectionView::makeSectionLabel(QString symbol)
636
const std::string objectName("SectionView");
637
std::string uniqueSuffix{m_sectionName.substr(objectName.length(), std::string::npos)};
638
std::string uniqueLabel = "Section" + uniqueSuffix;
639
std::string temp = Base::Tools::toStdString(symbol);
640
return ( uniqueLabel + " " + temp + " - " + temp );
643
void TaskSectionView::failNoObject(void)
645
QString qsectionName = Base::Tools::fromStdString(m_sectionName);
646
QString qbaseName = Base::Tools::fromStdString(m_baseName);
647
QString msg = tr("Can not continue. Object * %1 or %2 not found.").arg(qsectionName, qbaseName);
648
QMessageBox::critical(Gui::getMainWindow(), QObject::tr("Operation Failed"), msg);
649
Gui::Control().closeDialog();
652
bool TaskSectionView::isBaseValid()
657
App::DocumentObject* baseObj = m_doc->getObject(m_saveBaseName.c_str());
664
bool TaskSectionView::isSectionValid()
669
App::DocumentObject* sectionObj = m_doc->getObject(m_sectionName.c_str());
676
//get required rotation from input angle in [0, 360]
677
double TaskSectionView::requiredRotation(double inputAngle)
679
double rotation = inputAngle - 90.0;
680
if (rotation == 180.0) {
681
//if the view direction is 90/270, then the section is drawn properly and no
682
//rotation is needed. 90.0 becomes 0.0, but 270.0 needs special handling.
688
//******************************************************************************
690
bool TaskSectionView::accept()
692
// Base::Console().Message("TSV::accept()\n");
694
Gui::Command::doCommand(Gui::Command::Gui, "Gui.ActiveDocument.resetEdit()");
698
bool TaskSectionView::reject()
700
// Base::Console().Message("TSV::reject()\n");
701
if (!m_section) {//no section created, nothing to undo
702
Gui::Command::doCommand(Gui::Command::Gui, "Gui.ActiveDocument.resetEdit()");
706
if (!isSectionValid()) {//section !exist. nothing to undo
708
m_base->requestPaint();
710
Gui::Command::doCommand(Gui::Command::Gui, "Gui.ActiveDocument.resetEdit()");
715
std::string SectionName = m_section->getNameInDocument();
716
Gui::Command::doCommand(Gui::Command::Gui,
717
"App.ActiveDocument.%s.removeView(App.ActiveDocument.%s)",
718
m_savePageName.c_str(), SectionName.c_str());
719
Gui::Command::doCommand(Gui::Command::Gui, "App.ActiveDocument.removeObject('%s')",
720
SectionName.c_str());
723
if (m_modelIsDirty) {
724
restoreSectionState();
725
m_section->recomputeFeature();
726
m_section->requestPaint();
731
m_base->requestPaint();
733
Gui::Command::updateActive();
734
Gui::Command::doCommand(Gui::Command::Gui, "Gui.ActiveDocument.resetEdit()");
739
void TaskSectionView::changeEvent(QEvent* event)
741
if (event->type() == QEvent::LanguageChange) {
742
ui->retranslateUi(this);
746
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
747
TaskDlgSectionView::TaskDlgSectionView(TechDraw::DrawViewPart* base) : TaskDialog()
749
widget = new TaskSectionView(base);
751
new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("actions/TechDraw_SectionView"),
752
widget->windowTitle(), true, nullptr);
753
taskbox->groupLayout()->addWidget(widget);
754
Content.push_back(taskbox);
757
TaskDlgSectionView::TaskDlgSectionView(TechDraw::DrawViewSection* section) : TaskDialog()
759
widget = new TaskSectionView(section);
761
new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("actions/TechDraw_SectionView"),
762
widget->windowTitle(), true, nullptr);
764
taskbox->groupLayout()->addWidget(widget);
765
Content.push_back(taskbox);
767
TaskDlgSectionView::~TaskDlgSectionView() {}
769
void TaskDlgSectionView::update()
771
//widget->updateTask();
774
//==== calls from the TaskView ===============================================================
775
void TaskDlgSectionView::open() {}
777
bool TaskDlgSectionView::accept()
783
bool TaskDlgSectionView::reject()
789
#include <Mod/TechDraw/Gui/moc_TaskSectionView.cpp>