Commit e27d3f8c authored by CHARRAS's avatar CHARRAS

more work on programmable hotkeys. Most of features are ok.

parent 4a8bf70d
......@@ -4,6 +4,14 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2007-sept-6 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ eeschema & pcbnew
Programmable hotkeys update.
some features are still subject to change (mainly path for config files: see 2007-aug-30 UPDATE))
The preference menu has a command to create and reread config hotkey files.
the hotkey ? lists the current hotkeys.
2007-Sep-4 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
......
......@@ -265,7 +265,7 @@ void MyFree( void* pt_mem )
/**************************************************************/
wxString ReturnPcbLayerName( int layer_number, bool is_filename, bool is_gui )
wxString ReturnPcbLayerName( int layer_number, bool is_filename )
/**************************************************************/
/* Return the name of the layer number "layer_number".
......@@ -305,21 +305,6 @@ wxString ReturnPcbLayerName( int layer_number, bool is_filename, bool is_gui )
else
layer_name = layer_name_list[layer_number];
if( is_gui )
{
static const wxString hotkey_list[] = {
wxT( "(PgDn)" ), wxT( "(F5)" ), wxT( "(F6)" ), wxT( "(F7)" ),
wxT( "(F8)" ), wxT( "(F9)" ), wxT( "(F10)" ), wxT( " " ),
wxT( " " ), wxT( " " ), wxT( " " ), wxT( " " ),
wxT( " " ), wxT( " " ), wxT( " " ), wxT( " (PgUp)" ),
wxT( " " ), wxT( " " ), wxT( " " ), wxT( " " ),
wxT( " " ), wxT( " " ), wxT( " " ), wxT( " " ),
wxT( " " ), wxT( " " ), wxT( " " ), wxT( " " ),
wxT( " " ), wxT( " " ), wxT( " " ), wxT( " " )
};
layer_name += wxT( " " ) + hotkey_list[layer_number];
}
return layer_name;
}
......
......@@ -26,6 +26,7 @@
#include "worksheet.h"
#include "id.h"
#include "build_version.h"
#include "hotkeys_basic.h"
#include "bitmaps.h"
#include "Language.xpm"
......
This diff is collapsed.
......@@ -11,12 +11,10 @@
#include "eeconfig.h"
#include "worksheet.h"
#include "hotkeys_basic.h"
#include "hotkeys.h"
#include "id.h"
extern Ki_HotkeyInfo *s_Schematic_Hotkey_List[];
extern Ki_HotkeyInfo *s_LibEdit_Hotkey_List[];
/* Variables locales */
......@@ -80,11 +78,7 @@ wxString FullFileName;
FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName += wxT("eeschema");
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
WriteHotkeyConfigFile(FullFileName, s_Schematic_Hotkey_List, true);
FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName += wxT("libedit");
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
WriteHotkeyConfigFile(FullFileName, s_LibEdit_Hotkey_List, true);
WriteHotkeyConfigFile(FullFileName, s_Eeschema_Hokeys_Descr, true);
break;
case ID_PREFERENCES_READ_CONFIG_HOTKEYS:
......@@ -107,11 +101,7 @@ bool Read_Hotkey_Config( WinEDA_DrawFrame * frame, bool verbose )
wxString FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName += wxT("eeschema");
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
frame->ReadHotkeyConfigFile(FullFileName, s_Schematic_Hotkey_List, verbose);
FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName += wxT("libedit");
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
frame->ReadHotkeyConfigFile(FullFileName, s_LibEdit_Hotkey_List, verbose);
frame->ReadHotkeyConfigFile(FullFileName, s_Eeschema_Hokeys_Descr, verbose);
return TRUE;
}
......
......@@ -24,7 +24,8 @@
* "Command Label" is the name used in hotkey list display, and the identifier in the hotkey list file
* MY_NEW_ID_FUNCTION is an equivalent id function used in the switch in OnHotKey() function.
* default key value is the default hotkey for this command. Can be overrided by the user hotkey list file
* add the HkMyNewEntry pointer in the s_Schematic_Hotkey_List list ( or/and the s_LibEdit_Hotkey_List list)
* 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 added both in eeschema and libedit)
* Add the new code in the switch in OnHotKey() function.
* when the variable PopupOn is true, an item is currently edited.
* This can be usefull if the new function cannot be executed while an item is currently being edited
......@@ -38,6 +39,15 @@
/* local variables */
/* Hotkey list: */
// Common commands
static Ki_HotkeyInfo HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 );
static Ki_HotkeyInfo HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 );
static Ki_HotkeyInfo HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
static Ki_HotkeyInfo HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 );
static Ki_HotkeyInfo HkHelp( wxT( "Help: this message" ), HK_HELP, '?' );
static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset local coord." ), HK_RESET_LOCAL_COORD, ' ' );
// Schematic editor
static Ki_HotkeyInfo HkBeginWire( wxT( "begin Wire" ), HK_BEGIN_WIRE, 'W' );
static Ki_HotkeyInfo HkAddComponent( wxT( "Add Component" ), HK_ADD_NEW_COMPONENT, 'A' );
static Ki_HotkeyInfo HkMirrorYComponent( wxT(
......@@ -54,19 +64,24 @@ static Ki_HotkeyInfo HkMove2Drag( wxT(
HK_MOVEBLOCK_TO_DRAGBLOCK, '\t' );
static Ki_HotkeyInfo HkInsert( wxT( "Repeat Last Item" ), HK_REPEAT_LAST, WXK_INSERT );
static Ki_HotkeyInfo HkDelete( wxT( "Delete Item" ), HK_DELETE, WXK_DELETE );
static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset local coord." ), HK_RESET_LOCAL_COORD, ' ' );
static Ki_HotkeyInfo HkNextSearch( wxT( "Next Search" ), HK_NEXT_SEARCH, WXK_F5 );
static Ki_HotkeyInfo HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 );
static Ki_HotkeyInfo HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 );
static Ki_HotkeyInfo HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
static Ki_HotkeyInfo HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 );
static Ki_HotkeyInfo HkHelp( wxT( "Help: this message" ), HK_HELP, '?' );
// Library editor:
static Ki_HotkeyInfo HkInsertPin( wxT( "Repeat Pin" ), HK_REPEAT_LAST, WXK_INSERT );
// List of common hotkey descriptors
Ki_HotkeyInfo* s_Common_Hotkey_List[] =
{
&HkHelp,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
&HkResetLocalCoord,
NULL
};
// List of hotkey descriptors for schematic
Ki_HotkeyInfo* s_Schematic_Hotkey_List[] = {
&HkHelp,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
&HkNextSearch, &HkResetLocalCoord,
&HkNextSearch,
&HkDelete, &HkInsert, &HkMove2Drag,
&HkMoveComponent, &HkAddComponent,
&HkRotateComponent, &HkMirrorXComponent, &HkMirrorYComponent, &HkOrientNormalComponent,
......@@ -74,25 +89,41 @@ Ki_HotkeyInfo* s_Schematic_Hotkey_List[] = {
NULL
};
// Library editor:
static Ki_HotkeyInfo HkInsertPin( wxT( "Repeat Pin" ), HK_REPEAT_LAST, WXK_INSERT );
// List of hotkey descriptors for libray editor
Ki_HotkeyInfo* s_LibEdit_Hotkey_List[] =
{
&HkHelp,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
&HkResetLocalCoord,
&HkInsertPin,
NULL
};
// list of sections and corresponding hotkey list for eeschema (used to create an hotkey config file)
struct Ki_HotkeyInfoSectionDescriptor s_Eeschema_Hokeys_Descr[] = {
{ &g_CommonSectionTag, s_Common_Hotkey_List, "Common keys" },
{ &g_SchematicSectionTag, s_Schematic_Hotkey_List, "Schematic editor keys"},
{ &g_LibEditSectionTag, s_LibEdit_Hotkey_List, "library editor keys"},
NULL, NULL
};
// list of sections and corresponding hotkey list for the schematic editor (used to list current hotkeys)
struct Ki_HotkeyInfoSectionDescriptor s_Schematic_Hokeys_Descr[] = {
{ &g_CommonSectionTag, s_Common_Hotkey_List, NULL},
{ &g_SchematicSectionTag, s_Schematic_Hotkey_List, NULL},
NULL, NULL
};
// list of sections and corresponding hotkey list for the component editor (used to list current hotkeys)
struct Ki_HotkeyInfoSectionDescriptor s_Libedit_Hokeys_Descr[] = {
{ &g_CommonSectionTag, s_Common_Hotkey_List, NULL},
{ &g_LibEditSectionTag, s_LibEdit_Hotkey_List, NULL},
NULL, NULL
};
/***********************************************************/
void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
EDA_BaseStruct* DrawStruct )
/***********************************************************/
/* Hot keys. Some commands are relatives to the item under the mouse cursor
/* Hot keys. Some commands are relative to the item under the mouse cursor
* Commands are case insensitive
*/
{
......@@ -113,7 +144,9 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
hotkey += 'A' - 'a';
// Search command from key :
int CommandCode = GetCommandCodeFromHotkey( hotkey, s_Schematic_Hotkey_List );
int CommandCode = GetCommandCodeFromHotkey( hotkey, s_Common_Hotkey_List );
if ( CommandCode == HK_NOT_FOUND )
CommandCode = GetCommandCodeFromHotkey( hotkey, s_Schematic_Hotkey_List );
switch( CommandCode )
{
......@@ -123,7 +156,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
break;
case HK_HELP: // Display Current hotkey list
DisplayHotkeyList( this, s_Schematic_Hotkey_List );
DisplayHotkeyList( this, s_Schematic_Hokeys_Descr );
break;
case HK_RESET_LOCAL_COORD: /* Reset the relative coord */
......@@ -319,7 +352,7 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
EDA_BaseStruct* DrawStruct )
/***********************************************************/
/* Hot keys for the component editot. Some commands are relatives to the item under the mouse cursor
/* Hot keys for the component editor. Some commands are relatives to the item under the mouse cursor
* Commands are case insensitive
*/
{
......@@ -333,7 +366,9 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
/* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */
if( (hotkey >= 'a') && (hotkey <= 'z') )
hotkey += 'A' - 'a';
int CommandCode = GetCommandCodeFromHotkey( hotkey, s_LibEdit_Hotkey_List );
int CommandCode = GetCommandCodeFromHotkey( hotkey, s_Common_Hotkey_List );
if ( CommandCode == HK_NOT_FOUND )
CommandCode = GetCommandCodeFromHotkey( hotkey, s_LibEdit_Hotkey_List );
switch( CommandCode )
{
......@@ -343,7 +378,7 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
break;
case HK_HELP: // Display Current hotkey list
DisplayHotkeyList( this, s_LibEdit_Hotkey_List );
DisplayHotkeyList( this, s_Libedit_Hokeys_Descr );
break;
case HK_RESET_LOCAL_COORD: /* Reset the relative coord */
......
......@@ -27,9 +27,11 @@ enum hotkey_id_commnand {
HK_BEGIN_WIRE
};
// List of hotkey descriptors for schematic
extern Ki_HotkeyInfo* s_Schematic_Hotkey_List[];
// List of hotkey descriptors for libray editor
extern Ki_HotkeyInfo* s_LibEdit_Hotkey_List[];
// List of hotkey descriptors for eeschema
extern struct Ki_HotkeyInfoSectionDescriptor s_Eeschema_Hokeys_Descr[];
// List of hotkey descriptors for the schematic editor only
extern struct Ki_HotkeyInfoSectionDescriptor s_Schematic_Hokeys_Descr[];
// List of hotkey descriptors for the lib editor only
extern struct Ki_HotkeyInfoSectionDescriptor s_Libedit_Hokeys_Descr[];
#endif // KOTKEYS_H
......@@ -281,22 +281,22 @@ void AddMenusForComponent( wxMenu* PopMenu, EDA_SchComponentStruct* Component )
if( !Component->m_Flags )
{
msg = AddHotkeyName( _( "Move Component" ), s_Schematic_Hotkey_List, HK_MOVE_COMPONENT );
msg = AddHotkeyName( _( "Move Component" ), s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_CMP_REQUEST,
msg, move_xpm );
}
// add menu orient et sous menu:
wxMenu* orientmenu = new wxMenu;
msg = AddHotkeyName( _( "Rotate +" ), s_Schematic_Hotkey_List, HK_ROTATE_COMPONENT );
msg = AddHotkeyName( _( "Rotate +" ), s_Schematic_Hokeys_Descr, HK_ROTATE_COMPONENT );
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE,
msg, rotate_pos_xpm );
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ROTATE_CMP_CLOCKWISE, _( "Rotate -" ), rotate_neg_xpm );
msg = AddHotkeyName( _( "Mirror --" ), s_Schematic_Hotkey_List, HK_MIRROR_X_COMPONENT );
msg = AddHotkeyName( _( "Mirror --" ), s_Schematic_Hokeys_Descr, HK_MIRROR_X_COMPONENT );
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_MIROR_X_CMP, msg, mirror_V_xpm );
msg = AddHotkeyName( _( "Mirror ||" ), s_Schematic_Hotkey_List, HK_MIRROR_Y_COMPONENT );
msg = AddHotkeyName( _( "Mirror ||" ), s_Schematic_Hokeys_Descr, HK_MIRROR_Y_COMPONENT );
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_MIROR_Y_CMP, msg, mirror_H_xpm );
msg = AddHotkeyName( _( "Normal" ), s_Schematic_Hotkey_List, HK_ORIENT_NORMAL_COMPONENT );
msg = AddHotkeyName( _( "Normal" ), s_Schematic_Hokeys_Descr, HK_ORIENT_NORMAL_COMPONENT );
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ORIENT_NORMAL_CMP, msg, normal_xpm );
ADD_MENUITEM_WITH_SUBMENU( PopMenu, orientmenu,
ID_POPUP_SCH_GENERIC_ORIENT_CMP, _(
......
......@@ -167,15 +167,15 @@ void WinEDA_LibeditFrame::ReCreateHToolbar()
_( "Test duplicate pins" ) );
m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "zoom +" ), s_LibEdit_Hotkey_List, HK_ZOOM_IN );
msg = AddHotkeyName( _( "zoom +" ), s_Libedit_Hokeys_Descr, HK_ZOOM_IN );
m_HToolBar->AddTool( ID_ZOOM_PLUS_BUTT, wxEmptyString, BITMAP( zoom_in_xpm ),
msg );
msg = AddHotkeyName( _( "zoom -" ), s_LibEdit_Hotkey_List, HK_ZOOM_OUT );
msg = AddHotkeyName( _( "zoom -" ), s_Libedit_Hokeys_Descr, HK_ZOOM_OUT );
m_HToolBar->AddTool( ID_ZOOM_MOINS_BUTT, wxEmptyString, BITMAP( zoom_out_xpm ),
msg );
msg = AddHotkeyName( _( "redraw" ), s_LibEdit_Hotkey_List, HK_ZOOM_REDRAW );
msg = AddHotkeyName( _( "redraw" ), s_Libedit_Hokeys_Descr, HK_ZOOM_REDRAW );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString, BITMAP( repaint_xpm ),
msg );
......
......@@ -104,15 +104,15 @@ void WinEDA_SchematicFrame::ReCreateHToolbar()
_( "Run Pcbnew" ) );
m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "zoom +" ), s_Schematic_Hotkey_List, HK_ZOOM_IN );
msg = AddHotkeyName( _( "zoom +" ), s_Schematic_Hokeys_Descr, HK_ZOOM_IN );
m_HToolBar->AddTool( ID_ZOOM_PLUS_BUTT, wxEmptyString, BITMAP( zoom_in_xpm ),
msg );
msg = AddHotkeyName( _( "zoom -" ), s_Schematic_Hotkey_List, HK_ZOOM_OUT );
msg = AddHotkeyName( _( "zoom -" ), s_Schematic_Hokeys_Descr, HK_ZOOM_OUT );
m_HToolBar->AddTool( ID_ZOOM_MOINS_BUTT, wxEmptyString, BITMAP( zoom_out_xpm ),
msg );
msg = AddHotkeyName( _( "redraw" ), s_Schematic_Hotkey_List, HK_ZOOM_REDRAW );
msg = AddHotkeyName( _( "redraw" ), s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString, BITMAP( repaint_xpm ),
msg );
......
......@@ -5,7 +5,7 @@
COMMON_GLOBL wxString g_BuildVersion
#ifdef EDA_BASE
(wxT("(2007-08-30)"))
(wxT("(2007-09-06)"))
#endif
;
......
......@@ -345,7 +345,7 @@ class WinEDA_DrawPanel;
/* COMMON.CPP */
wxString ReturnPcbLayerName(int layer_number, bool is_filename = FALSE, bool is_gui = FALSE);
wxString ReturnPcbLayerName(int layer_number, bool is_filename = FALSE);
/* Return the name of the layer number "layer_number".
if "is_filename" == TRUE, the name can be used for a file name
(not internatinalized, no space)*/
......
......@@ -8,6 +8,10 @@
#ifndef HOTKEYS_BASIC_H
#define HOTKEYS_BASIC_H
#ifndef COMMON_GLOBL
#define COMMON_GLOBL extern
#endif
#define DEFAULT_HOTKEY_FILENAME_EXT wxT( ".key" )
/* define default path for config key file */
......@@ -32,12 +36,60 @@ public:
Ki_HotkeyInfo( const wxChar* infomsg, int idcommand, int keycode );
};
/* handle a Section name and the corresponding list of hotkeys (Ki_HotkeyInfo list) */
struct Ki_HotkeyInfoSectionDescriptor
{
public:
wxString* m_SectionTag; // The section name
Ki_HotkeyInfo** m_HK_InfoList; // pointer on List of Ki_HotkeyInfo
char* m_Comment; // comment: will be printed in the config file
/*
* public:
* Ki_HotkeyInfoSectionDescriptor( wxString * SectionTag, Ki_HotkeyInfo ** HK_InfoList )
* { m_SectionTag = SectionTag; m_HK_InfoList = HK_InfoList; }
*/
};
/* Identifiers (tags) in key code configuration file file
* .m_SectionTag member of a Ki_HotkeyInfoSectionDescriptor
*/
COMMON_GLOBL wxString g_CommonSectionTag
#ifdef EDA_BASE
( wxT( "[common]" ) )
#endif
;
COMMON_GLOBL wxString g_SchematicSectionTag
#ifdef EDA_BASE
( wxT( "[eeschema]" ) )
#endif
;
COMMON_GLOBL wxString g_LibEditSectionTag
#ifdef EDA_BASE
( wxT( "[libedit]" ) )
#endif
;
COMMON_GLOBL wxString g_BoardEditorSectionTag
#ifdef EDA_BASE
( wxT( "[pcbnew]" ) )
#endif
;
COMMON_GLOBL wxString g_ModuleEditSectionTag
#ifdef EDA_BASE
( wxT( "[footprinteditor]" ) )
#endif
;
/* Functions:
*/
wxString ReturnKeyNameFromKeyCode( int keycode );
wxString ReturnKeyNameFromCommandId( Ki_HotkeyInfo** List, int CommandId );
wxString AddHotkeyName( const wxString& text, Ki_HotkeyInfo** List, int CommandId );
void DisplayHotkeyList( WinEDA_DrawFrame* frame, Ki_HotkeyInfo** List );
wxString AddHotkeyName( const wxString& text,
struct Ki_HotkeyInfoSectionDescriptor* DescrList,
int CommandId );
void DisplayHotkeyList( WinEDA_DrawFrame* frame,
struct Ki_HotkeyInfoSectionDescriptor* List );
int GetCommandCodeFromHotkey( int key, Ki_HotkeyInfo** List );
......
......@@ -177,8 +177,8 @@ public:
void PrintMsg( const wxString& text );
void GetSettings();
void SaveSettings();
int WriteHotkeyConfigFile(const wxString & Filename, Ki_HotkeyInfo ** List, bool verbose);
int ReadHotkeyConfigFile(const wxString & Filename, Ki_HotkeyInfo ** List, bool verbose);
int WriteHotkeyConfigFile(const wxString & Filename, struct Ki_HotkeyInfoSectionDescriptor * DescList, bool verbose);
int ReadHotkeyConfigFile(const wxString & Filename, struct Ki_HotkeyInfoSectionDescriptor * DescList, bool verbose);
void SetLanguage( wxCommandEvent& event );
void ProcessFontPreferences( int id );
......
......@@ -17,7 +17,7 @@ KICAD_BIN = /f/kicad/winexe
#Define the wxWidget path (if not found in environment variables):
ifndef WXWIN
WXWIN=f:/wxMSW-2.8.4
WXWIN=f:/wxMSW-2.8.5
endif
LIBVERSION = 2.8
......
......@@ -26,7 +26,7 @@
* This can be usefull if the new function cannot be executed while an item is currently being edited
* ( For example, one cannot start a new wire when a component is moving.)
*
* Note: If an hotkey is a special key be sure the corresponding wxWidget keycode (WXK_XXXX)
* Note: If an hotkey is a special key, be sure the corresponding wxWidget keycode (WXK_XXXX)
* is handled in the hotkey_name_descr s_Hotkey_Name_List list (see hotkeys_basic.cpp)
* and see this list for some ascii keys (space ...)
*/
......@@ -35,10 +35,10 @@
/* Hotkey list: */
static Ki_HotkeyInfo HkSwitch2CopperLayer( wxT(
"Switch to Copper layer" ),
HK_SWITCH_LAYER_TO_COPPER, '-' );
HK_SWITCH_LAYER_TO_COPPER, WXK_PAGEUP );
static Ki_HotkeyInfo HkSwitch2ComponentLayer( wxT(
"Switch to Component layer" ),
HK_SWITCH_LAYER_TO_COMPONENT, '+' );
HK_SWITCH_LAYER_TO_COMPONENT, WXK_PAGEDOWN );
static Ki_HotkeyInfo HkSwitch2InnerLayer1( wxT(
"Switch to Inner layer 1" ),
HK_SWITCH_LAYER_TO_INNER1, WXK_F5 );
......@@ -58,6 +58,13 @@ static Ki_HotkeyInfo HkSwitch2InnerLayer6( wxT(
"Switch to Inner layer 6" ),
HK_SWITCH_LAYER_TO_INNER6, WXK_F10 );
static Ki_HotkeyInfo HkSwitch2NextCopperLayer( wxT(
"Switch to Next Layer" ),
HK_SWITCH_LAYER_TO_NEXT, '+' );
static Ki_HotkeyInfo HkSwitch2PreviousCopperLayer( wxT(
"Switch to Previous Layer" ),
HK_SWITCH_LAYER_TO_PREVIOUS, '-');
static Ki_HotkeyInfo HkSavefile( wxT( "Save board" ), HK_SAVE_BOARD, 'S' + GR_KB_CTRL );
static Ki_HotkeyInfo HkLoadfile( wxT( "Load board" ), HK_LOAD_BOARD, 'L' + GR_KB_CTRL );
static Ki_HotkeyInfo HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL );
......@@ -83,12 +90,17 @@ static Ki_HotkeyInfo HkTrackDisplayMode( wxT(
"Track Display Mode" ),
HK_SWITCH_TRACK_DISPLAY_MODE, 'F' );
// List of common hotkey descriptors
Ki_HotkeyInfo* s_Common_Hotkey_List[] = {
&HkHelp,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
&HkSwitchUnits, &HkResetLocalCoord,
NULL
};
// List of hotkey descriptors for pcbnew
Ki_HotkeyInfo* s_board_edit_Hotkey_List[] = {
&HkHelp,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
&HkResetLocalCoord, &HkSwitchUnits, &HkTrackDisplayMode,
&HkTrackDisplayMode,
&HkDelete, &HkBackspace,
&HkAddVia, &HkEndTrack,
&HkMoveFootprint, &HkFlipFootprint,
......@@ -103,19 +115,41 @@ Ki_HotkeyInfo* s_board_edit_Hotkey_List[] = {
&HkSwitch2InnerLayer5,
&HkSwitch2InnerLayer6,
&HkSwitch2ComponentLayer,
&HkSwitch2NextCopperLayer,
&HkSwitch2PreviousCopperLayer,
NULL
};
// List of hotkey descriptors for the module editor
Ki_HotkeyInfo* s_module_edit_Hotkey_List[] = {
&HkHelp,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
&HkSwitchUnits, &HkResetLocalCoord,
&HkDelete, &HkBackspace,
NULL
};
// list of sections and corresponding hotkey list for pcbnew (used to create an hotkey config file)
struct Ki_HotkeyInfoSectionDescriptor s_Pcbnew_Editor_Hokeys_Descr[] = {
{ &g_CommonSectionTag, s_Common_Hotkey_List, "Common keys"},
{ &g_BoardEditorSectionTag, s_board_edit_Hotkey_List, "Board editor keys"},
{ &g_ModuleEditSectionTag, s_module_edit_Hotkey_List, "Footprint editor keys"},
NULL, NULL
};
// list of sections and corresponding hotkey list for the board editor (used to list current hotkeys)
struct Ki_HotkeyInfoSectionDescriptor s_Board_Editor_Hokeys_Descr[] = {
{ &g_CommonSectionTag, s_Common_Hotkey_List, NULL},
{ &g_BoardEditorSectionTag, s_board_edit_Hotkey_List, NULL},
NULL, NULL
};
// list of sections and corresponding hotkey list for the footprint editor (used to list current hotkeys)
struct Ki_HotkeyInfoSectionDescriptor s_Module_Editor_Hokeys_Descr[] = {
{ &g_CommonSectionTag, s_Common_Hotkey_List, NULL},
{ &g_ModuleEditSectionTag, s_module_edit_Hotkey_List, NULL},
NULL, NULL
};
/***********************************************************/
void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
EDA_BaseStruct* DrawStruct )
......@@ -123,7 +157,6 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
/* Hot keys. Some commands are relatives to the item under the mouse cursor
* Commands are case insensitive
* Zoom commands are not managed here
* @param DC = current device context
* @param hotkey = hothey code (ascii or wxWidget code for special keys)
* @param DrawStruct = NULL or pointer on a EDA_BaseStruct under the mouse cursor
......@@ -148,7 +181,9 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
if( (hotkey >= 'a') && (hotkey <= 'z') )
hotkey += 'A' - 'a';
int CommandCode = GetCommandCodeFromHotkey( hotkey, s_board_edit_Hotkey_List );
int CommandCode = GetCommandCodeFromHotkey( hotkey, s_Common_Hotkey_List );
if ( CommandCode == HK_NOT_FOUND )
CommandCode = GetCommandCodeFromHotkey( hotkey, s_board_edit_Hotkey_List );
int ll;
switch( CommandCode )
......@@ -218,7 +253,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
break;
case HK_HELP: // Display Current hotkey list
DisplayHotkeyList( this, s_board_edit_Hotkey_List );
DisplayHotkeyList( this, s_Board_Editor_Hokeys_Descr );
break;
case HK_ZOOM_IN:
......@@ -434,9 +469,8 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* DC, int hotkey,
EDA_BaseStruct* DrawStruct )
/***********************************************************/
/* Gestion des commandes rapides (Raccourcis claviers) concernant l'element
* sous le courseur souris
* Les majuscules/minuscules sont indifferenciees
/* Hot keys. Some commands are relative to the item under the mouse cursor
* Commands are case insensitive
*/
{
if( hotkey == 0 )
......@@ -446,7 +480,9 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* DC, int hotkey,
if( (hotkey >= 'a') && (hotkey <= 'z') )
hotkey += 'A' - 'a';
int CommandCode = GetCommandCodeFromHotkey( hotkey, s_module_edit_Hotkey_List );
int CommandCode = GetCommandCodeFromHotkey( hotkey, s_Common_Hotkey_List );
if ( CommandCode == HK_NOT_FOUND )
CommandCode = GetCommandCodeFromHotkey( hotkey, s_module_edit_Hotkey_List );
switch( CommandCode )
{
......@@ -456,7 +492,7 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* DC, int hotkey,
break;
case HK_HELP: // Display Current hotkey list
DisplayHotkeyList( this, s_module_edit_Hotkey_List );
DisplayHotkeyList( this, s_Module_Editor_Hokeys_Descr );
break;
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */
......@@ -491,12 +527,13 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* DC, int hotkey,
bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct )
/******************************************************************************/
/* Efface l'item pointe par la souris, en reponse a la touche "Del"
* Effet dependant de l'outil selectionne:
* Outil trace de pistes
* Efface le segment en cours ou la piste si pas d'element
* Outil module:
* Efface le module.
/* Delete the item foun under the mouse cursor
* Depending on the current active tool::
* Tool track
* if a track is in progress: Delete the last segment
* else delete the entire track
* Tool module (footprint):
* Delete the module.
*/
{
bool ItemFree = (GetScreen()->GetCurItem() == NULL )
......
......@@ -34,12 +34,22 @@ enum hotkey_id_commnand {
HK_SWITCH_LAYER_TO_INNER3,
HK_SWITCH_LAYER_TO_INNER4,
HK_SWITCH_LAYER_TO_INNER5,
HK_SWITCH_LAYER_TO_INNER6
HK_SWITCH_LAYER_TO_INNER6,
HK_SWITCH_LAYER_TO_INNER7,
HK_SWITCH_LAYER_TO_INNER8,
HK_SWITCH_LAYER_TO_INNER9,
HK_SWITCH_LAYER_TO_INNER10,
HK_SWITCH_LAYER_TO_INNER11,
HK_SWITCH_LAYER_TO_INNER12,
HK_SWITCH_LAYER_TO_INNER13,
HK_SWITCH_LAYER_TO_INNER14
};
// List of hotkey descriptors for pcbnew
extern Ki_HotkeyInfo* s_board_edit_Hotkey_List[];
// List of hotkey descriptors for the module editor
extern Ki_HotkeyInfo* s_module_edit_Hotkey_List[];
extern struct Ki_HotkeyInfoSectionDescriptor s_Pcbnew_Editor_Hokeys_Descr[];
// List of hotkey descriptors for the board editor only
extern struct Ki_HotkeyInfoSectionDescriptor s_Board_Editor_Hokeys_Descr[];
// List of hotkey descriptors for the footprint editor only
extern struct Ki_HotkeyInfoSectionDescriptor s_Module_Editor_Hokeys_Descr[];
#endif // KOTKEYS_H
......@@ -13,12 +13,10 @@
#include "worksheet.h"
#include "id.h"
#include "hotkeys_basic.h"
#include "hotkeys.h"
#include "protos.h"
extern Ki_HotkeyInfo *s_board_edit_Hotkey_List[];
extern Ki_HotkeyInfo *s_module_edit_Hotkey_List[];
/* Routines Locales */
/* Variables locales */
......@@ -89,11 +87,7 @@ wxString FullFileName;
FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName += wxT("pcbnew");
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
WriteHotkeyConfigFile(FullFileName, s_board_edit_Hotkey_List, true);
FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName += wxT("module_edit");
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
WriteHotkeyConfigFile(FullFileName, s_module_edit_Hotkey_List, true);
WriteHotkeyConfigFile(FullFileName, s_Pcbnew_Editor_Hokeys_Descr, true);
break;
case ID_PREFERENCES_READ_CONFIG_HOTKEYS:
......@@ -116,11 +110,7 @@ bool Read_Hotkey_Config( WinEDA_DrawFrame * frame, bool verbose )
wxString FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName += wxT("pcbnew");
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
frame->ReadHotkeyConfigFile(FullFileName, s_board_edit_Hotkey_List, verbose);
FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName += wxT("module_edit");
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
return frame->ReadHotkeyConfigFile(FullFileName, s_module_edit_Hotkey_List, verbose);
return frame->ReadHotkeyConfigFile(FullFileName, s_Pcbnew_Editor_Hokeys_Descr, verbose);
}
......
......@@ -112,15 +112,15 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar()
_( "Print Module" ) );
m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "zoom +" ), s_module_edit_Hotkey_List, HK_ZOOM_IN );
msg = AddHotkeyName( _( "zoom +" ), s_Module_Editor_Hokeys_Descr, HK_ZOOM_IN );
m_HToolBar->AddTool( ID_ZOOM_PLUS_BUTT, wxEmptyString, BITMAP( zoom_in_xpm ),
msg );
msg = AddHotkeyName( _( "zoom -" ), s_module_edit_Hotkey_List, HK_ZOOM_OUT );
msg = AddHotkeyName( _( "zoom -" ), s_Module_Editor_Hokeys_Descr, HK_ZOOM_OUT );
m_HToolBar->AddTool( ID_ZOOM_MOINS_BUTT, wxEmptyString, BITMAP( zoom_out_xpm ),
msg );
msg = AddHotkeyName( _( "redraw" ), s_module_edit_Hotkey_List, HK_ZOOM_REDRAW );
msg = AddHotkeyName( _( "redraw" ), s_Module_Editor_Hokeys_Descr, HK_ZOOM_REDRAW );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString, BITMAP( repaint_xpm ),
msg );
......
......@@ -267,15 +267,15 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
_( "Plot (HPGL, PostScript, or GERBER format)" ) );
m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "zoom +" ), s_board_edit_Hotkey_List, HK_ZOOM_IN );
msg = AddHotkeyName( _( "zoom +" ), s_Board_Editor_Hokeys_Descr, HK_ZOOM_IN );
m_HToolBar->AddTool( ID_ZOOM_PLUS_BUTT, wxEmptyString, BITMAP( zoom_in_xpm ),
msg );
msg = AddHotkeyName( _( "zoom -" ), s_board_edit_Hotkey_List, HK_ZOOM_OUT );
msg = AddHotkeyName( _( "zoom -" ), s_Board_Editor_Hokeys_Descr, HK_ZOOM_OUT );
m_HToolBar->AddTool( ID_ZOOM_MOINS_BUTT, wxEmptyString, BITMAP( zoom_out_xpm ),
msg );
msg = AddHotkeyName( _( "redraw" ), s_board_edit_Hotkey_List, HK_ZOOM_REDRAW );
msg = AddHotkeyName( _( "redraw" ), s_Board_Editor_Hokeys_Descr, HK_ZOOM_REDRAW );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString, BITMAP( repaint_xpm ),
msg );
......@@ -283,7 +283,7 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
_( "auto zoom" ) );
m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Find components and texts" ), s_board_edit_Hotkey_List, HK_FIND_ITEM );
msg = AddHotkeyName( _( "Find components and texts" ), s_Board_Editor_Hokeys_Descr, HK_FIND_ITEM );
m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, BITMAP( find_xpm ),
msg );
......@@ -643,9 +643,31 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
m_SelLayerBox->Clear();
for( ii = 0, jj = 0; ii <= EDGE_N; ii++ )
{
// List to append hotkeys in layer box selection
static int HK_SwitchLayer[EDGE_N+1] = {
HK_SWITCH_LAYER_TO_COPPER,
HK_SWITCH_LAYER_TO_INNER1,
HK_SWITCH_LAYER_TO_INNER2,
HK_SWITCH_LAYER_TO_INNER3,
HK_SWITCH_LAYER_TO_INNER4,
HK_SWITCH_LAYER_TO_INNER5,
HK_SWITCH_LAYER_TO_INNER6,
HK_SWITCH_LAYER_TO_INNER7,
HK_SWITCH_LAYER_TO_INNER8,
HK_SWITCH_LAYER_TO_INNER9,
HK_SWITCH_LAYER_TO_INNER10,
HK_SWITCH_LAYER_TO_INNER11,
HK_SWITCH_LAYER_TO_INNER12,
HK_SWITCH_LAYER_TO_INNER13,
HK_SWITCH_LAYER_TO_INNER14,
HK_SWITCH_LAYER_TO_COMPONENT
};
if( (g_TabOneLayerMask[ii] & Masque_Layer) )
{
m_SelLayerBox->Append( ReturnPcbLayerName( ii, false, true ) );
wxString msg = ReturnPcbLayerName( ii, false );
msg = AddHotkeyName( msg, s_Board_Editor_Hokeys_Descr, HK_SwitchLayer[ii] );
m_SelLayerBox->Append( msg );
m_SelLayerBox->SetClientData( jj, (void*) ii );
jj++;
}
......
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