KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_symbol_fields_table.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 (C) 2017 Oliver Walters
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#pragma once
22
23#include <set>
24#include <vector>
25
28#include <sch_reference_list.h>
29#include <schematic.h>
31
32wxDECLARE_EVENT( EDA_EVT_CLOSE_DIALOG_SYMBOL_FIELDS_TABLE, wxCommandEvent );
33
34class SCH_EDIT_FRAME;
35class JOB_EXPORT_BOM;
36class TEMPLATES;
37
38
40{
41public:
42 DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* aParent, JOB_EXPORT_BOM* aJob = nullptr );
44
45 bool TransferDataToWindow() override;
46 bool TransferDataFromWindow() override;
47
49 void ReloadVariants();
50
53
54private:
55 wxGridCellEditor* createDatasheetEditor() override;
56 wxGridCellEditor* createFootprintEditor() override;
57
60
65 void LoadFieldNames();
66
67 void OnTableSelectionChanged( const std::set<int>& aRows ) override;
68
69 void OnScope( wxCommandEvent& aEvent ) override;
70 void OnMenu( wxCommandEvent& aEvent ) override;
71
72 void OnSaveAndContinue( wxCommandEvent& aEvent ) override;
73 void OnCancel( wxCommandEvent& aEvent ) override;
74 void OnOk( wxCommandEvent& aEvent ) override;
75 void OnClose( wxCloseEvent& aEvent ) override;
76
77 // Schematic listener event handlers
78 void OnSchItemsAdded( SCHEMATIC& aSch, std::vector<SCH_ITEM*>& aSchItem ) override;
79 void OnSchItemsRemoved( SCHEMATIC& aSch, std::vector<SCH_ITEM*>& aSchItem ) override;
80 void OnSchItemsChanged( SCHEMATIC& aSch, std::vector<SCH_ITEM*>& aSchItem ) override;
81 void OnSchSheetChanged( SCHEMATIC& aSch ) override;
82 void OnSchSelectionChanged( SCHEMATIC& aSch ) override;
83
85 void rebuildRowsPreservingSelection( const std::set<KIID_PATH>& aSavedSelection );
86
88
89private:
92
93 void onAddVariant( wxCommandEvent& aEvent ) override;
94 void onDeleteVariant( wxCommandEvent& aEvent ) override;
95 void onRenameVariant( wxCommandEvent& aEvent ) override;
96 void onCopyVariant( wxCommandEvent& aEvent ) override;
97 void onEditVariantDescription( wxCommandEvent& aEvent ) override;
98 void onVariantSelectionChange( wxCommandEvent& aEvent ) override;
99
101 void showSelectedVariant();
102
104 void selectVariant( const wxString& aVariant, const wxString& aShown );
105
107
108 wxString resolveVariant() const override;
109 bool resolveTextVar( wxString* aToken ) const override;
110
111private:
113
116
118
119 bool m_aborted = false;
120
121public:
122 bool WasAborted() const { return m_aborted; }
123};
DIALOG_FIELDS_TABLE(wxWindow *aParent, FIELDS_TABLE_SETTINGS &aPanelSettings, FIELDS_TABLE_BOM_SETTINGS &aBomSettings, JOB_EXPORT_BOM *aJob)
void OnSaveAndContinue(wxCommandEvent &aEvent) override
void OnSchItemsRemoved(SCHEMATIC &aSch, std::vector< SCH_ITEM * > &aSchItem) override
void onAddVariant(wxCommandEvent &aEvent) override
void selectVariant(const wxString &aVariant, const wxString &aShown)
Select aVariant, or the default when it is gone, rebuilding rows unless aShown stays.
SCH_REFERENCE_LIST getSheetSymbolReferences(SCH_SHEET &aSheet)
wxGridCellEditor * createDatasheetEditor() override
void OnOk(wxCommandEvent &aEvent) override
void OnSchSelectionChanged(SCHEMATIC &aSch) override
void OnSchItemsAdded(SCHEMATIC &aSch, std::vector< SCH_ITEM * > &aSchItem) override
void OnSchItemsChanged(SCHEMATIC &aSch, std::vector< SCH_ITEM * > &aSchItem) override
void showSelectedVariant()
Show the list box's selected variant in the grid without touching the schematic.
void FollowCurrentVariant()
Show the schematic's current variant, which the toolbar or an undo may have just changed.
void OnTableSelectionChanged(const std::set< int > &aRows) override
SYMBOL_FIELDS_EDITOR_GRID_DATA_MODEL * m_dataModel
FIELDS_TABLE_DATA_MODEL_BASE * getDataModel() const override
void onVariantSelectionChange(wxCommandEvent &aEvent) override
void OnClose(wxCloseEvent &aEvent) override
void OnSchSheetChanged(SCHEMATIC &aSch) override
void onCopyVariant(wxCommandEvent &aEvent) override
void setScope(SYMBOL_FIELDS_EDITOR_GRID_DATA_MODEL::SCOPE aScope)
void onDeleteVariant(wxCommandEvent &aEvent) override
DIALOG_SYMBOL_FIELDS_TABLE(SCH_EDIT_FRAME *aParent, JOB_EXPORT_BOM *aJob=nullptr)
void OnCancel(wxCommandEvent &aEvent) override
void OnMenu(wxCommandEvent &aEvent) override
SCH_REFERENCE_LIST getSymbolReferences(SCH_SYMBOL *aSymbol, SCH_REFERENCE_LIST &aCachedRefs)
bool resolveTextVar(wxString *aToken) const override
void onRenameVariant(wxCommandEvent &aEvent) override
void LoadFieldNames()
Construct the rows of m_fieldsCtrl and the columns of m_dataModel from a union of all field names in ...
void OnScope(wxCommandEvent &aEvent) override
void ReloadVariants()
Take the schematic's variant list again and show its current variant.
wxGridCellEditor * createFootprintEditor() override
void onEditVariantDescription(wxCommandEvent &aEvent) override
Contains everything completly generic to fields tables data models, as well as column functionality t...
Holds all the data relating to one schematic.
Definition schematic.h:155
Schematic editor (Eeschema) main window.
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition sch_sheet.h:50
Schematic symbol object.
Definition sch_symbol.h:76
wxDECLARE_EVENT(EDA_EVT_CLOSE_DIALOG_SYMBOL_FIELDS_TABLE, wxCommandEvent)