Ensure "Open Recent" and "Clear files" menu titles are updated after language change.
This commit is contained in:
parent
403992a6f4
commit
ac8e2d0768
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019 Ian McInerney <Ian.S.McInerney@ieee.org>
|
* Copyright (C) 2019 Ian McInerney <Ian.S.McInerney@ieee.org>
|
||||||
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -165,6 +165,18 @@ void FILE_HISTORY::doAddClearItem( wxMenu* aMenu )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FILE_HISTORY::UpdateClearText( wxMenu* aMenu, wxString aClearText )
|
||||||
|
{
|
||||||
|
size_t itemPos;
|
||||||
|
wxMenuItem* clearItem = aMenu->FindChildItem( m_clearId, &itemPos );
|
||||||
|
|
||||||
|
if( clearItem && itemPos > 1 ) // clearItem is the last menu, after a separator
|
||||||
|
{
|
||||||
|
clearItem->SetItemLabel( aClearText );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void FILE_HISTORY::ClearFileHistory()
|
void FILE_HISTORY::ClearFileHistory()
|
||||||
{
|
{
|
||||||
while( GetCount() > 0 )
|
while( GetCount() > 0 )
|
||||||
|
|
|
@ -62,13 +62,15 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
||||||
if( !openRecentMenu )
|
if( !openRecentMenu )
|
||||||
{
|
{
|
||||||
openRecentMenu = new ACTION_MENU( false, selTool );
|
openRecentMenu = new ACTION_MENU( false, selTool );
|
||||||
openRecentMenu->SetTitle( _( "Open Recent" ) );
|
|
||||||
openRecentMenu->SetIcon( BITMAPS::recent );
|
openRecentMenu->SetIcon( BITMAPS::recent );
|
||||||
|
|
||||||
fileHistory.UseMenu( openRecentMenu );
|
fileHistory.UseMenu( openRecentMenu );
|
||||||
fileHistory.AddFilesToMenu( openRecentMenu );
|
fileHistory.AddFilesToMenu( openRecentMenu );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure the title is up to date after changing language
|
||||||
|
openRecentMenu->SetTitle( _( "Open Recent" ) );
|
||||||
|
|
||||||
fileMenu->Add( ACTIONS::doNew );
|
fileMenu->Add( ACTIONS::doNew );
|
||||||
fileMenu->Add( ACTIONS::open );
|
fileMenu->Add( ACTIONS::open );
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com>
|
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -64,14 +64,17 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
||||||
if( !openRecentGbrMenu )
|
if( !openRecentGbrMenu )
|
||||||
{
|
{
|
||||||
openRecentGbrMenu = new ACTION_MENU( false, selTool );
|
openRecentGbrMenu = new ACTION_MENU( false, selTool );
|
||||||
openRecentGbrMenu->SetTitle( _( "Open Recent Gerber File" ) );
|
|
||||||
openRecentGbrMenu->SetIcon( BITMAPS::recent );
|
openRecentGbrMenu->SetIcon( BITMAPS::recent );
|
||||||
|
|
||||||
recentGbrFiles.UseMenu( openRecentGbrMenu );
|
|
||||||
recentGbrFiles.SetClearText( _( "Clear Recent Gerber Files" ) );
|
recentGbrFiles.SetClearText( _( "Clear Recent Gerber Files" ) );
|
||||||
|
recentGbrFiles.UseMenu( openRecentGbrMenu );
|
||||||
recentGbrFiles.AddFilesToMenu();
|
recentGbrFiles.AddFilesToMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure the title is up to date after changing language
|
||||||
|
openRecentGbrMenu->SetTitle( _( "Open Recent Gerber File" ) );
|
||||||
|
recentGbrFiles.UpdateClearText( openRecentGbrMenu, _( "Clear Recent Gerber Files" ) );
|
||||||
|
|
||||||
fileMenu->Add( GERBVIEW_ACTIONS::openAutodetected );
|
fileMenu->Add( GERBVIEW_ACTIONS::openAutodetected );
|
||||||
fileMenu->Add( GERBVIEW_ACTIONS::openGerber );
|
fileMenu->Add( GERBVIEW_ACTIONS::openGerber );
|
||||||
wxMenuItem* gbrItem = fileMenu->Add( openRecentGbrMenu->Clone() );
|
wxMenuItem* gbrItem = fileMenu->Add( openRecentGbrMenu->Clone() );
|
||||||
|
@ -91,6 +94,10 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
||||||
m_drillFileHistory.AddFilesToMenu();
|
m_drillFileHistory.AddFilesToMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure the title is up to date after changing language
|
||||||
|
openRecentGbrMenu->SetTitle( _( "Open Recent Gerber File" ) );
|
||||||
|
m_drillFileHistory.UpdateClearText( openRecentDrlMenu, _( "Clear Recent Drill Files" ) );
|
||||||
|
|
||||||
fileMenu->Add( GERBVIEW_ACTIONS::openDrillFile );
|
fileMenu->Add( GERBVIEW_ACTIONS::openDrillFile );
|
||||||
wxMenuItem* drillItem = fileMenu->Add( openRecentDrlMenu->Clone() );
|
wxMenuItem* drillItem = fileMenu->Add( openRecentDrlMenu->Clone() );
|
||||||
RegisterUIUpdateHandler( drillItem->GetId(), FileHistoryCond( m_drillFileHistory ) );
|
RegisterUIUpdateHandler( drillItem->GetId(), FileHistoryCond( m_drillFileHistory ) );
|
||||||
|
@ -101,14 +108,17 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
||||||
if( !openRecentJobMenu )
|
if( !openRecentJobMenu )
|
||||||
{
|
{
|
||||||
openRecentJobMenu = new ACTION_MENU( false, selTool );
|
openRecentJobMenu = new ACTION_MENU( false, selTool );
|
||||||
openRecentJobMenu->SetTitle( _( "Open Recent Job File" ) );
|
|
||||||
openRecentJobMenu->SetIcon( BITMAPS::recent );
|
openRecentJobMenu->SetIcon( BITMAPS::recent );
|
||||||
|
|
||||||
m_jobFileHistory.UseMenu( openRecentJobMenu );
|
|
||||||
m_jobFileHistory.SetClearText( _( "Clear Recent Job Files" ) );
|
m_jobFileHistory.SetClearText( _( "Clear Recent Job Files" ) );
|
||||||
|
m_jobFileHistory.UseMenu( openRecentJobMenu );
|
||||||
m_jobFileHistory.AddFilesToMenu();
|
m_jobFileHistory.AddFilesToMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure the title is up to date after changing language
|
||||||
|
openRecentJobMenu->SetTitle( _( "Open Recent Job File" ) );
|
||||||
|
m_jobFileHistory.UpdateClearText( openRecentJobMenu, _( "Clear Recent Job Files" ) );
|
||||||
|
|
||||||
fileMenu->Add( GERBVIEW_ACTIONS::openJobFile );
|
fileMenu->Add( GERBVIEW_ACTIONS::openJobFile );
|
||||||
wxMenuItem* jobItem = fileMenu->Add( openRecentJobMenu->Clone() );
|
wxMenuItem* jobItem = fileMenu->Add( openRecentJobMenu->Clone() );
|
||||||
RegisterUIUpdateHandler( jobItem->GetId(), FileHistoryCond( m_jobFileHistory ) );
|
RegisterUIUpdateHandler( jobItem->GetId(), FileHistoryCond( m_jobFileHistory ) );
|
||||||
|
@ -119,7 +129,6 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
||||||
if( !openRecentZipMenu )
|
if( !openRecentZipMenu )
|
||||||
{
|
{
|
||||||
openRecentZipMenu = new ACTION_MENU( false, selTool );
|
openRecentZipMenu = new ACTION_MENU( false, selTool );
|
||||||
openRecentZipMenu->SetTitle( _( "Open Recent Zip File" ) );
|
|
||||||
openRecentZipMenu->SetIcon( BITMAPS::recent );
|
openRecentZipMenu->SetIcon( BITMAPS::recent );
|
||||||
|
|
||||||
m_zipFileHistory.UseMenu( openRecentZipMenu );
|
m_zipFileHistory.UseMenu( openRecentZipMenu );
|
||||||
|
@ -127,6 +136,10 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
||||||
m_zipFileHistory.AddFilesToMenu();
|
m_zipFileHistory.AddFilesToMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure the title is up to date after changing language
|
||||||
|
openRecentZipMenu->SetTitle( _( "Open Recent Zip File" ) );
|
||||||
|
m_zipFileHistory.UpdateClearText( openRecentZipMenu, _( "Clear Recent Zip Files" ) );
|
||||||
|
|
||||||
fileMenu->Add( GERBVIEW_ACTIONS::openZipFile );
|
fileMenu->Add( GERBVIEW_ACTIONS::openZipFile );
|
||||||
wxMenuItem* zipItem = fileMenu->Add( openRecentZipMenu->Clone() );
|
wxMenuItem* zipItem = fileMenu->Add( openRecentZipMenu->Clone() );
|
||||||
RegisterUIUpdateHandler( zipItem->GetId(), FileHistoryCond( m_zipFileHistory ) );
|
RegisterUIUpdateHandler( zipItem->GetId(), FileHistoryCond( m_zipFileHistory ) );
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019 Ian McInerney <Ian.S.McInerney@ieee.org>
|
* Copyright (C) 2019 Ian McInerney <Ian.S.McInerney@ieee.org>
|
||||||
* Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -104,7 +104,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Add the files to the specified menu
|
* Add the files to the specified menu
|
||||||
*
|
*
|
||||||
* @aMenu is the menu to operate on.
|
* @param aMenu is the menu to operate on.
|
||||||
*/
|
*/
|
||||||
void AddFilesToMenu( wxMenu* aMenu ) override;
|
void AddFilesToMenu( wxMenu* aMenu ) override;
|
||||||
|
|
||||||
|
@ -125,6 +125,15 @@ public:
|
||||||
m_clearText = aClearText;
|
m_clearText = aClearText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the text displayed on the menu item that clears the entire menu.
|
||||||
|
* useful after language change.
|
||||||
|
*
|
||||||
|
* @param aMenu is the menu to operate on.
|
||||||
|
* @param aClearText is the new text to use for the menu item
|
||||||
|
*/
|
||||||
|
void UpdateClearText( wxMenu* aMenu, wxString aClearText );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear all entries from the file history.
|
* Clear all entries from the file history.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -62,13 +62,15 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
|
||||||
if( !openRecentMenu )
|
if( !openRecentMenu )
|
||||||
{
|
{
|
||||||
openRecentMenu = new ACTION_MENU( false, controlTool );
|
openRecentMenu = new ACTION_MENU( false, controlTool );
|
||||||
openRecentMenu->SetTitle( _( "Open Recent" ) );
|
|
||||||
openRecentMenu->SetIcon( BITMAPS::recent );
|
openRecentMenu->SetIcon( BITMAPS::recent );
|
||||||
|
|
||||||
fileHistory.UseMenu( openRecentMenu );
|
fileHistory.UseMenu( openRecentMenu );
|
||||||
fileHistory.AddFilesToMenu();
|
fileHistory.AddFilesToMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure the title is up to date after changing language
|
||||||
|
openRecentMenu->SetTitle( _( "Open Recent" ) );
|
||||||
|
|
||||||
fileMenu->Add( KICAD_MANAGER_ACTIONS::newProject );
|
fileMenu->Add( KICAD_MANAGER_ACTIONS::newProject );
|
||||||
fileMenu->Add( KICAD_MANAGER_ACTIONS::newFromTemplate );
|
fileMenu->Add( KICAD_MANAGER_ACTIONS::newFromTemplate );
|
||||||
|
|
||||||
|
|
|
@ -54,13 +54,15 @@ void PL_EDITOR_FRAME::ReCreateMenuBar()
|
||||||
if( !openRecentMenu )
|
if( !openRecentMenu )
|
||||||
{
|
{
|
||||||
openRecentMenu = new ACTION_MENU( false, selTool );
|
openRecentMenu = new ACTION_MENU( false, selTool );
|
||||||
openRecentMenu->SetTitle( _( "Open Recent" ) );
|
|
||||||
openRecentMenu->SetIcon( BITMAPS::recent );
|
openRecentMenu->SetIcon( BITMAPS::recent );
|
||||||
|
|
||||||
recentFiles.UseMenu( openRecentMenu );
|
recentFiles.UseMenu( openRecentMenu );
|
||||||
recentFiles.AddFilesToMenu();
|
recentFiles.AddFilesToMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure the title is up to date after changing language
|
||||||
|
openRecentMenu->SetTitle( _( "Open Recent" ) );
|
||||||
|
|
||||||
//-- File menu -------------------------------------------------------
|
//-- File menu -------------------------------------------------------
|
||||||
//
|
//
|
||||||
ACTION_MENU* fileMenu = new ACTION_MENU( false, selTool );
|
ACTION_MENU* fileMenu = new ACTION_MENU( false, selTool );
|
||||||
|
|
|
@ -64,13 +64,15 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
if( !openRecentMenu )
|
if( !openRecentMenu )
|
||||||
{
|
{
|
||||||
openRecentMenu = new ACTION_MENU( false, selTool );
|
openRecentMenu = new ACTION_MENU( false, selTool );
|
||||||
openRecentMenu->SetTitle( _( "Open Recent" ) );
|
|
||||||
openRecentMenu->SetIcon( BITMAPS::recent );
|
openRecentMenu->SetIcon( BITMAPS::recent );
|
||||||
|
|
||||||
fileHistory.UseMenu( openRecentMenu );
|
fileHistory.UseMenu( openRecentMenu );
|
||||||
fileHistory.AddFilesToMenu();
|
fileHistory.AddFilesToMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure the title is up to date after changing language
|
||||||
|
openRecentMenu->SetTitle( _( "Open Recent" ) );
|
||||||
|
|
||||||
fileMenu->Add( ACTIONS::doNew );
|
fileMenu->Add( ACTIONS::doNew );
|
||||||
fileMenu->Add( ACTIONS::open );
|
fileMenu->Add( ACTIONS::open );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue