[glom/maemo5] LayoutGroup: Added accessors for columns count, hiding the member variable.



commit 23406ba11310336b64644cec94a414e883bbedeb
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Sep 29 11:49:37 2009 +0200

    LayoutGroup: Added accessors for columns count, hiding the member variable.
    
    * glom/libglom/data_structure/layout/layoutgroup.[h|cc]: Made m_columns_count
    private and added get/set_columns_count() so I can see when this is changing.
    * glom/libglom/data_structure/layout/layoutgroup.h:
    * glom/libglom/document/document.cc:
    * glom/mode_data/flowtablewithfields.cc:
    * glom/utility_widgets/dialog_flowtable.cc: Adapted.

 ChangeLog                                         |   11 +++++++++++
 glom/libglom/data_structure/layout/layoutgroup.cc |    9 +++++++++
 glom/libglom/data_structure/layout/layoutgroup.h  |    7 +++++--
 glom/libglom/document/document.cc                 |   11 ++++++-----
 glom/mode_data/flowtablewithfields.cc             |    6 +++---
 glom/utility_widgets/dialog_flowtable.cc          |    2 +-
 6 files changed, 35 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index aa82eab..3cd2cd0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2009-09-29  Murray Cumming  <murrayc murrayc com>
 
+	LayoutGroup: Added accessors for columns count, hiding the member variable.
+	
+	* glom/libglom/data_structure/layout/layoutgroup.[h|cc]: Made m_columns_count 
+	private and added get/set_columns_count() so I can see when this is changing.
+	* glom/libglom/data_structure/layout/layoutgroup.h:
+	* glom/libglom/document/document.cc:
+	* glom/mode_data/flowtablewithfields.cc:
+	* glom/utility_widgets/dialog_flowtable.cc: Adapted.
+
+2009-09-29  Murray Cumming  <murrayc murrayc com>
+
 	Maemo: Actually allow details to be opened.
 	
 	* glom/utility_widgets/db_adddel/db_adddel.cc: get_item_selected():
diff --git a/glom/libglom/data_structure/layout/layoutgroup.cc b/glom/libglom/data_structure/layout/layoutgroup.cc
index 06cac72..0ac3d26 100644
--- a/glom/libglom/data_structure/layout/layoutgroup.cc
+++ b/glom/libglom/data_structure/layout/layoutgroup.cc
@@ -415,7 +415,16 @@ void LayoutGroup::debug(guint level) const
 }
 */
 
+guint LayoutGroup::get_columns_count() const
+{
+  return m_columns_count;
+}
 
+void LayoutGroup::set_columns_count(guint columns_count)
+{
+  m_columns_count = columns_count;
+}
+  
 double LayoutGroup::get_border_width() const
 {
   return m_border_width;
diff --git a/glom/libglom/data_structure/layout/layoutgroup.h b/glom/libglom/data_structure/layout/layoutgroup.h
index 9b01691..7baf9cd 100644
--- a/glom/libglom/data_structure/layout/layoutgroup.h
+++ b/glom/libglom/data_structure/layout/layoutgroup.h
@@ -92,8 +92,9 @@ public:
 
   guint get_items_count() const;
 
-  guint m_columns_count;
-
+  guint get_columns_count() const;
+  void set_columns_count(guint columns_count);
+  
   typedef std::vector< sharedptr<LayoutItem> > type_list_items;
   type_list_items get_items();
 
@@ -109,6 +110,8 @@ public:
 
 private:
 
+  guint m_columns_count;
+
   double m_border_width; //For use on reports.
 };
 
