← Back to team overview

kicad-developers team mailing list archive

Minor patch for design rules editor

 

Hi,

I attached a small patch that fixes a bug with the design editor.
Loading a design with micro vias enabled loads the flag and sets the
checkbox.
The two input fields are not enabled when the design is loaded.

Cheers
From 102a83b8919d3bb0042c736e1dfbbf5e64746492 Mon Sep 17 00:00:00 2001
From: Bastian Neumann <bneumann@xxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 28 Aug 2017 21:45:50 +0200
Subject: [PATCH 1/1] Micro via input fields are enabled when design is loaded

Loading a design with micro vias enabled did check the box for enabling
micro vias in pcbnew. The value input fields for diameter and drill
size were not enabled.

This patch moves the functionality into an new function and calls that
from the onclick event of the checkbox and the init function of the
dialog.
---
 pcbnew/dialogs/dialog_design_rules.cpp | 12 +++++++++---
 pcbnew/dialogs/dialog_design_rules.h   |  1 +
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/pcbnew/dialogs/dialog_design_rules.cpp b/pcbnew/dialogs/dialog_design_rules.cpp
index 1de2f1b..64f5d8f 100644
--- a/pcbnew/dialogs/dialog_design_rules.cpp
+++ b/pcbnew/dialogs/dialog_design_rules.cpp
@@ -291,6 +291,7 @@ void DIALOG_DESIGN_RULES::InitGlobalRules()
 
     m_OptAllowBlindBuriedVias->SetValue( m_BrdSettings->m_BlindBuriedViaAllowed );
     m_OptAllowMicroVias->SetValue( m_BrdSettings->m_MicroViasAllowed );
+    CheckAllowMicroVias();
 
     PutValueInLocalUnits( *m_SetMicroViasMinSizeCtrl, m_BrdSettings->m_MicroViasMinSize );
     PutValueInLocalUnits( *m_SetMicroViasMinDrillCtrl, m_BrdSettings->m_MicroViasMinDrill );
@@ -808,15 +809,20 @@ void DIALOG_DESIGN_RULES::OnRemoveNetclassClick( wxCommandEvent& event )
     }
 }
 
+void DIALOG_DESIGN_RULES::CheckAllowMicroVias()
+{
+    bool enabled = m_OptAllowMicroVias->GetValue();
+    m_SetMicroViasMinSizeCtrl->Enable( enabled );
+    m_SetMicroViasMinDrillCtrl->Enable( enabled );
+}
+
 /**
  * Function OnAllowMicroVias
  * is called whenever the AllowMicroVias checkbox is toggled
  */
 void DIALOG_DESIGN_RULES::OnAllowMicroVias( wxCommandEvent& event )
 {
-    bool enabled = m_OptAllowMicroVias->GetValue();
-    m_SetMicroViasMinSizeCtrl->Enable( enabled );
-    m_SetMicroViasMinDrillCtrl->Enable( enabled );
+    CheckAllowMicroVias();
 }
 
 void DIALOG_DESIGN_RULES::OnMoveUpSelectedNetClass( wxCommandEvent& event )
diff --git a/pcbnew/dialogs/dialog_design_rules.h b/pcbnew/dialogs/dialog_design_rules.h
index 831ab84..76dcdbe 100644
--- a/pcbnew/dialogs/dialog_design_rules.h
+++ b/pcbnew/dialogs/dialog_design_rules.h
@@ -95,6 +95,7 @@ private:
     void OnNetClassesNameRightClick( wxGridEvent& event ) override { event.Skip(); }
     void OnAddNetclassClick( wxCommandEvent& event ) override;
     void OnRemoveNetclassClick( wxCommandEvent& event ) override;
+    void CheckAllowMicroVias();
     void OnAllowMicroVias( wxCommandEvent& event ) override;
 
     /*
-- 
2.7.4


Follow ups