KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sel_layer.cpp
Go to the documentation of this file.
1
5/*
6 * This program source code file is part of KiCad, a free EDA CAD application.
7 *
8 * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
9 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
10 *
11 * This program is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation, either version 3 of the License, or (at your
14 * option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <https://www.gnu.org/licenses/>.
23 */
24
25#include <wx/bitmap.h>
26
27#include <kiplatform/ui.h>
28#include <confirm.h>
29#include <lset.h>
30#include <board.h>
31#include <pgm_base.h>
32#include <project.h>
33#include <pcb_base_frame.h>
36#include <layer_pairs.h>
39#include <router/router_tool.h>
42#include <tools/pcb_actions.h>
47#include <widgets/wx_grid.h>
49
50
51// Column position by function:
52#define SELECT_COLNUM 0
53#define COLOR_COLNUM 1
54#define LAYERNAME_COLNUM 2
55#define LAYER_HK_COLUMN 3
56
57
61
63{
64 if( m_boardFrame )
65 {
66 return m_boardFrame->GetColorSettings()->GetColor( aLayer );
67 }
68 else
69 {
72
73 return current->GetColor( aLayer );
74 }
75}
76
77wxString PCB_LAYER_PRESENTATION::getLayerName( int aLayer ) const
78{
79 if( m_boardFrame )
80 return m_boardFrame->GetBoard()->GetLayerName( ToLAYER_ID( aLayer ) );
81 else
82 return BOARD::GetStandardLayerName( ToLAYER_ID( aLayer ) );
83}
84
86{
87 return m_boardFrame->GetBoard()->GetEnabledLayers().UIOrder();
88}
89
91{
92 const wxString layerAName = getLayerName( aPair.GetLayerA() );
93 const wxString layerBName = getLayerName( aPair.GetLayerB() );
94
95 return layerAName + wxT( " / " ) + layerBName;
96}
97
98
103{
104public:
105 PCB_ONE_LAYER_SELECTOR( PCB_BASE_FRAME* aParent, PCB_LAYER_ID aDefaultLayer,
106 LSET aNotAllowedLayersMask, bool aHideCheckBoxes = false );
108
110
111private:
112 // Event handlers
113 void OnLeftGridCellClick( wxGridEvent& aEvent ) override;
114 void OnRightGridCellClick( wxGridEvent& aEvent ) override;
115 void OnMouseMove( wxUpdateUIEvent& aEvent ) override;
116
117 // Will close the dialog on ESC key
118 void onCharHook( wxKeyEvent& event );
119
120 wxString getLayerHotKey( PCB_LAYER_ID aLayer ) const
121 {
122 int code = PCB_ACTIONS::LayerIDToAction( aLayer )->GetHotKey();
123 return AddHotkeyName( wxS( "" ), code, IS_COMMENT );
124 }
125
126 // Return the selectable layer whose layer-switch hotkey matches aKeyCode, or UNDEFINED_LAYER.
127 // Only copper layers (the left column) carry a switch action and a displayed hotkey.
128 PCB_LAYER_ID layerForHotKey( long aKeyCode ) const
129 {
130 if( aKeyCode == 0 )
131 return UNDEFINED_LAYER;
132
134 {
135 if( TOOL_ACTION* action = PCB_ACTIONS::LayerIDToAction( layer );
136 action && action->GetHotKey() == aKeyCode )
137 {
138 return layer;
139 }
140 }
141
142 return UNDEFINED_LAYER;
143 }
144
145 void buildList();
146
150 std::vector<PCB_LAYER_ID> m_layersIdLeftColumn;
151 std::vector<PCB_LAYER_ID> m_layersIdRightColumn;
152};
153
154
156 LSET aNotAllowedLayersMask, bool aHideCheckBoxes ) :
158{
159 m_useCalculatedSize = true;
160
161 m_layerSelected = aDefaultLayer;
162 m_notAllowedLayersMask = aNotAllowedLayersMask;
163
164 m_leftGridLayers->SetCellHighlightPenWidth( 0 );
165 m_rightGridLayers->SetCellHighlightPenWidth( 0 );
166 m_leftGridLayers->SetColFormatBool( SELECT_COLNUM );
167 m_rightGridLayers->SetColFormatBool( SELECT_COLNUM );
168
169 m_leftGridLayers->AppendCols( 1 );
170
171 buildList();
172
173 if( aHideCheckBoxes )
174 {
177 }
178
179 Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( PCB_ONE_LAYER_SELECTOR::onCharHook ) );
180
181 Layout();
182 GetSizer()->SetSizeHints( this );
183 SetFocus();
184}
185
186
188{
189 Disconnect( wxEVT_CHAR_HOOK, wxKeyEventHandler( PCB_ONE_LAYER_SELECTOR::onCharHook ) );
190}
191
192
193void PCB_ONE_LAYER_SELECTOR::OnMouseMove( wxUpdateUIEvent& aEvent )
194{
198
199 wxPoint mouse_pos = KIPLATFORM::UI::GetMousePosition();
200 wxPoint left_pos = m_leftGridLayers->ScreenToClient( mouse_pos );
201 wxPoint right_pos = m_rightGridLayers->ScreenToClient( mouse_pos );
202
203 if( m_leftGridLayers->HitTest( left_pos ) == wxHT_WINDOW_INSIDE )
204 {
205 int row = m_leftGridLayers->YToRow( left_pos.y );
206
207 if( row != wxNOT_FOUND && row < static_cast<int>( m_layersIdLeftColumn.size() ) )
208 {
210 m_leftGridLayers->SelectBlock( row, LAYERNAME_COLNUM, row, LAYER_HK_COLUMN );
211 return;
212 }
213 }
214
215 if( m_rightGridLayers->HitTest( right_pos ) == wxHT_WINDOW_INSIDE )
216 {
217 int row = m_rightGridLayers->YToRow( right_pos.y );
218
219 if( row == wxNOT_FOUND || row >= static_cast<int>( m_layersIdRightColumn.size() ) )
220 return;
221
223 m_rightGridLayers->SelectBlock( row, LAYERNAME_COLNUM, row, LAYERNAME_COLNUM );
224 }
225}
226
227
228void PCB_ONE_LAYER_SELECTOR::onCharHook( wxKeyEvent& event )
229{
230 if( event.GetKeyCode() == WXK_ESCAPE )
231 {
232 Close();
233 return;
234 }
235
236 // The hotkeys shown in the layer list are the global layer-switch shortcuts; pressing one
237 // here selects that layer and closes the dialog, matching the displayed annotations.
239
240 if( layer != UNDEFINED_LAYER )
241 {
242 m_layerSelected = layer;
243
244 if( IsQuasiModal() )
245 EndQuasiModal( 1 );
246 else
247 EndDialog( 1 );
248
249 return;
250 }
251
252 event.Skip();
253}
254
255
257{
258 wxColour bg = m_layerPresentation.getLayerColor( LAYER_PCB_BACKGROUND ).ToColour();
259 int left_row = 0;
260 int right_row = 0;
261 wxString layername;
262
263 for( PCB_LAYER_ID layerid : m_layerPresentation.getOrderedEnabledLayers() )
264 {
265 if( m_notAllowedLayersMask[layerid] )
266 continue;
267
268 wxColour fg = m_layerPresentation.getLayerColor( layerid ).ToColour();
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 ) );
272
273 layername = wxT( " " ) + m_layerPresentation.getLayerName( layerid );
274
275 if( IsCopperLayer( layerid ) )
276 {
277 if( left_row )
278 m_leftGridLayers->AppendRows( 1 );
279
280 m_leftGridLayers->SetCellBackgroundColour( left_row, COLOR_COLNUM, color );
281 m_leftGridLayers->SetCellValue( left_row, LAYERNAME_COLNUM, layername );
282 m_leftGridLayers->SetCellValue( left_row, LAYER_HK_COLUMN, getLayerHotKey( layerid ) );
283
284 if( m_layerSelected == layerid )
285 m_leftGridLayers->SetCellValue( left_row, SELECT_COLNUM, wxT( "1" ) );
286
287 m_layersIdLeftColumn.push_back( layerid );
288 left_row++;
289 }
290 else
291 {
292 if( right_row )
293 m_rightGridLayers->AppendRows( 1 );
294
295 m_rightGridLayers->SetCellBackgroundColour( right_row, COLOR_COLNUM, color );
296 m_rightGridLayers->SetCellValue( right_row, LAYERNAME_COLNUM, layername );
297
298 if( m_layerSelected == layerid )
299 m_rightGridLayers->SetCellValue( right_row, SELECT_COLNUM, wxT( "1" ) );
300
301 m_layersIdRightColumn.push_back( layerid );
302 right_row++;
303 }
304 }
305
306 // Show only populated lists:
307 if( left_row <= 0 )
308 m_leftGridLayers->Show( false );
309
310 if( right_row <= 0 )
311 m_rightGridLayers->Show( false );
312
313 // Now fix min grid column size (it also sets a minimal size)
314 m_leftGridLayers->AutoSizeColumns();
315 m_rightGridLayers->AutoSizeColumns();
316}
317
318
320{
321 m_layerSelected = m_layersIdLeftColumn[event.GetRow()];
322
323 if( IsQuasiModal() )
324 EndQuasiModal( 1 );
325 else
326 EndDialog( 1 );
327}
328
329
331{
332 m_layerSelected = m_layersIdRightColumn[event.GetRow()];
333
334 if( IsQuasiModal() )
335 EndQuasiModal( 2 );
336 else
337 EndDialog( 2 );
338}
339
340
342 const LSET& aNotAllowedLayersMask,
343 wxPoint aDlgPosition )
344{
345 PCB_ONE_LAYER_SELECTOR dlg( this, aDefaultLayer, aNotAllowedLayersMask, true );
346
347 if( aDlgPosition != wxDefaultPosition )
348 {
349 wxSize dlgSize = dlg.GetSize();
350 aDlgPosition.x -= dlgSize.x / 2;
351 aDlgPosition.y -= dlgSize.y / 2;
352 dlg.SetPosition( aDlgPosition );
353 }
354
355 if( dlg.ShowModal() != wxID_CANCEL )
356 return ToLAYER_ID( dlg.GetLayerSelection() );
357 else
358 return UNDEFINED_LAYER;
359}
360
361
367{
375
376public:
378 LAYER_PAIR_SETTINGS& aLayerPairSettings ) :
379 m_layerPresentation( aPresentation ),
380 m_grid( aGrid ),
381 m_layerPairSettings( aLayerPairSettings )
382 {
383 wxASSERT_MSG( m_grid.GetNumberRows() == 0, "Grid should be empty at controller start" );
384
387
388 m_grid.Bind( wxEVT_GRID_CELL_CHANGED,
389 [this]( wxGridEvent& aEvent )
390 {
391 const int col = aEvent.GetCol();
392 const int row = aEvent.GetRow();
393 if( col == (int) COLNUMS::USERNAME )
394 {
395 onUserNameChanged( row, m_grid.GetCellValue( row, col ) );
396 }
397 else if( col == (int) COLNUMS::ENABLED )
398 {
399 onEnableChanged( row, m_grid.GetCellValue( row, col ) == wxS( "1" ) );
400 }
401 } );
402
403 m_grid.Bind( wxEVT_GRID_CELL_LEFT_DCLICK,
404 [&]( wxGridEvent& aEvent )
405 {
406 const int row = aEvent.GetRow();
407 const int col = aEvent.GetCol();
408
409 if( col == (int) COLNUMS::LAYERNAMES || col == (int) COLNUMS::SWATCH )
410 {
411 onPairActivated( row );
412 }
413 } );
414 }
415
416 void OnLayerPairAdded( const LAYER_PAIR& aLayerPair )
417 {
418 LAYER_PAIR_INFO layerPairInfo{ aLayerPair, true, std::nullopt };
419
420 const bool added = m_layerPairSettings.AddLayerPair( layerPairInfo );
421
422 if( added )
423 {
424 m_grid.AppendRows( 1 );
425 fillRowFromLayerPair( m_grid.GetNumberRows() - 1, layerPairInfo );
426 }
427 }
428
430 {
431 m_grid.OnDeleteRows(
432 [&]( int row )
433 {
434 const LAYER_PAIR_INFO& layerPairInfo = m_layerPairSettings.GetLayerPairs()[row];
435
436 if( m_layerPairSettings.RemoveLayerPair( layerPairInfo.GetLayerPair() ) )
437 m_grid.DeleteRows( row );
438 } );
439 }
440
441private:
443 {
444 m_grid.UseNativeColHeader( true );
445
446 m_grid.SetCellHighlightPenWidth( 0 );
447 m_grid.SetColFormatBool( (int) COLNUMS::ENABLED );
448 m_grid.SetupColumnAutosizer( (int) COLNUMS::USERNAME );
449
450 m_grid.SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
451 }
452
454 {
455 std::span<const LAYER_PAIR_INFO> storePairs = m_layerPairSettings.GetLayerPairs();
456
457 m_grid.AppendRows( storePairs.size() );
458
459 int row = 0;
460 for( const LAYER_PAIR_INFO& layerPairInfo : storePairs )
461 {
462 fillRowFromLayerPair( row, layerPairInfo );
463 row++;
464 }
465 }
466
467 void fillRowFromLayerPair( int aRow, const LAYER_PAIR_INFO& aLayerPairInfo )
468 {
469 wxASSERT_MSG( aRow < m_grid.GetNumberRows(), "Row index out of bounds" );
470
471 const LAYER_PAIR& layerPair = aLayerPairInfo.GetLayerPair();
472
473 const wxString layerNames = m_layerPresentation.getLayerPairName( layerPair );
474
475 m_grid.SetCellValue( aRow, (int) COLNUMS::LAYERNAMES, layerNames );
476
477 const std::optional<wxString> userName = aLayerPairInfo.GetName();
478 if( userName )
479 {
480 m_grid.SetCellValue( aRow, (int) COLNUMS::USERNAME, *userName );
481 }
482
483 m_grid.SetCellValue( aRow, (int) COLNUMS::ENABLED,
484 aLayerPairInfo.IsEnabled() ? wxT( "1" ) : wxT( "0" ) );
485
486 // Set the color swatch
487 wxBitmapBundle swatch = m_layerPresentation.CreateLayerPairIcon( layerPair.GetLayerA(), layerPair.GetLayerB() );
488
489 m_grid.SetCellRenderer( aRow, (int) COLNUMS::SWATCH, new GRID_CELL_ICON_RENDERER( swatch ) );
490
491 m_grid.SetReadOnly( aRow, (int) COLNUMS::SWATCH );
492 m_grid.SetReadOnly( aRow, (int) COLNUMS::LAYERNAMES );
493 }
494
495 void onUserNameChanged( int aRow, const wxString& aNewValue )
496 {
497 LAYER_PAIR_INFO& changedPair = m_layerPairSettings.GetLayerPairs()[aRow];
498 changedPair.SetName( aNewValue );
499 }
500
501 void onEnableChanged( int aRow, bool aNewValue )
502 {
503 LAYER_PAIR_INFO& changedPair = m_layerPairSettings.GetLayerPairs()[aRow];
504 changedPair.SetEnabled( aNewValue );
505 }
506
507 void onPairActivated( int aRow )
508 {
509 const LAYER_PAIR_INFO& layerPairInfo = m_layerPairSettings.GetLayerPairs()[aRow];
510 const LAYER_PAIR& layerPair = layerPairInfo.GetLayerPair();
511
512 m_layerPairSettings.SetCurrentLayerPair( layerPair );
513 }
514
518};
519
520
526{
528 {
530 COLOR = 1,
532 };
533
534public:
535 COPPER_LAYERS_PAIR_SELECTION_UI( wxGrid& aLeftGrid, wxGrid& aRightGrid,
536 PCB_LAYER_PRESENTATION& aPresentation,
537 LAYER_PAIR_SETTINGS& aLayerPairSettings ) :
538 m_layerPresentation( aPresentation ), m_layerPairSettings( aLayerPairSettings ),
539 m_leftGrid( aLeftGrid ), m_rightGrid( aRightGrid )
540 {
543
544 for( const PCB_LAYER_ID& layerId : m_layerPresentation.getOrderedEnabledLayers() )
545 {
546 if( IsCopperLayer( layerId ) )
547 m_layersId.push_back( layerId );
548 }
549
552
553 m_leftGrid.Bind( wxEVT_GRID_CELL_LEFT_CLICK,
554 [this]( wxGridEvent& aEvent )
555 {
556 onLeftGridRowSelected( aEvent.GetRow() );
557 } );
558
559 m_rightGrid.Bind( wxEVT_GRID_CELL_LEFT_CLICK,
560 [this]( wxGridEvent& aEvent )
561 {
562 onRightGridRowSelected( aEvent.GetRow() );
563 } );
564
565 m_layerPairSettings.Bind( PCB_CURRENT_LAYER_PAIR_CHANGED,
566 [this]( wxCommandEvent& aEvent )
567 {
568 const LAYER_PAIR& newPair = m_layerPairSettings.GetCurrentLayerPair();
570 rowForLayer( newPair.GetLayerB() ) );
571 } );
572 }
573
574private:
575 void configureGrid( wxGrid& aGrid )
576 {
577 aGrid.SetCellHighlightPenWidth( 0 );
578 aGrid.SetColFormatBool( (int) CU_LAYER_COLNUMS::SELECT );
579 }
580
581 void fillLayerGrid( wxGrid& aGrid )
582 {
583 const wxColour bg = m_layerPresentation.getLayerColor( LAYER_PCB_BACKGROUND ).ToColour();
584
585 aGrid.AppendRows( m_layersId.size() - 1 );
586
587 int row = 0;
588 for( const PCB_LAYER_ID& layerId : m_layersId )
589 {
590 const wxColour fg = m_layerPresentation.getLayerColor( layerId ).ToColour();
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 ) );
594
595 const wxString layerName = wxT( " " ) + m_layerPresentation.getLayerName( layerId );
596
597 aGrid.SetCellBackgroundColour( row, (int) CU_LAYER_COLNUMS::COLOR, color );
598 aGrid.SetCellValue( row, (int) CU_LAYER_COLNUMS::LAYERNAME, layerName );
599
600 row++;
601 };
602
603 // Now fix min grid layer name column size (it also sets a minimal size)
604 aGrid.AutoSizeColumn( (int) CU_LAYER_COLNUMS::LAYERNAME );
605 }
606
607 PCB_LAYER_ID layerForRow( int aRow ) { return m_layersId.at( aRow ); }
608
609 int rowForLayer( PCB_LAYER_ID aLayerId )
610 {
611 for( unsigned i = 0; i < m_layersId.size(); ++i )
612 {
613 if( m_layersId[i] == aLayerId )
614 return i;
615 }
616
617 wxASSERT_MSG( false, wxString::Format( "Unknown layer in grid: %d", aLayerId ) );
618 return 0;
619 }
620
621 void onLeftGridRowSelected( int aRow )
622 {
623 LAYER_PAIR newPair{
624 layerForRow( aRow ),
626 };
628 m_layerPairSettings.SetCurrentLayerPair( newPair );
629 }
630
631 void onRightGridRowSelected( int aRow )
632 {
633 LAYER_PAIR newPair{
635 layerForRow( aRow ),
636 };
638 m_layerPairSettings.SetCurrentLayerPair( newPair );
639 }
640
647 void setCurrentSelection( int aLeftRow, int aRightRow )
648 {
649 const auto selectGridRow =
650 []( wxGrid& aGrid, int aRow, bool aSelect )
651 {
652 // At start, there is no old row
653 if( aRow < 0 )
654 return;
655
656 const wxString val = aSelect ? wxT( "1" ) : wxEmptyString;
657 aGrid.SetCellValue( aRow, (int) CU_LAYER_COLNUMS::SELECT, val );
658 aGrid.SetGridCursor( aRow, (int) CU_LAYER_COLNUMS::COLOR );
659 };
660
661 if( m_leftCurrRow != aLeftRow )
662 {
663 selectGridRow( m_leftGrid, m_leftCurrRow, false );
664 selectGridRow( m_leftGrid, aLeftRow, true );
665 m_leftCurrRow = aLeftRow;
666 }
667
668 if( m_rightCurrRow != aRightRow )
669 {
670 selectGridRow( m_rightGrid, m_rightCurrRow, false );
671 selectGridRow( m_rightGrid, aRightRow, true );
672 m_rightCurrRow = aRightRow;
673 }
674 }
675
678 std::vector<PCB_LAYER_ID> m_layersId;
679 wxGrid& m_leftGrid;
680 wxGrid& m_rightGrid;
681
684};
685
686
694{
695public:
697 LAYER_PAIR_SETTINGS& aBoardSettings ) :
699 m_boardPairSettings( aBoardSettings ), m_dialogPairSettings( aBoardSettings ),
700 m_layerPresentation( &aParent ),
704 {
707
708 m_addToPresetsButton->Bind( wxEVT_BUTTON,
709 [this]( wxCommandEvent& aEvent )
710 {
711 const LAYER_PAIR newPair = m_dialogPairSettings.GetCurrentLayerPair();
712 m_presetsGridController.OnLayerPairAdded( newPair );
713 } );
714
715 m_deleteRowButton->Bind( wxEVT_BUTTON,
716 [this]( wxCommandEvent& aEvent )
717 {
718 m_presetsGridController.OnDeleteSelectedLayerPairs();
719 } );
720
721 SetFocus();
722
723 GetSizer()->SetSizeHints( this );
724 Center();
725 }
726
727 bool TransferDataToWindow() override
728 {
729 m_presetsGrid->Freeze();
730 m_leftGridLayers->Freeze();
731 m_rightGridLayers->Freeze();
732
733 m_dialogPairSettings.SetCurrentLayerPair( m_boardPairSettings.GetCurrentLayerPair() );
734
735 m_rightGridLayers->Thaw();
736 m_leftGridLayers->Thaw();
737 m_presetsGrid->Thaw();
738 return true;
739 }
740
742 {
743 // Pull out the dialog's stored pairs
744 std::span<const LAYER_PAIR_INFO> storePairs = m_dialogPairSettings.GetLayerPairs();
745
746 m_boardPairSettings.SetLayerPairs( storePairs );
747 m_boardPairSettings.SetCurrentLayerPair( m_dialogPairSettings.GetCurrentLayerPair() );
748
749 return true;
750 }
751
752private:
753 // The BOARD's pair store to be updated
755 // A local copy while we modify it
757 // Information about the layer presentation (colors, etc)
759 // UI controllers
762};
763
764
766{
767 LAYER_PAIR_SETTINGS* const boardSettings = frame()->GetLayerPairSettings();
768
769 if( !boardSettings )
770 {
771 // Should only be used for suitable frame types with layer pairs
772 wxASSERT_MSG( false, "Could not access layer pair settings" );
773 return 0;
774 }
775
776 SELECT_COPPER_LAYERS_PAIR_DIALOG dlg( *frame(), *boardSettings );
777
778 if( dlg.ShowModal() == wxID_OK )
779 {
780 const LAYER_PAIR layerPair = boardSettings->GetCurrentLayerPair();
781
782 // select the same layer for both layers is allowed (normal in some boards)
783 // but could be a mistake. So display an info message
784 if( layerPair.GetLayerA() == layerPair.GetLayerB() )
785 {
786 DisplayInfoMessage( frame(), _( "Warning: top and bottom layers are same." ) );
787 }
788 }
789
790 return 0;
791}
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:106
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.
Definition board.h:999
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 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
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)
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)
bool IsQuasiModal() const
Definition dialog_shim.h:90
bool m_useCalculatedSize
void EndQuasiModal(int retCode)
void SetPosition(const wxPoint &aNewPosition)
Force the position of the dialog to a new position.
int ShowModal() override
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
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.
Definition layer_pairs.h:43
const LAYER_PAIR & GetCurrentLayerPair() const
Definition layer_pairs.h:83
PCB_LAYER_ID GetLayerA() const
PCB_LAYER_ID GetLayerB() const
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition lseq.h:47
LSET is a set of PCB_LAYER_IDs.
Definition lset.h:37
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.
wxString getLayerName(int aLayer) const override
Definition sel_layer.cpp:77
PCB_LAYER_PRESENTATION(PCB_BASE_FRAME *aFrame)
Definition sel_layer.cpp:58
LSEQ getOrderedEnabledLayers() const
Definition sel_layer.cpp:85
COLOR4D getLayerColor(int aLayer) const override
Definition sel_layer.cpp:62
wxString getLayerPairName(const LAYER_PAIR &aPair) const
Definition sel_layer.cpp:90
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)
std::vector< PCB_LAYER_ID > m_layersIdLeftColumn
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
T * frame() const
int SelectCopperLayerPair(const TOOL_EVENT &aEvent)
Display a pair PCB copper layers list in a dialog to select a layer pair from these lists.
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
Represent a single user action.
int GetHotKey() const
Return the hotkey keycode which initiates the action.
Generic, UI-independent tool event.
Definition tool_event.h:167
static long MapKeypressToKeycode(const wxKeyEvent &aEvent)
Map a keypress event to the correct key code for use as a hotkey.
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition confirm.cpp:245
This file is part of the common library.
#define _(s)
wxString AddHotkeyName(const wxString &aText, int aHotKey, HOTKEY_ACTION_TYPE aStyle)
@ IS_COMMENT
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
Definition layer_ids.h:675
@ LAYER_PCB_BACKGROUND
PCB background color.
Definition layer_ids.h:277
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
@ UNDEFINED_LAYER
Definition layer_ids.h:57
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition lset.cpp:750
wxPoint GetMousePosition()
Returns the mouse position in screen coordinates.
Definition wxgtk/ui.cpp:766
see class PGM_BASE
#define LAYER_HK_COLUMN
Definition sel_layer.cpp:55
#define LAYERNAME_COLNUM
Definition sel_layer.cpp:54
#define SELECT_COLNUM
Definition sel_layer.cpp:52
#define COLOR_COLNUM
Definition sel_layer.cpp:53
#define DEFAULT_THEME
COLOR_SETTINGS * GetColorSettings(const wxString &aName)
T * GetAppSettings(const char *aFilename)