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
Show 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
...
@@ -140,11 +140,19 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
...
@@ -140,11 +140,19 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
else
if
(
evt
->
IsDrag
(
BUT_LEFT
)
)
else
if
(
evt
->
IsDrag
(
BUT_LEFT
)
)
{
{
if
(
m_selection
.
Empty
()
||
m_additive
)
if
(
m_selection
.
Empty
()
||
m_additive
)
{
if
(
!
selectSingle
(
getView
()
->
ToWorld
(
getViewControls
()
->
GetMousePosition
()
),
false
)
)
{
{
// If nothings has been selected or user wants to select more
// If nothings has been selected or user wants to select more
// draw the selection box
// draw the selection box
selectMultiple
();
selectMultiple
();
}
}
else
{
m_toolMgr
->
InvokeTool
(
"pcbnew.InteractiveEdit"
);
}
}
else
else
{
{
// Check if dragging has started within any of selected items bounding box
// Check if dragging has started within any of selected items bounding box
...
@@ -205,7 +213,7 @@ void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem )
...
@@ -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
*
pcb
=
getModel
<
BOARD
>
(
PCB_T
);
BOARD_ITEM
*
item
;
BOARD_ITEM
*
item
;
...
@@ -220,11 +228,13 @@ void SELECTION_TOOL::selectSingle( const VECTOR2I& aWhere )
...
@@ -220,11 +228,13 @@ void SELECTION_TOOL::selectSingle( const VECTOR2I& aWhere )
case
0
:
case
0
:
if
(
!
m_additive
)
if
(
!
m_additive
)
clearSelection
();
clearSelection
();
break
;
return
false
;
case
1
:
case
1
:
toggleSelection
(
collector
[
0
]
);
toggleSelection
(
collector
[
0
]
);
break
;
return
true
;
default
:
default
:
// Remove unselectable items
// Remove unselectable items
...
@@ -238,17 +248,25 @@ void SELECTION_TOOL::selectSingle( const VECTOR2I& aWhere )
...
@@ -238,17 +248,25 @@ void SELECTION_TOOL::selectSingle( const VECTOR2I& aWhere )
if
(
collector
.
GetCount
()
==
1
)
if
(
collector
.
GetCount
()
==
1
)
{
{
toggleSelection
(
collector
[
0
]
);
toggleSelection
(
collector
[
0
]
);
return
true
;
}
}
else
if
(
collector
.
GetCount
()
>
1
)
else
if
(
aAllowDisambiguation
&&
collector
.
GetCount
()
>
1
)
{
{
item
=
disambiguationMenu
(
&
collector
);
item
=
disambiguationMenu
(
&
collector
);
if
(
item
)
if
(
item
)
{
toggleSelection
(
item
);
toggleSelection
(
item
);
}
return
true
;
}
}
break
;
break
;
}
}
return
false
;
}
}
...
...
pcbnew/tools/selection_tool.h
View file @
6a1d3445
...
@@ -130,8 +130,11 @@ private:
...
@@ -130,8 +130,11 @@ private:
* place, there is a menu displayed that allows to choose the item.
* place, there is a menu displayed that allows to choose the item.
*
*
* @param aWhere is the place where the item should be selected.
* @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()
* 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