Remove vestiges of old zoom-auto architecture.

Fixes https://gitlab.com/kicad/code/kicad/issues/9055
This commit is contained in:
Jeff Young 2021-09-19 17:31:10 +01:00
parent c088de5f75
commit 3651d7c5e7
14 changed files with 14 additions and 117 deletions

View File

@ -31,7 +31,6 @@ const int cvpcbSchemaVersion = 0;
CVPCB_SETTINGS::CVPCB_SETTINGS() : CVPCB_SETTINGS::CVPCB_SETTINGS() :
APP_SETTINGS_BASE( "cvpcb", cvpcbSchemaVersion ), APP_SETTINGS_BASE( "cvpcb", cvpcbSchemaVersion ),
m_FootprintViewerAutoZoom( false ),
m_FootprintViewerZoom( 1.0 ), m_FootprintViewerZoom( 1.0 ),
m_FilterFootprint( 0 ), m_FilterFootprint( 0 ),
m_LibrariesWidth( 0 ), m_LibrariesWidth( 0 ),
@ -62,9 +61,6 @@ CVPCB_SETTINGS::CVPCB_SETTINGS() :
m_params.emplace_back( new PARAM<bool>( "footprint_viewer.graphic_items_fill", m_params.emplace_back( new PARAM<bool>( "footprint_viewer.graphic_items_fill",
&m_FootprintViewerDisplayOptions.m_DisplayGraphicsFill, true ) ); &m_FootprintViewerDisplayOptions.m_DisplayGraphicsFill, true ) );
m_params.emplace_back( new PARAM<bool>( "footprint_viewer.auto_zoom",
&m_FootprintViewerAutoZoom, false ) );
m_params.emplace_back( new PARAM<double>( "footprint_viewer.zoom", m_params.emplace_back( new PARAM<double>( "footprint_viewer.zoom",
&m_FootprintViewerZoom, 1.0 ) ); &m_FootprintViewerZoom, 1.0 ) );

View File

@ -43,8 +43,6 @@ public:
MAGNETIC_SETTINGS m_FootprintViewerMagneticSettings; MAGNETIC_SETTINGS m_FootprintViewerMagneticSettings;
bool m_FootprintViewerAutoZoom;
double m_FootprintViewerZoom; double m_FootprintViewerZoom;
int m_FilterFootprint; int m_FilterFootprint;

View File

@ -212,13 +212,6 @@ void DISPLAY_FOOTPRINTS_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) ); mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
auto autoZoomCond =
[this] ( const SELECTION& aSel )
{
return GetAutoZoom();
};
mgr->SetConditions( PCB_ACTIONS::zoomFootprintAutomatically, CHECK( autoZoomCond ) );
mgr->SetConditions( PCB_ACTIONS::showPadNumbers, mgr->SetConditions( PCB_ACTIONS::showPadNumbers,
CHECK( cond.PadNumbersDisplay() ) ); CHECK( cond.PadNumbersDisplay() ) );
mgr->SetConditions( PCB_ACTIONS::padDisplayMode, CHECK( !cond.PadFillDisplay() ) ); mgr->SetConditions( PCB_ACTIONS::padDisplayMode, CHECK( !cond.PadFillDisplay() ) );
@ -301,9 +294,7 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar()
m_mainToolBar->Add( ACTIONS::zoomInCenter ); m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter ); m_mainToolBar->Add( ACTIONS::zoomOutCenter );
m_mainToolBar->Add( ACTIONS::zoomFitScreen ); m_mainToolBar->Add( ACTIONS::zoomFitScreen );
m_mainToolBar->Add( ACTIONS::zoomTool, m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE, ACTION_TOOLBAR::CANCEL );
ACTION_TOOLBAR::TOGGLE, ACTION_TOOLBAR::CANCEL );
m_mainToolBar->Add( PCB_ACTIONS::zoomFootprintAutomatically, ACTION_TOOLBAR::TOGGLE );
m_mainToolBar->AddScaledSeparator( this ); m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::show3DViewer ); m_mainToolBar->Add( ACTIONS::show3DViewer );
@ -515,7 +506,7 @@ void DISPLAY_FOOTPRINTS_FRAME::updateView()
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD ); m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
if( GetAutoZoom() ) if( m_zoomSelectBox->GetSelection() == 0 )
m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); m_toolManager->RunAction( ACTIONS::zoomFitScreen, true );
else else
m_toolManager->RunAction( ACTIONS::centerContents, true ); m_toolManager->RunAction( ACTIONS::centerContents, true );
@ -553,22 +544,6 @@ BOARD_ITEM_CONTAINER* DISPLAY_FOOTPRINTS_FRAME::GetModel() const
} }
void DISPLAY_FOOTPRINTS_FRAME::SetAutoZoom( bool aAutoZoom )
{
CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( config() );
wxCHECK( cfg, /* void */ );
cfg->m_FootprintViewerAutoZoom = aAutoZoom;
}
bool DISPLAY_FOOTPRINTS_FRAME::GetAutoZoom()
{
CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( config() );
wxCHECK( cfg, false );
return cfg->m_FootprintViewerAutoZoom;
}
SELECTION& DISPLAY_FOOTPRINTS_FRAME::GetCurrentSelection() SELECTION& DISPLAY_FOOTPRINTS_FRAME::GetCurrentSelection()
{ {
return m_toolManager->GetTool<CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL>()->GetSelection(); return m_toolManager->GetTool<CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL>()->GetSelection();

View File

@ -108,20 +108,6 @@ public:
// currently: do nothing in CvPcb. // currently: do nothing in CvPcb.
} }
/**
* Set if the canvas should automatically zoom to the footprint on load.
*
* @param aAutoZoom is true if it should automatically zoom
*/
void SetAutoZoom( bool aAutoZoom ) override;
/**
* Get if the canvas should automatically zoom to the footprint on load.
*
* @return true if it should automatically zoom
*/
bool GetAutoZoom() override;
SELECTION& GetCurrentSelection() override; SELECTION& GetCurrentSelection() override;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()

