mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-13 17:53:11 +02:00
REMOVED: HPGL plotting.
Its sketch-mode greatly complicates the plotting code and it is poorly maintained due to lack of use.
This commit is contained in:
parent
db23ee481c
commit
c452fe9686
@ -528,7 +528,6 @@ set( PLOTTERS_CONTROL_SRCS
|
||||
plotters/plotter.cpp
|
||||
plotters/DXF_plotter.cpp
|
||||
plotters/GERBER_plotter.cpp
|
||||
plotters/HPGL_plotter.cpp
|
||||
plotters/PDF_plotter.cpp
|
||||
plotters/PS_plotter.cpp
|
||||
plotters/SVG_plotter.cpp
|
||||
|
@ -23,28 +23,9 @@
|
||||
#include <i18n_utility.h>
|
||||
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_HPGL::GEN_MODE,
|
||||
{
|
||||
{ JOB_EXPORT_PCB_HPGL::GEN_MODE::MULTI, "multi" },
|
||||
{ JOB_EXPORT_PCB_HPGL::GEN_MODE::SINGLE, "single" },
|
||||
} )
|
||||
|
||||
|
||||
JOB_EXPORT_PCB_HPGL::JOB_EXPORT_PCB_HPGL() :
|
||||
JOB_EXPORT_PCB_PLOT( JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::HPGL, "hpgl", false ),
|
||||
m_genMode( GEN_MODE::MULTI ), m_defaultPenSize( 0.381 ), m_penSpeed( 20 ), m_penNumber( 1 )
|
||||
{
|
||||
m_plotDrawingSheet = false;
|
||||
|
||||
m_params.emplace_back( new JOB_PARAM<wxString>( "color_theme",
|
||||
&m_colorTheme, m_colorTheme ) );
|
||||
m_params.emplace_back( new JOB_PARAM<GEN_MODE>( "gen_mode", &m_genMode, m_genMode ) );
|
||||
m_params.emplace_back( new JOB_PARAM<double>( "scale", &m_scale, m_scale ) );
|
||||
m_params.emplace_back( new JOB_PARAM<double>( "default_pen_size",
|
||||
&m_defaultPenSize, m_defaultPenSize ) );
|
||||
m_params.emplace_back( new JOB_PARAM<int>( "pen_speed", &m_penSpeed, m_penSpeed ) );
|
||||
m_params.emplace_back( new JOB_PARAM<int>( "pen_number", &m_penNumber, m_penNumber ) );
|
||||
}
|
||||
JOB_EXPORT_PCB_PLOT( JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::HPGL, "hpgl", false )
|
||||
{}
|
||||
|
||||
|
||||
wxString JOB_EXPORT_PCB_HPGL::GetDefaultDescription() const
|
||||
@ -53,10 +34,4 @@ wxString JOB_EXPORT_PCB_HPGL::GetDefaultDescription() const
|
||||
}
|
||||
|
||||
|
||||
wxString JOB_EXPORT_PCB_HPGL::GetSettingsDialogTitle() const
|
||||
{
|
||||
return wxString::Format( _( "Export HPGL Job Settings" ) );
|
||||
}
|
||||
|
||||
|
||||
REGISTER_JOB( pcb_export_hpgl, _HKI( "PCB: Export HPGL" ), KIWAY::FACE_PCB, JOB_EXPORT_PCB_HPGL );
|
||||
REGISTER_DEPRECATED_JOB( pcb_export_hpgl, _HKI( "PCB: Export HPGL" ), KIWAY::FACE_PCB, JOB_EXPORT_PCB_HPGL );
|
||||
|
@ -21,11 +21,6 @@
|
||||
#ifndef JOB_EXPORT_PCB_HPGL_H
|
||||
#define JOB_EXPORT_PCB_HPGL_H
|
||||
|
||||
#include <kicommon.h>
|
||||
#include <kicommon.h>
|
||||
#include <layer_ids.h>
|
||||
#include <lseq.h>
|
||||
#include <wx/string.h>
|
||||
#include <jobs/job_export_pcb_plot.h>
|
||||
|
||||
|
||||
@ -34,18 +29,6 @@ class KICOMMON_API JOB_EXPORT_PCB_HPGL : public JOB_EXPORT_PCB_PLOT
|
||||
public:
|
||||
JOB_EXPORT_PCB_HPGL();
|
||||
wxString GetDefaultDescription() const override;
|
||||
wxString GetSettingsDialogTitle() const override;
|
||||
|
||||
enum class GEN_MODE
|
||||
{
|
||||
SINGLE,
|
||||
MULTI
|
||||
};
|
||||
|
||||
GEN_MODE m_genMode;
|
||||
double m_defaultPenSize;
|
||||
int m_penSpeed;
|
||||
int m_penNumber;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -29,30 +29,6 @@ NLOHMANN_JSON_SERIALIZE_ENUM( JOB_PAGE_SIZE,
|
||||
{ JOB_PAGE_SIZE::PAGE_SIZE_A, "A" },
|
||||
} )
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_HPGL_PAGE_SIZE,
|
||||
{
|
||||
{ JOB_HPGL_PAGE_SIZE::DEFAULT, "default" },
|
||||
{ JOB_HPGL_PAGE_SIZE::SIZE_A5, "A5" },
|
||||
{ JOB_HPGL_PAGE_SIZE::SIZE_A4, "A4" },
|
||||
{ JOB_HPGL_PAGE_SIZE::SIZE_A3, "A3" },
|
||||
{ JOB_HPGL_PAGE_SIZE::SIZE_A2, "A2" },
|
||||
{ JOB_HPGL_PAGE_SIZE::SIZE_A1, "A1" },
|
||||
{ JOB_HPGL_PAGE_SIZE::SIZE_A0, "A0" },
|
||||
{ JOB_HPGL_PAGE_SIZE::SIZE_A, "A" },
|
||||
{ JOB_HPGL_PAGE_SIZE::SIZE_B, "B" },
|
||||
{ JOB_HPGL_PAGE_SIZE::SIZE_C, "C" },
|
||||
{ JOB_HPGL_PAGE_SIZE::SIZE_D, "D" },
|
||||
{ JOB_HPGL_PAGE_SIZE::SIZE_E, "E" },
|
||||
} )
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_HPGL_PLOT_ORIGIN_AND_UNITS,
|
||||
{
|
||||
{ JOB_HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_BOT_LEFT, "default" },
|
||||
{ JOB_HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_CENTER, "A5" },
|
||||
{ JOB_HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_PAGE, "A4" },
|
||||
{ JOB_HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_CONTENT, "A3" },
|
||||
} )
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM( SCH_PLOT_FORMAT,
|
||||
{
|
||||
{ SCH_PLOT_FORMAT::HPGL, "hpgl" },
|
||||
@ -73,13 +49,10 @@ JOB_EXPORT_SCH_PLOT::JOB_EXPORT_SCH_PLOT( bool aOutputIsDirectory ) :
|
||||
m_pageSizeSelect( JOB_PAGE_SIZE::PAGE_SIZE_AUTO ),
|
||||
m_useBackgroundColor( true ),
|
||||
m_minPenWidth( 847 /* hairline @ 300dpi */ ),
|
||||
m_HPGLPenSize( 1.0 ),
|
||||
m_HPGLPaperSizeSelect( JOB_HPGL_PAGE_SIZE::DEFAULT ),
|
||||
m_PDFPropertyPopups( true ),
|
||||
m_PDFHierarchicalLinks( true ),
|
||||
m_PDFMetadata( true ),
|
||||
m_theme(),
|
||||
m_HPGLPlotOrigin( JOB_HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_CONTENT )
|
||||
m_theme()
|
||||
{
|
||||
m_params.emplace_back( new JOB_PARAM<SCH_PLOT_FORMAT>( "format",
|
||||
&m_plotFormat, m_plotFormat ) );
|
||||
@ -105,12 +78,6 @@ JOB_EXPORT_SCH_PLOT::JOB_EXPORT_SCH_PLOT( bool aOutputIsDirectory ) :
|
||||
m_params.emplace_back( new JOB_PARAM<int>( "min_pen_width",
|
||||
&m_minPenWidth, m_minPenWidth ) );
|
||||
|
||||
m_params.emplace_back( new JOB_PARAM<double>( "hpgl_pen_size",
|
||||
&m_HPGLPenSize, m_HPGLPenSize ) );
|
||||
|
||||
m_params.emplace_back( new JOB_PARAM<JOB_HPGL_PAGE_SIZE>( "hpgl_page_size",
|
||||
&m_HPGLPaperSizeSelect, m_HPGLPaperSizeSelect ) );
|
||||
|
||||
m_params.emplace_back( new JOB_PARAM<bool>( "pdf_property_popups",
|
||||
&m_PDFPropertyPopups, m_PDFPropertyPopups ) );
|
||||
|
||||
@ -122,10 +89,6 @@ JOB_EXPORT_SCH_PLOT::JOB_EXPORT_SCH_PLOT( bool aOutputIsDirectory ) :
|
||||
|
||||
m_params.emplace_back( new JOB_PARAM<wxString>( "color_theme",
|
||||
&m_theme, m_theme ) );
|
||||
|
||||
m_params.emplace_back( new JOB_PARAM<JOB_HPGL_PLOT_ORIGIN_AND_UNITS>( "hpgl_plot_origin",
|
||||
&m_HPGLPlotOrigin, m_HPGLPlotOrigin ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -218,15 +181,9 @@ wxString JOB_EXPORT_SCH_PLOT_HPGL::GetDefaultDescription() const
|
||||
}
|
||||
|
||||
|
||||
wxString JOB_EXPORT_SCH_PLOT_HPGL::GetSettingsDialogTitle() const
|
||||
{
|
||||
return _( "Export HPGL Job Settings" );
|
||||
}
|
||||
|
||||
|
||||
REGISTER_JOB( sch_export_plot_svg, _HKI( "Schematic: Export SVG" ), KIWAY::FACE_SCH,
|
||||
JOB_EXPORT_SCH_PLOT_SVG );
|
||||
REGISTER_JOB( sch_export_plot_hpgl, _HKI( "Schematic: Export HPGL" ), KIWAY::FACE_SCH,
|
||||
REGISTER_DEPRECATED_JOB( sch_export_plot_hpgl, _HKI( "Schematic: Export HPGL" ), KIWAY::FACE_SCH,
|
||||
JOB_EXPORT_SCH_PLOT_HPGL );
|
||||
REGISTER_JOB( sch_export_plot_ps, _HKI( "Schematic: Export Postscript" ), KIWAY::FACE_SCH,
|
||||
JOB_EXPORT_SCH_PLOT_PS );
|
||||
|
@ -27,32 +27,6 @@
|
||||
#include "job.h"
|
||||
|
||||
|
||||
enum class JOB_HPGL_PLOT_ORIGIN_AND_UNITS
|
||||
{
|
||||
PLOTTER_BOT_LEFT,
|
||||
PLOTTER_CENTER,
|
||||
USER_FIT_PAGE,
|
||||
USER_FIT_CONTENT,
|
||||
};
|
||||
|
||||
|
||||
enum class JOB_HPGL_PAGE_SIZE
|
||||
{
|
||||
DEFAULT = 0,
|
||||
SIZE_A5,
|
||||
SIZE_A4,
|
||||
SIZE_A3,
|
||||
SIZE_A2,
|
||||
SIZE_A1,
|
||||
SIZE_A0,
|
||||
SIZE_A,
|
||||
SIZE_B,
|
||||
SIZE_C,
|
||||
SIZE_D,
|
||||
SIZE_E,
|
||||
};
|
||||
|
||||
|
||||
enum class JOB_PAGE_SIZE
|
||||
{
|
||||
PAGE_SIZE_AUTO,
|
||||
@ -89,14 +63,10 @@ public:
|
||||
JOB_PAGE_SIZE m_pageSizeSelect;
|
||||
bool m_useBackgroundColor;
|
||||
int m_minPenWidth;
|
||||
double m_HPGLPenSize; // for HPGL format only: pen size
|
||||
JOB_HPGL_PAGE_SIZE m_HPGLPaperSizeSelect;
|
||||
bool m_PDFPropertyPopups;
|
||||
bool m_PDFHierarchicalLinks;
|
||||
bool m_PDFMetadata;
|
||||
wxString m_theme;
|
||||
|
||||
JOB_HPGL_PLOT_ORIGIN_AND_UNITS m_HPGLPlotOrigin;
|
||||
};
|
||||
|
||||
|
||||
@ -141,7 +111,6 @@ class KICOMMON_API JOB_EXPORT_SCH_PLOT_HPGL : public JOB_EXPORT_SCH_PLOT
|
||||
public:
|
||||
JOB_EXPORT_SCH_PLOT_HPGL();
|
||||
wxString GetDefaultDescription() const override;
|
||||
wxString GetSettingsDialogTitle() const override;
|
||||
};
|
||||
|
||||
#endif
|
@ -20,14 +20,14 @@
|
||||
|
||||
#include <jobs/job_registry.h>
|
||||
|
||||
bool JOB_REGISTRY::Add( const wxString& aName, JOB_REGISTRY_ENTRY entry )
|
||||
bool JOB_REGISTRY::Add( const wxString& aName, JOB_REGISTRY_ENTRY entry, bool aDeprecated )
|
||||
{
|
||||
entry.deprecated = aDeprecated;
|
||||
|
||||
REGISTRY_MAP_T& registry = getRegistry();
|
||||
|
||||
if( registry.find( aName ) != registry.end() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
registry[aName] = entry;
|
||||
return true;
|
||||
|
@ -29,6 +29,7 @@ public:
|
||||
KIWAY::FACE_T kifaceType;
|
||||
std::function<JOB*()> createFunc;
|
||||
wxString title;
|
||||
bool deprecated = false;
|
||||
};
|
||||
|
||||
class KICOMMON_API JOB_REGISTRY
|
||||
@ -36,7 +37,7 @@ class KICOMMON_API JOB_REGISTRY
|
||||
public:
|
||||
typedef std::unordered_map<wxString, JOB_REGISTRY_ENTRY> REGISTRY_MAP_T;
|
||||
|
||||
static bool Add( const wxString& aName, JOB_REGISTRY_ENTRY entry );
|
||||
static bool Add( const wxString& aName, JOB_REGISTRY_ENTRY entry, bool aDeprecated = false );
|
||||
|
||||
static KIWAY::FACE_T GetKifaceType( const wxString& aName );
|
||||
|
||||
@ -44,10 +45,9 @@ public:
|
||||
static T* CreateInstance( const wxString& aName )
|
||||
{
|
||||
REGISTRY_MAP_T& registry = getRegistry();
|
||||
|
||||
if( registry.find( aName ) == registry.end() )
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return registry[aName].createFunc();
|
||||
}
|
||||
@ -67,4 +67,12 @@ private:
|
||||
return new T(); \
|
||||
}, \
|
||||
title } )
|
||||
// newline required to appease warning for REGISTER_JOB macro
|
||||
// newline required to appease warning for REGISTER_JOB macro
|
||||
|
||||
#define REGISTER_DEPRECATED_JOB( job_name, title, face, T ) bool job_name##_entry = JOB_REGISTRY::Add( #job_name, \
|
||||
{ face, []() \
|
||||
{ \
|
||||
return new T(); \
|
||||
}, \
|
||||
title }, true )
|
||||
// newline required to appease warning for REGISTER_DEPRECATED_JOB macro
|
@ -1,927 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright The 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file HPGL_plotter.cpp
|
||||
* @brief KiCad plotter for HPGL file format.
|
||||
* Since this plot engine is mostly intended for import in external programs,
|
||||
* sadly HPGL/2 isn't supported a lot... some of the primitives use overlapped
|
||||
* strokes to fill the shape.
|
||||
*/
|
||||
|
||||
/* Some HPGL commands:
|
||||
* Note: the HPGL unit is 25 micrometers
|
||||
* All commands MUST be terminated by a semi-colon or a linefeed.
|
||||
* Spaces can NOT be substituted for required commas in the syntax of a command.
|
||||
*
|
||||
*
|
||||
* AA (Arc Absolute): Angle is a floating point # (requires non integer value)
|
||||
* Draws an arc with the center at (X,Y).
|
||||
* A positive angle creates a counter-clockwise arc.
|
||||
* If the chord angle is specified,
|
||||
* this will be the number of degrees used for stepping around the arc.
|
||||
* If no value is given then a default value of five degrees is used.
|
||||
* AA x, y, a {,b};
|
||||
*
|
||||
* AR (Arc Relative):
|
||||
* AR Dx, Dy, a {, b};
|
||||
*
|
||||
* CA (Alternate Character Set):
|
||||
* CA {n};
|
||||
*
|
||||
* CI (Circle):
|
||||
* CI r {,b};
|
||||
*
|
||||
* CP (Character Plot):
|
||||
* CP {h, v};
|
||||
* h [-127.9999 .. 127.9999] Number of characters horizontally
|
||||
* v [-127.9999 .. 127.9999] Number of characters vertically
|
||||
*
|
||||
* CS (Standard Character Set):
|
||||
* CS {n};
|
||||
*
|
||||
* DR (Relative Direction for Label Text):
|
||||
* DR s, a;
|
||||
*
|
||||
* DI (Absolute Direction for Label Text):
|
||||
* DI {s, a};
|
||||
*
|
||||
* DT (Define Terminator - this character becomes unavailable except to terminate a label string.
|
||||
* Default is ^C control-C):
|
||||
* DT t;
|
||||
*
|
||||
* EA (rEctangle Absolute - Unfilled, from current position to diagonal x,y):
|
||||
* EA x, y;
|
||||
*
|
||||
* ER (rEctangle Relative - Unfilled, from current position to diagonal x,y):
|
||||
* ER x,y;
|
||||
*
|
||||
* FT (Fill Type):
|
||||
* FT {s {,l {a}}};
|
||||
*
|
||||
* IM (Input Mask):
|
||||
* IM {f};
|
||||
*
|
||||
* IN (Initialize): This command instructs the controller to begin processing the HPGL plot file.
|
||||
* Without this, the commands in the file are received but never executed.
|
||||
* If multiple IN s are found during execution of the file,
|
||||
* the controller performs a Pause/Cancel operation.
|
||||
* All motion from the previous job, yet to be executed, is lost,
|
||||
* and the new information is executed.
|
||||
* IN;
|
||||
*
|
||||
* IP Input P1 and P2:
|
||||
* IP {P1x, P1y {, P2x, P2y}};
|
||||
*
|
||||
* IW (Input Window):
|
||||
* IW {XUL, YUL, XOR, YOR};
|
||||
*
|
||||
* LB (Label):
|
||||
* LB c1 .. cn t;
|
||||
*
|
||||
* PA (Plot Absolute): Moves to an absolute HPGL position and sets absolute mode for
|
||||
* future PU and PD commands. If no arguments follow the command,
|
||||
* only absolute mode is set.
|
||||
* PA {x1, y1 {{PU|PD|,} ..., ..., xn, yn}};
|
||||
* P1x, P1y, P2x, P2y [Integer in ASCII]
|
||||
*
|
||||
* PD (Pen Down): Executes <current pen> pen then moves to the requested position
|
||||
* if one is specified. This position is dependent on whether absolute
|
||||
* or relative mode is set. This command performs no motion in 3-D mode,
|
||||
* but the outputs and feedrates are affected.
|
||||
* PD {x, y};
|
||||
*
|
||||
* PM Polygon mode
|
||||
* associated commands:
|
||||
* PM2 End polygon mode
|
||||
* FP Fill polygon
|
||||
* EP Draw polygon outline
|
||||
*
|
||||
* PR (Plot Relative): Moves to the relative position specified and sets relative mode
|
||||
* for future PU and PD commands.
|
||||
* If no arguments follow the command, only relative mode is set.
|
||||
* PR {Dx1, Dy1 {{PU|PD|,} ..., ..., Dxn, Dyn}};
|
||||
*
|
||||
* PS (Paper Size):
|
||||
* PS {n};
|
||||
*
|
||||
* PT (Pen Thickness): in mm
|
||||
* PT {l};
|
||||
*
|
||||
* PU (Pen Up): Executes <current pen> pen then moves to the requested position
|
||||
* if one is specified. This position is dependent on whether absolute
|
||||
* or relative mode is set.
|
||||
* This command performs no motion in 3-D mode, but the outputs
|
||||
* and feedrates are affected.
|
||||
* PU {x, y};
|
||||
*
|
||||
* RA (Rectangle Absolute - Filled, from current position to diagonal x,y):
|
||||
* RA x, y;
|
||||
*
|
||||
* RO (Rotate Coordinate System):
|
||||
* RO;
|
||||
*
|
||||
* RR (Rectangle Relative - Filled, from current position to diagonal x,y):
|
||||
* RR x, y;
|
||||
*
|
||||
* SA (Select Alternate Set):
|
||||
* SA;
|
||||
*
|
||||
* SC (Scale):
|
||||
* SC {Xmin, Xmax, Ymin, Ymax};
|
||||
*
|
||||
* SI (Absolute Character Size):
|
||||
* SI b, h;
|
||||
* b [-127.9999 .. 127.9999, keine 0]
|
||||
* h [-127.9999 .. 127.9999, keine 0]
|
||||
*
|
||||
* SL (Character Slant):
|
||||
* SL {a};
|
||||
* a [-3.5 .. -0.5, 0.5 .. 3.5]
|
||||
*
|
||||
* SP (Select Pen): Selects a new pen or tool for use.
|
||||
* If no pen number or a value of zero is given,
|
||||
* the controller performs an EOF (end of file command).
|
||||
* Once an EOF is performed, no motion is executed,
|
||||
* until a new IN command is received.
|
||||
* SP n;
|
||||
*
|
||||
* SR (Relative Character Size):
|
||||
* SR {b, h};
|
||||
* b [-127.9999 .. 127.9999, keine 0]
|
||||
* h [-127.9999 .. 127.9999, keine 0]
|
||||
*
|
||||
* SS (Select Standard Set):
|
||||
* SS;
|
||||
*
|
||||
* TL (Tick Length):
|
||||
* TL {tp {, tm}};
|
||||
*
|
||||
* UC (User Defined Character):
|
||||
* UC {i,} x1, y1, {i,} x2, y2, ... {i,} xn, yn;
|
||||
*
|
||||
* VS (Velocity Select):
|
||||
* VS {v {, n}};
|
||||
* v [1 .. 40] in cm/s
|
||||
* n [1 .. 8]
|
||||
*
|
||||
* XT (X Tick):
|
||||
* XT;
|
||||
*
|
||||
* YT (Y Tick):
|
||||
* YT;
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include <string_utils.h>
|
||||
#include <convert_basic_shapes_to_polygon.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
#include <trigo.h>
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <plotters/plotter_hpgl.h>
|
||||
|
||||
|
||||
/// Compute the distance between two VECTOR2D points.
|
||||
static double dpoint_dist( const VECTOR2D& a, const VECTOR2D& b );
|
||||
|
||||
|
||||
// The hpgl command to close a polygon def, fill it and plot outline:
|
||||
// PM 2; ends the polygon definition and closes it if not closed
|
||||
// FP; fills the polygon
|
||||
// EP; draws the polygon outline. It usually gives a better look to the filled polygon
|
||||
static std::string hpgl_end_polygon_cmd = "PM 2; FP; EP;\n";
|
||||
|
||||
|
||||
// HPGL scale factor (1 Plotter Logical Unit = 1/40mm = 25 micrometers)
|
||||
// PLUsPERDECIMIL = (25.4 / 10000) / 0.025
|
||||
static const double PLUsPERDECIMIL = 0.1016;
|
||||
|
||||
|
||||
HPGL_PLOTTER::HPGL_PLOTTER() :
|
||||
m_arcTargetChordLength( 0 ),
|
||||
m_arcMinChordDegrees( 5.0, DEGREES_T ),
|
||||
m_lineStyle( LINE_STYLE::SOLID ),
|
||||
m_useUserCoords( false ),
|
||||
m_fitUserCoords( false ),
|
||||
m_current_item( nullptr )
|
||||
{
|
||||
SetPenSpeed( 40 ); // Default pen speed = 40 cm/s; Pen speed is *always* in cm
|
||||
SetPenNumber( 1 ); // Default pen num = 1
|
||||
SetPenDiameter( 0.0 );
|
||||
}
|
||||
|
||||
|
||||
void HPGL_PLOTTER::SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
|
||||
double aScale, bool aMirror )
|
||||
{
|
||||
m_plotOffset = aOffset;
|
||||
m_plotScale = aScale;
|
||||
m_IUsPerDecimil = aIusPerDecimil;
|
||||
m_iuPerDeviceUnit = PLUsPERDECIMIL / aIusPerDecimil;
|
||||
|
||||
// Compute the paper size in IUs.
|
||||
m_paperSize = m_pageInfo.GetSizeMils();
|
||||
m_paperSize.x *= 10.0 * aIusPerDecimil;
|
||||
m_paperSize.y *= 10.0 * aIusPerDecimil;
|
||||
m_plotMirror = aMirror;
|
||||
}
|
||||
|
||||
|
||||
void HPGL_PLOTTER::SetTargetChordLength( double chord_len )
|
||||
{
|
||||
m_arcTargetChordLength = userToDeviceSize( chord_len );
|
||||
}
|
||||
|
||||
|
||||
bool HPGL_PLOTTER::StartPlot( const wxString& aPageNumber )
|
||||
{
|
||||
wxASSERT( m_outputFile );
|
||||
fmt::print( m_outputFile, "IN;VS{};PU;PA;SP{};\n", m_penSpeed, m_penNumber );
|
||||
|
||||
// Set HPGL Pen Thickness (in mm) (useful in polygon fill command)
|
||||
double penThicknessMM = userToDeviceSize( m_penDiameter ) / 40;
|
||||
fmt::print( m_outputFile, "PT {:.1f};\n", penThicknessMM );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool HPGL_PLOTTER::EndPlot()
|
||||
{
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
fmt::print( m_outputFile, "PU;\n" );
|
||||
|
||||
flushItem();
|
||||
sortItems( m_items );
|
||||
|
||||
if( m_items.size() > 0 )
|
||||
{
|
||||
if( m_useUserCoords )
|
||||
{
|
||||
if( m_fitUserCoords )
|
||||
{
|
||||
BOX2D bbox = m_items.front().bbox;
|
||||
|
||||
for( HPGL_ITEM const& item : m_items )
|
||||
bbox.Merge( item.bbox );
|
||||
|
||||
fmt::print( m_outputFile, "SC{:.0f},{:.0f},{:.0f},{:.0f};\n",
|
||||
bbox.GetX(),
|
||||
bbox.GetX() + bbox.GetWidth(),
|
||||
bbox.GetY(),
|
||||
bbox.GetY() + bbox.GetHeight() );
|
||||
}
|
||||
else
|
||||
{
|
||||
VECTOR2D pagesize_device( m_paperSize * m_iuPerDeviceUnit );
|
||||
fmt::print( m_outputFile, "SC{:.0f},{:.0f},{:.0f},{:.0f};\n",
|
||||
0.0,
|
||||
pagesize_device.x,
|
||||
0.0,
|
||||
pagesize_device.y );
|
||||
}
|
||||
}
|
||||
|
||||
VECTOR2D loc = m_items.begin()->loc_start;
|
||||
bool pen_up = true;
|
||||
LINE_STYLE current_dash = LINE_STYLE::SOLID;
|
||||
int current_pen = m_penNumber;
|
||||
|
||||
for( HPGL_ITEM const& item : m_items )
|
||||
{
|
||||
if( item.loc_start != loc || pen_up )
|
||||
{
|
||||
if( !pen_up )
|
||||
{
|
||||
fmt::print( m_outputFile, "PU;" );
|
||||
pen_up = true;
|
||||
}
|
||||
|
||||
fmt::print( m_outputFile, "PA {:.0f},{:.0f};", item.loc_start.x, item.loc_start.y );
|
||||
}
|
||||
|
||||
if( item.dashType != current_dash )
|
||||
{
|
||||
current_dash = item.dashType;
|
||||
fmt::print( m_outputFile, "{}", lineStyleCommand( item.dashType ) );
|
||||
}
|
||||
|
||||
if( item.pen != current_pen )
|
||||
{
|
||||
if( !pen_up )
|
||||
{
|
||||
fmt::print( m_outputFile, "PU;" );
|
||||
pen_up = true;
|
||||
}
|
||||
|
||||
fmt::print( m_outputFile, "SP{};", item.pen );
|
||||
current_pen = item.pen;
|
||||
}
|
||||
|
||||
if( pen_up && !item.lift_before )
|
||||
{
|
||||
fmt::print( m_outputFile, "PD;" );
|
||||
pen_up = false;
|
||||
}
|
||||
else if( !pen_up && item.lift_before )
|
||||
{
|
||||
fmt::print( m_outputFile, "PU;" );
|
||||
pen_up = true;
|
||||
}
|
||||
|
||||
fmt::print( m_outputFile, "{}", item.content );
|
||||
|
||||
if( !item.pen_returns )
|
||||
{
|
||||
// Assume commands drop the pen
|
||||
pen_up = false;
|
||||
}
|
||||
|
||||
if( item.lift_after )
|
||||
{
|
||||
fmt::print( m_outputFile, "PU;" );
|
||||
pen_up = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
loc = item.loc_end;
|
||||
}
|
||||
|
||||
fmt::print( m_outputFile, "\n" );
|
||||
}
|
||||
}
|
||||
|
||||
fmt::print( m_outputFile, "PU;PA;SP0;\n" );
|
||||
fclose( m_outputFile );
|
||||
m_outputFile = nullptr;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void HPGL_PLOTTER::SetPenDiameter( double diameter )
|
||||
{
|
||||
m_penDiameter = diameter;
|
||||
}
|
||||
|
||||
|
||||
void HPGL_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T aFill, int aWidth )
|
||||
{
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
// EA command seems to always fill the rectangle, so plot as a polygon instead
|
||||
std::vector<VECTOR2I> cornerList;
|
||||
|
||||
cornerList.emplace_back( p1.x, p1.y );
|
||||
cornerList.emplace_back( p2.x, p1.y );
|
||||
cornerList.emplace_back( p2.x, p2.y );
|
||||
cornerList.emplace_back( p1.x, p2.y );
|
||||
cornerList.emplace_back( p1.x, p1.y );
|
||||
|
||||
PlotPoly( cornerList, aFill, aWidth, nullptr );
|
||||
}
|
||||
|
||||
|
||||
void HPGL_PLOTTER::Circle( const VECTOR2I& aCenter, int aDiameter, FILL_T aFill, int aWidth )
|
||||
{
|
||||
wxASSERT( m_outputFile );
|
||||
double radius = userToDeviceSize( aDiameter / 2 );
|
||||
VECTOR2D center_dev = userToDeviceCoordinates( aCenter );
|
||||
SetCurrentLineWidth( aWidth );
|
||||
|
||||
double const circumf = 2.0 * M_PI * radius;
|
||||
double const target_chord_length = m_arcTargetChordLength;
|
||||
EDA_ANGLE chord_angle = ANGLE_360 * target_chord_length / circumf;
|
||||
|
||||
chord_angle = std::clamp( chord_angle, m_arcMinChordDegrees, ANGLE_45 );
|
||||
|
||||
if( aFill == FILL_T::FILLED_SHAPE )
|
||||
{
|
||||
// Draw the filled area
|
||||
MoveTo( aCenter );
|
||||
startOrAppendItem( center_dev, fmt::format( "PM 0;CI {:g},{:g};{}",
|
||||
radius,
|
||||
chord_angle.AsDegrees(),
|
||||
hpgl_end_polygon_cmd ) );
|
||||
m_current_item->lift_before = true;
|
||||
m_current_item->bbox.Merge( BOX2D( center_dev - radius,
|
||||
VECTOR2D( 2 * radius, 2 * radius ) ) );
|
||||
PenFinish();
|
||||
}
|
||||
|
||||
if( radius > 0 )
|
||||
{
|
||||
MoveTo( aCenter );
|
||||
startOrAppendItem( center_dev, fmt::format( "CI {:g},{:g};",
|
||||
radius,
|
||||
chord_angle.AsDegrees() ) );
|
||||
m_current_item->lift_before = true;
|
||||
m_current_item->bbox.Merge( BOX2D( center_dev - radius,
|
||||
VECTOR2D( 2 * radius, 2 * radius ) ) );
|
||||
PenFinish();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void HPGL_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill, int aWidth,
|
||||
void* aData )
|
||||
{
|
||||
if( aFill == FILL_T::NO_FILL && aWidth == 0 )
|
||||
return;
|
||||
|
||||
SetCurrentLineWidth( aWidth );
|
||||
|
||||
if( aCornerList.size() <= 1 )
|
||||
return;
|
||||
|
||||
MoveTo( aCornerList[0] );
|
||||
startItem( userToDeviceCoordinates( aCornerList[0] ) );
|
||||
|
||||
if( aFill != FILL_T::NO_FILL )
|
||||
{
|
||||
// Draw the filled area
|
||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
||||
|
||||
m_current_item->content += std::string( "PM 0;\n" ); // Start polygon
|
||||
|
||||
for( unsigned ii = 1; ii < aCornerList.size(); ++ii )
|
||||
LineTo( aCornerList[ii] );
|
||||
|
||||
int ii = aCornerList.size() - 1;
|
||||
|
||||
if( aCornerList[ii] != aCornerList[0] )
|
||||
LineTo( aCornerList[0] );
|
||||
|
||||
m_current_item->content += hpgl_end_polygon_cmd; // Close, fill polygon and draw outlines
|
||||
m_current_item->pen_returns = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Plot only the polygon outline.
|
||||
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
|
||||
LineTo( aCornerList[ii] );
|
||||
}
|
||||
|
||||
PenFinish();
|
||||
}
|
||||
|
||||
|
||||
void HPGL_PLOTTER::PenTo( const VECTOR2I& pos, char plume )
|
||||
{
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
if( plume == 'Z' )
|
||||
{
|
||||
m_penState = 'Z';
|
||||
flushItem();
|
||||
return;
|
||||
}
|
||||
|
||||
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
|
||||
VECTOR2D lastpos_dev = userToDeviceCoordinates( m_penLastpos );
|
||||
|
||||
if( plume == 'U' )
|
||||
{
|
||||
m_penState = 'U';
|
||||
flushItem();
|
||||
}
|
||||
else if( plume == 'D' )
|
||||
{
|
||||
m_penState = 'D';
|
||||
startOrAppendItem( lastpos_dev, fmt::format( "PA {:.0f},{:.0f};",
|
||||
pos_dev.x,
|
||||
pos_dev.y ) );
|
||||
m_current_item->loc_end = pos_dev;
|
||||
m_current_item->bbox.Merge( pos_dev );
|
||||
}
|
||||
|
||||
m_penLastpos = pos;
|
||||
}
|
||||
|
||||
|
||||
void HPGL_PLOTTER::SetDash( int aLineWidth, LINE_STYLE aLineStyle )
|
||||
{
|
||||
m_lineStyle = aLineStyle;
|
||||
flushItem();
|
||||
}
|
||||
|
||||
|
||||
void HPGL_PLOTTER::ThickSegment( const VECTOR2I& start, const VECTOR2I& end,
|
||||
int width, OUTLINE_MODE tracemode, void* aData )
|
||||
{
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
// Suppress overlap if pen is too big
|
||||
if( m_penDiameter >= width )
|
||||
{
|
||||
MoveTo( start );
|
||||
FinishTo( end );
|
||||
}
|
||||
else
|
||||
{
|
||||
segmentAsOval( start, end, width, tracemode );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void HPGL_PLOTTER::Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
|
||||
const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill, int aWidth )
|
||||
{
|
||||
if( aRadius <= 0 )
|
||||
return;
|
||||
|
||||
// Avoid integer overflow when calculating the center point
|
||||
if( std::abs( aAngle.AsDegrees() ) < 5 )
|
||||
{
|
||||
polyArc( aCenter, aStartAngle, aAngle, aRadius, aFill, aWidth );
|
||||
return;
|
||||
}
|
||||
|
||||
double const radius_device = userToDeviceSize( aRadius );
|
||||
double const circumf_device = 2.0 * M_PI * radius_device;
|
||||
double const target_chord_length = m_arcTargetChordLength;
|
||||
EDA_ANGLE chord_angle = ANGLE_360 * target_chord_length / circumf_device;
|
||||
|
||||
chord_angle = std::max( m_arcMinChordDegrees, std::min( chord_angle, ANGLE_45 ) );
|
||||
|
||||
VECTOR2D centre_device = userToDeviceCoordinates( aCenter );
|
||||
EDA_ANGLE angle = aAngle;
|
||||
|
||||
if( !m_plotMirror )
|
||||
angle = -angle;
|
||||
|
||||
EDA_ANGLE startAngle = -aStartAngle;
|
||||
|
||||
// Calculate arc start point:
|
||||
VECTOR2I cmap( KiROUND( aCenter.x + aRadius * startAngle.Cos() ),
|
||||
KiROUND( aCenter.y - aRadius * startAngle.Sin() ) );
|
||||
VECTOR2D cmap_dev = userToDeviceCoordinates( cmap );
|
||||
|
||||
startOrAppendItem( cmap_dev, fmt::format( "AA {:.0f},{:.0f},{:g},{:g}",
|
||||
centre_device.x,
|
||||
centre_device.y,
|
||||
angle.AsDegrees(),
|
||||
chord_angle.AsDegrees() ) );
|
||||
|
||||
// TODO We could compute the final position and full bounding box instead...
|
||||
m_current_item->bbox.Merge( BOX2D( centre_device - radius_device,
|
||||
VECTOR2D( radius_device * 2, radius_device * 2 ) ) );
|
||||
m_current_item->lift_after = true;
|
||||
flushItem();
|
||||
}
|
||||
|
||||
|
||||
void HPGL_PLOTTER::FlashPadOval( const VECTOR2I& aPos, const VECTOR2I& aSize,
|
||||
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode, void* aData )
|
||||
{
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
VECTOR2I size( aSize );
|
||||
EDA_ANGLE orient( aOrient );
|
||||
|
||||
// The pad will be drawn as an oblong shape with size.y > size.x (Oval vertical orientation 0).
|
||||
if( size.x > size.y )
|
||||
{
|
||||
std::swap( size.x, size.y );
|
||||
orient += ANGLE_90;
|
||||
}
|
||||
|
||||
if( aTraceMode == FILLED )
|
||||
{
|
||||
int deltaxy = size.y - size.x; // distance between centers of the oval
|
||||
|
||||
FlashPadRect( aPos, VECTOR2I( size.x, deltaxy + KiROUND( m_penDiameter ) ), orient,
|
||||
aTraceMode, aData );
|
||||
|
||||
VECTOR2I pt( 0, deltaxy / 2 );
|
||||
RotatePoint( pt, orient );
|
||||
FlashPadCircle( pt + aPos, size.x, aTraceMode, aData );
|
||||
|
||||
pt = VECTOR2I( 0, -deltaxy / 2 );
|
||||
RotatePoint( pt, orient );
|
||||
FlashPadCircle( pt + aPos, size.x, aTraceMode, aData );
|
||||
}
|
||||
else // Plot in outline mode.
|
||||
{
|
||||
sketchOval( aPos, size, orient, KiROUND( m_penDiameter ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void HPGL_PLOTTER::FlashPadCircle( const VECTOR2I& pos, int diametre,
|
||||
OUTLINE_MODE trace_mode, void* aData )
|
||||
{
|
||||
wxASSERT( m_outputFile );
|
||||
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
|
||||
int radius = diametre / 2;
|
||||
|
||||
if( trace_mode == FILLED )
|
||||
{
|
||||
// if filled mode, the pen diameter is removed from diameter
|
||||
// to keep the pad size
|
||||
radius -= KiROUND( m_penDiameter ) / 2;
|
||||
|
||||
if( radius < 0 )
|
||||
radius = 0;
|
||||
}
|
||||
|
||||
double rsize = userToDeviceSize( radius );
|
||||
|
||||
if( trace_mode == FILLED ) // Plot in filled mode.
|
||||
{
|
||||
// A filled polygon uses always the current point to start the polygon.
|
||||
// Gives a correct current starting point for the circle
|
||||
MoveTo( VECTOR2I( pos.x + radius, pos.y ) );
|
||||
|
||||
// Plot filled area and its outline
|
||||
startOrAppendItem( userToDeviceCoordinates( VECTOR2I( pos.x + radius, pos.y ) ),
|
||||
fmt::format( "PM 0; PA {:.0f},{:.0f};CI {:.0f};{}",
|
||||
pos_dev.x,
|
||||
pos_dev.y,
|
||||
rsize,
|
||||
hpgl_end_polygon_cmd ) );
|
||||
m_current_item->lift_before = true;
|
||||
m_current_item->pen_returns = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Draw outline only:
|
||||
startOrAppendItem( pos_dev, fmt::format( "CI {:.0f};", rsize ) );
|
||||
m_current_item->lift_before = true;
|
||||
m_current_item->pen_returns = true;
|
||||
}
|
||||
|
||||
PenFinish();
|
||||
}
|
||||
|
||||
|
||||
void HPGL_PLOTTER::FlashPadRect( const VECTOR2I& aPos, const VECTOR2I& aPadSize,
|
||||
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode, void* aData )
|
||||
{
|
||||
// Build rect polygon:
|
||||
std::vector<VECTOR2I> corners;
|
||||
|
||||
int dx = aPadSize.x / 2;
|
||||
int dy = aPadSize.y / 2;
|
||||
|
||||
if( aTraceMode == FILLED )
|
||||
{
|
||||
// in filled mode, the pen diameter is removed from size
|
||||
// to compensate the extra size due to this pen size
|
||||
dx -= KiROUND( m_penDiameter ) / 2;
|
||||
dx = std::max( dx, 0);
|
||||
dy -= KiROUND( m_penDiameter ) / 2;
|
||||
dy = std::max( dy, 0);
|
||||
}
|
||||
|
||||
|
||||
corners.emplace_back( - dx, - dy );
|
||||
corners.emplace_back( - dx, + dy );
|
||||
corners.emplace_back( + dx, + dy );
|
||||
corners.emplace_back( + dx, - dy );
|
||||
|
||||
// Close polygon
|
||||
corners.emplace_back( - dx, - dy );
|
||||
|
||||
for( VECTOR2I& corner : corners )
|
||||
{
|
||||
RotatePoint( corner, aOrient );
|
||||
corner += aPos;
|
||||
}
|
||||
|
||||
PlotPoly( corners, aTraceMode == FILLED ? FILL_T::FILLED_SHAPE : FILL_T::NO_FILL );
|
||||
}
|
||||
|
||||
|
||||
void HPGL_PLOTTER::FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
|
||||
int aCornerRadius, const EDA_ANGLE& aOrient,
|
||||
OUTLINE_MODE aTraceMode, void* aData )
|
||||
{
|
||||
SHAPE_POLY_SET outline;
|
||||
|
||||
VECTOR2I size = aSize;
|
||||
|
||||
if( aTraceMode == FILLED )
|
||||
{
|
||||
// In filled mode, the pen diameter is removed from size to keep the pad size.
|
||||
size.x -= KiROUND( m_penDiameter ) / 2;
|
||||
size.x = std::max( size.x, 0);
|
||||
size.y -= KiROUND( m_penDiameter ) / 2;
|
||||
size.y = std::max( size.y, 0);
|
||||
|
||||
// keep aCornerRadius to a value < min size x,y < 2:
|
||||
aCornerRadius = std::min( aCornerRadius, std::min( size.x, size.y ) /2 );
|
||||
}
|
||||
|
||||
TransformRoundChamferedRectToPolygon( outline, aPadPos, size, aOrient, aCornerRadius, 0.0, 0,
|
||||
0, GetPlotterArcHighDef(), ERROR_INSIDE );
|
||||
|
||||
// TransformRoundRectToPolygon creates only one convex polygon
|
||||
std::vector<VECTOR2I> cornerList;
|
||||
SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
|
||||
cornerList.reserve( poly.PointCount() );
|
||||
|
||||
for( int ii = 0; ii < poly.PointCount(); ++ii )
|
||||
cornerList.emplace_back( poly.CPoint( ii ).x, poly.CPoint( ii ).y );
|
||||
|
||||
if( cornerList.back() != cornerList.front() )
|
||||
cornerList.push_back( cornerList.front() );
|
||||
|
||||
PlotPoly( cornerList, aTraceMode == FILLED ? FILL_T::FILLED_SHAPE : FILL_T::NO_FILL );
|
||||
}
|
||||
|
||||
|
||||
void HPGL_PLOTTER::FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
|
||||
const EDA_ANGLE& aOrient, SHAPE_POLY_SET* aPolygons,
|
||||
OUTLINE_MODE aTraceMode, void* aData )
|
||||
{
|
||||
std::vector<VECTOR2I> cornerList;
|
||||
|
||||
for( int cnt = 0; cnt < aPolygons->OutlineCount(); ++cnt )
|
||||
{
|
||||
SHAPE_LINE_CHAIN& poly = aPolygons->Outline( cnt );
|
||||
|
||||
cornerList.clear();
|
||||
cornerList.reserve( poly.PointCount() );
|
||||
|
||||
for( int ii = 0; ii < poly.PointCount(); ++ii )
|
||||
cornerList.emplace_back( poly.CPoint( ii ).x, poly.CPoint( ii ).y );
|
||||
|
||||
if( cornerList.back() != cornerList.front() )
|
||||
cornerList.push_back( cornerList.front() );
|
||||
|
||||
PlotPoly( cornerList, aTraceMode == FILLED ? FILL_T::FILLED_SHAPE : FILL_T::NO_FILL );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void HPGL_PLOTTER::FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
|
||||
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
|
||||
void* aData )
|
||||
{
|
||||
std::vector<VECTOR2I> cornerList;
|
||||
cornerList.reserve( 5 );
|
||||
|
||||
for( int ii = 0; ii < 4; ii++ )
|
||||
{
|
||||
VECTOR2I coord( aCorners[ii] );
|
||||
RotatePoint( coord, aPadOrient );
|
||||
coord += aPadPos;
|
||||
cornerList.push_back( coord );
|
||||
}
|
||||
|
||||
// Close polygon
|
||||
cornerList.push_back( cornerList.front() );
|
||||
|
||||
PlotPoly( cornerList, aTraceMode == FILLED ? FILL_T::FILLED_SHAPE : FILL_T::NO_FILL );
|
||||
}
|
||||
|
||||
|
||||
void HPGL_PLOTTER::FlashRegularPolygon( const VECTOR2I& aShapePos, int aRadius, int aCornerCount,
|
||||
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode,
|
||||
void* aData )
|
||||
{
|
||||
// Do nothing
|
||||
wxASSERT( 0 );
|
||||
}
|
||||
|
||||
|
||||
bool HPGL_PLOTTER::startItem( const VECTOR2D& location )
|
||||
{
|
||||
return startOrAppendItem( location );
|
||||
}
|
||||
|
||||
|
||||
void HPGL_PLOTTER::flushItem()
|
||||
{
|
||||
m_current_item = nullptr;
|
||||
}
|
||||
|
||||
|
||||
bool HPGL_PLOTTER::startOrAppendItem( const VECTOR2D& location, std::string const& content )
|
||||
{
|
||||
if( m_current_item == nullptr )
|
||||
{
|
||||
HPGL_ITEM item;
|
||||
item.loc_start = location;
|
||||
item.loc_end = location;
|
||||
item.bbox = BOX2D( location );
|
||||
item.pen = m_penNumber;
|
||||
item.dashType = m_lineStyle;
|
||||
item.content = content;
|
||||
m_items.push_back( item );
|
||||
m_current_item = &m_items.back();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_current_item->content += content;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void HPGL_PLOTTER::sortItems( std::list<HPGL_ITEM>& items )
|
||||
{
|
||||
if( items.size() < 2 )
|
||||
return;
|
||||
|
||||
std::list<HPGL_ITEM> target;
|
||||
|
||||
// Plot items are sorted to improve print time on mechanical plotters. This
|
||||
// means
|
||||
// 1) Avoid excess pen-switching - once a pen is selected, keep printing
|
||||
// with it until no more items using that pen remain.
|
||||
// 2) Within the items for one pen, avoid bouncing back and forth around
|
||||
// the page; items should be sequenced with nearby items.
|
||||
//
|
||||
// This is essentially a variant of the Traveling Salesman Problem where
|
||||
// the cities are themselves edges that must be traversed. This is of course
|
||||
// a famously NP-Hard problem and this particular variant has a monstrous
|
||||
// number of "cities". For now, we're using a naive nearest-neighbor search,
|
||||
// which is less than optimal but (usually!) better than nothing, very
|
||||
// simple to implement, and fast enough.
|
||||
//
|
||||
// Items are moved one at a time from `items` into `target`, searching
|
||||
// each time for the first one matching the above criteria. Then, all of
|
||||
// `target` is moved back into `items`.
|
||||
|
||||
// Get the first one started
|
||||
HPGL_ITEM last_item = items.front();
|
||||
items.pop_front();
|
||||
target.emplace_back( last_item );
|
||||
|
||||
while( !items.empty() )
|
||||
{
|
||||
auto best_it = items.begin();
|
||||
double best_dist = dpoint_dist( last_item.loc_end, best_it->loc_start );
|
||||
|
||||
for( auto search_it = best_it; search_it != items.end(); search_it++ )
|
||||
{
|
||||
// Immediately forget an item as "best" if another one is a better pen match
|
||||
if( best_it->pen != last_item.pen && search_it->pen == last_item.pen )
|
||||
{
|
||||
best_it = search_it;
|
||||
continue;
|
||||
}
|
||||
|
||||
double const dist = dpoint_dist( last_item.loc_end, search_it->loc_start );
|
||||
|
||||
if( dist < best_dist )
|
||||
{
|
||||
best_it = search_it;
|
||||
best_dist = dist;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
target.emplace_back( *best_it );
|
||||
last_item = *best_it;
|
||||
items.erase( best_it );
|
||||
}
|
||||
|
||||
items.splice( items.begin(), target );
|
||||
}
|
||||
|
||||
|
||||
const char* HPGL_PLOTTER::lineStyleCommand( LINE_STYLE aLineStyle )
|
||||
{
|
||||
switch( aLineStyle )
|
||||
{
|
||||
case LINE_STYLE::DASH: return "LT 2 4 1;";
|
||||
case LINE_STYLE::DOT: return "LT 1 1 1;";
|
||||
case LINE_STYLE::DASHDOT: return "LT 4 6 1;";
|
||||
case LINE_STYLE::DASHDOTDOT: return "LT 7 8 1;";
|
||||
default: return "LT;";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static double dpoint_dist( const VECTOR2D& a, const VECTOR2D& b )
|
||||
{
|
||||
VECTOR2D diff = a - b;
|
||||
return sqrt( diff.x * diff.x + diff.y * diff.y );
|
||||
}
|
@ -25,7 +25,6 @@
|
||||
#include <eda_item.h>
|
||||
#include <font/font.h>
|
||||
#include <plotters/plotter_dxf.h>
|
||||
#include <plotters/plotter_hpgl.h>
|
||||
#include <plotters/plotters_pslike.h>
|
||||
#include <plotters/plotter_gerber.h>
|
||||
#include <drawing_sheet/ds_data_item.h>
|
||||
@ -41,7 +40,6 @@ wxString GetDefaultPlotExtension( PLOT_FORMAT aFormat )
|
||||
case PLOT_FORMAT::DXF: return DXF_PLOTTER::GetDefaultFileExtension();
|
||||
case PLOT_FORMAT::POST: return PS_PLOTTER::GetDefaultFileExtension();
|
||||
case PLOT_FORMAT::PDF: return PDF_PLOTTER::GetDefaultFileExtension();
|
||||
case PLOT_FORMAT::HPGL: return HPGL_PLOTTER::GetDefaultFileExtension();
|
||||
case PLOT_FORMAT::GERBER: return GERBER_PLOTTER::GetDefaultFileExtension();
|
||||
case PLOT_FORMAT::SVG: return SVG_PLOTTER::GetDefaultFileExtension();
|
||||
default: wxFAIL; return wxEmptyString;
|
||||
|
@ -53,7 +53,6 @@
|
||||
|
||||
// static members (static to remember last state):
|
||||
int DIALOG_PLOT_SCHEMATIC::m_pageSizeSelect = PAGE_SIZE_AUTO;
|
||||
HPGL_PAGE_SIZE DIALOG_PLOT_SCHEMATIC::m_HPGLPaperSizeSelect = HPGL_PAGE_SIZE::DEFAULT;
|
||||
|
||||
|
||||
DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC( SCH_EDIT_FRAME* aEditFrame ) :
|
||||
@ -67,9 +66,8 @@ DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC( SCH_EDIT_FRAME* aEditFrame, wxWind
|
||||
DIALOG_PLOT_SCHEMATIC_BASE( aEditFrame ),
|
||||
m_editFrame( aEditFrame ),
|
||||
m_plotFormat( PLOT_FORMAT::UNDEFINED ),
|
||||
m_HPGLPenSize( 1.0 ),
|
||||
m_defaultLineWidth( aEditFrame, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits ),
|
||||
m_penWidth( aEditFrame, m_penWidthLabel, m_penWidthCtrl, m_penWidthUnits ), m_job( aJob )
|
||||
m_job( aJob )
|
||||
{
|
||||
m_configChanged = false;
|
||||
|
||||
@ -140,40 +138,28 @@ void DIALOG_PLOT_SCHEMATIC::initDlg()
|
||||
m_plotPDFHierarchicalLinks->SetValue( cfg->m_PlotPanel.pdf_hierarchical_links );
|
||||
m_plotPDFMetadata->SetValue( cfg->m_PlotPanel.pdf_metadata );
|
||||
|
||||
// HPGL plot origin and unit system configuration
|
||||
m_plotOriginOpt->SetSelection( cfg->m_PlotPanel.hpgl_origin );
|
||||
|
||||
m_HPGLPaperSizeSelect = static_cast<HPGL_PAGE_SIZE>( cfg->m_PlotPanel.hpgl_paper_size );
|
||||
|
||||
// HPGL Pen Size is stored in mm in config
|
||||
m_HPGLPenSize = cfg->m_PlotPanel.hpgl_pen_size * schIUScale.IU_PER_MM;
|
||||
|
||||
// Switch to the last save plot format
|
||||
PLOT_FORMAT fmt = static_cast<PLOT_FORMAT>( cfg->m_PlotPanel.format );
|
||||
|
||||
switch( fmt )
|
||||
switch( fmt )
|
||||
{
|
||||
default:
|
||||
case PLOT_FORMAT::POST: m_plotFormatOpt->SetSelection( 0 ); break;
|
||||
case PLOT_FORMAT::PDF: m_plotFormatOpt->SetSelection( 1 ); break;
|
||||
case PLOT_FORMAT::SVG: m_plotFormatOpt->SetSelection( 2 ); break;
|
||||
case PLOT_FORMAT::DXF: m_plotFormatOpt->SetSelection( 3 ); break;
|
||||
case PLOT_FORMAT::HPGL: m_plotFormatOpt->SetSelection( 4 ); break;
|
||||
case PLOT_FORMAT::HPGL: /* no longer supported */ break;
|
||||
}
|
||||
|
||||
if( fmt == PLOT_FORMAT::DXF || fmt == PLOT_FORMAT::HPGL )
|
||||
if( fmt == PLOT_FORMAT::DXF )
|
||||
m_plotBackgroundColor->Disable();
|
||||
|
||||
// Set the default line width (pen width which should be used for
|
||||
// items that do not have a pen size defined (like frame ref)
|
||||
// the default line width is stored in mils in config
|
||||
m_defaultLineWidth.SetValue(
|
||||
schIUScale.MilsToIU( cfg->m_Drawing.default_line_thickness ) );
|
||||
m_defaultLineWidth.SetValue( schIUScale.MilsToIU( cfg->m_Drawing.default_line_thickness ) );
|
||||
}
|
||||
|
||||
// Initialize HPGL specific widgets
|
||||
m_penWidth.SetDoubleValue( m_HPGLPenSize );
|
||||
|
||||
// Plot directory
|
||||
SCHEMATIC_SETTINGS& settings = m_editFrame->Schematic().Settings();
|
||||
wxString path = settings.m_PlotDirectoryName;
|
||||
@ -197,14 +183,9 @@ void DIALOG_PLOT_SCHEMATIC::initDlg()
|
||||
|
||||
m_plotBackgroundColor->SetValue( m_job->m_useBackgroundColor );
|
||||
m_defaultLineWidth.SetValue( m_job->m_minPenWidth );
|
||||
m_penWidth.SetDoubleValue( m_job->m_HPGLPenSize );
|
||||
m_HPGLPaperSizeSelect = static_cast<HPGL_PAGE_SIZE>( m_job->m_HPGLPaperSizeSelect );
|
||||
m_plotPDFPropertyPopups->SetValue( m_job->m_PDFPropertyPopups );
|
||||
m_plotPDFHierarchicalLinks->SetValue( m_job->m_PDFHierarchicalLinks );
|
||||
m_plotPDFMetadata->SetValue( m_job->m_PDFMetadata );
|
||||
m_colorTheme->Enable( m_job->m_plotFormat != SCH_PLOT_FORMAT::HPGL );
|
||||
m_ModeColorOption->Enable( m_job->m_plotFormat != SCH_PLOT_FORMAT::HPGL );
|
||||
m_plotOriginOpt->SetSelection( static_cast<int>( m_job->m_HPGLPlotOrigin ) );
|
||||
m_pageSizeSelect = static_cast<int>( m_job->m_pageSizeSelect );
|
||||
m_plotDrawingSheet->SetValue( m_job->m_plotDrawingSheet );
|
||||
setModeColor( !m_job->m_blackAndWhite );
|
||||
@ -217,7 +198,7 @@ void DIALOG_PLOT_SCHEMATIC::initDlg()
|
||||
case SCH_PLOT_FORMAT::PDF: m_plotFormatOpt->SetSelection( 1 ); break;
|
||||
case SCH_PLOT_FORMAT::SVG: m_plotFormatOpt->SetSelection( 2 ); break;
|
||||
case SCH_PLOT_FORMAT::DXF: m_plotFormatOpt->SetSelection( 3 ); break;
|
||||
case SCH_PLOT_FORMAT::HPGL: m_plotFormatOpt->SetSelection( 4 ); break;
|
||||
case SCH_PLOT_FORMAT::HPGL: /* no longer supported */ break;
|
||||
}
|
||||
|
||||
// And then hide it
|
||||
@ -284,22 +265,18 @@ PLOT_FORMAT DIALOG_PLOT_SCHEMATIC::GetPlotFileFormat()
|
||||
{
|
||||
switch( m_plotFormatOpt->GetSelection() )
|
||||
{
|
||||
default:
|
||||
case 0: return PLOT_FORMAT::POST;
|
||||
default:
|
||||
case 1: return PLOT_FORMAT::PDF;
|
||||
case 2: return PLOT_FORMAT::SVG;
|
||||
case 3: return PLOT_FORMAT::DXF;
|
||||
case 4: return PLOT_FORMAT::HPGL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PLOT_SCHEMATIC::OnPageSizeSelected( wxCommandEvent& event )
|
||||
{
|
||||
if( GetPlotFileFormat() == PLOT_FORMAT::HPGL )
|
||||
m_HPGLPaperSizeSelect = static_cast<HPGL_PAGE_SIZE>( m_paperSizeOption->GetSelection() );
|
||||
else
|
||||
m_pageSizeSelect = m_paperSizeOption->GetSelection();
|
||||
m_pageSizeSelect = m_paperSizeOption->GetSelection();
|
||||
}
|
||||
|
||||
|
||||
@ -316,29 +293,10 @@ void DIALOG_PLOT_SCHEMATIC::OnUpdateUI( wxUpdateUIEvent& event )
|
||||
|
||||
int selection;
|
||||
|
||||
if( fmt == PLOT_FORMAT::HPGL )
|
||||
{
|
||||
paperSizes.push_back( _( "A5" ) );
|
||||
paperSizes.push_back( _( "A4" ) );
|
||||
paperSizes.push_back( _( "A3" ) );
|
||||
paperSizes.push_back( _( "A2" ) );
|
||||
paperSizes.push_back( _( "A1" ) );
|
||||
paperSizes.push_back( _( "A0" ) );
|
||||
paperSizes.push_back( _( "A" ) );
|
||||
paperSizes.push_back( _( "B" ) );
|
||||
paperSizes.push_back( _( "C" ) );
|
||||
paperSizes.push_back( _( "D" ) );
|
||||
paperSizes.push_back( _( "E" ) );
|
||||
paperSizes.push_back( _( "A4" ) );
|
||||
paperSizes.push_back( _( "A" ) );
|
||||
|
||||
selection = static_cast<int>( m_HPGLPaperSizeSelect );
|
||||
}
|
||||
else
|
||||
{
|
||||
paperSizes.push_back( _( "A4" ) );
|
||||
paperSizes.push_back( _( "A" ) );
|
||||
|
||||
selection = m_pageSizeSelect;
|
||||
}
|
||||
selection = m_pageSizeSelect;
|
||||
|
||||
m_openFileAfterPlot->Enable( fmt == PLOT_FORMAT::PDF );
|
||||
m_plotPDFPropertyPopups->Enable( fmt == PLOT_FORMAT::PDF );
|
||||
@ -348,26 +306,19 @@ void DIALOG_PLOT_SCHEMATIC::OnUpdateUI( wxUpdateUIEvent& event )
|
||||
m_paperSizeOption->Set( paperSizes );
|
||||
m_paperSizeOption->SetSelection( selection );
|
||||
|
||||
m_defaultLineWidth.Enable(
|
||||
fmt == PLOT_FORMAT::POST || fmt == PLOT_FORMAT::PDF || fmt == PLOT_FORMAT::SVG );
|
||||
m_defaultLineWidth.Enable( fmt == PLOT_FORMAT::POST
|
||||
|| fmt == PLOT_FORMAT::PDF
|
||||
|| fmt == PLOT_FORMAT::SVG );
|
||||
|
||||
m_plotOriginTitle->Enable( fmt == PLOT_FORMAT::HPGL );
|
||||
m_plotOriginOpt->Enable( fmt == PLOT_FORMAT::HPGL );
|
||||
m_penWidth.Enable( fmt == PLOT_FORMAT::HPGL );
|
||||
|
||||
m_plotBackgroundColor->Enable(
|
||||
fmt == PLOT_FORMAT::POST || fmt == PLOT_FORMAT::PDF || fmt == PLOT_FORMAT::SVG );
|
||||
|
||||
m_colorTheme->Enable( fmt != PLOT_FORMAT::HPGL );
|
||||
m_ModeColorOption->Enable( fmt != PLOT_FORMAT::HPGL );
|
||||
m_plotBackgroundColor->Enable( fmt == PLOT_FORMAT::POST
|
||||
|| fmt == PLOT_FORMAT::PDF
|
||||
|| fmt == PLOT_FORMAT::SVG );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PLOT_SCHEMATIC::getPlotOptions( RENDER_SETTINGS* aSettings )
|
||||
{
|
||||
m_HPGLPenSize = m_penWidth.GetDoubleValue();
|
||||
|
||||
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
wxASSERT( cfg );
|
||||
|
||||
@ -380,16 +331,11 @@ void DIALOG_PLOT_SCHEMATIC::getPlotOptions( RENDER_SETTINGS* aSettings )
|
||||
cfg->m_PlotPanel.color_theme = colors->GetFilename();
|
||||
cfg->m_PlotPanel.frame_reference = getPlotDrawingSheet();
|
||||
cfg->m_PlotPanel.format = static_cast<int>( GetPlotFileFormat() );
|
||||
cfg->m_PlotPanel.hpgl_origin = m_plotOriginOpt->GetSelection();
|
||||
cfg->m_PlotPanel.hpgl_paper_size = static_cast<int>( m_HPGLPaperSizeSelect );
|
||||
cfg->m_PlotPanel.pdf_property_popups = m_plotPDFPropertyPopups->GetValue();
|
||||
cfg->m_PlotPanel.pdf_hierarchical_links = m_plotPDFHierarchicalLinks->GetValue();
|
||||
cfg->m_PlotPanel.pdf_metadata = m_plotPDFMetadata->GetValue();
|
||||
cfg->m_PlotPanel.open_file_after_plot = getOpenFileAfterPlot();
|
||||
|
||||
// HPGL Pen Size is stored in mm in config
|
||||
cfg->m_PlotPanel.hpgl_pen_size = m_HPGLPenSize / schIUScale.IU_PER_MM;
|
||||
|
||||
aSettings->SetDefaultFont( cfg->m_Appearance.default_font );
|
||||
}
|
||||
|
||||
@ -445,9 +391,7 @@ void DIALOG_PLOT_SCHEMATIC::OnPlotAll( wxCommandEvent& event )
|
||||
m_job->m_blackAndWhite = !getModeColor();
|
||||
m_job->m_useBackgroundColor = m_plotBackgroundColor->GetValue();
|
||||
m_job->m_minPenWidth = m_defaultLineWidth.GetIntValue();
|
||||
m_job->m_HPGLPenSize = m_penWidth.GetDoubleValue();
|
||||
|
||||
// m_job->m_HPGLPaperSizeSelect = m_HPGLPaperSizeSelect;
|
||||
m_job->m_pageSizeSelect = static_cast<JOB_PAGE_SIZE>( m_pageSizeSelect );
|
||||
m_job->m_PDFPropertyPopups = m_plotPDFPropertyPopups->GetValue();
|
||||
m_job->m_PDFHierarchicalLinks = m_plotPDFHierarchicalLinks->GetValue();
|
||||
@ -456,9 +400,6 @@ void DIALOG_PLOT_SCHEMATIC::OnPlotAll( wxCommandEvent& event )
|
||||
m_job->m_plotAll = true;
|
||||
m_job->SetConfiguredOutputPath( m_outputPath->GetValue() );
|
||||
|
||||
m_job->m_HPGLPlotOrigin =
|
||||
static_cast<JOB_HPGL_PLOT_ORIGIN_AND_UNITS>( m_plotOriginOpt->GetSelection() );
|
||||
|
||||
COLOR_SETTINGS* colors = getColorSettings();
|
||||
m_job->m_theme = colors->GetName();
|
||||
|
||||
@ -490,10 +431,6 @@ void DIALOG_PLOT_SCHEMATIC::plotSchematic( bool aPlotAll )
|
||||
plotOpts.m_PDFPropertyPopups = m_plotPDFPropertyPopups->GetValue();
|
||||
plotOpts.m_PDFHierarchicalLinks = m_plotPDFHierarchicalLinks->GetValue();
|
||||
plotOpts.m_PDFMetadata = m_plotPDFMetadata->GetValue();
|
||||
plotOpts.m_HPGLPaperSizeSelect = static_cast<HPGL_PAGE_SIZE>( m_HPGLPaperSizeSelect );
|
||||
plotOpts.m_HPGLPlotOrigin =
|
||||
static_cast<HPGL_PLOT_ORIGIN_AND_UNITS>( m_plotOriginOpt->GetSelection() );
|
||||
plotOpts.m_HPGLPenSize = m_HPGLPenSize;
|
||||
plotOpts.m_outputDirectory = getOutputPath();
|
||||
plotOpts.m_pageSizeSelect = m_pageSizeSelect;
|
||||
|
||||
|
@ -107,10 +107,7 @@ private:
|
||||
bool m_configChanged; // true if a project config param has changed
|
||||
PLOT_FORMAT m_plotFormat;
|
||||
static int m_pageSizeSelect; // Static to keep last option for some format
|
||||
static HPGL_PAGE_SIZE m_HPGLPaperSizeSelect; // for HPGL format only: last selected paper size
|
||||
double m_HPGLPenSize;
|
||||
UNIT_BINDER m_defaultLineWidth;
|
||||
UNIT_BINDER m_penWidth;
|
||||
JOB_EXPORT_SCH_PLOT* m_job;
|
||||
};
|
||||
|
||||
|
@ -39,10 +39,10 @@ DIALOG_PLOT_SCHEMATIC_BASE::DIALOG_PLOT_SCHEMATIC_BASE( wxWindow* parent, wxWind
|
||||
|
||||
m_optionsSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxString m_plotFormatOptChoices[] = { _("Postscript"), _("PDF"), _("SVG"), _("DXF"), _("HPGL") };
|
||||
wxString m_plotFormatOptChoices[] = { _("Postscript"), _("PDF"), _("SVG"), _("DXF") };
|
||||
int m_plotFormatOptNChoices = sizeof( m_plotFormatOptChoices ) / sizeof( wxString );
|
||||
m_plotFormatOpt = new wxRadioBox( this, wxID_ANY, _("Output Format"), wxDefaultPosition, wxDefaultSize, m_plotFormatOptNChoices, m_plotFormatOptChoices, 1, wxRA_SPECIFY_COLS );
|
||||
m_plotFormatOpt->SetSelection( 2 );
|
||||
m_plotFormatOpt->SetSelection( 1 );
|
||||
m_optionsSizer->Add( m_plotFormatOpt, 0, wxALIGN_TOP|wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbOptions;
|
||||
@ -121,42 +121,6 @@ DIALOG_PLOT_SCHEMATIC_BASE::DIALOG_PLOT_SCHEMATIC_BASE( wxWindow* parent, wxWind
|
||||
wxBoxSizer* bOptionsRight;
|
||||
bOptionsRight = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_HPGLOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("HPGL Options") ), wxVERTICAL );
|
||||
|
||||
wxGridBagSizer* gbSizer2;
|
||||
gbSizer2 = new wxGridBagSizer( 3, 3 );
|
||||
gbSizer2->SetFlexibleDirection( wxBOTH );
|
||||
gbSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_plotOriginTitle = new wxStaticText( m_HPGLOptionsSizer->GetStaticBox(), wxID_ANY, _("Position and units:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_plotOriginTitle->Wrap( -1 );
|
||||
gbSizer2->Add( m_plotOriginTitle, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
wxString m_plotOriginOptChoices[] = { _("Bottom left, plotter units"), _("Centered, plotter units"), _("Page fit, user units"), _("Content fit, user units") };
|
||||
int m_plotOriginOptNChoices = sizeof( m_plotOriginOptChoices ) / sizeof( wxString );
|
||||
m_plotOriginOpt = new wxChoice( m_HPGLOptionsSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_plotOriginOptNChoices, m_plotOriginOptChoices, 0 );
|
||||
m_plotOriginOpt->SetSelection( 0 );
|
||||
gbSizer2->Add( m_plotOriginOpt, wxGBPosition( 0, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
|
||||
|
||||
m_penWidthLabel = new wxStaticText( m_HPGLOptionsSizer->GetStaticBox(), wxID_ANY, _("Pen width:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_penWidthLabel->Wrap( -1 );
|
||||
gbSizer2->Add( m_penWidthLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_penWidthCtrl = new wxTextCtrl( m_HPGLOptionsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer2->Add( m_penWidthCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_penWidthUnits = new wxStaticText( m_HPGLOptionsSizer->GetStaticBox(), wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_penWidthUnits->Wrap( -1 );
|
||||
gbSizer2->Add( m_penWidthUnits, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
gbSizer2->AddGrowableCol( 1 );
|
||||
|
||||
m_HPGLOptionsSizer->Add( gbSizer2, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bOptionsRight->Add( m_HPGLOptionsSizer, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbSizer4;
|
||||
sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("PDF Options") ), wxVERTICAL );
|
||||
|
||||
|
@ -306,7 +306,7 @@
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices">"Postscript" "PDF" "SVG" "DXF" "HPGL"</property>
|
||||
<property name="choices">"Postscript" "PDF" "SVG" "DXF"</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
@ -339,7 +339,7 @@
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">2</property>
|
||||
<property name="selection">1</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxRA_SPECIFY_COLS</property>
|
||||
@ -1130,368 +1130,6 @@
|
||||
<property name="name">bOptionsRight</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBoxSizer" expanded="true">
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">HPGL Options</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_HPGLOptionsSizer</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="parent">1</property>
|
||||
<property name="permission">protected</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxGridBagSizer" expanded="true">
|
||||
<property name="empty_cell_size"></property>
|
||||
<property name="flexible_direction">wxBOTH</property>
|
||||
<property name="growablecols">1</property>
|
||||
<property name="growablerows"></property>
|
||||
<property name="hgap">3</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">gbSizer2</property>
|
||||
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
|
||||
<property name="permission">none</property>
|
||||
<property name="vgap">3</property>
|
||||
<object class="gbsizeritem" expanded="false">
|
||||
<property name="border">5</property>
|
||||
<property name="colspan">1</property>
|
||||
<property name="column">0</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="row">0</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxStaticText" expanded="false">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Position and units:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_plotOriginTitle</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="gbsizeritem" expanded="false">
|
||||
<property name="border">5</property>
|
||||
<property name="colspan">2</property>
|
||||
<property name="column">1</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="row">0</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxChoice" expanded="false">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices">"Bottom left, plotter units" "Centered, plotter units" "Page fit, user units" "Content fit, user units"</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_plotOriginOpt</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">0</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="gbsizeritem" expanded="false">
|
||||
<property name="border">5</property>
|
||||
<property name="colspan">1</property>
|
||||
<property name="column">0</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="row">1</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxStaticText" expanded="false">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Pen width:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_penWidthLabel</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="gbsizeritem" expanded="false">
|
||||
<property name="border">5</property>
|
||||
<property name="colspan">1</property>
|
||||
<property name="column">1</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
|
||||
<property name="row">1</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxTextCtrl" expanded="false">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength">0</property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_penWidthCtrl</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="gbsizeritem" expanded="false">
|
||||
<property name="border">5</property>
|
||||
<property name="colspan">1</property>
|
||||
<property name="column">2</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="row">1</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxStaticText" expanded="false">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">mm</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_penWidthUnits</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
|
||||
|
@ -60,12 +60,6 @@ class DIALOG_PLOT_SCHEMATIC_BASE : public DIALOG_SHIM
|
||||
wxStaticText* m_lineWidthLabel;
|
||||
wxTextCtrl* m_lineWidthCtrl;
|
||||
wxStaticText* m_lineWidthUnits;
|
||||
wxStaticBoxSizer* m_HPGLOptionsSizer;
|
||||
wxStaticText* m_plotOriginTitle;
|
||||
wxChoice* m_plotOriginOpt;
|
||||
wxStaticText* m_penWidthLabel;
|
||||
wxTextCtrl* m_penWidthCtrl;
|
||||
wxStaticText* m_penWidthUnits;
|
||||
wxCheckBox* m_plotPDFPropertyPopups;
|
||||
wxCheckBox* m_plotPDFHierarchicalLinks;
|
||||
wxCheckBox* m_plotPDFMetadata;
|
||||
|
@ -74,6 +74,7 @@
|
||||
#include <dialogs/dialog_plot_schematic.h>
|
||||
#include <dialogs/dialog_erc_job_config.h>
|
||||
#include <dialogs/dialog_symbol_fields_table.h>
|
||||
#include <confirm.h>
|
||||
|
||||
|
||||
EESCHEMA_JOBS_HANDLER::EESCHEMA_JOBS_HANDLER( KIWAY* aKiway ) :
|
||||
@ -125,6 +126,13 @@ EESCHEMA_JOBS_HANDLER::EESCHEMA_JOBS_HANDLER( KIWAY* aKiway ) :
|
||||
|
||||
wxCHECK( plotJob && editFrame, false );
|
||||
|
||||
if( plotJob->m_plotFormat == SCH_PLOT_FORMAT::HPGL )
|
||||
{
|
||||
DisplayErrorMessage( editFrame,
|
||||
_( "Plotting to HPGL is no longer supported as of KiCad 10.0." ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
DIALOG_PLOT_SCHEMATIC dlg( editFrame, aParent, plotJob );
|
||||
return dlg.ShowModal() == wxID_OK;
|
||||
} );
|
||||
@ -177,8 +185,7 @@ SCHEMATIC* EESCHEMA_JOBS_HANDLER::getSchematic( const wxString& aPath )
|
||||
}
|
||||
else if( Pgm().IsGUI() && Pgm().GetSettingsManager().IsProjectOpen() )
|
||||
{
|
||||
SCH_EDIT_FRAME* editFrame = static_cast<SCH_EDIT_FRAME*>( m_kiway->Player( FRAME_SCH,
|
||||
false ) );
|
||||
SCH_EDIT_FRAME* editFrame = static_cast<SCH_EDIT_FRAME*>( m_kiway->Player( FRAME_SCH, false ) );
|
||||
|
||||
if( editFrame )
|
||||
sch = &editFrame->Schematic();
|
||||
@ -253,6 +260,13 @@ int EESCHEMA_JOBS_HANDLER::JobExportPlot( JOB* aJob )
|
||||
|
||||
wxCHECK( aPlotJob, CLI::EXIT_CODES::ERR_UNKNOWN );
|
||||
|
||||
if( aPlotJob->m_plotFormat == SCH_PLOT_FORMAT::HPGL )
|
||||
{
|
||||
m_reporter->Report( _( "Plotting to HPGL is no longer supported as of KiCad 10.0.\n" ),
|
||||
RPT_SEVERITY_ERROR );
|
||||
return CLI::EXIT_CODES::ERR_ARGS;
|
||||
}
|
||||
|
||||
SCHEMATIC* sch = getSchematic( aPlotJob->m_filename );
|
||||
|
||||
if( !sch )
|
||||
@ -291,43 +305,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportPlot( JOB* aJob )
|
||||
case SCH_PLOT_FORMAT::PDF: format = PLOT_FORMAT::PDF; break;
|
||||
case SCH_PLOT_FORMAT::SVG: format = PLOT_FORMAT::SVG; break;
|
||||
case SCH_PLOT_FORMAT::POST: format = PLOT_FORMAT::POST; break;
|
||||
case SCH_PLOT_FORMAT::HPGL: format = PLOT_FORMAT::HPGL; break;
|
||||
}
|
||||
|
||||
HPGL_PAGE_SIZE hpglPageSize = HPGL_PAGE_SIZE::DEFAULT;
|
||||
|
||||
switch( aPlotJob->m_HPGLPaperSizeSelect )
|
||||
{
|
||||
case JOB_HPGL_PAGE_SIZE::DEFAULT: hpglPageSize = HPGL_PAGE_SIZE::DEFAULT; break;
|
||||
case JOB_HPGL_PAGE_SIZE::SIZE_A: hpglPageSize = HPGL_PAGE_SIZE::SIZE_A; break;
|
||||
case JOB_HPGL_PAGE_SIZE::SIZE_A0: hpglPageSize = HPGL_PAGE_SIZE::SIZE_A0; break;
|
||||
case JOB_HPGL_PAGE_SIZE::SIZE_A1: hpglPageSize = HPGL_PAGE_SIZE::SIZE_A1; break;
|
||||
case JOB_HPGL_PAGE_SIZE::SIZE_A2: hpglPageSize = HPGL_PAGE_SIZE::SIZE_A2; break;
|
||||
case JOB_HPGL_PAGE_SIZE::SIZE_A3: hpglPageSize = HPGL_PAGE_SIZE::SIZE_A3; break;
|
||||
case JOB_HPGL_PAGE_SIZE::SIZE_A4: hpglPageSize = HPGL_PAGE_SIZE::SIZE_A4; break;
|
||||
case JOB_HPGL_PAGE_SIZE::SIZE_A5: hpglPageSize = HPGL_PAGE_SIZE::SIZE_A5; break;
|
||||
case JOB_HPGL_PAGE_SIZE::SIZE_B: hpglPageSize = HPGL_PAGE_SIZE::SIZE_B; break;
|
||||
case JOB_HPGL_PAGE_SIZE::SIZE_C: hpglPageSize = HPGL_PAGE_SIZE::SIZE_C; break;
|
||||
case JOB_HPGL_PAGE_SIZE::SIZE_D: hpglPageSize = HPGL_PAGE_SIZE::SIZE_D; break;
|
||||
case JOB_HPGL_PAGE_SIZE::SIZE_E: hpglPageSize = HPGL_PAGE_SIZE::SIZE_E; break;
|
||||
}
|
||||
|
||||
HPGL_PLOT_ORIGIN_AND_UNITS hpglOrigin = HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_PAGE;
|
||||
|
||||
switch( aPlotJob->m_HPGLPlotOrigin )
|
||||
{
|
||||
case JOB_HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_BOT_LEFT:
|
||||
hpglOrigin = HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_BOT_LEFT;
|
||||
break;
|
||||
case JOB_HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_CENTER:
|
||||
hpglOrigin = HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_CENTER;
|
||||
break;
|
||||
case JOB_HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_CONTENT:
|
||||
hpglOrigin = HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_CONTENT;
|
||||
break;
|
||||
case JOB_HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_PAGE:
|
||||
hpglOrigin = HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_PAGE;
|
||||
break;
|
||||
case SCH_PLOT_FORMAT::HPGL: /* no longer supported */ break;
|
||||
}
|
||||
|
||||
int pageSizeSelect = PageFormatReq::PAGE_SIZE_AUTO;
|
||||
@ -349,9 +327,6 @@ int EESCHEMA_JOBS_HANDLER::JobExportPlot( JOB* aJob )
|
||||
|
||||
SCH_PLOT_OPTS plotOpts;
|
||||
plotOpts.m_blackAndWhite = aPlotJob->m_blackAndWhite;
|
||||
plotOpts.m_HPGLPaperSizeSelect = hpglPageSize;
|
||||
plotOpts.m_HPGLPenSize = aPlotJob->m_HPGLPenSize;
|
||||
plotOpts.m_HPGLPlotOrigin = hpglOrigin;
|
||||
plotOpts.m_PDFPropertyPopups = aPlotJob->m_PDFPropertyPopups;
|
||||
plotOpts.m_PDFHierarchicalLinks = aPlotJob->m_PDFHierarchicalLinks;
|
||||
plotOpts.m_PDFMetadata = aPlotJob->m_PDFMetadata;
|
||||
@ -749,8 +724,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportBom( JOB* aJob )
|
||||
|
||||
if( !schFmtPreset )
|
||||
{
|
||||
m_reporter->Report( wxString::Format( _( "BOM format preset '%s' not found" )
|
||||
+ wxS( "\n" ),
|
||||
m_reporter->Report( wxString::Format( _( "BOM format preset '%s' not found" ) + wxS( "\n" ),
|
||||
aBomJob->m_bomFmtPresetName ),
|
||||
RPT_SEVERITY_ERROR );
|
||||
|
||||
@ -898,12 +872,14 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob,
|
||||
|
||||
fn.SetName( filename );
|
||||
m_reporter->Report( wxString::Format( _( "Plotting symbol '%s' unit %d to '%s'\n" ),
|
||||
symbol->GetName(), unit, fn.GetFullPath() ),
|
||||
symbol->GetName(),
|
||||
unit,
|
||||
fn.GetFullPath() ),
|
||||
RPT_SEVERITY_ACTION );
|
||||
|
||||
// Get the symbol bounding box to fit the plot page to it
|
||||
BOX2I symbolBB = symbol->Flatten()->GetUnitBoundingBox(
|
||||
unit, bodyStyle, !aSvgJob->m_includeHiddenFields );
|
||||
BOX2I symbolBB = symbol->Flatten()->GetUnitBoundingBox( unit, bodyStyle,
|
||||
!aSvgJob->m_includeHiddenFields );
|
||||
PAGE_INFO pageInfo( PAGE_INFO::Custom );
|
||||
pageInfo.SetHeightMils( schIUScale.IUToMils( symbolBB.GetHeight() * 1.2 ) );
|
||||
pageInfo.SetWidthMils( schIUScale.IUToMils( symbolBB.GetWidth() * 1.2 ) );
|
||||
@ -923,8 +899,7 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob,
|
||||
|
||||
if( !plotter->OpenFile( fn.GetFullPath() ) )
|
||||
{
|
||||
m_reporter->Report( wxString::Format( _( "Unable to open destination '%s'" )
|
||||
+ wxS( "\n" ),
|
||||
m_reporter->Report( wxString::Format( _( "Unable to open destination '%s'" ) + wxS( "\n" ),
|
||||
fn.GetFullPath() ),
|
||||
RPT_SEVERITY_ERROR );
|
||||
|
||||
@ -1055,8 +1030,7 @@ int EESCHEMA_JOBS_HANDLER::JobSymUpgrade( JOB* aJob )
|
||||
}
|
||||
else if( fileType != SCH_IO_MGR::SCH_KICAD )
|
||||
{
|
||||
m_reporter->Report( _( "Output path must be specified to convert legacy and non-KiCad "
|
||||
"libraries\n" ),
|
||||
m_reporter->Report( _( "Output path must be specified to convert legacy and non-KiCad libraries\n" ),
|
||||
RPT_SEVERITY_ERROR );
|
||||
|
||||
return CLI::EXIT_CODES::ERR_INVALID_OUTPUT_CONFLICT;
|
||||
@ -1082,8 +1056,7 @@ int EESCHEMA_JOBS_HANDLER::JobSymUpgrade( JOB* aJob )
|
||||
|
||||
if( shouldSave )
|
||||
{
|
||||
m_reporter->Report( _( "Saving symbol library in updated format\n" ),
|
||||
RPT_SEVERITY_ACTION );
|
||||
m_reporter->Report( _( "Saving symbol library in updated format\n" ), RPT_SEVERITY_ACTION );
|
||||
|
||||
try
|
||||
{
|
||||
@ -1177,8 +1150,7 @@ int EESCHEMA_JOBS_HANDLER::JobSchErc( JOB* aJob )
|
||||
|
||||
markersProvider->SetSeverities( ercJob->m_severity );
|
||||
|
||||
m_reporter->Report( wxString::Format( _( "Found %d violations\n" ),
|
||||
markersProvider->GetCount() ),
|
||||
m_reporter->Report( wxString::Format( _( "Found %d violations\n" ), markersProvider->GetCount() ),
|
||||
RPT_SEVERITY_INFO );
|
||||
|
||||
ERC_REPORT reportWriter( sch, units );
|
||||
|
@ -561,15 +561,6 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
|
||||
m_params.emplace_back( new PARAM<bool>( "plot.pdf_metadata",
|
||||
&m_PlotPanel.pdf_metadata, true ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "plot.hpgl_paper_size",
|
||||
&m_PlotPanel.hpgl_paper_size, 0 ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<double>( "plot.hpgl_pen_size",
|
||||
&m_PlotPanel.hpgl_pen_size, 0.5 ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "plot.hpgl_origin",
|
||||
&m_PlotPanel.hpgl_origin, 0 ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "plot.other_open_file_after_plot",
|
||||
&m_PlotPanel.open_file_after_plot, false ) );
|
||||
|
||||
@ -913,9 +904,6 @@ bool EESCHEMA_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
||||
ret &= fromLegacy<bool>( aCfg, "PlotModeColor", "plot.color" );
|
||||
ret &= fromLegacy<int>( aCfg, "PlotFormat", "plot.format" );
|
||||
ret &= fromLegacy<bool>( aCfg, "PlotFrameRef", "plot.frame_reference" );
|
||||
ret &= fromLegacy<bool>( aCfg, "PlotHPGLOrg", "plot.hpgl_origin" );
|
||||
ret &= fromLegacy<int>( aCfg, "PlotHPGLPaperSize", "plot.hpgl_paper_size" );
|
||||
ret &= fromLegacy<double>( aCfg, "PlotHPGLPenSize", "plot.hpgl_pen_size" );
|
||||
|
||||
ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMEPos_x", "simulator.window.pos_x" );
|
||||
ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMEPos_y", "simulator.window.pos_y" );
|
||||
|
@ -266,9 +266,6 @@ public:
|
||||
wxString color_theme;
|
||||
int format;
|
||||
bool frame_reference;
|
||||
int hpgl_paper_size;
|
||||
double hpgl_pen_size;
|
||||
int hpgl_origin;
|
||||
bool pdf_property_popups;
|
||||
bool pdf_hierarchical_links;
|
||||
bool pdf_metadata;
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <common.h>
|
||||
#include <sch_plotter.h>
|
||||
#include <locale_io.h>
|
||||
#include <plotters/plotter_hpgl.h>
|
||||
#include <plotters/plotter_dxf.h>
|
||||
#include <plotters/plotters_pslike.h>
|
||||
|
||||
@ -49,27 +48,6 @@
|
||||
// (clear some data used to show the sheet on screen) and does not fully restore the "old" screen
|
||||
|
||||
|
||||
static const wxChar* plot_sheet_list( HPGL_PAGE_SIZE aSize )
|
||||
{
|
||||
switch( aSize )
|
||||
{
|
||||
default:
|
||||
case HPGL_PAGE_SIZE::DEFAULT: return nullptr;
|
||||
case HPGL_PAGE_SIZE::SIZE_A5: return wxT( "A5" );
|
||||
case HPGL_PAGE_SIZE::SIZE_A4: return wxT( "A4" );
|
||||
case HPGL_PAGE_SIZE::SIZE_A3: return wxT( "A3" );
|
||||
case HPGL_PAGE_SIZE::SIZE_A2: return wxT( "A2" );
|
||||
case HPGL_PAGE_SIZE::SIZE_A1: return wxT( "A1" );
|
||||
case HPGL_PAGE_SIZE::SIZE_A0: return wxT( "A0" );
|
||||
case HPGL_PAGE_SIZE::SIZE_A: return wxT( "A" );
|
||||
case HPGL_PAGE_SIZE::SIZE_B: return wxT( "B" );
|
||||
case HPGL_PAGE_SIZE::SIZE_C: return wxT( "C" );
|
||||
case HPGL_PAGE_SIZE::SIZE_D: return wxT( "D" );
|
||||
case HPGL_PAGE_SIZE::SIZE_E: return wxT( "E" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SCH_PLOTTER::SCH_PLOTTER( SCHEMATIC* aSchematic ) :
|
||||
m_schematic( aSchematic )
|
||||
{
|
||||
@ -694,192 +672,6 @@ bool SCH_PLOTTER::plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScree
|
||||
}
|
||||
|
||||
|
||||
void SCH_PLOTTER::createHPGLFiles( const SCH_PLOT_OPTS& aPlotOpts,
|
||||
SCH_RENDER_SETTINGS* aRenderSettings, REPORTER* aReporter )
|
||||
{
|
||||
SCH_SCREEN* screen = m_schematic->RootScreen();
|
||||
SCH_SHEET_PATH oldsheetpath = m_schematic->CurrentSheet();
|
||||
|
||||
/* When printing all pages, the printed page is not the current page. In complex hierarchies,
|
||||
* we must update symbol references and other parameters in the given printed SCH_SCREEN,
|
||||
* according to the sheet path because in complex hierarchies a SCH_SCREEN (a drawing ) is
|
||||
* shared between many sheets and symbol references depend on the actual sheet path used.
|
||||
*/
|
||||
SCH_SHEET_LIST sheetList;
|
||||
|
||||
if( aPlotOpts.m_plotAll )
|
||||
{
|
||||
sheetList.BuildSheetList( &m_schematic->Root(), true );
|
||||
sheetList.SortByPageNumbers();
|
||||
|
||||
// remove the non-selected pages if we are in plot pages mode
|
||||
if( aPlotOpts.m_plotPages.size() > 0 )
|
||||
{
|
||||
sheetList.TrimToPageNumbers( aPlotOpts.m_plotPages );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// in Eeschema, this prints the current page
|
||||
sheetList.push_back( m_schematic->CurrentSheet() );
|
||||
}
|
||||
|
||||
for( unsigned i = 0; i < sheetList.size(); i++ )
|
||||
{
|
||||
m_schematic->SetCurrentSheet( sheetList[i] );
|
||||
m_schematic->CurrentSheet().UpdateAllScreenReferences();
|
||||
m_schematic->SetSheetNumberAndCount();
|
||||
|
||||
screen = m_schematic->CurrentSheet().LastScreen();
|
||||
|
||||
if( !screen ) // LastScreen() may return NULL
|
||||
screen = m_schematic->RootScreen();
|
||||
|
||||
const PAGE_INFO& curPage = screen->GetPageSettings();
|
||||
|
||||
PAGE_INFO plotPage = curPage;
|
||||
|
||||
// if plotting on a page size other than curPage
|
||||
plotPage.SetType( plot_sheet_list( aPlotOpts.m_HPGLPaperSizeSelect ) );
|
||||
|
||||
// Calculation of conversion scales.
|
||||
double plot_scale = (double) plotPage.GetWidthMils() / curPage.GetWidthMils();
|
||||
|
||||
// Calculate offsets
|
||||
VECTOR2I plotOffset;
|
||||
wxString msg;
|
||||
|
||||
if( aPlotOpts.m_HPGLPlotOrigin == HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_CENTER )
|
||||
{
|
||||
plotOffset.x = plotPage.GetWidthIU( schIUScale.IU_PER_MILS ) / 2;
|
||||
plotOffset.y = -plotPage.GetHeightIU( schIUScale.IU_PER_MILS ) / 2;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
wxString fname = m_schematic->GetUniqueFilenameForCurrentSheet();
|
||||
// The sub sheet can be in a sub_hierarchy, but we plot the file in the
|
||||
// main project folder (or the folder specified by the caller),
|
||||
// so replace separators to create a unique filename:
|
||||
fname.Replace( "/", "_" );
|
||||
fname.Replace( "\\", "_" );
|
||||
wxString ext = HPGL_PLOTTER::GetDefaultFileExtension();
|
||||
wxFileName plotFileName = createPlotFileName( aPlotOpts, fname, ext, aReporter );
|
||||
|
||||
if( !plotFileName.IsOk() )
|
||||
return;
|
||||
|
||||
LOCALE_IO toggle;
|
||||
|
||||
if( plotOneSheetHpgl( plotFileName.GetFullPath(), screen, curPage, aRenderSettings,
|
||||
plotOffset, plot_scale, aPlotOpts ) )
|
||||
{
|
||||
if( aReporter )
|
||||
{
|
||||
msg.Printf( _( "Plotted to '%s'." ), plotFileName.GetFullPath() );
|
||||
aReporter->Report( msg, RPT_SEVERITY_ACTION );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( aReporter )
|
||||
{
|
||||
msg.Printf( _( "Failed to create file '%s'." ), plotFileName.GetFullPath() );
|
||||
aReporter->Report( msg, RPT_SEVERITY_ERROR );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( IO_ERROR& e )
|
||||
{
|
||||
if( aReporter )
|
||||
{
|
||||
msg.Printf( wxT( "HPGL Plotter exception: %s" ), e.What() );
|
||||
aReporter->Report( msg, RPT_SEVERITY_ERROR );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( aReporter )
|
||||
{
|
||||
aReporter->ReportTail( _( "Done." ), RPT_SEVERITY_INFO );
|
||||
}
|
||||
|
||||
restoreEnvironment( nullptr, oldsheetpath );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_PLOTTER::plotOneSheetHpgl( const wxString& aFileName, SCH_SCREEN* aScreen,
|
||||
const PAGE_INFO& aPageInfo, RENDER_SETTINGS* aRenderSettings,
|
||||
const VECTOR2I& aPlot0ffset, double aScale,
|
||||
const SCH_PLOT_OPTS& aPlotOpts )
|
||||
{
|
||||
HPGL_PLOTTER* plotter = new HPGL_PLOTTER();
|
||||
// Currently, plot units are in decimil
|
||||
|
||||
plotter->SetPageSettings( aPageInfo );
|
||||
plotter->SetRenderSettings( aRenderSettings );
|
||||
plotter->RenderSettings()->LoadColors( m_colorSettings );
|
||||
plotter->SetViewport( aPlot0ffset, schIUScale.IU_PER_MILS/10, aScale, false );
|
||||
|
||||
// TODO this could be configurable
|
||||
plotter->SetTargetChordLength( schIUScale.mmToIU( 0.6 ) );
|
||||
|
||||
switch( aPlotOpts.m_HPGLPlotOrigin )
|
||||
{
|
||||
case HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_BOT_LEFT:
|
||||
case HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_CENTER:
|
||||
default:
|
||||
plotter->SetUserCoords( false );
|
||||
break;
|
||||
case HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_PAGE:
|
||||
plotter->SetUserCoords( true );
|
||||
plotter->SetUserCoordsFit( false );
|
||||
break;
|
||||
case HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_CONTENT:
|
||||
plotter->SetUserCoords( true );
|
||||
plotter->SetUserCoordsFit( true );
|
||||
break;
|
||||
}
|
||||
|
||||
// Init :
|
||||
plotter->SetCreator( wxT( "Eeschema-HPGL" ) );
|
||||
|
||||
if( !plotter->OpenFile( aFileName ) )
|
||||
{
|
||||
delete plotter;
|
||||
return false;
|
||||
}
|
||||
|
||||
LOCALE_IO toggle;
|
||||
|
||||
// Pen num and pen speed are not initialized here.
|
||||
// Default HPGL driver values are used
|
||||
plotter->SetPenDiameter( aPlotOpts.m_HPGLPenSize );
|
||||
plotter->StartPlot( m_schematic->CurrentSheet().GetPageNumber() );
|
||||
|
||||
if( aPlotOpts.m_plotDrawingSheet )
|
||||
{
|
||||
wxString sheetName = m_schematic->CurrentSheet().Last()->GetName();
|
||||
wxString sheetPath = m_schematic->CurrentSheet().PathHumanReadable();
|
||||
|
||||
PlotDrawingSheet( plotter, &m_schematic->Prj(),
|
||||
aScreen->GetTitleBlock(),
|
||||
aPageInfo,
|
||||
aScreen->Schematic()->GetProperties(), aScreen->GetPageNumber(),
|
||||
aScreen->GetPageCount(), sheetName, sheetPath, aScreen->GetFileName(),
|
||||
COLOR4D::BLACK, aScreen->GetVirtualPageNumber() == 1 );
|
||||
}
|
||||
|
||||
aScreen->Plot( plotter, aPlotOpts );
|
||||
|
||||
plotter->EndPlot();
|
||||
|
||||
delete plotter;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void SCH_PLOTTER::createDXFFiles( const SCH_PLOT_OPTS& aPlotOpts,
|
||||
SCH_RENDER_SETTINGS* aRenderSettings, REPORTER* aReporter )
|
||||
{
|
||||
@ -1100,6 +892,6 @@ void SCH_PLOTTER::Plot( PLOT_FORMAT aPlotFormat, const SCH_PLOT_OPTS& aPlotOpts,
|
||||
case PLOT_FORMAT::DXF: createDXFFiles( aPlotOpts, aRenderSettings, aReporter ); break;
|
||||
case PLOT_FORMAT::PDF: createPDFFile( aPlotOpts, aRenderSettings, aReporter ); break;
|
||||
case PLOT_FORMAT::SVG: createSVGFiles( aPlotOpts, aRenderSettings, aReporter ); break;
|
||||
case PLOT_FORMAT::HPGL: createHPGLFiles( aPlotOpts, aRenderSettings, aReporter ); break;
|
||||
case PLOT_FORMAT::HPGL: /* no longer supported */ break;
|
||||
}
|
||||
}
|
||||
|
@ -43,15 +43,6 @@ using KIGFX::RENDER_SETTINGS;
|
||||
class PDF_PLOTTER;
|
||||
class REPORTER;
|
||||
|
||||
enum class HPGL_PLOT_ORIGIN_AND_UNITS
|
||||
{
|
||||
PLOTTER_BOT_LEFT,
|
||||
PLOTTER_CENTER,
|
||||
USER_FIT_PAGE,
|
||||
USER_FIT_CONTENT,
|
||||
};
|
||||
|
||||
|
||||
enum PageFormatReq
|
||||
{
|
||||
PAGE_SIZE_AUTO,
|
||||
@ -60,23 +51,6 @@ enum PageFormatReq
|
||||
};
|
||||
|
||||
|
||||
enum class HPGL_PAGE_SIZE
|
||||
{
|
||||
DEFAULT = 0,
|
||||
SIZE_A5,
|
||||
SIZE_A4,
|
||||
SIZE_A3,
|
||||
SIZE_A2,
|
||||
SIZE_A1,
|
||||
SIZE_A0,
|
||||
SIZE_A,
|
||||
SIZE_B,
|
||||
SIZE_C,
|
||||
SIZE_D,
|
||||
SIZE_E,
|
||||
};
|
||||
|
||||
|
||||
struct SCH_PLOT_OPTS
|
||||
{
|
||||
bool m_plotAll;
|
||||
@ -86,8 +60,6 @@ struct SCH_PLOT_OPTS
|
||||
bool m_blackAndWhite;
|
||||
int m_pageSizeSelect;
|
||||
bool m_useBackgroundColor;
|
||||
double m_HPGLPenSize; // for HPGL format only: pen size
|
||||
HPGL_PAGE_SIZE m_HPGLPaperSizeSelect;
|
||||
bool m_PDFPropertyPopups;
|
||||
bool m_PDFHierarchicalLinks;
|
||||
bool m_PDFMetadata;
|
||||
@ -96,23 +68,18 @@ struct SCH_PLOT_OPTS
|
||||
wxString m_outputDirectory;
|
||||
wxString m_outputFile;
|
||||
|
||||
HPGL_PLOT_ORIGIN_AND_UNITS m_HPGLPlotOrigin;
|
||||
|
||||
SCH_PLOT_OPTS() :
|
||||
m_plotAll( true ),
|
||||
m_plotDrawingSheet( true ),
|
||||
m_blackAndWhite( false ),
|
||||
m_pageSizeSelect( 0 ),
|
||||
m_useBackgroundColor( true ),
|
||||
m_HPGLPenSize( 1.0 ),
|
||||
m_HPGLPaperSizeSelect( HPGL_PAGE_SIZE::DEFAULT ),
|
||||
m_PDFPropertyPopups( false ),
|
||||
m_PDFHierarchicalLinks( false ),
|
||||
m_PDFMetadata( false ),
|
||||
m_theme(),
|
||||
m_outputDirectory(),
|
||||
m_outputFile(),
|
||||
m_HPGLPlotOrigin( HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_CONTENT )
|
||||
m_outputFile()
|
||||
{
|
||||
|
||||
}
|
||||
@ -173,14 +140,6 @@ protected:
|
||||
double aScale, const SCH_PLOT_OPTS& aPlotOpts );
|
||||
|
||||
|
||||
// HPGL
|
||||
void createHPGLFiles( const SCH_PLOT_OPTS& aPlotOpts, SCH_RENDER_SETTINGS* aRenderSettings,
|
||||
REPORTER* aReporter );
|
||||
bool plotOneSheetHpgl( const wxString& aFileName, SCH_SCREEN* aScreen,
|
||||
const PAGE_INFO& aPageInfo, RENDER_SETTINGS* aRenderSettings,
|
||||
const VECTOR2I& aPlot0ffset, double aScale,
|
||||
const SCH_PLOT_OPTS& aPlotOpts );
|
||||
|
||||
// PS
|
||||
void createPSFiles( const SCH_PLOT_OPTS& aPlotOpts, SCH_RENDER_SETTINGS* aRenderSettings,
|
||||
REPORTER* aReporter );
|
||||
|
@ -52,7 +52,7 @@ class PROJECT;
|
||||
* - rect
|
||||
* - polygons (for logos)
|
||||
* - graphic texts
|
||||
* - bitmaps (also for logos, but they cannot be plot by SVG, GERBER or HPGL plotters
|
||||
* - bitmaps (also for logos, but they cannot be plot by SVG or GERBER plotters
|
||||
* where we just plot the bounding box)
|
||||
*/
|
||||
class DS_DRAW_ITEM_BASE : public EDA_ITEM
|
||||
|
@ -87,7 +87,6 @@ enum main_id
|
||||
|
||||
ID_GEN_PLOT,
|
||||
ID_GEN_PLOT_PS,
|
||||
ID_GEN_PLOT_HPGL,
|
||||
ID_GEN_PLOT_GERBER,
|
||||
ID_GEN_PLOT_SVG,
|
||||
ID_GEN_PLOT_DXF,
|
||||
|
@ -658,7 +658,7 @@ protected: // variables used in most of plotters:
|
||||
// usually decimils)
|
||||
VECTOR2I m_plotOffset; // Plot offset (in IUs)
|
||||
bool m_plotMirror; // X axis orientation (SVG)
|
||||
// and plot mirrored (only for PS, PDF HPGL and SVG)
|
||||
// and plot mirrored (only for PS, PDF and SVG)
|
||||
bool m_mirrorIsHorizontal; // true to mirror horizontally (else vertically)
|
||||
bool m_yaxisReversed; // true if the Y axis is top to bottom (SVG)
|
||||
|
||||
|
@ -1,229 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright The 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Plotting engine (HPGL)
|
||||
*
|
||||
* @file plotter_hpgl.h
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <list>
|
||||
|
||||
#include "plotter.h"
|
||||
|
||||
|
||||
class HPGL_PLOTTER : public PLOTTER
|
||||
{
|
||||
public:
|
||||
HPGL_PLOTTER();
|
||||
|
||||
virtual PLOT_FORMAT GetPlotterType() const override
|
||||
{
|
||||
return PLOT_FORMAT::HPGL;
|
||||
}
|
||||
|
||||
static wxString GetDefaultFileExtension()
|
||||
{
|
||||
return wxString( wxT( "plt" ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the target length of chords used to draw approximated circles and arcs.
|
||||
*
|
||||
* @param chord_len the chord length in IUs.
|
||||
*/
|
||||
void SetTargetChordLength( double chord_len );
|
||||
|
||||
/// Switch to the user coordinate system
|
||||
void SetUserCoords( bool user_coords ) { m_useUserCoords = user_coords; }
|
||||
|
||||
/// Set whether the user coordinate system is fit to content
|
||||
void SetUserCoordsFit( bool user_coords_fit ) { m_fitUserCoords = user_coords_fit; }
|
||||
|
||||
/**
|
||||
* At the start of the HPGL plot pen speed and number are requested.
|
||||
*/
|
||||
virtual bool StartPlot( const wxString& aPageNumber ) override;
|
||||
|
||||
/**
|
||||
* HPGL end of plot: sort and emit graphics, pen return and release.
|
||||
*/
|
||||
virtual bool EndPlot() override;
|
||||
|
||||
/// HPGL doesn't handle color
|
||||
virtual void SetColorMode( bool aColorMode ) override {};
|
||||
|
||||
/// HPGL doesn't handle line thickness or color
|
||||
virtual void SetCurrentLineWidth( int width, void* aData = nullptr ) override
|
||||
{
|
||||
// This is the truth
|
||||
m_currentPenWidth = userToDeviceSize( m_penDiameter );
|
||||
}
|
||||
|
||||
/**
|
||||
* HPGL supports dashed lines.
|
||||
*/
|
||||
virtual void SetDash( int aLineWidth, LINE_STYLE aLineStyle ) override;
|
||||
|
||||
virtual void SetColor( const COLOR4D& color ) override {}
|
||||
|
||||
virtual void SetPenSpeed( int speed )
|
||||
{
|
||||
m_penSpeed = speed;
|
||||
}
|
||||
|
||||
virtual void SetPenNumber( int number )
|
||||
{
|
||||
m_penNumber = number;
|
||||
}
|
||||
|
||||
virtual void SetPenDiameter( double diameter );
|
||||
|
||||
virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
|
||||
double aScale, bool aMirror ) override;
|
||||
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T aFill,
|
||||
int aWidth = USE_DEFAULT_LINE_WIDTH ) override;
|
||||
virtual void Circle( const VECTOR2I& aCenter, int aDiameter, FILL_T aFill,
|
||||
int aWidth = USE_DEFAULT_LINE_WIDTH ) override;
|
||||
virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
|
||||
int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr ) override;
|
||||
|
||||
virtual void ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int width,
|
||||
OUTLINE_MODE tracemode, void* aData ) override;
|
||||
|
||||
virtual void PenTo( const VECTOR2I& pos, char plume ) override;
|
||||
|
||||
virtual void FlashPadCircle( const VECTOR2I& aPadPos, int aDiameter,
|
||||
OUTLINE_MODE aTraceMode, void* aData ) override;
|
||||
virtual void FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
|
||||
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
|
||||
void* aData ) override;
|
||||
virtual void FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
|
||||
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode,
|
||||
void* aData ) override;
|
||||
virtual void FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
|
||||
int aCornerRadius, const EDA_ANGLE& aOrient,
|
||||
OUTLINE_MODE aTraceMode, void* aData ) override;
|
||||
virtual void FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
|
||||
const EDA_ANGLE& aOrient, SHAPE_POLY_SET* aPolygons,
|
||||
OUTLINE_MODE aTraceMode, void* aData ) override;
|
||||
virtual void FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
|
||||
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
|
||||
void* aData ) override;
|
||||
virtual void FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter, int aCornerCount,
|
||||
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode,
|
||||
void* aData ) override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Plot an arc.
|
||||
*
|
||||
* Command
|
||||
* PU PY x, y; PD start_arc_X AA, start_arc_Y, angle, NbSegm; PU;
|
||||
* Or PU PY x, y; PD start_arc_X AA, start_arc_Y, angle, PU;
|
||||
*
|
||||
* center is the center of the arc.
|
||||
* StAngled is the start angle of the arc.
|
||||
* aAngle is angle the arc.
|
||||
* Radius is the radius of the arc.
|
||||
*/
|
||||
virtual void Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
|
||||
const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill,
|
||||
int aWidth = USE_DEFAULT_LINE_WIDTH ) override;
|
||||
|
||||
/**
|
||||
* Start a new HPGL_ITEM if necessary, keeping the current one if it exists.
|
||||
*
|
||||
* @param location is the location of the item.
|
||||
* @return whether a new item was made.
|
||||
*/
|
||||
bool startItem( const VECTOR2D& location );
|
||||
|
||||
/// Flush the current HPGL_ITEM and clear out the current item pointer.
|
||||
void flushItem();
|
||||
|
||||
/**
|
||||
* Start a new HPGL_ITEM with the given string if necessary, or append the
|
||||
* string to the current item.
|
||||
*
|
||||
* @param location is the location of the item, if a new one is made.
|
||||
* @param content is the content substring.
|
||||
* @return whether a new item was made.
|
||||
*/
|
||||
bool startOrAppendItem( const VECTOR2D& location, const std::string& content = "" );
|
||||
|
||||
struct HPGL_ITEM
|
||||
{
|
||||
HPGL_ITEM() :
|
||||
lift_before( false ),
|
||||
lift_after( false ),
|
||||
pen_returns( false ),
|
||||
pen( 0 ),
|
||||
dashType( LINE_STYLE::SOLID ) {}
|
||||
|
||||
/// Location the pen should start at
|
||||
VECTOR2D loc_start;
|
||||
|
||||
/// Location the pen will be at when it finishes. If this is not known,
|
||||
/// leave it equal to loc_start and set lift_after.
|
||||
VECTOR2D loc_end;
|
||||
|
||||
/// Bounding box of this item
|
||||
BOX2D bbox;
|
||||
|
||||
/// Whether the command should be executed with the pen lifted
|
||||
bool lift_before;
|
||||
|
||||
/// Whether the pen must be lifted after the command. If the location of the pen
|
||||
/// is not known, this must be set (so that another command starting at loc_end
|
||||
/// is not immediately executed with no lift).
|
||||
bool lift_after;
|
||||
|
||||
/// Whether the pen returns to its original state after the command. Otherwise,
|
||||
/// the pen is assumed to be down following the command.
|
||||
bool pen_returns;
|
||||
|
||||
int pen; /// Pen number for this command
|
||||
LINE_STYLE dashType; /// Line style for this command
|
||||
std::string content; /// Text of the command
|
||||
};
|
||||
|
||||
/// Sort a list of HPGL items to improve plotting speed on mechanical plotters.
|
||||
///
|
||||
/// @param items - items to sort
|
||||
static void sortItems( std::list<HPGL_ITEM>& items );
|
||||
|
||||
/// Return the plot command corresponding to a line type
|
||||
static const char* lineStyleCommand( LINE_STYLE aLineStyle );
|
||||
|
||||
protected:
|
||||
int m_penSpeed;
|
||||
int m_penNumber;
|
||||
double m_penDiameter;
|
||||
double m_arcTargetChordLength;
|
||||
EDA_ANGLE m_arcMinChordDegrees;
|
||||
LINE_STYLE m_lineStyle;
|
||||
bool m_useUserCoords;
|
||||
bool m_fitUserCoords;
|
||||
|
||||
std::list<HPGL_ITEM> m_items;
|
||||
HPGL_ITEM* m_current_item;
|
||||
};
|
@ -18,158 +18,21 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <base_units.h>
|
||||
#include "command_pcb_export_hpgl.h"
|
||||
#include <cli/exit_codes.h>
|
||||
#include "jobs/job_export_pcb_hpgl.h"
|
||||
#include <kiface_base.h>
|
||||
#include <string_utils.h>
|
||||
#include <wx/crt.h>
|
||||
|
||||
#include <locale_io.h>
|
||||
|
||||
#define ARG_MODE_SINGLE "--mode-single"
|
||||
#define ARG_MODE_MULTI "--mode-multi"
|
||||
#define ARG_DEFAULT_PEN_SIZE "--default-pen-size"
|
||||
#define ARG_PEN_NUMBER "--pen-number"
|
||||
#define ARG_PEN_SPEED "--pen-speed"
|
||||
|
||||
CLI::PCB_EXPORT_HPGL_COMMAND::PCB_EXPORT_HPGL_COMMAND() :
|
||||
PCB_EXPORT_BASE_COMMAND( "hpgl", false, true )
|
||||
{
|
||||
m_argParser.add_description( UTF8STDSTR( _( "Generate HPGL from a list of layers" ) ) );
|
||||
|
||||
addLayerArg();
|
||||
addCommonLayersArg();
|
||||
addDrawingSheetArg();
|
||||
addDefineArg();
|
||||
|
||||
m_argParser.add_argument( "-m", ARG_MIRROR )
|
||||
.help( UTF8STDSTR( _( "Mirror the board (useful for trying to show bottom layers)" ) ) )
|
||||
.flag();
|
||||
|
||||
m_argParser.add_argument( "--erd", ARG_EXCLUDE_REFDES )
|
||||
.help( UTF8STDSTR( _( "Exclude the reference designator text" ) ) )
|
||||
.flag();
|
||||
|
||||
m_argParser.add_argument( "--ev", ARG_EXCLUDE_VALUE )
|
||||
.help( UTF8STDSTR( _( "Exclude the value text" ) ) )
|
||||
.flag();
|
||||
|
||||
m_argParser.add_argument( "--ibt", ARG_INCLUDE_BORDER_TITLE )
|
||||
.help( UTF8STDSTR( _( "Include the border and title block" ) ) )
|
||||
.flag();
|
||||
|
||||
m_argParser.add_argument( ARG_SUBTRACT_SOLDERMASK )
|
||||
.help( UTF8STDSTR( _( "Subtract soldermask from silkscreen" ) ) )
|
||||
.flag();
|
||||
|
||||
m_argParser.add_argument( "--sp", ARG_SKETCH_PADS_ON_FAB_LAYERS )
|
||||
.help( UTF8STDSTR( _( ARG_SKETCH_PADS_ON_FAB_LAYERS_DESC ) ) )
|
||||
.flag();
|
||||
|
||||
m_argParser.add_argument( "--hdnp", ARG_HIDE_DNP_FPS_ON_FAB_LAYERS )
|
||||
.help( UTF8STDSTR( _( ARG_HIDE_DNP_FPS_ON_FAB_LAYERS_DESC ) ) )
|
||||
.flag();
|
||||
|
||||
m_argParser.add_argument( "--sdnp", ARG_SKETCH_DNP_FPS_ON_FAB_LAYERS )
|
||||
.help( UTF8STDSTR( _( ARG_SKETCH_DNP_FPS_ON_FAB_LAYERS_DESC ) ) )
|
||||
.flag();
|
||||
|
||||
m_argParser.add_argument( "--cdnp", ARG_CROSSOUT_DNP_FPS_ON_FAB_LAYERS )
|
||||
.help( UTF8STDSTR( _( ARG_CROSSOUT_DNP_FPS_ON_FAB_LAYERS_DESC ) ) )
|
||||
.flag();
|
||||
|
||||
m_argParser.add_argument( ARG_DRILL_SHAPE_OPTION )
|
||||
.help( UTF8STDSTR( _( ARG_DRILL_SHAPE_OPTION_DESC ) ) )
|
||||
.scan<'i', int>()
|
||||
.default_value( 2 );
|
||||
|
||||
m_argParser.add_argument( ARG_MODE_SINGLE )
|
||||
.help( UTF8STDSTR(
|
||||
_( "Generates a single file with the output arg path acting as the complete "
|
||||
"directory and filename path. COMMON_LAYER_LIST does not function in this "
|
||||
"mode. Instead LAYER_LIST controls all layers plotted." ) ) )
|
||||
.flag();
|
||||
|
||||
m_argParser.add_argument( ARG_MODE_MULTI )
|
||||
.help( UTF8STDSTR( _( "Generates one or more files with behavior similar to the KiCad "
|
||||
"GUI plotting. The given output path specifies a directory in "
|
||||
"which files may be output." ) ) )
|
||||
.flag();
|
||||
|
||||
m_argParser.add_argument( ARG_SCALE )
|
||||
.help( UTF8STDSTR( _( ARG_SCALE_DESC ) ) )
|
||||
.scan<'g', double>()
|
||||
.default_value( 1.0 )
|
||||
.metavar( "SCALE" );
|
||||
|
||||
m_argParser.add_argument( "-P", ARG_DEFAULT_PEN_SIZE )
|
||||
.help( UTF8STDSTR( _( "Size for the default pen [mm]" ) ) )
|
||||
.scan<'g', double>()
|
||||
.default_value( 0.381 )
|
||||
.metavar( "DEF_SIZE" );
|
||||
|
||||
m_argParser.add_argument( "-N", ARG_PEN_NUMBER )
|
||||
.help( UTF8STDSTR( _( "Pen number selection (1 to 9)" ) ) )
|
||||
.scan<'d', int>()
|
||||
.default_value( 1 )
|
||||
.metavar( "PEN_NUM" );
|
||||
|
||||
m_argParser.add_argument( "-S", ARG_PEN_SPEED )
|
||||
.help( UTF8STDSTR( _( "Pen speed [cm/s] (1 to 99 cm/s)" ) ) )
|
||||
.scan<'d', int>()
|
||||
.default_value( 40 )
|
||||
.metavar( "PEN_SPD" );
|
||||
m_argParser.add_description( UTF8STDSTR( _( "No longer supported as of KiCad 10.0." ) ) );
|
||||
}
|
||||
|
||||
|
||||
int CLI::PCB_EXPORT_HPGL_COMMAND::doPerform( KIWAY& aKiway )
|
||||
{
|
||||
std::unique_ptr<JOB_EXPORT_PCB_HPGL> hpglJob( new JOB_EXPORT_PCB_HPGL() );
|
||||
|
||||
hpglJob->m_filename = m_argInput;
|
||||
hpglJob->SetConfiguredOutputPath( m_argOutput );
|
||||
hpglJob->m_drawingSheet = m_argDrawingSheet;
|
||||
hpglJob->SetVarOverrides( m_argDefineVars );
|
||||
|
||||
if( !wxFile::Exists( hpglJob->m_filename ) )
|
||||
{
|
||||
wxFprintf( stderr, _( "Board file does not exist or is not accessible\n" ) );
|
||||
return EXIT_CODES::ERR_INVALID_INPUT_FILE;
|
||||
}
|
||||
|
||||
hpglJob->m_plotFootprintValues = !m_argParser.get<bool>( ARG_EXCLUDE_VALUE );
|
||||
hpglJob->m_plotRefDes = !m_argParser.get<bool>( ARG_EXCLUDE_REFDES );
|
||||
|
||||
hpglJob->m_plotDrawingSheet = m_argParser.get<bool>( ARG_INCLUDE_BORDER_TITLE );
|
||||
hpglJob->m_subtractSolderMaskFromSilk = m_argParser.get<bool>( ARG_SUBTRACT_SOLDERMASK );
|
||||
hpglJob->m_mirror = m_argParser.get<bool>( ARG_MIRROR );
|
||||
// We don't have colors here, we just use a pen, and we don't even know its color
|
||||
hpglJob->m_blackAndWhite = true;
|
||||
hpglJob->m_negative = false;
|
||||
|
||||
hpglJob->m_sketchPadsOnFabLayers = m_argParser.get<bool>( ARG_SKETCH_PADS_ON_FAB_LAYERS );
|
||||
hpglJob->m_hideDNPFPsOnFabLayers = m_argParser.get<bool>( ARG_HIDE_DNP_FPS_ON_FAB_LAYERS );
|
||||
hpglJob->m_sketchDNPFPsOnFabLayers = m_argParser.get<bool>( ARG_SKETCH_DNP_FPS_ON_FAB_LAYERS );
|
||||
hpglJob->m_crossoutDNPFPsOnFabLayers = m_argParser.get<bool>( ARG_CROSSOUT_DNP_FPS_ON_FAB_LAYERS );
|
||||
|
||||
int drillShape = m_argParser.get<int>( ARG_DRILL_SHAPE_OPTION );
|
||||
hpglJob->m_drillShapeOption = static_cast<DRILL_MARKS>( drillShape );
|
||||
|
||||
hpglJob->m_argLayers = From_UTF8( m_argParser.get<std::string>( ARG_LAYERS ).c_str() );
|
||||
hpglJob->m_argCommonLayers = From_UTF8( m_argParser.get<std::string>( ARG_COMMON_LAYERS ).c_str() );
|
||||
|
||||
if( m_argParser.get<bool>( ARG_MODE_MULTI ) )
|
||||
hpglJob->m_genMode = JOB_EXPORT_PCB_HPGL::GEN_MODE::MULTI;
|
||||
else if( m_argParser.get<bool>( ARG_MODE_SINGLE ) )
|
||||
hpglJob->m_genMode = JOB_EXPORT_PCB_HPGL::GEN_MODE::SINGLE;
|
||||
|
||||
hpglJob->m_scale = m_argParser.get<double>( ARG_SCALE );
|
||||
hpglJob->m_defaultPenSize = m_argParser.get<double>( ARG_DEFAULT_PEN_SIZE );
|
||||
hpglJob->m_penNumber = m_argParser.get<int>( ARG_PEN_NUMBER );
|
||||
hpglJob->m_penSpeed = m_argParser.get<int>( ARG_PEN_SPEED );
|
||||
|
||||
LOCALE_IO dummy; // Switch to "C" locale
|
||||
return aKiway.ProcessJob( KIWAY::FACE_PCB, hpglJob.get() );
|
||||
wxFprintf( stderr, _( "Plotting to HPGL is no longer supported as of KiCad 10.0.\n" ) );
|
||||
return EXIT_CODES::ERR_ARGS;
|
||||
}
|
||||
|
@ -33,24 +33,18 @@
|
||||
|
||||
#define ARG_EXCLUDE_DRAWING_SHEET "--exclude-drawing-sheet"
|
||||
#define ARG_NO_BACKGROUND_COLOR "--no-background-color"
|
||||
#define ARG_HPGL_PEN_SIZE "--pen-size"
|
||||
#define ARG_HPGL_ORIGIN "--origin"
|
||||
#define ARG_PAGES "--pages"
|
||||
#define ARG_EXCLUDE_PDF_PROPERTY_POPUPS "--exclude-pdf-property-popups"
|
||||
#define ARG_EXCLUDE_PDF_HIERARCHICAL_LINKS "--exclude-pdf-hierarchical-links"
|
||||
#define ARG_EXCLUDE_PDF_METADATA "--exclude-pdf-metadata"
|
||||
#define ARG_FONT_NAME "--default-font"
|
||||
|
||||
const JOB_HPGL_PLOT_ORIGIN_AND_UNITS hpgl_origin_ops[4] = {
|
||||
JOB_HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_BOT_LEFT,
|
||||
JOB_HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_CENTER,
|
||||
JOB_HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_PAGE,
|
||||
JOB_HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_CONTENT
|
||||
};
|
||||
#define DEPRECATED_ARG_HPGL_PEN_SIZE "--pen-size"
|
||||
#define DEPRECATED_ARG_HPGL_ORIGIN "--origin"
|
||||
|
||||
CLI::SCH_EXPORT_PLOT_COMMAND::SCH_EXPORT_PLOT_COMMAND( const std::string& aName,
|
||||
const std::string& aDescription,
|
||||
SCH_PLOT_FORMAT aPlotFormat,
|
||||
SCH_PLOT_FORMAT aPlotFormat,
|
||||
bool aOutputIsDir ) :
|
||||
COMMAND( aName ),
|
||||
m_plotFormat( aPlotFormat )
|
||||
@ -61,17 +55,13 @@ CLI::SCH_EXPORT_PLOT_COMMAND::SCH_EXPORT_PLOT_COMMAND( const std::string& aName,
|
||||
addDrawingSheetArg();
|
||||
addDefineArg();
|
||||
|
||||
if( aPlotFormat != SCH_PLOT_FORMAT::HPGL )
|
||||
{
|
||||
m_argParser.add_argument( "-t", ARG_THEME )
|
||||
.default_value( std::string() )
|
||||
.help( UTF8STDSTR( _( "Color theme to use (will default to schematic "
|
||||
"settings)" ) ) )
|
||||
.metavar( "THEME_NAME" );
|
||||
m_argParser.add_argument( "-b", ARG_BLACKANDWHITE )
|
||||
.help( UTF8STDSTR( _( ARG_BLACKANDWHITE_DESC ) ) )
|
||||
.flag();
|
||||
}
|
||||
m_argParser.add_argument( "-t", ARG_THEME )
|
||||
.default_value( std::string() )
|
||||
.help( UTF8STDSTR( _( "Color theme to use (will default to schematic settings)" ) ) )
|
||||
.metavar( "THEME_NAME" );
|
||||
m_argParser.add_argument( "-b", ARG_BLACKANDWHITE )
|
||||
.help( UTF8STDSTR( _( ARG_BLACKANDWHITE_DESC ) ) )
|
||||
.flag();
|
||||
|
||||
m_argParser.add_argument( "-e", ARG_EXCLUDE_DRAWING_SHEET )
|
||||
.help( UTF8STDSTR( _( "No drawing sheet" ) ) )
|
||||
@ -89,8 +79,7 @@ CLI::SCH_EXPORT_PLOT_COMMAND::SCH_EXPORT_PLOT_COMMAND( const std::string& aName,
|
||||
.flag();
|
||||
|
||||
m_argParser.add_argument( ARG_EXCLUDE_PDF_HIERARCHICAL_LINKS )
|
||||
.help( UTF8STDSTR( _( "Do not generate clickable links for hierarchical elements "
|
||||
"in PDF" ) ) )
|
||||
.help( UTF8STDSTR( _( "Do not generate clickable links for hierarchical elements in PDF" ) ) )
|
||||
.flag();
|
||||
|
||||
m_argParser.add_argument( ARG_EXCLUDE_PDF_METADATA )
|
||||
@ -115,15 +104,14 @@ CLI::SCH_EXPORT_PLOT_COMMAND::SCH_EXPORT_PLOT_COMMAND( const std::string& aName,
|
||||
|
||||
if( aPlotFormat == SCH_PLOT_FORMAT::HPGL )
|
||||
{
|
||||
m_argParser.add_argument( "-p", ARG_HPGL_PEN_SIZE )
|
||||
.help( UTF8STDSTR( _( "Pen size [mm]" ) ) )
|
||||
m_argParser.add_argument( "-p", DEPRECATED_ARG_HPGL_PEN_SIZE )
|
||||
.help( UTF8STDSTR( _( "Deprecated. Has no effect." ) ) )
|
||||
.scan<'g', double>()
|
||||
.default_value( 0.5 )
|
||||
.metavar( "PEN_SIZE" );
|
||||
|
||||
m_argParser.add_argument( "-r", ARG_HPGL_ORIGIN )
|
||||
.help( UTF8STDSTR( _( "Origin and scale: 0 bottom left, 1 centered, 2 page fit, 3 "
|
||||
"content fit" ) ) )
|
||||
m_argParser.add_argument( "-r", DEPRECATED_ARG_HPGL_ORIGIN )
|
||||
.help( UTF8STDSTR( _( "Deprecated. Has no effect." ) ) )
|
||||
.scan<'d', int>()
|
||||
.default_value( 1 )
|
||||
.metavar( "ORIGIN" );
|
||||
@ -133,6 +121,12 @@ CLI::SCH_EXPORT_PLOT_COMMAND::SCH_EXPORT_PLOT_COMMAND( const std::string& aName,
|
||||
|
||||
int CLI::SCH_EXPORT_PLOT_COMMAND::doPerform( KIWAY& aKiway )
|
||||
{
|
||||
if( m_plotFormat == SCH_PLOT_FORMAT::HPGL )
|
||||
{
|
||||
wxFprintf( stderr, _( "Plotting to HPGL is no longer supported as of KiCad 10.0.\n" ) );
|
||||
return EXIT_CODES::ERR_ARGS;
|
||||
}
|
||||
|
||||
wxString filename = m_argInput;
|
||||
|
||||
if( !wxFile::Exists( filename ) )
|
||||
@ -156,7 +150,7 @@ int CLI::SCH_EXPORT_PLOT_COMMAND::doPerform( KIWAY& aKiway )
|
||||
case SCH_PLOT_FORMAT::DXF: plotJob = std::make_unique<JOB_EXPORT_SCH_PLOT_DXF>(); break;
|
||||
case SCH_PLOT_FORMAT::SVG: plotJob = std::make_unique<JOB_EXPORT_SCH_PLOT_SVG>(); break;
|
||||
case SCH_PLOT_FORMAT::POST: plotJob = std::make_unique<JOB_EXPORT_SCH_PLOT_PS>(); break;
|
||||
case SCH_PLOT_FORMAT::HPGL: plotJob = std::make_unique<JOB_EXPORT_SCH_PLOT_HPGL>(); break;
|
||||
case SCH_PLOT_FORMAT::HPGL: /* no longer supported */ break;
|
||||
}
|
||||
|
||||
plotJob->m_filename = filename;
|
||||
@ -173,11 +167,8 @@ int CLI::SCH_EXPORT_PLOT_COMMAND::doPerform( KIWAY& aKiway )
|
||||
plotJob->m_useBackgroundColor = !m_argParser.get<bool>( ARG_NO_BACKGROUND_COLOR );
|
||||
}
|
||||
|
||||
if ( m_plotFormat != SCH_PLOT_FORMAT::HPGL )
|
||||
{
|
||||
plotJob->m_blackAndWhite = m_argParser.get<bool>( ARG_BLACKANDWHITE );
|
||||
plotJob->m_theme = From_UTF8( m_argParser.get<std::string>( ARG_THEME ).c_str() );
|
||||
}
|
||||
plotJob->m_blackAndWhite = m_argParser.get<bool>( ARG_BLACKANDWHITE );
|
||||
plotJob->m_theme = From_UTF8( m_argParser.get<std::string>( ARG_THEME ).c_str() );
|
||||
|
||||
plotJob->SetConfiguredOutputPath( m_argOutput );
|
||||
|
||||
@ -186,25 +177,11 @@ int CLI::SCH_EXPORT_PLOT_COMMAND::doPerform( KIWAY& aKiway )
|
||||
plotJob->m_drawingSheet = m_argDrawingSheet;
|
||||
plotJob->SetVarOverrides( m_argDefineVars );
|
||||
|
||||
// HPGL local options
|
||||
if( m_plotFormat == SCH_PLOT_FORMAT::HPGL )
|
||||
{
|
||||
plotJob->m_HPGLPenSize =
|
||||
m_argParser.get<double>( ARG_HPGL_PEN_SIZE ) * schIUScale.IU_PER_MM;
|
||||
int origin = m_argParser.get<int>( ARG_HPGL_ORIGIN );
|
||||
if( origin < 0 || origin > 3 )
|
||||
{
|
||||
wxFprintf( stderr, _( "HPGL origin option must be 0, 1, 2 or 3\n" ) );
|
||||
return EXIT_CODES::ERR_ARGS;
|
||||
}
|
||||
plotJob->m_HPGLPlotOrigin = hpgl_origin_ops[origin];
|
||||
}
|
||||
// PDF local options
|
||||
else if( m_plotFormat == SCH_PLOT_FORMAT::PDF )
|
||||
if( m_plotFormat == SCH_PLOT_FORMAT::PDF )
|
||||
{
|
||||
plotJob->m_PDFPropertyPopups = !m_argParser.get<bool>( ARG_EXCLUDE_PDF_PROPERTY_POPUPS );
|
||||
plotJob->m_PDFHierarchicalLinks =
|
||||
!m_argParser.get<bool>( ARG_EXCLUDE_PDF_HIERARCHICAL_LINKS );
|
||||
plotJob->m_PDFHierarchicalLinks = !m_argParser.get<bool>( ARG_EXCLUDE_PDF_HIERARCHICAL_LINKS );
|
||||
plotJob->m_PDFMetadata = !m_argParser.get<bool>( ARG_EXCLUDE_PDF_METADATA );
|
||||
}
|
||||
|
||||
|
@ -703,6 +703,9 @@ void PANEL_JOBSET::OnAddJobClick( wxCommandEvent& aEvent )
|
||||
|
||||
for( const std::pair<const wxString, JOB_REGISTRY_ENTRY>& entry : jobMap )
|
||||
{
|
||||
if( entry.second.deprecated )
|
||||
continue;
|
||||
|
||||
wxArrayString item;
|
||||
item.Add( wxGetTranslation( entry.second.title ) );
|
||||
items.emplace_back( item );
|
||||
@ -721,6 +724,9 @@ void PANEL_JOBSET::OnAddJobClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
for( const std::pair<const wxString, JOB_REGISTRY_ENTRY>& entry : jobMap )
|
||||
{
|
||||
if( entry.second.deprecated )
|
||||
continue;
|
||||
|
||||
if( wxGetTranslation( entry.second.title ) == selectedString )
|
||||
{
|
||||
jobKey = entry.first;
|
||||
|
@ -113,7 +113,7 @@ private:
|
||||
|
||||
bool m_drillOriginIsAuxAxis; // Axis selection (main / auxiliary)
|
||||
// for drill origin coordinates
|
||||
static int g_mapFileType; // format of map file: HPGL, PS ...
|
||||
static int g_mapFileType; // format of map file: PS, PDF ...
|
||||
static int g_drillFileType; // for Excellon, Gerber
|
||||
};
|
||||
|
||||
|
@ -116,7 +116,6 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aEditFrame, wxWindow* aParent,
|
||||
JOB_EXPORT_PCB_PLOT* aJob ) :
|
||||
DIALOG_PLOT_BASE( aParent ),
|
||||
m_editFrame( aEditFrame ),
|
||||
m_defaultPenSize( m_editFrame, m_hpglPenLabel, m_hpglPenCtrl, m_hpglPenUnits ),
|
||||
m_trackWidthCorrection( m_editFrame, m_widthAdjustLabel, m_widthAdjustCtrl, m_widthAdjustUnits ),
|
||||
m_job( aJob )
|
||||
{
|
||||
@ -325,13 +324,10 @@ void DIALOG_PLOT::init_Dialog()
|
||||
case PLOT_FORMAT::POST: m_plotFormatOpt->SetSelection( 1 ); break;
|
||||
case PLOT_FORMAT::SVG: m_plotFormatOpt->SetSelection( 2 ); break;
|
||||
case PLOT_FORMAT::DXF: m_plotFormatOpt->SetSelection( 3 ); break;
|
||||
case PLOT_FORMAT::HPGL: m_plotFormatOpt->SetSelection( 4 ); break;
|
||||
case PLOT_FORMAT::PDF: m_plotFormatOpt->SetSelection( 5 ); break;
|
||||
case PLOT_FORMAT::HPGL: /* no longer supported */ break;
|
||||
case PLOT_FORMAT::PDF: m_plotFormatOpt->SetSelection( 4 ); break;
|
||||
}
|
||||
|
||||
// Set units and value for HPGL pen size (this param is in mils).
|
||||
m_defaultPenSize.SetValue( m_plotOpts.GetHPGLPenDiameter() * pcbIUScale.IU_PER_MILS );
|
||||
|
||||
// Test for a reasonable scale value. Set to 1 if problem
|
||||
if( m_XScaleAdjust < PLOT_MIN_SCALE || m_YScaleAdjust < PLOT_MIN_SCALE
|
||||
|| m_XScaleAdjust > PLOT_MAX_SCALE || m_YScaleAdjust > PLOT_MAX_SCALE )
|
||||
@ -420,9 +416,6 @@ void DIALOG_PLOT::init_Dialog()
|
||||
// Scale option
|
||||
m_scaleOpt->SetSelection( m_plotOpts.GetScaleSelection() );
|
||||
|
||||
// Plot mode
|
||||
setPlotModeChoiceSelection( m_plotOpts.GetPlotMode() );
|
||||
|
||||
// DXF outline mode
|
||||
m_DXF_plotModeOpt->SetValue( m_plotOpts.GetDXFPlotPolygonMode() );
|
||||
|
||||
@ -472,15 +465,6 @@ void DIALOG_PLOT::transferPlotParamsToJob()
|
||||
m_job->m_scale = selectionToScale( m_plotOpts.GetScaleSelection() );
|
||||
}
|
||||
|
||||
if( m_job->m_plotFormat == JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::HPGL )
|
||||
{
|
||||
JOB_EXPORT_PCB_HPGL* hpglJob = static_cast<JOB_EXPORT_PCB_HPGL*>( m_job );
|
||||
hpglJob->m_genMode = JOB_EXPORT_PCB_HPGL::GEN_MODE::MULTI;
|
||||
hpglJob->m_defaultPenSize = m_plotOpts.GetHPGLPenDiameter() / 1000.0 * 25.4; // mils to mm
|
||||
hpglJob->m_penNumber = m_plotOpts.GetHPGLPenNum();
|
||||
hpglJob->m_penSpeed = m_plotOpts.GetHPGLPenSpeed();
|
||||
}
|
||||
|
||||
if( m_job->m_plotFormat == JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::SVG )
|
||||
{
|
||||
JOB_EXPORT_PCB_SVG* svgJob = static_cast<JOB_EXPORT_PCB_SVG*>( m_job );
|
||||
@ -849,7 +833,6 @@ PLOT_FORMAT DIALOG_PLOT::getPlotFormat()
|
||||
PLOT_FORMAT::POST,
|
||||
PLOT_FORMAT::SVG,
|
||||
PLOT_FORMAT::DXF,
|
||||
PLOT_FORMAT::HPGL,
|
||||
PLOT_FORMAT::PDF };
|
||||
|
||||
return plotFmt[m_plotFormatOpt->GetSelection()];
|
||||
@ -881,11 +864,8 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
|
||||
case PLOT_FORMAT::SVG:
|
||||
case PLOT_FORMAT::PDF:
|
||||
m_drillShapeOpt->Enable( true );
|
||||
m_plotModeOpt->Enable( false );
|
||||
setPlotModeChoiceSelection( FILLED );
|
||||
m_plotMirrorOpt->Enable( true );
|
||||
m_useAuxOriginCheckBox->Enable( true );
|
||||
m_defaultPenSize.Enable( false );
|
||||
m_scaleOpt->Enable( true );
|
||||
m_fineAdjustXCtrl->Enable( false );
|
||||
m_fineAdjustYCtrl->Enable( false );
|
||||
@ -906,18 +886,15 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
|
||||
}
|
||||
|
||||
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_plotMirrorOpt->Enable( true );
|
||||
m_useAuxOriginCheckBox->Enable( false );
|
||||
m_useAuxOriginCheckBox->SetValue( false );
|
||||
m_defaultPenSize.Enable( false );
|
||||
m_scaleOpt->Enable( true );
|
||||
m_fineAdjustXCtrl->Enable( true );
|
||||
m_fineAdjustYCtrl->Enable( true );
|
||||
@ -926,7 +903,6 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
|
||||
m_forcePSA4OutputOpt->Enable( true );
|
||||
|
||||
m_PlotOptionsSizer->Hide( m_GerberOptionsSizer );
|
||||
m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer );
|
||||
m_PlotOptionsSizer->Show( m_PSOptionsSizer );
|
||||
m_PlotOptionsSizer->Hide( m_SizerDXF_options );
|
||||
m_PlotOptionsSizer->Hide( m_svgOptionsSizer );
|
||||
@ -936,12 +912,9 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
|
||||
case PLOT_FORMAT::GERBER:
|
||||
m_drillShapeOpt->Enable( false );
|
||||
m_drillShapeOpt->SetSelection( 0 );
|
||||
m_plotModeOpt->Enable( false );
|
||||
setPlotModeChoiceSelection( FILLED );
|
||||
m_plotMirrorOpt->Enable( false );
|
||||
m_plotMirrorOpt->SetValue( false );
|
||||
m_useAuxOriginCheckBox->Enable( true );
|
||||
m_defaultPenSize.Enable( false );
|
||||
m_scaleOpt->Enable( false );
|
||||
m_scaleOpt->SetSelection( 1 );
|
||||
m_fineAdjustXCtrl->Enable( false );
|
||||
@ -953,30 +926,6 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
|
||||
m_forcePSA4OutputOpt->SetValue( false );
|
||||
|
||||
m_PlotOptionsSizer->Show( m_GerberOptionsSizer );
|
||||
m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer );
|
||||
m_PlotOptionsSizer->Hide( m_PSOptionsSizer );
|
||||
m_PlotOptionsSizer->Hide( m_SizerDXF_options );
|
||||
m_PlotOptionsSizer->Hide( m_svgOptionsSizer );
|
||||
m_PlotOptionsSizer->Hide( m_PDFOptionsSizer );
|
||||
break;
|
||||
|
||||
case PLOT_FORMAT::HPGL:
|
||||
m_drillShapeOpt->Enable( true );
|
||||
m_plotModeOpt->Enable( true );
|
||||
m_plotMirrorOpt->Enable( true );
|
||||
m_useAuxOriginCheckBox->Enable( false );
|
||||
m_useAuxOriginCheckBox->SetValue( false );
|
||||
m_defaultPenSize.Enable( true );
|
||||
m_scaleOpt->Enable( true );
|
||||
m_fineAdjustXCtrl->Enable( false );
|
||||
m_fineAdjustYCtrl->Enable( false );
|
||||
m_trackWidthCorrection.Enable( false );
|
||||
m_plotPSNegativeOpt->SetValue( false );
|
||||
m_plotPSNegativeOpt->Enable( false );
|
||||
m_forcePSA4OutputOpt->Enable( true );
|
||||
|
||||
m_PlotOptionsSizer->Hide( m_GerberOptionsSizer );
|
||||
m_PlotOptionsSizer->Show( m_HPGLOptionsSizer );
|
||||
m_PlotOptionsSizer->Hide( m_PSOptionsSizer );
|
||||
m_PlotOptionsSizer->Hide( m_SizerDXF_options );
|
||||
m_PlotOptionsSizer->Hide( m_svgOptionsSizer );
|
||||
@ -985,12 +934,9 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
|
||||
|
||||
case PLOT_FORMAT::DXF:
|
||||
m_drillShapeOpt->Enable( true );
|
||||
m_plotModeOpt->Enable( false );
|
||||
setPlotModeChoiceSelection( FILLED );
|
||||
m_plotMirrorOpt->Enable( false );
|
||||
m_plotMirrorOpt->SetValue( false );
|
||||
m_useAuxOriginCheckBox->Enable( true );
|
||||
m_defaultPenSize.Enable( false );
|
||||
m_scaleOpt->Enable( true );
|
||||
m_fineAdjustXCtrl->Enable( false );
|
||||
m_fineAdjustYCtrl->Enable( false );
|
||||
@ -1001,7 +947,6 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
|
||||
m_forcePSA4OutputOpt->SetValue( false );
|
||||
|
||||
m_PlotOptionsSizer->Hide( m_GerberOptionsSizer );
|
||||
m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer );
|
||||
m_PlotOptionsSizer->Hide( m_PSOptionsSizer );
|
||||
m_PlotOptionsSizer->Show( m_SizerDXF_options );
|
||||
m_PlotOptionsSizer->Hide( m_svgOptionsSizer );
|
||||
@ -1010,6 +955,8 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
|
||||
OnChangeDXFPlotMode( event );
|
||||
break;
|
||||
|
||||
default:
|
||||
case PLOT_FORMAT::HPGL:
|
||||
case PLOT_FORMAT::UNDEFINED:
|
||||
break;
|
||||
}
|
||||
@ -1079,7 +1026,6 @@ void DIALOG_PLOT::applyPlotSettings()
|
||||
tempOptions.SetDrillMarksType( static_cast<DRILL_MARKS>( sel ) );
|
||||
|
||||
tempOptions.SetMirror( m_plotMirrorOpt->GetValue() );
|
||||
tempOptions.SetPlotMode( m_plotModeOpt->GetSelection() == 1 ? SKETCH : FILLED );
|
||||
tempOptions.SetDXFPlotPolygonMode( m_DXF_plotModeOpt->GetValue() );
|
||||
|
||||
sel = m_DXF_plotUnits->GetSelection();
|
||||
@ -1110,31 +1056,10 @@ void DIALOG_PLOT::applyPlotSettings()
|
||||
|
||||
// Update settings from text fields. Rewrite values back to the fields,
|
||||
// since the values may have been constrained by the setters.
|
||||
wxString msg;
|
||||
|
||||
// read HPLG pen size (this param is stored in mils)
|
||||
// However, due to issues when converting this value from or to mm
|
||||
// that can slightly change the value, update this param only if it
|
||||
// is in use
|
||||
if( getPlotFormat() == PLOT_FORMAT::HPGL )
|
||||
{
|
||||
if( !tempOptions.SetHPGLPenDiameter( m_defaultPenSize.GetValue() / pcbIUScale.IU_PER_MILS ) )
|
||||
{
|
||||
m_defaultPenSize.SetValue( tempOptions.GetHPGLPenDiameter() * pcbIUScale.IU_PER_MILS );
|
||||
msg.Printf( _( "HPGL pen size constrained." ) );
|
||||
reporter.Report( msg, RPT_SEVERITY_INFO );
|
||||
}
|
||||
}
|
||||
else // keep the last value (initial value if no HPGL plot made)
|
||||
{
|
||||
tempOptions.SetHPGLPenDiameter( m_plotOpts.GetHPGLPenDiameter() );
|
||||
}
|
||||
tempOptions.SetHPGLPenSpeed( m_plotOpts.GetHPGLPenSpeed() );
|
||||
tempOptions.SetHPGLPenNum( m_plotOpts.GetHPGLPenNum() );
|
||||
|
||||
// X scale
|
||||
double tmpDouble;
|
||||
msg = m_fineAdjustXCtrl->GetValue();
|
||||
double tmpDouble;
|
||||
wxString msg = m_fineAdjustXCtrl->GetValue();
|
||||
msg.ToDouble( &tmpDouble );
|
||||
|
||||
if( !setDouble( &m_XScaleAdjust, tmpDouble, PLOT_MIN_SCALE, PLOT_MAX_SCALE ) )
|
||||
|
@ -73,11 +73,6 @@ private:
|
||||
void applyPlotSettings();
|
||||
PLOT_FORMAT getPlotFormat();
|
||||
|
||||
void setPlotModeChoiceSelection( OUTLINE_MODE aPlotMode )
|
||||
{
|
||||
m_plotModeOpt->SetSelection( aPlotMode == SKETCH ? 1 : 0 );
|
||||
}
|
||||
|
||||
void arrangeAllLayersList( const LSEQ& aSeq );
|
||||
void loadPlotParamsFromJob();
|
||||
void transferPlotParamsToJob();
|
||||
@ -96,7 +91,6 @@ private:
|
||||
int m_widthAdjustMinValue; // Global track width limits
|
||||
int m_widthAdjustMaxValue; // tracks width will be "clipped" whenever the
|
||||
// m_PSWidthAdjust to these limits.
|
||||
UNIT_BINDER m_defaultPenSize;
|
||||
UNIT_BINDER m_trackWidthCorrection;
|
||||
|
||||
wxString m_DRCWarningTemplate;
|
||||
|
@ -25,7 +25,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
|
||||
m_staticTextPlotFmt->Wrap( -1 );
|
||||
bupperSizer->Add( m_staticTextPlotFmt, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
wxString m_plotFormatOptChoices[] = { _("Gerber"), _("Postscript"), _("SVG"), _("DXF"), _("HPGL"), _("PDF") };
|
||||
wxString m_plotFormatOptChoices[] = { _("Gerber"), _("Postscript"), _("SVG"), _("DXF"), _("PDF") };
|
||||
int m_plotFormatOptNChoices = sizeof( m_plotFormatOptChoices ) / sizeof( wxString );
|
||||
m_plotFormatOpt = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_plotFormatOptNChoices, m_plotFormatOptChoices, 0 );
|
||||
m_plotFormatOpt->SetSelection( 0 );
|
||||
@ -131,26 +131,16 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
|
||||
m_scaleOpt->SetSelection( 1 );
|
||||
gbSizer1->Add( m_scaleOpt, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxEXPAND|wxLEFT, 5 );
|
||||
|
||||
plotModeLabel = new wxStaticText( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Plot mode:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
plotModeLabel->Wrap( -1 );
|
||||
gbSizer1->Add( plotModeLabel, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 30 );
|
||||
|
||||
wxString m_plotModeOptChoices[] = { _("Filled"), _("Sketch") };
|
||||
int m_plotModeOptNChoices = sizeof( m_plotModeOptChoices ) / sizeof( wxString );
|
||||
m_plotModeOpt = new wxChoice( sbOptionsSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_plotModeOptNChoices, m_plotModeOptChoices, 0 );
|
||||
m_plotModeOpt->SetSelection( 0 );
|
||||
gbSizer1->Add( m_plotModeOpt, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxEXPAND|wxLEFT, 5 );
|
||||
|
||||
m_useAuxOriginCheckBox = new wxCheckBox( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Use drill/place file origin"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_useAuxOriginCheckBox->SetToolTip( _("Use the drill/place file origin as the coordinate origin for plotted files") );
|
||||
|
||||
gbSizer1->Add( m_useAuxOriginCheckBox, wxGBPosition( 3, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 30 );
|
||||
gbSizer1->Add( m_useAuxOriginCheckBox, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 30 );
|
||||
|
||||
m_plotMirrorOpt = new wxCheckBox( sbOptionsSizer->GetStaticBox(), ID_MIROR_OPT, _("Mirrored plot"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_plotMirrorOpt, wxGBPosition( 4, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 30 );
|
||||
gbSizer1->Add( m_plotMirrorOpt, wxGBPosition( 3, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 30 );
|
||||
|
||||
m_plotPSNegativeOpt = new wxCheckBox( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Negative plot"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_plotPSNegativeOpt, wxGBPosition( 5, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 30 );
|
||||
gbSizer1->Add( m_plotPSNegativeOpt, wxGBPosition( 4, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 30 );
|
||||
|
||||
|
||||
sbOptionsSizer->Add( gbSizer1, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
@ -246,25 +236,6 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
|
||||
|
||||
m_PlotOptionsSizer->Add( m_GerberOptionsSizer, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_HPGLOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("HPGL Options") ), wxHORIZONTAL );
|
||||
|
||||
m_hpglPenLabel = new wxStaticText( m_HPGLOptionsSizer->GetStaticBox(), wxID_ANY, _("Default pen size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_hpglPenLabel->Wrap( -1 );
|
||||
m_HPGLOptionsSizer->Add( m_hpglPenLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_hpglPenCtrl = new wxTextCtrl( m_HPGLOptionsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_HPGLOptionsSizer->Add( m_hpglPenCtrl, 5, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_hpglPenUnits = new wxStaticText( m_HPGLOptionsSizer->GetStaticBox(), wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_hpglPenUnits->Wrap( -1 );
|
||||
m_HPGLOptionsSizer->Add( m_hpglPenUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
m_HPGLOptionsSizer->Add( 0, 0, 11, wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_PlotOptionsSizer->Add( m_HPGLOptionsSizer, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_PSOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Postscript Options") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizer2;
|
||||
|
@ -154,7 +154,7 @@
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices">"Gerber" "Postscript" "SVG" "DXF" "HPGL" "PDF"</property>
|
||||
<property name="choices">"Gerber" "Postscript" "SVG" "DXF" "PDF"</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
@ -1426,145 +1426,12 @@
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="gbsizeritem" expanded="false">
|
||||
<property name="border">30</property>
|
||||
<property name="colspan">1</property>
|
||||
<property name="column">1</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
|
||||
<property name="row">2</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxStaticText" expanded="false">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Plot mode:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">plotModeLabel</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="gbsizeritem" expanded="false">
|
||||
<property name="border">5</property>
|
||||
<property name="colspan">1</property>
|
||||
<property name="column">2</property>
|
||||
<property name="flag">wxEXPAND|wxLEFT</property>
|
||||
<property name="row">2</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxChoice" expanded="false">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices">"Filled" "Sketch"</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_plotModeOpt</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">0</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="gbsizeritem" expanded="false">
|
||||
<property name="border">30</property>
|
||||
<property name="colspan">2</property>
|
||||
<property name="column">1</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
|
||||
<property name="row">3</property>
|
||||
<property name="row">2</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxCheckBox" expanded="false">
|
||||
<property name="BottomDockable">1</property>
|
||||
@ -1632,7 +1499,7 @@
|
||||
<property name="colspan">2</property>
|
||||
<property name="column">1</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
|
||||
<property name="row">4</property>
|
||||
<property name="row">3</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxCheckBox" expanded="false">
|
||||
<property name="BottomDockable">1</property>
|
||||
@ -1700,7 +1567,7 @@
|
||||
<property name="colspan">2</property>
|
||||
<property name="column">1</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
|
||||
<property name="row">5</property>
|
||||
<property name="row">4</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxCheckBox" expanded="false">
|
||||
<property name="BottomDockable">1</property>
|
||||
@ -2563,219 +2430,6 @@
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBoxSizer" expanded="false">
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">HPGL Options</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_HPGLOptionsSizer</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="parent">1</property>
|
||||
<property name="permission">protected</property>
|
||||
<object class="sizeritem" expanded="false">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="false">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Default pen size:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_hpglPenLabel</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="false">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">5</property>
|
||||
<object class="wxTextCtrl" expanded="false">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength">0</property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_hpglPenCtrl</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="false">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="false">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">mm</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_hpglPenUnits</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="false">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">11</property>
|
||||
<object class="spacer" expanded="false">
|
||||
<property name="height">0</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
|
@ -75,8 +75,6 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM
|
||||
wxChoice* m_drillShapeOpt;
|
||||
wxStaticText* scalingLabel;
|
||||
wxChoice* m_scaleOpt;
|
||||
wxStaticText* plotModeLabel;
|
||||
wxChoice* m_plotModeOpt;
|
||||
wxCheckBox* m_useAuxOriginCheckBox;
|
||||
wxCheckBox* m_plotMirrorOpt;
|
||||
wxCheckBox* m_plotPSNegativeOpt;
|
||||
@ -93,10 +91,6 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM
|
||||
wxCheckBox* m_useGerberX2Format;
|
||||
wxCheckBox* m_useGerberNetAttributes;
|
||||
wxCheckBox* m_disableApertMacros;
|
||||
wxStaticBoxSizer* m_HPGLOptionsSizer;
|
||||
wxStaticText* m_hpglPenLabel;
|
||||
wxTextCtrl* m_hpglPenCtrl;
|
||||
wxStaticText* m_hpglPenUnits;
|
||||
wxStaticBoxSizer* m_PSOptionsSizer;
|
||||
wxStaticText* m_fineAdjustXLabel;
|
||||
wxTextCtrl* m_fineAdjustXCtrl;
|
||||
|
@ -94,9 +94,6 @@ std::string g_previewBoard =
|
||||
" (viasonmask false)\n"
|
||||
" (mode 1)\n"
|
||||
" (useauxorigin false)\n"
|
||||
" (hpglpennumber 1)\n"
|
||||
" (hpglpenspeed 20)\n"
|
||||
" (hpglpendiameter 15.000000)\n"
|
||||
" (pdf_front_fp_property_popups true)\n"
|
||||
" (pdf_back_fp_property_popups true)\n"
|
||||
" (dxfpolygonmode true)\n"
|
||||
|
@ -223,8 +223,8 @@ public:
|
||||
/**
|
||||
* Initialize the format for the drill map file.
|
||||
*
|
||||
* @param aMapFmt a PlotFormat value (one of PLOT_FORMAT_HPGL, PLOT_FORMAT_POST,
|
||||
* PLOT_FORMAT_GERBER, PLOT_FORMAT_DXF, PLOT_FORMAT_SVG, PLOT_FORMAT_PDF
|
||||
* @param aMapFmt a PlotFormat value (one of PLOT_FORMAT_POST, PLOT_FORMAT_GERBER, PLOT_FORMAT_DXF,
|
||||
* PLOT_FORMAT_SVG, PLOT_FORMAT_PDF
|
||||
* the most useful are PLOT_FORMAT_PDF and PLOT_FORMAT_POST.
|
||||
*/
|
||||
void SetMapFileFormat( PLOT_FORMAT aMapFmt )
|
||||
@ -329,13 +329,13 @@ protected:
|
||||
int getHolesCount() const { return m_holeListBuffer.size(); }
|
||||
|
||||
/**
|
||||
* Write the drill marks in HPGL, POSTSCRIPT or other supported formats/
|
||||
* Write the drill marks in PDF, POSTSCRIPT or other supported formats/
|
||||
*
|
||||
* Each hole size has a symbol (circle, cross X, cross + ...) up to PLOTTER::MARKER_COUNT
|
||||
* different values. If more than PLOTTER::MARKER_COUNT different values, these other
|
||||
* values share the same mark shape.
|
||||
*
|
||||
* @param aPlotter is a PLOTTER instance (HPGL, POSTSCRIPT ... plotter).
|
||||
* @param aPlotter is a PLOTTER instance (PDF, POSTSCRIPT ... plotter).
|
||||
*/
|
||||
bool plotDrillMarks( PLOTTER* aPlotter );
|
||||
|
||||
|
@ -2008,9 +2008,6 @@ void PCB_EDIT_FRAME::ToPlotter( int aID )
|
||||
case ID_GEN_PLOT_DXF:
|
||||
plotSettings.SetFormat( PLOT_FORMAT::DXF );
|
||||
break;
|
||||
case ID_GEN_PLOT_HPGL:
|
||||
plotSettings.SetFormat( PLOT_FORMAT::HPGL );
|
||||
break;
|
||||
case ID_GEN_PLOT_PDF:
|
||||
plotSettings.SetFormat( PLOT_FORMAT::PDF );
|
||||
break;
|
||||
|
@ -36,13 +36,6 @@
|
||||
|
||||
#define PLOT_LINEWIDTH_DEFAULT ( DEFAULT_TEXT_WIDTH * IU_PER_MM )
|
||||
|
||||
#define HPGL_PEN_DIAMETER_MIN 0
|
||||
#define HPGL_PEN_DIAMETER_MAX 100.0 // Unit = mil
|
||||
#define HPGL_PEN_SPEED_MIN 1 // this param is always in cm/s
|
||||
#define HPGL_PEN_SPEED_MAX 99 // this param is always in cm/s
|
||||
#define HPGL_PEN_NUMBER_MIN 1
|
||||
#define HPGL_PEN_NUMBER_MAX 16
|
||||
|
||||
#define SVG_PRECISION_MIN 3U
|
||||
#define SVG_PRECISION_MAX 6U
|
||||
#define SVG_PRECISION_DEFAULT 4
|
||||
@ -62,34 +55,6 @@ static const char* getTokenName( T aTok )
|
||||
}
|
||||
|
||||
|
||||
static bool setInt( int* aTarget, int aValue, int aMin, int aMax )
|
||||
{
|
||||
int temp = aValue;
|
||||
|
||||
if( aValue < aMin )
|
||||
temp = aMin;
|
||||
else if( aValue > aMax )
|
||||
temp = aMax;
|
||||
|
||||
*aTarget = temp;
|
||||
return ( temp == aValue );
|
||||
}
|
||||
|
||||
|
||||
static bool setDouble( double* aTarget, double aValue, double aMin, double aMax )
|
||||
{
|
||||
double temp = aValue;
|
||||
|
||||
if( aValue < aMin )
|
||||
temp = aMin;
|
||||
else if( aValue > aMax )
|
||||
temp = aMax;
|
||||
|
||||
*aTarget = temp;
|
||||
return ( temp == aValue );
|
||||
}
|
||||
|
||||
|
||||
PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
|
||||
{
|
||||
m_useGerberProtelExtensions = false;
|
||||
@ -109,9 +74,6 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
|
||||
m_DXFPolygonMode = true;
|
||||
m_DXFUnits = DXF_UNITS::INCH;
|
||||
m_useAuxOrigin = false;
|
||||
m_HPGLPenNum = 1;
|
||||
m_HPGLPenSpeed = 20; // this param is always in cm/s
|
||||
m_HPGLPenDiam = 15; // in mils
|
||||
m_negative = false;
|
||||
m_A4Output = false;
|
||||
m_plotReference = true;
|
||||
@ -209,11 +171,6 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter ) const
|
||||
aFormatter->Print( "(mode %d)", GetPlotMode() == SKETCH ? 2 : 1 );
|
||||
KICAD_FORMAT::FormatBool( aFormatter, "useauxorigin", m_useAuxOrigin );
|
||||
|
||||
// HPGL options
|
||||
aFormatter->Print( "(hpglpennumber %d)", m_HPGLPenNum );
|
||||
aFormatter->Print( "(hpglpenspeed %d)", m_HPGLPenSpeed );
|
||||
aFormatter->Print( "(hpglpendiameter %f)", m_HPGLPenDiam );
|
||||
|
||||
// PDF options
|
||||
KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_pdf_front_fp_property_popups ),
|
||||
m_PDFFrontFPPropertyPopups );
|
||||
@ -305,15 +262,6 @@ bool PCB_PLOT_PARAMS::IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const
|
||||
if( m_useAuxOrigin != aPcbPlotParams.m_useAuxOrigin )
|
||||
return false;
|
||||
|
||||
if( m_HPGLPenNum != aPcbPlotParams.m_HPGLPenNum )
|
||||
return false;
|
||||
|
||||
if( m_HPGLPenSpeed != aPcbPlotParams.m_HPGLPenSpeed )
|
||||
return false;
|
||||
|
||||
if( m_HPGLPenDiam != aPcbPlotParams.m_HPGLPenDiam )
|
||||
return false;
|
||||
|
||||
if( m_negative != aPcbPlotParams.m_negative )
|
||||
return false;
|
||||
|
||||
@ -396,18 +344,6 @@ bool PCB_PLOT_PARAMS::IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const
|
||||
}
|
||||
|
||||
|
||||
bool PCB_PLOT_PARAMS::SetHPGLPenDiameter( double aValue )
|
||||
{
|
||||
return setDouble( &m_HPGLPenDiam, aValue, HPGL_PEN_DIAMETER_MIN, HPGL_PEN_DIAMETER_MAX );
|
||||
}
|
||||
|
||||
|
||||
bool PCB_PLOT_PARAMS::SetHPGLPenSpeed( int aValue )
|
||||
{
|
||||
return setInt( &m_HPGLPenSpeed, aValue, HPGL_PEN_SPEED_MIN, HPGL_PEN_SPEED_MAX );
|
||||
}
|
||||
|
||||
|
||||
PCB_PLOT_PARAMS_PARSER::PCB_PLOT_PARAMS_PARSER( LINE_READER* aReader, int aBoardFileVersion ) :
|
||||
PCB_PLOT_PARAMS_LEXER( aReader ),
|
||||
m_boardFileVersion( aBoardFileVersion )
|
||||
@ -741,29 +677,16 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams )
|
||||
aPcbPlotParams->m_plotViaOnMaskLayer = parseBool();
|
||||
break;
|
||||
|
||||
case T_mode:
|
||||
aPcbPlotParams->SetPlotMode( parseInt( 0, 2 ) > 1 ? SKETCH : FILLED );
|
||||
break;
|
||||
|
||||
case T_useauxorigin:
|
||||
aPcbPlotParams->m_useAuxOrigin = parseBool();
|
||||
break;
|
||||
|
||||
case T_mode:
|
||||
case T_hpglpennumber:
|
||||
aPcbPlotParams->m_HPGLPenNum = parseInt( HPGL_PEN_NUMBER_MIN, HPGL_PEN_NUMBER_MAX );
|
||||
break;
|
||||
|
||||
case T_hpglpenspeed:
|
||||
aPcbPlotParams->m_HPGLPenSpeed = parseInt( HPGL_PEN_SPEED_MIN, HPGL_PEN_SPEED_MAX );
|
||||
break;
|
||||
|
||||
case T_hpglpendiameter:
|
||||
aPcbPlotParams->m_HPGLPenDiam = parseDouble();
|
||||
break;
|
||||
|
||||
case T_hpglpenoverlay:
|
||||
// No more used. just here for compatibility with old versions
|
||||
parseInt( 0, HPGL_PEN_DIAMETER_MAX );
|
||||
// HPGL is no longer supported
|
||||
parseInt( std::numeric_limits<int>::min(), std::numeric_limits<int>::max() );
|
||||
break;
|
||||
|
||||
case T_pdf_front_fp_property_popups:
|
||||
|
@ -178,18 +178,6 @@ public:
|
||||
void SetA4Output( int aForce ) { m_A4Output = aForce; }
|
||||
bool GetA4Output() const { return m_A4Output; }
|
||||
|
||||
// For historical reasons, this parameter is stored in mils
|
||||
// (but is in mm in hpgl files...)
|
||||
double GetHPGLPenDiameter() const { return m_HPGLPenDiam; }
|
||||
bool SetHPGLPenDiameter( double aValue );
|
||||
|
||||
// This parameter is always in cm, due to hpgl file format constraint
|
||||
int GetHPGLPenSpeed() const { return m_HPGLPenSpeed; }
|
||||
bool SetHPGLPenSpeed( int aValue );
|
||||
|
||||
void SetHPGLPenNum( int aVal ) { m_HPGLPenNum = aVal; }
|
||||
int GetHPGLPenNum() const { return m_HPGLPenNum; }
|
||||
|
||||
void SetDashedLineDashRatio( double aVal ) { m_dashedLineDashRatio = aVal; }
|
||||
double GetDashedLineDashRatio() const { return m_dashedLineDashRatio; }
|
||||
|
||||
@ -293,11 +281,6 @@ private:
|
||||
///< strictly obey line width settings. Only used to plot
|
||||
///< pads and tracks.
|
||||
|
||||
int m_HPGLPenNum; ///< HPGL only: pen number selection(1 to 9)
|
||||
int m_HPGLPenSpeed; ///< HPGL only: pen speed, always in cm/s (1 to 99 cm/s)
|
||||
double m_HPGLPenDiam; ///< HPGL only: pen diameter in MILS, useful to fill areas
|
||||
///< However, it is in mm in hpgl files.
|
||||
|
||||
double m_dashedLineDashRatio;
|
||||
double m_dashedLineGapRatio;
|
||||
|
||||
|
@ -44,22 +44,12 @@
|
||||
static int scaleToSelection( double scale )
|
||||
{
|
||||
int selection = 1;
|
||||
if( scale == 0.0 )
|
||||
{
|
||||
selection = 0;
|
||||
}
|
||||
else if( scale == 1.5 )
|
||||
{
|
||||
selection = 2;
|
||||
}
|
||||
else if( scale == 2.0 )
|
||||
{
|
||||
selection = 3;
|
||||
}
|
||||
else if( scale == 3.0 )
|
||||
{
|
||||
selection = 4;
|
||||
}
|
||||
|
||||
if( scale == 0.0 ) selection = 0;
|
||||
else if( scale == 1.5 ) selection = 2;
|
||||
else if( scale == 2.0 ) selection = 3;
|
||||
else if( scale == 3.0 ) selection = 4;
|
||||
|
||||
return selection;
|
||||
}
|
||||
|
||||
@ -72,14 +62,10 @@ PCB_PLOTTER::PCB_PLOTTER( BOARD* aBoard, REPORTER* aReporter, PCB_PLOT_PARAMS& a
|
||||
}
|
||||
|
||||
|
||||
bool PCB_PLOTTER::Plot( const wxString& aOutputPath,
|
||||
const LSEQ& aLayersToPlot,
|
||||
const LSEQ& aCommonLayers,
|
||||
bool aUseGerberFileExtensions,
|
||||
bool aOutputPathIsSingle,
|
||||
std::optional<wxString> aLayerName,
|
||||
std::optional<wxString> aSheetName,
|
||||
std::optional<wxString> aSheetPath )
|
||||
bool PCB_PLOTTER::Plot( const wxString& aOutputPath, const LSEQ& aLayersToPlot,
|
||||
const LSEQ& aCommonLayers, bool aUseGerberFileExtensions,
|
||||
bool aOutputPathIsSingle, std::optional<wxString> aLayerName,
|
||||
std::optional<wxString> aSheetName, std::optional<wxString> aSheetPath )
|
||||
{
|
||||
std::function<bool( wxString* )> textResolver = [&]( wxString* token ) -> bool
|
||||
{
|
||||
@ -121,10 +107,7 @@ bool PCB_PLOTTER::Plot( const wxString& aOutputPath,
|
||||
layersToPlot.push_back( aLayersToPlot[0] );
|
||||
|
||||
if( aLayersToPlot.size() > 1 )
|
||||
{
|
||||
commonLayers.insert( commonLayers.end(), aLayersToPlot.begin() + 1,
|
||||
aLayersToPlot.end() );
|
||||
}
|
||||
commonLayers.insert( commonLayers.end(), aLayersToPlot.begin() + 1, aLayersToPlot.end() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -245,10 +228,11 @@ bool PCB_PLOTTER::Plot( const wxString& aOutputPath,
|
||||
break;
|
||||
}
|
||||
|
||||
if( m_plotOpts.GetFormat() == PLOT_FORMAT::PDF && m_plotOpts.m_PDFSingle
|
||||
&& i != layersToPlot.size() - 1 )
|
||||
if( m_plotOpts.GetFormat() == PLOT_FORMAT::PDF
|
||||
&& m_plotOpts.m_PDFSingle
|
||||
&& i != layersToPlot.size() - 1 )
|
||||
{
|
||||
wxString pageNumber = wxString::Format( "%zu", pageNum + 1 );
|
||||
wxString pageNumber = wxString::Format( "%d", pageNum + 1 );
|
||||
size_t nextI = i + 1;
|
||||
PCB_LAYER_ID nextLayer = layersToPlot[nextI];
|
||||
|
||||
@ -407,14 +391,6 @@ void PCB_PLOTTER::PlotJobToPlotOpts( PCB_PLOT_PARAMS& aOpts, JOB_EXPORT_PCB_PLOT
|
||||
aOpts.SetScaleSelection( scaleToSelection( aJob->m_scale ) );
|
||||
}
|
||||
|
||||
if( aJob->m_plotFormat == JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::HPGL )
|
||||
{
|
||||
JOB_EXPORT_PCB_HPGL* hpglJob = static_cast<JOB_EXPORT_PCB_HPGL*>( aJob );
|
||||
aOpts.SetHPGLPenDiameter( hpglJob->m_defaultPenSize / 25.4 * 1000.0 ); // mm to mils
|
||||
aOpts.SetHPGLPenSpeed( hpglJob->m_penSpeed );
|
||||
aOpts.SetHPGLPenNum( hpglJob->m_penNumber );
|
||||
}
|
||||
|
||||
if( aJob->m_plotFormat == JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::SVG )
|
||||
{
|
||||
JOB_EXPORT_PCB_SVG* svgJob = static_cast<JOB_EXPORT_PCB_SVG*>( aJob );
|
||||
@ -425,9 +401,8 @@ void PCB_PLOTTER::PlotJobToPlotOpts( PCB_PLOT_PARAMS& aOpts, JOB_EXPORT_PCB_PLOT
|
||||
if( aJob->m_plotFormat == JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::DXF )
|
||||
{
|
||||
JOB_EXPORT_PCB_DXF* dxfJob = static_cast<JOB_EXPORT_PCB_DXF*>( aJob );
|
||||
aOpts.SetDXFPlotUnits( dxfJob->m_dxfUnits == JOB_EXPORT_PCB_DXF::DXF_UNITS::INCH
|
||||
? DXF_UNITS::INCH
|
||||
: DXF_UNITS::MM );
|
||||
aOpts.SetDXFPlotUnits( dxfJob->m_dxfUnits == JOB_EXPORT_PCB_DXF::DXF_UNITS::INCH ? DXF_UNITS::INCH
|
||||
: DXF_UNITS::MM );
|
||||
|
||||
aOpts.SetPlotMode( dxfJob->m_plotGraphicItemsUsingContours ? OUTLINE_MODE::SKETCH
|
||||
: OUTLINE_MODE::FILLED );
|
||||
@ -478,7 +453,7 @@ void PCB_PLOTTER::PlotJobToPlotOpts( PCB_PLOT_PARAMS& aOpts, JOB_EXPORT_PCB_PLOT
|
||||
case JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::POST: aOpts.SetFormat( PLOT_FORMAT::POST ); break;
|
||||
case JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::SVG: aOpts.SetFormat( PLOT_FORMAT::SVG ); break;
|
||||
case JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::DXF: aOpts.SetFormat( PLOT_FORMAT::DXF ); break;
|
||||
case JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::HPGL: aOpts.SetFormat( PLOT_FORMAT::HPGL ); break;
|
||||
case JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::HPGL: /* no longer supported */ break;
|
||||
case JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::PDF: aOpts.SetFormat( PLOT_FORMAT::PDF ); break;
|
||||
}
|
||||
|
||||
@ -504,10 +479,9 @@ void PCB_PLOTTER::PlotJobToPlotOpts( PCB_PLOT_PARAMS& aOpts, JOB_EXPORT_PCB_PLOT
|
||||
|
||||
if( colors->GetFilename() != theme )
|
||||
{
|
||||
aReporter.Report( wxString::Format(
|
||||
_( "Color theme '%s' not found, will use theme from PCB Editor settings.\n" ),
|
||||
theme ),
|
||||
RPT_SEVERITY_WARNING );
|
||||
aReporter.Report( wxString::Format( _( "Color theme '%s' not found, will use theme from PCB Editor.\n" ),
|
||||
theme ),
|
||||
RPT_SEVERITY_WARNING );
|
||||
}
|
||||
|
||||
aOpts.SetColorSettings( colors );
|
||||
|
@ -95,6 +95,7 @@
|
||||
|
||||
#include "pcbnew_scripting_helpers.h"
|
||||
#include <locale_io.h>
|
||||
#include <confirm.h>
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
@ -222,18 +223,23 @@ PCBNEW_JOBS_HANDLER::PCBNEW_JOBS_HANDLER( KIWAY* aKiway ) :
|
||||
DIALOG_PLOT dlg( editFrame, aParent, gJob );
|
||||
return dlg.ShowModal() == wxID_OK;
|
||||
} );
|
||||
Register( "hpgl", std::bind( &PCBNEW_JOBS_HANDLER::JobExportHpgl, this, std::placeholders::_1 ),
|
||||
Register( "hpgl",
|
||||
[&]( JOB* aJob )
|
||||
{
|
||||
m_reporter->Report( _( "Plotting to HPGL is no longer supported as of KiCad 10.0.\n" ),
|
||||
RPT_SEVERITY_ERROR );
|
||||
return CLI::EXIT_CODES::ERR_ARGS;
|
||||
},
|
||||
[aKiway]( JOB* job, wxWindow* aParent ) -> bool
|
||||
{
|
||||
JOB_EXPORT_PCB_HPGL* hpglJob = dynamic_cast<JOB_EXPORT_PCB_HPGL*>( job );
|
||||
|
||||
PCB_EDIT_FRAME* editFrame =
|
||||
dynamic_cast<PCB_EDIT_FRAME*>( aKiway->Player( FRAME_PCB_EDITOR, false ) );
|
||||
|
||||
wxCHECK( hpglJob && editFrame, false );
|
||||
wxCHECK( editFrame, false );
|
||||
|
||||
DIALOG_PLOT dlg( editFrame, aParent, hpglJob );
|
||||
return dlg.ShowModal() == wxID_OK;
|
||||
DisplayErrorMessage( editFrame,
|
||||
_( "Plotting to HPGL is no longer supported as of KiCad 10.0." ) );
|
||||
return false;
|
||||
} );
|
||||
Register( "drill",
|
||||
std::bind( &PCBNEW_JOBS_HANDLER::JobExportDrill, this, std::placeholders::_1 ),
|
||||
@ -1298,90 +1304,6 @@ int PCBNEW_JOBS_HANDLER::JobExportGerbers( JOB* aJob )
|
||||
}
|
||||
|
||||
|
||||
int PCBNEW_JOBS_HANDLER::JobExportHpgl( JOB* aJob )
|
||||
{
|
||||
JOB_EXPORT_PCB_HPGL* hpglJob = dynamic_cast<JOB_EXPORT_PCB_HPGL*>( aJob );
|
||||
|
||||
if( hpglJob == nullptr )
|
||||
return CLI::EXIT_CODES::ERR_UNKNOWN;
|
||||
|
||||
BOARD* brd = getBoard( hpglJob->m_filename );
|
||||
|
||||
if( !brd )
|
||||
return CLI::EXIT_CODES::ERR_INVALID_INPUT_FILE;
|
||||
|
||||
hpglJob->SetTitleBlock( brd->GetTitleBlock() );
|
||||
loadOverrideDrawingSheet( brd, hpglJob->m_drawingSheet );
|
||||
brd->GetProject()->ApplyTextVars( hpglJob->GetVarOverrides() );
|
||||
brd->SynchronizeProperties();
|
||||
|
||||
if( hpglJob->m_argLayers )
|
||||
hpglJob->m_plotLayerSequence = convertLayerArg( hpglJob->m_argLayers.value(), brd );
|
||||
|
||||
if( hpglJob->m_argCommonLayers )
|
||||
hpglJob->m_plotOnAllLayersSequence = convertLayerArg( hpglJob->m_argCommonLayers.value(), brd );
|
||||
|
||||
if( hpglJob->m_plotLayerSequence.size() < 1 )
|
||||
{
|
||||
m_reporter->Report( _( "At least one layer must be specified\n" ), RPT_SEVERITY_ERROR );
|
||||
return CLI::EXIT_CODES::ERR_ARGS;
|
||||
}
|
||||
|
||||
bool isSingle = hpglJob->m_genMode == JOB_EXPORT_PCB_HPGL::GEN_MODE::SINGLE;
|
||||
|
||||
if( isSingle )
|
||||
{
|
||||
if( hpglJob->GetConfiguredOutputPath().IsEmpty() )
|
||||
{
|
||||
wxFileName fn = brd->GetFileName();
|
||||
fn.SetName( fn.GetName() );
|
||||
fn.SetExt( GetDefaultPlotExtension( PLOT_FORMAT::POST ) );
|
||||
|
||||
hpglJob->SetWorkingOutputPath( fn.GetFullName() );
|
||||
}
|
||||
}
|
||||
|
||||
wxString outPath = hpglJob->GetFullOutputPath( brd->GetProject() );
|
||||
|
||||
if( !PATHS::EnsurePathExists( outPath, isSingle ) )
|
||||
{
|
||||
m_reporter->Report( _( "Failed to create output directory\n" ), RPT_SEVERITY_ERROR );
|
||||
return CLI::EXIT_CODES::ERR_INVALID_OUTPUT_CONFLICT;
|
||||
}
|
||||
|
||||
PCB_PLOT_PARAMS plotOpts;
|
||||
PCB_PLOTTER::PlotJobToPlotOpts( plotOpts, hpglJob, *m_reporter );
|
||||
|
||||
PCB_PLOTTER pcbPlotter( brd, m_reporter, plotOpts );
|
||||
|
||||
std::optional<wxString> layerName;
|
||||
std::optional<wxString> sheetName;
|
||||
std::optional<wxString> sheetPath;
|
||||
|
||||
if( isSingle )
|
||||
{
|
||||
if( aJob->GetVarOverrides().contains( wxT( "LAYER" ) ) )
|
||||
layerName = hpglJob->GetVarOverrides().at( wxT( "LAYER" ) );
|
||||
|
||||
if( aJob->GetVarOverrides().contains( wxT( "SHEETNAME" ) ) )
|
||||
sheetName = hpglJob->GetVarOverrides().at( wxT( "SHEETNAME" ) );
|
||||
|
||||
if( aJob->GetVarOverrides().contains( wxT( "SHEETPATH" ) ) )
|
||||
sheetPath = hpglJob->GetVarOverrides().at( wxT( "SHEETPATH" ) );
|
||||
}
|
||||
|
||||
LOCALE_IO dummy;
|
||||
|
||||
if( !pcbPlotter.Plot( outPath, hpglJob->m_plotLayerSequence, hpglJob->m_plotOnAllLayersSequence, false, isSingle,
|
||||
layerName, sheetName, sheetPath ) )
|
||||
{
|
||||
return CLI::EXIT_CODES::ERR_UNKNOWN;
|
||||
}
|
||||
|
||||
return CLI::EXIT_CODES::OK;
|
||||
}
|
||||
|
||||
|
||||
int PCBNEW_JOBS_HANDLER::JobExportGencad( JOB* aJob )
|
||||
{
|
||||
JOB_EXPORT_PCB_GENCAD* aGencadJob = dynamic_cast<JOB_EXPORT_PCB_GENCAD*>( aJob );
|
||||
|
@ -44,7 +44,6 @@ public:
|
||||
int JobExportPs( JOB* aJob );
|
||||
int JobExportGerber( JOB* aJob );
|
||||
int JobExportGerbers( JOB* aJob );
|
||||
int JobExportHpgl( JOB* aJob );
|
||||
int JobExportGencad( JOB* aJob );
|
||||
int JobExportDrill( JOB* aJob );
|
||||
int JobExportPos( JOB* aJob );
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include <pcbplot.h>
|
||||
#include <plotters/plotter.h>
|
||||
#include <plotters/plotter_dxf.h>
|
||||
#include <plotters/plotter_hpgl.h>
|
||||
#include <plotters/plotter_gerber.h>
|
||||
#include <plotters/plotters_pslike.h>
|
||||
#include <pcb_painter.h>
|
||||
@ -1195,22 +1194,6 @@ static void FillNegativeKnockout( PLOTTER *aPlotter, const BOX2I &aBbbox )
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculate the effective size of HPGL pens and set them in the plotter object
|
||||
*/
|
||||
static void ConfigureHPGLPenSizes( HPGL_PLOTTER *aPlotter, const PCB_PLOT_PARAMS *aPlotOpts )
|
||||
{
|
||||
// Compute penDiam (the value is given in mils) in pcb units, with plot scale (if Scale is 2,
|
||||
// penDiam value is always m_HPGLPenDiam so apparent penDiam is actually penDiam / Scale
|
||||
int penDiam = KiROUND( aPlotOpts->GetHPGLPenDiameter() * pcbIUScale.IU_PER_MILS / aPlotOpts->GetScale() );
|
||||
|
||||
// Set HPGL-specific options and start
|
||||
aPlotter->SetPenSpeed( aPlotOpts->GetHPGLPenSpeed() );
|
||||
aPlotter->SetPenNumber( aPlotOpts->GetHPGLPenNum() );
|
||||
aPlotter->SetPenDiameter( penDiam );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Open a new plotfile using the options (and especially the format) specified in the options
|
||||
* and prepare the page for plotting.
|
||||
@ -1251,13 +1234,8 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts, int aL
|
||||
break;
|
||||
|
||||
case PLOT_FORMAT::HPGL:
|
||||
HPGL_PLOTTER* HPGL_plotter;
|
||||
HPGL_plotter = new HPGL_PLOTTER();
|
||||
|
||||
// HPGL options are a little more convoluted to compute, so they get their own function
|
||||
ConfigureHPGLPenSizes( HPGL_plotter, aPlotOpts );
|
||||
plotter = HPGL_plotter;
|
||||
break;
|
||||
wxLogError( _( "HPGL plotting is no longer supported as of KiCad 10.0" ) );
|
||||
return nullptr;
|
||||
|
||||
case PLOT_FORMAT::GERBER:
|
||||
// For Gerber plotter, a valid board layer must be set, in order to create a valid
|
||||
|
@ -1213,7 +1213,6 @@ void BRDITEMS_PLOTTER::PlotDrillMarks()
|
||||
/* In the filled trace mode drill marks are drawn white-on-black to knock-out the underlying
|
||||
pad. This works only for drivers supporting color change, obviously... it means that:
|
||||
- PS, SVG and PDF output is correct (i.e. you have a 'donut' pad)
|
||||
- In HPGL you can't see them
|
||||
- In gerbers you can't see them, too. This is arguably the right thing to do since having
|
||||
drill marks and high speed drill stations is a sure recipe for broken tools and angry
|
||||
manufacturers. If you *really* want them you could start a layer with negative polarity
|
||||
|
Loading…
x
Reference in New Issue
Block a user