aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/e-selection-model-array.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-12-05 05:03:28 +0800
committerChris Lahey <clahey@src.gnome.org>2001-12-05 05:03:28 +0800
commit410f3bc629f38cb76a5d16209a07e2c336ed1f9f (patch)
tree8ca2b834f5c5bff158d6e76ea2e27ef4826bf71c /widgets/misc/e-selection-model-array.c
parente508d293964edda19447e713a2503e3133e84161 (diff)
downloadgsoc2013-evolution-410f3bc629f38cb76a5d16209a07e2c336ed1f9f.tar
gsoc2013-evolution-410f3bc629f38cb76a5d16209a07e2c336ed1f9f.tar.gz
gsoc2013-evolution-410f3bc629f38cb76a5d16209a07e2c336ed1f9f.tar.bz2
gsoc2013-evolution-410f3bc629f38cb76a5d16209a07e2c336ed1f9f.tar.lz
gsoc2013-evolution-410f3bc629f38cb76a5d16209a07e2c336ed1f9f.tar.xz
gsoc2013-evolution-410f3bc629f38cb76a5d16209a07e2c336ed1f9f.tar.zst
gsoc2013-evolution-410f3bc629f38cb76a5d16209a07e2c336ed1f9f.zip
Merging changes:
2001-12-04 Christopher James Lahey <clahey@ximian.com> * configure.in (GAL_CURRENT): Bumped version number to 0.18.99.0 and CURRENT to 19. 2001-11-21 Christopher James Lahey <clahey@ximian.com> * gal/widgets/e-reflow.c, gal/widgets/e-reflow.h: Handle selection_row_changed signal. * gal/widgets/e-selection-model-array.c, gal/widgets/e-selection-model-array.h: Properly send selection_row_changed signals if changing from a single row selected to a single other row selected or if moving the selection_end by a single row. * gal/widgets/e-selection-model.c, gal/widgets/e-selection-model.h: Added selection_row_changed signal. (e_selection_model_select_as_key_press): Fixed the case statement here to make MULTIPLE and EXTENDED the same as BROWSE instead of as SINGLE. From gal/e-table/ChangeLog: 2001-11-21 Christopher James Lahey <clahey@ximian.com> * e-table-item.c, e-table-item.h: Handle selection_row_changed signal. Keep track of the old cursor row so that we only redraw two rows when the cursor changes. * e-table.c, e-tree.c: Handle selection_row_changed signal. * e-tree-selection-model.c: Properly send selection_row_changed signals if changing from a single row selected to a single other row selected or if moving the selection_end by a single row. svn path=/trunk/; revision=14870
Diffstat (limited to 'widgets/misc/e-selection-model-array.c')
-rw-r--r--widgets/misc/e-selection-model-array.c71
1 files changed, 64 insertions, 7 deletions
diff --git a/widgets/misc/e-selection-model-array.c b/widgets/misc/e-selection-model-array.c
index 13c964bfba..dd81fb2554 100644
--- a/widgets/misc/e-selection-model-array.c
+++ b/widgets/misc/e-selection-model-array.c
@@ -70,6 +70,8 @@ e_selection_model_array_delete_rows(ESelectionModelArray *esma, int row, int cou
if (esma->cursor_row >= 0)
e_bit_array_change_one_row(esma->eba, esma->cursor_row, TRUE);
+ esma->selected_row = -1;
+ esma->selected_range_end = -1;
e_selection_model_selection_changed(E_SELECTION_MODEL(esma));
e_selection_model_cursor_changed(E_SELECTION_MODEL(esma), esma->cursor_row, esma->cursor_col);
}
@@ -84,6 +86,8 @@ e_selection_model_array_insert_rows(ESelectionModelArray *esma, int row, int cou
if (esma->cursor_row >= row)
esma->cursor_row += count;
+ esma->selected_row = -1;
+ esma->selected_range_end = -1;
e_selection_model_selection_changed(E_SELECTION_MODEL(esma));
e_selection_model_cursor_changed(E_SELECTION_MODEL(esma), esma->cursor_row, esma->cursor_col);
}
@@ -114,6 +118,8 @@ e_selection_model_array_move_row(ESelectionModelArray *esma, int old_row, int ne
if (cursor) {
esma->cursor_row = new_row;
}
+ esma->selected_row = -1;
+ esma->selected_range_end = -1;
e_selection_model_selection_changed(esm);
e_selection_model_cursor_changed(esm, esma->cursor_row, esma->cursor_col);
}
@@ -223,6 +229,8 @@ esma_clear(ESelectionModel *selection)
}
esma->cursor_row = -1;
esma->cursor_col = -1;
+ esma->selected_row = -1;
+ esma->selected_range_end = -1;
e_selection_model_selection_changed(E_SELECTION_MODEL(esma));
e_selection_model_cursor_changed(E_SELECTION_MODEL(esma), -1, -1);
}
@@ -267,6 +275,8 @@ esma_select_all (ESelectionModel *selection)
esma->cursor_col = 0;
esma->cursor_row = 0;
esma->selection_start_row = 0;
+ esma->selected_row = -1;
+ esma->selected_range_end = -1;
e_selection_model_selection_changed(E_SELECTION_MODEL(esma));
e_selection_model_cursor_changed(E_SELECTION_MODEL(esma), 0, 0);
}
@@ -290,6 +300,8 @@ esma_invert_selection (ESelectionModel *selection)
esma->cursor_col = -1;
esma->cursor_row = -1;
esma->selection_start_row = 0;
+ esma->selected_row = -1;
+ esma->selected_range_end = -1;
e_selection_model_selection_changed(E_SELECTION_MODEL(esma));
e_selection_model_cursor_changed(E_SELECTION_MODEL(esma), -1, -1);
}
@@ -356,15 +368,33 @@ esma_cursor_col (ESelectionModel *selection)
}
static void
-esma_select_single_row (ESelectionModel *selection, int row)
+esma_real_select_single_row (ESelectionModel *selection, int row)
{
ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
e_selection_model_array_confirm_row_count(esma);
+
e_bit_array_select_single_row(esma->eba, row);
- e_selection_model_selection_changed(E_SELECTION_MODEL(esma));
esma->selection_start_row = row;
+ esma->selected_row = row;
+ esma->selected_range_end = row;
+}
+
+static void
+esma_select_single_row (ESelectionModel *selection, int row)
+{
+ int selected_row = E_SELECTION_MODEL_ARRAY(selection)->selected_row;
+ esma_real_select_single_row (selection, row);
+
+ if (selected_row != -1) {
+ if (selected_row != row) {
+ e_selection_model_selection_row_changed(selection, selected_row);
+ e_selection_model_selection_row_changed(selection, row);
+ }
+ } else {
+ e_selection_model_selection_changed(selection);
+ }
}
static void
@@ -376,11 +406,13 @@ esma_toggle_single_row (ESelectionModel *selection, int row)
e_bit_array_toggle_single_row(esma->eba, row);
esma->selection_start_row = row;
- e_selection_model_selection_changed(E_SELECTION_MODEL(esma));
+ esma->selected_row = -1;
+ esma->selected_range_end = -1;
+ e_selection_model_selection_row_changed(E_SELECTION_MODEL(esma), row);
}
static void
-esma_move_selection_end (ESelectionModel *selection, int row)
+esma_real_move_selection_end (ESelectionModel *selection, int row)
{
ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
int old_start;
@@ -411,16 +443,38 @@ esma_move_selection_end (ESelectionModel *selection, int row)
esma_change_range(selection, old_end, new_end, TRUE);
if (new_end < old_end)
esma_change_range(selection, new_end, old_end, FALSE);
- e_selection_model_selection_changed(E_SELECTION_MODEL(esma));
+ esma->selected_row = -1;
+ esma->selected_range_end = -1;
+}
+
+static void
+esma_move_selection_end (ESelectionModel *selection, int row)
+{
+ esma_real_move_selection_end (selection, row);
+ e_selection_model_selection_changed(selection);
}
static void
esma_set_selection_end (ESelectionModel *selection, int row)
{
ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- esma_select_single_row(selection, esma->selection_start_row);
+ int selected_range_end = esma->selected_range_end;
+ int view_row = e_sorter_model_to_sorted(selection->sorter, row);
+
+ esma_real_select_single_row(selection, esma->selection_start_row);
esma->cursor_row = esma->selection_start_row;
- esma_move_selection_end(selection, row);
+ esma_real_move_selection_end(selection, row);
+
+ esma->selected_range_end = view_row;
+ if (selected_range_end != -1 && view_row != -1) {
+ if (selected_range_end == view_row - 1 ||
+ selected_range_end == view_row + 1) {
+ e_selection_model_selection_row_changed(selection, selected_range_end);
+ e_selection_model_selection_row_changed(selection, view_row);
+ return;
+ }
+ }
+ e_selection_model_selection_changed(selection);
}
int
@@ -443,6 +497,9 @@ e_selection_model_array_init (ESelectionModelArray *esma)
esma->selection_start_row = 0;
esma->cursor_row = -1;
esma->cursor_col = -1;
+
+ esma->selected_row = -1;
+ esma->selected_range_end = -1;
}
static void