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
573f9841
Commit
573f9841
authored
Sep 16, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better way of marking 'brightened' mode for items.
parent
86f520f7
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
42 deletions
+18
-42
painter.cpp
common/painter.cpp
+0
-22
view.cpp
common/view/view.cpp
+0
-6
base_struct.h
include/base_struct.h
+2
-2
painter.h
include/painter.h
+0
-7
CMakeLists.txt
pcbnew/CMakeLists.txt
+1
-0
selection_tool.cpp
pcbnew/tools/selection_tool.cpp
+15
-5
No files found.
common/painter.cpp
View file @
573f9841
...
...
@@ -79,25 +79,3 @@ void PAINTER::SetGAL( GAL* aGal )
{
m_gal
=
aGal
;
}
void
PAINTER
::
DrawBrightened
(
const
VIEW_ITEM
*
aItem
)
{
BOX2I
box
=
aItem
->
ViewBBox
();
RenderTarget
oldTarget
=
m_gal
->
GetTarget
();
m_gal
->
SetTarget
(
TARGET_OVERLAY
);
m_gal
->
PushDepth
();
m_gal
->
SetLayerDepth
(
-
1.0
);
// Draw an outline that marks items as brightened
m_gal
->
SetIsStroke
(
true
);
m_gal
->
SetLineWidth
(
100000.0
);
m_gal
->
SetStrokeColor
(
m_brightenedColor
);
m_gal
->
DrawRectangle
(
box
.
GetOrigin
(),
box
.
GetOrigin
()
+
box
.
GetSize
()
);
m_gal
->
PopDepth
();
m_gal
->
SetTarget
(
oldTarget
);
}
common/view/view.cpp
View file @
573f9841
...
...
@@ -596,12 +596,6 @@ void VIEW::draw( VIEW_ITEM* aItem, int aLayer, bool aImmediate ) const
if
(
!
m_painter
->
Draw
(
aItem
,
aLayer
)
)
aItem
->
ViewDraw
(
aLayer
,
m_gal
);
// Alternative drawing method
}
// Draws a bright contour around the item
if
(
static_cast
<
const
EDA_ITEM
*>
(
aItem
)
->
IsBrightened
()
)
{
m_painter
->
DrawBrightened
(
aItem
);
}
}
...
...
include/base_struct.h
View file @
573f9841
...
...
@@ -474,11 +474,11 @@ public:
inline
void
SetSelected
()
{
SetFlags
(
SELECTED
);
ViewUpdate
(
COLOR
);
}
inline
void
SetHighlighted
()
{
SetFlags
(
HIGHLIGHTED
);
ViewUpdate
(
COLOR
);
}
inline
void
SetBrightened
()
{
SetFlags
(
BRIGHTENED
);
ViewUpdate
(
COLOR
);
}
inline
void
SetBrightened
()
{
SetFlags
(
BRIGHTENED
);
}
inline
void
ClearSelected
()
{
ClearFlags
(
SELECTED
);
ViewUpdate
(
COLOR
);
}
inline
void
ClearHighlighted
()
{
ClearFlags
(
HIGHLIGHTED
);
ViewUpdate
(
COLOR
);
}
inline
void
ClearBrightened
()
{
ClearFlags
(
BRIGHTENED
);
ViewUpdate
(
COLOR
);
}
inline
void
ClearBrightened
()
{
ClearFlags
(
BRIGHTENED
);
}
void
SetModified
();
...
...
include/painter.h
View file @
573f9841
...
...
@@ -224,13 +224,6 @@ public:
*/
virtual
bool
Draw
(
const
VIEW_ITEM
*
aItem
,
int
aLayer
)
=
0
;
/**
* Function DrawBrightened
* Draws a special marking for the item.
* @param aItem is the item that is going to be marked.
*/
virtual
void
DrawBrightened
(
const
VIEW_ITEM
*
aItem
);
protected
:
/// Instance of graphic abstraction layer that gives an interface to call
/// commands used to draw (eg. DrawLine, DrawCircle, etc.)
...
...
pcbnew/CMakeLists.txt
View file @
573f9841
...
...
@@ -221,6 +221,7 @@ set(PCBNEW_CLASS_SRCS
tools/selection_tool.cpp
tools/selection_area.cpp
tools/bright_box.cpp
tools/move_tool.cpp
tools/pcb_tools.cpp
)
...
...
pcbnew/tools/selection_tool.cpp
View file @
573f9841
...
...
@@ -41,6 +41,7 @@
#include "selection_tool.h"
#include "selection_area.h"
#include "bright_box.h"
using
namespace
KiGfx
;
using
boost
::
optional
;
...
...
@@ -334,8 +335,8 @@ bool SELECTION_TOOL::selectMultiple()
BOARD_ITEM
*
SELECTION_TOOL
::
disambiguationMenu
(
GENERAL_COLLECTOR
*
aCollector
)
{
OPT_TOOL_EVENT
evt
;
BOARD_ITEM
*
current
=
NULL
;
boost
::
shared_ptr
<
BRIGHT_BOX
>
brightBox
;
m_menu
.
reset
(
new
CONTEXT_MENU
()
);
m_menu
->
SetTitle
(
_
(
"Clarify selection"
)
);
...
...
@@ -352,10 +353,13 @@ BOARD_ITEM* SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR* aCollector )
SetContextMenu
(
m_menu
.
get
(),
CMENU_NOW
);
while
(
evt
=
Wait
()
)
while
(
OPT_TOOL_EVENT
evt
=
Wait
()
)
{
wxLogDebug
(
wxT
(
"disambiguation menu event"
)
);
if
(
evt
->
Action
()
==
TA_ContextMenuUpdate
)
{
// User has pointed an item, so show it in a different way
if
(
current
)
current
->
ClearBrightened
();
...
...
@@ -380,14 +384,20 @@ BOARD_ITEM* SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR* aCollector )
{
current
=
(
*
aCollector
)[
*
id
];
current
->
SetSelected
();
return
current
;
}
return
NULL
;
break
;
}
if
(
current
&&
current
->
IsBrightened
()
)
{
brightBox
.
reset
(
new
BRIGHT_BOX
(
current
)
);
getView
()
->
Add
(
brightBox
.
get
()
);
}
}
return
NULL
;
getView
()
->
MarkTargetDirty
(
TARGET_OVERLAY
);
return
current
;
}
...
...
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