From d82f403fd7ee123891f62e32b5b872495b111eba Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 15 Oct 2014 13:40:38 +0200 Subject: [PATCH] Libview and Modview: fix issues relative to hotkeys (hardcoded keys instead of user defined keys) and not working tools and popup menus. Fix also some minor coding style issues. --- common/draw_frame.cpp | 5 +- common/zoom.cpp | 10 +- eeschema/eeschema.cpp | 2 +- eeschema/eeschema_config.cpp | 16 ++-- eeschema/hotkeys.cpp | 146 +++++++++++++++++++++++++----- eeschema/hotkeys.h | 8 +- eeschema/libedit_onrightclick.cpp | 56 ++++++------ eeschema/libeditframe.cpp | 2 +- eeschema/menubar.cpp | 48 +++++----- eeschema/menubar_libedit.cpp | 8 +- eeschema/onrightclick.cpp | 146 +++++++++++++++--------------- eeschema/schframe.cpp | 2 +- eeschema/tool_lib.cpp | 12 +-- eeschema/tool_sch.cpp | 14 +-- eeschema/tool_viewlib.cpp | 104 ++++++++++++++++++++- eeschema/viewlib_frame.cpp | 38 +++----- eeschema/viewlib_frame.h | 13 +++ include/id.h | 23 +++-- pcbnew/hotkeys.cpp | 101 ++++++++++++++++++++- pcbnew/menubar_modedit.cpp | 42 +++++---- pcbnew/menubar_pcbframe.cpp | 5 +- pcbnew/modview_frame.cpp | 45 ++++----- pcbnew/modview_frame.h | 14 +++ pcbnew/tool_modview.cpp | 130 +++++++++++++++++++++++--- 24 files changed, 707 insertions(+), 283 deletions(-) diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp index bda427fb88..e5d1c1bdae 100644 --- a/common/draw_frame.cpp +++ b/common/draw_frame.cpp @@ -70,10 +70,11 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, KIWAY_PLAYER ) EVT_MOUSEWHEEL( EDA_DRAW_FRAME::OnMouseEvent ) EVT_MENU_OPEN( EDA_DRAW_FRAME::OnMenuOpen ) EVT_ACTIVATE( EDA_DRAW_FRAME::OnActivate ) - EVT_MENU_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, EDA_DRAW_FRAME::OnZoom ) - EVT_MENU_RANGE( ID_OFFCENTER_ZOOM_IN, ID_OFFCENTER_ZOOM_OUT, EDA_DRAW_FRAME::OnZoom ) + EVT_MENU_RANGE( ID_ZOOM_BEGIN, ID_ZOOM_END, EDA_DRAW_FRAME::OnZoom ) + EVT_MENU_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE, EDA_DRAW_FRAME::OnZoom ) + EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER, EDA_DRAW_FRAME::OnSelectGrid ) diff --git a/common/zoom.cpp b/common/zoom.cpp index b7393cd54f..67526b7450 100644 --- a/common/zoom.cpp +++ b/common/zoom.cpp @@ -138,6 +138,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event ) center = GetCrossHairPosition(); // fall thru + case ID_VIEWER_ZOOM_IN: case ID_ZOOM_IN: if( screen->SetPreviousZoom() ) RedrawScreen( center, zoom_at_cursor ); @@ -154,11 +155,14 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event ) center = GetCrossHairPosition(); // fall thru + case ID_VIEWER_ZOOM_OUT: case ID_ZOOM_OUT: if( screen->SetNextZoom() ) RedrawScreen( center, zoom_at_cursor ); break; + case ID_VIEWER_ZOOM_REDRAW: + case ID_POPUP_ZOOM_REDRAW: case ID_ZOOM_REDRAW: m_canvas->Refresh(); break; @@ -168,6 +172,8 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event ) RedrawScreen( center, true ); break; + case ID_POPUP_ZOOM_PAGE: + case ID_VIEWER_ZOOM_PAGE: case ID_ZOOM_PAGE: Zoom_Automatique( false ); break; @@ -227,9 +233,9 @@ void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu ) msg = AddHotkeyName( _( "Zoom out" ), m_HotkeysZoomAndGridList, HK_ZOOM_OUT ); AddMenuItem( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) ); msg = AddHotkeyName( _( "Redraw view" ), m_HotkeysZoomAndGridList, HK_ZOOM_REDRAW ); - AddMenuItem( MasterMenu, ID_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) ); + AddMenuItem( MasterMenu, ID_POPUP_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) ); msg = AddHotkeyName( _( "Zoom auto" ), m_HotkeysZoomAndGridList, HK_ZOOM_AUTO ); - AddMenuItem( MasterMenu, ID_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) ); + AddMenuItem( MasterMenu, ID_POPUP_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) ); wxMenu* zoom_choice = new wxMenu; diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp index 58f936fbae..b3d25190e9 100644 --- a/eeschema/eeschema.cpp +++ b/eeschema/eeschema.cpp @@ -229,7 +229,7 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) // Must be called before creating the main frame in order to // display the real hotkeys in menus or tool tips - ReadHotkeyConfig( wxT("SchematicFrame"), s_Eeschema_Hokeys_Descr ); + ReadHotkeyConfig( wxT("SchematicFrame"), g_Eeschema_Hokeys_Descr ); wxConfigLoadSetups( KifaceSettings(), cfg_params() ); diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index b7a1e395bb..87d2aadf5b 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -172,20 +172,20 @@ void LIB_EDIT_FRAME::Process_Config( wxCommandEvent& event ) { // Hotkey IDs case ID_PREFERENCES_HOTKEY_SHOW_EDITOR: - InstallHotkeyFrame( this, s_Eeschema_Hokeys_Descr ); + InstallHotkeyFrame( this, g_Eeschema_Hokeys_Descr ); break; case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG: - ExportHotkeyConfigToFile( s_Eeschema_Hokeys_Descr ); + ExportHotkeyConfigToFile( g_Eeschema_Hokeys_Descr ); break; case ID_PREFERENCES_HOTKEY_IMPORT_CONFIG: - ImportHotkeyConfigFromFile( s_Eeschema_Hokeys_Descr ); + ImportHotkeyConfigFromFile( g_Eeschema_Hokeys_Descr ); break; case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST: // Display current hotkey list for LibEdit. - DisplayHotkeyList( this, s_Libedit_Hokeys_Descr ); + DisplayHotkeyList( this, g_Libedit_Hokeys_Descr ); break; default: @@ -281,20 +281,20 @@ void SCH_EDIT_FRAME::Process_Config( wxCommandEvent& event ) // Hotkey IDs case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG: - ExportHotkeyConfigToFile( s_Eeschema_Hokeys_Descr ); + ExportHotkeyConfigToFile( g_Eeschema_Hokeys_Descr ); break; case ID_PREFERENCES_HOTKEY_IMPORT_CONFIG: - ImportHotkeyConfigFromFile( s_Eeschema_Hokeys_Descr ); + ImportHotkeyConfigFromFile( g_Eeschema_Hokeys_Descr ); break; case ID_PREFERENCES_HOTKEY_SHOW_EDITOR: - InstallHotkeyFrame( this, s_Eeschema_Hokeys_Descr ); + InstallHotkeyFrame( this, g_Eeschema_Hokeys_Descr ); break; case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST: // Display current hotkey list for eeschema. - DisplayHotkeyList( this, s_Schematic_Hokeys_Descr ); + DisplayHotkeyList( this, g_Schematic_Hokeys_Descr ); break; default: diff --git a/eeschema/hotkeys.cpp b/eeschema/hotkeys.cpp index 2847aad2a2..d302150c8a 100644 --- a/eeschema/hotkeys.cpp +++ b/eeschema/hotkeys.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008-2011 Wayne Stambaugh * Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors. * @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -55,8 +56,8 @@ * OnHotKey() function. * default key value is the default hotkey for this command. Can be overridden * by the user hotkey list file - * add the HkMyNewEntry pointer in the s_Schematic_Hotkey_List list or the - * s_LibEdit_Hotkey_List list or s_Common_Hotkey_List if the same command is + * add the HkMyNewEntry pointer in the schematic_Hotkey_List list or the + * libEdit_Hotkey_List list or common_Hotkey_List if the same command is * added both in Eeschema and libedit) * Add the new code in the switch in OnHotKey() function. * when the variable itemInEdit is true, an item is currently edited. @@ -211,7 +212,7 @@ static EDA_HOTKEY HkSaveSchematic( wxT( "Save Schematic" ), HK_SAVE_SCH, 'S' + G static EDA_HOTKEY HkLoadSchematic( wxT( "Load Schematic" ), HK_LOAD_SCH, 'L' + GR_KB_CTRL ); // List of common hotkey descriptors -EDA_HOTKEY* s_Common_Hotkey_List[] = +static EDA_HOTKEY* common_Hotkey_List[] = { &HkHelp, &HkZoomIn, @@ -231,8 +232,23 @@ EDA_HOTKEY* s_Common_Hotkey_List[] = NULL }; +// List of common hotkey descriptors, for the library vierwer +static EDA_HOTKEY* common_basic_Hotkey_List[] = +{ + &HkHelp, + &HkZoomIn, + &HkZoomOut, + &HkZoomRedraw, + &HkZoomCenter, + &HkZoomAuto, + &HkResetLocalCoord, + &HkMouseLeftClick, + &HkMouseLeftDClick, + NULL +}; + // List of hotkey descriptors for schematic -EDA_HOTKEY* s_Schematic_Hotkey_List[] = +static EDA_HOTKEY* schematic_Hotkey_List[] = { &HkSaveSchematic, &HkLoadSchematic, @@ -270,7 +286,7 @@ EDA_HOTKEY* s_Schematic_Hotkey_List[] = }; // List of hotkey descriptors for library editor -EDA_HOTKEY* s_LibEdit_Hotkey_List[] = +static EDA_HOTKEY* libEdit_Hotkey_List[] = { &HkSaveLib, &HkCreatePin, @@ -279,40 +295,46 @@ EDA_HOTKEY* s_LibEdit_Hotkey_List[] = NULL }; +// List of hotkey descriptors for library viewer (currently empty +static EDA_HOTKEY* viewlib_Hotkey_List[] = +{ + NULL +}; + // list of sections and corresponding hotkey list for Eeschema (used to create // an hotkey config file) -struct EDA_HOTKEY_CONFIG s_Eeschema_Hokeys_Descr[] = +struct EDA_HOTKEY_CONFIG g_Eeschema_Hokeys_Descr[] = { - { &g_CommonSectionTag, s_Common_Hotkey_List, L"Common keys" }, - { &g_SchematicSectionTag, s_Schematic_Hotkey_List, L"Schematic editor keys" }, - { &g_LibEditSectionTag, s_LibEdit_Hotkey_List, L"library editor keys" }, + { &g_CommonSectionTag, common_Hotkey_List, L"Common keys" }, + { &g_SchematicSectionTag, schematic_Hotkey_List, L"Schematic editor keys" }, + { &g_LibEditSectionTag, libEdit_Hotkey_List, L"library editor keys" }, { NULL, NULL, NULL } }; // list of sections and corresponding hotkey list for the schematic editor // (used to list current hotkeys) -struct EDA_HOTKEY_CONFIG s_Schematic_Hokeys_Descr[] = +struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[] = { - { &g_CommonSectionTag, s_Common_Hotkey_List, NULL }, - { &g_SchematicSectionTag, s_Schematic_Hotkey_List, NULL }, + { &g_CommonSectionTag, common_Hotkey_List, NULL }, + { &g_SchematicSectionTag, schematic_Hotkey_List, NULL }, { NULL, NULL, NULL } }; // list of sections and corresponding hotkey list for the component editor // (used to list current hotkeys) -struct EDA_HOTKEY_CONFIG s_Libedit_Hokeys_Descr[] = +struct EDA_HOTKEY_CONFIG g_Libedit_Hokeys_Descr[] = { - { &g_CommonSectionTag, s_Common_Hotkey_List, NULL }, - { &g_LibEditSectionTag, s_LibEdit_Hotkey_List, NULL }, + { &g_CommonSectionTag, common_Hotkey_List, NULL }, + { &g_LibEditSectionTag, libEdit_Hotkey_List, NULL }, { NULL, NULL, NULL } }; // list of sections and corresponding hotkey list for the component browser // (used to list current hotkeys) -struct EDA_HOTKEY_CONFIG s_Viewlib_Hokeys_Descr[] = +struct EDA_HOTKEY_CONFIG g_Viewlib_Hokeys_Descr[] = { - { &g_CommonSectionTag, s_Common_Hotkey_List, NULL }, - { NULL, NULL, NULL } + { &g_CommonSectionTag, common_basic_Hotkey_List, NULL }, + { NULL, NULL, NULL } }; /* @@ -348,10 +370,10 @@ bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, aHotKey += 'A' - 'a'; // Search command from key : - EDA_HOTKEY* hotKey = GetDescriptorFromHotkey( aHotKey, s_Common_Hotkey_List ); + EDA_HOTKEY* hotKey = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List ); if( hotKey == NULL ) - hotKey = GetDescriptorFromHotkey( aHotKey, s_Schematic_Hotkey_List ); + hotKey = GetDescriptorFromHotkey( aHotKey, schematic_Hotkey_List ); if( hotKey == NULL ) return false; @@ -363,7 +385,7 @@ bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, return false; case HK_HELP: // Display Current hotkey list - DisplayHotkeyList( this, s_Schematic_Hokeys_Descr ); + DisplayHotkeyList( this, g_Schematic_Hokeys_Descr ); break; case HK_RESET_LOCAL_COORD: // Reset the relative coord @@ -553,10 +575,10 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, if( (aHotKey >= 'a') && (aHotKey <= 'z') ) aHotKey += 'A' - 'a'; - EDA_HOTKEY* hotKey = GetDescriptorFromHotkey( aHotKey, s_Common_Hotkey_List ); + EDA_HOTKEY* hotKey = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List ); if( hotKey == NULL ) - hotKey = GetDescriptorFromHotkey( aHotKey, s_LibEdit_Hotkey_List ); + hotKey = GetDescriptorFromHotkey( aHotKey, libEdit_Hotkey_List ); if( hotKey == NULL ) return false; @@ -568,7 +590,7 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, return false; case HK_HELP: // Display Current hotkey list - DisplayHotkeyList( this, s_Libedit_Hokeys_Descr ); + DisplayHotkeyList( this, g_Libedit_Hokeys_Descr ); break; case HK_RESET_LOCAL_COORD: // Reset the relative coord @@ -704,3 +726,77 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, // Hot key handled. return true; } + +bool LIB_VIEW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, + EDA_ITEM* aItem ) +{ + if( aHotKey == 0 ) + return false; + + wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); + cmd.SetEventObject( this ); + + /* Convert lower to upper case (the usual toupper function has problem with non ascii + * codes like function keys */ + if( (aHotKey >= 'a') && (aHotKey <= 'z') ) + aHotKey += 'A' - 'a'; + + EDA_HOTKEY* HK_Descr = GetDescriptorFromHotkey( aHotKey, common_basic_Hotkey_List ); + + if( HK_Descr == NULL ) + HK_Descr = GetDescriptorFromHotkey( aHotKey, viewlib_Hotkey_List ); + + if( HK_Descr == NULL ) + return false; + + switch( HK_Descr->m_Idcommand ) + { + default: + case HK_NOT_FOUND: + return false; + + case HK_HELP: // Display Current hotkey list + DisplayHotkeyList( this, g_Viewlib_Hokeys_Descr ); + break; + + case HK_RESET_LOCAL_COORD: // set local (relative) coordinate origin + GetScreen()->m_O_Curseur = GetCrossHairPosition(); + break; + + case HK_LEFT_CLICK: + OnLeftClick( aDC, aPosition ); + break; + + case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events + OnLeftClick( aDC, aPosition ); + OnLeftDClick( aDC, aPosition ); + break; + + case HK_ZOOM_IN: + cmd.SetId( ID_POPUP_ZOOM_IN ); + GetEventHandler()->ProcessEvent( cmd ); + break; + + case HK_ZOOM_OUT: + cmd.SetId( ID_POPUP_ZOOM_OUT ); + GetEventHandler()->ProcessEvent( cmd ); + break; + + case HK_ZOOM_REDRAW: + cmd.SetId( ID_ZOOM_REDRAW ); + GetEventHandler()->ProcessEvent( cmd ); + break; + + case HK_ZOOM_CENTER: + cmd.SetId( ID_POPUP_ZOOM_CENTER ); + GetEventHandler()->ProcessEvent( cmd ); + break; + + case HK_ZOOM_AUTO: + cmd.SetId( ID_ZOOM_PAGE ); + GetEventHandler()->ProcessEvent( cmd ); + break; + } + + return true; +} diff --git a/eeschema/hotkeys.h b/eeschema/hotkeys.h index a68a07dd7b..da945a07f1 100644 --- a/eeschema/hotkeys.h +++ b/eeschema/hotkeys.h @@ -55,15 +55,15 @@ enum hotkey_id_commnand { }; // List of hotkey descriptors for Eeschema -extern struct EDA_HOTKEY_CONFIG s_Eeschema_Hokeys_Descr[]; +extern struct EDA_HOTKEY_CONFIG g_Eeschema_Hokeys_Descr[]; // List of hotkey descriptors for the schematic editor only -extern struct EDA_HOTKEY_CONFIG s_Schematic_Hokeys_Descr[]; +extern struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]; // List of hotkey descriptors for the lib editor only -extern struct EDA_HOTKEY_CONFIG s_Libedit_Hokeys_Descr[]; +extern struct EDA_HOTKEY_CONFIG g_Libedit_Hokeys_Descr[]; // List of hotkey descriptors for the lib browser only -extern struct EDA_HOTKEY_CONFIG s_Viewlib_Hokeys_Descr[]; +extern struct EDA_HOTKEY_CONFIG g_Viewlib_Hokeys_Descr[]; #endif // EESCHEMA_KOTKEYS_H_ diff --git a/eeschema/libedit_onrightclick.cpp b/eeschema/libedit_onrightclick.cpp index 38f9e98151..24067ed2d3 100644 --- a/eeschema/libedit_onrightclick.cpp +++ b/eeschema/libedit_onrightclick.cpp @@ -115,20 +115,20 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) case LIB_ARC_T: if( not_edited ) { - msg = AddHotkeyName( _( "Move Arc" ), s_Libedit_Hokeys_Descr, + msg = AddHotkeyName( _( "Move Arc" ), g_Libedit_Hokeys_Descr, HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, KiBitmap( move_arc_xpm ) ); - msg = AddHotkeyName( _( "Drag Arc Size" ), s_Libedit_Hokeys_Descr, HK_DRAG ); + msg = AddHotkeyName( _( "Drag Arc Size" ), g_Libedit_Hokeys_Descr, HK_DRAG ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, KiBitmap( move_arc_xpm ) ); } - msg = AddHotkeyName( _( "Edit Arc Options" ), s_Libedit_Hokeys_Descr, HK_EDIT ); + msg = AddHotkeyName( _( "Edit Arc Options" ), g_Libedit_Hokeys_Descr, HK_EDIT ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, KiBitmap( options_arc_xpm ) ); if( not_edited ) { - msg = AddHotkeyName( _( "Delete Arc" ), s_Libedit_Hokeys_Descr, HK_DELETE ); + msg = AddHotkeyName( _( "Delete Arc" ), g_Libedit_Hokeys_Descr, HK_DELETE ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, KiBitmap( delete_arc_xpm ) ); } break; @@ -136,22 +136,22 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) case LIB_CIRCLE_T: if( not_edited ) { - msg = AddHotkeyName( _( "Move Circle" ), s_Libedit_Hokeys_Descr, + msg = AddHotkeyName( _( "Move Circle" ), g_Libedit_Hokeys_Descr, HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, KiBitmap( move_circle_xpm ) ); - msg = AddHotkeyName( _( "Drag Circle Outline" ), s_Libedit_Hokeys_Descr, HK_DRAG ); + msg = AddHotkeyName( _( "Drag Circle Outline" ), g_Libedit_Hokeys_Descr, HK_DRAG ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, KiBitmap( move_rectangle_xpm ) ); } - msg = AddHotkeyName( _( "Edit Circle Options" ), s_Libedit_Hokeys_Descr, HK_EDIT ); + msg = AddHotkeyName( _( "Edit Circle Options" ), g_Libedit_Hokeys_Descr, HK_EDIT ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, KiBitmap( options_circle_xpm ) ); if( not_edited ) { - msg = AddHotkeyName( _( "Delete Circle" ), s_Libedit_Hokeys_Descr, HK_DELETE ); + msg = AddHotkeyName( _( "Delete Circle" ), g_Libedit_Hokeys_Descr, HK_DELETE ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, KiBitmap( delete_circle_xpm ) ); } @@ -160,22 +160,22 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) case LIB_RECTANGLE_T: if( not_edited ) { - msg = AddHotkeyName( _( "Move Rectangle" ), s_Libedit_Hokeys_Descr, + msg = AddHotkeyName( _( "Move Rectangle" ), g_Libedit_Hokeys_Descr, HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, KiBitmap( move_rectangle_xpm ) ); } - msg = AddHotkeyName( _( "Edit Rectangle Options" ), s_Libedit_Hokeys_Descr, HK_EDIT ); + msg = AddHotkeyName( _( "Edit Rectangle Options" ), g_Libedit_Hokeys_Descr, HK_EDIT ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, KiBitmap( options_rectangle_xpm ) ); if( not_edited ) { - msg = AddHotkeyName( _( "Drag Rectangle Edge" ), s_Libedit_Hokeys_Descr, HK_DRAG ); + msg = AddHotkeyName( _( "Drag Rectangle Edge" ), g_Libedit_Hokeys_Descr, HK_DRAG ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, KiBitmap( move_rectangle_xpm ) ); - msg = AddHotkeyName( _( "Delete Rectangle" ), s_Libedit_Hokeys_Descr, HK_DELETE ); + msg = AddHotkeyName( _( "Delete Rectangle" ), g_Libedit_Hokeys_Descr, HK_DELETE ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, KiBitmap( delete_rectangle_xpm ) ); } @@ -185,21 +185,21 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) case LIB_TEXT_T: if( not_edited ) { - msg = AddHotkeyName( _( "Move Text" ), s_Libedit_Hokeys_Descr, + msg = AddHotkeyName( _( "Move Text" ), g_Libedit_Hokeys_Descr, HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, KiBitmap( move_text_xpm ) ); } - msg = AddHotkeyName( _( "Edit Text" ), s_Libedit_Hokeys_Descr, HK_EDIT ); + msg = AddHotkeyName( _( "Edit Text" ), g_Libedit_Hokeys_Descr, HK_EDIT ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) ); - msg = AddHotkeyName( _( "Rotate Text" ), s_Libedit_Hokeys_Descr, HK_ROTATE ); + msg = AddHotkeyName( _( "Rotate Text" ), g_Libedit_Hokeys_Descr, HK_ROTATE ); AddMenuItem( PopMenu, ID_LIBEDIT_ROTATE_ITEM, msg, KiBitmap( edit_text_xpm ) ); if( not_edited ) { - msg = AddHotkeyName( _( "Delete Text" ), s_Libedit_Hokeys_Descr, HK_DELETE ); + msg = AddHotkeyName( _( "Delete Text" ), g_Libedit_Hokeys_Descr, HK_DELETE ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, KiBitmap( delete_text_xpm ) ); } break; @@ -207,11 +207,11 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) case LIB_POLYLINE_T: if( not_edited ) { - msg = AddHotkeyName( _( "Move Line" ), s_Libedit_Hokeys_Descr, + msg = AddHotkeyName( _( "Move Line" ), g_Libedit_Hokeys_Descr, HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, KiBitmap( move_line_xpm ) ); - msg = AddHotkeyName( _( "Drag Edge Point" ), s_Libedit_Hokeys_Descr, HK_DRAG ); + msg = AddHotkeyName( _( "Drag Edge Point" ), g_Libedit_Hokeys_Descr, HK_DRAG ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, KiBitmap( move_line_xpm ) ); } @@ -221,13 +221,13 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) KiBitmap( checked_ok_xpm ) ); } - msg = AddHotkeyName( _( "Edit Line Options" ), s_Libedit_Hokeys_Descr, HK_EDIT ); + msg = AddHotkeyName( _( "Edit Line Options" ), g_Libedit_Hokeys_Descr, HK_EDIT ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, KiBitmap( options_segment_xpm ) ); if( not_edited ) { - msg = AddHotkeyName( _( "Delete Line " ), s_Libedit_Hokeys_Descr, HK_DELETE ); + msg = AddHotkeyName( _( "Delete Line " ), g_Libedit_Hokeys_Descr, HK_DELETE ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, KiBitmap( delete_segment_xpm ) ); } @@ -236,7 +236,7 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) { if( ( (LIB_POLYLINE*) item )->GetCornerCount() > 2 ) { - msg = AddHotkeyName( _( "Delete Segment" ), s_Libedit_Hokeys_Descr, HK_DELETE ); + msg = AddHotkeyName( _( "Delete Segment" ), g_Libedit_Hokeys_Descr, HK_DELETE ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT, msg, KiBitmap( delete_segment_xpm ) ); } @@ -247,15 +247,15 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) case LIB_FIELD_T: if( not_edited ) { - msg = AddHotkeyName( _( "Move Field" ), s_Libedit_Hokeys_Descr, + msg = AddHotkeyName( _( "Move Field" ), g_Libedit_Hokeys_Descr, HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, KiBitmap( move_field_xpm ) ); } - msg = AddHotkeyName( _( "Field Rotate" ), s_Libedit_Hokeys_Descr, HK_ROTATE ); + msg = AddHotkeyName( _( "Field Rotate" ), g_Libedit_Hokeys_Descr, HK_ROTATE ); AddMenuItem( PopMenu, ID_LIBEDIT_ROTATE_ITEM, msg, KiBitmap( rotate_field_xpm ) ); - msg = AddHotkeyName( _( "Field Edit" ), s_Libedit_Hokeys_Descr, HK_EDIT ); + msg = AddHotkeyName( _( "Field Edit" ), g_Libedit_Hokeys_Descr, HK_EDIT ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) ); break; @@ -280,20 +280,20 @@ void AddMenusForPin( wxMenu* PopMenu, LIB_PIN* Pin, LIB_EDIT_FRAME* frame ) if( not_in_move ) { - msg = AddHotkeyName( _( "Move Pin " ), s_Libedit_Hokeys_Descr, + msg = AddHotkeyName( _( "Move Pin " ), g_Libedit_Hokeys_Descr, HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, KiBitmap( move_xpm ) ); } - msg = AddHotkeyName( _( "Edit Pin " ), s_Libedit_Hokeys_Descr, HK_EDIT); + msg = AddHotkeyName( _( "Edit Pin " ), g_Libedit_Hokeys_Descr, HK_EDIT); AddMenuItem( PopMenu, ID_LIBEDIT_EDIT_PIN, msg, KiBitmap( edit_xpm ) ); - msg = AddHotkeyName( _( "Rotate Pin " ), s_Libedit_Hokeys_Descr, HK_ROTATE ); + msg = AddHotkeyName( _( "Rotate Pin " ), g_Libedit_Hokeys_Descr, HK_ROTATE ); AddMenuItem( PopMenu, ID_LIBEDIT_ROTATE_ITEM, msg, KiBitmap( rotate_pin_xpm ) ); if( not_in_move ) { - msg = AddHotkeyName( _( "Delete Pin " ), s_Libedit_Hokeys_Descr, HK_DELETE ); + msg = AddHotkeyName( _( "Delete Pin " ), g_Libedit_Hokeys_Descr, HK_DELETE ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, KiBitmap( delete_pin_xpm ) ); } diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp index 9d1b633683..eee31eaa86 100644 --- a/eeschema/libeditframe.cpp +++ b/eeschema/libeditframe.cpp @@ -191,7 +191,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : SetShowDeMorgan( false ); m_drawSpecificConvert = true; m_drawSpecificUnit = false; - m_HotkeysZoomAndGridList = s_Libedit_Hokeys_Descr; + m_HotkeysZoomAndGridList = g_Libedit_Hokeys_Descr; m_editPinsPerPartOrConvert = false; // Delayed initialization diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index c1c0dfad4f..0692444530 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -72,7 +72,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() _( "Clear current schematic hierarchy and start a new schematic root sheet" ), KiBitmap( new_xpm ) ); - text = AddHotkeyName( _( "&Open Schematic Project" ), s_Schematic_Hokeys_Descr, HK_LOAD_SCH ); + text = AddHotkeyName( _( "&Open Schematic Project" ), g_Schematic_Hokeys_Descr, HK_LOAD_SCH ); AddMenuItem( fileMenu, ID_LOAD_PROJECT, text, _( "Open an existing schematic hierarchy" ), @@ -109,7 +109,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() fileMenu->AppendSeparator(); text = AddHotkeyName( _( "&Save Schematic Project" ), - s_Schematic_Hokeys_Descr, HK_SAVE_SCH ); + g_Schematic_Hokeys_Descr, HK_SAVE_SCH ); AddMenuItem( fileMenu, ID_SAVE_PROJECT, text, _( "Save all sheets in schematic project" ), @@ -191,12 +191,12 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() wxMenu* editMenu = new wxMenu; // Undo - text = AddHotkeyName( _( "&Undo" ), s_Schematic_Hokeys_Descr, HK_UNDO ); + text = AddHotkeyName( _( "&Undo" ), g_Schematic_Hokeys_Descr, HK_UNDO ); AddMenuItem( editMenu, wxID_UNDO, text, HELP_UNDO, KiBitmap( undo_xpm ) ); // Redo - text = AddHotkeyName( _( "&Redo" ), s_Schematic_Hokeys_Descr, HK_REDO ); + text = AddHotkeyName( _( "&Redo" ), g_Schematic_Hokeys_Descr, HK_REDO ); AddMenuItem( editMenu, wxID_REDO, text, HELP_REDO, KiBitmap( redo_xpm ) ); @@ -208,11 +208,11 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() // Find editMenu->AppendSeparator(); - text = AddHotkeyName( _( "&Find" ), s_Schematic_Hokeys_Descr, HK_FIND_ITEM ); + text = AddHotkeyName( _( "&Find" ), g_Schematic_Hokeys_Descr, HK_FIND_ITEM ); AddMenuItem( editMenu, ID_FIND_ITEMS, text, HELP_FIND, KiBitmap( find_xpm ) ); // Find/Replace - text = AddHotkeyName( _( "Find and Re&place" ), s_Schematic_Hokeys_Descr, + text = AddHotkeyName( _( "Find and Re&place" ), g_Schematic_Hokeys_Descr, HK_FIND_REPLACE ); AddMenuItem( editMenu, wxID_REPLACE, text, HELP_REPLACE, KiBitmap( find_replace_xpm ) ); @@ -242,15 +242,15 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() * using in AddHotkeyName call the option "false" (not a shortcut) */ - text = AddHotkeyName( _( "Zoom &In" ), s_Schematic_Hokeys_Descr, + text = AddHotkeyName( _( "Zoom &In" ), g_Schematic_Hokeys_Descr, HK_ZOOM_IN, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, KiBitmap( zoom_in_xpm ) ); - text = AddHotkeyName( _( "Zoom &Out" ), s_Schematic_Hokeys_Descr, + text = AddHotkeyName( _( "Zoom &Out" ), g_Schematic_Hokeys_Descr, HK_ZOOM_OUT, IS_ACCELERATOR ); // add accelerator, not a shortcut AddMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, KiBitmap( zoom_out_xpm ) ); - text = AddHotkeyName( _( "&Fit on Screen" ), s_Schematic_Hokeys_Descr, HK_ZOOM_AUTO ); + text = AddHotkeyName( _( "&Fit on Screen" ), g_Schematic_Hokeys_Descr, HK_ZOOM_AUTO ); AddMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, KiBitmap( zoom_fit_in_page_xpm ) ); @@ -262,65 +262,65 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() _( "Navigate hierarchical sheets" ), KiBitmap( hierarchy_nav_xpm ) ); - text = AddHotkeyName( _( "&Redraw" ), s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW ); + text = AddHotkeyName( _( "&Redraw" ), g_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW ); AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) ); // Menu place: wxMenu* placeMenu = new wxMenu; - text = AddHotkeyName( _( "&Component" ), s_Schematic_Hokeys_Descr, + text = AddHotkeyName( _( "&Component" ), g_Schematic_Hokeys_Descr, HK_ADD_NEW_COMPONENT, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_SCH_PLACE_COMPONENT, text, HELP_PLACE_COMPONENTS, KiBitmap( add_component_xpm ) ); - text = AddHotkeyName( _( "&Power Port" ), s_Schematic_Hokeys_Descr, + text = AddHotkeyName( _( "&Power Port" ), g_Schematic_Hokeys_Descr, HK_ADD_NEW_POWER, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_PLACE_POWER_BUTT, text, HELP_PLACE_POWERPORT, KiBitmap( add_power_xpm ) ); - text = AddHotkeyName( _( "&Wire" ), s_Schematic_Hokeys_Descr, + text = AddHotkeyName( _( "&Wire" ), g_Schematic_Hokeys_Descr, HK_BEGIN_WIRE, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_WIRE_BUTT, text, HELP_PLACE_WIRE, KiBitmap( add_line_xpm ) ); - text = AddHotkeyName( _( "&Bus" ), s_Schematic_Hokeys_Descr, + text = AddHotkeyName( _( "&Bus" ), g_Schematic_Hokeys_Descr, HK_BEGIN_BUS, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_BUS_BUTT, text, HELP_PLACE_BUS, KiBitmap( add_bus_xpm ) ); - text = AddHotkeyName( _( "Wire to Bus &Entry" ), s_Schematic_Hokeys_Descr, + text = AddHotkeyName( _( "Wire to Bus &Entry" ), g_Schematic_Hokeys_Descr, HK_ADD_WIRE_ENTRY, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_WIRETOBUS_ENTRY_BUTT, text, HELP_PLACE_WIRE2BUS_ENTRY, KiBitmap( add_line2bus_xpm ) ); - text = AddHotkeyName( _( "Bus &to Bus Entry" ), s_Schematic_Hokeys_Descr, + text = AddHotkeyName( _( "Bus &to Bus Entry" ), g_Schematic_Hokeys_Descr, HK_ADD_BUS_ENTRY, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_BUSTOBUS_ENTRY_BUTT, text, HELP_PLACE_BUS2BUS_ENTRY, KiBitmap( add_bus2bus_xpm ) ); - text = AddHotkeyName( _( "&No Connect Flag" ), s_Schematic_Hokeys_Descr, + text = AddHotkeyName( _( "&No Connect Flag" ), g_Schematic_Hokeys_Descr, HK_ADD_NOCONN_FLAG, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_NOCONN_BUTT, text, HELP_PLACE_NC_FLAG, KiBitmap( noconn_xpm ) ); - text = AddHotkeyName( _( "&Junction" ), s_Schematic_Hokeys_Descr, + text = AddHotkeyName( _( "&Junction" ), g_Schematic_Hokeys_Descr, HK_ADD_JUNCTION, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_JUNCTION_BUTT, text, HELP_PLACE_JUNCTION, KiBitmap( add_junction_xpm ) ); - text = AddHotkeyName( _( "&Label" ), s_Schematic_Hokeys_Descr, + text = AddHotkeyName( _( "&Label" ), g_Schematic_Hokeys_Descr, HK_ADD_LABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_LABEL_BUTT, text, HELP_PLACE_NETLABEL, KiBitmap( add_line_label_xpm ) ); - text = AddHotkeyName( _( "Gl&obal Label" ), s_Schematic_Hokeys_Descr, + text = AddHotkeyName( _( "Gl&obal Label" ), g_Schematic_Hokeys_Descr, HK_ADD_GLABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_GLABEL_BUTT, text, HELP_PLACE_GLOBALLABEL, @@ -328,14 +328,14 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() placeMenu->AppendSeparator(); - text = AddHotkeyName( _( "&Hierarchical Label" ), s_Schematic_Hokeys_Descr, + text = AddHotkeyName( _( "&Hierarchical Label" ), g_Schematic_Hokeys_Descr, HK_ADD_HLABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_HIERLABEL_BUTT, text, HELP_PLACE_HIER_LABEL, KiBitmap( add_hierarchical_label_xpm ) ); - text = AddHotkeyName( _( "H&ierarchical &Sheet" ), s_Schematic_Hokeys_Descr, + text = AddHotkeyName( _( "H&ierarchical &Sheet" ), g_Schematic_Hokeys_Descr, HK_ADD_HIER_SHEET, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_SHEET_SYMBOL_BUTT, text, HELP_PLACE_SHEET, @@ -355,13 +355,13 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() placeMenu->AppendSeparator(); - text = AddHotkeyName( _( "Graphic Polyline" ), s_Schematic_Hokeys_Descr, + text = AddHotkeyName( _( "Graphic Polyline" ), g_Schematic_Hokeys_Descr, HK_ADD_GRAPHIC_POLYLINE, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_LINE_COMMENT_BUTT, text, HELP_PLACE_GRAPHICLINES, KiBitmap( add_dashed_line_xpm ) ); - text = AddHotkeyName( _( "Graphic Text" ), s_Schematic_Hokeys_Descr, + text = AddHotkeyName( _( "Graphic Text" ), g_Schematic_Hokeys_Descr, HK_ADD_GRAPHIC_TEXT, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_TEXT_COMMENT_BUTT, text, HELP_PLACE_GRAPHICTEXTS, diff --git a/eeschema/menubar_libedit.cpp b/eeschema/menubar_libedit.cpp index eb33ad260c..2c90491a7c 100644 --- a/eeschema/menubar_libedit.cpp +++ b/eeschema/menubar_libedit.cpp @@ -115,7 +115,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar() wxMenu* editMenu = new wxMenu; // Undo - text = AddHotkeyName( _( "&Undo" ), s_Libedit_Hokeys_Descr, HK_UNDO ); + text = AddHotkeyName( _( "&Undo" ), g_Libedit_Hokeys_Descr, HK_UNDO ); AddMenuItem( editMenu, wxID_UNDO, @@ -124,7 +124,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar() KiBitmap( undo_xpm ) ); // Redo - text = AddHotkeyName( _( "&Redo" ), s_Libedit_Hokeys_Descr, HK_REDO ); + text = AddHotkeyName( _( "&Redo" ), g_Libedit_Hokeys_Descr, HK_REDO ); AddMenuItem( editMenu, wxID_REDO, text, @@ -166,14 +166,14 @@ void LIB_EDIT_FRAME::ReCreateMenuBar() AddMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, KiBitmap( zoom_out_xpm ) ); // Fit on screen - text = AddHotkeyName( _( "&Fit on Screen" ), s_Schematic_Hokeys_Descr, HK_ZOOM_AUTO ); + text = AddHotkeyName( _( "&Fit on Screen" ), g_Libedit_Hokeys_Descr, HK_ZOOM_AUTO ); AddMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, KiBitmap( zoom_fit_in_page_xpm ) ); // Separator viewMenu->AppendSeparator(); // Redraw - text = AddHotkeyName( _( "&Redraw" ), s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW ); + text = AddHotkeyName( _( "&Redraw" ), g_Libedit_Hokeys_Descr, HK_ZOOM_REDRAW ); AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) ); // Menu Place: diff --git a/eeschema/onrightclick.cpp b/eeschema/onrightclick.cpp index 77ac679737..58d9233476 100644 --- a/eeschema/onrightclick.cpp +++ b/eeschema/onrightclick.cpp @@ -93,33 +93,33 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) break; case SCH_TEXT_T: - msg = AddHotkeyName( _( "Edit Text" ), s_Schematic_Hokeys_Descr, HK_EDIT ); + msg = AddHotkeyName( _( "Edit Text" ), g_Schematic_Hokeys_Descr, HK_EDIT ); AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) ); PopMenu->AppendSeparator(); break; case SCH_LABEL_T: - msg = AddHotkeyName( _( "Edit Label" ), s_Schematic_Hokeys_Descr, HK_EDIT ); + msg = AddHotkeyName( _( "Edit Label" ), g_Schematic_Hokeys_Descr, HK_EDIT ); AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) ); PopMenu->AppendSeparator(); break; case SCH_GLOBAL_LABEL_T: - msg = AddHotkeyName( _( "Edit Global Label" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Edit Global Label" ), g_Schematic_Hokeys_Descr, HK_EDIT ); AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) ); PopMenu->AppendSeparator(); break; case SCH_HIERARCHICAL_LABEL_T: - msg = AddHotkeyName( _( "Edit Hierarchical Label" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Edit Hierarchical Label" ), g_Schematic_Hokeys_Descr, HK_EDIT ); AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) ); PopMenu->AppendSeparator(); break; case SCH_BITMAP_T: - msg = AddHotkeyName( _( "Edit Image" ), s_Schematic_Hokeys_Descr, HK_EDIT ); + msg = AddHotkeyName( _( "Edit Image" ), g_Schematic_Hokeys_Descr, HK_EDIT ); AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) ); PopMenu->AppendSeparator(); break; @@ -305,7 +305,7 @@ void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field ) default: name = _( "Move Field" ); break; } - msg = AddHotkeyName( name, s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( name, g_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM ); AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_text_xpm ) ); } @@ -318,7 +318,7 @@ void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field ) default: name = _( "Rotate Field" ); break; } - msg = AddHotkeyName( name, s_Schematic_Hokeys_Descr, HK_ROTATE ); + msg = AddHotkeyName( name, g_Schematic_Hokeys_Descr, HK_ROTATE ); AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_field_xpm ) ); // Ref, value and footprint have specific hotkeys. Show the specific hotkey: @@ -342,7 +342,7 @@ void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field ) name = _( "Edit Field" ); break; } - msg = AddHotkeyName( name, s_Schematic_Hokeys_Descr, id ); + msg = AddHotkeyName( name, g_Schematic_Hokeys_Descr, id ); AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) ); } @@ -362,22 +362,22 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, PART_LIBS* { msg.Printf( _( "Move Component %s" ), GetChars( Component->GetField( REFERENCE )->GetText() ) ); - msg = AddHotkeyName( msg, s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM ); + msg = AddHotkeyName( msg, g_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM ); AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) ); - msg = AddHotkeyName( _( "Drag Component" ), s_Schematic_Hokeys_Descr, HK_DRAG ); + msg = AddHotkeyName( _( "Drag Component" ), g_Schematic_Hokeys_Descr, HK_DRAG ); AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( move_xpm ) ); } wxMenu* orientmenu = new wxMenu; - msg = AddHotkeyName( _( "Rotate Clockwise" ), s_Schematic_Hokeys_Descr, HK_ROTATE ); + msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE ); AddMenuItem( orientmenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) ); AddMenuItem( orientmenu, ID_SCH_ROTATE_COUNTERCLOCKWISE, _( "Rotate Counterclockwise" ), KiBitmap( rotate_ccw_xpm ) ); - msg = AddHotkeyName( _( "Mirror --" ), s_Schematic_Hokeys_Descr, HK_MIRROR_X_COMPONENT ); + msg = AddHotkeyName( _( "Mirror --" ), g_Schematic_Hokeys_Descr, HK_MIRROR_X_COMPONENT ); AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) ); - msg = AddHotkeyName( _( "Mirror ||" ), s_Schematic_Hokeys_Descr, HK_MIRROR_Y_COMPONENT ); + msg = AddHotkeyName( _( "Mirror ||" ), g_Schematic_Hokeys_Descr, HK_MIRROR_Y_COMPONENT ); AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) ); - msg = AddHotkeyName( _( "Normal" ), s_Schematic_Hokeys_Descr, HK_ORIENT_NORMAL_COMPONENT ); + msg = AddHotkeyName( _( "Normal" ), g_Schematic_Hokeys_Descr, HK_ORIENT_NORMAL_COMPONENT ); AddMenuItem( orientmenu, ID_SCH_ORIENT_NORMAL, msg, KiBitmap( normal_xpm ) ); AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP, _( "Orient Component" ), KiBitmap( orient_xpm ) ); @@ -386,10 +386,10 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, PART_LIBS* if( !Component->GetFlags() ) { - msg = AddHotkeyName( _( "Copy Component" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Copy Component" ), g_Schematic_Hokeys_Descr, HK_COPY_COMPONENT_OR_LABEL ); AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, KiBitmap( copy_button_xpm ) ); - msg = AddHotkeyName( _( "Delete Component" ), s_Schematic_Hokeys_Descr, HK_DELETE ); + msg = AddHotkeyName( _( "Delete Component" ), g_Schematic_Hokeys_Descr, HK_DELETE ); AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CMP, msg, KiBitmap( delete_xpm ) ); } @@ -414,22 +414,22 @@ void AddMenusForEditComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, PART_L part = libEntry->GetPart(); wxMenu* editmenu = new wxMenu; - msg = AddHotkeyName( _( "Edit" ), s_Schematic_Hokeys_Descr, HK_EDIT ); + msg = AddHotkeyName( _( "Edit" ), g_Schematic_Hokeys_Descr, HK_EDIT ); AddMenuItem( editmenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_component_xpm ) ); if( part && part->IsNormal() ) { - msg = AddHotkeyName( _( "Value" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Value" ), g_Schematic_Hokeys_Descr, HK_EDIT_COMPONENT_VALUE ); AddMenuItem( editmenu, ID_SCH_EDIT_COMPONENT_VALUE, msg, KiBitmap( edit_comp_value_xpm ) ); - msg = AddHotkeyName( _( "Reference" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Reference" ), g_Schematic_Hokeys_Descr, HK_EDIT_COMPONENT_REFERENCE ); AddMenuItem( editmenu, ID_SCH_EDIT_COMPONENT_REFERENCE, msg, KiBitmap( edit_comp_ref_xpm ) ); - msg = AddHotkeyName( _( "Footprint" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Footprint" ), g_Schematic_Hokeys_Descr, HK_EDIT_COMPONENT_FOOTPRINT ); AddMenuItem( editmenu, ID_SCH_EDIT_COMPONENT_FOOTPRINT, msg, KiBitmap( edit_comp_footprint_xpm ) ); @@ -479,22 +479,22 @@ void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel ) if( !GLabel->GetFlags() ) { - msg = AddHotkeyName( _( "Move Global Label" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Move Global Label" ), g_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM ); AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_text_xpm ) ); - msg = AddHotkeyName( _( "Drag Global Label" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Drag Global Label" ), g_Schematic_Hokeys_Descr, HK_DRAG ); AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( move_text_xpm ) ); - msg = AddHotkeyName( _( "Copy Global Label" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Copy Global Label" ), g_Schematic_Hokeys_Descr, HK_COPY_COMPONENT_OR_LABEL ); AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, KiBitmap( copy_button_xpm ) ); } - msg = AddHotkeyName( _( "Rotate Global Label" ), s_Schematic_Hokeys_Descr, HK_ROTATE ); + msg = AddHotkeyName( _( "Rotate Global Label" ), g_Schematic_Hokeys_Descr, HK_ROTATE ); AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_glabel_xpm ) ); - msg = AddHotkeyName( _( "Edit Global Label" ), s_Schematic_Hokeys_Descr, HK_EDIT ); + msg = AddHotkeyName( _( "Edit Global Label" ), g_Schematic_Hokeys_Descr, HK_EDIT ); AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) ); - msg = AddHotkeyName( _( "Delete Global Label" ), s_Schematic_Hokeys_Descr, HK_DELETE ); + msg = AddHotkeyName( _( "Delete Global Label" ), g_Schematic_Hokeys_Descr, HK_DELETE ); AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_text_xpm ) ); // add menu change type text (to label, glabel, text): @@ -516,21 +516,21 @@ void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel ) if( !HLabel->GetFlags() ) { - msg = AddHotkeyName( _( "Move Hierarchical Label" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Move Hierarchical Label" ), g_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM ); AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_text_xpm ) ); - msg = AddHotkeyName( _( "Drag Hierarchical Label" ), s_Schematic_Hokeys_Descr, HK_DRAG ); + msg = AddHotkeyName( _( "Drag Hierarchical Label" ), g_Schematic_Hokeys_Descr, HK_DRAG ); AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( move_text_xpm ) ); - msg = AddHotkeyName( _( "Copy Hierarchical Label" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Copy Hierarchical Label" ), g_Schematic_Hokeys_Descr, HK_COPY_COMPONENT_OR_LABEL ); AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, KiBitmap( copy_button_xpm ) ); } - msg = AddHotkeyName( _( "Rotate Hierarchical Label" ), s_Schematic_Hokeys_Descr, HK_ROTATE ); + msg = AddHotkeyName( _( "Rotate Hierarchical Label" ), g_Schematic_Hokeys_Descr, HK_ROTATE ); AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_glabel_xpm ) ); - msg = AddHotkeyName( _( "Edit Hierarchical Label" ), s_Schematic_Hokeys_Descr, HK_EDIT ); + msg = AddHotkeyName( _( "Edit Hierarchical Label" ), g_Schematic_Hokeys_Descr, HK_EDIT ); AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) ); - msg = AddHotkeyName( _( "Delete Hierarchical Label" ), s_Schematic_Hokeys_Descr, HK_DELETE ); + msg = AddHotkeyName( _( "Delete Hierarchical Label" ), g_Schematic_Hokeys_Descr, HK_DELETE ); AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_text_xpm ) ); // add menu change type text (to label, glabel, text): @@ -552,21 +552,21 @@ void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label ) if( !Label->GetFlags() ) { - msg = AddHotkeyName( _( "Move Label" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Move Label" ), g_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM ); AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_text_xpm ) ); - msg = AddHotkeyName( _( "Drag Label" ), s_Schematic_Hokeys_Descr, HK_DRAG ); + msg = AddHotkeyName( _( "Drag Label" ), g_Schematic_Hokeys_Descr, HK_DRAG ); AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( move_text_xpm ) ); - msg = AddHotkeyName( _( "Copy Label" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Copy Label" ), g_Schematic_Hokeys_Descr, HK_COPY_COMPONENT_OR_LABEL ); AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, KiBitmap( copy_button_xpm ) ); } - msg = AddHotkeyName( _( "Rotate Label" ), s_Schematic_Hokeys_Descr, HK_ROTATE ); + msg = AddHotkeyName( _( "Rotate Label" ), g_Schematic_Hokeys_Descr, HK_ROTATE ); AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) ); - msg = AddHotkeyName( _( "Edit Label" ), s_Schematic_Hokeys_Descr, HK_EDIT ); + msg = AddHotkeyName( _( "Edit Label" ), g_Schematic_Hokeys_Descr, HK_EDIT ); AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) ); - msg = AddHotkeyName( _( "Delete Label" ), s_Schematic_Hokeys_Descr, HK_DELETE ); + msg = AddHotkeyName( _( "Delete Label" ), g_Schematic_Hokeys_Descr, HK_DELETE ); AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_text_xpm ) ); // add menu change type text (to label, glabel, text): @@ -588,19 +588,19 @@ void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text ) if( !Text->GetFlags() ) { - msg = AddHotkeyName( _( "Move Text" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Move Text" ), g_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM ); AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_text_xpm ) ); - msg = AddHotkeyName( _( "Copy Text" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Copy Text" ), g_Schematic_Hokeys_Descr, HK_COPY_COMPONENT_OR_LABEL ); AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, KiBitmap( copy_button_xpm ) ); } - msg = AddHotkeyName( _( "Rotate Text" ), s_Schematic_Hokeys_Descr, HK_ROTATE ); + msg = AddHotkeyName( _( "Rotate Text" ), g_Schematic_Hokeys_Descr, HK_ROTATE ); AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) ); - msg = AddHotkeyName( _( "Edit Text" ), s_Schematic_Hokeys_Descr, HK_EDIT ); + msg = AddHotkeyName( _( "Edit Text" ), g_Schematic_Hokeys_Descr, HK_EDIT ); AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) ); - msg = AddHotkeyName( _( "Delete Text" ), s_Schematic_Hokeys_Descr, HK_DELETE ); + msg = AddHotkeyName( _( "Delete Text" ), g_Schematic_Hokeys_Descr, HK_DELETE ); AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_text_xpm ) ); /* add menu change type text (to label, glabel, text), @@ -625,7 +625,7 @@ void SCH_EDIT_FRAME::addJunctionMenuEntries( wxMenu* aMenu, SCH_JUNCTION* aJunct wxString msg; SCH_SCREEN* screen = GetScreen(); - msg = AddHotkeyName( _( "Delete Junction" ), s_Schematic_Hokeys_Descr, HK_DELETE ); + msg = AddHotkeyName( _( "Delete Junction" ), g_Schematic_Hokeys_Descr, HK_DELETE ); AddMenuItem( aMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) ); if( !aJunction->IsNew() ) @@ -656,7 +656,7 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame ) if( Wire == NULL ) { - msg = AddHotkeyName( _( "Begin Wire" ), s_Schematic_Hokeys_Descr, HK_BEGIN_WIRE ); + msg = AddHotkeyName( _( "Begin Wire" ), g_Schematic_Hokeys_Descr, HK_BEGIN_WIRE ); AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_WIRE, msg, KiBitmap( add_line_xpm ) ); return; } @@ -664,15 +664,15 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame ) bool is_new = Wire->IsNew(); if( is_new ) { - msg = AddHotkeyName( _( "Wire End" ), s_Schematic_Hokeys_Descr, HK_END_CURR_LINEWIREBUS ); + msg = AddHotkeyName( _( "Wire End" ), g_Schematic_Hokeys_Descr, HK_END_CURR_LINEWIREBUS ); AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( checked_ok_xpm ) ); return; } - msg = AddHotkeyName( _( "Drag Wire" ), s_Schematic_Hokeys_Descr, HK_DRAG ); + msg = AddHotkeyName( _( "Drag Wire" ), g_Schematic_Hokeys_Descr, HK_DRAG ); AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( move_track_xpm ) ); PopMenu->AppendSeparator(); - msg = AddHotkeyName( _( "Delete Wire" ), s_Schematic_Hokeys_Descr, HK_DELETE ); + msg = AddHotkeyName( _( "Delete Wire" ), g_Schematic_Hokeys_Descr, HK_DELETE ); AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ), KiBitmap( delete_node_xpm ) ); @@ -687,9 +687,9 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame ) PopMenu->AppendSeparator(); - msg = AddHotkeyName( _( "Add Junction" ), s_Schematic_Hokeys_Descr, HK_ADD_JUNCTION ); + msg = AddHotkeyName( _( "Add Junction" ), g_Schematic_Hokeys_Descr, HK_ADD_JUNCTION ); AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, KiBitmap( add_junction_xpm ) ); - msg = AddHotkeyName( _( "Add Label" ), s_Schematic_Hokeys_Descr, HK_ADD_LABEL ); + msg = AddHotkeyName( _( "Add Label" ), g_Schematic_Hokeys_Descr, HK_ADD_LABEL ); AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, KiBitmap( add_line_label_xpm ) ); // Add global label command only if the cursor is over one end of the wire. @@ -706,7 +706,7 @@ void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame ) if( Bus == NULL ) { - msg = AddHotkeyName( _( "Begin Bus" ), s_Schematic_Hokeys_Descr, HK_BEGIN_BUS ); + msg = AddHotkeyName( _( "Begin Bus" ), g_Schematic_Hokeys_Descr, HK_BEGIN_BUS ); AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_BUS, msg, KiBitmap( add_bus_xpm ) ); return; } @@ -714,20 +714,20 @@ void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame ) bool is_new = Bus->IsNew(); if( is_new ) { - msg = AddHotkeyName( _( "Bus End" ), s_Schematic_Hokeys_Descr, HK_END_CURR_LINEWIREBUS ); + msg = AddHotkeyName( _( "Bus End" ), g_Schematic_Hokeys_Descr, HK_END_CURR_LINEWIREBUS ); AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( checked_ok_xpm ) ); return; } - msg = AddHotkeyName( _( "Delete Bus" ), s_Schematic_Hokeys_Descr, HK_DELETE ); + msg = AddHotkeyName( _( "Delete Bus" ), g_Schematic_Hokeys_Descr, HK_DELETE ); AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_bus_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Bus" ), KiBitmap( break_bus_xpm ) ); PopMenu->AppendSeparator(); - msg = AddHotkeyName( _( "Add Junction" ), s_Schematic_Hokeys_Descr, HK_ADD_JUNCTION ); + msg = AddHotkeyName( _( "Add Junction" ), g_Schematic_Hokeys_Descr, HK_ADD_JUNCTION ); AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, KiBitmap( add_junction_xpm ) ); - msg = AddHotkeyName( _( "Add Label" ), s_Schematic_Hokeys_Descr, HK_ADD_LABEL ); + msg = AddHotkeyName( _( "Add Label" ), g_Schematic_Hokeys_Descr, HK_ADD_LABEL ); AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, KiBitmap( add_line_label_xpm ) ); // Add global label command only if the cursor is over one end of the bus. @@ -746,11 +746,11 @@ void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet ) AddMenuItem( PopMenu, ID_POPUP_SCH_ENTER_SHEET, _( "Enter Sheet" ), KiBitmap( enter_sheet_xpm ) ); PopMenu->AppendSeparator(); - msg = AddHotkeyName( _( "Move Sheet" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Move Sheet" ), g_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM ); AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_sheet_xpm ) ); - msg = AddHotkeyName( _( "Drag Sheet" ), s_Schematic_Hokeys_Descr, HK_DRAG ); + msg = AddHotkeyName( _( "Drag Sheet" ), g_Schematic_Hokeys_Descr, HK_DRAG ); AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( move_sheet_xpm ) ); } @@ -760,7 +760,7 @@ void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet ) } else { - msg = AddHotkeyName( _( "Edit Sheet" ), s_Schematic_Hokeys_Descr, HK_EDIT ); + msg = AddHotkeyName( _( "Edit Sheet" ), g_Schematic_Hokeys_Descr, HK_EDIT ); AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_sheet_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_RESIZE_SHEET, _( "Resize Sheet" ), @@ -774,7 +774,7 @@ void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet ) KiBitmap( options_pinsheet_xpm ) ); PopMenu->AppendSeparator(); - msg = AddHotkeyName( _( "Delete Sheet" ), s_Schematic_Hokeys_Descr, HK_DELETE ); + msg = AddHotkeyName( _( "Delete Sheet" ), g_Schematic_Hokeys_Descr, HK_DELETE ); AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_sheet_xpm ) ); } } @@ -786,7 +786,7 @@ void AddMenusForSheetPin( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet ) if( !PinSheet->GetFlags() ) { - msg = AddHotkeyName( _( "Move Sheet Pin" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Move Sheet Pin" ), g_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM ); AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) ); } @@ -817,21 +817,21 @@ void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame ) // a block function. if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE ) { - msg = AddHotkeyName( _( "Save Block" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Save Block" ), g_Schematic_Hokeys_Descr, HK_SAVE_BLOCK ); AddMenuItem( PopMenu, wxID_COPY, msg, KiBitmap( copy_button_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_COPY_BLOCK, _( "Copy Block" ), KiBitmap( copyblock_xpm ) ); - msg = AddHotkeyName( _( "Drag Block" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Drag Block" ), g_Schematic_Hokeys_Descr, HK_MOVEBLOCK_TO_DRAGBLOCK ); AddMenuItem( PopMenu, ID_POPUP_DRAG_BLOCK, msg, KiBitmap( move_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), KiBitmap( delete_xpm ) ); - msg = AddHotkeyName( _( "Mirror Block ||" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Mirror Block ||" ), g_Schematic_Hokeys_Descr, HK_MIRROR_Y_COMPONENT ); AddMenuItem( PopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) ); - msg = AddHotkeyName( _( "Mirror Block --" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Mirror Block --" ), g_Schematic_Hokeys_Descr, HK_MIRROR_X_COMPONENT ); AddMenuItem( PopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) ); - msg = AddHotkeyName( _( "Rotate Block CCW" ), s_Schematic_Hokeys_Descr, HK_ROTATE ); + msg = AddHotkeyName( _( "Rotate Block CCW" ), g_Schematic_Hokeys_Descr, HK_ROTATE ); AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) ); #if 0 @@ -857,26 +857,26 @@ void AddMenusForBitmap( wxMenu* aPopMenu, SCH_BITMAP * aBitmap ) wxString msg; if( aBitmap->GetFlags() == 0 ) { - msg = AddHotkeyName( _( "Move Image" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Move Image" ), g_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM ); AddMenuItem( aPopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) ); } - msg = AddHotkeyName( _( "Rotate Image" ), s_Schematic_Hokeys_Descr, HK_ROTATE ); + msg = AddHotkeyName( _( "Rotate Image" ), g_Schematic_Hokeys_Descr, HK_ROTATE ); AddMenuItem( aPopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) ); - msg = AddHotkeyName( _( "Mirror --" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Mirror --" ), g_Schematic_Hokeys_Descr, HK_MIRROR_X_COMPONENT ); AddMenuItem( aPopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) ); - msg = AddHotkeyName( _( "Mirror ||" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Mirror ||" ), g_Schematic_Hokeys_Descr, HK_MIRROR_Y_COMPONENT ); AddMenuItem( aPopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) ); - msg = AddHotkeyName( _( "Edit Image" ), s_Schematic_Hokeys_Descr, HK_EDIT ); + msg = AddHotkeyName( _( "Edit Image" ), g_Schematic_Hokeys_Descr, HK_EDIT ); AddMenuItem( aPopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) ); if( aBitmap->GetFlags() == 0 ) { aPopMenu->AppendSeparator(); - msg = AddHotkeyName( _( "Delete Image" ), s_Schematic_Hokeys_Descr, HK_DELETE ); + msg = AddHotkeyName( _( "Delete Image" ), g_Schematic_Hokeys_Descr, HK_DELETE ); AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) ); } } @@ -887,7 +887,7 @@ void AddMenusForBusEntry( wxMenu* aPopMenu, SCH_BUS_ENTRY_BASE* aBusEntry ) wxString msg; if( !aBusEntry->GetFlags() ) { - msg = AddHotkeyName( _( "Move Bus Entry" ), s_Schematic_Hokeys_Descr, + msg = AddHotkeyName( _( "Move Bus Entry" ), g_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM ); AddMenuItem( aPopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) ); } @@ -899,6 +899,6 @@ void AddMenusForBusEntry( wxMenu* aPopMenu, SCH_BUS_ENTRY_BASE* aBusEntry ) AddMenuItem( aPopMenu, ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH, _( "Set Bus Entry Shape \\" ), KiBitmap( change_entry_orient_xpm ) ); - msg = AddHotkeyName( _( "Delete Bus Entry" ), s_Schematic_Hokeys_Descr, HK_DELETE ); + msg = AddHotkeyName( _( "Delete Bus Entry" ), g_Schematic_Hokeys_Descr, HK_DELETE ); AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) ); } diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index 69265f253a..65c9e4928e 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -319,7 +319,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ): m_printMonochrome = true; m_printSheetReference = true; SetShowPageLimits( true ); - m_HotkeysZoomAndGridList = s_Schematic_Hokeys_Descr; + m_HotkeysZoomAndGridList = g_Schematic_Hokeys_Descr; m_dlgFindReplace = NULL; m_findReplaceData = new wxFindReplaceData( wxFR_DOWN ); m_undoItem = NULL; diff --git a/eeschema/tool_lib.cpp b/eeschema/tool_lib.cpp index 8440bd0b2d..e9e930136e 100644 --- a/eeschema/tool_lib.cpp +++ b/eeschema/tool_lib.cpp @@ -147,9 +147,9 @@ void LIB_EDIT_FRAME::ReCreateHToolbar() _( "Save current component to new library" ) ); m_mainToolBar->AddSeparator(); - msg = AddHotkeyName( _( "Undo last command" ), s_Schematic_Hokeys_Descr, HK_UNDO, IS_COMMENT ); + msg = AddHotkeyName( _( "Undo last command" ), g_Libedit_Hokeys_Descr, HK_UNDO, IS_COMMENT ); m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString, KiBitmap( undo_xpm ), msg ); - msg = AddHotkeyName( _( "Redo the last command" ), s_Schematic_Hokeys_Descr, HK_REDO, + msg = AddHotkeyName( _( "Redo the last command" ), g_Libedit_Hokeys_Descr, HK_REDO, IS_COMMENT ); m_mainToolBar->AddTool( wxID_REDO, wxEmptyString, KiBitmap( redo_xpm ), msg ); @@ -166,16 +166,16 @@ void LIB_EDIT_FRAME::ReCreateHToolbar() _( "Test for duplicate and off grid pins" ) ); m_mainToolBar->AddSeparator(); - msg = AddHotkeyName( HELP_ZOOM_IN, s_Libedit_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT ); + msg = AddHotkeyName( HELP_ZOOM_IN, g_Libedit_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT ); m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), msg ); - msg = AddHotkeyName( HELP_ZOOM_OUT, s_Libedit_Hokeys_Descr, HK_ZOOM_OUT, IS_COMMENT ); + msg = AddHotkeyName( HELP_ZOOM_OUT, g_Libedit_Hokeys_Descr, HK_ZOOM_OUT, IS_COMMENT ); m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), msg ); - msg = AddHotkeyName( HELP_ZOOM_REDRAW, s_Libedit_Hokeys_Descr, HK_ZOOM_REDRAW, IS_COMMENT ); + msg = AddHotkeyName( HELP_ZOOM_REDRAW, g_Libedit_Hokeys_Descr, HK_ZOOM_REDRAW, IS_COMMENT ); m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg ); - msg = AddHotkeyName( HELP_ZOOM_FIT, s_Libedit_Hokeys_Descr, HK_ZOOM_AUTO, IS_COMMENT ); + msg = AddHotkeyName( HELP_ZOOM_FIT, g_Libedit_Hokeys_Descr, HK_ZOOM_AUTO, IS_COMMENT ); m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), msg ); m_mainToolBar->AddSeparator(); diff --git a/eeschema/tool_sch.cpp b/eeschema/tool_sch.cpp index b11cd5b786..a3fbb05011 100644 --- a/eeschema/tool_sch.cpp +++ b/eeschema/tool_sch.cpp @@ -91,17 +91,17 @@ void SCH_EDIT_FRAME::ReCreateHToolbar() m_mainToolBar->AddSeparator(); - msg = AddHotkeyName( HELP_UNDO, s_Schematic_Hokeys_Descr, HK_UNDO, IS_COMMENT ); + msg = AddHotkeyName( HELP_UNDO, g_Schematic_Hokeys_Descr, HK_UNDO, IS_COMMENT ); m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString, KiBitmap( undo_xpm ), msg ); - msg = AddHotkeyName( HELP_REDO, s_Schematic_Hokeys_Descr, HK_REDO, IS_COMMENT ); + msg = AddHotkeyName( HELP_REDO, g_Schematic_Hokeys_Descr, HK_REDO, IS_COMMENT ); m_mainToolBar->AddTool( wxID_REDO, wxEmptyString, KiBitmap( redo_xpm ), msg ); m_mainToolBar->AddSeparator(); - msg = AddHotkeyName( HELP_FIND, s_Schematic_Hokeys_Descr, HK_FIND_ITEM, IS_COMMENT ); + msg = AddHotkeyName( HELP_FIND, g_Schematic_Hokeys_Descr, HK_FIND_ITEM, IS_COMMENT ); m_mainToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, KiBitmap( find_xpm ), msg ); m_mainToolBar->AddTool( wxID_REPLACE, wxEmptyString, KiBitmap( find_replace_xpm ), @@ -111,16 +111,16 @@ void SCH_EDIT_FRAME::ReCreateHToolbar() m_mainToolBar->AddSeparator(); - msg = AddHotkeyName( HELP_ZOOM_IN, s_Schematic_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT ); + msg = AddHotkeyName( HELP_ZOOM_IN, g_Schematic_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT ); m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), msg ); - msg = AddHotkeyName( HELP_ZOOM_OUT, s_Schematic_Hokeys_Descr, HK_ZOOM_OUT, IS_COMMENT ); + msg = AddHotkeyName( HELP_ZOOM_OUT, g_Schematic_Hokeys_Descr, HK_ZOOM_OUT, IS_COMMENT ); m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), msg ); - msg = AddHotkeyName( HELP_ZOOM_REDRAW, s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW, IS_COMMENT ); + msg = AddHotkeyName( HELP_ZOOM_REDRAW, g_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW, IS_COMMENT ); m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg ); - msg = AddHotkeyName( HELP_ZOOM_FIT, s_Schematic_Hokeys_Descr, HK_ZOOM_AUTO, IS_COMMENT ); + msg = AddHotkeyName( HELP_ZOOM_FIT, g_Schematic_Hokeys_Descr, HK_ZOOM_AUTO, IS_COMMENT ); m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), msg ); diff --git a/eeschema/tool_viewlib.cpp b/eeschema/tool_viewlib.cpp index 7d53802184..658661dd34 100644 --- a/eeschema/tool_viewlib.cpp +++ b/eeschema/tool_viewlib.cpp @@ -37,6 +37,8 @@ #include #include #include +#include +#include void LIB_VIEW_FRAME::ReCreateHToolbar() @@ -70,22 +72,22 @@ void LIB_VIEW_FRAME::ReCreateHToolbar() _( "Display next component" ) ); m_mainToolBar->AddSeparator(); - msg = AddHotkeyName( _( "Zoom in" ), s_Viewlib_Hokeys_Descr, + msg = AddHotkeyName( _( "Zoom in" ), g_Viewlib_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT ); m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), msg ); - msg = AddHotkeyName( _( "Zoom out" ), s_Viewlib_Hokeys_Descr, + msg = AddHotkeyName( _( "Zoom out" ), g_Viewlib_Hokeys_Descr, HK_ZOOM_OUT, IS_COMMENT ); m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), msg ); - msg = AddHotkeyName( _( "Redraw view" ), s_Viewlib_Hokeys_Descr, + msg = AddHotkeyName( _( "Redraw view" ), g_Viewlib_Hokeys_Descr, HK_ZOOM_REDRAW, IS_COMMENT ); m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg ); - msg = AddHotkeyName( _( "Zoom auto" ), s_Viewlib_Hokeys_Descr, + msg = AddHotkeyName( _( "Zoom auto" ), g_Viewlib_Hokeys_Descr, HK_ZOOM_AUTO, IS_COMMENT ); m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), msg ); @@ -181,3 +183,97 @@ void LIB_VIEW_FRAME::ReCreateHToolbar() void LIB_VIEW_FRAME::ReCreateVToolbar() { } + + +// Virtual function +void LIB_VIEW_FRAME::ReCreateMenuBar( void ) +{ + // Create and try to get the current menubar + wxMenuBar* menuBar = GetMenuBar(); + + if( !menuBar ) + menuBar = new wxMenuBar(); + + // Delete all existing menus so they can be rebuilt. + // This allows language changes of the menu text on the fly. + menuBar->Freeze(); + + while( menuBar->GetMenuCount() ) + delete menuBar->Remove( 0 ); + + // Recreate all menus: + wxString text; + + // Menu File: + wxMenu* fileMenu = new wxMenu; + + // Active library selection + AddMenuItem( fileMenu, ID_LIBVIEW_SELECT_LIB, _("Set Current Library"), + _( "Select library to be displayed" ), + KiBitmap( open_library_xpm ) ); + fileMenu->AppendSeparator(); + + // Close viewer + AddMenuItem( fileMenu, wxID_EXIT, + _( "Cl&ose" ), + _( "Close schematic component viewer" ), + KiBitmap( exit_xpm ) ); + + // View menu + wxMenu* viewMenu = new wxMenu; + + text = AddHotkeyName( _( "Zoom &In" ), g_Viewlib_Hokeys_Descr, + HK_ZOOM_IN, IS_ACCELERATOR ); + AddMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, KiBitmap( zoom_in_xpm ) ); + + text = AddHotkeyName( _( "Zoom &Out" ), g_Viewlib_Hokeys_Descr, + HK_ZOOM_OUT, IS_ACCELERATOR ); + AddMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, KiBitmap( zoom_out_xpm ) ); + + text = AddHotkeyName( _( "&Fit on Screen" ), g_Viewlib_Hokeys_Descr, + HK_ZOOM_AUTO ); + AddMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, + KiBitmap( zoom_fit_in_page_xpm ) ); + + text = AddHotkeyName( _( "&Redraw" ), g_Viewlib_Hokeys_Descr, HK_ZOOM_REDRAW ); + AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text, + HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) ); + + // Menu Help: + wxMenu* helpMenu = new wxMenu; + + // Version info + AddHelpVersionInfoMenuEntry( helpMenu ); + + // Contents + AddMenuItem( helpMenu, wxID_HELP, + _( "Eesc&hema Manual" ), + _( "Open Eeschema manual" ), + KiBitmap( online_help_xpm ) ); + + AddMenuItem( helpMenu, wxID_INDEX, + _( "&Getting Started in KiCad" ), + _( "Open the \"Getting Started in KiCad\" guide for beginners" ), + KiBitmap( help_xpm ) ); + + // About Pcbnew + helpMenu->AppendSeparator(); + AddMenuItem( helpMenu, wxID_ABOUT, + _( "&About Eeschema" ), + _( "About Eeschema schematic designer" ), + KiBitmap( info_xpm ) ); + + // Append menus to the menubar + menuBar->Append( fileMenu, _( "&File" ) ); + + menuBar->Append( viewMenu, _( "&View" ) ); + menuBar->Append( helpMenu, _( "&Help" ) ); + + menuBar->Thaw(); + + // Associate the menu bar with the frame, if no previous menubar + if( GetMenuBar() == NULL ) + SetMenuBar( menuBar ); + else + menuBar->Refresh(); +} diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index 7d7805e7c8..330777e374 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -70,26 +70,14 @@ BEGIN_EVENT_TABLE( LIB_VIEW_FRAME, EDA_DRAW_FRAME ) EVT_LISTBOX( ID_LIBVIEW_CMP_LIST, LIB_VIEW_FRAME::ClickOnCmpList ) EVT_LISTBOX_DCLICK( ID_LIBVIEW_CMP_LIST, LIB_VIEW_FRAME::DClickOnCmpList ) + // Menu (and/or hotkey) events + EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp ) + EVT_MENU( wxID_EXIT, LIB_VIEW_FRAME::CloseLibraryViewer ) EVT_MENU( ID_SET_RELATIVE_OFFSET, LIB_VIEW_FRAME::OnSetRelativeOffset ) + END_EVENT_TABLE() -/* - * This emulates the zoom menu entries found in the other KiCad applications. - * The library viewer does not have any menus so add an accelerator table to - * the main frame. - */ -static wxAcceleratorEntry accels[] = -{ - wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F1, ID_ZOOM_IN ), - wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F2, ID_ZOOM_OUT ), - wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F3, ID_ZOOM_REDRAW ), - wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F4, ID_POPUP_ZOOM_CENTER ), - wxAcceleratorEntry( wxACCEL_NORMAL, WXK_HOME, ID_ZOOM_PAGE ), - wxAcceleratorEntry( wxACCEL_NORMAL, WXK_SPACE, ID_SET_RELATIVE_OFFSET ) -}; - -#define ACCEL_TABLE_CNT ( sizeof( accels ) / sizeof( wxAcceleratorEntry ) ) #define LIB_VIEW_FRAME_NAME wxT( "ViewlibFrame" ) LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType, @@ -106,18 +94,15 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame if( aFrameType == FRAME_SCH_VIEWER_MODAL ) SetModal( true ); - wxAcceleratorTable table( ACCEL_TABLE_CNT, accels ); - m_FrameName = GetLibViewerFrameName(); m_configPath = wxT( "LibraryViewer" ); // Give an icon wxIcon icon; icon.CopyFromBitmap( KiBitmap( library_browse_xpm ) ); - SetIcon( icon ); - m_HotkeysZoomAndGridList = s_Viewlib_Hokeys_Descr; + m_HotkeysZoomAndGridList = g_Viewlib_Hokeys_Descr; m_cmpList = NULL; m_libList = NULL; @@ -131,6 +116,9 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000; GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); + // Menu bar is not mandatory: uncomment/comment the next line + // to add/remove the menubar + ReCreateMenuBar(); ReCreateHToolbar(); ReCreateVToolbar(); @@ -166,12 +154,8 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame DisplayLibInfos(); - if( m_canvas ) - m_canvas->SetAcceleratorTable( table ); - m_auimgr.SetManagedWindow( this ); - EDA_PANEINFO horiz; horiz.HorizontalToolbarPane(); @@ -550,3 +534,9 @@ void LIB_VIEW_FRAME::OnActivate( wxActivateEvent& event ) DisplayLibInfos(); } + + +void LIB_VIEW_FRAME::CloseLibraryViewer( wxCommandEvent& event ) +{ + Close(); +} diff --git a/eeschema/viewlib_frame.h b/eeschema/viewlib_frame.h index 36b46351c3..2d83dcc3b5 100644 --- a/eeschema/viewlib_frame.h +++ b/eeschema/viewlib_frame.h @@ -79,8 +79,11 @@ public: void DisplayLibInfos(); void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void OnCloseWindow( wxCloseEvent& Event ); + void CloseLibraryViewer( wxCommandEvent& event ); void ReCreateHToolbar(); void ReCreateVToolbar(); + void ReCreateMenuBar(); + void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); double BestZoom(); void ClickOnLibList( wxCommandEvent& event ); @@ -89,6 +92,16 @@ public: bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ); + /** + * Function OnHotKey + * handle hot key events. + * + */ + bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL ); + void LoadSettings( wxConfigBase* aCfg ); void SaveSettings( wxConfigBase* aCfg ); diff --git a/include/id.h b/include/id.h index 02d06b8130..937028d999 100644 --- a/include/id.h +++ b/include/id.h @@ -112,7 +112,7 @@ enum main_id ID_EXIT, ID_OPTIONS_SETUP, - // Find id menu + // id for toolbars ID_H_TOOLBAR, ID_V_TOOLBAR, ID_OPT_TOOLBAR, @@ -169,10 +169,6 @@ enum main_id ID_POPUP_SELECT_ITEMS_BLOCK, ID_POPUP_MIRROR_X_BLOCK, ID_POPUP_MIRROR_Y_BLOCK, - ID_POPUP_MIRROR_UNUSED0, - ID_POPUP_MIRROR_UNUSED1, - ID_POPUP_MIRROR_UNUSED2, - ID_POPUP_MIRROR_UNUSED3, ID_POPUP_OTHER_COMMANDS, ID_POPUP_GENERAL_END_RANGE, // last number @@ -185,6 +181,8 @@ enum main_id ID_POPUP_ZOOM_OUT, ID_POPUP_ZOOM_SELECT, ID_POPUP_ZOOM_CENTER, + ID_POPUP_ZOOM_PAGE, + ID_POPUP_ZOOM_REDRAW, /* Reserve IDs for popup menu zoom levels. If you need more * levels of zoom, change ID_POPUP_ZOOM_LEVEL_END. Note that more @@ -229,10 +227,19 @@ enum main_id ID_SHEET_SET, ID_COMPONENT_BUTT, - ID_ZOOM_IN, + ID_ZOOM_BEGIN, + ID_ZOOM_IN = ID_ZOOM_BEGIN, ID_ZOOM_OUT, ID_ZOOM_PAGE, ID_ZOOM_REDRAW, + ID_VIEWER_ZOOM_IN, + ID_VIEWER_ZOOM_OUT, + ID_VIEWER_ZOOM_PAGE, + ID_VIEWER_ZOOM_REDRAW, + // zoom commands for non center zooming + ID_OFFCENTER_ZOOM_IN, + ID_OFFCENTER_ZOOM_OUT, + ID_ZOOM_END, // Panning command event IDs. ID_PAN_UP, @@ -262,10 +269,6 @@ enum main_id ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, ID_TB_OPTIONS_SHOW_PADS_SKETCH, - // zoom commands for non center zooming - ID_OFFCENTER_ZOOM_IN, - ID_OFFCENTER_ZOOM_OUT, - ID_DIALOG_ERC, ///< eeschema ERC modeless dialog ID // IDs specifics to a sub-application (Eeschema, Kicad manager....) start here diff --git a/pcbnew/hotkeys.cpp b/pcbnew/hotkeys.cpp index bfd91c7bf0..e6ed7dee19 100644 --- a/pcbnew/hotkeys.cpp +++ b/pcbnew/hotkeys.cpp @@ -5,6 +5,8 @@ #include #include #include +#include +#include #include @@ -223,6 +225,17 @@ EDA_HOTKEY* common_Hotkey_List[] = NULL }; +// common hotkey descriptors only useful in footprint viewer +EDA_HOTKEY* common_basic_Hotkey_List[] = +{ + &HkHelp, &HkZoomIn, &HkZoomOut, + &HkZoomRedraw, &HkZoomCenter, &HkZoomAuto, + &HkSwitchUnits, &HkResetLocalCoord, + &HkMouseLeftClick, + &HkMouseLeftDClick, + NULL +}; + // List of hotkey descriptors for Pcbnew EDA_HOTKEY* board_edit_Hotkey_List[] = { @@ -263,6 +276,12 @@ EDA_HOTKEY* module_edit_Hotkey_List[] = { NULL }; +// List of hotkey descriptors for the module viewer +// Currently empty +EDA_HOTKEY* module_viewer_Hotkey_List[] = { + NULL + }; + // list of sections and corresponding hotkey list for Pcbnew // (used to create an hotkey config file, and edit hotkeys ) struct EDA_HOTKEY_CONFIG g_Pcbnew_Editor_Hokeys_Descr[] = { @@ -291,7 +310,87 @@ struct EDA_HOTKEY_CONFIG g_Module_Editor_Hokeys_Descr[] = { // list of sections and corresponding hotkey list for the footprint viewer // (used to list current hotkeys in the module viewer) struct EDA_HOTKEY_CONFIG g_Module_Viewer_Hokeys_Descr[] = { - { &g_CommonSectionTag, common_Hotkey_List, NULL }, + { &g_CommonSectionTag, common_basic_Hotkey_List, NULL }, { NULL, NULL, NULL } }; + +bool FOOTPRINT_VIEWER_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, + EDA_ITEM* aItem ) +{ + if( aHotKey == 0 ) + return false; + + wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); + cmd.SetEventObject( this ); + + /* Convert lower to upper case (the usual toupper function has problem with non ascii + * codes like function keys */ + if( (aHotKey >= 'a') && (aHotKey <= 'z') ) + aHotKey += 'A' - 'a'; + + EDA_HOTKEY* HK_Descr = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List ); + + if( HK_Descr == NULL ) + HK_Descr = GetDescriptorFromHotkey( aHotKey, module_viewer_Hotkey_List ); + + if( HK_Descr == NULL ) + return false; + + switch( HK_Descr->m_Idcommand ) + { + default: + case HK_NOT_FOUND: + return false; + + case HK_HELP: // Display Current hotkey list + DisplayHotkeyList( this, g_Module_Viewer_Hokeys_Descr ); + break; + + case HK_RESET_LOCAL_COORD: // set local (relative) coordinate origin + GetScreen()->m_O_Curseur = GetCrossHairPosition(); + break; + + case HK_LEFT_CLICK: + OnLeftClick( aDC, aPosition ); + break; + + case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events + OnLeftClick( aDC, aPosition ); + OnLeftDClick( aDC, aPosition ); + break; + + case HK_SWITCH_UNITS: + cmd.SetId( (g_UserUnit == INCHES) ? + ID_TB_OPTIONS_SELECT_UNIT_MM : ID_TB_OPTIONS_SELECT_UNIT_INCH ); + GetEventHandler()->ProcessEvent( cmd ); + break; + + case HK_ZOOM_IN: + cmd.SetId( ID_POPUP_ZOOM_IN ); + GetEventHandler()->ProcessEvent( cmd ); + break; + + case HK_ZOOM_OUT: + cmd.SetId( ID_POPUP_ZOOM_OUT ); + GetEventHandler()->ProcessEvent( cmd ); + break; + + case HK_ZOOM_REDRAW: + cmd.SetId( ID_ZOOM_REDRAW ); + GetEventHandler()->ProcessEvent( cmd ); + break; + + case HK_ZOOM_CENTER: + cmd.SetId( ID_POPUP_ZOOM_CENTER ); + GetEventHandler()->ProcessEvent( cmd ); + break; + + case HK_ZOOM_AUTO: + cmd.SetId( ID_ZOOM_PAGE ); + GetEventHandler()->ProcessEvent( cmd ); + break; + } + + return true; +} diff --git a/pcbnew/menubar_modedit.cpp b/pcbnew/menubar_modedit.cpp index fc73ba49b0..f65790360c 100644 --- a/pcbnew/menubar_modedit.cpp +++ b/pcbnew/menubar_modedit.cpp @@ -38,6 +38,7 @@ #include #include +#include void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() @@ -200,28 +201,35 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() // View menu wxMenu* viewMenu = new wxMenu; - // Zoom In - AddMenuItem( viewMenu, ID_ZOOM_IN, - _( "Zoom &In" ), _( "Zoom in" ), - KiBitmap( zoom_in_xpm ) ); + /* Important Note for ZOOM IN and ZOOM OUT commands from menubar: + * we cannot add hotkey info here, because the hotkey HK_ZOOM_IN and HK_ZOOM_OUT + * events(default = WXK_F1 and WXK_F2) are *NOT* equivalent to this menu command: + * zoom in and out from hotkeys are equivalent to the pop up menu zoom + * From here, zooming is made around the screen center + * From hotkeys, zooming is made around the mouse cursor position + * (obviously not possible from the toolbar or menubar command) + * + * in other words HK_ZOOM_IN and HK_ZOOM_OUT *are NOT* accelerators + * for Zoom in and Zoom out sub menus + */ + text = AddHotkeyName( _( "Zoom &In" ), g_Module_Editor_Hokeys_Descr, + HK_ZOOM_IN, IS_ACCELERATOR ); + AddMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, KiBitmap( zoom_in_xpm ) ); - // Zoom Out - AddMenuItem( viewMenu, ID_ZOOM_OUT, - _( "Zoom &Out" ), _( "Zoom out" ), - KiBitmap( zoom_out_xpm ) ); + text = AddHotkeyName( _( "Zoom &Out" ), g_Module_Editor_Hokeys_Descr, + HK_ZOOM_OUT, IS_ACCELERATOR ); + AddMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, KiBitmap( zoom_out_xpm ) ); - // Fit on Screen - AddMenuItem( viewMenu, ID_ZOOM_PAGE, - _( "&Fit on Screen" ), - _( "Zoom to fit the module in the window" ), + text = AddHotkeyName( _( "&Fit on Screen" ), g_Module_Editor_Hokeys_Descr, + HK_ZOOM_AUTO ); + AddMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, KiBitmap( zoom_fit_in_page_xpm ) ); - viewMenu->AppendSeparator(); + text = AddHotkeyName( _( "&Redraw" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_REDRAW ); + AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text, + HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) ); - // Redraw - AddMenuItem( viewMenu, ID_ZOOM_REDRAW, - _( "&Redraw" ), _( "Redraw window's viewport" ), - KiBitmap( zoom_redraw_xpm ) ); + viewMenu->AppendSeparator(); // 3D view AddMenuItem( viewMenu, ID_MENU_PCB_SHOW_3D_FRAME, diff --git a/pcbnew/menubar_pcbframe.cpp b/pcbnew/menubar_pcbframe.cpp index 76c67252c0..1f699fcc13 100644 --- a/pcbnew/menubar_pcbframe.cpp +++ b/pcbnew/menubar_pcbframe.cpp @@ -320,15 +320,14 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() AddMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, KiBitmap( zoom_out_xpm ) ); text = AddHotkeyName( _( "&Fit on Screen" ), g_Pcbnew_Editor_Hokeys_Descr, - HK_ZOOM_AUTO, IS_ACCELERATOR ); + HK_ZOOM_AUTO ); AddMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, KiBitmap( zoom_fit_in_page_xpm ) ); - viewMenu->AppendSeparator(); - text = AddHotkeyName( _( "&Redraw" ), g_Pcbnew_Editor_Hokeys_Descr, HK_ZOOM_REDRAW ); AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) ); + viewMenu->AppendSeparator(); AddMenuItem( viewMenu, ID_MENU_PCB_SHOW_3D_FRAME, diff --git a/pcbnew/modview_frame.cpp b/pcbnew/modview_frame.cpp index 2651ee6117..ba7a7aeebd 100644 --- a/pcbnew/modview_frame.cpp +++ b/pcbnew/modview_frame.cpp @@ -73,6 +73,10 @@ BEGIN_EVENT_TABLE( FOOTPRINT_VIEWER_FRAME, EDA_DRAW_FRAME ) EVT_SIZE( FOOTPRINT_VIEWER_FRAME::OnSize ) EVT_ACTIVATE( FOOTPRINT_VIEWER_FRAME::OnActivate ) + // Menu (and/or hotkey) events + EVT_MENU( wxID_EXIT, FOOTPRINT_VIEWER_FRAME::CloseFootprintViewer ) + EVT_MENU( ID_SET_RELATIVE_OFFSET, FOOTPRINT_VIEWER_FRAME::OnSetRelativeOffset ) + // Toolbar events EVT_TOOL( ID_MODVIEW_SELECT_LIB, FOOTPRINT_VIEWER_FRAME::SelectCurrentLibrary ) @@ -91,27 +95,9 @@ BEGIN_EVENT_TABLE( FOOTPRINT_VIEWER_FRAME, EDA_DRAW_FRAME ) EVT_LISTBOX( ID_MODVIEW_FOOTPRINT_LIST, FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList ) EVT_LISTBOX_DCLICK( ID_MODVIEW_FOOTPRINT_LIST, FOOTPRINT_VIEWER_FRAME::DClickOnFootprintList ) - EVT_MENU( ID_SET_RELATIVE_OFFSET, FOOTPRINT_VIEWER_FRAME::OnSetRelativeOffset ) END_EVENT_TABLE() -/* - * This emulates the zoom menu entries found in the other KiCad applications. - * The library viewer does not have any menus so add an accelerator table to - * the main frame. - */ -static wxAcceleratorEntry accels[] = -{ - wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F1, ID_ZOOM_IN ), - wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F2, ID_ZOOM_OUT ), - wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F3, ID_ZOOM_REDRAW ), - wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F4, ID_POPUP_ZOOM_CENTER ), - wxAcceleratorEntry( wxACCEL_NORMAL, WXK_HOME, ID_ZOOM_PAGE ), - wxAcceleratorEntry( wxACCEL_NORMAL, WXK_SPACE, ID_SET_RELATIVE_OFFSET ) -}; - - -#define EXTRA_BORDER_SIZE 2 #define FOOTPRINT_VIEWER_FRAME_NAME wxT( "ModViewFrame" ) @@ -129,8 +115,6 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent if( aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL ) SetModal( true ); - wxAcceleratorTable table( DIM( accels ), accels ); - m_FrameName = GetFootprintViewerFrameName(); m_configPath = wxT( "FootprintViewer" ); m_showAxis = true; // true to draw axis. @@ -161,6 +145,9 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); + // Menu bar is not mandatory: uncomment/comment the next line + // to add/remove the menubar + ReCreateMenuBar(); ReCreateHToolbar(); ReCreateVToolbar(); @@ -197,9 +184,6 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent drawPanel->DisplayBoard( m_Pcb ); updateView(); - if( m_canvas ) - m_canvas->SetAcceleratorTable( table ); - m_auimgr.SetManagedWindow( this ); wxSize minsize(100,-1); // Min size of list boxes @@ -609,7 +593,12 @@ bool FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition wxPoint pos = aPosition; GeneralControlKeyMovement( aHotKey, &pos, true ); - switch( aHotKey ) + if( aHotKey ) + { + eventHandled = OnHotKey( aDC, aHotKey, aPosition ); + } + +/* switch( aHotKey ) { case WXK_F1: cmd.SetId( ID_POPUP_ZOOM_IN ); @@ -643,7 +632,7 @@ bool FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition default: eventHandled = false; } - +*/ SetCrossHairPosition( pos ); RefreshCrossHair( oldpos, aPosition, aDC ); @@ -898,3 +887,9 @@ void FOOTPRINT_VIEWER_FRAME::updateView() m_toolManager->RunAction( COMMON_ACTIONS::zoomFitScreen, true ); } } + + +void FOOTPRINT_VIEWER_FRAME::CloseFootprintViewer( wxCommandEvent& event ) +{ + Close(); +} diff --git a/pcbnew/modview_frame.h b/pcbnew/modview_frame.h index e8892ed3f1..ca744dcdce 100644 --- a/pcbnew/modview_frame.h +++ b/pcbnew/modview_frame.h @@ -104,8 +104,12 @@ private: void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void OnCloseWindow( wxCloseEvent& Event ); + void CloseFootprintViewer( wxCommandEvent& event ); + void ReCreateHToolbar(); void ReCreateVToolbar(); + void ReCreateMenuBar(); + void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void ClickOnLibList( wxCommandEvent& event ); void ClickOnFootprintList( wxCommandEvent& event ); @@ -114,6 +118,16 @@ private: bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ); + /** + * Function OnHotKey + * handle hot key events. + * + */ + bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL ); + void LoadSettings( wxConfigBase* aCfg ); // override virtual void SaveSettings( wxConfigBase* aCfg ); // override virtual diff --git a/pcbnew/tool_modview.cpp b/pcbnew/tool_modview.cpp index 3101864a0c..ac6e4faf94 100644 --- a/pcbnew/tool_modview.cpp +++ b/pcbnew/tool_modview.cpp @@ -1,10 +1,10 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr + * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2012 Wayne Stambaugh - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -35,9 +35,11 @@ #include #include +#include #include #include #include +#include void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar() @@ -47,7 +49,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar() if( m_mainToolBar == NULL ) { m_mainToolBar = new wxAuiToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, - wxAUI_TB_DEFAULT_STYLE + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT | wxAUI_TB_OVERFLOW ); // Set up toolbar @@ -74,24 +76,24 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar() _( "Show footprint in 3D viewer" ) ); m_mainToolBar->AddSeparator(); - msg = AddHotkeyName( _( "Zoom in" ), g_Module_Editor_Hokeys_Descr, + msg = AddHotkeyName( _( "Zoom in" ), g_Module_Viewer_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT ); - m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, + m_mainToolBar->AddTool( ID_VIEWER_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), msg ); - msg = AddHotkeyName( _( "Zoom out" ), g_Module_Editor_Hokeys_Descr, + msg = AddHotkeyName( _( "Zoom out" ), g_Module_Viewer_Hokeys_Descr, HK_ZOOM_OUT, IS_COMMENT ); - m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, + m_mainToolBar->AddTool( ID_VIEWER_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), msg ); - msg = AddHotkeyName( _( "Redraw view" ), g_Module_Editor_Hokeys_Descr, - HK_ZOOM_REDRAW, IS_COMMENT ); - m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, + msg = AddHotkeyName( _( "Redraw view" ), g_Module_Viewer_Hokeys_Descr, + HK_ZOOM_REDRAW ); + m_mainToolBar->AddTool( ID_VIEWER_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg ); - msg = AddHotkeyName( _( "Zoom auto" ), g_Module_Editor_Hokeys_Descr, - HK_ZOOM_AUTO, IS_COMMENT ); - m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, + msg = AddHotkeyName( _( "Zoom auto" ), g_Module_Viewer_Hokeys_Descr, + HK_ZOOM_AUTO ); + m_mainToolBar->AddTool( ID_VIEWER_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), msg ); if( IsModal() ) @@ -114,3 +116,105 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar() void FOOTPRINT_VIEWER_FRAME::ReCreateVToolbar() { } + + +// Virtual function +void FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar( void ) +{ + // Create and try to get the current menubar + wxMenuBar* menuBar = GetMenuBar(); + + if( !menuBar ) + menuBar = new wxMenuBar(); + + // Delete all existing menus so they can be rebuilt. + // This allows language changes of the menu text on the fly. + menuBar->Freeze(); + + while( menuBar->GetMenuCount() ) + delete menuBar->Remove( 0 ); + + // Recreate all menus: + wxString text; + + // Menu File: + wxMenu* fileMenu = new wxMenu; + + // Active library selection + AddMenuItem( fileMenu, ID_MODVIEW_SELECT_LIB, _("Set Current Library"), + _( "Select library to be displayed" ), + KiBitmap( open_library_xpm ) ); + fileMenu->AppendSeparator(); + + // Close viewer + AddMenuItem( fileMenu, wxID_EXIT, + _( "Cl&ose" ), + _( "Close footprint viewer" ), + KiBitmap( exit_xpm ) ); + + // View menu + wxMenu* viewMenu = new wxMenu; + + text = AddHotkeyName( _( "Zoom &In" ), g_Module_Viewer_Hokeys_Descr, + HK_ZOOM_IN, IS_ACCELERATOR ); + AddMenuItem( viewMenu, ID_VIEWER_ZOOM_IN, text, HELP_ZOOM_IN, KiBitmap( zoom_in_xpm ) ); + + text = AddHotkeyName( _( "Zoom &Out" ), g_Module_Viewer_Hokeys_Descr, + HK_ZOOM_OUT, IS_ACCELERATOR ); + AddMenuItem( viewMenu, ID_VIEWER_ZOOM_OUT, text, HELP_ZOOM_OUT, KiBitmap( zoom_out_xpm ) ); + + text = AddHotkeyName( _( "&Fit on Screen" ), g_Module_Viewer_Hokeys_Descr, + HK_ZOOM_AUTO ); + AddMenuItem( viewMenu, ID_VIEWER_ZOOM_PAGE, text, HELP_ZOOM_FIT, + KiBitmap( zoom_fit_in_page_xpm ) ); + + text = AddHotkeyName( _( "&Redraw" ), g_Module_Viewer_Hokeys_Descr, HK_ZOOM_REDRAW ); + AddMenuItem( viewMenu, ID_VIEWER_ZOOM_REDRAW, text, + HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) ); + + viewMenu->AppendSeparator(); + + // 3D view + AddMenuItem( viewMenu, ID_MODVIEW_SHOW_3D_VIEW, + _( "3&D View" ), + _( "Show footprint in 3D viewer" ), + KiBitmap( three_d_xpm ) ); + + // Menu Help: + wxMenu* helpMenu = new wxMenu; + + // Version info + AddHelpVersionInfoMenuEntry( helpMenu ); + + // Contents + AddMenuItem( helpMenu, wxID_HELP, + _( "P&cbnew Manual" ), + _( "Open the Pcbnew manual" ), + KiBitmap( online_help_xpm ) ); + + AddMenuItem( helpMenu, wxID_INDEX, + _( "&Getting Started in KiCad" ), + _( "Open the \"Getting Started in KiCad\" guide for beginners" ), + KiBitmap( help_xpm ) ); + + // About Pcbnew + helpMenu->AppendSeparator(); + AddMenuItem( helpMenu, wxID_ABOUT, + _( "&About Pcbnew" ), + _( "About Pcbnew PCB designer" ), + KiBitmap( info_xpm ) ); + + // Append menus to the menubar + menuBar->Append( fileMenu, _( "&File" ) ); + + menuBar->Append( viewMenu, _( "&View" ) ); + menuBar->Append( helpMenu, _( "&Help" ) ); + + menuBar->Thaw(); + + // Associate the menu bar with the frame, if no previous menubar + if( GetMenuBar() == NULL ) + SetMenuBar( menuBar ); + else + menuBar->Refresh(); +}