Commit 95316beb authored by charras's avatar charras

fixed other issue in dialog edit multiline text

parent 686358d6
...@@ -55,20 +55,15 @@ void DialogLabelEditor::InitDialog() ...@@ -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();
......
...@@ -15,6 +15,7 @@ class DialogLabelEditor : public DialogLabelEditor_Base ...@@ -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 );
......
...@@ -17,6 +17,8 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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 );
} }
This diff is collapsed.
...@@ -34,13 +34,15 @@ class DialogLabelEditor_Base : public wxDialog ...@@ -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 ...@@ -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();
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment