34 m_membersGridDirty( false ),
35 m_errorGrid( nullptr ),
51 [
this]( wxCommandEvent& aEvent )
57 [
this]( wxCommandEvent& aEvent )
91 [&](
const std::shared_ptr<BUS_ALIAS>& alias ) ->
bool
93 wxString aName = alias->GetName();
94 std::vector<wxString> aMembers = alias->Members();
96 std::sort( aMembers.begin(), aMembers.end() );
98 for(
const std::shared_ptr<BUS_ALIAS>& candidate :
m_aliases )
100 wxString bName = candidate->GetName();
101 std::vector<wxString> bMembers = candidate->Members();
103 std::sort( bMembers.begin(), bMembers.end() );
105 if( aName == bName && aMembers == bMembers )
117 for(
const std::shared_ptr<BUS_ALIAS>& alias : screen->GetBusAliases() )
119 if( !contains( alias ) )
129 for(
const std::shared_ptr<BUS_ALIAS>& alias :
m_aliases )
150 screen->ClearBusAliases();
152 for(
const std::shared_ptr<BUS_ALIAS>& alias :
m_aliases )
153 alias->GetParent()->AddBusAlias( alias );
199 m_aliasesGrid->MakeCellVisible( std::max( 0, curRow-1 ), 0 );
235 alias->Members().clear();
238 alias->Members().push_back(
m_membersGrid->GetCellValue( ii, 0 ) );
242 m_membersGrid->MakeCellVisible( std::max( 0, curRow-1 ), 0 );
250 int row =
event.GetRow();
254 wxString
name =
event.GetString();
258 if( ii == event.GetRow() )
264 m_errorMsg = wxString::Format(
_(
"Alias name '%s' already in use." ),
name );
280 int row =
event.GetRow();
284 wxString
name =
event.GetString();
288 m_errorMsg =
_(
"Member net/alias name cannot be empty." );
298 alias->Members().clear();
305 wxStringTokenizer tok(
name,
" " );
307 if( tok.CountTokens() > 1 )
313 while( tok.HasMoreTokens() )
314 alias->Members().push_back( tok.GetNextToken() );
318 alias->Members().push_back(
m_membersGrid->GetCellValue( ii, 0 ) );
327 if(
m_lastAlias >= 0 && m_lastAlias < m_aliasesGrid->GetNumberRows() )
331 wxString membersLabel;
333 if( alias->GetParent() )
335 wxFileName sheet_name( alias->GetParent()->GetFileName() );
336 source.Printf( wxS(
"(" ) + sheet_name.GetFullName() + wxS(
")" ) );
349 for(
const wxString& member : alias->Members() )
372 int colSize = std::max(
grid->GetClientSize().x,
grid->GetVisibleWidth( 0 ) );
374 if(
grid->GetColSize( 0 ) != colSize )
375 grid->SetColSize( 0, colSize );
417 wxGridCellEditor* cellEditor =
m_aliasesGrid->GetCellEditor( row, 0 );
419 if( wxTextEntry* txt =
dynamic_cast<wxTextEntry*
>( cellEditor->GetControl() ) )
420 aliasName = txt->GetValue();
422 cellEditor->DecRef();
429 else if(
m_lastAlias >= 0 && m_lastAlias < m_aliasesGrid->GetNumberRows() )
447 const std::shared_ptr<BUS_ALIAS>& alias =
m_aliases[ row ];
448 alias->SetName( aliasName );
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Class PANEL_SETUP_BUSES_BASE.
STD_BITMAP_BUTTON * m_addAlias
wxSimplebook * m_membersBook
STD_BITMAP_BUTTON * m_addMember
STD_BITMAP_BUTTON * m_deleteAlias
wxStaticText * m_membersLabel
STD_BITMAP_BUTTON * m_removeMember
void OnAliasesGridCellChanging(wxGridEvent &event)
std::vector< std::shared_ptr< BUS_ALIAS > > m_aliases
void reloadMembersGridOnIdle(wxIdleEvent &aEvent)
void OnDeleteAlias(wxCommandEvent &aEvent) override
void OnUpdateUI(wxUpdateUIEvent &event) override
void OnSizeGrid(wxSizeEvent &event) override
PANEL_SETUP_BUSES(wxWindow *aWindow, SCH_EDIT_FRAME *aFrame)
bool TransferDataToWindow() override
wxString m_membersLabelTemplate
void OnRemoveMember(wxCommandEvent &aEvent) override
void OnMemberGridCellChanging(wxGridEvent &event)
bool TransferDataFromWindow() override
void OnAddMember(wxCommandEvent &aEvent) override
void doReloadMembersGrid()
void OnAddAlias(wxCommandEvent &aEvent) override
Schematic editor (Eeschema) main window.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCHEMATIC & Schematic() const
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
void ClearRows()
wxWidgets recently added an ASSERT which fires if the position is greater than or equal to the number...
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library.
wxFont GetInfoFont(wxWindow *aWindow)