2022-08-21 12:26:47 +01:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2018 CERN
|
2025-01-01 13:30:11 -08:00
|
|
|
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
|
2022-08-21 12:26:47 +01:00
|
|
|
* @author Jon Evans <jon@craftyjon.com>
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PANEL_SETUP_BUSES_H
|
|
|
|
#define PANEL_SETUP_BUSES_H
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <dialogs/panel_setup_buses_base.h>
|
|
|
|
#include <bus_alias.h>
|
|
|
|
|
|
|
|
class SCH_EDIT_FRAME;
|
|
|
|
class SCH_SCREEN;
|
|
|
|
class BUS_ALIAS;
|
|
|
|
|
|
|
|
class PANEL_SETUP_BUSES : public PANEL_SETUP_BUSES_BASE
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PANEL_SETUP_BUSES( wxWindow* aWindow, SCH_EDIT_FRAME* aFrame );
|
|
|
|
|
2022-09-09 12:18:05 +01:00
|
|
|
~PANEL_SETUP_BUSES();
|
2022-08-21 12:26:47 +01:00
|
|
|
|
|
|
|
bool TransferDataFromWindow() override;
|
|
|
|
bool TransferDataToWindow() override;
|
|
|
|
|
2024-08-11 19:07:03 -06:00
|
|
|
void ImportSettingsFrom( const SCHEMATIC& aOtherSchematic );
|
|
|
|
|
2022-08-21 12:26:47 +01:00
|
|
|
protected:
|
|
|
|
void OnAddAlias( wxCommandEvent& aEvent ) override;
|
|
|
|
void OnDeleteAlias( wxCommandEvent& aEvent ) override;
|
|
|
|
void OnAddMember( wxCommandEvent& aEvent ) override;
|
|
|
|
void OnRemoveMember( wxCommandEvent& aEvent ) override;
|
|
|
|
void OnAliasesGridCellChanging( wxGridEvent& event );
|
|
|
|
void OnMemberGridCellChanging( wxGridEvent& event );
|
|
|
|
void OnSizeGrid( wxSizeEvent& event ) override;
|
|
|
|
void OnUpdateUI( wxUpdateUIEvent& event ) override;
|
|
|
|
|
2024-08-11 19:07:03 -06:00
|
|
|
void loadAliases( const SCHEMATIC& aSchematic );
|
|
|
|
|
2022-08-21 20:35:02 +01:00
|
|
|
void reloadMembersGridOnIdle( wxIdleEvent& aEvent );
|
|
|
|
|
|
|
|
void doReloadMembersGrid();
|
2022-08-21 12:26:47 +01:00
|
|
|
|
2025-01-18 10:32:42 -05:00
|
|
|
/**
|
2024-11-07 17:15:13 +00:00
|
|
|
* When rows are created programmatically by pasting values from the clipboard,
|
2025-01-18 10:32:42 -05:00
|
|
|
* the cell change event may not be triggered.
|
2025-01-01 13:30:11 -08:00
|
|
|
*
|
2025-01-18 10:32:42 -05:00
|
|
|
* This can prevent members from being automatically added to the corresponding alias. To
|
|
|
|
* ensure that members are correctly associated with the alias, manually update the members
|
|
|
|
* for the needed alias.
|
2024-11-07 17:15:13 +00:00
|
|
|
*/
|
|
|
|
void updateAliasMembers( int aAliasIndex );
|
|
|
|
|
2022-08-21 12:26:47 +01:00
|
|
|
private:
|
|
|
|
SCH_EDIT_FRAME* m_frame;
|
|
|
|
wxString m_membersLabelTemplate;
|
|
|
|
|
|
|
|
std::vector< std::shared_ptr<BUS_ALIAS> > m_aliases;
|
|
|
|
int m_lastAlias;
|
|
|
|
wxString m_lastAliasName;
|
2022-09-09 12:18:05 +01:00
|
|
|
bool m_membersGridDirty;
|
2022-08-21 12:26:47 +01:00
|
|
|
|
|
|
|
wxString m_errorMsg;
|
|
|
|
WX_GRID* m_errorGrid;
|
|
|
|
int m_errorRow;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // PANEL_SETUP_BUSES_H
|