ADDED unit-filtering for pin table.
Fixes https://gitlab.com/kicad/code/kicad/issues/9382
This commit is contained in:
parent
e6c2b12ddf
commit
d5533e7999
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -34,6 +34,7 @@
|
||||||
#include <widgets/grid_icon_text_helpers.h>
|
#include <widgets/grid_icon_text_helpers.h>
|
||||||
#include <widgets/grid_combobox.h>
|
#include <widgets/grid_combobox.h>
|
||||||
#include <widgets/wx_grid.h>
|
#include <widgets/wx_grid.h>
|
||||||
|
#include <widgets/bitmap_button.h>
|
||||||
#include <settings/settings_manager.h>
|
#include <settings/settings_manager.h>
|
||||||
#include <wx/tokenzr.h>
|
#include <wx/tokenzr.h>
|
||||||
#include <string_utils.h>
|
#include <string_utils.h>
|
||||||
|
@ -48,6 +49,7 @@ class PIN_TABLE_DATA_MODEL : public wxGridTableBase
|
||||||
public:
|
public:
|
||||||
PIN_TABLE_DATA_MODEL( SYMBOL_EDIT_FRAME* aFrame, DIALOG_LIB_EDIT_PIN_TABLE* aPinTable ) :
|
PIN_TABLE_DATA_MODEL( SYMBOL_EDIT_FRAME* aFrame, DIALOG_LIB_EDIT_PIN_TABLE* aPinTable ) :
|
||||||
m_frame( aFrame ),
|
m_frame( aFrame ),
|
||||||
|
m_unitFilter( -1 ),
|
||||||
m_edited( false ),
|
m_edited( false ),
|
||||||
m_pinTable( aPinTable )
|
m_pinTable( aPinTable )
|
||||||
{
|
{
|
||||||
|
@ -67,6 +69,7 @@ public:
|
||||||
aEvent.Skip();
|
aEvent.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetUnitFilter( int aFilter ) { m_unitFilter = aFilter; }
|
||||||
|
|
||||||
int GetNumberRows() override { return (int) m_rows.size(); }
|
int GetNumberRows() override { return (int) m_rows.size(); }
|
||||||
int GetNumberCols() override { return COL_COUNT; }
|
int GetNumberCols() override { return COL_COUNT; }
|
||||||
|
@ -119,46 +122,60 @@ public:
|
||||||
case COL_PIN_COUNT:
|
case COL_PIN_COUNT:
|
||||||
val << pins.size();
|
val << pins.size();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_NUMBER:
|
case COL_NUMBER:
|
||||||
val = pin->GetNumber();
|
val = pin->GetNumber();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_NAME:
|
case COL_NAME:
|
||||||
val = pin->GetName();
|
val = pin->GetName();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_TYPE:
|
case COL_TYPE:
|
||||||
val = PinTypeNames()[static_cast<int>( pin->GetType() )];
|
val = PinTypeNames()[static_cast<int>( pin->GetType() )];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_SHAPE:
|
case COL_SHAPE:
|
||||||
val = PinShapeNames()[static_cast<int>( pin->GetShape() )];
|
val = PinShapeNames()[static_cast<int>( pin->GetShape() )];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_ORIENTATION:
|
case COL_ORIENTATION:
|
||||||
if( PinOrientationIndex( pin->GetOrientation() ) >= 0 )
|
if( PinOrientationIndex( pin->GetOrientation() ) >= 0 )
|
||||||
val = PinOrientationNames()[ PinOrientationIndex( pin->GetOrientation() ) ];
|
val = PinOrientationNames()[ PinOrientationIndex( pin->GetOrientation() ) ];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_NUMBER_SIZE:
|
case COL_NUMBER_SIZE:
|
||||||
val = StringFromValue( aUserUnits, pin->GetNumberTextSize(), true );
|
val = StringFromValue( aUserUnits, pin->GetNumberTextSize(), true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_NAME_SIZE:
|
case COL_NAME_SIZE:
|
||||||
val = StringFromValue( aUserUnits, pin->GetNameTextSize(), true );
|
val = StringFromValue( aUserUnits, pin->GetNameTextSize(), true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_LENGTH:
|
case COL_LENGTH:
|
||||||
val = StringFromValue( aUserUnits, pin->GetLength(), true );
|
val = StringFromValue( aUserUnits, pin->GetLength(), true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_POSX:
|
case COL_POSX:
|
||||||
val = StringFromValue( aUserUnits, pin->GetPosition().x, true );
|
val = StringFromValue( aUserUnits, pin->GetPosition().x, true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_POSY:
|
case COL_POSY:
|
||||||
val = StringFromValue( aUserUnits, pin->GetPosition().y, true );
|
val = StringFromValue( aUserUnits, pin->GetPosition().y, true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_VISIBLE:
|
case COL_VISIBLE:
|
||||||
val = StringFromBool( pin->IsVisible() );
|
val = StringFromBool( pin->IsVisible() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_UNIT:
|
case COL_UNIT:
|
||||||
if( pin->GetUnit() )
|
if( pin->GetUnit() )
|
||||||
val = LIB_SYMBOL::SubReference( pin->GetUnit(), false );
|
val = LIB_SYMBOL::SubReference( pin->GetUnit(), false );
|
||||||
else
|
else
|
||||||
val = UNITS_ALL;
|
val = UNITS_ALL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_DEMORGAN:
|
case COL_DEMORGAN:
|
||||||
switch( pin->GetConvert() )
|
switch( pin->GetConvert() )
|
||||||
{
|
{
|
||||||
|
@ -173,6 +190,7 @@ public:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxFAIL;
|
wxFAIL;
|
||||||
break;
|
break;
|
||||||
|
@ -271,9 +289,8 @@ public:
|
||||||
{
|
{
|
||||||
case COL_NUMBER:
|
case COL_NUMBER:
|
||||||
if( !m_pinTable->IsDisplayGrouped() )
|
if( !m_pinTable->IsDisplayGrouped() )
|
||||||
{
|
|
||||||
pin->SetNumber( aValue );
|
pin->SetNumber( aValue );
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_NAME:
|
case COL_NAME:
|
||||||
|
@ -438,18 +455,21 @@ public:
|
||||||
|
|
||||||
for( LIB_PIN* pin : aPins )
|
for( LIB_PIN* pin : aPins )
|
||||||
{
|
{
|
||||||
int rowIndex = -1;
|
if( m_unitFilter == -1 || pin->GetUnit() == 0 || pin->GetUnit() == m_unitFilter )
|
||||||
|
|
||||||
if( groupByName )
|
|
||||||
rowIndex = findRow( m_rows, pin->GetName() );
|
|
||||||
|
|
||||||
if( rowIndex < 0 )
|
|
||||||
{
|
{
|
||||||
m_rows.emplace_back( LIB_PINS() );
|
int rowIndex = -1;
|
||||||
rowIndex = m_rows.size() - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_rows[ rowIndex ].push_back( pin );
|
if( groupByName )
|
||||||
|
rowIndex = findRow( m_rows, pin->GetName() );
|
||||||
|
|
||||||
|
if( rowIndex < 0 )
|
||||||
|
{
|
||||||
|
m_rows.emplace_back( LIB_PINS() );
|
||||||
|
rowIndex = m_rows.size() - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_rows[ rowIndex ].push_back( pin );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int sortCol = 0;
|
int sortCol = 0;
|
||||||
|
@ -545,8 +565,8 @@ private:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( wxString::Format( "string '%s' can't be converted to boolean "
|
wxFAIL_MSG( wxString::Format( "string '%s' can't be converted to boolean correctly, "
|
||||||
"correctly, it will have been perceived as FALSE",
|
"it will have been perceived as FALSE",
|
||||||
aValue ) );
|
aValue ) );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -559,6 +579,7 @@ private:
|
||||||
// data model is a 2D vector. If we're in the single pin case, each row's LIB_PINS
|
// data model is a 2D vector. If we're in the single pin case, each row's LIB_PINS
|
||||||
// contains only a single pin.
|
// contains only a single pin.
|
||||||
std::vector<LIB_PINS> m_rows;
|
std::vector<LIB_PINS> m_rows;
|
||||||
|
int m_unitFilter; // 0 to show pins for all units
|
||||||
|
|
||||||
bool m_edited;
|
bool m_edited;
|
||||||
|
|
||||||
|
@ -659,9 +680,27 @@ DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE( SYMBOL_EDIT_FRAME* parent,
|
||||||
m_deleteButton->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
|
m_deleteButton->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
|
||||||
m_refreshButton->SetBitmap( KiBitmap( BITMAPS::small_refresh ) );
|
m_refreshButton->SetBitmap( KiBitmap( BITMAPS::small_refresh ) );
|
||||||
|
|
||||||
|
m_divider1->SetIsSeparator();
|
||||||
|
m_divider2->SetIsSeparator();
|
||||||
|
|
||||||
GetSizer()->SetSizeHints(this);
|
GetSizer()->SetSizeHints(this);
|
||||||
Centre();
|
Centre();
|
||||||
|
|
||||||
|
if( aSymbol->IsMulti() )
|
||||||
|
{
|
||||||
|
m_unitFilter->Append( UNITS_ALL );
|
||||||
|
|
||||||
|
for( int ii = 0; ii < aSymbol->GetUnitCount(); ++ii )
|
||||||
|
m_unitFilter->Append( aSymbol->GetUnitReference( ii + 1 ) );
|
||||||
|
|
||||||
|
m_unitFilter->SetSelection( -1 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_cbFilterByUnit->Show( false );
|
||||||
|
m_unitFilter->Show( false );
|
||||||
|
}
|
||||||
|
|
||||||
SetupStandardButtons();
|
SetupStandardButtons();
|
||||||
|
|
||||||
if( !parent->IsSymbolEditable() || parent->IsSymbolAlias() )
|
if( !parent->IsSymbolEditable() || parent->IsSymbolAlias() )
|
||||||
|
@ -887,11 +926,35 @@ void DIALOG_LIB_EDIT_PIN_TABLE::OnRebuildRows( wxCommandEvent& )
|
||||||
m_grid->HideCol( COL_PIN_COUNT );
|
m_grid->HideCol( COL_PIN_COUNT );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
adjustGridColumns();
|
adjustGridColumns();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DIALOG_LIB_EDIT_PIN_TABLE::OnFilterCheckBox( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
if( event.IsChecked() )
|
||||||
|
{
|
||||||
|
m_dataModel->SetUnitFilter( m_unitFilter->GetSelection() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_dataModel->SetUnitFilter( -1 );
|
||||||
|
m_unitFilter->SetSelection( -1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
OnRebuildRows( event );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DIALOG_LIB_EDIT_PIN_TABLE::OnFilterChoice( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
m_cbFilterByUnit->SetValue( true );
|
||||||
|
m_dataModel->SetUnitFilter( m_unitFilter->GetSelection() );
|
||||||
|
|
||||||
|
OnRebuildRows( event );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_LIB_EDIT_PIN_TABLE::adjustGridColumns()
|
void DIALOG_LIB_EDIT_PIN_TABLE::adjustGridColumns()
|
||||||
{
|
{
|
||||||
// Account for scroll bars
|
// Account for scroll bars
|
||||||
|
@ -1018,10 +1081,8 @@ void DIALOG_LIB_EDIT_PIN_TABLE::updateSummary()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pin_numbers_summary->SetLabel( pinNumbers.GetSummary() );
|
m_pin_numbers_summary->SetLabel( pinNumbers.GetSummary() );
|
||||||
|
m_pin_count->SetLabel( wxString::Format( wxT( "%lu" ), m_pins.size() ) );
|
||||||
wxString count;
|
|
||||||
count << m_pins.size();
|
|
||||||
m_pin_count->SetLabel( count );
|
|
||||||
|
|
||||||
m_duplicate_pins->SetLabel( pinNumbers.GetDuplicates() );
|
m_duplicate_pins->SetLabel( pinNumbers.GetDuplicates() );
|
||||||
|
|
||||||
|
Layout();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -66,6 +66,8 @@ public:
|
||||||
void OnSize( wxSizeEvent& event ) override;
|
void OnSize( wxSizeEvent& event ) override;
|
||||||
void OnCellEdited( wxGridEvent& event ) override;
|
void OnCellEdited( wxGridEvent& event ) override;
|
||||||
void OnRebuildRows( wxCommandEvent& event ) override;
|
void OnRebuildRows( wxCommandEvent& event ) override;
|
||||||
|
void OnFilterCheckBox( wxCommandEvent& event ) override;
|
||||||
|
void OnFilterChoice( wxCommandEvent& event ) override;
|
||||||
void OnUpdateUI( wxUpdateUIEvent& event ) override;
|
void OnUpdateUI( wxUpdateUIEvent& event ) override;
|
||||||
void OnCancel( wxCommandEvent& event ) override;
|
void OnCancel( wxCommandEvent& event ) override;
|
||||||
void OnClose( wxCloseEvent& event ) override;
|
void OnClose( wxCloseEvent& event ) override;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "widgets/bitmap_button.h"
|
||||||
#include "widgets/wx_grid.h"
|
#include "widgets/wx_grid.h"
|
||||||
|
|
||||||
#include "dialog_lib_edit_pin_table_base.h"
|
#include "dialog_lib_edit_pin_table_base.h"
|
||||||
|
@ -18,42 +19,44 @@ DIALOG_LIB_EDIT_PIN_TABLE_BASE::DIALOG_LIB_EDIT_PIN_TABLE_BASE( wxWindow* parent
|
||||||
wxBoxSizer* top_sizer;
|
wxBoxSizer* top_sizer;
|
||||||
top_sizer = new wxBoxSizer( wxVERTICAL );
|
top_sizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
wxBoxSizer* bSizer7;
|
wxBoxSizer* bSummarySizer;
|
||||||
bSizer7 = new wxBoxSizer( wxHORIZONTAL );
|
bSummarySizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
wxBoxSizer* bPinNumbersSizer;
|
|
||||||
bPinNumbersSizer = new wxBoxSizer( wxHORIZONTAL );
|
|
||||||
|
|
||||||
m_staticTextPinNumbers = new wxStaticText( this, wxID_ANY, _("Pin numbers:"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_staticTextPinNumbers = new wxStaticText( this, wxID_ANY, _("Pin numbers:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_staticTextPinNumbers->Wrap( -1 );
|
m_staticTextPinNumbers->Wrap( -1 );
|
||||||
bPinNumbersSizer->Add( m_staticTextPinNumbers, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
bSummarySizer->Add( m_staticTextPinNumbers, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||||
|
|
||||||
m_pin_numbers_summary = new wxStaticText( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_pin_numbers_summary = new wxStaticText( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_pin_numbers_summary->Wrap( -1 );
|
m_pin_numbers_summary->Wrap( -1 );
|
||||||
bPinNumbersSizer->Add( m_pin_numbers_summary, 1, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
bSummarySizer->Add( m_pin_numbers_summary, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||||
|
|
||||||
|
|
||||||
bSizer7->Add( bPinNumbersSizer, 1, wxEXPAND, 5 );
|
bSummarySizer->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||||
|
|
||||||
wxBoxSizer* bPinCountSizer;
|
|
||||||
bPinCountSizer = new wxBoxSizer( wxHORIZONTAL );
|
|
||||||
|
|
||||||
m_staticTextPinCount = new wxStaticText( this, wxID_ANY, _("Pin count:"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_staticTextPinCount = new wxStaticText( this, wxID_ANY, _("Pin count:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_staticTextPinCount->Wrap( -1 );
|
m_staticTextPinCount->Wrap( -1 );
|
||||||
bPinCountSizer->Add( m_staticTextPinCount, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 10 );
|
bSummarySizer->Add( m_staticTextPinCount, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 10 );
|
||||||
|
|
||||||
m_pin_count = new wxStaticText( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_pin_count = new wxStaticText( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_pin_count->Wrap( -1 );
|
m_pin_count->Wrap( -1 );
|
||||||
bPinCountSizer->Add( m_pin_count, 1, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
bSummarySizer->Add( m_pin_count, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||||
|
|
||||||
|
|
||||||
bSizer7->Add( bPinCountSizer, 0, wxRIGHT|wxLEFT, 10 );
|
bSummarySizer->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
m_staticTextDuplicatePins = new wxStaticText( this, wxID_ANY, _("Duplicate pins:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_staticTextDuplicatePins->Wrap( -1 );
|
||||||
|
bSummarySizer->Add( m_staticTextDuplicatePins, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 10 );
|
||||||
|
|
||||||
|
m_duplicate_pins = new wxStaticText( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_duplicate_pins->Wrap( -1 );
|
||||||
|
bSummarySizer->Add( m_duplicate_pins, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||||
|
|
||||||
|
|
||||||
top_sizer->Add( bSizer7, 0, wxEXPAND|wxTOP|wxLEFT, 10 );
|
top_sizer->Add( bSummarySizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
|
||||||
|
|
||||||
wxBoxSizer* bSizer8;
|
wxBoxSizer* bGridMarginsSizer;
|
||||||
bSizer8 = new wxBoxSizer( wxVERTICAL );
|
bGridMarginsSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
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 );
|
||||||
|
|
||||||
|
@ -108,57 +111,49 @@ DIALOG_LIB_EDIT_PIN_TABLE_BASE::DIALOG_LIB_EDIT_PIN_TABLE_BASE( wxWindow* parent
|
||||||
m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
|
m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
|
||||||
m_grid->SetMinSize( wxSize( 690,200 ) );
|
m_grid->SetMinSize( wxSize( 690,200 ) );
|
||||||
|
|
||||||
bSizer8->Add( m_grid, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 10 );
|
bGridMarginsSizer->Add( m_grid, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 10 );
|
||||||
|
|
||||||
|
|
||||||
top_sizer->Add( bSizer8, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
top_sizer->Add( bGridMarginsSizer, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
wxBoxSizer* bSizer2;
|
wxBoxSizer* bBottomSizer;
|
||||||
bSizer2 = new wxBoxSizer( wxHORIZONTAL );
|
bBottomSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
m_addButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
m_addButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||||
bSizer2->Add( m_addButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
bBottomSizer->Add( m_addButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||||
|
|
||||||
|
|
||||||
bSizer2->Add( 20, 0, 0, wxEXPAND, 5 );
|
bBottomSizer->Add( 20, 0, 0, wxEXPAND, 5 );
|
||||||
|
|
||||||
m_deleteButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
m_deleteButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||||
bSizer2->Add( m_deleteButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 10 );
|
bBottomSizer->Add( m_deleteButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 10 );
|
||||||
|
|
||||||
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
|
m_divider1 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||||
bSizer2->Add( m_staticline1, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 );
|
m_divider1->Enable( false );
|
||||||
|
|
||||||
|
bBottomSizer->Add( m_divider1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 10 );
|
||||||
|
|
||||||
m_cbGroup = new wxCheckBox( this, wxID_ANY, _("Group by name"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_cbGroup = new wxCheckBox( this, wxID_ANY, _("Group by name"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
bSizer2->Add( m_cbGroup, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 10 );
|
bBottomSizer->Add( m_cbGroup, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 10 );
|
||||||
|
|
||||||
m_refreshButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
m_refreshButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||||
bSizer2->Add( m_refreshButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 10 );
|
bBottomSizer->Add( m_refreshButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 10 );
|
||||||
|
|
||||||
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
|
m_divider2 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||||
bSizer2->Add( m_staticline2, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 10 );
|
m_divider2->Enable( false );
|
||||||
|
|
||||||
wxBoxSizer* bSizer3;
|
bBottomSizer->Add( m_divider2, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 10 );
|
||||||
bSizer3 = new wxBoxSizer( wxVERTICAL );
|
|
||||||
|
|
||||||
wxBoxSizer* bDuplicatePinSizer;
|
m_cbFilterByUnit = new wxCheckBox( this, wxID_ANY, _("Filter by unit:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
bDuplicatePinSizer = new wxBoxSizer( wxHORIZONTAL );
|
bBottomSizer->Add( m_cbFilterByUnit, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
|
||||||
|
|
||||||
m_staticTextDuplicatePins = new wxStaticText( this, wxID_ANY, _("Duplicate pins:"), wxDefaultPosition, wxDefaultSize, 0 );
|
wxArrayString m_unitFilterChoices;
|
||||||
m_staticTextDuplicatePins->Wrap( -1 );
|
m_unitFilter = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_unitFilterChoices, 0 );
|
||||||
bDuplicatePinSizer->Add( m_staticTextDuplicatePins, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 10 );
|
m_unitFilter->SetSelection( 0 );
|
||||||
|
bBottomSizer->Add( m_unitFilter, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||||
m_duplicate_pins = new wxStaticText( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
m_duplicate_pins->Wrap( -1 );
|
|
||||||
bDuplicatePinSizer->Add( m_duplicate_pins, 1, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
bSizer3->Add( bDuplicatePinSizer, 1, wxEXPAND, 5 );
|
bBottomSizer->Add( 30, 0, 1, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
|
||||||
bSizer2->Add( bSizer3, 1, wxEXPAND, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
bSizer2->Add( 10, 0, 0, wxEXPAND, 5 );
|
|
||||||
|
|
||||||
m_Buttons = new wxStdDialogButtonSizer();
|
m_Buttons = new wxStdDialogButtonSizer();
|
||||||
m_ButtonsOK = new wxButton( this, wxID_OK );
|
m_ButtonsOK = new wxButton( this, wxID_OK );
|
||||||
|
@ -167,10 +162,10 @@ DIALOG_LIB_EDIT_PIN_TABLE_BASE::DIALOG_LIB_EDIT_PIN_TABLE_BASE( wxWindow* parent
|
||||||
m_Buttons->AddButton( m_ButtonsCancel );
|
m_Buttons->AddButton( m_ButtonsCancel );
|
||||||
m_Buttons->Realize();
|
m_Buttons->Realize();
|
||||||
|
|
||||||
bSizer2->Add( m_Buttons, 0, wxEXPAND|wxALL, 5 );
|
bBottomSizer->Add( m_Buttons, 0, wxEXPAND|wxALL, 5 );
|
||||||
|
|
||||||
|
|
||||||
top_sizer->Add( bSizer2, 0, wxLEFT|wxEXPAND, 10 );
|
top_sizer->Add( bBottomSizer, 0, wxLEFT|wxEXPAND, 10 );
|
||||||
|
|
||||||
|
|
||||||
this->SetSizer( top_sizer );
|
this->SetSizer( top_sizer );
|
||||||
|
@ -188,6 +183,8 @@ DIALOG_LIB_EDIT_PIN_TABLE_BASE::DIALOG_LIB_EDIT_PIN_TABLE_BASE( wxWindow* parent
|
||||||
m_deleteButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnDeleteRow ), NULL, this );
|
m_deleteButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnDeleteRow ), NULL, this );
|
||||||
m_cbGroup->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnRebuildRows ), NULL, this );
|
m_cbGroup->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnRebuildRows ), NULL, this );
|
||||||
m_refreshButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnRebuildRows ), NULL, this );
|
m_refreshButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnRebuildRows ), NULL, this );
|
||||||
|
m_cbFilterByUnit->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnFilterCheckBox ), NULL, this );
|
||||||
|
m_unitFilter->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnFilterChoice ), NULL, this );
|
||||||
m_ButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnCancel ), NULL, this );
|
m_ButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnCancel ), NULL, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,6 +199,8 @@ DIALOG_LIB_EDIT_PIN_TABLE_BASE::~DIALOG_LIB_EDIT_PIN_TABLE_BASE()
|
||||||
m_deleteButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnDeleteRow ), NULL, this );
|
m_deleteButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnDeleteRow ), NULL, this );
|
||||||
m_cbGroup->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnRebuildRows ), NULL, this );
|
m_cbGroup->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnRebuildRows ), NULL, this );
|
||||||
m_refreshButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnRebuildRows ), NULL, this );
|
m_refreshButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnRebuildRows ), NULL, this );
|
||||||
|
m_cbFilterByUnit->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnFilterCheckBox ), NULL, this );
|
||||||
|
m_unitFilter->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnFilterChoice ), NULL, this );
|
||||||
m_ButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnCancel ), NULL, this );
|
m_ButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnCancel ), NULL, this );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -10,6 +10,7 @@
|
||||||
#include <wx/artprov.h>
|
#include <wx/artprov.h>
|
||||||
#include <wx/xrc/xmlres.h>
|
#include <wx/xrc/xmlres.h>
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
|
class BITMAP_BUTTON;
|
||||||
class WX_GRID;
|
class WX_GRID;
|
||||||
|
|
||||||
#include "dialog_shim.h"
|
#include "dialog_shim.h"
|
||||||
|
@ -26,8 +27,8 @@ class WX_GRID;
|
||||||
#include <wx/image.h>
|
#include <wx/image.h>
|
||||||
#include <wx/icon.h>
|
#include <wx/icon.h>
|
||||||
#include <wx/button.h>
|
#include <wx/button.h>
|
||||||
#include <wx/statline.h>
|
|
||||||
#include <wx/checkbox.h>
|
#include <wx/checkbox.h>
|
||||||
|
#include <wx/choice.h>
|
||||||
#include <wx/dialog.h>
|
#include <wx/dialog.h>
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -45,15 +46,17 @@ class DIALOG_LIB_EDIT_PIN_TABLE_BASE : public DIALOG_SHIM
|
||||||
wxStaticText* m_pin_numbers_summary;
|
wxStaticText* m_pin_numbers_summary;
|
||||||
wxStaticText* m_staticTextPinCount;
|
wxStaticText* m_staticTextPinCount;
|
||||||
wxStaticText* m_pin_count;
|
wxStaticText* m_pin_count;
|
||||||
|
wxStaticText* m_staticTextDuplicatePins;
|
||||||
|
wxStaticText* m_duplicate_pins;
|
||||||
WX_GRID* m_grid;
|
WX_GRID* m_grid;
|
||||||
wxBitmapButton* m_addButton;
|
wxBitmapButton* m_addButton;
|
||||||
wxBitmapButton* m_deleteButton;
|
wxBitmapButton* m_deleteButton;
|
||||||
wxStaticLine* m_staticline1;
|
BITMAP_BUTTON* m_divider1;
|
||||||
wxCheckBox* m_cbGroup;
|
wxCheckBox* m_cbGroup;
|
||||||
wxBitmapButton* m_refreshButton;
|
wxBitmapButton* m_refreshButton;
|
||||||
wxStaticLine* m_staticline2;
|
BITMAP_BUTTON* m_divider2;
|
||||||
wxStaticText* m_staticTextDuplicatePins;
|
wxCheckBox* m_cbFilterByUnit;
|
||||||
wxStaticText* m_duplicate_pins;
|
wxChoice* m_unitFilter;
|
||||||
wxStdDialogButtonSizer* m_Buttons;
|
wxStdDialogButtonSizer* m_Buttons;
|
||||||
wxButton* m_ButtonsOK;
|
wxButton* m_ButtonsOK;
|
||||||
wxButton* m_ButtonsCancel;
|
wxButton* m_ButtonsCancel;
|
||||||
|
@ -66,6 +69,8 @@ class DIALOG_LIB_EDIT_PIN_TABLE_BASE : public DIALOG_SHIM
|
||||||
virtual void OnAddRow( wxCommandEvent& event ) = 0;
|
virtual void OnAddRow( wxCommandEvent& event ) = 0;
|
||||||
virtual void OnDeleteRow( wxCommandEvent& event ) = 0;
|
virtual void OnDeleteRow( wxCommandEvent& event ) = 0;
|
||||||
virtual void OnRebuildRows( wxCommandEvent& event ) = 0;
|
virtual void OnRebuildRows( wxCommandEvent& event ) = 0;
|
||||||
|
virtual void OnFilterCheckBox( wxCommandEvent& event ) = 0;
|
||||||
|
virtual void OnFilterChoice( wxCommandEvent& event ) = 0;
|
||||||
virtual void OnCancel( wxCommandEvent& event ) = 0;
|
virtual void OnCancel( wxCommandEvent& event ) = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017 Oliver Walters
|
* Copyright (C) 2017 Oliver Walters
|
||||||
* Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2017-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -62,7 +62,7 @@
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
MYID_SELECT_FOOTPRINT = GRIDTRICKS_FIRST_SHOWHIDE - 2, // must be within GRID_TRICKS' enum range
|
MYID_SELECT_FOOTPRINT = GRIDTRICKS_FIRST_CLIENT_ID,
|
||||||
MYID_SHOW_DATASHEET
|
MYID_SHOW_DATASHEET
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
MYID_SELECT_FOOTPRINT = GRIDTRICKS_FIRST_SHOWHIDE - 2, // must be within GRID_TRICKS' enum range
|
MYID_SELECT_FOOTPRINT = GRIDTRICKS_FIRST_CLIENT_ID,
|
||||||
MYID_SHOW_DATASHEET
|
MYID_SHOW_DATASHEET
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Simon Richter
|
* Copyright (C) 2015 Simon Richter
|
||||||
* Copyright (C) 2015 KiCad Developers, see AUTHORS.TXT for contributors.
|
* Copyright (C) 2015-2022 KiCad Developers, see AUTHORS.TXT for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "pin_numbers.h"
|
#include "pin_numbers.h"
|
||||||
#include <wx/crt.h>
|
#include <wx/crt.h>
|
||||||
|
#include <wx/translation.h>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -121,6 +122,9 @@ wxString PIN_NUMBERS::GetDuplicates() const
|
||||||
// Remove the trailing comma
|
// Remove the trailing comma
|
||||||
ret.RemoveLast();
|
ret.RemoveLast();
|
||||||
|
|
||||||
|
if( ret.IsEmpty() )
|
||||||
|
ret = _( "none" );
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 2012-2020 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 2012-2022 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -43,7 +43,10 @@ enum
|
||||||
GRIDTRICKS_ID_PASTE,
|
GRIDTRICKS_ID_PASTE,
|
||||||
GRIDTRICKS_ID_SELECT,
|
GRIDTRICKS_ID_SELECT,
|
||||||
|
|
||||||
GRIDTRICKS_FIRST_SHOWHIDE = 949, // reserve IDs for show/hide-column-n
|
GRIDTRICKS_FIRST_CLIENT_ID = 1101, // reserve IDs for sub-classes
|
||||||
|
GRID_TRICKS_LAST_CLIENT_ID = 2100,
|
||||||
|
|
||||||
|
GRIDTRICKS_FIRST_SHOWHIDE, // reserve IDs for show/hide-column-n
|
||||||
|
|
||||||
GRIDTRICKS_LAST_ID = GRIDTRICKS_FIRST_SHOWHIDE + GRIDTRICKS_MAX_COL
|
GRIDTRICKS_LAST_ID = GRIDTRICKS_FIRST_SHOWHIDE + GRIDTRICKS_MAX_COL
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue