small change on hotkey management. Added: drag component

This commit is contained in:
CHARRAS 2007-09-22 14:31:20 +00:00
parent 3e3ae8925a
commit ba04f83247
15 changed files with 825 additions and 681 deletions

View File

@ -4,6 +4,18 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2007-sept-22 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ all
* small change in hotkeys handling
(Ki_HotkeyInfo: new member m_IdMenuEvent to call an existing event handler from a hotkey list)
+ eeschema:
* added drag component in pop up menu and hotkeys
* plot svg format: incorrect arc draw fixed
2007-Sep-22 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+ pcbnew

View File

@ -166,10 +166,11 @@ char Line[256];
void PlotPolyPS(int nb_segm, int * coord, int fill, int width)
/*****************************************************************/
/* Trace un polygone ( ferme si rempli ) en format POSTSCRIPT
* coord = tableau des coord des sommets
* nb_segm = nombre de coord ( 1 coord = 2 elements: X et Y du tableau )
* fill : si != 0 polygone rempli
/* Draw a polygon ( a filled polygon if fill == 1 ) in POSTSCRIPT format
* @param nb_segm = corner count
* @param coord = corner list (a corner uses 2 int = X coordinate followed by Y coordinate
* @param fill :if == 0 : filled polygon
* @param width = line width
*/
{
int ii;

File diff suppressed because it is too large Load Diff

View File

@ -18,11 +18,12 @@
* This class allows the real key code changed by user from a key code list file
*/
Ki_HotkeyInfo::Ki_HotkeyInfo( const wxChar* infomsg, int idcommand, int keycode )
Ki_HotkeyInfo::Ki_HotkeyInfo( const wxChar* infomsg, int idcommand, int keycode, int idmenuevent )
{
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)
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)
m_IdMenuEvent = idmenuevent; // id to call the corresponding event (if any) (see id.h)
}
@ -37,101 +38,101 @@ struct hotkey_name_descr
static struct hotkey_name_descr s_Hotkey_Name_List[] =
{
{ wxT( "F1" ), WXK_F1 },
{ wxT( "F2" ), WXK_F2 },
{ wxT( "F3" ), WXK_F3 },
{ wxT( "F4" ), WXK_F4 },
{ wxT( "F5" ), WXK_F5 },
{ wxT( "F6" ), WXK_F6 },
{ wxT( "F7" ), WXK_F7 },
{ wxT( "F8" ), WXK_F8 },
{ wxT( "F9" ), WXK_F9 },
{ wxT( "F10" ), WXK_F10 },
{ wxT( "F11" ), WXK_F11 },
{ wxT( "F12" ), WXK_F12 },
{ wxT( "F1" ), WXK_F1 },
{ wxT( "F2" ), WXK_F2 },
{ wxT( "F3" ), WXK_F3 },
{ wxT( "F4" ), WXK_F4 },
{ wxT( "F5" ), WXK_F5 },
{ wxT( "F6" ), WXK_F6 },
{ wxT( "F7" ), WXK_F7 },
{ wxT( "F8" ), WXK_F8 },
{ wxT( "F9" ), WXK_F9 },
{ wxT( "F10" ), WXK_F10 },
{ wxT( "F11" ), WXK_F11 },
{ wxT( "F12" ), WXK_F12 },
{ wxT( "Esc" ), WXK_ESCAPE },
{ wxT( "Delete" ), WXK_DELETE },
{ wxT( "Esc" ), WXK_ESCAPE },
{ wxT( "Tab" ), '\t' },
{ wxT( "Esc" ), WXK_ESCAPE },
{ wxT( "Delete" ), WXK_DELETE },
{ wxT( "Esc" ), WXK_ESCAPE },
{ wxT( "Tab" ), '\t' },
{ wxT( "Backspace" ), WXK_BACK },
{ wxT( "Insert" ), WXK_INSERT },
{ wxT( "Insert" ), WXK_INSERT },
{ wxT( "End" ), WXK_END },
{ wxT( "Page Up" ), WXK_PAGEUP },
{ wxT( "End" ), WXK_END },
{ wxT( "Page Up" ), WXK_PAGEUP },
{ wxT( "Page Down" ), WXK_PAGEDOWN },
{ wxT( "+" ), WXK_ADD },
{ wxT( "-" ), WXK_SUBTRACT },
{ wxT( "+" ), WXK_ADD },
{ wxT( "-" ), WXK_SUBTRACT },
{ wxT( "Up" ), WXK_UP },
{ wxT( "Down" ), WXK_DOWN },
{ wxT( "Left" ), WXK_LEFT },
{ wxT( "Right" ), WXK_RIGHT },
{ wxT( "Up" ), WXK_UP },
{ wxT( "Down" ), WXK_DOWN },
{ wxT( "Left" ), WXK_LEFT },
{ wxT( "Right" ), WXK_RIGHT },
{ wxT( "space" ), ' ' },
{ wxT( "?" ), '?' },
{ wxT( "!" ), '!' },
{ wxT( ":" ), ':' },
{ wxT( "," ), ',' },
{ wxT( "*" ), '*' },
{ wxT( "+" ), '+' },
{ wxT( "-" ), '-' },
{ wxT( "\%" ), '%' },
{ wxT( "A" ), 'A' },
{ wxT( "B" ), 'B' },
{ wxT( "C" ), 'C' },
{ wxT( "D" ), 'D' },
{ wxT( "E" ), 'E' },
{ wxT( "F" ), 'F' },
{ wxT( "G" ), 'G' },
{ wxT( "H" ), 'H' },
{ wxT( "I" ), 'I' },
{ wxT( "J" ), 'J' },
{ wxT( "K" ), 'K' },
{ wxT( "L" ), 'L' },
{ wxT( "M" ), 'M' },
{ wxT( "N" ), 'N' },
{ wxT( "O" ), 'O' },
{ wxT( "P" ), 'P' },
{ wxT( "Q" ), 'Q' },
{ wxT( "R" ), 'R' },
{ wxT( "S" ), 'S' },
{ wxT( "T" ), 'T' },
{ wxT( "U" ), 'U' },
{ wxT( "V" ), 'V' },
{ wxT( "W" ), 'W' },
{ wxT( "X" ), 'X' },
{ wxT( "Y" ), 'Y' },
{ wxT( "Z" ), 'Z' },
{ wxT( "space" ), ' ' },
{ wxT( "?" ), '?' },
{ wxT( "!" ), '!' },
{ wxT( ":" ), ':' },
{ wxT( "," ), ',' },
{ wxT( "*" ), '*' },
{ wxT( "+" ), '+' },
{ wxT( "-" ), '-' },
{ wxT( "\%" ), '%' },
{ wxT( "A" ), 'A' },
{ wxT( "B" ), 'B' },
{ wxT( "C" ), 'C' },
{ wxT( "D" ), 'D' },
{ wxT( "E" ), 'E' },
{ wxT( "F" ), 'F' },
{ wxT( "G" ), 'G' },
{ wxT( "H" ), 'H' },
{ wxT( "I" ), 'I' },
{ wxT( "J" ), 'J' },
{ wxT( "K" ), 'K' },
{ wxT( "L" ), 'L' },
{ wxT( "M" ), 'M' },
{ wxT( "N" ), 'N' },
{ wxT( "O" ), 'O' },
{ wxT( "P" ), 'P' },
{ wxT( "Q" ), 'Q' },
{ wxT( "R" ), 'R' },
{ wxT( "S" ), 'S' },
{ wxT( "T" ), 'T' },
{ wxT( "U" ), 'U' },
{ wxT( "V" ), 'V' },
{ wxT( "W" ), 'W' },
{ wxT( "X" ), 'X' },
{ wxT( "Y" ), 'Y' },
{ wxT( "Z" ), 'Z' },
{ wxT( "Ctrl A" ), GR_KB_CTRL + 'A' },
{ wxT( "Ctrl B" ), GR_KB_CTRL + 'B' },
{ wxT( "Ctrl C" ), GR_KB_CTRL + 'C' },
{ wxT( "Ctrl D" ), GR_KB_CTRL + 'D' },
{ wxT( "Ctrl E" ), GR_KB_CTRL + 'E' },
{ wxT( "Ctrl F" ), GR_KB_CTRL + 'F' },
{ wxT( "Ctrl G" ), GR_KB_CTRL + 'G' },
{ wxT( "Ctrl H" ), GR_KB_CTRL + 'H' },
{ wxT( "Ctrl I" ), GR_KB_CTRL + 'I' },
{ wxT( "Ctrl J" ), GR_KB_CTRL + 'J' },
{ wxT( "Ctrl K" ), GR_KB_CTRL + 'K' },
{ wxT( "Ctrl L" ), GR_KB_CTRL + 'L' },
{ wxT( "Ctrl M" ), GR_KB_CTRL + 'M' },
{ wxT( "Ctrl N" ), GR_KB_CTRL + 'N' },
{ wxT( "Ctrl O" ), GR_KB_CTRL + 'O' },
{ wxT( "Ctrl P" ), GR_KB_CTRL + 'P' },
{ wxT( "Ctrl Q" ), GR_KB_CTRL + 'Q' },
{ wxT( "Ctrl R" ), GR_KB_CTRL + 'R' },
{ wxT( "Ctrl S" ), GR_KB_CTRL + 'S' },
{ wxT( "Ctrl T" ), GR_KB_CTRL + 'T' },
{ wxT( "Ctrl U" ), GR_KB_CTRL + 'U' },
{ wxT( "Ctrl V" ), GR_KB_CTRL + 'V' },
{ wxT( "Ctrl W" ), GR_KB_CTRL + 'W' },
{ wxT( "Ctrl X" ), GR_KB_CTRL + 'X' },
{ wxT( "Ctrl Y" ), GR_KB_CTRL + 'Y' },
{ wxT( "Ctrl Z" ), GR_KB_CTRL + 'Z' },
{ wxT( "Ctrl A" ), GR_KB_CTRL + 'A' },
{ wxT( "Ctrl B" ), GR_KB_CTRL + 'B' },
{ wxT( "Ctrl C" ), GR_KB_CTRL + 'C' },
{ wxT( "Ctrl D" ), GR_KB_CTRL + 'D' },
{ wxT( "Ctrl E" ), GR_KB_CTRL + 'E' },
{ wxT( "Ctrl F" ), GR_KB_CTRL + 'F' },
{ wxT( "Ctrl G" ), GR_KB_CTRL + 'G' },
{ wxT( "Ctrl H" ), GR_KB_CTRL + 'H' },
{ wxT( "Ctrl I" ), GR_KB_CTRL + 'I' },
{ wxT( "Ctrl J" ), GR_KB_CTRL + 'J' },
{ wxT( "Ctrl K" ), GR_KB_CTRL + 'K' },
{ wxT( "Ctrl L" ), GR_KB_CTRL + 'L' },
{ wxT( "Ctrl M" ), GR_KB_CTRL + 'M' },
{ wxT( "Ctrl N" ), GR_KB_CTRL + 'N' },
{ wxT( "Ctrl O" ), GR_KB_CTRL + 'O' },
{ wxT( "Ctrl P" ), GR_KB_CTRL + 'P' },
{ wxT( "Ctrl Q" ), GR_KB_CTRL + 'Q' },
{ wxT( "Ctrl R" ), GR_KB_CTRL + 'R' },
{ wxT( "Ctrl S" ), GR_KB_CTRL + 'S' },
{ wxT( "Ctrl T" ), GR_KB_CTRL + 'T' },
{ wxT( "Ctrl U" ), GR_KB_CTRL + 'U' },
{ wxT( "Ctrl V" ), GR_KB_CTRL + 'V' },
{ wxT( "Ctrl W" ), GR_KB_CTRL + 'W' },
{ wxT( "Ctrl X" ), GR_KB_CTRL + 'X' },
{ wxT( "Ctrl Y" ), GR_KB_CTRL + 'Y' },
{ wxT( "Ctrl Z" ), GR_KB_CTRL + 'Z' },
{ wxT( "" ), 0 } // Do not change: end of list
{ wxT( "" ), 0 } // Do not change: end of list
};
@ -315,25 +316,25 @@ void DisplayHotkeyList( WinEDA_DrawFrame* frame, struct Ki_HotkeyInfoSectionDesc
}
/******************************************************************/
int GetCommandCodeFromHotkey( int key, Ki_HotkeyInfo** List )
/******************************************************************/
/************************************************************************/
Ki_HotkeyInfo* GetDescriptorFromHotkey( int key, Ki_HotkeyInfo** List )
/***********************************************************************/
/*
* Return an id identifier fron a key code for OnHotKey() function
* Return a Ki_HotkeyInfo * pointer 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
* @return the corresponding Ki_HotkeyInfo * pointer 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_decr;
}
return 0;
return NULL;
}
@ -606,8 +607,9 @@ void AddHotkeyConfigMenu( wxMenu* menu )
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" ) );
_( "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,
@ -623,64 +625,67 @@ void AddHotkeyConfigMenu( wxMenu* menu )
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 );
_( "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 );
_( "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,
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( menu, submenu_hkcfg,
-1,
_( "Hotkey config location" ),
_( "Hotkey config file location selection (home directory or kicad tree)" ),
_( "Hotkey config location" ),
_(
"Hotkey config file location selection (home directory or kicad tree)" ),
right_xpm );
submenu_hkcfg->Check(ID_PREFERENCES_HOTKEY_PATH_IS_HOME,
g_ConfigFileLocationChoice == 0);
submenu_hkcfg->Check(ID_PREFERENCES_HOTKEY_PATH_IS_KICAD,
g_ConfigFileLocationChoice == 1);
submenu_hkcfg->Check( ID_PREFERENCES_HOTKEY_PATH_IS_HOME,
g_ConfigFileLocationChoice == 0 );
submenu_hkcfg->Check( ID_PREFERENCES_HOTKEY_PATH_IS_KICAD,
g_ConfigFileLocationChoice == 1 );
}
/************************************************************************/
void HandleHotkeyConfigMenuSelection( WinEDA_DrawFrame * frame, int id )
void HandleHotkeyConfigMenuSelection( WinEDA_DrawFrame* frame, int id )
/************************************************************************/
/* called on hotkey file location selecton menu
* @param frame = current WinEDA_DrawFrame
* @param id = selected menu id
* @return g_ConfigFileLocationChoice (global) = new selection
*/
* @param frame = current WinEDA_DrawFrame
* @param id = selected menu id
* @return g_ConfigFileLocationChoice (global) = new selection
*/
{
wxMenuBar * menu = frame->GetMenuBar();
switch (id )
{
case ID_PREFERENCES_HOTKEY_PATH_IS_HOME:
if ( g_ConfigFileLocationChoice != 0 )
{
g_ConfigFileLocationChoice = 0;
menu->Check(ID_PREFERENCES_HOTKEY_PATH_IS_HOME, true);
menu->Check(ID_PREFERENCES_HOTKEY_PATH_IS_KICAD, false);
frame->m_Parent->m_EDA_CommonConfig->Write(HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice);
}
break;
wxMenuBar* menu = frame->GetMenuBar();
case ID_PREFERENCES_HOTKEY_PATH_IS_KICAD:
if ( g_ConfigFileLocationChoice != 1 )
{
g_ConfigFileLocationChoice = 1;
menu->Check(ID_PREFERENCES_HOTKEY_PATH_IS_HOME, false);
menu->Check(ID_PREFERENCES_HOTKEY_PATH_IS_KICAD, true);
frame->m_Parent->m_EDA_CommonConfig->Write(HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice);
}
break;
default:
break;
}
switch( id )
{
case ID_PREFERENCES_HOTKEY_PATH_IS_HOME:
if( g_ConfigFileLocationChoice != 0 )
{
g_ConfigFileLocationChoice = 0;
menu->Check( ID_PREFERENCES_HOTKEY_PATH_IS_HOME, true );
menu->Check( ID_PREFERENCES_HOTKEY_PATH_IS_KICAD, false );
frame->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;
menu->Check( ID_PREFERENCES_HOTKEY_PATH_IS_HOME, false );
menu->Check( ID_PREFERENCES_HOTKEY_PATH_IS_KICAD, true );
frame->m_Parent->m_EDA_CommonConfig->Write( HOTKEY_CFG_PATH_OPT,
g_ConfigFileLocationChoice );
}
break;
default:
break;
}
}

