[glom/maemo5] Slightly better spacing on Maemo.



commit 6a5ea928d7d9e35ee09273c4fcc4ce5e7aa0fa1f
Author: Murray Cumming <murrayc murrayc com>
Date:   Sun Oct 11 22:22:58 2009 +0200

    Slightly better spacing on Maemo.

 glom/mode_data/flowtablewithfields.cc |    9 +++++++++
 glom/utility_widgets/flowtable.cc     |    7 ++++---
 glom/utils_ui.h                       |    8 ++++++--
 glom/window_boxholder.cc              |    5 +++++
 4 files changed, 24 insertions(+), 5 deletions(-)
---
diff --git a/glom/mode_data/flowtablewithfields.cc b/glom/mode_data/flowtablewithfields.cc
index 0f11320..2062e4e 100644
--- a/glom/mode_data/flowtablewithfields.cc
+++ b/glom/mode_data/flowtablewithfields.cc
@@ -36,6 +36,7 @@
 #include <glom/utils_ui.h> //For bold_message()).
 #include <libglom/data_structure/layout/layoutitem_placeholder.h>
 #include <glom/signal_reemitter.h>
+
 #include <glibmm/i18n.h>
 
 namespace Glom
@@ -203,7 +204,11 @@ void FlowTableWithFields::add_layout_group_at_position(const sharedptr<LayoutGro
     flow_table->set_table(m_table_name);
 
     flow_table->set_columns_count(group->get_columns_count());
+    #ifndef GLOM_ENABLE_MAEMO
     flow_table->set_padding(Utils::DEFAULT_SPACING_SMALL);
+    #else
+    flow_table->set_padding(0);HILDON_MARGIN_HALF);
+    #endif
     flow_table->show();
     
     Gtk::EventBox* event_box = Gtk::manage( new Gtk::EventBox() ); //TODO_Leak: Valgrind says this is possibly leaked.
@@ -388,7 +393,11 @@ void FlowTableWithFields::add_layout_notebook_at_position(const sharedptr<Layout
         flow_table->set_table(m_table_name);
 
         flow_table->set_columns_count(group->get_columns_count());
+        #ifndef GLOM_ENABLE_MAEMO
         flow_table->set_padding(Utils::DEFAULT_SPACING_SMALL);
+        #else
+        flow_table->set_padding(HILDON_MARGIN_HALF);
+        #endif
         flow_table->show();
         
         // Put the new flowtable in an event box to catch events
diff --git a/glom/utility_widgets/flowtable.cc b/glom/utility_widgets/flowtable.cc
index ffdd015..6b94ee1 100644
--- a/glom/utility_widgets/flowtable.cc
+++ b/glom/utility_widgets/flowtable.cc
@@ -441,7 +441,7 @@ int FlowTable::get_column_height(guint start_widget, guint widget_count, int& to
   for(i = start_widget; i < (start_widget+widget_count);  ++i)
   {
     const FlowTableItem& item = m_children[i];
-    int item_height = get_item_requested_height(item);
+    const int item_height = get_item_requested_height(item);
 
     int item_width_first = 0;
     int item_width_second = 0;
@@ -452,6 +452,7 @@ int FlowTable::get_column_height(guint start_widget, guint widget_count, int& to
     //Add the padding if it's not the first widget, and if one is visible:
     if( (i != start_widget) && item_height)
     {
+      std::cout << "debug: row padding=" << m_padding << std::endl;
       column_height += m_padding;
     }
 
@@ -459,8 +460,8 @@ int FlowTable::get_column_height(guint start_widget, guint widget_count, int& to
     {
       if(child_is_visible(item.m_second))
       {
-        column_width_first =MAX(column_width_first, item_width_first);
-        column_width_second =MAX(column_width_second, item_width_second);
+        column_width_first = MAX(column_width_first, item_width_first);
+        column_width_second = MAX(column_width_second, item_width_second);
       }
       else
       {
diff --git a/glom/utils_ui.h b/glom/utils_ui.h
index 0eacf96..20b98d5 100644
--- a/glom/utils_ui.h
+++ b/glom/utils_ui.h
@@ -30,6 +30,10 @@
 #include <gtkmm/dialog.h>
 #include <gtkmm/messagedialog.h>
 
+#ifdef GLOM_ENABLE_MAEMO
+#include <hildon/hildon-defines.h>
+#endif
+
 namespace Glom
 {
 
@@ -40,8 +44,8 @@ enum DefaultSpacings
 {
   #ifdef GLOM_ENABLE_MAEMO
   //We use different spacings on Maemo because the screen is smaller:
-  DEFAULT_SPACING_LARGE = 1,
-  DEFAULT_SPACING_SMALL = 1
+  DEFAULT_SPACING_LARGE = HILDON_MARGIN_DEFAULT,
+  DEFAULT_SPACING_SMALL = HILDON_MARGIN_HALF
   #else
   DEFAULT_SPACING_LARGE = 12,
   DEFAULT_SPACING_SMALL = 6
diff --git a/glom/window_boxholder.cc b/glom/window_boxholder.cc
index 15a07ef..5b793b2 100644
--- a/glom/window_boxholder.cc
+++ b/glom/window_boxholder.cc
@@ -31,7 +31,12 @@ Window_BoxHolder::Window_BoxHolder(Box_WithButtons* pBox, const Glib::ustring& t
   if(!title.empty())
     set_title(title);
 
+#ifndef GLOM_ENABLE_MAEMO
   set_border_width(Utils::DEFAULT_SPACING_SMALL);
+#else
+  //Maemo has wide border margins:
+  set_border_width(HILDON_MARGIN_DOUBLE);
+#endif
 
   pBox->signal_cancelled.connect(sigc::mem_fun(*this, &Window_BoxHolder::on_box_cancelled));
 



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