Remove pad move/drag/edit hotkeys id board editor (Marco Mattila's patches)

This commit is contained in:
Marco Mattila 2010-09-02 10:26:53 +02:00 committed by jean-pierre charras
commit d00f3744ca
5 changed files with 100 additions and 22 deletions

View File

@ -5,8 +5,6 @@ WXMAC Platform
-------------- --------------
* Fix hotkey list to match CMD key * Fix hotkey list to match CMD key
* Fix AddHotkeyName to let wxWidgets handle Ctrl to CMD key * Fix AddHotkeyName to let wxWidgets handle Ctrl to CMD key
* Fix About dialog crash, or trash wxAboutDialog and create our own
About dialog to match all platforms. (wxAboutDialog different on platforms)
* Fix toolbar button tooltips. * Fix toolbar button tooltips.
Common Common
@ -14,12 +12,10 @@ Common
* Grep for @TODO or TODO for sourcecode tasks * Grep for @TODO or TODO for sourcecode tasks
* Use doxygen compatible comments on member functions (.h files) * Use doxygen compatible comments on member functions (.h files)
* Add tooltip text to all non-obvious controls in every dialog window. * Add tooltip text to all non-obvious controls in every dialog window.
Need to do this using DialogBlocks. Use wxFormBuilder.
* Component and module search displays in which library the * Component and module search displays in which library the
module or component lives. module or component lives.
* List auto up and down scrolling. * List auto up and down scrolling.
* Integer/long/double input boxes should handle comma and dot separated values,
not only comma.
* Push file open semantics down to one of the base frame classes ( likely candidate is * Push file open semantics down to one of the base frame classes ( likely candidate is
WinEDA_BasicFrame ) so that file open behavior is consistent across all applications. WinEDA_BasicFrame ) so that file open behavior is consistent across all applications.

View File

@ -200,6 +200,8 @@ static void InitKiCadAboutNew( AboutAppInfo& info )
wxT( "http://boolean.klaasholwerda.nl/bool.html" ) ) ); wxT( "http://boolean.klaasholwerda.nl/bool.html" ) ) );
info.AddDeveloper( new Contributor( wxT( "Lorenzo Marcantonio" ), wxT( "lomarcan@tin.it" ) ) ); info.AddDeveloper( new Contributor( wxT( "Lorenzo Marcantonio" ), wxT( "lomarcan@tin.it" ) ) );
info.AddDeveloper( new Contributor( wxT( "Marco Serantoni" ), wxT( "marco.serantoni@gmail.com" ) ) ); info.AddDeveloper( new Contributor( wxT( "Marco Serantoni" ), wxT( "marco.serantoni@gmail.com" ) ) );
info.AddDeveloper( new Contributor( wxT( "Marco Mattila" ), wxT( "marcom99@gmail.com" ) ) );
info.AddDeveloper( new Contributor( wxT( "Rafael Sokolowski" ), wxT( "rafael.sokolowski@web.de" ) ) );
info.AddDeveloper( new Contributor( wxT( "Rok Markovic" ), wxT( "rok@kanardia.eu" ) ) ); info.AddDeveloper( new Contributor( wxT( "Rok Markovic" ), wxT( "rok@kanardia.eu" ) ) );
info.AddDeveloper( new Contributor( wxT( "Tim Hanson" ), wxT( "sideskate@gmail.com" ) ) ); info.AddDeveloper( new Contributor( wxT( "Tim Hanson" ), wxT( "sideskate@gmail.com" ) ) );
info.AddDeveloper( new Contributor( wxT( "Vesa Solonen" ), wxT( "vesa.solonen@hut.fi" ) ) ); info.AddDeveloper( new Contributor( wxT( "Vesa Solonen" ), wxT( "vesa.solonen@hut.fi" ) ) );

View File

