mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Use action to change current sheet.
That way it gets into the navigation hierarchy, the current zoom gets saved, etc. Fixes https://gitlab.com/kicad/code/kicad/-/issues/20466
This commit is contained in:
parent
c67924ccac
commit
7ba07a3bb0
@ -123,8 +123,8 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString* aPath, const wx
|
||||
{
|
||||
if( *sheetWithSymbolFound != m_frame->GetCurrentSheet() )
|
||||
{
|
||||
m_frame->Schematic().SetCurrentSheet( *sheetWithSymbolFound );
|
||||
m_frame->DisplayCurrentSheet();
|
||||
m_frame->GetToolManager()->RunAction<SCH_SHEET_PATH*>( SCH_ACTIONS::changeSheet,
|
||||
sheetWithSymbolFound );
|
||||
}
|
||||
|
||||
if( crossProbingSettings.center_on_items )
|
||||
|
@ -569,14 +569,8 @@ void DIALOG_ERC::OnERCItemSelected( wxDataViewEvent& aEvent )
|
||||
|
||||
if( !sheet.empty() && sheet != m_parent->GetCurrentSheet() )
|
||||
{
|
||||
m_parent->GetToolManager()->RunAction( ACTIONS::cancelInteractive );
|
||||
m_parent->GetToolManager()->RunAction( SCH_ACTIONS::clearSelection );
|
||||
|
||||
// Store the current zoom level into the current screen before switching
|
||||
m_parent->GetScreen()->m_LastZoomLevel = m_parent->GetCanvas()->GetView()->GetScale();
|
||||
|
||||
m_parent->SetCurrentSheet( sheet );
|
||||
m_parent->DisplayCurrentSheet();
|
||||
m_parent->GetToolManager()->RunAction<SCH_SHEET_PATH*>( SCH_ACTIONS::changeSheet,
|
||||
&sheet );
|
||||
m_parent->RedrawScreen( m_parent->GetScreen()->m_ScrollCenter, false );
|
||||
}
|
||||
|
||||
|
@ -148,17 +148,11 @@ int SCH_EDITOR_CONTROL::Revert( const TOOL_EVENT& aEvent )
|
||||
|
||||
if( m_frame->GetCurrentSheet().Last() != &root )
|
||||
{
|
||||
m_toolMgr->RunAction( ACTIONS::cancelInteractive );
|
||||
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
|
||||
|
||||
// Store the current zoom level into the current screen before switching
|
||||
m_frame->GetScreen()->m_LastZoomLevel = m_frame->GetCanvas()->GetView()->GetScale();
|
||||
|
||||
SCH_SHEET_PATH rootSheetPath;
|
||||
rootSheetPath.push_back( &root );
|
||||
m_frame->SetCurrentSheet( rootSheetPath );
|
||||
m_frame->DisplayCurrentSheet();
|
||||
|
||||
m_frame->GetToolManager()->RunAction<SCH_SHEET_PATH*>( SCH_ACTIONS::changeSheet,
|
||||
&rootSheetPath );
|
||||
wxSafeYield();
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <schematic.h>
|
||||
#include <tools/sch_find_replace_tool.h>
|
||||
#include <sch_sheet_path.h>
|
||||
#include "sch_actions.h"
|
||||
|
||||
|
||||
int SCH_FIND_REPLACE_TOOL::FindAndReplace( const TOOL_EVENT& aEvent )
|
||||
@ -290,11 +291,8 @@ int SCH_FIND_REPLACE_TOOL::FindNext( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
if( m_frame->Schematic().CurrentSheet() != sheet )
|
||||
{
|
||||
// Store the current zoom level into the current screen before switching
|
||||
m_frame->GetScreen()->m_LastZoomLevel = m_frame->GetCanvas()->GetView()->GetScale();
|
||||
|
||||
m_frame->Schematic().SetCurrentSheet( sheet );
|
||||
m_frame->DisplayCurrentSheet();
|
||||
m_frame->GetToolManager()->RunAction<SCH_SHEET_PATH*>( SCH_ACTIONS::changeSheet,
|
||||
&sheet );
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -2540,8 +2540,8 @@ void SCH_SELECTION_TOOL::SyncSelection( const std::optional<SCH_SHEET_PATH>& tar
|
||||
|
||||
if( targetSheetPath && targetSheetPath != editFrame->Schematic().CurrentSheet() )
|
||||
{
|
||||
editFrame->Schematic().SetCurrentSheet( *targetSheetPath );
|
||||
editFrame->DisplayCurrentSheet();
|
||||
SCH_SHEET_PATH path = targetSheetPath.value();
|
||||
m_frame->GetToolManager()->RunAction<SCH_SHEET_PATH*>( SCH_ACTIONS::changeSheet, &path );
|
||||
}
|
||||
|
||||
ClearSelection( items.size() > 0 ? true /*quiet mode*/ : false );
|
||||
|
@ -128,11 +128,10 @@ void SCH_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
|
||||
|
||||
if( allHitsOnSamePage && !selectedHits.empty() )
|
||||
{
|
||||
if( m_frame->GetCurrentSheet() != *selectedHits.front().sheetPath )
|
||||
{
|
||||
m_frame->SetCurrentSheet( *selectedHits.front().sheetPath );
|
||||
m_frame->DisplayCurrentSheet();
|
||||
}
|
||||
SCH_SHEET_PATH* sheet = selectedHits.front().sheetPath;
|
||||
|
||||
if( m_frame->GetCurrentSheet() != *sheet )
|
||||
m_frame->GetToolManager()->RunAction<SCH_SHEET_PATH*>( SCH_ACTIONS::changeSheet, sheet );
|
||||
|
||||
if( selectedItems.size() )
|
||||
m_frame->GetToolManager()->RunAction<EDA_ITEMS*>( SCH_ACTIONS::addItemsToSel, &selectedItems );
|
||||
|
Loading…
x
Reference in New Issue
Block a user