KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_symbol_pin_map.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef PANEL_SYMBOL_PIN_MAP_H
21#define PANEL_SYMBOL_PIN_MAP_H
22
23#include <map>
24#include <memory>
25#include <set>
26#include <vector>
27#include <wx/string.h>
28
29#include <pin_map.h>
31
32class LIB_SYMBOL;
34
35
45{
46public:
47 PANEL_SYMBOL_PIN_MAP( wxWindow* aParent );
48 ~PANEL_SYMBOL_PIN_MAP() override;
49
56 void SetSymbol( LIB_SYMBOL* aSymbol );
57
58 bool TransferDataToWindow() override;
59 bool TransferDataFromWindow() override;
60
68 void ApplyToSymbol( LIB_SYMBOL* aSymbol );
69
73
75 static constexpr int FIXED_COLS = 3;
76
78 void ResetColumnToIdentity( int aCol );
79
81 void CopyColumn( int aSrcCol, int aDstCol );
82
84 void RenameColumn( int aCol );
85
87 wxString GetColumnMapName( int aCol ) const;
88
90 void ValidateCell( int aRow, int aCol );
91
92protected:
93 void OnAddMap( wxCommandEvent& aEvent ) override;
94 void OnRemoveMap( wxCommandEvent& aEvent ) override;
95 void OnSizeGrid( wxSizeEvent& aEvent ) override;
96
97private:
98 void onCellChanged( wxGridEvent& aEvent );
99
101 void onLabelDClick( wxGridEvent& aEvent );
102
104 void applyColumnFootprint( int aCol, const wxString& aFootprintId );
105
107 void rebuildGrid();
108
110 void adjustGridColumns();
111
113 void harvestGrid();
114
116 void validateAllCells();
117
119 wxString makeUniqueMapName() const;
120
122 const std::set<wxString>& padNumbersFor( const wxString& aFootprintId );
123
125 std::vector<wxString> m_pinNumbers; // one per grid row, logical numbers
127 std::vector<ASSOCIATED_FOOTPRINT> m_associations;
128 std::unique_ptr<PIN_MAP_GRID_TRICKS> m_gridTricks;
129 std::map<wxString, std::set<wxString>> m_footprintPads;
130};
131
132#endif // PANEL_SYMBOL_PIN_MAP_H
Define a library symbol object.
Definition lib_symbol.h:80
PANEL_SYMBOL_PIN_MAP_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)
static constexpr int FIXED_COLS
Number of fixed leading columns (unit, pin number, pin name).
void rebuildGrid()
Rebuild the whole grid from the working model.
void ValidateCell(int aRow, int aCol)
Re-evaluate the colour of pad cell (aRow, aCol) from its current contents.
std::vector< ASSOCIATED_FOOTPRINT > m_associations
void RenameColumn(int aCol)
Prompt for a new name for column aCol's map and update every reference to it.
void OnAddMap(wxCommandEvent &aEvent) override
const std::set< wxString > & padNumbersFor(const wxString &aFootprintId)
void onLabelDClick(wxGridEvent &aEvent)
Double-clicking a map column's header opens its rename dialog.
PANEL_SYMBOL_PIN_MAP(wxWindow *aParent)
void harvestGrid()
Read every pad cell back into the working pin maps.
void CopyColumn(int aSrcCol, int aDstCol)
Copy every pad value from column aSrcCol into column aDstCol.
void onCellChanged(wxGridEvent &aEvent)
std::vector< wxString > m_pinNumbers
void applyColumnFootprint(int aCol, const wxString &aFootprintId)
Bind (or clear, when empty) the footprint entered in column aCol's footprint cell.
void ApplyToSymbol(LIB_SYMBOL *aSymbol)
Write the edited pin maps and associations into aSymbol.
wxString makeUniqueMapName() const
bool TransferDataToWindow() override
void ResetColumnToIdentity(int aCol)
Set every cell in pad column aCol back to its row's symbol pin number (1:1).
void SetSymbol(LIB_SYMBOL *aSymbol)
Load the editable state from aSymbol.
void OnSizeGrid(wxSizeEvent &aEvent) override
std::map< wxString, std::set< wxString > > m_footprintPads
bool CommitPendingChanges()
Commit any in-progress grid cell edit;.
bool TransferDataFromWindow() override
void validateAllCells()
Re-evaluate the colour of every pad cell.
void OnRemoveMap(wxCommandEvent &aEvent) override
std::unique_ptr< PIN_MAP_GRID_TRICKS > m_gridTricks
void adjustGridColumns()
Resize the pad columns to fill the available width.
wxString GetColumnMapName(int aCol) const
Pin-map grid context menu: adds reset-to-1:1 and copy-from-column to GRID_TRICKS.
A symbol-owned ordered set of named pin maps.
Definition pin_map.h:123