51#define SELECT_COLNUM 0
53#define LAYERNAME_COLNUM 2
54#define LAYER_HK_COLUMN 3
95 return layerAName + wxT(
" / " ) + layerBName;
106 LSET aNotAllowedLayersMask,
bool aHideCheckBoxes =
false );
115 void OnMouseMove( wxUpdateUIEvent& aEvent )
override;
137 LSET aNotAllowedLayersMask,
bool aHideCheckBoxes ) :
154 if( aHideCheckBoxes )
163 GetSizer()->SetSizeHints(
this );
211 if( event.GetKeyCode() == WXK_ESCAPE )
229 wxColour
color( wxColour::AlphaBlend( fg.Red(), bg.Red(), fg.Alpha() / 255.0 ),
230 wxColour::AlphaBlend( fg.Green(), bg.Green(), fg.Alpha() / 255.0 ),
231 wxColour::AlphaBlend( fg.Blue(), bg.Blue(), fg.Alpha() / 255.0 ) );
302 wxPoint aDlgPosition )
306 if( aDlgPosition != wxDefaultPosition )
308 wxSize dlgSize = dlg.GetSize();
309 aDlgPosition.x -= dlgSize.x / 2;
310 aDlgPosition.y -= dlgSize.y / 2;
341 wxASSERT_MSG(
m_grid.GetNumberRows() == 0,
"Grid should be empty at controller start" );
346 m_grid.Bind( wxEVT_GRID_CELL_CHANGED,
347 [
this]( wxGridEvent& aEvent )
349 const int col = aEvent.GetCol();
350 const int row = aEvent.GetRow();
361 m_grid.Bind( wxEVT_GRID_CELL_LEFT_DCLICK,
362 [&]( wxGridEvent& aEvent )
364 const int row = aEvent.GetRow();
365 const int col = aEvent.GetCol();
374 std::make_unique<WX_GRID_AUTOSIZER>(
m_grid,
397 int row =
m_grid.GetGridCursorRow();
411 m_grid.UseNativeColHeader(
true );
413 m_grid.SetCellHighlightPenWidth( 0 );
416 m_grid.SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
425 m_grid.AppendRows( storePairs.size() );
437 wxASSERT_MSG( aRow <
m_grid.GetNumberRows(),
"Row index out of bounds" );
445 const std::optional<wxString> userName = aLayerPairInfo.
GetName();
452 aLayerPairInfo.
IsEnabled() ? wxT(
"1" ) : wxT(
"0" ) );
455 std::unique_ptr<wxBitmap>& swatch =
469 changedPair.
SetName( aNewValue );
532 [
this]( wxGridEvent& aEvent )
538 [
this]( wxGridEvent& aEvent )
544 [
this]( wxCommandEvent& aEvent )
556 aGrid.SetCellHighlightPenWidth( 0 );
570 const wxColour
color(
571 wxColour::AlphaBlend( fg.Red(), bg.Red(), fg.Alpha() / 255.0 ),
572 wxColour::AlphaBlend( fg.Green(), bg.Green(), fg.Alpha() / 255.0 ),
573 wxColour::AlphaBlend( fg.Blue(), bg.Blue(), fg.Alpha() / 255.0 ) );
591 for(
unsigned i = 0; i <
m_layersId.size(); ++i )
599 wxASSERT_MSG(
false, wxString::Format(
"Unknown layer in grid: %d", aLayerId ) );
631 const auto selectGridRow = []( wxGrid& aGrid,
int aRow,
bool aSelect )
638 const wxString val = aSelect ? wxT(
"1" ) : wxEmptyString;
691 [
this]( wxCommandEvent& aEvent )
699 [
this]( wxCommandEvent& aEvent )
706 GetSizer()->SetSizeHints(
this );
755 wxASSERT_MSG(
false,
"Could not access layer pair settings" );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
int KiIconScale(wxWindow *aWindow)
Return the automatic scale factor that would be used for a given window by KiScaledBitmap and KiScale...
wxString m_ColorTheme
Active color theme name.
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Color settings are a bit different than most of the settings objects in that there can be more than o...
COLOR4D GetColor(int aLayer) const
Class that manages the UI for the copper layer pair presets list based on an injected layer pair stor...
void onPairActivated(int aRow)
void OnDeleteSelectedLayerPairs()
void onUserNameChanged(int aRow, const wxString &aNewValue)
std::vector< std::unique_ptr< wxBitmap > > m_swatches
COPPER_LAYERS_PAIR_PRESETS_UI(WX_GRID &aGrid, PCB_LAYER_PRESENTATION &aPresentation, LAYER_PAIR_SETTINGS &aLayerPairSettings)
LAYER_PAIR_SETTINGS & m_layerPairSettings
void OnLayerPairAdded(const LAYER_PAIR &aLayerPair)
void fillRowFromLayerPair(int aRow, const LAYER_PAIR_INFO &aLayerPairInfo)
void onEnableChanged(int aRow, bool aNewValue)
std::unique_ptr< WX_GRID_AUTOSIZER > m_autosizer
PCB_LAYER_PRESENTATION & m_layerPresentation
Class that manages the UI for the copper layer pair selection (left and right grids).
void setCurrentSelection(int aLeftRow, int aRightRow)
Set the current layer selection.
void onRightGridRowSelected(int aRow)
COPPER_LAYERS_PAIR_SELECTION_UI(wxGrid &aLeftGrid, wxGrid &aRightGrid, PCB_LAYER_PRESENTATION &aPresentation, LAYER_PAIR_SETTINGS &aLayerPairSettings)
PCB_LAYER_PRESENTATION & m_layerPresentation
void configureGrid(wxGrid &aGrid)
void fillLayerGrid(wxGrid &aGrid)
int rowForLayer(PCB_LAYER_ID aLayerId)
LAYER_PAIR_SETTINGS & m_layerPairSettings
PCB_LAYER_ID layerForRow(int aRow)
std::vector< PCB_LAYER_ID > m_layersId
void onLeftGridRowSelected(int aRow)
Class DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE.
wxGrid * m_rightGridLayers
wxBitmapButton * m_deleteRowButton
wxBitmapButton * m_addToPresetsButton
wxGrid * m_leftGridLayers
Class DIALOG_LAYER_SELECTION_BASE.
wxGrid * m_leftGridLayers
wxGrid * m_rightGridLayers
bool IsQuasiModal() const
void EndQuasiModal(int retCode)
void SetPosition(const wxPoint &aNewPosition)
Force the position of the dialog to a new position.
A color representation with 4 components: red, green, blue, alpha.
wxColour ToColour() const
All information about a layer pair as stored in the layer pair store.
const LAYER_PAIR & GetLayerPair() const
void SetName(const wxString &aNewName)
const std::optional< wxString > & GetName() const
void SetEnabled(bool aNewEnabled)
Management class for layer pairs in a PCB.
bool AddLayerPair(LAYER_PAIR_INFO aPair)
std::span< const LAYER_PAIR_INFO > GetLayerPairs() const
Returns a span of all stored layer pairs.
void SetCurrentLayerPair(const LAYER_PAIR &aPair)
Set the "active" layer pair.
void SetLayerPairs(std::span< const LAYER_PAIR_INFO > aPairs)
Replace the stored layer pairs with the given list.
bool RemoveLayerPair(const LAYER_PAIR &aPair)
Remove the matching layer pair from the store, if present.
const LAYER_PAIR & GetCurrentLayerPair() const
PCB_LAYER_ID GetLayerA() const
PCB_LAYER_ID GetLayerB() const
static std::unique_ptr< wxBitmap > CreateLayerPairIcon(const KIGFX::COLOR4D &aBgColor, const KIGFX::COLOR4D &aTopColor, const KIGFX::COLOR4D &aBottomColor, int aScale)
Create a layer pair "side-by-side swatch" icon.
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
LSET is a set of PCB_LAYER_IDs.
LSEQ UIOrder() const
Returns the copper, technical and user layers in the order shown in layer widget.
static TOOL_ACTION * LayerIDToAction(PCB_LAYER_ID aLayerID)
Translate a layer ID into the action that switches to that layer.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
PCB_LAYER_ID SelectOneLayer(PCB_LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask=LSET(), wxPoint aDlgPosition=wxDefaultPosition)
Show the dialog box for a layer selection.
virtual COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
Class that manages the presentation of PCB layers in a PCB frame.
PCB_BASE_FRAME * m_boardFrame
wxString getLayerName(int aLayer) const override
PCB_LAYER_PRESENTATION(PCB_BASE_FRAME *aFrame)
LSEQ getOrderedEnabledLayers() const
COLOR4D getLayerColor(int aLayer) const override
wxString getLayerPairName(const LAYER_PAIR &aPair) const
Display a PCB layers list in a dialog to select one layer from this list.
void OnLeftGridCellClick(wxGridEvent &aEvent) override
PCB_LAYER_PRESENTATION m_layerPresentation
void OnRightGridCellClick(wxGridEvent &aEvent) override
void onCharHook(wxKeyEvent &event)
~PCB_ONE_LAYER_SELECTOR()
std::vector< PCB_LAYER_ID > m_layersIdLeftColumn
LSET m_notAllowedLayersMask
std::vector< PCB_LAYER_ID > m_layersIdRightColumn
void OnMouseMove(wxUpdateUIEvent &aEvent) override
PCB_LAYER_ID m_layerSelected
PCB_ONE_LAYER_SELECTOR(PCB_BASE_FRAME *aParent, PCB_LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask, bool aHideCheckBoxes=false)
wxString getLayerHotKey(PCB_LAYER_ID aLayer) const
virtual SETTINGS_MANAGER & GetSettingsManager() const
Display a pair PCB copper layers list in a dialog to select a layer pair from these lists.
bool TransferDataToWindow() override
PCB_LAYER_PRESENTATION m_layerPresentation
LAYER_PAIR_SETTINGS & m_boardPairSettings
SELECT_COPPER_LAYERS_PAIR_DIALOG(PCB_BASE_FRAME &aParent, LAYER_PAIR_SETTINGS &aBoardSettings)
COPPER_LAYERS_PAIR_PRESETS_UI m_presetsGridController
COPPER_LAYERS_PAIR_SELECTION_UI m_pairSelectionController
bool TransferDataFromWindow() override
LAYER_PAIR_SETTINGS m_dialogPairSettings
T * GetAppSettings()
Returns a handle to the a given settings by type If the settings have already been loaded,...
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
std::map< int, int > COL_MIN_WIDTHS
Map of column indices to minimum widths.
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
This file is part of the common library.
wxString AddHotkeyName(const wxString &aText, int aHotKey, HOTKEY_ACTION_TYPE aStyle)
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
@ LAYER_PCB_BACKGROUND
PCB background color.
PCB_LAYER_ID
A quick note on layer IDs:
PCB_LAYER_ID ToLAYER_ID(int aLayer)
PGM_BASE & Pgm()
The global Program "get" accessor.