Commit c116a9b5 authored by CHARRAS's avatar CHARRAS

first version of programmable hotkeys (work in progress)

parent 88dec9cd
/* XPM */
#ifndef XPMMAIN
extern char * reload_xpm[];
#else
char * reload_xpm[] = {
"16 16 110 2",
" c None",
". c #000000",
"+ c #766B3F",
"@ c #F7F8FA",
"# c #CBDDEB",
"$ c #5D5332",
"% c #EFE5BA",
"& c #7A7A7A",
"* c #E9E9E9",
"= c #EAEAEA",
"- c #F1F1F1",
"; c #BFD5E8",
"> c #DCE5E8",
", c #5A5230",
"' c #EEE5BB",
") c #EED680",
"! c #231F13",
"~ c #2A2516",
"{ c #12100A",
"] c #707070",
"^ c #ABABAB",
"/ c #C0C0C0",
"( c #E0E0E0",
"_ c #8DA9BE",
": c #54697C",
"< c #574F2E",
"[ c #EFE4B6",
"} c #CCB76D",
"| c #96864F",
"1 c #636363",
"2 c #FEFEFE",
"3 c #F9F9F9",
"4 c #84A0B5",
"5 c #4F6475",
"6 c #4B4428",
"7 c #EEE2B2",
"8 c #AF9D5D",
"9 c #919191",
"0 c #819AAE",
"a c #496072",
"b c #494227",
"c c #8F6406",
"d c #D1940C",
"e c #D7A328",
"f c #DEB446",
"g c #A49357",
"h c #CFCFCF",
"i c #302C19",
"j c #765204",
"k c #9E7009",
"l c #D9AA35",
"m c #909090",
"n c #666E75",
"o c #272315",
"p c #986B07",
"q c #737373",
"r c #5C4003",
"s c #B07D0A",
"t c #767676",
"u c #CFE0ED",
"v c #6C7E87",
"w c #1E1A0F",
"x c #896611",
"y c #676D73",
"z c #54595E",
"A c #986B08",
"B c #57626A",
"C c #6B7C85",
"D c #221E11",
"E c #0B0B06",
"F c #576876",
"G c #AE9141",
"H c #847645",
"I c #8CA8BD",
"J c #8E96A0",
"K c #616161",
"L c #C5C5C5",
"M c #CECECE",
"N c #E0C978",
"O c #131D24",
"P c #A0A8AF",
"Q c #183042",
"R c #C9B46B",
"S c #817444",
"T c #0E222D",
"U c #586D80",
"V c #97A5B0",
"W c #86A4B9",
"X c #CDCDCD",
"Y c #AE9C5C",
"Z c #626262",
"` c #112835",
" . c #5A7082",
".. c #9DA9B0",
"+. c #6B7882",
"@. c #839EB2",
"#. c #E6E6E6",
"$. c #213648",
"%. c #666666",
"&. c #8D8D8D",
"*. c #112C3A",
"=. c #9FA9B0",
"-. c #59636D",
";. c #A1A1A1",
">. c #868686",
",. c #6E6E6E",
"'. c #2D3949",
"). c #3E4F5C",
"!. c #80878F",
"~. c #1A3140",
" . . . + . . . . . . . . . . ",
". @ # $ % . & * * * = * - ; ; . ",
". > , ' ) . ! ~ { ] ^ / ( _ : . ",
". < [ ) ) ) ) } | . 1 2 3 4 5 . ",
"6 7 ) ) ) ) ) ) ) 8 . 9 - 0 a . ",
"b c d d d d d e f ) g . h 0 a . ",
". i c d d . . j k l } . m 0 a . ",
". n o p d . q . r s ) . t 0 a . ",
". u v w x . y z . A ) . B 0 a . ",
". u _ C D E F 0 . G H . 0 0 a . ",
". u _ I J K L M . N . O P 0 a . ",
". u _ 4 L L Q . R S . T U V a . ",
". u W 0 L X . Y | . Z ` ...a . ",
". +.@.0 X #.$.. . %.&.*. .=.a . ",
" . -.5 ;./ m m >.,.& '.).!.~.. ",
" . . . . . . . . . . . . . "};
#endif
...@@ -4,6 +4,12 @@ Started 2007-June-11 ...@@ -4,6 +4,12 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2007-aug-21 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ eeschema & pcbnew
First version of programmable hotkeys by editing hotkey configuration files.
some hotkeys are not programmable (Zoom)(work in progress)
2007-Aug-21 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Aug-21 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
......
...@@ -27,10 +27,9 @@ wxString HOSTNAME( wxT( "localhost" ) ); ...@@ -27,10 +27,9 @@ wxString HOSTNAME( wxT( "localhost" ) );
/* variables locales */ /* variables locales */
// buffers for read and write data in socket connections // buffer for read and write data in socket connections
#define IPC_BUF_SIZE 4096 #define IPC_BUF_SIZE 4096
static char client_ipc_buffer[IPC_BUF_SIZE]; static char client_ipc_buffer[IPC_BUF_SIZE];
static char server_ipc_buffer[IPC_BUF_SIZE];
static wxServer* server; static wxServer* server;
...@@ -80,15 +79,15 @@ void WinEDA_DrawFrame::OnSockRequest( wxSocketEvent& evt ) ...@@ -80,15 +79,15 @@ void WinEDA_DrawFrame::OnSockRequest( wxSocketEvent& evt )
switch( evt.GetSocketEvent() ) switch( evt.GetSocketEvent() )
{ {
case wxSOCKET_INPUT: case wxSOCKET_INPUT:
sock->Read( server_ipc_buffer, 1 ); sock->Read( client_ipc_buffer, 1 );
if( sock->LastCount() == 0 ) if( sock->LastCount() == 0 )
break; // No data: Occurs on open connection break; // No data: Occurs on opening connection
sock->Read( server_ipc_buffer + 1, IPC_BUF_SIZE - 2 ); sock->Read( client_ipc_buffer + 1, IPC_BUF_SIZE - 2 );
len = 1 + sock->LastCount(); len = 1 + sock->LastCount();
server_ipc_buffer[len] = 0; client_ipc_buffer[len] = 0;
if( RemoteFct ) if( RemoteFct )
RemoteFct( server_ipc_buffer ); RemoteFct( client_ipc_buffer );
break; break;
case wxSOCKET_LOST: case wxSOCKET_LOST:
......
...@@ -6,7 +6,9 @@ ...@@ -6,7 +6,9 @@
*/ */
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "wxstruct.h"
#include "hotkeys_basic.h" #include "hotkeys_basic.h"
#include "macros.h"
/* Class to handle hotkey commnands. hotkeys have a default value /* 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 (for the future..) the real key code changed by user(from a key code list file, TODO)
...@@ -19,6 +21,100 @@ Ki_HotkeyInfo::Ki_HotkeyInfo(const wxChar * infomsg, int idcommand, int keycode) ...@@ -19,6 +21,100 @@ Ki_HotkeyInfo::Ki_HotkeyInfo(const wxChar * infomsg, int idcommand, int keycode)
m_Idcommand = idcommand; // internal id for the corresponding command (see hotkey_id_commnand list) m_Idcommand = idcommand; // internal id for the corresponding command (see hotkey_id_commnand list)
} }
/* class to handle the printable name and the keycode
*/
struct hotkey_name_descr {
wxChar * m_Name;
int m_KeyCode;
};
struct hotkey_name_descr s_Notkey_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("Backspace"), WXK_BACK},
{wxT("Insert"), WXK_INSERT},
{wxT("End"), WXK_END},
{wxT("Page Up"), WXK_PAGEUP},
{wxT("Page Down"), WXK_PAGEDOWN},
{wxT("+"), WXK_ADD},
{wxT("-"), WXK_SUBTRACT},
{wxT("space"), ' '},
{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
};
/****************************************************/ /****************************************************/
wxString ReturnKeyNameFromKeyCode(int keycode) wxString ReturnKeyNameFromKeyCode(int keycode)
/****************************************************/ /****************************************************/
...@@ -30,81 +126,54 @@ wxString ReturnKeyNameFromKeyCode(int keycode) ...@@ -30,81 +126,54 @@ wxString ReturnKeyNameFromKeyCode(int keycode)
*/ */
{ {
wxString keyname, modifier, fullkeyname; wxString keyname, modifier, fullkeyname;
int ii;
if ( (keycode & GR_KB_CTRL) != 0 ) modifier << wxT("Ctrl "); if ( (keycode & GR_KB_CTRL) != 0 ) modifier << wxT("Ctrl ");
if ( (keycode & GR_KB_ALT) != 0 ) modifier << wxT("Alt "); if ( (keycode & GR_KB_ALT) != 0 ) modifier << wxT("Alt ");
if ( (keycode & GR_KB_SHIFT) != 0 ) modifier << wxT("Shift "); if ( (keycode & GR_KB_SHIFT) != 0 ) modifier << wxT("Shift ");
switch ( keycode) keycode &= ~(GR_KB_CTRL|GR_KB_ALT|GR_KB_SHIFT);
for ( ii = 0; ; ii++)
{ {
default: if ( s_Notkey_Name_List[ii].m_KeyCode == 0 )
keycode &= ~(GR_KB_CTRL|GR_KB_ALT|GR_KB_SHIFT); {
keyname.Printf(wxT("%c"), keycode); keyname = wxT("<unknown>");
break;
case WXK_ESCAPE:
keyname = wxT("Esc");
break;
case WXK_F1:
case WXK_F2:
case WXK_F3:
case WXK_F4:
case WXK_F5:
case WXK_F6:
case WXK_F7:
case WXK_F8:
case WXK_F9:
case WXK_F10:
case WXK_F11:
case WXK_F12:
keyname.Printf(wxT("F%d"), keycode - WXK_F1 + 1);
break;
case ' ':
keyname = wxT("space");
break; break;
}
case '\t': if ( s_Notkey_Name_List[ii].m_KeyCode == keycode)
keyname = wxT("Tab"); {
break; keyname = s_Notkey_Name_List[ii].m_Name;
case WXK_DELETE:
keyname = wxT("Delete");
break;
case WXK_BACK:
keyname = wxT("Backspace");
break; break;
}
}
fullkeyname = modifier + keyname;
return fullkeyname;
}
case WXK_INSERT: /************************************************************/
keyname = wxT("Insert"); static int ReturnKeyCodeFromKeyName(const wxString & keyname)
break; /************************************************************/
/*
* return the key code from its key name
* Only some wxWidgets key values are handled for function key
* @param keyname = wxString key name to find in s_Notkey_Name_List[]
* @return the key code
*/
{
int ii, keycode = 0;
case WXK_END: for ( ii = 0; ; ii++)
keyname = wxT("End"); {
break; if ( s_Notkey_Name_List[ii].m_KeyCode == 0 ) break;
if ( s_Notkey_Name_List[ii].m_Name == keyname)
case WXK_PAGEUP: {
keyname = wxT("Page Up"); keycode = s_Notkey_Name_List[ii].m_KeyCode;
break;
case WXK_PAGEDOWN:
keyname = wxT("Page Down");
break;
case WXK_ADD:
keyname = wxT("+");
break;
case WXK_SUBTRACT:
keyname = wxT("-");
break; break;
} }
}
fullkeyname = modifier + keyname; return keycode;
return fullkeyname;
} }
/****************************************************************************/ /****************************************************************************/
...@@ -123,7 +192,6 @@ wxString keyname; ...@@ -123,7 +192,6 @@ wxString keyname;
for ( ; * List != NULL; List++ ) for ( ; * List != NULL; List++ )
{ {
Ki_HotkeyInfo * hk_decr = * List; Ki_HotkeyInfo * hk_decr = * List;
if ( hk_decr->m_InfoMsg.IsEmpty() ) break;
msg += _("key "); msg += _("key ");
keyname = ReturnKeyNameFromKeyCode(hk_decr->m_KeyCode); keyname = ReturnKeyNameFromKeyCode(hk_decr->m_KeyCode);
msg += keyname + wxT(": ") + hk_decr->m_InfoMsg + wxT("\n"); msg += keyname + wxT(": ") + hk_decr->m_InfoMsg + wxT("\n");
...@@ -150,3 +218,177 @@ int GetCommandCodeFromHotkey(int key, Ki_HotkeyInfo ** List) ...@@ -150,3 +218,177 @@ int GetCommandCodeFromHotkey(int key, Ki_HotkeyInfo ** List)
return 0; return 0;
} }
/*************************************************************************/
int WinEDA_BasicFrame::WriteHotkeyConfigFile(const wxString & Filename,
Ki_HotkeyInfo ** List, bool verbose)
/*************************************************************************/
/*
* Create a configuration file (*.key) from the current hotkey list
* @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
*
*/
{
wxString FullFilename = Filename;
FILE * cfgfile;
wxString msg;
if ( FullFilename.IsEmpty() || verbose)
{
wxString Mask, Path, Ext;
Ext = DEFAULT_HOTKEY_FILENAME_EXT;
Mask = wxT("*") + Ext;
Path = DEFAULT_HOTKEY_FILENAME_PATH;
FullFilename = EDA_FileSelector( _("Hotkey configuration file:"),
Path, /* Chemin par defaut */
FullFilename, /* nom fichier par defaut */
Ext, /* extension par defaut */
Mask, /* Masque d'affichage */
this,
wxFD_SAVE,
TRUE
);
}
if ( FullFilename.IsEmpty() ) return 0;
cfgfile = wxFopen(FullFilename, wxT("wt"));
if ( cfgfile == NULL )
{
if ( verbose )
{
msg = _("Unable to create ") + FullFilename;
DisplayError(this, msg);
}
return 0;
}
wxString keyname, infokey;
msg = wxT("$hotkey list\n");
fprintf(cfgfile, CONV_TO_UTF8(msg));
/* print the allowed keys, for info
*/
msg = wxT("# "); msg += _("Allowed keys:\n");
fprintf(cfgfile, CONV_TO_UTF8(msg));
msg.Empty();
for ( int ii = 0; ; ii ++ )
{
if ( s_Notkey_Name_List[ii].m_KeyCode == 0 ) break;;
if ( msg.IsEmpty() ) msg = wxT("# ");
else msg += wxT(", ");
msg += s_Notkey_Name_List[ii].m_Name;
if ( msg.Len() > 60 )
{
msg += wxT("\n");
fprintf(cfgfile, CONV_TO_UTF8(msg));
msg.Empty();
}
}
/* print the last line */
if ( ! msg.IsEmpty() ) msg += wxT("\n");
msg += wxT("#\n#\n");
fprintf(cfgfile, CONV_TO_UTF8(msg));
/* Print the current list */
for ( ; * List != NULL; List++ )
{
Ki_HotkeyInfo * hk_decr = * List;
msg = wxT("shortcut ");
keyname = ReturnKeyNameFromKeyCode(hk_decr->m_KeyCode);
AddDelimiterString( keyname );
infokey = hk_decr->m_InfoMsg;
AddDelimiterString( infokey );
msg += keyname + wxT(": ") + infokey + wxT("\n");
fprintf(cfgfile, CONV_TO_UTF8(msg));
}
msg = wxT("$Endlist\n");
fprintf(cfgfile, CONV_TO_UTF8(msg));
fclose(cfgfile);
return 1;
}
/********************************************************************************************/
int WinEDA_BasicFrame::ReadHotkeyConfigFile(const wxString & Filename,
Ki_HotkeyInfo ** CurrentHotkeyList, bool verbose)
/********************************************************************************************/
/*
* Read a configuration file (<file>.key) and fill the current hotkey list with hotkeys
* @param Filename = default full file name to create. If void, A filename will be asked
* @param CurrentHotkeyList = current hotkey list to initialise.
* the input format is: shortcut "key" "function"
* lines starting by # are ignored (comments)
*
*/
{
wxString FullFilename = Filename;
FILE * cfgfile;
wxString msg;
if ( FullFilename.IsEmpty() || verbose )
{
wxString Mask, Path, Ext;
Ext = DEFAULT_HOTKEY_FILENAME_EXT;
Mask = wxT("*") + Ext;
Path = DEFAULT_HOTKEY_FILENAME_PATH;
FullFilename = EDA_FileSelector( _("Hotkey configuration file:"),
Path, /* Chemin par defaut */
FullFilename, /* nom fichier par defaut */
Ext, /* extension par defaut */
Mask, /* Masque d'affichage */
this,
wxFD_OPEN,
TRUE
);
if ( FullFilename.IsEmpty() ) return 0;
}
cfgfile = wxFopen(FullFilename, wxT("rt"));
if ( cfgfile == NULL )
{
if ( verbose )
{
msg = _("Unable to read ") + FullFilename;
DisplayError(this, msg);
}
return 0;
}
wxString keyname;
char Line[1024];
int LineNum = 0;
/* Read the file */
while( GetLine( cfgfile, Line, &LineNum ) != NULL )
{
char * line_type, * keyname, *fctname;
line_type = strtok(Line, " \t\n\r");
msg = CONV_FROM_UTF8(line_type);
if( msg != wxT("shortcut") ) continue;
if( msg == wxT("$Endlist") ) break;
/* Get the key name */
strtok(NULL, "\"\n\r");
keyname = strtok(NULL, "\"\n\r");
strtok(NULL, "\"\n\r");
/* Get the command name */
fctname = strtok(NULL, "\"\n\r");
msg = CONV_FROM_UTF8(fctname);
/* search the hotkey in current hotkey list */
for (Ki_HotkeyInfo ** List = CurrentHotkeyList; * List != NULL; List++ )
{
Ki_HotkeyInfo * hk_decr = * List;
if (hk_decr->m_InfoMsg == msg )
{
msg = CONV_FROM_UTF8(keyname);
int code = ReturnKeyCodeFromKeyName(msg);
if ( code ) hk_decr->m_KeyCode = code;
break;
}
}
}
fclose(cfgfile);
return 1;
}
...@@ -333,10 +333,6 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ...@@ -333,10 +333,6 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels
curpos = m_CurrentScreen->m_Curseur; curpos = m_CurrentScreen->m_Curseur;
break; break;
case ' ': // Remise a zero coord relatives
m_CurrentScreen->m_O_Curseur = m_CurrentScreen->m_Curseur;
break;
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */ case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
case WXK_UP: case WXK_UP:
MousePositionInPixels.y -= delta.y; MousePositionInPixels.y -= delta.y;
...@@ -391,8 +387,6 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ...@@ -391,8 +387,6 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels
} }
} }
Affiche_Status_Box(); /* Affichage des coord curseur */
if( hotkey ) if( hotkey )
{ {
if( m_CurrentScreen->GetCurItem() if( m_CurrentScreen->GetCurItem()
...@@ -401,4 +395,7 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ...@@ -401,4 +395,7 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels
else else
OnHotKey( DC, hotkey, NULL ); OnHotKey( DC, hotkey, NULL );
} }
Affiche_Status_Box(); /* Affichage des coord curseur */
} }
...@@ -10,9 +10,13 @@ ...@@ -10,9 +10,13 @@
#include "protos.h" #include "protos.h"
#include "eeconfig.h" #include "eeconfig.h"
#include "worksheet.h" #include "worksheet.h"
#include "hotkeys_basic.h"
#include "id.h" #include "id.h"
extern Ki_HotkeyInfo *s_Schematic_Hotkey_List[];
extern Ki_HotkeyInfo *s_LibEdit_Hotkey_List[];
/* Variables locales */ /* Variables locales */
...@@ -22,7 +26,8 @@ void WinEDA_SchematicFrame::Process_Config(wxCommandEvent& event) ...@@ -22,7 +26,8 @@ void WinEDA_SchematicFrame::Process_Config(wxCommandEvent& event)
{ {
int id = event.GetId(); int id = event.GetId();
wxPoint pos; wxPoint pos;
wxString FullFileName;
wxGetMousePosition(&pos.x, &pos.y); wxGetMousePosition(&pos.x, &pos.y);
pos.y += 5; pos.y += 5;
...@@ -49,7 +54,7 @@ wxPoint pos; ...@@ -49,7 +54,7 @@ wxPoint pos;
case ID_CONFIG_READ: case ID_CONFIG_READ:
{ {
wxString mask( wxT("*") ); mask += g_Prj_Config_Filename_ext; wxString mask( wxT("*") ); mask += g_Prj_Config_Filename_ext;
wxString FullFileName = ScreenSch->m_FileName; FullFileName = ScreenSch->m_FileName;
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext ); ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
FullFileName = EDA_FileSelector(_("Read config file"), FullFileName = EDA_FileSelector(_("Read config file"),
...@@ -71,12 +76,45 @@ wxPoint pos; ...@@ -71,12 +76,45 @@ wxPoint pos;
} }
break; break;
case ID_PREFERENCES_CREATE_CONFIG_HOTKEYS:
FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName += wxT("eeschema");
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
WriteHotkeyConfigFile(FullFileName, s_Schematic_Hotkey_List, true);
FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName += wxT("libedit");
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
WriteHotkeyConfigFile(FullFileName, s_LibEdit_Hotkey_List, true);
break;
case ID_PREFERENCES_READ_CONFIG_HOTKEYS:
Read_Hotkey_Config( this, true);
break;
default: default:
DisplayError(this, wxT("WinEDA_SchematicFrame::Process_Config internal error") ); DisplayError(this, wxT("WinEDA_SchematicFrame::Process_Config internal error") );
} }
} }
/***************************************************************/
bool Read_Hotkey_Config( WinEDA_DrawFrame * frame, bool verbose )
/***************************************************************/
/*
* Read the hotkey files config for eeschema and libedit
*/
{
wxString FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName += wxT("eeschema");
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
frame->ReadHotkeyConfigFile(FullFileName, s_Schematic_Hotkey_List, verbose);
FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName += wxT("libedit");
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
frame->ReadHotkeyConfigFile(FullFileName, s_LibEdit_Hotkey_List, verbose);
}
/***********************************************************************/ /***********************************************************************/
bool Read_Config( const wxString & CfgFileName, bool ForceRereadConfig ) bool Read_Config( const wxString & CfgFileName, bool ForceRereadConfig )
/***********************************************************************/ /***********************************************************************/
......
...@@ -80,6 +80,7 @@ wxString FFileName; ...@@ -80,6 +80,7 @@ wxString FFileName;
} }
SchematicFrame->Zoom_Automatique(TRUE); SchematicFrame->Zoom_Automatique(TRUE);
Read_Hotkey_Config(SchematicFrame, false);
/* Load file specified in the command line. */ /* Load file specified in the command line. */
if( ! FFileName.IsEmpty() ) if( ! FFileName.IsEmpty() )
......
...@@ -60,7 +60,7 @@ static Ki_HotkeyInfo HkZoomIn(wxT("Zoom In"), HK_ZOOM_IN, WXK_F1); ...@@ -60,7 +60,7 @@ 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 HkHelp(wxT("Help: this message"), HK_HELP, '?');
// List of hotkey descriptors for schematic // List of hotkey descriptors for schematic
static Ki_HotkeyInfo *s_Schematic_Hotkey_List[] = { Ki_HotkeyInfo *s_Schematic_Hotkey_List[] = {
&HkHelp, &HkHelp,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter, &HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
&HkNextSearch, &HkResetLocalCoord, &HkNextSearch, &HkResetLocalCoord,
...@@ -71,12 +71,11 @@ static Ki_HotkeyInfo *s_Schematic_Hotkey_List[] = { ...@@ -71,12 +71,11 @@ static Ki_HotkeyInfo *s_Schematic_Hotkey_List[] = {
NULL NULL
}; };
// Library editor: // Library editor:
static Ki_HotkeyInfo HkInsertPin(wxT("Repeat Pin"), HK_REPEAT_LAST, WXK_INSERT); static Ki_HotkeyInfo HkInsertPin(wxT("Repeat Pin"), HK_REPEAT_LAST, WXK_INSERT);
// List of hotkey descriptors for libray editor // List of hotkey descriptors for libray editor
static Ki_HotkeyInfo *s_LibEdit_Hotkey_List[] = Ki_HotkeyInfo *s_LibEdit_Hotkey_List[] =
{ {
&HkHelp, &HkHelp,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter, &HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
...@@ -120,11 +119,14 @@ wxPoint MousePos = m_CurrentScreen->m_MousePosition; ...@@ -120,11 +119,14 @@ wxPoint MousePos = m_CurrentScreen->m_MousePosition;
DisplayHotkeyList(this, s_Schematic_Hotkey_List); DisplayHotkeyList(this, s_Schematic_Hotkey_List);
break; break;
case HK_RESET_LOCAL_COORD: /* Reset the relative coord */
m_CurrentScreen->m_O_Curseur = m_CurrentScreen->m_Curseur;
break;
case HK_ZOOM_IN: case HK_ZOOM_IN:
case HK_ZOOM_OUT: case HK_ZOOM_OUT:
case HK_ZOOM_REDRAW: case HK_ZOOM_REDRAW:
case HK_ZOOM_CENTER: case HK_ZOOM_CENTER:
case HK_RESET_LOCAL_COORD:
break; break;
case HK_MOVEBLOCK_TO_DRAGBLOCK: // Switch to drag mode, when block moving case HK_MOVEBLOCK_TO_DRAGBLOCK: // Switch to drag mode, when block moving
......
...@@ -146,6 +146,16 @@ wxMenuBar * menuBar = GetMenuBar(); ...@@ -146,6 +146,16 @@ wxMenuBar * menuBar = GetMenuBar();
item->SetBitmap(read_setup_xpm); item->SetBitmap(read_setup_xpm);
configmenu->Append(item); 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);
// Menu Help: // Menu Help:
wxMenu *helpMenu = new wxMenu; wxMenu *helpMenu = new wxMenu;
item = new wxMenuItem(helpMenu , ID_GENERAL_HELP, item = new wxMenuItem(helpMenu , ID_GENERAL_HELP,
......
...@@ -227,6 +227,7 @@ int CountCmpNumber(void); ...@@ -227,6 +227,7 @@ int CountCmpNumber(void);
/* EECONFIG.CPP */ /* EECONFIG.CPP */
/***************/ /***************/
bool Read_Config( const wxString & CfgFileName, bool ForceRereadConfig ); bool Read_Config( const wxString & CfgFileName, bool ForceRereadConfig );
bool Read_Hotkey_Config( WinEDA_DrawFrame * frame, bool verbose );
/**************/ /**************/
......
...@@ -61,6 +61,8 @@ BEGIN_EVENT_TABLE(WinEDA_SchematicFrame, wxFrame) ...@@ -61,6 +61,8 @@ BEGIN_EVENT_TABLE(WinEDA_SchematicFrame, wxFrame)
EVT_MENU(ID_CONFIG_SAVE, 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_COLORS_SETUP, WinEDA_SchematicFrame::Process_Config)
EVT_MENU(ID_OPTIONS_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_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, EVT_MENU_RANGE(ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
WinEDA_DrawFrame::SetLanguage) WinEDA_DrawFrame::SetLanguage)
......
...@@ -124,11 +124,11 @@ wxString path = wxPathOnly(FullFileName); ...@@ -124,11 +124,11 @@ wxString path = wxPathOnly(FullFileName);
if( filename == wxEmptyString) if( filename == wxEmptyString)
{ {
wxString mask = wxT("*") + g_PhotoFilenameExt; wxString mask = wxT("*") + g_PhotoFilenameExt;
mask += wxT(";*.gbr;*.lgr;*.ger"); mask += wxT(";*.gbr;*.gbx;*.lgr;*.ger");
filename = EDA_FileSelector(_("Gerber files:"), filename = EDA_FileSelector(_("Gerber files:"),
path, /* Chemin par defaut */ path, /* Chemin par defaut */
wxEmptyString, /* nom fichier par defaut */ wxEmptyString, /* nom fichier par defaut */
g_PhotoFilenameExt, /* extension par defaut */ g_PhotoFilenameExt, /* extension par defaut */
mask, /* Masque d'affichage */ mask, /* Masque d'affichage */
this, this,
0, 0,
......
...@@ -84,7 +84,7 @@ enum Gerb_GCommand ...@@ -84,7 +84,7 @@ enum Gerb_GCommand
}; };
#define MAX_TOOLS 512 #define MAX_TOOLS 2048
#define FIRST_DCODE 10 #define FIRST_DCODE 10
enum Gerb_Analyse_Cmd enum Gerb_Analyse_Cmd
......
...@@ -13,18 +13,6 @@ ...@@ -13,18 +13,6 @@
/* Variables locales : */ /* Variables locales : */
/* Routines Locales */ /* Routines Locales */
/****************************/
/* int GetLayerNumber(void) */
/****************************/
/* retourne le nombre de couches a tracer
*/
int GetLayerNumber(void)
{
int ii = 0;
//TO REDO
return ii;
}
/*******************************************************************************/ /*******************************************************************************/
void Print_PcbItems(BOARD * Pcb, wxDC *DC, int drawmode, int printmasklayer) void Print_PcbItems(BOARD * Pcb, wxDC *DC, int drawmode, int printmasklayer)
......
...@@ -23,7 +23,6 @@ void Plume(int state); ...@@ -23,7 +23,6 @@ void Plume(int state);
/****************/ /****************/
/* lay2plot.cpp */ /* lay2plot.cpp */
int GetLayerNumber(void);
void Print_PcbItems(BOARD * Pcb, wxDC *DC, int drawmode, int printmasklayer); void Print_PcbItems(BOARD * Pcb, wxDC *DC, int drawmode, int printmasklayer);
/*****************/ /*****************/
...@@ -116,7 +115,7 @@ void PlotArcPS(int x, int y, int StAngle, int EndAngle, int rayon, int width); ...@@ -116,7 +115,7 @@ void PlotArcPS(int x, int y, int StAngle, int EndAngle, int rayon, int width);
/***************/ /***************/
/* trpiste.cpp */ /* trpiste.cpp */
/***************/ /***************/
void Trace_Pistes(WinEDA_DrawPanel * panel, wxDC * DC, BOARD * Pcb, int drawmode); void Draw_Track_Buffer(WinEDA_DrawPanel * panel, wxDC * DC, BOARD * Pcb, int drawmode, int printmasklayer);
void Trace_Segment(WinEDA_DrawPanel * panel, wxDC * DC, TRACK* pt_piste, int draw_mode); void Trace_Segment(WinEDA_DrawPanel * panel, wxDC * DC, TRACK* pt_piste, int draw_mode);
void Trace_DrawSegmentPcb(WinEDA_DrawPanel * panel, wxDC * DC, void Trace_DrawSegmentPcb(WinEDA_DrawPanel * panel, wxDC * DC,
DRAWSEGMENT * PtDrawSegment, int draw_mode); DRAWSEGMENT * PtDrawSegment, int draw_mode);
......
...@@ -44,7 +44,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl ...@@ -44,7 +44,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
DisplayOpt.DisplayDrawItems = FILLED; DisplayOpt.DisplayDrawItems = FILLED;
DisplayOpt.DisplayZones = 1; DisplayOpt.DisplayZones = 1;
( (WinEDA_GerberFrame*) m_Parent )->Trace_Gerber( DC, GR_COPY ); ( (WinEDA_GerberFrame*) m_Parent )->Trace_Gerber( DC, GR_COPY, printmasklayer );
if( Print_Sheet_Ref ) if( Print_Sheet_Ref )
m_Parent->TraceWorkSheet( DC, GetScreen(), 0 ); m_Parent->TraceWorkSheet( DC, GetScreen(), 0 );
...@@ -72,7 +72,7 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -72,7 +72,7 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
DrawPanel->DrawBackGround( DC ); DrawPanel->DrawBackGround( DC );
Trace_Gerber( DC, GR_OR ); Trace_Gerber( DC, GR_OR, -1 );
TraceWorkSheet( DC, screen, 0 ); TraceWorkSheet( DC, screen, 0 );
Affiche_Status_Box(); Affiche_Status_Box();
...@@ -83,16 +83,21 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -83,16 +83,21 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
} }
/********************************************************/ /***********************************************************************************/
void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int mode ) void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklayer )
/********************************************************/ /***********************************************************************************/
/* Trace l'ensemble des elements du PCB sur l'ecran actif*/ /*
* Trace l'ensemble des elements du PCB sur l'ecran actif
* @param DC = device context to draw
* @param draw_mode = draw mode for the device context (GR_COPY, GR_OR, GR_XOR ..)
* @param printmasklayer = mask for allowed layer (=-1 to draw all layers)
*/
{ {
if( !m_Pcb ) if( !m_Pcb )
return; return;
// Draw tracks and flashes // Draw tracks and flashes
Trace_Pistes( DrawPanel, DC, m_Pcb, mode ); Draw_Track_Buffer( DrawPanel, DC, m_Pcb, draw_mode, printmasklayer );
// Draw filled polygons // Draw filled polygons
#define NBMAX 2000 #define NBMAX 2000
...@@ -104,6 +109,9 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int mode ) ...@@ -104,6 +109,9 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int mode )
track = m_Pcb->m_Zone; track = m_Pcb->m_Zone;
for( ; track != NULL; track = track->Next() ) for( ; track != NULL; track = track->Next() )
{ {
if ( printmasklayer != -1 )
if ( (track->ReturnMaskLayer() & printmasklayer) == 0 ) continue;
if( track->m_NetCode == 0 ) // StartPoint if( track->m_NetCode == 0 ) // StartPoint
{ {
if( nbpoints ) if( nbpoints )
......
...@@ -16,12 +16,18 @@ ...@@ -16,12 +16,18 @@
/* variables locales : */ /* variables locales : */
/********************************************************************************/ /***************************************************************************************************/
void Trace_Pistes(WinEDA_DrawPanel * panel, wxDC * DC, BOARD * Pcb, int drawmode) void Draw_Track_Buffer(WinEDA_DrawPanel * panel, wxDC * DC, BOARD * Pcb, int draw_mode, int printmasklayer)
/********************************************************************************/ /***************************************************************************************************/
/* Routine de trace des pistes et zones */ /* Function to draw the tracks (i.e Sports or lines) in gerbview
Polygons are not handled here (there are in Pcb->m_Zone)
* @param DC = device context to draw
* @param Pcb = Board to draw (only Pcb->m_Track is used)
* @param draw_mode = draw mode for the device context (GR_COPY, GR_OR, GR_XOR ..)
* @param printmasklayer = mask for allowed layer (=-1 to draw all layers)
*/
{ {
TRACK * pt_piste; TRACK * Track;
int layer = ((PCB_SCREEN*)panel->GetScreen())->m_Active_Layer; int layer = ((PCB_SCREEN*)panel->GetScreen())->m_Active_Layer;
GERBER_Descr * gerber_layer = g_GERBER_Descr_List[layer]; GERBER_Descr * gerber_layer = g_GERBER_Descr_List[layer];
int dcode_hightlight = 0; int dcode_hightlight = 0;
...@@ -29,13 +35,16 @@ int dcode_hightlight = 0; ...@@ -29,13 +35,16 @@ int dcode_hightlight = 0;
if ( gerber_layer ) if ( gerber_layer )
dcode_hightlight = gerber_layer->m_Selected_Tool; dcode_hightlight = gerber_layer->m_Selected_Tool;
pt_piste = Pcb->m_Track; Track = Pcb->m_Track;
for ( ; pt_piste != NULL ; pt_piste = (TRACK*) pt_piste->Pnext ) for ( ; Track != NULL ; Track = (TRACK*) Track->Pnext )
{ {
if ( (dcode_hightlight == pt_piste->m_NetCode) && if ( printmasklayer != -1 )
(pt_piste->m_Layer == layer) ) if ( (Track->ReturnMaskLayer() & printmasklayer) == 0 ) continue;
Trace_Segment(panel, DC, pt_piste, drawmode | GR_SURBRILL);
else Trace_Segment(panel, DC, pt_piste, drawmode ); if ( (dcode_hightlight == Track->m_NetCode) &&
(Track->m_Layer == layer) )
Trace_Segment(panel, DC, Track, draw_mode | GR_SURBRILL);
else Trace_Segment(panel, DC, Track, draw_mode );
} }
} }
...@@ -45,7 +54,7 @@ void Trace_Segment(WinEDA_DrawPanel * panel, wxDC * DC, TRACK* track, int draw_m ...@@ -45,7 +54,7 @@ void Trace_Segment(WinEDA_DrawPanel * panel, wxDC * DC, TRACK* track, int draw_m
/***********************************************************************************/ /***********************************************************************************/
/* routine de trace de 1 segment de piste. /* routine de trace de 1 segment de piste.
Parametres : Parametres :
pt_piste = adresse de la description de la piste en buflib track = adresse de la description de la piste en buflib
draw_mode = mode ( GR_XOR, GR_OR..) draw_mode = mode ( GR_XOR, GR_OR..)
*/ */
{ {
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "../bitmaps/Cancel.xpm" #include "../bitmaps/Cancel.xpm"
#include "../bitmaps/cancel_tool.xpm" #include "../bitmaps/cancel_tool.xpm"
#include "../bitmaps/Apply.xpm" #include "../bitmaps/Apply.xpm"
#include "../bitmaps/reload.xpm"
#include "../bitmaps/icon_txt.xpm" #include "../bitmaps/icon_txt.xpm"
#include "../bitmaps/new_txt.xpm" #include "../bitmaps/new_txt.xpm"
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
COMMON_GLOBL wxString g_BuildVersion COMMON_GLOBL wxString g_BuildVersion
#ifdef EDA_BASE #ifdef EDA_BASE
(wxT("(2007-08-19)")) (wxT("(2007-08-21)"))
#endif #endif
; ;
......
...@@ -8,6 +8,16 @@ ...@@ -8,6 +8,16 @@
#ifndef HOTKEYS_BASIC_H #ifndef HOTKEYS_BASIC_H
#define HOTKEYS_BASIC_H #define HOTKEYS_BASIC_H
#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
/* Class to handle hotkey commnands. hotkeys have a default value /* 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 (for the future..) the real key code changed by user(from a key code list file, TODO)
*/ */
......
...@@ -64,6 +64,12 @@ enum main_id { ...@@ -64,6 +64,12 @@ enum main_id {
ID_CONFIG_REQ, ID_CONFIG_REQ,
ID_CONFIG_SAVE, ID_CONFIG_SAVE,
ID_CONFIG_READ, ID_CONFIG_READ,
ID_PREFERENCES_CREATE_CONFIG_HOTKEYS,
ID_PREFERENCES_READ_CONFIG_HOTKEYS,
ID_PREFERENCES_UNUSED0,
ID_PREFERENCES_UNUSED1,
ID_PREFERENCES_UNUSED2,
ID_PREFERENCES_UNUSED3,
ID_GEN_PRINT, ID_GEN_PRINT,
ID_GEN_PLOT, ID_GEN_PLOT,
...@@ -93,11 +99,11 @@ enum main_id { ...@@ -93,11 +99,11 @@ enum main_id {
ID_PREFERENCES_FONT_INFOSCREEN, ID_PREFERENCES_FONT_INFOSCREEN,
ID_PREFERENCES_FONT_DIALOG, ID_PREFERENCES_FONT_DIALOG,
ID_PREFERENCES_FONT_STATUS, ID_PREFERENCES_FONT_STATUS,
ID_PREFERENCES_UNUSED3, ID_PREFERENCES_FONT_UNUSED3,
ID_PREFERENCES_UNUSED4, ID_PREFERENCES_FONT_UNUSED4,
ID_PREFERENCES_UNUSED5, ID_PREFERENCES_FONT_UNUSED5,
ID_PREFERENCES_UNUSED6, ID_PREFERENCES_FONT_UNUSED6,
ID_PREFERENCES_UNUSED7, ID_PREFERENCES_FONT_UNUSED7,
ID_PREFERENCES_FONT_END, ID_PREFERENCES_FONT_END,
// Find id menu // Find id menu
......
...@@ -65,7 +65,7 @@ class WinEDAChoiceBox; ...@@ -65,7 +65,7 @@ class WinEDAChoiceBox;
#define WinEDA_Menu wxMenu #define WinEDA_Menu wxMenu
#define WinEDA_MenuItem wxMenuItem #define WinEDA_MenuItem wxMenuItem
// Utilises mais non definies ici : // Utilisees mais non definies ici :
class LibraryStruct; class LibraryStruct;
class EDA_LibComponentStruct; class EDA_LibComponentStruct;
class LibEDA_BaseStruct; class LibEDA_BaseStruct;
...@@ -97,6 +97,7 @@ class EDGE_MODULE; ...@@ -97,6 +97,7 @@ class EDGE_MODULE;
class WinEDA3D_DrawFrame; class WinEDA3D_DrawFrame;
class PARAM_CFG_BASE; class PARAM_CFG_BASE;
class Ki_PageDescr; class Ki_PageDescr;
class Ki_HotkeyInfo;
enum id_librarytype { enum id_librarytype {
...@@ -176,7 +177,9 @@ public: ...@@ -176,7 +177,9 @@ public:
void PrintMsg( const wxString& text ); void PrintMsg( const wxString& text );
void GetSettings( void ); void GetSettings( void );
void SaveSettings( void ); void SaveSettings( void );
void SetLanguage( wxCommandEvent& event ); int WriteHotkeyConfigFile(const wxString & Filename, Ki_HotkeyInfo ** List, bool verbose);
int ReadHotkeyConfigFile(const wxString & Filename, Ki_HotkeyInfo ** List, bool verbose);
void SetLanguage( wxCommandEvent& event );
void ProcessFontPreferences( int id ); void ProcessFontPreferences( int id );
wxString GetLastProject( int rang ); wxString GetLastProject( int rang );
...@@ -802,7 +805,7 @@ public: ...@@ -802,7 +805,7 @@ public:
void Liste_D_Codes( wxDC* DC ); void Liste_D_Codes( wxDC* DC );
/* Fonctions specifiques */ /* Fonctions specifiques */
void Trace_Gerber( wxDC* DC, int mode ); void Trace_Gerber( wxDC* DC, int draw_mode, int printmasklayer );
// Gestion des textes sur pcb // Gestion des textes sur pcb
void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, 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.
...@@ -62,7 +62,7 @@ static Ki_HotkeyInfo HkTrackDisplayMode(wxT("Track Display Mode"), HK_SWITCH_TRA ...@@ -62,7 +62,7 @@ static Ki_HotkeyInfo HkTrackDisplayMode(wxT("Track Display Mode"), HK_SWITCH_TRA
// List of hotkey descriptors for pcbnew // List of hotkey descriptors for pcbnew
static Ki_HotkeyInfo *s_board_edit_Hotkey_List[] = { Ki_HotkeyInfo *s_board_edit_Hotkey_List[] = {
&HkHelp, &HkHelp,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter, &HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
&HkResetLocalCoord, &HkSwitchUnits, &HkTrackDisplayMode, &HkResetLocalCoord, &HkSwitchUnits, &HkTrackDisplayMode,
...@@ -75,7 +75,7 @@ static Ki_HotkeyInfo *s_board_edit_Hotkey_List[] = { ...@@ -75,7 +75,7 @@ static Ki_HotkeyInfo *s_board_edit_Hotkey_List[] = {
NULL NULL
}; };
static Ki_HotkeyInfo *s_module_edit_Hotkey_List[] = { Ki_HotkeyInfo *s_module_edit_Hotkey_List[] = {
&HkHelp, &HkHelp,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter, &HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
&HkSwitchUnits, &HkResetLocalCoord, &HkSwitchUnits, &HkResetLocalCoord,
......
...@@ -19,18 +19,6 @@ static void Plot_Module(WinEDA_DrawPanel * panel, wxDC * DC, MODULE * Module, ...@@ -19,18 +19,6 @@ static void Plot_Module(WinEDA_DrawPanel * panel, wxDC * DC, MODULE * Module,
int draw_mode, int masklayer); int draw_mode, int masklayer);
/****************************/
int GetLayerNumber(void)
/****************************/
/* Return the number of layers which can be printed
*/
{
int ii = 29;
//TO REDO
return ii;
}
/**********************************************************************************/ /**********************************************************************************/
void WinEDA_DrawPanel::PrintPage(wxDC *DC, bool Print_Sheet_Ref, int printmasklayer) void WinEDA_DrawPanel::PrintPage(wxDC *DC, bool Print_Sheet_Ref, int printmasklayer)
/**********************************************************************************/ /**********************************************************************************/
......
...@@ -182,6 +182,16 @@ wxMenuBar * menuBar = GetMenuBar(); ...@@ -182,6 +182,16 @@ wxMenuBar * menuBar = GetMenuBar();
item->SetBitmap(read_setup_xpm); item->SetBitmap(read_setup_xpm);
configmenu->Append(item); 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);
///////////////////////////// /////////////////////////////
// Ajustage de dimensions: // // Ajustage de dimensions: //
///////////////////////////// /////////////////////////////
......
...@@ -12,9 +12,13 @@ ...@@ -12,9 +12,13 @@
#include "pcbcfg.h" #include "pcbcfg.h"
#include "worksheet.h" #include "worksheet.h"
#include "id.h" #include "id.h"
#include "hotkeys_basic.h"
#include "protos.h" #include "protos.h"
extern Ki_HotkeyInfo *s_board_edit_Hotkey_List[];
extern Ki_HotkeyInfo *s_module_edit_Hotkey_List[];
/* Routines Locales */ /* Routines Locales */
/* Variables locales */ /* Variables locales */
...@@ -27,6 +31,7 @@ void WinEDA_PcbFrame::Process_Config(wxCommandEvent& event) ...@@ -27,6 +31,7 @@ void WinEDA_PcbFrame::Process_Config(wxCommandEvent& event)
int id = event.GetId(); int id = event.GetId();
wxPoint pos; wxPoint pos;
wxClientDC dc(DrawPanel); wxClientDC dc(DrawPanel);
wxString FullFileName;
DrawPanel->PrepareGraphicContext(&dc); DrawPanel->PrepareGraphicContext(&dc);
...@@ -40,10 +45,8 @@ wxClientDC dc(DrawPanel); ...@@ -40,10 +45,8 @@ wxClientDC dc(DrawPanel);
break; break;
case ID_CONFIG_REQ : // Creation de la fenetre de configuration case ID_CONFIG_REQ : // Creation de la fenetre de configuration
{
InstallConfigFrame(pos); InstallConfigFrame(pos);
break; break;
}
case ID_PCB_TRACK_SIZE_SETUP: case ID_PCB_TRACK_SIZE_SETUP:
case ID_PCB_LOOK_SETUP: case ID_PCB_LOOK_SETUP:
...@@ -61,8 +64,7 @@ wxClientDC dc(DrawPanel); ...@@ -61,8 +64,7 @@ wxClientDC dc(DrawPanel);
break; break;
case ID_CONFIG_READ: case ID_CONFIG_READ:
{ FullFileName = GetScreen()->m_FileName.AfterLast('/');
wxString FullFileName = GetScreen()->m_FileName.AfterLast('/');
ChangeFileNameExt(FullFileName, g_Prj_Config_Filename_ext); ChangeFileNameExt(FullFileName, g_Prj_Config_Filename_ext);
FullFileName = EDA_FileSelector(_("Read config file"), FullFileName = EDA_FileSelector(_("Read config file"),
wxPathOnly(GetScreen()->m_FileName),/* Chemin par defaut */ wxPathOnly(GetScreen()->m_FileName),/* Chemin par defaut */
...@@ -81,7 +83,21 @@ wxClientDC dc(DrawPanel); ...@@ -81,7 +83,21 @@ wxClientDC dc(DrawPanel);
DisplayError(this, msg); break; DisplayError(this, msg); break;
} }
Read_Config(FullFileName ); Read_Config(FullFileName );
} break;
case ID_PREFERENCES_CREATE_CONFIG_HOTKEYS:
FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName += wxT("pcbnew");
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
WriteHotkeyConfigFile(FullFileName, s_board_edit_Hotkey_List, true);
FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName += wxT("module_edit");
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
WriteHotkeyConfigFile(FullFileName, s_module_edit_Hotkey_List, true);
break;
case ID_PREFERENCES_READ_CONFIG_HOTKEYS:
Read_Hotkey_Config( this, true);
break; break;
default: default:
...@@ -90,6 +106,25 @@ wxClientDC dc(DrawPanel); ...@@ -90,6 +106,25 @@ wxClientDC dc(DrawPanel);
} }
/***************************************************************/
bool Read_Hotkey_Config( WinEDA_DrawFrame * frame, bool verbose )
/***************************************************************/
/*
* Read the hotkey files config for eeschema and libedit
*/
{
wxString FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName += wxT("pcbnew");
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
frame->ReadHotkeyConfigFile(FullFileName, s_board_edit_Hotkey_List, verbose);
FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName += wxT("module_edit");
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
frame->ReadHotkeyConfigFile(FullFileName, s_module_edit_Hotkey_List, verbose);
}
/**************************************************************************/ /**************************************************************************/
bool Read_Config(const wxString & project_name) bool Read_Config(const wxString & project_name)
/*************************************************************************/ /*************************************************************************/
......
...@@ -69,6 +69,8 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, wxFrame ) ...@@ -69,6 +69,8 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, wxFrame )
EVT_MENU( ID_CONFIG_REQ, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_CONFIG_REQ, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_COLORS_SETUP, 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_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( ID_PCB_TRACK_SIZE_SETUP, 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_DRAWINGS_WIDTHS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_PAD_SETUP, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_PCB_PAD_SETUP, WinEDA_PcbFrame::Process_Config )
......
...@@ -79,6 +79,7 @@ bool WinEDA_App::OnInit( void ) ...@@ -79,6 +79,7 @@ bool WinEDA_App::OnInit( void )
SetTopWindow( m_PcbFrame ); SetTopWindow( m_PcbFrame );
m_PcbFrame->Show( TRUE ); m_PcbFrame->Show( TRUE );
Read_Hotkey_Config(m_PcbFrame, false);
if( CreateServer( m_PcbFrame, KICAD_PCB_PORT_SERVICE_NUMBER ) ) if( CreateServer( m_PcbFrame, KICAD_PCB_PORT_SERVICE_NUMBER ) )
{ {
......
...@@ -17,6 +17,7 @@ LISTE_PAD* CreateSortedPadListByXCoord(BOARD * pcb); ...@@ -17,6 +17,7 @@ LISTE_PAD* CreateSortedPadListByXCoord(BOARD * pcb);
/* PCBCFG.CPP */ /* PCBCFG.CPP */
/**************/ /**************/
bool Read_Config(const wxString & project_name); bool Read_Config(const wxString & project_name);
bool Read_Hotkey_Config( WinEDA_DrawFrame * frame, bool verbose );
/***************/ /***************/
/* TRACEPCB.CPP */ /* TRACEPCB.CPP */
...@@ -400,7 +401,6 @@ MODULE * ListAndSelectModuleName(COMMAND * Cmd); ...@@ -400,7 +401,6 @@ MODULE * ListAndSelectModuleName(COMMAND * Cmd);
/***************/ /***************/
/* LAY2PLOT.CPP */ /* LAY2PLOT.CPP */
/***************/ /***************/
int GetLayerNumber(void); /* retourne le nombre de couches a tracer */
/*****************/ /*****************/
/* SEL_COLOR.CPP */ /* SEL_COLOR.CPP */
......
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