View File

@ -378,16 +378,6 @@ public:
virtual void ActivateGalCanvas() override; virtual void ActivateGalCanvas() override;
/**
* Does nothing. Should be overridden in derived classes which support autozoom.
*/
virtual void SetAutoZoom( bool aAutoZoom ) {}
/**
* Always returns false. Should be overridden in derived classes which support autozoom.
*/
virtual bool GetAutoZoom() { return false; }
protected: protected:
bool canCloseWindow( wxCloseEvent& aCloseEvent ) override; bool canCloseWindow( wxCloseEvent& aCloseEvent ) override;

View File

@ -58,6 +58,7 @@
#include <wx/listbox.h> #include <wx/listbox.h>
#include <wx/srchctrl.h> #include <wx/srchctrl.h>
#include <wx/tokenzr.h> #include <wx/tokenzr.h>
#include <wx/choice.h>
using namespace std::placeholders; using namespace std::placeholders;
@ -336,14 +337,6 @@ void FOOTPRINT_VIEWER_FRAME::setupUIConditions()
mgr->SetConditions( PCB_ACTIONS::textOutlines, CHECK( !cond.TextFillDisplay() ) ); mgr->SetConditions( PCB_ACTIONS::textOutlines, CHECK( !cond.TextFillDisplay() ) );
mgr->SetConditions( PCB_ACTIONS::graphicsOutlines, CHECK( !cond.GraphicsFillDisplay() ) ); mgr->SetConditions( PCB_ACTIONS::graphicsOutlines, CHECK( !cond.GraphicsFillDisplay() ) );
auto autoZoomCond =
[this] ( const SELECTION& )
{
return GetAutoZoom();
};
mgr->SetConditions( PCB_ACTIONS::zoomFootprintAutomatically, CHECK( autoZoomCond ) );
#undef ENABLE #undef ENABLE
#undef CHECK #undef CHECK
} }
@ -813,24 +806,6 @@ COLOR_SETTINGS* FOOTPRINT_VIEWER_FRAME::GetColorSettings() const
} }
bool FOOTPRINT_VIEWER_FRAME::GetAutoZoom()
{
// It is stored in pcbnew's settings
PCBNEW_SETTINGS* cfg = GetPcbNewSettings();
wxCHECK( cfg, false );
return cfg->m_FootprintViewerAutoZoom;
}
void FOOTPRINT_VIEWER_FRAME::SetAutoZoom( bool aAutoZoom )
{
// It is stored in pcbnew's settings
PCBNEW_SETTINGS* cfg = GetPcbNewSettings();
wxASSERT( cfg );
cfg->m_FootprintViewerAutoZoom = aAutoZoom;
}
void FOOTPRINT_VIEWER_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) void FOOTPRINT_VIEWER_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
{ {
PCB_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged ); PCB_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
@ -1064,7 +1039,7 @@ void FOOTPRINT_VIEWER_FRAME::updateView()
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD ); m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
if( GetAutoZoom() ) if( m_zoomSelectBox->GetSelection() == 0 )
m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); m_toolManager->RunAction( ACTIONS::zoomFitScreen, true );
else else
m_toolManager->RunAction( ACTIONS::centerContents, true ); m_toolManager->RunAction( ACTIONS::centerContents, true );

