Add a layer pair preset list

This will later be used for a quick switcher UI. This commit
adds the data structures, set-up UI and project file persistance.

Relates-To: https://gitlab.com/kicad/code/kicad/-/issues/15227
This commit is contained in:
John Beard
2024-08-06 23:45:55 +08:00
parent db457f52fa
commit edf13bdfd0
16 changed files with 1852 additions and 819 deletions
+58 -13
View File
@@ -1,10 +1,12 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.1.0-0-g733bf3d)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "widgets/wx_grid.h"
#include "dialog_layer_selection_base.h"
///////////////////////////////////////////////////////////////////////////
@@ -14,7 +16,7 @@ DIALOG_LAYER_SELECTION_BASE::DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWi
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
bSizerMain = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizerUpper;
bSizerUpper = new wxBoxSizer( wxHORIZONTAL );
@@ -153,7 +155,7 @@ DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
bSizerLeft->Add( m_leftGridLayers, 0, wxALL|wxEXPAND, 5 );
bSizerUpper->Add( bSizerLeft, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
bSizerUpper->Add( bSizerLeft, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizerRight;
bSizerRight = new wxBoxSizer( wxVERTICAL );
@@ -192,7 +194,59 @@ DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
bSizerRight->Add( m_rightGridLayers, 0, wxALL|wxEXPAND, 5 );
bSizerUpper->Add( bSizerRight, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
bSizerUpper->Add( bSizerRight, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxVERTICAL );
m_addToPresetsButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
bSizer7->Add( m_addToPresetsButton, 0, wxALL, 5 );
bSizerUpper->Add( bSizer7, 0, wxALIGN_CENTER_VERTICAL, 5 );
wxStaticBoxSizer* m_presetsSizer;
m_presetsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Copper layer pair presets") ), wxVERTICAL );
m_presetsGrid = new WX_GRID( m_presetsSizer->GetStaticBox(), ID_LEFT_LIST, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_presetsGrid->CreateGrid( 0, 4 );
m_presetsGrid->EnableEditing( true );
m_presetsGrid->EnableGridLines( true );
m_presetsGrid->EnableDragGridSize( false );
m_presetsGrid->SetMargins( 5, 3 );
// Columns
m_presetsGrid->SetColSize( 0, 60 );
m_presetsGrid->SetColSize( 1, 24 );
m_presetsGrid->SetColSize( 2, 100 );
m_presetsGrid->SetColSize( 3, 200 );
m_presetsGrid->EnableDragColMove( false );
m_presetsGrid->EnableDragColSize( false );
m_presetsGrid->SetColLabelValue( 0, _("Enabled") );
m_presetsGrid->SetColLabelValue( 1, wxEmptyString );
m_presetsGrid->SetColLabelValue( 2, _("Layers") );
m_presetsGrid->SetColLabelValue( 3, _("Label") );
m_presetsGrid->SetColLabelSize( wxGRID_AUTOSIZE );
m_presetsGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
m_presetsGrid->EnableDragRowSize( false );
m_presetsGrid->SetRowLabelSize( 0 );
m_presetsGrid->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Label Appearance
// Cell Defaults
m_presetsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_CENTER );
m_presetsSizer->Add( m_presetsGrid, 1, wxALL|wxEXPAND, 0 );
m_deleteRowButton = new wxBitmapButton( m_presetsSizer->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_presetsSizer->Add( m_deleteRowButton, 0, wxALL, 5 );
bSizerUpper->Add( m_presetsSizer, 1, wxEXPAND, 5 );
bSizerMain->Add( bSizerUpper, 1, wxALL|wxEXPAND, 5 );
@@ -209,19 +263,10 @@ DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
this->SetSizer( bSizerMain );
this->Layout();
bSizerMain->Fit( this );
this->Centre( wxBOTH );
// Connect Events
m_leftGridLayers->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnLeftGridCellClick ), NULL, this );
m_rightGridLayers->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnRightGridCellClick ), NULL, this );
}
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::~DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE()
{
// Disconnect Events
m_leftGridLayers->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnLeftGridCellClick ), NULL, this );
m_rightGridLayers->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnRightGridCellClick ), NULL, this );
}