glom r1485 - in trunk: . glom/utility_widgets/db_adddel



Author: murrayc
Date: Sun Mar 30 08:20:57 2008
New Revision: 1485
URL: http://svn.gnome.org/viewvc/glom?rev=1485&view=rev

Log:
2008-03-30  Murray Cumming  <murrayc murrayc com>

* glom/utility_widgets/db_adddel/glom_db_treemodel.cc
create_iterator(): Always create a completely new iterator, instead of trying 
to return one with an existing GlueItem. A comment says that this is 
necessary to make operator=() work (it only compares pointers), but 
I do not know why a working iterator::operator=() is necessary. I guess 
we will find out. This was very inefficient. Glom can now show a list of 
60,000 records in 5 minutes instead of hours/days. There is still much 
room for improvement though.

Modified:
   trunk/ChangeLog
   trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc
   trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.h

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 Mar 30 08:20:57 2008
@@ -257,7 +257,7 @@
   }
   else
   {
-     //std::cout << "debug: DbTreeModelRow::fill_values_if_necessary(): retrieving" << std::endl;
+    //std::cout << "debug: DbTreeModelRow::fill_values_if_necessary(): retrieving for row=" << row << std::endl;
   
     if((row < (int)model.m_data_model_rows_count) && model.m_gda_datamodel)
     {
@@ -363,7 +363,7 @@
 /*
 DbTreeModel::type_datamodel_iter DbTreeModel::GlueItem::get_row_iter() const
 {
-  return m_row_iter;
+  return m_datamodel_row_iter;
 }
 */
 
@@ -387,17 +387,19 @@
   }
 }
 
+/*
 DbTreeModel::GlueItem* DbTreeModel::GlueList::get_existing_item(const type_datamodel_iter& row_iter)
 {
   for(type_listOfGlue::iterator iter = m_list.begin(); iter != m_list.end(); ++iter)
   {
     DbTreeModel::GlueItem* pItem = *iter;
-    if(pItem->get_datamodel_row_iter() == row_iter) //TODO_Performance: Access m_row_iter directly?
+    if(pItem->get_datamodel_row_iter() == row_iter) //TODO_Performance: Access m_datamodel_row_iter directly?
       return pItem;
   }
 
   return 0;
 }
+*/
 
 //Intialize static variable:
 bool DbTreeModel::m_iface_initialized = false;
@@ -905,7 +907,7 @@
   iter.set_model_refptr(refModel);
 
   const guint count_all_rows = get_internal_rows_count();
-//g_warning("DbTreeModel::create_iterator(): row_iter=%d, count=%d", row_iter, count_all_rows);
+  //g_warning("DbTreeModel::create_iterator(): row_iter=%d, count=%d", row_iter, count_all_rows);
   if(row_iter >= (count_all_rows)) //row_iter == m_rows.end()) //1 for the placeholder.
   {
     //TreeView seems to use this to identify the last row.
@@ -925,7 +927,8 @@
      m_pGlueList = new GlueList();
     }
 
-    GlueItem* pItem = m_pGlueList->get_existing_item(row_iter);
+    //TODO: Do we need to return an existing GlueItem, so that iterator::operator=() works?
+    GlueItem* pItem = 0; //m_pGlueList->get_existing_item(row_iter);
     if(!pItem)
     {
       pItem = new GlueItem(row_iter);

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 Mar 30 08:20:57 2008
@@ -190,7 +190,6 @@
      type_datamodel_iter get_datamodel_row_iter() const;
 
    protected:
-     //type_datamodel_iter m_row_iter;
      type_datamodel_iter m_datamodel_row_iter;
    };
 
@@ -208,7 +207,7 @@
      //We must reuse GlueItems instead of having 2 that contain equal iterators,
      //because Gtk::TreeIter::iterator::operator() unfortunately does only
      //a pointer comparison, without allowing us to implement specific logic.
-     GlueItem* get_existing_item(const type_datamodel_iter& row_iter);
+     //GlueItem* get_existing_item(const type_datamodel_iter& row_iter);
 
      //This is just a list of stuff to delete later:
      typedef std::list<GlueItem*> type_listOfGlue;



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