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
6af09fed
Commit
6af09fed
authored
Aug 09, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added the additive mode for the selection area.
parent
2cb6e59d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
9 deletions
+15
-9
selection_tool.cpp
pcbnew/tools/selection_tool.cpp
+12
-7
selection_tool.h
pcbnew/tools/selection_tool.h
+3
-2
No files found.
pcbnew/tools/selection_tool.cpp
View file @
6af09fed
...
...
@@ -67,12 +67,14 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
// Main loop: keep receiving events
while
(
OPT_TOOL_EVENT
evt
=
Wait
()
)
{
m_additive
=
evt
->
Modifier
(
MB_ModShift
);
if
(
evt
->
IsCancel
()
)
return
0
;
// single click? Select single object
if
(
evt
->
IsClick
(
MB_Left
)
)
selectSingle
(
evt
->
Position
()
,
evt
->
Modifier
(
MB_ModShift
)
);
selectSingle
(
evt
->
Position
()
);
// drag with LMB? Select multiple objects (or at least draw a selection box)
if
(
evt
->
IsDrag
(
MB_Left
)
)
...
...
@@ -83,7 +85,7 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
}
void
SELECTION_TOOL
::
toggleSelection
(
BOARD_ITEM
*
aItem
,
bool
aAdditive
)
void
SELECTION_TOOL
::
toggleSelection
(
BOARD_ITEM
*
aItem
)
{
if
(
m_selectedItems
.
find
(
aItem
)
!=
m_selectedItems
.
end
()
)
{
...
...
@@ -92,7 +94,7 @@ void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem, bool aAdditive )
}
else
{
if
(
!
aA
dditive
)
if
(
!
m_a
dditive
)
clearSelection
();
aItem
->
SetSelected
();
...
...
@@ -112,7 +114,7 @@ void SELECTION_TOOL::clearSelection()
}
void
SELECTION_TOOL
::
selectSingle
(
const
VECTOR2I
&
aWhere
,
bool
aAdditive
)
void
SELECTION_TOOL
::
selectSingle
(
const
VECTOR2I
&
aWhere
)
{
BOARD
*
pcb
=
getModel
<
BOARD
>
(
PCB_T
);
BOARD_ITEM
*
item
;
...
...
@@ -125,18 +127,18 @@ void SELECTION_TOOL::selectSingle( const VECTOR2I& aWhere, bool aAdditive )
switch
(
collector
.
GetCount
()
)
{
case
0
:
if
(
!
aA
dditive
)
if
(
!
m_a
dditive
)
clearSelection
();
break
;
case
1
:
toggleSelection
(
collector
[
0
]
,
aAdditive
);
toggleSelection
(
collector
[
0
]
);
break
;
default
:
item
=
disambiguationMenu
(
&
collector
);
if
(
item
)
toggleSelection
(
item
,
aAdditive
);
toggleSelection
(
item
);
break
;
}
}
...
...
@@ -197,6 +199,9 @@ void SELECTION_TOOL::selectMultiple()
if
(
evt
->
IsDrag
(
MB_Left
)
)
{
if
(
!
m_additive
)
clearSelection
();
// Start drawing a selection box
m_selArea
->
SetOrigin
(
evt
->
DragOrigin
()
);
m_selArea
->
SetEnd
(
evt
->
Position
()
);
...
...
pcbnew/tools/selection_tool.h
View file @
6af09fed
...
...
@@ -57,17 +57,18 @@ public:
int
Main
(
TOOL_EVENT
&
aEvent
);
private
:
void
selectSingle
(
const
VECTOR2I
&
aWhere
,
bool
aAdditive
);
void
selectSingle
(
const
VECTOR2I
&
aWhere
);
void
selectMultiple
();
void
handleHighlight
(
const
VECTOR2D
&
aP
);
BOARD_ITEM
*
disambiguationMenu
(
GENERAL_COLLECTOR
*
aItems
);
BOARD_ITEM
*
pickSmallestComponent
(
GENERAL_COLLECTOR
*
aCollector
);
void
toggleSelection
(
BOARD_ITEM
*
aItem
,
bool
aAdditive
);
void
toggleSelection
(
BOARD_ITEM
*
aItem
);
void
clearSelection
();
std
::
set
<
BOARD_ITEM
*>
m_selectedItems
;
SELECTION_AREA
*
m_selArea
;
boost
::
shared_ptr
<
CONTEXT_MENU
>
m_menu
;
bool
m_additive
;
};
#endif
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