diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2001-01-22 09:48:54 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-01-22 09:48:54 +0800 |
commit | 4404cde3fc7f27f9dc348d388a4cad22af302ea0 (patch) | |
tree | 2f29928a68d1575bd7659334ce2c0dcd84296a96 /widgets/table | |
parent | ad3a86858e5fb751fe01e5b1cee800771cccfcaf (diff) | |
download | gsoc2013-evolution-4404cde3fc7f27f9dc348d388a4cad22af302ea0.tar gsoc2013-evolution-4404cde3fc7f27f9dc348d388a4cad22af302ea0.tar.gz gsoc2013-evolution-4404cde3fc7f27f9dc348d388a4cad22af302ea0.tar.bz2 gsoc2013-evolution-4404cde3fc7f27f9dc348d388a4cad22af302ea0.tar.lz gsoc2013-evolution-4404cde3fc7f27f9dc348d388a4cad22af302ea0.tar.xz gsoc2013-evolution-4404cde3fc7f27f9dc348d388a4cad22af302ea0.tar.zst gsoc2013-evolution-4404cde3fc7f27f9dc348d388a4cad22af302ea0.zip |
Made the cursor move when rows are inserted or deleted. If in single mode
2001-01-21 Christopher James Lahey <clahey@helixcode.com>
* e-table-selection-model.c: Made the cursor move when rows are
inserted or deleted. If in single mode and the selected row gets
removed, move it up.
svn path=/trunk/; revision=7691
Diffstat (limited to 'widgets/table')
-rw-r--r-- | widgets/table/e-table-selection-model.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/widgets/table/e-table-selection-model.c b/widgets/table/e-table-selection-model.c index 7c39648f55..85a22fd638 100644 --- a/widgets/table/e-table-selection-model.c +++ b/widgets/table/e-table-selection-model.c @@ -27,6 +27,8 @@ static GtkObjectClass *e_table_selection_model_parent_class; +static void etsm_select_single_row (ETableSelectionModel *selection, int row); + enum { CURSOR_CHANGED, SELECTION_CHANGED, @@ -74,6 +76,8 @@ model_row_inserted(ETableModel *etm, int row, ETableSelectionModel *etsm) etsm->selection[box] = (etsm->selection[box] & BITMASK_LEFT(row)) | ((etsm->selection[box] & BITMASK_RIGHT(row)) >> 1); etsm->row_count ++; } + if (etsm->cursor_row >= row) + etsm->cursor_row ++; } static void @@ -82,6 +86,7 @@ model_row_deleted(ETableModel *etm, int row, ETableSelectionModel *etsm) int box; int i; int last; + int selected = FALSE; if(etsm->row_count >= 0) { guint32 bitmask; box = row >> 5; @@ -89,6 +94,7 @@ model_row_deleted(ETableModel *etm, int row, ETableSelectionModel *etsm) /* Build bitmasks for the left and right half of the box */ bitmask = BITMASK_RIGHT(row) >> 1; + selected = e_table_selection_model_is_row_selected(etsm, row); /* Shift right half of box one bit to the left. */ etsm->selection[box] = (etsm->selection[box] & BITMASK_LEFT(row))| ((etsm->selection[box] & bitmask) << 1); @@ -106,7 +112,12 @@ model_row_deleted(ETableModel *etm, int row, ETableSelectionModel *etsm) if ((etsm->row_count & 0x1f) == 0) { etsm->selection = g_renew(gint, etsm->selection, etsm->row_count >> 5); } + if (selected && etsm->mode == GTK_SELECTION_SINGLE) { + etsm_select_single_row (etsm, row > 0 ? row - 1 : 0); + } } + if (etsm->cursor_row >= row && etsm->cursor_row > 0) + etsm->cursor_row --; } #else |