Commit ee661525 authored by charras's avatar charras

minor enhancements and fixed minor bug in field editor dialog

parent 8570d331
...@@ -66,7 +66,7 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos, ...@@ -66,7 +66,7 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
} }
parent->DrawPanel->MouseToCursorSchema(); parent->DrawPanel->MouseToCursorSchema();
parent->DrawPanel->m_IgnoreMouseEvents = FALSE; parent->DrawPanel->m_IgnoreMouseEvents = false;
} }
...@@ -522,8 +522,12 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel() ...@@ -522,8 +522,12 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
fieldValueTextCtrl->SetValue( field.m_Text ); fieldValueTextCtrl->SetValue( field.m_Text );
// For power symbols, the value is NOR editable, because value and pin name must be same
// and can be edited only in library editor
if( fieldNdx == VALUE && m_LibEntry && m_LibEntry->m_Options == ENTRY_POWER ) if( fieldNdx == VALUE && m_LibEntry && m_LibEntry->m_Options == ENTRY_POWER )
fieldValueTextCtrl->Enable( FALSE ); fieldValueTextCtrl->Enable( false );
else
fieldValueTextCtrl->Enable( true );
textSizeTextCtrl->SetValue( textSizeTextCtrl->SetValue(
WinEDA_GraphicTextCtrl::FormatSize( EESCHEMA_INTERNAL_UNIT, g_UnitMetric, field.m_Size.x ) ); WinEDA_GraphicTextCtrl::FormatSize( EESCHEMA_INTERNAL_UNIT, g_UnitMetric, field.m_Size.x ) );
......
...@@ -46,11 +46,13 @@ DialogLabelEditor::DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT* C ...@@ -46,11 +46,13 @@ DialogLabelEditor::DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT* C
void DialogLabelEditor::init() void DialogLabelEditor::init()
{ {
wxString msg; wxString msg;
bool multine = false;
if( m_CurrentText->m_MultilineAllowed ) if( m_CurrentText->m_MultilineAllowed )
{ {
m_TextLabel = m_textCtrlMultiline; m_TextLabel = m_textCtrlMultiline;
m_TextLabelSingleline->Show(false); m_TextLabelSingleline->Show(false);
multine = true;
} }
else else
{ {
...@@ -90,8 +92,33 @@ void DialogLabelEditor::init() ...@@ -90,8 +92,33 @@ void DialogLabelEditor::init()
textWidth.Append( 'M', MINTEXTWIDTH ); textWidth.Append( 'M', MINTEXTWIDTH );
EnsureTextCtrlWidth( m_TextLabel, &textWidth ); EnsureTextCtrlWidth( m_TextLabel, &textWidth );
} }
else else if ( ! multine )
EnsureTextCtrlWidth( m_TextLabel ); EnsureTextCtrlWidth( m_TextLabel );
else
{
// calculate the lenght of the biggest line
// we cannot use the lenght of the entire text that has no meaning
int max_len = 0;
int curr_len = 0;
int imax = m_CurrentText->m_Text.Len();
for( int count = 0; count < imax; count++ )
{
if( m_CurrentText->m_Text[count] == '\n' ||
m_CurrentText->m_Text[count] == '\r' ) // new line
{
curr_len = 0;
}
else
{
curr_len++;
if ( max_len < curr_len )
max_len = curr_len;
}
}
wxString textWidth;
textWidth.Append( 'M', max_len );
EnsureTextCtrlWidth( m_TextLabel, &textWidth );
}
// Set validators // Set validators
m_TextOrient->SetSelection( m_CurrentText->GetSchematicTextOrientation() ); m_TextOrient->SetSelection( m_CurrentText->GetSchematicTextOrientation() );
......
...@@ -23,13 +23,13 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id, ...@@ -23,13 +23,13 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id,
m_TextLabelSingleline = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); m_TextLabelSingleline = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_TextLabelSingleline->SetToolTip( _("Enter the text to be used within the schematic") ); m_TextLabelSingleline->SetToolTip( _("Enter the text to be used within the schematic") );
bMainSizer->Add( m_TextLabelSingleline, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); bMainSizer->Add( m_TextLabelSingleline, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_textCtrlMultiline = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_PROCESS_ENTER ); m_textCtrlMultiline = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_PROCESS_ENTER );
m_textCtrlMultiline->SetToolTip( _("Enter the text to be used within the schematic") ); m_textCtrlMultiline->SetToolTip( _("Enter the text to be used within the schematic") );
m_textCtrlMultiline->SetMinSize( wxSize( -1,60 ) ); m_textCtrlMultiline->SetMinSize( wxSize( -1,60 ) );
bMainSizer->Add( m_textCtrlMultiline, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); bMainSizer->Add( m_textCtrlMultiline, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* m_OptionsSizer; wxBoxSizer* m_OptionsSizer;
m_OptionsSizer = new wxBoxSizer( wxHORIZONTAL ); m_OptionsSizer = new wxBoxSizer( wxHORIZONTAL );
...@@ -73,7 +73,7 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id, ...@@ -73,7 +73,7 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id,
m_OptionsSizer->Add( bSizer4, 1, 0, 5 ); m_OptionsSizer->Add( bSizer4, 1, 0, 5 );
bMainSizer->Add( m_OptionsSizer, 1, wxEXPAND, 5 ); bMainSizer->Add( m_OptionsSizer, 0, wxEXPAND, 5 );
this->SetSizer( bMainSizer ); this->SetSizer( bMainSizer );
this->Layout(); this->Layout();
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">DialogLabelEditor_Base</property> <property name="name">DialogLabelEditor_Base</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">526,281</property> <property name="size">526,290</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">Text Editor</property> <property name="title">Text Editor</property>
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property> <property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1"> <object class="wxTextCtrl" expanded="1">
<property name="bg"></property> <property name="bg"></property>
...@@ -183,8 +183,8 @@ ...@@ -183,8 +183,8 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property> <property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">1</property>
<object class="wxTextCtrl" expanded="1"> <object class="wxTextCtrl" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="context_help"></property> <property name="context_help"></property>
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_OptionsSizer</property> <property name="name">m_OptionsSizer</property>
......
...@@ -57,7 +57,7 @@ class DialogLabelEditor_Base : public wxDialog ...@@ -57,7 +57,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( 526,281 ), 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( 526,290 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DialogLabelEditor_Base(); ~DialogLabelEditor_Base();
}; };
......
...@@ -533,7 +533,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel() ...@@ -533,7 +533,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
fieldNameTextCtrl->SetValue( field.m_Name ); fieldNameTextCtrl->SetValue( field.m_Name );
// if fieldNdx == REFERENCE, VALUE, FOOTPRINT, or DATASHEET, then disable filed name editing // if fieldNdx == REFERENCE, VALUE, FOOTPRINT, or DATASHEET, then disable field name editing
fieldNameTextCtrl->Enable( fieldNdx >= FIELD1 ); fieldNameTextCtrl->Enable( fieldNdx >= FIELD1 );
fieldNameTextCtrl->SetEditable( fieldNdx >= FIELD1 ); fieldNameTextCtrl->SetEditable( fieldNdx >= FIELD1 );
moveUpButton->Enable( fieldNdx >= FIELD1 ); // disable move up button for non moveable fields moveUpButton->Enable( fieldNdx >= FIELD1 ); // disable move up button for non moveable fields
...@@ -542,9 +542,6 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel() ...@@ -542,9 +542,6 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
fieldValueTextCtrl->SetValue( field.m_Text ); fieldValueTextCtrl->SetValue( field.m_Text );
if( fieldNdx == VALUE && m_LibEntry && m_LibEntry->m_Options == ENTRY_POWER )
fieldValueTextCtrl->Enable( FALSE );
textSizeTextCtrl->SetValue( textSizeTextCtrl->SetValue(
WinEDA_GraphicTextCtrl::FormatSize( EESCHEMA_INTERNAL_UNIT, g_UnitMetric, field.m_Size.x ) ); WinEDA_GraphicTextCtrl::FormatSize( EESCHEMA_INTERNAL_UNIT, g_UnitMetric, field.m_Size.x ) );
......
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