use the visual scroll steps.

2001-02-16  Havoc Pennington  <hp@redhat.com>

	* gtk/gtkvscrollbar.c (gtk_vscrollbar_trough_keys): use the visual
	scroll steps.

	* gtk/gtkvscale.c (gtk_vscale_trough_keys): use the visual scroll
	steps, and add Ctrl-arrow shortcuts for paging visually as with
	HScale, since Page Up and Page Down move logically.

	* gtk/gtkenums.h (GtkScrollType): add GTK_SCROLL_STEP_UP,
	GTK_SCROLL_STEP_DOWN, etc. for visual scroll directions

	* gtk/gtkrange.c (gtk_range_key_press): handle the visual scroll
	steps
	(gtk_range_scroll): handle the visual steps

	* gtk/gtklist.c (gtk_list_scroll_horizontal): handle the up/down
	scroll steps

	* gtk/gtkhscale.c (gtk_hscale_trough_keys): use the visual scroll
	steps, not the logical ones.

	* gtk/gtkclist.c (move_focus_row): handle the up/down scroll steps
	(scroll_vertical): handle up/down steps
This commit is contained in:
Havoc Pennington 2001-02-19 20:06:37 +00:00 committed by Havoc Pennington
parent ba46da61a7
commit 3a99bdf5a7
15 changed files with 331 additions and 14 deletions

View File

@ -1,3 +1,28 @@
2001-02-16 Havoc Pennington <hp@redhat.com>
* gtk/gtkvscrollbar.c (gtk_vscrollbar_trough_keys): use the visual
scroll steps.
* gtk/gtkvscale.c (gtk_vscale_trough_keys): use the visual scroll
steps, and add Ctrl-arrow shortcuts for paging visually as with
HScale, since Page Up and Page Down move logically.
* gtk/gtkenums.h (GtkScrollType): add GTK_SCROLL_STEP_UP,
GTK_SCROLL_STEP_DOWN, etc. for visual scroll directions
* gtk/gtkrange.c (gtk_range_key_press): handle the visual scroll
steps
(gtk_range_scroll): handle the visual steps
* gtk/gtklist.c (gtk_list_scroll_horizontal): handle the up/down
scroll steps
* gtk/gtkhscale.c (gtk_hscale_trough_keys): use the visual scroll
steps, not the logical ones.
* gtk/gtkclist.c (move_focus_row): handle the up/down scroll steps
(scroll_vertical): handle up/down steps
2001-02-19 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkimage-fb.c (gdk_image_new_bitmap):
@ -82,6 +107,7 @@ Sat Feb 17 06:47:27 2001 Tim Janik <timj@gtk.org>
* gtk/gtkliststore.c (gtk_list_store_set_valist):
fix G_VALUE_COLLECT() and G_VALUE_LCOPY() calls.
>>>>>>> 1.1728
Fri Feb 16 17:49:59 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.[hc], gtk/gtkliststore.[ch]: removed

View File

@ -1,3 +1,28 @@
2001-02-16 Havoc Pennington <hp@redhat.com>
* gtk/gtkvscrollbar.c (gtk_vscrollbar_trough_keys): use the visual
scroll steps.
* gtk/gtkvscale.c (gtk_vscale_trough_keys): use the visual scroll
steps, and add Ctrl-arrow shortcuts for paging visually as with
HScale, since Page Up and Page Down move logically.
* gtk/gtkenums.h (GtkScrollType): add GTK_SCROLL_STEP_UP,
GTK_SCROLL_STEP_DOWN, etc. for visual scroll directions
* gtk/gtkrange.c (gtk_range_key_press): handle the visual scroll
steps
(gtk_range_scroll): handle the visual steps
* gtk/gtklist.c (gtk_list_scroll_horizontal): handle the up/down
scroll steps
* gtk/gtkhscale.c (gtk_hscale_trough_keys): use the visual scroll
steps, not the logical ones.
* gtk/gtkclist.c (move_focus_row): handle the up/down scroll steps
(scroll_vertical): handle up/down steps
2001-02-19 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkimage-fb.c (gdk_image_new_bitmap):
@ -82,6 +107,7 @@ Sat Feb 17 06:47:27 2001 Tim Janik <timj@gtk.org>
* gtk/gtkliststore.c (gtk_list_store_set_valist):
fix G_VALUE_COLLECT() and G_VALUE_LCOPY() calls.
>>>>>>> 1.1728
Fri Feb 16 17:49:59 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.[hc], gtk/gtkliststore.[ch]: removed

