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
e21ebb72
Commit
e21ebb72
authored
Oct 24, 2011
by
Wayne Stambaugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factor Eeschema place item hot keys into select tool event handler.
parent
8e584fc2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
164 deletions
+63
-164
hotkeys.cpp
eeschema/hotkeys.cpp
+49
-164
schedit.cpp
eeschema/schedit.cpp
+14
-0
No files found.
eeschema/hotkeys.cpp
View file @
e21ebb72
...
@@ -130,20 +130,30 @@ static EDA_HOTKEY HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_SHIFT + GR_KB_CTRL + 'Z'
...
@@ -130,20 +130,30 @@ static EDA_HOTKEY HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_SHIFT + GR_KB_CTRL + 'Z'
#endif
#endif
// Schematic editor
// Schematic editor
static
EDA_HOTKEY
HkAddLabel
(
wxT
(
"add Label"
),
HK_ADD_LABEL
,
'L'
);
static
EDA_HOTKEY
HkAddLabel
(
wxT
(
"Add Label"
),
HK_ADD_LABEL
,
'L'
,
ID_LABEL_BUTT
);
static
EDA_HOTKEY
HkAddHierarchicalLabel
(
wxT
(
"Add Hierarchical Label"
),
HK_ADD_HLABEL
,
'H'
);
static
EDA_HOTKEY
HkAddHierarchicalLabel
(
wxT
(
"Add Hierarchical Label"
),
HK_ADD_HLABEL
,
'H'
,
static
EDA_HOTKEY
HkAddGlobalLabel
(
wxT
(
"Add Global Label"
),
HK_ADD_GLABEL
,
GR_KB_CTRL
+
'L'
);
ID_HIERLABEL_BUTT
);
static
EDA_HOTKEY
HkAddJunction
(
wxT
(
"Add Junction"
),
HK_ADD_JUNCTION
,
'J'
);
static
EDA_HOTKEY
HkAddGlobalLabel
(
wxT
(
"Add Global Label"
),
HK_ADD_GLABEL
,
GR_KB_CTRL
+
'L'
,
static
EDA_HOTKEY
HkBeginWire
(
wxT
(
"Draw Wire"
),
HK_BEGIN_WIRE
,
'W'
);
ID_GLABEL_BUTT
);
static
EDA_HOTKEY
HkBeginBus
(
wxT
(
"Draw Bus"
),
HK_BEGIN_BUS
,
'B'
);
static
EDA_HOTKEY
HkAddJunction
(
wxT
(
"Add Junction"
),
HK_ADD_JUNCTION
,
'J'
,
ID_JUNCTION_BUTT
);
static
EDA_HOTKEY
HkAddComponent
(
wxT
(
"Add Component"
),
HK_ADD_NEW_COMPONENT
,
'A'
);
static
EDA_HOTKEY
HkBeginWire
(
wxT
(
"Draw Wire"
),
HK_BEGIN_WIRE
,
'W'
,
ID_WIRE_BUTT
);
static
EDA_HOTKEY
HkAddPower
(
wxT
(
"Add Power"
),
HK_ADD_NEW_POWER
,
'P'
);
static
EDA_HOTKEY
HkBeginBus
(
wxT
(
"Draw Bus"
),
HK_BEGIN_BUS
,
'B'
,
ID_BUS_BUTT
);
static
EDA_HOTKEY
HkAddNoConn
(
wxT
(
"Add NoConnected Flag"
),
HK_ADD_NOCONN_FLAG
,
'Q'
);
static
EDA_HOTKEY
HkAddComponent
(
wxT
(
"Add Component"
),
HK_ADD_NEW_COMPONENT
,
'A'
,
static
EDA_HOTKEY
HkAddHierSheet
(
wxT
(
"Add Sheet"
),
HK_ADD_HIER_SHEET
,
'S'
);
ID_SCH_PLACE_COMPONENT
);
static
EDA_HOTKEY
HkAddBusEntry
(
wxT
(
"Add Bus Entry"
),
HK_ADD_BUS_ENTRY
,
'/'
);
static
EDA_HOTKEY
HkAddPower
(
wxT
(
"Add Power"
),
HK_ADD_NEW_POWER
,
'P'
,
static
EDA_HOTKEY
HkAddWireEntry
(
wxT
(
"Add Wire Entry"
),
HK_ADD_WIRE_ENTRY
,
'Z'
);
ID_PLACE_POWER_BUTT
);
static
EDA_HOTKEY
HkAddGraphicPolyLine
(
wxT
(
"Add Graphic PolyLine"
),
HK_ADD_GRAPHIC_POLYLINE
,
'I'
);
static
EDA_HOTKEY
HkAddNoConn
(
wxT
(
"Add NoConnected Flag"
),
HK_ADD_NOCONN_FLAG
,
'Q'
,
static
EDA_HOTKEY
HkAddGraphicText
(
wxT
(
"Add Graphic Text"
),
HK_ADD_GRAPHIC_TEXT
,
'T'
);
ID_NOCONN_BUTT
);
static
EDA_HOTKEY
HkAddHierSheet
(
wxT
(
"Add Sheet"
),
HK_ADD_HIER_SHEET
,
'S'
,
ID_SHEET_SYMBOL_BUTT
);
static
EDA_HOTKEY
HkAddBusEntry
(
wxT
(
"Add Bus Entry"
),
HK_ADD_BUS_ENTRY
,
'/'
,
ID_BUSTOBUS_ENTRY_BUTT
);
static
EDA_HOTKEY
HkAddWireEntry
(
wxT
(
"Add Wire Entry"
),
HK_ADD_WIRE_ENTRY
,
'Z'
,
ID_WIRETOBUS_ENTRY_BUTT
);
static
EDA_HOTKEY
HkAddGraphicPolyLine
(
wxT
(
"Add Graphic PolyLine"
),
HK_ADD_GRAPHIC_POLYLINE
,
'I'
,
ID_LINE_COMMENT_BUTT
);
static
EDA_HOTKEY
HkAddGraphicText
(
wxT
(
"Add Graphic Text"
),
HK_ADD_GRAPHIC_TEXT
,
'T'
,
ID_TEXT_COMMENT_BUTT
);
static
EDA_HOTKEY
HkMirrorYComponent
(
wxT
(
"Mirror Y Component"
),
HK_MIRROR_Y_COMPONENT
,
'Y'
);
static
EDA_HOTKEY
HkMirrorYComponent
(
wxT
(
"Mirror Y Component"
),
HK_MIRROR_Y_COMPONENT
,
'Y'
);
static
EDA_HOTKEY
HkMirrorXComponent
(
wxT
(
"Mirror X Component"
),
HK_MIRROR_X_COMPONENT
,
'X'
);
static
EDA_HOTKEY
HkMirrorXComponent
(
wxT
(
"Mirror X Component"
),
HK_MIRROR_X_COMPONENT
,
'X'
);
static
EDA_HOTKEY
HkOrientNormalComponent
(
wxT
(
"Orient Normal Component"
),
static
EDA_HOTKEY
HkOrientNormalComponent
(
wxT
(
"Orient Normal Component"
),
...
@@ -397,129 +407,30 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
...
@@ -397,129 +407,30 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break
;
break
;
case
HK_ADD_NEW_COMPONENT
:
// Add component
case
HK_ADD_NEW_COMPONENT
:
// Add component
if
(
!
itemInEdit
)
{
if
(
GetToolId
()
!=
ID_SCH_PLACE_COMPONENT
)
SetToolID
(
ID_SCH_PLACE_COMPONENT
,
wxCURSOR_PENCIL
,
_
(
"Add Component"
)
);
OnLeftClick
(
aDC
,
aPosition
);
}
break
;
case
HK_ADD_NEW_POWER
:
// Add power component
case
HK_ADD_NEW_POWER
:
// Add power component
if
(
!
itemInEdit
)
{
if
(
GetToolId
()
!=
ID_PLACE_POWER_BUTT
)
SetToolID
(
ID_PLACE_POWER_BUTT
,
wxCURSOR_PENCIL
,
_
(
"Add Power"
)
);
OnLeftClick
(
aDC
,
aPosition
);
}
break
;
case
HK_ADD_LABEL
:
case
HK_ADD_LABEL
:
if
(
notBusy
)
{
if
(
GetToolId
()
!=
ID_LABEL_BUTT
)
SetToolID
(
ID_LABEL_BUTT
,
wxCURSOR_PENCIL
,
_
(
"Add Label"
)
);
OnLeftClick
(
aDC
,
aPosition
);
}
break
;
case
HK_ADD_HLABEL
:
case
HK_ADD_HLABEL
:
if
(
notBusy
)
{
if
(
GetToolId
()
!=
ID_HIERLABEL_BUTT
)
SetToolID
(
ID_HIERLABEL_BUTT
,
wxCURSOR_PENCIL
,
_
(
"Add Hierarchical Label"
)
);
OnLeftClick
(
aDC
,
aPosition
);
}
break
;
case
HK_ADD_GLABEL
:
case
HK_ADD_GLABEL
:
if
(
notBusy
)
{
if
(
GetToolId
()
!=
ID_GLABEL_BUTT
)
SetToolID
(
ID_GLABEL_BUTT
,
wxCURSOR_PENCIL
,
_
(
"Add Global Label"
)
);
OnLeftClick
(
aDC
,
aPosition
);
}
break
;
case
HK_ADD_JUNCTION
:
case
HK_ADD_JUNCTION
:
if
(
notBusy
)
{
if
(
GetToolId
()
!=
ID_JUNCTION_BUTT
)
SetToolID
(
ID_JUNCTION_BUTT
,
wxCURSOR_PENCIL
,
_
(
"Add Junction"
)
);
OnLeftClick
(
aDC
,
aPosition
);
}
break
;
case
HK_ADD_WIRE_ENTRY
:
case
HK_ADD_WIRE_ENTRY
:
if
(
notBusy
)
{
if
(
GetToolId
()
!=
ID_WIRETOBUS_ENTRY_BUTT
)
SetToolID
(
ID_WIRETOBUS_ENTRY_BUTT
,
wxCURSOR_PENCIL
,
_
(
"Add Wire to Bus Entry"
)
);
OnLeftClick
(
aDC
,
aPosition
);
}
break
;
case
HK_ADD_BUS_ENTRY
:
case
HK_ADD_BUS_ENTRY
:
if
(
notBusy
)
{
if
(
GetToolId
()
!=
ID_BUSTOBUS_ENTRY_BUTT
)
SetToolID
(
ID_BUSTOBUS_ENTRY_BUTT
,
wxCURSOR_PENCIL
,
_
(
"Add Bus to Bus Entry"
)
);
OnLeftClick
(
aDC
,
aPosition
);
}
break
;
case
HK_ADD_HIER_SHEET
:
case
HK_ADD_HIER_SHEET
:
if
(
notBusy
)
{
if
(
GetToolId
()
!=
ID_SHEET_SYMBOL_BUTT
)
SetToolID
(
ID_SHEET_SYMBOL_BUTT
,
wxCURSOR_PENCIL
,
_
(
"Add Sheet"
)
);
OnLeftClick
(
aDC
,
aPosition
);
}
break
;
case
HK_ADD_GRAPHIC_TEXT
:
case
HK_ADD_GRAPHIC_TEXT
:
if
(
notBusy
)
{
if
(
GetToolId
()
!=
ID_TEXT_COMMENT_BUTT
)
SetToolID
(
ID_TEXT_COMMENT_BUTT
,
wxCURSOR_PENCIL
,
_
(
"Add Text"
)
);
OnLeftClick
(
aDC
,
aPosition
);
}
break
;
case
HK_ADD_GRAPHIC_POLYLINE
:
case
HK_ADD_GRAPHIC_POLYLINE
:
if
(
notBusy
)
case
HK_ADD_NOCONN_FLAG
:
// Add a no connected flag
{
if
(
GetToolId
()
!=
ID_LINE_COMMENT_BUTT
)
SetToolID
(
ID_LINE_COMMENT_BUTT
,
wxCURSOR_PENCIL
,
_
(
"Add Lines"
)
);
OnLeftClick
(
aDC
,
aPosition
);
}
break
;
case
HK_BEGIN_BUS
:
case
HK_BEGIN_BUS
:
// An item can be selected. If not a Bus, a begin command is not possible
case
HK_BEGIN_WIRE
:
if
(
notBusy
)
if
(
notBusy
)
{
{
if
(
GetToolId
()
!=
ID_BUS_BUTT
)
cmd
.
SetInt
(
aHotKey
);
SetToolID
(
ID_BUS_BUTT
,
wxCURSOR_PENCIL
,
_
(
"Add Bus"
)
);
cmd
.
SetClientData
(
new
EDA_HOTKEY_CLIENT_DATA
(
aPosition
)
);
cmd
.
SetId
(
hotKey
->
m_IdMenuEvent
);
OnLeftClick
(
aDC
,
aPosition
);
wxPostEvent
(
this
,
cmd
);
break
;
}
}
else
if
(
aItem
&&
aItem
->
IsNew
()
)
if
(
aItem
&&
aItem
->
IsNew
()
&&
(
GetToolId
()
==
ID_BUS_BUTT
)
)
{
{
if
(
aItem
->
Type
()
==
SCH_LINE_T
)
// If the item is a bus or a wire, a begin command is not possible.
if
(
(
GetToolId
()
==
ID_BUS_BUTT
)
&&
(
aItem
->
Type
()
==
SCH_LINE_T
)
)
{
{
SCH_LINE
*
segment
=
(
SCH_LINE
*
)
aItem
;
SCH_LINE
*
segment
=
(
SCH_LINE
*
)
aItem
;
...
@@ -529,24 +440,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
...
@@ -529,24 +440,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
// Bus in progress:
// Bus in progress:
OnLeftClick
(
aDC
,
aPosition
);
OnLeftClick
(
aDC
,
aPosition
);
}
}
}
else
if
(
(
GetToolId
()
==
ID_WIRE_BUTT
)
&&
(
aItem
->
Type
()
==
SCH_LINE_T
)
)
break
;
case
HK_BEGIN_WIRE
:
// An item can be selected. If not a wire, a begin command is not possible
if
(
notBusy
)
{
if
(
GetToolId
()
!=
ID_WIRE_BUTT
)
SetToolID
(
ID_WIRE_BUTT
,
wxCURSOR_PENCIL
,
_
(
"Add Wire"
)
);
OnLeftClick
(
aDC
,
aPosition
);
break
;
}
if
(
aItem
&&
aItem
->
IsNew
()
&&
(
GetToolId
()
==
ID_WIRE_BUTT
)
)
{
if
(
aItem
->
Type
()
==
SCH_LINE_T
)
{
{
SCH_LINE
*
segment
=
(
SCH_LINE
*
)
aItem
;
SCH_LINE
*
segment
=
(
SCH_LINE
*
)
aItem
;
...
@@ -557,16 +451,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
...
@@ -557,16 +451,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
OnLeftClick
(
aDC
,
aPosition
);
OnLeftClick
(
aDC
,
aPosition
);
}
}
}
}
break
;
case
HK_ADD_NOCONN_FLAG
:
// Add a no connected flag
if
(
notBusy
)
{
if
(
GetToolId
()
!=
ID_NOCONN_BUTT
)
SetToolID
(
ID_NOCONN_BUTT
,
wxCURSOR_PENCIL
,
_
(
"Add
\"
No Connect
\"
Flag"
)
);
OnLeftClick
(
aDC
,
aPosition
);
}
break
;
break
;
case
HK_ROTATE
:
// Component or other schematic item rotation
case
HK_ROTATE
:
// Component or other schematic item rotation
...
...
eeschema/schedit.cpp
View file @
e21ebb72
...
@@ -666,6 +666,20 @@ void SCH_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
...
@@ -666,6 +666,20 @@ void SCH_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
default
:
default
:
m_itemToRepeat
=
NULL
;
m_itemToRepeat
=
NULL
;
}
}
// Simulate left click event if we got here from a hot key.
if
(
aEvent
.
GetClientData
()
!=
NULL
)
{
EDA_HOTKEY_CLIENT_DATA
*
data
=
(
EDA_HOTKEY_CLIENT_DATA
*
)
aEvent
.
GetClientData
();
wxPoint
pos
=
data
->
GetPosition
();
aEvent
.
SetClientData
(
NULL
);
delete
data
;
INSTALL_UNBUFFERED_DC
(
dc
,
DrawPanel
);
OnLeftClick
(
&
dc
,
pos
);
}
}
}
...
...
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