bool DIALOG_SHIM::Show( bool show ) { bool ret; const char* hash_key; if( m_hash_key.size() ) { // a special case like EDA_LIST_DIALOG, which has multiple uses. hash_key = m_hash_key.c_str(); } else { hash_key = typeid(*this).name(); } // Show or hide the window. If hiding, save current position and size. // If showing, use previous position and size. if( show ) { wxDialog::Raise(); // Needed on OS X and some other window managers (i.e. Unity) ret = wxDialog::Show( show ); // classname is key, returns a zeroed out default EDA_RECT if none existed before. EDA_RECT r = class_map[ hash_key ]; if( r.GetSize().x != 0 && r.GetSize().y != 0 ) SetSize( r.GetPosition().x, r.GetPosition().y, r.GetSize().x, r.GetSize().y, 0 ); } else { // Save the dialog's position & size before hiding, using classname as key EDA_RECT r( wxDialog::GetPosition(), wxDialog::GetSize() ); class_map[ hash_key ] = r; ret = wxDialog::Show( show ); } return ret; }