2018-04-28 15:22:25 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2023-05-10 17:13:52 +00:00
|
|
|
* Copyright (C) 2019-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2018-04-28 15:22:25 +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
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef PANEL_SETUP_NETCLASSES_H
|
|
|
|
#define PANEL_SETUP_NETCLASSES_H
|
|
|
|
|
|
|
|
#include <widgets/unit_binder.h>
|
|
|
|
#include <widgets/paged_dialog.h>
|
|
|
|
#include <panel_setup_netclasses_base.h>
|
|
|
|
|
2022-08-14 11:03:18 +00:00
|
|
|
class NET_SETTINGS;
|
2023-09-17 14:49:46 +00:00
|
|
|
class NETCLASS;
|
2018-04-28 15:22:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
class PANEL_SETUP_NETCLASSES : public PANEL_SETUP_NETCLASSES_BASE
|
|
|
|
{
|
2021-07-27 12:22:27 +00:00
|
|
|
public:
|
2023-05-10 17:13:52 +00:00
|
|
|
PANEL_SETUP_NETCLASSES( wxWindow* aParentWindow, EDA_DRAW_FRAME* aFrame,
|
2022-08-14 11:03:18 +00:00
|
|
|
std::shared_ptr<NET_SETTINGS> aSettings,
|
2022-09-03 18:29:02 +00:00
|
|
|
const std::set<wxString>& aNetNames, bool isEEschema );
|
2021-07-27 12:22:27 +00:00
|
|
|
~PANEL_SETUP_NETCLASSES( ) override;
|
2020-07-03 22:30:23 +00:00
|
|
|
|
2021-07-27 12:22:27 +00:00
|
|
|
bool TransferDataToWindow() override;
|
|
|
|
bool TransferDataFromWindow() override;
|
|
|
|
|
|
|
|
bool Validate() override;
|
|
|
|
|
2022-08-14 11:03:18 +00:00
|
|
|
void ImportSettingsFrom( const std::shared_ptr<NET_SETTINGS>& aNetSettings );
|
2020-07-03 22:30:23 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
private:
|
|
|
|
void OnAddNetclassClick( wxCommandEvent& event ) override;
|
|
|
|
void OnRemoveNetclassClick( wxCommandEvent& event ) override;
|
|
|
|
void OnSizeNetclassGrid( wxSizeEvent& event ) override;
|
2022-08-14 11:03:18 +00:00
|
|
|
void OnSizeAssignmentGrid( wxSizeEvent& event ) override;
|
|
|
|
void OnAddAssignmentClick( wxCommandEvent& event ) override;
|
|
|
|
void OnRemoveAssignmentClick( wxCommandEvent& event ) override;
|
2018-04-28 15:22:25 +00:00
|
|
|
void OnUpdateUI( wxUpdateUIEvent &event ) override;
|
|
|
|
void OnNetclassGridCellChanging( wxGridEvent& event );
|
2021-02-12 01:49:51 +00:00
|
|
|
void OnNetclassGridMouseEvent( wxMouseEvent& event );
|
2018-04-28 15:22:25 +00:00
|
|
|
|
2021-12-22 21:43:41 +00:00
|
|
|
void onUnitsChanged( wxCommandEvent& aEvent );
|
|
|
|
|
2021-07-27 12:22:27 +00:00
|
|
|
bool validateNetclassName( int aRow, const wxString& aName, bool focusFirst = true );
|
2018-04-28 15:22:25 +00:00
|
|
|
|
|
|
|
void rebuildNetclassDropdowns();
|
|
|
|
|
|
|
|
void AdjustNetclassGridColumns( int aWidth );
|
2022-08-14 11:03:18 +00:00
|
|
|
void AdjustAssignmentGridColumns( int aWidth );
|
2018-04-28 15:22:25 +00:00
|
|
|
|
2023-09-17 14:49:46 +00:00
|
|
|
void loadNetclasses();
|
|
|
|
void checkReload();
|
|
|
|
|
2022-08-14 11:03:18 +00:00
|
|
|
private:
|
2022-11-04 12:20:53 +00:00
|
|
|
EDA_DRAW_FRAME* m_frame;
|
|
|
|
bool m_isEEschema;
|
|
|
|
std::shared_ptr<NET_SETTINGS> m_netSettings;
|
|
|
|
std::set<wxString> m_netNames;
|
|
|
|
|
|
|
|
std::unique_ptr<UNITS_PROVIDER> m_schUnitsProvider;
|
|
|
|
std::unique_ptr<UNITS_PROVIDER> m_pcbUnitsProvider;
|
2021-02-12 03:19:46 +00:00
|
|
|
|
2023-09-17 14:49:46 +00:00
|
|
|
std::map<wxString, std::shared_ptr<NETCLASS>> m_lastLoaded;
|
|
|
|
int m_lastCheckedTicker;
|
|
|
|
|
2024-02-08 15:07:14 +00:00
|
|
|
std::map<int, int> m_originalColWidths; // Map col-number : orig-col-width
|
2021-07-27 12:22:27 +00:00
|
|
|
bool m_netclassesDirty; // The netclass drop-down menus need rebuilding
|
|
|
|
int m_hoveredCol; // Column being hovered over, for tooltips
|
2022-08-14 11:03:18 +00:00
|
|
|
wxString m_lastPattern;
|
2022-08-21 11:26:47 +00:00
|
|
|
|
|
|
|
int m_lastNetclassGridWidth;
|
2018-04-28 15:22:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //PANEL_SETUP_NETCLASSES_H
|