View File

@ -15,7 +15,7 @@
#include "colors.h"
// Define print format d to display a schematic component line
#define CMP_FORMAT wxT("%3d %+8s - %+16s : %-.32s")
#define CMP_FORMAT wxT("%3d %8s - %16s : %-.32s")
#define FILTERFOOTPRINTKEY "FilterFootprint"

View File

@ -27,7 +27,7 @@
* add the HkMyNewEntry pointer in the s_Schematic_Hotkey_List list or the s_LibEdit_Hotkey_List list
* ( or s_Common_Hotkey_List if the same command is added both in eeschema and libedit)
* Add the new code in the switch in OnHotKey() function.
* when the variable PopupOn is true, an item is currently edited.
* when the variable ItemInEdit is true, an item is currently edited.
* This can be usefull if the new function cannot be executed while an item is currently being edited
* ( For example, one cannot start a new wire when a component is moving.)
*
@ -48,8 +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' );
static Ki_HotkeyInfo HkUndo( wxT( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z', (int)ID_SCHEMATIC_UNDO );
static Ki_HotkeyInfo HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y', (int)ID_SCHEMATIC_REDO );
// Schematic editor
static Ki_HotkeyInfo HkBeginWire( wxT( "begin Wire" ), HK_BEGIN_WIRE, 'W' );
@ -62,7 +62,8 @@ static Ki_HotkeyInfo HkOrientNormalComponent( wxT(
"Orient Normal Component" ),
HK_ORIENT_NORMAL_COMPONENT, 'N' );
static Ki_HotkeyInfo HkRotateComponent( wxT( "Rotate Component" ), HK_ROTATE_COMPONENT, 'R' );
static Ki_HotkeyInfo HkMoveComponent( wxT( "Move Component" ), HK_MOVE_COMPONENT, 'M' );
static Ki_HotkeyInfo HkMoveComponent( wxT( "Move Component" ), HK_MOVE_COMPONENT, 'M', ID_POPUP_SCH_MOVE_CMP_REQUEST );
static Ki_HotkeyInfo HkDragComponent( wxT( "Drag Component" ), HK_DRAG_COMPONENT, 'G', ID_POPUP_SCH_DRAG_CMP_REQUEST );
static Ki_HotkeyInfo HkMove2Drag( wxT(
"Switch move block to drag block" ),
HK_MOVEBLOCK_TO_DRAGBLOCK, '\t' );
@ -80,7 +81,7 @@ Ki_HotkeyInfo* s_Common_Hotkey_List[] =
&HkHelp,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
&HkResetLocalCoord,
&HkUndo, &HkRedo,
&HkUndo, &HkRedo,
NULL
};
@ -88,7 +89,7 @@ Ki_HotkeyInfo* s_Common_Hotkey_List[] =
Ki_HotkeyInfo* s_Schematic_Hotkey_List[] = {
&HkNextSearch,
&HkDelete, &HkInsert, &HkMove2Drag,
&HkMoveComponent, &HkAddComponent,
&HkMoveComponent, &HkDragComponent, &HkAddComponent,
&HkRotateComponent, &HkMirrorXComponent, &HkMirrorYComponent, &HkOrientNormalComponent,
&HkBeginWire,
NULL
@ -135,7 +136,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
* Commands are case insensitive
*/
{
bool PopupOn = m_CurrentScreen->GetCurItem()
bool ItemInEdit = m_CurrentScreen->GetCurItem()
&& m_CurrentScreen->GetCurItem()->m_Flags;
bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified
@ -152,11 +153,12 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
hotkey += 'A' - 'a';
// Search command from key :
int CommandCode = GetCommandCodeFromHotkey( hotkey, s_Common_Hotkey_List );
if( CommandCode == HK_NOT_FOUND )
CommandCode = GetCommandCodeFromHotkey( hotkey, s_Schematic_Hotkey_List );
Ki_HotkeyInfo * HK_Descr = GetDescriptorFromHotkey( hotkey, s_Common_Hotkey_List );
if( HK_Descr == NULL )
HK_Descr = GetDescriptorFromHotkey( hotkey, s_Schematic_Hotkey_List );
if( HK_Descr == NULL ) return;
switch( CommandCode )
switch( HK_Descr->m_Idcommand )
{
default:
case HK_NOT_FOUND:
@ -188,25 +190,22 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
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;
if( ItemInEdit )
break;
{
wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, HK_Descr->m_IdMenuEvent );
wxPostEvent( this, event );
}
break;
case HK_MOVEBLOCK_TO_DRAGBLOCK: // Switch to drag mode, when block moving
HandleBlockEndByPopUp( BLOCK_DRAG, DC );
break;
case HK_DELETE:
if( PopupOn )
if( ItemInEdit )
break;
RefreshToolBar = LocateAndDeleteItem( this, DC );
m_CurrentScreen->SetModify();
@ -215,23 +214,25 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
break;
case HK_REPEAT_LAST:
if( ItemInEdit )
break;
if( g_ItemToRepeat && (g_ItemToRepeat->m_Flags == 0) )
{
RepeatDrawItem( DC );
}
else
wxBell();
break;
case HK_NEXT_SEARCH:
if( g_LastSearchIsMarker )
if( ItemInEdit )
break;
if( g_LastSearchIsMarker )
WinEDA_SchematicFrame::FindMarker( 1 );
else
FindSchematicItem( wxEmptyString, 2 );
break;
case HK_ADD_NEW_COMPONENT: // Add component
if( DrawStruct && DrawStruct->m_Flags )
if( ItemInEdit )
break;
// switch to m_ID_current_state = ID_COMPONENT_BUTT;
@ -351,15 +352,18 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
}
break;
case HK_MOVE_COMPONENT: // Start move Component
if( PopupOn )
case HK_DRAG_COMPONENT: // Start drag Component
case HK_MOVE_COMPONENT: // Start move Component
if( ItemInEdit )
break;
if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( GetScreen() );
if( DrawStruct && (DrawStruct->m_Flags ==0) )
{
m_CurrentScreen->SetCurItem( DrawStruct );
Process_Move_Item( m_CurrentScreen->GetCurItem(), DC );
wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, HK_Descr->m_IdMenuEvent );
wxPostEvent( this, event );
}
break;
}
@ -378,6 +382,8 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
* Commands are case insensitive
*/
{
bool ItemInEdit = m_CurrentScreen->GetCurItem()
&& m_CurrentScreen->GetCurItem()->m_Flags;
bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified
if( hotkey == 0 )
@ -391,11 +397,12 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int 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_Common_Hotkey_List );
if( CommandCode == HK_NOT_FOUND )
CommandCode = GetCommandCodeFromHotkey( hotkey, s_LibEdit_Hotkey_List );
Ki_HotkeyInfo * HK_Descr = GetDescriptorFromHotkey( hotkey, s_Common_Hotkey_List );
if( HK_Descr == NULL )
HK_Descr = GetDescriptorFromHotkey( hotkey, s_LibEdit_Hotkey_List );
if( HK_Descr == NULL ) return;
switch( CommandCode )
switch( HK_Descr->m_Idcommand )
{
default:
case HK_NOT_FOUND:
@ -426,19 +433,16 @@ 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_UNDO:
case HK_REDO:
if( ItemInEdit )
break;
{
wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, HK_Descr->m_IdMenuEvent );
case HK_REDO:
{
wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, ID_LIBEDIT_REDO);
wxPostEvent(this, event);
}
break;
wxPostEvent( this, event );
}
break;
case HK_REPEAT_LAST:
if( LibItemToRepeat && (LibItemToRepeat->m_Flags == 0)

View File

@ -25,6 +25,7 @@ enum hotkey_id_commnand {
HK_MIRROR_Y_COMPONENT,
HK_ORIENT_NORMAL_COMPONENT,
HK_MOVE_COMPONENT,
HK_DRAG_COMPONENT,
HK_ADD_NEW_COMPONENT,
HK_BEGIN_WIRE
};

View File

@ -284,6 +284,9 @@ void AddMenusForComponent( wxMenu* PopMenu, EDA_SchComponentStruct* Component )
msg = AddHotkeyName( _( "Move Component" ), s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_CMP_REQUEST,
msg, move_xpm );
msg = AddHotkeyName( _( "Drag Component" ), s_Schematic_Hokeys_Descr, HK_DRAG_COMPONENT );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST,
msg, move_xpm );
}
// add menu orient et sous menu:

