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
69816d87
Commit
69816d87
authored
May 21, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The GAL view uses colors settings from the legacy canvas.
Minor refactoring of PAINTER & RENDER_SETTINGS classes.
parent
07877f90
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
101 additions
and
101 deletions
+101
-101
class_colors_design_settings.cpp
common/class_colors_design_settings.cpp
+3
-2
painter.cpp
common/painter.cpp
+0
-6
class_colors_design_settings.h
include/class_colors_design_settings.h
+3
-3
painter.h
include/painter.h
+20
-26
basepcbframe.cpp
pcbnew/basepcbframe.cpp
+0
-13
class_pcb_layer_widget.cpp
pcbnew/class_pcb_layer_widget.cpp
+8
-0
pcb_painter.cpp
pcbnew/pcb_painter.cpp
+34
-33
pcb_painter.h
pcbnew/pcb_painter.h
+19
-17
pcbframe.cpp
pcbnew/pcbframe.cpp
+14
-1
No files found.
common/class_colors_design_settings.cpp
View file @
69816d87
...
...
@@ -100,12 +100,13 @@ void COLORS_DESIGN_SETTINGS::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor
* @return the color for an item which is one of the item indices given
* in pcbstruct.h, enum PCB_VISIBLE or in schematic
*/
EDA_COLOR_T
COLORS_DESIGN_SETTINGS
::
GetItemColor
(
int
aItemIdx
)
EDA_COLOR_T
COLORS_DESIGN_SETTINGS
::
GetItemColor
(
int
aItemIdx
)
const
{
if
(
(
unsigned
)
aItemIdx
<
DIM
(
m_ItemsColors
)
)
if
(
(
unsigned
)
aItemIdx
<
DIM
(
m_ItemsColors
)
)
{
return
m_ItemsColors
[
aItemIdx
];
}
return
UNSPECIFIED_COLOR
;
}
...
...
common/painter.cpp
View file @
69816d87
...
...
@@ -73,9 +73,3 @@ PAINTER::PAINTER( GAL* aGal ) :
PAINTER
::~
PAINTER
()
{
}
void
PAINTER
::
SetGAL
(
GAL
*
aGal
)
{
m_gal
=
aGal
;
}
include/class_colors_design_settings.h
View file @
69816d87
...
...
@@ -26,7 +26,7 @@ public:
EDA_COLOR_T
m_ItemsColors
[
ITEMSCOLORSBUFFERSIZE
];
///< All others items but layers
public
:
COLORS_DESIGN_SETTINGS
(
);
COLORS_DESIGN_SETTINGS
();
/**
* Function GetLayerColor
...
...
@@ -47,14 +47,14 @@ public:
* @return the color for an item which is one of the item indices given
* in pcbstruct.h, enum PCB_VISIBLE or in schematic
*/
EDA_COLOR_T
GetItemColor
(
int
aItemIdx
);
EDA_COLOR_T
GetItemColor
(
int
aItemIdx
)
const
;
/**
* Function SetItemColor
* sets the color for an item which is one of the item indices given
* in pcbstruct.h, enum PCB_VISIBLE or in schematic
*/
void
SetItemColor
(
int
aItemIdx
,
EDA_COLOR_T
aColor
);
void
SetItemColor
(
int
aItemIdx
,
EDA_COLOR_T
aColor
);
/**
* Function SetAllColorsAs
...
...
include/painter.h
View file @
69816d87
...
...
@@ -64,7 +64,7 @@ public:
* Loads a list of color settings for layers.
* @param aSettings is a list of color settings.
*/
virtual
void
ImportLegacyColors
(
COLORS_DESIGN_SETTINGS
*
aSettings
)
=
0
;
virtual
void
ImportLegacyColors
(
const
COLORS_DESIGN_SETTINGS
*
aSettings
)
=
0
;
/**
* Function SetActiveLayer
...
...
@@ -114,7 +114,7 @@ public:
* Returns current highlight setting.
* @return True if highlight is enabled, false otherwise.
*/
bool
GetHighlight
()
const
inline
bool
GetHighlight
()
const
{
return
m_highlightEnabled
;
}
...
...
@@ -124,7 +124,7 @@ public:
* Returns netcode of currently highlighted net.
* @return Netcode of currently highlighted net.
*/
int
GetHighlightNetCode
()
const
in
line
in
t
GetHighlightNetCode
()
const
{
return
m_highlightNetcode
;
}
...
...
@@ -182,7 +182,7 @@ public:
* Returns the color responding to the one of EDA_COLOR_T enum values.
* @param EDA_COLOR_T color equivalent.
*/
const
COLOR4D
&
TranslateColor
(
EDA_COLOR_T
aColor
)
inline
const
COLOR4D
&
TranslateColor
(
EDA_COLOR_T
aColor
)
{
return
m_legacyColorMap
[
aColor
];
}
...
...
@@ -192,7 +192,7 @@ public:
* Returns current background color settings.
* @return Background color.
*/
const
COLOR4D
&
GetBackgroundColor
()
const
inline
const
COLOR4D
&
GetBackgroundColor
()
const
{
return
m_backgroundColor
;
}
...
...
@@ -202,7 +202,7 @@ public:
* Sets new color for background.
* @param aColor is the new background color.
*/
void
SetBackgroundColor
(
const
COLOR4D
&
aColor
)
inline
void
SetBackgroundColor
(
const
COLOR4D
&
aColor
)
{
m_backgroundColor
=
aColor
;
}
...
...
@@ -210,12 +210,12 @@ public:
protected
:
/**
* Function update
* Precalculates extra colors for layers (eg. highlighted, darkened and any needed version
* Precalculates extra colors for layers (e
.
g. highlighted, darkened and any needed version
* of base colors).
*/
virtual
void
update
();
std
::
set
<
unsigned
int
>
m_activeLayers
;
/// Stores active layers number
std
::
set
<
unsigned
int
>
m_activeLayers
;
///
<
Stores active layers number
/// Parameters for display modes
bool
m_hiContrastEnabled
;
///< High contrast display mode on/off
...
...
@@ -268,31 +268,28 @@ public:
virtual
~
PAINTER
();
/**
* Function
ApplySettings
*
Loads colors and display modes settings that are going to be used when drawing items
.
* @param a
Settings are settings to be applied
.
* Function
SetGAL
*
Changes Graphics Abstraction Layer used for drawing items for a new one
.
* @param a
Gal is the new GAL instance
.
*/
v
irtual
void
ApplySettings
(
RENDER_SETTINGS
*
aSettings
)
v
oid
SetGAL
(
GAL
*
aGal
)
{
m_
settings
.
reset
(
aSettings
)
;
m_
gal
=
aGal
;
}
/**
* Function
SetGAL
*
Changes Graphics Abstraction Layer used for drawing items for a new one
.
* @param a
Gal is the new GAL instance
.
* Function
ApplySettings
*
Loads colors and display modes settings that are going to be used when drawing items
.
* @param a
Settings are settings to be applied
.
*/
v
oid
SetGAL
(
GAL
*
aGal
)
;
v
irtual
void
ApplySettings
(
const
RENDER_SETTINGS
*
aSettings
)
=
0
;
/**
* Function GetSettings
* Returns pointer to current settings that are going to be used when drawing items.
* @return Current rendering settings.
*/
virtual
RENDER_SETTINGS
*
GetSettings
()
const
{
return
m_settings
.
get
();
}
virtual
RENDER_SETTINGS
*
GetSettings
()
=
0
;
/**
* Function Draw
...
...
@@ -307,13 +304,10 @@ public:
protected
:
/// Instance of graphic abstraction layer that gives an interface to call
/// commands used to draw (eg. DrawLine, DrawCircle, etc.)
GAL
*
m_gal
;
/// Colors and display modes settings that are going to be used when drawing items.
boost
::
shared_ptr
<
RENDER_SETTINGS
>
m_settings
;
GAL
*
m_gal
;
/// Color of brightened item frame
COLOR4D
m_brightenedColor
;
COLOR4D
m_brightenedColor
;
};
}
// namespace KIGFX
...
...
pcbnew/basepcbframe.cpp
View file @
69816d87
...
...
@@ -855,19 +855,6 @@ void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
view
->
SetLayerTarget
(
ITEM_GAL_LAYER
(
GP_OVERLAY
),
KIGFX
::
TARGET_OVERLAY
);
view
->
SetLayerTarget
(
ITEM_GAL_LAYER
(
RATSNEST_VISIBLE
),
KIGFX
::
TARGET_OVERLAY
);
// Apply layer coloring scheme & display options
if
(
view
->
GetPainter
()
)
{
KIGFX
::
PCB_RENDER_SETTINGS
*
settings
=
new
KIGFX
::
PCB_RENDER_SETTINGS
();
// Load layers' colors from PCB data
settings
->
ImportLegacyColors
(
m_Pcb
->
GetColorsSettings
()
);
view
->
GetPainter
()
->
ApplySettings
(
settings
);
// Load display options (such as filled/outline display of items)
settings
->
LoadDisplayOptions
(
DisplayOpt
);
}
// WxWidgets 2.9.1 seems call setlocale( LC_NUMERIC, "" )
// when reading doubles in config,
// but forget to back to current locale. So we call SetLocaleTo_Default
...
...
pcbnew/class_pcb_layer_widget.cpp
View file @
69816d87
...
...
@@ -348,6 +348,14 @@ void PCB_LAYER_WIDGET::OnLayerColorChange( LAYER_NUM aLayer, EDA_COLOR_T aColor
{
myframe
->
GetBoard
()
->
SetLayerColor
(
aLayer
,
aColor
);
myframe
->
ReCreateLayerBox
(
false
);
if
(
myframe
->
IsGalCanvasActive
()
)
{
KIGFX
::
VIEW
*
view
=
myframe
->
GetGalCanvas
()
->
GetView
();
view
->
GetPainter
()
->
GetSettings
()
->
ImportLegacyColors
(
myframe
->
GetBoard
()
->
GetColorsSettings
()
);
view
->
UpdateLayerColor
(
aLayer
);
}
myframe
->
GetCanvas
()
->
Refresh
();
}
...
...
pcbnew/pcb_painter.cpp
View file @
69816d87
...
...
@@ -44,6 +44,10 @@ using namespace KIGFX;
PCB_RENDER_SETTINGS
::
PCB_RENDER_SETTINGS
()
{
m_backgroundColor
=
COLOR4D
(
0.0
,
0.0
,
0.0
,
1.0
);
m_padNumbers
=
true
;
m_netNamesOnPads
=
true
;
m_netNamesOnTracks
=
true
;
m_displayZoneMode
=
DZ_SHOW_FILLED
;
// By default everything should be displayed as filled
for
(
unsigned
int
i
=
0
;
i
<
END_PCB_VISIBLE_LIST
;
++
i
)
...
...
@@ -55,7 +59,7 @@ PCB_RENDER_SETTINGS::PCB_RENDER_SETTINGS()
}
void
PCB_RENDER_SETTINGS
::
ImportLegacyColors
(
COLORS_DESIGN_SETTINGS
*
aSettings
)
void
PCB_RENDER_SETTINGS
::
ImportLegacyColors
(
const
COLORS_DESIGN_SETTINGS
*
aSettings
)
{
for
(
int
i
=
0
;
i
<
NB_LAYERS
;
i
++
)
{
...
...
@@ -82,7 +86,6 @@ void PCB_RENDER_SETTINGS::ImportLegacyColors( COLORS_DESIGN_SETTINGS* aSettings
// Netnames for copper layers
for
(
LAYER_NUM
layer
=
FIRST_COPPER_LAYER
;
layer
<=
LAST_COPPER_LAYER
;
++
layer
)
{
// Quick, dirty hack, netnames layers should be stored in usual layers
m_layerColors
[
GetNetnameLayer
(
layer
)]
=
COLOR4D
(
0.8
,
0.8
,
0.8
,
0.7
);
}
...
...
@@ -192,8 +195,6 @@ void PCB_RENDER_SETTINGS::update()
PCB_PAINTER
::
PCB_PAINTER
(
GAL
*
aGal
)
:
PAINTER
(
aGal
)
{
m_settings
.
reset
(
new
PCB_RENDER_SETTINGS
()
);
m_pcbSettings
=
(
PCB_RENDER_SETTINGS
*
)
m_settings
.
get
();
}
...
...
@@ -260,7 +261,7 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
VECTOR2D
end
(
aTrack
->
GetEnd
()
);
int
width
=
aTrack
->
GetWidth
();
if
(
m_pcbSettings
->
m_netNamesOnTracks
&&
IsNetnameLayer
(
aLayer
)
)
if
(
m_pcbSettings
.
m_netNamesOnTracks
&&
IsNetnameLayer
(
aLayer
)
)
{
// If there is a net name - display it on the track
if
(
aTrack
->
GetNetCode
()
>
NETINFO_LIST
::
UNCONNECTED
)
...
...
@@ -278,8 +279,8 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
double
textSize
=
std
::
min
(
static_cast
<
double
>
(
width
),
length
/
netName
.
length
()
);
// Set a proper color for the label
const
COLOR4D
&
color
=
m_pcbSettings
->
GetColor
(
aTrack
,
aTrack
->
GetLayer
()
);
COLOR4D
labelColor
=
m_pcbSettings
->
GetColor
(
NULL
,
aLayer
);
const
COLOR4D
&
color
=
m_pcbSettings
.
GetColor
(
aTrack
,
aTrack
->
GetLayer
()
);
COLOR4D
labelColor
=
m_pcbSettings
.
GetColor
(
NULL
,
aLayer
);
if
(
color
.
GetBrightness
()
>
0.5
)
m_gal
->
SetStrokeColor
(
labelColor
.
Inverted
()
);
...
...
@@ -299,14 +300,14 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
else
if
(
IsCopperLayer
(
aLayer
)
)
{
// Draw a regular track
const
COLOR4D
&
color
=
m_pcbSettings
->
GetColor
(
aTrack
,
aLayer
);
const
COLOR4D
&
color
=
m_pcbSettings
.
GetColor
(
aTrack
,
aLayer
);
m_gal
->
SetStrokeColor
(
color
);
m_gal
->
SetIsStroke
(
true
);
if
(
m_pcbSettings
->
m_sketchMode
[
TRACKS_VISIBLE
]
)
if
(
m_pcbSettings
.
m_sketchMode
[
TRACKS_VISIBLE
]
)
{
// Outline mode
m_gal
->
SetLineWidth
(
m_pcbSettings
->
m_outlineWidth
);
m_gal
->
SetLineWidth
(
m_pcbSettings
.
m_outlineWidth
);
m_gal
->
SetIsFill
(
false
);
}
else
...
...
@@ -337,14 +338,14 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer )
else
return
;
const
COLOR4D
&
color
=
m_pcbSettings
->
GetColor
(
aVia
,
aLayer
);
const
COLOR4D
&
color
=
m_pcbSettings
.
GetColor
(
aVia
,
aLayer
);
if
(
m_pcbSettings
->
m_sketchMode
[
VIA_THROUGH_VISIBLE
]
)
if
(
m_pcbSettings
.
m_sketchMode
[
VIA_THROUGH_VISIBLE
]
)
{
// Outline mode
m_gal
->
SetIsFill
(
false
);
m_gal
->
SetIsStroke
(
true
);
m_gal
->
SetLineWidth
(
m_pcbSettings
->
m_outlineWidth
);
m_gal
->
SetLineWidth
(
m_pcbSettings
.
m_outlineWidth
);
m_gal
->
SetStrokeColor
(
color
);
m_gal
->
DrawCircle
(
center
,
radius
);
}
...
...
@@ -372,12 +373,12 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
if
(
IsNetnameLayer
(
aLayer
)
)
{
// Is anything that we can display enabled?
if
(
m_pcbSettings
->
m_netNamesOnPads
||
m_pcbSettings
->
m_padNumbers
)
if
(
m_pcbSettings
.
m_netNamesOnPads
||
m_pcbSettings
.
m_padNumbers
)
{
// Min char count to calculate string size
const
int
MIN_CHAR_COUNT
=
3
;
bool
displayNetname
=
(
m_pcbSettings
->
m_netNamesOnPads
&&
bool
displayNetname
=
(
m_pcbSettings
.
m_netNamesOnPads
&&
!
aPad
->
GetNetname
().
empty
()
);
VECTOR2D
padsize
=
VECTOR2D
(
aPad
->
GetSize
()
);
double
maxSize
=
PCB_RENDER_SETTINGS
::
MAX_FONT_SIZE
;
...
...
@@ -415,8 +416,8 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
m_gal
->
SetMirrored
(
false
);
// Set a proper color for the label
const
COLOR4D
&
color
=
m_pcbSettings
->
GetColor
(
aPad
,
aPad
->
GetLayer
()
);
COLOR4D
labelColor
=
m_pcbSettings
->
GetColor
(
NULL
,
aLayer
);
const
COLOR4D
&
color
=
m_pcbSettings
.
GetColor
(
aPad
,
aPad
->
GetLayer
()
);
COLOR4D
labelColor
=
m_pcbSettings
.
GetColor
(
NULL
,
aLayer
);
if
(
color
.
GetBrightness
()
>
0.5
)
m_gal
->
SetStrokeColor
(
labelColor
.
Inverted
()
);
...
...
@@ -427,7 +428,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
// Divide the space, to display both pad numbers and netnames
// and set the Y text position to display 2 lines
if
(
displayNetname
&&
m_pcbSettings
->
m_padNumbers
)
if
(
displayNetname
&&
m_pcbSettings
.
m_padNumbers
)
{
size
=
size
/
2.0
;
textpos
.
y
=
size
/
2.0
;
...
...
@@ -446,7 +447,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
m_gal
->
StrokeText
(
aPad
->
GetShortNetname
(),
textpos
,
0.0
);
}
if
(
m_pcbSettings
->
m_padNumbers
)
if
(
m_pcbSettings
.
m_padNumbers
)
{
textpos
.
y
=
-
textpos
.
y
;
aPad
->
StringPadName
(
buffer
);
...
...
@@ -469,13 +470,13 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
}
// Pad drawing
const
COLOR4D
&
color
=
m_pcbSettings
->
GetColor
(
aPad
,
aLayer
);
if
(
m_pcbSettings
->
m_sketchMode
[
PADS_VISIBLE
]
)
const
COLOR4D
&
color
=
m_pcbSettings
.
GetColor
(
aPad
,
aLayer
);
if
(
m_pcbSettings
.
m_sketchMode
[
PADS_VISIBLE
]
)
{
// Outline mode
m_gal
->
SetIsFill
(
false
);
m_gal
->
SetIsStroke
(
true
);
m_gal
->
SetLineWidth
(
m_pcbSettings
->
m_outlineWidth
);
m_gal
->
SetLineWidth
(
m_pcbSettings
.
m_outlineWidth
);
m_gal
->
SetStrokeColor
(
color
);
}
else
...
...
@@ -533,7 +534,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
m
=
(
size
.
y
-
size
.
x
);
n
=
size
.
x
;
if
(
m_pcbSettings
->
m_sketchMode
[
PADS_VISIBLE
]
)
if
(
m_pcbSettings
.
m_sketchMode
[
PADS_VISIBLE
]
)
{
// Outline mode
m_gal
->
DrawArc
(
VECTOR2D
(
0
,
-
m
),
n
,
-
M_PI
,
0
);
...
...
@@ -554,7 +555,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
m
=
(
size
.
x
-
size
.
y
);
n
=
size
.
y
;
if
(
m_pcbSettings
->
m_sketchMode
[
PADS_VISIBLE
]
)
if
(
m_pcbSettings
.
m_sketchMode
[
PADS_VISIBLE
]
)
{
// Outline mode
m_gal
->
DrawArc
(
VECTOR2D
(
-
m
,
0
),
n
,
M_PI
/
2
,
3
*
M_PI
/
2
);
...
...
@@ -590,7 +591,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
pointList
.
push_back
(
VECTOR2D
(
corners
[
2
]
)
);
pointList
.
push_back
(
VECTOR2D
(
corners
[
3
]
)
);
if
(
m_pcbSettings
->
m_sketchMode
[
PADS_VISIBLE
]
)
if
(
m_pcbSettings
.
m_sketchMode
[
PADS_VISIBLE
]
)
{
// Add the beginning point to close the outline
pointList
.
push_back
(
pointList
.
front
()
);
...
...
@@ -614,7 +615,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
void
PCB_PAINTER
::
draw
(
const
DRAWSEGMENT
*
aSegment
)
{
const
COLOR4D
&
color
=
m_pcbSettings
->
GetColor
(
aSegment
,
aSegment
->
GetLayer
()
);
const
COLOR4D
&
color
=
m_pcbSettings
.
GetColor
(
aSegment
,
aSegment
->
GetLayer
()
);
m_gal
->
SetIsFill
(
false
);
m_gal
->
SetIsStroke
(
true
);
...
...
@@ -694,7 +695,7 @@ void PCB_PAINTER::draw( const TEXTE_PCB* aText, int aLayer )
if
(
aText
->
GetText
().
Length
()
==
0
)
return
;
const
COLOR4D
&
strokeColor
=
m_pcbSettings
->
GetColor
(
aText
,
aText
->
GetLayer
()
);
const
COLOR4D
&
strokeColor
=
m_pcbSettings
.
GetColor
(
aText
,
aText
->
GetLayer
()
);
VECTOR2D
position
(
aText
->
GetTextPosition
().
x
,
aText
->
GetTextPosition
().
y
);
double
orientation
=
aText
->
GetOrientation
()
*
M_PI
/
1800.0
;
...
...
@@ -710,7 +711,7 @@ void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer )
if
(
aText
->
GetLength
()
==
0
)
return
;
const
COLOR4D
&
strokeColor
=
m_pcbSettings
->
GetColor
(
aText
,
aLayer
);
const
COLOR4D
&
strokeColor
=
m_pcbSettings
.
GetColor
(
aText
,
aLayer
);
VECTOR2D
position
(
aText
->
GetTextPosition
().
x
,
aText
->
GetTextPosition
().
y
);
double
orientation
=
aText
->
GetDrawRotation
()
*
M_PI
/
1800.0
;
...
...
@@ -723,15 +724,15 @@ void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer )
void
PCB_PAINTER
::
draw
(
const
ZONE_CONTAINER
*
aZone
)
{
const
COLOR4D
&
color
=
m_pcbSettings
->
GetColor
(
aZone
,
aZone
->
GetLayer
()
);
const
COLOR4D
&
color
=
m_pcbSettings
.
GetColor
(
aZone
,
aZone
->
GetLayer
()
);
std
::
deque
<
VECTOR2D
>
corners
;
PCB_RENDER_SETTINGS
::
DisplayZonesMode
displayMode
=
m_pcbSettings
->
m_displayZoneMode
;
PCB_RENDER_SETTINGS
::
DisplayZonesMode
displayMode
=
m_pcbSettings
.
m_displayZoneMode
;
// Draw the outline
m_gal
->
SetStrokeColor
(
color
);
m_gal
->
SetIsFill
(
false
);
m_gal
->
SetIsStroke
(
true
);
m_gal
->
SetLineWidth
(
m_pcbSettings
->
m_outlineWidth
);
m_gal
->
SetLineWidth
(
m_pcbSettings
.
m_outlineWidth
);
const
CPolyLine
*
outline
=
aZone
->
Outline
();
for
(
int
i
=
0
;
i
<
outline
->
GetCornersCount
();
++
i
)
...
...
@@ -796,7 +797,7 @@ void PCB_PAINTER::draw( const ZONE_CONTAINER* aZone )
void
PCB_PAINTER
::
draw
(
const
DIMENSION
*
aDimension
,
int
aLayer
)
{
const
COLOR4D
&
strokeColor
=
m_pcbSettings
->
GetColor
(
aDimension
,
aLayer
);
const
COLOR4D
&
strokeColor
=
m_pcbSettings
.
GetColor
(
aDimension
,
aLayer
);
m_gal
->
SetStrokeColor
(
strokeColor
);
m_gal
->
SetIsFill
(
false
);
...
...
@@ -827,7 +828,7 @@ void PCB_PAINTER::draw( const DIMENSION* aDimension, int aLayer )
void
PCB_PAINTER
::
draw
(
const
PCB_TARGET
*
aTarget
)
{
const
COLOR4D
&
strokeColor
=
m_pcbSettings
->
GetColor
(
aTarget
,
aTarget
->
GetLayer
()
);
const
COLOR4D
&
strokeColor
=
m_pcbSettings
.
GetColor
(
aTarget
,
aTarget
->
GetLayer
()
);
VECTOR2D
position
(
aTarget
->
GetPosition
()
);
double
size
,
radius
;
...
...
pcbnew/pcb_painter.h
View file @
69816d87
...
...
@@ -79,7 +79,7 @@ public:
PCB_RENDER_SETTINGS
();
/// @copydoc RENDER_SETTINGS::ImportLegacyColors()
void
ImportLegacyColors
(
COLORS_DESIGN_SETTINGS
*
aSettings
);
void
ImportLegacyColors
(
const
COLORS_DESIGN_SETTINGS
*
aSettings
);
/**
* Function LoadDisplayOptions
...
...
@@ -97,7 +97,7 @@ public:
* Returns the color used to draw a layer.
* @param aLayer is the layer number.
*/
const
COLOR4D
&
GetLayerColor
(
int
aLayer
)
const
inline
const
COLOR4D
&
GetLayerColor
(
int
aLayer
)
const
{
return
m_layerColors
[
aLayer
];
}
...
...
@@ -108,7 +108,7 @@ public:
* @param aLayer is the layer number.
* @param aColor is the new color.
*/
void
SetLayerColor
(
int
aLayer
,
const
COLOR4D
&
aColor
)
inline
void
SetLayerColor
(
int
aLayer
,
const
COLOR4D
&
aColor
)
{
m_layerColors
[
aLayer
]
=
aColor
;
...
...
@@ -122,7 +122,7 @@ public:
* @param aEnabled decides if it is drawn in sketch mode (true for sketched mode,
* false for filled mode).
*/
void
SetSketchMode
(
int
aItemLayer
,
bool
aEnabled
)
inline
void
SetSketchMode
(
int
aItemLayer
,
bool
aEnabled
)
{
// It is supposed to work only with item layers
assert
(
aItemLayer
>=
ITEM_GAL_LAYER
(
0
)
);
...
...
@@ -135,7 +135,7 @@ public:
* Returns sketch mode setting for a given item layer.
* @param aItemLayer is the item layer that is changed.
*/
bool
GetSketchMode
(
int
aItemLayer
)
const
inline
bool
GetSketchMode
(
int
aItemLayer
)
const
{
// It is supposed to work only with item layers
assert
(
aItemLayer
>=
ITEM_GAL_LAYER
(
0
)
);
...
...
@@ -148,13 +148,13 @@ protected:
void
update
();
///> Colors for all layers (normal)
COLOR4D
m_layerColors
[
TOTAL_LAYER_COUNT
];
COLOR4D
m_layerColors
[
TOTAL_LAYER_COUNT
];
///> Colors for all layers (highlighted)
COLOR4D
m_layerColorsHi
[
TOTAL_LAYER_COUNT
];
COLOR4D
m_layerColorsHi
[
TOTAL_LAYER_COUNT
];
///> Colors for all layers (selected)
COLOR4D
m_layerColorsSel
[
TOTAL_LAYER_COUNT
];
COLOR4D
m_layerColorsSel
[
TOTAL_LAYER_COUNT
];
///> Colors for all layers (darkened)
COLOR4D
m_layerColorsDark
[
TOTAL_LAYER_COUNT
];
...
...
@@ -188,21 +188,23 @@ class PCB_PAINTER : public PAINTER
public
:
PCB_PAINTER
(
GAL
*
aGal
);
/// @copydoc PAINTER::Draw()
virtual
bool
Draw
(
const
VIEW_ITEM
*
,
int
);
/// @copydoc PAINTER::ApplySettings()
virtual
void
ApplySettings
(
RENDER_SETTINGS
*
aSettings
)
virtual
void
ApplySettings
(
const
RENDER_SETTINGS
*
aSettings
)
{
PAINTER
::
ApplySettings
(
aSettings
);
m_pcbSettings
=
*
static_cast
<
const
PCB_RENDER_SETTINGS
*>
(
aSettings
);
}
// Store PCB specific render settings
m_pcbSettings
=
(
PCB_RENDER_SETTINGS
*
)
m_settings
.
get
();
/// @copydoc PAINTER::GetSettings()
virtual
RENDER_SETTINGS
*
GetSettings
()
{
return
&
m_pcbSettings
;
}
/// @copydoc PAINTER::Draw()
virtual
bool
Draw
(
const
VIEW_ITEM
*
aItem
,
int
aLayer
);
protected
:
/// Just a properly casted pointer to settings
PCB_RENDER_SETTINGS
*
m_pcbSettings
;
PCB_RENDER_SETTINGS
m_pcbSettings
;
// Drawing functions for various types of PCB-specific items
void
draw
(
const
TRACK
*
aTrack
,
int
aLayer
);
...
...
pcbnew/pcbframe.cpp
View file @
69816d87
...
...
@@ -58,7 +58,7 @@
#include <convert_from_iu.h>
#include <view/view.h>
#include <view/view_controls.h>
#include <painter.h>
#include <p
cb_p
ainter.h>
#include <class_track.h>
#include <class_board.h>
...
...
@@ -548,6 +548,19 @@ void PCB_EDIT_FRAME::ViewReloadBoard( const BOARD* aBoard ) const
view
->
Add
(
aBoard
->
GetRatsnestViewItem
()
);
aBoard
->
GetRatsnest
()
->
Recalculate
();
// Apply layer coloring scheme & display options
if
(
view
->
GetPainter
()
)
{
KIGFX
::
PCB_RENDER_SETTINGS
*
settings
=
static_cast
<
KIGFX
::
PCB_RENDER_SETTINGS
*>
(
view
->
GetPainter
()
->
GetSettings
()
);
// Load layers' colors from PCB data
settings
->
ImportLegacyColors
(
m_Pcb
->
GetColorsSettings
()
);
// Load display options (such as filled/outline display of items)
settings
->
LoadDisplayOptions
(
DisplayOpt
);
}
// Limit panning to the size of worksheet frame
GetGalCanvas
()
->
GetViewControls
()
->
SetPanBoundary
(
aBoard
->
GetWorksheetViewItem
()
->
ViewBBox
()
);
view
->
RecacheAllItems
(
true
);
...
...
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