Commit 26b20cad authored by charras's avatar charras
Browse files

Better label dialog editor. Libedit: now, cannot change the component name to...

Better label dialog editor. Libedit: now, cannot change the component name to an existing alias name (eeschema crashes when happens)
parent 07ddb9cb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@
#include "appl_wxstruct.h"


#define BUILD_VERSION wxT("(20090504-unstable)")
#define BUILD_VERSION wxT("(20090513-unstable)")

wxString g_BuildVersion

+15 −4
Original line number Diff line number Diff line
@@ -21,9 +21,8 @@
int DialogLabelEditor::ShowModally(  WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText )
{
    int ret;
    bool multiline = CurrentText->m_MultilineAllowed;

    DialogLabelEditor* dialog = new DialogLabelEditor( parent, CurrentText, multiline );
    DialogLabelEditor* dialog = new DialogLabelEditor( parent, CurrentText );

    // doing any post construction resizing is better done here than in
    // OnInitDialog() since it tends to flash/redraw the dialog less.
@@ -36,11 +35,12 @@ int DialogLabelEditor::ShowModally( WinEDA_SchematicFrame* parent, SCH_TEXT * C



DialogLabelEditor::DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT* CurrentText,bool multiline ) :
    DialogLabelEditor_Base( parent,wxID_ANY,multiline )
DialogLabelEditor::DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT* CurrentText ) :
    DialogLabelEditor_Base( parent )
{
    m_Parent = parent;
    m_CurrentText = CurrentText;
    init();
}


@@ -48,6 +48,17 @@ void DialogLabelEditor::init()
{
    wxString msg;
    
    if( m_CurrentText->m_MultilineAllowed )
    {
        m_TextLabel = m_textCtrlMultiline;
        m_TextLabelSingleline->Show(false);
    }
    else
    {
        m_TextLabel = m_TextLabelSingleline;
       m_textCtrlMultiline->Show(false);
    }

    m_TextLabel->SetValue( m_CurrentText->m_Text );
    m_TextLabel->SetFocus();

+2 −1
Original line number Diff line number Diff line
@@ -15,10 +15,11 @@ class DialogLabelEditor : public DialogLabelEditor_Base
private:
    WinEDA_SchematicFrame * m_Parent;
    SCH_TEXT * m_CurrentText;
    wxTextCtrl* m_TextLabel;

protected:
    // these are protected so that the static ShowModally() gets used.
    DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText, bool multiline);
    DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText);
    ~DialogLabelEditor(){};


+18 −19
Original line number Diff line number Diff line
@@ -9,26 +9,27 @@

///////////////////////////////////////////////////////////////////////////

DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id, bool multiline,const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	
	wxBoxSizer* bMainSizer;
	bMainSizer = new wxBoxSizer( wxHORIZONTAL );
	
	bSizerTextCtrl = new wxBoxSizer( wxVERTICAL );
	bMainSizer = new wxBoxSizer( wxVERTICAL );
	
	m_staticText1 = new wxStaticText( this, wxID_ANY, _("Text"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText1->Wrap( -1 );
	bSizerTextCtrl->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
	bMainSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
	
	m_TextLabelSingleline = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
	m_TextLabelSingleline->SetToolTip( _("Enter the text to be used within the schematic") );
	
	bMainSizer->Add( m_TextLabelSingleline, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
	
	if (multiline)
	  m_TextLabel = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER | wxTE_MULTILINE );
	else
	  m_TextLabel = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
	m_TextLabel->SetToolTip( _("Enter the text to be used within the schematic") );
	m_textCtrlMultiline = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_PROCESS_ENTER );
	m_textCtrlMultiline->SetToolTip( _("Enter the text to be used within the schematic") );
	m_textCtrlMultiline->SetMinSize( wxSize( -1,60 ) );
	
	bSizerTextCtrl->Add( m_TextLabel, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
	bMainSizer->Add( m_textCtrlMultiline, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
	
	wxBoxSizer* m_OptionsSizer;
	m_OptionsSizer = new wxBoxSizer( wxHORIZONTAL );
@@ -51,10 +52,6 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id,
	m_TextShape->SetSelection( 0 );
	m_OptionsSizer->Add( m_TextShape, 1, wxALL, 5 );
	
	bSizerTextCtrl->Add( m_OptionsSizer, 1, wxEXPAND, 5 );
	
	bMainSizer->Add( bSizerTextCtrl, 5, wxEXPAND, 5 );
	
	wxBoxSizer* bSizer4;
	bSizer4 = new wxBoxSizer( wxVERTICAL );
	
@@ -66,7 +63,7 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id,
	bSizer4->Add( m_TextSize, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
	
	
	bSizer4->Add( 8, 8, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
	bSizer4->Add( 8, 8, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
	
	m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
	bSizer4->Add( m_buttonOK, 1, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
@@ -74,13 +71,15 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id,
	m_buttonCANCEL = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
	bSizer4->Add( m_buttonCANCEL, 1, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
	
	bMainSizer->Add( bSizer4, 1, 0, 5 );
	m_OptionsSizer->Add( bSizer4, 1, 0, 5 );
	
	bMainSizer->Add( m_OptionsSizer, 1, wxEXPAND, 5 );
	
	this->SetSizer( bMainSizer );
	this->Layout();
	
	// Connect Events
	m_TextLabel->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::onEnterKey ), NULL, this );
	m_TextLabelSingleline->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::onEnterKey ), NULL, this );
	m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonOKClick ), NULL, this );
	m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonCANCEL_Click ), NULL, this );
}
@@ -88,7 +87,7 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id,
DialogLabelEditor_Base::~DialogLabelEditor_Base()
{
	// Disconnect Events
	m_TextLabel->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::onEnterKey ), NULL, this );
	m_TextLabelSingleline->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::onEnterKey ), NULL, this );
	m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonOKClick ), NULL, this );
	m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonCANCEL_Click ), NULL, this );
}
+334 −290
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@
            <property name="minimum_size"></property>
            <property name="name">DialogLabelEditor_Base</property>
            <property name="pos"></property>
            <property name="size">600,216</property>
            <property name="size">526,281</property>
            <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
            <property name="subclass"></property>
            <property name="title">Text Editor</property>
