KiCad PCB EDA Suite
APPEARANCE_CONTROLS Class Reference

#include <appearance_controls.h>

Inheritance diagram for APPEARANCE_CONTROLS:
APPEARANCE_CONTROLS_BASE BOARD_LISTENER WX_PANEL

Classes

struct  APPEARANCE_SETTING
 Container for an appearance setting (can control a single board layer, or GAL layer, etc) More...
 

Public Member Functions

 APPEARANCE_CONTROLS (PCB_BASE_FRAME *aParent, wxWindow *aFocusOwner, bool aFpEditor=false)
 
 ~APPEARANCE_CONTROLS ()
 
wxSize GetBestSize () const
 
void OnLanguageChanged ()
 Update the panel contents from the application and board models. More...
 
void OnBoardChanged ()
 
void OnBoardNetSettingsChanged (BOARD &aBoard) override
 
void OnBoardItemAdded (BOARD &aBoard, BOARD_ITEM *aItem) override
 
void OnBoardItemsAdded (BOARD &aBoard, std::vector< BOARD_ITEM * > &aItems) override
 
void OnBoardItemRemoved (BOARD &aBoard, BOARD_ITEM *aItem) override
 
void OnBoardItemsRemoved (BOARD &aBoard, std::vector< BOARD_ITEM * > &aItems) override
 
void OnBoardItemChanged (BOARD &aBoard, BOARD_ITEM *aItem) override
 
void OnBoardItemsChanged (BOARD &aBoard, std::vector< BOARD_ITEM * > &aItems) override
 Update the colors on all the widgets from the new chosen color theme. More...
 
void OnColorThemeChanged ()
 Respond to change in OS's DarkMode. More...
 
void OnDarkModeToggle ()
 Update the widget when the active board layer is changed. More...
 
void OnLayerChanged ()
 
void OnNetVisibilityChanged (int aNetCode, bool aVisibility)
 Notifies the panel when a net has been hidden or shown via the external tool. More...
 
void SetLayerVisible (int aLayer, bool isVisible)
 
void SetObjectVisible (GAL_LAYER_ID aLayer, bool isVisible=true)
 
void UpdateDisplayOptions ()
 Return a list of the layer presets created by the user. More...
 
std::vector< LAYER_PRESETGetUserLayerPresets () const
 Update the current layer presets from those saved in the project file. More...
 
void SetUserLayerPresets (std::vector< LAYER_PRESET > &aPresetList)
 
void ApplyLayerPreset (const wxString &aPresetName)
 
void ApplyLayerPreset (const LAYER_PRESET &aPreset)
 
wxString GetActiveLayerPreset () const
 
const wxArrayString & GetLayerPresetsMRU ()
 Return a list of viewports created by the user. More...
 
std::vector< VIEWPORTGetUserViewports () const
 Update the current viewports from those saved in the project file. More...
 
void SetUserViewports (std::vector< VIEWPORT > &aPresetList)
 
void ApplyViewport (const wxString &aPresetName)
 
void ApplyViewport (const VIEWPORT &aPreset)
 
const wxArrayString & GetViewportsMRU ()
 
void OnColorSwatchChanged (wxCommandEvent &aEvent)
 
void OnLayerContextMenu (wxCommandEvent &aEvent)
 Return the index of the current tab (0-2). More...
 
int GetTabIndex () const
 Set the current notebook tab. More...
 
void SetTabIndex (int aTab)
 
void RefreshCollapsiblePanes ()
 Function to force a redraw of the collapsible panes in this control. More...
 
void m_netsTabSplitterOnIdle (wxIdleEvent &)
 
void SetBorders (bool aLeft, bool aRight, bool aTop, bool aBottom)
 
virtual void OnBoardHighlightNetChanged (BOARD &aBoard)
 

Protected Member Functions

void OnNotebookPageChanged (wxNotebookEvent &event) override
 
void OnSetFocus (wxFocusEvent &aEvent) override
 
void OnSize (wxSizeEvent &aEvent) override
 
void OnNetGridClick (wxGridEvent &event) override
 
void OnNetGridDoubleClick (wxGridEvent &event) override
 
void OnNetGridRightClick (wxGridEvent &event) override
 
void OnNetGridMouseEvent (wxMouseEvent &aEvent)
 

Protected Attributes

wxBoxSizer * m_sizerOuter
 
wxNotebook * m_notebook
 
wxPanel * m_panelLayers
 
wxBoxSizer * m_panelLayersSizer
 
wxScrolledCanvas * m_windowLayers
 
wxPanel * m_panelObjects
 
wxBoxSizer * m_objectsPanelSizer
 
wxScrolledCanvas * m_windowObjects
 
wxPanel * m_panelNetsAndClasses
 
wxBoxSizer * m_netsTabOuterSizer
 
wxSplitterWindow * m_netsTabSplitter
 
wxPanel * m_panelNets
 
wxStaticText * m_staticTextNets
 
wxTextCtrl * m_txtNetFilter
 
BITMAP_BUTTONm_btnNetInspector
 
WX_GRIDm_netsGrid
 
wxPanel * m_panelNetclasses
 
wxStaticText * m_staticTextNetClasses
 
BITMAP_BUTTONm_btnConfigureNetClasses
 
wxScrolledWindow * m_netclassScrolledWindow
 
wxBoxSizer * m_netclassOuterSizer
 
wxStaticText * m_presetsLabel
 
wxChoice * m_cbLayerPresets
 
wxStaticText * m_viewportsLabel
 
wxChoice * m_cbViewports
 

Private Types

enum  POPUP_ID {
  ID_CHANGE_COLOR = wxID_HIGHEST , ID_SET_NET_COLOR , ID_CLEAR_NET_COLOR , ID_SHOW_ALL_NETS ,
  ID_HIDE_OTHER_NETS , ID_HIGHLIGHT_NET , ID_SELECT_NET , ID_DESELECT_NET ,
  ID_SHOW_ALL_COPPER_LAYERS , ID_HIDE_ALL_COPPER_LAYERS , ID_HIDE_ALL_BUT_ACTIVE , ID_PRESET_NO_LAYERS ,
  ID_PRESET_ALL_LAYERS , ID_PRESET_FRONT , ID_PRESET_FRONT_ASSEMBLY , ID_PRESET_INNER_COPPER ,
  ID_PRESET_BACK , ID_PRESET_BACK_ASSEMBLY , ID_HIDE_ALL_NON_COPPER , ID_SHOW_ALL_NON_COPPER ,
  ID_LAST_VALUE
}
 

Private Member Functions

void createControls ()
 
void rebuildLayers ()
 
void rebuildLayerContextMenu ()
 
void syncColorsAndVisibility ()
 
void rebuildObjects ()
 
void syncObjectSettings ()
 
void buildNetClassMenu (wxMenu &aMenu, bool isDefaultClass, const wxString &aName)
 
void rebuildNets ()
 
void loadDefaultLayerPresets ()
 
void rebuildLayerPresetsWidget ()
 
void syncLayerPresetSelection ()
 
void rebuildViewportsWidget ()
 
void onLayerLeftClick (wxMouseEvent &aEvent)
 
void rightClickHandler (wxMouseEvent &aEvent)
 
void onLayerVisibilityToggled (PCB_LAYER_ID aLayer)
 
void onObjectVisibilityChanged (GAL_LAYER_ID aLayer, bool isVisible, bool isFinal)
 
void setVisibleLayers (LSET aLayers)
 
void setVisibleObjects (GAL_SET aObjects)
 
LSET getVisibleLayers ()
 
GAL_SET getVisibleObjects ()
 
void onObjectOpacitySlider (int aLayer, float aOpacity)
 
void updateLayerPresetSelection (const wxString &aName)
 
void onLayerPresetChanged (wxCommandEvent &aEvent) override
 
void doApplyLayerPreset (const LAYER_PRESET &aPreset)
 
void updateViewportSelection (const wxString &aName)
 
void onViewportChanged (wxCommandEvent &aEvent) override
 
void doApplyViewport (const VIEWPORT &aViewport)
 
void onNetclassVisibilityChanged (wxCommandEvent &aEvent)
 
void showNetclass (const wxString &aClassName, bool aShow=true)
 
void onNetContextMenu (wxCommandEvent &aEvent)
 
void onNetclassColorChanged (wxCommandEvent &aEvent)
 
wxString netclassNameFromEvent (wxEvent &aEvent)
 
void onNetColorMode (wxCommandEvent &aEvent)
 
void onRatsnestMode (wxCommandEvent &aEvent)
 
void onNetclassContextMenu (wxCommandEvent &aEvent)
 
void handleBoardItemsChanged ()
 
void passOnFocus ()
 
void idleFocusHandler (wxIdleEvent &aEvent)
 
void onReadOnlySwatch ()
 
bool doesBoardItemNeedRebuild (BOARD_ITEM *aBoardItem)
 
bool doesBoardItemNeedRebuild (std::vector< BOARD_ITEM * > &aBoardItems)
 
void OnPaint (wxPaintEvent &event)
 

Private Attributes

PCB_BASE_FRAMEm_frame
 
wxWindow * m_focusOwner
 
ROW_ICON_PROVIDERm_iconProvider
 
BOARDm_board
 
bool m_isFpEditor
 
NET_GRID_TABLEm_netsTable
 
GRID_BITMAP_TOGGLE_RENDERERm_toggleGridRenderer
 
wxGridCellCoords m_hoveredCell
 Grid cell that is being hovered over, for tooltips. More...
 
std::vector< std::unique_ptr< APPEARANCE_SETTING > > m_layerSettings
 
std::map< PCB_LAYER_ID, APPEARANCE_SETTING * > m_layerSettingsMap
 
std::vector< std::unique_ptr< APPEARANCE_SETTING > > m_objectSettings
 
std::map< GAL_LAYER_ID, APPEARANCE_SETTING * > m_objectSettingsMap
 
std::vector< std::unique_ptr< APPEARANCE_SETTING > > m_netclassSettings
 
std::map< wxString, APPEARANCE_SETTING * > m_netclassSettingsMap
 
std::map< wxString, LAYER_PRESETm_layerPresets
 
LAYER_PRESETm_currentPreset
 
LAYER_PRESETm_lastSelectedUserPreset
 
wxArrayString m_presetMRU
 
std::map< wxString, VIEWPORTm_viewports
 
VIEWPORTm_lastSelectedViewport
 
wxArrayString m_viewportMRU
 
wxMenu * m_layerContextMenu
 
std::map< int, wxString > m_netclassIdMap
 Stores wxIDs for each netclass for control event mapping. More...
 
wxString m_contextMenuNetclass
 The name of the netclass that was right-clicked. More...
 
wxBoxSizer * m_layersOuterSizer
 
wxBoxSizer * m_objectsOuterSizer
 
int m_pointSize
 
wxColour m_layerPanelColour
 
WX_COLLAPSIBLE_PANEm_paneLayerDisplayOptions
 
wxStaticText * m_inactiveLayersLabel
 
wxRadioButton * m_rbHighContrastNormal
 
wxRadioButton * m_rbHighContrastDim
 
wxRadioButton * m_rbHighContrastOff
 
wxStaticLine * m_layerDisplaySeparator
 
wxCheckBox * m_cbFlipBoard
 
WX_COLLAPSIBLE_PANEm_paneNetDisplayOptions
 
wxStaticText * m_txtNetDisplayTitle
 
wxRadioButton * m_rbNetColorAll
 
wxRadioButton * m_rbNetColorRatsnest
 
wxRadioButton * m_rbNetColorOff
 
wxStaticText * m_txtRatsnestVisibility
 
wxRadioButton * m_rbRatsnestAllLayers
 
wxRadioButton * m_rbRatsnestVisLayers
 
wxRadioButton * m_rbRatsnestNone
 
bool m_leftBorder
 
bool m_rightBorder
 
bool m_topBorder
 
bool m_bottomBorder
 

Static Private Attributes

static const APPEARANCE_SETTING s_objectSettings []
 Template for object appearance settings. More...
 
static LAYER_PRESET presetNoLayers
 
static LAYER_PRESET presetAllLayers
 
static LAYER_PRESET presetAllCopper
 
static LAYER_PRESET presetInnerCopper
 
static LAYER_PRESET presetFront
 
static LAYER_PRESET presetFrontAssembly
 
static LAYER_PRESET presetBack
 
static LAYER_PRESET presetBackAssembly
 

Detailed Description

Definition at line 141 of file appearance_controls.h.

Member Enumeration Documentation

◆ POPUP_ID

Enumerator
ID_CHANGE_COLOR 
ID_SET_NET_COLOR 
ID_CLEAR_NET_COLOR 
ID_SHOW_ALL_NETS 
ID_HIDE_OTHER_NETS 
ID_HIGHLIGHT_NET 
ID_SELECT_NET 
ID_DESELECT_NET 
ID_SHOW_ALL_COPPER_LAYERS 
ID_HIDE_ALL_COPPER_LAYERS 
ID_HIDE_ALL_BUT_ACTIVE 
ID_PRESET_NO_LAYERS 
ID_PRESET_ALL_LAYERS 
ID_PRESET_FRONT 
ID_PRESET_FRONT_ASSEMBLY 
ID_PRESET_INNER_COPPER 
ID_PRESET_BACK 
ID_PRESET_BACK_ASSEMBLY 
ID_HIDE_ALL_NON_COPPER 
ID_SHOW_ALL_NON_COPPER 
ID_LAST_VALUE 

Definition at line 458 of file appearance_controls.h.

459 {
460 ID_CHANGE_COLOR = wxID_HIGHEST,
481 };

Constructor & Destructor Documentation

◆ APPEARANCE_CONTROLS()

APPEARANCE_CONTROLS::APPEARANCE_CONTROLS ( PCB_BASE_FRAME aParent,
wxWindow *  aFocusOwner,
bool  aFpEditor = false 
)

Definition at line 398 of file appearance_controls.cpp.

