KiCad PCB EDA Suite
Loading...
Searching...
No Matches
drill_chart_template.cpp File Reference
#include <drill/drill_chart_template.h>
#include <algorithm>
#include <set>
#include <fstream>
#include <json_common.h>
#include <wx/translation.h>

Go to the source code of this file.

Functions

bool ValidateDrillChartColumns (std::vector< DRILL_CHART_COLUMN > &aColumns)
 Reject a column set that repeats an id or is implausibly wide.
 
LSET DrillDocumentationLayers ()
 Layers a chart or map may live on.
 
bool DrillChartDefaultColumn (DRILL_CHART_COLUMN_ID aId, DRILL_CHART_COLUMN &aColumn)
 The heading and alignment a column starts with, so the writer can leave them out of the file and the parser can put the same values back.
 
const char * DrillChartUnitsToken (DRILL_CHART_UNITS aUnits)
 Stable file tokens, independent of enum ordering so inserting a value later cannot change what an existing board file means.
 
const char * DrillChartColumnToken (DRILL_CHART_COLUMN_ID aId)
 
const char * DrillChartAlignToken (DRILL_CHART_ALIGN aAlign)
 
bool DrillChartUnitsFromToken (const wxString &aToken, DRILL_CHART_UNITS &aUnits)
 
bool DrillChartColumnFromToken (const wxString &aToken, DRILL_CHART_COLUMN_ID &aId)
 
bool DrillChartAlignFromToken (const wxString &aToken, DRILL_CHART_ALIGN &aAlign)
 

Function Documentation

◆ DrillChartAlignFromToken()

bool DrillChartAlignFromToken ( const wxString & aToken,
DRILL_CHART_ALIGN & aAlign )

◆ DrillChartAlignToken()

const char * DrillChartAlignToken ( DRILL_CHART_ALIGN aAlign)

◆ DrillChartColumnFromToken()

bool DrillChartColumnFromToken ( const wxString & aToken,
DRILL_CHART_COLUMN_ID & aId )

◆ DrillChartColumnToken()

const char * DrillChartColumnToken ( DRILL_CHART_COLUMN_ID aId)

◆ DrillChartDefaultColumn()

bool DrillChartDefaultColumn ( DRILL_CHART_COLUMN_ID aId,
DRILL_CHART_COLUMN & aColumn )

The heading and alignment a column starts with, so the writer can leave them out of the file and the parser can put the same values back.

False for a column with no default.

Definition at line 112 of file drill_chart_template.cpp.

References DRILL_CHART_COLUMN::m_Align, DRILL_CHART_COLUMN::m_Heading, and DRILL_CHART_COLUMN::m_Id.

Referenced by PCB_IO_KICAD_SEXPR::format(), DRILL_CHART_TEMPLATE::MakeDefault(), and PCB_IO_KICAD_SEXPR_PARSER::parsePCB_DRILL_CHART().

◆ DrillChartUnitsFromToken()

bool DrillChartUnitsFromToken ( const wxString & aToken,
DRILL_CHART_UNITS & aUnits )

◆ DrillChartUnitsToken()

const char * DrillChartUnitsToken ( DRILL_CHART_UNITS aUnits)

Stable file tokens, independent of enum ordering so inserting a value later cannot change what an existing board file means.

Definition at line 209 of file drill_chart_template.cpp.

Referenced by PCB_IO_KICAD_SEXPR::format(), and DRILL_CHART_TEMPLATE::SaveToFile().

◆ DrillDocumentationLayers()

LSET DrillDocumentationLayers ( )

Layers a chart or map may live on.

Excludes copper, silkscreen, mask, paste, adhesive, Edge.Cuts, Margin, courtyard and rescue layers. Chart artwork and hole symbols must not alter fabrication outputs or DRC constraints.

Definition at line 74 of file drill_chart_template.cpp.

References LSET::AllNonCuMask(), B_CrtYd, Edge_Cuts, F_CrtYd, Margin, Rescue, and BASE_SET::reset().

Referenced by PCB_DRILL_CHART::Deserialize(), PCB_DRILL_MAP::Deserialize(), DIALOG_DRILL_CHART_PROPERTIES::DIALOG_DRILL_CHART_PROPERTIES(), PCB_IO_KICAD_SEXPR_PARSER::parsePCB_DRILL_CHART(), PCB_IO_KICAD_SEXPR_PARSER::parsePCB_DRILL_MAP(), PCB_CONTROL::PlaceDrillChart(), and PCB_CONTROL::PlaceDrillMap().

◆ ValidateDrillChartColumns()

bool ValidateDrillChartColumns ( std::vector< DRILL_CHART_COLUMN > & aColumns)

Reject a column set that repeats an id or is implausibly wide.

Shared so the s-expression parser, the protobuf decoder and template import cannot disagree about what is acceptable.

Definition at line 55 of file drill_chart_template.cpp.

References DRILL_CHART_MAX_COLUMN_WIDTH, and DRILL_CHART_MAX_TOTAL_WIDTH.

Referenced by PCB_DRILL_CHART::Deserialize(), DRILL_CHART_TEMPLATE::LoadFromFile(), and PCB_IO_KICAD_SEXPR_PARSER::parsePCB_DRILL_CHART().