View File

@ -53,6 +53,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_MOVE_PINSHEET:
case ID_POPUP_SCH_MOVE_ITEM_REQUEST:
case ID_POPUP_SCH_MOVE_CMP_REQUEST:
case ID_POPUP_SCH_DRAG_CMP_REQUEST:
case ID_POPUP_SCH_EDIT_CMP:
case ID_POPUP_SCH_MIROR_X_CMP:
case ID_POPUP_SCH_MIROR_Y_CMP:
@ -486,21 +487,27 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
m_CurrentScreen->GetCurItem(), &dc );
break;
case ID_POPUP_SCH_DRAG_CMP_REQUEST:
case ID_POPUP_SCH_MOVE_CMP_REQUEST:
// Ensure the struct is a component (could be a struct of a component, like Field, text..)
if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
if( m_CurrentScreen->GetCurItem() == NULL )
break;
case ID_POPUP_SCH_MOVE_ITEM_REQUEST:
DrawPanel->MouseToCursorSchema();
Process_Move_Item( m_CurrentScreen->GetCurItem(), &dc );
if ( id == ID_POPUP_SCH_DRAG_CMP_REQUEST )
{ // The easiest way to handle a drag component is simulate a block drag command
if( GetScreen()->BlockLocate.m_State == STATE_NO_BLOCK )
{
if( !HandleBlockBegin( &dc, BLOCK_DRAG, GetScreen()->m_Curseur ) ) break;
HandleBlockEnd( &dc );
}
}
else Process_Move_Item( m_CurrentScreen->GetCurItem(), &dc );
break;
case ID_POPUP_SCH_EDIT_CMP:
// Ensure the struct is a component (could be a struct of a component, like Field, text..)
if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );

