33#include <wx/variant.h>
43 m_selectedIndex(
std::optional<unsigned>() ),
57 const std::shared_ptr<SHEET_SYNCHRONIZATION_ITEM>& item =
m_items[row];
62 aVariant << wxDataViewIconText( item->GetName(), item->GetBitmap() );
83 wxDataViewItemAttr& attr )
const
100 for(
const auto& item :
TakeItems( aItems ) )
109 m_items.push_back( std::move( aItem ) );
118 m_items.push_back( std::move( aItem ) );
127 if( aItems.size() == 1 )
130 std::set<unsigned> rowsToBeRemove;
134 for(
const auto& item : aItems )
138 unsigned int idx = GetRow( item );
139 rowsToBeRemove.insert( idx );
143 for(
unsigned i = 0; i <
m_items.size(); i++ )
145 if( rowsToBeRemove.find( i ) == rowsToBeRemove.end() )
147 items_remain.push_back(
m_items[i] );
151 items_token.push_back(
m_items[i] );
163 const unsigned int row = GetRow( aItem );
168 std::shared_ptr<SHEET_SYNCHRONIZATION_ITEM> item =
m_items[row];
190 if( aRow.has_value() &&
m_items.size() > *aRow )
192 if( wxDataViewItem item = GetItem( *aRow ); item.IsOk() )
206 std::shared_ptr<SHEET_SYNCHRONIZATION_NOTIFIER> aNotifier )
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Agent for all the modifications while syncing the sheet pin and hierarchical label.
void RemoveItem(SHEET_SYNCHRONIZATION_ITEM &aItem, SCH_SHEET *aSheet, SCH_SHEET_PATH const &aPath)
~SHEET_SYNCHRONIZATION_MODEL() override
std::list< std::shared_ptr< SHEET_SYNCHRONIZATION_NOTIFIER > > m_notifiers
std::optional< unsigned > m_selectedIndex
bool GetAttrByRow(unsigned row, unsigned int col, wxDataViewItemAttr &attr) const override
bool SetValueByRow(const wxVariant &variant, unsigned row, unsigned col) override
SHEET_SYNCHRONIZATION_ITE_PTR TakeItem(wxDataViewItem const &aItem)
SHEET_SYNCHRONIZATION_ITEM_LIST TakeItems(wxDataViewItemArray const &aItems)
SHEET_SYNCHRONIZATION_ITE_PTR GetSynchronizationItem(unsigned aIndex) const
void AddNotifier(std::shared_ptr< SHEET_SYNCHRONIZATION_NOTIFIER > aNotifier)
void GetValueByRow(wxVariant &variant, unsigned row, unsigned col) const override
bool AppendItem(std::shared_ptr< SHEET_SYNCHRONIZATION_ITEM > aItem)
Just append item to the list, the notifiers are not notified.
void UpdateItems(SHEET_SYNCHRONIZATION_ITEM_LIST aItems)
SHEET_SYNCHRONIZATION_AGENT & m_agent
SHEET_SYNCHRONIZATION_ITEM_LIST m_items
void RemoveItems(wxDataViewItemArray const &aItems)
bool AppendNewItem(std::shared_ptr< SHEET_SYNCHRONIZATION_ITEM > aItem)
Add a new item, the notifiers are notified.
void OnRowSelected(std::optional< unsigned > aRow)
SHEET_SYNCHRONIZATION_MODEL(SHEET_SYNCHRONIZATION_AGENT &aAgent, SCH_SHEET *aSheet, SCH_SHEET_PATH &aPath)
wxString getElectricalTypeLabel(LABEL_FLAG_SHAPE aType)
wxString getElectricalTypeLabel(LABEL_FLAG_SHAPE aType)
std::vector< SHEET_SYNCHRONIZATION_ITE_PTR > SHEET_SYNCHRONIZATION_ITEM_LIST
std::shared_ptr< SHEET_SYNCHRONIZATION_ITEM > SHEET_SYNCHRONIZATION_ITE_PTR