diff --git a/pcbnew/dialogs/dialog_cleanup_tracks_and_vias_base.fbp b/pcbnew/dialogs/dialog_cleanup_tracks_and_vias_base.fbp index 15a3649c55..f1392707fd 100644 --- a/pcbnew/dialogs/dialog_cleanup_tracks_and_vias_base.fbp +++ b/pcbnew/dialogs/dialog_cleanup_tracks_and_vias_base.fbp @@ -1,34 +1,36 @@ - + - ; C++ - 1 - source_name - 0 - 0 + ; + 1 + connect + none + + + 0 + 0 res UTF-8 - connect dialog_cleanup_tracks_and_vias_base 1000 - none - - 1 + 1 + UI dialog_cleanup_tracks_and_vias - . - + 0 + source_name + 1 + 0 + source_name + + + 1 1 - 1 - 1 - 1 - UI - 0 - 0 0 + 0 0 wxAUI_MGR_DEFAULT @@ -102,7 +104,7 @@ 1 0 - 0 + 1 1 1 @@ -177,7 +179,7 @@ 1 0 - 0 + 1 1 1 @@ -253,7 +255,7 @@ 1 0 - 0 + 1 1 1 @@ -319,7 +321,7 @@ 1 0 - 0 + 1 1 1 @@ -395,7 +397,7 @@ 1 0 - 0 + 1 1 1 @@ -461,7 +463,7 @@ 1 0 - 0 + 1 1 1 @@ -614,10 +616,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -680,10 +682,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -743,10 +745,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -809,10 +811,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -895,10 +897,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -961,10 +963,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1060,10 +1062,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1149,10 +1151,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1204,10 +1206,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1359,10 +1361,10 @@ 1 1 1 - + 0 - - + 0 + 0 diff --git a/pcbnew/dialogs/dialog_export_idf.cpp b/pcbnew/dialogs/dialog_export_idf.cpp index ec68087eaf..bba39f6e93 100644 --- a/pcbnew/dialogs/dialog_export_idf.cpp +++ b/pcbnew/dialogs/dialog_export_idf.cpp @@ -34,51 +34,12 @@ DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3( PCB_EDIT_FRAME* aEditFrame ) : DIALOG_EXPORT_IDF3_BASE( aEditFrame ), - m_idfThouOpt( false ), - m_AutoAdjust( false ), - m_RefUnits( 0 ), - m_XRef( 0.0 ), - m_YRef( 0.0 ), - m_editFrame( aEditFrame ) + m_xPos( aEditFrame, m_xLabel, m_IDF_Xref, m_xUnits ), + m_yPos( aEditFrame, m_yLabel, m_IDF_Yref, m_yUnits ) { SetFocus(); - if( PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings() ) - { - 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 ); - } + m_cbSetBoardReferencePoint->Bind( wxEVT_CHECKBOX, &DIALOG_EXPORT_IDF3::OnBoardReferencePointChecked, this ); 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() ) - { - 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(); - } + event.Skip(); } -void DIALOG_EXPORT_IDF3::OnAutoAdjustOffset( wxCommandEvent& event ) +bool DIALOG_EXPORT_IDF3::TransferDataToWindow() { - if( GetAutoAdjustOffset() ) - { - 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 ); - } + wxCommandEvent dummy; + OnBoardReferencePointChecked( dummy ); - event.Skip(); + return true; } @@ -130,8 +72,8 @@ bool DIALOG_EXPORT_IDF3::TransferDataFromWindow() if( fn.FileExists() ) { - wxString msg = wxString::Format( _( "File %s already exists." ), fn.GetPath() ); - KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING ); + KIDIALOG dlg( this, wxString::Format( _( "File %s already exists." ), fn.GetPath() ), + _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING ); dlg.SetOKLabel( _( "Overwrite" ) ); dlg.DoNotShowCheckbox( __FILE__, __LINE__ ); @@ -162,11 +104,10 @@ int BOARD_EDITOR_CONTROL::ExportIDF( const TOOL_EVENT& aEvent ) if ( dlg.ShowModal() != wxID_OK ) return 0; - bool thou = dlg.GetThouOption(); double aXRef; double aYRef; - if( dlg.GetAutoAdjustOffset() ) + if( dlg.GetSetBoardReferencePoint() ) { BOX2I bbox = board->GetBoardEdgesBoundingBox(); aXRef = bbox.Centre().x * pcbIUScale.MM_PER_IU; @@ -174,24 +115,17 @@ int BOARD_EDITOR_CONTROL::ExportIDF( const TOOL_EVENT& aEvent ) } else { - aXRef = dlg.GetXRef(); - aYRef = dlg.GetYRef(); - - if( dlg.GetRefUnitsChoice() == 1 ) - { - // selected reference unit is in inches - aXRef *= 25.4; - aYRef *= 25.4; - } + aXRef = dlg.GetXRefMM(); + aYRef = dlg.GetYRefMM(); } - wxBusyCursor dummy; - wxString fullFilename = dlg.FilePicker()->GetPath(); m_frame->SetLastPath( LAST_PATH_IDF, fullFilename ); - if( !m_frame->Export_IDF3( board, fullFilename, thou, aXRef, aYRef, !dlg.GetNoUnspecifiedOption(), - !dlg.GetNoDNPOption() ) ) + wxBusyCursor dummy; + + if( !m_frame->Export_IDF3( board, fullFilename, dlg.GetThouOption(), aXRef, aYRef, + !dlg.GetNoUnspecifiedOption(), !dlg.GetNoDNPOption() ) ) { wxMessageBox( wxString::Format( _( "Failed to create file '%s'." ), fullFilename ) ); } diff --git a/pcbnew/dialogs/dialog_export_idf.h b/pcbnew/dialogs/dialog_export_idf.h index a6edfaf0eb..b0bff8c92d 100644 --- a/pcbnew/dialogs/dialog_export_idf.h +++ b/pcbnew/dialogs/dialog_export_idf.h @@ -25,42 +25,32 @@ #pragma once #include +#include class PCB_EDIT_FRAME; 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: DIALOG_EXPORT_IDF3( PCB_EDIT_FRAME* aEditFrame ); - - ~DIALOG_EXPORT_IDF3(); - - bool GetThouOption() { return m_rbUnitSelection->GetSelection() == 1; } + ~DIALOG_EXPORT_IDF3() = default; wxFilePickerCtrl* FilePicker() { return m_filePickerIDF; } - int GetRefUnitsChoice() { return m_IDF_RefUnitChoice->GetSelection(); } - - double GetXRef() { return EDA_UNIT_UTILS::UI::DoubleValueFromString( m_IDF_Xref->GetValue() ); } - - double GetYRef() { return EDA_UNIT_UTILS::UI::DoubleValueFromString( m_IDF_Yref->GetValue() ); } + bool GetSetBoardReferencePoint() { return m_cbSetBoardReferencePoint->GetValue(); } + double GetXRefMM() { return pcbIUScale.IUTomm( m_xPos.GetIntValue() ); } + double GetYRefMM() { return pcbIUScale.IUTomm( m_yPos.GetIntValue() ); } + bool GetThouOption() { return m_outputUnitsChoice->GetSelection() == 1; } bool GetNoUnspecifiedOption() { return m_cbRemoveUnspecified->GetValue(); } - bool GetNoDNPOption() { return m_cbRemoveDNP->GetValue(); } - bool GetAutoAdjustOffset() { return m_cbAutoAdjustOffset->GetValue(); } - - void OnAutoAdjustOffset( wxCommandEvent& event ); + void OnBoardReferencePointChecked( wxCommandEvent& event ); + bool TransferDataToWindow() override; bool TransferDataFromWindow() override; + +private: + UNIT_BINDER m_xPos; + UNIT_BINDER m_yPos; }; \ No newline at end of file diff --git a/pcbnew/dialogs/dialog_export_idf_base.cpp b/pcbnew/dialogs/dialog_export_idf_base.cpp index 8cea211cb3..9222d30c85 100644 --- a/pcbnew/dialogs/dialog_export_idf_base.cpp +++ b/pcbnew/dialogs/dialog_export_idf_base.cpp @@ -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/ // // 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->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 ); - bSizerIDFFile->Add( m_filePickerIDF, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bSizerIDFFile->Add( m_filePickerIDF, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 ); - wxBoxSizer* bSizer2; - bSizer2 = new wxBoxSizer( wxHORIZONTAL ); + wxGridBagSizer* gbSizer1; + gbSizer1 = new wxGridBagSizer( 2, 3 ); + gbSizer1->SetFlexibleDirection( wxBOTH ); + gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - wxBoxSizer* bSizer3; - bSizer3 = new wxBoxSizer( wxVERTICAL ); + m_cbSetBoardReferencePoint = new wxCheckBox( this, wxID_ANY, _("Set board reference point:"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); + 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_staticText2->Wrap( -1 ); - bSizer3->Add( m_staticText2, 0, wxALL, 5 ); - - 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_xLabel = new wxStaticText( this, wxID_ANY, _("X position:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_xLabel->Wrap( -1 ); + gbSizer1->Add( m_xLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 23 ); m_IDF_Xref = new TEXT_CTRL_EVAL( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 ); #ifdef __WXGTK__ @@ -70,17 +46,15 @@ DIALOG_EXPORT_IDF3_BASE::DIALOG_EXPORT_IDF3_BASE( wxWindow* parent, wxWindowID i #else m_IDF_Xref->SetMaxLength( 8 ); #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 ); - - wxBoxSizer* bSizer5; - 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_yLabel = new wxStaticText( this, wxID_ANY, _("Y position:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_yLabel->Wrap( -1 ); + gbSizer1->Add( m_yLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 23 ); m_IDF_Yref = new TEXT_CTRL_EVAL( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 ); #ifdef __WXGTK__ @@ -91,34 +65,30 @@ DIALOG_EXPORT_IDF3_BASE::DIALOG_EXPORT_IDF3_BASE( wxWindow* parent, wxWindowID i #else m_IDF_Yref->SetMaxLength( 8 ); #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 ); - - - 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 ); + bSizerIDFFile->Add( gbSizer1, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 ); m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizerOK = new wxButton( this, wxID_OK ); diff --git a/pcbnew/dialogs/dialog_export_idf_base.fbp b/pcbnew/dialogs/dialog_export_idf_base.fbp index 20eb9563fc..221dc3415e 100644 --- a/pcbnew/dialogs/dialog_export_idf_base.fbp +++ b/pcbnew/dialogs/dialog_export_idf_base.fbp @@ -1,34 +1,36 @@ - + - C++ - 1 - source_name - 0 - 0 + + 1 + connect + none + + + 0 + 1 res UTF-8 - connect dialog_export_idf_base 1000 - none - - 1 + 1 + UI dialog_export_idf3_base - . - + 0 + source_name + 1 + 0 + source_name + + + 1 1 - 1 - 1 - 1 - UI - 0 - 1 0 + 0 0 wxAUI_MGR_DEFAULT @@ -63,18 +65,18 @@ wxVERTICAL none - 5 - wxBOTTOM|wxLEFT|wxRIGHT|wxTOP + 10 + wxTOP|wxRIGHT|wxLEFT 0 1 1 1 1 - + 0 - - + 0 + 0 @@ -125,7 +127,7 @@ - 5 + 10 wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 0 @@ -133,10 +135,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -191,579 +193,565 @@ - 5 - wxEXPAND + 10 + wxEXPAND|wxRIGHT|wxLEFT 1 - + + + wxBOTH + + + 3 - bSizer2 - wxHORIZONTAL + gbSizer1 + wxFLEX_GROWMODE_SPECIFIED none - + 2 + 5 - wxEXPAND|wxLEFT - 1 - - - bSizer3 - wxVERTICAL - none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - Grid reference point: - 0 - - 0 - - - 0 - - 1 - m_staticText2 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - Adjust automatically - - 0 - - - 0 - - 1 - m_cbAutoAdjustOffset - 1 - - - protected - 1 - - Resizable - 1 - - wxCHK_2STATE - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxEXPAND - 1 - - - bSizer6 - wxHORIZONTAL - none - - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - Units: - 0 - - 0 - - - 0 - - 1 - m_staticText5 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "mm" "inch" - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_IDF_RefUnitChoice - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - 5 - wxEXPAND - 1 - - - bSizer4 - wxHORIZONTAL - none - - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - X position: - 0 - - 0 - - - 0 - - 1 - m_staticText3 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 8 - - 0 - - 1 - m_IDF_Xref - 1 - - - protected - 1 - - Resizable - 1 - - - TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h - 0 - - - wxFILTER_NUMERIC - wxTextValidator - - 0 - - - - - - - - - 5 - wxEXPAND - 1 - - - bSizer5 - wxHORIZONTAL - none - - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - Y position: - 0 - - 0 - - - 0 - - 1 - m_staticText4 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 8 - - 0 - - 1 - m_IDF_Yref - 1 - - - protected - 1 - - Resizable - 1 - - - TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h - 0 - - - wxFILTER_NUMERIC - wxTextValidator - - 0 - - - - - - - - - - - 5 - wxALL - 0 - + 3 + 0 + + 0 + 1 + 1 1 1 1 - + 0 - - + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Set board reference point: + + 0 + + + 0 + + 1 + m_cbSetBoardReferencePoint + 1 + + + protected + 1 + + Resizable + 1 + + wxCHK_2STATE + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 23 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxLEFT + 1 + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + X position: + 0 + + 0 + + + 0 + + 1 + m_xLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + 1 + 1 + wxALIGN_CENTER_VERTICAL|wxLEFT + 1 + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 8 + + 0 + + 1 + m_IDF_Xref + 1 + + + protected + 1 + + Resizable + 1 + + + TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h + 0 + + + wxFILTER_NUMERIC + wxTextValidator + + 0 + + + + + + + 5 + 1 + 2 + wxALIGN_CENTER_VERTICAL + 1 + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + units + 0 + + 0 + + + 0 + + 1 + m_xUnits + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 23 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxLEFT + 2 + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Y position: + 0 + + 0 + + + 0 + + 1 + m_yLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + 1 + 1 + wxALIGN_CENTER_VERTICAL|wxLEFT + 2 + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 8 + + 0 + + 1 + m_IDF_Yref + 1 + + + protected + 1 + + Resizable + 1 + + + TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h + 0 + + + wxFILTER_NUMERIC + wxTextValidator + + 0 + + + + + + + 5 + 1 + 2 + wxALIGN_CENTER_VERTICAL + 2 + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + units + 0 + + 0 + + + 0 + + 1 + m_yUnits + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 8 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM + 3 + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Output units: + 0 + + 0 + + + 0 + + 1 + m_outputUnitsLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + 2 + 1 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 3 + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 @@ -785,8 +773,6 @@ 0 0 wxID_ANY - Output Units - 1 0 @@ -794,7 +780,7 @@ 0 1 - m_rbUnitSelection + m_outputUnitsChoice 1 @@ -805,8 +791,8 @@ 0 1 - wxRA_SPECIFY_COLS - + + ; ; forward_declare 0 @@ -818,148 +804,140 @@ - - 10 - wxEXPAND|wxLEFT|wxRIGHT - 1 - + + 5 + 3 + 0 + wxBOTTOM + 4 + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 wxID_ANY - Other Options + Ignore 'Do not populate' components + + 0 + + + 0 - sbOtherOptions - wxVERTICAL - 1 - none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - Ignore 'Do not populate' components - - 0 - - - 0 - - 1 - m_cbRemoveDNP - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - Ignore 'Unspecified' components - - 0 - - - 0 - - 1 - m_cbRemoveUnspecified - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - + 1 + m_cbRemoveDNP + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + 3 + 0 + + 5 + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Ignore 'Unspecified' components + + 0 + + + 0 + + 1 + m_cbRemoveUnspecified + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + diff --git a/pcbnew/dialogs/dialog_export_idf_base.h b/pcbnew/dialogs/dialog_export_idf_base.h index 6192c29d4c..24281ec355 100644 --- a/pcbnew/dialogs/dialog_export_idf_base.h +++ b/pcbnew/dialogs/dialog_export_idf_base.h @@ -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/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -21,12 +21,11 @@ class TEXT_CTRL_EVAL; #include #include #include -#include -#include #include #include -#include -#include +#include +#include +#include #include #include @@ -42,15 +41,15 @@ class DIALOG_EXPORT_IDF3_BASE : public DIALOG_SHIM protected: wxStaticText* m_txtBrdFile; wxFilePickerCtrl* m_filePickerIDF; - wxStaticText* m_staticText2; - wxCheckBox* m_cbAutoAdjustOffset; - wxStaticText* m_staticText5; - wxChoice* m_IDF_RefUnitChoice; - wxStaticText* m_staticText3; + wxCheckBox* m_cbSetBoardReferencePoint; + wxStaticText* m_xLabel; TEXT_CTRL_EVAL* m_IDF_Xref; - wxStaticText* m_staticText4; + wxStaticText* m_xUnits; + wxStaticText* m_yLabel; TEXT_CTRL_EVAL* m_IDF_Yref; - wxRadioBox* m_rbUnitSelection; + wxStaticText* m_yUnits; + wxStaticText* m_outputUnitsLabel; + wxChoice* m_outputUnitsChoice; wxCheckBox* m_cbRemoveDNP; wxCheckBox* m_cbRemoveUnspecified; wxStdDialogButtonSizer* m_sdbSizer; diff --git a/pcbnew/dialogs/dialog_export_step.cpp b/pcbnew/dialogs/dialog_export_step.cpp index 6da0e64649..261e0ad8d8 100644 --- a/pcbnew/dialogs/dialog_export_step.cpp +++ b/pcbnew/dialogs/dialog_export_step.cpp @@ -40,7 +40,6 @@ #include #include #include -#include #include #include // LAST_PATH_TYPE #include @@ -73,24 +72,6 @@ static const std::map c_formatExtToChoice = { { FILEEXT::StepFile { 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( aEditFrame, aEditFrame, aBoardPath ) { @@ -103,9 +84,8 @@ DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aEditFrame, wxWindow* aP DIALOG_EXPORT_STEP_BASE( aEditFrame ), m_editFrame( aEditFrame ), m_job( aJob ), - m_userOriginX( 0.0 ), - m_userOriginY( 0.0 ), - m_originUnits( 0 /* mm */ ), + m_originX( aEditFrame, m_originXLabel, m_originXCtrl, m_originXUnits ), + m_originY( aEditFrame, m_originYLabel, m_originYCtrl, m_originYUnits ), m_boardPath( aBoardPath ) { if( !m_job ) @@ -114,7 +94,6 @@ DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aEditFrame, wxWindow* aP SetupStandardButtons( { { wxID_OK, _( "Export" ) }, { wxID_CANCEL, _( "Close" ) } } ); - // Build default output file name // (last saved filename in project or built from board filename) 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 - // non-job versions (which have different sizes). + // non-job versions. m_hash_key = TO_UTF8( GetTitle() ); Layout(); @@ -145,127 +124,6 @@ DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aEditFrame, wxWindow* aP SetFocus(); - if( !m_job ) - { - if( PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings() ) - { - m_origin = static_cast( 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; 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; } - if( m_toleranceLastChoice >= 0 ) - 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(); + OnFmtChoiceOptionChanged(); // Now all widgets have the size fixed, call FinishDialogSettings finishDialogSettings(); } -DIALOG_EXPORT_STEP::~DIALOG_EXPORT_STEP() +bool DIALOG_EXPORT_STEP::TransferDataToWindow() { - GetOriginOption(); // Update m_origin member. - - if( !m_job ) // dont save mru if its a job dialog + if( m_job ) { - if( PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings() ) - { - cfg->m_ExportStep.origin_mode = static_cast( 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(); + m_rbBoardCenterOrigin->SetValue( true ); // Default - 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 ); - cfg->m_ExportStep.origin_x = val; + m_originX.SetValue( pcbIUScale.mmToIU( m_job->m_3dparams.m_Origin.x ) ); + m_originY.SetValue( pcbIUScale.mmToIU( m_job->m_3dparams.m_Origin.y ) ); - m_STEP_Yorg->GetValue().ToDouble( &val ); - cfg->m_ExportStep.origin_y = val; + 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 ); - cfg->m_ExportStep.no_unspecified = m_cbRemoveUnspecified->GetValue(); - cfg->m_ExportStep.no_dnp = m_cbRemoveDNP->GetValue(); - } - - 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; + 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_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() -{ - 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; + return true; } @@ -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 ) { aEvent.Enable( m_rbUserDefinedOrigin->GetValue() ); @@ -466,8 +296,7 @@ void DIALOG_EXPORT_STEP::onBrowseClicked( wxCommandEvent& aEvent ) wxString path = ExpandEnvVarSubstitutions( m_outputFileName->GetValue(), &Prj() ); wxFileName fn( Prj().AbsolutePath( path ) ); - wxFileDialog dlg( this, _( "3D Model Output File" ), fn.GetPath(), fn.GetFullName(), filter, - wxFD_SAVE ); + wxFileDialog dlg( this, _( "3D Model Output File" ), fn.GetPath(), fn.GetFullName(), filter, wxFD_SAVE ); if( dlg.ShowModal() == wxID_CANCEL ) return; @@ -557,31 +386,6 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent ) 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; wxString msg; @@ -603,7 +407,7 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent ) 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?" ), fn.GetFullPath() ); @@ -644,49 +448,49 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent ) cmdK2S.Append( wxT( " " ) ); cmdK2S.Append( c_formatCommand[m_choiceFormat->GetSelection()] ); - if( GetNoUnspecifiedOption() ) + if( m_cbRemoveUnspecified->GetValue() ) cmdK2S.Append( wxT( " --no-unspecified" ) ); - if( GetNoDNPOption() ) + if( m_cbRemoveDNP->GetValue() ) cmdK2S.Append( wxT( " --no-dnp" ) ); - if( GetSubstOption() ) + if( m_cbSubstModels->GetValue() ) cmdK2S.Append( wxT( " --subst-models" ) ); - if( !m_optimizeStep ) + if( !m_cbOptimizeStep->GetValue() ) cmdK2S.Append( wxT( " --no-optimize-step" ) ); - if( !m_exportBoardBody ) + if( !m_cbExportBody->GetValue() ) cmdK2S.Append( wxT( " --no-board-body" ) ); - if( !m_exportComponents ) + if( !m_cbExportComponents->GetValue() ) cmdK2S.Append( wxT( " --no-components" ) ); - if( m_exportTracks ) + if( m_cbExportTracks->GetValue() ) cmdK2S.Append( wxT( " --include-tracks" ) ); - if( m_exportPads ) + if( m_cbExportPads->GetValue() ) cmdK2S.Append( wxT( " --include-pads" ) ); - if( m_exportZones ) + if( m_cbExportZones->GetValue() ) cmdK2S.Append( wxT( " --include-zones" ) ); - if( m_exportInnerCopper ) + if( m_cbExportInnerCopper->GetValue() ) cmdK2S.Append( wxT( " --include-inner-copper" ) ); - if( m_exportSilkscreen ) + if( m_cbExportSilkscreen->GetValue() ) cmdK2S.Append( wxT( " --include-silkscreen" ) ); - if( m_exportSoldermask ) + if( m_cbExportSoldermask->GetValue() ) cmdK2S.Append( wxT( " --include-soldermask" ) ); - if( m_fuseShapes ) + if( m_cbFuseShapes->GetValue() ) cmdK2S.Append( wxT( " --fuse-shapes" ) ); - if( m_cutViasInBody ) + if( m_cbCutViasInBody->GetValue() ) cmdK2S.Append( wxT( " --cut-vias-in-body" ) ); - if( m_fillAllVias ) + if( m_cbFillAllVias->GetValue() ) cmdK2S.Append( wxT( " --fill-all-vias" ) ); // 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 dblquote = '"'; - if( !m_netFilter.empty() ) + if( !m_txtNetFilter->GetValue().empty() ) { cmdK2S.Append( wxString::Format( wxT( " --net-filter %c%s%c" ), - dblquote, m_netFilter, dblquote ) ); + dblquote, m_txtNetFilter->GetValue(), dblquote ) ); } - switch( m_componentMode ) - { - case COMPONENT_MODE::EXPORT_SELECTED: + if( m_rbOnlySelected->GetValue() ) { wxArrayString components; 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" ), dblquote, wxJoin( components, ',' ), dblquote ) ); - break; } - - case COMPONENT_MODE::CUSTOM_FILTER: + else if( m_rbFilteredComponents->GetValue() ) + { cmdK2S.Append( wxString::Format( wxT( " --component-filter %c%s%c" ), - dblquote, m_componentFilter, dblquote ) ); - break; - - default: - break; + dblquote, m_txtComponentFilter->GetValue(), dblquote ) ); } - 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" ) ); - break; - - case STEP_ORIGIN_GRID_AXIS: - cmdK2S.Append( wxT( " --grid-origin" ) ); - break; - - case STEP_ORIGIN_USER: + } + else if( m_rbGridOrigin->GetValue() ) { - double xOrg = GetXOrg(); - double yOrg = GetYOrg(); - - if( GetOrgUnitsChoice() == 1 ) - { - // selected reference unit is in inches, and STEP units are mm - xOrg *= 25.4; - yOrg *= 25.4; - } + cmdK2S.Append( wxT( " --grid-origin" ) ); + } + else if( m_rbUserDefinedOrigin->GetValue() ) + { + double xOrg = pcbIUScale.IUTomm( m_originX.GetIntValue() ); + double yOrg = pcbIUScale.IUTomm( m_originY.GetIntValue() ); LOCALE_IO dummy; cmdK2S.Append( wxString::Format( wxT( " --user-origin=%c%.6fx%.6fmm%c" ), quote, xOrg, yOrg, quote ) ); - break; } - - case STEP_ORIGIN_BOARD_CENTER: + else if( m_rbBoardCenterOrigin->GetValue() ) { BOX2I bbox = m_editFrame->GetBoard()->ComputeBoundingBox( true ); 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" ), 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 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::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::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::STL: m_job->m_format = JOB_EXPORT_PCB_3D::FORMAT::STL; 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::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::STL: m_job->m_format = JOB_EXPORT_PCB_3D::FORMAT::STL; break; } 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_UsePcbCenterOrigin = false; - switch( GetOriginOption() ) + if( m_rbDrillAndPlotOrigin->GetValue() ) { - case STEP_ORIGIN_0: - break; - case STEP_ORIGIN_PLOT_AXIS: - m_job->m_3dparams.m_UseDrillOrigin = true; - break; - case STEP_ORIGIN_GRID_AXIS: - m_job->m_3dparams.m_UseGridOrigin = true; - break; - case STEP_ORIGIN_USER: - { - double xOrg = GetXOrg(); - double yOrg = GetYOrg(); + m_job->m_3dparams.m_UseDrillOrigin = true; + } + else if( m_rbGridOrigin->GetValue() ) + { + m_job->m_3dparams.m_UseGridOrigin = true; + } + else if( m_rbUserDefinedOrigin->GetValue() ) + { + double xOrg = pcbIUScale.IUTomm( m_originX.GetIntValue() ); + double yOrg = pcbIUScale.IUTomm( m_originY.GetIntValue() ); - if( GetOrgUnitsChoice() == 1 ) - { - // selected reference unit is in inches, and STEP units are mm - xOrg *= 25.4; - yOrg *= 25.4; - } + m_job->m_3dparams.m_UseDefinedOrigin = true; + m_job->m_3dparams.m_Origin = VECTOR2D( xOrg, yOrg ); + } + else if( m_rbBoardCenterOrigin->GetValue() ) + { + 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_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; - } + m_job->m_3dparams.m_UsePcbCenterOrigin = true; + m_job->m_3dparams.m_Origin = VECTOR2D( xOrg, yOrg ); } 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() ); -} diff --git a/pcbnew/dialogs/dialog_export_step.h b/pcbnew/dialogs/dialog_export_step.h index 4c5ef5e3b6..85320bd431 100644 --- a/pcbnew/dialogs/dialog_export_step.h +++ b/pcbnew/dialogs/dialog_export_step.h @@ -25,6 +25,7 @@ #pragma once #include "dialog_export_step_base.h" +#include class PCB_EDIT_FRAME; class JOB_EXPORT_PCB_3D; @@ -32,23 +33,15 @@ class JOB_EXPORT_PCB_3D; class DIALOG_EXPORT_STEP : public DIALOG_EXPORT_STEP_BASE { 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, wxWindow* aParent, const wxString& aBoardPath, JOB_EXPORT_PCB_3D* aJob = nullptr ); - ~DIALOG_EXPORT_STEP(); + ~DIALOG_EXPORT_STEP() = default; + + bool TransferDataToWindow() override; protected: void onBrowseClicked( wxCommandEvent& aEvent ) override; - void onUpdateUnits( wxUpdateUIEvent& aEvent ) override; void onUpdateXPos( wxUpdateUIEvent& aEvent ) override; void onUpdateYPos( wxUpdateUIEvent& aEvent ) override; void onExportButton( wxCommandEvent& aEvent ) override; @@ -56,72 +49,13 @@ protected: void onCbExportComponents( 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 void OnFmtChoiceOptionChanged(); private: - enum class COMPONENT_MODE - { - EXPORT_ALL, - EXPORT_SELECTED, - CUSTOM_FILTER - }; - PCB_EDIT_FRAME* m_editFrame; JOB_EXPORT_PCB_3D* m_job; - STEP_ORIGIN_OPTION m_origin; // The last preference for STEP origin option - double m_userOriginX; // remember last User Origin X value - 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; + UNIT_BINDER m_originX; + UNIT_BINDER m_originY; 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 }; \ No newline at end of file diff --git a/pcbnew/dialogs/dialog_export_step_base.cpp b/pcbnew/dialogs/dialog_export_step_base.cpp index a9ff23e6e1..bcac5e8ed2 100644 --- a/pcbnew/dialogs/dialog_export_step_base.cpp +++ b/pcbnew/dialogs/dialog_export_step_base.cpp @@ -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 ); 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 ); 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 ); 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 ); 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 ); 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 ); 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 ); wxFlexGridSizer* fgSizer1; - fgSizer1 = new wxFlexGridSizer( 0, 2, 5, 0 ); + fgSizer1 = new wxFlexGridSizer( 0, 3, 5, 0 ); fgSizer1->SetFlexibleDirection( wxBOTH ); fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_staticTextUnits = new wxStaticText( sbUserDefinedOrigin->GetStaticBox(), wxID_ANY, _("Units:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextUnits->Wrap( -1 ); - fgSizer1->Add( m_staticTextUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + m_originXLabel = new wxStaticText( sbUserDefinedOrigin->GetStaticBox(), wxID_ANY, _("X position:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_originXLabel->Wrap( -1 ); + fgSizer1->Add( m_originXLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - wxString m_STEP_OrgUnitChoiceChoices[] = { _("mm"), _("inch") }; - 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 ); + m_originXCtrl = new TEXT_CTRL_EVAL( sbUserDefinedOrigin->GetStaticBox(), wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 ); #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 - m_STEP_Xorg->SetMaxLength( 8 ); + m_originXCtrl->SetMaxLength( 8 ); #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_staticTextYpos->Wrap( -1 ); - fgSizer1->Add( m_staticTextYpos, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + m_originXUnits = new wxStaticText( sbUserDefinedOrigin->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 ); + m_originXUnits->Wrap( -1 ); + 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__ - if ( !m_STEP_Yorg->HasFlag( wxTE_MULTILINE ) ) + if ( !m_originYCtrl->HasFlag( wxTE_MULTILINE ) ) { - m_STEP_Yorg->SetMaxLength( 8 ); + m_originYCtrl->SetMaxLength( 8 ); } #else - m_STEP_Yorg->SetMaxLength( 8 ); + m_originYCtrl->SetMaxLength( 8 ); #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 ); @@ -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 ); 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") ); 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->SetValue(true); 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->SetValue(true); 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 ); @@ -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_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_STEP_OrgUnitChoice->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EXPORT_STEP_BASE::onUpdateUnits ), NULL, this ); - m_STEP_Xorg->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EXPORT_STEP_BASE::onUpdateXPos ), NULL, this ); - m_STEP_Yorg->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EXPORT_STEP_BASE::onUpdateYPos ), NULL, this ); + m_originXCtrl->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_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_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_STEP_OrgUnitChoice->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EXPORT_STEP_BASE::onUpdateUnits ), NULL, this ); - m_STEP_Xorg->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EXPORT_STEP_BASE::onUpdateXPos ), NULL, this ); - m_STEP_Yorg->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EXPORT_STEP_BASE::onUpdateYPos ), NULL, this ); + m_originXCtrl->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_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXPORT_STEP_BASE::onExportButton ), NULL, this ); } diff --git a/pcbnew/dialogs/dialog_export_step_base.fbp b/pcbnew/dialogs/dialog_export_step_base.fbp index 24c9544652..9c9a8f3550 100644 --- a/pcbnew/dialogs/dialog_export_step_base.fbp +++ b/pcbnew/dialogs/dialog_export_step_base.fbp @@ -518,7 +518,7 @@ 1 0 - 0 + 1 1 1 @@ -843,7 +843,7 @@ 1 0 - 0 + 1 1 1 @@ -1780,7 +1780,7 @@ wxFILTER_NONE wxDefaultValidator - 0 + 1 @@ -2000,7 +2000,7 @@ wxEXPAND|wxTOP|wxBOTTOM 1 - 2 + 3 wxBOTH @@ -2011,134 +2011,6 @@ none 0 5 - - 5 - wxALIGN_CENTER_VERTICAL|wxLEFT - 0 - - 1 - 1 - 1 - 1 - 0 - - 0 - 0 - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - Units: - 0 - - 0 - - - 0 - - 1 - m_staticTextUnits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - 0 - - 0 - 0 - - - - 1 - 0 - "mm" "inch" - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_STEP_OrgUnitChoice - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - onUpdateUnits - - 5 wxALIGN_CENTER_VERTICAL|wxLEFT @@ -2181,7 +2053,7 @@ 0 1 - m_staticTextXpos + m_originXLabel 1 @@ -2242,7 +2114,7 @@ 0 1 - m_STEP_Xorg + m_originXCtrl 1 @@ -2267,6 +2139,68 @@ onUpdateXPos + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + units + 0 + + 0 + + + 0 + + 1 + m_originXUnits + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + 5 wxALIGN_CENTER_VERTICAL|wxLEFT @@ -2309,7 +2243,7 @@ 0 1 - m_staticTextYpos + m_originYLabel 1 @@ -2370,7 +2304,7 @@ 0 1 - m_STEP_Yorg + m_originYCtrl 1 @@ -2395,6 +2329,68 @@ onUpdateYPos + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + units + 0 + + 0 + + + 0 + + 1 + m_originYUnits + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + @@ -2559,7 +2555,7 @@ 1 0 - 0 + 1 1 1 @@ -2624,7 +2620,7 @@ 1 0 - 0 + 1 1 1 @@ -2689,7 +2685,7 @@ 1 0 - 0 + 1 1 1 diff --git a/pcbnew/dialogs/dialog_export_step_base.h b/pcbnew/dialogs/dialog_export_step_base.h index 8df8a8c92a..dd395a13bf 100644 --- a/pcbnew/dialogs/dialog_export_step_base.h +++ b/pcbnew/dialogs/dialog_export_step_base.h @@ -74,12 +74,12 @@ class DIALOG_EXPORT_STEP_BASE : public DIALOG_SHIM wxRadioButton* m_rbGridOrigin; wxRadioButton* m_rbUserDefinedOrigin; wxRadioButton* m_rbBoardCenterOrigin; - wxStaticText* m_staticTextUnits; - wxChoice* m_STEP_OrgUnitChoice; - wxStaticText* m_staticTextXpos; - TEXT_CTRL_EVAL* m_STEP_Xorg; - wxStaticText* m_staticTextYpos; - TEXT_CTRL_EVAL* m_STEP_Yorg; + wxStaticText* m_originXLabel; + TEXT_CTRL_EVAL* m_originXCtrl; + wxStaticText* m_originXUnits; + wxStaticText* m_originYLabel; + TEXT_CTRL_EVAL* m_originYCtrl; + wxStaticText* m_originYUnits; wxCheckBox* m_cbRemoveDNP; wxCheckBox* m_cbRemoveUnspecified; wxCheckBox* m_cbSubstModels; @@ -96,7 +96,6 @@ class DIALOG_EXPORT_STEP_BASE : public DIALOG_SHIM virtual void onBrowseClicked( wxCommandEvent& event ) { event.Skip(); } virtual void onCbExportComponents( 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 onUpdateYPos( wxUpdateUIEvent& event ) { event.Skip(); } virtual void onExportButton( wxCommandEvent& event ) { event.Skip(); } diff --git a/pcbnew/dialogs/dialog_gen_footprint_position.cpp b/pcbnew/dialogs/dialog_gen_footprint_position.cpp index 525b971b3b..930d4555d4 100644 --- a/pcbnew/dialogs/dialog_gen_footprint_position.cpp +++ b/pcbnew/dialogs/dialog_gen_footprint_position.cpp @@ -62,7 +62,7 @@ DIALOG_GEN_FOOTPRINT_POSITION::DIALOG_GEN_FOOTPRINT_POSITION( PCB_EDIT_FRAME* aE { wxID_CANCEL, _( "Close" ) } } ); // 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() ); 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, PCB_EDIT_FRAME* aEditFrame, wxWindow* aParent ) : @@ -83,24 +82,13 @@ DIALOG_GEN_FOOTPRINT_POSITION::DIALOG_GEN_FOOTPRINT_POSITION( JOB_EXPORT_PCB_POS m_browseButton->Hide(); m_units = m_job->m_units == JOB_EXPORT_PCB_POS::UNITS::INCH ? EDA_UNITS::INCH : EDA_UNITS::MM; m_staticTextDir->SetLabel( _( "Output file:" ) ); - m_outputDirectoryName->SetValue( m_job->GetConfiguredOutputPath() ); - - m_unitsCtrl->SetSelection( static_cast( m_job->m_units ) ); - m_singleFile->SetValue( m_job->m_singleFile ); - m_formatCtrl->SetSelection( static_cast( 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(); SetupStandardButtons(); // 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() ); 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( m_job->m_units ) ); + m_singleFile->SetValue( m_job->m_singleFile ); + m_formatCtrl->SetSelection( static_cast( 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 ) { m_unitsLabel->Enable( m_formatCtrl->GetSelection() != 2 ); diff --git a/pcbnew/dialogs/dialog_gen_footprint_position.h b/pcbnew/dialogs/dialog_gen_footprint_position.h index 68696276ac..2c130c2a2d 100644 --- a/pcbnew/dialogs/dialog_gen_footprint_position.h +++ b/pcbnew/dialogs/dialog_gen_footprint_position.h @@ -40,6 +40,8 @@ public: DIALOG_GEN_FOOTPRINT_POSITION( JOB_EXPORT_PCB_POS* aJob, PCB_EDIT_FRAME* aEditFrame, wxWindow* aParent ); + bool TransferDataToWindow() override; + private: void onOutputDirectoryBrowseClicked( wxCommandEvent& event ) override; void onGenerate( wxCommandEvent& event ) override; diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp index 410063004e..f201c668ad 100644 --- a/pcbnew/dialogs/dialog_gendrill.cpp +++ b/pcbnew/dialogs/dialog_gendrill.cpp @@ -75,7 +75,7 @@ DIALOG_GENDRILL::DIALOG_GENDRILL( PCB_EDIT_FRAME* aPcbEditFrame, wxWindow* aPare { wxID_CANCEL, _( "Close" ) } } ); // 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() ); finishDialogSettings(); @@ -101,43 +101,13 @@ DIALOG_GENDRILL::DIALOG_GENDRILL( PCB_EDIT_FRAME* aPcbEditFrame, JOB_EXPORT_PCB_ SetTitle( m_job->GetSettingsDialogTitle() ); // 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() ); 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( 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( m_choiceDrillMap->GetSelection() ); - m_job->m_zeroFormat = static_cast( m_zeros->GetSelection() ); - m_job->m_generateMap = m_cbGenerateMap->IsChecked(); - m_job->m_generateTenting = m_generateTentingLayers->IsChecked(); - } - - return true; -} - - bool DIALOG_GENDRILL::TransferDataToWindow() { 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( 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( m_choiceDrillMap->GetSelection() ); + m_job->m_zeroFormat = static_cast( 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 ) { bool enbl_Excellon = m_rbExcellon->GetValue(); diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index 44e2c8b3a9..3a3fdfcc5a 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -110,12 +110,11 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aEditFrame ) } -DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aEditFrame, wxWindow* aParent, - JOB_EXPORT_PCB_PLOT* aJob ) : - DIALOG_PLOT_BASE( aParent ), - m_editFrame( aEditFrame ), - m_trackWidthCorrection( m_editFrame, m_widthAdjustLabel, m_widthAdjustCtrl, m_widthAdjustUnits ), - m_job( aJob ) +DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aEditFrame, wxWindow* aParent, JOB_EXPORT_PCB_PLOT* aJob ) : + DIALOG_PLOT_BASE( aParent ), + m_editFrame( aEditFrame ), + m_trackWidthCorrection( m_editFrame, m_widthAdjustLabel, m_widthAdjustCtrl, m_widthAdjustUnits ), + m_job( aJob ) { 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 - // non-job versions (which have different sizes). + // non-job versions. m_hash_key = TO_UTF8( GetTitle() ); 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 ); - init_Dialog(); + m_browseButton->SetBitmap( KiBitmapBundle( BITMAPS::small_folder ) ); + m_openDirButton->SetBitmap( KiBitmapBundle( BITMAPS::small_new_window ) ); 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_bpMoveDown->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_PLOT::onPlotAllListMoveDown, this ); - m_layerCheckListBox->Connect( wxEVT_RIGHT_DOWN, - wxMouseEventHandler( DIALOG_PLOT::OnRightClickLayers ), nullptr, - this ); + m_layerCheckListBox->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( DIALOG_PLOT::OnRightClickLayers ), + nullptr, this ); - m_plotAllLayersList->Connect( wxEVT_RIGHT_DOWN, - wxMouseEventHandler( DIALOG_PLOT::OnRightClickAllLayers ), nullptr, - this ); + m_plotAllLayersList->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( DIALOG_PLOT::OnRightClickAllLayers ), + nullptr, this ); } @@ -272,7 +270,7 @@ DIALOG_PLOT::~DIALOG_PLOT() } -void DIALOG_PLOT::init_Dialog() +bool DIALOG_PLOT::TransferDataToWindow() { BOARD* board = m_editFrame->GetBoard(); wxFileName fileName; @@ -282,8 +280,6 @@ void DIALOG_PLOT::init_Dialog() // Could devote a PlotOrder() function in place of UIOrder(). m_layerList = board->GetEnabledLayers().UIOrder(); - PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings(); - if( !m_job && !projectFile.m_PcbLastPath[ LAST_PATH_PLOT ].IsEmpty() ) 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 // 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_YScaleAdjust = m_plotOpts.GetFineScaleAdjustY(); - 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 ); - } + m_fineAdjustXCtrl->SetValue( EDA_UNIT_UTILS::UI::StringFromValue( unityScale, EDA_UNITS::UNSCALED, + m_plotOpts.GetFineScaleAdjustX() ) ); - 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 ); } - 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 // [-(MinTrackWidth-1), +(MinClearanceValue-1)] decimils. @@ -335,25 +314,6 @@ void DIALOG_PLOT::init_Dialog() 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_forcePSA4OutputOpt->SetValue( m_plotOpts.GetA4Output() ); @@ -427,8 +387,7 @@ void DIALOG_PLOT::init_Dialog() m_DXF_plotModeOpt->SetValue( m_plotOpts.GetDXFPlotPolygonMode() ); // DXF text mode - m_DXF_plotTextStrokeFontOpt->SetValue( m_plotOpts.GetTextMode() - == PLOT_TEXT_MODE::DEFAULT ); + m_DXF_plotTextStrokeFontOpt->SetValue( m_plotOpts.GetTextMode() == PLOT_TEXT_MODE::DEFAULT ); // DXF units selection m_DXF_plotUnits->SetSelection( m_plotOpts.GetDXFPlotUnits() == DXF_UNITS::INCH ? 0 : 1 ); @@ -453,6 +412,8 @@ void DIALOG_PLOT::init_Dialog() // Update options values: wxCommandEvent cmd_event; SetPlotFormat( cmd_event ); + + return true; } @@ -1095,25 +1056,8 @@ void DIALOG_PLOT::applyPlotSettings() 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 - if( !setInt( &m_PSWidthAdjust, m_trackWidthCorrection.GetValue(), m_widthAdjustMinValue, + if( !setInt( &m_PSWidthAdjust, m_trackWidthCorrection.GetIntValue(), m_widthAdjustMinValue, m_widthAdjustMaxValue ) ) { m_trackWidthCorrection.SetValue( m_PSWidthAdjust ); @@ -1127,14 +1071,10 @@ void DIALOG_PLOT::applyPlotSettings() if( m_job ) { // When using a job we store the adjusts in the plot options + tempOptions.SetFineScaleAdjustX( m_XScaleAdjust ); + tempOptions.SetFineScaleAdjustY( m_YScaleAdjust ); 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() ); @@ -1329,8 +1269,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) } } - pcbPlotter.Plot( outputDir.GetPath(), layersToPlot, commonLayers, - m_useGerberExtensions->GetValue() ); + pcbPlotter.Plot( outputDir.GetPath(), layersToPlot, commonLayers, m_useGerberExtensions->GetValue() ); } } diff --git a/pcbnew/dialogs/dialog_plot.h b/pcbnew/dialogs/dialog_plot.h index 439ac2ddfc..a76c9cf30c 100644 --- a/pcbnew/dialogs/dialog_plot.h +++ b/pcbnew/dialogs/dialog_plot.h @@ -41,13 +41,13 @@ class DIALOG_PLOT : public DIALOG_PLOT_BASE { public: DIALOG_PLOT( PCB_EDIT_FRAME* aEditFrame ); - DIALOG_PLOT( PCB_EDIT_FRAME* aEditFrame, wxWindow* aParent, - JOB_EXPORT_PCB_PLOT* aJob = nullptr ); + DIALOG_PLOT( PCB_EDIT_FRAME* aEditFrame, wxWindow* aParent, JOB_EXPORT_PCB_PLOT* aJob = nullptr ); virtual ~DIALOG_PLOT(); -private: + bool TransferDataToWindow() override; +private: // Event called functions void Plot( wxCommandEvent& event ) override; void onOutputDirectoryBrowseClicked( wxCommandEvent& event ) override; @@ -69,13 +69,11 @@ private: void onPDFColorChoice( wxCommandEvent& event ) override; // other functions - void init_Dialog(); // main initialization void reInitDialog(); // initialization after calling drill dialog void applyPlotSettings(); PLOT_FORMAT getPlotFormat(); void arrangeAllLayersList( const LSEQ& aSeq ); - void loadPlotParamsFromJob(); void transferPlotParamsToJob(); void updatePdfColorOptions(); diff --git a/pcbnew/dialogs/dialog_plot_base.cpp b/pcbnew/dialogs/dialog_plot_base.cpp index b65fbeb1d9..dfd87ecd87 100644 --- a/pcbnew/dialogs/dialog_plot_base.cpp +++ b/pcbnew/dialogs/dialog_plot_base.cpp @@ -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 ); 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 ); 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") }; 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->SetSelection( 0 ); + m_drillShapeOpt->SetSelection( 2 ); gbSizer1->Add( m_drillShapeOpt, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxEXPAND|wxLEFT, 5 ); scalingLabel = new wxStaticText( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Scaling:"), wxDefaultPosition, wxDefaultSize, 0 ); diff --git a/pcbnew/dialogs/dialog_plot_base.fbp b/pcbnew/dialogs/dialog_plot_base.fbp index 7f813f3b89..0c8733ca7d 100644 --- a/pcbnew/dialogs/dialog_plot_base.fbp +++ b/pcbnew/dialogs/dialog_plot_base.fbp @@ -1113,7 +1113,7 @@ 1 0 - 0 + 1 1 1 @@ -1277,7 +1277,7 @@ 1 Resizable - 0 + 2 1 diff --git a/pcbnew/pcbnew_printout.cpp b/pcbnew/pcbnew_printout.cpp index 5ea9b4d2a1..e5de2b1caf 100644 --- a/pcbnew/pcbnew_printout.cpp +++ b/pcbnew/pcbnew_printout.cpp @@ -53,30 +53,12 @@ PCBNEW_PRINTOUT_SETTINGS::PCBNEW_PRINTOUT_SETTINGS( const PAGE_INFO& aPageInfo ) void PCBNEW_PRINTOUT_SETTINGS::Load( APP_SETTINGS_BASE* aConfig ) { BOARD_PRINTOUT_SETTINGS::Load( aConfig ); - - if( PCBNEW_SETTINGS* cfg = GetAppSettings( "pcbnew" ) ) - { - m_DrillMarks = static_cast( cfg->m_Plot.pads_drill_mode ); - m_Pagination = static_cast( 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 ) { BOARD_PRINTOUT_SETTINGS::Save( aConfig ); - - if( PCBNEW_SETTINGS* cfg = GetAppSettings( "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; - } } diff --git a/pcbnew/pcbnew_settings.cpp b/pcbnew/pcbnew_settings.cpp index 3e8e8d3550..f3d02abf16 100644 --- a/pcbnew/pcbnew_settings.cpp +++ b/pcbnew/pcbnew_settings.cpp @@ -50,12 +50,9 @@ const int pcbnewSchemaVersion = 5; PCBNEW_SETTINGS::PCBNEW_SETTINGS() : PCB_VIEWERS_SETTINGS_BASE( "pcbnew", pcbnewSchemaVersion ), m_AuiPanels(), - m_ExportIdf(), - m_ExportStep(), m_ExportODBPP(), m_ExportVrml(), m_FootprintWizardList(), - m_Plot(), m_FootprintChooser(), m_Zones(), m_FootprintViewer(), @@ -312,45 +309,6 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS() m_params.emplace_back( new PARAM( "export_odb.compress_format", &m_ExportODBPP.compressFormat, 1 ) ); - m_params.emplace_back( new PARAM( "export_idf.auto_adjust", - &m_ExportIdf.auto_adjust, false ) ); - - m_params.emplace_back( new PARAM( "export_idf.ref_units", - &m_ExportIdf.ref_units, 0 ) ); - - m_params.emplace_back( new PARAM( "export_idf.ref_x", - &m_ExportIdf.ref_x, 0 ) ); - - m_params.emplace_back( new PARAM( "export_idf.ref_y", - &m_ExportIdf.ref_y, 0 ) ); - - m_params.emplace_back( new PARAM( "export_idf.units_mils", - &m_ExportIdf.units_mils, false ) ); - - m_params.emplace_back( new PARAM( "export_step.origin_mode", - &m_ExportStep.origin_mode, 1 ) ); - - m_params.emplace_back( new PARAM( "export_step.origin_units", - &m_ExportStep.origin_units, 0 ) ); - - m_params.emplace_back( new PARAM( "export_step.origin_x", - &m_ExportStep.origin_x, 0 ) ); - - m_params.emplace_back( new PARAM( "export_step.origin_y", - &m_ExportStep.origin_y, 0 ) ); - - m_params.emplace_back( new PARAM( "export_step.no_unspecified", - &m_ExportStep.no_unspecified, false ) ); - - m_params.emplace_back( new PARAM( "export_step.no_dnp", - &m_ExportStep.no_dnp, false ) ); - - m_params.emplace_back( new PARAM( "export_step.replace_models", - &m_ExportStep.replace_models, true ) ); - - m_params.emplace_back( new PARAM( "export_step.overwrite_file", - &m_ExportStep.overwrite_file, true ) ); - m_params.emplace_back( new PARAM( "export_vrml.units", &m_ExportVrml.units, 1 ) ); @@ -384,30 +342,6 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS() m_params.emplace_back( new PARAM( "zones.net_sort_mode", &m_Zones.net_sort_mode, -1 ) ); - m_params.emplace_back( new PARAM( "plot.edgecut_on_all_layers", - &m_Plot.edgecut_on_all_layers, true ) ); - - m_params.emplace_back( new PARAM( "plot.pads_drill_mode", - &m_Plot.pads_drill_mode, 2 ) ); - - m_params.emplace_back( new PARAM( "plot.fine_scale_x", - &m_Plot.fine_scale_x, 0 ) ); - - m_params.emplace_back( new PARAM( "plot.fine_scale_y", - &m_Plot.fine_scale_y, 0 ) ); - - m_params.emplace_back( new PARAM( "plot.ps_fine_width_adjust", - &m_Plot.ps_fine_width_adjust, 0 ) ); - - m_params.emplace_back( new PARAM( "plot.check_zones_before_plotting", - &m_Plot.check_zones_before_plotting, true ) ); - - m_params.emplace_back( new PARAM( "plot.mirror", - &m_Plot.mirror, false ) ); - - m_params.emplace_back( new PARAM( "plot.as_item_checkboxes", - &m_Plot.as_item_checkboxes, false ) ); - m_params.emplace_back( new PARAM( "window.footprint_text_shown_columns", &m_FootprintTextShownColumns, "0 1 2 3 4 5 7" ) ); @@ -578,45 +512,6 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg ) ret &= fromLegacy( aCfg, "PlotLineWidth_mm", "plot.line_width" ); - aCfg->SetPath( "/dialogs/cleanup_tracks" ); - ret &= fromLegacy( aCfg, "DialogCleanupVias", "cleanup.cleanup_vias" ); - ret &= fromLegacy( aCfg, "DialogCleanupMergeSegments", "cleanup.merge_segments" ); - ret &= fromLegacy( aCfg, "DialogCleanupUnconnected", "cleanup.cleanup_unconnected" ); - ret &= fromLegacy( aCfg, "DialogCleanupShortCircuit", "cleanup.cleanup_short_circuits" ); - ret &= fromLegacy( aCfg, "DialogCleanupTracksInPads", "cleanup.cleanup_tracks_in_pad" ); - aCfg->SetPath( "../.." ); - - ret &= fromLegacy( aCfg, "RefillZonesBeforeDrc", "drc_dialog.refill_zones" ); - ret &= fromLegacy( aCfg, "DrcTestFootprints", "drc_dialog.test_footprints" ); - - ret &= fromLegacy( aCfg, "DrillMergePTHNPTH", "gen_drill.merge_pth_npth" ); - ret &= fromLegacy( aCfg, "DrillMinHeader", "gen_drill.minimal_header" ); - ret &= fromLegacy( aCfg, "DrillMirrorYOpt", "gen_drill.mirror" ); - ret &= fromLegacy( aCfg, "DrillUnit", "gen_drill.unit_drill_is_inch" ); - ret &= fromLegacy( aCfg, "OvalHolesRouteMode", "gen_drill.use_route_for_oval_holes" ); - ret &= fromLegacy( aCfg, "DrillFileType", "gen_drill.drill_file_type" ); - ret &= fromLegacy( aCfg, "DrillMapFileType", "gen_drill.map_file_type" ); - ret &= fromLegacy( aCfg, "DrillZerosFormat", "gen_drill.zeros_format" ); - - ret &= fromLegacy( aCfg, "IDFRefAutoAdj", "export_idf.auto_adjust" ); - ret &= fromLegacy( aCfg, "IDFRefUnits", "export_idf.ref_units" ); - ret &= fromLegacy( aCfg, "IDFRefX", "export_idf.ref_x" ); - ret &= fromLegacy( aCfg, "IDFRefY", "export_idf.ref_y" ); - ret &= fromLegacy( aCfg, "IDFExportThou", "export_idf.units_mils" ); - - ret &= fromLegacy( aCfg, "STEP_Origin_Opt", "export_step.origin_mode" ); - ret &= fromLegacy( aCfg, "STEP_UserOriginUnits", "export_step.origin_units" ); - ret &= fromLegacy( aCfg, "STEP_UserOriginX", "export_step.origin_x" ); - ret &= fromLegacy( aCfg, "STEP_UserOriginY", "export_step.origin_y" ); - ret &= fromLegacy( aCfg, "STEP_NoVirtual", "export_step.no_virtual" ); - - ret &= fromLegacy( aCfg, "PlotSVGModeColor", "export_svg.black_and_white" ); - ret &= fromLegacy( aCfg, "PlotSVGModeMirror", "export_svg.mirror" ); - ret &= fromLegacy( aCfg, "PlotSVGModeOneFile", "export_svg.one_file" ); - ret &= fromLegacy( aCfg, "PlotSVGBrdEdge", "export_svg.plot_board_edges" ); - ret &= fromLegacy( aCfg, "PlotSVGPageOpt", "export_svg.page_size" ); - ret &= fromLegacyString( aCfg, "PlotSVGDirectory", "export_svg.output_dir" ); - { nlohmann::json js = nlohmann::json::array(); 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. // - ret &= fromLegacy( aCfg, "VrmlExportUnit", "export_vrml.units" ); - ret &= fromLegacy( aCfg, "VrmlExportCopyFiles", "export_vrml.copy_3d_models" ); - ret &= fromLegacy( aCfg, "VrmlUseRelativePaths", "export_vrml.use_relative_paths" ); - ret &= fromLegacy( aCfg, "VrmlRefUnits", "export_vrml.ref_units" ); - ret &= fromLegacy( aCfg, "VrmlRefX", "export_vrml.ref_x" ); - ret &= fromLegacy( aCfg, "VrmlRefY", "export_vrml.ref_y" ); - ret &= fromLegacy ( aCfg, "VrmlOriginMode", "export_vrml.origin_mode" ); - ret &= fromLegacy( aCfg, "Zone_Ouline_Hatch_Opt", "zones.hatching_style" ); ret &= fromLegacy( aCfg, "Zone_NetSort_Opt", "zones.net_sort_mode" ); ret &= fromLegacy( aCfg, "Zone_Clearance", "zones.clearance" ); @@ -682,27 +569,6 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg ) ret &= fromLegacy( aCfg, "Zone_TH_Gap", "zones.thermal_relief_gap" ); ret &= fromLegacy( aCfg, "Zone_TH_Copper_Width", "zones.thermal_relief_copper_width" ); - aCfg->SetPath( "ImportGraphics" ); - ret &= fromLegacy( aCfg, "BoardLayer", "import_graphics.layer" ); - ret &= fromLegacy( aCfg, "InteractivePlacement", "import_graphics.interactive_placement" ); - ret &= fromLegacyString( aCfg, "LastFile", "import_graphics.last_file" ); - ret &= fromLegacy( aCfg, "LineWidth", "import_graphics.line_width" ); - ret &= fromLegacy( aCfg, "LineWidthUnits", "import_graphics.line_width_units" ); - ret &= fromLegacy( aCfg, "PositionUnits", "import_graphics.origin_units" ); - ret &= fromLegacy( aCfg, "PositionX", "import_graphics.origin_x" ); - ret &= fromLegacy( aCfg, "PositionY", "import_graphics.origin_y" ); - aCfg->SetPath( ".." ); - - ret &= fromLegacy( aCfg, "NetlistReportFilterMsg", "netlist.report_filter" ); - ret &= fromLegacy( aCfg, "NetlistUpdateFootprints", "netlist.update_footprints" ); - ret &= fromLegacy( aCfg, "NetlistDeleteShortingTracks", "netlist.delete_shorting_tracks" ); - ret &= fromLegacy( aCfg, "NetlistDeleteExtraFootprints", "netlist.delete_extra_footprints" ); - - ret &= fromLegacy( aCfg, "PlaceFileUnits", "place_file.units" ); - ret &= fromLegacy( aCfg, "PlaceFileOpts", "place_file.file_options" ); - ret &= fromLegacy( aCfg, "PlaceFileFormat", "place_file.file_format" ); - ret &= fromLegacy( aCfg, "PlaceFileIncludeBrdEdge", "place_file.include_board_edge" ); - ret &= fromLegacy( aCfg, "PrintSinglePage", "plot.all_layers_on_one_page" ); ret &= fromLegacy( aCfg, "PrintPadsDrillOpt", "plot.pads_drill_mode" ); ret &= fromLegacy( aCfg, "PlotXFineScaleAdj", "plot.fine_scale_x" ); diff --git a/pcbnew/pcbnew_settings.h b/pcbnew/pcbnew_settings.h index 3b5745131c..93d6a79edd 100644 --- a/pcbnew/pcbnew_settings.h +++ b/pcbnew/pcbnew_settings.h @@ -163,29 +163,6 @@ public: 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 { int precision; @@ -225,19 +202,6 @@ public: 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 { int width; @@ -297,10 +261,6 @@ public: AUI_PANELS m_AuiPanels; - DIALOG_EXPORT_IDF m_ExportIdf; - - DIALOG_EXPORT_STEP m_ExportStep; - DIALOG_EXPORT_2581 m_Export2581; DIALOG_EXPORT_ODBPP m_ExportODBPP; @@ -311,8 +271,6 @@ public: DIALOG_FOOTPRINT_WIZARD_LIST m_FootprintWizardList; - DIALOG_PLOT m_Plot; - FOOTPRINT_CHOOSER m_FootprintChooser; ZONES m_Zones;