Commit af4e798b authored by dickelbeck's avatar dickelbeck

enhance dialog_edit_label

parent 04174ecd
......@@ -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 <dick@softplc.com>
================================================================================
++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 <jean-pierre.charras@inpg.fr>
================================================================================
++All:
......
/////////////////////////////////////////////////////////////////////////////
// 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();
// 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"));
SetTitle( _( "Global Label Properties" ) );
break;
case TYPE_SCH_HIERLABEL:
SetTitle(_("Hierarchal Label properties"));
SetTitle( _( "Hierarchal Label Properties" ) );
break;
case TYPE_SCH_LABEL:
SetTitle(_("Label properties"));
SetTitle( _( "Label Properties" ) );
break;
default:
SetTitle(_("Text properties"));
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 );
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( m_CurrentText->Type() != TYPE_SCH_GLOBALLABEL
&& m_CurrentText->Type() != TYPE_SCH_HIERLABEL )
{
m_TextShape->Show( false );
}
if (GetSizer())
if( GetSizer() )
{
GetSizer()->SetSizeHints(this);
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
*/
......
///////////////////////////////////////////////////////////////////////////
// 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();
......
......@@ -32,11 +32,15 @@
<property name="minimum_size"></property>
<property name="name">DialogLabelEditor_Base</property>
<property name="pos"></property>
<property name="size">401,222</property>
<property name="style">wxDEFAULT_DIALOG_STYLE</property>
<property name="size">600,300</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="title">Text Editor</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
......@@ -78,7 +82,7 @@
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<property name="proportion">5</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer2</property>
......@@ -106,6 +110,10 @@
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
......@@ -156,7 +164,11 @@
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="tooltip">Enter the text to be used within the schematic</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
......@@ -202,7 +214,7 @@
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<property name="proportion">1</property>
<object class="wxRadioBox" expanded="1">
<property name="bg"></property>
<property name="choices">&quot;Right&quot; &quot;Up&quot; &quot;Left&quot; &quot;Down&quot;</property>
......@@ -224,6 +236,10 @@
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
......@@ -256,7 +272,7 @@
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<property name="proportion">1</property>
<object class="wxRadioBox" expanded="1">
<property name="bg"></property>
<property name="choices">&quot;Normal&quot; &quot;Italic&quot; &quot;Bold&quot; &quot;Bold Italic&quot;</property>
......@@ -278,6 +294,10 @@
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
......@@ -310,7 +330,7 @@
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<property name="proportion">1</property>
<object class="wxRadioBox" expanded="1">
<property name="bg"></property>
<property name="choices">&quot;Input&quot; &quot;Output&quot; &quot;Bidi&quot; &quot;TriState&quot; &quot;Passive&quot;</property>
......@@ -320,18 +340,22 @@
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Glabel Shape:</property>
<property name="label">Glabel Shape</property>
<property name="majorDimension">1</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_TextShape</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="selection">2</property>
<property name="selection">0</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
......@@ -367,8 +391,8 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<property name="flag"></property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer4</property>
......@@ -396,6 +420,10 @@
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
......@@ -447,6 +475,10 @@
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
......@@ -493,7 +525,7 @@
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property>
<property name="proportion">0</property>
<property name="proportion">1</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
......@@ -513,6 +545,10 @@
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
......@@ -545,7 +581,7 @@
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property>
<property name="proportion">0</property>
<property name="proportion">1</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
......@@ -565,6 +601,10 @@
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
......
///////////////////////////////////////////////////////////////////////////
// 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();
};
......
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