KiCad PCB EDA Suite
eeschema/menubar.cpp File Reference
#include <filehistory.h>
#include <kiface_i.h>
#include <menus_helpers.h>
#include <pgm_base.h>
#include <tool/conditional_menu.h>
#include <tool/tool_manager.h>
#include <tools/ee_selection_tool.h>
#include <tools/ee_actions.h>
#include "eeschema_id.h"
#include "sch_edit_frame.h"

Go to the source code of this file.


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...

Function Documentation

◆ AddMenuLanguageList()

void AddMenuLanguageList ( CONDITIONAL_MENU aMasterMenu,

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

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;
58  auto isCurrentLang = [] ( int aLangIdentifier ) {
59  return Pgm().GetSelectedLanguageIdentifier() == aLangIdentifier;
60  };
62  for( unsigned ii = 0; LanguagesList[ii].m_KI_Lang_Identifier != 0; ii++ )
63  {
64  wxString label;
66  if( LanguagesList[ii].m_DoNotTranslate )
67  label = LanguagesList[ii].m_Lang_Label;
68  else
69  label = wxGetTranslation( LanguagesList[ii].m_Lang_Label );
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()
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()
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
LANGUAGE_DESCR LanguagesList[]
Definition: pgm_base.cpp:80
VTBL_ENTRY int GetSelectedLanguageIdentifier() const
Definition: pgm_base.h:272
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
#define _(s)
void SetTitle(const wxString &aTitle) override
Function SetTitle() Sets title for the menu.
Definition: action_menu.cpp:86

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