From 71b7816de5f8daa97311a4ffb9564273961b8efc Mon Sep 17 00:00:00 2001
From: jean-pierre charras <jp.charras@wanadoo.fr>
Date: Sat, 21 Aug 2021 10:52:51 +0200
Subject: [PATCH] DIALOG_GEN_FOOTPRINT_POSITION and dialogs print: minor
 enhancements: Gen footprint: 2 options are now stored during a session.
 Gerbview and Pcbnew dialogs print: avoid useless large size of right panel.

---
 common/dialogs/dialog_print_generic_base.cpp              | 4 ++--
 common/dialogs/dialog_print_generic_base.fbp              | 5 +----
 common/dialogs/dialog_print_generic_base.h                | 4 ++--
 .../dialogs/dialog_gen_footprint_position_file_base.cpp   | 4 ++--
 .../dialogs/dialog_gen_footprint_position_file_base.fbp   | 4 ++--
 pcbnew/exporters/gen_footprints_placefile.cpp             | 8 ++++++++
 6 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/common/dialogs/dialog_print_generic_base.cpp b/common/dialogs/dialog_print_generic_base.cpp
index fb382c22dc..10c0381a13 100644
--- a/common/dialogs/dialog_print_generic_base.cpp
+++ b/common/dialogs/dialog_print_generic_base.cpp
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version 3.9.0 Jun  3 2020)
+// C++ code generated with wxFormBuilder (version Oct 26 2018)
 // http://www.wxformbuilder.org/
 //
 // PLEASE DO *NOT* EDIT THIS FILE!
@@ -85,7 +85,7 @@ DIALOG_PRINT_GENERIC_BASE::DIALOG_PRINT_GENERIC_BASE( wxWindow* parent, wxWindow
 	bRightCol->Add( bScaleSizer, 0, wxALL|wxEXPAND, 5 );
 
 
-	m_bUpperSizer->Add( bRightCol, 1, wxEXPAND, 5 );
+	m_bUpperSizer->Add( bRightCol, 0, wxEXPAND, 5 );
 
 
 	bMainSizer->Add( m_bUpperSizer, 1, wxEXPAND|wxALL, 5 );
diff --git a/common/dialogs/dialog_print_generic_base.fbp b/common/dialogs/dialog_print_generic_base.fbp
index 6adf0f8b26..0db160023d 100644
--- a/common/dialogs/dialog_print_generic_base.fbp
+++ b/common/dialogs/dialog_print_generic_base.fbp
@@ -14,7 +14,6 @@
         <property name="file">dialog_print_generic_base</property>
         <property name="first_id">1000</property>
         <property name="help_provider">none</property>
-        <property name="image_path_wrapper_function_name"></property>
         <property name="indent_with_spaces"></property>
         <property name="internationalize">1</property>
         <property name="name">DIALOG_PRINT_GENERIC</property>
@@ -26,7 +25,6 @@
         <property name="skip_php_events">1</property>
         <property name="skip_python_events">1</property>
         <property name="ui_table">UI</property>
-        <property name="use_array_enum">0</property>
         <property name="use_enum">1</property>
         <property name="use_microsoft_bom">0</property>
         <object class="Dialog" expanded="1">
@@ -73,7 +71,7 @@
                         <object class="sizeritem" expanded="1">
                             <property name="border">5</property>
                             <property name="flag">wxEXPAND</property>
-                            <property name="proportion">1</property>
+                            <property name="proportion">0</property>
                             <object class="wxBoxSizer" expanded="1">
                                 <property name="minimum_size"></property>
                                 <property name="name">bRightCol</property>
@@ -694,7 +692,6 @@
                                 <property name="aui_name"></property>
                                 <property name="aui_position"></property>
                                 <property name="aui_row"></property>
-                                <property name="auth_needed">0</property>
                                 <property name="best_size"></property>
                                 <property name="bg"></property>
                                 <property name="bitmap"></property>
diff --git a/common/dialogs/dialog_print_generic_base.h b/common/dialogs/dialog_print_generic_base.h
index 36f96292a4..79d028efdd 100644
--- a/common/dialogs/dialog_print_generic_base.h
+++ b/common/dialogs/dialog_print_generic_base.h
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version 3.9.0 Jun  3 2020)
+// C++ code generated with wxFormBuilder (version Oct 26 2018)
 // http://www.wxformbuilder.org/
 //
 // PLEASE DO *NOT* EDIT THIS FILE!
@@ -25,10 +25,10 @@
 #include <wx/radiobut.h>
 #include <wx/textctrl.h>
 #include <wx/statline.h>
-#include <wx/button.h>
 #include <wx/bitmap.h>
 #include <wx/image.h>
 #include <wx/icon.h>
+#include <wx/button.h>
 #include <wx/dialog.h>
 
 ///////////////////////////////////////////////////////////////////////////