@@ -73,17 +73,8 @@
            <object class="wxBoxSizer" expanded="1">
                <property name="minimum_size"></property>
                <property name="name">bMainSizer</property>
                <property name="orient">wxHORIZONTAL</property>
                <property name="permission">none</property>
                <object class="sizeritem" expanded="1">
                    <property name="border">5</property>
                    <property name="flag">wxEXPAND</property>
                    <property name="proportion">5</property>
                    <object class="wxBoxSizer" expanded="1">
                        <property name="minimum_size"></property>
                        <property name="name">bSizerTextCtrl</property>
                <property name="orient">wxVERTICAL</property>
                        <property name="permission">protected</property>
                <property name="permission">none</property>
                <object class="sizeritem" expanded="1">
                    <property name="border">5</property>
                    <property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
@@ -150,7 +141,7 @@
                        <property name="maximum_size"></property>
                        <property name="maxlength">0</property>
                        <property name="minimum_size"></property>
                                <property name="name">m_TextLabel</property>
                        <property name="name">m_TextLabelSingleline</property>
                        <property name="permission">protected</property>
                        <property name="pos"></property>
                        <property name="size"></property>
@@ -190,6 +181,61 @@
                        <event name="OnUpdateUI"></event>
                    </object>
                </object>
                <object class="sizeritem" expanded="1">
                    <property name="border">5</property>
                    <property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
                    <property name="proportion">0</property>
                    <object class="wxTextCtrl" expanded="1">
                        <property name="bg"></property>
                        <property name="context_help"></property>
                        <property name="enabled">1</property>
                        <property name="fg"></property>
                        <property name="font"></property>
                        <property name="hidden">0</property>
                        <property name="id">wxID_ANY</property>
                        <property name="maximum_size"></property>
                        <property name="maxlength">0</property>
                        <property name="minimum_size">-1,60</property>
                        <property name="name">m_textCtrlMultiline</property>
                        <property name="permission">protected</property>
                        <property name="pos"></property>
                        <property name="size"></property>
                        <property name="style">wxTE_MULTILINE|wxTE_PROCESS_ENTER</property>
                        <property name="subclass"></property>
                        <property name="tooltip">Enter the text to be used within the schematic</property>
                        <property name="value"></property>
                        <property name="window_extra_style"></property>
                        <property name="window_name"></property>
                        <property name="window_style"></property>
                        <event name="OnChar"></event>
                        <event name="OnEnterWindow"></event>
                        <event name="OnEraseBackground"></event>
                        <event name="OnKeyDown"></event>
                        <event name="OnKeyUp"></event>
                        <event name="OnKillFocus"></event>
                        <event name="OnLeaveWindow"></event>
                        <event name="OnLeftDClick"></event>
                        <event name="OnLeftDown"></event>
                        <event name="OnLeftUp"></event>
                        <event name="OnMiddleDClick"></event>
                        <event name="OnMiddleDown"></event>
                        <event name="OnMiddleUp"></event>
                        <event name="OnMotion"></event>
                        <event name="OnMouseEvents"></event>
                        <event name="OnMouseWheel"></event>
                        <event name="OnPaint"></event>
                        <event name="OnRightDClick"></event>
                        <event name="OnRightDown"></event>
                        <event name="OnRightUp"></event>
                        <event name="OnSetFocus"></event>
                        <event name="OnSize"></event>
                        <event name="OnText"></event>
                        <event name="OnTextEnter"></event>
                        <event name="OnTextMaxLen"></event>
                        <event name="OnTextURL"></event>
                        <event name="OnUpdateUI"></event>
                    </object>
                </object>
                <object class="sizeritem" expanded="1">
                    <property name="border">5</property>
                    <property name="flag">wxEXPAND</property>
@@ -361,10 +407,6 @@
                                <event name="OnUpdateUI"></event>
                            </object>
                        </object>
                            </object>
                        </object>
                    </object>
                </object>
                        <object class="sizeritem" expanded="1">
                            <property name="border">5</property>
                            <property name="flag"></property>
@@ -482,7 +524,7 @@
                                </object>
                                <object class="sizeritem" expanded="1">
                                    <property name="border">5</property>
                            <property name="flag">wxEXPAND|wxALIGN_CENTER_HORIZONTAL</property>
                                    <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxEXPAND</property>
                                    <property name="proportion">0</property>
                                    <object class="spacer" expanded="1">
                                        <property name="height">8</property>
@@ -599,4 +641,6 @@
                    </object>
                </object>
            </object>
        </object>
    </object>
</wxFormBuilder_Project>
Loading