[glom] Print Layout: Do not show navigation options for related records portals.



commit f104b165ee220b28c7ce86ca41a289a3306fd75a
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Aug 15 12:11:16 2011 +0200

    Print Layout: Do not show navigation options for related records portals.
    
    * glom/mode_design/layout/dialog_layout_list_related.[h|cc]:
      set_document(): Add a new bool parametrer that can hide the navigation
      widgets because they are useless in a print layout.
    * glom/print_layout/canvas_print_layout.cc: offer_related_records():
      Use the new bool parameter.
    * ui/developer/window_data_layout.glade: Correct some packing options so
      the right parts expand, without empty space.

 ChangeLog                                          |   12 +++
 glom/frame_glom.cc                                 |    1 -
 .../layout/dialog_layout_list_related.cc           |    8 ++-
 .../layout/dialog_layout_list_related.h            |    3 +-
 glom/print_layout/canvas_print_layout.cc           |    4 +-
 ui/developer/window_data_layout.glade              |   85 +++++++++-----------
 6 files changed, 63 insertions(+), 50 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b957192..9d71bcc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2011-08-15  Murray Cumming  <murrayc murrayc com>
+
+	Print Layout: Do not show navigation options for related records portals.
+
+	* glom/mode_design/layout/dialog_layout_list_related.[h|cc]:
+  set_document(): Add a new bool parametrer that can hide the navigation 
+  widgets because they are useless in a print layout.
+	* glom/print_layout/canvas_print_layout.cc: offer_related_records():
+  Use the new bool parameter.
+	* ui/developer/window_data_layout.glade: Correct some packing options so 
+  the right parts expand, without empty space.
+
 2011-08-13  Murray Cumming  <murrayc murrayc com>
 
 	Print Layout: Snap to rules even when the grid is not shown.
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index d421aaa..234a6af 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -2424,7 +2424,6 @@ void Frame_Glom::do_print_layout(const Glib::ustring& print_layout_name, bool pr
   canvas.set_print_layout(m_table_name, print_layout);
 
   //Do not show things that are only for editing the print layout:
-
   canvas.remove_grid();
   canvas.set_rules_visibility(false);
   canvas.set_outlines_visibility(false);
diff --git a/glom/mode_design/layout/dialog_layout_list_related.cc b/glom/mode_design/layout/dialog_layout_list_related.cc
index 19f7411..ec0f332 100644
--- a/glom/mode_design/layout/dialog_layout_list_related.cc
+++ b/glom/mode_design/layout/dialog_layout_list_related.cc
@@ -95,7 +95,7 @@ Dialog_Layout_List_Related::~Dialog_Layout_List_Related()
 }
 
 
