static void _blendop_mode_callback (GtkWidget *combo, dt_iop_gui_blend_data_t *data) { data->module->blend_params->mode = data->modes[dt_bauhaus_combobox_get(data->blend_modes_combo)].mode; if(data->module->blend_params->mode != DEVELOP_BLEND_DISABLED) { gtk_widget_show(data->opacity_slider); if(data->blendif_support) { gtk_widget_show(data->blendif_enable); if(dt_bauhaus_combobox_get(data->blendif_enable)) gtk_widget_show(GTK_WIDGET(data->blendif_box)); } } else { gtk_widget_hide(data->opacity_slider); if(data->blendif_support) { gtk_widget_hide(GTK_WIDGET(data->blendif_enable)); gtk_widget_hide(GTK_WIDGET(data->blendif_box)); } } dt_dev_add_history_item(darktable.develop, data->module, TRUE); }
void gui_update(struct dt_iop_module_t *self) { dt_iop_module_t *module = (dt_iop_module_t *)self; dt_iop_channelmixer_gui_data_t *g = (dt_iop_channelmixer_gui_data_t *)self->gui_data; dt_iop_channelmixer_params_t *p = (dt_iop_channelmixer_params_t *)module->params; // gtk_combo_box_set_active(g->combo1, p->output_channel); dt_bauhaus_slider_set(g->scale1, p->red[ dt_bauhaus_combobox_get( g->combo1 ) ] ); dt_bauhaus_slider_set(g->scale2, p->green[ dt_bauhaus_combobox_get( g->combo1 ) ] ); dt_bauhaus_slider_set(g->scale3, p->blue[ dt_bauhaus_combobox_get( g->combo1 ) ] ); }
static void output_callback(GtkComboBox *combo, gpointer user_data) { dt_iop_module_t *self = (dt_iop_module_t *)user_data; if(self->dt->gui->reset) return; dt_iop_channelmixer_params_t *p = (dt_iop_channelmixer_params_t *)self->params; dt_iop_channelmixer_gui_data_t *g = (dt_iop_channelmixer_gui_data_t *)self->gui_data; // p->output_channel= gtk_combo_box_get_active(combo); dt_bauhaus_slider_set( g->scale1, p->red[ dt_bauhaus_combobox_get( g->combo1 ) ] ); dt_bauhaus_slider_set( g->scale2, p->green[ dt_bauhaus_combobox_get( g->combo1 ) ] ); dt_bauhaus_slider_set( g->scale3, p->blue[ dt_bauhaus_combobox_get( g->combo1 ) ] ); //dt_dev_add_history_item(darktable.develop, self, TRUE); }
int button_pressed(struct dt_lib_module_t *self, double x, double y, double pressure, int which, int type, uint32_t state) { dt_lib_live_view_t *lib = (dt_lib_live_view_t *)self->data; int result = 0; int imgid = 0; switch(dt_bauhaus_combobox_get(lib->overlay)) { case OVERLAY_SELECTED: imgid = dt_view_tethering_get_selected_imgid(darktable.view_manager); break; case OVERLAY_ID: imgid = lib->imgid; break; } if(imgid > 0 && dt_bauhaus_combobox_get(lib->overlay_splitline)) { const double width = lib->overlay_x1 - lib->overlay_x0; const double height = lib->overlay_y1 - lib->overlay_y0; // splitline position to absolute coords: double sl_x = lib->overlay_x0 + lib->splitline_x * width; double sl_y = lib->overlay_y0 + lib->splitline_y * height; gboolean mouse_over_control = (lib->splitline_rotation % 2 == 0) ? (fabs(sl_x - x) < 5) : (fabs(sl_y - y) < 5); /* do the split rotating */ if(which == 1 && fabs(sl_x - x) < 7 && fabs(sl_y - y) < 7) { /* let's rotate */ lib->splitline_rotation = (lib->splitline_rotation + 1) % 4; dt_control_queue_redraw_center(); result = 1; } /* do the dragging !? */ else if(which == 1 && mouse_over_control) { lib->splitline_dragging = TRUE; dt_control_queue_redraw_center(); result = 1; } } return result; }
static void mode_callback(GtkWidget *w, dt_iop_module_t *self) { dt_iop_bilat_params_t *p = (dt_iop_bilat_params_t *)self->params; p->mode = dt_bauhaus_combobox_get(w); dt_iop_bilat_gui_data_t *g = (dt_iop_bilat_gui_data_t *)self->gui_data; if(p->mode == s_mode_local_laplacian) { gtk_widget_set_visible(g->highlights, TRUE); gtk_widget_set_visible(g->shadows, TRUE); gtk_widget_set_visible(g->midtone, TRUE); gtk_widget_set_visible(g->range, FALSE); gtk_widget_set_visible(g->spatial, FALSE); dt_bauhaus_slider_set(g->highlights, 100.0f); dt_bauhaus_slider_set(g->shadows, 100.0f); } else { gtk_widget_set_visible(g->highlights, FALSE); gtk_widget_set_visible(g->shadows, FALSE); gtk_widget_set_visible(g->midtone, FALSE); gtk_widget_set_visible(g->range, TRUE); gtk_widget_set_visible(g->spatial, TRUE); dt_bauhaus_slider_set(g->range, 20.0f); dt_bauhaus_slider_set(g->spatial, 50.0f); } dt_dev_add_history_item(darktable.develop, self, TRUE); }
static void _blendop_blendif_callback(GtkWidget *b, dt_iop_gui_blend_data_t *data) { if(dt_bauhaus_combobox_get(b)) { data->module->blend_params->blendif |= (1<<DEVELOP_BLENDIF_active); gtk_widget_show(GTK_WIDGET(data->blendif_box)); } else { /* switch off color picker if it was requested by blendif */ if(data->module->request_color_pick < 0) { data->module->request_color_pick = 0; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->colorpicker), 0); } data->module->request_mask_display = 0; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->showmask), 0); data->module->suppress_mask = 0; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->suppress), 0); gtk_widget_hide(GTK_WIDGET(data->blendif_box)); data->module->blend_params->blendif &= ~(1<<DEVELOP_BLENDIF_active); } dt_dev_add_history_item(darktable.develop, data->module, TRUE); }
static void aspect_changed (GtkWidget *combo, dt_iop_module_t *self) { dt_iop_borders_gui_data_t *g = (dt_iop_borders_gui_data_t *)self->gui_data; dt_iop_borders_params_t *p = (dt_iop_borders_params_t *)self->params; int which = dt_bauhaus_combobox_get(combo); const char* text = dt_bauhaus_combobox_get_text(combo); if (which < 0) { p->aspect = DT_IOP_BORDERS_ASPECT_CONSTANT_VALUE; if(text) { const char *c = text; while(*c != ':' && *c != '/' && c < text + strlen(text)) c++; if(c < text + strlen(text) - 1) { // *c = '\0'; // not needed, atof will stop there. c++; p->aspect = atof(text) / atof(c); g_strlcpy(p->aspect_text, text, sizeof(p->aspect_text)); } } } else if (which < DT_IOP_BORDERS_ASPECT_COUNT) { g_strlcpy(p->aspect_text, text, sizeof(p->aspect_text)); p->aspect = g->aspect_ratios[which]; } dt_dev_add_history_item(darktable.develop, self, TRUE); }
static void mode_changed(GtkWidget *combo, dt_iop_module_t *self) { dt_iop_highlights_params_t *p = (dt_iop_highlights_params_t *)self->params; p->mode = dt_bauhaus_combobox_get(combo); if(p->mode > DT_IOP_HIGHLIGHTS_INPAINT) p->mode = DT_IOP_HIGHLIGHTS_INPAINT; dt_dev_add_history_item(darktable.develop, self, TRUE); }
static void dt_iop_levels_mode_callback(GtkWidget *combo, gpointer user_data) { dt_iop_module_t *self = (dt_iop_module_t *)user_data; if(darktable.gui->reset) return; dt_iop_levels_gui_data_t *g = (dt_iop_levels_gui_data_t *)self->gui_data; dt_iop_levels_params_t *p = (dt_iop_levels_params_t *)self->params; const dt_iop_levels_mode_t new_mode = GPOINTER_TO_UINT(g_list_nth_data(g->modes, dt_bauhaus_combobox_get(combo))); switch(new_mode) { case LEVELS_MODE_AUTOMATIC: p->mode = LEVELS_MODE_AUTOMATIC; gtk_stack_set_visible_child_name(GTK_STACK(g->mode_stack), "automatic"); break; case LEVELS_MODE_MANUAL: default: p->mode = LEVELS_MODE_MANUAL; gtk_stack_set_visible_child_name(GTK_STACK(g->mode_stack), "manual"); break; } dt_dev_add_history_item(darktable.develop, self, TRUE); }
static void deflicker_histogram_source_callback(GtkWidget *combo, gpointer user_data) { dt_iop_module_t *self = (dt_iop_module_t *)user_data; if(self->dt->gui->reset) return; if(!dt_image_is_raw(&self->dev->image_storage)) return; dt_iop_exposure_gui_data_t *g = (dt_iop_exposure_gui_data_t *)self->gui_data; dt_iop_exposure_params_t *p = (dt_iop_exposure_params_t *)self->params; const dt_iop_exposure_deflicker_histogram_source_t new_mode = GPOINTER_TO_UINT(g_list_nth_data(g->deflicker_histogram_sources, dt_bauhaus_combobox_get(combo))); switch(new_mode) { case DEFLICKER_HISTOGRAM_SOURCE_SOURCEFILE: p->deflicker_histogram_source = DEFLICKER_HISTOGRAM_SOURCE_SOURCEFILE; deflicker_prepare_histogram(self, &g->deflicker_histogram, &g->deflicker_histogram_stats); break; case DEFLICKER_HISTOGRAM_SOURCE_THUMBNAIL: default: p->deflicker_histogram_source = DEFLICKER_HISTOGRAM_SOURCE_THUMBNAIL; free(g->deflicker_histogram); g->deflicker_histogram = NULL; break; } dt_dev_add_history_item(darktable.develop, self, TRUE); }
static void aspect_changed (GtkWidget *combo, dt_iop_module_t *self) { dt_iop_borders_gui_data_t *g = (dt_iop_borders_gui_data_t *)self->gui_data; dt_iop_borders_params_t *p = (dt_iop_borders_params_t *)self->params; int which = dt_bauhaus_combobox_get(combo); if (which < 0) { p->aspect = self->dev->image_storage.width/(float)self->dev->image_storage.height; const char* text = dt_bauhaus_combobox_get_text(combo); if(text) { const char *c = text; while(*c != ':' && *c != '/' && c < text + strlen(text)) c++; if(c < text + strlen(text) - 1) { // *c = '\0'; // not needed, atof will stop there. c++; p->aspect = atof(text) / atof(c); } } } else if (which < 9) { if(self->dev->image_storage.height > self->dev->image_storage.width) p->aspect = 1.0/g->aspect_ratios[which]; else p->aspect = g->aspect_ratios[which]; } dt_dev_add_history_item(darktable.develop, self, TRUE); }
static void aspect_orient_changed(GtkWidget *widget, dt_iop_module_t *self) { if(darktable.gui->reset) return; dt_iop_borders_params_t *p = (dt_iop_borders_params_t *)self->params; p->aspect_orient = dt_bauhaus_combobox_get(widget); dt_dev_add_history_item(darktable.develop, self, TRUE); }
static gboolean key_gamutcheck_callback(GtkAccelGroup *accel_group, GObject *acceleratable, guint keyval, GdkModifierType modifier, gpointer data) { dt_iop_module_t* self = (dt_iop_module_t*)data; dt_iop_colorout_gui_data_t *g = (dt_iop_colorout_gui_data_t *)self->gui_data; dt_iop_colorout_params_t *p = (dt_iop_colorout_params_t *)self->params; if(p->softproof_enabled == DT_SOFTPROOF_GAMUTCHECK) p->softproof_enabled = DT_SOFTPROOF_DISABLED; else p->softproof_enabled = DT_SOFTPROOF_GAMUTCHECK; g->softproof_enabled = p->softproof_enabled; if(p->softproof_enabled) { int pos = dt_bauhaus_combobox_get(g->cbox5); gchar *filename = _get_profile_from_pos(g->profiles, pos); if (filename) g_strlcpy(p->softproofprofile, filename, sizeof(p->softproofprofile)); } dt_dev_add_history_item(darktable.develop, self, TRUE); dt_control_queue_redraw_center(); return TRUE; }
static void autoscale_ab_callback(GtkWidget *widget, dt_iop_module_t *self) { if(darktable.gui->reset) return; dt_iop_tonecurve_gui_data_t *g = (dt_iop_tonecurve_gui_data_t *)self->gui_data; dt_iop_tonecurve_params_t *p = (dt_iop_tonecurve_params_t *)self->params; p->tonecurve_autoscale_ab = 1 - dt_bauhaus_combobox_get(g->autoscale_ab); dt_dev_add_history_item(darktable.develop, self, TRUE); }
static void intent_changed(GtkWidget *widget, gpointer user_data) { dt_iop_module_t *self = (dt_iop_module_t *)user_data; if(self->dt->gui->reset) return; dt_iop_colorout_params_t *p = (dt_iop_colorout_params_t *)self->params; p->intent = (dt_iop_color_intent_t)dt_bauhaus_combobox_get(widget); dt_dev_add_history_item(darktable.develop, self, TRUE); }
static void presets_changed (GtkWidget *widget, gpointer user_data) { dt_iop_module_t *self = (dt_iop_module_t *)user_data; apply_preset(self); const int pos = dt_bauhaus_combobox_get(widget); dt_iop_temperature_gui_data_t *g = (dt_iop_temperature_gui_data_t *)self->gui_data; gtk_widget_set_sensitive(g->finetune, pos > 2); }
static void patch_callback(GtkWidget *combo, gpointer user_data) { dt_iop_module_t *self = (dt_iop_module_t *)user_data; dt_iop_colorchecker_gui_data_t *g = (dt_iop_colorchecker_gui_data_t *)self->gui_data; g->patch = dt_bauhaus_combobox_get(combo); // switch off colour picker, it'll interfere with other changes of the patch: self->request_color_pick = DT_REQUEST_COLORPICK_OFF; self->gui_update(self); }
static void sizeto_callback(GtkWidget *tb, gpointer user_data) { dt_iop_module_t *self = (dt_iop_module_t *)user_data; if(darktable.gui->reset) return; dt_iop_watermark_params_t *p = (dt_iop_watermark_params_t *)self->params; p->sizeto = dt_bauhaus_combobox_get(tb); dt_dev_add_history_item(darktable.develop, self, TRUE); }
static void blue_callback(GtkWidget *slider, gpointer user_data) { dt_iop_module_t *self = (dt_iop_module_t *)user_data; if(self->dt->gui->reset) return; dt_iop_channelmixer_params_t *p = (dt_iop_channelmixer_params_t *)self->params; dt_iop_channelmixer_gui_data_t *g = (dt_iop_channelmixer_gui_data_t *)self->gui_data; p->blue[ dt_bauhaus_combobox_get( g->combo1 ) ]= dt_bauhaus_slider_get(slider); dt_dev_add_history_item(darktable.develop, self, TRUE); }
static void scale_callback(GtkWidget *widget, gpointer user_data) { dt_iop_module_t *self = (dt_iop_module_t *)user_data; dt_iop_basecurve_gui_data_t *g = (dt_iop_basecurve_gui_data_t *)self->gui_data; if(dt_bauhaus_combobox_get(widget)) g->loglogscale = 64; else g->loglogscale = 0; gtk_widget_queue_draw(GTK_WIDGET(g->area)); }
static void _golden_mean_changed(GtkWidget *combo, _golden_mean_t *user_data) { int which = dt_bauhaus_combobox_get(combo); // remember setting dt_conf_set_int("plugins/darkroom/clipping/golden_extras", which); _golden_mean_set_data(user_data, which); dt_control_queue_redraw_center(); }
static void bilat_callback (GtkWidget *widget, gpointer user_data) { dt_iop_module_t *self = (dt_iop_module_t *)user_data; dt_iop_lowpass_params_t *p = (dt_iop_lowpass_params_t *)self->params; if(dt_bauhaus_combobox_get(widget)) p->radius = -fabsf(p->radius); else p->radius = fabsf(p->radius); dt_dev_add_history_item(darktable.develop, self, TRUE); }
static void bpp_combobox_changed(GtkWidget *widget, gpointer user_data) { const int bpp = dt_bauhaus_combobox_get(widget); if(bpp == 1) dt_conf_set_int("plugins/imageio/format/tiff/bpp", 16); else if(bpp == 2) dt_conf_set_int("plugins/imageio/format/tiff/bpp", 32); else // (bpp == 0) dt_conf_set_int("plugins/imageio/format/tiff/bpp", 8); }
void dt_iop_gui_update_blending(dt_iop_module_t *module) { dt_iop_gui_blend_data_t *bd = (dt_iop_gui_blend_data_t*)module->blend_data; if (!(module->flags() & IOP_FLAGS_SUPPORTS_BLENDING) || !bd || !bd->blend_inited) return; int reset = darktable.gui->reset; darktable.gui->reset = 1; dt_bauhaus_combobox_set(bd->blend_modes_combo, dt_iop_gui_blending_mode_seq(bd, module->blend_params->mode)); dt_bauhaus_slider_set(bd->opacity_slider, module->blend_params->opacity); dt_iop_gui_update_blendif(module); /* now show hide controls as required */ if(bd->modes[dt_bauhaus_combobox_get(bd->blend_modes_combo)].mode == DEVELOP_BLEND_DISABLED) { gtk_widget_hide(GTK_WIDGET(bd->opacity_slider)); if(bd->blendif_support && bd->blendif_inited) { gtk_widget_hide(GTK_WIDGET(bd->blendif_box)); gtk_widget_hide(GTK_WIDGET(bd->blendif_enable)); } } else { gtk_widget_show(GTK_WIDGET(bd->opacity_slider)); if(bd->blendif_support && bd->blendif_inited) { gtk_widget_show(GTK_WIDGET(bd->blendif_enable)); if(dt_bauhaus_combobox_get(bd->blendif_enable) != 0) gtk_widget_show(GTK_WIDGET(bd->blendif_box)); else gtk_widget_hide(GTK_WIDGET(bd->blendif_box)); } } darktable.gui->reset = reset; }
static void _blendop_mode_callback (GtkWidget *combo, dt_iop_gui_blend_data_t *data) { data->module->blend_params->mode = data->modes[dt_bauhaus_combobox_get(data->blend_modes_combo)].mode; if(data->module->blend_params->mode != DEVELOP_BLEND_DISABLED) { gtk_widget_show(data->opacity_slider); if(data->blendif_support) { gtk_widget_show(data->blendif_enable); if(dt_bauhaus_combobox_get(data->blendif_enable)) gtk_widget_show(GTK_WIDGET(data->blendif_box)); } } else { gtk_widget_hide(data->opacity_slider); if(data->blendif_support) { /* switch off color picker if it was requested by blendif */ if(data->module->request_color_pick < 0) { data->module->request_color_pick = 0; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->colorpicker), 0); } data->module->request_mask_display = 0; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->showmask), 0); data->module->suppress_mask = 0; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->suppress), 0); gtk_widget_hide(GTK_WIDGET(data->blendif_enable)); gtk_widget_hide(GTK_WIDGET(data->blendif_box)); } } dt_dev_add_history_item(darktable.develop, data->module, TRUE); }
static void apply_preset(dt_iop_module_t *self) { self->request_color_pick = 0; if(self->dt->gui->reset) return; dt_iop_temperature_gui_data_t *g = (dt_iop_temperature_gui_data_t *)self->gui_data; dt_iop_temperature_params_t *p = (dt_iop_temperature_params_t *)self->params; dt_iop_temperature_params_t *fp = (dt_iop_temperature_params_t *)self->default_params; const int tune = dt_bauhaus_slider_get(g->finetune); const int pos = dt_bauhaus_combobox_get(g->presets); switch(pos) { case -1: // just un-setting. return; case 0: // camera wb for(int k=0; k<3; k++) p->coeffs[k] = fp->coeffs[k]; break; case 1: // spot wb, exposure callback will set p->coeffs. for(int k=0; k<3; k++) p->coeffs[k] = fp->coeffs[k]; dt_iop_request_focus(self); self->request_color_pick = 1; /* set the area sample size*/ if (self->request_color_pick) dt_lib_colorpicker_set_area(darktable.lib, 0.99); break; case 2: // passthrough mode, raw data for(int k=0; k<3; k++) p->coeffs[k] = 1.0; break; default: for(int i=g->preset_num[pos]; i<wb_preset_count; i++) { char makermodel[1024]; char *model = makermodel; dt_colorspaces_get_makermodel_split(makermodel, 1024, &model, self->dev->image_storage.exif_maker, self->dev->image_storage.exif_model); if(!strcmp(wb_preset[i].make, makermodel) && !strcmp(wb_preset[i].model, model) && wb_preset[i].tuning == tune) { for(int k=0; k<3; k++) p->coeffs[k] = wb_preset[i].channel[k]; break; } } break; } if(self->off) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(self->off), 1); gui_update_from_coeffs(self); dt_dev_add_history_item(darktable.develop, self, TRUE); }
static void _blendop_blendif_callback(GtkWidget *b, dt_iop_gui_blend_data_t *data) { if(dt_bauhaus_combobox_get(b)) { data->module->blend_params->blendif |= (1<<31); gtk_widget_show(GTK_WIDGET(data->blendif_box)); } else { gtk_widget_hide(GTK_WIDGET(data->blendif_box)); data->module->blend_params->blendif &= ~(1<<31); } dt_dev_add_history_item(darktable.develop, data->module, TRUE); }
static void softproof_profile_changed(GtkWidget *widget, gpointer user_data) { dt_iop_module_t *self = (dt_iop_module_t *)user_data; if(self->dt->gui->reset) return; dt_iop_colorout_params_t *p = (dt_iop_colorout_params_t *)self->params; dt_iop_colorout_gui_data_t *g = (dt_iop_colorout_gui_data_t *)self->gui_data; int pos = dt_bauhaus_combobox_get(widget); gchar *filename = _get_profile_from_pos(g->profiles, pos); if(filename) { g_strlcpy(p->softproofprofile, filename, sizeof(p->softproofprofile)); dt_dev_add_history_item(darktable.develop, self, TRUE); return; } fprintf(stderr, "[colorout] softprofile %s seems to have disappeared!\n", p->softproofprofile); }
static void mode_changed (GtkWidget *combo, dt_iop_module_t *self) { dt_iop_highlights_params_t *p = (dt_iop_highlights_params_t *)self->params; int active = dt_bauhaus_combobox_get(combo); switch(active) { case DT_IOP_HIGHLIGHTS_CLIP: p->mode = DT_IOP_HIGHLIGHTS_CLIP; break; default: case DT_IOP_HIGHLIGHTS_LCH: p->mode = DT_IOP_HIGHLIGHTS_LCH; break; } dt_dev_add_history_item(darktable.develop, self, TRUE); }
static void overlay_changed(GtkWidget *combo, dt_lib_live_view_t *lib) { int which = dt_bauhaus_combobox_get(combo); if(which == OVERLAY_NONE) { gtk_widget_set_visible(GTK_WIDGET(lib->overlay_mode), FALSE); gtk_widget_set_visible(GTK_WIDGET(lib->overlay_splitline), FALSE); } else { gtk_widget_set_visible(GTK_WIDGET(lib->overlay_mode), TRUE); gtk_widget_set_visible(GTK_WIDGET(lib->overlay_splitline), TRUE); } if(which == OVERLAY_ID) gtk_widget_set_visible(GTK_WIDGET(lib->overlay_id_box), TRUE); else gtk_widget_set_visible(GTK_WIDGET(lib->overlay_id_box), FALSE); }