Step export dialog: save 2 options in config file.

2 options (overwrite file and replace 3d shapes) were not saved previously.
This commit is contained in:
jean-pierre charras 2021-06-15 09:33:37 +02:00
parent b4f5b6ef3c
commit 5d9ff0b9b7
3 changed files with 34 additions and 24 deletions

View File

@ -58,7 +58,6 @@ private:
// The last preference for STEP Origin:
STEP_ORG_OPT m_STEP_org_opt;
bool m_noVirtual; // remember last preference for No Virtual Component
static bool m_overwriteFile; // remember last preference for overwrite file
int m_OrgUnits; // remember last units for User Origin
double m_XOrg; // remember last User Origin X value
double m_YOrg; // remember last User Origin Y value
@ -104,30 +103,9 @@ protected:
public:
DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aParent, const wxString& aBoardPath );
~DIALOG_EXPORT_STEP()
{
GetOriginOption(); // Update m_STEP_org_opt member.
auto cfg = m_parent->GetPcbNewSettings();
cfg->m_ExportStep.origin_mode = static_cast<int>( m_STEP_org_opt );
cfg->m_ExportStep.origin_units = m_STEP_OrgUnitChoice->GetSelection();
double val = 0.0;
m_STEP_Xorg->GetValue().ToDouble( &val );
cfg->m_ExportStep.origin_x = val;
m_STEP_Yorg->GetValue().ToDouble( &val );
cfg->m_ExportStep.origin_y = val;
cfg->m_ExportStep.no_virtual = m_cbRemoveVirtual->GetValue();
}
~DIALOG_EXPORT_STEP();
};
bool DIALOG_EXPORT_STEP::m_overwriteFile = false;
DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aParent, const wxString& aBoardPath ) :
DIALOG_EXPORT_STEP_BASE( aParent )
@ -171,7 +149,8 @@ DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aParent, const wxString&
m_noVirtual = cfg->m_ExportStep.no_virtual;
m_cbRemoveVirtual->SetValue( m_noVirtual );
m_cbOverwriteFile->SetValue( m_overwriteFile );
m_cbSubstModels->SetValue( cfg->m_ExportStep.replace_models );
m_cbOverwriteFile->SetValue( cfg->m_ExportStep.overwrite_file );
m_STEP_OrgUnitChoice->SetSelection( m_OrgUnits );
wxString tmpStr;
@ -220,6 +199,29 @@ DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aParent, const wxString&
}
DIALOG_EXPORT_STEP::~DIALOG_EXPORT_STEP()
{
GetOriginOption(); // Update m_STEP_org_opt member.
auto cfg = m_parent->GetPcbNewSettings();
cfg->m_ExportStep.origin_mode = static_cast<int>( m_STEP_org_opt );
cfg->m_ExportStep.origin_units = m_STEP_OrgUnitChoice->GetSelection();
cfg->m_ExportStep.replace_models = m_cbSubstModels->GetValue();
cfg->m_ExportStep.overwrite_file = m_cbOverwriteFile->GetValue();
double val = 0.0;
m_STEP_Xorg->GetValue().ToDouble( &val );
cfg->m_ExportStep.origin_x = val;
m_STEP_Yorg->GetValue().ToDouble( &val );
cfg->m_ExportStep.origin_y = val;
cfg->m_ExportStep.no_virtual = m_cbRemoveVirtual->GetValue();
}
DIALOG_EXPORT_STEP::STEP_ORG_OPT DIALOG_EXPORT_STEP::GetOriginOption()
{
m_STEP_org_opt = STEP_ORG_0;

View File

@ -279,6 +279,12 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
m_params.emplace_back( new PARAM<bool>( "export_step.no_virtual",
&m_ExportStep.no_virtual, false ) );
m_params.emplace_back( new PARAM<bool>( "export_step.replace_models",
&m_ExportStep.replace_models, false ) );
m_params.emplace_back( new PARAM<bool>( "export_step.overwrite_file",
&m_ExportStep.overwrite_file, true ) );
m_params.emplace_back( new PARAM<bool>( "export_svg.black_and_white",
&m_ExportSvg.black_and_white, false ) );

View File

@ -104,6 +104,8 @@ public:
double origin_x;
double origin_y;
bool no_virtual;
bool replace_models;
bool overwrite_file;
};
struct DIALOG_EXPORT_SVG