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
402f3c6f
Commit
402f3c6f
authored
Aug 08, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added brightened mode for selecting items using disambiguation menu.
parent
cc5c0383
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
33 deletions
+68
-33
painter.cpp
common/painter.cpp
+24
-3
view.cpp
common/view/view.cpp
+9
-4
base_struct.h
include/base_struct.h
+3
-3
painter.h
include/painter.h
+21
-15
selection_tool.cpp
pcbnew/tools/selection_tool.cpp
+11
-8
No files found.
common/painter.cpp
View file @
402f3c6f
...
@@ -25,14 +25,13 @@
...
@@ -25,14 +25,13 @@
*/
*/
#include <painter.h>
#include <painter.h>
#include <gal/graphics_abstraction_layer.h>
using
namespace
KiGfx
;
using
namespace
KiGfx
;
RENDER_SETTINGS
::
RENDER_SETTINGS
()
RENDER_SETTINGS
::
RENDER_SETTINGS
()
{
{
// Set the default initial values
// Set the default initial values
m_selectionBorderColor
=
COLOR4D
(
1.0
,
1.0
,
1.0
,
1.0
);
m_highlightFactor
=
0.5
;
m_highlightFactor
=
0.5
;
m_selectFactor
=
0.5
;
m_selectFactor
=
0.5
;
m_layerOpacity
=
0.8
;
m_layerOpacity
=
0.8
;
...
@@ -65,7 +64,7 @@ void RENDER_SETTINGS::update()
...
@@ -65,7 +64,7 @@ void RENDER_SETTINGS::update()
PAINTER
::
PAINTER
(
GAL
*
aGal
)
:
PAINTER
::
PAINTER
(
GAL
*
aGal
)
:
m_gal
(
aGal
),
m_settings
(
NULL
)
m_gal
(
aGal
),
m_settings
(
NULL
)
,
m_brightenedColor
(
0.0
,
1.0
,
0.0
,
0.9
)
{
{
}
}
...
@@ -80,3 +79,25 @@ void PAINTER::SetGAL( GAL* aGal )
...
@@ -80,3 +79,25 @@ void PAINTER::SetGAL( GAL* aGal )
{
{
m_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 semitransparent box 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 @
402f3c6f
...
@@ -509,16 +509,21 @@ struct VIEW::drawItem
...
@@ -509,16 +509,21 @@ struct VIEW::drawItem
{
{
group
=
gal
->
BeginGroup
();
group
=
gal
->
BeginGroup
();
aItem
->
setGroup
(
currentLayer
->
id
,
group
);
aItem
->
setGroup
(
currentLayer
->
id
,
group
);
if
(
!
view
->
m_painter
->
Draw
(
aItem
,
currentLayer
->
id
)
)
if
(
!
view
->
m_painter
->
Draw
(
aItem
,
currentLayer
->
id
)
)
aItem
->
ViewDraw
(
currentLayer
->
id
,
gal
,
BOX2I
());
aItem
->
ViewDraw
(
currentLayer
->
id
,
gal
,
BOX2I
()
);
// Alternative drawing method
gal
->
EndGroup
();
gal
->
EndGroup
();
}
}
}
}
else
else
{
{
// Immediate mode
// Immediate mode
if
(
!
view
->
m_painter
->
Draw
(
aItem
,
currentLayer
->
id
))
if
(
!
view
->
m_painter
->
Draw
(
aItem
,
currentLayer
->
id
)
)
aItem
->
ViewDraw
(
currentLayer
->
id
,
gal
,
BOX2I
());
aItem
->
ViewDraw
(
currentLayer
->
id
,
gal
,
BOX2I
()
);
// Alternative drawing method
}
if
(
static_cast
<
const
EDA_ITEM
*>
(
aItem
)
->
IsBrightened
()
)
{
view
->
m_painter
->
DrawBrightened
(
aItem
);
}
}
}
}
...
...
include/base_struct.h
View file @
402f3c6f
...
@@ -472,13 +472,13 @@ public:
...
@@ -472,13 +472,13 @@ public:
inline
bool
IsHighlighted
()
const
{
return
m_Flags
&
HIGHLIGHTED
;
}
inline
bool
IsHighlighted
()
const
{
return
m_Flags
&
HIGHLIGHTED
;
}
inline
bool
IsBrightened
()
const
{
return
m_Flags
&
BRIGHTENED
;
}
inline
bool
IsBrightened
()
const
{
return
m_Flags
&
BRIGHTENED
;
}
inline
void
SetBrightened
()
{
SetFlags
(
BRIGHTENED
);
ViewUpdate
(
APPEARANCE
);
}
inline
void
SetSelected
()
{
SetFlags
(
SELECTED
);
ViewUpdate
(
APPEARANCE
);
}
inline
void
SetSelected
()
{
SetFlags
(
SELECTED
);
ViewUpdate
(
APPEARANCE
);
}
inline
void
SetHighlighted
()
{
SetFlags
(
HIGHLIGHTED
);
ViewUpdate
(
APPEARANCE
|
GEOMETRY
);
}
inline
void
SetHighlighted
()
{
SetFlags
(
HIGHLIGHTED
);
ViewUpdate
(
APPEARANCE
);
}
inline
void
SetBrightened
()
{
SetFlags
(
BRIGHTENED
);
ViewUpdate
(
APPEARANCE
);
}
inline
void
ClearSelected
()
{
ClearFlags
(
SELECTED
);
ViewUpdate
(
APPEARANCE
);
}
inline
void
ClearSelected
()
{
ClearFlags
(
SELECTED
);
ViewUpdate
(
APPEARANCE
);
}
inline
void
ClearHighlighted
()
{
ClearFlags
(
HIGHLIGHTED
);
ViewUpdate
(
APPEARANCE
);
}
inline
void
ClearHighlighted
()
{
ClearFlags
(
HIGHLIGHTED
);
ViewUpdate
(
APPEARANCE
);
}
inline
void
ClearBrightened
()
{
ClearFlags
(
BRIGHTENED
);
ViewUpdate
(
APPEARANCE
|
GEOMETRY
);
}
inline
void
ClearBrightened
()
{
ClearFlags
(
BRIGHTENED
);
ViewUpdate
(
APPEARANCE
);
}
void
SetModified
();
void
SetModified
();
...
...
include/painter.h
View file @
402f3c6f
...
@@ -55,7 +55,6 @@ class VIEW_ITEM;
...
@@ -55,7 +55,6 @@ class VIEW_ITEM;
class
RENDER_SETTINGS
class
RENDER_SETTINGS
{
{
public
:
public
:
RENDER_SETTINGS
();
RENDER_SETTINGS
();
virtual
~
RENDER_SETTINGS
();
virtual
~
RENDER_SETTINGS
();
...
@@ -125,21 +124,19 @@ protected:
...
@@ -125,21 +124,19 @@ protected:
std
::
set
<
unsigned
int
>
m_activeLayers
;
/// Stores active layers number
std
::
set
<
unsigned
int
>
m_activeLayers
;
/// Stores active layers number
/// Parameters for display modes
/// Parameters for display modes
bool
m_hiContrastEnabled
;
/// High contrast display mode on/off
bool
m_hiContrastEnabled
;
///< High contrast display mode on/off
COLOR4D
m_hiContrastColor
;
/// Color used for high contrast display mode
COLOR4D
m_hiContrastColor
;
///< Color used for high contrast display mode
float
m_hiContrastFactor
;
/// Factor used for computing high contrast color
float
m_hiContrastFactor
;
///< Factor used for computing high contrast color
bool
m_highlightEnabled
;
/// Highlight display mode on/off
int
m_highlightNetcode
;
/// Net number that is displayed in highlight
/// -1 means that there is no specific net, and whole active
/// layer is highlighted
float
m_highlightFactor
;
/// Factor used for computing hightlight color
COLOR4D
m_selectionBorderColor
;
/// Color of selection box border
bool
m_highlightEnabled
;
///< Highlight display mode on/off
int
m_highlightNetcode
;
///< Net number that is displayed in highlight
///< -1 means that there is no specific net, and whole active
///< layer is highlighted
float
m_highlightFactor
;
///< Factor used for computing hightlight color
float
m_selectFactor
;
/// Specifies how color of selected items is changed
float
m_selectFactor
;
///
<
Specifies how color of selected items is changed
float
m_layerOpacity
;
/// Determines opacity of all layers
float
m_layerOpacity
;
///
<
Determines opacity of all layers
float
m_outlineWidth
;
/// Line width used when drawing outlines
float
m_outlineWidth
;
///
<
Line width used when drawing outlines
/// Map of colors that were usually used for display
/// Map of colors that were usually used for display
std
::
map
<
EDA_COLOR_T
,
COLOR4D
>
m_legacyColorMap
;
std
::
map
<
EDA_COLOR_T
,
COLOR4D
>
m_legacyColorMap
;
...
@@ -161,7 +158,6 @@ protected:
...
@@ -161,7 +158,6 @@ protected:
class
PAINTER
class
PAINTER
{
{
public
:
public
:
/*
/*
* Constructor PAINTER( GAL* )
* Constructor PAINTER( GAL* )
* initializes this object for painting on any of the polymorphic
* initializes this object for painting on any of the polymorphic
...
@@ -214,6 +210,13 @@ public:
...
@@ -214,6 +210,13 @@ public:
*/
*/
virtual
bool
Draw
(
const
VIEW_ITEM
*
aItem
,
int
aLayer
)
=
0
;
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
);
/**
/**
* Function GetColor
* Function GetColor
* Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer
* Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer
...
@@ -231,6 +234,9 @@ protected:
...
@@ -231,6 +234,9 @@ protected:
/// Colors and display modes settings that are going to be used when drawing items.
/// Colors and display modes settings that are going to be used when drawing items.
RENDER_SETTINGS
*
m_settings
;
RENDER_SETTINGS
*
m_settings
;
/// Color of brightened item frame
COLOR4D
m_brightenedColor
;
};
};
}
// namespace KiGfx
}
// namespace KiGfx
...
...
pcbnew/tools/selection_tool.cpp
View file @
402f3c6f
...
@@ -89,10 +89,12 @@ void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem, bool aAdditive )
...
@@ -89,10 +89,12 @@ void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem, bool aAdditive )
{
{
aItem
->
ClearSelected
();
aItem
->
ClearSelected
();
m_selectedItems
.
erase
(
aItem
);
m_selectedItems
.
erase
(
aItem
);
}
else
}
else
{
{
if
(
!
aAdditive
)
if
(
!
aAdditive
)
clearSelection
();
clearSelection
();
aItem
->
SetSelected
();
aItem
->
SetSelected
();
m_selectedItems
.
insert
(
aItem
);
m_selectedItems
.
insert
(
aItem
);
}
}
...
@@ -237,19 +239,20 @@ BOARD_ITEM* SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR *aCollector )
...
@@ -237,19 +239,20 @@ BOARD_ITEM* SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR *aCollector )
if
(
evt
->
Action
()
==
TA_ContextMenuUpdate
)
if
(
evt
->
Action
()
==
TA_ContextMenuUpdate
)
{
{
if
(
current
)
if
(
current
)
current
->
Clear
Select
ed
();
current
->
Clear
Brighten
ed
();
int
id
=
*
evt
->
GetCommandId
();
int
id
=
*
evt
->
GetCommandId
();
if
(
id
>=
0
)
if
(
id
>=
0
)
{
{
current
=
(
*
aCollector
)[
id
];
current
=
(
*
aCollector
)[
id
];
current
->
SetSelected
();
current
->
SetBrightened
();
}
else
}
else
current
=
NULL
;
current
=
NULL
;
}
}
else
if
(
evt
->
Action
()
==
TA_ContextMenuChoice
)
else
if
(
evt
->
Action
()
==
TA_ContextMenuChoice
)
{
{
optional
<
int
>
id
=
evt
->
GetCommandId
();
optional
<
int
>
id
=
evt
->
GetCommandId
();
if
(
current
)
if
(
current
)
...
@@ -261,9 +264,9 @@ BOARD_ITEM* SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR *aCollector )
...
@@ -261,9 +264,9 @@ BOARD_ITEM* SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR *aCollector )
current
->
SetSelected
();
current
->
SetSelected
();
return
current
;
return
current
;
}
}
return
NULL
;
return
NULL
;
}
}
}
}
return
NULL
;
return
NULL
;
...
...
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