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
3fd26b6d
Commit
3fd26b6d
authored
Jul 09, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TOOL_ACTIONs are automagically registered by TOOL_MANAGER upon its construction.
parent
f5325f8d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
29 deletions
+7
-29
action_manager.cpp
common/tool/action_manager.cpp
+2
-9
tool_manager.cpp
common/tool/tool_manager.cpp
+5
-0
tool_action.h
include/tool/tool_action.h
+0
-15
pcb_tools.cpp
pcbnew/tools/pcb_tools.cpp
+0
-5
No files found.
common/tool/action_manager.cpp
View file @
3fd26b6d
...
...
@@ -44,8 +44,6 @@ ACTION_MANAGER::~ACTION_MANAGER()
void
ACTION_MANAGER
::
RegisterAction
(
TOOL_ACTION
*
aAction
)
{
// Check if the TOOL_ACTION was not registered before
assert
(
aAction
->
GetId
()
==
-
1
);
// TOOL_ACTIONs are supposed to be named [appName.]toolName.actionName (with dots between)
// action name without specifying at least toolName is not valid
assert
(
aAction
->
GetName
().
find
(
'.'
,
0
)
!=
std
::
string
::
npos
);
...
...
@@ -54,15 +52,14 @@ void ACTION_MANAGER::RegisterAction( TOOL_ACTION* aAction )
assert
(
m_actionNameIndex
.
find
(
aAction
->
m_name
)
==
m_actionNameIndex
.
end
()
);
assert
(
m_actionIdIndex
.
find
(
aAction
->
m_id
)
==
m_actionIdIndex
.
end
()
);
aAction
->
setId
(
MakeActionId
(
aAction
->
m_name
)
);
if
(
aAction
->
m_id
==
-
1
)
aAction
->
m_id
=
MakeActionId
(
aAction
->
m_name
);
m_actionNameIndex
[
aAction
->
m_name
]
=
aAction
;
m_actionIdIndex
[
aAction
->
m_id
]
=
aAction
;
if
(
aAction
->
HasHotKey
()
)
m_actionHotKeys
[
aAction
->
m_currentHotKey
].
push_back
(
aAction
);
aAction
->
setActionMgr
(
this
);
}
...
...
@@ -71,10 +68,6 @@ void ACTION_MANAGER::UnregisterAction( TOOL_ACTION* aAction )
m_actionNameIndex
.
erase
(
aAction
->
m_name
);
m_actionIdIndex
.
erase
(
aAction
->
m_id
);
// Indicate that the ACTION_MANAGER no longer care about the object
aAction
->
setActionMgr
(
NULL
);
aAction
->
setId
(
-
1
);
if
(
aAction
->
HasHotKey
()
)
{
std
::
list
<
TOOL_ACTION
*>&
actions
=
m_actionHotKeys
[
aAction
->
m_currentHotKey
];
...
...
common/tool/tool_manager.cpp
View file @
3fd26b6d
...
...
@@ -99,6 +99,11 @@ TOOL_MANAGER::TOOL_MANAGER() :
m_model
(
NULL
),
m_view
(
NULL
),
m_viewControls
(
NULL
),
m_editFrame
(
NULL
)
{
m_actionMgr
=
new
ACTION_MANAGER
(
this
);
// Register known actions
std
::
list
<
TOOL_ACTION
*>&
actionList
=
GetActionList
();
BOOST_FOREACH
(
TOOL_ACTION
*
action
,
actionList
)
RegisterAction
(
action
);
}
...
...
include/tool/tool_action.h
View file @
3fd26b6d
...
...
@@ -189,18 +189,6 @@ public:
private
:
friend
class
ACTION_MANAGER
;
/// Assigns an unique identifier. It is given by an instance of ACTION_MANAGER.
void
setId
(
int
aId
)
{
m_id
=
aId
;
}
/// Assigns ACTION_MANAGER object that handles the TOOL_ACTION.
void
setActionMgr
(
ACTION_MANAGER
*
aManager
)
{
m_actionMgr
=
aManager
;
}
/// Name of the action (convention is: app.[tool.]action.name)
std
::
string
m_name
;
...
...
@@ -225,9 +213,6 @@ private:
/// Unique ID for fast matching. Assigned by ACTION_MANAGER.
int
m_id
;
/// Action manager that handles this TOOL_ACTION.
ACTION_MANAGER
*
m_actionMgr
;
/// Origin of the action
// const TOOL_BASE* m_origin;
...
...
pcbnew/tools/pcb_tools.cpp
View file @
3fd26b6d
...
...
@@ -60,11 +60,6 @@ void PCB_EDIT_FRAME::setupTools()
wxCommandEventHandler
(
PCB_EDIT_FRAME
::
onGenericCommand
),
NULL
,
this
);
#endif
// Register actions
std
::
list
<
TOOL_ACTION
*>&
actionList
=
m_toolManager
->
GetActionList
();
BOOST_FOREACH
(
TOOL_ACTION
*
action
,
actionList
)
m_toolManager
->
RegisterAction
(
action
);
// Register tools
m_toolManager
->
RegisterTool
(
new
SELECTION_TOOL
);
m_toolManager
->
RegisterTool
(
new
ROUTER_TOOL
);
...
...
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