Permalink
Browse files

Pcbnew: fix a few plot issues (from master branch)

  • Loading branch information...
jp-charras committed Aug 1, 2017
1 parent 6b1b6d4 commit 9f35e384c1c4e3a2df0eba6196fe0664031cc5a9
@@ -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 );
@@ -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 );
@@ -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();
@@ -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,15 +374,16 @@ 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:
case PLOT_FORMAT_SVG:
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,21 +434,18 @@ 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:
m_drillShapeOpt->Enable( false );
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();
}
}
@@ -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 <pcb_plot_params.h>
/**
* 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,19 +58,19 @@ class DIALOG_PLOT : public DIALOG_PLOT_BASE
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;
void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) override;
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();
@@ -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 );
Oops, something went wrong.

0 comments on commit 9f35e38

Please sign in to comment.