aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/e-table
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-07-26 04:46:49 +0800
committerChris Lahey <clahey@src.gnome.org>2000-07-26 04:46:49 +0800
commitcbaec9459607a60bf56a727f74ffd45de0543207 (patch)
tree50a31b592b9e3991d68891fd01fea7d17a320581 /widgets/e-table
parent4ab46c1b63a253f77aff9de8a128160ab1b2468f (diff)
downloadgsoc2013-evolution-cbaec9459607a60bf56a727f74ffd45de0543207.tar
gsoc2013-evolution-cbaec9459607a60bf56a727f74ffd45de0543207.tar.gz
gsoc2013-evolution-cbaec9459607a60bf56a727f74ffd45de0543207.tar.bz2
gsoc2013-evolution-cbaec9459607a60bf56a727f74ffd45de0543207.tar.lz
gsoc2013-evolution-cbaec9459607a60bf56a727f74ffd45de0543207.tar.xz
gsoc2013-evolution-cbaec9459607a60bf56a727f74ffd45de0543207.tar.zst
gsoc2013-evolution-cbaec9459607a60bf56a727f74ffd45de0543207.zip
More fixes.
2000-07-25 Christopher James Lahey <clahey@helixcode.com> * e-table-selection-model.c: More fixes. svn path=/trunk/; revision=4328
Diffstat (limited to 'widgets/e-table')
-rw-r--r--widgets/e-table/e-table-selection-model.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/widgets/e-table/e-table-selection-model.c b/widgets/e-table/e-table-selection-model.c
index 44ecc07979..b8c4d65d2e 100644
--- a/widgets/e-table/e-table-selection-model.c
+++ b/widgets/e-table/e-table-selection-model.c
@@ -42,16 +42,21 @@ model_row_inserted(ETableModel *etm, int row, ETableSelectionModel *etsm)
int i;
int offset;
if(etsm->row_count >= 0) {
+ guint32 bitmask1 = 0xffff;
+ guint32 bitmask2;
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;
for (i = etsm->row_count >> 5; i > box; i--) {
- etsm->selection[i] = (etsm->selection[i] >> 1) & (etsm->selection[i - 1] << 31)
+ etsm->selection[i] = (etsm->selection[i] >> 1) | (etsm->selection[i - 1] << 31)
}
+
offset = row & 0x1f;
- etsm->selection[i] = ((etsm->selection[i] >> (32 - offset)) << (32 - offset)) & ((etsm->selection[i] << offset) >> (offset + 1));
+ bitmask1 = bitmask1 << (32 - offset);
+ bitmask2 = ~bitmask1;
+ etsm->selection[i] = (etsm->selection[i] & bitmask1) | ((etsm->selection[i] & bitmask2) >> 1);
etsm->row_count ++;
}
}
@@ -63,19 +68,21 @@ model_row_deleted(ETableModel *etm, int row, ETableSelectionModel *etsm)
int i;
int offset;
if(etsm->row_count >= 0) {
+ guint32 bitmask1 = 0xffff;
+ guint32 bitmask2;
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;
+ bitmask1 = bitmask1 << (32 - offset);
+ bitmask2 = (~bitmask1) >> 1;
+ etsm->selection[box] = (etsm->selection[box] & bitmask1) | ((etsm->selection[box] & bitmask2) << 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->selection[i + 1] >> 31);
}
etsm->selection[i] = etsm->selection[i] << 1;
}
@@ -90,8 +97,15 @@ inline static void
add_model(ETableSelectionModel *etsm, ETableModel *model)
{
etsm->model = model;
- if (model)
+ if (model) {
gtk_object_ref(GTK_OBJECT(model));
+ etsm->model_changed_id = gtk_signal_connect(GTK_OBJECT(model), "model_changed",
+ GTK_SIGNAL_FUNC(model_changed), etsm);
+ etsm->model_row_inserted_id = gtk_signal_connect(GTK_OBJECT(model), "model_row_inserted",
+ GTK_SIGNAL_FUNC(model_row_inserted), etsm);
+ etsm->model_row_deleted_id = gtk_signal_connect(GTK_OBJECT(model), "model_row_deleted",
+ GTK_SIGNAL_FUNC(model_row_deleted), etsm);
+ }
}
inline static void