39#include <unordered_map>
44 std::list<SCH_SHEET_PATH> aSheetPath,
45 std::shared_ptr<SHEET_SYNCHRONIZATION_AGENT> aAgent ) :
48 m_lastEditSheet( nullptr ),
50 m_placementTemplate( nullptr )
62 std::unordered_map<wxString, std::list<PANEL_SYNC_SHEET_PINS*>> sheet_instances;
64 for(
const auto& sheet_path : aSheetPath )
66 auto sheet = sheet_path.Last();
67 wxString fileName = sheet->GetFileName();
69 ++count, *
m_agent, sheet_path );
73 if( sheet_instances.find( fileName ) == sheet_instances.end() )
75 sheet_instances.try_emplace( fileName, std::list<PANEL_SYNC_SHEET_PINS*>{ page } );
79 sheet_instances[fileName].push_back( page );
85 for(
auto& [sheet_name, panel_list] : sheet_instances )
87 if( panel_list.size() > 1 )
89 std::list<std::shared_ptr<SHEET_SYNCHRONIZATION_NOTIFIER>> sheet_change_notifiers;
90 std::list<SHEET_SYNCHRONIZATION_MODEL*> sheet_sync_models;
92 for(
auto& panel : panel_list )
96 sheet_sync_models.push_back( model );
97 sheet_change_notifiers.push_back(
98 std::make_shared<SHEET_FILE_CHANGE_NOTIFIER>( model, panel ) );
101 for(
auto& notifier : sheet_change_notifiers )
103 for(
auto& other : sheet_sync_models )
105 if( notifier->GetOwner() != other )
137 auto post_end_place_item = std::shared_ptr<std::nullptr_t>(
nullptr,
138 [&]( std::nullptr_t )
155 if( template_item->GetText() != new_item->GetText()
156 || template_item->GetShape() != new_item->GetShape() )
162 template_item->SetText( new_item->GetText() );
163 template_item->SetShape( new_item->GetShape() );
165 panel->GetSheetPath(),
167 ? SHEET_SYNCHRONIZATION_ITEM_KIND::HIERLABEL
168 : SHEET_SYNCHRONIZATION_ITEM_KIND::SHEET_PIN );
171 panel->UpdateForms();
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Class DIALOG_SYNC_SHEET_PINS_BASE.
SCH_HIERLABEL * GetPlacementTemplate() const
Get the Placement Template SHEET_PIN / HIERLABEL used for place a new HIERLABEL/SHEET_PIN.
PlaceItemKind m_placeItemKind
void BeginPlaceItem(SCH_SHEET *aSheet, PlaceItemKind aKind, EDA_ITEM *aTemplate)
Start place a new SHEET_PIN/HIERLABEL.
SCH_SHEET * m_lastEditSheet
std::unordered_map< SCH_SHEET *, PANEL_SYNC_SHEET_PINS * > m_panels
void EndPlaceItem(EDA_ITEM *aNewItem)
std::shared_ptr< SHEET_SYNCHRONIZATION_AGENT > m_agent
DIALOG_SYNC_SHEET_PINS(wxWindow *aParent, std::list< SCH_SHEET_PATH > aSheetPath, std::shared_ptr< SHEET_SYNCHRONIZATION_AGENT > aAgent)
void OnClose(wxCloseEvent &aEvent)
~DIALOG_SYNC_SHEET_PINS() override
EDA_ITEM * m_placementTemplate
void OnCloseBtnClick(wxCommandEvent &event) override
A base class for most all the KiCad significant classes used in schematics and boards.
bool HasUndefinedSheetPing() const
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
void AddNotifier(std::shared_ptr< SHEET_SYNCHRONIZATION_NOTIFIER > aNotifier)
static const std::map< BOOKCTRL_ICON_INDEX, BITMAPS > & GetBookctrlPageIcon()