View File

@ -1,3 +1,28 @@
2001-02-16 Havoc Pennington <hp@redhat.com>
* gtk/gtkvscrollbar.c (gtk_vscrollbar_trough_keys): use the visual
scroll steps.
* gtk/gtkvscale.c (gtk_vscale_trough_keys): use the visual scroll
steps, and add Ctrl-arrow shortcuts for paging visually as with
HScale, since Page Up and Page Down move logically.
* gtk/gtkenums.h (GtkScrollType): add GTK_SCROLL_STEP_UP,
GTK_SCROLL_STEP_DOWN, etc. for visual scroll directions
* gtk/gtkrange.c (gtk_range_key_press): handle the visual scroll
steps
(gtk_range_scroll): handle the visual steps
* gtk/gtklist.c (gtk_list_scroll_horizontal): handle the up/down
scroll steps
* gtk/gtkhscale.c (gtk_hscale_trough_keys): use the visual scroll
steps, not the logical ones.
* gtk/gtkclist.c (move_focus_row): handle the up/down scroll steps
(scroll_vertical): handle up/down steps
2001-02-19 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkimage-fb.c (gdk_image_new_bitmap):
@ -82,6 +107,7 @@ Sat Feb 17 06:47:27 2001 Tim Janik <timj@gtk.org>
* gtk/gtkliststore.c (gtk_list_store_set_valist):
fix G_VALUE_COLLECT() and G_VALUE_LCOPY() calls.
>>>>>>> 1.1728
Fri Feb 16 17:49:59 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.[hc], gtk/gtkliststore.[ch]: removed

View File

@ -1,3 +1,28 @@
2001-02-16 Havoc Pennington <hp@redhat.com>
* gtk/gtkvscrollbar.c (gtk_vscrollbar_trough_keys): use the visual
scroll steps.
* gtk/gtkvscale.c (gtk_vscale_trough_keys): use the visual scroll
steps, and add Ctrl-arrow shortcuts for paging visually as with
HScale, since Page Up and Page Down move logically.
* gtk/gtkenums.h (GtkScrollType): add GTK_SCROLL_STEP_UP,
GTK_SCROLL_STEP_DOWN, etc. for visual scroll directions
* gtk/gtkrange.c (gtk_range_key_press): handle the visual scroll
steps
(gtk_range_scroll): handle the visual steps
* gtk/gtklist.c (gtk_list_scroll_horizontal): handle the up/down
scroll steps
* gtk/gtkhscale.c (gtk_hscale_trough_keys): use the visual scroll
steps, not the logical ones.
* gtk/gtkclist.c (move_focus_row): handle the up/down scroll steps
(scroll_vertical): handle up/down steps
2001-02-19 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkimage-fb.c (gdk_image_new_bitmap):
@ -82,6 +107,7 @@ Sat Feb 17 06:47:27 2001 Tim Janik <timj@gtk.org>
* gtk/gtkliststore.c (gtk_list_store_set_valist):
fix G_VALUE_COLLECT() and G_VALUE_LCOPY() calls.
>>>>>>> 1.1728
Fri Feb 16 17:49:59 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.[hc], gtk/gtkliststore.[ch]: removed

View File

