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
bec2e9b1
Commit
bec2e9b1
authored
Dec 03, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some comments & asserts.
parent
08fd9d8c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
5 deletions
+29
-5
action_manager.cpp
common/tool/action_manager.cpp
+2
-0
tool_manager.cpp
common/tool/tool_manager.cpp
+13
-3
tool_event.h
include/tool/tool_event.h
+3
-0
basepcbframe.cpp
pcbnew/basepcbframe.cpp
+1
-1
selection_tool.h
pcbnew/tools/selection_tool.h
+10
-1
No files found.
common/tool/action_manager.cpp
View file @
bec2e9b1
...
...
@@ -44,6 +44,8 @@ ACTION_MANAGER::~ACTION_MANAGER()
void
ACTION_MANAGER
::
RegisterAction
(
TOOL_ACTION
*
aAction
)
{
assert
(
aAction
->
GetId
()
==
-
1
);
// Check if the TOOL_ACTION was not registered before
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
)
);
...
...
common/tool/tool_manager.cpp
View file @
bec2e9b1
...
...
@@ -120,6 +120,11 @@ TOOL_MANAGER::~TOOL_MANAGER()
void
TOOL_MANAGER
::
RegisterTool
(
TOOL_BASE
*
aTool
)
{
wxASSERT_MSG
(
m_toolNameIndex
.
find
(
aTool
->
GetName
()
)
==
m_toolNameIndex
.
end
(),
wxT
(
"Adding two tools with the same name may result in unexpected behaviour."
)
);
wxASSERT_MSG
(
m_toolIdIndex
.
find
(
aTool
->
GetId
()
)
==
m_toolIdIndex
.
end
(),
wxT
(
"Adding two tools with the same ID may result in unexpected behaviour."
)
);
TOOL_STATE
*
st
=
new
TOOL_STATE
;
st
->
theTool
=
aTool
;
...
...
@@ -227,7 +232,10 @@ bool TOOL_MANAGER::runTool( TOOL_BASE* aTool )
wxASSERT
(
aTool
!=
NULL
);
if
(
!
isRegistered
(
aTool
)
)
{
wxASSERT_MSG
(
false
,
wxT
(
"You cannot run unregistered tools"
)
);
return
false
;
}
TOOL_STATE
*
state
=
m_toolState
[
aTool
];
...
...
@@ -334,10 +342,11 @@ void TOOL_MANAGER::dispatchInternal( TOOL_EVENT& aEvent )
// Go() method that match the event.
if
(
st
->
transitions
.
size
()
)
{
BOOST_FOREACH
(
TRANSITION
tr
,
st
->
transitions
)
BOOST_FOREACH
(
TRANSITION
&
tr
,
st
->
transitions
)
{
if
(
tr
.
first
.
Matches
(
aEvent
)
)
{
// as the state changes, the transition table has to be set up again
st
->
transitions
.
clear
();
// no tool context allocated yet? Create one.
...
...
@@ -351,6 +360,9 @@ void TOOL_MANAGER::dispatchInternal( TOOL_EVENT& aEvent )
if
(
!
st
->
cofunc
->
Running
()
)
finishTool
(
st
);
// The couroutine has finished immediately?
// there is no point in further checking, as transitions got cleared
break
;
}
}
}
...
...
@@ -406,8 +418,6 @@ void TOOL_MANAGER::finishTool( TOOL_STATE* aState )
if
(
it
!=
m_activeTools
.
end
()
)
m_activeTools
.
erase
(
it
);
else
wxLogWarning
(
wxT
(
"Tried to finish inactive tool"
)
);
aState
->
idle
=
true
;
delete
aState
->
cofunc
;
...
...
include/tool/tool_event.h
View file @
bec2e9b1
...
...
@@ -321,6 +321,9 @@ public:
if
(
m_commandId
&&
aEvent
.
m_commandId
)
return
*
m_commandId
==
*
aEvent
.
m_commandId
;
// Command-type event has to contain either id or string
assert
(
false
);
}
return
true
;
...
...
pcbnew/basepcbframe.cpp
View file @
bec2e9b1
...
...
@@ -609,7 +609,7 @@ void PCB_BASE_FRAME::UseGalCanvas( bool aEnable )
EDA_DRAW_FRAME
::
UseGalCanvas
(
aEnable
);
m_toolManager
->
SetEnvironment
(
m_Pcb
,
m_galCanvas
->
GetView
(),
m_galCanvas
->
GetViewControls
(),
this
);
m_galCanvas
->
GetViewControls
(),
this
);
ViewReloadBoard
(
m_Pcb
);
}
...
...
pcbnew/tools/selection_tool.h
View file @
bec2e9b1
...
...
@@ -68,7 +68,16 @@ public:
KIGFX
::
VIEW_GROUP
*
group
;
/// Checks if there is anything selected
bool
Empty
()
const
{
return
items
.
empty
();
}
bool
Empty
()
const
{
return
items
.
empty
();
}
/// Returns the number of selected parts
int
Size
()
const
{
return
items
.
size
();
}
};
/// @copydoc TOOL_INTERACTIVE::Reset()
...
...
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