[glom] Print Layouts: Default to 12-point text instead of 9.



commit 10c79196f9162dbc236e7c3ab7948ceb95b4c23c
Author: Murray Cumming <murrayc murrayc com>
Date:   Sat Aug 27 17:05:52 2011 +0200

    Print Layouts: Default to 12-point text instead of 9.
    
    * glom/mode_design/print_layouts/window_print_layout_edit.cc:
    Use a grid size, and item sizes, suitable for 12 point text.
    create_empty_item(): Make sure we stop LayoutItem_Field items from
    using default formatting, which is not for print layouts.
    Set a default font size for anything that has text formatting.
    * glom/mode_design/relationships_overview/canvas_group_dbtable.cc:
    Constructor: Use 12 points instead of 10 points, though this should
    be configurable anyway.

 ChangeLog                                          |   13 +++++++++++++
 .../print_layouts/window_print_layout_edit.cc      |   16 ++++++++++++++--
 .../relationships_overview/canvas_group_dbtable.cc |    2 +-
 glom/print_layout/canvas_layout_item.cc            |    5 +----
 4 files changed, 29 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0d9f485..dc013da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2011-08-27  Murray Cumming  <murrayc murrayc com>
 
+	Print Layouts: Default to 12-point text instead of 9.
+
+	* glom/mode_design/print_layouts/window_print_layout_edit.cc:
+	Use a grid size, and item sizes, suitable for 12 point text.
+	create_empty_item(): Make sure we stop LayoutItem_Field items from 
+	using default formatting, which is not for print layouts.
+	Set a default font size for anything that has text formatting.
+	* glom/mode_design/relationships_overview/canvas_group_dbtable.cc:
+	Constructor: Use 12 points instead of 10 points, though this should 
+	be configurable anyway.
+
+2011-08-27  Murray Cumming  <murrayc murrayc com>
+
 	Print Layout: Make item sizes match the grid size by default.
 
 	* glom/mode_design/print_layouts/window_print_layout_edit.cc:
diff --git a/glom/mode_design/print_layouts/window_print_layout_edit.cc b/glom/mode_design/print_layouts/window_print_layout_edit.cc
index 4bf7003..b0841b5 100644
--- a/glom/mode_design/print_layouts/window_print_layout_edit.cc
+++ b/glom/mode_design/print_layouts/window_print_layout_edit.cc
@@ -35,7 +35,7 @@
 namespace Glom
 {
 
-const double GRID_GAP = 5.0f;
+const double GRID_GAP = 6.0f; //Roughly the right height for 12 point text.
 
 //Base the default item sizes on the grid gap, instead of being arbitrary:
 const double ITEM_HEIGHT = GRID_GAP;
@@ -400,8 +400,12 @@ sharedptr<LayoutItem> Window_PrintLayout_Edit::create_empty_item(PrintLayoutTool
 
   if(item_type == PrintLayoutToolbarButton::ITEM_FIELD)
   {
-    layout_item = sharedptr<LayoutItem_Field>::create();
+    sharedptr<LayoutItem_Field> layout_item_derived  = sharedptr<LayoutItem_Field>::create();
+    layout_item = layout_item_derived;
     layout_item->set_print_layout_position(0, 0, ITEM_WIDTH_WIDE, ITEM_HEIGHT);
+
+    //Don't use the field's default formatting, because that is probably only for on-screen layouts:
+    layout_item_derived->set_formatting_use_default(false);
   }
   else if(item_type == PrintLayoutToolbarButton::ITEM_TEXT)
   {
@@ -441,6 +445,14 @@ sharedptr<LayoutItem> Window_PrintLayout_Edit::create_empty_item(PrintLayoutTool
     std::cerr << G_STRFUNC << ": Unhandled item type: " << item_type << std::endl;
   }
 
+  //Set a default text style and size:
+  //12pt text seems sane. It is what OpenOffice/LibreOffice and Abiword use:
+  //Serif (rather than sans-serif) is sane for body text:
+  sharedptr<LayoutItem_WithFormatting> with_formatting = 
+    sharedptr<LayoutItem_WithFormatting>::cast_dynamic(layout_item);
+  if(with_formatting)
+    with_formatting->m_formatting.set_text_format_font("Serif 12");
+
   return layout_item;
 }
 
diff --git a/glom/mode_design/relationships_overview/canvas_group_dbtable.cc b/glom/mode_design/relationships_overview/canvas_group_dbtable.cc
index e9ade6b..91bd16a 100644
--- a/glom/mode_design/relationships_overview/canvas_group_dbtable.cc
+++ b/glom/mode_design/relationships_overview/canvas_group_dbtable.cc
@@ -93,7 +93,7 @@ CanvasGroupDbTable::CanvasGroupDbTable(const Glib::ustring& table_name, const Gl
     Glib::RefPtr<CanvasTextMovable> text_item = CanvasTextMovable::create(title, 
       x + margin, y + margin + field_y, m_table_width - margin*2,
       Goocanvas::ANCHOR_NORTH_WEST);
-    text_item->property_font() = "Sans 10"; //TODO: Let the user specify this.
+    text_item->property_font() = "Sans 12"; //TODO: Let the user specify this.
     text_item->property_use_markup() = true;
     text_item->set_movement_allowed(false, false); //Move only as part of the parent group.
     add_child(text_item);
diff --git a/glom/print_layout/canvas_layout_item.cc b/glom/print_layout/canvas_layout_item.cc
index 7ad456d..4c70fa9 100644
--- a/glom/print_layout/canvas_layout_item.cc
+++ b/glom/print_layout/canvas_layout_item.cc
@@ -94,11 +94,8 @@ void CanvasLayoutItem::apply_formatting(const Glib::RefPtr<CanvasTextMovable>& c
   Glib::ustring font = formatting.get_text_format_font();
   if(font.empty())
   {
+    //Just a sanity-check default that should never actually be used:
     font = "Serif 9";
-
-    //Set it in the input parameter,
-    //so that this is the default:
-    //TODO? formatting.set_text_format_font(font);
   }
 
   canvas_item->set_font_points(font);



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