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
0c1a87ca
Commit
0c1a87ca
authored
Nov 21, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
selection_tool: Added SelectItem and UnselectItem actions.
parent
823623ac
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
2 deletions
+69
-2
common_actions.cpp
pcbnew/tools/common_actions.cpp
+8
-0
common_actions.h
pcbnew/tools/common_actions.h
+6
-0
selection_tool.cpp
pcbnew/tools/selection_tool.cpp
+49
-2
selection_tool.h
pcbnew/tools/selection_tool.h
+6
-0
No files found.
pcbnew/tools/common_actions.cpp
View file @
0c1a87ca
...
...
@@ -36,6 +36,14 @@ TOOL_ACTION COMMON_ACTIONS::selectionCursor( "pcbnew.InteractiveSelection.Cursor
AS_GLOBAL
,
0
,
""
,
""
);
// No description, it is not supposed to be shown anywhere
TOOL_ACTION
COMMON_ACTIONS
::
selectItem
(
"pcbnew.InteractiveSelection.SelectItem"
,
AS_GLOBAL
,
0
,
""
,
""
);
// No description, it is not supposed to be shown anywhere
TOOL_ACTION
COMMON_ACTIONS
::
unselectItem
(
"pcbnew.InteractiveSelection.UnselectItem"
,
AS_GLOBAL
,
0
,
""
,
""
);
// No description, it is not supposed to be shown anywhere
TOOL_ACTION
COMMON_ACTIONS
::
selectionClear
(
"pcbnew.InteractiveSelection.Clear"
,
AS_GLOBAL
,
0
,
""
,
""
);
// No description, it is not supposed to be shown anywhere
...
...
pcbnew/tools/common_actions.h
View file @
0c1a87ca
...
...
@@ -46,6 +46,12 @@ public:
/// Clears the current selection
static
TOOL_ACTION
selectionClear
;
/// Selects an item (specified as the event parameter).
static
TOOL_ACTION
selectItem
;
/// Unselects an item (specified as the event parameter).
static
TOOL_ACTION
unselectItem
;
// Edit Tool
/// Activation of the edit tool
static
TOOL_ACTION
editActivate
;
...
...
pcbnew/tools/selection_tool.cpp
View file @
0c1a87ca
...
...
@@ -187,6 +187,16 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
findMove
(
*
evt
);
}
else
if
(
evt
->
IsAction
(
&
COMMON_ACTIONS
::
selectItem
)
)
{
SelectItem
(
*
evt
);
}
else
if
(
evt
->
IsAction
(
&
COMMON_ACTIONS
::
unselectItem
)
)
{
UnselectItem
(
*
evt
);
}
else
if
(
evt
->
IsCancel
()
||
evt
->
Action
()
==
TA_UNDO_REDO
||
evt
->
IsAction
(
&
COMMON_ACTIONS
::
selectionClear
)
)
{
...
...
@@ -397,6 +407,8 @@ void SELECTION_TOOL::setTransitions()
Go
(
&
SELECTION_TOOL
::
Main
,
COMMON_ACTIONS
::
selectionActivate
.
MakeEvent
()
);
Go
(
&
SELECTION_TOOL
::
CursorSelection
,
COMMON_ACTIONS
::
selectionCursor
.
MakeEvent
()
);
Go
(
&
SELECTION_TOOL
::
ClearSelection
,
COMMON_ACTIONS
::
selectionClear
.
MakeEvent
()
);
Go
(
&
SELECTION_TOOL
::
SelectItem
,
COMMON_ACTIONS
::
selectItem
.
MakeEvent
()
);
Go
(
&
SELECTION_TOOL
::
UnselectItem
,
COMMON_ACTIONS
::
unselectItem
.
MakeEvent
()
);
Go
(
&
SELECTION_TOOL
::
find
,
COMMON_ACTIONS
::
find
.
MakeEvent
()
);
Go
(
&
SELECTION_TOOL
::
findMove
,
COMMON_ACTIONS
::
findMove
.
MakeEvent
()
);
}
...
...
@@ -461,6 +473,43 @@ int SELECTION_TOOL::ClearSelection( TOOL_EVENT& aEvent )
return
0
;
}
int
SELECTION_TOOL
::
SelectItem
(
TOOL_EVENT
&
aEvent
)
{
// Check if there is an item to be selected
BOARD_ITEM
*
item
=
static_cast
<
BOARD_ITEM
*>
(
aEvent
.
Parameter
()
);
if
(
item
)
{
select
(
item
);
// Inform other potentially interested tools
TOOL_EVENT
select
(
SelectedEvent
);
m_toolMgr
->
ProcessEvent
(
select
);
}
setTransitions
();
return
0
;
}
int
SELECTION_TOOL
::
UnselectItem
(
TOOL_EVENT
&
aEvent
)
{
// Check if there is an item to be selected
BOARD_ITEM
*
item
=
static_cast
<
BOARD_ITEM
*>
(
aEvent
.
Parameter
()
);
if
(
item
)
{
unselect
(
item
);
// Inform other potentially interested tools
TOOL_EVENT
unselect
(
UnselectedEvent
);
m_toolMgr
->
ProcessEvent
(
unselect
);
}
setTransitions
();
return
0
;
}
void
SELECTION_TOOL
::
findCallback
(
BOARD_ITEM
*
aItem
)
{
...
...
@@ -525,8 +574,6 @@ void SELECTION_TOOL::clearSelection()
// Inform other potentially interested tools
TOOL_EVENT
clearEvent
(
ClearedEvent
);
m_toolMgr
->
ProcessEvent
(
clearEvent
);
return
;
}
...
...
pcbnew/tools/selection_tool.h
View file @
0c1a87ca
...
...
@@ -157,6 +157,12 @@ public:
///> Clear current selection event handler.
int
ClearSelection
(
TOOL_EVENT
&
aEvent
);
///> Item selection event handler.
int
SelectItem
(
TOOL_EVENT
&
aEvent
);
///> Item unselection event handler.
int
UnselectItem
(
TOOL_EVENT
&
aEvent
);
///> Event sent after an item is selected.
const
TOOL_EVENT
SelectedEvent
;
...
...
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