diff --git a/pcbnew/dialogs/dialog_gen_footprint_position_file_base.cpp b/pcbnew/dialogs/dialog_gen_footprint_position_file_base.cpp
index ee90cfb635..f2011429a9 100644
--- a/pcbnew/dialogs/dialog_gen_footprint_position_file_base.cpp
+++ b/pcbnew/dialogs/dialog_gen_footprint_position_file_base.cpp
@@ -45,7 +45,7 @@ DIALOG_GEN_FOOTPRINT_POSITION_BASE::DIALOG_GEN_FOOTPRINT_POSITION_BASE( wxWindow
 	wxBoxSizer* bSizerMiddle;
 	bSizerMiddle = new wxBoxSizer( wxHORIZONTAL );
 
-	wxString m_rbFormatChoices[] = { _("ASCII"), _("CSV"), _("Gerber (very experimental)") };
+	wxString m_rbFormatChoices[] = { _("ASCII"), _("CSV"), _("Gerber (experimental)") };
 	int m_rbFormatNChoices = sizeof( m_rbFormatChoices ) / sizeof( wxString );
 	m_rbFormat = new wxRadioBox( this, wxID_ANY, _("Format"), wxDefaultPosition, wxDefaultSize, m_rbFormatNChoices, m_rbFormatChoices, 1, wxRA_SPECIFY_COLS );
 	m_rbFormat->SetSelection( 2 );
@@ -75,7 +75,7 @@ DIALOG_GEN_FOOTPRINT_POSITION_BASE::DIALOG_GEN_FOOTPRINT_POSITION_BASE( wxWindow
 	bSizerLower->Add( m_onlySMD, 0, wxALL, 5 );
 
 	m_excludeTH = new wxCheckBox( this, wxID_ANY, _("Exclude all footprints with through hole pads"), wxDefaultPosition, wxDefaultSize, 0 );
-	bSizerLower->Add( m_excludeTH, 0, wxALL, 5 );
+	bSizerLower->Add( m_excludeTH, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
 
 	m_cbIncludeBoardEdge = new wxCheckBox( this, wxID_ANY, _("Include board edge layer"), wxDefaultPosition, wxDefaultSize, 0 );
 	bSizerLower->Add( m_cbIncludeBoardEdge, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
diff --git a/pcbnew/dialogs/dialog_gen_footprint_position_file_base.fbp b/pcbnew/dialogs/dialog_gen_footprint_position_file_base.fbp
index e53b6448cd..93b2b8c8b5 100644
--- a/pcbnew/dialogs/dialog_gen_footprint_position_file_base.fbp
+++ b/pcbnew/dialogs/dialog_gen_footprint_position_file_base.fbp
@@ -305,7 +305,7 @@
                                 <property name="caption"></property>
                                 <property name="caption_visible">1</property>
                                 <property name="center_pane">0</property>
-                                <property name="choices">&quot;ASCII&quot; &quot;CSV&quot; &quot;Gerber (very experimental)&quot;</property>
+                                <property name="choices">&quot;ASCII&quot; &quot;CSV&quot; &quot;Gerber (experimental)&quot;</property>
                                 <property name="close_button">1</property>
                                 <property name="context_help"></property>
                                 <property name="context_menu">1</property>
@@ -566,7 +566,7 @@
                         </object>
                         <object class="sizeritem" expanded="1">
                             <property name="border">5</property>
-                            <property name="flag">wxALL</property>
+                            <property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
                             <property name="proportion">0</property>
                             <object class="wxCheckBox" expanded="1">
                                 <property name="BottomDockable">1</property>
diff --git a/pcbnew/exporters/gen_footprints_placefile.cpp b/pcbnew/exporters/gen_footprints_placefile.cpp
index 24ec0fc40f..75595b7ea3 100644
--- a/pcbnew/exporters/gen_footprints_placefile.cpp
+++ b/pcbnew/exporters/gen_footprints_placefile.cpp
@@ -159,6 +159,8 @@ private:
     static int m_fileOpt;
     static int m_fileFormat;
     static bool m_includeBoardEdge;
+    static bool m_excludeTHOpt;
+    static bool m_onlySMDOpt;
 };
 
 
@@ -166,6 +168,8 @@ private:
 int DIALOG_GEN_FOOTPRINT_POSITION::m_fileOpt = 0;
 int DIALOG_GEN_FOOTPRINT_POSITION::m_fileFormat = 0;
 bool DIALOG_GEN_FOOTPRINT_POSITION::m_includeBoardEdge = false;
+bool DIALOG_GEN_FOOTPRINT_POSITION::m_excludeTHOpt = false;
+bool DIALOG_GEN_FOOTPRINT_POSITION::m_onlySMDOpt = false;
 
 
 void DIALOG_GEN_FOOTPRINT_POSITION::initDialog()
@@ -188,6 +192,8 @@ void DIALOG_GEN_FOOTPRINT_POSITION::initDialog()
     m_rbFormat->SetSelection( m_fileFormat );
     m_cbIncludeBoardEdge->SetValue( m_includeBoardEdge );
     m_useDrillPlaceOrigin->SetValue( cfg->m_PlaceFile.use_aux_origin );
+    m_onlySMD->SetValue( m_onlySMDOpt );
+    m_excludeTH->SetValue( m_excludeTHOpt );
 
     // Update sizes and sizers:
     m_messagesPanel->MsgPanelSetMinSize( wxSize( -1, 160 ) );
@@ -230,6 +236,8 @@ void DIALOG_GEN_FOOTPRINT_POSITION::OnGenerate( wxCommandEvent& event )
     m_fileOpt = m_radioBoxFilesCount->GetSelection();
     m_fileFormat = m_rbFormat->GetSelection();
     m_includeBoardEdge = m_cbIncludeBoardEdge->GetValue();
+    m_onlySMDOpt = m_onlySMD->GetValue();
+    m_excludeTHOpt = m_excludeTH->GetValue();
 
     auto cfg = m_parent->GetPcbNewSettings();
     m_units  = m_radioBoxUnits->GetSelection() == 0 ? EDA_UNITS::INCHES : EDA_UNITS::MILLIMETRES;