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
...
@@ -223,3 +223,15 @@ const BOX2I TEXTE_PCB::ViewBBox() const
return
BOX2I
(
rect
.
GetOrigin
(),
rect
.
GetSize
()
);
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:
...
@@ -121,12 +121,15 @@ public:
EDA_ITEM
*
Clone
()
const
;
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)
#if defined(DEBUG)
virtual
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
const
{
ShowDummy
(
os
);
}
// override
virtual
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
const
{
ShowDummy
(
os
);
}
// override
#endif
#endif
/// @copydoc VIEW_ITEM::ViewBBox()
virtual
const
BOX2I
ViewBBox
()
const
;
};
};
#endif // #define CLASS_PCB_TEXT_H
#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
...
@@ -456,5 +456,8 @@ void TEXTE_MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
break
;
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:
...
@@ -142,7 +142,6 @@ public:
return
wxT
(
"MTEXT"
);
return
wxT
(
"MTEXT"
);
}
}
wxString
GetSelectMenuText
()
const
;
wxString
GetSelectMenuText
()
const
;
BITMAP_DEF
GetMenuImage
()
const
{
return
footprint_text_xpm
;
}
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 )
...
@@ -224,7 +224,7 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
break
;
break
;
case
PCB_TEXT_T
:
case
PCB_TEXT_T
:
draw
(
(
TEXTE_PCB
*
)
aItem
);
draw
(
(
TEXTE_PCB
*
)
aItem
,
aLayer
);
break
;
break
;
case
PCB_MODULE_TEXT_T
:
case
PCB_MODULE_TEXT_T
:
...
@@ -662,65 +662,55 @@ void PCB_PAINTER::draw( const MODULE* aModule )
...
@@ -662,65 +662,55 @@ void PCB_PAINTER::draw( const MODULE* aModule )
{
{
// For modules we have to draw a selection box if needed
// For modules we have to draw a selection box if needed
if
(
aModule
->
IsSelected
()
)
if
(
aModule
->
IsSelected
()
)
{
drawSelectionBox
(
aModule
);
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
()
);
}
}
}
void
PCB_PAINTER
::
draw
(
const
TEXTE_PCB
*
aText
)
void
PCB_PAINTER
::
draw
(
const
TEXTE_PCB
*
aText
,
int
aLayer
)
{
{
if
(
aText
->
GetText
().
Length
()
==
0
)
if
(
aLayer
==
ITEM_GAL_LAYER
(
GP_OVERLAY
)
)
return
;
{
if
(
aText
->
IsSelected
()
)
drawSelectionBox
(
aText
);
}
else
{
if
(
aText
->
GetText
().
Length
()
==
0
)
return
;
COLOR4D
strokeColor
=
GetColor
(
NULL
,
aText
->
GetLayer
()
);
COLOR4D
strokeColor
=
GetColor
(
NULL
,
aText
->
GetLayer
()
);
VECTOR2D
position
(
aText
->
GetTextPosition
().
x
,
aText
->
GetTextPosition
().
y
);
VECTOR2D
position
(
aText
->
GetTextPosition
().
x
,
aText
->
GetTextPosition
().
y
);
double
orientation
=
aText
->
GetOrientation
()
*
M_PI
/
1800.0
;
double
orientation
=
aText
->
GetOrientation
()
*
M_PI
/
1800.0
;
m_gal
->
SetStrokeColor
(
strokeColor
);
m_gal
->
SetStrokeColor
(
strokeColor
);
m_gal
->
SetLineWidth
(
aText
->
GetThickness
()
);
m_gal
->
SetLineWidth
(
aText
->
GetThickness
()
);
m_gal
->
SetTextAttributes
(
aText
);
m_gal
->
SetTextAttributes
(
aText
);
m_gal
->
StrokeText
(
std
::
string
(
aText
->
GetText
().
mb_str
()
),
position
,
orientation
);
m_gal
->
StrokeText
(
std
::
string
(
aText
->
GetText
().
mb_str
()
),
position
,
orientation
);
}
}
}
void
PCB_PAINTER
::
draw
(
const
TEXTE_MODULE
*
aText
,
int
aLayer
)
void
PCB_PAINTER
::
draw
(
const
TEXTE_MODULE
*
aText
,
int
aLayer
)
{
{
if
(
aText
->
GetLength
()
==
0
)
if
(
aLayer
==
ITEM_GAL_LAYER
(
GP_OVERLAY
)
)
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())
{
{
EDA_RECT bb (aText->GetBoundingBox());
if
(
aText
->
IsSelected
()
)
VECTOR2D s (bb.GetOrigin());
drawSelectionBox
(
aText
);
VECTOR2D e (bb.GetEnd());
}
m_gal->SetFillColor( COLOR4D (1.0, 1.0, 1.0, 0.3) );
else
m_gal->SetStrokeColor( COLOR4D (1.0, 1.0, 1.0, 0.5) );
{
m_gal->SetIsFill(true);
if
(
aText
->
GetLength
()
==
0
)
m_gal->SetIsStroke(true);
return
;
m_gal->SetLineWidth(0);
m_gal->DrawRectangle(s, e);
}*/
m_gal
->
AdvanceDepth
();
m_gal
->
SetStrokeColor
(
strokeColor
);
COLOR4D
strokeColor
=
GetColor
(
NULL
,
aLayer
);
m_gal
->
SetLineWidth
(
aText
->
GetThickness
()
);
VECTOR2D
position
(
aText
->
GetTextPosition
().
x
,
aText
->
GetTextPosition
().
y
);
m_gal
->
SetTextAttributes
(
aText
);
double
orientation
=
aText
->
GetDrawRotation
()
*
M_PI
/
1800.0
;
m_gal
->
StrokeText
(
std
::
string
(
aText
->
GetText
().
mb_str
()
),
position
,
orientation
);
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 )
...
@@ -796,7 +786,8 @@ void PCB_PAINTER::draw( const ZONE_CONTAINER* aZone )
void
PCB_PAINTER
::
draw
(
const
DIMENSION
*
aDimension
)
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
->
SetStrokeColor
(
strokeColor
);
m_gal
->
SetIsFill
(
false
);
m_gal
->
SetIsFill
(
false
);
...
@@ -805,15 +796,17 @@ void PCB_PAINTER::draw( const DIMENSION* aDimension )
...
@@ -805,15 +796,17 @@ void PCB_PAINTER::draw( const DIMENSION* aDimension )
// Draw an arrow
// Draw an arrow
m_gal
->
DrawLine
(
VECTOR2D
(
aDimension
->
m_crossBarO
),
VECTOR2D
(
aDimension
->
m_crossBarF
)
);
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_featureLineGO
),
m_gal
->
DrawLine
(
VECTOR2D
(
aDimension
->
m_featureLineDO
),
VECTOR2D
(
aDimension
->
m_featureLineDF
)
);
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_arrowD1O
),
VECTOR2D
(
aDimension
->
m_arrowD1F
)
);
m_gal
->
DrawLine
(
VECTOR2D
(
aDimension
->
m_arrowD2O
),
VECTOR2D
(
aDimension
->
m_arrowD2F
)
);
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_arrowG1O
),
VECTOR2D
(
aDimension
->
m_arrowG1F
)
);
m_gal
->
DrawLine
(
VECTOR2D
(
aDimension
->
m_arrowG2O
),
VECTOR2D
(
aDimension
->
m_arrowG2F
)
);
m_gal
->
DrawLine
(
VECTOR2D
(
aDimension
->
m_arrowG2O
),
VECTOR2D
(
aDimension
->
m_arrowG2F
)
);
// Draw text
// Draw text
draw
(
&
aDimension
->
Text
()
);
draw
(
&
aDimension
->
Text
()
,
layer
);
}
}
...
@@ -853,3 +846,14 @@ void PCB_PAINTER::draw( const PCB_TARGET* aTarget )
...
@@ -853,3 +846,14 @@ void PCB_PAINTER::draw( const PCB_TARGET* aTarget )
m_gal
->
Restore
();
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:
...
@@ -142,11 +142,14 @@ protected:
void
draw
(
const
D_PAD
*
,
int
);
void
draw
(
const
D_PAD
*
,
int
);
void
draw
(
const
DRAWSEGMENT
*
);
void
draw
(
const
DRAWSEGMENT
*
);
void
draw
(
const
MODULE
*
);
void
draw
(
const
MODULE
*
);
void
draw
(
const
TEXTE_PCB
*
);
void
draw
(
const
TEXTE_PCB
*
,
int
);
void
draw
(
const
TEXTE_MODULE
*
,
int
);
void
draw
(
const
TEXTE_MODULE
*
,
int
);
void
draw
(
const
ZONE_CONTAINER
*
);
void
draw
(
const
ZONE_CONTAINER
*
);
void
draw
(
const
DIMENSION
*
);
void
draw
(
const
DIMENSION
*
);
void
draw
(
const
PCB_TARGET
*
);
void
draw
(
const
PCB_TARGET
*
);
/// Draws a white semitransparent box indicating an item as selected
void
drawSelectionBox
(
const
VIEW_ITEM
*
aItem
)
const
;
};
};
}
// namespace KiGfx
}
// namespace KiGfx
...
...
pcbnew/tools/selection_tool.h
View file @
d73d1536
...
@@ -50,8 +50,8 @@ class GENERAL_COLLECTOR;
...
@@ -50,8 +50,8 @@ class GENERAL_COLLECTOR;
class
SELECTION_TOOL
:
public
TOOL_INTERACTIVE
class
SELECTION_TOOL
:
public
TOOL_INTERACTIVE
{
{
public
:
public
:
SELECTION_TOOL
();
SELECTION_TOOL
();
~
SELECTION_TOOL
();
~
SELECTION_TOOL
();
void
Reset
();
void
Reset
();
int
Main
(
TOOL_EVENT
&
aEvent
);
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