diff options
author | Christopher James Lahey <clahey@ximian.com> | 2002-01-09 14:49:52 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2002-01-09 14:49:52 +0800 |
commit | effefd28156b8ad5aff067f3031fd4b7627a2d5c (patch) | |
tree | dd7ff58c9245955565ab1eac46bcd19e0f370f82 | |
parent | e5d02e7ed1e4ba0b007cb130be6f4d268ecc9e92 (diff) | |
download | gsoc2013-evolution-effefd28156b8ad5aff067f3031fd4b7627a2d5c.tar gsoc2013-evolution-effefd28156b8ad5aff067f3031fd4b7627a2d5c.tar.gz gsoc2013-evolution-effefd28156b8ad5aff067f3031fd4b7627a2d5c.tar.bz2 gsoc2013-evolution-effefd28156b8ad5aff067f3031fd4b7627a2d5c.tar.lz gsoc2013-evolution-effefd28156b8ad5aff067f3031fd4b7627a2d5c.tar.xz gsoc2013-evolution-effefd28156b8ad5aff067f3031fd4b7627a2d5c.tar.zst gsoc2013-evolution-effefd28156b8ad5aff067f3031fd4b7627a2d5c.zip |
Bumped version number to 0.19.99.0. Bumped GAL_CURRENT. Reset
2002-01-09 Christopher James Lahey <clahey@ximian.com>
* configure.in: Bumped version number to 0.19.99.0. Bumped
GAL_CURRENT. Reset GAL_REVISION.
From gal/e-table/ChangeLog:
2002-01-09 Christopher James Lahey <clahey@ximian.com>
* e-table.c, e-table.h (scroll_timeout), e-tree.c
(scroll_timeout): Made these handle horizontal scrolling during
drags.
svn path=/trunk/; revision=15272
-rw-r--r-- | widgets/table/e-table.c | 62 | ||||
-rw-r--r-- | widgets/table/e-table.h | 2 | ||||
-rw-r--r-- | widgets/table/e-tree.c | 66 |
3 files changed, 87 insertions, 43 deletions
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index 1b0784b6ed..2d37fa45ef 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -95,6 +95,13 @@ enum { ARG_UNIFORM_ROW_HEIGHT, }; +enum { + ET_SCROLL_UP = 1 << 0, + ET_SCROLL_DOWN = 1 << 1, + ET_SCROLL_LEFT = 1 << 2, + ET_SCROLL_RIGHT = 1 << 3 +}; + static gint et_signals [LAST_SIGNAL] = { 0, }; static void e_table_fill_table (ETable *e_table, ETableModel *model); @@ -146,7 +153,7 @@ static void et_drag_data_received(GtkWidget *widget, static gint et_focus (GtkContainer *container, GtkDirectionType direction); static void scroll_off (ETable *et); -static void scroll_on (ETable *et, gboolean down); +static void scroll_on (ETable *et, guint scroll_direction); static void et_disconnect_model (ETable *et) @@ -2421,22 +2428,31 @@ static gboolean scroll_timeout (gpointer data) { ETable *et = data; - int dy; - GtkAdjustment *v; - double value; + int dx = 0, dy = 0; + GtkAdjustment *h, *v; + double hvalue, vvalue; - if (et->scroll_down) - dy = 20; - else - dy = -20; + if (et->scroll_direction & ET_SCROLL_DOWN) + dy += 20; + if (et->scroll_direction & ET_SCROLL_UP) + dy -= 20; + + if (et->scroll_direction & ET_SCROLL_RIGHT) + dx += 20; + if (et->scroll_direction & ET_SCROLL_LEFT) + dx -= 20; + h = GTK_LAYOUT(et->table_canvas)->hadjustment; v = GTK_LAYOUT(et->table_canvas)->vadjustment; - value = v->value; + hvalue = h->value; + vvalue = v->value; + gtk_adjustment_set_value(h, CLAMP(h->value + dx, h->lower, h->upper - h->page_size)); gtk_adjustment_set_value(v, CLAMP(v->value + dy, v->lower, v->upper - v->page_size)); - if (v->value != value) + if (h->value != hvalue || + v->value != vvalue) do_drag_motion(et, et->last_drop_context, et->last_drop_x, @@ -2448,12 +2464,12 @@ scroll_timeout (gpointer data) } static void -scroll_on (ETable *et, gboolean down) +scroll_on (ETable *et, guint scroll_direction) { - if (et->scroll_idle_id == 0 || down != et->scroll_down) { + if (et->scroll_idle_id == 0 || scroll_direction != et->scroll_direction) { if (et->scroll_idle_id != 0) g_source_remove (et->scroll_idle_id); - et->scroll_down = down; + et->scroll_direction = scroll_direction; et->scroll_idle_id = g_timeout_add (100, scroll_timeout, et); } } @@ -2517,6 +2533,7 @@ et_drag_motion(GtkWidget *widget, ETable *et) { gboolean ret_val; + guint direction = 0; et->last_drop_x = x; et->last_drop_y = y; @@ -2534,14 +2551,19 @@ et_drag_motion(GtkWidget *widget, x -= widget->allocation.x; y -= widget->allocation.y; - if (y < 20 || y > widget->allocation.height - 20) { - if (y < 20) - scroll_on (et, FALSE); - else - scroll_on (et, TRUE); - } else { + if (y < 20) + direction |= ET_SCROLL_UP; + if (y > widget->allocation.height - 20) + direction |= ET_SCROLL_DOWN; + if (x < 20) + direction |= ET_SCROLL_LEFT; + if (x > widget->allocation.width - 20) + direction |= ET_SCROLL_RIGHT; + + if (direction != 0) + scroll_on (et, direction); + else scroll_off (et); - } return ret_val; } diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h index 9900821eb7..30c2887cd0 100644 --- a/widgets/table/e-table.h +++ b/widgets/table/e-table.h @@ -108,7 +108,7 @@ typedef struct { guint is_grouped : 1; - guint scroll_down : 1; + guint scroll_direction : 4; guint do_drag : 1; diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index db68daff11..4e1154f44f 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -99,6 +99,13 @@ enum { ARG_UNIFORM_ROW_HEIGHT, }; +enum { + ET_SCROLL_UP = 1 << 0, + ET_SCROLL_DOWN = 1 << 1, + ET_SCROLL_LEFT = 1 << 2, + ET_SCROLL_RIGHT = 1 << 3 +}; + struct ETreePriv { ETreeModel *model; ETreeSorted *sorted; @@ -142,7 +149,7 @@ struct ETreePriv { guint horizontal_scrolling : 1; - guint scroll_down : 1; + guint scroll_direction : 4; guint do_drag : 1; @@ -219,7 +226,7 @@ static void et_drag_data_received(GtkWidget *widget, static gint et_focus (GtkContainer *container, GtkDirectionType direction); static void scroll_off (ETree *et); -static void scroll_on (ETree *et, gboolean down); +static void scroll_on (ETree *et, guint scroll_direction); static void hover_off (ETree *et); static void hover_on (ETree *et, int x, int y); @@ -2294,22 +2301,31 @@ static gboolean scroll_timeout (gpointer data) { ETree *et = data; - int dy; - GtkAdjustment *v; - double value; + int dx = 0, dy = 0; + GtkAdjustment *v, *h; + double vvalue, hvalue; - if (et->priv->scroll_down) - dy = 20; - else - dy = -20; + if (et->priv->scroll_direction & ET_SCROLL_DOWN) + dy += 20; + if (et->priv->scroll_direction & ET_SCROLL_UP) + dy -= 20; + + if (et->priv->scroll_direction & ET_SCROLL_RIGHT) + dx += 20; + if (et->priv->scroll_direction & ET_SCROLL_LEFT) + dx -= 20; + h = GTK_LAYOUT(et->priv->table_canvas)->hadjustment; v = GTK_LAYOUT(et->priv->table_canvas)->vadjustment; - value = v->value; + hvalue = h->value; + vvalue = v->value; + gtk_adjustment_set_value(h, CLAMP(h->value + dx, h->lower, h->upper - h->page_size)); gtk_adjustment_set_value(v, CLAMP(v->value + dy, v->lower, v->upper - v->page_size)); - if (v->value != value) + if (h->value != hvalue || + v->value != vvalue) do_drag_motion(et, et->priv->last_drop_context, et->priv->last_drop_x, @@ -2321,12 +2337,12 @@ scroll_timeout (gpointer data) } static void -scroll_on (ETree *et, gboolean down) +scroll_on (ETree *et, guint scroll_direction) { - if (et->priv->scroll_idle_id == 0 || down != et->priv->scroll_down) { + if (et->priv->scroll_idle_id == 0 || scroll_direction != et->priv->scroll_direction) { if (et->priv->scroll_idle_id != 0) g_source_remove (et->priv->scroll_idle_id); - et->priv->scroll_down = down; + et->priv->scroll_direction = scroll_direction; et->priv->scroll_idle_id = g_timeout_add (100, scroll_timeout, et); } } @@ -2339,7 +2355,7 @@ scroll_off (ETree *et) et->priv->scroll_idle_id = 0; } } - + static gboolean hover_timeout (gpointer data) { @@ -2478,6 +2494,7 @@ et_drag_motion(GtkWidget *widget, ETree *et) { int ret_val; + guint direction = 0; et->priv->last_drop_x = x; et->priv->last_drop_y = y; @@ -2503,14 +2520,19 @@ et_drag_motion(GtkWidget *widget, x -= widget->allocation.x; y -= widget->allocation.y; - if (y < 20 || y > widget->allocation.height - 20) { - if (y < 20) - scroll_on (et, FALSE); - else - scroll_on (et, TRUE); - } else { + if (y < 20) + direction |= ET_SCROLL_UP; + if (y > widget->allocation.height - 20) + direction |= ET_SCROLL_DOWN; + if (x < 20) + direction |= ET_SCROLL_LEFT; + if (x > widget->allocation.width - 20) + direction |= ET_SCROLL_RIGHT; + + if (direction != 0) + scroll_on (et, direction); + else scroll_off (et); - } return ret_val; } |