399 :
400 APPEARANCE_CONTROLS_BASE( aParent ),
401 m_frame( aParent ),
402 m_focusOwner( aFocusOwner ),
403 m_board( nullptr ),
404 m_isFpEditor( aFpEditorMode ),
405 m_currentPreset( nullptr ),
406 m_lastSelectedUserPreset( nullptr ),
407 m_layerContextMenu( nullptr )
408{
409 int indicatorSize = ConvertDialogToPixels( wxSize( 6, 6 ) ).x;
410 int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
411 m_iconProvider = new ROW_ICON_PROVIDER( indicatorSize );
412 m_pointSize = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ).GetPointSize();
413
414 m_layerPanelColour = m_panelLayers->GetBackgroundColour().ChangeLightness( 110 );
415 SetBorders( true, false, false, false );
416
417 m_layersOuterSizer = new wxBoxSizer( wxVERTICAL );
419 m_windowLayers->SetScrollRate( 0, 5 );
420 m_windowLayers->Bind( wxEVT_SET_FOCUS, &APPEARANCE_CONTROLS::OnSetFocus, this );
421
422 m_objectsOuterSizer = new wxBoxSizer( wxVERTICAL );
424 m_windowObjects->SetScrollRate( 0, 5 );
425 m_windowObjects->Bind( wxEVT_SET_FOCUS, &APPEARANCE_CONTROLS::OnSetFocus, this );
426
427 wxFont infoFont = KIUI::GetInfoFont( this );
428 m_staticTextNets->SetFont( infoFont );
429 m_staticTextNetClasses->SetFont( infoFont );
430 m_panelLayers->SetFont( infoFont );
431 m_windowLayers->SetFont( infoFont );
432 m_windowObjects->SetFont( infoFont );
433 m_presetsLabel->SetFont( infoFont );
434 m_viewportsLabel->SetFont( infoFont );
435
436 m_cbLayerPresets->SetToolTip( wxString::Format( _( "Save and restore layer visibility combinations.\n"
437 "Use %s+Tab to activate selector.\n"
438 "Successive Tabs while holding %s down will "
439 "cycle through presets in the popup." ),
442
443 m_cbViewports->SetToolTip( wxString::Format( _( "Save and restore view location and zoom.\n"
444 "Use %s+Tab to activate selector.\n"
445 "Successive Tabs while holding %s down will "
446 "cycle through viewports in the popup." ),
449
451
454
457
458 m_txtNetFilter->SetHint( _( "Filter nets" ) );
459
460 if( screenHeight <= 900 && m_pointSize >= indicatorSize )
461 m_pointSize = m_pointSize * 8 / 10;
462
463 wxFont font = m_notebook->GetFont();
464
465#ifdef __WXMAC__
466 font.SetPointSize( m_pointSize );
467 m_notebook->SetFont( font );
468#endif
469
470 auto setHighContrastMode =
471 [&]( HIGH_CONTRAST_MODE aMode )
472 {
474 opts.m_ContrastModeDisplay = aMode;
475
476 m_frame->SetDisplayOptions( opts );
477 passOnFocus();
478 };
479
480 m_rbHighContrastNormal->Bind( wxEVT_RADIOBUTTON,
481 [=]( wxCommandEvent& aEvent )
482 {
483 setHighContrastMode( HIGH_CONTRAST_MODE::NORMAL );
484 } );
485
486 m_rbHighContrastDim->Bind( wxEVT_RADIOBUTTON,
487 [=]( wxCommandEvent& aEvent )
488 {
489 setHighContrastMode( HIGH_CONTRAST_MODE::DIMMED );
490 } );
491
492 m_rbHighContrastOff->Bind( wxEVT_RADIOBUTTON,
493 [=]( wxCommandEvent& aEvent )
494 {
495 setHighContrastMode( HIGH_CONTRAST_MODE::HIDDEN );
496 } );
497
499
500 m_btnNetInspector->Bind( wxEVT_BUTTON,
501 [&]( wxCommandEvent& aEvent )
502 {
504 passOnFocus();
505 } );
506
507 m_btnConfigureNetClasses->Bind( wxEVT_BUTTON,
508 [&]( wxCommandEvent& aEvent )
509 {
510 // This panel should only be visible in the PCB_EDIT_FRAME anyway
511 if( PCB_EDIT_FRAME* editframe = dynamic_cast<PCB_EDIT_FRAME*>( m_frame ) )
512 editframe->ShowBoardSetupDialog( _( "Net Classes" ) );
513
514 passOnFocus();
515 } );
516
517 m_cbFlipBoard->SetValue( m_frame->GetCanvas()->GetView()->IsMirroredX() );
518 m_cbFlipBoard->Bind( wxEVT_CHECKBOX,
519 [&]( wxCommandEvent& aEvent )
520 {
522 } );
523
526
527 m_netsGrid->RegisterDataType( wxT( "bool" ), m_toggleGridRenderer, new wxGridCellBoolEditor );
528
529 m_netsGrid->RegisterDataType( wxT( "COLOR4D" ),
532
533 m_netsTable = new NET_GRID_TABLE( m_frame, m_panelNets->GetBackgroundColour() );
536
537 m_netsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
538 m_netsGrid->SetSelectionForeground( m_netsGrid->GetDefaultCellTextColour() );
539 m_netsGrid->SetSelectionBackground( m_panelNets->GetBackgroundColour() );
540
541 const int cellPadding = 6;
542#ifdef __WXMAC__
543 const int rowHeightPadding = 5;
544#else
545 const int rowHeightPadding = 3;
546#endif
547
548 wxSize size = ConvertDialogToPixels( SWATCH_SIZE_SMALL_DU );
549 m_netsGrid->SetColSize( NET_GRID_TABLE::COL_COLOR, size.x + cellPadding );
550
551 size = KiBitmap( BITMAPS::visibility ).GetSize();
552 m_netsGrid->SetColSize( NET_GRID_TABLE::COL_VISIBILITY, size.x + cellPadding );
553
554 m_netsGrid->SetDefaultCellFont( font );
555 m_netsGrid->SetDefaultRowSize( font.GetPixelSize().y + rowHeightPadding );
556
557 m_netsGrid->GetGridWindow()->Bind( wxEVT_MOTION, &APPEARANCE_CONTROLS::OnNetGridMouseEvent,
558 this );
559
560 // To handle middle click on color swatches
561 m_netsGrid->GetGridWindow()->Bind( wxEVT_MIDDLE_UP, &APPEARANCE_CONTROLS::OnNetGridMouseEvent,
562 this );
563
564 m_netsGrid->ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_DEFAULT );
565 m_netclassScrolledWindow->ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_DEFAULT );
566
567 if( m_isFpEditor )
568 m_notebook->RemovePage( 2 );
569
571
574
577
581
582 // Grid visibility is loaded and set to the GAL before we are constructed
584
585 Bind( wxEVT_COMMAND_MENU_SELECTED, &APPEARANCE_CONTROLS::OnLayerContextMenu, this,
587}
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:105
@ list_nets_16
@ visibility_off
@ options_generic_16
HIGH_CONTRAST_MODE
Determine how inactive layers should be displayed.
@ NORMAL
Inactive layers are shown normally (no high-contrast mode)
@ HIDDEN
Inactive layers are hidden.
@ DIMMED
Inactive layers are dimmed (old high-contrast mode)
APPEARANCE_CONTROLS_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
wxScrolledWindow * m_netclassScrolledWindow
wxRadioButton * m_rbHighContrastNormal
WX_COLLAPSIBLE_PANE * m_paneLayerDisplayOptions
void onLayerPresetChanged(wxCommandEvent &aEvent) override
NET_GRID_TABLE * m_netsTable
wxBoxSizer * m_objectsOuterSizer
LAYER_PRESET * m_lastSelectedUserPreset
void OnNetGridMouseEvent(wxMouseEvent &aEvent)
WX_COLLAPSIBLE_PANE * m_paneNetDisplayOptions
ROW_ICON_PROVIDER * m_iconProvider
wxBoxSizer * m_layersOuterSizer
wxRadioButton * m_rbHighContrastOff
LAYER_PRESET * m_currentPreset
PCB_BASE_FRAME * m_frame
void OnSetFocus(wxFocusEvent &aEvent) override
wxRadioButton * m_rbHighContrastDim
void OnLayerContextMenu(wxCommandEvent &aEvent)
Return the index of the current tab (0-2).
void SetObjectVisible(GAL_LAYER_ID aLayer, bool isVisible=true)
GRID_BITMAP_TOGGLE_RENDERER * m_toggleGridRenderer
void SetBitmap(const wxBitmap &aBmp)
Set the bitmap shown when the button is enabled.
void SetPadding(int aPadding)
Set the amount of padding present on each side of the bitmap.
bool IsGridVisible() const
A toggle button renderer for a wxGrid, similar to BITMAP_TOGGLE.
bool IsMirroredX() const
Return true if view is flipped across the X axis.
Definition: view.h:243
AUI_PANELS m_AuiPanels
static TOOL_ACTION listNets
Definition: pcb_actions.h:383
static TOOL_ACTION flipBoard
Definition: pcb_actions.h:330
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
PCBNEW_SETTINGS * GetPcbNewSettings() const
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions, bool aRefresh=true)
Updates the current display options from the given options struct.
HIGH_CONTRAST_MODE m_ContrastModeDisplay
How inactive layers are displayed.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
The main frame for Pcbnew.
Icon provider for the "standard" row indicators, for example in layer selection lists.
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:142
void SetTable(wxGridTableBase *table, bool aTakeOwnership=false)
Hide wxGrid's SetTable() method with one which doesn't mess up the grid column widths when setting th...
Definition: wx_grid.cpp:164
void SetColLabelSize(int aHeight)
Hide wxGrid's SetColLabelSize() method with one which makes sure the size is tall enough for the syst...
Definition: wx_grid.cpp:144
void SetBorders(bool aLeft, bool aRight, bool aTop, bool aBottom)
Definition: wx_panel.h:38
static const wxSize SWATCH_SIZE_SMALL_DU(8, 6)
@ SWATCH_SMALL
Definition: color_swatch.h:40
#define _(s)
#define VIEWPORT_SWITCH_KEY
#define PRESET_SWITCH_KEY
wxString KeyNameFromKeyCode(int aKeycode, bool *aIsFound)
Return the key name from the key code.
@ LAYER_GRID
Definition: layer_ids.h:205
wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:156
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200

References _, PCBNEW_SETTINGS::AUI_PANELS::appearance_expand_layer_display, PCBNEW_SETTINGS::AUI_PANELS::appearance_expand_net_display, NET_GRID_TABLE::COL_COLOR, NET_GRID_TABLE::COL_VISIBILITY, createControls(), DIMMED, WX_COLLAPSIBLE_PANE::Expand(), PCB_ACTIONS::flipBoard, Format(), PCB_BASE_FRAME::GetCanvas(), PCB_BASE_FRAME::GetDisplayOptions(), KIUI::GetInfoFont(), PCB_BASE_FRAME::GetPcbNewSettings(), TOOLS_HOLDER::GetToolManager(), PCB_DRAW_PANEL_GAL::GetView(), HIDDEN, ID_CHANGE_COLOR, ID_LAST_VALUE, EDA_DRAW_FRAME::IsGridVisible(), KIGFX::VIEW::IsMirroredX(), KeyNameFromKeyCode(), KiBitmap(), LAYER_GRID, list_nets_16, PCB_ACTIONS::listNets, loadDefaultLayerPresets(), PCBNEW_SETTINGS::m_AuiPanels, APPEARANCE_CONTROLS_BASE::m_btnConfigureNetClasses, APPEARANCE_CONTROLS_BASE::m_btnNetInspector, m_cbFlipBoard, APPEARANCE_CONTROLS_BASE::m_cbLayerPresets, APPEARANCE_CONTROLS_BASE::m_cbViewports, PCB_DISPLAY_OPTIONS::m_ContrastModeDisplay, m_frame, m_iconProvider, m_isFpEditor, m_layerPanelColour, m_layersOuterSizer, APPEARANCE_CONTROLS_BASE::m_netclassScrolledWindow, APPEARANCE_CONTROLS_BASE::m_netsGrid, m_netsTable, APPEARANCE_CONTROLS_BASE::m_notebook, m_objectsOuterSizer, m_paneLayerDisplayOptions, APPEARANCE_CONTROLS_BASE::m_panelLayers, APPEARANCE_CONTROLS_BASE::m_panelNets, m_paneNetDisplayOptions, m_pointSize, APPEARANCE_CONTROLS_BASE::m_presetsLabel, m_rbHighContrastDim, m_rbHighContrastNormal, m_rbHighContrastOff, APPEARANCE_CONTROLS_BASE::m_staticTextNetClasses, APPEARANCE_CONTROLS_BASE::m_staticTextNets, m_toggleGridRenderer, APPEARANCE_CONTROLS_BASE::m_txtNetFilter, APPEARANCE_CONTROLS_BASE::m_viewportsLabel, APPEARANCE_CONTROLS_BASE::m_windowLayers, APPEARANCE_CONTROLS_BASE::m_windowObjects, NORMAL, OnBoardChanged(), OnLayerContextMenu(), onLayerPresetChanged(), OnNetGridMouseEvent(), OnSetFocus(), options_generic_16, passOnFocus(), PRESET_SWITCH_KEY, rebuildObjects(), TOOL_MANAGER::RunAction(), BITMAP_BUTTON::SetBitmap(), WX_PANEL::SetBorders(), WX_GRID::SetColLabelSize(), PCB_BASE_FRAME::SetDisplayOptions(), SetObjectVisible(), BITMAP_BUTTON::SetPadding(), WX_GRID::SetTable(), SWATCH_SIZE_SMALL_DU(), SWATCH_SMALL, VIEWPORT_SWITCH_KEY, visibility, and visibility_off.

◆ ~APPEARANCE_CONTROLS()

Member Function Documentation

◆ ApplyLayerPreset() [1/2]

void APPEARANCE_CONTROLS::ApplyLayerPreset ( const LAYER_PRESET aPreset)

Definition at line 1436 of file appearance_controls.cpp.

1437{
1438 if( m_layerPresets.count( aPreset.name ) )
1440 else
1441 m_currentPreset = nullptr;
1442
1444 : nullptr;
1445
1447 doApplyLayerPreset( aPreset );
1448}
void doApplyLayerPreset(const LAYER_PRESET &aPreset)
void updateLayerPresetSelection(const wxString &aName)
std::map< wxString, LAYER_PRESET > m_layerPresets
wxString name
A name for this layer set.
bool readOnly
True if this is a read-only (built-in) preset.

References doApplyLayerPreset(), m_currentPreset, m_lastSelectedUserPreset, m_layerPresets, LAYER_PRESET::name, LAYER_PRESET::readOnly, and updateLayerPresetSelection().

◆ ApplyLayerPreset() [2/2]

void APPEARANCE_CONTROLS::ApplyLayerPreset ( const wxString &  aPresetName)

Definition at line 1427 of file appearance_controls.cpp.

1428{
1429 updateLayerPresetSelection( aPresetName );
1430
1431 wxCommandEvent dummy;
1433}
std::vector< FAB_LAYER_COLOR > dummy

References dummy, onLayerPresetChanged(), and updateLayerPresetSelection().

Referenced by PCB_EDIT_FRAME::onBoardLoaded(), OnLayerContextMenu(), and PCB_BASE_EDIT_FRAME::TryBefore().

◆ ApplyViewport() [1/2]

void APPEARANCE_CONTROLS::ApplyViewport ( const VIEWPORT aPreset)

Definition at line 1489 of file appearance_controls.cpp.

1490{
1491 updateViewportSelection( aViewport.name );
1492 doApplyViewport( aViewport );
1493}
void updateViewportSelection(const wxString &aName)
void doApplyViewport(const VIEWPORT &aViewport)

References doApplyViewport(), VIEWPORT::name, and updateViewportSelection().

◆ ApplyViewport() [2/2]

void APPEARANCE_CONTROLS::ApplyViewport ( const wxString &  aPresetName)

Definition at line 1480 of file appearance_controls.cpp.

1481{
1482 updateViewportSelection( aViewportName );
1483
1484 wxCommandEvent dummy;
1486}
void onViewportChanged(wxCommandEvent &aEvent) override

References dummy, onViewportChanged(), and updateViewportSelection().

Referenced by PCB_BASE_EDIT_FRAME::TryBefore().

◆ buildNetClassMenu()

void APPEARANCE_CONTROLS::buildNetClassMenu ( wxMenu &  aMenu,
bool  isDefaultClass,
const wxString &  aName 
)
private

Definition at line 2278 of file appearance_controls.cpp.

2280{
2281 if( !isDefaultClass)
2282 {
2283 aMenu.Append( new wxMenuItem( &aMenu, ID_SET_NET_COLOR, _( "Set Netclass Color" ),
2284 wxEmptyString, wxITEM_NORMAL ) );
2285 }
2286
2287 wxString name = UnescapeString( aName );
2288
2289 aMenu.Append( new wxMenuItem( &aMenu, ID_HIGHLIGHT_NET,
2290 wxString::Format( _( "Highlight Nets in %s" ), name ),
2291 wxEmptyString, wxITEM_NORMAL ) );
2292 aMenu.Append( new wxMenuItem( &aMenu, ID_SELECT_NET,
2293 wxString::Format( _( "Select Tracks and Vias in %s" ), name ),
2294 wxEmptyString, wxITEM_NORMAL ) );
2295 aMenu.Append( new wxMenuItem( &aMenu, ID_DESELECT_NET,
2296 wxString::Format( _( "Unselect Tracks and Vias in %s" ), name ),
2297 wxEmptyString, wxITEM_NORMAL ) );
2298
2299 aMenu.AppendSeparator();
2300
2301 aMenu.Append( new wxMenuItem( &aMenu, ID_SHOW_ALL_NETS, _( "Show All Netclasses" ),
2302 wxEmptyString, wxITEM_NORMAL ) );
2303 aMenu.Append( new wxMenuItem( &aMenu, ID_HIDE_OTHER_NETS, _( "Hide All Other Netclasses" ),
2304 wxEmptyString, wxITEM_NORMAL ) );
2305
2306 aMenu.Bind( wxEVT_COMMAND_MENU_SELECTED, &APPEARANCE_CONTROLS::onNetclassContextMenu, this );
2307
2308}
const char * name
Definition: DXF_plotter.cpp:56
void onNetclassContextMenu(wxCommandEvent &aEvent)
wxString UnescapeString(const wxString &aSource)

References _, Format(), ID_DESELECT_NET, ID_HIDE_OTHER_NETS, ID_HIGHLIGHT_NET, ID_SELECT_NET, ID_SET_NET_COLOR, ID_SHOW_ALL_NETS, name, onNetclassContextMenu(), and UnescapeString().

Referenced by rebuildNets().

◆ createControls()

void APPEARANCE_CONTROLS::createControls ( )
private

Definition at line 601 of file appearance_controls.cpp.

602{
603 int hotkey;
604 wxString msg;
605 wxFont infoFont = KIUI::GetInfoFont( this );
606
607 // Create layer display options
609 _( "Layer Display Options" ) );
611 m_paneLayerDisplayOptions->SetBackgroundColour( m_notebook->GetThemeBackgroundColour() );
612
613 wxWindow* layerDisplayPane = m_paneLayerDisplayOptions->GetPane();
614
615 wxBoxSizer* layerDisplayOptionsSizer;
616 layerDisplayOptionsSizer = new wxBoxSizer( wxVERTICAL );
617
619
620 if( hotkey )
621 msg = wxString::Format( _( "Inactive layers (%s):" ), KeyNameFromKeyCode( hotkey ) );
622 else
623 msg = _( "Inactive layers:" );
624
625 m_inactiveLayersLabel = new wxStaticText( layerDisplayPane, wxID_ANY, msg );
626 m_inactiveLayersLabel->SetFont( infoFont );
627 m_inactiveLayersLabel->Wrap( -1 );
628 layerDisplayOptionsSizer->Add( m_inactiveLayersLabel, 0, wxEXPAND | wxBOTTOM, 2 );
629
630 wxBoxSizer* contrastModeSizer;
631 contrastModeSizer = new wxBoxSizer( wxHORIZONTAL );
632
633 m_rbHighContrastNormal = new wxRadioButton( layerDisplayPane, wxID_ANY, _( "Normal" ),
634 wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
635 m_rbHighContrastNormal->SetFont( infoFont );
636 m_rbHighContrastNormal->SetValue( true );
637 m_rbHighContrastNormal->SetToolTip( _( "Inactive layers will be shown in full color" ) );
638
639 contrastModeSizer->Add( m_rbHighContrastNormal, 0, wxRIGHT, 5 );
640 contrastModeSizer->AddStretchSpacer();
641
642 m_rbHighContrastDim = new wxRadioButton( layerDisplayPane, wxID_ANY, _( "Dim" ) );
643 m_rbHighContrastDim->SetFont( infoFont );
644 m_rbHighContrastDim->SetToolTip( _( "Inactive layers will be dimmed" ) );
645
646 contrastModeSizer->Add( m_rbHighContrastDim, 0, wxRIGHT, 5 );
647 contrastModeSizer->AddStretchSpacer();
648
649 m_rbHighContrastOff = new wxRadioButton( layerDisplayPane, wxID_ANY, _( "Hide" ) );
650 m_rbHighContrastOff->SetFont( infoFont );
651 m_rbHighContrastOff->SetToolTip( _( "Inactive layers will be hidden" ) );
652
653 contrastModeSizer->Add( m_rbHighContrastOff, 0, 0, 5 );
654 contrastModeSizer->AddStretchSpacer();
655
656 layerDisplayOptionsSizer->Add( contrastModeSizer, 0, wxEXPAND, 5 );
657
658 m_layerDisplaySeparator = new wxStaticLine( layerDisplayPane, wxID_ANY, wxDefaultPosition,
659 wxDefaultSize, wxLI_HORIZONTAL );
660 layerDisplayOptionsSizer->Add( m_layerDisplaySeparator, 0, wxEXPAND | wxBOTTOM, 3 );
661
662 m_cbFlipBoard = new wxCheckBox( layerDisplayPane, wxID_ANY, _( "Flip board view" ) );
663 m_cbFlipBoard->SetFont( infoFont );
664 layerDisplayOptionsSizer->Add( m_cbFlipBoard, 0, wxTOP | wxBOTTOM, 5 );
665
666 layerDisplayPane->SetSizer( layerDisplayOptionsSizer );
667 layerDisplayPane->Layout();
668 layerDisplayOptionsSizer->Fit( layerDisplayPane );
669
670 m_panelLayersSizer->Add( m_paneLayerDisplayOptions, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 5 );
671
672 m_paneLayerDisplayOptions->Bind( WX_COLLAPSIBLE_PANE_CHANGED,
673 [&]( wxCommandEvent& aEvent )
674 {
675 Freeze();
676 m_panelLayers->Fit();
677 m_sizerOuter->Layout();
678 Thaw();
679 } );
680
681 // Create net display options
682
684 _( "Net Display Options" ) );
686 m_paneNetDisplayOptions->SetBackgroundColour( m_notebook->GetThemeBackgroundColour() );
687
688 wxWindow* netDisplayPane = m_paneNetDisplayOptions->GetPane();
689 wxBoxSizer* netDisplayOptionsSizer = new wxBoxSizer( wxVERTICAL );
690
692
694
695 if( hotkey )
696 msg = wxString::Format( _( "Net colors (%s):" ), KeyNameFromKeyCode( hotkey ) );
697 else
698 msg = _( "Net colors:" );
699
700 m_txtNetDisplayTitle = new wxStaticText( netDisplayPane, wxID_ANY, msg );
701 m_txtNetDisplayTitle->SetFont( infoFont );
702 m_txtNetDisplayTitle->Wrap( -1 );
703 m_txtNetDisplayTitle->SetToolTip( _( "Choose when to show net and netclass colors" ) );
704
705 netDisplayOptionsSizer->Add( m_txtNetDisplayTitle, 0, wxEXPAND | wxBOTTOM | wxLEFT, 2 );
706
707 wxBoxSizer* netColorSizer = new wxBoxSizer( wxHORIZONTAL );
708
709 m_rbNetColorAll = new wxRadioButton( netDisplayPane, wxID_ANY, _( "All" ), wxDefaultPosition,
710 wxDefaultSize, wxRB_GROUP );
711 m_rbNetColorAll->SetFont( infoFont );
712 m_rbNetColorAll->SetToolTip( _( "Net and netclass colors are shown on all copper items" ) );
713
714 netColorSizer->Add( m_rbNetColorAll, 0, wxRIGHT, 5 );
715 netColorSizer->AddStretchSpacer();
716
717 m_rbNetColorRatsnest = new wxRadioButton( netDisplayPane, wxID_ANY, _( "Ratsnest" ) );
718 m_rbNetColorRatsnest->SetFont( infoFont );
719 m_rbNetColorRatsnest->SetValue( true );
720 m_rbNetColorRatsnest->SetToolTip( _( "Net and netclass colors are shown on the ratsnest only" ) );
721
722 netColorSizer->Add( m_rbNetColorRatsnest, 0, wxRIGHT, 5 );
723 netColorSizer->AddStretchSpacer();
724
725 m_rbNetColorOff = new wxRadioButton( netDisplayPane, wxID_ANY, _( "None" ) );
726 m_rbNetColorOff->SetFont( infoFont );
727 m_rbNetColorOff->SetToolTip( _( "Net and netclass colors are not shown" ) );
728
729 netColorSizer->Add( m_rbNetColorOff, 0, 0, 5 );
730
731 netDisplayOptionsSizer->Add( netColorSizer, 0, wxEXPAND | wxBOTTOM, 5 );
732
734
736
737 if( hotkey )
738 msg = wxString::Format( _( "Ratsnest display (%s):" ), KeyNameFromKeyCode( hotkey ) );
739 else
740 msg = _( "Ratsnest display:" );
741
742 m_txtRatsnestVisibility = new wxStaticText( netDisplayPane, wxID_ANY, msg );
743 m_txtRatsnestVisibility->SetFont( infoFont );
744 m_txtRatsnestVisibility->Wrap( -1 );
745 m_txtRatsnestVisibility->SetToolTip( _( "Choose which ratsnest lines to display" ) );
746
747 netDisplayOptionsSizer->Add( m_txtRatsnestVisibility, 0, wxEXPAND | wxBOTTOM | wxLEFT, 2 );
748
749 wxBoxSizer* ratsnestDisplayModeSizer = new wxBoxSizer( wxHORIZONTAL );
750
751 m_rbRatsnestAllLayers = new wxRadioButton( netDisplayPane, wxID_ANY, _( "All" ),
752 wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
753 m_rbRatsnestAllLayers->SetFont( infoFont );
754 m_rbRatsnestAllLayers->SetValue( true );
755 m_rbRatsnestAllLayers->SetToolTip( _( "Show ratsnest lines to items on all layers" ) );
756
757 ratsnestDisplayModeSizer->Add( m_rbRatsnestAllLayers, 0, wxRIGHT, 5 );
758 ratsnestDisplayModeSizer->AddStretchSpacer();
759
760 m_rbRatsnestVisLayers = new wxRadioButton( netDisplayPane, wxID_ANY, _( "Visible layers" ) );
761 m_rbRatsnestVisLayers->SetFont( infoFont );
762 m_rbRatsnestVisLayers->SetToolTip( _( "Show ratsnest lines to items on visible layers" ) );
763
764 ratsnestDisplayModeSizer->Add( m_rbRatsnestVisLayers, 0, wxRIGHT, 5 );
765 ratsnestDisplayModeSizer->AddStretchSpacer();
766
767 m_rbRatsnestNone = new wxRadioButton( netDisplayPane, wxID_ANY, _( "None" ) );
768 m_rbRatsnestNone->SetFont( infoFont );
769 m_rbRatsnestNone->SetToolTip( _( "Hide all ratsnest lines" ) );
770
771 ratsnestDisplayModeSizer->Add( m_rbRatsnestNone, 0, 0, 5 );
772
773 netDisplayOptionsSizer->Add( ratsnestDisplayModeSizer, 0, wxEXPAND | wxBOTTOM, 5 );
774
776
777 netDisplayPane->SetSizer( netDisplayOptionsSizer );
778 netDisplayPane->Layout();
779 netDisplayOptionsSizer->Fit( netDisplayPane );
780
781 m_netsTabOuterSizer->Add( m_paneNetDisplayOptions, 0, wxEXPAND | wxTOP, 5 );
782
783 m_paneNetDisplayOptions->Bind( WX_COLLAPSIBLE_PANE_CHANGED,
784 [&]( wxCommandEvent& aEvent )
785 {
786 Freeze();
788 m_sizerOuter->Layout();
789 passOnFocus();
790 Thaw();
791 } );
792
793 m_rbNetColorAll->Bind( wxEVT_RADIOBUTTON, &APPEARANCE_CONTROLS::onNetColorMode, this );
794 m_rbNetColorOff->Bind( wxEVT_RADIOBUTTON, &APPEARANCE_CONTROLS::onNetColorMode, this );
795 m_rbNetColorRatsnest->Bind( wxEVT_RADIOBUTTON, &APPEARANCE_CONTROLS::onNetColorMode, this );
796
797 m_rbRatsnestAllLayers->Bind( wxEVT_RADIOBUTTON, &APPEARANCE_CONTROLS::onRatsnestMode, this );
798 m_rbRatsnestVisLayers->Bind( wxEVT_RADIOBUTTON, &APPEARANCE_CONTROLS::onRatsnestMode, this );
799 m_rbRatsnestNone->Bind( wxEVT_RADIOBUTTON, &APPEARANCE_CONTROLS::onRatsnestMode, this );
800}
static TOOL_ACTION highContrastModeCycle
Definition: actions.h:106
wxStaticText * m_inactiveLayersLabel
wxRadioButton * m_rbRatsnestNone
wxRadioButton * m_rbRatsnestVisLayers
wxRadioButton * m_rbNetColorAll
wxRadioButton * m_rbRatsnestAllLayers
wxRadioButton * m_rbNetColorRatsnest
void onRatsnestMode(wxCommandEvent &aEvent)
wxRadioButton * m_rbNetColorOff
wxStaticText * m_txtRatsnestVisibility
void onNetColorMode(wxCommandEvent &aEvent)
wxStaticText * m_txtNetDisplayTitle
wxStaticLine * m_layerDisplaySeparator
static TOOL_ACTION ratsnestModeCycle
Definition: pcb_actions.h:278
static TOOL_ACTION netColorModeCycle
Definition: pcb_actions.h:277
int GetHotKey() const
Return the hotkey keycode which initiates the action.
Definition: tool_action.h:111
A better wxCollapsiblePane that.
void Collapse(bool aCollapse=true)
bool SetBackgroundColour(const wxColour &aColor) override

References _, WX_COLLAPSIBLE_PANE::Collapse(), Format(), TOOL_ACTION::GetHotKey(), KIUI::GetInfoFont(), WX_COLLAPSIBLE_PANE::GetPane(), ACTIONS::highContrastModeCycle, KeyNameFromKeyCode(), m_cbFlipBoard, m_inactiveLayersLabel, m_layerDisplaySeparator, APPEARANCE_CONTROLS_BASE::m_netsTabOuterSizer, APPEARANCE_CONTROLS_BASE::m_notebook, m_paneLayerDisplayOptions, APPEARANCE_CONTROLS_BASE::m_panelLayers, APPEARANCE_CONTROLS_BASE::m_panelLayersSizer, APPEARANCE_CONTROLS_BASE::m_panelNetsAndClasses, m_paneNetDisplayOptions, m_rbHighContrastDim, m_rbHighContrastNormal, m_rbHighContrastOff, m_rbNetColorAll, m_rbNetColorOff, m_rbNetColorRatsnest, m_rbRatsnestAllLayers, m_rbRatsnestNone, m_rbRatsnestVisLayers, APPEARANCE_CONTROLS_BASE::m_sizerOuter, m_txtNetDisplayTitle, m_txtRatsnestVisibility, PCB_ACTIONS::netColorModeCycle, onNetColorMode(), onRatsnestMode(), passOnFocus(), PCB_ACTIONS::ratsnestModeCycle, and WX_COLLAPSIBLE_PANE::SetBackgroundColour().

Referenced by APPEARANCE_CONTROLS().

◆ doApplyLayerPreset()

void APPEARANCE_CONTROLS::doApplyLayerPreset ( const LAYER_PRESET aPreset)
private

Definition at line 2699 of file appearance_controls.cpp.

2700{
2701 BOARD* board = m_frame->GetBoard();
2702
2703 setVisibleLayers( aPreset.layers );
2705
2706 // If the preset doesn't have an explicit active layer to restore, we can at least
2707 // force the active layer to be something in the preset's layer set
2708 PCB_LAYER_ID activeLayer = UNSELECTED_LAYER;
2709
2710 if( aPreset.activeLayer != UNSELECTED_LAYER )
2711 activeLayer = aPreset.activeLayer;
2712 else if( aPreset.layers.any() && !aPreset.layers.test( m_frame->GetActiveLayer() ) )
2713 activeLayer = *aPreset.layers.Seq().begin();
2714
2715 LSET boardLayers = board->GetLayerSet();
2716
2717 if( activeLayer != UNSELECTED_LAYER && boardLayers.Contains( activeLayer ) )
2718 m_frame->SetActiveLayer( activeLayer );
2719
2720 if( !m_isFpEditor )
2722
2724
2726}
void setVisibleObjects(GAL_SET aObjects)
void setVisibleLayers(LSET aLayers)
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:185
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:530
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:411
bool Contains(PCB_LAYER_ID aLayer)
See if the layer set contains a PCB layer.
Definition: layer_ids.h:600
virtual PCB_LAYER_ID GetActiveLayer() const
BOARD * GetBoard() const
virtual void SetActiveLayer(PCB_LAYER_ID aLayer)
void SyncLayersVisibility(const BOARD *aBoard)
Update "visibility" property of each layer of a given BOARD.
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
@ UNSELECTED_LAYER
Definition: layer_ids.h:61
GAL_SET renderLayers
Render layers (e.g. object types) that are visible.
LSET layers
Board layers that are visible.
PCB_LAYER_ID activeLayer
Optional layer to set active when this preset is loaded.

References LAYER_PRESET::activeLayer, LSET::Contains(), PCB_BASE_FRAME::GetActiveLayer(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetCanvas(), BOARD_ITEM::GetLayerSet(), LAYER_PRESET::layers, m_frame, m_isFpEditor, EDA_DRAW_PANEL_GAL::Refresh(), LAYER_PRESET::renderLayers, LSET::Seq(), PCB_BASE_FRAME::SetActiveLayer(), setVisibleLayers(), setVisibleObjects(), syncColorsAndVisibility(), PCB_DRAW_PANEL_GAL::SyncLayersVisibility(), and UNSELECTED_LAYER.

Referenced by ApplyLayerPreset(), and onLayerPresetChanged().

◆ doApplyViewport()

void APPEARANCE_CONTROLS::doApplyViewport ( const VIEWPORT aViewport)
private

Definition at line 2865 of file appearance_controls.cpp.

2866{
2867 m_frame->GetCanvas()->GetView()->SetViewport( aViewport.rect );
2869}
void SetViewport(const BOX2D &aViewport)
Set the visible area of the VIEW.
Definition: view.cpp:523

References PCB_BASE_FRAME::GetCanvas(), PCB_DRAW_PANEL_GAL::GetView(), m_frame, VIEWPORT::rect, EDA_DRAW_PANEL_GAL::Refresh(), and KIGFX::VIEW::SetViewport().

Referenced by ApplyViewport(), and onViewportChanged().

◆ doesBoardItemNeedRebuild() [1/2]

bool APPEARANCE_CONTROLS::doesBoardItemNeedRebuild ( BOARD_ITEM aBoardItem)
private

Definition at line 1069 of file appearance_controls.cpp.

1070{
1071 return aBoardItem->Type() == PCB_NETINFO_T;
1072}
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
@ PCB_NETINFO_T
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:114

References PCB_NETINFO_T, and EDA_ITEM::Type().

Referenced by OnBoardItemAdded(), OnBoardItemChanged(), OnBoardItemRemoved(), OnBoardItemsAdded(), OnBoardItemsChanged(), and OnBoardItemsRemoved().

◆ doesBoardItemNeedRebuild() [2/2]

bool APPEARANCE_CONTROLS::doesBoardItemNeedRebuild ( std::vector< BOARD_ITEM * > &  aBoardItems)
private

Definition at line 1075 of file appearance_controls.cpp.

1076{
1077 bool rebuild = std::any_of( aBoardItems.begin(), aBoardItems.end(),
1078 []( const BOARD_ITEM* a )
1079 {
1080 return a->Type() == PCB_NETINFO_T;
1081 } );
1082
1083 return rebuild;
1084}
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:58

◆ GetActiveLayerPreset()

wxString APPEARANCE_CONTROLS::GetActiveLayerPreset ( ) const
inline

Definition at line 244 of file appearance_controls.h.

245 {
246 if( m_currentPreset )
247 return m_currentPreset->name;
248 else
249 return wxEmptyString;
250 }

References m_currentPreset, and LAYER_PRESET::name.

Referenced by PCB_EDIT_FRAME::SaveProjectSettings(), and FOOTPRINT_EDIT_FRAME::SaveSettings().

◆ GetBestSize()

wxSize APPEARANCE_CONTROLS::GetBestSize ( ) const

Definition at line 803 of file appearance_controls.cpp.

804{
805 wxSize size( 220, 480 );
806 // TODO(JE) appropriate logic
807 return size;
808}

◆ GetLayerPresetsMRU()

const wxArrayString & APPEARANCE_CONTROLS::GetLayerPresetsMRU ( )
inline

Return a list of viewports created by the user.

Definition at line 252 of file appearance_controls.h.

References m_presetMRU.

Referenced by PCB_BASE_EDIT_FRAME::TryBefore().

◆ GetTabIndex()

int APPEARANCE_CONTROLS::GetTabIndex ( ) const

Set the current notebook tab.

Definition at line 1907 of file appearance_controls.cpp.

1908{
1909 return m_notebook->GetSelection();
1910}

References APPEARANCE_CONTROLS_BASE::m_notebook.

Referenced by FOOTPRINT_EDIT_FRAME::SaveSettings(), and PCB_EDIT_FRAME::SaveSettings().

◆ GetUserLayerPresets()

std::vector< LAYER_PRESET > APPEARANCE_CONTROLS::GetUserLayerPresets ( ) const

Update the current layer presets from those saved in the project file.

Definition at line 1376 of file appearance_controls.cpp.

1377{
1378 std::vector<LAYER_PRESET> ret;
1379
1380 for( const std::pair<const wxString, LAYER_PRESET>& pair : m_layerPresets )
1381 {
1382 if( !pair.second.readOnly )
1383 ret.emplace_back( pair.second );
1384 }
1385
1386 return ret;
1387}

References m_layerPresets.

Referenced by PCB_EDIT_FRAME::SaveProjectSettings(), and FOOTPRINT_EDIT_FRAME::SaveSettings().

◆ GetUserViewports()

std::vector< VIEWPORT > APPEARANCE_CONTROLS::GetUserViewports ( ) const

Update the current viewports from those saved in the project file.

Definition at line 1451 of file appearance_controls.cpp.

1452{
1453 std::vector<VIEWPORT> ret;
1454
1455 for( const std::pair<const wxString, VIEWPORT>& pair : m_viewports )
1456 ret.emplace_back( pair.second );
1457
1458 return ret;
1459}
std::map< wxString, VIEWPORT > m_viewports

References m_viewports.

Referenced by PCB_EDIT_FRAME::SaveProjectSettings().

◆ GetViewportsMRU()

const wxArrayString & APPEARANCE_CONTROLS::GetViewportsMRU ( )
inline

Definition at line 264 of file appearance_controls.h.

264{ return m_viewportMRU; }

References m_viewportMRU.

Referenced by PCB_BASE_EDIT_FRAME::TryBefore().

◆ getVisibleLayers()

LSET APPEARANCE_CONTROLS::getVisibleLayers ( )
private

Definition at line 1299 of file appearance_controls.cpp.

1300{
1301 if( m_isFpEditor )
1302 {
1303 KIGFX::VIEW* view = m_frame->GetCanvas()->GetView();
1304 LSET set;
1305
1306 for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
1307 set.set( layer, view->IsLayerVisible( layer ) );
1308
1309 return set;
1310 }
1311 else
1312 {
1313 return m_frame->GetBoard()->GetVisibleLayers();
1314 }
1315}
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:579
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:69
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
Definition: view.h:410
static LSET AllLayersMask()
Definition: lset.cpp:808

References LSET::AllLayersMask(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetCanvas(), PCB_DRAW_PANEL_GAL::GetView(), BOARD::GetVisibleLayers(), KIGFX::VIEW::IsLayerVisible(), m_frame, and m_isFpEditor.

Referenced by OnLayerContextMenu(), onLayerPresetChanged(), onLayerVisibilityToggled(), rebuildLayers(), SetLayerVisible(), syncColorsAndVisibility(), and syncLayerPresetSelection().

◆ getVisibleObjects()

GAL_SET APPEARANCE_CONTROLS::getVisibleObjects ( )
private

Definition at line 1318 of file appearance_controls.cpp.

1319{
1320 if( m_isFpEditor )
1321 {
1322 KIGFX::VIEW* view = m_frame->GetCanvas()->GetView();
1323 GAL_SET set;
1324 set.reset();
1325
1326 for( size_t i = 0; i < set.size(); i++ )
1327 set.set( i, view->IsLayerVisible( GAL_LAYER_ID_START + GAL_LAYER_ID( i ) ) );
1328
1329 return set;
1330 }
1331 else
1332 {
1333 return m_frame->GetBoard()->GetVisibleElements();
1334 }
1335}
GAL_SET GetVisibleElements() const
Return a set of all the element categories that are visible.
Definition: board.cpp:625
Helper for storing and iterating over GAL_LAYER_IDs.
Definition: layer_ids.h:296
GAL_SET & set()
Definition: layer_ids.h:311
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
Definition: layer_ids.h:190
@ GAL_LAYER_ID_START
Definition: layer_ids.h:191

References GAL_LAYER_ID_START, PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetCanvas(), PCB_DRAW_PANEL_GAL::GetView(), BOARD::GetVisibleElements(), KIGFX::VIEW::IsLayerVisible(), m_frame, m_isFpEditor, and GAL_SET::set().

Referenced by onLayerPresetChanged(), onObjectVisibilityChanged(), rebuildObjects(), syncColorsAndVisibility(), syncLayerPresetSelection(), and syncObjectSettings().

◆ handleBoardItemsChanged()

void APPEARANCE_CONTROLS::handleBoardItemsChanged ( )
private

◆ idleFocusHandler()

void APPEARANCE_CONTROLS::idleFocusHandler ( wxIdleEvent &  aEvent)
private

Definition at line 835 of file appearance_controls.cpp.

836{
837 passOnFocus();
838 Unbind( wxEVT_IDLE, &APPEARANCE_CONTROLS::idleFocusHandler, this );
839}
void idleFocusHandler(wxIdleEvent &aEvent)

References idleFocusHandler(), and passOnFocus().

Referenced by idleFocusHandler(), and OnNotebookPageChanged().

◆ loadDefaultLayerPresets()

void APPEARANCE_CONTROLS::loadDefaultLayerPresets ( )
private

Definition at line 1409 of file appearance_controls.cpp.

1410{
1411 m_layerPresets.clear();
1412 m_presetMRU.clear();
1413
1414 // Load the read-only defaults
1418 {
1419 m_layerPresets[preset.name] = preset;
1420 m_layerPresets[preset.name].readOnly = true;
1421
1422 m_presetMRU.Add( preset.name );
1423 }
1424}
static LAYER_PRESET presetFrontAssembly
static LAYER_PRESET presetBackAssembly
static LAYER_PRESET presetInnerCopper
static LAYER_PRESET presetFront
static LAYER_PRESET presetBack
static LAYER_PRESET presetAllCopper
static LAYER_PRESET presetAllLayers
A saved set of layers that are visible.

References m_layerPresets, m_presetMRU, presetAllCopper, presetAllLayers, presetBack, presetBackAssembly, presetFront, presetFrontAssembly, and presetInnerCopper.

Referenced by APPEARANCE_CONTROLS(), and SetUserLayerPresets().

◆ m_netsTabSplitterOnIdle()

void APPEARANCE_CONTROLS_BASE::m_netsTabSplitterOnIdle ( wxIdleEvent &  )
inlineinherited

◆ netclassNameFromEvent()

wxString APPEARANCE_CONTROLS::netclassNameFromEvent ( wxEvent &  aEvent)
private

Definition at line 3035 of file appearance_controls.cpp.

3036{
3037 COLOR_SWATCH* s = static_cast<COLOR_SWATCH*>( aEvent.GetEventObject() );
3038 int classId = s->GetId();
3039
3040 wxASSERT( m_netclassIdMap.count( classId ) );
3041 return m_netclassIdMap.at( classId );
3042}
std::map< int, wxString > m_netclassIdMap
Stores wxIDs for each netclass for control event mapping.
A simple color swatch of the kind used to set layer colors.
Definition: color_swatch.h:57

References m_netclassIdMap.

Referenced by onNetclassColorChanged(), and onNetclassVisibilityChanged().

◆ OnBoardChanged()

void APPEARANCE_CONTROLS::OnBoardChanged ( )

Definition at line 1027 of file appearance_controls.cpp.

1028{
1029 Freeze();
1030 rebuildLayers();
1034 rebuildNets();
1038
1040
1042
1043 if( m_board )
1044 m_board->AddListener( this );
1045
1046 Thaw();
1047 Refresh();
1048}
void UpdateDisplayOptions()
Return a list of the layer presets created by the user.
void AddListener(BOARD_LISTENER *aListener)
Add a listener to the board to receive calls whenever something on the board has been modified.
Definition: board.cpp:2023
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...

References BOARD::AddListener(), PCB_BASE_FRAME::GetBoard(), m_board, m_frame, rebuildLayerContextMenu(), rebuildLayerPresetsWidget(), rebuildLayers(), rebuildNets(), rebuildViewportsWidget(), Refresh(), syncColorsAndVisibility(), syncLayerPresetSelection(), syncObjectSettings(), and UpdateDisplayOptions().

Referenced by APPEARANCE_CONTROLS(), PCB_EDIT_FRAME::Clear_Pcb(), PCB_EDIT_FRAME::onBoardLoaded(), FOOTPRINT_EDIT_FRAME::UpdateUserInterface(), and PCB_EDIT_FRAME::UpdateUserInterface().

◆ OnBoardHighlightNetChanged()

virtual void BOARD_LISTENER::OnBoardHighlightNetChanged ( BOARD aBoard)
inlinevirtualinherited

Reimplemented in DIALOG_NET_INSPECTOR, and PCB_SEARCH_PANE.

Definition at line 247 of file board.h.

247{ }

Referenced by BOARD::HighLightON(), BOARD::ResetNetHighLight(), and BOARD::SetHighLightNet().

◆ OnBoardItemAdded()

void APPEARANCE_CONTROLS::OnBoardItemAdded ( BOARD aBoard,
BOARD_ITEM aItem 
)
overridevirtual

Reimplemented from BOARD_LISTENER.

Definition at line 1087 of file appearance_controls.cpp.

1088{
1089 if( doesBoardItemNeedRebuild( aItem ) )
1091}
bool doesBoardItemNeedRebuild(BOARD_ITEM *aBoardItem)

References doesBoardItemNeedRebuild(), and handleBoardItemsChanged().

◆ OnBoardItemChanged()

void APPEARANCE_CONTROLS::OnBoardItemChanged ( BOARD aBoard,
BOARD_ITEM aItem 
)
overridevirtual

Reimplemented from BOARD_LISTENER.

Definition at line 1115 of file appearance_controls.cpp.

1116{
1117 if( doesBoardItemNeedRebuild( aItem ) )
1119}

References doesBoardItemNeedRebuild(), and handleBoardItemsChanged().

◆ OnBoardItemRemoved()

void APPEARANCE_CONTROLS::OnBoardItemRemoved ( BOARD aBoard,
BOARD_ITEM aItem 
)
overridevirtual

Reimplemented from BOARD_LISTENER.

Definition at line 1101 of file appearance_controls.cpp.

1102{
1103 if( doesBoardItemNeedRebuild( aItem ) )
1105}

References doesBoardItemNeedRebuild(), and handleBoardItemsChanged().

◆ OnBoardItemsAdded()

void APPEARANCE_CONTROLS::OnBoardItemsAdded ( BOARD aBoard,
std::vector< BOARD_ITEM * > &  aItems 
)
overridevirtual

Reimplemented from BOARD_LISTENER.

Definition at line 1094 of file appearance_controls.cpp.

1095{
1096 if( doesBoardItemNeedRebuild( aItems ) )
1098}

References doesBoardItemNeedRebuild(), and handleBoardItemsChanged().

◆ OnBoardItemsChanged()

void APPEARANCE_CONTROLS::OnBoardItemsChanged ( BOARD aBoard,
std::vector< BOARD_ITEM * > &  aItems 
)
overridevirtual

Update the colors on all the widgets from the new chosen color theme.

Reimplemented from BOARD_LISTENER.

Definition at line 1122 of file appearance_controls.cpp.

1123{
1124 if( doesBoardItemNeedRebuild( aItems ) )
1126}

References doesBoardItemNeedRebuild(), and handleBoardItemsChanged().

◆ OnBoardItemsRemoved()

void APPEARANCE_CONTROLS::OnBoardItemsRemoved ( BOARD aBoard,
std::vector< BOARD_ITEM * > &  aItems 
)
overridevirtual

Reimplemented from BOARD_LISTENER.

Definition at line 1108 of file appearance_controls.cpp.

1109{
1110 if( doesBoardItemNeedRebuild( aItems ) )
1112}

References doesBoardItemNeedRebuild(), and handleBoardItemsChanged().

◆ OnBoardNetSettingsChanged()

void APPEARANCE_CONTROLS::OnBoardNetSettingsChanged ( BOARD aBoard)
overridevirtual

Reimplemented from BOARD_LISTENER.

Definition at line 1051 of file appearance_controls.cpp.

1052{
1054}

References handleBoardItemsChanged().

◆ OnColorSwatchChanged()

void APPEARANCE_CONTROLS::OnColorSwatchChanged ( wxCommandEvent &  aEvent)

Definition at line 2872 of file appearance_controls.cpp.

2873{
2874 COLOR_SWATCH* swatch = static_cast<COLOR_SWATCH*>( aEvent.GetEventObject() );
2875 COLOR4D newColor = swatch->GetSwatchColor();
2876 int layer = swatch->GetId();
2877
2879 cs->SetColor( layer, newColor );
2880
2882
2883 KIGFX::VIEW* view = m_frame->GetCanvas()->GetView();
2884 view->UpdateLayerColor( layer );
2885 view->UpdateLayerColor( GetNetnameLayer( layer ) );
2886
2887 if( IsCopperLayer( layer ) )
2888 view->UpdateLayerColor( ZONE_LAYER_FOR( layer ) );
2889
2890 if( layer == F_Cu )
2892 else if( layer == B_Cu )
2894
2895 // Update the bitmap of the layer box
2897 static_cast<PCB_EDIT_FRAME*>( m_frame )->ReCreateLayerBox( false );
2898
2900
2901 if( layer == LAYER_PCB_BACKGROUND )
2902 m_frame->SetDrawBgColor( newColor );
2903
2904 passOnFocus();
2905}
Color settings are a bit different than most of the settings objects in that there can be more than o...
void SetColor(int aLayer, const COLOR4D &aColor)
KIGFX::COLOR4D GetSwatchColor() const
bool IsType(FRAME_T aType) const
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
void UpdateLayerColor(int aLayer)
Apply the new coloring scheme held by RENDER_SETTINGS in case that it has changed.
Definition: view.cpp:740
void SetDrawBgColor(const COLOR4D &aColor) override
virtual COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
void UpdateColors()
Update the color settings in the painter and GAL.
void ReCreateLayerBox(bool aForceResizeToolbar=true)
Recreate the layer box by clearing the old list and building a new one from the new layer names and c...
@ FRAME_PCB_EDITOR
Definition: frame_type.h:40
int GetNetnameLayer(int aLayer)
Returns a netname layer corresponding to the given layer.
Definition: layer_ids.h:966
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:825
@ LAYER_PAD_FR
smd pads, front layer
Definition: layer_ids.h:202
@ LAYER_PCB_BACKGROUND
PCB background color.
Definition: layer_ids.h:220
@ LAYER_PAD_BK
smd pads, back layer
Definition: layer_ids.h:203
@ B_Cu
Definition: layer_ids.h:95
@ F_Cu
Definition: layer_ids.h:64
#define ZONE_LAYER_FOR(boardLayer)
Definition: layer_ids.h:268

References B_Cu, F_Cu, FRAME_PCB_EDITOR, PCB_BASE_FRAME::GetCanvas(), PCB_BASE_FRAME::GetColorSettings(), GetNetnameLayer(), COLOR_SWATCH::GetSwatchColor(), PCB_DRAW_PANEL_GAL::GetView(), IsCopperLayer(), EDA_BASE_FRAME::IsType(), LAYER_PAD_BK, LAYER_PAD_FR, LAYER_PCB_BACKGROUND, m_frame, passOnFocus(), PCB_EDIT_FRAME::ReCreateLayerBox(), EDA_DRAW_PANEL_GAL::Refresh(), COLOR_SETTINGS::SetColor(), PCB_BASE_FRAME::SetDrawBgColor(), PCB_DRAW_PANEL_GAL::UpdateColors(), KIGFX::VIEW::UpdateLayerColor(), and ZONE_LAYER_FOR.

Referenced by rebuildLayers(), and rebuildObjects().

◆ OnColorThemeChanged()

void APPEARANCE_CONTROLS::OnColorThemeChanged ( )

Respond to change in OS's DarkMode.

Definition at line 1137 of file appearance_controls.cpp.

1138{
1141}

References syncColorsAndVisibility(), and syncObjectSettings().

Referenced by PCB_EDIT_FRAME::CommonSettingsChanged().

◆ OnDarkModeToggle()

void APPEARANCE_CONTROLS::OnDarkModeToggle ( )

Update the widget when the active board layer is changed.

Definition at line 1144 of file appearance_controls.cpp.

1145{
1146 // This is essentially a list of hacks because DarkMode isn't yet implemented inside
1147 // wxWidgets.
1148 //
1149 // The individual wxPanels, COLOR_SWATCHes and GRID_CELL_COLOR_RENDERERs should really be
1150 // overriding some virtual method or responding to some wxWidgets event so that the parent
1151 // doesn't have to know what it contains. But, that's not where we are, so... :shrug:
1152
1153 m_layerPanelColour = m_panelLayers->GetBackgroundColour().ChangeLightness( 110 );
1154
1155 m_windowLayers->SetBackgroundColour( m_layerPanelColour );
1156
1157 for( wxSizerItem* child : m_layersOuterSizer->GetChildren() )
1158 {
1159 if( child && child->GetWindow() )
1160 child->GetWindow()->SetBackgroundColour( m_layerPanelColour );
1161 }
1162
1163 // Easier than calling OnDarkModeToggle on all the GRID_CELL_COLOR_RENDERERs:
1164 m_netsGrid->RegisterDataType( wxT( "COLOR4D" ),
1167
1168 for( const std::pair<const wxString, APPEARANCE_SETTING*>& pair : m_netclassSettingsMap )
1169 {
1170 if( pair.second->ctl_color )
1171 pair.second->ctl_color->OnDarkModeToggle();
1172 }
1173
1174 OnLayerChanged(); // Update selected highlighting
1175}
std::map< wxString, APPEARANCE_SETTING * > m_netclassSettingsMap

References m_frame, m_layerPanelColour, m_layersOuterSizer, m_netclassSettingsMap, APPEARANCE_CONTROLS_BASE::m_netsGrid, APPEARANCE_CONTROLS_BASE::m_panelLayers, APPEARANCE_CONTROLS_BASE::m_windowLayers, OnLayerChanged(), and SWATCH_SMALL.

Referenced by PCB_BASE_EDIT_FRAME::onDarkModeToggle().

◆ OnLanguageChanged()

void APPEARANCE_CONTROLS::OnLanguageChanged ( )

Update the panel contents from the application and board models.

Definition at line 1002 of file appearance_controls.cpp.

1003{
1004 m_notebook->SetPageText( 0, _( "Layers" ) );
1005 m_notebook->SetPageText( 1, _( "Objects" ) );
1006 m_notebook->SetPageText( 2, _( "Nets" ) );
1007
1008 Freeze();
1009 rebuildLayers();
1014 rebuildNets();
1015
1019
1021
1022 Thaw();
1023 Refresh();
1024}

References _, APPEARANCE_CONTROLS_BASE::m_notebook, rebuildLayerContextMenu(), rebuildLayerPresetsWidget(), rebuildLayers(), rebuildNets(), rebuildObjects(), rebuildViewportsWidget(), Refresh(), syncColorsAndVisibility(), syncLayerPresetSelection(), syncObjectSettings(), and UpdateDisplayOptions().

Referenced by FOOTPRINT_EDIT_FRAME::ShowChangedLanguage(), and PCB_EDIT_FRAME::ShowChangedLanguage().

◆ OnLayerChanged()

void APPEARANCE_CONTROLS::OnLayerChanged ( )

Definition at line 1178 of file appearance_controls.cpp.

1179{
1180 for( const std::unique_ptr<APPEARANCE_SETTING>& setting : m_layerSettings )
1181 {
1182 setting->ctl_panel->SetBackgroundColour( m_layerPanelColour );
1183 setting->ctl_indicator->SetIndicatorState( ROW_ICON_PROVIDER::STATE::OFF );
1184 }
1185
1186 wxChar r = m_layerPanelColour.Red();
1187 wxChar g = m_layerPanelColour.Green();
1188 wxChar b = m_layerPanelColour.Blue();
1189
1190 if( r < 240 || g < 240 || b < 240 )
1191 {
1192 r = wxChar( std::min( (int) r + 15, 255 ) );
1193 g = wxChar( std::min( (int) g + 15, 255 ) );
1194 b = wxChar( std::min( (int) b + 15, 255 ) );
1195 }
1196 else
1197 {
1198 r = wxChar( std::max( (int) r - 15, 0 ) );
1199 g = wxChar( std::max( (int) g - 15, 0 ) );
1200 b = wxChar( std::max( (int) b - 15, 0 ) );
1201 }
1202
1203 PCB_LAYER_ID current = m_frame->GetActiveLayer();
1204
1205 if( !m_layerSettingsMap.count( current ) )
1206 {
1207 wxASSERT( m_layerSettingsMap.count( F_Cu ) );
1208 current = F_Cu;
1209 }
1210
1211 APPEARANCE_SETTING* newSetting = m_layerSettingsMap[ current ];
1212
1213 newSetting->ctl_panel->SetBackgroundColour( wxColour( r, g, b ) );
1214 newSetting->ctl_indicator->SetIndicatorState( ROW_ICON_PROVIDER::STATE::ON );
1215
1216 Refresh();
1217}
#define ON
std::map< PCB_LAYER_ID, APPEARANCE_SETTING * > m_layerSettingsMap
std::vector< std::unique_ptr< APPEARANCE_SETTING > > m_layerSettings

References APPEARANCE_CONTROLS::APPEARANCE_SETTING::ctl_indicator, APPEARANCE_CONTROLS::APPEARANCE_SETTING::ctl_panel, F_Cu, PCB_BASE_FRAME::GetActiveLayer(), m_frame, m_layerPanelColour, m_layerSettings, m_layerSettingsMap, ON, Refresh(), and INDICATOR_ICON::SetIndicatorState().

Referenced by OnDarkModeToggle(), FOOTPRINT_EDIT_FRAME::SetActiveLayer(), PCB_EDIT_FRAME::SetActiveLayer(), and syncColorsAndVisibility().

◆ OnLayerContextMenu()

void APPEARANCE_CONTROLS::OnLayerContextMenu ( wxCommandEvent &  aEvent)

Return the index of the current tab (0-2).

Definition at line 1825 of file appearance_controls.cpp.

1826{
1827 BOARD* board = m_frame->GetBoard();
1828 LSET visible = getVisibleLayers();
1829
1830 PCB_LAYER_ID current = m_frame->GetActiveLayer();
1831
1832 switch( aEvent.GetId() )
1833 {
1836 return;
1837
1840 return;
1841
1843 visible |= presetAllCopper.layers;
1844 setVisibleLayers( visible );
1845 break;
1846
1849 SetLayerVisible( current, true );
1850 break;
1851
1853 visible &= ~presetAllCopper.layers;
1854
1855 if( !visible.test( current ) && visible.count() > 0 )
1856 m_frame->SetActiveLayer( *visible.Seq().begin() );
1857
1858 setVisibleLayers( visible );
1859 break;
1860
1862 visible &= presetAllCopper.layers;
1863
1864 if( !visible.test( current ) && visible.count() > 0 )
1865 m_frame->SetActiveLayer( *visible.Seq().begin() );
1866
1867 setVisibleLayers( visible );
1868 break;
1869
1871 visible |= ~presetAllCopper.layers;
1872
1873 setVisibleLayers( visible );
1874 break;
1875
1878 return;
1879
1880 case ID_PRESET_FRONT:
1882 return;
1883
1886 return;
1887
1888 case ID_PRESET_BACK:
1890 return;
1891
1894 return;
1895 }
1896
1899
1900 if( !m_isFpEditor )
1902
1904}
void ApplyLayerPreset(const wxString &aPresetName)
static LAYER_PRESET presetNoLayers
void SetLayerVisible(int aLayer, bool isVisible)

References ApplyLayerPreset(), PCB_BASE_FRAME::GetActiveLayer(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetCanvas(), getVisibleLayers(), ID_HIDE_ALL_BUT_ACTIVE, ID_HIDE_ALL_COPPER_LAYERS, ID_HIDE_ALL_NON_COPPER, ID_PRESET_ALL_LAYERS, ID_PRESET_BACK, ID_PRESET_BACK_ASSEMBLY, ID_PRESET_FRONT, ID_PRESET_FRONT_ASSEMBLY, ID_PRESET_INNER_COPPER, ID_PRESET_NO_LAYERS, ID_SHOW_ALL_COPPER_LAYERS, ID_SHOW_ALL_NON_COPPER, LAYER_PRESET::layers, m_frame, m_isFpEditor, presetAllCopper, presetAllLayers, presetBack, presetBackAssembly, presetFront, presetFrontAssembly, presetInnerCopper, presetNoLayers, EDA_DRAW_PANEL_GAL::Refresh(), LSET::Seq(), PCB_BASE_FRAME::SetActiveLayer(), SetLayerVisible(), setVisibleLayers(), syncColorsAndVisibility(), syncLayerPresetSelection(), and PCB_DRAW_PANEL_GAL::SyncLayersVisibility().

Referenced by APPEARANCE_CONTROLS().

◆ onLayerLeftClick()

void APPEARANCE_CONTROLS::onLayerLeftClick ( wxMouseEvent &  aEvent)
private

Definition at line 1970 of file appearance_controls.cpp.

1971{
1972 wxWindow* eventSource = static_cast<wxWindow*>( aEvent.GetEventObject() );
1973
1974 PCB_LAYER_ID layer = ToLAYER_ID( eventSource->GetId() );
1975
1977 return;
1978
1979 m_frame->SetActiveLayer( layer );
1980 passOnFocus();
1981}
static LSET ForbiddenFootprintLayers()
Layers which are not allowed within footprint definitions.
Definition: lset.cpp:915
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:932

References LSET::ForbiddenFootprintLayers(), m_frame, m_isFpEditor, passOnFocus(), PCB_BASE_FRAME::SetActiveLayer(), and ToLAYER_ID().

Referenced by rebuildLayers().

◆ onLayerPresetChanged()

void APPEARANCE_CONTROLS::onLayerPresetChanged ( wxCommandEvent &  aEvent)
overrideprivatevirtual

Reimplemented from APPEARANCE_CONTROLS_BASE.

Definition at line 2574 of file appearance_controls.cpp.

2575{
2576 int count = m_cbLayerPresets->GetCount();
2577 int index = m_cbLayerPresets->GetSelection();
2578
2579 auto resetSelection =
2580 [&]()
2581 {
2582 if( m_currentPreset )
2583 m_cbLayerPresets->SetStringSelection( m_currentPreset->name );
2584 else
2585 m_cbLayerPresets->SetSelection( m_cbLayerPresets->GetCount() - 3 );
2586 };
2587
2588 if( index == count - 3 )
2589 {
2590 // Separator: reject the selection
2591 resetSelection();
2592 return;
2593 }
2594 else if( index == count - 2 )
2595 {
2596 // Save current state to new preset
2597 wxString name;
2598
2601
2602 wxTextEntryDialog dlg( this, _( "Layer preset name:" ), _( "Save Layer Preset" ), name );
2603
2604 if( dlg.ShowModal() != wxID_OK )
2605 {
2606 resetSelection();
2607 return;
2608 }
2609
2610 name = dlg.GetValue();
2611 bool exists = m_layerPresets.count( name );
2612
2613 if( !exists )
2614 {
2617 }
2618
2619 LAYER_PRESET* preset = &m_layerPresets[name];
2620 m_currentPreset = preset;
2621
2622 if( !exists )
2623 {
2624 index = m_cbLayerPresets->Insert( name, index - 1, static_cast<void*>( preset ) );
2625 }
2626 else
2627 {
2628 preset->layers = getVisibleLayers();
2629 preset->renderLayers = getVisibleObjects();
2630
2631 index = m_cbLayerPresets->FindString( name );
2632 m_presetMRU.Remove( name );
2633 }
2634
2635 m_cbLayerPresets->SetSelection( index );
2636 m_presetMRU.Insert( name, 0 );
2637
2638 return;
2639 }
2640 else if( index == count - 1 )
2641 {
2642 // Delete a preset
2643 wxArrayString headers;
2644 std::vector<wxArrayString> items;
2645
2646 headers.Add( _( "Presets" ) );
2647
2648 for( std::pair<const wxString, LAYER_PRESET>& pair : m_layerPresets )
2649 {
2650 if( !pair.second.readOnly )
2651 {
2652 wxArrayString item;
2653 item.Add( pair.first );
2654 items.emplace_back( item );
2655 }
2656 }
2657
2658 EDA_LIST_DIALOG dlg( m_frame, _( "Delete Preset" ), headers, items );
2659 dlg.SetListLabel( _( "Select preset:" ) );
2660
2661 if( dlg.ShowModal() == wxID_OK )
2662 {
2663 wxString presetName = dlg.GetTextSelection();
2664 int idx = m_cbLayerPresets->FindString( presetName );
2665
2666 if( idx != wxNOT_FOUND )
2667 {
2668 m_layerPresets.erase( presetName );
2669
2670 m_cbLayerPresets->Delete( idx );
2671 m_currentPreset = nullptr;
2672
2673 m_presetMRU.Remove( presetName );
2674 }
2675 }
2676
2677 resetSelection();
2678 return;
2679 }
2680
2681 LAYER_PRESET* preset = static_cast<LAYER_PRESET*>( m_cbLayerPresets->GetClientData( index ) );
2682 m_currentPreset = preset;
2683
2684 m_lastSelectedUserPreset = ( !preset || preset->readOnly ) ? nullptr : preset;
2685
2686 if( preset )
2687 doApplyLayerPreset( *preset );
2688
2689 if( !m_currentPreset->name.IsEmpty() )
2690 {
2691 m_presetMRU.Remove( m_currentPreset->name );
2692 m_presetMRU.Insert( m_currentPreset->name, 0 );
2693 }
2694
2695 passOnFocus();
2696}
A dialog which shows:

References _, doApplyLayerPreset(), EDA_LIST_DIALOG::GetTextSelection(), getVisibleLayers(), getVisibleObjects(), LAYER_PRESET::layers, APPEARANCE_CONTROLS_BASE::m_cbLayerPresets, m_currentPreset, m_frame, m_lastSelectedUserPreset, m_layerPresets, m_presetMRU, name, LAYER_PRESET::name, passOnFocus(), LAYER_PRESET::readOnly, LAYER_PRESET::renderLayers, EDA_LIST_DIALOG::SetListLabel(), and UNSELECTED_LAYER.

Referenced by APPEARANCE_CONTROLS(), and ApplyLayerPreset().

◆ onLayerVisibilityToggled()

void APPEARANCE_CONTROLS::onLayerVisibilityToggled ( PCB_LAYER_ID  aLayer)
private

Definition at line 1992 of file appearance_controls.cpp.

1993{
1994 LSET visibleLayers = getVisibleLayers();
1995
1996 visibleLayers.set( aLayer, !visibleLayers.test( aLayer ) );
1997 setVisibleLayers( visibleLayers );
1998 m_frame->GetCanvas()->GetView()->SetLayerVisible( aLayer, visibleLayers.test( aLayer ) );
1999
2002}
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
Definition: view.h:393

References PCB_BASE_FRAME::GetCanvas(), PCB_DRAW_PANEL_GAL::GetView(), getVisibleLayers(), m_frame, EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::VIEW::SetLayerVisible(), setVisibleLayers(), and syncLayerPresetSelection().

Referenced by rebuildLayers().

◆ onNetclassColorChanged()

void APPEARANCE_CONTROLS::onNetclassColorChanged ( wxCommandEvent &  aEvent)
private

Definition at line 3017 of file appearance_controls.cpp.

3018{
3021
3022 std::map<wxString, KIGFX::COLOR4D>& netclassColors = rs->GetNetclassColorMap();
3023
3024 COLOR_SWATCH* swatch = static_cast<COLOR_SWATCH*>( aEvent.GetEventObject() );
3025 wxString netclassName = netclassNameFromEvent( aEvent );
3026
3027 netclassColors[netclassName] = swatch->GetSwatchColor();
3028
3032}
wxString netclassNameFromEvent(wxEvent &aEvent)
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
PCB specific render settings.
Definition: pcb_painter.h:72
std::map< wxString, KIGFX::COLOR4D > & GetNetclassColorMap()
Definition: pcb_painter.h:114
void UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
Definition: view.cpp:761
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:213
void RedrawRatsnest()
Return the bounding box of the view that should be used if model is not valid.

References PCB_BASE_FRAME::GetCanvas(), KIGFX::PCB_RENDER_SETTINGS::GetNetclassColorMap(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), COLOR_SWATCH::GetSwatchColor(), PCB_DRAW_PANEL_GAL::GetView(), m_frame, netclassNameFromEvent(), PCB_DRAW_PANEL_GAL::RedrawRatsnest(), EDA_DRAW_PANEL_GAL::Refresh(), and KIGFX::VIEW::UpdateAllLayersColor().

Referenced by rebuildNets().

◆ onNetclassContextMenu()

void APPEARANCE_CONTROLS::onNetclassContextMenu ( wxCommandEvent &  aEvent)
private

Definition at line 3092 of file appearance_controls.cpp.

3093{
3094 KIGFX::VIEW* view = m_frame->GetCanvas()->GetView();
3096 static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
3097
3098 BOARD* board = m_frame->GetBoard();
3099 std::shared_ptr<NET_SETTINGS>& netSettings = board->GetDesignSettings().m_NetSettings;
3100 APPEARANCE_SETTING* setting = nullptr;
3101
3103
3104 if( it != m_netclassSettingsMap.end() )
3105 setting = it->second;
3106
3107 auto runOnNetsOfClass =
3108 [&]( const wxString& netClassName, std::function<void( NETINFO_ITEM* )> aFunction )
3109 {
3110 for( NETINFO_ITEM* net : board->GetNetInfo() )
3111 {
3112 if( net->GetNetClass()->GetName() == netClassName )
3113 aFunction( net );
3114 }
3115 };
3116
3117 switch( aEvent.GetId() )
3118 {
3119 case ID_SET_NET_COLOR:
3120 if( setting )
3121 {
3122 setting->ctl_color->GetNewSwatchColor();
3123
3124 COLOR4D color = setting->ctl_color->GetSwatchColor();
3125
3126 std::map<wxString, KIGFX::COLOR4D>& netclassColors = rs->GetNetclassColorMap();
3127
3128 if( color != COLOR4D::UNSPECIFIED )
3129 netclassColors[m_contextMenuNetclass] = color;
3130 else
3131 netclassColors.erase( m_contextMenuNetclass );
3132
3133 view->UpdateAllLayersColor();
3134 }
3135
3136 break;
3137
3138 case ID_HIGHLIGHT_NET:
3139 if( !m_contextMenuNetclass.IsEmpty() )
3140 {
3141 runOnNetsOfClass( m_contextMenuNetclass,
3142 [&]( NETINFO_ITEM* aItem )
3143 {
3144 static bool first = true;
3145 int code = aItem->GetNetCode();
3146
3147 if( first )
3148 {
3149 board->SetHighLightNet( code );
3150 rs->SetHighlight( true, code );
3151 first = false;
3152 }
3153 else
3154 {
3155 board->SetHighLightNet( code, true );
3156 rs->SetHighlight( true, code, true );
3157 }
3158 } );
3159
3160 view->UpdateAllLayersColor();
3161 board->HighLightON();
3162 }
3163
3164 break;
3165
3166 case ID_SELECT_NET:
3167 case ID_DESELECT_NET:
3168 if( !m_contextMenuNetclass.IsEmpty() )
3169 {
3170 TOOL_MANAGER* toolMgr = m_frame->GetToolManager();
3173
3174 runOnNetsOfClass( m_contextMenuNetclass,
3175 [&]( NETINFO_ITEM* aItem )
3176 {
3177 toolMgr->RunAction( action, true,
3178 static_cast<intptr_t>( aItem->GetNetCode() ) );
3179 } );
3180 }
3181 break;
3182
3183
3184 case ID_SHOW_ALL_NETS:
3186 wxASSERT( m_netclassSettingsMap.count( NETCLASS::Default ) );
3187 m_netclassSettingsMap.at( NETCLASS::Default )->ctl_visibility->SetValue( true );
3188
3189 for( const auto& [ name, netclass ] : netSettings->m_NetClasses )
3190 {
3191 showNetclass( name );
3192
3193 if( m_netclassSettingsMap.count( name ) )
3194 m_netclassSettingsMap.at( name )->ctl_visibility->SetValue( true );
3195 }
3196
3197 break;
3198
3199 case ID_HIDE_OTHER_NETS:
3200 {
3201 bool showDefault = m_contextMenuNetclass == NETCLASS::Default;
3202 showNetclass( NETCLASS::Default, showDefault );
3203 wxASSERT( m_netclassSettingsMap.count( NETCLASS::Default ) );
3204 m_netclassSettingsMap.at( NETCLASS::Default )->ctl_visibility->SetValue( showDefault );
3205
3206 for( const auto& [ name, netclass ] : netSettings->m_NetClasses )
3207 {
3208 bool show = ( name == m_contextMenuNetclass );
3209
3210 showNetclass( name, show );
3211
3212 if( m_netclassSettingsMap.count( name ) )
3213 m_netclassSettingsMap.at( name )->ctl_visibility->SetValue( show );
3214 }
3215
3216 break;
3217 }
3218
3219 default:
3220 break;
3221 }
3222
3225
3226 m_contextMenuNetclass.clear();
3227}
int color
Definition: DXF_plotter.cpp:57
wxString m_contextMenuNetclass
The name of the netclass that was right-clicked.
void showNetclass(const wxString &aClassName, bool aShow=true)
std::shared_ptr< NET_SETTINGS > m_NetSettings
const NETINFO_LIST & GetNetInfo() const
Definition: board.h:765
void SetHighLightNet(int aNetCode, bool aMulti=false)
Select the netcode to be highlighted.
Definition: board.cpp:2069
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:682
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
Definition: board.cpp:2082
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aMulti=false)
Turns on/off highlighting.
static const char Default[]
the name of the default NETCLASS
Definition: netclass.h:49
Handle the data for a net.
Definition: netinfo.h:67
int GetNetCode() const
Definition: netinfo.h:114
static TOOL_ACTION selectNet
Select all connections belonging to a single net.
Definition: pcb_actions.h:86
static TOOL_ACTION deselectNet
Remove all connections belonging to a single net from the active selection.
Definition: pcb_actions.h:89
Represent a single user action.
Definition: tool_action.h:68
int GetId() const
Return the unique id of the TOOL_ACTION object.
Definition: tool_action.h:121
Master controller class:
Definition: tool_manager.h:55

References color, APPEARANCE_CONTROLS::APPEARANCE_SETTING::ctl_color, NETCLASS::Default, PCB_ACTIONS::deselectNet, PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetCanvas(), BOARD::GetDesignSettings(), TOOL_ACTION::GetId(), KIGFX::PCB_RENDER_SETTINGS::GetNetclassColorMap(), NETINFO_ITEM::GetNetCode(), BOARD::GetNetInfo(), COLOR_SWATCH::GetNewSwatchColor(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), COLOR_SWATCH::GetSwatchColor(), TOOLS_HOLDER::GetToolManager(), PCB_DRAW_PANEL_GAL::GetView(), BOARD::HighLightON(), ID_DESELECT_NET, ID_HIDE_OTHER_NETS, ID_HIGHLIGHT_NET, ID_SELECT_NET, ID_SET_NET_COLOR, ID_SHOW_ALL_NETS, m_contextMenuNetclass, m_frame, m_netclassSettingsMap, BOARD_DESIGN_SETTINGS::m_NetSettings, name, PCB_DRAW_PANEL_GAL::RedrawRatsnest(), EDA_DRAW_PANEL_GAL::Refresh(), TOOL_MANAGER::RunAction(), PCB_ACTIONS::selectNet, KIGFX::RENDER_SETTINGS::SetHighlight(), BOARD::SetHighLightNet(), showNetclass(), and KIGFX::VIEW::UpdateAllLayersColor().

Referenced by buildNetClassMenu().

◆ onNetclassVisibilityChanged()

void APPEARANCE_CONTROLS::onNetclassVisibilityChanged ( wxCommandEvent &  aEvent)
private

Definition at line 2979 of file appearance_controls.cpp.

2980{
2981 wxString className = netclassNameFromEvent( aEvent );
2982 bool show = aEvent.GetInt();
2983 showNetclass( className, show );
2984 passOnFocus();
2985}

References netclassNameFromEvent(), passOnFocus(), and showNetclass().

Referenced by rebuildNets().

◆ onNetColorMode()

void APPEARANCE_CONTROLS::onNetColorMode ( wxCommandEvent &  aEvent)
private

Definition at line 3045 of file appearance_controls.cpp.

3046{
3048
3049 if( m_rbNetColorAll->GetValue() )
3051 else if( m_rbNetColorRatsnest->GetValue() )
3053 else
3055
3056 m_frame->SetDisplayOptions( options );
3058 passOnFocus();
3059}
@ RATSNEST
Net/netclass colors are shown on ratsnest lines only.
@ ALL
Net/netclass colors are shown on all net copper.
@ OFF
Net (and netclass) colors are not shown.
NET_COLOR_MODE m_NetColorMode
How to use color overrides on specific nets and netclasses.

References ALL, PCB_BASE_FRAME::GetCanvas(), PCB_BASE_FRAME::GetDisplayOptions(), PCB_DRAW_PANEL_GAL::GetView(), m_frame, PCB_DISPLAY_OPTIONS::m_NetColorMode, m_rbNetColorAll, m_rbNetColorRatsnest, OFF, passOnFocus(), RATSNEST, PCB_BASE_FRAME::SetDisplayOptions(), and KIGFX::VIEW::UpdateAllLayersColor().

Referenced by createControls().

◆ onNetContextMenu()

void APPEARANCE_CONTROLS::onNetContextMenu ( wxCommandEvent &  aEvent)
private

Definition at line 2927 of file appearance_controls.cpp.

2928{
2929 wxASSERT( m_netsGrid->GetSelectedRows().size() == 1 );
2930
2931 int row = m_netsGrid->GetSelectedRows()[0];
2932 NET_GRID_ENTRY& net = m_netsTable->GetEntry( row );
2933
2934 m_netsGrid->ClearSelection();
2935
2936 switch( aEvent.GetId() )
2937 {
2938 case ID_SET_NET_COLOR:
2939 {
2940 wxGridCellEditor* editor = m_netsGrid->GetCellEditor( row, NET_GRID_TABLE::COL_COLOR );
2941 editor->BeginEdit( row, NET_GRID_TABLE::COL_COLOR, m_netsGrid );
2942 break;
2943 }
2944
2945 case ID_HIGHLIGHT_NET:
2947 static_cast<intptr_t>( net.code ) );
2949 break;
2950
2951 case ID_SELECT_NET:
2953 static_cast<intptr_t>( net.code ) );
2955 break;
2956
2957 case ID_DESELECT_NET:
2959 static_cast<intptr_t>( net.code ) );
2961 break;
2962
2963 case ID_SHOW_ALL_NETS:
2965 break;
2966
2967 case ID_HIDE_OTHER_NETS:
2968 m_netsTable->HideOtherNets( net );
2969 break;
2970
2971 default:
2972 break;
2973 }
2974
2975 passOnFocus();
2976}
NET_GRID_ENTRY & GetEntry(int aRow)
void HideOtherNets(const NET_GRID_ENTRY &aNet)
static TOOL_ACTION highlightNet
Definition: pcb_actions.h:497
int code

References NET_GRID_ENTRY::code, NET_GRID_TABLE::COL_COLOR, PCB_ACTIONS::deselectNet, editor, PCB_BASE_FRAME::GetCanvas(), NET_GRID_TABLE::GetEntry(), TOOLS_HOLDER::GetToolManager(), NET_GRID_TABLE::HideOtherNets(), PCB_ACTIONS::highlightNet, ID_DESELECT_NET, ID_HIDE_OTHER_NETS, ID_HIGHLIGHT_NET, ID_SELECT_NET, ID_SET_NET_COLOR, ID_SHOW_ALL_NETS, m_frame, APPEARANCE_CONTROLS_BASE::m_netsGrid, m_netsTable, passOnFocus(), EDA_DRAW_PANEL_GAL::Refresh(), TOOL_MANAGER::RunAction(), PCB_ACTIONS::selectNet, and NET_GRID_TABLE::ShowAllNets().

Referenced by OnNetGridRightClick().

◆ OnNetGridClick()

void APPEARANCE_CONTROLS::OnNetGridClick ( wxGridEvent &  event)
overrideprotectedvirtual

Reimplemented from APPEARANCE_CONTROLS_BASE.

Definition at line 865 of file appearance_controls.cpp.

866{
867 int row = event.GetRow();
868 int col = event.GetCol();
869
870 switch( col )
871 {
873 m_netsTable->SetValueAsBool( row, col, !m_netsTable->GetValueAsBool( row, col ) );
874 m_netsGrid->ForceRefresh();
875 break;
876
877 default:
878 break;
879 }
880}
void SetValueAsBool(int aRow, int aCol, bool aValue) override
bool GetValueAsBool(int aRow, int aCol) override

References NET_GRID_TABLE::COL_VISIBILITY, NET_GRID_TABLE::GetValueAsBool(), APPEARANCE_CONTROLS_BASE::m_netsGrid, m_netsTable, and NET_GRID_TABLE::SetValueAsBool().

◆ OnNetGridDoubleClick()

void APPEARANCE_CONTROLS::OnNetGridDoubleClick ( wxGridEvent &  event)
overrideprotectedvirtual

Reimplemented from APPEARANCE_CONTROLS_BASE.

Definition at line 883 of file appearance_controls.cpp.

884{
885 int row = event.GetRow();
886 int col = event.GetCol();
887
888 switch( col )
889 {
891 m_netsGrid->GetCellEditor( row, col )->BeginEdit( row, col, m_netsGrid );
892 break;
893
894 default:
895 break;
896 }
897}

References NET_GRID_TABLE::COL_COLOR, and APPEARANCE_CONTROLS_BASE::m_netsGrid.

◆ OnNetGridMouseEvent()

void APPEARANCE_CONTROLS::OnNetGridMouseEvent ( wxMouseEvent &  aEvent)
protected

Definition at line 933 of file appearance_controls.cpp.

934{
935 wxPoint pos = m_netsGrid->CalcUnscrolledPosition( aEvent.GetPosition() );
936 wxGridCellCoords cell = m_netsGrid->XYToCell( pos );
937
938 if( aEvent.Moving() || aEvent.Entering() )
939 {
940 aEvent.Skip();
941
942 if( !cell )
943 {
944 m_netsGrid->GetGridWindow()->UnsetToolTip();
945 return;
946 }
947
948 if( cell == m_hoveredCell )
949 return;
950
951 m_hoveredCell = cell;
952
953 NET_GRID_ENTRY& net = m_netsTable->GetEntry( cell.GetRow() );
954
955 wxString name = net.name;
956 wxString showOrHide = net.visible ? _( "Click to hide ratsnest for %s" )
957 : _( "Click to show ratsnest for %s" );
958 wxString tip;
959
960 if( cell.GetCol() == NET_GRID_TABLE::COL_VISIBILITY )
961 {
962 tip.Printf( showOrHide, name );
963 }
964 else if( cell.GetCol() == NET_GRID_TABLE::COL_COLOR )
965 {
966 tip = _( "Double click (or middle click) to change color; "
967 "right click for more actions" );
968 }
969
970 m_netsGrid->GetGridWindow()->SetToolTip( tip );
971 }
972 else if( aEvent.Leaving() )
973 {
974 m_netsGrid->UnsetToolTip();
975 aEvent.Skip();
976 }
977 else if( aEvent.Dragging() )
978 {
979 // not allowed
980 CallAfter( [&]()
981 {
982 m_netsGrid->ClearSelection();
983 } );
984 }
985 else if( aEvent.ButtonUp( wxMOUSE_BTN_MIDDLE ) && !!cell )
986 {
987 int row = cell.GetRow();
988 int col = cell.GetCol();
989
990 if(col == NET_GRID_TABLE::COL_COLOR )
991 m_netsGrid->GetCellEditor( row, col )->BeginEdit( row, col, m_netsGrid );
992
993 aEvent.Skip();
994 }
995 else
996 {
997 aEvent.Skip();
998 }
999}
wxGridCellCoords m_hoveredCell
Grid cell that is being hovered over, for tooltips.
wxString name
bool visible

References _, NET_GRID_TABLE::COL_COLOR, NET_GRID_TABLE::COL_VISIBILITY, NET_GRID_TABLE::GetEntry(), m_hoveredCell, APPEARANCE_CONTROLS_BASE::m_netsGrid, m_netsTable, name, NET_GRID_ENTRY::name, and NET_GRID_ENTRY::visible.

Referenced by APPEARANCE_CONTROLS().

◆ OnNetGridRightClick()

void APPEARANCE_CONTROLS::OnNetGridRightClick ( wxGridEvent &  event)
overrideprotectedvirtual

Reimplemented from APPEARANCE_CONTROLS_BASE.

Definition at line 900 of file appearance_controls.cpp.

901{
902 m_netsGrid->SelectRow( event.GetRow() );
903
904 wxString netName = UnescapeString( m_netsGrid->GetCellValue( event.GetRow(),
906 wxMenu menu;
907
908 menu.Append( new wxMenuItem( &menu, ID_SET_NET_COLOR, _( "Set Net Color" ), wxEmptyString,
909 wxITEM_NORMAL ) );
910 menu.Append( new wxMenuItem( &menu, ID_HIGHLIGHT_NET,
911 wxString::Format( _( "Highlight %s" ), netName ), wxEmptyString,
912 wxITEM_NORMAL ) );
913 menu.Append( new wxMenuItem( &menu, ID_SELECT_NET,
914 wxString::Format( _( "Select Tracks and Vias in %s" ), netName ),
915 wxEmptyString, wxITEM_NORMAL ) );
916 menu.Append( new wxMenuItem( &menu, ID_DESELECT_NET,
917 wxString::Format( _( "Unselect Tracks and Vias in %s" ), netName ),
918 wxEmptyString, wxITEM_NORMAL ) );
919
920 menu.AppendSeparator();
921
922 menu.Append( new wxMenuItem( &menu, ID_SHOW_ALL_NETS, _( "Show All Nets" ), wxEmptyString,
923 wxITEM_NORMAL ) );
924 menu.Append( new wxMenuItem( &menu, ID_HIDE_OTHER_NETS, _( "Hide All Other Nets" ),
925 wxEmptyString, wxITEM_NORMAL ) );
926
927 menu.Bind( wxEVT_COMMAND_MENU_SELECTED, &APPEARANCE_CONTROLS::onNetContextMenu, this );
928
929 PopupMenu( &menu );
930}
void onNetContextMenu(wxCommandEvent &aEvent)

References _, NET_GRID_TABLE::COL_LABEL, Format(), ID_DESELECT_NET, ID_HIDE_OTHER_NETS, ID_HIGHLIGHT_NET, ID_SELECT_NET, ID_SET_NET_COLOR, ID_SHOW_ALL_NETS, APPEARANCE_CONTROLS_BASE::m_netsGrid, onNetContextMenu(), and UnescapeString().

◆ OnNetVisibilityChanged()

void APPEARANCE_CONTROLS::OnNetVisibilityChanged ( int  aNetCode,
bool  aVisibility 
)

Notifies the panel when a net has been hidden or shown via the external tool.

Manually update visibility for a given layer

Definition at line 1057 of file appearance_controls.cpp.

1058{
1059 int row = m_netsTable->GetRowByNetcode( aNetCode );
1060
1061 if( row >= 0 )
1062 {
1064 m_netsGrid->ForceRefresh();
1065 }
1066}
int GetRowByNetcode(int aCode) const

References NET_GRID_TABLE::COL_VISIBILITY, NET_GRID_TABLE::GetRowByNetcode(), APPEARANCE_CONTROLS_BASE::m_netsGrid, m_netsTable, and NET_GRID_TABLE::SetValueAsBool().

Referenced by BOARD_INSPECTION_TOOL::doHideRatsnestNet().

◆ OnNotebookPageChanged()

void APPEARANCE_CONTROLS::OnNotebookPageChanged ( wxNotebookEvent &  event)
overrideprotectedvirtual

Reimplemented from APPEARANCE_CONTROLS_BASE.

Definition at line 811 of file appearance_controls.cpp.

812{
813 // Work around wxMac issue where the notebook pages are blank
814#ifdef __WXMAC__
815 int page = aEvent.GetSelection();
816
817 if( page >= 0 )
818 m_notebook->ChangeSelection( static_cast<unsigned>( page ) );
819#endif
820
821#ifndef __WXMSW__
822 // Because wxWidgets is broken and will send click events to children of the collapsible
823 // panes even if they are collapsed without this
824 Freeze();
825 m_panelLayers->Fit();
827 m_sizerOuter->Layout();
828 Thaw();
829#endif
830
831 Bind( wxEVT_IDLE, &APPEARANCE_CONTROLS::idleFocusHandler, this );
832}

References idleFocusHandler(), APPEARANCE_CONTROLS_BASE::m_notebook, APPEARANCE_CONTROLS_BASE::m_panelLayers, APPEARANCE_CONTROLS_BASE::m_panelNetsAndClasses, and APPEARANCE_CONTROLS_BASE::m_sizerOuter.

◆ onObjectOpacitySlider()

void APPEARANCE_CONTROLS::onObjectOpacitySlider ( int  aLayer,
float  aOpacity 
)
private

Definition at line 2908 of file appearance_controls.cpp.

2909{
2911
2912 switch( aLayer )
2913 {
2914 case static_cast<int>( LAYER_TRACKS ): options.m_TrackOpacity = aOpacity; break;
2915 case static_cast<int>( LAYER_VIAS ): options.m_ViaOpacity = aOpacity; break;
2916 case static_cast<int>( LAYER_PADS ): options.m_PadOpacity = aOpacity; break;
2917 case static_cast<int>( LAYER_ZONES ): options.m_ZoneOpacity = aOpacity; break;
2918 case static_cast<int>( LAYER_DRAW_BITMAPS ): options.m_ImageOpacity = aOpacity; break;
2919 default: return;
2920 }
2921
2922 m_frame->SetDisplayOptions( options );
2923 passOnFocus();
2924}
double m_TrackOpacity
Opacity override for all tracks.
double m_ZoneOpacity
Opacity override for filled zone areas.
double m_ImageOpacity
Opacity override for user images.
double m_PadOpacity
Opacity override for SMD pads and PTHs.
double m_ViaOpacity
Opacity override for all types of via.
@ LAYER_DRAW_BITMAPS
to handle and draw images bitmaps
Definition: layer_ids.h:223
@ LAYER_ZONES
Control for copper zone opacity/visibility (color ignored)
Definition: layer_ids.h:231
@ LAYER_PADS
Meta control for all pads opacity/visibility (color ignored)
Definition: layer_ids.h:230
@ LAYER_TRACKS
Definition: layer_ids.h:212
@ LAYER_VIAS
Meta control for all vias opacity/visibility.
Definition: layer_ids.h:193

References PCB_BASE_FRAME::GetDisplayOptions(), LAYER_DRAW_BITMAPS, LAYER_PADS, LAYER_TRACKS, LAYER_VIAS, LAYER_ZONES, m_frame, PCB_DISPLAY_OPTIONS::m_ImageOpacity, PCB_DISPLAY_OPTIONS::m_PadOpacity, PCB_DISPLAY_OPTIONS::m_TrackOpacity, PCB_DISPLAY_OPTIONS::m_ViaOpacity, PCB_DISPLAY_OPTIONS::m_ZoneOpacity, passOnFocus(), and PCB_BASE_FRAME::SetDisplayOptions().

Referenced by rebuildObjects().

◆ onObjectVisibilityChanged()

void APPEARANCE_CONTROLS::onObjectVisibilityChanged ( GAL_LAYER_ID  aLayer,
bool  isVisible,
bool  isFinal 
)
private

Definition at line 2005 of file appearance_controls.cpp.

2007{
2008 // Special-case controls
2009 switch( aLayer )
2010 {
2011 case LAYER_RATSNEST:
2012 {
2013 // don't touch the layers. ratsnest is enabled on per-item basis.
2015 m_frame->GetCanvas()->GetView()->SetLayerVisible( aLayer, true );
2016
2018 {
2020 m_frame->GetBoard()->SetElementVisibility( aLayer, isVisible );
2023 }
2024
2025 break;
2026 }
2027
2028 case LAYER_GRID:
2029 m_frame->SetGridVisibility( isVisible );
2032 break;
2033
2034 case LAYER_MOD_TEXT:
2035 // Because Footprint Text is a meta-control that also can disable values/references,
2036 // drag them along here so that the user is less likely to be confused.
2037 if( isFinal )
2038 {
2039 // Should only trigger when you actually click the Footprint Text button
2040 // Otherwise it goes into infinite recursive loop with the following case section
2042 onObjectVisibilityChanged( LAYER_MOD_VALUES, isVisible, false );
2043 m_objectSettingsMap[LAYER_MOD_REFERENCES]->ctl_visibility->SetValue( isVisible );
2044 m_objectSettingsMap[LAYER_MOD_VALUES]->ctl_visibility->SetValue( isVisible );
2045 }
2046 break;
2047
2049 case LAYER_MOD_VALUES:
2050 // In case that user changes Footprint Value/References when the Footprint Text
2051 // meta-control is disabled, we should put it back on.
2052 if( isVisible )
2053 {
2054 onObjectVisibilityChanged( LAYER_MOD_TEXT, isVisible, false );
2055 m_objectSettingsMap[LAYER_MOD_TEXT]->ctl_visibility->SetValue( isVisible );
2056 }
2057 break;
2058
2059 default:
2060 break;
2061 }
2062
2063 GAL_SET visible = getVisibleObjects();
2064
2065 if( visible.Contains( aLayer ) != isVisible )
2066 {
2067 visible.set( aLayer, isVisible );
2068 setVisibleObjects( visible );
2069 m_frame->GetCanvas()->GetView()->SetLayerVisible( aLayer, isVisible );
2071 }
2072
2073 if( isFinal )
2074 {
2076 passOnFocus();
2077 }
2078}
std::map< GAL_LAYER_ID, APPEARANCE_SETTING * > m_objectSettingsMap
void onObjectVisibilityChanged(GAL_LAYER_ID aLayer, bool isVisible, bool isFinal)
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Change the visibility of an element category.
Definition: board.cpp:637
virtual void SetGridVisibility(bool aVisible)
bool Contains(GAL_LAYER_ID aPos)
Definition: layer_ids.h:329
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition: view.h:617
DISPLAY_OPTIONS m_Display
virtual void OnDisplayOptionsChanged()
@ LAYER_MOD_TEXT
Definition: layer_ids.h:198
@ LAYER_RATSNEST
Definition: layer_ids.h:204
@ LAYER_MOD_VALUES
show footprints values (when texts are visible)
Definition: layer_ids.h:210
@ LAYER_MOD_REFERENCES
show footprints references (when texts are visible)
Definition: layer_ids.h:211
@ TARGET_NONCACHED
Auxiliary rendering target (noncached)
Definition: definitions.h:49

References GAL_SET::Contains(), FRAME_PCB_EDITOR, PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetCanvas(), PCB_BASE_FRAME::GetPcbNewSettings(), PCB_DRAW_PANEL_GAL::GetView(), getVisibleObjects(), EDA_BASE_FRAME::IsType(), LAYER_GRID, LAYER_MOD_REFERENCES, LAYER_MOD_TEXT, LAYER_MOD_VALUES, LAYER_RATSNEST, PCBNEW_SETTINGS::m_Display, m_frame, m_objectSettingsMap, PCBNEW_SETTINGS::DISPLAY_OPTIONS::m_ShowGlobalRatsnest, KIGFX::VIEW::MarkTargetDirty(), PCB_BASE_FRAME::OnDisplayOptionsChanged(), onObjectVisibilityChanged(), passOnFocus(), PCB_DRAW_PANEL_GAL::RedrawRatsnest(), EDA_DRAW_PANEL_GAL::Refresh(), GAL_SET::set(), BOARD::SetElementVisibility(), EDA_DRAW_FRAME::SetGridVisibility(), KIGFX::VIEW::SetLayerVisible(), setVisibleObjects(), syncLayerPresetSelection(), and KIGFX::TARGET_NONCACHED.

Referenced by onObjectVisibilityChanged(), and rebuildObjects().

◆ OnPaint()

void WX_PANEL::OnPaint ( wxPaintEvent &  event)
privateinherited

Definition at line 47 of file wx_panel.cpp.

48{
49 wxRect rect( wxPoint( 0, 0 ), GetClientSize() );
50 wxPaintDC dc( this );
51
52 KIGFX::COLOR4D bg = wxSystemSettings::GetColour( wxSYS_COLOUR_FRAMEBK );
53 KIGFX::COLOR4D fg = wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER );
54 KIGFX::COLOR4D border = fg.Mix( bg, 0.18 );
55 dc.SetPen( wxPen( border.ToColour(), 1 ) );
56
57 if( m_leftBorder )
58 dc.DrawLine( rect.GetLeft(), rect.GetTop(), rect.GetLeft(), rect.GetBottom() );
59
60 if( m_rightBorder )
61 dc.DrawLine( rect.GetRight(), rect.GetTop(), rect.GetRight(), rect.GetBottom() );
62
63 if( m_topBorder )
64 dc.DrawLine( rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetTop() );
65
66 if( m_bottomBorder )
67 dc.DrawLine( rect.GetLeft(), rect.GetBottom(), rect.GetRight(), rect.GetBottom() );
68}
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Return a color that is mixed with the input by a factor.
Definition: color4d.h:311
bool m_topBorder
Definition: wx_panel.h:52
bool m_rightBorder
Definition: wx_panel.h:51
bool m_leftBorder
Definition: wx_panel.h:50
bool m_bottomBorder
Definition: wx_panel.h:53

References WX_PANEL::m_bottomBorder, WX_PANEL::m_leftBorder, WX_PANEL::m_rightBorder, WX_PANEL::m_topBorder, and KIGFX::COLOR4D::Mix().

Referenced by WX_PANEL::WX_PANEL(), and WX_PANEL::~WX_PANEL().

◆ onRatsnestMode()

void APPEARANCE_CONTROLS::onRatsnestMode ( wxCommandEvent &  aEvent)
private

Definition at line 3062 of file appearance_controls.cpp.

3063{
3065
3066 if( m_rbRatsnestAllLayers->GetValue() )
3067 {
3068 cfg->m_Display.m_ShowGlobalRatsnest = true;
3070 }
3071 else if( m_rbRatsnestVisLayers->GetValue() )
3072 {
3073 cfg->m_Display.m_ShowGlobalRatsnest = true;
3075 }
3076 else
3077 {
3078 cfg->m_Display.m_ShowGlobalRatsnest = false;
3079 }
3080
3081 if( PCB_EDIT_FRAME* editframe = dynamic_cast<PCB_EDIT_FRAME*>( m_frame ) )
3082 {
3083 editframe->SetElementVisibility( LAYER_RATSNEST, cfg->m_Display.m_ShowGlobalRatsnest );
3084 editframe->OnDisplayOptionsChanged();
3085 editframe->GetCanvas()->RedrawRatsnest();
3086 editframe->GetCanvas()->Refresh();
3087 }
3088 passOnFocus();
3089}
@ VISIBLE
Ratsnest lines are drawn to items on visible layers only.
@ ALL
Ratsnest lines are drawn to items on all layers (default)

References ALL, PCB_BASE_FRAME::GetPcbNewSettings(), LAYER_RATSNEST, PCBNEW_SETTINGS::m_Display, m_frame, PCBNEW_SETTINGS::DISPLAY_OPTIONS::m_RatsnestMode, m_rbRatsnestAllLayers, m_rbRatsnestVisLayers, PCBNEW_SETTINGS::DISPLAY_OPTIONS::m_ShowGlobalRatsnest, passOnFocus(), and VISIBLE.

Referenced by createControls().

◆ onReadOnlySwatch()

void APPEARANCE_CONTROLS::onReadOnlySwatch ( )
private

Definition at line 3236 of file appearance_controls.cpp.

3237{
3238 WX_INFOBAR* infobar = m_frame->GetInfoBar();
3239
3240 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, _( "Open Preferences" ),
3241 wxEmptyString );
3242
3243 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
3244 [&]( wxHyperlinkEvent& aEvent )
3245 {
3246 wxCommandEvent dummy;
3248 } ) );
3249
3250 infobar->RemoveAllButtons();
3251 infobar->AddButton( button );
3252 infobar->AddCloseButton();
3253
3254 infobar->ShowMessageFor( _( "The current color theme is read-only. Create a new theme in "
3255 "Preferences to enable color editing." ),
3256 10000, wxICON_INFORMATION );
3257}
void OnPreferences(wxCommandEvent &event)
Displays the preferences and settings of all opened editors paged dialog.
WX_INFOBAR * GetInfoBar()
A modified version of the wxInfoBar class that allows us to:
Definition: wx_infobar.h:75
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
Definition: wx_infobar.cpp:289
void ShowMessageFor(const wxString &aMessage, int aTime, int aFlags=wxICON_INFORMATION, MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the infobar with the provided message and icon for a specific period of time.
Definition: wx_infobar.cpp:128
void AddButton(wxButton *aButton)
Add an already created button to the infobar.
Definition: wx_infobar.cpp:248
void AddCloseButton(const wxString &aTooltip=_("Hide this message."))
Add the default close button to the infobar on the right side.
Definition: wx_infobar.cpp:279

References _, WX_INFOBAR::AddButton(), WX_INFOBAR::AddCloseButton(), dummy, EDA_BASE_FRAME::GetInfoBar(), m_frame, EDA_BASE_FRAME::OnPreferences(), WX_INFOBAR::RemoveAllButtons(), and WX_INFOBAR::ShowMessageFor().

Referenced by rebuildLayers(), and rebuildObjects().

◆ OnSetFocus()

void APPEARANCE_CONTROLS::OnSetFocus ( wxFocusEvent &  aEvent)
overrideprotectedvirtual

Reimplemented from APPEARANCE_CONTROLS_BASE.

Definition at line 842 of file appearance_controls.cpp.

843{
844#ifdef __WXMSW__
845 // In wxMSW, buttons won't process events unless they have focus, so we'll let it take the
846 // focus and give it back to the parent in the button event handler.
847 if( wxBitmapButton* btn = dynamic_cast<wxBitmapButton*>( aEvent.GetEventObject() ) )
848 {
849 wxCommandEvent evt( wxEVT_BUTTON );
850 wxPostEvent( btn, evt );
851 }
852#endif
853
854 passOnFocus();
855 aEvent.Skip();
856}

References passOnFocus().

Referenced by APPEARANCE_CONTROLS(), and rebuildObjects().

◆ OnSize()

void APPEARANCE_CONTROLS::OnSize ( wxSizeEvent &  aEvent)
overrideprotectedvirtual

Reimplemented from APPEARANCE_CONTROLS_BASE.

Definition at line 859 of file appearance_controls.cpp.

860{
861 aEvent.Skip();
862}

◆ onViewportChanged()

void APPEARANCE_CONTROLS::onViewportChanged ( wxCommandEvent &  aEvent)
overrideprivatevirtual

Reimplemented from APPEARANCE_CONTROLS_BASE.

Definition at line 2765 of file appearance_controls.cpp.

2766{
2767 int count = m_cbViewports->GetCount();
2768 int index = m_cbViewports->GetSelection();
2769
2770 if( index >= 0 && index < count - 3 )
2771 {
2772 VIEWPORT* viewport = static_cast<VIEWPORT*>( m_cbViewports->GetClientData( index ) );
2773
2774 wxCHECK( viewport, /* void */ );
2775
2776 doApplyViewport( *viewport );
2777
2778 if( !viewport->name.IsEmpty() )
2779 {
2780 m_viewportMRU.Remove( viewport->name );
2781 m_viewportMRU.Insert( viewport->name, 0 );
2782 }
2783 }
2784 else if( index == count - 2 )
2785 {
2786 // Save current state to new preset
2787 wxString name;
2788
2789 wxTextEntryDialog dlg( this, _( "Viewport name:" ), _( "Save Viewport" ), name );
2790
2791 if( dlg.ShowModal() != wxID_OK )
2792 {
2794 m_cbViewports->SetStringSelection( m_lastSelectedViewport->name );
2795 else
2796 m_cbViewports->SetSelection( m_cbViewports->GetCount() - 3 );
2797
2798 return;
2799 }
2800
2801 name = dlg.GetValue();
2802 bool exists = m_viewports.count( name );
2803
2804 if( !exists )
2805 {
2807
2808 index = m_cbViewports->Insert( name, index-1, static_cast<void*>( &m_viewports[name] ) );
2809 }
2810 else
2811 {
2813 index = m_cbViewports->FindString( name );
2814 m_viewportMRU.Remove( name );
2815 }
2816
2817 m_cbViewports->SetSelection( index );
2818 m_viewportMRU.Insert( name, 0 );
2819
2820 return;
2821 }
2822 else if( index == count - 1 )
2823 {
2824 // Delete an existing viewport
2825 wxArrayString headers;
2826 std::vector<wxArrayString> items;
2827
2828 headers.Add( _( "Viewports" ) );
2829
2830 for( std::pair<const wxString, VIEWPORT>& pair : m_viewports )
2831 {
2832 wxArrayString item;
2833 item.Add( pair.first );
2834 items.emplace_back( item );
2835 }
2836
2837 EDA_LIST_DIALOG dlg( m_frame, _( "Delete Viewport" ), headers, items );
2838 dlg.SetListLabel( _( "Select viewport:" ) );
2839
2840 if( dlg.ShowModal() == wxID_OK )
2841 {
2842 wxString viewportName = dlg.GetTextSelection();
2843 int idx = m_cbViewports->FindString( viewportName );
2844
2845 if( idx != wxNOT_FOUND )
2846 {
2847 m_viewports.erase( viewportName );
2848 m_cbViewports->Delete( idx );
2849 m_viewportMRU.Remove( viewportName );
2850 }
2851 }
2852
2854 m_cbViewports->SetStringSelection( m_lastSelectedViewport->name );
2855 else
2856 m_cbViewports->SetSelection( m_cbViewports->GetCount() - 3 );
2857
2858 return;
2859 }
2860
2861 passOnFocus();
2862}
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
Definition: view.cpp:511

References _, doApplyViewport(), PCB_BASE_FRAME::GetCanvas(), EDA_LIST_DIALOG::GetTextSelection(), PCB_DRAW_PANEL_GAL::GetView(), KIGFX::VIEW::GetViewport(), APPEARANCE_CONTROLS_BASE::m_cbViewports, m_frame, m_lastSelectedViewport, m_viewportMRU, m_viewports, name, VIEWPORT::name, passOnFocus(), and EDA_LIST_DIALOG::SetListLabel().

Referenced by ApplyViewport().

◆ passOnFocus()

◆ rebuildLayerContextMenu()

void APPEARANCE_CONTROLS::rebuildLayerContextMenu ( )
private

Definition at line 1771 of file appearance_controls.cpp.

1772{
1773 delete m_layerContextMenu;
1774 m_layerContextMenu = new wxMenu;
1775
1776 AddMenuItem( m_layerContextMenu, ID_SHOW_ALL_COPPER_LAYERS, _( "Show All Copper Layers" ),
1778 AddMenuItem( m_layerContextMenu, ID_HIDE_ALL_COPPER_LAYERS, _( "Hide All Copper Layers" ),
1780
1781 m_layerContextMenu->AppendSeparator();
1782
1783 AddMenuItem( m_layerContextMenu, ID_HIDE_ALL_BUT_ACTIVE, _( "Hide All Layers But Active" ),
1785
1786 m_layerContextMenu->AppendSeparator();
1787
1788 AddMenuItem( m_layerContextMenu, ID_SHOW_ALL_NON_COPPER, _( "Show All Non Copper Layers" ),
1790
1791 AddMenuItem( m_layerContextMenu, ID_HIDE_ALL_NON_COPPER, _( "Hide All Non Copper Layers" ),
1793
1794 m_layerContextMenu->AppendSeparator();
1795
1796 AddMenuItem( m_layerContextMenu, ID_PRESET_ALL_LAYERS, _( "Show All Layers" ),
1798
1799 AddMenuItem( m_layerContextMenu, ID_PRESET_NO_LAYERS, _( "Hide All Layers" ),
1801
1802 m_layerContextMenu->AppendSeparator();
1803
1804 AddMenuItem( m_layerContextMenu, ID_PRESET_FRONT_ASSEMBLY, _( "Show Only Front Assembly Layers" ),
1806
1807 AddMenuItem( m_layerContextMenu, ID_PRESET_FRONT, _( "Show Only Front Layers" ),
1809
1810 // Only show the internal layer option if internal layers are enabled
1811 if( m_frame->GetBoard()->GetCopperLayerCount() > 2 )
1812 {
1813 AddMenuItem( m_layerContextMenu, ID_PRESET_INNER_COPPER, _( "Show Only Inner Layers" ),
1815 }
1816
1817 AddMenuItem( m_layerContextMenu, ID_PRESET_BACK, _( "Show Only Back Layers" ),
1819
1820 AddMenuItem( m_layerContextMenu, ID_PRESET_BACK_ASSEMBLY, _( "Show Only Back Assembly Layers" ),
1822}
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Create and insert a menu item with an icon into aMenu.
Definition: bitmap.cpp:265
@ show_all_back_layers
@ show_front_assembly_layers
@ select_w_layer
@ show_back_assembly_layers
@ show_all_front_layers
@ show_no_layers
@ show_no_copper_layers
@ show_all_layers
@ show_all_copper_layers
int GetCopperLayerCount() const
Definition: board.cpp:541

References _, AddMenuItem(), PCB_BASE_FRAME::GetBoard(), BOARD::GetCopperLayerCount(), ID_HIDE_ALL_BUT_ACTIVE, ID_HIDE_ALL_COPPER_LAYERS, ID_HIDE_ALL_NON_COPPER, ID_PRESET_ALL_LAYERS, ID_PRESET_BACK, ID_PRESET_BACK_ASSEMBLY, ID_PRESET_FRONT, ID_PRESET_FRONT_ASSEMBLY, ID_PRESET_INNER_COPPER, ID_PRESET_NO_LAYERS, ID_SHOW_ALL_COPPER_LAYERS, ID_SHOW_ALL_NON_COPPER, KiBitmap(), m_frame, m_layerContextMenu, select_w_layer, show_all_back_layers, show_all_copper_layers, show_all_front_layers, show_all_layers, show_back_assembly_layers, show_front_assembly_layers, show_no_copper_layers, and show_no_layers.

Referenced by OnBoardChanged(), and OnLanguageChanged().

◆ rebuildLayerPresetsWidget()

void APPEARANCE_CONTROLS::rebuildLayerPresetsWidget ( )
private

Definition at line 2474 of file appearance_controls.cpp.

2475{
2476 m_viewportsLabel->SetLabel( wxString::Format( _( "Presets (%s+Tab):" ),
2478
2479 m_cbLayerPresets->Clear();
2480
2481 // Build the layers preset list.
2482 // By default, the presetAllLayers will be selected
2483 int idx = 0;
2484 int default_idx = 0;
2485
2486 for( std::pair<const wxString, LAYER_PRESET>& pair : m_layerPresets )
2487 {
2488 m_cbLayerPresets->Append( wxGetTranslation( pair.first ),
2489 static_cast<void*>( &pair.second ) );
2490
2491 if( pair.first == presetAllLayers.name )
2492 default_idx = idx;
2493
2494 idx++;
2495 }
2496
2497 m_cbLayerPresets->Append( wxT( "---" ) );
2498 m_cbLayerPresets->Append( _( "Save preset..." ) );
2499 m_cbLayerPresets->Append( _( "Delete preset..." ) );
2500
2501 // At least the built-in presets should always be present
2502 wxASSERT( !m_layerPresets.empty() );
2503
2504 // Default preset: all layers
2505 m_cbLayerPresets->SetSelection( default_idx );
2507}

References _, Format(), KeyNameFromKeyCode(), APPEARANCE_CONTROLS_BASE::m_cbLayerPresets, m_currentPreset, m_layerPresets, APPEARANCE_CONTROLS_BASE::m_viewportsLabel, LAYER_PRESET::name, PRESET_SWITCH_KEY, and presetAllLayers.

Referenced by OnBoardChanged(), OnLanguageChanged(), and SetUserLayerPresets().

◆ rebuildLayers()

void APPEARANCE_CONTROLS::rebuildLayers ( )
private

Definition at line 1496 of file appearance_controls.cpp.

1497{
1498 BOARD* board = m_frame->GetBoard();
1499 LSET enabled = board->GetEnabledLayers();
1500 LSET visible = getVisibleLayers();
1501
1503 COLOR4D bgColor = theme->GetColor( LAYER_PCB_BACKGROUND );
1504 bool readOnly = theme->IsReadOnly();
1505
1506#ifdef __WXMAC__
1507 wxSizerItem* m_windowLayersSizerItem = m_panelLayersSizer->GetItem( m_windowLayers );
1508 m_windowLayersSizerItem->SetFlag( m_windowLayersSizerItem->GetFlag() & ~wxTOP );
1509#endif
1510
1511 auto appendLayer =
1512 [&]( std::unique_ptr<APPEARANCE_SETTING>& aSetting )
1513 {
1514 int layer = aSetting->id;
1515
1516 wxPanel* panel = new wxPanel( m_windowLayers, layer );
1517 wxBoxSizer* sizer = new wxBoxSizer( wxHORIZONTAL );
1518 panel->SetSizer( sizer );
1519
1520 panel->SetBackgroundColour( m_layerPanelColour );
1521
1522 aSetting->visible = visible[layer];
1523
1524 // TODO(JE) consider restyling this indicator
1525 INDICATOR_ICON* indicator = new INDICATOR_ICON( panel, *m_iconProvider,
1526 ROW_ICON_PROVIDER::STATE::OFF,
1527 layer );
1528
1529 COLOR_SWATCH* swatch = new COLOR_SWATCH( panel, COLOR4D::UNSPECIFIED, layer,
1530 bgColor, theme->GetColor( layer ),
1531 SWATCH_SMALL );
1532 swatch->SetToolTip( _( "Double click or middle click for color change, "
1533 "right click for menu" ) );
1534
1535 BITMAP_TOGGLE* btn_visible = new BITMAP_TOGGLE( panel, layer,
1538 aSetting->visible );
1539 btn_visible->SetToolTip( _( "Show or hide this layer" ) );
1540
1541 wxStaticText* label = new wxStaticText( panel, layer, aSetting->label );
1542 label->Wrap( -1 );
1543 label->SetToolTip( aSetting->tooltip );
1544
1545 sizer->AddSpacer( 1 );
1546 sizer->Add( indicator, 0, wxALIGN_CENTER_VERTICAL | wxTOP, 2 );
1547 sizer->AddSpacer( 5 );
1548 sizer->Add( swatch, 0, wxALIGN_CENTER_VERTICAL | wxTOP, 2 );
1549 sizer->AddSpacer( 6 );
1550 sizer->Add( btn_visible, 0, wxALIGN_CENTER_VERTICAL | wxTOP, 2 );
1551 sizer->AddSpacer( 5 );
1552 sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxTOP, 2 );
1553
1554 m_layersOuterSizer->Add( panel, 0, wxEXPAND, 0 );
1555
1556 aSetting->ctl_panel = panel;
1557 aSetting->ctl_indicator = indicator;
1558 aSetting->ctl_visibility = btn_visible;
1559 aSetting->ctl_color = swatch;
1560 aSetting->ctl_text = label;
1561
1562 panel->Bind( wxEVT_LEFT_DOWN, &APPEARANCE_CONTROLS::onLayerLeftClick, this );
1563 indicator->Bind( wxEVT_LEFT_DOWN, &APPEARANCE_CONTROLS::onLayerLeftClick, this );
1564 swatch->Bind( wxEVT_LEFT_DOWN, &APPEARANCE_CONTROLS::onLayerLeftClick, this );
1565 label->Bind( wxEVT_LEFT_DOWN, &APPEARANCE_CONTROLS::onLayerLeftClick, this );
1566
1567 btn_visible->Bind( TOGGLE_CHANGED,
1568 [&]( wxCommandEvent& aEvent )
1569 {
1570 wxObject* btn = aEvent.GetEventObject();
1571 int layerId = static_cast<wxWindow*>( btn )->GetId();
1572
1573 onLayerVisibilityToggled( static_cast<PCB_LAYER_ID>( layerId ) );
1574 } );
1575
1576 swatch->Bind( COLOR_SWATCH_CHANGED, &APPEARANCE_CONTROLS::OnColorSwatchChanged,
1577 this );
1579 this ) );
1580 swatch->SetReadOnly( readOnly );
1581
1582 panel->Bind( wxEVT_RIGHT_DOWN, &APPEARANCE_CONTROLS::rightClickHandler, this );
1583 indicator->Bind( wxEVT_RIGHT_DOWN, &APPEARANCE_CONTROLS::rightClickHandler, this );
1584 swatch->Bind( wxEVT_RIGHT_DOWN, &APPEARANCE_CONTROLS::rightClickHandler, this );
1585 btn_visible->Bind( wxEVT_RIGHT_DOWN, &APPEARANCE_CONTROLS::rightClickHandler, this );
1586 label->Bind( wxEVT_RIGHT_DOWN, &APPEARANCE_CONTROLS::rightClickHandler, this );
1587 };
1588
1589 auto updateLayer =
1590 [&]( std::unique_ptr<APPEARANCE_SETTING>& aSetting )
1591 {
1592 int layer = aSetting->id;
1593 aSetting->visible = visible[layer];
1594 aSetting->ctl_panel->Show();
1595 aSetting->ctl_panel->SetId( layer );
1596 aSetting->ctl_indicator->SetWindowID( layer );
1597 aSetting->ctl_color->SetWindowID( layer );
1598 aSetting->ctl_color->SetSwatchColor( theme->GetColor( layer ), false );
1599 aSetting->ctl_visibility->SetWindowID( layer );
1600 aSetting->ctl_text->SetLabelText( aSetting->label );
1601 aSetting->ctl_text->SetId( layer );
1602 aSetting->ctl_text->SetToolTip( aSetting->tooltip );
1603 };
1604
1605 // technical layers are shown in this order:
1606 // Because they are static, wxGetTranslation must be explicitly
1607 // called for tooltips.
1608 static const struct {
1609 PCB_LAYER_ID layerId;
1610 wxString tooltip;
1611 } non_cu_seq[] = {
1612 { F_Adhes, _HKI( "Adhesive on board's front" ) },
1613 { B_Adhes, _HKI( "Adhesive on board's back" ) },
1614 { F_Paste, _HKI( "Solder paste on board's front" ) },
1615 { B_Paste, _HKI( "Solder paste on board's back" ) },
1616 { F_SilkS, _HKI( "Silkscreen on board's front" ) },
1617 { B_SilkS, _HKI( "Silkscreen on board's back" ) },
1618 { F_Mask, _HKI( "Solder mask on board's front" ) },
1619 { B_Mask, _HKI( "Solder mask on board's back" ) },
1620 { Dwgs_User, _HKI( "Explanatory drawings" ) },
1621 { Cmts_User, _HKI( "Explanatory comments" ) },
1622 { Eco1_User, _HKI( "User defined meaning" ) },
1623 { Eco2_User, _HKI( "User defined meaning" ) },
1624 { Edge_Cuts, _HKI( "Board's perimeter definition" ) },
1625 { Margin, _HKI( "Board's edge setback outline" ) },
1626 { F_CrtYd, _HKI( "Footprint courtyards on board's front" ) },
1627 { B_CrtYd, _HKI( "Footprint courtyards on board's back" ) },
1628 { F_Fab, _HKI( "Footprint assembly on board's front" ) },
1629 { B_Fab, _HKI( "Footprint assembly on board's back" ) },
1630 { User_1, _HKI( "User defined layer 1" ) },
1631 { User_2, _HKI( "User defined layer 2" ) },
1632 { User_3, _HKI( "User defined layer 3" ) },
1633 { User_4, _HKI( "User defined layer 4" ) },
1634 { User_5, _HKI( "User defined layer 5" ) },
1635 { User_6, _HKI( "User defined layer 6" ) },
1636 { User_7, _HKI( "User defined layer 7" ) },
1637 { User_8, _HKI( "User defined layer 8" ) },
1638 { User_9, _HKI( "User defined layer 9" ) },
1639 };
1640
1641 // There is a spacer added to the end of the list that we need to remove and re-add
1642 // after possibly adding additional layers
1643 if( m_layersOuterSizer->GetItemCount() > 0 )
1644 {
1645 m_layersOuterSizer->Detach( m_layersOuterSizer->GetItemCount() - 1 );
1646 }
1647 // Otherwise, this is the first time we are updating the control, so we need to attach
1648 // the handler
1649 else
1650 {
1651 // Add right click handling to show the context menu when clicking to the free area in
1652 // m_windowLayers (below the layer items)
1653 m_windowLayers->Bind( wxEVT_RIGHT_DOWN, &APPEARANCE_CONTROLS::rightClickHandler, this );
1654 }
1655
1656 std::size_t total_layers = enabled.CuStack().size();
1657
1658 for( const auto& entry : non_cu_seq )
1659 {
1660 if( enabled[entry.layerId] )
1661 total_layers++;
1662 }
1663
1664 // Adds layers to the panel until we have enough to hold our total count
1665 while( total_layers > m_layerSettings.size() )
1666 m_layerSettings.push_back( std::make_unique<APPEARANCE_SETTING>() );
1667
1668 // We never delete layers from the panel, only hide them. This saves us
1669 // having to recreate the (possibly) later with minimal overhead
1670 for( std::size_t ii = total_layers; ii < m_layerSettings.size(); ++ii )
1671 {
1672 if( m_layerSettings[ii]->ctl_panel )
1673 m_layerSettings[ii]->ctl_panel->Show( false );
1674 }
1675
1676 auto layer_it = m_layerSettings.begin();
1677
1678 // show all coppers first, with front on top, back on bottom, then technical layers
1679 for( LSEQ cu_stack = enabled.CuStack(); cu_stack; ++cu_stack, ++layer_it )
1680 {
1681 PCB_LAYER_ID layer = *cu_stack;
1682 wxString dsc;
1683
1684 switch( layer )
1685 {
1686 case F_Cu: dsc = _( "Front copper layer" ); break;
1687 case B_Cu: dsc = _( "Back copper layer" ); break;
1688 default: dsc = _( "Inner copper layer" ); break;
1689 }
1690
1691 std::unique_ptr<APPEARANCE_SETTING>& setting = *layer_it;
1692
1693 setting->label = board->GetLayerName( layer );
1694 setting->id = layer;
1695 setting->tooltip = dsc;
1696
1697 if( setting->ctl_panel == nullptr )
1698 appendLayer( setting );
1699 else
1700 updateLayer( setting );
1701
1702 m_layerSettingsMap[layer] = setting.get();
1703
1705 {
1706 setting->ctl_text->Disable();
1707 setting->ctl_color->SetToolTip( wxEmptyString );
1708 }
1709 }
1710
1711 for( const auto& entry : non_cu_seq )
1712 {
1713 PCB_LAYER_ID layer = entry.layerId;
1714
1715 if( !enabled[layer] )
1716 continue;
1717
1718 std::unique_ptr<APPEARANCE_SETTING>& setting = *layer_it;
1719
1720 setting->label = board->GetLayerName( layer );
1721 setting->id = layer;
1722 // Because non_cu_seq is created static, we must explicitly call wxGetTranslation for
1723 // texts which are internationalized
1724 setting->tooltip = wxGetTranslation( entry.tooltip );
1725
1726 if( setting->ctl_panel == nullptr )
1727 appendLayer( setting );
1728 else
1729 updateLayer( setting );
1730
1731 m_layerSettingsMap[layer] = setting.get();
1732
1734 {
1735 setting->ctl_text->Disable();
1736 setting->ctl_color->SetToolTip( wxEmptyString );
1737 }
1738
1739 ++layer_it;
1740 }
1741
1742 m_layersOuterSizer->AddSpacer( 10 );
1743 m_windowLayers->SetBackgroundColour( m_layerPanelColour );
1744 m_windowLayers->Layout();
1745
1746 m_paneLayerDisplayOptions->SetLabel( _( "Layer Display Options" ) );
1747
1749 wxString msg;
1750
1751 if( hotkey )
1752 msg = wxString::Format( _( "Inactive layers (%s):" ), KeyNameFromKeyCode( hotkey ) );
1753 else
1754 msg = _( "Inactive layers:" );
1755
1756 m_inactiveLayersLabel->SetLabel( msg );
1757
1758 m_rbHighContrastNormal->SetLabel( _( "Normal" ) );
1759 m_rbHighContrastNormal->SetToolTip( _( "Inactive layers will be shown in full color" ) );
1760
1761 m_rbHighContrastDim->SetLabel( _( "Dim" ) );
1762 m_rbHighContrastDim->SetToolTip( _( "Inactive layers will be dimmed" ) );
1763
1764 m_rbHighContrastOff->SetLabel( _( "Hide" ) );
1765 m_rbHighContrastOff->SetToolTip( _( "Inactive layers will be hidden" ) );
1766
1767 m_cbFlipBoard->SetLabel( _( "Flip board view" ) );
1768}
void onLayerVisibilityToggled(PCB_LAYER_ID aLayer)
void OnColorSwatchChanged(wxCommandEvent &aEvent)
void rightClickHandler(wxMouseEvent &aEvent)
void onLayerLeftClick(wxMouseEvent &aEvent)
A checkbox control except with custom bitmaps for the checked and unchecked states.
Definition: bitmap_toggle.h:44
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:565
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:452
COLOR4D GetColor(int aLayer) const
void SetReadOnlyCallback(std::function< void()> aCallback)
Registers a handler for when the user tries to interact with a read-only swatch.
Definition: color_swatch.h:125
void SetReadOnly(bool aReadOnly=true)
Definition: color_swatch.h:119
representing a row indicator icon for use in places like the layer widget
bool IsReadOnly() const
Definition: json_settings.h:84
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition: layer_ids.h:491
LSEQ CuStack() const
Return a sequence of copper layers in starting from the front/top and extending to the back/bottom.
Definition: lset.cpp:170
void SetLabel(const wxString &aLabel) override
#define _HKI(x)
@ User_8
Definition: layer_ids.h:130
@ F_CrtYd
Definition: layer_ids.h:117
@ B_Adhes
Definition: layer_ids.h:97
@ Edge_Cuts
Definition: layer_ids.h:113
@ Dwgs_User
Definition: layer_ids.h:109
@ F_Paste
Definition: layer_ids.h:101
@ Cmts_User
Definition: layer_ids.h:110
@ User_6
Definition: layer_ids.h:128
@ User_7
Definition: layer_ids.h:129
@ F_Adhes
Definition: layer_ids.h:98
@ B_Mask
Definition: layer_ids.h:106
@ User_5
Definition: layer_ids.h:127
@ Eco1_User
Definition: layer_ids.h:111
@ F_Mask
Definition: layer_ids.h:107
@ B_Paste
Definition: layer_ids.h:100
@ User_9
Definition: layer_ids.h:131
@ F_Fab
Definition: layer_ids.h:120
@ Margin
Definition: layer_ids.h:114
@ F_SilkS
Definition: layer_ids.h:104
@ B_CrtYd
Definition: layer_ids.h:116
@ Eco2_User
Definition: layer_ids.h:112
@ User_3
Definition: layer_ids.h:125
@ User_1
Definition: layer_ids.h:123
@ B_SilkS
Definition: layer_ids.h:103
@ User_4
Definition: layer_ids.h:126
@ User_2
Definition: layer_ids.h:124
@ B_Fab
Definition: layer_ids.h:119

References _, _HKI, B_Adhes, B_CrtYd, B_Cu, B_Fab, B_Mask, B_Paste, B_SilkS, Cmts_User, LSET::CuStack(), Dwgs_User, Eco1_User, Eco2_User, Edge_Cuts, F_Adhes, F_CrtYd, F_Cu, F_Fab, F_Mask, F_Paste, F_SilkS, LSET::ForbiddenFootprintLayers(), Format(), PCB_BASE_FRAME::GetBoard(), COLOR_SETTINGS::GetColor(), PCB_BASE_FRAME::GetColorSettings(), BOARD::GetEnabledLayers(), TOOL_ACTION::GetHotKey(), BOARD::GetLayerName(), getVisibleLayers(), ACTIONS::highContrastModeCycle, JSON_SETTINGS::IsReadOnly(), KeyNameFromKeyCode(), KiBitmap(), LAYER_PCB_BACKGROUND, m_cbFlipBoard, m_frame, m_iconProvider, m_inactiveLayersLabel, m_isFpEditor, m_layerPanelColour, m_layerSettings, m_layerSettingsMap, m_layersOuterSizer, m_paneLayerDisplayOptions, APPEARANCE_CONTROLS_BASE::m_panelLayersSizer, m_rbHighContrastDim, m_rbHighContrastNormal, m_rbHighContrastOff, APPEARANCE_CONTROLS_BASE::m_windowLayers, Margin, OnColorSwatchChanged(), onLayerLeftClick(), onLayerVisibilityToggled(), onReadOnlySwatch(), rightClickHandler(), WX_COLLAPSIBLE_PANE::SetLabel(), COLOR_SWATCH::SetReadOnly(), COLOR_SWATCH::SetReadOnlyCallback(), SWATCH_SMALL, User_1, User_2, User_3, User_4, User_5, User_6, User_7, User_8, User_9, visibility, and visibility_off.

Referenced by OnBoardChanged(), and OnLanguageChanged().

◆ rebuildNets()

void APPEARANCE_CONTROLS::rebuildNets ( )
private

Definition at line 2311 of file appearance_controls.cpp.

2312{
2313 BOARD* board = m_frame->GetBoard();
2315 COLOR4D bgColor = theme->GetColor( LAYER_PCB_BACKGROUND );
2316
2317 // If the board isn't fully loaded, we can't yet rebuild
2318 if( !board->GetProject() )
2319 return;
2320
2321 m_staticTextNets->SetLabel( _( "Nets" ) );
2322 m_staticTextNetClasses->SetLabel( _( "Net Classes" ) );
2323
2326
2327 std::map<wxString, KIGFX::COLOR4D>& netclassColors = rs->GetNetclassColorMap();
2328 const std::set<wxString>& hiddenClasses = m_frame->Prj().GetLocalSettings().m_HiddenNetclasses;
2329
2330 m_netclassOuterSizer->Clear( true );
2331
2332 auto appendNetclass =
2333 [&]( int aId, const std::shared_ptr<NETCLASS>& aClass, bool isDefaultClass = false )
2334 {
2335 wxString name = aClass->GetName();
2336
2337 m_netclassSettings.emplace_back( std::make_unique<APPEARANCE_SETTING>() );
2338 APPEARANCE_SETTING* setting = m_netclassSettings.back().get();
2339 m_netclassSettingsMap[name] = setting;
2340
2341 setting->ctl_panel = new wxPanel( m_netclassScrolledWindow, aId );
2342 wxBoxSizer* sizer = new wxBoxSizer( wxHORIZONTAL );
2343 setting->ctl_panel->SetSizer( sizer );
2344 COLOR4D color = netclassColors.count( name ) ? netclassColors.at( name ) :
2345 COLOR4D::UNSPECIFIED;
2346
2347 setting->ctl_color = new COLOR_SWATCH( setting->ctl_panel, color, aId, bgColor,
2348 COLOR4D::UNSPECIFIED, SWATCH_SMALL );
2349 setting->ctl_color->SetToolTip( _( "Left double click or middle click for color "
2350 "change, right click for menu" ) );
2351
2352 setting->ctl_color->Bind( COLOR_SWATCH_CHANGED,
2354
2355 // Default netclass can't have an override color
2356 if( isDefaultClass )
2357 setting->ctl_color->Hide();
2358
2359 setting->ctl_visibility = new BITMAP_TOGGLE( setting->ctl_panel, aId,
2362 !hiddenClasses.count( name ) );
2363
2364 wxString tip;
2365 tip.Printf( _( "Show or hide ratsnest for nets in %s" ), name );
2366 setting->ctl_visibility->SetToolTip( tip );
2367
2368 setting->ctl_text = new wxStaticText( setting->ctl_panel, aId, name );
2369 setting->ctl_text->Wrap( -1 );
2370
2371 int flags = wxALIGN_CENTER_VERTICAL;
2372
2373 sizer->Add( setting->ctl_color, 0, flags | wxRESERVE_SPACE_EVEN_IF_HIDDEN, 5 );
2374 sizer->AddSpacer( 7 );
2375 sizer->Add( setting->ctl_visibility, 0, flags, 5 );
2376 sizer->AddSpacer( 3 );
2377 sizer->Add( setting->ctl_text, 1, flags, 5 );
2378
2379 m_netclassOuterSizer->Add( setting->ctl_panel, 0, wxEXPAND, 5 );
2380 m_netclassOuterSizer->AddSpacer( 2 );
2381
2382 setting->ctl_visibility->Bind( TOGGLE_CHANGED,
2384 this );
2385
2386 auto menuHandler =
2387 [&, name, isDefaultClass]( wxMouseEvent& aEvent )
2388 {
2389 wxMenu menu;
2390 buildNetClassMenu( menu, isDefaultClass, name );
2391
2393 PopupMenu( &menu );
2394 };
2395
2396 setting->ctl_panel->Bind( wxEVT_RIGHT_DOWN, menuHandler );
2397 setting->ctl_visibility->Bind( wxEVT_RIGHT_DOWN, menuHandler );
2398 setting->ctl_color->Bind( wxEVT_RIGHT_DOWN, menuHandler );
2399 setting->ctl_text->Bind( wxEVT_RIGHT_DOWN, menuHandler );
2400 };
2401
2402 std::shared_ptr<NET_SETTINGS>& netSettings = board->GetDesignSettings().m_NetSettings;
2403
2404 std::vector<wxString> names;
2405
2406 for( const auto& [ name, netclass ] : netSettings->m_NetClasses )
2407 names.emplace_back( name );
2408
2409 std::sort( names.begin(), names.end() );
2410
2411 m_netclassIdMap.clear();
2412
2413 int idx = wxID_HIGHEST;
2414
2415 m_netclassIdMap[idx] = netSettings->m_DefaultNetClass->GetName();
2416 appendNetclass( idx++, netSettings->m_DefaultNetClass, true );
2417
2418 for( const wxString& name : names )
2419 {
2420 m_netclassIdMap[idx] = name;
2421 appendNetclass( idx++, netSettings->m_NetClasses.at( name ) );
2422 }
2423
2424 int hotkey;
2425 wxString msg;
2426
2427 m_paneNetDisplayOptions->SetLabel( _( "Net Display Options" ) );
2428
2430
2431 if( hotkey )
2432 msg = wxString::Format( _( "Net colors (%s):" ), KeyNameFromKeyCode( hotkey ) );
2433 else
2434 msg = _( "Net colors:" );
2435
2436 m_txtNetDisplayTitle->SetLabel( msg );
2437 m_txtNetDisplayTitle->SetToolTip( _( "Choose when to show net and netclass colors" ) );
2438
2439 m_rbNetColorAll->SetLabel( _( "All" ) );
2440 m_rbNetColorAll->SetToolTip( _( "Net and netclass colors are shown on all copper items" ) );
2441
2442 m_rbNetColorRatsnest->SetLabel( _( "Ratsnest" ) );
2443 m_rbNetColorRatsnest->SetToolTip( _( "Net and netclass colors are shown on the ratsnest only" ) );
2444
2445 m_rbNetColorOff->SetLabel( _( "None" ) );
2446 m_rbNetColorOff->SetToolTip( _( "Net and netclass colors are not shown" ) );
2447
2449
2450 if( hotkey )
2451 msg = wxString::Format( _( "Ratsnest display (%s):" ), KeyNameFromKeyCode( hotkey ) );
2452 else
2453 msg = _( "Ratsnest display:" );
2454
2455 m_txtRatsnestVisibility->SetLabel( msg );
2456 m_txtRatsnestVisibility->SetToolTip( _( "Choose which ratsnest lines to display" ) );
2457
2458 m_rbRatsnestAllLayers->SetLabel( _( "All" ) );
2459 m_rbRatsnestAllLayers->SetToolTip( _( "Show ratsnest lines to items on all layers" ) );
2460
2461 m_rbRatsnestVisLayers->SetLabel( _( "Visible layers" ) );
2462 m_rbRatsnestVisLayers->SetToolTip( _( "Show ratsnest lines to items on visible layers" ) );
2463
2464 m_rbRatsnestNone->SetLabel( _( "None" ) );
2465 m_rbRatsnestNone->SetToolTip( _( "Hide all ratsnest lines" ) );
2466
2467 m_netclassOuterSizer->Layout();
2468
2470 m_panelNets->GetSizer()->Layout();
2471}
void buildNetClassMenu(wxMenu &aMenu, bool isDefaultClass, const wxString &aName)
void onNetclassVisibilityChanged(wxCommandEvent &aEvent)
std::vector< std::unique_ptr< APPEARANCE_SETTING > > m_netclassSettings
void onNetclassColorChanged(wxCommandEvent &aEvent)
PROJECT * GetProject() const
Definition: board.h:440
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
std::set< wxString > m_HiddenNetclasses
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
Definition: project.h:155

References _, buildNetClassMenu(), color, APPEARANCE_CONTROLS::APPEARANCE_SETTING::ctl_color, APPEARANCE_CONTROLS::APPEARANCE_SETTING::ctl_panel, APPEARANCE_CONTROLS::APPEARANCE_SETTING::ctl_text, APPEARANCE_CONTROLS::APPEARANCE_SETTING::ctl_visibility, Format(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetCanvas(), COLOR_SETTINGS::GetColor(), PCB_BASE_FRAME::GetColorSettings(), BOARD::GetDesignSettings(), TOOL_ACTION::GetHotKey(), PROJECT::GetLocalSettings(), KIGFX::PCB_RENDER_SETTINGS::GetNetclassColorMap(), KIGFX::VIEW::GetPainter(), BOARD::GetProject(), KIGFX::PAINTER::GetSettings(), PCB_DRAW_PANEL_GAL::GetView(), KeyNameFromKeyCode(), KiBitmap(), LAYER_PCB_BACKGROUND, m_contextMenuNetclass, m_frame, PROJECT_LOCAL_SETTINGS::m_HiddenNetclasses, m_netclassIdMap, APPEARANCE_CONTROLS_BASE::m_netclassOuterSizer, APPEARANCE_CONTROLS_BASE::m_netclassScrolledWindow, m_netclassSettings, m_netclassSettingsMap, BOARD_DESIGN_SETTINGS::m_NetSettings, m_netsTable, APPEARANCE_CONTROLS_BASE::m_panelNets, m_paneNetDisplayOptions, m_rbNetColorAll, m_rbNetColorOff, m_rbNetColorRatsnest, m_rbRatsnestAllLayers, m_rbRatsnestNone, m_rbRatsnestVisLayers, APPEARANCE_CONTROLS_BASE::m_staticTextNetClasses, APPEARANCE_CONTROLS_BASE::m_staticTextNets, m_txtNetDisplayTitle, m_txtRatsnestVisibility, name, PCB_ACTIONS::netColorModeCycle, onNetclassColorChanged(), onNetclassVisibilityChanged(), KIWAY_HOLDER::Prj(), PCB_ACTIONS::ratsnestModeCycle, NET_GRID_TABLE::Rebuild(), WX_COLLAPSIBLE_PANE::SetLabel(), SWATCH_SMALL, visibility, and visibility_off.

Referenced by handleBoardItemsChanged(), OnBoardChanged(), and OnLanguageChanged().

◆ rebuildObjects()

void APPEARANCE_CONTROLS::rebuildObjects ( )
private

Definition at line 2081 of file appearance_controls.cpp.

2082{
2084 COLOR4D bgColor = theme->GetColor( LAYER_PCB_BACKGROUND );
2085 GAL_SET visible = getVisibleObjects();
2086 int swatchWidth = m_windowObjects->ConvertDialogToPixels( wxSize( 8, 0 ) ).x;
2087 int labelWidth = 0;
2088
2089 m_objectSettings.clear();
2090 m_objectsOuterSizer->Clear( true );
2091 m_objectsOuterSizer->AddSpacer( 5 );
2092
2093 auto appendObject =
2094 [&]( const std::unique_ptr<APPEARANCE_SETTING>& aSetting )
2095 {
2096 wxBoxSizer* sizer = new wxBoxSizer( wxHORIZONTAL );
2097 int layer = aSetting->id;
2098
2099 aSetting->visible = visible.Contains( ToGalLayer( layer ) );
2100 COLOR4D color = theme->GetColor( layer );
2101 COLOR4D defColor = theme->GetDefaultColor( layer );
2102
2103 if( color != COLOR4D::UNSPECIFIED )
2104 {
2105 COLOR_SWATCH* swatch = new COLOR_SWATCH( m_windowObjects, color, layer,
2106 bgColor, defColor, SWATCH_SMALL );
2107 swatch->SetToolTip( _( "Left double click or middle click for color change, "
2108 "right click for menu" ) );
2109
2110 sizer->Add( swatch, 0, wxALIGN_CENTER_VERTICAL, 0 );
2111 aSetting->ctl_color = swatch;
2112
2113 swatch->Bind( COLOR_SWATCH_CHANGED, &APPEARANCE_CONTROLS::OnColorSwatchChanged,
2114 this );
2115
2117 this ) );
2118 }
2119 else
2120 {
2121 sizer->AddSpacer( swatchWidth );
2122 }
2123
2124 BITMAP_TOGGLE* btn_visible = new BITMAP_TOGGLE( m_windowObjects, layer,
2127 aSetting->visible );
2128
2129 wxString tip;
2130 tip.Printf( _( "Show or hide %s" ), aSetting->label.Lower() );
2131 btn_visible->SetToolTip( tip );
2132
2133 aSetting->ctl_visibility = btn_visible;
2134
2135 sizer->AddSpacer( 5 );
2136
2137 btn_visible->Bind( TOGGLE_CHANGED,
2138 [&]( wxCommandEvent& aEvent )
2139 {
2140 int id = static_cast<wxWindow*>( aEvent.GetEventObject() )->GetId();
2141 bool isVisible = aEvent.GetInt();
2142 onObjectVisibilityChanged( ToGalLayer( id ), isVisible, true );
2143 } );
2144
2145 wxStaticText* label = new wxStaticText( m_windowObjects, layer, aSetting->label );
2146 label->Wrap( -1 );
2147 label->SetToolTip( aSetting->tooltip );
2148
2149 if( aSetting->can_control_opacity )
2150 {
2151 label->SetMinSize( wxSize( labelWidth, -1 ) );
2152#ifdef __WXMAC__
2153 sizer->Add( btn_visible, 0, wxALIGN_CENTER_VERTICAL | wxBOTTOM, 10 );
2154 sizer->AddSpacer( 5 );
2155 sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL | wxBOTTOM, 10 );
2156#else
2157 sizer->Add( btn_visible, 0, wxALIGN_CENTER_VERTICAL, 0 );
2158 sizer->AddSpacer( 5 );
2159 sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL, 0 );
2160#endif
2161
2162 wxSlider* slider = new wxSlider( m_windowObjects, wxID_ANY, 100, 0, 100,
2163 wxDefaultPosition, wxDefaultSize,
2164 wxSL_HORIZONTAL );
2165#ifdef __WXMAC__
2166 slider->SetMinSize( wxSize( 80, 16 ) );
2167#else
2168 slider->SetMinSize( wxSize( 80, -1 ) );
2169#endif
2170
2171 tip.Printf( _( "Set opacity of %s" ), aSetting->label.Lower() );
2172 slider->SetToolTip( tip );
2173
2174 sizer->Add( slider, 1, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5 );
2175 aSetting->ctl_opacity = slider;
2176
2177 auto opacitySliderHandler =
2178 [=]( wxCommandEvent& aEvent )
2179 {
2180 wxSlider* ctrl = static_cast<wxSlider*>( aEvent.GetEventObject() );
2181 int value = ctrl->GetValue();
2182 onObjectOpacitySlider( layer, value / 100.0f );
2183 };
2184
2185 slider->Bind( wxEVT_SCROLL_CHANGED, opacitySliderHandler );
2186 slider->Bind( wxEVT_SCROLL_THUMBTRACK, opacitySliderHandler );
2187 slider->Bind( wxEVT_SET_FOCUS, &APPEARANCE_CONTROLS::OnSetFocus, this );
2188 }
2189 else
2190 {
2191 sizer->Add( btn_visible, 0, wxALIGN_CENTER_VERTICAL, 0 );
2192 sizer->AddSpacer( 5 );
2193 sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL, 0 );
2194 }
2195
2196 aSetting->ctl_text = label;
2197 m_objectsOuterSizer->Add( sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, 5 );
2198
2199 if( !aSetting->can_control_opacity )
2200 m_objectsOuterSizer->AddSpacer( 2 );
2201 };
2202
2203 for( const APPEARANCE_SETTING& s_setting : s_objectSettings )
2204 {
2205 if( m_isFpEditor && !s_allowedInFpEditor.count( s_setting.id ) )
2206 continue;
2207
2208 if( !s_setting.spacer )
2209 {
2210 m_objectSettings.emplace_back( std::make_unique<APPEARANCE_SETTING>( s_setting ) );
2211
2212 std::unique_ptr<APPEARANCE_SETTING>& setting = m_objectSettings.back();
2213
2214 // Because s_render_rows is created static, we must explicitly call wxGetTranslation
2215 // for texts which are internationalized (tool tips and item names)
2216 setting->tooltip = wxGetTranslation( s_setting.tooltip );
2217 setting->label = wxGetTranslation( s_setting.label );
2218
2219 if( setting->can_control_opacity )
2220 {
2221 int width = m_windowObjects->GetTextExtent( setting->label ).x + 5;
2222 labelWidth = std::max( labelWidth, width );
2223 }
2224
2225 m_objectSettingsMap[ToGalLayer( setting->id )] = setting.get();
2226 }
2227 }
2228
2229 for( const std::unique_ptr<APPEARANCE_SETTING>& setting : m_objectSettings )
2230 {
2231 if( setting->spacer )
2232 m_objectsOuterSizer->AddSpacer( m_pointSize );
2233 else
2234 appendObject( setting );
2235 }
2236
2237 m_objectsOuterSizer->Layout();
2238}
static std::set< int > s_allowedInFpEditor
These GAL layers are shown in the Objects tab in the footprint editor.
std::vector< std::unique_ptr< APPEARANCE_SETTING > > m_objectSettings
void onObjectOpacitySlider(int aLayer, float aOpacity)
static const APPEARANCE_SETTING s_objectSettings[]
Template for object appearance settings.
COLOR4D GetDefaultColor(int aLayer)
GAL_LAYER_ID ToGalLayer(int aInteger)
Definition: layer_ids.h:278

References _, color, GAL_SET::Contains(), COLOR_SETTINGS::GetColor(), PCB_BASE_FRAME::GetColorSettings(), COLOR_SETTINGS::GetDefaultColor(), getVisibleObjects(), KiBitmap(), LAYER_PCB_BACKGROUND, m_frame, m_isFpEditor, m_objectSettings, m_objectSettingsMap, m_objectsOuterSizer, m_pointSize, APPEARANCE_CONTROLS_BASE::m_windowObjects, OnColorSwatchChanged(), onObjectOpacitySlider(), onObjectVisibilityChanged(), onReadOnlySwatch(), OnSetFocus(), s_allowedInFpEditor, s_objectSettings, COLOR_SWATCH::SetReadOnlyCallback(), SWATCH_SMALL, ToGalLayer(), visibility, and visibility_off.

Referenced by APPEARANCE_CONTROLS(), and OnLanguageChanged().

◆ rebuildViewportsWidget()

void APPEARANCE_CONTROLS::rebuildViewportsWidget ( )
private

Definition at line 2729 of file appearance_controls.cpp.

2730{
2731 m_viewportsLabel->SetLabel( wxString::Format( _( "Viewports (%s+Tab):" ),
2733
2734 m_cbViewports->Clear();
2735
2736 for( std::pair<const wxString, VIEWPORT>& pair : m_viewports )
2737 m_cbViewports->Append( pair.first, static_cast<void*>( &pair.second ) );
2738
2739 m_cbViewports->Append( wxT( "---" ) );
2740 m_cbViewports->Append( _( "Save viewport..." ) );
2741 m_cbViewports->Append( _( "Delete viewport..." ) );
2742
2743 m_cbViewports->SetSelection( m_cbViewports->GetCount() - 3 );
2744 m_lastSelectedViewport = nullptr;
2745}

References _, Format(), KeyNameFromKeyCode(), APPEARANCE_CONTROLS_BASE::m_cbViewports, m_lastSelectedViewport, m_viewports, APPEARANCE_CONTROLS_BASE::m_viewportsLabel, and VIEWPORT_SWITCH_KEY.

Referenced by OnBoardChanged(), OnLanguageChanged(), and SetUserViewports().

◆ RefreshCollapsiblePanes()

void APPEARANCE_CONTROLS::RefreshCollapsiblePanes ( )

Function to force a redraw of the collapsible panes in this control.

Definition at line 3260 of file appearance_controls.cpp.

3261{
3262 m_paneLayerDisplayOptions->Refresh();
3263}

References m_paneLayerDisplayOptions.

Referenced by PCB_BASE_EDIT_FRAME::handleActivateEvent().

◆ rightClickHandler()

void APPEARANCE_CONTROLS::rightClickHandler ( wxMouseEvent &  aEvent)
private

Definition at line 1984 of file appearance_controls.cpp.

1985{
1986 wxASSERT( m_layerContextMenu );
1987 PopupMenu( m_layerContextMenu );
1988 passOnFocus();
1989};

References m_layerContextMenu, and passOnFocus().

Referenced by rebuildLayers().

◆ SetBorders()

◆ SetLayerVisible()

void APPEARANCE_CONTROLS::SetLayerVisible ( int  aLayer,
bool  isVisible 
)

◆ SetObjectVisible()

void APPEARANCE_CONTROLS::SetObjectVisible ( GAL_LAYER_ID  aLayer,
bool  isVisible = true 
)

◆ SetTabIndex()

void APPEARANCE_CONTROLS::SetTabIndex ( int  aTab)

Definition at line 1913 of file appearance_controls.cpp.

1914{
1915 size_t max = m_notebook->GetPageCount();
1916
1917 if( aTab >= 0 && static_cast<size_t>( aTab ) < max )
1918 m_notebook->SetSelection( aTab );
1919}

References APPEARANCE_CONTROLS_BASE::m_notebook.

◆ SetUserLayerPresets()

void APPEARANCE_CONTROLS::SetUserLayerPresets ( std::vector< LAYER_PRESET > &  aPresetList)

Definition at line 1390 of file appearance_controls.cpp.

1391{
1392 // Reset to defaults
1394
1395 for( const LAYER_PRESET& preset : aPresetList )
1396 {
1397 if( m_layerPresets.count( preset.name ) )
1398 continue;
1399
1400 m_layerPresets[preset.name] = preset;
1401
1402 m_presetMRU.Add( preset.name );
1403 }
1404
1406}

References loadDefaultLayerPresets(), m_layerPresets, m_presetMRU, and rebuildLayerPresetsWidget().

Referenced by PCB_EDIT_FRAME::LoadProjectSettings().

◆ SetUserViewports()

void APPEARANCE_CONTROLS::SetUserViewports ( std::vector< VIEWPORT > &  aPresetList)

Definition at line 1462 of file appearance_controls.cpp.

1463{
1464 m_viewports.clear();
1465
1466 for( const VIEWPORT& viewport : aViewportList )
1467 {
1468 if( m_viewports.count( viewport.name ) )
1469 continue;
1470
1471 m_viewports[viewport.name] = viewport;
1472
1473 m_viewportMRU.Add( viewport.name );
1474 }
1475
1477}

References m_viewportMRU, m_viewports, and rebuildViewportsWidget().

Referenced by PCB_EDIT_FRAME::LoadProjectSettings().

◆ setVisibleLayers()

void APPEARANCE_CONTROLS::setVisibleLayers ( LSET  aLayers)
private

Definition at line 1252 of file appearance_controls.cpp.

1253{
1254 KIGFX::VIEW* view = m_frame->GetCanvas()->GetView();
1255
1256 if( m_isFpEditor )
1257 {
1258 for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
1259 view->SetLayerVisible( layer, aLayers.Contains( layer ) );
1260 }
1261 else
1262 {
1263 m_frame->GetBoard()->SetVisibleLayers( aLayers );
1264
1265 // Note: KIGFX::REPAINT isn't enough for things that go from invisible to visible as
1266 // they won't be found in the view layer's itemset for repainting.
1268 []( KIGFX::VIEW_ITEM* aItem ) -> bool
1269 {
1270 // Items rendered to composite layers (such as LAYER_PAD_TH) must be redrawn
1271 // whether they're optionally flashed or not (as the layer being hidden/shown
1272 // might be the last layer the item is visible on).
1273 return dynamic_cast<PCB_VIA*>( aItem ) || dynamic_cast<PAD*>( aItem );
1274 } );
1275 }
1276}
void SetVisibleLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
Definition: board.cpp:597
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:77
void UpdateAllItemsConditionally(int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
Update items in the view according to the given flags and condition.
Definition: view.cpp:1494
Definition: pad.h:59
@ ALL
All except INITIAL_ADD.
Definition: view_item.h:53

References KIGFX::ALL, LSET::AllLayersMask(), LSET::Contains(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetCanvas(), PCB_DRAW_PANEL_GAL::GetView(), m_frame, m_isFpEditor, KIGFX::VIEW::SetLayerVisible(), BOARD::SetVisibleLayers(), and KIGFX::VIEW::UpdateAllItemsConditionally().

Referenced by doApplyLayerPreset(), OnLayerContextMenu(), onLayerVisibilityToggled(), and SetLayerVisible().

◆ setVisibleObjects()

void APPEARANCE_CONTROLS::setVisibleObjects ( GAL_SET  aObjects)
private

Definition at line 1279 of file appearance_controls.cpp.

1280{
1281 if( m_isFpEditor )
1282 {
1283 KIGFX::VIEW* view = m_frame->GetCanvas()->GetView();
1284
1285 for( size_t i = 0; i < GAL_LAYER_INDEX( LAYER_ZONE_START ); i++ )
1286 view->SetLayerVisible( GAL_LAYER_ID_START + GAL_LAYER_ID( i ), aLayers.test( i ) );
1287 }
1288 else
1289 {
1290 // Ratsnest visibility is controlled by the ratsnest option, and not by the preset
1293
1294 m_frame->GetBoard()->SetVisibleElements( aLayers );
1295 }
1296}
void SetVisibleElements(const GAL_SET &aMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:604
@ LAYER_ZONE_START
Virtual layers for stacking zones and tracks on a given copper layer.
Definition: layer_ids.h:253
#define GAL_LAYER_INDEX(x)
Use this macro to convert a GAL layer to a 0-indexed offset from LAYER_VIAS.
Definition: layer_ids.h:264

References FRAME_PCB_EDITOR, GAL_LAYER_ID_START, GAL_LAYER_INDEX, PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetCanvas(), PCB_BASE_FRAME::GetPcbNewSettings(), PCB_DRAW_PANEL_GAL::GetView(), EDA_BASE_FRAME::IsType(), LAYER_RATSNEST, LAYER_ZONE_START, PCBNEW_SETTINGS::m_Display, m_frame, m_isFpEditor, PCBNEW_SETTINGS::DISPLAY_OPTIONS::m_ShowGlobalRatsnest, GAL_SET::set(), KIGFX::VIEW::SetLayerVisible(), and BOARD::SetVisibleElements().

Referenced by doApplyLayerPreset(), and onObjectVisibilityChanged().

◆ showNetclass()

void APPEARANCE_CONTROLS::showNetclass ( const wxString &  aClassName,
bool  aShow = true 
)
private

Definition at line 2988 of file appearance_controls.cpp.

2989{
2990 for( NETINFO_ITEM* net : m_frame->GetBoard()->GetNetInfo() )
2991 {
2992 if( net->GetNetClass()->GetName() == aClassName )
2993 {
2996 true,
2997 static_cast<intptr_t>( net->GetNetCode() ) );
2998
2999 int row = m_netsTable->GetRowByNetcode( net->GetNetCode() );
3000
3001 if( row >= 0 )
3003 }
3004 }
3005
3006 PROJECT_LOCAL_SETTINGS& localSettings = m_frame->Prj().GetLocalSettings();
3007
3008 if( !aShow )
3009 localSettings.m_HiddenNetclasses.insert( aClassName );
3010 else
3011 localSettings.m_HiddenNetclasses.erase( aClassName );
3012
3013 m_netsGrid->ForceRefresh();
3014}
static TOOL_ACTION hideNetInRatsnest
Definition: pcb_actions.h:504
static TOOL_ACTION showNetInRatsnest
Definition: pcb_actions.h:505
The project local settings are things that are attached to a particular project, but also might be pa...

References NET_GRID_TABLE::COL_VISIBILITY, PCB_BASE_FRAME::GetBoard(), PROJECT::GetLocalSettings(), BOARD::GetNetInfo(), NET_GRID_TABLE::GetRowByNetcode(), TOOLS_HOLDER::GetToolManager(), PCB_ACTIONS::hideNetInRatsnest, m_frame, PROJECT_LOCAL_SETTINGS::m_HiddenNetclasses, APPEARANCE_CONTROLS_BASE::m_netsGrid, m_netsTable, KIWAY_HOLDER::Prj(), TOOL_MANAGER::RunAction(), NET_GRID_TABLE::SetValueAsBool(), and PCB_ACTIONS::showNetInRatsnest.

Referenced by onNetclassContextMenu(), and onNetclassVisibilityChanged().

◆ syncColorsAndVisibility()

void APPEARANCE_CONTROLS::syncColorsAndVisibility ( )
private

Definition at line 1922 of file appearance_controls.cpp.

1923{
1925 bool readOnly = theme->IsReadOnly();
1926 LSET visible = getVisibleLayers();
1927 GAL_SET objects = getVisibleObjects();
1928
1929 Freeze();
1930
1931 for( std::unique_ptr<APPEARANCE_SETTING>& setting : m_layerSettings )
1932 {
1933 int layer = setting->id;
1934
1935 if( setting->ctl_visibility )
1936 setting->ctl_visibility->SetValue( visible[layer] );
1937
1938 if( setting->ctl_color )
1939 {
1940 const COLOR4D& color = theme->GetColor( layer );
1941 setting->ctl_color->SetSwatchColor( color, false );
1942 setting->ctl_color->SetReadOnly( readOnly );
1943 }
1944 }
1945
1946 for( std::unique_ptr<APPEARANCE_SETTING>& setting : m_objectSettings )
1947 {
1948 GAL_LAYER_ID layer = static_cast<GAL_LAYER_ID>( setting->id );
1949
1950 if( setting->ctl_visibility )
1951 setting->ctl_visibility->SetValue( objects.Contains( layer ) );
1952
1953 if( setting->ctl_color )
1954 {
1955 const COLOR4D& color = theme->GetColor( layer );
1956 setting->ctl_color->SetSwatchColor( color, false );
1957 setting->ctl_color->SetReadOnly( readOnly );
1958 }
1959 }
1960
1961 // Update indicators and panel background colors
1963
1964 Thaw();
1965
1966 m_windowLayers->Refresh();
1967}

References color, GAL_SET::Contains(), COLOR_SETTINGS::GetColor(), PCB_BASE_FRAME::GetColorSettings(), getVisibleLayers(), getVisibleObjects(), JSON_SETTINGS::IsReadOnly(), m_frame, m_layerSettings, m_objectSettings, APPEARANCE_CONTROLS_BASE::m_windowLayers, and OnLayerChanged().

Referenced by doApplyLayerPreset(), OnBoardChanged(), OnColorThemeChanged(), OnLanguageChanged(), OnLayerContextMenu(), and SetLayerVisible().

◆ syncLayerPresetSelection()

void APPEARANCE_CONTROLS::syncLayerPresetSelection ( )
private

Definition at line 2510 of file appearance_controls.cpp.

2511{
2512 LSET visibleLayers = getVisibleLayers();
2513 GAL_SET visibleObjects = getVisibleObjects();
2514
2515 auto it = std::find_if( m_layerPresets.begin(), m_layerPresets.end(),
2516 [&]( const std::pair<const wxString, LAYER_PRESET>& aPair )
2517 {
2518 return ( aPair.second.layers == visibleLayers
2519 && aPair.second.renderLayers == visibleObjects );
2520 } );
2521
2522 if( it != m_layerPresets.end() )
2523 {
2524 // Select the right m_cbLayersPresets item.
2525 // but these items are translated if they are predefined items.
2526 bool do_translate = it->second.readOnly;
2527 wxString text = do_translate ? wxGetTranslation( it->first ) : it->first;
2528
2529 m_cbLayerPresets->SetStringSelection( text );
2530 }
2531 else
2532 {
2533 m_cbLayerPresets->SetSelection( m_cbLayerPresets->GetCount() - 3 ); // separator
2534 }
2535
2536 m_currentPreset = static_cast<LAYER_PRESET*>(
2537 m_cbLayerPresets->GetClientData( m_cbLayerPresets->GetSelection() ) );
2538}

References getVisibleLayers(), getVisibleObjects(), APPEARANCE_CONTROLS_BASE::m_cbLayerPresets, m_currentPreset, m_layerPresets, and text.

Referenced by OnBoardChanged(), OnLanguageChanged(), OnLayerContextMenu(), onLayerVisibilityToggled(), and onObjectVisibilityChanged().

◆ syncObjectSettings()

void APPEARANCE_CONTROLS::syncObjectSettings ( )
private

Definition at line 2241 of file appearance_controls.cpp.

2242{
2243 GAL_SET visible = getVisibleObjects();
2244
2246
2247 for( std::unique_ptr<APPEARANCE_SETTING>& setting : m_objectSettings )
2248 {
2249 if( setting->spacer )
2250 continue;
2251
2252 GAL_LAYER_ID layer = ToGalLayer( setting->id );
2253
2254 if( setting->ctl_visibility )
2255 setting->ctl_visibility->SetValue( visible.Contains( layer ) );
2256
2257 if( setting->ctl_color )
2258 {
2259 COLOR4D color = m_frame->GetColorSettings()->GetColor( setting->id );
2260 setting->ctl_color->SetSwatchColor( color, false );
2261 }
2262 }
2263
2264 wxASSERT( m_objectSettingsMap.count( LAYER_TRACKS )
2269
2270 m_objectSettingsMap[LAYER_TRACKS]->ctl_opacity->SetValue( opts.m_TrackOpacity * 100 );
2271 m_objectSettingsMap[LAYER_VIAS]->ctl_opacity->SetValue( opts.m_ViaOpacity * 100 );
2272 m_objectSettingsMap[LAYER_PADS]->ctl_opacity->SetValue( opts.m_PadOpacity * 100 );
2273 m_objectSettingsMap[LAYER_ZONES]->ctl_opacity->SetValue( opts.m_ZoneOpacity * 100 );
2274 m_objectSettingsMap[LAYER_DRAW_BITMAPS]->ctl_opacity->SetValue( opts.m_ImageOpacity * 100 );
2275}

References color, GAL_SET::Contains(), COLOR_SETTINGS::GetColor(), PCB_BASE_FRAME::GetColorSettings(), PCB_BASE_FRAME::GetDisplayOptions(), getVisibleObjects(), LAYER_DRAW_BITMAPS, LAYER_PADS, LAYER_TRACKS, LAYER_VIAS, LAYER_ZONES, m_frame, PCB_DISPLAY_OPTIONS::m_ImageOpacity, m_objectSettings, m_objectSettingsMap, PCB_DISPLAY_OPTIONS::m_PadOpacity, PCB_DISPLAY_OPTIONS::m_TrackOpacity, PCB_DISPLAY_OPTIONS::m_ViaOpacity, PCB_DISPLAY_OPTIONS::m_ZoneOpacity, and ToGalLayer().

Referenced by OnBoardChanged(), OnColorThemeChanged(), and OnLanguageChanged().

◆ UpdateDisplayOptions()

void APPEARANCE_CONTROLS::UpdateDisplayOptions ( )

Return a list of the layer presets created by the user.

Definition at line 1338 of file appearance_controls.cpp.

1339{
1340 const PCB_DISPLAY_OPTIONS& options = m_frame->GetDisplayOptions();
1341
1342 switch( options.m_ContrastModeDisplay )
1343 {
1344 case HIGH_CONTRAST_MODE::NORMAL: m_rbHighContrastNormal->SetValue( true ); break;
1345 case HIGH_CONTRAST_MODE::DIMMED: m_rbHighContrastDim->SetValue( true ); break;
1346 case HIGH_CONTRAST_MODE::HIDDEN: m_rbHighContrastOff->SetValue( true ); break;
1347 }
1348
1349 switch( options.m_NetColorMode )
1350 {
1351 case NET_COLOR_MODE::ALL: m_rbNetColorAll->SetValue( true ); break;
1352 case NET_COLOR_MODE::RATSNEST: m_rbNetColorRatsnest->SetValue( true ); break;
1353 case NET_COLOR_MODE::OFF: m_rbNetColorOff->SetValue( true ); break;
1354 }
1355
1356 m_cbFlipBoard->SetValue( m_frame->GetCanvas()->GetView()->IsMirroredX() );
1357
1358 if( !m_isFpEditor )
1359 {
1361
1363 m_rbRatsnestNone->SetValue( true );
1365 m_rbRatsnestAllLayers->SetValue( true );
1366 else
1367 m_rbRatsnestVisLayers->SetValue( true );
1368
1369 wxASSERT( m_objectSettingsMap.count( LAYER_RATSNEST ) );
1370 APPEARANCE_SETTING* ratsnest = m_objectSettingsMap.at( LAYER_RATSNEST );
1371 ratsnest->ctl_visibility->SetValue( cfg->m_Display.m_ShowGlobalRatsnest );
1372 }
1373}

References ALL, APPEARANCE_CONTROLS::APPEARANCE_SETTING::ctl_visibility, DIMMED, PCB_BASE_FRAME::GetCanvas(), PCB_BASE_FRAME::GetDisplayOptions(), PCB_BASE_FRAME::GetPcbNewSettings(), PCB_DRAW_PANEL_GAL::GetView(), HIDDEN, KIGFX::VIEW::IsMirroredX(), LAYER_RATSNEST, m_cbFlipBoard, PCB_DISPLAY_OPTIONS::m_ContrastModeDisplay, PCBNEW_SETTINGS::m_Display, m_frame, m_isFpEditor, PCB_DISPLAY_OPTIONS::m_NetColorMode, m_objectSettingsMap, PCBNEW_SETTINGS::DISPLAY_OPTIONS::m_RatsnestMode, m_rbHighContrastDim, m_rbHighContrastNormal, m_rbHighContrastOff, m_rbNetColorAll, m_rbNetColorOff, m_rbNetColorRatsnest, m_rbRatsnestAllLayers, m_rbRatsnestNone, m_rbRatsnestVisLayers, PCBNEW_SETTINGS::DISPLAY_OPTIONS::m_ShowGlobalRatsnest, NORMAL, OFF, RATSNEST, and BITMAP_TOGGLE::SetValue().

Referenced by OnBoardChanged(), FOOTPRINT_EDIT_FRAME::OnDisplayOptionsChanged(), PCB_EDIT_FRAME::OnDisplayOptionsChanged(), and OnLanguageChanged().

◆ updateLayerPresetSelection()

void APPEARANCE_CONTROLS::updateLayerPresetSelection ( const wxString &  aName)
private

Definition at line 2541 of file appearance_controls.cpp.

2542{
2543 // look at m_layerPresets to know if aName is a read only preset, or a user preset.
2544 // Read only presets have translated names in UI, so we have to use
2545 // a translated name in UI selection.
2546 // But for a user preset name we should search for aName (not translated)
2547 wxString ui_label = aName;
2548
2549 for( std::pair<const wxString, LAYER_PRESET>& pair : m_layerPresets )
2550 {
2551 if( pair.first != aName )
2552 continue;
2553
2554 if( pair.second.readOnly == true )
2555 ui_label = wxGetTranslation( aName );
2556
2557 break;
2558 }
2559
2560 int idx = m_cbLayerPresets->FindString( ui_label );
2561
2562 if( idx >= 0 && m_cbLayerPresets->GetSelection() != idx )
2563 {
2564 m_cbLayerPresets->SetSelection( idx );
2565 m_currentPreset = static_cast<LAYER_PRESET*>( m_cbLayerPresets->GetClientData( idx ) );
2566 }
2567 else if( idx < 0 )
2568 {
2569 m_cbLayerPresets->SetSelection( m_cbLayerPresets->GetCount() - 3 ); // separator
2570 }
2571}

References APPEARANCE_CONTROLS_BASE::m_cbLayerPresets, m_currentPreset, and m_layerPresets.

Referenced by ApplyLayerPreset().

◆ updateViewportSelection()

void APPEARANCE_CONTROLS::updateViewportSelection ( const wxString &  aName)
private

Definition at line 2748 of file appearance_controls.cpp.

2749{
2750 int idx = m_cbViewports->FindString( aName );
2751
2752 if( idx >= 0 && idx < (int)m_cbViewports->GetCount() - 3 /* separator */ )
2753 {
2754 m_cbViewports->SetSelection( idx );
2755 m_lastSelectedViewport = static_cast<VIEWPORT*>( m_cbViewports->GetClientData( idx ) );
2756 }
2757 else if( idx < 0 )
2758 {
2759 m_cbViewports->SetSelection( m_cbViewports->GetCount() - 3 ); // separator
2760 m_lastSelectedViewport = nullptr;
2761 }
2762}

References APPEARANCE_CONTROLS_BASE::m_cbViewports, and m_lastSelectedViewport.

Referenced by ApplyViewport().

Member Data Documentation

◆ m_board

BOARD* APPEARANCE_CONTROLS::m_board
private

Definition at line 381 of file appearance_controls.h.

Referenced by OnBoardChanged().

◆ m_bottomBorder

bool WX_PANEL::m_bottomBorder
privateinherited

Definition at line 53 of file wx_panel.h.

Referenced by WX_PANEL::OnPaint(), and WX_PANEL::SetBorders().

◆ m_btnConfigureNetClasses

BITMAP_BUTTON* APPEARANCE_CONTROLS_BASE::m_btnConfigureNetClasses
protectedinherited

◆ m_btnNetInspector

BITMAP_BUTTON* APPEARANCE_CONTROLS_BASE::m_btnNetInspector
protectedinherited

◆ m_cbFlipBoard

wxCheckBox* APPEARANCE_CONTROLS::m_cbFlipBoard
private

◆ m_cbLayerPresets

◆ m_cbViewports

◆ m_contextMenuNetclass

wxString APPEARANCE_CONTROLS::m_contextMenuNetclass
private

The name of the netclass that was right-clicked.

Definition at line 419 of file appearance_controls.h.

Referenced by onNetclassContextMenu(), and rebuildNets().

◆ m_currentPreset

◆ m_focusOwner

wxWindow* APPEARANCE_CONTROLS::m_focusOwner
private

Definition at line 375 of file appearance_controls.h.

Referenced by passOnFocus().

◆ m_frame

◆ m_hoveredCell

wxGridCellCoords APPEARANCE_CONTROLS::m_hoveredCell
private

Grid cell that is being hovered over, for tooltips.

Definition at line 391 of file appearance_controls.h.

Referenced by OnNetGridMouseEvent().

◆ m_iconProvider

ROW_ICON_PROVIDER* APPEARANCE_CONTROLS::m_iconProvider
private

Definition at line 379 of file appearance_controls.h.

Referenced by APPEARANCE_CONTROLS(), rebuildLayers(), and ~APPEARANCE_CONTROLS().

◆ m_inactiveLayersLabel

wxStaticText* APPEARANCE_CONTROLS::m_inactiveLayersLabel
private

Definition at line 440 of file appearance_controls.h.

Referenced by createControls(), and rebuildLayers().

◆ m_isFpEditor

◆ m_lastSelectedUserPreset

LAYER_PRESET* APPEARANCE_CONTROLS::m_lastSelectedUserPreset
private

Definition at line 406 of file appearance_controls.h.

Referenced by ApplyLayerPreset(), and onLayerPresetChanged().

◆ m_lastSelectedViewport

VIEWPORT* APPEARANCE_CONTROLS::m_lastSelectedViewport
private

◆ m_layerContextMenu

wxMenu* APPEARANCE_CONTROLS::m_layerContextMenu
private

Definition at line 413 of file appearance_controls.h.

Referenced by rebuildLayerContextMenu(), and rightClickHandler().

◆ m_layerDisplaySeparator

wxStaticLine* APPEARANCE_CONTROLS::m_layerDisplaySeparator
private

Definition at line 444 of file appearance_controls.h.

Referenced by createControls().

◆ m_layerPanelColour

wxColour APPEARANCE_CONTROLS::m_layerPanelColour
private

◆ m_layerPresets

◆ m_layerSettings

std::vector<std::unique_ptr<APPEARANCE_SETTING> > APPEARANCE_CONTROLS::m_layerSettings
private

Definition at line 393 of file appearance_controls.h.

Referenced by OnLayerChanged(), rebuildLayers(), and syncColorsAndVisibility().

◆ m_layerSettingsMap

std::map<PCB_LAYER_ID, APPEARANCE_SETTING*> APPEARANCE_CONTROLS::m_layerSettingsMap
private

Definition at line 394 of file appearance_controls.h.

Referenced by OnLayerChanged(), and rebuildLayers().

◆ m_layersOuterSizer

wxBoxSizer* APPEARANCE_CONTROLS::m_layersOuterSizer
private

Definition at line 421 of file appearance_controls.h.

Referenced by APPEARANCE_CONTROLS(), OnDarkModeToggle(), and rebuildLayers().

◆ m_leftBorder

bool WX_PANEL::m_leftBorder
privateinherited

Definition at line 50 of file wx_panel.h.

Referenced by WX_PANEL::OnPaint(), and WX_PANEL::SetBorders().

◆ m_netclassIdMap

std::map<int, wxString> APPEARANCE_CONTROLS::m_netclassIdMap
private

Stores wxIDs for each netclass for control event mapping.

Definition at line 416 of file appearance_controls.h.

Referenced by netclassNameFromEvent(), and rebuildNets().

◆ m_netclassOuterSizer

wxBoxSizer* APPEARANCE_CONTROLS_BASE::m_netclassOuterSizer
protectedinherited

◆ m_netclassScrolledWindow

wxScrolledWindow* APPEARANCE_CONTROLS_BASE::m_netclassScrolledWindow
protectedinherited

◆ m_netclassSettings

std::vector<std::unique_ptr<APPEARANCE_SETTING> > APPEARANCE_CONTROLS::m_netclassSettings
private

Definition at line 399 of file appearance_controls.h.

Referenced by rebuildNets().

◆ m_netclassSettingsMap

std::map<wxString, APPEARANCE_SETTING*> APPEARANCE_CONTROLS::m_netclassSettingsMap
private

Definition at line 400 of file appearance_controls.h.

Referenced by OnDarkModeToggle(), onNetclassContextMenu(), and rebuildNets().

◆ m_netsGrid

◆ m_netsTable

◆ m_netsTabOuterSizer

wxBoxSizer* APPEARANCE_CONTROLS_BASE::m_netsTabOuterSizer
protectedinherited

◆ m_netsTabSplitter

wxSplitterWindow* APPEARANCE_CONTROLS_BASE::m_netsTabSplitter
protectedinherited

◆ m_notebook

◆ m_objectSettings

std::vector<std::unique_ptr<APPEARANCE_SETTING> > APPEARANCE_CONTROLS::m_objectSettings
private

◆ m_objectSettingsMap

std::map<GAL_LAYER_ID, APPEARANCE_SETTING*> APPEARANCE_CONTROLS::m_objectSettingsMap
private

◆ m_objectsOuterSizer

wxBoxSizer* APPEARANCE_CONTROLS::m_objectsOuterSizer
private

Definition at line 422 of file appearance_controls.h.

Referenced by APPEARANCE_CONTROLS(), and rebuildObjects().

◆ m_objectsPanelSizer

wxBoxSizer* APPEARANCE_CONTROLS_BASE::m_objectsPanelSizer
protectedinherited

◆ m_paneLayerDisplayOptions

WX_COLLAPSIBLE_PANE* APPEARANCE_CONTROLS::m_paneLayerDisplayOptions
private

◆ m_panelLayers

◆ m_panelLayersSizer

wxBoxSizer* APPEARANCE_CONTROLS_BASE::m_panelLayersSizer
protectedinherited

◆ m_panelNetclasses

wxPanel* APPEARANCE_CONTROLS_BASE::m_panelNetclasses
protectedinherited

◆ m_panelNets

wxPanel* APPEARANCE_CONTROLS_BASE::m_panelNets
protectedinherited

◆ m_panelNetsAndClasses

wxPanel* APPEARANCE_CONTROLS_BASE::m_panelNetsAndClasses
protectedinherited

◆ m_panelObjects

wxPanel* APPEARANCE_CONTROLS_BASE::m_panelObjects
protectedinherited

◆ m_paneNetDisplayOptions

WX_COLLAPSIBLE_PANE* APPEARANCE_CONTROLS::m_paneNetDisplayOptions
private

◆ m_pointSize

int APPEARANCE_CONTROLS::m_pointSize
private

Definition at line 434 of file appearance_controls.h.

Referenced by APPEARANCE_CONTROLS(), and rebuildObjects().

◆ m_presetMRU

wxArrayString APPEARANCE_CONTROLS::m_presetMRU
private

◆ m_presetsLabel

wxStaticText* APPEARANCE_CONTROLS_BASE::m_presetsLabel
protectedinherited

◆ m_rbHighContrastDim

wxRadioButton* APPEARANCE_CONTROLS::m_rbHighContrastDim
private

◆ m_rbHighContrastNormal

wxRadioButton* APPEARANCE_CONTROLS::m_rbHighContrastNormal
private

◆ m_rbHighContrastOff

wxRadioButton* APPEARANCE_CONTROLS::m_rbHighContrastOff
private

◆ m_rbNetColorAll

wxRadioButton* APPEARANCE_CONTROLS::m_rbNetColorAll
private

◆ m_rbNetColorOff

wxRadioButton* APPEARANCE_CONTROLS::m_rbNetColorOff
private

Definition at line 452 of file appearance_controls.h.

Referenced by createControls(), rebuildNets(), and UpdateDisplayOptions().

◆ m_rbNetColorRatsnest

wxRadioButton* APPEARANCE_CONTROLS::m_rbNetColorRatsnest
private

◆ m_rbRatsnestAllLayers

wxRadioButton* APPEARANCE_CONTROLS::m_rbRatsnestAllLayers
private

◆ m_rbRatsnestNone

wxRadioButton* APPEARANCE_CONTROLS::m_rbRatsnestNone
private

Definition at line 456 of file appearance_controls.h.

Referenced by createControls(), rebuildNets(), and UpdateDisplayOptions().

◆ m_rbRatsnestVisLayers

wxRadioButton* APPEARANCE_CONTROLS::m_rbRatsnestVisLayers
private

◆ m_rightBorder

bool WX_PANEL::m_rightBorder
privateinherited

Definition at line 51 of file wx_panel.h.

Referenced by WX_PANEL::OnPaint(), and WX_PANEL::SetBorders().

◆ m_sizerOuter

wxBoxSizer* APPEARANCE_CONTROLS_BASE::m_sizerOuter
protectedinherited

◆ m_staticTextNetClasses

wxStaticText* APPEARANCE_CONTROLS_BASE::m_staticTextNetClasses
protectedinherited

◆ m_staticTextNets

wxStaticText* APPEARANCE_CONTROLS_BASE::m_staticTextNets
protectedinherited

◆ m_toggleGridRenderer

GRID_BITMAP_TOGGLE_RENDERER* APPEARANCE_CONTROLS::m_toggleGridRenderer
private

Definition at line 388 of file appearance_controls.h.

Referenced by APPEARANCE_CONTROLS().

◆ m_topBorder

bool WX_PANEL::m_topBorder
privateinherited

Definition at line 52 of file wx_panel.h.

Referenced by WX_PANEL::OnPaint(), and WX_PANEL::SetBorders().

◆ m_txtNetDisplayTitle

wxStaticText* APPEARANCE_CONTROLS::m_txtNetDisplayTitle
private

Definition at line 449 of file appearance_controls.h.

Referenced by createControls(), and rebuildNets().

◆ m_txtNetFilter

wxTextCtrl* APPEARANCE_CONTROLS_BASE::m_txtNetFilter
protectedinherited

◆ m_txtRatsnestVisibility

wxStaticText* APPEARANCE_CONTROLS::m_txtRatsnestVisibility
private

Definition at line 453 of file appearance_controls.h.

Referenced by createControls(), and rebuildNets().

◆ m_viewportMRU

wxArrayString APPEARANCE_CONTROLS::m_viewportMRU
private

Definition at line 411 of file appearance_controls.h.

Referenced by GetViewportsMRU(), onViewportChanged(), and SetUserViewports().

◆ m_viewports

std::map<wxString, VIEWPORT> APPEARANCE_CONTROLS::m_viewports
private

◆ m_viewportsLabel

wxStaticText* APPEARANCE_CONTROLS_BASE::m_viewportsLabel
protectedinherited

◆ m_windowLayers

wxScrolledCanvas* APPEARANCE_CONTROLS_BASE::m_windowLayers
protectedinherited

◆ m_windowObjects

wxScrolledCanvas* APPEARANCE_CONTROLS_BASE::m_windowObjects
protectedinherited

◆ presetAllCopper

LAYER_PRESET APPEARANCE_CONTROLS::presetAllCopper
staticprivate

Definition at line 427 of file appearance_controls.h.

Referenced by loadDefaultLayerPresets(), and OnLayerContextMenu().

◆ presetAllLayers

LAYER_PRESET APPEARANCE_CONTROLS::presetAllLayers
staticprivate

◆ presetBack

LAYER_PRESET APPEARANCE_CONTROLS::presetBack
staticprivate

Definition at line 431 of file appearance_controls.h.

Referenced by loadDefaultLayerPresets(), and OnLayerContextMenu().

◆ presetBackAssembly

LAYER_PRESET APPEARANCE_CONTROLS::presetBackAssembly
staticprivate

Definition at line 432 of file appearance_controls.h.

Referenced by loadDefaultLayerPresets(), and OnLayerContextMenu().

◆ presetFront

LAYER_PRESET APPEARANCE_CONTROLS::presetFront
staticprivate

Definition at line 429 of file appearance_controls.h.

Referenced by loadDefaultLayerPresets(), and OnLayerContextMenu().

◆ presetFrontAssembly

LAYER_PRESET APPEARANCE_CONTROLS::presetFrontAssembly
staticprivate

Definition at line 430 of file appearance_controls.h.

Referenced by loadDefaultLayerPresets(), and OnLayerContextMenu().

◆ presetInnerCopper

LAYER_PRESET APPEARANCE_CONTROLS::presetInnerCopper
staticprivate

Definition at line 428 of file appearance_controls.h.

Referenced by loadDefaultLayerPresets(), and OnLayerContextMenu().

◆ presetNoLayers

LAYER_PRESET APPEARANCE_CONTROLS::presetNoLayers
staticprivate

Definition at line 425 of file appearance_controls.h.

Referenced by OnLayerContextMenu().

◆ s_objectSettings

const APPEARANCE_CONTROLS::APPEARANCE_SETTING APPEARANCE_CONTROLS::s_objectSettings
staticprivate
Initial value:
= {
#define RR
RR( _HKI( "Tracks" ), LAYER_TRACKS, _HKI( "Show tracks" ), true ),
RR( _HKI( "Vias" ), LAYER_VIAS, _HKI( "Show all vias" ), true ),
RR( _HKI( "Pads" ), LAYER_PADS, _HKI( "Show all pads" ), true ),
RR( _HKI( "Zones" ), LAYER_ZONES, _HKI( "Show copper zones" ), true ),
RR( _HKI( "Images" ), LAYER_DRAW_BITMAPS, _HKI( "Show user images" ), true ),
RR(),
RR( _HKI( "Footprints Front" ), LAYER_MOD_FR, _HKI( "Show footprints that are on board's front" ) ),
RR( _HKI( "Footprints Back" ), LAYER_MOD_BK, _HKI( "Show footprints that are on board's back" ) ),
RR( _HKI( "Through-hole Pads" ), LAYER_PADS_TH, _HKI( "Show through-hole pads" ) ),
RR( _HKI( "Values" ), LAYER_MOD_VALUES, _HKI( "Show footprint values" ) ),
RR( _HKI( "References" ), LAYER_MOD_REFERENCES, _HKI( "Show footprint references" ) ),
RR( _HKI( "Footprint Text" ), LAYER_MOD_TEXT, _HKI( "Show all footprint text" ) ),
RR( _HKI( "Hidden Text" ), LAYER_MOD_TEXT_INVISIBLE, _HKI( "Show footprint text marked as invisible" ) ),
RR(),
RR(),
RR( _HKI( "Ratsnest" ), LAYER_RATSNEST, _HKI( "Show unconnected nets as a ratsnest") ),
RR( _HKI( "DRC Warnings" ), LAYER_DRC_WARNING, _HKI( "DRC violations with a Warning severity" ) ),
RR( _HKI( "DRC Errors" ), LAYER_DRC_ERROR, _HKI( "DRC violations with an Error severity" ) ),
RR( _HKI( "DRC Exclusions" ), LAYER_DRC_EXCLUSION, _HKI( "DRC violations which have been individually excluded" ) ),
RR( _HKI( "Anchors" ), LAYER_ANCHOR, _HKI( "Show footprint and text origins as a cross" ) ),
RR( _HKI( "Locked Item Shadow" ), LAYER_LOCKED_ITEM_SHADOW, _HKI( "Show a shadow marker on locked items" ) ),
RR( _HKI( "Drawing Sheet" ), LAYER_DRAWINGSHEET, _HKI( "Show drawing sheet borders and title block" ) ),
RR( _HKI( "Grid" ), LAYER_GRID, _HKI( "Show the (x,y) grid dots" ) )
}
#define RR
@ LAYER_MOD_TEXT_INVISIBLE
text marked as invisible
Definition: layer_ids.h:200
@ LAYER_LOCKED_ITEM_SHADOW
shadow layer for locked items
Definition: layer_ids.h:239
@ LAYER_DRAWINGSHEET
drawingsheet frame and titleblock
Definition: layer_ids.h:217
@ LAYER_DRC_EXCLUSION
layer for drc markers which have been individually excluded
Definition: layer_ids.h:236
@ LAYER_DRC_WARNING
layer for drc markers with SEVERITY_WARNING
Definition: layer_ids.h:235
@ LAYER_MOD_FR
show footprints on front
Definition: layer_ids.h:208
@ LAYER_ANCHOR
anchor of items having an anchor point (texts, footprints)
Definition: layer_ids.h:201
@ LAYER_PADS_TH
multilayer pads, usually with holes
Definition: layer_ids.h:213
@ LAYER_DRC_ERROR
layer for drc markers with SEVERITY_ERROR
Definition: layer_ids.h:216