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 (C) 2017-2023 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, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#ifndef DIALOG_SYMBOL_FIELDS_TABLE_H
26#define DIALOG_SYMBOL_FIELDS_TABLE_H
27
28
30#include <sch_reference_list.h>
31#include <schematic.h>
32
33wxDECLARE_EVENT( EDA_EVT_CLOSE_DIALOG_SYMBOL_FIELDS_TABLE, wxCommandEvent );
34
36struct BOM_PRESET;
37struct BOM_FMT_PRESET;
38class SCH_EDIT_FRAME;
40
41
43{
44public:
47
48 bool TransferDataToWindow() override;
49 bool TransferDataFromWindow() override;
50
51 void ShowEditTab();
52 void ShowExportTab();
53
54private:
55 void SetupColumnProperties( int aCol );
57 void AddField( const wxString& displayName, const wxString& aCanonicalName, bool show,
58 bool groupBy, bool addedByUser = false );
59
64 void LoadFieldNames();
65
66 void OnColSort( wxGridEvent& aEvent );
67 void OnColMove( wxGridEvent& aEvent );
68 void OnColLabelChange( wxDataViewEvent& aEvent );
69 void OnTableRangeSelected( wxGridRangeSelectEvent& aEvent );
70
71 void OnColumnItemToggled( wxDataViewEvent& event ) override;
72 void OnGroupSymbolsToggled( wxCommandEvent& event ) override;
73 void OnExcludeDNPToggled( wxCommandEvent& event ) override;
74 void OnShowExcludedToggled( wxCommandEvent& event ) override;
75 void OnRegroupSymbols( wxCommandEvent& aEvent ) override;
76 void OnScopeChanged( wxCommandEvent& aEvent ) override;
77 void UpdateScope();
78 void OnTableValueChanged( wxGridEvent& event ) override;
79 void OnTableCellClick( wxGridEvent& event ) override;
80 void OnTableItemContextMenu( wxGridEvent& event ) override;
81 void OnTableColSize( wxGridSizeEvent& event ) override;
82 void OnSizeFieldList( wxSizeEvent& event ) override;
83 void OnAddField( wxCommandEvent& event ) override;
84 void OnRemoveField( wxCommandEvent& event ) override;
85 void OnRenameField( wxCommandEvent& event ) override;
86 void OnExport( wxCommandEvent& aEvent ) override;
87 void OnSaveAndContinue( wxCommandEvent& aEvent ) override;
88 void OnCancel( wxCommandEvent& aEvent ) override;
89 void OnClose( wxCloseEvent& aEvent ) override;
90 void OnOk( wxCommandEvent& aEvent ) override;
91 void OnFilterText( wxCommandEvent& aEvent ) override;
92 void OnFilterMouseMoved( wxMouseEvent& event ) override;
93 void OnFieldsCtrlSelectionChanged( wxDataViewEvent& event ) override;
94
95 void OnOutputFileBrowseClicked( wxCommandEvent& event ) override;
96 void OnPageChanged( wxNotebookEvent& event ) override;
97 void OnPreviewRefresh( wxCommandEvent& event ) override;
98 void PreviewRefresh();
99
100 std::vector<BOM_PRESET> GetUserBomPresets() const;
101 void SetUserBomPresets( std::vector<BOM_PRESET>& aPresetList );
102 void ApplyBomPreset( const wxString& aPresetName );
103 void ApplyBomPreset( const BOM_PRESET& aPreset );
104
108 std::vector<BOM_FMT_PRESET> GetUserBomFmtPresets() const;
109 void SetUserBomFmtPresets( std::vector<BOM_FMT_PRESET>& aPresetList );
110 void ApplyBomFmtPreset( const wxString& aPresetName );
111 void ApplyBomFmtPreset( const BOM_FMT_PRESET& aPreset );
112
113 // Schematic listener event handlers
114 void OnSchItemsAdded( SCHEMATIC& aSch, std::vector<SCH_ITEM*>& aSchItem ) override;
115 void OnSchItemsRemoved( SCHEMATIC& aSch, std::vector<SCH_ITEM*>& aSchItem ) override;
116 void OnSchItemsChanged( SCHEMATIC& aSch, std::vector<SCH_ITEM*>& aSchItem ) override;
117 void OnSchSheetChanged( SCHEMATIC& aSch ) override;
118
121
122private:
125
128 void updateBomPresetSelection( const wxString& aName );
129 void onBomPresetChanged( wxCommandEvent& aEvent );
130 void doApplyBomPreset( const BOM_PRESET& aPreset );
132
135 void updateBomFmtPresetSelection( const wxString& aName );
136 void onBomFmtPresetChanged( wxCommandEvent& aEvent );
137 void doApplyBomFmtPreset( const BOM_FMT_PRESET& aPreset );
139
141
142private:
143 std::map<wxString, BOM_PRESET> m_bomPresets;
146 wxArrayString m_bomPresetMRU;
147
148 std::map<wxString, BOM_FMT_PRESET> m_bomFmtPresets;
151 wxArrayString m_bomFmtPresetMRU;
152
158
161
163};
164
165#endif /* DIALOG_SYMBOL_FIELDS_TABLE_H */
Class DIALOG_SYMBOL_FIELDS_TABLE_BASE.
void OnTableColSize(wxGridSizeEvent &event) override
void OnSaveAndContinue(wxCommandEvent &aEvent) override
void OnSchItemsRemoved(SCHEMATIC &aSch, std::vector< SCH_ITEM * > &aSchItem) override
void OnPreviewRefresh(wxCommandEvent &event) override
void OnAddField(wxCommandEvent &event) override
SCH_REFERENCE_LIST getSheetSymbolReferences(SCH_SHEET &aSheet)
void SetUserBomPresets(std::vector< BOM_PRESET > &aPresetList)
void OnOk(wxCommandEvent &aEvent) override
void OnGroupSymbolsToggled(wxCommandEvent &event) override
void OnColumnItemToggled(wxDataViewEvent &event) override
void OnSchItemsAdded(SCHEMATIC &aSch, std::vector< SCH_ITEM * > &aSchItem) override
std::map< wxString, BOM_PRESET > m_bomPresets
void OnSchItemsChanged(SCHEMATIC &aSch, std::vector< SCH_ITEM * > &aSchItem) override
void ApplyBomFmtPreset(const wxString &aPresetName)
FIELDS_EDITOR_GRID_DATA_MODEL * m_dataModel
void updateBomPresetSelection(const wxString &aName)
void OnTableItemContextMenu(wxGridEvent &event) override
void updateBomFmtPresetSelection(const wxString &aName)
void OnFilterText(wxCommandEvent &aEvent) override
void OnScopeChanged(wxCommandEvent &aEvent) override
void OnRemoveField(wxCommandEvent &event) override
void OnTableCellClick(wxGridEvent &event) override
void OnShowExcludedToggled(wxCommandEvent &event) override
void OnColLabelChange(wxDataViewEvent &aEvent)
void doApplyBomFmtPreset(const BOM_FMT_PRESET &aPreset)
void onBomPresetChanged(wxCommandEvent &aEvent)
void OnTableValueChanged(wxGridEvent &event) override
void OnExport(wxCommandEvent &aEvent) override
void OnClose(wxCloseEvent &aEvent) override
void OnSchSheetChanged(SCHEMATIC &aSch) override
void OnFieldsCtrlSelectionChanged(wxDataViewEvent &event) override
void OnTableRangeSelected(wxGridRangeSelectEvent &aEvent)
std::vector< BOM_FMT_PRESET > GetUserBomFmtPresets() const
void OnCancel(wxCommandEvent &aEvent) override
void OnFilterMouseMoved(wxMouseEvent &event) override
std::map< wxString, BOM_FMT_PRESET > m_bomFmtPresets
BOM_FMT_PRESET GetCurrentBomFmtSettings()
Returns a formatting configuration corresponding to the values in the UI controls of the dialog.
void AddField(const wxString &displayName, const wxString &aCanonicalName, bool show, bool groupBy, bool addedByUser=false)
SCH_REFERENCE_LIST getSymbolReferences(SCH_SYMBOL *aSymbol, SCH_REFERENCE_LIST &aCachedRefs)
void OnSizeFieldList(wxSizeEvent &event) override
void doApplyBomPreset(const BOM_PRESET &aPreset)
void OnPageChanged(wxNotebookEvent &event) override
void SetUserBomFmtPresets(std::vector< BOM_FMT_PRESET > &aPresetList)
void OnRegroupSymbols(wxCommandEvent &aEvent) override
std::vector< BOM_PRESET > GetUserBomPresets() const
void OnOutputFileBrowseClicked(wxCommandEvent &event) override
void LoadFieldNames()
Construct the rows of m_fieldsCtrl and the columns of m_dataModel from a union of all field names in ...
void onBomFmtPresetChanged(wxCommandEvent &aEvent)
void ApplyBomPreset(const wxString &aPresetName)
void OnExcludeDNPToggled(wxCommandEvent &event) override
void OnRenameField(wxCommandEvent &event) override
These are loaded from Eeschema settings but then overwritten by the project settings.
Holds all the data relating to one schematic.
Definition: schematic.h:77
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:57
Schematic symbol object.
Definition: sch_symbol.h:77
wxDECLARE_EVENT(EDA_EVT_CLOSE_DIALOG_SYMBOL_FIELDS_TABLE, wxCommandEvent)