View File

@ -54,9 +54,6 @@ public:
virtual COLOR4D GetGridColor() override; virtual COLOR4D GetGridColor() override;
bool GetAutoZoom() override;
void SetAutoZoom( bool aAutoZoom ) override;
MAGNETIC_SETTINGS* GetMagneticItemsSettings() override MAGNETIC_SETTINGS* GetMagneticItemsSettings() override
{ {
return &m_magneticItems; return &m_magneticItems;

View File

@ -75,7 +75,6 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
m_AutoRefillZones( true ), m_AutoRefillZones( true ),
m_AllowFreePads( false ), m_AllowFreePads( false ),
m_PnsSettings( nullptr ), m_PnsSettings( nullptr ),
m_FootprintViewerAutoZoom( false ),
m_FootprintViewerZoom( 1.0 ) m_FootprintViewerZoom( 1.0 )
{ {
m_MagneticItems.pads = MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL; m_MagneticItems.pads = MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL;
@ -502,9 +501,6 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
addParamsForWindow( &m_FootprintViewer, "footprint_viewer" ); addParamsForWindow( &m_FootprintViewer, "footprint_viewer" );
m_params.emplace_back( new PARAM<bool>( "footprint_viewer.auto_zoom",
&m_FootprintViewerAutoZoom, false ) );
m_params.emplace_back( new PARAM<double>( "footprint_viewer.zoom", m_params.emplace_back( new PARAM<double>( "footprint_viewer.zoom",
&m_FootprintViewerZoom, 1.0 ) ); &m_FootprintViewerZoom, 1.0 ) );

View File

@ -296,9 +296,7 @@ public:
std::unique_ptr<PNS::ROUTING_SETTINGS> m_PnsSettings; std::unique_ptr<PNS::ROUTING_SETTINGS> m_PnsSettings;
bool m_FootprintViewerAutoZoom; ///< Should the footprint viewer auto zoom on select double m_FootprintViewerZoom; ///< The last zoom level used (0 for auto)
double m_FootprintViewerZoom; ///< The last zoom level in the footprint viewer
wxString m_lastFootprintLibDir; wxString m_lastFootprintLibDir;

View File

@ -68,9 +68,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar()
m_mainToolBar->Add( ACTIONS::zoomInCenter ); m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter ); m_mainToolBar->Add( ACTIONS::zoomOutCenter );
m_mainToolBar->Add( ACTIONS::zoomFitScreen ); m_mainToolBar->Add( ACTIONS::zoomFitScreen );
m_mainToolBar->Add( ACTIONS::zoomTool, m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE, ACTION_TOOLBAR::CANCEL );
ACTION_TOOLBAR::TOGGLE, ACTION_TOOLBAR::CANCEL );
m_mainToolBar->Add( PCB_ACTIONS::zoomFootprintAutomatically, ACTION_TOOLBAR::TOGGLE );
m_mainToolBar->AddScaledSeparator( this ); m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::show3DViewer ); m_mainToolBar->Add( ACTIONS::show3DViewer );
@ -82,8 +80,10 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar()
// Grid selection choice box. // Grid selection choice box.
if( m_gridSelectBox == nullptr ) if( m_gridSelectBox == nullptr )
m_gridSelectBox = new wxChoice( m_mainToolBar, ID_ON_GRID_SELECT, {
wxDefaultPosition, wxDefaultSize, 0, nullptr ); m_gridSelectBox = new wxChoice( m_mainToolBar, ID_ON_GRID_SELECT, wxDefaultPosition,
wxDefaultSize, 0, nullptr );
}
UpdateGridSelectBox(); UpdateGridSelectBox();
m_mainToolBar->AddControl( m_gridSelectBox ); m_mainToolBar->AddControl( m_gridSelectBox );
@ -92,8 +92,10 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar()
// Zoom selection choice box. // Zoom selection choice box.
if( m_zoomSelectBox == nullptr ) if( m_zoomSelectBox == nullptr )
m_zoomSelectBox = new wxChoice( m_mainToolBar, ID_ON_ZOOM_SELECT, {
wxDefaultPosition, wxDefaultSize, 0, nullptr ); m_zoomSelectBox = new wxChoice( m_mainToolBar, ID_ON_ZOOM_SELECT, wxDefaultPosition,
wxDefaultSize, 0, nullptr );
}
UpdateZoomSelectBox(); UpdateZoomSelectBox();
m_mainToolBar->AddControl( m_zoomSelectBox ); m_mainToolBar->AddControl( m_zoomSelectBox );

View File

@ -824,11 +824,6 @@ TOOL_ACTION PCB_ACTIONS::showPadNumbers( "pcbnew.Control.showPadNumbers",
_( "Show pad numbers" ), _( "Show pad numbers" ), _( "Show pad numbers" ), _( "Show pad numbers" ),
BITMAPS::pad_number ); BITMAPS::pad_number );
TOOL_ACTION PCB_ACTIONS::zoomFootprintAutomatically( "pcbnew.Control.zoomFootprintAutomatically",
AS_GLOBAL, 0, "",
_( "Automatically zoom to fit" ), _( "Zoom to fit when changing footprint" ),
BITMAPS::zoom_auto_fit_in_page );
TOOL_ACTION PCB_ACTIONS::zoneDisplayFilled( "pcbnew.Control.zoneDisplayEnable", TOOL_ACTION PCB_ACTIONS::zoneDisplayFilled( "pcbnew.Control.zoneDisplayEnable",
AS_GLOBAL, 0, "", AS_GLOBAL, 0, "",
_( "Draw Zone Fills" ), _( "Show filled areas of zones" ), _( "Draw Zone Fills" ), _( "Show filled areas of zones" ),

View File

@ -246,7 +246,6 @@ public:
static TOOL_ACTION zoneDisplayTriangulated; static TOOL_ACTION zoneDisplayTriangulated;
static TOOL_ACTION zoneDisplayToggle; static TOOL_ACTION zoneDisplayToggle;
static TOOL_ACTION showPadNumbers; static TOOL_ACTION showPadNumbers;
static TOOL_ACTION zoomFootprintAutomatically;
// Layer control // Layer control
static TOOL_ACTION layerTop; static TOOL_ACTION layerTop;

View File

@ -85,14 +85,6 @@ template<class T> void Flip( T& aValue )
} }
int PCB_VIEWER_TOOLS::ZoomAutomatically( const TOOL_EVENT& aEvent )
{
frame()->SetAutoZoom( !frame()->GetAutoZoom() );
return 0;
}
int PCB_VIEWER_TOOLS::ShowPadNumbers( const TOOL_EVENT& aEvent ) int PCB_VIEWER_TOOLS::ShowPadNumbers( const TOOL_EVENT& aEvent )
{ {
auto opts = displayOptions(); auto opts = displayOptions();
@ -347,7 +339,6 @@ void PCB_VIEWER_TOOLS::setTransitions()
Go( &PCB_VIEWER_TOOLS::PadDisplayMode, PCB_ACTIONS::padDisplayMode.MakeEvent() ); Go( &PCB_VIEWER_TOOLS::PadDisplayMode, PCB_ACTIONS::padDisplayMode.MakeEvent() );
Go( &PCB_VIEWER_TOOLS::GraphicOutlines, PCB_ACTIONS::graphicsOutlines.MakeEvent() ); Go( &PCB_VIEWER_TOOLS::GraphicOutlines, PCB_ACTIONS::graphicsOutlines.MakeEvent() );
Go( &PCB_VIEWER_TOOLS::TextOutlines, PCB_ACTIONS::textOutlines.MakeEvent() ); Go( &PCB_VIEWER_TOOLS::TextOutlines, PCB_ACTIONS::textOutlines.MakeEvent() );
Go( &PCB_VIEWER_TOOLS::ZoomAutomatically, PCB_ACTIONS::zoomFootprintAutomatically.MakeEvent() );
Go( &PCB_VIEWER_TOOLS::MeasureTool, ACTIONS::measureTool.MakeEvent() ); Go( &PCB_VIEWER_TOOLS::MeasureTool, ACTIONS::measureTool.MakeEvent() );
} }

View File

@ -58,7 +58,6 @@ public:
int PadDisplayMode( const TOOL_EVENT& aEvent ); int PadDisplayMode( const TOOL_EVENT& aEvent );
int GraphicOutlines( const TOOL_EVENT& aEvent ); int GraphicOutlines( const TOOL_EVENT& aEvent );
int TextOutlines( const TOOL_EVENT& aEvent ); int TextOutlines( const TOOL_EVENT& aEvent );
int ZoomAutomatically( const TOOL_EVENT& aEvent );
/// Show the 3D viewer /// Show the 3D viewer
int Show3DViewer( const TOOL_EVENT& aEvent ); int Show3DViewer( const TOOL_EVENT& aEvent );