Remove more old open-coded dialog state saving.

(State saving is now handled uniformly in DIALOG_SHIM.)
This commit is contained in:
Jeff Young 2025-08-09 16:11:16 +01:00
parent d1dd446e4e
commit 5dabfaf26e
21 changed files with 1235 additions and 1917 deletions

View File

@ -1,34 +1,36 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wxFormBuilder_Project> <wxFormBuilder_Project>
<FileVersion major="1" minor="17"/> <FileVersion major="1" minor="18"/>
<object class="Project" expanded="true"> <object class="Project" expanded="true">
<property name="class_decoration">; </property>
<property name="code_generation">C++</property> <property name="code_generation">C++</property>
<property name="disconnect_events">1</property> <property name="cpp_class_decoration">; </property>
<property name="disconnect_mode">source_name</property> <property name="cpp_disconnect_events">1</property>
<property name="disconnect_php_events">0</property> <property name="cpp_event_generation">connect</property>
<property name="disconnect_python_events">0</property> <property name="cpp_help_provider">none</property>
<property name="cpp_namespace"></property>
<property name="cpp_precompiled_header"></property>
<property name="cpp_use_array_enum">0</property>
<property name="cpp_use_enum">0</property>
<property name="embedded_files_path">res</property> <property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property> <property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">dialog_cleanup_tracks_and_vias_base</property> <property name="file">dialog_cleanup_tracks_and_vias_base</property>
<property name="first_id">1000</property> <property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property> <property name="internationalize">1</property>
<property name="lua_skip_events">1</property>
<property name="lua_ui_table">UI</property>
<property name="name">dialog_cleanup_tracks_and_vias</property> <property name="name">dialog_cleanup_tracks_and_vias</property>
<property name="namespace"></property>
<property name="path">.</property> <property name="path">.</property>
<property name="precompiled_header"></property> <property name="php_disconnect_events">0</property>
<property name="php_disconnect_mode">source_name</property>
<property name="php_skip_events">1</property>
<property name="python_disconnect_events">0</property>
<property name="python_disconnect_mode">source_name</property>
<property name="python_image_path_wrapper_function_name"></property>
<property name="python_indent_with_spaces"></property>
<property name="python_skip_events">1</property>
<property name="relative_path">1</property> <property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property> <property name="use_microsoft_bom">0</property>
<property name="use_native_eol">0</property>
<object class="Dialog" expanded="true"> <object class="Dialog" expanded="true">
<property name="aui_managed">0</property> <property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property> <property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
@ -102,7 +104,7 @@
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
<property name="center_pane">0</property> <property name="center_pane">0</property>
<property name="checked">0</property> <property name="checked">1</property>
<property name="close_button">1</property> <property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
@ -177,7 +179,7 @@
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
<property name="center_pane">0</property> <property name="center_pane">0</property>
<property name="checked">0</property> <property name="checked">1</property>
<property name="close_button">1</property> <property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
@ -253,7 +255,7 @@
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
<property name="center_pane">0</property> <property name="center_pane">0</property>
<property name="checked">0</property> <property name="checked">1</property>
<property name="close_button">1</property> <property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
@ -319,7 +321,7 @@
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
<property name="center_pane">0</property> <property name="center_pane">0</property>
<property name="checked">0</property> <property name="checked">1</property>
<property name="close_button">1</property> <property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
@ -395,7 +397,7 @@
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
<property name="center_pane">0</property> <property name="center_pane">0</property>
<property name="checked">0</property> <property name="checked">1</property>
<property name="close_button">1</property> <property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
@ -461,7 +463,7 @@
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
<property name="center_pane">0</property> <property name="center_pane">0</property>
<property name="checked">0</property> <property name="checked">1</property>
<property name="close_button">1</property> <property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
@ -614,10 +616,10 @@
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_layer"></property> <property name="aui_layer">0</property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position">0</property>
<property name="aui_row"></property> <property name="aui_row">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>
@ -680,10 +682,10 @@
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_layer"></property> <property name="aui_layer">0</property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position">0</property>
<property name="aui_row"></property> <property name="aui_row">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>
@ -743,10 +745,10 @@
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_layer"></property> <property name="aui_layer">0</property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position">0</property>
<property name="aui_row"></property> <property name="aui_row">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>
@ -809,10 +811,10 @@
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_layer"></property> <property name="aui_layer">0</property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position">0</property>
<property name="aui_row"></property> <property name="aui_row">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>
@ -895,10 +897,10 @@
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_layer"></property> <property name="aui_layer">0</property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position">0</property>
<property name="aui_row"></property> <property name="aui_row">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>
@ -961,10 +963,10 @@
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_layer"></property> <property name="aui_layer">0</property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position">0</property>
<property name="aui_row"></property> <property name="aui_row">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>
@ -1060,10 +1062,10 @@
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_layer"></property> <property name="aui_layer">0</property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position">0</property>
<property name="aui_row"></property> <property name="aui_row">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>
@ -1149,10 +1151,10 @@
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_layer"></property> <property name="aui_layer">0</property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position">0</property>
<property name="aui_row"></property> <property name="aui_row">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>
@ -1204,10 +1206,10 @@
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_layer"></property> <property name="aui_layer">0</property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position">0</property>
<property name="aui_row"></property> <property name="aui_row">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>
@ -1359,10 +1361,10 @@
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_layer"></property> <property name="aui_layer">0</property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position">0</property>
<property name="aui_row"></property> <property name="aui_row">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>

View File

