From 9f35e384c1c4e3a2df0eba6196fe0664031cc5a9 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 1 Aug 2017 12:39:06 +0200 Subject: [PATCH] Pcbnew: fix a few plot issues (from master branch) --- common/common_plotPDF_functions.cpp | 9 +- common/common_plotPS_functions.cpp | 11 +- pcbnew/dialogs/dialog_SVG_print.cpp | 5 - pcbnew/dialogs/dialog_plot.cpp | 68 ++--- pcbnew/dialogs/dialog_plot.h | 10 +- pcbnew/dialogs/dialog_plot_base.cpp | 35 +-- pcbnew/dialogs/dialog_plot_base.fbp | 371 +++++++++++++++------------- pcbnew/dialogs/dialog_plot_base.h | 9 +- pcbnew/pcb_plot_params.cpp | 34 ++- pcbnew/pcb_plot_params.h | 43 ++-- pcbnew/pcbframe.cpp | 14 +- pcbnew/plot_board_layers.cpp | 6 +- pcbnew/plot_brditems_plotter.cpp | 21 +- 13 files changed, 331 insertions(+), 305 deletions(-) diff --git a/common/common_plotPDF_functions.cpp b/common/common_plotPDF_functions.cpp index 331e6d73cd..a95e7def1b 100644 --- a/common/common_plotPDF_functions.cpp +++ b/common/common_plotPDF_functions.cpp @@ -7,7 +7,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 1992-2012 Lorenzo Marcantonio, l.marcantonio@logossrl.com - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -766,7 +766,10 @@ void PDF_PLOTTER::Text( const wxPoint& aPos, aMultilineAllowed = false; // the text has only one line. // Emit native PDF text (if requested) - if( m_textMode != PLOTTEXTMODE_STROKE && !aMultilineAllowed ) + // Currently: does not work: disable it + bool use_native = false; // = m_textMode != PLOTTEXTMODE_STROKE && !aMultilineAllowed; + + if( use_native ) { const char *fontname = aItalic ? (aBold ? "/KicadFontBI" : "/KicadFontI") : (aBold ? "/KicadFontB" : "/KicadFont"); @@ -822,7 +825,7 @@ void PDF_PLOTTER::Text( const wxPoint& aPos, } // Plot the stroked text (if requested) - if( m_textMode != PLOTTEXTMODE_NATIVE || aMultilineAllowed ) + if( !use_native ) { PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic, aBold, aMultilineAllowed ); diff --git a/common/common_plotPS_functions.cpp b/common/common_plotPS_functions.cpp index f02ffc5a4c..bbf9ede85b 100644 --- a/common/common_plotPS_functions.cpp +++ b/common/common_plotPS_functions.cpp @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2017 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -873,7 +873,10 @@ void PS_PLOTTER::Text( const wxPoint& aPos, aMultilineAllowed = false; // the text has only one line. // Draw the native postscript text (if requested) - if( m_textMode == PLOTTEXTMODE_NATIVE && !aMultilineAllowed ) + // Currently: does not work: disable it + bool use_native = false; // = m_textMode == PLOTTEXTMODE_NATIVE && !aMultilineAllowed; + + if( use_native ) { const char *fontname = aItalic ? (aBold ? "/KicadFont-BoldOblique" : "/KicadFont-Oblique") @@ -926,7 +929,7 @@ void PS_PLOTTER::Text( const wxPoint& aPos, } // Draw the stroked text (if requested) - if( m_textMode != PLOTTEXTMODE_NATIVE || aMultilineAllowed ) + if( !use_native ) { PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic, aBold, aMultilineAllowed ); diff --git a/pcbnew/dialogs/dialog_SVG_print.cpp b/pcbnew/dialogs/dialog_SVG_print.cpp index e78fb133ee..1fbe7d04fc 100644 --- a/pcbnew/dialogs/dialog_SVG_print.cpp +++ b/pcbnew/dialogs/dialog_SVG_print.cpp @@ -337,11 +337,6 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName, bool aOnlyO plot_opts.SetMirror( m_printMirror ); plot_opts.SetFormat( PLOT_FORMAT_SVG ); - EDA_COLOR_T color = UNSPECIFIED_COLOR; // Used layer color to plot ref and value - - plot_opts.SetReferenceColor( color ); - plot_opts.SetValueColor( color ); - PAGE_INFO pageInfo = m_board->GetPageSettings(); wxPoint axisorigin = m_board->GetAuxOrigin(); diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index bab8e73cb9..d0065eb87d 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -5,7 +5,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -46,14 +46,14 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) : m_plotOpts( aParent->GetPlotSettings() ) { m_config = Kiface().KifaceSettings(); - Init_Dialog(); + init_Dialog(); GetSizer()->Fit( this ); GetSizer()->SetSizeHints( this ); } -void DIALOG_PLOT::Init_Dialog() +void DIALOG_PLOT::init_Dialog() { wxString msg; wxFileName fileName; @@ -195,10 +195,10 @@ void DIALOG_PLOT::Init_Dialog() setPlotModeChoiceSelection( m_plotOpts.GetPlotMode() ); // Plot outline mode - m_plotOutlineModeOpt->SetValue( m_plotOpts.GetPlotOutlineMode() ); + m_DXF_plotModeOpt->SetValue( m_plotOpts.GetDXFPlotPolygonMode() ); // Plot text mode - m_plotTextAsLineOpt->SetValue( m_plotOpts.GetTextMode() == PLOTTEXTMODE_DEFAULT ); + m_DXF_plotTextStrokeFontOpt->SetValue( m_plotOpts.GetTextMode() == PLOTTEXTMODE_DEFAULT ); // Plot mirror option m_plotMirrorOpt->SetValue( m_plotOpts.GetMirror() ); @@ -294,11 +294,16 @@ void DIALOG_PLOT::CreateDrillFile( wxCommandEvent& event ) } -void DIALOG_PLOT::OnChangeOutlineMode( wxCommandEvent& event ) +void DIALOG_PLOT::OnChangeDXFPlotMode( wxCommandEvent& event ) { - m_plotTextAsLineOpt->Enable( !m_plotOutlineModeOpt->GetValue() ); - if( !m_plotTextAsLineOpt->IsEnabled() ) - m_plotTextAsLineOpt->SetValue( true ); + // m_DXF_plotTextStrokeFontOpt is disabled if m_DXF_plotModeOpt + // is checked (plot in DXF polygon mode) + m_DXF_plotTextStrokeFontOpt->Enable( !m_DXF_plotModeOpt->GetValue() ); + + // if m_DXF_plotTextStrokeFontOpt option is disabled (plot DXF in polygon mode), + // force m_DXF_plotTextStrokeFontOpt to true to use Pcbnew stroke font + if( !m_DXF_plotTextStrokeFontOpt->IsEnabled() ) + m_DXF_plotTextStrokeFontOpt->SetValue( true ); } @@ -369,6 +374,9 @@ PlotFormat DIALOG_PLOT::getPlotFormat() // and clear also some optional values void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) { + // this option exist only in DXF format: + m_DXF_plotModeOpt->Enable( getPlotFormat() == PLOT_FORMAT_DXF ); + switch( getPlotFormat() ) { case PLOT_FORMAT_PDF: @@ -376,8 +384,6 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) m_drillShapeOpt->Enable( true ); m_plotModeOpt->Enable( false ); setPlotModeChoiceSelection( FILLED ); - m_plotOutlineModeOpt->Enable( false ); - m_plotOutlineModeOpt->SetValue( false ); m_plotMirrorOpt->Enable( true ); m_useAuxOriginCheckBox->Enable( false ); m_useAuxOriginCheckBox->SetValue( false ); @@ -399,19 +405,16 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) m_plotPSNegativeOpt->Enable( true ); m_forcePSA4OutputOpt->Enable( false ); m_forcePSA4OutputOpt->SetValue( false ); - m_plotTextAsLineOpt->Enable( false ); - m_plotTextAsLineOpt->SetValue( false ); m_PlotOptionsSizer->Hide( m_GerberOptionsSizer ); m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer ); m_PlotOptionsSizer->Hide( m_PSOptionsSizer ); + m_PlotOptionsSizer->Hide( m_SizerDXF_options ); break; case PLOT_FORMAT_POST: m_drillShapeOpt->Enable( true ); m_plotModeOpt->Enable( true ); - m_plotOutlineModeOpt->Enable( false ); - m_plotOutlineModeOpt->SetValue( false ); m_plotMirrorOpt->Enable( true ); m_useAuxOriginCheckBox->Enable( false ); m_useAuxOriginCheckBox->SetValue( false ); @@ -431,12 +434,11 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) m_PSFineAdjustWidthOpt->Enable( true ); m_plotPSNegativeOpt->Enable( true ); m_forcePSA4OutputOpt->Enable( true ); - m_plotTextAsLineOpt->Enable( false ); - m_plotTextAsLineOpt->SetValue( true ); m_PlotOptionsSizer->Hide( m_GerberOptionsSizer ); m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer ); m_PlotOptionsSizer->Show( m_PSOptionsSizer ); + m_PlotOptionsSizer->Hide( m_SizerDXF_options ); break; case PLOT_FORMAT_GERBER: @@ -444,8 +446,6 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) m_drillShapeOpt->SetSelection( 0 ); m_plotModeOpt->Enable( false ); setPlotModeChoiceSelection( FILLED ); - m_plotOutlineModeOpt->Enable( false ); - m_plotOutlineModeOpt->SetValue( false ); m_plotMirrorOpt->Enable( false ); m_plotMirrorOpt->SetValue( false ); m_useAuxOriginCheckBox->Enable( true ); @@ -465,19 +465,16 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) m_plotPSNegativeOpt->SetValue( false ); m_forcePSA4OutputOpt->Enable( false ); m_forcePSA4OutputOpt->SetValue( false ); - m_plotTextAsLineOpt->Enable( false ); - m_plotTextAsLineOpt->SetValue( true ); m_PlotOptionsSizer->Show( m_GerberOptionsSizer ); m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer ); m_PlotOptionsSizer->Hide( m_PSOptionsSizer ); + m_PlotOptionsSizer->Hide( m_SizerDXF_options ); break; case PLOT_FORMAT_HPGL: m_drillShapeOpt->Enable( true ); m_plotModeOpt->Enable( true ); - m_plotOutlineModeOpt->Enable( false ); - m_plotOutlineModeOpt->SetValue( false ); m_plotMirrorOpt->Enable( true ); m_useAuxOriginCheckBox->Enable( false ); m_useAuxOriginCheckBox->SetValue( false ); @@ -498,19 +495,17 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) m_plotPSNegativeOpt->SetValue( false ); m_plotPSNegativeOpt->Enable( false ); m_forcePSA4OutputOpt->Enable( true ); - m_plotTextAsLineOpt->Enable( false ); - m_plotTextAsLineOpt->SetValue( true ); m_PlotOptionsSizer->Hide( m_GerberOptionsSizer ); m_PlotOptionsSizer->Show( m_HPGLOptionsSizer ); m_PlotOptionsSizer->Hide( m_PSOptionsSizer ); + m_PlotOptionsSizer->Hide( m_SizerDXF_options ); break; case PLOT_FORMAT_DXF: m_drillShapeOpt->Enable( true ); m_plotModeOpt->Enable( false ); setPlotModeChoiceSelection( FILLED ); - m_plotOutlineModeOpt->Enable( true ); m_plotMirrorOpt->Enable( false ); m_plotMirrorOpt->SetValue( false ); m_useAuxOriginCheckBox->Enable( true ); @@ -537,8 +532,9 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) m_PlotOptionsSizer->Hide( m_GerberOptionsSizer ); m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer ); m_PlotOptionsSizer->Hide( m_PSOptionsSizer ); + m_PlotOptionsSizer->Show( m_SizerDXF_options ); - OnChangeOutlineMode( event ); + OnChangeDXFPlotMode( event ); break; default: @@ -612,10 +608,14 @@ void DIALOG_PLOT::applyPlotSettings() ( m_drillShapeOpt->GetSelection() ) ); tempOptions.SetMirror( m_plotMirrorOpt->GetValue() ); tempOptions.SetPlotMode( m_plotModeOpt->GetSelection() == 1 ? SKETCH : FILLED ); - tempOptions.SetPlotOutlineMode( m_plotOutlineModeOpt->GetValue() ); + tempOptions.SetDXFPlotPolygonMode( m_DXF_plotModeOpt->GetValue() ); tempOptions.SetPlotViaOnMaskLayer( m_plotNoViaOnMaskOpt->GetValue() ); - tempOptions.SetTextMode( m_plotTextAsLineOpt->GetValue() ? - PLOTTEXTMODE_DEFAULT : PLOTTEXTMODE_NATIVE ); + + if( !m_DXF_plotTextStrokeFontOpt->IsEnabled() ) // Currently, only DXF supports this option + tempOptions.SetTextMode( PLOTTEXTMODE_DEFAULT ); + else + tempOptions.SetTextMode( m_DXF_plotTextStrokeFontOpt->GetValue() ? + PLOTTEXTMODE_DEFAULT : PLOTTEXTMODE_NATIVE ); // Update settings from text fields. Rewrite values back to the fields, // since the values may have been constrained by the setters. @@ -731,11 +731,15 @@ void DIALOG_PLOT::applyPlotSettings() dirStr.Replace( wxT( "\\" ), wxT( "/" ) ); tempOptions.SetOutputDirectory( dirStr ); - if( m_plotOpts != tempOptions ) + if( !m_plotOpts.IsSameAs( tempOptions, false ) ) { + // First, mark board as modified only for parameters saved in file + if( !m_plotOpts.IsSameAs( tempOptions, true ) ) + m_parent->OnModify(); + + // Now, save any change, for the session m_parent->SetPlotSettings( tempOptions ); m_plotOpts = tempOptions; - m_parent->OnModify(); } } diff --git a/pcbnew/dialogs/dialog_plot.h b/pcbnew/dialogs/dialog_plot.h index 2ec12be3ae..637b2461fb 100644 --- a/pcbnew/dialogs/dialog_plot.h +++ b/pcbnew/dialogs/dialog_plot.h @@ -5,7 +5,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -31,8 +31,8 @@ #include /** - * Class DIALOG_PLOT - * + * Class DIALOG_PLOT is the dialog to set the plot options, and create plot files + * in various formats. */ class DIALOG_PLOT : public DIALOG_PLOT_BASE { @@ -58,7 +58,6 @@ private: PCB_PLOT_PARAMS m_plotOpts; // Event called functions - void Init_Dialog(); void Plot( wxCommandEvent& event ) override; void OnQuit( wxCommandEvent& event ) override; void OnClose( wxCloseEvent& event ) override; @@ -66,11 +65,12 @@ private: void OnRightClick( wxMouseEvent& event ) override; void OnPopUpLayers( wxCommandEvent& event ) override; void SetPlotFormat( wxCommandEvent& event ) override; - void OnChangeOutlineMode( wxCommandEvent& event ) override; + void OnChangeDXFPlotMode( wxCommandEvent& event ) override; void OnSetScaleOpt( wxCommandEvent& event ) override; void CreateDrillFile( wxCommandEvent& event ) override; // orther functions + void init_Dialog(); // main initialization void applyPlotSettings(); PlotFormat getPlotFormat(); diff --git a/pcbnew/dialogs/dialog_plot_base.cpp b/pcbnew/dialogs/dialog_plot_base.cpp index 92a286dff8..84e03d0e7a 100644 --- a/pcbnew/dialogs/dialog_plot_base.cpp +++ b/pcbnew/dialogs/dialog_plot_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Dec 21 2016) +// C++ code generated with wxFormBuilder (version Jul 2 2017) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -127,18 +127,6 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr bSizerPlotItems->Add( m_useAuxOriginCheckBox, 0, wxALL, 2 ); - m_plotOutlineModeOpt = new wxCheckBox( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Plot lines in outline mode"), wxDefaultPosition, wxDefaultSize, 0 ); - m_plotOutlineModeOpt->SetValue(true); - m_plotOutlineModeOpt->SetToolTip( _("Otherwise plot with sketch lines in layers that don't support polygons (*.SilkS, *_User, Edge.Cuts, Margin, *.CrtYd, *.Fab) and plot in outline mode in other layers (*.Cu, *.Adhes, *.Paste, *.Mask)") ); - - bSizerPlotItems->Add( m_plotOutlineModeOpt, 0, wxALL, 2 ); - - m_plotTextAsLineOpt = new wxCheckBox( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Plot all text as lines"), wxDefaultPosition, wxDefaultSize, 0 ); - m_plotTextAsLineOpt->SetValue(true); - m_plotTextAsLineOpt->SetToolTip( _("Otherwise plot oneline ASCII text as editable text") ); - - bSizerPlotItems->Add( m_plotTextAsLineOpt, 0, wxALL, 2 ); - bSizer192->Add( bSizerPlotItems, 0, wxEXPAND, 5 ); @@ -361,6 +349,23 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr m_PlotOptionsSizer->Add( m_PSOptionsSizer, 0, wxALL|wxEXPAND, 3 ); + m_SizerDXF_options = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("DXF options") ), wxVERTICAL ); + + m_DXF_plotModeOpt = new wxCheckBox( m_SizerDXF_options->GetStaticBox(), wxID_ANY, _("Plot all layers in outline (polygon) mode"), wxDefaultPosition, wxDefaultSize, 0 ); + m_DXF_plotModeOpt->SetValue(true); + m_DXF_plotModeOpt->SetToolTip( _("DXF only:\nCheck to plot all layers in polygon mode.\nUncheck to plot in sketch mode layers that don't support polygons (*.SilkS, *_User, Edge.Cuts, Margin, *.CrtYd, *.Fab)\nand plot in polygon mode other layers (*.Cu, *.Adhes, *.Paste, *.Mask)") ); + + m_SizerDXF_options->Add( m_DXF_plotModeOpt, 0, wxALL, 2 ); + + m_DXF_plotTextStrokeFontOpt = new wxCheckBox( m_SizerDXF_options->GetStaticBox(), wxID_ANY, _("Use Pcbnew font to plot texts"), wxDefaultPosition, wxDefaultSize, 0 ); + m_DXF_plotTextStrokeFontOpt->SetValue(true); + m_DXF_plotTextStrokeFontOpt->SetToolTip( _("Check to use Pcbnew stroke font\nUncheck to plot oneline ASCII texts as editable text (using DXF font)") ); + + m_SizerDXF_options->Add( m_DXF_plotTextStrokeFontOpt, 0, wxALL, 2 ); + + + m_PlotOptionsSizer->Add( m_SizerDXF_options, 0, wxEXPAND, 5 ); + bmiddleSizer->Add( m_PlotOptionsSizer, 0, 0, 5 ); @@ -430,8 +435,8 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr m_plotFormatOpt->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::SetPlotFormat ), NULL, this ); m_browseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnOutputDirectoryBrowseClicked ), NULL, this ); m_layerCheckListBox->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( DIALOG_PLOT_BASE::OnRightClick ), NULL, this ); - m_plotOutlineModeOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnChangeOutlineMode ), NULL, this ); m_scaleOpt->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnSetScaleOpt ), NULL, this ); + m_DXF_plotModeOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnChangeDXFPlotMode ), NULL, this ); m_plotButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::Plot ), NULL, this ); m_buttonDrill->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::CreateDrillFile ), NULL, this ); m_buttonQuit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnQuit ), NULL, this ); @@ -451,8 +456,8 @@ DIALOG_PLOT_BASE::~DIALOG_PLOT_BASE() m_plotFormatOpt->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::SetPlotFormat ), NULL, this ); m_browseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnOutputDirectoryBrowseClicked ), NULL, this ); m_layerCheckListBox->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( DIALOG_PLOT_BASE::OnRightClick ), NULL, this ); - m_plotOutlineModeOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnChangeOutlineMode ), NULL, this ); m_scaleOpt->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnSetScaleOpt ), NULL, this ); + m_DXF_plotModeOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnChangeDXFPlotMode ), NULL, this ); m_plotButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::Plot ), NULL, this ); m_buttonDrill->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::CreateDrillFile ), NULL, this ); m_buttonQuit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnQuit ), NULL, this ); diff --git a/pcbnew/dialogs/dialog_plot_base.fbp b/pcbnew/dialogs/dialog_plot_base.fbp index 73f9259d7d..02498572bf 100644 --- a/pcbnew/dialogs/dialog_plot_base.fbp +++ b/pcbnew/dialogs/dialog_plot_base.fbp @@ -88,7 +88,7 @@ - + m_MainSizer wxVERTICAL @@ -106,7 +106,7 @@ 5 wxEXPAND|wxRIGHT|wxLEFT 0 - + bSizerPlotFmt wxVERTICAL @@ -1603,182 +1603,6 @@ - - 2 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Plot lines in outline mode - - 0 - - - 0 - - 1 - m_plotOutlineModeOpt - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Otherwise plot with sketch lines in layers that don't support polygons (*.SilkS, *_User, Edge.Cuts, Margin, *.CrtYd, *.Fab) and plot in outline mode in other layers (*.Cu, *.Adhes, *.Paste, *.Mask) - - wxFILTER_NONE - wxDefaultValidator - - - - - - OnChangeOutlineMode - - - - - - - - - - - - - - - - - - - - - - - - - - 2 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Plot all text as lines - - 0 - - - 0 - - 1 - m_plotTextAsLineOpt - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Otherwise plot oneline ASCII text as editable text - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -4293,6 +4117,197 @@ + + 5 + wxEXPAND + 0 + + wxID_ANY + DXF options + + m_SizerDXF_options + wxVERTICAL + 1 + protected + + + 2 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Plot all layers in outline (polygon) mode + + 0 + + + 0 + + 1 + m_DXF_plotModeOpt + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + DXF only: Check to plot all layers in polygon mode. Uncheck to plot in sketch mode layers that don't support polygons (*.SilkS, *_User, Edge.Cuts, Margin, *.CrtYd, *.Fab) and plot in polygon mode other layers (*.Cu, *.Adhes, *.Paste, *.Mask) + + wxFILTER_NONE + wxDefaultValidator + + + + + + OnChangeDXFPlotMode + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Use Pcbnew font to plot texts + + 0 + + + 0 + + 1 + m_DXF_plotTextStrokeFontOpt + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Check to use Pcbnew stroke font Uncheck to plot oneline ASCII texts as editable text (using DXF font) + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pcbnew/dialogs/dialog_plot_base.h b/pcbnew/dialogs/dialog_plot_base.h index 6935dadf69..13a0fd496d 100644 --- a/pcbnew/dialogs/dialog_plot_base.h +++ b/pcbnew/dialogs/dialog_plot_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Dec 21 2016) +// C++ code generated with wxFormBuilder (version Jul 2 2017) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -78,8 +78,6 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM wxCheckBox* m_plotMirrorOpt; wxCheckBox* m_plotPSNegativeOpt; wxCheckBox* m_useAuxOriginCheckBox; - wxCheckBox* m_plotOutlineModeOpt; - wxCheckBox* m_plotTextAsLineOpt; wxStaticText* m_staticText11; wxChoice* m_drillShapeOpt; wxStaticText* m_staticText12; @@ -110,6 +108,9 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM wxStaticText* m_textPSFineAdjustWidth; wxTextCtrl* m_PSFineAdjustWidthOpt; wxCheckBox* m_forcePSA4OutputOpt; + wxStaticBoxSizer* m_SizerDXF_options; + wxCheckBox* m_DXF_plotModeOpt; + wxCheckBox* m_DXF_plotTextStrokeFontOpt; WX_HTML_REPORT_PANEL* m_messagesPanel; wxButton* m_plotButton; wxButton* m_buttonDrill; @@ -122,8 +123,8 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM virtual void OnRightClick( wxMouseEvent& event ) { event.Skip(); } virtual void SetPlotFormat( wxCommandEvent& event ) { event.Skip(); } virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); } - virtual void OnChangeOutlineMode( wxCommandEvent& event ) { event.Skip(); } virtual void OnSetScaleOpt( wxCommandEvent& event ) { event.Skip(); } + virtual void OnChangeDXFPlotMode( wxCommandEvent& event ) { event.Skip(); } virtual void Plot( wxCommandEvent& event ) { event.Skip(); } virtual void CreateDrillFile( wxCommandEvent& event ) { event.Skip(); } virtual void OnQuit( wxCommandEvent& event ) { event.Skip(); } diff --git a/pcbnew/pcb_plot_params.cpp b/pcbnew/pcb_plot_params.cpp index 69a8c2ab27..6e23b1e012 100644 --- a/pcbnew/pcb_plot_params.cpp +++ b/pcbnew/pcb_plot_params.cpp @@ -2,7 +2,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -90,7 +90,7 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS() : m_plotFrameRef = false; m_plotViaOnMaskLayer = false; m_plotMode = FILLED; - m_plotOutlineMode = true; + m_DXFplotPolygonMode = true; m_useAuxOrigin = false; m_HPGLPenNum = 1; m_HPGLPenSpeed = 20; // this param is always in cm/s @@ -114,8 +114,6 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS() : m_widthAdjust = 0.; m_outputDirectory.clear(); m_color = BLACK; - m_referenceColor = BLACK; - m_valueColor = BLACK; m_textMode = PLOTTEXTMODE_DEFAULT; // This parameter controls if the NPTH pads will be plotted or not @@ -220,7 +218,7 @@ void PCB_PLOT_PARAMS::Parse( PCB_PLOT_PARAMS_PARSER* aParser ) } -bool PCB_PLOT_PARAMS::operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const +bool PCB_PLOT_PARAMS::IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams, bool aCompareOnlySavedPrms ) const { if( m_layerSelection != aPcbPlotParams.m_layerSelection ) return false; @@ -240,8 +238,13 @@ bool PCB_PLOT_PARAMS::operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const return false; if( m_plotMode != aPcbPlotParams.m_plotMode ) return false; - if( m_plotOutlineMode != aPcbPlotParams.m_plotOutlineMode ) + + if( !aCompareOnlySavedPrms ) + { + if( m_DXFplotPolygonMode != aPcbPlotParams.m_DXFplotPolygonMode ) return false; + } + if( m_useAuxOrigin != aPcbPlotParams.m_useAuxOrigin ) return false; if( m_HPGLPenNum != aPcbPlotParams.m_HPGLPenNum ) @@ -284,12 +287,13 @@ bool PCB_PLOT_PARAMS::operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const return false; if( m_widthAdjust != aPcbPlotParams.m_widthAdjust ) return false; - if( m_color != aPcbPlotParams.m_color ) - return false; - if( m_referenceColor != aPcbPlotParams.m_referenceColor ) - return false; - if( m_valueColor != aPcbPlotParams.m_valueColor ) - return false; + + if( !aCompareOnlySavedPrms ) + { + if( m_color != aPcbPlotParams.m_color ) + return false; + } + if( m_textMode != aPcbPlotParams.m_textMode ) return false; if( !m_outputDirectory.IsSameAs( aPcbPlotParams.m_outputDirectory ) ) @@ -298,12 +302,6 @@ bool PCB_PLOT_PARAMS::operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const } -bool PCB_PLOT_PARAMS::operator!=( const PCB_PLOT_PARAMS &aPcbPlotParams ) const -{ - return !( *this == aPcbPlotParams ); -} - - bool PCB_PLOT_PARAMS::SetHPGLPenDiameter( int aValue ) { return setInt( &m_HPGLPenDiam, aValue, HPGL_PEN_DIAMETER_MIN, HPGL_PEN_DIAMETER_MAX ); diff --git a/pcbnew/pcb_plot_params.h b/pcbnew/pcb_plot_params.h index c111c0895f..def8b5c21a 100644 --- a/pcbnew/pcb_plot_params.h +++ b/pcbnew/pcb_plot_params.h @@ -54,8 +54,11 @@ private: */ EDA_DRAW_MODE_T m_plotMode; - /// Plot lines in outline mode - bool m_plotOutlineMode; + /** DXF format: Plot items in outline (polygon) mode + * In polygon mode, each item to plot is converted to a polygon, and all + * polygons are merged. + */ + bool m_DXFplotPolygonMode; /// Plot format type (chooses the driver to be used) PlotFormat m_format; @@ -66,7 +69,7 @@ private: /// Choose how represent text with PS, PDF and DXF drivers PlotTextMode m_textMode; - /// The default line width (used for the frame and in LINE mode) + /// The default line width (used to draw items having no defined width) int m_lineWidth; /// When true set the scale to fit the board in the page @@ -93,8 +96,10 @@ private: /// Set of layers to plot LSET m_layerSelection; - /** When plotting gerbers use a conventional set of Protel extensions - * instead of appending a suffix to the board name */ + /** When plotting gerber files, use a conventional set of Protel extensions + * instead of .gbr, that is now the offical gerber file extension + * this is a deprecated feature + */ bool m_useGerberProtelExtensions; /// Include attributes from the Gerber X2 format (chapter 5 in revision J2) @@ -106,7 +111,7 @@ private: /// 5 is the minimal value for professional boards. int m_gerberPrecision; - /// Plot gerbers using auxiliary (drill) origin instead of page coordinates + /// Plot gerbers using auxiliary (drill) origin instead of absolute coordinates bool m_useAuxOrigin; /// On gerbers 'scrape' away the solder mask from silkscreen (trim silks) @@ -139,8 +144,8 @@ private: * near 1.0; only X and Y dimensions are adjusted: circles are plotted as * circles, even if X and Y fine scale differ; because of this it is mostly * useful for printers: postscript plots would be best adjusted using - * the prologue (that would change the whole output matrix */ - + * the prologue (that would change the whole output matrix + */ double m_fineScaleAdjustX; ///< fine scale adjust X axis double m_fineScaleAdjustY; ///< fine scale adjust Y axis @@ -154,8 +159,6 @@ private: int m_HPGLPenDiam; ///< HPGL only: pen diameter in MILS, useful to fill areas int m_HPGLPenOvr; ///< HPGL only: pen overlay in MILS, useful only to fill areas EDA_COLOR_T m_color; ///< Color for plotting the current layer - EDA_COLOR_T m_referenceColor; ///< Color for plotting references - EDA_COLOR_T m_valueColor; ///< Color for plotting values public: PCB_PLOT_PARAMS(); @@ -167,26 +170,26 @@ public: const throw( IO_ERROR ); void Parse( PCB_PLOT_PARAMS_PARSER* aParser ) throw( PARSE_ERROR, IO_ERROR ); - bool operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const; - bool operator!=( const PCB_PLOT_PARAMS &aPcbPlotParams ) const; + /** + * Compare current settings to aPcbPlotParams, including not saved parameters in brd file + * @param aPcbPlotParams = the PCB_PLOT_PARAMS to compare + * @param aCompareOnlySavedPrms = true to compare only saved in file parameters, + * and false to compare the full set of parameters. + * @return true is parameters are same, false if one (or more) parameter does not match + */ + bool IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams, bool aCompareOnlySavedPrms ) const; void SetColor( EDA_COLOR_T aVal ) { m_color = aVal; } EDA_COLOR_T GetColor() const { return m_color; } - void SetReferenceColor( EDA_COLOR_T aVal ) { m_referenceColor = aVal; } - EDA_COLOR_T GetReferenceColor() const { return m_referenceColor; } - - void SetValueColor( EDA_COLOR_T aVal ) { m_valueColor = aVal; } - EDA_COLOR_T GetValueColor() const { return m_valueColor; } - void SetTextMode( PlotTextMode aVal ) { m_textMode = aVal; } PlotTextMode GetTextMode() const { return m_textMode; } void SetPlotMode( EDA_DRAW_MODE_T aPlotMode ) { m_plotMode = aPlotMode; } EDA_DRAW_MODE_T GetPlotMode() const { return m_plotMode; } - void SetPlotOutlineMode( bool aFlag ) { m_plotOutlineMode = aFlag; } - bool GetPlotOutlineMode() const { return m_plotOutlineMode; } + void SetDXFPlotPolygonMode( bool aFlag ) { m_DXFplotPolygonMode = aFlag; } + bool GetDXFPlotPolygonMode() const { return m_DXFplotPolygonMode; } void SetDrillMarksType( DrillMarksType aVal ) { m_drillMarks = aVal; } DrillMarksType GetDrillMarksType() const { return m_drillMarks; } diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index f3e378388a..90c3272e94 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -962,16 +962,20 @@ void PCB_EDIT_FRAME::OnModify( ) void PCB_EDIT_FRAME::SVG_Print( wxCommandEvent& event ) { - PCB_PLOT_PARAMS tmp = GetPlotSettings(); + PCB_PLOT_PARAMS plot_prms = GetPlotSettings(); // we don't want dialogs knowing about complex wxFrame functions so // pass everything the dialog needs without reference to *this frame's class. - if( InvokeSVGPrint( this, GetBoard(), &tmp ) ) + if( InvokeSVGPrint( this, GetBoard(), &plot_prms ) ) { - if( tmp != GetPlotSettings() ) + if( !plot_prms.IsSameAs( GetPlotSettings(), false ) ) { - SetPlotSettings( tmp ); - OnModify(); + // First, mark board as modified only for parameters saved in file + if( !plot_prms.IsSameAs( GetPlotSettings(), true ) ) + OnModify(); + + // Now, save any change, for the session + SetPlotSettings( plot_prms ); } } } diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index ad288c0936..34c08fd8d9 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -214,7 +214,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, LAYER_ID aLayer, case F_SilkS: case B_SilkS: - if( plotOpt.GetFormat() == PLOT_FORMAT_DXF && plotOpt.GetPlotOutlineMode() ) + if( plotOpt.GetFormat() == PLOT_FORMAT_DXF && plotOpt.GetDXFPlotPolygonMode() ) // PlotLayerOutlines() is designed only for DXF plotters. // and must not be used for other plot formats PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt ); @@ -257,7 +257,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, LAYER_ID aLayer, plotOpt.SetSkipPlotNPTH_Pads( false ); plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE ); - if ( plotOpt.GetFormat() == PLOT_FORMAT_DXF && plotOpt.GetPlotOutlineMode() ) + if ( plotOpt.GetFormat() == PLOT_FORMAT_DXF && plotOpt.GetDXFPlotPolygonMode() ) // PlotLayerOutlines() is designed only for DXF plotters. // and must not be used for other plot formats PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt ); @@ -269,7 +269,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, LAYER_ID aLayer, plotOpt.SetSkipPlotNPTH_Pads( false ); plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE ); - if ( plotOpt.GetFormat() == PLOT_FORMAT_DXF && plotOpt.GetPlotOutlineMode() ) + if ( plotOpt.GetFormat() == PLOT_FORMAT_DXF && plotOpt.GetDXFPlotPolygonMode() ) // PlotLayerOutlines() is designed only for DXF plotters. // and must not be used for other plot formats PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt ); diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 82598bc128..248eda720c 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -133,18 +133,12 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule ) // Plot text fields, if allowed if( trace_ref ) { - if( GetReferenceColor() == UNSPECIFIED_COLOR ) - PlotTextModule( &aModule->Reference(), getColor( textLayer ) ); - else - PlotTextModule( &aModule->Reference(), GetReferenceColor() ); + PlotTextModule( &aModule->Reference(), getColor( textLayer ) ); } if( trace_val ) { - if( GetValueColor() == UNSPECIFIED_COLOR ) - PlotTextModule( &aModule->Value(), getColor( textLayer ) ); - else - PlotTextModule( &aModule->Value(), GetValueColor() ); + PlotTextModule( &aModule->Value(), getColor( textLayer ) ); } for( BOARD_ITEM *item = aModule->GraphicalItems().GetFirst(); item; item = item->Next() ) @@ -249,11 +243,11 @@ void BRDITEMS_PLOTTER::PlotDimension( DIMENSION* aDim ) draw.SetWidth( aDim->GetWidth() ); draw.SetLayer( aDim->GetLayer() ); - EDA_COLOR_T color = aDim->GetBoard()->GetLayerColor( aDim->GetLayer() ); + EDA_COLOR_T color = getColor( aDim->GetLayer() ); // Set plot color (change WHITE to LIGHTGRAY because // the white items are not seen on a white paper or screen - m_plotter->SetColor( color != WHITE ? color : LIGHTGRAY); + m_plotter->SetColor( color ); PlotTextePcb( &aDim->Text() ); @@ -447,7 +441,8 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte ) if( !m_layerMask[pt_texte->GetLayer()] ) return; - m_plotter->SetColor( getColor( pt_texte->GetLayer() ) ); + EDA_COLOR_T color = getColor( pt_texte->GetLayer() ); + m_plotter->SetColor( color ); size = pt_texte->GetSize(); pos = pt_texte->GetTextPosition(); @@ -475,14 +470,14 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte ) for( unsigned ii = 0; ii < strings_list.Count(); ii++ ) { wxString& txt = strings_list.Item( ii ); - m_plotter->Text( positions[ii], UNSPECIFIED_COLOR, txt, orient, size, + m_plotter->Text( positions[ii], color, txt, orient, size, pt_texte->GetHorizJustify(), pt_texte->GetVertJustify(), thickness, pt_texte->IsItalic(), allow_bold ); } } else { - m_plotter->Text( pos, UNSPECIFIED_COLOR, shownText, orient, size, + m_plotter->Text( pos, color, shownText, orient, size, pt_texte->GetHorizJustify(), pt_texte->GetVertJustify(), thickness, pt_texte->IsItalic(), allow_bold ); }