Move APPEARANCE_CONTROLS_3D to the lang change event

This commit is contained in:
Marek Roszko 2024-03-03 14:16:40 -05:00
parent 85b1978408
commit 16953edf6d
3 changed files with 16 additions and 6 deletions

View File

@ -658,8 +658,6 @@ void EDA_3D_VIEWER_FRAME::ShowChangedLanguage()
{ {
wxAuiPaneInfo& lm_pane_info = m_auimgr.GetPane( m_appearancePanel ); wxAuiPaneInfo& lm_pane_info = m_auimgr.GetPane( m_appearancePanel );
lm_pane_info.Caption( _( "Appearance" ) ); lm_pane_info.Caption( _( "Appearance" ) );
m_appearancePanel->OnLanguageChanged();
} }
SetStatusText( wxEmptyString, ACTIVITY ); SetStatusText( wxEmptyString, ACTIVITY );

View File

@ -153,11 +153,14 @@ APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent,
m_toggleGridRenderer = new GRID_BITMAP_TOGGLE_RENDERER( KiBitmap( BITMAPS::visibility ), m_toggleGridRenderer = new GRID_BITMAP_TOGGLE_RENDERER( KiBitmap( BITMAPS::visibility ),
KiBitmap( BITMAPS::visibility_off ) ); KiBitmap( BITMAPS::visibility_off ) );
m_frame->Bind( EDA_LANG_CHANGED, &APPEARANCE_CONTROLS_3D::OnLanguageChanged, this );
} }
APPEARANCE_CONTROLS_3D::~APPEARANCE_CONTROLS_3D() APPEARANCE_CONTROLS_3D::~APPEARANCE_CONTROLS_3D()
{ {
m_frame->Unbind( EDA_LANG_CHANGED, &APPEARANCE_CONTROLS_3D::OnLanguageChanged, this );
} }
@ -192,7 +195,7 @@ void APPEARANCE_CONTROLS_3D::OnSize( wxSizeEvent& aEvent )
} }
void APPEARANCE_CONTROLS_3D::OnLanguageChanged() void APPEARANCE_CONTROLS_3D::rebuildControls()
{ {
Freeze(); Freeze();
@ -206,6 +209,14 @@ void APPEARANCE_CONTROLS_3D::OnLanguageChanged()
} }
void APPEARANCE_CONTROLS_3D::OnLanguageChanged( wxCommandEvent& aEvent )
{
rebuildControls();
aEvent.Skip();
}
void APPEARANCE_CONTROLS_3D::OnDarkModeToggle() void APPEARANCE_CONTROLS_3D::OnDarkModeToggle()
{ {
// This is essentially a list of hacks because DarkMode isn't yet implemented inside // This is essentially a list of hacks because DarkMode isn't yet implemented inside
@ -229,7 +240,7 @@ void APPEARANCE_CONTROLS_3D::OnDarkModeToggle()
void APPEARANCE_CONTROLS_3D::CommonSettingsChanged() void APPEARANCE_CONTROLS_3D::CommonSettingsChanged()
{ {
OnLanguageChanged(); rebuildControls();
UpdateLayerCtls(); UpdateLayerCtls();
syncLayerPresetSelection(); syncLayerPresetSelection();

View File

@ -114,8 +114,6 @@ public:
~APPEARANCE_CONTROLS_3D(); ~APPEARANCE_CONTROLS_3D();
wxSize GetBestSize() const; wxSize GetBestSize() const;
void OnLanguageChanged();
void OnDarkModeToggle(); void OnDarkModeToggle();
void OnLayerVisibilityChanged( int aLayer, bool isVisible ); void OnLayerVisibilityChanged( int aLayer, bool isVisible );
@ -140,8 +138,11 @@ public:
protected: protected:
void OnSetFocus( wxFocusEvent& aEvent ) override; void OnSetFocus( wxFocusEvent& aEvent ) override;
void OnSize( wxSizeEvent& aEvent ) override; void OnSize( wxSizeEvent& aEvent ) override;
void OnLanguageChanged( wxCommandEvent& aEvent );
private: private:
void rebuildControls();
void rebuildLayers(); void rebuildLayers();
void rebuildLayerPresetsWidget(); void rebuildLayerPresetsWidget();