@ -34,51 +34,12 @@
DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3( PCB_EDIT_FRAME* aEditFrame ) : DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3( PCB_EDIT_FRAME* aEditFrame ) :
DIALOG_EXPORT_IDF3_BASE( aEditFrame ), DIALOG_EXPORT_IDF3_BASE( aEditFrame ),
m_idfThouOpt( false ), m_xPos( aEditFrame, m_xLabel, m_IDF_Xref, m_xUnits ),
m_AutoAdjust( false ), m_yPos( aEditFrame, m_yLabel, m_IDF_Yref, m_yUnits )
m_RefUnits( 0 ),
m_XRef( 0.0 ),
m_YRef( 0.0 ),
m_editFrame( aEditFrame )
{ {
SetFocus(); SetFocus();
if( PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings() ) m_cbSetBoardReferencePoint->Bind( wxEVT_CHECKBOX, &DIALOG_EXPORT_IDF3::OnBoardReferencePointChecked, this );
{
m_idfThouOpt = cfg->m_ExportIdf.units_mils;
m_rbUnitSelection->SetSelection( m_idfThouOpt ? 1 : 0 );
m_AutoAdjust = cfg->m_ExportIdf.auto_adjust;
m_RefUnits = cfg->m_ExportIdf.ref_units;
m_XRef = cfg->m_ExportIdf.ref_x;
m_YRef = cfg->m_ExportIdf.ref_y;
m_cbRemoveUnspecified->SetValue( cfg->m_ExportIdf.no_unspecified );
m_cbRemoveDNP->SetValue( cfg->m_ExportIdf.no_dnp );
}
m_cbAutoAdjustOffset->SetValue( m_AutoAdjust );
m_cbAutoAdjustOffset->Bind( wxEVT_CHECKBOX, &DIALOG_EXPORT_IDF3::OnAutoAdjustOffset, this );
m_IDF_RefUnitChoice->SetSelection( m_RefUnits );
wxString tmpStr;
tmpStr << m_XRef;
m_IDF_Xref->SetValue( tmpStr );
tmpStr = wxT( "" );
tmpStr << m_YRef;
m_IDF_Yref->SetValue( tmpStr );
if( m_AutoAdjust )
{
m_IDF_RefUnitChoice->Enable( false );
m_IDF_Xref->Enable( false );
m_IDF_Yref->Enable( false );
}
else
{
m_IDF_RefUnitChoice->Enable( true );
m_IDF_Xref->Enable( true );
m_IDF_Yref->Enable( true );
}
SetupStandardButtons(); SetupStandardButtons();
@ -87,40 +48,21 @@ DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3( PCB_EDIT_FRAME* aEditFrame ) :
} }
DIALOG_EXPORT_IDF3::~DIALOG_EXPORT_IDF3() void DIALOG_EXPORT_IDF3::OnBoardReferencePointChecked( wxCommandEvent& event )
{ {
m_idfThouOpt = m_rbUnitSelection->GetSelection() == 1; m_xPos.Enable( m_cbSetBoardReferencePoint->GetValue() );
m_yPos.Enable( m_cbSetBoardReferencePoint->GetValue() );
if( PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings() ) event.Skip();
{
cfg->m_ExportIdf.units_mils = m_idfThouOpt;
cfg->m_ExportIdf.auto_adjust = m_AutoAdjust;
cfg->m_ExportIdf.ref_units = m_RefUnits;
cfg->m_ExportIdf.ref_x = m_XRef;
cfg->m_ExportIdf.ref_y = m_YRef;
cfg->m_ExportIdf.no_unspecified = m_cbRemoveUnspecified->GetValue();
cfg->m_ExportIdf.no_dnp = m_cbRemoveDNP->GetValue();
}
} }
void DIALOG_EXPORT_IDF3::OnAutoAdjustOffset( wxCommandEvent& event ) bool DIALOG_EXPORT_IDF3::TransferDataToWindow()
{ {
if( GetAutoAdjustOffset() ) wxCommandEvent dummy;
{ OnBoardReferencePointChecked( dummy );
m_IDF_RefUnitChoice->Enable( false );
m_IDF_Xref->Enable( false );
m_IDF_Yref->Enable( false );
}
else
{
m_IDF_RefUnitChoice->Enable( true );
m_IDF_Xref->Enable( true );
m_IDF_Yref->Enable( true );
}
event.Skip(); return true;
} }
@ -130,8 +72,8 @@ bool DIALOG_EXPORT_IDF3::TransferDataFromWindow()
if( fn.FileExists() ) if( fn.FileExists() )
{ {
wxString msg = wxString::Format( _( "File %s already exists." ), fn.GetPath() ); KIDIALOG dlg( this, wxString::Format( _( "File %s already exists." ), fn.GetPath() ),
KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING ); _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
dlg.SetOKLabel( _( "Overwrite" ) ); dlg.SetOKLabel( _( "Overwrite" ) );
dlg.DoNotShowCheckbox( __FILE__, __LINE__ ); dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
@ -162,11 +104,10 @@ int BOARD_EDITOR_CONTROL::ExportIDF( const TOOL_EVENT& aEvent )
if ( dlg.ShowModal() != wxID_OK ) if ( dlg.ShowModal() != wxID_OK )
return 0; return 0;
bool thou = dlg.GetThouOption();
double aXRef; double aXRef;
double aYRef; double aYRef;
if( dlg.GetAutoAdjustOffset() ) if( dlg.GetSetBoardReferencePoint() )
{ {
BOX2I bbox = board->GetBoardEdgesBoundingBox(); BOX2I bbox = board->GetBoardEdgesBoundingBox();
aXRef = bbox.Centre().x * pcbIUScale.MM_PER_IU; aXRef = bbox.Centre().x * pcbIUScale.MM_PER_IU;
@ -174,24 +115,17 @@ int BOARD_EDITOR_CONTROL::ExportIDF( const TOOL_EVENT& aEvent )
} }
else else
{ {
aXRef = dlg.GetXRef(); aXRef = dlg.GetXRefMM();
aYRef = dlg.GetYRef(); aYRef = dlg.GetYRefMM();
if( dlg.GetRefUnitsChoice() == 1 )
{
// selected reference unit is in inches
aXRef *= 25.4;
aYRef *= 25.4;
}
} }
wxBusyCursor dummy;
wxString fullFilename = dlg.FilePicker()->GetPath(); wxString fullFilename = dlg.FilePicker()->GetPath();
m_frame->SetLastPath( LAST_PATH_IDF, fullFilename ); m_frame->SetLastPath( LAST_PATH_IDF, fullFilename );
if( !m_frame->Export_IDF3( board, fullFilename, thou, aXRef, aYRef, !dlg.GetNoUnspecifiedOption(), wxBusyCursor dummy;
!dlg.GetNoDNPOption() ) )
if( !m_frame->Export_IDF3( board, fullFilename, dlg.GetThouOption(), aXRef, aYRef,
!dlg.GetNoUnspecifiedOption(), !dlg.GetNoDNPOption() ) )
{ {
wxMessageBox( wxString::Format( _( "Failed to create file '%s'." ), fullFilename ) ); wxMessageBox( wxString::Format( _( "Failed to create file '%s'." ), fullFilename ) );
} }

View File

@ -25,42 +25,32 @@
#pragma once #pragma once
#include <dialog_export_idf_base.h> #include <dialog_export_idf_base.h>
#include <widgets/unit_binder.h>
class PCB_EDIT_FRAME; class PCB_EDIT_FRAME;
class DIALOG_EXPORT_IDF3 : public DIALOG_EXPORT_IDF3_BASE class DIALOG_EXPORT_IDF3 : public DIALOG_EXPORT_IDF3_BASE
{ {
private:
bool m_idfThouOpt; // remember last preference for units in THOU
bool m_AutoAdjust; // remember last Reference Point AutoAdjust setting
int m_RefUnits; // remember last units for Reference Point
double m_XRef; // remember last X Reference Point
double m_YRef; // remember last Y Reference Point
PCB_EDIT_FRAME* m_editFrame;
public: public:
DIALOG_EXPORT_IDF3( PCB_EDIT_FRAME* aEditFrame ); DIALOG_EXPORT_IDF3( PCB_EDIT_FRAME* aEditFrame );
~DIALOG_EXPORT_IDF3() = default;
~DIALOG_EXPORT_IDF3();
bool GetThouOption() { return m_rbUnitSelection->GetSelection() == 1; }
wxFilePickerCtrl* FilePicker() { return m_filePickerIDF; } wxFilePickerCtrl* FilePicker() { return m_filePickerIDF; }
int GetRefUnitsChoice() { return m_IDF_RefUnitChoice->GetSelection(); } bool GetSetBoardReferencePoint() { return m_cbSetBoardReferencePoint->GetValue(); }
double GetXRefMM() { return pcbIUScale.IUTomm( m_xPos.GetIntValue() ); }
double GetXRef() { return EDA_UNIT_UTILS::UI::DoubleValueFromString( m_IDF_Xref->GetValue() ); } double GetYRefMM() { return pcbIUScale.IUTomm( m_yPos.GetIntValue() ); }
double GetYRef() { return EDA_UNIT_UTILS::UI::DoubleValueFromString( m_IDF_Yref->GetValue() ); }
bool GetThouOption() { return m_outputUnitsChoice->GetSelection() == 1; }
bool GetNoUnspecifiedOption() { return m_cbRemoveUnspecified->GetValue(); } bool GetNoUnspecifiedOption() { return m_cbRemoveUnspecified->GetValue(); }
bool GetNoDNPOption() { return m_cbRemoveDNP->GetValue(); } bool GetNoDNPOption() { return m_cbRemoveDNP->GetValue(); }
bool GetAutoAdjustOffset() { return m_cbAutoAdjustOffset->GetValue(); } void OnBoardReferencePointChecked( wxCommandEvent& event );
void OnAutoAdjustOffset( wxCommandEvent& event );
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;
private:
UNIT_BINDER m_xPos;
UNIT_BINDER m_yPos;
}; };

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) // C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -20,46 +20,22 @@ DIALOG_EXPORT_IDF3_BASE::DIALOG_EXPORT_IDF3_BASE( wxWindow* parent, wxWindowID i
m_txtBrdFile = new wxStaticText( this, wxID_ANY, _("File name:"), wxDefaultPosition, wxDefaultSize, 0 ); m_txtBrdFile = new wxStaticText( this, wxID_ANY, _("File name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_txtBrdFile->Wrap( -1 ); m_txtBrdFile->Wrap( -1 );
bSizerIDFFile->Add( m_txtBrdFile, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxTOP, 5 ); bSizerIDFFile->Add( m_txtBrdFile, 0, wxTOP|wxRIGHT|wxLEFT, 10 );
m_filePickerIDF = new wxFilePickerCtrl( this, wxID_ANY, wxEmptyString, _("Select an IDF export filename"), _("*.emn"), wxDefaultPosition, wxSize( 450,-1 ), wxFLP_OVERWRITE_PROMPT|wxFLP_SAVE|wxFLP_USE_TEXTCTRL ); m_filePickerIDF = new wxFilePickerCtrl( this, wxID_ANY, wxEmptyString, _("Select an IDF export filename"), _("*.emn"), wxDefaultPosition, wxSize( 450,-1 ), wxFLP_OVERWRITE_PROMPT|wxFLP_SAVE|wxFLP_USE_TEXTCTRL );
bSizerIDFFile->Add( m_filePickerIDF, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bSizerIDFFile->Add( m_filePickerIDF, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 );
wxBoxSizer* bSizer2; wxGridBagSizer* gbSizer1;
bSizer2 = new wxBoxSizer( wxHORIZONTAL ); gbSizer1 = new wxGridBagSizer( 2, 3 );
gbSizer1->SetFlexibleDirection( wxBOTH );
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
wxBoxSizer* bSizer3; m_cbSetBoardReferencePoint = new wxCheckBox( this, wxID_ANY, _("Set board reference point:"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
bSizer3 = new wxBoxSizer( wxVERTICAL ); gbSizer1->Add( m_cbSetBoardReferencePoint, wxGBPosition( 0, 0 ), wxGBSpan( 1, 3 ), 0, 5 );
m_staticText2 = new wxStaticText( this, wxID_ANY, _("Grid reference point:"), wxDefaultPosition, wxDefaultSize, 0 ); m_xLabel = new wxStaticText( this, wxID_ANY, _("X position:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 ); m_xLabel->Wrap( -1 );
bSizer3->Add( m_staticText2, 0, wxALL, 5 ); gbSizer1->Add( m_xLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 23 );
m_cbAutoAdjustOffset = new wxCheckBox( this, wxID_ANY, _("Adjust automatically"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
bSizer3->Add( m_cbAutoAdjustOffset, 0, wxALL, 5 );
wxBoxSizer* bSizer6;
bSizer6 = new wxBoxSizer( wxHORIZONTAL );
m_staticText5 = new wxStaticText( this, wxID_ANY, _("Units:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText5->Wrap( -1 );
bSizer6->Add( m_staticText5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxString m_IDF_RefUnitChoiceChoices[] = { _("mm"), _("inch") };
int m_IDF_RefUnitChoiceNChoices = sizeof( m_IDF_RefUnitChoiceChoices ) / sizeof( wxString );
m_IDF_RefUnitChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_IDF_RefUnitChoiceNChoices, m_IDF_RefUnitChoiceChoices, 0 );
m_IDF_RefUnitChoice->SetSelection( 0 );
bSizer6->Add( m_IDF_RefUnitChoice, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
bSizer3->Add( bSizer6, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxHORIZONTAL );
m_staticText3 = new wxStaticText( this, wxID_ANY, _("X position:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3->Wrap( -1 );
bSizer4->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_IDF_Xref = new TEXT_CTRL_EVAL( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 ); m_IDF_Xref = new TEXT_CTRL_EVAL( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
#ifdef __WXGTK__ #ifdef __WXGTK__
@ -70,17 +46,15 @@ DIALOG_EXPORT_IDF3_BASE::DIALOG_EXPORT_IDF3_BASE( wxWindow* parent, wxWindowID i
#else #else
m_IDF_Xref->SetMaxLength( 8 ); m_IDF_Xref->SetMaxLength( 8 );
#endif #endif
bSizer4->Add( m_IDF_Xref, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); gbSizer1->Add( m_IDF_Xref, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_xUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_xUnits->Wrap( -1 );
gbSizer1->Add( m_xUnits, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
bSizer3->Add( bSizer4, 1, wxEXPAND, 5 ); m_yLabel = new wxStaticText( this, wxID_ANY, _("Y position:"), wxDefaultPosition, wxDefaultSize, 0 );
m_yLabel->Wrap( -1 );
wxBoxSizer* bSizer5; gbSizer1->Add( m_yLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 23 );
bSizer5 = new wxBoxSizer( wxHORIZONTAL );
m_staticText4 = new wxStaticText( this, wxID_ANY, _("Y position:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText4->Wrap( -1 );
bSizer5->Add( m_staticText4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_IDF_Yref = new TEXT_CTRL_EVAL( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 ); m_IDF_Yref = new TEXT_CTRL_EVAL( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
#ifdef __WXGTK__ #ifdef __WXGTK__
@ -91,34 +65,30 @@ DIALOG_EXPORT_IDF3_BASE::DIALOG_EXPORT_IDF3_BASE( wxWindow* parent, wxWindowID i
#else #else
m_IDF_Yref->SetMaxLength( 8 ); m_IDF_Yref->SetMaxLength( 8 );
#endif #endif
bSizer5->Add( m_IDF_Yref, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); gbSizer1->Add( m_IDF_Yref, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_yUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_yUnits->Wrap( -1 );
gbSizer1->Add( m_yUnits, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_outputUnitsLabel = new wxStaticText( this, wxID_ANY, _("Output units:"), wxDefaultPosition, wxDefaultSize, 0 );
m_outputUnitsLabel->Wrap( -1 );
gbSizer1->Add( m_outputUnitsLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 8 );
wxString m_outputUnitsChoiceChoices[] = { _("Millimeters"), _("Mils") };
int m_outputUnitsChoiceNChoices = sizeof( m_outputUnitsChoiceChoices ) / sizeof( wxString );
m_outputUnitsChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_outputUnitsChoiceNChoices, m_outputUnitsChoiceChoices, 0 );
m_outputUnitsChoice->SetSelection( 0 );
gbSizer1->Add( m_outputUnitsChoice, wxGBPosition( 3, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_cbRemoveDNP = new wxCheckBox( this, wxID_ANY, _("Ignore 'Do not populate' components"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_cbRemoveDNP, wxGBPosition( 4, 0 ), wxGBSpan( 1, 3 ), wxBOTTOM, 5 );
m_cbRemoveUnspecified = new wxCheckBox( this, wxID_ANY, _("Ignore 'Unspecified' components"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_cbRemoveUnspecified, wxGBPosition( 5, 0 ), wxGBSpan( 1, 3 ), 0, 5 );
bSizer3->Add( bSizer5, 1, wxEXPAND, 5 ); bSizerIDFFile->Add( gbSizer1, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 );
bSizer2->Add( bSizer3, 1, wxEXPAND|wxLEFT, 5 );
wxString m_rbUnitSelectionChoices[] = { _("Millimeters"), _("Mils") };
int m_rbUnitSelectionNChoices = sizeof( m_rbUnitSelectionChoices ) / sizeof( wxString );
m_rbUnitSelection = new wxRadioBox( this, wxID_ANY, _("Output Units"), wxDefaultPosition, wxDefaultSize, m_rbUnitSelectionNChoices, m_rbUnitSelectionChoices, 1, wxRA_SPECIFY_COLS );
m_rbUnitSelection->SetSelection( 0 );
bSizer2->Add( m_rbUnitSelection, 0, wxALL, 5 );
wxStaticBoxSizer* sbOtherOptions;
sbOtherOptions = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Other Options") ), wxVERTICAL );
m_cbRemoveDNP = new wxCheckBox( sbOtherOptions->GetStaticBox(), wxID_ANY, _("Ignore 'Do not populate' components"), wxDefaultPosition, wxDefaultSize, 0 );
sbOtherOptions->Add( m_cbRemoveDNP, 0, wxALL, 5 );
m_cbRemoveUnspecified = new wxCheckBox( sbOtherOptions->GetStaticBox(), wxID_ANY, _("Ignore 'Unspecified' components"), wxDefaultPosition, wxDefaultSize, 0 );
sbOtherOptions->Add( m_cbRemoveUnspecified, 0, wxALL, 5 );
bSizer2->Add( sbOtherOptions, 1, wxEXPAND|wxLEFT|wxRIGHT, 10 );
bSizerIDFFile->Add( bSizer2, 1, wxEXPAND, 5 );
m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK ); m_sdbSizerOK = new wxButton( this, wxID_OK );

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) // C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -21,12 +21,11 @@ class TEXT_CTRL_EVAL;
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/filepicker.h> #include <wx/filepicker.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/choice.h>
#include <wx/sizer.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/valtext.h> #include <wx/valtext.h>
#include <wx/radiobox.h> #include <wx/choice.h>
#include <wx/statbox.h> #include <wx/gbsizer.h>
#include <wx/sizer.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/dialog.h> #include <wx/dialog.h>
@ -42,15 +41,15 @@ class DIALOG_EXPORT_IDF3_BASE : public DIALOG_SHIM
protected: protected:
wxStaticText* m_txtBrdFile; wxStaticText* m_txtBrdFile;
wxFilePickerCtrl* m_filePickerIDF; wxFilePickerCtrl* m_filePickerIDF;
wxStaticText* m_staticText2; wxCheckBox* m_cbSetBoardReferencePoint;
wxCheckBox* m_cbAutoAdjustOffset; wxStaticText* m_xLabel;
wxStaticText* m_staticText5;
wxChoice* m_IDF_RefUnitChoice;
wxStaticText* m_staticText3;
TEXT_CTRL_EVAL* m_IDF_Xref; TEXT_CTRL_EVAL* m_IDF_Xref;
wxStaticText* m_staticText4; wxStaticText* m_xUnits;
wxStaticText* m_yLabel;
TEXT_CTRL_EVAL* m_IDF_Yref; TEXT_CTRL_EVAL* m_IDF_Yref;
wxRadioBox* m_rbUnitSelection; wxStaticText* m_yUnits;
wxStaticText* m_outputUnitsLabel;
wxChoice* m_outputUnitsChoice;
wxCheckBox* m_cbRemoveDNP; wxCheckBox* m_cbRemoveDNP;
wxCheckBox* m_cbRemoveUnspecified; wxCheckBox* m_cbRemoveUnspecified;
wxStdDialogButtonSizer* m_sdbSizer; wxStdDialogButtonSizer* m_sdbSizer;

View File

@ -40,7 +40,6 @@
#include <locale_io.h> #include <locale_io.h>
#include <math/vector3.h> #include <math/vector3.h>
#include <pcb_edit_frame.h> #include <pcb_edit_frame.h>
#include <pcbnew_settings.h>
#include <tools/board_editor_control.h> #include <tools/board_editor_control.h>
#include <project/project_file.h> // LAST_PATH_TYPE #include <project/project_file.h> // LAST_PATH_TYPE
#include <reporter.h> #include <reporter.h>
@ -73,24 +72,6 @@ static const std::map<wxString, int> c_formatExtToChoice = { { FILEEXT::StepFile
{ FILEEXT::StepZFileAbrvExtension, 6 }}; { FILEEXT::StepZFileAbrvExtension, 6 }};
int DIALOG_EXPORT_STEP::m_toleranceLastChoice = -1; // Use default
int DIALOG_EXPORT_STEP::m_formatLastChoice = -1; // Use default
bool DIALOG_EXPORT_STEP::m_optimizeStep = true;
bool DIALOG_EXPORT_STEP::m_exportBoardBody = true;
bool DIALOG_EXPORT_STEP::m_exportComponents = true;
bool DIALOG_EXPORT_STEP::m_exportTracks = false;
bool DIALOG_EXPORT_STEP::m_exportPads = false;
bool DIALOG_EXPORT_STEP::m_exportZones = false;
bool DIALOG_EXPORT_STEP::m_exportInnerCopper = false;
bool DIALOG_EXPORT_STEP::m_exportSilkscreen = false;
bool DIALOG_EXPORT_STEP::m_exportSoldermask = false;
bool DIALOG_EXPORT_STEP::m_fuseShapes = false;
bool DIALOG_EXPORT_STEP::m_fillAllVias = false;
bool DIALOG_EXPORT_STEP::m_cutViasInBody = false;
DIALOG_EXPORT_STEP::COMPONENT_MODE DIALOG_EXPORT_STEP::m_componentMode = COMPONENT_MODE::EXPORT_ALL;
wxString DIALOG_EXPORT_STEP::m_componentFilter;
DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aEditFrame, const wxString& aBoardPath ) : DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aEditFrame, const wxString& aBoardPath ) :
DIALOG_EXPORT_STEP( aEditFrame, aEditFrame, aBoardPath ) DIALOG_EXPORT_STEP( aEditFrame, aEditFrame, aBoardPath )
{ {
@ -103,9 +84,8 @@ DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aEditFrame, wxWindow* aP
DIALOG_EXPORT_STEP_BASE( aEditFrame ), DIALOG_EXPORT_STEP_BASE( aEditFrame ),
m_editFrame( aEditFrame ), m_editFrame( aEditFrame ),
m_job( aJob ), m_job( aJob ),
m_userOriginX( 0.0 ), m_originX( aEditFrame, m_originXLabel, m_originXCtrl, m_originXUnits ),
m_userOriginY( 0.0 ), m_originY( aEditFrame, m_originYLabel, m_originYCtrl, m_originYUnits ),
m_originUnits( 0 /* mm */ ),
m_boardPath( aBoardPath ) m_boardPath( aBoardPath )
{ {
if( !m_job ) if( !m_job )
@ -114,7 +94,6 @@ DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aEditFrame, wxWindow* aP
SetupStandardButtons( { { wxID_OK, _( "Export" ) }, SetupStandardButtons( { { wxID_OK, _( "Export" ) },
{ wxID_CANCEL, _( "Close" ) } } ); { wxID_CANCEL, _( "Close" ) } } );
// Build default output file name // Build default output file name
// (last saved filename in project or built from board filename) // (last saved filename in project or built from board filename)
wxString path = m_editFrame->GetLastPath( LAST_PATH_STEP ); wxString path = m_editFrame->GetLastPath( LAST_PATH_STEP );
@ -137,7 +116,7 @@ DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aEditFrame, wxWindow* aP
} }
// DIALOG_SHIM needs a unique hash_key because classname will be the same for both job and // DIALOG_SHIM needs a unique hash_key because classname will be the same for both job and
// non-job versions (which have different sizes). // non-job versions.
m_hash_key = TO_UTF8( GetTitle() ); m_hash_key = TO_UTF8( GetTitle() );
Layout(); Layout();
@ -145,127 +124,6 @@ DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aEditFrame, wxWindow* aP
SetFocus(); SetFocus();
if( !m_job )
{
if( PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings() )
{
m_origin = static_cast<STEP_ORIGIN_OPTION>( cfg->m_ExportStep.origin_mode );
switch( m_origin )
{
default:
case STEP_ORIGIN_PLOT_AXIS: m_rbDrillAndPlotOrigin->SetValue( true ); break;
case STEP_ORIGIN_GRID_AXIS: m_rbGridOrigin->SetValue( true ); break;
case STEP_ORIGIN_USER: m_rbUserDefinedOrigin->SetValue( true ); break;
case STEP_ORIGIN_BOARD_CENTER: m_rbBoardCenterOrigin->SetValue( true ); break;
}
m_originUnits = cfg->m_ExportStep.origin_units;
m_userOriginX = cfg->m_ExportStep.origin_x;
m_userOriginY = cfg->m_ExportStep.origin_y;
m_noUnspecified = cfg->m_ExportStep.no_unspecified;
m_noDNP = cfg->m_ExportStep.no_dnp;
m_txtNetFilter->SetValue( m_netFilter );
m_cbOptimizeStep->SetValue( m_optimizeStep );
m_cbExportBody->SetValue( m_exportBoardBody );
m_cbExportComponents->SetValue( m_exportComponents );
m_cbExportTracks->SetValue( m_exportTracks );
m_cbExportPads->SetValue( m_exportPads );
m_cbExportZones->SetValue( m_exportZones );
m_cbExportInnerCopper->SetValue( m_exportInnerCopper );
m_cbExportSilkscreen->SetValue( m_exportSilkscreen );
m_cbExportSoldermask->SetValue( m_exportSoldermask );
m_cbFuseShapes->SetValue( m_fuseShapes );
m_cbCutViasInBody->SetValue( m_cutViasInBody );
m_cbFillAllVias->SetValue( m_fillAllVias );
m_cbRemoveUnspecified->SetValue( m_noUnspecified );
m_cbRemoveDNP->SetValue( m_noDNP );
m_cbSubstModels->SetValue( cfg->m_ExportStep.replace_models );
m_cbOverwriteFile->SetValue( cfg->m_ExportStep.overwrite_file );
}
m_txtComponentFilter->SetValue( m_componentFilter );
switch( m_componentMode )
{
case COMPONENT_MODE::EXPORT_ALL: m_rbAllComponents->SetValue( true ); break;
case COMPONENT_MODE::EXPORT_SELECTED: m_rbOnlySelected->SetValue( true ); break;
case COMPONENT_MODE::CUSTOM_FILTER: m_rbFilteredComponents->SetValue( true ); break;
}
// Sync the enabled states
wxCommandEvent dummy;
DIALOG_EXPORT_STEP::onCbExportComponents( dummy );
m_STEP_OrgUnitChoice->SetSelection( m_originUnits );
wxString tmpStr;
tmpStr << m_userOriginX;
m_STEP_Xorg->SetValue( tmpStr );
tmpStr = wxEmptyString;
tmpStr << m_userOriginY;
m_STEP_Yorg->SetValue( tmpStr );
}
else
{
m_rbBoardCenterOrigin->SetValue( true ); // Default
if( m_job->m_3dparams.m_UseDrillOrigin )
m_rbDrillAndPlotOrigin->SetValue( true );
else if( m_job->m_3dparams.m_UseGridOrigin )
m_rbGridOrigin->SetValue( true );
else if( m_job->m_3dparams.m_UseDefinedOrigin )
m_rbUserDefinedOrigin->SetValue( true );
else if( m_job->m_3dparams.m_UsePcbCenterOrigin )
m_rbBoardCenterOrigin->SetValue( true );
m_userOriginX = m_job->m_3dparams.m_Origin.x;
m_userOriginY = m_job->m_3dparams.m_Origin.y;
m_noUnspecified = m_job->m_3dparams.m_IncludeUnspecified;
m_noDNP = m_job->m_3dparams.m_IncludeDNP;
m_txtNetFilter->SetValue( m_job->m_3dparams.m_NetFilter );
m_cbOptimizeStep->SetValue( m_job->m_3dparams.m_OptimizeStep );
m_cbExportBody->SetValue( m_job->m_3dparams.m_ExportBoardBody );
m_cbExportComponents->SetValue( m_job->m_3dparams.m_ExportComponents );
m_cbExportTracks->SetValue( m_job->m_3dparams.m_ExportTracksVias );
m_cbExportPads->SetValue( m_job->m_3dparams.m_ExportPads );
m_cbExportZones->SetValue( m_job->m_3dparams.m_ExportZones );
m_cbExportInnerCopper->SetValue( m_job->m_3dparams.m_ExportInnerCopper );
m_cbExportSilkscreen->SetValue( m_job->m_3dparams.m_ExportSilkscreen );
m_cbExportSoldermask->SetValue( m_job->m_3dparams.m_ExportSoldermask );
m_cbFuseShapes->SetValue( m_job->m_3dparams.m_FuseShapes );
m_cbCutViasInBody->SetValue( m_job->m_3dparams.m_CutViasInBody );
m_cbFillAllVias->SetValue( m_job->m_3dparams.m_FillAllVias );
m_cbRemoveUnspecified->SetValue( !m_job->m_3dparams.m_IncludeUnspecified );
m_cbRemoveDNP->SetValue( !m_job->m_3dparams.m_IncludeDNP );
m_cbSubstModels->SetValue( m_job->m_3dparams.m_SubstModels );
m_cbOverwriteFile->SetValue( m_job->m_3dparams.m_Overwrite );
if( m_job->m_3dparams.m_BoardOutlinesChainingEpsilon > 0.05 )
m_choiceTolerance->SetSelection( 2 );
else if( m_job->m_3dparams.m_BoardOutlinesChainingEpsilon < 0.005 )
m_choiceTolerance->SetSelection( 0 );
else
m_choiceTolerance->SetSelection( 1 );
m_txtComponentFilter->SetValue( m_job->m_3dparams.m_ComponentFilter );
m_outputFileName->SetValue( m_job->GetConfiguredOutputPath() );
wxCommandEvent dummy;
DIALOG_EXPORT_STEP::onCbExportComponents( dummy );
m_STEP_OrgUnitChoice->SetSelection( m_originUnits );
wxString tmpStr;
tmpStr << m_userOriginX;
m_STEP_Xorg->SetValue( tmpStr );
tmpStr = wxEmptyString;
tmpStr << m_userOriginY;
m_STEP_Yorg->SetValue( tmpStr );
}
wxString bad_scales; wxString bad_scales;
size_t bad_count = 0; size_t bad_count = 0;
@ -302,87 +160,65 @@ DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aEditFrame, wxWindow* aP
Pgm().GetCommonSettings()->m_DoNotShowAgain.scaled_3d_models_warning = true; Pgm().GetCommonSettings()->m_DoNotShowAgain.scaled_3d_models_warning = true;
} }
if( m_toleranceLastChoice >= 0 ) OnFmtChoiceOptionChanged();
m_choiceTolerance->SetSelection( m_toleranceLastChoice );
if( m_formatLastChoice >= 0 )
m_choiceFormat->SetSelection( m_formatLastChoice );
else
// ensure the selected fmt and the output file ext are synchronized the first time
// the dialog is opened
OnFmtChoiceOptionChanged();
// Now all widgets have the size fixed, call FinishDialogSettings // Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings(); finishDialogSettings();
} }
DIALOG_EXPORT_STEP::~DIALOG_EXPORT_STEP() bool DIALOG_EXPORT_STEP::TransferDataToWindow()
{ {
GetOriginOption(); // Update m_origin member. if( m_job )
if( !m_job ) // dont save mru if its a job dialog
{ {
if( PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings() ) m_rbBoardCenterOrigin->SetValue( true ); // Default
{
cfg->m_ExportStep.origin_mode = static_cast<int>( m_origin );
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; if( m_job->m_3dparams.m_UseDrillOrigin )
m_rbDrillAndPlotOrigin->SetValue( true );
else if( m_job->m_3dparams.m_UseGridOrigin )
m_rbGridOrigin->SetValue( true );
else if( m_job->m_3dparams.m_UseDefinedOrigin )
m_rbUserDefinedOrigin->SetValue( true );
else if( m_job->m_3dparams.m_UsePcbCenterOrigin )
m_rbBoardCenterOrigin->SetValue( true );
m_STEP_Xorg->GetValue().ToDouble( &val ); m_originX.SetValue( pcbIUScale.mmToIU( m_job->m_3dparams.m_Origin.x ) );
cfg->m_ExportStep.origin_x = val; m_originY.SetValue( pcbIUScale.mmToIU( m_job->m_3dparams.m_Origin.y ) );
m_STEP_Yorg->GetValue().ToDouble( &val ); m_txtNetFilter->SetValue( m_job->m_3dparams.m_NetFilter );
cfg->m_ExportStep.origin_y = val; m_cbOptimizeStep->SetValue( m_job->m_3dparams.m_OptimizeStep );
m_cbExportBody->SetValue( m_job->m_3dparams.m_ExportBoardBody );
m_cbExportComponents->SetValue( m_job->m_3dparams.m_ExportComponents );
m_cbExportTracks->SetValue( m_job->m_3dparams.m_ExportTracksVias );
m_cbExportPads->SetValue( m_job->m_3dparams.m_ExportPads );
m_cbExportZones->SetValue( m_job->m_3dparams.m_ExportZones );
m_cbExportInnerCopper->SetValue( m_job->m_3dparams.m_ExportInnerCopper );
m_cbExportSilkscreen->SetValue( m_job->m_3dparams.m_ExportSilkscreen );
m_cbExportSoldermask->SetValue( m_job->m_3dparams.m_ExportSoldermask );
m_cbFuseShapes->SetValue( m_job->m_3dparams.m_FuseShapes );
m_cbCutViasInBody->SetValue( m_job->m_3dparams.m_CutViasInBody );
m_cbFillAllVias->SetValue( m_job->m_3dparams.m_FillAllVias );
m_cbRemoveUnspecified->SetValue( !m_job->m_3dparams.m_IncludeUnspecified );
m_cbRemoveDNP->SetValue( !m_job->m_3dparams.m_IncludeDNP );
m_cbSubstModels->SetValue( m_job->m_3dparams.m_SubstModels );
m_cbOverwriteFile->SetValue( m_job->m_3dparams.m_Overwrite );
cfg->m_ExportStep.no_unspecified = m_cbRemoveUnspecified->GetValue(); if( m_job->m_3dparams.m_BoardOutlinesChainingEpsilon > 0.05 )
cfg->m_ExportStep.no_dnp = m_cbRemoveDNP->GetValue(); m_choiceTolerance->SetSelection( 2 );
} else if( m_job->m_3dparams.m_BoardOutlinesChainingEpsilon < 0.005 )
m_choiceTolerance->SetSelection( 0 );
m_netFilter = m_txtNetFilter->GetValue();
m_toleranceLastChoice = m_choiceTolerance->GetSelection();
m_formatLastChoice = m_choiceFormat->GetSelection();
m_optimizeStep = m_cbOptimizeStep->GetValue();
m_exportBoardBody = m_cbExportBody->GetValue();
m_exportComponents = m_cbExportComponents->GetValue();
m_exportTracks = m_cbExportTracks->GetValue();
m_exportPads = m_cbExportPads->GetValue();
m_exportZones = m_cbExportZones->GetValue();
m_exportInnerCopper = m_cbExportInnerCopper->GetValue();
m_exportSilkscreen = m_cbExportSilkscreen->GetValue();
m_exportSoldermask = m_cbExportSoldermask->GetValue();
m_fuseShapes = m_cbFuseShapes->GetValue();
m_cutViasInBody = m_cbCutViasInBody->GetValue();
m_fillAllVias = m_cbFillAllVias->GetValue();
m_componentFilter = m_txtComponentFilter->GetValue();
if( m_rbAllComponents->GetValue() )
m_componentMode = COMPONENT_MODE::EXPORT_ALL;
else if( m_rbOnlySelected->GetValue() )
m_componentMode = COMPONENT_MODE::EXPORT_SELECTED;
else else
m_componentMode = COMPONENT_MODE::CUSTOM_FILTER; m_choiceTolerance->SetSelection( 1 );
m_txtComponentFilter->SetValue( m_job->m_3dparams.m_ComponentFilter );
m_outputFileName->SetValue( m_job->GetConfiguredOutputPath() );
} }
}
// Sync the enabled states
wxCommandEvent dummy;
DIALOG_EXPORT_STEP::onCbExportComponents( dummy );
DIALOG_EXPORT_STEP::STEP_ORIGIN_OPTION DIALOG_EXPORT_STEP::GetOriginOption() return true;
{
m_origin = STEP_ORIGIN_0;
if( m_rbDrillAndPlotOrigin->GetValue() )
m_origin = STEP_ORIGIN_PLOT_AXIS;
else if( m_rbGridOrigin->GetValue() )
m_origin = STEP_ORIGIN_GRID_AXIS;
else if( m_rbUserDefinedOrigin->GetValue() )
m_origin = STEP_ORIGIN_USER;
else if( m_rbBoardCenterOrigin->GetValue() )
m_origin = STEP_ORIGIN_BOARD_CENTER;
return m_origin;
} }
@ -427,12 +263,6 @@ int BOARD_EDITOR_CONTROL::ExportSTEP( const TOOL_EVENT& aEvent )
} }
void DIALOG_EXPORT_STEP::onUpdateUnits( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( m_rbUserDefinedOrigin->GetValue() );
}
void DIALOG_EXPORT_STEP::onUpdateXPos( wxUpdateUIEvent& aEvent ) void DIALOG_EXPORT_STEP::onUpdateXPos( wxUpdateUIEvent& aEvent )
{ {
aEvent.Enable( m_rbUserDefinedOrigin->GetValue() ); aEvent.Enable( m_rbUserDefinedOrigin->GetValue() );
@ -466,8 +296,7 @@ void DIALOG_EXPORT_STEP::onBrowseClicked( wxCommandEvent& aEvent )
wxString path = ExpandEnvVarSubstitutions( m_outputFileName->GetValue(), &Prj() ); wxString path = ExpandEnvVarSubstitutions( m_outputFileName->GetValue(), &Prj() );
wxFileName fn( Prj().AbsolutePath( path ) ); wxFileName fn( Prj().AbsolutePath( path ) );
wxFileDialog dlg( this, _( "3D Model Output File" ), fn.GetPath(), fn.GetFullName(), filter, wxFileDialog dlg( this, _( "3D Model Output File" ), fn.GetPath(), fn.GetFullName(), filter, wxFD_SAVE );
wxFD_SAVE );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;
@ -557,31 +386,6 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
return; return;
} }
m_netFilter = m_txtNetFilter->GetValue();
m_componentFilter = m_txtComponentFilter->GetValue();
if( m_rbAllComponents->GetValue() )
m_componentMode = COMPONENT_MODE::EXPORT_ALL;
else if( m_rbOnlySelected->GetValue() )
m_componentMode = COMPONENT_MODE::EXPORT_SELECTED;
else
m_componentMode = COMPONENT_MODE::CUSTOM_FILTER;
m_toleranceLastChoice = m_choiceTolerance->GetSelection();
m_formatLastChoice = m_choiceFormat->GetSelection();
m_optimizeStep = m_cbOptimizeStep->GetValue();
m_exportBoardBody = m_cbExportBody->GetValue();
m_exportComponents = m_cbExportComponents->GetValue();
m_exportTracks = m_cbExportTracks->GetValue();
m_exportPads = m_cbExportPads->GetValue();
m_exportZones = m_cbExportZones->GetValue();
m_exportInnerCopper = m_cbExportInnerCopper->GetValue();
m_exportSilkscreen = m_cbExportSilkscreen->GetValue();
m_exportSoldermask = m_cbExportSoldermask->GetValue();
m_fuseShapes = m_cbFuseShapes->GetValue();
m_cutViasInBody = m_cbCutViasInBody->GetValue();
m_fillAllVias = m_cbFillAllVias->GetValue();
SHAPE_POLY_SET outline; SHAPE_POLY_SET outline;
wxString msg; wxString msg;
@ -603,7 +407,7 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
wxFileName fn( Prj().AbsolutePath( path ) ); wxFileName fn( Prj().AbsolutePath( path ) );
if( fn.FileExists() && !GetOverwriteFile() ) if( fn.FileExists() && !m_cbOverwriteFile->GetValue() )
{ {
msg.Printf( _( "File '%s' already exists. Do you want overwrite this file?" ), msg.Printf( _( "File '%s' already exists. Do you want overwrite this file?" ),
fn.GetFullPath() ); fn.GetFullPath() );
@ -644,49 +448,49 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
cmdK2S.Append( wxT( " " ) ); cmdK2S.Append( wxT( " " ) );
cmdK2S.Append( c_formatCommand[m_choiceFormat->GetSelection()] ); cmdK2S.Append( c_formatCommand[m_choiceFormat->GetSelection()] );
if( GetNoUnspecifiedOption() ) if( m_cbRemoveUnspecified->GetValue() )
cmdK2S.Append( wxT( " --no-unspecified" ) ); cmdK2S.Append( wxT( " --no-unspecified" ) );
if( GetNoDNPOption() ) if( m_cbRemoveDNP->GetValue() )
cmdK2S.Append( wxT( " --no-dnp" ) ); cmdK2S.Append( wxT( " --no-dnp" ) );
if( GetSubstOption() ) if( m_cbSubstModels->GetValue() )
cmdK2S.Append( wxT( " --subst-models" ) ); cmdK2S.Append( wxT( " --subst-models" ) );
if( !m_optimizeStep ) if( !m_cbOptimizeStep->GetValue() )
cmdK2S.Append( wxT( " --no-optimize-step" ) ); cmdK2S.Append( wxT( " --no-optimize-step" ) );
if( !m_exportBoardBody ) if( !m_cbExportBody->GetValue() )
cmdK2S.Append( wxT( " --no-board-body" ) ); cmdK2S.Append( wxT( " --no-board-body" ) );
if( !m_exportComponents ) if( !m_cbExportComponents->GetValue() )
cmdK2S.Append( wxT( " --no-components" ) ); cmdK2S.Append( wxT( " --no-components" ) );
if( m_exportTracks ) if( m_cbExportTracks->GetValue() )
cmdK2S.Append( wxT( " --include-tracks" ) ); cmdK2S.Append( wxT( " --include-tracks" ) );
if( m_exportPads ) if( m_cbExportPads->GetValue() )
cmdK2S.Append( wxT( " --include-pads" ) ); cmdK2S.Append( wxT( " --include-pads" ) );
if( m_exportZones ) if( m_cbExportZones->GetValue() )
cmdK2S.Append( wxT( " --include-zones" ) ); cmdK2S.Append( wxT( " --include-zones" ) );
if( m_exportInnerCopper ) if( m_cbExportInnerCopper->GetValue() )
cmdK2S.Append( wxT( " --include-inner-copper" ) ); cmdK2S.Append( wxT( " --include-inner-copper" ) );
if( m_exportSilkscreen ) if( m_cbExportSilkscreen->GetValue() )
cmdK2S.Append( wxT( " --include-silkscreen" ) ); cmdK2S.Append( wxT( " --include-silkscreen" ) );
if( m_exportSoldermask ) if( m_cbExportSoldermask->GetValue() )
cmdK2S.Append( wxT( " --include-soldermask" ) ); cmdK2S.Append( wxT( " --include-soldermask" ) );
if( m_fuseShapes ) if( m_cbFuseShapes->GetValue() )
cmdK2S.Append( wxT( " --fuse-shapes" ) ); cmdK2S.Append( wxT( " --fuse-shapes" ) );
if( m_cutViasInBody ) if( m_cbCutViasInBody->GetValue() )
cmdK2S.Append( wxT( " --cut-vias-in-body" ) ); cmdK2S.Append( wxT( " --cut-vias-in-body" ) );
if( m_fillAllVias ) if( m_cbFillAllVias->GetValue() )
cmdK2S.Append( wxT( " --fill-all-vias" ) ); cmdK2S.Append( wxT( " --fill-all-vias" ) );
// Note: for some reason, using \" to insert a quote in a format string, under MacOS // Note: for some reason, using \" to insert a quote in a format string, under MacOS
@ -694,15 +498,13 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
int quote = '\''; int quote = '\'';
int dblquote = '"'; int dblquote = '"';
if( !m_netFilter.empty() ) if( !m_txtNetFilter->GetValue().empty() )
{ {
cmdK2S.Append( wxString::Format( wxT( " --net-filter %c%s%c" ), cmdK2S.Append( wxString::Format( wxT( " --net-filter %c%s%c" ),
dblquote, m_netFilter, dblquote ) ); dblquote, m_txtNetFilter->GetValue(), dblquote ) );
} }
switch( m_componentMode ) if( m_rbOnlySelected->GetValue() )
{
case COMPONENT_MODE::EXPORT_SELECTED:
{ {
wxArrayString components; wxArrayString components;
SELECTION& selection = m_editFrame->GetCurrentSelection(); SELECTION& selection = m_editFrame->GetCurrentSelection();
@ -716,51 +518,31 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
cmdK2S.Append( wxString::Format( wxT( " --component-filter %c%s%c" ), cmdK2S.Append( wxString::Format( wxT( " --component-filter %c%s%c" ),
dblquote, wxJoin( components, ',' ), dblquote ) ); dblquote, wxJoin( components, ',' ), dblquote ) );
break;
} }
else if( m_rbFilteredComponents->GetValue() )
case COMPONENT_MODE::CUSTOM_FILTER: {
cmdK2S.Append( wxString::Format( wxT( " --component-filter %c%s%c" ), cmdK2S.Append( wxString::Format( wxT( " --component-filter %c%s%c" ),
dblquote, m_componentFilter, dblquote ) ); dblquote, m_txtComponentFilter->GetValue(), dblquote ) );
break;
default:
break;
} }
switch( GetOriginOption() ) if( m_rbDrillAndPlotOrigin->GetValue() )
{ {
case STEP_ORIGIN_0:
wxFAIL_MSG( wxT( "Unsupported origin option: how did we get here?" ) );
break;
case STEP_ORIGIN_PLOT_AXIS:
cmdK2S.Append( wxT( " --drill-origin" ) ); cmdK2S.Append( wxT( " --drill-origin" ) );
break; }
else if( m_rbGridOrigin->GetValue() )
case STEP_ORIGIN_GRID_AXIS:
cmdK2S.Append( wxT( " --grid-origin" ) );
break;
case STEP_ORIGIN_USER:
{ {
double xOrg = GetXOrg(); cmdK2S.Append( wxT( " --grid-origin" ) );
double yOrg = GetYOrg(); }
else if( m_rbUserDefinedOrigin->GetValue() )
if( GetOrgUnitsChoice() == 1 ) {
{ double xOrg = pcbIUScale.IUTomm( m_originX.GetIntValue() );
// selected reference unit is in inches, and STEP units are mm double yOrg = pcbIUScale.IUTomm( m_originY.GetIntValue() );
xOrg *= 25.4;
yOrg *= 25.4;
}
LOCALE_IO dummy; LOCALE_IO dummy;
cmdK2S.Append( wxString::Format( wxT( " --user-origin=%c%.6fx%.6fmm%c" ), cmdK2S.Append( wxString::Format( wxT( " --user-origin=%c%.6fx%.6fmm%c" ),
quote, xOrg, yOrg, quote ) ); quote, xOrg, yOrg, quote ) );
break;
} }
else if( m_rbBoardCenterOrigin->GetValue() )
case STEP_ORIGIN_BOARD_CENTER:
{ {
BOX2I bbox = m_editFrame->GetBoard()->ComputeBoundingBox( true ); BOX2I bbox = m_editFrame->GetBoard()->ComputeBoundingBox( true );
double xOrg = pcbIUScale.IUTomm( bbox.GetCenter().x ); double xOrg = pcbIUScale.IUTomm( bbox.GetCenter().x );
@ -769,8 +551,10 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
cmdK2S.Append( wxString::Format( wxT( " --user-origin=%c%.6fx%.6fmm%c" ), cmdK2S.Append( wxString::Format( wxT( " --user-origin=%c%.6fx%.6fmm%c" ),
quote, xOrg, yOrg, quote ) ); quote, xOrg, yOrg, quote ) );
break;
} }
else
{
wxFAIL_MSG( wxT( "Unsupported origin option: how did we get here?" ) );
} }
{ {
@ -820,13 +604,13 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
// ensure the main format on the job is populated // ensure the main format on the job is populated
switch( m_job->m_3dparams.m_Format ) switch( m_job->m_3dparams.m_Format )
{ {
case EXPORTER_STEP_PARAMS::FORMAT::STEP: m_job->m_format = JOB_EXPORT_PCB_3D::FORMAT::STEP; break; case EXPORTER_STEP_PARAMS::FORMAT::STEP: m_job->m_format = JOB_EXPORT_PCB_3D::FORMAT::STEP; break;
case EXPORTER_STEP_PARAMS::FORMAT::STEPZ: m_job->m_format = JOB_EXPORT_PCB_3D::FORMAT::STEPZ; break; case EXPORTER_STEP_PARAMS::FORMAT::STEPZ: m_job->m_format = JOB_EXPORT_PCB_3D::FORMAT::STEPZ; break;
case EXPORTER_STEP_PARAMS::FORMAT::GLB: m_job->m_format = JOB_EXPORT_PCB_3D::FORMAT::GLB; break; case EXPORTER_STEP_PARAMS::FORMAT::GLB: m_job->m_format = JOB_EXPORT_PCB_3D::FORMAT::GLB; break;
case EXPORTER_STEP_PARAMS::FORMAT::XAO: m_job->m_format = JOB_EXPORT_PCB_3D::FORMAT::XAO; break; case EXPORTER_STEP_PARAMS::FORMAT::XAO: m_job->m_format = JOB_EXPORT_PCB_3D::FORMAT::XAO; break;
case EXPORTER_STEP_PARAMS::FORMAT::BREP: m_job->m_format = JOB_EXPORT_PCB_3D::FORMAT::BREP; break; case EXPORTER_STEP_PARAMS::FORMAT::BREP: m_job->m_format = JOB_EXPORT_PCB_3D::FORMAT::BREP; break;
case EXPORTER_STEP_PARAMS::FORMAT::PLY: m_job->m_format = JOB_EXPORT_PCB_3D::FORMAT::PLY; break; case EXPORTER_STEP_PARAMS::FORMAT::PLY: m_job->m_format = JOB_EXPORT_PCB_3D::FORMAT::PLY; break;
case EXPORTER_STEP_PARAMS::FORMAT::STL: m_job->m_format = JOB_EXPORT_PCB_3D::FORMAT::STL; break; case EXPORTER_STEP_PARAMS::FORMAT::STL: m_job->m_format = JOB_EXPORT_PCB_3D::FORMAT::STL; break;
} }
m_job->m_3dparams.m_UseDrillOrigin = false; m_job->m_3dparams.m_UseDrillOrigin = false;
@ -834,58 +618,33 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
m_job->m_3dparams.m_UseDefinedOrigin = false; m_job->m_3dparams.m_UseDefinedOrigin = false;
m_job->m_3dparams.m_UsePcbCenterOrigin = false; m_job->m_3dparams.m_UsePcbCenterOrigin = false;
switch( GetOriginOption() ) if( m_rbDrillAndPlotOrigin->GetValue() )
{ {
case STEP_ORIGIN_0: m_job->m_3dparams.m_UseDrillOrigin = true;
break; }
case STEP_ORIGIN_PLOT_AXIS: else if( m_rbGridOrigin->GetValue() )
m_job->m_3dparams.m_UseDrillOrigin = true; {
break; m_job->m_3dparams.m_UseGridOrigin = true;
case STEP_ORIGIN_GRID_AXIS: }
m_job->m_3dparams.m_UseGridOrigin = true; else if( m_rbUserDefinedOrigin->GetValue() )
break; {
case STEP_ORIGIN_USER: double xOrg = pcbIUScale.IUTomm( m_originX.GetIntValue() );
{ double yOrg = pcbIUScale.IUTomm( m_originY.GetIntValue() );
double xOrg = GetXOrg();
double yOrg = GetYOrg();
if( GetOrgUnitsChoice() == 1 ) m_job->m_3dparams.m_UseDefinedOrigin = true;
{ m_job->m_3dparams.m_Origin = VECTOR2D( xOrg, yOrg );
// selected reference unit is in inches, and STEP units are mm }
xOrg *= 25.4; else if( m_rbBoardCenterOrigin->GetValue() )
yOrg *= 25.4; {
} BOX2I bbox = m_editFrame->GetBoard()->ComputeBoundingBox( true );
double xOrg = pcbIUScale.IUTomm( bbox.GetCenter().x );
double yOrg = pcbIUScale.IUTomm( bbox.GetCenter().y );
LOCALE_IO dummy;
m_job->m_3dparams.m_UseDefinedOrigin = true; m_job->m_3dparams.m_UsePcbCenterOrigin = true;
m_job->m_3dparams.m_Origin = VECTOR2D( xOrg, yOrg ); m_job->m_3dparams.m_Origin = VECTOR2D( xOrg, yOrg );
break;
}
case STEP_ORIGIN_BOARD_CENTER:
{
BOX2I bbox = m_editFrame->GetBoard()->ComputeBoundingBox( true );
double xOrg = pcbIUScale.IUTomm( bbox.GetCenter().x );
double yOrg = pcbIUScale.IUTomm( bbox.GetCenter().y );
LOCALE_IO dummy;
m_job->m_3dparams.m_UsePcbCenterOrigin = true;
m_job->m_3dparams.m_Origin = VECTOR2D( xOrg, yOrg );
break;
}
} }
EndModal( wxID_OK ); EndModal( wxID_OK );
} }
} }
double DIALOG_EXPORT_STEP::GetXOrg() const
{
return EDA_UNIT_UTILS::UI::DoubleValueFromString( m_STEP_Xorg->GetValue() );
}
double DIALOG_EXPORT_STEP::GetYOrg()
{
return EDA_UNIT_UTILS::UI::DoubleValueFromString( m_STEP_Yorg->GetValue() );
}

View File

@ -25,6 +25,7 @@
#pragma once #pragma once
#include "dialog_export_step_base.h" #include "dialog_export_step_base.h"
#include <widgets/unit_binder.h>
class PCB_EDIT_FRAME; class PCB_EDIT_FRAME;
class JOB_EXPORT_PCB_3D; class JOB_EXPORT_PCB_3D;
@ -32,23 +33,15 @@ class JOB_EXPORT_PCB_3D;
class DIALOG_EXPORT_STEP : public DIALOG_EXPORT_STEP_BASE class DIALOG_EXPORT_STEP : public DIALOG_EXPORT_STEP_BASE
{ {
public: public:
enum STEP_ORIGIN_OPTION
{
STEP_ORIGIN_0, // absolute coordinates
STEP_ORIGIN_PLOT_AXIS, // origin is plot/drill axis origin
STEP_ORIGIN_GRID_AXIS, // origin is grid origin
STEP_ORIGIN_BOARD_CENTER, // origin is board center
STEP_ORIGIN_USER, // origin is entered by user
};
DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aEditFrame, const wxString& aBoardPath ); DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aEditFrame, const wxString& aBoardPath );
DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aEditFrame, wxWindow* aParent, const wxString& aBoardPath, DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aEditFrame, wxWindow* aParent, const wxString& aBoardPath,
JOB_EXPORT_PCB_3D* aJob = nullptr ); JOB_EXPORT_PCB_3D* aJob = nullptr );
~DIALOG_EXPORT_STEP(); ~DIALOG_EXPORT_STEP() = default;
bool TransferDataToWindow() override;
protected: protected:
void onBrowseClicked( wxCommandEvent& aEvent ) override; void onBrowseClicked( wxCommandEvent& aEvent ) override;
void onUpdateUnits( wxUpdateUIEvent& aEvent ) override;
void onUpdateXPos( wxUpdateUIEvent& aEvent ) override; void onUpdateXPos( wxUpdateUIEvent& aEvent ) override;
void onUpdateYPos( wxUpdateUIEvent& aEvent ) override; void onUpdateYPos( wxUpdateUIEvent& aEvent ) override;
void onExportButton( wxCommandEvent& aEvent ) override; void onExportButton( wxCommandEvent& aEvent ) override;
@ -56,72 +49,13 @@ protected:
void onCbExportComponents( wxCommandEvent& event ) override; void onCbExportComponents( wxCommandEvent& event ) override;
void OnComponentModeChange( wxCommandEvent& event ) override; void OnComponentModeChange( wxCommandEvent& event ) override;
int GetOrgUnitsChoice() const
{
return m_STEP_OrgUnitChoice->GetSelection();
}
double GetXOrg() const;
double GetYOrg();
STEP_ORIGIN_OPTION GetOriginOption();
bool GetNoUnspecifiedOption()
{
return m_cbRemoveUnspecified->GetValue();
}
bool GetNoDNPOption()
{
return m_cbRemoveDNP->GetValue();
}
bool GetSubstOption()
{
return m_cbSubstModels->GetValue();
}
bool GetOverwriteFile()
{
return m_cbOverwriteFile->GetValue();
}
// Called to update filename extension after the output file format is changed // Called to update filename extension after the output file format is changed
void OnFmtChoiceOptionChanged(); void OnFmtChoiceOptionChanged();
private: private:
enum class COMPONENT_MODE
{
EXPORT_ALL,
EXPORT_SELECTED,
CUSTOM_FILTER
};
PCB_EDIT_FRAME* m_editFrame; PCB_EDIT_FRAME* m_editFrame;
JOB_EXPORT_PCB_3D* m_job; JOB_EXPORT_PCB_3D* m_job;
STEP_ORIGIN_OPTION m_origin; // The last preference for STEP origin option UNIT_BINDER m_originX;
double m_userOriginX; // remember last User Origin X value UNIT_BINDER m_originY;
double m_userOriginY; // remember last User Origin Y value
int m_originUnits; // remember last units for User Origin
bool m_noUnspecified; // remember last preference for No Unspecified Component
bool m_noDNP; // remember last preference for No DNP Component
static bool m_optimizeStep; // remember last preference for Optimize STEP file (stored only for the session)
static bool m_exportBoardBody; // remember last preference to export board body (stored only for the session)
static bool m_exportComponents; // remember last preference to export components (stored only for the session)
static bool m_exportTracks; // remember last preference to export tracks and vias (stored only for the session)
static bool m_exportPads; // remember last preference to export pads (stored only for the session)
static bool m_exportZones; // remember last preference to export zones (stored only for the session)
static bool m_exportInnerCopper; // remember last preference to export inner layers (stored only for the session)
static bool m_exportSilkscreen; // remember last preference to export silkscreen (stored only for the session)
static bool m_exportSoldermask; // remember last preference to export soldermask (stored only for the session)
static bool m_fuseShapes; // remember last preference to fuse shapes (stored only for the session)
static bool m_fillAllVias; // remember last preference to fill all vias (stored only for the session)
static bool m_cutViasInBody; // remember last preference to cut via holes in body (stored only for the session)
wxString m_netFilter; // filter copper nets
static wxString m_componentFilter; // filter component reference designators
static COMPONENT_MODE m_componentMode;
wxString m_boardPath; // path to the exported board file wxString m_boardPath; // path to the exported board file
static int m_toleranceLastChoice; // Store m_tolerance option during a session
static int m_formatLastChoice; // Store format option during a session
}; };

View File

@ -62,6 +62,7 @@ DIALOG_EXPORT_STEP_BASE::DIALOG_EXPORT_STEP_BASE( wxWindow* parent, wxWindowID i
sbBoardOptions->Add( m_cbExportCompound_hidden, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); sbBoardOptions->Add( m_cbExportCompound_hidden, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbExportBody = new wxCheckBox( sbBoardOptions->GetStaticBox(), wxID_ANY, _("Export board body"), wxDefaultPosition, wxDefaultSize, 0 ); m_cbExportBody = new wxCheckBox( sbBoardOptions->GetStaticBox(), wxID_ANY, _("Export board body"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbExportBody->SetValue(true);
sbBoardOptions->Add( m_cbExportBody, 0, wxALL, 5 ); sbBoardOptions->Add( m_cbExportBody, 0, wxALL, 5 );
m_cbCutViasInBody = new wxCheckBox( sbBoardOptions->GetStaticBox(), wxID_ANY, _("Cut vias in board body"), wxDefaultPosition, wxDefaultSize, 0 ); m_cbCutViasInBody = new wxCheckBox( sbBoardOptions->GetStaticBox(), wxID_ANY, _("Cut vias in board body"), wxDefaultPosition, wxDefaultSize, 0 );
@ -86,6 +87,7 @@ DIALOG_EXPORT_STEP_BASE::DIALOG_EXPORT_STEP_BASE( wxWindow* parent, wxWindowID i
sbBoardOptions->Add( m_cbExportSolderpaste_hidden, 0, wxBOTTOM|wxRIGHT, 5 ); sbBoardOptions->Add( m_cbExportSolderpaste_hidden, 0, wxBOTTOM|wxRIGHT, 5 );
m_cbExportComponents = new wxCheckBox( sbBoardOptions->GetStaticBox(), wxID_ANY, _("Export components"), wxDefaultPosition, wxDefaultSize, 0 ); m_cbExportComponents = new wxCheckBox( sbBoardOptions->GetStaticBox(), wxID_ANY, _("Export components"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbExportComponents->SetValue(true);
sbBoardOptions->Add( m_cbExportComponents, 0, wxRIGHT|wxLEFT, 5 ); sbBoardOptions->Add( m_cbExportComponents, 0, wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizer51; wxBoxSizer* bSizer51;
@ -166,6 +168,7 @@ DIALOG_EXPORT_STEP_BASE::DIALOG_EXPORT_STEP_BASE( wxWindow* parent, wxWindowID i
sbCoordinates = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Coordinates") ), wxVERTICAL ); sbCoordinates = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Coordinates") ), wxVERTICAL );
m_rbDrillAndPlotOrigin = new wxRadioButton( sbCoordinates->GetStaticBox(), wxID_ANY, _("Drill/place file origin"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); m_rbDrillAndPlotOrigin = new wxRadioButton( sbCoordinates->GetStaticBox(), wxID_ANY, _("Drill/place file origin"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_rbDrillAndPlotOrigin->SetValue( true );
sbCoordinates->Add( m_rbDrillAndPlotOrigin, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); sbCoordinates->Add( m_rbDrillAndPlotOrigin, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_rbGridOrigin = new wxRadioButton( sbCoordinates->GetStaticBox(), wxID_ANY, _("Grid origin"), wxDefaultPosition, wxDefaultSize, 0 ); m_rbGridOrigin = new wxRadioButton( sbCoordinates->GetStaticBox(), wxID_ANY, _("Grid origin"), wxDefaultPosition, wxDefaultSize, 0 );
@ -184,49 +187,47 @@ DIALOG_EXPORT_STEP_BASE::DIALOG_EXPORT_STEP_BASE( wxWindow* parent, wxWindowID i
sbUserDefinedOrigin = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User Defined Origin") ), wxVERTICAL ); sbUserDefinedOrigin = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User Defined Origin") ), wxVERTICAL );
wxFlexGridSizer* fgSizer1; wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 0, 2, 5, 0 ); fgSizer1 = new wxFlexGridSizer( 0, 3, 5, 0 );
fgSizer1->SetFlexibleDirection( wxBOTH ); fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextUnits = new wxStaticText( sbUserDefinedOrigin->GetStaticBox(), wxID_ANY, _("Units:"), wxDefaultPosition, wxDefaultSize, 0 ); m_originXLabel = new wxStaticText( sbUserDefinedOrigin->GetStaticBox(), wxID_ANY, _("X position:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnits->Wrap( -1 ); m_originXLabel->Wrap( -1 );
fgSizer1->Add( m_staticTextUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); fgSizer1->Add( m_originXLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
wxString m_STEP_OrgUnitChoiceChoices[] = { _("mm"), _("inch") }; m_originXCtrl = new TEXT_CTRL_EVAL( sbUserDefinedOrigin->GetStaticBox(), wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
int m_STEP_OrgUnitChoiceNChoices = sizeof( m_STEP_OrgUnitChoiceChoices ) / sizeof( wxString );
m_STEP_OrgUnitChoice = new wxChoice( sbUserDefinedOrigin->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_STEP_OrgUnitChoiceNChoices, m_STEP_OrgUnitChoiceChoices, 0 );
m_STEP_OrgUnitChoice->SetSelection( 0 );
fgSizer1->Add( m_STEP_OrgUnitChoice, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_staticTextXpos = new wxStaticText( sbUserDefinedOrigin->GetStaticBox(), wxID_ANY, _("X position:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextXpos->Wrap( -1 );
fgSizer1->Add( m_staticTextXpos, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_STEP_Xorg = new TEXT_CTRL_EVAL( sbUserDefinedOrigin->GetStaticBox(), wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
#ifdef __WXGTK__ #ifdef __WXGTK__
if ( !m_STEP_Xorg->HasFlag( wxTE_MULTILINE ) ) if ( !m_originXCtrl->HasFlag( wxTE_MULTILINE ) )
{ {
m_STEP_Xorg->SetMaxLength( 8 ); m_originXCtrl->SetMaxLength( 8 );
} }
#else #else
m_STEP_Xorg->SetMaxLength( 8 ); m_originXCtrl->SetMaxLength( 8 );
#endif #endif
fgSizer1->Add( m_STEP_Xorg, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 ); fgSizer1->Add( m_originXCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_staticTextYpos = new wxStaticText( sbUserDefinedOrigin->GetStaticBox(), wxID_ANY, _("Y position:"), wxDefaultPosition, wxDefaultSize, 0 ); m_originXUnits = new wxStaticText( sbUserDefinedOrigin->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextYpos->Wrap( -1 ); m_originXUnits->Wrap( -1 );
fgSizer1->Add( m_staticTextYpos, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); fgSizer1->Add( m_originXUnits, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_STEP_Yorg = new TEXT_CTRL_EVAL( sbUserDefinedOrigin->GetStaticBox(), wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 ); m_originYLabel = new wxStaticText( sbUserDefinedOrigin->GetStaticBox(), wxID_ANY, _("Y position:"), wxDefaultPosition, wxDefaultSize, 0 );
m_originYLabel->Wrap( -1 );
fgSizer1->Add( m_originYLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_originYCtrl = new TEXT_CTRL_EVAL( sbUserDefinedOrigin->GetStaticBox(), wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
#ifdef __WXGTK__ #ifdef __WXGTK__
if ( !m_STEP_Yorg->HasFlag( wxTE_MULTILINE ) ) if ( !m_originYCtrl->HasFlag( wxTE_MULTILINE ) )
{ {
m_STEP_Yorg->SetMaxLength( 8 ); m_originYCtrl->SetMaxLength( 8 );
} }
#else #else
m_STEP_Yorg->SetMaxLength( 8 ); m_originYCtrl->SetMaxLength( 8 );
#endif #endif
fgSizer1->Add( m_STEP_Yorg, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 ); fgSizer1->Add( m_originYCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_originYUnits = new wxStaticText( sbUserDefinedOrigin->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_originYUnits->Wrap( -1 );
fgSizer1->Add( m_originYUnits, 0, wxALIGN_CENTER_VERTICAL, 5 );
sbUserDefinedOrigin->Add( fgSizer1, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); sbUserDefinedOrigin->Add( fgSizer1, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
@ -248,14 +249,17 @@ DIALOG_EXPORT_STEP_BASE::DIALOG_EXPORT_STEP_BASE( wxWindow* parent, wxWindowID i
sbOtherOptions->Add( m_cbRemoveUnspecified, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); sbOtherOptions->Add( m_cbRemoveUnspecified, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbSubstModels = new wxCheckBox( sbOtherOptions->GetStaticBox(), wxID_ANY, _("Substitute similarly named models"), wxDefaultPosition, wxDefaultSize, 0 ); m_cbSubstModels = new wxCheckBox( sbOtherOptions->GetStaticBox(), wxID_ANY, _("Substitute similarly named models"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbSubstModels->SetValue(true);
m_cbSubstModels->SetToolTip( _("Replace VRML models with STEP models of the same name") ); m_cbSubstModels->SetToolTip( _("Replace VRML models with STEP models of the same name") );
sbOtherOptions->Add( m_cbSubstModels, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); sbOtherOptions->Add( m_cbSubstModels, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbOverwriteFile = new wxCheckBox( sbOtherOptions->GetStaticBox(), wxID_ANY, _("Overwrite old file"), wxDefaultPosition, wxDefaultSize, 0 ); m_cbOverwriteFile = new wxCheckBox( sbOtherOptions->GetStaticBox(), wxID_ANY, _("Overwrite old file"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbOverwriteFile->SetValue(true);
sbOtherOptions->Add( m_cbOverwriteFile, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); sbOtherOptions->Add( m_cbOverwriteFile, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbOptimizeStep = new wxCheckBox( sbOtherOptions->GetStaticBox(), wxID_ANY, _("Don't write P-curves to STEP file"), wxDefaultPosition, wxDefaultSize, 0 ); m_cbOptimizeStep = new wxCheckBox( sbOtherOptions->GetStaticBox(), wxID_ANY, _("Don't write P-curves to STEP file"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbOptimizeStep->SetValue(true);
m_cbOptimizeStep->SetToolTip( _("Disables writing parametric curves. Optimizes file size and write/read times, but may reduce compatibility with other software.") ); m_cbOptimizeStep->SetToolTip( _("Disables writing parametric curves. Optimizes file size and write/read times, but may reduce compatibility with other software.") );
sbOtherOptions->Add( m_cbOptimizeStep, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); sbOtherOptions->Add( m_cbOptimizeStep, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
@ -304,9 +308,8 @@ DIALOG_EXPORT_STEP_BASE::DIALOG_EXPORT_STEP_BASE( wxWindow* parent, wxWindowID i
m_rbAllComponents->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXPORT_STEP_BASE::OnComponentModeChange ), NULL, this ); m_rbAllComponents->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXPORT_STEP_BASE::OnComponentModeChange ), NULL, this );
m_rbOnlySelected->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXPORT_STEP_BASE::OnComponentModeChange ), NULL, this ); m_rbOnlySelected->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXPORT_STEP_BASE::OnComponentModeChange ), NULL, this );
m_rbFilteredComponents->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXPORT_STEP_BASE::OnComponentModeChange ), NULL, this ); m_rbFilteredComponents->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXPORT_STEP_BASE::OnComponentModeChange ), NULL, this );
m_STEP_OrgUnitChoice->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EXPORT_STEP_BASE::onUpdateUnits ), NULL, this ); m_originXCtrl->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EXPORT_STEP_BASE::onUpdateXPos ), NULL, this );
m_STEP_Xorg->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EXPORT_STEP_BASE::onUpdateXPos ), NULL, this ); m_originYCtrl->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EXPORT_STEP_BASE::onUpdateYPos ), NULL, this );
m_STEP_Yorg->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EXPORT_STEP_BASE::onUpdateYPos ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXPORT_STEP_BASE::onExportButton ), NULL, this ); m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXPORT_STEP_BASE::onExportButton ), NULL, this );
} }
@ -319,9 +322,8 @@ DIALOG_EXPORT_STEP_BASE::~DIALOG_EXPORT_STEP_BASE()
m_rbAllComponents->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXPORT_STEP_BASE::OnComponentModeChange ), NULL, this ); m_rbAllComponents->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXPORT_STEP_BASE::OnComponentModeChange ), NULL, this );
m_rbOnlySelected->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXPORT_STEP_BASE::OnComponentModeChange ), NULL, this ); m_rbOnlySelected->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXPORT_STEP_BASE::OnComponentModeChange ), NULL, this );
m_rbFilteredComponents->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXPORT_STEP_BASE::OnComponentModeChange ), NULL, this ); m_rbFilteredComponents->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXPORT_STEP_BASE::OnComponentModeChange ), NULL, this );
m_STEP_OrgUnitChoice->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EXPORT_STEP_BASE::onUpdateUnits ), NULL, this ); m_originXCtrl->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EXPORT_STEP_BASE::onUpdateXPos ), NULL, this );
m_STEP_Xorg->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EXPORT_STEP_BASE::onUpdateXPos ), NULL, this ); m_originYCtrl->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EXPORT_STEP_BASE::onUpdateYPos ), NULL, this );
m_STEP_Yorg->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EXPORT_STEP_BASE::onUpdateYPos ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXPORT_STEP_BASE::onExportButton ), NULL, this ); m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXPORT_STEP_BASE::onExportButton ), NULL, this );
} }

View File

@ -518,7 +518,7 @@
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
<property name="center_pane">0</property> <property name="center_pane">0</property>
<property name="checked">0</property> <property name="checked">1</property>
<property name="close_button">1</property> <property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
@ -843,7 +843,7 @@
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
<property name="center_pane">0</property> <property name="center_pane">0</property>
<property name="checked">0</property> <property name="checked">1</property>
<property name="close_button">1</property> <property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
@ -1780,7 +1780,7 @@
<property name="validator_style">wxFILTER_NONE</property> <property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property> <property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property> <property name="validator_variable"></property>
<property name="value">0</property> <property name="value">1</property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
@ -2000,7 +2000,7 @@
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property> <property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="false"> <object class="wxFlexGridSizer" expanded="false">
<property name="cols">2</property> <property name="cols">3</property>
<property name="flexible_direction">wxBOTH</property> <property name="flexible_direction">wxBOTH</property>
<property name="growablecols"></property> <property name="growablecols"></property>
<property name="growablerows"></property> <property name="growablerows"></property>
@ -2011,134 +2011,6 @@
<property name="permission">none</property> <property name="permission">none</property>
<property name="rows">0</property> <property name="rows">0</property>
<property name="vgap">5</property> <property name="vgap">5</property>
<object class="sizeritem" expanded="false">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="false">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Units:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticTextUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="false">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxChoice" expanded="false">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;mm&quot; &quot;inch&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_STEP_OrgUnitChoice</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">0</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnUpdateUI">onUpdateUnits</event>
</object>
</object>
<object class="sizeritem" expanded="false"> <object class="sizeritem" expanded="false">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property> <property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
@ -2181,7 +2053,7 @@
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">m_staticTextXpos</property> <property name="name">m_originXLabel</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
<property name="pane_position"></property> <property name="pane_position"></property>
<property name="pane_size"></property> <property name="pane_size"></property>
@ -2242,7 +2114,7 @@
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">m_STEP_Xorg</property> <property name="name">m_originXCtrl</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
<property name="pane_position"></property> <property name="pane_position"></property>
<property name="pane_size"></property> <property name="pane_size"></property>
@ -2267,6 +2139,68 @@
<event name="OnUpdateUI">onUpdateXPos</event> <event name="OnUpdateUI">onUpdateXPos</event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">units</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_originXUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="false"> <object class="sizeritem" expanded="false">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property> <property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
@ -2309,7 +2243,7 @@
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">m_staticTextYpos</property> <property name="name">m_originYLabel</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
<property name="pane_position"></property> <property name="pane_position"></property>
<property name="pane_size"></property> <property name="pane_size"></property>
@ -2370,7 +2304,7 @@
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">m_STEP_Yorg</property> <property name="name">m_originYCtrl</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
<property name="pane_position"></property> <property name="pane_position"></property>
<property name="pane_size"></property> <property name="pane_size"></property>
@ -2395,6 +2329,68 @@
<event name="OnUpdateUI">onUpdateYPos</event> <event name="OnUpdateUI">onUpdateYPos</event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">units</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_originYUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
</object> </object>
</object> </object>
</object> </object>
@ -2559,7 +2555,7 @@
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
<property name="center_pane">0</property> <property name="center_pane">0</property>
<property name="checked">0</property> <property name="checked">1</property>
<property name="close_button">1</property> <property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
@ -2624,7 +2620,7 @@
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
<property name="center_pane">0</property> <property name="center_pane">0</property>
<property name="checked">0</property> <property name="checked">1</property>
<property name="close_button">1</property> <property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
@ -2689,7 +2685,7 @@
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
<property name="center_pane">0</property> <property name="center_pane">0</property>
<property name="checked">0</property> <property name="checked">1</property>
<property name="close_button">1</property> <property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>

View File

@ -74,12 +74,12 @@ class DIALOG_EXPORT_STEP_BASE : public DIALOG_SHIM
wxRadioButton* m_rbGridOrigin; wxRadioButton* m_rbGridOrigin;
wxRadioButton* m_rbUserDefinedOrigin; wxRadioButton* m_rbUserDefinedOrigin;
wxRadioButton* m_rbBoardCenterOrigin; wxRadioButton* m_rbBoardCenterOrigin;
wxStaticText* m_staticTextUnits; wxStaticText* m_originXLabel;
wxChoice* m_STEP_OrgUnitChoice; TEXT_CTRL_EVAL* m_originXCtrl;
wxStaticText* m_staticTextXpos; wxStaticText* m_originXUnits;
TEXT_CTRL_EVAL* m_STEP_Xorg; wxStaticText* m_originYLabel;
wxStaticText* m_staticTextYpos; TEXT_CTRL_EVAL* m_originYCtrl;
TEXT_CTRL_EVAL* m_STEP_Yorg; wxStaticText* m_originYUnits;
wxCheckBox* m_cbRemoveDNP; wxCheckBox* m_cbRemoveDNP;
wxCheckBox* m_cbRemoveUnspecified; wxCheckBox* m_cbRemoveUnspecified;
wxCheckBox* m_cbSubstModels; wxCheckBox* m_cbSubstModels;
@ -96,7 +96,6 @@ class DIALOG_EXPORT_STEP_BASE : public DIALOG_SHIM
virtual void onBrowseClicked( wxCommandEvent& event ) { event.Skip(); } virtual void onBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void onCbExportComponents( wxCommandEvent& event ) { event.Skip(); } virtual void onCbExportComponents( wxCommandEvent& event ) { event.Skip(); }
virtual void OnComponentModeChange( wxCommandEvent& event ) { event.Skip(); } virtual void OnComponentModeChange( wxCommandEvent& event ) { event.Skip(); }
virtual void onUpdateUnits( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onUpdateXPos( wxUpdateUIEvent& event ) { event.Skip(); } virtual void onUpdateXPos( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onUpdateYPos( wxUpdateUIEvent& event ) { event.Skip(); } virtual void onUpdateYPos( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onExportButton( wxCommandEvent& event ) { event.Skip(); } virtual void onExportButton( wxCommandEvent& event ) { event.Skip(); }

View File

@ -62,7 +62,7 @@ DIALOG_GEN_FOOTPRINT_POSITION::DIALOG_GEN_FOOTPRINT_POSITION( PCB_EDIT_FRAME* aE
{ wxID_CANCEL, _( "Close" ) } } ); { wxID_CANCEL, _( "Close" ) } } );
// DIALOG_SHIM needs a unique hash_key because classname will be the same for both job and // DIALOG_SHIM needs a unique hash_key because classname will be the same for both job and
// non-job versions (which have different sizes). // non-job versions.
m_hash_key = TO_UTF8( GetTitle() ); m_hash_key = TO_UTF8( GetTitle() );
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
@ -70,7 +70,6 @@ DIALOG_GEN_FOOTPRINT_POSITION::DIALOG_GEN_FOOTPRINT_POSITION( PCB_EDIT_FRAME* aE
} }
DIALOG_GEN_FOOTPRINT_POSITION::DIALOG_GEN_FOOTPRINT_POSITION( JOB_EXPORT_PCB_POS* aJob, DIALOG_GEN_FOOTPRINT_POSITION::DIALOG_GEN_FOOTPRINT_POSITION( JOB_EXPORT_PCB_POS* aJob,
PCB_EDIT_FRAME* aEditFrame, PCB_EDIT_FRAME* aEditFrame,
wxWindow* aParent ) : wxWindow* aParent ) :
@ -83,24 +82,13 @@ DIALOG_GEN_FOOTPRINT_POSITION::DIALOG_GEN_FOOTPRINT_POSITION( JOB_EXPORT_PCB_POS
m_browseButton->Hide(); m_browseButton->Hide();
m_units = m_job->m_units == JOB_EXPORT_PCB_POS::UNITS::INCH ? EDA_UNITS::INCH : EDA_UNITS::MM; m_units = m_job->m_units == JOB_EXPORT_PCB_POS::UNITS::INCH ? EDA_UNITS::INCH : EDA_UNITS::MM;
m_staticTextDir->SetLabel( _( "Output file:" ) ); m_staticTextDir->SetLabel( _( "Output file:" ) );
m_outputDirectoryName->SetValue( m_job->GetConfiguredOutputPath() );
m_unitsCtrl->SetSelection( static_cast<int>( m_job->m_units ) );
m_singleFile->SetValue( m_job->m_singleFile );
m_formatCtrl->SetSelection( static_cast<int>( m_job->m_format ) );
m_cbIncludeBoardEdge->SetValue( m_job->m_gerberBoardEdge );
m_useDrillPlaceOrigin->SetValue( m_job->m_useDrillPlaceFileOrigin );
m_onlySMD->SetValue( m_job->m_smdOnly );
m_negateXcb->SetValue( m_job->m_negateBottomX );
m_excludeTH->SetValue( m_job->m_excludeFootprintsWithTh );
m_excludeDNP->SetValue( m_job->m_excludeDNP );
m_messagesPanel->Hide(); m_messagesPanel->Hide();
SetupStandardButtons(); SetupStandardButtons();
// DIALOG_SHIM needs a unique hash_key because classname will be the same for both job and // DIALOG_SHIM needs a unique hash_key because classname will be the same for both job and
// non-job versions (which have different sizes). // non-job versions.
m_hash_key = TO_UTF8( GetTitle() ); m_hash_key = TO_UTF8( GetTitle() );
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
@ -108,6 +96,27 @@ DIALOG_GEN_FOOTPRINT_POSITION::DIALOG_GEN_FOOTPRINT_POSITION( JOB_EXPORT_PCB_POS
} }
bool DIALOG_GEN_FOOTPRINT_POSITION::TransferDataToWindow()
{
if( m_job )
{
m_outputDirectoryName->SetValue( m_job->GetConfiguredOutputPath() );
m_unitsCtrl->SetSelection( static_cast<int>( m_job->m_units ) );
m_singleFile->SetValue( m_job->m_singleFile );
m_formatCtrl->SetSelection( static_cast<int>( m_job->m_format ) );
m_cbIncludeBoardEdge->SetValue( m_job->m_gerberBoardEdge );
m_useDrillPlaceOrigin->SetValue( m_job->m_useDrillPlaceFileOrigin );
m_onlySMD->SetValue( m_job->m_smdOnly );
m_negateXcb->SetValue( m_job->m_negateBottomX );
m_excludeTH->SetValue( m_job->m_excludeFootprintsWithTh );
m_excludeDNP->SetValue( m_job->m_excludeDNP );
}
return true;
}
void DIALOG_GEN_FOOTPRINT_POSITION::onUpdateUIUnits( wxUpdateUIEvent& event ) void DIALOG_GEN_FOOTPRINT_POSITION::onUpdateUIUnits( wxUpdateUIEvent& event )
{ {
m_unitsLabel->Enable( m_formatCtrl->GetSelection() != 2 ); m_unitsLabel->Enable( m_formatCtrl->GetSelection() != 2 );

View File

@ -40,6 +40,8 @@ public:
DIALOG_GEN_FOOTPRINT_POSITION( JOB_EXPORT_PCB_POS* aJob, PCB_EDIT_FRAME* aEditFrame, DIALOG_GEN_FOOTPRINT_POSITION( JOB_EXPORT_PCB_POS* aJob, PCB_EDIT_FRAME* aEditFrame,
wxWindow* aParent ); wxWindow* aParent );
bool TransferDataToWindow() override;
private: private:
void onOutputDirectoryBrowseClicked( wxCommandEvent& event ) override; void onOutputDirectoryBrowseClicked( wxCommandEvent& event ) override;
void onGenerate( wxCommandEvent& event ) override; void onGenerate( wxCommandEvent& event ) override;

View File

@ -75,7 +75,7 @@ DIALOG_GENDRILL::DIALOG_GENDRILL( PCB_EDIT_FRAME* aPcbEditFrame, wxWindow* aPare
{ wxID_CANCEL, _( "Close" ) } } ); { wxID_CANCEL, _( "Close" ) } } );
// DIALOG_SHIM needs a unique hash_key because classname will be the same for both job and // DIALOG_SHIM needs a unique hash_key because classname will be the same for both job and
// non-job versions (which have different sizes). // non-job versions.
m_hash_key = TO_UTF8( GetTitle() ); m_hash_key = TO_UTF8( GetTitle() );
finishDialogSettings(); finishDialogSettings();
@ -101,43 +101,13 @@ DIALOG_GENDRILL::DIALOG_GENDRILL( PCB_EDIT_FRAME* aPcbEditFrame, JOB_EXPORT_PCB_
SetTitle( m_job->GetSettingsDialogTitle() ); SetTitle( m_job->GetSettingsDialogTitle() );
// DIALOG_SHIM needs a unique hash_key because classname will be the same for both job and // DIALOG_SHIM needs a unique hash_key because classname will be the same for both job and
// non-job versions (which have different sizes). // non-job versions.
m_hash_key = TO_UTF8( GetTitle() ); m_hash_key = TO_UTF8( GetTitle() );
finishDialogSettings(); finishDialogSettings();
} }
bool DIALOG_GENDRILL::TransferDataFromWindow()
{
if( !m_job )
{
genDrillAndMapFiles( true, m_cbGenerateMap->GetValue(), m_generateTentingLayers->GetValue() );
// Keep the window open so that the user can see the result
return false;
}
else
{
m_job->SetConfiguredOutputPath( m_outputDirectoryName->GetValue() );
m_job->m_format = m_rbExcellon->GetValue() ? JOB_EXPORT_PCB_DRILL::DRILL_FORMAT::EXCELLON
: JOB_EXPORT_PCB_DRILL::DRILL_FORMAT::GERBER;
m_job->m_drillUnits = m_units->GetSelection() == 0 ? JOB_EXPORT_PCB_DRILL::DRILL_UNITS::MM
: JOB_EXPORT_PCB_DRILL::DRILL_UNITS::INCH;
m_job->m_drillOrigin = static_cast<JOB_EXPORT_PCB_DRILL::DRILL_ORIGIN>( m_origin->GetSelection() );
m_job->m_excellonCombinePTHNPTH = m_Check_Merge_PTH_NPTH->IsChecked();
m_job->m_excellonMinimalHeader = m_Check_Minimal->IsChecked();
m_job->m_excellonMirrorY = m_Check_Mirror->IsChecked();
m_job->m_excellonOvalDrillRoute = !m_altDrillMode->GetValue();
m_job->m_mapFormat = static_cast<JOB_EXPORT_PCB_DRILL::MAP_FORMAT>( m_choiceDrillMap->GetSelection() );
m_job->m_zeroFormat = static_cast<JOB_EXPORT_PCB_DRILL::ZEROS_FORMAT>( m_zeros->GetSelection() );
m_job->m_generateMap = m_cbGenerateMap->IsChecked();
m_job->m_generateTenting = m_generateTentingLayers->IsChecked();
}
return true;
}
bool DIALOG_GENDRILL::TransferDataToWindow() bool DIALOG_GENDRILL::TransferDataToWindow()
{ {
if( !m_job ) if( !m_job )
@ -177,6 +147,36 @@ bool DIALOG_GENDRILL::TransferDataToWindow()
} }
bool DIALOG_GENDRILL::TransferDataFromWindow()
{
if( !m_job )
{
genDrillAndMapFiles( true, m_cbGenerateMap->GetValue(), m_generateTentingLayers->GetValue() );
// Keep the window open so that the user can see the result
return false;
}
else
{
m_job->SetConfiguredOutputPath( m_outputDirectoryName->GetValue() );
m_job->m_format = m_rbExcellon->GetValue() ? JOB_EXPORT_PCB_DRILL::DRILL_FORMAT::EXCELLON
: JOB_EXPORT_PCB_DRILL::DRILL_FORMAT::GERBER;
m_job->m_drillUnits = m_units->GetSelection() == 0 ? JOB_EXPORT_PCB_DRILL::DRILL_UNITS::MM
: JOB_EXPORT_PCB_DRILL::DRILL_UNITS::INCH;
m_job->m_drillOrigin = static_cast<JOB_EXPORT_PCB_DRILL::DRILL_ORIGIN>( m_origin->GetSelection() );
m_job->m_excellonCombinePTHNPTH = m_Check_Merge_PTH_NPTH->IsChecked();
m_job->m_excellonMinimalHeader = m_Check_Minimal->IsChecked();
m_job->m_excellonMirrorY = m_Check_Mirror->IsChecked();
m_job->m_excellonOvalDrillRoute = !m_altDrillMode->GetValue();
m_job->m_mapFormat = static_cast<JOB_EXPORT_PCB_DRILL::MAP_FORMAT>( m_choiceDrillMap->GetSelection() );
m_job->m_zeroFormat = static_cast<JOB_EXPORT_PCB_DRILL::ZEROS_FORMAT>( m_zeros->GetSelection() );
m_job->m_generateMap = m_cbGenerateMap->IsChecked();
m_job->m_generateTenting = m_generateTentingLayers->IsChecked();
}
return true;
}
void DIALOG_GENDRILL::onFileFormatSelection( wxCommandEvent& event ) void DIALOG_GENDRILL::onFileFormatSelection( wxCommandEvent& event )
{ {
bool enbl_Excellon = m_rbExcellon->GetValue(); bool enbl_Excellon = m_rbExcellon->GetValue();

View File

@ -110,12 +110,11 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aEditFrame )
} }
DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aEditFrame, wxWindow* aParent, DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aEditFrame, wxWindow* aParent, JOB_EXPORT_PCB_PLOT* aJob ) :
JOB_EXPORT_PCB_PLOT* aJob ) : DIALOG_PLOT_BASE( aParent ),
DIALOG_PLOT_BASE( aParent ), m_editFrame( aEditFrame ),
m_editFrame( aEditFrame ), m_trackWidthCorrection( m_editFrame, m_widthAdjustLabel, m_widthAdjustCtrl, m_widthAdjustUnits ),
m_trackWidthCorrection( m_editFrame, m_widthAdjustLabel, m_widthAdjustCtrl, m_widthAdjustUnits ), m_job( aJob )
m_job( aJob )
{ {
BOARD* board = m_editFrame->GetBoard(); BOARD* board = m_editFrame->GetBoard();
@ -146,7 +145,7 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aEditFrame, wxWindow* aParent,
} }
// DIALOG_SHIM needs a unique hash_key because classname will be the same for both job and // DIALOG_SHIM needs a unique hash_key because classname will be the same for both job and
// non-job versions (which have different sizes). // non-job versions.
m_hash_key = TO_UTF8( GetTitle() ); m_hash_key = TO_UTF8( GetTitle() );
int order = 0; int order = 0;
@ -231,7 +230,8 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aEditFrame, wxWindow* aParent,
bmiddleSizer->Insert( 1, sbSizer, 1, wxALL | wxEXPAND, 5 ); bmiddleSizer->Insert( 1, sbSizer, 1, wxALL | wxEXPAND, 5 );
init_Dialog(); m_browseButton->SetBitmap( KiBitmapBundle( BITMAPS::small_folder ) );
m_openDirButton->SetBitmap( KiBitmapBundle( BITMAPS::small_new_window ) );
if( m_job ) if( m_job )
{ {
@ -250,13 +250,11 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aEditFrame, wxWindow* aParent,
m_bpMoveUp->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_PLOT::onPlotAllListMoveUp, this ); m_bpMoveUp->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_PLOT::onPlotAllListMoveUp, this );
m_bpMoveDown->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_PLOT::onPlotAllListMoveDown, this ); m_bpMoveDown->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_PLOT::onPlotAllListMoveDown, this );
m_layerCheckListBox->Connect( wxEVT_RIGHT_DOWN, m_layerCheckListBox->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( DIALOG_PLOT::OnRightClickLayers ),
wxMouseEventHandler( DIALOG_PLOT::OnRightClickLayers ), nullptr, nullptr, this );
this );
m_plotAllLayersList->Connect( wxEVT_RIGHT_DOWN, m_plotAllLayersList->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( DIALOG_PLOT::OnRightClickAllLayers ),
wxMouseEventHandler( DIALOG_PLOT::OnRightClickAllLayers ), nullptr, nullptr, this );
this );
} }
@ -272,7 +270,7 @@ DIALOG_PLOT::~DIALOG_PLOT()
} }
void DIALOG_PLOT::init_Dialog() bool DIALOG_PLOT::TransferDataToWindow()
{ {
BOARD* board = m_editFrame->GetBoard(); BOARD* board = m_editFrame->GetBoard();
wxFileName fileName; wxFileName fileName;
@ -282,8 +280,6 @@ void DIALOG_PLOT::init_Dialog()
// Could devote a PlotOrder() function in place of UIOrder(). // Could devote a PlotOrder() function in place of UIOrder().
m_layerList = board->GetEnabledLayers().UIOrder(); m_layerList = board->GetEnabledLayers().UIOrder();
PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings();
if( !m_job && !projectFile.m_PcbLastPath[ LAST_PATH_PLOT ].IsEmpty() ) if( !m_job && !projectFile.m_PcbLastPath[ LAST_PATH_PLOT ].IsEmpty() )
m_plotOpts.SetOutputDirectory( projectFile.m_PcbLastPath[ LAST_PATH_PLOT ] ); m_plotOpts.SetOutputDirectory( projectFile.m_PcbLastPath[ LAST_PATH_PLOT ] );
@ -293,31 +289,14 @@ void DIALOG_PLOT::init_Dialog()
{ {
// When we are using a job we get the PS adjust values from the plot options // When we are using a job we get the PS adjust values from the plot options
// The exception is when this is a fresh job and we want to get the global values as defaults // The exception is when this is a fresh job and we want to get the global values as defaults
m_XScaleAdjust = m_plotOpts.GetFineScaleAdjustX(); m_fineAdjustXCtrl->SetValue( EDA_UNIT_UTILS::UI::StringFromValue( unityScale, EDA_UNITS::UNSCALED,
m_YScaleAdjust = m_plotOpts.GetFineScaleAdjustY(); m_plotOpts.GetFineScaleAdjustX() ) );
m_PSWidthAdjust = m_plotOpts.GetWidthAdjust();
}
else
{
// The default is to use the global adjusts from the pcbnew settings
m_XScaleAdjust = cfg->m_Plot.fine_scale_x;
m_YScaleAdjust = cfg->m_Plot.fine_scale_y;
// m_PSWidthAdjust is stored in mm in user config
m_PSWidthAdjust = KiROUND( cfg->m_Plot.ps_fine_width_adjust * pcbIUScale.IU_PER_MM );
}
if( m_job ) m_fineAdjustYCtrl->SetValue( EDA_UNIT_UTILS::UI::StringFromValue( unityScale, EDA_UNITS::UNSCALED,
{ m_plotOpts.GetFineScaleAdjustY() ) );
m_trackWidthCorrection.SetValue( m_plotOpts.GetWidthAdjust() );
m_zoneFillCheck->SetValue( m_job->m_checkZonesBeforePlot ); m_zoneFillCheck->SetValue( m_job->m_checkZonesBeforePlot );
} }
else
{
m_zoneFillCheck->SetValue( cfg->m_Plot.check_zones_before_plotting );
}
m_browseButton->SetBitmap( KiBitmapBundle( BITMAPS::small_folder ) );
m_openDirButton->SetBitmap( KiBitmapBundle( BITMAPS::small_new_window ) );
// The reasonable width correction value must be in a range of // The reasonable width correction value must be in a range of
// [-(MinTrackWidth-1), +(MinClearanceValue-1)] decimils. // [-(MinTrackWidth-1), +(MinClearanceValue-1)] decimils.
@ -335,25 +314,6 @@ void DIALOG_PLOT::init_Dialog()
case PLOT_FORMAT::PDF: m_plotFormatOpt->SetSelection( 4 ); break; case PLOT_FORMAT::PDF: m_plotFormatOpt->SetSelection( 4 ); break;
} }
// Test for a reasonable scale value. Set to 1 if problem
if( m_XScaleAdjust < PLOT_MIN_SCALE || m_YScaleAdjust < PLOT_MIN_SCALE
|| m_XScaleAdjust > PLOT_MAX_SCALE || m_YScaleAdjust > PLOT_MAX_SCALE )
{
m_XScaleAdjust = m_YScaleAdjust = 1.0;
}
m_fineAdjustXCtrl->SetValue( EDA_UNIT_UTILS::UI::StringFromValue(
unityScale, EDA_UNITS::UNSCALED, m_XScaleAdjust ) );
m_fineAdjustYCtrl->SetValue( EDA_UNIT_UTILS::UI::StringFromValue(
unityScale, EDA_UNITS::UNSCALED, m_YScaleAdjust ) );
// Test for a reasonable PS width correction value. Set to 0 if problem.
if( m_PSWidthAdjust < m_widthAdjustMinValue || m_PSWidthAdjust > m_widthAdjustMaxValue )
m_PSWidthAdjust = 0.;
m_trackWidthCorrection.SetValue( m_PSWidthAdjust );
m_plotPSNegativeOpt->SetValue( m_plotOpts.GetNegative() ); m_plotPSNegativeOpt->SetValue( m_plotOpts.GetNegative() );
m_forcePSA4OutputOpt->SetValue( m_plotOpts.GetA4Output() ); m_forcePSA4OutputOpt->SetValue( m_plotOpts.GetA4Output() );
@ -427,8 +387,7 @@ void DIALOG_PLOT::init_Dialog()
m_DXF_plotModeOpt->SetValue( m_plotOpts.GetDXFPlotPolygonMode() ); m_DXF_plotModeOpt->SetValue( m_plotOpts.GetDXFPlotPolygonMode() );
// DXF text mode // DXF text mode
m_DXF_plotTextStrokeFontOpt->SetValue( m_plotOpts.GetTextMode() m_DXF_plotTextStrokeFontOpt->SetValue( m_plotOpts.GetTextMode() == PLOT_TEXT_MODE::DEFAULT );
== PLOT_TEXT_MODE::DEFAULT );
// DXF units selection // DXF units selection
m_DXF_plotUnits->SetSelection( m_plotOpts.GetDXFPlotUnits() == DXF_UNITS::INCH ? 0 : 1 ); m_DXF_plotUnits->SetSelection( m_plotOpts.GetDXFPlotUnits() == DXF_UNITS::INCH ? 0 : 1 );
@ -453,6 +412,8 @@ void DIALOG_PLOT::init_Dialog()
// Update options values: // Update options values:
wxCommandEvent cmd_event; wxCommandEvent cmd_event;
SetPlotFormat( cmd_event ); SetPlotFormat( cmd_event );
return true;
} }
@ -1095,25 +1056,8 @@ void DIALOG_PLOT::applyPlotSettings()
reporter.Report( msg, RPT_SEVERITY_INFO ); reporter.Report( msg, RPT_SEVERITY_INFO );
} }
auto cfg = m_editFrame->GetPcbNewSettings();
if( m_job )
{
// When using a job we store the adjusts in the plot options
tempOptions.SetFineScaleAdjustX( m_XScaleAdjust );
tempOptions.SetFineScaleAdjustY( m_YScaleAdjust );
}
else
{
// The default is to use the pcbnew settings, so here we modify them
cfg->m_Plot.fine_scale_x = m_XScaleAdjust;
cfg->m_Plot.fine_scale_y = m_YScaleAdjust;
}
cfg->m_Plot.check_zones_before_plotting = m_zoneFillCheck->GetValue();
// PS Width correction // PS Width correction
if( !setInt( &m_PSWidthAdjust, m_trackWidthCorrection.GetValue(), m_widthAdjustMinValue, if( !setInt( &m_PSWidthAdjust, m_trackWidthCorrection.GetIntValue(), m_widthAdjustMinValue,
m_widthAdjustMaxValue ) ) m_widthAdjustMaxValue ) )
{ {
m_trackWidthCorrection.SetValue( m_PSWidthAdjust ); m_trackWidthCorrection.SetValue( m_PSWidthAdjust );
@ -1127,14 +1071,10 @@ void DIALOG_PLOT::applyPlotSettings()
if( m_job ) if( m_job )
{ {
// When using a job we store the adjusts in the plot options // When using a job we store the adjusts in the plot options
tempOptions.SetFineScaleAdjustX( m_XScaleAdjust );
tempOptions.SetFineScaleAdjustY( m_YScaleAdjust );
tempOptions.SetWidthAdjust( m_PSWidthAdjust ); tempOptions.SetWidthAdjust( m_PSWidthAdjust );
} }
else
{
// The default is to use the pcbnew settings, so here we modify them
// Store m_PSWidthAdjust in mm in user config
cfg->m_Plot.ps_fine_width_adjust = pcbIUScale.IUTomm( m_PSWidthAdjust );
}
tempOptions.SetFormat( getPlotFormat() ); tempOptions.SetFormat( getPlotFormat() );
@ -1329,8 +1269,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
} }
} }
pcbPlotter.Plot( outputDir.GetPath(), layersToPlot, commonLayers, pcbPlotter.Plot( outputDir.GetPath(), layersToPlot, commonLayers, m_useGerberExtensions->GetValue() );
m_useGerberExtensions->GetValue() );
} }
} }

