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 )
...
@@ -95,6 +95,10 @@ void HOTKEYS_EDITOR_DIALOG::CancelClicked( wxCommandEvent& event )
void
HOTKEYS_EDITOR_DIALOG
::
UndoClicked
(
wxCommandEvent
&
event
)
void
HOTKEYS_EDITOR_DIALOG
::
UndoClicked
(
wxCommandEvent
&
event
)
{
{
m_table
->
RestoreFrom
(
m_hotkeys
);
m_table
->
RestoreFrom
(
m_hotkeys
);
m_curEditingRow
=
-
1
;
for
(
int
i
=
0
;
i
<
m_hotkeyGrid
->
GetNumberRows
();
++
i
)
SetHotkeyCellState
(
i
,
false
);
m_hotkeyGrid
->
Refresh
();
m_hotkeyGrid
->
Refresh
();
Update
();
Update
();
}
}
...
@@ -167,7 +171,7 @@ void HOTKEYS_EDITOR_DIALOG::KeyPressed( wxKeyEvent& event )
...
@@ -167,7 +171,7 @@ void HOTKEYS_EDITOR_DIALOG::KeyPressed( wxKeyEvent& event )
if
(
key
>=
'a'
&&
key
<=
'z'
)
//upcase key
if
(
key
>=
'a'
&&
key
<=
'z'
)
//upcase key
key
=
key
+
(
'A'
-
'a'
);
key
=
key
+
(
'A'
-
'a'
);
#if 0 // For debug
#if 0 // For debug
only
wxString msg;
wxString msg;
msg.Printf(wxT("key %X, keycode %X"),event.GetKeyCode(), key);
msg.Printf(wxT("key %X, keycode %X"),event.GetKeyCode(), key);
wxMessageBox(msg);
wxMessageBox(msg);
...
@@ -175,12 +179,11 @@ void HOTKEYS_EDITOR_DIALOG::KeyPressed( wxKeyEvent& event )
...
@@ -175,12 +179,11 @@ void HOTKEYS_EDITOR_DIALOG::KeyPressed( wxKeyEvent& event )
// See if this key code is handled in hotkeys list
// See if this key code is handled in hotkeys list
bool
exists
;
bool
exists
;
ReturnKeyNameFromKeyCode
(
key
,
&
exists
);
ReturnKeyNameFromKeyCode
(
key
,
&
exists
);
if
(
!
exists
)
// not handled, see
s_Hotkey_Name_List[] in
hotkeys_basic.cpp
if
(
!
exists
)
// not handled, see hotkeys_basic.cpp
wxMessageBox
(
_
(
"Hotkey
valu
e not handled"
)
);
wxMessageBox
(
_
(
"Hotkey
cod
e not handled"
)
);
else
else
{
{
m_table
->
SetKeyCode
(
m_curEditingRow
,
key
);
m_table
->
SetKeyCode
(
m_curEditingRow
,
key
);
SetHotkeyCellState
(
m_curEditingRow
,
false
);
}
}
break
;
break
;
}
}
...
...
common/hotkeys_basic.cpp
View file @
a153b254
...
@@ -106,6 +106,10 @@ static struct hotkey_name_descr s_Hotkey_Name_List[] =
...
@@ -106,6 +106,10 @@ static struct hotkey_name_descr s_Hotkey_Name_List[] =
{
wxT
(
""
),
0
}
{
wxT
(
""
),
0
}
};
};
#define MODIFIER_CTRL wxT( "Ctrl+" )
#define MODIFIER_ALT wxT( "Alt+" )
#define MODIFIER_SHIFT wxT( "Shift+" )
/** function ReturnKeyNameFromKeyCode
/** function ReturnKeyNameFromKeyCode
* return the key name from the key code
* return the key name from the key code
...
@@ -122,11 +126,11 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool* aIsFound )
...
@@ -122,11 +126,11 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool* aIsFound )
bool
found
=
false
;
bool
found
=
false
;
if
(
(
aKeycode
&
GR_KB_CTRL
)
!=
0
)
if
(
(
aKeycode
&
GR_KB_CTRL
)
!=
0
)
modifier
<<
wxT
(
"Ctrl+"
)
;
modifier
<<
MODIFIER_CTRL
;
if
(
(
aKeycode
&
GR_KB_ALT
)
!=
0
)
if
(
(
aKeycode
&
GR_KB_ALT
)
!=
0
)
modifier
<<
wxT
(
"Alt+"
)
;
modifier
<<
MODIFIER_ALT
;
if
(
(
aKeycode
&
GR_KB_SHIFT
)
!=
0
)
if
(
(
aKeycode
&
GR_KB_SHIFT
)
!=
0
)
modifier
<<
wxT
(
"Shift+"
)
;
modifier
<<
MODIFIER_SHIFT
;
aKeycode
&=
~
(
GR_KB_CTRL
|
GR_KB_ALT
|
GR_KB_SHIFT
);
aKeycode
&=
~
(
GR_KB_CTRL
|
GR_KB_ALT
|
GR_KB_SHIFT
);
...
@@ -268,18 +272,18 @@ static int ReturnKeyCodeFromKeyName( const wxString& keyname )
...
@@ -268,18 +272,18 @@ static int ReturnKeyCodeFromKeyName( const wxString& keyname )
int
modifier
=
0
;
int
modifier
=
0
;
while
(
1
)
while
(
1
)
{
{
if
(
key
.
StartsWith
(
wxT
(
"Ctrl+"
)
)
)
if
(
key
.
StartsWith
(
MODIFIER_CTRL
)
)
{
{
modifier
|=
GR_KB_CTRL
;
modifier
|=
GR_KB_CTRL
;
key
.
Remove
(
0
,
5
);
key
.
Remove
(
0
,
5
);
}
}
else
if
(
key
.
StartsWith
(
wxT
(
"Alt+"
)
)
)
else
if
(
key
.
StartsWith
(
MODIFIER_ALT
)
)
{
{
modifier
|=
GR_KB_ALT
;
modifier
|=
GR_KB_ALT
;
key
.
Remove
(
0
,
4
);
key
.
Remove
(
0
,
4
);
}
}
else
if
(
key
.
StartsWith
(
wxT
(
"Shift+"
)
)
)
else
if
(
key
.
StartsWith
(
MODIFIER_SHIFT
)
)
{
{
modifier
|=
GR_KB_SHIFT
;
modifier
|=
GR_KB_SHIFT
;
key
.
Remove
(
0
,
6
);
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