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
0d459865
Commit
0d459865
authored
Dec 22, 2011
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename Ki_PageDescr to PAGE_INFO, encapsulate it in accessors, and move it into the BOARD
parent
0e27f45f
Changes
49
Hide whitespace changes
Inline
Side-by-side
Showing
49 changed files
with
964 additions
and
747 deletions
+964
-747
base_screen.cpp
common/base_screen.cpp
+29
-48
class_plotter.cpp
common/class_plotter.cpp
+5
-6
common.cpp
common/common.cpp
+125
-30
common_plotPS_functions.cpp
common/common_plotPS_functions.cpp
+11
-9
common_plot_functions.cpp
common/common_plot_functions.cpp
+32
-29
dialog_page_settings.cpp
common/dialogs/dialog_page_settings.cpp
+64
-70
dialog_page_settings.h
common/dialogs/dialog_page_settings.h
+7
-7
drawframe.cpp
common/drawframe.cpp
+3
-4
drawpanel.cpp
common/drawpanel.cpp
+29
-27
worksheet.cpp
common/worksheet.cpp
+107
-83
dialog_SVG_print.h
eeschema/dialogs/dialog_SVG_print.h
+0
-1
dialog_build_BOM.cpp
eeschema/dialogs/dialog_build_BOM.cpp
+16
-16
dialog_plot_schematic_DXF.cpp
eeschema/dialogs/dialog_plot_schematic_DXF.cpp
+3
-3
dialog_plot_schematic_HPGL.cpp
eeschema/dialogs/dialog_plot_schematic_HPGL.cpp
+6
-6
dialog_plot_schematic_PS.cpp
eeschema/dialogs/dialog_plot_schematic_PS.cpp
+4
-4
load_one_schematic_file.cpp
eeschema/load_one_schematic_file.cpp
+2
-2
sch_screen.cpp
eeschema/sch_screen.cpp
+22
-6
gerbview.cpp
gerbview/gerbview.cpp
+1
-1
gerbview.h
gerbview/gerbview.h
+1
-3
gerbview_frame.cpp
gerbview/gerbview_frame.cpp
+12
-14
initpcb.cpp
gerbview/initpcb.cpp
+1
-0
class_base_screen.h
include/class_base_screen.h
+20
-37
class_pcb_screen.h
include/class_pcb_screen.h
+6
-7
class_sch_screen.h
include/class_sch_screen.h
+19
-8
common.h
include/common.h
+94
-29
plot_common.h
include/plot_common.h
+4
-6
wxBasePcbFrame.h
include/wxBasePcbFrame.h
+4
-0
wxstruct.h
include/wxstruct.h
+16
-6
basepcbframe.cpp
pcbnew/basepcbframe.cpp
+32
-6
class_board.h
pcbnew/class_board.h
+7
-8
class_pad.cpp
pcbnew/class_pad.cpp
+2
-5
class_track.h
pcbnew/class_track.h
+2
-2
classpcb.cpp
pcbnew/classpcb.cpp
+10
-15
dialog_SVG_print.cpp
pcbnew/dialogs/dialog_SVG_print.cpp
+16
-15
dialog_gendrill.h
pcbnew/dialogs/dialog_gendrill.h
+2
-1
gen_drill_report_files.cpp
pcbnew/gen_drill_report_files.cpp
+34
-36
gendrill.cpp
pcbnew/gendrill.cpp
+1
-1
gendrill.h
pcbnew/gendrill.h
+1
-1
initpcb.cpp
pcbnew/initpcb.cpp
+13
-12
io_mgr.h
pcbnew/io_mgr.h
+2
-0
ioascii.cpp
pcbnew/ioascii.cpp
+40
-30
kicad_plugin.cpp
pcbnew/kicad_plugin.cpp
+51
-37
minimun_spanning_tree.h
pcbnew/minimun_spanning_tree.h
+1
-1
plotdxf.cpp
pcbnew/plotdxf.cpp
+2
-6
plothpgl.cpp
pcbnew/plothpgl.cpp
+27
-30
plotps.cpp
pcbnew/plotps.cpp
+36
-33
print_board_functions.cpp
pcbnew/print_board_functions.cpp
+12
-17
printout_controler.cpp
pcbnew/printout_controler.cpp
+28
-27
printout_controler.h
pcbnew/printout_controler.h
+2
-2
No files found.
common/base_screen.cpp
View file @
0d459865
...
@@ -40,7 +40,6 @@
...
@@ -40,7 +40,6 @@
BASE_SCREEN
::
BASE_SCREEN
(
KICAD_T
aType
)
:
EDA_ITEM
(
aType
)
BASE_SCREEN
::
BASE_SCREEN
(
KICAD_T
aType
)
:
EDA_ITEM
(
aType
)
{
{
m_drawList
=
NULL
;
/* Draw items list */
m_UndoRedoCountMax
=
10
;
/* undo/Redo command Max depth, 10 is a reasonable value */
m_UndoRedoCountMax
=
10
;
/* undo/Redo command Max depth, 10 is a reasonable value */
m_FirstRedraw
=
true
;
m_FirstRedraw
=
true
;
m_ScreenNumber
=
1
;
m_ScreenNumber
=
1
;
...
@@ -49,12 +48,9 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_ITEM( aType )
...
@@ -49,12 +48,9 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_ITEM( aType )
m_Grid
.
m_Size
=
wxRealPoint
(
50
,
50
);
/* Default grid size */
m_Grid
.
m_Size
=
wxRealPoint
(
50
,
50
);
/* Default grid size */
m_Grid
.
m_Id
=
ID_POPUP_GRID_LEVEL_50
;
m_Grid
.
m_Id
=
ID_POPUP_GRID_LEVEL_50
;
m_Center
=
true
;
m_Center
=
true
;
m_CurrentSheetDesc
=
&
g_Sheet_A4
;
m_IsPrinting
=
false
;
m_IsPrinting
=
false
;
m_ScrollPixelsPerUnitX
=
1
;
m_ScrollPixelsPerUnitX
=
1
;
m_ScrollPixelsPerUnitY
=
1
;
m_ScrollPixelsPerUnitY
=
1
;
InitDatas
();
}
}
...
@@ -63,26 +59,49 @@ BASE_SCREEN::~BASE_SCREEN()
...
@@ -63,26 +59,49 @@ BASE_SCREEN::~BASE_SCREEN()
}
}
void
BASE_SCREEN
::
InitDatas
()
/*
wxSize BASE_SCREEN::ReturnPageSize( void )
{
int internal_units = GetInternalUnits();
wxSize size = m_CurrentSheetDesc->m_Size;
size.x = (int)( (double)size.x * internal_units / 1000 );
size.y = (int)( (double)size.y * internal_units / 1000 );
return size;
}
void BASE_SCREEN::SetPageSize( wxSize& aPageSize )
{
int internal_units = GetInternalUnits();
m_CurrentSheetDesc->m_Size.x = (int) ((double)aPageSize.x * 1000 / internal_units);
m_CurrentSheetDesc->m_Size.y = (int) ((double)aPageSize.y * 1000 / internal_units);
}
*/
void
BASE_SCREEN
::
InitDataPoints
(
const
wxSize
&
aPageSizeInternalUnits
)
{
{
if
(
m_Center
)
if
(
m_Center
)
{
{
m_crossHairPosition
.
x
=
m_crossHairPosition
.
y
=
0
;
m_crossHairPosition
.
x
=
m_crossHairPosition
.
y
=
0
;
m_DrawOrg
.
x
=
-
ReturnPageSize
().
x
/
2
;
m_DrawOrg
.
y
=
-
ReturnPageSize
().
y
/
2
;
m_DrawOrg
.
x
=
-
aPageSizeInternalUnits
.
x
/
2
;
m_DrawOrg
.
y
=
-
aPageSizeInternalUnits
.
y
/
2
;
}
}
else
else
{
{
m_DrawOrg
.
x
=
m_DrawOrg
.
y
=
0
;
m_DrawOrg
.
x
=
m_DrawOrg
.
y
=
0
;
m_crossHairPosition
.
x
=
ReturnPageSize
().
x
/
2
;
m_crossHairPosition
.
y
=
ReturnPageSize
().
y
/
2
;
m_crossHairPosition
.
x
=
aPageSizeInternalUnits
.
x
/
2
;
m_crossHairPosition
.
y
=
aPageSizeInternalUnits
.
y
/
2
;
}
}
m_O_Curseur
.
x
=
m_O_Curseur
.
y
=
0
;
m_O_Curseur
.
x
=
m_O_Curseur
.
y
=
0
;
SetCurItem
(
NULL
);
SetCurItem
(
NULL
);
m_FlagModified
=
false
;
// Set when any change is made on b
roa
d.
m_FlagModified
=
false
;
// Set when any change is made on b
oar
d.
m_FlagSave
=
false
;
// Used in auto save set when an auto save is required.
m_FlagSave
=
false
;
// Used in auto save set when an auto save is required.
}
}
...
@@ -93,25 +112,6 @@ int BASE_SCREEN::GetInternalUnits( void )
...
@@ -93,25 +112,6 @@ int BASE_SCREEN::GetInternalUnits( void )
}
}
wxSize
BASE_SCREEN
::
ReturnPageSize
(
void
)
{
int
internal_units
=
GetInternalUnits
();
wxSize
size
=
m_CurrentSheetDesc
->
m_Size
;
size
.
x
=
(
int
)(
(
double
)
size
.
x
*
internal_units
/
1000
);
size
.
y
=
(
int
)(
(
double
)
size
.
y
*
internal_units
/
1000
);
return
size
;
}
void
BASE_SCREEN
::
SetPageSize
(
wxSize
&
aPageSize
)
{
int
internal_units
=
GetInternalUnits
();
m_CurrentSheetDesc
->
m_Size
.
x
=
(
int
)
((
double
)
aPageSize
.
x
*
1000
/
internal_units
);
m_CurrentSheetDesc
->
m_Size
.
y
=
(
int
)
((
double
)
aPageSize
.
y
*
1000
/
internal_units
);
}
double
BASE_SCREEN
::
GetScalingFactor
()
const
double
BASE_SCREEN
::
GetScalingFactor
()
const
{
{
double
scale
=
1.0
/
GetZoom
();
double
scale
=
1.0
/
GetZoom
();
...
@@ -513,22 +513,3 @@ void BASE_SCREEN::InsertItem( EDA_ITEMS::iterator aIter, EDA_ITEM* aItem )
...
@@ -513,22 +513,3 @@ void BASE_SCREEN::InsertItem( EDA_ITEMS::iterator aIter, EDA_ITEM* aItem )
m_items
.
insert
(
aIter
,
aItem
);
m_items
.
insert
(
aIter
,
aItem
);
}
}
#if defined(DEBUG)
void
BASE_SCREEN
::
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
const
{
EDA_ITEM
*
item
=
m_drawList
;
// for now, make it look like XML, expand on this later.
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
GetClass
().
Lower
().
mb_str
()
<<
">
\n
"
;
for
(
;
item
;
item
=
item
->
Next
()
)
{
item
->
Show
(
nestLevel
+
1
,
os
);
}
NestedSpace
(
nestLevel
,
os
)
<<
"</"
<<
GetClass
().
Lower
().
mb_str
()
<<
">
\n
"
;
}
#endif
common/class_plotter.cpp
View file @
0d459865
...
@@ -32,7 +32,6 @@ PLOTTER::PLOTTER( PlotFormat aPlotType )
...
@@ -32,7 +32,6 @@ PLOTTER::PLOTTER( PlotFormat aPlotType )
output_file
=
0
;
output_file
=
0
;
color_mode
=
false
;
/* Start as a BW plot */
color_mode
=
false
;
/* Start as a BW plot */
negative_mode
=
false
;
negative_mode
=
false
;
sheet
=
NULL
;
}
}
...
@@ -424,12 +423,12 @@ void PLOTTER::thick_circle( wxPoint pos, int diametre, int width,
...
@@ -424,12 +423,12 @@ void PLOTTER::thick_circle( wxPoint pos, int diametre, int width,
}
}
void
PLOTTER
::
set_paper_size
(
Ki_PageDescr
*
asheet
)
void
PLOTTER
::
SetPageSettings
(
const
PAGE_INFO
&
aPageSettings
)
{
{
wxASSERT
(
!
output_file
);
wxASSERT
(
!
output_file
);
sheet
=
asheet
;
pageInfo
=
aPageSettings
;
// Sheets are in mils, plotter works with decimals
// PAGE_INFO is in mils, plotter works with decimals
paper_size
.
x
=
sheet
->
m_Size
.
x
*
10
;
paper_size
=
pageInfo
.
GetSizeMils
()
*
10
;
paper_size
.
y
=
sheet
->
m_Size
.
y
*
10
;
}
}
common/common.cpp
View file @
0d459865
...
@@ -46,31 +46,6 @@
...
@@ -46,31 +46,6 @@
* application class.
* application class.
*/
*/
/* Standard page sizes in 1/1000 inch */
#if defined(KICAD_GOST)
Ki_PageDescr
g_Sheet_A4
(
wxSize
(
8283
,
11700
),
wxPoint
(
0
,
0
),
wxT
(
"A4"
)
);
#else
Ki_PageDescr
g_Sheet_A4
(
wxSize
(
11700
,
8267
),
wxPoint
(
0
,
0
),
wxT
(
"A4"
)
);
#endif
Ki_PageDescr
g_Sheet_A3
(
wxSize
(
16535
,
11700
),
wxPoint
(
0
,
0
),
wxT
(
"A3"
)
);
Ki_PageDescr
g_Sheet_A2
(
wxSize
(
23400
,
16535
),
wxPoint
(
0
,
0
),
wxT
(
"A2"
)
);
Ki_PageDescr
g_Sheet_A1
(
wxSize
(
33070
,
23400
),
wxPoint
(
0
,
0
),
wxT
(
"A1"
)
);
Ki_PageDescr
g_Sheet_A0
(
wxSize
(
46800
,
33070
),
wxPoint
(
0
,
0
),
wxT
(
"A0"
)
);
Ki_PageDescr
g_Sheet_A
(
wxSize
(
11000
,
8500
),
wxPoint
(
0
,
0
),
wxT
(
"A"
)
);
Ki_PageDescr
g_Sheet_B
(
wxSize
(
17000
,
11000
),
wxPoint
(
0
,
0
),
wxT
(
"B"
)
);
Ki_PageDescr
g_Sheet_C
(
wxSize
(
22000
,
17000
),
wxPoint
(
0
,
0
),
wxT
(
"C"
)
);
Ki_PageDescr
g_Sheet_D
(
wxSize
(
34000
,
22000
),
wxPoint
(
0
,
0
),
wxT
(
"D"
)
);
Ki_PageDescr
g_Sheet_E
(
wxSize
(
44000
,
34000
),
wxPoint
(
0
,
0
),
wxT
(
"E"
)
);
Ki_PageDescr
g_Sheet_GERBER
(
wxSize
(
32000
,
32000
),
wxPoint
(
0
,
0
),
wxT
(
"GERBER"
)
);
Ki_PageDescr
g_Sheet_user
(
wxSize
(
17000
,
11000
),
wxPoint
(
0
,
0
),
wxT
(
"User"
)
);
Ki_PageDescr
*
g_SheetSizeList
[
NB_ITEMS
+
1
]
=
{
&
g_Sheet_A4
,
&
g_Sheet_A3
,
&
g_Sheet_A2
,
&
g_Sheet_A1
,
&
g_Sheet_A0
,
&
g_Sheet_A
,
&
g_Sheet_B
,
&
g_Sheet_C
,
&
g_Sheet_D
,
&
g_Sheet_E
,
&
g_Sheet_user
,
NULL
};
const
wxString
ProjectFileExtension
(
wxT
(
"pro"
)
);
const
wxString
ProjectFileExtension
(
wxT
(
"pro"
)
);
const
wxString
SchematicFileExtension
(
wxT
(
"sch"
)
);
const
wxString
SchematicFileExtension
(
wxT
(
"sch"
)
);
...
@@ -199,12 +174,88 @@ bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString )
...
@@ -199,12 +174,88 @@ bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString )
}
}
Ki_PageDescr
::
Ki_PageDescr
(
const
wxSize
&
size
,
const
wxPoint
&
offset
,
const
wxString
&
name
)
//-----<PAGE_INFO>-------------------------------------------------------------
// Standard page sizes in 1/1000 inch
#if defined(KICAD_GOST)
static
const
PAGE_INFO
pageA4
(
wxSize
(
8283
,
11700
),
wxPoint
(
0
,
0
),
wxT
(
"A4"
)
);
#else
static
const
PAGE_INFO
pageA4
(
wxSize
(
11700
,
8267
),
wxPoint
(
0
,
0
),
wxT
(
"A4"
)
);
#endif
static
const
PAGE_INFO
pageA3
(
wxSize
(
16535
,
11700
),
wxPoint
(
0
,
0
),
wxT
(
"A3"
)
);
static
const
PAGE_INFO
pageA2
(
wxSize
(
23400
,
16535
),
wxPoint
(
0
,
0
),
wxT
(
"A2"
)
);
static
const
PAGE_INFO
pageA1
(
wxSize
(
33070
,
23400
),
wxPoint
(
0
,
0
),
wxT
(
"A1"
)
);
static
const
PAGE_INFO
pageA0
(
wxSize
(
46800
,
33070
),
wxPoint
(
0
,
0
),
wxT
(
"A0"
)
);
static
const
PAGE_INFO
pageA
(
wxSize
(
11000
,
8500
),
wxPoint
(
0
,
0
),
wxT
(
"A"
)
);
static
const
PAGE_INFO
pageB
(
wxSize
(
17000
,
11000
),
wxPoint
(
0
,
0
),
wxT
(
"B"
)
);
static
const
PAGE_INFO
pageC
(
wxSize
(
22000
,
17000
),
wxPoint
(
0
,
0
),
wxT
(
"C"
)
);
static
const
PAGE_INFO
pageD
(
wxSize
(
34000
,
22000
),
wxPoint
(
0
,
0
),
wxT
(
"D"
)
);
static
const
PAGE_INFO
pageE
(
wxSize
(
44000
,
34000
),
wxPoint
(
0
,
0
),
wxT
(
"E"
)
);
static
const
PAGE_INFO
pageGERBER
(
wxSize
(
32000
,
32000
),
wxPoint
(
0
,
0
),
wxT
(
"GERBER"
)
);
double
PAGE_INFO
::
s_user_width
=
17.0
;
double
PAGE_INFO
::
s_user_height
=
11.0
;
static
const
PAGE_INFO
pageUser
(
wxSize
(
17000
,
11000
),
wxPoint
(
0
,
0
),
wxT
(
"User"
)
);
/*
static const PAGE_INFO* pageSizes[] =
{
&pageA4, &pageA3, &pageA2, &pageA1, &pageA0,
&pageA, &pageB, &pageC, &pageD, &pageE, &pageUser,
};
PAGE_INFOS PAGE_INFO::GetStandardSizes()
{
return PAGE_INFOS( pageSizes, pageSizes + DIM( pageSizes ) );
}
*/
bool
PAGE_INFO
::
SetType
(
const
wxString
&
aType
)
{
bool
rc
=
true
;
if
(
aType
==
pageA4
.
GetType
()
)
*
this
=
pageA4
;
else
if
(
aType
==
pageA3
.
GetType
()
)
*
this
=
pageA3
;
else
if
(
aType
==
pageA2
.
GetType
()
)
*
this
=
pageA2
;
else
if
(
aType
==
pageA1
.
GetType
()
)
*
this
=
pageA1
;
else
if
(
aType
==
pageA0
.
GetType
()
)
*
this
=
pageA0
;
else
if
(
aType
==
pageA
.
GetType
()
)
*
this
=
pageA
;
else
if
(
aType
==
pageB
.
GetType
()
)
*
this
=
pageB
;
else
if
(
aType
==
pageC
.
GetType
()
)
*
this
=
pageC
;
else
if
(
aType
==
pageD
.
GetType
()
)
*
this
=
pageD
;
else
if
(
aType
==
pageE
.
GetType
()
)
*
this
=
pageE
;
else
if
(
aType
==
pageUser
.
GetType
()
)
{
*
this
=
pageUser
;
m_widthInches
=
s_user_width
;
m_heightInches
=
s_user_height
;
}
else
rc
=
false
;
return
rc
;
}
PAGE_INFO
::
PAGE_INFO
(
const
wxSize
&
aSizeMils
,
const
wxPoint
&
aOffsetMils
,
const
wxString
&
aType
)
{
{
// All sizes are in 1/1000 inch
// aSizeMils is in 1/1000th of an inch
m_Size
=
size
;
SetWidthInches
(
aSizeMils
.
x
/
1000.0
);
m_Offset
=
offset
;
SetHeightInches
(
aSizeMils
.
y
/
1000.0
);
m_Name
=
name
;
m_Offset
=
aOffsetMils
;
m_Type
=
aType
;
// Adjust the default value for margins to 400 mils (0,4 inch or 10 mm)
// Adjust the default value for margins to 400 mils (0,4 inch or 10 mm)
#if defined(KICAD_GOST)
#if defined(KICAD_GOST)
...
@@ -218,6 +269,50 @@ Ki_PageDescr::Ki_PageDescr( const wxSize& size, const wxPoint& offset, const wxS
...
@@ -218,6 +269,50 @@ Ki_PageDescr::Ki_PageDescr( const wxSize& size, const wxPoint& offset, const wxS
}
}
PAGE_INFO
::
PAGE_INFO
(
const
wxString
&
aType
)
{
SetType
(
aType
);
}
void
PAGE_INFO
::
SetWidthInches
(
double
aWidthInInches
)
{
// limit resolution to 1/1000th of an inch
m_widthInches
=
double
(
int
(
aWidthInInches
*
1000
+
500
)
/
1000
);
}
void
PAGE_INFO
::
SetHeightInches
(
double
aHeightInInches
)
{
// limit resolution to 1/1000th of an inch
m_heightInches
=
double
(
int
(
aHeightInInches
*
1000
+
500
)
/
1000
);
}
void
PAGE_INFO
::
SetUserWidthInches
(
double
aWidthInInches
)
{
if
(
aWidthInInches
<
6.0
)
aWidthInInches
=
6.0
;
else
if
(
aWidthInInches
>
44.0
)
aWidthInInches
=
44.0
;
s_user_width
=
aWidthInInches
;
}
void
PAGE_INFO
::
SetUserHeightInches
(
double
aHeightInInches
)
{
if
(
aHeightInInches
<
4.0
)
aHeightInInches
=
4.0
;
else
if
(
aHeightInInches
>
44.0
)
aHeightInInches
=
44.0
;
s_user_height
=
aHeightInInches
;
}
//-----</PAGE_INFO>------------------------------------------------------------
wxString
ReturnUnitSymbol
(
EDA_UNITS_T
aUnit
,
const
wxString
&
formatString
)
wxString
ReturnUnitSymbol
(
EDA_UNITS_T
aUnit
,
const
wxString
&
formatString
)
{
{
wxString
tmp
;
wxString
tmp
;
...
...
common/common_plotPS_functions.cpp
View file @
0d459865
...
@@ -366,7 +366,7 @@ bool PS_PLOTTER::start_plot( FILE* fout )
...
@@ -366,7 +366,7 @@ bool PS_PLOTTER::start_plot( FILE* fout )
fprintf
(
output_file
,
"%%%%Pages: 1
\n
"
);
fprintf
(
output_file
,
"%%%%Pages: 1
\n
"
);
fprintf
(
output_file
,
"%%%%PageOrder: Ascend
\n
"
);
fprintf
(
output_file
,
"%%%%PageOrder: Ascend
\n
"
);
// Print boundary box in 1/72 pixels per inch, box is in deci
ma
ls
// Print boundary box in 1/72 pixels per inch, box is in deci
-mi
ls
const
double
CONV_SCALE
=
DECIMIL_TO_INCH
*
72
;
const
double
CONV_SCALE
=
DECIMIL_TO_INCH
*
72
;
// The coordinates of the lower left corner of the boundary
// The coordinates of the lower left corner of the boundary
...
@@ -388,18 +388,20 @@ bool PS_PLOTTER::start_plot( FILE* fout )
...
@@ -388,18 +388,20 @@ bool PS_PLOTTER::start_plot( FILE* fout )
//
//
// (NOTE: m_Size.y is *supposed* to be listed before m_Size.x;
// (NOTE: m_Size.y is *supposed* to be listed before m_Size.x;
// the order in which they are specified is not wrong!)
// the order in which they are specified is not wrong!)
// Also note sheet->m_Size is given in mils, not in decimils and must be
// Also note pageSize is given in mils, not in internal units and must be
// sheet->m_Size * 10 in decimals
// converted to internal units.
if
(
sheet
->
m_Name
.
Cmp
(
wxT
(
"User"
)
)
==
0
)
wxSize
pageSize
=
pageInfo
.
GetSizeMils
();
if
(
pageInfo
.
GetType
().
Cmp
(
wxT
(
"User"
)
)
==
0
)
fprintf
(
output_file
,
"%%%%DocumentMedia: Custom %d %d 0 () ()
\n
"
,
fprintf
(
output_file
,
"%%%%DocumentMedia: Custom %d %d 0 () ()
\n
"
,
wxRound
(
sheet
->
m_
Size
.
y
*
10
*
CONV_SCALE
),
wxRound
(
page
Size
.
y
*
10
*
CONV_SCALE
),
wxRound
(
sheet
->
m_
Size
.
x
*
10
*
CONV_SCALE
)
);
wxRound
(
page
Size
.
x
*
10
*
CONV_SCALE
)
);
else
// ( if sheet->m_Name does not equal "User" )
else
// ( if sheet->m_Name does not equal "User" )
fprintf
(
output_file
,
"%%%%DocumentMedia: %s %d %d 0 () ()
\n
"
,
fprintf
(
output_file
,
"%%%%DocumentMedia: %s %d %d 0 () ()
\n
"
,
TO_UTF8
(
sheet
->
m_Name
),
TO_UTF8
(
pageInfo
.
GetType
()
),
wxRound
(
sheet
->
m_
Size
.
y
*
10
*
CONV_SCALE
),
wxRound
(
page
Size
.
y
*
10
*
CONV_SCALE
),
wxRound
(
sheet
->
m_
Size
.
x
*
10
*
CONV_SCALE
)
);
wxRound
(
page
Size
.
x
*
10
*
CONV_SCALE
)
);
fprintf
(
output_file
,
"%%%%Orientation: Landscape
\n
"
);
fprintf
(
output_file
,
"%%%%Orientation: Landscape
\n
"
);
...
...
common/common_plot_functions.cpp
View file @
0d459865
...
@@ -22,15 +22,17 @@
...
@@ -22,15 +22,17 @@
void
EDA_DRAW_FRAME
::
PlotWorkSheet
(
PLOTTER
*
plotter
,
BASE_SCREEN
*
screen
)
void
EDA_DRAW_FRAME
::
PlotWorkSheet
(
PLOTTER
*
plotter
,
BASE_SCREEN
*
screen
)
{
{
#define WSTEXTSIZE 50 // Text size in mils
#define WSTEXTSIZE 50 // Text size in mils
Ki_PageDescr
*
Sheet
=
screen
->
m_CurrentSheetDesc
;
const
PAGE_INFO
&
pageInfo
=
GetPageSettings
();
int
xg
,
yg
;
wxSize
pageSize
=
pageInfo
.
GetSizeMils
();
// mils
wxSize
PageSize
;
int
xg
,
yg
;
wxPoint
pos
,
ref
;
EDA_Colors
color
;
wxPoint
pos
,
ref
;
EDA_Colors
color
;
/* Scale to convert dimension in 1/1000 in into internal units
/* Scale to convert dimension in 1/1000 in into internal units
* (1/1000 inc for Eeschema, 1/10000 for Pcbnew. */
* (1/1000 inc for Eeschema, 1/10000 for Pcbnew. */
int
conv_unit
=
screen
->
GetInternalUnits
()
/
1000
;
int
conv_unit
=
screen
->
GetInternalUnits
()
/
1000
;
wxString
msg
;
wxString
msg
;
wxSize
text_size
;
wxSize
text_size
;
#if defined(KICAD_GOST)
#if defined(KICAD_GOST)
...
@@ -47,14 +49,11 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
...
@@ -47,14 +49,11 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
color
=
BLACK
;
color
=
BLACK
;
plotter
->
set_color
(
color
);
plotter
->
set_color
(
color
);
PageSize
.
x
=
Sheet
->
m_Size
.
x
;
PageSize
.
y
=
Sheet
->
m_Size
.
y
;
/* Plot edge. */
/* Plot edge. */
ref
.
x
=
Sheet
->
m_LeftMargin
*
conv_unit
;
ref
.
x
=
pageInfo
.
GetLeftMarginMils
()
*
conv_unit
;
ref
.
y
=
Sheet
->
m_TopMargin
*
conv_unit
;
ref
.
y
=
pageInfo
.
GetTopMarginMils
()
*
conv_unit
;
xg
=
(
PageSize
.
x
-
Sheet
->
m_RightMargin
)
*
conv_unit
;
xg
=
(
pageSize
.
x
-
pageInfo
.
GetRightMarginMils
()
)
*
conv_unit
;
yg
=
(
PageSize
.
y
-
Sheet
->
m_BottomMargin
)
*
conv_unit
;
yg
=
(
pageSize
.
y
-
pageInfo
.
GetBottomMarginMils
()
)
*
conv_unit
;
#if defined(KICAD_GOST)
#if defined(KICAD_GOST)
plotter
->
move_to
(
ref
);
plotter
->
move_to
(
ref
);
...
@@ -93,12 +92,13 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
...
@@ -93,12 +92,13 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
text_size
.
x
=
WSTEXTSIZE
*
conv_unit
;
text_size
.
x
=
WSTEXTSIZE
*
conv_unit
;
text_size
.
y
=
WSTEXTSIZE
*
conv_unit
;
text_size
.
y
=
WSTEXTSIZE
*
conv_unit
;
ref
.
x
=
Sheet
->
m_LeftMargin
;
// upper left corner in mils
ref
.
y
=
Sheet
->
m_TopMargin
;
/* Upper left corner in
ref
.
x
=
pageInfo
.
GetLeftMarginMils
();
* 1/1000 inch */
ref
.
y
=
pageInfo
.
GetTopMarginMils
();
xg
=
(
PageSize
.
x
-
Sheet
->
m_RightMargin
);
yg
=
(
PageSize
.
y
-
Sheet
->
m_BottomMargin
);
/* lower right corner
// lower right corner in mils
* in 1/1000 inch */
xg
=
(
pageSize
.
x
-
pageInfo
.
GetRightMarginMils
()
);
yg
=
(
pageSize
.
y
-
pageInfo
.
GetBottomMarginMils
()
);
#if defined(KICAD_GOST)
#if defined(KICAD_GOST)
for
(
Ki_WorkSheetData
*
WsItem
=
&
WS_Segm1_LU
;
for
(
Ki_WorkSheetData
*
WsItem
=
&
WS_Segm1_LU
;
...
@@ -240,6 +240,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
...
@@ -240,6 +240,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
/* Plot the worksheet. */
/* Plot the worksheet. */
text_size
.
x
=
SIZETEXT
*
conv_unit
;
text_size
.
x
=
SIZETEXT
*
conv_unit
;
text_size
.
y
=
SIZETEXT
*
conv_unit
;
text_size
.
y
=
SIZETEXT
*
conv_unit
;
#if defined(KICAD_GOST)
#if defined(KICAD_GOST)
text_size2
.
x
=
SIZETEXT
*
conv_unit
*
2
;
text_size2
.
x
=
SIZETEXT
*
conv_unit
*
2
;
text_size2
.
y
=
SIZETEXT
*
conv_unit
*
2
;
text_size2
.
y
=
SIZETEXT
*
conv_unit
*
2
;
...
@@ -247,8 +248,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
...
@@ -247,8 +248,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
text_size3
.
y
=
SIZETEXT
*
conv_unit
*
3
;
text_size3
.
y
=
SIZETEXT
*
conv_unit
*
3
;
text_size1_5
.
x
=
SIZETEXT
*
conv_unit
*
1.5
;
text_size1_5
.
x
=
SIZETEXT
*
conv_unit
*
1.5
;
text_size1_5
.
y
=
SIZETEXT
*
conv_unit
*
1.5
;
text_size1_5
.
y
=
SIZETEXT
*
conv_unit
*
1.5
;
ref
.
x
=
PageSize
.
x
-
Sheet
->
m_RightMargin
;
ref
.
x
=
pageSize
.
x
-
pageInfo
.
GetRightMarginMils
()
;
ref
.
y
=
PageSize
.
y
-
Sheet
->
m_BottomMargin
;
ref
.
y
=
pageSize
.
y
-
pageInfo
.
GetBottomMarginMils
()
;
if
(
screen
->
m_ScreenNumber
==
1
)
if
(
screen
->
m_ScreenNumber
==
1
)
{
{
...
@@ -287,7 +288,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
...
@@ -287,7 +288,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
if
(
WsItem
->
m_Legende
)
if
(
WsItem
->
m_Legende
)
msg
=
WsItem
->
m_Legende
;
msg
=
WsItem
->
m_Legende
;
if
(
screen
->
m_NumberOfScreen
>
1
)
if
(
screen
->
m_NumberOfScreen
>
1
)
msg
<<
screen
->
m_ScreenNumber
;
msg
<<
screen
->
m_ScreenNumber
;
plotter
->
text
(
pos
,
color
,
plotter
->
text
(
pos
,
color
,
msg
,
TEXT_ORIENT_HORIZ
,
text_size
,
msg
,
TEXT_ORIENT_HORIZ
,
text_size
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_CENTER
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_CENTER
,
...
@@ -297,7 +298,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
...
@@ -297,7 +298,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
case
WS_SHEETS
:
case
WS_SHEETS
:
if
(
WsItem
->
m_Legende
)
if
(
WsItem
->
m_Legende
)
msg
=
WsItem
->
m_Legende
;
msg
=
WsItem
->
m_Legende
;
msg
<<
screen
->
m_NumberOfScreen
;
msg
<<
screen
->
m_NumberOfScreen
;
plotter
->
text
(
pos
,
color
,
plotter
->
text
(
pos
,
color
,
msg
,
TEXT_ORIENT_HORIZ
,
text_size
,
msg
,
TEXT_ORIENT_HORIZ
,
text_size
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_CENTER
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_CENTER
,
...
@@ -334,8 +335,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
...
@@ -334,8 +335,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
msg
,
TEXT_ORIENT_HORIZ
,
text_size3
,
msg
,
TEXT_ORIENT_HORIZ
,
text_size3
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
thickness
,
italic
,
false
);
thickness
,
italic
,
false
);
pos
.
x
=
(
Sheet
->
m_LeftMargin
+
1260
)
*
conv_unit
;
pos
.
x
=
(
pageInfo
.
GetLeftMarginMils
()
+
1260
)
*
conv_unit
;
pos
.
y
=
(
Sheet
->
m_TopMargin
+
270
)
*
conv_unit
;
pos
.
y
=
(
pageInfo
.
GetTopMarginMils
()
+
270
)
*
conv_unit
;
plotter
->
text
(
pos
,
color
,
plotter
->
text
(
pos
,
color
,
msg
.
GetData
(),
1800
,
text_size2
,
msg
.
GetData
(),
1800
,
text_size2
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
...
@@ -408,8 +409,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
...
@@ -408,8 +409,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
msg
,
TEXT_ORIENT_HORIZ
,
text_size3
,
msg
,
TEXT_ORIENT_HORIZ
,
text_size3
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
thickness
,
italic
,
false
);
thickness
,
italic
,
false
);
pos
.
x
=
(
Sheet
->
m_LeftMargin
+
1260
)
*
conv_unit
;
pos
.
x
=
(
pageInfo
.
GetLeftMarginMils
()
+
1260
)
*
conv_unit
;
pos
.
y
=
(
Sheet
->
m_TopMargin
+
270
)
*
conv_unit
;
pos
.
y
=
(
pageInfo
.
GetTopMarginMils
()
+
270
)
*
conv_unit
;
plotter
->
text
(
pos
,
color
,
plotter
->
text
(
pos
,
color
,
msg
,
1800
,
text_size2
,
msg
,
1800
,
text_size2
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
...
@@ -444,9 +445,11 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
...
@@ -444,9 +445,11 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
}
}
}
}
}
}
#else
#else
ref
.
x
=
PageSize
.
x
-
GRID_REF_W
-
Sheet
->
m_RightMargin
;
ref
.
y
=
PageSize
.
y
-
GRID_REF_W
-
Sheet
->
m_BottomMargin
;
ref
.
x
=
pageSize
.
x
-
GRID_REF_W
-
pageInfo
.
GetRightMarginMils
();
ref
.
y
=
pageSize
.
y
-
GRID_REF_W
-
pageInfo
.
GetBottomMarginMils
();
for
(
Ki_WorkSheetData
*
WsItem
=
&
WS_Date
;
for
(
Ki_WorkSheetData
*
WsItem
=
&
WS_Date
;
WsItem
!=
NULL
;
WsItem
!=
NULL
;
...
@@ -477,7 +480,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
...
@@ -477,7 +480,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
break
;
break
;
case
WS_SIZESHEET
:
case
WS_SIZESHEET
:
msg
+=
screen
->
m_CurrentSheetDesc
->
m_Name
;
msg
+=
pageInfo
.
GetType
()
;
break
;
break
;
case
WS_IDENTSHEET
:
case
WS_IDENTSHEET
:
...
...
common/dialogs/dialog_page_settings.cpp
View file @
0d459865
...
@@ -23,14 +23,6 @@
...
@@ -23,14 +23,6 @@
#include "dialog_page_settings.h"
#include "dialog_page_settings.h"
#define NB_ITEMS 11
Ki_PageDescr
*
SheetList
[
NB_ITEMS
+
1
]
=
{
&
g_Sheet_A4
,
&
g_Sheet_A3
,
&
g_Sheet_A2
,
&
g_Sheet_A1
,
&
g_Sheet_A0
,
&
g_Sheet_A
,
&
g_Sheet_B
,
&
g_Sheet_C
,
&
g_Sheet_D
,
&
g_Sheet_E
,
&
g_Sheet_user
,
NULL
};
void
EDA_DRAW_FRAME
::
Process_PageSettings
(
wxCommandEvent
&
event
)
void
EDA_DRAW_FRAME
::
Process_PageSettings
(
wxCommandEvent
&
event
)
{
{
...
@@ -43,13 +35,12 @@ void EDA_DRAW_FRAME::Process_PageSettings( wxCommandEvent& event )
...
@@ -43,13 +35,12 @@ void EDA_DRAW_FRAME::Process_PageSettings( wxCommandEvent& event )
DIALOG_PAGES_SETTINGS
::
DIALOG_PAGES_SETTINGS
(
EDA_DRAW_FRAME
*
parent
)
:
DIALOG_PAGES_SETTINGS
::
DIALOG_PAGES_SETTINGS
(
EDA_DRAW_FRAME
*
parent
)
:
DIALOG_PAGES_SETTINGS_BASE
(
parent
)
DIALOG_PAGES_SETTINGS_BASE
(
parent
),
m_user_size
(
wxT
(
"User"
)
)
{
{
m_Parent
=
parent
;
m_Parent
=
parent
;
m_Screen
=
m_Parent
->
GetScreen
();
m_Screen
=
m_Parent
->
GetScreen
();
m_Modified
=
0
;
m_modified
=
false
;
m_SelectedSheet
=
NULL
;
m_CurrentSelection
=
0
;
initDialog
();
initDialog
();
...
@@ -65,10 +56,11 @@ DIALOG_PAGES_SETTINGS::~DIALOG_PAGES_SETTINGS()
...
@@ -65,10 +56,11 @@ DIALOG_PAGES_SETTINGS::~DIALOG_PAGES_SETTINGS()
void
DIALOG_PAGES_SETTINGS
::
initDialog
()
void
DIALOG_PAGES_SETTINGS
::
initDialog
()
{
{
wxString
msg
;
wxString
msg
;
double
userSizeX
;
double
userSizeY
;
SetFocus
();
SetFocus
();
SearchPageSizeSelection
();
// Init display value for sheet User size
// Init display value for sheet User size
wxString
format
=
m_TextSheetCount
->
GetLabel
();
wxString
format
=
m_TextSheetCount
->
GetLabel
();
...
@@ -78,38 +70,49 @@ void DIALOG_PAGES_SETTINGS::initDialog()
...
@@ -78,38 +70,49 @@ void DIALOG_PAGES_SETTINGS::initDialog()
msg
.
Printf
(
format
,
m_Screen
->
m_ScreenNumber
);
msg
.
Printf
(
format
,
m_Screen
->
m_ScreenNumber
);
m_TextSheetNumber
->
SetLabel
(
msg
);
m_TextSheetNumber
->
SetLabel
(
msg
);
m_page
=
m_Parent
->
GetPageSettings
();
setCurrentPageSizeSelection
();
switch
(
g_UserUnit
)
switch
(
g_UserUnit
)
{
{
case
MILLIMETRES
:
case
MILLIMETRES
:
UserSizeX
=
(
double
)
g_Sheet_user
.
m_Size
.
x
*
25.4
/
1000
;
userSizeX
=
m_user_size
.
GetWidthInches
()
*
25.4
;
UserSizeY
=
(
double
)
g_Sheet_user
.
m_Size
.
y
*
25.4
/
1000
;
userSizeY
=
m_user_size
.
GetHeightInches
()
*
25.4
;
msg
.
Printf
(
wxT
(
"%.2f"
),
UserSizeX
);
msg
.
Printf
(
wxT
(
"%.2f"
),
userSizeX
);
m_TextUserSizeX
->
SetValue
(
msg
);
m_TextUserSizeX
->
SetValue
(
msg
);
msg
.
Printf
(
wxT
(
"%.2f"
),
UserSizeY
);
msg
.
Printf
(
wxT
(
"%.2f"
),
userSizeY
);
m_TextUserSizeY
->
SetValue
(
msg
);
m_TextUserSizeY
->
SetValue
(
msg
);
break
;
break
;
default
:
case
INCHES
:
case
INCHES
:
UserSizeX
=
(
double
)
g_Sheet_user
.
m_Size
.
x
/
1000
;
userSizeX
=
m_user_size
.
GetWidthInches
();
UserSizeY
=
(
double
)
g_Sheet_user
.
m_Size
.
y
/
1000
;
userSizeY
=
m_user_size
.
GetHeightInches
();
msg
.
Printf
(
wxT
(
"%.3f"
),
UserSizeX
);
msg
.
Printf
(
wxT
(
"%.3f"
),
userSizeX
);
m_TextUserSizeX
->
SetValue
(
msg
);
m_TextUserSizeX
->
SetValue
(
msg
);
msg
.
Printf
(
wxT
(
"%.3f"
),
UserSizeY
);
msg
.
Printf
(
wxT
(
"%.3f"
),
userSizeY
);
m_TextUserSizeY
->
SetValue
(
msg
);
m_TextUserSizeY
->
SetValue
(
msg
);
break
;
break
;
/* // you want it in 1/1000ths of an inch, why?
case UNSCALED_UNITS:
case UNSCALED_UNITS:
UserSizeX
=
g_Sheet_user
.
m_Size
.
x
;
userSizeX = m_user_size.GetWidthInches() * 1000
;
UserSizeY
=
g_Sheet_user
.
m_Size
.
y
;
userSizeY = m_user_size.GetHeightInches() * 1000
;
msg
.
Printf
(
wxT
(
"%f"
),
U
serSizeX
);
msg.Printf( wxT( "%f" ),
m_u
serSizeX );
m_TextUserSizeX->SetValue( msg );
m_TextUserSizeX->SetValue( msg );
msg
.
Printf
(
wxT
(
"%f"
),
U
serSizeY
);
msg.Printf( wxT( "%f" ),
m_u
serSizeY );
m_TextUserSizeY->SetValue( msg );
m_TextUserSizeY->SetValue( msg );
break;
break;
*/
}
}
// Set validators
// Set validators
m_PageSizeBox
->
SetValidator
(
wxGenericValidator
(
&
m_CurrentSelection
)
);
//
m_PageSizeBox->SetValidator( wxGenericValidator( &m_CurrentSelection ) );
m_TextRevision
->
SetValidator
(
wxTextValidator
(
wxFILTER_NONE
,
&
m_Screen
->
m_Revision
)
);
m_TextRevision
->
SetValidator
(
wxTextValidator
(
wxFILTER_NONE
,
&
m_Screen
->
m_Revision
)
);
m_TextTitle
->
SetValidator
(
wxTextValidator
(
wxFILTER_NONE
,
&
m_Screen
->
m_Title
)
);
m_TextTitle
->
SetValidator
(
wxTextValidator
(
wxFILTER_NONE
,
&
m_Screen
->
m_Title
)
);
m_TextCompany
->
SetValidator
(
wxTextValidator
(
wxFILTER_NONE
,
&
m_Screen
->
m_Company
)
);
m_TextCompany
->
SetValidator
(
wxTextValidator
(
wxFILTER_NONE
,
&
m_Screen
->
m_Company
)
);
...
@@ -139,7 +142,7 @@ void DIALOG_PAGES_SETTINGS::initDialog()
...
@@ -139,7 +142,7 @@ void DIALOG_PAGES_SETTINGS::initDialog()
void
DIALOG_PAGES_SETTINGS
::
OnCloseWindow
(
wxCloseEvent
&
event
)
void
DIALOG_PAGES_SETTINGS
::
OnCloseWindow
(
wxCloseEvent
&
event
)
{
{
EndModal
(
m_
M
odified
);
EndModal
(
m_
m
odified
);
}
}
...
@@ -150,7 +153,7 @@ void DIALOG_PAGES_SETTINGS::OnCloseWindow( wxCloseEvent& event )
...
@@ -150,7 +153,7 @@ void DIALOG_PAGES_SETTINGS::OnCloseWindow( wxCloseEvent& event )
void
DIALOG_PAGES_SETTINGS
::
OnOkClick
(
wxCommandEvent
&
event
)
void
DIALOG_PAGES_SETTINGS
::
OnOkClick
(
wxCommandEvent
&
event
)
{
{
SavePageSettings
(
event
);
SavePageSettings
(
event
);
m_
Modified
=
1
;
m_
modified
=
true
;
Close
(
true
);
Close
(
true
);
}
}
...
@@ -167,8 +170,9 @@ void DIALOG_PAGES_SETTINGS::OnCancelClick( wxCommandEvent& event )
...
@@ -167,8 +170,9 @@ void DIALOG_PAGES_SETTINGS::OnCancelClick( wxCommandEvent& event )
void
DIALOG_PAGES_SETTINGS
::
SavePageSettings
(
wxCommandEvent
&
event
)
void
DIALOG_PAGES_SETTINGS
::
SavePageSettings
(
wxCommandEvent
&
event
)
{
{
double
dtmp
;
wxString
msg
;
wxString
msg
;
double
userSizeX
;
double
userSizeY
;
m_Screen
->
m_Revision
=
m_TextRevision
->
GetValue
();
m_Screen
->
m_Revision
=
m_TextRevision
->
GetValue
();
m_Screen
->
m_Company
=
m_TextCompany
->
GetValue
();
m_Screen
->
m_Company
=
m_TextCompany
->
GetValue
();
...
@@ -179,50 +183,42 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
...
@@ -179,50 +183,42 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
m_Screen
->
m_Commentaire4
=
m_TextComment4
->
GetValue
();
m_Screen
->
m_Commentaire4
=
m_TextComment4
->
GetValue
();
msg
=
m_TextUserSizeX
->
GetValue
();
msg
=
m_TextUserSizeX
->
GetValue
();
msg
.
ToDouble
(
&
dtmp
);
msg
.
ToDouble
(
&
userSizeX
);
UserSizeX
=
dtmp
;
msg
=
m_TextUserSizeY
->
GetValue
();
msg
=
m_TextUserSizeY
->
GetValue
();
msg
.
ToDouble
(
&
dtmp
);
msg
.
ToDouble
(
&
userSizeY
);
UserSizeY
=
dtmp
;
int
ii
=
m_PageSizeBox
->
GetSelection
();
int
radioSelection
=
m_PageSizeBox
->
GetSelection
();
if
(
radioSelection
<
0
)
radioSelection
=
0
;
if
(
ii
<
0
)
wxString
paperType
=
m_PageSizeBox
->
GetString
(
radioSelection
);
ii
=
0
;
m_SelectedSheet
=
SheetList
[
ii
];
m_page
.
SetType
(
paperType
);
m_Screen
->
m_CurrentSheetDesc
=
m_SelectedSheet
;
m_Parent
->
SetPageSettings
(
m_page
);
switch
(
g_UserUnit
)
switch
(
g_UserUnit
)
{
{
case
MILLIMETRES
:
case
MILLIMETRES
:
g_Sheet_user
.
m_Size
.
x
=
(
int
)
(
UserSizeX
*
1000
/
25.4
);
PAGE_INFO
::
SetUserWidthInches
(
userSizeX
/
25.4
);
g_Sheet_user
.
m_Size
.
y
=
(
int
)
(
UserSizeY
*
1000
/
25.4
);
PAGE_INFO
::
SetUserHeightInches
(
userSizeY
/
25.4
);
break
;
break
;
default
:
case
INCHES
:
case
INCHES
:
g_Sheet_user
.
m_Size
.
x
=
(
int
)
(
UserSizeX
*
1000
);
PAGE_INFO
::
SetUserWidthInches
(
userSizeX
);
g_Sheet_user
.
m_Size
.
y
=
(
int
)
(
UserSizeY
*
1000
);
PAGE_INFO
::
SetUserHeightInches
(
userSizeY
);
break
;
break
;
/* // set in 1/1000ths of an inch, but why?
case UNSCALED_UNITS:
case UNSCALED_UNITS:
g_Sheet_user
.
m_Size
.
x
=
(
int
)
(
UserSizeX
);
PAGE_INFO::SetUserWidthInches( userSizeX /1000
);
g_Sheet_user
.
m_Size
.
y
=
(
int
)
(
UserSizeY
);
PAGE_INFO::SetUserHeightInches( userSizeY /1000
);
break;
break;
*/
}
}
if
(
g_Sheet_user
.
m_Size
.
x
<
6000
)
g_Sheet_user
.
m_Size
.
x
=
6000
;
if
(
g_Sheet_user
.
m_Size
.
x
>
44000
)
g_Sheet_user
.
m_Size
.
x
=
44000
;
if
(
g_Sheet_user
.
m_Size
.
y
<
4000
)
g_Sheet_user
.
m_Size
.
y
=
4000
;
if
(
g_Sheet_user
.
m_Size
.
y
>
44000
)
g_Sheet_user
.
m_Size
.
y
=
44000
;
#ifdef EESCHEMA
#ifdef EESCHEMA
/* Exports settings to other sheets if requested: */
/* Exports settings to other sheets if requested: */
SCH_SCREEN
*
screen
;
SCH_SCREEN
*
screen
;
...
@@ -265,21 +261,19 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
...
@@ -265,21 +261,19 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
}
}
/* Search the correct index to activate the radiobox list size selection
void
DIALOG_PAGES_SETTINGS
::
setCurrentPageSizeSelection
()
* according to the current page size
*/
void
DIALOG_PAGES_SETTINGS
::
SearchPageSizeSelection
()
{
{
Ki_PageDescr
*
sheet
;
wxString
curPaperType
=
m_page
.
GetType
();
int
ii
;
m_CurrentSelection
=
NB_ITEMS
-
1
;
for
(
ii
=
0
;
ii
<
NB_ITEMS
;
ii
++
)
for
(
unsigned
i
=
0
;
i
<
m_PageSizeBox
->
GetCount
();
++
i
)
{
{
sheet
=
SheetList
[
ii
];
if
(
m_PageSizeBox
->
GetString
(
i
)
==
curPaperType
)
{
if
(
m_Parent
->
GetScreen
()
->
m_CurrentSheetDesc
==
sheet
)
m_PageSizeBox
->
SetSelection
(
i
);
m_CurrentSelection
=
ii
;
return
;
}
}
}
// m_PageSizeBox->SetSelection( 1 ); // wxFormBuilder does this, control there
}
}
common/dialogs/dialog_page_settings.h
View file @
0d459865
...
@@ -14,12 +14,11 @@
...
@@ -14,12 +14,11 @@
class
DIALOG_PAGES_SETTINGS
:
public
DIALOG_PAGES_SETTINGS_BASE
class
DIALOG_PAGES_SETTINGS
:
public
DIALOG_PAGES_SETTINGS_BASE
{
{
private
:
private
:
EDA_DRAW_FRAME
*
m_Parent
;
EDA_DRAW_FRAME
*
m_Parent
;
BASE_SCREEN
*
m_Screen
;
BASE_SCREEN
*
m_Screen
;
int
m_Modified
;
bool
m_modified
;
Ki_PageDescr
*
m_SelectedSheet
;
PAGE_INFO
m_page
;
///< the one being edited
float
UserSizeX
,
UserSizeY
;
PAGE_INFO
m_user_size
;
///< instantiated just to get the size
int
m_CurrentSelection
;
public
:
public
:
DIALOG_PAGES_SETTINGS
(
EDA_DRAW_FRAME
*
parent
);
DIALOG_PAGES_SETTINGS
(
EDA_DRAW_FRAME
*
parent
);
...
@@ -37,7 +36,8 @@ private:
...
@@ -37,7 +36,8 @@ private:
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
void
OnCancelClick
(
wxCommandEvent
&
event
);
void
OnCancelClick
(
wxCommandEvent
&
event
);
void
SearchPageSizeSelection
();
void
setCurrentPageSizeSelection
();
void
SavePageSettings
(
wxCommandEvent
&
event
);
void
SavePageSettings
(
wxCommandEvent
&
event
);
void
ReturnSizeSelected
(
wxCommandEvent
&
event
);
void
ReturnSizeSelected
(
wxCommandEvent
&
event
);
...
...
common/drawframe.cpp
View file @
0d459865
...
@@ -524,12 +524,11 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition )
...
@@ -524,12 +524,11 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition )
logicalClientSize
.
x
=
wxRound
(
(
double
)
clientSize
.
x
/
scalar
);
logicalClientSize
.
x
=
wxRound
(
(
double
)
clientSize
.
x
/
scalar
);
logicalClientSize
.
y
=
wxRound
(
(
double
)
clientSize
.
y
/
scalar
);
logicalClientSize
.
y
=
wxRound
(
(
double
)
clientSize
.
y
/
scalar
);
// The upper left corner of the drawing in device units.
// A corner of the drawing in internal units.
int
w
=
screen
->
ReturnPageSize
().
x
;
wxSize
corner
=
GetPageSizeIU
();
int
h
=
screen
->
ReturnPageSize
().
y
;
// The drawing rectangle logical units
// The drawing rectangle logical units
wxRect
drawingRect
(
wxPoint
(
0
,
0
),
wxSize
(
w
,
h
)
);
wxRect
drawingRect
(
wxPoint
(
0
,
0
),
corner
);
wxLogTrace
(
traceScrollSettings
,
wxT
(
"Logical drawing rect = ( %d, %d, %d, %d )."
),
wxLogTrace
(
traceScrollSettings
,
wxT
(
"Logical drawing rect = ( %d, %d, %d, %d )."
),
drawingRect
.
x
,
drawingRect
.
y
,
drawingRect
.
width
,
drawingRect
.
height
);
drawingRect
.
x
,
drawingRect
.
y
,
drawingRect
.
width
,
drawingRect
.
height
);
...
...
common/drawpanel.cpp
View file @
0d459865
...
@@ -527,23 +527,24 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg )
...
@@ -527,23 +527,24 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg )
void
EDA_DRAW_PANEL
::
DrawBackGround
(
wxDC
*
DC
)
void
EDA_DRAW_PANEL
::
DrawBackGround
(
wxDC
*
DC
)
{
{
int
axis_color
=
BLUE
;
int
axis_color
=
BLUE
;
BASE_SCREEN
*
screen
=
GetScreen
();
GRSetDrawMode
(
DC
,
GR_COPY
);
GRSetDrawMode
(
DC
,
GR_COPY
);
if
(
GetParent
()
->
IsGridVisible
()
)
if
(
GetParent
()
->
IsGridVisible
()
)
DrawGrid
(
DC
);
DrawGrid
(
DC
);
/
* Draw axis */
/
/ Draw axis
if
(
GetParent
()
->
m_showAxis
)
if
(
GetParent
()
->
m_showAxis
)
{
{
/* Draw the Y axis */
wxSize
pageSize
=
GetParent
()
->
GetPageSizeIU
();
GRDashedLine
(
&
m_ClipBox
,
DC
,
0
,
-
screen
->
ReturnPageSize
().
y
,
0
,
screen
->
ReturnPageSize
().
y
,
0
,
axis_color
);
/* Draw the X axis */
// Draw the Y axis
GRDashedLine
(
&
m_ClipBox
,
DC
,
-
screen
->
ReturnPageSize
().
x
,
0
,
GRDashedLine
(
&
m_ClipBox
,
DC
,
0
,
-
pageSize
.
y
,
screen
->
ReturnPageSize
().
x
,
0
,
0
,
axis_color
);
0
,
pageSize
.
y
,
0
,
axis_color
);
// Draw the X axis
GRDashedLine
(
&
m_ClipBox
,
DC
,
-
pageSize
.
x
,
0
,
pageSize
.
x
,
0
,
0
,
axis_color
);
}
}
if
(
GetParent
()
->
m_showOriginAxis
)
if
(
GetParent
()
->
m_showOriginAxis
)
...
@@ -679,26 +680,26 @@ void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, int aDrawMode )
...
@@ -679,26 +680,26 @@ void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, int aDrawMode )
if
(
GetParent
()
->
m_originAxisPosition
==
wxPoint
(
0
,
0
)
)
if
(
GetParent
()
->
m_originAxisPosition
==
wxPoint
(
0
,
0
)
)
return
;
return
;
int
Color
=
DARKRED
;
int
color
=
DARKRED
;
BASE_SCREEN
*
screen
=
GetScreen
();
wxSize
pageSize
=
GetParent
()
->
GetPageSizeIU
();
GRSetDrawMode
(
aDC
,
aDrawMode
);
GRSetDrawMode
(
aDC
,
aDrawMode
);
/
* Draw the Y axis */
/
/ Draw the Y axis
GRDashedLine
(
&
m_ClipBox
,
aDC
,
GRDashedLine
(
&
m_ClipBox
,
aDC
,
GetParent
()
->
m_originAxisPosition
.
x
,
GetParent
()
->
m_originAxisPosition
.
x
,
-
screen
->
ReturnPageSize
()
.
y
,
-
pageSize
.
y
,
GetParent
()
->
m_originAxisPosition
.
x
,
GetParent
()
->
m_originAxisPosition
.
x
,
screen
->
ReturnPageSize
()
.
y
,
pageSize
.
y
,
0
,
C
olor
);
0
,
c
olor
);
/
* Draw the X axis */
/
/ Draw the X axis
GRDashedLine
(
&
m_ClipBox
,
aDC
,
GRDashedLine
(
&
m_ClipBox
,
aDC
,
-
screen
->
ReturnPageSize
()
.
x
,
-
pageSize
.
x
,
GetParent
()
->
m_originAxisPosition
.
y
,
GetParent
()
->
m_originAxisPosition
.
y
,
screen
->
ReturnPageSize
()
.
x
,
pageSize
.
x
,
GetParent
()
->
m_originAxisPosition
.
y
,
GetParent
()
->
m_originAxisPosition
.
y
,
0
,
C
olor
);
0
,
c
olor
);
}
}
...
@@ -710,25 +711,26 @@ void EDA_DRAW_PANEL::DrawGridAxis( wxDC* aDC, int aDrawMode )
...
@@ -710,25 +711,26 @@ void EDA_DRAW_PANEL::DrawGridAxis( wxDC* aDC, int aDrawMode )
||
(
screen
->
m_GridOrigin
.
x
==
0
&&
screen
->
m_GridOrigin
.
y
==
0
)
)
||
(
screen
->
m_GridOrigin
.
x
==
0
&&
screen
->
m_GridOrigin
.
y
==
0
)
)
return
;
return
;
int
Color
=
GetParent
()
->
GetGridColor
();
int
color
=
GetParent
()
->
GetGridColor
();
wxSize
pageSize
=
GetParent
()
->
GetPageSizeIU
();
GRSetDrawMode
(
aDC
,
aDrawMode
);
GRSetDrawMode
(
aDC
,
aDrawMode
);
/
* Draw the Y axis */
/
/ Draw the Y axis
GRDashedLine
(
&
m_ClipBox
,
aDC
,
GRDashedLine
(
&
m_ClipBox
,
aDC
,
screen
->
m_GridOrigin
.
x
,
screen
->
m_GridOrigin
.
x
,
-
screen
->
ReturnPageSize
()
.
y
,
-
pageSize
.
y
,
screen
->
m_GridOrigin
.
x
,
screen
->
m_GridOrigin
.
x
,
screen
->
ReturnPageSize
()
.
y
,
pageSize
.
y
,
0
,
C
olor
);
0
,
c
olor
);
/
* Draw the X axis */
/
/ Draw the X axis
GRDashedLine
(
&
m_ClipBox
,
aDC
,
GRDashedLine
(
&
m_ClipBox
,
aDC
,
-
screen
->
ReturnPageSize
()
.
x
,
-
pageSize
.
x
,
screen
->
m_GridOrigin
.
y
,
screen
->
m_GridOrigin
.
y
,
screen
->
ReturnPageSize
()
.
x
,
pageSize
.
x
,
screen
->
m_GridOrigin
.
y
,
screen
->
m_GridOrigin
.
y
,
0
,
C
olor
);
0
,
c
olor
);
}
}
...
...
common/worksheet.cpp
View file @
0d459865
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
#include "build_version.h"
#include "build_version.h"
/
* Must be defined in main applications: */
/
/ Must be defined in main applications:
Ki_WorkSheetData
WS_Date
=
Ki_WorkSheetData
WS_Date
=
{
{
...
@@ -186,7 +186,9 @@ Ki_WorkSheetData WS_Comment4 =
...
@@ -186,7 +186,9 @@ Ki_WorkSheetData WS_Comment4 =
NULL
,
NULL
NULL
,
NULL
};
};
Ki_WorkSheetData
WS_MostLeftLine
=
/* Left vertical segment */
/// Left vertical segment
Ki_WorkSheetData
WS_MostLeftLine
=
{
{
WS_LEFT_SEGMENT
,
WS_LEFT_SEGMENT
,
#if defined(KICAD_GOST)
#if defined(KICAD_GOST)
...
@@ -200,8 +202,9 @@ Ki_WorkSheetData WS_MostLeftLine = /* Left vertical segment */
...
@@ -200,8 +202,9 @@ Ki_WorkSheetData WS_MostLeftLine = /* Left vertical segment */
NULL
,
NULL
NULL
,
NULL
};
};
Ki_WorkSheetData
WS_SeparatorLine
=
/* horizontal segment between filename
* and comments */
/// horizontal segment between filename and comments
Ki_WorkSheetData
WS_SeparatorLine
=
{
{
WS_SEGMENT
,
WS_SEGMENT
,
&
WS_MostUpperLine
,
&
WS_MostUpperLine
,
...
@@ -211,7 +214,9 @@ Ki_WorkSheetData WS_SeparatorLine = /* horizontal segment between filename
...
@@ -211,7 +214,9 @@ Ki_WorkSheetData WS_SeparatorLine = /* horizontal segment between filename
NULL
,
NULL
NULL
,
NULL
};
};
Ki_WorkSheetData
WS_MostUpperLine
=
/* superior horizontal segment */
/// superior horizontal segment
Ki_WorkSheetData
WS_MostUpperLine
=
{
{
WS_UPPER_SEGMENT
,
WS_UPPER_SEGMENT
,
&
WS_Segm3
,
&
WS_Segm3
,
...
@@ -225,7 +230,9 @@ Ki_WorkSheetData WS_MostUpperLine = /* superior horizontal segment */
...
@@ -225,7 +230,9 @@ Ki_WorkSheetData WS_MostUpperLine = /* superior horizontal segment */
NULL
,
NULL
NULL
,
NULL
};
};
Ki_WorkSheetData
WS_Segm3
=
/* horizontal segment above COMPANY NAME */
/// horizontal segment above COMPANY NAME
Ki_WorkSheetData
WS_Segm3
=
{
{
WS_SEGMENT
,
WS_SEGMENT
,
&
WS_Segm4
,
&
WS_Segm4
,
...
@@ -239,7 +246,9 @@ Ki_WorkSheetData WS_Segm3 = /* horizontal segment above COMPANY NAME */
...
@@ -239,7 +246,9 @@ Ki_WorkSheetData WS_Segm3 = /* horizontal segment above COMPANY NAME */
NULL
,
NULL
NULL
,
NULL
};
};
Ki_WorkSheetData
WS_Segm4
=
/* vertical segment of the left REV and SHEET */
/// vertical segment of the left REV and SHEET
Ki_WorkSheetData
WS_Segm4
=
{
{
WS_SEGMENT
,
WS_SEGMENT
,
&
WS_Segm5
,
&
WS_Segm5
,
...
@@ -253,6 +262,7 @@ Ki_WorkSheetData WS_Segm4 = /* vertical segment of the left REV and SHEET */
...
@@ -253,6 +262,7 @@ Ki_WorkSheetData WS_Segm4 = /* vertical segment of the left REV and SHEET */
NULL
,
NULL
NULL
,
NULL
};
};
Ki_WorkSheetData
WS_Segm5
=
Ki_WorkSheetData
WS_Segm5
=
{
{
WS_SEGMENT
,
WS_SEGMENT
,
...
@@ -267,6 +277,7 @@ Ki_WorkSheetData WS_Segm5 =
...
@@ -267,6 +277,7 @@ Ki_WorkSheetData WS_Segm5 =
NULL
,
NULL
NULL
,
NULL
};
};
Ki_WorkSheetData
WS_Segm6
=
Ki_WorkSheetData
WS_Segm6
=
{
{
WS_SEGMENT
,
WS_SEGMENT
,
...
@@ -281,6 +292,7 @@ Ki_WorkSheetData WS_Segm6 =
...
@@ -281,6 +292,7 @@ Ki_WorkSheetData WS_Segm6 =
NULL
,
NULL
NULL
,
NULL
};
};
Ki_WorkSheetData
WS_Segm7
=
Ki_WorkSheetData
WS_Segm7
=
{
{
WS_SEGMENT
,
WS_SEGMENT
,
...
@@ -989,14 +1001,14 @@ Ki_WorkSheetData WS_Segm5_LT =
...
@@ -989,14 +1001,14 @@ Ki_WorkSheetData WS_Segm5_LT =
};
};
/* Draw the page reference sheet.
*/
void
EDA_DRAW_FRAME
::
TraceWorkSheet
(
wxDC
*
DC
,
BASE_SCREEN
*
screen
,
int
line_width
)
void
EDA_DRAW_FRAME
::
TraceWorkSheet
(
wxDC
*
DC
,
BASE_SCREEN
*
screen
,
int
line_width
)
{
{
if
(
!
m_showBorderAndTitleBlock
)
if
(
!
m_showBorderAndTitleBlock
)
return
;
return
;
Ki_PageDescr
*
Sheet
=
screen
->
m_CurrentSheetDesc
;
const
PAGE_INFO
&
pageInfo
=
GetPageSettings
();
wxSize
pageSize
=
pageInfo
.
GetSizeMils
();
int
ii
,
jj
,
xg
,
yg
,
ipas
,
gxpas
,
gypas
;
int
ii
,
jj
,
xg
,
yg
,
ipas
,
gxpas
,
gypas
;
wxPoint
pos
;
wxPoint
pos
;
int
refx
,
refy
;
int
refx
,
refy
;
...
@@ -1017,28 +1029,27 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
...
@@ -1017,28 +1029,27 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
int
width
=
line_width
;
int
width
=
line_width
;
Color
=
RED
;
Color
=
RED
;
if
(
Sheet
==
NULL
)
{
DisplayError
(
this
,
wxT
(
"EDA_DRAW_FRAME::TraceWorkSheet() error: NULL Sheet"
)
);
return
;
}
// if not printing, draw the page limits:
// if not printing, draw the page limits:
if
(
!
screen
->
m_IsPrinting
&
g_ShowPageLimits
)
if
(
!
screen
->
m_IsPrinting
&
g_ShowPageLimits
)
{
{
GRSetDrawMode
(
DC
,
GR_COPY
);
GRSetDrawMode
(
DC
,
GR_COPY
);
GRRect
(
&
DrawPanel
->
m_ClipBox
,
DC
,
0
,
0
,
GRRect
(
&
DrawPanel
->
m_ClipBox
,
DC
,
0
,
0
,
Sheet
->
m_Size
.
x
*
scale
,
Sheet
->
m_
Size
.
y
*
scale
,
width
,
pageSize
.
x
*
scale
,
page
Size
.
y
*
scale
,
width
,
g_DrawBgColor
==
WHITE
?
LIGHTGRAY
:
DARKDARKGRAY
);
g_DrawBgColor
==
WHITE
?
LIGHTGRAY
:
DARKDARKGRAY
);
}
}
GRSetDrawMode
(
DC
,
GR_COPY
);
GRSetDrawMode
(
DC
,
GR_COPY
);
/* Draw the border. */
refx
=
Sheet
->
m_LeftMargin
;
// Draw the border.
refy
=
Sheet
->
m_TopMargin
;
/* Upper left corner */
xg
=
Sheet
->
m_Size
.
x
-
Sheet
->
m_RightMargin
;
// Upper left corner
yg
=
Sheet
->
m_Size
.
y
-
Sheet
->
m_BottomMargin
;
/* lower right corner */
refx
=
pageInfo
.
GetLeftMarginMils
();
refy
=
pageInfo
.
GetTopMarginMils
();
// lower right corner
xg
=
pageSize
.
x
-
pageInfo
.
GetRightMarginMils
();
yg
=
pageSize
.
y
-
pageInfo
.
GetBottomMarginMils
();
#if defined(KICAD_GOST)
#if defined(KICAD_GOST)
GRRect
(
&
DrawPanel
->
m_ClipBox
,
DC
,
refx
*
scale
,
refy
*
scale
,
GRRect
(
&
DrawPanel
->
m_ClipBox
,
DC
,
refx
*
scale
,
refy
*
scale
,
...
@@ -1056,10 +1067,11 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
...
@@ -1056,10 +1067,11 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
#endif
#endif
/* Draw the reference legends. */
// Draw the reference legends.
refx
=
Sheet
->
m_LeftMargin
;
refx
=
pageInfo
.
GetLeftMarginMils
();
#if defined(KICAD_GOST)
#if defined(KICAD_GOST)
refy
=
Sheet
->
m_Size
.
y
-
Sheet
->
m_BottomMargin
;
/* Lower left corner */
refy
=
pageSize
.
y
-
pageInfo
.
GetBottomMargin
();
// Lower left corner
for
(
WsItem
=
&
WS_Segm1_LU
;
WsItem
!=
NULL
;
WsItem
=
WsItem
->
Pnext
)
for
(
WsItem
=
&
WS_Segm1_LU
;
WsItem
!=
NULL
;
WsItem
=
WsItem
->
Pnext
)
{
{
pos
.
x
=
(
refx
-
WsItem
->
m_Posx
)
*
scale
;
pos
.
x
=
(
refx
-
WsItem
->
m_Posx
)
*
scale
;
...
@@ -1080,15 +1092,15 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
...
@@ -1080,15 +1092,15 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
break
;
break
;
case
WS_SEGMENT_LU
:
case
WS_SEGMENT_LU
:
xg
=
Sheet
->
m_LeftMargin
-
WsItem
->
m_Endx
;
xg
=
pageInfo
.
GetLeftMargin
()
-
WsItem
->
m_Endx
;
yg
=
Sheet
->
m_Size
.
y
-
Sheet
->
m_BottomMargin
-
WsItem
->
m_Endy
;
yg
=
pageSize
.
y
-
pageInfo
.
GetBottomMarginMils
()
-
WsItem
->
m_Endy
;
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
pos
.
x
,
pos
.
y
,
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
pos
.
x
,
pos
.
y
,
xg
*
scale
,
yg
*
scale
,
width
,
Color
);
xg
*
scale
,
yg
*
scale
,
width
,
Color
);
break
;
break
;
}
}
}
}
refy
=
Sheet
->
m_BottomMargin
;
/* Left Top corner */
refy
=
pageInfo
.
GetBottomMarginMils
();
// Left Top corner
for
(
WsItem
=
&
WS_Segm1_LT
;
WsItem
!=
NULL
;
WsItem
=
WsItem
->
Pnext
)
for
(
WsItem
=
&
WS_Segm1_LT
;
WsItem
!=
NULL
;
WsItem
=
WsItem
->
Pnext
)
{
{
pos
.
x
=
(
refx
+
WsItem
->
m_Posx
)
*
scale
;
pos
.
x
=
(
refx
+
WsItem
->
m_Posx
)
*
scale
;
...
@@ -1097,8 +1109,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
...
@@ -1097,8 +1109,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
switch
(
WsItem
->
m_Type
)
switch
(
WsItem
->
m_Type
)
{
{
case
WS_SEGMENT_LT
:
case
WS_SEGMENT_LT
:
xg
=
Sheet
->
m_LeftMargin
+
WsItem
->
m_Endx
;
xg
=
pageInfo
.
GetLeftMarginMils
()
+
WsItem
->
m_Endx
;
yg
=
Sheet
->
m_BottomMargin
+
WsItem
->
m_Endy
;
yg
=
pageInfo
.
GetBottomMarginMils
()
+
WsItem
->
m_Endy
;
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
pos
.
x
,
pos
.
y
,
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
pos
.
x
,
pos
.
y
,
xg
*
scale
,
yg
*
scale
,
width
,
Color
);
xg
*
scale
,
yg
*
scale
,
width
,
Color
);
break
;
break
;
...
@@ -1106,31 +1118,39 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
...
@@ -1106,31 +1118,39 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
}
}
#else
#else
refy
=
Sheet
->
m_TopMargin
;
/* Upper left corner */
xg
=
Sheet
->
m_Size
.
x
-
Sheet
->
m_RightMargin
;
// Upper left corner
yg
=
Sheet
->
m_Size
.
y
-
Sheet
->
m_BottomMargin
;
/* lower right corner */
refy
=
pageInfo
.
GetTopMarginMils
();
// lower right corner
xg
=
pageSize
.
x
-
pageInfo
.
GetRightMarginMils
();
yg
=
pageSize
.
y
-
pageInfo
.
GetBottomMarginMils
();
ipas
=
(
xg
-
refx
)
/
PAS_REF
;
ipas
=
(
xg
-
refx
)
/
PAS_REF
;
gxpas
=
(
xg
-
refx
)
/
ipas
;
gxpas
=
(
xg
-
refx
)
/
ipas
;
for
(
ii
=
refx
+
gxpas
,
jj
=
1
;
ipas
>
0
;
ii
+=
gxpas
,
jj
++
,
ipas
--
)
for
(
ii
=
refx
+
gxpas
,
jj
=
1
;
ipas
>
0
;
ii
+=
gxpas
,
jj
++
,
ipas
--
)
{
{
Line
.
Printf
(
wxT
(
"%d"
),
jj
);
Line
.
Printf
(
wxT
(
"%d"
),
jj
);
if
(
ii
<
xg
-
PAS_REF
/
2
)
if
(
ii
<
xg
-
PAS_REF
/
2
)
{
{
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
ii
*
scale
,
refy
*
scale
,
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
ii
*
scale
,
refy
*
scale
,
ii
*
scale
,
(
refy
+
GRID_REF_W
)
*
scale
,
width
,
Color
);
ii
*
scale
,
(
refy
+
GRID_REF_W
)
*
scale
,
width
,
Color
);
}
}
DrawGraphicText
(
DrawPanel
,
DC
,
DrawGraphicText
(
DrawPanel
,
DC
,
wxPoint
(
(
ii
-
gxpas
/
2
)
*
scale
,
wxPoint
(
(
ii
-
gxpas
/
2
)
*
scale
,
(
refy
+
GRID_REF_W
/
2
)
*
scale
),
(
refy
+
GRID_REF_W
/
2
)
*
scale
),
Color
,
Line
,
TEXT_ORIENT_HORIZ
,
size_ref
,
Color
,
Line
,
TEXT_ORIENT_HORIZ
,
size_ref
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
width
,
false
,
false
);
width
,
false
,
false
);
if
(
ii
<
xg
-
PAS_REF
/
2
)
if
(
ii
<
xg
-
PAS_REF
/
2
)
{
{
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
ii
*
scale
,
yg
*
scale
,
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
ii
*
scale
,
yg
*
scale
,
ii
*
scale
,
(
yg
-
GRID_REF_W
)
*
scale
,
width
,
Color
);
ii
*
scale
,
(
yg
-
GRID_REF_W
)
*
scale
,
width
,
Color
);
}
}
DrawGraphicText
(
DrawPanel
,
DC
,
DrawGraphicText
(
DrawPanel
,
DC
,
wxPoint
(
(
ii
-
gxpas
/
2
)
*
scale
,
wxPoint
(
(
ii
-
gxpas
/
2
)
*
scale
,
(
yg
-
GRID_REF_W
/
2
)
*
scale
),
(
yg
-
GRID_REF_W
/
2
)
*
scale
),
...
@@ -1141,28 +1161,33 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
...
@@ -1141,28 +1161,33 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
ipas
=
(
yg
-
refy
)
/
PAS_REF
;
ipas
=
(
yg
-
refy
)
/
PAS_REF
;
gypas
=
(
yg
-
refy
)
/
ipas
;
gypas
=
(
yg
-
refy
)
/
ipas
;
for
(
ii
=
refy
+
gypas
,
jj
=
0
;
ipas
>
0
;
ii
+=
gypas
,
jj
++
,
ipas
--
)
for
(
ii
=
refy
+
gypas
,
jj
=
0
;
ipas
>
0
;
ii
+=
gypas
,
jj
++
,
ipas
--
)
{
{
if
(
jj
<
26
)
if
(
jj
<
26
)
Line
.
Printf
(
wxT
(
"%c"
),
jj
+
'A'
);
Line
.
Printf
(
wxT
(
"%c"
),
jj
+
'A'
);
else
// I hope 52 identifiers are enought...
else
// I hope 52 identifiers are enought...
Line
.
Printf
(
wxT
(
"%c"
),
'a'
+
jj
-
26
);
Line
.
Printf
(
wxT
(
"%c"
),
'a'
+
jj
-
26
);
if
(
ii
<
yg
-
PAS_REF
/
2
)
if
(
ii
<
yg
-
PAS_REF
/
2
)
{
{
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
refx
*
scale
,
ii
*
scale
,
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
refx
*
scale
,
ii
*
scale
,
(
refx
+
GRID_REF_W
)
*
scale
,
ii
*
scale
,
width
,
Color
);
(
refx
+
GRID_REF_W
)
*
scale
,
ii
*
scale
,
width
,
Color
);
}
}
DrawGraphicText
(
DrawPanel
,
DC
,
DrawGraphicText
(
DrawPanel
,
DC
,
wxPoint
(
(
refx
+
GRID_REF_W
/
2
)
*
scale
,
wxPoint
(
(
refx
+
GRID_REF_W
/
2
)
*
scale
,
(
ii
-
gypas
/
2
)
*
scale
),
(
ii
-
gypas
/
2
)
*
scale
),
Color
,
Line
,
TEXT_ORIENT_HORIZ
,
size_ref
,
Color
,
Line
,
TEXT_ORIENT_HORIZ
,
size_ref
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
width
,
false
,
false
);
width
,
false
,
false
);
if
(
ii
<
yg
-
PAS_REF
/
2
)
if
(
ii
<
yg
-
PAS_REF
/
2
)
{
{
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
xg
*
scale
,
ii
*
scale
,
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
xg
*
scale
,
ii
*
scale
,
(
xg
-
GRID_REF_W
)
*
scale
,
ii
*
scale
,
width
,
Color
);
(
xg
-
GRID_REF_W
)
*
scale
,
ii
*
scale
,
width
,
Color
);
}
}
DrawGraphicText
(
DrawPanel
,
DC
,
DrawGraphicText
(
DrawPanel
,
DC
,
wxPoint
(
(
xg
-
GRID_REF_W
/
2
)
*
scale
,
wxPoint
(
(
xg
-
GRID_REF_W
/
2
)
*
scale
,
(
ii
-
gxpas
/
2
)
*
scale
),
(
ii
-
gxpas
/
2
)
*
scale
),
...
@@ -1174,8 +1199,10 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
...
@@ -1174,8 +1199,10 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
#endif
#endif
#if defined(KICAD_GOST)
#if defined(KICAD_GOST)
refx
=
Sheet
->
m_Size
.
x
-
Sheet
->
m_RightMargin
;
// lower right corner
refy
=
Sheet
->
m_Size
.
y
-
Sheet
->
m_BottomMargin
;
/* lower right corner */
refx
=
pageSize
.
x
-
pageInfo
.
GetRightMarginMils
();
refy
=
pageSize
.
y
-
pageInfo
.
GetBottomMarginMils
();
if
(
screen
->
m_ScreenNumber
==
1
)
if
(
screen
->
m_ScreenNumber
==
1
)
{
{
for
(
WsItem
=
&
WS_Date
;
WsItem
!=
NULL
;
WsItem
=
WsItem
->
Pnext
)
for
(
WsItem
=
&
WS_Date
;
WsItem
!=
NULL
;
WsItem
=
WsItem
->
Pnext
)
...
@@ -1197,6 +1224,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
...
@@ -1197,6 +1224,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
case
WS_PODPIS
:
case
WS_PODPIS
:
if
(
WsItem
->
m_Legende
)
if
(
WsItem
->
m_Legende
)
msg
=
WsItem
->
m_Legende
;
msg
=
WsItem
->
m_Legende
;
DrawGraphicText
(
DrawPanel
,
DC
,
pos
,
Color
,
DrawGraphicText
(
DrawPanel
,
DC
,
pos
,
Color
,
msg
,
TEXT_ORIENT_HORIZ
,
size
,
msg
,
TEXT_ORIENT_HORIZ
,
size
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_CENTER
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_CENTER
,
...
@@ -1258,8 +1286,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
...
@@ -1258,8 +1286,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
width
,
width
,
false
,
false
);
false
,
false
);
pos
.
x
=
(
Sheet
->
m_LeftMargin
+
1260
)
*
scale
;
pos
.
x
=
(
pageInfo
.
GetLeftMarginMils
()
+
1260
)
*
scale
;
pos
.
y
=
(
Sheet
->
m_TopMargin
+
270
)
*
scale
;
pos
.
y
=
(
pageInfo
.
GetTopMarginMils
()
+
270
)
*
scale
;
DrawGraphicText
(
DrawPanel
,
DC
,
pos
,
Color
,
DrawGraphicText
(
DrawPanel
,
DC
,
pos
,
Color
,
msg
,
1800
,
size2
,
msg
,
1800
,
size2
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
...
@@ -1308,10 +1336,10 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
...
@@ -1308,10 +1336,10 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
pos
.
y
=
(
refy
-
WsItem
->
m_Posy
)
*
scale
;
pos
.
y
=
(
refy
-
WsItem
->
m_Posy
)
*
scale
;
case
WS_SEGMENT
:
case
WS_SEGMENT
:
xg
=
Sheet
->
m_
Size
.
x
-
xg
=
page
Size
.
x
-
Sheet
->
m_RightMargin
-
WsItem
->
m_Endx
;
pageInfo
.
GetRightMarginMils
()
-
WsItem
->
m_Endx
;
yg
=
Sheet
->
m_
Size
.
y
-
yg
=
page
Size
.
y
-
Sheet
->
m_BottomMargin
-
WsItem
->
m_Endy
;
pageInfo
.
GetBottomMarginMils
()
-
WsItem
->
m_Endy
;
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
pos
.
x
,
pos
.
y
,
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
pos
.
x
,
pos
.
y
,
xg
*
scale
,
yg
*
scale
,
width
,
Color
);
xg
*
scale
,
yg
*
scale
,
width
,
Color
);
break
;
break
;
...
@@ -1325,10 +1353,11 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
...
@@ -1325,10 +1353,11 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
pos
.
x
=
(
refx
-
WsItem
->
m_Posx
)
*
scale
;
pos
.
x
=
(
refx
-
WsItem
->
m_Posx
)
*
scale
;
pos
.
y
=
(
refy
-
WsItem
->
m_Posy
)
*
scale
;
pos
.
y
=
(
refy
-
WsItem
->
m_Posy
)
*
scale
;
msg
.
Empty
();
msg
.
Empty
();
switch
(
WsItem
->
m_Type
)
switch
(
WsItem
->
m_Type
)
{
{
case
WS_CADRE
:
case
WS_CADRE
:
/
* Begin list number > 1 */
/
/ Begin list number > 1
msg
=
screen
->
m_Commentaire1
;
msg
=
screen
->
m_Commentaire1
;
if
(
!
msg
.
IsEmpty
()
)
if
(
!
msg
.
IsEmpty
()
)
{
{
...
@@ -1337,8 +1366,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
...
@@ -1337,8 +1366,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
width
,
width
,
false
,
false
);
false
,
false
);
pos
.
x
=
(
Sheet
->
m_LeftMargin
+
1260
)
*
scale
;
pos
.
x
=
(
pageInfo
.
GetLeftMarginMils
()
+
1260
)
*
scale
;
pos
.
y
=
(
Sheet
->
m_TopMargin
+
270
)
*
scale
;
pos
.
y
=
(
pageInfo
.
GetTopMarginMils
()
+
270
)
*
scale
;
DrawGraphicText
(
DrawPanel
,
DC
,
pos
,
Color
,
DrawGraphicText
(
DrawPanel
,
DC
,
pos
,
Color
,
msg
,
1800
,
size2
,
msg
,
1800
,
size2
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
...
@@ -1371,19 +1400,21 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
...
@@ -1371,19 +1400,21 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
pos
.
y
=
(
refy
-
WsItem
->
m_Posy
)
*
scale
;
pos
.
y
=
(
refy
-
WsItem
->
m_Posy
)
*
scale
;
case
WS_SEGMENT_D
:
case
WS_SEGMENT_D
:
xg
=
Sheet
->
m_
Size
.
x
-
xg
=
page
Size
.
x
-
Sheet
->
m_RightMargin
-
WsItem
->
m_Endx
;
pageInfo
.
GetRightMarginMils
()
-
WsItem
->
m_Endx
;
yg
=
Sheet
->
m_
Size
.
y
-
yg
=
page
Size
.
y
-
Sheet
->
m_BottomMargin
-
WsItem
->
m_Endy
;
pageInfo
.
GetBottomMarginMils
()
-
WsItem
->
m_Endy
;
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
pos
.
x
,
pos
.
y
,
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
pos
.
x
,
pos
.
y
,
xg
*
scale
,
yg
*
scale
,
width
,
Color
);
xg
*
scale
,
yg
*
scale
,
width
,
Color
);
break
;
break
;
}
}
}
}
}
}
#else
#else
refx
=
Sheet
->
m_Size
.
x
-
Sheet
->
m_RightMargin
-
GRID_REF_W
;
refy
=
Sheet
->
m_Size
.
y
-
Sheet
->
m_BottomMargin
-
GRID_REF_W
;
refx
=
pageSize
.
x
-
pageInfo
.
GetRightMarginMils
()
-
GRID_REF_W
;
refy
=
pageSize
.
y
-
pageInfo
.
GetBottomMarginMils
()
-
GRID_REF_W
;
for
(
WsItem
=
&
WS_Date
;
WsItem
!=
NULL
;
WsItem
=
WsItem
->
Pnext
)
for
(
WsItem
=
&
WS_Date
;
WsItem
!=
NULL
;
WsItem
=
WsItem
->
Pnext
)
{
{
...
@@ -1428,7 +1459,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
...
@@ -1428,7 +1459,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
case
WS_SIZESHEET
:
case
WS_SIZESHEET
:
if
(
WsItem
->
m_Legende
)
if
(
WsItem
->
m_Legende
)
msg
=
WsItem
->
m_Legende
;
msg
=
WsItem
->
m_Legende
;
msg
+=
Sheet
->
m_Name
;
msg
+=
pageInfo
.
GetType
()
;
DrawGraphicText
(
DrawPanel
,
DC
,
pos
,
Color
,
DrawGraphicText
(
DrawPanel
,
DC
,
pos
,
Color
,
msg
,
TEXT_ORIENT_HORIZ
,
size
,
msg
,
TEXT_ORIENT_HORIZ
,
size
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_CENTER
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_CENTER
,
...
@@ -1566,10 +1597,10 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
...
@@ -1566,10 +1597,10 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
pos
.
y
=
(
refy
-
WsItem
->
m_Posy
)
*
scale
;
pos
.
y
=
(
refy
-
WsItem
->
m_Posy
)
*
scale
;
case
WS_SEGMENT
:
case
WS_SEGMENT
:
xg
=
Sheet
->
m_
Size
.
x
-
xg
=
page
Size
.
x
-
GRID_REF_W
-
Sheet
->
m_RightMargin
-
WsItem
->
m_Endx
;
GRID_REF_W
-
pageInfo
.
GetRightMarginMils
()
-
WsItem
->
m_Endx
;
yg
=
Sheet
->
m_
Size
.
y
-
yg
=
page
Size
.
y
-
GRID_REF_W
-
Sheet
->
m_BottomMargin
-
WsItem
->
m_Endy
;
GRID_REF_W
-
pageInfo
.
GetBottomMarginMils
()
-
WsItem
->
m_Endy
;
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
pos
.
x
,
pos
.
y
,
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
pos
.
x
,
pos
.
y
,
xg
*
scale
,
yg
*
scale
,
width
,
Color
);
xg
*
scale
,
yg
*
scale
,
width
,
Color
);
break
;
break
;
...
@@ -1580,50 +1611,43 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
...
@@ -1580,50 +1611,43 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
}
}
/**
const
wxString
EDA_DRAW_FRAME
::
GetXYSheetReferences
(
const
wxPoint
&
aPosition
)
* Function GetXYSheetReferences
* Return the X,Y sheet references where the point position is located
* @param aScreen = screen to use
* @param aPosition = position to identify by YX ref
* @return a wxString containing the message locator like A3 or B6 (or ?? if out of page limits)
*/
wxString
EDA_DRAW_FRAME
::
GetXYSheetReferences
(
BASE_SCREEN
*
aScreen
,
const
wxPoint
&
aPosition
)
{
{
Ki_PageDescr
*
Sheet
=
aScreen
->
m_CurrentSheetDesc
;
const
PAGE_INFO
&
pageInfo
=
GetPageSettings
();
int
ii
,
xg
,
yg
,
ipas
,
gxpas
,
gypas
;
int
refx
,
refy
;
wxString
msg
;
if
(
Sheet
==
NULL
)
int
ii
;
{
int
xg
,
yg
;
DisplayError
(
this
,
int
ipas
;
wxT
(
"EDA_DRAW_FRAME::GetXYSheetReferences() error: NULL Sheet"
)
);
int
gxpas
,
gypas
;
return
msg
;
int
refx
,
refy
;
}
wxString
msg
;
// Upper left corner
refx
=
pageInfo
.
GetLeftMarginMils
();
refy
=
pageInfo
.
GetTopMarginMils
();
refx
=
Sheet
->
m_LeftMargin
;
// lower right corner
refy
=
Sheet
->
m_TopMargin
;
/* Upper left corner */
xg
=
pageInfo
.
GetSizeMils
().
x
-
pageInfo
.
GetRightMarginMils
();
xg
=
Sheet
->
m_Size
.
x
-
Sheet
->
m_RightMargin
;
yg
=
pageInfo
.
GetSizeMils
().
y
-
pageInfo
.
GetBottomMarginMils
();
yg
=
Sheet
->
m_Size
.
y
-
Sheet
->
m_BottomMargin
;
/* lower right corner */
/
* Get the Y axis identifier (A symbol A ... Z) */
/
/ Get the Y axis identifier (A symbol A ... Z)
if
(
aPosition
.
y
<
refy
||
aPosition
.
y
>
yg
)
// Ouside of Y limits
if
(
aPosition
.
y
<
refy
||
aPosition
.
y
>
yg
)
// Ouside of Y limits
msg
<<
wxT
(
"?"
);
msg
<<
wxT
(
"?"
);
else
else
{
{
ipas
=
(
yg
-
refy
)
/
PAS_REF
;
// ipas = Y count sections
ipas
=
(
yg
-
refy
)
/
PAS_REF
;
// ipas = Y count sections
gypas
=
(
yg
-
refy
)
/
ipas
;
// gypas = Y section size
gypas
=
(
yg
-
refy
)
/
ipas
;
// gypas = Y section size
ii
=
(
aPosition
.
y
-
refy
)
/
gypas
;
ii
=
(
aPosition
.
y
-
refy
)
/
gypas
;
msg
.
Printf
(
wxT
(
"%c"
),
'A'
+
ii
);
msg
.
Printf
(
wxT
(
"%c"
),
'A'
+
ii
);
}
}
/
* Get the X axis identifier (A number 1 ... n) */
/
/ Get the X axis identifier (A number 1 ... n)
if
(
aPosition
.
x
<
refx
||
aPosition
.
x
>
xg
)
// Ouside of X limits
if
(
aPosition
.
x
<
refx
||
aPosition
.
x
>
xg
)
// Ouside of X limits
msg
<<
wxT
(
"?"
);
msg
<<
wxT
(
"?"
);
else
else
{
{
ipas
=
(
xg
-
refx
)
/
PAS_REF
;
// ipas = X count sections
ipas
=
(
xg
-
refx
)
/
PAS_REF
;
// ipas = X count sections
gxpas
=
(
xg
-
refx
)
/
ipas
;
// gxpas = X section size
gxpas
=
(
xg
-
refx
)
/
ipas
;
// gxpas = X section size
ii
=
(
aPosition
.
x
-
refx
)
/
gxpas
;
ii
=
(
aPosition
.
x
-
refx
)
/
gxpas
;
msg
<<
ii
+
1
;
msg
<<
ii
+
1
;
...
...
eeschema/dialogs/dialog_SVG_print.h
View file @
0d459865
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
class
EDA_DRAW_FRAME
;
class
EDA_DRAW_FRAME
;
class
BASE_SCREEN
;
#include "dialog_SVG_print_base.h"
#include "dialog_SVG_print_base.h"
...
...
eeschema/dialogs/dialog_build_BOM.cpp
View file @
0d459865
...
@@ -567,8 +567,8 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
...
@@ -567,8 +567,8 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
bool
CompactForm
)
bool
CompactForm
)
{
{
#if defined(KICAD_GOST)
#if defined(KICAD_GOST)
wxString
outStr
;
wxString
outStr
;
wxString
tmpStr
;
wxString
tmpStr
;
#endif
#endif
if
(
IsFieldChecked
(
FOOTPRINT
)
)
if
(
IsFieldChecked
(
FOOTPRINT
)
)
...
@@ -577,7 +577,7 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
...
@@ -577,7 +577,7 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
{
{
#if defined(KICAD_GOST)
#if defined(KICAD_GOST)
outStr
.
Printf
(
wxT
(
"%c%s"
),
s_ExportSeparatorSymbol
,
outStr
.
Printf
(
wxT
(
"%c%s"
),
s_ExportSeparatorSymbol
,
GetChars
(
DrawLibItem
->
GetField
(
FOOTPRINT
)
->
m_Text
)
);
GetChars
(
DrawLibItem
->
GetField
(
FOOTPRINT
)
->
m_Text
)
);
#else
#else
fprintf
(
f
,
"%c%s"
,
s_ExportSeparatorSymbol
,
fprintf
(
f
,
"%c%s"
,
s_ExportSeparatorSymbol
,
TO_UTF8
(
DrawLibItem
->
GetField
(
FOOTPRINT
)
->
m_Text
)
);
TO_UTF8
(
DrawLibItem
->
GetField
(
FOOTPRINT
)
->
m_Text
)
);
...
@@ -602,10 +602,10 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
...
@@ -602,10 +602,10 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
if
(
CompactForm
)
if
(
CompactForm
)
#if defined(KICAD_GOST)
#if defined(KICAD_GOST)
{
{
tmpStr
.
Printf
(
wxT
(
"%c%s"
),
s_ExportSeparatorSymbol
,
tmpStr
.
Printf
(
wxT
(
"%c%s"
),
s_ExportSeparatorSymbol
,
GetChars
(
DrawLibItem
->
GetField
(
ii
)
->
m_Text
)
);
GetChars
(
DrawLibItem
->
GetField
(
ii
)
->
m_Text
)
);
outStr
+=
tmpStr
;
outStr
+=
tmpStr
;
}
}
#else
#else
fprintf
(
f
,
"%c%s"
,
s_ExportSeparatorSymbol
,
fprintf
(
f
,
"%c%s"
,
s_ExportSeparatorSymbol
,
...
@@ -613,10 +613,10 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
...
@@ -613,10 +613,10 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
#endif
#endif
else
else
#if defined(KICAD_GOST)
#if defined(KICAD_GOST)
{
{
tmpStr
.
Printf
(
wxT
(
"; %-12s"
),
tmpStr
.
Printf
(
wxT
(
"; %-12s"
),
GetChars
(
DrawLibItem
->
GetField
(
ii
)
->
m_Text
)
);
GetChars
(
DrawLibItem
->
GetField
(
ii
)
->
m_Text
)
);
outStr
+=
tmpStr
;
outStr
+=
tmpStr
;
}
}
#else
#else
fprintf
(
f
,
"; %-12s"
,
fprintf
(
f
,
"; %-12s"
,
...
@@ -750,11 +750,11 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
...
@@ -750,11 +750,11 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
{
{
#if defined(KICAD_GOST)
#if defined(KICAD_GOST)
strCur
.
Printf
(
wxT
(
"%c%s"
),
s_ExportSeparatorSymbol
,
GetChars
(
msg
)
);
strCur
.
Printf
(
wxT
(
"%c%s"
),
s_ExportSeparatorSymbol
,
GetChars
(
msg
)
);
msg
=
m_Parent
->
GetXYSheetReferences
(
screen
,
comp
->
GetPosition
()
);
msg
=
m_Parent
->
GetXYSheetReferences
(
comp
->
GetPosition
()
);
strCur
.
Printf
(
wxT
(
"%c%s)"
),
s_ExportSeparatorSymbol
,
GetChars
(
msg
)
);
strCur
.
Printf
(
wxT
(
"%c%s)"
),
s_ExportSeparatorSymbol
,
GetChars
(
msg
)
);
#else
#else
fprintf
(
f
,
"%c%s"
,
s_ExportSeparatorSymbol
,
TO_UTF8
(
msg
)
);
fprintf
(
f
,
"%c%s"
,
s_ExportSeparatorSymbol
,
TO_UTF8
(
msg
)
);
msg
=
m_Parent
->
GetXYSheetReferences
(
screen
,
comp
->
GetPosition
()
);
msg
=
m_Parent
->
GetXYSheetReferences
(
comp
->
GetPosition
()
);
fprintf
(
f
,
"%c%s)"
,
s_ExportSeparatorSymbol
,
fprintf
(
f
,
"%c%s)"
,
s_ExportSeparatorSymbol
,
TO_UTF8
(
msg
)
);
TO_UTF8
(
msg
)
);
#endif
#endif
...
@@ -762,7 +762,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
...
@@ -762,7 +762,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
else
else
{
{
fprintf
(
f
,
" (Sheet %s)"
,
TO_UTF8
(
msg
)
);
fprintf
(
f
,
" (Sheet %s)"
,
TO_UTF8
(
msg
)
);
msg
=
m_Parent
->
GetXYSheetReferences
(
screen
,
comp
->
GetPosition
()
);
msg
=
m_Parent
->
GetXYSheetReferences
(
comp
->
GetPosition
()
);
fprintf
(
f
,
" (loc %s)"
,
TO_UTF8
(
msg
)
);
fprintf
(
f
,
" (loc %s)"
,
TO_UTF8
(
msg
)
);
}
}
}
}
...
@@ -828,8 +828,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
...
@@ -828,8 +828,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
#if defined(KICAD_GOST)
#if defined(KICAD_GOST)
else
else
{
{
switch
(
amount
)
switch
(
amount
)
{
{
case
1
:
case
1
:
fprintf
(
f
,
"%s%s%c%d
\n
"
,
CmpNameFirst
.
c_str
(),
TO_UTF8
(
strPred
),
fprintf
(
f
,
"%s%s%c%d
\n
"
,
CmpNameFirst
.
c_str
(),
TO_UTF8
(
strPred
),
s_ExportSeparatorSymbol
,
amount
);
s_ExportSeparatorSymbol
,
amount
);
...
@@ -844,8 +844,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
...
@@ -844,8 +844,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
fprintf
(
f
,
"%s..%s%s%c%d
\n
"
,
CmpNameFirst
.
c_str
(),
CmpNameLast
.
c_str
(),
fprintf
(
f
,
"%s..%s%s%c%d
\n
"
,
CmpNameFirst
.
c_str
(),
CmpNameLast
.
c_str
(),
TO_UTF8
(
strPred
),
s_ExportSeparatorSymbol
,
amount
);
TO_UTF8
(
strPred
),
s_ExportSeparatorSymbol
,
amount
);
break
;
break
;
}
}
}
}
#endif
#endif
return
0
;
return
0
;
...
@@ -1060,13 +1060,13 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( FILE* f,
...
@@ -1060,13 +1060,13 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( FILE* f,
{
{
msg
=
aList
[
ii
].
GetSheetPath
().
PathHumanReadable
();
msg
=
aList
[
ii
].
GetSheetPath
().
PathHumanReadable
();
fprintf
(
f
,
" (Sheet %s)"
,
TO_UTF8
(
msg
)
);
fprintf
(
f
,
" (Sheet %s)"
,
TO_UTF8
(
msg
)
);
msg
=
m_Parent
->
GetXYSheetReferences
(
screen
,
DrawLibItem
->
GetPosition
()
);
msg
=
m_Parent
->
GetXYSheetReferences
(
DrawLibItem
->
GetPosition
()
);
fprintf
(
f
,
" (loc %s)"
,
TO_UTF8
(
msg
)
);
fprintf
(
f
,
" (loc %s)"
,
TO_UTF8
(
msg
)
);
}
}
}
}
#if defined(KICAD_GOST)
#if defined(KICAD_GOST)
fprintf
(
f
,
"%s"
,
TO_UTF8
(
PrintFieldData
(
DrawLibItem
)
)
);
fprintf
(
f
,
"%s"
,
TO_UTF8
(
PrintFieldData
(
DrawLibItem
)
)
);
#else
#else
PrintFieldData
(
f
,
DrawLibItem
);
PrintFieldData
(
f
,
DrawLibItem
);
#endif
#endif
...
...
eeschema/dialogs/dialog_plot_schematic_DXF.cpp
View file @
0d459865
...
@@ -64,7 +64,7 @@ private:
...
@@ -64,7 +64,7 @@ private:
void
initOptVars
();
void
initOptVars
();
void
CreateDXFFile
();
void
CreateDXFFile
();
void
PlotOneSheetDXF
(
const
wxString
&
FileName
,
void
PlotOneSheetDXF
(
const
wxString
&
FileName
,
SCH_SCREEN
*
screen
,
Ki_PageDescr
*
sheet
,
SCH_SCREEN
*
screen
,
PAGE_INFO
*
sheet
,
wxPoint
plot_offset
,
double
scale
);
wxPoint
plot_offset
,
double
scale
);
};
};
/* static members (static to remember last state): */
/* static members (static to remember last state): */
...
@@ -148,7 +148,7 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
...
@@ -148,7 +148,7 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
SCH_SHEET_PATH
*
sheetpath
;
SCH_SHEET_PATH
*
sheetpath
;
SCH_SHEET_PATH
oldsheetpath
=
schframe
->
GetCurrentSheet
();
SCH_SHEET_PATH
oldsheetpath
=
schframe
->
GetCurrentSheet
();
wxString
PlotFileName
;
wxString
PlotFileName
;
Ki_PageDescr
*
PlotSheet
;
PAGE_INFO
*
PlotSheet
;
wxPoint
plot_offset
;
wxPoint
plot_offset
;
/* When printing all pages, the printed page is not the current page.
/* When printing all pages, the printed page is not the current page.
...
@@ -208,7 +208,7 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
...
@@ -208,7 +208,7 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
void
DIALOG_PLOT_SCHEMATIC_DXF
::
PlotOneSheetDXF
(
const
wxString
&
FileName
,
void
DIALOG_PLOT_SCHEMATIC_DXF
::
PlotOneSheetDXF
(
const
wxString
&
FileName
,
SCH_SCREEN
*
screen
,
SCH_SCREEN
*
screen
,
Ki_PageDescr
*
sheet
,
PAGE_INFO
*
sheet
,
wxPoint
plot_offset
,
wxPoint
plot_offset
,
double
scale
)
double
scale
)
{
{
...
...
eeschema/dialogs/dialog_plot_schematic_HPGL.cpp
View file @
0d459865
...
@@ -54,7 +54,7 @@ enum PageFormatReq
...
@@ -54,7 +54,7 @@ enum PageFormatReq
PAGE_SIZE_E
PAGE_SIZE_E
};
};
static
Ki_PageDescr
*
Plot_sheet_list
[]
=
static
PAGE_INFO
*
Plot_sheet_list
[]
=
{
{
NULL
,
NULL
,
&
g_Sheet_A4
,
&
g_Sheet_A4
,
...
@@ -99,7 +99,7 @@ private:
...
@@ -99,7 +99,7 @@ private:
void
HPGL_Plot
(
bool
aPlotAll
);
void
HPGL_Plot
(
bool
aPlotAll
);
void
Plot_Schematic_HPGL
(
bool
aPlotAll
,
int
HPGL_SheetSize
);
void
Plot_Schematic_HPGL
(
bool
aPlotAll
,
int
HPGL_SheetSize
);
void
Plot_1_Page_HPGL
(
const
wxString
&
FileName
,
void
Plot_1_Page_HPGL
(
const
wxString
&
FileName
,
SCH_SCREEN
*
screen
,
Ki_PageDescr
*
sheet
,
SCH_SCREEN
*
screen
,
PAGE_INFO
*
sheet
,
wxPoint
&
offset
,
double
plot_scale
);
wxPoint
&
offset
,
double
plot_scale
);
void
ReturnSheetDims
(
SCH_SCREEN
*
screen
,
wxSize
&
SheetSize
,
wxPoint
&
SheetOffset
);
void
ReturnSheetDims
(
SCH_SCREEN
*
screen
,
wxSize
&
SheetSize
,
wxPoint
&
SheetOffset
);
};
};
...
@@ -245,7 +245,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::HPGL_Plot( bool aPlotAll )
...
@@ -245,7 +245,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::HPGL_Plot( bool aPlotAll )
if
(
m_pageSizeSelect
!=
PAGE_DEFAULT
)
if
(
m_pageSizeSelect
!=
PAGE_DEFAULT
)
{
{
Ki_PageDescr
*
plot_sheet
=
Plot_sheet_list
[
m_pageSizeSelect
];
PAGE_INFO
*
plot_sheet
=
Plot_sheet_list
[
m_pageSizeSelect
];
wxString
msg
=
m_PlotOrgPosition_X
->
GetValue
();
wxString
msg
=
m_PlotOrgPosition_X
->
GetValue
();
plot_sheet
->
m_Offset
.
x
=
plot_sheet
->
m_Offset
.
x
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
EESCHEMA_INTERNAL_UNIT
);
ReturnValueFromString
(
g_UserUnit
,
msg
,
EESCHEMA_INTERNAL_UNIT
);
...
@@ -265,7 +265,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::ReturnSheetDims( SCH_SCREEN* screen,
...
@@ -265,7 +265,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::ReturnSheetDims( SCH_SCREEN* screen,
wxSize
&
SheetSize
,
wxSize
&
SheetSize
,
wxPoint
&
SheetOffset
)
wxPoint
&
SheetOffset
)
{
{
Ki_PageDescr
*
PlotSheet
;
PAGE_INFO
*
PlotSheet
;
if
(
screen
==
NULL
)
if
(
screen
==
NULL
)
screen
=
m_Parent
->
GetScreen
();
screen
=
m_Parent
->
GetScreen
();
...
@@ -283,7 +283,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh
...
@@ -283,7 +283,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh
SCH_SCREEN
*
screen
=
m_Parent
->
GetScreen
();
SCH_SCREEN
*
screen
=
m_Parent
->
GetScreen
();
SCH_SHEET_PATH
*
sheetpath
;
SCH_SHEET_PATH
*
sheetpath
;
SCH_SHEET_PATH
oldsheetpath
=
m_Parent
->
GetCurrentSheet
();
SCH_SHEET_PATH
oldsheetpath
=
m_Parent
->
GetCurrentSheet
();
Ki_PageDescr
*
PlotSheet
;
PAGE_INFO
*
PlotSheet
;
wxSize
SheetSize
;
wxSize
SheetSize
;
wxPoint
SheetOffset
,
PlotOffset
;
wxPoint
SheetOffset
,
PlotOffset
;
...
@@ -353,7 +353,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh
...
@@ -353,7 +353,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh
void
DIALOG_PLOT_SCHEMATIC_HPGL
::
Plot_1_Page_HPGL
(
const
wxString
&
FileName
,
void
DIALOG_PLOT_SCHEMATIC_HPGL
::
Plot_1_Page_HPGL
(
const
wxString
&
FileName
,
SCH_SCREEN
*
screen
,
SCH_SCREEN
*
screen
,
Ki_PageDescr
*
sheet
,
PAGE_INFO
*
sheet
,
wxPoint
&
offset
,
wxPoint
&
offset
,
double
plot_scale
)
double
plot_scale
)
{
{
...
...
eeschema/dialogs/dialog_plot_schematic_PS.cpp
View file @
0d459865
...
@@ -70,7 +70,7 @@ private:
...
@@ -70,7 +70,7 @@ private:
void
initOptVars
();
void
initOptVars
();
void
createPSFile
();
void
createPSFile
();
void
plotOneSheetPS
(
const
wxString
&
FileName
,
void
plotOneSheetPS
(
const
wxString
&
FileName
,
SCH_SCREEN
*
screen
,
Ki_PageDescr
*
sheet
,
SCH_SCREEN
*
screen
,
PAGE_INFO
*
sheet
,
wxPoint
plot_offset
,
double
scale
);
wxPoint
plot_offset
,
double
scale
);
};
};
/* static members (static to remember last state): */
/* static members (static to remember last state): */
...
@@ -176,8 +176,8 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
...
@@ -176,8 +176,8 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
SCH_SHEET_PATH
*
sheetpath
;
SCH_SHEET_PATH
*
sheetpath
;
SCH_SHEET_PATH
oldsheetpath
=
m_Parent
->
GetCurrentSheet
();
// sheetpath is saved here
SCH_SHEET_PATH
oldsheetpath
=
m_Parent
->
GetCurrentSheet
();
// sheetpath is saved here
wxString
plotFileName
;
wxString
plotFileName
;
Ki_PageDescr
*
actualPage
;
// page size selected in schematic
PAGE_INFO
*
actualPage
;
// page size selected in schematic
Ki_PageDescr
*
plotPage
;
// page size selected to plot
PAGE_INFO
*
plotPage
;
// page size selected to plot
wxPoint
plot_offset
;
wxPoint
plot_offset
;
/* When printing all pages, the printed page is not the current page.
/* When printing all pages, the printed page is not the current page.
...
@@ -254,7 +254,7 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
...
@@ -254,7 +254,7 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
void
DIALOG_PLOT_SCHEMATIC_PS
::
plotOneSheetPS
(
const
wxString
&
FileName
,
void
DIALOG_PLOT_SCHEMATIC_PS
::
plotOneSheetPS
(
const
wxString
&
FileName
,
SCH_SCREEN
*
screen
,
SCH_SCREEN
*
screen
,
Ki_PageDescr
*
sheet
,
PAGE_INFO
*
sheet
,
wxPoint
plot_offset
,
wxPoint
plot_offset
,
double
scale
)
double
scale
)
{
{
...
...
eeschema/load_one_schematic_file.cpp
View file @
0d459865
...
@@ -305,11 +305,11 @@ bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* aScre
...
@@ -305,11 +305,11 @@ bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* aScre
char
Text
[
256
];
char
Text
[
256
];
char
buf
[
1024
];
char
buf
[
1024
];
int
ii
;
int
ii
;
Ki_PageDescr
*
wsheet
=
&
g_Sheet_A4
;
PAGE_INFO
*
wsheet
=
&
g_Sheet_A4
;
wxSize
PageSize
;
wxSize
PageSize
;
char
*
line
;
char
*
line
;
static
Ki_PageDescr
*
SheetFormatList
[]
=
static
PAGE_INFO
*
SheetFormatList
[]
=
{
{
&
g_Sheet_A4
,
&
g_Sheet_A3
,
&
g_Sheet_A2
,
&
g_Sheet_A1
,
&
g_Sheet_A0
,
&
g_Sheet_A4
,
&
g_Sheet_A3
,
&
g_Sheet_A2
,
&
g_Sheet_A1
,
&
g_Sheet_A0
,
&
g_Sheet_A
,
&
g_Sheet_B
,
&
g_Sheet_C
,
&
g_Sheet_D
,
&
g_Sheet_E
,
&
g_Sheet_A
,
&
g_Sheet_B
,
&
g_Sheet_C
,
&
g_Sheet_D
,
&
g_Sheet_E
,
...
...
eeschema/sch_screen.cpp
View file @
0d459865
...
@@ -101,7 +101,8 @@ SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type )
...
@@ -101,7 +101,8 @@ SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type )
{
{
size_t
i
;
size_t
i
;
SetDrawItems
(
NULL
);
/* Schematic items list */
SetDrawItems
(
NULL
);
// Schematic items list
m_Zoom
=
32
;
m_Zoom
=
32
;
for
(
i
=
0
;
i
<
SCHEMATIC_ZOOM_LIST_CNT
;
i
++
)
for
(
i
=
0
;
i
<
SCHEMATIC_ZOOM_LIST_CNT
;
i
++
)
...
@@ -110,12 +111,12 @@ SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type )
...
@@ -110,12 +111,12 @@ SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type )
for
(
i
=
0
;
i
<
SCHEMATIC_GRID_LIST_CNT
;
i
++
)
for
(
i
=
0
;
i
<
SCHEMATIC_GRID_LIST_CNT
;
i
++
)
AddGrid
(
SchematicGridList
[
i
]
);
AddGrid
(
SchematicGridList
[
i
]
);
SetGrid
(
wxRealPoint
(
50
,
50
)
);
/
* Default grid size. */
SetGrid
(
wxRealPoint
(
50
,
50
)
);
/
/ Default grid size.
m_refCount
=
0
;
m_refCount
=
0
;
m_Center
=
false
;
/* Suitable for schematic only. For
* libedit and viewlib, must be set
m_Center
=
false
;
// Suitable for schematic only. For
* to true */
// libedit and viewlib, must be set
InitDatas
();
// to true
}
}
...
@@ -1547,3 +1548,18 @@ int SCH_SCREENS::GetMarkerCount( int aMarkerType )
...
@@ -1547,3 +1548,18 @@ int SCH_SCREENS::GetMarkerCount( int aMarkerType )
return
count
;
return
count
;
}
}
#if defined(DEBUG)
void
SCH_SCREEN
::
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
const
{
// for now, make it look like XML, expand on this later.
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
GetClass
().
Lower
().
mb_str
()
<<
">
\n
"
;
for
(
EDA_ITEM
*
item
=
m_drawList
;
item
;
item
=
item
->
Next
()
)
{
item
->
Show
(
nestLevel
+
1
,
os
);
}
NestedSpace
(
nestLevel
,
os
)
<<
"</"
<<
GetClass
().
Lower
().
mb_str
()
<<
">
\n
"
;
}
#endif
gerbview/gerbview.cpp
View file @
0d459865
...
@@ -32,7 +32,7 @@ int g_DisplayPolygonsModeSketch;
...
@@ -32,7 +32,7 @@ int g_DisplayPolygonsModeSketch;
GERBER_IMAGE
*
g_GERBER_List
[
32
];
GERBER_IMAGE
*
g_GERBER_List
[
32
];
// List of page sizes
// List of page sizes
Ki_PageDescr
*
g_GerberPageSizeList
[]
=
PAGE_INFO
*
g_GerberPageSizeList
[]
=
{
{
&
g_Sheet_GERBER
,
// Full size page selection, and do not show page limits
&
g_Sheet_GERBER
,
// Full size page selection, and do not show page limits
&
g_Sheet_GERBER
,
// Full size page selection, and show page limits
&
g_Sheet_GERBER
,
// Full size page selection, and show page limits
...
...
gerbview/gerbview.h
View file @
0d459865
...
@@ -19,7 +19,7 @@ class GERBVIEW_FRAME;
...
@@ -19,7 +19,7 @@ class GERBVIEW_FRAME;
//class BOARD;
//class BOARD;
class
GERBER_IMAGE
;
class
GERBER_IMAGE
;
class
Ki_PageDescr
;
class
PAGE_INFO
;
// Type of photoplotter action:
// Type of photoplotter action:
...
@@ -57,8 +57,6 @@ extern int g_DisplayPolygonsModeSketch;
...
@@ -57,8 +57,6 @@ extern int g_DisplayPolygonsModeSketch;
extern
const
wxString
GerbviewProjectFileExt
;
extern
const
wxString
GerbviewProjectFileExt
;
extern
const
wxString
GerbviewProjectFileWildcard
;
extern
const
wxString
GerbviewProjectFileWildcard
;
extern
Ki_PageDescr
*
g_GerberPageSizeList
[];
// Interpolation type
// Interpolation type
enum
Gerb_Interpolation
enum
Gerb_Interpolation
{
{
...
...
gerbview/gerbview_frame.cpp
View file @
0d459865
...
@@ -67,8 +67,8 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
...
@@ -67,8 +67,8 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
m_FrameName
=
wxT
(
"GerberFrame"
);
m_FrameName
=
wxT
(
"GerberFrame"
);
m_show_layer_manager_tools
=
true
;
m_show_layer_manager_tools
=
true
;
m_showAxis
=
true
;
// true to show X and Y axis on screen
m_showAxis
=
true
;
// true to show X and Y axis on screen
m_showBorderAndTitleBlock
=
false
;
// true for reference drawings.
m_showBorderAndTitleBlock
=
false
;
// true for reference drawings.
m_HotkeysZoomAndGridList
=
s_Gerbview_Hokeys_Descr
;
m_HotkeysZoomAndGridList
=
s_Gerbview_Hokeys_Descr
;
m_SelLayerBox
=
NULL
;
m_SelLayerBox
=
NULL
;
m_DCodeSelector
=
NULL
;
m_DCodeSelector
=
NULL
;
...
@@ -83,13 +83,13 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
...
@@ -83,13 +83,13 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
icon
.
CopyFromBitmap
(
KiBitmap
(
icon_gerbview_xpm
)
);
icon
.
CopyFromBitmap
(
KiBitmap
(
icon_gerbview_xpm
)
);
SetIcon
(
icon
);
SetIcon
(
icon
);
SetScreen
(
new
PCB_SCREEN
()
);
GetScreen
()
->
m_CurrentSheetDesc
=
&
g_Sheet_GERBER
;
SetBoard
(
new
BOARD
()
);
SetBoard
(
new
BOARD
()
);
GetBoard
()
->
SetEnabledLayers
(
FULL_LAYERS
);
// All 32 layers enabled at first.
GetBoard
()
->
SetEnabledLayers
(
FULL_LAYERS
);
// All 32 layers enabled at first.
GetBoard
()
->
SetVisibleLayers
(
FULL_LAYERS
);
// All 32 layers visible.
GetBoard
()
->
SetVisibleLayers
(
FULL_LAYERS
);
// All 32 layers visible.
SetScreen
(
new
PCB_SCREEN
()
);
GetScreen
()
->
m_CurrentSheetDesc
=
&
g_Sheet_GERBER
;
// Create the PCB_LAYER_WIDGET *after* SetBoard():
// Create the PCB_LAYER_WIDGET *after* SetBoard():
wxFont
font
=
wxSystemSettings
::
GetFont
(
wxSYS_DEFAULT_GUI_FONT
);
wxFont
font
=
wxSystemSettings
::
GetFont
(
wxSYS_DEFAULT_GUI_FONT
);
int
pointSize
=
font
.
GetPointSize
();
int
pointSize
=
font
.
GetPointSize
();
...
@@ -209,17 +209,15 @@ void GERBVIEW_FRAME::LoadSettings()
...
@@ -209,17 +209,15 @@ void GERBVIEW_FRAME::LoadSettings()
wxGetApp
().
ReadCurrentSetupValues
(
GetConfigurationSettings
()
);
wxGetApp
().
ReadCurrentSetupValues
(
GetConfigurationSettings
()
);
long
pageSize_opt
;
wxString
pageType
;
config
->
Read
(
GerbviewShowPageSizeOption
,
&
pageSize_opt
,
0l
);
int
imax
=
0
;
config
->
Read
(
GerbviewShowPageSizeOption
,
&
pageType
,
wxT
(
"GERBER"
)
)
;
for
(
;
g_GerberPageSizeList
[
imax
]
!=
NULL
;
imax
++
)
PAGE_INFO
pageInfo
(
pageType
);
;
if
(
pageSize_opt
<
0
||
pageSize_opt
>=
imax
)
SetPageSettings
(
pageInfo
);
pageSize_opt
=
0
;
GetScreen
()
->
m_CurrentSheetDesc
=
g_GerberPageSizeList
[
pageSize_opt
]
;
GetScreen
()
->
InitDataPoints
(
pageInfo
.
GetSizeIU
()
)
;
if
(
pageSize_opt
>
0
)
if
(
pageSize_opt
>
0
)
{
{
...
@@ -268,7 +266,7 @@ void GERBVIEW_FRAME::SaveSettings()
...
@@ -268,7 +266,7 @@ void GERBVIEW_FRAME::SaveSettings()
}
}
}
}
config
->
Write
(
GerbviewShowPageSizeOption
,
pageSize_opt
);
config
->
Write
(
GerbviewShowPageSizeOption
,
GetPageSettings
().
GetType
()
);
config
->
Write
(
GerbviewShowDCodes
,
IsElementVisible
(
DCODES_VISIBLE
)
);
config
->
Write
(
GerbviewShowDCodes
,
IsElementVisible
(
DCODES_VISIBLE
)
);
// Save the drill file history list.
// Save the drill file history list.
// Because we have 2 file histories, we must save this one
// Because we have 2 file histories, we must save this one
...
...
gerbview/initpcb.cpp
View file @
0d459865
...
@@ -70,6 +70,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query )
...
@@ -70,6 +70,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query )
SetScreen
(
new
PCB_SCREEN
()
);
SetScreen
(
new
PCB_SCREEN
()
);
GetScreen
()
->
Init
();
GetScreen
()
->
Init
();
setActiveLayer
(
FIRST_COPPER_LAYER
);
setActiveLayer
(
FIRST_COPPER_LAYER
);
m_LayersManager
->
UpdateLayerIcons
();
m_LayersManager
->
UpdateLayerIcons
();
syncLayerBox
();
syncLayerBox
();
...
...
include/class_base_screen.h
View file @
0d459865
...
@@ -37,11 +37,10 @@
...
@@ -37,11 +37,10 @@
#include "common.h"
#include "common.h"
// Forward declarations:
/**
class
Ki_PageDescr
;
* Class GRID_TYPE
* is for grid arrays.
*/
/* Simple class for handling grid arrays. */
class
GRID_TYPE
class
GRID_TYPE
{
{
public
:
public
:
...
@@ -59,7 +58,6 @@ public:
...
@@ -59,7 +58,6 @@ public:
return
*
this
;
return
*
this
;
}
}
const
bool
operator
==
(
const
GRID_TYPE
&
item
)
const
const
bool
operator
==
(
const
GRID_TYPE
&
item
)
const
{
{
return
m_Size
==
item
.
m_Size
&&
m_Id
==
item
.
m_Id
;
return
m_Size
==
item
.
m_Size
&&
m_Id
==
item
.
m_Id
;
...
@@ -72,13 +70,12 @@ typedef std::vector< GRID_TYPE > GRIDS;
...
@@ -72,13 +70,12 @@ typedef std::vector< GRID_TYPE > GRIDS;
/**
/**
* Class BASE_SCREEN
* Class BASE_SCREEN
* handle how to draw a screen (a board, a schematic ...)
* handle
s
how to draw a screen (a board, a schematic ...)
*/
*/
class
BASE_SCREEN
:
public
EDA_ITEM
class
BASE_SCREEN
:
public
EDA_ITEM
{
{
EDA_ITEMS
m_items
;
///< The drawing items associated with this screen.
EDA_ITEMS
m_items
;
///< The drawing items associated with this screen.
GRIDS
m_grids
;
///< List of valid grid sizes.
GRIDS
m_grids
;
///< List of valid grid sizes.
EDA_ITEM
*
m_drawList
;
///< Object list for the screen.
wxString
m_fileName
;
///< File used to load the screen.
wxString
m_fileName
;
///< File used to load the screen.
char
m_FlagRefreshReq
;
///< Indicates that the screen should be redrawn.
char
m_FlagRefreshReq
;
///< Indicates that the screen should be redrawn.
bool
m_FlagModified
;
///< Indicates current drawing has been modified.
bool
m_FlagModified
;
///< Indicates current drawing has been modified.
...
@@ -96,18 +93,19 @@ class BASE_SCREEN : public EDA_ITEM
...
@@ -96,18 +93,19 @@ class BASE_SCREEN : public EDA_ITEM
wxPoint
m_crossHairPosition
;
wxPoint
m_crossHairPosition
;
public
:
public
:
wxPoint
m_DrawOrg
;
/
* offsets for drawing the circuit on the screen */
wxPoint
m_DrawOrg
;
/
//< offsets for drawing the circuit on the screen
wxPoint
m_O_Curseur
;
/* Relative Screen cursor coordinate (on grid)
wxPoint
m_O_Curseur
;
/* Relative Screen cursor coordinate (on grid)
* in user units. (coordinates from last reset position)*/
* in user units. (coordinates from last reset position)*/
// Scrollbars management:
// Scrollbars management:
int
m_ScrollPixelsPerUnitX
;
/
* Pixels per scroll unit in the horizontal direction. */
int
m_ScrollPixelsPerUnitX
;
/
//< Pixels per scroll unit in the horizontal direction.
int
m_ScrollPixelsPerUnitY
;
/
* Pixels per scroll unit in the vertical direction. */
int
m_ScrollPixelsPerUnitY
;
/
//< Pixels per scroll unit in the vertical direction.
wxSize
m_ScrollbarNumber
;
/* Current virtual draw area size in scroll units.
wxSize
m_ScrollbarNumber
;
/* Current virtual draw area size in scroll units.
* m_ScrollbarNumber * m_ScrollPixelsPerUnit =
* m_ScrollbarNumber * m_ScrollPixelsPerUnit =
* virtual draw area size in pixels */
* virtual draw area size in pixels */
wxPoint
m_ScrollbarPos
;
/* Current scroll bar position in scroll units. */
wxPoint
m_ScrollbarPos
;
///< Current scroll bar position in scroll units.
wxPoint
m_StartVisu
;
/* Coordinates in drawing units of the current
wxPoint
m_StartVisu
;
/* Coordinates in drawing units of the current
* view position (upper left corner of device)
* view position (upper left corner of device)
...
@@ -118,18 +116,16 @@ public:
...
@@ -118,18 +116,16 @@ public:
* > 0 except for schematics.
* > 0 except for schematics.
* false: when coordinates can only be >= 0
* false: when coordinates can only be >= 0
* Schematic */
* Schematic */
bool
m_FirstRedraw
;
bool
m_FirstRedraw
;
// Undo/redo list of commands
// Undo/redo list of commands
UNDO_REDO_CONTAINER
m_UndoList
;
/
* Objects list for the undo command (old data) */
UNDO_REDO_CONTAINER
m_UndoList
;
/
//< Objects list for the undo command (old data)
UNDO_REDO_CONTAINER
m_RedoList
;
/
* Objects list for the redo command (old data) */
UNDO_REDO_CONTAINER
m_RedoList
;
/
//< Objects list for the redo command (old data)
unsigned
m_UndoRedoCountMax
;
// undo/Redo command Max depth
unsigned
m_UndoRedoCountMax
;
//
/<
undo/Redo command Max depth
/
* block control */
/
/ block control
BLOCK_SELECTOR
m_BlockLocate
;
/
* Block description for block commands */
BLOCK_SELECTOR
m_BlockLocate
;
/
//< Block description for block commands
/* Page description */
Ki_PageDescr
*
m_CurrentSheetDesc
;
int
m_ScreenNumber
;
int
m_ScreenNumber
;
int
m_NumberOfScreen
;
int
m_NumberOfScreen
;
...
@@ -145,8 +141,8 @@ public:
...
@@ -145,8 +141,8 @@ public:
/* Grid and zoom values. */
/* Grid and zoom values. */
wxPoint
m_GridOrigin
;
wxPoint
m_GridOrigin
;
wxArrayDouble
m_ZoomList
;
/
* Array of standard zoom (i.e. scale) coefficients. */
wxArrayDouble
m_ZoomList
;
/
//< Array of standard zoom (i.e. scale) coefficients.
double
m_Zoom
;
/
* Current zoom coefficient. */
double
m_Zoom
;
/
//< Current zoom coefficient.
bool
m_IsPrinting
;
bool
m_IsPrinting
;
public
:
public
:
...
@@ -162,24 +158,12 @@ public:
...
@@ -162,24 +158,12 @@ public:
EDA_ITEM
*
GetCurItem
()
const
{
return
m_CurrentItem
;
}
EDA_ITEM
*
GetCurItem
()
const
{
return
m_CurrentItem
;
}
/**
void
InitDataPoints
(
const
wxSize
&
aPageSizeInternalUnits
);
* Function GetDrawItems().
*
* @return - A pointer to the first item in the linked list of draw items.
*/
virtual
EDA_ITEM
*
GetDrawItems
()
const
{
return
m_drawList
;
}
virtual
void
SetDrawItems
(
EDA_ITEM
*
aItem
)
{
m_drawList
=
aItem
;
}
void
InitDatas
();
void
SetFileName
(
const
wxString
&
aFileName
)
{
m_fileName
=
aFileName
;
}
void
SetFileName
(
const
wxString
&
aFileName
)
{
m_fileName
=
aFileName
;
}
wxString
GetFileName
()
const
{
return
m_fileName
;
}
wxString
GetFileName
()
const
{
return
m_fileName
;
}
void
SetPageSize
(
wxSize
&
aPageSize
);
wxSize
ReturnPageSize
(
void
);
/**
/**
* Function GetInternalUnits
* Function GetInternalUnits
* @return the screen units scalar.
* @return the screen units scalar.
...
@@ -469,9 +453,8 @@ public:
...
@@ -469,9 +453,8 @@ public:
}
}
#if defined(DEBUG)
#if defined(DEBUG)
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
const
;
// overload
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
const
{
ShowDummy
(
os
);
}
// override
#endif
#endif
};
};
#endif // CLASS_BASE_SCREEN_H_
#endif // CLASS_BASE_SCREEN_H_
include/class_pcb_screen.h
View file @
0d459865
...
@@ -2,8 +2,8 @@
...
@@ -2,8 +2,8 @@
* @file class_pcb_screen.h
* @file class_pcb_screen.h
*/
*/
#ifndef
__CLASSPCB_SCREEN_H_
_
#ifndef
CLASS_PCB_SCREEN_H
_
#define
__CLASSPCB_SCREEN_H_
_
#define
CLASS_PCB_SCREEN_H
_
#include "class_base_screen.h"
#include "class_base_screen.h"
...
@@ -26,17 +26,17 @@ public:
...
@@ -26,17 +26,17 @@ public:
~
PCB_SCREEN
();
~
PCB_SCREEN
();
PCB_SCREEN
*
Next
()
{
return
(
PCB_SCREEN
*
)
Pnext
;
}
PCB_SCREEN
*
Next
()
{
return
(
PCB_SCREEN
*
)
Pnext
;
}
void
Init
();
void
SetNextZoom
();
void
SetNextZoom
();
void
SetPreviousZoom
();
void
SetPreviousZoom
();
void
SetLastZoom
();
void
SetLastZoom
();
virtual
int
GetInternalUnits
(
void
);
virtual
int
GetInternalUnits
();
/**
/**
* Function GetCurItem
* Function GetCurItem
* returns the currently selected BOARD_ITEM, overriding
* returns the currently selected BOARD_ITEM, overriding
*BASE_SCREEN::GetCurItem().
*
BASE_SCREEN::GetCurItem().
* @return BOARD_ITEM* - the one selected, or NULL.
* @return BOARD_ITEM* - the one selected, or NULL.
*/
*/
BOARD_ITEM
*
GetCurItem
()
const
BOARD_ITEM
*
GetCurItem
()
const
...
@@ -73,5 +73,4 @@ public:
...
@@ -73,5 +73,4 @@ public:
void
ClearUndoORRedoList
(
UNDO_REDO_CONTAINER
&
aList
,
int
aItemCount
=
-
1
);
void
ClearUndoORRedoList
(
UNDO_REDO_CONTAINER
&
aList
,
int
aItemCount
=
-
1
);
};
};
#endif // CLASS_PCB_SCREEN_H_
#endif
/* __CLASSPCB_SCREEN_H__ */
include/class_sch_screen.h
View file @
0d459865
...
@@ -55,14 +55,20 @@ enum SCH_LINE_TEST_T
...
@@ -55,14 +55,20 @@ enum SCH_LINE_TEST_T
};
};
/
* Max number of sheets in a hierarchy project: */
/
// Max number of sheets in a hierarchy project
#define NB_MAX_SHEET 500
#define NB_MAX_SHEET
500
class
SCH_SCREEN
:
public
BASE_SCREEN
class
SCH_SCREEN
:
public
BASE_SCREEN
{
{
int
m_refCount
;
///< Number of sheets referencing this screen.
int
m_refCount
;
///< Number of sheets referencing this screen.
///< Delete when it goes to zero.
///< Delete when it goes to zero.
/// The size of the paper to print or plot on
PAGE_INFO
m_paper
;
// keep with the MVC model as this class gets split
SCH_ITEM
*
m_drawList
;
///< Object list for the screen.
/// @todo use DLIST<SCH_ITEM> or superior container
/**
/**
* Function addConnectedItemsToBlock
* Function addConnectedItemsToBlock
...
@@ -85,6 +91,9 @@ public:
...
@@ -85,6 +91,9 @@ public:
return
wxT
(
"SCH_SCREEN"
);
return
wxT
(
"SCH_SCREEN"
);
}
}
const
PAGE_INFO
&
GetPageSettings
()
const
{
return
m_paper
;
}
void
SetPageSettings
(
const
PAGE_INFO
&
aPageSettings
)
{
m_paper
=
aPageSettings
;
}
void
DecRefCount
();
void
DecRefCount
();
void
IncRefCount
();
void
IncRefCount
();
...
@@ -93,12 +102,10 @@ public:
...
@@ -93,12 +102,10 @@ public:
/**
/**
* Function GetDrawItems().
* Function GetDrawItems().
*
* @return - A pointer to the first item in the linked list of draw items.
* @return - A pointer to the first item in the linked list of draw items.
*/
*/
virtual
SCH_ITEM
*
GetDrawItems
()
const
{
return
(
SCH_ITEM
*
)
BASE_SCREEN
::
GetDrawItems
();
}
SCH_ITEM
*
GetDrawItems
()
const
{
return
m_drawList
;
}
void
SetDrawItems
(
SCH_ITEM
*
aItem
)
{
m_drawList
=
aItem
;
}
virtual
void
SetDrawItems
(
SCH_ITEM
*
aItem
)
{
BASE_SCREEN
::
SetDrawItems
(
aItem
);
}
/**
/**
* Function GetCurItem
* Function GetCurItem
...
@@ -456,6 +463,10 @@ public:
...
@@ -456,6 +463,10 @@ public:
{
{
BASE_SCREEN
::
InsertItem
(
aIter
,
(
EDA_ITEM
*
)
aItem
);
BASE_SCREEN
::
InsertItem
(
aIter
,
(
EDA_ITEM
*
)
aItem
);
}
}
#if defined(DEBUG)
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
const
;
// overload
#endif
};
};
...
...
include/common.h
View file @
0d459865
...
@@ -32,10 +32,13 @@
...
@@ -32,10 +32,13 @@
#ifndef INCLUDE__COMMON_H_
#ifndef INCLUDE__COMMON_H_
#define INCLUDE__COMMON_H_
#define INCLUDE__COMMON_H_
#include <vector>
#include "wx/wx.h"
#include "wx/wx.h"
#include "wx/confbase.h"
#include "wx/confbase.h"
#include "wx/fileconf.h"
#include "wx/fileconf.h"
class
wxAboutDialogInfo
;
class
wxAboutDialogInfo
;
class
BASE_SCREEN
;
class
BASE_SCREEN
;
class
EDA_DRAW_FRAME
;
class
EDA_DRAW_FRAME
;
...
@@ -54,12 +57,11 @@ class EDA_DRAW_PANEL;
...
@@ -54,12 +57,11 @@ class EDA_DRAW_PANEL;
* flag for block commands
* flag for block commands
*/
*/
// default name for nameless projects
//
/
default name for nameless projects
#define NAMELESS_PROJECT wxT( "noname" )
#define NAMELESS_PROJECT wxT( "noname" )
#define NB_ITEMS 11
/
* Pseudo key codes for command panning */
/
// Pseudo key codes for command panning
enum
pseudokeys
{
enum
pseudokeys
{
EDA_PANNING_UP_KEY
=
1
,
EDA_PANNING_UP_KEY
=
1
,
EDA_PANNING_DOWN_KEY
,
EDA_PANNING_DOWN_KEY
,
...
@@ -124,38 +126,101 @@ enum EDA_UNITS_T {
...
@@ -124,38 +126,101 @@ enum EDA_UNITS_T {
class
LibNameList
;
class
LibNameList
;
/* Class to handle pages sizes:
class
PAGE_INFO
;
/**
* Class PAGE_INFO
* describes the page size and margins of a paper page on which to
* eventually print or plot. Since paper is often described in inches,
* (and due to legacy code), inches, mils, and internal units (IU) are supported
* in the accessors. Again, we are describing paper in this class.
*/
*/
class
Ki_PageDescr
class
PAGE_INFO
{
{
// All sizes are in 1/1000 inch
public
:
public
:
wxSize
m_Size
;
/* page size in 1/1000 inch */
PAGE_INFO
(
const
wxString
&
aType
=
wxT
(
"A3"
)
);
wxPoint
m_Offset
;
/* plot offset in 1/1000 inch */
PAGE_INFO
(
const
wxSize
&
aSizeMils
,
const
wxPoint
&
aOffsetMils
,
const
wxString
&
aName
);
wxString
m_Name
;
int
m_LeftMargin
;
const
wxString
&
GetType
()
const
{
return
m_Type
;
}
int
m_RightMargin
;
int
m_TopMargin
;
/**
int
m_BottomMargin
;
* Function SetType
* sets the name of the page type and also the sizes and margins
* commonly associated with that type name.
*
* @param aStandardPageDescriptionName is a wxString constant giving one of:
* "A4" "A3" "A2" "A1" "A0" "A" "B" "C" "D" "E" "GERBER", or "User". If "User"
* then the width and height are custom, and will be set according to previous calls
* to static PAGE_INFO::SetUserWidthInches( double aWidthInInches ) and
* static PAGE_INFO::SetUserHeightInches( double aHeightInInches );
*
* @return bool - true iff @a aStandarePageDescription was a recognized type.
*/
bool
SetType
(
const
wxString
&
aStandardPageDescriptionName
);
void
SetWidthInches
(
double
aWidthInInches
);
void
SetHeightInches
(
double
aHeightInInches
);
double
GetWidthInches
()
const
{
return
m_widthInches
;
}
double
GetHeightInches
()
const
{
return
m_heightInches
;
}
int
GetWidthMils
()
const
{
return
int
(
1000
*
m_widthInches
);
}
int
GetHeightMils
()
const
{
return
int
(
1000
*
m_heightInches
);
}
const
wxSize
GetSizeMils
()
const
{
return
wxSize
(
GetWidthMils
(),
GetHeightMils
()
);
}
// accessors returning Internal Units
#if defined(PCBNEW)
# if defined(KICAD_NANOMETRE)
int
GetWidthIU
()
const
{
return
int
(
2.54e7
*
m_widthInches
);
}
int
GetHeightIU
()
const
{
return
int
(
2.54e7
*
m_heightInches
);
}
# else
int
GetWidthIU
()
const
{
return
int
(
10000
*
m_widthInches
);
}
int
GetHeightIU
()
const
{
return
int
(
10000
*
m_heightInches
);
}
# endif
const
wxSize
GetSizeIU
()
const
{
return
wxSize
(
GetWidthIU
(),
GetHeightIU
()
);
}
#elif defined(EESCHEMA)
int
GetWidthIU
()
const
{
return
int
(
1000
*
m_widthInches
);
}
int
GetHeightIU
()
const
{
return
int
(
1000
*
m_heightInches
);
}
const
wxSize
GetSizeIU
()
const
{
return
wxSize
(
GetWidthIU
(),
GetHeightIU
()
);
}
#endif
public
:
wxPoint
GetOffsetMils
()
const
{
return
m_Offset
;
}
Ki_PageDescr
(
const
wxSize
&
size
,
const
wxPoint
&
offset
,
const
wxString
&
name
);
};
int
GetLeftMarginMils
()
const
{
return
m_LeftMargin
;
}
int
GetRightMarginMils
()
const
{
return
m_RightMargin
;
}
int
GetTopMarginMils
()
const
{
return
m_TopMargin
;
}
int
GetBottomMarginMils
()
const
{
return
m_BottomMargin
;
}
extern
Ki_PageDescr
g_Sheet_A4
;
/**
extern
Ki_PageDescr
g_Sheet_A3
;
* Function SetUserWidthInches
extern
Ki_PageDescr
g_Sheet_A2
;
* sets the width of type "User" page in inches.
extern
Ki_PageDescr
g_Sheet_A1
;
*/
extern
Ki_PageDescr
g_Sheet_A0
;
static
void
SetUserWidthInches
(
double
aWidthInInches
);
extern
Ki_PageDescr
g_Sheet_A
;
extern
Ki_PageDescr
g_Sheet_B
;
/**
extern
Ki_PageDescr
g_Sheet_C
;
* Function SetUserHeightInches
extern
Ki_PageDescr
g_Sheet_D
;
* sets the height type "User" page in inches.
extern
Ki_PageDescr
g_Sheet_E
;
*/
extern
Ki_PageDescr
g_Sheet_GERBER
;
static
void
SetUserHeightInches
(
double
aHeightInInches
);
extern
Ki_PageDescr
g_Sheet_user
;
extern
Ki_PageDescr
*
g_SheetSizeList
[];
#define PAGE_INFO_COUNT 11 ///< count of standard page sizes
private
:
wxString
m_Type
;
///< paper type: A4, A3, etc.
double
m_widthInches
;
double
m_heightInches
;
wxPoint
m_Offset
;
///< plot offset in 1/1000 inches
int
m_LeftMargin
;
int
m_RightMargin
;
int
m_TopMargin
;
int
m_BottomMargin
;
static
double
s_user_height
;
static
double
s_user_width
;
};
extern
wxString
g_ProductName
;
extern
wxString
g_ProductName
;
...
...
include/plot_common.h
View file @
0d459865
...
@@ -10,10 +10,7 @@
...
@@ -10,10 +10,7 @@
#include <vector>
#include <vector>
#include "drawtxt.h"
#include "drawtxt.h"
#include "common.h" // PAGE_INFO
class
Ki_PageDescr
;
/**
/**
* Enum PlotFormat
* Enum PlotFormat
...
@@ -27,6 +24,7 @@ enum PlotFormat {
...
@@ -27,6 +24,7 @@ enum PlotFormat {
PLOT_FORMAT_DXF
PLOT_FORMAT_DXF
};
};
class
PLOTTER
class
PLOTTER
{
{
public
:
public
:
...
@@ -70,8 +68,8 @@ public: PLOTTER( PlotFormat aPlotType );
...
@@ -70,8 +68,8 @@ public: PLOTTER( PlotFormat aPlotType );
return
color_mode
;
return
color_mode
;
}
}
void
SetPageSettings
(
const
PAGE_INFO
&
aPageSettings
);
virtual
void
set_paper_size
(
Ki_PageDescr
*
sheet
);
virtual
void
set_current_line_width
(
int
width
)
=
0
;
virtual
void
set_current_line_width
(
int
width
)
=
0
;
virtual
void
set_default_line_width
(
int
width
)
=
0
;
virtual
void
set_default_line_width
(
int
width
)
=
0
;
virtual
void
set_color
(
int
color
)
=
0
;
virtual
void
set_color
(
int
color
)
=
0
;
...
@@ -226,7 +224,7 @@ protected:
...
@@ -226,7 +224,7 @@ protected:
bool
plotMirror
;
bool
plotMirror
;
wxString
creator
;
wxString
creator
;
wxString
filename
;
wxString
filename
;
Ki_PageDescr
*
sheet
;
PAGE_INFO
pageInfo
;
wxSize
paper_size
;
wxSize
paper_size
;
};
};
...
...
include/wxBasePcbFrame.h
View file @
0d459865
...
@@ -112,6 +112,10 @@ public:
...
@@ -112,6 +112,10 @@ public:
*/
*/
EDA_RECT
GetBoardBoundingBox
(
bool
aBoardEdgesOnly
=
false
)
const
;
EDA_RECT
GetBoardBoundingBox
(
bool
aBoardEdgesOnly
=
false
)
const
;
void
SetPageSettings
(
const
PAGE_INFO
&
aPageSettings
);
// overload
const
PAGE_INFO
&
GetPageSettings
()
const
;
// overload
const
wxSize
GetPageSizeIU
()
const
;
// overload
/**
/**
* Function SetBoard
* Function SetBoard
* sets the m_Pcb member in such as way as to ensure deleting any previous
* sets the m_Pcb member in such as way as to ensure deleting any previous
...
...
include/wxstruct.h
View file @
0d459865
...
@@ -72,7 +72,7 @@ class EDA_DRAW_PANEL;
...
@@ -72,7 +72,7 @@ class EDA_DRAW_PANEL;
class
EDA_MSG_PANEL
;
class
EDA_MSG_PANEL
;
class
BASE_SCREEN
;
class
BASE_SCREEN
;
class
PARAM_CFG_BASE
;
class
PARAM_CFG_BASE
;
class
Ki_PageDescr
;
class
PAGE_INFO
;
class
PLOTTER
;
class
PLOTTER
;
enum
id_librarytype
{
enum
id_librarytype
{
...
@@ -371,9 +371,9 @@ public:
...
@@ -371,9 +371,9 @@ public:
protected
:
protected
:
EDA_HOTKEY_CONFIG
*
m_HotkeysZoomAndGridList
;
EDA_HOTKEY_CONFIG
*
m_HotkeysZoomAndGridList
;
int
m_LastGridSizeId
;
int
m_LastGridSizeId
;
bool
m_DrawGrid
;
// hide/Show grid
bool
m_DrawGrid
;
// hide/Show grid
int
m_GridColor
;
// Grid color
int
m_GridColor
;
// Grid color
/// Internal units count that is equivalent to 1 inch. Set to 1000 (0.001") for
/// Internal units count that is equivalent to 1 inch. Set to 1000 (0.001") for
/// schematic drawing and 10000 (0.0001") for PCB drawing.
/// schematic drawing and 10000 (0.0001") for PCB drawing.
...
@@ -449,6 +449,16 @@ public:
...
@@ -449,6 +449,16 @@ public:
~
EDA_DRAW_FRAME
();
~
EDA_DRAW_FRAME
();
virtual
void
SetPageSettings
(
const
PAGE_INFO
&
aPageSettings
)
=
0
;
virtual
const
PAGE_INFO
&
GetPageSettings
()
const
=
0
;
/**
* Function GetPageSizeIU
* works off of GetPageSettings() to return the size of the paper page in
* the internal units of this particular view.
*/
virtual
const
wxSize
GetPageSizeIU
()
const
=
0
;
wxPoint
GetOriginAxisPosition
()
const
{
return
m_originAxisPosition
;
}
wxPoint
GetOriginAxisPosition
()
const
{
return
m_originAxisPosition
;
}
void
SetOriginAxisPosition
(
const
wxPoint
&
aPosition
)
{
m_originAxisPosition
=
aPosition
;
}
void
SetOriginAxisPosition
(
const
wxPoint
&
aPosition
)
{
m_originAxisPosition
=
aPosition
;
}
...
@@ -653,13 +663,13 @@ public:
...
@@ -653,13 +663,13 @@ public:
/**
/**
* Function GetXYSheetReferences
* Function GetXYSheetReferences
*
Return
the X,Y sheet references where the point position is located
*
returns
the X,Y sheet references where the point position is located
* @param aScreen = screen to use
* @param aScreen = screen to use
* @param aPosition = position to identify by YX ref
* @param aPosition = position to identify by YX ref
* @return a wxString containing the message locator like A3 or B6
* @return a wxString containing the message locator like A3 or B6
* (or ?? if out of page limits)
* (or ?? if out of page limits)
*/
*/
wxString
GetXYSheetReferences
(
BASE_SCREEN
*
aScreen
,
const
wxPoint
&
aPosition
);
const
wxString
GetXYSheetReferences
(
const
wxPoint
&
aPosition
);
void
DisplayToolMsg
(
const
wxString
&
msg
);
void
DisplayToolMsg
(
const
wxString
&
msg
);
virtual
void
RedrawActiveWindow
(
wxDC
*
DC
,
bool
EraseBg
)
=
0
;
virtual
void
RedrawActiveWindow
(
wxDC
*
DC
,
bool
EraseBg
)
=
0
;
...
...
pcbnew/basepcbframe.cpp
View file @
0d459865
...
@@ -125,6 +125,33 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
...
@@ -125,6 +125,33 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
m_Pcb
=
aBoard
;
m_Pcb
=
aBoard
;
}
}
void
PCB_BASE_FRAME
::
SetPageSettings
(
const
PAGE_INFO
&
aPageSettings
)
{
wxASSERT
(
m_Pcb
);
m_Pcb
->
SetPageSettings
(
aPageSettings
);
}
const
PAGE_INFO
&
PCB_BASE_FRAME
::
GetPageSettings
()
const
{
wxASSERT
(
m_Pcb
);
return
m_Pcb
->
GetPageSettings
();
}
const
wxSize
PCB_BASE_FRAME
::
GetPageSizeIU
()
const
{
wxASSERT
(
m_Pcb
);
const
PAGE_INFO
&
page
=
m_Pcb
->
GetPageSettings
();
// convert paper size into internal units.
#if defined( KICAD_NANOMETRE )
return
page
.
GetSizeMils
()
*
25400
;
// nanometers
#else
return
page
.
GetSizeMils
()
*
10
;
// deci-mils
#endif
}
EDA_RECT
PCB_BASE_FRAME
::
GetBoardBoundingBox
(
bool
aBoardEdgesOnly
)
const
EDA_RECT
PCB_BASE_FRAME
::
GetBoardBoundingBox
(
bool
aBoardEdgesOnly
)
const
{
{
...
@@ -134,18 +161,17 @@ EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
...
@@ -134,18 +161,17 @@ EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
if
(
area
.
GetWidth
()
==
0
&&
area
.
GetHeight
()
==
0
)
if
(
area
.
GetWidth
()
==
0
&&
area
.
GetHeight
()
==
0
)
{
{
wxSize
pageSize
=
GetPageSizeIU
();
if
(
m_showBorderAndTitleBlock
)
if
(
m_showBorderAndTitleBlock
)
{
{
area
.
SetOrigin
(
0
,
0
);
area
.
SetOrigin
(
0
,
0
);
area
.
SetEnd
(
GetScreen
()
->
ReturnPageSize
().
x
,
area
.
SetEnd
(
pageSize
.
x
,
pageSize
.
y
);
GetScreen
()
->
ReturnPageSize
().
y
);
}
}
else
else
{
{
area
.
SetOrigin
(
-
GetScreen
()
->
ReturnPageSize
().
x
/
2
,
area
.
SetOrigin
(
-
pageSize
.
x
/
2
,
-
pageSize
.
y
/
2
);
-
GetScreen
()
->
ReturnPageSize
().
y
/
2
);
area
.
SetEnd
(
pageSize
.
x
/
2
,
pageSize
.
y
/
2
);
area
.
SetEnd
(
GetScreen
()
->
ReturnPageSize
().
x
/
2
,
GetScreen
()
->
ReturnPageSize
().
y
/
2
);
}
}
}
}
...
...
pcbnew/class_board.h
View file @
0d459865
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
#include "class_pad.h"
#include "class_pad.h"
#include "class_colors_design_settings.h"
#include "class_colors_design_settings.h"
#include "class_board_design_settings.h"
#include "class_board_design_settings.h"
#include "common.h" // PAGE_INFO
class
PCB_BASE_FRAME
;
class
PCB_BASE_FRAME
;
class
PCB_EDIT_FRAME
;
class
PCB_EDIT_FRAME
;
...
@@ -27,7 +27,7 @@ class D_PAD;
...
@@ -27,7 +27,7 @@ class D_PAD;
class
MARKER_PCB
;
class
MARKER_PCB
;
//
buffer of item candidates when search
for items on the same track.
//
non-owning container of item candidates when searching
for items on the same track.
typedef
std
::
vector
<
TRACK
*
>
TRACK_PTRS
;
typedef
std
::
vector
<
TRACK
*
>
TRACK_PTRS
;
...
@@ -174,6 +174,7 @@ private:
...
@@ -174,6 +174,7 @@ private:
BOARD_DESIGN_SETTINGS
m_designSettings
;
BOARD_DESIGN_SETTINGS
m_designSettings
;
COLORS_DESIGN_SETTINGS
*
m_colorsSettings
;
// Link to current colors settings
COLORS_DESIGN_SETTINGS
*
m_colorsSettings
;
// Link to current colors settings
PAGE_INFO
m_paper
;
/**
/**
* Function chainMarkedSegments
* Function chainMarkedSegments
...
@@ -534,15 +535,14 @@ public:
...
@@ -534,15 +535,14 @@ public:
*/
*/
void
SetDesignSettings
(
const
BOARD_DESIGN_SETTINGS
&
aDesignSettings
);
void
SetDesignSettings
(
const
BOARD_DESIGN_SETTINGS
&
aDesignSettings
);
const
PAGE_INFO
&
GetPageSettings
()
const
{
return
m_paper
;
}
void
SetPageSettings
(
const
PAGE_INFO
&
aPageSettings
)
{
m_paper
=
aPageSettings
;
}
/**
/**
* Function SetBoardSettings
* Function SetBoardSettings
* @return the current COLORS_DESIGN_SETTINGS in use
* @return the current COLORS_DESIGN_SETTINGS in use
*/
*/
COLORS_DESIGN_SETTINGS
*
GetColorsSettings
()
const
COLORS_DESIGN_SETTINGS
*
GetColorsSettings
()
const
{
return
m_colorsSettings
;
}
{
return
m_colorsSettings
;
}
/**
/**
* Function SetColorsSettings
* Function SetColorsSettings
...
@@ -553,7 +553,6 @@ public:
...
@@ -553,7 +553,6 @@ public:
m_colorsSettings
=
aColorsSettings
;
m_colorsSettings
=
aColorsSettings
;
}
}
/**
/**
* Function GetLayerName
* Function GetLayerName
* returns the name of the layer given by aLayerIndex.
* returns the name of the layer given by aLayerIndex.
...
...
pcbnew/class_pad.cpp
View file @
0d459865
...
@@ -184,12 +184,9 @@ void D_PAD::ReturnStringPadName( wxString& text ) const
...
@@ -184,12 +184,9 @@ void D_PAD::ReturnStringPadName( wxString& text ) const
text
.
Empty
();
text
.
Empty
();
for
(
int
ii
=
0
;
ii
<
PADNAMEZ
;
ii
++
)
for
(
int
ii
=
0
;
ii
<
PADNAMEZ
&&
m_Padname
[
ii
];
ii
++
)
{
{
if
(
!
m_Padname
[
ii
]
)
// m_Padname is 8 bit KiCad font junk, do not sign extend
break
;
// add an unsigned 8 bit byte, which is LATIN1 or CRYLIC
text
.
Append
(
(
unsigned
char
)
m_Padname
[
ii
]
);
text
.
Append
(
(
unsigned
char
)
m_Padname
[
ii
]
);
}
}
#endif
#endif
...
...
pcbnew/class_track.h
View file @
0d459865
...
@@ -197,9 +197,9 @@ public:
...
@@ -197,9 +197,9 @@ public:
int
aCircleToSegmentsCount
,
int
aCircleToSegmentsCount
,
double
aCorrectionFactor
);
double
aCorrectionFactor
);
/**
/**
* Function SetDrill
Value
* Function SetDrill
* Set the drill value for vias
* Set the drill value for vias
* @param
drill_value = new drill value
* @param
aDrill is the new drill diameter
*/
*/
void
SetDrill
(
int
aDrill
)
{
m_Drill
=
aDrill
;
}
void
SetDrill
(
int
aDrill
)
{
m_Drill
=
aDrill
;
}
...
...
pcbnew/classpcb.cpp
View file @
0d459865
...
@@ -32,8 +32,8 @@ static const double PcbZoomList[] =
...
@@ -32,8 +32,8 @@ static const double PcbZoomList[] =
200.0
,
350.0
,
500.0
,
1000.0
,
2000.0
200.0
,
350.0
,
500.0
,
1000.0
,
2000.0
};
};
#define PCB_ZOOM_LIST_CNT ( sizeof( PcbZoomList ) / sizeof( PcbZoomList[0] ) )
#define PCB_ZOOM_LIST_CNT
( sizeof( PcbZoomList ) / sizeof( PcbZoomList[0] ) )
#define MM_TO_PCB_UNITS
10000.0 / 25.4
#define MM_TO_PCB_UNITS
(10000.0 / 25.4)
/* Default grid sizes for PCB editor screens. */
/* Default grid sizes for PCB editor screens. */
...
@@ -82,8 +82,13 @@ PCB_SCREEN::PCB_SCREEN() : BASE_SCREEN( SCREEN_T )
...
@@ -82,8 +82,13 @@ PCB_SCREEN::PCB_SCREEN() : BASE_SCREEN( SCREEN_T )
for
(
i
=
0
;
i
<
PCB_GRID_LIST_CNT
;
i
++
)
for
(
i
=
0
;
i
<
PCB_GRID_LIST_CNT
;
i
++
)
AddGrid
(
PcbGridList
[
i
]
);
AddGrid
(
PcbGridList
[
i
]
);
SetGrid
(
wxRealPoint
(
500
,
500
)
);
/* Set the working grid size to a reasonnable value (in 1/10000 inch) */
// Set the working grid size to a reasonnable value (in 1/10000 inch)
Init
();
SetGrid
(
wxRealPoint
(
500
,
500
)
);
m_Active_Layer
=
LAYER_N_BACK
;
// default active layer = bottom layer
m_Route_Layer_TOP
=
LAYER_N_FRONT
;
// default layers pair for vias (bottom to top)
m_Route_Layer_BOTTOM
=
LAYER_N_BACK
;
m_Zoom
=
150
;
// a default value for zoom
}
}
...
@@ -93,17 +98,7 @@ PCB_SCREEN::~PCB_SCREEN()
...
@@ -93,17 +98,7 @@ PCB_SCREEN::~PCB_SCREEN()
}
}
void
PCB_SCREEN
::
Init
()
int
PCB_SCREEN
::
GetInternalUnits
()
{
InitDatas
();
m_Active_Layer
=
LAYER_N_BACK
;
/* default active layer = bottom layer */
m_Route_Layer_TOP
=
LAYER_N_FRONT
;
/* default layers pair for vias (bottom to top) */
m_Route_Layer_BOTTOM
=
LAYER_N_BACK
;
m_Zoom
=
150
;
/* a default value for zoom */
}
int
PCB_SCREEN
::
GetInternalUnits
(
void
)
{
{
return
PCB_INTERNAL_UNIT
;
return
PCB_INTERNAL_UNIT
;
}
}
...
...
pcbnew/dialogs/dialog_SVG_print.cpp
View file @
0d459865
...
@@ -226,39 +226,40 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
...
@@ -226,39 +226,40 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
BASE_SCREEN
*
screen
,
BASE_SCREEN
*
screen
,
bool
aPrint_Frame_Ref
)
bool
aPrint_Frame_Ref
)
{
{
int
tmpzoom
;
// const PAGE_INFO& pageInfo = m_Parent->GetPageSettings();
wxPoint
tmp_startvisu
;
wxSize
SheetSize
;
// Sheet size in internal units
wxPoint
old_org
;
bool
success
=
true
;
/* Change frames and local settings */
LOCALE_IO
toggle
;
int
tmpzoom
;
wxPoint
tmp_startvisu
;
wxPoint
old_org
;
bool
success
=
true
;
// Change frames and local settings
tmp_startvisu
=
screen
->
m_StartVisu
;
tmp_startvisu
=
screen
->
m_StartVisu
;
tmpzoom
=
screen
->
GetZoom
();
tmpzoom
=
screen
->
GetZoom
();
old_org
=
screen
->
m_DrawOrg
;
old_org
=
screen
->
m_DrawOrg
;
screen
->
m_DrawOrg
.
x
=
screen
->
m_DrawOrg
.
y
=
0
;
screen
->
m_DrawOrg
.
x
=
screen
->
m_DrawOrg
.
y
=
0
;
screen
->
m_StartVisu
.
x
=
screen
->
m_StartVisu
.
y
=
0
;
screen
->
m_StartVisu
.
x
=
screen
->
m_StartVisu
.
y
=
0
;
SheetSize
=
screen
->
m_CurrentSheetDesc
->
m_Size
;
// size in 1/1000 inch
SheetSize
.
x
*=
m_Parent
->
GetInternalUnits
()
/
1000
;
SheetSize
.
y
*=
m_Parent
->
GetInternalUnits
()
/
1000
;
// size in pixels
screen
->
SetScalingFactor
(
1.0
);
screen
->
SetScalingFactor
(
1.0
);
float
dpi
=
(
float
)
m_Parent
->
GetInternalUnits
();
float
dpi
=
(
float
)
m_Parent
->
GetInternalUnits
();
EDA_DRAW_PANEL
*
panel
=
m_Parent
->
DrawPanel
;
EDA_DRAW_PANEL
*
panel
=
m_Parent
->
DrawPanel
;
SetLocaleTo_C_standard
();
// Switch the locale to standard C (needed
// paper pageSize is in internal units, either nanometers or deci-mils
// to print floating point numbers like 1.3)
wxSize
pageSize
=
m_Parent
->
GetPageSizeIU
();
wxSVGFileDC
dc
(
FullFileName
,
SheetSize
.
x
,
SheetSize
.
y
,
dpi
);
wxSVGFileDC
dc
(
FullFileName
,
pageSize
.
x
,
pageSize
.
y
,
dpi
);
EDA_RECT
tmp
=
panel
->
m_ClipBox
;
EDA_RECT
tmp
=
panel
->
m_ClipBox
;
GRResetPenAndBrush
(
&
dc
);
GRResetPenAndBrush
(
&
dc
);
GRForceBlackPen
(
m_ModeColorOption
->
GetSelection
()
==
0
?
false
:
true
);
GRForceBlackPen
(
m_ModeColorOption
->
GetSelection
()
==
0
?
false
:
true
);
s_Parameters
.
m_DrillShapeOpt
=
PRINT_PARAMETERS
::
FULL_DRILL_SHAPE
;
s_Parameters
.
m_DrillShapeOpt
=
PRINT_PARAMETERS
::
FULL_DRILL_SHAPE
;
panel
->
m_ClipBox
.
SetX
(
0
);
panel
->
m_ClipBox
.
SetX
(
0
);
panel
->
m_ClipBox
.
SetY
(
0
);
panel
->
m_ClipBox
.
SetY
(
0
);
// Set clip box to the max size
// Set clip box to the max size
#define MAX_VALUE (INT_MAX/2) // MAX_VALUE is the max we can use in an integer
#define MAX_VALUE (INT_MAX/2) // MAX_VALUE is the max we can use in an integer
// and that allows calculations without overflow
// and that allows calculations without overflow
...
@@ -273,9 +274,9 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
...
@@ -273,9 +274,9 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
if
(
aPrint_Frame_Ref
)
if
(
aPrint_Frame_Ref
)
m_Parent
->
TraceWorkSheet
(
&
dc
,
screen
,
s_Parameters
.
m_PenDefaultSize
);
m_Parent
->
TraceWorkSheet
(
&
dc
,
screen
,
s_Parameters
.
m_PenDefaultSize
);
m_Parent
->
PrintPage
(
&
dc
,
m_PrintMaskLayer
,
false
,
&
s_Parameters
);
m_Parent
->
PrintPage
(
&
dc
,
m_PrintMaskLayer
,
false
,
&
s_Parameters
);
g_DrawBgColor
=
bg_color
;
g_DrawBgColor
=
bg_color
;
SetLocaleTo_Default
();
// revert to the current locale
screen
->
m_IsPrinting
=
false
;
screen
->
m_IsPrinting
=
false
;
panel
->
m_ClipBox
=
tmp
;
panel
->
m_ClipBox
=
tmp
;
...
...
pcbnew/dialogs/dialog_gendrill.h
View file @
0d459865
...
@@ -54,7 +54,8 @@ private:
...
@@ -54,7 +54,8 @@ private:
static
bool
m_createRpt
;
// true to create a drill file report
static
bool
m_createRpt
;
// true to create a drill file report
static
int
m_createMap
;
// > 0 to create a map file report
static
int
m_createMap
;
// > 0 to create a map file report
public
:
DIALOG_GENDRILL
(
PCB_EDIT_FRAME
*
parent
);
public
:
DIALOG_GENDRILL
(
PCB_EDIT_FRAME
*
parent
);
~
DIALOG_GENDRILL
();
~
DIALOG_GENDRILL
();
private
:
private
:
...
...
pcbnew/gen_drill_report_files.cpp
View file @
0d459865
...
@@ -20,25 +20,24 @@
...
@@ -20,25 +20,24 @@
void
GenDrillMapFile
(
BOARD
*
aPcb
,
FILE
*
aFile
,
const
wxString
&
aFullFileName
,
void
GenDrillMapFile
(
BOARD
*
aPcb
,
FILE
*
aFile
,
const
wxString
&
aFullFileName
,
Ki_PageDescr
*
aSheet
,
const
PAGE_INFO
&
aSheet
,
std
::
vector
<
HOLE_INFO
>
aHoleListBuffer
,
std
::
vector
<
HOLE_INFO
>
aHoleListBuffer
,
std
::
vector
<
DRILL_TOOL
>
aToolListBuffer
,
std
::
vector
<
DRILL_TOOL
>
aToolListBuffer
,
bool
aUnit_Drill_is_Inch
,
int
format
,
bool
aUnit_Drill_is_Inch
,
int
format
,
const
wxPoint
&
auxoffset
)
const
wxPoint
&
auxoffset
)
{
{
int
x
,
y
;
int
x
,
y
;
int
plotX
,
plotY
,
TextWidth
;
int
plotX
,
plotY
,
TextWidth
;
double
scale
=
1.0
;
double
scale
=
1.0
;
int
intervalle
=
0
,
CharSize
=
0
;
int
intervalle
=
0
,
CharSize
=
0
;
EDA_ITEM
*
PtStruct
;
EDA_ITEM
*
PtStruct
;
char
line
[
1024
];
char
line
[
1024
];
int
dX
,
dY
;
int
dX
,
dY
;
wxPoint
BoardCentre
;
wxPoint
BoardCentre
;
wxPoint
offset
;
wxPoint
offset
;
wxString
msg
;
wxString
msg
;
PLOTTER
*
plotter
=
NULL
;
PLOTTER
*
plotter
=
NULL
;
LOCALE_IO
toggle
;
// use standard notation for float numbers
SetLocaleTo_C_standard
();
// Use the standard notation for float numbers
// Calculate dimensions and center of PCB
// Calculate dimensions and center of PCB
EDA_RECT
bbbox
=
aPcb
->
ComputeBoundingBox
();
EDA_RECT
bbbox
=
aPcb
->
ComputeBoundingBox
();
...
@@ -58,7 +57,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
...
@@ -58,7 +57,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
plotter
->
set_viewport
(
offset
,
scale
,
0
);
plotter
->
set_viewport
(
offset
,
scale
,
0
);
break
;
break
;
case
PLOT_FORMAT_HPGL
:
/
* Scale for HPGL format. */
case
PLOT_FORMAT_HPGL
:
/
/ Scale for HPGL format.
{
{
offset
.
x
=
0
;
offset
.
x
=
0
;
offset
.
y
=
0
;
offset
.
y
=
0
;
...
@@ -68,29 +67,29 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
...
@@ -68,29 +67,29 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
hpgl_plotter
->
set_pen_number
(
g_PcbPlotOptions
.
m_HPGLPenNum
);
hpgl_plotter
->
set_pen_number
(
g_PcbPlotOptions
.
m_HPGLPenNum
);
hpgl_plotter
->
set_pen_speed
(
g_PcbPlotOptions
.
m_HPGLPenSpeed
);
hpgl_plotter
->
set_pen_speed
(
g_PcbPlotOptions
.
m_HPGLPenSpeed
);
hpgl_plotter
->
set_pen_overlap
(
0
);
hpgl_plotter
->
set_pen_overlap
(
0
);
plotter
->
set_paper_size
(
aSheet
);
plotter
->
SetPageSettings
(
aSheet
);
plotter
->
set_viewport
(
offset
,
scale
,
0
);
plotter
->
set_viewport
(
offset
,
scale
,
0
);
}
}
break
;
break
;
case
PLOT_FORMAT_POST
:
case
PLOT_FORMAT_POST
:
{
{
Ki_PageDescr
*
SheetPS
=
&
g_Sheet_A4
;
PAGE_INFO
pageA4
(
wxT
(
"A4"
)
);
wxSize
SheetSize
;
wxSize
pageSizeIU
=
pageA4
.
GetSizeIU
();
SheetSize
.
x
=
SheetPS
->
m_Size
.
x
*
U_PCB
;
SheetSize
.
y
=
SheetPS
->
m_Size
.
y
*
U_PCB
;
// Keep size for drill legend
/* Keep size for drill legend */
double
Xscale
=
(
double
)
(
pageSizeIU
.
x
*
0.8
)
/
dX
;
double
Xscale
=
(
double
)
(
SheetSize
.
x
*
0.8
)
/
dX
;
double
Yscale
=
(
double
)
(
pageSizeIU
.
y
*
0.6
)
/
dY
;
double
Yscale
=
(
double
)
(
SheetSize
.
y
*
0.6
)
/
dY
;
scale
=
MIN
(
Xscale
,
Yscale
);
scale
=
MIN
(
Xscale
,
Yscale
);
offset
.
x
=
(
int
)
(
(
double
)
BoardCentre
.
x
-
(
(
double
)
SheetSize
.
x
/
2.0
)
/
scale
);
offset
.
x
=
(
int
)
(
(
double
)
BoardCentre
.
x
-
(
(
double
)
pageSizeIU
.
x
/
2.0
)
/
scale
);
offset
.
y
=
(
int
)
(
(
double
)
BoardCentre
.
y
-
(
(
double
)
SheetSize
.
y
/
2.0
)
/
scale
);
offset
.
y
=
(
int
)
(
(
double
)
BoardCentre
.
y
-
(
(
double
)
pageSizeIU
.
y
/
2.0
)
/
scale
);
offset
.
y
+=
SheetSize
.
y
/
8
;
/* offset to legend */
offset
.
y
+=
pageSizeIU
.
y
/
8
;
// offset to legend
PS_PLOTTER
*
ps_plotter
=
new
PS_PLOTTER
;
PS_PLOTTER
*
ps_plotter
=
new
PS_PLOTTER
;
plotter
=
ps_plotter
;
plotter
=
ps_plotter
;
ps_plotter
->
set_paper_size
(
SheetPS
);
ps_plotter
->
SetPageSettings
(
pageA4
);
plotter
->
set_viewport
(
offset
,
scale
,
0
);
plotter
->
set_viewport
(
offset
,
scale
,
0
);
break
;
break
;
}
}
...
@@ -102,7 +101,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
...
@@ -102,7 +101,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
scale
=
1
;
scale
=
1
;
DXF_PLOTTER
*
dxf_plotter
=
new
DXF_PLOTTER
;
DXF_PLOTTER
*
dxf_plotter
=
new
DXF_PLOTTER
;
plotter
=
dxf_plotter
;
plotter
=
dxf_plotter
;
plotter
->
set_paper_size
(
aSheet
);
plotter
->
SetPageSettings
(
aSheet
);
plotter
->
set_viewport
(
offset
,
scale
,
0
);
plotter
->
set_viewport
(
offset
,
scale
,
0
);
break
;
break
;
}
}
...
@@ -116,7 +115,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
...
@@ -116,7 +115,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
plotter
->
set_default_line_width
(
10
);
plotter
->
set_default_line_width
(
10
);
plotter
->
start_plot
(
aFile
);
plotter
->
start_plot
(
aFile
);
/
* Draw items on edge layer */
/
/ Draw items on edge layer
for
(
PtStruct
=
aPcb
->
m_Drawings
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Next
()
)
for
(
PtStruct
=
aPcb
->
m_Drawings
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Next
()
)
{
{
...
@@ -154,19 +153,19 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
...
@@ -154,19 +153,19 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
// Plot board outlines and drill map
// Plot board outlines and drill map
Gen_Drill_PcbMap
(
aPcb
,
plotter
,
aHoleListBuffer
,
aToolListBuffer
);
Gen_Drill_PcbMap
(
aPcb
,
plotter
,
aHoleListBuffer
,
aToolListBuffer
);
/
* Print a list of symbols used. */
/
/ Print a list of symbols used.
CharSize
=
800
;
/
* text size in 1/10000 mils */
CharSize
=
800
;
/
/ text size in 1/10000 mils
double
CharScale
=
1.0
/
scale
;
/* real scale will be CharScale
double
CharScale
=
1.0
/
scale
;
/* real scale will be CharScale
* scale_x, because the global
* scale_x, because the global
* plot scale is scale_x */
* plot scale is scale_x */
TextWidth
=
(
int
)
(
(
CharSize
*
CharScale
)
/
10
);
// Set text width (thickness)
TextWidth
=
(
int
)
(
(
CharSize
*
CharScale
)
/
10
);
// Set text width (thickness)
intervalle
=
(
int
)
(
CharSize
*
CharScale
)
+
TextWidth
;
intervalle
=
(
int
)
(
CharSize
*
CharScale
)
+
TextWidth
;
/
* Trace information. */
/
/ Trace information.
plotX
=
(
int
)
(
(
double
)
bbbox
.
GetX
()
+
200.0
*
CharScale
);
plotX
=
(
int
)
(
(
double
)
bbbox
.
GetX
()
+
200.0
*
CharScale
);
plotY
=
bbbox
.
GetBottom
()
+
intervalle
;
plotY
=
bbbox
.
GetBottom
()
+
intervalle
;
/
* Plot title "Info" */
/
/ Plot title "Info"
wxString
Text
=
wxT
(
"Drill Map:"
);
wxString
Text
=
wxT
(
"Drill Map:"
);
plotter
->
text
(
wxPoint
(
plotX
,
plotY
),
BLACK
,
Text
,
0
,
plotter
->
text
(
wxPoint
(
plotX
,
plotY
),
BLACK
,
Text
,
0
,
wxSize
(
(
int
)
(
CharSize
*
CharScale
),
wxSize
(
(
int
)
(
CharSize
*
CharScale
),
...
@@ -188,7 +187,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
...
@@ -188,7 +187,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
y
=
(
int
)
(
(
double
)
plotY
+
(
double
)
CharSize
*
CharScale
);
y
=
(
int
)
(
(
double
)
plotY
+
(
double
)
CharSize
*
CharScale
);
plotter
->
marker
(
wxPoint
(
x
,
y
),
plot_diam
,
ii
);
plotter
->
marker
(
wxPoint
(
x
,
y
),
plot_diam
,
ii
);
/
* Trace the legends. */
/
/ Trace the legends.
// List the diameter of each drill in the selected Drill Unit,
// List the diameter of each drill in the selected Drill Unit,
// and then its diameter in the other Drill Unit.
// and then its diameter in the other Drill Unit.
...
@@ -235,7 +234,6 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
...
@@ -235,7 +234,6 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
plotter
->
end_plot
();
plotter
->
end_plot
();
delete
plotter
;
delete
plotter
;
SetLocaleTo_Default
();
// Revert to local notation for float numbers
}
}
...
@@ -251,7 +249,7 @@ void Gen_Drill_PcbMap( BOARD* aPcb, PLOTTER* aPlotter,
...
@@ -251,7 +249,7 @@ void Gen_Drill_PcbMap( BOARD* aPcb, PLOTTER* aPlotter,
{
{
wxPoint
pos
;
wxPoint
pos
;
/
* create the drill list */
/
/ create the drill list
if
(
aToolListBuffer
.
size
()
>
13
)
if
(
aToolListBuffer
.
size
()
>
13
)
{
{
DisplayInfoMessage
(
NULL
,
DisplayInfoMessage
(
NULL
,
...
...
pcbnew/gendrill.cpp
View file @
0d459865
...
@@ -635,7 +635,7 @@ void DIALOG_GENDRILL::GenDrillMap( const wxString aFileName,
...
@@ -635,7 +635,7 @@ void DIALOG_GENDRILL::GenDrillMap( const wxString aFileName,
GenDrillMapFile
(
m_Parent
->
GetBoard
(),
GenDrillMapFile
(
m_Parent
->
GetBoard
(),
plotfile
,
plotfile
,
dlg
.
GetPath
(),
dlg
.
GetPath
(),
m_Parent
->
Get
Screen
()
->
m_CurrentSheetDesc
,
m_Parent
->
Get
PageSettings
()
,
s_HoleListBuffer
,
s_HoleListBuffer
,
s_ToolListBuffer
,
s_ToolListBuffer
,
m_UnitDrillIsInch
,
m_UnitDrillIsInch
,
...
...
pcbnew/gendrill.h
View file @
0d459865
...
@@ -217,7 +217,7 @@ void Build_Holes_List( BOARD* aPcb, std::vector<HOLE_INFO>& aHoleListBuffer,
...
@@ -217,7 +217,7 @@ void Build_Holes_List( BOARD* aPcb, std::vector<HOLE_INFO>& aHoleListBuffer,
void
GenDrillMapFile
(
BOARD
*
aPcb
,
void
GenDrillMapFile
(
BOARD
*
aPcb
,
FILE
*
aFile
,
FILE
*
aFile
,
const
wxString
&
aFullFileName
,
const
wxString
&
aFullFileName
,
Ki_PageDescr
*
aSheet
,
const
PAGE_INFO
&
aSheet
,
std
::
vector
<
HOLE_INFO
>
aHoleListBuffer
,
std
::
vector
<
HOLE_INFO
>
aHoleListBuffer
,
std
::
vector
<
DRILL_TOOL
>
aToolListBuffer
,
std
::
vector
<
DRILL_TOOL
>
aToolListBuffer
,
bool
aUnit_Drill_is_Inch
,
bool
aUnit_Drill_is_Inch
,
...
...
pcbnew/initpcb.cpp
View file @
0d459865
...
@@ -42,21 +42,22 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
...
@@ -42,21 +42,22 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
SetBoard
(
new
BOARD
()
);
SetBoard
(
new
BOARD
()
);
SetCurItem
(
NULL
);
SetCurItem
(
NULL
);
/
* clear filename, to avoid overwriting an old file */
/
/ clear filename, to avoid overwriting an old file
GetScreen
()
->
GetFileName
().
Empty
();
GetScreen
()
->
GetFileName
().
Empty
();
/* Init new grid size */
// preserve grid size accross call to InitDataPoints()
wxRealPoint
gridsize
=
GetScreen
()
->
GetGridSize
();
GetScreen
()
->
Init
();
// wxRealPoint gridsize = GetScreen()->GetGridSize();
GetScreen
()
->
SetGrid
(
gridsize
);
GetScreen
()
->
InitDataPoints
(
GetPageSizeIU
()
);
// GetScreen()->SetGrid( gridsize );
GetBoard
()
->
ResetHighLight
();
GetBoard
()
->
ResetHighLight
();
// Enable all layers (SetCopperLayerCount() will adjust the copper layers enabled)
// Enable all layers (SetCopperLayerCount() will adjust the copper layers enabled)
GetBoard
()
->
SetEnabledLayers
(
ALL_LAYERS
);
GetBoard
()
->
SetEnabledLayers
(
ALL_LAYERS
);
// Default copper layers count set to 2: double layer board
// Default copper layers count set to 2: double layer board
GetBoard
()
->
SetCopperLayerCount
(
2
);
GetBoard
()
->
SetCopperLayerCount
(
2
);
// Update display:
// Update display:
GetBoard
()
->
SetVisibleLayers
(
ALL_LAYERS
);
GetBoard
()
->
SetVisibleLayers
(
ALL_LAYERS
);
...
@@ -91,15 +92,15 @@ bool FOOTPRINT_EDIT_FRAME::Clear_Pcb( bool aQuery )
...
@@ -91,15 +92,15 @@ bool FOOTPRINT_EDIT_FRAME::Clear_Pcb( bool aQuery )
// Delete the current footprint
// Delete the current footprint
GetBoard
()
->
m_Modules
.
DeleteAll
();
GetBoard
()
->
m_Modules
.
DeleteAll
();
/
* init pointeurs et variables */
/
/ init pointeurs et variables
GetScreen
()
->
GetFileName
().
Empty
();
GetScreen
()
->
GetFileName
().
Empty
();
SetCurItem
(
NULL
);
SetCurItem
(
NULL
);
/
* Init parametres de gestion */
/
/ preserve grid size accross call to InitDataPoints()
wxRealPoint
gridsize
=
GetScreen
()
->
GetGridSize
();
//
wxRealPoint gridsize = GetScreen()->GetGridSize();
GetScreen
()
->
Init
(
);
GetScreen
()
->
Init
DataPoints
(
GetPageSizeIU
()
);
GetScreen
()
->
SetGrid
(
gridsize
);
//
GetScreen()->SetGrid( gridsize );
Zoom_Automatique
(
false
);
Zoom_Automatique
(
false
);
...
...
pcbnew/io_mgr.h
View file @
0d459865
...
@@ -119,6 +119,8 @@ public:
...
@@ -119,6 +119,8 @@ public:
* implementation knows about, or it can be used to write a portion of
* implementation knows about, or it can be used to write a portion of
* aBoard to a special kind of export file.
* aBoard to a special kind of export file.
*
*
* @param aFileType is the PCB_FILE_T of file to save.
*
* @param aFileName is the name of a file to save to on disk.
* @param aFileName is the name of a file to save to on disk.
* @param aBoard is the BOARD document (data tree) to save or export to disk.
* @param aBoard is the BOARD document (data tree) to save or export to disk.
*
*
...
...
pcbnew/ioascii.cpp
View file @
0d459865
...
@@ -786,7 +786,7 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
...
@@ -786,7 +786,7 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
EDA_ITEM
*
PtStruct
=
GetBoard
()
->
m_Modules
;
EDA_ITEM
*
PtStruct
=
GetBoard
()
->
m_Modules
;
int
NbModules
,
NbDrawItem
,
NbLayers
;
int
NbModules
,
NbDrawItem
,
NbLayers
;
/
* Write copper layer count */
/
/ Write copper layer count
NbLayers
=
GetBoard
()
->
GetCopperLayerCount
();
NbLayers
=
GetBoard
()
->
GetCopperLayerCount
();
fprintf
(
File
,
"$GENERAL
\n
"
);
fprintf
(
File
,
"$GENERAL
\n
"
);
fprintf
(
File
,
"encoding utf-8
\n
"
);
fprintf
(
File
,
"encoding utf-8
\n
"
);
...
@@ -801,7 +801,7 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
...
@@ -801,7 +801,7 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
fprintf
(
File
,
"Links %d
\n
"
,
GetBoard
()
->
GetRatsnestsCount
()
);
fprintf
(
File
,
"Links %d
\n
"
,
GetBoard
()
->
GetRatsnestsCount
()
);
fprintf
(
File
,
"NoConn %d
\n
"
,
GetBoard
()
->
m_NbNoconnect
);
fprintf
(
File
,
"NoConn %d
\n
"
,
GetBoard
()
->
m_NbNoconnect
);
// Write
B
ounding box info
// Write
board's b
ounding box info
EDA_RECT
bbbox
=
GetBoard
()
->
ComputeBoundingBox
();
EDA_RECT
bbbox
=
GetBoard
()
->
ComputeBoundingBox
();
fprintf
(
File
,
"Di %d %d %d %d
\n
"
,
fprintf
(
File
,
"Di %d %d %d %d
\n
"
,
bbbox
.
GetX
(),
bbbox
.
GetX
(),
...
@@ -809,8 +809,8 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
...
@@ -809,8 +809,8 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
bbbox
.
GetRight
(),
bbbox
.
GetRight
(),
bbbox
.
GetBottom
()
);
bbbox
.
GetBottom
()
);
/
* Write segment count for footprints, drawings, track and zones */
/
/ Write segment count for footprints, drawings, track and zones
/
* Calculate the footprint count */
/
/ Calculate the footprint count
for
(
NbModules
=
0
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Next
()
)
for
(
NbModules
=
0
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Next
()
)
NbModules
++
;
NbModules
++
;
...
@@ -836,13 +836,14 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
...
@@ -836,13 +836,14 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
* @param screen BASE_SCREEN to save
* @param screen BASE_SCREEN to save
* @param File = an open FILE to write info
* @param File = an open FILE to write info
*/
*/
bool
WriteSheetDescr
(
BASE_SCREEN
*
screen
,
FILE
*
File
)
static
bool
WriteSheetDescr
(
const
PAGE_INFO
&
aPageSettings
,
BASE_SCREEN
*
screen
,
FILE
*
File
)
{
{
Ki_PageDescr
*
sheet
=
screen
->
m_CurrentSheetDesc
;
fprintf
(
File
,
"$SHEETDESCR
\n
"
);
fprintf
(
File
,
"$SHEETDESCR
\n
"
);
fprintf
(
File
,
"Sheet %s %d %d
\n
"
,
fprintf
(
File
,
"Sheet %s %d %d
\n
"
,
TO_UTF8
(
sheet
->
m_Name
),
sheet
->
m_Size
.
x
,
sheet
->
m_Size
.
y
);
TO_UTF8
(
aPageSettings
.
GetType
()
),
aPageSettings
.
GetSizeMils
().
x
,
aPageSettings
.
GetSizeMils
().
y
);
fprintf
(
File
,
"Title %s
\n
"
,
EscapedUTF8
(
screen
->
m_Title
).
c_str
()
);
fprintf
(
File
,
"Title %s
\n
"
,
EscapedUTF8
(
screen
->
m_Title
).
c_str
()
);
fprintf
(
File
,
"Date %s
\n
"
,
EscapedUTF8
(
screen
->
m_Date
).
c_str
()
);
fprintf
(
File
,
"Date %s
\n
"
,
EscapedUTF8
(
screen
->
m_Date
).
c_str
()
);
fprintf
(
File
,
"Rev %s
\n
"
,
EscapedUTF8
(
screen
->
m_Revision
).
c_str
()
);
fprintf
(
File
,
"Rev %s
\n
"
,
EscapedUTF8
(
screen
->
m_Revision
).
c_str
()
);
...
@@ -859,7 +860,7 @@ bool WriteSheetDescr( BASE_SCREEN* screen, FILE* File )
...
@@ -859,7 +860,7 @@ bool WriteSheetDescr( BASE_SCREEN* screen, FILE* File )
#if !defined( USE_NEW_PCBNEW_LOAD )
#if !defined( USE_NEW_PCBNEW_LOAD )
static
bool
ReadSheetDescr
(
BASE_SCREEN
*
screen
,
LINE_READER
*
aReader
)
static
bool
ReadSheetDescr
(
B
OARD
*
aBoard
,
B
ASE_SCREEN
*
screen
,
LINE_READER
*
aReader
)
{
{
char
buf
[
1024
];
char
buf
[
1024
];
char
*
text
;
char
*
text
;
...
@@ -873,32 +874,41 @@ static bool ReadSheetDescr( BASE_SCREEN* screen, LINE_READER* aReader )
...
@@ -873,32 +874,41 @@ static bool ReadSheetDescr( BASE_SCREEN* screen, LINE_READER* aReader )
if
(
strnicmp
(
line
,
"Sheet"
,
4
)
==
0
)
if
(
strnicmp
(
line
,
"Sheet"
,
4
)
==
0
)
{
{
text
=
strtok
(
line
,
"
\t\n\r
"
);
// e.g. "Sheet A3 16535 11700"
text
=
strtok
(
NULL
,
"
\t\n\r
"
);
// width and height are in 1/1000th of an inch, always
Ki_PageDescr
*
sheet
=
g_SheetSizeList
[
0
];
int
ii
;
PAGE_INFO
page
;
char
*
sname
=
strtok
(
line
+
SZ
(
"Sheet"
),
delims
);
for
(
ii
=
0
;
sheet
!=
NULL
;
ii
++
,
sheet
=
g_SheetSizeList
[
ii
]
)
if
(
sname
)
{
{
if
(
stricmp
(
TO_UTF8
(
sheet
->
m_Name
),
text
)
==
0
)
wxString
wname
=
FROM_UTF8
(
sname
);
if
(
!
page
.
SetType
(
wname
)
)
{
{
screen
->
m_CurrentSheetDesc
=
sheet
;
m_error
.
Printf
(
_
(
"Unknown sheet type '%s' on line:%d"
),
wname
.
GetData
(),
m_reader
->
LineNumber
()
);
if
(
sheet
==
&
g_Sheet_user
)
THROW_IO_ERROR
(
m_error
);
{
}
text
=
strtok
(
NULL
,
"
\t\n\r
"
);
if
(
text
)
// only parse the width and height if page size is "User"
sheet
->
m_Size
.
x
=
atoi
(
text
);
if
(
wname
==
wxT
(
"User"
)
)
{
char
*
width
=
strtok
(
line
,
delims
);
char
*
height
=
strtok
(
line
,
delims
);
text
=
strtok
(
NULL
,
"
\t\n\r
"
);
if
(
width
&&
height
)
{
// legacy disk file describes paper in mils
// (1/1000th of an inch)
int
w
=
intParse
(
width
);
int
h
=
intParse
(
height
);
if
(
text
)
page
.
SetWidthInches
(
w
/
1000.0
);
sheet
->
m_Size
.
y
=
atoi
(
text
);
page
.
SetHeightInches
(
h
/
1000.0
);
}
}
break
;
}
}
aBoard
->
SetPageSettings
(
page
);
}
}
continue
;
continue
;
...
@@ -1098,7 +1108,7 @@ int PCB_EDIT_FRAME::ReadPcbFile( LINE_READER* aReader, bool Append )
...
@@ -1098,7 +1108,7 @@ int PCB_EDIT_FRAME::ReadPcbFile( LINE_READER* aReader, bool Append )
if
(
TESTLINE
(
"SHEETDESCR"
)
)
if
(
TESTLINE
(
"SHEETDESCR"
)
)
{
{
ReadSheetDescr
(
GetScreen
(),
aReader
);
ReadSheetDescr
(
board
,
GetScreen
(),
aReader
);
continue
;
continue
;
}
}
...
@@ -1162,7 +1172,7 @@ int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile )
...
@@ -1162,7 +1172,7 @@ int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile )
// like 1.3)
// like 1.3)
LOCALE_IO
toggle
;
LOCALE_IO
toggle
;
/
* Writing file header. */
/
/ Writing file header.
fprintf
(
aFile
,
"PCBNEW-BOARD Version %d date %s
\n\n
"
,
BOARD_FILE_VERSION
,
fprintf
(
aFile
,
"PCBNEW-BOARD Version %d date %s
\n\n
"
,
BOARD_FILE_VERSION
,
TO_UTF8
(
DateAndTime
()
)
);
TO_UTF8
(
DateAndTime
()
)
);
fprintf
(
aFile
,
"# Created by Pcbnew%s
\n\n
"
,
TO_UTF8
(
GetBuildVersion
()
)
);
fprintf
(
aFile
,
"# Created by Pcbnew%s
\n\n
"
,
TO_UTF8
(
GetBuildVersion
()
)
);
...
@@ -1174,7 +1184,7 @@ int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile )
...
@@ -1174,7 +1184,7 @@ int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile )
GetBoard
()
->
SetCurrentNetClass
(
GetBoard
()
->
m_NetClasses
.
GetDefault
()
->
GetName
()
);
GetBoard
()
->
SetCurrentNetClass
(
GetBoard
()
->
m_NetClasses
.
GetDefault
()
->
GetName
()
);
WriteGeneralDescrPcb
(
aFile
);
WriteGeneralDescrPcb
(
aFile
);
WriteSheetDescr
(
GetScreen
(),
aFile
);
WriteSheetDescr
(
Get
Board
()
->
GetPageSettings
(),
Get
Screen
(),
aFile
);
WriteSetup
(
aFile
,
this
,
GetBoard
()
);
WriteSetup
(
aFile
,
this
,
GetBoard
()
);
rc
=
GetBoard
()
->
Save
(
aFile
);
rc
=
GetBoard
()
->
Save
(
aFile
);
...
...
pcbnew/kicad_plugin.cpp
View file @
0d459865
...
@@ -98,7 +98,7 @@
...
@@ -98,7 +98,7 @@
/// C string compare test for a specific length of characters.
/// C string compare test for a specific length of characters.
/// The -1 is to omit the trailing \0 which is included in sizeof() on a
/// The -1 is to omit the trailing \0 which is included in sizeof() on a
/// string constant.
/// string constant.
#define TESTLINE( x ) (strn
cmp( line, x, sizeof(x) -
1 ) == 0)
#define TESTLINE( x ) (strn
icmp( line, x, sizeof(x)-
1 ) == 0)
/// Get the length of a string constant, at compile time
/// Get the length of a string constant, at compile time
#define SZ( x ) (sizeof(x)-1)
#define SZ( x ) (sizeof(x)-1)
...
@@ -440,7 +440,6 @@ void KICAD_PLUGIN::loadGENERAL()
...
@@ -440,7 +440,6 @@ void KICAD_PLUGIN::loadGENERAL()
void
KICAD_PLUGIN
::
loadSHEET
()
void
KICAD_PLUGIN
::
loadSHEET
()
{
{
char
buf
[
260
];
char
buf
[
260
];
char
*
text
;
while
(
READLINE
()
)
while
(
READLINE
()
)
{
{
...
@@ -448,33 +447,41 @@ void KICAD_PLUGIN::loadSHEET()
...
@@ -448,33 +447,41 @@ void KICAD_PLUGIN::loadSHEET()
if
(
TESTLINE
(
"Sheet"
)
)
if
(
TESTLINE
(
"Sheet"
)
)
{
{
text
=
strtok
(
line
,
delims
);
// e.g. "Sheet A3 16535 11700"
text
=
strtok
(
NULL
,
delims
);
// width and height are in 1/1000th of an inch, always
Ki_PageDescr
*
sheet
=
g_SheetSizeList
[
0
]
;
PAGE_INFO
page
;
int
ii
;
char
*
sname
=
strtok
(
line
+
SZ
(
"Sheet"
),
delims
)
;
for
(
ii
=
0
;
sheet
!=
NULL
;
ii
++
,
sheet
=
g_SheetSizeList
[
ii
]
)
if
(
sname
)
{
{
if
(
!
stricmp
(
TO_UTF8
(
sheet
->
m_Name
),
text
)
)
wxString
wname
=
FROM_UTF8
(
sname
);
if
(
!
page
.
SetType
(
wname
)
)
{
{
// @todo screen->m_CurrentSheetDesc = sheet;
m_error
.
Printf
(
_
(
"Unknown sheet type '%s' on line:%d"
),
wname
.
GetData
(),
m_reader
->
LineNumber
()
);
if
(
sheet
==
&
g_Sheet_user
)
THROW_IO_ERROR
(
m_error
);
{
}
text
=
strtok
(
NULL
,
delims
);
if
(
text
)
// only parse the width and height if page size is "User"
sheet
->
m_Size
.
x
=
intParse
(
text
);
if
(
wname
==
wxT
(
"User"
)
)
{
char
*
width
=
strtok
(
line
,
delims
);
char
*
height
=
strtok
(
line
,
delims
);
text
=
strtok
(
NULL
,
delims
);
if
(
width
&&
height
)
{
// legacy disk file describes paper in mils
// (1/1000th of an inch)
int
w
=
intParse
(
width
);
int
h
=
intParse
(
height
);
if
(
text
)
page
.
SetWidthInches
(
w
/
1000.0
);
sheet
->
m_Size
.
y
=
intParse
(
text
);
page
.
SetHeightInches
(
h
/
1000.0
);
}
}
break
;
}
}
m_board
->
SetPageSettings
(
page
);
}
}
}
}
...
@@ -2727,14 +2734,17 @@ void KICAD_PLUGIN::saveGENERAL() const
...
@@ -2727,14 +2734,17 @@ void KICAD_PLUGIN::saveGENERAL() const
void
KICAD_PLUGIN
::
saveSHEET
()
const
void
KICAD_PLUGIN
::
saveSHEET
()
const
{
{
#if 0 // @todo sheet not available here. The sheet needs to go into the board if it is important enough to be saved with the board
const
PAGE_INFO
&
pageInfo
=
m_board
->
GetPageSettings
();
Ki_PageDescr* sheet = screen->m_CurrentSheetDesc;
fprintf
(
m_fp
,
"$SHEETDESCR
\n
"
);
fprintf
(
m_fp
,
"$SHEETDESCR
\n
"
);
fprintf( m_fp, "Sheet %s %d %d\n",
// paper is described in mils
TO_UTF8( sheet->m_Name ), sheet->m_Size.x, sheet->m_Size.y ); // in mm ?
fprintf
(
m_fp
,
"Sheet %s %d %d
\n
"
,
TO_UTF8
(
pageInfo
.
GetType
()
),
pageInfo
.
GetSizeMils
().
x
,
pageInfo
.
GetSizeMils
().
y
);
#if 0 // @todo sheet not available here. The sheet needs to go into the board if it is important enough to be saved with the board
fprintf( m_fp, "Title %s\n", EscapedUTF8( screen->m_Title ).c_str() );
fprintf( m_fp, "Title %s\n", EscapedUTF8( screen->m_Title ).c_str() );
fprintf( m_fp, "Date %s\n", EscapedUTF8( screen->m_Date ).c_str() );
fprintf( m_fp, "Date %s\n", EscapedUTF8( screen->m_Date ).c_str() );
fprintf( m_fp, "Rev %s\n", EscapedUTF8( screen->m_Revision ).c_str() );
fprintf( m_fp, "Rev %s\n", EscapedUTF8( screen->m_Revision ).c_str() );
...
@@ -2744,8 +2754,9 @@ void KICAD_PLUGIN::saveSHEET() const
...
@@ -2744,8 +2754,9 @@ void KICAD_PLUGIN::saveSHEET() const
fprintf( m_fp, "Comment3 %s\n", EscapedUTF8( screen->m_Commentaire3 ).c_str() );
fprintf( m_fp, "Comment3 %s\n", EscapedUTF8( screen->m_Commentaire3 ).c_str() );
fprintf( m_fp, "Comment4 %s\n", EscapedUTF8( screen->m_Commentaire4 ).c_str() );
fprintf( m_fp, "Comment4 %s\n", EscapedUTF8( screen->m_Commentaire4 ).c_str() );
fprintf( m_fp, "$EndSHEETDESCR\n\n" );
#endif
#endif
fprintf
(
m_fp
,
"$EndSHEETDESCR
\n\n
"
);
}
}
...
@@ -3077,26 +3088,29 @@ void KICAD_PLUGIN::savePAD( const D_PAD* me ) const
...
@@ -3077,26 +3088,29 @@ void KICAD_PLUGIN::savePAD( const D_PAD* me ) const
THROW_IO_ERROR
(
wxString
::
Format
(
UNKNOWN_PAD_FORMAT
,
me
->
GetShape
()
)
);
THROW_IO_ERROR
(
wxString
::
Format
(
UNKNOWN_PAD_FORMAT
,
me
->
GetShape
()
)
);
}
}
// universal character set padname
#if BOARD_FORMAT_VERSION == 1 // saving mode is a compile time option
wxString
padname
=
me
->
GetPadName
();
#if BOARD_FORMAT_VERSION == 1
char
mypadname
[
PADNAMEZ
+
1
];
wxString
wpadname
=
me
->
GetPadName
();
// universal character set padname
std
::
string
spadname
;
int
i
;
for
(
unsigned
i
=
0
;
wpadname
.
size
();
++
i
)
for
(
i
=
0
;
i
<
PADNAMEZ
&&
padname
[
i
];
++
i
)
{
{
// truncate from universal character down to 8 bit foreign jibber jabber byte
// truncate from universal character down to 8 bit foreign jibber
mypadname
[
i
]
=
(
char
)
padname
[
i
];
// jabber byte. This basically duplicates what was done in the old
// BOARD_FORMAT_VERSION 1 code. Any characters that were in the 8 bit
// character space were OK.
spadname
+=
(
char
)
wpadname
[
i
];
}
}
mypadname
[
i
]
=
0
;
fprintf
(
m_fp
,
"Sh
\"
%s
\"
%c %s %s %s
\n
"
,
fprintf
(
m_fp
,
"Sh
\"
%s
\"
%c %s %s %s
\n
"
,
mypadname
,
// probably ASCII, but possibly jibber jabber
spadname
.
c_str
(),
// probably ASCII, but possibly jibber jabber
#else
#else
fprintf
(
m_fp
,
"Sh %s %c %s %s %s
\n
"
,
fprintf
(
m_fp
,
"Sh %s %c %s %s %s
\n
"
,
// legacy VERSION 2 simply uses UTF8, wrapped in quotes,
// and 99.99 % of the time there is no difference between 1 & 2,
// since ASCII is a subset of UTF8. But if they were not using
// ASCII pad names, then there is a difference in the file.
EscapedUTF8
(
me
->
GetPadName
()
).
c_str
(),
EscapedUTF8
(
me
->
GetPadName
()
).
c_str
(),
#endif
#endif
cshape
,
cshape
,
...
...
pcbnew/minimun_spanning_tree.h
View file @
0d459865
...
@@ -70,7 +70,7 @@ private:
...
@@ -70,7 +70,7 @@ private:
* updates d so that the values are correct (goes through target's
* updates d so that the values are correct (goes through target's
* neighbours making sure that the distances between them and the tree
* neighbours making sure that the distances between them and the tree
* are indeed minimum)
* are indeed minimum)
* @param
t
arget = index of curr item
* @param
aT
arget = index of curr item
*/
*/
void
updateDistances
(
int
aTarget
);
void
updateDistances
(
int
aTarget
);
...
...
pcbnew/plotdxf.cpp
View file @
0d459865
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
bool
PCB_BASE_FRAME
::
ExportToDxfFile
(
const
wxString
&
aFullFileName
,
int
aLayer
,
bool
PCB_BASE_FRAME
::
ExportToDxfFile
(
const
wxString
&
aFullFileName
,
int
aLayer
,
GRTraceMode
aTraceMode
)
GRTraceMode
aTraceMode
)
{
{
Ki_PageDescr
*
currentsheet
=
GetScreen
()
->
m_CurrentSheetDesc
;
LOCALE_IO
toggle
;
FILE
*
output_file
=
wxFopen
(
aFullFileName
,
wxT
(
"wt"
)
);
FILE
*
output_file
=
wxFopen
(
aFullFileName
,
wxT
(
"wt"
)
);
...
@@ -27,10 +27,8 @@ bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
...
@@ -27,10 +27,8 @@ bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
return
false
;
return
false
;
}
}
SetLocaleTo_C_standard
();
DXF_PLOTTER
*
plotter
=
new
DXF_PLOTTER
();
DXF_PLOTTER
*
plotter
=
new
DXF_PLOTTER
();
plotter
->
set_paper_size
(
currentsheet
);
plotter
->
SetPageSettings
(
GetPageSettings
()
);
plotter
->
set_viewport
(
wxPoint
(
0
,
0
),
1
,
0
);
plotter
->
set_viewport
(
wxPoint
(
0
,
0
),
1
,
0
);
plotter
->
set_creator
(
wxT
(
"PCBNEW-DXF"
)
);
plotter
->
set_creator
(
wxT
(
"PCBNEW-DXF"
)
);
plotter
->
set_filename
(
aFullFileName
);
plotter
->
set_filename
(
aFullFileName
);
...
@@ -42,7 +40,5 @@ bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
...
@@ -42,7 +40,5 @@ bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
Plot_Layer
(
plotter
,
aLayer
,
aTraceMode
);
Plot_Layer
(
plotter
,
aLayer
,
aTraceMode
);
plotter
->
end_plot
();
plotter
->
end_plot
();
delete
plotter
;
delete
plotter
;
SetLocaleTo_Default
();
return
true
;
return
true
;
}
}
pcbnew/plothpgl.cpp
View file @
0d459865
...
@@ -20,15 +20,14 @@
...
@@ -20,15 +20,14 @@
bool
PCB_BASE_FRAME
::
ExportToHpglFile
(
const
wxString
&
aFullFileName
,
int
aLayer
,
bool
PCB_BASE_FRAME
::
ExportToHpglFile
(
const
wxString
&
aFullFileName
,
int
aLayer
,
GRTraceMode
aTraceMode
)
GRTraceMode
aTraceMode
)
{
{
wxSize
SheetSize
;
wxSize
boardSize
;
wxSize
BoardSize
;
wxPoint
boardCenter
;
wxPoint
BoardCenter
;
bool
center
=
false
;
bool
Center
=
false
;
double
scale
;
Ki_PageDescr
*
currentsheet
=
GetScreen
()
->
m_CurrentSheetDesc
;
wxPoint
offset
;
double
scale
;
LOCALE_IO
toggle
;
wxPoint
offset
;
FILE
*
output_file
=
wxFopen
(
aFullFileName
,
wxT
(
"wt"
)
);
FILE
*
output_file
=
wxFopen
(
aFullFileName
,
wxT
(
"wt"
)
);
if
(
output_file
==
NULL
)
if
(
output_file
==
NULL
)
{
{
...
@@ -52,29 +51,26 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
...
@@ -52,29 +51,26 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
g_PcbPlotOptions
.
m_PlotScale
);
g_PcbPlotOptions
.
m_PlotScale
);
SetLocaleTo_C_standard
();
if
(
g_PcbPlotOptions
.
m_PlotScale
!=
1.0
||
g_PcbPlotOptions
.
m_AutoScale
)
if
(
g_PcbPlotOptions
.
m_PlotScale
!=
1.0
||
g_PcbPlotOptions
.
m_AutoScale
)
Center
=
true
;
// when scale != 1.0 we must calculate the position in page
{
// because actual position has no meaning
// when scale != 1.0 we must calculate the position in page
// because actual position has no meaning
center
=
true
;
}
// Scale units from 0.0001" to HPGL plot units.
wxSize
pageSizeIU
=
GetPageSizeIU
();
SheetSize
.
x
=
currentsheet
->
m_Size
.
x
*
U_PCB
;
SheetSize
.
y
=
currentsheet
->
m_Size
.
y
*
U_PCB
;
// Calculate the center of the PCB
// Calculate the center of the PCB
EDA_RECT
bbbox
=
GetBoardBoundingBox
();
EDA_RECT
bbbox
=
GetBoardBoundingBox
();
B
oardSize
=
bbbox
.
GetSize
();
b
oardSize
=
bbbox
.
GetSize
();
B
oardCenter
=
bbbox
.
Centre
();
b
oardCenter
=
bbbox
.
Centre
();
if
(
g_PcbPlotOptions
.
m_AutoScale
)
// Optimum scale
if
(
g_PcbPlotOptions
.
m_AutoScale
)
// Optimum scale
{
{
double
Xscale
,
Yscale
;
// Fit to 80% of the page
// Fit to 80% of the page
Xscale
=
(
(
SheetSize
.
x
*
0.8
)
/
B
oardSize
.
x
);
double
Xscale
=
(
(
pageSizeIU
.
x
*
0.8
)
/
b
oardSize
.
x
);
Yscale
=
(
(
SheetSize
.
y
*
0.8
)
/
B
oardSize
.
y
);
double
Yscale
=
(
(
pageSizeIU
.
y
*
0.8
)
/
b
oardSize
.
y
);
scale
=
MIN
(
Xscale
,
Yscale
);
scale
=
MIN
(
Xscale
,
Yscale
);
}
}
else
else
...
@@ -83,12 +79,12 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
...
@@ -83,12 +79,12 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
}
}
// Calculate the page size offset.
// Calculate the page size offset.
if
(
C
enter
)
if
(
c
enter
)
{
{
offset
.
x
=
wxRound
(
(
double
)
B
oardCenter
.
x
-
offset
.
x
=
wxRound
(
(
double
)
b
oardCenter
.
x
-
(
(
double
)
SheetSize
.
x
/
2.0
)
/
scale
);
(
(
double
)
pageSizeIU
.
x
/
2.0
)
/
scale
);
offset
.
y
=
wxRound
(
(
double
)
B
oardCenter
.
y
-
offset
.
y
=
wxRound
(
(
double
)
b
oardCenter
.
y
-
(
(
double
)
SheetSize
.
y
/
2.0
)
/
scale
);
(
(
double
)
pageSizeIU
.
y
/
2.0
)
/
scale
);
}
}
else
else
{
{
...
@@ -97,7 +93,9 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
...
@@ -97,7 +93,9 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
}
}
HPGL_PLOTTER
*
plotter
=
new
HPGL_PLOTTER
();
HPGL_PLOTTER
*
plotter
=
new
HPGL_PLOTTER
();
plotter
->
set_paper_size
(
currentsheet
);
plotter
->
SetPageSettings
(
GetPageSettings
()
);
plotter
->
set_viewport
(
offset
,
scale
,
g_PcbPlotOptions
.
m_PlotMirror
);
plotter
->
set_viewport
(
offset
,
scale
,
g_PcbPlotOptions
.
m_PlotMirror
);
plotter
->
set_default_line_width
(
g_PcbPlotOptions
.
m_PlotLineWidth
);
plotter
->
set_default_line_width
(
g_PcbPlotOptions
.
m_PlotLineWidth
);
plotter
->
set_creator
(
wxT
(
"PCBNEW-HPGL"
)
);
plotter
->
set_creator
(
wxT
(
"PCBNEW-HPGL"
)
);
...
@@ -108,14 +106,13 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
...
@@ -108,14 +106,13 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
plotter
->
set_pen_diameter
(
pen_diam
);
plotter
->
set_pen_diameter
(
pen_diam
);
plotter
->
start_plot
(
output_file
);
plotter
->
start_plot
(
output_file
);
/
* The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway */
/
/ The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway
if
(
g_PcbPlotOptions
.
m_PlotFrameRef
&&
!
C
enter
)
if
(
g_PcbPlotOptions
.
m_PlotFrameRef
&&
!
c
enter
)
PlotWorkSheet
(
plotter
,
GetScreen
()
);
PlotWorkSheet
(
plotter
,
GetScreen
()
);
Plot_Layer
(
plotter
,
aLayer
,
aTraceMode
);
Plot_Layer
(
plotter
,
aLayer
,
aTraceMode
);
plotter
->
end_plot
();
plotter
->
end_plot
();
delete
plotter
;
delete
plotter
;
SetLocaleTo_Default
();
return
true
;
return
true
;
}
}
pcbnew/plotps.cpp
View file @
0d459865
...
@@ -24,15 +24,19 @@
...
@@ -24,15 +24,19 @@
bool
PCB_BASE_FRAME
::
ExportToPostScriptFile
(
const
wxString
&
aFullFileName
,
int
aLayer
,
bool
PCB_BASE_FRAME
::
ExportToPostScriptFile
(
const
wxString
&
aFullFileName
,
int
aLayer
,
bool
aUseA4
,
GRTraceMode
aTraceMode
)
bool
aUseA4
,
GRTraceMode
aTraceMode
)
{
{
wxSize
SheetSize
;
const
PAGE_INFO
&
pageInfo
=
GetPageSettings
();
wxSize
PaperSize
;
wxSize
BoardSize
;
wxSize
paperSizeIU
;
wxPoint
BoardCenter
;
wxSize
boardSize
;
bool
Center
=
false
;
wxPoint
boardCenter
;
Ki_PageDescr
*
currentsheet
=
GetScreen
()
->
m_CurrentSheetDesc
;
bool
center
=
false
;
double
scale
,
paperscale
;
double
scale
;
Ki_PageDescr
*
SheetPS
;
double
paperscale
;
wxPoint
offset
;
wxPoint
offset
;
LOCALE_IO
toggle
;
PAGE_INFO
pageA4
(
wxT
(
"A4"
)
);
const
PAGE_INFO
*
sheetPS
;
FILE
*
output_file
=
wxFopen
(
aFullFileName
,
wxT
(
"wt"
)
);
FILE
*
output_file
=
wxFopen
(
aFullFileName
,
wxT
(
"wt"
)
);
...
@@ -41,45 +45,43 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
...
@@ -41,45 +45,43 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
return
false
;
return
false
;
}
}
SetLocaleTo_C_standard
();
if
(
g_PcbPlotOptions
.
m_PlotScale
!=
1.0
||
g_PcbPlotOptions
.
m_AutoScale
)
if
(
g_PcbPlotOptions
.
m_PlotScale
!=
1.0
||
g_PcbPlotOptions
.
m_AutoScale
)
Center
=
true
;
// when scale != 1.0 we must calculate the position in page
{
// because actual position has no meaning
// when scale != 1.0 we must calculate the position in page
// because actual position has no meaning
center
=
true
;
}
// Set default line width
// Set default line width
if
(
g_PcbPlotOptions
.
m_PlotLineWidth
<
1
)
if
(
g_PcbPlotOptions
.
m_PlotLineWidth
<
1
)
g_PcbPlotOptions
.
m_PlotLineWidth
=
1
;
g_PcbPlotOptions
.
m_PlotLineWidth
=
1
;
SheetSize
.
x
=
currentsheet
->
m_Size
.
x
*
U_PCB
;
wxSize
pageSizeIU
=
GetPageSizeIU
();
SheetSize
.
y
=
currentsheet
->
m_Size
.
y
*
U_PCB
;
if
(
aUseA4
)
if
(
aUseA4
)
{
{
SheetPS
=
&
g_Sheet_A4
;
sheetPS
=
&
pageA4
;
PaperSize
.
x
=
g_Sheet_A4
.
m_Size
.
x
*
U_PCB
;
paperSizeIU
=
pageA4
.
GetSizeIU
();
PaperSize
.
y
=
g_Sheet_A4
.
m_Size
.
y
*
U_PCB
;
paperscale
=
(
double
)
paperSizeIU
.
x
/
pageSizeIU
.
x
;
paperscale
=
(
float
)
PaperSize
.
x
/
SheetSize
.
x
;
}
}
else
else
{
{
SheetPS
=
currentsheet
;
sheetPS
=
&
pageInfo
;
PaperSize
=
SheetSize
;
paperSizeIU
=
pageSizeIU
;
paperscale
=
1
;
paperscale
=
1
;
}
}
EDA_RECT
bbbox
=
GetBoardBoundingBox
();
EDA_RECT
bbbox
=
GetBoardBoundingBox
();
B
oardSize
=
bbbox
.
GetSize
();
b
oardSize
=
bbbox
.
GetSize
();
B
oardCenter
=
bbbox
.
Centre
();
b
oardCenter
=
bbbox
.
Centre
();
if
(
g_PcbPlotOptions
.
m_AutoScale
)
// Optimum scale
if
(
g_PcbPlotOptions
.
m_AutoScale
)
// Optimum scale
{
{
double
Xscale
,
Yscale
;
// Fit to 80% of the page
// Fit to 80% of the page
Xscale
=
(
PaperSize
.
x
*
0.8
)
/
BoardSize
.
x
;
double
Xscale
=
(
paperSizeIU
.
x
*
0.8
)
/
boardSize
.
x
;
Yscale
=
(
PaperSize
.
y
*
0.8
)
/
BoardSize
.
y
;
double
Yscale
=
(
paperSizeIU
.
y
*
0.8
)
/
boardSize
.
y
;
scale
=
MIN
(
Xscale
,
Yscale
);
scale
=
MIN
(
Xscale
,
Yscale
);
}
}
else
else
...
@@ -87,10 +89,10 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
...
@@ -87,10 +89,10 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
scale
=
g_PcbPlotOptions
.
m_PlotScale
*
paperscale
;
scale
=
g_PcbPlotOptions
.
m_PlotScale
*
paperscale
;
}
}
if
(
C
enter
)
if
(
c
enter
)
{
{
offset
.
x
=
wxRound
(
(
double
)
BoardCenter
.
x
-
(
(
double
)
PaperSize
.
x
/
2.0
)
/
scale
);
offset
.
x
=
wxRound
(
(
double
)
boardCenter
.
x
-
(
(
double
)
paperSizeIU
.
x
/
2.0
)
/
scale
);
offset
.
y
=
wxRound
(
(
double
)
BoardCenter
.
y
-
(
(
double
)
PaperSize
.
y
/
2.0
)
/
scale
);
offset
.
y
=
wxRound
(
(
double
)
boardCenter
.
y
-
(
(
double
)
paperSizeIU
.
y
/
2.0
)
/
scale
);
}
}
else
else
{
{
...
@@ -99,7 +101,9 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
...
@@ -99,7 +101,9 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
}
}
PS_PLOTTER
*
plotter
=
new
PS_PLOTTER
();
PS_PLOTTER
*
plotter
=
new
PS_PLOTTER
();
plotter
->
set_paper_size
(
SheetPS
);
plotter
->
SetPageSettings
(
*
sheetPS
);
plotter
->
set_scale_adjust
(
g_PcbPlotOptions
.
m_FineScaleAdjustX
,
plotter
->
set_scale_adjust
(
g_PcbPlotOptions
.
m_FineScaleAdjustX
,
g_PcbPlotOptions
.
m_FineScaleAdjustY
);
g_PcbPlotOptions
.
m_FineScaleAdjustY
);
plotter
->
set_viewport
(
offset
,
scale
,
g_PcbPlotOptions
.
m_PlotMirror
);
plotter
->
set_viewport
(
offset
,
scale
,
g_PcbPlotOptions
.
m_PlotMirror
);
...
@@ -109,7 +113,7 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
...
@@ -109,7 +113,7 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
plotter
->
start_plot
(
output_file
);
plotter
->
start_plot
(
output_file
);
/* The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway */
/* The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway */
if
(
g_PcbPlotOptions
.
m_PlotFrameRef
&&
!
C
enter
)
if
(
g_PcbPlotOptions
.
m_PlotFrameRef
&&
!
c
enter
)
PlotWorkSheet
(
plotter
,
GetScreen
()
);
PlotWorkSheet
(
plotter
,
GetScreen
()
);
// If plot a negative board:
// If plot a negative board:
...
@@ -131,7 +135,6 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
...
@@ -131,7 +135,6 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
Plot_Layer
(
plotter
,
aLayer
,
aTraceMode
);
Plot_Layer
(
plotter
,
aLayer
,
aTraceMode
);
plotter
->
end_plot
();
plotter
->
end_plot
();
delete
plotter
;
delete
plotter
;
SetLocaleTo_Default
();
return
true
;
return
true
;
}
}
pcbnew/print_board_functions.cpp
View file @
0d459865
...
@@ -31,11 +31,10 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
...
@@ -31,11 +31,10 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
bool
aPrintMirrorMode
,
bool
aPrintMirrorMode
,
void
*
aData
)
void
*
aData
)
{
{
MODULE
*
Module
;
int
drawmode
=
GR_COPY
;
int
drawmode
=
GR_COPY
;
int
defaultPenSize
=
50
;
DISPLAY_OPTIONS
save_opt
;
BOARD
*
Pcb
=
GetBoard
();
DISPLAY_OPTIONS
save_opt
;
int
defaultPenSize
=
50
;
PRINT_PARAMETERS
*
printParameters
=
(
PRINT_PARAMETERS
*
)
aData
;
// can be null
PRINT_PARAMETERS
*
printParameters
=
(
PRINT_PARAMETERS
*
)
aData
;
// can be null
PRINT_PARAMETERS
::
DrillShapeOptT
drillShapeOpt
=
PRINT_PARAMETERS
::
FULL_DRILL_SHAPE
;
PRINT_PARAMETERS
::
DrillShapeOptT
drillShapeOpt
=
PRINT_PARAMETERS
::
FULL_DRILL_SHAPE
;
...
@@ -74,21 +73,17 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
...
@@ -74,21 +73,17 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
// Draw footprints, this is done at last in order to print the pad holes in
// Draw footprints, this is done at last in order to print the pad holes in
// white (or g_DrawBgColor) after the tracks and zones
// white (or g_DrawBgColor) after the tracks and zones
Module
=
(
MODULE
*
)
Pcb
->
m_Modules
;
int
tmp
=
D_PAD
::
m_PadSketchModePenSize
;
int
tmp
=
D_PAD
::
m_PadSketchModePenSize
;
D_PAD
::
m_PadSketchModePenSize
=
defaultPenSize
;
D_PAD
::
m_PadSketchModePenSize
=
defaultPenSize
;
wxPoint
offset
;
offset
.
x
=
GetScreen
()
->
m_CurrentSheetDesc
->
m_Size
.
x
/
2
;
offset
.
y
=
GetScreen
()
->
m_CurrentSheetDesc
->
m_Size
.
y
/
2
;
// offset is in mils, converts in internal units
offset
.
x
*=
m_internalUnits
/
1000
;
offset
.
y
*=
m_internalUnits
/
1000
;
for
(
;
Module
!=
NULL
;
Module
=
Module
->
Next
()
)
wxSize
pageSizeIU
=
GetPageSizeIU
()
/
2
;
wxPoint
offset
(
pageSizeIU
.
x
,
pageSizeIU
.
y
);
for
(
MODULE
*
module
=
GetBoard
()
->
m_Modules
;
module
;
module
=
module
->
Next
()
)
{
{
M
odule
->
Move
(
offset
);
m
odule
->
Move
(
offset
);
Print_Module
(
DrawPanel
,
aDC
,
M
odule
,
drawmode
,
aPrintMaskLayer
,
drillShapeOpt
);
Print_Module
(
DrawPanel
,
aDC
,
m
odule
,
drawmode
,
aPrintMaskLayer
,
drillShapeOpt
);
M
odule
->
Move
(
-
offset
);
m
odule
->
Move
(
-
offset
);
}
}
D_PAD
::
m_PadSketchModePenSize
=
tmp
;
D_PAD
::
m_PadSketchModePenSize
=
tmp
;
...
@@ -100,7 +95,7 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
...
@@ -100,7 +95,7 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
m_DisplayPadFill
=
DisplayOpt
.
DisplayPadFill
;
m_DisplayPadFill
=
DisplayOpt
.
DisplayPadFill
;
m_DisplayViaFill
=
DisplayOpt
.
DisplayViaFill
;
m_DisplayViaFill
=
DisplayOpt
.
DisplayViaFill
;
m_DisplayPadNum
=
DisplayOpt
.
DisplayPadNum
;
m_DisplayPadNum
=
DisplayOpt
.
DisplayPadNum
;
GetBoard
()
->
SetElementVisibility
(
NO_CONNECTS_VISIBLE
,
nctmp
);
GetBoard
()
->
SetElementVisibility
(
NO_CONNECTS_VISIBLE
,
nctmp
);
}
}
...
...
pcbnew/printout_controler.cpp
View file @
0d459865
...
@@ -142,9 +142,8 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
...
@@ -142,9 +142,8 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
{
{
int
tmpzoom
;
int
tmpzoom
;
wxPoint
tmp_startvisu
;
wxPoint
tmp_startvisu
;
wxSize
SheetSize
;
// Page size in internal units
wxPoint
old_org
;
wxPoint
old_org
;
wxPoint
DrawOffset
;
// Offset de trace
wxPoint
DrawOffset
;
// Offset de trace
double
userscale
;
double
userscale
;
double
DrawZoom
=
1
;
double
DrawZoom
=
1
;
wxDC
*
dc
=
GetDC
();
wxDC
*
dc
=
GetDC
();
...
@@ -153,65 +152,68 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
...
@@ -153,65 +152,68 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
wxBusyCursor
dummy
;
wxBusyCursor
dummy
;
/
* Save old draw scale and draw offset */
/
/ Save old draw scale and draw offset
tmp_startvisu
=
screen
->
m_StartVisu
;
tmp_startvisu
=
screen
->
m_StartVisu
;
tmpzoom
=
screen
->
GetZoom
();
tmpzoom
=
screen
->
GetZoom
();
old_org
=
screen
->
m_DrawOrg
;
old_org
=
screen
->
m_DrawOrg
;
/* Change draw scale and offset to draw the whole page */
// Change draw scale and offset to draw the whole page
screen
->
SetScalingFactor
(
DrawZoom
);
screen
->
SetScalingFactor
(
DrawZoom
);
screen
->
m_DrawOrg
.
x
=
screen
->
m_DrawOrg
.
y
=
0
;
screen
->
m_DrawOrg
.
x
=
screen
->
m_DrawOrg
.
y
=
0
;
screen
->
m_StartVisu
.
x
=
screen
->
m_StartVisu
.
y
=
0
;
screen
->
m_StartVisu
.
x
=
screen
->
m_StartVisu
.
y
=
0
;
SheetSize
=
screen
->
m_CurrentSheetDesc
->
m_Size
;
// size in 1/1000 inch
SheetSize
.
x
*=
m_Parent
->
GetInternalUnits
()
/
1000
;
SheetSize
.
y
*=
m_Parent
->
GetInternalUnits
()
/
1000
;
// size in internal units
PCB_BASE_FRAME
*
pcbframe
=
(
PCB_BASE_FRAME
*
)
m_Parent
;
PCB_BASE_FRAME
*
pcbframe
=
(
PCB_BASE_FRAME
*
)
m_Parent
;
EDA_RECT
brd_BBox
=
pcbframe
->
GetBoard
()
->
ComputeBoundingBox
();
wxSize
pageSizeIU
=
pcbframe
->
GetPageSizeIU
();
// internal units
EDA_RECT
bbbox
=
pcbframe
->
GetBoard
()
->
ComputeBoundingBox
();
// In module editor, the module is located at 0,0 but for printing
// In module editor, the module is located at 0,0 but for printing
// it is moved to
SheetSize.x/2, SheetSize
.y/2.
// it is moved to
pageSizeIU.x/2, pageSizeIU
.y/2.
// So the equivalent board must be moved:
// So the equivalent board must be moved:
if
(
m_Parent
->
IsType
(
MODULE_EDITOR_FRAME
)
)
if
(
m_Parent
->
IsType
(
MODULE_EDITOR_FRAME
)
)
{
{
wxPoint
mv_offset
;
bbbox
.
Move
(
wxPoint
(
pageSizeIU
.
x
/
2
,
pageSizeIU
.
y
/
2
)
);
mv_offset
.
x
=
SheetSize
.
x
/
2
;
mv_offset
.
y
=
SheetSize
.
y
/
2
;
brd_BBox
.
Move
(
mv_offset
);
}
}
/
* Compute the PCB size in internal units*/
/
/ Compute the PCB size in internal units
userscale
=
m_PrintParams
.
m_PrintScale
;
userscale
=
m_PrintParams
.
m_PrintScale
;
if
(
userscale
==
0
)
// fit in page
if
(
userscale
==
0
)
// fit in page
{
{
int
extra_margin
=
4000
*
2
;
// Margin = 4000 units pcb = 0.4 inch
// Margin = 0.4 inch
SheetSize
.
x
=
brd_BBox
.
GetWidth
()
+
extra_margin
;
#if defined(KICAD_NANOMETRE)
SheetSize
.
y
=
brd_BBox
.
GetHeight
()
+
extra_margin
;
int
extra_margin
=
int
(
0.4
*
25400
);
// nanometers
#else
int
extra_margin
=
int
(
0.4
*
1000
);
// deci-mils
#endif
pageSizeIU
.
x
=
bbbox
.
GetWidth
()
+
extra_margin
*
2
;
pageSizeIU
.
y
=
bbbox
.
GetHeight
()
+
extra_margin
*
2
;
userscale
=
0.99
;
userscale
=
0.99
;
}
}
if
(
(
m_PrintParams
.
m_PrintScale
>
1.0
)
// scale > 1 -> Recadrage
if
(
(
m_PrintParams
.
m_PrintScale
>
1.0
)
// scale > 1 -> Recadrage
||
(
m_PrintParams
.
m_PrintScale
==
0
)
)
// fit in page
||
(
m_PrintParams
.
m_PrintScale
==
0
)
)
// fit in page
{
{
DrawOffset
+=
b
rd_BB
ox
.
Centre
();
DrawOffset
+=
b
bb
ox
.
Centre
();
}
}
if
(
m_PrintParams
.
m_PageSetupData
)
if
(
m_PrintParams
.
m_PageSetupData
)
{
{
wxSize
pagesize
;
wxSize
pagesize
;
pagesize
.
x
=
(
int
)
(
SheetSize
.
x
/
userscale
);
pagesize
.
y
=
(
int
)
(
SheetSize
.
y
/
userscale
);
pagesize
.
x
=
int
(
pageSizeIU
.
x
/
userscale
);
FitThisSizeToPageMargins
(
pagesize
,
*
m_PrintParams
.
m_PageSetupData
);
pagesize
.
y
=
int
(
pageSizeIU
.
y
/
userscale
);
FitThisSizeToPageMargins
(
pagesize
,
*
m_PrintParams
.
m_PageSetupData
);
}
}
// Compute Accurate scale 1
// Compute Accurate scale 1
if
(
userscale
==
1.0
)
if
(
userscale
==
1.0
)
{
{
// We want a 1:1 scale and margins for printing
// We want a 1:1 scale and margins for printing
MapScreenSizeToPaper
(
);
MapScreenSizeToPaper
();
int
w
,
h
;
int
w
,
h
;
GetPPIPrinter
(
&
w
,
&
h
);
GetPPIPrinter
(
&
w
,
&
h
);
double
accurate_Xscale
=
(
(
double
)
(
DrawZoom
*
w
)
)
/
(
double
)
PCB_INTERNAL_UNIT
;
double
accurate_Xscale
=
(
(
double
)
(
DrawZoom
*
w
)
)
/
(
double
)
PCB_INTERNAL_UNIT
;
...
@@ -263,7 +265,6 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
...
@@ -263,7 +265,6 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
if
(
m_PrintParams
.
m_Print_Black_and_White
)
if
(
m_PrintParams
.
m_Print_Black_and_White
)
GRForceBlackPen
(
true
);
GRForceBlackPen
(
true
);
EDA_DRAW_PANEL
*
panel
=
m_Parent
->
DrawPanel
;
EDA_DRAW_PANEL
*
panel
=
m_Parent
->
DrawPanel
;
EDA_RECT
tmp
=
panel
->
m_ClipBox
;
EDA_RECT
tmp
=
panel
->
m_ClipBox
;
...
@@ -303,7 +304,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
...
@@ -303,7 +304,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
* for scales > 1, the DrawOffset was already computed to have the board centre
* for scales > 1, the DrawOffset was already computed to have the board centre
* to the middle of the page.
* to the middle of the page.
*/
*/
wxPoint
pcb_centre
=
b
rd_BB
ox
.
Centre
();
wxPoint
pcb_centre
=
b
bb
ox
.
Centre
();
if
(
userscale
<=
1.0
)
if
(
userscale
<=
1.0
)
DrawOffset
.
y
+=
pcb_centre
.
y
-
(
ysize
/
2
);
DrawOffset
.
y
+=
pcb_centre
.
y
-
(
ysize
/
2
);
...
...
pcbnew/printout_controler.h
View file @
0d459865
...
@@ -52,8 +52,8 @@ public:
...
@@ -52,8 +52,8 @@ public:
class
BOARD_PRINTOUT_CONTROLER
:
public
wxPrintout
class
BOARD_PRINTOUT_CONTROLER
:
public
wxPrintout
{
{
private
:
private
:
EDA_DRAW_FRAME
*
m_Parent
;
EDA_DRAW_FRAME
*
m_Parent
;
PRINT_PARAMETERS
m_PrintParams
;
PRINT_PARAMETERS
m_PrintParams
;
public
:
public
:
BOARD_PRINTOUT_CONTROLER
(
const
PRINT_PARAMETERS
&
print_params
,
BOARD_PRINTOUT_CONTROLER
(
const
PRINT_PARAMETERS
&
print_params
,
...
...
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