Commit 542b9441 authored by CHARRAS's avatar CHARRAS

hotkeys handling finished

parent ef3d0491
/* XPM */
static char * editor_xpm[] = {
"16 16 60 1",
" c None",
". c #000000",
"+ c #FEFEFE",
"@ c #FDFDFD",
"# c #E0E0E0",
"$ c #C1C1C1",
"% c #F1F1F1",
"& c #C3C3C3",
"* c #FBFBFB",
"= c #A8A8A8",
"- c #CCCCCC",
"; c #ADADAD",
"> c #767676",
", c #5D5D5D",
"' c #404040",
") c #F0F0F0",
"! c #E2E2E2",
"~ c #858585",
"{ c #4B4B49",
"] c #FBE73B",
"^ c #F2B64D",
"/ c #CACACA",
"( c #EFEFEF",
"_ c #C9C9C9",
": c #FCEB3D",
"< c #F7B544",
"[ c #61542E",
"} c #EEEEEE",
"| c #FCE93B",
"1 c #F7B545",
"2 c #6C5F34",
"3 c #F9DF39",
"4 c #F4B244",
"5 c #665D3E",
"6 c #EDEDED",
"7 c #ECECEC",
"8 c #EBEBEB",
"9 c #F6D236",
"0 c #EFB44D",
"a c #5C4F2B",
"b c #C4C4C4",
"c c #E8E8E8",
"d c #D7AE74",
"e c #655930",
"f c #C0C0C0",
"g c #EAEAEA",
"h c #E9E9E9",
"i c #4F4115",
"j c #E7E7E7",
"k c #BFBFBF",
"l c #C2C2C2",
"m c #E6E6E6",
"n c #E5E5E5",
"o c #BEBEBE",
"p c #E4E4E4",
"q c #BDBDBD",
"r c #E3E3E3",
"s c #BBBBBB",
"t c #BCBCBC",
"u c #A0A0A0",
" ......... ",
" .++++++@#$. ",
" .+%%%%%%&*=. ",
" .+%---%%;>,'.. ",
" .+%%%%%)!~{.]^.",
" .+%////(/_.:<[.",
" .+(((}}}}.|12. ",
" .@}__}__.345. ",
" .@67778.90a.. ",
" .@8bbbc.de.f. ",
" .@gghh.i..jk. ",
" .@clml..mmno. ",
" .@jjmmmnnppq. ",
" .@mnnnpprrrs. ",
" .lqqqttssssu. ",
" ........... "};
/* XPM */
#ifndef XPMMAIN
extern char *editor_xpm[];
#else
char * editor_xpm[] = {
"16 16 60 1",
" c None",
". c #000000",
"+ c #FEFEFE",
"@ c #FDFDFD",
"# c #E0E0E0",
"$ c #C1C1C1",
"% c #F1F1F1",
"& c #C3C3C3",
"* c #FBFBFB",
"= c #A8A8A8",
"- c #CCCCCC",
"; c #ADADAD",
"> c #767676",
", c #5D5D5D",
"' c #404040",
") c #F0F0F0",
"! c #E2E2E2",
"~ c #858585",
"{ c #4B4B49",
"] c #FBE73B",
"^ c #F2B64D",
"/ c #CACACA",
"( c #EFEFEF",
"_ c #C9C9C9",
": c #FCEB3D",
"< c #F7B544",
"[ c #61542E",
"} c #EEEEEE",
"| c #FCE93B",
"1 c #F7B545",
"2 c #6C5F34",
"3 c #F9DF39",
"4 c #F4B244",
"5 c #665D3E",
"6 c #EDEDED",
"7 c #ECECEC",
"8 c #EBEBEB",
"9 c #F6D236",
"0 c #EFB44D",
"a c #5C4F2B",
"b c #C4C4C4",
"c c #E8E8E8",
"d c #D7AE74",
"e c #655930",
"f c #C0C0C0",
"g c #EAEAEA",
"h c #E9E9E9",
"i c #4F4115",
"j c #E7E7E7",
"k c #BFBFBF",
"l c #C2C2C2",
"m c #E6E6E6",
"n c #E5E5E5",
"o c #BEBEBE",
"p c #E4E4E4",
"q c #BDBDBD",
"r c #E3E3E3",
"s c #BBBBBB",
"t c #BCBCBC",
"u c #A0A0A0",
" ......... ",
" .++++++@#$. ",
" .+%%%%%%&*=. ",
" .+%---%%;>,'.. ",
" .+%%%%%)!~{.]^.",
" .+%////(/_.:<[.",
" .+(((}}}}.|12. ",
" .@}__}__.345. ",
" .@67778.90a.. ",
" .@8bbbc.de.f. ",
" .@gghh.i..jk. ",
" .@clml..mmno. ",
" .@jjmmmnnppq. ",
" .@mnnnpprrrs. ",
" .lqqqttssssu. ",
" ........... "};
#endif
......@@ -4,6 +4,11 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2007-sept-19 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ all
* hotkeys handling finished
2007-Sep-14 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
......
......@@ -250,6 +250,7 @@ unsigned ii;
{
m_LanguageId = m_EDA_CommonConfig->Read(wxT("Language"), wxLANGUAGE_DEFAULT);
g_EditorName = m_EDA_CommonConfig->Read(wxT("Editor"));
g_ConfigFileLocationChoice = m_EDA_CommonConfig->Read(HOTKEY_CFG_PATH_OPT, 0L);
}
if ( ! m_EDA_Config ) return;
......
......@@ -10,6 +10,9 @@
#include "wxstruct.h"
#include "hotkeys_basic.h"
#include "macros.h"
#include "bitmaps.h"
#include "id.h"
/* Class to handle hotkey commnands. hotkeys have a default value
* This class allows the real key code changed by user from a key code list file
......@@ -34,101 +37,101 @@ struct hotkey_name_descr
static struct hotkey_name_descr s_Hotkey_Name_List[] =
{
{ wxT( "F1" ), WXK_F1 },
{ wxT( "F2" ), WXK_F2 },
{ wxT( "F3" ), WXK_F3 },
{ wxT( "F4" ), WXK_F4 },
{ wxT( "F5" ), WXK_F5 },
{ wxT( "F6" ), WXK_F6 },
{ wxT( "F7" ), WXK_F7 },
{ wxT( "F8" ), WXK_F8 },
{ wxT( "F9" ), WXK_F9 },
{ wxT( "F10" ), WXK_F10 },
{ wxT( "F11" ), WXK_F11 },
{ wxT( "F12" ), WXK_F12 },
{ wxT( "Esc" ), WXK_ESCAPE },
{ wxT( "Delete" ), WXK_DELETE },
{ wxT( "Esc" ), WXK_ESCAPE },
{ wxT( "Tab" ), '\t' },
{ wxT( "F1" ), WXK_F1 },
{ wxT( "F2" ), WXK_F2 },
{ wxT( "F3" ), WXK_F3 },
{ wxT( "F4" ), WXK_F4 },
{ wxT( "F5" ), WXK_F5 },
{ wxT( "F6" ), WXK_F6 },
{ wxT( "F7" ), WXK_F7 },
{ wxT( "F8" ), WXK_F8 },
{ wxT( "F9" ), WXK_F9 },
{ wxT( "F10" ), WXK_F10 },
{ wxT( "F11" ), WXK_F11 },
{ wxT( "F12" ), WXK_F12 },
{ wxT( "Esc" ), WXK_ESCAPE },
{ wxT( "Delete" ), WXK_DELETE },
{ wxT( "Esc" ), WXK_ESCAPE },
{ wxT( "Tab" ), '\t' },
{ wxT( "Backspace" ), WXK_BACK },
{ wxT( "Insert" ), WXK_INSERT },
{ wxT( "Insert" ), WXK_INSERT },
{ wxT( "End" ), WXK_END },
{ wxT( "Page Up" ), WXK_PAGEUP },
{ wxT( "End" ), WXK_END },
{ wxT( "Page Up" ), WXK_PAGEUP },
{ wxT( "Page Down" ), WXK_PAGEDOWN },
{ wxT( "+" ), WXK_ADD },
{ wxT( "-" ), WXK_SUBTRACT },
{ wxT( "Up" ), WXK_UP },
{ wxT( "Down" ), WXK_DOWN },
{ wxT( "Left" ), WXK_LEFT },
{ wxT( "Right" ), WXK_RIGHT },
{ wxT( "space" ), ' ' },
{ wxT( "?" ), '?' },
{ wxT( "!" ), '!' },
{ wxT( ":" ), ':' },
{ wxT( "," ), ',' },
{ wxT( "*" ), '*' },
{ wxT( "+" ), '+' },
{ wxT( "-" ), '-' },
{ wxT( "\%" ), '%' },
{ wxT( "A" ), 'A' },
{ wxT( "B" ), 'B' },
{ wxT( "C" ), 'C' },
{ wxT( "D" ), 'D' },
{ wxT( "E" ), 'E' },
{ wxT( "F" ), 'F' },
{ wxT( "G" ), 'G' },
{ wxT( "H" ), 'H' },
{ wxT( "I" ), 'I' },
{ wxT( "J" ), 'J' },
{ wxT( "K" ), 'K' },
{ wxT( "L" ), 'L' },
{ wxT( "M" ), 'M' },
{ wxT( "N" ), 'N' },
{ wxT( "O" ), 'O' },
{ wxT( "P" ), 'P' },
{ wxT( "Q" ), 'Q' },
{ wxT( "R" ), 'R' },
{ wxT( "S" ), 'S' },
{ wxT( "T" ), 'T' },
{ wxT( "U" ), 'U' },
{ wxT( "V" ), 'V' },
{ wxT( "W" ), 'W' },
{ wxT( "X" ), 'X' },
{ wxT( "Y" ), 'Y' },
{ wxT( "Z" ), 'Z' },
{ wxT( "Ctrl A" ), GR_KB_CTRL + 'A' },
{ wxT( "Ctrl B" ), GR_KB_CTRL + 'B' },
{ wxT( "Ctrl C" ), GR_KB_CTRL + 'C' },
{ wxT( "Ctrl D" ), GR_KB_CTRL + 'D' },
{ wxT( "Ctrl E" ), GR_KB_CTRL + 'E' },
{ wxT( "Ctrl F" ), GR_KB_CTRL + 'F' },
{ wxT( "Ctrl G" ), GR_KB_CTRL + 'G' },
{ wxT( "Ctrl H" ), GR_KB_CTRL + 'H' },
{ wxT( "Ctrl I" ), GR_KB_CTRL + 'I' },
{ wxT( "Ctrl J" ), GR_KB_CTRL + 'J' },
{ wxT( "Ctrl K" ), GR_KB_CTRL + 'K' },
{ wxT( "Ctrl L" ), GR_KB_CTRL + 'L' },
{ wxT( "Ctrl M" ), GR_KB_CTRL + 'M' },
{ wxT( "Ctrl N" ), GR_KB_CTRL + 'N' },
{ wxT( "Ctrl O" ), GR_KB_CTRL + 'O' },
{ wxT( "Ctrl P" ), GR_KB_CTRL + 'P' },
{ wxT( "Ctrl Q" ), GR_KB_CTRL + 'Q' },
{ wxT( "Ctrl R" ), GR_KB_CTRL + 'R' },
{ wxT( "Ctrl S" ), GR_KB_CTRL + 'S' },
{ wxT( "Ctrl T" ), GR_KB_CTRL + 'T' },
{ wxT( "Ctrl U" ), GR_KB_CTRL + 'U' },
{ wxT( "Ctrl V" ), GR_KB_CTRL + 'V' },
{ wxT( "Ctrl W" ), GR_KB_CTRL + 'W' },
{ wxT( "Ctrl X" ), GR_KB_CTRL + 'X' },
{ wxT( "Ctrl Y" ), GR_KB_CTRL + 'Y' },
{ wxT( "Ctrl Z" ), GR_KB_CTRL + 'Z' },
{ wxT( "" ), 0 } // Do not change: end of list
{ wxT( "+" ), WXK_ADD },
{ wxT( "-" ), WXK_SUBTRACT },
{ wxT( "Up" ), WXK_UP },
{ wxT( "Down" ), WXK_DOWN },
{ wxT( "Left" ), WXK_LEFT },
{ wxT( "Right" ), WXK_RIGHT },
{ wxT( "space" ), ' ' },
{ wxT( "?" ), '?' },
{ wxT( "!" ), '!' },
{ wxT( ":" ), ':' },
{ wxT( "," ), ',' },
{ wxT( "*" ), '*' },
{ wxT( "+" ), '+' },
{ wxT( "-" ), '-' },
{ wxT( "\%" ), '%' },
{ wxT( "A" ), 'A' },
{ wxT( "B" ), 'B' },
{ wxT( "C" ), 'C' },
{ wxT( "D" ), 'D' },
{ wxT( "E" ), 'E' },
{ wxT( "F" ), 'F' },
{ wxT( "G" ), 'G' },
{ wxT( "H" ), 'H' },
{ wxT( "I" ), 'I' },
{ wxT( "J" ), 'J' },
{ wxT( "K" ), 'K' },
{ wxT( "L" ), 'L' },
{ wxT( "M" ), 'M' },
{ wxT( "N" ), 'N' },
{ wxT( "O" ), 'O' },
{ wxT( "P" ), 'P' },
{ wxT( "Q" ), 'Q' },
{ wxT( "R" ), 'R' },
{ wxT( "S" ), 'S' },
{ wxT( "T" ), 'T' },
{ wxT( "U" ), 'U' },
{ wxT( "V" ), 'V' },
{ wxT( "W" ), 'W' },
{ wxT( "X" ), 'X' },
{ wxT( "Y" ), 'Y' },
{ wxT( "Z" ), 'Z' },
{ wxT( "Ctrl A" ), GR_KB_CTRL + 'A' },
{ wxT( "Ctrl B" ), GR_KB_CTRL + 'B' },
{ wxT( "Ctrl C" ), GR_KB_CTRL + 'C' },
{ wxT( "Ctrl D" ), GR_KB_CTRL + 'D' },
{ wxT( "Ctrl E" ), GR_KB_CTRL + 'E' },
{ wxT( "Ctrl F" ), GR_KB_CTRL + 'F' },
{ wxT( "Ctrl G" ), GR_KB_CTRL + 'G' },
{ wxT( "Ctrl H" ), GR_KB_CTRL + 'H' },
{ wxT( "Ctrl I" ), GR_KB_CTRL + 'I' },
{ wxT( "Ctrl J" ), GR_KB_CTRL + 'J' },
{ wxT( "Ctrl K" ), GR_KB_CTRL + 'K' },
{ wxT( "Ctrl L" ), GR_KB_CTRL + 'L' },
{ wxT( "Ctrl M" ), GR_KB_CTRL + 'M' },
{ wxT( "Ctrl N" ), GR_KB_CTRL + 'N' },
{ wxT( "Ctrl O" ), GR_KB_CTRL + 'O' },
{ wxT( "Ctrl P" ), GR_KB_CTRL + 'P' },
{ wxT( "Ctrl Q" ), GR_KB_CTRL + 'Q' },
{ wxT( "Ctrl R" ), GR_KB_CTRL + 'R' },
{ wxT( "Ctrl S" ), GR_KB_CTRL + 'S' },
{ wxT( "Ctrl T" ), GR_KB_CTRL + 'T' },
{ wxT( "Ctrl U" ), GR_KB_CTRL + 'U' },
{ wxT( "Ctrl V" ), GR_KB_CTRL + 'V' },
{ wxT( "Ctrl W" ), GR_KB_CTRL + 'W' },
{ wxT( "Ctrl X" ), GR_KB_CTRL + 'X' },
{ wxT( "Ctrl Y" ), GR_KB_CTRL + 'Y' },
{ wxT( "Ctrl Z" ), GR_KB_CTRL + 'Z' },
{ wxT( "" ), 0 } // Do not change: end of list
};
......@@ -206,7 +209,7 @@ wxString AddHotkeyName( const wxString& text,
* @return text (key name) in a wxString if found or text without modification
*/
{
wxString msg = text;
wxString msg = text;
wxString keyname;
Ki_HotkeyInfo** List;
......@@ -345,7 +348,7 @@ int WinEDA_BasicFrame::WriteHotkeyConfigFile( const wxString&
* @param Filename = default full file name to create. If void, A filename will be asked
* @param List = pointer to the current hotkey list.
* the ouput format is: shortcut "key" "function"
* lines starting by # are comments
* lines starting with # are comments
*
*/
{
......@@ -358,7 +361,7 @@ int WinEDA_BasicFrame::WriteHotkeyConfigFile( const wxString&
wxString Mask, Path, Ext;
Ext = DEFAULT_HOTKEY_FILENAME_EXT;
Mask = wxT( "*" ) + Ext;
Path = DEFAULT_HOTKEY_FILENAME_PATH;
Path = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFilename = EDA_FileSelector( _( "Hotkey configuration file:" ),
Path, /* Chemin par defaut */
FullFilename, /* nom fichier par defaut */
......@@ -427,7 +430,7 @@ int WinEDA_BasicFrame::WriteHotkeyConfigFile( const wxString&
fprintf( cfgfile, DescList->m_Comment );
fprintf( cfgfile, "\n" );
}
msg = *DescList->m_SectionTag;
msg = *DescList->m_SectionTag;
fprintf( cfgfile, CONV_TO_UTF8( msg ) );
fprintf( cfgfile, "\n" );
List = DescList->m_HK_InfoList;
......@@ -476,7 +479,7 @@ int WinEDA_BasicFrame::ReadHotkeyConfigFile( const wxString&
wxString Mask, Path, Ext;
Ext = DEFAULT_HOTKEY_FILENAME_EXT;
Mask = wxT( "*" ) + Ext;
Path = DEFAULT_HOTKEY_FILENAME_PATH;
Path = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFilename = EDA_FileSelector( _( "Hotkey configuration file:" ),
Path, /* Chemin par defaut */
FullFilename, /* nom fichier par defaut */
......@@ -560,3 +563,80 @@ int WinEDA_BasicFrame::ReadHotkeyConfigFile( const wxString&
fclose( cfgfile );
return 1;
}
/****************************************************/
wxString ReturnHotkeyConfigFilePath( int choice )
/****************************************************/
/* return the hotkey config file path
* @param choice : 0 = home, 1 = kicad/template
*/
{
wxString path;
switch( choice )
{
case 0:
path = DEFAULT_HOTKEY_FILENAME_PATH_IS_HOME;
break;
case 1:
path = DEFAULT_HOTKEY_FILENAME_PATH_IS_KICAD;
break;
default:
break;
}
return path;
}
/***************************************/
void AddHotheyConfigMenu( wxMenu* menu )
/***************************************/
/* add hotkey config options to a menu
* @parm menu : initial menu
*/
{
wxMenuItem* item;
if( menu == NULL )
return;
item = new wxMenuItem( menu, ID_PREFERENCES_CREATE_CONFIG_HOTKEYS,
_( "Create Hotkey config file" ),
_( "Create or Recreate the hotkey config file from current hotkey list" ) );
item->SetBitmap( save_setup_xpm );
menu->Append( item );
item = new wxMenuItem( menu, ID_PREFERENCES_READ_CONFIG_HOTKEYS,
_( "Reread Hotkey config file" ),
_( "Reread the hotkey config file" ) );
item->SetBitmap( reload_xpm );
menu->Append( item );
item = new wxMenuItem( menu, ID_PREFERENCES_EDIT_CONFIG_HOTKEYS,
_( "Edit Hotkey config file" ),
_( "Run the text editor and edit the hotkey config file" ) );
item->SetBitmap( editor_xpm );
menu->Append( item );
wxMenu* submenu_hkcfg = new wxMenu();
item = new wxMenuItem( submenu_hkcfg, ID_PREFERENCES_HOTKEY_PATH_IS_HOME,
_( "home directory" ),
_( "Use home directory to load or store Hotkey config files" ),
wxITEM_CHECK );
submenu_hkcfg->Append( item );
item = new wxMenuItem( submenu_hkcfg, ID_PREFERENCES_HOTKEY_PATH_IS_KICAD,
_( "kicad/template directory" ),
_( "Use kicad/templatedirectory to load or store Hotkey config files" ),
wxITEM_CHECK );
submenu_hkcfg->Append( item );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( menu, submenu_hkcfg,
-1,
_( "Hotkey config location" ),
_( "Hotkey config file location selection (home directory or kicad tree)" ),
right_xpm );
}
......@@ -236,17 +236,17 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
/************************************/
/* Redraw a Texte while moving */
/* Redraw a Text while moving */
/************************************/
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{
EDA_BaseStruct* TextStruct = panel->GetScreen()->GetCurItem();
/* effacement ancienne position */
/* "Undraw" the current text at its old position*/
if( erase )
RedrawOneStruct( panel, DC, TextStruct, g_XorMode );
/* Redessin du texte */
/* redraw the text */
switch( TextStruct->Type() )
{
case DRAW_LABEL_STRUCT_TYPE:
......@@ -266,7 +266,7 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/*************************************************************/
static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
/*************************************************************/
/* Routine de sortie des menus de Texte */
/* Abort function for the command move text */
{
SCH_SCREEN* screen = (SCH_SCREEN*) Panel->m_Parent->m_CurrentScreen;
EDA_BaseStruct* Struct = screen->GetCurItem();
......@@ -275,22 +275,20 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
if( Struct == NULL ) /* Pas de trace en cours */
if( Struct == NULL ) /* no current item */
{
return;
}
/* ici : trace en cours */
/* Effacement du trace en cours et suppression eventuelle de la structure */
/* "Undraw" the text, and delete it if new (i.e. it was beiing just created)*/
RedrawOneStruct( Panel, DC, Struct, g_XorMode );
if( Struct->m_Flags & IS_NEW ) /* Suppression du nouveau texte en cours de placement */
if( Struct->m_Flags & IS_NEW )
{
delete Struct;
screen->SetCurItem( NULL );
}
else /* Remise a jour des anciens parametres du texte */
else /* this was a move command on an "old" text: restore its old settings. */
{
switch( Struct->Type() )
{
......
......@@ -77,7 +77,7 @@ wxString FullFileName;
break;
case ID_PREFERENCES_CREATE_CONFIG_HOTKEYS:
FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
WriteHotkeyConfigFile(FullFileName, s_Eeschema_Hokeys_Descr, true);
......@@ -87,6 +87,33 @@ wxString FullFileName;
Read_Hotkey_Config( this, true);
break;
case ID_PREFERENCES_EDIT_CONFIG_HOTKEYS:
{
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
wxString editorname = GetEditorName();
if ( !editorname.IsEmpty() )
ExecuteFile(this, editorname, FullFileName);
break;
}
case ID_PREFERENCES_HOTKEY_PATH_IS_HOME:
if ( g_ConfigFileLocationChoice != 0 )
{
g_ConfigFileLocationChoice = 0;
m_Parent->m_EDA_CommonConfig->Write(HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice);
}
break;
case ID_PREFERENCES_HOTKEY_PATH_IS_KICAD:
if ( g_ConfigFileLocationChoice != 1 )
{
g_ConfigFileLocationChoice = 1;
m_Parent->m_EDA_CommonConfig->Write(HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice);
}
break;
default:
DisplayError(this, wxT("WinEDA_SchematicFrame::Process_Config internal error") );
}
......@@ -100,7 +127,7 @@ bool Read_Hotkey_Config( WinEDA_DrawFrame * frame, bool verbose )
* Read the hotkey files config for eeschema and libedit
*/
{
wxString FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
wxString FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
frame->ReadHotkeyConfigFile(FullFileName, s_Eeschema_Hokeys_Descr, verbose);
......
......@@ -34,6 +34,7 @@
* 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 ...)
* Key modifier are: GR_KB_CTRL GR_KB_ALT
*/
......@@ -47,6 +48,8 @@ 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, ' ' );
static Ki_HotkeyInfo HkUndo( wxT( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z' );
static Ki_HotkeyInfo HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y' );
// Schematic editor
static Ki_HotkeyInfo HkBeginWire( wxT( "begin Wire" ), HK_BEGIN_WIRE, 'W' );
......@@ -77,6 +80,7 @@ Ki_HotkeyInfo* s_Common_Hotkey_List[] =
&HkHelp,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
&HkResetLocalCoord,
&HkUndo, &HkRedo,
NULL
};
......@@ -183,6 +187,20 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
OnZoom( ID_ZOOM_CENTER_KEY );
break;
case HK_UNDO:
{
wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, ID_SCHEMATIC_UNDO);
wxPostEvent(this, event);
}
break;
case HK_REDO:
{
wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, ID_SCHEMATIC_REDO);
wxPostEvent(this, event);
}
break;
case HK_MOVEBLOCK_TO_DRAGBLOCK: // Switch to drag mode, when block moving
HandleBlockEndByPopUp( BLOCK_DRAG, DC );
break;
......@@ -367,6 +385,9 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
wxPoint MousePos = m_CurrentScreen->m_MousePosition;
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to handle...)
if( (hotkey & GR_KB_CTRL) != 0 )
hotkey += 'A' - 1;
/* 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';
......@@ -405,6 +426,20 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
OnZoom( ID_ZOOM_CENTER_KEY );
break;
case HK_UNDO:
{
wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, ID_LIBEDIT_UNDO);
wxPostEvent(this, event);
}
break;
case HK_REDO:
{
wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, ID_LIBEDIT_REDO);
wxPostEvent(this, event);
}
break;
case HK_REPEAT_LAST:
if( LibItemToRepeat && (LibItemToRepeat->m_Flags == 0)
&& (LibItemToRepeat->Type() == COMPONENT_PIN_DRAW_TYPE) )
......
......@@ -17,6 +17,8 @@ enum hotkey_id_commnand {
HK_NEXT_SEARCH,
HK_DELETE,
HK_REPEAT_LAST,
HK_UNDO,
HK_REDO,
HK_MOVEBLOCK_TO_DRAGBLOCK,
HK_ROTATE_COMPONENT,
HK_MIRROR_X_COMPONENT,
......
......@@ -39,14 +39,15 @@ EDA_LibComponentStruct * CopyItem;
}
/******************************************************/
void WinEDA_LibeditFrame::GetComponentFromRedoList()
bool WinEDA_LibeditFrame::GetComponentFromRedoList()
/******************************************************/
/* Redo the last edition:
- Place the current edited library component in undo list
- Get old version of the current edited library component
* @return FALSE if nothing done, else TRUE
*/
{
if ( GetScreen()->m_RedoList == NULL ) return;
if ( GetScreen()->m_RedoList == NULL ) return FALSE;
GetScreen()->AddItemToUndoList((EDA_BaseStruct *)CurrentLibEntry);
CurrentLibEntry =
......@@ -56,17 +57,20 @@ void WinEDA_LibeditFrame::GetComponentFromRedoList()
GetScreen()->SetModify();
ReCreateHToolbar();
SetToolbars();
return TRUE;
}
/******************************************************/
void WinEDA_LibeditFrame::GetComponentFromUndoList()
bool WinEDA_LibeditFrame::GetComponentFromUndoList()
/******************************************************/
/* Undo the last edition:
- Place the current edited library component in Redo list
- Get old version of the current edited library component
* @return FALSE if nothing done, else TRUE
*/
{
if ( GetScreen()->m_UndoList == NULL ) return;
if ( GetScreen()->m_UndoList == NULL ) return FALSE;
GetScreen()->AddItemToRedoList((EDA_BaseStruct *)CurrentLibEntry);
CurrentLibEntry =
......@@ -77,4 +81,6 @@ void WinEDA_LibeditFrame::GetComponentFromUndoList()
GetScreen()->SetModify();
ReCreateHToolbar();
SetToolbars();
return TRUE;
}
......@@ -59,11 +59,11 @@ EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
END_EVENT_TABLE()
WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
WinEDA_App* parent,
WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
WinEDA_App* parent,
const wxString& title,
const wxPoint& pos,
const wxSize& size ) :
const wxPoint& pos,
const wxSize& size ) :
WinEDA_DrawFrame( father, LIBEDITOR_FRAME, parent, title, pos, size )
{
m_FrameName = wxT( "LibeditFrame" );
......@@ -205,7 +205,8 @@ void WinEDA_LibeditFrame::SetToolbars()
{
int AliasLocation = LocateAlias( CurrentLibEntry->m_AliasList, CurrentAliasName );
if( AliasLocation >= 0 )
if( !CurrentLibEntry->m_AliasList[AliasLocation + ALIAS_DOC_FILENAME].IsEmpty() )
if( !CurrentLibEntry->m_AliasList[AliasLocation +
ALIAS_DOC_FILENAME].IsEmpty() )
enable_dtool = TRUE;
}
else if( !CurrentLibEntry->m_DocFile.IsEmpty() )
......@@ -289,8 +290,8 @@ int WinEDA_LibeditFrame::BestZoom()
void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
/*************************************************************************/
{
int id = event.GetId();
wxPoint pos;
int id = event.GetId();
wxPoint pos;
wxClientDC dc( DrawPanel );
......@@ -709,13 +710,13 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_LIBEDIT_UNDO:
GetComponentFromUndoList();
DrawPanel->Refresh( TRUE );
if( GetComponentFromUndoList() )
DrawPanel->Refresh( TRUE );
break;
case ID_LIBEDIT_REDO:
GetComponentFromRedoList();
DrawPanel->Refresh( TRUE );
if( GetComponentFromRedoList() )
DrawPanel->Refresh( TRUE );
break;
default:
......
......@@ -16,6 +16,7 @@
#include "bitmaps.h"
#include "protos.h"
#include "id.h"
#include "hotkeys.h"
/************************************************/
......@@ -26,6 +27,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
{
int ii;
wxMenuBar * menuBar = GetMenuBar();
wxString msg;
if( menuBar == NULL )
{
......@@ -117,18 +119,16 @@ wxMenuBar * menuBar = GetMenuBar();
// Menu Edit:
wxMenu * editMenu = new wxMenu;
msg = AddHotkeyName( _( "&Undo\t" ), s_Schematic_Hokeys_Descr, HK_UNDO );
item = new wxMenuItem(editMenu, ID_SCHEMATIC_UNDO,
_("&Undo\tCTRL+Z"),
msg,
_("Undo last edition") );
item->SetBitmap(undo_xpm);
editMenu->Append(item);
/* if ( GetScreen()->m_UndoList )
editMenu->Enable(ID_SCHEMATIC_UNDO,TRUE);
else
editMenu->Enable(ID_SCHEMATIC_UNDO,FALSE);
*/
msg = AddHotkeyName( _( "&Redo\t" ), s_Schematic_Hokeys_Descr, HK_REDO );
item = new wxMenuItem(editMenu, ID_SCHEMATIC_REDO,
_("&Redo\tCTRL+Y"),
msg,
_("Redo the last undo command") );
item->SetBitmap(redo_xpm);
editMenu->Append(item);
......@@ -165,14 +165,7 @@ wxMenuBar * menuBar = GetMenuBar();
configmenu->Append(item);
configmenu->AppendSeparator();
item = new wxMenuItem(configmenu, ID_PREFERENCES_CREATE_CONFIG_HOTKEYS, _("Create Eeschema &Hotkey config file"),
_("Create or Recreate the hotkey config file from current hotkey list") );
item->SetBitmap(save_setup_xpm);
configmenu->Append(item);
item = new wxMenuItem(configmenu, ID_PREFERENCES_READ_CONFIG_HOTKEYS, _("Reread &Eeschema Hotkey config file"),
_("Reread the hotkey config file") );
item->SetBitmap( reload_xpm);
configmenu->Append(item);
AddHotheyConfigMenu( configmenu );
// Menu Help:
wxMenu *helpMenu = new wxMenu;
......
......@@ -746,13 +746,13 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_SCHEMATIC_UNDO:
GetSchematicFromUndoList();
DrawPanel->Refresh( TRUE );
if ( GetSchematicFromUndoList() )
DrawPanel->Refresh( TRUE );
break;
case ID_SCHEMATIC_REDO:
GetSchematicFromRedoList();
DrawPanel->Refresh( TRUE );
if ( GetSchematicFromRedoList() )
DrawPanel->Refresh( TRUE );
break;
default: // Log error:
......
......@@ -291,16 +291,17 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
/**********************************************************/
void WinEDA_SchematicFrame::GetSchematicFromRedoList()
bool WinEDA_SchematicFrame::GetSchematicFromRedoList()
/**********************************************************/
/* Redo the last edition:
* - Save the current schematic in undo list
* - Get the old version
* @return FALSE if nothing done, else TRUE
*/
{
if( GetScreen()->m_RedoList == NULL )
return;
return FALSE;
/* Get the old wrapper and put it in UndoList */
DrawPickedStruct* List = (DrawPickedStruct*) GetScreen()->GetItemFromRedoList();
......@@ -312,6 +313,8 @@ void WinEDA_SchematicFrame::GetSchematicFromRedoList()
GetScreen()->SetModify();
ReCreateHToolbar();
SetToolbars();
return TRUE;
}
......@@ -463,16 +466,17 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
/**********************************************************/
void WinEDA_SchematicFrame::GetSchematicFromUndoList()
bool WinEDA_SchematicFrame::GetSchematicFromUndoList()
/**********************************************************/
/* Undo the last edition:
* - Save the current schematic in Redo list
* - Get an old version of the schematic
* @return FALSE if nothing done, else TRUE
*/
{
if( GetScreen()->m_UndoList == NULL )
return;
return FALSE;
/* Get the old wrapper and put it in RedoList (the real data list is the m_Son member) */
DrawPickedStruct* List = (DrawPickedStruct*) GetScreen()->GetItemFromUndoList();
......@@ -484,6 +488,8 @@ void WinEDA_SchematicFrame::GetSchematicFromUndoList()
GetScreen()->SetModify();
ReCreateHToolbar();
SetToolbars();
return TRUE;
}
......
......@@ -56,13 +56,7 @@ BEGIN_EVENT_TABLE(WinEDA_SchematicFrame, wxFrame)
EVT_MENU(ID_GEN_COPY_BLOCK_TO_CLIPBOARD, WinEDA_DrawFrame::CopyToClipboard)
EVT_MENU(ID_EXIT, WinEDA_SchematicFrame::Process_Special_Functions)
EVT_MENU(ID_CONFIG_REQ, WinEDA_SchematicFrame::Process_Config)
EVT_MENU(ID_CONFIG_READ, WinEDA_SchematicFrame::Process_Config)
EVT_MENU(ID_CONFIG_SAVE, WinEDA_SchematicFrame::Process_Config)
EVT_MENU(ID_COLORS_SETUP, WinEDA_SchematicFrame::Process_Config)
EVT_MENU(ID_OPTIONS_SETUP, WinEDA_SchematicFrame::Process_Config)
EVT_MENU(ID_PREFERENCES_CREATE_CONFIG_HOTKEYS, WinEDA_SchematicFrame::Process_Config)
EVT_MENU(ID_PREFERENCES_READ_CONFIG_HOTKEYS, WinEDA_SchematicFrame::Process_Config)
EVT_MENU_RANGE(ID_CONFIG_AND_PREFERENCES_START, ID_CONFIG_AND_PREFERENCES_END, WinEDA_SchematicFrame::Process_Config)
EVT_MENU_RANGE(ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
WinEDA_DrawFrame::SetLanguage)
......
......@@ -147,10 +147,10 @@ void WinEDA_LibeditFrame::ReCreateHToolbar()
_( "Create a new library an save current part into" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBEDIT_UNDO, wxEmptyString, BITMAP( undo_xpm ),
_( "Undo last edition" ) );
m_HToolBar->AddTool( ID_LIBEDIT_REDO, wxEmptyString, BITMAP( redo_xpm ),
_( "Redo the last undo command" ) );
msg = AddHotkeyName( _( "Undo last edition" ), s_Schematic_Hokeys_Descr, HK_UNDO );
m_HToolBar->AddTool( ID_LIBEDIT_UNDO, wxEmptyString, BITMAP( undo_xpm ), msg );
msg = AddHotkeyName( _( "Redo the last undo command" ), s_Schematic_Hokeys_Descr, HK_REDO );
m_HToolBar->AddTool( ID_LIBEDIT_REDO, wxEmptyString, BITMAP( redo_xpm ), msg );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_PART, BITMAP( part_properties_xpm ),
......
......@@ -87,10 +87,11 @@ void WinEDA_SchematicFrame::ReCreateHToolbar()
_( "Paste" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_SCHEMATIC_UNDO, wxEmptyString, BITMAP( undo_xpm ),
_( "Undo last edition" ) );
m_HToolBar->AddTool( ID_SCHEMATIC_REDO, wxEmptyString, BITMAP( redo_xpm ),
_( "Redo the last undo command" ) );
msg = AddHotkeyName( _( "Undo last edition" ), s_Schematic_Hokeys_Descr, HK_UNDO );
m_HToolBar->AddTool( ID_SCHEMATIC_UNDO, wxEmptyString, BITMAP( undo_xpm ), msg );
msg = AddHotkeyName( _( "Redo the last undo command" ), s_Schematic_Hokeys_Descr, HK_REDO );
m_HToolBar->AddTool( ID_SCHEMATIC_REDO, wxEmptyString, BITMAP( redo_xpm ), msg );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GEN_PRINT, wxEmptyString, BITMAP( print_button ),
......
......@@ -57,13 +57,13 @@ BEGIN_EVENT_TABLE(WinEDA_GerberFrame, wxFrame)
EVT_MENU(ID_EXIT, WinEDA_GerberFrame::Process_Special_Functions)
// menu Config
EVT_MENU(ID_CONFIG_REQ, WinEDA_GerberFrame::Process_Config)
EVT_MENU_RANGE(ID_CONFIG_AND_PREFERENCES_START, ID_CONFIG_AND_PREFERENCES_END,
WinEDA_GerberFrame::Process_Config)
EVT_MENU(ID_COLORS_SETUP, WinEDA_GerberFrame::Process_Config)
EVT_MENU(ID_OPTIONS_SETUP, WinEDA_GerberFrame::Process_Config)
EVT_MENU(ID_PCB_LOOK_SETUP, WinEDA_GerberFrame::Process_Config)
EVT_MENU(ID_CONFIG_SAVE, WinEDA_GerberFrame::Process_Config)
EVT_MENU(ID_PREFERENCES_CREATE_CONFIG_HOTKEYS, WinEDA_GerberFrame::Process_Config)
EVT_MENU(ID_PREFERENCES_READ_CONFIG_HOTKEYS, WinEDA_GerberFrame::Process_Config)
EVT_MENU_RANGE(ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
WinEDA_DrawFrame::SetLanguage)
......
/******************************************/
/** gerbview_config.cpp : configuration pour Gerbview */
/******************************************/
/************************************************/
/** gerbview_config.cpp : Gerbview configuration*/
/************************************************/
/* lit ou met a jour la configuration de PCBNEW */
/* Functions to handle Gerbview configuration */
#include "fctsys.h"
......@@ -20,125 +20,149 @@
/* Variables locales */
#define HOTKEY_FILENAME wxT("gerbview")
#define HOTKEY_FILENAME wxT( "gerbview" )
/*************************************************************/
void WinEDA_GerberFrame::Process_Config(wxCommandEvent& event)
void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event )
/*************************************************************/
{
int id = event.GetId();
wxPoint pos;
wxString FullFileName;
pos = GetPosition();
pos.x += 20; pos.y += 20;
switch( id )
{
case ID_COLORS_SETUP :
DisplayColorSetupFrame(this, pos);
break;
case ID_CONFIG_REQ : // Creation de la fenetre de configuration
{
InstallConfigFrame(pos);
break;
}
case ID_PCB_TRACK_SIZE_SETUP:
case ID_PCB_LOOK_SETUP:
case ID_OPTIONS_SETUP:
InstallPcbOptionsFrame(pos, id);
break;
case ID_CONFIG_SAVE:
Update_config();
break;
case ID_PREFERENCES_CREATE_CONFIG_HOTKEYS:
FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
WriteHotkeyConfigFile(FullFileName, s_Gerbview_Hokeys_Descr, true);
break;
case ID_PREFERENCES_READ_CONFIG_HOTKEYS:
Read_Hotkey_Config( this, true);
break;
default:
DisplayError(this, wxT("WinEDA_GerberFrame::Process_Config internal error"));
}
int id = event.GetId();
wxPoint pos;
wxString FullFileName;
pos = GetPosition();
pos.x += 20; pos.y += 20;
switch( id )
{
case ID_COLORS_SETUP:
DisplayColorSetupFrame( this, pos );
break;
case ID_CONFIG_REQ: // Creation de la fenetre de configuration
{
InstallConfigFrame( pos );
break;
}
case ID_PCB_TRACK_SIZE_SETUP:
case ID_PCB_LOOK_SETUP:
case ID_OPTIONS_SETUP:
InstallPcbOptionsFrame( pos, id );
break;
case ID_CONFIG_SAVE:
Update_config();
break;
case ID_PREFERENCES_CREATE_CONFIG_HOTKEYS:
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
WriteHotkeyConfigFile( FullFileName, s_Gerbview_Hokeys_Descr, true );
break;
case ID_PREFERENCES_READ_CONFIG_HOTKEYS:
Read_Hotkey_Config( this, true );
break;
case ID_PREFERENCES_HOTKEY_PATH_IS_HOME:
if( g_ConfigFileLocationChoice != 0 )
{
g_ConfigFileLocationChoice = 0;
m_Parent->m_EDA_CommonConfig->Write( HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice );
}
break;
case ID_PREFERENCES_HOTKEY_PATH_IS_KICAD:
if( g_ConfigFileLocationChoice != 1 )
{
g_ConfigFileLocationChoice = 1;
m_Parent->m_EDA_CommonConfig->Write( HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice );
}
break;
default:
DisplayError( this, wxT( "WinEDA_GerberFrame::Process_Config internal error" ) );
}
}
/*****************************************************/
bool Read_Config()
/*****************************************************/
/* lit la configuration, si elle n'a pas deja etee lue
1 - lit gerbview.cnf
2 - si non trouve lit <chemin de gerbview.exe>/gerbview.cnf
3 - si non trouve: init des variables aux valeurs par defaut
Retourne un pointeur su le message d'erreur a afficher
*/
/* lit la configuration, si elle n'a pas deja etee lue
* 1 - lit gerbview.cnf
* 2 - si non trouve lit <chemin de gerbview.exe>/gerbview.cnf
* 3 - si non trouve: init des variables aux valeurs par defaut
*
* Retourne un pointeur su le message d'erreur a afficher
*/
{
g_Prj_Config_Filename_ext = wxT(".cnf");
EDA_Appl->ReadProjectConfig( wxT("gerbview"), GROUP, ParamCfgList, FALSE);
/* Inits autres variables */
if (ScreenPcb) ScreenPcb->SetGrid(TmpGrid);
if ( g_PhotoFilenameExt.IsEmpty() ) g_PhotoFilenameExt = wxT(".pho");
if ( g_DrillFilenameExt.IsEmpty() ) g_DrillFilenameExt = wxT(".drl");
if ( g_PenFilenameExt.IsEmpty() ) g_PenFilenameExt = wxT(".pen");
return TRUE;
g_Prj_Config_Filename_ext = wxT( ".cnf" );
EDA_Appl->ReadProjectConfig( wxT( "gerbview" ), GROUP, ParamCfgList, FALSE );
/* Inits autres variables */
if( ScreenPcb )
ScreenPcb->SetGrid( TmpGrid );
if( g_PhotoFilenameExt.IsEmpty() )
g_PhotoFilenameExt = wxT( ".pho" );
if( g_DrillFilenameExt.IsEmpty() )
g_DrillFilenameExt = wxT( ".drl" );
if( g_PenFilenameExt.IsEmpty() )
g_PenFilenameExt = wxT( ".pen" );
return TRUE;
}
/******************************************/
void WinEDA_GerberFrame::Update_config()
/******************************************/
/*
creation du fichier de config
*/
* creation du fichier de config
*/
{
wxString FullFileName;
wxString mask( wxT("*") ),
g_Prj_Config_Filename_ext = wxT(".cnf";)
mask += g_Prj_Config_Filename_ext;
FullFileName = wxT("gerbview");
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
FullFileName = EDA_FileSelector(_("Save config file"),
wxEmptyString, /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */
mask, /* Masque d'affichage */
this,
wxFD_SAVE,
TRUE
);
if ( FullFileName.IsEmpty() ) return;
/* ecriture de la configuration */
EDA_Appl->WriteProjectConfig(FullFileName, GROUP, ParamCfgList);
wxString FullFileName;
wxString mask( wxT( "*" ) ),
g_Prj_Config_Filename_ext = wxT( ".cnf"; )
mask += g_Prj_Config_Filename_ext;
FullFileName = wxT( "gerbview" );
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
FullFileName = EDA_FileSelector( _( "Save config file" ),
wxEmptyString, /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */
mask, /* Masque d'affichage */
this,
wxFD_SAVE,
TRUE
);
if( FullFileName.IsEmpty() )
return;
/* ecriture de la configuration */
EDA_Appl->WriteProjectConfig( FullFileName, GROUP, ParamCfgList );
}
/***************************************************************/
bool Read_Hotkey_Config( WinEDA_DrawFrame * frame, bool verbose )
bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose )
/***************************************************************/
/*
* Read the hotkey files config for pcbnew and module_edit
*/
*/
{
wxString FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
return frame->ReadHotkeyConfigFile(FullFileName, s_Gerbview_Hokeys_Descr, verbose);
}
wxString FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
return frame->ReadHotkeyConfigFile( FullFileName, s_Gerbview_Hokeys_Descr, verbose );
}
......@@ -124,18 +124,7 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
_( "Save application preferences" ), save_setup_xpm );
configmenu->AppendSeparator();
item = new wxMenuItem( configmenu, ID_PREFERENCES_CREATE_CONFIG_HOTKEYS,
_( "Create Pcbnew &Hotkey config file" ),
_(
"Create or Recreate the hotkey config file from current hotkey list" )
);
item->SetBitmap( save_setup_xpm );
configmenu->Append( item );
item = new wxMenuItem( configmenu, ID_PREFERENCES_READ_CONFIG_HOTKEYS,
_( "Reread &Pcbnew Hotkey config file" ),
_( "Reread the hotkey config file" ) );
item->SetBitmap( reload_xpm );
configmenu->Append( item );
AddHotheyConfigMenu( configmenu );
// Menu drill ( generation fichiers percage)
......
......@@ -21,6 +21,7 @@
#include "../bitmaps/Save_NetList.xpm"
#include "../bitmaps/Save_SetUp.xpm"
#include "../bitmaps/Read_SetUp.xpm"
#include "../bitmaps/Editor.xpm"
#include "../bitmaps/Open_Library.xpm"
#include "../bitmaps/New_Library.xpm"
......
......@@ -5,7 +5,7 @@
COMMON_GLOBL wxString g_BuildVersion
#ifdef EDA_BASE
(wxT("(2007-09-06)"))
(wxT("(2007-09-19)"))
#endif
;
......
......@@ -15,15 +15,15 @@
#define DEFAULT_HOTKEY_FILENAME_EXT wxT( ".key" )
/* define default path for config key file */
#ifdef __WINDOWS__
#define DEFAULT_HOTKEY_FILENAME_PATH EDA_Appl->m_BinDir + wxT( "../template/" )
#else
#define DEFAULT_HOTKEY_FILENAME_PATH wxGetHomeDir() + wxT( "/" )
#endif
#define DEFAULT_HOTKEY_FILENAME_PATH_IS_HOME wxGetHomeDir() + wxT( "/" )
#define DEFAULT_HOTKEY_FILENAME_PATH_IS_KICAD EDA_Appl->m_BinDir + wxT( "../template/" )
/* keyword idetifier in kicad config use ti store/retrieve path option */
#define HOTKEY_CFG_PATH_OPT wxT("HotkeyPathOption")
/* Class to handle hotkey commnands. hotkeys have a default value
* This class allows (for the future..) the real key code changed by user(from a key code list file, TODO)
* This class allows the real key code changed by user(from a key code list file)
*/
class Ki_HotkeyInfo
{
......@@ -36,22 +36,25 @@ public:
Ki_HotkeyInfo( const wxChar* infomsg, int idcommand, int keycode );
};
/* handle a Section name and the corresponding list of hotkeys (Ki_HotkeyInfo list) */
/* handle a Section name and the corresponding list of hotkeys (Ki_HotkeyInfo list)
* hotkeys are grouped by section.
* a section is a list of hotkey infos ( a Ki_HotkeyInfo list).
* A full list of hoteys can used one or many sections
* for instance:
* the schematic editor uses a common section (zoom hotkeys list ..) and a specific section
* the library editor uses the same common section and a specific section
* this feature avoid duplications and made hotkey file config easier to understand ane edit
*/
struct Ki_HotkeyInfoSectionDescriptor
{
public:
wxString* m_SectionTag; // The section name
Ki_HotkeyInfo** m_HK_InfoList; // pointer on List of Ki_HotkeyInfo
Ki_HotkeyInfo** m_HK_InfoList; // List of Ki_HotkeyInfo pointers
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; }
*/
// Info usage only
};
/* Identifiers (tags) in key code configuration file file
/* Identifiers (tags) in key code configuration file (or section names)
* .m_SectionTag member of a Ki_HotkeyInfoSectionDescriptor
*/
COMMON_GLOBL wxString g_CommonSectionTag
......@@ -80,15 +83,22 @@ COMMON_GLOBL wxString g_ModuleEditSectionTag
#endif
;
COMMON_GLOBL int g_ConfigFileLocationChoice; /* 0 = files are in Home directory (usefull under unix)
* 1 = kicad/template ( usefull only under windows )
* 2 ... = unused
*/
/* Functions:
*/
wxString ReturnHotkeyConfigFilePath( int choice );
void AddHotheyConfigMenu( wxMenu* menu );
wxString ReturnKeyNameFromKeyCode( int keycode );
wxString ReturnKeyNameFromCommandId( Ki_HotkeyInfo** List, int CommandId );
wxString AddHotkeyName( const wxString& text, Ki_HotkeyInfo** List, int CommandId );
wxString AddHotkeyName( const wxString& text,
struct Ki_HotkeyInfoSectionDescriptor* DescrList,
int CommandId );
void DisplayHotkeyList( WinEDA_DrawFrame* frame,
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 );
......
......@@ -63,15 +63,19 @@ enum main_id {
ID_SAVE_ONE_SHEET,
ID_SAVE_ONE_SHEET_AS,
ID_CONFIG_AND_PREFERENCES_START,
ID_CONFIG_REQ,
ID_CONFIG_SAVE,
ID_CONFIG_READ,
ID_PREFERENCES_CREATE_CONFIG_HOTKEYS,
ID_PREFERENCES_READ_CONFIG_HOTKEYS,
ID_PREFERENCES_UNUSED0,
ID_PREFERENCES_EDIT_CONFIG_HOTKEYS,
ID_PREFERENCES_HOTKEY_PATH_IS_HOME,
ID_PREFERENCES_HOTKEY_PATH_IS_KICAD,
ID_PREFERENCES_UNUSED1,
ID_PREFERENCES_UNUSED2,
ID_PREFERENCES_UNUSED3,
ID_CONFIG_AND_PREFERENCES_END,
ID_GEN_PRINT,
ID_GEN_PLOT,
......
......@@ -1152,8 +1152,8 @@ public:
private:
void PutDataInPreviousState( DrawPickedStruct* List );
void GetSchematicFromRedoList();
void GetSchematicFromUndoList();
bool GetSchematicFromRedoList();
bool GetSchematicFromUndoList();
public:
......@@ -1230,8 +1230,8 @@ public:
void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 );
private:
void GetComponentFromUndoList();
void GetComponentFromRedoList();
bool GetComponentFromUndoList();
bool GetComponentFromRedoList();
// Edition des Pins:
void CreatePin( wxDC* DC );
......
No preview for this file type
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -23,7 +23,6 @@
#include "zip.xpm"
#include "unzip.xpm"
#include "Browse_Files.xpm"
#include "Editor.xpm"
#include "New_Project.xpm"
#include "Open_Project.xpm"
#include "../bitmaps/icon_python.xpm"
......
......@@ -2,11 +2,7 @@
/* Routines generales de gestion des commandes usuelles */
/********************************************************/
/* fichier controle.cpp */
/*
* Routines d'affichage grille, Boite de coordonnees, Curseurs, marqueurs ...
*/
/* controle.cpp */
#include "fctsys.h"
#include "gr_basic.h"
......@@ -28,9 +24,9 @@
/* Variables Locales */
/**********************************/
/****************************************/
void RemoteCommand( const char* cmdline )
/**********************************/
/****************************************/
/* Read a remote command send by eeschema via a socket,
* port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242)
......@@ -129,7 +125,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
wxString text;
const BOARD_ITEM* item = this;
EQUIPOT* net;
switch( item->Type() )
{
case PCB_EQUIPOT_STRUCT_TYPE:
......@@ -138,6 +134,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
case TYPEMODULE:
text << _("Footprint") << wxT(" ") << ((MODULE*)item)->GetReference();
text << wxT(" (") << ReturnPcbLayerName( item->m_Layer ) << wxT(")");
break;
case TYPEPAD:
......@@ -188,13 +185,13 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
case S_RECT: cp = _("Rect"); break;
case S_ARC: cp = _("Arc"); break;
case S_CIRCLE: cp = _("Circle"); break;
/* used?
/* used in Gerbview: */
case S_ARC_RECT: cp = wxT("arc_rect"); break;
case S_SPOT_OVALE: cp = wxT("spot_oval"); break;
case S_SPOT_CIRCLE: cp = wxT("spot_circle"); break;
case S_SPOT_RECT: cp = wxT("spot_rect"); break;
case S_POLYGON: cp = wxT("polygon"); break;
*/
default: cp = wxT("??EDGE??"); break;
}
text << *cp << _(" of ")
......
......@@ -23,8 +23,7 @@ static void Process_Move_Item( WinEDA_PcbFrame* frame,
void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
/********************************************************************/
/* Traite les commandes declench�e par le bouton gauche de la souris,
* quand un outil est deja selectionn�
/* Handle the left buttom mouse click, when a tool is active
*/
{
BOARD_ITEM* DrawStruct = GetCurItem();
......@@ -35,7 +34,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ) )
{
DrawPanel->m_AutoPAN_Request = FALSE;
if( DrawStruct && DrawStruct->m_Flags ) // Commande "POPUP" en cours
if( DrawStruct && DrawStruct->m_Flags ) // "POPUP" in progress
{
switch( DrawStruct->Type() )
{
......
......@@ -33,62 +33,65 @@
/* local variables */
/* Hotkey list: */
static Ki_HotkeyInfo HkSwitch2CopperLayer( wxT(
"Switch to Copper layer" ),
HK_SWITCH_LAYER_TO_COPPER, WXK_PAGEUP );
static Ki_HotkeyInfo HkSwitch2ComponentLayer( wxT(
"Switch to Component layer" ),
HK_SWITCH_LAYER_TO_COMPONENT, WXK_PAGEDOWN );
static Ki_HotkeyInfo HkSwitch2InnerLayer1( wxT(
"Switch to Inner layer 1" ),
HK_SWITCH_LAYER_TO_INNER1, WXK_F5 );
static Ki_HotkeyInfo HkSwitch2InnerLayer2( wxT(
"Switch to Inner layer 2" ),
HK_SWITCH_LAYER_TO_INNER2, WXK_F6 );
static Ki_HotkeyInfo HkSwitch2InnerLayer3( wxT(
"Switch to Inner layer 3" ),
HK_SWITCH_LAYER_TO_INNER3, WXK_F7 );
static Ki_HotkeyInfo HkSwitch2InnerLayer4( wxT(
"Switch to Inner layer 4" ),
HK_SWITCH_LAYER_TO_INNER4, WXK_F8 );
static Ki_HotkeyInfo HkSwitch2InnerLayer5( wxT(
"Switch to Inner layer 5" ),
HK_SWITCH_LAYER_TO_INNER5, WXK_F9 );
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 );
static Ki_HotkeyInfo HkBackspace( wxT( "Delete track segment" ), HK_BACK_SPACE, WXK_BACK );
static Ki_HotkeyInfo HkAddVia( wxT( "Add Via" ), HK_ADD_VIA, 'V' );
static Ki_HotkeyInfo HkEndTrack( wxT( "End Track" ), HK_END_TRACK, WXK_END );
static Ki_HotkeyInfo HkFlipFootprint( wxT( "Flip Footprint" ), HK_FLIP_FOOTPRINT, 'F' );
static Ki_HotkeyInfo HkRotateFootprint( wxT( "Rotate Footprint" ), HK_ROTATE_FOOTPRINT, 'R' );
static Ki_HotkeyInfo HkMoveFootprint( wxT( "Move Footprint" ), HK_MOVE_FOOTPRINT, 'M' );
static Ki_HotkeyInfo HkDragFootprint( wxT( "Drag Footprint" ), HK_DRAG_FOOTPRINT, 'G' );
static Ki_HotkeyInfo HkLock_Unlock_Footprint( wxT(
"Lock/Unlock Footprint" ),
HK_LOCK_UNLOCK_FOOTPRINT, 'L' );
static Ki_HotkeyInfo HkDelete( wxT( "Delete Track or Footprint" ), HK_DELETE, WXK_DELETE );
static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset local coord." ), HK_RESET_LOCAL_COORD, ' ' );
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 HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' );
static Ki_HotkeyInfo HkTrackDisplayMode( wxT(
"Track Display Mode" ),
HK_SWITCH_TRACK_DISPLAY_MODE, 'F' );
static Ki_HotkeyInfo HkSwitch2CopperLayer( wxT(
"Switch to Copper layer" ),
HK_SWITCH_LAYER_TO_COPPER, WXK_PAGEUP );
static Ki_HotkeyInfo HkSwitch2ComponentLayer( wxT(
"Switch to Component layer" ),
HK_SWITCH_LAYER_TO_COMPONENT, WXK_PAGEDOWN );
static Ki_HotkeyInfo HkSwitch2InnerLayer1( wxT(
"Switch to Inner layer 1" ),
HK_SWITCH_LAYER_TO_INNER1, WXK_F5 );
static Ki_HotkeyInfo HkSwitch2InnerLayer2( wxT(
"Switch to Inner layer 2" ),
HK_SWITCH_LAYER_TO_INNER2, WXK_F6 );
static Ki_HotkeyInfo HkSwitch2InnerLayer3( wxT(
"Switch to Inner layer 3" ),
HK_SWITCH_LAYER_TO_INNER3, WXK_F7 );
static Ki_HotkeyInfo HkSwitch2InnerLayer4( wxT(
"Switch to Inner layer 4" ),
HK_SWITCH_LAYER_TO_INNER4, WXK_F8 );
static Ki_HotkeyInfo HkSwitch2InnerLayer5( wxT(
"Switch to Inner layer 5" ),
HK_SWITCH_LAYER_TO_INNER5, WXK_F9 );
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 );
static Ki_HotkeyInfo HkBackspace( wxT( "Delete track segment" ), HK_BACK_SPACE, WXK_BACK );
static Ki_HotkeyInfo HkAddVia( wxT( "Add Via" ), HK_ADD_VIA, 'V' );
static Ki_HotkeyInfo HkEndTrack( wxT( "End Track" ), HK_END_TRACK, WXK_END );
static Ki_HotkeyInfo HkFlipFootprint( wxT( "Flip Footprint" ), HK_FLIP_FOOTPRINT, 'F' );
static Ki_HotkeyInfo HkRotateFootprint( wxT( "Rotate Footprint" ), HK_ROTATE_FOOTPRINT, 'R' );
static Ki_HotkeyInfo HkMoveFootprint( wxT( "Move Footprint" ), HK_MOVE_FOOTPRINT, 'M' );
static Ki_HotkeyInfo HkDragFootprint( wxT( "Drag Footprint" ), HK_DRAG_FOOTPRINT, 'G' );
static Ki_HotkeyInfo HkGetAndMoveFootprint( wxT(
"Get and Move Footprint" ),
HK_GET_AND_MOVE_FOOTPRINT, 'T' );
static Ki_HotkeyInfo HkLock_Unlock_Footprint( wxT(
"Lock/Unlock Footprint" ),
HK_LOCK_UNLOCK_FOOTPRINT, 'L' );
static Ki_HotkeyInfo HkDelete( wxT( "Delete Track or Footprint" ), HK_DELETE, WXK_DELETE );
static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset local coord." ), HK_RESET_LOCAL_COORD, ' ' );
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 HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' + GR_KB_CTRL );
static Ki_HotkeyInfo HkTrackDisplayMode( wxT(
"Track Display Mode" ),
HK_SWITCH_TRACK_DISPLAY_MODE, 'K' );
// List of common hotkey descriptors
Ki_HotkeyInfo* s_Common_Hotkey_List[] = {
......@@ -105,6 +108,7 @@ Ki_HotkeyInfo* s_board_edit_Hotkey_List[] = {
&HkAddVia, &HkEndTrack,
&HkMoveFootprint, &HkFlipFootprint,
&HkRotateFootprint, &HkDragFootprint,
&HkGetAndMoveFootprint,
&HkLock_Unlock_Footprint,
&HkSavefile, &HkLoadfile, &HkFindItem,
&HkSwitch2CopperLayer,
......@@ -129,26 +133,26 @@ Ki_HotkeyInfo* s_module_edit_Hotkey_List[] = {
// 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, NULL}
{ &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, 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_CommonSectionTag, s_Common_Hotkey_List, NULL },
{ &g_BoardEditorSectionTag, s_board_edit_Hotkey_List, NULL },
{ NULL, NULL, NULL }
{ 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_CommonSectionTag, s_Common_Hotkey_List, NULL },
{ &g_ModuleEditSectionTag, s_module_edit_Hotkey_List, NULL },
{ NULL, NULL, NULL }
{ NULL, NULL, NULL }
};
......@@ -174,7 +178,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
MODULE* module = NULL;
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to handle...)
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (just easier to handle...)
if( (hotkey & GR_KB_CTRL) != 0 )
hotkey += 'A' - 1;
/* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */
......@@ -284,6 +288,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
case HK_SWITCH_TRACK_DISPLAY_MODE:
DisplayOpt.DisplayPcbTrackFill ^= 1; DisplayOpt.DisplayPcbTrackFill &= 1;
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
GetScreen()->SetRefreshReq();
break;
......@@ -294,15 +299,14 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
case HK_BACK_SPACE:
if( m_ID_current_state == ID_TRACK_BUTT && GetScreen()->m_Active_Layer <= CMP_N )
{
bool ItemFree = GetCurItem()==NULL || GetCurItem()->m_Flags==0;
if( ItemFree )
{
// no track is currently being edited - select a segment and remove it.
// @todo: possibly? pass the HK command code to PcbGeneralLocateAndDisplay() so it can restrict its search to specific item types.
// @todo: use PcbGeneralLocateAndDisplay() everywhere in this source file.
DrawStruct = PcbGeneralLocateAndDisplay();
// don't let backspace delete modules!!
......@@ -321,34 +325,49 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
break;
case HK_END_TRACK:
DrawPanel->MouseToCursorSchema();
End_Route( (TRACK*) ( GetCurItem() ), DC );
if ( ! ItemFree && (GetCurItem()->Type() == TYPETRACK) && ((GetCurItem()->m_Flags & IS_NEW) != 0) )
{ // A new track is in progress: call to End_Route()
DrawPanel->MouseToCursorSchema();
End_Route( (TRACK*) ( GetCurItem() ), DC );
}
break;
case HK_GET_AND_MOVE_FOOTPRINT:
if( ItemFree )
{
wxCommandEvent evt;
evt.SetId( ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST );
Process_Special_Functions( evt );
}
break;
case HK_FIND_ITEM:
{
wxCommandEvent evt;
evt.SetId( ID_FIND_ITEMS );
Process_Special_Functions( evt );
}
if( ItemFree )
{
wxCommandEvent evt;
evt.SetId( ID_FIND_ITEMS );
Process_Special_Functions( evt );
}
break;
case HK_LOAD_BOARD:
{
// try not to duplicate save, load code etc.
wxCommandEvent evt;
evt.SetId( ID_LOAD_FILE );
Files_io( evt );
}
if( ItemFree )
{
// try not to duplicate save, load code etc.
wxCommandEvent evt;
evt.SetId( ID_LOAD_FILE );
Files_io( evt );
}
break;
case HK_SAVE_BOARD:
{
// try not to duplicate save, load code etc.
wxCommandEvent evt;
evt.SetId( ID_SAVE_BOARD );
Files_io( evt );
}
if( ItemFree )
{
// try not to duplicate save, load code etc.
wxCommandEvent evt;
evt.SetId( ID_SAVE_BOARD );
Files_io( evt );
}
break;
case HK_ADD_VIA: // Switch to alternate layer and Place a via if a track is in progress
......
......@@ -20,6 +20,7 @@ enum hotkey_id_commnand {
HK_MOVE_FOOTPRINT,
HK_DRAG_FOOTPRINT,
HK_FLIP_FOOTPRINT,
HK_GET_AND_MOVE_FOOTPRINT,
HK_LOCK_UNLOCK_FOOTPRINT,
HK_ADD_VIA, HK_END_TRACK,
HK_SAVE_BOARD, HK_LOAD_BOARD,
......
......@@ -13,6 +13,7 @@
#include "bitmaps.h"
#include "protos.h"
#include "hotkeys.h"
#include "id.h"
#include "Swap_Layer.xpm"
......@@ -183,14 +184,7 @@ wxMenuBar * menuBar = GetMenuBar();
configmenu->Append(item);
configmenu->AppendSeparator();
item = new wxMenuItem(configmenu, ID_PREFERENCES_CREATE_CONFIG_HOTKEYS, _("Create Pcbnew &Hotkey config file"),
_("Create or Recreate the hotkey config file from current hotkey list") );
item->SetBitmap(save_setup_xpm);
configmenu->Append(item);
item = new wxMenuItem(configmenu, ID_PREFERENCES_READ_CONFIG_HOTKEYS, _("Reread &Pcbnew Hotkey config file"),
_("Reread the hotkey config file") );
item->SetBitmap( reload_xpm);
configmenu->Append(item);
AddHotheyConfigMenu( configmenu );
/////////////////////////////
// Ajustage de dimensions: //
......
......@@ -59,17 +59,19 @@
static wxMenu* Append_Track_Width_List()
/********************************************/
/* Ajoute au menu wxMenu * menu un sous-menu liste des epaisseurs de pistes
* disponibles
/* create a wxMenu * which shows the last used track widths and via diameters
* @return a pointeur to the menu
*/
{
#define TRACK_HISTORY_NUMBER_MAX 6
#define VIA_HISTORY_NUMBER_MAX 4
int ii;
wxString msg;
wxMenu* trackwidth;
wxMenu* trackwidth_menu;
double value;
trackwidth = new wxMenu;
for( ii = 0; ii < 6; ii++ )
trackwidth_menu = new wxMenu;
for( ii = 0; (ii < HIST0RY_NUMBER) && (ii < TRACK_HISTORY_NUMBER_MAX); ii++ )
{
if( g_DesignSettings.m_TrackWidhtHistory[ii] == 0 )
break;
......@@ -81,13 +83,13 @@ static wxMenu* Append_Track_Width_List()
else
msg.Printf( _( "Track %.3f" ), value );
trackwidth->Append( ID_POPUP_PCB_SELECT_WIDTH1 + ii, msg, wxEmptyString, TRUE );
trackwidth_menu->Append( ID_POPUP_PCB_SELECT_WIDTH1 + ii, msg, wxEmptyString, TRUE );
if( g_DesignSettings.m_TrackWidhtHistory[ii] == g_DesignSettings.m_CurrentTrackWidth )
trackwidth->Check( ID_POPUP_PCB_SELECT_WIDTH1 + ii, TRUE );
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_WIDTH1 + ii, TRUE );
}
trackwidth->AppendSeparator();
for( ii = 0; ii < 4; ii++ )
trackwidth_menu->AppendSeparator();
for( ii = 0; (ii < HIST0RY_NUMBER) && (ii < VIA_HISTORY_NUMBER_MAX); ii++ )
{
if( g_DesignSettings.m_ViaSizeHistory[ii] == 0 )
break;
......@@ -98,12 +100,12 @@ static wxMenu* Append_Track_Width_List()
msg.Printf( _( "Via %.1f" ), value * 1000 );
else
msg.Printf( _( "Via %.3f" ), value );
trackwidth->Append( ID_POPUP_PCB_SELECT_VIASIZE1 + ii, msg, wxEmptyString, TRUE );
trackwidth_menu->Append( ID_POPUP_PCB_SELECT_VIASIZE1 + ii, msg, wxEmptyString, TRUE );
if( g_DesignSettings.m_ViaSizeHistory[ii] == g_DesignSettings.m_CurrentViaSize )
trackwidth->Check( ID_POPUP_PCB_SELECT_VIASIZE1 + ii, TRUE );
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_VIASIZE1 + ii, TRUE );
}
return trackwidth;
return trackwidth_menu;
}
......@@ -120,20 +122,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
BOARD_ITEM* item = GetCurItem();
DrawPanel->CursorOff( &dc );
DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu
/* The user must now left click to first make the selection. OnRightClick()
is now only an action mechanism, not a selection mechanism. The selection
mechanism sometimes involves a popup menu, so it is too complex to try
and do that here.
// Only offer user a new selection if there is currently none.
if( item == NULL )
{
item = PcbGeneralLocateAndDisplay();
}
*/
DrawPanel->m_CanStartBlock = -1; // Avoid to start a block coomand when clicking on menu
// If command in progress: Put the Cancel command (if needed) and End command
if( m_ID_current_state )
......@@ -171,6 +160,14 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
return;
}
/* Select a proper item */
if( (item == NULL) || (item->m_Flags == 0) )
{
item = PcbGeneralLocateAndDisplay();
SetCurItem(item);
}
item = GetCurItem();
if( item )
flags = item->m_Flags;
else
......
......@@ -85,7 +85,7 @@ wxString FullFileName;
break;
case ID_PREFERENCES_CREATE_CONFIG_HOTKEYS:
FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
WriteHotkeyConfigFile(FullFileName, s_Pcbnew_Editor_Hokeys_Descr, true);
......@@ -95,6 +95,27 @@ wxString FullFileName;
Read_Hotkey_Config( this, true);
break;
case ID_PREFERENCES_EDIT_CONFIG_HOTKEYS:
{
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
wxString editorname = GetEditorName();
if ( !editorname.IsEmpty() )
ExecuteFile(this, editorname, FullFileName);
break;
}
case ID_PREFERENCES_HOTKEY_PATH_IS_HOME:
g_ConfigFileLocationChoice = 0;
m_Parent->m_EDA_CommonConfig->Write(HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice);
break;
case ID_PREFERENCES_HOTKEY_PATH_IS_KICAD:
g_ConfigFileLocationChoice = 1;
m_Parent->m_EDA_CommonConfig->Write(HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice);
break;
default:
DisplayError(this, wxT("WinEDA_PcbFrame::Process_Config internal error"));
}
......@@ -108,7 +129,7 @@ bool Read_Hotkey_Config( WinEDA_DrawFrame * frame, bool verbose )
* Read the hotkey files config for pcbnew and module_edit
*/
{
wxString FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
wxString FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
return frame->ReadHotkeyConfigFile(FullFileName, s_Pcbnew_Editor_Hokeys_Descr, verbose);
......
......@@ -64,11 +64,9 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
EVT_MENU( ID_EXIT, WinEDA_PcbFrame::Process_Special_Functions )
// menu Config
EVT_MENU( ID_CONFIG_REQ, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_COLORS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_OPTIONS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PREFERENCES_CREATE_CONFIG_HOTKEYS, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PREFERENCES_READ_CONFIG_HOTKEYS, WinEDA_PcbFrame::Process_Config )
EVT_MENU_RANGE(ID_CONFIG_AND_PREFERENCES_START, ID_CONFIG_AND_PREFERENCES_END,
WinEDA_PcbFrame::Process_Config)
EVT_MENU( ID_PCB_TRACK_SIZE_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_PAD_SETUP, WinEDA_PcbFrame::Process_Config )
......
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