55#include <wx/checkbox.h>
56#include <wx/hyperlink.h>
58#include <wx/radiobut.h>
61#include <wx/statline.h>
62#include <wx/textdlg.h>
63#include <wx/bmpbuttn.h>
77 m_labelAttr->SetBackgroundColour( aBackgroundColor );
90 wxGridCellAttr* attr =
nullptr;
109 wxASSERT(
static_cast<size_t>( aRow ) <
m_nets.size() );
116 default:
return wxEmptyString;
123 wxASSERT(
static_cast<size_t>( aRow ) <
m_nets.size() );
135 net.
visible = ( aValue != wxT(
"0" ) );
155 case COL_LABEL:
return wxGRID_VALUE_STRING;
156 default:
return wxGRID_VALUE_STRING;
163 wxASSERT(
static_cast<size_t>( aRow ) <
m_nets.size() );
166 return m_nets[aRow].visible;
172 wxASSERT(
static_cast<size_t>( aRow ) <
m_nets.size() );
182 wxASSERT(
static_cast<size_t>( aRow ) <
m_nets.size() );
184 m_nets[aRow].visible = aVisible;
191 wxASSERT( aTypeName == wxT(
"COLOR4D" ) );
192 wxASSERT(
static_cast<size_t>( aRow ) <
m_nets.size() );
201 wxASSERT( aTypeName == wxT(
"COLOR4D" ) );
202 wxASSERT(
static_cast<size_t>( aRow ) <
m_nets.size() );
211 wxASSERT(
static_cast<size_t>( aRow ) <
m_nets.size() );
237 int deleted = (int)
m_nets.size();
243 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, 0, deleted );
244 GetView()->ProcessTableMessage( msg );
247 for(
const std::pair<const wxString, NETINFO_ITEM*>& pair : nets )
249 int netCode = pair.second->GetNetCode();
251 if( netCode > 0 && !pair.first.StartsWith( wxT(
"unconnected-(" ) ) )
253 COLOR4D color = netColors.count( netCode ) ? netColors.at( netCode )
256 bool visible = hiddenNets.count( netCode ) == 0;
266 return a.name < b.name;
271 for(
size_t row = 0; row <
m_nets.size(); ++row )
278 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, (
int)
m_nets.size() );
279 GetView()->ProcessTableMessage( msg );
293 GetView()->ForceRefresh();
301 net.visible = ( net.code == aNet.
code );
306 GetView()->ForceRefresh();
315 m_frame->GetToolManager()->RunAction( action, aNet.
code );
324 std::map<int, KIGFX::COLOR4D>& netColors = renderSettings->
GetNetColorMap();
329 netColors.erase( aNet.
code );
331 m_frame->GetCanvas()->GetView()->UpdateAllLayersColor();
332 m_frame->GetCanvas()->RedrawRatsnest();
333 m_frame->GetCanvas()->Refresh();
340#define RR APPEARANCE_CONTROLS::APPEARANCE_SETTING
435 SetMinSize( FromDIP( GetMinSize() ) );
442 int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
444 m_pointSize = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ).GetPointSize();
467 m_cbLayerPresets->SetToolTip( wxString::Format(
_(
"Save and restore layer visibility combinations.\n"
468 "Use %s+Tab to activate selector.\n"
469 "Successive Tabs while holding %s down will "
470 "cycle through presets in the popup." ),
474 m_cbViewports->SetToolTip( wxString::Format(
_(
"Save and restore view location and zoom.\n"
475 "Use %s+Tab to activate selector.\n"
476 "Successive Tabs while holding %s down will "
477 "cycle through viewports in the popup." ),
501 auto setHighContrastMode =
507 m_frame->SetDisplayOptions( opts );
512 [=]( wxCommandEvent& aEvent )
518 [=]( wxCommandEvent& aEvent )
524 [=]( wxCommandEvent& aEvent )
532 [&]( wxCommandEvent& aEvent )
538 [&]( wxCommandEvent& aEvent )
542 editframe->ShowBoardSetupDialog(
_(
"Net Classes" ) );
549 [&]( wxCommandEvent& aEvent )
560 m_netsGrid->RegisterDataType( wxT(
"COLOR4D" ),
568 m_netsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
572 const int cellPadding = 6;
574 const int rowHeightPadding = 5;
576 const int rowHeightPadding = 3;
586 m_netsGrid->SetDefaultRowSize( font.GetPixelSize().y + rowHeightPadding );
593 m_netsGrid->ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_DEFAULT );
601 if( cfg->m_AuiPanels.appearance_expand_layer_display )
604 if( cfg->m_AuiPanels.appearance_expand_net_display )
644 wxBoxSizer* layerDisplayOptionsSizer;
645 layerDisplayOptionsSizer =
new wxBoxSizer( wxVERTICAL );
652 msg =
_(
"Inactive layers:" );
659 wxBoxSizer* contrastModeSizer;
660 contrastModeSizer =
new wxBoxSizer( wxHORIZONTAL );
663 wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
669 contrastModeSizer->AddStretchSpacer();
676 contrastModeSizer->AddStretchSpacer();
683 contrastModeSizer->AddStretchSpacer();
685 layerDisplayOptionsSizer->Add( contrastModeSizer, 0, wxEXPAND, 5 );
688 wxDefaultSize, wxLI_HORIZONTAL );
691 m_cbFlipBoard =
new wxCheckBox( layerDisplayPane, wxID_ANY,
_(
"Flip board view" ) );
693 layerDisplayOptionsSizer->Add(
m_cbFlipBoard, 0, wxTOP | wxBOTTOM, 3 );
695 layerDisplayPane->SetSizer( layerDisplayOptionsSizer );
696 layerDisplayPane->Layout();
697 layerDisplayOptionsSizer->Fit( layerDisplayPane );
702 [&]( wxCommandEvent& aEvent )
717 wxBoxSizer* netDisplayOptionsSizer =
new wxBoxSizer( wxVERTICAL );
726 msg =
_(
"Net colors:" );
735 wxBoxSizer* netColorSizer =
new wxBoxSizer( wxHORIZONTAL );
737 m_rbNetColorAll =
new wxRadioButton( netDisplayPane, wxID_ANY,
_(
"All" ), wxDefaultPosition,
738 wxDefaultSize, wxRB_GROUP );
740 m_rbNetColorAll->SetToolTip(
_(
"Net and netclass colors are shown on all copper items" ) );
743 netColorSizer->AddStretchSpacer();
751 netColorSizer->AddStretchSpacer();
753 m_rbNetColorOff =
new wxRadioButton( netDisplayPane, wxID_ANY,
_(
"None" ) );
755 m_rbNetColorOff->SetToolTip(
_(
"Net and netclass colors are not shown" ) );
759 netDisplayOptionsSizer->Add( netColorSizer, 0, wxEXPAND | wxBOTTOM, 5 );
768 msg =
_(
"Ratsnest display:" );
777 wxBoxSizer* ratsnestDisplayModeSizer =
new wxBoxSizer( wxHORIZONTAL );
780 wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
786 ratsnestDisplayModeSizer->AddStretchSpacer();
793 ratsnestDisplayModeSizer->AddStretchSpacer();
801 netDisplayOptionsSizer->Add( ratsnestDisplayModeSizer, 0, wxEXPAND | wxBOTTOM, 5 );
805 netDisplayPane->SetSizer( netDisplayOptionsSizer );
806 netDisplayPane->Layout();
807 netDisplayOptionsSizer->Fit( netDisplayPane );
812 [&]( wxCommandEvent& aEvent )
855 int page = aEvent.GetSelection();
858 m_notebook->ChangeSelection(
static_cast<unsigned>( page ) );
887 if( wxBitmapButton* btn =
dynamic_cast<wxBitmapButton*
>( aEvent.GetEventObject() ) )
889 wxCommandEvent evt( wxEVT_BUTTON );
890 wxPostEvent( btn, evt );
907 int row =
event.GetRow();
908 int col =
event.GetCol();
925 int row =
event.GetRow();
926 int col =
event.GetCol();
957 menu.Append(
new wxMenuItem( &menu,
ID_SET_NET_COLOR,
_(
"Set Net Color" ), wxEmptyString,
959 menu.Append(
new wxMenuItem( &menu,
ID_CLEAR_NET_COLOR,
_(
"Clear Net Color" ), wxEmptyString,
962 menu.AppendSeparator();
965 wxString::Format(
_(
"Highlight %s" ), netName ), wxEmptyString,
968 wxString::Format(
_(
"Select Tracks and Vias in %s" ), netName ),
969 wxEmptyString, wxITEM_NORMAL ) );
971 wxString::Format(
_(
"Unselect Tracks and Vias in %s" ), netName ),
972 wxEmptyString, wxITEM_NORMAL ) );
974 menu.AppendSeparator();
976 menu.Append(
new wxMenuItem( &menu,
ID_SHOW_ALL_NETS,
_(
"Show All Nets" ), wxEmptyString,
979 wxEmptyString, wxITEM_NORMAL ) );
989 wxPoint pos =
m_netsGrid->CalcUnscrolledPosition( aEvent.GetPosition() );
990 wxGridCellCoords cell =
m_netsGrid->XYToCell( pos );
992 if( aEvent.Moving() || aEvent.Entering() )
1010 wxString showOrHide = net.
visible ?
_(
"Click to hide ratsnest for %s" )
1011 :
_(
"Click to show ratsnest for %s" );
1015 tip.Printf( showOrHide,
name );
1017 tip =
_(
"Double click (or middle click) to change color; right click for more actions" );
1019 m_netsGrid->GetGridWindow()->SetToolTip( tip );
1021 else if( aEvent.Leaving() )
1026 else if( aEvent.Dragging() )
1034 else if( aEvent.ButtonUp( wxMOUSE_BTN_MIDDLE ) && !!cell )
1036 int row = cell.GetRow();
1037 int col = cell.GetCol();
1135 int row =
m_netsTable->GetRowByNetcode( aNetCode );
1139 m_netsTable->SetVisibilityState( row, aVisibility );
1153 bool rebuild = std::any_of( aBoardItems.begin(), aBoardItems.end(),
1156 return a->Type() == PCB_NETINFO_T;
1206 std::vector<BOARD_ITEM*>& aAddedItems,
1207 std::vector<BOARD_ITEM*>& aRemovedItems,
1208 std::vector<BOARD_ITEM*>& aChangedItems )
1256 if( child && child->GetWindow() )
1261 m_netsGrid->RegisterDataType( wxT(
"COLOR4D" ),
1267 if( pair.second->ctl_color )
1268 pair.second->ctl_color->OnDarkModeToggle();
1277 for(
const std::unique_ptr<APPEARANCE_SETTING>& setting :
m_layerSettings )
1287 if( r < 240 || g < 240 || b < 240 )
1289 r = wxChar( std::min( (
int) r + 15, 255 ) );
1290 g = wxChar( std::min( (
int) g + 15, 255 ) );
1291 b = wxChar( std::min( (
int) b + 15, 255 ) );
1295 r = wxChar( std::max( (
int) r - 15, 0 ) );
1296 g = wxChar( std::max( (
int) g - 15, 0 ) );
1297 b = wxChar( std::max( (
int) b - 15, 0 ) );
1310 newSetting->
ctl_panel->SetBackgroundColour( wxColour( r, g, b ) );
1322 if( visible.test( layer ) == isVisible )
1325 visible.
set( layer, isVisible );
1328 m_frame->GetCanvas()->GetView()->SetLayerVisible( layer, isVisible );
1351 m_frame->Update3DView(
true,
m_frame->GetPcbNewSettings()->m_Display.m_Live3DRefresh );
1353 m_frame->GetCanvas()->GetView()->SetLayerVisible( aLayer, isVisible );
1354 m_frame->GetCanvas()->Refresh();
1369 board->SetVisibleLayers( aLayers );
1379 return dynamic_cast<PCB_VIA*
>( aItem ) ||
dynamic_cast<PAD*
>( aItem );
1382 m_frame->Update3DView(
true,
m_frame->GetPcbNewSettings()->m_Display.m_Live3DRefresh );
1433 if( s_setting.id == gal_ly )
1441 m_frame->Update3DView(
true,
m_frame->GetPcbNewSettings()->m_Display.m_Live3DRefresh );
1460 return board->GetVisibleLayers();
1475 for(
size_t i = 0; i < set.size(); i++ )
1482 return board->GetVisibleElements();
1513 if( !cfg->m_Display.m_ShowGlobalRatsnest )
1530 std::vector<LAYER_PRESET> ret;
1532 for(
const std::pair<const wxString, LAYER_PRESET>& pair :
m_layerPresets )
1534 if( !pair.second.readOnly )
1535 ret.emplace_back( pair.second );
1585 wxCommandEvent
dummy;
1607 std::vector<VIEWPORT> ret;
1609 for(
const std::pair<const wxString, VIEWPORT>& pair :
m_viewports )
1610 ret.emplace_back( pair.second );
1620 for(
const VIEWPORT& viewport : aViewportList )
1638 wxCommandEvent
dummy;
1668 m_windowLayersSizerItem->SetFlag( m_windowLayersSizerItem->GetFlag() & ~wxTOP );
1672 [&]( std::unique_ptr<APPEARANCE_SETTING>& aSetting )
1674 int layer = aSetting->id;
1677 wxBoxSizer* sizer =
new wxBoxSizer( wxHORIZONTAL );
1678 panel->SetSizer( sizer );
1682 aSetting->visible = visible[layer];
1690 swatch->SetToolTip(
_(
"Double click or middle click for color change, right click for menu" ) );
1695 aSetting->visible );
1696 btn_visible->SetToolTip(
_(
"Show or hide this layer" ) );
1698 wxStaticText* label =
new wxStaticText( panel, layer, aSetting->label );
1700 label->SetToolTip( aSetting->tooltip );
1702 sizer->AddSpacer( 1 );
1703 sizer->Add( indicator, 0, wxALIGN_CENTER_VERTICAL | wxTOP, 2 );
1704 sizer->AddSpacer( 5 );
1705 sizer->Add( swatch, 0, wxALIGN_CENTER_VERTICAL | wxTOP, 2 );
1706 sizer->AddSpacer( 6 );
1707 sizer->Add( btn_visible, 0, wxALIGN_CENTER_VERTICAL | wxTOP, 2 );
1708 sizer->AddSpacer( 5 );
1709 sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxTOP, 2 );
1713 aSetting->ctl_panel = panel;
1714 aSetting->ctl_indicator = indicator;
1715 aSetting->ctl_visibility = btn_visible;
1716 aSetting->ctl_color = swatch;
1717 aSetting->ctl_text = label;
1724 btn_visible->Bind( TOGGLE_CHANGED,
1725 [&]( wxCommandEvent& aEvent )
1727 wxObject* btn = aEvent.GetEventObject();
1728 int layerId =
static_cast<wxWindow*
>( btn )->GetId();
1745 [&]( std::unique_ptr<APPEARANCE_SETTING>& aSetting )
1747 int layer = aSetting->id;
1748 aSetting->visible = visible[layer];
1749 aSetting->ctl_panel->Show();
1750 aSetting->ctl_panel->SetId( layer );
1751 aSetting->ctl_indicator->SetWindowID( layer );
1752 aSetting->ctl_color->SetWindowID( layer );
1753 aSetting->ctl_color->SetSwatchColor( theme->
GetColor( layer ),
false );
1754 aSetting->ctl_visibility->SetWindowID( layer );
1755 aSetting->ctl_text->SetLabelText( aSetting->label );
1756 aSetting->ctl_text->SetId( layer );
1757 aSetting->ctl_text->SetToolTip( aSetting->tooltip );
1763 static const struct {
1769 {
F_Paste,
_HKI(
"Solder paste on board's front" ) },
1770 {
B_Paste,
_HKI(
"Solder paste on board's back" ) },
1771 {
F_SilkS,
_HKI(
"Silkscreen on board's front" ) },
1772 {
B_SilkS,
_HKI(
"Silkscreen on board's back" ) },
1773 {
F_Mask,
_HKI(
"Solder mask on board's front" ) },
1774 {
B_Mask,
_HKI(
"Solder mask on board's back" ) },
1780 {
Margin,
_HKI(
"Board's edge setback outline" ) },
1781 {
F_CrtYd,
_HKI(
"Footprint courtyards on board's front" ) },
1782 {
B_CrtYd,
_HKI(
"Footprint courtyards on board's back" ) },
1783 {
F_Fab,
_HKI(
"Footprint assembly on board's front" ) },
1784 {
B_Fab,
_HKI(
"Footprint assembly on board's back" ) },
1847 std::size_t total_layers = enabled.
CuStack().size();
1849 for(
const auto& entry : non_cu_seq )
1851 if( enabled[entry.layerId] )
1861 for( std::size_t ii = total_layers; ii <
m_layerSettings.size(); ++ii )
1876 case F_Cu: dsc =
_(
"Front copper layer" );
break;
1877 case B_Cu: dsc =
_(
"Back copper layer" );
break;
1878 default: dsc =
_(
"Inner copper layer" );
break;
1881 std::unique_ptr<APPEARANCE_SETTING>& setting = *layer_it;
1884 setting->id = layer;
1885 setting->tooltip = dsc;
1887 if( setting->ctl_panel ==
nullptr )
1888 appendLayer( setting );
1890 updateLayer( setting );
1896 setting->ctl_text->Disable();
1897 setting->ctl_color->SetToolTip( wxEmptyString );
1903 for(
const auto& entry : non_cu_seq )
1907 if( !enabled[layer] )
1910 std::unique_ptr<APPEARANCE_SETTING>& setting = *layer_it;
1926 setting->id = layer;
1929 setting->tooltip = wxGetTranslation( entry.tooltip );
1931 if( setting->ctl_panel ==
nullptr )
1932 appendLayer( setting );
1934 updateLayer( setting );
1940 setting->ctl_text->Disable();
1941 setting->ctl_color->SetToolTip( wxEmptyString );
1959 msg =
_(
"Inactive layers:" );
2016 if(
m_frame->GetBoard() &&
m_frame->GetBoard()->GetCopperLayerCount() > 2 )
2046 switch( aEvent.GetId() )
2071 if( !visible.test( current ) && visible.count() > 0 )
2072 m_frame->SetActiveLayer( *visible.
Seq().begin() );
2080 if( !visible.test( current ) && visible.count() > 0 )
2081 m_frame->SetActiveLayer( *visible.
Seq().begin() );
2122 m_frame->GetCanvas()->SyncLayersVisibility( board );
2124 m_frame->GetCanvas()->Refresh();
2138 if( aTab >= 0 &&
static_cast<size_t>( aTab ) < max )
2154 int layer = setting->id;
2156 if( setting->ctl_visibility )
2157 setting->ctl_visibility->SetValue( visible[layer] );
2159 if( setting->ctl_color )
2162 setting->ctl_color->SetSwatchColor( color,
false );
2163 setting->ctl_color->SetReadOnly( readOnly );
2171 if( setting->ctl_visibility )
2172 setting->ctl_visibility->SetValue( objects.
Contains( layer ) );
2174 if( setting->ctl_color )
2177 setting->ctl_color->SetSwatchColor( color,
false );
2178 setting->ctl_color->SetReadOnly( readOnly );
2193 wxWindow* eventSource =
static_cast<wxWindow*
>( aEvent.GetEventObject() );
2200 m_frame->SetActiveLayer( layer );
2217 visibleLayers.
set( aLayer, !visibleLayers.test( aLayer ) );
2219 m_frame->GetCanvas()->GetView()->SetLayerVisible( aLayer, visibleLayers.test( aLayer ) );
2222 m_frame->GetCanvas()->Refresh();
2235 m_frame->GetCanvas()->GetView()->SetLayerVisible( aLayer,
true );
2239 m_frame->GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest = isVisible;
2242 m_frame->GetBoard()->SetElementVisibility( aLayer, isVisible );
2244 m_frame->OnDisplayOptionsChanged();
2245 m_frame->GetCanvas()->RedrawRatsnest();
2252 m_frame->SetGridVisibility( isVisible );
2253 m_frame->GetCanvas()->Refresh();
2288 if( visible.
Contains( aLayer ) != isVisible )
2290 visible.
set( aLayer, isVisible );
2292 m_frame->GetCanvas()->GetView()->SetLayerVisible( aLayer, isVisible );
2298 m_frame->GetCanvas()->Refresh();
2309 int swatchWidth =
m_windowObjects->ConvertDialogToPixels( wxSize( 8, 0 ) ).x;
2319 [&](
const std::unique_ptr<APPEARANCE_SETTING>& aSetting )
2322 wxBoxSizer* sizer =
new wxBoxSizer( wxHORIZONTAL );
2323 panel->SetSizer( sizer );
2324 int layer = aSetting->id;
2334 swatch->SetToolTip(
_(
"Left double click or middle click for color change, "
2335 "right click for menu" ) );
2337 sizer->Add( swatch, 0, wxALIGN_CENTER_VERTICAL, 0 );
2338 aSetting->ctl_color = swatch;
2346 sizer->AddSpacer( swatchWidth );
2352 if( aSetting->can_control_visibility )
2357 aSetting->visible );
2359 tip.Printf(
_(
"Show or hide %s" ), aSetting->label.Lower() );
2360 btn_visible->SetToolTip( tip );
2362 aSetting->ctl_visibility = btn_visible;
2364 btn_visible->Bind( TOGGLE_CHANGED,
2365 [&]( wxCommandEvent& aEvent )
2367 int id =
static_cast<wxWindow*
>( aEvent.GetEventObject() )->GetId();
2368 bool isVisible = aEvent.GetInt();
2373 sizer->AddSpacer( 5 );
2375 wxStaticText* label =
new wxStaticText( panel, layer, aSetting->label );
2377 label->SetToolTip( aSetting->tooltip );
2379 if( aSetting->can_control_opacity )
2381 label->SetMinSize( wxSize( labelWidth, -1 ) );
2384 sizer->Add( btn_visible, 0, wxALIGN_CENTER_VERTICAL | wxBOTTOM, 10 );
2386 sizer->AddSpacer( btnWidth );
2388 sizer->AddSpacer( 5 );
2389 sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL | wxBOTTOM, 10 );
2392 sizer->Add( btn_visible, 0, wxALIGN_CENTER_VERTICAL, 0 );
2394 sizer->AddSpacer( btnWidth );
2396 sizer->AddSpacer( 5 );
2397 sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL, 0 );
2400 wxSlider* slider =
new wxSlider( panel, wxID_ANY, 100, 0, 100,
2401 wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL );
2403 slider->SetMinSize( wxSize( 80, 16 ) );
2405 slider->SetMinSize( wxSize( 80, -1 ) );
2408 tip.Printf(
_(
"Set opacity of %s" ), aSetting->label.Lower() );
2409 slider->SetToolTip( tip );
2411 sizer->Add( slider, 1, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5 );
2412 aSetting->ctl_opacity = slider;
2414 auto opacitySliderHandler =
2415 [
this, layer]( wxCommandEvent& aEvent )
2417 wxSlider* ctrl =
static_cast<wxSlider*
>( aEvent.GetEventObject() );
2418 int value = ctrl->GetValue();
2422 slider->Bind( wxEVT_SCROLL_CHANGED, opacitySliderHandler );
2423 slider->Bind( wxEVT_SCROLL_THUMBTRACK, opacitySliderHandler );
2429 sizer->Add( btn_visible, 0, wxALIGN_CENTER_VERTICAL, 0 );
2431 sizer->AddSpacer( btnWidth );
2433 sizer->AddSpacer( 5 );
2434 sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL, 0 );
2437 aSetting->ctl_text = label;
2440 if( !aSetting->can_control_opacity )
2449 m_objectSettings.emplace_back( std::make_unique<APPEARANCE_SETTING>( s_setting ) );
2455 setting->tooltip = wxGetTranslation( s_setting.tooltip );
2456 setting->label = wxGetTranslation( s_setting.label );
2458 if( setting->can_control_opacity )
2461 labelWidth = std::max( labelWidth, width );
2464 if( !s_setting.spacer )
2468 for(
const std::unique_ptr<APPEARANCE_SETTING>& setting :
m_objectSettings )
2470 if( setting->spacer )
2473 appendObject( setting );
2489 if( setting->spacer )
2494 if( setting->ctl_visibility )
2495 setting->ctl_visibility->SetValue( visible.
Contains( layer ) );
2497 if( setting->ctl_color )
2499 COLOR4D color =
m_frame->GetColorSettings()->GetColor( setting->id );
2500 setting->ctl_color->SetSwatchColor( color,
false );
2521 const wxString& aName )
2530 if( !isDefaultClass)
2532 aMenu.Append(
new wxMenuItem( &aMenu,
ID_SET_NET_COLOR,
_(
"Set Netclass Color" ),
2533 wxEmptyString, wxITEM_NORMAL ) );
2536 _(
"Use Color from Schematic" ),
2537 wxEmptyString, wxITEM_NORMAL );
2538 std::shared_ptr<NETCLASS> nc = netSettings->GetNetClassByName( aName );
2540 aMenu.Append( schematicColor );
2543 schematicColor->Enable(
false );
2546 wxEmptyString, wxITEM_NORMAL ) );
2547 aMenu.AppendSeparator();
2553 wxString::Format(
_(
"Highlight Nets in %s" ),
name ),
2554 wxEmptyString, wxITEM_NORMAL ) );
2556 wxString::Format(
_(
"Select Tracks and Vias in %s" ),
name ),
2557 wxEmptyString, wxITEM_NORMAL ) );
2559 wxString::Format(
_(
"Unselect Tracks and Vias in %s" ),
name ),
2560 wxEmptyString, wxITEM_NORMAL ) );
2562 aMenu.AppendSeparator();
2564 aMenu.Append(
new wxMenuItem( &aMenu,
ID_SHOW_ALL_NETS,
_(
"Show All Netclasses" ),
2565 wxEmptyString, wxITEM_NORMAL ) );
2566 aMenu.Append(
new wxMenuItem( &aMenu,
ID_HIDE_OTHER_NETS,
_(
"Hide All Other Netclasses" ),
2567 wxEmptyString, wxITEM_NORMAL ) );
2589 const std::set<wxString>& hiddenClasses =
m_frame->Prj().GetLocalSettings().m_HiddenNetclasses;
2595 auto appendNetclass =
2596 [&](
int aId,
const std::shared_ptr<NETCLASS>& aClass,
bool isDefaultClass = false )
2598 wxString
name = aClass->GetName();
2605 wxBoxSizer* sizer =
new wxBoxSizer( wxHORIZONTAL );
2609 ? netSettings->GetNetClassByName(
name )->GetPcbColor()
2614 setting->
ctl_color->SetToolTip(
_(
"Left double click or middle click for color "
2615 "change, right click for menu" ) );
2617 setting->
ctl_color->Bind( COLOR_SWATCH_CHANGED,
2621 if( isDefaultClass )
2627 !hiddenClasses.count(
name ) );
2630 tip.Printf(
_(
"Show or hide ratsnest for nets in %s" ),
name );
2636 int flags = wxALIGN_CENTER_VERTICAL;
2638 sizer->Add( setting->
ctl_color, 0, flags | wxRESERVE_SPACE_EVEN_IF_HIDDEN, 5 );
2639 sizer->AddSpacer( 7 );
2641 sizer->AddSpacer( 3 );
2642 sizer->Add( setting->
ctl_text, 1, flags, 5 );
2652 [&,
name, isDefaultClass]( wxMouseEvent& aEvent )
2661 setting->
ctl_panel->Bind( wxEVT_RIGHT_DOWN, menuHandler );
2663 setting->
ctl_color->Bind( wxEVT_RIGHT_DOWN, menuHandler );
2664 setting->
ctl_text->Bind( wxEVT_RIGHT_DOWN, menuHandler );
2667 std::vector<wxString> names;
2669 for(
const auto& [
name, netclass] : netSettings->GetNetclasses() )
2670 names.emplace_back(
name );
2672 std::sort( names.begin(), names.end() );
2676 int idx = wxID_HIGHEST;
2679 appendNetclass( idx++, netSettings->GetDefaultNetclass(),
true );
2681 for(
const wxString&
name : names )
2684 appendNetclass( idx++, netSettings->GetNetclasses().at(
name ) );
2697 msg =
_(
"Net colors:" );
2703 m_rbNetColorAll->SetToolTip(
_(
"Net and netclass colors are shown on all copper items" ) );
2709 m_rbNetColorOff->SetToolTip(
_(
"Net and netclass colors are not shown" ) );
2716 msg =
_(
"Ratsnest display:" );
2749 int default_idx = 0;
2750 std::vector<std::pair<wxString, void*>> userPresets;
2756 const wxString translatedName = wxGetTranslation(
name );
2757 void* userData =
static_cast<void*
>( &preset );
2759 if( preset.readOnly )
2762 userPresets.push_back( {
name, userData } );
2773 if( !userPresets.empty() )
2777 for(
auto& [
name, userData] : userPresets )
2804 [&](
const std::pair<const wxString, LAYER_PRESET>& aPair )
2807 const GAL_SET& presetObjects = aPair.second.readOnly
2808 ? m_lastBuiltinPreset.renderLayers
2809 : aPair.second.renderLayers;
2811 return ( aPair.second.layers == visibleLayers
2812 && presetObjects == visibleObjects
2813 && aPair.second.flipBoard == flipBoard );
2820 bool do_translate = it->second.readOnly;
2821 wxString
text = do_translate ? wxGetTranslation( it->first ) : it->first;
2840 wxString ui_label = aName;
2842 for( std::pair<const wxString, LAYER_PRESET>& pair :
m_layerPresets )
2844 if( pair.first != aName )
2847 if( pair.second.readOnly ==
true )
2848 ui_label = wxGetTranslation( aName );
2872 auto resetSelection =
2881 if(
index == count - 2 )
2889 wxTextEntryDialog dlg( wxGetTopLevelParent(
this ),
_(
"Layer preset name:" ),
2890 _(
"Save Layer Preset" ),
name );
2892 if( dlg.ShowModal() != wxID_OK )
2898 name = dlg.GetValue();
2916 wxMessageBox(
_(
"Default presets cannot be modified.\nPlease use a different name." ),
2917 _(
"Error" ), wxOK | wxICON_ERROR, wxGetTopLevelParent(
this ) );
2924 if( !
IsOK( wxGetTopLevelParent(
this ),
_(
"Overwrite existing preset?" ) ) )
2946 else if(
index == count - 1 )
2949 wxArrayString headers;
2950 std::vector<wxArrayString> items;
2952 headers.Add(
_(
"Presets" ) );
2954 for( std::pair<const wxString, LAYER_PRESET>& pair :
m_layerPresets )
2956 if( !pair.second.readOnly )
2959 item.Add( pair.first );
2960 items.emplace_back( item );
2972 if( idx != wxNOT_FOUND )
2983 if(
m_presetMRU.Index( presetName ) != wxNOT_FOUND )
3025 const wxString translatedName = wxGetTranslation(
m_currentPreset->name );
3027 if(
m_presetMRU.Index( translatedName ) != wxNOT_FOUND )
3054 activeLayer = *aPreset.
layers.
Seq().begin();
3059 m_frame->SetActiveLayer( activeLayer );
3062 m_frame->GetCanvas()->SyncLayersVisibility( board );
3066 m_frame->SetDisplayOptions( options,
false );
3068 m_frame->GetCanvas()->Refresh();
3082 for( std::pair<const wxString, VIEWPORT>& pair :
m_viewports )
3083 m_cbViewports->Append( pair.first,
static_cast<void*
>( &pair.second ) );
3120 wxCHECK( viewport, );
3124 if( !viewport->
name.IsEmpty() )
3132 else if(
index == count - 2 )
3137 wxTextEntryDialog dlg( wxGetTopLevelParent(
this ),
_(
"Viewport name:" ),
_(
"Save Viewport" ),
name );
3139 if( dlg.ShowModal() != wxID_OK )
3149 name = dlg.GetValue();
3172 else if(
index == count - 1 )
3175 wxArrayString headers;
3176 std::vector<wxArrayString> items;
3178 headers.Add(
_(
"Viewports" ) );
3180 for( std::pair<const wxString, VIEWPORT>& pair :
m_viewports )
3183 item.Add( pair.first );
3184 items.emplace_back( item );
3195 if( idx != wxNOT_FOUND )
3222 m_frame->GetCanvas()->GetView()->SetViewport( aViewport.
rect );
3223 m_frame->GetCanvas()->Refresh();
3231 int layer = swatch->GetId();
3236 m_frame->GetSettingsManager()->SaveColorSettings( cs,
"board" );
3238 m_frame->GetCanvas()->UpdateColors();
3256 m_frame->GetCanvas()->Refresh();
3259 m_frame->SetDrawBgColor( newColor );
3280 m_frame->SetDisplayOptions( options );
3287 wxASSERT(
m_netsGrid->GetSelectedRows().size() == 1 );
3294 switch( aEvent.GetId() )
3315 m_frame->GetCanvas()->Refresh();
3320 m_frame->GetCanvas()->Refresh();
3325 m_frame->GetCanvas()->Refresh();
3347 bool show = aEvent.GetInt();
3364 if( net->GetNetClass()->ContainsNetclassWithName( aClassName ) )
3368 net->GetNetCode() );
3370 int row =
m_netsTable->GetRowByNetcode( net->GetNetCode() );
3385 m_frame->GetCanvas()->RedrawRatsnest();
3386 m_frame->GetCanvas()->Refresh();
3402 std::shared_ptr<NETCLASS> nc = netSettings->GetNetClassByName( netclassName );
3405 netSettings->RecomputeEffectiveNetclasses();
3407 m_frame->GetCanvas()->GetView()->UpdateAllLayersColor();
3408 m_frame->GetCanvas()->RedrawRatsnest();
3409 m_frame->GetCanvas()->Refresh();
3416 int classId = s->GetId();
3434 m_frame->SetDisplayOptions( options );
3435 m_frame->GetCanvas()->GetView()->UpdateAllLayersColor();
3446 cfg->m_Display.m_ShowGlobalRatsnest =
true;
3451 cfg->m_Display.m_ShowGlobalRatsnest =
true;
3456 cfg->m_Display.m_ShowGlobalRatsnest =
false;
3463 editframe->SetElementVisibility(
LAYER_RATSNEST, cfg->m_Display.m_ShowGlobalRatsnest );
3465 editframe->OnDisplayOptionsChanged();
3466 editframe->GetCanvas()->RedrawRatsnest();
3467 editframe->GetCanvas()->Refresh();
3491 setting = it->second;
3493 auto runOnNetsOfClass =
3494 [&](
const wxString& netClassName, std::function<void(
NETINFO_ITEM* )> aFunction )
3498 if( net->GetNetClass()->ContainsNetclassWithName( netClassName ) )
3503 switch( aEvent.GetId() )
3516 netSettings->RecomputeEffectiveNetclasses();
3532 netSettings->RecomputeEffectiveNetclasses();
3550 netSettings->RecomputeEffectiveNetclasses();
3606 for(
const auto& [
name, netclass] : netSettings->GetNetclasses() )
3624 for(
const auto& [
name, netclass] : netSettings->GetNetclasses() )
3641 m_frame->GetCanvas()->RedrawRatsnest();
3642 m_frame->GetCanvas()->Refresh();
3659 infobar->
AddLink(
_(
"Open Preferences" ),
3660 [&]( wxHyperlinkEvent& aEvent )
3662 m_frame->ShowPreferences( wxEmptyString, wxEmptyString );
3666 infobar->
ShowMessageFor(
_(
"The current color theme is read-only. Create a new theme in Preferences to "
3667 "enable color editing." ),
3668 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)
Update the current layer presets from those saved in the project file.
std::vector< LAYER_PRESET > GetUserLayerPresets() const
Return a list of the layer presets created by the user.
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
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
Return the index of the current tab (0-2).
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)
void OnLayerChanged()
Update the widget when the active board layer is changed.
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()
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
void OnBoardItemsAdded(BOARD &aBoard, std::vector< BOARD_ITEM * > &aItems) override
void OnColorThemeChanged()
Update the colors on all the widgets from the new chosen color theme.
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)
Update the current viewports from those saved in the project file.
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 OnBoardChanged()
Update the panel contents from the application and board models.
void onLayerLeftClick(wxMouseEvent &aEvent)
std::vector< VIEWPORT > GetUserViewports() const
Return a list of viewports created by the user.
VIEWPORT * m_lastSelectedViewport
wxArrayString m_viewportMRU
void SetTabIndex(int aTab)
Set the current notebook tab.
wxColour m_layerPanelColour
void CommonSettingsChanged(int aFlag)
std::map< int, wxString > m_netclassIdMap
Stores wxIDs for each netclass for control event mapping.
void OnLayerContextMenu(wxCommandEvent &aEvent)
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()
Respond to change in OS's DarkMode.
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)
Manually update visibility for a given layer.
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.
void ResetNetHighLight()
Reset all high light data to the init state.
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
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.
void SetVisibleElements(const GAL_SET &aMask)
A proxy function that calls the correspondent function in m_BoardSettings.
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 UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
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_ITEM objects.
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)
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 SetVisibilityState(int aRow, bool aVisible)
Update cached visibility without dispatching a ratsnest action.
void HideOtherNets(const NET_GRID_ENTRY &aNet)
std::unordered_map< int, int > m_netcodeToRow
wxGridCellAttr * m_defaultAttr
bool GetValueAsBool(int aRow, int aCol) override
const NET_GRID_ENTRY & GetEntry(int aRow) const
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.
bool m_FlipBoardView
true if the board is flipped to show the mirrored view
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 AddLink(const wxString &aLinkText, const std::function< void(wxHyperlinkEvent &)> &aFn)
Add a hypertext link 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_VIA_STITCHING
Outline of via stitching generators.
@ 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 RPT_SEVERITY_WARNING.
@ LAYER_CONSTRAINT_SHADOW
Shadow layer for items bound to a constraint.
@ 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_SUBGRIDS
Routing/placement subgrids (PCB_GRID_ITEM) visibility and color.
@ LAYER_DRC_ERROR
Layer for DRC markers with RPT_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
std::map< wxString, NETINFO_ITEM * > NETNAMES_MAP
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
const KICOMMON_API wxEventTypeTag< wxCommandEvent > WX_COLLAPSIBLE_PANE_CHANGED