-void Dialog_Layout_List_Related::set_document(const Glib::ustring& layout_name, const Glib::ustring& layout_platform, Document* document, const sharedptr<const LayoutItem_Portal>& portal, const Glib::ustring& from_table)
+void Dialog_Layout_List_Related::set_document(const Glib::ustring& layout_name, const Glib::ustring& layout_platform, Document* document, const sharedptr<const LayoutItem_Portal>& portal, const Glib::ustring& from_table, bool for_print_layout)
 {
   //Ignore the provided from_table if the portal has one:
   Glib::ustring actual_from_table;
@@ -120,6 +120,12 @@ void Dialog_Layout_List_Related::set_document(const Glib::ustring& layout_name,
   Dialog_Layout::set_document(layout_name, layout_platform, document, actual_from_table, empty_fields);
   //m_table_name is now actually the parent_table_name.
 
+  //Hide unwanted widgets:
+  if(for_print_layout)
+  {
+    m_box_related_navigation->hide();
+  }
+  
   update_ui();
 }
 
diff --git a/glom/mode_design/layout/dialog_layout_list_related.h b/glom/mode_design/layout/dialog_layout_list_related.h
index 57ed7f4..02a6fc9 100644
--- a/glom/mode_design/layout/dialog_layout_list_related.h
+++ b/glom/mode_design/layout/dialog_layout_list_related.h
@@ -42,8 +42,9 @@ public:
    * @param layout_platform As in the document. Empty or "maemo".
    * @param document The document, so that the dialog can load the previous layout, and save changes.
    * @param portal The layout item, which knows its from_table, for instance.
+   * @apram for_print_layout If true, don't show the navigation options, for instance.
    */
-  virtual void set_document(const Glib::ustring& layout_name, const Glib::ustring& layout_platform, Document* document, const sharedptr<const LayoutItem_Portal>& portal, const Glib::ustring& from_table);
+  virtual void set_document(const Glib::ustring& layout_name, const Glib::ustring& layout_platform, Document* document, const sharedptr<const LayoutItem_Portal>& portal, const Glib::ustring& from_table, bool for_print_layout = false);
 
   virtual void update_ui(bool including_relationships_list = true);
 
diff --git a/glom/print_layout/canvas_print_layout.cc b/glom/print_layout/canvas_print_layout.cc
index 1b6bd91..8c2b0de 100644
--- a/glom/print_layout/canvas_print_layout.cc
+++ b/glom/print_layout/canvas_print_layout.cc
@@ -333,7 +333,9 @@ sharedptr<LayoutItem_Portal> Canvas_PrintLayout::offer_related_records(const sha
 
   add_view(dialog); //Give it access to the document.
 
-  dialog->set_document("layout_name_unused_for_portals", "", /* layout_platform */ get_document(), portal, m_table_name);
+  dialog->set_document("layout_name_unused_for_portals", "", /* layout_platform */
+    get_document(), portal, m_table_name,
+    true /* for print layout */);
 
   if(parent)
     dialog->set_transient_for(*parent);
diff --git a/ui/developer/window_data_layout.glade b/ui/developer/window_data_layout.glade
index 6b2404e..aa2168d 100644
--- a/ui/developer/window_data_layout.glade
+++ b/ui/developer/window_data_layout.glade
@@ -238,7 +238,6 @@
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
-                            <property name="pack_type">end</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
@@ -294,7 +293,6 @@
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
-                            <property name="pack_type">end</property>
                             <property name="position">2</property>
                           </packing>
                         </child>
@@ -349,31 +347,30 @@
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
-                            <property name="pack_type">end</property>
                             <property name="position">3</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkButton" id="button_add_related">
+                          <object class="GtkButton" id="button_add_related_calendar">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="can_default">True</property>
                             <property name="receives_default">False</property>
-                            <property name="tooltip_text" translatable="yes">Add a related records portal. This is a list of records in a related table. Remember to edit this layout item to specify the relationship to use, and the fields to show from the related table.</property>
+                            <property name="tooltip_text" translatable="yes">Add a related records calendar portal. This is a calendar showing records from a related table. Remember to edit this layout item to specify the relationship to use, and the fields to show from the related table.</property>
                             <property name="use_action_appearance">False</property>
                             <child>
-                              <object class="GtkAlignment" id="alignment22">
+                              <object class="GtkAlignment" id="alignment1">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="xscale">0</property>
                                 <property name="yscale">0</property>
                                 <child>
-                                  <object class="GtkHBox" id="hbox29">
+                                  <object class="GtkHBox" id="hbox1">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
                                     <property name="spacing">2</property>
                                     <child>
-                                      <object class="GtkImage" id="image19">
+                                      <object class="GtkImage" id="image1">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
                                         <property name="stock">gtk-add</property>
@@ -385,10 +382,10 @@
                                       </packing>
                                     </child>
                                     <child>
-                                      <object class="GtkLabel" id="label74">
+                                      <object class="GtkLabel" id="label1">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
-                                        <property name="label" translatable="yes">Add Related Records</property>
+                                        <property name="label" translatable="yes">Add Related Calendar</property>
                                         <property name="use_underline">True</property>
                                       </object>
                                       <packing>
@@ -405,31 +402,30 @@
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
-                            <property name="pack_type">end</property>
                             <property name="position">4</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkButton" id="button_add_related_calendar">
+                          <object class="GtkButton" id="button_add_related">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="can_default">True</property>
                             <property name="receives_default">False</property>
-                            <property name="tooltip_text" translatable="yes">Add a related records calendar portal. This is a calendar showing records from a related table. Remember to edit this layout item to specify the relationship to use, and the fields to show from the related table.</property>
+                            <property name="tooltip_text" translatable="yes">Add a related records portal. This is a list of records in a related table. Remember to edit this layout item to specify the relationship to use, and the fields to show from the related table.</property>
                             <property name="use_action_appearance">False</property>
                             <child>
-                              <object class="GtkAlignment" id="alignment1">
+                              <object class="GtkAlignment" id="alignment22">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="xscale">0</property>
                                 <property name="yscale">0</property>
                                 <child>
-                                  <object class="GtkHBox" id="hbox1">
+                                  <object class="GtkHBox" id="hbox29">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
                                     <property name="spacing">2</property>
                                     <child>
-                                      <object class="GtkImage" id="image1">
+                                      <object class="GtkImage" id="image19">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
                                         <property name="stock">gtk-add</property>
@@ -441,10 +437,10 @@
                                       </packing>
                                     </child>
                                     <child>
-                                      <object class="GtkLabel" id="label1">
+                                      <object class="GtkLabel" id="label74">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
-                                        <property name="label" translatable="yes">Add Related Calendar</property>
+                                        <property name="label" translatable="yes">Add Related Records</property>
                                         <property name="use_underline">True</property>
                                       </object>
                                       <packing>
@@ -461,31 +457,30 @@
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
-                            <property name="pack_type">end</property>
                             <property name="position">4</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkButton" id="button_add_image">
+                          <object class="GtkButton" id="button_add_group">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="can_default">True</property>
                             <property name="receives_default">False</property>
-                            <property name="tooltip_text" translatable="yes">Add an image to the layout, such as a logo. The image will be the same for every record viewed. To show an image field from a record, to show different images for each field, use the field layout item.</property>
+                            <property name="tooltip_text" translatable="yes">Add a group which can contain other layout items. Use this to group items together, such as fields.</property>
                             <property name="use_action_appearance">False</property>
                             <child>
-                              <object class="GtkAlignment" id="alignment86">
+                              <object class="GtkAlignment" id="alignment17">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="xscale">0</property>
                                 <property name="yscale">0</property>
                                 <child>
-                                  <object class="GtkHBox" id="hbox110">
+                                  <object class="GtkHBox" id="hbox17">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
                                     <property name="spacing">2</property>
                                     <child>
-                                      <object class="GtkImage" id="image47">
+                                      <object class="GtkImage" id="image8">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
                                         <property name="stock">gtk-add</property>
@@ -497,10 +492,10 @@
                                       </packing>
                                     </child>
                                     <child>
-                                      <object class="GtkLabel" id="label240">
+                                      <object class="GtkLabel" id="label56">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
-                                        <property name="label">Add Image</property>
+                                        <property name="label" translatable="yes">Add _Group</property>
                                         <property name="use_underline">True</property>
                                       </object>
                                       <packing>
@@ -517,31 +512,30 @@
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
-                            <property name="pack_type">end</property>
                             <property name="position">5</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkButton" id="button_add_group">
+                          <object class="GtkButton" id="button_add_image">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="can_default">True</property>
                             <property name="receives_default">False</property>
-                            <property name="tooltip_text" translatable="yes">Add a group which can contain other layout items. Use this to group items together, such as fields.</property>
+                            <property name="tooltip_text" translatable="yes">Add an image to the layout, such as a logo. The image will be the same for every record viewed. To show an image field from a record, to show different images for each field, use the field layout item.</property>
                             <property name="use_action_appearance">False</property>
                             <child>
-                              <object class="GtkAlignment" id="alignment17">
+                              <object class="GtkAlignment" id="alignment86">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="xscale">0</property>
                                 <property name="yscale">0</property>
                                 <child>
-                                  <object class="GtkHBox" id="hbox17">
+                                  <object class="GtkHBox" id="hbox110">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
                                     <property name="spacing">2</property>
                                     <child>
-                                      <object class="GtkImage" id="image8">
+                                      <object class="GtkImage" id="image47">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
                                         <property name="stock">gtk-add</property>
@@ -553,10 +547,10 @@
                                       </packing>
                                     </child>
                                     <child>
-                                      <object class="GtkLabel" id="label56">
+                                      <object class="GtkLabel" id="label240">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
-                                        <property name="label" translatable="yes">Add _Group</property>
+                                        <property name="label">Add Image</property>
                                         <property name="use_underline">True</property>
                                       </object>
                                       <packing>
@@ -573,7 +567,6 @@
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
-                            <property name="pack_type">end</property>
                             <property name="position">5</property>
                           </packing>
                         </child>
@@ -629,7 +622,6 @@
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
-                            <property name="pack_type">end</property>
                             <property name="position">6</property>
                           </packing>
                         </child>
@@ -637,7 +629,8 @@
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="right_attach">2</property>
-                        <property name="x_options">GTK_FILL</property>
+                        <property name="x_options">GTK_SHRINK</property>
+                        <property name="y_options">GTK_SHRINK | GTK_FILL</property>
                       </packing>
                     </child>
                     <child>
@@ -795,7 +788,7 @@
                         <property name="top_attach">1</property>
                         <property name="bottom_attach">2</property>
                         <property name="x_options">GTK_FILL</property>
-                        <property name="y_options">GTK_FILL</property>
+                        <property name="y_options">GTK_SHRINK</property>
                       </packing>
                     </child>
                     <child>
@@ -944,15 +937,15 @@
                             <property name="can_focus">False</property>
                           </object>
                           <packing>
-                            <property name="expand">False</property>
+                            <property name="expand">True</property>
                             <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
                       </object>
                       <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
                         <property name="position">3</property>
                       </packing>
                     </child>
@@ -971,7 +964,7 @@
           </object>
           <packing>
             <property name="expand">False</property>
-            <property name="fill">True</property>
+            <property name="fill">False</property>
             <property name="position">2</property>
           </packing>
         </child>
@@ -1029,7 +1022,7 @@
           </object>
           <packing>
             <property name="expand">False</property>
-            <property name="fill">True</property>
+            <property name="fill">False</property>
             <property name="position">3</property>
           </packing>
         </child>
@@ -1058,7 +1051,7 @@
           </object>
           <packing>
             <property name="expand">False</property>
-            <property name="fill">True</property>
+            <property name="fill">False</property>
             <property name="pack_type">end</property>
             <property name="position">3</property>
           </packing>
@@ -1098,8 +1091,8 @@
             </child>
           </object>
           <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
             <property name="position">5</property>
           </packing>
         </child>



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