52#define SELECT_COLNUM 0
54#define LAYERNAME_COLNUM 2
55#define LAYER_HK_COLUMN 3
66 return m_boardFrame->GetColorSettings()->GetColor( aLayer );
87 return m_boardFrame->GetBoard()->GetEnabledLayers().UIOrder();
95 return layerAName + wxT(
" / " ) + layerBName;
106 LSET aNotAllowedLayersMask,
bool aHideCheckBoxes =
false );
115 void OnMouseMove( wxUpdateUIEvent& aEvent )
override;
136 action && action->GetHotKey() == aKeyCode )
156 LSET aNotAllowedLayersMask,
bool aHideCheckBoxes ) :
173 if( aHideCheckBoxes )
182 GetSizer()->SetSizeHints(
this );
230 if( event.GetKeyCode() == WXK_ESCAPE )
269 wxColour color( wxColour::AlphaBlend( fg.Red(), bg.Red(), fg.Alpha() / 255.0 ),
270 wxColour::AlphaBlend( fg.Green(), bg.Green(), fg.Alpha() / 255.0 ),
271 wxColour::AlphaBlend( fg.Blue(), bg.Blue(), fg.Alpha() / 255.0 ) );
342 const LSET& aNotAllowedLayersMask,
343 wxPoint aDlgPosition )
347 if( aDlgPosition != wxDefaultPosition )
349 wxSize dlgSize = dlg.GetSize();
350 aDlgPosition.x -= dlgSize.x / 2;
351 aDlgPosition.y -= dlgSize.y / 2;
383 wxASSERT_MSG(
m_grid.GetNumberRows() == 0,
"Grid should be empty at controller start" );
388 m_grid.Bind( wxEVT_GRID_CELL_CHANGED,
389 [
this]( wxGridEvent& aEvent )
391 const int col = aEvent.GetCol();
392 const int row = aEvent.GetRow();
403 m_grid.Bind( wxEVT_GRID_CELL_LEFT_DCLICK,
404 [&]( wxGridEvent& aEvent )
406 const int row = aEvent.GetRow();
407 const int col = aEvent.GetCol();
444 m_grid.UseNativeColHeader(
true );
446 m_grid.SetCellHighlightPenWidth( 0 );
450 m_grid.SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
457 m_grid.AppendRows( storePairs.size() );
469 wxASSERT_MSG( aRow <
m_grid.GetNumberRows(),
"Row index out of bounds" );
477 const std::optional<wxString> userName = aLayerPairInfo.
GetName();
484 aLayerPairInfo.
IsEnabled() ? wxT(
"1" ) : wxT(
"0" ) );
498 changedPair.
SetName( aNewValue );
554 [
this]( wxGridEvent& aEvent )
560 [
this]( wxGridEvent& aEvent )
566 [
this]( wxCommandEvent& aEvent )
577 aGrid.SetCellHighlightPenWidth( 0 );
591 const wxColour color( wxColour::AlphaBlend( fg.Red(), bg.Red(), fg.Alpha() / 255.0 ),
592 wxColour::AlphaBlend( fg.Green(), bg.Green(), fg.Alpha() / 255.0 ),
593 wxColour::AlphaBlend( fg.Blue(), bg.Blue(), fg.Alpha() / 255.0 ) );
611 for(
unsigned i = 0; i <
m_layersId.size(); ++i )
617 wxASSERT_MSG(
false, wxString::Format(
"Unknown layer in grid: %d", aLayerId ) );
649 const auto selectGridRow =
650 []( wxGrid& aGrid,
int aRow,
bool aSelect )
656 const wxString val = aSelect ? wxT(
"1" ) : wxEmptyString;
709 [
this]( wxCommandEvent& aEvent )
716 [
this]( wxCommandEvent& aEvent )
723 GetSizer()->SetSizeHints(
this );
772 wxASSERT_MSG(
false,
"Could not access layer pair settings" );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
wxString m_ColorTheme
Active color theme name.
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
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)
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)
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)
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Select Copper Layer Pair"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
wxGrid * m_rightGridLayers
wxBitmapButton * m_addToPresetsButton
wxGrid * m_leftGridLayers
STD_BITMAP_BUTTON * m_deleteRowButton
wxGrid * m_leftGridLayers
DIALOG_LAYER_SELECTION_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Select Layer"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
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.
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.
const LAYER_PAIR & GetCurrentLayerPair() const
PCB_LAYER_ID GetLayerA() const
PCB_LAYER_ID GetLayerB() const
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
LSET is a set of PCB_LAYER_IDs.
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, const LSET &aNotAllowedLayersMask=LSET(), wxPoint aDlgPosition=wxDefaultPosition)
Show the dialog box for a layer selection.
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
PCB_LAYER_ID layerForHotKey(long aKeyCode) const
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
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
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)
Test 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)
COLOR_SETTINGS * GetColorSettings(const wxString &aName)
T * GetAppSettings(const char *aFilename)