glom r1519 - in trunk: . glom glom/mode_data



Author: murrayc
Date: Fri Apr  4 08:40:20 2008
New Revision: 1519
URL: http://svn.gnome.org/viewvc/glom?rev=1519&view=rev

Log:
2008-04-04  Murray Cumming  <murrayc murrayc com>

* glom/mode_data/box_data_list.cc
* glom/mode_data/box_data_list.h
on_dialog_layout_hide(): Override this so we can set a bool and 
check for this bool in create_layout_add_group(), to reset the column 
widths after the layout dialog has been closed. Otherwise the new 
columns are off the right-hand side of the scroll area, making users 
think that nothing has happened unless they look at the scroll bar.
This is not ideal, but drag-and-drop will make this easier anyway.
Bug #526046 (Jani Monoses).

Modified:
   trunk/ChangeLog
   trunk/glom/base_db.cc
   trunk/glom/mode_data/box_data_list.cc
   trunk/glom/mode_data/box_data_list.h

Modified: trunk/glom/base_db.cc
==============================================================================
--- trunk/glom/base_db.cc	(original)
+++ trunk/glom/base_db.cc	Fri Apr  4 08:40:20 2008
@@ -314,7 +314,8 @@
     }
     else if(data_model_tables)
     {
-      int rows = data_model_tables->get_n_rows();
+      std::cout << "debug: data_model_tables refcount=" << G_OBJECT(data_model_tables->gobj())->ref_count << std::endl;
+      const int rows = data_model_tables->get_n_rows();
       for(int i = 0; i < rows; ++i)
       {
         Gnome::Gda::Value value = data_model_tables->get_value_at(0, i);

Modified: trunk/glom/mode_data/box_data_list.cc
==============================================================================
--- trunk/glom/mode_data/box_data_list.cc	(original)
+++ trunk/glom/mode_data/box_data_list.cc	Fri Apr  4 08:40:20 2008
@@ -34,7 +34,8 @@
 
 Box_Data_List::Box_Data_List()
 : m_has_one_or_more_records(false),
-  m_read_only(false)
+  m_read_only(false),
+  m_reset_column_widths(false)
 {
   m_layout_name = "list";
 
@@ -724,6 +725,10 @@
         }
       }
 
+      //Sometimes we reset the column width so that new fields are easily visible:
+      if(m_reset_column_widths)
+        child_item->set_display_width(0);
+
       m_AddDel.add_column(child_item);
     }
   }
@@ -889,7 +894,16 @@
     refModelDerived->get_record_counts(total, found);
 }
 
-} //namespace Glom
-
+#ifndef GLOM_ENABLE_CLIENT_ONLY
+//overridden, so we can change the column widths, so they are all visible:
+void Box_Data_List::on_dialog_layout_hide()
+{
+  //Tell create_layout() to reset the display_width for each layout item:
+  m_reset_column_widths = true;
+  Box_Data::on_dialog_layout_hide();
+  m_reset_column_widths = false;
+}
+#endif //GLOM_ENABLE_CLIENT_ONLY
 
+} //namespace Glom
 

Modified: trunk/glom/mode_data/box_data_list.h
==============================================================================
--- trunk/glom/mode_data/box_data_list.h	(original)
+++ trunk/glom/mode_data/box_data_list.h	Fri Apr  4 08:40:20 2008
@@ -71,6 +71,10 @@
 
   void get_record_counts(gulong& total, gulong& found) const;
 
+  #ifndef GLOM_ENABLE_CLIENT_ONLY
+  virtual void on_dialog_layout_hide(); //override
+  #endif //GLOM_ENABLE_CLIENT_ONLY
+
 protected:
   virtual void create_layout(); //override
   virtual Document_Glom::type_list_layout_groups create_layout_get_layout(); //overriden in Box_Data_List_Related.
@@ -108,6 +112,8 @@
   bool m_has_one_or_more_records;
   bool m_read_only;
 
+  bool m_reset_column_widths; //create_layout() sets these to 0 when this is set.
+
   type_signal_user_requested_details m_signal_user_requested_details;
 };
 



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