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 );
232 int deleted = (int)
m_nets.size();
237 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, 0, deleted );
238 GetView()->ProcessTableMessage( msg );
241 for(
const std::pair<const wxString, NETINFO_ITEM*>& pair : nets )
243 int netCode = pair.second->GetNetCode();
245 if( netCode > 0 && !pair.first.StartsWith( wxT(
"unconnected-(" ) ) )
247 COLOR4D color = netColors.count( netCode ) ? netColors.at( netCode )
250 bool visible = hiddenNets.count( netCode ) == 0;
260 return a.name < b.name;
265 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, (
int)
m_nets.size() );
266 GetView()->ProcessTableMessage( msg );
280 GetView()->ForceRefresh();
288 net.visible = ( net.code == aNet.
code );
293 GetView()->ForceRefresh();
302 m_frame->GetToolManager()->RunAction( action, aNet.
code );
311 std::map<int, KIGFX::COLOR4D>& netColors = renderSettings->
GetNetColorMap();
316 netColors.erase( aNet.
code );
318 m_frame->GetCanvas()->GetView()->UpdateAllLayersColor();
319 m_frame->GetCanvas()->RedrawRatsnest();
320 m_frame->GetCanvas()->Refresh();
327#define RR APPEARANCE_CONTROLS::APPEARANCE_SETTING
418 SetMinSize( FromDIP( GetMinSize() ) );
425 int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
427 m_pointSize = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ).GetPointSize();
450 m_cbLayerPresets->SetToolTip( wxString::Format(
_(
"Save and restore layer visibility combinations.\n"
451 "Use %s+Tab to activate selector.\n"
452 "Successive Tabs while holding %s down will "
453 "cycle through presets in the popup." ),
457 m_cbViewports->SetToolTip( wxString::Format(
_(
"Save and restore view location and zoom.\n"
458 "Use %s+Tab to activate selector.\n"
459 "Successive Tabs while holding %s down will "
460 "cycle through viewports in the popup." ),
484 auto setHighContrastMode =
490 m_frame->SetDisplayOptions( opts );
495 [=]( wxCommandEvent& aEvent )
501 [=]( wxCommandEvent& aEvent )
507 [=]( wxCommandEvent& aEvent )
515 [&]( wxCommandEvent& aEvent )
521 [&]( wxCommandEvent& aEvent )
525 editframe->ShowBoardSetupDialog(
_(
"Net Classes" ) );
532 [&]( wxCommandEvent& aEvent )
543 m_netsGrid->RegisterDataType( wxT(
"COLOR4D" ),
551 m_netsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
555 const int cellPadding = 6;
557 const int rowHeightPadding = 5;
559 const int rowHeightPadding = 3;
569 m_netsGrid->SetDefaultRowSize( font.GetPixelSize().y + rowHeightPadding );
576 m_netsGrid->ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_DEFAULT );
584 if( cfg->m_AuiPanels.appearance_expand_layer_display )
587 if( cfg->m_AuiPanels.appearance_expand_net_display )
622 _(
"Layer Display Options" ) );
628 wxBoxSizer* layerDisplayOptionsSizer;
629 layerDisplayOptionsSizer =
new wxBoxSizer( wxVERTICAL );
636 msg =
_(
"Inactive layers:" );
643 wxBoxSizer* contrastModeSizer;
644 contrastModeSizer =
new wxBoxSizer( wxHORIZONTAL );
647 wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
653 contrastModeSizer->AddStretchSpacer();
660 contrastModeSizer->AddStretchSpacer();
667 contrastModeSizer->AddStretchSpacer();
669 layerDisplayOptionsSizer->Add( contrastModeSizer, 0, wxEXPAND, 5 );
672 wxDefaultSize, wxLI_HORIZONTAL );
675 m_cbFlipBoard =
new wxCheckBox( layerDisplayPane, wxID_ANY,
_(
"Flip board view" ) );
677 layerDisplayOptionsSizer->Add(
m_cbFlipBoard, 0, wxTOP | wxBOTTOM, 3 );
679 layerDisplayPane->SetSizer( layerDisplayOptionsSizer );
680 layerDisplayPane->Layout();
681 layerDisplayOptionsSizer->Fit( layerDisplayPane );
686 [&]( wxCommandEvent& aEvent )
697 _(
"Net Display Options" ) );
702 wxBoxSizer* netDisplayOptionsSizer =
new wxBoxSizer( wxVERTICAL );
711 msg =
_(
"Net colors:" );
720 wxBoxSizer* netColorSizer =
new wxBoxSizer( wxHORIZONTAL );
722 m_rbNetColorAll =
new wxRadioButton( netDisplayPane, wxID_ANY,
_(
"All" ), wxDefaultPosition,
723 wxDefaultSize, wxRB_GROUP );
725 m_rbNetColorAll->SetToolTip(
_(
"Net and netclass colors are shown on all copper items" ) );
728 netColorSizer->AddStretchSpacer();
736 netColorSizer->AddStretchSpacer();
738 m_rbNetColorOff =
new wxRadioButton( netDisplayPane, wxID_ANY,
_(
"None" ) );
740 m_rbNetColorOff->SetToolTip(
_(
"Net and netclass colors are not shown" ) );
744 netDisplayOptionsSizer->Add( netColorSizer, 0, wxEXPAND | wxBOTTOM, 5 );
753 msg =
_(
"Ratsnest display:" );
762 wxBoxSizer* ratsnestDisplayModeSizer =
new wxBoxSizer( wxHORIZONTAL );
765 wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
771 ratsnestDisplayModeSizer->AddStretchSpacer();
778 ratsnestDisplayModeSizer->AddStretchSpacer();
786 netDisplayOptionsSizer->Add( ratsnestDisplayModeSizer, 0, wxEXPAND | wxBOTTOM, 5 );
790 netDisplayPane->SetSizer( netDisplayOptionsSizer );
791 netDisplayPane->Layout();
792 netDisplayOptionsSizer->Fit( netDisplayPane );
797 [&]( wxCommandEvent& aEvent )
840 int page = aEvent.GetSelection();
843 m_notebook->ChangeSelection(
static_cast<unsigned>( page ) );
872 if( wxBitmapButton* btn =
dynamic_cast<wxBitmapButton*
>( aEvent.GetEventObject() ) )
874 wxCommandEvent evt( wxEVT_BUTTON );
875 wxPostEvent( btn, evt );
892 int row =
event.GetRow();
893 int col =
event.GetCol();
910 int row =
event.GetRow();
911 int col =
event.GetCol();
933 menu.Append(
new wxMenuItem( &menu,
ID_SET_NET_COLOR,
_(
"Set Net Color" ), wxEmptyString,
935 menu.Append(
new wxMenuItem( &menu,
ID_CLEAR_NET_COLOR,
_(
"Clear Net Color" ), wxEmptyString,
938 menu.AppendSeparator();
941 wxString::Format(
_(
"Highlight %s" ), netName ), wxEmptyString,
944 wxString::Format(
_(
"Select Tracks and Vias in %s" ), netName ),
945 wxEmptyString, wxITEM_NORMAL ) );
947 wxString::Format(
_(
"Unselect Tracks and Vias in %s" ), netName ),
948 wxEmptyString, wxITEM_NORMAL ) );
950 menu.AppendSeparator();
952 menu.Append(
new wxMenuItem( &menu,
ID_SHOW_ALL_NETS,
_(
"Show All Nets" ), wxEmptyString,
955 wxEmptyString, wxITEM_NORMAL ) );
965 wxPoint pos =
m_netsGrid->CalcUnscrolledPosition( aEvent.GetPosition() );
966 wxGridCellCoords cell =
m_netsGrid->XYToCell( pos );
968 if( aEvent.Moving() || aEvent.Entering() )
986 wxString showOrHide = net.
visible ?
_(
"Click to hide ratsnest for %s" )
987 :
_(
"Click to show ratsnest for %s" );
991 tip.Printf( showOrHide,
name );
993 tip =
_(
"Double click (or middle click) to change color; right click for more actions" );
995 m_netsGrid->GetGridWindow()->SetToolTip( tip );
997 else if( aEvent.Leaving() )
1002 else if( aEvent.Dragging() )
1010 else if( aEvent.ButtonUp( wxMOUSE_BTN_MIDDLE ) && !!cell )
1012 int row = cell.GetRow();
1013 int col = cell.GetCol();
1095 int row =
m_netsTable->GetRowByNetcode( aNetCode );
1113 bool rebuild = std::any_of( aBoardItems.begin(), aBoardItems.end(),
1116 return a->Type() == PCB_NETINFO_T;
1166 std::vector<BOARD_ITEM*>& aAddedItems,
1167 std::vector<BOARD_ITEM*>& aRemovedItems,
1168 std::vector<BOARD_ITEM*>& aChangedItems )
1210 if( child && child->GetWindow() )
1215 m_netsGrid->RegisterDataType( wxT(
"COLOR4D" ),
1221 if( pair.second->ctl_color )
1222 pair.second->ctl_color->OnDarkModeToggle();
1231 for(
const std::unique_ptr<APPEARANCE_SETTING>& setting :
m_layerSettings )
1241 if( r < 240 || g < 240 || b < 240 )
1243 r = wxChar( std::min( (
int) r + 15, 255 ) );
1244 g = wxChar( std::min( (
int) g + 15, 255 ) );
1245 b = wxChar( std::min( (
int) b + 15, 255 ) );
1249 r = wxChar( std::max( (
int) r - 15, 0 ) );
1250 g = wxChar( std::max( (
int) g - 15, 0 ) );
1251 b = wxChar( std::max( (
int) b - 15, 0 ) );
1264 newSetting->
ctl_panel->SetBackgroundColour( wxColour( r, g, b ) );
1276 if( visible.test( layer ) == isVisible )
1279 visible.
set( layer, isVisible );
1282 m_frame->GetCanvas()->GetView()->SetLayerVisible( layer, isVisible );
1298 m_frame->GetBoard()->SetElementVisibility( aLayer, isVisible );
1300 m_frame->Update3DView(
true,
m_frame->GetPcbNewSettings()->m_Display.m_Live3DRefresh );
1302 m_frame->GetCanvas()->GetView()->SetLayerVisible( aLayer, isVisible );
1303 m_frame->GetCanvas()->Refresh();
1318 m_frame->GetBoard()->SetVisibleLayers( aLayers );
1328 return dynamic_cast<PCB_VIA*
>( aItem ) ||
dynamic_cast<PAD*
>( aItem );
1331 m_frame->Update3DView(
true,
m_frame->GetPcbNewSettings()->m_Display.m_Live3DRefresh );
1362 m_frame->GetBoard()->SetVisibleElements( aLayers );
1364 m_frame->Update3DView(
true,
m_frame->GetPcbNewSettings()->m_Display.m_Live3DRefresh );
1383 return m_frame->GetBoard()->GetVisibleLayers();
1396 for(
size_t i = 0; i < set.size(); i++ )
1403 return m_frame->GetBoard()->GetVisibleElements();
1432 if( !cfg->m_Display.m_ShowGlobalRatsnest )
1449 std::vector<LAYER_PRESET> ret;
1451 for(
const std::pair<const wxString, LAYER_PRESET>& pair :
m_layerPresets )
1453 if( !pair.second.readOnly )
1454 ret.emplace_back( pair.second );
1504 wxCommandEvent
dummy;
1526 std::vector<VIEWPORT> ret;
1528 for(
const std::pair<const wxString, VIEWPORT>& pair :
m_viewports )
1529 ret.emplace_back( pair.second );
1539 for(
const VIEWPORT& viewport : aViewportList )
1557 wxCommandEvent
dummy;
1583 m_windowLayersSizerItem->SetFlag( m_windowLayersSizerItem->GetFlag() & ~wxTOP );
1587 [&]( std::unique_ptr<APPEARANCE_SETTING>& aSetting )
1589 int layer = aSetting->id;
1592 wxBoxSizer* sizer =
new wxBoxSizer( wxHORIZONTAL );
1593 panel->SetSizer( sizer );
1597 aSetting->visible = visible[layer];
1605 swatch->SetToolTip(
_(
"Double click or middle click for color change, right click for menu" ) );
1610 aSetting->visible );
1611 btn_visible->SetToolTip(
_(
"Show or hide this layer" ) );
1613 wxStaticText* label =
new wxStaticText( panel, layer, aSetting->label );
1615 label->SetToolTip( aSetting->tooltip );
1617 sizer->AddSpacer( 1 );
1618 sizer->Add( indicator, 0, wxALIGN_CENTER_VERTICAL | wxTOP, 2 );
1619 sizer->AddSpacer( 5 );
1620 sizer->Add( swatch, 0, wxALIGN_CENTER_VERTICAL | wxTOP, 2 );
1621 sizer->AddSpacer( 6 );
1622 sizer->Add( btn_visible, 0, wxALIGN_CENTER_VERTICAL | wxTOP, 2 );
1623 sizer->AddSpacer( 5 );
1624 sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxTOP, 2 );
1628 aSetting->ctl_panel = panel;
1629 aSetting->ctl_indicator = indicator;
1630 aSetting->ctl_visibility = btn_visible;
1631 aSetting->ctl_color = swatch;
1632 aSetting->ctl_text = label;
1639 btn_visible->Bind( TOGGLE_CHANGED,
1640 [&]( wxCommandEvent& aEvent )
1642 wxObject* btn = aEvent.GetEventObject();
1643 int layerId =
static_cast<wxWindow*
>( btn )->GetId();
1660 [&]( std::unique_ptr<APPEARANCE_SETTING>& aSetting )
1662 int layer = aSetting->id;
1663 aSetting->visible = visible[layer];
1664 aSetting->ctl_panel->Show();
1665 aSetting->ctl_panel->SetId( layer );
1666 aSetting->ctl_indicator->SetWindowID( layer );
1667 aSetting->ctl_color->SetWindowID( layer );
1668 aSetting->ctl_color->SetSwatchColor( theme->
GetColor( layer ),
false );
1669 aSetting->ctl_visibility->SetWindowID( layer );
1670 aSetting->ctl_text->SetLabelText( aSetting->label );
1671 aSetting->ctl_text->SetId( layer );
1672 aSetting->ctl_text->SetToolTip( aSetting->tooltip );
1678 static const struct {
1684 {
F_Paste,
_HKI(
"Solder paste on board's front" ) },
1685 {
B_Paste,
_HKI(
"Solder paste on board's back" ) },
1686 {
F_SilkS,
_HKI(
"Silkscreen on board's front" ) },
1687 {
B_SilkS,
_HKI(
"Silkscreen on board's back" ) },
1688 {
F_Mask,
_HKI(
"Solder mask on board's front" ) },
1689 {
B_Mask,
_HKI(
"Solder mask on board's back" ) },
1695 {
Margin,
_HKI(
"Board's edge setback outline" ) },
1696 {
F_CrtYd,
_HKI(
"Footprint courtyards on board's front" ) },
1697 {
B_CrtYd,
_HKI(
"Footprint courtyards on board's back" ) },
1698 {
F_Fab,
_HKI(
"Footprint assembly on board's front" ) },
1699 {
B_Fab,
_HKI(
"Footprint assembly on board's back" ) },
1762 std::size_t total_layers = enabled.
CuStack().size();
1764 for(
const auto& entry : non_cu_seq )
1766 if( enabled[entry.layerId] )
1776 for( std::size_t ii = total_layers; ii <
m_layerSettings.size(); ++ii )
1791 case F_Cu: dsc =
_(
"Front copper layer" );
break;
1792 case B_Cu: dsc =
_(
"Back copper layer" );
break;
1793 default: dsc =
_(
"Inner copper layer" );
break;
1796 std::unique_ptr<APPEARANCE_SETTING>& setting = *layer_it;
1799 setting->id = layer;
1800 setting->tooltip = dsc;
1802 if( setting->ctl_panel ==
nullptr )
1803 appendLayer( setting );
1805 updateLayer( setting );
1811 setting->ctl_text->Disable();
1812 setting->ctl_color->SetToolTip( wxEmptyString );
1818 for(
const auto& entry : non_cu_seq )
1822 if( !enabled[layer] )
1825 std::unique_ptr<APPEARANCE_SETTING>& setting = *layer_it;
1841 setting->id = layer;
1844 setting->tooltip = wxGetTranslation( entry.tooltip );
1846 if( setting->ctl_panel ==
nullptr )
1847 appendLayer( setting );
1849 updateLayer( setting );
1855 setting->ctl_text->Disable();
1856 setting->ctl_color->SetToolTip( wxEmptyString );
1874 msg =
_(
"Inactive layers:" );
1931 if(
m_frame->GetBoard()->GetCopperLayerCount() > 2 )
1956 switch( aEvent.GetId() )
1981 if( !visible.test( current ) && visible.count() > 0 )
1982 m_frame->SetActiveLayer( *visible.
Seq().begin() );
1990 if( !visible.test( current ) && visible.count() > 0 )
1991 m_frame->SetActiveLayer( *visible.
Seq().begin() );
2032 m_frame->GetCanvas()->SyncLayersVisibility( board );
2034 m_frame->GetCanvas()->Refresh();
2048 if( aTab >= 0 &&
static_cast<size_t>( aTab ) < max )
2064 int layer = setting->id;
2066 if( setting->ctl_visibility )
2067 setting->ctl_visibility->SetValue( visible[layer] );
2069 if( setting->ctl_color )
2072 setting->ctl_color->SetSwatchColor(
color,
false );
2073 setting->ctl_color->SetReadOnly( readOnly );
2081 if( setting->ctl_visibility )
2082 setting->ctl_visibility->SetValue( objects.
Contains( layer ) );
2084 if( setting->ctl_color )
2087 setting->ctl_color->SetSwatchColor(
color,
false );
2088 setting->ctl_color->SetReadOnly( readOnly );
2103 wxWindow* eventSource =
static_cast<wxWindow*
>( aEvent.GetEventObject() );
2110 m_frame->SetActiveLayer( layer );
2127 visibleLayers.
set( aLayer, !visibleLayers.test( aLayer ) );
2129 m_frame->GetCanvas()->GetView()->SetLayerVisible( aLayer, visibleLayers.test( aLayer ) );
2132 m_frame->GetCanvas()->Refresh();
2145 m_frame->GetCanvas()->GetView()->SetLayerVisible( aLayer,
true );
2149 m_frame->GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest = isVisible;
2150 m_frame->GetBoard()->SetElementVisibility( aLayer, isVisible );
2151 m_frame->OnDisplayOptionsChanged();
2152 m_frame->GetCanvas()->RedrawRatsnest();
2159 m_frame->SetGridVisibility( isVisible );
2160 m_frame->GetCanvas()->Refresh();
2195 if( visible.
Contains( aLayer ) != isVisible )
2197 visible.
set( aLayer, isVisible );
2199 m_frame->GetCanvas()->GetView()->SetLayerVisible( aLayer, isVisible );
2205 m_frame->GetCanvas()->Refresh();
2216 int swatchWidth =
m_windowObjects->ConvertDialogToPixels( wxSize( 8, 0 ) ).x;
2226 [&](
const std::unique_ptr<APPEARANCE_SETTING>& aSetting )
2228 wxBoxSizer* sizer =
new wxBoxSizer( wxHORIZONTAL );
2229 int layer = aSetting->id;
2239 swatch->SetToolTip(
_(
"Left double click or middle click for color change, "
2240 "right click for menu" ) );
2242 sizer->Add( swatch, 0, wxALIGN_CENTER_VERTICAL, 0 );
2243 aSetting->ctl_color = swatch;
2251 sizer->AddSpacer( swatchWidth );
2257 if( aSetting->can_control_visibility )
2262 aSetting->visible );
2264 tip.Printf(
_(
"Show or hide %s" ), aSetting->label.Lower() );
2265 btn_visible->SetToolTip( tip );
2267 aSetting->ctl_visibility = btn_visible;
2269 btn_visible->Bind( TOGGLE_CHANGED,
2270 [&]( wxCommandEvent& aEvent )
2272 int id =
static_cast<wxWindow*
>( aEvent.GetEventObject() )->GetId();
2273 bool isVisible = aEvent.GetInt();
2278 sizer->AddSpacer( 5 );
2280 wxStaticText* label =
new wxStaticText(
m_windowObjects, layer, aSetting->label );
2282 label->SetToolTip( aSetting->tooltip );
2284 if( aSetting->can_control_opacity )
2286 label->SetMinSize( wxSize( labelWidth, -1 ) );
2289 sizer->Add( btn_visible, 0, wxALIGN_CENTER_VERTICAL | wxBOTTOM, 10 );
2291 sizer->AddSpacer( btnWidth );
2293 sizer->AddSpacer( 5 );
2294 sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL | wxBOTTOM, 10 );
2297 sizer->Add( btn_visible, 0, wxALIGN_CENTER_VERTICAL, 0 );
2299 sizer->AddSpacer( btnWidth );
2301 sizer->AddSpacer( 5 );
2302 sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL, 0 );
2305 wxSlider* slider =
new wxSlider(
m_windowObjects, wxID_ANY, 100, 0, 100,
2306 wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL );
2308 slider->SetMinSize( wxSize( 80, 16 ) );
2310 slider->SetMinSize( wxSize( 80, -1 ) );
2313 tip.Printf(
_(
"Set opacity of %s" ), aSetting->label.Lower() );
2314 slider->SetToolTip( tip );
2316 sizer->Add( slider, 1, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5 );
2317 aSetting->ctl_opacity = slider;
2319 auto opacitySliderHandler =
2320 [
this, layer]( wxCommandEvent& aEvent )
2322 wxSlider* ctrl =
static_cast<wxSlider*
>( aEvent.GetEventObject() );
2323 int value = ctrl->GetValue();
2327 slider->Bind( wxEVT_SCROLL_CHANGED, opacitySliderHandler );
2328 slider->Bind( wxEVT_SCROLL_THUMBTRACK, opacitySliderHandler );
2334 sizer->Add( btn_visible, 0, wxALIGN_CENTER_VERTICAL, 0 );
2336 sizer->AddSpacer( btnWidth );
2338 sizer->AddSpacer( 5 );
2339 sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL, 0 );
2342 aSetting->ctl_text = label;
2345 if( !aSetting->can_control_opacity )
2354 m_objectSettings.emplace_back( std::make_unique<APPEARANCE_SETTING>( s_setting ) );
2360 setting->tooltip = wxGetTranslation( s_setting.tooltip );
2361 setting->label = wxGetTranslation( s_setting.label );
2363 if( setting->can_control_opacity )
2366 labelWidth = std::max( labelWidth, width );
2369 if( !s_setting.spacer )
2373 for(
const std::unique_ptr<APPEARANCE_SETTING>& setting :
m_objectSettings )
2375 if( setting->spacer )
2378 appendObject( setting );
2393 if( setting->spacer )
2398 if( setting->ctl_visibility )
2399 setting->ctl_visibility->SetValue( visible.
Contains( layer ) );
2401 if( setting->ctl_color )
2404 setting->ctl_color->SetSwatchColor(
color,
false );
2425 const wxString& aName )
2430 if( !isDefaultClass)
2432 aMenu.Append(
new wxMenuItem( &aMenu,
ID_SET_NET_COLOR,
_(
"Set Netclass Color" ),
2433 wxEmptyString, wxITEM_NORMAL ) );
2436 _(
"Use Color from Schematic" ),
2437 wxEmptyString, wxITEM_NORMAL );
2438 std::shared_ptr<NETCLASS> nc = netSettings->GetNetClassByName( aName );
2440 aMenu.Append( schematicColor );
2443 schematicColor->Enable(
false );
2446 wxEmptyString, wxITEM_NORMAL ) );
2447 aMenu.AppendSeparator();
2453 wxString::Format(
_(
"Highlight Nets in %s" ),
name ),
2454 wxEmptyString, wxITEM_NORMAL ) );
2456 wxString::Format(
_(
"Select Tracks and Vias in %s" ),
name ),
2457 wxEmptyString, wxITEM_NORMAL ) );
2459 wxString::Format(
_(
"Unselect Tracks and Vias in %s" ),
name ),
2460 wxEmptyString, wxITEM_NORMAL ) );
2462 aMenu.AppendSeparator();
2464 aMenu.Append(
new wxMenuItem( &aMenu,
ID_SHOW_ALL_NETS,
_(
"Show All Netclasses" ),
2465 wxEmptyString, wxITEM_NORMAL ) );
2466 aMenu.Append(
new wxMenuItem( &aMenu,
ID_HIDE_OTHER_NETS,
_(
"Hide All Other Netclasses" ),
2467 wxEmptyString, wxITEM_NORMAL ) );
2489 const std::set<wxString>& hiddenClasses =
m_frame->Prj().GetLocalSettings().m_HiddenNetclasses;
2493 auto appendNetclass =
2494 [&](
int aId,
const std::shared_ptr<NETCLASS>& aClass,
bool isDefaultClass = false )
2496 wxString
name = aClass->GetName();
2503 wxBoxSizer* sizer =
new wxBoxSizer( wxHORIZONTAL );
2507 ? netSettings->GetNetClassByName(
name )->GetPcbColor()
2512 setting->
ctl_color->SetToolTip(
_(
"Left double click or middle click for color "
2513 "change, right click for menu" ) );
2515 setting->
ctl_color->Bind( COLOR_SWATCH_CHANGED,
2519 if( isDefaultClass )
2525 !hiddenClasses.count(
name ) );
2528 tip.Printf(
_(
"Show or hide ratsnest for nets in %s" ),
name );
2534 int flags = wxALIGN_CENTER_VERTICAL;
2536 sizer->Add( setting->
ctl_color, 0, flags | wxRESERVE_SPACE_EVEN_IF_HIDDEN, 5 );
2537 sizer->AddSpacer( 7 );
2539 sizer->AddSpacer( 3 );
2540 sizer->Add( setting->
ctl_text, 1, flags, 5 );
2550 [&,
name, isDefaultClass]( wxMouseEvent& aEvent )
2559 setting->
ctl_panel->Bind( wxEVT_RIGHT_DOWN, menuHandler );
2561 setting->
ctl_color->Bind( wxEVT_RIGHT_DOWN, menuHandler );
2562 setting->
ctl_text->Bind( wxEVT_RIGHT_DOWN, menuHandler );
2565 std::vector<wxString> names;
2567 for(
const auto& [
name, netclass] : netSettings->GetNetclasses() )
2568 names.emplace_back(
name );
2570 std::sort( names.begin(), names.end() );
2574 int idx = wxID_HIGHEST;
2577 appendNetclass( idx++, netSettings->GetDefaultNetclass(),
true );
2579 for(
const wxString&
name : names )
2582 appendNetclass( idx++, netSettings->GetNetclasses().at(
name ) );
2595 msg =
_(
"Net colors:" );
2601 m_rbNetColorAll->SetToolTip(
_(
"Net and netclass colors are shown on all copper items" ) );
2607 m_rbNetColorOff->SetToolTip(
_(
"Net and netclass colors are not shown" ) );
2614 msg =
_(
"Ratsnest display:" );
2648 int default_idx = 0;
2649 std::vector<std::pair<wxString, void*>> userPresets;
2655 const wxString translatedName = wxGetTranslation(
name );
2656 void* userData =
static_cast<void*
>( &preset );
2658 if( preset.readOnly )
2661 userPresets.push_back( {
name, userData } );
2672 if( !userPresets.empty() )
2676 for(
auto& [
name, userData] : userPresets )
2703 [&](
const std::pair<const wxString, LAYER_PRESET>& aPair )
2705 return ( aPair.second.layers == visibleLayers
2706 && aPair.second.renderLayers == visibleObjects
2707 && aPair.second.flipBoard == flipBoard );
2714 bool do_translate = it->second.readOnly;
2715 wxString
text = do_translate ? wxGetTranslation( it->first ) : it->first;
2734 wxString ui_label = aName;
2736 for( std::pair<const wxString, LAYER_PRESET>& pair :
m_layerPresets )
2738 if( pair.first != aName )
2741 if( pair.second.readOnly ==
true )
2742 ui_label = wxGetTranslation( aName );
2766 auto resetSelection =
2775 if( index == count - 2 )
2783 wxTextEntryDialog dlg( wxGetTopLevelParent(
this ),
_(
"Layer preset name:" ),
2784 _(
"Save Layer Preset" ),
name );
2786 if( dlg.ShowModal() != wxID_OK )
2792 name = dlg.GetValue();
2810 wxMessageBox(
_(
"Default presets cannot be modified.\nPlease use a different name." ),
2811 _(
"Error" ), wxOK | wxICON_ERROR, wxGetTopLevelParent(
this ) );
2818 if( !
IsOK( wxGetTopLevelParent(
this ),
_(
"Overwrite existing preset?" ) ) )
2840 else if( index == count - 1 )
2843 wxArrayString headers;
2844 std::vector<wxArrayString> items;
2846 headers.Add(
_(
"Presets" ) );
2848 for( std::pair<const wxString, LAYER_PRESET>& pair :
m_layerPresets )
2850 if( !pair.second.readOnly )
2853 item.Add( pair.first );
2854 items.emplace_back( item );
2866 if( idx != wxNOT_FOUND )
2874 if(
m_presetMRU.Index( presetName ) != wxNOT_FOUND )
2916 const wxString translatedName = wxGetTranslation(
m_currentPreset->name );
2918 if(
m_presetMRU.Index( translatedName ) != wxNOT_FOUND )
2943 activeLayer = *aPreset.
layers.
Seq().begin();
2948 m_frame->SetActiveLayer( activeLayer );
2951 m_frame->GetCanvas()->SyncLayersVisibility( board );
2959 m_frame->GetCanvas()->Refresh();
2973 for( std::pair<const wxString, VIEWPORT>& pair :
m_viewports )
2974 m_cbViewports->Append( pair.first,
static_cast<void*
>( &pair.second ) );
3007 if( index >= 0 && index < count - 3 )
3011 wxCHECK( viewport, );
3015 if( !viewport->
name.IsEmpty() )
3023 else if( index == count - 2 )
3028 wxTextEntryDialog dlg( wxGetTopLevelParent(
this ),
_(
"Viewport name:" ),
_(
"Save Viewport" ),
name );
3030 if( dlg.ShowModal() != wxID_OK )
3040 name = dlg.GetValue();
3063 else if( index == count - 1 )
3066 wxArrayString headers;
3067 std::vector<wxArrayString> items;
3069 headers.Add(
_(
"Viewports" ) );
3071 for( std::pair<const wxString, VIEWPORT>& pair :
m_viewports )
3074 item.Add( pair.first );
3075 items.emplace_back( item );
3086 if( idx != wxNOT_FOUND )
3110 m_frame->GetCanvas()->GetView()->SetViewport( aViewport.
rect );
3111 m_frame->GetCanvas()->Refresh();
3119 int layer = swatch->GetId();
3124 m_frame->GetSettingsManager()->SaveColorSettings( cs,
"board" );
3126 m_frame->GetCanvas()->UpdateColors();
3144 m_frame->GetCanvas()->Refresh();
3147 m_frame->SetDrawBgColor( newColor );
3168 m_frame->SetDisplayOptions( options );
3175 wxASSERT(
m_netsGrid->GetSelectedRows().size() == 1 );
3182 switch( aEvent.GetId() )
3197 m_frame->GetCanvas()->Refresh();
3202 m_frame->GetCanvas()->Refresh();
3207 m_frame->GetCanvas()->Refresh();
3229 bool show = aEvent.GetInt();
3241 if( net->GetNetClass()->ContainsNetclassWithName( aClassName ) )
3245 net->GetNetCode() );
3247 int row =
m_netsTable->GetRowByNetcode( net->GetNetCode() );
3262 m_frame->GetCanvas()->RedrawRatsnest();
3263 m_frame->GetCanvas()->Refresh();
3275 std::shared_ptr<NETCLASS> nc = netSettings->GetNetClassByName( netclassName );
3278 netSettings->RecomputeEffectiveNetclasses();
3280 m_frame->GetCanvas()->GetView()->UpdateAllLayersColor();
3281 m_frame->GetCanvas()->RedrawRatsnest();
3282 m_frame->GetCanvas()->Refresh();
3289 int classId = s->GetId();
3307 m_frame->SetDisplayOptions( options );
3308 m_frame->GetCanvas()->GetView()->UpdateAllLayersColor();
3319 cfg->m_Display.m_ShowGlobalRatsnest =
true;
3324 cfg->m_Display.m_ShowGlobalRatsnest =
true;
3329 cfg->m_Display.m_ShowGlobalRatsnest =
false;
3336 editframe->SetElementVisibility(
LAYER_RATSNEST, cfg->m_Display.m_ShowGlobalRatsnest );
3338 editframe->OnDisplayOptionsChanged();
3339 editframe->GetCanvas()->RedrawRatsnest();
3340 editframe->GetCanvas()->Refresh();
3360 setting = it->second;
3362 auto runOnNetsOfClass =
3363 [&](
const wxString& netClassName, std::function<void(
NETINFO_ITEM* )> aFunction )
3367 if( net->GetNetClass()->ContainsNetclassWithName( netClassName ) )
3372 switch( aEvent.GetId() )
3385 netSettings->RecomputeEffectiveNetclasses();
3401 netSettings->RecomputeEffectiveNetclasses();
3419 netSettings->RecomputeEffectiveNetclasses();
3434 static bool first =
true;
3482 for(
const auto& [
name, netclass] : netSettings->GetNetclasses() )
3500 for(
const auto& [
name, netclass] : netSettings->GetNetclasses() )
3517 m_frame->GetCanvas()->RedrawRatsnest();
3518 m_frame->GetCanvas()->Refresh();
3534 wxHyperlinkCtrl* button =
new wxHyperlinkCtrl( infobar, wxID_ANY,
_(
"Open Preferences" ), wxEmptyString );
3536 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<
void( wxHyperlinkEvent& aEvent )>(
3537 [&]( wxHyperlinkEvent& aEvent )
3539 m_frame->ShowPreferences( wxEmptyString, wxEmptyString );
3546 infobar->
ShowMessageFor(
_(
"The current color theme is read-only. Create a new theme in Preferences to "
3547 "enable color editing." ),
3548 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)
@ show_front_assembly_layers
@ show_back_assembly_layers
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)
@ 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.
@ VISIBLE
Ratsnest lines are drawn to items on visible layers only.
@ ALL
Ratsnest lines are drawn to items on all layers (default)
static TOOL_ACTION highContrastModeCycle
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
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)
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
wxBitmapBundle m_visibleBitmapBundle
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)
bool isLayerEnabled(PCB_LAYER_ID aLayer) const
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 rebuildLayerPresetsWidget(bool aReset)
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)
wxBitmapBundle m_notVisibileBitmapBundle
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 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
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 SetHighLightNet(int aNetCode, bool aMulti=false)
Select the netcode to be highlighted.
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
PROJECT * GetProject() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
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:
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.
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.
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 UpdateAllItemsConditionally(int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
Update items in the view according to the given flags and condition.
LSET is a set of PCB_LAYER_IDs.
static const LSET & FrontMask()
Return a mask holding all technical layers and the external CU layer on front side.
static const LSET & BackAssembly()
Return a complete set of all bottom assembly layers which is all B_SilkS and B_Mask.
static const LSET & BackMask()
Return a mask holding all technical layers and the external CU layer on back side.
static const LSET & FrontAssembly()
Return a complete set of all top assembly layers which is all F_SilkS and F_Mask.
LSEQ CuStack() const
Return a sequence of copper layers in starting from the front/top and extending to the back/bottom.
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static const LSET & AllLayersMask()
static const LSET & InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
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)
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.
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.
The main frame for Pcbnew.
The project local settings are things that are attached to a particular project, but also might be pa...
std::set< wxString > m_HiddenNetclasses
Icon provider for the "standard" row indicators, for example in layer selection lists.
@ OFF
Row "off" or "deselected".
@ ON
Row "on" or "selected".
A better wxCollapsiblePane that.
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_POINTS
PCB reference/manual snap points visibility.
@ LAYER_LOCKED_ITEM_SHADOW
Shadow layer for locked items.
@ LAYER_FILLED_SHAPES
Copper graphic shape opacity/visibility (color ignored).
@ 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_BOARD_OUTLINE_AREA
PCB board outline.
@ 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_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...
T * GetAppSettings(const char *aFilename)
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.
@ PCB_NETINFO_T
class NETINFO_ITEM, a description of a net