Commit 162492ef authored by charras's avatar charras

Change dialog to edit fields in libedit (see CHANGELOG.txt)

parent 930a777e
......@@ -84,7 +84,7 @@ void EDA_LibComponentStruct::SetFields( const std::vector <LibDrawField> aFields
/* for a user field (FieldId >= FIELD1), if a field value is void,
* fill it with "~" because for a library component a void field is not a very good idea
* (we do not see anything...) and in schematic this text is like a void text
* and for not editable names, remove the name (thar is the default name
* and for non editable names, remove the name (set to the default name)
*/
for( LibDrawField* Field = Fields; Field; Field = Field->Next() )
{
......@@ -148,7 +148,6 @@ private:
*/
void copySelectedFieldToPanel();
/**
* Function copyPanelToSelectedField
* copies the values displayed on the panel fields to the currently selected field
......@@ -535,6 +534,14 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
style |= 2;
m_StyleRadioBox->SetSelection( style );
// Copy the text justification
if( field.m_HJustify == GR_TEXT_HJUSTIFY_LEFT )
m_FieldHJustifyCtrl->SetSelection(0);
else if( field.m_HJustify == GR_TEXT_HJUSTIFY_RIGHT )
m_FieldHJustifyCtrl->SetSelection(2);
else
m_FieldHJustifyCtrl->SetSelection(1);
fieldNameTextCtrl->SetValue( field.m_Name );
// if fieldNdx == REFERENCE, VALUE, FOOTPRINT, or DATASHEET, then disable editing
......@@ -600,6 +607,25 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
else
field.m_Orient = TEXT_ORIENT_HORIZ;
// Copy the text justification
GRTextHorizJustifyType hjustify[3] = {
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_HJUSTIFY_RIGHT
};
GRTextVertJustifyType vjustify[3] = {
GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_TOP
};
field.m_HJustify = hjustify[m_FieldHJustifyCtrl->GetSelection()];
field.m_VJustify = vjustify[m_FieldVJustifyCtrl->GetSelection()];
if( field.m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM )
m_FieldVJustifyCtrl->SetSelection(0);
else if( field.m_VJustify == GR_TEXT_VJUSTIFY_TOP )
m_FieldVJustifyCtrl->SetSelection(2);
else
m_FieldVJustifyCtrl->SetSelection(1);
rotateCheckBox->SetValue( field.m_Orient == TEXT_ORIENT_VERT );
/* Void fields for REFERENCE and VALUE are not allowed
......
......@@ -51,13 +51,13 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
wxBoxSizer* orientationSizer;
orientationSizer = new wxBoxSizer( wxHORIZONTAL );
wxString m_FieldPositionCtrlChoices[] = { _("Align left"), _("Align center"), _("Align right") };
int m_FieldPositionCtrlNChoices = sizeof( m_FieldPositionCtrlChoices ) / sizeof( wxString );
m_FieldPositionCtrl = new wxRadioBox( this, wxID_ANY, _("Horiz. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldPositionCtrlNChoices, m_FieldPositionCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_FieldPositionCtrl->SetSelection( 1 );
m_FieldPositionCtrl->SetToolTip( _("Select if the component is to be rotated when drawn") );
wxString m_FieldHJustifyCtrlChoices[] = { _("Align left"), _("Align center"), _("Align right") };
int m_FieldHJustifyCtrlNChoices = sizeof( m_FieldHJustifyCtrlChoices ) / sizeof( wxString );
m_FieldHJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Horiz. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldHJustifyCtrlNChoices, m_FieldHJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_FieldHJustifyCtrl->SetSelection( 1 );
m_FieldHJustifyCtrl->SetToolTip( _("Select if the component is to be rotated when drawn") );
orientationSizer->Add( m_FieldPositionCtrl, 1, wxALL, 8 );
orientationSizer->Add( m_FieldHJustifyCtrl, 1, wxALL, 8 );
optionsSizer->Add( orientationSizer, 1, wxLEFT|wxRIGHT|wxTOP|wxEXPAND|wxALIGN_CENTER_VERTICAL, 0 );
......
......@@ -373,7 +373,7 @@
<property name="majorDimension">1</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_FieldPositionCtrl</property>
<property name="name">m_FieldHJustifyCtrl</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="selection">1</property>
......
......@@ -40,7 +40,7 @@ class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public wxDialog
wxButton* addFieldButton;
wxButton* deleteFieldButton;
wxButton* moveUpButton;
wxRadioBox* m_FieldPositionCtrl;
wxRadioBox* m_FieldHJustifyCtrl;
wxRadioBox* m_FieldVJustifyCtrl;
wxCheckBox* showCheckBox;
wxCheckBox* rotateCheckBox;
......
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