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;
......
This diff is collapsed.
......@@ -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 diff is collapsed.
......@@ -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() )
{
......
This diff is collapsed.
......@@ -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