[glom] TableInfo, Report, PrintLayout: Make member variables private.



commit 4a79c93ef6a10a1eec1b5eb7d7404e7f7ff09714
Author: Murray Cumming <murrayc murrayc com>
Date:   Sun Jan 29 22:55:59 2012 +0100

    TableInfo, Report, PrintLayout: Make member variables private.
    
    * glom/libglom/data_structure/print_layout.[h|cc]:
    * glom/libglom/data_structure/report.[h|cc]:
    * glom/libglom/data_structure/tableinfo.[h|cc]: Hide the member
    variables behind getters and setters.
    * glom/application.cc:
    * glom/base_db.cc:
    * glom/libglom/db_utils.cc:
    * glom/libglom/document/document.cc:
    * glom/libglom/report_builder.cc:
    * glom/mode_design/print_layouts/window_print_layout_edit.cc:
    * glom/mode_design/report_layout/dialog_layout_report.cc:
    * glom/navigation/box_tables.cc:
    * glom/print_layout/canvas_print_layout.[h|cc]:
    * glom/print_layout/print_layout_utils.cc:
    * tests/test_document_load.cc: Adapt.
    This avoids java-libglom from generating getM_*() and setM_*() methods,
    as well as being generally correct.

 ChangeLog                                          |   22 ++++++++
 glom/application.cc                                |    2 +-
 glom/base_db.cc                                    |    2 +-
 glom/libglom/data_structure/print_layout.cc        |   10 ++++
 glom/libglom/data_structure/print_layout.h         |    4 +-
 glom/libglom/data_structure/report.cc              |   11 ++++
 glom/libglom/data_structure/report.h               |    4 +-
 glom/libglom/data_structure/tableinfo.cc           |   26 ++++++++--
 glom/libglom/data_structure/tableinfo.h            |   19 ++++++-
 glom/libglom/db_utils.cc                           |    2 +-
 glom/libglom/document/document.cc                  |   55 +++++++++-----------
 glom/libglom/report_builder.cc                     |    5 +-
 .../print_layouts/window_print_layout_edit.cc      |   10 ++--
 .../report_layout/dialog_layout_report.cc          |   13 ++---
 glom/navigation/box_tables.cc                      |   12 ++--
 glom/print_layout/canvas_print_layout.cc           |    6 +-
 glom/print_layout/canvas_print_layout.h            |    2 +-
 glom/print_layout/print_layout_utils.cc            |    9 ++-
 tests/test_document_load.cc                        |    4 +-
 19 files changed, 146 insertions(+), 72 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d0c2336..729820c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,27 @@
 2012-01-29  Murray Cumming  <murrayc murrayc com>
 
+	TableInfo, Report, PrintLayout: Make member variables private.
+
+	* glom/libglom/data_structure/print_layout.[h|cc]:
+	* glom/libglom/data_structure/report.[h|cc]:
+	* glom/libglom/data_structure/tableinfo.[h|cc]: Hide the member
+	variables behind getters and setters.
+	* glom/application.cc:
+	* glom/base_db.cc:
+	* glom/libglom/db_utils.cc:
+	* glom/libglom/document/document.cc:
+	* glom/libglom/report_builder.cc:
+	* glom/mode_design/print_layouts/window_print_layout_edit.cc:
+	* glom/mode_design/report_layout/dialog_layout_report.cc:
+	* glom/navigation/box_tables.cc:
+	* glom/print_layout/canvas_print_layout.[h|cc]:
+	* glom/print_layout/print_layout_utils.cc:
+	* tests/test_document_load.cc: Adapt.
+	This avoids java-libglom generating getM_*() and setM_*() methods,
+	as well as being generally correct.
+
+2012-01-29  Murray Cumming  <murrayc murrayc com>
+
 	Database Preferences: Really store the organization name in the database.
 
 	* glom/libglom/db_utils.cc: set_database_preferences(): Also UPDATE