@ -1,3 +1,28 @@
2001-02-16 Havoc Pennington <hp@redhat.com>
* gtk/gtkvscrollbar.c (gtk_vscrollbar_trough_keys): use the visual
scroll steps.
* gtk/gtkvscale.c (gtk_vscale_trough_keys): use the visual scroll
steps, and add Ctrl-arrow shortcuts for paging visually as with
HScale, since Page Up and Page Down move logically.
* gtk/gtkenums.h (GtkScrollType): add GTK_SCROLL_STEP_UP,
GTK_SCROLL_STEP_DOWN, etc. for visual scroll directions
* gtk/gtkrange.c (gtk_range_key_press): handle the visual scroll
steps
(gtk_range_scroll): handle the visual steps
* gtk/gtklist.c (gtk_list_scroll_horizontal): handle the up/down
scroll steps
* gtk/gtkhscale.c (gtk_hscale_trough_keys): use the visual scroll
steps, not the logical ones.
* gtk/gtkclist.c (move_focus_row): handle the up/down scroll steps
(scroll_vertical): handle up/down steps
2001-02-19 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkimage-fb.c (gdk_image_new_bitmap):
@ -82,6 +107,7 @@ Sat Feb 17 06:47:27 2001 Tim Janik <timj@gtk.org>
* gtk/gtkliststore.c (gtk_list_store_set_valist):
fix G_VALUE_COLLECT() and G_VALUE_LCOPY() calls.
>>>>>>> 1.1728
Fri Feb 16 17:49:59 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.[hc], gtk/gtkliststore.[ch]: removed

View File

@ -1,3 +1,28 @@
2001-02-16 Havoc Pennington <hp@redhat.com>
* gtk/gtkvscrollbar.c (gtk_vscrollbar_trough_keys): use the visual
scroll steps.
* gtk/gtkvscale.c (gtk_vscale_trough_keys): use the visual scroll
steps, and add Ctrl-arrow shortcuts for paging visually as with
HScale, since Page Up and Page Down move logically.
* gtk/gtkenums.h (GtkScrollType): add GTK_SCROLL_STEP_UP,
GTK_SCROLL_STEP_DOWN, etc. for visual scroll directions
* gtk/gtkrange.c (gtk_range_key_press): handle the visual scroll
steps
(gtk_range_scroll): handle the visual steps
* gtk/gtklist.c (gtk_list_scroll_horizontal): handle the up/down
scroll steps
* gtk/gtkhscale.c (gtk_hscale_trough_keys): use the visual scroll
steps, not the logical ones.
* gtk/gtkclist.c (move_focus_row): handle the up/down scroll steps
(scroll_vertical): handle up/down steps
2001-02-19 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkimage-fb.c (gdk_image_new_bitmap):
@ -82,6 +107,7 @@ Sat Feb 17 06:47:27 2001 Tim Janik <timj@gtk.org>
* gtk/gtkliststore.c (gtk_list_store_set_valist):
fix G_VALUE_COLLECT() and G_VALUE_LCOPY() calls.
>>>>>>> 1.1728
Fri Feb 16 17:49:59 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.[hc], gtk/gtkliststore.[ch]: removed

View File

@ -1,3 +1,28 @@
2001-02-16 Havoc Pennington <hp@redhat.com>
* gtk/gtkvscrollbar.c (gtk_vscrollbar_trough_keys): use the visual
scroll steps.
* gtk/gtkvscale.c (gtk_vscale_trough_keys): use the visual scroll
steps, and add Ctrl-arrow shortcuts for paging visually as with
HScale, since Page Up and Page Down move logically.
* gtk/gtkenums.h (GtkScrollType): add GTK_SCROLL_STEP_UP,
GTK_SCROLL_STEP_DOWN, etc. for visual scroll directions
* gtk/gtkrange.c (gtk_range_key_press): handle the visual scroll
steps
(gtk_range_scroll): handle the visual steps
* gtk/gtklist.c (gtk_list_scroll_horizontal): handle the up/down
scroll steps
* gtk/gtkhscale.c (gtk_hscale_trough_keys): use the visual scroll
steps, not the logical ones.
* gtk/gtkclist.c (move_focus_row): handle the up/down scroll steps
(scroll_vertical): handle up/down steps
2001-02-19 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkimage-fb.c (gdk_image_new_bitmap):
@ -82,6 +107,7 @@ Sat Feb 17 06:47:27 2001 Tim Janik <timj@gtk.org>
* gtk/gtkliststore.c (gtk_list_store_set_valist):
fix G_VALUE_COLLECT() and G_VALUE_LCOPY() calls.
>>>>>>> 1.1728
Fri Feb 16 17:49:59 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.[hc], gtk/gtkliststore.[ch]: removed

