Hierarchy navigation: keep the last used zoom level in a sheet when go back to this sheet.
Fixes #7107 https://gitlab.com/kicad/code/kicad/issues/7107
This commit is contained in:
parent
68efdb2fff
commit
e10025db64
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -250,6 +250,10 @@ void HIERARCHY_NAVIG_DLG::onSelectSheetPath( wxTreeEvent& event )
|
||||||
wxTreeItemId itemSel = m_Tree->GetSelection();
|
wxTreeItemId itemSel = m_Tree->GetSelection();
|
||||||
TreeItemData* itemData = static_cast<TreeItemData*>( m_Tree->GetItemData( itemSel ) );
|
TreeItemData* itemData = static_cast<TreeItemData*>( m_Tree->GetItemData( itemSel ) );
|
||||||
|
|
||||||
|
// Store the current zoom level into the current screen before switching
|
||||||
|
m_SchFrameEditor->GetScreen()->m_LastZoomLevel =
|
||||||
|
m_SchFrameEditor->GetCanvas()->GetView()->GetScale();
|
||||||
|
|
||||||
m_SchFrameEditor->SetCurrentSheet( itemData->m_SheetPath );
|
m_SchFrameEditor->SetCurrentSheet( itemData->m_SheetPath );
|
||||||
m_SchFrameEditor->DisplayCurrentSheet();
|
m_SchFrameEditor->DisplayCurrentSheet();
|
||||||
|
|
||||||
|
@ -286,7 +290,6 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
|
||||||
{
|
{
|
||||||
m_toolManager->RunAction( ACTIONS::cancelInteractive, true );
|
m_toolManager->RunAction( ACTIONS::cancelInteractive, true );
|
||||||
m_toolManager->RunAction( EE_ACTIONS::clearSelection, true );
|
m_toolManager->RunAction( EE_ACTIONS::clearSelection, true );
|
||||||
|
|
||||||
SCH_SCREEN* screen = GetCurrentSheet().LastScreen();
|
SCH_SCREEN* screen = GetCurrentSheet().LastScreen();
|
||||||
|
|
||||||
wxASSERT( screen );
|
wxASSERT( screen );
|
||||||
|
@ -304,7 +307,8 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// RedrawScreen() will set zoom to last used
|
// Set zoom to last used in this screen
|
||||||
|
GetCanvas()->GetView()->SetScale( GetScreen()->m_LastZoomLevel );
|
||||||
RedrawScreen( (wxPoint) GetScreen()->m_ScrollCenter, false );
|
RedrawScreen( (wxPoint) GetScreen()->m_ScrollCenter, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -69,8 +69,8 @@ SCH_SCREEN::SCH_SCREEN( EDA_ITEM* aParent ) :
|
||||||
m_paper( wxT( "A4" ) )
|
m_paper( wxT( "A4" ) )
|
||||||
{
|
{
|
||||||
m_modification_sync = 0;
|
m_modification_sync = 0;
|
||||||
|
|
||||||
m_refCount = 0;
|
m_refCount = 0;
|
||||||
|
m_LastZoomLevel = 1.0;
|
||||||
|
|
||||||
// Suitable for schematic only. For symbol_editor and viewlib, must be set to true
|
// Suitable for schematic only. For symbol_editor and viewlib, must be set to true
|
||||||
m_Center = false;
|
m_Center = false;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||||
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -507,6 +507,12 @@ public:
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
void Show( int nestLevel, std::ostream& os ) const override;
|
void Show( int nestLevel, std::ostream& os ) const override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* last value for the zoom level, usefull in Eeschema when changing the current displayed
|
||||||
|
* sheet to reuse the same zoom level when back to the sheet using this screen
|
||||||
|
*/
|
||||||
|
double m_LastZoomLevel;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019 CERN
|
* Copyright (C) 2019 CERN
|
||||||
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -1692,6 +1692,9 @@ int SCH_EDITOR_CONTROL::EnterSheet( const TOOL_EVENT& aEvent )
|
||||||
m_toolMgr->RunAction( ACTIONS::cancelInteractive, true );
|
m_toolMgr->RunAction( ACTIONS::cancelInteractive, true );
|
||||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||||
|
|
||||||
|
// Store the current zoom level into the current screen before switching
|
||||||
|
m_frame->GetScreen()->m_LastZoomLevel = m_frame->GetCanvas()->GetView()->GetScale();
|
||||||
|
|
||||||
m_frame->GetCurrentSheet().push_back( sheet );
|
m_frame->GetCurrentSheet().push_back( sheet );
|
||||||
m_frame->DisplayCurrentSheet();
|
m_frame->DisplayCurrentSheet();
|
||||||
m_frame->UpdateHierarchyNavigator();
|
m_frame->UpdateHierarchyNavigator();
|
||||||
|
@ -1708,6 +1711,9 @@ int SCH_EDITOR_CONTROL::LeaveSheet( const TOOL_EVENT& aEvent )
|
||||||
m_toolMgr->RunAction( ACTIONS::cancelInteractive, true );
|
m_toolMgr->RunAction( ACTIONS::cancelInteractive, true );
|
||||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||||
|
|
||||||
|
// Store the current zoom level into the current screen before switching
|
||||||
|
m_frame->GetScreen()->m_LastZoomLevel = m_frame->GetCanvas()->GetView()->GetScale();
|
||||||
|
|
||||||
m_frame->GetCurrentSheet().pop_back();
|
m_frame->GetCurrentSheet().pop_back();
|
||||||
m_frame->DisplayCurrentSheet();
|
m_frame->DisplayCurrentSheet();
|
||||||
m_frame->UpdateHierarchyNavigator();
|
m_frame->UpdateHierarchyNavigator();
|
||||||
|
|
Loading…
Reference in New Issue