Commit 9414bf67 authored by CHARRAS's avatar CHARRAS

more work on hotkeys

parent 040e2cbf
......@@ -4,6 +4,17 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
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>
================================================================================
......
......@@ -29,15 +29,13 @@ wxString HOSTNAME( wxT( "localhost" ) );
// buffers for read and write data in socket connections
#define IPC_BUF_SIZE 4096
char client_ipc_buffer[IPC_BUF_SIZE];
char server_ipc_buffer[IPC_BUF_SIZE];
static char client_ipc_buffer[IPC_BUF_SIZE];
static char server_ipc_buffer[IPC_BUF_SIZE];
wxServer* server;
static wxServer* server;
void (*RemoteFct)(const char* cmd);
char buffcar[1024];
void SetupServerFunction( void (*remotefct)(const char* remotecmd) )
{
RemoteFct = remotefct;
......
/*********************/
/* 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_plotPS_functions.o\
common_plotHPGL_functions.o\
hotkeys_basic.o\
drawtxt.o \
wxwineda.o \
string.o \
......@@ -43,6 +44,8 @@ gr_basic.o: gr_basic.cpp ../include/gr_basic.h $(DEPEND)
confirm.o: confirm.cpp $(COMMON)
hotkeys_basic.o: hotkeys_basic.cpp ../include/hotkeys_basic.h $(COMMON)
worksheet.o: worksheet.cpp ../include/worksheet.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 composant in libraries, a marker ...,
* Search a text (text, value, reference) within a component or
* search a component in libraries, a marker ...,
* in current sheet or whole the project
*/
#include "fctsys.h"
......@@ -40,7 +40,7 @@ void InstallFindFrame( WinEDA_SchematicFrame* parent, wxPoint& pos )
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
* 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.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)
|| (curpos.y <= 0) || (curpos.y >= size.y) || force_recadre )
{
......@@ -289,9 +289,9 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
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;
firstpos = pos;
......@@ -340,9 +340,9 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
force_recadre = TRUE;
}
/* Si la struct localisee est du type DRAW_LIB_ITEM_STRUCT_TYPE,
* Les coordonnes sont a recalculer en fonction de la matrice
* d'orientation */
/* If the struct found is a DRAW_LIB_ITEM_STRUCT_TYPE type,
* coordinates must be computed according to its orientation matrix
*/
if( Struct->m_StructType == DRAW_LIB_ITEM_STRUCT_TYPE )
{
EDA_SchComponentStruct* pSch = (EDA_SchComponentStruct*) Struct;
......
This diff is collapsed.
......@@ -5,7 +5,7 @@
COMMON_GLOBL wxString g_BuildVersion
#ifdef EDA_BASE
(wxT("(2007-08-09)"))
(wxT("(2007-08-19)"))
#endif
;
......
/*******************/
/* 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
No preview for this file type
This diff is collapsed.
......@@ -91,14 +91,13 @@ void RemoteCommand( const char* cmdline )
if( pad )
netcode = pad->m_NetCode;
if( netcode > 0 )
if( netcode > 0 ) /* hightlighted the net selected net*/
{
/* effacement surbrillance ancienne */
if( g_HightLigt_Status )
if( g_HightLigt_Status ) /* erase the old hightlighted net */
frame->Hight_Light( &dc );
g_HightLigth_NetCode = netcode;
frame->Hight_Light( &dc );
frame->Hight_Light( &dc ); /* hightlighted the new one */
frame->DrawPanel->CursorOff( &dc );
frame->GetScreen()->m_Curseur = pad->m_Pos;
......@@ -231,22 +230,6 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
SwitchLayer( DC, CUIVRE_N );
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:
OnZoom( ID_ZOOM_PANNING_UP );
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() )
{
RedrawActiveWindow( DC, TRUE );
......@@ -408,9 +396,4 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
SetToolbars();
Affiche_Status_Box(); /* Affichage des coord curseur */
if( hotkey )
{
OnHotKey( DC, hotkey, NULL );
}
}
......@@ -128,7 +128,7 @@ void WinEDA_DrcFrame::CreateControls()
SetFont(*g_DialogFont);
////@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;
......
......@@ -52,8 +52,7 @@ class wxBoxSizer;
#define ID_BUTTON_BROWSE_RPT_FILE 10011
#define ID_TEXTCTRL_GET_RPT_FILENAME 10010
#define ID_TEXTCTRL 10001
// #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_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
#define SYMBOL_WINEDA_DRCFRAME_TITLE _("DRC Control")
#define SYMBOL_WINEDA_DRCFRAME_IDNAME ID_DIALOG
#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;
wxString FileName =
EDA_FileSelector( _( "Board files:" ),
EDA_FileSelector( _( "Load board files:" ),
wxEmptyString, /* Chemin par defaut */
GetScreen()->m_FileName, /* nom fichier par defaut */
PcbExtBuffer, /* extension par defaut */
......@@ -260,7 +260,7 @@ bool WinEDA_PcbFrame::SavePcbFile( const wxString& FileName )
if( FileName == wxEmptyString )
{
msg = wxT( "*" ) + PcbExtBuffer;
FullFileName = EDA_FileSelector( _( "Board files:" ),
FullFileName = EDA_FileSelector( _( "Save board files:" ),
wxEmptyString, /* Chemin par defaut */
GetScreen()->m_FileName, /* nom fichier par defaut */
PcbExtBuffer, /* extension par defaut */
......
This diff is collapsed.
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