View File

@ -6861,6 +6861,7 @@ move_focus_row (GtkCList *clist,
switch (scroll_type)
{
case GTK_SCROLL_STEP_UP:
case GTK_SCROLL_STEP_BACKWARD:
if (clist->focus_row <= 0)
return;
@ -6868,6 +6869,8 @@ move_focus_row (GtkCList *clist,
clist->focus_row--;
gtk_clist_draw_focus (widget);
break;
case GTK_SCROLL_STEP_DOWN:
case GTK_SCROLL_STEP_FORWARD:
if (clist->focus_row >= clist->rows - 1)
return;
@ -6875,6 +6878,7 @@ move_focus_row (GtkCList *clist,
clist->focus_row++;
gtk_clist_draw_focus (widget);
break;
case GTK_SCROLL_PAGE_UP:
case GTK_SCROLL_PAGE_BACKWARD:
if (clist->focus_row <= 0)
return;
@ -6885,6 +6889,7 @@ move_focus_row (GtkCList *clist,
(2 * (clist->row_height + CELL_SPACING)));
gtk_clist_draw_focus (widget);
break;
case GTK_SCROLL_PAGE_DOWN:
case GTK_SCROLL_PAGE_FORWARD:
if (clist->focus_row >= clist->rows - 1)
return;
@ -7029,10 +7034,14 @@ scroll_vertical (GtkCList *clist,
clist->focus_row, -1, NULL);
switch (scroll_type)
{
case GTK_SCROLL_PAGE_UP:
case GTK_SCROLL_STEP_UP:
case GTK_SCROLL_STEP_BACKWARD:
case GTK_SCROLL_PAGE_BACKWARD:
gtk_clist_moveto (clist, clist->focus_row, -1, 0, 0);
break;
case GTK_SCROLL_PAGE_DOWN:
case GTK_SCROLL_STEP_DOWN:
case GTK_SCROLL_STEP_FORWARD:
case GTK_SCROLL_PAGE_FORWARD:
gtk_clist_moveto (clist, clist->focus_row, -1, 1, 0);

View File

@ -254,7 +254,15 @@ typedef enum
GTK_SCROLL_STEP_FORWARD,
GTK_SCROLL_PAGE_BACKWARD,
GTK_SCROLL_PAGE_FORWARD,
GTK_SCROLL_JUMP
GTK_SCROLL_JUMP,
GTK_SCROLL_STEP_UP,
GTK_SCROLL_STEP_DOWN,
GTK_SCROLL_PAGE_UP,
GTK_SCROLL_PAGE_DOWN,
GTK_SCROLL_STEP_LEFT,
GTK_SCROLL_STEP_RIGHT,
GTK_SCROLL_PAGE_LEFT,
GTK_SCROLL_PAGE_RIGHT
} GtkScrollType;
/* list selection modes */

View File

@ -552,16 +552,16 @@ gtk_hscale_trough_keys (GtkRange *range,
case GDK_Left:
return_val = TRUE;
if (key->state & GDK_CONTROL_MASK)
*scroll = GTK_SCROLL_PAGE_BACKWARD;
*scroll = GTK_SCROLL_PAGE_LEFT;
else
*scroll = GTK_SCROLL_STEP_BACKWARD;
*scroll = GTK_SCROLL_STEP_LEFT;
break;
case GDK_Right:
return_val = TRUE;
if (key->state & GDK_CONTROL_MASK)
*scroll = GTK_SCROLL_PAGE_FORWARD;
*scroll = GTK_SCROLL_PAGE_RIGHT;
else
*scroll = GTK_SCROLL_STEP_FORWARD;
*scroll = GTK_SCROLL_STEP_RIGHT;
break;
case GDK_Home:
return_val = TRUE;

View File

@ -2217,18 +2217,22 @@ gtk_list_scroll_horizontal (GtkList *list,
switch (scroll_type)
{
case GTK_SCROLL_STEP_UP:
case GTK_SCROLL_STEP_BACKWARD:
adj->value = CLAMP (adj->value - adj->step_increment, adj->lower,
adj->upper - adj->page_size);
break;
case GTK_SCROLL_STEP_DOWN:
case GTK_SCROLL_STEP_FORWARD:
adj->value = CLAMP (adj->value + adj->step_increment, adj->lower,
adj->upper - adj->page_size);
break;
case GTK_SCROLL_PAGE_UP:
case GTK_SCROLL_PAGE_BACKWARD:
adj->value = CLAMP (adj->value - adj->page_increment, adj->lower,
adj->upper - adj->page_size);
break;
case GTK_SCROLL_PAGE_DOWN:
case GTK_SCROLL_PAGE_FORWARD:
adj->value = CLAMP (adj->value + adj->page_increment, adj->lower,
adj->upper - adj->page_size);

View File

@ -1116,7 +1116,7 @@ gtk_range_key_press (GtkWidget *widget,
range = GTK_RANGE (widget);
return_val = FALSE;
if (RANGE_CLASS (range)->trough_keys)
return_val = (* RANGE_CLASS (range)->trough_keys) (range, event, &scroll, &pos);
@ -1125,15 +1125,45 @@ gtk_range_key_press (GtkWidget *widget,
if (scroll != GTK_SCROLL_NONE)
{
range->scroll_type = scroll;
gtk_range_scroll (range, -1);
if (range->old_value != range->adjustment->value)
{
gtk_signal_emit_by_name (GTK_OBJECT (range->adjustment), "value_changed");
switch (range->scroll_type)
{
case GTK_SCROLL_STEP_LEFT:
if (should_invert (range, TRUE))
gtk_range_draw_step_forw (range);
else
gtk_range_draw_step_back (range);
break;
case GTK_SCROLL_STEP_UP:
if (should_invert (range, FALSE))
gtk_range_draw_step_forw (range);
else
gtk_range_draw_step_back (range);
break;
case GTK_SCROLL_STEP_RIGHT:
if (should_invert (range, TRUE))
gtk_range_draw_step_back (range);
else
gtk_range_draw_step_forw (range);
break;
case GTK_SCROLL_STEP_DOWN:
if (should_invert (range, FALSE))
gtk_range_draw_step_back (range);
else
gtk_range_draw_step_forw (range);
break;
case GTK_SCROLL_STEP_BACKWARD:
gtk_range_draw_step_back (range);
break;
case GTK_SCROLL_STEP_FORWARD:
gtk_range_draw_step_forw (range);
break;
@ -1374,13 +1404,79 @@ gtk_range_scroll (GtkRange *range,
{
gfloat new_value;
gint return_val;
GtkScrollType scroll_type;
g_return_val_if_fail (GTK_IS_RANGE (range), FALSE);
new_value = range->adjustment->value;
return_val = TRUE;
switch (range->scroll_type)
/* Translate visual to logical */
scroll_type = range->scroll_type;
switch (scroll_type)
{
case GTK_SCROLL_STEP_UP:
if (should_invert (range, FALSE))
scroll_type = GTK_SCROLL_STEP_FORWARD;
else
scroll_type = GTK_SCROLL_STEP_BACKWARD;
break;
case GTK_SCROLL_STEP_DOWN:
if (should_invert (range, FALSE))
scroll_type = GTK_SCROLL_STEP_BACKWARD;
else
scroll_type = GTK_SCROLL_STEP_FORWARD;
break;
case GTK_SCROLL_PAGE_UP:
if (should_invert (range, FALSE))
scroll_type = GTK_SCROLL_PAGE_FORWARD;
else
scroll_type = GTK_SCROLL_PAGE_BACKWARD;
break;
case GTK_SCROLL_PAGE_DOWN:
if (should_invert (range, FALSE))
scroll_type = GTK_SCROLL_PAGE_BACKWARD;
else
scroll_type = GTK_SCROLL_PAGE_FORWARD;
break;
case GTK_SCROLL_STEP_LEFT:
if (should_invert (range, TRUE))
scroll_type = GTK_SCROLL_STEP_FORWARD;
else
scroll_type = GTK_SCROLL_STEP_BACKWARD;
break;
case GTK_SCROLL_STEP_RIGHT:
if (should_invert (range, TRUE))
scroll_type = GTK_SCROLL_STEP_BACKWARD;
else
scroll_type = GTK_SCROLL_STEP_FORWARD;
break;
case GTK_SCROLL_PAGE_LEFT:
if (should_invert (range, TRUE))
scroll_type = GTK_SCROLL_PAGE_FORWARD;
else
scroll_type = GTK_SCROLL_PAGE_BACKWARD;
break;
case GTK_SCROLL_PAGE_RIGHT:
if (should_invert (range, TRUE))
scroll_type = GTK_SCROLL_PAGE_BACKWARD;
else
scroll_type = GTK_SCROLL_PAGE_FORWARD;
break;
default:
break;
}
switch (scroll_type)
{
case GTK_SCROLL_NONE:
break;
@ -1433,8 +1529,20 @@ gtk_range_scroll (GtkRange *range,
range->timer = 0;
}
break;
}
case GTK_SCROLL_STEP_UP:
case GTK_SCROLL_STEP_DOWN:
case GTK_SCROLL_PAGE_UP:
case GTK_SCROLL_PAGE_DOWN:
case GTK_SCROLL_STEP_LEFT:
case GTK_SCROLL_STEP_RIGHT:
case GTK_SCROLL_PAGE_LEFT:
case GTK_SCROLL_PAGE_RIGHT:
g_assert_not_reached ();
break;
}
if (new_value != range->adjustment->value)
{
range->adjustment->value = new_value;

View File

@ -64,7 +64,7 @@ struct _GtkRange
guint8 button;
gint8 digits;
guint policy : 2;
guint scroll_type : 3;
guint scroll_type : 5;
guint in_child : 3;
guint click_child : 3;
guint need_timer : 1;

View File

@ -554,11 +554,17 @@ gtk_vscale_trough_keys (GtkRange *range,
{
case GDK_Up:
return_val = TRUE;
*scroll = GTK_SCROLL_STEP_BACKWARD;
if (key->state & GDK_CONTROL_MASK)
*scroll = GTK_SCROLL_PAGE_UP;
else
*scroll = GTK_SCROLL_STEP_UP;
break;
case GDK_Down:
return_val = TRUE;
*scroll = GTK_SCROLL_STEP_FORWARD;
if (key->state & GDK_CONTROL_MASK)
*scroll = GTK_SCROLL_PAGE_DOWN;
else
*scroll = GTK_SCROLL_STEP_DOWN;
break;
case GDK_Page_Up:
return_val = TRUE;

View File

@ -436,11 +436,11 @@ gtk_vscrollbar_trough_keys(GtkRange *range,
{
case GDK_Up:
return_val = TRUE;
*scroll = GTK_SCROLL_STEP_BACKWARD;
*scroll = GTK_SCROLL_STEP_UP;
break;
case GDK_Down:
return_val = TRUE;
*scroll = GTK_SCROLL_STEP_FORWARD;
*scroll = GTK_SCROLL_STEP_DOWN;
break;
case GDK_Page_Up:
return_val = TRUE;