Commit 7774d684 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: Added move and rotate hot keys in board editor. hotkeys.cpp code...

Pcbnew: Added move and rotate hot keys in board editor. hotkeys.cpp code cleaned. Fixed a bug that can crashes Pcbnew when switching track posture.
parent 0e7fa222
...@@ -281,18 +281,16 @@ public: ...@@ -281,18 +281,16 @@ public:
* 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
* @param aIdCommand = the hotkey command id * @param aIdCommand = the hotkey command id
* @param aDC = current device context
* @return true if an item was moved * @return true if an item was moved
*/ */
bool OnHotkeyMoveItem( int aIdCommand, wxDC* aDC ); bool OnHotkeyMoveItem( int aIdCommand );
/** Function OnHotkeyRotateItem /** Function OnHotkeyRotateItem
* Rotate the item (text or footprint) found under the mouse cursor * Rotate the item (text or footprint) found under the mouse cursor
* @param aIdCommand = the hotkey command id * @param aIdCommand = the hotkey command id
* @param aDC = current device context
* @return true if an item was moved * @return true if an item was moved
*/ */
bool OnHotkeyRotateItem( int aIdCommand, wxDC* aDC ); bool OnHotkeyRotateItem( int aIdCommand );
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
......
...@@ -45,23 +45,23 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event ) ...@@ -45,23 +45,23 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_TOOLBARH_PCB_AUTOPLACE: case ID_TOOLBARH_PCB_MODE_MODULE:
on_state = m_HToolBar->GetToolState( ID_TOOLBARH_PCB_AUTOPLACE ); on_state = m_HToolBar->GetToolState( ID_TOOLBARH_PCB_MODE_MODULE );
if( on_state ) if( on_state )
{ {
m_HToolBar->ToggleTool( ID_TOOLBARH_PCB_AUTOROUTE, FALSE ); m_HToolBar->ToggleTool( ID_TOOLBARH_PCB_MODE_TRACKS, FALSE );
m_HTOOL_current_state = ID_TOOLBARH_PCB_AUTOPLACE; m_HTOOL_current_state = ID_TOOLBARH_PCB_MODE_MODULE;
} }
else else
m_HTOOL_current_state = 0; m_HTOOL_current_state = 0;
return; return;
case ID_TOOLBARH_PCB_AUTOROUTE: case ID_TOOLBARH_PCB_MODE_TRACKS:
on_state = m_HToolBar->GetToolState( ID_TOOLBARH_PCB_AUTOROUTE ); on_state = m_HToolBar->GetToolState( ID_TOOLBARH_PCB_MODE_TRACKS );
if( on_state ) if( on_state )
{ {
m_HToolBar->ToggleTool( ID_TOOLBARH_PCB_AUTOPLACE, FALSE ); m_HToolBar->ToggleTool( ID_TOOLBARH_PCB_MODE_MODULE, FALSE );
m_HTOOL_current_state = ID_TOOLBARH_PCB_AUTOROUTE; m_HTOOL_current_state = ID_TOOLBARH_PCB_MODE_TRACKS;
} }
else else
m_HTOOL_current_state = 0; m_HTOOL_current_state = 0;
......
...@@ -83,7 +83,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode ) ...@@ -83,7 +83,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
{ {
switch( m_HTOOL_current_state ) switch( m_HTOOL_current_state )
{ {
case ID_TOOLBARH_PCB_AUTOPLACE: case ID_TOOLBARH_PCB_MODE_MODULE:
scanList = GENERAL_COLLECTOR::ModuleItems; scanList = GENERAL_COLLECTOR::ModuleItems;
break; break;
......
...@@ -348,10 +348,13 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -348,10 +348,13 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_SWITCH_TRACK_POSTURE: case ID_POPUP_PCB_SWITCH_TRACK_POSTURE:
/* change the position of initial segment when creating new tracks /* change the position of initial segment when creating new tracks
* switch from _/ to -\ . * switch from _/ to -\ .
* If a track is in progress, it will be redrawn
*/ */
ShowNewTrackWhenMovingCursor( DrawPanel, &dc, false ); if( DrawPanel->ManageCurseur == ShowNewTrackWhenMovingCursor )
ShowNewTrackWhenMovingCursor( DrawPanel, &dc, false );
g_Alternate_Track_Posture = !g_Alternate_Track_Posture; g_Alternate_Track_Posture = !g_Alternate_Track_Posture;
ShowNewTrackWhenMovingCursor( DrawPanel, &dc, false ); if( DrawPanel->ManageCurseur == ShowNewTrackWhenMovingCursor )
ShowNewTrackWhenMovingCursor( DrawPanel, &dc, false );
break; break;
case ID_POPUP_PCB_PLACE_MICROVIA: case ID_POPUP_PCB_PLACE_MICROVIA:
......
This diff is collapsed.
...@@ -15,7 +15,7 @@ enum hotkey_id_commnand { ...@@ -15,7 +15,7 @@ enum hotkey_id_commnand {
HK_BACK_SPACE, HK_BACK_SPACE,
HK_ROTATE_ITEM, HK_ROTATE_ITEM,
HK_MOVE_ITEM, HK_MOVE_ITEM,
HK_DRAG_FOOTPRINT_OR_TRACK, HK_DRAG_ITEM,
HK_FLIP_FOOTPRINT, HK_FLIP_FOOTPRINT,
HK_GET_AND_MOVE_FOOTPRINT, HK_GET_AND_MOVE_FOOTPRINT,
HK_LOCK_UNLOCK_FOOTPRINT, HK_LOCK_UNLOCK_FOOTPRINT,
......
...@@ -120,7 +120,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -120,7 +120,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
case TYPE_MODULE: case TYPE_MODULE:
createPopUpMenuForFootprints( (MODULE*) item, aPopMenu ); createPopUpMenuForFootprints( (MODULE*) item, aPopMenu );
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOPLACE ) if( m_HTOOL_current_state == ID_TOOLBARH_PCB_MODE_MODULE )
{ {
aPopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
...@@ -146,7 +146,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -146,7 +146,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
_( "Auto Place Module" ) ); _( "Auto Place Module" ) );
} }
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOROUTE ) if( m_HTOOL_current_state == ID_TOOLBARH_PCB_MODE_TRACKS )
{ {
if( !flags ) if( !flags )
aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_MODULE, _( "Autoroute Module" ) ); aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_MODULE, _( "Autoroute Module" ) );
...@@ -318,7 +318,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -318,7 +318,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
break; break;
case 0: case 0:
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOPLACE ) if( m_HTOOL_current_state == ID_TOOLBARH_PCB_MODE_MODULE )
{ {
wxMenu* commands = new wxMenu; wxMenu* commands = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( aPopMenu, commands, ADD_MENUITEM_WITH_SUBMENU( aPopMenu, commands,
...@@ -342,7 +342,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -342,7 +342,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
aPopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
} }
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOROUTE ) if( m_HTOOL_current_state == ID_TOOLBARH_PCB_MODE_TRACKS )
{ {
wxMenu* commands = new wxMenu; wxMenu* commands = new wxMenu;
aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_COMMANDS, _( "Autoroute" ), commands ); aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_COMMANDS, _( "Autoroute" ), commands );
...@@ -641,7 +641,7 @@ void WinEDA_PcbFrame::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* men ...@@ -641,7 +641,7 @@ void WinEDA_PcbFrame::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* men
msg = AddHotkeyName( _( "Move" ), s_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM ); msg = AddHotkeyName( _( "Move" ), s_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM );
ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_MOVE_MODULE_REQUEST, ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_MOVE_MODULE_REQUEST,
msg, move_module_xpm ); msg, move_module_xpm );
msg = AddHotkeyName( _( "Drag" ), s_Board_Editor_Hokeys_Descr, HK_DRAG_FOOTPRINT_OR_TRACK ); msg = AddHotkeyName( _( "Drag" ), s_Board_Editor_Hokeys_Descr, HK_DRAG_ITEM );
ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_DRAG_MODULE_REQUEST, ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_DRAG_MODULE_REQUEST,
msg, drag_module_xpm ); msg, drag_module_xpm );
} }
...@@ -689,8 +689,9 @@ void WinEDA_PcbFrame::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* m ...@@ -689,8 +689,9 @@ void WinEDA_PcbFrame::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* m
msg, move_field_xpm ); msg, move_field_xpm );
} }
msg = AddHotkeyName( _( "Rotate" ), s_Board_Editor_Hokeys_Descr, HK_ROTATE_ITEM );
ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_ROTATE_TEXTMODULE, ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_ROTATE_TEXTMODULE,
_( "Rotate" ), rotate_field_xpm ); msg, rotate_field_xpm );
if( !flags ) if( !flags )
{ {
msg = AddHotkeyName( _( "Edit" ), s_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); msg = AddHotkeyName( _( "Edit" ), s_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
...@@ -742,8 +743,9 @@ void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu ) ...@@ -742,8 +743,9 @@ void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
msg = AddHotkeyName( _( "Move" ), s_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM ); 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 ); msg, 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,
_( "Drag" ), drag_pad_xpm ); msg, drag_pad_xpm );
msg = AddHotkeyName( _( "Edit Pad" ), s_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); 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, msg, options_pad_xpm );
...@@ -767,7 +769,7 @@ void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu ) ...@@ -767,7 +769,7 @@ void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_DELETE_PAD, ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_DELETE_PAD,
_( "Delete" ), delete_pad_xpm ); _( "Delete" ), delete_pad_xpm );
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOROUTE ) if( m_HTOOL_current_state == ID_TOOLBARH_PCB_MODE_TRACKS )
{ {
menu->Append( ID_POPUP_PCB_AUTOROUTE_PAD, _( "Autoroute Pad" ) ); menu->Append( ID_POPUP_PCB_AUTOROUTE_PAD, _( "Autoroute Pad" ) );
menu->Append( ID_POPUP_PCB_AUTOROUTE_NET, _( "Autoroute Net" ) ); menu->Append( ID_POPUP_PCB_AUTOROUTE_NET, _( "Autoroute Net" ) );
...@@ -801,8 +803,9 @@ void WinEDA_PcbFrame::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu ) ...@@ -801,8 +803,9 @@ void WinEDA_PcbFrame::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu )
ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST, ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST,
msg, move_text_xpm ); msg, move_text_xpm );
} }
msg = AddHotkeyName( _( "Rotate" ), s_Board_Editor_Hokeys_Descr, HK_ROTATE_ITEM );
ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_ROTATE_TEXTEPCB, ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_ROTATE_TEXTEPCB,
_( "Rotate" ), rotate_pos_xpm ); msg, rotate_pos_xpm );
msg = AddHotkeyName( _( "Edit" ), s_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); msg = AddHotkeyName( _( "Edit" ), s_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_EDIT_TEXTEPCB, ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_EDIT_TEXTEPCB,
msg, edit_text_xpm ); msg, edit_text_xpm );
......
...@@ -183,8 +183,8 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame ) ...@@ -183,8 +183,8 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
WinEDA_PcbFrame::Tracks_and_Vias_Size_Event ) WinEDA_PcbFrame::Tracks_and_Vias_Size_Event )
EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_VIA_SIZE, EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_VIA_SIZE,
WinEDA_PcbFrame::Tracks_and_Vias_Size_Event ) WinEDA_PcbFrame::Tracks_and_Vias_Size_Event )
EVT_TOOL( ID_TOOLBARH_PCB_AUTOPLACE, WinEDA_PcbFrame::AutoPlace ) EVT_TOOL( ID_TOOLBARH_PCB_MODE_MODULE, WinEDA_PcbFrame::AutoPlace )
EVT_TOOL( ID_TOOLBARH_PCB_AUTOROUTE, WinEDA_PcbFrame::AutoPlace ) EVT_TOOL( ID_TOOLBARH_PCB_MODE_TRACKS, WinEDA_PcbFrame::AutoPlace )
EVT_TOOL( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, EVT_TOOL( ID_TOOLBARH_PCB_FREEROUTE_ACCESS,
WinEDA_PcbFrame::Access_to_External_Tool ) WinEDA_PcbFrame::Access_to_External_Tool )
......
...@@ -215,8 +215,8 @@ enum pcbnew_ids ...@@ -215,8 +215,8 @@ enum pcbnew_ids
ID_MENU_PCB_SWAP_LAYERS, ID_MENU_PCB_SWAP_LAYERS,
ID_GEN_EXPORT_FILE_VRML, ID_GEN_EXPORT_FILE_VRML,
ID_TOOLBARH_PCB_AUTOPLACE, ID_TOOLBARH_PCB_MODE_MODULE,
ID_TOOLBARH_PCB_AUTOROUTE, ID_TOOLBARH_PCB_MODE_TRACKS,
ID_TOOLBARH_PCB_FREEROUTE_ACCESS, ID_TOOLBARH_PCB_FREEROUTE_ACCESS,
ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR,
......
...@@ -274,11 +274,11 @@ void WinEDA_PcbFrame::ReCreateHToolbar() ...@@ -274,11 +274,11 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
*LayerPairBitmap, SEL_LAYER_HELP ); *LayerPairBitmap, SEL_LAYER_HELP );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_TOOLBARH_PCB_AUTOPLACE, wxEmptyString, m_HToolBar->AddTool( ID_TOOLBARH_PCB_MODE_MODULE, wxEmptyString,
wxBitmap( mode_module_xpm ), wxBitmap( mode_module_xpm ),
_( "Mode footprint: manual and automatic move and place modules" ), _( "Mode footprint: manual and automatic move and place modules" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_HToolBar->AddTool( ID_TOOLBARH_PCB_AUTOROUTE, wxEmptyString, m_HToolBar->AddTool( ID_TOOLBARH_PCB_MODE_TRACKS, wxEmptyString,
wxBitmap( mode_track_xpm ), wxBitmap( mode_track_xpm ),
_( "Mode track: autorouting" ), wxITEM_CHECK ); _( "Mode track: autorouting" ), wxITEM_CHECK );
......
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