7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-19 09:51:43 +00:00

hotkeys handling finished

This commit is contained in:
CHARRAS 2007-09-19 15:29:50 +00:00
parent ef3d04912d
commit 542b944196
35 changed files with 5403 additions and 5126 deletions

View File

@ -1,79 +1,84 @@
/* 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

View File

@ -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>
================================================================================

View File

@ -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;

View File

@ -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( "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( "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( "+" ), WXK_ADD },
{ wxT( "-" ), WXK_SUBTRACT },
{ wxT( "Up" ), WXK_UP },
{ wxT( "Down" ), WXK_DOWN },
{ wxT( "Left" ), WXK_LEFT },
{ wxT( "Right" ), WXK_RIGHT },
{ 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( "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( "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( "" ), 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 );
}

View File

@ -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() )
{

View File

@ -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);

View File

@ -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) )

View File

@ -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,

View File

@ -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;
}

View File

@ -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:

View File

@ -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;

View File

@ -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:

View File

@ -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;
}

View File

@ -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)

View File

@ -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 ),

View File

@ -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 ),

View File

@ -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)

View File

@ -1,8 +1,8 @@
/******************************************/
/** 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;
int id = event.GetId();
wxPoint pos;
wxString FullFileName;
pos = GetPosition();
pos.x += 20; pos.y += 20;
pos = GetPosition();
pos.x += 20; pos.y += 20;
switch( id )
{
case ID_COLORS_SETUP :
DisplayColorSetupFrame(this, pos);
break;
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_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_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_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_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_READ_CONFIG_HOTKEYS:
Read_Hotkey_Config( this, true );
break;
default:
DisplayError(this, wxT("WinEDA_GerberFrame::Process_Config internal error"));
}
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
*/
* 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);
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");
/* 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;
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 );
wxString FullFileName;
wxString mask( wxT( "*" ) ),
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;
g_Prj_Config_Filename_ext = wxT( ".cnf"; )
mask += g_Prj_Config_Filename_ext;
/* ecriture de la configuration */
EDA_Appl->WriteProjectConfig(FullFileName, GROUP, ParamCfgList);
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 );
}

View File

@ -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)

View File

@ -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"

View File

@ -5,7 +5,7 @@
COMMON_GLOBL wxString g_BuildVersion
#ifdef EDA_BASE
(wxT("(2007-09-06)"))
(wxT("(2007-09-19)"))
#endif
;

View File

@ -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 );

View File

@ -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,

View File

@ -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 );

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More