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
9ef9b7b8
Commit
9ef9b7b8
authored
Apr 30, 2015
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Preliminary selection mode for SELECTION_TOOL.
parent
b8295b6a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
selection_tool.cpp
pcbnew/tools/selection_tool.cpp
+15
-2
selection_tool.h
pcbnew/tools/selection_tool.h
+6
-1
No files found.
pcbnew/tools/selection_tool.cpp
View file @
9ef9b7b8
...
@@ -111,7 +111,6 @@ void SELECTION_TOOL::Reset( RESET_REASON aReason )
...
@@ -111,7 +111,6 @@ void SELECTION_TOOL::Reset( RESET_REASON aReason )
// Remove pointers to the selected items from containers
// Remove pointers to the selected items from containers
// without changing their properties (as they are already deleted
// without changing their properties (as they are already deleted
// while a new board is loaded)
// while a new board is loaded)
m_selection
.
group
->
Clear
();
m_selection
.
clear
();
m_selection
.
clear
();
}
}
else
else
...
@@ -120,6 +119,7 @@ void SELECTION_TOOL::Reset( RESET_REASON aReason )
...
@@ -120,6 +119,7 @@ void SELECTION_TOOL::Reset( RESET_REASON aReason )
m_frame
=
getEditFrame
<
PCB_BASE_FRAME
>
();
m_frame
=
getEditFrame
<
PCB_BASE_FRAME
>
();
m_locked
=
true
;
m_locked
=
true
;
m_preliminary
=
true
;
// Reinsert the VIEW_GROUP, in case it was removed from the VIEW
// Reinsert the VIEW_GROUP, in case it was removed from the VIEW
getView
()
->
Remove
(
m_selection
.
group
);
getView
()
->
Remove
(
m_selection
.
group
);
...
@@ -155,10 +155,13 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
...
@@ -155,10 +155,13 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
// right click? if there is any object - show the context menu
// right click? if there is any object - show the context menu
else
if
(
evt
->
IsClick
(
BUT_RIGHT
)
)
else
if
(
evt
->
IsClick
(
BUT_RIGHT
)
)
{
{
if
(
m_selection
.
Empty
()
)
bool
emptySelection
=
m_selection
.
Empty
();
if
(
emptySelection
)
selectCursor
(
evt
->
Position
()
);
selectCursor
(
evt
->
Position
()
);
generateMenu
();
generateMenu
();
m_preliminary
=
emptySelection
;
}
}
// double click? Display the properties window
// double click? Display the properties window
...
@@ -175,10 +178,14 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
...
@@ -175,10 +178,14 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
{
{
if
(
m_additive
)
if
(
m_additive
)
{
{
m_preliminary
=
false
;
selectMultiple
();
selectMultiple
();
}
}
else
if
(
m_selection
.
Empty
()
)
else
if
(
m_selection
.
Empty
()
)
{
{
m_preliminary
=
false
;
// There is nothing selected, so try to select something
// There is nothing selected, so try to select something
if
(
!
selectCursor
(
getView
()
->
ToWorld
(
getViewControls
()
->
GetMousePosition
()
),
false
)
)
if
(
!
selectCursor
(
getView
()
->
ToWorld
(
getViewControls
()
->
GetMousePosition
()
),
false
)
)
{
{
...
@@ -249,6 +256,12 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
...
@@ -249,6 +256,12 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
{
{
selectNet
(
*
evt
);
selectNet
(
*
evt
);
}
}
else
if
(
evt
->
Action
()
==
TA_CONTEXT_MENU_CLOSED
)
{
if
(
m_preliminary
)
clearSelection
();
}
}
}
// This tool is supposed to be active forever
// This tool is supposed to be active forever
...
...
pcbnew/tools/selection_tool.h
View file @
9ef9b7b8
...
@@ -122,8 +122,10 @@ public:
...
@@ -122,8 +122,10 @@ public:
*
*
* Returns the set of currently selected items.
* Returns the set of currently selected items.
*/
*/
const
SELECTION
&
GetSelection
()
const
const
SELECTION
&
GetSelection
()
{
{
// The selected items list has been requested, so it is no longer preliminary
m_preliminary
=
false
;
return
m_selection
;
return
m_selection
;
}
}
...
@@ -356,6 +358,9 @@ private:
...
@@ -356,6 +358,9 @@ private:
/// Can other tools modify locked items.
/// Can other tools modify locked items.
bool
m_locked
;
bool
m_locked
;
/// Determines if the selection is preliminary or final.
bool
m_preliminary
;
/// Conditions for specific context menu entries.
/// Conditions for specific context menu entries.
std
::
deque
<
SELECTION_CONDITION
>
m_menuConditions
;
std
::
deque
<
SELECTION_CONDITION
>
m_menuConditions
;
};
};
...
...
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