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
a153b254
Commit
a153b254
authored
Aug 28, 2010
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hotkey editor code tweaking
parent
97a7330e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
10 deletions
+17
-10
dialog_hotkeys_editor.cpp
common/dialog_hotkeys_editor.cpp
+7
-4
hotkeys_basic.cpp
common/hotkeys_basic.cpp
+10
-6
No files found.
common/dialog_hotkeys_editor.cpp
View file @
a153b254
...
...
@@ -95,6 +95,10 @@ void HOTKEYS_EDITOR_DIALOG::CancelClicked( wxCommandEvent& event )
void
HOTKEYS_EDITOR_DIALOG
::
UndoClicked
(
wxCommandEvent
&
event
)
{
m_table
->
RestoreFrom
(
m_hotkeys
);
m_curEditingRow
=
-
1
;
for
(
int
i
=
0
;
i
<
m_hotkeyGrid
->
GetNumberRows
();
++
i
)
SetHotkeyCellState
(
i
,
false
);
m_hotkeyGrid
->
Refresh
();
Update
();
}
...
...
@@ -167,7 +171,7 @@ void HOTKEYS_EDITOR_DIALOG::KeyPressed( wxKeyEvent& event )
if
(
key
>=
'a'
&&
key
<=
'z'
)
//upcase key
key
=
key
+
(
'A'
-
'a'
);
#if 0 // For debug
#if 0 // For debug
only
wxString msg;
msg.Printf(wxT("key %X, keycode %X"),event.GetKeyCode(), key);
wxMessageBox(msg);
...
...
@@ -175,12 +179,11 @@ void HOTKEYS_EDITOR_DIALOG::KeyPressed( wxKeyEvent& event )
// See if this key code is handled in hotkeys list
bool
exists
;
ReturnKeyNameFromKeyCode
(
key
,
&
exists
);
if
(
!
exists
)
// not handled, see
s_Hotkey_Name_List[] in
hotkeys_basic.cpp
wxMessageBox
(
_
(
"Hotkey
valu
e not handled"
)
);
if
(
!
exists
)
// not handled, see hotkeys_basic.cpp
wxMessageBox
(
_
(
"Hotkey
cod
e not handled"
)
);
else
{
m_table
->
SetKeyCode
(
m_curEditingRow
,
key
);
SetHotkeyCellState
(
m_curEditingRow
,
false
);
}
break
;
}
...
...
common/hotkeys_basic.cpp
View file @
a153b254
...
...
@@ -106,6 +106,10 @@ static struct hotkey_name_descr s_Hotkey_Name_List[] =
{
wxT
(
""
),
0
}
};
#define MODIFIER_CTRL wxT( "Ctrl+" )
#define MODIFIER_ALT wxT( "Alt+" )
#define MODIFIER_SHIFT wxT( "Shift+" )
/** function ReturnKeyNameFromKeyCode
* return the key name from the key code
...
...
@@ -122,11 +126,11 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool* aIsFound )
bool
found
=
false
;
if
(
(
aKeycode
&
GR_KB_CTRL
)
!=
0
)
modifier
<<
wxT
(
"Ctrl+"
)
;
modifier
<<
MODIFIER_CTRL
;
if
(
(
aKeycode
&
GR_KB_ALT
)
!=
0
)
modifier
<<
wxT
(
"Alt+"
)
;
modifier
<<
MODIFIER_ALT
;
if
(
(
aKeycode
&
GR_KB_SHIFT
)
!=
0
)
modifier
<<
wxT
(
"Shift+"
)
;
modifier
<<
MODIFIER_SHIFT
;
aKeycode
&=
~
(
GR_KB_CTRL
|
GR_KB_ALT
|
GR_KB_SHIFT
);
...
...
@@ -268,18 +272,18 @@ static int ReturnKeyCodeFromKeyName( const wxString& keyname )
int
modifier
=
0
;
while
(
1
)
{
if
(
key
.
StartsWith
(
wxT
(
"Ctrl+"
)
)
)
if
(
key
.
StartsWith
(
MODIFIER_CTRL
)
)
{
modifier
|=
GR_KB_CTRL
;
key
.
Remove
(
0
,
5
);
}
else
if
(
key
.
StartsWith
(
wxT
(
"Alt+"
)
)
)
else
if
(
key
.
StartsWith
(
MODIFIER_ALT
)
)
{
modifier
|=
GR_KB_ALT
;
key
.
Remove
(
0
,
4
);
}
else
if
(
key
.
StartsWith
(
wxT
(
"Shift+"
)
)
)
else
if
(
key
.
StartsWith
(
MODIFIER_SHIFT
)
)
{
modifier
|=
GR_KB_SHIFT
;
key
.
Remove
(
0
,
6
);
...
...
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