diff --git a/CHANGELOG.txt b/CHANGELOG.txt index da5e7f4e7e..84afb1aef9 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -5,6 +5,13 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. +2009-Feb-09 UPDATE Dick Hollenbeck +================================================================================ +++eeschema + Changed dialog_edit_label so that is is UIpolicies.txt compliant. Proper case + on window titles, resizeable dialog border, minimum text width handling. + + 2009-Feb-7 Jean-Pierre Charras ================================================================================ ++All: diff --git a/eeschema/dialog_edit_label.cpp b/eeschema/dialog_edit_label.cpp index 5dc9ab48b1..6facece53d 100644 --- a/eeschema/dialog_edit_label.cpp +++ b/eeschema/dialog_edit_label.cpp @@ -1,4 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// + // Name: dialog_edit_label.cpp // Author: jean-pierre Charras // Modified by: @@ -16,65 +17,80 @@ #include "general.h" #include "dialog_edit_label.h" -DialogLabelEditor::DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText) - : DialogLabelEditor_Base ( parent ) +DialogLabelEditor::DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT* CurrentText ) : + DialogLabelEditor_Base( parent ) { m_Parent = parent; - m_CurrentText= CurrentText; + m_CurrentText = CurrentText; } + void DialogLabelEditor::OnInitDialog( wxInitDialogEvent& event ) { -wxString msg; + wxString msg; - SetFont(*g_DialogFont); + SetFont( *g_DialogFont ); - m_TextLabel->SetValue(m_CurrentText->m_Text); + m_TextLabel->SetValue( m_CurrentText->m_Text ); m_TextLabel->SetFocus(); + switch( m_CurrentText->Type() ) + { + case TYPE_SCH_GLOBALLABEL: + SetTitle( _( "Global Label Properties" ) ); + break; + + case TYPE_SCH_HIERLABEL: + SetTitle( _( "Hierarchal Label Properties" ) ); + break; + + case TYPE_SCH_LABEL: + SetTitle( _( "Label Properties" ) ); + break; + + default: + SetTitle( _( "Text Properties" ) ); + break; + } + + unsigned MINTEXTWIDTH = 30; // M's are big characters, a few establish a lot of width + + if( m_CurrentText->m_Text.Length() < MINTEXTWIDTH ) + { + wxString textWidth; + textWidth.Append( 'M', MINTEXTWIDTH ); + EnsureTextCtrlWidth( m_TextLabel, &textWidth ); + } + else + EnsureTextCtrlWidth( m_TextLabel ); + // Set validators m_TextOrient->SetSelection( m_CurrentText->m_Orient ); m_TextShape->SetSelection( m_CurrentText->m_Shape ); - switch( m_CurrentText->Type() ) - { - case TYPE_SCH_GLOBALLABEL: - SetTitle(_("Global Label properties")); - break; - - case TYPE_SCH_HIERLABEL: - SetTitle(_("Hierarchal Label properties")); - break; - - case TYPE_SCH_LABEL: - SetTitle(_("Label properties")); - break; - - default: - SetTitle(_("Text properties")); - break; - } - int style = 0; - if ( m_CurrentText->m_Italic ) + if( m_CurrentText->m_Italic ) style = 1; - if ( m_CurrentText->m_Width > 1 ) + if( m_CurrentText->m_Width > 1 ) style += 2; - m_TextStyle->SetSelection(style); + + m_TextStyle->SetSelection( style ); msg = m_SizeTitle->GetLabel() + ReturnUnitSymbol(); - m_SizeTitle->SetLabel(msg); + m_SizeTitle->SetLabel( msg ); - msg = ReturnStringFromValue(g_UnitMetric, m_CurrentText->m_Size.x, m_Parent->m_InternalUnits); - m_TextSize->SetValue(msg); + msg = ReturnStringFromValue( g_UnitMetric, m_CurrentText->m_Size.x, m_Parent->m_InternalUnits ); + m_TextSize->SetValue( msg ); - if (m_CurrentText->Type() != TYPE_SCH_GLOBALLABEL && - m_CurrentText->Type() != TYPE_SCH_HIERLABEL) - m_TextShape->Show(false); - - if (GetSizer()) + if( m_CurrentText->Type() != TYPE_SCH_GLOBALLABEL + && m_CurrentText->Type() != TYPE_SCH_HIERLABEL ) { - GetSizer()->SetSizeHints(this); + m_TextShape->Show( false ); + } + + if( GetSizer() ) + { + GetSizer()->SetSizeHints( this ); } } @@ -85,9 +101,10 @@ wxString msg; void DialogLabelEditor::OnButtonOKClick( wxCommandEvent& event ) { - TextPropertiesAccept(event); + TextPropertiesAccept( event ); } + /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL */ diff --git a/eeschema/dialog_edit_label_base.cpp b/eeschema/dialog_edit_label_base.cpp index ba65389dfd..3e15ebd1b0 100644 --- a/eeschema/dialog_edit_label_base.cpp +++ b/eeschema/dialog_edit_label_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 16 2008) +// C++ code generated with wxFormBuilder (version Aug 7 2008) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -24,6 +24,8 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id, bSizer2->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_TextLabel = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_TextLabel->SetToolTip( _("Enter the text to be used within the schematic") ); + bSizer2->Add( m_TextLabel, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); wxBoxSizer* m_OptionsSizer; @@ -33,23 +35,23 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id, int m_TextOrientNChoices = sizeof( m_TextOrientChoices ) / sizeof( wxString ); m_TextOrient = new wxRadioBox( this, wxID_ANY, _("Direction"), wxDefaultPosition, wxDefaultSize, m_TextOrientNChoices, m_TextOrientChoices, 1, wxRA_SPECIFY_COLS ); m_TextOrient->SetSelection( 0 ); - m_OptionsSizer->Add( m_TextOrient, 0, wxALL, 5 ); + m_OptionsSizer->Add( m_TextOrient, 1, wxALL, 5 ); wxString m_TextStyleChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") }; int m_TextStyleNChoices = sizeof( m_TextStyleChoices ) / sizeof( wxString ); m_TextStyle = new wxRadioBox( this, wxID_ANY, _("Style"), wxDefaultPosition, wxDefaultSize, m_TextStyleNChoices, m_TextStyleChoices, 1, wxRA_SPECIFY_COLS ); m_TextStyle->SetSelection( 0 ); - m_OptionsSizer->Add( m_TextStyle, 0, wxALL, 5 ); + m_OptionsSizer->Add( m_TextStyle, 1, wxALL, 5 ); wxString m_TextShapeChoices[] = { _("Input"), _("Output"), _("Bidi"), _("TriState"), _("Passive") }; int m_TextShapeNChoices = sizeof( m_TextShapeChoices ) / sizeof( wxString ); - m_TextShape = new wxRadioBox( this, wxID_ANY, _("Glabel Shape:"), wxDefaultPosition, wxDefaultSize, m_TextShapeNChoices, m_TextShapeChoices, 1, wxRA_SPECIFY_COLS ); - m_TextShape->SetSelection( 2 ); - m_OptionsSizer->Add( m_TextShape, 0, wxALL, 5 ); + m_TextShape = new wxRadioBox( this, wxID_ANY, _("Glabel Shape"), wxDefaultPosition, wxDefaultSize, m_TextShapeNChoices, m_TextShapeChoices, 1, wxRA_SPECIFY_COLS ); + m_TextShape->SetSelection( 0 ); + m_OptionsSizer->Add( m_TextShape, 1, wxALL, 5 ); bSizer2->Add( m_OptionsSizer, 1, wxEXPAND, 5 ); - bMainSizer->Add( bSizer2, 1, wxEXPAND, 5 ); + bMainSizer->Add( bSizer2, 5, wxEXPAND, 5 ); wxBoxSizer* bSizer4; bSizer4 = new wxBoxSizer( wxVERTICAL ); @@ -67,14 +69,14 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id, m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonOK->SetForegroundColour( wxColour( 234, 0, 0 ) ); - bSizer4->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + bSizer4->Add( m_buttonOK, 1, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); m_buttonCANCEL = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonCANCEL->SetForegroundColour( wxColour( 0, 0, 187 ) ); - bSizer4->Add( m_buttonCANCEL, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + bSizer4->Add( m_buttonCANCEL, 1, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - bMainSizer->Add( bSizer4, 0, wxEXPAND, 5 ); + bMainSizer->Add( bSizer4, 1, 0, 5 ); this->SetSizer( bMainSizer ); this->Layout(); diff --git a/eeschema/dialog_edit_label_base.fbp b/eeschema/dialog_edit_label_base.fbp index 387d2353ce..fe51986ed7 100644 --- a/eeschema/dialog_edit_label_base.fbp +++ b/eeschema/dialog_edit_label_base.fbp @@ -32,11 +32,15 @@ DialogLabelEditor_Base - 401,222 - wxDEFAULT_DIALOG_STYLE + 600,300 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER Text Editor + + wxFILTER_NONE + wxDefaultValidator + @@ -78,7 +82,7 @@ 5 wxEXPAND - 1 + 5 bSizer2 @@ -106,6 +110,10 @@ + + wxFILTER_NONE + wxDefaultValidator + @@ -156,7 +164,11 @@ - + Enter the text to be used within the schematic + + wxFILTER_NONE + wxDefaultValidator + @@ -202,7 +214,7 @@ 5 wxALL - 0 + 1 "Right" "Up" "Left" "Down" @@ -224,6 +236,10 @@ wxRA_SPECIFY_COLS + + wxFILTER_NONE + wxDefaultValidator + @@ -256,7 +272,7 @@ 5 wxALL - 0 + 1 "Normal" "Italic" "Bold" "Bold Italic" @@ -278,6 +294,10 @@ wxRA_SPECIFY_COLS + + wxFILTER_NONE + wxDefaultValidator + @@ -310,7 +330,7 @@ 5 wxALL - 0 + 1 "Input" "Output" "Bidi" "TriState" "Passive" @@ -320,18 +340,22 @@ 0 wxID_ANY - Glabel Shape: + Glabel Shape 1 m_TextShape protected - 2 + 0 wxRA_SPECIFY_COLS + + wxFILTER_NONE + wxDefaultValidator + @@ -367,8 +391,8 @@ 5 - wxEXPAND - 0 + + 1 bSizer4 @@ -396,6 +420,10 @@ + + wxFILTER_NONE + wxDefaultValidator + @@ -447,6 +475,10 @@ + + wxFILTER_NONE + wxDefaultValidator + @@ -493,7 +525,7 @@ 5 wxALL|wxALIGN_CENTER_HORIZONTAL - 0 + 1 @@ -513,6 +545,10 @@ + + wxFILTER_NONE + wxDefaultValidator + @@ -545,7 +581,7 @@ 5 wxALL|wxALIGN_CENTER_HORIZONTAL - 0 + 1 @@ -565,6 +601,10 @@ + + wxFILTER_NONE + wxDefaultValidator + diff --git a/eeschema/dialog_edit_label_base.h b/eeschema/dialog_edit_label_base.h index a041dacf92..b3e9ddea74 100644 --- a/eeschema/dialog_edit_label_base.h +++ b/eeschema/dialog_edit_label_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 16 2008) +// C++ code generated with wxFormBuilder (version Aug 7 2008) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -56,7 +56,8 @@ class DialogLabelEditor_Base : public wxDialog public: - DialogLabelEditor_Base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 401,222 ), long style = wxDEFAULT_DIALOG_STYLE ); + + DialogLabelEditor_Base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 600,300 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DialogLabelEditor_Base(); };