Skip to content

Commit

Permalink
[TD]Add Scale to Section gui
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan committed Nov 27, 2019
1 parent a2390cb commit cefb719
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 20 deletions.
25 changes: 7 additions & 18 deletions src/Mod/TechDraw/Gui/TaskSectionView.cpp
Expand Up @@ -163,6 +163,7 @@ void TaskSectionView::setUiPrimary()
//TODO: get next symbol from page
// ui->leSymbol->setText();

ui->sbScale->setValue(m_base->getScale());
Base::Vector3d origin = m_base->getOriginalCentroid();
ui->sbOrgX->setValue(origin.x);
ui->sbOrgY->setValue(origin.y);
Expand All @@ -181,6 +182,7 @@ void TaskSectionView::setUiEdit()
temp = m_section->SectionSymbol.getValue();
qTemp = Base::Tools::fromStdString(temp);
ui->leSymbol->setText(qTemp);
ui->sbScale->setValue(m_section->getScale());

Base::Vector3d origin = m_section->SectionOrigin.getValue();
ui->sbOrgX->setValue(origin.x);
Expand All @@ -194,6 +196,7 @@ void TaskSectionView::saveSectionState()
// Base::Console().Message("TSV::saveSectionState()\n");
if (m_section != nullptr) {
m_saveSymbol = m_section->SectionSymbol.getValue();
m_saveScale = m_section->getScale();
m_saveNormal = m_section->SectionNormal.getValue();
m_saveDirection = m_section->Direction.getValue();
m_saveOrigin = m_section->SectionOrigin.getValue();
Expand All @@ -208,6 +211,7 @@ void TaskSectionView::restoreSectionState()
// Base::Console().Message("TSV::restoreSectionState()\n");
if (m_section != nullptr) {
m_section->SectionSymbol.setValue(m_saveSymbol);
m_section->Scale.setValue(m_saveScale);
m_section->SectionNormal.setValue(m_saveNormal);
m_section->Direction.setValue(m_saveDirection);
m_section->SectionOrigin.setValue(m_saveOrigin);
Expand Down Expand Up @@ -374,28 +378,13 @@ void TaskSectionView::updateSectionView(void)
Command::doCommand(Command::Doc,"App.activeDocument().%s.SectionSymbol = '%s'",
sectionName.c_str(),
temp.c_str());
Command::doCommand(Command::Doc,"App.activeDocument().%s.Scale = %0.6f",
sectionName.c_str(),
ui->sbScale->value());
m_section->setCSFromBase(m_dirName.c_str());
}
}

//void TaskSectionView::saveButtons(QPushButton* btnOK,
// QPushButton* btnCancel,
// QPushButton* btnApply)
//{
// m_btnOK = btnOK;
// m_btnCancel = btnCancel;
// m_btnApply = btnApply;
//}

//std::string TaskSectionView::prefViewSection()
//{
//// Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
//// GetGroup("Preferences")->GetGroup("Mod/TechDraw/Section");
////
//// std::string prefString = hGrp->GetASCII("SectionPref", "default");
//// return prefString;
//}

//******************************************************************************

bool TaskSectionView::accept()
Expand Down
1 change: 1 addition & 0 deletions src/Mod/TechDraw/Gui/TaskSectionView.h
Expand Up @@ -90,6 +90,7 @@ protected Q_SLOTS:
Base::Vector3d m_saveNormal;
Base::Vector3d m_saveDirection;
Base::Vector3d m_saveOrigin;
double m_saveScale;

std::string m_dirName;

Expand Down
45 changes: 43 additions & 2 deletions src/Mod/TechDraw/Gui/TaskSectionView.ui
Expand Up @@ -66,20 +66,61 @@
</property>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Identifier</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QLineEdit" name="leSymbol">
<property name="toolTip">
<string>Identifier for this section</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Scale</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QDoubleSpinBox" name="sbScale">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>249</width>
<height>33</height>
</size>
</property>
<property name="baseSize">
<size>
<width>249</width>
<height>33</height>
</size>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>999.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
Expand Down

0 comments on commit cefb719

Please sign in to comment.