View File

@ -91,9 +91,10 @@ void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey,
if( (hotkey >= 'a') && (hotkey <= 'z') )
hotkey += 'A' - 'a';
int CommandCode = GetCommandCodeFromHotkey( hotkey, s_Gerbview_Hotkey_List );
Ki_HotkeyInfo * HK_Descr = GetDescriptorFromHotkey( hotkey, s_Gerbview_Hotkey_List );
if( HK_Descr == NULL ) return;
switch( CommandCode )
switch( HK_Descr->m_Idcommand )
{
default:
case HK_NOT_FOUND:

View File

@ -5,7 +5,7 @@
COMMON_GLOBL wxString g_BuildVersion
#ifdef EDA_BASE
(wxT("(2007-09-19)"))
(wxT("(2007-09-22)"))
#endif
;

View File

@ -15,11 +15,11 @@
#define DEFAULT_HOTKEY_FILENAME_EXT wxT( ".key" )
/* define default path for config key file */
#define DEFAULT_HOTKEY_FILENAME_PATH_IS_HOME wxGetHomeDir() + wxT( "/" )
#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")
#define HOTKEY_CFG_PATH_OPT wxT( "HotkeyPathOption" )
/* Class to handle hotkey commnands. hotkeys have a default value
@ -31,9 +31,10 @@ 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)
int m_IdMenuEvent; // id to call the corresponding event (if any) (see id.h)
public:
Ki_HotkeyInfo( const wxChar* infomsg, int idcommand, int keycode );
Ki_HotkeyInfo( const wxChar* infomsg, int idcommand, int keycode, int idmenuevent = 0 );
};
/* handle a Section name and the corresponding list of hotkeys (Ki_HotkeyInfo list)
@ -84,24 +85,24 @@ COMMON_GLOBL wxString g_ModuleEditSectionTag
;
COMMON_GLOBL int g_ConfigFileLocationChoice; /* 0 = files are in Home directory (usefull under unix)
* 1 = kicad/template ( usefull only under windows )
* 2 ... = unused
* 1 = kicad/template ( usefull only under windows )
* 2 ... = unused
*/
/* Functions:
*/
wxString ReturnHotkeyConfigFilePath( int choice );
void AddHotkeyConfigMenu( wxMenu* menu );
void HandleHotkeyConfigMenuSelection( WinEDA_DrawFrame * frame, int id );
wxString ReturnKeyNameFromKeyCode( int keycode );
wxString ReturnKeyNameFromCommandId( Ki_HotkeyInfo** List, int CommandId );
wxString AddHotkeyName( const wxString& text, Ki_HotkeyInfo** List, int CommandId );
wxString AddHotkeyName( const wxString& text,
struct Ki_HotkeyInfoSectionDescriptor* DescrList,
int CommandId );
void DisplayHotkeyList( WinEDA_DrawFrame* frame,
struct Ki_HotkeyInfoSectionDescriptor* List );
int GetCommandCodeFromHotkey( int key, Ki_HotkeyInfo** List );
wxString ReturnHotkeyConfigFilePath( int choice );
void AddHotkeyConfigMenu( wxMenu* menu );
void HandleHotkeyConfigMenuSelection( WinEDA_DrawFrame* frame, int id );
wxString ReturnKeyNameFromKeyCode( int keycode );
wxString ReturnKeyNameFromCommandId( Ki_HotkeyInfo** List, int CommandId );
wxString AddHotkeyName( const wxString& text, Ki_HotkeyInfo** List, int CommandId );
wxString AddHotkeyName( const wxString& text,
struct Ki_HotkeyInfoSectionDescriptor* DescrList,
int CommandId );
void DisplayHotkeyList( WinEDA_DrawFrame* frame,
struct Ki_HotkeyInfoSectionDescriptor* List );
Ki_HotkeyInfo* GetDescriptorFromHotkey( int key, Ki_HotkeyInfo** List );
#endif // HOTKEYS_BASIC_H

View File

@ -282,7 +282,7 @@ enum main_id {
ID_POPUP_SCH_DELETE_NODE,
ID_POPUP_SCH_MOVE_CMP_REQUEST,
ID_POPUP_SCH_DELETE_CMP,
ID_POPUP_SCH_UNUSED_0,
ID_POPUP_SCH_DRAG_CMP_REQUEST,
ID_POPUP_SCH_UNUSED_1,
ID_POPUP_SCH_UNUSED_2,
ID_POPUP_SCH_ENTRY_SELECT_SLASH,

View File

@ -25,9 +25,9 @@ KICAD_TEMPLATE=$(KICAD_DATA)/template
else
# used by myself (JP Charras) to build a statically linked distribution intalled in /usr/local (with STD_INSTALL = 0)
PREFIX = /usr/local/linux
KICAD_BIN = $(PREFIX)/bin
KICAD_PLUGINS = $(PREFIX)/linux/plugins
PREFIX = /usr/local/kicad
KICAD_BIN = $(PREFIX)/linux
KICAD_PLUGINS = $(KICAD_BIN)/plugins
KICAD_DOCS=$(PREFIX)/help
KICAD_DATA=$(PREFIX)
KICAD_MODULES=$(KICAD_DATA)/modules
@ -121,12 +121,15 @@ ifeq ($(KICAD_STATIC_LINK), 1)
LIBS3D = $(WXPATH)/$(PREFIX_WX_LIBS)$(SUFFIX_WX_LIBGL)\
$(MESALIBSPATH)/libGL.a $(MESALIBSPATH)/libGLU.a
AUXLIB = -lXxf86vm
#AUXLIB = /usr/X11R6/lib/libXinerama.a
WXSYSLIB= $(WXPATH)/$(PREFIX_WX_LIBS)-$(LIBVERSION).a \
$(WXPATH)/libwxpng-$(LIBVERSION).a\
$(WXPATH)/libwxjpeg-$(LIBVERSION).a\
$(WXPATH)/libwxzlib-$(LIBVERSION).a\
$(LIBREGEX)\
/usr/X11R6/lib/libXinerama.a \
$(AUXLIB)\
-lgtk-x11-2.0 -lgdk-x11-2.0 \
-latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lgthread-2.0\
-lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl\
@ -134,18 +137,8 @@ WXSYSLIB= $(WXPATH)/$(PREFIX_WX_LIBS)-$(LIBVERSION).a \
-L/usr/lib $(PYLIBS)
WXSYSLIB_WITH_GL= $(WXPATH)/$(PREFIX_WX_LIBS)-$(LIBVERSION).a \
$(WXPATH)/libwxpng-$(LIBVERSION).a\
$(WXPATH)/libwxjpeg-$(LIBVERSION).a\
$(WXPATH)/libwxzlib-$(LIBVERSION).a\
$(LIBS3D)\
/usr/X11R6/lib/libXinerama.a \
/usr/X11R6/lib/libXxf86vm.a \
-lgtk-x11-2.0 -lgdk-x11-2.0 \
-latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lgthread-2.0\
-lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl\
-lglib-2.0 -lpangoft2-1.0 -lSM\
-L/usr/lib $(PYLIBS)
WXSYSLIB_WITH_GL= $(WXSYSLIB) $(LIBS3D)
else
ifeq ($(DEBUG), 1)

View File

@ -186,12 +186,14 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
if( (hotkey >= 'a') && (hotkey <= 'z') )
hotkey += 'A' - 'a';
int CommandCode = GetCommandCodeFromHotkey( hotkey, s_Common_Hotkey_List );
if( CommandCode == HK_NOT_FOUND )
CommandCode = GetCommandCodeFromHotkey( hotkey, s_board_edit_Hotkey_List );
Ki_HotkeyInfo * HK_Descr = GetDescriptorFromHotkey( hotkey, s_Common_Hotkey_List );
if( HK_Descr == NULL )
HK_Descr = GetDescriptorFromHotkey( hotkey, s_board_edit_Hotkey_List );
if( HK_Descr == NULL ) return;
int ll;
switch( CommandCode )
switch( HK_Descr->m_Idcommand )
{
default:
case HK_NOT_FOUND:
@ -465,7 +467,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
SetCurItem( module );
}
switch( CommandCode )
switch( HK_Descr->m_Idcommand )
{
case HK_ROTATE_FOOTPRINT: // Rotation
Rotate_Module( DC, module, 900, TRUE );
@ -506,11 +508,12 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* DC, int hotkey,
if( (hotkey >= 'a') && (hotkey <= 'z') )
hotkey += 'A' - 'a';
int CommandCode = GetCommandCodeFromHotkey( hotkey, s_Common_Hotkey_List );
if( CommandCode == HK_NOT_FOUND )
CommandCode = GetCommandCodeFromHotkey( hotkey, s_module_edit_Hotkey_List );
Ki_HotkeyInfo * HK_Descr = GetDescriptorFromHotkey( hotkey, s_Common_Hotkey_List );
if( HK_Descr == NULL )
HK_Descr = GetDescriptorFromHotkey( hotkey, s_module_edit_Hotkey_List );
if( HK_Descr == NULL ) return;
switch( CommandCode )
switch( HK_Descr->m_Idcommand )
{
default:
case HK_NOT_FOUND: