aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-07-11 17:05:09 +0800
committerChris Lahey <clahey@src.gnome.org>2001-07-11 17:05:09 +0800
commit73a6f3a7fa96bdfde9136d3b4a80d0f7f8150f87 (patch)
treea1447a8310d080accc03cdb214e32679b1074664 /widgets
parent96496c1392cea9179b9bfbf2b6895e69a6dd13af (diff)
downloadgsoc2013-evolution-73a6f3a7fa96bdfde9136d3b4a80d0f7f8150f87.tar
gsoc2013-evolution-73a6f3a7fa96bdfde9136d3b4a80d0f7f8150f87.tar.gz
gsoc2013-evolution-73a6f3a7fa96bdfde9136d3b4a80d0f7f8150f87.tar.bz2
gsoc2013-evolution-73a6f3a7fa96bdfde9136d3b4a80d0f7f8150f87.tar.lz
gsoc2013-evolution-73a6f3a7fa96bdfde9136d3b4a80d0f7f8150f87.tar.xz
gsoc2013-evolution-73a6f3a7fa96bdfde9136d3b4a80d0f7f8150f87.tar.zst
gsoc2013-evolution-73a6f3a7fa96bdfde9136d3b4a80d0f7f8150f87.zip
Use e_selection_model_do_something directly for page up and page down
2001-07-11 Christopher James Lahey <clahey@ximian.com> * 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
Diffstat (limited to 'widgets')
-rw-r--r--widgets/table/e-table.c49
-rw-r--r--widgets/table/e-tree.c48
2 files changed, 33 insertions, 64 deletions
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index 4474d3e093..dca3a74049 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -480,43 +480,28 @@ group_key_press (ETableGroup *etg, int row, int col, GdkEvent *event, ETable *et
{
int return_val = 0;
GdkEventKey *key = (GdkEventKey *) event;
- GdkEventButton click;
+ 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->table_canvas)),
- CLAMP(gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->value +
- (gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->page_size - 20),
- 0,
- gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->upper -
- gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->page_size));
- click.type = GDK_BUTTON_PRESS;
- click.window = GTK_LAYOUT (et->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->table_canvas))->page_size - 1;
- click.state = key->state;
- click.button = 1;
- gtk_widget_event(GTK_WIDGET(et->table_canvas),
- (GdkEvent *) &click);
+ vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas));
+ y = CLAMP(vadj->value + (2 * vadj->page_size - 20), 0, vadj->upper);
+ y -= vadj->value;
+ e_table_get_cell_at (et, 30, y, &row_local, &col_local);
+ row_local = e_table_view_to_model_row (et, row_local);
+ col_local = e_selection_model_cursor_col(E_SELECTION_MODEL (et->selection));
+ e_selection_model_do_something(E_SELECTION_MODEL (et->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->table_canvas)),
- gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->value -
- (gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->page_size - 20));
- click.type = GDK_BUTTON_PRESS;
- click.window = GTK_LAYOUT (et->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->table_canvas),
- (GdkEvent *) &click);
+ vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas));
+ y = CLAMP(vadj->value - (vadj->page_size - 20), 0, vadj->upper);
+ y -= vadj->value;
+ e_table_get_cell_at (et, 30, y, &row_local, &col_local);
+ row_local = e_table_view_to_model_row (et, row_local);
+ col_local = e_selection_model_cursor_col(E_SELECTION_MODEL (et->selection));
+ e_selection_model_do_something(E_SELECTION_MODEL (et->selection), row_local, col_local, key->state);
return_val = 1;
break;
default:
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 '=':