Commit 77b3201b authored by jean-pierre charras's avatar jean-pierre charras

Libview and Modview: fix issues relative to hotkeys (hardcoded keys instead of...

Libview and Modview: fix issues relative to hotkeys (hardcoded keys instead of user defined keys and not working tools and popup menus).
Add menubars (can be disabled)
Fix also some minor coding style issues.
parents 396e7b8c d82f403f
......@@ -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 )
......
......@@ -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;
......
......@@ -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() );
......
......@@ -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:
......
/*
* 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 <stambaughw@verizon.net>
* Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
*
......@@ -34,6 +34,7 @@
#include <general.h>
#include <libeditframe.h>
#include <viewlib_frame.h>
#include <class_libentry.h>
#include <sch_junction.h>
#include <sch_line.h>
......@@ -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,39 +295,45 @@ 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 },
{ &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;
}
......@@ -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_
This diff is collapsed.
......@@ -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
......
......@@ -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,
......
......@@ -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:
......
This diff is collapsed.
......@@ -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;
......
......@@ -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();
......
......@@ -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 );
......
......@@ -37,6 +37,8 @@
#include <class_library.h>
#include <viewlib_frame.h>
#include <dialog_helpers.h>
#include <menus_helpers.h>
#include <help_common_strings.h>
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();
}
......@@ -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();
}
......@@ -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.
* <p?
* Some commands are relative to the item under the mouse cursor. Commands are
* case insensitive
* </p>
*/
bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
void LoadSettings( wxConfigBase* aCfg );
void SaveSettings( wxConfigBase* aCfg );
......
......@@ -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
......
......@@ -5,6 +5,8 @@
#include <fctsys.h>
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <modview_frame.h>
#include <pcbnew_id.h>
#include <hotkeys.h>
......@@ -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;
}
......@@ -38,6 +38,7 @@
#include <pcbnew_id.h>
#include <hotkeys.h>
#include <help_common_strings.h>
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,
......
......@@ -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,
......
......@@ -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();
}
......@@ -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.
* <p?
* Some commands are relative to the item under the mouse cursor. Commands are
* case insensitive
* </p>
*/
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
......
/*
* 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 <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* 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 <pcbnew.h>
#include <wxPcbStruct.h>
#include <menus_helpers.h>
#include <hotkeys.h>
#include <dialog_helpers.h>
#include <modview_frame.h>
#include <help_common_strings.h>
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();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment