kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #17925
[PATCH 26/27] Pin Table: display icon in pin type column
---
eeschema/dialogs/dialog_lib_edit_pin_table.cpp | 50 +++++++++++++++++++++++---
1 file changed, 45 insertions(+), 5 deletions(-)
diff --git a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp
index 28b4938..cfc3ee8 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp
+++ b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp
@@ -154,7 +154,7 @@ DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE( wxWindow* parent,
100,
wxAlignment( wxALIGN_LEFT | wxALIGN_TOP ),
wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE );
- wxDataViewTextRenderer* rend2 = new wxDataViewTextRenderer( wxT( "string" ), wxDATAVIEW_CELL_INERT );
+ wxDataViewIconTextRenderer* rend2 = new wxDataViewIconTextRenderer( wxT( "wxDataViewIconText" ), wxDATAVIEW_CELL_INERT );
wxDataViewColumn* col2 = new wxDataViewColumn( _( "Type" ),
rend2,
DataViewModel::PIN_TYPE,
@@ -216,7 +216,23 @@ unsigned int DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::GetColumnCount() const
wxString DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::GetColumnType( unsigned int aCol ) const
{
- return wxT( "string" );
+ switch( aCol )
+ {
+ case PIN_NUMBER:
+ return wxT( "string" );
+
+ case PIN_NAME:
+ return wxT( "string" );
+
+ case PIN_TYPE:
+ return wxT( "wxDataViewIconText" );
+
+ case PIN_POSITION:
+ return wxT( "string" );
+ }
+
+ assert( ! "Unhandled column" );
+ return wxT( "" );
}
@@ -508,10 +524,30 @@ void DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::GetValue( wxVariant& aValu
{
wxVariant value;
(*i)->GetValue( value, aCol );
- values.insert( value.GetString() );
+ if( aCol == PIN_TYPE )
+ {
+ wxDataViewIconText it;
+ it << value;
+ values.insert( it.GetText() );
+ }
+ else
+ {
+ values.insert( value.GetString() );
+ }
}
- aValue = boost::algorithm::join( values, "," );
+ if( values.size() > 1 )
+ {
+ wxString value = boost::algorithm::join( values, "," );
+ if( aCol == PIN_TYPE )
+ aValue << wxDataViewIconText( value, wxNullIcon );
+ else
+ aValue = value;
+ }
+ else
+ {
+ m_Members.front()->GetValue( aValue, aCol );
+ }
}
}
@@ -568,7 +604,11 @@ void DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Pin::GetValue( wxVariant& aValue,
break;
case PIN_TYPE:
- aValue = m_Backing->GetElectricalTypeName();
+ {
+ wxIcon icon;
+ icon.CopyFromBitmap( KiBitmap ( GetBitmap( m_Backing->GetType() ) ) );
+ aValue << wxDataViewIconText( m_Backing->GetElectricalTypeName(), icon );
+ }
break;
case PIN_POSITION:
Follow ups
References
-
[PATCH 00/27] My current patch stack
From: Simon Richter, 2015-04-13
-
[PATCH 01/27] Move feature check before dependent tests
From: Simon Richter, 2015-04-13
-
[PATCH 02/27] Use Link Time Optimization with GCC in Release builds
From: Simon Richter, 2015-04-13
-
[PATCH 03/27] Make NETLIST_OBJECT::GetConnectionType() const
From: Simon Richter, 2015-04-13
-
[PATCH 04/27] Remove superfluous cast
From: Simon Richter, 2015-04-13
-
[PATCH 05/27] Separate ElectricPinType and TypeSheetLabel
From: Simon Richter, 2015-04-13
-
[PATCH 06/27] Regenerate "Edit Pin" dialog with newer wxFormBuilder
From: Simon Richter, 2015-04-13
-
[PATCH 07/27] Replace DrawPinShape enum with PinShape
From: Simon Richter, 2015-04-13
-
[PATCH 08/27] PinShapeComboBox: Introduce widget
From: Simon Richter, 2015-04-13
-
[PATCH 09/27] PinShapeComboBox: Fully initialize in c'tor
From: Simon Richter, 2015-04-13
-
[PATCH 10/27] PinShapeComboBox: typesafe Get/Set
From: Simon Richter, 2015-04-13
-
[PATCH 11/27] PinShape: move enum to own header
From: Simon Richter, 2015-04-13
-
[PATCH 12/27] PinShape: move text lookup
From: Simon Richter, 2015-04-13
-
[PATCH 13/27] PinShape: drop list interfaces
From: Simon Richter, 2015-04-13
-
[PATCH 14/27] PinShape: move bitmap lookup
From: Simon Richter, 2015-04-13
-
[PATCH 15/27] ElectricPinType: move definition to pin_type.h
From: Simon Richter, 2015-04-13
-
[PATCH 16/27] ElectricPinType: Use enum rather than int where possible
From: Simon Richter, 2015-04-13
-
[PATCH 17/27] ElectricPinType: Rename PIN_NMAX to PINTYPE_COUNT
From: Simon Richter, 2015-04-13
-
[PATCH 18/27] ElectricPinType: Separate PINTYPE_COUNT from enum
From: Simon Richter, 2015-04-13
-
[PATCH 19/27] PinTypeComboBox: Introduce widget
From: Simon Richter, 2015-04-13
-
[PATCH 20/27] PinTypeComboBox: fully initialize in c'tor
From: Simon Richter, 2015-04-13
-
[PATCH 21/27] PinTypeComboBox: typesafe Get/Set
From: Simon Richter, 2015-04-13
-
[PATCH 22/27] ElectricPinType: move text lookup
From: Simon Richter, 2015-04-13
-
[PATCH 23/27] ElectricPinType: remove list interfaces
From: Simon Richter, 2015-04-13
-
[PATCH 24/27] ElectricPinType: move bitmap lookup
From: Simon Richter, 2015-04-13
-
[PATCH 25/27] TypeSheetLabel: use enum
From: Simon Richter, 2015-04-13