← Back to team overview

kicad-developers team mailing list archive

[PATCH] Fix field align settings in dialogs of Eeschema.

 

In Eeschema:
1) open dialog for editing properties of a component
2) set align left and _bottom_ for Ref field
3) press OK for applying
4) Ref field will aligned by left _top_ corner of its boundin box

And more, checkboxes for aligning has different labels and different order
in dialog for editing properties of component and in dialog for editing
fields.

Attached patch fixes this issues.
From f10ba603bb9f81d498c8cdc8c03c12864900b11f Mon Sep 17 00:00:00 2001
From: Baranovskiy Konstantin <baranovskiykonstantin@xxxxxxxxx>
Date: Fri, 10 Nov 2017 18:26:48 +0200
Subject: [PATCH] Fix field align settings in dialogs of Eeschema.

---
 eeschema/dialogs/dialog_edit_component_in_schematic.cpp     | 8 ++++----
 eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp | 4 ++--
 eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp | 4 ++--
 eeschema/dialogs/dialog_lib_edit_text.cpp                   | 8 ++++----
 eeschema/dialogs/dialog_lib_edit_text_base.cpp              | 4 ++--
 eeschema/dialogs/dialog_lib_edit_text_base.fbp              | 4 ++--
 6 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp
index 548c897db..2cf68e072 100644
--- a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp
+++ b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp
@@ -923,9 +923,9 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
     else
         m_FieldHJustifyCtrl->SetSelection( 1 );
 
-    if( field.GetVertJustify() == GR_TEXT_VJUSTIFY_BOTTOM )
+    if( field.GetVertJustify() == GR_TEXT_VJUSTIFY_TOP )
         m_FieldVJustifyCtrl->SetSelection( 0 );
-    else if( field.GetVertJustify() == GR_TEXT_VJUSTIFY_TOP )
+    else if( field.GetVertJustify() == GR_TEXT_VJUSTIFY_BOTTOM )
         m_FieldVJustifyCtrl->SetSelection( 2 );
     else
         m_FieldVJustifyCtrl->SetSelection( 1 );
@@ -1039,9 +1039,9 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
     };
 
     static const EDA_TEXT_VJUSTIFY_T vjustify[] = {
-        GR_TEXT_VJUSTIFY_BOTTOM,
+        GR_TEXT_VJUSTIFY_TOP,
         GR_TEXT_VJUSTIFY_CENTER,
-        GR_TEXT_VJUSTIFY_TOP
+        GR_TEXT_VJUSTIFY_BOTTOM
     };
 
     field.SetHorizJustify( hjustify[m_FieldHJustifyCtrl->GetSelection()] );
diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp
index 11fe11994..570122f24 100644
--- a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp
+++ b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp
@@ -166,13 +166,13 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
 	wxBoxSizer* bSizerJustification;
 	bSizerJustification = new wxBoxSizer( wxHORIZONTAL );
 	
-	wxString m_FieldHJustifyCtrlChoices[] = { _("Align Left"), _("Center"), _("Align Right") };
+	wxString m_FieldHJustifyCtrlChoices[] = { _("Align Left"), _("Align Center"), _("Align Right") };
 	int m_FieldHJustifyCtrlNChoices = sizeof( m_FieldHJustifyCtrlChoices ) / sizeof( wxString );
 	m_FieldHJustifyCtrl = new wxRadioBox( fieldsSizer->GetStaticBox(), wxID_ANY, _("Horizontal Position:"), wxDefaultPosition, wxDefaultSize, m_FieldHJustifyCtrlNChoices, m_FieldHJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS );
 	m_FieldHJustifyCtrl->SetSelection( 0 );
 	bSizerJustification->Add( m_FieldHJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
 	
-	wxString m_FieldVJustifyCtrlChoices[] = { _("Align Top"), _("Center"), _("Align Bottom") };
+	wxString m_FieldVJustifyCtrlChoices[] = { _("Align Top"), _("Align Center"), _("Align Bottom") };
 	int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString );
 	m_FieldVJustifyCtrl = new wxRadioBox( fieldsSizer->GetStaticBox(), wxID_ANY, _("Vertical Position:"), wxDefaultPosition, wxDefaultSize, m_FieldVJustifyCtrlNChoices, m_FieldVJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS );
 	m_FieldVJustifyCtrl->SetSelection( 0 );
diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp
index 192425a9e..05650a1fa 100644
--- a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp
+++ b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp
@@ -2107,7 +2107,7 @@
                                                         <property name="caption"></property>
                                                         <property name="caption_visible">1</property>
                                                         <property name="center_pane">0</property>
-                                                        <property name="choices">&quot;Align Left&quot; &quot;Center&quot; &quot;Align Right&quot;</property>
+                                                        <property name="choices">&quot;Align Left&quot; &quot;Align Center&quot; &quot;Align Right&quot;</property>
                                                         <property name="close_button">1</property>
                                                         <property name="context_help"></property>
                                                         <property name="context_menu">1</property>
@@ -2197,7 +2197,7 @@
                                                         <property name="caption"></property>
                                                         <property name="caption_visible">1</property>
                                                         <property name="center_pane">0</property>
-                                                        <property name="choices">&quot;Align Top&quot; &quot;Center&quot; &quot;Align Bottom&quot;</property>
+                                                        <property name="choices">&quot;Align Top&quot; &quot;Align Center&quot; &quot;Align Bottom&quot;</property>
                                                         <property name="close_button">1</property>
                                                         <property name="context_help"></property>
                                                         <property name="context_menu">1</property>
