Eeschema: Add pin count column to pin table
ADDED: When the pin table is showing grouped pins, display a read-only column that displays the number of pins in each row. Fixes https://gitlab.com/kicad/code/kicad/-/issues/2416
This commit is contained in:
parent
08ca19f95d
commit
56794ab829
|
@ -66,6 +66,7 @@ public:
|
||||||
{
|
{
|
||||||
switch( aCol )
|
switch( aCol )
|
||||||
{
|
{
|
||||||
|
case COL_PIN_COUNT: return _( "Count" );
|
||||||
case COL_NUMBER: return _( "Number" );
|
case COL_NUMBER: return _( "Number" );
|
||||||
case COL_NAME: return _( "Name" );
|
case COL_NAME: return _( "Name" );
|
||||||
case COL_TYPE: return _( "Electrical Type" );
|
case COL_TYPE: return _( "Electrical Type" );
|
||||||
|
@ -104,6 +105,7 @@ public:
|
||||||
|
|
||||||
switch( aCol )
|
switch( aCol )
|
||||||
{
|
{
|
||||||
|
case COL_PIN_COUNT: val << pins.size(); break;
|
||||||
case COL_NUMBER:
|
case COL_NUMBER:
|
||||||
val = pin->GetNumber();
|
val = pin->GetNumber();
|
||||||
break;
|
break;
|
||||||
|
@ -463,6 +465,10 @@ DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE( SYMBOL_EDIT_FRAME* parent,
|
||||||
// Set special attributes
|
// Set special attributes
|
||||||
wxGridCellAttr* attr;
|
wxGridCellAttr* attr;
|
||||||
|
|
||||||
|
attr = new wxGridCellAttr;
|
||||||
|
attr->SetReadOnly( true );
|
||||||
|
m_grid->SetColAttr( COL_PIN_COUNT, attr );
|
||||||
|
|
||||||
attr = new wxGridCellAttr;
|
attr = new wxGridCellAttr;
|
||||||
wxArrayString typeNames = PinTypeNames();
|
wxArrayString typeNames = PinTypeNames();
|
||||||
typeNames.push_back( INDETERMINATE_STATE );
|
typeNames.push_back( INDETERMINATE_STATE );
|
||||||
|
@ -558,6 +564,11 @@ bool DIALOG_LIB_EDIT_PIN_TABLE::TransferDataToWindow()
|
||||||
|
|
||||||
m_dataModel->RebuildRows( m_pins, m_cbGroup->GetValue() );
|
m_dataModel->RebuildRows( m_pins, m_cbGroup->GetValue() );
|
||||||
|
|
||||||
|
if( m_cbGroup->GetValue() )
|
||||||
|
m_grid->ShowCol( COL_PIN_COUNT );
|
||||||
|
else
|
||||||
|
m_grid->HideCol( COL_PIN_COUNT );
|
||||||
|
|
||||||
updateSummary();
|
updateSummary();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -635,8 +646,8 @@ void DIALOG_LIB_EDIT_PIN_TABLE::OnAddRow( wxCommandEvent& event )
|
||||||
|
|
||||||
m_dataModel->AppendRow( m_pins[ m_pins.size() - 1 ] );
|
m_dataModel->AppendRow( m_pins[ m_pins.size() - 1 ] );
|
||||||
|
|
||||||
m_grid->MakeCellVisible( m_grid->GetNumberRows() - 1, 0 );
|
m_grid->MakeCellVisible( m_grid->GetNumberRows() - 1, 1 );
|
||||||
m_grid->SetGridCursor( m_grid->GetNumberRows() - 1, 0 );
|
m_grid->SetGridCursor( m_grid->GetNumberRows() - 1, 1 );
|
||||||
|
|
||||||
m_grid->EnableCellEditControl( true );
|
m_grid->EnableCellEditControl( true );
|
||||||
m_grid->ShowCellEditControl();
|
m_grid->ShowCellEditControl();
|
||||||
|
@ -687,6 +698,17 @@ void DIALOG_LIB_EDIT_PIN_TABLE::OnRebuildRows( wxCommandEvent& )
|
||||||
|
|
||||||
m_dataModel->RebuildRows( m_pins, m_cbGroup->GetValue() );
|
m_dataModel->RebuildRows( m_pins, m_cbGroup->GetValue() );
|
||||||
|
|
||||||
|
if( m_cbGroup->GetValue() )
|
||||||
|
{
|
||||||
|
m_grid->ShowCol( COL_PIN_COUNT );
|
||||||
|
m_grid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_grid->HideCol( COL_PIN_COUNT );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
adjustGridColumns();
|
adjustGridColumns();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
enum COL_ORDER
|
enum COL_ORDER
|
||||||
{
|
{
|
||||||
|
COL_PIN_COUNT,
|
||||||
COL_NUMBER,
|
COL_NUMBER,
|
||||||
COL_NAME,
|
COL_NAME,
|
||||||
COL_TYPE,
|
COL_TYPE,
|
||||||
|
@ -40,7 +41,7 @@ enum COL_ORDER
|
||||||
COL_POSY,
|
COL_POSY,
|
||||||
COL_VISIBLE,
|
COL_VISIBLE,
|
||||||
|
|
||||||
COL_COUNT // keep as last
|
COL_COUNT // keep as last
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,38 +21,40 @@ DIALOG_LIB_EDIT_PIN_TABLE_BASE::DIALOG_LIB_EDIT_PIN_TABLE_BASE( wxWindow* parent
|
||||||
m_grid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxSize( 800,400 ), 0 );
|
m_grid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxSize( 800,400 ), 0 );
|
||||||
|
|
||||||
// Grid
|
// Grid
|
||||||
m_grid->CreateGrid( 5, 11 );
|
m_grid->CreateGrid( 5, 12 );
|
||||||
m_grid->EnableEditing( true );
|
m_grid->EnableEditing( true );
|
||||||
m_grid->EnableGridLines( true );
|
m_grid->EnableGridLines( true );
|
||||||
m_grid->EnableDragGridSize( false );
|
m_grid->EnableDragGridSize( false );
|
||||||
m_grid->SetMargins( 0, 0 );
|
m_grid->SetMargins( 0, 0 );
|
||||||
|
|
||||||
// Columns
|
// Columns
|
||||||
m_grid->SetColSize( 0, 66 );
|
m_grid->SetColSize( 0, 60 );
|
||||||
m_grid->SetColSize( 1, 84 );
|
m_grid->SetColSize( 1, 66 );
|
||||||
m_grid->SetColSize( 2, 140 );
|
m_grid->SetColSize( 2, 84 );
|
||||||
m_grid->SetColSize( 3, 140 );
|
m_grid->SetColSize( 3, 140 );
|
||||||
m_grid->SetColSize( 4, 100 );
|
m_grid->SetColSize( 4, 140 );
|
||||||
m_grid->SetColSize( 5, 110 );
|
m_grid->SetColSize( 5, 100 );
|
||||||
m_grid->SetColSize( 6, 110 );
|
m_grid->SetColSize( 6, 110 );
|
||||||
m_grid->SetColSize( 7, 84 );
|
m_grid->SetColSize( 7, 110 );
|
||||||
m_grid->SetColSize( 8, 84 );
|
m_grid->SetColSize( 8, 84 );
|
||||||
m_grid->SetColSize( 9, 84 );
|
m_grid->SetColSize( 9, 84 );
|
||||||
m_grid->SetColSize( 10, 84 );
|
m_grid->SetColSize( 10, 84 );
|
||||||
|
m_grid->SetColSize( 11, 84 );
|
||||||
m_grid->EnableDragColMove( false );
|
m_grid->EnableDragColMove( false );
|
||||||
m_grid->EnableDragColSize( true );
|
m_grid->EnableDragColSize( true );
|
||||||
m_grid->SetColLabelSize( 24 );
|
m_grid->SetColLabelSize( 24 );
|
||||||
m_grid->SetColLabelValue( 0, _("Number") );
|
m_grid->SetColLabelValue( 0, _("Count") );
|
||||||
m_grid->SetColLabelValue( 1, _("Name") );
|
m_grid->SetColLabelValue( 1, _("Number") );
|
||||||
m_grid->SetColLabelValue( 2, _("Electrical Type") );
|
m_grid->SetColLabelValue( 2, _("Name") );
|
||||||
m_grid->SetColLabelValue( 3, _("Graphic Style") );
|
m_grid->SetColLabelValue( 3, _("Electrical Type") );
|
||||||
m_grid->SetColLabelValue( 4, _("Orientation") );
|
m_grid->SetColLabelValue( 4, _("Graphic Style") );
|
||||||
m_grid->SetColLabelValue( 5, _("Number Text Size") );
|
m_grid->SetColLabelValue( 5, _("Orientation") );
|
||||||
m_grid->SetColLabelValue( 6, _("Name Text Size") );
|
m_grid->SetColLabelValue( 6, _("Number Text Size") );
|
||||||
m_grid->SetColLabelValue( 7, _("Length") );
|
m_grid->SetColLabelValue( 7, _("Name Text Size") );
|
||||||
m_grid->SetColLabelValue( 8, _("X Position") );
|
m_grid->SetColLabelValue( 8, _("Length") );
|
||||||
m_grid->SetColLabelValue( 9, _("Y Position") );
|
m_grid->SetColLabelValue( 9, _("X Position") );
|
||||||
m_grid->SetColLabelValue( 10, _("Visible") );
|
m_grid->SetColLabelValue( 10, _("Y Position") );
|
||||||
|
m_grid->SetColLabelValue( 11, _("Visible") );
|
||||||
m_grid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
m_grid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||||
|
|
||||||
// Rows
|
// Rows
|
||||||
|
|
|
@ -88,10 +88,10 @@
|
||||||
<property name="close_button">1</property>
|
<property name="close_button">1</property>
|
||||||
<property name="col_label_horiz_alignment">wxALIGN_CENTER</property>
|
<property name="col_label_horiz_alignment">wxALIGN_CENTER</property>
|
||||||
<property name="col_label_size">24</property>
|
<property name="col_label_size">24</property>
|
||||||
<property name="col_label_values">"Number" "Name" "Electrical Type" "Graphic Style" "Orientation" "Number Text Size" "Name Text Size" "Length" "X Position" "Y Position" "Visible"</property>
|
<property name="col_label_values">"Count" "Number" "Name" "Electrical Type" "Graphic Style" "Orientation" "Number Text Size" "Name Text Size" "Length" "X Position" "Y Position" "Visible"</property>
|
||||||
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
|
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
|
||||||
<property name="cols">11</property>
|
<property name="cols">12</property>
|
||||||
<property name="column_sizes">66,84,140,140,100,110,110,84,84,84,84</property>
|
<property name="column_sizes">60,66,84,140,140,100,110,110,84,84,84,84</property>
|
||||||
<property name="context_help"></property>
|
<property name="context_help"></property>
|
||||||
<property name="context_menu">1</property>
|
<property name="context_menu">1</property>
|
||||||
<property name="default_pane">0</property>
|
<property name="default_pane">0</property>
|
||||||
|
|
|
@ -77,7 +77,7 @@ SYMBOL_EDITOR_SETTINGS::SYMBOL_EDITOR_SETTINGS() :
|
||||||
&m_EditSymbolVisibleColumns, "0 1 2 3 4 5 6 7" ) );
|
&m_EditSymbolVisibleColumns, "0 1 2 3 4 5 6 7" ) );
|
||||||
|
|
||||||
m_params.emplace_back( new PARAM<wxString>( "pin_table_visible_columns",
|
m_params.emplace_back( new PARAM<wxString>( "pin_table_visible_columns",
|
||||||
&m_PinTableVisibleColumns, "0 1 2 3 4 8 9" ) );
|
&m_PinTableVisibleColumns, "0 1 2 3 4 5 9 10" ) );
|
||||||
|
|
||||||
m_params.emplace_back( new PARAM<bool>( "use_eeschema_color_settings",
|
m_params.emplace_back( new PARAM<bool>( "use_eeschema_color_settings",
|
||||||
&m_UseEeschemaColorSettings, true ) );
|
&m_UseEeschemaColorSettings, true ) );
|
||||||
|
|
Loading…
Reference in New Issue