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
6a1d3445
Commit
6a1d3445
authored
Mar 18, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Instant dragging (without prior selection).
parent
9783aaf3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
9 deletions
+30
-9
selection_tool.cpp
pcbnew/tools/selection_tool.cpp
+26
-8
selection_tool.h
pcbnew/tools/selection_tool.h
+4
-1
No files found.
pcbnew/tools/selection_tool.cpp
View file @
6a1d3445
...
...
@@ -141,10 +141,18 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
{
if
(
m_selection
.
Empty
()
||
m_additive
)
{
// If nothings has been selected or user wants to select more
// draw the selection box
selectMultiple
();
if
(
!
selectSingle
(
getView
()
->
ToWorld
(
getViewControls
()
->
GetMousePosition
()
),
false
)
)
{
// If nothings has been selected or user wants to select more
// draw the selection box
selectMultiple
();
}
else
{
m_toolMgr
->
InvokeTool
(
"pcbnew.InteractiveEdit"
);
}
}
else
{
// Check if dragging has started within any of selected items bounding box
...
...
@@ -205,7 +213,7 @@ void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem )
}
void
SELECTION_TOOL
::
selectSingle
(
const
VECTOR2I
&
aWhere
)
bool
SELECTION_TOOL
::
selectSingle
(
const
VECTOR2I
&
aWhere
,
bool
aAllowDisambiguation
)
{
BOARD
*
pcb
=
getModel
<
BOARD
>
(
PCB_T
);
BOARD_ITEM
*
item
;
...
...
@@ -220,11 +228,13 @@ void SELECTION_TOOL::selectSingle( const VECTOR2I& aWhere )
case
0
:
if
(
!
m_additive
)
clearSelection
();
break
;
return
false
;
case
1
:
toggleSelection
(
collector
[
0
]
);
break
;
return
true
;
default
:
// Remove unselectable items
...
...
@@ -238,17 +248,25 @@ void SELECTION_TOOL::selectSingle( const VECTOR2I& aWhere )
if
(
collector
.
GetCount
()
==
1
)
{
toggleSelection
(
collector
[
0
]
);
return
true
;
}
else
if
(
collector
.
GetCount
()
>
1
)
else
if
(
aAllowDisambiguation
&&
collector
.
GetCount
()
>
1
)
{
item
=
disambiguationMenu
(
&
collector
);
if
(
item
)
{
toggleSelection
(
item
);
}
return
true
;
}
}
break
;
}
return
false
;
}
...
...
pcbnew/tools/selection_tool.h
View file @
6a1d3445
...
...
@@ -130,8 +130,11 @@ private:
* place, there is a menu displayed that allows to choose the item.
*
* @param aWhere is the place where the item should be selected.
* @param aAllowDisambiguation decides what to do in case of disambiguation. If true, then
* a menu is shown, otherise function finishes without selecting anything.
* @return True if an item was selected, false otherwise.
*/
void
selectSingle
(
const
VECTOR2I
&
aWher
e
);
bool
selectSingle
(
const
VECTOR2I
&
aWhere
,
bool
aAllowDisambiguation
=
tru
e
);
/**
* Function selectMultiple()
...
...
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