[glom] Print Layout: Create standard: Use the multiline text formatting.



commit 5bd43d29a1f667944724a7f4140565e5f01d690f
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Oct 14 01:57:56 2011 +0200

    Print Layout: Create standard: Use the multiline text formatting.
    
    * glom/print_layout/print_layout_utils.cc: create_standard():
    Make text fields multiline if they are multiline on the details
    layout.

 ChangeLog                               |    8 ++++++++
 glom/print_layout/print_layout_utils.cc |   21 ++++++++++++++++++---
 2 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f0802e3..29c5110 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2011-10-14  Murray Cumming  <murrayc murrayc com>
 
+	Print Layout: Create standard: Use the multiline text formatting.
+
+	* glom/print_layout/print_layout_utils.cc: create_standard():
+	Make text fields multiline if they are multiline on the details 
+	layout.
+
+2011-10-14  Murray Cumming  <murrayc murrayc com>
+
 	Print Layout: Small improvement.
 
 	* glom/print_layout/canvas_print_layout.cc: move_items_below_item():
diff --git a/glom/print_layout/print_layout_utils.cc b/glom/print_layout/print_layout_utils.cc
index 68972fe..4b15f4e 100644
--- a/glom/print_layout/print_layout_utils.cc
+++ b/glom/print_layout/print_layout_utils.cc
@@ -247,14 +247,29 @@ static void create_standard(const sharedptr<const LayoutGroup>& layout_group, co
         item_x += (title_width + gap);
 
       const double field_width = item_width - title_width - gap;
-      y = move_fully_to_page(page_setup, units, y, field_height); //TODO: Move the title down too, if this was moved.
-      clone->set_print_layout_position(item_x, y, field_width, field_height); //TODO: Enough and no more.
+
+      //Make multi-line fields bigger:
+      //TODO: Add an auto-expand feature:
+      double this_field_height = field_height;
+      if(field)
+      {
+        const FieldFormatting& formatting = field->get_formatting_used();
+        if(formatting.get_text_format_multiline())
+        {
+          const guint lines = formatting.get_text_format_multiline_height_lines();
+          if(lines)
+            this_field_height = field_height * lines;
+        }
+      }
+
+      y = move_fully_to_page(page_setup, units, y, this_field_height); //TODO: Move the title down too, if this was moved.
+      clone->set_print_layout_position(item_x, y, field_width, this_field_height); //TODO: Enough and no more.
       
       //Make sure that the title is still aligned, even if this was moved by move_fully_to_page().
       if(text_title)
         text_title->set_print_layout_position_y(y);
       
-      y += field_height + gap; //padding.
+      y += this_field_height + gap; //padding.
 
       print_layout_group->add_item(clone);
     }



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