34 m_membersGridDirty( false ),
35 m_errorGrid( nullptr ),
51 [
this]( wxCommandEvent& aEvent )
57 [
this]( wxCommandEvent& aEvent )
94 [&](
const std::shared_ptr<BUS_ALIAS>& alias ) ->
bool
96 wxString aName = alias->GetName();
97 std::vector<wxString> aMembers = alias->Members();
99 std::sort( aMembers.begin(), aMembers.end() );
101 for(
const std::shared_ptr<BUS_ALIAS>& candidate :
m_aliases )
103 wxString bName = candidate->GetName();
104 std::vector<wxString> bMembers = candidate->Members();
106 std::sort( bMembers.begin(), bMembers.end() );
108 if( aName == bName && aMembers == bMembers )
120 for(
const std::shared_ptr<BUS_ALIAS>& alias : screen->GetBusAliases() )
122 if( !contains( alias ) )
132 for(
const std::shared_ptr<BUS_ALIAS>& alias :
m_aliases )
153 screen->ClearBusAliases();
155 for(
const std::shared_ptr<BUS_ALIAS>& alias :
m_aliases )
156 alias->GetParent()->AddBusAlias( alias );
202 m_aliasesGrid->MakeCellVisible( std::max( 0, curRow-1 ), 0 );
238 alias->Members().clear();
241 alias->Members().push_back(
m_membersGrid->GetCellValue( ii, 0 ) );
245 m_membersGrid->MakeCellVisible( std::max( 0, curRow-1 ), 0 );
253 int row =
event.GetRow();
257 wxString
name =
event.GetString();
261 if( ii == event.GetRow() )
267 m_errorMsg = wxString::Format(
_(
"Alias name '%s' already in use." ),
name );
283 int row =
event.GetRow();
287 wxString
name =
event.GetString();
291 m_errorMsg =
_(
"Member net/alias name cannot be empty." );
301 alias->Members().clear();
308 wxStringTokenizer tok(
name,
" " );
310 if( tok.CountTokens() > 1 )
316 while( tok.HasMoreTokens() )
317 alias->Members().push_back( tok.GetNextToken() );
321 alias->Members().push_back(
m_membersGrid->GetCellValue( ii, 0 ) );
330 if(
m_lastAlias >= 0 && m_lastAlias < m_aliasesGrid->GetNumberRows() )
334 wxString membersLabel;
336 if( alias->GetParent() )
338 wxFileName sheet_name( alias->GetParent()->GetFileName() );
339 source.Printf( wxS(
"(" ) + sheet_name.GetFullName() + wxS(
")" ) );
352 for(
const wxString& member : alias->Members() )
375 int colSize = std::max(
grid->GetClientSize().x,
grid->GetVisibleWidth( 0 ) );
377 if(
grid->GetColSize( 0 ) != colSize )
378 grid->SetColSize( 0, colSize );
400 wxWindow* topLevelParent = wxGetTopLevelParent(
this );
422 wxGridCellEditor* cellEditor =
m_aliasesGrid->GetCellEditor( row, 0 );
424 if( wxTextEntry* txt =
dynamic_cast<wxTextEntry*
>( cellEditor->GetControl() ) )
425 aliasName = txt->GetValue();
427 cellEditor->DecRef();
434 else if(
m_lastAlias >= 0 && m_lastAlias < m_aliasesGrid->GetNumberRows() )
452 const std::shared_ptr<BUS_ALIAS>& alias =
m_aliases[ row ];
453 alias->SetName( aliasName );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
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.
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)