View File

@ -41,13 +41,13 @@ class DIALOG_PLOT : public DIALOG_PLOT_BASE
{ {
public: public:
DIALOG_PLOT( PCB_EDIT_FRAME* aEditFrame ); DIALOG_PLOT( PCB_EDIT_FRAME* aEditFrame );
DIALOG_PLOT( PCB_EDIT_FRAME* aEditFrame, wxWindow* aParent, DIALOG_PLOT( PCB_EDIT_FRAME* aEditFrame, wxWindow* aParent, JOB_EXPORT_PCB_PLOT* aJob = nullptr );
JOB_EXPORT_PCB_PLOT* aJob = nullptr );
virtual ~DIALOG_PLOT(); virtual ~DIALOG_PLOT();
private: bool TransferDataToWindow() override;
private:
// Event called functions // Event called functions
void Plot( wxCommandEvent& event ) override; void Plot( wxCommandEvent& event ) override;
void onOutputDirectoryBrowseClicked( wxCommandEvent& event ) override; void onOutputDirectoryBrowseClicked( wxCommandEvent& event ) override;
@ -69,13 +69,11 @@ private:
void onPDFColorChoice( wxCommandEvent& event ) override; void onPDFColorChoice( wxCommandEvent& event ) override;
// other functions // other functions
void init_Dialog(); // main initialization
void reInitDialog(); // initialization after calling drill dialog void reInitDialog(); // initialization after calling drill dialog
void applyPlotSettings(); void applyPlotSettings();
PLOT_FORMAT getPlotFormat(); PLOT_FORMAT getPlotFormat();
void arrangeAllLayersList( const LSEQ& aSeq ); void arrangeAllLayersList( const LSEQ& aSeq );
void loadPlotParamsFromJob();
void transferPlotParamsToJob(); void transferPlotParamsToJob();
void updatePdfColorOptions(); void updatePdfColorOptions();

View File

@ -110,6 +110,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
gbSizer1->Add( m_plotPadNumbers, wxGBPosition( 6, 0 ), wxGBSpan( 1, 1 ), wxLEFT, 25 ); gbSizer1->Add( m_plotPadNumbers, wxGBPosition( 6, 0 ), wxGBSpan( 1, 1 ), wxLEFT, 25 );
m_zoneFillCheck = new wxCheckBox( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Check zone fills before plotting"), wxDefaultPosition, wxDefaultSize, 0 ); m_zoneFillCheck = new wxCheckBox( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Check zone fills before plotting"), wxDefaultPosition, wxDefaultSize, 0 );
m_zoneFillCheck->SetValue(true);
gbSizer1->Add( m_zoneFillCheck, wxGBPosition( 6, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 30 ); gbSizer1->Add( m_zoneFillCheck, wxGBPosition( 6, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 30 );
drillMarksLabel = new wxStaticText( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Drill marks:"), wxDefaultPosition, wxDefaultSize, 0 ); drillMarksLabel = new wxStaticText( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Drill marks:"), wxDefaultPosition, wxDefaultSize, 0 );
@ -119,7 +120,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
wxString m_drillShapeOptChoices[] = { _("None"), _("Small"), _("Actual size") }; wxString m_drillShapeOptChoices[] = { _("None"), _("Small"), _("Actual size") };
int m_drillShapeOptNChoices = sizeof( m_drillShapeOptChoices ) / sizeof( wxString ); int m_drillShapeOptNChoices = sizeof( m_drillShapeOptChoices ) / sizeof( wxString );
m_drillShapeOpt = new wxChoice( sbOptionsSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_drillShapeOptNChoices, m_drillShapeOptChoices, 0 ); m_drillShapeOpt = new wxChoice( sbOptionsSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_drillShapeOptNChoices, m_drillShapeOptChoices, 0 );
m_drillShapeOpt->SetSelection( 0 ); m_drillShapeOpt->SetSelection( 2 );
gbSizer1->Add( m_drillShapeOpt, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxEXPAND|wxLEFT, 5 ); gbSizer1->Add( m_drillShapeOpt, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxEXPAND|wxLEFT, 5 );
scalingLabel = new wxStaticText( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Scaling:"), wxDefaultPosition, wxDefaultSize, 0 ); scalingLabel = new wxStaticText( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Scaling:"), wxDefaultPosition, wxDefaultSize, 0 );

View File

@ -1113,7 +1113,7 @@
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
<property name="center_pane">0</property> <property name="center_pane">0</property>
<property name="checked">0</property> <property name="checked">1</property>
<property name="close_button">1</property> <property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
@ -1277,7 +1277,7 @@
<property name="pin_button">1</property> <property name="pin_button">1</property>
<property name="pos"></property> <property name="pos"></property>
<property name="resize">Resizable</property> <property name="resize">Resizable</property>
<property name="selection">0</property> <property name="selection">2</property>
<property name="show">1</property> <property name="show">1</property>
<property name="size"></property> <property name="size"></property>
<property name="style"></property> <property name="style"></property>

View File

@ -53,30 +53,12 @@ PCBNEW_PRINTOUT_SETTINGS::PCBNEW_PRINTOUT_SETTINGS( const PAGE_INFO& aPageInfo )
void PCBNEW_PRINTOUT_SETTINGS::Load( APP_SETTINGS_BASE* aConfig ) void PCBNEW_PRINTOUT_SETTINGS::Load( APP_SETTINGS_BASE* aConfig )
{ {
BOARD_PRINTOUT_SETTINGS::Load( aConfig ); BOARD_PRINTOUT_SETTINGS::Load( aConfig );
if( PCBNEW_SETTINGS* cfg = GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" ) )
{
m_DrillMarks = static_cast<DRILL_MARKS>( cfg->m_Plot.pads_drill_mode );
m_Pagination = static_cast<PAGINATION_T>( cfg->m_Plot.all_layers_on_one_page );
m_PrintEdgeCutsOnAllPages = cfg->m_Plot.edgecut_on_all_layers;
m_Mirror = cfg->m_Plot.mirror;
m_AsItemCheckboxes = cfg->m_Plot.as_item_checkboxes;
}
} }
void PCBNEW_PRINTOUT_SETTINGS::Save( APP_SETTINGS_BASE* aConfig ) void PCBNEW_PRINTOUT_SETTINGS::Save( APP_SETTINGS_BASE* aConfig )
{ {
BOARD_PRINTOUT_SETTINGS::Save( aConfig ); BOARD_PRINTOUT_SETTINGS::Save( aConfig );
if( PCBNEW_SETTINGS* cfg = GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" ) )
{
cfg->m_Plot.pads_drill_mode = (int)m_DrillMarks;
cfg->m_Plot.all_layers_on_one_page = m_Pagination;
cfg->m_Plot.edgecut_on_all_layers = m_PrintEdgeCutsOnAllPages;
cfg->m_Plot.mirror = m_Mirror;
cfg->m_Plot.as_item_checkboxes = m_AsItemCheckboxes;
}
} }

View File

@ -50,12 +50,9 @@ const int pcbnewSchemaVersion = 5;
PCBNEW_SETTINGS::PCBNEW_SETTINGS() PCBNEW_SETTINGS::PCBNEW_SETTINGS()
: PCB_VIEWERS_SETTINGS_BASE( "pcbnew", pcbnewSchemaVersion ), : PCB_VIEWERS_SETTINGS_BASE( "pcbnew", pcbnewSchemaVersion ),
m_AuiPanels(), m_AuiPanels(),
m_ExportIdf(),
m_ExportStep(),
m_ExportODBPP(), m_ExportODBPP(),
m_ExportVrml(), m_ExportVrml(),
m_FootprintWizardList(), m_FootprintWizardList(),
m_Plot(),
m_FootprintChooser(), m_FootprintChooser(),
m_Zones(), m_Zones(),
m_FootprintViewer(), m_FootprintViewer(),
@ -312,45 +309,6 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
m_params.emplace_back( new PARAM<int>( "export_odb.compress_format", m_params.emplace_back( new PARAM<int>( "export_odb.compress_format",
&m_ExportODBPP.compressFormat, 1 ) ); &m_ExportODBPP.compressFormat, 1 ) );
m_params.emplace_back( new PARAM<bool>( "export_idf.auto_adjust",
&m_ExportIdf.auto_adjust, false ) );
m_params.emplace_back( new PARAM<int>( "export_idf.ref_units",
&m_ExportIdf.ref_units, 0 ) );
m_params.emplace_back( new PARAM<double>( "export_idf.ref_x",
&m_ExportIdf.ref_x, 0 ) );
m_params.emplace_back( new PARAM<double>( "export_idf.ref_y",
&m_ExportIdf.ref_y, 0 ) );
m_params.emplace_back( new PARAM<bool>( "export_idf.units_mils",
&m_ExportIdf.units_mils, false ) );
m_params.emplace_back( new PARAM<int>( "export_step.origin_mode",
&m_ExportStep.origin_mode, 1 ) );
m_params.emplace_back( new PARAM<int>( "export_step.origin_units",
&m_ExportStep.origin_units, 0 ) );
m_params.emplace_back( new PARAM<double>( "export_step.origin_x",
&m_ExportStep.origin_x, 0 ) );
m_params.emplace_back( new PARAM<double>( "export_step.origin_y",
&m_ExportStep.origin_y, 0 ) );
m_params.emplace_back( new PARAM<bool>( "export_step.no_unspecified",
&m_ExportStep.no_unspecified, false ) );
m_params.emplace_back( new PARAM<bool>( "export_step.no_dnp",
&m_ExportStep.no_dnp, false ) );
m_params.emplace_back( new PARAM<bool>( "export_step.replace_models",
&m_ExportStep.replace_models, true ) );
m_params.emplace_back( new PARAM<bool>( "export_step.overwrite_file",
&m_ExportStep.overwrite_file, true ) );
m_params.emplace_back( new PARAM<int>( "export_vrml.units", m_params.emplace_back( new PARAM<int>( "export_vrml.units",
&m_ExportVrml.units, 1 ) ); &m_ExportVrml.units, 1 ) );
@ -384,30 +342,6 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
m_params.emplace_back( new PARAM<int>( "zones.net_sort_mode", m_params.emplace_back( new PARAM<int>( "zones.net_sort_mode",
&m_Zones.net_sort_mode, -1 ) ); &m_Zones.net_sort_mode, -1 ) );
m_params.emplace_back( new PARAM<bool>( "plot.edgecut_on_all_layers",
&m_Plot.edgecut_on_all_layers, true ) );
m_params.emplace_back( new PARAM<int>( "plot.pads_drill_mode",
&m_Plot.pads_drill_mode, 2 ) );
m_params.emplace_back( new PARAM<double>( "plot.fine_scale_x",
&m_Plot.fine_scale_x, 0 ) );
m_params.emplace_back( new PARAM<double>( "plot.fine_scale_y",
&m_Plot.fine_scale_y, 0 ) );
m_params.emplace_back( new PARAM<double>( "plot.ps_fine_width_adjust",
&m_Plot.ps_fine_width_adjust, 0 ) );
m_params.emplace_back( new PARAM<bool>( "plot.check_zones_before_plotting",
&m_Plot.check_zones_before_plotting, true ) );
m_params.emplace_back( new PARAM<bool>( "plot.mirror",
&m_Plot.mirror, false ) );
m_params.emplace_back( new PARAM<bool>( "plot.as_item_checkboxes",
&m_Plot.as_item_checkboxes, false ) );
m_params.emplace_back( new PARAM<wxString>( "window.footprint_text_shown_columns", m_params.emplace_back( new PARAM<wxString>( "window.footprint_text_shown_columns",
&m_FootprintTextShownColumns, "0 1 2 3 4 5 7" ) ); &m_FootprintTextShownColumns, "0 1 2 3 4 5 7" ) );
@ -578,45 +512,6 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
ret &= fromLegacy<double>( aCfg, "PlotLineWidth_mm", "plot.line_width" ); ret &= fromLegacy<double>( aCfg, "PlotLineWidth_mm", "plot.line_width" );
aCfg->SetPath( "/dialogs/cleanup_tracks" );
ret &= fromLegacy<bool>( aCfg, "DialogCleanupVias", "cleanup.cleanup_vias" );
ret &= fromLegacy<bool>( aCfg, "DialogCleanupMergeSegments", "cleanup.merge_segments" );
ret &= fromLegacy<bool>( aCfg, "DialogCleanupUnconnected", "cleanup.cleanup_unconnected" );
ret &= fromLegacy<bool>( aCfg, "DialogCleanupShortCircuit", "cleanup.cleanup_short_circuits" );
ret &= fromLegacy<bool>( aCfg, "DialogCleanupTracksInPads", "cleanup.cleanup_tracks_in_pad" );
aCfg->SetPath( "../.." );
ret &= fromLegacy<bool>( aCfg, "RefillZonesBeforeDrc", "drc_dialog.refill_zones" );
ret &= fromLegacy<bool>( aCfg, "DrcTestFootprints", "drc_dialog.test_footprints" );
ret &= fromLegacy<bool>( aCfg, "DrillMergePTHNPTH", "gen_drill.merge_pth_npth" );
ret &= fromLegacy<bool>( aCfg, "DrillMinHeader", "gen_drill.minimal_header" );
ret &= fromLegacy<bool>( aCfg, "DrillMirrorYOpt", "gen_drill.mirror" );
ret &= fromLegacy<bool>( aCfg, "DrillUnit", "gen_drill.unit_drill_is_inch" );
ret &= fromLegacy<bool>( aCfg, "OvalHolesRouteMode", "gen_drill.use_route_for_oval_holes" );
ret &= fromLegacy<int>( aCfg, "DrillFileType", "gen_drill.drill_file_type" );
ret &= fromLegacy<int>( aCfg, "DrillMapFileType", "gen_drill.map_file_type" );
ret &= fromLegacy<int>( aCfg, "DrillZerosFormat", "gen_drill.zeros_format" );
ret &= fromLegacy<bool>( aCfg, "IDFRefAutoAdj", "export_idf.auto_adjust" );
ret &= fromLegacy<int>( aCfg, "IDFRefUnits", "export_idf.ref_units" );
ret &= fromLegacy<double>( aCfg, "IDFRefX", "export_idf.ref_x" );
ret &= fromLegacy<double>( aCfg, "IDFRefY", "export_idf.ref_y" );
ret &= fromLegacy<bool>( aCfg, "IDFExportThou", "export_idf.units_mils" );
ret &= fromLegacy<int>( aCfg, "STEP_Origin_Opt", "export_step.origin_mode" );
ret &= fromLegacy<int>( aCfg, "STEP_UserOriginUnits", "export_step.origin_units" );
ret &= fromLegacy<double>( aCfg, "STEP_UserOriginX", "export_step.origin_x" );
ret &= fromLegacy<double>( aCfg, "STEP_UserOriginY", "export_step.origin_y" );
ret &= fromLegacy<bool>( aCfg, "STEP_NoVirtual", "export_step.no_virtual" );
ret &= fromLegacy<bool>( aCfg, "PlotSVGModeColor", "export_svg.black_and_white" );
ret &= fromLegacy<bool>( aCfg, "PlotSVGModeMirror", "export_svg.mirror" );
ret &= fromLegacy<bool>( aCfg, "PlotSVGModeOneFile", "export_svg.one_file" );
ret &= fromLegacy<bool>( aCfg, "PlotSVGBrdEdge", "export_svg.plot_board_edges" );
ret &= fromLegacy<int>( aCfg, "PlotSVGPageOpt", "export_svg.page_size" );
ret &= fromLegacyString( aCfg, "PlotSVGDirectory", "export_svg.output_dir" );
{ {
nlohmann::json js = nlohmann::json::array(); nlohmann::json js = nlohmann::json::array();
wxString key; wxString key;
@ -667,14 +562,6 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
// //
// NOTE: there's no value in line-wrapping these; it just makes the table unreadable. // NOTE: there's no value in line-wrapping these; it just makes the table unreadable.
// //
ret &= fromLegacy<int>( aCfg, "VrmlExportUnit", "export_vrml.units" );
ret &= fromLegacy<bool>( aCfg, "VrmlExportCopyFiles", "export_vrml.copy_3d_models" );
ret &= fromLegacy<bool>( aCfg, "VrmlUseRelativePaths", "export_vrml.use_relative_paths" );
ret &= fromLegacy<int>( aCfg, "VrmlRefUnits", "export_vrml.ref_units" );
ret &= fromLegacy<double>( aCfg, "VrmlRefX", "export_vrml.ref_x" );
ret &= fromLegacy<double>( aCfg, "VrmlRefY", "export_vrml.ref_y" );
ret &= fromLegacy<int> ( aCfg, "VrmlOriginMode", "export_vrml.origin_mode" );
ret &= fromLegacy<int>( aCfg, "Zone_Ouline_Hatch_Opt", "zones.hatching_style" ); ret &= fromLegacy<int>( aCfg, "Zone_Ouline_Hatch_Opt", "zones.hatching_style" );
ret &= fromLegacy<int>( aCfg, "Zone_NetSort_Opt", "zones.net_sort_mode" ); ret &= fromLegacy<int>( aCfg, "Zone_NetSort_Opt", "zones.net_sort_mode" );
ret &= fromLegacy<double>( aCfg, "Zone_Clearance", "zones.clearance" ); ret &= fromLegacy<double>( aCfg, "Zone_Clearance", "zones.clearance" );
@ -682,27 +569,6 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
ret &= fromLegacy<double>( aCfg, "Zone_TH_Gap", "zones.thermal_relief_gap" ); ret &= fromLegacy<double>( aCfg, "Zone_TH_Gap", "zones.thermal_relief_gap" );
ret &= fromLegacy<double>( aCfg, "Zone_TH_Copper_Width", "zones.thermal_relief_copper_width" ); ret &= fromLegacy<double>( aCfg, "Zone_TH_Copper_Width", "zones.thermal_relief_copper_width" );
aCfg->SetPath( "ImportGraphics" );
ret &= fromLegacy<int>( aCfg, "BoardLayer", "import_graphics.layer" );
ret &= fromLegacy<bool>( aCfg, "InteractivePlacement", "import_graphics.interactive_placement" );
ret &= fromLegacyString( aCfg, "LastFile", "import_graphics.last_file" );
ret &= fromLegacy<double>( aCfg, "LineWidth", "import_graphics.line_width" );
ret &= fromLegacy<int>( aCfg, "LineWidthUnits", "import_graphics.line_width_units" );
ret &= fromLegacy<int>( aCfg, "PositionUnits", "import_graphics.origin_units" );
ret &= fromLegacy<double>( aCfg, "PositionX", "import_graphics.origin_x" );
ret &= fromLegacy<double>( aCfg, "PositionY", "import_graphics.origin_y" );
aCfg->SetPath( ".." );
ret &= fromLegacy<int>( aCfg, "NetlistReportFilterMsg", "netlist.report_filter" );
ret &= fromLegacy<bool>( aCfg, "NetlistUpdateFootprints", "netlist.update_footprints" );
ret &= fromLegacy<bool>( aCfg, "NetlistDeleteShortingTracks", "netlist.delete_shorting_tracks" );
ret &= fromLegacy<bool>( aCfg, "NetlistDeleteExtraFootprints", "netlist.delete_extra_footprints" );
ret &= fromLegacy<int>( aCfg, "PlaceFileUnits", "place_file.units" );
ret &= fromLegacy<int>( aCfg, "PlaceFileOpts", "place_file.file_options" );
ret &= fromLegacy<int>( aCfg, "PlaceFileFormat", "place_file.file_format" );
ret &= fromLegacy<bool>( aCfg, "PlaceFileIncludeBrdEdge", "place_file.include_board_edge" );
ret &= fromLegacy<int>( aCfg, "PrintSinglePage", "plot.all_layers_on_one_page" ); ret &= fromLegacy<int>( aCfg, "PrintSinglePage", "plot.all_layers_on_one_page" );
ret &= fromLegacy<int>( aCfg, "PrintPadsDrillOpt", "plot.pads_drill_mode" ); ret &= fromLegacy<int>( aCfg, "PrintPadsDrillOpt", "plot.pads_drill_mode" );
ret &= fromLegacy<double>( aCfg, "PlotXFineScaleAdj", "plot.fine_scale_x" ); ret &= fromLegacy<double>( aCfg, "PlotXFineScaleAdj", "plot.fine_scale_x" );

View File

@ -163,29 +163,6 @@ public:
int design_blocks_panel_float_height; int design_blocks_panel_float_height;
}; };
struct DIALOG_EXPORT_IDF
{
bool auto_adjust;
int ref_units;
double ref_x;
double ref_y;
bool units_mils;
bool no_unspecified;
bool no_dnp;
};
struct DIALOG_EXPORT_STEP
{
int origin_mode;
int origin_units;
double origin_x;
double origin_y;
bool no_unspecified;
bool no_dnp;
bool replace_models;
bool overwrite_file;
};
struct DIALOG_EXPORT_2581 struct DIALOG_EXPORT_2581
{ {
int precision; int precision;
@ -225,19 +202,6 @@ public:
int height; int height;
}; };
struct DIALOG_PLOT
{
int all_layers_on_one_page;
bool edgecut_on_all_layers;
int pads_drill_mode;
double fine_scale_x;
double fine_scale_y;
double ps_fine_width_adjust;
bool check_zones_before_plotting;
bool mirror;
bool as_item_checkboxes;
};
struct FOOTPRINT_CHOOSER struct FOOTPRINT_CHOOSER
{ {
int width; int width;
@ -297,10 +261,6 @@ public:
AUI_PANELS m_AuiPanels; AUI_PANELS m_AuiPanels;
DIALOG_EXPORT_IDF m_ExportIdf;
DIALOG_EXPORT_STEP m_ExportStep;
DIALOG_EXPORT_2581 m_Export2581; DIALOG_EXPORT_2581 m_Export2581;
DIALOG_EXPORT_ODBPP m_ExportODBPP; DIALOG_EXPORT_ODBPP m_ExportODBPP;
@ -311,8 +271,6 @@ public:
DIALOG_FOOTPRINT_WIZARD_LIST m_FootprintWizardList; DIALOG_FOOTPRINT_WIZARD_LIST m_FootprintWizardList;
DIALOG_PLOT m_Plot;
FOOTPRINT_CHOOSER m_FootprintChooser; FOOTPRINT_CHOOSER m_FootprintChooser;
ZONES m_Zones; ZONES m_Zones;