lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [5238] Fix model notifications in CensusView::UponDeleteCe


From: Greg Chicares
Subject: [lmi-commits] [5238] Fix model notifications in CensusView::UponDeleteCells() (VS)
Date: Thu, 11 Aug 2011 09:36:53 +0000

Revision: 5238
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5238
Author:   chicares
Date:     2011-08-11 09:36:52 +0000 (Thu, 11 Aug 2011)
Log Message:
-----------
Fix model notifications in CensusView::UponDeleteCells() (VS)

Modified Paths:
--------------
    lmi/trunk/census_view.cpp

Modified: lmi/trunk/census_view.cpp
===================================================================
--- lmi/trunk/census_view.cpp   2011-08-08 12:04:32 UTC (rev 5237)
+++ lmi/trunk/census_view.cpp   2011-08-11 09:36:52 UTC (rev 5238)
@@ -910,7 +910,7 @@
         return;
         }
 
-    std::vector<int> erasures;
+    wxArrayInt erasures;
     typedef wxDataViewItemArray::const_iterator dvci;
     for(dvci i = selection.begin(); i != selection.end(); ++i)
         {
@@ -927,12 +927,8 @@
 
     for(unsigned int j = 0; j < cell_parms().size(); ++j)
         {
-        if(contains(erasures, j))
+        if(!contains(erasures, j))
             {
-            list_model_->RowDeleted(j);
-            }
-        else
-            {
             expurgated_cell_parms.push_back(cell_parms()[j]);
             }
         }
@@ -941,6 +937,13 @@
 //    cell_parms().swap(expurgated_cell_parms); // TODO ?? Would this be 
better?
     cell_parms() = expurgated_cell_parms;
 
+    // Send notifications about changes to the wxDataViewCtrl model. Two things
+    // changed: some rows were deleted and cell number of some rows shifted
+    // accordingly.
+    list_model_->RowsDeleted(erasures);
+    for(unsigned int j = erasures.front(); j < cell_parms().size(); ++j)
+        list_model_->RowValueChanged(j, CensusViewDataViewModel::Col_CellNum);
+
     Update();
     document().Modify(true);
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]