Commit 0ec0514b authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

changed wheel scrolling to be HIG-compliant (control zooms). Also handle

2005-11-18  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpgradienteditor.c (view_events):
	* app/widgets/gimpnavigationview.c (gimp_navigation_view_scroll):
	changed wheel scrolling to be HIG-compliant (control zooms). Also
	handle GDK_SCROLL_LEFT/RIGHT correctly and made shift switch the
	scroll axis. The widgets behave as the image window now.
parent be495d1a
2005-11-18 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpgradienteditor.c (view_events):
* app/widgets/gimpnavigationview.c (gimp_navigation_view_scroll):
changed wheel scrolling to be HIG-compliant (control zooms). Also
handle GDK_SCROLL_LEFT/RIGHT correctly and made shift switch the
scroll axis. The widgets behave as the image window now.
2005-11-18 Jakub Steiner <jimmac@ximian.com>
* data/palettes/Tango.gpl: Made the greens more vibrant.
......
......@@ -889,24 +889,44 @@ view_events (GtkWidget *widget,
{
GdkEventScroll *sevent = (GdkEventScroll *) event;
if (sevent->state & GDK_SHIFT_MASK)
if (sevent->state & GDK_CONTROL_MASK)
{
if (sevent->direction == GDK_SCROLL_UP)
gimp_gradient_editor_zoom (editor, GIMP_ZOOM_IN);
else
gimp_gradient_editor_zoom (editor, GIMP_ZOOM_OUT);
switch (sevent->direction)
{
case GDK_SCROLL_UP:
gimp_gradient_editor_zoom (editor, GIMP_ZOOM_IN);
break;
case GDK_SCROLL_DOWN:
gimp_gradient_editor_zoom (editor, GIMP_ZOOM_OUT);
break;
default:
break;
}
}
else
{
GtkAdjustment *adj = GTK_ADJUSTMENT (editor->scroll_data);
GtkAdjustment *adj = GTK_ADJUSTMENT (editor->scroll_data);
gfloat value = adj->value;
gfloat new_value = adj->value + ((sevent->direction == GDK_SCROLL_UP) ?
-adj->page_increment / 2 :
adj->page_increment / 2);
switch (sevent->direction)
{
case GDK_SCROLL_UP:
value -= adj->page_increment / 2;
break;
new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
case GDK_SCROLL_DOWN:
value += adj->page_increment / 2;
break;
gtk_adjustment_set_value (adj, new_value);
deafult:
break;
}
value = CLAMP (value, adj->lower, adj->upper - adj->page_size);
gtk_adjustment_set_value (adj, value);
}
}
break;
......
......@@ -377,32 +377,34 @@ static gboolean
gimp_navigation_view_scroll (GtkWidget *widget,
GdkEventScroll *sevent)
{
if (sevent->state & GDK_SHIFT_MASK)
if (sevent->state & GDK_CONTROL_MASK)
{
if (sevent->direction == GDK_SCROLL_UP)
switch (sevent->direction)
{
case GDK_SCROLL_UP:
g_signal_emit (widget, view_signals[ZOOM], 0, GIMP_ZOOM_IN);
}
else
{
break;
case GDK_SCROLL_DOWN:
g_signal_emit (widget, view_signals[ZOOM], 0, GIMP_ZOOM_OUT);
break;
default:
break;
}
}
else
{
GdkScrollDirection direction;
if (sevent->state & GDK_CONTROL_MASK)
{
if (sevent->direction == GDK_SCROLL_UP)
direction = GDK_SCROLL_LEFT;
else
direction = GDK_SCROLL_RIGHT;
}
else
{
direction = sevent->direction;
}
GdkScrollDirection direction = sevent->direction;
if (sevent->state & GDK_SHIFT_MASK)
switch (direction)
{
case GDK_SCROLL_UP: direction = GDK_SCROLL_LEFT; break;
case GDK_SCROLL_DOWN: direction = GDK_SCROLL_RIGHT; break;
case GDK_SCROLL_LEFT: direction = GDK_SCROLL_UP; break;
case GDK_SCROLL_RIGHT: direction = GDK_SCROLL_DOWN; break;
}
g_signal_emit (widget, view_signals[SCROLL], 0, direction);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment