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
96d162c9
Commit
96d162c9
authored
Sep 24, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added possibility to cancel a tool that is not on the top of the tool stack.
parent
171857a7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
5 deletions
+23
-5
tool_manager.cpp
common/tool/tool_manager.cpp
+23
-5
No files found.
common/tool/tool_manager.cpp
View file @
96d162c9
...
...
@@ -78,6 +78,16 @@ struct TOOL_MANAGER::TOOL_STATE
/// List of possible transitions (ie. association of events and functions that are executed
/// upon the event reception
std
::
vector
<
TRANSITION
>
transitions
;
bool
operator
==
(
const
TOOL_MANAGER
::
TOOL_STATE
&
aRhs
)
const
{
return
(
aRhs
.
theTool
==
this
->
theTool
);
}
bool
operator
!=
(
const
TOOL_MANAGER
::
TOOL_STATE
&
aRhs
)
const
{
return
(
aRhs
.
theTool
!=
this
->
theTool
);
}
};
...
...
@@ -262,7 +272,7 @@ void TOOL_MANAGER::dispatchInternal( TOOL_EVENT& aEvent )
st
->
wakeupEvent
=
aEvent
;
st
->
pendingWait
=
false
;
st
->
waitEvents
.
clear
();
if
(
!
st
->
cofunc
->
Resume
()
)
if
(
st
->
cofunc
&&
!
st
->
cofunc
->
Resume
()
)
{
// The couroutine has finished
finishTool
(
st
);
...
...
@@ -327,12 +337,20 @@ bool TOOL_MANAGER::dispatchActivation( TOOL_EVENT& aEvent )
void
TOOL_MANAGER
::
finishTool
(
TOOL_STATE
*
aState
)
{
wxASSERT
(
m_activeTools
.
front
()
==
aState
->
theTool
->
GetId
()
);
// Find the tool to be deactivated
std
::
deque
<
TOOL_ID
>::
iterator
it
,
it_end
;
for
(
it
=
m_activeTools
.
begin
(),
it_end
=
m_activeTools
.
end
();
it
!=
it_end
;
++
it
)
{
if
(
aState
==
m_toolIdIndex
[
*
it
]
)
break
;
}
// Deactivate the most recent tool and remove it from the active tools queue
aState
->
idle
=
true
;
m_activeTools
.
erase
(
m_activeTools
.
begin
()
);
if
(
it
!=
m_activeTools
.
end
()
)
m_activeTools
.
erase
(
it
);
else
wxLogWarning
(
wxT
(
"Tried to finish not active tool"
)
);
aState
->
idle
=
true
;
delete
aState
->
cofunc
;
aState
->
cofunc
=
NULL
;
}
...
...
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