Imperial Sketcher grid in Dialog
This commit is contained in:
parent
182eaebc21
commit
53f74153ea
|
@ -60,6 +60,7 @@ using namespace Base;
|
|||
double UnitsApi::defaultFactor = 1.0;
|
||||
|
||||
UnitsSchema *UnitsApi::UserPrefSystem = new UnitsSchemaInternal();
|
||||
UnitSystem UnitsApi::actSystem = SI1;
|
||||
|
||||
//double UnitsApi::UserPrefFactor [50];
|
||||
//QString UnitsApi::UserPrefUnit [50];
|
||||
|
@ -88,6 +89,7 @@ void UnitsApi::setSchema(UnitSystem s)
|
|||
case SI2 : UserPrefSystem = new UnitsSchemaMKS(); break;
|
||||
case Imperial1: UserPrefSystem = new UnitsSchemaImperial1(); break;
|
||||
}
|
||||
actSystem = s;
|
||||
UserPrefSystem->setSchemaUnits(); // if necesarry a unit schema can change the constants in Quantity (e.g. mi=1.8km rather then 1.6km).
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,8 @@ public:
|
|||
* for representative strings.
|
||||
*/
|
||||
static void setSchema(UnitSystem s);
|
||||
/// return the active schema
|
||||
static UnitSystem getSchema(void){return actSystem;}
|
||||
|
||||
static QString schemaTranslate(Base::Quantity quant,double &factor,QString &unitString);
|
||||
static QString schemaTranslate(Base::Quantity quant){ // to satisfy GCC
|
||||
|
@ -92,7 +94,7 @@ public:
|
|||
protected:
|
||||
// not used at the moment
|
||||
static UnitsSchema * UserPrefSystem;
|
||||
|
||||
static UnitSystem actSystem;
|
||||
/// number of decimals for floats
|
||||
static int UserPrefDecimals;
|
||||
|
||||
|
|
|
@ -78,14 +78,18 @@ TaskSketcherGeneral::TaskSketcherGeneral(ViewProviderSketch *sketchView)
|
|||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Sketcher/General");
|
||||
ui->checkBoxShowGrid->setChecked(hGrp->GetBool("ShowGrid", true));
|
||||
|
||||
fillGridCombo();
|
||||
QString size = ui->comboBoxGridSize->currentText();
|
||||
size = QString::fromAscii(hGrp->GetASCII("GridSize", (const char*)size.toAscii()).c_str());
|
||||
ui->comboBoxGridSize->setCurrentIndex(ui->comboBoxGridSize->findText(size));
|
||||
int it = ui->comboBoxGridSize->findText(size);
|
||||
if(it != -1)
|
||||
ui->comboBoxGridSize->setCurrentIndex(it);
|
||||
|
||||
ui->checkBoxGridSnap->setChecked(hGrp->GetBool("GridSnap", ui->checkBoxGridSnap->isChecked()));
|
||||
ui->checkBoxAutoconstraints->setChecked(hGrp->GetBool("AutoConstraints", ui->checkBoxAutoconstraints->isChecked()));
|
||||
}
|
||||
|
||||
|
||||
TaskSketcherGeneral::~TaskSketcherGeneral()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
|
@ -102,6 +106,43 @@ TaskSketcherGeneral::~TaskSketcherGeneral()
|
|||
Gui::Selection().Detach(this);
|
||||
}
|
||||
|
||||
void TaskSketcherGeneral::fillGridCombo(void)
|
||||
{
|
||||
if(Base::UnitsApi::getSchema() == Base::UnitSystem::Imperial1 ){
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("1/128 \""));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("1/64 \""));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("1/32 \""));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("1/16 \""));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("1/8 \""));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("1/4 \""));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("1/2 \""));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("1 \""));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("2 \""));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("4 \""));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("8 \""));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("16 \""));
|
||||
|
||||
ui->comboBoxGridSize->setCurrentIndex(ui->comboBoxGridSize->findText(QString::fromUtf8("1/4 \"")));
|
||||
}else{
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("0.1 mm"));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("0.2 mm"));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("0.5 mm"));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("1 mm"));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("2 mm"));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("5 mm"));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("10 mm"));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("20 mm"));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("50 mm"));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("100 mm"));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("200 mm"));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("500 mm"));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("1 m"));
|
||||
ui->comboBoxGridSize->addItem(QString::fromUtf8("2 m"));
|
||||
|
||||
ui->comboBoxGridSize->setCurrentIndex(ui->comboBoxGridSize->findText(QString::fromUtf8("10 mm")));
|
||||
}
|
||||
}
|
||||
|
||||
void TaskSketcherGeneral::toggleGridView(bool on)
|
||||
{
|
||||
ui->label->setEnabled(on);
|
||||
|
|
|
@ -61,6 +61,7 @@ protected:
|
|||
void changeEvent(QEvent *e);
|
||||
|
||||
ViewProviderSketch *sketchView;
|
||||
void fillGridCombo(void);
|
||||
|
||||
private:
|
||||
QWidget* proxy;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>153</width>
|
||||
<height>112</height>
|
||||
<height>115</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -39,93 +39,8 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>6</number>
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">0.1 mm</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">0.2 mm</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">0.5 mm</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">1 mm</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">2 mm</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">5 mm</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">10 mm</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">20 mm</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">50 mm</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">100 mm</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">200 mm</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">500 mm</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">1 m</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">2 m</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">5 m</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">10 m</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">20 m</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
Loading…
Reference in New Issue
Block a user