diff --git a/common/copy_to_clipboard.cpp b/common/copy_to_clipboard.cpp index fc81cc67d8..ddd4d919a7 100644 --- a/common/copy_to_clipboard.cpp +++ b/common/copy_to_clipboard.cpp @@ -15,9 +15,6 @@ #include "confirm.h" #include "wxstruct.h" - -extern BASE_SCREEN* ActiveScreen; - static const bool s_PlotBlackAndWhite = FALSE; static const bool Print_Sheet_Ref = TRUE; @@ -63,23 +60,23 @@ bool DrawPage( WinEDA_DrawPanel* panel ) /* scale is the ratio resolution/internal units */ float scale = 82.0 / panel->GetParent()->m_InternalUnits; - if( ActiveScreen->m_BlockLocate.m_Command != BLOCK_IDLE ) + if( screen->m_BlockLocate.m_Command != BLOCK_IDLE ) { DrawBlock = TRUE; - DrawArea.SetX( ActiveScreen->m_BlockLocate.GetX() ); - DrawArea.SetY( ActiveScreen->m_BlockLocate.GetY() ); - DrawArea.SetWidth( ActiveScreen->m_BlockLocate.GetWidth() ); - DrawArea.SetHeight( ActiveScreen->m_BlockLocate.GetHeight() ); + DrawArea.SetX( screen->m_BlockLocate.GetX() ); + DrawArea.SetY( screen->m_BlockLocate.GetY() ); + DrawArea.SetWidth( screen->m_BlockLocate.GetWidth() ); + DrawArea.SetHeight( screen->m_BlockLocate.GetHeight() ); } /* Change frames and local settings. */ - tmp_startvisu = ActiveScreen->m_StartVisu; - tmpzoom = ActiveScreen->GetZoom(); - old_org = ActiveScreen->m_DrawOrg; - ActiveScreen->m_DrawOrg.x = ActiveScreen->m_DrawOrg.y = 0; - ActiveScreen->m_StartVisu.x = ActiveScreen->m_StartVisu.y = 0; + tmp_startvisu = screen->m_StartVisu; + tmpzoom = screen->GetZoom(); + old_org = screen->m_DrawOrg; + screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0; + screen->m_StartVisu.x = screen->m_StartVisu.y = 0; - ActiveScreen->SetZoom( 1 ); + screen->SetZoom( 1 ); wxMetafileDC dc /*(wxT(""), DrawArea.GetWidth(), DrawArea.GetHeight())*/; @@ -112,11 +109,10 @@ bool DrawPage( WinEDA_DrawPanel* panel ) GRForceBlackPen( FALSE ); - SetPenMinWidth( 1 ); - ActiveScreen->m_StartVisu = tmp_startvisu; - ActiveScreen->m_DrawOrg = old_org; - ActiveScreen->SetZoom( tmpzoom ); + screen->m_StartVisu = tmp_startvisu; + screen->m_DrawOrg = old_org; + screen->SetZoom( tmpzoom ); #endif return success; diff --git a/common/gr_basic.cpp b/common/gr_basic.cpp index 27cb5b211f..1251c59929 100644 --- a/common/gr_basic.cpp +++ b/common/gr_basic.cpp @@ -63,8 +63,6 @@ extern BASE_SCREEN* ActiveScreen; static int GRLastMoveToX, GRLastMoveToY; -static int PenMinWidth = 1; /* minimum pen width (must be> 0) - * (Useful for printing) */ static bool ForceBlackPen; /* if true: draws in black instead of * color for printing. */ static int xcliplo = 0, @@ -524,27 +522,14 @@ void GRResetPenAndBrush( wxDC* DC ) } -void SetPenMinWidth( int minwidth ) -{ - PenMinWidth = minwidth; - if( PenMinWidth < 0 ) - PenMinWidth = 0; -} - -int GetPenMinWidth( ) -{ - return PenMinWidth; -} - - /** * Function GRSetColorPen * sets a pen style, width, color, and alpha into the given device context. */ void GRSetColorPen( wxDC* DC, int Color, int width, int style ) { - if( width < PenMinWidth ) - width = PenMinWidth; + if( width < 0 ) + width = 0; if( ForceBlackPen ) { @@ -656,28 +641,6 @@ void GRSPutPixel( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int Color ) } -int GRGetPixel( wxDC* DC, int x, int y ) -{ - wxColour colour; - unsigned char r, g, b; - int ii; - - DC->GetPixel( (long) x, (long) y, &colour ); - r = colour.Red(); - b = colour.Blue(); - g = colour.Green(); - for( ii = 0; ii < NBCOLOR; ii++ ) - { - if( ( r == ColorRefs[ii].m_Red ) - && ( g == ColorRefs[ii].m_Green ) - && ( b == ColorRefs[ii].m_Blue ) ) - break; - } - - return ii; -} - - /* * Draw a line, in object space. */ @@ -962,11 +925,18 @@ void GRSLineRel( EDA_Rect* ClipBox, /* * Draw segment with rounded ends in object space. */ +void GRCSegm( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, + int width, int aPenSize, int Color ) +{ + GRSCSegm( ClipBox, DC, GRMapX( x1 ), GRMapY( y1 ), GRMapX( x2 ), + GRMapY( y2 ), ZoomValue( width ), ZoomValue( aPenSize ), Color ); +} + void GRCSegm( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, int Color ) { GRSCSegm( ClipBox, DC, GRMapX( x1 ), GRMapY( y1 ), GRMapX( x2 ), - GRMapY( y2 ), ZoomValue( width ), Color ); + GRMapY( y2 ), ZoomValue( width ), 0, Color ); } @@ -1007,6 +977,7 @@ void GRSCSegm( EDA_Rect* ClipBox, int x2, int y2, int width, + int aPenSize, int Color ) { long radius; @@ -1049,7 +1020,7 @@ void GRSCSegm( EDA_Rect* ClipBox, return; } - GRSetColorPen( DC, Color ); + GRSetColorPen( DC, Color, aPenSize ); GRSetBrush( DC, Color, FALSE ); radius = (width + 1) >> 1; diff --git a/eeschema/class_libentry_fields.h b/eeschema/class_libentry_fields.h index e1c61a8df9..d3e847942b 100644 --- a/eeschema/class_libentry_fields.h +++ b/eeschema/class_libentry_fields.h @@ -120,6 +120,7 @@ public: { m_FieldId = field.m_FieldId; m_Text = field.m_Text; + m_Name = field.m_Name; m_Pos = field.m_Pos; m_Size = field.m_Size; m_Width = field.m_Width; diff --git a/eeschema/dialog_SVG_print.cpp b/eeschema/dialog_SVG_print.cpp index 2df901891c..478a9fed4d 100644 --- a/eeschema/dialog_SVG_print.cpp +++ b/eeschema/dialog_SVG_print.cpp @@ -226,7 +226,6 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, GRResetPenAndBrush( &dc ); g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits ); - SetPenMinWidth( g_DrawDefaultLineThickness ); GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? FALSE : true ); @@ -245,7 +244,6 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, GRForceBlackPen( FALSE ); - SetPenMinWidth( 1 ); screen->m_StartVisu = tmp_startvisu; screen->m_DrawOrg = old_org; diff --git a/gerbview/dialog_print_using_printer.cpp b/gerbview/dialog_print_using_printer.cpp index ac65e998a1..9694d075c7 100644 --- a/gerbview/dialog_print_using_printer.cpp +++ b/gerbview/dialog_print_using_printer.cpp @@ -207,7 +207,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) else m_ModeColorOption->SetSelection( 0 ); - s_Parameters.m_PenMinSize = 0; + s_Parameters.m_PenDefaultSize = 0; // Create scale adjust option msg.Printf( wxT( "%f" ), s_Parameters.m_XScaleAdjust ); diff --git a/gerbview/tracepcb.cpp b/gerbview/tracepcb.cpp index ecdbb8ecb7..e267b7f50b 100644 --- a/gerbview/tracepcb.cpp +++ b/gerbview/tracepcb.cpp @@ -125,9 +125,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay // minimize reallocations of the vector's internal array by starting with a good sized one. points.reserve(10000); - int tmp = GetPenMinWidth( ); - SetPenMinWidth(0 ); - for( TRACK* track = GetBoard()->m_Zone; track; track = track->Next() ) + for( TRACK* track = GetBoard()->m_Zone; track; track = track->Next() ) { if( !(track->ReturnMaskLayer() & printmasklayer) ) continue; @@ -187,8 +185,6 @@ 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( IsElementVisible( DCODES_VISIBLE) ) Affiche_DCodes_Pistes( DrawPanel, DC, GetBoard(), GR_COPY ); diff --git a/include/gr_basic.h b/include/gr_basic.h index 5c7bf522cf..14be00ba8e 100644 --- a/include/gr_basic.h +++ b/include/gr_basic.h @@ -56,8 +56,6 @@ void GRForceBlackPen( bool flagforce ); * @return ForceBlackPen (True if a black pen was forced) */ bool GetGRForceBlackPenState( void ); -void SetPenMinWidth( int minwidth ); -int GetPenMinWidth( ); void GRSPutPixel( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int color ); void GRSFilledRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, @@ -199,10 +197,14 @@ void GRSFilledArc( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int StAngle, int EndAngle, int r, int width, int Color, int BgColor ); void GRCSegm( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, int Color ); +void GRCSegm( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, + int width, int aPenSize, int Color ); void GRFillCSegm( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, int Color ); +void GRCSegm( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, + int width, int aPenSize, int Color ); void GRSCSegm( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, - int width, int Color ); + int width, int aPenSize, int Color ); void GRSFillCSegm( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, int Color ); @@ -210,7 +212,6 @@ void GRSetColor( int Color ); void GRSetDefaultPalette(); int GRGetColor(); void GRPutPixel( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int color ); -int GRGetPixel( wxDC* DC, int x, int y ); void GRFilledRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int Color, int BgColor ); void GRFilledRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index 839c222e93..042295752e 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -12,6 +12,8 @@ #include "pcbnew_id.h" // ID_TRACK_BUTT #include "class_board_design_settings.h" +int D_PAD::m_PadSketchModePenSize = 0; // Pen size used to draw pads in sketch mode + D_PAD::D_PAD( MODULE* parent ) : BOARD_CONNECTED_ITEM( parent, TYPE_PAD ) { diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h index 8a0a4715b7..fef7e2b733 100644 --- a/pcbnew/class_pad.h +++ b/pcbnew/class_pad.h @@ -76,6 +76,8 @@ public: int m_Rayon; // radius of pad circle int m_Attribut; // NORMAL, PAD_SMD, PAD_CONN int m_Orient; // in 1/10 degrees + static int m_PadSketchModePenSize; // Pen size used to draw pads in sketch mode + // (mode used to print pads on silkscreen layer) // Local clearance. When null, the module default value is used. // when the module default value is null, the netclass value is used diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp index 8cc9326e0b..015fa6b2b7 100644 --- a/pcbnew/class_pad_draw_functions.cpp +++ b/pcbnew/class_pad_draw_functions.cpp @@ -290,7 +290,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, dx + mask_margin.x, 0, color, color ); else GRCircle( &panel->m_ClipBox, DC, xc, yc, dx + mask_margin.x, - 0, color ); + m_PadSketchModePenSize, color ); if( DisplayIsol ) { @@ -331,7 +331,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, GRCSegm( &panel->m_ClipBox, DC, ux0 + delta_cx, uy0 + delta_cy, ux0 - delta_cx, uy0 - delta_cy, - rotdx, color ); + rotdx, m_PadSketchModePenSize, color ); } /* Draw the isolation line. */ @@ -371,7 +371,8 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, coord[ii].y = coord[ii].y + uy0; } - GRClosedPoly( &panel->m_ClipBox, DC, 4, coord, fillpad, color, color ); + GRClosedPoly( &panel->m_ClipBox, DC, 4, coord, fillpad, + fillpad ? 0 : m_PadSketchModePenSize, color, color ); if( DisplayIsol ) { diff --git a/pcbnew/dialog_SVG_print.cpp b/pcbnew/dialog_SVG_print.cpp index a75310b71a..f268b554ea 100644 --- a/pcbnew/dialog_SVG_print.cpp +++ b/pcbnew/dialog_SVG_print.cpp @@ -18,6 +18,7 @@ #include "pcbnew.h" #include "pcbplot.h" +#include "printout_controler.h" // Keys for configuration #define PLOTSVGMODECOLOR_KEY wxT( "PlotSVGModeColor" ) @@ -27,9 +28,7 @@ #define WIDTH_MIN_VALUE 1 // Local variables: -static int s_PrintPenMinWidth = 1; -static bool s_Print_Frame_Ref = true; -static int s_PlotBlackAndWhite = 0; +static PRINT_PARAMETERS s_Parameters; static long s_SelectedLayers = LAYER_BACK | LAYER_FRONT | SILKSCREEN_LAYER_FRONT | SILKSCREEN_LAYER_BACK; @@ -54,9 +53,9 @@ private: void OnButtonCancelClick( wxCommandEvent& event ); void OnSetColorModeSelected( wxCommandEvent& event ); void SetPenWidth(); - void PrintSVGDoc( bool aPrintAll, bool aPrint_Framet_Ref ); + void PrintSVGDoc( bool aPrintAll, bool aPrint_Frame_Ref ); bool DrawPage( const wxString& FullFileName, BASE_SCREEN* screen, - bool aPrint_Framet_Ref ); + bool aPrint_Frame_Ref ); }; @@ -89,16 +88,16 @@ void DIALOG_SVG_PRINT::OnInitDialog( wxInitDialogEvent& event ) m_ImageXSize_mm = 270; if( m_Config ) { - m_Config->Read( OPTKEY_PLOT_LINEWIDTH_VALUE, &s_PrintPenMinWidth ); - m_Config->Read( PLOTSVGMODECOLOR_KEY, &s_PlotBlackAndWhite ); + m_Config->Read( OPTKEY_PLOT_LINEWIDTH_VALUE, &s_Parameters.m_PenDefaultSize ); + m_Config->Read( PLOTSVGMODECOLOR_KEY, &s_Parameters.m_Print_Black_and_White ); } AddUnitSymbol( *m_TextPenWidth, g_UnitMetric ); m_DialogPenWidth->SetValue( - ReturnStringFromValue( g_UnitMetric, s_PrintPenMinWidth, + ReturnStringFromValue( g_UnitMetric, s_Parameters.m_PenDefaultSize, m_Parent->m_InternalUnits ) ); - m_Print_Frame_Ref_Ctrl->SetValue( s_Print_Frame_Ref ); + m_Print_Frame_Ref_Ctrl->SetValue( s_Parameters.m_Print_Sheet_Ref ); // Create layers list BOARD* board = m_Parent->GetBoard(); @@ -147,26 +146,26 @@ void DIALOG_SVG_PRINT::OnInitDialog( wxInitDialogEvent& event ) void DIALOG_SVG_PRINT::SetPenWidth() { - s_PrintPenMinWidth = ReturnValueFromTextCtrl( *m_DialogPenWidth, + s_Parameters.m_PenDefaultSize = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits ); - if( s_PrintPenMinWidth > WIDTH_MAX_VALUE ) + if( s_Parameters.m_PenDefaultSize > WIDTH_MAX_VALUE ) { - s_PrintPenMinWidth = WIDTH_MAX_VALUE; + s_Parameters.m_PenDefaultSize = WIDTH_MAX_VALUE; } - if( s_PrintPenMinWidth < WIDTH_MIN_VALUE ) + if( s_Parameters.m_PenDefaultSize < WIDTH_MIN_VALUE ) { - s_PrintPenMinWidth = WIDTH_MIN_VALUE; + s_Parameters.m_PenDefaultSize = WIDTH_MIN_VALUE; } m_DialogPenWidth->SetValue( - ReturnStringFromValue( g_UnitMetric, s_PrintPenMinWidth, + ReturnStringFromValue( g_UnitMetric, s_Parameters.m_PenDefaultSize, m_Parent->m_InternalUnits ) ); } -void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Framet_Ref ) +void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Frame_Ref ) { wxFileName fn; wxString msg; @@ -203,7 +202,7 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Framet_Ref ) fn.SetExt( wxT( "svg" ) ); - bool success = DrawPage( fn.GetFullPath(), screen, aPrint_Framet_Ref ); + bool success = DrawPage( fn.GetFullPath(), screen, aPrint_Frame_Ref ); msg = _( "Create file " ) + fn.GetFullPath(); if( !success ) msg += _( " error" ); @@ -221,7 +220,7 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Framet_Ref ) */ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, BASE_SCREEN* screen, - bool aPrint_Framet_Ref ) + bool aPrint_Frame_Ref ) { int tmpzoom; wxPoint tmp_startvisu; @@ -249,10 +248,10 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, EDA_Rect tmp = panel->m_ClipBox; GRResetPenAndBrush( &dc ); - s_PrintPenMinWidth = ReturnValueFromTextCtrl( *m_DialogPenWidth, + s_Parameters.m_PenDefaultSize = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits ); - SetPenMinWidth( s_PrintPenMinWidth ); GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? FALSE : true ); + s_Parameters.m_DrillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE; panel->m_ClipBox.SetX( 0 ); panel->m_ClipBox.SetY( 0 ); @@ -263,13 +262,12 @@ 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, NULL ); + panel->PrintPage( &dc, aPrint_Frame_Ref, m_PrintMaskLayer, false, &s_Parameters); SetLocaleTo_Default(); // revert to the current locale screen->m_IsPrinting = false; panel->m_ClipBox = tmp; GRForceBlackPen( FALSE ); - SetPenMinWidth( 1 ); screen->m_StartVisu = tmp_startvisu; screen->m_DrawOrg = old_org; @@ -281,15 +279,15 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, void DIALOG_SVG_PRINT::OnButtonPrintBoardClick( wxCommandEvent& event ) { - s_Print_Frame_Ref = m_Print_Frame_Ref_Ctrl->IsChecked(); - PrintSVGDoc( true, s_Print_Frame_Ref ); + s_Parameters.m_Print_Sheet_Ref = m_Print_Frame_Ref_Ctrl->IsChecked(); + PrintSVGDoc( true, s_Parameters.m_Print_Sheet_Ref ); } void DIALOG_SVG_PRINT::OnButtonPrintSelectedClick( wxCommandEvent& event ) { - s_Print_Frame_Ref = m_Print_Frame_Ref_Ctrl->IsChecked(); - PrintSVGDoc( false, s_Print_Frame_Ref ); + s_Parameters.m_Print_Sheet_Ref = m_Print_Frame_Ref_Ctrl->IsChecked(); + PrintSVGDoc( false, s_Parameters.m_Print_Sheet_Ref ); } @@ -302,11 +300,11 @@ void DIALOG_SVG_PRINT::OnButtonCancelClick( wxCommandEvent& event ) void DIALOG_SVG_PRINT::OnCloseWindow( wxCloseEvent& event ) { SetPenWidth(); - s_PlotBlackAndWhite = m_ModeColorOption->GetSelection(); + s_Parameters.m_Print_Black_and_White = m_ModeColorOption->GetSelection(); if( m_Config ) { - m_Config->Write( OPTKEY_PLOT_LINEWIDTH_VALUE, s_PrintPenMinWidth ); - m_Config->Write( PLOTSVGMODECOLOR_KEY, s_PlotBlackAndWhite ); + m_Config->Write( OPTKEY_PLOT_LINEWIDTH_VALUE, s_Parameters.m_PenDefaultSize ); + m_Config->Write( PLOTSVGMODECOLOR_KEY, s_Parameters.m_Print_Black_and_White ); wxString layerKey; for( int layer = 0; layerGetSelection(); + s_Parameters.m_Print_Black_and_White = m_ModeColorOption->GetSelection(); } diff --git a/pcbnew/dialog_print_for_modedit.cpp b/pcbnew/dialog_print_for_modedit.cpp index e27eccf143..d8de32b469 100644 --- a/pcbnew/dialog_print_for_modedit.cpp +++ b/pcbnew/dialog_print_for_modedit.cpp @@ -49,7 +49,6 @@ private: void OnPrintButtonClick( wxCommandEvent& event ); void OnButtonCancelClick( wxCommandEvent& event ) { Close(); } - void SetPenWidth(); void InitValues( ); }; @@ -103,7 +102,7 @@ void DIALOG_PRINT_FOR_MODEDIT::InitValues( ) int scale_Select = 3; // default selected scale = ScaleList[3] = 1 if( m_Config ) { - m_Config->Read( OPTKEY_PLOT_LINEWIDTH_VALUE, &s_Parameters.m_PenMinSize ); + m_Config->Read( OPTKEY_PLOT_LINEWIDTH_VALUE, &s_Parameters.m_PenDefaultSize ); m_Config->Read( OPTKEY_PRINT_MODULE_SCALE, &scale_Select ); m_Config->Read( OPTKEY_PRINT_MONOCHROME_MODE, &s_Parameters.m_Print_Black_and_White, 1); } @@ -112,10 +111,6 @@ void DIALOG_PRINT_FOR_MODEDIT::InitValues( ) if( s_Parameters.m_Print_Black_and_White ) m_ModeColorOption->SetSelection( 1 ); - - AddUnitSymbol( *m_TextPenWidth, g_UnitMetric ); - m_DialogPenWidth->SetValue( - ReturnStringFromValue( g_UnitMetric, s_Parameters.m_PenMinSize, m_Parent->m_InternalUnits ) ); } @@ -123,11 +118,8 @@ void DIALOG_PRINT_FOR_MODEDIT::InitValues( ) void DIALOG_PRINT_FOR_MODEDIT::OnCloseWindow( wxCloseEvent& event ) /********************************************************************/ { - SetPenWidth(); - if( m_Config ) { - m_Config->Write( OPTKEY_PLOT_LINEWIDTH_VALUE, s_Parameters.m_PenMinSize ); m_Config->Write( OPTKEY_PRINT_MODULE_SCALE, m_ScaleOption->GetSelection() ); m_Config->Write( OPTKEY_PRINT_MONOCHROME_MODE, s_Parameters.m_Print_Black_and_White); } @@ -135,32 +127,6 @@ void DIALOG_PRINT_FOR_MODEDIT::OnCloseWindow( wxCloseEvent& event ) } -/**********************************************/ - -void DIALOG_PRINT_FOR_MODEDIT::SetPenWidth() -/***********************************************/ - -/* Get the new pen width value, and verify min et max value - * NOTE: s_Parameters.m_PenMinSize is in internal units - */ -{ - s_Parameters.m_PenMinSize = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits ); - - if( s_Parameters.m_PenMinSize > WIDTH_MAX_VALUE ) - { - s_Parameters.m_PenMinSize = WIDTH_MAX_VALUE; - } - - if( s_Parameters.m_PenMinSize < WIDTH_MIN_VALUE ) - { - s_Parameters.m_PenMinSize = WIDTH_MIN_VALUE; - } - - m_DialogPenWidth->SetValue( - ReturnStringFromValue( g_UnitMetric, s_Parameters.m_PenMinSize, m_Parent->m_InternalUnits ) ); -} - - /**********************************************************/ void DIALOG_PRINT_FOR_MODEDIT::OnPrintSetup( wxCommandEvent& event ) /**********************************************************/ @@ -188,8 +154,6 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintPreview( wxCommandEvent& event ) /* Open and display a previewer frame for printing */ { - SetPenWidth(); - s_Parameters.m_Print_Black_and_White = m_ModeColorOption->GetSelection(); s_Parameters.m_PrintScale = s_ScaleList[m_ScaleOption->GetSelection()]; @@ -225,7 +189,6 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintButtonClick( wxCommandEvent& event ) /* Called on activate Print button */ { - SetPenWidth(); s_Parameters.m_Print_Black_and_White = m_ModeColorOption->GetSelection(); s_Parameters.m_PrintScale = s_ScaleList[m_ScaleOption->GetSelection()]; diff --git a/pcbnew/dialog_print_for_modedit_base.cpp b/pcbnew/dialog_print_for_modedit_base.cpp index 046c550272..d588b0a46a 100644 --- a/pcbnew/dialog_print_for_modedit_base.cpp +++ b/pcbnew/dialog_print_for_modedit_base.cpp @@ -30,23 +30,6 @@ DIALOG_PRINT_FOR_MODEDIT_BASE::DIALOG_PRINT_FOR_MODEDIT_BASE( wxWindow* parent, wxBoxSizer* bmiddleRightSizer; bmiddleRightSizer = new wxBoxSizer( wxVERTICAL ); - wxStaticBoxSizer* sbOptionsSizer; - sbOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL ); - - m_TextPenWidth = new wxStaticText( this, wxID_ANY, _("Pen Width Mini"), wxDefaultPosition, wxDefaultSize, 0 ); - m_TextPenWidth->Wrap( -1 ); - sbOptionsSizer->Add( m_TextPenWidth, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_DialogPenWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_DialogPenWidth->SetToolTip( _("Selection of the minimum pen thickness used to draw items.") ); - - sbOptionsSizer->Add( m_DialogPenWidth, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - - bmiddleRightSizer->Add( sbOptionsSizer, 0, wxEXPAND|wxALL, 5 ); - - - bmiddleRightSizer->Add( 10, 10, 0, 0, 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 ); @@ -55,7 +38,7 @@ DIALOG_PRINT_FOR_MODEDIT_BASE::DIALOG_PRINT_FOR_MODEDIT_BASE( wxWindow* parent, bmiddleRightSizer->Add( m_ModeColorOption, 0, wxALL|wxEXPAND, 5 ); - bMainSizer->Add( bmiddleRightSizer, 0, wxEXPAND, 5 ); + bMainSizer->Add( bmiddleRightSizer, 1, 0, 5 ); wxBoxSizer* bbuttonsSizer; bbuttonsSizer = new wxBoxSizer( wxVERTICAL ); @@ -72,14 +55,13 @@ DIALOG_PRINT_FOR_MODEDIT_BASE::DIALOG_PRINT_FOR_MODEDIT_BASE( wxWindow* parent, m_buttonQuit = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); bbuttonsSizer->Add( m_buttonQuit, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - bMainSizer->Add( bbuttonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bMainSizer->Add( bbuttonsSizer, 0, 0, 5 ); this->SetSizer( bMainSizer ); this->Layout(); // Connect Events this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnCloseWindow ) ); - m_ScaleOption->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::SetScale ), NULL, this ); m_buttonOption->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPrintSetup ), NULL, this ); m_buttonPreview->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPrintPreview ), NULL, this ); m_buttonPrint->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPrintButtonClick ), NULL, this ); @@ -90,7 +72,6 @@ DIALOG_PRINT_FOR_MODEDIT_BASE::~DIALOG_PRINT_FOR_MODEDIT_BASE() { // Disconnect Events this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnCloseWindow ) ); - m_ScaleOption->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::SetScale ), NULL, this ); m_buttonOption->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPrintSetup ), NULL, this ); m_buttonPreview->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPrintPreview ), NULL, this ); m_buttonPrint->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPrintButtonClick ), NULL, this ); diff --git a/pcbnew/dialog_print_for_modedit_base.fbp b/pcbnew/dialog_print_for_modedit_base.fbp index 89d6c74a16..37543a774c 100644 --- a/pcbnew/dialog_print_for_modedit_base.fbp +++ b/pcbnew/dialog_print_for_modedit_base.fbp @@ -32,7 +32,7 @@ -1,-1 DIALOG_PRINT_FOR_MODEDIT_BASE - 369,250 + 375,254 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER Print @@ -142,143 +142,13 @@ 5 - wxEXPAND - 0 + + 1 bmiddleRightSizer wxVERTICAL none - - 5 - wxEXPAND|wxALL - 0 - - wxID_ANY - Options: - - sbOptionsSizer - wxVERTICAL - none - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - Pen Width Mini - - - m_TextPenWidth - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND - 0 - - - - 1 - - - 0 - wxID_ANY - - 0 - -1,-1 - m_DialogPenWidth - protected - - - - - Selection of the minimum pen thickness used to draw items. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - - 0 - - 10 - protected - 10 - - 5 wxALL|wxEXPAND @@ -337,7 +207,7 @@ 5 - wxALIGN_CENTER_VERTICAL + 0 diff --git a/pcbnew/dialog_print_for_modedit_base.h b/pcbnew/dialog_print_for_modedit_base.h index 325dda3502..7a0afa910a 100644 --- a/pcbnew/dialog_print_for_modedit_base.h +++ b/pcbnew/dialog_print_for_modedit_base.h @@ -17,9 +17,6 @@ #include #include #include -#include -#include -#include #include #include @@ -41,9 +38,6 @@ class DIALOG_PRINT_FOR_MODEDIT_BASE : public wxDialog }; wxRadioBox* m_ScaleOption; - wxStaticText* m_TextPenWidth; - wxTextCtrl* m_DialogPenWidth; - wxRadioBox* m_ModeColorOption; wxButton* m_buttonOption; wxButton* m_buttonPreview; @@ -52,7 +46,6 @@ class DIALOG_PRINT_FOR_MODEDIT_BASE : public wxDialog // Virtual event handlers, overide them in your derived class virtual void OnCloseWindow( wxCloseEvent& event ){ event.Skip(); } - virtual void SetScale( wxCommandEvent& event ){ event.Skip(); } virtual void OnPrintSetup( wxCommandEvent& event ){ event.Skip(); } virtual void OnPrintPreview( wxCommandEvent& event ){ event.Skip(); } virtual void OnPrintButtonClick( wxCommandEvent& event ){ event.Skip(); } @@ -60,7 +53,7 @@ class DIALOG_PRINT_FOR_MODEDIT_BASE : public wxDialog public: - DIALOG_PRINT_FOR_MODEDIT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Print"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 369,250 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_PRINT_FOR_MODEDIT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Print"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 375,254 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_PRINT_FOR_MODEDIT_BASE(); }; diff --git a/pcbnew/dialog_print_using_printer.cpp b/pcbnew/dialog_print_using_printer.cpp index 39c2ae0bd4..cbda306f6a 100644 --- a/pcbnew/dialog_print_using_printer.cpp +++ b/pcbnew/dialog_print_using_printer.cpp @@ -190,7 +190,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) if( m_Config ) { - m_Config->Read( OPTKEY_PLOT_LINEWIDTH_VALUE, &s_Parameters.m_PenMinSize ); + m_Config->Read( OPTKEY_PLOT_LINEWIDTH_VALUE, &s_Parameters.m_PenDefaultSize ); 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 ); @@ -243,7 +243,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) AddUnitSymbol( *m_TextPenWidth, g_UnitMetric ); m_DialogPenWidth->SetValue( - ReturnStringFromValue( g_UnitMetric, s_Parameters.m_PenMinSize, m_Parent->m_InternalUnits ) ); + ReturnStringFromValue( g_UnitMetric, s_Parameters.m_PenDefaultSize, m_Parent->m_InternalUnits ) ); // Create scale adjust option @@ -321,7 +321,7 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event ) if( m_Config ) { - m_Config->Write( OPTKEY_PLOT_LINEWIDTH_VALUE, s_Parameters.m_PenMinSize ); + m_Config->Write( OPTKEY_PLOT_LINEWIDTH_VALUE, s_Parameters.m_PenDefaultSize ); m_Config->Write( OPTKEY_PRINT_X_FINESCALE_ADJ, s_Parameters.m_XScaleAdjust ); m_Config->Write( OPTKEY_PRINT_Y_FINESCALE_ADJ, s_Parameters.m_YScaleAdjust ); m_Config->Write( OPTKEY_PRINT_SCALE, m_ScaleOption->GetSelection() ); @@ -389,23 +389,23 @@ void DIALOG_PRINT_USING_PRINTER::SetPenWidth() /***********************************************/ /* Get the new pen width value, and verify min et max value - * NOTE: s_Parameters.m_PenMinSize is in internal units + * NOTE: s_Parameters.m_PenDefaultSize is in internal units */ { - s_Parameters.m_PenMinSize = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits ); + s_Parameters.m_PenDefaultSize = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits ); - if( s_Parameters.m_PenMinSize > WIDTH_MAX_VALUE ) + if( s_Parameters.m_PenDefaultSize > WIDTH_MAX_VALUE ) { - s_Parameters.m_PenMinSize = WIDTH_MAX_VALUE; + s_Parameters.m_PenDefaultSize = WIDTH_MAX_VALUE; } - if( s_Parameters.m_PenMinSize < WIDTH_MIN_VALUE ) + if( s_Parameters.m_PenDefaultSize < WIDTH_MIN_VALUE ) { - s_Parameters.m_PenMinSize = WIDTH_MIN_VALUE; + s_Parameters.m_PenDefaultSize = WIDTH_MIN_VALUE; } m_DialogPenWidth->SetValue( - ReturnStringFromValue( g_UnitMetric, s_Parameters.m_PenMinSize, m_Parent->m_InternalUnits ) ); + ReturnStringFromValue( g_UnitMetric, s_Parameters.m_PenDefaultSize, m_Parent->m_InternalUnits ) ); } diff --git a/pcbnew/dialog_print_using_printer_base.cpp b/pcbnew/dialog_print_using_printer_base.cpp index 0d5e142ce5..90678f16ff 100644 --- a/pcbnew/dialog_print_using_printer_base.cpp +++ b/pcbnew/dialog_print_using_printer_base.cpp @@ -75,13 +75,13 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare wxStaticBoxSizer* sbOptionsSizer; sbOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL ); - m_TextPenWidth = new wxStaticText( this, wxID_ANY, _("Pen Width Mini"), wxDefaultPosition, wxDefaultSize, 0 ); + m_TextPenWidth = new wxStaticText( this, wxID_ANY, _("Default Pen Size:"), wxDefaultPosition, wxDefaultSize, 0 ); m_TextPenWidth->Wrap( -1 ); + m_TextPenWidth->SetToolTip( _("Pen size used to draw items that have no pen size specified.\nUsed mainly to draw items in sketch mode.") ); + sbOptionsSizer->Add( m_TextPenWidth, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_DialogPenWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_DialogPenWidth->SetToolTip( _("Selection of the minimum pen thickness used to draw items.") ); - sbOptionsSizer->Add( m_DialogPenWidth, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); m_Print_Sheet_Ref = new wxCheckBox( this, wxID_FRAME_SEL, _("Print frame ref"), wxDefaultPosition, wxDefaultSize, 0 ); diff --git a/pcbnew/dialog_print_using_printer_base.fbp b/pcbnew/dialog_print_using_printer_base.fbp index 20a3dfe796..e79b26459c 100644 --- a/pcbnew/dialog_print_using_printer_base.fbp +++ b/pcbnew/dialog_print_using_printer_base.fbp @@ -490,7 +490,7 @@ 0 wxID_ANY - Pen Width Mini + Default Pen Size: m_TextPenWidth @@ -499,7 +499,7 @@ - + Pen size used to draw items that have no pen size specified. Used mainly to draw items in sketch mode. @@ -550,7 +550,7 @@ - Selection of the minimum pen thickness used to draw items. + @@ -1036,7 +1036,7 @@ - 0 + 1 1 diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp index ccad101045..af9207704d 100644 --- a/pcbnew/print_board_functions.cpp +++ b/pcbnew/print_board_functions.cpp @@ -41,11 +41,15 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, TRACK* pt_piste; WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) m_Parent; BOARD* Pcb = frame->GetBoard(); + int defaultPenSize = 50; PRINT_PARAMETERS * printParameters = (PRINT_PARAMETERS*) aData; // can be null PRINT_PARAMETERS::DrillShapeOptT drillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE; if( printParameters ) + { drillShapeOpt = printParameters->m_DrillShapeOpt; + defaultPenSize = printParameters->m_PenDefaultSize; + } save_opt = DisplayOpt; if( aPrintMaskLayer & ALL_CU_LAYERS ) @@ -147,10 +151,13 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, // Draw footprints, this is done at last in order to print the pad holes in // white (or g_DrawBgColor) after the tracks and zones Module = (MODULE*) Pcb->m_Modules; + int tmp = D_PAD::m_PadSketchModePenSize; + D_PAD::m_PadSketchModePenSize = defaultPenSize; for( ; Module != NULL; Module = Module->Next() ) { Print_Module( this, aDC, Module, drawmode, aPrintMaskLayer, drillShapeOpt ); } + D_PAD::m_PadSketchModePenSize = tmp; /* Print via holes in bg color: Not sure it is good for buried or blind * vias */ @@ -182,7 +189,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, } if( aPrint_Sheet_Ref ) - m_Parent->TraceWorkSheet( aDC, GetScreen(), 10 ); + m_Parent->TraceWorkSheet( aDC, GetScreen(), defaultPenSize ); m_PrintIsMirrored = false; @@ -206,6 +213,7 @@ static void Print_Module( WinEDA_DrawPanel* aPanel, wxDC* aDC, MODULE* aModule, /* Print pads */ pt_pad = aModule->m_Pads; + for( ; pt_pad != NULL; pt_pad = pt_pad->Next() ) { if( (pt_pad->m_Masque_Layer & aMasklayer ) == 0 ) diff --git a/pcbnew/printout_controler.cpp b/pcbnew/printout_controler.cpp index 75d04d1188..76c802e860 100644 --- a/pcbnew/printout_controler.cpp +++ b/pcbnew/printout_controler.cpp @@ -19,7 +19,7 @@ // This class is an helper to pass print parameters to print functions PRINT_PARAMETERS::PRINT_PARAMETERS() { - m_PenMinSize = 50; // A reasonnable minimal value to draw items + m_PenDefaultSize = 50; // A reasonnable minimal value to draw items // mainly that do not have a specifed line width m_PrintScale = 1.0; m_XScaleAdjust = m_YScaleAdjust = 1.0; @@ -238,15 +238,13 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() m_Parent->GetBaseScreen()->m_IsPrinting = true; int bg_color = g_DrawBgColor; - SetPenMinWidth( m_PrintParams.m_PenMinSize ); - if( userscale == 1.0 ) { dc->SetUserScale( accurate_Xscale, accurate_Yscale ); } if( m_PrintParams.m_Print_Sheet_Ref ) - m_Parent->TraceWorkSheet( dc, ActiveScreen, 0 ); + m_Parent->TraceWorkSheet( dc, ActiveScreen, m_PrintParams.m_PenDefaultSize ); if( printMirror ) { @@ -300,7 +298,6 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() m_Parent->GetBaseScreen()->m_IsPrinting = false; panel->m_ClipBox = tmp; - SetPenMinWidth( 1 ); GRForceBlackPen( false ); ActiveScreen->m_StartVisu = tmp_startvisu; diff --git a/pcbnew/printout_controler.h b/pcbnew/printout_controler.h index 5d5b178af9..e45ba6b357 100644 --- a/pcbnew/printout_controler.h +++ b/pcbnew/printout_controler.h @@ -19,7 +19,8 @@ class PRINT_PARAMETERS { public: - int m_PenMinSize; // A minimal value pen size to plot/print items + int m_PenDefaultSize; // The defAUlt value pen size to plot/print items + // that have no defined pen size double m_PrintScale; // general scale when printing double m_XScaleAdjust, m_YScaleAdjust; // fine scale adjust for X and Y axis bool m_Print_Sheet_Ref; // Option: pring page references