diff --git a/glom/application.cc b/glom/application.cc
index baa35b9..b4b3712 100644
--- a/glom/application.cc
+++ b/glom/application.cc
@@ -2003,7 +2003,7 @@ void Application::fill_menu_tables()
   for(Document::type_listTableInfo::const_iterator iter = tables.begin(); iter != tables.end(); ++iter)
   {
     sharedptr<const TableInfo> table_info = *iter;
-    if(!table_info->m_hidden)
+    if(!table_info->get_hidden())
     {
       const Glib::ustring action_name = "NavTableAction_" + table_info->get_name();
 
diff --git a/glom/base_db.cc b/glom/base_db.cc
index 936eeed..be2ec2a 100644
--- a/glom/base_db.cc
+++ b/glom/base_db.cc
@@ -758,7 +758,7 @@ Base_DB::type_vecConstLayoutFields Base_DB::get_table_fields_to_show_for_sequenc
       {
         sharedptr<LayoutGroup> group = *iter;
 
-        if(true) //!group->m_hidden)
+        if(true) //!group->get_hidden())
         {
           //Get the fields:
           get_table_fields_to_show_for_sequence_add_group(table_name, table_privs, all_fields, group, result);
diff --git a/glom/libglom/data_structure/print_layout.cc b/glom/libglom/data_structure/print_layout.cc
index 84caa51..191d917 100644
--- a/glom/libglom/data_structure/print_layout.cc
+++ b/glom/libglom/data_structure/print_layout.cc
@@ -75,6 +75,16 @@ void PrintLayout::set_show_table_title(bool show_table_title)
   m_show_table_title = show_table_title;
 }
 
+sharedptr<LayoutGroup> PrintLayout::get_layout_group()
+{
+  return m_layout_group;
+}
+
+sharedptr<const LayoutGroup> PrintLayout::get_layout_group() const
+{
+  return m_layout_group;
+}
+
 void PrintLayout::set_page_setup(const std::string& page_setup)
 {
   m_page_setup = page_setup;
diff --git a/glom/libglom/data_structure/print_layout.h b/glom/libglom/data_structure/print_layout.h
index 58da376..456cd67 100644
--- a/glom/libglom/data_structure/print_layout.h
+++ b/glom/libglom/data_structure/print_layout.h
@@ -38,7 +38,8 @@ public:
   bool get_show_table_title() const;
   void set_show_table_title(bool show_table_title = true);
 
-  sharedptr<LayoutGroup> m_layout_group;
+  sharedptr<LayoutGroup> get_layout_group();
+  sharedptr<const LayoutGroup> get_layout_group() const;
 
   /** Sets the Page Setup as it would be created by a Gtk::PageSetup.
    */
@@ -73,6 +74,7 @@ public:
   void set_vertical_rules(const type_vec_doubles& rules);
 
 private:
+  sharedptr<LayoutGroup> m_layout_group;
   bool m_show_table_title;
 
   bool m_show_grid;
diff --git a/glom/libglom/data_structure/report.cc b/glom/libglom/data_structure/report.cc
index 1e0ca71..240c162 100644
--- a/glom/libglom/data_structure/report.cc
+++ b/glom/libglom/data_structure/report.cc
@@ -57,5 +57,16 @@ void Report::set_show_table_title(bool show_table_title)
   m_show_table_title = show_table_title;
 }
 
+
+sharedptr<LayoutGroup> Report::get_layout_group()
+{
+  return m_layout_group;
+}
+
+sharedptr<const LayoutGroup> Report::get_layout_group() const
+{
+  return m_layout_group;
+}
+
 } //namespace Glom
 
diff --git a/glom/libglom/data_structure/report.h b/glom/libglom/data_structure/report.h
index 376611a..2a98962 100644
--- a/glom/libglom/data_structure/report.h
+++ b/glom/libglom/data_structure/report.h
@@ -38,9 +38,11 @@ public:
   bool get_show_table_title() const;
   void set_show_table_title(bool show_table_title = true);
 
-  sharedptr<LayoutGroup> m_layout_group;
+  sharedptr<LayoutGroup> get_layout_group();
+  sharedptr<const LayoutGroup> get_layout_group() const;
 
 private:
+  sharedptr<LayoutGroup> m_layout_group;
   bool m_show_table_title;
 };
 
diff --git a/glom/libglom/data_structure/tableinfo.cc b/glom/libglom/data_structure/tableinfo.cc
index 3abe43b..baffef1 100644
--- a/glom/libglom/data_structure/tableinfo.cc
+++ b/glom/libglom/data_structure/tableinfo.cc
@@ -24,8 +24,7 @@ namespace Glom
 {
 
 TableInfo::TableInfo()
-: m_sequence(0),
-  m_hidden(false),
+: m_hidden(false),
   m_default(false)
 {
   m_translatable_item_type = TRANSLATABLE_TYPE_TABLE;
@@ -34,7 +33,6 @@ TableInfo::TableInfo()
 TableInfo::TableInfo(const TableInfo& src)
 : TranslatableItem(src),
   HasTitleSingular(src),
-  m_sequence(src.m_sequence),
   m_hidden(src.m_hidden),
   m_default(src.m_default)
 {
@@ -44,13 +42,31 @@ TableInfo& TableInfo::operator=(const TableInfo& src)
 {
   TranslatableItem::operator=(src);
   HasTitleSingular::operator=(src);
-  
-  m_sequence = src.m_sequence;
+
   m_hidden = src.m_hidden;
   m_default = src.m_default;
 
   return *this;
 }
 
+bool TableInfo::get_hidden() const
+{
+  return m_hidden;
+}
+
+void TableInfo::set_hidden(bool val)
+{
+  m_hidden = val;
+}
+
+bool TableInfo::get_default() const
+{
+  return m_default;
+}
+
+void TableInfo::set_default(bool val)
+{
+  m_default = val;
+}
 
 } //namespace Glom
diff --git a/glom/libglom/data_structure/tableinfo.h b/glom/libglom/data_structure/tableinfo.h
index f74a9ef..b349660 100644
--- a/glom/libglom/data_structure/tableinfo.h
+++ b/glom/libglom/data_structure/tableinfo.h
@@ -36,7 +36,24 @@ public:
   TableInfo(const TableInfo& src);
   TableInfo& operator=(const TableInfo& src);
 
-  guint m_sequence; //TODO: Use this?
+  /** Returns true if this table should not be shown in the list of tables when in operator mode.
+   */
+  bool get_hidden() const;
+
+  /** See get_default().
+   */
+  void set_hidden(bool val = true);
+
+  /** Returns true if this table should be shown when the system is opened.
+   * Only one table can be the default table.
+   */
+  bool get_default() const;
+
+  /** See get_default().
+   */
+  void set_default(bool val = true);
+
+private:
   bool m_hidden;
   bool m_default;
 };
diff --git a/glom/libglom/db_utils.cc b/glom/libglom/db_utils.cc
index 6f35ec5..d7966bf 100644
--- a/glom/libglom/db_utils.cc
+++ b/glom/libglom/db_utils.cc
@@ -501,7 +501,7 @@ bool add_standard_tables(Document* document)
       sharedptr<TableInfo> table_info(new TableInfo());
       table_info->set_name(GLOM_STANDARD_TABLE_AUTOINCREMENTS_TABLE_NAME);
       table_info->set_title_original(_("System: Auto Increments"));
-      table_info->m_hidden = true;
+      table_info->set_hidden(true);
 
       Document::type_vec_fields fields;
 
diff --git a/glom/libglom/document/document.cc b/glom/libglom/document/document.cc
index b4bcc59..d803801 100644
--- a/glom/libglom/document/document.cc
+++ b/glom/libglom/document/document.cc
@@ -523,7 +523,7 @@ sharedptr<TableInfo> Document::create_table_system_preferences(type_vec_fields&
   sharedptr<TableInfo> prefs_table_info = sharedptr<TableInfo>::create();
   prefs_table_info->set_name(GLOM_STANDARD_TABLE_PREFS_TABLE_NAME);
   prefs_table_info->set_title_original(_("System Preferences"));
-  prefs_table_info->m_hidden = true;
+  prefs_table_info->set_hidden(true);
 
 
   fields.clear();
@@ -707,7 +707,7 @@ void Document::remove_relationship(const sharedptr<const Relationship>& relation
     for(DocumentTableInfo::type_reports::iterator iterReports = info.m_reports.begin(); iterReports != info.m_reports.end(); ++iterReports)
     {
       sharedptr<Report> report = iterReports->second;
-      sharedptr<LayoutGroup> group = report->m_layout_group;
+      sharedptr<LayoutGroup> group = report->get_layout_group();
 
       //Remove the field wherever it is a related field:
       group->remove_relationship(relationship);
@@ -785,7 +785,7 @@ void Document::remove_field(const Glib::ustring& table_name, const Glib::ustring
     for(DocumentTableInfo::type_reports::iterator iterReports = info.m_reports.begin(); iterReports != info.m_reports.end(); ++iterReports)
     {
       sharedptr<Report> report = iterReports->second;
-      sharedptr<LayoutGroup> group = report->m_layout_group;
+      sharedptr<LayoutGroup> group = report->get_layout_group();
 
       //Remove regular fields if the field is in this layout's table:
       const Glib::ustring layout_table_name = info.m_info->get_name();
@@ -1008,9 +1008,9 @@ void Document::change_field_name(const Glib::ustring& table_name, const Glib::us
         if(report)
         {
           if(is_parent_table)
-            report->m_layout_group->change_field_item_name(table_name, strFieldNameOld, strFieldNameNew);
+            report->get_layout_group()->change_field_item_name(table_name, strFieldNameOld, strFieldNameNew);
           else
-            report->m_layout_group->change_related_field_item_name(table_name, strFieldNameOld, strFieldNameNew);
+            report->get_layout_group()->change_related_field_item_name(table_name, strFieldNameOld, strFieldNameNew);
         }
       }
 
@@ -1111,9 +1111,9 @@ void Document::change_relationship_name(const Glib::ustring& table_name, const G
       {
         //Change the field if it is in this group:
         if(is_parent_table)
-          iterReports->second->m_layout_group->change_relationship_name(table_name, name, name_new);
+          iterReports->second->get_layout_group()->change_relationship_name(table_name, name, name_new);
         else
-          iterReports->second->m_layout_group->change_related_relationship_name(table_name, name, name_new);
+          iterReports->second->get_layout_group()->change_related_relationship_name(table_name, name, name_new);
       }
       */
 
@@ -1817,7 +1817,7 @@ bool Document::get_table_is_hidden(const Glib::ustring& table_name) const
 {
   type_tables::const_iterator iterFind = m_tables.find(table_name);
   if(iterFind != m_tables.end())
-    return iterFind->second.m_info->m_hidden;
+    return iterFind->second.m_info->get_hidden();
   else
     return false; //It's not even known.
 }
@@ -1906,8 +1906,9 @@ Glib::ustring Document::get_default_table() const
 {
   for(type_tables::const_iterator iter = m_tables.begin(); iter != m_tables.end(); ++iter)
   {
-    if(iter->second.m_info->m_default)
-      return iter->second.m_info->get_name();
+    const sharedptr<const TableInfo> info = iter->second.m_info;
+    if(info && info->get_default())
+      return info->get_name();
   }
 
   //If there is only one table then pretend that is the default:
@@ -2750,8 +2751,8 @@ bool Document::load_after(int& failure_code)
 
           sharedptr<TableInfo> table_info(new TableInfo());
           table_info->set_name(table_name);
-          table_info->m_hidden = get_node_attribute_value_as_bool(nodeTable, GLOM_ATTRIBUTE_HIDDEN);
-          table_info->m_default = get_node_attribute_value_as_bool(nodeTable, GLOM_ATTRIBUTE_DEFAULT);
+          table_info->set_hidden( get_node_attribute_value_as_bool(nodeTable, GLOM_ATTRIBUTE_HIDDEN) );
+          table_info->set_default( get_node_attribute_value_as_bool(nodeTable, GLOM_ATTRIBUTE_DEFAULT) );
 
           doctableinfo.m_info = table_info;
 
@@ -3007,12 +3008,11 @@ bool Document::load_after(int& failure_code)
                     const xmlpp::Element* node = dynamic_cast<const xmlpp::Element*>(*iter);
                     if(node)
                     {
-                      sharedptr<LayoutGroup> group = sharedptr<LayoutGroup>::create();
+                      sharedptr<LayoutGroup> group = report->get_layout_group();
+                      group->remove_all_items();
                       load_after_layout_group(node, table_name, group);
 
-                      report->m_layout_group = group; //TODO: Get rid of the for loop here.
-
-                      fill_layout_field_details(table_name, report->m_layout_group); //Get full field details from the field names.
+                      fill_layout_field_details(table_name, group); //Get full field details from the field names.
                     }
                   }
                 }
@@ -3097,12 +3097,11 @@ bool Document::load_after(int& failure_code)
                     const xmlpp::Element* node = dynamic_cast<const xmlpp::Element*>(*iter);
                     if(node)
                     {
-                      sharedptr<LayoutGroup> group = sharedptr<LayoutGroup>::create();
+                      sharedptr<LayoutGroup> group = print_layout->get_layout_group();
+                      group->remove_all_items();
                       load_after_layout_group(node, table_name, group, true /* load positions too. */);
 
-                      print_layout->m_layout_group = group; //TODO: Get rid of the for loop here.
-
-                      fill_layout_field_details(table_name, print_layout->m_layout_group); //Get full field details from the field names.
+                      fill_layout_field_details(table_name, group); //Get full field details from the field names.
                     }
                   }
                 }
@@ -3785,8 +3784,8 @@ bool Document::save_before()
       {
         xmlpp::Element* nodeTable = nodeRoot->add_child(GLOM_NODE_TABLE);
         set_node_attribute_value(nodeTable, GLOM_ATTRIBUTE_NAME, table_name);
-        set_node_attribute_value_as_bool(nodeTable, GLOM_ATTRIBUTE_HIDDEN, doctableinfo.m_info->m_hidden);
-        set_node_attribute_value_as_bool(nodeTable, GLOM_ATTRIBUTE_DEFAULT, doctableinfo.m_info->m_default);
+        set_node_attribute_value_as_bool(nodeTable, GLOM_ATTRIBUTE_HIDDEN, doctableinfo.m_info->get_hidden());
+        set_node_attribute_value_as_bool(nodeTable, GLOM_ATTRIBUTE_DEFAULT, doctableinfo.m_info->get_default());
 
         set_node_attribute_value_as_float(nodeTable, GLOM_ATTRIBUTE_OVERVIEW_X, doctableinfo.m_overviewx);
         set_node_attribute_value_as_float(nodeTable, GLOM_ATTRIBUTE_OVERVIEW_Y, doctableinfo.m_overviewy);
@@ -3921,10 +3920,7 @@ bool Document::save_before()
           set_node_attribute_value_as_bool(nodeReport, GLOM_ATTRIBUTE_REPORT_SHOW_TABLE_TITLE, report->get_show_table_title());
 
           xmlpp::Element* nodeGroups = nodeReport->add_child(GLOM_NODE_DATA_LAYOUT_GROUPS);
-          if(report->m_layout_group)
-          {
-            save_before_layout_group(nodeGroups, report->m_layout_group);
-          }
+          save_before_layout_group(nodeGroups, report->get_layout_group());
 
           //Translations:
           save_before_translations(nodeReport, report);
@@ -3975,10 +3971,7 @@ bool Document::save_before()
             print_layout->get_page_count(), 1);
 
           xmlpp::Element* nodeGroups = nodePrintLayout->add_child(GLOM_NODE_DATA_LAYOUT_GROUPS);
-          if(print_layout->m_layout_group)
-          {
-            save_before_layout_group(nodeGroups, print_layout->m_layout_group, true /* x,y positions too. */);
-          }
+          save_before_layout_group(nodeGroups, print_layout->get_layout_group(), true /* x,y positions too. */);
 
           //Translations:
           save_before_translations(nodePrintLayout, print_layout);
@@ -4549,7 +4542,7 @@ Document::type_list_translatables Document::get_translatable_report_items(const
 
   sharedptr<Report> report = get_report(table_name, report_title);
   if(report)
-    fill_translatable_layout_items(report->m_layout_group, the_list, hint);
+    fill_translatable_layout_items(report->get_layout_group(), the_list, hint);
 
   return the_list;
 }
diff --git a/glom/libglom/report_builder.cc b/glom/libglom/report_builder.cc
index fdda4db..ea3d8bb 100644
--- a/glom/libglom/report_builder.cc
+++ b/glom/libglom/report_builder.cc
@@ -563,7 +563,8 @@ Glib::ustring ReportBuilder::report_build(const FoundSet& found_set, const share
 
   type_vecLayoutItems itemsToGet_TopLevel;
 
-  for(LayoutGroup::type_list_items::const_iterator iter = report->m_layout_group->m_list_items.begin(); iter != report->m_layout_group->m_list_items.end(); ++iter)
+  const sharedptr<const LayoutGroup> group = report->get_layout_group();
+  for(LayoutGroup::type_list_items::const_iterator iter = group->m_list_items.begin(); iter != group->m_list_items.end(); ++iter)
   {
     sharedptr<LayoutItem> pPart = *iter;
 
@@ -623,7 +624,7 @@ static void fill_standard_list_report_fill(const sharedptr<Report>& report, cons
       continue;
 
     const sharedptr<LayoutItem> unconst = sharedptr<LayoutItem>::cast_const(item); //TODO: Avoid this?
-    report->m_layout_group->add_item(unconst);
+    report->get_layout_group()->add_item(unconst);
   }
 }
 
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 171ea05..bd62a44 100644
--- a/glom/mode_design/print_layouts/window_print_layout_edit.cc
+++ b/glom/mode_design/print_layouts/window_print_layout_edit.cc
@@ -714,24 +714,22 @@ sharedptr<PrintLayout> Window_PrintLayout_Edit::get_print_layout()
   m_print_layout->set_vertical_rules( m_canvas.get_vertical_rules() );
 
 /*
-  m_print_layout->m_layout_group->remove_all_items();
-
-  m_print_layout->m_layout_group->remove_all_items();
+  m_print_layout->get_layout_group()->remove_all_items();
 
   //The Header and Footer parts are implicit (they are the whole header or footer treeview)
   sharedptr<LayoutItem_Header> header = sharedptr<LayoutItem_Header>::create();
   sharedptr<LayoutGroup> group_temp = header;
   fill_print_layout_parts(group_temp, m_model_parts_header);
   if(header->get_items_count())
-    m_print_layout->m_layout_group->add_item(header);
+    m_print_layout->get_layout_group()->add_item(header);
 
-  fill_print_layout_parts(m_print_layout->m_layout_group, m_model_parts_main);
+  fill_print_layout_parts(m_print_layout->get_layout_group(), m_model_parts_main);
 
   sharedptr<LayoutItem_Footer> footer = sharedptr<LayoutItem_Footer>::create();
   group_temp = footer;
   fill_print_layout_parts(group_temp, m_model_parts_footer);
   if(footer->get_items_count())
-    m_print_layout->m_layout_group->add_item(footer);
+    m_print_layout->get_layout_group()->add_item(footer);
 
 */
   return m_print_layout;
diff --git a/glom/mode_design/report_layout/dialog_layout_report.cc b/glom/mode_design/report_layout/dialog_layout_report.cc
index c848685..0c637ef 100644
--- a/glom/mode_design/report_layout/dialog_layout_report.cc
+++ b/glom/mode_design/report_layout/dialog_layout_report.cc
@@ -370,7 +370,7 @@ void Dialog_Layout_Report::set_report(const Glib::ustring& table_name, const sha
     m_model_parts_footer->clear();
 
     //Add most parts to main, adding any found header or footer chidlren to those other models:
-    add_group_children(m_model_parts_main, Gtk::TreeModel::iterator() /* null == top-level */, report->m_layout_group);
+    add_group_children(m_model_parts_main, Gtk::TreeModel::iterator() /* null == top-level */, report->get_layout_group());
 
     //treeview_fill_sequences(m_model_parts_main, m_model_parts_main->m_columns.m_col_sequence); //The document should have checked this already, but it does not hurt to check again.
   }
@@ -1012,24 +1012,23 @@ sharedptr<Report> Dialog_Layout_Report::get_report()
   m_report->set_title( m_entry_title->get_text() , Application::get_current_locale());
   m_report->set_show_table_title( m_checkbutton_table_title->get_active() );
 
-  m_report->m_layout_group->remove_all_items();
-
-  m_report->m_layout_group->remove_all_items();
+  sharedptr<LayoutGroup> group = m_report->get_layout_group();
+  group->remove_all_items();
 
   //The Header and Footer parts are implicit (they are the whole header or footer treeview)
   sharedptr<LayoutItem_Header> header = sharedptr<LayoutItem_Header>::create();
   sharedptr<LayoutGroup> group_temp = header;
   fill_report_parts(group_temp, m_model_parts_header);
   if(header->get_items_count())
-    m_report->m_layout_group->add_item(header);
+    group->add_item(header);
 
-  fill_report_parts(m_report->m_layout_group, m_model_parts_main);
+  fill_report_parts(group, m_model_parts_main);
 
   sharedptr<LayoutItem_Footer> footer = sharedptr<LayoutItem_Footer>::create();
   group_temp = footer;
   fill_report_parts(group_temp, m_model_parts_footer);
   if(footer->get_items_count())
-    m_report->m_layout_group->add_item(footer);
+    group->add_item(footer);
 
   return m_report;
 }
diff --git a/glom/navigation/box_tables.cc b/glom/navigation/box_tables.cc
index 767ceab..3d9eb97 100644
--- a/glom/navigation/box_tables.cc
+++ b/glom/navigation/box_tables.cc
@@ -85,7 +85,7 @@ void Box_Tables::fill_table_row(const Gtk::TreeModel::iterator& iter, const shar
 
     m_AddDel.set_value_key(iter, table_info->get_name());
     m_AddDel.set_value(iter, m_colTableName, table_info->get_name());
-    m_AddDel.set_value(iter, m_colHidden, table_info->m_hidden);
+    m_AddDel.set_value(iter, m_colHidden, table_info->get_hidden());
 
     if(developer_mode)
     {
@@ -99,7 +99,7 @@ void Box_Tables::fill_table_row(const Gtk::TreeModel::iterator& iter, const shar
       m_AddDel.set_value(iter, m_colTitle, item_get_title_or_name(table_info));
     }
 
-    m_AddDel.set_value(iter, m_colDefault, table_info->m_default);
+    m_AddDel.set_value(iter, m_colDefault, table_info->get_default());
   }
 }
 
@@ -183,10 +183,10 @@ bool Box_Tables::fill_from_database()
         //Show it as hidden:
         table_info = sharedptr<TableInfo>(new TableInfo());
         table_info->set_name(strName);
-        table_info->m_hidden = true;
+        table_info->set_hidden(true);
       }
 
-      const bool hidden = table_info->m_hidden;
+      const bool hidden = table_info->get_hidden();
 
       bool bAddIt = true;
       if(hidden && !developer_mode) //Don't add hidden tables unless we are in developer mode:
@@ -477,11 +477,11 @@ void Box_Tables::save_to_document()
 
         if(!table_info->get_name().empty())
         {
-          table_info->m_hidden = m_AddDel.get_value_as_bool(iter, m_colHidden);
+          table_info->set_hidden( m_AddDel.get_value_as_bool(iter, m_colHidden) );
           table_info->set_title( m_AddDel.get_value(iter, m_colTitle) , Application::get_current_locale()); //TODO_Translations: Store the TableInfo in the TreeView.
           table_info->set_title_singular( m_AddDel.get_value(iter, m_colTitleSingular), Application::get_current_locale()); //TODO_Translations: Store the TableInfo in the TreeView.
           //std::cout << "debug: " << G_STRFUNC << ": title=" << item_get_title(table_info) << std::endl;
-          table_info->m_default = m_AddDel.get_value_as_bool(iter, m_colDefault);
+          table_info->set_default( m_AddDel.get_value_as_bool(iter, m_colDefault) );
 
           listTables.push_back(table_info);
         }
diff --git a/glom/print_layout/canvas_print_layout.cc b/glom/print_layout/canvas_print_layout.cc
index d6a1433..fa08e95 100644
--- a/glom/print_layout/canvas_print_layout.cc
+++ b/glom/print_layout/canvas_print_layout.cc
@@ -70,13 +70,13 @@ Canvas_PrintLayout::~Canvas_PrintLayout()
 {
 }
 
-void Canvas_PrintLayout::set_print_layout(const Glib::ustring& table_name, const sharedptr<const PrintLayout>& print_layout)
+void Canvas_PrintLayout::set_print_layout(const Glib::ustring& table_name, const sharedptr<PrintLayout>& print_layout)
 {
   m_table_name = table_name;
   m_modified = false;
 
   remove_all_items(m_items_group);
-  add_layout_group(print_layout->m_layout_group, true /* is top-level */);
+  add_layout_group(print_layout->get_layout_group(), true /* is top-level */);
 
   //Use the page setup:
   const Glib::ustring key_file_text = print_layout->get_page_setup();
@@ -121,7 +121,7 @@ void Canvas_PrintLayout::set_print_layout(const Glib::ustring& table_name, const
 sharedptr<PrintLayout> Canvas_PrintLayout::get_print_layout()
 {
   sharedptr<PrintLayout> result = sharedptr<PrintLayout>::create();
-  fill_layout_group(result->m_layout_group);
+  fill_layout_group(result->get_layout_group());
 
   //Page Setup:
   Glib::KeyFile key_file;
diff --git a/glom/print_layout/canvas_print_layout.h b/glom/print_layout/canvas_print_layout.h
index 20302be..9a560a2 100644
--- a/glom/print_layout/canvas_print_layout.h
+++ b/glom/print_layout/canvas_print_layout.h
@@ -45,7 +45,7 @@ public:
   Canvas_PrintLayout();
   virtual ~Canvas_PrintLayout();
 
-  void set_print_layout(const Glib::ustring& table_name, const sharedptr<const PrintLayout>& print_layout);
+  void set_print_layout(const Glib::ustring& table_name, const sharedptr<PrintLayout>& print_layout);
   sharedptr<PrintLayout> get_print_layout();
 
   void set_page_setup(const Glib::RefPtr<Gtk::PageSetup>& page_setup);
diff --git a/glom/print_layout/print_layout_utils.cc b/glom/print_layout/print_layout_utils.cc
index 335ae6f..e52c14f 100644
--- a/glom/print_layout/print_layout_utils.cc
+++ b/glom/print_layout/print_layout_utils.cc
@@ -340,7 +340,7 @@ sharedptr<PrintLayout> create_standard(const Glib::RefPtr<const Gtk::PageSetup>&
     text->set_print_layout_position(x, y, ITEM_WIDTH_WIDE, field_height); //TODO: Enough and no more.
     y += field_height + GRID_GAP; //padding.
 
-    print_layout->m_layout_group->add_item(text);
+    print_layout->get_layout_group()->add_item(text);
   }
 
   //The layout:
@@ -353,7 +353,7 @@ sharedptr<PrintLayout> create_standard(const Glib::RefPtr<const Gtk::PageSetup>&
     if(!group)
       continue;
 
-    create_standard(group, print_layout->m_layout_group, page_setup, units, x, y, avoid_page_margins);
+    create_standard(group, print_layout->get_layout_group(), page_setup, units, x, y, avoid_page_margins);
   }
 
   //Add extra pages if necessary:
@@ -392,7 +392,10 @@ void do_print_layout(const sharedptr<const PrintLayout>& print_layout, const Fou
 
   Canvas_PrintLayout canvas;
   canvas.set_document(const_cast<Document*>(document)); //We const_cast because, for this use, it will not be changed.
-  canvas.set_print_layout(found_set.m_table_name, print_layout);
+
+  //We cast to unconst because we know that the layout will not be changed by this use: 
+  sharedptr<PrintLayout> unconst = sharedptr<PrintLayout>::cast_const(print_layout);
+  canvas.set_print_layout(found_set.m_table_name, unconst);
 
   //Do not show things that are only for editing the print layout:
   canvas.remove_grid();
diff --git a/tests/test_document_load.cc b/tests/test_document_load.cc
index f749bb4..e6287a3 100644
--- a/tests/test_document_load.cc
+++ b/tests/test_document_load.cc
@@ -299,7 +299,7 @@ int main()
     return false;
   }
   
-  if(!print_layout->m_layout_group)
+  if(!print_layout->get_layout_group())
   {
     std::cerr << "Failure: The print layout has no layout group." << std::endl;
     return false;
@@ -333,7 +333,7 @@ int main()
     return false;
   }
   
-  if(!report->m_layout_group)
+  if(!report->get_layout_group())
   {
     std::cerr << "Failure: The report has no layout group." << std::endl;
     return false;



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