diff --git a/eeschema/dialogs/dialog_lib_edit_text.cpp b/eeschema/dialogs/dialog_lib_edit_text.cpp
index b3a2e9656..f42dca81e 100644
--- a/eeschema/dialogs/dialog_lib_edit_text.cpp
+++ b/eeschema/dialogs/dialog_lib_edit_text.cpp
@@ -100,7 +100,7 @@ void DIALOG_LIB_EDIT_TEXT::initDlg( )
 
         switch ( m_graphicText->GetVertJustify() )
         {
-        case GR_TEXT_VJUSTIFY_BOTTOM:
+        case GR_TEXT_VJUSTIFY_TOP:
             m_TextVJustificationOpt->SetSelection( 0 );
             break;
 
@@ -108,7 +108,7 @@ void DIALOG_LIB_EDIT_TEXT::initDlg( )
             m_TextVJustificationOpt->SetSelection( 1 );
             break;
 
-        case GR_TEXT_VJUSTIFY_TOP:
+        case GR_TEXT_VJUSTIFY_BOTTOM:
             m_TextVJustificationOpt->SetSelection( 2 );
             break;
         }
@@ -199,7 +199,7 @@ void DIALOG_LIB_EDIT_TEXT::OnOkClick( wxCommandEvent& event )
         switch( m_TextVJustificationOpt->GetSelection() )
         {
         case 0:
-            m_graphicText->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
+            m_graphicText->SetVertJustify( GR_TEXT_VJUSTIFY_TOP );
             break;
 
         case 1:
@@ -207,7 +207,7 @@ void DIALOG_LIB_EDIT_TEXT::OnOkClick( wxCommandEvent& event )
             break;
 
         case 2:
-            m_graphicText->SetVertJustify( GR_TEXT_VJUSTIFY_TOP );
+            m_graphicText->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
             break;
         }
     }
diff --git a/eeschema/dialogs/dialog_lib_edit_text_base.cpp b/eeschema/dialogs/dialog_lib_edit_text_base.cpp
index 683bbc80a..ad95fdfa8 100644
--- a/eeschema/dialogs/dialog_lib_edit_text_base.cpp
+++ b/eeschema/dialogs/dialog_lib_edit_text_base.cpp
@@ -98,13 +98,13 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow
 	m_TextShapeOpt->SetSelection( 0 );
 	bBottomtBoxSizer->Add( m_TextShapeOpt, 1, wxALL|wxEXPAND, 5 );
 	
-	wxString m_TextHJustificationOptChoices[] = { _("Align left"), _("Align center"), _("Align right") };
+	wxString m_TextHJustificationOptChoices[] = { _("Align Left"), _("Align Center"), _("Align Right") };
 	int m_TextHJustificationOptNChoices = sizeof( m_TextHJustificationOptChoices ) / sizeof( wxString );
 	m_TextHJustificationOpt = new wxRadioBox( this, wxID_ANY, _("Horizontal Justify"), wxDefaultPosition, wxDefaultSize, m_TextHJustificationOptNChoices, m_TextHJustificationOptChoices, 1, wxRA_SPECIFY_COLS );
 	m_TextHJustificationOpt->SetSelection( 1 );
 	bBottomtBoxSizer->Add( m_TextHJustificationOpt, 1, wxALL|wxEXPAND, 5 );
 	
-	wxString m_TextVJustificationOptChoices[] = { _("Align bottom"), _("Align center"), _("Align top") };
+	wxString m_TextVJustificationOptChoices[] = { _("Align Top"), _("Align Center"), _("Align Bottom") };
 	int m_TextVJustificationOptNChoices = sizeof( m_TextVJustificationOptChoices ) / sizeof( wxString );
 	m_TextVJustificationOpt = new wxRadioBox( this, wxID_ANY, _("Vertical Justify"), wxDefaultPosition, wxDefaultSize, m_TextVJustificationOptNChoices, m_TextVJustificationOptChoices, 1, wxRA_SPECIFY_COLS );
 	m_TextVJustificationOpt->SetSelection( 1 );
diff --git a/eeschema/dialogs/dialog_lib_edit_text_base.fbp b/eeschema/dialogs/dialog_lib_edit_text_base.fbp
index 1edc5896a..62b4f0a47 100644
--- a/eeschema/dialogs/dialog_lib_edit_text_base.fbp
+++ b/eeschema/dialogs/dialog_lib_edit_text_base.fbp
@@ -1230,7 +1230,7 @@
                                         <property name="caption"></property>
                                         <property name="caption_visible">1</property>
                                         <property name="center_pane">0</property>
-                                        <property name="choices">&quot;Align left&quot; &quot;Align center&quot; &quot;Align right&quot;</property>
+                                        <property name="choices">&quot;Align Left&quot; &quot;Align Center&quot; &quot;Align Right&quot;</property>
                                         <property name="close_button">1</property>
                                         <property name="context_help"></property>
                                         <property name="context_menu">1</property>
@@ -1320,7 +1320,7 @@
                                         <property name="caption"></property>
                                         <property name="caption_visible">1</property>
                                         <property name="center_pane">0</property>
-                                        <property name="choices">&quot;Align bottom&quot; &quot;Align center&quot; &quot;Align top&quot;</property>
+                                        <property name="choices">&quot;Align Top&quot; &quot;Align Center&quot; &quot;Align Bottom&quot;</property>
                                         <property name="close_button">1</property>
                                         <property name="context_help"></property>
                                         <property name="context_menu">1</property>
-- 
2.15.0


Follow ups