Make symbol/footprint trees sensitive to language change.

(cherry picked from commit eef3492fc0)
This commit is contained in:
Jeff Young 2023-04-11 23:51:27 +01:00
parent 724262651f
commit 1f34883a27
8 changed files with 35 additions and 9 deletions

View File

@ -613,8 +613,8 @@ void EDA_DRAW_FRAME::DisplayGridMsg()
{
wxString msg;
msg.Printf( wxS( "grid %s" ), MessageTextFromValue( GetCanvas()->GetGAL()->GetGridSize().x,
false ) );
msg.Printf( _( "grid %s" ), MessageTextFromValue( GetCanvas()->GetGAL()->GetGridSize().x,
false ) );
SetStatusText( msg, 4 );
}

View File

@ -269,7 +269,7 @@ void LIB_TREE_MODEL_ADAPTER::recreateColumns()
for( const wxString& colName : m_shownColumns )
{
if( !m_colNameMap.count( colName ) )
doAddColumn( colName, false );
doAddColumn( colName, colName == wxT( "Description" ) );
}
}

View File

@ -185,6 +185,16 @@ LIB_TREE::~LIB_TREE()
}
void LIB_TREE::ShowChangedLanguage()
{
if( m_query_ctrl )
m_query_ctrl->SetDescriptiveText( _( "Filter" ) );
if( m_adapter )
m_adapter->ShowChangedLanguage();
}
LIB_ID LIB_TREE::GetSelectedLibId( int* aUnit ) const
{
wxDataViewItem sel = m_tree_ctrl->GetSelection();

View File

@ -1199,6 +1199,16 @@ void SYMBOL_EDIT_FRAME::ShowChangedLanguage()
// tooltips in toolbars
RecreateToolbars();
// For some obscure reason, the AUI manager hides the first modified pane.
// So force show panes
wxAuiPaneInfo& tree_pane_info = m_auimgr.GetPane( m_treePane );
bool tree_shown = tree_pane_info.IsShown();
tree_pane_info.Caption( _( "Libraries" ) );
tree_pane_info.Show( tree_shown );
m_auimgr.Update();
m_treePane->GetLibTree()->ShowChangedLanguage();
// status bar
UpdateMsgPanel();

View File

@ -181,11 +181,6 @@ public:
const std::vector<LIB_TREE_ITEM*>& aItemList,
bool pinned, bool presorted );
void AddColumn( const wxString& aHeader )
{
doAddColumn( aHeader, false );
}
std::vector<wxString> GetAvailableColumns() const { return m_availableColumns; }
std::vector<wxString> GetShownColumns() const { return m_shownColumns; }
@ -303,6 +298,11 @@ public:
void PinLibrary( LIB_TREE_NODE* aTreeNode );
void UnpinLibrary( LIB_TREE_NODE* aTreeNode );
void ShowChangedLanguage()
{
recreateColumns();
}
protected:
/**
* Convert #SYM_TREE_NODE -> wxDataViewItem.

View File

@ -144,6 +144,8 @@ public:
*/
void FocusSearchFieldIfExists();
void ShowChangedLanguage();
protected:
/**
* Expand or collapse a node, switching it to the opposite state.

View File

@ -873,6 +873,8 @@ void FOOTPRINT_EDIT_FRAME::ShowChangedLanguage()
tree_pane_info.Show( tree_shown );
m_auimgr.Update();
m_treePane->GetLibTree()->ShowChangedLanguage();
UpdateTitle();
}

View File

@ -1005,7 +1005,9 @@ void APPEARANCE_CONTROLS::OnLanguageChanged()
{
m_notebook->SetPageText( 0, _( "Layers" ) );
m_notebook->SetPageText( 1, _( "Objects" ) );
m_notebook->SetPageText( 2, _( "Nets" ) );
if( m_notebook->GetPageCount() >= 3 )
m_notebook->SetPageText( 2, _( "Nets" ) );
Freeze();
rebuildLayers();