diff --git a/src/Mod/Part/App/AppPart.cpp b/src/Mod/Part/App/AppPart.cpp index 03648c5da..596cceb24 100644 --- a/src/Mod/Part/App/AppPart.cpp +++ b/src/Mod/Part/App/AppPart.cpp @@ -287,18 +287,32 @@ void PartExport initPart() // set the user-defined units Base::Reference hGrp = App::GetApplication().GetUserParameter() .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part"); - int unit = hGrp->GetInt("Unit", 0); - switch (unit) { + int value = Interface_Static::IVal("write.iges.brep.mode"); + bool brep = hGrp->GetBool("BrepMode", value > 0); + Interface_Static::SetIVal("write.iges.brep.mode",brep ? 1 : 0); + + int unitIges = hGrp->GetInt("UnitIges", 0); + switch (unitIges) { case 1: Interface_Static::SetCVal("write.iges.unit","M"); - Interface_Static::SetCVal("write.step.unit","M"); break; case 2: Interface_Static::SetCVal("write.iges.unit","IN"); - Interface_Static::SetCVal("write.step.unit","IN"); break; default: Interface_Static::SetCVal("write.iges.unit","MM"); + break; + } + + int unitStep = hGrp->GetInt("UnitStep", 0); + switch (unitStep) { + case 1: + Interface_Static::SetCVal("write.step.unit","M"); + break; + case 2: + Interface_Static::SetCVal("write.step.unit","IN"); + break; + default: Interface_Static::SetCVal("write.step.unit","MM"); break; } diff --git a/src/Mod/Part/Gui/AppPartGui.cpp b/src/Mod/Part/Gui/AppPartGui.cpp index 2a74641e6..d25ce6bdd 100644 --- a/src/Mod/Part/Gui/AppPartGui.cpp +++ b/src/Mod/Part/Gui/AppPartGui.cpp @@ -5,7 +5,7 @@ * published by the Free Software Foundation; either version 2 of the * * License, or (at your option) any later version. * * for detail see the LICENCE text file. * - * J�rgen Riegel 2002 * + * Juergen Riegel 2002 * * * ***************************************************************************/ @@ -160,6 +160,8 @@ void PartGuiExport initPartGui() // register preferences pages (void)new Gui::PrefPageProducer ( QT_TRANSLATE_NOOP("QObject","Part design") ); (void)new Gui::PrefPageProducer ( QT_TRANSLATE_NOOP("QObject","Part design") ); + (void)new Gui::PrefPageProducer ( QT_TRANSLATE_NOOP("QObject","Import-Export") ); + (void)new Gui::PrefPageProducer ( QT_TRANSLATE_NOOP("QObject","Import-Export") ); (void)new Gui::PrefPageProducer ( QT_TRANSLATE_NOOP("QObject","Display") ); Gui::ViewProviderBuilder::add( Part::PropertyPartShape::getClassTypeId(), diff --git a/src/Mod/Part/Gui/CMakeLists.txt b/src/Mod/Part/Gui/CMakeLists.txt index 7ee81428b..8d845f2dd 100644 --- a/src/Mod/Part/Gui/CMakeLists.txt +++ b/src/Mod/Part/Gui/CMakeLists.txt @@ -59,6 +59,8 @@ set(PartGui_UIC_SRCS DlgBooleanOperation.ui DlgExtrusion.ui DlgFilletEdges.ui + DlgImportExportIges.ui + DlgImportExportStep.ui DlgPartBox.ui DlgPartCylinder.ui DlgPartImportIges.ui @@ -99,6 +101,8 @@ SET(PartGui_SRCS DlgFilletEdges.cpp DlgFilletEdges.h DlgFilletEdges.ui + DlgImportExportIges.ui + DlgImportExportStep.ui DlgPartBox.ui DlgPartBoxImp.cpp DlgPartBoxImp.h diff --git a/src/Mod/Part/Gui/DlgImportExportIges.ui b/src/Mod/Part/Gui/DlgImportExportIges.ui new file mode 100644 index 000000000..8493aaf26 --- /dev/null +++ b/src/Mod/Part/Gui/DlgImportExportIges.ui @@ -0,0 +1,89 @@ + + + PartGui::DlgImportExportIges + + + + 0 + 0 + 445 + 187 + + + + IGES + + + + + + Export + + + + + + Units for export of IGES + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + Millimeter + + + + + Meter + + + + + Inch + + + + + + + + Enable B-REP mode + + + + + + + + + + Qt::Vertical + + + + 20 + 82 + + + + + + + + + diff --git a/src/Mod/Part/Gui/DlgImportExportStep.ui b/src/Mod/Part/Gui/DlgImportExportStep.ui new file mode 100644 index 000000000..245db88af --- /dev/null +++ b/src/Mod/Part/Gui/DlgImportExportStep.ui @@ -0,0 +1,82 @@ + + + PartGui::DlgImportExportStep + + + + 0 + 0 + 445 + 187 + + + + STEP + + + + + + Export + + + + + + Units for export of STEP + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + Millimeter + + + + + Meter + + + + + Inch + + + + + + + + + + + Qt::Vertical + + + + 20 + 82 + + + + + + + + + diff --git a/src/Mod/Part/Gui/DlgSettingsGeneral.cpp b/src/Mod/Part/Gui/DlgSettingsGeneral.cpp index 0f5555c64..c008ddfc7 100644 --- a/src/Mod/Part/Gui/DlgSettingsGeneral.cpp +++ b/src/Mod/Part/Gui/DlgSettingsGeneral.cpp @@ -30,6 +30,8 @@ #include "DlgSettingsGeneral.h" #include "ui_DlgSettingsGeneral.h" +#include "ui_DlgImportExportIges.h" +#include "ui_DlgImportExportStep.h" using namespace PartGui; @@ -51,24 +53,6 @@ DlgSettingsGeneral::~DlgSettingsGeneral() void DlgSettingsGeneral::saveSettings() { - int unit = ui->comboBoxUnits->currentIndex(); - Base::Reference hGrp = App::GetApplication().GetUserParameter() - .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part"); - hGrp->SetInt("Unit", unit); - switch (unit) { - case 1: - Interface_Static::SetCVal("write.iges.unit","M"); - Interface_Static::SetCVal("write.step.unit","M"); - break; - case 2: - Interface_Static::SetCVal("write.iges.unit","IN"); - Interface_Static::SetCVal("write.step.unit","IN"); - break; - default: - Interface_Static::SetCVal("write.iges.unit","MM"); - Interface_Static::SetCVal("write.step.unit","MM"); - break; - } ui->checkBooleanCheck->onSave(); ui->checkBooleanRefine->onSave(); ui->checkSketchBaseRefine->onSave(); @@ -77,10 +61,6 @@ void DlgSettingsGeneral::saveSettings() void DlgSettingsGeneral::loadSettings() { - Base::Reference hGrp = App::GetApplication().GetUserParameter() - .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part"); - int unit = hGrp->GetInt("Unit", 0); - ui->comboBoxUnits->setCurrentIndex(unit); ui->checkBooleanCheck->onRestore(); ui->checkBooleanRefine->onRestore(); ui->checkSketchBaseRefine->onRestore(); @@ -99,5 +79,128 @@ void DlgSettingsGeneral::changeEvent(QEvent *e) QWidget::changeEvent(e); } } -#include "moc_DlgSettingsGeneral.cpp" +// ---------------------------------------------------------------------------- + +DlgImportExportIges::DlgImportExportIges(QWidget* parent) + : PreferencePage(parent) +{ + ui = new Ui_DlgImportExportIges(); + ui->setupUi(this); +} + +/** + * Destroys the object and frees any allocated resources + */ +DlgImportExportIges::~DlgImportExportIges() +{ + // no need to delete child widgets, Qt does it all for us + delete ui; +} + +void DlgImportExportIges::saveSettings() +{ + int unit = ui->comboBoxUnits->currentIndex(); + Base::Reference hGrp = App::GetApplication().GetUserParameter() + .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part"); + hGrp->SetInt("UnitIges", unit); + switch (unit) { + case 1: + Interface_Static::SetCVal("write.iges.unit","M"); + break; + case 2: + Interface_Static::SetCVal("write.iges.unit","IN"); + break; + default: + Interface_Static::SetCVal("write.iges.unit","MM"); + break; + } + + hGrp->SetBool("BrepMode", ui->checkBrepMode->isChecked()); + Interface_Static::SetIVal("write.iges.brep.mode",ui->checkBrepMode->isChecked() ? 1 : 0); +} + +void DlgImportExportIges::loadSettings() +{ + Base::Reference hGrp = App::GetApplication().GetUserParameter() + .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part"); + int unit = hGrp->GetInt("UnitIges", 0); + ui->comboBoxUnits->setCurrentIndex(unit); + + int value = Interface_Static::IVal("write.iges.brep.mode"); + bool brep = hGrp->GetBool("BrepMode", value > 0); + ui->checkBrepMode->setChecked(brep); +} + +/** + * Sets the strings of the subwidgets using the current language. + */ +void DlgImportExportIges::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) { + ui->retranslateUi(this); + } + else { + QWidget::changeEvent(e); + } +} + +// ---------------------------------------------------------------------------- + +DlgImportExportStep::DlgImportExportStep(QWidget* parent) + : PreferencePage(parent) +{ + ui = new Ui_DlgImportExportStep(); + ui->setupUi(this); +} + +/** + * Destroys the object and frees any allocated resources + */ +DlgImportExportStep::~DlgImportExportStep() +{ + // no need to delete child widgets, Qt does it all for us + delete ui; +} + +void DlgImportExportStep::saveSettings() +{ + int unit = ui->comboBoxUnits->currentIndex(); + Base::Reference hGrp = App::GetApplication().GetUserParameter() + .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part"); + hGrp->SetInt("UnitStep", unit); + switch (unit) { + case 1: + Interface_Static::SetCVal("write.step.unit","M"); + break; + case 2: + Interface_Static::SetCVal("write.step.unit","IN"); + break; + default: + Interface_Static::SetCVal("write.step.unit","MM"); + break; + } +} + +void DlgImportExportStep::loadSettings() +{ + Base::Reference hGrp = App::GetApplication().GetUserParameter() + .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part"); + int unit = hGrp->GetInt("UnitStep", 0); + ui->comboBoxUnits->setCurrentIndex(unit); +} + +/** + * Sets the strings of the subwidgets using the current language. + */ +void DlgImportExportStep::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) { + ui->retranslateUi(this); + } + else { + QWidget::changeEvent(e); + } +} + +#include "moc_DlgSettingsGeneral.cpp" diff --git a/src/Mod/Part/Gui/DlgSettingsGeneral.h b/src/Mod/Part/Gui/DlgSettingsGeneral.h index 6b32ee723..5dac06fd0 100644 --- a/src/Mod/Part/Gui/DlgSettingsGeneral.h +++ b/src/Mod/Part/Gui/DlgSettingsGeneral.h @@ -46,6 +46,42 @@ private: Ui_DlgSettingsGeneral* ui; }; +class Ui_DlgImportExportIges; +class DlgImportExportIges : public Gui::Dialog::PreferencePage +{ + Q_OBJECT + +public: + DlgImportExportIges(QWidget* parent = 0); + ~DlgImportExportIges(); + +protected: + void saveSettings(); + void loadSettings(); + void changeEvent(QEvent *e); + +private: + Ui_DlgImportExportIges* ui; +}; + +class Ui_DlgImportExportStep; +class DlgImportExportStep : public Gui::Dialog::PreferencePage +{ + Q_OBJECT + +public: + DlgImportExportStep(QWidget* parent = 0); + ~DlgImportExportStep(); + +protected: + void saveSettings(); + void loadSettings(); + void changeEvent(QEvent *e); + +private: + Ui_DlgImportExportStep* ui; +}; + } // namespace Gui #endif // PARTGUI_DLGSETTINGSGENERAL_H diff --git a/src/Mod/Part/Gui/DlgSettingsGeneral.ui b/src/Mod/Part/Gui/DlgSettingsGeneral.ui index 4bccc5f2b..89d134bfd 100644 --- a/src/Mod/Part/Gui/DlgSettingsGeneral.ui +++ b/src/Mod/Part/Gui/DlgSettingsGeneral.ui @@ -15,60 +15,6 @@ - - - Export - - - - 9 - - - 6 - - - - - - Millimeter - - - - - Meter - - - - - Inch - - - - - - - - Units for export of STEP/IGES - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Model settings @@ -116,7 +62,7 @@ - + Object naming @@ -138,7 +84,7 @@ - + Qt::Vertical