<commit_before>	/*************************************************************/
	/* menubar.cpp  - create the menubar for the schematic frame */
	/*************************************************************/

#ifdef __GNUG__
#pragma implementation
#endif

#include "fctsys.h"
#include "common.h"

#include "program.h"
#include "libcmp.h"
#include "general.h"

#include "bitmaps.h"
#include "protos.h"
#include "id.h"
#include "hotkeys.h"


/************************************************/
void WinEDA_SchematicFrame::ReCreateMenuBar()
/************************************************/
/* create or update the menubar for the schematic frame
*/
{
int ii;
wxMenuBar * menuBar = GetMenuBar();
wxString msg;

	if( menuBar == NULL )
	{
		menuBar = new wxMenuBar();
			
		m_FilesMenu = new wxMenu;
		// Menu File:
		wxMenuItem *item = new wxMenuItem(m_FilesMenu, ID_NEW_PROJECT,
						_("&New"),
						_("New schematic") );
	    item->SetBitmap(new_xpm);
		m_FilesMenu->Append(item);

		item = new wxMenuItem(m_FilesMenu, ID_LOAD_PROJECT,
						_("&Open"),
						_("Open a schematic") );
	    item->SetBitmap(open_xpm);
		m_FilesMenu->Append(item);

		item = new wxMenuItem(m_FilesMenu, ID_LOAD_ONE_SHEET,
						_("&Reload the current sheet"),
						_("Load or reload a schematic file from file into the current sheet") );
	    item->SetBitmap(import_xpm);
		m_FilesMenu->Append(item);

		m_FilesMenu->AppendSeparator();
		item = new wxMenuItem(m_FilesMenu,ID_SAVE_PROJECT,
					 _("&Save"),
					 _("Save schematic project") );
	    item->SetBitmap(save_project_xpm);
		m_FilesMenu->Append(item);

		m_FilesMenu->AppendSeparator();
		item = new wxMenuItem(m_FilesMenu, ID_SAVE_ONE_SHEET,
					 _("Save &Current sheet"),
					 _("Save current sheet only") );
	    item->SetBitmap(save_xpm);
		m_FilesMenu->Append(item);

		item = new wxMenuItem(m_FilesMenu, ID_SAVE_ONE_SHEET_AS,
					 _("Save Current sheet &as.."),
					 _("Save current sheet as..") );
	    item->SetBitmap(save_as_xpm);
		m_FilesMenu->Append(item);

		/* Plot Menu */
		item = new wxMenuItem(m_FilesMenu, ID_GEN_PRINT,
					_("P&rint"), _("Print on current printer") );
	    item->SetBitmap(print_button);
		m_FilesMenu->Append(item);

		wxMenu *choice_plot_fmt = new wxMenu;
		item = new wxMenuItem(choice_plot_fmt, ID_GEN_PLOT_PS,
			_("Plot PostScript"), _("Plotting in PostScript format") );
	    item->SetBitmap(plot_PS_xpm);
		choice_plot_fmt->Append(item);

		item = new wxMenuItem(choice_plot_fmt, ID_GEN_PLOT_HPGL,
			_("Plot HPGL"), _("Plotting in HPGL format") );
	    item->SetBitmap(plot_HPG_xpm);
		choice_plot_fmt->Append(item);

		item = new wxMenuItem(choice_plot_fmt, ID_GEN_PLOT_SVG,
			_("Plot SVG"), _("Plotting in SVG format") );
	    item->SetBitmap(plot_xpm);
		choice_plot_fmt->Append(item);

#ifdef __WINDOWS__
		/* Under windows, one can draw to the clipboard */
		item = new wxMenuItem(choice_plot_fmt, ID_GEN_COPY_SHEET_TO_CLIPBOARD,
			_("Plot to Clipboard"), _("Export drawings to clipboard") );
	    item->SetBitmap(copy_button);
		choice_plot_fmt->Append(item);
#endif

		m_FilesMenu->AppendSeparator();
		ADD_MENUITEM_WITH_HELP_AND_SUBMENU(m_FilesMenu, choice_plot_fmt,
			ID_GEN_PLOT, _("&Plot"),  _("Plot HPGL, PostScript, SVG"), plot_xpm);

		m_FilesMenu->AppendSeparator();
		item = new wxMenuItem(m_FilesMenu, ID_EXIT, _("E&xit"), _("Quit Eeschema") );
	    item->SetBitmap(exit_xpm);
		m_FilesMenu->Append(item);

		// Create the list of last edited schematic files
		m_FilesMenu->AppendSeparator();
		int max_file = m_Parent->m_LastProjectMaxCount;
		for ( ii = 0; ii < max_file; ii++ )
		{
			if ( GetLastProject(ii).IsEmpty() ) break;
			item = new wxMenuItem(m_FilesMenu, ID_LOAD_FILE_1 + ii,
						GetLastProject(ii));
			m_FilesMenu->Append(item);
		}

		// Menu Edit:
		wxMenu * editMenu = new wxMenu;
		msg = AddHotkeyName( _( "&Undo\t" ), s_Schematic_Hokeys_Descr, HK_UNDO );
		item = new wxMenuItem(editMenu, ID_SCHEMATIC_UNDO,
			msg,
			_("Undo last edition") );
	    item->SetBitmap(undo_xpm);
		editMenu->Append(item);

		msg = AddHotkeyName( _( "&Redo\t" ), s_Schematic_Hokeys_Descr, HK_REDO );
		item = new wxMenuItem(editMenu, ID_SCHEMATIC_REDO,
			msg,
			_("Redo the last undo command") );
	    item->SetBitmap(redo_xpm);
		editMenu->Append(item);

		// Menu Configuration:
		wxMenu * configmenu = new wxMenu;
		item = new wxMenuItem(configmenu, ID_CONFIG_REQ,
			_("&Libs and Dir"),
			_("Setting Libraries, Directories and others...") );
	    item->SetBitmap(library_xpm);
		configmenu->Append(item);

		item = new wxMenuItem(configmenu, ID_COLORS_SETUP,
			_("&Colors"),
			_("Setting colors...") );
	    item->SetBitmap(palette_xpm);
		configmenu->Append(item);

//		ADD_MENUITEM(configmenu, ID_OPTIONS_SETUP, _("&Options"), preference_xpm);
		item = new wxMenuItem(configmenu, ID_OPTIONS_SETUP,
			_("&Options"),
			_("Select general options...") );
	    item->SetBitmap(preference_xpm);
		configmenu->Append(item);

		// Font selection and setup
		AddFontSelectionMenu(configmenu);
		
		m_Parent->SetLanguageList(configmenu);

		configmenu->AppendSeparator();
		item = new wxMenuItem(configmenu, ID_CONFIG_SAVE, _("&Save preferences"),
			_("Save application preferences") );
	    item->SetBitmap(save_setup_xpm);
		configmenu->Append(item);
		item = new wxMenuItem(configmenu, ID_CONFIG_READ, _("&Read preferences"),
				_("Read application preferences"));
	    item->SetBitmap(read_setup_xpm);
		configmenu->Append(item);

		configmenu->AppendSeparator();
		AddHotkeyConfigMenu( configmenu );

		// Menu Help:
		wxMenu *helpMenu = new wxMenu;
		item = new wxMenuItem(helpMenu , ID_GENERAL_HELP,
				_("&Contents"), _("Open the eeschema manual"));
	    item->SetBitmap(help_xpm);
		helpMenu->Append(item);

		item = new wxMenuItem(helpMenu , ID_KICAD_ABOUT,
				_("&About"), _("About this application"));
	    item->SetBitmap(info_xpm);
		helpMenu->Append(item);


		menuBar->Append(m_FilesMenu, _("&File") );
		menuBar->Append(editMenu, _("&Edit") );
		menuBar->Append(configmenu, _("&Preferences") );
		menuBar->Append(helpMenu, _("&Help") );

		// Associate the menu bar with the frame
		SetMenuBar(menuBar);
	}

	else		// Update the list of last edited schematic files
		{<commit_msg>eeschema: Added menu "Place" and some menu items for this menu.<commit_after>	/*************************************************************/
	/* menubar.cpp  - create the menubar for the schematic frame */
	/*************************************************************/

#ifdef __GNUG__
#pragma implementation
#endif

#include "fctsys.h"
#include "common.h"

#include "program.h"
#include "libcmp.h"
#include "general.h"

#include "bitmaps.h"
#include "protos.h"
#include "id.h"
#include "hotkeys.h"


/************************************************/
void WinEDA_SchematicFrame::ReCreateMenuBar()
/************************************************/
/* create or update the menubar for the schematic frame
*/
{
int ii;
wxMenuBar * menuBar = GetMenuBar();
wxString msg;

	if( menuBar == NULL )
	{
		menuBar = new wxMenuBar();
			
		m_FilesMenu = new wxMenu;
		// Menu File:
		wxMenuItem *item = new wxMenuItem(m_FilesMenu, ID_NEW_PROJECT,
						_("&New"),
						_("New schematic") );
	    item->SetBitmap(new_xpm);
		m_FilesMenu->Append(item);

		item = new wxMenuItem(m_FilesMenu, ID_LOAD_PROJECT,
						_("&Open"),
						_("Open a schematic") );
	    item->SetBitmap(open_xpm);
		m_FilesMenu->Append(item);

		item = new wxMenuItem(m_FilesMenu, ID_LOAD_ONE_SHEET,
						_("&Reload the current sheet"),
						_("Load or reload a schematic file from file into the current sheet") );
	    item->SetBitmap(import_xpm);
		m_FilesMenu->Append(item);

		m_FilesMenu->AppendSeparator();
		item = new wxMenuItem(m_FilesMenu,ID_SAVE_PROJECT,
					 _("&Save"),
					 _("Save schematic project") );
	    item->SetBitmap(save_project_xpm);
		m_FilesMenu->Append(item);

		m_FilesMenu->AppendSeparator();
		item = new wxMenuItem(m_FilesMenu, ID_SAVE_ONE_SHEET,
					 _("Save &Current sheet"),
					 _("Save current sheet only") );
	    item->SetBitmap(save_xpm);
		m_FilesMenu->Append(item);

		item = new wxMenuItem(m_FilesMenu, ID_SAVE_ONE_SHEET_AS,
					 _("Save Current sheet &as.."),
					 _("Save current sheet as..") );
	    item->SetBitmap(save_as_xpm);
		m_FilesMenu->Append(item);

		item = new wxMenuItem(m_FilesMenu, ID_GEN_PRINT,
					_("P&rint"), _("Print on current printer") );
	    item->SetBitmap(print_button);
		m_FilesMenu->Append(item);

		/* Plot Submenu */
		wxMenu *choice_plot_fmt = new wxMenu;
		item = new wxMenuItem(choice_plot_fmt, ID_GEN_PLOT_PS,
			_("Plot PostScript"), _("Plotting in PostScript format") );
	    item->SetBitmap(plot_PS_xpm);
		choice_plot_fmt->Append(item);

		item = new wxMenuItem(choice_plot_fmt, ID_GEN_PLOT_HPGL,
			_("Plot HPGL"), _("Plotting in HPGL format") );
	    item->SetBitmap(plot_HPG_xpm);
		choice_plot_fmt->Append(item);

		item = new wxMenuItem(choice_plot_fmt, ID_GEN_PLOT_SVG,
			_("Plot SVG"), _("Plotting in SVG format") );
	    item->SetBitmap(plot_xpm);
		choice_plot_fmt->Append(item);

#ifdef __WINDOWS__
		/* Under windows, one can draw to the clipboard */
		item = new wxMenuItem(choice_plot_fmt, ID_GEN_COPY_SHEET_TO_CLIPBOARD,
			_("Plot to Clipboard"), _("Export drawings to clipboard") );
	    item->SetBitmap(copy_button);
		choice_plot_fmt->Append(item);
#endif

		m_FilesMenu->AppendSeparator();
		ADD_MENUITEM_WITH_HELP_AND_SUBMENU(m_FilesMenu, choice_plot_fmt,
			ID_GEN_PLOT, _("&Plot"),  _("Plot HPGL, PostScript, SVG"), plot_xpm);

		m_FilesMenu->AppendSeparator();
		item = new wxMenuItem(m_FilesMenu, ID_EXIT, _("E&xit"), _("Quit Eeschema") );
	    item->SetBitmap(exit_xpm);
		m_FilesMenu->Append(item);

		// Create the list of last edited schematic files
		m_FilesMenu->AppendSeparator();
		int max_file = m_Parent->m_LastProjectMaxCount;
		for ( ii = 0; ii < max_file; ii++ )
		{
			if ( GetLastProject(ii).IsEmpty() ) break;
			item = new wxMenuItem(m_FilesMenu, ID_LOAD_FILE_1 + ii,
						GetLastProject(ii));
			m_FilesMenu->Append(item);
		}

		// Menu Edit:
		wxMenu * editMenu = new wxMenu;
		msg = AddHotkeyName( _( "&Undo\t" ), s_Schematic_Hokeys_Descr, HK_UNDO );
		item = new wxMenuItem(editMenu, ID_SCHEMATIC_UNDO,
			msg,
			_("Undo last edition") );
	    item->SetBitmap(undo_xpm);
		editMenu->Append(item);

		msg = AddHotkeyName( _( "&Redo\t" ), s_Schematic_Hokeys_Descr, HK_REDO );
		item = new wxMenuItem(editMenu, ID_SCHEMATIC_REDO,
			msg,
			_("Redo the last undo command") );
	    item->SetBitmap(redo_xpm);
		editMenu->Append(item);

		// Place Menu
		wxMenu *placeMenu = new wxMenu;
		placeMenu->Append(ID_COMPONENT_BUTT, _("&Component"), _("Place the component"), wxITEM_NORMAL);
		placeMenu->Append(ID_PLACE_POWER_BUTT, _("&Power port"), _("Place the power port"), wxITEM_NORMAL); //TODO: Unify the ID names!
		placeMenu->Append(ID_WIRE_BUTT, _("&Wire"), _("Place the wire"), wxITEM_NORMAL);
		placeMenu->Append(ID_BUS_BUTT, _("&Bus"), _("Place the bus"), wxITEM_NORMAL);
		placeMenu->Append(ID_WIRETOBUS_ENTRY_BUTT, _("&Wire to bus entry"), _("Place the wire to bus entry"), wxITEM_NORMAL);
		placeMenu->Append(ID_BUSTOBUS_ENTRY_BUTT, _("&Bus to bus entry"), _("Place the bus to bus entry"), wxITEM_NORMAL);

		// Menu Configuration:
		wxMenu * configmenu = new wxMenu;
		item = new wxMenuItem(configmenu, ID_CONFIG_REQ,
			_("&Libs and Dir"),
			_("Setting Libraries, Directories and others...") );
	    item->SetBitmap(library_xpm);
		configmenu->Append(item);

		item = new wxMenuItem(configmenu, ID_COLORS_SETUP,
			_("&Colors"),
			_("Setting colors...") );
	    item->SetBitmap(palette_xpm);
		configmenu->Append(item);

//		ADD_MENUITEM(configmenu, ID_OPTIONS_SETUP, _("&Options"), preference_xpm);
		item = new wxMenuItem(configmenu, ID_OPTIONS_SETUP,
			_("&Options"),
			_("Select general options...") );
	    item->SetBitmap(preference_xpm);
		configmenu->Append(item);

		// Font selection and setup
		AddFontSelectionMenu(configmenu);
		
		m_Parent->SetLanguageList(configmenu);

		configmenu->AppendSeparator();
		item = new wxMenuItem(configmenu, ID_CONFIG_SAVE, _("&Save preferences"),
			_("Save application preferences") );
	    item->SetBitmap(save_setup_xpm);
		configmenu->Append(item);
		item = new wxMenuItem(configmenu, ID_CONFIG_READ, _("&Read preferences"),
				_("Read application preferences"));
	    item->SetBitmap(read_setup_xpm);
		configmenu->Append(item);

		configmenu->AppendSeparator();
		AddHotkeyConfigMenu( configmenu );

		// Menu Help:
		wxMenu *helpMenu = new wxMenu;
		item = new wxMenuItem(helpMenu , ID_GENERAL_HELP,
				_("&Contents"), _("Open the eeschema manual"));
	    item->SetBitmap(help_xpm);
		helpMenu->Append(item);

		item = new wxMenuItem(helpMenu , ID_KICAD_ABOUT,
				_("&About"), _("About this application"));
	    item->SetBitmap(info_xpm);
		helpMenu->Append(item);


		menuBar->Append(m_FilesMenu, _("&File") );
		menuBar->Append(editMenu, _("&Edit") );
		menuBar->Append(placeMenu, _("&Place") );
		menuBar->Append(configmenu, _("&Preferences") );
		menuBar->Append(helpMenu, _("&Help") );

		// Associate the menu bar with the frame
		SetMenuBar(menuBar);
	}

	else		// Update the list of last edited schematic files
		{
{'fraction_non_alphanumeric': 0.17259113598547876, 'fraction_numerical': 0.0003025260928755105, 'mean_word_length': 4.641211604095563, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 122, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4698206', 'n_tokens_mistral': 5082, 'n_tokens_neox': 4544, 'n_words': 935}