Post merge request clean up.

This commit is contained in:
Wayne Stambaugh 2024-02-26 07:43:56 -05:00
parent 43c45f3ee8
commit 23169ca1a7
14 changed files with 115 additions and 73 deletions

View File

@ -39,12 +39,15 @@
#include <unordered_map>
#include <sch_drawing_tools.h>
DIALOG_SYNC_SHEET_PINS::DIALOG_SYNC_SHEET_PINS(
wxWindow* aParent, std::list<SCH_SHEET_PATH> aSheetPath,
std::shared_ptr<SHEET_SYNCHRONIZATION_AGENT> aAgent ) :
DIALOG_SYNC_SHEET_PINS::DIALOG_SYNC_SHEET_PINS( wxWindow* aParent,
std::list<SCH_SHEET_PATH> aSheetPath,
std::shared_ptr<SHEET_SYNCHRONIZATION_AGENT> aAgent ) :
DIALOG_SYNC_SHEET_PINS_BASE( aParent ),
m_agent( std::move( aAgent ) ), m_lastEditSheet( nullptr ),
m_placeItemKind( PlaceItemKind::UNDEFINED ), m_placementTemplate( nullptr )
m_agent( std::move( aAgent ) ),
m_lastEditSheet( nullptr ),
m_placeItemKind( PlaceItemKind::UNDEFINED ),
m_placementTemplate( nullptr )
{
wxImageList* imageList = new wxImageList( SYNC_SHEET_PIN_PREFERENCE::NORMAL_WIDTH,
SYNC_SHEET_PIN_PREFERENCE::NORMAL_HEIGHT );
@ -122,6 +125,7 @@ void DIALOG_SYNC_SHEET_PINS::OnCloseBtnClick( wxCommandEvent& event )
Close();
}
void DIALOG_SYNC_SHEET_PINS::OnClose( wxCloseEvent& aEvent )
{
aEvent.Skip();

View File

@ -37,6 +37,7 @@ class EDA_ITEM;
class SHEET_SYNCHRONIZATION_AGENT;
class PANEL_SYNC_SHEET_PINS;
class SCH_HIERLABEL;
class DIALOG_SYNC_SHEET_PINS : public DIALOG_SYNC_SHEET_PINS_BASE
{
public:
@ -59,17 +60,17 @@ public:
void EndPlaceItem( EDA_ITEM* aNewItem );
/**
* @brief Start place a new SHEET_PIN / HIERLABEL
*
* @param aSheet The sheet instance
* @param aKind SHEET_PIN / HIERLABEL
* @param aTemplate The template used for the new SHEET_PIN / HIERLABEL
*/
* Start place a new #SHEET_PIN/#HIERLABEL.
*
* @param aSheet The sheet instance
* @param aKind SHEET_PIN / HIERLABEL
* @param aTemplate The template used for the new SHEET_PIN / HIERLABEL
*/
void BeginPlaceItem( SCH_SHEET* aSheet, PlaceItemKind aKind, EDA_ITEM* aTemplate );
/**
* @brief Get the Placement Template SHEET_PIN / HIERLABEL used for place a new HIERLABEL/SHEET_PIN
*
* Get the Placement Template SHEET_PIN / HIERLABEL used for place a new #HIERLABEL/#SHEET_PIN.
*
* @return SCH_HIERLABEL*
*/
SCH_HIERLABEL* GetPlacementTemplate() const;
@ -79,6 +80,7 @@ private:
//It's the agent that performs modification and placement
std::shared_ptr<SHEET_SYNCHRONIZATION_AGENT> m_agent;
SCH_SHEET* m_lastEditSheet;
//The same sheet may have mutiple instances
std::unordered_map<SCH_SHEET*, PANEL_SYNC_SHEET_PINS*> m_panels;
PlaceItemKind m_placeItemKind;

View File

@ -42,10 +42,14 @@
PANEL_SYNC_SHEET_PINS::PANEL_SYNC_SHEET_PINS( wxWindow* aParent, SCH_SHEET* aSheet,
wxNotebook* aNoteBook, int aIndex,
SHEET_SYNCHRONIZATION_AGENT& aAgent,
SCH_SHEET_PATH aPath ) :
const SCH_SHEET_PATH& aPath ) :
PANEL_SYNC_SHEET_PINS_BASE( aParent ),
m_sheet( aSheet ), m_noteBook( aNoteBook ), m_index( aIndex ),
m_sheetFileName( aSheet->GetFileName() ), m_agent( aAgent ), m_path( std::move( aPath ) )
m_sheet( aSheet ),
m_noteBook( aNoteBook ),
m_index( aIndex ),
m_sheetFileName( aSheet->GetFileName() ),
m_agent( aAgent ),
m_path( std::move( aPath ) )
{
m_btnUsePinAsTemplate->SetBitmap( KiBitmapBundle( BITMAPS::add_hierar_pin ) );
m_btnUseLabelAsTemplate->SetBitmap( KiBitmapBundle( BITMAPS::add_hierarchical_label ) );
@ -101,6 +105,7 @@ void PANEL_SYNC_SHEET_PINS::UpdateForms()
for( size_t i = 0; i < pins_ori.size(); i++ )
{
SCH_SHEET_PIN* cur_pin = pins_ori[i];
if( label->GetText() == cur_pin->GetText() && label->GetShape() == cur_pin->GetShape() )
{
associated_list.push_back(
@ -109,11 +114,11 @@ void PANEL_SYNC_SHEET_PINS::UpdateForms()
return;
}
}
labels_list.push_back(
std::make_shared<SCH_HIERLABEL_SYNCHRONIZATION_ITEM>( label, m_sheet ) );
};
for( const auto& item : labels_ori )
check_matched( static_cast<SCH_HIERLABEL*>( item ) );
@ -141,8 +146,7 @@ void PANEL_SYNC_SHEET_PINS::UpdateForms()
}
SHEET_SYNCHRONIZATION_MODEL_PTR
PANEL_SYNC_SHEET_PINS::GetModel( int aKind ) const
SHEET_SYNCHRONIZATION_MODEL_PTR PANEL_SYNC_SHEET_PINS::GetModel( int aKind ) const
{
return m_models.at( aKind );
}
@ -172,11 +176,15 @@ void PANEL_SYNC_SHEET_PINS::OnBtnAddLabelsClicked( wxCommandEvent& aEvent )
if( auto idx = m_models[SHEET_SYNCHRONIZATION_MODEL::SHEET_PIN]->GetSelectedIndex();
idx.has_value() )
{
if( SHEET_SYNCHRONIZATION_ITE_PTR item =
m_models[SHEET_SYNCHRONIZATION_MODEL::SHEET_PIN]->GetSynchronizationItem(
*idx ) )
{
m_agent.PlaceHieraLable( m_sheet, m_path,
static_cast<SCH_SHEET_PIN*>( item->GetItem() ) );
}
}
}
@ -186,11 +194,15 @@ void PANEL_SYNC_SHEET_PINS::OnBtnAddSheetPinsClicked( wxCommandEvent& aEvent )
if( auto idx = m_models[SHEET_SYNCHRONIZATION_MODEL::HIRE_LABEL]->GetSelectedIndex();
idx.has_value() )
{
if( SHEET_SYNCHRONIZATION_ITE_PTR item =
m_models[SHEET_SYNCHRONIZATION_MODEL::HIRE_LABEL]->GetSynchronizationItem(
*idx ) )
{
m_agent.PlaceSheetPin( m_sheet, m_path,
static_cast<SCH_HIERLABEL*>( item->GetItem() ) );
}
}
}
@ -200,8 +212,10 @@ void PANEL_SYNC_SHEET_PINS::GenericSync( SYNC_DIRECTION direction )
wxDataViewItem pinIdx = m_viewSheetPins->GetSelection();
for( auto& idx : { labelIdx, pinIdx } )
{
if( !idx.IsOk() )
return;
}
SHEET_SYNCHRONIZATION_ITE_PTR labelItem =
m_models[SHEET_SYNCHRONIZATION_MODEL::HIRE_LABEL]->TakeItem( labelIdx );
@ -209,8 +223,10 @@ void PANEL_SYNC_SHEET_PINS::GenericSync( SYNC_DIRECTION direction )
m_models[SHEET_SYNCHRONIZATION_MODEL::SHEET_PIN]->TakeItem( pinIdx );
for( const auto& item : { labelItem, pinItem } )
{
if( !item )
return;
}
auto label_ptr =
std::static_pointer_cast<SCH_HIERLABEL_SYNCHRONIZATION_ITEM>( labelItem )->GetLabel();
@ -247,7 +263,9 @@ void PANEL_SYNC_SHEET_PINS::GenericSync( SYNC_DIRECTION direction )
for( auto idx :
{ SHEET_SYNCHRONIZATION_MODEL::HIRE_LABEL, SHEET_SYNCHRONIZATION_MODEL::SHEET_PIN } )
{
PostProcessModelSelection( idx, {} );
}
m_models[SHEET_SYNCHRONIZATION_MODEL::HIRE_LABEL]->DoNotify();
}
@ -317,6 +335,7 @@ void PANEL_SYNC_SHEET_PINS::OnBtnUndoClicked( wxCommandEvent& aEvent )
std::make_shared<SCH_SHEET_PIN_SYNCHRONIZATION_ITEM>( associated->GetPin(),
m_sheet ) );
}
PostProcessModelSelection( SHEET_SYNCHRONIZATION_MODEL::ASSOCIATED, {} );
UpdatePageImage();
}
@ -335,12 +354,14 @@ void PANEL_SYNC_SHEET_PINS::PostProcessModelSelection( int aIdex, wxDataViewItem
{
for( auto btn : { m_btnAddLabels, m_btnRmPins } )
btn->Enable( m_models[SHEET_SYNCHRONIZATION_MODEL::SHEET_PIN]->HasSelectedIndex() );
break;
}
case SHEET_SYNCHRONIZATION_MODEL::HIRE_LABEL:
{
for( auto btn : { m_btnAddSheetPins, m_btnRmLabels } )
btn->Enable( m_models[SHEET_SYNCHRONIZATION_MODEL::HIRE_LABEL]->HasSelectedIndex() );
break;
}
case SHEET_SYNCHRONIZATION_MODEL::ASSOCIATED:
@ -348,7 +369,8 @@ void PANEL_SYNC_SHEET_PINS::PostProcessModelSelection( int aIdex, wxDataViewItem
m_btnUndo->Enable( m_models[SHEET_SYNCHRONIZATION_MODEL::ASSOCIATED]->HasSelectedIndex() );
break;
}
default: break;
default:
break;
}
if( aIdex != SHEET_SYNCHRONIZATION_MODEL::ASSOCIATED )

