more work on hotkeys
This commit is contained in:
parent
040e2cbf6b
commit
9414bf676b
|
@ -4,6 +4,17 @@ 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-20 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
||||||
|
================================================================================
|
||||||
|
+ eeschema & pcbnew
|
||||||
|
modify hotkeys.cpp code (large modifications).
|
||||||
|
Added: common code in hotkeys_basic.cpp (in common) and hotkeys_basic.h (in include)
|
||||||
|
In the future, i hope hotkeys will be programmed by a config file
|
||||||
|
|
||||||
|
+ pcbnew
|
||||||
|
filename drc_dialog.prj changed to dialog_drc.prj
|
||||||
|
(according to the fulename dialog_drc.cpp and dialog_drc.h created by dialogblock from the .prj)
|
||||||
|
|
||||||
|
|
||||||
2007-Aug-19 UPDATE Dick Hollenbeck <dick@softplc.com>
|
2007-Aug-19 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
|
@ -29,15 +29,13 @@ wxString HOSTNAME( wxT( "localhost" ) );
|
||||||
|
|
||||||
// buffers for read and write data in socket connections
|
// buffers for read and write data in socket connections
|
||||||
#define IPC_BUF_SIZE 4096
|
#define IPC_BUF_SIZE 4096
|
||||||
char client_ipc_buffer[IPC_BUF_SIZE];
|
static char client_ipc_buffer[IPC_BUF_SIZE];
|
||||||
char server_ipc_buffer[IPC_BUF_SIZE];
|
static char server_ipc_buffer[IPC_BUF_SIZE];
|
||||||
|
|
||||||
wxServer* server;
|
static wxServer* server;
|
||||||
|
|
||||||
void (*RemoteFct)(const char* cmd);
|
void (*RemoteFct)(const char* cmd);
|
||||||
|
|
||||||
char buffcar[1024];
|
|
||||||
|
|
||||||
void SetupServerFunction( void (*remotefct)(const char* remotecmd) )
|
void SetupServerFunction( void (*remotefct)(const char* remotecmd) )
|
||||||
{
|
{
|
||||||
RemoteFct = remotefct;
|
RemoteFct = remotefct;
|
||||||
|
|
|
@ -0,0 +1,152 @@
|
||||||
|
/*********************/
|
||||||
|
/* hotkeys_basic.cpp */
|
||||||
|
/*********************/
|
||||||
|
|
||||||
|
/* Some functions to handle hotkeys in kicad
|
||||||
|
*/
|
||||||
|
#include "fctsys.h"
|
||||||
|
#include "common.h"
|
||||||
|
#include "hotkeys_basic.h"
|
||||||
|
|
||||||
|
/* 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)
|
||||||
|
*/
|
||||||
|
|
||||||
|
Ki_HotkeyInfo::Ki_HotkeyInfo(const wxChar * infomsg, int idcommand, int keycode)
|
||||||
|
{
|
||||||
|
m_KeyCode = keycode; // Key code (ascii value for ascii keys or wxWidgets code for function key
|
||||||
|
m_InfoMsg = infomsg; // info message.
|
||||||
|
m_Idcommand = idcommand; // internal id for the corresponding command (see hotkey_id_commnand list)
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************/
|
||||||
|
wxString ReturnKeyNameFromKeyCode(int keycode)
|
||||||
|
/****************************************************/
|
||||||
|
/*
|
||||||
|
* return the key name from the key code
|
||||||
|
* Only some wxWidgets key values are handled for function key
|
||||||
|
* @param key = key code (ascii value, or wxWidgets value for function keys)
|
||||||
|
* @return the key name in a wxString
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
wxString keyname, modifier, fullkeyname;
|
||||||
|
|
||||||
|
if ( (keycode & GR_KB_CTRL) != 0 ) modifier << wxT("Ctrl ");
|
||||||
|
if ( (keycode & GR_KB_ALT) != 0 ) modifier << wxT("Alt ");
|
||||||
|
if ( (keycode & GR_KB_SHIFT) != 0 ) modifier << wxT("Shift ");
|
||||||
|
|
||||||
|
switch ( keycode)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
keycode &= ~(GR_KB_CTRL|GR_KB_ALT|GR_KB_SHIFT);
|
||||||
|
keyname.Printf(wxT("%c"), keycode);
|
||||||
|
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;
|
||||||
|
|
||||||
|
case '\t':
|
||||||
|
keyname = wxT("Tab");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WXK_DELETE:
|
||||||
|
keyname = wxT("Delete");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WXK_BACK:
|
||||||
|
keyname = wxT("Backspace");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WXK_INSERT:
|
||||||
|
keyname = wxT("Insert");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WXK_END:
|
||||||
|
keyname = wxT("End");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WXK_PAGEUP:
|
||||||
|
keyname = wxT("Page Up");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WXK_PAGEDOWN:
|
||||||
|
keyname = wxT("Page Down");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WXK_ADD:
|
||||||
|
keyname = wxT("+");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WXK_SUBTRACT:
|
||||||
|
keyname = wxT("-");
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fullkeyname = modifier + keyname;
|
||||||
|
return fullkeyname;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
void DisplayHotkeyList(WinEDA_DrawFrame * frame, Ki_HotkeyInfo ** List)
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*
|
||||||
|
* Displays the current hotkey list
|
||||||
|
* @param frame = current open frame
|
||||||
|
* @param List = pointer to a Ki_HotkeyInfo list of commands
|
||||||
|
* @return none
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
wxString keyname;
|
||||||
|
|
||||||
|
wxString msg = _("Current hotkey list:\n\n");
|
||||||
|
for ( ; * List != NULL; List++ )
|
||||||
|
{
|
||||||
|
Ki_HotkeyInfo * hk_decr = * List;
|
||||||
|
if ( hk_decr->m_InfoMsg.IsEmpty() ) break;
|
||||||
|
msg += _("key ");
|
||||||
|
keyname = ReturnKeyNameFromKeyCode(hk_decr->m_KeyCode);
|
||||||
|
msg += keyname + wxT(": ") + hk_decr->m_InfoMsg + wxT("\n");
|
||||||
|
}
|
||||||
|
DisplayInfo(frame, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************/
|
||||||
|
int GetCommandCodeFromHotkey(int key, Ki_HotkeyInfo ** List)
|
||||||
|
/******************************************************************/
|
||||||
|
/*
|
||||||
|
* Return an id identifier fron a key code for OnHotKey() function
|
||||||
|
* @param key = key code (ascii value, or wxWidgets value for function keys
|
||||||
|
* @param List = pointer to a Ki_HotkeyInfo list of commands
|
||||||
|
* @return the corresponding function identifier from the Ki_HotkeyInfo List
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
for ( ; * List != NULL; List++ )
|
||||||
|
{
|
||||||
|
Ki_HotkeyInfo * hk_decr = * List;
|
||||||
|
if ( hk_decr->m_KeyCode == key ) return hk_decr->m_Idcommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ OBJECTS= \
|
||||||
common_plot_functions.o\
|
common_plot_functions.o\
|
||||||
common_plotPS_functions.o\
|
common_plotPS_functions.o\
|
||||||
common_plotHPGL_functions.o\
|
common_plotHPGL_functions.o\
|
||||||
|
hotkeys_basic.o\
|
||||||
drawtxt.o \
|
drawtxt.o \
|
||||||
wxwineda.o \
|
wxwineda.o \
|
||||||
string.o \
|
string.o \
|
||||||
|
@ -43,6 +44,8 @@ gr_basic.o: gr_basic.cpp ../include/gr_basic.h $(DEPEND)
|
||||||
|
|
||||||
confirm.o: confirm.cpp $(COMMON)
|
confirm.o: confirm.cpp $(COMMON)
|
||||||
|
|
||||||
|
hotkeys_basic.o: hotkeys_basic.cpp ../include/hotkeys_basic.h $(COMMON)
|
||||||
|
|
||||||
worksheet.o: worksheet.cpp ../include/worksheet.h $(COMMON)
|
worksheet.o: worksheet.cpp ../include/worksheet.h $(COMMON)
|
||||||
|
|
||||||
selcolor.o: selcolor.cpp ../include/colors.h $(COMMON)
|
selcolor.o: selcolor.cpp ../include/colors.h $(COMMON)
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Search a text (text, value, reference) withing e composent or
|
* Search a text (text, value, reference) within a component or
|
||||||
* search a composant in libraries, a marker ...,
|
* search a component in libraries, a marker ...,
|
||||||
* in current sheet or whole the project
|
* in current sheet or whole the project
|
||||||
*/
|
*/
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
|
@ -40,7 +40,7 @@ void InstallFindFrame( WinEDA_SchematicFrame* parent, wxPoint& pos )
|
||||||
void WinEDA_FindFrame::FindMarker( wxCommandEvent& event )
|
void WinEDA_FindFrame::FindMarker( wxCommandEvent& event )
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
|
|
||||||
/* Search de markers in whole the hierarchy.
|
/* Search markers in whole hierarchy.
|
||||||
* Mouse cursor is put on the marker
|
* Mouse cursor is put on the marker
|
||||||
* search the first marker, or next marker
|
* search the first marker, or next marker
|
||||||
*/
|
*/
|
||||||
|
@ -144,7 +144,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
|
||||||
curpos.x -= m_CurrentScreen->m_StartVisu.x;
|
curpos.x -= m_CurrentScreen->m_StartVisu.x;
|
||||||
curpos.y -= m_CurrentScreen->m_StartVisu.y;
|
curpos.y -= m_CurrentScreen->m_StartVisu.y;
|
||||||
|
|
||||||
/* Il y a peut-etre necessite de recadrer le dessin: */
|
// reposition the window if the chosen marker is off screen.
|
||||||
if( (curpos.x <= 0) || (curpos.x >= size.x - 1)
|
if( (curpos.x <= 0) || (curpos.x >= size.x - 1)
|
||||||
|| (curpos.y <= 0) || (curpos.y >= size.y) || force_recadre )
|
|| (curpos.y <= 0) || (curpos.y >= size.y) || force_recadre )
|
||||||
{
|
{
|
||||||
|
@ -289,9 +289,9 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NotFound == FALSE ) /* Element trouve */
|
if( NotFound == FALSE ) /* Item found ! */
|
||||||
{
|
{
|
||||||
if( FirstScreen == NULL ) /* 1er element trouve */
|
if( FirstScreen == NULL ) /* First Item found */
|
||||||
{
|
{
|
||||||
FirstScreen = Screen;
|
FirstScreen = Screen;
|
||||||
firstpos = pos;
|
firstpos = pos;
|
||||||
|
@ -340,9 +340,9 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
|
||||||
force_recadre = TRUE;
|
force_recadre = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Si la struct localisee est du type DRAW_LIB_ITEM_STRUCT_TYPE,
|
/* If the struct found is a DRAW_LIB_ITEM_STRUCT_TYPE type,
|
||||||
* Les coordonnes sont a recalculer en fonction de la matrice
|
* coordinates must be computed according to its orientation matrix
|
||||||
* d'orientation */
|
*/
|
||||||
if( Struct->m_StructType == DRAW_LIB_ITEM_STRUCT_TYPE )
|
if( Struct->m_StructType == DRAW_LIB_ITEM_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
EDA_SchComponentStruct* pSch = (EDA_SchComponentStruct*) Struct;
|
EDA_SchComponentStruct* pSch = (EDA_SchComponentStruct*) Struct;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***************/
|
/***************/
|
||||||
/* hotkeys.cpp */
|
/* hotkeys.cpp */
|
||||||
/***************/
|
/***************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
|
|
||||||
|
@ -13,477 +13,314 @@
|
||||||
|
|
||||||
#include "id.h"
|
#include "id.h"
|
||||||
|
|
||||||
|
#include "hotkeys_basic.h"
|
||||||
|
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
enum hotkey_id_commnand {
|
enum hotkey_id_commnand {
|
||||||
HK_NOT_FOUND = 0,
|
HK_NOT_FOUND = 0,
|
||||||
HK_RESET_LOCAL_COORD,
|
HK_RESET_LOCAL_COORD,
|
||||||
HK_HELP,
|
HK_HELP,
|
||||||
HK_ZOOM_IN,
|
HK_ZOOM_IN,
|
||||||
HK_ZOOM_OUT,
|
HK_ZOOM_OUT,
|
||||||
HK_ZOOM_REDRAW,
|
HK_ZOOM_REDRAW,
|
||||||
HK_ZOOM_CENTER,
|
HK_ZOOM_CENTER,
|
||||||
HK_NEXT_SEARCH,
|
HK_NEXT_SEARCH,
|
||||||
HK_DELETE,
|
HK_DELETE,
|
||||||
HK_REPEAT_LAST,
|
HK_REPEAT_LAST,
|
||||||
HK_MOVEBLOCK_TO_DRAGBLOCK,
|
HK_MOVEBLOCK_TO_DRAGBLOCK,
|
||||||
HK_ROTATE_COMPONENT,
|
HK_ROTATE_COMPONENT,
|
||||||
HK_MIRROR_X_COMPONENT,
|
HK_MIRROR_X_COMPONENT,
|
||||||
HK_MIRROR_Y_COMPONENT,
|
HK_MIRROR_Y_COMPONENT,
|
||||||
HK_ORIENT_NORMAL_COMPONENT,
|
HK_ORIENT_NORMAL_COMPONENT,
|
||||||
HK_MOVE_COMPONENT,
|
HK_MOVE_COMPONENT,
|
||||||
HK_ADD_NEW_COMPONENT,
|
HK_ADD_NEW_COMPONENT,
|
||||||
HK_BEGIN_WIRE
|
HK_BEGIN_WIRE
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 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)
|
|
||||||
*/
|
|
||||||
class Ki_HotkeyInfo
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
int m_KeyCode; // Key code (ascii value for ascii keys or wxWidgets code for function key
|
|
||||||
wxString m_InfoMsg; // info message.
|
|
||||||
hotkey_id_commnand m_Idcommand; // internal id for the corresponding command (see hotkey_id_commnand list)
|
|
||||||
|
|
||||||
public:
|
|
||||||
Ki_HotkeyInfo( const wxChar* infomsg, hotkey_id_commnand idcommand, int keycode );
|
|
||||||
};
|
|
||||||
|
|
||||||
Ki_HotkeyInfo::Ki_HotkeyInfo( const wxChar* infomsg, hotkey_id_commnand idcommand, int keycode )
|
|
||||||
{
|
|
||||||
m_KeyCode = keycode; // Key code (ascii value for ascii keys or wxWidgets code for function key
|
|
||||||
m_InfoMsg = infomsg; // info message.
|
|
||||||
m_Idcommand = idcommand; // internal id for the corresponding command (see hotkey_id_commnand list)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* local variables */
|
/* local variables */
|
||||||
/* Hotkey list: */
|
/* Hotkey list: */
|
||||||
static Ki_HotkeyInfo HkBeginWire( wxT( "begin Wire" ), HK_BEGIN_WIRE, 'W' );
|
static Ki_HotkeyInfo HkBeginWire(wxT("begin Wire"), HK_BEGIN_WIRE, 'W');
|
||||||
static Ki_HotkeyInfo HkAddComponent( wxT( "Add Component" ), HK_ADD_NEW_COMPONENT, 'A' );
|
static Ki_HotkeyInfo HkAddComponent(wxT("Add Component"), HK_ADD_NEW_COMPONENT, 'A');
|
||||||
static Ki_HotkeyInfo HkMirrorYComponent( wxT( "Mirror Y Component" ), HK_MIRROR_Y_COMPONENT,
|
static Ki_HotkeyInfo HkMirrorYComponent(wxT("Mirror Y Component"), HK_MIRROR_Y_COMPONENT, 'Y');
|
||||||
'Y' );
|
static Ki_HotkeyInfo HkMirrorXComponent(wxT("Mirror X Component"), HK_MIRROR_X_COMPONENT, 'X');
|
||||||
static Ki_HotkeyInfo HkMirrorXComponent( wxT( "Mirror X Component" ), HK_MIRROR_X_COMPONENT,
|
static Ki_HotkeyInfo HkOrientNormalComponent(wxT("Orient Normal Component"), HK_ORIENT_NORMAL_COMPONENT, 'N');
|
||||||
'X' );
|
static Ki_HotkeyInfo HkRotateComponent(wxT("Rotate Component"), HK_ROTATE_COMPONENT, 'R');
|
||||||
static Ki_HotkeyInfo HkOrientNormalComponent( wxT( "Orient Normal Component" ),
|
static Ki_HotkeyInfo HkMoveComponent(wxT("Move Component"), HK_MOVE_COMPONENT, 'M');
|
||||||
HK_ORIENT_NORMAL_COMPONENT, 'N' );
|
static Ki_HotkeyInfo HkMove2Drag(wxT("Switch move block to drag block"), HK_MOVEBLOCK_TO_DRAGBLOCK, '\t');
|
||||||
static Ki_HotkeyInfo HkRotateComponent( wxT( "Rotate Component" ), HK_ROTATE_COMPONENT, 'R' );
|
static Ki_HotkeyInfo HkInsert(wxT("Repeat Last Item"), HK_REPEAT_LAST, WXK_INSERT);
|
||||||
static Ki_HotkeyInfo HkMoveComponent( wxT( "Move Component" ), HK_MOVE_COMPONENT, 'M' );
|
static Ki_HotkeyInfo HkDelete(wxT("Delete Item"), HK_DELETE, WXK_DELETE);
|
||||||
static Ki_HotkeyInfo HkMove2Drag( wxT( "Switch move block to drag block" ),
|
static Ki_HotkeyInfo HkResetLocalCoord(wxT("Reset local coord."), HK_RESET_LOCAL_COORD, ' ');
|
||||||
HK_MOVEBLOCK_TO_DRAGBLOCK, '\t' );
|
static Ki_HotkeyInfo HkNextSearch(wxT("Next Search"), HK_NEXT_SEARCH, WXK_F5);
|
||||||
static Ki_HotkeyInfo HkInsert( wxT( "Repeat Last Item" ), HK_REPEAT_LAST, WXK_INSERT );
|
static Ki_HotkeyInfo HkZoomCenter(wxT("Zoom Center"), HK_ZOOM_CENTER, WXK_F4);
|
||||||
static Ki_HotkeyInfo HkDelete( wxT( "Delete Item" ), HK_DELETE, WXK_DELETE );
|
static Ki_HotkeyInfo HkZoomRedraw(wxT("Zoom Redraw"), HK_ZOOM_REDRAW, WXK_F3);
|
||||||
static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset local coord." ), HK_RESET_LOCAL_COORD, ' ' );
|
static Ki_HotkeyInfo HkZoomOut(wxT("Zoom Out"), HK_ZOOM_OUT, WXK_F2);
|
||||||
static Ki_HotkeyInfo HkNextSearch( wxT( "Next Search" ), HK_NEXT_SEARCH, WXK_F5 );
|
static Ki_HotkeyInfo HkZoomIn(wxT("Zoom In"), HK_ZOOM_IN, WXK_F1);
|
||||||
static Ki_HotkeyInfo HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 );
|
static Ki_HotkeyInfo HkHelp(wxT("Help: this message"), HK_HELP, '?');
|
||||||
static Ki_HotkeyInfo HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 );
|
|
||||||
static Ki_HotkeyInfo HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
|
|
||||||
static Ki_HotkeyInfo HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 );
|
|
||||||
static Ki_HotkeyInfo HkHelp( wxT( "Help: this message" ), HK_HELP, '?' );
|
|
||||||
|
|
||||||
// List of hotkey descriptors for schematic
|
// List of hotkey descriptors for schematic
|
||||||
static Ki_HotkeyInfo* s_Schematic_Hotkey_List[] = {
|
static Ki_HotkeyInfo *s_Schematic_Hotkey_List[] = {
|
||||||
&HkHelp,
|
&HkHelp,
|
||||||
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
|
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
|
||||||
&HkNextSearch, &HkResetLocalCoord,
|
&HkNextSearch, &HkResetLocalCoord,
|
||||||
&HkDelete, &HkInsert, &HkMove2Drag,
|
&HkDelete, &HkInsert, &HkMove2Drag,
|
||||||
&HkMoveComponent, &HkAddComponent,
|
&HkMoveComponent, &HkAddComponent,
|
||||||
&HkRotateComponent, &HkMirrorXComponent, &HkMirrorYComponent, &HkOrientNormalComponent,
|
&HkRotateComponent, &HkMirrorXComponent, &HkMirrorYComponent, & HkOrientNormalComponent,
|
||||||
&HkBeginWire,
|
&HkBeginWire,
|
||||||
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[] =
|
static Ki_HotkeyInfo *s_LibEdit_Hotkey_List[] =
|
||||||
{
|
{
|
||||||
&HkHelp,
|
&HkHelp,
|
||||||
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
|
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
|
||||||
&HkResetLocalCoord,
|
&HkResetLocalCoord,
|
||||||
&HkInsertPin,
|
&HkInsertPin,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/****************************************************/
|
|
||||||
static wxString ReturnKeyNameFromKeyCode( int keycode )
|
|
||||||
/****************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* return the key name from the key code
|
|
||||||
* Only some wxWidgets key values are handled for function key
|
|
||||||
* @param key = key code (ascii value, or wxWidgets value for function keys)
|
|
||||||
* @return the key name wxString
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
wxString keyname, modifier, fullkeyname;
|
|
||||||
|
|
||||||
if( keycode & GR_KB_CTRL )
|
|
||||||
modifier << wxT( "Ctrl " );
|
|
||||||
if( keycode & GR_KB_ALT )
|
|
||||||
modifier << wxT( "Alt " );
|
|
||||||
if( keycode & GR_KB_SHIFT )
|
|
||||||
modifier << wxT( "Shift " );
|
|
||||||
keycode &= ~(GR_KB_CTRL | GR_KB_ALT | GR_KB_SHIFT);
|
|
||||||
|
|
||||||
switch( keycode )
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
keyname.Printf( wxT( "%c" ), keycode );
|
|
||||||
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;
|
|
||||||
|
|
||||||
case '\t':
|
|
||||||
keyname = wxT( "Tab" );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WXK_DELETE:
|
|
||||||
keyname = wxT( "Delete" );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WXK_INSERT:
|
|
||||||
keyname = wxT( "Insert" );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
fullkeyname = modifier + keyname;
|
|
||||||
return keyname;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
||||||
static void DisplayHotkeyList( WinEDA_DrawFrame* frame, Ki_HotkeyInfo** List )
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Displays the current hotkey list
|
|
||||||
* @param frame = current open frame
|
|
||||||
* @param List = pointer to a Ki_HotkeyInfo list of commands
|
|
||||||
* @return none
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
wxString keyname;
|
|
||||||
|
|
||||||
wxString msg = _( "Current hotkey list:\n\n" );
|
|
||||||
|
|
||||||
for( ; *List != NULL; List++ )
|
|
||||||
{
|
|
||||||
Ki_HotkeyInfo* hk_decr = *List;
|
|
||||||
if( hk_decr->m_InfoMsg.IsEmpty() )
|
|
||||||
break;
|
|
||||||
msg += _( "key " );
|
|
||||||
keyname = ReturnKeyNameFromKeyCode( hk_decr->m_KeyCode );
|
|
||||||
msg += keyname + wxT( ": " ) + hk_decr->m_InfoMsg + wxT( "\n" );
|
|
||||||
}
|
|
||||||
|
|
||||||
DisplayInfo( frame, msg );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************/
|
|
||||||
static int GetCommandCodeFromHotkey( int key, Ki_HotkeyInfo** List )
|
|
||||||
/******************************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return an id identifier fron a key code for OnHotKey() function
|
|
||||||
* @param key = key code (ascii value, or wxWidgets value for function keys
|
|
||||||
* @param List = pointer to a Ki_HotkeyInfo list of commands
|
|
||||||
* @return the corresponding function identifier from the Ki_HotkeyInfo List
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
for( ; *List != NULL; List++ )
|
|
||||||
{
|
|
||||||
Ki_HotkeyInfo* hk_decr = *List;
|
|
||||||
if( hk_decr->m_KeyCode == key )
|
|
||||||
return hk_decr->m_Idcommand;
|
|
||||||
}
|
|
||||||
|
|
||||||
return HK_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
|
void WinEDA_SchematicFrame::OnHotKey(wxDC * DC, int hotkey,
|
||||||
EDA_BaseStruct* DrawStruct )
|
EDA_BaseStruct * DrawStruct)
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
|
|
||||||
/* Hot keys. Some commands are relatives to the item under the mouse cursor
|
/* Hot keys. Some commands are relatives to the item under the mouse cursor
|
||||||
* Commands are case insensitive
|
Commands are case insensitive
|
||||||
* Zoom commands are not managed here
|
Zoom commands are not managed here
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
bool PopupOn = m_CurrentScreen->GetCurItem()
|
bool PopupOn = m_CurrentScreen->GetCurItem() &&
|
||||||
&& m_CurrentScreen->GetCurItem()->m_Flags;
|
m_CurrentScreen->GetCurItem()->m_Flags;
|
||||||
bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified
|
bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified
|
||||||
|
|
||||||
|
if ( hotkey == 0 ) return;
|
||||||
|
|
||||||
if( hotkey == 0 )
|
wxPoint MousePos = m_CurrentScreen->m_MousePosition;
|
||||||
return;
|
|
||||||
|
|
||||||
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';
|
||||||
|
|
||||||
|
// Search command from key :
|
||||||
|
int CommandCode = GetCommandCodeFromHotkey(hotkey, s_Schematic_Hotkey_List);
|
||||||
|
switch( CommandCode )
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case HK_NOT_FOUND:
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HK_HELP: // Display Current hotkey list
|
||||||
|
DisplayHotkeyList(this, s_Schematic_Hotkey_List);
|
||||||
|
break;
|
||||||
|
|
||||||
/* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */
|
case HK_ZOOM_IN:
|
||||||
if( (hotkey >= 'a') && (hotkey <= 'z') )
|
case HK_ZOOM_OUT:
|
||||||
hotkey += 'A' - 'a';
|
case HK_ZOOM_REDRAW:
|
||||||
|
case HK_ZOOM_CENTER:
|
||||||
|
case HK_RESET_LOCAL_COORD:
|
||||||
|
break;
|
||||||
|
|
||||||
// Search commnd from key :
|
case HK_MOVEBLOCK_TO_DRAGBLOCK: // Switch to drag mode, when block moving
|
||||||
switch( GetCommandCodeFromHotkey( hotkey, s_Schematic_Hotkey_List ) )
|
HandleBlockEndByPopUp(BLOCK_DRAG, DC);
|
||||||
{
|
break;
|
||||||
default:
|
|
||||||
case HK_NOT_FOUND:
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HK_HELP: // Display Current hotkey list
|
case HK_DELETE:
|
||||||
DisplayHotkeyList( this, s_Schematic_Hotkey_List );
|
if ( PopupOn ) break;
|
||||||
break;
|
RefreshToolBar = LocateAndDeleteItem(this, DC);
|
||||||
|
m_CurrentScreen->SetModify();
|
||||||
|
m_CurrentScreen->SetCurItem( NULL);
|
||||||
|
TestDanglingEnds(m_CurrentScreen->EEDrawList, DC);
|
||||||
|
break;
|
||||||
|
|
||||||
case HK_ZOOM_IN:
|
case HK_REPEAT_LAST:
|
||||||
case HK_ZOOM_OUT:
|
if ( g_ItemToRepeat && (g_ItemToRepeat->m_Flags == 0) )
|
||||||
case HK_ZOOM_REDRAW:
|
{
|
||||||
case HK_ZOOM_CENTER:
|
RepeatDrawItem(DC);
|
||||||
case HK_RESET_LOCAL_COORD:
|
}
|
||||||
break;
|
else wxBell();
|
||||||
|
break;
|
||||||
|
|
||||||
case HK_MOVEBLOCK_TO_DRAGBLOCK: // Switch to drag mode, when block moving
|
case HK_NEXT_SEARCH :
|
||||||
HandleBlockEndByPopUp( BLOCK_DRAG, DC );
|
if ( g_LastSearchIsMarker ) WinEDA_SchematicFrame::FindMarker(1);
|
||||||
break;
|
else FindSchematicItem(wxEmptyString, 2);
|
||||||
|
break;
|
||||||
|
|
||||||
case HK_DELETE:
|
case HK_ADD_NEW_COMPONENT: // Add component
|
||||||
if( PopupOn )
|
if ( DrawStruct && DrawStruct->m_Flags ) break;
|
||||||
break;
|
// switch to m_ID_current_state = ID_COMPONENT_BUTT;
|
||||||
RefreshToolBar = LocateAndDeleteItem( this, DC );
|
if ( m_ID_current_state != ID_COMPONENT_BUTT ) SetToolID( ID_COMPONENT_BUTT, wxCURSOR_PENCIL, _("Add Component"));
|
||||||
m_CurrentScreen->SetModify();
|
OnLeftClick(DC, MousePos);
|
||||||
m_CurrentScreen->SetCurItem( NULL );
|
break;
|
||||||
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HK_REPEAT_LAST:
|
case HK_BEGIN_WIRE: // Add wire
|
||||||
if( g_ItemToRepeat && (g_ItemToRepeat->m_Flags == 0) )
|
if ( DrawStruct ) // An item is selected. If edited and not a wire, a new command is not possible
|
||||||
{
|
{
|
||||||
RepeatDrawItem( DC );
|
if ( DrawStruct->m_Flags ) // Item selected and edition in progress
|
||||||
}
|
{
|
||||||
else
|
if (DrawStruct->m_StructType == DRAW_SEGMENT_STRUCT_TYPE )
|
||||||
wxBell();
|
{
|
||||||
break;
|
EDA_DrawLineStruct * segment = (EDA_DrawLineStruct *)DrawStruct;
|
||||||
|
if ( segment->m_Layer != LAYER_WIRE ) break;
|
||||||
case HK_NEXT_SEARCH:
|
}
|
||||||
if( g_LastSearchIsMarker )
|
else break;
|
||||||
WinEDA_SchematicFrame::FindMarker( 1 );
|
}
|
||||||
else
|
}
|
||||||
FindSchematicItem( wxEmptyString, 2 );
|
// switch to m_ID_current_state = ID_WIRE_BUTT;
|
||||||
break;
|
if ( m_ID_current_state != ID_WIRE_BUTT ) SetToolID( ID_WIRE_BUTT, wxCURSOR_PENCIL, _("Add Wire"));
|
||||||
|
OnLeftClick(DC, MousePos);
|
||||||
case HK_ADD_NEW_COMPONENT: // Add component
|
|
||||||
if( DrawStruct && DrawStruct->m_Flags )
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// switch to m_ID_current_state = ID_COMPONENT_BUTT;
|
case HK_ROTATE_COMPONENT: // Component Rotation
|
||||||
if( m_ID_current_state != ID_COMPONENT_BUTT )
|
if ( DrawStruct == NULL )
|
||||||
SetToolID( ID_COMPONENT_BUTT, wxCURSOR_PENCIL, _( "Add Component" ) );
|
{
|
||||||
OnLeftClick( DC, MousePos );
|
DrawStruct = PickStruct( GetScreen()->m_Curseur,
|
||||||
break;
|
GetScreen()->EEDrawList, LIBITEM|TEXTITEM|LABELITEM );
|
||||||
|
if ( DrawStruct == NULL ) break;
|
||||||
|
if ( DrawStruct->m_StructType == DRAW_LIB_ITEM_STRUCT_TYPE )
|
||||||
|
DrawStruct = LocateSmallestComponent( GetScreen() );
|
||||||
|
if ( DrawStruct == NULL ) break;
|
||||||
|
}
|
||||||
|
switch (DrawStruct->m_StructType)
|
||||||
|
{
|
||||||
|
case DRAW_LIB_ITEM_STRUCT_TYPE:
|
||||||
|
if ( DrawStruct->m_Flags == 0 )
|
||||||
|
{
|
||||||
|
SaveCopyInUndoList(DrawStruct, IS_CHANGED);
|
||||||
|
RefreshToolBar = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
CmpRotationMiroir(
|
||||||
|
(EDA_SchComponentStruct *) DrawStruct, DC, CMP_ROTATE_COUNTERCLOCKWISE );
|
||||||
|
break;
|
||||||
|
|
||||||
case HK_BEGIN_WIRE: // Add wire
|
case DRAW_TEXT_STRUCT_TYPE:
|
||||||
if( DrawStruct ) // An item is selected. If edited and not a wire, a new command is not possible
|
case DRAW_LABEL_STRUCT_TYPE:
|
||||||
{
|
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||||
if( DrawStruct->m_Flags ) // Item selected and edition in progress
|
if ( DrawStruct->m_Flags == 0 )
|
||||||
{
|
{
|
||||||
if( DrawStruct->m_StructType == DRAW_SEGMENT_STRUCT_TYPE )
|
SaveCopyInUndoList(DrawStruct, IS_CHANGED);
|
||||||
{
|
RefreshToolBar = TRUE;
|
||||||
EDA_DrawLineStruct* segment = (EDA_DrawLineStruct*) DrawStruct;
|
}
|
||||||
if( segment->m_Layer != LAYER_WIRE )
|
ChangeTextOrient( (DrawTextStruct*)DrawStruct, DC);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// switch to m_ID_current_state = ID_WIRE_BUTT;
|
case HK_MIRROR_Y_COMPONENT: // Mirror Y (Component)
|
||||||
if( m_ID_current_state != ID_WIRE_BUTT )
|
if ( DrawStruct == NULL )
|
||||||
SetToolID( ID_WIRE_BUTT, wxCURSOR_PENCIL, _( "Add Wire" ) );
|
DrawStruct = LocateSmallestComponent( GetScreen() );
|
||||||
OnLeftClick( DC, MousePos );
|
if ( DrawStruct )
|
||||||
break;
|
{
|
||||||
|
if ( DrawStruct->m_Flags == 0 )
|
||||||
|
{
|
||||||
|
SaveCopyInUndoList(DrawStruct, IS_CHANGED);
|
||||||
|
RefreshToolBar = TRUE;
|
||||||
|
}
|
||||||
|
CmpRotationMiroir(
|
||||||
|
(EDA_SchComponentStruct *) DrawStruct, DC, CMP_MIROIR_Y );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case HK_ROTATE_COMPONENT: // Component Rotation
|
case HK_MIRROR_X_COMPONENT: // Mirror X (Component)
|
||||||
if( DrawStruct == NULL )
|
if ( DrawStruct == NULL )
|
||||||
{
|
DrawStruct = LocateSmallestComponent( GetScreen() );
|
||||||
DrawStruct = PickStruct( GetScreen()->m_Curseur,
|
if ( DrawStruct )
|
||||||
GetScreen()->EEDrawList, LIBITEM | TEXTITEM | LABELITEM );
|
{
|
||||||
if( DrawStruct == NULL )
|
if ( DrawStruct->m_Flags == 0 )
|
||||||
break;
|
{
|
||||||
if( DrawStruct->m_StructType == DRAW_LIB_ITEM_STRUCT_TYPE )
|
SaveCopyInUndoList(DrawStruct, IS_CHANGED);
|
||||||
DrawStruct = LocateSmallestComponent( GetScreen() );
|
RefreshToolBar = TRUE;
|
||||||
if( DrawStruct == NULL )
|
}
|
||||||
break;
|
CmpRotationMiroir(
|
||||||
}
|
(EDA_SchComponentStruct *) DrawStruct, DC, CMP_MIROIR_X );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
switch( DrawStruct->m_StructType )
|
case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component)
|
||||||
{
|
if ( DrawStruct == NULL )
|
||||||
case DRAW_LIB_ITEM_STRUCT_TYPE:
|
DrawStruct = LocateSmallestComponent( GetScreen() );
|
||||||
if( DrawStruct->m_Flags == 0 )
|
if ( DrawStruct )
|
||||||
{
|
{
|
||||||
SaveCopyInUndoList( DrawStruct, IS_CHANGED );
|
if ( DrawStruct->m_Flags == 0 )
|
||||||
RefreshToolBar = TRUE;
|
{
|
||||||
}
|
SaveCopyInUndoList(DrawStruct, IS_CHANGED);
|
||||||
|
RefreshToolBar = TRUE;
|
||||||
|
}
|
||||||
|
CmpRotationMiroir(
|
||||||
|
(EDA_SchComponentStruct *) DrawStruct, DC, CMP_NORMAL );
|
||||||
|
TestDanglingEnds(m_CurrentScreen->EEDrawList, DC);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
CmpRotationMiroir(
|
case HK_MOVE_COMPONENT: // Start move Component
|
||||||
(EDA_SchComponentStruct*) DrawStruct, DC, CMP_ROTATE_COUNTERCLOCKWISE );
|
if ( PopupOn ) break;
|
||||||
break;
|
if ( DrawStruct == NULL )
|
||||||
|
DrawStruct = LocateSmallestComponent( GetScreen() );
|
||||||
case DRAW_TEXT_STRUCT_TYPE:
|
if ( DrawStruct && (DrawStruct->m_Flags ==0) )
|
||||||
case DRAW_LABEL_STRUCT_TYPE:
|
{
|
||||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
m_CurrentScreen->SetCurItem(DrawStruct);
|
||||||
if( DrawStruct->m_Flags == 0 )
|
Process_Move_Item(m_CurrentScreen->GetCurItem(), DC);
|
||||||
{
|
}
|
||||||
SaveCopyInUndoList( DrawStruct, IS_CHANGED );
|
break;
|
||||||
RefreshToolBar = TRUE;
|
}
|
||||||
}
|
|
||||||
ChangeTextOrient( (DrawTextStruct*) DrawStruct, DC );
|
if ( RefreshToolBar ) SetToolbars();
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HK_MIRROR_Y_COMPONENT: // Mirror Y (Component)
|
|
||||||
if( DrawStruct == NULL )
|
|
||||||
DrawStruct = LocateSmallestComponent( GetScreen() );
|
|
||||||
if( DrawStruct )
|
|
||||||
{
|
|
||||||
if( DrawStruct->m_Flags == 0 )
|
|
||||||
{
|
|
||||||
SaveCopyInUndoList( DrawStruct, IS_CHANGED );
|
|
||||||
RefreshToolBar = TRUE;
|
|
||||||
}
|
|
||||||
CmpRotationMiroir(
|
|
||||||
(EDA_SchComponentStruct*) DrawStruct, DC, CMP_MIROIR_Y );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HK_MIRROR_X_COMPONENT: // Mirror X (Component)
|
|
||||||
if( DrawStruct == NULL )
|
|
||||||
DrawStruct = LocateSmallestComponent( GetScreen() );
|
|
||||||
if( DrawStruct )
|
|
||||||
{
|
|
||||||
if( DrawStruct->m_Flags == 0 )
|
|
||||||
{
|
|
||||||
SaveCopyInUndoList( DrawStruct, IS_CHANGED );
|
|
||||||
RefreshToolBar = TRUE;
|
|
||||||
}
|
|
||||||
CmpRotationMiroir(
|
|
||||||
(EDA_SchComponentStruct*) DrawStruct, DC, CMP_MIROIR_X );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component)
|
|
||||||
if( DrawStruct == NULL )
|
|
||||||
DrawStruct = LocateSmallestComponent( GetScreen() );
|
|
||||||
if( DrawStruct )
|
|
||||||
{
|
|
||||||
if( DrawStruct->m_Flags == 0 )
|
|
||||||
{
|
|
||||||
SaveCopyInUndoList( DrawStruct, IS_CHANGED );
|
|
||||||
RefreshToolBar = TRUE;
|
|
||||||
}
|
|
||||||
CmpRotationMiroir(
|
|
||||||
(EDA_SchComponentStruct*) DrawStruct, DC, CMP_NORMAL );
|
|
||||||
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HK_MOVE_COMPONENT: // Start move Component
|
|
||||||
if( PopupOn )
|
|
||||||
break;
|
|
||||||
if( DrawStruct == NULL )
|
|
||||||
DrawStruct = LocateSmallestComponent( GetScreen() );
|
|
||||||
if( DrawStruct && (DrawStruct->m_Flags ==0) )
|
|
||||||
{
|
|
||||||
m_CurrentScreen->SetCurItem( DrawStruct );
|
|
||||||
Process_Move_Item( m_CurrentScreen->GetCurItem(), DC );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( RefreshToolBar )
|
|
||||||
SetToolbars();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
|
void WinEDA_LibeditFrame::OnHotKey(wxDC * DC, int hotkey,
|
||||||
EDA_BaseStruct* DrawStruct )
|
EDA_BaseStruct * DrawStruct)
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
|
|
||||||
/* Hot keys for the component editot. Some commands are relatives to the item under the mouse cursor
|
/* Hot keys for the component editot. Some commands are relatives to the item under the mouse cursor
|
||||||
* Commands are case insensitive
|
Commands are case insensitive
|
||||||
* Zoom commands are not managed here
|
Zoom commands are not managed here
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
bool PopupOn = m_CurrentScreen->GetCurItem()
|
bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified
|
||||||
&& m_CurrentScreen->GetCurItem()->m_Flags;
|
|
||||||
|
if ( hotkey == 0 ) return;
|
||||||
|
|
||||||
bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified
|
wxPoint MousePos = m_CurrentScreen->m_MousePosition;
|
||||||
|
|
||||||
if( hotkey == 0 )
|
/* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */
|
||||||
return;
|
if( (hotkey >= 'a') && (hotkey <= 'z') ) hotkey += 'A' - 'a';
|
||||||
|
int CommandCode = GetCommandCodeFromHotkey(hotkey, s_LibEdit_Hotkey_List);
|
||||||
|
switch( CommandCode )
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case HK_NOT_FOUND:
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HK_HELP: // Display Current hotkey list
|
||||||
|
DisplayHotkeyList(this, s_LibEdit_Hotkey_List);
|
||||||
|
break;
|
||||||
|
|
||||||
wxPoint MousePos = m_CurrentScreen->m_MousePosition;
|
case HK_ZOOM_IN:
|
||||||
|
case HK_ZOOM_OUT:
|
||||||
|
case HK_ZOOM_REDRAW:
|
||||||
|
case HK_ZOOM_CENTER:
|
||||||
|
case HK_RESET_LOCAL_COORD:
|
||||||
|
break;
|
||||||
|
|
||||||
/* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */
|
case HK_REPEAT_LAST:
|
||||||
if( (hotkey >= 'a') && (hotkey <= 'z') )
|
if ( LibItemToRepeat && (LibItemToRepeat->m_Flags == 0) &&
|
||||||
hotkey += 'A' - 'a';
|
(LibItemToRepeat->m_StructType == COMPONENT_PIN_DRAW_TYPE) )
|
||||||
|
{
|
||||||
|
RepeatPinItem(DC, (LibDrawPin*) LibItemToRepeat);
|
||||||
|
}
|
||||||
|
else wxBell();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
switch( GetCommandCodeFromHotkey( hotkey, s_LibEdit_Hotkey_List ) )
|
if ( RefreshToolBar ) SetToolbars();
|
||||||
{
|
|
||||||
default:
|
|
||||||
case HK_NOT_FOUND:
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HK_HELP: // Display Current hotkey list
|
|
||||||
DisplayHotkeyList( this, s_LibEdit_Hotkey_List );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HK_ZOOM_IN:
|
|
||||||
case HK_ZOOM_OUT:
|
|
||||||
case HK_ZOOM_REDRAW:
|
|
||||||
case HK_ZOOM_CENTER:
|
|
||||||
case HK_RESET_LOCAL_COORD:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HK_REPEAT_LAST:
|
|
||||||
if( LibItemToRepeat && (LibItemToRepeat->m_Flags == 0)
|
|
||||||
&& (LibItemToRepeat->m_StructType == COMPONENT_PIN_DRAW_TYPE) )
|
|
||||||
{
|
|
||||||
RepeatPinItem( DC, (LibDrawPin*) LibItemToRepeat );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
wxBell();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( RefreshToolBar )
|
|
||||||
SetToolbars();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
COMMON_GLOBL wxString g_BuildVersion
|
COMMON_GLOBL wxString g_BuildVersion
|
||||||
#ifdef EDA_BASE
|
#ifdef EDA_BASE
|
||||||
(wxT("(2007-08-09)"))
|
(wxT("(2007-08-19)"))
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*******************/
|
||||||
|
/* hotkeys_basic.h */
|
||||||
|
/*******************/
|
||||||
|
|
||||||
|
/* Some functions to handle hotkeys in kicad
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HOTKEYS_BASIC_H
|
||||||
|
#define HOTKEYS_BASIC_H
|
||||||
|
|
||||||
|
/* 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)
|
||||||
|
*/
|
||||||
|
class Ki_HotkeyInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
int m_KeyCode; // Key code (ascii value for ascii keys or wxWidgets code for function key
|
||||||
|
wxString m_InfoMsg; // info message.
|
||||||
|
int m_Idcommand; // internal id for the corresponding command (see hotkey_id_commnand list)
|
||||||
|
|
||||||
|
public:
|
||||||
|
Ki_HotkeyInfo(const wxChar * infomsg, int idcommand, int keycode);
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Functions:
|
||||||
|
*/
|
||||||
|
wxString ReturnKeyNameFromKeyCode(int keycode);
|
||||||
|
void DisplayHotkeyList(WinEDA_DrawFrame * frame, Ki_HotkeyInfo ** List);
|
||||||
|
int GetCommandCodeFromHotkey(int key, Ki_HotkeyInfo ** List);
|
||||||
|
|
||||||
|
|
||||||
|
#endif // HOTKEYS_BASIC_H
|
||||||
|
|
Binary file not shown.
1957
internat/fr/kicad.po
1957
internat/fr/kicad.po
File diff suppressed because it is too large
Load Diff
|
@ -91,14 +91,13 @@ void RemoteCommand( const char* cmdline )
|
||||||
if( pad )
|
if( pad )
|
||||||
netcode = pad->m_NetCode;
|
netcode = pad->m_NetCode;
|
||||||
|
|
||||||
if( netcode > 0 )
|
if( netcode > 0 ) /* hightlighted the net selected net*/
|
||||||
{
|
{
|
||||||
/* effacement surbrillance ancienne */
|
if( g_HightLigt_Status ) /* erase the old hightlighted net */
|
||||||
if( g_HightLigt_Status )
|
|
||||||
frame->Hight_Light( &dc );
|
frame->Hight_Light( &dc );
|
||||||
|
|
||||||
g_HightLigth_NetCode = netcode;
|
g_HightLigth_NetCode = netcode;
|
||||||
frame->Hight_Light( &dc );
|
frame->Hight_Light( &dc ); /* hightlighted the new one */
|
||||||
|
|
||||||
frame->DrawPanel->CursorOff( &dc );
|
frame->DrawPanel->CursorOff( &dc );
|
||||||
frame->GetScreen()->m_Curseur = pad->m_Pos;
|
frame->GetScreen()->m_Curseur = pad->m_Pos;
|
||||||
|
@ -231,22 +230,6 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
SwitchLayer( DC, CUIVRE_N );
|
SwitchLayer( DC, CUIVRE_N );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'F' | GR_KB_CTRL:
|
|
||||||
case 'f' | GR_KB_CTRL:
|
|
||||||
DisplayOpt.DisplayPcbTrackFill ^= 1; DisplayOpt.DisplayPcbTrackFill &= 1;
|
|
||||||
GetScreen()->SetRefreshReq();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ' ': /* Mise a jour de l'origine des coord relatives */
|
|
||||||
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
case 'U' | GR_KB_CTRL:
|
|
||||||
case 'u' | GR_KB_CTRL:
|
|
||||||
g_UnitMetric = (g_UnitMetric == INCHES ) ? MILLIMETRE : INCHES;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EDA_PANNING_UP_KEY:
|
case EDA_PANNING_UP_KEY:
|
||||||
OnZoom( ID_ZOOM_PANNING_UP );
|
OnZoom( ID_ZOOM_PANNING_UP );
|
||||||
curpos = m_CurrentScreen->m_Curseur;
|
curpos = m_CurrentScreen->m_Curseur;
|
||||||
|
@ -401,6 +384,11 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( hotkey )
|
||||||
|
{
|
||||||
|
OnHotKey( DC, hotkey, NULL );
|
||||||
|
}
|
||||||
|
|
||||||
if( GetScreen()->IsRefreshReq() )
|
if( GetScreen()->IsRefreshReq() )
|
||||||
{
|
{
|
||||||
RedrawActiveWindow( DC, TRUE );
|
RedrawActiveWindow( DC, TRUE );
|
||||||
|
@ -408,9 +396,4 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
|
|
||||||
SetToolbars();
|
SetToolbars();
|
||||||
Affiche_Status_Box(); /* Affichage des coord curseur */
|
Affiche_Status_Box(); /* Affichage des coord curseur */
|
||||||
|
|
||||||
if( hotkey )
|
|
||||||
{
|
|
||||||
OnHotKey( DC, hotkey, NULL );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ void WinEDA_DrcFrame::CreateControls()
|
||||||
SetFont(*g_DialogFont);
|
SetFont(*g_DialogFont);
|
||||||
|
|
||||||
////@begin WinEDA_DrcFrame content construction
|
////@begin WinEDA_DrcFrame content construction
|
||||||
// Generated by DialogBlocks, 02/08/2007 10:11:17 (unregistered)
|
// Generated by DialogBlocks, 20/08/2007 08:58:05 (unregistered)
|
||||||
|
|
||||||
WinEDA_DrcFrame* itemDialog1 = this;
|
WinEDA_DrcFrame* itemDialog1 = this;
|
||||||
|
|
||||||
|
|
|
@ -52,8 +52,7 @@ class wxBoxSizer;
|
||||||
#define ID_BUTTON_BROWSE_RPT_FILE 10011
|
#define ID_BUTTON_BROWSE_RPT_FILE 10011
|
||||||
#define ID_TEXTCTRL_GET_RPT_FILENAME 10010
|
#define ID_TEXTCTRL_GET_RPT_FILENAME 10010
|
||||||
#define ID_TEXTCTRL 10001
|
#define ID_TEXTCTRL 10001
|
||||||
// #define SYMBOL_WINEDA_DRCFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
|
#define SYMBOL_WINEDA_DRCFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
|
||||||
#define SYMBOL_WINEDA_DRCFRAME_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX
|
|
||||||
#define SYMBOL_WINEDA_DRCFRAME_TITLE _("DRC Control")
|
#define SYMBOL_WINEDA_DRCFRAME_TITLE _("DRC Control")
|
||||||
#define SYMBOL_WINEDA_DRCFRAME_IDNAME ID_DIALOG
|
#define SYMBOL_WINEDA_DRCFRAME_IDNAME ID_DIALOG
|
||||||
#define SYMBOL_WINEDA_DRCFRAME_SIZE wxSize(400, 300)
|
#define SYMBOL_WINEDA_DRCFRAME_SIZE wxSize(400, 300)
|
||||||
|
|
|
@ -158,7 +158,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC* DC, boo
|
||||||
{
|
{
|
||||||
msg = wxT( "*" ) + PcbExtBuffer;
|
msg = wxT( "*" ) + PcbExtBuffer;
|
||||||
wxString FileName =
|
wxString FileName =
|
||||||
EDA_FileSelector( _( "Board files:" ),
|
EDA_FileSelector( _( "Load board files:" ),
|
||||||
wxEmptyString, /* Chemin par defaut */
|
wxEmptyString, /* Chemin par defaut */
|
||||||
GetScreen()->m_FileName, /* nom fichier par defaut */
|
GetScreen()->m_FileName, /* nom fichier par defaut */
|
||||||
PcbExtBuffer, /* extension par defaut */
|
PcbExtBuffer, /* extension par defaut */
|
||||||
|
@ -260,7 +260,7 @@ bool WinEDA_PcbFrame::SavePcbFile( const wxString& FileName )
|
||||||
if( FileName == wxEmptyString )
|
if( FileName == wxEmptyString )
|
||||||
{
|
{
|
||||||
msg = wxT( "*" ) + PcbExtBuffer;
|
msg = wxT( "*" ) + PcbExtBuffer;
|
||||||
FullFileName = EDA_FileSelector( _( "Board files:" ),
|
FullFileName = EDA_FileSelector( _( "Save board files:" ),
|
||||||
wxEmptyString, /* Chemin par defaut */
|
wxEmptyString, /* Chemin par defaut */
|
||||||
GetScreen()->m_FileName, /* nom fichier par defaut */
|
GetScreen()->m_FileName, /* nom fichier par defaut */
|
||||||
PcbExtBuffer, /* extension par defaut */
|
PcbExtBuffer, /* extension par defaut */
|
||||||
|
|
|
@ -9,29 +9,92 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "pcbnew.h"
|
#include "pcbnew.h"
|
||||||
#include "id.h"
|
#include "id.h"
|
||||||
|
#include "hotkeys_basic.h"
|
||||||
|
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
/* Routines locales */
|
/* Routines locales */
|
||||||
|
|
||||||
/* variables externes */
|
enum hotkey_id_commnand {
|
||||||
|
HK_NOT_FOUND = 0,
|
||||||
|
HK_RESET_LOCAL_COORD,
|
||||||
|
HK_HELP,
|
||||||
|
HK_ZOOM_IN,
|
||||||
|
HK_ZOOM_OUT,
|
||||||
|
HK_ZOOM_REDRAW,
|
||||||
|
HK_ZOOM_CENTER,
|
||||||
|
HK_DELETE,
|
||||||
|
HK_BACK_SPACE,
|
||||||
|
HK_ROTATE_FOOTPRINT,
|
||||||
|
HK_MOVE_FOOTPRINT,
|
||||||
|
HK_DRAG_FOOTPRINT,
|
||||||
|
HK_FLIP_FOOTPRINT,
|
||||||
|
HK_LOCK_UNLOCK_FOOTPRINT,
|
||||||
|
HK_ADD_VIA, HK_END_TRACK,
|
||||||
|
HK_SAVE_BOARD, HK_LOAD_BOARD,
|
||||||
|
HK_SWITCH_UNITS, HK_SWITCH_TRACK_DISPLAY_MODE,
|
||||||
|
HK_FIND_ITEM
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* local variables */
|
||||||
|
/* Hotkey list: */
|
||||||
|
static Ki_HotkeyInfo HkSavefile(wxT("Save board"), HK_SAVE_BOARD, 'S' + GR_KB_CTRL);
|
||||||
|
static Ki_HotkeyInfo HkLoadfile(wxT("Load board"), HK_LOAD_BOARD, 'L' + GR_KB_CTRL);
|
||||||
|
static Ki_HotkeyInfo HkFindItem(wxT("Find Item"), HK_FIND_ITEM, 'F' + GR_KB_CTRL);
|
||||||
|
static Ki_HotkeyInfo HkBackspace(wxT("Delete track segment"), HK_BACK_SPACE, WXK_BACK);
|
||||||
|
static Ki_HotkeyInfo HkAddVia(wxT("Add Via"), HK_ADD_VIA, 'V');
|
||||||
|
static Ki_HotkeyInfo HkEndTrack(wxT("End Track"), HK_END_TRACK, WXK_END);
|
||||||
|
static Ki_HotkeyInfo HkFlipFootprint(wxT("Flip Footprint"), HK_FLIP_FOOTPRINT, 'F');
|
||||||
|
static Ki_HotkeyInfo HkRotateFootprint(wxT("Rotate Footprint"), HK_ROTATE_FOOTPRINT, 'R');
|
||||||
|
static Ki_HotkeyInfo HkMoveFootprint(wxT("Move Footprint"), HK_MOVE_FOOTPRINT, 'M');
|
||||||
|
static Ki_HotkeyInfo HkDragFootprint(wxT("Drag Footprint"), HK_DRAG_FOOTPRINT, 'G');
|
||||||
|
static Ki_HotkeyInfo HkLock_Unlock_Footprint(wxT("Lock/Unlock Footprint"), HK_LOCK_UNLOCK_FOOTPRINT, 'L');
|
||||||
|
static Ki_HotkeyInfo HkDelete(wxT("Delete Track or Footprint"), HK_DELETE, WXK_DELETE);
|
||||||
|
static Ki_HotkeyInfo HkResetLocalCoord(wxT("Reset local coord."), HK_RESET_LOCAL_COORD, ' ');
|
||||||
|
static Ki_HotkeyInfo HkZoomCenter(wxT("Zoom Center"), HK_ZOOM_CENTER, WXK_F4);
|
||||||
|
static Ki_HotkeyInfo HkZoomRedraw(wxT("Zoom Redraw"), HK_ZOOM_REDRAW, WXK_F3);
|
||||||
|
static Ki_HotkeyInfo HkZoomOut(wxT("Zoom Out"), HK_ZOOM_OUT, WXK_F2);
|
||||||
|
static Ki_HotkeyInfo HkZoomIn(wxT("Zoom In"), HK_ZOOM_IN, WXK_F1);
|
||||||
|
static Ki_HotkeyInfo HkHelp(wxT("Help: this message"), HK_HELP, '?');
|
||||||
|
static Ki_HotkeyInfo HkSwitchUnits(wxT("Switch Units"), HK_SWITCH_UNITS, 'U');
|
||||||
|
static Ki_HotkeyInfo HkTrackDisplayMode(wxT("Track Display Mode"), HK_SWITCH_TRACK_DISPLAY_MODE, 'F');
|
||||||
|
|
||||||
|
|
||||||
|
// List of hotkey descriptors for pcbnew
|
||||||
|
static Ki_HotkeyInfo *s_board_edit_Hotkey_List[] = {
|
||||||
|
&HkHelp,
|
||||||
|
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
|
||||||
|
&HkResetLocalCoord, &HkSwitchUnits, &HkTrackDisplayMode,
|
||||||
|
&HkDelete, &HkBackspace,
|
||||||
|
&HkAddVia, &HkEndTrack,
|
||||||
|
&HkMoveFootprint, &HkFlipFootprint,
|
||||||
|
&HkRotateFootprint, &HkDragFootprint,
|
||||||
|
&HkLock_Unlock_Footprint,
|
||||||
|
&HkSavefile, &HkLoadfile, &HkFindItem,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static Ki_HotkeyInfo *s_module_edit_Hotkey_List[] = {
|
||||||
|
&HkHelp,
|
||||||
|
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
|
||||||
|
&HkSwitchUnits, &HkResetLocalCoord,
|
||||||
|
&HkDelete, &HkBackspace,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
|
void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
|
||||||
EDA_BaseStruct* DrawStruct )
|
EDA_BaseStruct* DrawStruct )
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
|
/* Hot keys. Some commands are relatives to the item under the mouse cursor
|
||||||
|
Commands are case insensitive
|
||||||
|
Zoom commands are not managed here
|
||||||
|
*/
|
||||||
|
|
||||||
/* Gestion des commandes rapides (Raccourcis claviers) concernant l'element
|
|
||||||
* sous le courseur souris
|
|
||||||
* Les majuscules/minuscules sont indifferenciees
|
|
||||||
* touche DELETE: Effacement (Module ou piste selon commande en cours)
|
|
||||||
* touche V: Place via en cours de trace de piste
|
|
||||||
* touche R: Rotation module
|
|
||||||
* touche S: Change couche module (Composant <-> Cuivre)
|
|
||||||
* touche M: Start Move module
|
|
||||||
* touche G: Start Drag module
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
|
|
||||||
bool PopupOn = GetScreen()->GetCurItem()
|
bool PopupOn = GetScreen()->GetCurItem()
|
||||||
&& GetScreen()->GetCurItem()->m_Flags;
|
&& GetScreen()->GetCurItem()->m_Flags;
|
||||||
|
|
||||||
|
@ -41,194 +104,216 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
|
||||||
if( hotkey == 0 )
|
if( hotkey == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// code Ctrl A = 1, Ctr B = 2 ..., remapped, (more easy to understand in switch)
|
|
||||||
if( hotkey & GR_KB_CTRL )
|
|
||||||
hotkey += 'A' - 1;
|
|
||||||
|
|
||||||
MODULE* module = NULL;
|
MODULE* module = NULL;
|
||||||
|
|
||||||
if( hotkey <= 0xFF )
|
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to handle...)
|
||||||
hotkey = toupper( hotkey );
|
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 */
|
||||||
switch( hotkey )
|
if( (hotkey >= 'a') && (hotkey <= 'z') ) hotkey += 'A' - 'a';
|
||||||
|
|
||||||
|
int CommandCode = GetCommandCodeFromHotkey(hotkey, s_board_edit_Hotkey_List);
|
||||||
|
switch( CommandCode )
|
||||||
{
|
{
|
||||||
case WXK_DELETE:
|
default:
|
||||||
case WXK_NUMPAD_DELETE:
|
case HK_NOT_FOUND:
|
||||||
OnHotkeyDeleteItem( DC, DrawStruct );
|
return;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case HK_HELP: // Display Current hotkey list
|
||||||
|
DisplayHotkeyList(this, s_board_edit_Hotkey_List);
|
||||||
|
break;
|
||||||
|
|
||||||
case WXK_BACK:
|
case HK_ZOOM_IN:
|
||||||
if( m_ID_current_state == ID_TRACK_BUTT && GetScreen()->m_Active_Layer <= CMP_N )
|
case HK_ZOOM_OUT:
|
||||||
{
|
case HK_ZOOM_REDRAW:
|
||||||
bool ItemFree = (GetScreen()->GetCurItem() == NULL )
|
case HK_ZOOM_CENTER:
|
||||||
|| (GetScreen()->GetCurItem()->m_Flags == 0);
|
break;
|
||||||
if( ItemFree )
|
|
||||||
{
|
|
||||||
// no track is currently being edited - select a segment and remove it.
|
|
||||||
DrawStruct = PcbGeneralLocateAndDisplay();
|
|
||||||
|
|
||||||
// don't let backspace delete modules!!
|
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */
|
||||||
if( DrawStruct && (DrawStruct->m_StructType == TYPETRACK
|
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
|
||||||
|| DrawStruct->m_StructType == TYPEVIA) )
|
break;
|
||||||
Delete_Segment( DC, (TRACK*) DrawStruct );
|
|
||||||
GetScreen()->SetModify();
|
|
||||||
}
|
|
||||||
else if( GetScreen()->GetCurItem()->m_StructType == TYPETRACK )
|
|
||||||
{
|
|
||||||
// then an element is being edited - remove the last segment.
|
|
||||||
GetScreen()->SetCurItem(
|
|
||||||
Delete_Segment( DC, (TRACK*) GetScreen()->GetCurItem() ) );
|
|
||||||
GetScreen()->SetModify();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WXK_END:
|
|
||||||
DrawPanel->MouseToCursorSchema();
|
|
||||||
End_Route( (TRACK*) (GetScreen()->GetCurItem()), DC );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'F' + GR_KB_CTRL:
|
case HK_SWITCH_UNITS:
|
||||||
{
|
g_UnitMetric = (g_UnitMetric == INCHES ) ? MILLIMETRE : INCHES;
|
||||||
wxCommandEvent evt;
|
break;
|
||||||
evt.SetId( ID_FIND_ITEMS );
|
|
||||||
Process_Special_Functions( evt );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'O' + GR_KB_CTRL:
|
case HK_SWITCH_TRACK_DISPLAY_MODE:
|
||||||
{
|
DisplayOpt.DisplayPcbTrackFill ^= 1; DisplayOpt.DisplayPcbTrackFill &= 1;
|
||||||
// try not to duplicate save, load code etc.
|
GetScreen()->SetRefreshReq();
|
||||||
wxCommandEvent evt;
|
break;
|
||||||
evt.SetId( ID_LOAD_FILE );
|
|
||||||
Files_io( evt );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'S' + GR_KB_CTRL:
|
case HK_DELETE:
|
||||||
{
|
OnHotkeyDeleteItem( DC, DrawStruct );
|
||||||
// try not to duplicate save, load code etc.
|
break;
|
||||||
wxCommandEvent evt;
|
|
||||||
evt.SetId( ID_SAVE_BOARD );
|
|
||||||
Files_io( evt );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'V': // Switch to alternate layer and Place a via if a track is in progress
|
case HK_BACK_SPACE:
|
||||||
if( m_ID_current_state != ID_TRACK_BUTT )
|
if( m_ID_current_state == ID_TRACK_BUTT && GetScreen()->m_Active_Layer <= CMP_N )
|
||||||
return;
|
{
|
||||||
if( ItemFree )
|
bool ItemFree = (GetScreen()->GetCurItem() == NULL )
|
||||||
{
|
|| (GetScreen()->GetCurItem()->m_Flags == 0);
|
||||||
Other_Layer_Route( NULL, DC );
|
if( ItemFree )
|
||||||
break;
|
{
|
||||||
}
|
// no track is currently being edited - select a segment and remove it.
|
||||||
if( GetScreen()->GetCurItem()->m_StructType != TYPETRACK )
|
DrawStruct = PcbGeneralLocateAndDisplay();
|
||||||
return;
|
|
||||||
if( (GetScreen()->GetCurItem()->m_Flags & IS_NEW) == 0 )
|
|
||||||
return;
|
|
||||||
Other_Layer_Route( (TRACK*) GetScreen()->GetCurItem(), DC );
|
|
||||||
if( DisplayOpt.ContrastModeDisplay )
|
|
||||||
GetScreen()->SetRefreshReq();
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Footprint edition:
|
// don't let backspace delete modules!!
|
||||||
case 'L': // toggle module "MODULE_is_LOCKED" status:
|
if( DrawStruct && (DrawStruct->m_StructType == TYPETRACK
|
||||||
// get any module, locked or not locked and toggle its locked status
|
|| DrawStruct->m_StructType == TYPEVIA) )
|
||||||
if( ItemFree )
|
Delete_Segment( DC, (TRACK*) DrawStruct );
|
||||||
module = Locate_Prefered_Module( m_Pcb, CURSEUR_OFF_GRILLE | VISIBLE_ONLY );
|
GetScreen()->SetModify();
|
||||||
else if( GetScreen()->GetCurItem()->m_StructType == TYPEMODULE )
|
}
|
||||||
module = (MODULE*) GetScreen()->GetCurItem();
|
else if( GetScreen()->GetCurItem()->m_StructType == TYPETRACK )
|
||||||
if( module )
|
{
|
||||||
{
|
// then an element is being edited - remove the last segment.
|
||||||
GetScreen()->SetCurItem( module );
|
GetScreen()->SetCurItem(Delete_Segment( DC, (TRACK*) GetScreen()->GetCurItem() ) );
|
||||||
module->SetLocked( !module->IsLocked() );
|
GetScreen()->SetModify();
|
||||||
module->Display_Infos( this );
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'G': // Start move (and drag) module
|
case HK_END_TRACK:
|
||||||
case 'M': // Start move module
|
DrawPanel->MouseToCursorSchema();
|
||||||
if( PopupOn )
|
End_Route( (TRACK*) (GetScreen()->GetCurItem()), DC );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'R': // Rotation
|
case HK_FIND_ITEM:
|
||||||
case 'S': // move to other side
|
{
|
||||||
if( ItemFree )
|
wxCommandEvent evt;
|
||||||
{
|
evt.SetId( ID_FIND_ITEMS );
|
||||||
module = Locate_Prefered_Module( m_Pcb,
|
Process_Special_Functions( evt );
|
||||||
CURSEUR_OFF_GRILLE | IGNORE_LOCKED | VISIBLE_ONLY
|
}
|
||||||
#if defined (USE_MATCH_LAYER)
|
break;
|
||||||
| MATCH_LAYER
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
if( module == NULL ) // no footprint found
|
|
||||||
{
|
|
||||||
module = Locate_Prefered_Module( m_Pcb, CURSEUR_OFF_GRILLE );
|
|
||||||
if( module )
|
|
||||||
{
|
|
||||||
// a footprint is found, but locked or on an other layer
|
|
||||||
if( module->IsLocked() )
|
|
||||||
{
|
|
||||||
wxString msg;
|
|
||||||
|
|
||||||
msg.Printf( _("Footprint %s found, but locked"),
|
|
||||||
module->m_Reference->m_Text.GetData() );
|
|
||||||
|
|
||||||
DisplayInfo( this, msg );
|
|
||||||
}
|
|
||||||
module = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( GetScreen()->GetCurItem()->m_StructType == TYPEMODULE )
|
|
||||||
{
|
|
||||||
module = (MODULE*) GetScreen()->GetCurItem();
|
|
||||||
|
|
||||||
// @todo: might need to add a layer check in if() below
|
case HK_LOAD_BOARD:
|
||||||
if( (GetScreen()->GetCurItem()->m_Flags == 0)
|
{
|
||||||
&& module->IsLocked() )
|
// try not to duplicate save, load code etc.
|
||||||
module = NULL; // do not move, rotate ... it.
|
wxCommandEvent evt;
|
||||||
}
|
evt.SetId( ID_LOAD_FILE );
|
||||||
if( module == NULL )
|
Files_io( evt );
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
/* I'd like to make sending to EESCHEMA edge triggered, but the
|
case HK_SAVE_BOARD:
|
||||||
simple mouse click on a module when the arrow icon is in play
|
{
|
||||||
does not set m_CurrentItem at this time, nor does a mouse click
|
// try not to duplicate save, load code etc.
|
||||||
when the local ratsnest icon is in play set m_CurrentItem, and these
|
wxCommandEvent evt;
|
||||||
actions also call SendMessageToEESCHEMA().
|
evt.SetId( ID_SAVE_BOARD );
|
||||||
if( GetScreen()->GetCurItem() != module )
|
Files_io( evt );
|
||||||
*/
|
}
|
||||||
{
|
break;
|
||||||
// Send the module via socket to EESCHEMA's search facility.
|
|
||||||
SendMessageToEESCHEMA( module );
|
|
||||||
|
|
||||||
GetScreen()->SetCurItem( module );
|
|
||||||
}
|
|
||||||
|
|
||||||
switch( hotkey )
|
case HK_ADD_VIA: // Switch to alternate layer and Place a via if a track is in progress
|
||||||
{
|
if( m_ID_current_state != ID_TRACK_BUTT )
|
||||||
case 'R': // Rotation
|
return;
|
||||||
Rotate_Module( DC, module, 900, TRUE );
|
if( ItemFree )
|
||||||
break;
|
{
|
||||||
|
Other_Layer_Route( NULL, DC );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if( GetScreen()->GetCurItem()->m_StructType != TYPETRACK )
|
||||||
|
return;
|
||||||
|
if( (GetScreen()->GetCurItem()->m_Flags & IS_NEW) == 0 )
|
||||||
|
return;
|
||||||
|
Other_Layer_Route( (TRACK*) GetScreen()->GetCurItem(), DC );
|
||||||
|
if( DisplayOpt.ContrastModeDisplay )
|
||||||
|
GetScreen()->SetRefreshReq();
|
||||||
|
break;
|
||||||
|
|
||||||
case 'S': // move to other side
|
// Footprint edition:
|
||||||
Change_Side_Module( module, DC );
|
case HK_LOCK_UNLOCK_FOOTPRINT: // toggle module "MODULE_is_LOCKED" status:
|
||||||
break;
|
// get any module, locked or not locked and toggle its locked status
|
||||||
|
if( ItemFree )
|
||||||
|
module = Locate_Prefered_Module( m_Pcb, CURSEUR_OFF_GRILLE | VISIBLE_ONLY );
|
||||||
|
else if( GetScreen()->GetCurItem()->m_StructType == TYPEMODULE )
|
||||||
|
module = (MODULE*) GetScreen()->GetCurItem();
|
||||||
|
if( module )
|
||||||
|
{
|
||||||
|
GetScreen()->SetCurItem(module);
|
||||||
|
module->SetLocked( !module->IsLocked() );
|
||||||
|
module->Display_Infos( this );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 'G': // Start move (and drag) module
|
case HK_DRAG_FOOTPRINT: // Start move (and drag) module
|
||||||
g_Drag_Pistes_On = TRUE;
|
case HK_MOVE_FOOTPRINT: // Start move module
|
||||||
|
if( PopupOn )
|
||||||
|
break;
|
||||||
|
|
||||||
// fall through
|
case HK_ROTATE_FOOTPRINT: // Rotation
|
||||||
|
case HK_FLIP_FOOTPRINT: // move to other side
|
||||||
|
if( ItemFree )
|
||||||
|
{
|
||||||
|
module = Locate_Prefered_Module( m_Pcb,
|
||||||
|
CURSEUR_OFF_GRILLE | IGNORE_LOCKED | VISIBLE_ONLY
|
||||||
|
#if defined (USE_MATCH_LAYER)
|
||||||
|
| MATCH_LAYER
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
if( module == NULL ) // no footprint found
|
||||||
|
{
|
||||||
|
module = Locate_Prefered_Module( m_Pcb, CURSEUR_OFF_GRILLE );
|
||||||
|
if( module )
|
||||||
|
{
|
||||||
|
// a footprint is found, but locked or on an other layer
|
||||||
|
if( module->IsLocked() )
|
||||||
|
{
|
||||||
|
wxString msg;
|
||||||
|
|
||||||
|
msg.Printf( _("Footprint %s found, but locked"),
|
||||||
|
module->m_Reference->m_Text.GetData() );
|
||||||
|
|
||||||
|
DisplayInfo( this, msg );
|
||||||
|
}
|
||||||
|
module = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( GetScreen()->GetCurItem()->m_StructType == TYPEMODULE )
|
||||||
|
{
|
||||||
|
module = (MODULE*) GetScreen()->GetCurItem();
|
||||||
|
|
||||||
case 'M': // Start move module
|
// @todo: might need to add a layer check in if() below
|
||||||
StartMove_Module( module, DC );
|
if( (GetScreen()->GetCurItem()->m_Flags == 0)
|
||||||
break;
|
&& module->IsLocked() )
|
||||||
}
|
module = NULL; // do not move, rotate ... it.
|
||||||
|
}
|
||||||
|
if( module == NULL )
|
||||||
|
break;
|
||||||
|
|
||||||
module->Display_Infos( this );
|
/* I'd like to make sending to EESCHEMA edge triggered, but the
|
||||||
|
simple mouse click on a module when the arrow icon is in play
|
||||||
|
does not set GetCurItem() at this time, nor does a mouse click
|
||||||
|
when the local ratsnest icon is in play set GetCurItem(), and these
|
||||||
|
actions also call SendMessageToEESCHEMA().
|
||||||
|
if( GetScreen()->GetCurItem() != module )
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
// Send the module via socket to EESCHEMA's search facility.
|
||||||
|
SendMessageToEESCHEMA( module );
|
||||||
|
|
||||||
|
GetScreen()->SetCurItem(module);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
switch( CommandCode )
|
||||||
|
{
|
||||||
|
case HK_ROTATE_FOOTPRINT: // Rotation
|
||||||
|
Rotate_Module( DC, module, 900, TRUE );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HK_FLIP_FOOTPRINT: // move to other side
|
||||||
|
Change_Side_Module( module, DC );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HK_DRAG_FOOTPRINT: // Start move (and drag) module
|
||||||
|
g_Drag_Pistes_On = TRUE;
|
||||||
|
// fall through
|
||||||
|
case HK_MOVE_FOOTPRINT: // Start move module
|
||||||
|
StartMove_Module( module, DC );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
module->Display_Infos( this );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,41 +328,38 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* DC, int hotkey,
|
||||||
* Les majuscules/minuscules sont indifferenciees
|
* Les majuscules/minuscules sont indifferenciees
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
bool PopupOn = GetScreen()->GetCurItem()
|
|
||||||
&& GetScreen()->GetCurItem()->m_Flags;
|
|
||||||
|
|
||||||
if( hotkey == 0 )
|
if( hotkey == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch( hotkey )
|
/* 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';
|
||||||
|
|
||||||
|
int CommandCode = GetCommandCodeFromHotkey(hotkey, s_module_edit_Hotkey_List);
|
||||||
|
switch( CommandCode )
|
||||||
{
|
{
|
||||||
case WXK_DELETE:
|
default:
|
||||||
case WXK_NUMPAD_DELETE:
|
case HK_NOT_FOUND:
|
||||||
if( PopupOn )
|
return;
|
||||||
break;
|
break;
|
||||||
break;
|
|
||||||
|
case HK_HELP: // Display Current hotkey list
|
||||||
|
DisplayHotkeyList(this, s_module_edit_Hotkey_List);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'r': // Rotation
|
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */
|
||||||
case 'R':
|
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'y': // Mirror Y (drawlibpart)
|
|
||||||
case 'Y':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'x': // Mirror X (drawlibpart)
|
case HK_SWITCH_UNITS:
|
||||||
case 'X':
|
g_UnitMetric = (g_UnitMetric == INCHES ) ? MILLIMETRE : INCHES;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'n':
|
case HK_ZOOM_IN:
|
||||||
case 'N': // Orient 0, no mirror (drawlibpart)
|
case HK_ZOOM_OUT:
|
||||||
break;
|
case HK_ZOOM_REDRAW:
|
||||||
|
case HK_ZOOM_CENTER:
|
||||||
case 'm':
|
break;
|
||||||
case 'M': // Start move drawlibpart
|
|
||||||
if( PopupOn )
|
|
||||||
break;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,7 +394,7 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct )
|
||||||
else if( GetScreen()->GetCurItem()->m_StructType == TYPETRACK )
|
else if( GetScreen()->GetCurItem()->m_StructType == TYPETRACK )
|
||||||
{
|
{
|
||||||
GetScreen()->SetCurItem(
|
GetScreen()->SetCurItem(
|
||||||
Delete_Segment( DC, (TRACK*) GetScreen()->GetCurItem() ));
|
Delete_Segment( DC, (TRACK*) GetScreen()->GetCurItem() ) );
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -337,6 +419,6 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct )
|
||||||
}
|
}
|
||||||
|
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
GetScreen()->SetCurItem( NULL );
|
GetScreen()->SetCurItem(NULL);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue