[glom] Remove some unnecessary padding/borders around the main window.



commit 1b6d962b398728318aa638e67f902be852b7084f
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Mar 8 13:34:25 2011 +0100

    Remove some unnecessary padding/borders around the main window.
    
    * glom/box_withbuttons.cc: Remove the border, because it is not useful.
    It would be for the parent widget to decide that.
    * glom/mode_data/flowtablewithfields.[h|cc]: add_group(): Add a with_indent
    optional parameter.
    * glom/mode_data/box_data_details.cc: create_layout(): Have no indent on
    top-level groups.

 ChangeLog                             |   11 +++++++++++
 glom/box_withbuttons.cc               |    4 ++--
 glom/mode_data/box_data_details.cc    |    2 +-
 glom/mode_data/flowtablewithfields.cc |   10 +++++-----
 glom/mode_data/flowtablewithfields.h  |    8 ++++++--
 5 files changed, 25 insertions(+), 10 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c1d1f47..c4f332a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2011-03-08  Murray Cumming  <murrayc murrayc com>
 
+	Remove some unnecessary padding/borders around the main window.
+
+	* glom/box_withbuttons.cc: Remove the border, because it is not useful.
+	It would be for the parent widget to decide that.
+	* glom/mode_data/flowtablewithfields.[h|cc]: add_group(): Add a with_indent
+	optional parameter.
+	* glom/mode_data/box_data_details.cc: create_layout(): Have no indent on
+	top-level groups.
+
+2011-03-08  Murray Cumming  <murrayc murrayc com>
+
 	Use a custom Notebook-like widget instead of Gtk::Notebook.
 
 	* glom/utility_widgets/notebook_noframe.[h|cc]: A new class with an API that
diff --git a/glom/box_withbuttons.cc b/glom/box_withbuttons.cc
index 49d7afa..1dd8a24 100644
--- a/glom/box_withbuttons.cc
+++ b/glom/box_withbuttons.cc
@@ -35,7 +35,7 @@ Box_WithButtons::Box_WithButtons()
 {
   //m_pDocument = 0;
 
-  set_border_width(Utils::DEFAULT_SPACING_SMALL);
+  //set_border_width(Utils::DEFAULT_SPACING_SMALL);
   set_spacing(Utils::DEFAULT_SPACING_SMALL);
 
   //Connect signals:
@@ -49,7 +49,7 @@ Box_WithButtons::Box_WithButtons(BaseObjectType* cobject, const Glib::RefPtr<Gtk
 {
   //m_pDocument = 0;
 
-  set_border_width(Utils::DEFAULT_SPACING_SMALL);
+  //set_border_width(Utils::DEFAULT_SPACING_SMALL);
   set_spacing(Utils::DEFAULT_SPACING_SMALL);
 
   //Connect signals:
diff --git a/glom/mode_data/box_data_details.cc b/glom/mode_data/box_data_details.cc
index 9908277..72edf68 100644
--- a/glom/mode_data/box_data_details.cc
+++ b/glom/mode_data/box_data_details.cc
@@ -232,7 +232,7 @@ void Box_Data_Details::create_layout()
 
     for(Document::type_list_layout_groups::const_iterator iter = layout_groups.begin(); iter != layout_groups.end(); ++iter)
     {
-      m_FlowTable.add_layout_group(*iter);
+      m_FlowTable.add_layout_group(*iter, false /* no indent at this top level */);
     }
 
     m_FlowTable.align_child_group_labels();
diff --git a/glom/mode_data/flowtablewithfields.cc b/glom/mode_data/flowtablewithfields.cc
index 2f0dd2e..7c5f430 100644
--- a/glom/mode_data/flowtablewithfields.cc
+++ b/glom/mode_data/flowtablewithfields.cc
@@ -160,12 +160,12 @@ void FlowTableWithFields::add_layout_item_at_position(const sharedptr<LayoutItem
   }
 }
 
-void FlowTableWithFields::add_layout_group(const sharedptr<LayoutGroup>& group)
+void FlowTableWithFields::add_layout_group(const sharedptr<LayoutGroup>& group, bool with_indent)
 {
-  add_layout_group_at_position(group, m_list_layoutwidgets.end());
+  add_layout_group_at_position(group, m_list_layoutwidgets.end(), with_indent);
 }
 
-void FlowTableWithFields::add_layout_group_at_position(const sharedptr<LayoutGroup>& group, const type_list_layoutwidgets::iterator& add_before)
+void FlowTableWithFields::add_layout_group_at_position(const sharedptr<LayoutGroup>& group, const type_list_layoutwidgets::iterator& add_before, bool with_indent)
 {
   if(!group)
     return;
@@ -187,9 +187,9 @@ void FlowTableWithFields::add_layout_group_at_position(const sharedptr<LayoutGro
 
     Gtk::Alignment* alignment = Gtk::manage( new Gtk::Alignment ); //TODO_leak: This is possibly leaked, according to valgrind.
 
-    if(!group->get_title().empty()) //Don't indent if it has no title, to allow use of groups just for positioning.
+    if(!group->get_title().empty() && with_indent) //Don't indent if it has no title, to allow use of groups just for positioning.
     {
-      alignment->set_padding(Glom::Utils::DEFAULT_SPACING_SMALL, 0, 6, 0); //Use left-padding of 6 even on Maemo because indentation is important.
+      alignment->set_padding(Glom::Utils::DEFAULT_SPACING_SMALL, 0, Glom::Utils::DEFAULT_SPACING_SMALL, 0);
       #ifdef GLOM_ENABLE_MAEMO
       std::cerr << "DEBUG: Unexpected group with title causing extra spacing on Maemo." << std::endl;
       #endif
diff --git a/glom/mode_data/flowtablewithfields.h b/glom/mode_data/flowtablewithfields.h
index 99014ef..463be08 100644
--- a/glom/mode_data/flowtablewithfields.h
+++ b/glom/mode_data/flowtablewithfields.h
@@ -75,7 +75,11 @@ public:
   //virtual void add_group(const Glib::ustring& group_name, const Glib::ustring& group_title, const type_map_field_sequence& fields);
 
   void add_layout_item(const sharedptr<LayoutItem>& item);
-  void add_layout_group(const sharedptr<LayoutGroup>& group);
+
+  /**
+   * @param with_indent Pass true for top-level groups, to avoid wasting extra space with an unnecessary indent.
+   */
+  void add_layout_group(const sharedptr<LayoutGroup>& group, bool with_indent = true);
 
   void set_field_editable(const sharedptr<const LayoutItem_Field>& field, bool editable = true);
 
@@ -233,7 +237,7 @@ private:
   void add_layoutwidgetbase(LayoutWidgetBase* layout_widget);
   void add_layoutwidgetbase(LayoutWidgetBase* layout_widget, const type_list_layoutwidgets::iterator& add_before);
   void add_layout_item_at_position(const sharedptr<LayoutItem>& item, const type_list_layoutwidgets::iterator& add_before);
-  void add_layout_group_at_position(const sharedptr<LayoutGroup>& group, const type_list_layoutwidgets::iterator& add_before);
+  void add_layout_group_at_position(const sharedptr<LayoutGroup>& group, const type_list_layoutwidgets::iterator& add_before, bool with_indent = true);
   void add_layout_notebook_at_position(const sharedptr<LayoutItem_Notebook>& notebook, const type_list_layoutwidgets::iterator& add_before);
   void add_layout_portal_at_position(const sharedptr<LayoutItem_Portal>& portal, const type_list_layoutwidgets::iterator& add_before);
 



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