Use wxRect in dialog_shim rather than eda_rect for purely gui logic

This commit is contained in:
Marek Roszko 2021-06-03 21:11:08 -04:00
parent 0c879eead3
commit 564826feae
1 changed files with 9 additions and 10 deletions

View File

@ -23,7 +23,6 @@
*/
#include <dialog_shim.h>
#include <eda_rect.h>
#include <kiway_player.h>
#include <pgm_base.h>
#include <tool/tool_manager.h>
@ -182,7 +181,7 @@ int DIALOG_SHIM::vertPixelsFromDU( int y ) const
#include <hashtables.h>
#include <typeinfo>
static RECT_MAP class_map;
static std::unordered_map<std::string, wxRect> 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<std::string, wxRect>::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<std::string, wxRect>::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;
}