24#include <wx/bmpbuttn.h>
25#include <wx/clntdata.h>
26#include <wx/rearrangectrl.h>
81 m_defaultPenSize( aParent, m_hpglPenLabel, m_hpglPenCtrl, m_hpglPenUnits ),
82 m_trackWidthCorrection( aParent, m_widthAdjustLabel, m_widthAdjustCtrl, m_widthAdjustUnits )
94 wxArrayInt plotAllLayersOrder;
95 wxArrayString plotAllLayersChoicesStrings;
96 std::vector<PCB_LAYER_ID> layersIdChoiceList;
107 plotAllLayersChoicesStrings.Add( layerName );
108 layersIdChoiceList.push_back(
id );
110 size_t size = plotOnAllLayersSelection.size();
112 if( (
static_cast<size_t>(
id ) <= size ) && plotOnAllLayersSelection.test(
id ) )
113 plotAllLayersOrder.push_back( order );
115 plotAllLayersOrder.push_back( ~order );
120 int checkColSize = 22;
121 int layerColSize = textWidth + 15;
133 wxStaticBox* allLayersLabel =
new wxStaticBox(
this, wxID_ANY,
_(
"Plot on All Layers" ) );
134 wxStaticBoxSizer* sbSizer =
new wxStaticBoxSizer( allLayersLabel, wxVERTICAL );
137 wxDefaultPosition, wxDefaultSize,
138 plotAllLayersOrder, plotAllLayersChoicesStrings, 0 );
146 for(
size_t idx = 0; idx < layersIdChoiceList.size(); idx++ )
148 wxString& txt = plotAllLayersChoicesStrings[idx];
157 wxBoxSizer* bButtonSizer;
158 bButtonSizer =
new wxBoxSizer( wxHORIZONTAL );
160 m_bpMoveUp =
new wxBitmapButton( sbSizer->GetStaticBox(), wxID_ANY, wxNullBitmap,
161 wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW | 0 );
162 m_bpMoveUp->SetToolTip(
_(
"Move current selection up" ) );
165 bButtonSizer->Add(
m_bpMoveUp, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5 );
167 m_bpMoveDown =
new wxBitmapButton( sbSizer->GetStaticBox(), wxID_ANY, wxNullBitmap,
168 wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW | 0 );
169 m_bpMoveDown->SetToolTip(
_(
"Move current selection down" ) );
172 bButtonSizer->Add(
m_bpMoveDown, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5 );
174 sbSizer->Add( bButtonSizer, 0, wxALL | wxEXPAND, 5 );
175 bmiddleSizer->Insert( 1, sbSizer, 1, wxALL | wxEXPAND, 3 );
180 { wxID_APPLY,
_(
"Generate Drill Files..." ) },
181 { wxID_CANCEL,
_(
"Close" ) } } );
183 GetSizer()->Fit(
this );
184 GetSizer()->SetSizeHints(
this );
345 wxCommandEvent cmd_event;
361 int knownViolations = 0;
372 if( knownViolations || exclusions )
411 switch( event.GetId() )
418 if( ( layermask & fab_layer_set ).any() )
492 bool scale1 = (
m_scaleOpt->GetSelection() == 1 );
504 std::function<bool( wxString* )> textResolver =
505 [&]( wxString* token ) ->
bool
515 wxDirDialog dirDialog(
this,
_(
"Select Output Directory" ),
path );
517 if( dirDialog.ShowModal() == wxID_CANCEL )
520 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
523 wxString defaultPath = fn.GetPathWithSep();
525 wxFileName relPathTest;
527 relPathTest.Assign( dirDialog.GetPath() );
530 if( relPathTest.MakeRelativeTo( defaultPath ) )
532 msg.Printf(
_(
"Do you want to use a path relative to\n'%s'?" ), defaultPath );
534 wxMessageDialog dialog(
this, msg,
_(
"Plot Output Directory" ),
535 wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
537 if( dialog.ShowModal() == wxID_YES )
538 dirName.MakeRelativeTo( defaultPath );
732static bool setDouble(
double* aResult,
double aValue,
double aMin,
double aMax )
739 else if( aValue > aMax )
750static bool setInt(
int* aResult,
int aValue,
int aMin,
int aMax )
757 else if( aValue > aMax )
820 msg.Printf(
_(
"HPGL pen size constrained." ) );
832 msg.ToDouble( &tmpDouble );
838 msg.Printf(
_(
"X scale constrained." ) );
844 msg.ToDouble( &tmpDouble );
850 msg.Printf(
_(
"Y scale constrained." ) );
866 msg.Printf(
_(
"Width correction constrained. The width correction value must be in the"
867 " range of [%s; %s] for the current design rules." ),
898 LSET plotOnAllLayers;
901 wxArrayInt plotOnAllLayersSelections;
905 size_t count = plotOnAllLayersSelections.GetCount();
907 for(
size_t i = 0; i < count; i++ )
909 int index = plotOnAllLayersSelections.Item( i );
913 wxCHECK2( layerId,
continue );
915 plotOnAllLayers.set( layerId->
GetData() );
922 selectedLayers = selectedLayers | disabledCopperLayers;
931 dirStr.Replace( wxT(
"\\" ), wxT(
"/" ) );
966 DisplayError(
this,
_(
"No layer selected, Nothing to plot" ) );
973 std::function<bool( wxString* )> textResolver =
974 [&]( wxString* token ) ->
bool
984 wxFileName outputDir = wxFileName::DirName(
path );
991 msg.Printf(
_(
"Could not write plot files to folder '%s'." ), outputDir.GetPath() );
1048 plotSequence.push_back( *seq );
1051 wxArrayInt plotOnAllLayers;
1055 size_t count = plotOnAllLayers.GetCount();
1057 for(
size_t i = 0; i < count; i++ )
1059 int index = plotOnAllLayers.Item( i );
1063 wxCHECK2( layerId,
continue );
1066 if(
find( plotSequence.begin(), plotSequence.end(), layerId->
GetData() ) !=
1067 plotSequence.end() )
1070 plotSequence.push_back( layerId->
GetData() );
1086 wxFileName fn( boardFilename );
1094 wxString fullname = fn.GetFullName();
1095 jobfile_writer.
AddGbrFile( layer, fullname );
1102 wxEmptyString, wxEmptyString );
1115 msg.Printf(
_(
"Plotted to '%s'." ), fn.GetFullPath() );
1120 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
1130 wxFileName fn( boardFilename );
constexpr EDA_IU_SCALE pcbIUScale
constexpr EDA_IU_SCALE unityScale
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
wxString m_ColorTheme
Active color theme name.
Container for design settings for a BOARD object.
int GetSmallestClearanceValue() const
int m_SolderMaskExpansion
int GetLineThickness(PCB_LAYER_ID aLayer) const
Return the default graphic segment thickness from the layer class for the given layer.
Information pertinent to a Pcbnew printed circuit board.
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
bool ResolveTextVar(wxString *token, int aDepth) const
const wxString & GetFileName() const
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
PROJECT * GetProject() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
wxStaticText * m_DRCExclusionsWarning
wxTextCtrl * m_fineAdjustXCtrl
wxBoxSizer * bmiddleSizer
wxStaticBoxSizer * m_PDFOptionsSizer
wxCheckBox * m_disableApertMacros
wxChoice * m_coordFormatCtrl
wxCheckBox * m_DXF_plotModeOpt
wxChoice * m_SVGColorChoice
STD_BITMAP_BUTTON * m_browseButton
wxTextCtrl * m_outputDirectoryName
wxSpinCtrl * m_svgPrecsision
wxTextCtrl * m_fineAdjustYCtrl
wxStaticBoxSizer * m_HPGLOptionsSizer
wxCheckBox * m_useAuxOriginCheckBox
wxStaticBoxSizer * m_PSOptionsSizer
wxCheckBox * m_plotPSNegativeOpt
@ ID_SELECT_COPPER_LAYERS
@ ID_DESELECT_COPPER_LAYERS
wxCheckBox * m_DXF_plotTextStrokeFontOpt
wxCheckBox * m_useGerberExtensions
wxCheckBox * m_plotSheetRef
wxBoxSizer * m_SizerSolderMaskAlert
wxCheckBox * m_generateGerberJobFile
wxCheckBox * m_useGerberX2Format
wxCheckListBox * m_layerCheckListBox
wxCheckBox * m_plotMirrorOpt
wxStaticBoxSizer * m_svgOptionsSizer
wxCheckBox * m_forcePSA4OutputOpt
wxCheckBox * m_useGerberNetAttributes
wxCheckBox * m_plotNoViaOnMaskOpt
wxCheckBox * m_sketchPadsOnFabLayers
wxCheckBox * m_subtractMaskFromSilk
wxBoxSizer * m_PlotOptionsSizer
wxChoice * m_DXF_plotUnits
wxCheckBox * m_plotModuleRefOpt
wxStaticBoxSizer * m_SizerDXF_options
wxCheckBox * m_plotInvisibleText
wxChoice * m_drillShapeOpt
wxCheckBox * m_plotModuleValueOpt
wxCheckBox * m_zoneFillCheck
wxStaticBoxSizer * m_GerberOptionsSizer
WX_HTML_REPORT_PANEL * m_messagesPanel
wxChoice * m_PDFColorChoice
wxChoice * m_plotFormatOpt
void OnRightClick(wxMouseEvent &event) override
PCB_PLOT_PARAMS m_plotOpts
void onPlotAllListMoveUp(wxCommandEvent &aEvent)
void OnChangeDXFPlotMode(wxCommandEvent &event) override
int m_widthAdjustMinValue
UNIT_BINDER m_trackWidthCorrection
void onBoardSetup(wxHyperlinkEvent &aEvent) override
wxBitmapButton * m_bpMoveUp
PCB_EDIT_FRAME * m_parent
void Plot(wxCommandEvent &event) override
wxString m_DRCWarningTemplate
void setPlotModeChoiceSelection(OUTLINE_MODE aPlotMode)
void OnOutputDirectoryBrowseClicked(wxCommandEvent &event) override
wxRearrangeList * m_plotAllLayersList
void onPlotAllListMoveDown(wxCommandEvent &aEvent)
void onRunDRC(wxCommandEvent &event) override
void OnSetScaleOpt(wxCommandEvent &event) override
static LSEQ m_lastPlotOnAllLayersOrder
The plot on all layers ordering the last time the dialog was opened.
void OnPopUpLayers(wxCommandEvent &event) override
wxBitmapButton * m_bpMoveDown
static LSET m_lastLayerSet
The plot layer set that last time the dialog was opened.
DIALOG_PLOT(PCB_EDIT_FRAME *parent)
void CreateDrillFile(wxCommandEvent &event) override
UNIT_BINDER m_defaultPenSize
PLOT_FORMAT getPlotFormat()
int m_widthAdjustMaxValue
void OnGerberX2Checked(wxCommandEvent &event) override
void SetPlotFormat(wxCommandEvent &event) override
void SetupStandardButtons(std::map< int, wxString > aLabels={})
GERBER_JOBFILE_WRITER is a class used to create Gerber job file a Gerber job file stores info to make...
bool CreateJobFile(const wxString &aFullFilename)
Creates a Gerber job file.
void AddGbrFile(PCB_LAYER_ID aLayer, wxString &aFilename)
add a gerber file name and type in job file list
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
LSET is a set of PCB_LAYER_IDs.
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
virtual const PCB_PLOT_PARAMS & GetPlotSettings() const
Return the PCB_PLOT_PARAMS for the BOARD owned by this frame.
PCBNEW_SETTINGS * GetPcbNewSettings() const
virtual void SetPlotSettings(const PCB_PLOT_PARAMS &aSettings)
The main frame for Pcbnew.
void ShowBoardSetupDialog(const wxString &aInitialPage=wxEmptyString)
void OnModify() override
Must be called after a board change to set the modified flag.
A helper wxWidgets control client data object to store layer IDs.
PCB_LAYER_ID GetData() const
void SetData(PCB_LAYER_ID aId)
PCB_LAYER_ID_CLIENT_DATA()
PCB_LAYER_ID_CLIENT_DATA(PCB_LAYER_ID aId)
Parameters and options when plotting/printing a board.
PLOT_FORMAT GetFormat() const
void SetDrillMarksType(DRILL_MARKS aVal)
bool GetUseAuxOrigin() const
void SetLayerSelection(LSET aSelection)
void SetOutputDirectory(const wxString &aDir)
void SetPlotReference(bool aFlag)
void SetSketchPadsOnFabLayers(bool aFlag)
void SetUseGerberX2format(bool aUse)
DXF_UNITS GetDXFPlotUnits() const
bool GetPlotInvisibleText() const
void SetA4Output(int aForce)
PLOT_TEXT_MODE GetTextMode() const
void SetDXFPlotPolygonMode(bool aFlag)
void SetAutoScale(bool aFlag)
double GetHPGLPenDiameter() const
unsigned GetSvgPrecision() const
void SetPlotFrameRef(bool aFlag)
unsigned GetBlackAndWhite() const
bool GetCreateGerberJobFile() const
bool GetDXFPlotPolygonMode() const
void SetSketchPadLineWidth(int aWidth)
LSET GetLayerSelection() const
bool GetPlotReference() const
wxString GetOutputDirectory() const
int GetScaleSelection() const
void SetPlotOnAllLayersSelection(LSET aSelection)
LSET GetPlotOnAllLayersSelection() const
bool SetHPGLPenDiameter(double aValue)
void SetScale(double aVal)
void SetDisableGerberMacros(bool aDisable)
void SetScaleSelection(int aSelection)
void SetFineScaleAdjustX(double aVal)
void SetMirror(bool aFlag)
void SetBlackAndWhite(bool blackAndWhite)
void SetPlotViaOnMaskLayer(bool aFlag)
void SetGerberPrecision(int aPrecision)
void SetSubtractMaskFromSilk(bool aSubtract)
bool GetSketchPadsOnFabLayers() const
bool GetSubtractMaskFromSilk() const
void SetPlotValue(bool aFlag)
int GetGerberPrecision() const
void SetUseGerberProtelExtensions(bool aUse)
DRILL_MARKS GetDrillMarksType() const
bool GetUseGerberX2format() const
void SetDXFPlotUnits(DXF_UNITS aUnit)
void SetColorSettings(COLOR_SETTINGS *aSettings)
bool IsSameAs(const PCB_PLOT_PARAMS &aPcbPlotParams) const
Compare current settings to aPcbPlotParams, including not saved parameters in brd file.
void SetIncludeGerberNetlistInfo(bool aUse)
bool GetPlotValue() const
void SetPlotInvisibleText(bool aFlag)
void SetCreateGerberJobFile(bool aCreate)
bool GetIncludeGerberNetlistInfo() const
void SetNegative(bool aFlag)
void SetPlotMode(OUTLINE_MODE aPlotMode)
void SetUseAuxOrigin(bool aAux)
void SetTextMode(PLOT_TEXT_MODE aVal)
bool GetUseGerberProtelExtensions() const
void SetSvgPrecision(unsigned aPrecision)
bool GetPlotFrameRef() const
void SetFormat(PLOT_FORMAT aFormat)
bool GetPlotViaOnMaskLayer() const
bool GetDisableGerberMacros() const
void SetFineScaleAdjustY(double aVal)
OUTLINE_MODE GetPlotMode() const
void SetWidthAdjust(int aVal)
Base plotter engine class.
RENDER_SETTINGS * RenderSettings()
virtual const wxString AbsolutePath(const wxString &aFileName) const
Fix up aFileName if it is relative to the project's directory to be an absolute path and filename.
A pure virtual class used to derive REPORTER objects from.
virtual REPORTER & ReportTail(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Places the report at the end of the list, for objects that support report ordering.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
T * GetAppSettings(bool aLoadNow=true)
Returns a handle to the a given settings by type If the settings have already been loaded,...
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
wxString StringFromValue(double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Converts aValue in internal units into a united string.
virtual long long int GetValue()
Return the current value in Internal Units.
void Enable(bool aEnable)
Enable/disable the label, widget and units label.
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
void SetFileName(const wxString &aReportFileName)
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
bool EnsureFileDirectoryExists(wxFileName *aTargetFullFileName, const wxString &aBaseFilename, REPORTER *aReporter)
Make aTargetFullFileName absolute and create the path of this file if it doesn't yet exist.
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
wxString GetDefaultPlotExtension(PLOT_FORMAT aFormat)
Returns the default plot extension for a format.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
This file is part of the common library.
static bool setDouble(double *aResult, double aValue, double aMin, double aMax)
static bool setInt(int *aResult, int aValue, int aMin, int aMax)
Classes used to generate a Gerber job file in JSON.
const std::string GerberJobFileExtension
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
PCB_LAYER_ID
A quick note on layer IDs:
This file contains miscellaneous commonly used macros and functions.
wxString StringFromValue(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, double aValue, bool aAddUnitsText=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Returns the string from aValue according to aUnits (inch, mm ...) for display.
wxSize GetTextSize(const wxString &aSingleLine, wxWindow *aWindow)
Return the size of aSingleLine of text when it is rendered in aWindow using whatever font is currentl...
const wxString GetGerberProtelExtension(int aLayer)
void BuildPlotFileName(wxFileName *aFilename, const wxString &aOutputDir, const wxString &aSuffix, const wxString &aExtension)
Complete a plot filename.
void PlotInteractiveLayer(BOARD *aBoard, PLOTTER *aPlotter)
Plot interactive items (hypertext links, properties, etc.).
PLOTTER * StartPlotBoard(BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts, int aLayer, const wxString &aFullFileName, const wxString &aSheetName, const wxString &aSheetPath)
Open a new plotfile using the options (and especially the format) specified in the options and prepar...
void PlotBoardLayers(BOARD *aBoard, PLOTTER *aPlotter, const LSEQ &aLayerSequence, const PCB_PLOT_PARAMS &aPlotOptions)
Plot a sequence of board layer IDs.
DRILL_MARKS
Plots and prints can show holes in pads and vias 3 options are available:
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
PLOT_FORMAT
The set of supported output plot formats.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
std::vector< FAB_LAYER_COLOR > dummy
constexpr double IUTomm(int iu) const
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition of file extensions used in Kicad.