From aa0ae48dda4a61b7b072166f5b46cb5733bd55b1 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 3 Feb 2018 22:55:13 +0000 Subject: [PATCH] Update status bar and toolbars on language change. Fixes: lp:1392582 * https://bugs.launchpad.net/kicad/+bug/1392582 Fixes: lp:1748428 * https://bugs.launchpad.net/kicad/+bug/1748428 --- cvpcb/cvpcb_mainframe.cpp | 8 ++++++++ cvpcb/cvpcb_mainframe.h | 1 + cvpcb/display_footprints_frame.h | 2 +- include/pcb_base_frame.h | 4 ++-- pcbnew/footprint_edit_frame.h | 2 +- pcbnew/pcb_base_frame.cpp | 16 ++++++++++++++++ pcbnew/pcb_edit_frame.cpp | 17 +++++++++++++++-- pcbnew/pcb_edit_frame.h | 2 +- 8 files changed, 45 insertions(+), 7 deletions(-) diff --git a/cvpcb/cvpcb_mainframe.cpp b/cvpcb/cvpcb_mainframe.cpp index 6919398773..8add18ff6f 100644 --- a/cvpcb/cvpcb_mainframe.cpp +++ b/cvpcb/cvpcb_mainframe.cpp @@ -954,6 +954,14 @@ void CVPCB_MAINFRAME::OnConfigurePaths( wxCommandEvent& aEvent ) } +void CVPCB_MAINFRAME::ShowChangedLanguage() +{ + EDA_BASE_FRAME::ShowChangedLanguage(); + ReCreateHToolbar(); + DisplayStatus(); +} + + void CVPCB_MAINFRAME::KiwayMailIn( KIWAY_EXPRESS& mail ) { const std::string& payload = mail.GetPayload(); diff --git a/cvpcb/cvpcb_mainframe.h b/cvpcb/cvpcb_mainframe.h index 0891e730be..9916f8e9e0 100644 --- a/cvpcb/cvpcb_mainframe.h +++ b/cvpcb/cvpcb_mainframe.h @@ -116,6 +116,7 @@ public: void OnSize( wxSizeEvent& SizeEvent ); void ReCreateHToolbar(); virtual void ReCreateMenuBar() override; + void ShowChangedLanguage() override; void ChangeFocus( bool aMoveRight ); diff --git a/cvpcb/display_footprints_frame.h b/cvpcb/display_footprints_frame.h index 68fb1e4d4f..a823531abd 100644 --- a/cvpcb/display_footprints_frame.h +++ b/cvpcb/display_footprints_frame.h @@ -54,7 +54,7 @@ public: void ReCreateHToolbar() override; void ReCreateVToolbar() override; - void ReCreateOptToolbar(); + void ReCreateOptToolbar() override; void RecreateMenuBar(); void OnSelectOptionToolbar( wxCommandEvent& event ); diff --git a/include/pcb_base_frame.h b/include/pcb_base_frame.h index 822cf79163..4fedce8dc5 100644 --- a/include/pcb_base_frame.h +++ b/include/pcb_base_frame.h @@ -187,11 +187,11 @@ public: // General virtual void OnCloseWindow( wxCloseEvent& Event ) = 0; virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override { } - virtual void ReCreateHToolbar() override = 0; - virtual void ReCreateVToolbar() override = 0; + virtual void ReCreateOptToolbar() { } virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) override = 0; virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) override = 0; virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) override = 0; + virtual void ShowChangedLanguage() override; virtual void ReCreateMenuBar() override; virtual void SetToolID( int aId, int aCursor, const wxString& aToolMsg ) override; virtual void UpdateStatusBar() override; diff --git a/pcbnew/footprint_edit_frame.h b/pcbnew/footprint_edit_frame.h index 13e5a71e4a..6ec2930b00 100644 --- a/pcbnew/footprint_edit_frame.h +++ b/pcbnew/footprint_edit_frame.h @@ -102,7 +102,7 @@ public: void ReCreateHToolbar() override; void ReCreateVToolbar() override; - void ReCreateOptToolbar(); + void ReCreateOptToolbar() override; void ReCreateAuxiliaryToolbar() override; void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) override; diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp index 7db183b600..5e6aada4e9 100644 --- a/pcbnew/pcb_base_frame.cpp +++ b/pcbnew/pcb_base_frame.cpp @@ -386,6 +386,22 @@ void PCB_BASE_FRAME::ReCreateMenuBar( void ) } +void PCB_BASE_FRAME::ShowChangedLanguage() +{ + // call my base class + EDA_DRAW_FRAME::ShowChangedLanguage(); + + // tooltips in toolbars + ReCreateHToolbar(); + ReCreateAuxiliaryToolbar(); + ReCreateVToolbar(); + ReCreateOptToolbar(); + + // status bar + UpdateMsgPanel(); +} + + // Virtual functions: Do nothing for PCB_BASE_FRAME window void PCB_BASE_FRAME::Show3D_Frame( wxCommandEvent& event ) { diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index cf62e3de6d..10f27f63b8 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -1032,13 +1032,26 @@ void PCB_EDIT_FRAME::ShowChangedLanguage() // call my base class PCB_BASE_FRAME::ShowChangedLanguage(); - m_Layers->SetLayersManagerTabsText(); + // update the layer manager + m_Layers->Freeze(); wxAuiPaneInfo& pane_info = m_auimgr.GetPane( m_Layers ); - pane_info.Caption( _( "Visibles" ) ); m_auimgr.Update(); + + m_Layers->SetLayersManagerTabsText(); ReFillLayerWidget(); + m_Layers->ReFillRender(); + + // upate the layer widget to match board visibility states, both layers and render columns. + syncLayerVisibilities(); + syncLayerWidgetLayer(); + syncRenderStates(); + + m_Layers->Thaw(); + + // pcbnew-specific toolbars + ReCreateMicrowaveVToolbar(); } diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index 6493e95db3..c84c486c7a 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -581,7 +581,7 @@ public: void ReCreateAuxiliaryToolbar() override; void ReCreateVToolbar() override; void ReCreateMicrowaveVToolbar(); - void ReCreateOptToolbar(); + void ReCreateOptToolbar() override; void ReCreateMenuBar() override; /**