[glom] Print Layout: Don't move fields to 0, 0 when choosing the field.



commit 49e3ed1f0ad0b7780d48734a55ca59bc5241a1fc
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Aug 11 11:58:54 2011 +0200

    Print Layout: Don't move fields to 0,0 when choosing the field.
    
    * glom/mode_design/layout/dialog_choose_field.cc: get_field():
    Preserve the extra details of the start field, such as formatting
    and print layout position.

 ChangeLog                                      |    8 ++++++++
 glom/mode_design/layout/dialog_choose_field.cc |   18 +++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b54de73..5bc0ce7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2011-08-11  Murray Cumming  <murrayc murrayc com>
 
+	Print Layout: Don't move fields to 0,0 when choosing the field.
+
+	* glom/mode_design/layout/dialog_choose_field.cc: get_field():
+	Preserve the extra details of the start field, such as formatting 
+	and print layout position.
+
+2011-08-11  Murray Cumming  <murrayc murrayc com>
+
 	Print Layout: Actually allow the user to change the text formatting.
 
 	* glom/mode_design/layout/layout_item_dialogs/box_formatting.cc:
diff --git a/glom/mode_design/layout/dialog_choose_field.cc b/glom/mode_design/layout/dialog_choose_field.cc
index f0a7222..1db4df8 100644
--- a/glom/mode_design/layout/dialog_choose_field.cc
+++ b/glom/mode_design/layout/dialog_choose_field.cc
@@ -203,8 +203,24 @@ sharedptr<LayoutItem_Field> Dialog_ChooseField::get_field_chosen() const
   {
     field = *(list_fields.begin()); 
   }
+
+  if(!field)
+    return field;
+
+  if(!m_start_field)
+    return field;
+  else
+  {
+    //Preserve extra details of the field that was originally used, if any,
+    //changing only the details that could have been changed in this dialog:
+    //Note that m_start_field is already a clone, so it's safe to change it:
+    m_start_field->set_name( field->get_name() );
+    m_start_field->set_full_field_details( field->get_full_field_details() );
+    m_start_field->set_relationship( field->get_relationship() );
+    m_start_field->set_related_relationship( field->get_related_relationship() );
   
-  return field;
+    return m_start_field;
+  }
 }
 
 Dialog_ChooseField::type_list_field_items Dialog_ChooseField::get_fields_chosen() const



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]