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
f4114d22
Commit
f4114d22
authored
Jul 17, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display preferences for showing netnames applies to the GAL backend.
parent
cc901496
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
121 additions
and
62 deletions
+121
-62
dialog_display_options.cpp
pcbnew/dialogs/dialog_display_options.cpp
+16
-1
pcb_painter.cpp
pcbnew/pcb_painter.cpp
+102
-59
pcb_painter.h
pcbnew/pcb_painter.h
+3
-2
No files found.
pcbnew/dialogs/dialog_display_options.cpp
View file @
f4114d22
...
@@ -18,6 +18,10 @@
...
@@ -18,6 +18,10 @@
#include <dialog_display_options.h>
#include <dialog_display_options.h>
#include <dialog_display_options_base.h>
#include <dialog_display_options_base.h>
#include <class_drawpanel_gal.h>
#include <view/view.h>
#include <pcb_painter.h>
void
PCB_EDIT_FRAME
::
InstallDisplayOptionsDialog
(
wxCommandEvent
&
aEvent
)
void
PCB_EDIT_FRAME
::
InstallDisplayOptionsDialog
(
wxCommandEvent
&
aEvent
)
{
{
...
@@ -165,7 +169,18 @@ void DIALOG_DISPLAY_OPTIONS::OnOkClick(wxCommandEvent& event)
...
@@ -165,7 +169,18 @@ void DIALOG_DISPLAY_OPTIONS::OnOkClick(wxCommandEvent& event)
DisplayOpt
.
DisplayDrawItems
=
m_OptDisplayDrawings
->
GetSelection
();
DisplayOpt
.
DisplayDrawItems
=
m_OptDisplayDrawings
->
GetSelection
();
DisplayOpt
.
DisplayNetNamesMode
=
m_ShowNetNamesOption
->
GetSelection
();
DisplayOpt
.
DisplayNetNamesMode
=
m_ShowNetNamesOption
->
GetSelection
();
m_Parent
->
GetCanvas
()
->
Refresh
();
// Apply changes to the GAL
KiGfx
::
VIEW
*
view
=
m_Parent
->
GetGalCanvas
()
->
GetView
();
KiGfx
::
PCB_PAINTER
*
painter
=
static_cast
<
KiGfx
::
PCB_PAINTER
*>
(
view
->
GetPainter
()
);
KiGfx
::
PCB_RENDER_SETTINGS
*
settings
=
static_cast
<
KiGfx
::
PCB_RENDER_SETTINGS
*>
(
painter
->
GetSettings
()
);
settings
->
LoadDisplayOptions
(
DisplayOpt
);
view
->
RecacheAllItems
();
if
(
m_Parent
->
IsGalCanvasActive
()
)
m_Parent
->
GetGalCanvas
()
->
Refresh
();
else
m_Parent
->
GetCanvas
()
->
Refresh
();
EndModal
(
1
);
EndModal
(
1
);
}
}
pcbnew/pcb_painter.cpp
View file @
f4114d22
...
@@ -90,12 +90,36 @@ void PCB_RENDER_SETTINGS::ImportLegacyColors( COLORS_DESIGN_SETTINGS* aSettings
...
@@ -90,12 +90,36 @@ void PCB_RENDER_SETTINGS::ImportLegacyColors( COLORS_DESIGN_SETTINGS* aSettings
void
PCB_RENDER_SETTINGS
::
LoadDisplayOptions
(
const
DISPLAY_OPTIONS
&
aOptions
)
void
PCB_RENDER_SETTINGS
::
LoadDisplayOptions
(
const
DISPLAY_OPTIONS
&
aOptions
)
{
{
m_hiContrastEnabled
=
aOptions
.
ContrastModeDisplay
;
m_hiContrastEnabled
=
aOptions
.
ContrastModeDisplay
;
m_padNumbers
=
aOptions
.
DisplayPadNum
;
// Whether to draw tracks, vias & pads filled or as outlines
// Whether to draw tracks, vias & pads filled or as outlines
m_sketchModeSelect
[
PADS_VISIBLE
]
=
!
aOptions
.
DisplayPadFill
;
m_sketchModeSelect
[
PADS_VISIBLE
]
=
!
aOptions
.
DisplayPadFill
;
m_sketchModeSelect
[
VIAS_VISIBLE
]
=
!
aOptions
.
DisplayViaFill
;
m_sketchModeSelect
[
VIAS_VISIBLE
]
=
!
aOptions
.
DisplayViaFill
;
m_sketchModeSelect
[
TRACKS_VISIBLE
]
=
!
aOptions
.
DisplayPcbTrackFill
;
m_sketchModeSelect
[
TRACKS_VISIBLE
]
=
!
aOptions
.
DisplayPcbTrackFill
;
switch
(
aOptions
.
DisplayNetNamesMode
)
{
case
0
:
m_netNamesOnPads
=
false
;
m_netNamesOnTracks
=
false
;
break
;
case
1
:
m_netNamesOnPads
=
true
;
m_netNamesOnTracks
=
false
;
break
;
case
2
:
m_netNamesOnPads
=
false
;
m_netNamesOnTracks
=
true
;
break
;
case
3
:
m_netNamesOnPads
=
true
;
m_netNamesOnTracks
=
true
;
break
;
}
switch
(
aOptions
.
DisplayZonesMode
)
switch
(
aOptions
.
DisplayZonesMode
)
{
{
case
0
:
case
0
:
...
@@ -264,7 +288,7 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
...
@@ -264,7 +288,7 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
int
netNumber
=
aTrack
->
GetNet
();
int
netNumber
=
aTrack
->
GetNet
();
COLOR4D
color
;
COLOR4D
color
;
if
(
IsNetnameLayer
(
aLayer
)
)
if
(
m_pcbSettings
->
m_netNamesOnTracks
&&
IsNetnameLayer
(
aLayer
)
)
{
{
// If there is a net name - display it on the track
// If there is a net name - display it on the track
if
(
netNumber
!=
0
)
if
(
netNumber
!=
0
)
...
@@ -378,73 +402,92 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
...
@@ -378,73 +402,92 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
// Draw description layer
// Draw description layer
if
(
IsNetnameLayer
(
aLayer
)
)
if
(
IsNetnameLayer
(
aLayer
)
)
{
{
size
=
VECTOR2D
(
aPad
->
GetSize
()
/
2
);
// Is anything that we can display enabled?
double
scale
=
m_gal
->
GetZoomFactor
();
if
(
m_pcbSettings
->
m_netNamesOnPads
||
m_pcbSettings
->
m_padNumbers
)
double
maxSize
=
PCB_RENDER_SETTINGS
::
MAX_FONT_SIZE
/
scale
;
// Font size limits
if
(
size
.
x
>
maxSize
)
size
.
x
=
maxSize
;
if
(
size
.
y
>
maxSize
)
size
.
y
=
maxSize
;
// Keep the size ratio for the font, but make it smaller
if
(
size
.
x
<
size
.
y
)
{
{
orientation
-=
M_PI
/
2
;
bool
displayNetname
=
(
m_pcbSettings
->
m_netNamesOnPads
&&
size
.
y
=
size
.
x
*
4.0
/
3.0
;
!
aPad
->
GetNetname
().
empty
()
);
}
size
=
VECTOR2D
(
aPad
->
GetSize
()
/
2
);
else
if
(
size
.
x
==
size
.
y
)
double
scale
=
m_gal
->
GetZoomFactor
();
{
double
maxSize
=
PCB_RENDER_SETTINGS
::
MAX_FONT_SIZE
/
scale
;
// If the text is displayed on a symmetrical pad, do not rotate it
orientation
=
0.0
;
// Font size limits
}
if
(
size
.
x
>
maxSize
)
else
size
.
x
=
maxSize
;
{
if
(
size
.
y
>
maxSize
)
size
.
x
=
size
.
y
*
3.0
/
4.0
;
size
.
y
=
maxSize
;
}
// Keep the size ratio for the font, but make it smaller
if
(
size
.
x
<
size
.
y
)
{
orientation
-=
M_PI
/
2.0
;
size
.
y
=
size
.
x
*
4.0
/
3.0
;
}
else
if
(
size
.
x
==
size
.
y
)
{
// If the text is displayed on a symmetrical pad, do not rotate it
orientation
=
0.0
;
}
else
{
size
.
x
=
size
.
y
*
3.0
/
4.0
;
}
m_gal
->
Save
();
m_gal
->
Save
();
m_gal
->
Translate
(
position
);
m_gal
->
Translate
(
position
);
m_gal
->
Rotate
(
-
orientation
);
m_gal
->
Rotate
(
-
orientation
);
// Default font settings
// Default font settings
m_gal
->
SetHorizontalJustify
(
GR_TEXT_HJUSTIFY_CENTER
);
m_gal
->
SetHorizontalJustify
(
GR_TEXT_HJUSTIFY_CENTER
);
m_gal
->
SetVerticalJustify
(
GR_TEXT_VJUSTIFY_CENTER
);
m_gal
->
SetVerticalJustify
(
GR_TEXT_VJUSTIFY_CENTER
);
m_gal
->
SetBold
(
false
);
m_gal
->
SetBold
(
false
);
m_gal
->
SetItalic
(
false
);
m_gal
->
SetItalic
(
false
);
m_gal
->
SetMirrored
(
false
);
m_gal
->
SetMirrored
(
false
);
// Set a proper color for the label
// Set a proper color for the label
color
=
getLayerColor
(
aPad
->
GetParent
()
->
GetLayer
(),
aPad
->
GetNet
(),
color
=
getLayerColor
(
aPad
->
GetParent
()
->
GetLayer
(),
aPad
->
GetNet
(),
aPad
->
ViewIsHighlighted
()
);
aPad
->
ViewIsHighlighted
()
);
if
(
color
.
GetBrightness
()
>
0.5
)
if
(
color
.
GetBrightness
()
>
0.5
)
m_gal
->
SetStrokeColor
(
color
.
Darkened
(
0.8
)
);
m_gal
->
SetStrokeColor
(
color
.
Darkened
(
0.8
)
);
else
else
m_gal
->
SetStrokeColor
(
color
.
Highlighted
(
0.8
)
);
m_gal
->
SetStrokeColor
(
color
.
Highlighted
(
0.8
)
);
// Let's make some space for a netname too, if there's one to display
if
(
displayNetname
&&
m_pcbSettings
->
m_padNumbers
)
if
(
!
aPad
->
GetNetname
().
empty
()
)
{
{
// Divide the space, when both pad numbers and netnames are enabled
size
=
size
/
2.0
;
size
=
size
/
2.0
;
m_gal
->
SetGlyphSize
(
size
);
m_gal
->
SetGlyphSize
(
size
);
m_gal
->
SetLineWidth
(
size
.
y
/
10
.0
);
m_gal
->
SetLineWidth
(
size
.
y
/
8
.0
);
m_gal
->
StrokeText
(
std
::
string
(
aPad
->
GetNetname
().
mb_str
()
),
m_gal
->
StrokeText
(
std
::
string
(
aPad
->
GetNetname
().
mb_str
()
),
VECTOR2D
(
0
,
size
.
y
),
0.0
);
VECTOR2D
(
0.0
,
size
.
y
),
0.0
);
m_gal
->
Translate
(
VECTOR2D
(
0.0
,
-
size
.
y
/
2.0
)
);
}
else
{
// In case when there's no netname assigned
m_gal
->
SetGlyphSize
(
size
);
m_gal
->
SetLineWidth
(
size
.
y
/
10.0
);
}
m_gal
->
StrokeText
(
std
::
string
(
aPad
->
GetPadName
().
mb_str
()
),
VECTOR2D
(
0
,
0
),
0.0
);
m_gal
->
StrokeText
(
std
::
string
(
aPad
->
GetPadName
().
mb_str
()
),
VECTOR2D
(
0.0
,
-
size
.
y
/
2.0
),
0.0
);
}
else
{
// There is only one thing to display
if
(
displayNetname
)
{
m_gal
->
SetGlyphSize
(
size
/
2.0
);
m_gal
->
SetLineWidth
(
size
.
y
/
12.0
);
m_gal
->
StrokeText
(
std
::
string
(
aPad
->
GetNetname
().
mb_str
()
),
VECTOR2D
(
0.0
,
0.0
),
0.0
);
}
if
(
m_pcbSettings
->
m_padNumbers
)
{
m_gal
->
SetGlyphSize
(
size
);
m_gal
->
SetLineWidth
(
size
.
y
/
10.0
);
m_gal
->
StrokeText
(
std
::
string
(
aPad
->
GetPadName
().
mb_str
()
),
VECTOR2D
(
0.0
,
0.0
),
0.0
);
}
}
m_gal
->
Restore
();
m_gal
->
Restore
();
}
return
;
return
;
}
}
...
...
pcbnew/pcb_painter.h
View file @
f4114d22
...
@@ -102,8 +102,9 @@ protected:
...
@@ -102,8 +102,9 @@ protected:
COLOR4D
m_itemColorsDark
[
END_PCB_VISIBLE_LIST
];
COLOR4D
m_itemColorsDark
[
END_PCB_VISIBLE_LIST
];
bool
m_sketchModeSelect
[
END_PCB_VISIBLE_LIST
];
bool
m_sketchModeSelect
[
END_PCB_VISIBLE_LIST
];
bool
m_visibleLayers
[
NB_LAYERS
];
bool
m_padNumbers
;
bool
m_visibleItems
[
END_PCB_VISIBLE_LIST
];
bool
m_netNamesOnPads
;
bool
m_netNamesOnTracks
;
static
const
double
MAX_FONT_SIZE
=
100000000
;
static
const
double
MAX_FONT_SIZE
=
100000000
;
...
...
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