2017-04-02 12:09:01 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2017 Oliver Walters
|
2023-01-27 14:18:32 +00:00
|
|
|
* Copyright (C) 2017-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2017-04-02 12:09:01 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2021-07-03 20:43:30 +00:00
|
|
|
#ifndef DIALOG_SYMBOL_FIELDS_TABLE_H
|
|
|
|
#define DIALOG_SYMBOL_FIELDS_TABLE_H
|
2017-04-02 12:09:01 +00:00
|
|
|
|
|
|
|
|
2021-07-03 20:43:30 +00:00
|
|
|
#include <dialog_symbol_fields_table_base.h>
|
2017-04-02 12:09:01 +00:00
|
|
|
#include <sch_reference_list.h>
|
|
|
|
|
2018-04-17 10:34:48 +00:00
|
|
|
|
2023-02-09 20:13:05 +00:00
|
|
|
class SCHEMATIC_SETTINGS;
|
|
|
|
struct BOM_PRESET;
|
2023-03-09 15:54:57 +00:00
|
|
|
struct BOM_FMT_PRESET;
|
2018-04-17 10:34:48 +00:00
|
|
|
class SCH_EDIT_FRAME;
|
|
|
|
class FIELDS_EDITOR_GRID_DATA_MODEL;
|
|
|
|
|
2017-04-02 12:09:01 +00:00
|
|
|
|
2021-07-03 20:43:30 +00:00
|
|
|
class DIALOG_SYMBOL_FIELDS_TABLE : public DIALOG_SYMBOL_FIELDS_TABLE_BASE
|
2017-04-02 12:09:01 +00:00
|
|
|
{
|
|
|
|
public:
|
2021-07-03 20:43:30 +00:00
|
|
|
DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent );
|
|
|
|
virtual ~DIALOG_SYMBOL_FIELDS_TABLE();
|
2017-04-02 12:09:01 +00:00
|
|
|
|
2020-01-09 00:57:39 +00:00
|
|
|
bool TransferDataToWindow() override;
|
2018-04-17 10:34:48 +00:00
|
|
|
bool TransferDataFromWindow() override;
|
|
|
|
|
2017-04-02 12:09:01 +00:00
|
|
|
private:
|
2023-02-06 21:05:53 +00:00
|
|
|
void SetupColumnProperties();
|
2023-03-15 00:03:57 +00:00
|
|
|
void AddField( const wxString& displayName, const wxString& aCanonicalName, bool show,
|
|
|
|
bool groupBy, bool addedByUser = false );
|
2021-07-16 20:13:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct the rows of m_fieldsCtrl and the columns of m_dataModel from a union of all
|
|
|
|
* field names in use.
|
|
|
|
*/
|
2018-04-17 10:34:48 +00:00
|
|
|
void LoadFieldNames();
|
2017-04-02 12:09:01 +00:00
|
|
|
|
2018-04-17 10:34:48 +00:00
|
|
|
void OnColSort( wxGridEvent& aEvent );
|
2023-01-30 17:16:33 +00:00
|
|
|
void OnColMove( wxGridEvent& aEvent );
|
2023-02-23 19:10:50 +00:00
|
|
|
void OnColLabelChange( wxDataViewEvent& aEvent );
|
2017-04-18 09:25:02 +00:00
|
|
|
|
2018-04-19 22:13:19 +00:00
|
|
|
void OnColumnItemToggled( wxDataViewEvent& event ) override;
|
2020-11-15 16:08:31 +00:00
|
|
|
void OnGroupSymbolsToggled( wxCommandEvent& event ) override;
|
2023-03-30 14:17:09 +00:00
|
|
|
void OnExcludeDNPToggled( wxCommandEvent& event ) override;
|
2020-11-15 16:08:31 +00:00
|
|
|
void OnRegroupSymbols( wxCommandEvent& aEvent ) override;
|
2018-04-19 22:13:19 +00:00
|
|
|
void OnTableValueChanged( wxGridEvent& event ) override;
|
2018-05-12 22:04:11 +00:00
|
|
|
void OnTableCellClick( wxGridEvent& event ) override;
|
2023-01-29 11:51:21 +00:00
|
|
|
void OnTableRangeSelected( wxGridRangeSelectEvent& event ) override;
|
2018-04-19 22:13:19 +00:00
|
|
|
void OnTableItemContextMenu( wxGridEvent& event ) override;
|
2020-04-21 15:15:04 +00:00
|
|
|
void OnTableColSize( wxGridSizeEvent& event ) override;
|
2018-04-19 22:13:19 +00:00
|
|
|
void OnSizeFieldList( wxSizeEvent& event ) override;
|
2018-05-23 12:12:01 +00:00
|
|
|
void OnAddField( wxCommandEvent& event ) override;
|
2022-04-12 20:13:26 +00:00
|
|
|
void OnRemoveField( wxCommandEvent& event ) override;
|
2023-01-27 14:18:32 +00:00
|
|
|
void OnRenameField( wxCommandEvent& event ) override;
|
2022-05-09 13:41:00 +00:00
|
|
|
void OnExport( wxCommandEvent& aEvent ) override;
|
2018-04-19 22:13:19 +00:00
|
|
|
void OnSaveAndContinue( wxCommandEvent& aEvent ) override;
|
2022-04-17 19:02:05 +00:00
|
|
|
void OnCancel( wxCommandEvent& aEvent ) override;
|
|
|
|
void OnClose( wxCloseEvent& aEvent ) override;
|
|
|
|
void OnFilterText( wxCommandEvent& aEvent ) override;
|
|
|
|
void OnFilterMouseMoved( wxMouseEvent& event ) override;
|
2022-09-11 12:28:53 +00:00
|
|
|
void OnFieldsCtrlSelectionChanged( wxDataViewEvent& event ) override;
|
2023-02-09 20:13:05 +00:00
|
|
|
|
2023-03-08 19:31:51 +00:00
|
|
|
void OnOutputFileBrowseClicked( wxCommandEvent& event ) override;
|
2023-03-09 15:54:57 +00:00
|
|
|
void OnPageChanged( wxNotebookEvent& event ) override;
|
2023-02-28 18:37:04 +00:00
|
|
|
void OnPreviewRefresh( wxCommandEvent& event ) override;
|
2023-03-09 15:54:57 +00:00
|
|
|
void PreviewRefresh();
|
2023-02-28 18:37:04 +00:00
|
|
|
|
2023-02-09 20:13:05 +00:00
|
|
|
std::vector<BOM_PRESET> GetUserBomPresets() const;
|
|
|
|
void SetUserBomPresets( std::vector<BOM_PRESET>& aPresetList );
|
|
|
|
void ApplyBomPreset( const wxString& aPresetName );
|
|
|
|
void ApplyBomPreset( const BOM_PRESET& aPreset );
|
2021-03-21 17:31:23 +00:00
|
|
|
|
2023-04-01 12:57:59 +00:00
|
|
|
/// Returns a formatting configuration corresponding to the values in the UI controls
|
|
|
|
/// of the dialog.
|
|
|
|
BOM_FMT_PRESET GetCurrentBomFmtSettings();
|
2023-03-09 15:54:57 +00:00
|
|
|
std::vector<BOM_FMT_PRESET> GetUserBomFmtPresets() const;
|
|
|
|
void SetUserBomFmtPresets( std::vector<BOM_FMT_PRESET>& aPresetList );
|
|
|
|
void ApplyBomFmtPreset( const wxString& aPresetName );
|
|
|
|
void ApplyBomFmtPreset( const BOM_FMT_PRESET& aPreset );
|
|
|
|
|
2022-09-12 22:38:36 +00:00
|
|
|
private:
|
2023-02-09 20:13:05 +00:00
|
|
|
void syncBomPresetSelection();
|
|
|
|
void rebuildBomPresetsWidget();
|
|
|
|
void updateBomPresetSelection( const wxString& aName );
|
|
|
|
void onBomPresetChanged( wxCommandEvent& aEvent );
|
|
|
|
void doApplyBomPreset( const BOM_PRESET& aPreset );
|
|
|
|
void loadDefaultBomPresets();
|
|
|
|
|
|
|
|
std::map<wxString, BOM_PRESET> m_bomPresets;
|
|
|
|
BOM_PRESET* m_currentBomPreset;
|
|
|
|
BOM_PRESET* m_lastSelectedBomPreset;
|
|
|
|
wxArrayString m_bomPresetMRU;
|
|
|
|
|
2023-03-09 15:54:57 +00:00
|
|
|
void syncBomFmtPresetSelection();
|
|
|
|
void rebuildBomFmtPresetsWidget();
|
|
|
|
void updateBomFmtPresetSelection( const wxString& aName );
|
|
|
|
void onBomFmtPresetChanged( wxCommandEvent& aEvent );
|
|
|
|
void doApplyBomFmtPreset( const BOM_FMT_PRESET& aPreset );
|
|
|
|
void loadDefaultBomFmtPresets();
|
|
|
|
|
|
|
|
std::map<wxString, BOM_FMT_PRESET> m_bomFmtPresets;
|
|
|
|
BOM_FMT_PRESET* m_currentBomFmtPreset;
|
|
|
|
BOM_FMT_PRESET* m_lastSelectedBomFmtPreset;
|
|
|
|
wxArrayString m_bomFmtPresetMRU;
|
|
|
|
|
2023-03-29 14:53:11 +00:00
|
|
|
void savePresetsToSchematic();
|
|
|
|
|
2021-03-21 17:31:23 +00:00
|
|
|
SCH_EDIT_FRAME* m_parent;
|
2023-02-23 19:10:50 +00:00
|
|
|
int m_fieldNameColWidth;
|
|
|
|
int m_labelColWidth;
|
2021-03-21 17:31:23 +00:00
|
|
|
int m_showColWidth;
|
|
|
|
int m_groupByColWidth;
|
|
|
|
|
|
|
|
SCH_REFERENCE_LIST m_symbolsList;
|
|
|
|
FIELDS_EDITOR_GRID_DATA_MODEL* m_dataModel;
|
2023-02-09 20:13:05 +00:00
|
|
|
|
|
|
|
SCHEMATIC_SETTINGS& m_schSettings;
|
2017-04-02 12:09:01 +00:00
|
|
|
};
|
|
|
|
|
2021-07-03 20:43:30 +00:00
|
|
|
#endif /* DIALOG_SYMBOL_FIELDS_TABLE_H */
|