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
c8ed3280
Commit
c8ed3280
authored
Mar 12, 2013
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pcbnew: Fix many minor issues in print dialog, mainly in modedit.
parent
742e1a7e
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
218 additions
and
231 deletions
+218
-231
dialog_print_using_printer.cpp
eeschema/dialogs/dialog_print_using_printer.cpp
+3
-21
dialog_print_for_modedit.cpp
pcbnew/dialogs/dialog_print_for_modedit.cpp
+18
-25
dialog_print_for_modedit_base.cpp
pcbnew/dialogs/dialog_print_for_modedit_base.cpp
+87
-87
dialog_print_for_modedit_base.fbp
pcbnew/dialogs/dialog_print_for_modedit_base.fbp
+1
-1
dialog_print_for_modedit_base.h
pcbnew/dialogs/dialog_print_for_modedit_base.h
+66
-64
dialog_print_using_printer.cpp
pcbnew/dialogs/dialog_print_using_printer.cpp
+4
-6
moduleframe.cpp
pcbnew/moduleframe.cpp
+4
-0
printout_controler.cpp
pcbnew/printout_controler.cpp
+35
-27
No files found.
eeschema/dialogs/dialog_print_using_printer.cpp
View file @
c8ed3280
...
...
@@ -151,30 +151,12 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
if
(
GetSizer
()
)
GetSizer
()
->
SetSizeHints
(
this
);
#if 0
Does not work on a two monitor system when the 2nd monitor is not attached,
and when the coords were saved to disk when the playground was bigger while the
2nd monitor was attached.
Simply rely on the policy in class DIALOG_SHIM, which centers the dialog
initially during a runtime session but gives user the ability to move it in
that session.
if( parent->GetPrintDialogPosition() == wxDefaultPosition &&
parent->GetPrintDialogSize() == wxDefaultSize )
{
Center();
}
else
{
SetPosition( parent->GetPrintDialogPosition() );
SetSize( parent->GetPrintDialogSize() );
}
#else
// Rely on the policy in class DIALOG_SHIM, which centers the dialog
// initially during a runtime session but gives user the ability to move it in
// that session.
// This dialog may get moved and resized in Show(), but in case this is
// the first time, center it for starters.
Center
();
#endif
m_buttonPrint
->
SetDefault
();
// on linux, this is inadequate to determine
// what ENTER does. Must also SetFocus().
...
...
pcbnew/dialogs/dialog_print_for_modedit.cpp
View file @
c8ed3280
...
...
@@ -3,7 +3,7 @@
// Set this to 1 if you want to test PostScript printing under MSW.
#define wxTEST_POSTSCRIPT_IN_MSW 1
//
#define wxTEST_POSTSCRIPT_IN_MSW 1
#include <fctsys.h>
#include <appl_wxstruct.h>
...
...
@@ -43,7 +43,7 @@ private:
void
OnCloseWindow
(
wxCloseEvent
&
event
);
/// Open a dialog box for printer setup (printer options, page size ...)
void
OnP
rint
Setup
(
wxCommandEvent
&
event
);
void
OnP
age
Setup
(
wxCommandEvent
&
event
);
void
OnPrintPreview
(
wxCommandEvent
&
event
);
...
...
@@ -57,6 +57,8 @@ private:
void
FOOTPRINT_EDIT_FRAME
::
ToPrinter
(
wxCommandEvent
&
event
)
{
const
PAGE_INFO
&
pageInfo
=
GetPageSettings
();
if
(
s_PrintData
==
NULL
)
// First print
{
s_PrintData
=
new
wxPrintData
();
...
...
@@ -68,7 +70,15 @@ void FOOTPRINT_EDIT_FRAME::ToPrinter( wxCommandEvent& event )
s_PrintData
->
SetQuality
(
wxPRINT_QUALITY_HIGH
);
// Default resolution = HIGHT;
}
s_PrintData
->
SetOrientation
(
GetPageSettings
().
IsPortrait
()
?
wxPORTRAIT
:
wxLANDSCAPE
);
if
(
s_pageSetupData
==
NULL
)
s_pageSetupData
=
new
wxPageSetupDialogData
(
*
s_PrintData
);
s_pageSetupData
->
SetPaperId
(
pageInfo
.
GetPaperId
()
);
s_pageSetupData
->
GetPrintData
().
SetOrientation
(
pageInfo
.
GetWxOrientation
()
);
s_PrintData
->
SetOrientation
(
pageInfo
.
GetWxOrientation
()
);
*
s_PrintData
=
s_pageSetupData
->
GetPrintData
();
s_Parameters
.
m_PageSetupData
=
s_pageSetupData
;
DIALOG_PRINT_FOR_MODEDIT
dlg
(
this
);
...
...
@@ -91,17 +101,6 @@ DIALOG_PRINT_FOR_MODEDIT::DIALOG_PRINT_FOR_MODEDIT( PCB_BASE_FRAME* parent ) :
void
DIALOG_PRINT_FOR_MODEDIT
::
InitValues
(
)
{
if
(
s_pageSetupData
==
NULL
)
{
s_pageSetupData
=
new
wxPageSetupDialogData
;
// Set initial page margins.
// Margins are already set in Pcbnew, so we cans use 0
s_pageSetupData
->
SetMarginTopLeft
(
wxPoint
(
0
,
0
));
s_pageSetupData
->
SetMarginBottomRight
(
wxPoint
(
0
,
0
));
}
s_Parameters
.
m_PageSetupData
=
s_pageSetupData
;
// Read the scale adjust option
int
scale_Select
=
3
;
// default selected scale = ScaleList[3] = 1
if
(
m_config
)
...
...
@@ -130,19 +129,13 @@ void DIALOG_PRINT_FOR_MODEDIT::OnCloseWindow( wxCloseEvent& event )
}
void
DIALOG_PRINT_FOR_MODEDIT
::
OnPrintSetup
(
wxCommandEvent
&
event
)
void
DIALOG_PRINT_FOR_MODEDIT
::
OnPageSetup
(
wxCommandEvent
&
event
)
{
wxPrintDialogData
printDialogData
(
*
s_PrintData
);
wxPageSetupDialog
pageSetupDialog
(
this
,
s_pageSetupData
);
pageSetupDialog
.
ShowModal
();
if
(
printDialogData
.
Ok
()
)
{
wxPrintDialog
printerDialog
(
this
,
&
printDialogData
);
printerDialog
.
ShowModal
();
*
s_PrintData
=
printerDialog
.
GetPrintDialogData
().
GetPrintData
();
}
else
DisplayError
(
this
,
_
(
"Printer Problem!"
)
);
(
*
s_PrintData
)
=
pageSetupDialog
.
GetPageSetupDialogData
().
GetPrintData
();
(
*
s_pageSetupData
)
=
pageSetupDialog
.
GetPageSetupDialogData
();
}
...
...
pcbnew/dialogs/dialog_print_for_modedit_base.cpp
View file @
c8ed3280
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version
Mar 19 2012)
// C++ code generated with wxFormBuilder (version
Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
...
...
@@ -69,7 +69,7 @@ DIALOG_PRINT_FOR_MODEDIT_BASE::DIALOG_PRINT_FOR_MODEDIT_BASE( wxWindow* parent,
// Connect Events
this
->
Connect
(
wxEVT_CLOSE_WINDOW
,
wxCloseEventHandler
(
DIALOG_PRINT_FOR_MODEDIT_BASE
::
OnCloseWindow
)
);
m_buttonOption
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_FOR_MODEDIT_BASE
::
OnP
rintSetup
),
NULL
,
this
);
m_buttonOption
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_FOR_MODEDIT_BASE
::
OnP
ageSetup
),
NULL
,
this
);
m_buttonPreview
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_FOR_MODEDIT_BASE
::
OnPrintPreview
),
NULL
,
this
);
m_buttonPrint
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_FOR_MODEDIT_BASE
::
OnPrintButtonClick
),
NULL
,
this
);
m_buttonQuit
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_FOR_MODEDIT_BASE
::
OnButtonCancelClick
),
NULL
,
this
);
...
...
@@ -79,7 +79,7 @@ DIALOG_PRINT_FOR_MODEDIT_BASE::~DIALOG_PRINT_FOR_MODEDIT_BASE()
{
// Disconnect Events
this
->
Disconnect
(
wxEVT_CLOSE_WINDOW
,
wxCloseEventHandler
(
DIALOG_PRINT_FOR_MODEDIT_BASE
::
OnCloseWindow
)
);
m_buttonOption
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_FOR_MODEDIT_BASE
::
OnP
rintSetup
),
NULL
,
this
);
m_buttonOption
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_FOR_MODEDIT_BASE
::
OnP
ageSetup
),
NULL
,
this
);
m_buttonPreview
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_FOR_MODEDIT_BASE
::
OnPrintPreview
),
NULL
,
this
);
m_buttonPrint
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_FOR_MODEDIT_BASE
::
OnPrintButtonClick
),
NULL
,
this
);
m_buttonQuit
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_PRINT_FOR_MODEDIT_BASE
::
OnButtonCancelClick
),
NULL
,
this
);
...
...
pcbnew/dialogs/dialog_print_for_modedit_base.fbp
View file @
c8ed3280
...
...
@@ -364,7 +364,7 @@
<property
name=
"window_extra_style"
></property>
<property
name=
"window_name"
></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=
"OnEnterWindow"
></event>
<event
name=
"OnEraseBackground"
></event>
...
...
pcbnew/dialogs/dialog_print_for_modedit_base.h
View file @
c8ed3280
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version
Mar 19 2012)
// C++ code generated with wxFormBuilder (version
Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
...
...
@@ -11,6 +11,8 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class
DIALOG_SHIM
;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/radiobox.h>
...
...
@@ -48,7 +50,7 @@ class DIALOG_PRINT_FOR_MODEDIT_BASE : public DIALOG_SHIM
// Virtual event handlers, overide them in your derived class
virtual
void
OnCloseWindow
(
wxCloseEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnP
rintSetup
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnP
ageSetup
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnPrintPreview
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnPrintButtonClick
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnButtonCancelClick
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
...
...
pcbnew/dialogs/dialog_print_using_printer.cpp
View file @
c8ed3280
...
...
@@ -3,7 +3,7 @@
/****************************************/
// Set this to 1 if you want to test PostScript printing under MSW.
#define wxTEST_POSTSCRIPT_IN_MSW 1
//
#define wxTEST_POSTSCRIPT_IN_MSW 1
#include <fctsys.h>
#include <appl_wxstruct.h>
...
...
@@ -100,6 +100,7 @@ void PCB_EDIT_FRAME::ToPrinter( wxCommandEvent& event )
s_pageSetupData
=
new
wxPageSetupDialogData
(
*
s_PrintData
);
s_pageSetupData
->
SetPaperId
(
pageInfo
.
GetPaperId
()
);
s_pageSetupData
->
GetPrintData
().
SetOrientation
(
pageInfo
.
GetWxOrientation
()
);
if
(
pageInfo
.
IsCustom
()
)
{
...
...
@@ -111,10 +112,6 @@ void PCB_EDIT_FRAME::ToPrinter( wxCommandEvent& event )
Mils2mm
(
pageInfo
.
GetWidthMils
()
)
)
);
}
s_pageSetupData
->
SetMarginTopLeft
(
wxPoint
(
0
,
0
)
);
s_pageSetupData
->
SetMarginBottomRight
(
wxPoint
(
0
,
0
)
);
s_pageSetupData
->
GetPrintData
().
SetOrientation
(
pageInfo
.
GetWxOrientation
()
);
*
s_PrintData
=
s_pageSetupData
->
GetPrintData
();
DIALOG_PRINT_USING_PRINTER
dlg
(
this
);
...
...
@@ -454,10 +451,11 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
}
// Uses the parent position and size.
// @todo uses last position and size ans store them when exit in m_config
wxPoint
WPos
=
m_parent
->
GetPosition
();
wxSize
WSize
=
m_parent
->
GetSize
();
preview
->
SetZoom
(
100
);
wxPreviewFrame
*
frame
=
new
wxPreviewFrame
(
preview
,
this
,
title
,
WPos
,
WSize
);
frame
->
Initialize
();
...
...
pcbnew/moduleframe.cpp
View file @
c8ed3280
...
...
@@ -198,6 +198,10 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( PCB_EDIT_FRAME* aParent ) :
GetScreen
()
->
AddGrid
(
m_UserGridSize
,
m_UserGridUnit
,
ID_POPUP_GRID_USER
);
GetScreen
()
->
SetGrid
(
ID_POPUP_GRID_LEVEL_1000
+
m_LastGridSizeId
);
// In modedit, set the default paper size to A4:
// this should be OK for all footprint to plot/print
SetPageSettings
(
PAGE_INFO
::
A4
);
SetSize
(
m_FramePos
.
x
,
m_FramePos
.
y
,
m_FrameSize
.
x
,
m_FrameSize
.
y
);
ReCreateMenuBar
();
ReCreateHToolbar
();
...
...
pcbnew/printout_controler.cpp
View file @
c8ed3280
...
...
@@ -59,8 +59,8 @@ static const wxString tracePrinting( wxT( "KicadPrinting" ) );
PRINT_PARAMETERS
::
PRINT_PARAMETERS
()
{
m_PenDefaultSize
=
50
;
// A reasonable minimal
value to draw items
//
mainly that
do not have a specified line width
m_PenDefaultSize
=
Millimeter2iu
(
0.2
);
// A reasonable defualt
value to draw items
//
which
do not have a specified line width
m_PrintScale
=
1.0
;
m_XScaleAdjust
=
1.0
;
m_YScaleAdjust
=
1.0
;
...
...
@@ -159,6 +159,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
wxDC
*
dc
=
GetDC
();
BASE_SCREEN
*
screen
=
m_Parent
->
GetScreen
();
bool
printMirror
=
m_PrintParams
.
m_PrintMirror
;
wxSize
pageSizeIU
=
m_Parent
->
GetPageSizeIU
();
wxBusyCursor
dummy
;
...
...
@@ -171,16 +172,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
// Use the page size as the drawing area when the board is shown or the user scale
// is less than 1.
if
(
m_PrintParams
.
PrintBorderAndTitleBlock
()
)
boardBoundingBox
=
EDA_RECT
(
wxPoint
(
0
,
0
),
m_Parent
->
GetPageSizeIU
()
);
// In module editor, the module is located at 0,0 but for printing
// it is moved to pageSizeIU.x/2, pageSizeIU.y/2.
// So the equivalent board must be moved:
if
(
m_Parent
->
IsType
(
MODULE_EDITOR_FRAME_TYPE
)
)
{
boardBoundingBox
.
Move
(
wxPoint
(
boardBoundingBox
.
GetWidth
()
/
2
,
boardBoundingBox
.
GetHeight
()
/
2
)
);
}
boardBoundingBox
=
EDA_RECT
(
wxPoint
(
0
,
0
),
pageSizeIU
);
wxLogTrace
(
tracePrinting
,
wxT
(
"Drawing bounding box: x=%d, y=%d, w=%d, h=%d"
),
boardBoundingBox
.
GetX
(),
boardBoundingBox
.
GetY
(),
...
...
@@ -191,14 +183,23 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
if
(
m_PrintParams
.
m_PrintScale
==
0
)
// fit in page option
{
// TODO: a better way to calculate the userscale
if
(
boardBoundingBox
.
GetWidth
()
&&
boardBoundingBox
.
GetHeight
())
{
int
margin
=
Millimeter2iu
(
10.0
);
// add a margin around the drawings
double
scaleX
=
(
double
)(
pageSizeIU
.
x
-
(
2
*
margin
))
/
boardBoundingBox
.
GetWidth
();
double
scaleY
=
(
double
)(
pageSizeIU
.
y
-
(
2
*
margin
))
/
boardBoundingBox
.
GetHeight
();
userscale
=
(
scaleX
<
scaleY
)
?
scaleX
:
scaleY
;
}
else
userscale
=
1.0
;
}
wxSize
scaledPageSize
=
m_Parent
->
GetPageSizeIU
()
;
wxSize
scaledPageSize
=
pageSizeIU
;
drawRect
.
SetSize
(
scaledPageSize
);
scaledPageSize
.
x
=
wxRound
(
(
double
)
scaledPageSize
.
x
/
userscale
);
scaledPageSize
.
y
=
wxRound
(
(
double
)
scaledPageSize
.
y
/
userscale
);
scaledPageSize
.
x
=
wxRound
(
scaledPageSize
.
x
/
userscale
);
scaledPageSize
.
y
=
wxRound
(
scaledPageSize
.
y
/
userscale
);
if
(
m_PrintParams
.
m_PageSetupData
)
...
...
@@ -213,12 +214,13 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
// Compute Accurate scale 1
if
(
m_PrintParams
.
m_PrintScale
==
1.0
)
{
// We want a 1:1 scale and margins for printing
MapScreenSizeToPaper
();
// We want a 1:1 scale, regardless the page setup
// like page size, margin ...
MapScreenSizeToPaper
();
// set best scale and offset (scale is not used)
int
w
,
h
;
GetPPIPrinter
(
&
w
,
&
h
);
double
accurate_Xscale
=
(
(
double
)
(
w
)
)
/
(
IU_PER_MILS
*
1000
);
double
accurate_Yscale
=
(
(
double
)
(
h
)
)
/
(
IU_PER_MILS
*
1000
);
double
accurate_Xscale
=
(
double
)
w
/
(
IU_PER_MILS
*
1000
);
double
accurate_Yscale
=
(
double
)
h
/
(
IU_PER_MILS
*
1000
);
if
(
IsPreview
()
)
// Scale must take in account the DC size in Preview
{
...
...
@@ -226,16 +228,14 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
wxSize
PlotAreaSize
;
dc
->
GetSize
(
&
PlotAreaSize
.
x
,
&
PlotAreaSize
.
y
);
GetPageSizePixels
(
&
w
,
&
h
);
accurate_Xscale
*=
PlotAreaSize
.
x
;
accurate_Xscale
/=
(
double
)
w
;
accurate_Yscale
*=
PlotAreaSize
.
y
;
accurate_Yscale
/=
(
double
)
h
;
accurate_Xscale
*=
(
double
)
PlotAreaSize
.
x
/
w
;
accurate_Yscale
*=
(
double
)
PlotAreaSize
.
y
/
h
;
}
// Fine scale adjust
accurate_Xscale
*=
m_PrintParams
.
m_XScaleAdjust
;
accurate_Yscale
*=
m_PrintParams
.
m_YScaleAdjust
;
//
Fine scale adjust
//
Set print scale for 1:1 exact scale
dc
->
SetUserScale
(
accurate_Xscale
,
accurate_Yscale
);
}
...
...
@@ -255,6 +255,14 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
wxLogTrace
(
tracePrinting
,
wxT
(
"Scaled plot area in user units: x=%d, y=%d"
),
PlotAreaSizeInUserUnits
.
x
,
PlotAreaSizeInUserUnits
.
y
);
// In module editor, the module is located at 0,0 but for printing
// it is moved to pageSizeIU.x/2, pageSizeIU.y/2.
// So the equivalent board must be moved to the center of the page:
if
(
m_Parent
->
IsType
(
MODULE_EDITOR_FRAME_TYPE
)
)
{
boardBoundingBox
.
Move
(
wxPoint
(
pageSizeIU
.
x
/
2
,
pageSizeIU
.
y
/
2
)
);
}
// In some cases the plot origin is the centre of the board outline rather than the center
// of the selected paper size.
if
(
m_PrintParams
.
CenterOnBoardOutline
()
)
...
...
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