Pcbnew: print dialog: added pads drill option (like in plot dialog)

This commit is contained in:
charras 2010-01-09 20:25:39 +00:00
parent cee9ab7610
commit d4bd033a8e
16 changed files with 272 additions and 115 deletions

View File

@ -99,7 +99,7 @@ bool DrawPage( WinEDA_DrawPanel* panel )
dc.SetClippingRegion( DrawArea );
}
panel->PrintPage( &dc, Print_Sheet_Ref, -1, false );
panel->PrintPage( &dc, Print_Sheet_Ref, -1, false, NULL );
screen->m_IsPrinting = false;
panel->m_ClipBox = tmp;
wxMetafile* mf = dc.Close();

View File

@ -238,7 +238,7 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
screen->m_IsPrinting = true;
SetLocaleTo_C_standard( ); // Switch the locale to standard C (needed
// to print floating point numbers like 1.3)
panel->PrintPage( &dc, aPrint_Sheet_Ref, 1, false );
panel->PrintPage( &dc, aPrint_Sheet_Ref, 1, false, NULL );
SetLocaleTo_Default( ); // revert to the current locale
screen->m_IsPrinting = false;
panel->m_ClipBox = tmp;

View File

@ -432,7 +432,7 @@ void EDA_Printout::DrawPage()
screen->m_IsPrinting = true;
int bg_color = g_DrawBgColor;
panel->PrintPage( dc, m_Print_Sheet_Ref, 0xFFFFFFFF, false );
panel->PrintPage( dc, m_Print_Sheet_Ref, 0xFFFFFFFF, false, NULL );
g_DrawBgColor = bg_color;
screen->m_IsPrinting = false;

View File

@ -104,20 +104,22 @@ void WinEDA_SchematicFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
* PrintPage
* used to print a page.
* Print the page pointed by ActiveScreen, set by the calling print function
* @param DC = wxDC given by the calling print function
* @param Print_Sheet_Ref = true to print page references
* @param PrintMask = not used here
* @param aDC = wxDC given by the calling print function
* @param aPrint_Sheet_Ref = true to print page references
* @param aPrintMask = not used here
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not used here)
*/
void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref,
int PrintMask, bool aPrintMirrorMode )
void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref,
int aPrintMask, bool aPrintMirrorMode,
void * aData)
{
wxBeginBusyCursor();
RedrawStructList( this, DC, ActiveScreen->EEDrawList, GR_COPY );
RedrawStructList( this, aDC, ActiveScreen->EEDrawList, GR_COPY );
if( Print_Sheet_Ref )
m_Parent->TraceWorkSheet( DC, ActiveScreen, g_DrawDefaultLineThickness );
if( aPrint_Sheet_Ref )
m_Parent->TraceWorkSheet( aDC, ActiveScreen, g_DrawDefaultLineThickness );
wxEndBusyCursor();
}

View File

