← Back to team overview

kicad-developers team mailing list archive

[PATCH] Pcbnew, plot dialog: grey out advanced net attributes if Gerber X2 is unchecked.

 

m_useGerberNetAttributes is useless if m_useGerberX2Attributes is not checked.
So disabled (greyed out) when Gerber X2 gets unchecked to make it clear to
the user.
---
 pcbnew/dialogs/dialog_plot.cpp      | 20 ++++++++++++++++++++
 pcbnew/dialogs/dialog_plot.h        |  3 ++-
 pcbnew/dialogs/dialog_plot_base.cpp |  4 +++-
 pcbnew/dialogs/dialog_plot_base.fbp |  2 +-
 pcbnew/dialogs/dialog_plot_base.h   |  3 ++-
 5 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp
index 0e51867..dea1cec 100644
--- a/pcbnew/dialogs/dialog_plot.cpp
+++ b/pcbnew/dialogs/dialog_plot.cpp
@@ -166,6 +166,9 @@ void DIALOG_PLOT::Init_Dialog()
     // Option for including Gerber netlist info (from Gerber X2 format) in the output
 #ifdef KICAD_USE_GBR_NETATTRIBUTES
     m_useGerberNetAttributes->SetValue( m_plotOpts.GetIncludeGerberNetlistInfo() );
+
+    // Grey out if m_useGerberX2Attributes is not checked
+    m_useGerberNetAttributes->Enable( m_useGerberX2Attributes->GetValue() );
 #else
     m_plotOpts.SetIncludeGerberNetlistInfo( false );
     m_useGerberNetAttributes->SetValue( false );
@@ -670,6 +673,23 @@ void DIALOG_PLOT::applyPlotSettings()
 }
 
 
+void DIALOG_PLOT::OnGerberX2Checked( wxCommandEvent& event )
+{
+    // m_useGerberNetAttributes is useless if m_useGerberX2Attributes
+    // is not checked. So disabled (greyed out) when Gerber X2 gets unchecked
+    // to make it clear to the user.
+    if( m_useGerberX2Attributes->GetValue() )
+    {
+        m_useGerberNetAttributes->Enable( true );
+    }
+    else
+    {
+        m_useGerberNetAttributes->Enable( false );
+        m_useGerberNetAttributes->SetValue( false );
+    }
+}
+
+
 void DIALOG_PLOT::Plot( wxCommandEvent& event )
 {
     applyPlotSettings();
diff --git a/pcbnew/dialogs/dialog_plot.h b/pcbnew/dialogs/dialog_plot.h
index c4e152a..5fa534e 100644
--- a/pcbnew/dialogs/dialog_plot.h
+++ b/pcbnew/dialogs/dialog_plot.h
@@ -68,9 +68,10 @@ private:
     void        SetPlotFormat( wxCommandEvent& event ) override;
     void        OnSetScaleOpt( wxCommandEvent& event ) override;
     void        CreateDrillFile( wxCommandEvent& event ) override;
+    void        OnGerberX2Checked( wxCommandEvent& event ) override;
 	virtual void onRunDRC( wxCommandEvent& event ) override;
 
-    // orther functions
+    // other functions
     void        applyPlotSettings();
     PlotFormat  getPlotFormat();
 
diff --git a/pcbnew/dialogs/dialog_plot_base.cpp b/pcbnew/dialogs/dialog_plot_base.cpp
index f14b082..2610f6d 100644
--- a/pcbnew/dialogs/dialog_plot_base.cpp
+++ b/pcbnew/dialogs/dialog_plot_base.cpp
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version May  6 2016)
+// C++ code generated with wxFormBuilder (version Feb 16 2016)
 // http://www.wxformbuilder.org/
 //
 // PLEASE DO "NOT" EDIT THIS FILE!
@@ -410,6 +410,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
 	m_browseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnOutputDirectoryBrowseClicked ), NULL, this );
 	m_layerCheckListBox->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( DIALOG_PLOT_BASE::OnRightClick ), NULL, this );
 	m_scaleOpt->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnSetScaleOpt ), NULL, this );
+	m_useGerberX2Attributes->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnGerberX2Checked ), NULL, this );
 	m_plotButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::Plot ), NULL, this );
 	m_buttonDrill->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::CreateDrillFile ), NULL, this );
 	m_buttonDRC->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::onRunDRC ), NULL, this );
@@ -431,6 +432,7 @@ DIALOG_PLOT_BASE::~DIALOG_PLOT_BASE()
 	m_browseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnOutputDirectoryBrowseClicked ), NULL, this );
 	m_layerCheckListBox->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( DIALOG_PLOT_BASE::OnRightClick ), NULL, this );
 	m_scaleOpt->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnSetScaleOpt ), NULL, this );
+	m_useGerberX2Attributes->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnGerberX2Checked ), NULL, this );
 	m_plotButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::Plot ), NULL, this );
 	m_buttonDrill->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::CreateDrillFile ), NULL, this );
 	m_buttonDRC->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::onRunDRC ), NULL, this );
diff --git a/pcbnew/dialogs/dialog_plot_base.fbp b/pcbnew/dialogs/dialog_plot_base.fbp
index 5de46c1..8c66c17 100644
--- a/pcbnew/dialogs/dialog_plot_base.fbp
+++ b/pcbnew/dialogs/dialog_plot_base.fbp
@@ -2845,7 +2845,7 @@
                                                         <property name="window_name"></property>
                                                         <property name="window_style"></property>
                                                         <event name="OnChar"></event>
-                                                        <event name="OnCheckBox"></event>
+                                                        <event name="OnCheckBox">OnGerberX2Checked</event>
                                                         <event name="OnEnterWindow"></event>
                                                         <event name="OnEraseBackground"></event>
                                                         <event name="OnKeyDown"></event>
diff --git a/pcbnew/dialogs/dialog_plot_base.h b/pcbnew/dialogs/dialog_plot_base.h
index 4add29a..5d1849b 100644
--- a/pcbnew/dialogs/dialog_plot_base.h
+++ b/pcbnew/dialogs/dialog_plot_base.h
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version May  6 2016)
+// C++ code generated with wxFormBuilder (version Feb 16 2016)
 // http://www.wxformbuilder.org/
 //
 // PLEASE DO "NOT" EDIT THIS FILE!
@@ -121,6 +121,7 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM
 		virtual void SetPlotFormat( wxCommandEvent& event ) { event.Skip(); }
 		virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
 		virtual void OnSetScaleOpt( wxCommandEvent& event ) { event.Skip(); }
+		virtual void OnGerberX2Checked( wxCommandEvent& event ) { event.Skip(); }
 		virtual void Plot( wxCommandEvent& event ) { event.Skip(); }
 		virtual void CreateDrillFile( wxCommandEvent& event ) { event.Skip(); }
 		virtual void onRunDRC( wxCommandEvent& event ) { event.Skip(); }

Follow ups