Commit 944c8fe3 authored by Jim Nelson's avatar Jim Nelson

#959: Center color adjustment sliders with Ctrl+LMB.

parent 20d11c33
......@@ -4,6 +4,7 @@ Joeny Ang <ang.joeny@gmail.com>
Matthias Clasen <matthias.clasen@gmail.com>
David Jeske <davidj@gmail.com>
Matt Jones <mattjones@workhorsy.org>
Andreas Kühntopf <andreas@kuehntopf.org>
Paul Novak <pnovak@alumni.caltech.edu>
Martin Robinson <martin.james.robinson@gmail.com>
Shan Xiong <shan.xiong@gmail.com>
......
......@@ -2444,6 +2444,16 @@ public class AdjustTool : EditingTool {
init_fp_pixel_cache(canvas.get_scaled_pixbuf());
}
private bool on_hscale_reset(Gtk.HScale source, Gdk.EventButton event) {
if (event.button == 1 && event.type == Gdk.EventType.BUTTON_PRESS
&& has_only_key_modifier(event.state, Gdk.ModifierType.CONTROL_MASK)) {
// Left Mouse Button and CTRL pressed
source.set_value(0);
return true;
}
return false;
}
private void bind_canvas_handlers(PhotoCanvas canvas) {
canvas.resized_scaled_pixbuf += on_canvas_resize;
}
......@@ -2466,6 +2476,12 @@ public class AdjustTool : EditingTool {
on_shadows_adjustment;
adjust_tool_window.histogram_manipulator.nub_position_changed +=
on_histogram_constraint;
adjust_tool_window.saturation_slider.button_press_event += on_hscale_reset;
adjust_tool_window.exposure_slider.button_press_event += on_hscale_reset;
adjust_tool_window.tint_slider.button_press_event += on_hscale_reset;
adjust_tool_window.temperature_slider.button_press_event += on_hscale_reset;
adjust_tool_window.shadows_slider.button_press_event += on_hscale_reset;
}
private void unbind_window_handlers() {
......@@ -2482,6 +2498,12 @@ public class AdjustTool : EditingTool {
on_shadows_adjustment;
adjust_tool_window.histogram_manipulator.nub_position_changed -=
on_histogram_constraint;
adjust_tool_window.saturation_slider.button_press_event -= on_hscale_reset;
adjust_tool_window.exposure_slider.button_press_event -= on_hscale_reset;
adjust_tool_window.tint_slider.button_press_event -= on_hscale_reset;
adjust_tool_window.temperature_slider.button_press_event -= on_hscale_reset;
adjust_tool_window.shadows_slider.button_press_event -= on_hscale_reset;
}
public bool enhance() {
......
......@@ -409,6 +409,33 @@ public string format_local_date(Time date) {
return date_string_stripped.str;
}
// Verifies that only the mask bits are set in the modifier field, disregarding mouse and
// key modifers that are not normally of concern (i.e. Num Lock, Caps Lock, etc.). Mask can be
// one or more bits set, but should only consist of these values:
// * Gdk.ModifierType.SHIFT_MASK
// * Gdk.ModifierType.CONTROL_MASK
// * Gdk.ModifierType.MOD1_MASK (Alt)
// * Gdk.ModifierType.MOD3_MASK
// * Gdk.ModifierType.MOD4_MASK
// * Gdk.ModifierType.MOD5_MASK
// * Gdk.ModifierType.SUPER_MASK
// * Gdk.ModifierType.HYPER_MASK
// * Gdk.ModifierType.META_MASK
//
// (Note: MOD2 seems to be Num Lock in GDK.)
public bool has_only_key_modifier(Gdk.ModifierType field, Gdk.ModifierType mask) {
return (field
& (Gdk.ModifierType.SHIFT_MASK
| Gdk.ModifierType.CONTROL_MASK
| Gdk.ModifierType.MOD1_MASK
| Gdk.ModifierType.MOD3_MASK
| Gdk.ModifierType.MOD4_MASK
| Gdk.ModifierType.MOD5_MASK
| Gdk.ModifierType.SUPER_MASK
| Gdk.ModifierType.HYPER_MASK
| Gdk.ModifierType.META_MASK)) == mask;
}
public delegate void OneShotCallback();
public class OneShotScheduler {
......
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