From d4bd033a8e8649d787d58d29b9483d54c5d85762 Mon Sep 17 00:00:00 2001 From: charras Date: Sat, 9 Jan 2010 20:25:39 +0000 Subject: [PATCH] Pcbnew: print dialog: added pads drill option (like in plot dialog) --- common/copy_to_clipboard.cpp | 2 +- eeschema/dialog_SVG_print.cpp | 2 +- eeschema/dialog_print_using_printer.cpp | 2 +- eeschema/eeredraw.cpp | 18 +-- gerbview/tracepcb.cpp | 24 ++-- include/class_drawpanel.h | 18 ++- pcbnew/dialog_SVG_print.cpp | 2 +- pcbnew/dialog_print_using_printer.cpp | 9 ++ pcbnew/dialog_print_using_printer_base.cpp | 38 ++++-- pcbnew/dialog_print_using_printer_base.fbp | 110 +++++++++++++--- pcbnew/dialog_print_using_printer_base.h | 5 +- pcbnew/pcbplot.h | 4 + pcbnew/plot_rtn.cpp | 1 - pcbnew/print_board_functions.cpp | 138 +++++++++++++-------- pcbnew/printout_controler.cpp | 7 +- pcbnew/printout_controler.h | 7 ++ 16 files changed, 272 insertions(+), 115 deletions(-) diff --git a/common/copy_to_clipboard.cpp b/common/copy_to_clipboard.cpp index 6fbde75102..fc81cc67d8 100644 --- a/common/copy_to_clipboard.cpp +++ b/common/copy_to_clipboard.cpp @@ -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(); diff --git a/eeschema/dialog_SVG_print.cpp b/eeschema/dialog_SVG_print.cpp index 50e0a75a05..2df901891c 100644 --- a/eeschema/dialog_SVG_print.cpp +++ b/eeschema/dialog_SVG_print.cpp @@ -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; diff --git a/eeschema/dialog_print_using_printer.cpp b/eeschema/dialog_print_using_printer.cpp index ec81498988..b219bd44c2 100644 --- a/eeschema/dialog_print_using_printer.cpp +++ b/eeschema/dialog_print_using_printer.cpp @@ -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; diff --git a/eeschema/eeredraw.cpp b/eeschema/eeredraw.cpp index 3ff9e474d3..7b3eb1acde 100644 --- a/eeschema/eeredraw.cpp +++ b/eeschema/eeredraw.cpp @@ -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(); } diff --git a/gerbview/tracepcb.cpp b/gerbview/tracepcb.cpp index 113acb2d01..0fb75a6d75 100644 --- a/gerbview/tracepcb.cpp +++ b/gerbview/tracepcb.cpp @@ -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 ) diff --git a/include/class_drawpanel.h b/include/class_drawpanel.h index a3e05cce41..7553256935 100644 --- a/include/class_drawpanel.h +++ b/include/class_drawpanel.h @@ -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 ); diff --git a/pcbnew/dialog_SVG_print.cpp b/pcbnew/dialog_SVG_print.cpp index 2f6b4ccf06..a75310b71a 100644 --- a/pcbnew/dialog_SVG_print.cpp +++ b/pcbnew/dialog_SVG_print.cpp @@ -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; diff --git a/pcbnew/dialog_print_using_printer.cpp b/pcbnew/dialog_print_using_printer.cpp index f830fc0d41..90d43d01d2 100644 --- a/pcbnew/dialog_print_using_printer.cpp +++ b/pcbnew/dialog_print_using_printer.cpp @@ -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; diff --git a/pcbnew/dialog_print_using_printer_base.cpp b/pcbnew/dialog_print_using_printer_base.cpp index d971b90efe..0d5e142ce5 100644 --- a/pcbnew/dialog_print_using_printer_base.cpp +++ b/pcbnew/dialog_print_using_printer_base.cpp @@ -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(); diff --git a/pcbnew/dialog_print_using_printer_base.fbp b/pcbnew/dialog_print_using_printer_base.fbp index 22903d549d..20a3dfe796 100644 --- a/pcbnew/dialog_print_using_printer_base.fbp +++ b/pcbnew/dialog_print_using_printer_base.fbp @@ -32,7 +32,7 @@ -1,-1 DIALOG_PRINT_USING_PRINTER_base - 551,314 + 551,315 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER Print @@ -209,7 +209,7 @@ m_ScaleOption protected - 3 + 4 wxRA_SPECIFY_COLS @@ -586,7 +586,7 @@ 5 - wxALL + wxTOP|wxRIGHT|wxLEFT 0 @@ -690,6 +690,60 @@ + + 5 + wxALL|wxEXPAND + 0 + + + "No drill mark" "Small mark" "Real drill" + + 1 + + + 0 + wxID_ANY + Pads Drill Opt + 1 + + + m_Drill_Shape_Opt + protected + + 1 + + wxRA_SPECIFY_COLS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 wxALL|wxEXPAND @@ -744,6 +798,17 @@ + + + + 5 + wxALIGN_CENTER_VERTICAL|wxEXPAND + 0 + + + bbuttonsSizer + wxVERTICAL + none 5 wxALL|wxEXPAND @@ -798,20 +863,19 @@ - - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - - bbuttonsSizer - wxVERTICAL - none 5 - wxALL|wxALIGN_CENTER_HORIZONTAL + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND 0 @@ -863,7 +927,7 @@ 5 - wxALL|wxALIGN_CENTER_HORIZONTAL + wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND 0 @@ -915,7 +979,7 @@ 5 - wxALL|wxALIGN_CENTER_HORIZONTAL + wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND 0 @@ -967,7 +1031,7 @@ 5 - wxALL|wxALIGN_CENTER_HORIZONTAL + wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND 0 @@ -1017,6 +1081,16 @@ + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + diff --git a/pcbnew/dialog_print_using_printer_base.h b/pcbnew/dialog_print_using_printer_base.h index d3b503deed..e35763c944 100644 --- a/pcbnew/dialog_print_using_printer_base.h +++ b/pcbnew/dialog_print_using_printer_base.h @@ -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(); }; diff --git a/pcbnew/pcbplot.h b/pcbnew/pcbplot.h index 5e2b0b177d..cd44d2bd3a 100644 --- a/pcbnew/pcbplot.h +++ b/pcbnew/pcbplot.h @@ -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 { diff --git a/pcbnew/plot_rtn.cpp b/pcbnew/plot_rtn.cpp index 9de4222698..9de56b9eaf 100644 --- a/pcbnew/plot_rtn.cpp +++ b/pcbnew/plot_rtn.cpp @@ -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; diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp index 3fe9c21ba5..1ca8d286ec 100644 --- a/pcbnew/print_board_functions.cpp +++ b/pcbnew/print_board_functions.cpp @@ -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; } diff --git a/pcbnew/printout_controler.cpp b/pcbnew/printout_controler.cpp index 26045fa249..7d5d78d251 100644 --- a/pcbnew/printout_controler.cpp +++ b/pcbnew/printout_controler.cpp @@ -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; diff --git a/pcbnew/printout_controler.h b/pcbnew/printout_controler.h index 1de0e191d2..e785bb052e 100644 --- a/pcbnew/printout_controler.h +++ b/pcbnew/printout_controler.h @@ -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(); };