54#include <wx/checkbox.h>
55#include <wx/hyperlink.h>
57#include <wx/radiobut.h>
60#include <wx/statline.h>
61#include <wx/textdlg.h>
62#include <wx/bmpbuttn.h>
76 m_labelAttr->SetBackgroundColour( aBackgroundColor );
89 wxGridCellAttr* attr =
nullptr;
108 wxASSERT(
static_cast<size_t>( aRow ) <
m_nets.size() );
115 default:
return wxEmptyString;
122 wxASSERT(
static_cast<size_t>( aRow ) <
m_nets.size() );
134 net.
visible = ( aValue != wxT(
"0" ) );
154 case COL_LABEL:
return wxGRID_VALUE_STRING;
155 default:
return wxGRID_VALUE_STRING;
162 wxASSERT(
static_cast<size_t>( aRow ) <
m_nets.size() );
165 return m_nets[aRow].visible;
171 wxASSERT(
static_cast<size_t>( aRow ) <
m_nets.size() );
174 m_nets[aRow].visible = aValue;
182 wxASSERT( aTypeName == wxT(
"COLOR4D" ) );
183 wxASSERT(
static_cast<size_t>( aRow ) <
m_nets.size() );
192 wxASSERT( aTypeName == wxT(
"COLOR4D" ) );
193 wxASSERT(
static_cast<size_t>( aRow ) <
m_nets.size() );
202 wxASSERT(
static_cast<size_t>( aRow ) <
m_nets.size() );
212 return aEntry.code == aCode;
218 return std::distance(
m_nets.cbegin(), it );
233 int deleted =
m_nets.size();
238 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, 0, deleted );
239 GetView()->ProcessTableMessage( msg );
242 for(
const std::pair<const wxString, NETINFO_ITEM*>& pair : nets )
244 int netCode = pair.second->GetNetCode();
246 if( netCode > 0 && !pair.first.StartsWith( wxT(
"unconnected-(" ) ) )
248 COLOR4D color = netColors.count( netCode ) ? netColors.at( netCode ) :
249 COLOR4D::UNSPECIFIED;
251 bool visible = hiddenNets.count( netCode ) == 0;
261 return a.name < b.name;
266 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
m_nets.size() );
267 GetView()->ProcessTableMessage( msg );
281 GetView()->ForceRefresh();
289 net.visible = ( net.code == aNet.
code );
294 GetView()->ForceRefresh();
312 std::map<int, KIGFX::COLOR4D>& netColors = renderSettings->
GetNetColorMap();
314 if( aNet.
color != COLOR4D::UNSPECIFIED )
317 netColors.erase( aNet.
code );
328#define RR APPEARANCE_CONTROLS::APPEARANCE_SETTING
402 bool aFpEditorMode ) :
405 m_focusOwner( aFocusOwner ),
407 m_isFpEditor( aFpEditorMode ),
408 m_currentPreset( nullptr ),
409 m_lastSelectedUserPreset( nullptr ),
410 m_layerContextMenu( nullptr ),
411 m_togglingNetclassRatsnestVisibility( false )
414 SetMinSize( FromDIP( GetMinSize() ) );
416 int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
418 m_pointSize = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ).GetPointSize();
442 m_cbLayerPresets->SetToolTip( wxString::Format(
_(
"Save and restore layer visibility combinations.\n"
443 "Use %s+Tab to activate selector.\n"
444 "Successive Tabs while holding %s down will "
445 "cycle through presets in the popup." ),
449 m_cbViewports->SetToolTip( wxString::Format(
_(
"Save and restore view location and zoom.\n"
450 "Use %s+Tab to activate selector.\n"
451 "Successive Tabs while holding %s down will "
452 "cycle through viewports in the popup." ),
476 auto setHighContrastMode =
487 [=]( wxCommandEvent& aEvent )
489 setHighContrastMode( HIGH_CONTRAST_MODE::NORMAL );
493 [=]( wxCommandEvent& aEvent )
495 setHighContrastMode( HIGH_CONTRAST_MODE::DIMMED );
499 [=]( wxCommandEvent& aEvent )
501 setHighContrastMode( HIGH_CONTRAST_MODE::HIDDEN );
507 [&]( wxCommandEvent& aEvent )
513 [&]( wxCommandEvent& aEvent )
517 editframe->ShowBoardSetupDialog(
_(
"Net Classes" ) );
524 [&]( wxCommandEvent& aEvent )
535 m_netsGrid->RegisterDataType( wxT(
"COLOR4D" ),
543 m_netsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
547 const int cellPadding = 6;
549 const int rowHeightPadding = 5;
551 const int rowHeightPadding = 3;
557 size =
KiBitmapBundle( BITMAPS::visibility ).GetPreferredBitmapSizeFor(
this );
561 m_netsGrid->SetDefaultRowSize( font.GetPixelSize().y + rowHeightPadding );
570 m_netsGrid->ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_DEFAULT );
615 _(
"Layer Display Options" ) );
621 wxBoxSizer* layerDisplayOptionsSizer;
622 layerDisplayOptionsSizer =
new wxBoxSizer( wxVERTICAL );
629 msg =
_(
"Inactive layers:" );
636 wxBoxSizer* contrastModeSizer;
637 contrastModeSizer =
new wxBoxSizer( wxHORIZONTAL );
640 wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
646 contrastModeSizer->AddStretchSpacer();
653 contrastModeSizer->AddStretchSpacer();
660 contrastModeSizer->AddStretchSpacer();
662 layerDisplayOptionsSizer->Add( contrastModeSizer, 0, wxEXPAND, 5 );
665 wxDefaultSize, wxLI_HORIZONTAL );
668 m_cbFlipBoard =
new wxCheckBox( layerDisplayPane, wxID_ANY,
_(
"Flip board view" ) );
670 layerDisplayOptionsSizer->Add(
m_cbFlipBoard, 0, wxTOP | wxBOTTOM, 3 );
672 layerDisplayPane->SetSizer( layerDisplayOptionsSizer );
673 layerDisplayPane->Layout();
674 layerDisplayOptionsSizer->Fit( layerDisplayPane );
679 [&]( wxCommandEvent& aEvent )
690 _(
"Net Display Options" ) );
695 wxBoxSizer* netDisplayOptionsSizer =
new wxBoxSizer( wxVERTICAL );
704 msg =
_(
"Net colors:" );
713 wxBoxSizer* netColorSizer =
new wxBoxSizer( wxHORIZONTAL );
715 m_rbNetColorAll =
new wxRadioButton( netDisplayPane, wxID_ANY,
_(
"All" ), wxDefaultPosition,
716 wxDefaultSize, wxRB_GROUP );
718 m_rbNetColorAll->SetToolTip(
_(
"Net and netclass colors are shown on all copper items" ) );
721 netColorSizer->AddStretchSpacer();
729 netColorSizer->AddStretchSpacer();
731 m_rbNetColorOff =
new wxRadioButton( netDisplayPane, wxID_ANY,
_(
"None" ) );
733 m_rbNetColorOff->SetToolTip(
_(
"Net and netclass colors are not shown" ) );
737 netDisplayOptionsSizer->Add( netColorSizer, 0, wxEXPAND | wxBOTTOM, 5 );
746 msg =
_(
"Ratsnest display:" );
755 wxBoxSizer* ratsnestDisplayModeSizer =
new wxBoxSizer( wxHORIZONTAL );
758 wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
764 ratsnestDisplayModeSizer->AddStretchSpacer();
771 ratsnestDisplayModeSizer->AddStretchSpacer();
779 netDisplayOptionsSizer->Add( ratsnestDisplayModeSizer, 0, wxEXPAND | wxBOTTOM, 5 );
783 netDisplayPane->SetSizer( netDisplayOptionsSizer );
784 netDisplayPane->Layout();
785 netDisplayOptionsSizer->Fit( netDisplayPane );
790 [&]( wxCommandEvent& aEvent )
833 int page = aEvent.GetSelection();
836 m_notebook->ChangeSelection(
static_cast<unsigned>( page ) );
865 if( wxBitmapButton* btn =
dynamic_cast<wxBitmapButton*
>( aEvent.GetEventObject() ) )
867 wxCommandEvent evt( wxEVT_BUTTON );
868 wxPostEvent( btn, evt );
885 int row =
event.GetRow();
886 int col =
event.GetCol();
903 int row =
event.GetRow();
904 int col =
event.GetCol();
926 menu.Append(
new wxMenuItem( &menu,
ID_SET_NET_COLOR,
_(
"Set Net Color" ), wxEmptyString,
928 menu.Append(
new wxMenuItem( &menu,
ID_CLEAR_NET_COLOR,
_(
"Clear Net Color" ), wxEmptyString,
931 menu.AppendSeparator();
934 wxString::Format(
_(
"Highlight %s" ), netName ), wxEmptyString,
937 wxString::Format(
_(
"Select Tracks and Vias in %s" ), netName ),
938 wxEmptyString, wxITEM_NORMAL ) );
940 wxString::Format(
_(
"Unselect Tracks and Vias in %s" ), netName ),
941 wxEmptyString, wxITEM_NORMAL ) );
943 menu.AppendSeparator();
945 menu.Append(
new wxMenuItem( &menu,
ID_SHOW_ALL_NETS,
_(
"Show All Nets" ), wxEmptyString,
948 wxEmptyString, wxITEM_NORMAL ) );
958 wxPoint pos =
m_netsGrid->CalcUnscrolledPosition( aEvent.GetPosition() );
959 wxGridCellCoords cell =
m_netsGrid->XYToCell( pos );
961 if( aEvent.Moving() || aEvent.Entering() )
979 wxString showOrHide = net.
visible ?
_(
"Click to hide ratsnest for %s" )
980 :
_(
"Click to show ratsnest for %s" );
985 tip.Printf( showOrHide,
name );
989 tip =
_(
"Double click (or middle click) to change color; "
990 "right click for more actions" );
993 m_netsGrid->GetGridWindow()->SetToolTip( tip );
995 else if( aEvent.Leaving() )
1000 else if( aEvent.Dragging() )
1008 else if( aEvent.ButtonUp( wxMOUSE_BTN_MIDDLE ) && !!cell )
1010 int row = cell.GetRow();
1011 int col = cell.GetCol();
1107 bool rebuild = std::any_of( aBoardItems.begin(), aBoardItems.end(),
1110 return a->Type() == PCB_NETINFO_T;
1160 std::vector<BOARD_ITEM*>& aAddedItems,
1161 std::vector<BOARD_ITEM*>& aRemovedItems,
1162 std::vector<BOARD_ITEM*>& aChangedItems )
1202 if( child && child->GetWindow() )
1207 m_netsGrid->RegisterDataType( wxT(
"COLOR4D" ),
1213 if( pair.second->ctl_color )
1214 pair.second->ctl_color->OnDarkModeToggle();
1223 for(
const std::unique_ptr<APPEARANCE_SETTING>& setting :
m_layerSettings )
1233 if( r < 240 || g < 240 || b < 240 )
1235 r = wxChar( std::min( (
int) r + 15, 255 ) );
1236 g = wxChar( std::min( (
int) g + 15, 255 ) );
1237 b = wxChar( std::min( (
int) b + 15, 255 ) );
1241 r = wxChar( std::max( (
int) r - 15, 0 ) );
1242 g = wxChar( std::max( (
int) g - 15, 0 ) );
1243 b = wxChar( std::max( (
int) b - 15, 0 ) );
1256 newSetting->
ctl_panel->SetBackgroundColour( wxColour( r, g, b ) );
1268 if( visible.test( layer ) == isVisible )
1271 visible.
set( layer, isVisible );
1320 return dynamic_cast<PCB_VIA*
>( aItem ) ||
dynamic_cast<PAD*
>( aItem );
1377 for(
size_t i = 0; i < set.size(); i++ )
1429 std::vector<LAYER_PRESET> ret;
1431 for(
const std::pair<const wxString, LAYER_PRESET>& pair :
m_layerPresets )
1433 if( !pair.second.readOnly )
1434 ret.emplace_back( pair.second );
1479 wxCommandEvent
dummy;
1501 std::vector<VIEWPORT> ret;
1503 for(
const std::pair<const wxString, VIEWPORT>& pair :
m_viewports )
1504 ret.emplace_back( pair.second );
1514 for(
const VIEWPORT& viewport : aViewportList )
1532 wxCommandEvent
dummy;
1559 m_windowLayersSizerItem->SetFlag( m_windowLayersSizerItem->GetFlag() & ~wxTOP );
1563 [&]( std::unique_ptr<APPEARANCE_SETTING>& aSetting )
1565 int layer = aSetting->id;
1568 wxBoxSizer* sizer =
new wxBoxSizer( wxHORIZONTAL );
1569 panel->SetSizer( sizer );
1573 aSetting->visible = visible[layer];
1583 swatch->SetToolTip(
_(
"Double click or middle click for color change, "
1584 "right click for menu" ) );
1589 aSetting->visible );
1590 btn_visible->SetToolTip(
_(
"Show or hide this layer" ) );
1592 wxStaticText* label =
new wxStaticText( panel, layer, aSetting->label );
1594 label->SetToolTip( aSetting->tooltip );
1596 sizer->AddSpacer( 1 );
1597 sizer->Add( indicator, 0, wxALIGN_CENTER_VERTICAL | wxTOP, 2 );
1598 sizer->AddSpacer( 5 );
1599 sizer->Add( swatch, 0, wxALIGN_CENTER_VERTICAL | wxTOP, 2 );
1600 sizer->AddSpacer( 6 );
1601 sizer->Add( btn_visible, 0, wxALIGN_CENTER_VERTICAL | wxTOP, 2 );
1602 sizer->AddSpacer( 5 );
1603 sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxTOP, 2 );
1607 aSetting->ctl_panel = panel;
1608 aSetting->ctl_indicator = indicator;
1609 aSetting->ctl_visibility = btn_visible;
1610 aSetting->ctl_color = swatch;
1611 aSetting->ctl_text = label;
1618 btn_visible->Bind( TOGGLE_CHANGED,
1619 [&]( wxCommandEvent& aEvent )
1621 wxObject* btn = aEvent.GetEventObject();
1622 int layerId =
static_cast<wxWindow*
>( btn )->GetId();
1641 [&]( std::unique_ptr<APPEARANCE_SETTING>& aSetting )
1643 int layer = aSetting->id;
1644 aSetting->visible = visible[layer];
1645 aSetting->ctl_panel->Show();
1646 aSetting->ctl_panel->SetId( layer );
1647 aSetting->ctl_indicator->SetWindowID( layer );
1648 aSetting->ctl_color->SetWindowID( layer );
1649 aSetting->ctl_color->SetSwatchColor( theme->
GetColor( layer ), false );
1650 aSetting->ctl_visibility->SetWindowID( layer );
1651 aSetting->ctl_text->SetLabelText( aSetting->label );
1652 aSetting->ctl_text->SetId( layer );
1653 aSetting->ctl_text->SetToolTip( aSetting->tooltip );
1659 static const struct {
1665 {
F_Paste,
_HKI(
"Solder paste on board's front" ) },
1666 {
B_Paste,
_HKI(
"Solder paste on board's back" ) },
1667 {
F_SilkS,
_HKI(
"Silkscreen on board's front" ) },
1668 {
B_SilkS,
_HKI(
"Silkscreen on board's back" ) },
1669 {
F_Mask,
_HKI(
"Solder mask on board's front" ) },
1670 {
B_Mask,
_HKI(
"Solder mask on board's back" ) },
1676 {
Margin,
_HKI(
"Board's edge setback outline" ) },
1677 {
F_CrtYd,
_HKI(
"Footprint courtyards on board's front" ) },
1678 {
B_CrtYd,
_HKI(
"Footprint courtyards on board's back" ) },
1679 {
F_Fab,
_HKI(
"Footprint assembly on board's front" ) },
1680 {
B_Fab,
_HKI(
"Footprint assembly on board's back" ) },
1743 std::size_t total_layers = enabled.
CuStack().size();
1745 for(
const auto& entry : non_cu_seq )
1747 if( enabled[entry.layerId] )
1757 for( std::size_t ii = total_layers; ii <
m_layerSettings.size(); ++ii )
1772 case F_Cu: dsc =
_(
"Front copper layer" );
break;
1773 case B_Cu: dsc =
_(
"Back copper layer" );
break;
1774 default: dsc =
_(
"Inner copper layer" );
break;
1777 std::unique_ptr<APPEARANCE_SETTING>& setting = *layer_it;
1780 setting->id = layer;
1781 setting->tooltip = dsc;
1783 if( setting->ctl_panel ==
nullptr )
1784 appendLayer( setting );
1786 updateLayer( setting );
1792 setting->ctl_text->Disable();
1793 setting->ctl_color->SetToolTip( wxEmptyString );
1799 for(
const auto& entry : non_cu_seq )
1803 if( !enabled[layer] )
1806 std::unique_ptr<APPEARANCE_SETTING>& setting = *layer_it;
1822 setting->id = layer;
1825 setting->tooltip = wxGetTranslation( entry.tooltip );
1827 if( setting->ctl_panel ==
nullptr )
1828 appendLayer( setting );
1830 updateLayer( setting );
1836 setting->ctl_text->Disable();
1837 setting->ctl_color->SetToolTip( wxEmptyString );
1855 msg =
_(
"Inactive layers:" );
1878 KiBitmap( BITMAPS::show_all_copper_layers ) );
1880 KiBitmap( BITMAPS::show_no_copper_layers ) );
1885 _(
"Hide All Layers But Active" ),
KiBitmap( BITMAPS::select_w_layer ) );
1890 _(
"Show All Non Copper Layers" ),
1891 KiBitmap( BITMAPS::show_no_copper_layers ) );
1894 _(
"Hide All Non Copper Layers" ),
1895 KiBitmap( BITMAPS::show_all_copper_layers ) );
1900 KiBitmap( BITMAPS::show_all_layers ) );
1903 KiBitmap( BITMAPS::show_no_layers ) );
1908 _(
"Show Only Front Assembly Layers" ),
1909 KiBitmap( BITMAPS::show_front_assembly_layers ) );
1912 KiBitmap( BITMAPS::show_all_front_layers ) );
1918 _(
"Show Only Inner Layers" ),
1919 KiBitmap( BITMAPS::show_all_copper_layers ) );
1923 KiBitmap( BITMAPS::show_all_back_layers ) );
1926 _(
"Show Only Back Assembly Layers" ),
1927 KiBitmap( BITMAPS::show_back_assembly_layers ) );
1942 switch( aEvent.GetId() )
1965 visible &= ~presetAllCopper.layers;
1967 if( !visible.test( current ) && visible.count() > 0 )
1976 if( !visible.test( current ) && visible.count() > 0 )
1983 visible |= ~presetAllCopper.layers;
2034 if( aTab >= 0 &&
static_cast<size_t>( aTab ) < max )
2050 int layer = setting->id;
2052 if( setting->ctl_visibility )
2053 setting->ctl_visibility->SetValue( visible[layer] );
2055 if( setting->ctl_color )
2058 setting->ctl_color->SetSwatchColor(
color,
false );
2059 setting->ctl_color->SetReadOnly( readOnly );
2067 if( setting->ctl_visibility )
2068 setting->ctl_visibility->SetValue( objects.
Contains( layer ) );
2070 if( setting->ctl_color )
2073 setting->ctl_color->SetSwatchColor(
color,
false );
2074 setting->ctl_color->SetReadOnly( readOnly );
2089 wxWindow* eventSource =
static_cast<wxWindow*
>( aEvent.GetEventObject() );
2113 visibleLayers.
set( aLayer, !visibleLayers.test( aLayer ) );
2182 if( visible.
Contains( aLayer ) != isVisible )
2184 visible.
set( aLayer, isVisible );
2203 int swatchWidth =
m_windowObjects->ConvertDialogToPixels( wxSize( 8, 0 ) ).x;
2214 [&](
const std::unique_ptr<APPEARANCE_SETTING>& aSetting )
2216 wxBoxSizer* sizer =
new wxBoxSizer( wxHORIZONTAL );
2217 int layer = aSetting->id;
2223 if(
color != COLOR4D::UNSPECIFIED )
2227 swatch->SetToolTip(
_(
"Left double click or middle click for color change, "
2228 "right click for menu" ) );
2230 sizer->Add( swatch, 0, wxALIGN_CENTER_VERTICAL, 0 );
2231 aSetting->ctl_color = swatch;
2241 sizer->AddSpacer( swatchWidth );
2247 if( aSetting->can_control_visibility )
2253 tip.Printf(
_(
"Show or hide %s" ), aSetting->label.Lower() );
2254 btn_visible->SetToolTip( tip );
2256 aSetting->ctl_visibility = btn_visible;
2258 btn_visible->Bind( TOGGLE_CHANGED,
2259 [&]( wxCommandEvent& aEvent )
2261 int id =
static_cast<wxWindow*
>( aEvent.GetEventObject() )->GetId();
2262 bool isVisible = aEvent.GetInt();
2267 sizer->AddSpacer( 5 );
2269 wxStaticText* label =
new wxStaticText(
m_windowObjects, layer, aSetting->label );
2271 label->SetToolTip( aSetting->tooltip );
2273 if( aSetting->can_control_opacity )
2275 label->SetMinSize( wxSize( labelWidth, -1 ) );
2278 sizer->Add( btn_visible, 0, wxALIGN_CENTER_VERTICAL | wxBOTTOM, 10 );
2280 sizer->AddSpacer( btnWidth );
2282 sizer->AddSpacer( 5 );
2283 sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL | wxBOTTOM, 10 );
2286 sizer->Add( btn_visible, 0, wxALIGN_CENTER_VERTICAL, 0 );
2288 sizer->AddSpacer( btnWidth );
2290 sizer->AddSpacer( 5 );
2291 sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL, 0 );
2294 wxSlider* slider =
new wxSlider(
m_windowObjects, wxID_ANY, 100, 0, 100,
2295 wxDefaultPosition, wxDefaultSize,
2298 slider->SetMinSize( wxSize( 80, 16 ) );
2300 slider->SetMinSize( wxSize( 80, -1 ) );
2303 tip.Printf(
_(
"Set opacity of %s" ), aSetting->label.Lower() );
2304 slider->SetToolTip( tip );
2306 sizer->Add( slider, 1, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5 );
2307 aSetting->ctl_opacity = slider;
2309 auto opacitySliderHandler =
2310 [
this, layer]( wxCommandEvent& aEvent )
2312 wxSlider* ctrl =
static_cast<wxSlider*
>( aEvent.GetEventObject() );
2313 int value = ctrl->GetValue();
2317 slider->Bind( wxEVT_SCROLL_CHANGED, opacitySliderHandler );
2318 slider->Bind( wxEVT_SCROLL_THUMBTRACK, opacitySliderHandler );
2324 sizer->Add( btn_visible, 0, wxALIGN_CENTER_VERTICAL, 0 );
2326 sizer->AddSpacer( btnWidth );
2328 sizer->AddSpacer( 5 );
2329 sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL, 0 );
2332 aSetting->ctl_text = label;
2335 if( !aSetting->can_control_opacity )
2344 m_objectSettings.emplace_back( std::make_unique<APPEARANCE_SETTING>( s_setting ) );
2350 setting->tooltip = wxGetTranslation( s_setting.tooltip );
2351 setting->label = wxGetTranslation( s_setting.label );
2353 if( setting->can_control_opacity )
2356 labelWidth = std::max( labelWidth, width );
2359 if( !s_setting.spacer )
2363 for(
const std::unique_ptr<APPEARANCE_SETTING>& setting :
m_objectSettings )
2365 if( setting->spacer )
2368 appendObject( setting );
2383 if( setting->spacer )
2388 if( setting->ctl_visibility )
2389 setting->ctl_visibility->SetValue( visible.
Contains( layer ) );
2391 if( setting->ctl_color )
2394 setting->ctl_color->SetSwatchColor(
color,
false );
2415 const wxString& aName )
2420 if( !isDefaultClass)
2422 aMenu.Append(
new wxMenuItem( &aMenu,
ID_SET_NET_COLOR,
_(
"Set Netclass Color" ),
2423 wxEmptyString, wxITEM_NORMAL ) );
2425 wxMenuItem* schematicColor =
2427 wxEmptyString, wxITEM_NORMAL );
2428 std::shared_ptr<NETCLASS> nc = netSettings->GetNetClassByName( aName );
2430 aMenu.Append( schematicColor );
2433 schematicColor->Enable(
false );
2436 wxEmptyString, wxITEM_NORMAL ) );
2437 aMenu.AppendSeparator();
2443 wxString::Format(
_(
"Highlight Nets in %s" ),
name ),
2444 wxEmptyString, wxITEM_NORMAL ) );
2446 wxString::Format(
_(
"Select Tracks and Vias in %s" ),
name ),
2447 wxEmptyString, wxITEM_NORMAL ) );
2449 wxString::Format(
_(
"Unselect Tracks and Vias in %s" ),
name ),
2450 wxEmptyString, wxITEM_NORMAL ) );
2452 aMenu.AppendSeparator();
2454 aMenu.Append(
new wxMenuItem( &aMenu,
ID_SHOW_ALL_NETS,
_(
"Show All Netclasses" ),
2455 wxEmptyString, wxITEM_NORMAL ) );
2456 aMenu.Append(
new wxMenuItem( &aMenu,
ID_HIDE_OTHER_NETS,
_(
"Hide All Other Netclasses" ),
2457 wxEmptyString, wxITEM_NORMAL ) );
2483 auto appendNetclass =
2484 [&](
int aId,
const std::shared_ptr<NETCLASS>& aClass,
bool isDefaultClass = false )
2486 wxString
name = aClass->GetName();
2493 wxBoxSizer* sizer =
new wxBoxSizer( wxHORIZONTAL );
2497 ? netSettings->GetNetClassByName(
name )->GetPcbColor()
2498 : COLOR4D::UNSPECIFIED;
2502 setting->
ctl_color->SetToolTip(
_(
"Left double click or middle click for color "
2503 "change, right click for menu" ) );
2505 setting->
ctl_color->Bind( COLOR_SWATCH_CHANGED,
2509 if( isDefaultClass )
2517 tip.Printf(
_(
"Show or hide ratsnest for nets in %s" ),
name );
2523 int flags = wxALIGN_CENTER_VERTICAL;
2525 sizer->Add( setting->
ctl_color, 0, flags | wxRESERVE_SPACE_EVEN_IF_HIDDEN, 5 );
2526 sizer->AddSpacer( 7 );
2528 sizer->AddSpacer( 3 );
2529 sizer->Add( setting->
ctl_text, 1, flags, 5 );
2539 [&,
name, isDefaultClass]( wxMouseEvent& aEvent )
2548 setting->
ctl_panel->Bind( wxEVT_RIGHT_DOWN, menuHandler );
2550 setting->
ctl_color->Bind( wxEVT_RIGHT_DOWN, menuHandler );
2551 setting->
ctl_text->Bind( wxEVT_RIGHT_DOWN, menuHandler );
2554 std::vector<wxString> names;
2556 for(
const auto& [
name, netclass] : netSettings->GetNetclasses() )
2557 names.emplace_back(
name );
2559 std::sort( names.begin(), names.end() );
2563 int idx = wxID_HIGHEST;
2566 appendNetclass( idx++, netSettings->GetDefaultNetclass(),
true );
2568 for(
const wxString&
name : names )
2571 appendNetclass( idx++, netSettings->GetNetclasses().at(
name ) );
2584 msg =
_(
"Net colors:" );
2590 m_rbNetColorAll->SetToolTip(
_(
"Net and netclass colors are shown on all copper items" ) );
2596 m_rbNetColorOff->SetToolTip(
_(
"Net and netclass colors are not shown" ) );
2603 msg =
_(
"Ratsnest display:" );
2635 int default_idx = 0;
2637 for( std::pair<const wxString, LAYER_PRESET>& pair :
m_layerPresets )
2639 const wxString translatedName = wxGetTranslation( pair.first );
2641 static_cast<void*
>( &pair.second ) );
2670 [&](
const std::pair<const wxString, LAYER_PRESET>& aPair )
2672 return ( aPair.second.layers == visibleLayers
2673 && aPair.second.renderLayers == visibleObjects
2674 && aPair.second.flipBoard == flipBoard );
2681 bool do_translate = it->second.readOnly;
2682 wxString
text = do_translate ? wxGetTranslation( it->first ) : it->first;
2702 wxString ui_label = aName;
2704 for( std::pair<const wxString, LAYER_PRESET>& pair :
m_layerPresets )
2706 if( pair.first != aName )
2709 if( pair.second.readOnly ==
true )
2710 ui_label = wxGetTranslation( aName );
2734 auto resetSelection =
2743 if( index == count - 3 )
2749 else if( index == count - 2 )
2757 wxTextEntryDialog dlg( wxGetTopLevelParent(
this ),
_(
"Layer preset name:" ),
2758 _(
"Save Layer Preset" ),
name );
2760 if( dlg.ShowModal() != wxID_OK )
2766 name = dlg.GetValue();
2783 wxMessageBox(
_(
"Default presets cannot be modified.\nPlease use a different name." ),
2784 _(
"Error" ), wxOK | wxICON_ERROR, wxGetTopLevelParent(
this ) );
2791 if( !
IsOK( wxGetTopLevelParent(
this ),
_(
"Overwrite existing preset?" ) ) )
2811 else if( index == count - 1 )
2814 wxArrayString headers;
2815 std::vector<wxArrayString> items;
2817 headers.Add(
_(
"Presets" ) );
2819 for( std::pair<const wxString, LAYER_PRESET>& pair :
m_layerPresets )
2821 if( !pair.second.readOnly )
2824 item.Add( pair.first );
2825 items.emplace_back( item );
2837 if( idx != wxNOT_FOUND )
2905 activeLayer = *aPreset.
layers.
Seq().begin();
2935 for( std::pair<const wxString, VIEWPORT>& pair :
m_viewports )
2936 m_cbViewports->Append( pair.first,
static_cast<void*
>( &pair.second ) );
2969 if( index >= 0 && index < count - 3 )
2973 wxCHECK( viewport, );
2977 if( !viewport->
name.IsEmpty() )
2983 else if( index == count - 2 )
2988 wxTextEntryDialog dlg( wxGetTopLevelParent(
this ),
2989 _(
"Viewport name:" ),
_(
"Save Viewport" ),
name );
2991 if( dlg.ShowModal() != wxID_OK )
3001 name = dlg.GetValue();
3022 else if( index == count - 1 )
3025 wxArrayString headers;
3026 std::vector<wxArrayString> items;
3028 headers.Add(
_(
"Viewports" ) );
3030 for( std::pair<const wxString, VIEWPORT>& pair :
m_viewports )
3033 item.Add( pair.first );
3034 items.emplace_back( item );
3045 if( idx != wxNOT_FOUND )
3076 int layer = swatch->GetId();
3132 wxASSERT(
m_netsGrid->GetSelectedRows().size() == 1 );
3139 switch( aEvent.GetId() )
3186 bool show = aEvent.GetInt();
3198 if( net->GetNetClass()->ContainsNetclassWithName( aClassName ) )
3202 net->GetNetCode() );
3232 std::shared_ptr<NETCLASS> nc = netSettings->GetNetClassByName( netclassName );
3235 netSettings->RecomputeEffectiveNetclasses();
3246 int classId = s->GetId();
3292 editframe->OnDisplayOptionsChanged();
3293 editframe->GetCanvas()->RedrawRatsnest();
3294 editframe->GetCanvas()->Refresh();
3313 setting = it->second;
3315 auto runOnNetsOfClass =
3316 [&](
const wxString& netClassName, std::function<
void(
NETINFO_ITEM* )> aFunction )
3320 if( net->GetNetClass()->ContainsNetclassWithName( netClassName ) )
3325 switch( aEvent.GetId() )
3335 if(
color != COLOR4D::UNSPECIFIED )
3338 netSettings->RecomputeEffectiveNetclasses();
3354 ->SetPcbColor( COLOR4D::UNSPECIFIED );
3355 netSettings->RecomputeEffectiveNetclasses();
3367 std::shared_ptr<NETCLASS> nc =
3374 netSettings->RecomputeEffectiveNetclasses();
3389 static bool first =
true;
3437 for(
const auto& [
name, netclass] : netSettings->GetNetclasses() )
3455 for(
const auto& [
name, netclass] : netSettings->GetNetclasses() )
3489 wxHyperlinkCtrl* button =
new wxHyperlinkCtrl( infobar, wxID_ANY,
_(
"Open Preferences" ),
3492 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<
void( wxHyperlinkEvent& aEvent )>(
3493 [&]( wxHyperlinkEvent& aEvent )
3502 infobar->
ShowMessageFor(
_(
"The current color theme is read-only. Create a new theme in "
3503 "Preferences to enable color editing." ),
3504 10000, wxICON_INFORMATION );
static std::set< int > s_allowedInFpEditor
These GAL layers are shown in the Objects tab in the footprint editor.
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
HIGH_CONTRAST_MODE
Determine how inactive layers should be displayed.
static TOOL_ACTION highContrastModeCycle
Class APPEARANCE_CONTROLS_BASE.
wxPanel * m_panelNetsAndClasses
wxBoxSizer * m_sizerOuter
wxBoxSizer * m_netsTabOuterSizer
wxStaticText * m_staticTextNetClasses
wxChoice * m_cbLayerPresets
wxBoxSizer * m_netclassOuterSizer
wxScrolledCanvas * m_windowLayers
wxStaticText * m_viewportsLabel
BITMAP_BUTTON * m_btnConfigureNetClasses
wxBoxSizer * m_panelLayersSizer
wxTextCtrl * m_txtNetFilter
BITMAP_BUTTON * m_btnNetInspector
wxScrolledCanvas * m_windowObjects
wxScrolledWindow * m_netclassScrolledWindow
wxStaticText * m_staticTextNets
wxStaticText * m_presetsLabel
void OnBoardNetSettingsChanged(BOARD &aBoard) override
void doApplyLayerPreset(const LAYER_PRESET &aPreset)
std::map< PCB_LAYER_ID, APPEARANCE_SETTING * > m_layerSettingsMap
wxArrayString m_presetMRU
wxStaticText * m_inactiveLayersLabel
void syncColorsAndVisibility()
std::map< GAL_LAYER_ID, APPEARANCE_SETTING * > m_objectSettingsMap
void ApplyLayerPreset(const wxString &aPresetName)
static LAYER_PRESET m_lastBuiltinPreset
wxRadioButton * m_rbHighContrastNormal
void onObjectVisibilityChanged(GAL_LAYER_ID aLayer, bool isVisible, bool isFinal)
static LAYER_PRESET presetFrontAssembly
void OnBoardItemAdded(BOARD &aBoard, BOARD_ITEM *aItem) override
void syncLayerPresetSelection()
static LAYER_PRESET presetBackAssembly
void OnNetGridClick(wxGridEvent &event) override
void setVisibleObjects(GAL_SET aObjects)
wxRadioButton * m_rbRatsnestNone
WX_COLLAPSIBLE_PANE * m_paneLayerDisplayOptions
void buildNetClassMenu(wxMenu &aMenu, bool isDefaultClass, const wxString &aName)
void onLayerVisibilityToggled(PCB_LAYER_ID aLayer)
void onLayerPresetChanged(wxCommandEvent &aEvent) override
void OnBoardItemRemoved(BOARD &aBoard, BOARD_ITEM *aItem) override
wxMenu * m_layerContextMenu
wxRadioButton * m_rbRatsnestVisLayers
@ ID_PRESET_FRONT_ASSEMBLY
@ ID_SHOW_ALL_COPPER_LAYERS
@ ID_HIDE_ALL_COPPER_LAYERS
@ ID_USE_SCHEMATIC_NET_COLOR
@ ID_PRESET_BACK_ASSEMBLY
wxRadioButton * m_rbNetColorAll
bool doesBoardItemNeedRebuild(BOARD_ITEM *aBoardItem)
wxCheckBox * m_cbFlipBoard
void SetUserLayerPresets(std::vector< LAYER_PRESET > &aPresetList)
std::vector< LAYER_PRESET > GetUserLayerPresets() const
Update the current layer presets from those saved in the project file.
static LAYER_PRESET presetInnerCopper
void updateViewportSelection(const wxString &aName)
std::map< wxString, VIEWPORT > m_viewports
void onViewportChanged(wxCommandEvent &aEvent) override
NET_GRID_TABLE * m_netsTable
std::vector< std::unique_ptr< APPEARANCE_SETTING > > m_layerSettings
void loadDefaultLayerPresets()
std::vector< std::unique_ptr< APPEARANCE_SETTING > > m_objectSettings
void onObjectOpacitySlider(int aLayer, float aOpacity)
void setVisibleLayers(const LSET &aLayers)
void rebuildViewportsWidget()
wxRadioButton * m_rbRatsnestAllLayers
wxBoxSizer * m_objectsOuterSizer
wxSize GetBestSize() const
Update the panel contents from the application and board models.
LAYER_PRESET * m_lastSelectedUserPreset
wxString m_contextMenuNetclass
The name of the netclass that was right-clicked.
wxRadioButton * m_rbNetColorRatsnest
void onRatsnestMode(wxCommandEvent &aEvent)
wxRadioButton * m_rbNetColorOff
static LAYER_PRESET presetFront
void doApplyViewport(const VIEWPORT &aViewport)
static const APPEARANCE_SETTING s_objectSettings[]
Template for object appearance settings.
void OnNetGridMouseEvent(wxMouseEvent &aEvent)
WX_COLLAPSIBLE_PANE * m_paneNetDisplayOptions
void OnNotebookPageChanged(wxNotebookEvent &event) override
int GetTabIndex() const
Set the current notebook tab.
bool IsLayerOptionsExpanded()
void onNetclassVisibilityChanged(wxCommandEvent &aEvent)
void OnBoardItemsRemoved(BOARD &aBoard, std::vector< BOARD_ITEM * > &aItems) override
void onNetContextMenu(wxCommandEvent &aEvent)
void OnColorSwatchChanged(wxCommandEvent &aEvent)
void updateLayerPresetSelection(const wxString &aName)
ROW_ICON_PROVIDER * m_iconProvider
std::map< wxString, LAYER_PRESET > m_layerPresets
bool IsTogglingNetclassRatsnestVisibility()
static LAYER_PRESET presetBack
void rebuildLayerContextMenu()
void RefreshCollapsiblePanes()
Function to force a redraw of the collapsible panes in this control.
static LAYER_PRESET presetNoLayers
void idleFocusHandler(wxIdleEvent &aEvent)
void rightClickHandler(wxMouseEvent &aEvent)
void OnNetGridRightClick(wxGridEvent &event) override
void OnBoardItemsChanged(BOARD &aBoard, std::vector< BOARD_ITEM * > &aItems) override
wxBoxSizer * m_layersOuterSizer
void UpdateDisplayOptions()
Return a list of the layer presets created by the user.
std::vector< std::unique_ptr< APPEARANCE_SETTING > > m_netclassSettings
wxRadioButton * m_rbHighContrastOff
void OnBoardCompositeUpdate(BOARD &aBoard, std::vector< BOARD_ITEM * > &aAddedItems, std::vector< BOARD_ITEM * > &aRemovedItems, std::vector< BOARD_ITEM * > &aChangedItems) override
Update the colors on all the widgets from the new chosen color theme.
void OnBoardItemsAdded(BOARD &aBoard, std::vector< BOARD_ITEM * > &aItems) override
void OnColorThemeChanged()
Respond to change in OS's DarkMode.
LAYER_PRESET * m_currentPreset
std::map< wxString, APPEARANCE_SETTING * > m_netclassSettingsMap
GAL_SET getVisibleObjects()
void OnSetFocus(wxFocusEvent &aEvent) override
void OnLanguageChanged(wxCommandEvent &aEvent)
static LAYER_PRESET presetAllCopper
void SetUserViewports(std::vector< VIEWPORT > &aPresetList)
void handleBoardItemsChanged()
wxRadioButton * m_rbHighContrastDim
void OnSize(wxSizeEvent &aEvent) override
wxString netclassNameFromEvent(wxEvent &aEvent)
wxGridCellCoords m_hoveredCell
Grid cell that is being hovered over, for tooltips.
void showNetclass(const wxString &aClassName, bool aShow=true)
wxStaticText * m_txtRatsnestVisibility
void rebuildLayerPresetsWidget()
void onLayerLeftClick(wxMouseEvent &aEvent)
std::vector< VIEWPORT > GetUserViewports() const
Update the current viewports from those saved in the project file.
VIEWPORT * m_lastSelectedViewport
wxArrayString m_viewportMRU
void SetTabIndex(int aTab)
wxColour m_layerPanelColour
std::map< int, wxString > m_netclassIdMap
Stores wxIDs for each netclass for control event mapping.
void OnLayerContextMenu(wxCommandEvent &aEvent)
Return the index of the current tab (0-2).
void onNetColorMode(wxCommandEvent &aEvent)
void OnNetVisibilityChanged(int aNetCode, bool aVisibility)
Notifies the panel when a net has been hidden or shown via the external tool.
bool IsNetOptionsExpanded()
void OnDarkModeToggle()
Update the widget when the active board layer is changed.
static LAYER_PRESET presetAllLayers
bool m_togglingNetclassRatsnestVisibility
void onNetclassContextMenu(wxCommandEvent &aEvent)
wxStaticText * m_txtNetDisplayTitle
wxStaticLine * m_layerDisplaySeparator
void syncObjectSettings()
APPEARANCE_CONTROLS(PCB_BASE_FRAME *aParent, wxWindow *aFocusOwner, bool aFpEditor=false)
void SetObjectVisible(GAL_LAYER_ID aLayer, bool isVisible=true)
void OnNetGridDoubleClick(wxGridEvent &event) override
void SetLayerVisible(int aLayer, bool isVisible)
void OnBoardItemChanged(BOARD &aBoard, BOARD_ITEM *aItem) override
void onNetclassColorChanged(wxCommandEvent &aEvent)
void ApplyViewport(const wxString &aPresetName)
GRID_BITMAP_TOGGLE_RENDERER * m_toggleGridRenderer
BASE_SET & set(size_t pos)
A checkbox control except with custom bitmaps for the checked and unchecked states.
void SetValue(bool aValue)
Set the checkbox state.
std::shared_ptr< NET_SETTINGS > m_NetSettings
std::map< std::string, wxString > m_UserLayerNames
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Information pertinent to a Pcbnew printed circuit board.
const NETINFO_LIST & GetNetInfo() const
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
void SetVisibleLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
void AddListener(BOARD_LISTENER *aListener)
Add a listener to the board to receive calls whenever something on the board has been modified.
GAL_SET GetVisibleElements() const
Return a set of all the element categories that are visible.
void SetHighLightNet(int aNetCode, bool aMulti=false)
Select the netcode to be highlighted.
int GetCopperLayerCount() const
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Change the visibility of an element category.
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
PROJECT * GetProject() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
void SetVisibleElements(const GAL_SET &aMask)
A proxy function that calls the correspondent function in m_BoardSettings.
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)
COLOR4D GetColor(int aLayer) const
COLOR4D GetDefaultColor(int aLayer)
A simple color swatch of the kind used to set layer colors.
void SetSwatchColor(const KIGFX::COLOR4D &aColor, bool aSendEvent)
Set the current swatch color directly.
void GetNewSwatchColor()
Prompt for a new colour, using the colour picker dialog.
KIGFX::COLOR4D GetSwatchColor() const
void SetReadOnlyCallback(std::function< void()> aCallback)
Register a handler for when the user tries to interact with a read-only swatch.
void SetReadOnly(bool aReadOnly=true)
Class to handle configuration and automatic determination of the DPI scale to use for canvases.
double GetScaleFactor() const override
Get the DPI scale from all known sources in order:
SETTINGS_MANAGER * GetSettingsManager() const
void ShowPreferences(wxString aStartPage, wxString aStartParentPage)
Display the preferences and settings of all opened editors paged dialog, starting with a particular p...
bool IsType(FRAME_T aType) const
WX_INFOBAR * GetInfoBar()
virtual void SetGridVisibility(bool aVisible)
bool IsGridVisible() const
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
KICAD_T Type() const
Returns the type of object.
wxString GetTextSelection(int aColumn=0)
Return the selected text from aColumn in the wxListCtrl in the dialog.
void SetListLabel(const wxString &aLabel)
Helper for storing and iterating over GAL_LAYER_IDs.
bool Contains(GAL_LAYER_ID aPos)
static GAL_SET DefaultVisible()
A toggle button renderer for a wxGrid, similar to BITMAP_TOGGLE.
A text renderer that can unescape text for display This is useful where it's desired to keep the unde...
Represent a row indicator icon for use in places like the layer widget.
void SetIndicatorState(ICON_ID aIconId)
Set the row indicator to the given state.
A color representation with 4 components: red, green, blue, alpha.
bool SetFromWxString(const wxString &aColorString)
Set color values by parsing a string using wxColour::Set().
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
PCB specific render settings.
std::set< int > & GetHiddenNets()
std::map< int, KIGFX::COLOR4D > & GetNetColorMap()
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aMulti=false)
Turns on/off highlighting.
An abstract base class for deriving all objects that can be added to a VIEW.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
void SetMirror(bool aMirrorX, bool aMirrorY)
Control the mirroring of the VIEW.
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
void SetViewport(const BOX2D &aViewport)
Set the visible area of the VIEW.
void UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
bool IsMirroredX() const
Return true if view is flipped across the X axis.
void RecacheAllItems()
Rebuild GAL display lists.
bool IsMirroredY() const
Return true if view is flipped across the Y axis.
void UpdateLayerColor(int aLayer)
Apply the new coloring scheme held by RENDER_SETTINGS in case that it has changed.
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
void UpdateAllItemsConditionally(int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
Update items in the view according to the given flags and condition.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
LSET is a set of PCB_LAYER_IDs.
static LSET AllLayersMask()
LSEQ CuStack() const
Return a sequence of copper layers in starting from the front/top and extending to the back/bottom.
static LSET FrontAssembly()
Return a complete set of all top assembly layers which is all F_SilkS and F_Mask.
static LSET InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static LSET ForbiddenFootprintLayers()
Layers which are not allowed within footprint definitions.
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
static LSET BackAssembly()
Return a complete set of all bottom assembly layers which is all B_SilkS and B_Mask.
static LSET FrontMask()
Return a mask holding all technical layers and the external CU layer on front side.
static LSET BackMask()
Return a mask holding all technical layers and the external CU layer on back side.
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
bool Contains(PCB_LAYER_ID aLayer) const
See if the layer set contains a PCB layer.
static const char Default[]
the name of the default NETCLASS
Handle the data for a net.
const NETNAMES_MAP & NetsByName() const
Return the name map, at least for python.
void SetValue(int aRow, int aCol, const wxString &aValue) override
void SetValueAsCustom(int aRow, int aCol, const wxString &aTypeName, void *aValue) override
std::vector< NET_GRID_ENTRY > m_nets
void updateNetColor(const NET_GRID_ENTRY &aNet)
NET_GRID_ENTRY & GetEntry(int aRow)
void SetValueAsBool(int aRow, int aCol, bool aValue) override
void * GetValueAsCustom(int aRow, int aCol, const wxString &aTypeName) override
NET_GRID_TABLE(PCB_BASE_FRAME *aFrame, wxColor aBackgroundColor)
void updateNetVisibility(const NET_GRID_ENTRY &aNet)
wxString GetValue(int aRow, int aCol) override
wxGridCellAttr * m_labelAttr
void HideOtherNets(const NET_GRID_ENTRY &aNet)
wxGridCellAttr * m_defaultAttr
bool GetValueAsBool(int aRow, int aCol) override
wxGridCellAttr * GetAttr(int aRow, int aCol, wxGridCellAttr::wxAttrKind) override
static void * ColorToVoid(COLOR4D &aColor)
int GetRowByNetcode(int aCode) const
wxString GetTypeName(int aRow, int aCol) override
static COLOR4D VoidToColor(void *aColor)
DISPLAY_OPTIONS m_Display
static TOOL_ACTION highlightNet
static TOOL_ACTION hideNetInRatsnest
static TOOL_ACTION showNetInRatsnest
static TOOL_ACTION showNetInspector
static TOOL_ACTION ratsnestModeCycle
static TOOL_ACTION netColorModeCycle
static TOOL_ACTION selectNet
Select all connections belonging to a single net.
static TOOL_ACTION flipBoard
static TOOL_ACTION deselectNet
Remove all connections belonging to a single net from the active selection.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
virtual void OnDisplayOptionsChanged()
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
virtual PCB_LAYER_ID GetActiveLayer() const
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SetDrawBgColor(const COLOR4D &aColor) override
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions, bool aRefresh=true)
Update the current display options.
virtual void SetActiveLayer(PCB_LAYER_ID aLayer)
virtual COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
double m_TrackOpacity
Opacity override for all tracks.
double m_FilledShapeOpacity
Opacity override for graphic shapes.
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.
HIGH_CONTRAST_MODE m_ContrastModeDisplay
How inactive layers are displayed.
NET_COLOR_MODE m_NetColorMode
How to use color overrides on specific nets and netclasses.
void UpdateColors()
Update the color settings in the painter and GAL.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void SyncLayersVisibility(const BOARD *aBoard)
Update "visibility" property of each layer of a given BOARD.
void RedrawRatsnest()
Return the bounding box of the view that should be used if model is not valid.
The main frame for Pcbnew.
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...
virtual SETTINGS_MANAGER & GetSettingsManager() const
The project local settings are things that are attached to a particular project, but also might be pa...
std::set< wxString > m_HiddenNetclasses
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
Icon provider for the "standard" row indicators, for example in layer selection lists.
@ OFF
Row "off" or "deselected".
@ ON
Row "on" or "selected".
void SaveColorSettings(COLOR_SETTINGS *aSettings, const std::string &aNamespace="")
Safely save a COLOR_SETTINGS to disk, preserving any changes outside the given namespace.
T * GetAppSettings(const wxString &aFilename)
Return a handle to the a given settings by type.
A better wxCollapsiblePane that.
void Collapse(bool aCollapse=true)
void SetLabel(const wxString &aLabel) override
bool SetBackgroundColour(const wxColour &aColor) override
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...
void SetColLabelSize(int aHeight)
Hide wxGrid's SetColLabelSize() method with one which makes sure the size is tall enough for the syst...
A modified version of the wxInfoBar class that allows us to:
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
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.
void AddButton(wxButton *aButton)
Add an already created button to the infobar.
void AddCloseButton(const wxString &aTooltip=_("Hide this message."))
Add the default close button to the infobar on the right side.
void SetBorders(bool aLeft, bool aRight, bool aTop, bool aBottom)
static const wxSize SWATCH_SIZE_SMALL_DU(8, 6)
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
This file is part of the common library.
#define VIEWPORT_SWITCH_KEY
#define PRESET_SWITCH_KEY
wxString KeyNameFromKeyCode(int aKeycode, bool *aIsFound)
Return the key name from the key code.
GAL_LAYER_ID ToGalLayer(int aInteger)
int GetNetnameLayer(int aLayer)
Return a netname layer corresponding to the given layer.
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
@ LAYER_LOCKED_ITEM_SHADOW
Shadow layer for locked items.
@ LAYER_CONFLICTS_SHADOW
Shadow layer for items flagged conflicting.
@ LAYER_FOOTPRINTS_FR
Show footprints on front.
@ LAYER_DRAWINGSHEET
Sheet frame and title block.
@ LAYER_DRAW_BITMAPS
Draw images.
@ LAYER_FP_REFERENCES
Show footprints references (when texts are visible).
@ LAYER_DRC_EXCLUSION
Layer for DRC markers which have been individually excluded.
@ LAYER_PCB_BACKGROUND
PCB background color.
@ LAYER_ZONES
Control for copper zone opacity/visibility (color ignored).
@ LAYER_SHAPES
Copper graphic shape opacity/visibility (color ignored).
@ LAYER_PADS
Meta control for all pads opacity/visibility (color ignored).
@ LAYER_DRC_WARNING
Layer for DRC markers with #SEVERITY_WARNING.
@ LAYER_ZONE_START
Virtual layers for stacking zones and tracks on a given copper layer.
@ LAYER_FOOTPRINTS_BK
Show footprints on back.
@ LAYER_ANCHOR
Anchor of items having an anchor point (texts, footprints).
@ LAYER_FP_VALUES
Show footprints values (when texts are visible).
@ LAYER_DRC_ERROR
Layer for DRC markers with #SEVERITY_ERROR.
@ LAYER_VIAS
Meta control for all vias opacity/visibility.
#define CLEARANCE_LAYER_FOR(boardLayer)
#define VIA_COPPER_LAYER_FOR(boardLayer)
PCB_LAYER_ID
A quick note on layer IDs:
#define ZONE_LAYER_FOR(boardLayer)
#define PAD_COPPER_LAYER_FOR(boardLayer)
#define GAL_LAYER_INDEX(x)
Use this macro to convert a #GAL layer to a 0-indexed offset from LAYER_VIAS.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
@ ALL
All except INITIAL_ADD.
@ TARGET_NONCACHED
Auxiliary rendering target (noncached)
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
KICOMMON_API wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmapBundle &aImage, wxItemKind aType=wxITEM_NORMAL)
Create and insert a menu item with an icon into aMenu.
const int c_IndicatorSizeDIP
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
PGM_BASE & Pgm()
The global program "get" accessor.
std::vector< FAB_LAYER_COLOR > dummy
wxString UnescapeString(const wxString &aSource)
Container for an appearance setting (can control a single board layer, or GAL layer,...
bool can_control_visibility
BITMAP_TOGGLE * ctl_visibility
INDICATOR_ICON * ctl_indicator
A saved set of layers that are visible.
GAL_SET renderLayers
Render layers (e.g. object types) that are visible.
wxString name
A name for this layer set.
bool flipBoard
True if the flip board is enabled.
LSET layers
Board layers that are visible.
bool readOnly
True if this is a read-only (built-in) preset.
PCB_LAYER_ID activeLayer
Optional layer to set active when this preset is loaded.
bool appearance_expand_layer_display
bool appearance_expand_net_display
RATSNEST_MODE m_RatsnestMode
bool m_ShowGlobalRatsnest
@ PCB_NETINFO_T
class NETINFO_ITEM, a description of a net