Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
8f52ba14
Commit
8f52ba14
authored
Dec 01, 2012
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pcbnew: minor enhancements.
parent
91d5bb58
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
162 additions
and
146 deletions
+162
-146
wxPcbStruct.h
include/wxPcbStruct.h
+12
-0
edit.cpp
pcbnew/edit.cpp
+6
-17
event_handlers_tracks_vias_sizes.cpp
pcbnew/event_handlers_tracks_vias_sizes.cpp
+26
-1
hotkeys.h
pcbnew/hotkeys.h
+12
-10
hotkeys_board_editor.cpp
pcbnew/hotkeys_board_editor.cpp
+70
-117
onrightclick.cpp
pcbnew/onrightclick.cpp
+19
-1
pcbnew_id.h
pcbnew/pcbnew_id.h
+17
-0
No files found.
include/wxPcbStruct.h
View file @
8f52ba14
...
@@ -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
);
...
...
pcbnew/edit.cpp
View file @
8f52ba14
...
@@ -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
();
...
...
pcbnew/event_handlers_tracks_vias_sizes.cpp
View file @
8f52ba14
...
@@ -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
);
}
}
}
pcbnew/hotkeys.h
View file @
8f52ba14
...
@@ -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
,
};
};
...
...
pcbnew/hotkeys_board_editor.cpp
View file @
8f52ba14
...
@@ -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_Idcomman
d
)
switch
(
hk_i
d
)
{
{
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
)
{
{
...
...
pcbnew/onrightclick.cpp
View file @
8f52ba14
...
@@ -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
)
);
}
}
...
...
pcbnew/pcbnew_id.h
View file @
8f52ba14
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment