2024-08-30 16:03:06 -07:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2025-09-06 00:05:27 +01:00
|
|
|
#pragma once
|
2024-08-30 16:03:06 -07:00
|
|
|
|
2025-09-06 00:05:27 +01:00
|
|
|
#include <dialog_lib_fields_table_base.h>
|
2024-08-30 16:03:06 -07:00
|
|
|
#include <sch_reference_list.h>
|
2025-09-06 00:05:27 +01:00
|
|
|
#include <lib_fields_data_model.h>
|
2024-08-30 16:03:06 -07:00
|
|
|
|
|
|
|
class SYMBOL_EDIT_FRAME;
|
|
|
|
class LIB_SYMBOL;
|
|
|
|
|
2025-09-06 00:05:27 +01:00
|
|
|
|
|
|
|
class DIALOG_LIB_FIELDS_TABLE : public DIALOG_LIB_FIELDS_TABLE_BASE
|
2024-08-30 16:03:06 -07:00
|
|
|
{
|
|
|
|
public:
|
2025-09-06 00:05:27 +01:00
|
|
|
enum SCOPE : int
|
|
|
|
{
|
|
|
|
SCOPE_LIBRARY = 0,
|
|
|
|
SCOPE_RELATED_SYMBOLS
|
|
|
|
};
|
2024-08-30 16:03:06 -07:00
|
|
|
|
2025-09-06 00:05:27 +01:00
|
|
|
DIALOG_LIB_FIELDS_TABLE( SYMBOL_EDIT_FRAME* parent, DIALOG_LIB_FIELDS_TABLE::SCOPE aScope );
|
|
|
|
~DIALOG_LIB_FIELDS_TABLE() override;
|
2024-08-30 16:03:06 -07:00
|
|
|
|
2025-09-06 00:05:27 +01:00
|
|
|
bool TransferDataToWindow() override;
|
2024-08-30 16:03:06 -07:00
|
|
|
bool TransferDataFromWindow() override;
|
|
|
|
|
2025-09-06 00:05:27 +01:00
|
|
|
void ShowHideColumn( int aCol, bool aShow );
|
|
|
|
|
2024-08-30 16:03:06 -07:00
|
|
|
private:
|
|
|
|
void UpdateFieldList();
|
2025-09-06 00:05:27 +01:00
|
|
|
void AddField( const wxString& aFieldName, const wxString& aLabelValue, bool show, bool groupBy,
|
|
|
|
bool addedByUser = false, bool aIsCheckbox = false );
|
2024-08-30 16:03:06 -07:00
|
|
|
void RemoveField( const wxString& fieldName );
|
|
|
|
void RenameField( const wxString& oldName, const wxString& newName );
|
|
|
|
void RegroupSymbols();
|
|
|
|
|
|
|
|
void OnColSort( wxGridEvent& aEvent );
|
|
|
|
void OnColMove( wxGridEvent& aEvent );
|
|
|
|
void SetupColumnProperties( int aCol );
|
|
|
|
void SetupAllColumnProperties();
|
2025-09-06 00:05:27 +01:00
|
|
|
void setScope( SCOPE aScope );
|
2024-08-30 16:03:06 -07:00
|
|
|
|
2025-09-02 18:28:23 +08:00
|
|
|
void loadSymbols( const wxArrayString& aSymbolNames );
|
2024-08-30 16:03:06 -07:00
|
|
|
|
2025-09-06 00:05:27 +01:00
|
|
|
void OnViewControlsCellChanged( wxGridEvent& aEvent ) override;
|
|
|
|
void OnSizeViewControlsGrid( wxSizeEvent& event ) override;
|
|
|
|
void OnAddField( wxCommandEvent& event ) override;
|
|
|
|
void OnRenameField( wxCommandEvent& event ) override;
|
|
|
|
void OnRemoveField( wxCommandEvent& event ) override;
|
|
|
|
|
|
|
|
void OnFilterMouseMoved( wxMouseEvent& event ) override;
|
|
|
|
void OnFilterText( wxCommandEvent& event ) override;
|
|
|
|
void OnScope( wxCommandEvent& event ) override;
|
|
|
|
void OnRegroupSymbols( wxCommandEvent& event ) override;
|
|
|
|
|
|
|
|
void OnTableValueChanged( wxGridEvent& event ) override;
|
|
|
|
void OnTableCellClick( wxGridEvent& event ) override;
|
|
|
|
void OnTableItemContextMenu( wxGridEvent& event ) override;
|
|
|
|
void OnTableColSize( wxGridSizeEvent& event ) override;
|
|
|
|
|
2025-09-06 19:06:36 +01:00
|
|
|
void OnSidebarToggle( wxCommandEvent& event ) override;
|
2025-09-06 00:05:27 +01:00
|
|
|
void OnCancel( wxCommandEvent& event ) override;
|
|
|
|
void OnOk( wxCommandEvent& event ) override;
|
|
|
|
void OnApply( wxCommandEvent& event ) override;
|
|
|
|
void OnClose( wxCloseEvent& event ) override;
|
|
|
|
|
|
|
|
private:
|
2024-08-30 16:03:06 -07:00
|
|
|
SYMBOL_EDIT_FRAME* m_parent;
|
2025-09-06 00:05:27 +01:00
|
|
|
SCOPE m_scope;
|
2024-08-30 16:03:06 -07:00
|
|
|
|
2025-09-06 00:05:27 +01:00
|
|
|
VIEW_CONTROLS_GRID_DATA_MODEL* m_viewControlsDataModel;
|
2024-08-30 16:03:06 -07:00
|
|
|
|
|
|
|
LIB_FIELDS_EDITOR_GRID_DATA_MODEL* m_dataModel;
|
|
|
|
std::vector<LIB_SYMBOL*> m_symbolsList;
|
|
|
|
};
|