Fix some minor bugs in plot functions
This commit is contained in:
parent
7f07b48e88
commit
de471744cd
|
@ -1,9 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||||
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
|
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -285,7 +286,7 @@ GRID_TYPE& BASE_SCREEN::GetGrid( size_t aIndex )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition,
|
wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition,
|
||||||
wxRealPoint* aGridSize ) const
|
wxRealPoint* aGridSize ) const
|
||||||
{
|
{
|
||||||
wxPoint pt;
|
wxPoint pt;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
/* Plot sheet references
|
/* Plot sheet references
|
||||||
* margin is in mils (1/1000 inch)
|
* margin is in mils (1/1000 inch)
|
||||||
*/
|
*/
|
||||||
void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
|
void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen, int aLineWidth )
|
||||||
{
|
{
|
||||||
#define WSTEXTSIZE 50 // Text size in mils
|
#define WSTEXTSIZE 50 // Text size in mils
|
||||||
|
|
||||||
|
@ -46,10 +46,11 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool italic = false;
|
bool italic = false;
|
||||||
bool thickness = 0; //@todo : use current pen
|
int thickness = aLineWidth;
|
||||||
|
|
||||||
color = BLACK;
|
color = BLACK;
|
||||||
plotter->SetColor( color );
|
plotter->SetColor( color );
|
||||||
|
plotter->SetCurrentLineWidth( thickness );
|
||||||
|
|
||||||
// Plot edge.
|
// Plot edge.
|
||||||
ref.x = pageInfo.GetLeftMarginMils() * iusPerMil;
|
ref.x = pageInfo.GetLeftMarginMils() * iusPerMil;
|
||||||
|
|
|
@ -2,6 +2,33 @@
|
||||||
* Functions to draw and plot text on screen
|
* Functions to draw and plot text on screen
|
||||||
* @file drawtxt.cpp
|
* @file drawtxt.cpp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||||
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
|
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
|
* Copyright (C) 1992-2012 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
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, you may find one here:
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||||
|
* or you may write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <gr_basic.h>
|
#include <gr_basic.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
@ -526,15 +553,17 @@ void PLOTTER::Text( const wxPoint& aPos,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold )
|
bool aBold )
|
||||||
{
|
{
|
||||||
if( aWidth == 0 && aBold ) // Use default values if aWidth == 0
|
int textPensize = aWidth;
|
||||||
aWidth = GetPenSizeForBold( MIN( aSize.x, aSize.y ) );
|
|
||||||
|
|
||||||
if( aWidth >= 0 )
|
if( textPensize == 0 && aBold ) // Use default values if aWidth == 0
|
||||||
aWidth = Clamp_Text_PenSize( aWidth, aSize, aBold );
|
textPensize = GetPenSizeForBold( MIN( aSize.x, aSize.y ) );
|
||||||
|
|
||||||
|
if( textPensize >= 0 )
|
||||||
|
textPensize = Clamp_Text_PenSize( aWidth, aSize, aBold );
|
||||||
else
|
else
|
||||||
aWidth = -Clamp_Text_PenSize( -aWidth, aSize, aBold );
|
textPensize = -Clamp_Text_PenSize( -aWidth, aSize, aBold );
|
||||||
|
|
||||||
SetCurrentLineWidth( aWidth );
|
SetCurrentLineWidth( textPensize );
|
||||||
|
|
||||||
|
|
||||||
if( aColor >= 0 )
|
if( aColor >= 0 )
|
||||||
|
@ -543,8 +572,11 @@ void PLOTTER::Text( const wxPoint& aPos,
|
||||||
DrawGraphicText( NULL, NULL, aPos, aColor, aText,
|
DrawGraphicText( NULL, NULL, aPos, aColor, aText,
|
||||||
aOrient, aSize,
|
aOrient, aSize,
|
||||||
aH_justify, aV_justify,
|
aH_justify, aV_justify,
|
||||||
aWidth, aItalic,
|
textPensize, aItalic,
|
||||||
aBold,
|
aBold,
|
||||||
NULL,
|
NULL,
|
||||||
this );
|
this );
|
||||||
|
|
||||||
|
if( aWidth != textPensize )
|
||||||
|
SetCurrentLineWidth( aWidth );
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,7 +241,7 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
|
||||||
if( m_plot_Sheet_Ref )
|
if( m_plot_Sheet_Ref )
|
||||||
{
|
{
|
||||||
plotter->SetColor( BLACK );
|
plotter->SetColor( BLACK );
|
||||||
m_Parent->PlotWorkSheet( plotter, screen );
|
m_Parent->PlotWorkSheet( plotter, screen, g_DrawDefaultLineThickness );
|
||||||
}
|
}
|
||||||
|
|
||||||
screen->Plot( plotter );
|
screen->Plot( plotter );
|
||||||
|
|
|
@ -395,7 +395,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
|
||||||
plotter->SetColor( BLACK );
|
plotter->SetColor( BLACK );
|
||||||
|
|
||||||
if( s_plot_Sheet_Ref )
|
if( s_plot_Sheet_Ref )
|
||||||
m_Parent->PlotWorkSheet( plotter, screen );
|
m_Parent->PlotWorkSheet( plotter, screen, g_DrawDefaultLineThickness );
|
||||||
|
|
||||||
screen->Plot( plotter );
|
screen->Plot( plotter );
|
||||||
|
|
||||||
|
|
|
@ -220,7 +220,7 @@ void DIALOG_PLOT_SCHEMATIC_PDF::createPDFFile()
|
||||||
|
|
||||||
if( first_page ) {
|
if( first_page ) {
|
||||||
wxString msg;
|
wxString msg;
|
||||||
wxString plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet()
|
wxString plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet()
|
||||||
+ wxT( ".pdf" );
|
+ wxT( ".pdf" );
|
||||||
msg.Printf( _( "Plot: %s " ), GetChars( plotFileName ) );
|
msg.Printf( _( "Plot: %s " ), GetChars( plotFileName ) );
|
||||||
m_MsgBox->AppendText( msg );
|
m_MsgBox->AppendText( msg );
|
||||||
|
@ -241,8 +241,8 @@ void DIALOG_PLOT_SCHEMATIC_PDF::createPDFFile()
|
||||||
plotSetupPage( plotter, screen );
|
plotSetupPage( plotter, screen );
|
||||||
plotter->StartPlot( output_file );
|
plotter->StartPlot( output_file );
|
||||||
first_page = false;
|
first_page = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* For the following pages you need to close the (finished) page,
|
/* For the following pages you need to close the (finished) page,
|
||||||
reconfigure, and then start a new one */
|
reconfigure, and then start a new one */
|
||||||
|
@ -301,7 +301,7 @@ void DIALOG_PLOT_SCHEMATIC_PDF::plotOneSheet( PDF_PLOTTER* plotter,
|
||||||
if( m_plot_Sheet_Ref )
|
if( m_plot_Sheet_Ref )
|
||||||
{
|
{
|
||||||
plotter->SetColor( BLACK );
|
plotter->SetColor( BLACK );
|
||||||
m_Parent->PlotWorkSheet( plotter, screen );
|
m_Parent->PlotWorkSheet( plotter, screen, g_DrawDefaultLineThickness );
|
||||||
}
|
}
|
||||||
|
|
||||||
screen->Plot( plotter );
|
screen->Plot( plotter );
|
||||||
|
|
|
@ -294,7 +294,7 @@ void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName,
|
||||||
if( m_plot_Sheet_Ref )
|
if( m_plot_Sheet_Ref )
|
||||||
{
|
{
|
||||||
plotter->SetColor( BLACK );
|
plotter->SetColor( BLACK );
|
||||||
m_Parent->PlotWorkSheet( plotter, screen );
|
m_Parent->PlotWorkSheet( plotter, screen, g_DrawDefaultLineThickness );
|
||||||
}
|
}
|
||||||
|
|
||||||
screen->Plot( plotter );
|
screen->Plot( plotter );
|
||||||
|
|
|
@ -686,7 +686,7 @@ public:
|
||||||
int aNScr, int aScr, int aLnW, double aScalar,
|
int aNScr, int aScr, int aLnW, double aScalar,
|
||||||
EDA_COLOR_T aClr1 = RED, EDA_COLOR_T aClr2 = RED );
|
EDA_COLOR_T aClr1 = RED, EDA_COLOR_T aClr2 = RED );
|
||||||
|
|
||||||
void PlotWorkSheet( PLOTTER* aPlotter, BASE_SCREEN* aScreen );
|
void PlotWorkSheet( PLOTTER* aPlotter, BASE_SCREEN* aScreen, int aLineWidth );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetXYSheetReferences
|
* Function GetXYSheetReferences
|
||||||
|
|
|
@ -2,6 +2,32 @@
|
||||||
* Module editor: Dialog box for editing module properties in the pcb editor. *
|
* Module editor: Dialog box for editing module properties in the pcb editor. *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2011 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||||
|
* Copyright (C) 2012 Dick Hollenbeck, dick@softplc.com
|
||||||
|
* Copyright (C) 2004-2011 KiCad Developers, see change_log.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
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, you may find one here:
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||||
|
* or you may write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <gr_basic.h>
|
#include <gr_basic.h>
|
||||||
#include <class_drawpanel.h>
|
#include <class_drawpanel.h>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -28,18 +28,19 @@
|
||||||
#include <layers_id_colors_and_visibility.h>
|
#include <layers_id_colors_and_visibility.h>
|
||||||
#include <plot_common.h>
|
#include <plot_common.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
|
#include <convert_to_biu.h>
|
||||||
|
|
||||||
|
|
||||||
#define PLOT_LINEWIDTH_MIN 0
|
#define PLOT_LINEWIDTH_MIN 0
|
||||||
#define PLOT_LINEWIDTH_MAX (200*IU_PER_DECIMILS)
|
#define PLOT_LINEWIDTH_MAX (200*IU_PER_MILS)
|
||||||
#define HPGL_PEN_DIAMETER_MIN 0
|
#define HPGL_PEN_DIAMETER_MIN 0
|
||||||
#define HPGL_PEN_DIAMETER_MAX (100*IU_PER_DECIMILS)
|
#define HPGL_PEN_DIAMETER_MAX 100 // Unit = mil
|
||||||
#define HPGL_PEN_SPEED_MIN 0
|
#define HPGL_PEN_SPEED_MIN 1 // this param is always in cm/s
|
||||||
#define HPGL_PEN_SPEED_MAX 1000
|
#define HPGL_PEN_SPEED_MAX 99 // this param is always in cm/s
|
||||||
#define HPGL_PEN_NUMBER_MIN 1
|
#define HPGL_PEN_NUMBER_MIN 1
|
||||||
#define HPGL_PEN_NUMBER_MAX 16
|
#define HPGL_PEN_NUMBER_MAX 16
|
||||||
#define HPGL_PEN_OVERLAY_MIN 0
|
#define HPGL_PEN_OVERLAP_MIN 0
|
||||||
#define HPGL_PEN_OVERLAY_MAX 0x100
|
#define HPGL_PEN_OVERLAP_MAX 50 // Unit = mil
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,7 +48,7 @@
|
||||||
* default thickness line value (Frame references) (i.e. = 0 ).
|
* default thickness line value (Frame references) (i.e. = 0 ).
|
||||||
* 0 = single pixel line width.
|
* 0 = single pixel line width.
|
||||||
*/
|
*/
|
||||||
int g_DrawDefaultLineThickness = 60;
|
int g_DrawDefaultLineThickness = 6*IU_PER_MILS;
|
||||||
|
|
||||||
|
|
||||||
using namespace PCBPLOTPARAMS_T;
|
using namespace PCBPLOTPARAMS_T;
|
||||||
|
@ -88,9 +89,9 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
|
||||||
m_PlotMode = FILLED;
|
m_PlotMode = FILLED;
|
||||||
useAuxOrigin = false;
|
useAuxOrigin = false;
|
||||||
m_HPGLPenNum = 1;
|
m_HPGLPenNum = 1;
|
||||||
m_HPGLPenSpeed = 20;
|
m_HPGLPenSpeed = 20; // this param is always in cm/s
|
||||||
m_HPGLPenDiam = 15;
|
m_HPGLPenDiam = 15; // in mils
|
||||||
m_HPGLPenOvr = 2;
|
m_HPGLPenOvr = 2; // in mils
|
||||||
m_PlotPSColorOpt = true;
|
m_PlotPSColorOpt = true;
|
||||||
m_PlotPSNegative = false;
|
m_PlotPSNegative = false;
|
||||||
psA4Output = false;
|
psA4Output = false;
|
||||||
|
@ -260,7 +261,7 @@ bool PCB_PLOT_PARAMS::SetHpglPenSpeed( int aValue )
|
||||||
|
|
||||||
bool PCB_PLOT_PARAMS::SetHpglPenOverlay( int aValue )
|
bool PCB_PLOT_PARAMS::SetHpglPenOverlay( int aValue )
|
||||||
{
|
{
|
||||||
return setInt( &m_HPGLPenOvr, aValue, HPGL_PEN_OVERLAY_MIN, HPGL_PEN_OVERLAY_MAX );
|
return setInt( &m_HPGLPenOvr, aValue, HPGL_PEN_OVERLAP_MIN, HPGL_PEN_OVERLAP_MAX );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -344,8 +345,8 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) throw( IO_
|
||||||
HPGL_PEN_DIAMETER_MAX );
|
HPGL_PEN_DIAMETER_MAX );
|
||||||
break;
|
break;
|
||||||
case T_hpglpenoverlay:
|
case T_hpglpenoverlay:
|
||||||
aPcbPlotParams->m_HPGLPenOvr = ParseInt( HPGL_PEN_OVERLAY_MIN,
|
aPcbPlotParams->m_HPGLPenOvr = ParseInt( HPGL_PEN_OVERLAP_MIN,
|
||||||
HPGL_PEN_OVERLAY_MIN );
|
HPGL_PEN_OVERLAP_MAX );
|
||||||
break;
|
break;
|
||||||
case T_pscolor:
|
case T_pscolor:
|
||||||
aPcbPlotParams->m_PlotPSColorOpt = ParseBool();
|
aPcbPlotParams->m_PlotPSColorOpt = ParseBool();
|
||||||
|
|
|
@ -47,10 +47,10 @@ public:
|
||||||
///< (ie protected by mask)
|
///< (ie protected by mask)
|
||||||
EDA_DRAW_MODE_T m_PlotMode; ///< LINE, FILLED or SKETCH: select how to plot filled objects.
|
EDA_DRAW_MODE_T m_PlotMode; ///< LINE, FILLED or SKETCH: select how to plot filled objects.
|
||||||
///< depending on plot format or layers, all options are not always allowed
|
///< depending on plot format or layers, all options are not always allowed
|
||||||
int m_HPGLPenNum;
|
int m_HPGLPenNum; ///< HPGL only: pen number selection(1 to 9)
|
||||||
int m_HPGLPenSpeed;
|
int m_HPGLPenSpeed; ///< HPGL only: pen speed, always in cm/s (1 to 99 cm/s)
|
||||||
int m_HPGLPenDiam;
|
int m_HPGLPenDiam; ///< HPGL only: pen diameter in MILS, usefull to fill areas
|
||||||
int m_HPGLPenOvr;
|
int m_HPGLPenOvr; ///< HPGL only: pen overlay in MILS, usefull only to fill areas
|
||||||
int m_PlotPSColorOpt; ///< True for color Postscript output
|
int m_PlotPSColorOpt; ///< True for color Postscript output
|
||||||
bool m_PlotPSNegative; ///< True to create a negative board ps plot
|
bool m_PlotPSNegative; ///< True to create a negative board ps plot
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,31 @@
|
||||||
* @file pcbnew/pcbplot.cpp
|
* @file pcbnew/pcbplot.cpp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||||
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
|
* Copyright (C) 1992-2012 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
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, you may find one here:
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||||
|
* or you may write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <appl_wxstruct.h>
|
||||||
#include <plot_common.h>
|
#include <plot_common.h>
|
||||||
|
@ -119,18 +144,20 @@ void DIALOG_PLOT::Init_Dialog()
|
||||||
|
|
||||||
m_plotFormatOpt->SetSelection( m_plotOpts.GetPlotFormat() );
|
m_plotFormatOpt->SetSelection( m_plotOpts.GetPlotFormat() );
|
||||||
|
|
||||||
// Set units and value for HPGL pen size.
|
// Set units and value for HPGL pen size (this param in in mils).
|
||||||
AddUnitSymbol( *m_textPenSize, g_UserUnit );
|
AddUnitSymbol( *m_textPenSize, g_UserUnit );
|
||||||
msg = ReturnStringFromValue( g_UserUnit, m_plotOpts.GetHpglPenDiameter() * 10 );
|
msg = ReturnStringFromValue( g_UserUnit,
|
||||||
|
m_plotOpts.GetHpglPenDiameter() * IU_PER_MILS );
|
||||||
m_HPGLPenSizeOpt->AppendText( msg );
|
m_HPGLPenSizeOpt->AppendText( msg );
|
||||||
|
|
||||||
// Set units to cm/s for standard HPGL pen speed.
|
// Units are *always* cm/s for HPGL pen speed, from 1 to 99.
|
||||||
msg = ReturnStringFromValue( UNSCALED_UNITS, m_plotOpts.GetHpglPenSpeed() * 10000 );
|
msg = ReturnStringFromValue( UNSCALED_UNITS, m_plotOpts.GetHpglPenSpeed() );
|
||||||
m_HPGLPenSpeedOpt->AppendText( msg );
|
m_HPGLPenSpeedOpt->AppendText( msg );
|
||||||
|
|
||||||
// Set units and value for HPGL pen overlay.
|
// Set units and value for HPGL pen overlay (this param in in mils).
|
||||||
AddUnitSymbol( *m_textPenOvr, g_UserUnit );
|
AddUnitSymbol( *m_textPenOvr, g_UserUnit );
|
||||||
msg = ReturnStringFromValue( g_UserUnit, m_plotOpts.GetHpglPenOverlay() * 10 );
|
msg = ReturnStringFromValue( g_UserUnit,
|
||||||
|
m_plotOpts.GetHpglPenOverlay() * IU_PER_MILS );
|
||||||
m_HPGLPenOverlayOpt->AppendText( msg );
|
m_HPGLPenOverlayOpt->AppendText( msg );
|
||||||
|
|
||||||
AddUnitSymbol( *m_textDefaultPenSize, g_UserUnit );
|
AddUnitSymbol( *m_textDefaultPenSize, g_UserUnit );
|
||||||
|
@ -448,37 +475,39 @@ void DIALOG_PLOT::applyPlotSettings()
|
||||||
|
|
||||||
// Update settings from text fields. Rewrite values back to the fields,
|
// Update settings from text fields. Rewrite values back to the fields,
|
||||||
// since the values may have been constrained by the setters.
|
// since the values may have been constrained by the setters.
|
||||||
// HPLG pen size
|
|
||||||
|
// read HPLG pen size (this param is stored in mils)
|
||||||
wxString msg = m_HPGLPenSizeOpt->GetValue();
|
wxString msg = m_HPGLPenSizeOpt->GetValue();
|
||||||
int tmp = ReturnValueFromString( g_UserUnit, msg );
|
int tmp = ReturnValueFromString( g_UserUnit, msg ) / IU_PER_MILS;
|
||||||
|
|
||||||
if( !tempOptions.SetHpglPenDiameter( tmp ) )
|
if( !tempOptions.SetHpglPenDiameter( tmp ) )
|
||||||
{
|
{
|
||||||
msg = ReturnStringFromValue( g_UserUnit, tempOptions.GetHpglPenDiameter() * 10 );
|
msg = ReturnStringFromValue( g_UserUnit, tempOptions.GetHpglPenDiameter() * IU_PER_MILS );
|
||||||
m_HPGLPenSizeOpt->SetValue( msg );
|
m_HPGLPenSizeOpt->SetValue( msg );
|
||||||
msg.Printf( _( "HPGL pen size constrained!\n" ) );
|
msg.Printf( _( "HPGL pen size constrained!\n" ) );
|
||||||
m_messagesBox->AppendText( msg );
|
m_messagesBox->AppendText( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
// HPGL pen speed
|
// read HPGL pen speed (this param is stored in cm/s)
|
||||||
msg = m_HPGLPenSpeedOpt->GetValue();
|
msg = m_HPGLPenSpeedOpt->GetValue();
|
||||||
tmp = ReturnValueFromString( UNSCALED_UNITS, msg );
|
tmp = ReturnValueFromString( UNSCALED_UNITS, msg );
|
||||||
|
|
||||||
if( !tempOptions.SetHpglPenSpeed( tmp ) )
|
if( !tempOptions.SetHpglPenSpeed( tmp ) )
|
||||||
{
|
{
|
||||||
msg = ReturnStringFromValue( UNSCALED_UNITS, tempOptions.GetHpglPenSpeed() * 1000 );
|
msg = ReturnStringFromValue( UNSCALED_UNITS, tempOptions.GetHpglPenSpeed() );
|
||||||
m_HPGLPenSpeedOpt->SetValue( msg );
|
m_HPGLPenSpeedOpt->SetValue( msg );
|
||||||
msg.Printf( _( "HPGL pen speed constrained!\n" ) );
|
msg.Printf( _( "HPGL pen speed constrained!\n" ) );
|
||||||
m_messagesBox->AppendText( msg );
|
m_messagesBox->AppendText( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
// HPGL pen overlay
|
// Read HPGL pen overlay (this param is stored in mils)
|
||||||
msg = m_HPGLPenOverlayOpt->GetValue();
|
msg = m_HPGLPenOverlayOpt->GetValue();
|
||||||
tmp = ReturnValueFromString( g_UserUnit, msg );
|
tmp = ReturnValueFromString( g_UserUnit, msg ) / IU_PER_MILS;
|
||||||
|
|
||||||
if( !tempOptions.SetHpglPenOverlay( tmp ) )
|
if( !tempOptions.SetHpglPenOverlay( tmp ) )
|
||||||
{
|
{
|
||||||
msg = ReturnStringFromValue( g_UserUnit, tempOptions.GetHpglPenOverlay() * 10 );
|
msg = ReturnStringFromValue( g_UserUnit,
|
||||||
|
tempOptions.GetHpglPenOverlay() * IU_PER_MILS );
|
||||||
m_HPGLPenOverlayOpt->SetValue( msg );
|
m_HPGLPenOverlayOpt->SetValue( msg );
|
||||||
msg.Printf( _( "HPGL pen overlay constrained!\n" ) );
|
msg.Printf( _( "HPGL pen overlay constrained!\n" ) );
|
||||||
m_messagesBox->AppendText( msg );
|
m_messagesBox->AppendText( msg );
|
||||||
|
|
|
@ -37,7 +37,7 @@ bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
|
||||||
plotter->StartPlot( output_file );
|
plotter->StartPlot( output_file );
|
||||||
|
|
||||||
if( plot_opts.m_PlotFrameRef )
|
if( plot_opts.m_PlotFrameRef )
|
||||||
PlotWorkSheet( plotter, GetScreen() );
|
PlotWorkSheet( plotter, GetScreen(), plot_opts.GetPlotLineWidth() );
|
||||||
|
|
||||||
Plot_Layer( plotter, aLayer, aTraceMode );
|
Plot_Layer( plotter, aLayer, aTraceMode );
|
||||||
plotter->EndPlot();
|
plotter->EndPlot();
|
||||||
|
|
|
@ -70,7 +70,7 @@ bool PCB_BASE_FRAME::ExportToGerberFile( const wxString& aFullFileName, int aLay
|
||||||
|
|
||||||
// Sheet refs on gerber CAN be useful... and they're always 1:1
|
// Sheet refs on gerber CAN be useful... and they're always 1:1
|
||||||
if( plot_opts.m_PlotFrameRef )
|
if( plot_opts.m_PlotFrameRef )
|
||||||
PlotWorkSheet( plotter, GetScreen() );
|
PlotWorkSheet( plotter, GetScreen(), plot_opts.GetPlotLineWidth() );
|
||||||
|
|
||||||
Plot_Layer( plotter, aLayer, aTraceMode );
|
Plot_Layer( plotter, aLayer, aTraceMode );
|
||||||
|
|
||||||
|
|
|
@ -2,19 +2,39 @@
|
||||||
* @file plothpgl.cpp
|
* @file plothpgl.cpp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 KiCad Developers, see change_log.txt for contributors.
|
||||||
|
* Copyright (C) 2012 Dick Hollenbeck, dick@softplc.com
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, you may find one here:
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||||
|
* or you may write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <plot_common.h>
|
#include <plot_common.h>
|
||||||
#include <confirm.h>
|
|
||||||
#include <trigo.h>
|
|
||||||
#include <wxBasePcbFrame.h>
|
#include <wxBasePcbFrame.h>
|
||||||
#include <macros.h>
|
|
||||||
|
|
||||||
#include <class_board.h>
|
#include <class_board.h>
|
||||||
|
|
||||||
#include <pcbnew.h>
|
#include <pcbnew.h>
|
||||||
#include <protos.h>
|
|
||||||
#include <pcbplot.h>
|
#include <pcbplot.h>
|
||||||
|
#include <convert_to_biu.h>
|
||||||
|
|
||||||
|
|
||||||
bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer,
|
bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer,
|
||||||
|
@ -35,20 +55,21 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
|
||||||
|
|
||||||
PCB_PLOT_PARAMS plot_opts = GetPlotSettings();
|
PCB_PLOT_PARAMS plot_opts = GetPlotSettings();
|
||||||
|
|
||||||
// Compute pen_dim (from g_m_HPGLPenDiam in mils) in pcb units,
|
// Compute pen_dim (from m_HPGLPenDiam in mils) in pcb units,
|
||||||
// with plot scale (if Scale is 2, pen diameter is always g_m_HPGLPenDiam
|
// with plot scale (if Scale is 2, pen diameter value is always m_HPGLPenDiam
|
||||||
// so apparent pen diam is real pen diam / Scale
|
// so apparent pen diam is real pen diam / Scale
|
||||||
int pen_diam = KiROUND( plot_opts.m_HPGLPenDiam /
|
int pen_diam = KiROUND( plot_opts.m_HPGLPenDiam * IU_PER_MILS /
|
||||||
plot_opts.m_PlotScale );
|
plot_opts.m_PlotScale );
|
||||||
|
|
||||||
// compute pen_overlay (from g_m_HPGLPenOvr in mils) with plot scale
|
// compute pen_overlay (from m_HPGLPenOvr in mils) in pcb units
|
||||||
|
// with plot scale
|
||||||
if( plot_opts.m_HPGLPenOvr < 0 )
|
if( plot_opts.m_HPGLPenOvr < 0 )
|
||||||
plot_opts.m_HPGLPenOvr = 0;
|
plot_opts.m_HPGLPenOvr = 0;
|
||||||
|
|
||||||
if( plot_opts.m_HPGLPenOvr >= plot_opts.m_HPGLPenDiam )
|
if( plot_opts.m_HPGLPenOvr >= plot_opts.m_HPGLPenDiam )
|
||||||
plot_opts.m_HPGLPenOvr = plot_opts.m_HPGLPenDiam - 1;
|
plot_opts.m_HPGLPenOvr = plot_opts.m_HPGLPenDiam - 1;
|
||||||
|
|
||||||
int pen_overlay = KiROUND( plot_opts.m_HPGLPenOvr * 10.0 /
|
int pen_overlay = KiROUND( plot_opts.m_HPGLPenOvr * IU_PER_MILS /
|
||||||
plot_opts.m_PlotScale );
|
plot_opts.m_PlotScale );
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,7 +93,7 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
|
||||||
// Fit to 80% of the page
|
// Fit to 80% of the page
|
||||||
double Xscale = ( ( pageSizeIU.x * 0.8 ) / boardSize.x );
|
double Xscale = ( ( pageSizeIU.x * 0.8 ) / boardSize.x );
|
||||||
double Yscale = ( ( pageSizeIU.y * 0.8 ) / boardSize.y );
|
double Yscale = ( ( pageSizeIU.y * 0.8 ) / boardSize.y );
|
||||||
scale = MIN( Xscale, Yscale );
|
scale = std::min( Xscale, Yscale );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -100,7 +121,7 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
|
||||||
// why did we have to change these settings above?
|
// why did we have to change these settings above?
|
||||||
SetPlotSettings( plot_opts );
|
SetPlotSettings( plot_opts );
|
||||||
|
|
||||||
plotter->SetViewport( offset, IU_PER_DECIMILS, scale,
|
plotter->SetViewport( offset, IU_PER_DECIMILS, scale,
|
||||||
plot_opts.m_PlotMirror );
|
plot_opts.m_PlotMirror );
|
||||||
plotter->SetDefaultLineWidth( plot_opts.m_PlotLineWidth );
|
plotter->SetDefaultLineWidth( plot_opts.m_PlotLineWidth );
|
||||||
plotter->SetCreator( wxT( "PCBNEW-HPGL" ) );
|
plotter->SetCreator( wxT( "PCBNEW-HPGL" ) );
|
||||||
|
@ -113,7 +134,7 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
|
||||||
|
|
||||||
// The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway
|
// The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway
|
||||||
if( plot_opts.m_PlotFrameRef && !center )
|
if( plot_opts.m_PlotFrameRef && !center )
|
||||||
PlotWorkSheet( plotter, GetScreen() );
|
PlotWorkSheet( plotter, GetScreen(), plot_opts.GetPlotLineWidth() );
|
||||||
|
|
||||||
Plot_Layer( plotter, aLayer, aTraceMode );
|
Plot_Layer( plotter, aLayer, aTraceMode );
|
||||||
plotter->EndPlot();
|
plotter->EndPlot();
|
||||||
|
|
|
@ -111,7 +111,7 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
|
||||||
plotter->SetScaleAdjust( plotOpts.m_FineScaleAdjustX,
|
plotter->SetScaleAdjust( plotOpts.m_FineScaleAdjustX,
|
||||||
plotOpts.m_FineScaleAdjustY );
|
plotOpts.m_FineScaleAdjustY );
|
||||||
plotter->SetPlotWidthAdj( plotOpts.m_FineWidthAdjust );
|
plotter->SetPlotWidthAdj( plotOpts.m_FineWidthAdjust );
|
||||||
plotter->SetViewport( offset, IU_PER_DECIMILS, scale,
|
plotter->SetViewport( offset, IU_PER_DECIMILS, scale,
|
||||||
plotOpts.m_PlotMirror );
|
plotOpts.m_PlotMirror );
|
||||||
plotter->SetDefaultLineWidth( plotOpts.m_PlotLineWidth );
|
plotter->SetDefaultLineWidth( plotOpts.m_PlotLineWidth );
|
||||||
plotter->SetCreator( wxT( "PCBNEW-PS" ) );
|
plotter->SetCreator( wxT( "PCBNEW-PS" ) );
|
||||||
|
@ -121,7 +121,7 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
|
||||||
|
|
||||||
/* The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway */
|
/* The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway */
|
||||||
if( plotOpts.m_PlotFrameRef && !center )
|
if( plotOpts.m_PlotFrameRef && !center )
|
||||||
PlotWorkSheet( plotter, GetScreen() );
|
PlotWorkSheet( plotter, GetScreen(), plotOpts.GetPlotLineWidth() );
|
||||||
|
|
||||||
// If plot a negative board:
|
// If plot a negative board:
|
||||||
// Draw a black rectangle (background for plot board in white)
|
// Draw a black rectangle (background for plot board in white)
|
||||||
|
|
Loading…
Reference in New Issue