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

This commit is contained in:
jean-pierre charras 2010-09-02 10:23:38 +02:00
parent daa12ba91c
commit f578abcc97
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 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.
Common
@ -14,12 +12,10 @@ Common
* Grep for @TODO or TODO for sourcecode tasks
* Use doxygen compatible comments on member functions (.h files)
* 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
module or component lives.
* 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
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" ) ) );
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 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( "Tim Hanson" ), wxT( "sideskate@gmail.com" ) ) );
info.AddDeveloper( new Contributor( wxT( "Vesa Solonen" ), wxT( "vesa.solonen@hut.fi" ) ) );

View File

@ -277,6 +277,8 @@ public:
*/
bool OnHotkeyDeleteItem( wxDC* aDC );
bool OnHotkeyEditItem( int aIdCommand );
/** Function OnHotkeyMoveItem
* Moves or drag the item (footprint, track, text .. ) found under the mouse cursor
* 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;
case HK_EDIT_ITEM: // Edit board item
if( !itemCurrentlyEdited )
{
BOARD_ITEM* item = PcbGeneralLocateAndDisplay();
if( item == NULL )
break;
//An item is found, and some can be edited:
OnEditItemRequest( aDC, item );
}
OnHotkeyEditItem( HK_EDIT_ITEM );
break;
// Footprint edition:
@ -908,6 +900,90 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* aDC )
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
* Move or drag the item (footprint, track, text .. ) found under the mouse cursor
@ -953,10 +1029,14 @@ bool WinEDA_PcbFrame::OnHotkeyMoveItem( int aIdCommand )
break;
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 )
evt_type = ID_POPUP_PCB_MOVE_PAD_REQUEST;
evt_type = ID_POPUP_PCB_MOVE_MODULE_REQUEST;
if( aIdCommand == HK_DRAG_ITEM )
evt_type = ID_POPUP_PCB_DRAG_PAD_REQUEST;
evt_type = ID_POPUP_PCB_DRAG_MODULE_REQUEST;
break;
case TYPE_TEXTE:

View File

@ -741,15 +741,13 @@ void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
sub_menu_Pad = new wxMenu;
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,
msg, move_pad_xpm );
msg = AddHotkeyName( _( "Drag" ), s_Board_Editor_Hokeys_Descr, HK_DRAG_ITEM );
_( "Move" ), move_pad_xpm );
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, msg, options_pad_xpm );
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_EDIT_PAD,
_( "Edit" ), options_pad_xpm );
sub_menu_Pad->AppendSeparator();
ADD_MENUITEM_WITH_HELP( sub_menu_Pad, ID_POPUP_PCB_IMPORT_PAD_SETTINGS,