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
16784384
Commit
16784384
authored
Feb 25, 2009
by
stambaughw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix EESchema hot key bugs, fixes bug #1896790.
parent
073d0767
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
223 additions
and
161 deletions
+223
-161
CHANGELOG.txt
CHANGELOG.txt
+11
-1
hotkeys.cpp
eeschema/hotkeys.cpp
+212
-160
No files found.
CHANGELOG.txt
View file @
16784384
...
@@ -5,6 +5,17 @@ Started 2007-June-11
...
@@ -5,6 +5,17 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
Please add newer entries at the top, list the date and your name with
email address.
email address.
2009-Feb-25 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++EESchema
* Fixed hot key bug that caused undo and redo events in the library editor
to be passed to the schematic frame. Fixes bug #1896790.
* Fixed hot key bug that allowed new wire to be placed during block move
causing a manage cursor message box to pop up.
* Fixed hot key bug that allows an object in block to be deleted during
a move or drag operation.
2009-Feb-25 UPDATE Dick Hollenbeck <dick@softplc.com>
2009-Feb-25 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
================================================================================
++pcbnew
++pcbnew
...
@@ -116,7 +127,6 @@ email address.
...
@@ -116,7 +127,6 @@ email address.
automatically scrolling the drawing.
automatically scrolling the drawing.
>>>>>>> .r1562
2009-Feb-4 UPDATE Vesa Solonen <vesa.solonen@hut.fi>
2009-Feb-4 UPDATE Vesa Solonen <vesa.solonen@hut.fi>
================================================================================
================================================================================
++pcbnew:
++pcbnew:
...
...
eeschema/hotkeys.cpp
View file @
16784384
...
@@ -16,22 +16,31 @@
...
@@ -16,22 +16,31 @@
#include "protos.h"
#include "protos.h"
/* How to add a new hotkey:
/* How to add a new hotkey:
* add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION (see hotkeys.h).
* add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION (see
* hotkeys.h).
* add a new Ki_HotkeyInfo entry like:
* add a new Ki_HotkeyInfo entry like:
* static Ki_HotkeyInfo HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION, default key value);
* static Ki_HotkeyInfo HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION,
* "Command Label" is the name used in hotkey list display, and the identifier in the hotkey list file
* default key value);
* MY_NEW_ID_FUNCTION is an equivalent id function used in the switch in OnHotKey() function.
* wxT("Command Label") is the name used in hotkey list display, and the
* default key value is the default hotkey for this command. Can be overrided by the user hotkey list file
* identifier in the hotkey list file
* add the HkMyNewEntry pointer in the s_Schematic_Hotkey_List list or the s_LibEdit_Hotkey_List list
* MY_NEW_ID_FUNCTION is an equivalent id function used in the switch in
* ( or s_Common_Hotkey_List if the same command is added both in eeschema and libedit)
* OnHotKey() function.
* default key value is the default hotkey for this command. Can be overridden
* by the user hotkey list file
* add the HkMyNewEntry pointer in the s_Schematic_Hotkey_List list or the
* s_LibEdit_Hotkey_List list or s_Common_Hotkey_List if the same command is
* added both in eeschema and libedit)
* Add the new code in the switch in OnHotKey() function.
* Add the new code in the switch in OnHotKey() function.
* when the variable ItemInEdit is true, an item is currently edited.
* when the variable ItemInEdit is true, an item is currently edited.
* This can be usefull if the new function cannot be executed while an item is currently being edited
* This can be usefull if the new function cannot be executed while an item is
* currently being edited
* ( For example, one cannot start a new wire when a component is moving.)
* ( For example, one cannot start a new wire when a component is moving.)
*
*
* Note: If an hotkey is a special key be sure the corresponding wxWidget keycode (WXK_XXXX)
* Note: If an hotkey is a special key be sure the corresponding wxWidget
* is handled in the hotkey_name_descr s_Hotkey_Name_List list (see hotkeys_basic.cpp)
* keycode (WXK_XXXX) is handled in the hotkey_name_descr
* and see this list for some ascii keys (space ...)
* s_Hotkey_Name_List list (see hotkeys_basic.cpp) and see this list
* for some ascii keys (space ...)
*
* Key modifier are: GR_KB_CTRL GR_KB_ALT
* Key modifier are: GR_KB_CTRL GR_KB_ALT
*/
*/
...
@@ -40,61 +49,80 @@
...
@@ -40,61 +49,80 @@
/* Hotkey list: */
/* Hotkey list: */
// Common commands
// Common commands
static
Ki_HotkeyInfo
HkZoomCenter
(
wxT
(
"Zoom Center"
),
HK_ZOOM_CENTER
,
WXK_F4
);
static
Ki_HotkeyInfo
HkZoomCenter
(
wxT
(
"Zoom Center"
),
HK_ZOOM_CENTER
,
static
Ki_HotkeyInfo
HkZoomRedraw
(
wxT
(
"Zoom Redraw"
),
HK_ZOOM_REDRAW
,
WXK_F3
);
WXK_F4
);
static
Ki_HotkeyInfo
HkZoomRedraw
(
wxT
(
"Zoom Redraw"
),
HK_ZOOM_REDRAW
,
WXK_F3
);
static
Ki_HotkeyInfo
HkZoomOut
(
wxT
(
"Zoom Out"
),
HK_ZOOM_OUT
,
WXK_F2
);
static
Ki_HotkeyInfo
HkZoomOut
(
wxT
(
"Zoom Out"
),
HK_ZOOM_OUT
,
WXK_F2
);
static
Ki_HotkeyInfo
HkZoomIn
(
wxT
(
"Zoom In"
),
HK_ZOOM_IN
,
WXK_F1
);
static
Ki_HotkeyInfo
HkZoomIn
(
wxT
(
"Zoom In"
),
HK_ZOOM_IN
,
WXK_F1
);
static
Ki_HotkeyInfo
HkHelp
(
wxT
(
"Help: this message"
),
HK_HELP
,
'?'
);
static
Ki_HotkeyInfo
HkHelp
(
wxT
(
"Help: this message"
),
HK_HELP
,
'?'
);
static
Ki_HotkeyInfo
HkResetLocalCoord
(
wxT
(
"Reset local coord."
),
HK_RESET_LOCAL_COORD
,
' '
);
static
Ki_HotkeyInfo
HkResetLocalCoord
(
wxT
(
"Reset local coord."
),
static
Ki_HotkeyInfo
HkUndo
(
wxT
(
"Undo"
),
HK_UNDO
,
GR_KB_CTRL
+
'Z'
,
(
int
)
ID_SCHEMATIC_UNDO
);
HK_RESET_LOCAL_COORD
,
' '
);
static
Ki_HotkeyInfo
HkRedo
(
wxT
(
"Redo"
),
HK_REDO
,
GR_KB_CTRL
+
'Y'
,
(
int
)
ID_SCHEMATIC_REDO
);
static
Ki_HotkeyInfo
HkUndo
(
wxT
(
"Undo"
),
HK_UNDO
,
GR_KB_CTRL
+
'Z'
,
(
int
)
ID_SCHEMATIC_UNDO
);
static
Ki_HotkeyInfo
HkRedo
(
wxT
(
"Redo"
),
HK_REDO
,
GR_KB_CTRL
+
'Y'
,
(
int
)
ID_SCHEMATIC_REDO
);
// Schematic editor
// Schematic editor
static
Ki_HotkeyInfo
HkBeginWire
(
wxT
(
"begin Wire"
),
HK_BEGIN_WIRE
,
'W'
);
static
Ki_HotkeyInfo
HkBeginWire
(
wxT
(
"begin Wire"
),
HK_BEGIN_WIRE
,
'W'
);
static
Ki_HotkeyInfo
HkAddComponent
(
wxT
(
"Add Component"
),
HK_ADD_NEW_COMPONENT
,
'A'
);
static
Ki_HotkeyInfo
HkAddComponent
(
wxT
(
"Add Component"
),
static
Ki_HotkeyInfo
HkMirrorYComponent
(
wxT
(
HK_ADD_NEW_COMPONENT
,
'A'
);
"Mirror Y Component"
),
HK_MIRROR_Y_COMPONENT
,
'Y'
);
static
Ki_HotkeyInfo
HkMirrorYComponent
(
wxT
(
"Mirror Y Component"
),
static
Ki_HotkeyInfo
HkMirrorXComponent
(
wxT
(
HK_MIRROR_Y_COMPONENT
,
'Y'
);
"Mirror X Component"
),
HK_MIRROR_X_COMPONENT
,
'X'
);
static
Ki_HotkeyInfo
HkMirrorXComponent
(
wxT
(
"Mirror X Component"
),
static
Ki_HotkeyInfo
HkOrientNormalComponent
(
wxT
(
HK_MIRROR_X_COMPONENT
,
'X'
);
"Orient Normal Component"
),
static
Ki_HotkeyInfo
HkOrientNormalComponent
(
wxT
(
"Orient Normal Component"
),
HK_ORIENT_NORMAL_COMPONENT
,
'N'
);
HK_ORIENT_NORMAL_COMPONENT
,
'N'
);
static
Ki_HotkeyInfo
HkRotateComponent
(
wxT
(
"Rotate Component"
),
HK_ROTATE_COMPONENT
,
'R'
);
static
Ki_HotkeyInfo
HkRotateComponent
(
wxT
(
"Rotate Component"
),
static
Ki_HotkeyInfo
HkEditComponentValue
(
wxT
(
"Edit Component Value"
),
HK_EDIT_COMPONENT_VALUE
,
'V'
);
HK_ROTATE_COMPONENT
,
'R'
);
static
Ki_HotkeyInfo
HkEditComponentFootprint
(
wxT
(
"Edit Component Footprint"
),
HK_EDIT_COMPONENT_FOOTPRINT
,
'F'
);
static
Ki_HotkeyInfo
HkEditComponentValue
(
wxT
(
"Edit Component Value"
),
static
Ki_HotkeyInfo
HkMoveComponent
(
wxT
(
"Move Component"
),
HK_MOVE_COMPONENT
,
'M'
,
ID_POPUP_SCH_MOVE_CMP_REQUEST
);
HK_EDIT_COMPONENT_VALUE
,
'V'
);
static
Ki_HotkeyInfo
HkDragComponent
(
wxT
(
"Drag Component"
),
HK_DRAG_COMPONENT
,
'G'
,
ID_POPUP_SCH_DRAG_CMP_REQUEST
);
static
Ki_HotkeyInfo
HkEditComponentFootprint
(
wxT
(
"Edit Component Footprint"
),
static
Ki_HotkeyInfo
HkMove2Drag
(
wxT
(
HK_EDIT_COMPONENT_FOOTPRINT
,
"Switch move block to drag block"
),
'F'
);
static
Ki_HotkeyInfo
HkMoveComponent
(
wxT
(
"Move Component"
),
HK_MOVE_COMPONENT
,
'M'
,
ID_POPUP_SCH_MOVE_CMP_REQUEST
);
static
Ki_HotkeyInfo
HkDragComponent
(
wxT
(
"Drag Component"
),
HK_DRAG_COMPONENT
,
'G'
,
ID_POPUP_SCH_DRAG_CMP_REQUEST
);
static
Ki_HotkeyInfo
HkMove2Drag
(
wxT
(
"Switch move block to drag block"
),
HK_MOVEBLOCK_TO_DRAGBLOCK
,
'\t'
);
HK_MOVEBLOCK_TO_DRAGBLOCK
,
'\t'
);
static
Ki_HotkeyInfo
HkInsert
(
wxT
(
"Repeat Last Item"
),
HK_REPEAT_LAST
,
WXK_INSERT
);
static
Ki_HotkeyInfo
HkInsert
(
wxT
(
"Repeat Last Item"
),
HK_REPEAT_LAST
,
WXK_INSERT
);
static
Ki_HotkeyInfo
HkDelete
(
wxT
(
"Delete Item"
),
HK_DELETE
,
WXK_DELETE
);
static
Ki_HotkeyInfo
HkDelete
(
wxT
(
"Delete Item"
),
HK_DELETE
,
WXK_DELETE
);
static
Ki_HotkeyInfo
HkNextSearch
(
wxT
(
"Next Search"
),
HK_NEXT_SEARCH
,
WXK_F5
);
static
Ki_HotkeyInfo
HkNextSearch
(
wxT
(
"Next Search"
),
HK_NEXT_SEARCH
,
WXK_F5
);
// Library editor:
// Library editor:
static
Ki_HotkeyInfo
HkInsertPin
(
wxT
(
"Repeat Pin"
),
HK_REPEAT_LAST
,
WXK_INSERT
);
static
Ki_HotkeyInfo
HkInsertPin
(
wxT
(
"Repeat Pin"
),
HK_REPEAT_LAST
,
WXK_INSERT
);
static
Ki_HotkeyInfo
HkEditPin
(
wxT
(
"Edit Pin"
),
HK_EDIT_PIN
,
'E'
);
static
Ki_HotkeyInfo
HkEditPin
(
wxT
(
"Edit Pin"
),
HK_EDIT_PIN
,
'E'
);
static
Ki_HotkeyInfo
HkMovePin
(
wxT
(
"Move Pin"
),
HK_MOVE_PIN
,
'M'
);
static
Ki_HotkeyInfo
HkMovePin
(
wxT
(
"Move Pin"
),
HK_MOVE_PIN
,
'M'
);
static
Ki_HotkeyInfo
HkDeletePin
(
wxT
(
"Delete Pin"
),
HK_DELETE_PIN
,
WXK_DELETE
);
static
Ki_HotkeyInfo
HkDeletePin
(
wxT
(
"Delete Pin"
),
HK_DELETE_PIN
,
WXK_DELETE
);
// List of common hotkey descriptors
// List of common hotkey descriptors
Ki_HotkeyInfo
*
s_Common_Hotkey_List
[]
=
Ki_HotkeyInfo
*
s_Common_Hotkey_List
[]
=
{
{
&
HkHelp
,
&
HkHelp
,
&
HkZoomIn
,
&
HkZoomOut
,
&
HkZoomRedraw
,
&
HkZoomCenter
,
&
HkZoomIn
,
&
HkZoomOut
,
&
HkZoomRedraw
,
&
HkZoomCenter
,
&
HkResetLocalCoord
,
&
HkResetLocalCoord
,
&
HkUndo
,
&
HkRedo
,
&
HkUndo
,
&
HkRedo
,
NULL
NULL
};
};
// List of hotkey descriptors for schematic
// List of hotkey descriptors for schematic
Ki_HotkeyInfo
*
s_Schematic_Hotkey_List
[]
=
{
Ki_HotkeyInfo
*
s_Schematic_Hotkey_List
[]
=
{
&
HkNextSearch
,
&
HkNextSearch
,
&
HkDelete
,
&
HkInsert
,
&
HkMove2Drag
,
&
HkDelete
,
&
HkInsert
,
&
HkMove2Drag
,
&
HkMoveComponent
,
&
HkDragComponent
,
&
HkAddComponent
,
&
HkMoveComponent
,
&
HkDragComponent
,
&
HkAddComponent
,
&
HkRotateComponent
,
&
HkMirrorXComponent
,
&
HkMirrorYComponent
,
&
HkOrientNormalComponent
,
&
HkRotateComponent
,
&
HkMirrorXComponent
,
&
HkMirrorYComponent
,
&
HkEditComponentValue
,
&
HkEditComponentFootprint
,
&
HkOrientNormalComponent
,
&
HkEditComponentValue
,
&
HkEditComponentFootprint
,
&
HkBeginWire
,
&
HkBeginWire
,
NULL
NULL
};
};
...
@@ -109,16 +137,18 @@ Ki_HotkeyInfo* s_LibEdit_Hotkey_List[] =
...
@@ -109,16 +137,18 @@ Ki_HotkeyInfo* s_LibEdit_Hotkey_List[] =
NULL
NULL
};
};
// list of sections and corresponding hotkey list for eeschema (used to create an hotkey config file)
// list of sections and corresponding hotkey list for eeschema (used to create
// an hotkey config file)
struct
Ki_HotkeyInfoSectionDescriptor
s_Eeschema_Hokeys_Descr
[]
=
struct
Ki_HotkeyInfoSectionDescriptor
s_Eeschema_Hokeys_Descr
[]
=
{
{
{
&
g_CommonSectionTag
,
s_Common_Hotkey_List
,
"Common keys"
},
{
&
g_CommonSectionTag
,
s_Common_Hotkey_List
,
"Common keys"
},
{
&
g_SchematicSectionTag
,
s_Schematic_Hotkey_List
,
"Schematic editor keys"
},
{
&
g_SchematicSectionTag
,
s_Schematic_Hotkey_List
,
"Schematic editor keys"
},
{
&
g_LibEditSectionTag
,
s_LibEdit_Hotkey_List
,
"library editor keys"
},
{
&
g_LibEditSectionTag
,
s_LibEdit_Hotkey_List
,
"library editor keys"
},
{
NULL
,
NULL
}
{
NULL
,
NULL
,
NULL
}
};
};
// list of sections and corresponding hotkey list for the schematic editor (used to list current hotkeys)
// list of sections and corresponding hotkey list for the schematic editor
// (used to list current hotkeys)
struct
Ki_HotkeyInfoSectionDescriptor
s_Schematic_Hokeys_Descr
[]
=
struct
Ki_HotkeyInfoSectionDescriptor
s_Schematic_Hokeys_Descr
[]
=
{
{
{
&
g_CommonSectionTag
,
s_Common_Hotkey_List
,
NULL
},
{
&
g_CommonSectionTag
,
s_Common_Hotkey_List
,
NULL
},
...
@@ -126,7 +156,8 @@ struct Ki_HotkeyInfoSectionDescriptor s_Schematic_Hokeys_Descr[] =
...
@@ -126,7 +156,8 @@ struct Ki_HotkeyInfoSectionDescriptor s_Schematic_Hokeys_Descr[] =
{
NULL
,
NULL
,
NULL
}
{
NULL
,
NULL
,
NULL
}
};
};
// list of sections and corresponding hotkey list for the component editor (used to list current hotkeys)
// list of sections and corresponding hotkey list for the component editor
// (used to list current hotkeys)
struct
Ki_HotkeyInfoSectionDescriptor
s_Libedit_Hokeys_Descr
[]
=
struct
Ki_HotkeyInfoSectionDescriptor
s_Libedit_Hokeys_Descr
[]
=
{
{
{
&
g_CommonSectionTag
,
s_Common_Hotkey_List
,
NULL
},
{
&
g_CommonSectionTag
,
s_Common_Hotkey_List
,
NULL
},
...
@@ -134,39 +165,43 @@ struct Ki_HotkeyInfoSectionDescriptor s_Libedit_Hokeys_Descr[] =
...
@@ -134,39 +165,43 @@ struct Ki_HotkeyInfoSectionDescriptor s_Libedit_Hokeys_Descr[] =
{
NULL
,
NULL
,
NULL
}
{
NULL
,
NULL
,
NULL
}
};
};
/***********************************************************/
/*
void
WinEDA_SchematicFrame
::
OnHotKey
(
wxDC
*
DC
,
int
hotkey
,
* Hot keys. Some commands are relative to the item under the mouse cursor
EDA_BaseStruct
*
DrawStruct
)
/***********************************************************/
/* Hot keys. Some commands are relative to the item under the mouse cursor
* Commands are case insensitive
* Commands are case insensitive
*/
*/
void
WinEDA_SchematicFrame
::
OnHotKey
(
wxDC
*
DC
,
int
hotkey
,
EDA_BaseStruct
*
DrawStruct
)
{
{
wxCommandEvent
cmd
(
wxEVT_COMMAND_MENU_SELECTED
);
wxCommandEvent
cmd
(
wxEVT_COMMAND_MENU_SELECTED
);
cmd
.
SetEventObject
(
this
);
cmd
.
SetEventObject
(
this
);
bool
ItemInEdit
=
GetScreen
()
->
GetCurItem
()
bool
ItemInEdit
=
GetScreen
()
->
GetCurItem
()
&&
GetScreen
()
->
GetCurItem
()
->
m_Flags
;
&&
GetScreen
()
->
GetCurItem
()
->
m_Flags
;
bool
RefreshToolBar
=
FALSE
;
// We must refresh tool bar when the undo/redo tool state is modified
bool
RefreshToolBar
=
FALSE
;
SCH_SCREEN
*
screen
=
GetScreen
();
if
(
hotkey
==
0
)
if
(
hotkey
==
0
)
return
;
return
;
wxPoint
MousePos
=
GetScreen
()
->
m_MousePosition
;
wxPoint
MousePos
=
GetScreen
()
->
m_MousePosition
;
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to handle...)
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to
// handle...)
if
(
(
hotkey
&
GR_KB_CTRL
)
!=
0
)
if
(
(
hotkey
&
GR_KB_CTRL
)
!=
0
)
hotkey
+=
'A'
-
1
;
hotkey
+=
'A'
-
1
;
/* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */
/* Convert lower to upper case (the usual toupper function has problem
* with non ascii codes like function keys */
if
(
(
hotkey
>=
'a'
)
&&
(
hotkey
<=
'z'
)
)
if
(
(
hotkey
>=
'a'
)
&&
(
hotkey
<=
'z'
)
)
hotkey
+=
'A'
-
'a'
;
hotkey
+=
'A'
-
'a'
;
// Search command from key :
// Search command from key :
Ki_HotkeyInfo
*
HK_Descr
=
GetDescriptorFromHotkey
(
hotkey
,
s_Common_Hotkey_List
);
Ki_HotkeyInfo
*
HK_Descr
=
GetDescriptorFromHotkey
(
hotkey
,
s_Common_Hotkey_List
);
if
(
HK_Descr
==
NULL
)
if
(
HK_Descr
==
NULL
)
HK_Descr
=
GetDescriptorFromHotkey
(
hotkey
,
s_Schematic_Hotkey_List
);
HK_Descr
=
GetDescriptorFromHotkey
(
hotkey
,
s_Schematic_Hotkey_List
);
if
(
HK_Descr
==
NULL
)
return
;
if
(
HK_Descr
==
NULL
)
return
;
switch
(
HK_Descr
->
m_Idcommand
)
switch
(
HK_Descr
->
m_Idcommand
)
{
{
...
@@ -204,11 +239,10 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
...
@@ -204,11 +239,10 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
case
HK_UNDO
:
case
HK_UNDO
:
case
HK_REDO
:
case
HK_REDO
:
if
(
ItemInEdit
)
if
(
!
ItemInEdit
)
break
;
{
{
wxCommandEvent
event
(
wxEVT_COMMAND_TOOL_CLICKED
,
HK_Descr
->
m_IdMenuEvent
);
wxCommandEvent
event
(
wxEVT_COMMAND_TOOL_CLICKED
,
HK_Descr
->
m_IdMenuEvent
);
wxPostEvent
(
this
,
event
);
wxPostEvent
(
this
,
event
);
}
}
break
;
break
;
...
@@ -218,69 +252,72 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
...
@@ -218,69 +252,72 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
break
;
break
;
case
HK_DELETE
:
case
HK_DELETE
:
if
(
ItemInEdit
)
if
(
!
ItemInEdit
&&
screen
->
BlockLocate
.
m_State
==
STATE_NO_BLOCK
)
break
;
{
RefreshToolBar
=
LocateAndDeleteItem
(
this
,
DC
);
RefreshToolBar
=
LocateAndDeleteItem
(
this
,
DC
);
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetCurItem
(
NULL
);
GetScreen
()
->
SetCurItem
(
NULL
);
TestDanglingEnds
(
GetScreen
()
->
EEDrawList
,
DC
);
TestDanglingEnds
(
GetScreen
()
->
EEDrawList
,
DC
);
}
break
;
break
;
case
HK_REPEAT_LAST
:
case
HK_REPEAT_LAST
:
if
(
ItemInEdit
)
if
(
!
ItemInEdit
&&
g_ItemToRepeat
&&
(
g_ItemToRepeat
->
m_Flags
==
0
)
)
break
;
if
(
g_ItemToRepeat
&&
(
g_ItemToRepeat
->
m_Flags
==
0
)
)
{
RepeatDrawItem
(
DC
);
RepeatDrawItem
(
DC
);
}
break
;
break
;
case
HK_NEXT_SEARCH
:
case
HK_NEXT_SEARCH
:
if
(
ItemInEdit
)
if
(
!
ItemInEdit
)
break
;
{
if
(
g_LastSearchIsMarker
)
if
(
g_LastSearchIsMarker
)
WinEDA_SchematicFrame
::
FindMarker
(
1
);
WinEDA_SchematicFrame
::
FindMarker
(
1
);
else
else
FindSchematicItem
(
wxEmptyString
,
2
);
FindSchematicItem
(
wxEmptyString
,
2
);
}
break
;
break
;
case
HK_ADD_NEW_COMPONENT
:
// Add component
case
HK_ADD_NEW_COMPONENT
:
// Add component
if
(
ItemInEdit
)
if
(
!
ItemInEdit
)
break
;
{
// switch to m_ID_current_state = ID_COMPONENT_BUTT;
// switch to m_ID_current_state = ID_COMPONENT_BUTT;
if
(
m_ID_current_state
!=
ID_COMPONENT_BUTT
)
if
(
m_ID_current_state
!=
ID_COMPONENT_BUTT
)
SetToolID
(
ID_COMPONENT_BUTT
,
wxCURSOR_PENCIL
,
_
(
"Add Component"
)
);
SetToolID
(
ID_COMPONENT_BUTT
,
wxCURSOR_PENCIL
,
_
(
"Add Component"
)
);
OnLeftClick
(
DC
,
MousePos
);
OnLeftClick
(
DC
,
MousePos
);
}
break
;
break
;
case
HK_BEGIN_WIRE
:
// Add wire
case
HK_BEGIN_WIRE
:
if
(
DrawStruct
)
// An item is selected. If edited and not a wire, a new command is not possible
/* An item is selected. If edited and not a wire, a new command is not
* possible */
if
(
!
ItemInEdit
&&
screen
->
BlockLocate
.
m_State
==
STATE_NO_BLOCK
)
{
{
if
(
DrawStruct
->
m_Flags
)
// Item selected and edition in progress
if
(
DrawStruct
&&
DrawStruct
->
m_Flags
)
{
{
if
(
DrawStruct
->
Type
()
==
DRAW_SEGMENT_STRUCT_TYPE
)
if
(
DrawStruct
->
Type
()
==
DRAW_SEGMENT_STRUCT_TYPE
)
{
{
EDA_DrawLineStruct
*
segment
=
(
EDA_DrawLineStruct
*
)
DrawStruct
;
EDA_DrawLineStruct
*
segment
=
(
EDA_DrawLineStruct
*
)
DrawStruct
;
if
(
segment
->
GetLayer
()
!=
LAYER_WIRE
)
if
(
segment
->
GetLayer
()
!=
LAYER_WIRE
)
break
;
break
;
}
}
else
else
break
;
break
;
}
}
}
// switch to m_ID_current_state = ID_WIRE_BUTT;
// switch to m_ID_current_state = ID_WIRE_BUTT;
if
(
m_ID_current_state
!=
ID_WIRE_BUTT
)
if
(
m_ID_current_state
!=
ID_WIRE_BUTT
)
SetToolID
(
ID_WIRE_BUTT
,
wxCURSOR_PENCIL
,
_
(
"Add Wire"
)
);
SetToolID
(
ID_WIRE_BUTT
,
wxCURSOR_PENCIL
,
_
(
"Add Wire"
)
);
OnLeftClick
(
DC
,
MousePos
);
OnLeftClick
(
DC
,
MousePos
);
}
break
;
break
;
case
HK_ROTATE_COMPONENT
:
// Component Rotation
case
HK_ROTATE_COMPONENT
:
// Component Rotation
if
(
DrawStruct
==
NULL
)
if
(
DrawStruct
==
NULL
)
{
{
DrawStruct
=
PickStruct
(
GetScreen
()
->
m_Curseur
,
DrawStruct
=
PickStruct
(
GetScreen
()
->
m_Curseur
,
GetScreen
(),
LIBITEM
|
TEXTITEM
|
LABELITEM
);
GetScreen
(),
LIBITEM
|
TEXTITEM
|
LABELITEM
);
if
(
DrawStruct
==
NULL
)
if
(
DrawStruct
==
NULL
)
break
;
break
;
if
(
DrawStruct
->
Type
()
==
TYPE_SCH_COMPONENT
)
if
(
DrawStruct
->
Type
()
==
TYPE_SCH_COMPONENT
)
...
@@ -298,8 +335,8 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
...
@@ -298,8 +335,8 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
RefreshToolBar
=
TRUE
;
RefreshToolBar
=
TRUE
;
}
}
CmpRotationMiroir
(
CmpRotationMiroir
(
(
SCH_COMPONENT
*
)
DrawStruct
,
DC
,
(
SCH_COMPONENT
*
)
DrawStruct
,
DC
,
CMP_ROTATE_COUNTERCLOCKWISE
);
CMP_ROTATE_COUNTERCLOCKWISE
);
break
;
break
;
case
TYPE_SCH_TEXT
:
case
TYPE_SCH_TEXT
:
...
@@ -322,7 +359,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
...
@@ -322,7 +359,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
case
HK_MIRROR_Y_COMPONENT
:
// Mirror Y (Component)
case
HK_MIRROR_Y_COMPONENT
:
// Mirror Y (Component)
if
(
DrawStruct
==
NULL
)
if
(
DrawStruct
==
NULL
)
DrawStruct
=
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
);
DrawStruct
=
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
);
if
(
DrawStruct
)
if
(
DrawStruct
)
{
{
if
(
DrawStruct
->
m_Flags
==
0
)
if
(
DrawStruct
->
m_Flags
==
0
)
...
@@ -344,8 +381,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
...
@@ -344,8 +381,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
SaveCopyInUndoList
(
(
SCH_ITEM
*
)
DrawStruct
,
IS_CHANGED
);
SaveCopyInUndoList
(
(
SCH_ITEM
*
)
DrawStruct
,
IS_CHANGED
);
RefreshToolBar
=
TRUE
;
RefreshToolBar
=
TRUE
;
}
}
CmpRotationMiroir
(
CmpRotationMiroir
(
(
SCH_COMPONENT
*
)
DrawStruct
,
DC
,
CMP_MIROIR_X
);
(
SCH_COMPONENT
*
)
DrawStruct
,
DC
,
CMP_MIROIR_X
);
}
}
break
;
break
;
...
@@ -373,20 +409,21 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
...
@@ -373,20 +409,21 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
if
(
DrawStruct
&&
(
DrawStruct
->
m_Flags
==
0
)
)
if
(
DrawStruct
&&
(
DrawStruct
->
m_Flags
==
0
)
)
{
{
GetScreen
()
->
SetCurItem
(
(
SCH_ITEM
*
)
DrawStruct
);
GetScreen
()
->
SetCurItem
(
(
SCH_ITEM
*
)
DrawStruct
);
wxCommandEvent
event
(
wxEVT_COMMAND_TOOL_CLICKED
,
HK_Descr
->
m_IdMenuEvent
);
wxCommandEvent
event
(
wxEVT_COMMAND_TOOL_CLICKED
,
HK_Descr
->
m_IdMenuEvent
);
wxPostEvent
(
this
,
event
);
wxPostEvent
(
this
,
event
);
}
}
break
;
break
;
case
HK_EDIT_COMPONENT_VALUE
:
case
HK_EDIT_COMPONENT_VALUE
:
if
(
ItemInEdit
)
if
(
ItemInEdit
)
break
;
break
;
if
(
DrawStruct
==
NULL
)
if
(
DrawStruct
==
NULL
)
DrawStruct
=
LocateSmallestComponent
(
GetScreen
()
);
DrawStruct
=
LocateSmallestComponent
(
GetScreen
()
);
if
(
DrawStruct
)
if
(
DrawStruct
)
{
{
EditComponentValue
(
EditComponentValue
(
(
SCH_COMPONENT
*
)
DrawStruct
,
DC
);
(
SCH_COMPONENT
*
)
DrawStruct
,
DC
);
}
}
break
;
break
;
...
@@ -395,10 +432,9 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
...
@@ -395,10 +432,9 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
break
;
break
;
if
(
DrawStruct
==
NULL
)
if
(
DrawStruct
==
NULL
)
DrawStruct
=
LocateSmallestComponent
(
GetScreen
()
);
DrawStruct
=
LocateSmallestComponent
(
GetScreen
()
);
if
(
DrawStruct
)
if
(
DrawStruct
)
{
{
EditComponentFootprint
(
EditComponentFootprint
(
(
SCH_COMPONENT
*
)
DrawStruct
,
DC
);
(
SCH_COMPONENT
*
)
DrawStruct
,
DC
);
}
}
break
;
break
;
}
}
...
@@ -408,21 +444,23 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
...
@@ -408,21 +444,23 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
}
}
/***********************************************************/
/*
void
WinEDA_LibeditFrame
::
OnHotKey
(
wxDC
*
DC
,
int
hotkey
,
* Hot keys for the component editor. Some commands are relatives to the item
EDA_BaseStruct
*
DrawStruct
)
* under the mouse cursor
/***********************************************************/
/* Hot keys for the component editor. Some commands are relatives to the item under the mouse cursor
* Commands are case insensitive
* Commands are case insensitive
*/
*/
void
WinEDA_LibeditFrame
::
OnHotKey
(
wxDC
*
DC
,
int
hotkey
,
EDA_BaseStruct
*
DrawStruct
)
{
{
wxCommandEvent
cmd
(
wxEVT_COMMAND_MENU_SELECTED
);
wxCommandEvent
cmd
(
wxEVT_COMMAND_MENU_SELECTED
);
wxCommandEvent
toolCmd
(
wxEVT_COMMAND_TOOL_CLICKED
);
cmd
.
SetEventObject
(
this
);
cmd
.
SetEventObject
(
this
);
bool
ItemInEdit
=
GetScreen
()
->
GetCurItem
()
bool
ItemInEdit
=
GetScreen
()
->
GetCurItem
()
&&
GetScreen
()
->
GetCurItem
()
->
m_Flags
;
&&
GetScreen
()
->
GetCurItem
()
->
m_Flags
;
bool
RefreshToolBar
=
FALSE
;
// We must refresh tool bar when the undo/redo tool state is modified
bool
RefreshToolBar
=
FALSE
;
/* Refresh tool bar when the undo/redo
* tool state is modified. */
if
(
hotkey
==
0
)
if
(
hotkey
==
0
)
return
;
return
;
...
@@ -431,16 +469,21 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
...
@@ -431,16 +469,21 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
LibEDA_BaseStruct
*
DrawEntry
=
LocateItemUsingCursor
();
LibEDA_BaseStruct
*
DrawEntry
=
LocateItemUsingCursor
();
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to handle...)
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to
// handle...)
if
(
(
hotkey
&
GR_KB_CTRL
)
!=
0
)
if
(
(
hotkey
&
GR_KB_CTRL
)
!=
0
)
hotkey
+=
'A'
-
1
;
hotkey
+=
'A'
-
1
;
/* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */
/* Convert lower to upper case (the usual toupper function has problem
* with non ascii codes like function keys */
if
(
(
hotkey
>=
'a'
)
&&
(
hotkey
<=
'z'
)
)
if
(
(
hotkey
>=
'a'
)
&&
(
hotkey
<=
'z'
)
)
hotkey
+=
'A'
-
'a'
;
hotkey
+=
'A'
-
'a'
;
Ki_HotkeyInfo
*
HK_Descr
=
GetDescriptorFromHotkey
(
hotkey
,
s_Common_Hotkey_List
);
Ki_HotkeyInfo
*
HK_Descr
=
GetDescriptorFromHotkey
(
hotkey
,
s_Common_Hotkey_List
);
if
(
HK_Descr
==
NULL
)
if
(
HK_Descr
==
NULL
)
HK_Descr
=
GetDescriptorFromHotkey
(
hotkey
,
s_LibEdit_Hotkey_List
);
HK_Descr
=
GetDescriptorFromHotkey
(
hotkey
,
s_LibEdit_Hotkey_List
);
if
(
HK_Descr
==
NULL
)
return
;
if
(
HK_Descr
==
NULL
)
return
;
switch
(
HK_Descr
->
m_Idcommand
)
switch
(
HK_Descr
->
m_Idcommand
)
{
{
...
@@ -478,13 +521,18 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
...
@@ -478,13 +521,18 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
break
;
break
;
case
HK_UNDO
:
case
HK_UNDO
:
case
HK_REDO
:
if
(
!
ItemInEdit
)
if
(
ItemInEdit
)
break
;
{
{
wxCommandEvent
event
(
wxEVT_COMMAND_TOOL_CLICKED
,
HK_Descr
->
m_IdMenuEvent
);
toolCmd
.
SetId
(
ID_LIBEDIT_UNDO
);
GetEventHandler
()
->
ProcessEvent
(
toolCmd
);
}
break
;
wxPostEvent
(
this
,
event
);
case
HK_REDO
:
if
(
!
ItemInEdit
)
{
toolCmd
.
SetId
(
ID_LIBEDIT_REDO
);
GetEventHandler
()
->
ProcessEvent
(
toolCmd
);
}
}
break
;
break
;
...
@@ -497,36 +545,40 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
...
@@ -497,36 +545,40 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
else
else
wxBell
();
wxBell
();
break
;
break
;
case
HK_EDIT_PIN
:
case
HK_EDIT_PIN
:
if
(
DrawEntry
)
if
(
DrawEntry
)
CurrentDrawItem
=
DrawEntry
;
CurrentDrawItem
=
DrawEntry
;
if
(
CurrentDrawItem
)
if
(
CurrentDrawItem
)
{
{
if
(
CurrentDrawItem
->
Type
()
==
COMPONENT_PIN_DRAW_TYPE
)
if
(
CurrentDrawItem
->
Type
()
==
COMPONENT_PIN_DRAW_TYPE
)
InstallPineditFrame
(
this
,
DC
,
MousePos
);
InstallPineditFrame
(
this
,
DC
,
MousePos
);
}
}
break
;
break
;
case
HK_DELETE_PIN
:
case
HK_DELETE_PIN
:
if
(
DrawEntry
)
if
(
DrawEntry
)
CurrentDrawItem
=
DrawEntry
;
CurrentDrawItem
=
DrawEntry
;
if
(
CurrentDrawItem
)
if
(
CurrentDrawItem
)
{
{
wxCommandEvent
evt
;
wxCommandEvent
evt
;
evt
.
SetId
(
ID_POPUP_LIBEDIT_DELETE_ITEM
);
evt
.
SetId
(
ID_POPUP_LIBEDIT_DELETE_ITEM
);
Process_Special_Functions
(
evt
);
Process_Special_Functions
(
evt
);
}
}
break
;
break
;
case
HK_MOVE_PIN
:
case
HK_MOVE_PIN
:
if
(
DrawEntry
)
if
(
DrawEntry
)
CurrentDrawItem
=
DrawEntry
;
CurrentDrawItem
=
DrawEntry
;
if
(
CurrentDrawItem
)
if
(
CurrentDrawItem
)
{
{
wxCommandEvent
evt
;
wxCommandEvent
evt
;
evt
.
SetId
(
ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST
);
evt
.
SetId
(
ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST
);
Process_Special_Functions
(
evt
);
Process_Special_Functions
(
evt
);
}
}
break
;
break
;
}
}
if
(
RefreshToolBar
)
if
(
RefreshToolBar
)
SetToolbars
();
SetToolbars
();
}
}
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