View File

@ -53,7 +53,7 @@ public:
PANEL_SYNC_SHEET_PINS( wxWindow* aParent, SCH_SHEET* aSheet, wxNotebook* aNoteBook, int aIndex,
SHEET_SYNCHRONIZATION_AGENT& aAgent, SCH_SHEET_PATH aPath );
SHEET_SYNCHRONIZATION_AGENT& aAgent, const SCH_SHEET_PATH& aPath );
~PANEL_SYNC_SHEET_PINS() override;
@ -105,4 +105,4 @@ private:
SCH_SHEET_PATH m_path;
};
#endif
#endif

View File

@ -36,8 +36,10 @@ SHEET_SYNCHRONIZATION_AGENT::SHEET_SYNCHRONIZATION_AGENT( DO_MODIFY_ITEM aDoMod
TOOL_MANAGER* aToolManager,
SCH_EDIT_FRAME* a_frame ) :
m_doModify( std::move( aDoModify ) ),
m_doDelete( std::move( aNotifyItemChange ) ), m_doPlaceItem( std::move( aPlaceItem ) ),
m_toolManager( aToolManager ), m_frame( a_frame )
m_doDelete( std::move( aNotifyItemChange ) ),
m_doPlaceItem( std::move( aPlaceItem ) ),
m_toolManager( aToolManager ),
m_frame( a_frame )
{
}
@ -54,7 +56,7 @@ void SHEET_SYNCHRONIZATION_AGENT::ModifyItem( SHEET_SYNCHRONIZATION_ITEM& aItem,
void SHEET_SYNCHRONIZATION_AGENT::ModifyItem( SCH_ITEM* sch_item, std::function<void()> aDoModify,
SCH_SHEET_PATH const& aPath,
const SCH_SHEET_PATH& aPath,
SHEET_SYNCHRONIZATION_ITEM_KIND aKind )
{
if( !aDoModify )
@ -68,20 +70,20 @@ void SHEET_SYNCHRONIZATION_AGENT::ModifyItem( SCH_ITEM* sch_item, std::function<
break;
}
case SHEET_SYNCHRONIZATION_ITEM_KIND::SHEET_PIN:
{
SCH_SHEET_PATH path_cp = aPath;
path_cp.pop_back();
m_doModify( sch_item, path_cp, aDoModify );
break;
}
case SHEET_SYNCHRONIZATION_ITEM_KIND::HIERLABEL_AND_SHEET_PIN: break;
case SHEET_SYNCHRONIZATION_ITEM_KIND::HIERLABEL_AND_SHEET_PIN:
break;
}
}
void SHEET_SYNCHRONIZATION_AGENT::RemoveItem( SHEET_SYNCHRONIZATION_ITEM& aItem, SCH_SHEET* aSheet,
SCH_SHEET_PATH const& aPath )
const SCH_SHEET_PATH& aPath )
{
if( !aSheet )
return;
@ -101,7 +103,8 @@ void SHEET_SYNCHRONIZATION_AGENT::RemoveItem( SHEET_SYNCHRONIZATION_ITEM& aItem,
m_doDelete( aItem.GetItem(), path_cp );
break;
}
case SHEET_SYNCHRONIZATION_ITEM_KIND::HIERLABEL_AND_SHEET_PIN: break;
case SHEET_SYNCHRONIZATION_ITEM_KIND::HIERLABEL_AND_SHEET_PIN:
break;
}
}

