KiCad PCB EDA Suite
languages_menu.cpp File Reference

build the standard menu to show the list of available translations More...

#include <fctsys.h>
#include <pgm_base.h>
#include <id.h>
#include <tool/tool_interactive.h>
#include <tool/conditional_menu.h>
#include <bitmaps.h>

Go to the source code of this file.

Functions

void AddMenuLanguageList (CONDITIONAL_MENU *aMasterMenu, TOOL_INTERACTIVE *aControlTool)
 Function AddMenuLanguageList creates a menu list for language choice, and add it as submenu to MasterMenu. More...
 

Variables

LANGUAGE_DESCR LanguagesList []
 

Detailed Description

build the standard menu to show the list of available translations

Definition in file languages_menu.cpp.

Function Documentation

◆ AddMenuLanguageList()

void AddMenuLanguageList ( CONDITIONAL_MENU aMasterMenu,
TOOL_INTERACTIVE aControlTool 
)

Function AddMenuLanguageList creates a menu list for language choice, and add it as submenu to MasterMenu.

Parameters
aMasterMenuThe main menu.

Definition at line 50 of file languages_menu.cpp.

51 {
52  CONDITIONAL_MENU* langsMenu = new CONDITIONAL_MENU( false, aControlTool );
53  langsMenu->SetTitle( _( "Set Language" ) );
54  langsMenu->SetIcon( language_xpm );
55  aMasterMenu->AddMenu( langsMenu );
56  wxString tooltip;
57 
58  auto isCurrentLang = [] ( int aLangIdentifier ) {
59  return Pgm().GetSelectedLanguageIdentifier() == aLangIdentifier;
60  };
61 
62  for( unsigned ii = 0; LanguagesList[ii].m_KI_Lang_Identifier != 0; ii++ )
63  {
64  wxString label;
65 
66  if( LanguagesList[ii].m_DoNotTranslate )
67  label = LanguagesList[ii].m_Lang_Label;
68  else
69  label = wxGetTranslation( LanguagesList[ii].m_Lang_Label );
70 
71  langsMenu->AddCheckItem( LanguagesList[ii].m_KI_Lang_Identifier, // wxMenuItem wxID
72  label, tooltip, LanguagesList[ii].m_Lang_Icon,
73  std::bind( isCurrentLang, LanguagesList[ii].m_WX_Lang_Identifier ) );
74  }
75 }
void AddMenu(ACTION_MENU *aMenu, const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Function AddMenu()
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:98
int m_KI_Lang_Identifier
KiCad identifier used in menu selection (See id.h)
Definition: pgm_base.h:83
void AddCheckItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Function AddCheckItem()
LANGUAGE_DESCR LanguagesList[]
Definition: pgm_base.cpp:80
void SetIcon(const BITMAP_OPAQUE *aIcon)
Function SetIcon() Assigns an icon for the entry.
Definition: action_menu.cpp:68
wxString m_Lang_Label
Labels used in menus.
Definition: pgm_base.h:89
const BITMAP_OPAQUE language_xpm[1]
Definition: language.cpp:104
void SetTitle(const wxString &aTitle) override
Function SetTitle() Sets title for the menu.
Definition: action_menu.cpp:86
#define _(s)
Definition: 3d_actions.cpp:31

References _, CONDITIONAL_MENU::AddCheckItem(), CONDITIONAL_MENU::AddMenu(), language_xpm, LanguagesList, LANGUAGE_DESCR::m_KI_Lang_Identifier, LANGUAGE_DESCR::m_Lang_Label, Pgm(), ACTION_MENU::SetIcon(), and ACTION_MENU::SetTitle().

Referenced by KICAD_MANAGER_FRAME::ReCreateMenuBar(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), LIB_EDIT_FRAME::ReCreateMenuBar(), CVPCB_MAINFRAME::ReCreateMenuBar(), GERBVIEW_FRAME::ReCreateMenuBar(), SCH_EDIT_FRAME::ReCreateMenuBar(), and PCB_EDIT_FRAME::ReCreateMenuBar().

Variable Documentation

◆ LanguagesList

LANGUAGE_DESCR LanguagesList[]