@ -25,11 +25,17 @@ static void Draw_Track_Buffer( WinEDA_DrawPanel* panel,
static void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC,
BOARD* Pcb, int drawmode );
/************************************************************************************************************/
void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmasklayer, bool aPrintMirrorMode )
/*************************************************************************************************************/
/* Draw gerbview layers, for printing
*/
/** Function PrintPage
* Used to print the board (on printer, or when creating SVF files).
* Print the board, but only layers allowed by aPrintMaskLayer
* @param aDC = the print device context
* @param aPrint_Sheet_Ref = true to print frame references
* @param aPrint_Sheet_Ref = a 32 bits mask: bit n = 1 -> layer n is printed
* @param aPrintMirrorMode = true to plot mirrored
* @param aData = a pointer to an optional data (not used here: can be NULL)
*/
void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintmasklayer,
bool aPrintMirrorMode, void * aData )
{
DISPLAY_OPTIONS save_opt;
int DisplayPolygonsModeImg;
@ -46,10 +52,10 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
m_PrintIsMirrored = aPrintMirrorMode;
( (WinEDA_GerberFrame*) m_Parent )->Trace_Gerber( DC, GR_COPY, printmasklayer );
( (WinEDA_GerberFrame*) m_Parent )->Trace_Gerber( aDC, GR_COPY, aPrintmasklayer );
if( Print_Sheet_Ref )
m_Parent->TraceWorkSheet( DC, GetScreen(), 0 );
if( aPrint_Sheet_Ref )
m_Parent->TraceWorkSheet( aDC, GetScreen(), 0 );
m_PrintIsMirrored = false;
@ -178,7 +184,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
// Draw tracks and flashes down here. This will probably not be a final solution to drawing order issues
Draw_Track_Buffer( DrawPanel, DC, GetBoard(), draw_mode, printmasklayer );
SetPenMinWidth( tmp );
if( DisplayOpt.DisplayPadNum )

View File

@ -83,10 +83,20 @@ public:
void OnPaint( wxPaintEvent& event );
void OnSize( wxSizeEvent& event );
void PrintPage( wxDC* DC,
bool Print_Sheet_Ref,
int PrintMask,
bool aPrintMirrorMode );
/** Function PrintPage
* Used to print the board (on printer, or when creating SVF files).
* Print the board, but only layers allowed by aPrintMaskLayer
* @param aDC = the print device context
* @param aPrint_Sheet_Ref = true to print frame references
* @param aPrint_Sheet_Ref = a 32 bits mask: bit n = 1 -> layer n is printed
* @param aPrintMirrorMode = true to plot mirrored
* @param aData = a pointer to an optional data (NULL if not used)
*/
void PrintPage( wxDC* aDC,
bool aPrint_Sheet_Ref,
int aPrintMask,
bool aPrintMirrorMode,
void* aData );
void DrawBackGround( wxDC* DC );
void DrawAuxiliaryAxis( wxDC* DC, int drawmode );
void OnEraseBackground( wxEraseEvent& event );

View File

@ -263,7 +263,7 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
SetLocaleTo_C_standard(); // Switch the locale to standard C (needed
// to print floating point numbers like
// 1.3)
panel->PrintPage( &dc, aPrint_Framet_Ref, m_PrintMaskLayer, false );
panel->PrintPage( &dc, aPrint_Framet_Ref, m_PrintMaskLayer, false, NULL );
SetLocaleTo_Default(); // revert to the current locale
screen->m_IsPrinting = false;
panel->m_ClipBox = tmp;

View File

@ -186,6 +186,9 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
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);
int tmp;
m_Config->Read( OPTKEY_PRINT_PADS_DRILL, &tmp, PRINT_PARAMETERS::SMALL_DRILL_SHAPE );
s_Parameters.m_DrillShapeOpt = (PRINT_PARAMETERS::DrillShapeOptT) tmp;
// Test for a reasonnable scale value. Set to 1 if problem
if( s_Parameters.m_XScaleAdjust < MIN_SCALE ||
@ -220,6 +223,8 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
m_Exclude_Edges_Pcb->SetValue(m_ExcludeEdgeLayer);
m_Print_Sheet_Ref->SetValue( s_Parameters.m_Print_Sheet_Ref );
// Options to plot pads and vias holes
m_Drill_Shape_Opt->SetSelection( s_Parameters.m_DrillShapeOpt );
if( s_Parameters.m_Print_Black_and_White )
m_ModeColorOption->SetSelection( 1 );
@ -286,6 +291,7 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
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_MONOCHROME_MODE, s_Parameters.m_Print_Black_and_White);
m_Config->Write( OPTKEY_PRINT_PADS_DRILL, (long) s_Parameters.m_DrillShapeOpt );
wxString layerKey;
for( int layer = 0; layer < NB_LAYERS; ++layer )
{
@ -308,6 +314,9 @@ void DIALOG_PRINT_USING_PRINTER::SetPrintParameters( )
s_Parameters.m_Print_Black_and_White =
m_ModeColorOption->GetSelection() != 0;
s_Parameters.m_DrillShapeOpt =
(PRINT_PARAMETERS::DrillShapeOptT) m_Drill_Shape_Opt->GetSelection();
if( m_PagesOption )
s_Parameters.m_OptionPrintPage = m_PagesOption->GetSelection() != 0;

View File

@ -46,7 +46,7 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
wxString m_ScaleOptionChoices[] = { _("fit in page"), _("Scale 0.5"), _("Scale 0.7"), _("Approx. Scale 1"), _("Accurate Scale 1"), _("Scale 1.4"), _("Scale 2"), _("Scale 3"), _("Scale 4") };
int m_ScaleOptionNChoices = sizeof( m_ScaleOptionChoices ) / sizeof( wxString );
m_ScaleOption = new wxRadioBox( this, wxID_ANY, _("Approx. Scale:"), wxDefaultPosition, wxDefaultSize, m_ScaleOptionNChoices, m_ScaleOptionChoices, 1, wxRA_SPECIFY_COLS );
m_ScaleOption->SetSelection( 3 );
m_ScaleOption->SetSelection( 4 );
bmiddleLeftSizer->Add( m_ScaleOption, 0, wxALL, 5 );
m_FineAdjustXscaleTitle = new wxStaticText( this, wxID_ANY, _("X Scale Adjust"), wxDefaultPosition, wxDefaultSize, 0 );
@ -89,7 +89,7 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
m_Print_Sheet_Ref->SetToolTip( _("Print (or not) the Frame references.") );
sbOptionsSizer->Add( m_Print_Sheet_Ref, 0, wxALL, 5 );
sbOptionsSizer->Add( m_Print_Sheet_Ref, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_Print_Mirror = new wxCheckBox( this, wxID_ANY, _("Mirror"), wxDefaultPosition, wxDefaultSize, 0 );
@ -97,6 +97,12 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
bmiddleRightSizer->Add( sbOptionsSizer, 0, wxEXPAND|wxALL, 5 );
wxString m_Drill_Shape_OptChoices[] = { _("No drill mark"), _("Small mark"), _("Real drill") };
int m_Drill_Shape_OptNChoices = sizeof( m_Drill_Shape_OptChoices ) / sizeof( wxString );
m_Drill_Shape_Opt = new wxRadioBox( this, wxID_ANY, _("Pads Drill Opt"), wxDefaultPosition, wxDefaultSize, m_Drill_Shape_OptNChoices, m_Drill_Shape_OptChoices, 1, wxRA_SPECIFY_COLS );
m_Drill_Shape_Opt->SetSelection( 1 );
bmiddleRightSizer->Add( m_Drill_Shape_Opt, 0, wxALL|wxEXPAND, 5 );
wxString m_ModeColorOptionChoices[] = { _("Color"), _("Black and white") };
int m_ModeColorOptionNChoices = sizeof( m_ModeColorOptionChoices ) / sizeof( wxString );
m_ModeColorOption = new wxRadioBox( this, wxID_PRINT_MODE, _("Print Mode"), wxDefaultPosition, wxDefaultSize, m_ModeColorOptionNChoices, m_ModeColorOptionChoices, 1, wxRA_SPECIFY_COLS );
@ -105,30 +111,36 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
bmiddleRightSizer->Add( m_ModeColorOption, 0, wxALL|wxEXPAND, 5 );
wxString m_PagesOptionChoices[] = { _("1 Page per Layer"), _("Single page") };
int m_PagesOptionNChoices = sizeof( m_PagesOptionChoices ) / sizeof( wxString );
m_PagesOption = new wxRadioBox( this, wxID_PAGE_MODE, _("Page Print"), wxDefaultPosition, wxDefaultSize, m_PagesOptionNChoices, m_PagesOptionChoices, 1, wxRA_SPECIFY_COLS );
m_PagesOption->SetSelection( 0 );
bmiddleRightSizer->Add( m_PagesOption, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( bmiddleRightSizer, 0, wxEXPAND, 5 );
wxBoxSizer* bbuttonsSizer;
bbuttonsSizer = new wxBoxSizer( wxVERTICAL );
wxString m_PagesOptionChoices[] = { _("1 Page per Layer"), _("Single page") };
int m_PagesOptionNChoices = sizeof( m_PagesOptionChoices ) / sizeof( wxString );
m_PagesOption = new wxRadioBox( this, wxID_PAGE_MODE, _("Page Print"), wxDefaultPosition, wxDefaultSize, m_PagesOptionNChoices, m_PagesOptionChoices, 1, wxRA_SPECIFY_COLS );
m_PagesOption->SetSelection( 0 );
bbuttonsSizer->Add( m_PagesOption, 0, wxALL|wxEXPAND, 5 );
bbuttonsSizer->Add( 0, 0, 1, wxEXPAND, 5 );
m_buttonOption = new wxButton( this, wxID_PRINT_OPTIONS, _("Page Options"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonOption, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
bbuttonsSizer->Add( m_buttonOption, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_buttonPreview = new wxButton( this, wxID_PREVIEW, _("Preview"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonPreview, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
bbuttonsSizer->Add( m_buttonPreview, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_buttonPrint = new wxButton( this, wxID_PRINT_ALL, _("Print"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonPrint, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
bbuttonsSizer->Add( m_buttonPrint, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_buttonQuit = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonQuit, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
bbuttonsSizer->Add( m_buttonQuit, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
bMainSizer->Add( bbuttonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
bbuttonsSizer->Add( 0, 0, 1, wxEXPAND, 5 );
bMainSizer->Add( bbuttonsSizer, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();

View File

@ -32,7 +32,7 @@
<property name="minimum_size">-1,-1</property>
<property name="name">DIALOG_PRINT_USING_PRINTER_base</property>
<property name="pos"></property>
<property name="size">551,314</property>
<property name="size">551,315</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="title">Print</property>
@ -209,7 +209,7 @@
<property name="name">m_ScaleOption</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="selection">3</property>
<property name="selection">4</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
@ -586,7 +586,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="bg"></property>
@ -690,6 +690,60 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxRadioBox" expanded="1">
<property name="bg"></property>
<property name="choices">&quot;No drill mark&quot; &quot;Small mark&quot; &quot;Real drill&quot;</property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Pads Drill Opt</property>
<property name="majorDimension">1</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_Drill_Shape_Opt</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="selection">1</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRadioBox"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
@ -744,6 +798,17 @@
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bbuttonsSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
@ -798,20 +863,19 @@
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bbuttonsSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
@ -863,7 +927,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
@ -915,7 +979,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
@ -967,7 +1031,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
@ -1017,6 +1081,16 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
</object>
</object>
</object>

View File

@ -55,13 +55,16 @@ class DIALOG_PRINT_USING_PRINTER_base : public wxDialog
wxTextCtrl* m_DialogPenWidth;
wxCheckBox* m_Print_Sheet_Ref;
wxCheckBox* m_Print_Mirror;
wxRadioBox* m_Drill_Shape_Opt;
wxRadioBox* m_ModeColorOption;
wxRadioBox* m_PagesOption;
wxButton* m_buttonOption;
wxButton* m_buttonPreview;
wxButton* m_buttonPrint;
wxButton* m_buttonQuit;
// Virtual event handlers, overide them in your derived class
virtual void OnCloseWindow( wxCloseEvent& event ){ event.Skip(); }
virtual void OnPrintSetup( wxCommandEvent& event ){ event.Skip(); }
@ -71,7 +74,7 @@ class DIALOG_PRINT_USING_PRINTER_base : public wxDialog
public:
DIALOG_PRINT_USING_PRINTER_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Print"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 551,314 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_PRINT_USING_PRINTER_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Print"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 551,315 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PRINT_USING_PRINTER_base();
};

View File

@ -15,6 +15,7 @@
#define OPTKEY_PRINT_MODULE_SCALE wxT( "PrintModuleScale" )
#define OPTKEY_PRINT_PAGE_FRAME wxT( "PrintPageFrame" )
#define OPTKEY_PRINT_MONOCHROME_MODE wxT( "PrintMonochrome" )
#define OPTKEY_PRINT_PADS_DRILL wxT( "PrintPadsDrillOpt" )
/* Conversion unit constants. */
/* Convert pcb dimension of 0.1 mil to PS units of inches. */
@ -22,6 +23,9 @@
/* Convert dimension 0.1 mil -> HPGL units: */
#define SCALE_HPGL 0.102041
// Small drill marks diameter value (in internal value = 1/10000 inch)
#define SMALL_DRILL 150
/* Plot Options : */
class PCB_Plot_Options
{

View File

@ -1003,7 +1003,6 @@ void WinEDA_BasePcbFrame::PlotDrillMark( PLOTTER* aPlotter,
GRTraceMode aTraceMode,
bool aSmallDrillShape )
{
const int SMALL_DRILL = 150;
wxPoint pos;
wxSize diam;
MODULE* Module;

View File

@ -10,22 +10,29 @@
#include "pcbnew.h"
#include "class_board_design_settings.h"
#include "pcbplot.h"
#include "printout_controler.h"
#include "protos.h"
static void Print_Module( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module,
int draw_mode, int masklayer );
static void Print_Module( WinEDA_DrawPanel* aPanel, wxDC* aDC, MODULE* aModule,
int aDraw_mode, int aMasklayer,
PRINT_PARAMETERS::DrillShapeOptT aDrillShapeOpt );
/** Function PrintPage
* Used to print the board (on printer, or when creating SVF files).
* Print the board, but only layers allowed by aPrintMaskLayer
* ( printmasklayer is a 32 bits mask: bit n = 1 -> layer n is printed)
* Print the board, but only layers allowed by aPrintMaskLayer
* @param aDC = the print device context
* @param aPrint_Sheet_Ref = true to print frame references
* @param aPrint_Sheet_Ref = a 32 bits mask: bit n = 1 -> layer n is printed
* @param aPrintMirrorMode = true to plot mirrored
* @param aData = a pointer to an optional data (NULL if not used)
*/
void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
bool aPrint_Sheet_Ref,
int aPrintMaskLayer,
bool aPrintMirrorMode )
bool aPrintMirrorMode,
void * aData)
{
MODULE* Module;
int drawmode = GR_COPY;
@ -33,6 +40,11 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
TRACK* pt_piste;
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) m_Parent;
BOARD* Pcb = frame->GetBoard();
PRINT_PARAMETERS * printParameters = (PRINT_PARAMETERS*) aData; // can be null
PRINT_PARAMETERS::DrillShapeOptT drillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE;
if( printParameters )
drillShapeOpt = printParameters->m_DrillShapeOpt;
save_opt = DisplayOpt;
if( aPrintMaskLayer & ALL_CU_LAYERS )
@ -101,14 +113,11 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
int rayon = pt_piste->m_Width >> 1;
int color = g_DesignSettings.m_ViaColor[pt_piste->m_Shape];
GRSetDrawMode( aDC, drawmode );
GRFilledCircle( &m_ClipBox,
aDC,
GRFilledCircle( &m_ClipBox, aDC,
pt_piste->m_Start.x,
pt_piste->m_Start.y,
rayon,
0,
color,
color );
0, color, color );
}
else
pt_piste->Draw( this, aDC, drawmode );
@ -138,36 +147,38 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
Module = (MODULE*) Pcb->m_Modules;
for( ; Module != NULL; Module = Module->Next() )
{
Print_Module( this, aDC, Module, drawmode, aPrintMaskLayer );
Print_Module( this, aDC, Module, drawmode, aPrintMaskLayer, drillShapeOpt );
}
/* Print via holes in bg color: Not sure it is good for buried or blind
* vias */
pt_piste = Pcb->m_Track;
int color = g_DrawBgColor;
bool blackpenstate = GetGRForceBlackPenState();
GRForceBlackPen( false );
GRSetDrawMode( aDC, GR_COPY );
for( ; pt_piste != NULL; pt_piste = pt_piste->Next() )
if( drillShapeOpt != PRINT_PARAMETERS::NO_DRILL_SHAPE )
{
if( ( aPrintMaskLayer & pt_piste->ReturnMaskLayer() ) == 0 )
continue;
if( pt_piste->Type() == TYPE_VIA ) /* VIA encountered. */
pt_piste = Pcb->m_Track;
int color = g_DrawBgColor;
bool blackpenstate = GetGRForceBlackPenState();
GRForceBlackPen( false );
GRSetDrawMode( aDC, GR_COPY );
for( ; pt_piste != NULL; pt_piste = pt_piste->Next() )
{
int rayon = pt_piste->GetDrillValue() / 2;
GRFilledCircle( &m_ClipBox,
aDC,
pt_piste->m_Start.x,
pt_piste->m_Start.y,
rayon,
0,
color,
color );
if( ( aPrintMaskLayer & pt_piste->ReturnMaskLayer() ) == 0 )
continue;
if( pt_piste->Type() == TYPE_VIA ) /* VIA encountered. */
{
int diameter;
if( drillShapeOpt == PRINT_PARAMETERS::SMALL_DRILL_SHAPE )
diameter = min( SMALL_DRILL, pt_piste->GetDrillValue());
else
diameter = pt_piste->GetDrillValue();
GRFilledCircle( &m_ClipBox, aDC,
pt_piste->m_Start.x, pt_piste->m_Start.y,
diameter/2,
0, color, color );
}
}
GRForceBlackPen( blackpenstate );
}
GRForceBlackPen( blackpenstate );
if( aPrint_Sheet_Ref )
m_Parent->TraceWorkSheet( aDC, GetScreen(), 10 );
@ -181,8 +192,9 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
}
static void Print_Module( WinEDA_DrawPanel* panel, wxDC* DC,
MODULE* Module, int draw_mode, int masklayer )
static void Print_Module( WinEDA_DrawPanel* aPanel, wxDC* aDC, MODULE* aModule,
int aDraw_mode, int aMasklayer,
PRINT_PARAMETERS::DrillShapeOptT aDrillShapeOpt )
{
D_PAD* pt_pad;
EDA_BaseStruct* PtStruct;
@ -190,42 +202,60 @@ static void Print_Module( WinEDA_DrawPanel* panel, wxDC* DC,
int mlayer;
/* Print pads */
pt_pad = Module->m_Pads;
pt_pad = aModule->m_Pads;
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
{
if( (pt_pad->m_Masque_Layer & masklayer ) == 0 )
if( (pt_pad->m_Masque_Layer & aMasklayer ) == 0 )
continue;
// Usually we draw pads in sketch mode on non copper layers:
if( (masklayer & ALL_CU_LAYERS) == 0 )
if( (aMasklayer & ALL_CU_LAYERS) == 0 )
{
int tmp_fill =
( (WinEDA_BasePcbFrame*) panel->GetParent() )->m_DisplayPadFill;
( (WinEDA_BasePcbFrame*) aPanel->GetParent() )->m_DisplayPadFill;
// Switch in sketch mode
( (WinEDA_BasePcbFrame*) panel->GetParent() )->m_DisplayPadFill = 0;
pt_pad->Draw( panel, DC, draw_mode );
( (WinEDA_BasePcbFrame*) panel->GetParent() )->m_DisplayPadFill =
( (WinEDA_BasePcbFrame*) aPanel->GetParent() )->m_DisplayPadFill = 0;
pt_pad->Draw( aPanel, aDC, aDraw_mode );
( (WinEDA_BasePcbFrame*) aPanel->GetParent() )->m_DisplayPadFill =
tmp_fill;
}
else // on copper layer, draw pads according to current options
pt_pad->Draw( panel, DC, draw_mode );
{
// Manage hole according to the print drill option
wxSize drill_tmp = pt_pad->m_Drill;
switch ( aDrillShapeOpt )
{
case PRINT_PARAMETERS::NO_DRILL_SHAPE:
pt_pad->m_Drill = wxSize(0,0);
break;
case PRINT_PARAMETERS::SMALL_DRILL_SHAPE:
pt_pad->m_Drill.x = MIN(SMALL_DRILL,pt_pad->m_Drill.x);
pt_pad->m_Drill.y = MIN(SMALL_DRILL,pt_pad->m_Drill.y);
break;
case PRINT_PARAMETERS::FULL_DRILL_SHAPE:
// Do nothing
break;
}
pt_pad->Draw( aPanel, aDC, aDraw_mode );
pt_pad->m_Drill = drill_tmp;
}
}
/* Print footprint graphic shapes */
PtStruct = Module->m_Drawings;
mlayer = g_TabOneLayerMask[Module->GetLayer()];
if( Module->GetLayer() == LAYER_N_BACK )
PtStruct = aModule->m_Drawings;
mlayer = g_TabOneLayerMask[aModule->GetLayer()];
if( aModule->GetLayer() == LAYER_N_BACK )
mlayer = SILKSCREEN_LAYER_BACK;
else if( Module->GetLayer() == LAYER_N_FRONT )
else if( aModule->GetLayer() == LAYER_N_FRONT )
mlayer = SILKSCREEN_LAYER_FRONT;
if( mlayer & masklayer )
if( mlayer & aMasklayer )
{
if( !Module->m_Reference->m_NoShow )
Module->m_Reference->Draw( panel, DC, draw_mode );
if( !Module->m_Value->m_NoShow )
Module->m_Value->Draw( panel, DC, draw_mode );
if( !aModule->m_Reference->m_NoShow )
aModule->m_Reference->Draw( aPanel, aDC, aDraw_mode );
if( !aModule->m_Value->m_NoShow )
aModule->m_Value->Draw( aPanel, aDC, aDraw_mode );
}
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
@ -233,19 +263,19 @@ static void Print_Module( WinEDA_DrawPanel* panel, wxDC* DC,
switch( PtStruct->Type() )
{
case TYPE_TEXTE_MODULE:
if( (mlayer & masklayer ) == 0 )
if( (mlayer & aMasklayer ) == 0 )
break;
TextMod = (TEXTE_MODULE*) PtStruct;
TextMod->Draw( panel, DC, draw_mode );
TextMod->Draw( aPanel, aDC, aDraw_mode );
break;
case TYPE_EDGE_MODULE:
{
EDGE_MODULE* edge = (EDGE_MODULE*) PtStruct;
if( ( g_TabOneLayerMask[edge->GetLayer()] & masklayer ) == 0 )
if( ( g_TabOneLayerMask[edge->GetLayer()] & aMasklayer ) == 0 )
break;
edge->Draw( panel, DC, draw_mode );
edge->Draw( aPanel, aDC, aDraw_mode );
break;
}

View File

@ -31,6 +31,7 @@ PRINT_PARAMETERS::PRINT_PARAMETERS()
m_PageCount = 1;
m_ForceCentered = false;
m_Flags = 0;
m_DrillShapeOpt = PRINT_PARAMETERS::SMALL_DRILL_SHAPE;
}
@ -282,13 +283,13 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
* 2 - Plot in OR mode on black "local" background
*/
if( !m_PrintParams.m_Print_Black_and_White )
{
{ // Creates a "local" black background
GRForceBlackPen( true );
panel->PrintPage( dc, 0, m_PrintParams.m_PrintMaskLayer, printMirror );
panel->PrintPage( dc, 0, m_PrintParams.m_PrintMaskLayer, printMirror, &m_PrintParams );
GRForceBlackPen( false );
}
panel->PrintPage( dc, 0, m_PrintParams.m_PrintMaskLayer, printMirror );
panel->PrintPage( dc, 0, m_PrintParams.m_PrintMaskLayer, printMirror, &m_PrintParams );
g_DrawBgColor = bg_color;
m_Parent->GetBaseScreen()->m_IsPrinting = false;

View File

@ -31,6 +31,13 @@ public:
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
enum DrillShapeOptT {
NO_DRILL_SHAPE = 0,
SMALL_DRILL_SHAPE = 1,
FULL_DRILL_SHAPE = 2
};
DrillShapeOptT m_DrillShapeOpt; // Options to print pads and vias holes
public:
PRINT_PARAMETERS();
};