Commit d4bd033a authored by charras's avatar charras

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

parent cee9ab76
...@@ -99,7 +99,7 @@ bool DrawPage( WinEDA_DrawPanel* panel ) ...@@ -99,7 +99,7 @@ bool DrawPage( WinEDA_DrawPanel* panel )
dc.SetClippingRegion( DrawArea ); dc.SetClippingRegion( DrawArea );
} }
panel->PrintPage( &dc, Print_Sheet_Ref, -1, false ); panel->PrintPage( &dc, Print_Sheet_Ref, -1, false, NULL );
screen->m_IsPrinting = false; screen->m_IsPrinting = false;
panel->m_ClipBox = tmp; panel->m_ClipBox = tmp;
wxMetafile* mf = dc.Close(); wxMetafile* mf = dc.Close();
......
...@@ -238,7 +238,7 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, ...@@ -238,7 +238,7 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
screen->m_IsPrinting = true; screen->m_IsPrinting = true;
SetLocaleTo_C_standard( ); // Switch the locale to standard C (needed SetLocaleTo_C_standard( ); // Switch the locale to standard C (needed
// to print floating point numbers like 1.3) // 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 SetLocaleTo_Default( ); // revert to the current locale
screen->m_IsPrinting = false; screen->m_IsPrinting = false;
panel->m_ClipBox = tmp; panel->m_ClipBox = tmp;
......
...@@ -432,7 +432,7 @@ void EDA_Printout::DrawPage() ...@@ -432,7 +432,7 @@ void EDA_Printout::DrawPage()
screen->m_IsPrinting = true; screen->m_IsPrinting = true;
int bg_color = g_DrawBgColor; 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; g_DrawBgColor = bg_color;
screen->m_IsPrinting = false; screen->m_IsPrinting = false;
......
...@@ -104,20 +104,22 @@ void WinEDA_SchematicFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -104,20 +104,22 @@ void WinEDA_SchematicFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
* PrintPage * PrintPage
* used to print a page. * used to print a page.
* Print the page pointed by ActiveScreen, set by the calling print function * Print the page pointed by ActiveScreen, set by the calling print function
* @param DC = wxDC given by the calling print function * @param aDC = wxDC given by the calling print function
* @param Print_Sheet_Ref = true to print page references * @param aPrint_Sheet_Ref = true to print page references
* @param PrintMask = not used here * @param aPrintMask = not used here
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode) * @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, void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref,
int PrintMask, bool aPrintMirrorMode ) int aPrintMask, bool aPrintMirrorMode,
void * aData)
{ {
wxBeginBusyCursor(); wxBeginBusyCursor();
RedrawStructList( this, DC, ActiveScreen->EEDrawList, GR_COPY ); RedrawStructList( this, aDC, ActiveScreen->EEDrawList, GR_COPY );
if( Print_Sheet_Ref ) if( aPrint_Sheet_Ref )
m_Parent->TraceWorkSheet( DC, ActiveScreen, g_DrawDefaultLineThickness ); m_Parent->TraceWorkSheet( aDC, ActiveScreen, g_DrawDefaultLineThickness );
wxEndBusyCursor(); wxEndBusyCursor();
} }
......
...@@ -25,11 +25,17 @@ static void Draw_Track_Buffer( WinEDA_DrawPanel* panel, ...@@ -25,11 +25,17 @@ static void Draw_Track_Buffer( WinEDA_DrawPanel* panel,
static void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, static void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC,
BOARD* Pcb, int drawmode ); BOARD* Pcb, int drawmode );
/************************************************************************************************************/ /** Function PrintPage
void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmasklayer, bool aPrintMirrorMode ) * Used to print the board (on printer, or when creating SVF files).
/*************************************************************************************************************/ * Print the board, but only layers allowed by aPrintMaskLayer
/* Draw gerbview layers, for printing * @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; DISPLAY_OPTIONS save_opt;
int DisplayPolygonsModeImg; int DisplayPolygonsModeImg;
...@@ -46,10 +52,10 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl ...@@ -46,10 +52,10 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
m_PrintIsMirrored = aPrintMirrorMode; 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 ) if( aPrint_Sheet_Ref )
m_Parent->TraceWorkSheet( DC, GetScreen(), 0 ); m_Parent->TraceWorkSheet( aDC, GetScreen(), 0 );
m_PrintIsMirrored = false; m_PrintIsMirrored = false;
...@@ -178,7 +184,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay ...@@ -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 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 ); Draw_Track_Buffer( DrawPanel, DC, GetBoard(), draw_mode, printmasklayer );
SetPenMinWidth( tmp ); SetPenMinWidth( tmp );
if( DisplayOpt.DisplayPadNum ) if( DisplayOpt.DisplayPadNum )
......
...@@ -83,10 +83,20 @@ public: ...@@ -83,10 +83,20 @@ public:
void OnPaint( wxPaintEvent& event ); void OnPaint( wxPaintEvent& event );
void OnSize( wxSizeEvent& event ); void OnSize( wxSizeEvent& event );
void PrintPage( wxDC* DC, /** Function PrintPage
bool Print_Sheet_Ref, * Used to print the board (on printer, or when creating SVF files).
int PrintMask, * Print the board, but only layers allowed by aPrintMaskLayer
bool aPrintMirrorMode ); * @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 DrawBackGround( wxDC* DC );
void DrawAuxiliaryAxis( wxDC* DC, int drawmode ); void DrawAuxiliaryAxis( wxDC* DC, int drawmode );
void OnEraseBackground( wxEraseEvent& event ); void OnEraseBackground( wxEraseEvent& event );
......
...@@ -263,7 +263,7 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, ...@@ -263,7 +263,7 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
SetLocaleTo_C_standard(); // Switch the locale to standard C (needed SetLocaleTo_C_standard(); // Switch the locale to standard C (needed
// to print floating point numbers like // to print floating point numbers like
// 1.3) // 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 SetLocaleTo_Default(); // revert to the current locale
screen->m_IsPrinting = false; screen->m_IsPrinting = false;
panel->m_ClipBox = tmp; panel->m_ClipBox = tmp;
......
...@@ -186,6 +186,9 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) ...@@ -186,6 +186,9 @@ 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);
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 // Test for a reasonnable scale value. Set to 1 if problem
if( s_Parameters.m_XScaleAdjust < MIN_SCALE || if( s_Parameters.m_XScaleAdjust < MIN_SCALE ||
...@@ -220,6 +223,8 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) ...@@ -220,6 +223,8 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
m_Exclude_Edges_Pcb->SetValue(m_ExcludeEdgeLayer); m_Exclude_Edges_Pcb->SetValue(m_ExcludeEdgeLayer);
m_Print_Sheet_Ref->SetValue( s_Parameters.m_Print_Sheet_Ref ); 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 ) if( s_Parameters.m_Print_Black_and_White )
m_ModeColorOption->SetSelection( 1 ); m_ModeColorOption->SetSelection( 1 );
...@@ -286,6 +291,7 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event ) ...@@ -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_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_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 )
{ {
...@@ -308,6 +314,9 @@ void DIALOG_PRINT_USING_PRINTER::SetPrintParameters( ) ...@@ -308,6 +314,9 @@ void DIALOG_PRINT_USING_PRINTER::SetPrintParameters( )
s_Parameters.m_Print_Black_and_White = s_Parameters.m_Print_Black_and_White =
m_ModeColorOption->GetSelection() != 0; m_ModeColorOption->GetSelection() != 0;
s_Parameters.m_DrillShapeOpt =
(PRINT_PARAMETERS::DrillShapeOptT) m_Drill_Shape_Opt->GetSelection();
if( m_PagesOption ) if( m_PagesOption )
s_Parameters.m_OptionPrintPage = m_PagesOption->GetSelection() != 0; s_Parameters.m_OptionPrintPage = m_PagesOption->GetSelection() != 0;
......
...@@ -46,7 +46,7 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare ...@@ -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") }; 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 ); 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 = 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 ); bmiddleLeftSizer->Add( m_ScaleOption, 0, wxALL, 5 );
m_FineAdjustXscaleTitle = new wxStaticText( this, wxID_ANY, _("X Scale Adjust"), wxDefaultPosition, wxDefaultSize, 0 ); 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 ...@@ -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.") ); 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 ); 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 ...@@ -97,6 +97,12 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
bmiddleRightSizer->Add( sbOptionsSizer, 0, wxEXPAND|wxALL, 5 ); 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") }; wxString m_ModeColorOptionChoices[] = { _("Color"), _("Black and white") };
int m_ModeColorOptionNChoices = sizeof( m_ModeColorOptionChoices ) / sizeof( wxString ); 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 ); 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 ...@@ -105,30 +111,36 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
bmiddleRightSizer->Add( m_ModeColorOption, 0, wxALL|wxEXPAND, 5 ); bmiddleRightSizer->Add( m_ModeColorOption, 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") }; wxString m_PagesOptionChoices[] = { _("1 Page per Layer"), _("Single page") };
int m_PagesOptionNChoices = sizeof( m_PagesOptionChoices ) / sizeof( wxString ); 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 = new wxRadioBox( this, wxID_PAGE_MODE, _("Page Print"), wxDefaultPosition, wxDefaultSize, m_PagesOptionNChoices, m_PagesOptionChoices, 1, wxRA_SPECIFY_COLS );
m_PagesOption->SetSelection( 0 ); m_PagesOption->SetSelection( 0 );
bmiddleRightSizer->Add( m_PagesOption, 0, wxALL|wxEXPAND, 5 ); bbuttonsSizer->Add( m_PagesOption, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( bmiddleRightSizer, 0, wxEXPAND, 5 );
wxBoxSizer* bbuttonsSizer; bbuttonsSizer->Add( 0, 0, 1, wxEXPAND, 5 );
bbuttonsSizer = new wxBoxSizer( wxVERTICAL );
m_buttonOption = new wxButton( this, wxID_PRINT_OPTIONS, _("Page Options"), wxDefaultPosition, wxDefaultSize, 0 ); 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 ); 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 ); 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 ); 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 );
bbuttonsSizer->Add( 0, 0, 1, wxEXPAND, 5 );
bMainSizer->Add( bbuttonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 ); bMainSizer->Add( bbuttonsSizer, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
this->SetSizer( bMainSizer ); this->SetSizer( bMainSizer );
this->Layout(); this->Layout();
......
This diff is collapsed.
...@@ -55,13 +55,16 @@ class DIALOG_PRINT_USING_PRINTER_base : public wxDialog ...@@ -55,13 +55,16 @@ class DIALOG_PRINT_USING_PRINTER_base : public wxDialog
wxTextCtrl* m_DialogPenWidth; wxTextCtrl* m_DialogPenWidth;
wxCheckBox* m_Print_Sheet_Ref; wxCheckBox* m_Print_Sheet_Ref;
wxCheckBox* m_Print_Mirror; wxCheckBox* m_Print_Mirror;
wxRadioBox* m_Drill_Shape_Opt;
wxRadioBox* m_ModeColorOption; wxRadioBox* m_ModeColorOption;
wxRadioBox* m_PagesOption; wxRadioBox* m_PagesOption;
wxButton* m_buttonOption; wxButton* m_buttonOption;
wxButton* m_buttonPreview; wxButton* m_buttonPreview;
wxButton* m_buttonPrint; wxButton* m_buttonPrint;
wxButton* m_buttonQuit; wxButton* m_buttonQuit;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnCloseWindow( wxCloseEvent& event ){ event.Skip(); } virtual void OnCloseWindow( wxCloseEvent& event ){ event.Skip(); }
virtual void OnPrintSetup( wxCommandEvent& event ){ event.Skip(); } virtual void OnPrintSetup( wxCommandEvent& event ){ event.Skip(); }
...@@ -71,7 +74,7 @@ class DIALOG_PRINT_USING_PRINTER_base : public wxDialog ...@@ -71,7 +74,7 @@ class DIALOG_PRINT_USING_PRINTER_base : public wxDialog
public: 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(); ~DIALOG_PRINT_USING_PRINTER_base();
}; };
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#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_PADS_DRILL wxT( "PrintPadsDrillOpt" )
/* Conversion unit constants. */ /* Conversion unit constants. */
/* Convert pcb dimension of 0.1 mil to PS units of inches. */ /* Convert pcb dimension of 0.1 mil to PS units of inches. */
...@@ -22,6 +23,9 @@ ...@@ -22,6 +23,9 @@
/* Convert dimension 0.1 mil -> HPGL units: */ /* Convert dimension 0.1 mil -> HPGL units: */
#define SCALE_HPGL 0.102041 #define SCALE_HPGL 0.102041
// Small drill marks diameter value (in internal value = 1/10000 inch)
#define SMALL_DRILL 150
/* Plot Options : */ /* Plot Options : */
class PCB_Plot_Options class PCB_Plot_Options
{ {
......
...@@ -1003,7 +1003,6 @@ void WinEDA_BasePcbFrame::PlotDrillMark( PLOTTER* aPlotter, ...@@ -1003,7 +1003,6 @@ void WinEDA_BasePcbFrame::PlotDrillMark( PLOTTER* aPlotter,
GRTraceMode aTraceMode, GRTraceMode aTraceMode,
bool aSmallDrillShape ) bool aSmallDrillShape )
{ {
const int SMALL_DRILL = 150;
wxPoint pos; wxPoint pos;
wxSize diam; wxSize diam;
MODULE* Module; MODULE* Module;
......
...@@ -10,22 +10,29 @@ ...@@ -10,22 +10,29 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "pcbplot.h" #include "pcbplot.h"
#include "printout_controler.h"
#include "protos.h" #include "protos.h"
static void Print_Module( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module, static void Print_Module( WinEDA_DrawPanel* aPanel, wxDC* aDC, MODULE* aModule,
int draw_mode, int masklayer ); int aDraw_mode, int aMasklayer,
PRINT_PARAMETERS::DrillShapeOptT aDrillShapeOpt );
/** Function PrintPage /** Function PrintPage
* Used to print the board (on printer, or when creating SVF files). * Used to print the board (on printer, or when creating SVF files).
* Print the board, but only layers allowed by aPrintMaskLayer * Print the board, but only layers allowed by aPrintMaskLayer
* ( printmasklayer is a 32 bits mask: bit n = 1 -> layer n is printed) * @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, void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
bool aPrint_Sheet_Ref, bool aPrint_Sheet_Ref,
int aPrintMaskLayer, int aPrintMaskLayer,
bool aPrintMirrorMode ) bool aPrintMirrorMode,
void * aData)
{ {
MODULE* Module; MODULE* Module;
int drawmode = GR_COPY; int drawmode = GR_COPY;
...@@ -33,6 +40,11 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, ...@@ -33,6 +40,11 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
TRACK* pt_piste; TRACK* pt_piste;
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) m_Parent; WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) m_Parent;
BOARD* Pcb = frame->GetBoard(); 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; save_opt = DisplayOpt;
if( aPrintMaskLayer & ALL_CU_LAYERS ) if( aPrintMaskLayer & ALL_CU_LAYERS )
...@@ -101,14 +113,11 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, ...@@ -101,14 +113,11 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
int rayon = pt_piste->m_Width >> 1; int rayon = pt_piste->m_Width >> 1;
int color = g_DesignSettings.m_ViaColor[pt_piste->m_Shape]; int color = g_DesignSettings.m_ViaColor[pt_piste->m_Shape];
GRSetDrawMode( aDC, drawmode ); GRSetDrawMode( aDC, drawmode );
GRFilledCircle( &m_ClipBox, GRFilledCircle( &m_ClipBox, aDC,
aDC,
pt_piste->m_Start.x, pt_piste->m_Start.x,
pt_piste->m_Start.y, pt_piste->m_Start.y,
rayon, rayon,
0, 0, color, color );
color,
color );
} }
else else
pt_piste->Draw( this, aDC, drawmode ); pt_piste->Draw( this, aDC, drawmode );
...@@ -138,36 +147,38 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, ...@@ -138,36 +147,38 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
Module = (MODULE*) Pcb->m_Modules; Module = (MODULE*) Pcb->m_Modules;
for( ; Module != NULL; Module = Module->Next() ) 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 /* Print via holes in bg color: Not sure it is good for buried or blind
* vias */ * vias */
pt_piste = Pcb->m_Track; if( drillShapeOpt != PRINT_PARAMETERS::NO_DRILL_SHAPE )
int color = g_DrawBgColor;
bool blackpenstate = GetGRForceBlackPenState();
GRForceBlackPen( false );
GRSetDrawMode( aDC, GR_COPY );
for( ; pt_piste != NULL; pt_piste = pt_piste->Next() )
{ {
if( ( aPrintMaskLayer & pt_piste->ReturnMaskLayer() ) == 0 ) pt_piste = Pcb->m_Track;
continue; int color = g_DrawBgColor;
if( pt_piste->Type() == TYPE_VIA ) /* VIA encountered. */ bool blackpenstate = GetGRForceBlackPenState();
GRForceBlackPen( false );
GRSetDrawMode( aDC, GR_COPY );
for( ; pt_piste != NULL; pt_piste = pt_piste->Next() )
{ {
int rayon = pt_piste->GetDrillValue() / 2; if( ( aPrintMaskLayer & pt_piste->ReturnMaskLayer() ) == 0 )
GRFilledCircle( &m_ClipBox, continue;
aDC, if( pt_piste->Type() == TYPE_VIA ) /* VIA encountered. */
pt_piste->m_Start.x, {
pt_piste->m_Start.y, int diameter;
rayon, if( drillShapeOpt == PRINT_PARAMETERS::SMALL_DRILL_SHAPE )
0, diameter = min( SMALL_DRILL, pt_piste->GetDrillValue());
color, else
color ); 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 ) if( aPrint_Sheet_Ref )
m_Parent->TraceWorkSheet( aDC, GetScreen(), 10 ); m_Parent->TraceWorkSheet( aDC, GetScreen(), 10 );
...@@ -181,8 +192,9 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, ...@@ -181,8 +192,9 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
} }
static void Print_Module( WinEDA_DrawPanel* panel, wxDC* DC, static void Print_Module( WinEDA_DrawPanel* aPanel, wxDC* aDC, MODULE* aModule,
MODULE* Module, int draw_mode, int masklayer ) int aDraw_mode, int aMasklayer,
PRINT_PARAMETERS::DrillShapeOptT aDrillShapeOpt )
{ {
D_PAD* pt_pad; D_PAD* pt_pad;
EDA_BaseStruct* PtStruct; EDA_BaseStruct* PtStruct;
...@@ -190,42 +202,60 @@ static void Print_Module( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -190,42 +202,60 @@ static void Print_Module( WinEDA_DrawPanel* panel, wxDC* DC,
int mlayer; int mlayer;
/* Print pads */ /* Print pads */
pt_pad = Module->m_Pads; pt_pad = aModule->m_Pads;
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() ) 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; continue;
// Usually we draw pads in sketch mode on non copper layers: // 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 = int tmp_fill =
( (WinEDA_BasePcbFrame*) panel->GetParent() )->m_DisplayPadFill; ( (WinEDA_BasePcbFrame*) aPanel->GetParent() )->m_DisplayPadFill;
// Switch in sketch mode // Switch in sketch mode
( (WinEDA_BasePcbFrame*) panel->GetParent() )->m_DisplayPadFill = 0; ( (WinEDA_BasePcbFrame*) aPanel->GetParent() )->m_DisplayPadFill = 0;
pt_pad->Draw( panel, DC, draw_mode ); pt_pad->Draw( aPanel, aDC, aDraw_mode );
( (WinEDA_BasePcbFrame*) panel->GetParent() )->m_DisplayPadFill = ( (WinEDA_BasePcbFrame*) aPanel->GetParent() )->m_DisplayPadFill =
tmp_fill; tmp_fill;
} }
else // on copper layer, draw pads according to current options 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 */ /* Print footprint graphic shapes */
PtStruct = Module->m_Drawings; PtStruct = aModule->m_Drawings;
mlayer = g_TabOneLayerMask[Module->GetLayer()]; mlayer = g_TabOneLayerMask[aModule->GetLayer()];
if( Module->GetLayer() == LAYER_N_BACK ) if( aModule->GetLayer() == LAYER_N_BACK )
mlayer = SILKSCREEN_LAYER_BACK; mlayer = SILKSCREEN_LAYER_BACK;
else if( Module->GetLayer() == LAYER_N_FRONT ) else if( aModule->GetLayer() == LAYER_N_FRONT )
mlayer = SILKSCREEN_LAYER_FRONT; mlayer = SILKSCREEN_LAYER_FRONT;
if( mlayer & masklayer ) if( mlayer & aMasklayer )
{ {
if( !Module->m_Reference->m_NoShow ) if( !aModule->m_Reference->m_NoShow )
Module->m_Reference->Draw( panel, DC, draw_mode ); aModule->m_Reference->Draw( aPanel, aDC, aDraw_mode );
if( !Module->m_Value->m_NoShow ) if( !aModule->m_Value->m_NoShow )
Module->m_Value->Draw( panel, DC, draw_mode ); aModule->m_Value->Draw( aPanel, aDC, aDraw_mode );
} }
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
...@@ -233,19 +263,19 @@ static void Print_Module( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -233,19 +263,19 @@ static void Print_Module( WinEDA_DrawPanel* panel, wxDC* DC,
switch( PtStruct->Type() ) switch( PtStruct->Type() )
{ {
case TYPE_TEXTE_MODULE: case TYPE_TEXTE_MODULE:
if( (mlayer & masklayer ) == 0 ) if( (mlayer & aMasklayer ) == 0 )
break; break;
TextMod = (TEXTE_MODULE*) PtStruct; TextMod = (TEXTE_MODULE*) PtStruct;
TextMod->Draw( panel, DC, draw_mode ); TextMod->Draw( aPanel, aDC, aDraw_mode );
break; break;
case TYPE_EDGE_MODULE: case TYPE_EDGE_MODULE:
{ {
EDGE_MODULE* edge = (EDGE_MODULE*) PtStruct; EDGE_MODULE* edge = (EDGE_MODULE*) PtStruct;
if( ( g_TabOneLayerMask[edge->GetLayer()] & masklayer ) == 0 ) if( ( g_TabOneLayerMask[edge->GetLayer()] & aMasklayer ) == 0 )
break; break;
edge->Draw( panel, DC, draw_mode ); edge->Draw( aPanel, aDC, aDraw_mode );
break; break;
} }
......
...@@ -31,6 +31,7 @@ PRINT_PARAMETERS::PRINT_PARAMETERS() ...@@ -31,6 +31,7 @@ PRINT_PARAMETERS::PRINT_PARAMETERS()
m_PageCount = 1; m_PageCount = 1;
m_ForceCentered = false; m_ForceCentered = false;
m_Flags = 0; m_Flags = 0;
m_DrillShapeOpt = PRINT_PARAMETERS::SMALL_DRILL_SHAPE;
} }
...@@ -282,13 +283,13 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() ...@@ -282,13 +283,13 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
* 2 - Plot in OR mode on black "local" background * 2 - Plot in OR mode on black "local" background
*/ */
if( !m_PrintParams.m_Print_Black_and_White ) if( !m_PrintParams.m_Print_Black_and_White )
{ { // Creates a "local" black background
GRForceBlackPen( true ); GRForceBlackPen( true );
panel->PrintPage( dc, 0, m_PrintParams.m_PrintMaskLayer, printMirror ); panel->PrintPage( dc, 0, m_PrintParams.m_PrintMaskLayer, printMirror, &m_PrintParams );
GRForceBlackPen( false ); 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; g_DrawBgColor = bg_color;
m_Parent->GetBaseScreen()->m_IsPrinting = false; m_Parent->GetBaseScreen()->m_IsPrinting = false;
......
...@@ -31,6 +31,13 @@ public: ...@@ -31,6 +31,13 @@ public:
bool m_ForceCentered; // Forge plot origin to page centre (used in modedit) 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 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: public:
PRINT_PARAMETERS(); PRINT_PARAMETERS();
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment