[TD] add spacing to ProjGroup dialog
Add the setting to auto-distribute projections to the dialog
This commit is contained in:
@@ -45,16 +45,16 @@
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawPage.h>
|
||||
#include <Mod/TechDraw/App/DrawProjGroupItem.h>
|
||||
#include <Mod/TechDraw/App/DrawProjGroup.h>
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
#include <Mod/TechDraw/App/DrawView.h>
|
||||
#include <Mod/TechDraw/App/DrawViewPart.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawProjGroupItem.h>
|
||||
#include <Mod/TechDraw/App/DrawProjGroup.h>
|
||||
|
||||
#include "ViewProviderPage.h"
|
||||
#include "ViewProviderProjGroup.h"
|
||||
#include "ViewProviderProjGroupItem.h"
|
||||
#include "ViewProviderPage.h"
|
||||
|
||||
#include "TaskProjGroup.h"
|
||||
#include <Mod/TechDraw/Gui/ui_TaskProjGroup.h>
|
||||
|
||||
@@ -86,6 +86,13 @@ TaskProjGroup::TaskProjGroup(TechDraw::DrawProjGroup* featView, bool mode) :
|
||||
ui->sbScaleDen->setEnabled(false);
|
||||
}
|
||||
|
||||
ui->cbAutoDistribute->setChecked(multiView->AutoDistribute.getValue());
|
||||
// disable if no AutoDistribute
|
||||
ui->sbXSpacing->setEnabled(multiView->AutoDistribute.getValue());
|
||||
ui->sbYSpacing->setEnabled(multiView->AutoDistribute.getValue());
|
||||
ui->sbXSpacing->setValue(multiView->spacingX.getValue());
|
||||
ui->sbYSpacing->setValue(multiView->spacingY.getValue());
|
||||
|
||||
// Initially toggle view checkboxes if needed
|
||||
setupViewCheckboxes(true);
|
||||
|
||||
@@ -112,6 +119,13 @@ TaskProjGroup::TaskProjGroup(TechDraw::DrawProjGroup* featView, bool mode) :
|
||||
// connect(ui->projection, SIGNAL(currentIndexChanged(int)), this, SLOT(projectionTypeChanged(int)));
|
||||
connect(ui->projection, SIGNAL(currentIndexChanged(QString)), this, SLOT(projectionTypeChanged(QString)));
|
||||
|
||||
// Spacing
|
||||
connect(ui->cbAutoDistribute, SIGNAL(clicked(bool)), this, SLOT(AutoDistributeClicked(bool)));
|
||||
connect(ui->sbXSpacing, SIGNAL(valueChanged(double)), this, SLOT(spacingChanged(void)));
|
||||
connect(ui->sbYSpacing, SIGNAL(valueChanged(double)), this, SLOT(spacingChanged(void)));
|
||||
ui->sbXSpacing->setUnit(Base::Unit::Length);
|
||||
ui->sbYSpacing->setUnit(Base::Unit::Length);
|
||||
|
||||
m_page = multiView->findParentPage();
|
||||
Gui::Document* activeGui = Gui::Application::Instance->getDocument(m_page->getDocument());
|
||||
Gui::ViewProvider* vp = activeGui->getViewProvider(m_page);
|
||||
@@ -135,6 +149,9 @@ void TaskProjGroup::saveGroupState()
|
||||
m_saveProjType = multiView->ProjectionType.getValueAsString();
|
||||
m_saveScaleType = multiView->ScaleType.getValueAsString();
|
||||
m_saveScale = multiView->Scale.getValue();
|
||||
m_saveAutoDistribute = multiView->AutoDistribute.getValue();
|
||||
m_saveSpacingX = multiView->spacingX.getValue();
|
||||
m_saveSpacingY = multiView->spacingY.getValue();
|
||||
DrawProjGroupItem* anchor = multiView->getAnchor();
|
||||
m_saveDirection = anchor->Direction.getValue();
|
||||
}
|
||||
@@ -154,6 +171,9 @@ void TaskProjGroup::restoreGroupState()
|
||||
multiView->ProjectionType.setValue(m_saveProjType.c_str());
|
||||
multiView->ScaleType.setValue(m_saveScaleType.c_str());
|
||||
multiView->Scale.setValue(m_saveScale);
|
||||
multiView->AutoDistribute.setValue(m_saveAutoDistribute);
|
||||
multiView->spacingX.setValue(m_saveSpacingX);
|
||||
multiView->spacingY.setValue(m_saveSpacingY);
|
||||
multiView->purgeProjections();
|
||||
for(auto & sv : m_saveViewNames) {
|
||||
if (sv != "Front") {
|
||||
@@ -269,6 +289,25 @@ void TaskProjGroup::scaleTypeChanged(int index)
|
||||
}
|
||||
}
|
||||
|
||||
void TaskProjGroup::AutoDistributeClicked(bool b)
|
||||
{
|
||||
if (blockUpdate) {
|
||||
return;
|
||||
}
|
||||
multiView->AutoDistribute.setValue(b);
|
||||
multiView->recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskProjGroup::spacingChanged(void)
|
||||
{
|
||||
if (blockUpdate) {
|
||||
return;
|
||||
}
|
||||
multiView->spacingX.setValue(ui->sbXSpacing->value().getValue());
|
||||
multiView->spacingY.setValue(ui->sbYSpacing->value().getValue());
|
||||
multiView->recomputeFeature();
|
||||
}
|
||||
|
||||
std::pair<int, int> TaskProjGroup::nearestFraction(const double val, const long int maxDenom) const
|
||||
{
|
||||
/*
|
||||
|
||||
@@ -85,6 +85,9 @@ protected Q_SLOTS:
|
||||
/* void projectionTypeChanged(int index);*/
|
||||
void projectionTypeChanged(QString qText);
|
||||
void scaleTypeChanged(int index);
|
||||
void AutoDistributeClicked(bool b);
|
||||
/// Updates item spacing
|
||||
void spacingChanged(void);
|
||||
void scaleManuallyChanged(int i);
|
||||
|
||||
protected:
|
||||
@@ -122,6 +125,9 @@ private:
|
||||
std::string m_saveProjType;
|
||||
std::string m_saveScaleType;
|
||||
double m_saveScale;
|
||||
bool m_saveAutoDistribute;
|
||||
double m_saveSpacingX;
|
||||
double m_saveSpacingY;
|
||||
Base::Vector3d m_saveDirection;
|
||||
std::vector<std::string> m_saveViewNames;
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user