glom r1886 - in trunk: . glom/libglom/data_structure glom/mode_data glom/utility_widgets/db_adddel regression_tests



Author: murrayc
Date: Sun Feb  8 20:52:49 2009
New Revision: 1886
URL: http://svn.gnome.org/viewvc/glom?rev=1886&view=rev

Log:
2009-02-08  Murray Cumming  <murrayc murrayc com>

* glom/utility_widgets/db_adddel/glom_db_treemodel.[h|cc]:
constuctor/create(): Added a bool find_mode parameter and member 
variable.
refresh_from_database(): Create a DataModelArray for find mode, 
with the appropriate column types.
* glom/utility_widgets/db_adddel/db_adddel.[h|cc]:
Remove the awkward ListStore alternative model for find mode that I 
recently introduced,
construct_specified_columns(): Instead just specify find_mode=true 
when creating the tree model.

* glom/mode_data/box_data_list.cc: Simplify this code again 
accordingly.

* glom/utility_widgets/db_adddel/Makefile.am:
* glom/utility_widgets/db_adddel/treemodel_with_addrow.[h|cc]:
* glom/utility_widgets/db_adddel/liststore_with_addrow.[h|cc]:
* regression_tests/Makefile.am:
* regression_tests/test_treemodel_dynamic_cast.cc:
Removed these because they are no longer used.

Removed:
   trunk/glom/utility_widgets/db_adddel/liststore_with_addrow.cc
   trunk/glom/utility_widgets/db_adddel/liststore_with_addrow.h
   trunk/glom/utility_widgets/db_adddel/treemodel_with_addrow.cc
   trunk/glom/utility_widgets/db_adddel/treemodel_with_addrow.h
   trunk/regression_tests/test_treemodel_dynamic_cast.cc
Modified:
   trunk/ChangeLog
   trunk/glom/libglom/data_structure/parameternamegenerator.cc
   trunk/glom/libglom/data_structure/parameternamegenerator.h
   trunk/glom/mode_data/box_data_list.cc
   trunk/glom/utility_widgets/db_adddel/Makefile.am
   trunk/glom/utility_widgets/db_adddel/db_adddel.cc
   trunk/glom/utility_widgets/db_adddel/db_adddel.h
   trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc
   trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.h
   trunk/regression_tests/Makefile.am

