diff --git a/common/build_version.cpp b/common/build_version.cpp index 10259e63ca..78b55b228f 100644 --- a/common/build_version.cpp +++ b/common/build_version.cpp @@ -7,9 +7,9 @@ #ifndef KICAD_BUILD_VERSION #if defined KICAD_GOST -# define KICAD_BUILD_VERSION "(2012-oct-18 GOST)" +# define KICAD_BUILD_VERSION "(2012-nov-02 GOST)" #else -# define KICAD_BUILD_VERSION "(2012-oct-18)" +# define KICAD_BUILD_VERSION "(2012-nov-02)" #endif #endif diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index a398f68c2a..1c99f9210f 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -471,6 +471,18 @@ public: */ bool OnHotkeyRotateItem( int aIdCommand ); + /** + * Function OnHotkeyBeginRoute + * If the current active layer is a copper layer, + * and if no item currently edited, start a new track segmenton + * the current copper layer. + * If a new track is in progress, terminate the current segment and + * start a new one. + * @param aDC = current device context + * @return a reference to the track if a track is created, or NULL + */ + TRACK * OnHotkeyBeginRoute( wxDC* aDC ); + void OnCloseWindow( wxCloseEvent& Event ); void Process_Special_Functions( wxCommandEvent& event ); void Tracks_and_Vias_Size_Event( wxCommandEvent& event ); diff --git a/pcbnew/dialogs/dialog_global_pads_edition_base.cpp b/pcbnew/dialogs/dialog_global_pads_edition_base.cpp index a98f780fdb..c4adf4cd20 100644 --- a/pcbnew/dialogs/dialog_global_pads_edition_base.cpp +++ b/pcbnew/dialogs/dialog_global_pads_edition_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 30 2011) +// C++ code generated with wxFormBuilder (version Apr 10 2012) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -9,7 +9,7 @@ /////////////////////////////////////////////////////////////////////////// -DIALOG_GLOBAL_PADS_EDITION_BASE::DIALOG_GLOBAL_PADS_EDITION_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +DIALOG_GLOBAL_PADS_EDITION_BASE::DIALOG_GLOBAL_PADS_EDITION_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); @@ -31,8 +31,10 @@ DIALOG_GLOBAL_PADS_EDITION_BASE::DIALOG_GLOBAL_PADS_EDITION_BASE( wxWindow* pare m_Pad_Orient_Filter_CB = new wxCheckBox( this, wxID_ANY, _("Do not modify pads having a different orientation"), wxDefaultPosition, wxDefaultSize, 0 ); sbSizer1->Add( m_Pad_Orient_Filter_CB, 0, wxALL, 5 ); + bLeftSizer->Add( sbSizer1, 1, wxEXPAND, 5 ); + bMainSizer->Add( bLeftSizer, 1, wxEXPAND, 5 ); wxBoxSizer* bRightSizer; @@ -53,8 +55,10 @@ DIALOG_GLOBAL_PADS_EDITION_BASE::DIALOG_GLOBAL_PADS_EDITION_BASE( wxWindow* pare m_buttonCancel = new wxButton( this, wxID_ANY, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); bRightSizer->Add( m_buttonCancel, 0, wxALL|wxEXPAND, 5 ); + bMainSizer->Add( bRightSizer, 0, wxEXPAND, 5 ); + this->SetSizer( bMainSizer ); this->Layout(); diff --git a/pcbnew/dialogs/dialog_global_pads_edition_base.fbp b/pcbnew/dialogs/dialog_global_pads_edition_base.fbp index 16bbc2b08d..5704c8caea 100644 --- a/pcbnew/dialogs/dialog_global_pads_edition_base.fbp +++ b/pcbnew/dialogs/dialog_global_pads_edition_base.fbp @@ -2,10 +2,11 @@ - + C++ 1 source_name + 0 0 res UTF-8 @@ -15,111 +16,78 @@ none 1 dialog_global_pads_edition - + . - + 1 + 1 1 0 0 - 1 - 1 - 1 - 1 0 - - - - - 1 - - 0 - 1 - + wxAUI_MGR_DEFAULT + + + 1 - 0 - Dock - 0 - Left 1 impl_virtual - - - 1 - - 0 + + + 0 wxID_ANY - - - 0 - - - 0 - - 1 + + DIALOG_GLOBAL_PADS_EDITION_BASE - 1 - - - 1 - - - Resizable - - 1 + 482,165 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - + DIALOG_SHIM; dialog_shim.h Global Pads Edition - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + bMainSizer wxHORIZONTAL none @@ -128,7 +96,7 @@ wxEXPAND 1 - + bLeftSizer wxVERTICAL none @@ -139,11 +107,11 @@ wxID_ANY Pad Filter : - + sbSizer1 wxVERTICAL none - + 5 wxALL @@ -153,83 +121,83 @@ 1 1 1 - - - - + + + + + + + 1 0 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Do not modify pads having a different shape - - + 0 - - + + 0 - + 1 m_Pad_Shape_Filter_CB 1 - - + + protected 1 - - + Resizable - 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -241,83 +209,83 @@ 1 1 1 - - - - + + + + + + + 1 0 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Do not modify pads having different layers - - + 0 - - + + 0 - + 1 m_Pad_Layer_Filter_CB 1 - - + + protected 1 - - + Resizable - 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -329,83 +297,83 @@ 1 1 1 - - - - + + + + + + + 1 0 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Do not modify pads having a different orientation - - + 0 - - + + 0 - + 1 m_Pad_Orient_Filter_CB 1 - - + + protected 1 - - + Resizable - 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -417,7 +385,7 @@ wxEXPAND 0 - + bRightSizer wxVERTICAL none @@ -430,14 +398,17 @@ 1 1 1 - - - - + + + + + + + 1 0 1 - + 1 0 0 @@ -445,73 +416,70 @@ 0 Left 1 - + 1 - + 0 0 ID_CHANGE_GET_PAD_SETTINGS Pad Editor - - + 0 - - + + 0 - + 1 m_buttonPadEditor 1 - - + + protected 1 - - + Resizable - 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - + + + + InstallPadEditor - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + 5 - + 0 10 @@ -528,14 +496,17 @@ 1 1 1 - - - - + + + + + + + 1 0 1 - + 1 0 0 @@ -543,68 +514,65 @@ 0 Left 1 - + 1 - + 0 0 ID_CHANGE_CURRENT_MODULE Change Pads on Module - - + 0 - - + + 0 - + 1 m_buttonChangeModule 1 - - + + protected 1 - - + Resizable - 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - + + + + PadPropertiesAccept - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -616,14 +584,17 @@ 1 1 1 - - - - + + + + + + + 1 0 1 - + 1 0 0 @@ -631,68 +602,65 @@ 0 Left 1 - + 1 - + 0 0 ID_CHANGE_ID_MODULES Change Pads on Same Modules - - + 0 - - + + 0 - + 1 m_buttonIdModules 1 - - + + public 1 - - + Resizable - 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - + + + + PadPropertiesAccept - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -704,14 +672,17 @@ 1 1 1 - - - - + + + + + + + 1 0 1 - + 1 0 0 @@ -719,68 +690,65 @@ 0 Left 1 - + 1 - + 0 0 wxID_ANY Cancel - - + 0 - - + + 0 - + 1 m_buttonCancel 1 - - + + protected 1 - - + Resizable - 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - + + + + OnCancelClick - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pcbnew/dialogs/dialog_global_pads_edition_base.h b/pcbnew/dialogs/dialog_global_pads_edition_base.h index 30f144ce85..a880709896 100644 --- a/pcbnew/dialogs/dialog_global_pads_edition_base.h +++ b/pcbnew/dialogs/dialog_global_pads_edition_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 30 2011) +// C++ code generated with wxFormBuilder (version Apr 10 2012) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -11,6 +11,7 @@ #include #include #include +#include "dialog_shim.h" #include #include #include @@ -31,7 +32,7 @@ /////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_GLOBAL_PADS_EDITION_BASE /////////////////////////////////////////////////////////////////////////////// -class DIALOG_GLOBAL_PADS_EDITION_BASE : public wxDialog +class DIALOG_GLOBAL_PADS_EDITION_BASE : public DIALOG_SHIM { private: diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index 2d7988500c..0f1aa46018 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -305,6 +305,7 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) case PLOT_FORMAT_SVG: m_drillShapeOpt->Enable( true ); m_plotModeOpt->Enable( false ); + m_plotModeOpt->SetSelection( 1 ); m_plotMirrorOpt->Enable( true ); m_useAuxOriginCheckBox->Enable( false ); m_useAuxOriginCheckBox->SetValue( false ); diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index b948611e9a..e9299160d1 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -56,9 +56,6 @@ #include -// Uncomment following line to enable wxBell() command (which beeps speaker) -// #include - /* Handles the selection of command events. */ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) { @@ -94,6 +91,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PCB_EDIT_MODULE: case ID_POPUP_PCB_EDIT_TEXTMODULE: case ID_POPUP_PCB_STOP_CURRENT_DRAWING: + case ID_POPUP_PCB_BEGIN_TRACK: case ID_POPUP_PCB_END_TRACK: case ID_POPUP_PCB_PLACE_VIA: case ID_POPUP_PCB_SWITCH_TRACK_POSTURE: @@ -342,6 +340,11 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) m_canvas->MoveCursorToCrossHair(); break; + case ID_POPUP_PCB_BEGIN_TRACK: + m_canvas->MoveCursorToCrossHair(); + OnHotkeyBeginRoute( &dc ); + break; + case ID_POPUP_PCB_END_TRACK: m_canvas->MoveCursorToCrossHair(); End_Route( (TRACK*) GetCurItem(), &dc ); @@ -1225,14 +1228,7 @@ void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, int layer ) if( GetBoard()->GetCopperLayerCount() < 2 ) { if( layer != LAYER_N_BACK ) - { - // Uncomment following command (and line 17) to beep - // the speaker. (Doing that would provide feedback to - // the user that the (layer-switching) command has been - // "acknowledged", but is unable to be acted upon.) -// wxBell(); return; - } } // If more than one copper layer is enabled, the "Copper" // and "Component" layers can be selected, but the total @@ -1242,14 +1238,7 @@ void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, int layer ) { if( ( layer != LAYER_N_BACK ) && ( layer != LAYER_N_FRONT ) && ( layer >= GetBoard()->GetCopperLayerCount() - 1 ) ) - { - // Uncomment following command (and line 17) to beep - // the speaker. (Doing that would provide feedback to - // the user that the (layer-switching) command has been - // "acknowledged", but is unable to be acted upon.) -// wxBell(); return; - } } EDA_ITEM* current = GetScreen()->GetCurItem(); diff --git a/pcbnew/event_handlers_tracks_vias_sizes.cpp b/pcbnew/event_handlers_tracks_vias_sizes.cpp index 3d4b797084..fd1966840d 100644 --- a/pcbnew/event_handlers_tracks_vias_sizes.cpp +++ b/pcbnew/event_handlers_tracks_vias_sizes.cpp @@ -58,6 +58,14 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) case ID_POPUP_PCB_SELECT_WIDTH6: case ID_POPUP_PCB_SELECT_WIDTH7: case ID_POPUP_PCB_SELECT_WIDTH8: + case ID_POPUP_PCB_SELECT_WIDTH9: + case ID_POPUP_PCB_SELECT_WIDTH10: + case ID_POPUP_PCB_SELECT_WIDTH11: + case ID_POPUP_PCB_SELECT_WIDTH12: + case ID_POPUP_PCB_SELECT_WIDTH13: + case ID_POPUP_PCB_SELECT_WIDTH14: + case ID_POPUP_PCB_SELECT_WIDTH15: + case ID_POPUP_PCB_SELECT_WIDTH16: m_canvas->MoveCursorToCrossHair(); GetDesignSettings().m_UseConnectedTrackWidth = false; ii = id - ID_POPUP_PCB_SELECT_WIDTH1; @@ -71,7 +79,16 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) case ID_POPUP_PCB_SELECT_VIASIZE5: case ID_POPUP_PCB_SELECT_VIASIZE6: case ID_POPUP_PCB_SELECT_VIASIZE7: - case ID_POPUP_PCB_SELECT_VIASIZE8: // select the new current value for via size (via diameter) + case ID_POPUP_PCB_SELECT_VIASIZE8: + case ID_POPUP_PCB_SELECT_VIASIZE9: + case ID_POPUP_PCB_SELECT_VIASIZE10: + case ID_POPUP_PCB_SELECT_VIASIZE11: + case ID_POPUP_PCB_SELECT_VIASIZE12: + case ID_POPUP_PCB_SELECT_VIASIZE13: + case ID_POPUP_PCB_SELECT_VIASIZE14: + case ID_POPUP_PCB_SELECT_VIASIZE15: + case ID_POPUP_PCB_SELECT_VIASIZE16: + // select the new current value for via size (via diameter) m_canvas->MoveCursorToCrossHair(); ii = id - ID_POPUP_PCB_SELECT_VIASIZE1; GetBoard()->m_ViaSizeSelector = ii; @@ -91,4 +108,12 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) wxMessageBox( wxT( "PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event() error") ); break; } + + // Refresh track in progress, if any, by forcing a mouse event, + // to call the current function attached to the mouse + if( m_canvas->IsMouseCaptured() ) + { + wxMouseEvent event(wxEVT_MOTION); + wxPostEvent( m_canvas, event ); + } } diff --git a/pcbnew/globaleditpad.cpp b/pcbnew/globaleditpad.cpp index 42d88ac0f3..bf5cd22726 100644 --- a/pcbnew/globaleditpad.cpp +++ b/pcbnew/globaleditpad.cpp @@ -24,8 +24,8 @@ class DIALOG_GLOBAL_PADS_EDITION : public DIALOG_GLOBAL_PADS_EDITION_BASE { private: - PCB_BASE_FRAME* m_Parent; - D_PAD* m_CurrentPad; + PCB_BASE_FRAME* m_parent; + D_PAD* m_currentPad; public: static bool m_Pad_Shape_Filter; @@ -45,8 +45,8 @@ private: DIALOG_GLOBAL_PADS_EDITION::DIALOG_GLOBAL_PADS_EDITION( PCB_BASE_FRAME* aParent, D_PAD* aPad ) : DIALOG_GLOBAL_PADS_EDITION_BASE( aParent ) { - m_Parent = aParent; - m_CurrentPad = aPad; + m_parent = aParent; + m_currentPad = aPad; // Pad filter selection. m_Pad_Shape_Filter_CB->SetValue( m_Pad_Shape_Filter ); @@ -76,7 +76,7 @@ void DIALOG_GLOBAL_PADS_EDITION::OnCancelClick( wxCommandEvent& event ) */ void DIALOG_GLOBAL_PADS_EDITION::InstallPadEditor( wxCommandEvent& event ) { - m_Parent->InstallPadOptionsFrame( m_CurrentPad ); + m_parent->InstallPadOptionsFrame( m_currentPad ); } @@ -101,7 +101,7 @@ void DIALOG_GLOBAL_PADS_EDITION::PadPropertiesAccept( wxCommandEvent& event ) break; } - m_Parent->OnModify(); + m_parent->OnModify(); } diff --git a/pcbnew/hotkeys.h b/pcbnew/hotkeys.h index d2aa0afbc6..98e18fb565 100644 --- a/pcbnew/hotkeys.h +++ b/pcbnew/hotkeys.h @@ -59,26 +59,28 @@ enum hotkey_id_commnand { HK_SWITCH_LAYER_TO_INNER14, HK_ADD_MODULE, HK_SLIDE_TRACK, - HK_RECORD_MACROS_0, - HK_CALL_MACROS_0, - HK_RECORD_MACROS_1, - HK_CALL_MACROS_1, + HK_MACRO_ID_BEGIN, + HK_RECORD_MACROS_0, // keep these id ordered from 0 to 9 + HK_RECORD_MACROS_1, // because this order is used in code HK_RECORD_MACROS_2, - HK_CALL_MACROS_2, HK_RECORD_MACROS_3, - HK_CALL_MACROS_3, HK_RECORD_MACROS_4, - HK_CALL_MACROS_4, HK_RECORD_MACROS_5, - HK_CALL_MACROS_5, HK_RECORD_MACROS_6, - HK_CALL_MACROS_6, HK_RECORD_MACROS_7, - HK_CALL_MACROS_7, HK_RECORD_MACROS_8, - HK_CALL_MACROS_8, HK_RECORD_MACROS_9, + HK_CALL_MACROS_0, + HK_CALL_MACROS_1, + HK_CALL_MACROS_2, + HK_CALL_MACROS_3, + HK_CALL_MACROS_4, + HK_CALL_MACROS_5, + HK_CALL_MACROS_6, + HK_CALL_MACROS_7, + HK_CALL_MACROS_8, HK_CALL_MACROS_9, + HK_MACRO_ID_END, HK_SWITCH_HIGHCONTRAST_MODE, }; diff --git a/pcbnew/hotkeys_board_editor.cpp b/pcbnew/hotkeys_board_editor.cpp index b428ce3986..331d336552 100644 --- a/pcbnew/hotkeys_board_editor.cpp +++ b/pcbnew/hotkeys_board_editor.cpp @@ -24,9 +24,8 @@ void PCB_EDIT_FRAME::RecordMacros(wxDC* aDC, int aNumber) { - assert( aNumber >= 0 ); - assert( aNumber < 10 ); - wxString msg, tmp; + wxASSERT( aNumber >= 0 && aNumber < 10 ); + wxString msg; if( m_RecordingMacros < 0 ) { @@ -34,14 +33,14 @@ void PCB_EDIT_FRAME::RecordMacros(wxDC* aDC, int aNumber) m_Macros[aNumber].m_StartPosition = GetScreen()->GetCrossHairPosition( false ); m_Macros[aNumber].m_Record.clear(); - msg.Printf( wxT( "%s %d" ), _( "Recording macros" ), aNumber ); + msg.Printf( _( "Recording macro %d" ), aNumber ); SetStatusText( msg ); } else { m_RecordingMacros = -1; - msg.Printf( wxT( "%s %d %s" ), _( "Macros" ), aNumber, _( "recorded" ) ); + msg.Printf( _( "Macro %d recorded" ), aNumber ); SetStatusText( msg ); } } @@ -54,7 +53,7 @@ void PCB_EDIT_FRAME::CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumbe wxString msg; - msg.Printf( wxT( "%s %d" ), _( "Call macros" ), aNumber ); + msg.Printf( _( "Call macro %d" ), aNumber ); SetStatusText( msg ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); @@ -110,27 +109,10 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit if( HK_Descr == NULL ) return; - if( (m_RecordingMacros != -1) - && (HK_Descr->m_Idcommand != HK_RECORD_MACROS_1) - && (HK_Descr->m_Idcommand != HK_CALL_MACROS_1) - && (HK_Descr->m_Idcommand != HK_RECORD_MACROS_2) - && (HK_Descr->m_Idcommand != HK_CALL_MACROS_2) - && (HK_Descr->m_Idcommand != HK_RECORD_MACROS_3) - && (HK_Descr->m_Idcommand != HK_CALL_MACROS_3) - && (HK_Descr->m_Idcommand != HK_RECORD_MACROS_4) - && (HK_Descr->m_Idcommand != HK_CALL_MACROS_4) - && (HK_Descr->m_Idcommand != HK_RECORD_MACROS_5) - && (HK_Descr->m_Idcommand != HK_CALL_MACROS_5) - && (HK_Descr->m_Idcommand != HK_RECORD_MACROS_6) - && (HK_Descr->m_Idcommand != HK_CALL_MACROS_6) - && (HK_Descr->m_Idcommand != HK_RECORD_MACROS_7) - && (HK_Descr->m_Idcommand != HK_CALL_MACROS_7) - && (HK_Descr->m_Idcommand != HK_RECORD_MACROS_8) - && (HK_Descr->m_Idcommand != HK_CALL_MACROS_8) - && (HK_Descr->m_Idcommand != HK_RECORD_MACROS_9) - && (HK_Descr->m_Idcommand != HK_CALL_MACROS_9) - && (HK_Descr->m_Idcommand != HK_RECORD_MACROS_0) - && (HK_Descr->m_Idcommand != HK_CALL_MACROS_0) ) + int hk_id = HK_Descr->m_Idcommand; + + if( (m_RecordingMacros != -1) && + !( hk_id > HK_MACRO_ID_BEGIN && hk_id < HK_MACRO_ID_END) ) { MACROS_RECORD macros_record; macros_record.m_HotkeyCode = aHotkeyCode; @@ -138,6 +120,9 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit macros_record.m_Position = screen->GetNearestGridPosition( aPosition ) - m_Macros[m_RecordingMacros].m_StartPosition; m_Macros[m_RecordingMacros].m_Record.push_back( macros_record ); + wxString msg; + msg.Printf( _( "Add key [%c] in macro %d" ), aHotkeyCode, m_RecordingMacros ); + SetStatusText( msg ); } // Create a wxCommandEvent that will be posted in some hot keys functions @@ -147,7 +132,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit int ll; unsigned int cnt; - switch( HK_Descr->m_Idcommand ) + switch( hk_id ) { default: case HK_NOT_FOUND: @@ -155,83 +140,30 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit break; case HK_RECORD_MACROS_0: - RecordMacros( aDC, 0 ); - break; - case HK_RECORD_MACROS_1: - RecordMacros( aDC, 1 ); - break; - case HK_RECORD_MACROS_2: - RecordMacros( aDC, 2 ); - break; - case HK_RECORD_MACROS_3: - RecordMacros( aDC, 3 ); - break; - case HK_RECORD_MACROS_4: - RecordMacros( aDC, 4 ); - break; - case HK_RECORD_MACROS_5: - RecordMacros( aDC, 5 ); - break; - case HK_RECORD_MACROS_6: - RecordMacros( aDC, 6 ); - break; - case HK_RECORD_MACROS_7: - RecordMacros( aDC, 7 ); - break; - case HK_RECORD_MACROS_8: - RecordMacros( aDC, 8 ); - break; - case HK_RECORD_MACROS_9: - RecordMacros( aDC, 9 ); + RecordMacros( aDC, hk_id - HK_RECORD_MACROS_0 ); break; case HK_CALL_MACROS_0: - CallMacros( aDC, screen->GetCrossHairPosition( false ), 0 ); - break; - case HK_CALL_MACROS_1: - CallMacros( aDC, screen->GetCrossHairPosition( false ), 1 ); - break; - case HK_CALL_MACROS_2: - CallMacros( aDC, screen->GetCrossHairPosition( false ), 2 ); - break; - case HK_CALL_MACROS_3: - CallMacros( aDC, screen->GetCrossHairPosition( false ), 3 ); - break; - case HK_CALL_MACROS_4: - CallMacros( aDC, screen->GetCrossHairPosition( false ), 4 ); - break; - case HK_CALL_MACROS_5: - CallMacros( aDC, screen->GetCrossHairPosition( false ), 5 ); - break; - case HK_CALL_MACROS_6: - CallMacros( aDC, screen->GetCrossHairPosition( false ), 6 ); - break; - case HK_CALL_MACROS_7: - CallMacros( aDC, screen->GetCrossHairPosition( false ), 7 ); - break; - case HK_CALL_MACROS_8: - CallMacros( aDC, screen->GetCrossHairPosition( false ), 8 ); - break; - case HK_CALL_MACROS_9: - CallMacros( aDC, screen->GetCrossHairPosition( false ), 9 ); + CallMacros( aDC, screen->GetCrossHairPosition( false ), + hk_id - HK_CALL_MACROS_0 ); break; case HK_SWITCH_TRACK_WIDTH_TO_NEXT: @@ -551,39 +483,8 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit OnHotkeyPlaceItem( aDC ); break; - case HK_ADD_NEW_TRACK: // Start new track - if( getActiveLayer() > LAYER_N_FRONT ) - break; - - if( GetToolId() != ID_TRACK_BUTT && !itemCurrentlyEdited ) - { - cmd.SetId( ID_TRACK_BUTT ); - GetEventHandler()->ProcessEvent( cmd ); - } - - if( GetToolId() != ID_TRACK_BUTT ) - break; - - if( !itemCurrentlyEdited ) // no track in progress: - { - TRACK* track = Begin_Route( NULL, aDC ); - SetCurItem( track ); - - if( track ) - m_canvas->SetAutoPanRequest( true ); - } - else if( GetCurItem()->IsNew() ) - { - TRACK* track = Begin_Route( (TRACK*) GetCurItem(), aDC ); - - // SetCurItem() must not write to the msg panel - // because a track info is displayed while moving the mouse cursor - if( track ) // A new segment was created - SetCurItem( track, false ); - - m_canvas->SetAutoPanRequest( true ); - } - + case HK_ADD_NEW_TRACK: // Start new track, if possible + OnHotkeyBeginRoute( aDC ); break; case HK_EDIT_ITEM: // Edit board item @@ -1017,6 +918,58 @@ bool PCB_EDIT_FRAME::OnHotkeyPlaceItem( wxDC* aDC ) return false; } +/* + * Function OnHotkeyBeginRoute + * If the current active layer is a copper layer, + * and if no item currently edited, starta new track on + * the current copper layer + * If a new track is in progress, terminate the current segment and + * start a new one. + * Returns a reference to the track if a track is created, or NULL + */ +TRACK * PCB_EDIT_FRAME::OnHotkeyBeginRoute( wxDC* aDC ) +{ + if( getActiveLayer() > LAYER_N_FRONT ) + return NULL; + + bool itemCurrentlyEdited = (GetCurItem() && GetCurItem()->GetFlags()); + + // Ensure the track tool is active + if( GetToolId() != ID_TRACK_BUTT && !itemCurrentlyEdited ) + { + wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); + cmd.SetEventObject( this ); + cmd.SetId( ID_TRACK_BUTT ); + GetEventHandler()->ProcessEvent( cmd ); + } + + if( GetToolId() != ID_TRACK_BUTT ) + return NULL; + + TRACK* track = NULL; + + if( !itemCurrentlyEdited ) // no track in progress: + { + track = Begin_Route( NULL, aDC ); + SetCurItem( track ); + + if( track ) + m_canvas->SetAutoPanRequest( true ); + } + else if( GetCurItem()->IsNew() ) + { + track = Begin_Route( (TRACK*) GetCurItem(), aDC ); + + // SetCurItem() must not write to the msg panel + // because a track info is displayed while moving the mouse cursor + if( track ) // A new segment was created + SetCurItem( track, false ); + + m_canvas->SetAutoPanRequest( true ); + } + + return track; +} bool PCB_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand ) { diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index 9d2111589a..5b6eeccf98 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -336,11 +336,19 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) break; case ID_TRACK_BUTT: + aPopMenu->AppendSeparator(); + if ( ! locate_track ) // This menu is already added when a track is located + { + msg = AddHotkeyName( _( "Begin Track" ), + g_Board_Editor_Hokeys_Descr, HK_ADD_NEW_TRACK ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_BEGIN_TRACK, + msg, KiBitmap( add_tracks_xpm ) ); + AddMenuItem( aPopMenu, Append_Track_Width_List( GetBoard() ), ID_POPUP_PCB_SELECT_WIDTH, _( "Select Track Width" ), KiBitmap( width_track_xpm ) ); - + } AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_CU_LAYER, _( "Select Working Layer" ), KiBitmap( select_w_layer_xpm ) ); AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_LAYER_PAIR, @@ -401,6 +409,11 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) aPopMenu->AppendSeparator(); } + msg = AddHotkeyName( _( "Begin Track" ), + g_Board_Editor_Hokeys_Descr, HK_ADD_NEW_TRACK ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_BEGIN_TRACK, + msg, KiBitmap( add_tracks_xpm ) ); + if( locate_track ) AddMenuItem( aPopMenu, Append_Track_Width_List( GetBoard() ), ID_POPUP_PCB_SELECT_WIDTH, _( "Select Track Width" ), @@ -487,6 +500,11 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu ) { if( flags & IS_NEW ) { + msg = AddHotkeyName( _( "Begin Track" ), + g_Board_Editor_Hokeys_Descr, HK_ADD_NEW_TRACK ); + AddMenuItem( PopMenu, ID_POPUP_PCB_BEGIN_TRACK, + msg, KiBitmap( add_tracks_xpm ) ); + msg = AddHotkeyName( _( "End Track" ), g_Board_Editor_Hokeys_Descr, HK_END_TRACK ); AddMenuItem( PopMenu, ID_POPUP_PCB_END_TRACK, msg, KiBitmap( apply_xpm ) ); } diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h index bed0fb40f2..685e872f57 100644 --- a/pcbnew/pcbnew_id.h +++ b/pcbnew/pcbnew_id.h @@ -78,6 +78,7 @@ enum pcbnew_ids ID_POPUP_PCB_DELETE_DRAWING_LAYER, ID_POPUP_PCB_END_LINE, + ID_POPUP_PCB_BEGIN_TRACK, ID_POPUP_PCB_EDIT_TRACK, ID_POPUP_PCB_DELETE_TRACK, ID_POPUP_PCB_DELETE_TRACKNET, @@ -175,6 +176,14 @@ enum pcbnew_ids ID_POPUP_PCB_SELECT_WIDTH6, ID_POPUP_PCB_SELECT_WIDTH7, ID_POPUP_PCB_SELECT_WIDTH8, + ID_POPUP_PCB_SELECT_WIDTH9, + ID_POPUP_PCB_SELECT_WIDTH10, + ID_POPUP_PCB_SELECT_WIDTH11, + ID_POPUP_PCB_SELECT_WIDTH12, + ID_POPUP_PCB_SELECT_WIDTH13, + ID_POPUP_PCB_SELECT_WIDTH14, + ID_POPUP_PCB_SELECT_WIDTH15, + ID_POPUP_PCB_SELECT_WIDTH16, ID_POPUP_PCB_SELECT_VIASIZE, ID_POPUP_PCB_SELECT_VIASIZE1, ID_POPUP_PCB_SELECT_VIASIZE2, @@ -184,6 +193,14 @@ enum pcbnew_ids ID_POPUP_PCB_SELECT_VIASIZE6, ID_POPUP_PCB_SELECT_VIASIZE7, ID_POPUP_PCB_SELECT_VIASIZE8, + ID_POPUP_PCB_SELECT_VIASIZE9, + ID_POPUP_PCB_SELECT_VIASIZE10, + ID_POPUP_PCB_SELECT_VIASIZE11, + ID_POPUP_PCB_SELECT_VIASIZE12, + ID_POPUP_PCB_SELECT_VIASIZE13, + ID_POPUP_PCB_SELECT_VIASIZE14, + ID_POPUP_PCB_SELECT_VIASIZE15, + ID_POPUP_PCB_SELECT_VIASIZE16, ID_POPUP_PCB_SELECT_WIDTH_END_RANGE, // reserve a block of MAX_ITEMS_IN_PICKER ids for the item selection popup