Esempio n. 1
0
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;
}
Esempio n. 2
0
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;
}
Esempio n. 3
0
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 cw = dt_dev_exposure_get_white(darktable.develop);
    float cb = dt_dev_exposure_get_black(darktable.develop);

    if(event->direction == GDK_SCROLL_UP && d->highlight == 2)
        dt_dev_exposure_set_white(darktable.develop, cw - 0.1);

    if(event->direction == GDK_SCROLL_DOWN && d->highlight == 2)
        dt_dev_exposure_set_white(darktable.develop, cw + 0.1);

    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;
}