From 564826feae50ee09b83ec1405f9e1445210d2300 Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Thu, 3 Jun 2021 21:11:08 -0400 Subject: [PATCH] Use wxRect in dialog_shim rather than eda_rect for purely gui logic --- common/dialog_shim.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/common/dialog_shim.cpp b/common/dialog_shim.cpp index d3690124d4..a64ea7f99f 100644 --- a/common/dialog_shim.cpp +++ b/common/dialog_shim.cpp @@ -23,7 +23,6 @@ */ #include -#include #include #include #include @@ -182,7 +181,7 @@ int DIALOG_SHIM::vertPixelsFromDU( int y ) const #include #include -static RECT_MAP class_map; +static std::unordered_map class_map; void DIALOG_SHIM::SetPosition( const wxPoint& aNewPosition ) @@ -202,13 +201,13 @@ void DIALOG_SHIM::SetPosition( const wxPoint& aNewPosition ) hash_key = typeid(*this).name(); } - RECT_MAP::iterator it = class_map.find( hash_key ); + std::unordered_map::iterator it = class_map.find( hash_key ); if( it == class_map.end() ) return; - EDA_RECT rect = it->second; - rect.SetOrigin( aNewPosition ); + wxRect rect = it->second; + rect.SetPosition( aNewPosition ); class_map[ hash_key ] = rect; } @@ -239,7 +238,7 @@ bool DIALOG_SHIM::Show( bool show ) ret = wxDialog::Show( show ); // classname is key, returns a zeroed out default EDA_RECT if none existed before. - EDA_RECT savedDialogRect = class_map[ hash_key ]; + wxRect savedDialogRect = class_map[ hash_key ]; if( savedDialogRect.GetSize().x != 0 && savedDialogRect.GetSize().y != 0 ) { @@ -266,7 +265,7 @@ bool DIALOG_SHIM::Show( bool show ) else { // Save the dialog's position & size before hiding, using classname as key - class_map[ hash_key ] = EDA_RECT( wxDialog::GetPosition(), wxDialog::GetSize() ); + class_map[ hash_key ] = wxRect( wxDialog::GetPosition(), wxDialog::GetSize() ); #ifdef __WXMAC__ if ( m_eventLoop ) @@ -294,13 +293,13 @@ void DIALOG_SHIM::resetSize() hash_key = typeid(*this).name(); } - RECT_MAP::iterator it = class_map.find( hash_key ); + std::unordered_map::iterator it = class_map.find( hash_key ); if( it == class_map.end() ) return; - EDA_RECT rect = it->second; - rect.SetSize( 0, 0 ); + wxRect rect = it->second; + rect.SetSize( wxSize( 0, 0 ) ); class_map[ hash_key ] = rect; }