Commit affbb8a8 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: minor coding style fixes. Very minor fixes. Minor enhancements. Fix bug #1085523

parents 91d5bb58 8f52ba14
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
#ifndef KICAD_BUILD_VERSION #ifndef KICAD_BUILD_VERSION
#if defined KICAD_GOST #if defined KICAD_GOST
# define KICAD_BUILD_VERSION "(2012-oct-18 GOST)" # define KICAD_BUILD_VERSION "(2012-nov-02 GOST)"
#else #else
# define KICAD_BUILD_VERSION "(2012-oct-18)" # define KICAD_BUILD_VERSION "(2012-nov-02)"
#endif #endif
#endif #endif
......
...@@ -471,6 +471,18 @@ public: ...@@ -471,6 +471,18 @@ public:
*/ */
bool OnHotkeyRotateItem( int aIdCommand ); 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 OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
void Tracks_and_Vias_Size_Event( wxCommandEvent& event ); void Tracks_and_Vias_Size_Event( wxCommandEvent& event );
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011) // C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -9,7 +9,7 @@ ...@@ -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 ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
...@@ -31,8 +31,10 @@ DIALOG_GLOBAL_PADS_EDITION_BASE::DIALOG_GLOBAL_PADS_EDITION_BASE( wxWindow* pare ...@@ -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 ); 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 ); sbSizer1->Add( m_Pad_Orient_Filter_CB, 0, wxALL, 5 );
bLeftSizer->Add( sbSizer1, 1, wxEXPAND, 5 ); bLeftSizer->Add( sbSizer1, 1, wxEXPAND, 5 );
bMainSizer->Add( bLeftSizer, 1, wxEXPAND, 5 ); bMainSizer->Add( bLeftSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bRightSizer; wxBoxSizer* bRightSizer;
...@@ -53,8 +55,10 @@ DIALOG_GLOBAL_PADS_EDITION_BASE::DIALOG_GLOBAL_PADS_EDITION_BASE( wxWindow* pare ...@@ -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 ); m_buttonCancel = new wxButton( this, wxID_ANY, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_buttonCancel, 0, wxALL|wxEXPAND, 5 ); bRightSizer->Add( m_buttonCancel, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( bRightSizer, 0, wxEXPAND, 5 ); bMainSizer->Add( bRightSizer, 0, wxEXPAND, 5 );
this->SetSizer( bMainSizer ); this->SetSizer( bMainSizer );
this->Layout(); this->Layout();
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011) // C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h> #include <wx/string.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
...@@ -31,7 +32,7 @@ ...@@ -31,7 +32,7 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GLOBAL_PADS_EDITION_BASE /// Class DIALOG_GLOBAL_PADS_EDITION_BASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class DIALOG_GLOBAL_PADS_EDITION_BASE : public wxDialog class DIALOG_GLOBAL_PADS_EDITION_BASE : public DIALOG_SHIM
{ {
private: private:
......
...@@ -305,6 +305,7 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) ...@@ -305,6 +305,7 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
case PLOT_FORMAT_SVG: case PLOT_FORMAT_SVG:
m_drillShapeOpt->Enable( true ); m_drillShapeOpt->Enable( true );
m_plotModeOpt->Enable( false ); m_plotModeOpt->Enable( false );
m_plotModeOpt->SetSelection( 1 );
m_plotMirrorOpt->Enable( true ); m_plotMirrorOpt->Enable( true );
m_useAuxOriginCheckBox->Enable( false ); m_useAuxOriginCheckBox->Enable( false );
m_useAuxOriginCheckBox->SetValue( false ); m_useAuxOriginCheckBox->SetValue( false );
......
...@@ -56,9 +56,6 @@ ...@@ -56,9 +56,6 @@
#include <dialog_global_edit_tracks_and_vias.h> #include <dialog_global_edit_tracks_and_vias.h>
// Uncomment following line to enable wxBell() command (which beeps speaker)
// #include <wx/utils.h>
/* Handles the selection of command events. */ /* Handles the selection of command events. */
void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{ {
...@@ -94,6 +91,7 @@ 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_MODULE:
case ID_POPUP_PCB_EDIT_TEXTMODULE: case ID_POPUP_PCB_EDIT_TEXTMODULE:
case ID_POPUP_PCB_STOP_CURRENT_DRAWING: case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
case ID_POPUP_PCB_BEGIN_TRACK:
case ID_POPUP_PCB_END_TRACK: case ID_POPUP_PCB_END_TRACK:
case ID_POPUP_PCB_PLACE_VIA: case ID_POPUP_PCB_PLACE_VIA:
case ID_POPUP_PCB_SWITCH_TRACK_POSTURE: case ID_POPUP_PCB_SWITCH_TRACK_POSTURE:
...@@ -342,6 +340,11 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -342,6 +340,11 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_BEGIN_TRACK:
m_canvas->MoveCursorToCrossHair();
OnHotkeyBeginRoute( &dc );
break;
case ID_POPUP_PCB_END_TRACK: case ID_POPUP_PCB_END_TRACK:
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
End_Route( (TRACK*) GetCurItem(), &dc ); End_Route( (TRACK*) GetCurItem(), &dc );
...@@ -1225,14 +1228,7 @@ void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, int layer ) ...@@ -1225,14 +1228,7 @@ void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, int layer )
if( GetBoard()->GetCopperLayerCount() < 2 ) if( GetBoard()->GetCopperLayerCount() < 2 )
{ {
if( layer != LAYER_N_BACK ) 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; return;
}
} }
// If more than one copper layer is enabled, the "Copper" // If more than one copper layer is enabled, the "Copper"
// and "Component" layers can be selected, but the total // and "Component" layers can be selected, but the total
...@@ -1242,14 +1238,7 @@ void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, int layer ) ...@@ -1242,14 +1238,7 @@ void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, int layer )
{ {
if( ( layer != LAYER_N_BACK ) && ( layer != LAYER_N_FRONT ) if( ( layer != LAYER_N_BACK ) && ( layer != LAYER_N_FRONT )
&& ( layer >= GetBoard()->GetCopperLayerCount() - 1 ) ) && ( 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; return;
}
} }
EDA_ITEM* current = GetScreen()->GetCurItem(); EDA_ITEM* current = GetScreen()->GetCurItem();
......
...@@ -58,6 +58,14 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) ...@@ -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_WIDTH6:
case ID_POPUP_PCB_SELECT_WIDTH7: case ID_POPUP_PCB_SELECT_WIDTH7:
case ID_POPUP_PCB_SELECT_WIDTH8: 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(); m_canvas->MoveCursorToCrossHair();
GetDesignSettings().m_UseConnectedTrackWidth = false; GetDesignSettings().m_UseConnectedTrackWidth = false;
ii = id - ID_POPUP_PCB_SELECT_WIDTH1; ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
...@@ -71,7 +79,16 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) ...@@ -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_VIASIZE5:
case ID_POPUP_PCB_SELECT_VIASIZE6: case ID_POPUP_PCB_SELECT_VIASIZE6:
case ID_POPUP_PCB_SELECT_VIASIZE7: 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(); m_canvas->MoveCursorToCrossHair();
ii = id - ID_POPUP_PCB_SELECT_VIASIZE1; ii = id - ID_POPUP_PCB_SELECT_VIASIZE1;
GetBoard()->m_ViaSizeSelector = ii; GetBoard()->m_ViaSizeSelector = ii;
...@@ -91,4 +108,12 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) ...@@ -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") ); wxMessageBox( wxT( "PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event() error") );
break; 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 );
}
} }
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
class DIALOG_GLOBAL_PADS_EDITION : public DIALOG_GLOBAL_PADS_EDITION_BASE class DIALOG_GLOBAL_PADS_EDITION : public DIALOG_GLOBAL_PADS_EDITION_BASE
{ {
private: private:
PCB_BASE_FRAME* m_Parent; PCB_BASE_FRAME* m_parent;
D_PAD* m_CurrentPad; D_PAD* m_currentPad;
public: public:
static bool m_Pad_Shape_Filter; static bool m_Pad_Shape_Filter;
...@@ -45,8 +45,8 @@ private: ...@@ -45,8 +45,8 @@ private:
DIALOG_GLOBAL_PADS_EDITION::DIALOG_GLOBAL_PADS_EDITION( PCB_BASE_FRAME* aParent, D_PAD* aPad ) : DIALOG_GLOBAL_PADS_EDITION::DIALOG_GLOBAL_PADS_EDITION( PCB_BASE_FRAME* aParent, D_PAD* aPad ) :
DIALOG_GLOBAL_PADS_EDITION_BASE( aParent ) DIALOG_GLOBAL_PADS_EDITION_BASE( aParent )
{ {
m_Parent = aParent; m_parent = aParent;
m_CurrentPad = aPad; m_currentPad = aPad;
// Pad filter selection. // Pad filter selection.
m_Pad_Shape_Filter_CB->SetValue( m_Pad_Shape_Filter ); m_Pad_Shape_Filter_CB->SetValue( m_Pad_Shape_Filter );
...@@ -76,7 +76,7 @@ void DIALOG_GLOBAL_PADS_EDITION::OnCancelClick( wxCommandEvent& event ) ...@@ -76,7 +76,7 @@ void DIALOG_GLOBAL_PADS_EDITION::OnCancelClick( wxCommandEvent& event )
*/ */
void DIALOG_GLOBAL_PADS_EDITION::InstallPadEditor( 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 ) ...@@ -101,7 +101,7 @@ void DIALOG_GLOBAL_PADS_EDITION::PadPropertiesAccept( wxCommandEvent& event )
break; break;
} }
m_Parent->OnModify(); m_parent->OnModify();
} }
......
...@@ -59,26 +59,28 @@ enum hotkey_id_commnand { ...@@ -59,26 +59,28 @@ enum hotkey_id_commnand {
HK_SWITCH_LAYER_TO_INNER14, HK_SWITCH_LAYER_TO_INNER14,
HK_ADD_MODULE, HK_ADD_MODULE,
HK_SLIDE_TRACK, HK_SLIDE_TRACK,
HK_RECORD_MACROS_0, 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_RECORD_MACROS_3,
HK_RECORD_MACROS_4,
HK_RECORD_MACROS_5,
HK_RECORD_MACROS_6,
HK_RECORD_MACROS_7,
HK_RECORD_MACROS_8,
HK_RECORD_MACROS_9,
HK_CALL_MACROS_0, HK_CALL_MACROS_0,
HK_RECORD_MACROS_1,
HK_CALL_MACROS_1, HK_CALL_MACROS_1,
HK_RECORD_MACROS_2,
HK_CALL_MACROS_2, HK_CALL_MACROS_2,
HK_RECORD_MACROS_3,
HK_CALL_MACROS_3, HK_CALL_MACROS_3,
HK_RECORD_MACROS_4,
HK_CALL_MACROS_4, HK_CALL_MACROS_4,
HK_RECORD_MACROS_5,
HK_CALL_MACROS_5, HK_CALL_MACROS_5,
HK_RECORD_MACROS_6,
HK_CALL_MACROS_6, HK_CALL_MACROS_6,
HK_RECORD_MACROS_7,
HK_CALL_MACROS_7, HK_CALL_MACROS_7,
HK_RECORD_MACROS_8,
HK_CALL_MACROS_8, HK_CALL_MACROS_8,
HK_RECORD_MACROS_9,
HK_CALL_MACROS_9, HK_CALL_MACROS_9,
HK_MACRO_ID_END,
HK_SWITCH_HIGHCONTRAST_MODE, HK_SWITCH_HIGHCONTRAST_MODE,
}; };
......
...@@ -24,9 +24,8 @@ ...@@ -24,9 +24,8 @@
void PCB_EDIT_FRAME::RecordMacros(wxDC* aDC, int aNumber) void PCB_EDIT_FRAME::RecordMacros(wxDC* aDC, int aNumber)
{ {
assert( aNumber >= 0 ); wxASSERT( aNumber >= 0 && aNumber < 10 );
assert( aNumber < 10 ); wxString msg;
wxString msg, tmp;
if( m_RecordingMacros < 0 ) if( m_RecordingMacros < 0 )
{ {
...@@ -34,14 +33,14 @@ void PCB_EDIT_FRAME::RecordMacros(wxDC* aDC, int aNumber) ...@@ -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_StartPosition = GetScreen()->GetCrossHairPosition( false );
m_Macros[aNumber].m_Record.clear(); m_Macros[aNumber].m_Record.clear();
msg.Printf( wxT( "%s %d" ), _( "Recording macros" ), aNumber ); msg.Printf( _( "Recording macro %d" ), aNumber );
SetStatusText( msg ); SetStatusText( msg );
} }
else else
{ {
m_RecordingMacros = -1; m_RecordingMacros = -1;
msg.Printf( wxT( "%s %d %s" ), _( "Macros" ), aNumber, _( "recorded" ) ); msg.Printf( _( "Macro %d recorded" ), aNumber );
SetStatusText( msg ); SetStatusText( msg );
} }
} }
...@@ -54,7 +53,7 @@ void PCB_EDIT_FRAME::CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumbe ...@@ -54,7 +53,7 @@ void PCB_EDIT_FRAME::CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumbe
wxString msg; wxString msg;
msg.Printf( wxT( "%s %d" ), _( "Call macros" ), aNumber ); msg.Printf( _( "Call macro %d" ), aNumber );
SetStatusText( msg ); SetStatusText( msg );
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
...@@ -110,27 +109,10 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -110,27 +109,10 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
if( HK_Descr == NULL ) if( HK_Descr == NULL )
return; return;
if( (m_RecordingMacros != -1) int hk_id = HK_Descr->m_Idcommand;
&& (HK_Descr->m_Idcommand != HK_RECORD_MACROS_1)
&& (HK_Descr->m_Idcommand != HK_CALL_MACROS_1) if( (m_RecordingMacros != -1) &&
&& (HK_Descr->m_Idcommand != HK_RECORD_MACROS_2) !( hk_id > HK_MACRO_ID_BEGIN && hk_id < HK_MACRO_ID_END) )
&& (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) )
{ {
MACROS_RECORD macros_record; MACROS_RECORD macros_record;
macros_record.m_HotkeyCode = aHotkeyCode; macros_record.m_HotkeyCode = aHotkeyCode;
...@@ -138,6 +120,9 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -138,6 +120,9 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
macros_record.m_Position = screen->GetNearestGridPosition( aPosition ) - macros_record.m_Position = screen->GetNearestGridPosition( aPosition ) -
m_Macros[m_RecordingMacros].m_StartPosition; m_Macros[m_RecordingMacros].m_StartPosition;
m_Macros[m_RecordingMacros].m_Record.push_back( macros_record ); 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 // 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 ...@@ -147,7 +132,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
int ll; int ll;
unsigned int cnt; unsigned int cnt;
switch( HK_Descr->m_Idcommand ) switch( hk_id )
{ {
default: default:
case HK_NOT_FOUND: case HK_NOT_FOUND:
...@@ -155,83 +140,30 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -155,83 +140,30 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
break; break;
case HK_RECORD_MACROS_0: case HK_RECORD_MACROS_0:
RecordMacros( aDC, 0 );
break;
case HK_RECORD_MACROS_1: case HK_RECORD_MACROS_1:
RecordMacros( aDC, 1 );
break;
case HK_RECORD_MACROS_2: case HK_RECORD_MACROS_2:
RecordMacros( aDC, 2 );
break;
case HK_RECORD_MACROS_3: case HK_RECORD_MACROS_3:
RecordMacros( aDC, 3 );
break;
case HK_RECORD_MACROS_4: case HK_RECORD_MACROS_4:
RecordMacros( aDC, 4 );
break;
case HK_RECORD_MACROS_5: case HK_RECORD_MACROS_5:
RecordMacros( aDC, 5 );
break;
case HK_RECORD_MACROS_6: case HK_RECORD_MACROS_6:
RecordMacros( aDC, 6 );
break;
case HK_RECORD_MACROS_7: case HK_RECORD_MACROS_7:
RecordMacros( aDC, 7 );
break;
case HK_RECORD_MACROS_8: case HK_RECORD_MACROS_8:
RecordMacros( aDC, 8 );
break;
case HK_RECORD_MACROS_9: case HK_RECORD_MACROS_9:
RecordMacros( aDC, 9 ); RecordMacros( aDC, hk_id - HK_RECORD_MACROS_0 );
break; break;
case HK_CALL_MACROS_0: case HK_CALL_MACROS_0:
CallMacros( aDC, screen->GetCrossHairPosition( false ), 0 );
break;
case HK_CALL_MACROS_1: case HK_CALL_MACROS_1:
CallMacros( aDC, screen->GetCrossHairPosition( false ), 1 );
break;
case HK_CALL_MACROS_2: case HK_CALL_MACROS_2:
CallMacros( aDC, screen->GetCrossHairPosition( false ), 2 );
break;
case HK_CALL_MACROS_3: case HK_CALL_MACROS_3:
CallMacros( aDC, screen->GetCrossHairPosition( false ), 3 );
break;
case HK_CALL_MACROS_4: case HK_CALL_MACROS_4:
CallMacros( aDC, screen->GetCrossHairPosition( false ), 4 );
break;
case HK_CALL_MACROS_5: case HK_CALL_MACROS_5:
CallMacros( aDC, screen->GetCrossHairPosition( false ), 5 );
break;
case HK_CALL_MACROS_6: case HK_CALL_MACROS_6:
CallMacros( aDC, screen->GetCrossHairPosition( false ), 6 );
break;
case HK_CALL_MACROS_7: case HK_CALL_MACROS_7:
CallMacros( aDC, screen->GetCrossHairPosition( false ), 7 );
break;
case HK_CALL_MACROS_8: case HK_CALL_MACROS_8:
CallMacros( aDC, screen->GetCrossHairPosition( false ), 8 );
break;
case HK_CALL_MACROS_9: case HK_CALL_MACROS_9:
CallMacros( aDC, screen->GetCrossHairPosition( false ), 9 ); CallMacros( aDC, screen->GetCrossHairPosition( false ),
hk_id - HK_CALL_MACROS_0 );
break; break;
case HK_SWITCH_TRACK_WIDTH_TO_NEXT: case HK_SWITCH_TRACK_WIDTH_TO_NEXT:
...@@ -551,39 +483,8 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -551,39 +483,8 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
OnHotkeyPlaceItem( aDC ); OnHotkeyPlaceItem( aDC );
break; break;
case HK_ADD_NEW_TRACK: // Start new track case HK_ADD_NEW_TRACK: // Start new track, if possible
if( getActiveLayer() > LAYER_N_FRONT ) OnHotkeyBeginRoute( aDC );
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 );
}
break; break;
case HK_EDIT_ITEM: // Edit board item case HK_EDIT_ITEM: // Edit board item
...@@ -1017,6 +918,58 @@ bool PCB_EDIT_FRAME::OnHotkeyPlaceItem( wxDC* aDC ) ...@@ -1017,6 +918,58 @@ bool PCB_EDIT_FRAME::OnHotkeyPlaceItem( wxDC* aDC )
return false; 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 ) bool PCB_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand )
{ {
......
...@@ -336,11 +336,19 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -336,11 +336,19 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
break; break;
case ID_TRACK_BUTT: case ID_TRACK_BUTT:
aPopMenu->AppendSeparator();
if ( ! locate_track ) // This menu is already added when a track is located 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() ), AddMenuItem( aPopMenu, Append_Track_Width_List( GetBoard() ),
ID_POPUP_PCB_SELECT_WIDTH, _( "Select Track Width" ), ID_POPUP_PCB_SELECT_WIDTH, _( "Select Track Width" ),
KiBitmap( width_track_xpm ) ); KiBitmap( width_track_xpm ) );
}
AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_CU_LAYER, AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_CU_LAYER,
_( "Select Working Layer" ), KiBitmap( select_w_layer_xpm ) ); _( "Select Working Layer" ), KiBitmap( select_w_layer_xpm ) );
AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_LAYER_PAIR, AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_LAYER_PAIR,
...@@ -401,6 +409,11 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -401,6 +409,11 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
aPopMenu->AppendSeparator(); 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 ) if( locate_track )
AddMenuItem( aPopMenu, Append_Track_Width_List( GetBoard() ), AddMenuItem( aPopMenu, Append_Track_Width_List( GetBoard() ),
ID_POPUP_PCB_SELECT_WIDTH, _( "Select Track Width" ), ID_POPUP_PCB_SELECT_WIDTH, _( "Select Track Width" ),
...@@ -487,6 +500,11 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu ) ...@@ -487,6 +500,11 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
{ {
if( flags & IS_NEW ) 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 ); msg = AddHotkeyName( _( "End Track" ), g_Board_Editor_Hokeys_Descr, HK_END_TRACK );
AddMenuItem( PopMenu, ID_POPUP_PCB_END_TRACK, msg, KiBitmap( apply_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_PCB_END_TRACK, msg, KiBitmap( apply_xpm ) );
} }
......
...@@ -78,6 +78,7 @@ enum pcbnew_ids ...@@ -78,6 +78,7 @@ enum pcbnew_ids
ID_POPUP_PCB_DELETE_DRAWING_LAYER, ID_POPUP_PCB_DELETE_DRAWING_LAYER,
ID_POPUP_PCB_END_LINE, ID_POPUP_PCB_END_LINE,
ID_POPUP_PCB_BEGIN_TRACK,
ID_POPUP_PCB_EDIT_TRACK, ID_POPUP_PCB_EDIT_TRACK,
ID_POPUP_PCB_DELETE_TRACK, ID_POPUP_PCB_DELETE_TRACK,
ID_POPUP_PCB_DELETE_TRACKNET, ID_POPUP_PCB_DELETE_TRACKNET,
...@@ -175,6 +176,14 @@ enum pcbnew_ids ...@@ -175,6 +176,14 @@ enum pcbnew_ids
ID_POPUP_PCB_SELECT_WIDTH6, ID_POPUP_PCB_SELECT_WIDTH6,
ID_POPUP_PCB_SELECT_WIDTH7, ID_POPUP_PCB_SELECT_WIDTH7,
ID_POPUP_PCB_SELECT_WIDTH8, 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_VIASIZE,
ID_POPUP_PCB_SELECT_VIASIZE1, ID_POPUP_PCB_SELECT_VIASIZE1,
ID_POPUP_PCB_SELECT_VIASIZE2, ID_POPUP_PCB_SELECT_VIASIZE2,
...@@ -184,6 +193,14 @@ enum pcbnew_ids ...@@ -184,6 +193,14 @@ enum pcbnew_ids
ID_POPUP_PCB_SELECT_VIASIZE6, ID_POPUP_PCB_SELECT_VIASIZE6,
ID_POPUP_PCB_SELECT_VIASIZE7, ID_POPUP_PCB_SELECT_VIASIZE7,
ID_POPUP_PCB_SELECT_VIASIZE8, 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, ID_POPUP_PCB_SELECT_WIDTH_END_RANGE,
// reserve a block of MAX_ITEMS_IN_PICKER ids for the item selection popup // reserve a block of MAX_ITEMS_IN_PICKER ids for the item selection popup
......
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