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
e066b91c
Commit
e066b91c
authored
Apr 21, 2010
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pcbnew+gerbview: fixed some issues in printing dialog
parent
85604886
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
70 additions
and
62 deletions
+70
-62
dialog_print_using_printer.cpp
gerbview/dialog_print_using_printer.cpp
+19
-13
dialog_print_using_printer_base.cpp
gerbview/dialog_print_using_printer_base.cpp
+2
-2
dialog_print_using_printer_base.fbp
gerbview/dialog_print_using_printer_base.fbp
+1
-1
dialog_print_using_printer_base.h
gerbview/dialog_print_using_printer_base.h
+1
-1
dialog_print_using_printer.cpp
pcbnew/dialog_print_using_printer.cpp
+16
-10
printout_controler.cpp
pcbnew/printout_controler.cpp
+30
-35
printout_controler.h
pcbnew/printout_controler.h
+1
-0
No files found.
gerbview/dialog_print_using_printer.cpp
View file @
e066b91c
...
@@ -34,6 +34,7 @@ static double s_ScaleList[] =
...
@@ -34,6 +34,7 @@ static double s_ScaleList[] =
// static print data and page setup data, to remember settings during the session
// static print data and page setup data, to remember settings during the session
static
wxPrintData
*
g_PrintData
;
static
wxPrintData
*
g_PrintData
;
static
wxPageSetupDialogData
*
g_pageSetupData
=
(
wxPageSetupDialogData
*
)
NULL
;
// Variables locales
// Variables locales
static
PRINT_PARAMETERS
s_Parameters
;
static
PRINT_PARAMETERS
s_Parameters
;
...
@@ -58,7 +59,7 @@ public:
...
@@ -58,7 +59,7 @@ public:
private
:
private
:
void
OnCloseWindow
(
wxCloseEvent
&
event
);
void
OnCloseWindow
(
wxCloseEvent
&
event
);
void
OnInitDialog
(
wxInitDialogEvent
&
event
);
void
OnInitDialog
(
wxInitDialogEvent
&
event
);
void
OnP
rint
Setup
(
wxCommandEvent
&
event
);
void
OnP
age
Setup
(
wxCommandEvent
&
event
);
void
OnPrintPreview
(
wxCommandEvent
&
event
);
void
OnPrintPreview
(
wxCommandEvent
&
event
);
void
OnPrintButtonClick
(
wxCommandEvent
&
event
);
void
OnPrintButtonClick
(
wxCommandEvent
&
event
);
...
@@ -130,8 +131,18 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
...
@@ -130,8 +131,18 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
int
layer_max
=
NB_LAYERS
;
int
layer_max
=
NB_LAYERS
;
wxString
msg
;
wxString
msg
;
layer_max
=
32
;
if
(
g_pageSetupData
==
NULL
)
{
g_pageSetupData
=
new
wxPageSetupDialogData
;
// Set initial page margins.
// Margins are already set in Pcbnew, so we cans use 0
g_pageSetupData
->
SetMarginTopLeft
(
wxPoint
(
0
,
0
));
g_pageSetupData
->
SetMarginBottomRight
(
wxPoint
(
0
,
0
));
}
s_Parameters
.
m_PageSetupData
=
g_pageSetupData
;
layer_max
=
32
;
/* Create layer list */
/* Create layer list */
int
mask
=
1
,
ii
;
int
mask
=
1
,
ii
;
for
(
ii
=
0
;
ii
<
layer_max
;
ii
++
,
mask
<<=
1
)
for
(
ii
=
0
;
ii
<
layer_max
;
ii
++
,
mask
<<=
1
)
...
@@ -326,24 +337,19 @@ void DIALOG_PRINT_USING_PRINTER::SetPrintParameters( )
...
@@ -326,24 +337,19 @@ void DIALOG_PRINT_USING_PRINTER::SetPrintParameters( )
}
}
/**********************************************************/
/**********************************************************/
void
DIALOG_PRINT_USING_PRINTER
::
OnP
rint
Setup
(
wxCommandEvent
&
event
)
void
DIALOG_PRINT_USING_PRINTER
::
OnP
age
Setup
(
wxCommandEvent
&
event
)
/**********************************************************/
/**********************************************************/
/* Open a dialog box for printer setup (printer options, page size ...)
/* Open a dialog box for printer setup (printer options, page size ...)
*/
*/
{
{
wxPrintDialogData
printDialogData
(
*
g_PrintData
);
*
g_pageSetupData
=
*
g_PrintData
;
if
(
printDialogData
.
Ok
()
)
{
wxPrintDialog
printerDialog
(
this
,
&
printDialogData
);
printerDialog
.
ShowModal
();
wxPageSetupDialog
pageSetupDialog
(
this
,
g_pageSetupData
);
pageSetupDialog
.
ShowModal
();
*
g_PrintData
=
printerDialog
.
GetPrintDialogData
().
GetPrintData
();
(
*
g_PrintData
)
=
pageSetupDialog
.
GetPageSetupDialogData
().
GetPrintData
();
}
(
*
g_pageSetupData
)
=
pageSetupDialog
.
GetPageSetupDialogData
();
else
DisplayError
(
this
,
_
(
"Printer Problem!"
)
);
}
}
...
...
gerbview/dialog_print_using_printer_base.cpp
View file @
e066b91c
...
@@ -113,7 +113,7 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
...
@@ -113,7 +113,7 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
// Connect Events
// Connect Events
this
->
Connect
(
wxEVT_CLOSE_WINDOW
,
wxCloseEventHandler
(
DIALOG_PRINT_USING_PRINTER_base
::
OnCloseWindow
)
);
this
->
Connect
(
wxEVT_CLOSE_WINDOW
,
wxCloseEventHandler
(
DIALOG_PRINT_USING_PRINTER_base
::
OnCloseWindow
)
);
m_buttonOption
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_USING_PRINTER_base
::
OnP
rint
Setup
),
NULL
,
this
);
m_buttonOption
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_USING_PRINTER_base
::
OnP
age
Setup
),
NULL
,
this
);
m_buttonPreview
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_USING_PRINTER_base
::
OnPrintPreview
),
NULL
,
this
);
m_buttonPreview
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_USING_PRINTER_base
::
OnPrintPreview
),
NULL
,
this
);
m_buttonPrint
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_USING_PRINTER_base
::
OnPrintButtonClick
),
NULL
,
this
);
m_buttonPrint
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_USING_PRINTER_base
::
OnPrintButtonClick
),
NULL
,
this
);
m_buttonQuit
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_USING_PRINTER_base
::
OnButtonCancelClick
),
NULL
,
this
);
m_buttonQuit
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_USING_PRINTER_base
::
OnButtonCancelClick
),
NULL
,
this
);
...
@@ -123,7 +123,7 @@ DIALOG_PRINT_USING_PRINTER_base::~DIALOG_PRINT_USING_PRINTER_base()
...
@@ -123,7 +123,7 @@ DIALOG_PRINT_USING_PRINTER_base::~DIALOG_PRINT_USING_PRINTER_base()
{
{
// Disconnect Events
// Disconnect Events
this
->
Disconnect
(
wxEVT_CLOSE_WINDOW
,
wxCloseEventHandler
(
DIALOG_PRINT_USING_PRINTER_base
::
OnCloseWindow
)
);
this
->
Disconnect
(
wxEVT_CLOSE_WINDOW
,
wxCloseEventHandler
(
DIALOG_PRINT_USING_PRINTER_base
::
OnCloseWindow
)
);
m_buttonOption
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_USING_PRINTER_base
::
OnP
rint
Setup
),
NULL
,
this
);
m_buttonOption
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_USING_PRINTER_base
::
OnP
age
Setup
),
NULL
,
this
);
m_buttonPreview
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_USING_PRINTER_base
::
OnPrintPreview
),
NULL
,
this
);
m_buttonPreview
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_USING_PRINTER_base
::
OnPrintPreview
),
NULL
,
this
);
m_buttonPrint
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_USING_PRINTER_base
::
OnPrintButtonClick
),
NULL
,
this
);
m_buttonPrint
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_USING_PRINTER_base
::
OnPrintButtonClick
),
NULL
,
this
);
m_buttonQuit
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_USING_PRINTER_base
::
OnButtonCancelClick
),
NULL
,
this
);
m_buttonQuit
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_USING_PRINTER_base
::
OnButtonCancelClick
),
NULL
,
this
);
...
...
gerbview/dialog_print_using_printer_base.fbp
View file @
e066b91c
...
@@ -625,7 +625,7 @@
...
@@ -625,7 +625,7 @@
<property
name=
"window_extra_style"
></property>
<property
name=
"window_extra_style"
></property>
<property
name=
"window_name"
></property>
<property
name=
"window_name"
></property>
<property
name=
"window_style"
></property>
<property
name=
"window_style"
></property>
<event
name=
"OnButtonClick"
>
OnP
rint
Setup
</event>
<event
name=
"OnButtonClick"
>
OnP
age
Setup
</event>
<event
name=
"OnChar"
></event>
<event
name=
"OnChar"
></event>
<event
name=
"OnEnterWindow"
></event>
<event
name=
"OnEnterWindow"
></event>
<event
name=
"OnEraseBackground"
></event>
<event
name=
"OnEraseBackground"
></event>
...
...
gerbview/dialog_print_using_printer_base.h
View file @
e066b91c
...
@@ -59,7 +59,7 @@ class DIALOG_PRINT_USING_PRINTER_base : public wxDialog
...
@@ -59,7 +59,7 @@ class DIALOG_PRINT_USING_PRINTER_base : public wxDialog
// Virtual event handlers, overide them in your derived class
// Virtual event handlers, overide them in your derived class
virtual
void
OnCloseWindow
(
wxCloseEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnCloseWindow
(
wxCloseEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnP
rint
Setup
(
wxCommandEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnP
age
Setup
(
wxCommandEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnPrintPreview
(
wxCommandEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnPrintPreview
(
wxCommandEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnPrintButtonClick
(
wxCommandEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnPrintButtonClick
(
wxCommandEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnButtonCancelClick
(
wxCommandEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnButtonCancelClick
(
wxCommandEvent
&
event
){
event
.
Skip
();
}
...
...
pcbnew/dialog_print_using_printer.cpp
View file @
e066b91c
...
@@ -36,6 +36,7 @@ static double s_ScaleList[] =
...
@@ -36,6 +36,7 @@ static double s_ScaleList[] =
// static print data and page setup data, to remember settings during the session
// static print data and page setup data, to remember settings during the session
static
wxPrintData
*
g_PrintData
;
static
wxPrintData
*
g_PrintData
;
static
wxPageSetupDialogData
*
g_pageSetupData
=
(
wxPageSetupDialogData
*
)
NULL
;
static
PRINT_PARAMETERS
s_Parameters
;
static
PRINT_PARAMETERS
s_Parameters
;
...
@@ -138,6 +139,16 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
...
@@ -138,6 +139,16 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
int
layer_max
=
NB_LAYERS
;
int
layer_max
=
NB_LAYERS
;
wxString
msg
;
wxString
msg
;
BOARD
*
board
=
m_Parent
->
GetBoard
();
BOARD
*
board
=
m_Parent
->
GetBoard
();
if
(
g_pageSetupData
==
NULL
)
{
g_pageSetupData
=
new
wxPageSetupDialogData
;
// Set initial page margins.
// Margins are already set in Pcbnew, so we cans use 0
g_pageSetupData
->
SetMarginTopLeft
(
wxPoint
(
0
,
0
));
g_pageSetupData
->
SetMarginBottomRight
(
wxPoint
(
0
,
0
));
}
s_Parameters
.
m_PageSetupData
=
g_pageSetupData
;
// Create layer list.
// Create layer list.
int
layer
;
int
layer
;
...
@@ -420,18 +431,13 @@ void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event )
...
@@ -420,18 +431,13 @@ void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event )
/* Open a dialog box for printer setup (printer options, page size ...)
/* Open a dialog box for printer setup (printer options, page size ...)
*/
*/
{
{
wxPrintDialogData
printDialogData
(
*
g_PrintData
)
;
*
g_pageSetupData
=
*
g_PrintData
;
if
(
printDialogData
.
Ok
()
)
wxPageSetupDialog
pageSetupDialog
(
this
,
g_pageSetupData
);
{
pageSetupDialog
.
ShowModal
();
wxPrintDialog
printerDialog
(
this
,
&
printDialogData
);
printerDialog
.
ShowModal
();
*
g_PrintData
=
printerDialog
.
GetPrintDialogData
().
GetPrintData
();
(
*
g_PrintData
)
=
pageSetupDialog
.
GetPageSetupDialogData
().
GetPrintData
();
}
(
*
g_pageSetupData
)
=
pageSetupDialog
.
GetPageSetupDialogData
();
else
DisplayError
(
this
,
_
(
"Printer Problem!"
)
);
}
}
...
...
pcbnew/printout_controler.cpp
View file @
e066b91c
...
@@ -32,6 +32,7 @@ PRINT_PARAMETERS::PRINT_PARAMETERS()
...
@@ -32,6 +32,7 @@ PRINT_PARAMETERS::PRINT_PARAMETERS()
m_ForceCentered
=
false
;
m_ForceCentered
=
false
;
m_Flags
=
0
;
m_Flags
=
0
;
m_DrillShapeOpt
=
PRINT_PARAMETERS
::
SMALL_DRILL_SHAPE
;
m_DrillShapeOpt
=
PRINT_PARAMETERS
::
SMALL_DRILL_SHAPE
;
m_PageSetupData
=
NULL
;
}
}
...
@@ -116,10 +117,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
...
@@ -116,10 +117,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
{
{
int
tmpzoom
;
int
tmpzoom
;
wxPoint
tmp_startvisu
;
wxPoint
tmp_startvisu
;
wxSize
PageSize_in_mm
;
wxSize
SheetSize
;
// Page size in internal units
wxSize
SheetSize
;
// Page size in internal units
wxSize
PlotAreaSize
;
// plot area size in pixels
double
scaleX
,
scaleY
,
scale
;
wxPoint
old_org
;
wxPoint
old_org
;
wxPoint
DrawOffset
;
// Offset de trace
wxPoint
DrawOffset
;
// Offset de trace
double
userscale
;
double
userscale
;
...
@@ -130,8 +128,6 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
...
@@ -130,8 +128,6 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
wxBusyCursor
dummy
;
wxBusyCursor
dummy
;
GetPageSizeMM
(
&
PageSize_in_mm
.
x
,
&
PageSize_in_mm
.
y
);
/* Save old draw scale and draw offset */
/* Save old draw scale and draw offset */
tmp_startvisu
=
ActiveScreen
->
m_StartVisu
;
tmp_startvisu
=
ActiveScreen
->
m_StartVisu
;
tmpzoom
=
ActiveScreen
->
GetZoom
();
tmpzoom
=
ActiveScreen
->
GetZoom
();
...
@@ -151,21 +147,19 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
...
@@ -151,21 +147,19 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
SheetSize
.
x
*=
m_Parent
->
m_InternalUnits
/
1000
;
SheetSize
.
x
*=
m_Parent
->
m_InternalUnits
/
1000
;
SheetSize
.
y
*=
m_Parent
->
m_InternalUnits
/
1000
;
// size in pixels
SheetSize
.
y
*=
m_Parent
->
m_InternalUnits
/
1000
;
// size in pixels
// Get the size of the DC in pixels
dc
->
GetSize
(
&
PlotAreaSize
.
x
,
&
PlotAreaSize
.
y
);
WinEDA_BasePcbFrame
*
pcbframe
=
(
WinEDA_BasePcbFrame
*
)
m_Parent
;
WinEDA_BasePcbFrame
*
pcbframe
=
(
WinEDA_BasePcbFrame
*
)
m_Parent
;
pcbframe
->
GetBoard
()
->
ComputeBoundaryBox
();
pcbframe
->
GetBoard
()
->
ComputeBoundaryBox
();
/* Compute the PCB size in internal units*/
/* Compute the PCB size in internal units*/
userscale
=
m_PrintParams
.
m_PrintScale
;
userscale
=
m_PrintParams
.
m_PrintScale
;
if
(
userscale
==
0
)
// fit in page
if
(
userscale
==
0
)
// fit in page
{
{
int
extra_margin
=
0
;
// Margin = 8000/2 units pcb = 0,
4 inch
int
extra_margin
=
4000
*
2
;
// Margin = 4000 units pcb = 0.
4 inch
SheetSize
.
x
=
pcbframe
->
GetBoard
()
->
m_BoundaryBox
.
GetWidth
()
+
extra_margin
;
SheetSize
.
x
=
pcbframe
->
GetBoard
()
->
m_BoundaryBox
.
GetWidth
()
+
extra_margin
;
SheetSize
.
y
=
pcbframe
->
GetBoard
()
->
m_BoundaryBox
.
GetHeight
()
+
extra_margin
;
SheetSize
.
y
=
pcbframe
->
GetBoard
()
->
m_BoundaryBox
.
GetHeight
()
+
extra_margin
;
userscale
=
0.99
;
userscale
=
0.99
;
}
}
if
(
(
m_PrintParams
.
m_PrintScale
>
1.0
)
// scale > 1 -> Recadrage
if
(
(
m_PrintParams
.
m_PrintScale
>
1.0
)
// scale > 1 -> Recadrage
||
(
m_PrintParams
.
m_PrintScale
==
0
)
)
// fit in page
||
(
m_PrintParams
.
m_PrintScale
==
0
)
)
// fit in page
{
{
...
@@ -173,26 +167,28 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
...
@@ -173,26 +167,28 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
DrawOffset
.
y
+=
pcbframe
->
GetBoard
()
->
m_BoundaryBox
.
Centre
().
y
;
DrawOffset
.
y
+=
pcbframe
->
GetBoard
()
->
m_BoundaryBox
.
Centre
().
y
;
}
}
// Calculate a suitable scaling factor
if
(
m_PrintParams
.
m_PageSetupData
)
scaleX
=
(
double
)
SheetSize
.
x
/
(
double
)
PlotAreaSize
.
x
;
{
scaleY
=
(
double
)
SheetSize
.
y
/
(
double
)
PlotAreaSize
.
y
;
wxSize
pagesize
;
scale
=
wxMax
(
scaleX
,
scaleY
)
/
userscale
;
// Use x or y scaling factor, whichever fits on the DC
pagesize
.
x
=
(
int
)
(
SheetSize
.
x
/
userscale
);
pagesize
.
y
=
(
int
)
(
SheetSize
.
y
/
userscale
);
// ajust the real draw scale
FitThisSizeToPageMargins
(
pagesize
,
*
m_PrintParams
.
m_PageSetupData
);
double
accurate_Xscale
,
accurate_Yscale
;
}
dc
->
SetUserScale
(
DrawZoom
/
scale
*
m_PrintParams
.
m_XScaleAdjust
,
DrawZoom
/
scale
*
m_PrintParams
.
m_YScaleAdjust
);
// Compute Accurate scale 1
// Compute Accurate scale 1
if
(
userscale
==
1.0
)
{
{
// We want a 1:1 scale and margins for printing
MapScreenSizeToPaper
(
);
int
w
,
h
;
int
w
,
h
;
GetPPIPrinter
(
&
w
,
&
h
);
GetPPIPrinter
(
&
w
,
&
h
);
accurate_Xscale
=
(
(
double
)
(
DrawZoom
*
w
)
)
/
(
double
)
PCB_INTERNAL_UNIT
;
double
accurate_Xscale
=
(
(
double
)
(
DrawZoom
*
w
)
)
/
(
double
)
PCB_INTERNAL_UNIT
;
accurate_Yscale
=
(
(
double
)
(
DrawZoom
*
h
)
)
/
(
double
)
PCB_INTERNAL_UNIT
;
double
accurate_Yscale
=
(
(
double
)
(
DrawZoom
*
h
)
)
/
(
double
)
PCB_INTERNAL_UNIT
;
if
(
IsPreview
()
)
// Scale must take in account the DC size in Preview
if
(
IsPreview
()
)
// Scale must take in account the DC size in Preview
{
{
// Get the size of the DC in pixels
// Get the size of the DC in pixels
wxSize
PlotAreaSize
;
dc
->
GetSize
(
&
PlotAreaSize
.
x
,
&
PlotAreaSize
.
y
);
dc
->
GetSize
(
&
PlotAreaSize
.
x
,
&
PlotAreaSize
.
y
);
GetPageSizePixels
(
&
w
,
&
h
);
GetPageSizePixels
(
&
w
,
&
h
);
accurate_Xscale
*=
PlotAreaSize
.
x
;
accurate_Xscale
*=
PlotAreaSize
.
x
;
...
@@ -202,8 +198,19 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
...
@@ -202,8 +198,19 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
}
}
accurate_Xscale
*=
m_PrintParams
.
m_XScaleAdjust
;
accurate_Xscale
*=
m_PrintParams
.
m_XScaleAdjust
;
accurate_Yscale
*=
m_PrintParams
.
m_YScaleAdjust
;
accurate_Yscale
*=
m_PrintParams
.
m_YScaleAdjust
;
// Fine scale adjust
dc
->
SetUserScale
(
accurate_Xscale
,
accurate_Yscale
);
}
}
// Get the final size of the DC in pixels
wxSize
PlotAreaSizeInPixels
;
dc
->
GetSize
(
&
PlotAreaSizeInPixels
.
x
,
&
PlotAreaSizeInPixels
.
y
);
double
scalex
,
scaley
;
dc
->
GetUserScale
(
&
scalex
,
&
scaley
);
wxSize
PlotAreaSizeInUserUnits
;
PlotAreaSizeInUserUnits
.
x
=
(
int
)
(
PlotAreaSizeInPixels
.
x
/
scalex
);
PlotAreaSizeInUserUnits
.
y
=
(
int
)
(
PlotAreaSizeInPixels
.
y
/
scaley
);
/* In some cases the plot origin is the centre of the page
/* In some cases the plot origin is the centre of the page
* when:
* when:
* - Asked
* - Asked
...
@@ -214,13 +221,9 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
...
@@ -214,13 +221,9 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
||
(
m_PrintParams
.
m_PrintScale
>
1.0
)
// scale > 1
||
(
m_PrintParams
.
m_PrintScale
>
1.0
)
// scale > 1
||
(
m_PrintParams
.
m_PrintScale
==
0
)
)
// fit in page
||
(
m_PrintParams
.
m_PrintScale
==
0
)
)
// fit in page
{
{
DrawOffset
.
x
-=
wxRound
(
(
(
double
)
PlotAreaSize
.
x
/
2.0
)
*
scale
)
;
DrawOffset
.
x
-=
PlotAreaSizeInUserUnits
.
x
/
2
;
DrawOffset
.
y
-=
wxRound
(
(
(
double
)
PlotAreaSize
.
y
/
2.0
)
*
scale
)
;
DrawOffset
.
y
-=
PlotAreaSizeInUserUnits
.
y
/
2
;
}
}
DrawOffset
.
x
+=
wxRound
(
(
(
double
)
SheetSize
.
x
/
2.0
)
*
(
m_PrintParams
.
m_XScaleAdjust
-
1.0
)
);
DrawOffset
.
y
+=
wxRound
(
(
(
double
)
SheetSize
.
y
/
2.0
)
*
(
m_PrintParams
.
m_YScaleAdjust
-
1.0
)
);
ActiveScreen
->
m_DrawOrg
=
DrawOffset
;
ActiveScreen
->
m_DrawOrg
=
DrawOffset
;
...
@@ -238,14 +241,6 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
...
@@ -238,14 +241,6 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
m_Parent
->
GetBaseScreen
()
->
m_IsPrinting
=
true
;
m_Parent
->
GetBaseScreen
()
->
m_IsPrinting
=
true
;
int
bg_color
=
g_DrawBgColor
;
int
bg_color
=
g_DrawBgColor
;
if
(
userscale
==
1.0
)
{
// We want a 1:1 scale and margins for printing
MapScreenSizeToPaper
(
);
// Fine scale adjust
dc
->
SetUserScale
(
accurate_Xscale
,
accurate_Yscale
);
}
if
(
m_PrintParams
.
m_Print_Sheet_Ref
)
if
(
m_PrintParams
.
m_Print_Sheet_Ref
)
m_Parent
->
TraceWorkSheet
(
dc
,
ActiveScreen
,
m_PrintParams
.
m_PenDefaultSize
);
m_Parent
->
TraceWorkSheet
(
dc
,
ActiveScreen
,
m_PrintParams
.
m_PenDefaultSize
);
...
@@ -263,7 +258,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
...
@@ -263,7 +258,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
* the old draw area in the new draw area, because the draw origin has not moved
* the old draw area in the new draw area, because the draw origin has not moved
* (this is the upper left corner) but the Y axis is reversed, therefore the plotting area
* (this is the upper left corner) but the Y axis is reversed, therefore the plotting area
* is the y coordinate values from - PlotAreaSize.y to 0 */
* is the y coordinate values from - PlotAreaSize.y to 0 */
int
ysize
=
(
int
)
(
PlotAreaSize
.
y
/
sy
);
int
ysize
=
(
int
)
(
PlotAreaSize
InPixels
.
y
/
sy
);
DrawOffset
.
y
+=
ysize
;
DrawOffset
.
y
+=
ysize
;
/* in order to keep the board position in the sheet
/* in order to keep the board position in the sheet
...
...
pcbnew/printout_controler.h
View file @
e066b91c
...
@@ -31,6 +31,7 @@ public:
...
@@ -31,6 +31,7 @@ public:
int
m_PageCount
;
// Number of page to print
int
m_PageCount
;
// Number of page to print
bool
m_ForceCentered
;
// Forge plot origin to page centre (used in modedit)
bool
m_ForceCentered
;
// Forge plot origin to page centre (used in modedit)
int
m_Flags
;
// auxiliary variable: can be used to pass some other info
int
m_Flags
;
// auxiliary variable: can be used to pass some other info
wxPageSetupDialogData
*
m_PageSetupData
;
// A wxPageSetupDialogData to know page options (margins)
enum
DrillShapeOptT
{
enum
DrillShapeOptT
{
NO_DRILL_SHAPE
=
0
,
NO_DRILL_SHAPE
=
0
,
...
...
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