@ -277,6 +277,8 @@ public:
*/ */
bool OnHotkeyDeleteItem( wxDC* aDC ); bool OnHotkeyDeleteItem( wxDC* aDC );
bool OnHotkeyEditItem( int aIdCommand );
/** Function OnHotkeyMoveItem /** Function OnHotkeyMoveItem
* Moves or drag the item (footprint, track, text .. ) found under the mouse cursor * Moves or drag the item (footprint, track, text .. ) found under the mouse cursor
* Only a footprint or a track can be dragged * Only a footprint or a track can be dragged

View File

@ -503,15 +503,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, EDA_BaseStruct* aIte
break; break;
case HK_EDIT_ITEM: // Edit board item case HK_EDIT_ITEM: // Edit board item
if( !itemCurrentlyEdited ) OnHotkeyEditItem( HK_EDIT_ITEM );
{
BOARD_ITEM* item = PcbGeneralLocateAndDisplay();
if( item == NULL )
break;
//An item is found, and some can be edited:
OnEditItemRequest( aDC, item );
}
break; break;
// Footprint edition: // Footprint edition:
@ -908,6 +900,90 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* aDC )
return true; return true;
} }
bool WinEDA_PcbFrame::OnHotkeyEditItem( int aIdCommand )
{
BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->m_Flags;
if( itemCurrentlyEdited )
return false;
item = PcbGeneralLocateAndDisplay();
if( item == NULL )
return false;
SetCurItem( item );
int evt_type = 0; //Used to post a wxCommandEvent on demand
switch( item->Type() )
{
case TYPE_TRACK:
case TYPE_VIA:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_TRACKSEG;
break;
case TYPE_TEXTE:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_TEXTEPCB;
break;
case TYPE_MODULE:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_MODULE;
break;
case TYPE_PAD:
// Post a EDIT_MODULE event here to prevent pads
// from being edited by hotkeys.
// Process_Special_Functions takes care of finding
// the parent.
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_MODULE;
break;
case TYPE_MIRE:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_MIRE;
break;
case TYPE_DIMENSION:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_DIMENSION;
break;
case TYPE_TEXTE_MODULE:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_TEXTMODULE;
break;
case TYPE_DRAWSEGMENT:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_DRAWING;
break;
case TYPE_ZONE_CONTAINER:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_ZONE_PARAMS;
break;
default:
break;
}
if( evt_type != 0 )
{
wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED );
evt.SetEventObject( this );
evt.SetId( evt_type );
wxPostEvent( this, evt );
return true;
}
return false;
}
/** Function OnHotkeyMoveItem /** Function OnHotkeyMoveItem
* Move or drag the item (footprint, track, text .. ) found under the mouse cursor * Move or drag the item (footprint, track, text .. ) found under the mouse cursor
@ -953,10 +1029,14 @@ bool WinEDA_PcbFrame::OnHotkeyMoveItem( int aIdCommand )
break; break;
case TYPE_PAD: case TYPE_PAD:
// Post MODULE_REQUEST events here to prevent pads
// from being moved or dragged by hotkeys.
// Process_Special_Functions takes care of finding
// the parent.
if( aIdCommand == HK_MOVE_ITEM ) if( aIdCommand == HK_MOVE_ITEM )
evt_type = ID_POPUP_PCB_MOVE_PAD_REQUEST; evt_type = ID_POPUP_PCB_MOVE_MODULE_REQUEST;
if( aIdCommand == HK_DRAG_ITEM ) if( aIdCommand == HK_DRAG_ITEM )
evt_type = ID_POPUP_PCB_DRAG_PAD_REQUEST; evt_type = ID_POPUP_PCB_DRAG_MODULE_REQUEST;
break; break;
case TYPE_TEXTE: case TYPE_TEXTE:

View File

@ -741,15 +741,13 @@ void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
sub_menu_Pad = new wxMenu; sub_menu_Pad = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_Pad, -1, msg, pad_xpm ); ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_Pad, -1, msg, pad_xpm );
msg = AddHotkeyName( _( "Move" ), s_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM );
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_MOVE_PAD_REQUEST, ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_MOVE_PAD_REQUEST,
msg, move_pad_xpm ); _( "Move" ), move_pad_xpm );
msg = AddHotkeyName( _( "Drag" ), s_Board_Editor_Hokeys_Descr, HK_DRAG_ITEM );
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_DRAG_PAD_REQUEST, ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_DRAG_PAD_REQUEST,
msg, drag_pad_xpm ); _( "Drag" ), drag_pad_xpm );
msg = AddHotkeyName( _( "Edit Pad" ), s_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_EDIT_PAD,
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_EDIT_PAD, msg, options_pad_xpm ); _( "Edit" ), options_pad_xpm );
sub_menu_Pad->AppendSeparator(); sub_menu_Pad->AppendSeparator();
ADD_MENUITEM_WITH_HELP( sub_menu_Pad, ID_POPUP_PCB_IMPORT_PAD_SETTINGS, ADD_MENUITEM_WITH_HELP( sub_menu_Pad, ID_POPUP_PCB_IMPORT_PAD_SETTINGS,