void gui_update (struct dt_iop_module_t *self) { dt_iop_module_t *module = (dt_iop_module_t *)self; self->request_color_pick = 0; self->color_picker_box[0] = self->color_picker_box[1] = .25f; self->color_picker_box[2] = self->color_picker_box[3] = .75f; self->color_picker_point[0] = self->color_picker_point[1] = 0.5f; 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 *)module->params; dt_iop_temperature_params_t *fp = (dt_iop_temperature_params_t *)module->default_params; float temp, tint, mul[3]; for(int k=0; k<3; k++) mul[k] = p->coeffs[k]/fp->coeffs[k]; convert_rgb_to_k(mul, p->temp_out, &temp, &tint); dt_bauhaus_slider_set(g->scale_k_out, p->temp_out); dt_bauhaus_slider_set(g->scale_r, p->coeffs[0]); dt_bauhaus_slider_set(g->scale_g, p->coeffs[1]); dt_bauhaus_slider_set(g->scale_b, p->coeffs[2]); dt_bauhaus_slider_set(g->scale_k, temp); dt_bauhaus_slider_set(g->scale_tint, tint); if(fabsf(p->coeffs[0]-fp->coeffs[0]) + fabsf(p->coeffs[1]-fp->coeffs[1]) + fabsf(p->coeffs[2]-fp->coeffs[2]) < 0.01) dt_bauhaus_combobox_set(g->presets, 0); else dt_bauhaus_combobox_set(g->presets, -1); dt_bauhaus_slider_set(g->finetune, 0); gtk_widget_set_sensitive(g->finetune, 0); }
void gui_update(struct 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; dt_bauhaus_slider_set(g->size, p->size*100.0f); int k = 0; for(;k<9;k++) { if(fabsf(p->aspect - g->aspect_ratios[k]) < 0.0001f) { dt_bauhaus_combobox_set(g->aspect, k); break; } } if(k == 9) { char text[128]; snprintf(text, 128, "%.3f:1", p->aspect); dt_bauhaus_combobox_set(g->aspect, -1); dt_bauhaus_combobox_set_text(g->aspect, text); } GdkColor c; c.red = p->color[0]*65535.0; c.green = p->color[1]*65535.0; c.blue = p->color[2]*65535.0; gtk_widget_modify_fg(GTK_WIDGET(g->colorpick), GTK_STATE_NORMAL, &c); }
static gboolean dt_bauhaus_popup_scroll(GtkWidget *widget, GdkEventScroll *event, gpointer user_data) { gtk_widget_queue_draw(darktable.bauhaus->popup_area); dt_bauhaus_widget_t *w = darktable.bauhaus->current; switch(w->type) { case DT_BAUHAUS_COMBOBOX: { gint wx, wy; GtkWidget *w = GTK_WIDGET(darktable.bauhaus->current); const int ht = w->allocation.height; const int skip = ht + get_line_space(); gdk_window_get_origin (gtk_widget_get_window (w), &wx, &wy); dt_bauhaus_combobox_data_t *d = &darktable.bauhaus->current->data.combobox; if(event->direction == GDK_SCROLL_UP) dt_bauhaus_combobox_set(w, CLAMP(d->active-1, 0, d->num_labels-1)); else dt_bauhaus_combobox_set(w, CLAMP(d->active+1, 0, d->num_labels-1)); gdk_window_move(gtk_widget_get_window(darktable.bauhaus->popup_window), wx, wy - d->active * skip); } break; case DT_BAUHAUS_SLIDER: break; default: break; } return TRUE; }
static int value_member(lua_State*L) { lua_combobox combobox; luaA_to(L,lua_combobox,&combobox,1); int length = dt_bauhaus_combobox_length(combobox->widget); if(lua_gettop(L) > 2) { if(lua_isnil(L,3)) { dt_bauhaus_combobox_set(combobox->widget,-1); } else if(lua_isnumber(L,3)) { int index = lua_tointeger(L,3) ; if(index < 1 || index > length) { return luaL_error(L,"Invalid index for combo box : %d\n",index); } dt_bauhaus_combobox_set(combobox->widget,index -1); } else if(lua_isstring(L,3)&& dt_bauhaus_combobox_get_editable(combobox->widget)) { const char * string = lua_tostring(L,3); dt_bauhaus_combobox_set_text(combobox->widget,string); } else { return luaL_error(L,"Invalid type for combo box value\n"); } return 0; } lua_pushstring(L,dt_bauhaus_combobox_get_text(combobox->widget)); return 1; }
void gui_update(struct dt_iop_module_t *self) { 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; if(!dt_image_is_raw(&self->dev->image_storage)) { gtk_widget_hide(GTK_WIDGET(g->mode)); p->mode = EXPOSURE_MODE_MANUAL; dt_dev_add_history_item(darktable.develop, self, TRUE); } else { gtk_widget_show(GTK_WIDGET(g->mode)); } dt_bauhaus_combobox_set(g->mode, g_list_index(g->modes, GUINT_TO_POINTER(p->mode))); dt_bauhaus_slider_set(g->black, p->black); dt_bauhaus_slider_set_soft(g->exposure, p->exposure); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g->autoexp), FALSE); dt_bauhaus_slider_set(g->autoexpp, 0.01); gtk_widget_set_sensitive(GTK_WIDGET(g->autoexpp), FALSE); dt_bauhaus_slider_set(g->deflicker_percentile, p->deflicker_percentile); dt_bauhaus_slider_set(g->deflicker_target_level, p->deflicker_target_level); dt_bauhaus_combobox_set(g->deflicker_histogram_source, g_list_index(g->deflicker_histogram_sources, GUINT_TO_POINTER(p->deflicker_histogram_source))); self->request_color_pick = DT_REQUEST_COLORPICK_OFF; free(g->deflicker_histogram); g->deflicker_histogram = NULL; g->reprocess_on_next_expose = FALSE; gtk_label_set_text(g->deflicker_used_EC, ""); g->deflicker_computed_exposure = NAN; switch(p->mode) { case EXPOSURE_MODE_DEFLICKER: autoexp_disable(self); gtk_widget_hide(GTK_WIDGET(g->vbox_manual)); gtk_widget_show(GTK_WIDGET(g->vbox_deflicker)); if(p->deflicker_histogram_source == DEFLICKER_HISTOGRAM_SOURCE_SOURCEFILE) deflicker_prepare_histogram(self, &g->deflicker_histogram, &g->deflicker_histogram_stats); break; case EXPOSURE_MODE_MANUAL: default: gtk_widget_hide(GTK_WIDGET(g->vbox_deflicker)); gtk_widget_show(GTK_WIDGET(g->vbox_manual)); break; } }
/** Refresh albums */ static void refresh_albums(dt_storage_flickr_gui_data_t *ui) { int i; gtk_widget_set_sensitive(GTK_WIDGET(ui->album_list), FALSE); if(ui->flickr_api == NULL || ui->flickr_api->needsReauthentication == TRUE) { if(ui->flickr_api != NULL) _flickr_api_free(ui->flickr_api); ui->flickr_api = _flickr_api_authenticate(ui); if(ui->flickr_api != NULL) { set_status(ui, _("authenticated"), "#7fe07f"); } else { set_status(ui, _("not authenticated"), "#e07f7f"); gtk_widget_set_sensitive(GTK_WIDGET(ui->album_list), FALSE); return; } } // First clear the cobobox except first 2 items (none / create new album) dt_bauhaus_combobox_clear(ui->album_list); ui->albums = _flickr_api_photosets(ui->flickr_api, gtk_entry_get_text(ui->user_entry)); if(ui->albums) { // Add standard action dt_bauhaus_combobox_add(ui->album_list, _("without album")); dt_bauhaus_combobox_add(ui->album_list, _("create new album")); // dt_bauhaus_combobox_add(ui->album_list, ""); // Separator // FIXME: bauhaus doesn't support separators // Then add albums from list... for(i = 0; ui->albums[i]; i++) { char data[512] = { 0 }; snprintf(data, sizeof(data), "%s (%i)", ui->albums[i]->title, ui->albums[i]->photos_count); dt_bauhaus_combobox_add(ui->album_list, data); } dt_bauhaus_combobox_set(ui->album_list, 2); gtk_widget_hide(GTK_WIDGET(ui->create_box)); // Hide create album box... } else { // Failed to parse feed of album... // Lets notify somehow... dt_bauhaus_combobox_set(ui->album_list, 0); } gtk_widget_set_sensitive(GTK_WIDGET(ui->album_list), TRUE); }
void gui_update (struct dt_iop_module_t *self) { dt_iop_module_t *module = (dt_iop_module_t *)self; self->request_color_pick = 0; self->color_picker_box[0] = self->color_picker_box[1] = .25f; self->color_picker_box[2] = self->color_picker_box[3] = .75f; self->color_picker_point[0] = self->color_picker_point[1] = 0.5f; 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 *)module->params; dt_iop_temperature_params_t *fp = (dt_iop_temperature_params_t *)module->default_params; float temp, tint, mul[3]; for(int k=0; k<3; k++) mul[k] = g->daylight_wb[k]/p->coeffs[k]; convert_rgb_to_k(mul, &temp, &tint); dt_bauhaus_slider_set(g->scale_r, p->coeffs[0]); dt_bauhaus_slider_set(g->scale_g, p->coeffs[1]); dt_bauhaus_slider_set(g->scale_b, p->coeffs[2]); dt_bauhaus_slider_set(g->scale_k, temp); dt_bauhaus_slider_set(g->scale_tint, tint); dt_bauhaus_combobox_clear(g->presets); dt_bauhaus_combobox_add(g->presets, _("camera white balance")); dt_bauhaus_combobox_add(g->presets, _("spot white balance")); dt_bauhaus_combobox_add(g->presets, _("passthrough")); g->preset_cnt = 3; const char *wb_name = NULL; 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(!dt_image_is_ldr(&self->dev->image_storage)) for(int i=0; i<wb_preset_count; i++) { if(g->preset_cnt >= 50) break; if(!strcmp(wb_preset[i].make, makermodel) && !strcmp(wb_preset[i].model, model)) { if(!wb_name || strcmp(wb_name, wb_preset[i].name)) { wb_name = wb_preset[i].name; dt_bauhaus_combobox_add(g->presets, _(wb_preset[i].name)); g->preset_num[g->preset_cnt++] = i; } } } if(fabsf(p->coeffs[0]-fp->coeffs[0]) + fabsf(p->coeffs[1]-fp->coeffs[1]) + fabsf(p->coeffs[2]-fp->coeffs[2]) < 0.01) dt_bauhaus_combobox_set(g->presets, 0); else dt_bauhaus_combobox_set(g->presets, -1); dt_bauhaus_slider_set(g->finetune, 0); gtk_widget_set_sensitive(g->finetune, 0); }
/** gui callbacks, these are needed. */ void gui_update(dt_iop_module_t *self) { // let gui slider match current parameters: dt_iop_bilat_gui_data_t *g = (dt_iop_bilat_gui_data_t *)self->gui_data; dt_iop_bilat_params_t *p = (dt_iop_bilat_params_t *)self->params; dt_bauhaus_slider_set(g->detail, 100.0f*p->detail+100.0f); dt_bauhaus_combobox_set(g->mode, p->mode); if(p->mode == s_mode_local_laplacian) { dt_bauhaus_slider_set(g->shadows, p->sigma_s*100.0f); dt_bauhaus_slider_set(g->highlights, p->sigma_r*100.0f); dt_bauhaus_slider_set(g->midtone, p->midtone); gtk_widget_set_visible(g->range, FALSE); gtk_widget_set_visible(g->spatial, FALSE); gtk_widget_set_visible(g->highlights, TRUE); gtk_widget_set_visible(g->shadows, TRUE); gtk_widget_set_visible(g->midtone, TRUE); dt_pthread_mutex_lock(&g->lock); g->hash = 0; dt_pthread_mutex_unlock(&g->lock); } else { dt_bauhaus_slider_set(g->spatial, p->sigma_s); dt_bauhaus_slider_set(g->range, p->sigma_r); gtk_widget_set_visible(g->range, TRUE); gtk_widget_set_visible(g->spatial, TRUE); gtk_widget_set_visible(g->highlights, FALSE); gtk_widget_set_visible(g->shadows, FALSE); gtk_widget_set_visible(g->midtone, FALSE); } }
void gui_update(dt_iop_module_t *self) { 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; dt_bauhaus_combobox_set(g->mode, g_list_index(g->modes, GUINT_TO_POINTER(p->mode))); dt_bauhaus_slider_set(g->percentile_black, p->percentiles[0]); dt_bauhaus_slider_set(g->percentile_grey, p->percentiles[1]); dt_bauhaus_slider_set(g->percentile_white, p->percentiles[2]); switch(p->mode) { case LEVELS_MODE_AUTOMATIC: gtk_stack_set_visible_child_name(GTK_STACK(g->mode_stack), "automatic"); break; case LEVELS_MODE_MANUAL: default: gtk_stack_set_visible_child_name(GTK_STACK(g->mode_stack), "manual"); break; } dt_pthread_mutex_lock(&g->lock); g->auto_levels[0] = NAN; g->auto_levels[1] = NAN; g->auto_levels[2] = NAN; dt_pthread_mutex_unlock(&g->lock); gtk_widget_queue_draw(self->widget); }
void gui_update(struct dt_iop_module_t *self) { dt_iop_module_t *module = (dt_iop_module_t *)self; dt_iop_watermark_gui_data_t *g = (dt_iop_watermark_gui_data_t *)self->gui_data; dt_iop_watermark_params_t *p = (dt_iop_watermark_params_t *)module->params; dt_bauhaus_slider_set(g->opacity, p->opacity); dt_bauhaus_slider_set_soft(g->scale, p->scale); dt_bauhaus_slider_set(g->rotate, p->rotate); dt_bauhaus_slider_set(g->x_offset, p->xoffset); dt_bauhaus_slider_set(g->y_offset, p->yoffset); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g->align[p->alignment]), TRUE); _combo_box_set_active_text(g->watermarks, p->filename); dt_bauhaus_combobox_set(g->sizeto, p->sizeto); gtk_entry_set_text(GTK_ENTRY(g->text), p->text); GdkRGBA color = (GdkRGBA){.red = p->color[0], .green = p->color[1], .blue = p->color[2], .alpha = 1.0 }; gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(g->colorpick), &color); gtk_font_button_set_font_name(GTK_FONT_BUTTON(g->fontsel), p->font); } void init(dt_iop_module_t *module) { module->params = calloc(1, sizeof(dt_iop_watermark_params_t)); module->params_size = sizeof(dt_iop_watermark_params_t); module->default_params = calloc(1, sizeof(dt_iop_watermark_params_t)); module->default_enabled = 0; module->priority = 969; // module order created by iop_dependencies.py, do not edit! module->params_size = sizeof(dt_iop_watermark_params_t); module->gui_data = NULL; dt_iop_watermark_params_t tmp = (dt_iop_watermark_params_t){ 100.0, 100.0, 0.0, 0.0, 4, 0.0, DT_SCALE_IMAGE, { "darktable.svg" }, { "" }, {0.0, 0.0, 0.0}, {"DejaVu Sans 10"} }; // opacity,scale,xoffs,yoffs,alignment memcpy(module->params, &tmp, sizeof(dt_iop_watermark_params_t)); memcpy(module->default_params, &tmp, sizeof(dt_iop_watermark_params_t)); }
void gui_update(struct dt_iop_module_t *self) { dt_iop_module_t *module = (dt_iop_module_t *)self; dt_iop_global_tonemap_gui_data_t *g = (dt_iop_global_tonemap_gui_data_t *)self->gui_data; dt_iop_global_tonemap_params_t *p = (dt_iop_global_tonemap_params_t *)module->params; dt_bauhaus_combobox_set(g->operator, p->operator); gtk_widget_set_visible(g->drago.bias, FALSE); gtk_widget_set_visible(g->drago.max_light, FALSE); /* show ui for selected operator */ if(p->operator== OPERATOR_DRAGO) { gtk_widget_set_visible(g->drago.bias, TRUE); gtk_widget_set_visible(g->drago.max_light, TRUE); } /* drago */ dt_bauhaus_slider_set(g->drago.bias, p->drago.bias); dt_bauhaus_slider_set(g->drago.max_light, p->drago.max_light); dt_bauhaus_slider_set(g->detail, p->detail); dt_pthread_mutex_lock(&g->lock); g->lwmax = NAN; g->hash = 0; dt_pthread_mutex_unlock(&g->lock); }
void gui_update(struct dt_iop_module_t *self) { 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; dt_bauhaus_combobox_set(g->autoscale_ab, 1-p->tonecurve_autoscale_ab); // that's all, gui curve is read directly from params during expose event. gtk_widget_queue_draw(self->widget); }
static gboolean _set_preset_spot(GtkAccelGroup *accel_group, GObject *acceleratable, guint keyval, GdkModifierType modifier, gpointer data) { dt_iop_module_t *self = data; dt_iop_temperature_gui_data_t *g = self->gui_data; dt_bauhaus_combobox_set(g->presets, 2); return TRUE; }
void gui_update(dt_iop_module_t *module) { dt_iop_defringe_gui_data_t *g = (dt_iop_defringe_gui_data_t *)module->gui_data; dt_iop_defringe_params_t *p = (dt_iop_defringe_params_t *)module->params; dt_bauhaus_combobox_set(g->mode_select, p->op_mode); dt_bauhaus_slider_set(g->radius_scale, p->radius); dt_bauhaus_slider_set(g->thresh_scale, p->thresh); }
int set_params(dt_imageio_module_format_t *self, const void *params, const int size) { if(size != self->params_size(self)) return 1; const dt_imageio_tiff_t *d = (dt_imageio_tiff_t *)params; const dt_imageio_tiff_gui_t *g = (dt_imageio_tiff_gui_t *)self->gui_data; if(d->bpp == 16) dt_bauhaus_combobox_set(g->bpp, 1); else if(d->bpp == 32) dt_bauhaus_combobox_set(g->bpp, 2); else // (d->bpp == 8) dt_bauhaus_combobox_set(g->bpp, 0); dt_bauhaus_combobox_set(g->compress, d->compress); return 0; }
void gui_update(struct dt_iop_module_t *self) { dt_iop_module_t *module = (dt_iop_module_t *)self; dt_iop_highlights_gui_data_t *g = (dt_iop_highlights_gui_data_t *)self->gui_data; dt_iop_highlights_params_t *p = (dt_iop_highlights_params_t *)module->params; dt_bauhaus_slider_set(g->clip, p->clip); dt_bauhaus_combobox_set(g->mode, p->mode); }
static void temp_callback (GtkWidget *slider, gpointer user_data) { dt_iop_module_t *self = (dt_iop_module_t *)user_data; if(self->dt->gui->reset) return; temp_changed(self); dt_iop_temperature_gui_data_t *g = (dt_iop_temperature_gui_data_t *)self->gui_data; dt_bauhaus_combobox_set(g->presets, -1); }
void gui_reset(dt_imageio_module_storage_t *self) { disk_t *d = (disk_t *)self->gui_data; // global default can be annoying: // gtk_entry_set_text(GTK_ENTRY(d->entry), "$(FILE_FOLDER)/darktable_exported/$(FILE_NAME)"); dt_conf_set_string("plugins/imageio/storage/disk/file_directory", gtk_entry_get_text(d->entry)); // this should prevent users from unintentional image overwrite dt_bauhaus_combobox_set(d->overwrite, 0); }
void gui_update(struct dt_iop_module_t *self) { dt_iop_module_t *module = (dt_iop_module_t *)self; dt_iop_lowpass_gui_data_t *g = (dt_iop_lowpass_gui_data_t *)self->gui_data; dt_iop_lowpass_params_t *p = (dt_iop_lowpass_params_t *)module->params; dt_bauhaus_slider_set(g->scale1, fabsf(p->radius)); dt_bauhaus_combobox_set(g->bilat, p->radius < 0 ? 1 : 0); dt_bauhaus_slider_set(g->scale2, p->contrast); dt_bauhaus_slider_set(g->scale3, p->saturation); //gtk_combo_box_set_active(g->order, p->order); }
void gui_update(struct dt_iop_module_t *self) { dt_iop_module_t *module = (dt_iop_module_t *)self; 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 *)module->params; dt_bauhaus_combobox_set(g->output_intent, (int)p->intent); for(GList *iter = darktable.color_profiles->profiles; iter; iter = g_list_next(iter)) { dt_colorspaces_color_profile_t *pp = (dt_colorspaces_color_profile_t *)iter->data; if(pp->out_pos > -1 && p->type == pp->type && (p->type != DT_COLORSPACE_FILE || !strcmp(p->filename, pp->filename))) { dt_bauhaus_combobox_set(g->output_profile, pp->out_pos); return; } } dt_bauhaus_combobox_set(g->output_profile, 0); fprintf(stderr, "[colorout] could not find requested profile `%s'!\n", dt_colorspaces_get_name(p->type, p->filename)); }
void gui_init(struct dt_iop_module_t *self) { self->gui_data = malloc(sizeof(dt_iop_channelmixer_gui_data_t)); 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 *)self->params; self->widget = gtk_vbox_new(FALSE, DT_BAUHAUS_SPACE); /* output */ g->combo1 = dt_bauhaus_combobox_new(self); dt_bauhaus_widget_set_label(g->combo1, NULL, _("destination")); dt_bauhaus_combobox_add(g->combo1,_("hue")); dt_bauhaus_combobox_add(g->combo1,_("saturation")); dt_bauhaus_combobox_add(g->combo1,_("lightness")); dt_bauhaus_combobox_add(g->combo1,_("red")); dt_bauhaus_combobox_add(g->combo1,_("green")); dt_bauhaus_combobox_add(g->combo1,_("blue")); dt_bauhaus_combobox_add(g->combo1,C_("channelmixer", "gray")); dt_bauhaus_combobox_set(g->combo1, CHANNEL_RED ); g_signal_connect (G_OBJECT (g->combo1), "value-changed", G_CALLBACK (output_callback), self); /* red */ g->scale1 = dt_bauhaus_slider_new_with_range(self, -2.0, 2.0, 0.005, p->red[CHANNEL_RED] , 3); g_object_set (GTK_OBJECT(g->scale1), "tooltip-text", _("amount of red channel in the output channel"), (char *)NULL); dt_bauhaus_widget_set_label(g->scale1, NULL, _("red")); g_signal_connect (G_OBJECT (g->scale1), "value-changed", G_CALLBACK (red_callback), self); /* green */ g->scale2 = dt_bauhaus_slider_new_with_range(self, -2.0, 2.0, 0.005, p->green[CHANNEL_RED] , 3); g_object_set (GTK_OBJECT(g->scale2), "tooltip-text", _("amount of green channel in the output channel"), (char *)NULL); dt_bauhaus_widget_set_label(g->scale2, NULL, _("green")); g_signal_connect (G_OBJECT (g->scale2), "value-changed", G_CALLBACK (green_callback), self); /* blue */ g->scale3 = dt_bauhaus_slider_new_with_range(self, -2.0, 2.0, 0.005, p->blue[CHANNEL_RED] , 3); g_object_set(g->scale3, "tooltip-text", _("amount of blue channel in the output channel"), (char *)NULL); dt_bauhaus_widget_set_label(g->scale3, NULL, _("blue")); g_signal_connect (G_OBJECT (g->scale3), "value-changed", G_CALLBACK (blue_callback), self); gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->combo1), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->scale1), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->scale2), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->scale3), TRUE, TRUE, 0); }
void gui_update(struct dt_iop_module_t *self) { dt_iop_module_t *module = (dt_iop_module_t *)self; dt_iop_watermark_gui_data_t *g = (dt_iop_watermark_gui_data_t *)self->gui_data; dt_iop_watermark_params_t *p = (dt_iop_watermark_params_t *)module->params; dt_bauhaus_slider_set(g->scale1, p->opacity); dt_bauhaus_slider_set(g->scale2, p->scale); dt_bauhaus_slider_set(g->scale3, p->xoffset); dt_bauhaus_slider_set(g->scale4, p->yoffset); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(g->dtba[ p->alignment ]), TRUE); _combo_box_set_active_text(GTK_COMBO_BOX(g->combobox1), p->filename); dt_bauhaus_combobox_set(g->sizeto, p->sizeto); }
static int selected_member(lua_State*L) { lua_combobox combobox; luaA_to(L,lua_combobox,&combobox,1); int length = dt_bauhaus_combobox_length(combobox->widget); if(lua_gettop(L) > 2) { if(lua_isnil(L,3)) { dt_bauhaus_combobox_set(combobox->widget,-1); } else if(lua_isnumber(L,3)) { int index = lua_tointeger(L,3) ; if(index < 0 || index > length) { return luaL_error(L,"Invalid index for combo box : %d\n",index); } dt_bauhaus_combobox_set(combobox->widget,index -1); } else { return luaL_error(L,"Invalid type for combo box selected\n"); } return 0; } lua_pushinteger(L,dt_bauhaus_combobox_get(combobox->widget) + 1); return 1; }
int set_params(dt_imageio_module_storage_t *self, const void *params, const int size) { dt_imageio_disk_t *d = (dt_imageio_disk_t *)params; disk_t *g = (disk_t *)self->gui_data; if(size != self->params_size(self)) return 1; gtk_entry_set_text(GTK_ENTRY(g->entry), d->filename); // we really do not want user to unintentionally overwrite image dt_bauhaus_combobox_set(g->overwrite, 0); return 0; }
static void _combo_box_set_active_text(GtkWidget *cb, gchar *text) { int i = 0; for(const GList *iter = dt_bauhaus_combobox_get_labels(cb); iter; iter = g_list_next(iter)) { if(!g_strcmp0((gchar *)iter->data, text)) { dt_bauhaus_combobox_set(cb, i); return; } i++; } }
static GtkWidget *_guides_gui_golden_mean(dt_iop_module_t *self, void *user_data) { _golden_mean_t *data = (_golden_mean_t *)user_data; GtkWidget *golden_extras = dt_bauhaus_combobox_new(self); dt_bauhaus_widget_set_label(golden_extras, NULL, _("extra")); dt_bauhaus_combobox_add(golden_extras, _("golden sections")); dt_bauhaus_combobox_add(golden_extras, _("golden spiral sections")); dt_bauhaus_combobox_add(golden_extras, _("golden spiral")); dt_bauhaus_combobox_add(golden_extras, _("all")); gtk_widget_set_tooltip_text(golden_extras, _("show some extra guides")); dt_bauhaus_combobox_set(golden_extras, data->which); g_signal_connect(G_OBJECT(golden_extras), "value-changed", G_CALLBACK(_golden_mean_changed), user_data); return golden_extras; }
void gui_init(dt_imageio_module_storage_t *self) { disk_t *d = (disk_t *)malloc(sizeof(disk_t)); self->gui_data = (void *)d; self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_PIXEL_APPLY_DPI(5)); GtkWidget *widget; GtkWidget *hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, DT_PIXEL_APPLY_DPI(8)); gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(hbox), TRUE, FALSE, 0); widget = gtk_entry_new(); gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0); gchar *dir = dt_conf_get_string("plugins/imageio/storage/disk/file_directory"); if(dir) { gtk_entry_set_text(GTK_ENTRY(widget), dir); g_free(dir); } dt_gtkentry_setup_completion(GTK_ENTRY(widget), dt_gtkentry_get_default_path_compl_list()); char *tooltip_text = dt_gtkentry_build_completion_tooltip_text( _("enter the path where to put exported images\nvariables support bash like string manipulation\n" "recognized variables:"), dt_gtkentry_get_default_path_compl_list()); d->entry = GTK_ENTRY(widget); dt_gui_key_accel_block_on_focus_connect(GTK_WIDGET(d->entry)); gtk_entry_set_width_chars(GTK_ENTRY(widget), 0); gtk_widget_set_tooltip_text(widget, tooltip_text); g_signal_connect(G_OBJECT(widget), "changed", G_CALLBACK(entry_changed_callback), self); widget = dtgtk_button_new(dtgtk_cairo_paint_directory, CPF_DO_NOT_USE_BORDER, NULL); gtk_widget_set_size_request(widget, DT_PIXEL_APPLY_DPI(18), DT_PIXEL_APPLY_DPI(18)); gtk_widget_set_tooltip_text(widget, _("select directory")); gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(button_clicked), self); d->overwrite = dt_bauhaus_combobox_new(NULL); dt_bauhaus_widget_set_label(d->overwrite, NULL, _("on conflict")); dt_bauhaus_combobox_add(d->overwrite, _("create unique filename")); dt_bauhaus_combobox_add(d->overwrite, _("overwrite")); gtk_box_pack_start(GTK_BOX(self->widget), d->overwrite, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(d->overwrite), "value-changed", G_CALLBACK(overwrite_toggle_callback), self); dt_bauhaus_combobox_set(d->overwrite, 0); g_free(tooltip_text); }
static void rgb_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_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; const float value = dt_bauhaus_slider_get( slider ); if (slider == g->scale_r) p->coeffs[0] = value; else if(slider == g->scale_g) p->coeffs[1] = value; else if(slider == g->scale_b) p->coeffs[2] = value; gui_update_from_coeffs(self); dt_dev_add_history_item(darktable.develop, self, TRUE); dt_bauhaus_combobox_set(g->presets, -1); }
void gui_update(struct dt_iop_module_t *self) { dt_iop_module_t *module = (dt_iop_module_t *)self; 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 *)module->params; dt_bauhaus_combobox_set(g->cbox1, (int)p->intent); dt_bauhaus_combobox_set(g->cbox4, (int)p->displayintent); int iccfound = 0, displayfound = 0, softprooffound = 0; GList *prof = g->profiles; while(prof) { dt_iop_color_profile_t *pp = (dt_iop_color_profile_t *)prof->data; if(!strcmp(pp->filename, p->iccprofile)) { dt_bauhaus_combobox_set(g->cbox2, pp->pos); iccfound = 1; } if(!strcmp(pp->filename, p->displayprofile)) { dt_bauhaus_combobox_set(g->cbox3, pp->display_pos); displayfound = 1; } if(!strcmp(pp->filename, p->softproofprofile)) { dt_bauhaus_combobox_set(g->cbox5, pp->pos); softprooffound = 1; } if(iccfound && displayfound && softprooffound) break; prof = g_list_next(prof); } if(!iccfound) dt_bauhaus_combobox_set(g->cbox2, 0); if(!displayfound) dt_bauhaus_combobox_set(g->cbox3, 0); if(!softprooffound) dt_bauhaus_combobox_set(g->cbox5, 0); if(!iccfound) fprintf(stderr, "[colorout] could not find requested profile `%s'!\n", p->iccprofile); if(!displayfound) fprintf(stderr, "[colorout] could not find requested display profile `%s'!\n", p->displayprofile); if(!softprooffound) fprintf(stderr, "[colorout] could not find requested softproof profile `%s'!\n", p->softproofprofile); }
static gboolean dt_iop_tonecurve_button_press(GtkWidget *widget, GdkEventButton *event, gpointer user_data) { dt_iop_module_t *self = (dt_iop_module_t *)user_data; dt_iop_tonecurve_params_t *p = (dt_iop_tonecurve_params_t *)self->params; dt_iop_tonecurve_params_t *d = (dt_iop_tonecurve_params_t *)self->default_params; dt_iop_tonecurve_gui_data_t *c = (dt_iop_tonecurve_gui_data_t *)self->gui_data; int ch = c->channel; int autoscale_ab = p->tonecurve_autoscale_ab; if(event->button == 1 && event->type == GDK_2BUTTON_PRESS) { // reset current curve // if autoscale_ab is on: allow only reset of L curve if (!(autoscale_ab && ch != ch_L)) { p->tonecurve_nodes[ch] = d->tonecurve_nodes[ch]; p->tonecurve_type[ch] = d->tonecurve_type[ch]; for(int k=0; k<d->tonecurve_nodes[ch]; k++) { p->tonecurve[ch][k].x = d->tonecurve[ch][k].x; p->tonecurve[ch][k].y = d->tonecurve[ch][k].y; } c->selected = -2; // avoid motion notify re-inserting immediately. dt_dev_add_history_item(darktable.develop, self, TRUE); gtk_widget_queue_draw(self->widget); } else { if (ch != ch_L) { p->tonecurve_autoscale_ab = 0; c->selected = -2; // avoid motion notify re-inserting immediately. dt_bauhaus_combobox_set(c->autoscale_ab, 1-p->tonecurve_autoscale_ab); dt_dev_add_history_item(darktable.develop, self, TRUE); gtk_widget_queue_draw(self->widget); } } return TRUE; } return FALSE; }