diff --git a/glom/libglom/document/document.cc b/glom/libglom/document/document.cc
index 96bd562..95f698a 100644
--- a/glom/libglom/document/document.cc
+++ b/glom/libglom/document/document.cc
@@ -1428,7 +1428,7 @@ Document::type_list_layout_groups Document::get_data_layout_groups_default(const
 
   sharedptr<LayoutGroup> group = sharedptr<LayoutGroup>::create();
   group->set_name("main");
-  group->m_columns_count = 1;
+  group->set_columns_count(1);
   result.push_back(group);
   pTopLevel = group;
 
@@ -1437,7 +1437,7 @@ Document::type_list_layout_groups Document::get_data_layout_groups_default(const
     sharedptr<LayoutGroup> overview = sharedptr<LayoutGroup>::create();;
     overview->set_name("overview");
     overview->set_title_original("Overview"); //Don't translate this, but TODO: add standard translations.
-    overview->m_columns_count = 2;
+    overview->set_columns_count(2);
 
     pTopLevel->add_item(overview);
     pOverview = sharedptr<LayoutGroup>::cast_dynamic(overview);
@@ -1445,7 +1445,7 @@ Document::type_list_layout_groups Document::get_data_layout_groups_default(const
     sharedptr<LayoutGroup> details = sharedptr<LayoutGroup>::create();
     details->set_name("details");
     details->set_title_original("Details"); //Don't translate this, but TODO: add standard translations.
-    details->m_columns_count = 2;
+    details->set_columns_count(2);
     
     pTopLevel->add_item(details);
     pDetails = sharedptr<LayoutGroup>::cast_dynamic(details);
@@ -2011,7 +2011,8 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
   //Get the group details:
   group->set_name( get_node_attribute_value(node, GLOM_ATTRIBUTE_NAME) );
   group->set_title( get_node_attribute_value(node, GLOM_ATTRIBUTE_TITLE) );
-  group->m_columns_count = get_node_attribute_value_as_decimal(node, GLOM_ATTRIBUTE_COLUMNS_COUNT, 1); //default to 1, because 0 is meaningless.
+  group->set_columns_count(
+    get_node_attribute_value_as_decimal(node, GLOM_ATTRIBUTE_COLUMNS_COUNT, 1)); //default to 1, because 0 is meaningless.
   group->set_border_width( get_node_attribute_value_as_decimal_double(node, GLOM_ATTRIBUTE_BORDER_WIDTH) );
 
   //Translations:
@@ -3051,7 +3052,7 @@ void Document::save_before_layout_group(xmlpp::Element* node, const sharedptr<co
     return;
 
   set_node_attribute_value(child, GLOM_ATTRIBUTE_NAME, group->get_name());
-  set_node_attribute_value_as_decimal(child, GLOM_ATTRIBUTE_COLUMNS_COUNT, group->m_columns_count, 1); //Default to 1 because 0 is meaningless.
+  set_node_attribute_value_as_decimal(child, GLOM_ATTRIBUTE_COLUMNS_COUNT, group->get_columns_count(), 1); //Default to 1 because 0 is meaningless.
 
   set_node_attribute_value_as_decimal_double(child, GLOM_ATTRIBUTE_BORDER_WIDTH, group->get_border_width());
 
diff --git a/glom/mode_data/flowtablewithfields.cc b/glom/mode_data/flowtablewithfields.cc
index a0b901f..0f11320 100644
--- a/glom/mode_data/flowtablewithfields.cc
+++ b/glom/mode_data/flowtablewithfields.cc
@@ -202,7 +202,7 @@ void FlowTableWithFields::add_layout_group_at_position(const sharedptr<LayoutGro
     add_view(flow_table); //Allow these sub-flowtables to access the document too.
     flow_table->set_table(m_table_name);
 
-    flow_table->set_columns_count(group->m_columns_count);
+    flow_table->set_columns_count(group->get_columns_count());
     flow_table->set_padding(Utils::DEFAULT_SPACING_SMALL);
     flow_table->show();
     
@@ -387,7 +387,7 @@ void FlowTableWithFields::add_layout_notebook_at_position(const sharedptr<Layout
         add_view(flow_table); //Allow these sub-flowtables to access the document too.
         flow_table->set_table(m_table_name);
 
-        flow_table->set_columns_count(group->m_columns_count);
+        flow_table->set_columns_count(group->get_columns_count());
         flow_table->set_padding(Utils::DEFAULT_SPACING_SMALL);
         flow_table->show();
         
@@ -1406,7 +1406,7 @@ void FlowTableWithFields::on_menu_properties_activate()
       if(response == Gtk::RESPONSE_OK)
       {
         sharedptr<LayoutGroup> group = get_layout_group();
-        group->m_columns_count = dialog->get_columns_count();
+        group->set_columns_count( dialog->get_columns_count() );
         group->set_title(dialog->get_title());
         signal_layout_changed().emit();
       }
diff --git a/glom/utility_widgets/dialog_flowtable.cc b/glom/utility_widgets/dialog_flowtable.cc
index 1493af6..03fa6b0 100644
--- a/glom/utility_widgets/dialog_flowtable.cc
+++ b/glom/utility_widgets/dialog_flowtable.cc
@@ -46,7 +46,7 @@ void Dialog_FlowTable::set_flowtable(FlowTableWithFields* flowtable)
   m_flowtable = flowtable;
   m_layoutgroup = sharedptr<LayoutGroup>::cast_dynamic(flowtable->get_layout_item());
   m_entry_title->set_text(m_layoutgroup->get_title());
-  m_spin_columns->set_value(m_layoutgroup->m_columns_count);
+  m_spin_columns->set_value(m_layoutgroup->get_columns_count());
 }
 
 Glib::ustring Dialog_FlowTable::get_title()



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