Commit ba04f832 authored by CHARRAS's avatar CHARRAS

small change on hotkey management. Added: drag component

parent 3e3ae892
...@@ -4,6 +4,18 @@ Started 2007-June-11 ...@@ -4,6 +4,18 @@ 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-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> 2007-Sep-22 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
+ pcbnew + pcbnew
......
...@@ -166,10 +166,11 @@ char Line[256]; ...@@ -166,10 +166,11 @@ char Line[256];
void PlotPolyPS(int nb_segm, int * coord, int fill, int width) void PlotPolyPS(int nb_segm, int * coord, int fill, int width)
/*****************************************************************/ /*****************************************************************/
/* Trace un polygone ( ferme si rempli ) en format POSTSCRIPT /* Draw a polygon ( a filled polygon if fill == 1 ) in POSTSCRIPT format
* coord = tableau des coord des sommets * @param nb_segm = corner count
* nb_segm = nombre de coord ( 1 coord = 2 elements: X et Y du tableau ) * @param coord = corner list (a corner uses 2 int = X coordinate followed by Y coordinate
* fill : si != 0 polygone rempli * @param fill :if == 0 : filled polygon
* @param width = line width
*/ */
{ {
int ii; int ii;
......
This diff is collapsed.
...@@ -18,11 +18,12 @@ ...@@ -18,11 +18,12 @@
* This class allows the real key code changed by user from a key code list file * 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_KeyCode = keycode; // Key code (ascii value for ascii keys or wxWidgets code for function key
m_InfoMsg = infomsg; // info message. m_InfoMsg = infomsg; // info message.
m_Idcommand = idcommand; // internal id for the corresponding command (see hotkey_id_commnand list) 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)
} }
...@@ -315,25 +316,25 @@ void DisplayHotkeyList( WinEDA_DrawFrame* frame, struct Ki_HotkeyInfoSectionDesc ...@@ -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 key = key code (ascii value, or wxWidgets value for function keys
* @param List = pointer to a Ki_HotkeyInfo list of commands * @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++ ) for( ; *List != NULL; List++ )
{ {
Ki_HotkeyInfo* hk_decr = *List; Ki_HotkeyInfo* hk_decr = *List;
if( hk_decr->m_KeyCode == key ) if( hk_decr->m_KeyCode == key )
return hk_decr->m_Idcommand; return hk_decr;
} }
return 0; return NULL;
} }
...@@ -607,7 +608,8 @@ void AddHotkeyConfigMenu( wxMenu* menu ) ...@@ -607,7 +608,8 @@ void AddHotkeyConfigMenu( wxMenu* menu )
return; return;
item = new wxMenuItem( menu, ID_PREFERENCES_CREATE_CONFIG_HOTKEYS, item = new wxMenuItem( menu, ID_PREFERENCES_CREATE_CONFIG_HOTKEYS,
_( "Create Hotkey config file" ), _( "Create Hotkey config file" ),
_( "Create or Recreate the hotkey config file from current hotkey list" ) ); _( "Create or Recreate the hotkey config file from current hotkey list" )
);
item->SetBitmap( save_setup_xpm ); item->SetBitmap( save_setup_xpm );
menu->Append( item ); menu->Append( item );
item = new wxMenuItem( menu, ID_PREFERENCES_READ_CONFIG_HOTKEYS, item = new wxMenuItem( menu, ID_PREFERENCES_READ_CONFIG_HOTKEYS,
...@@ -637,45 +639,49 @@ void AddHotkeyConfigMenu( wxMenu* menu ) ...@@ -637,45 +639,49 @@ void AddHotkeyConfigMenu( wxMenu* menu )
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( menu, submenu_hkcfg, ADD_MENUITEM_WITH_HELP_AND_SUBMENU( menu, submenu_hkcfg,
-1, -1,
_( "Hotkey config location" ), _( "Hotkey config location" ),
_( "Hotkey config file location selection (home directory or kicad tree)" ), _(
"Hotkey config file location selection (home directory or kicad tree)" ),
right_xpm ); right_xpm );
submenu_hkcfg->Check(ID_PREFERENCES_HOTKEY_PATH_IS_HOME, submenu_hkcfg->Check( ID_PREFERENCES_HOTKEY_PATH_IS_HOME,
g_ConfigFileLocationChoice == 0); g_ConfigFileLocationChoice == 0 );
submenu_hkcfg->Check(ID_PREFERENCES_HOTKEY_PATH_IS_KICAD, submenu_hkcfg->Check( ID_PREFERENCES_HOTKEY_PATH_IS_KICAD,
g_ConfigFileLocationChoice == 1); g_ConfigFileLocationChoice == 1 );
} }
/************************************************************************/ /************************************************************************/
void HandleHotkeyConfigMenuSelection( WinEDA_DrawFrame * frame, int id ) void HandleHotkeyConfigMenuSelection( WinEDA_DrawFrame* frame, int id )
/************************************************************************/ /************************************************************************/
/* called on hotkey file location selecton menu /* called on hotkey file location selecton menu
* @param frame = current WinEDA_DrawFrame * @param frame = current WinEDA_DrawFrame
* @param id = selected menu id * @param id = selected menu id
* @return g_ConfigFileLocationChoice (global) = new selection * @return g_ConfigFileLocationChoice (global) = new selection
*/ */
{ {
wxMenuBar * menu = frame->GetMenuBar(); wxMenuBar* menu = frame->GetMenuBar();
switch (id ) switch( id )
{ {
case ID_PREFERENCES_HOTKEY_PATH_IS_HOME: case ID_PREFERENCES_HOTKEY_PATH_IS_HOME:
if ( g_ConfigFileLocationChoice != 0 ) if( g_ConfigFileLocationChoice != 0 )
{ {
g_ConfigFileLocationChoice = 0; g_ConfigFileLocationChoice = 0;
menu->Check(ID_PREFERENCES_HOTKEY_PATH_IS_HOME, true); menu->Check( ID_PREFERENCES_HOTKEY_PATH_IS_HOME, true );
menu->Check(ID_PREFERENCES_HOTKEY_PATH_IS_KICAD, false); menu->Check( ID_PREFERENCES_HOTKEY_PATH_IS_KICAD, false );
frame->m_Parent->m_EDA_CommonConfig->Write(HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice); frame->m_Parent->m_EDA_CommonConfig->Write( HOTKEY_CFG_PATH_OPT,
g_ConfigFileLocationChoice );
} }
break; break;
case ID_PREFERENCES_HOTKEY_PATH_IS_KICAD: case ID_PREFERENCES_HOTKEY_PATH_IS_KICAD:
if ( g_ConfigFileLocationChoice != 1 ) if( g_ConfigFileLocationChoice != 1 )
{ {
g_ConfigFileLocationChoice = 1; g_ConfigFileLocationChoice = 1;
menu->Check(ID_PREFERENCES_HOTKEY_PATH_IS_HOME, false); menu->Check( ID_PREFERENCES_HOTKEY_PATH_IS_HOME, false );
menu->Check(ID_PREFERENCES_HOTKEY_PATH_IS_KICAD, true); menu->Check( ID_PREFERENCES_HOTKEY_PATH_IS_KICAD, true );
frame->m_Parent->m_EDA_CommonConfig->Write(HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice); frame->m_Parent->m_EDA_CommonConfig->Write( HOTKEY_CFG_PATH_OPT,
g_ConfigFileLocationChoice );
} }
break; break;
...@@ -683,4 +689,3 @@ wxMenuBar * menu = frame->GetMenuBar(); ...@@ -683,4 +689,3 @@ wxMenuBar * menu = frame->GetMenuBar();
break; break;
} }
} }
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "colors.h" #include "colors.h"
// Define print format d to display a schematic component line // 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" #define FILTERFOOTPRINTKEY "FilterFootprint"
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
* add the HkMyNewEntry pointer in the s_Schematic_Hotkey_List list or the s_LibEdit_Hotkey_List list * 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) * ( 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. * 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 * 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.) * ( 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 ); ...@@ -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 HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 );
static Ki_HotkeyInfo HkHelp( wxT( "Help: this message" ), HK_HELP, '?' ); 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 HkResetLocalCoord( wxT( "Reset local coord." ), HK_RESET_LOCAL_COORD, ' ' );
static Ki_HotkeyInfo HkUndo( wxT( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z' ); 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' ); static Ki_HotkeyInfo HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y', (int)ID_SCHEMATIC_REDO );
// Schematic editor // Schematic editor
static Ki_HotkeyInfo HkBeginWire( wxT( "begin Wire" ), HK_BEGIN_WIRE, 'W' ); static Ki_HotkeyInfo HkBeginWire( wxT( "begin Wire" ), HK_BEGIN_WIRE, 'W' );
...@@ -62,7 +62,8 @@ static Ki_HotkeyInfo HkOrientNormalComponent( wxT( ...@@ -62,7 +62,8 @@ static Ki_HotkeyInfo HkOrientNormalComponent( wxT(
"Orient Normal Component" ), "Orient Normal Component" ),
HK_ORIENT_NORMAL_COMPONENT, 'N' ); HK_ORIENT_NORMAL_COMPONENT, 'N' );
static Ki_HotkeyInfo HkRotateComponent( wxT( "Rotate Component" ), HK_ROTATE_COMPONENT, 'R' ); 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( static Ki_HotkeyInfo HkMove2Drag( wxT(
"Switch move block to drag block" ), "Switch move block to drag block" ),
HK_MOVEBLOCK_TO_DRAGBLOCK, '\t' ); HK_MOVEBLOCK_TO_DRAGBLOCK, '\t' );
...@@ -88,7 +89,7 @@ Ki_HotkeyInfo* s_Common_Hotkey_List[] = ...@@ -88,7 +89,7 @@ Ki_HotkeyInfo* s_Common_Hotkey_List[] =
Ki_HotkeyInfo* s_Schematic_Hotkey_List[] = { Ki_HotkeyInfo* s_Schematic_Hotkey_List[] = {
&HkNextSearch, &HkNextSearch,
&HkDelete, &HkInsert, &HkMove2Drag, &HkDelete, &HkInsert, &HkMove2Drag,
&HkMoveComponent, &HkAddComponent, &HkMoveComponent, &HkDragComponent, &HkAddComponent,
&HkRotateComponent, &HkMirrorXComponent, &HkMirrorYComponent, &HkOrientNormalComponent, &HkRotateComponent, &HkMirrorXComponent, &HkMirrorYComponent, &HkOrientNormalComponent,
&HkBeginWire, &HkBeginWire,
NULL NULL
...@@ -135,7 +136,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -135,7 +136,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
* Commands are case insensitive * Commands are case insensitive
*/ */
{ {
bool PopupOn = m_CurrentScreen->GetCurItem() bool ItemInEdit = 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
...@@ -152,11 +153,12 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -152,11 +153,12 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
hotkey += 'A' - 'a'; hotkey += 'A' - 'a';
// Search command from key : // Search command from key :
int CommandCode = GetCommandCodeFromHotkey( hotkey, s_Common_Hotkey_List ); Ki_HotkeyInfo * HK_Descr = GetDescriptorFromHotkey( hotkey, s_Common_Hotkey_List );
if( CommandCode == HK_NOT_FOUND ) if( HK_Descr == NULL )
CommandCode = GetCommandCodeFromHotkey( hotkey, s_Schematic_Hotkey_List ); HK_Descr = GetDescriptorFromHotkey( hotkey, s_Schematic_Hotkey_List );
if( HK_Descr == NULL ) return;
switch( CommandCode ) switch( HK_Descr->m_Idcommand )
{ {
default: default:
case HK_NOT_FOUND: case HK_NOT_FOUND:
...@@ -188,16 +190,13 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -188,16 +190,13 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
break; break;
case HK_UNDO: case HK_UNDO:
{
wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, ID_SCHEMATIC_UNDO);
wxPostEvent(this, event);
}
break;
case HK_REDO: case HK_REDO:
if( ItemInEdit )
break;
{ {
wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, ID_SCHEMATIC_REDO); wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, HK_Descr->m_IdMenuEvent );
wxPostEvent(this, event);
wxPostEvent( this, event );
} }
break; break;
...@@ -206,7 +205,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -206,7 +205,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
break; break;
case HK_DELETE: case HK_DELETE:
if( PopupOn ) if( ItemInEdit )
break; break;
RefreshToolBar = LocateAndDeleteItem( this, DC ); RefreshToolBar = LocateAndDeleteItem( this, DC );
m_CurrentScreen->SetModify(); m_CurrentScreen->SetModify();
...@@ -215,15 +214,17 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -215,15 +214,17 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
break; break;
case HK_REPEAT_LAST: case HK_REPEAT_LAST:
if( ItemInEdit )
break;
if( g_ItemToRepeat && (g_ItemToRepeat->m_Flags == 0) ) if( g_ItemToRepeat && (g_ItemToRepeat->m_Flags == 0) )
{ {
RepeatDrawItem( DC ); RepeatDrawItem( DC );
} }
else
wxBell();
break; break;
case HK_NEXT_SEARCH: case HK_NEXT_SEARCH:
if( ItemInEdit )
break;
if( g_LastSearchIsMarker ) if( g_LastSearchIsMarker )
WinEDA_SchematicFrame::FindMarker( 1 ); WinEDA_SchematicFrame::FindMarker( 1 );
else else
...@@ -231,7 +232,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -231,7 +232,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
break; break;
case HK_ADD_NEW_COMPONENT: // Add component case HK_ADD_NEW_COMPONENT: // Add component
if( DrawStruct && DrawStruct->m_Flags ) if( ItemInEdit )
break; break;
// switch to m_ID_current_state = ID_COMPONENT_BUTT; // switch to m_ID_current_state = ID_COMPONENT_BUTT;
...@@ -351,15 +352,18 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -351,15 +352,18 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
} }
break; break;
case HK_DRAG_COMPONENT: // Start drag Component
case HK_MOVE_COMPONENT: // Start move Component case HK_MOVE_COMPONENT: // Start move Component
if( PopupOn ) if( ItemInEdit )
break; break;
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( GetScreen() ); DrawStruct = LocateSmallestComponent( GetScreen() );
if( DrawStruct && (DrawStruct->m_Flags ==0) ) if( DrawStruct && (DrawStruct->m_Flags ==0) )
{ {
m_CurrentScreen->SetCurItem( DrawStruct ); 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; break;
} }
...@@ -378,6 +382,8 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -378,6 +382,8 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
* Commands are case insensitive * 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 bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified
if( hotkey == 0 ) if( hotkey == 0 )
...@@ -391,11 +397,12 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -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 */ /* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */
if( (hotkey >= 'a') && (hotkey <= 'z') ) if( (hotkey >= 'a') && (hotkey <= 'z') )
hotkey += 'A' - 'a'; hotkey += 'A' - 'a';
int CommandCode = GetCommandCodeFromHotkey( hotkey, s_Common_Hotkey_List ); Ki_HotkeyInfo * HK_Descr = GetDescriptorFromHotkey( hotkey, s_Common_Hotkey_List );
if( CommandCode == HK_NOT_FOUND ) if( HK_Descr == NULL )
CommandCode = GetCommandCodeFromHotkey( hotkey, s_LibEdit_Hotkey_List ); HK_Descr = GetDescriptorFromHotkey( hotkey, s_LibEdit_Hotkey_List );
if( HK_Descr == NULL ) return;
switch( CommandCode ) switch( HK_Descr->m_Idcommand )
{ {
default: default:
case HK_NOT_FOUND: case HK_NOT_FOUND:
...@@ -427,16 +434,13 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -427,16 +434,13 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
break; break;
case HK_UNDO: case HK_UNDO:
{
wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, ID_LIBEDIT_UNDO);
wxPostEvent(this, event);
}
break;
case HK_REDO: case HK_REDO:
if( ItemInEdit )
break;
{ {
wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, ID_LIBEDIT_REDO); wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, HK_Descr->m_IdMenuEvent );
wxPostEvent(this, event);
wxPostEvent( this, event );
} }
break; break;
......
...@@ -25,6 +25,7 @@ enum hotkey_id_commnand { ...@@ -25,6 +25,7 @@ enum hotkey_id_commnand {
HK_MIRROR_Y_COMPONENT, HK_MIRROR_Y_COMPONENT,
HK_ORIENT_NORMAL_COMPONENT, HK_ORIENT_NORMAL_COMPONENT,
HK_MOVE_COMPONENT, HK_MOVE_COMPONENT,
HK_DRAG_COMPONENT,
HK_ADD_NEW_COMPONENT, HK_ADD_NEW_COMPONENT,
HK_BEGIN_WIRE HK_BEGIN_WIRE
}; };
......
...@@ -284,6 +284,9 @@ void AddMenusForComponent( wxMenu* PopMenu, EDA_SchComponentStruct* Component ) ...@@ -284,6 +284,9 @@ void AddMenusForComponent( wxMenu* PopMenu, EDA_SchComponentStruct* Component )
msg = AddHotkeyName( _( "Move Component" ), s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT ); msg = AddHotkeyName( _( "Move Component" ), s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_CMP_REQUEST, ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_CMP_REQUEST,
msg, move_xpm ); 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: // add menu orient et sous menu:
......
...@@ -53,6 +53,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -53,6 +53,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_MOVE_PINSHEET: case ID_POPUP_SCH_MOVE_PINSHEET:
case ID_POPUP_SCH_MOVE_ITEM_REQUEST: case ID_POPUP_SCH_MOVE_ITEM_REQUEST:
case ID_POPUP_SCH_MOVE_CMP_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_EDIT_CMP:
case ID_POPUP_SCH_MIROR_X_CMP: case ID_POPUP_SCH_MIROR_X_CMP:
case ID_POPUP_SCH_MIROR_Y_CMP: case ID_POPUP_SCH_MIROR_Y_CMP:
...@@ -486,21 +487,27 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -486,21 +487,27 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
m_CurrentScreen->GetCurItem(), &dc ); m_CurrentScreen->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_DRAG_CMP_REQUEST:
case ID_POPUP_SCH_MOVE_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..) // 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 ) if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
if( m_CurrentScreen->GetCurItem() == NULL ) if( m_CurrentScreen->GetCurItem() == NULL )
break; break;
case ID_POPUP_SCH_MOVE_ITEM_REQUEST: case ID_POPUP_SCH_MOVE_ITEM_REQUEST:
DrawPanel->MouseToCursorSchema(); 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; break;
case ID_POPUP_SCH_EDIT_CMP: case ID_POPUP_SCH_EDIT_CMP:
// Ensure the struct is a component (could be a struct of a component, like Field, text..) // 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 ) if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
......
...@@ -91,9 +91,10 @@ void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -91,9 +91,10 @@ void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey,
if( (hotkey >= 'a') && (hotkey <= 'z') ) if( (hotkey >= 'a') && (hotkey <= 'z') )
hotkey += 'A' - 'a'; 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: default:
case HK_NOT_FOUND: case HK_NOT_FOUND:
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
COMMON_GLOBL wxString g_BuildVersion COMMON_GLOBL wxString g_BuildVersion
#ifdef EDA_BASE #ifdef EDA_BASE
(wxT("(2007-09-19)")) (wxT("(2007-09-22)"))
#endif #endif
; ;
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#define DEFAULT_HOTKEY_FILENAME_PATH_IS_KICAD EDA_Appl->m_BinDir + wxT( "../template/" ) #define DEFAULT_HOTKEY_FILENAME_PATH_IS_KICAD EDA_Appl->m_BinDir + wxT( "../template/" )
/* keyword idetifier in kicad config use ti store/retrieve path option */ /* 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 /* Class to handle hotkey commnands. hotkeys have a default value
...@@ -31,9 +31,10 @@ public: ...@@ -31,9 +31,10 @@ public:
int m_KeyCode; // Key code (ascii value for ascii keys or wxWidgets code for function key int m_KeyCode; // Key code (ascii value for ascii keys or wxWidgets code for function key
wxString m_InfoMsg; // info message. wxString m_InfoMsg; // info message.
int m_Idcommand; // internal id for the corresponding command (see hotkey_id_commnand list) 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: 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) /* handle a Section name and the corresponding list of hotkeys (Ki_HotkeyInfo list)
...@@ -92,7 +93,7 @@ COMMON_GLOBL int g_ConfigFileLocationChoice; /* 0 = files are in Home directo ...@@ -92,7 +93,7 @@ COMMON_GLOBL int g_ConfigFileLocationChoice; /* 0 = files are in Home directo
*/ */
wxString ReturnHotkeyConfigFilePath( int choice ); wxString ReturnHotkeyConfigFilePath( int choice );
void AddHotkeyConfigMenu( wxMenu* menu ); void AddHotkeyConfigMenu( wxMenu* menu );
void HandleHotkeyConfigMenuSelection( WinEDA_DrawFrame * frame, int id ); void HandleHotkeyConfigMenuSelection( WinEDA_DrawFrame* frame, int id );
wxString ReturnKeyNameFromKeyCode( int keycode ); wxString ReturnKeyNameFromKeyCode( int keycode );
wxString ReturnKeyNameFromCommandId( Ki_HotkeyInfo** List, int CommandId ); wxString ReturnKeyNameFromCommandId( Ki_HotkeyInfo** List, int CommandId );
wxString AddHotkeyName( const wxString& text, Ki_HotkeyInfo** List, int CommandId ); wxString AddHotkeyName( const wxString& text, Ki_HotkeyInfo** List, int CommandId );
...@@ -101,7 +102,7 @@ wxString AddHotkeyName( const wxString& text, ...@@ -101,7 +102,7 @@ wxString AddHotkeyName( const wxString& text,
int CommandId ); int CommandId );
void DisplayHotkeyList( WinEDA_DrawFrame* frame, void DisplayHotkeyList( WinEDA_DrawFrame* frame,
struct Ki_HotkeyInfoSectionDescriptor* List ); struct Ki_HotkeyInfoSectionDescriptor* List );
int GetCommandCodeFromHotkey( int key, Ki_HotkeyInfo** List ); Ki_HotkeyInfo* GetDescriptorFromHotkey( int key, Ki_HotkeyInfo** List );
#endif // HOTKEYS_BASIC_H #endif // HOTKEYS_BASIC_H
...@@ -282,7 +282,7 @@ enum main_id { ...@@ -282,7 +282,7 @@ enum main_id {
ID_POPUP_SCH_DELETE_NODE, ID_POPUP_SCH_DELETE_NODE,
ID_POPUP_SCH_MOVE_CMP_REQUEST, ID_POPUP_SCH_MOVE_CMP_REQUEST,
ID_POPUP_SCH_DELETE_CMP, 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_1,
ID_POPUP_SCH_UNUSED_2, ID_POPUP_SCH_UNUSED_2,
ID_POPUP_SCH_ENTRY_SELECT_SLASH, ID_POPUP_SCH_ENTRY_SELECT_SLASH,
......
...@@ -25,9 +25,9 @@ KICAD_TEMPLATE=$(KICAD_DATA)/template ...@@ -25,9 +25,9 @@ KICAD_TEMPLATE=$(KICAD_DATA)/template
else else
# used by myself (JP Charras) to build a statically linked distribution intalled in /usr/local (with STD_INSTALL = 0) # used by myself (JP Charras) to build a statically linked distribution intalled in /usr/local (with STD_INSTALL = 0)
PREFIX = /usr/local/linux PREFIX = /usr/local/kicad
KICAD_BIN = $(PREFIX)/bin KICAD_BIN = $(PREFIX)/linux
KICAD_PLUGINS = $(PREFIX)/linux/plugins KICAD_PLUGINS = $(KICAD_BIN)/plugins
KICAD_DOCS=$(PREFIX)/help KICAD_DOCS=$(PREFIX)/help
KICAD_DATA=$(PREFIX) KICAD_DATA=$(PREFIX)
KICAD_MODULES=$(KICAD_DATA)/modules KICAD_MODULES=$(KICAD_DATA)/modules
...@@ -121,12 +121,15 @@ ifeq ($(KICAD_STATIC_LINK), 1) ...@@ -121,12 +121,15 @@ ifeq ($(KICAD_STATIC_LINK), 1)
LIBS3D = $(WXPATH)/$(PREFIX_WX_LIBS)$(SUFFIX_WX_LIBGL)\ LIBS3D = $(WXPATH)/$(PREFIX_WX_LIBS)$(SUFFIX_WX_LIBGL)\
$(MESALIBSPATH)/libGL.a $(MESALIBSPATH)/libGLU.a $(MESALIBSPATH)/libGL.a $(MESALIBSPATH)/libGLU.a
AUXLIB = -lXxf86vm
#AUXLIB = /usr/X11R6/lib/libXinerama.a
WXSYSLIB= $(WXPATH)/$(PREFIX_WX_LIBS)-$(LIBVERSION).a \ WXSYSLIB= $(WXPATH)/$(PREFIX_WX_LIBS)-$(LIBVERSION).a \
$(WXPATH)/libwxpng-$(LIBVERSION).a\ $(WXPATH)/libwxpng-$(LIBVERSION).a\
$(WXPATH)/libwxjpeg-$(LIBVERSION).a\ $(WXPATH)/libwxjpeg-$(LIBVERSION).a\
$(WXPATH)/libwxzlib-$(LIBVERSION).a\ $(WXPATH)/libwxzlib-$(LIBVERSION).a\
$(LIBREGEX)\ $(LIBREGEX)\
/usr/X11R6/lib/libXinerama.a \ $(AUXLIB)\
-lgtk-x11-2.0 -lgdk-x11-2.0 \ -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\ -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\ -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl\
...@@ -134,18 +137,8 @@ WXSYSLIB= $(WXPATH)/$(PREFIX_WX_LIBS)-$(LIBVERSION).a \ ...@@ -134,18 +137,8 @@ WXSYSLIB= $(WXPATH)/$(PREFIX_WX_LIBS)-$(LIBVERSION).a \
-L/usr/lib $(PYLIBS) -L/usr/lib $(PYLIBS)
WXSYSLIB_WITH_GL= $(WXPATH)/$(PREFIX_WX_LIBS)-$(LIBVERSION).a \ WXSYSLIB_WITH_GL= $(WXSYSLIB) $(LIBS3D)
$(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)
else else
ifeq ($(DEBUG), 1) ifeq ($(DEBUG), 1)
......
...@@ -186,12 +186,14 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -186,12 +186,14 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
if( (hotkey >= 'a') && (hotkey <= 'z') ) if( (hotkey >= 'a') && (hotkey <= 'z') )
hotkey += 'A' - 'a'; hotkey += 'A' - 'a';
int CommandCode = GetCommandCodeFromHotkey( hotkey, s_Common_Hotkey_List ); Ki_HotkeyInfo * HK_Descr = GetDescriptorFromHotkey( hotkey, s_Common_Hotkey_List );
if( CommandCode == HK_NOT_FOUND ) if( HK_Descr == NULL )
CommandCode = GetCommandCodeFromHotkey( hotkey, s_board_edit_Hotkey_List ); HK_Descr = GetDescriptorFromHotkey( hotkey, s_board_edit_Hotkey_List );
if( HK_Descr == NULL ) return;
int ll; int ll;
switch( CommandCode ) switch( HK_Descr->m_Idcommand )
{ {
default: default:
case HK_NOT_FOUND: case HK_NOT_FOUND:
...@@ -465,7 +467,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -465,7 +467,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
SetCurItem( module ); SetCurItem( module );
} }
switch( CommandCode ) switch( HK_Descr->m_Idcommand )
{ {
case HK_ROTATE_FOOTPRINT: // Rotation case HK_ROTATE_FOOTPRINT: // Rotation
Rotate_Module( DC, module, 900, TRUE ); Rotate_Module( DC, module, 900, TRUE );
...@@ -506,11 +508,12 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -506,11 +508,12 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* DC, int hotkey,
if( (hotkey >= 'a') && (hotkey <= 'z') ) if( (hotkey >= 'a') && (hotkey <= 'z') )
hotkey += 'A' - 'a'; hotkey += 'A' - 'a';
int CommandCode = GetCommandCodeFromHotkey( hotkey, s_Common_Hotkey_List ); Ki_HotkeyInfo * HK_Descr = GetDescriptorFromHotkey( hotkey, s_Common_Hotkey_List );
if( CommandCode == HK_NOT_FOUND ) if( HK_Descr == NULL )
CommandCode = GetCommandCodeFromHotkey( hotkey, s_module_edit_Hotkey_List ); HK_Descr = GetDescriptorFromHotkey( hotkey, s_module_edit_Hotkey_List );
if( HK_Descr == NULL ) return;
switch( CommandCode ) switch( HK_Descr->m_Idcommand )
{ {
default: default:
case HK_NOT_FOUND: case HK_NOT_FOUND:
......
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