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
d2c47a74
Commit
d2c47a74
authored
Sep 09, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Parts of MODULEs are not selectable in multiple selection mode.
parent
31f7ecc1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
31 deletions
+18
-31
selection_tool.cpp
pcbnew/tools/selection_tool.cpp
+15
-25
selection_tool.h
pcbnew/tools/selection_tool.h
+3
-6
No files found.
pcbnew/tools/selection_tool.cpp
View file @
d2c47a74
...
@@ -44,7 +44,7 @@ using namespace KiGfx;
...
@@ -44,7 +44,7 @@ using namespace KiGfx;
using
boost
::
optional
;
using
boost
::
optional
;
SELECTION_TOOL
::
SELECTION_TOOL
()
:
SELECTION_TOOL
::
SELECTION_TOOL
()
:
TOOL_INTERACTIVE
(
"pcbnew.InteractiveSelection"
)
TOOL_INTERACTIVE
(
"pcbnew.InteractiveSelection"
)
,
m_multiple
(
false
)
{
{
m_selArea
=
new
SELECTION_AREA
;
m_selArea
=
new
SELECTION_AREA
;
}
}
...
@@ -233,6 +233,7 @@ bool SELECTION_TOOL::selectMultiple()
...
@@ -233,6 +233,7 @@ bool SELECTION_TOOL::selectMultiple()
OPT_TOOL_EVENT
evt
;
OPT_TOOL_EVENT
evt
;
VIEW
*
v
=
getView
();
VIEW
*
v
=
getView
();
bool
cancelled
=
false
;
bool
cancelled
=
false
;
m_multiple
=
true
;
// Those 2 lines remove the blink-in-the-random-place effect
// Those 2 lines remove the blink-in-the-random-place effect
m_selArea
->
SetOrigin
(
VECTOR2I
(
0
,
0
)
);
m_selArea
->
SetOrigin
(
VECTOR2I
(
0
,
0
)
);
...
@@ -281,13 +282,12 @@ bool SELECTION_TOOL::selectMultiple()
...
@@ -281,13 +282,12 @@ bool SELECTION_TOOL::selectMultiple()
m_selectedItems
.
insert
(
item
);
m_selectedItems
.
insert
(
item
);
}
}
}
}
handleModules
();
break
;
break
;
}
}
}
}
v
->
Remove
(
m_selArea
);
v
->
Remove
(
m_selArea
);
m_multiple
=
false
;
return
cancelled
;
return
cancelled
;
}
}
...
@@ -370,6 +370,11 @@ bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem )
...
@@ -370,6 +370,11 @@ bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem )
break
;
break
;
case
PCB_PAD_T
:
case
PCB_PAD_T
:
{
// Pads are not selectable in multiple selection mode
if
(
m_multiple
)
return
false
;
// Pads are supposed to be on top, bottom or both at the same time (THT)
// Pads are supposed to be on top, bottom or both at the same time (THT)
if
(
aItem
->
IsOnLayer
(
LAYER_N_FRONT
)
&&
board
->
IsLayerVisible
(
LAYER_N_FRONT
)
)
if
(
aItem
->
IsOnLayer
(
LAYER_N_FRONT
)
&&
board
->
IsLayerVisible
(
LAYER_N_FRONT
)
)
return
true
;
return
true
;
...
@@ -378,6 +383,13 @@ bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem )
...
@@ -378,6 +383,13 @@ bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem )
return
true
;
return
true
;
return
false
;
return
false
;
}
break
;
case
PCB_MODULE_TEXT_T
:
// Module texts are not selectable in multiple selection mode
if
(
m_multiple
)
return
false
;
break
;
break
;
case
PCB_MODULE_EDGE_T
:
case
PCB_MODULE_EDGE_T
:
...
@@ -389,25 +401,3 @@ bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem )
...
@@ -389,25 +401,3 @@ bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem )
// All other items are selected only if the layer on which they exist is visible
// All other items are selected only if the layer on which they exist is visible
return
board
->
IsLayerVisible
(
aItem
->
GetLayer
()
);
return
board
->
IsLayerVisible
(
aItem
->
GetLayer
()
);
}
}
void
SELECTION_TOOL
::
handleModules
()
{
std
::
set
<
BOARD_ITEM
*>::
iterator
it
,
it_end
;
for
(
it
=
m_selectedItems
.
begin
(),
it_end
=
m_selectedItems
.
end
();
it
!=
it_end
;
)
{
BOARD_ITEM
*
parent
=
(
*
it
)
->
GetParent
();
// Do not allow to select MODULE and it's parts at the same time
if
(
parent
!=
NULL
&&
parent
->
IsSelected
()
)
{
(
*
it
)
->
ClearSelected
();
m_selectedItems
.
erase
(
it
++
);
}
else
{
++
it
;
}
}
}
pcbnew/tools/selection_tool.h
View file @
d2c47a74
...
@@ -131,12 +131,6 @@ private:
...
@@ -131,12 +131,6 @@ private:
*/
*/
bool
selectable
(
const
BOARD_ITEM
*
aItem
);
bool
selectable
(
const
BOARD_ITEM
*
aItem
);
/**
* Prevents from selecting both MODULEs and it's parts at the same time. The right way is
* to select a MODULE *or* some of it's parts.
*/
void
handleModules
();
/// Container storing currently selected items
/// Container storing currently selected items
std
::
set
<
BOARD_ITEM
*>
m_selectedItems
;
std
::
set
<
BOARD_ITEM
*>
m_selectedItems
;
...
@@ -148,6 +142,9 @@ private:
...
@@ -148,6 +142,9 @@ private:
/// Flag saying if items should be added to the current selection or rather replace it
/// Flag saying if items should be added to the current selection or rather replace it
bool
m_additive
;
bool
m_additive
;
/// Flag saying if multiple selection mode is active
bool
m_multiple
;
};
};
#endif
#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