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;
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 const LSET& aNotAllowedLayersMask,
303 wxPoint aDlgPosition )
307 if( aDlgPosition != wxDefaultPosition )
309 wxSize dlgSize = dlg.GetSize();
310 aDlgPosition.x -= dlgSize.x / 2;
311 aDlgPosition.y -= dlgSize.y / 2;
342 wxASSERT_MSG(
m_grid.GetNumberRows() == 0,
"Grid should be empty at controller start" );
347 m_grid.Bind( wxEVT_GRID_CELL_CHANGED,
348 [
this]( wxGridEvent& aEvent )
350 const int col = aEvent.GetCol();
351 const int row = aEvent.GetRow();
362 m_grid.Bind( wxEVT_GRID_CELL_LEFT_DCLICK,
363 [&]( wxGridEvent& aEvent )
365 const int row = aEvent.GetRow();
366 const int col = aEvent.GetCol();
375 std::make_unique<WX_GRID_AUTOSIZER>(
m_grid,
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 );
530 [
this]( wxGridEvent& aEvent )
536 [
this]( wxGridEvent& aEvent )
542 [
this]( wxCommandEvent& aEvent )
553 aGrid.SetCellHighlightPenWidth( 0 );
567 const wxColour
color( wxColour::AlphaBlend( fg.Red(), bg.Red(), fg.Alpha() / 255.0 ),
568 wxColour::AlphaBlend( fg.Green(), bg.Green(), fg.Alpha() / 255.0 ),
569 wxColour::AlphaBlend( fg.Blue(), bg.Blue(), fg.Alpha() / 255.0 ) );
587 for(
unsigned i = 0; i <
m_layersId.size(); ++i )
593 wxASSERT_MSG(
false, wxString::Format(
"Unknown layer in grid: %d", aLayerId ) );
625 const auto selectGridRow = []( wxGrid& aGrid,
int aRow,
bool aSelect )
631 const wxString val = aSelect ? wxT(
"1" ) : wxEmptyString;
684 [
this]( wxCommandEvent& aEvent )
691 [
this]( wxCommandEvent& aEvent )
698 GetSizer()->SetSizeHints(
this );
747 wxASSERT_MSG(
false,
"Could not access layer pair settings" );
int KiIconScale(wxWindow *aWindow)
Return the automatic scale factor that would be used for a given window by KiScaledBitmap and KiScale...
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)
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)
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
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
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)
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)