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
d73d1536
Commit
d73d1536
authored
Aug 09, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added selection boxes for texts.
parent
6af09fed
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
82 additions
and
58 deletions
+82
-58
class_pcb_text.cpp
pcbnew/class_pcb_text.cpp
+12
-0
class_pcb_text.h
pcbnew/class_pcb_text.h
+6
-3
class_text_mod.cpp
pcbnew/class_text_mod.cpp
+4
-1
class_text_mod.h
pcbnew/class_text_mod.h
+0
-1
pcb_painter.cpp
pcbnew/pcb_painter.cpp
+54
-50
pcb_painter.h
pcbnew/pcb_painter.h
+4
-1
selection_tool.h
pcbnew/tools/selection_tool.h
+2
-2
No files found.
pcbnew/class_pcb_text.cpp
View file @
d73d1536
...
...
@@ -223,3 +223,15 @@ const BOX2I TEXTE_PCB::ViewBBox() const
return
BOX2I
(
rect
.
GetOrigin
(),
rect
.
GetSize
()
);
}
}
void
TEXTE_PCB
::
ViewGetLayers
(
int
aLayers
[],
int
&
aCount
)
const
{
// Layer that simply displays the text
aLayers
[
0
]
=
m_Layer
;
// On the general purpose overlay there is a selection box displayed
aLayers
[
1
]
=
ITEM_GAL_LAYER
(
GP_OVERLAY
);
aCount
=
2
;
}
pcbnew/class_pcb_text.h
View file @
d73d1536
...
...
@@ -121,12 +121,15 @@ public:
EDA_ITEM
*
Clone
()
const
;
/// @copydoc VIEW_ITEM::ViewBBox()
virtual
const
BOX2I
ViewBBox
()
const
;
/// @copydoc VIEW_ITEM::ViewGetLayers()
virtual
void
ViewGetLayers
(
int
aLayers
[],
int
&
aCount
)
const
;
#if defined(DEBUG)
virtual
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
const
{
ShowDummy
(
os
);
}
// override
#endif
/// @copydoc VIEW_ITEM::ViewBBox()
virtual
const
BOX2I
ViewBBox
()
const
;
};
#endif // #define CLASS_PCB_TEXT_H
pcbnew/class_text_mod.cpp
View file @
d73d1536
...
...
@@ -456,5 +456,8 @@ void TEXTE_MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
break
;
}
aCount
=
1
;
// On the general purpose overlay there is a selection box displayed
aLayers
[
1
]
=
ITEM_GAL_LAYER
(
GP_OVERLAY
);
aCount
=
2
;
}
pcbnew/class_text_mod.h
View file @
d73d1536
...
...
@@ -142,7 +142,6 @@ public:
return
wxT
(
"MTEXT"
);
}
wxString
GetSelectMenuText
()
const
;
BITMAP_DEF
GetMenuImage
()
const
{
return
footprint_text_xpm
;
}
...
...
pcbnew/pcb_painter.cpp
View file @
d73d1536
...
...
@@ -224,7 +224,7 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
break
;
case
PCB_TEXT_T
:
draw
(
(
TEXTE_PCB
*
)
aItem
);
draw
(
(
TEXTE_PCB
*
)
aItem
,
aLayer
);
break
;
case
PCB_MODULE_TEXT_T
:
...
...
@@ -662,65 +662,55 @@ void PCB_PAINTER::draw( const MODULE* aModule )
{
// For modules we have to draw a selection box if needed
if
(
aModule
->
IsSelected
()
)
{
BOX2I
boundingBox
=
aModule
->
ViewBBox
();
m_gal
->
SetIsStroke
(
false
);
m_gal
->
SetIsFill
(
true
);
m_gal
->
SetFillColor
(
COLOR4D
(
1.0
,
1.0
,
1.0
,
0.5
)
);
m_gal
->
DrawRectangle
(
boundingBox
.
GetOrigin
(),
boundingBox
.
GetEnd
()
);
}
drawSelectionBox
(
aModule
);
}
void
PCB_PAINTER
::
draw
(
const
TEXTE_PCB
*
aText
)
void
PCB_PAINTER
::
draw
(
const
TEXTE_PCB
*
aText
,
int
aLayer
)
{
if
(
aText
->
GetText
().
Length
()
==
0
)
return
;
if
(
aLayer
==
ITEM_GAL_LAYER
(
GP_OVERLAY
)
)
{
if
(
aText
->
IsSelected
()
)
drawSelectionBox
(
aText
);
}
else
{
if
(
aText
->
GetText
().
Length
()
==
0
)
return
;
COLOR4D
strokeColor
=
GetColor
(
NULL
,
aText
->
GetLayer
()
);
VECTOR2D
position
(
aText
->
GetTextPosition
().
x
,
aText
->
GetTextPosition
().
y
);
double
orientation
=
aText
->
GetOrientation
()
*
M_PI
/
1800.0
;
COLOR4D
strokeColor
=
GetColor
(
NULL
,
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
()
);
m_gal
->
SetTextAttributes
(
aText
);
m_gal
->
StrokeText
(
std
::
string
(
aText
->
GetText
().
mb_str
()
),
position
,
orientation
);
m_gal
->
SetStrokeColor
(
strokeColor
);
m_gal
->
SetLineWidth
(
aText
->
GetThickness
()
);
m_gal
->
SetTextAttributes
(
aText
);
m_gal
->
StrokeText
(
std
::
string
(
aText
->
GetText
().
mb_str
()
),
position
,
orientation
);
}
}
void
PCB_PAINTER
::
draw
(
const
TEXTE_MODULE
*
aText
,
int
aLayer
)
{
if
(
aText
->
GetLength
()
==
0
)
return
;
COLOR4D
strokeColor
=
GetColor
(
NULL
,
aLayer
);
VECTOR2D
position
(
aText
->
GetTextPosition
().
x
,
aText
->
GetTextPosition
().
y
);
double
orientation
=
aText
->
GetDrawRotation
()
*
M_PI
/
1800.0
;
m_gal
->
PushDepth
();
/*if(aText->IsSelected())
if
(
aLayer
==
ITEM_GAL_LAYER
(
GP_OVERLAY
)
)
{
EDA_RECT bb (aText->GetBoundingBox());
VECTOR2D s (bb.GetOrigin());
VECTOR2D e (bb.GetEnd());
m_gal->SetFillColor( COLOR4D (1.0, 1.0, 1.0, 0.3) );
m_gal->SetStrokeColor( COLOR4D (1.0, 1.0, 1.0, 0.5) );
m_gal->SetIsFill(true);
m_gal->SetIsStroke(true);
m_gal->SetLineWidth(0);
m_gal->DrawRectangle(s, e);
}*/
m_gal
->
AdvanceDepth
();
if
(
aText
->
IsSelected
()
)
drawSelectionBox
(
aText
);
}
else
{
if
(
aText
->
GetLength
()
==
0
)
return
;
m_gal
->
SetStrokeColor
(
strokeColor
);
m_gal
->
SetLineWidth
(
aText
->
GetThickness
()
);
m_gal
->
SetTextAttributes
(
aText
);
m_gal
->
StrokeText
(
std
::
string
(
aText
->
GetText
().
mb_str
()
),
position
,
orientation
);
COLOR4D
strokeColor
=
GetColor
(
NULL
,
aLayer
);
VECTOR2D
position
(
aText
->
GetTextPosition
().
x
,
aText
->
GetTextPosition
().
y
);
double
orientation
=
aText
->
GetDrawRotation
()
*
M_PI
/
1800.0
;
m_gal
->
PopDepth
();
m_gal
->
SetStrokeColor
(
strokeColor
);
m_gal
->
SetLineWidth
(
aText
->
GetThickness
()
);
m_gal
->
SetTextAttributes
(
aText
);
m_gal
->
StrokeText
(
std
::
string
(
aText
->
GetText
().
mb_str
()
),
position
,
orientation
);
}
}
...
...
@@ -796,7 +786,8 @@ void PCB_PAINTER::draw( const ZONE_CONTAINER* aZone )
void
PCB_PAINTER
::
draw
(
const
DIMENSION
*
aDimension
)
{
COLOR4D
strokeColor
=
GetColor
(
NULL
,
aDimension
->
GetLayer
()
);
int
layer
=
aDimension
->
GetLayer
();
COLOR4D
strokeColor
=
GetColor
(
NULL
,
layer
);
m_gal
->
SetStrokeColor
(
strokeColor
);
m_gal
->
SetIsFill
(
false
);
...
...
@@ -805,15 +796,17 @@ void PCB_PAINTER::draw( const DIMENSION* aDimension )
// Draw an arrow
m_gal
->
DrawLine
(
VECTOR2D
(
aDimension
->
m_crossBarO
),
VECTOR2D
(
aDimension
->
m_crossBarF
)
);
m_gal
->
DrawLine
(
VECTOR2D
(
aDimension
->
m_featureLineGO
),
VECTOR2D
(
aDimension
->
m_featureLineGF
)
);
m_gal
->
DrawLine
(
VECTOR2D
(
aDimension
->
m_featureLineDO
),
VECTOR2D
(
aDimension
->
m_featureLineDF
)
);
m_gal
->
DrawLine
(
VECTOR2D
(
aDimension
->
m_featureLineGO
),
VECTOR2D
(
aDimension
->
m_featureLineGF
)
);
m_gal
->
DrawLine
(
VECTOR2D
(
aDimension
->
m_featureLineDO
),
VECTOR2D
(
aDimension
->
m_featureLineDF
)
);
m_gal
->
DrawLine
(
VECTOR2D
(
aDimension
->
m_arrowD1O
),
VECTOR2D
(
aDimension
->
m_arrowD1F
)
);
m_gal
->
DrawLine
(
VECTOR2D
(
aDimension
->
m_arrowD2O
),
VECTOR2D
(
aDimension
->
m_arrowD2F
)
);
m_gal
->
DrawLine
(
VECTOR2D
(
aDimension
->
m_arrowG1O
),
VECTOR2D
(
aDimension
->
m_arrowG1F
)
);
m_gal
->
DrawLine
(
VECTOR2D
(
aDimension
->
m_arrowG2O
),
VECTOR2D
(
aDimension
->
m_arrowG2F
)
);
// Draw text
draw
(
&
aDimension
->
Text
()
);
draw
(
&
aDimension
->
Text
()
,
layer
);
}
...
...
@@ -853,3 +846,14 @@ void PCB_PAINTER::draw( const PCB_TARGET* aTarget )
m_gal
->
Restore
();
}
void
PCB_PAINTER
::
drawSelectionBox
(
const
VIEW_ITEM
*
aItem
)
const
{
BOX2I
boundingBox
=
aItem
->
ViewBBox
();
m_gal
->
SetIsStroke
(
false
);
m_gal
->
SetIsFill
(
true
);
m_gal
->
SetFillColor
(
COLOR4D
(
1.0
,
1.0
,
1.0
,
0.5
)
);
m_gal
->
DrawRectangle
(
boundingBox
.
GetOrigin
(),
boundingBox
.
GetEnd
()
);
}
pcbnew/pcb_painter.h
View file @
d73d1536
...
...
@@ -142,11 +142,14 @@ protected:
void
draw
(
const
D_PAD
*
,
int
);
void
draw
(
const
DRAWSEGMENT
*
);
void
draw
(
const
MODULE
*
);
void
draw
(
const
TEXTE_PCB
*
);
void
draw
(
const
TEXTE_PCB
*
,
int
);
void
draw
(
const
TEXTE_MODULE
*
,
int
);
void
draw
(
const
ZONE_CONTAINER
*
);
void
draw
(
const
DIMENSION
*
);
void
draw
(
const
PCB_TARGET
*
);
/// Draws a white semitransparent box indicating an item as selected
void
drawSelectionBox
(
const
VIEW_ITEM
*
aItem
)
const
;
};
}
// namespace KiGfx
...
...
pcbnew/tools/selection_tool.h
View file @
d73d1536
...
...
@@ -50,8 +50,8 @@ class GENERAL_COLLECTOR;
class
SELECTION_TOOL
:
public
TOOL_INTERACTIVE
{
public
:
SELECTION_TOOL
();
~
SELECTION_TOOL
();
SELECTION_TOOL
();
~
SELECTION_TOOL
();
void
Reset
();
int
Main
(
TOOL_EVENT
&
aEvent
);
...
...
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