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
93a8e7b3
Commit
93a8e7b3
authored
Mar 11, 2013
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pcbnew: print dialog: code cleanup and bug fixes (added some fixes from Sergey A. Borshch)
parent
2a2a530c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
36 additions
and
40 deletions
+36
-40
dialog_print_using_printer.cpp
gerbview/dialogs/dialog_print_using_printer.cpp
+0
-3
dialog_print_for_modedit.cpp
pcbnew/dialogs/dialog_print_for_modedit.cpp
+0
-3
dialog_print_using_printer.cpp
pcbnew/dialogs/dialog_print_using_printer.cpp
+17
-16
pcbnew.cpp
pcbnew/pcbnew.cpp
+7
-0
pcbplot.h
pcbnew/pcbplot.h
+1
-7
print_board_functions.cpp
pcbnew/print_board_functions.cpp
+7
-5
printout_controler.cpp
pcbnew/printout_controler.cpp
+4
-6
No files found.
gerbview/dialogs/dialog_print_using_printer.cpp
View file @
93a8e7b3
...
@@ -18,9 +18,6 @@
...
@@ -18,9 +18,6 @@
#include <pcbplot.h>
#include <pcbplot.h>
#include <class_board_design_settings.h>
#include <class_board_design_settings.h>
#define WIDTH_MAX_VALUE 1000
#define WIDTH_MIN_VALUE 1
static
long
s_SelectedLayers
;
static
long
s_SelectedLayers
;
static
double
s_ScaleList
[]
=
static
double
s_ScaleList
[]
=
{
0
,
0.5
,
0.7
,
0.999
,
1.0
,
1.4
,
2.0
,
3.0
,
4.0
};
{
0
,
0.5
,
0.7
,
0.999
,
1.0
,
1.4
,
2.0
,
3.0
,
4.0
};
...
...
pcbnew/dialogs/dialog_print_for_modedit.cpp
View file @
93a8e7b3
...
@@ -17,9 +17,6 @@
...
@@ -17,9 +17,6 @@
#include <dialog_print_for_modedit_base.h>
#include <dialog_print_for_modedit_base.h>
#include <printout_controler.h>
#include <printout_controler.h>
#define WIDTH_MAX_VALUE 1000
#define WIDTH_MIN_VALUE 1
static
double
s_ScaleList
[]
=
static
double
s_ScaleList
[]
=
{
0
,
0.5
,
0.7
,
1.0
,
1.4
,
2.0
,
3.0
,
4.0
,
8.0
,
16.0
};
{
0
,
0.5
,
0.7
,
1.0
,
1.4
,
2.0
,
3.0
,
4.0
,
8.0
,
16.0
};
...
...
pcbnew/dialogs/dialog_print_using_printer.cpp
View file @
93a8e7b3
...
@@ -21,8 +21,8 @@
...
@@ -21,8 +21,8 @@
#include <dialog_print_using_printer_base.h>
#include <dialog_print_using_printer_base.h>
#define
WIDTH_MAX_VALUE 1000
#define
PEN_WIDTH_MAX_VALUE ( (int)(5 * IU_PER_MM) )
#define
WIDTH_MIN_VALUE 1
#define
PEN_WIDTH_MIN_VALUE ( (int)(0.005 * IU_PER_MM) )
extern
int
g_DrawDefaultLineThickness
;
extern
int
g_DrawDefaultLineThickness
;
...
@@ -211,6 +211,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
...
@@ -211,6 +211,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
m_config
->
Read
(
OPTKEY_PRINT_SCALE
,
&
scale_idx
);
m_config
->
Read
(
OPTKEY_PRINT_SCALE
,
&
scale_idx
);
m_config
->
Read
(
OPTKEY_PRINT_PAGE_FRAME
,
&
s_Parameters
.
m_Print_Sheet_Ref
,
1
);
m_config
->
Read
(
OPTKEY_PRINT_PAGE_FRAME
,
&
s_Parameters
.
m_Print_Sheet_Ref
,
1
);
m_config
->
Read
(
OPTKEY_PRINT_MONOCHROME_MODE
,
&
s_Parameters
.
m_Print_Black_and_White
,
1
);
m_config
->
Read
(
OPTKEY_PRINT_MONOCHROME_MODE
,
&
s_Parameters
.
m_Print_Black_and_White
,
1
);
m_config
->
Read
(
OPTKEY_PRINT_PAGE_PER_LAYER
,
&
s_Parameters
.
m_OptionPrintPage
,
0
);
int
tmp
;
int
tmp
;
m_config
->
Read
(
OPTKEY_PRINT_PADS_DRILL
,
&
tmp
,
PRINT_PARAMETERS
::
SMALL_DRILL_SHAPE
);
m_config
->
Read
(
OPTKEY_PRINT_PADS_DRILL
,
&
tmp
,
PRINT_PARAMETERS
::
SMALL_DRILL_SHAPE
);
s_Parameters
.
m_DrillShapeOpt
=
(
PRINT_PARAMETERS
::
DrillShapeOptT
)
tmp
;
s_Parameters
.
m_DrillShapeOpt
=
(
PRINT_PARAMETERS
::
DrillShapeOptT
)
tmp
;
...
@@ -258,6 +259,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
...
@@ -258,6 +259,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
else
else
m_ModeColorOption
->
SetSelection
(
0
);
m_ModeColorOption
->
SetSelection
(
0
);
m_PagesOption
->
SetSelection
(
s_Parameters
.
m_OptionPrintPage
);
s_Parameters
.
m_PenDefaultSize
=
g_DrawDefaultLineThickness
;
s_Parameters
.
m_PenDefaultSize
=
g_DrawDefaultLineThickness
;
AddUnitSymbol
(
*
m_TextPenWidth
,
g_UserUnit
);
AddUnitSymbol
(
*
m_TextPenWidth
,
g_UserUnit
);
m_DialogPenWidth
->
SetValue
(
m_DialogPenWidth
->
SetValue
(
...
@@ -320,6 +322,7 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
...
@@ -320,6 +322,7 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
m_config
->
Write
(
OPTKEY_PRINT_SCALE
,
m_ScaleOption
->
GetSelection
()
);
m_config
->
Write
(
OPTKEY_PRINT_SCALE
,
m_ScaleOption
->
GetSelection
()
);
m_config
->
Write
(
OPTKEY_PRINT_PAGE_FRAME
,
s_Parameters
.
m_Print_Sheet_Ref
);
m_config
->
Write
(
OPTKEY_PRINT_PAGE_FRAME
,
s_Parameters
.
m_Print_Sheet_Ref
);
m_config
->
Write
(
OPTKEY_PRINT_MONOCHROME_MODE
,
s_Parameters
.
m_Print_Black_and_White
);
m_config
->
Write
(
OPTKEY_PRINT_MONOCHROME_MODE
,
s_Parameters
.
m_Print_Black_and_White
);
m_config
->
Write
(
OPTKEY_PRINT_PAGE_PER_LAYER
,
s_Parameters
.
m_OptionPrintPage
);
m_config
->
Write
(
OPTKEY_PRINT_PADS_DRILL
,
(
long
)
s_Parameters
.
m_DrillShapeOpt
);
m_config
->
Write
(
OPTKEY_PRINT_PADS_DRILL
,
(
long
)
s_Parameters
.
m_DrillShapeOpt
);
wxString
layerKey
;
wxString
layerKey
;
for
(
int
layer
=
0
;
layer
<
NB_LAYERS
;
++
layer
)
for
(
int
layer
=
0
;
layer
<
NB_LAYERS
;
++
layer
)
...
@@ -387,14 +390,14 @@ void DIALOG_PRINT_USING_PRINTER::SetPenWidth()
...
@@ -387,14 +390,14 @@ void DIALOG_PRINT_USING_PRINTER::SetPenWidth()
s_Parameters
.
m_PenDefaultSize
=
ReturnValueFromTextCtrl
(
*
m_DialogPenWidth
);
s_Parameters
.
m_PenDefaultSize
=
ReturnValueFromTextCtrl
(
*
m_DialogPenWidth
);
if
(
s_Parameters
.
m_PenDefaultSize
>
WIDTH_MAX_VALUE
)
if
(
s_Parameters
.
m_PenDefaultSize
>
PEN_
WIDTH_MAX_VALUE
)
{
{
s_Parameters
.
m_PenDefaultSize
=
WIDTH_MAX_VALUE
;
s_Parameters
.
m_PenDefaultSize
=
PEN_
WIDTH_MAX_VALUE
;
}
}
if
(
s_Parameters
.
m_PenDefaultSize
<
WIDTH_MIN_VALUE
)
if
(
s_Parameters
.
m_PenDefaultSize
<
PEN_
WIDTH_MIN_VALUE
)
{
{
s_Parameters
.
m_PenDefaultSize
=
WIDTH_MIN_VALUE
;
s_Parameters
.
m_PenDefaultSize
=
PEN_
WIDTH_MIN_VALUE
;
}
}
g_DrawDefaultLineThickness
=
s_Parameters
.
m_PenDefaultSize
;
g_DrawDefaultLineThickness
=
s_Parameters
.
m_PenDefaultSize
;
...
@@ -429,6 +432,14 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
...
@@ -429,6 +432,14 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
{
{
SetPrintParameters
(
);
SetPrintParameters
(
);
// If no layer selected, we have no plot. prompt user if it happens
// because he could think there is a bug in Pcbnew:
if
(
s_Parameters
.
m_PrintMaskLayer
==
0
)
{
DisplayError
(
this
,
_
(
"No layer selected"
)
);
return
;
}
// Pass two printout objects: for preview, and possible printing.
// Pass two printout objects: for preview, and possible printing.
wxString
title
=
_
(
"Print Preview"
);
wxString
title
=
_
(
"Print Preview"
);
wxPrintPreview
*
preview
=
wxPrintPreview
*
preview
=
...
@@ -442,16 +453,6 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
...
@@ -442,16 +453,6 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
return
;
return
;
}
}
SetLayerMaskFromListSelection
();
// If no layer selected, we have no plot. prompt user if it happens
// because he could think there is a bug in Pcbnew:
if
(
s_Parameters
.
m_PrintMaskLayer
==
0
)
{
DisplayError
(
this
,
_
(
"No layer selected"
)
);
return
;
}
// Uses the parent position and size.
// Uses the parent position and size.
// @todo uses last position and size ans store them when exit in m_config
// @todo uses last position and size ans store them when exit in m_config
wxPoint
WPos
=
m_parent
->
GetPosition
();
wxPoint
WPos
=
m_parent
->
GetPosition
();
...
...
pcbnew/pcbnew.cpp
View file @
93a8e7b3
...
@@ -121,6 +121,13 @@ bool EDA_APP::OnInit()
...
@@ -121,6 +121,13 @@ bool EDA_APP::OnInit()
{
{
fn
=
argv
[
1
];
fn
=
argv
[
1
];
// Be sure the filename is absolute, to avoid issues
// when the filename is relative,
// for instance when stored in history list without path,
// and when building the config filename ( which should have a path )
if
(
fn
.
IsRelative
()
)
fn
.
MakeAbsolute
();
if
(
fn
.
GetExt
()
!=
PcbFileExtension
&&
fn
.
GetExt
()
!=
LegacyPcbFileExtension
)
if
(
fn
.
GetExt
()
!=
PcbFileExtension
&&
fn
.
GetExt
()
!=
LegacyPcbFileExtension
)
{
{
msg
.
Printf
(
_
(
"Pcbnew file <%s> has a wrong extension.
\n
\
msg
.
Printf
(
_
(
"Pcbnew file <%s> has a wrong extension.
\n
\
...
...
pcbnew/pcbplot.h
View file @
93a8e7b3
...
@@ -28,6 +28,7 @@ class BOARD;
...
@@ -28,6 +28,7 @@ class BOARD;
#define OPTKEY_PRINT_MODULE_SCALE wxT( "PrintModuleScale" )
#define OPTKEY_PRINT_MODULE_SCALE wxT( "PrintModuleScale" )
#define OPTKEY_PRINT_PAGE_FRAME wxT( "PrintPageFrame" )
#define OPTKEY_PRINT_PAGE_FRAME wxT( "PrintPageFrame" )
#define OPTKEY_PRINT_MONOCHROME_MODE wxT( "PrintMonochrome" )
#define OPTKEY_PRINT_MONOCHROME_MODE wxT( "PrintMonochrome" )
#define OPTKEY_PRINT_PAGE_PER_LAYER wxT( "PrintSinglePage" )
#define OPTKEY_PRINT_PADS_DRILL wxT( "PrintPadsDrillOpt" )
#define OPTKEY_PRINT_PADS_DRILL wxT( "PrintPadsDrillOpt" )
#define OPTKEY_PLOT_X_FINESCALE_ADJ wxT( "PlotXFineScaleAdj" )
#define OPTKEY_PLOT_X_FINESCALE_ADJ wxT( "PlotXFineScaleAdj" )
#define OPTKEY_PLOT_Y_FINESCALE_ADJ wxT( "PlotYFineScaleAdj" )
#define OPTKEY_PLOT_Y_FINESCALE_ADJ wxT( "PlotYFineScaleAdj" )
...
@@ -37,13 +38,6 @@ class BOARD;
...
@@ -37,13 +38,6 @@ class BOARD;
#define PLOT_MIN_SCALE 0.01
#define PLOT_MIN_SCALE 0.01
#define PLOT_MAX_SCALE 100.0
#define PLOT_MAX_SCALE 100.0
// Conversion unit constants.
// Convert pcb dimension of 0.1 mil to PS units of inches.
#define SCALE_PS .0001
// Convert dimension 0.1 mil -> HPGL units (1 HPGL unit = 25 micrometers):
#define SCALE_HPGL 0.102041
// Small drill marks (small pad holes) diameter value
// Small drill marks (small pad holes) diameter value
#define SMALL_DRILL (int)( 0.35 * IU_PER_MM )
#define SMALL_DRILL (int)( 0.35 * IU_PER_MM )
...
...
pcbnew/print_board_functions.cpp
View file @
93a8e7b3
...
@@ -32,7 +32,7 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
...
@@ -32,7 +32,7 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
void
*
aData
)
void
*
aData
)
{
{
GR_DRAWMODE
drawmode
=
GR_COPY
;
GR_DRAWMODE
drawmode
=
GR_COPY
;
int
defaultPenSize
=
50
;
int
defaultPenSize
=
Millimeter2iu
(
0.2
)
;
DISPLAY_OPTIONS
save_opt
;
DISPLAY_OPTIONS
save_opt
;
...
@@ -53,6 +53,8 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
...
@@ -53,6 +53,8 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
m_DisplayPadNum
=
DisplayOpt
.
DisplayPadNum
=
false
;
m_DisplayPadNum
=
DisplayOpt
.
DisplayPadNum
=
false
;
bool
nctmp
=
GetBoard
()
->
IsElementVisible
(
NO_CONNECTS_VISIBLE
);
bool
nctmp
=
GetBoard
()
->
IsElementVisible
(
NO_CONNECTS_VISIBLE
);
GetBoard
()
->
SetElementVisibility
(
NO_CONNECTS_VISIBLE
,
false
);
GetBoard
()
->
SetElementVisibility
(
NO_CONNECTS_VISIBLE
,
false
);
bool
anchorsTmp
=
GetBoard
()
->
IsElementVisible
(
ANCHOR_VISIBLE
);
GetBoard
()
->
SetElementVisibility
(
ANCHOR_VISIBLE
,
false
);
DisplayOpt
.
DisplayPadIsol
=
false
;
DisplayOpt
.
DisplayPadIsol
=
false
;
DisplayOpt
.
DisplayModEdge
=
FILLED
;
DisplayOpt
.
DisplayModEdge
=
FILLED
;
DisplayOpt
.
DisplayModText
=
FILLED
;
DisplayOpt
.
DisplayModText
=
FILLED
;
...
@@ -96,6 +98,7 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
...
@@ -96,6 +98,7 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
m_DisplayViaFill
=
DisplayOpt
.
DisplayViaFill
;
m_DisplayViaFill
=
DisplayOpt
.
DisplayViaFill
;
m_DisplayPadNum
=
DisplayOpt
.
DisplayPadNum
;
m_DisplayPadNum
=
DisplayOpt
.
DisplayPadNum
;
GetBoard
()
->
SetElementVisibility
(
NO_CONNECTS_VISIBLE
,
nctmp
);
GetBoard
()
->
SetElementVisibility
(
NO_CONNECTS_VISIBLE
,
nctmp
);
GetBoard
()
->
SetElementVisibility
(
ANCHOR_VISIBLE
,
anchorsTmp
);
}
}
...
@@ -116,9 +119,8 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
...
@@ -116,9 +119,8 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
MODULE
*
Module
;
MODULE
*
Module
;
GR_DRAWMODE
drawmode
=
GR_COPY
;
GR_DRAWMODE
drawmode
=
GR_COPY
;
DISPLAY_OPTIONS
save_opt
;
DISPLAY_OPTIONS
save_opt
;
TRACK
*
pt_trace
;
BOARD
*
Pcb
=
GetBoard
();
BOARD
*
Pcb
=
GetBoard
();
int
defaultPenSize
=
50
;
int
defaultPenSize
=
Millimeter2iu
(
0.2
)
;
bool
onePagePerLayer
=
false
;
bool
onePagePerLayer
=
false
;
PRINT_PARAMETERS
*
printParameters
=
(
PRINT_PARAMETERS
*
)
aData
;
// can be null
PRINT_PARAMETERS
*
printParameters
=
(
PRINT_PARAMETERS
*
)
aData
;
// can be null
...
@@ -222,7 +224,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
...
@@ -222,7 +224,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
}
}
// Print tracks
// Print tracks
pt_trace
=
Pcb
->
m_Track
;
TRACK
*
pt_trace
=
Pcb
->
m_Track
;
for
(
;
pt_trace
!=
NULL
;
pt_trace
=
pt_trace
->
Next
()
)
for
(
;
pt_trace
!=
NULL
;
pt_trace
=
pt_trace
->
Next
()
)
{
{
...
@@ -246,8 +248,8 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
...
@@ -246,8 +248,8 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
}
}
}
}
// Outdated: only for compatibility to old boards
pt_trace
=
Pcb
->
m_Zone
;
pt_trace
=
Pcb
->
m_Zone
;
for
(
;
pt_trace
!=
NULL
;
pt_trace
=
pt_trace
->
Next
()
)
for
(
;
pt_trace
!=
NULL
;
pt_trace
=
pt_trace
->
Next
()
)
{
{
if
(
(
aPrintMaskLayer
&
pt_trace
->
ReturnMaskLayer
()
)
==
0
)
if
(
(
aPrintMaskLayer
&
pt_trace
->
ReturnMaskLayer
()
)
==
0
)
...
...
pcbnew/printout_controler.cpp
View file @
93a8e7b3
...
@@ -163,10 +163,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
...
@@ -163,10 +163,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
wxBusyCursor
dummy
;
wxBusyCursor
dummy
;
#ifdef PCBNEW
#ifdef PCBNEW
if
(
m_PrintParams
.
PrintBorderAndTitleBlock
()
)
boardBoundingBox
=
((
PCB_BASE_FRAME
*
)
m_Parent
)
->
GetBoard
()
->
ComputeBoundingBox
();
boardBoundingBox
=
((
PCB_BASE_FRAME
*
)
m_Parent
)
->
GetBoard
()
->
ComputeBoundingBox
();
else
boardBoundingBox
=
((
PCB_BASE_FRAME
*
)
m_Parent
)
->
GetBoard
()
->
ComputeBoundingBox
(
true
);
#else
#else
boardBoundingBox
=
((
GERBVIEW_FRAME
*
)
m_Parent
)
->
GetLayoutBoundingBox
();
boardBoundingBox
=
((
GERBVIEW_FRAME
*
)
m_Parent
)
->
GetLayoutBoundingBox
();
#endif
#endif
...
@@ -185,15 +182,16 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
...
@@ -185,15 +182,16 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
boardBoundingBox
.
GetHeight
()
/
2
)
);
boardBoundingBox
.
GetHeight
()
/
2
)
);
}
}
wxLogTrace
(
tracePrinting
,
wxT
(
"Drawing bounding box: x=%d, y=%d, w=%d, h=%d"
),
wxLogTrace
(
tracePrinting
,
wxT
(
"Drawing bounding box:
x=%d, y=%d, w=%d, h=%d"
),
boardBoundingBox
.
GetX
(),
boardBoundingBox
.
GetY
(),
boardBoundingBox
.
GetX
(),
boardBoundingBox
.
GetY
(),
boardBoundingBox
.
GetWidth
(),
boardBoundingBox
.
GetHeight
()
);
boardBoundingBox
.
GetWidth
(),
boardBoundingBox
.
GetHeight
()
);
// 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
(
m_PrintParams
.
m_PrintScale
==
0
)
// fit in page
if
(
m_PrintParams
.
m_PrintScale
==
0
)
// fit in page option
{
{
// TODO: a better way to calculate the userscale
userscale
=
1.0
;
userscale
=
1.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