static gboolean _lib_histogram_button_press_callback(GtkWidget *widget, GdkEventButton *event, gpointer user_data) { dt_lib_module_t *self = (dt_lib_module_t *)user_data; dt_lib_histogram_t *d = (dt_lib_histogram_t *)self->data; /* check if exposure hooks are available */ gboolean hooks_available = dt_dev_exposure_hooks_available(darktable.develop); if(!hooks_available) return TRUE; if(event->type == GDK_2BUTTON_PRESS) { dt_dev_exposure_reset_defaults(darktable.develop); } else { d->dragging = 1; if(d->highlight == 2) d->white = dt_dev_exposure_get_white(darktable.develop); if(d->highlight == 1) d->black = dt_dev_exposure_get_black(darktable.develop); d->button_down_x = event->x; d->button_down_y = event->y; } return TRUE; }
static gboolean _lib_histogram_button_press_callback(GtkWidget *widget, GdkEventButton *event, gpointer user_data) { dt_lib_module_t *self = (dt_lib_module_t *)user_data; dt_lib_histogram_t *d = (dt_lib_histogram_t *)self->data; /* check if exposure hooks are available */ gboolean hooks_available = dt_dev_exposure_hooks_available(darktable.develop); if(!hooks_available) return TRUE; if(event->type == GDK_2BUTTON_PRESS) { dt_dev_exposure_reset_defaults(darktable.develop); } else { if(d->highlight == 3) // mode button { darktable.develop->histogram_type = (darktable.develop->histogram_type + 1) % DT_DEV_HISTOGRAM_N; dt_conf_set_string("plugins/darkroom/histogram/mode", dt_dev_histogram_type_names[darktable.develop->histogram_type]); } else if(d->highlight == 4) // red button { d->red = !d->red; dt_conf_set_bool("plugins/darkroom/histogram/show_red", d->red); } else if(d->highlight == 5) // green button { d->green = !d->green; dt_conf_set_bool("plugins/darkroom/histogram/show_green", d->green); } else if(d->highlight == 6) // blue button { d->blue = !d->blue; dt_conf_set_bool("plugins/darkroom/histogram/show_blue", d->blue); } else { d->dragging = 1; if(d->highlight == 2) d->white = dt_dev_exposure_get_white(darktable.develop); if(d->highlight == 1) d->black = dt_dev_exposure_get_black(darktable.develop); d->button_down_x = event->x; d->button_down_y = event->y; } } // update for good measure dt_control_queue_redraw_widget(self->widget); return TRUE; }
static gboolean _lib_histogram_scroll_callback(GtkWidget *widget, GdkEventScroll *event, gpointer user_data) { dt_lib_module_t *self = (dt_lib_module_t *)user_data; dt_lib_histogram_t *d = (dt_lib_histogram_t *)self->data; float ce = dt_dev_exposure_get_exposure(darktable.develop); float cb = dt_dev_exposure_get_black(darktable.develop); if(event->direction == GDK_SCROLL_UP && d->highlight == 2) dt_dev_exposure_set_exposure(darktable.develop, ce + 0.15); if(event->direction == GDK_SCROLL_DOWN && d->highlight == 2) dt_dev_exposure_set_exposure(darktable.develop, ce - 0.15); if(event->direction == GDK_SCROLL_UP && d->highlight == 1) dt_dev_exposure_set_black(darktable.develop, cb - 0.001); if(event->direction == GDK_SCROLL_DOWN && d->highlight == 1) dt_dev_exposure_set_black(darktable.develop, cb + 0.001); return TRUE; }
static gboolean _lib_histogram_scroll_callback(GtkWidget *widget, GdkEventScroll *event, gpointer user_data) { dt_lib_module_t *self = (dt_lib_module_t *)user_data; dt_lib_histogram_t *d = (dt_lib_histogram_t *)self->data; float ce = dt_dev_exposure_get_exposure(darktable.develop); float cb = dt_dev_exposure_get_black(darktable.develop); int delta_y; // note are using unit rather than smooth scroll events, as // exposure changes can get laggy if handling a multitude of smooth // scroll events if(dt_gui_get_scroll_unit_deltas(event, NULL, &delta_y)) { if(d->highlight == 2) dt_dev_exposure_set_exposure(darktable.develop, ce - 0.15f * delta_y); else if(d->highlight == 1) dt_dev_exposure_set_black(darktable.develop, cb + 0.001f * delta_y); } return TRUE; }