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
c5a1df62
Commit
c5a1df62
authored
Dec 05, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ClearHotKey() function.
parent
27c7eb5d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
5 deletions
+20
-5
action_manager.cpp
common/tool/action_manager.cpp
+12
-0
action_manager.h
include/tool/action_manager.h
+8
-5
No files found.
common/tool/action_manager.cpp
View file @
c5a1df62
...
@@ -53,7 +53,13 @@ void ACTION_MANAGER::RegisterAction( TOOL_ACTION* aAction )
...
@@ -53,7 +53,13 @@ void ACTION_MANAGER::RegisterAction( TOOL_ACTION* aAction )
m_actionIdIndex
[
aAction
->
m_id
]
=
aAction
;
m_actionIdIndex
[
aAction
->
m_id
]
=
aAction
;
if
(
aAction
->
HasHotKey
()
)
if
(
aAction
->
HasHotKey
()
)
{
// Duplication of hot keys leads to unexpected behaviour
// The right way to change a hotkey is to use ACTION_MANAGER::ClearHotKey() first
assert
(
m_actionHotKeys
.
find
(
aAction
->
m_currentHotKey
)
==
m_actionHotKeys
.
end
()
);
m_actionHotKeys
[
aAction
->
m_currentHotKey
]
=
aAction
;
m_actionHotKeys
[
aAction
->
m_currentHotKey
]
=
aAction
;
}
aAction
->
setActionMgr
(
this
);
aAction
->
setActionMgr
(
this
);
}
}
...
@@ -107,6 +113,12 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const
...
@@ -107,6 +113,12 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const
}
}
void
ACTION_MANAGER
::
ClearHotKey
(
int
aHotKey
)
{
m_actionHotKeys
.
erase
(
aHotKey
);
}
void
ACTION_MANAGER
::
runAction
(
const
TOOL_ACTION
*
aAction
)
const
void
ACTION_MANAGER
::
runAction
(
const
TOOL_ACTION
*
aAction
)
const
{
{
TOOL_EVENT
event
=
aAction
->
MakeEvent
();
TOOL_EVENT
event
=
aAction
->
MakeEvent
();
...
...
include/tool/action_manager.h
View file @
c5a1df62
...
@@ -81,18 +81,21 @@ public:
...
@@ -81,18 +81,21 @@ public:
*/
*/
bool
RunAction
(
const
std
::
string
&
aActionName
)
const
;
bool
RunAction
(
const
std
::
string
&
aActionName
)
const
;
// TODO to be considered
// bool RunAction( int aActionId ) const;
// bool RunAction( TOOL_ACTION* aAction ) const;
/**
/**
* Function RunHotKey()
* Function RunHotKey()
* Runs an action associated with a hotkey (if there is one available).
* Runs an action associated with a hotkey (if there is one available).
* @param aHotKey is the hotkey to be
serv
ed.
* @param aHotKey is the hotkey to be
handl
ed.
* @return True if there was an action associated with the hotkey, false otherwise.
* @return True if there was an action associated with the hotkey, false otherwise.
*/
*/
bool
RunHotKey
(
int
aHotKey
)
const
;
bool
RunHotKey
(
int
aHotKey
)
const
;
/**
* Function ClearHotKey()
* Removes an action associated with a hotkey.
* @param aHotKey is the hotkey to be cleared.
*/
void
ClearHotKey
(
int
aHotKey
);
private
:
private
:
///> Tool manager needed to run actions
///> Tool manager needed to run actions
TOOL_MANAGER
*
m_toolMgr
;
TOOL_MANAGER
*
m_toolMgr
;
...
...
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