diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-08-31 21:45:02 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-08-31 21:45:02 +0800 |
commit | c4982eded3e78276bd2265c2b81e27d914f5b63d (patch) | |
tree | 4199a524a98a9bc670de6b0d86fa413070e035c9 | |
parent | 4b7718f89408664af20a55d80a09323e63f4694f (diff) | |
download | gsoc2013-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
-rw-r--r-- | widgets/e-table/ChangeLog | 5 | ||||
-rw-r--r-- | widgets/e-table/e-table-selection-model.c | 14 | ||||
-rw-r--r-- | widgets/table/e-table-selection-model.c | 14 |
3 files changed, 19 insertions, 14 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog index a3a2977668..c95132782f 100644 --- a/widgets/e-table/ChangeLog +++ b/widgets/e-table/ChangeLog @@ -1,3 +1,8 @@ +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. + 2000-08-31 Richard Hult <rhult@codefactory.se> * e-tree-example-1.c (create_tree): Don't show the root node. diff --git a/widgets/e-table/e-table-selection-model.c b/widgets/e-table/e-table-selection-model.c index ffe8cfa947..6585840a8f 100644 --- a/widgets/e-table/e-table-selection-model.c +++ b/widgets/e-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); } } } 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); } } } |