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
This commit is contained in:

committed by
Chris Lahey

parent
e5d02e7ed1
commit
effefd2815
@ -95,6 +95,13 @@ enum {
|
|||||||
ARG_UNIFORM_ROW_HEIGHT,
|
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 gint et_signals [LAST_SIGNAL] = { 0, };
|
||||||
|
|
||||||
static void e_table_fill_table (ETable *e_table, ETableModel *model);
|
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 gint et_focus (GtkContainer *container, GtkDirectionType direction);
|
||||||
|
|
||||||
static void scroll_off (ETable *et);
|
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
|
static void
|
||||||
et_disconnect_model (ETable *et)
|
et_disconnect_model (ETable *et)
|
||||||
@ -2421,22 +2428,31 @@ static gboolean
|
|||||||
scroll_timeout (gpointer data)
|
scroll_timeout (gpointer data)
|
||||||
{
|
{
|
||||||
ETable *et = data;
|
ETable *et = data;
|
||||||
int dy;
|
int dx = 0, dy = 0;
|
||||||
GtkAdjustment *v;
|
GtkAdjustment *h, *v;
|
||||||
double value;
|
double hvalue, vvalue;
|
||||||
|
|
||||||
if (et->scroll_down)
|
if (et->scroll_direction & ET_SCROLL_DOWN)
|
||||||
dy = 20;
|
dy += 20;
|
||||||
else
|
if (et->scroll_direction & ET_SCROLL_UP)
|
||||||
dy = -20;
|
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;
|
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));
|
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,
|
do_drag_motion(et,
|
||||||
et->last_drop_context,
|
et->last_drop_context,
|
||||||
et->last_drop_x,
|
et->last_drop_x,
|
||||||
@ -2448,12 +2464,12 @@ scroll_timeout (gpointer data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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)
|
if (et->scroll_idle_id != 0)
|
||||||
g_source_remove (et->scroll_idle_id);
|
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);
|
et->scroll_idle_id = g_timeout_add (100, scroll_timeout, et);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2517,6 +2533,7 @@ et_drag_motion(GtkWidget *widget,
|
|||||||
ETable *et)
|
ETable *et)
|
||||||
{
|
{
|
||||||
gboolean ret_val;
|
gboolean ret_val;
|
||||||
|
guint direction = 0;
|
||||||
|
|
||||||
et->last_drop_x = x;
|
et->last_drop_x = x;
|
||||||
et->last_drop_y = y;
|
et->last_drop_y = y;
|
||||||
@ -2534,14 +2551,19 @@ et_drag_motion(GtkWidget *widget,
|
|||||||
x -= widget->allocation.x;
|
x -= widget->allocation.x;
|
||||||
y -= widget->allocation.y;
|
y -= widget->allocation.y;
|
||||||
|
|
||||||
if (y < 20 || y > widget->allocation.height - 20) {
|
if (y < 20)
|
||||||
if (y < 20)
|
direction |= ET_SCROLL_UP;
|
||||||
scroll_on (et, FALSE);
|
if (y > widget->allocation.height - 20)
|
||||||
else
|
direction |= ET_SCROLL_DOWN;
|
||||||
scroll_on (et, TRUE);
|
if (x < 20)
|
||||||
} else {
|
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);
|
scroll_off (et);
|
||||||
}
|
|
||||||
|
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ typedef struct {
|
|||||||
|
|
||||||
guint is_grouped : 1;
|
guint is_grouped : 1;
|
||||||
|
|
||||||
guint scroll_down : 1;
|
guint scroll_direction : 4;
|
||||||
|
|
||||||
guint do_drag : 1;
|
guint do_drag : 1;
|
||||||
|
|
||||||
|
@ -99,6 +99,13 @@ enum {
|
|||||||
ARG_UNIFORM_ROW_HEIGHT,
|
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 {
|
struct ETreePriv {
|
||||||
ETreeModel *model;
|
ETreeModel *model;
|
||||||
ETreeSorted *sorted;
|
ETreeSorted *sorted;
|
||||||
@ -142,7 +149,7 @@ struct ETreePriv {
|
|||||||
|
|
||||||
guint horizontal_scrolling : 1;
|
guint horizontal_scrolling : 1;
|
||||||
|
|
||||||
guint scroll_down : 1;
|
guint scroll_direction : 4;
|
||||||
|
|
||||||
guint do_drag : 1;
|
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 gint et_focus (GtkContainer *container, GtkDirectionType direction);
|
||||||
|
|
||||||
static void scroll_off (ETree *et);
|
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_off (ETree *et);
|
||||||
static void hover_on (ETree *et, int x, int y);
|
static void hover_on (ETree *et, int x, int y);
|
||||||
|
|
||||||
@ -2294,22 +2301,31 @@ static gboolean
|
|||||||
scroll_timeout (gpointer data)
|
scroll_timeout (gpointer data)
|
||||||
{
|
{
|
||||||
ETree *et = data;
|
ETree *et = data;
|
||||||
int dy;
|
int dx = 0, dy = 0;
|
||||||
GtkAdjustment *v;
|
GtkAdjustment *v, *h;
|
||||||
double value;
|
double vvalue, hvalue;
|
||||||
|
|
||||||
if (et->priv->scroll_down)
|
if (et->priv->scroll_direction & ET_SCROLL_DOWN)
|
||||||
dy = 20;
|
dy += 20;
|
||||||
else
|
if (et->priv->scroll_direction & ET_SCROLL_UP)
|
||||||
dy = -20;
|
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;
|
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));
|
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,
|
do_drag_motion(et,
|
||||||
et->priv->last_drop_context,
|
et->priv->last_drop_context,
|
||||||
et->priv->last_drop_x,
|
et->priv->last_drop_x,
|
||||||
@ -2321,12 +2337,12 @@ scroll_timeout (gpointer data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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)
|
if (et->priv->scroll_idle_id != 0)
|
||||||
g_source_remove (et->priv->scroll_idle_id);
|
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);
|
et->priv->scroll_idle_id = g_timeout_add (100, scroll_timeout, et);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2478,6 +2494,7 @@ et_drag_motion(GtkWidget *widget,
|
|||||||
ETree *et)
|
ETree *et)
|
||||||
{
|
{
|
||||||
int ret_val;
|
int ret_val;
|
||||||
|
guint direction = 0;
|
||||||
|
|
||||||
et->priv->last_drop_x = x;
|
et->priv->last_drop_x = x;
|
||||||
et->priv->last_drop_y = y;
|
et->priv->last_drop_y = y;
|
||||||
@ -2503,14 +2520,19 @@ et_drag_motion(GtkWidget *widget,
|
|||||||
x -= widget->allocation.x;
|
x -= widget->allocation.x;
|
||||||
y -= widget->allocation.y;
|
y -= widget->allocation.y;
|
||||||
|
|
||||||
if (y < 20 || y > widget->allocation.height - 20) {
|
if (y < 20)
|
||||||
if (y < 20)
|
direction |= ET_SCROLL_UP;
|
||||||
scroll_on (et, FALSE);
|
if (y > widget->allocation.height - 20)
|
||||||
else
|
direction |= ET_SCROLL_DOWN;
|
||||||
scroll_on (et, TRUE);
|
if (x < 20)
|
||||||
} else {
|
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);
|
scroll_off (et);
|
||||||
}
|
|
||||||
|
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user