Commit 3453e670 authored by jean-pierre charras's avatar jean-pierre charras

Eeschema: minor enhancements

parent 69b19f51
...@@ -92,24 +92,18 @@ void DialogLabelEditor::InitDialog() ...@@ -92,24 +92,18 @@ void DialogLabelEditor::InitDialog()
break; break;
} }
unsigned MINTEXTWIDTH = 40; // M's are big characters, a few establish a lot of width int MINTEXTWIDTH = 40; // M's are big characters, a few establish a lot of width
if( m_CurrentText->m_Text.Length() < MINTEXTWIDTH ) int max_len = 0;
if ( !multiLine )
{ {
wxString textWidth; max_len =m_CurrentText->m_Text.Length();
textWidth.Append( 'M', MINTEXTWIDTH );
EnsureTextCtrlWidth( m_textLabel, &textWidth );
}
else if ( !multiLine )
{
EnsureTextCtrlWidth( m_textLabel );
} }
else else
{ {
// calculate the length of the biggest line // calculate the length of the biggest line
// we cannot use the length of the entire text that has no meaning // we cannot use the length of the entire text that has no meaning
int max_len = 0; int curr_len = MINTEXTWIDTH;
int curr_len = 0;
int imax = m_CurrentText->m_Text.Len(); int imax = m_CurrentText->m_Text.Len();
for( int count = 0; count < imax; count++ ) for( int count = 0; count < imax; count++ )
{ {
...@@ -125,10 +119,13 @@ void DialogLabelEditor::InitDialog() ...@@ -125,10 +119,13 @@ void DialogLabelEditor::InitDialog()
max_len = curr_len; max_len = curr_len;
} }
} }
wxString textWidth;
textWidth.Append( 'M', max_len );
EnsureTextCtrlWidth( m_textLabel, &textWidth );
} }
if( max_len < MINTEXTWIDTH )
max_len = MINTEXTWIDTH;
wxString textWidth;
textWidth.Append( 'M', MINTEXTWIDTH );
EnsureTextCtrlWidth( m_textLabel, &textWidth );
// Set validators // Set validators
m_TextOrient->SetSelection( m_CurrentText->GetSchematicTextOrientation() ); m_TextOrient->SetSelection( m_CurrentText->GetSchematicTextOrientation() );
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008) // C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -107,4 +107,5 @@ DialogLabelEditor_Base::~DialogLabelEditor_Base() ...@@ -107,4 +107,5 @@ DialogLabelEditor_Base::~DialogLabelEditor_Base()
m_textLabelMultiLine->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.
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008) // C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -54,12 +54,13 @@ class DialogLabelEditor_Base : public wxDialog ...@@ -54,12 +54,13 @@ class DialogLabelEditor_Base : public wxDialog
wxButton* m_sdbSizer1Cancel; wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnEnterKey( wxCommandEvent& event ){ event.Skip(); } virtual void OnEnterKey( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public: public:
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( 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();
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
DIALOG_SCH_EDIT_SHEET_PIN_BASE::DIALOG_SCH_EDIT_SHEET_PIN_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) DIALOG_SCH_EDIT_SHEET_PIN_BASE::DIALOG_SCH_EDIT_SHEET_PIN_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 ); this->SetSizeHints( wxSize( 350,-1 ), wxDefaultSize );
wxBoxSizer* m_mainSizer; wxBoxSizer* m_mainSizer;
m_mainSizer = new wxBoxSizer( wxVERTICAL ); m_mainSizer = new wxBoxSizer( wxVERTICAL );
...@@ -21,6 +21,7 @@ DIALOG_SCH_EDIT_SHEET_PIN_BASE::DIALOG_SCH_EDIT_SHEET_PIN_BASE( wxWindow* parent ...@@ -21,6 +21,7 @@ DIALOG_SCH_EDIT_SHEET_PIN_BASE::DIALOG_SCH_EDIT_SHEET_PIN_BASE( wxWindow* parent
wxFlexGridSizer* fgSizer1; wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 4, 3, 0, 0 ); fgSizer1 = new wxFlexGridSizer( 4, 3, 0, 0 );
fgSizer1->AddGrowableCol( 1 );
fgSizer1->SetFlexibleDirection( wxBOTH ); fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
...@@ -85,7 +86,6 @@ DIALOG_SCH_EDIT_SHEET_PIN_BASE::DIALOG_SCH_EDIT_SHEET_PIN_BASE( wxWindow* parent ...@@ -85,7 +86,6 @@ DIALOG_SCH_EDIT_SHEET_PIN_BASE::DIALOG_SCH_EDIT_SHEET_PIN_BASE( wxWindow* parent
this->SetSizer( m_mainSizer ); this->SetSizer( m_mainSizer );
this->Layout(); this->Layout();
m_mainSizer->Fit( this );
this->Centre( wxBOTH ); this->Centre( wxBOTH );
} }
......
...@@ -34,10 +34,10 @@ ...@@ -34,10 +34,10 @@
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size">350,-1</property>
<property name="name">DIALOG_SCH_EDIT_SHEET_PIN_BASE</property> <property name="name">DIALOG_SCH_EDIT_SHEET_PIN_BASE</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size"></property> <property name="size">350,189</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">Sheet Pin Properties</property> <property name="title">Sheet Pin Properties</property>
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
<object class="wxFlexGridSizer" expanded="1"> <object class="wxFlexGridSizer" expanded="1">
<property name="cols">3</property> <property name="cols">3</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"></property>
<property name="hgap">0</property> <property name="hgap">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
......
...@@ -52,7 +52,7 @@ class DIALOG_SCH_EDIT_SHEET_PIN_BASE : public wxDialog ...@@ -52,7 +52,7 @@ class DIALOG_SCH_EDIT_SHEET_PIN_BASE : public wxDialog
public: public:
DIALOG_SCH_EDIT_SHEET_PIN_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Sheet Pin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_SCH_EDIT_SHEET_PIN_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Sheet Pin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 350,189 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_SCH_EDIT_SHEET_PIN_BASE(); ~DIALOG_SCH_EDIT_SHEET_PIN_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