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
48private:
49 wxGridCellEditor* createDatasheetEditor() override;
50 wxGridCellEditor* createFootprintEditor() override;
51
54
59 void LoadFieldNames();
60
61 void OnTableSelectionChanged( const std::set<int>& aRows ) override;
62
63 void OnScope( wxCommandEvent& aEvent ) override;
64 void OnMenu( wxCommandEvent& aEvent ) override;
65
66 void OnSaveAndContinue( wxCommandEvent& aEvent ) override;
67 void OnCancel( wxCommandEvent& aEvent ) override;
68 void OnOk( wxCommandEvent& aEvent ) override;
69 void OnClose( wxCloseEvent& aEvent ) override;
70
71 // Schematic listener event handlers
72 void OnSchItemsAdded( SCHEMATIC& aSch, std::vector<SCH_ITEM*>& aSchItem ) override;
73 void OnSchItemsRemoved( SCHEMATIC& aSch, std::vector<SCH_ITEM*>& aSchItem ) override;
74 void OnSchItemsChanged( SCHEMATIC& aSch, std::vector<SCH_ITEM*>& aSchItem ) override;
75 void OnSchSheetChanged( SCHEMATIC& aSch ) override;
76 void OnSchSelectionChanged( SCHEMATIC& aSch ) override;
77
79 void rebuildRowsPreservingSelection( const std::set<KIID_PATH>& aSavedSelection );
80
82
83private:
86
87 void onAddVariant( wxCommandEvent& aEvent ) override;
88 void onDeleteVariant( wxCommandEvent& aEvent ) override;
89 void onRenameVariant( wxCommandEvent& aEvent ) override;
90 void onCopyVariant( wxCommandEvent& aEvent ) override;
91 void onEditVariantDescription( wxCommandEvent& aEvent ) override;
92 void onVariantSelectionChange( wxCommandEvent& aEvent ) override;
93
95
96 wxString resolveVariant() const override;
97 bool resolveTextVar( wxString* aToken ) const override;
98
99private:
101
104
106
107 bool m_aborted = false;
108
109public:
110 bool WasAborted() const { return m_aborted; }
111};
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
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 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
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:148
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:48
Schematic symbol object.
Definition sch_symbol.h:75
wxDECLARE_EVENT(EDA_EVT_CLOSE_DIALOG_SYMBOL_FIELDS_TABLE, wxCommandEvent)