Commit 95316beb authored by charras's avatar charras
Browse files

fixed other issue in dialog edit multiline text

parent 686358d6
Loading
Loading
Loading
Loading
+7 −12
Original line number Original line Diff line number Diff line
@@ -55,20 +55,15 @@ void DialogLabelEditor::InitDialog()


    if( m_CurrentText->m_MultilineAllowed )
    if( m_CurrentText->m_MultilineAllowed )
    {
    {
        /* Multiline text edit control must be created because changing the text
        m_textLabel = m_textLabelMultiLine;
         * control style to multiline must be done when the control is created.
        m_textLabelSingleLine->Show(false);
         */
        m_textControlSizer->Detach( m_textLabel );
        m_textLabel->Destroy();
        m_textLabel = NULL;
        m_textLabel = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition,
                                      wxDefaultSize, wxTE_MULTILINE | wxTE_PROCESS_ENTER );
        m_textLabel->SetToolTip( _("Enter the text to be used within the schematic") );
        m_textLabel->SetMinSize( wxSize( -1, 60 ) );
        m_textControlSizer->Insert( 1, m_textLabel, 0, wxLEFT | wxEXPAND, 3 );
        m_textControlSizer->RecalcSizes();
        multiLine = true;
        multiLine = true;
    }
    }
    else
    {
        m_textLabel = m_textLabelSingleLine;
        m_textLabelMultiLine->Show(false);
    }


    m_textLabel->SetValue( m_CurrentText->m_Text );
    m_textLabel->SetValue( m_CurrentText->m_Text );
    m_textLabel->SetFocus();
    m_textLabel->SetFocus();
+1 −0
Original line number Original line Diff line number Diff line
@@ -15,6 +15,7 @@ class DialogLabelEditor : public DialogLabelEditor_Base
private:
private:
    WinEDA_SchematicFrame* m_Parent;
    WinEDA_SchematicFrame* m_Parent;
    SCH_TEXT*              m_CurrentText;
    SCH_TEXT*              m_CurrentText;
    wxTextCtrl *           m_textLabel;


public:
public:
    DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT* aTextItem );
    DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT* aTextItem );
+19 −6
Original line number Original line Diff line number Diff line
@@ -17,6 +17,8 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id,
	bMainSizer = new wxBoxSizer( wxVERTICAL );
	bMainSizer = new wxBoxSizer( wxVERTICAL );
	
	
	m_textControlSizer = new wxFlexGridSizer( 2, 2, 3, 3 );
	m_textControlSizer = new wxFlexGridSizer( 2, 2, 3, 3 );
	m_textControlSizer->AddGrowableCol( 1 );
	m_textControlSizer->AddGrowableRow( 0 );
	m_textControlSizer->SetFlexibleDirection( wxBOTH );
	m_textControlSizer->SetFlexibleDirection( wxBOTH );
	m_textControlSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	m_textControlSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	
	
@@ -24,10 +26,20 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id,
	m_staticText1->Wrap( -1 );
	m_staticText1->Wrap( -1 );
	m_textControlSizer->Add( m_staticText1, 0, wxRIGHT, 3 );
	m_textControlSizer->Add( m_staticText1, 0, wxRIGHT, 3 );
	
	
	m_textLabel = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
	wxBoxSizer* bSizeText;
	m_textLabel->SetToolTip( _("Enter the text to be used within the schematic") );
	bSizeText = new wxBoxSizer( wxVERTICAL );
	
	
	m_textControlSizer->Add( m_textLabel, 0, wxEXPAND|wxLEFT, 3 );
	m_textLabelSingleLine = new wxTextCtrl( this, wxID_VALUESINGLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
	m_textLabelSingleLine->SetToolTip( _("Enter the text to be used within the schematic") );
	
	bSizeText->Add( m_textLabelSingleLine, 0, wxEXPAND|wxLEFT, 3 );
	
	m_textLabelMultiLine = new wxTextCtrl( this, wxID_VALUEMULTI, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_PROCESS_ENTER );
	m_textLabelMultiLine->SetToolTip( _("Enter the text to be used within the schematic") );
	
	bSizeText->Add( m_textLabelMultiLine, 1, wxEXPAND|wxLEFT, 5 );
	
	m_textControlSizer->Add( bSizeText, 1, wxEXPAND, 5 );
	
	
	m_SizeTitle = new wxStaticText( this, wxID_ANY, _("&Size:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_SizeTitle = new wxStaticText( this, wxID_ANY, _("&Size:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_SizeTitle->Wrap( -1 );
	m_SizeTitle->Wrap( -1 );
@@ -80,10 +92,10 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id,
	
	
	this->SetSizer( bMainSizer );
	this->SetSizer( bMainSizer );
	this->Layout();
	this->Layout();
	bMainSizer->Fit( this );
	
	
	// Connect Events
	// 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_textLabelMultiLine->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::OnEnterKey ), NULL, this );
	m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnCancelClick ), NULL, this );
	m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnCancelClick ), NULL, this );
	m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnOkClick ), NULL, this );
	m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnOkClick ), NULL, this );
}
}
@@ -91,7 +103,8 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id,
DialogLabelEditor_Base::~DialogLabelEditor_Base()
DialogLabelEditor_Base::~DialogLabelEditor_Base()
{
{
	// Disconnect Events
	// 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_textLabelMultiLine->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::OnEnterKey ), NULL, this );
	m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnCancelClick ), NULL, this );
	m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnCancelClick ), NULL, this );
	m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnOkClick ), NULL, this );
	m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnOkClick ), NULL, this );
}
}
+119 −53
Original line number Original line Diff line number Diff line
@@ -32,7 +32,7 @@
            <property name="minimum_size"></property>
            <property name="minimum_size"></property>
            <property name="name">DialogLabelEditor_Base</property>
            <property name="name">DialogLabelEditor_Base</property>
            <property name="pos"></property>
            <property name="pos"></property>
            <property name="size">-1,-1</property>
            <property name="size">359,347</property>
            <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
            <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
            <property name="subclass"></property>
            <property name="subclass"></property>
            <property name="title">Text Editor</property>
            <property name="title">Text Editor</property>
