diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index 7e694358dc..b4537b1d29 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -802,7 +802,8 @@ void FOOTPRINT_EDIT_FRAME::ShowChangedLanguage() lm_pane_info.Caption( _( "Appearance" ) ); // update the layer manager - m_appearancePanel->OnBoardChanged(); + m_appearancePanel->OnLanguageChanged(); + m_selectionFilterPanel->OnLanguageChanged(); UpdateUserInterface(); // Now restore the visibility: diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index b8dd425e43..81bc6b994d 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -1236,7 +1236,8 @@ void PCB_EDIT_FRAME::ShowChangedLanguage() pane_info.Caption( _( "Appearance" ) ); m_auimgr.Update(); - m_appearancePanel->OnBoardChanged(); + m_appearancePanel->OnLanguageChanged(); + m_selectionFilterPanel->OnLanguageChanged(); } diff --git a/pcbnew/widgets/appearance_controls.cpp b/pcbnew/widgets/appearance_controls.cpp index f543c1c71f..cbbb9522e0 100644 --- a/pcbnew/widgets/appearance_controls.cpp +++ b/pcbnew/widgets/appearance_controls.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2020 Jon Evans - * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -332,28 +332,28 @@ const APPEARANCE_CONTROLS::APPEARANCE_SETTING APPEARANCE_CONTROLS::s_objectSetti #define RR APPEARANCE_CONTROLS::APPEARANCE_SETTING // Render Row abbreviation to reduce source width // text id tooltip opacity slider - RR( _( "Tracks" ), LAYER_TRACKS, _( "Show tracks" ), true ), - RR( _( "Vias" ), LAYER_VIAS, _( "Show all vias" ), true ), - RR( _( "Pads" ), LAYER_PADS, _( "Show all pads" ), true ), - RR( _( "Zones" ), LAYER_ZONES, _( "Show copper zones" ), true ), + RR( _HKI( "Tracks" ), LAYER_TRACKS, _HKI( "Show tracks" ), true ), + RR( _HKI( "Vias" ), LAYER_VIAS, _HKI( "Show all vias" ), true ), + RR( _HKI( "Pads" ), LAYER_PADS, _HKI( "Show all pads" ), true ), + RR( _HKI( "Zones" ), LAYER_ZONES, _HKI( "Show copper zones" ), true ), RR(), - RR( _( "Footprints Front" ), LAYER_MOD_FR, _( "Show footprints that are on board's front" ) ), - RR( _( "Footprints Back" ), LAYER_MOD_BK, _( "Show footprints that are on board's back" ) ), - RR( _( "Through-hole Pads" ),LAYER_PADS_TH, _( "Show through-hole pads" ) ), - RR( _( "Values" ), LAYER_MOD_VALUES, _( "Show footprint values" ) ), - RR( _( "References" ), LAYER_MOD_REFERENCES, _( "Show footprint references" ) ), - RR( _( "Footprint Text" ), LAYER_MOD_TEXT, _( "Show all footprint text" ) ), - RR( _( "Hidden Text" ), LAYER_MOD_TEXT_INVISIBLE, _( "Show footprint text marked as invisible" ) ), + RR( _HKI( "Footprints Front" ), LAYER_MOD_FR, _HKI( "Show footprints that are on board's front" ) ), + RR( _HKI( "Footprints Back" ), LAYER_MOD_BK, _HKI( "Show footprints that are on board's back" ) ), + RR( _HKI( "Through-hole Pads" ),LAYER_PADS_TH, _HKI( "Show through-hole pads" ) ), + RR( _HKI( "Values" ), LAYER_MOD_VALUES, _HKI( "Show footprint values" ) ), + RR( _HKI( "References" ), LAYER_MOD_REFERENCES, _HKI( "Show footprint references" ) ), + RR( _HKI( "Footprint Text" ), LAYER_MOD_TEXT, _HKI( "Show all footprint text" ) ), + RR( _HKI( "Hidden Text" ), LAYER_MOD_TEXT_INVISIBLE, _HKI( "Show footprint text marked as invisible" ) ), RR(), RR(), - RR( _( "Ratsnest" ), LAYER_RATSNEST, _( "Show unconnected nets as a ratsnest") ), - RR( _( "No-Connects" ), LAYER_NO_CONNECTS, _( "Show a marker on pads which have no net connected" ) ), - RR( _( "DRC Warnings" ), LAYER_DRC_WARNING, _( "DRC violations with a Warning severity" ) ), - RR( _( "DRC Errors" ), LAYER_DRC_ERROR, _( "DRC violations with an Error severity" ) ), - RR( _( "DRC Exclusions" ), LAYER_DRC_EXCLUSION, _( "DRC violations which have been individually excluded" ) ), - RR( _( "Anchors" ), LAYER_ANCHOR, _( "Show footprint and text origins as a cross" ) ), - RR( _( "Drawing Sheet" ), LAYER_DRAWINGSHEET, _( "Show drawing sheet borders and title block" ) ), - RR( _( "Grid" ), LAYER_GRID, _( "Show the (x,y) grid dots" ) ) + RR( _HKI( "Ratsnest" ), LAYER_RATSNEST, _HKI( "Show unconnected nets as a ratsnest") ), + RR( _HKI( "No-Connects" ), LAYER_NO_CONNECTS, _HKI( "Show a marker on pads which have no net connected" ) ), + RR( _HKI( "DRC Warnings" ), LAYER_DRC_WARNING, _HKI( "DRC violations with a Warning severity" ) ), + RR( _HKI( "DRC Errors" ), LAYER_DRC_ERROR, _HKI( "DRC violations with an Error severity" ) ), + RR( _HKI( "DRC Exclusions" ), LAYER_DRC_EXCLUSION, _HKI( "DRC violations which have been individually excluded" ) ), + RR( _HKI( "Anchors" ), LAYER_ANCHOR, _HKI( "Show footprint and text origins as a cross" ) ), + RR( _HKI( "Drawing Sheet" ), LAYER_DRAWINGSHEET, _HKI( "Show drawing sheet borders and title block" ) ), + RR( _HKI( "Grid" ), LAYER_GRID, _HKI( "Show the (x,y) grid dots" ) ) }; /// These GAL layers are shown in the Objects tab in the footprint editor @@ -373,26 +373,26 @@ static std::set s_allowedInFpEditor = // These are the built-in layer presets that cannot be deleted -LAYER_PRESET APPEARANCE_CONTROLS::presetNoLayers( _( "No Layers" ), LSET() ); +LAYER_PRESET APPEARANCE_CONTROLS::presetNoLayers( _HKI( "No Layers" ), LSET() ); -LAYER_PRESET APPEARANCE_CONTROLS::presetAllLayers( _( "All Layers" ), LSET::AllLayersMask() ); +LAYER_PRESET APPEARANCE_CONTROLS::presetAllLayers( _HKI( "All Layers" ), LSET::AllLayersMask() ); -LAYER_PRESET APPEARANCE_CONTROLS::presetAllCopper( _( "All Copper Layers" ), +LAYER_PRESET APPEARANCE_CONTROLS::presetAllCopper( _HKI( "All Copper Layers" ), LSET::AllCuMask().set( Edge_Cuts ) ); -LAYER_PRESET APPEARANCE_CONTROLS::presetInnerCopper( _( "Inner Copper Layers" ), +LAYER_PRESET APPEARANCE_CONTROLS::presetInnerCopper( _HKI( "Inner Copper Layers" ), LSET::InternalCuMask().set( Edge_Cuts ) ); -LAYER_PRESET APPEARANCE_CONTROLS::presetFront( _( "Front Layers" ), +LAYER_PRESET APPEARANCE_CONTROLS::presetFront( _HKI( "Front Layers" ), LSET::FrontMask().set( Edge_Cuts ) ); -LAYER_PRESET APPEARANCE_CONTROLS::presetFrontAssembly( _( "Front Assembly View" ), +LAYER_PRESET APPEARANCE_CONTROLS::presetFrontAssembly( _HKI( "Front Assembly View" ), LSET::FrontAssembly().set( Edge_Cuts ), GAL_SET::DefaultVisible(), F_SilkS ); -LAYER_PRESET APPEARANCE_CONTROLS::presetBack( _( "Back Layers" ), +LAYER_PRESET APPEARANCE_CONTROLS::presetBack( _HKI( "Back Layers" ), LSET::BackMask().set( Edge_Cuts ) ); -LAYER_PRESET APPEARANCE_CONTROLS::presetBackAssembly( _( "Back Assembly View" ), +LAYER_PRESET APPEARANCE_CONTROLS::presetBackAssembly( _HKI( "Back Assembly View" ), LSET::BackAssembly().set( Edge_Cuts ), GAL_SET::DefaultVisible(), B_SilkS ); @@ -973,6 +973,30 @@ void APPEARANCE_CONTROLS::OnNetGridMouseEvent( wxMouseEvent& aEvent ) } +void APPEARANCE_CONTROLS::OnLanguageChanged() +{ + m_notebook->SetPageText( 0, _( "Layers" ) ); + m_notebook->SetPageText( 1, _( "Objects" ) ); + m_notebook->SetPageText( 2, _( "Nets" ) ); + + Freeze(); + rebuildLayers(); + rebuildLayerContextMenu(); + rebuildLayerPresetsWidget(); + rebuildObjects(); + rebuildNets(); + + syncColorsAndVisibility(); + syncObjectSettings(); + syncLayerPresetSelection(); + + UpdateDisplayOptions(); + + Thaw(); + Refresh(); +} + + void APPEARANCE_CONTROLS::OnBoardChanged() { Freeze(); @@ -1520,33 +1544,33 @@ void APPEARANCE_CONTROLS::rebuildLayers() PCB_LAYER_ID layerId; wxString tooltip; } non_cu_seq[] = { - { F_Adhes, _( "Adhesive on board's front" ) }, - { B_Adhes, _( "Adhesive on board's back" ) }, - { F_Paste, _( "Solder paste on board's front" ) }, - { B_Paste, _( "Solder paste on board's back" ) }, - { F_SilkS, _( "Silkscreen on board's front" ) }, - { B_SilkS, _( "Silkscreen on board's back" ) }, - { F_Mask, _( "Solder mask on board's front" ) }, - { B_Mask, _( "Solder mask on board's back" ) }, - { Dwgs_User, _( "Explanatory drawings" ) }, - { Cmts_User, _( "Explanatory comments" ) }, - { Eco1_User, _( "User defined meaning" ) }, - { Eco2_User, _( "User defined meaning" ) }, - { Edge_Cuts, _( "Board's perimeter definition" ) }, - { Margin, _( "Board's edge setback outline" ) }, - { F_CrtYd, _( "Footprint courtyards on board's front" ) }, - { B_CrtYd, _( "Footprint courtyards on board's back" ) }, - { F_Fab, _( "Footprint assembly on board's front" ) }, - { B_Fab, _( "Footprint assembly on board's back" ) }, - { User_1, _( "User defined layer 1" ) }, - { User_2, _( "User defined layer 2" ) }, - { User_3, _( "User defined layer 3" ) }, - { User_4, _( "User defined layer 4" ) }, - { User_5, _( "User defined layer 5" ) }, - { User_6, _( "User defined layer 6" ) }, - { User_7, _( "User defined layer 7" ) }, - { User_8, _( "User defined layer 8" ) }, - { User_9, _( "User defined layer 9" ) }, + { F_Adhes, _HKI( "Adhesive on board's front" ) }, + { B_Adhes, _HKI( "Adhesive on board's back" ) }, + { F_Paste, _HKI( "Solder paste on board's front" ) }, + { B_Paste, _HKI( "Solder paste on board's back" ) }, + { F_SilkS, _HKI( "Silkscreen on board's front" ) }, + { B_SilkS, _HKI( "Silkscreen on board's back" ) }, + { F_Mask, _HKI( "Solder mask on board's front" ) }, + { B_Mask, _HKI( "Solder mask on board's back" ) }, + { Dwgs_User, _HKI( "Explanatory drawings" ) }, + { Cmts_User, _HKI( "Explanatory comments" ) }, + { Eco1_User, _HKI( "User defined meaning" ) }, + { Eco2_User, _HKI( "User defined meaning" ) }, + { Edge_Cuts, _HKI( "Board's perimeter definition" ) }, + { Margin, _HKI( "Board's edge setback outline" ) }, + { F_CrtYd, _HKI( "Footprint courtyards on board's front" ) }, + { B_CrtYd, _HKI( "Footprint courtyards on board's back" ) }, + { F_Fab, _HKI( "Footprint assembly on board's front" ) }, + { B_Fab, _HKI( "Footprint assembly on board's back" ) }, + { User_1, _HKI( "User defined layer 1" ) }, + { User_2, _HKI( "User defined layer 2" ) }, + { User_3, _HKI( "User defined layer 3" ) }, + { User_4, _HKI( "User defined layer 4" ) }, + { User_5, _HKI( "User defined layer 5" ) }, + { User_6, _HKI( "User defined layer 6" ) }, + { User_7, _HKI( "User defined layer 7" ) }, + { User_8, _HKI( "User defined layer 8" ) }, + { User_9, _HKI( "User defined layer 9" ) }, }; // There is a spacer added to the end of the list that we need to remove and re-add @@ -1630,7 +1654,9 @@ void APPEARANCE_CONTROLS::rebuildLayers() setting->label = board->GetLayerName( layer ); setting->id = layer; - setting->tooltip = entry.tooltip; + // Because non_cu_seq is created static, we must explicitly call wxGetTranslation for + // texts which are internationalized + setting->tooltip = wxGetTranslation( entry.tooltip ); if( setting->ctl_panel == nullptr ) appendLayer( setting ); @@ -1651,6 +1677,19 @@ void APPEARANCE_CONTROLS::rebuildLayers() m_layersOuterSizer->AddSpacer( 10 ); m_windowLayers->SetBackgroundColour( m_layerPanelColour ); m_windowLayers->Layout(); + + m_paneLayerDisplayOptions->SetLabel( _( "Layer Display Options" ) ); + + m_rbHighContrastNormal->SetLabel( _( "Normal" ) ); + m_rbHighContrastNormal->SetToolTip( _( "Inactive layers will be shown in full color" ) ); + + m_rbHighContrastDim->SetLabel( _( "Dim" ) ); + m_rbHighContrastDim->SetToolTip( _( "Inactive layers will be dimmed" ) ); + + m_rbHighContrastOff->SetLabel( _( "Hide" ) ); + m_rbHighContrastOff->SetToolTip( _( "Inactive layers will be hidden" ) ); + + m_cbFlipBoard->SetLabel( _( "Flip board view" ) ); } @@ -2118,9 +2157,8 @@ void APPEARANCE_CONTROLS::rebuildObjects() std::unique_ptr& setting = m_objectSettings.back(); - // Because s_render_rows is created static, we must explicitly call - // wxGetTranslation for texts which are internationalized (tool tips - // and item names) + // Because s_render_rows is created static, we must explicitly call wxGetTranslation + // for texts which are internationalized (tool tips and item names) setting->tooltip = wxGetTranslation( s_setting.tooltip ); setting->label = wxGetTranslation( s_setting.label ); @@ -2191,6 +2229,9 @@ void APPEARANCE_CONTROLS::rebuildNets() if( !board->GetProject() ) return; + m_staticTextNets->SetLabel( _( "Nets" ) ); + m_staticTextNetClasses->SetLabel( _( "Net Classes" ) ); + KIGFX::PCB_RENDER_SETTINGS* rs = static_cast( m_frame->GetCanvas()->GetView()->GetPainter()->GetSettings() ); @@ -2323,6 +2364,49 @@ void APPEARANCE_CONTROLS::rebuildNets() appendNetclass( idx++, classes.at( name ) ); } + int hotkey; + wxString msg; + + m_paneNetDisplayOptions->SetLabel( _( "Net Display Options" ) ); + + hotkey = PCB_ACTIONS::netColorModeCycle.GetHotKey(); + + if( hotkey ) + msg = wxString::Format( _( "Net colors (%s):" ), KeyNameFromKeyCode( hotkey ) ); + else + msg = _( "Net colors:" ); + + m_txtNetDisplayTitle->SetLabel( msg ); + m_txtNetDisplayTitle->SetToolTip( _( "Choose when to show net and netclass colors" ) ); + + m_rbNetColorAll->SetLabel( _( "All" ) ); + m_rbNetColorAll->SetToolTip( _( "Net and netclass colors are shown on all copper items" ) ); + + m_rbNetColorRatsnest->SetLabel( _( "Ratsnest" ) ); + m_rbNetColorRatsnest->SetToolTip( _( "Net and netclass colors are shown on the ratsnest only" ) ); + + m_rbNetColorOff->SetLabel( _( "None" ) ); + m_rbNetColorOff->SetToolTip( _( "Net and netclass colors are not shown" ) ); + + hotkey = PCB_ACTIONS::ratsnestModeCycle.GetHotKey(); + + if( hotkey ) + msg = wxString::Format( _( "Ratsnest display (%s):" ), KeyNameFromKeyCode( hotkey ) ); + else + msg = _( "Ratsnest display:" ); + + m_txtRatsnestVisibility->SetLabel( msg ); + m_txtRatsnestVisibility->SetToolTip( _( "Choose which ratsnest lines to display" ) ); + + m_rbRatsnestAllLayers->SetLabel( _( "All" ) ); + m_rbRatsnestAllLayers->SetToolTip( _( "Show ratsnest lines to items on all layers" ) ); + + m_rbRatsnestVisLayers->SetLabel( _( "Visible layers" ) ); + m_rbRatsnestVisLayers->SetToolTip( _( "Show ratsnest lines to items on visible layers" ) ); + + m_rbRatsnestNone->SetLabel( _( "None" ) ); + m_rbRatsnestNone->SetToolTip( _( "Hide all ratsnest lines" ) ); + m_netclassOuterSizer->Layout(); m_netsTable->Rebuild(); @@ -2332,10 +2416,15 @@ void APPEARANCE_CONTROLS::rebuildNets() void APPEARANCE_CONTROLS::rebuildLayerPresetsWidget() { + m_presetsLabel->SetLabel( _( "Presets (Ctrl+Tab):" ) ); + m_cbLayerPresets->Clear(); for( std::pair& pair : m_layerPresets ) - m_cbLayerPresets->Append( pair.first, static_cast( &pair.second ) ); + { + m_cbLayerPresets->Append( wxGetTranslation( pair.first ), + static_cast( &pair.second ) ); + } m_cbLayerPresets->Append( wxT( "-----" ) ); m_cbLayerPresets->Append( _( "Save preset..." ) ); diff --git a/pcbnew/widgets/appearance_controls.h b/pcbnew/widgets/appearance_controls.h index a168eddc20..66cd4903fc 100644 --- a/pcbnew/widgets/appearance_controls.h +++ b/pcbnew/widgets/appearance_controls.h @@ -199,6 +199,8 @@ public: wxSize GetBestSize() const; + void OnLanguageChanged(); + ///< Update the panel contents from the application and board models. void OnBoardChanged(); diff --git a/pcbnew/widgets/panel_selection_filter.cpp b/pcbnew/widgets/panel_selection_filter.cpp index bb69820e2c..d17c25a4bf 100644 --- a/pcbnew/widgets/panel_selection_filter.cpp +++ b/pcbnew/widgets/panel_selection_filter.cpp @@ -176,3 +176,23 @@ void PANEL_SELECTION_FILTER::onPopupSelection( wxCommandEvent& aEvent ) wxCommandEvent dummy; OnFilterChanged( dummy ); } + + +void PANEL_SELECTION_FILTER::OnLanguageChanged() +{ + m_cbAllItems->SetLabel( _("All items") ); + m_cbLockedItems->SetLabel( _("Locked items") ); + m_cbLockedItems->SetToolTip( _("Allow selection of locked items") ); + m_cbFootprints->SetLabel( _("Footprints") ); + m_cbText->SetLabel( _("Text") ); + m_cbTracks->SetLabel( _("Tracks") ); + m_cbVias->SetLabel( _("Vias") ); + m_cbPads->SetLabel( _("Pads") ); + m_cbGraphics->SetLabel( _("Graphics") ); + m_cbZones->SetLabel( _("Zones") ); + m_cbKeepouts->SetLabel( _("Rule Areas") ); + m_cbDimensions->SetLabel( _("Dimensions") ); + m_cbOtherItems->SetLabel( _("Other items") ); + + m_cbAllItems->GetParent()->Layout(); +} \ No newline at end of file diff --git a/pcbnew/widgets/panel_selection_filter.h b/pcbnew/widgets/panel_selection_filter.h index f09bb07ff3..835b446095 100644 --- a/pcbnew/widgets/panel_selection_filter.h +++ b/pcbnew/widgets/panel_selection_filter.h @@ -37,6 +37,8 @@ public: void SetCheckboxesFromFilter( SELECTION_FILTER_OPTIONS& aOptions ); + void OnLanguageChanged(); + protected: void OnFilterChanged( wxCommandEvent& aEvent ) override;