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
32c8fdad
Commit
32c8fdad
authored
Mar 26, 2015
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for printing non-consecutive layers or starting with layer > 1 in gerbview.
parent
681090b8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
26 deletions
+38
-26
class_gbr_layout.h
gerbview/class_gbr_layout.h
+4
-4
dialog_print_using_printer.cpp
gerbview/dialogs/dialog_print_using_printer.cpp
+12
-12
draw_gerber_screen.cpp
gerbview/draw_gerber_screen.cpp
+17
-4
printout_control.cpp
gerbview/printout_control.cpp
+5
-6
No files found.
gerbview/class_gbr_layout.h
View file @
32c8fdad
gerbview/dialogs/dialog_print_using_printer.cpp
View file @
32c8fdad
...
...
@@ -78,8 +78,8 @@ private:
void
OnScaleSelectionClick
(
wxCommandEvent
&
event
);
void
OnButtonCancelClick
(
wxCommandEvent
&
event
)
{
Close
();
}
void
SetPrintParameters
(
);
void
InitValues
(
);
void
SetPrintParameters
();
void
InitValues
();
public
:
bool
IsMirrored
()
{
return
m_Print_Mirror
->
IsChecked
();
}
...
...
@@ -151,8 +151,8 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
s_pageSetupData
=
new
wxPageSetupDialogData
;
// Set initial page margins.
// Margins are already set in Gerbview, so we can use 0
s_pageSetupData
->
SetMarginTopLeft
(
wxPoint
(
0
,
0
)
);
s_pageSetupData
->
SetMarginBottomRight
(
wxPoint
(
0
,
0
)
);
s_pageSetupData
->
SetMarginTopLeft
(
wxPoint
(
0
,
0
)
);
s_pageSetupData
->
SetMarginBottomRight
(
wxPoint
(
0
,
0
)
);
}
s_Parameters
.
m_PageSetupData
=
s_pageSetupData
;
...
...
@@ -175,7 +175,6 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
wxGROW
|
wxLEFT
|
wxRIGHT
|
wxTOP
);
}
// Read the scale adjust option
int
scale_idx
=
4
;
// default selected scale = ScaleList[4] = 1.000
...
...
@@ -184,8 +183,8 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
m_Config
->
Read
(
OPTKEY_PRINT_X_FINESCALE_ADJ
,
&
s_Parameters
.
m_XScaleAdjust
);
m_Config
->
Read
(
OPTKEY_PRINT_Y_FINESCALE_ADJ
,
&
s_Parameters
.
m_YScaleAdjust
);
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_MONOCHROME_MODE
,
&
s_Parameters
.
m_Print_Black_and_White
,
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
);
// Test for a reasonnable scale value. Set to 1 if problem
if
(
s_Parameters
.
m_XScaleAdjust
<
MIN_SCALE
||
...
...
@@ -208,7 +207,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
m_ScaleOption
->
SetSelection
(
scale_idx
);
scale_idx
=
m_ScaleOption
->
GetSelection
();
s_Parameters
.
m_PrintScale
=
s_ScaleList
[
scale_idx
];
m_Print_Mirror
->
SetValue
(
s_Parameters
.
m_PrintMirror
);
m_Print_Mirror
->
SetValue
(
s_Parameters
.
m_PrintMirror
);
if
(
s_Parameters
.
m_Print_Black_and_White
)
...
...
@@ -230,6 +229,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
m_FineAdjustYscaleOpt
->
Enable
(
enable
);
}
int
DIALOG_PRINT_USING_PRINTER
::
SetLayerSetFromListSelection
()
{
int
page_count
=
0
;
...
...
@@ -275,7 +275,7 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
}
void
DIALOG_PRINT_USING_PRINTER
::
SetPrintParameters
(
)
void
DIALOG_PRINT_USING_PRINTER
::
SetPrintParameters
()
{
s_Parameters
.
m_PrintMirror
=
m_Print_Mirror
->
GetValue
();
s_Parameters
.
m_Print_Black_and_White
=
...
...
@@ -331,7 +331,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event )
bool
DIALOG_PRINT_USING_PRINTER
::
PreparePrintPrms
()
{
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:
...
...
gerbview/draw_gerber_screen.cpp
View file @
32c8fdad
...
...
@@ -46,7 +46,7 @@
void
GERBVIEW_FRAME
::
PrintPage
(
wxDC
*
aDC
,
LSET
aPrintMasklayer
,
bool
aPrintMirrorMode
,
void
*
aData
)
{
wxCHECK_RET
(
aData
!=
NULL
,
wxT
(
"aDat
e
cannot be NULL."
)
);
wxCHECK_RET
(
aData
!=
NULL
,
wxT
(
"aDat
a
cannot be NULL."
)
);
// Save current draw options, because print mode has specific options:
GBR_DISPLAY_OPTIONS
imgDisplayOptions
=
m_DisplayOptions
;
...
...
@@ -59,15 +59,28 @@ void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer,
m_DisplayOptions
.
m_DisplayDCodes
=
false
;
m_DisplayOptions
.
m_IsPrinting
=
true
;
PRINT_PARAMETERS
*
printParameters
=
(
PRINT_PARAMETERS
*
)
aData
;
PRINT_PARAMETERS
*
printParameters
=
(
PRINT_PARAMETERS
*
)
aData
;
// Find the layer to be printed
int
page
=
printParameters
->
m_Flags
;
// contains the page number (not necessarily layer number)
int
layer
=
0
;
// Find the layer number for the printed page (search through the mask and count bits)
while
(
page
>
0
)
{
if
(
printLayersMask
[
layer
++
]
)
--
page
;
}
--
layer
;
std
::
bitset
<
GERBER_DRAWLAYERS_COUNT
>
printCurrLayerMask
;
printCurrLayerMask
.
reset
();
printCurrLayerMask
.
set
(
printParameters
->
m_Flags
);
// m_Flags contains the draw layer number
printCurrLayerMask
.
set
(
layer
);
GetGerberLayout
()
->
SetPrintableLayers
(
printCurrLayerMask
);
m_canvas
->
SetPrintMirrored
(
aPrintMirrorMode
);
bool
printBlackAndWhite
=
printParameters
->
m_Print_Black_and_White
;
GetGerberLayout
()
->
Draw
(
m_canvas
,
aDC
,
UNSPECIFIED_DRAWMODE
,
GetGerberLayout
()
->
Draw
(
m_canvas
,
aDC
,
(
GR_DRAWMODE
)
0
,
wxPoint
(
0
,
0
),
printBlackAndWhite
);
m_canvas
->
SetPrintMirrored
(
false
);
...
...
gerbview/printout_control.cpp
View file @
32c8fdad
...
...
@@ -81,7 +81,7 @@ bool BOARD_PRINTOUT_CONTROLLER::OnPrintPage( int aPage )
{
// in gerbview, draw layers are always printed on separate pages
// because handling negative objects when using only one page is tricky
m_PrintParams
.
m_Flags
=
aPage
-
1
;
// = gerber draw layer id
m_PrintParams
.
m_Flags
=
aPage
;
DrawPage
();
return
true
;
...
...
@@ -238,7 +238,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
if
(
printMirror
)
{
// To plot mirror, we reverse the x axis, and modify the plot x origin
dc
->
SetAxisOrientation
(
false
,
false
);
dc
->
SetAxisOrientation
(
false
,
false
);
/* Plot offset x is moved by the x plot area size in order to have
* the old draw area in the new draw area, because the draw origin has not moved
...
...
@@ -248,7 +248,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
x_dc_offset
=
KiROUND
(
x_dc_offset
*
userscale
);
dc
->
SetDeviceOrigin
(
x_dc_offset
,
0
);
panel
->
SetClipBox
(
EDA_RECT
(
wxPoint
(
-
MAX_VALUE
/
2
,
-
MAX_VALUE
/
2
),
panel
->
SetClipBox
(
EDA_RECT
(
wxPoint
(
-
MAX_VALUE
/
2
,
-
MAX_VALUE
/
2
),
panel
->
GetClipBox
()
->
GetSize
()
)
);
}
...
...
@@ -261,8 +261,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
// B&W mode is handled in print page function
GRForceBlackPen
(
false
);
m_Parent
->
PrintPage
(
dc
,
m_PrintParams
.
m_PrintMaskLayer
,
printMirror
,
&
m_PrintParams
);
m_Parent
->
PrintPage
(
dc
,
m_PrintParams
.
m_PrintMaskLayer
,
printMirror
,
&
m_PrintParams
);
m_Parent
->
SetDrawBgColor
(
bg_color
);
screen
->
m_IsPrinting
=
false
;
...
...
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