@@ -82,8 +82,8 @@
                    <object class="wxFlexGridSizer" expanded="1">
                    <object class="wxFlexGridSizer" expanded="1">
                        <property name="cols">2</property>
                        <property name="cols">2</property>
                        <property name="flexible_direction">wxBOTH</property>
                        <property name="flexible_direction">wxBOTH</property>
                        <property name="growablecols"></property>
                        <property name="growablecols">1</property>
                        <property name="growablerows"></property>
                        <property name="growablerows">0</property>
                        <property name="hgap">3</property>
                        <property name="hgap">3</property>
                        <property name="minimum_size"></property>
                        <property name="minimum_size"></property>
                        <property name="name">m_textControlSizer</property>
                        <property name="name">m_textControlSizer</property>
@@ -142,6 +142,15 @@
                                <event name="OnUpdateUI"></event>
                                <event name="OnUpdateUI"></event>
                            </object>
                            </object>
                        </object>
                        </object>
                        <object class="sizeritem" expanded="1">
                            <property name="border">3</property>
                            <property name="flag">wxEXPAND</property>
                            <property name="proportion">1</property>
                            <object class="wxBoxSizer" expanded="1">
                                <property name="minimum_size"></property>
                                <property name="name">bSizeText</property>
                                <property name="orient">wxVERTICAL</property>
                                <property name="permission">none</property>
                                <object class="sizeritem" expanded="1">
                                <object class="sizeritem" expanded="1">
                                    <property name="border">3</property>
                                    <property name="border">3</property>
                                    <property name="flag">wxEXPAND|wxLEFT</property>
                                    <property name="flag">wxEXPAND|wxLEFT</property>
@@ -153,11 +162,11 @@
                                        <property name="fg"></property>
                                        <property name="fg"></property>
                                        <property name="font"></property>
                                        <property name="font"></property>
                                        <property name="hidden">0</property>
                                        <property name="hidden">0</property>
                                <property name="id">wxID_VALUE</property>
                                        <property name="id">wxID_VALUESINGLE</property>
                                        <property name="maximum_size"></property>
                                        <property name="maximum_size"></property>
                                        <property name="maxlength">0</property>
                                        <property name="maxlength">0</property>
                                        <property name="minimum_size"></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="permission">protected</property>
                                        <property name="pos"></property>
                                        <property name="pos"></property>
                                        <property name="size"></property>
                                        <property name="size"></property>
@@ -197,6 +206,63 @@
                                        <event name="OnUpdateUI"></event>
                                        <event name="OnUpdateUI"></event>
                                    </object>
                                    </object>
                                </object>
                                </object>
                                <object class="sizeritem" expanded="1">
                                    <property name="border">3</property>
                                    <property name="flag">wxEXPAND|wxLEFT</property>
                                    <property name="proportion">1</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_VALUEMULTI</property>
                                        <property name="maximum_size"></property>
                                        <property name="maxlength">0</property>
                                        <property name="minimum_size"></property>
                                        <property name="name">m_textLabelMultiLine</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">OnEnterKey</event>
                                        <event name="OnTextMaxLen"></event>
                                        <event name="OnTextURL"></event>
                                        <event name="OnUpdateUI"></event>
                                    </object>
                                </object>
                            </object>
                        </object>
                        <object class="sizeritem" expanded="1">
                        <object class="sizeritem" expanded="1">
                            <property name="border">3</property>
                            <property name="border">3</property>
                            <property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
                            <property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
+5 −3
Original line number Original line Diff line number Diff line
@@ -34,13 +34,15 @@ class DialogLabelEditor_Base : public wxDialog
	protected:
	protected:
		enum
		enum
		{
		{
			wxID_VALUE = 1000,
			wxID_VALUESINGLE = 1000,
			wxID_VALUEMULTI,
			wxID_SIZE,
			wxID_SIZE,
		};
		};
		
		
		wxFlexGridSizer* m_textControlSizer;
		wxFlexGridSizer* m_textControlSizer;
		wxStaticText* m_staticText1;
		wxStaticText* m_staticText1;
		wxTextCtrl* m_textLabel;
		wxTextCtrl* m_textLabelSingleLine;
		wxTextCtrl* m_textLabelMultiLine;
		wxStaticText* m_SizeTitle;
		wxStaticText* m_SizeTitle;
		wxTextCtrl* m_TextSize;
		wxTextCtrl* m_TextSize;
		wxStaticText* m_staticSizeUnits;
		wxStaticText* m_staticSizeUnits;
@@ -58,7 +60,7 @@ class DialogLabelEditor_Base : public wxDialog
		
		
	
	
	public:
	public:
		DialogLabelEditor_Base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
		DialogLabelEditor_Base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 359,347 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
		~DialogLabelEditor_Base();
		~DialogLabelEditor_Base();
	
	
};
};