View File

@ -41,8 +41,7 @@ class SCH_ITEM;
enum class SHEET_SYNCHRONIZATION_ITEM_KIND;
/**
* @brief Agent for all the modifications while syncing the sheet pin and hierlabel
*
* Agent for all the modifications while syncing the sheet pin and hierarchical label.
*/
class SHEET_SYNCHRONIZATION_AGENT
{
@ -69,9 +68,9 @@ public:
~SHEET_SYNCHRONIZATION_AGENT();
void ModifyItem( SHEET_SYNCHRONIZATION_ITEM& aItem, std::function<void()> aDoModify,
SCH_SHEET_PATH const& aPath );
const SCH_SHEET_PATH& aPath );
void ModifyItem( SCH_ITEM* aItem, std::function<void()> aDoModify, SCH_SHEET_PATH const& aPath,
void ModifyItem( SCH_ITEM* aItem, std::function<void()> aDoModify, const SCH_SHEET_PATH& aPath,
SHEET_SYNCHRONIZATION_ITEM_KIND aKind );
void RemoveItem( SHEET_SYNCHRONIZATION_ITEM& aItem, SCH_SHEET* aSheet,

View File

@ -143,14 +143,16 @@ int ASSOCIATED_SCH_LABEL_PIN::GetShape() const
wxBitmap& ASSOCIATED_SCH_LABEL_PIN::GetBitmap() const
{
static auto label_and_pin_icon = ( []{
wxBitmap left = KiBitmap( BITMAPS::add_hierar_pin, SYNC_SHEET_PIN_PREFERENCE::NORMAL_HEIGHT );
wxBitmap left = KiBitmap( BITMAPS::add_hierar_pin,
SYNC_SHEET_PIN_PREFERENCE::NORMAL_HEIGHT );
wxBitmap right =
KiBitmap( BITMAPS::add_hierarchical_label, SYNC_SHEET_PIN_PREFERENCE::NORMAL_HEIGHT );
KiBitmap( BITMAPS::add_hierarchical_label,
SYNC_SHEET_PIN_PREFERENCE::NORMAL_HEIGHT );
wxImage img( wxSize{ SYNC_SHEET_PIN_PREFERENCE::NORMAL_WIDTH * 2,
SYNC_SHEET_PIN_PREFERENCE::NORMAL_HEIGHT } );
img.Paste( left.ConvertToImage(), 0, 0 );
img.Paste( right.ConvertToImage(), SYNC_SHEET_PIN_PREFERENCE::NORMAL_WIDTH, 0 );
return wxBitmap(img);
return wxBitmap( img );
} )();
return label_and_pin_icon;

View File

@ -44,6 +44,7 @@ enum class SHEET_SYNCHRONIZATION_ITEM_KIND
};
using SCREEN_UPDATER = std::function<void( EDA_ITEM* )>;
class SHEET_SYNCHRONIZATION_ITEM
{
public:
@ -60,6 +61,7 @@ public:
virtual SHEET_SYNCHRONIZATION_ITEM_KIND GetKind() const = 0;
};
class SCH_HIERLABEL_SYNCHRONIZATION_ITEM : public SHEET_SYNCHRONIZATION_ITEM
{
public:

View File

@ -39,9 +39,11 @@ extern wxString getElectricalTypeLabel( LABEL_FLAG_SHAPE aType );
SHEET_SYNCHRONIZATION_MODEL::SHEET_SYNCHRONIZATION_MODEL( SHEET_SYNCHRONIZATION_AGENT& aAgent,
SCH_SHEET* aSheet,
SCH_SHEET_PATH aPath ) :
SCH_SHEET_PATH& aPath ) :
m_selectedIndex( std::optional<unsigned>() ),
m_agent( aAgent ), m_sheet( aSheet ), m_path( std::move( aPath ) )
m_agent( aAgent ),
m_sheet( aSheet ),
m_path( std::move( aPath ) )
{
}
@ -56,7 +58,9 @@ void SHEET_SYNCHRONIZATION_MODEL::GetValueByRow( wxVariant& aVariant, unsigned r
switch( col )
{
case NAME: aVariant << wxDataViewIconText( item->GetName(), item->GetBitmap() ); break;
case NAME:
aVariant << wxDataViewIconText( item->GetName(), item->GetBitmap() );
break;
case SHAPE:
aVariant = getElectricalTypeLabel( static_cast<LABEL_FLAG_SHAPE>( item->GetShape() ) );
break;
@ -139,7 +143,9 @@ SHEET_SYNCHRONIZATION_MODEL::TakeItems( wxDataViewItemArray const& aItems )
for( unsigned i = 0; i < m_items.size(); i++ )
{
if( rowsToBeRemove.find( i ) == rowsToBeRemove.end() )
{
items_remain.push_back( m_items[i] );
}
else
{
items_token.push_back( m_items[i] );

View File

@ -40,6 +40,7 @@ class SHEET_SYNCHRONIZATION_NOTIFIER;
class SHEET_SYNCHRONIZATION_AGENT;
class SCH_SHEET;
class SCH_SHEET_PATH;
class SHEET_SYNCHRONIZATION_MODEL : public wxDataViewVirtualListModel
{
public:
@ -70,7 +71,7 @@ public:
SHEET_SYNCHRONIZATION_MODEL( SHEET_SYNCHRONIZATION_AGENT& aAgent, SCH_SHEET* aSheet,
SCH_SHEET_PATH aPath );
SCH_SHEET_PATH& aPath );
~SHEET_SYNCHRONIZATION_MODEL() override;
void GetValueByRow( wxVariant& variant, unsigned row, unsigned col ) const override;
@ -82,12 +83,12 @@ public:
void RemoveItems( wxDataViewItemArray const& aItems );
/**
* @brief Add a new item, the notifiers are notified
* Add a new item, the notifiers are notified.
*/
bool AppendNewItem( std::shared_ptr<SHEET_SYNCHRONIZATION_ITEM> aItem );
/**
* @brief Just append item to the list, the notifiers are not notified
* Just append item to the list, the notifiers are not notified.
*/
bool AppendItem( std::shared_ptr<SHEET_SYNCHRONIZATION_ITEM> aItem );

View File

@ -46,6 +46,7 @@ bool SHEET_FILE_CHANGE_NOTIFIER::ShouldIgnore() const
return false;
}
void SHEET_FILE_CHANGE_NOTIFIER::Sync()
{
m_panel->UpdateForms();

View File

@ -28,6 +28,7 @@
class SHEET_SYNCHRONIZATION_MODEL;
class PANEL_SYNC_SHEET_PINS;
class SHEET_SYNCHRONIZATION_NOTIFIER
{
public:
@ -55,7 +56,7 @@ private:
/**
* @brief Used to sync the modifications between the mutiple instances of a sheet file
* Used to sync the modifications between the mutiple instances of a sheet file.
*
*/
class SHEET_FILE_CHANGE_NOTIFIER : public SHEET_SYNCHRONIZATION_NOTIFIER

View File

@ -504,30 +504,28 @@ TOOL_ACTION EE_ACTIONS::drawSheet( TOOL_ACTION_ARGS()
.Parameter( SCH_SHEET_T ) );
TOOL_ACTION EE_ACTIONS::placeSheetPin( TOOL_ACTION_ARGS()
.Name( "eeschema.InteractiveDrawing.placeSheetPin" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "Add Sheet Pin" ) )
.Tooltip( _( "Add sheet pins" ) )
.Icon( BITMAPS::add_hierar_pin )
.Flags( AF_ACTIVATE ) );
.Name( "eeschema.InteractiveDrawing.placeSheetPin" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "Add Sheet Pin" ) )
.Tooltip( _( "Add sheet pins" ) )
.Icon( BITMAPS::add_hierar_pin )
.Flags( AF_ACTIVATE ) );
TOOL_ACTION EE_ACTIONS::syncSheetPins(
TOOL_ACTION_ARGS()
.Name( "eeschema.InteractiveDrawing.syncSheetPins" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "Sync Sheet Pins" ) )
.Tooltip( _( "Synchronize sheet pins and hierarchical labels”" ) )
.Icon( BITMAPS::import_hierarchical_label )
.Flags( AF_ACTIVATE ) );
TOOL_ACTION EE_ACTIONS::syncSheetPins( TOOL_ACTION_ARGS()
.Name( "eeschema.InteractiveDrawing.syncSheetPins" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "Sync Sheet Pins" ) )
.Tooltip( _( "Synchronize sheet pins and hierarchical labels”" ) )
.Icon( BITMAPS::import_hierarchical_label )
.Flags( AF_ACTIVATE ) );
TOOL_ACTION EE_ACTIONS::syncAllSheetsPins(
TOOL_ACTION_ARGS()
.Name( "eeschema.InteractiveDrawing.syncAllSheetsPins" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "Sync Sheet Pins" ) )
.Tooltip( _( "Synchronize sheet pins and hierarchical labels”" ) )
.Icon( BITMAPS::import_hierarchical_label )
.Flags( AF_ACTIVATE ) );
TOOL_ACTION EE_ACTIONS::syncAllSheetsPins( TOOL_ACTION_ARGS()
.Name( "eeschema.InteractiveDrawing.syncAllSheetsPins" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "Sync Sheet Pins" ) )
.Tooltip( _( "Synchronize sheet pins and hierarchical labels”" ) )
.Icon( BITMAPS::import_hierarchical_label )
.Flags( AF_ACTIVATE ) );
TOOL_ACTION EE_ACTIONS::placeGlobalLabel( TOOL_ACTION_ARGS()
.Name( "eeschema.InteractiveDrawing.placeGlobalLabel" )

View File

@ -1584,6 +1584,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
else
{
item = createNewSheetPin( sheet, cursorPos );
if( m_dialogSyncSheetPin && m_dialogSyncSheetPin->GetPlacementTemplate() )
{
auto label = static_cast<SCH_HIERLABEL*>(
@ -1746,7 +1747,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
if( m_dialogSyncSheetPin && m_dialogSyncSheetPin->GetPlacementTemplate() )
{
m_dialogSyncSheetPin->EndPlaceItem( nullptr );
m_dialogSyncSheetPin->Show(true);
m_dialogSyncSheetPin->Show( true );
}
return 0;
@ -2562,7 +2563,7 @@ int SCH_DRAWING_TOOLS::SyncSheetsPins( const TOOL_EVENT& aEvent )
{
VECTOR2I cursorPos = getViewControls()->GetMousePosition();
if( EDA_ITEM* i = nullptr; static_cast<void>(m_selectionTool->SelectPoint( cursorPos, { SCH_SHEET_T }, &i )) , i != nullptr )
if( EDA_ITEM* i = nullptr; static_cast<void>(m_selectionTool->SelectPoint( cursorPos, { SCH_SHEET_T }, &i ) ) , i != nullptr )
{
sheet = dynamic_cast<SCH_SHEET*>( i );
}
@ -2591,23 +2592,23 @@ int SCH_DRAWING_TOOLS::SyncAllSheetsPins( const TOOL_EVENT& aEvent )
std::vector<SCH_ITEM*> sheetChildren;
aScene->GetSheets( &sheetChildren );
aVisited.insert(aScene);
aVisited.insert( aScene );
for( SCH_ITEM* child : sheetChildren)
for( SCH_ITEM* child : sheetChildren )
{
SCH_SHEET_PATH cp = aCurPath;
SCH_SHEET* sheet = static_cast<SCH_SHEET*>( child );
cp.push_back(sheet);
cp.push_back( sheet );
aPaths.push_back( cp );
getSheetChildren(aPaths , sheet->GetScreen() , aVisited ,cp);
getSheetChildren( aPaths, sheet->GetScreen(), aVisited, cp );
}
};
std::list<SCH_SHEET_PATH> sheetPaths;
std::set<SCH_SCREEN*> visited;
SCH_SHEET_PATH current;
current.push_back(&m_frame->Schematic().Root());
getSheetChildren(sheetPaths , m_frame->Schematic().Root().GetScreen() ,visited ,current );
current.push_back( &m_frame->Schematic().Root() );
getSheetChildren( sheetPaths, m_frame->Schematic().Root().GetScreen(), visited, current );
return doSyncSheetsPins( sheetPaths );
}