[glom] Replace most uses of Gtk::Alignment in the code.



commit 0376b0968306ee15bb4037f214b679847bafaff9
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Jun 5 21:22:47 2014 +0200

    Replace most uses of Gtk::Alignment in the code.

 glom/mode_data/box_data_calendar_related.cc |   11 ++++++++---
 glom/mode_data/box_data_list_related.cc     |   12 ++++++++----
 glom/mode_data/box_data_portal.cc           |    7 ++-----
 glom/mode_data/box_data_portal.h            |    2 --
 4 files changed, 18 insertions(+), 14 deletions(-)
---
diff --git a/glom/mode_data/box_data_calendar_related.cc b/glom/mode_data/box_data_calendar_related.cc
index 7e63910..3d44ebc 100644
--- a/glom/mode_data/box_data_calendar_related.cc
+++ b/glom/mode_data/box_data_calendar_related.cc
@@ -38,7 +38,9 @@ Box_Data_Calendar_Related::Box_Data_Calendar_Related()
 {
   set_size_request(400, -1); //An arbitrary default.
 
-  m_Alignment.add(m_calendar);
+  m_Frame.add(m_calendar);
+  m_calendar.set_margin_start(UiUtils::DEFAULT_SPACING_LARGE);
+  m_calendar.set_margin_top(UiUtils::DEFAULT_SPACING_SMALL);   
   m_calendar.show();
 
   //m_calendar.set_show_details();
@@ -99,14 +101,17 @@ bool Box_Data_Calendar_Related::init_db_details(const Glib::ustring& parent_tabl
     m_Label.set_markup(UiUtils::bold_message(title));
     m_Label.show();
 
-    m_Alignment.set_padding(UiUtils::DEFAULT_SPACING_SMALL /* top */, 0, UiUtils::DEFAULT_SPACING_LARGE /* 
left */, 0);
+    m_calendar.set_margin_start(UiUtils::DEFAULT_SPACING_LARGE);
+    m_calendar.set_margin_top(UiUtils::DEFAULT_SPACING_SMALL);
   }
   else
   {
     m_Label.set_markup(Glib::ustring());
     m_Label.hide();
 
-    m_Alignment.set_padding(0, 0, 0, 0); //The box itself has padding of 6.
+    //The box itself has padding of 6.
+    m_calendar.set_margin_start(0);
+    m_calendar.set_margin_top(0);
   }
 
   if(m_portal)
diff --git a/glom/mode_data/box_data_list_related.cc b/glom/mode_data/box_data_list_related.cc
index 59df82c..26f92d7 100644
--- a/glom/mode_data/box_data_list_related.cc
+++ b/glom/mode_data/box_data_list_related.cc
@@ -35,11 +35,11 @@ namespace Glom
 
 Box_Data_List_Related::Box_Data_List_Related()
 {
-  m_Alignment.add(m_AddDel);
+  m_Frame.add(m_AddDel);
   add_view(&m_AddDel); //Give it access to the document.
   m_AddDel.show();
   m_AddDel.set_height_rows(6, 6);
-  m_Alignment.show();
+  m_Frame.show();
 
   //Connect signals:
   m_AddDel.signal_user_requested_edit().connect(sigc::mem_fun(*this, 
&Box_Data_List_Related::on_adddel_user_requested_edit));
@@ -102,7 +102,9 @@ bool Box_Data_List_Related::init_db_details(const Glib::ustring& parent_table, b
     if(!(m_Frame.get_label_widget()))
       m_Frame.set_label_widget(m_Label);
 
-    m_Alignment.set_padding(UiUtils::DEFAULT_SPACING_SMALL /* top */, 0, UiUtils::DEFAULT_SPACING_LARGE /* 
left */, 0);
+    m_AddDel.set_margin_start(UiUtils::DEFAULT_SPACING_LARGE);
+    m_AddDel.set_margin_top(UiUtils::DEFAULT_SPACING_SMALL);
+
   }
   else
   {
@@ -111,7 +113,9 @@ bool Box_Data_List_Related::init_db_details(const Glib::ustring& parent_table, b
     if(m_Frame.get_label_widget())
       m_Frame.unset_label(); //Otherwise the allocation is calculated wrong due to GtkFrame bug: 
https://bugzilla.gnome.org/show_bug.cgi?id=662915
 
-    m_Alignment.set_padding(0.0f, 0.0f, 0.0f, 0.0f); //The box itself has padding of 6.
+    //The box itself has padding of 6:
+    m_AddDel.set_margin_start(0);
+    m_AddDel.set_margin_top(0);
   }
 
   if(m_portal)
diff --git a/glom/mode_data/box_data_portal.cc b/glom/mode_data/box_data_portal.cc
index b6fa27c..fdd5a9f 100644
--- a/glom/mode_data/box_data_portal.cc
+++ b/glom/mode_data/box_data_portal.cc
@@ -37,17 +37,14 @@ Box_Data_Portal::Box_Data_Portal()
 {
   //m_Frame.set_label_widget(m_Label_Related);
   m_Frame.set_shadow_type(Gtk::SHADOW_NONE);
-
-  m_Frame.add(m_Alignment);
   m_Frame.show();
 
   m_Frame.set_label_widget(m_Label);
   m_Label.show();
 
   //The AddDel or Calendar is added to this:
-  m_Alignment.set_padding(UiUtils::DEFAULT_SPACING_SMALL /* top */, 0, UiUtils::DEFAULT_SPACING_LARGE /* 
left */, 0);
-  m_Alignment.show();
-
+  //They must use child.set_margin_start(UiUtils::DEFAULT_SPACING_LARGE) and
+  //child.set_margin_top(UiUtils::DEFAULT_SPACING_SMALL);
   add(m_Frame);
 
   m_layout_name = "list_portal"; //Replaced by derived classes.
diff --git a/glom/mode_data/box_data_portal.h b/glom/mode_data/box_data_portal.h
index 16a06fa..f32965d 100644
--- a/glom/mode_data/box_data_portal.h
+++ b/glom/mode_data/box_data_portal.h
@@ -25,7 +25,6 @@
 
 #include "box_data_manyrecords.h"
 #include <glom/utility_widgets/layoutwidgetbase.h>
-#include <gtkmm/alignment.h>
 #include <gtkmm/frame.h>
 #include <gtkmm/label.h>
 
@@ -121,7 +120,6 @@ protected:
   Glib::ustring get_title_singular(const Glib::ustring& locale) const;  
   
   Gtk::Frame m_Frame;
-  Gtk::Alignment m_Alignment;
   Gtk::Label m_Label;
 
   sharedptr<LayoutItem_Portal> m_portal;


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