From 73a6f3a7fa96bdfde9136d3b4a80d0f7f8150f87 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Wed, 11 Jul 2001 09:05:09 +0000 Subject: Use e_selection_model_do_something directly for page up and page down 2001-07-11 Christopher James Lahey * e-table.c (group_key_press), e-tree.c (item_key_press): Use e_selection_model_do_something directly for page up and page down instead of emulating a key press. svn path=/trunk/; revision=10990 --- widgets/table/e-tree.c | 48 ++++++++++++++++-------------------------------- 1 file changed, 16 insertions(+), 32 deletions(-) (limited to 'widgets/table/e-tree.c') diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index 7823c055f9..5064e582c6 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -528,45 +528,29 @@ item_key_press (ETableItem *eti, int row, int col, GdkEvent *event, ETree *et) { int return_val = 0; GdkEventKey *key = (GdkEventKey *) event; - GdkEventButton click; ETreePath path; + int y, row_local, col_local; + GtkAdjustment *vadj; switch (key->keyval) { case GDK_Page_Down: - gtk_adjustment_set_value( - gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas)), - CLAMP(gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas))->value + - (gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas))->page_size - 20), - 0, - gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas))->upper - - gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas))->page_size)); - click.type = GDK_BUTTON_PRESS; - click.window = GTK_LAYOUT (et->priv->table_canvas)->bin_window; - click.send_event = key->send_event; - click.time = key->time; - click.x = 30; - click.y = gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas))->page_size - 1; - click.state = key->state; - click.button = 1; - gtk_widget_event(GTK_WIDGET(et->priv->table_canvas), - (GdkEvent *) &click); + vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas)); + y = CLAMP(vadj->value + (2 * vadj->page_size - 20), 0, vadj->upper); + y -= vadj->value; + e_tree_get_cell_at (et, 30, y, &row_local, &col_local); + row_local = e_tree_view_to_model_row (et, row_local); + col_local = e_selection_model_cursor_col(E_SELECTION_MODEL (et->priv->selection)); + e_selection_model_do_something(E_SELECTION_MODEL (et->priv->selection), row_local, col_local, key->state); return_val = 1; break; case GDK_Page_Up: - gtk_adjustment_set_value( - gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas)), - gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas))->value - - (gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas))->page_size - 20)); - click.type = GDK_BUTTON_PRESS; - click.window = GTK_LAYOUT (et->priv->table_canvas)->bin_window; - click.send_event = key->send_event; - click.time = key->time; - click.x = 30; - click.y = 1; - click.state = key->state; - click.button = 1; - gtk_widget_event(GTK_WIDGET(et->priv->table_canvas), - (GdkEvent *) &click); + vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas)); + y = CLAMP(vadj->value - (vadj->page_size - 20), 0, vadj->upper); + y -= vadj->value; + e_tree_get_cell_at (et, 30, y, &row_local, &col_local); + row_local = e_tree_view_to_model_row (et, row_local); + col_local = e_selection_model_cursor_col(E_SELECTION_MODEL (et->priv->selection)); + e_selection_model_do_something(E_SELECTION_MODEL (et->priv->selection), row_local, col_local, key->state); return_val = 1; break; case '=': -- cgit