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
172bbc8f
Commit
172bbc8f
authored
May 18, 2013
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eeschema: fix Bug #1180902 (Libedit creates empty svg images)
parent
0f885e7f
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
148 additions
and
19 deletions
+148
-19
class_libentry.cpp
eeschema/class_libentry.cpp
+40
-2
class_libentry.h
eeschema/class_libentry.h
+17
-2
lib_field.cpp
eeschema/lib_field.cpp
+25
-1
libedit_plot_component.cpp
eeschema/libedit_plot_component.cpp
+45
-6
libeditframe.h
eeschema/libeditframe.h
+3
-3
sch_screen.cpp
eeschema/sch_screen.cpp
+12
-5
class_sch_screen.h
include/class_sch_screen.h
+6
-0
No files found.
eeschema/class_libentry.cpp
View file @
172bbc8f
...
@@ -383,18 +383,56 @@ void LIB_COMPONENT::Plot( PLOTTER* aPlotter, int aUnit, int aConvert,
...
@@ -383,18 +383,56 @@ void LIB_COMPONENT::Plot( PLOTTER* aPlotter, int aUnit, int aConvert,
{
{
wxASSERT
(
aPlotter
!=
NULL
);
wxASSERT
(
aPlotter
!=
NULL
);
aPlotter
->
SetColor
(
GetLayerColor
(
LAYER_DEVICE
)
);
bool
fill
=
aPlotter
->
GetColorMode
();
BOOST_FOREACH
(
LIB_ITEM
&
item
,
drawings
)
BOOST_FOREACH
(
LIB_ITEM
&
item
,
drawings
)
{
{
// Lib Fields not are plotted here, because this plot function
// is used to plot schematic items, which have they own fields
if
(
item
.
Type
()
==
LIB_FIELD_T
)
continue
;
if
(
aUnit
&&
item
.
m_Unit
&&
(
item
.
m_Unit
!=
aUnit
)
)
if
(
aUnit
&&
item
.
m_Unit
&&
(
item
.
m_Unit
!=
aUnit
)
)
continue
;
continue
;
if
(
aConvert
&&
item
.
m_Convert
&&
(
item
.
m_Convert
!=
aConvert
)
)
if
(
aConvert
&&
item
.
m_Convert
&&
(
item
.
m_Convert
!=
aConvert
)
)
continue
;
continue
;
aPlotter
->
SetColor
(
GetLayerColor
(
LAYER_DEVICE
)
);
item
.
Plot
(
aPlotter
,
aOffset
,
fill
,
aTransform
);
}
}
void
LIB_COMPONENT
::
PlotLibFields
(
PLOTTER
*
aPlotter
,
int
aUnit
,
int
aConvert
,
const
wxPoint
&
aOffset
,
const
TRANSFORM
&
aTransform
)
{
wxASSERT
(
aPlotter
!=
NULL
);
aPlotter
->
SetColor
(
GetLayerColor
(
LAYER_FIELDS
)
);
bool
fill
=
aPlotter
->
GetColorMode
();
bool
fill
=
aPlotter
->
GetColorMode
();
BOOST_FOREACH
(
LIB_ITEM
&
item
,
drawings
)
{
if
(
item
.
Type
()
!=
LIB_FIELD_T
)
continue
;
if
(
aUnit
&&
item
.
m_Unit
&&
(
item
.
m_Unit
!=
aUnit
)
)
continue
;
if
(
aConvert
&&
item
.
m_Convert
&&
(
item
.
m_Convert
!=
aConvert
)
)
continue
;
// The reference is a special case: we shoud change the basic text
// to add '?' and the part id
LIB_FIELD
&
field
=
(
LIB_FIELD
&
)
item
;
wxString
tmp
=
field
.
GetText
();
if
(
field
.
GetId
()
==
REFERENCE
)
{
wxString
text
=
field
.
GetFullText
(
aUnit
);
field
.
SetText
(
text
);
}
item
.
Plot
(
aPlotter
,
aOffset
,
fill
,
aTransform
);
item
.
Plot
(
aPlotter
,
aOffset
,
fill
,
aTransform
);
field
.
SetText
(
tmp
);
}
}
}
}
...
...
eeschema/class_libentry.h
View file @
172bbc8f
...
@@ -404,7 +404,9 @@ public:
...
@@ -404,7 +404,9 @@ public:
bool
aOnlySelected
=
false
);
bool
aOnlySelected
=
false
);
/**
/**
* Plot component to plotter.
* Plot lib component to plotter.
* Lib Fields not are plotted here, because this plot function
* is used to plot schematic items, which have they own fields
*
*
* @param aPlotter - Plotter object to plot to.
* @param aPlotter - Plotter object to plot to.
* @param aUnit - Component part to plot.
* @param aUnit - Component part to plot.
...
@@ -415,6 +417,19 @@ public:
...
@@ -415,6 +417,19 @@ public:
void
Plot
(
PLOTTER
*
aPlotter
,
int
aUnit
,
int
aConvert
,
const
wxPoint
&
aOffset
,
void
Plot
(
PLOTTER
*
aPlotter
,
int
aUnit
,
int
aConvert
,
const
wxPoint
&
aOffset
,
const
TRANSFORM
&
aTransform
);
const
TRANSFORM
&
aTransform
);
/**
* Plot Lib Fields only of the component to plotter.
* is used to plot the full lib component, outside the schematic
*
* @param aPlotter - Plotter object to plot to.
* @param aUnit - Component part to plot.
* @param aConvert - Component alternate body style to plot.
* @param aOffset - Distance to shift the plot coordinates.
* @param aTransform - Component plot transform matrix.
*/
void
PlotLibFields
(
PLOTTER
*
aPlotter
,
int
aUnit
,
int
aConvert
,
const
wxPoint
&
aOffset
,
const
TRANSFORM
&
aTransform
);
/**
/**
* Add a new draw \a aItem to the draw object list.
* Add a new draw \a aItem to the draw object list.
*
*
...
...
eeschema/lib_field.cpp
View file @
172bbc8f
...
@@ -473,9 +473,33 @@ void LIB_FIELD::Rotate( const wxPoint& center, bool aRotateCCW )
...
@@ -473,9 +473,33 @@ void LIB_FIELD::Rotate( const wxPoint& center, bool aRotateCCW )
}
}
void
LIB_FIELD
::
Plot
(
PLOTTER
*
plotter
,
const
wxPoint
&
offset
,
bool
f
ill
,
void
LIB_FIELD
::
Plot
(
PLOTTER
*
aPlotter
,
const
wxPoint
&
aOffset
,
bool
aF
ill
,
const
TRANSFORM
&
aTransform
)
const
TRANSFORM
&
aTransform
)
{
{
if
(
IsVoid
()
)
return
;
/* Calculate the text orientation, according to the component
* orientation/mirror */
int
orient
=
m_Orient
;
if
(
aTransform
.
y1
)
// Rotate component 90 deg.
{
if
(
orient
==
TEXT_ORIENT_HORIZ
)
orient
=
TEXT_ORIENT_VERT
;
else
orient
=
TEXT_ORIENT_HORIZ
;
}
EDA_RECT
BoundaryBox
=
GetBoundingBox
();
EDA_TEXT_HJUSTIFY_T
hjustify
=
GR_TEXT_HJUSTIFY_CENTER
;
EDA_TEXT_VJUSTIFY_T
vjustify
=
GR_TEXT_VJUSTIFY_CENTER
;
wxPoint
textpos
=
aTransform
.
TransformCoordinate
(
BoundaryBox
.
Centre
()
)
+
aOffset
;
aPlotter
->
Text
(
textpos
,
GetDefaultColor
(),
m_Text
,
orient
,
m_Size
,
hjustify
,
vjustify
,
GetPenSize
(),
m_Italic
,
m_Bold
);
}
}
...
...
eeschema/libedit_plot_component.cpp
View file @
172bbc8f
...
@@ -41,6 +41,8 @@
...
@@ -41,6 +41,8 @@
#include <class_library.h>
#include <class_library.h>
#include <dialogs/dialog_plot_schematic.h>
#include <dialogs/dialog_plot_schematic.h>
#include <boost/foreach.hpp>
void
LIB_EDIT_FRAME
::
OnPlotCurrentComponent
(
wxCommandEvent
&
event
)
void
LIB_EDIT_FRAME
::
OnPlotCurrentComponent
(
wxCommandEvent
&
event
)
{
{
...
@@ -103,7 +105,7 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
...
@@ -103,7 +105,7 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
pageTemp
.
SetHeightMils
(
int
(
componentSize
.
y
*
1.2
)
);
pageTemp
.
SetHeightMils
(
int
(
componentSize
.
y
*
1.2
)
);
GetScreen
()
->
SetPageSettings
(
pageTemp
);
GetScreen
()
->
SetPageSettings
(
pageTemp
);
SVG_P
rint_
Component
(
FullFileName
);
SVG_P
lot
Component
(
FullFileName
);
GetScreen
()
->
SetPageSettings
(
pageSave
);
GetScreen
()
->
SetPageSettings
(
pageSave
);
}
}
break
;
break
;
...
@@ -136,12 +138,49 @@ void LIB_EDIT_FRAME::CreatePNGorJPEGFile( const wxString& aFileName, bool aFmt_j
...
@@ -136,12 +138,49 @@ void LIB_EDIT_FRAME::CreatePNGorJPEGFile( const wxString& aFileName, bool aFmt_j
}
}
void
LIB_EDIT_FRAME
::
SVG_P
rint_Component
(
const
wxString
&
FullFileName
)
void
LIB_EDIT_FRAME
::
SVG_P
lotComponent
(
const
wxString
&
a
FullFileName
)
{
{
bool
plotBW
=
false
;
const
bool
plotBW
=
false
;
bool
plotFrameRef
=
false
;
const
PAGE_INFO
&
pageInfo
=
GetScreen
()
->
GetPageSettings
();
DIALOG_PLOT_SCHEMATIC
::
plotOneSheetSVG
(
this
,
FullFileName
,
GetScreen
(),
plotBW
,
plotFrameRef
);
SVG_PLOTTER
*
plotter
=
new
SVG_PLOTTER
();
plotter
->
SetPageSettings
(
pageInfo
);
plotter
->
SetDefaultLineWidth
(
GetDefaultLineThickness
()
);
plotter
->
SetColorMode
(
plotBW
);
wxPoint
plot_offset
;
const
double
scale
=
1.0
;
plotter
->
SetViewport
(
plot_offset
,
IU_PER_DECIMILS
,
scale
,
false
);
// Init :
plotter
->
SetCreator
(
wxT
(
"Eeschema-SVG"
)
);
if
(
!
plotter
->
OpenFile
(
aFullFileName
)
)
{
delete
plotter
;
return
;
}
LOCALE_IO
toggle
;
plotter
->
StartPlot
();
if
(
m_component
)
{
TRANSFORM
temp
;
// Uses default transform
wxPoint
plotPos
;
plotPos
.
x
=
pageInfo
.
GetWidthIU
()
/
2
;
plotPos
.
y
=
pageInfo
.
GetHeightIU
()
/
2
;
m_component
->
Plot
(
plotter
,
GetUnit
(),
GetConvert
(),
plotPos
,
temp
);
// Plot lib fields, not plotted by m_component->Plot():
m_component
->
PlotLibFields
(
plotter
,
GetUnit
(),
GetConvert
(),
plotPos
,
temp
);
}
plotter
->
EndPlot
();
delete
plotter
;
}
}
void
LIB_EDIT_FRAME
::
PrintPage
(
wxDC
*
aDC
,
LAYER_MSK
aPrintMask
,
bool
aPrintMirrorMode
,
void
*
aData
)
void
LIB_EDIT_FRAME
::
PrintPage
(
wxDC
*
aDC
,
LAYER_MSK
aPrintMask
,
bool
aPrintMirrorMode
,
void
*
aData
)
...
...
eeschema/libeditframe.h
View file @
172bbc8f
...
@@ -641,11 +641,11 @@ public:
...
@@ -641,11 +641,11 @@ public:
bool
aPrintMirrorMode
,
void
*
aData
=
NULL
);
bool
aPrintMirrorMode
,
void
*
aData
=
NULL
);
/**
/**
* Function SVG_P
rint_
Component
* Function SVG_P
lot
Component
* Creates the SVG print file for the current edited component.
* Creates the SVG print file for the current edited component.
* @param aFullFileName = the full filename
of the file
* @param aFullFileName = the full filename
*/
*/
void
SVG_P
rint_
Component
(
const
wxString
&
aFullFileName
);
void
SVG_P
lot
Component
(
const
wxString
&
aFullFileName
);
DECLARE_EVENT_TABLE
()
DECLARE_EVENT_TABLE
()
...
...
eeschema/sch_screen.cpp
View file @
172bbc8f
/*
/*
* This program source code file is part of KiCad, a free EDA CAD application.
* This program source code file is part of KiCad, a free EDA CAD application.
*
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* modify it under the terms of the GNU General Public License
...
@@ -549,9 +551,10 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
...
@@ -549,9 +551,10 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
return
true
;
return
true
;
}
}
// note: SCH_SCREEN::Draw is useful only for schematic.
/* note: SCH_SCREEN::Draw is useful only for schematic.
// library editor and library viewer do not use a draw list, and therefore
* library editor and library viewer do not use a draw list, and therefore
// SCH_SCREEN::Draw draws nothing
* SCH_SCREEN::Draw draws nothing
*/
void
SCH_SCREEN
::
Draw
(
EDA_DRAW_PANEL
*
aCanvas
,
wxDC
*
aDC
,
GR_DRAWMODE
aDrawMode
,
EDA_COLOR_T
aColor
)
void
SCH_SCREEN
::
Draw
(
EDA_DRAW_PANEL
*
aCanvas
,
wxDC
*
aDC
,
GR_DRAWMODE
aDrawMode
,
EDA_COLOR_T
aColor
)
{
{
for
(
SCH_ITEM
*
item
=
m_drawList
.
begin
();
item
!=
NULL
;
item
=
item
->
Next
()
)
for
(
SCH_ITEM
*
item
=
m_drawList
.
begin
();
item
!=
NULL
;
item
=
item
->
Next
()
)
...
@@ -568,6 +571,10 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode
...
@@ -568,6 +571,10 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode
}
}
/* note: SCH_SCREEN::Plot is useful only for schematic.
* library editor and library viewer do not use a draw list, and therefore
* SCH_SCREEN::Plot plots nothing
*/
void
SCH_SCREEN
::
Plot
(
PLOTTER
*
aPlotter
)
void
SCH_SCREEN
::
Plot
(
PLOTTER
*
aPlotter
)
{
{
for
(
SCH_ITEM
*
item
=
m_drawList
.
begin
();
item
;
item
=
item
->
Next
()
)
for
(
SCH_ITEM
*
item
=
m_drawList
.
begin
();
item
;
item
=
item
->
Next
()
)
...
...
include/class_sch_screen.h
View file @
172bbc8f
...
@@ -184,6 +184,9 @@ public:
...
@@ -184,6 +184,9 @@ public:
/**
/**
* Function Draw
* Function Draw
* draws all the items in the screen to \a aCanvas.
* draws all the items in the screen to \a aCanvas.
* note: this function is useful only for schematic.
* library editor and library viewer do not use a draw list, and therefore
* draws nothing
* @param aCanvas The canvas item to draw on.
* @param aCanvas The canvas item to draw on.
* @param aDC The device context to draw on.
* @param aDC The device context to draw on.
* @param aDrawMode The drawing mode.
* @param aDrawMode The drawing mode.
...
@@ -195,6 +198,9 @@ public:
...
@@ -195,6 +198,9 @@ public:
/**
/**
* Function Plot
* Function Plot
* plots all the schematic objects to \a aPlotter.
* plots all the schematic objects to \a aPlotter.
* note: this function is useful only for schematic.
* library editor and library viewer do not use a draw list, and therefore
* plots nothing
*
*
* @param aPlotter The plotter object to plot to.
* @param aPlotter The plotter object to plot to.
*/
*/
...
...
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