Commit 6aabb9bc authored by Dick Hollenbeck's avatar Dick Hollenbeck
Browse files

EDA_LIST_DIALOG_BASE is used multiple times for different numbers of

columns.  DIALOG_SHIM would resize each separate usage to the same
size.  DIALOG_SHIM now supports and alternate m_hash_key in lieu
of the class name, optionally.
parent 94db11a8
Loading
Loading
Loading
Loading
+13 −3
Original line number Original line Diff line number Diff line
@@ -46,7 +46,17 @@ static RECT_MAP class_map;
bool DIALOG_SHIM::Show( bool show )
bool DIALOG_SHIM::Show( bool show )
{
{
    bool        ret;
    bool        ret;
    const char* classname = typeid(*this).name();
    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.
    // Show or hide the window.  If hiding, save current position and size.
    // If showing, use previous position and size.
    // If showing, use previous position and size.
@@ -55,7 +65,7 @@ bool DIALOG_SHIM::Show( bool show )
        ret = wxDialog::Show( show );
        ret = wxDialog::Show( show );


        // classname is key, returns a zeroed out default EDA_RECT if none existed before.
        // classname is key, returns a zeroed out default EDA_RECT if none existed before.
        EDA_RECT r = class_map[ classname ];
        EDA_RECT r = class_map[ hash_key ];


        if( r.GetSize().x != 0 && r.GetSize().y != 0 )
        if( r.GetSize().x != 0 && r.GetSize().y != 0 )
            SetSize( r.GetPosition().x, r.GetPosition().y, r.GetSize().x, r.GetSize().y, 0 );
            SetSize( r.GetPosition().x, r.GetPosition().y, r.GetSize().x, r.GetSize().y, 0 );
@@ -64,7 +74,7 @@ bool DIALOG_SHIM::Show( bool show )
    {
    {
        // Save the dialog's position & size before hiding, using classname as key
        // Save the dialog's position & size before hiding, using classname as key
        EDA_RECT  r( wxDialog::GetPosition(), wxDialog::GetSize() );
        EDA_RECT  r( wxDialog::GetPosition(), wxDialog::GetSize() );
        class_map[ classname ] = r;
        class_map[ hash_key ] = r;


        ret = wxDialog::Show( show );
        ret = wxDialog::Show( show );
    }
    }
+3 −1
Original line number Original line Diff line number Diff line
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// C++ code generated with wxFormBuilder (version Nov  5 2013)
// http://www.wxformbuilder.org/
// http://www.wxformbuilder.org/
//
//
// PLEASE DO "NOT" EDIT THIS FILE!
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -24,6 +24,7 @@ DIALOG_GET_COMPONENT_BASE::DIALOG_GET_COMPONENT_BASE( wxWindow* parent, wxWindow
	bSizerLeft->Add( m_staticTextName, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
	bSizerLeft->Add( m_staticTextName, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
	
	
	m_textCmpNameCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_textCmpNameCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_textCmpNameCtrl->SetMaxLength( 0 ); 
	bSizerLeft->Add( m_textCmpNameCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
	bSizerLeft->Add( m_textCmpNameCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
	
	
	m_staticTextHistory = new wxStaticText( this, wxID_ANY, _("History list:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticTextHistory = new wxStaticText( this, wxID_ANY, _("History list:"), wxDefaultPosition, wxDefaultSize, 0 );
@@ -63,6 +64,7 @@ DIALOG_GET_COMPONENT_BASE::DIALOG_GET_COMPONENT_BASE( wxWindow* parent, wxWindow
	
	
	this->SetSizer( bSizerMain );
	this->SetSizer( bSizerMain );
	this->Layout();
	this->Layout();
	bSizerMain->Fit( this );
	
	
	this->Centre( wxBOTH );
	this->Centre( wxBOTH );
	
	
+3 −1
Original line number Original line Diff line number Diff line
@@ -20,8 +20,10 @@
        <property name="path">.</property>
        <property name="path">.</property>
        <property name="precompiled_header"></property>
        <property name="precompiled_header"></property>
        <property name="relative_path">1</property>
        <property name="relative_path">1</property>
        <property name="skip_lua_events">1</property>
        <property name="skip_php_events">1</property>
        <property name="skip_php_events">1</property>
        <property name="skip_python_events">1</property>
        <property name="skip_python_events">1</property>
        <property name="ui_table">UI</property>
        <property name="use_enum">0</property>
        <property name="use_enum">0</property>
        <property name="use_microsoft_bom">0</property>
        <property name="use_microsoft_bom">0</property>
        <object class="Dialog" expanded="1">
        <object class="Dialog" expanded="1">
@@ -42,7 +44,7 @@
            <property name="minimum_size"></property>
            <property name="minimum_size"></property>
            <property name="name">DIALOG_GET_COMPONENT_BASE</property>
            <property name="name">DIALOG_GET_COMPONENT_BASE</property>
            <property name="pos"></property>
            <property name="pos"></property>
            <property name="size">375,210</property>
            <property name="size">-1,-1</property>
            <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
            <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
            <property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
            <property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
            <property name="title"></property>
            <property name="title"></property>
+4 −2
Original line number Original line Diff line number Diff line
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// C++ code generated with wxFormBuilder (version Nov  5 2013)
// http://www.wxformbuilder.org/
// http://www.wxformbuilder.org/
//
//
// PLEASE DO "NOT" EDIT THIS FILE!
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -11,6 +11,8 @@
#include <wx/artprov.h>
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/intl.h>
class DIALOG_SHIM;

#include "dialog_shim.h"
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/stattext.h>
@@ -57,7 +59,7 @@ class DIALOG_GET_COMPONENT_BASE : public DIALOG_SHIM
	
	
	public:
	public:
		
		
		DIALOG_GET_COMPONENT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 375,210 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); 
		DIALOG_GET_COMPONENT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); 
		~DIALOG_GET_COMPONENT_BASE();
		~DIALOG_GET_COMPONENT_BASE();
	
	
};
};
+5 −6
Original line number Original line Diff line number Diff line
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct  8 2012)
// C++ code generated with wxFormBuilder (version Nov  5 2013)
// http://www.wxformbuilder.org/
// http://www.wxformbuilder.org/
//
//
// PLEASE DO "NOT" EDIT THIS FILE!
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -29,10 +29,8 @@ EDA_LIST_DIALOG_BASE::EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id, con
	m_staticText2->Wrap( -1 );
	m_staticText2->Wrap( -1 );
	bSizerMain->Add( m_staticText2, 0, wxRIGHT|wxLEFT, 5 );
	bSizerMain->Add( m_staticText2, 0, wxRIGHT|wxLEFT, 5 );
	
	
	m_listBox = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxVSCROLL );
	m_listBox = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL|wxALWAYS_SHOW_SB|wxVSCROLL );
	m_listBox->SetMinSize( wxSize( 300,200 ) );
	bSizerMain->Add( m_listBox, 3, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
	
	bSizerMain->Add( m_listBox, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
	
	
	m_staticTextMsg = new wxStaticText( this, wxID_ANY, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticTextMsg = new wxStaticText( this, wxID_ANY, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticTextMsg->Wrap( -1 );
	m_staticTextMsg->Wrap( -1 );
@@ -41,7 +39,7 @@ EDA_LIST_DIALOG_BASE::EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id, con
	m_messages = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
	m_messages = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
	m_messages->SetMinSize( wxSize( -1,80 ) );
	m_messages->SetMinSize( wxSize( -1,80 ) );
	
	
	bSizerMain->Add( m_messages, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
	bSizerMain->Add( m_messages, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
	
	
	m_sdbSizer = new wxStdDialogButtonSizer();
	m_sdbSizer = new wxStdDialogButtonSizer();
	m_sdbSizerOK = new wxButton( this, wxID_OK );
	m_sdbSizerOK = new wxButton( this, wxID_OK );
@@ -55,6 +53,7 @@ EDA_LIST_DIALOG_BASE::EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id, con
	
	
	this->SetSizer( bSizerMain );
	this->SetSizer( bSizerMain );
	this->Layout();
	this->Layout();
	bSizerMain->Fit( this );
	
	
	this->Centre( wxBOTH );
	this->Centre( wxBOTH );
	
	
Loading