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
a6917280
Commit
a6917280
authored
Apr 04, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added net highlighting.
parent
9a84944f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
6 deletions
+63
-6
painter.h
include/painter.h
+21
-3
selection_tool.cpp
pcbnew/tools/selection_tool.cpp
+34
-3
selection_tool.h
pcbnew/tools/selection_tool.h
+8
-0
No files found.
include/painter.h
View file @
a6917280
...
@@ -109,6 +109,26 @@ public:
...
@@ -109,6 +109,26 @@ public:
return
(
m_activeLayers
.
count
(
aLayerId
)
>
0
);
return
(
m_activeLayers
.
count
(
aLayerId
)
>
0
);
}
}
/**
* Function GetHighlight
* Returns current highlight setting.
* @return True if highlight is enabled, false otherwise.
*/
bool
GetHighlight
()
const
{
return
m_highlightEnabled
;
}
/**
* Function GetHighlightNetCode
* Returns netcode of currently highlighted net.
* @return Netcode of currently highlighted net.
*/
int
GetHighlightNetCode
()
const
{
return
m_highlightNetcode
;
}
/**
/**
* Function SetHighlight
* Function SetHighlight
* Turns on/off highlighting - it may be done for the active layer or the specified net.
* Turns on/off highlighting - it may be done for the active layer or the specified net.
...
@@ -119,8 +139,6 @@ public:
...
@@ -119,8 +139,6 @@ public:
inline
void
SetHighlight
(
bool
aEnabled
,
int
aNetcode
=
-
1
)
inline
void
SetHighlight
(
bool
aEnabled
,
int
aNetcode
=
-
1
)
{
{
m_highlightEnabled
=
aEnabled
;
m_highlightEnabled
=
aEnabled
;
if
(
aNetcode
>
0
)
m_highlightNetcode
=
aNetcode
;
m_highlightNetcode
=
aNetcode
;
}
}
...
...
pcbnew/tools/selection_tool.cpp
View file @
a6917280
...
@@ -111,12 +111,19 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
...
@@ -111,12 +111,19 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
// single click? Select single object
// single click? Select single object
else
if
(
evt
->
IsClick
(
BUT_LEFT
)
)
else
if
(
evt
->
IsClick
(
BUT_LEFT
)
)
{
if
(
evt
->
Modifier
(
MD_CTRL
)
)
{
highlightNet
(
evt
->
Position
()
);
}
else
{
{
if
(
!
m_additive
)
if
(
!
m_additive
)
clearSelection
();
clearSelection
();
selectSingle
(
evt
->
Position
()
);
selectSingle
(
evt
->
Position
()
);
}
}
}
// 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
)
)
...
@@ -650,6 +657,30 @@ bool SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const
...
@@ -650,6 +657,30 @@ bool SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const
}
}
void
SELECTION_TOOL
::
highlightNet
(
const
VECTOR2I
&
aPoint
)
{
KIGFX
::
RENDER_SETTINGS
*
render
=
getView
()
->
GetPainter
()
->
GetSettings
();
GENERAL_COLLECTORS_GUIDE
guide
=
getEditFrame
<
PCB_EDIT_FRAME
>
()
->
GetCollectorsGuide
();
GENERAL_COLLECTOR
collector
;
int
net
=
-
1
;
// Find a connected item for which we are going to highlight a net
collector
.
Collect
(
getModel
<
BOARD
>
(
PCB_T
),
GENERAL_COLLECTOR
::
PadsTracksOrZones
,
wxPoint
(
aPoint
.
x
,
aPoint
.
y
),
guide
);
bool
enableHighlight
=
(
collector
.
GetCount
()
>
0
);
// Obtain net code for the clicked item
if
(
enableHighlight
)
net
=
static_cast
<
BOARD_CONNECTED_ITEM
*>
(
collector
[
0
]
)
->
GetNetCode
();
if
(
enableHighlight
!=
render
->
GetHighlight
()
||
net
!=
render
->
GetHighlightNetCode
()
)
{
render
->
SetHighlight
(
enableHighlight
,
net
);
getView
()
->
UpdateAllLayersColor
();
}
}
void
SELECTION_TOOL
::
SELECTION
::
clear
()
void
SELECTION_TOOL
::
SELECTION
::
clear
()
{
{
items
.
ClearItemsList
();
items
.
ClearItemsList
();
...
...
pcbnew/tools/selection_tool.h
View file @
a6917280
...
@@ -221,6 +221,14 @@ private:
...
@@ -221,6 +221,14 @@ private:
*/
*/
bool
selectionContains
(
const
VECTOR2I
&
aPoint
)
const
;
bool
selectionContains
(
const
VECTOR2I
&
aPoint
)
const
;
/**
* Function highlightNet()
* Looks for a BOARD_CONNECTED_ITEM in a given spot, and if one is found - it enables
* highlight for its net.
* @param aPoint is the point where an item is expected (world coordinates).
*/
void
highlightNet
(
const
VECTOR2I
&
aPoint
);
/// Visual representation of selection box
/// Visual representation of selection box
SELECTION_AREA
*
m_selArea
;
SELECTION_AREA
*
m_selArea
;
...
...
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