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();
......
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// 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