← Back to team overview

kicad-developers team mailing list archive

[PATCH 08/27] PinShapeComboBox: Introduce widget

 

Derived from the regular bitmap combobox, this widget should be used for
pin shape choices.
---
 eeschema/CMakeLists.txt                       |  3 ++
 eeschema/dialogs/dialog_lib_edit_pin.h        |  1 +
 eeschema/dialogs/dialog_lib_edit_pin_base.cpp |  3 +-
 eeschema/dialogs/dialog_lib_edit_pin_base.fbp |  2 +-
 eeschema/dialogs/dialog_lib_edit_pin_base.h   |  3 +-
 eeschema/widgets/pin_shape_combobox.cpp       | 43 +++++++++++++++++++++++++
 eeschema/widgets/pin_shape_combobox.h         | 46 +++++++++++++++++++++++++++
 7 files changed, 98 insertions(+), 3 deletions(-)
 create mode 100644 eeschema/widgets/pin_shape_combobox.cpp
 create mode 100644 eeschema/widgets/pin_shape_combobox.h

diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt
index 700007f..a14ac02 100644
--- a/eeschema/CMakeLists.txt
+++ b/eeschema/CMakeLists.txt
@@ -13,6 +13,7 @@ include_directories( BEFORE ${INC_BEFORE} )
 include_directories(
     ./dialogs
     ./netlist_exporters
+    ./widgets
     ../common
     ../common/dialogs
     ${INC_AFTER}
@@ -174,6 +175,8 @@ set( EESCHEMA_SRCS
     netlist_exporters/netlist_exporter_kicad.cpp
     netlist_exporters/netlist_exporter_orcadpcb2.cpp
     netlist_exporters/netlist_exporter_pspice.cpp
+
+    widgets/pin_shape_combobox.cpp
     )
 
 
diff --git a/eeschema/dialogs/dialog_lib_edit_pin.h b/eeschema/dialogs/dialog_lib_edit_pin.h
index f292041..a083e2c 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin.h
+++ b/eeschema/dialogs/dialog_lib_edit_pin.h
@@ -31,6 +31,7 @@
  */
 
 #include <wx/bmpcbox.h>
+#include <pin_shape_combobox.h>
 
 #include <dialog_lib_edit_pin_base.h>
 
diff --git a/eeschema/dialogs/dialog_lib_edit_pin_base.cpp b/eeschema/dialogs/dialog_lib_edit_pin_base.cpp
index 42d508a..5e7b345 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin_base.cpp
+++ b/eeschema/dialogs/dialog_lib_edit_pin_base.cpp
@@ -5,6 +5,7 @@
 // PLEASE DO "NOT" EDIT THIS FILE!
 ///////////////////////////////////////////////////////////////////////////
 
+#include "pin_shape_combobox.h"
 #include "wx/bmpcbox.h"
 
 #include "dialog_lib_edit_pin_base.h"
@@ -68,7 +69,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
 	m_staticTextGstyle->Wrap( -1 );
 	fgSizerPins->Add( m_staticTextGstyle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
 	
-	m_choiceStyle = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); 
+	m_choiceStyle = new PinShapeComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); 
 	fgSizerPins->Add( m_choiceStyle, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
 	
 	
diff --git a/eeschema/dialogs/dialog_lib_edit_pin_base.fbp b/eeschema/dialogs/dialog_lib_edit_pin_base.fbp
index f18240f..f78abb6 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin_base.fbp
+++ b/eeschema/dialogs/dialog_lib_edit_pin_base.fbp
@@ -958,7 +958,7 @@
                                                 <property name="show">1</property>
                                                 <property name="size"></property>
                                                 <property name="style">wxCB_READONLY</property>
-                                                <property name="subclass">wxBitmapComboBox; wx/bmpcbox.h</property>
+                                                <property name="subclass">PinShapeComboBox; pin_shape_combobox.h</property>
                                                 <property name="toolbar_pane">0</property>
                                                 <property name="tooltip"></property>
                                                 <property name="validator_data_type"></property>
diff --git a/eeschema/dialogs/dialog_lib_edit_pin_base.h b/eeschema/dialogs/dialog_lib_edit_pin_base.h
index bac7325..db9a949 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin_base.h
+++ b/eeschema/dialogs/dialog_lib_edit_pin_base.h
@@ -12,6 +12,7 @@
 #include <wx/xrc/xmlres.h>
 #include <wx/intl.h>
 class DIALOG_SHIM;
+class PinShapeComboBox;
 class wxBitmapComboBox;
 
 #include "dialog_shim.h"
@@ -66,7 +67,7 @@ class DIALOG_LIB_EDIT_PIN_BASE : public DIALOG_SHIM
 		wxStaticText* m_staticTextEType;
 		wxBitmapComboBox* m_choiceElectricalType;
 		wxStaticText* m_staticTextGstyle;
-		wxBitmapComboBox* m_choiceStyle;
+		PinShapeComboBox* m_choiceStyle;
 		wxCheckBox* m_checkApplyToAllParts;
 		wxCheckBox* m_checkApplyToAllConversions;
 		wxCheckBox* m_checkShow;
diff --git a/eeschema/widgets/pin_shape_combobox.cpp b/eeschema/widgets/pin_shape_combobox.cpp
new file mode 100644
index 0000000..0c69bb2
--- /dev/null
+++ b/eeschema/widgets/pin_shape_combobox.cpp
@@ -0,0 +1,43 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2015 Simon Richter <Simon.Richter@xxxxxxxxxx>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ */
+
+/**
+ * @file pin_shape_combobox.cpp
+ * @brief ComboBox widget for pin shape
+ */
+
+#include "pin_shape_combobox.h"
+
+PinShapeComboBox::PinShapeComboBox( wxWindow* parent,
+        wxWindowID id,
+        const wxString& value,
+        const wxPoint& pos,
+        const wxSize& size,
+        int n,
+        const wxString choices[],
+        long style,
+        const wxValidator& validator,
+        const wxString& name ) :
+    wxBitmapComboBox( parent, id, value, pos, size, n, choices, style, validator, name )
+{
+}
diff --git a/eeschema/widgets/pin_shape_combobox.h b/eeschema/widgets/pin_shape_combobox.h
new file mode 100644
index 0000000..9396770
--- /dev/null
+++ b/eeschema/widgets/pin_shape_combobox.h
@@ -0,0 +1,46 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2015 Simon Richter <Simon.Richter@xxxxxxxxxx>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ */
+
+/**
+ * @file pin_shape_combobox.h
+ * @brief ComboBox widget for pin shape
+ */
+
+#include <wx/bmpcbox.h>
+
+class PinShapeComboBox : public wxBitmapComboBox
+{
+public:
+    /// @todo C++11: replace with forwarder
+
+    PinShapeComboBox( wxWindow* parent,
+            wxWindowID id = wxID_ANY,
+            const wxString& value = wxEmptyString,
+            const wxPoint& pos = wxDefaultPosition,
+            const wxSize& size = wxDefaultSize,
+            int n = 0,
+            const wxString choices[] = NULL,
+            long style = 0,
+            const wxValidator& validator = wxDefaultValidator,
+            const wxString& name = wxBitmapComboBoxNameStr );
+};

Follow ups

References