← Back to team overview

kicad-developers team mailing list archive

[PATCH 13/19] PinTypeComboBox: Introduce widget

 

---
 eeschema/CMakeLists.txt                       |  1 +
 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_type_combobox.cpp        | 43 +++++++++++++++++++++++++
 eeschema/widgets/pin_type_combobox.h          | 46 +++++++++++++++++++++++++++
 7 files changed, 96 insertions(+), 3 deletions(-)
 create mode 100644 eeschema/widgets/pin_type_combobox.cpp
 create mode 100644 eeschema/widgets/pin_type_combobox.h

diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt
index c6c894c..e9ae4bb 100644
--- a/eeschema/CMakeLists.txt
+++ b/eeschema/CMakeLists.txt
@@ -186,6 +186,7 @@ set( EESCHEMA_SRCS
     netlist_exporters/netlist_exporter_pspice.cpp
 
     widgets/pin_shape_combobox.cpp
+    widgets/pin_type_combobox.cpp
     )
 
 
diff --git a/eeschema/dialogs/dialog_lib_edit_pin.h b/eeschema/dialogs/dialog_lib_edit_pin.h
index 0ffdcd8..ab23264 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin.h
+++ b/eeschema/dialogs/dialog_lib_edit_pin.h
@@ -32,6 +32,7 @@
 
 #include <wx/bmpcbox.h>
 #include <pin_shape_combobox.h>
+#include <pin_type_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 af770d7..920a586 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin_base.cpp
+++ b/eeschema/dialogs/dialog_lib_edit_pin_base.cpp
@@ -6,6 +6,7 @@
 ///////////////////////////////////////////////////////////////////////////
 
 #include "pin_shape_combobox.h"
+#include "pin_type_combobox.h"
 #include "wx/bmpcbox.h"
 
 #include "dialog_lib_edit_pin_base.h"
@@ -62,7 +63,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
 	
 	fgSizerPins->Add( m_staticTextEType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
 	
-	m_choiceElectricalType = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); 
+	m_choiceElectricalType = new PinTypeComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); 
 	fgSizerPins->Add( m_choiceElectricalType, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
 	
 	m_staticTextGstyle = new wxStaticText( this, wxID_ANY, _("Graphic &Style:"), wxDefaultPosition, wxDefaultSize, 0 );
diff --git a/eeschema/dialogs/dialog_lib_edit_pin_base.fbp b/eeschema/dialogs/dialog_lib_edit_pin_base.fbp
index f1647ae..43b1deb 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin_base.fbp
+++ b/eeschema/dialogs/dialog_lib_edit_pin_base.fbp
@@ -784,7 +784,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">PinTypeComboBox; pin_type_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 890623b..e8b46e9 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin_base.h
+++ b/eeschema/dialogs/dialog_lib_edit_pin_base.h
@@ -13,6 +13,7 @@
 #include <wx/intl.h>
 class DIALOG_SHIM;
 class PinShapeComboBox;
+class PinTypeComboBox;
 class wxBitmapComboBox;
 
 #include "dialog_shim.h"
@@ -65,7 +66,7 @@ class DIALOG_LIB_EDIT_PIN_BASE : public DIALOG_SHIM
 		wxStaticText* m_staticTextOrient;
 		wxBitmapComboBox* m_choiceOrientation;
 		wxStaticText* m_staticTextEType;
-		wxBitmapComboBox* m_choiceElectricalType;
+		PinTypeComboBox* m_choiceElectricalType;
 		wxStaticText* m_staticTextGstyle;
 		PinShapeComboBox* m_choiceStyle;
 		wxCheckBox* m_checkApplyToAllParts;
diff --git a/eeschema/widgets/pin_type_combobox.cpp b/eeschema/widgets/pin_type_combobox.cpp
new file mode 100644
index 0000000..3c2ac7e
--- /dev/null
+++ b/eeschema/widgets/pin_type_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_type_combobox.cpp
+ * @brief ComboBox widget for pin type
+ */
+
+#include "pin_type_combobox.h"
+
+PinTypeComboBox::PinTypeComboBox( 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_type_combobox.h b/eeschema/widgets/pin_type_combobox.h
new file mode 100644
index 0000000..1564839
--- /dev/null
+++ b/eeschema/widgets/pin_type_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_type_combobox.h
+ * @brief ComboBox widget for pin type
+ */
+
+#include <wx/bmpcbox.h>
+
+class PinTypeComboBox : public wxBitmapComboBox
+{
+public:
+    /// @todo C++11: replace with forwarder
+
+    PinTypeComboBox( 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