20#ifndef PCB_GENERATED_TABLE_H
21#define PCB_GENERATED_TABLE_H
55 std::vector<GENERATED_TABLE_ROW>
m_Rows;
83 std::vector<GENERATED_TABLE_COLUMN>
AllColumns()
const;
90 void SetColumns( std::vector<GENERATED_TABLE_COLUMN> aColumns );
96 void RestoreColumns(
const std::vector<GENERATED_TABLE_COLUMN>& aColumns );
209 virtual std::unique_ptr<GENERATED_TABLE_CONTENT>
generate(
const BOARD& aBoard,
354 void migrateRows(
int aRows,
int aCols,
const std::vector<std::string>& aNewRowKeys );
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Information pertinent to a Pcbnew printed circuit board.
The base class for create windows for drawing purpose.
One pass of rebuilding tables.
The columns one generator (the drill chart, a stackup table, ...) can produce, and the units and prec...
A table whose cell text is derived from the board and rebuilt whenever it goes stale.
void styleCreatedCells(const std::vector< CELL_ORIGIN > &aOrigin)
Style cells placeCells created from another cell in their row.
void SetFontNameProp(const wxString &aFontName)
void forEachCell(const std::function< void(PCB_TABLECELL *)> &aFunc)
Visit every shown cell.
int GetRowHeightProp() const
The first data row's height, with RowHeightsDiffer saying whether it speaks for every data row.
std::vector< HIDDEN_COLUMN > m_hidden
By position.
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
void migrateRows(int aRows, int aCols, const std::vector< std::string > &aNewRowKeys)
Move each row's cells to the row that reports the same thing.
void SetFontSizeProp(int aSize)
void placeCells(COLUMN_REMAP &aRemap)
Put every cell in the geometry its slot had, so the table stays where it was, creating those nothing ...
std::vector< GENERATED_TABLE_COLUMN > m_columns
const PCB_TABLECELL * nearestDataCell(int aRow, int aCol, const std::set< KIID > &aStyled) const
The nearest data cell in aCol among aStyled, or null when the column has none.
virtual void ApplySettings(const PCB_GENERATED_TABLE &aOther)
Take aOther's settings and placement but keep this table's cells, so formatting applied to them survi...
void setAutosizedRowHeights(const std::vector< int > &aNeeded) override
Row heights are the user's, carried by key through migrateRows.
bool FontSizesDiffer() const
std::vector< GENERATED_TABLE_COLUMN > AllColumns() const
Every column the table has been given, in order, with hidden ones marked by m_Visible.
virtual void onRebuilt(const BOARD &aBoard, const GENERATED_TABLE_CONTENT &aContent)
Called once the cells are laid out, with the content they were built from.
int metricRowHeight(int aRow) const
The height aRow needs by its cells' line count, line spacing, pen width and margins.
GENERATED_TABLE_UNITS m_units
const PCB_TABLECELL * firstCell() const
The first cell forEachCell visits, which the font getters speak for, or null.
void RestoreColumns(const std::vector< GENERATED_TABLE_COLUMN > &aColumns)
Replace the columns without touching any cell, for a loader whose cells already match the visible one...
void CopyFrom(const BOARD_ITEM *aOther) override
Copy everything a table of this kind holds, including what a subclass adds.
const std::map< int, std::string > & RowKeys() const
What each generated row reports on, by table row.
void RebuildCells(const BOARD &aBoard, GENERATED_TABLE_REFRESH *aRefresh=nullptr)
Regenerate the cells from the board.
std::map< int, std::string > & RowKeys()
void styleFromColumn(PCB_TABLECELL *aCell, int aRow, int aCol, const std::set< KIID > &aStyled)
Give a new cell the text formatting of the nearest data cell in its column among aStyled,...
const std::vector< GENERATED_TABLE_COLUMN > & Columns() const
virtual std::unique_ptr< GENERATED_TABLE_CONTENT > generate(const BOARD &aBoard, GENERATED_TABLE_REFRESH *aRefresh) const =0
The rows this table reports.
void moveShownCells(const std::vector< GENERATED_TABLE_COLUMN > &aShown, COLUMN_REMAP &aRemap) const
Carry each shown column's cells and width to its new position.
virtual bool IsDataRow(int aRow) const
True for a row that reports on the board, false for the heading and trailer rows.
virtual bool IsStale(const BOARD &aBoard) const
True when the cells no longer say what the board says.
std::vector< int > dataRows() const
The rows below the heading that IsDataRow accepts, in order.
void SetPrecision(int aPrecision)
Clamped.
virtual void onColumnsReversed()
Called once the columns have been reversed, for any column index a subclass keeps.
virtual void styleNewCell(PCB_TABLECELL *aCell, bool aIsHeading)
Called for each cell a rebuild creates, before its text is set.
std::vector< GENERATED_TABLE_COLUMN > & Columns()
The columns the table shows, which are the columns of its cells.
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
bool generatedEquals(const PCB_GENERATED_TABLE &aOther) const
Equality of the members this class owns and of the underlying PCB_TABLE.
void swapData(BOARD_ITEM *aImage) override
wxString GetFontNameProp() const
The first cell's font, with FontNamesDiffer saying whether it speaks for every shown cell.
void SetRowHeightProp(int aHeight)
void SetColumns(std::vector< GENERATED_TABLE_COLUMN > aColumns)
Replace the columns of a built table, moving each column's cells to where its id now sits so their fo...
virtual const GENERATED_TABLE_SCHEMA & Schema() const =0
INSPECT_RESULT Visit(INSPECTOR aInspector, void *aTestData, const std::vector< KICAD_T > &aScanTypes) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
PCB_GENERATED_TABLE(BOARD_ITEM *aParent, KICAD_T aType, int aLineWidth)
void SetRowHeightToFit(int aRow, int aHeight)
Set one row's height, no shorter than its text.
GENERATED_TABLE_UNITS GetUnits() const
@ MOVED
A shown column's cell, carried to its new column.
@ CREATED
New, including a cell in a column shown again.
@ EMPTY
Nothing filled the slot yet.
bool RowHeightsDiffer() const
bool anyCell(const std::function< bool(const PCB_TABLECELL *)> &aTest) const
True when aTest holds for any cell forEachCell would visit, stopping at the first.
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
PCB_TABLE::Flip reverses the columns in either direction, as it does for a plain table's text,...
virtual void onRowsMigrated()
Called once a rebuild has moved the rows to where the new content puts them, before anything asks whi...
int GetFontSizeProp() const
The first cell's text height, with FontSizesDiffer saying whether every shown cell has that size,...
void SetUnits(GENERATED_TABLE_UNITS aUnits)
int minRowHeight(int aRow) const
The smallest height aRow may take with its text still inside it.
bool FontNamesDiffer() const
std::map< int, std::string > m_rowKeys
PCB_TABLE(BOARD_ITEM *aParent, int aLineWidth)
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
constexpr int GENERATED_TABLE_MAX_PRECISION
The most digits a generated table prints after the decimal point.
A column as a generated table actually carries it: what a row's cell in that column holds and how it ...
What a generated table reports, one entry per cell below the heading row.
virtual ~GENERATED_TABLE_CONTENT()=default
std::vector< std::vector< wxString > > m_Trailer
Unkeyed rows below the data, e.g. totals.
std::vector< GENERATED_TABLE_ROW > m_Rows
Keyed, below the heading row.
One data row of a generated table, and the identity its formatting follows across rebuilds.
std::vector< wxString > m_Cells
SetColumns' work in progress, laying the old cells out for the new columns.
std::vector< bool > m_Carried
Old cells that went somewhere, by old index.
std::vector< CELL_ORIGIN > m_Origin
Where each of m_Cells came from.
std::map< int, int > m_ColWidths
By new column.
std::vector< PCB_TABLECELL * > m_Cells
The new layout, row by row.
A hidden column and its place among all columns.
GENERATED_TABLE_COLUMN m_Column
bool operator==(const HIDDEN_COLUMN &aOther) const =default
int m_Position
In AllColumns()
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
VECTOR2< int32_t > VECTOR2I