33#include <wx/filedlg.h>
34#include <wx/filename.h>
74 for(
size_t row = 0; row < std::size( g_groupKeyRows ); ++row )
95 const std::set<DRILL_GROUP_KEY> wasGroupedBy = profile.
GroupKeys();
97 for(
size_t row = 0; row < std::size( g_groupKeyRows ); ++row )
113 wxFileDialog dlg(
this,
_(
"Import Drill Chart Template" ), wxEmptyString, wxEmptyString,
114 _(
"Drill chart templates" ) + wxT(
" (*.json)|*.json" ), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
116 if( dlg.ShowModal() != wxID_OK )
140 std::optional<GENERATED_TABLE_FORMAT> format =
m_GetFormat();
145 wxFileDialog dlg(
this,
_(
"Export Drill Chart Template" ), wxEmptyString, wxT(
"drill_chart" ),
146 _(
"Drill chart templates" ) + wxT(
" (*.json)|*.json" ), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
148 if( dlg.ShowModal() != wxID_OK )
154 tmpl.
SetName( wxFileName( dlg.GetPath() ).GetName() );
158 tmpl.
Columns() = format->m_Columns;
162 if( !tmpl.
SaveToFile( dlg.GetPath(), &error ) )
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Information pertinent to a Pcbnew printed circuit board.
void BumpDrillModelGeneration()
Bumped whenever anything a drill chart or map reports on has moved.
The column set and formatting a new chart starts from.
bool SaveToFile(const wxString &aPath, wxString *aError) const
Read and write a template as JSON.
void SetName(const wxString &aName)
void SetPrecision(int aPrecision)
GENERATED_TABLE_UNITS GetUnits() const
void SetShowTotals(bool aShow)
std::vector< GENERATED_TABLE_COLUMN > & Columns()
bool LoadFromFile(const wxString &aPath, wxString *aError)
void SetUnits(GENERATED_TABLE_UNITS aUnits)
bool GetShowTotals() const
Grouping rules and symbol assignments, shared by reference so a chart and its map can never disagree ...
bool IsGroupedBy(DRILL_GROUP_KEY aKey) const
void SetGroupedBy(DRILL_GROUP_KEY aKey, bool aOn)
const std::set< DRILL_GROUP_KEY > & GroupKeys() const
std::function< std::optional< GENERATED_TABLE_FORMAT >()> m_GetFormat
The dialog's columns, units and precision as edited so far, or nothing when a grid edit is invalid.
std::function< void(const GENERATED_TABLE_FORMAT &)> m_SetFormat
Hands the dialog a new column set, units and precision, e.g. from an imported template.
One pass of rebuilding tables.
T & Pending()
The pass's T, created from the board on first use.
wxCheckBox * m_filterVias
wxCheckListBox * m_groupByList
wxCheckBox * m_showTotals
wxCheckBox * m_filterSlots
wxCheckBox * m_filterNonPlated
wxCheckBox * m_filterCastellated
wxCheckBox * m_filterPlated
PANEL_DRILL_CHART_OPTIONS_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
wxCheckBox * m_filterBackdrills
PANEL_DRILL_CHART_OPTIONS(wxWindow *aParent)
void onImportTemplate(wxCommandEvent &aEvent) override
void TransferToWindow(const PCB_GENERATED_TABLE &aTable) override
void onExportTemplate(wxCommandEvent &aEvent) override
bool TransferFromWindow(PCB_GENERATED_TABLE &aTable, GENERATED_TABLE_REFRESH &aRefresh) override
Applies to the table. Board state goes into aRefresh so Cancel leaves the board alone.
A drill chart placed on the board, kept in step with the holes.
void SetShowTotals(bool aShow)
bool GetShowTotals() const
DRILL_CHART_FILTER & Filter()
A table whose cell text is derived from the board and rebuilt whenever it goes stale.
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
This file is part of the common library.
DRILL_GROUP_KEY
Which properties split holes into separate chart rows and symbols.
Which holes a chart reports on.
The board's drill symbol profile as a refresh assigns new symbols into it.