Commit 542b9441 authored by CHARRAS's avatar CHARRAS

hotkeys handling finished

parent ef3d0491
/* XPM */
static char * editor_xpm[] = {
#ifndef XPMMAIN
extern char *editor_xpm[];
#else
char * editor_xpm[] = {
"16 16 60 1",
" c None",
". c #000000",
......@@ -77,3 +81,4 @@ static char * editor_xpm[] = {
" .@mnnnpprrrs. ",
" .lqqqttssssu. ",
" ........... "};
#endif
......@@ -4,6 +4,11 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2007-sept-19 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ all
* hotkeys handling finished
2007-Sep-14 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
......
......@@ -250,6 +250,7 @@ unsigned ii;
{
m_LanguageId = m_EDA_CommonConfig->Read(wxT("Language"), wxLANGUAGE_DEFAULT);
g_EditorName = m_EDA_CommonConfig->Read(wxT("Editor"));
g_ConfigFileLocationChoice = m_EDA_CommonConfig->Read(HOTKEY_CFG_PATH_OPT, 0L);
}
if ( ! m_EDA_Config ) return;
......
......@@ -10,6 +10,9 @@
#include "wxstruct.h"
#include "hotkeys_basic.h"
#include "macros.h"
#include "bitmaps.h"
#include "id.h"
/* Class to handle hotkey commnands. hotkeys have a default value
* This class allows the real key code changed by user from a key code list file
......@@ -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 */
......@@ -476,7 +479,7 @@ int WinEDA_BasicFrame::ReadHotkeyConfigFile( const wxString&
wxString Mask, Path, Ext;
Ext = DEFAULT_HOTKEY_FILENAME_EXT;
Mask = wxT( "*" ) + Ext;
Path = DEFAULT_HOTKEY_FILENAME_PATH;
Path = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFilename = EDA_FileSelector( _( "Hotkey configuration file:" ),
Path, /* Chemin par defaut */
FullFilename, /* nom fichier par defaut */
......@@ -560,3 +563,80 @@ int WinEDA_BasicFrame::ReadHotkeyConfigFile( const wxString&
fclose( cfgfile );
return 1;
}
/****************************************************/
wxString ReturnHotkeyConfigFilePath( int choice )
/****************************************************/
/* return the hotkey config file path
* @param choice : 0 = home, 1 = kicad/template
*/
{
wxString path;
switch( choice )
{
case 0:
path = DEFAULT_HOTKEY_FILENAME_PATH_IS_HOME;
break;
case 1:
path = DEFAULT_HOTKEY_FILENAME_PATH_IS_KICAD;
break;
default:
break;
}
return path;
}
/***************************************/
void AddHotheyConfigMenu( wxMenu* menu )
/***************************************/
/* add hotkey config options to a menu
* @parm menu : initial menu
*/
{
wxMenuItem* item;
if( menu == NULL )
return;
item = new wxMenuItem( menu, ID_PREFERENCES_CREATE_CONFIG_HOTKEYS,
_( "Create Hotkey config file" ),
_( "Create or Recreate the hotkey config file from current hotkey list" ) );
item->SetBitmap( save_setup_xpm );
menu->Append( item );
item = new wxMenuItem( menu, ID_PREFERENCES_READ_CONFIG_HOTKEYS,
_( "Reread Hotkey config file" ),
_( "Reread the hotkey config file" ) );
item->SetBitmap( reload_xpm );
menu->Append( item );
item = new wxMenuItem( menu, ID_PREFERENCES_EDIT_CONFIG_HOTKEYS,
_( "Edit Hotkey config file" ),
_( "Run the text editor and edit the hotkey config file" ) );
item->SetBitmap( editor_xpm );
menu->Append( item );
wxMenu* submenu_hkcfg = new wxMenu();
item = new wxMenuItem( submenu_hkcfg, ID_PREFERENCES_HOTKEY_PATH_IS_HOME,
_( "home directory" ),
_( "Use home directory to load or store Hotkey config files" ),
wxITEM_CHECK );
submenu_hkcfg->Append( item );
item = new wxMenuItem( submenu_hkcfg, ID_PREFERENCES_HOTKEY_PATH_IS_KICAD,
_( "kicad/template directory" ),
_( "Use kicad/templatedirectory to load or store Hotkey config files" ),
wxITEM_CHECK );
submenu_hkcfg->Append( item );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( menu, submenu_hkcfg,
-1,
_( "Hotkey config location" ),
_( "Hotkey config file location selection (home directory or kicad tree)" ),
right_xpm );
}
......@@ -236,17 +236,17 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
/************************************/
/* Redraw a Texte while moving */
/* Redraw a Text while moving */
/************************************/
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{
EDA_BaseStruct* TextStruct = panel->GetScreen()->GetCurItem();
/* effacement ancienne position */
/* "Undraw" the current text at its old position*/
if( erase )
RedrawOneStruct( panel, DC, TextStruct, g_XorMode );
/* Redessin du texte */
/* redraw the text */
switch( TextStruct->Type() )
{
case DRAW_LABEL_STRUCT_TYPE:
......@@ -266,7 +266,7 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/*************************************************************/
static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
/*************************************************************/
/* Routine de sortie des menus de Texte */
/* Abort function for the command move text */
{
SCH_SCREEN* screen = (SCH_SCREEN*) Panel->m_Parent->m_CurrentScreen;
EDA_BaseStruct* Struct = screen->GetCurItem();
......@@ -275,22 +275,20 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
if( Struct == NULL ) /* Pas de trace en cours */
if( Struct == NULL ) /* no current item */
{
return;
}
/* ici : trace en cours */
/* Effacement du trace en cours et suppression eventuelle de la structure */
/* "Undraw" the text, and delete it if new (i.e. it was beiing just created)*/
RedrawOneStruct( Panel, DC, Struct, g_XorMode );
if( Struct->m_Flags & IS_NEW ) /* Suppression du nouveau texte en cours de placement */
if( Struct->m_Flags & IS_NEW )
{
delete Struct;
screen->SetCurItem( NULL );
}
else /* Remise a jour des anciens parametres du texte */
else /* this was a move command on an "old" text: restore its old settings. */
{
switch( Struct->Type() )
{
......
......@@ -77,7 +77,7 @@ wxString FullFileName;
break;
case ID_PREFERENCES_CREATE_CONFIG_HOTKEYS:
FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
WriteHotkeyConfigFile(FullFileName, s_Eeschema_Hokeys_Descr, true);
......@@ -87,6 +87,33 @@ wxString FullFileName;
Read_Hotkey_Config( this, true);
break;
case ID_PREFERENCES_EDIT_CONFIG_HOTKEYS:
{
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
wxString editorname = GetEditorName();
if ( !editorname.IsEmpty() )
ExecuteFile(this, editorname, FullFileName);
break;
}
case ID_PREFERENCES_HOTKEY_PATH_IS_HOME:
if ( g_ConfigFileLocationChoice != 0 )
{
g_ConfigFileLocationChoice = 0;
m_Parent->m_EDA_CommonConfig->Write(HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice);
}
break;
case ID_PREFERENCES_HOTKEY_PATH_IS_KICAD:
if ( g_ConfigFileLocationChoice != 1 )
{
g_ConfigFileLocationChoice = 1;
m_Parent->m_EDA_CommonConfig->Write(HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice);
}
break;
default:
DisplayError(this, wxT("WinEDA_SchematicFrame::Process_Config internal error") );
}
......@@ -100,7 +127,7 @@ bool Read_Hotkey_Config( WinEDA_DrawFrame * frame, bool verbose )
* Read the hotkey files config for eeschema and libedit
*/
{
wxString FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
wxString FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
frame->ReadHotkeyConfigFile(FullFileName, s_Eeschema_Hokeys_Descr, verbose);
......
......@@ -34,6 +34,7 @@
* Note: If an hotkey is a special key be sure the corresponding wxWidget keycode (WXK_XXXX)
* is handled in the hotkey_name_descr s_Hotkey_Name_List list (see hotkeys_basic.cpp)
* and see this list for some ascii keys (space ...)
* Key modifier are: GR_KB_CTRL GR_KB_ALT
*/
......@@ -47,6 +48,8 @@ static Ki_HotkeyInfo HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
static Ki_HotkeyInfo HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 );
static Ki_HotkeyInfo HkHelp( wxT( "Help: this message" ), HK_HELP, '?' );
static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset local coord." ), HK_RESET_LOCAL_COORD, ' ' );
static Ki_HotkeyInfo HkUndo( wxT( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z' );
static Ki_HotkeyInfo HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y' );
// Schematic editor
static Ki_HotkeyInfo HkBeginWire( wxT( "begin Wire" ), HK_BEGIN_WIRE, 'W' );
......@@ -77,6 +80,7 @@ Ki_HotkeyInfo* s_Common_Hotkey_List[] =
&HkHelp,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
&HkResetLocalCoord,
&HkUndo, &HkRedo,
NULL
};
......@@ -183,6 +187,20 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
OnZoom( ID_ZOOM_CENTER_KEY );
break;
case HK_UNDO:
{
wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, ID_SCHEMATIC_UNDO);
wxPostEvent(this, event);
}
break;
case HK_REDO:
{
wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, ID_SCHEMATIC_REDO);
wxPostEvent(this, event);
}
break;
case HK_MOVEBLOCK_TO_DRAGBLOCK: // Switch to drag mode, when block moving
HandleBlockEndByPopUp( BLOCK_DRAG, DC );
break;
......@@ -367,6 +385,9 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
wxPoint MousePos = m_CurrentScreen->m_MousePosition;
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to handle...)
if( (hotkey & GR_KB_CTRL) != 0 )
hotkey += 'A' - 1;
/* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */
if( (hotkey >= 'a') && (hotkey <= 'z') )
hotkey += 'A' - 'a';
......@@ -405,6 +426,20 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
OnZoom( ID_ZOOM_CENTER_KEY );
break;
case HK_UNDO:
{
wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, ID_LIBEDIT_UNDO);
wxPostEvent(this, event);
}
break;
case HK_REDO:
{
wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, ID_LIBEDIT_REDO);
wxPostEvent(this, event);
}
break;
case HK_REPEAT_LAST:
if( LibItemToRepeat && (LibItemToRepeat->m_Flags == 0)
&& (LibItemToRepeat->Type() == COMPONENT_PIN_DRAW_TYPE) )
......
......@@ -17,6 +17,8 @@ enum hotkey_id_commnand {
HK_NEXT_SEARCH,
HK_DELETE,
HK_REPEAT_LAST,
HK_UNDO,
HK_REDO,
HK_MOVEBLOCK_TO_DRAGBLOCK,
HK_ROTATE_COMPONENT,
HK_MIRROR_X_COMPONENT,
......
......@@ -39,14 +39,15 @@ EDA_LibComponentStruct * CopyItem;
}
/******************************************************/
void WinEDA_LibeditFrame::GetComponentFromRedoList()
bool WinEDA_LibeditFrame::GetComponentFromRedoList()
/******************************************************/
/* Redo the last edition:
- Place the current edited library component in undo list
- Get old version of the current edited library component
* @return FALSE if nothing done, else TRUE
*/
{
if ( GetScreen()->m_RedoList == NULL ) return;
if ( GetScreen()->m_RedoList == NULL ) return FALSE;
GetScreen()->AddItemToUndoList((EDA_BaseStruct *)CurrentLibEntry);
CurrentLibEntry =
......@@ -56,17 +57,20 @@ void WinEDA_LibeditFrame::GetComponentFromRedoList()
GetScreen()->SetModify();
ReCreateHToolbar();
SetToolbars();
return TRUE;
}
/******************************************************/
void WinEDA_LibeditFrame::GetComponentFromUndoList()
bool WinEDA_LibeditFrame::GetComponentFromUndoList()
/******************************************************/
/* Undo the last edition:
- Place the current edited library component in Redo list
- Get old version of the current edited library component
* @return FALSE if nothing done, else TRUE
*/
{
if ( GetScreen()->m_UndoList == NULL ) return;
if ( GetScreen()->m_UndoList == NULL ) return FALSE;
GetScreen()->AddItemToRedoList((EDA_BaseStruct *)CurrentLibEntry);
CurrentLibEntry =
......@@ -77,4 +81,6 @@ void WinEDA_LibeditFrame::GetComponentFromUndoList()
GetScreen()->SetModify();
ReCreateHToolbar();
SetToolbars();
return TRUE;
}
......@@ -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() )
......@@ -709,12 +710,12 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_LIBEDIT_UNDO:
GetComponentFromUndoList();
if( GetComponentFromUndoList() )
DrawPanel->Refresh( TRUE );
break;
case ID_LIBEDIT_REDO:
GetComponentFromRedoList();
if( GetComponentFromRedoList() )
DrawPanel->Refresh( TRUE );
break;
......
......@@ -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,12 +746,12 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_SCHEMATIC_UNDO:
GetSchematicFromUndoList();
if ( GetSchematicFromUndoList() )
DrawPanel->Refresh( TRUE );
break;
case ID_SCHEMATIC_REDO:
GetSchematicFromRedoList();
if ( GetSchematicFromRedoList() )
DrawPanel->Refresh( TRUE );
break;
......
......@@ -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,36 +20,36 @@
/* 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;
switch( id )
{
case ID_COLORS_SETUP :
DisplayColorSetupFrame(this, pos);
case ID_COLORS_SETUP:
DisplayColorSetupFrame( this, pos );
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;
}
case ID_PCB_TRACK_SIZE_SETUP:
case ID_PCB_LOOK_SETUP:
case ID_OPTIONS_SETUP:
InstallPcbOptionsFrame(pos, id);
InstallPcbOptionsFrame( pos, id );
break;
case ID_CONFIG_SAVE:
......@@ -57,18 +57,34 @@ 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_Gerbview_Hokeys_Descr, true);
WriteHotkeyConfigFile( FullFileName, s_Gerbview_Hokeys_Descr, true );
break;
case ID_PREFERENCES_READ_CONFIG_HOTKEYS:
Read_Hotkey_Config( this, true);
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"));
DisplayError( this, wxT( "WinEDA_GerberFrame::Process_Config internal error" ) );
}
}
......@@ -76,44 +92,50 @@ wxString FullFileName;
/*****************************************************/
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);
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");
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("*") ),
wxString FullFileName;
wxString mask( wxT( "*" ) ),
g_Prj_Config_Filename_ext = wxT(".cnf";)
g_Prj_Config_Filename_ext = wxT( ".cnf"; )
mask += g_Prj_Config_Filename_ext;
FullFileName = wxT("gerbview");
FullFileName = wxT( "gerbview" );
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
FullFileName = EDA_FileSelector(_("Save config file"),
FullFileName = EDA_FileSelector( _( "Save config file" ),
wxEmptyString, /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */
......@@ -122,23 +144,25 @@ wxString mask( wxT("*") ),
wxFD_SAVE,
TRUE
);
if ( FullFileName.IsEmpty() ) return;
if( FullFileName.IsEmpty() )
return;
/* ecriture de la configuration */
EDA_Appl->WriteProjectConfig(FullFileName, GROUP, ParamCfgList);
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;
wxString FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
return frame->ReadHotkeyConfigFile(FullFileName, s_Gerbview_Hokeys_Descr, verbose);
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,8 +83,15 @@ 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 );
......
......@@ -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)
......@@ -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() )
{
......
......@@ -75,6 +75,9 @@ static Ki_HotkeyInfo HkFlipFootprint( wxT( "Flip Footprint" ), HK_FLIP_FOOTPR
static Ki_HotkeyInfo HkRotateFootprint( wxT( "Rotate Footprint" ), HK_ROTATE_FOOTPRINT, 'R' );
static Ki_HotkeyInfo HkMoveFootprint( wxT( "Move Footprint" ), HK_MOVE_FOOTPRINT, 'M' );
static Ki_HotkeyInfo HkDragFootprint( wxT( "Drag Footprint" ), HK_DRAG_FOOTPRINT, 'G' );
static Ki_HotkeyInfo HkGetAndMoveFootprint( wxT(
"Get and Move Footprint" ),
HK_GET_AND_MOVE_FOOTPRINT, 'T' );
static Ki_HotkeyInfo HkLock_Unlock_Footprint( wxT(
"Lock/Unlock Footprint" ),
HK_LOCK_UNLOCK_FOOTPRINT, 'L' );
......@@ -85,10 +88,10 @@ static Ki_HotkeyInfo HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_
static Ki_HotkeyInfo HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
static Ki_HotkeyInfo HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 );
static Ki_HotkeyInfo HkHelp( wxT( "Help: this message" ), HK_HELP, '?' );
static Ki_HotkeyInfo HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' );
static Ki_HotkeyInfo HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' + GR_KB_CTRL );
static Ki_HotkeyInfo HkTrackDisplayMode( wxT(
"Track Display Mode" ),
HK_SWITCH_TRACK_DISPLAY_MODE, 'F' );
HK_SWITCH_TRACK_DISPLAY_MODE, 'K' );
// List of common hotkey descriptors
Ki_HotkeyInfo* s_Common_Hotkey_List[] = {
......@@ -105,6 +108,7 @@ Ki_HotkeyInfo* s_board_edit_Hotkey_List[] = {
&HkAddVia, &HkEndTrack,
&HkMoveFootprint, &HkFlipFootprint,
&HkRotateFootprint, &HkDragFootprint,
&HkGetAndMoveFootprint,
&HkLock_Unlock_Footprint,
&HkSavefile, &HkLoadfile, &HkFindItem,
&HkSwitch2CopperLayer,
......@@ -132,7 +136,7 @@ struct Ki_HotkeyInfoSectionDescriptor s_Pcbnew_Editor_Hokeys_Descr[] =
{ &g_CommonSectionTag, s_Common_Hotkey_List, "Common keys" },
{ &g_BoardEditorSectionTag, s_board_edit_Hotkey_List, "Board editor keys" },
{ &g_ModuleEditSectionTag, s_module_edit_Hotkey_List, "Footprint editor keys" },
{ NULL, NULL, NULL}
{ NULL, NULL, NULL }
};
// list of sections and corresponding hotkey list for the board editor (used to list current hotkeys)
......@@ -174,7 +178,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
MODULE* module = NULL;
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to handle...)
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (just easier to handle...)
if( (hotkey & GR_KB_CTRL) != 0 )
hotkey += 'A' - 1;
/* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */
......@@ -284,6 +288,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
case HK_SWITCH_TRACK_DISPLAY_MODE:
DisplayOpt.DisplayPcbTrackFill ^= 1; DisplayOpt.DisplayPcbTrackFill &= 1;
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
GetScreen()->SetRefreshReq();
break;
......@@ -294,7 +299,6 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
case HK_BACK_SPACE:
if( m_ID_current_state == ID_TRACK_BUTT && GetScreen()->m_Active_Layer <= CMP_N )
{
bool ItemFree = GetCurItem()==NULL || GetCurItem()->m_Flags==0;
if( ItemFree )
{
// no track is currently being edited - select a segment and remove it.
......@@ -321,11 +325,24 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
break;
case HK_END_TRACK:
if ( ! ItemFree && (GetCurItem()->Type() == TYPETRACK) && ((GetCurItem()->m_Flags & IS_NEW) != 0) )
{ // A new track is in progress: call to End_Route()
DrawPanel->MouseToCursorSchema();
End_Route( (TRACK*) ( GetCurItem() ), DC );
}
break;
case HK_GET_AND_MOVE_FOOTPRINT:
if( ItemFree )
{
wxCommandEvent evt;
evt.SetId( ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST );
Process_Special_Functions( evt );
}
break;
case HK_FIND_ITEM:
if( ItemFree )
{
wxCommandEvent evt;
evt.SetId( ID_FIND_ITEMS );
......@@ -334,6 +351,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
break;
case HK_LOAD_BOARD:
if( ItemFree )
{
// try not to duplicate save, load code etc.
wxCommandEvent evt;
......@@ -343,6 +361,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
break;
case HK_SAVE_BOARD:
if( ItemFree )
{
// try not to duplicate save, load code etc.
wxCommandEvent evt;
......
......@@ -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