aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-07-26 04:17:59 +0800
committerChris Lahey <clahey@src.gnome.org>2000-07-26 04:17:59 +0800
commit4ab46c1b63a253f77aff9de8a128160ab1b2468f (patch)
treef85b3d6f7baf46e01be7a8fc1fb776bc34a13aa2 /widgets/table
parent384b3e38f2b049f808d1b4a72ca1d396ae6e2fb2 (diff)
downloadgsoc2013-evolution-4ab46c1b63a253f77aff9de8a128160ab1b2468f.tar
gsoc2013-evolution-4ab46c1b63a253f77aff9de8a128160ab1b2468f.tar.gz
gsoc2013-evolution-4ab46c1b63a253f77aff9de8a128160ab1b2468f.tar.bz2
gsoc2013-evolution-4ab46c1b63a253f77aff9de8a128160ab1b2468f.tar.lz
gsoc2013-evolution-4ab46c1b63a253f77aff9de8a128160ab1b2468f.tar.xz
gsoc2013-evolution-4ab46c1b63a253f77aff9de8a128160ab1b2468f.tar.zst
gsoc2013-evolution-4ab46c1b63a253f77aff9de8a128160ab1b2468f.zip
Fixed up the bit manipulation a bit here.
2000-07-25 Christopher James Lahey <clahey@helixcode.com> * e-table-selection-model.c: Fixed up the bit manipulation a bit here. svn path=/trunk/; revision=4327
Diffstat (limited to 'widgets/table')
-rw-r--r--widgets/table/e-table-selection-model.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/widgets/table/e-table-selection-model.c b/widgets/table/e-table-selection-model.c
index 9a199f74e8..44ecc07979 100644
--- a/widgets/table/e-table-selection-model.c
+++ b/widgets/table/e-table-selection-model.c
@@ -42,8 +42,8 @@ model_row_inserted(ETableModel *etm, int row, ETableSelectionModel *etsm)
int i;
int offset;
if(etsm->row_count >= 0) {
- if ((etsm->row_count & 0x1f /*%32*/) == 0) {
- etsm->selection = e_realloc(etsm->selection, (etsm->row_count >> 5/* /32 */) + 1);
+ if ((etsm->row_count & 0x1f) == 0) {
+ etsm->selection = e_realloc(etsm->selection, (etsm->row_count >> 5) + 1);
etsm->selection[etsm->row_count >> 5] = 0;
}
box = row >> 5;
@@ -51,7 +51,38 @@ model_row_inserted(ETableModel *etm, int row, ETableSelectionModel *etsm)
etsm->selection[i] = (etsm->selection[i] >> 1) & (etsm->selection[i - 1] << 31)
}
offset = row & 0x1f;
- etsm->selection[i] = ((etsm->selection[i] >> (32 - offset)) << (31 - offset)) & ((etsm->selection[i] << offset) >> offset);
+ etsm->selection[i] = ((etsm->selection[i] >> (32 - offset)) << (32 - offset)) & ((etsm->selection[i] << offset) >> (offset + 1));
+ etsm->row_count ++;
+ }
+}
+
+static void
+model_row_deleted(ETableModel *etm, int row, ETableSelectionModel *etsm)
+{
+ int box;
+ int i;
+ int offset;
+ if(etsm->row_count >= 0) {
+ box = row >> 5;
+ last = etsm->row_count >> 5
+
+ offset = row & 0x1f;
+ if (offset)
+ etsm->selection[box] = ((etsm->selection[box] >> (32 - offset)) << (32 - offset)) & ((etsm->selection[box] << offset) >> (offset - 1));
+ else
+ etsm->selection[box] = etsm->selection[box] << 1;
+ if (box < last) {
+ etsm->selection[box] &= etsm->selection[box + 1] >> 31;
+
+ for (i = box + 1; i < last; i++) {
+ etsm->selection[i] = (etsm->selection[i] << 1) & (etsm->selection[i + 1] >> 31);
+ }
+ etsm->selection[i] = etsm->selection[i] << 1;
+ }
+ etsm->row_count --;
+ if ((etsm->row_count & 0x1f) == 0) {
+ etsm->selection = e_realloc(etsm->selection, etsm->row_count >> 5);
+ }
}
}