aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-07-27 07:01:48 +0800
committerChris Lahey <clahey@src.gnome.org>2000-07-27 07:01:48 +0800
commit0adf2e8584b9559fdaf185d04db2196c60949ced (patch)
treed8ffc26e24dc7de0a25bd5687e56af9d20fe5b2b /widgets/table
parenta8d433b4b89585bc9a1326f0f98c3fa91d3fc71f (diff)
downloadgsoc2013-evolution-0adf2e8584b9559fdaf185d04db2196c60949ced.tar
gsoc2013-evolution-0adf2e8584b9559fdaf185d04db2196c60949ced.tar.gz
gsoc2013-evolution-0adf2e8584b9559fdaf185d04db2196c60949ced.tar.bz2
gsoc2013-evolution-0adf2e8584b9559fdaf185d04db2196c60949ced.tar.lz
gsoc2013-evolution-0adf2e8584b9559fdaf185d04db2196c60949ced.tar.xz
gsoc2013-evolution-0adf2e8584b9559fdaf185d04db2196c60949ced.tar.zst
gsoc2013-evolution-0adf2e8584b9559fdaf185d04db2196c60949ced.zip
Fixed the model/view row confusion.
2000-07-26 Christopher James Lahey <clahey@helixcode.com> * e-table-item.c: Fixed the model/view row confusion. * e-table-selection-model.c: Changed one expression to use a #define properly. svn path=/trunk/; revision=4371
Diffstat (limited to 'widgets/table')
-rw-r--r--widgets/table/e-table-item.c24
-rw-r--r--widgets/table/e-table-selection-model.c2
2 files changed, 15 insertions, 11 deletions
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 9e66a487be..76996fed2e 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -537,7 +537,7 @@ eti_item_region_redraw (ETableItem *eti, int x0, int y0, int x1, int y1)
gnome_canvas_item_i2c_affine (item, i2c);
art_drect_affine_transform (&rect, &rect, i2c);
-
+
gnome_canvas_request_redraw (item->canvas, rect.x0, rect.y0, rect.x1, rect.y1);
}
@@ -552,7 +552,7 @@ eti_table_model_changed (ETableModel *table_model, ETableItem *eti)
#endif
eti->rows = e_table_model_row_count (eti->table_model);
-
+
free_height_cache(eti);
eti->needs_compute_height = 1;
@@ -576,7 +576,7 @@ eti_row_diff (ETableItem *eti, int start_row, int end_row)
int row, total;
total = 0;
-
+
for (row = start_row; row < end_row; row++)
total += eti_row_height (eti, row) + 1;
@@ -1143,7 +1143,7 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width,
xd = x_offset;
/* printf ("paint: %d %d\n", yd, yd + height); */
- selected = e_table_selection_model_is_row_selected(eti->selection, row);
+ selected = e_table_selection_model_is_row_selected(eti->selection, view_to_model_row(eti,row));
gtk_object_get(GTK_OBJECT(eti->selection),
"cursor_col", &cursor_col,
@@ -1353,7 +1353,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
if (!find_cell (eti, e->button.x, e->button.y, &col, &row, &x1, &y1))
return TRUE;
- e_table_selection_model_do_something(eti->selection, row, col, shifted, ctrled);
+ e_table_selection_model_do_something(eti->selection, view_to_model_row(eti, row), col, shifted, ctrled);
gtk_object_get(GTK_OBJECT(eti->selection),
"cursor_row", &cursor_row,
@@ -1548,9 +1548,9 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
gtk_signal_emit (GTK_OBJECT (eti), eti_signals [KEY_PRESS],
model_to_view_row(eti, cursor_row), cursor_col, e, &return_val);
} else {
- ecol = e_table_header_get_column (eti->header, cursor_col);
- ecell_view = eti->cell_views [cursor_col];
- e_cell_event (ecell_view, e, ecol->col_idx, cursor_col, model_to_view_row(eti, cursor_row));
+ ecol = e_table_header_get_column (eti->header, eti->editing_col);
+ ecell_view = eti->cell_views [eti->editing_col];
+ e_cell_event (ecell_view, e, ecol->col_idx, eti->editing_col, eti->editing_row);
}
}
break;
@@ -1744,12 +1744,16 @@ static void
eti_cursor_change (ETableSelectionModel *selection, int row, int col, ETableItem *eti)
{
int view_row = model_to_view_row(eti, row);
+ ETableCol *ecol;
gtk_signal_emit (GTK_OBJECT (eti), eti_signals [CURSOR_CHANGE],
view_row);
eti_request_region_show (eti, col, view_row, col, view_row);
- if (e_table_model_is_cell_editable(selection->model, col, row))
- e_table_item_enter_edit (eti, col, view_row);
+ ecol = e_table_header_get_column (eti->header, col);
+ if (e_table_model_is_cell_editable(selection->model, ecol->col_idx, view_row)) {
+ e_canvas_item_grab_focus(GNOME_CANVAS_ITEM(eti));
+ e_table_item_enter_edit (eti, ecol->col_idx, view_row);
+ }
}
static void
diff --git a/widgets/table/e-table-selection-model.c b/widgets/table/e-table-selection-model.c
index 35e0cb13aa..f896e37eaa 100644
--- a/widgets/table/e-table-selection-model.c
+++ b/widgets/table/e-table-selection-model.c
@@ -65,7 +65,7 @@ model_row_inserted(ETableModel *etm, int row, ETableSelectionModel *etsm)
}
/* The box is the word that our row is in. */
- box = row >> 5;
+ box = BOX(row);
/* Shift all words to the right of our box right one bit. */
for (i = etsm->row_count >> 5; i > box; i--) {
etsm->selection[i] = (etsm->selection[i] >> 1) | (etsm->selection[i - 1] << 31);