aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table-selection-model.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-08-31 21:45:02 +0800
committerChris Lahey <clahey@src.gnome.org>2000-08-31 21:45:02 +0800
commitc4982eded3e78276bd2265c2b81e27d914f5b63d (patch)
tree4199a524a98a9bc670de6b0d86fa413070e035c9 /widgets/table/e-table-selection-model.c
parent4b7718f89408664af20a55d80a09323e63f4694f (diff)
downloadgsoc2013-evolution-c4982eded3e78276bd2265c2b81e27d914f5b63d.tar
gsoc2013-evolution-c4982eded3e78276bd2265c2b81e27d914f5b63d.tar.gz
gsoc2013-evolution-c4982eded3e78276bd2265c2b81e27d914f5b63d.tar.bz2
gsoc2013-evolution-c4982eded3e78276bd2265c2b81e27d914f5b63d.tar.lz
gsoc2013-evolution-c4982eded3e78276bd2265c2b81e27d914f5b63d.tar.xz
gsoc2013-evolution-c4982eded3e78276bd2265c2b81e27d914f5b63d.tar.zst
gsoc2013-evolution-c4982eded3e78276bd2265c2b81e27d914f5b63d.zip
Made the selection work when shift clicking on the first row of the table.
2000-08-31 Christopher James Lahey <clahey@helixcode.com> * e-table-selection-model.c: Made the selection work when shift clicking on the first row of the table. svn path=/trunk/; revision=5139
Diffstat (limited to 'widgets/table/e-table-selection-model.c')
-rw-r--r--widgets/table/e-table-selection-model.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/widgets/table/e-table-selection-model.c b/widgets/table/e-table-selection-model.c
index ffe8cfa947..6585840a8f 100644
--- a/widgets/table/e-table-selection-model.c
+++ b/widgets/table/e-table-selection-model.c
@@ -20,8 +20,8 @@
#define BOX(n) ((n) / 32)
#define OFFSET(n) (31 - ((n) % 32))
-#define BITMASK(n) ((guint32)(((guint32) 0x1) << OFFSET(n)))
-#define BITMASK_LEFT(n) ((guint32)(((guint32) ONES) << (32 - ((n) % 32))))
+#define BITMASK(n) ((guint32)(((guint32) 0x1) << OFFSET((n))))
+#define BITMASK_LEFT(n) ((((n) % 32) == 0) ? 0 : (ONES << (32 - ((n) % 32))))
#define BITMASK_RIGHT(n) ((guint32)(((guint32) ONES) >> ((n) % 32)))
static GtkObjectClass *e_table_selection_model_parent_class;
@@ -325,7 +325,7 @@ e_table_selection_model_foreach (ETableSelectionModel *selection,
}
}
-#define OPERATE(object, mask, grow) ((grow) ? ((object) |= (~(mask))) : ((object) &= (mask)))
+#define OPERATE(object, i,mask,grow) ((grow) ? (((object)->selection[(i)]) |= ((guint32) ~(mask))) : (((object)->selection[(i)]) &= (mask)))
static void
change_one_row(ETableSelectionModel *selection, int row, gboolean grow)
@@ -333,7 +333,7 @@ change_one_row(ETableSelectionModel *selection, int row, gboolean grow)
int i;
i = BOX(row);
- OPERATE(selection->selection[i], BITMASK_LEFT(row) | BITMASK_RIGHT(row + 1), grow);
+ OPERATE(selection, i, BITMASK_LEFT(row) | BITMASK_RIGHT(row + 1), grow);
}
static void
@@ -350,16 +350,16 @@ change_selection(ETableSelectionModel *selection, int start, int end, gboolean g
last = BOX(end);
if (i == last) {
- OPERATE(selection->selection[i], BITMASK_LEFT(start) | BITMASK_RIGHT(end), grow);
+ OPERATE(selection, i, BITMASK_LEFT(start) | BITMASK_RIGHT(end), grow);
} else {
- OPERATE(selection->selection[i], BITMASK_LEFT(start), grow);
+ OPERATE(selection, i, BITMASK_LEFT(start), grow);
if (grow)
for (i ++; i < last; i++)
selection->selection[i] = ONES;
else
for (i ++; i < last; i++)
selection->selection[i] = 0;
- OPERATE(selection->selection[i], BITMASK_RIGHT(end), grow);
+ OPERATE(selection, i, BITMASK_RIGHT(end), grow);
}
}
}