Modified: trunk/glom/libglom/data_structure/parameternamegenerator.cc
==============================================================================
--- trunk/glom/libglom/data_structure/parameternamegenerator.cc	(original)
+++ trunk/glom/libglom/data_structure/parameternamegenerator.cc	Sun Feb  8 20:52:49 2009
@@ -1,6 +1,6 @@
 /*
  * glom
- * Copyright (C) Johannes Schmid 2009 <jhs gnome org>
+ * Copyright (C) Openismus GmbH, 2009
  * 
  * glom is free software: you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
@@ -21,27 +21,25 @@
 namespace Glom
 {
 
-ParameterNameGenerator::ParameterNameGenerator() :
-    m_id(0)
+ParameterNameGenerator::ParameterNameGenerator()
+: m_id(0)
 {
-    
 }
 
 ParameterNameGenerator::~ParameterNameGenerator()
 {
-    
 }
     
 Glib::ustring ParameterNameGenerator::get_next_name(unsigned int& id)
 {
-    m_id_table[m_id] = Glib::ustring::compose("glom_param%1", m_id);
-    id = m_id++;
-    return m_id_table[id];
+  m_id_table[m_id] = Glib::ustring::compose("glom_param%1", m_id);
+  id = m_id++;
+  return m_id_table[id];
 }
 
 Glib::ustring ParameterNameGenerator::get_name_from_id(unsigned int id)
 {
-    return m_id_table[id];
+  return m_id_table[id];
 }
 
 } // namespace Glom

Modified: trunk/glom/libglom/data_structure/parameternamegenerator.h
==============================================================================
--- trunk/glom/libglom/data_structure/parameternamegenerator.h	(original)
+++ trunk/glom/libglom/data_structure/parameternamegenerator.h	Sun Feb  8 20:52:49 2009
@@ -1,6 +1,6 @@
 /*
  * glom
- * Copyright (C) Johannes Schmid 2009 <jhs gnome org>
+ * Copyright (C) Openismus GmbH, 2009
  * 
  * glom is free software: you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
@@ -41,4 +41,4 @@
 
 #endif // _PARAMETERNAMEGENERATOR_H_
 
-}
\ No newline at end of file
+}

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	Sun Feb  8 20:52:49 2009
@@ -22,7 +22,6 @@
 #include <glom/libglom/data_structure/glomconversions.h>
 #include <glom/libglom/glade_utils.h>
 #include <glom/reports/report_builder.h>
-#include <glom/utility_widgets/db_adddel/glom_db_treemodel.h>
 #include "dialog_layout_list.h"
 #include <glom/glom_privs.h>
 #include <bakery/App/App_Gtk.h> //For util_bold_message().
@@ -578,20 +577,10 @@
   found = 0;
 
   Glib::RefPtr<Gtk::TreeModel> refModel = m_AddDel.get_model();
-  //if(!refModel)
-  //  std::cerr << "Box_Data_List::get_record_counts(): (this=" << typeid(this).name() << ") The tree model was NULL." << std::endl;
-
   Glib::RefPtr<DbTreeModel> refModelDerived = Glib::RefPtr<DbTreeModel>::cast_dynamic(refModel);
   
   if(refModelDerived)
     refModelDerived->get_record_counts(total, found);
-
-  /*
-  else
-  {
-    std::cerr << "Box_Data_List::get_record_counts(): (this=" << typeid(this).name() << ") The tree model was not a DbTreeModel. It was a " << typeid(refModel.operator->()).name() << std::endl;
-  }
-  */
 }
 
 void Box_Data_List::on_adddel_user_sort_clause_changed()

Modified: trunk/glom/utility_widgets/db_adddel/Makefile.am
==============================================================================
--- trunk/glom/utility_widgets/db_adddel/Makefile.am	(original)
+++ trunk/glom/utility_widgets/db_adddel/Makefile.am	Sun Feb  8 20:52:49 2009
@@ -7,8 +7,6 @@
                                       db_treeviewcolumn_glom.cc db_treeviewcolumn_glom.h \
                                       glom_db_treemodel.h glom_db_treemodel.cc \
                                       cellrenderer_buttonimage.h cellrenderer_buttonimage.cc \
-                                      cellrenderer_buttontext.h cellrenderer_buttontext.cc \
-                                      treemodel_with_addrow.h treemodel_with_addrow.cc \
-                                      liststore_with_addrow.h liststore_with_addrow.cc
+                                      cellrenderer_buttontext.h cellrenderer_buttontext.cc
                                       
  

Modified: trunk/glom/utility_widgets/db_adddel/db_adddel.cc
==============================================================================
--- trunk/glom/utility_widgets/db_adddel/db_adddel.cc	(original)
+++ trunk/glom/utility_widgets/db_adddel/db_adddel.cc	Sun Feb  8 20:52:49 2009
@@ -23,8 +23,6 @@
 #include <glibmm/i18n.h>
 #include "../cellrendererlist/cellrendererlist.h"
 #include "db_treeviewcolumn_glom.h"
-#include "glom_db_treemodel.h"
-#include "liststore_with_addrow.h"
 #include <glom/libglom/data_structure/glomconversions.h>
 #include "../../dialog_invalid_data.h"
 #include "../../application.h"
@@ -408,8 +406,8 @@
      return refTreeSelection->get_selected();
   }
 
-  if(m_refListStore_as_model)
-    return m_refListStore_as_model->children().end();
+  if(m_refListStore)
+    return m_refListStore->children().end();
   else
     return Gtk::TreeModel::iterator();
 }
