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
9bd7ba36
Commit
9bd7ba36
authored
Aug 15, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added resetting of tools after loading a new board.
parent
723424df
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
7 deletions
+14
-7
tool_manager.cpp
common/tool/tool_manager.cpp
+9
-3
tool_manager.h
include/tool/tool_manager.h
+3
-4
selection_tool.cpp
pcbnew/tools/selection_tool.cpp
+2
-0
No files found.
common/tool/tool_manager.cpp
View file @
9bd7ba36
...
...
@@ -145,7 +145,7 @@ void TOOL_MANAGER::dispatchInternal( TOOL_EVENT& aEvent )
{
st
->
transitions
.
clear
();
if
(
!
st
->
cofunc
)
if
(
!
st
->
cofunc
)
st
->
cofunc
=
new
COROUTINE
<
int
,
TOOL_EVENT
&>
(
tr
.
second
);
else
st
->
cofunc
->
SetEntry
(
tr
.
second
);
...
...
@@ -174,7 +174,7 @@ bool TOOL_MANAGER::ProcessEvent( TOOL_EVENT& aEvent )
if
(
st
->
contextMenuTrigger
==
CMENU_NOW
)
{
st
->
pendingWait
=
true
;
st
->
waitEvents
=
TOOL_EVENT
(
TC_Any
,
TA_Any
);
st
->
waitEvents
=
TOOL_EVENT
(
TC_Any
,
TA_Any
);
st
->
contextMenuTrigger
=
CMENU_OFF
;
GetEditFrame
()
->
PopupMenu
(
st
->
contextMenu
->
GetMenu
()
);
...
...
@@ -222,5 +222,11 @@ void TOOL_MANAGER::SetEnvironment( EDA_ITEM* aModel, KiGfx::VIEW* aView,
m_view
=
aView
;
m_viewControls
=
aViewControls
;
m_editFrame
=
aFrame
;
// fixme: reset tools after changing environment
// Reset state of the registered tools
BOOST_FOREACH
(
TOOL_BASE
*
tool
,
m_toolState
|
boost
::
adaptors
::
map_keys
)
{
if
(
tool
->
GetType
()
==
TOOL_Interactive
)
static_cast
<
TOOL_INTERACTIVE
*>
(
tool
)
->
Reset
();
}
}
include/tool/tool_manager.h
View file @
9bd7ba36
...
...
@@ -78,19 +78,18 @@ public:
template
<
class
Parameters
>
void
InvokeTool
(
const
std
::
string
&
name
,
const
Parameters
&
aToolParams
);
/**
* Function FindTool()
* Searches for a tool with given name or ID
*/
TOOL_BASE
*
FindTool
(
int
aId
);
TOOL_BASE
*
FindTool
(
const
std
::
string
&
aName
);
TOOL_BASE
*
FindTool
(
int
aId
);
TOOL_BASE
*
FindTool
(
const
std
::
string
&
aName
);
/**
* Resets the state of a given tool by clearing its wait and
* transition lists and calling tool's internal Reset() method.
*/
void
ResetTool
(
TOOL_BASE
*
aTool
);
void
ResetTool
(
TOOL_BASE
*
aTool
);
/**
* Takes an event from the TOOL_DISPATCHER and propagates it to
...
...
pcbnew/tools/selection_tool.cpp
View file @
9bd7ba36
...
...
@@ -57,6 +57,8 @@ SELECTION_TOOL::~SELECTION_TOOL()
void
SELECTION_TOOL
::
Reset
()
{
m_selectedItems
.
clear
();
// the tool launches upon reception of activate ("pcbnew.InteractiveSelection")
Go
(
&
SELECTION_TOOL
::
Main
,
TOOL_EVENT
(
TC_Command
,
TA_ActivateTool
,
GetName
()
)
);
//"pcbnew.InteractiveSelection"));
}
...
...
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