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
587f22e1
Commit
587f22e1
authored
Jul 09, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Outline display mode for module edges & texts in the module editor.
parent
3b5ece39
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
165 additions
and
23 deletions
+165
-23
pcb_painter.cpp
pcbnew/pcb_painter.cpp
+49
-10
pcb_painter.h
pcbnew/pcb_painter.h
+1
-7
common_actions.cpp
pcbnew/tools/common_actions.cpp
+14
-2
common_actions.h
pcbnew/tools/common_actions.h
+6
-0
module_tools.cpp
pcbnew/tools/module_tools.cpp
+81
-4
module_tools.h
pcbnew/tools/module_tools.h
+14
-0
No files found.
pcbnew/pcb_painter.cpp
View file @
587f22e1
...
...
@@ -223,7 +223,7 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
case
PCB_LINE_T
:
case
PCB_MODULE_EDGE_T
:
draw
(
(
DRAWSEGMENT
*
)
item
);
draw
(
(
DRAWSEGMENT
*
)
item
,
aLayer
);
break
;
case
PCB_TEXT_T
:
...
...
@@ -325,6 +325,7 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
m_gal
->
SetFillColor
(
color
);
m_gal
->
SetIsFill
(
true
);
}
m_gal
->
DrawSegment
(
start
,
end
,
width
);
}
}
...
...
@@ -622,14 +623,26 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
}
void
PCB_PAINTER
::
draw
(
const
DRAWSEGMENT
*
aSegment
)
void
PCB_PAINTER
::
draw
(
const
DRAWSEGMENT
*
aSegment
,
int
aLayer
)
{
const
COLOR4D
&
color
=
m_pcbSettings
.
GetColor
(
aSegment
,
aSegment
->
GetLayer
()
);
m_gal
->
SetIsFill
(
false
);
m_gal
->
SetIsStroke
(
true
);
m_gal
->
SetStrokeColor
(
color
);
m_gal
->
SetLineWidth
(
aSegment
->
GetWidth
()
);
if
(
m_pcbSettings
.
m_sketchMode
[
aLayer
]
)
{
// Outline mode
m_gal
->
SetLineWidth
(
m_pcbSettings
.
m_outlineWidth
);
m_gal
->
SetIsFill
(
false
);
}
else
{
// Filled mode
m_gal
->
SetLineWidth
(
aSegment
->
GetWidth
()
);
m_gal
->
SetFillColor
(
color
);
m_gal
->
SetIsFill
(
true
);
}
switch
(
aSegment
->
GetShape
()
)
{
...
...
@@ -704,12 +717,25 @@ void PCB_PAINTER::draw( const TEXTE_PCB* aText, int aLayer )
if
(
aText
->
GetText
().
Length
()
==
0
)
return
;
const
COLOR4D
&
strokeC
olor
=
m_pcbSettings
.
GetColor
(
aText
,
aText
->
GetLayer
()
);
const
COLOR4D
&
c
olor
=
m_pcbSettings
.
GetColor
(
aText
,
aText
->
GetLayer
()
);
VECTOR2D
position
(
aText
->
GetTextPosition
().
x
,
aText
->
GetTextPosition
().
y
);
double
orientation
=
aText
->
GetOrientation
()
*
M_PI
/
1800.0
;
m_gal
->
SetStrokeColor
(
strokeColor
);
m_gal
->
SetLineWidth
(
aText
->
GetThickness
()
);
if
(
m_pcbSettings
.
m_sketchMode
[
aLayer
]
)
{
// Outline mode
m_gal
->
SetLineWidth
(
m_pcbSettings
.
m_outlineWidth
);
m_gal
->
SetIsFill
(
false
);
}
else
{
// Filled mode
m_gal
->
SetLineWidth
(
aText
->
GetThickness
()
);
m_gal
->
SetFillColor
(
color
);
m_gal
->
SetIsFill
(
true
);
}
m_gal
->
SetStrokeColor
(
color
);
m_gal
->
SetTextAttributes
(
aText
);
m_gal
->
StrokeText
(
aText
->
GetText
(),
position
,
orientation
);
}
...
...
@@ -720,12 +746,25 @@ void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer )
if
(
aText
->
GetLength
()
==
0
)
return
;
const
COLOR4D
&
strokeC
olor
=
m_pcbSettings
.
GetColor
(
aText
,
aLayer
);
const
COLOR4D
&
c
olor
=
m_pcbSettings
.
GetColor
(
aText
,
aLayer
);
VECTOR2D
position
(
aText
->
GetTextPosition
().
x
,
aText
->
GetTextPosition
().
y
);
double
orientation
=
aText
->
GetDrawRotation
()
*
M_PI
/
1800.0
;
m_gal
->
SetStrokeColor
(
strokeColor
);
m_gal
->
SetLineWidth
(
aText
->
GetThickness
()
);
if
(
m_pcbSettings
.
m_sketchMode
[
aLayer
]
)
{
// Outline mode
m_gal
->
SetLineWidth
(
m_pcbSettings
.
m_outlineWidth
);
m_gal
->
SetIsFill
(
false
);
}
else
{
// Filled mode
m_gal
->
SetLineWidth
(
aText
->
GetThickness
()
);
m_gal
->
SetFillColor
(
color
);
m_gal
->
SetIsFill
(
true
);
}
m_gal
->
SetStrokeColor
(
color
);
m_gal
->
SetTextAttributes
(
aText
);
m_gal
->
StrokeText
(
aText
->
GetText
(),
position
,
orientation
);
}
...
...
pcbnew/pcb_painter.h
View file @
587f22e1
...
...
@@ -124,9 +124,6 @@ public:
*/
inline
void
SetSketchMode
(
int
aItemLayer
,
bool
aEnabled
)
{
// It is supposed to work only with item layers
assert
(
aItemLayer
>=
ITEM_GAL_LAYER
(
0
)
);
m_sketchMode
[
aItemLayer
]
=
aEnabled
;
}
...
...
@@ -137,9 +134,6 @@ public:
*/
inline
bool
GetSketchMode
(
int
aItemLayer
)
const
{
// It is supposed to work only with item layers
assert
(
aItemLayer
>=
ITEM_GAL_LAYER
(
0
)
);
return
m_sketchMode
[
aItemLayer
];
}
...
...
@@ -210,7 +204,7 @@ protected:
void
draw
(
const
TRACK
*
aTrack
,
int
aLayer
);
void
draw
(
const
VIA
*
aVia
,
int
aLayer
);
void
draw
(
const
D_PAD
*
aPad
,
int
aLayer
);
void
draw
(
const
DRAWSEGMENT
*
aSegment
);
void
draw
(
const
DRAWSEGMENT
*
aSegment
,
int
aLayer
);
void
draw
(
const
TEXTE_PCB
*
aText
,
int
aLayer
);
void
draw
(
const
TEXTE_MODULE
*
aText
,
int
aLayer
);
void
draw
(
const
MODULE
*
aModule
);
...
...
pcbnew/tools/common_actions.cpp
View file @
587f22e1
...
...
@@ -284,6 +284,14 @@ TOOL_ACTION COMMON_ACTIONS::pasteItems( "pcbnew.ModuleEditor.pasteItems",
AS_GLOBAL
,
MD_CTRL
+
int
(
'V'
),
"Paste items"
,
"Paste items"
,
AF_ACTIVATE
);
TOOL_ACTION
COMMON_ACTIONS
::
moduleEdgeOutlines
(
"pcbnew.ModuleEditor.graphicOutlines"
,
AS_GLOBAL
,
0
,
""
,
""
);
TOOL_ACTION
COMMON_ACTIONS
::
moduleTextOutlines
(
"pcbnew.ModuleEditor.textOutlines"
,
AS_GLOBAL
,
0
,
""
,
""
);
// Miscellaneous
TOOL_ACTION
COMMON_ACTIONS
::
resetCoords
(
"pcbnew.Control.resetCoords"
,
...
...
@@ -425,14 +433,18 @@ boost::optional<TOOL_EVENT> COMMON_ACTIONS::TranslateLegacyId( int aId )
case
ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY
:
return
COMMON_ACTIONS
::
zoneDisplayOutlines
.
MakeEvent
();
case
ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH
:
return
COMMON_ACTIONS
::
moduleEdgeOutlines
.
MakeEvent
();
case
ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH
:
return
COMMON_ACTIONS
::
moduleTextOutlines
.
MakeEvent
();
case
ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE
:
return
COMMON_ACTIONS
::
highContrastMode
.
MakeEvent
();
case
ID_TB_OPTIONS_SELECT_CURSOR
:
return
COMMON_ACTIONS
::
switchCursor
.
MakeEvent
();
case
ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH
:
case
ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH
:
case
ID_PCB_DELETE_ITEM_BUTT
:
case
ID_PCB_HIGHLIGHT_BUTT
:
case
ID_PCB_SHOW_1_RATSNEST_BUTT
:
...
...
pcbnew/tools/common_actions.h
View file @
587f22e1
...
...
@@ -186,6 +186,12 @@ public:
/// Pasting module items from clipboard
static
TOOL_ACTION
pasteItems
;
/// Display module edges as outlines
static
TOOL_ACTION
moduleEdgeOutlines
;
/// Display module texts as outlines
static
TOOL_ACTION
moduleTextOutlines
;
// Miscellaneous
static
TOOL_ACTION
resetCoords
;
...
...
pcbnew/tools/module_tools.cpp
View file @
587f22e1
...
...
@@ -29,6 +29,7 @@
#include <class_draw_panel_gal.h>
#include <view/view_controls.h>
#include <view/view_group.h>
#include <pcb_painter.h>
#include <kicad_plugin.h>
#include <pcbnew_id.h>
...
...
@@ -531,10 +532,86 @@ int MODULE_TOOLS::PasteItems( TOOL_EVENT& aEvent )
}
int
MODULE_TOOLS
::
ModuleTextOutlines
(
TOOL_EVENT
&
aEvent
)
{
KIGFX
::
PCB_PAINTER
*
painter
=
static_cast
<
KIGFX
::
PCB_PAINTER
*>
(
m_frame
->
GetGalCanvas
()
->
GetView
()
->
GetPainter
()
);
KIGFX
::
PCB_RENDER_SETTINGS
*
settings
=
static_cast
<
KIGFX
::
PCB_RENDER_SETTINGS
*>
(
painter
->
GetSettings
()
);
const
LAYER_NUM
layers
[]
=
{
ITEM_GAL_LAYER
(
MOD_TEXT_BK_VISIBLE
),
ITEM_GAL_LAYER
(
MOD_TEXT_FR_VISIBLE
),
ITEM_GAL_LAYER
(
MOD_TEXT_INVISIBLE
),
ITEM_GAL_LAYER
(
MOD_REFERENCES_VISIBLE
),
ITEM_GAL_LAYER
(
MOD_VALUES_VISIBLE
)
};
bool
enable
=
!
settings
->
GetSketchMode
(
layers
[
0
]
);
BOOST_FOREACH
(
LAYER_NUM
layer
,
layers
)
settings
->
SetSketchMode
(
layer
,
enable
);
for
(
MODULE
*
module
=
getModel
<
BOARD
>
()
->
m_Modules
;
module
;
module
=
module
->
Next
()
)
{
for
(
BOARD_ITEM
*
item
=
module
->
GraphicalItems
();
item
;
item
=
item
->
Next
()
)
{
if
(
item
->
Type
()
==
PCB_MODULE_TEXT_T
)
item
->
ViewUpdate
(
KIGFX
::
VIEW_ITEM
::
GEOMETRY
);
}
module
->
Reference
().
ViewUpdate
(
KIGFX
::
VIEW_ITEM
::
GEOMETRY
);
module
->
Value
().
ViewUpdate
(
KIGFX
::
VIEW_ITEM
::
GEOMETRY
);
}
m_frame
->
GetGalCanvas
()
->
Refresh
();
setTransitions
();
return
0
;
}
int
MODULE_TOOLS
::
ModuleEdgeOutlines
(
TOOL_EVENT
&
aEvent
)
{
KIGFX
::
PCB_PAINTER
*
painter
=
static_cast
<
KIGFX
::
PCB_PAINTER
*>
(
m_frame
->
GetGalCanvas
()
->
GetView
()
->
GetPainter
()
);
KIGFX
::
PCB_RENDER_SETTINGS
*
settings
=
static_cast
<
KIGFX
::
PCB_RENDER_SETTINGS
*>
(
painter
->
GetSettings
()
);
const
LAYER_NUM
layers
[]
=
{
ADHESIVE_N_FRONT
,
ADHESIVE_N_BACK
,
\
SOLDERPASTE_N_FRONT
,
SOLDERPASTE_N_BACK
,
\
SILKSCREEN_N_FRONT
,
SILKSCREEN_N_BACK
,
\
SOLDERMASK_N_FRONT
,
SOLDERMASK_N_BACK
,
\
DRAW_N
,
\
COMMENT_N
,
\
ECO1_N
,
ECO2_N
,
\
EDGE_N
};
bool
enable
=
!
settings
->
GetSketchMode
(
layers
[
0
]
);
BOOST_FOREACH
(
LAYER_NUM
layer
,
layers
)
settings
->
SetSketchMode
(
layer
,
enable
);
for
(
MODULE
*
module
=
getModel
<
BOARD
>
()
->
m_Modules
;
module
;
module
=
module
->
Next
()
)
{
for
(
BOARD_ITEM
*
item
=
module
->
GraphicalItems
();
item
;
item
=
item
->
Next
()
)
{
if
(
item
->
Type
()
==
PCB_MODULE_EDGE_T
)
item
->
ViewUpdate
(
KIGFX
::
VIEW_ITEM
::
GEOMETRY
);
}
}
m_frame
->
GetGalCanvas
()
->
Refresh
();
setTransitions
();
return
0
;
}
void
MODULE_TOOLS
::
setTransitions
()
{
Go
(
&
MODULE_TOOLS
::
PlacePad
,
COMMON_ACTIONS
::
placePad
.
MakeEvent
()
);
Go
(
&
MODULE_TOOLS
::
EnumeratePads
,
COMMON_ACTIONS
::
enumeratePads
.
MakeEvent
()
);
Go
(
&
MODULE_TOOLS
::
CopyItems
,
COMMON_ACTIONS
::
copyItems
.
MakeEvent
()
);
Go
(
&
MODULE_TOOLS
::
PasteItems
,
COMMON_ACTIONS
::
pasteItems
.
MakeEvent
()
);
Go
(
&
MODULE_TOOLS
::
PlacePad
,
COMMON_ACTIONS
::
placePad
.
MakeEvent
()
);
Go
(
&
MODULE_TOOLS
::
EnumeratePads
,
COMMON_ACTIONS
::
enumeratePads
.
MakeEvent
()
);
Go
(
&
MODULE_TOOLS
::
CopyItems
,
COMMON_ACTIONS
::
copyItems
.
MakeEvent
()
);
Go
(
&
MODULE_TOOLS
::
PasteItems
,
COMMON_ACTIONS
::
pasteItems
.
MakeEvent
()
);
Go
(
&
MODULE_TOOLS
::
ModuleTextOutlines
,
COMMON_ACTIONS
::
moduleTextOutlines
.
MakeEvent
()
);
Go
(
&
MODULE_TOOLS
::
ModuleEdgeOutlines
,
COMMON_ACTIONS
::
moduleEdgeOutlines
.
MakeEvent
()
);
}
pcbnew/tools/module_tools.h
View file @
587f22e1
...
...
@@ -77,6 +77,20 @@ public:
*/
int
PasteItems
(
TOOL_EVENT
&
aEvent
);
/**
* Function ModuleTextOutlines()
*
* Toggles display mode for module texts (outline/filled).
*/
int
ModuleTextOutlines
(
TOOL_EVENT
&
aEvent
);
/**
* Function ModuleEdgeOutlines()
*
* Toggles display mode for module edges (outline/filled).
*/
int
ModuleEdgeOutlines
(
TOOL_EVENT
&
aEvent
);
private
:
///> Sets up handlers for various events.
void
setTransitions
();
...
...
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