@@ -423,8 +421,8 @@
      return unconst->get_selected();
   }
 
-  if(m_refListStore_as_model)
-    return m_refListStore_as_model->children().end();
+  if(m_refListStore)
+    return m_refListStore->children().end();
   else
     return Gtk::TreeModel::iterator();
 }
@@ -432,10 +430,10 @@
 
 Gtk::TreeModel::iterator DbAddDel::get_row(const Gnome::Gda::Value& key)
 {
-  if(!m_refListStore_as_model)
+  if(!m_refListStore)
     return Gtk::TreeModel::iterator();
 
-  for(Gtk::TreeModel::iterator iter = m_refListStore_as_model->children().begin(); iter != m_refListStore_as_model->children().end(); ++iter)
+  for(Gtk::TreeModel::iterator iter = m_refListStore->children().begin(); iter != m_refListStore->children().end(); ++iter)
   {
     //Gtk::TreeModel::Row row = *iter;
     const Gnome::Gda::Value& valTemp = get_value_key(iter);
@@ -445,7 +443,7 @@
     }
   }
 
-  return  m_refListStore_as_model->children().end();
+  return  m_refListStore->children().end();
 }
 
 bool DbAddDel::select_item(const Gtk::TreeModel::iterator& iter, bool start_editing)
@@ -491,7 +489,7 @@
     {
       refTreeSelection->select(iter);
 
-      Gtk::TreeModel::Path path = m_refListStore_as_model->get_path(iter);
+      Gtk::TreeModel::Path path = m_refListStore->get_path(iter);
 
       guint view_column_index = 0;
       const bool test = get_view_column_index(treemodel_col, view_column_index);
@@ -518,10 +516,10 @@
 
 guint DbAddDel::get_count() const
 {
-  if(!m_refListStore_as_model)
+  if(!m_refListStore)
     return 0;
 
-  guint iCount = m_refListStore_as_model->children().size();
+  guint iCount = m_refListStore->children().size();
 
   //Take account of the extra blank for new entries:
   if(get_allow_user_actions()) //If it has the extra row.
@@ -580,10 +578,10 @@
 
 void DbAddDel::on_cell_layout_button_clicked(const Gtk::TreeModel::Path& path, int model_column_index)
 {
-  if(!m_refListStore_as_model)
+  if(!m_refListStore)
     return;
 
-  Gtk::TreeModel::iterator iter = m_refListStore_as_model->get_iter(path);
+  Gtk::TreeModel::iterator iter = m_refListStore->get_iter(path);
   if(iter)
   {
     sharedptr<const LayoutItem> layout_item = m_ColumnTypes[model_column_index].m_item;
@@ -824,8 +822,6 @@
 
 void DbAddDel::construct_specified_columns()
 {
-  //std::cout << "debug: DbAddDel::construct_specified_columns()" << std::endl;
-
   InnerIgnore innerIgnore(this);
 
   //TODO_optimisation: This is called many times, just to simplify the API.
@@ -849,7 +845,7 @@
   Gtk::TreeModel::ColumnRecord record;
     
   //Database columns:
-  DbTreeModel::type_vec_fields fields;
+  type_model_store::type_vec_fields fields;
   {
     type_vecModelColumns::size_type i = 0;
     for(type_ColumnTypes::iterator iter = m_ColumnTypes.begin(); iter != m_ColumnTypes.end(); ++iter)
@@ -876,22 +872,11 @@
   
   m_FieldsShown = fields; //Needed by Base_DB_Table_Data::record_new().
 
-  //std::cout << "DEBUG: DbAddDel::construct_specified_columns(): m_find_mode=" << m_find_mode << std::endl;
-
-  if(m_find_mode)
-  {
-    //std::cout << "DEBUG: DbAddDel::construct_specified_columns(): Creating ListStoreWithAddRow" << std::endl;
-    Glib::RefPtr<ListStoreWithAddRow> liststore = ListStoreWithAddRow::create(record, fields);
-    liststore->append();
-    m_refListStore = liststore.operator->();
-    m_refListStore_as_model = liststore;
-  }
-  else
   {
     //Find the primary key:
     int column_index_key = 0;
     bool key_found = false;
-    for(DbTreeModel::type_vec_fields::const_iterator iter = fields.begin(); iter != fields.end(); ++iter)
+    for(type_model_store::type_vec_fields::const_iterator iter = fields.begin(); iter != fields.end(); ++iter)
     {
       sharedptr<LayoutItem_Field> layout_item = *iter;
       if( !(layout_item->get_has_relationship_name()) )
@@ -907,12 +892,11 @@
       ++column_index_key;
     }
 
-    if(key_found )
+    if(key_found)
     {
       //Create the model from the ColumnRecord:
-      Glib::RefPtr<DbTreeModel> liststore  = DbTreeModel::create(record, m_found_set, fields, column_index_key, m_allow_view);
-      m_refListStore = liststore.operator->();
-      m_refListStore_as_model = liststore;
+      //Note that the model will use a dummy Gda DataModel if m_find_mode is true.
+      m_refListStore = type_model_store::create(record, m_found_set, fields, column_index_key, m_allow_view, m_find_mode);
     }
     else
     {
@@ -922,13 +906,11 @@
       //  g_warning("  field: %s", (iter->get_name().c_str());
       //}
 
-      Glib::RefPtr<DbTreeModel> liststore = Glib::RefPtr<DbTreeModel>();
-      m_refListStore = liststore.operator->();
-      m_refListStore_as_model = liststore;
+      m_refListStore = Glib::RefPtr<type_model_store>();
     }
   }
  
-  m_TreeView.set_model(m_refListStore_as_model);
+  m_TreeView.set_model(m_refListStore);
 
 
   //Remove all View columns:
@@ -1048,7 +1030,7 @@
     if(m_TreeView.get_model())
       gtk_tree_view_set_model(m_TreeView.gobj(), 0); //This gives the same warning.
 
-    m_TreeView.set_model(m_refListStore_as_model);
+    m_TreeView.set_model(m_refListStore);
     return result;
   }
   else
@@ -1058,6 +1040,9 @@
 
 bool DbAddDel::refresh_from_database_blank()
 {
+  if(m_find_mode)
+    return refresh_from_database();
+
   if(m_refListStore)
   {
     m_refListStore->clear(); //Remove all rows.
@@ -1406,11 +1391,14 @@
 
 Gnome::Gda::Value DbAddDel::treeview_get_key(const Gtk::TreeModel::iterator& row) const
 {
-  Glib::RefPtr<DbTreeModel> dbmodel = Glib::RefPtr<DbTreeModel>::cast_dynamic(m_refListStore_as_model);
-  if(dbmodel)
-    return dbmodel->get_key_value(row);
-  else
-    return Gnome::Gda::Value();
+  Gnome::Gda::Value value;
+
+  if(m_refListStore)
+  {
+    return m_refListStore->get_key_value(row);
+  }
+
+  return value;
 }
 
 void DbAddDel::on_treeview_cell_edited_bool(const Glib::ustring& path_string, int model_column_index, int data_model_column_index)
@@ -1426,7 +1414,7 @@
   const Gtk::TreeModel::Path path(path_string);
 
   //Get the row from the path:
-  Gtk::TreeModel::iterator iter = m_refListStore_as_model->get_iter(path);
+  Gtk::TreeModel::iterator iter = m_refListStore->get_iter(path);
   if(iter)
   {
     Gtk::TreeModel::Row row = *iter;
@@ -1450,7 +1438,7 @@
     bool bIsAdd = false;
     bool bIsChange = false;
 
-    const int iCount = m_refListStore_as_model->children().size();
+    const int iCount = m_refListStore->children().size();
     if(iCount)
     {
       if(get_allow_user_actions()) //If add is possible:
@@ -1503,13 +1491,13 @@
   if(path_string.empty())
     return;
 
-  if(!m_refListStore_as_model)
+  if(!m_refListStore)
     return;
 
   const Gtk::TreeModel::Path path(path_string);
 
   //Get the row from the path:
-  Gtk::TreeModel::iterator iter = m_refListStore_as_model->get_iter(path);
+  Gtk::TreeModel::iterator iter = m_refListStore->get_iter(path);
   if(iter != get_model()->children().end())
   {
     Gtk::TreeModel::Row row = *iter;
@@ -1829,11 +1817,11 @@
 
 Glib::RefPtr<Gtk::TreeModel> DbAddDel::get_model()
 {
-  return m_refListStore_as_model;
+  return m_refListStore;
 }
 Glib::RefPtr<const Gtk::TreeModel> DbAddDel::get_model() const
 {
-  return m_refListStore_as_model;
+  return m_refListStore;
 }
 
 bool DbAddDel::get_is_first_row(const Gtk::TreeModel::iterator& iter) const
@@ -1890,10 +1878,7 @@
       //row[*m_modelcolumn_placeholder] = false;
     }
 
-    //TODO_Performance: Cache the dynamic_cast<>ed result?
-    Glib::RefPtr<DbTreeModel> dbmodel = Glib::RefPtr<DbTreeModel>::cast_dynamic(m_refListStore_as_model);
-    if(dbmodel)
-      return dbmodel->set_key_value(iter, value);
+    m_refListStore->set_key_value(iter, value);
   }
 }
 
@@ -1909,10 +1894,10 @@
   if(!iter)
     return false;
 
-  if(!m_refListStore_as_model)
+  if(!m_refListStore)
     return false;
 
-  if(iter == m_refListStore_as_model->children().end())
+  if(iter == m_refListStore->children().end())
   {
     return false;
   }
@@ -1976,22 +1961,11 @@
 
 void DbAddDel::treeviewcolumn_on_cell_data(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter, int model_column_index, int data_model_column_index)
 {
-  if(!m_refListStore_as_model)
-    return;
-
-  //std::cout << "debug: DbAddDel::treeviewcolumn_on_cell_data(): model columns count=" << m_refListStore_as_model->get_n_columns() << std::endl; 
+  //std::cout << "debug: DbAddDel::treeviewcolumn_on_cell_data()" << std::endl; 
 
 
   if(iter)
   {
-    /*
-    if(!iter->get_model_gobject())
-    {
-      std::cerr << "DbAddDel::treeviewcolumn_on_cell_data(): iter has no model" << std::endl;
-      return; 
-    }
-    */
-
     const DbAddDelColumnInfo& column_info = m_ColumnTypes[model_column_index];
 
     sharedptr<LayoutItem_Field> field = sharedptr<LayoutItem_Field>::cast_dynamic(column_info.m_item);
@@ -2085,10 +2059,10 @@
 
 void DbAddDel::on_cell_button_clicked(const Gtk::TreeModel::Path& path)
 {
-  if(!m_refListStore_as_model)
+  if(!m_refListStore)
     return;
 
-  Gtk::TreeModel::iterator iter = m_refListStore_as_model->get_iter(path);
+  Gtk::TreeModel::iterator iter = m_refListStore->get_iter(path);
   if(iter)
   {
     select_item(iter, false /* start_editing */);

Modified: trunk/glom/utility_widgets/db_adddel/db_adddel.h
==============================================================================
--- trunk/glom/utility_widgets/db_adddel/db_adddel.h	(original)
+++ trunk/glom/utility_widgets/db_adddel/db_adddel.h	Sun Feb  8 20:52:49 2009
@@ -24,7 +24,7 @@
 #include <gtkmm.h>
 #include <glom/libglom/data_structure/layout/layoutitem_field.h>
 #include <libgdamm.h>
-#include <glom/utility_widgets/db_adddel/treemodel_with_addrow.h>
+#include "glom_db_treemodel.h"
 #include <glom/libglom/document/document_glom.h>
 #include <glom/base_db_table_data.h>
 
@@ -361,9 +361,9 @@
   Gtk::TreeView m_TreeView;
   Gtk::TreeModel::ColumnRecord m_ColumnRecord;
 
-  //Either a db-backed model, or a liststore-derived find-criteria model:
-  TreeModelWithAddRow* m_refListStore; //We use this without a Glib::RefPtr to avoid the complication of ObjectBase as an MI base.
-  Glib::RefPtr<Gtk::TreeModel> m_refListStore_as_model; //To avoid repeated dynamic_casts.
+  //typedef Gtk::ListStore type_model_store;
+  typedef DbTreeModel type_model_store;
+  Glib::RefPtr<type_model_store> m_refListStore;
 
   //Columns, not including the hidden internal columns:
   typedef std::vector<DbAddDelColumnInfo> type_ColumnTypes;

Modified: trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc
==============================================================================
--- trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc	(original)
+++ trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc	Sun Feb  8 20:52:49 2009
@@ -369,7 +369,7 @@
 //Intialize static variable:
 bool DbTreeModel::m_iface_initialized = false;
 
-DbTreeModel::DbTreeModel(const Gtk::TreeModelColumnRecord& columns, const FoundSet& found_set, const type_vec_fields& column_fields, int column_index_key, bool get_records)
+DbTreeModel::DbTreeModel(const Gtk::TreeModelColumnRecord& columns, const FoundSet& found_set, const type_vec_fields& column_fields, int column_index_key, bool get_records, bool find_mode)
 : Glib::ObjectBase( typeid(DbTreeModel) ), //register a custom GType.
   Glib::Object(), //The custom GType is actually registered here.
   m_columns_count(0),
@@ -381,6 +381,7 @@
   m_count_extra_rows(0),
   m_count_removed_rows(0),
   m_get_records(get_records),
+  m_find_mode(find_mode),
   m_stamp(1) //When the model's stamp != the iterator's stamp then that iterator is invalid and should be ignored. Also, 0=invalid
 {
   if(!m_iface_initialized)
@@ -422,9 +423,9 @@
 }
 
 //static:
-Glib::RefPtr<DbTreeModel> DbTreeModel::create(const Gtk::TreeModelColumnRecord& columns, const FoundSet& found_set, const type_vec_fields& column_fields, int column_index_key, bool get_records)
+Glib::RefPtr<DbTreeModel> DbTreeModel::create(const Gtk::TreeModelColumnRecord& columns, const FoundSet& found_set, const type_vec_fields& column_fields, int column_index_key, bool get_records, bool find_mode)
 {
-  return Glib::RefPtr<DbTreeModel>( new DbTreeModel(columns, found_set, column_fields, column_index_key, get_records) );
+  return Glib::RefPtr<DbTreeModel>( new DbTreeModel(columns, found_set, column_fields, column_index_key, get_records, find_mode) );
 }
 
 bool DbTreeModel::refresh_from_database(const FoundSet& found_set)
@@ -432,11 +433,40 @@
   //std::cout << "DbTreeModel::refresh_from_database()" << std::endl;
   m_found_set = found_set;
 
-  if(!m_get_records)
+  if(!m_get_records && !m_find_mode)
     return false;
 
   clear(); //Clear existing shown records.
 
+  if(m_find_mode)
+  {
+    m_get_records = false; //Otherwise it would not make sense.
+
+    //Use a dummy DataModel that has the same columns and types, 
+    //but which does not use a real database table,
+    //so we can use it to add find criteria.
+    Glib::RefPtr<Gnome::Gda::DataModelArray> model_array = Gnome::Gda::DataModelArray::create(m_column_fields.size());
+    m_gda_datamodel = model_array;
+
+    int col = 0;
+    for(type_vec_fields::const_iterator iter = m_column_fields.begin(); iter != m_column_fields.end(); ++iter)
+    {
+      sharedptr<const LayoutItem_Field> layout_item = *iter;
+      if(layout_item)
+      {
+        const Field::glom_field_type glom_type = layout_item->get_glom_type();
+        const GType gda_type = Field::get_gda_type_for_glom_type(glom_type);
+        model_array->set_column_g_type(col, gda_type);
+        ++col;
+      }
+    }
+
+    //Add at least an initial row:
+    m_gda_datamodel->append_row(); //TODO: Handle adding.
+    return true;
+  }
+
+
   //Connect to database:
   ConnectionPool* connection_pool = ConnectionPool::get_instance();
   if(connection_pool)

Modified: trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.h
==============================================================================
--- trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.h	(original)
+++ trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.h	Sun Feb  8 20:52:49 2009
@@ -21,10 +21,11 @@
 #ifndef GLOM_MODE_DATA_DB_TREEMODEL_H
 #define GLOM_MODE_DATA_DB_TREEMODEL_H
 
-#include <glom/utility_widgets/db_adddel/treemodel_with_addrow.h>
+#include <gtkmm/treemodel.h>
 #include <gtkmm/treepath.h>
 #include <glom/libglom/data_structure/layout/layoutitem_field.h>
 #include <glom/libglom/connectionpool.h>
+#include "../../base_db.h"
 
 namespace Glom
 {
@@ -61,21 +62,23 @@
 
 class DbTreeModel
   : public Glib::Object,
-    public Gtk::TreeModel,
-    public TreeModelWithAddRow
+    public Gtk::TreeModel
 {
 public:
   typedef unsigned int size_type;
 
+  //typedef std::vector<LayoutItem_Field> type_vec_fields;
+  typedef Base_DB::type_vecLayoutFields type_vec_fields;
+
   friend class DbTreeModelRow;
 
 protected:
   //Create a TreeModel with @a columns_count number of columns, each of type Glib::ustring.
-  DbTreeModel(const Gtk::TreeModelColumnRecord& columns, const FoundSet& found_set, const type_vec_fields& column_fields, int column_index_key, bool get_records = true);
+  DbTreeModel(const Gtk::TreeModelColumnRecord& columns, const FoundSet& found_set, const type_vec_fields& column_fields, int column_index_key, bool get_records = true, bool find_mode = false);
   virtual ~DbTreeModel();
 
 public:
-  static Glib::RefPtr<DbTreeModel> create(const Gtk::TreeModelColumnRecord& columns, const FoundSet& found_set, const type_vec_fields& column_fields, int column_index_key, bool get_records = true);
+  static Glib::RefPtr<DbTreeModel> create(const Gtk::TreeModelColumnRecord& columns, const FoundSet& found_set, const type_vec_fields& column_fields, int column_index_key, bool get_records = true, bool find_mode = false);
 
   typedef DbTreeModelRow::DbValue DbValue;
 
@@ -199,6 +202,7 @@
    typedef Gtk::TreeModelColumn< DbValue > typeModelColumn;
 
    bool m_get_records;
+   bool m_find_mode;
 
    int m_stamp; //When the model's stamp and the TreeIter's stamp are equal, the TreeIter is valid.
 

Modified: trunk/regression_tests/Makefile.am
==============================================================================
--- trunk/regression_tests/Makefile.am	(original)
+++ trunk/regression_tests/Makefile.am	Sun Feb  8 20:52:49 2009
@@ -18,6 +18,3 @@
 test_signal_reemit_SOURCES = test_signal_reemit.cc
 test_signal_reemit_LDADD = $(GLOM_LIBS) 
 
-test_treemodel_dynamic_cast_SOURCES = test_treemodel_dynamic_cast.cc
-test_treemodel_dynamic_cast_LDADD = $(GLOM_LIBS) 
-



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