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 @@
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_FirstRedraw
=
true
;
m_ScreenNumber
=
1
;
...
...
@@ -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_Id
=
ID_POPUP_GRID_LEVEL_50
;
m_Center
=
true
;
m_CurrentSheetDesc
=
&
g_Sheet_A4
;
m_IsPrinting
=
false
;
m_ScrollPixelsPerUnitX
=
1
;
m_ScrollPixelsPerUnitY
=
1
;
InitDatas
();
}
...
...
@@ -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
)
{
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
{
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
;
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.
}
...
...
@@ -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
scale
=
1.0
/
GetZoom
();
...
...
@@ -513,22 +513,3 @@ void BASE_SCREEN::InsertItem( EDA_ITEMS::iterator aIter, EDA_ITEM* 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 )
output_file
=
0
;
color_mode
=
false
;
/* Start as a BW plot */
negative_mode
=
false
;
sheet
=
NULL
;
}
...
...
@@ -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
);
sheet
=
asheet
;
pageInfo
=
aPageSettings
;
// Sheets are in mils, plotter works with decimals
paper_size
.
x
=
sheet
->
m_Size
.
x
*
10
;
paper_size
.
y
=
sheet
->
m_Size
.
y
*
10
;
// PAGE_INFO is in mils, plotter works with decimals
paper_size
=
pageInfo
.
GetSizeMils
()
*
10
;
}
common/common.cpp
View file @
0d459865
...
...
@@ -46,31 +46,6 @@
* 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
SchematicFileExtension
(
wxT
(
"sch"
)
);
...
...
@@ -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
m_Size
=
size
;
m_Offset
=
offset
;
m_Name
=
name
;
// aSizeMils is in 1/1000th of an inch
SetWidthInches
(
aSizeMils
.
x
/
1000.0
);
SetHeightInches
(
aSizeMils
.
y
/
1000.0
);
m_Offset
=
aOffsetMils
;
m_Type
=
aType
;
// Adjust the default value for margins to 400 mils (0,4 inch or 10 mm)
#if defined(KICAD_GOST)
...
...
@@ -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
tmp
;
...
...
common/common_plotPS_functions.cpp
View file @
0d459865
...
...
@@ -366,7 +366,7 @@ bool PS_PLOTTER::start_plot( FILE* fout )
fprintf
(
output_file
,
"%%%%Pages: 1
\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
;
// The coordinates of the lower left corner of the boundary
...
...
@@ -388,18 +388,20 @@ bool PS_PLOTTER::start_plot( FILE* fout )
//
// (NOTE: m_Size.y is *supposed* to be listed before m_Size.x;
// 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
// sheet->m_Size * 10 in decimals
if
(
sheet
->
m_Name
.
Cmp
(
wxT
(
"User"
)
)
==
0
)
// Also note pageSize is given in mils, not in internal units and must be
// converted to internal units.
wxSize
pageSize
=
pageInfo
.
GetSizeMils
();
if
(
pageInfo
.
GetType
().
Cmp
(
wxT
(
"User"
)
)
==
0
)
fprintf
(
output_file
,
"%%%%DocumentMedia: Custom %d %d 0 () ()
\n
"
,
wxRound
(
sheet
->
m_
Size
.
y
*
10
*
CONV_SCALE
),
wxRound
(
sheet
->
m_
Size
.
x
*
10
*
CONV_SCALE
)
);
wxRound
(
page
Size
.
y
*
10
*
CONV_SCALE
),
wxRound
(
page
Size
.
x
*
10
*
CONV_SCALE
)
);
else
// ( if sheet->m_Name does not equal "User" )
fprintf
(
output_file
,
"%%%%DocumentMedia: %s %d %d 0 () ()
\n
"
,
TO_UTF8
(
sheet
->
m_Name
),
wxRound
(
sheet
->
m_
Size
.
y
*
10
*
CONV_SCALE
),
wxRound
(
sheet
->
m_
Size
.
x
*
10
*
CONV_SCALE
)
);
TO_UTF8
(
pageInfo
.
GetType
()
),
wxRound
(
page
Size
.
y
*
10
*
CONV_SCALE
),
wxRound
(
page
Size
.
x
*
10
*
CONV_SCALE
)
);
fprintf
(
output_file
,
"%%%%Orientation: Landscape
\n
"
);
...
...
common/common_plot_functions.cpp
View file @
0d459865
...
...
@@ -22,15 +22,17 @@
void
EDA_DRAW_FRAME
::
PlotWorkSheet
(
PLOTTER
*
plotter
,
BASE_SCREEN
*
screen
)
{
#define WSTEXTSIZE 50 // Text size in mils
Ki_PageDescr
*
Sheet
=
screen
->
m_CurrentSheetDesc
;
int
xg
,
yg
;
wxSize
PageSize
;
wxPoint
pos
,
ref
;
EDA_Colors
color
;
const
PAGE_INFO
&
pageInfo
=
GetPageSettings
();
wxSize
pageSize
=
pageInfo
.
GetSizeMils
();
// mils
int
xg
,
yg
;
wxPoint
pos
,
ref
;
EDA_Colors
color
;
/* Scale to convert dimension in 1/1000 in into internal units
* (1/1000 inc for Eeschema, 1/10000 for Pcbnew. */
int
conv_unit
=
screen
->
GetInternalUnits
()
/
1000
;
wxString
msg
;
wxSize
text_size
;
#if defined(KICAD_GOST)
...
...
@@ -47,14 +49,11 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
color
=
BLACK
;
plotter
->
set_color
(
color
);
PageSize
.
x
=
Sheet
->
m_Size
.
x
;
PageSize
.
y
=
Sheet
->
m_Size
.
y
;
/* Plot edge. */
ref
.
x
=
Sheet
->
m_LeftMargin
*
conv_unit
;
ref
.
y
=
Sheet
->
m_TopMargin
*
conv_unit
;
xg
=
(
PageSize
.
x
-
Sheet
->
m_RightMargin
)
*
conv_unit
;
yg
=
(
PageSize
.
y
-
Sheet
->
m_BottomMargin
)
*
conv_unit
;
ref
.
x
=
pageInfo
.
GetLeftMarginMils
()
*
conv_unit
;
ref
.
y
=
pageInfo
.
GetTopMarginMils
()
*
conv_unit
;
xg
=
(
pageSize
.
x
-
pageInfo
.
GetRightMarginMils
()
)
*
conv_unit
;
yg
=
(
pageSize
.
y
-
pageInfo
.
GetBottomMarginMils
()
)
*
conv_unit
;
#if defined(KICAD_GOST)
plotter
->
move_to
(
ref
);
...
...
@@ -93,12 +92,13 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
text_size
.
x
=
WSTEXTSIZE
*
conv_unit
;
text_size
.
y
=
WSTEXTSIZE
*
conv_unit
;
ref
.
x
=
Sheet
->
m_LeftMargin
;
ref
.
y
=
Sheet
->
m_TopMargin
;
/* Upper left corner in
* 1/1000 inch */
xg
=
(
PageSize
.
x
-
Sheet
->
m_RightMargin
);
yg
=
(
PageSize
.
y
-
Sheet
->
m_BottomMargin
);
/* lower right corner
* in 1/1000 inch */
// upper left corner in mils
ref
.
x
=
pageInfo
.
GetLeftMarginMils
();
ref
.
y
=
pageInfo
.
GetTopMarginMils
();
// lower right corner in mils
xg
=
(
pageSize
.
x
-
pageInfo
.
GetRightMarginMils
()
);
yg
=
(
pageSize
.
y
-
pageInfo
.
GetBottomMarginMils
()
);
#if defined(KICAD_GOST)
for
(
Ki_WorkSheetData
*
WsItem
=
&
WS_Segm1_LU
;
...
...
@@ -240,6 +240,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
/* Plot the worksheet. */
text_size
.
x
=
SIZETEXT
*
conv_unit
;
text_size
.
y
=
SIZETEXT
*
conv_unit
;
#if defined(KICAD_GOST)
text_size2
.
x
=
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 )
text_size3
.
y
=
SIZETEXT
*
conv_unit
*
3
;
text_size1_5
.
x
=
SIZETEXT
*
conv_unit
*
1.5
;
text_size1_5
.
y
=
SIZETEXT
*
conv_unit
*
1.5
;
ref
.
x
=
PageSize
.
x
-
Sheet
->
m_RightMargin
;
ref
.
y
=
PageSize
.
y
-
Sheet
->
m_BottomMargin
;
ref
.
x
=
pageSize
.
x
-
pageInfo
.
GetRightMarginMils
()
;
ref
.
y
=
pageSize
.
y
-
pageInfo
.
GetBottomMarginMils
()
;
if
(
screen
->
m_ScreenNumber
==
1
)
{
...
...
@@ -287,7 +288,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
if
(
WsItem
->
m_Legende
)
msg
=
WsItem
->
m_Legende
;
if
(
screen
->
m_NumberOfScreen
>
1
)
msg
<<
screen
->
m_ScreenNumber
;
msg
<<
screen
->
m_ScreenNumber
;
plotter
->
text
(
pos
,
color
,
msg
,
TEXT_ORIENT_HORIZ
,
text_size
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_CENTER
,
...
...
@@ -297,7 +298,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
case
WS_SHEETS
:
if
(
WsItem
->
m_Legende
)
msg
=
WsItem
->
m_Legende
;
msg
<<
screen
->
m_NumberOfScreen
;
msg
<<
screen
->
m_NumberOfScreen
;
plotter
->
text
(
pos
,
color
,
msg
,
TEXT_ORIENT_HORIZ
,
text_size
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_CENTER
,
...
...
@@ -334,8 +335,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
msg
,
TEXT_ORIENT_HORIZ
,
text_size3
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
thickness
,
italic
,
false
);
pos
.
x
=
(
Sheet
->
m_LeftMargin
+
1260
)
*
conv_unit
;
pos
.
y
=
(
Sheet
->
m_TopMargin
+
270
)
*
conv_unit
;
pos
.
x
=
(
pageInfo
.
GetLeftMarginMils
()
+
1260
)
*
conv_unit
;
pos
.
y
=
(
pageInfo
.
GetTopMarginMils
()
+
270
)
*
conv_unit
;
plotter
->
text
(
pos
,
color
,
msg
.
GetData
(),
1800
,
text_size2
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
...
...
@@ -408,8 +409,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
msg
,
TEXT_ORIENT_HORIZ
,
text_size3
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
thickness
,
italic
,
false
);
pos
.
x
=
(
Sheet
->
m_LeftMargin
+
1260
)
*
conv_unit
;
pos
.
y
=
(
Sheet
->
m_TopMargin
+
270
)
*
conv_unit
;
pos
.
x
=
(
pageInfo
.
GetLeftMarginMils
()
+
1260
)
*
conv_unit
;
pos
.
y
=
(
pageInfo
.
GetTopMarginMils
()
+
270
)
*
conv_unit
;
plotter
->
text
(
pos
,
color
,
msg
,
1800
,
text_size2
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
...
...
@@ -444,9 +445,11 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
}
}
}
#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
;
WsItem
!=
NULL
;
...
...
@@ -477,7 +480,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
break
;
case
WS_SIZESHEET
:
msg
+=
screen
->
m_CurrentSheetDesc
->
m_Name
;
msg
+=
pageInfo
.
GetType
()
;
break
;
case
WS_IDENTSHEET
:
...
...
common/dialogs/dialog_page_settings.cpp
View file @
0d459865
...
...
@@ -23,14 +23,6 @@
#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
)
{
...
...
@@ -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_BASE
(
parent
)
DIALOG_PAGES_SETTINGS_BASE
(
parent
),
m_user_size
(
wxT
(
"User"
)
)
{
m_Parent
=
parent
;
m_Screen
=
m_Parent
->
GetScreen
();
m_Modified
=
0
;
m_SelectedSheet
=
NULL
;
m_CurrentSelection
=
0
;
m_modified
=
false
;
initDialog
();
...
...
@@ -65,10 +56,11 @@ DIALOG_PAGES_SETTINGS::~DIALOG_PAGES_SETTINGS()
void
DIALOG_PAGES_SETTINGS
::
initDialog
()
{
wxString
msg
;
wxString
msg
;
double
userSizeX
;
double
userSizeY
;
SetFocus
();
SearchPageSizeSelection
();
// Init display value for sheet User size
wxString
format
=
m_TextSheetCount
->
GetLabel
();
...
...
@@ -78,38 +70,49 @@ void DIALOG_PAGES_SETTINGS::initDialog()
msg
.
Printf
(
format
,
m_Screen
->
m_ScreenNumber
);
m_TextSheetNumber
->
SetLabel
(
msg
);
m_page
=
m_Parent
->
GetPageSettings
();
setCurrentPageSizeSelection
();
switch
(
g_UserUnit
)
{
case
MILLIMETRES
:
UserSizeX
=
(
double
)
g_Sheet_user
.
m_Size
.
x
*
25.4
/
1000
;
UserSizeY
=
(
double
)
g_Sheet_user
.
m_Size
.
y
*
25.4
/
1000
;
msg
.
Printf
(
wxT
(
"%.2f"
),
UserSizeX
);
userSizeX
=
m_user_size
.
GetWidthInches
()
*
25.4
;
userSizeY
=
m_user_size
.
GetHeightInches
()
*
25.4
;
msg
.
Printf
(
wxT
(
"%.2f"
),
userSizeX
);
m_TextUserSizeX
->
SetValue
(
msg
);
msg
.
Printf
(
wxT
(
"%.2f"
),
UserSizeY
);
msg
.
Printf
(
wxT
(
"%.2f"
),
userSizeY
);
m_TextUserSizeY
->
SetValue
(
msg
);
break
;
default
:
case
INCHES
:
UserSizeX
=
(
double
)
g_Sheet_user
.
m_Size
.
x
/
1000
;
UserSizeY
=
(
double
)
g_Sheet_user
.
m_Size
.
y
/
1000
;
msg
.
Printf
(
wxT
(
"%.3f"
),
UserSizeX
);
userSizeX
=
m_user_size
.
GetWidthInches
();
userSizeY
=
m_user_size
.
GetHeightInches
();
msg
.
Printf
(
wxT
(
"%.3f"
),
userSizeX
);
m_TextUserSizeX
->
SetValue
(
msg
);
msg
.
Printf
(
wxT
(
"%.3f"
),
UserSizeY
);
msg
.
Printf
(
wxT
(
"%.3f"
),
userSizeY
);
m_TextUserSizeY
->
SetValue
(
msg
);
break
;
/* // you want it in 1/1000ths of an inch, why?
case UNSCALED_UNITS:
UserSizeX
=
g_Sheet_user
.
m_Size
.
x
;
UserSizeY
=
g_Sheet_user
.
m_Size
.
y
;
msg
.
Printf
(
wxT
(
"%f"
),
U
serSizeX
);
userSizeX = m_user_size.GetWidthInches() * 1000
;
userSizeY = m_user_size.GetHeightInches() * 1000
;
msg.Printf( wxT( "%f" ),
m_u
serSizeX );
m_TextUserSizeX->SetValue( msg );
msg
.
Printf
(
wxT
(
"%f"
),
U
serSizeY
);
msg.Printf( wxT( "%f" ),
m_u
serSizeY );
m_TextUserSizeY->SetValue( msg );
break;
*/
}
// 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_TextTitle
->
SetValidator
(
wxTextValidator
(
wxFILTER_NONE
,
&
m_Screen
->
m_Title
)
);
m_TextCompany
->
SetValidator
(
wxTextValidator
(
wxFILTER_NONE
,
&
m_Screen
->
m_Company
)
);
...
...
@@ -139,7 +142,7 @@ void DIALOG_PAGES_SETTINGS::initDialog()
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 )
void
DIALOG_PAGES_SETTINGS
::
OnOkClick
(
wxCommandEvent
&
event
)
{
SavePageSettings
(
event
);
m_
Modified
=
1
;
m_
modified
=
true
;
Close
(
true
);
}
...
...
@@ -167,8 +170,9 @@ void DIALOG_PAGES_SETTINGS::OnCancelClick( wxCommandEvent& event )
void
DIALOG_PAGES_SETTINGS
::
SavePageSettings
(
wxCommandEvent
&
event
)
{
double
dtmp
;
wxString
msg
;
double
userSizeX
;
double
userSizeY
;
m_Screen
->
m_Revision
=
m_TextRevision
->
GetValue
();
m_Screen
->
m_Company
=
m_TextCompany
->
GetValue
();
...
...
@@ -179,50 +183,42 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
m_Screen
->
m_Commentaire4
=
m_TextComment4
->
GetValue
();
msg
=
m_TextUserSizeX
->
GetValue
();
msg
.
ToDouble
(
&
dtmp
);
UserSizeX
=
dtmp
;
msg
.
ToDouble
(
&
userSizeX
);
msg
=
m_TextUserSizeY
->
GetValue
();
msg
.
ToDouble
(
&
dtmp
);
UserSizeY
=
dtmp
;
msg
.
ToDouble
(
&
userSizeY
);
int
ii
=
m_PageSizeBox
->
GetSelection
();
int
radioSelection
=
m_PageSizeBox
->
GetSelection
();
if
(
radioSelection
<
0
)
radioSelection
=
0
;
if
(
ii
<
0
)
ii
=
0
;
wxString
paperType
=
m_PageSizeBox
->
GetString
(
radioSelection
);
m_SelectedSheet
=
SheetList
[
ii
];
m_Screen
->
m_CurrentSheetDesc
=
m_SelectedSheet
;
m_page
.
SetType
(
paperType
);
m_Parent
->
SetPageSettings
(
m_page
);
switch
(
g_UserUnit
)
{
case
MILLIMETRES
:
g_Sheet_user
.
m_Size
.
x
=
(
int
)
(
UserSizeX
*
1000
/
25.4
);
g_Sheet_user
.
m_Size
.
y
=
(
int
)
(
UserSizeY
*
1000
/
25.4
);
PAGE_INFO
::
SetUserWidthInches
(
userSizeX
/
25.4
);
PAGE_INFO
::
SetUserHeightInches
(
userSizeY
/
25.4
);
break
;
default
:
case
INCHES
:
g_Sheet_user
.
m_Size
.
x
=
(
int
)
(
UserSizeX
*
1000
);
g_Sheet_user
.
m_Size
.
y
=
(
int
)
(
UserSizeY
*
1000
);
PAGE_INFO
::
SetUserWidthInches
(
userSizeX
);
PAGE_INFO
::
SetUserHeightInches
(
userSizeY
);
break
;
/* // set in 1/1000ths of an inch, but why?
case UNSCALED_UNITS:
g_Sheet_user
.
m_Size
.
x
=
(
int
)
(
UserSizeX
);
g_Sheet_user
.
m_Size
.
y
=
(
int
)
(
UserSizeY
);
PAGE_INFO::SetUserWidthInches( userSizeX /1000
);
PAGE_INFO::SetUserHeightInches( userSizeY /1000
);
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
/* Exports settings to other sheets if requested: */
SCH_SCREEN
*
screen
;
...
...
@@ -265,21 +261,19 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
}
/* Search the correct index to activate the radiobox list size selection
* according to the current page size
*/
void
DIALOG_PAGES_SETTINGS
::
SearchPageSizeSelection
()
void
DIALOG_PAGES_SETTINGS
::
setCurrentPageSizeSelection
()
{
Ki_PageDescr
*
sheet
;
int
ii
;
m_CurrentSelection
=
NB_ITEMS
-
1
;
wxString
curPaperType
=
m_page
.
GetType
();
for
(
ii
=
0
;
ii
<
NB_ITEMS
;
ii
++
)
for
(
unsigned
i
=
0
;
i
<
m_PageSizeBox
->
GetCount
();
++
i
)
{
sheet
=
SheetList
[
ii
];
if
(
m_Parent
->
GetScreen
()
->
m_CurrentSheetDesc
==
sheet
)
m_CurrentSelection
=
ii
;
if
(
m_PageSizeBox
->
GetString
(
i
)
==
curPaperType
)
{
m_PageSizeBox
->
SetSelection
(
i
);
return
;
}
}
// m_PageSizeBox->SetSelection( 1 ); // wxFormBuilder does this, control there
}
common/dialogs/dialog_page_settings.h
View file @
0d459865
...
...
@@ -14,12 +14,11 @@
class
DIALOG_PAGES_SETTINGS
:
public
DIALOG_PAGES_SETTINGS_BASE
{
private
:
EDA_DRAW_FRAME
*
m_Parent
;
BASE_SCREEN
*
m_Screen
;
int
m_Modified
;
Ki_PageDescr
*
m_SelectedSheet
;
float
UserSizeX
,
UserSizeY
;
int
m_CurrentSelection
;
EDA_DRAW_FRAME
*
m_Parent
;
BASE_SCREEN
*
m_Screen
;
bool
m_modified
;
PAGE_INFO
m_page
;
///< the one being edited
PAGE_INFO
m_user_size
;
///< instantiated just to get the size
public
:
DIALOG_PAGES_SETTINGS
(
EDA_DRAW_FRAME
*
parent
);
...
...
@@ -37,7 +36,8 @@ private:
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
void
OnCancelClick
(
wxCommandEvent
&
event
);
void
SearchPageSizeSelection
();
void
setCurrentPageSizeSelection
();
void
SavePageSettings
(
wxCommandEvent
&
event
);
void
ReturnSizeSelected
(
wxCommandEvent
&
event
);
...
...
common/drawframe.cpp
View file @
0d459865
...
...
@@ -524,12 +524,11 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition )
logicalClientSize
.
x
=
wxRound
(
(
double
)
clientSize
.
x
/
scalar
);
logicalClientSize
.
y
=
wxRound
(
(
double
)
clientSize
.
y
/
scalar
);
// The upper left corner of the drawing in device units.
int
w
=
screen
->
ReturnPageSize
().
x
;
int
h
=
screen
->
ReturnPageSize
().
y
;
// A corner of the drawing in internal units.
wxSize
corner
=
GetPageSizeIU
();
// 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 )."
),
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 )
void
EDA_DRAW_PANEL
::
DrawBackGround
(
wxDC
*
DC
)
{
int
axis_color
=
BLUE
;
BASE_SCREEN
*
screen
=
GetScreen
();
GRSetDrawMode
(
DC
,
GR_COPY
);
if
(
GetParent
()
->
IsGridVisible
()
)
DrawGrid
(
DC
);
/
* Draw axis */
/
/ Draw axis
if
(
GetParent
()
->
m_showAxis
)
{
/* Draw the Y axis */
GRDashedLine
(
&
m_ClipBox
,
DC
,
0
,
-
screen
->
ReturnPageSize
().
y
,
0
,
screen
->
ReturnPageSize
().
y
,
0
,
axis_color
);
wxSize
pageSize
=
GetParent
()
->
GetPageSizeIU
();
/* Draw the X axis */
GRDashedLine
(
&
m_ClipBox
,
DC
,
-
screen
->
ReturnPageSize
().
x
,
0
,
screen
->
ReturnPageSize
().
x
,
0
,
0
,
axis_color
);
// Draw the Y axis
GRDashedLine
(
&
m_ClipBox
,
DC
,
0
,
-
pageSize
.
y
,
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
)
...
...
@@ -679,26 +680,26 @@ void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, int aDrawMode )
if
(
GetParent
()
->
m_originAxisPosition
==
wxPoint
(
0
,
0
)
)
return
;
int
Color
=
DARKRED
;
BASE_SCREEN
*
screen
=
GetScreen
();
int
color
=
DARKRED
;
wxSize
pageSize
=
GetParent
()
->
GetPageSizeIU
();
GRSetDrawMode
(
aDC
,
aDrawMode
);
/
* Draw the Y axis */
/
/ Draw the Y axis
GRDashedLine
(
&
m_ClipBox
,
aDC
,
GetParent
()
->
m_originAxisPosition
.
x
,
-
screen
->
ReturnPageSize
()
.
y
,
-
pageSize
.
y
,
GetParent
()
->
m_originAxisPosition
.
x
,
screen
->
ReturnPageSize
()
.
y
,
0
,
C
olor
);
pageSize
.
y
,
0
,
c
olor
);
/
* Draw the X axis */
/
/ Draw the X axis
GRDashedLine
(
&
m_ClipBox
,
aDC
,
-
screen
->
ReturnPageSize
()
.
x
,
-
pageSize
.
x
,
GetParent
()
->
m_originAxisPosition
.
y
,
screen
->
ReturnPageSize
()
.
x
,
pageSize
.
x
,
GetParent
()
->
m_originAxisPosition
.
y
,
0
,
C
olor
);
0
,
c
olor
);
}
...
...
@@ -710,25 +711,26 @@ void EDA_DRAW_PANEL::DrawGridAxis( wxDC* aDC, int aDrawMode )
||
(
screen
->
m_GridOrigin
.
x
==
0
&&
screen
->
m_GridOrigin
.
y
==
0
)
)
return
;
int
Color
=
GetParent
()
->
GetGridColor
();
int
color
=
GetParent
()
->
GetGridColor
();
wxSize
pageSize
=
GetParent
()
->
GetPageSizeIU
();
GRSetDrawMode
(
aDC
,
aDrawMode
);
/
* Draw the Y axis */
/
/ Draw the Y axis
GRDashedLine
(
&
m_ClipBox
,
aDC
,
screen
->
m_GridOrigin
.
x
,
-
screen
->
ReturnPageSize
()
.
y
,
-
pageSize
.
y
,
screen
->
m_GridOrigin
.
x
,
screen
->
ReturnPageSize
()
.
y
,
0
,
C
olor
);
pageSize
.
y
,
0
,
c
olor
);
/
* Draw the X axis */
/
/ Draw the X axis
GRDashedLine
(
&
m_ClipBox
,
aDC
,
-
screen
->
ReturnPageSize
()
.
x
,
-
pageSize
.
x
,
screen
->
m_GridOrigin
.
y
,
screen
->
ReturnPageSize
()
.
x
,
pageSize
.
x
,
screen
->
m_GridOrigin
.
y
,
0
,
C
olor
);
0
,
c
olor
);
}
...
...
common/worksheet.cpp
View file @
0d459865
...
...
@@ -16,7 +16,7 @@
#include "build_version.h"
/
* Must be defined in main applications: */
/
/ Must be defined in main applications:
Ki_WorkSheetData
WS_Date
=
{
...
...
@@ -186,7 +186,9 @@ Ki_WorkSheetData WS_Comment4 =
NULL
,
NULL
};
Ki_WorkSheetData
WS_MostLeftLine
=
/* Left vertical segment */
/// Left vertical segment
Ki_WorkSheetData
WS_MostLeftLine
=
{
WS_LEFT_SEGMENT
,
#if defined(KICAD_GOST)
...
...
@@ -200,8 +202,9 @@ Ki_WorkSheetData WS_MostLeftLine = /* Left vertical segment */
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_MostUpperLine
,
...
...
@@ -211,7 +214,9 @@ Ki_WorkSheetData WS_SeparatorLine = /* horizontal segment between filename
NULL
,
NULL
};
Ki_WorkSheetData
WS_MostUpperLine
=
/* superior horizontal segment */
/// superior horizontal segment
Ki_WorkSheetData
WS_MostUpperLine
=
{
WS_UPPER_SEGMENT
,
&
WS_Segm3
,
...
...
@@ -225,7 +230,9 @@ Ki_WorkSheetData WS_MostUpperLine = /* superior horizontal segment */
NULL
,
NULL
};
Ki_WorkSheetData
WS_Segm3
=
/* horizontal segment above COMPANY NAME */
/// horizontal segment above COMPANY NAME
Ki_WorkSheetData
WS_Segm3
=
{
WS_SEGMENT
,
&
WS_Segm4
,
...
...
@@ -239,7 +246,9 @@ Ki_WorkSheetData WS_Segm3 = /* horizontal segment above COMPANY NAME */
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_Segm5
,
...
...
@@ -253,6 +262,7 @@ Ki_WorkSheetData WS_Segm4 = /* vertical segment of the left REV and SHEET */
NULL
,
NULL
};
Ki_WorkSheetData
WS_Segm5
=
{
WS_SEGMENT
,
...
...
@@ -267,6 +277,7 @@ Ki_WorkSheetData WS_Segm5 =
NULL
,
NULL
};
Ki_WorkSheetData
WS_Segm6
=
{
WS_SEGMENT
,
...
...
@@ -281,6 +292,7 @@ Ki_WorkSheetData WS_Segm6 =
NULL
,
NULL
};
Ki_WorkSheetData
WS_Segm7
=
{
WS_SEGMENT
,
...
...
@@ -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
)
{
if
(
!
m_showBorderAndTitleBlock
)
return
;
Ki_PageDescr
*
Sheet
=
screen
->
m_CurrentSheetDesc
;
const
PAGE_INFO
&
pageInfo
=
GetPageSettings
();
wxSize
pageSize
=
pageInfo
.
GetSizeMils
();
int
ii
,
jj
,
xg
,
yg
,
ipas
,
gxpas
,
gypas
;
wxPoint
pos
;
int
refx
,
refy
;
...
...
@@ -1017,28 +1029,27 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
int
width
=
line_width
;
Color
=
RED
;
if
(
Sheet
==
NULL
)
{
DisplayError
(
this
,
wxT
(
"EDA_DRAW_FRAME::TraceWorkSheet() error: NULL Sheet"
)
);
return
;
}
// if not printing, draw the page limits:
if
(
!
screen
->
m_IsPrinting
&
g_ShowPageLimits
)
{
GRSetDrawMode
(
DC
,
GR_COPY
);
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
);
}
GRSetDrawMode
(
DC
,
GR_COPY
);
/* Draw the border. */
refx
=
Sheet
->
m_LeftMargin
;
refy
=
Sheet
->
m_TopMargin
;
/* Upper left corner */
xg
=
Sheet
->
m_Size
.
x
-
Sheet
->
m_RightMargin
;
yg
=
Sheet
->
m_Size
.
y
-
Sheet
->
m_BottomMargin
;
/* lower right corner */
// Draw the border.
// Upper left corner
refx
=
pageInfo
.
GetLeftMarginMils
();
refy
=
pageInfo
.
GetTopMarginMils
();
// lower right corner
xg
=
pageSize
.
x
-
pageInfo
.
GetRightMarginMils
();
yg
=
pageSize
.
y
-
pageInfo
.
GetBottomMarginMils
();
#if defined(KICAD_GOST)
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
#endif
/* Draw the reference legends. */
refx
=
Sheet
->
m_LeftMargin
;
// Draw the reference legends.
refx
=
pageInfo
.
GetLeftMarginMils
();
#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
)
{
pos
.
x
=
(
refx
-
WsItem
->
m_Posx
)
*
scale
;
...
...
@@ -1080,15 +1092,15 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
break
;
case
WS_SEGMENT_LU
:
xg
=
Sheet
->
m_LeftMargin
-
WsItem
->
m_Endx
;
yg
=
Sheet
->
m_Size
.
y
-
Sheet
->
m_BottomMargin
-
WsItem
->
m_Endy
;
xg
=
pageInfo
.
GetLeftMargin
()
-
WsItem
->
m_Endx
;
yg
=
pageSize
.
y
-
pageInfo
.
GetBottomMarginMils
()
-
WsItem
->
m_Endy
;
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
pos
.
x
,
pos
.
y
,
xg
*
scale
,
yg
*
scale
,
width
,
Color
);
break
;
}
}
refy
=
Sheet
->
m_BottomMargin
;
/* Left Top corner */
refy
=
pageInfo
.
GetBottomMarginMils
();
// Left Top corner
for
(
WsItem
=
&
WS_Segm1_LT
;
WsItem
!=
NULL
;
WsItem
=
WsItem
->
Pnext
)
{
pos
.
x
=
(
refx
+
WsItem
->
m_Posx
)
*
scale
;
...
...
@@ -1097,8 +1109,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
switch
(
WsItem
->
m_Type
)
{
case
WS_SEGMENT_LT
:
xg
=
Sheet
->
m_LeftMargin
+
WsItem
->
m_Endx
;
yg
=
Sheet
->
m_BottomMargin
+
WsItem
->
m_Endy
;
xg
=
pageInfo
.
GetLeftMarginMils
()
+
WsItem
->
m_Endx
;
yg
=
pageInfo
.
GetBottomMarginMils
()
+
WsItem
->
m_Endy
;
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
pos
.
x
,
pos
.
y
,
xg
*
scale
,
yg
*
scale
,
width
,
Color
);
break
;
...
...
@@ -1106,31 +1118,39 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
}
#else
refy
=
Sheet
->
m_TopMargin
;
/* Upper left corner */
xg
=
Sheet
->
m_Size
.
x
-
Sheet
->
m_RightMargin
;
yg
=
Sheet
->
m_Size
.
y
-
Sheet
->
m_BottomMargin
;
/* lower right corner */
// Upper left corner
refy
=
pageInfo
.
GetTopMarginMils
();
// lower right corner
xg
=
pageSize
.
x
-
pageInfo
.
GetRightMarginMils
();
yg
=
pageSize
.
y
-
pageInfo
.
GetBottomMarginMils
();
ipas
=
(
xg
-
refx
)
/
PAS_REF
;
gxpas
=
(
xg
-
refx
)
/
ipas
;
for
(
ii
=
refx
+
gxpas
,
jj
=
1
;
ipas
>
0
;
ii
+=
gxpas
,
jj
++
,
ipas
--
)
{
Line
.
Printf
(
wxT
(
"%d"
),
jj
);
if
(
ii
<
xg
-
PAS_REF
/
2
)
{
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
ii
*
scale
,
refy
*
scale
,
ii
*
scale
,
(
refy
+
GRID_REF_W
)
*
scale
,
width
,
Color
);
}
DrawGraphicText
(
DrawPanel
,
DC
,
wxPoint
(
(
ii
-
gxpas
/
2
)
*
scale
,
(
refy
+
GRID_REF_W
/
2
)
*
scale
),
Color
,
Line
,
TEXT_ORIENT_HORIZ
,
size_ref
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
width
,
false
,
false
);
if
(
ii
<
xg
-
PAS_REF
/
2
)
{
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
ii
*
scale
,
yg
*
scale
,
ii
*
scale
,
(
yg
-
GRID_REF_W
)
*
scale
,
width
,
Color
);
}
DrawGraphicText
(
DrawPanel
,
DC
,
wxPoint
(
(
ii
-
gxpas
/
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
ipas
=
(
yg
-
refy
)
/
PAS_REF
;
gypas
=
(
yg
-
refy
)
/
ipas
;
for
(
ii
=
refy
+
gypas
,
jj
=
0
;
ipas
>
0
;
ii
+=
gypas
,
jj
++
,
ipas
--
)
{
if
(
jj
<
26
)
Line
.
Printf
(
wxT
(
"%c"
),
jj
+
'A'
);
else
// I hope 52 identifiers are enought...
Line
.
Printf
(
wxT
(
"%c"
),
'a'
+
jj
-
26
);
if
(
ii
<
yg
-
PAS_REF
/
2
)
{
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
refx
*
scale
,
ii
*
scale
,
(
refx
+
GRID_REF_W
)
*
scale
,
ii
*
scale
,
width
,
Color
);
}
DrawGraphicText
(
DrawPanel
,
DC
,
wxPoint
(
(
refx
+
GRID_REF_W
/
2
)
*
scale
,
(
ii
-
gypas
/
2
)
*
scale
),
Color
,
Line
,
TEXT_ORIENT_HORIZ
,
size_ref
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
width
,
false
,
false
);
if
(
ii
<
yg
-
PAS_REF
/
2
)
{
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
xg
*
scale
,
ii
*
scale
,
(
xg
-
GRID_REF_W
)
*
scale
,
ii
*
scale
,
width
,
Color
);
}
DrawGraphicText
(
DrawPanel
,
DC
,
wxPoint
(
(
xg
-
GRID_REF_W
/
2
)
*
scale
,
(
ii
-
gxpas
/
2
)
*
scale
),
...
...
@@ -1174,8 +1199,10 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
#endif
#if defined(KICAD_GOST)
refx
=
Sheet
->
m_Size
.
x
-
Sheet
->
m_RightMargin
;
refy
=
Sheet
->
m_Size
.
y
-
Sheet
->
m_BottomMargin
;
/* lower right corner */
// lower right corner
refx
=
pageSize
.
x
-
pageInfo
.
GetRightMarginMils
();
refy
=
pageSize
.
y
-
pageInfo
.
GetBottomMarginMils
();
if
(
screen
->
m_ScreenNumber
==
1
)
{
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
case
WS_PODPIS
:
if
(
WsItem
->
m_Legende
)
msg
=
WsItem
->
m_Legende
;
DrawGraphicText
(
DrawPanel
,
DC
,
pos
,
Color
,
msg
,
TEXT_ORIENT_HORIZ
,
size
,
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
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
width
,
false
,
false
);
pos
.
x
=
(
Sheet
->
m_LeftMargin
+
1260
)
*
scale
;
pos
.
y
=
(
Sheet
->
m_TopMargin
+
270
)
*
scale
;
pos
.
x
=
(
pageInfo
.
GetLeftMarginMils
()
+
1260
)
*
scale
;
pos
.
y
=
(
pageInfo
.
GetTopMarginMils
()
+
270
)
*
scale
;
DrawGraphicText
(
DrawPanel
,
DC
,
pos
,
Color
,
msg
,
1800
,
size2
,
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
pos
.
y
=
(
refy
-
WsItem
->
m_Posy
)
*
scale
;
case
WS_SEGMENT
:
xg
=
Sheet
->
m_
Size
.
x
-
Sheet
->
m_RightMargin
-
WsItem
->
m_Endx
;
yg
=
Sheet
->
m_
Size
.
y
-
Sheet
->
m_BottomMargin
-
WsItem
->
m_Endy
;
xg
=
page
Size
.
x
-
pageInfo
.
GetRightMarginMils
()
-
WsItem
->
m_Endx
;
yg
=
page
Size
.
y
-
pageInfo
.
GetBottomMarginMils
()
-
WsItem
->
m_Endy
;
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
pos
.
x
,
pos
.
y
,
xg
*
scale
,
yg
*
scale
,
width
,
Color
);
break
;
...
...
@@ -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
.
y
=
(
refy
-
WsItem
->
m_Posy
)
*
scale
;
msg
.
Empty
();
switch
(
WsItem
->
m_Type
)
{
case
WS_CADRE
:
/
* Begin list number > 1 */
/
/ Begin list number > 1
msg
=
screen
->
m_Commentaire1
;
if
(
!
msg
.
IsEmpty
()
)
{
...
...
@@ -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
,
width
,
false
,
false
);
pos
.
x
=
(
Sheet
->
m_LeftMargin
+
1260
)
*
scale
;
pos
.
y
=
(
Sheet
->
m_TopMargin
+
270
)
*
scale
;
pos
.
x
=
(
pageInfo
.
GetLeftMarginMils
()
+
1260
)
*
scale
;
pos
.
y
=
(
pageInfo
.
GetTopMarginMils
()
+
270
)
*
scale
;
DrawGraphicText
(
DrawPanel
,
DC
,
pos
,
Color
,
msg
,
1800
,
size2
,
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
pos
.
y
=
(
refy
-
WsItem
->
m_Posy
)
*
scale
;
case
WS_SEGMENT_D
:
xg
=
Sheet
->
m_
Size
.
x
-
Sheet
->
m_RightMargin
-
WsItem
->
m_Endx
;
yg
=
Sheet
->
m_
Size
.
y
-
Sheet
->
m_BottomMargin
-
WsItem
->
m_Endy
;
xg
=
page
Size
.
x
-
pageInfo
.
GetRightMarginMils
()
-
WsItem
->
m_Endx
;
yg
=
page
Size
.
y
-
pageInfo
.
GetBottomMarginMils
()
-
WsItem
->
m_Endy
;
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
pos
.
x
,
pos
.
y
,
xg
*
scale
,
yg
*
scale
,
width
,
Color
);
break
;
}
}
}
#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
)
{
...
...
@@ -1428,7 +1459,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
case
WS_SIZESHEET
:
if
(
WsItem
->
m_Legende
)
msg
=
WsItem
->
m_Legende
;
msg
+=
Sheet
->
m_Name
;
msg
+=
pageInfo
.
GetType
()
;
DrawGraphicText
(
DrawPanel
,
DC
,
pos
,
Color
,
msg
,
TEXT_ORIENT_HORIZ
,
size
,
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
pos
.
y
=
(
refy
-
WsItem
->
m_Posy
)
*
scale
;
case
WS_SEGMENT
:
xg
=
Sheet
->
m_
Size
.
x
-
GRID_REF_W
-
Sheet
->
m_RightMargin
-
WsItem
->
m_Endx
;
yg
=
Sheet
->
m_
Size
.
y
-
GRID_REF_W
-
Sheet
->
m_BottomMargin
-
WsItem
->
m_Endy
;
xg
=
page
Size
.
x
-
GRID_REF_W
-
pageInfo
.
GetRightMarginMils
()
-
WsItem
->
m_Endx
;
yg
=
page
Size
.
y
-
GRID_REF_W
-
pageInfo
.
GetBottomMarginMils
()
-
WsItem
->
m_Endy
;
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
pos
.
x
,
pos
.
y
,
xg
*
scale
,
yg
*
scale
,
width
,
Color
);
break
;
...
...
@@ -1580,50 +1611,43 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
}
/**
* 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
)
const
wxString
EDA_DRAW_FRAME
::
GetXYSheetReferences
(
const
wxPoint
&
aPosition
)
{
Ki_PageDescr
*
Sheet
=
aScreen
->
m_CurrentSheetDesc
;
int
ii
,
xg
,
yg
,
ipas
,
gxpas
,
gypas
;
int
refx
,
refy
;
wxString
msg
;
const
PAGE_INFO
&
pageInfo
=
GetPageSettings
();
if
(
Sheet
==
NULL
)
{
DisplayError
(
this
,
wxT
(
"EDA_DRAW_FRAME::GetXYSheetReferences() error: NULL Sheet"
)
);
return
msg
;
}
int
ii
;
int
xg
,
yg
;
int
ipas
;
int
gxpas
,
gypas
;
int
refx
,
refy
;
wxString
msg
;
// Upper left corner
refx
=
pageInfo
.
GetLeftMarginMils
();
refy
=
pageInfo
.
GetTopMarginMils
();
refx
=
Sheet
->
m_LeftMargin
;
refy
=
Sheet
->
m_TopMargin
;
/* Upper left corner */
xg
=
Sheet
->
m_Size
.
x
-
Sheet
->
m_RightMargin
;
yg
=
Sheet
->
m_Size
.
y
-
Sheet
->
m_BottomMargin
;
/* lower right corner */
// lower right corner
xg
=
pageInfo
.
GetSizeMils
().
x
-
pageInfo
.
GetRightMarginMils
();
yg
=
pageInfo
.
GetSizeMils
().
y
-
pageInfo
.
GetBottomMarginMils
();
/
* 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
msg
<<
wxT
(
"?"
);
else
{
ipas
=
(
yg
-
refy
)
/
PAS_REF
;
// ipas = Y count sections
gypas
=
(
yg
-
refy
)
/
ipas
;
// gypas = Y section size
ipas
=
(
yg
-
refy
)
/
PAS_REF
;
// ipas = Y count sections
gypas
=
(
yg
-
refy
)
/
ipas
;
// gypas = Y section size
ii
=
(
aPosition
.
y
-
refy
)
/
gypas
;
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
msg
<<
wxT
(
"?"
);
else
{
ipas
=
(
xg
-
refx
)
/
PAS_REF
;
// ipas = X count sections
gxpas
=
(
xg
-
refx
)
/
ipas
;
// gxpas = X section size
ipas
=
(
xg
-
refx
)
/
PAS_REF
;
// ipas = X count sections
gxpas
=
(
xg
-
refx
)
/
ipas
;
// gxpas = X section size
ii
=
(
aPosition
.
x
-
refx
)
/
gxpas
;
msg
<<
ii
+
1
;
...
...
eeschema/dialogs/dialog_SVG_print.h
View file @
0d459865
...
...
@@ -4,7 +4,6 @@
class
EDA_DRAW_FRAME
;
class
BASE_SCREEN
;
#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,
bool
CompactForm
)
{
#if defined(KICAD_GOST)
wxString
outStr
;
wxString
tmpStr
;
wxString
outStr
;
wxString
tmpStr
;
#endif
if
(
IsFieldChecked
(
FOOTPRINT
)
)
...
...
@@ -577,7 +577,7 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
{
#if defined(KICAD_GOST)
outStr
.
Printf
(
wxT
(
"%c%s"
),
s_ExportSeparatorSymbol
,
GetChars
(
DrawLibItem
->
GetField
(
FOOTPRINT
)
->
m_Text
)
);
GetChars
(
DrawLibItem
->
GetField
(
FOOTPRINT
)
->
m_Text
)
);
#else
fprintf
(
f
,
"%c%s"
,
s_ExportSeparatorSymbol
,
TO_UTF8
(
DrawLibItem
->
GetField
(
FOOTPRINT
)
->
m_Text
)
);
...
...
@@ -602,10 +602,10 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
if
(
CompactForm
)
#if defined(KICAD_GOST)
{
{
tmpStr
.
Printf
(
wxT
(
"%c%s"
),
s_ExportSeparatorSymbol
,
GetChars
(
DrawLibItem
->
GetField
(
ii
)
->
m_Text
)
);
outStr
+=
tmpStr
;
outStr
+=
tmpStr
;
}
#else
fprintf
(
f
,
"%c%s"
,
s_ExportSeparatorSymbol
,
...
...
@@ -613,10 +613,10 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
#endif
else
#if defined(KICAD_GOST)
{
{
tmpStr
.
Printf
(
wxT
(
"; %-12s"
),
GetChars
(
DrawLibItem
->
GetField
(
ii
)
->
m_Text
)
);
outStr
+=
tmpStr
;
outStr
+=
tmpStr
;
}
#else
fprintf
(
f
,
"; %-12s"
,
...
...
@@ -750,11 +750,11 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
{
#if defined(KICAD_GOST)
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
)
);
#else
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
,
TO_UTF8
(
msg
)
);
#endif
...
...
@@ -762,7 +762,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
else
{
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
)
);
}
}
...
...
@@ -828,8 +828,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
#if defined(KICAD_GOST)
else
{
switch
(
amount
)
{
switch
(
amount
)
{
case
1
:
fprintf
(
f
,
"%s%s%c%d
\n
"
,
CmpNameFirst
.
c_str
(),
TO_UTF8
(
strPred
),
s_ExportSeparatorSymbol
,
amount
);
...
...
@@ -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
(),
TO_UTF8
(
strPred
),
s_ExportSeparatorSymbol
,
amount
);
break
;
}
}
}
}
#endif
return
0
;
...
...
@@ -1060,13 +1060,13 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( FILE* f,
{
msg
=
aList
[
ii
].
GetSheetPath
().
PathHumanReadable
();
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
)
);
}
}
#if defined(KICAD_GOST)
fprintf
(
f
,
"%s"
,
TO_UTF8
(
PrintFieldData
(
DrawLibItem
)
)
);
fprintf
(
f
,
"%s"
,
TO_UTF8
(
PrintFieldData
(
DrawLibItem
)
)
);
#else
PrintFieldData
(
f
,
DrawLibItem
);
#endif
...
...
eeschema/dialogs/dialog_plot_schematic_DXF.cpp
View file @
0d459865
...
...
@@ -64,7 +64,7 @@ private:
void
initOptVars
();
void
CreateDXFFile
();
void
PlotOneSheetDXF
(
const
wxString
&
FileName
,
SCH_SCREEN
*
screen
,
Ki_PageDescr
*
sheet
,
SCH_SCREEN
*
screen
,
PAGE_INFO
*
sheet
,
wxPoint
plot_offset
,
double
scale
);
};
/* static members (static to remember last state): */
...
...
@@ -148,7 +148,7 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
SCH_SHEET_PATH
*
sheetpath
;
SCH_SHEET_PATH
oldsheetpath
=
schframe
->
GetCurrentSheet
();
wxString
PlotFileName
;
Ki_PageDescr
*
PlotSheet
;
PAGE_INFO
*
PlotSheet
;
wxPoint
plot_offset
;
/* When printing all pages, the printed page is not the current page.
...
...
@@ -208,7 +208,7 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
void
DIALOG_PLOT_SCHEMATIC_DXF
::
PlotOneSheetDXF
(
const
wxString
&
FileName
,
SCH_SCREEN
*
screen
,
Ki_PageDescr
*
sheet
,
PAGE_INFO
*
sheet
,
wxPoint
plot_offset
,
double
scale
)
{
...
...
eeschema/dialogs/dialog_plot_schematic_HPGL.cpp
View file @
0d459865
...
...
@@ -54,7 +54,7 @@ enum PageFormatReq
PAGE_SIZE_E
};
static
Ki_PageDescr
*
Plot_sheet_list
[]
=
static
PAGE_INFO
*
Plot_sheet_list
[]
=
{
NULL
,
&
g_Sheet_A4
,
...
...
@@ -99,7 +99,7 @@ private:
void
HPGL_Plot
(
bool
aPlotAll
);
void
Plot_Schematic_HPGL
(
bool
aPlotAll
,
int
HPGL_SheetSize
);
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
);
void
ReturnSheetDims
(
SCH_SCREEN
*
screen
,
wxSize
&
SheetSize
,
wxPoint
&
SheetOffset
);
};
...
...
@@ -245,7 +245,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::HPGL_Plot( bool aPlotAll )
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
();
plot_sheet
->
m_Offset
.
x
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
EESCHEMA_INTERNAL_UNIT
);
...
...
@@ -265,7 +265,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::ReturnSheetDims( SCH_SCREEN* screen,
wxSize
&
SheetSize
,
wxPoint
&
SheetOffset
)
{
Ki_PageDescr
*
PlotSheet
;
PAGE_INFO
*
PlotSheet
;
if
(
screen
==
NULL
)
screen
=
m_Parent
->
GetScreen
();
...
...
@@ -283,7 +283,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh
SCH_SCREEN
*
screen
=
m_Parent
->
GetScreen
();
SCH_SHEET_PATH
*
sheetpath
;
SCH_SHEET_PATH
oldsheetpath
=
m_Parent
->
GetCurrentSheet
();
Ki_PageDescr
*
PlotSheet
;
PAGE_INFO
*
PlotSheet
;
wxSize
SheetSize
;
wxPoint
SheetOffset
,
PlotOffset
;
...
...
@@ -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
,
SCH_SCREEN
*
screen
,
Ki_PageDescr
*
sheet
,
PAGE_INFO
*
sheet
,
wxPoint
&
offset
,
double
plot_scale
)
{
...
...
eeschema/dialogs/dialog_plot_schematic_PS.cpp
View file @
0d459865
...
...
@@ -70,7 +70,7 @@ private:
void
initOptVars
();
void
createPSFile
();
void
plotOneSheetPS
(
const
wxString
&
FileName
,
SCH_SCREEN
*
screen
,
Ki_PageDescr
*
sheet
,
SCH_SCREEN
*
screen
,
PAGE_INFO
*
sheet
,
wxPoint
plot_offset
,
double
scale
);
};
/* static members (static to remember last state): */
...
...
@@ -176,8 +176,8 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
SCH_SHEET_PATH
*
sheetpath
;
SCH_SHEET_PATH
oldsheetpath
=
m_Parent
->
GetCurrentSheet
();
// sheetpath is saved here
wxString
plotFileName
;
Ki_PageDescr
*
actualPage
;
// page size selected in schematic
Ki_PageDescr
*
plotPage
;
// page size selected to plot
PAGE_INFO
*
actualPage
;
// page size selected in schematic
PAGE_INFO
*
plotPage
;
// page size selected to plot
wxPoint
plot_offset
;
/* When printing all pages, the printed page is not the current page.
...
...
@@ -254,7 +254,7 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
void
DIALOG_PLOT_SCHEMATIC_PS
::
plotOneSheetPS
(
const
wxString
&
FileName
,
SCH_SCREEN
*
screen
,
Ki_PageDescr
*
sheet
,
PAGE_INFO
*
sheet
,
wxPoint
plot_offset
,
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
char
Text
[
256
];
char
buf
[
1024
];
int
ii
;
Ki_PageDescr
*
wsheet
=
&
g_Sheet_A4
;
PAGE_INFO
*
wsheet
=
&
g_Sheet_A4
;
wxSize
PageSize
;
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_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 )
{
size_t
i
;
SetDrawItems
(
NULL
);
/* Schematic items list */
SetDrawItems
(
NULL
);
// Schematic items list
m_Zoom
=
32
;
for
(
i
=
0
;
i
<
SCHEMATIC_ZOOM_LIST_CNT
;
i
++
)
...
...
@@ -110,12 +111,12 @@ SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type )
for
(
i
=
0
;
i
<
SCHEMATIC_GRID_LIST_CNT
;
i
++
)
AddGrid
(
SchematicGridList
[
i
]
);
SetGrid
(
wxRealPoint
(
50
,
50
)
);
/
* Default grid size. */
SetGrid
(
wxRealPoint
(
50
,
50
)
);
/
/ Default grid size.
m_refCount
=
0
;
m_Center
=
false
;
/* Suitable for schematic only. For
* libedit and viewlib, must be set
* to true */
InitDatas
();
m_Center
=
false
;
// Suitable for schematic only. For
// libedit and viewlib, must be set
// to true
}
...
...
@@ -1547,3 +1548,18 @@ int SCH_SCREENS::GetMarkerCount( int aMarkerType )
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;
GERBER_IMAGE
*
g_GERBER_List
[
32
];
// 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 show page limits
...
...
gerbview/gerbview.h
View file @
0d459865
...
...
@@ -19,7 +19,7 @@ class GERBVIEW_FRAME;
//class BOARD;
class
GERBER_IMAGE
;
class
Ki_PageDescr
;
class
PAGE_INFO
;
// Type of photoplotter action:
...
...
@@ -57,8 +57,6 @@ extern int g_DisplayPolygonsModeSketch;
extern
const
wxString
GerbviewProjectFileExt
;
extern
const
wxString
GerbviewProjectFileWildcard
;
extern
Ki_PageDescr
*
g_GerberPageSizeList
[];
// Interpolation type
enum
Gerb_Interpolation
{
...
...
gerbview/gerbview_frame.cpp
View file @
0d459865
...
...
@@ -67,8 +67,8 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
m_FrameName
=
wxT
(
"GerberFrame"
);
m_show_layer_manager_tools
=
true
;
m_showAxis
=
true
;
// true to show X and Y axis on screen
m_showBorderAndTitleBlock
=
false
;
// true for reference drawings.
m_showAxis
=
true
;
// true to show X and Y axis on screen
m_showBorderAndTitleBlock
=
false
;
// true for reference drawings.
m_HotkeysZoomAndGridList
=
s_Gerbview_Hokeys_Descr
;
m_SelLayerBox
=
NULL
;
m_DCodeSelector
=
NULL
;
...
...
@@ -83,13 +83,13 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
icon
.
CopyFromBitmap
(
KiBitmap
(
icon_gerbview_xpm
)
);
SetIcon
(
icon
);
SetScreen
(
new
PCB_SCREEN
()
);
GetScreen
()
->
m_CurrentSheetDesc
=
&
g_Sheet_GERBER
;
SetBoard
(
new
BOARD
()
);
GetBoard
()
->
SetEnabledLayers
(
FULL_LAYERS
);
// All 32 layers enabled at first.
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():
wxFont
font
=
wxSystemSettings
::
GetFont
(
wxSYS_DEFAULT_GUI_FONT
);
int
pointSize
=
font
.
GetPointSize
();
...
...
@@ -209,17 +209,15 @@ void GERBVIEW_FRAME::LoadSettings()
wxGetApp
().
ReadCurrentSetupValues
(
GetConfigurationSettings
()
);
long
pageSize_opt
;
config
->
Read
(
GerbviewShowPageSizeOption
,
&
pageSize_opt
,
0l
);
int
imax
=
0
;
wxString
pageType
;
config
->
Read
(
GerbviewShowPageSizeOption
,
&
pageType
,
wxT
(
"GERBER"
)
)
;
for
(
;
g_GerberPageSizeList
[
imax
]
!=
NULL
;
imax
++
)
;
PAGE_INFO
pageInfo
(
pageType
);
if
(
pageSize_opt
<
0
||
pageSize_opt
>=
imax
)
pageSize_opt
=
0
;
SetPageSettings
(
pageInfo
);
GetScreen
()
->
m_CurrentSheetDesc
=
g_GerberPageSizeList
[
pageSize_opt
]
;
GetScreen
()
->
InitDataPoints
(
pageInfo
.
GetSizeIU
()
)
;
if
(
pageSize_opt
>
0
)
{
...
...
@@ -268,7 +266,7 @@ void GERBVIEW_FRAME::SaveSettings()
}
}
config
->
Write
(
GerbviewShowPageSizeOption
,
pageSize_opt
);
config
->
Write
(
GerbviewShowPageSizeOption
,
GetPageSettings
().
GetType
()
);
config
->
Write
(
GerbviewShowDCodes
,
IsElementVisible
(
DCODES_VISIBLE
)
);
// Save the drill file history list.
// 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 )
SetScreen
(
new
PCB_SCREEN
()
);
GetScreen
()
->
Init
();
setActiveLayer
(
FIRST_COPPER_LAYER
);
m_LayersManager
->
UpdateLayerIcons
();
syncLayerBox
();
...
...
include/class_base_screen.h
View file @
0d459865
...
...
@@ -37,11 +37,10 @@
#include "common.h"
// Forward declarations:
class
Ki_PageDescr
;
/* Simple class for handling grid arrays. */
/**
* Class GRID_TYPE
* is for grid arrays.
*/
class
GRID_TYPE
{
public
:
...
...
@@ -59,7 +58,6 @@ public:
return
*
this
;
}
const
bool
operator
==
(
const
GRID_TYPE
&
item
)
const
{
return
m_Size
==
item
.
m_Size
&&
m_Id
==
item
.
m_Id
;
...
...
@@ -72,13 +70,12 @@ typedef std::vector< GRID_TYPE > GRIDS;
/**
* 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
{
EDA_ITEMS
m_items
;
///< The drawing items associated with this screen.
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.
char
m_FlagRefreshReq
;
///< Indicates that the screen should be redrawn.
bool
m_FlagModified
;
///< Indicates current drawing has been modified.
...
...
@@ -96,18 +93,19 @@ class BASE_SCREEN : public EDA_ITEM
wxPoint
m_crossHairPosition
;
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)
* in user units. (coordinates from last reset position)*/
// Scrollbars management:
int
m_ScrollPixelsPerUnitX
;
/
* Pixels per scroll unit in the horizontal direction. */
int
m_ScrollPixelsPerUnitY
;
/
* Pixels per scroll unit in the vertical direction. */
int
m_ScrollPixelsPerUnitX
;
/
//< Pixels per scroll unit in the horizontal direction.
int
m_ScrollPixelsPerUnitY
;
/
//< Pixels per scroll unit in the vertical direction.
wxSize
m_ScrollbarNumber
;
/* Current virtual draw area size in scroll units.
* m_ScrollbarNumber * m_ScrollPixelsPerUnit =
* 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
* view position (upper left corner of device)
...
...
@@ -118,18 +116,16 @@ public:
* > 0 except for schematics.
* false: when coordinates can only be >= 0
* Schematic */
bool
m_FirstRedraw
;
bool
m_FirstRedraw
;
// Undo/redo list of commands
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) */
unsigned
m_UndoRedoCountMax
;
// undo/Redo command Max depth
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)
unsigned
m_UndoRedoCountMax
;
//
/<
undo/Redo command Max depth
/
* block control */
BLOCK_SELECTOR
m_BlockLocate
;
/
* Block description for block commands */
/
/ block control
BLOCK_SELECTOR
m_BlockLocate
;
/
//< Block description for block commands
/* Page description */
Ki_PageDescr
*
m_CurrentSheetDesc
;
int
m_ScreenNumber
;
int
m_NumberOfScreen
;
...
...
@@ -145,8 +141,8 @@ public:
/* Grid and zoom values. */
wxPoint
m_GridOrigin
;
wxArrayDouble
m_ZoomList
;
/
* Array of standard zoom (i.e. scale) coefficients. */
double
m_Zoom
;
/
* Current zoom coefficient. */
wxArrayDouble
m_ZoomList
;
/
//< Array of standard zoom (i.e. scale) coefficients.
double
m_Zoom
;
/
//< Current zoom coefficient.
bool
m_IsPrinting
;
public
:
...
...
@@ -162,24 +158,12 @@ public:
EDA_ITEM
*
GetCurItem
()
const
{
return
m_CurrentItem
;
}
/**
* 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
InitDataPoints
(
const
wxSize
&
aPageSizeInternalUnits
);
void
SetFileName
(
const
wxString
&
aFileName
)
{
m_fileName
=
aFileName
;
}
wxString
GetFileName
()
const
{
return
m_fileName
;
}
void
SetPageSize
(
wxSize
&
aPageSize
);
wxSize
ReturnPageSize
(
void
);
/**
* Function GetInternalUnits
* @return the screen units scalar.
...
...
@@ -469,9 +453,8 @@ public:
}
#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 // CLASS_BASE_SCREEN_H_
include/class_pcb_screen.h
View file @
0d459865
...
...
@@ -2,8 +2,8 @@
* @file class_pcb_screen.h
*/
#ifndef
__CLASSPCB_SCREEN_H_
_
#define
__CLASSPCB_SCREEN_H_
_
#ifndef
CLASS_PCB_SCREEN_H
_
#define
CLASS_PCB_SCREEN_H
_
#include "class_base_screen.h"
...
...
@@ -26,17 +26,17 @@ public:
~
PCB_SCREEN
();
PCB_SCREEN
*
Next
()
{
return
(
PCB_SCREEN
*
)
Pnext
;
}
void
Init
();
void
SetNextZoom
();
void
SetPreviousZoom
();
void
SetLastZoom
();
virtual
int
GetInternalUnits
(
void
);
virtual
int
GetInternalUnits
();
/**
* Function GetCurItem
* returns the currently selected BOARD_ITEM, overriding
*BASE_SCREEN::GetCurItem().
*
BASE_SCREEN::GetCurItem().
* @return BOARD_ITEM* - the one selected, or NULL.
*/
BOARD_ITEM
*
GetCurItem
()
const
...
...
@@ -73,5 +73,4 @@ public:
void
ClearUndoORRedoList
(
UNDO_REDO_CONTAINER
&
aList
,
int
aItemCount
=
-
1
);
};
#endif
/* __CLASSPCB_SCREEN_H__ */
#endif // CLASS_PCB_SCREEN_H_
include/class_sch_screen.h
View file @
0d459865
...
...
@@ -55,14 +55,20 @@ enum SCH_LINE_TEST_T
};
/
* Max number of sheets in a hierarchy project: */
#define NB_MAX_SHEET 500
/
// Max number of sheets in a hierarchy project
#define NB_MAX_SHEET
500
class
SCH_SCREEN
:
public
BASE_SCREEN
{
int
m_refCount
;
///< Number of sheets referencing this screen.
///< Delete when it goes to zero.
int
m_refCount
;
///< Number of sheets referencing this screen.
///< 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
...
...
@@ -85,6 +91,9 @@ public:
return
wxT
(
"SCH_SCREEN"
);
}
const
PAGE_INFO
&
GetPageSettings
()
const
{
return
m_paper
;
}
void
SetPageSettings
(
const
PAGE_INFO
&
aPageSettings
)
{
m_paper
=
aPageSettings
;
}
void
DecRefCount
();
void
IncRefCount
();
...
...
@@ -93,12 +102,10 @@ public:
/**
* Function GetDrawItems().
*
* @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
();
}
virtual
void
SetDrawItems
(
SCH_ITEM
*
aItem
)
{
BASE_SCREEN
::
SetDrawItems
(
aItem
);
}
SCH_ITEM
*
GetDrawItems
()
const
{
return
m_drawList
;
}
void
SetDrawItems
(
SCH_ITEM
*
aItem
)
{
m_drawList
=
aItem
;
}
/**
* Function GetCurItem
...
...
@@ -456,6 +463,10 @@ public:
{
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 @@
#ifndef INCLUDE__COMMON_H_
#define INCLUDE__COMMON_H_
#include <vector>
#include "wx/wx.h"
#include "wx/confbase.h"
#include "wx/fileconf.h"
class
wxAboutDialogInfo
;
class
BASE_SCREEN
;
class
EDA_DRAW_FRAME
;
...
...
@@ -54,12 +57,11 @@ class EDA_DRAW_PANEL;
* flag for block commands
*/
// default name for nameless projects
//
/
default name for nameless projects
#define NAMELESS_PROJECT wxT( "noname" )
#define NB_ITEMS 11
/
* Pseudo key codes for command panning */
/
// Pseudo key codes for command panning
enum
pseudokeys
{
EDA_PANNING_UP_KEY
=
1
,
EDA_PANNING_DOWN_KEY
,
...
...
@@ -124,38 +126,101 @@ enum EDA_UNITS_T {
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
:
wxSize
m_Size
;
/* page size in 1/1000 inch */
wxPoint
m_Offset
;
/* plot offset in 1/1000 inch */
wxString
m_Name
;
int
m_LeftMargin
;
int
m_RightMargin
;
int
m_TopMargin
;
int
m_BottomMargin
;
PAGE_INFO
(
const
wxString
&
aType
=
wxT
(
"A3"
)
);
PAGE_INFO
(
const
wxSize
&
aSizeMils
,
const
wxPoint
&
aOffsetMils
,
const
wxString
&
aName
);
const
wxString
&
GetType
()
const
{
return
m_Type
;
}
/**
* 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
:
Ki_PageDescr
(
const
wxSize
&
size
,
const
wxPoint
&
offset
,
const
wxString
&
name
);
};
wxPoint
GetOffsetMils
()
const
{
return
m_Offset
;
}
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
;
extern
Ki_PageDescr
g_Sheet_A2
;
extern
Ki_PageDescr
g_Sheet_A1
;
extern
Ki_PageDescr
g_Sheet_A0
;
extern
Ki_PageDescr
g_Sheet_A
;
extern
Ki_PageDescr
g_Sheet_B
;
extern
Ki_PageDescr
g_Sheet_C
;
extern
Ki_PageDescr
g_Sheet_D
;
extern
Ki_PageDescr
g_Sheet_E
;
extern
Ki_PageDescr
g_Sheet_GERBER
;
extern
Ki_PageDescr
g_Sheet_user
;
extern
Ki_PageDescr
*
g_SheetSizeList
[];
/**
* Function SetUserWidthInches
* sets the width of type "User" page in inches.
*/
static
void
SetUserWidthInches
(
double
aWidthInInches
);
/**
* Function SetUserHeightInches
* sets the height type "User" page in inches.
*/
static
void
SetUserHeightInches
(
double
aHeightInInches
);
#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
;
...
...
include/plot_common.h
View file @
0d459865
...
...
@@ -10,10 +10,7 @@
#include <vector>
#include "drawtxt.h"
class
Ki_PageDescr
;
#include "common.h" // PAGE_INFO
/**
* Enum PlotFormat
...
...
@@ -27,6 +24,7 @@ enum PlotFormat {
PLOT_FORMAT_DXF
};
class
PLOTTER
{
public
:
...
...
@@ -70,8 +68,8 @@ public: PLOTTER( PlotFormat aPlotType );
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_default_line_width
(
int
width
)
=
0
;
virtual
void
set_color
(
int
color
)
=
0
;
...
...
@@ -226,7 +224,7 @@ protected:
bool
plotMirror
;
wxString
creator
;
wxString
filename
;
Ki_PageDescr
*
sheet
;
PAGE_INFO
pageInfo
;
wxSize
paper_size
;
};
...
...
include/wxBasePcbFrame.h
View file @
0d459865
...
...
@@ -112,6 +112,10 @@ public:
*/
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
* 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;
class
EDA_MSG_PANEL
;
class
BASE_SCREEN
;
class
PARAM_CFG_BASE
;
class
Ki_PageDescr
;
class
PAGE_INFO
;
class
PLOTTER
;
enum
id_librarytype
{
...
...
@@ -371,9 +371,9 @@ public:
protected
:
EDA_HOTKEY_CONFIG
*
m_HotkeysZoomAndGridList
;
int
m_LastGridSizeId
;
bool
m_DrawGrid
;
// hide/Show grid
int
m_GridColor
;
// Grid color
int
m_LastGridSizeId
;
bool
m_DrawGrid
;
// hide/Show grid
int
m_GridColor
;
// Grid color
/// Internal units count that is equivalent to 1 inch. Set to 1000 (0.001") for
/// schematic drawing and 10000 (0.0001") for PCB drawing.
...
...
@@ -449,6 +449,16 @@ public:
~
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
;
}
void
SetOriginAxisPosition
(
const
wxPoint
&
aPosition
)
{
m_originAxisPosition
=
aPosition
;
}
...
...
@@ -653,13 +663,13 @@ public:
/**
* 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 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
GetXYSheetReferences
(
BASE_SCREEN
*
aScreen
,
const
wxPoint
&
aPosition
);
const
wxString
GetXYSheetReferences
(
const
wxPoint
&
aPosition
);
void
DisplayToolMsg
(
const
wxString
&
msg
);
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 )
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
{
...
...
@@ -134,18 +161,17 @@ EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
if
(
area
.
GetWidth
()
==
0
&&
area
.
GetHeight
()
==
0
)
{
wxSize
pageSize
=
GetPageSizeIU
();
if
(
m_showBorderAndTitleBlock
)
{
area
.
SetOrigin
(
0
,
0
);
area
.
SetEnd
(
GetScreen
()
->
ReturnPageSize
().
x
,
GetScreen
()
->
ReturnPageSize
().
y
);
area
.
SetEnd
(
pageSize
.
x
,
pageSize
.
y
);
}
else
{
area
.
SetOrigin
(
-
GetScreen
()
->
ReturnPageSize
().
x
/
2
,
-
GetScreen
()
->
ReturnPageSize
().
y
/
2
);
area
.
SetEnd
(
GetScreen
()
->
ReturnPageSize
().
x
/
2
,
GetScreen
()
->
ReturnPageSize
().
y
/
2
);
area
.
SetOrigin
(
-
pageSize
.
x
/
2
,
-
pageSize
.
y
/
2
);
area
.
SetEnd
(
pageSize
.
x
/
2
,
pageSize
.
y
/
2
);
}
}
...
...
pcbnew/class_board.h
View file @
0d459865
...
...
@@ -14,7 +14,7 @@
#include "class_pad.h"
#include "class_colors_design_settings.h"
#include "class_board_design_settings.h"
#include "common.h" // PAGE_INFO
class
PCB_BASE_FRAME
;
class
PCB_EDIT_FRAME
;
...
...
@@ -27,7 +27,7 @@ class D_PAD;
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
;
...
...
@@ -174,6 +174,7 @@ private:
BOARD_DESIGN_SETTINGS
m_designSettings
;
COLORS_DESIGN_SETTINGS
*
m_colorsSettings
;
// Link to current colors settings
PAGE_INFO
m_paper
;
/**
* Function chainMarkedSegments
...
...
@@ -534,15 +535,14 @@ public:
*/
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
* @return the current COLORS_DESIGN_SETTINGS in use
*/
COLORS_DESIGN_SETTINGS
*
GetColorsSettings
()
const
{
return
m_colorsSettings
;
}
COLORS_DESIGN_SETTINGS
*
GetColorsSettings
()
const
{
return
m_colorsSettings
;
}
/**
* Function SetColorsSettings
...
...
@@ -553,7 +553,6 @@ public:
m_colorsSettings
=
aColorsSettings
;
}
/**
* Function GetLayerName
* 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
text
.
Empty
();
for
(
int
ii
=
0
;
ii
<
PADNAMEZ
;
ii
++
)
for
(
int
ii
=
0
;
ii
<
PADNAMEZ
&&
m_Padname
[
ii
];
ii
++
)
{
if
(
!
m_Padname
[
ii
]
)
break
;
// add an unsigned 8 bit byte, which is LATIN1 or CRYLIC
// m_Padname is 8 bit KiCad font junk, do not sign extend
text
.
Append
(
(
unsigned
char
)
m_Padname
[
ii
]
);
}
#endif
...
...
pcbnew/class_track.h
View file @
0d459865
...
...
@@ -197,9 +197,9 @@ public:
int
aCircleToSegmentsCount
,
double
aCorrectionFactor
);
/**
* Function SetDrill
Value
* Function SetDrill
* 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
;
}
...
...
pcbnew/classpcb.cpp
View file @
0d459865
...
...
@@ -32,8 +32,8 @@ static const double PcbZoomList[] =
200.0
,
350.0
,
500.0
,
1000.0
,
2000.0
};
#define PCB_ZOOM_LIST_CNT ( sizeof( PcbZoomList ) / sizeof( PcbZoomList[0] ) )
#define MM_TO_PCB_UNITS
10000.0 / 25.4
#define PCB_ZOOM_LIST_CNT
( sizeof( PcbZoomList ) / sizeof( PcbZoomList[0] ) )
#define MM_TO_PCB_UNITS
(10000.0 / 25.4)
/* Default grid sizes for PCB editor screens. */
...
...
@@ -82,8 +82,13 @@ PCB_SCREEN::PCB_SCREEN() : BASE_SCREEN( SCREEN_T )
for
(
i
=
0
;
i
<
PCB_GRID_LIST_CNT
;
i
++
)
AddGrid
(
PcbGridList
[
i
]
);
SetGrid
(
wxRealPoint
(
500
,
500
)
);
/* Set the working grid size to a reasonnable value (in 1/10000 inch) */
Init
();
// Set the working grid size to a reasonnable value (in 1/10000 inch)
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()
}
void
PCB_SCREEN
::
Init
()
{
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
)
int
PCB_SCREEN
::
GetInternalUnits
()
{
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,
BASE_SCREEN
*
screen
,
bool
aPrint_Frame_Ref
)
{
int
tmpzoom
;
wxPoint
tmp_startvisu
;
wxSize
SheetSize
;
// Sheet size in internal units
wxPoint
old_org
;
bool
success
=
true
;
// const PAGE_INFO& pageInfo = m_Parent->GetPageSettings();
/* 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
;
tmpzoom
=
screen
->
GetZoom
();
old_org
=
screen
->
m_DrawOrg
;
screen
->
m_DrawOrg
.
x
=
screen
->
m_DrawOrg
.
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
);
float
dpi
=
(
float
)
m_Parent
->
GetInternalUnits
();
EDA_DRAW_PANEL
*
panel
=
m_Parent
->
DrawPanel
;
SetLocaleTo_C_standard
();
// Switch the locale to standard C (needed
// to print floating point numbers like 1.3)
wxSVGFileDC
dc
(
FullFileName
,
SheetSize
.
x
,
SheetSize
.
y
,
dpi
);
// paper pageSize is in internal units, either nanometers or deci-mils
wxSize
pageSize
=
m_Parent
->
GetPageSizeIU
();
wxSVGFileDC
dc
(
FullFileName
,
pageSize
.
x
,
pageSize
.
y
,
dpi
);
EDA_RECT
tmp
=
panel
->
m_ClipBox
;
GRResetPenAndBrush
(
&
dc
);
GRForceBlackPen
(
m_ModeColorOption
->
GetSelection
()
==
0
?
false
:
true
);
s_Parameters
.
m_DrillShapeOpt
=
PRINT_PARAMETERS
::
FULL_DRILL_SHAPE
;
panel
->
m_ClipBox
.
SetX
(
0
);
panel
->
m_ClipBox
.
SetY
(
0
);
// Set clip box to the max size
#define MAX_VALUE (INT_MAX/2) // MAX_VALUE is the max we can use in an integer
// and that allows calculations without overflow
...
...
@@ -273,9 +274,9 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
if
(
aPrint_Frame_Ref
)
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
;
SetLocaleTo_Default
();
// revert to the current locale
screen
->
m_IsPrinting
=
false
;
panel
->
m_ClipBox
=
tmp
;
...
...
pcbnew/dialogs/dialog_gendrill.h
View file @
0d459865
...
...
@@ -54,7 +54,8 @@ private:
static
bool
m_createRpt
;
// true to create a drill 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
();
private
:
...
...
pcbnew/gen_drill_report_files.cpp
View file @
0d459865
...
...
@@ -20,25 +20,24 @@
void
GenDrillMapFile
(
BOARD
*
aPcb
,
FILE
*
aFile
,
const
wxString
&
aFullFileName
,
Ki_PageDescr
*
aSheet
,
const
PAGE_INFO
&
aSheet
,
std
::
vector
<
HOLE_INFO
>
aHoleListBuffer
,
std
::
vector
<
DRILL_TOOL
>
aToolListBuffer
,
bool
aUnit_Drill_is_Inch
,
int
format
,
const
wxPoint
&
auxoffset
)
{
int
x
,
y
;
int
plotX
,
plotY
,
TextWidth
;
double
scale
=
1.0
;
int
intervalle
=
0
,
CharSize
=
0
;
EDA_ITEM
*
PtStruct
;
char
line
[
1024
];
int
dX
,
dY
;
wxPoint
BoardCentre
;
wxPoint
offset
;
wxString
msg
;
PLOTTER
*
plotter
=
NULL
;
SetLocaleTo_C_standard
();
// Use the standard notation for float numbers
int
x
,
y
;
int
plotX
,
plotY
,
TextWidth
;
double
scale
=
1.0
;
int
intervalle
=
0
,
CharSize
=
0
;
EDA_ITEM
*
PtStruct
;
char
line
[
1024
];
int
dX
,
dY
;
wxPoint
BoardCentre
;
wxPoint
offset
;
wxString
msg
;
PLOTTER
*
plotter
=
NULL
;
LOCALE_IO
toggle
;
// use standard notation for float numbers
// Calculate dimensions and center of PCB
EDA_RECT
bbbox
=
aPcb
->
ComputeBoundingBox
();
...
...
@@ -58,7 +57,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
plotter
->
set_viewport
(
offset
,
scale
,
0
);
break
;
case
PLOT_FORMAT_HPGL
:
/
* Scale for HPGL format. */
case
PLOT_FORMAT_HPGL
:
/
/ Scale for HPGL format.
{
offset
.
x
=
0
;
offset
.
y
=
0
;
...
...
@@ -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_speed
(
g_PcbPlotOptions
.
m_HPGLPenSpeed
);
hpgl_plotter
->
set_pen_overlap
(
0
);
plotter
->
set_paper_size
(
aSheet
);
plotter
->
SetPageSettings
(
aSheet
);
plotter
->
set_viewport
(
offset
,
scale
,
0
);
}
break
;
case
PLOT_FORMAT_POST
:
{
Ki_PageDescr
*
SheetPS
=
&
g_Sheet_A4
;
wxSize
SheetSize
;
SheetSize
.
x
=
SheetPS
->
m_Size
.
x
*
U_PCB
;
SheetSize
.
y
=
SheetPS
->
m_Size
.
y
*
U_PCB
;
/* Keep size for drill legend */
double
Xscale
=
(
double
)
(
SheetSize
.
x
*
0.8
)
/
dX
;
double
Yscale
=
(
double
)
(
SheetSize
.
y
*
0.6
)
/
dY
;
PAGE_INFO
pageA4
(
wxT
(
"A4"
)
);
wxSize
pageSizeIU
=
pageA4
.
GetSizeIU
();
// Keep size for drill legend
double
Xscale
=
(
double
)
(
pageSizeIU
.
x
*
0.8
)
/
dX
;
double
Yscale
=
(
double
)
(
pageSizeIU
.
y
*
0.6
)
/
dY
;
scale
=
MIN
(
Xscale
,
Yscale
);
offset
.
x
=
(
int
)
(
(
double
)
BoardCentre
.
x
-
(
(
double
)
SheetSize
.
x
/
2.0
)
/
scale
);
offset
.
y
=
(
int
)
(
(
double
)
BoardCentre
.
y
-
(
(
double
)
SheetSize
.
y
/
2.0
)
/
scale
);
offset
.
y
+=
SheetSize
.
y
/
8
;
/* offset to legend */
offset
.
x
=
(
int
)
(
(
double
)
BoardCentre
.
x
-
(
(
double
)
pageSizeIU
.
x
/
2.0
)
/
scale
);
offset
.
y
=
(
int
)
(
(
double
)
BoardCentre
.
y
-
(
(
double
)
pageSizeIU
.
y
/
2.0
)
/
scale
);
offset
.
y
+=
pageSizeIU
.
y
/
8
;
// offset to legend
PS_PLOTTER
*
ps_plotter
=
new
PS_PLOTTER
;
plotter
=
ps_plotter
;
ps_plotter
->
set_paper_size
(
SheetPS
);
ps_plotter
->
SetPageSettings
(
pageA4
);
plotter
->
set_viewport
(
offset
,
scale
,
0
);
break
;
}
...
...
@@ -102,7 +101,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
scale
=
1
;
DXF_PLOTTER
*
dxf_plotter
=
new
DXF_PLOTTER
;
plotter
=
dxf_plotter
;
plotter
->
set_paper_size
(
aSheet
);
plotter
->
SetPageSettings
(
aSheet
);
plotter
->
set_viewport
(
offset
,
scale
,
0
);
break
;
}
...
...
@@ -116,7 +115,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
plotter
->
set_default_line_width
(
10
);
plotter
->
start_plot
(
aFile
);
/
* Draw items on edge layer */
/
/ Draw items on edge layer
for
(
PtStruct
=
aPcb
->
m_Drawings
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Next
()
)
{
...
...
@@ -154,19 +153,19 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
// Plot board outlines and drill map
Gen_Drill_PcbMap
(
aPcb
,
plotter
,
aHoleListBuffer
,
aToolListBuffer
);
/
* Print a list of symbols used. */
CharSize
=
800
;
/
* text size in 1/10000 mils */
/
/ Print a list of symbols used.
CharSize
=
800
;
/
/ text size in 1/10000 mils
double
CharScale
=
1.0
/
scale
;
/* real scale will be CharScale
* scale_x, because the global
* plot scale is scale_x */
TextWidth
=
(
int
)
(
(
CharSize
*
CharScale
)
/
10
);
// Set text width (thickness)
intervalle
=
(
int
)
(
CharSize
*
CharScale
)
+
TextWidth
;
/
* Trace information. */
/
/ Trace information.
plotX
=
(
int
)
(
(
double
)
bbbox
.
GetX
()
+
200.0
*
CharScale
);
plotY
=
bbbox
.
GetBottom
()
+
intervalle
;
/
* Plot title "Info" */
/
/ Plot title "Info"
wxString
Text
=
wxT
(
"Drill Map:"
);
plotter
->
text
(
wxPoint
(
plotX
,
plotY
),
BLACK
,
Text
,
0
,
wxSize
(
(
int
)
(
CharSize
*
CharScale
),
...
...
@@ -188,7 +187,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
y
=
(
int
)
(
(
double
)
plotY
+
(
double
)
CharSize
*
CharScale
);
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,
// and then its diameter in the other Drill Unit.
...
...
@@ -235,7 +234,6 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
plotter
->
end_plot
();
delete
plotter
;
SetLocaleTo_Default
();
// Revert to local notation for float numbers
}
...
...
@@ -251,7 +249,7 @@ void Gen_Drill_PcbMap( BOARD* aPcb, PLOTTER* aPlotter,
{
wxPoint
pos
;
/
* create the drill list */
/
/ create the drill list
if
(
aToolListBuffer
.
size
()
>
13
)
{
DisplayInfoMessage
(
NULL
,
...
...
pcbnew/gendrill.cpp
View file @
0d459865
...
...
@@ -635,7 +635,7 @@ void DIALOG_GENDRILL::GenDrillMap( const wxString aFileName,
GenDrillMapFile
(
m_Parent
->
GetBoard
(),
plotfile
,
dlg
.
GetPath
(),
m_Parent
->
Get
Screen
()
->
m_CurrentSheetDesc
,
m_Parent
->
Get
PageSettings
()
,
s_HoleListBuffer
,
s_ToolListBuffer
,
m_UnitDrillIsInch
,
...
...
pcbnew/gendrill.h
View file @
0d459865
...
...
@@ -217,7 +217,7 @@ void Build_Holes_List( BOARD* aPcb, std::vector<HOLE_INFO>& aHoleListBuffer,
void
GenDrillMapFile
(
BOARD
*
aPcb
,
FILE
*
aFile
,
const
wxString
&
aFullFileName
,
Ki_PageDescr
*
aSheet
,
const
PAGE_INFO
&
aSheet
,
std
::
vector
<
HOLE_INFO
>
aHoleListBuffer
,
std
::
vector
<
DRILL_TOOL
>
aToolListBuffer
,
bool
aUnit_Drill_is_Inch
,
...
...
pcbnew/initpcb.cpp
View file @
0d459865
...
...
@@ -42,21 +42,22 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
SetBoard
(
new
BOARD
()
);
SetCurItem
(
NULL
);
/
* clear filename, to avoid overwriting an old file */
/
/ clear filename, to avoid overwriting an old file
GetScreen
()
->
GetFileName
().
Empty
();
/* Init new grid size */
wxRealPoint
gridsize
=
GetScreen
()
->
GetGridSize
();
GetScreen
()
->
Init
();
GetScreen
()
->
SetGrid
(
gridsize
);
// preserve grid size accross call to InitDataPoints()
// wxRealPoint gridsize = GetScreen()->GetGridSize();
GetScreen
()
->
InitDataPoints
(
GetPageSizeIU
()
);
// GetScreen()->SetGrid( gridsize );
GetBoard
()
->
ResetHighLight
();
// 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
GetBoard
()
->
SetCopperLayerCount
(
2
);
GetBoard
()
->
SetCopperLayerCount
(
2
);
// Update display:
GetBoard
()
->
SetVisibleLayers
(
ALL_LAYERS
);
...
...
@@ -91,15 +92,15 @@ bool FOOTPRINT_EDIT_FRAME::Clear_Pcb( bool aQuery )
// Delete the current footprint
GetBoard
()
->
m_Modules
.
DeleteAll
();
/
* init pointeurs et variables */
/
/ init pointeurs et variables
GetScreen
()
->
GetFileName
().
Empty
();
SetCurItem
(
NULL
);
/
* Init parametres de gestion */
wxRealPoint
gridsize
=
GetScreen
()
->
GetGridSize
();
GetScreen
()
->
Init
(
);
GetScreen
()
->
SetGrid
(
gridsize
);
/
/ preserve grid size accross call to InitDataPoints()
//
wxRealPoint gridsize = GetScreen()->GetGridSize();
GetScreen
()
->
Init
DataPoints
(
GetPageSizeIU
()
);
//
GetScreen()->SetGrid( gridsize );
Zoom_Automatique
(
false
);
...
...
pcbnew/io_mgr.h
View file @
0d459865
...
...
@@ -119,6 +119,8 @@ public:
* implementation knows about, or it can be used to write a portion of
* 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 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 )
EDA_ITEM
*
PtStruct
=
GetBoard
()
->
m_Modules
;
int
NbModules
,
NbDrawItem
,
NbLayers
;
/
* Write copper layer count */
/
/ Write copper layer count
NbLayers
=
GetBoard
()
->
GetCopperLayerCount
();
fprintf
(
File
,
"$GENERAL
\n
"
);
fprintf
(
File
,
"encoding utf-8
\n
"
);
...
...
@@ -801,7 +801,7 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
fprintf
(
File
,
"Links %d
\n
"
,
GetBoard
()
->
GetRatsnestsCount
()
);
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
();
fprintf
(
File
,
"Di %d %d %d %d
\n
"
,
bbbox
.
GetX
(),
...
...
@@ -809,8 +809,8 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
bbbox
.
GetRight
(),
bbbox
.
GetBottom
()
);
/
* Write segment count for footprints, drawings, track and zones */
/
* Calculate the footprint count */
/
/ Write segment count for footprints, drawings, track and zones
/
/ Calculate the footprint count
for
(
NbModules
=
0
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Next
()
)
NbModules
++
;
...
...
@@ -836,13 +836,14 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
* @param screen BASE_SCREEN to save
* @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
,
"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
,
"Date %s
\n
"
,
EscapedUTF8
(
screen
->
m_Date
).
c_str
()
);
fprintf
(
File
,
"Rev %s
\n
"
,
EscapedUTF8
(
screen
->
m_Revision
).
c_str
()
);
...
...
@@ -859,7 +860,7 @@ bool WriteSheetDescr( BASE_SCREEN* screen, FILE* File )
#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
*
text
;
...
...
@@ -873,32 +874,41 @@ static bool ReadSheetDescr( BASE_SCREEN* screen, LINE_READER* aReader )
if
(
strnicmp
(
line
,
"Sheet"
,
4
)
==
0
)
{
text
=
strtok
(
line
,
"
\t\n\r
"
);
text
=
strtok
(
NULL
,
"
\t\n\r
"
);
Ki_PageDescr
*
sheet
=
g_SheetSizeList
[
0
];
int
ii
;
// e.g. "Sheet A3 16535 11700"
// width and height are in 1/1000th of an inch, always
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
;
if
(
sheet
==
&
g_Sheet_user
)
{
text
=
strtok
(
NULL
,
"
\t\n\r
"
);
m_error
.
Printf
(
_
(
"Unknown sheet type '%s' on line:%d"
),
wname
.
GetData
(),
m_reader
->
LineNumber
()
);
THROW_IO_ERROR
(
m_error
);
}
if
(
text
)
sheet
->
m_Size
.
x
=
atoi
(
text
);
// only parse the width and height if page size is "User"
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
)
sheet
->
m_Size
.
y
=
atoi
(
text
);
page
.
SetWidthInches
(
w
/
1000.0
);
page
.
SetHeightInches
(
h
/
1000.0
);
}
break
;
}
aBoard
->
SetPageSettings
(
page
);
}
continue
;
...
...
@@ -1098,7 +1108,7 @@ int PCB_EDIT_FRAME::ReadPcbFile( LINE_READER* aReader, bool Append )
if
(
TESTLINE
(
"SHEETDESCR"
)
)
{
ReadSheetDescr
(
GetScreen
(),
aReader
);
ReadSheetDescr
(
board
,
GetScreen
(),
aReader
);
continue
;
}
...
...
@@ -1162,7 +1172,7 @@ int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile )
// like 1.3)
LOCALE_IO
toggle
;
/
* Writing file header. */
/
/ Writing file header.
fprintf
(
aFile
,
"PCBNEW-BOARD Version %d date %s
\n\n
"
,
BOARD_FILE_VERSION
,
TO_UTF8
(
DateAndTime
()
)
);
fprintf
(
aFile
,
"# Created by Pcbnew%s
\n\n
"
,
TO_UTF8
(
GetBuildVersion
()
)
);
...
...
@@ -1174,7 +1184,7 @@ int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile )
GetBoard
()
->
SetCurrentNetClass
(
GetBoard
()
->
m_NetClasses
.
GetDefault
()
->
GetName
()
);
WriteGeneralDescrPcb
(
aFile
);
WriteSheetDescr
(
GetScreen
(),
aFile
);
WriteSheetDescr
(
Get
Board
()
->
GetPageSettings
(),
Get
Screen
(),
aFile
);
WriteSetup
(
aFile
,
this
,
GetBoard
()
);
rc
=
GetBoard
()
->
Save
(
aFile
);
...
...
pcbnew/kicad_plugin.cpp
View file @
0d459865
...
...
@@ -98,7 +98,7 @@
/// 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
/// 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
#define SZ( x ) (sizeof(x)-1)
...
...
@@ -440,7 +440,6 @@ void KICAD_PLUGIN::loadGENERAL()
void
KICAD_PLUGIN
::
loadSHEET
()
{
char
buf
[
260
];
char
*
text
;
while
(
READLINE
()
)
{
...
...
@@ -448,33 +447,41 @@ void KICAD_PLUGIN::loadSHEET()
if
(
TESTLINE
(
"Sheet"
)
)
{
text
=
strtok
(
line
,
delims
);
text
=
strtok
(
NULL
,
delims
);
// e.g. "Sheet A3 16535 11700"
// 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
)
)
wxString
wname
=
FROM_UTF8
(
sname
);
if
(
!
page
.
SetType
(
wname
)
)
{
// @todo screen->m_CurrentSheetDesc = sheet;
if
(
sheet
==
&
g_Sheet_user
)
{
text
=
strtok
(
NULL
,
delims
);
m_error
.
Printf
(
_
(
"Unknown sheet type '%s' on line:%d"
),
wname
.
GetData
(),
m_reader
->
LineNumber
()
);
THROW_IO_ERROR
(
m_error
);
}
if
(
text
)
sheet
->
m_Size
.
x
=
intParse
(
text
);
// only parse the width and height if page size is "User"
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
)
sheet
->
m_Size
.
y
=
intParse
(
text
);
page
.
SetWidthInches
(
w
/
1000.0
);
page
.
SetHeightInches
(
h
/
1000.0
);
}
break
;
}
m_board
->
SetPageSettings
(
page
);
}
}
...
...
@@ -2727,14 +2734,17 @@ void KICAD_PLUGIN::saveGENERAL() 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
Ki_PageDescr* sheet = screen->m_CurrentSheetDesc;
const
PAGE_INFO
&
pageInfo
=
m_board
->
GetPageSettings
();
fprintf
(
m_fp
,
"$SHEETDESCR
\n
"
);
fprintf( m_fp, "Sheet %s %d %d\n",
TO_UTF8( sheet->m_Name ), sheet->m_Size.x, sheet->m_Size.y ); // in mm ?
// paper is described in mils
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, "Date %s\n", EscapedUTF8( screen->m_Date ).c_str() );
fprintf( m_fp, "Rev %s\n", EscapedUTF8( screen->m_Revision ).c_str() );
...
...
@@ -2744,8 +2754,9 @@ void KICAD_PLUGIN::saveSHEET() const
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, "$EndSHEETDESCR\n\n" );
#endif
fprintf
(
m_fp
,
"$EndSHEETDESCR
\n\n
"
);
}
...
...
@@ -3077,26 +3088,29 @@ void KICAD_PLUGIN::savePAD( const D_PAD* me ) const
THROW_IO_ERROR
(
wxString
::
Format
(
UNKNOWN_PAD_FORMAT
,
me
->
GetShape
()
)
);
}
// universal character set padname
wxString
padname
=
me
->
GetPadName
();
#if BOARD_FORMAT_VERSION == 1
#if BOARD_FORMAT_VERSION == 1 // saving mode is a compile time option
char
mypadname
[
PADNAMEZ
+
1
];
wxString
wpadname
=
me
->
GetPadName
();
// universal character set padname
std
::
string
spadname
;
int
i
;
for
(
i
=
0
;
i
<
PADNAMEZ
&&
padname
[
i
];
++
i
)
for
(
unsigned
i
=
0
;
wpadname
.
size
();
++
i
)
{
// truncate from universal character down to 8 bit foreign jibber jabber byte
mypadname
[
i
]
=
(
char
)
padname
[
i
];
// truncate from universal character down to 8 bit foreign jibber
// 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
"
,
mypadname
,
// probably ASCII, but possibly jibber jabber
spadname
.
c_str
(),
// probably ASCII, but possibly jibber jabber
#else
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
(),
#endif
cshape
,
...
...
pcbnew/minimun_spanning_tree.h
View file @
0d459865
...
...
@@ -70,7 +70,7 @@ private:
* updates d so that the values are correct (goes through target's
* neighbours making sure that the distances between them and the tree
* are indeed minimum)
* @param
t
arget = index of curr item
* @param
aT
arget = index of curr item
*/
void
updateDistances
(
int
aTarget
);
...
...
pcbnew/plotdxf.cpp
View file @
0d459865
...
...
@@ -18,7 +18,7 @@
bool
PCB_BASE_FRAME
::
ExportToDxfFile
(
const
wxString
&
aFullFileName
,
int
aLayer
,
GRTraceMode
aTraceMode
)
{
Ki_PageDescr
*
currentsheet
=
GetScreen
()
->
m_CurrentSheetDesc
;
LOCALE_IO
toggle
;
FILE
*
output_file
=
wxFopen
(
aFullFileName
,
wxT
(
"wt"
)
);
...
...
@@ -27,10 +27,8 @@ bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
return
false
;
}
SetLocaleTo_C_standard
();
DXF_PLOTTER
*
plotter
=
new
DXF_PLOTTER
();
plotter
->
set_paper_size
(
currentsheet
);
plotter
->
SetPageSettings
(
GetPageSettings
()
);
plotter
->
set_viewport
(
wxPoint
(
0
,
0
),
1
,
0
);
plotter
->
set_creator
(
wxT
(
"PCBNEW-DXF"
)
);
plotter
->
set_filename
(
aFullFileName
);
...
...
@@ -42,7 +40,5 @@ bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
Plot_Layer
(
plotter
,
aLayer
,
aTraceMode
);
plotter
->
end_plot
();
delete
plotter
;
SetLocaleTo_Default
();
return
true
;
}
pcbnew/plothpgl.cpp
View file @
0d459865
...
...
@@ -20,15 +20,14 @@
bool
PCB_BASE_FRAME
::
ExportToHpglFile
(
const
wxString
&
aFullFileName
,
int
aLayer
,
GRTraceMode
aTraceMode
)
{
wxSize
SheetSize
;
wxSize
BoardSize
;
wxPoint
BoardCenter
;
bool
Center
=
false
;
Ki_PageDescr
*
currentsheet
=
GetScreen
()
->
m_CurrentSheetDesc
;
double
scale
;
wxPoint
offset
;
wxSize
boardSize
;
wxPoint
boardCenter
;
bool
center
=
false
;
double
scale
;
wxPoint
offset
;
LOCALE_IO
toggle
;
FILE
*
output_file
=
wxFopen
(
aFullFileName
,
wxT
(
"wt"
)
);
FILE
*
output_file
=
wxFopen
(
aFullFileName
,
wxT
(
"wt"
)
);
if
(
output_file
==
NULL
)
{
...
...
@@ -52,29 +51,26 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
g_PcbPlotOptions
.
m_PlotScale
);
SetLocaleTo_C_standard
();
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.
SheetSize
.
x
=
currentsheet
->
m_Size
.
x
*
U_PCB
;
SheetSize
.
y
=
currentsheet
->
m_Size
.
y
*
U_PCB
;
wxSize
pageSizeIU
=
GetPageSizeIU
();
// Calculate the center of the PCB
EDA_RECT
bbbox
=
GetBoardBoundingBox
();
B
oardSize
=
bbbox
.
GetSize
();
B
oardCenter
=
bbbox
.
Centre
();
b
oardSize
=
bbbox
.
GetSize
();
b
oardCenter
=
bbbox
.
Centre
();
if
(
g_PcbPlotOptions
.
m_AutoScale
)
// Optimum scale
{
double
Xscale
,
Yscale
;
// Fit to 80% of the page
Xscale
=
(
(
SheetSize
.
x
*
0.8
)
/
B
oardSize
.
x
);
Yscale
=
(
(
SheetSize
.
y
*
0.8
)
/
B
oardSize
.
y
);
double
Xscale
=
(
(
pageSizeIU
.
x
*
0.8
)
/
b
oardSize
.
x
);
double
Yscale
=
(
(
pageSizeIU
.
y
*
0.8
)
/
b
oardSize
.
y
);
scale
=
MIN
(
Xscale
,
Yscale
);
}
else
...
...
@@ -83,12 +79,12 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
}
// Calculate the page size offset.
if
(
C
enter
)
if
(
c
enter
)
{
offset
.
x
=
wxRound
(
(
double
)
B
oardCenter
.
x
-
(
(
double
)
SheetSize
.
x
/
2.0
)
/
scale
);
offset
.
y
=
wxRound
(
(
double
)
B
oardCenter
.
y
-
(
(
double
)
SheetSize
.
y
/
2.0
)
/
scale
);
offset
.
x
=
wxRound
(
(
double
)
b
oardCenter
.
x
-
(
(
double
)
pageSizeIU
.
x
/
2.0
)
/
scale
);
offset
.
y
=
wxRound
(
(
double
)
b
oardCenter
.
y
-
(
(
double
)
pageSizeIU
.
y
/
2.0
)
/
scale
);
}
else
{
...
...
@@ -97,7 +93,9 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
}
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_default_line_width
(
g_PcbPlotOptions
.
m_PlotLineWidth
);
plotter
->
set_creator
(
wxT
(
"PCBNEW-HPGL"
)
);
...
...
@@ -108,14 +106,13 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
plotter
->
set_pen_diameter
(
pen_diam
);
plotter
->
start_plot
(
output_file
);
/
* The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway */
if
(
g_PcbPlotOptions
.
m_PlotFrameRef
&&
!
C
enter
)
/
/ The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway
if
(
g_PcbPlotOptions
.
m_PlotFrameRef
&&
!
c
enter
)
PlotWorkSheet
(
plotter
,
GetScreen
()
);
Plot_Layer
(
plotter
,
aLayer
,
aTraceMode
);
plotter
->
end_plot
();
delete
plotter
;
SetLocaleTo_Default
();
return
true
;
}
pcbnew/plotps.cpp
View file @
0d459865
...
...
@@ -24,15 +24,19 @@
bool
PCB_BASE_FRAME
::
ExportToPostScriptFile
(
const
wxString
&
aFullFileName
,
int
aLayer
,
bool
aUseA4
,
GRTraceMode
aTraceMode
)
{
wxSize
SheetSize
;
wxSize
PaperSize
;
wxSize
BoardSize
;
wxPoint
BoardCenter
;
bool
Center
=
false
;
Ki_PageDescr
*
currentsheet
=
GetScreen
()
->
m_CurrentSheetDesc
;
double
scale
,
paperscale
;
Ki_PageDescr
*
SheetPS
;
wxPoint
offset
;
const
PAGE_INFO
&
pageInfo
=
GetPageSettings
();
wxSize
paperSizeIU
;
wxSize
boardSize
;
wxPoint
boardCenter
;
bool
center
=
false
;
double
scale
;
double
paperscale
;
wxPoint
offset
;
LOCALE_IO
toggle
;
PAGE_INFO
pageA4
(
wxT
(
"A4"
)
);
const
PAGE_INFO
*
sheetPS
;
FILE
*
output_file
=
wxFopen
(
aFullFileName
,
wxT
(
"wt"
)
);
...
...
@@ -41,45 +45,43 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
return
false
;
}
SetLocaleTo_C_standard
();
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
if
(
g_PcbPlotOptions
.
m_PlotLineWidth
<
1
)
g_PcbPlotOptions
.
m_PlotLineWidth
=
1
;
SheetSize
.
x
=
currentsheet
->
m_Size
.
x
*
U_PCB
;
SheetSize
.
y
=
currentsheet
->
m_Size
.
y
*
U_PCB
;
wxSize
pageSizeIU
=
GetPageSizeIU
();
if
(
aUseA4
)
{
SheetPS
=
&
g_Sheet_A4
;
PaperSize
.
x
=
g_Sheet_A4
.
m_Size
.
x
*
U_PCB
;
PaperSize
.
y
=
g_Sheet_A4
.
m_Size
.
y
*
U_PCB
;
paperscale
=
(
float
)
PaperSize
.
x
/
SheetSize
.
x
;
sheetPS
=
&
pageA4
;
paperSizeIU
=
pageA4
.
GetSizeIU
();
paperscale
=
(
double
)
paperSizeIU
.
x
/
pageSizeIU
.
x
;
}
else
{
SheetPS
=
currentsheet
;
PaperSize
=
SheetSize
;
sheetPS
=
&
pageInfo
;
paperSizeIU
=
pageSizeIU
;
paperscale
=
1
;
}
EDA_RECT
bbbox
=
GetBoardBoundingBox
();
B
oardSize
=
bbbox
.
GetSize
();
B
oardCenter
=
bbbox
.
Centre
();
b
oardSize
=
bbbox
.
GetSize
();
b
oardCenter
=
bbbox
.
Centre
();
if
(
g_PcbPlotOptions
.
m_AutoScale
)
// Optimum scale
{
double
Xscale
,
Yscale
;
// Fit to 80% of the page
Xscale
=
(
PaperSize
.
x
*
0.8
)
/
BoardSize
.
x
;
Yscale
=
(
PaperSize
.
y
*
0.8
)
/
BoardSize
.
y
;
double
Xscale
=
(
paperSizeIU
.
x
*
0.8
)
/
boardSize
.
x
;
double
Yscale
=
(
paperSizeIU
.
y
*
0.8
)
/
boardSize
.
y
;
scale
=
MIN
(
Xscale
,
Yscale
);
}
else
...
...
@@ -87,10 +89,10 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
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
.
y
=
wxRound
(
(
double
)
BoardCenter
.
y
-
(
(
double
)
PaperSize
.
y
/
2.0
)
/
scale
);
offset
.
x
=
wxRound
(
(
double
)
boardCenter
.
x
-
(
(
double
)
paperSizeIU
.
x
/
2.0
)
/
scale
);
offset
.
y
=
wxRound
(
(
double
)
boardCenter
.
y
-
(
(
double
)
paperSizeIU
.
y
/
2.0
)
/
scale
);
}
else
{
...
...
@@ -99,7 +101,9 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
}
PS_PLOTTER
*
plotter
=
new
PS_PLOTTER
();
plotter
->
set_paper_size
(
SheetPS
);
plotter
->
SetPageSettings
(
*
sheetPS
);
plotter
->
set_scale_adjust
(
g_PcbPlotOptions
.
m_FineScaleAdjustX
,
g_PcbPlotOptions
.
m_FineScaleAdjustY
);
plotter
->
set_viewport
(
offset
,
scale
,
g_PcbPlotOptions
.
m_PlotMirror
);
...
...
@@ -109,7 +113,7 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
plotter
->
start_plot
(
output_file
);
/* 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
()
);
// If plot a negative board:
...
...
@@ -131,7 +135,6 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
Plot_Layer
(
plotter
,
aLayer
,
aTraceMode
);
plotter
->
end_plot
();
delete
plotter
;
SetLocaleTo_Default
();
return
true
;
}
pcbnew/print_board_functions.cpp
View file @
0d459865
...
...
@@ -31,11 +31,10 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
bool
aPrintMirrorMode
,
void
*
aData
)
{
MODULE
*
Module
;
int
drawmode
=
GR_COPY
;
DISPLAY_OPTIONS
save_opt
;
BOARD
*
Pcb
=
GetBoard
();
int
defaultPenSize
=
50
;
int
drawmode
=
GR_COPY
;
int
defaultPenSize
=
50
;
DISPLAY_OPTIONS
save_opt
;
PRINT_PARAMETERS
*
printParameters
=
(
PRINT_PARAMETERS
*
)
aData
;
// can be null
PRINT_PARAMETERS
::
DrillShapeOptT
drillShapeOpt
=
PRINT_PARAMETERS
::
FULL_DRILL_SHAPE
;
...
...
@@ -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
// white (or g_DrawBgColor) after the tracks and zones
Module
=
(
MODULE
*
)
Pcb
->
m_Modules
;
int
tmp
=
D_PAD
::
m_PadSketchModePenSize
;
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
);
Print_Module
(
DrawPanel
,
aDC
,
M
odule
,
drawmode
,
aPrintMaskLayer
,
drillShapeOpt
);
M
odule
->
Move
(
-
offset
);
m
odule
->
Move
(
offset
);
Print_Module
(
DrawPanel
,
aDC
,
m
odule
,
drawmode
,
aPrintMaskLayer
,
drillShapeOpt
);
m
odule
->
Move
(
-
offset
);
}
D_PAD
::
m_PadSketchModePenSize
=
tmp
;
...
...
@@ -100,7 +95,7 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
m_DisplayPadFill
=
DisplayOpt
.
DisplayPadFill
;
m_DisplayViaFill
=
DisplayOpt
.
DisplayViaFill
;
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()
{
int
tmpzoom
;
wxPoint
tmp_startvisu
;
wxSize
SheetSize
;
// Page size in internal units
wxPoint
old_org
;
wxPoint
DrawOffset
;
// Offset de trace
wxPoint
DrawOffset
;
// Offset de trace
double
userscale
;
double
DrawZoom
=
1
;
wxDC
*
dc
=
GetDC
();
...
...
@@ -153,65 +152,68 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
wxBusyCursor
dummy
;
/
* Save old draw scale and draw offset */
/
/ Save old draw scale and draw offset
tmp_startvisu
=
screen
->
m_StartVisu
;
tmpzoom
=
screen
->
GetZoom
();
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
->
m_DrawOrg
.
x
=
screen
->
m_DrawOrg
.
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
;
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
// 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:
if
(
m_Parent
->
IsType
(
MODULE_EDITOR_FRAME
)
)
{
wxPoint
mv_offset
;
mv_offset
.
x
=
SheetSize
.
x
/
2
;
mv_offset
.
y
=
SheetSize
.
y
/
2
;
brd_BBox
.
Move
(
mv_offset
);
bbbox
.
Move
(
wxPoint
(
pageSizeIU
.
x
/
2
,
pageSizeIU
.
y
/
2
)
);
}
/
* Compute the PCB size in internal units*/
/
/ Compute the PCB size in internal units
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
SheetSize
.
x
=
brd_BBox
.
GetWidth
()
+
extra_margin
;
SheetSize
.
y
=
brd_BBox
.
GetHeight
()
+
extra_margin
;
// Margin = 0.4 inch
#if defined(KICAD_NANOMETRE)
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
;
}
if
(
(
m_PrintParams
.
m_PrintScale
>
1.0
)
// scale > 1 -> Recadrage
||
(
m_PrintParams
.
m_PrintScale
==
0
)
)
// fit in page
{
DrawOffset
+=
b
rd_BB
ox
.
Centre
();
DrawOffset
+=
b
bb
ox
.
Centre
();
}
if
(
m_PrintParams
.
m_PageSetupData
)
{
wxSize
pagesize
;
pagesize
.
x
=
(
int
)
(
SheetSize
.
x
/
userscale
);
pagesize
.
y
=
(
int
)
(
SheetSize
.
y
/
userscale
);
FitThisSizeToPageMargins
(
pagesize
,
*
m_PrintParams
.
m_PageSetupData
);
pagesize
.
x
=
int
(
pageSizeIU
.
x
/
userscale
);
pagesize
.
y
=
int
(
pageSizeIU
.
y
/
userscale
);
FitThisSizeToPageMargins
(
pagesize
,
*
m_PrintParams
.
m_PageSetupData
);
}
// Compute Accurate scale 1
if
(
userscale
==
1.0
)
{
// We want a 1:1 scale and margins for printing
MapScreenSizeToPaper
(
);
MapScreenSizeToPaper
();
int
w
,
h
;
GetPPIPrinter
(
&
w
,
&
h
);
double
accurate_Xscale
=
(
(
double
)
(
DrawZoom
*
w
)
)
/
(
double
)
PCB_INTERNAL_UNIT
;
...
...
@@ -263,7 +265,6 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
if
(
m_PrintParams
.
m_Print_Black_and_White
)
GRForceBlackPen
(
true
);
EDA_DRAW_PANEL
*
panel
=
m_Parent
->
DrawPanel
;
EDA_RECT
tmp
=
panel
->
m_ClipBox
;
...
...
@@ -303,7 +304,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
* for scales > 1, the DrawOffset was already computed to have the board centre
* 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
)
DrawOffset
.
y
+=
pcb_centre
.
y
-
(
ysize
/
2
);
...
...
pcbnew/printout_controler.h
View file @
0d459865
...
...
@@ -52,8 +52,8 @@ public:
class
BOARD_PRINTOUT_CONTROLER
:
public
wxPrintout
{
private
:
EDA_DRAW_FRAME
*
m_Parent
;
PRINT_PARAMETERS
m_PrintParams
;
EDA_DRAW_FRAME
*
m_Parent
;
PRINT_PARAMETERS
m_PrintParams
;
public
:
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