本文整理汇总了C++中DT_PIXEL_APPLY_DPI函数的典型用法代码示例。如果您正苦于以下问题:C++ DT_PIXEL_APPLY_DPI函数的具体用法?C++ DT_PIXEL_APPLY_DPI怎么用?C++ DT_PIXEL_APPLY_DPI使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DT_PIXEL_APPLY_DPI函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gui_init
void gui_init(struct dt_iop_module_t *self)
{
self->gui_data = malloc(sizeof(dt_iop_monochrome_gui_data_t));
dt_iop_monochrome_gui_data_t *g = (dt_iop_monochrome_gui_data_t *)self->gui_data;
g->dragging = 0;
self->request_color_pick = DT_REQUEST_COLORPICK_OFF;
self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE);
dt_gui_add_help_link(self->widget, dt_get_help_url(self->op));
g->area = GTK_DRAWING_AREA(dtgtk_drawing_area_new_with_aspect_ratio(1.0));
gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->area), TRUE, TRUE, 0);
gtk_widget_set_tooltip_text(GTK_WIDGET(g->area), _("drag and scroll mouse wheel to adjust the virtual color filter"));
gtk_widget_add_events(GTK_WIDGET(g->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_LEAVE_NOTIFY_MASK | darktable.gui->scroll_mask);
g_signal_connect(G_OBJECT(g->area), "draw", G_CALLBACK(dt_iop_monochrome_draw), self);
g_signal_connect(G_OBJECT(g->area), "button-press-event", G_CALLBACK(dt_iop_monochrome_button_press), self);
g_signal_connect(G_OBJECT(g->area), "button-release-event", G_CALLBACK(dt_iop_monochrome_button_release),
self);
g_signal_connect(G_OBJECT(g->area), "motion-notify-event", G_CALLBACK(dt_iop_monochrome_motion_notify),
self);
g_signal_connect(G_OBJECT(g->area), "leave-notify-event", G_CALLBACK(dt_iop_monochrome_leave_notify), self);
g_signal_connect(G_OBJECT(g->area), "scroll-event", G_CALLBACK(dt_iop_monochrome_scrolled), self);
GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, DT_BAUHAUS_SPACE);
g->highlights = dt_bauhaus_slider_new_with_range(self, 0.0, 1.0, 0.01, 0.0, 2);
gtk_widget_set_tooltip_text(g->highlights, _("how much to keep highlights"));
dt_bauhaus_widget_set_label(g->highlights, NULL, _("highlights"));
gtk_box_pack_start(GTK_BOX(box), g->highlights, TRUE, TRUE, 0);
g_signal_connect(G_OBJECT(g->highlights), "value-changed", G_CALLBACK(highlights_callback), self);
g->colorpicker = dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
gtk_widget_set_size_request(GTK_WIDGET(g->colorpicker), DT_PIXEL_APPLY_DPI(14), DT_PIXEL_APPLY_DPI(14));
gtk_box_pack_end(GTK_BOX(box), GTK_WIDGET(g->colorpicker), FALSE, FALSE, 0);
g_signal_connect(G_OBJECT(g->colorpicker), "toggled", G_CALLBACK(picker_callback), self);
gtk_box_pack_end(GTK_BOX(self->widget), GTK_WIDGET(box), TRUE, TRUE, 0);
cmsHPROFILE hsRGB = dt_colorspaces_get_profile(DT_COLORSPACE_SRGB, "", DT_PROFILE_DIRECTION_IN)->profile;
cmsHPROFILE hLab = dt_colorspaces_get_profile(DT_COLORSPACE_LAB, "", DT_PROFILE_DIRECTION_ANY)->profile;
g->xform = cmsCreateTransform(hLab, TYPE_Lab_DBL, hsRGB, TYPE_RGB_DBL, INTENT_PERCEPTUAL,
0); // cmsFLAGS_NOTPRECALC);
}
示例2: calloc
/** Creates a gconf widget. */
static _camera_gconf_widget_t *_camera_import_gconf_widget(_camera_import_dialog_t *dlg, gchar *label,
gchar *confstring)
{
_camera_gconf_widget_t *gcw = calloc(1, sizeof(_camera_gconf_widget_t));
GtkWidget *vbox, *hbox;
gcw->widget = vbox = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_VERTICAL, 0));
hbox = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0));
g_object_set_data(G_OBJECT(vbox), "gconf:string", confstring);
gcw->dialog = dlg;
gcw->entry = gtk_entry_new();
char *value = dt_conf_get_string(confstring);
if(value)
{
gtk_entry_set_text(GTK_ENTRY(gcw->entry), value);
g_free(gcw->value);
gcw->value = value;
}
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(gcw->entry), TRUE, TRUE, 0);
GtkWidget *button = dtgtk_button_new(dtgtk_cairo_paint_store, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
gtk_widget_set_tooltip_text(button, _("store value as default"));
gtk_widget_set_size_request(button, DT_PIXEL_APPLY_DPI(13), DT_PIXEL_APPLY_DPI(13));
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(_gcw_store_callback), gcw);
button = dtgtk_button_new(dtgtk_cairo_paint_reset, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
gtk_widget_set_tooltip_text(button, _("reset value to default"));
gtk_widget_set_size_request(button, DT_PIXEL_APPLY_DPI(13), DT_PIXEL_APPLY_DPI(13));
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(_gcw_reset_callback), gcw);
GtkWidget *l = gtk_label_new(label);
gtk_widget_set_halign(l, GTK_ALIGN_START);
gtk_box_pack_start(GTK_BOX(vbox), l, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(hbox), FALSE, FALSE, 0);
g_signal_connect(G_OBJECT(gtk_entry_get_buffer(GTK_ENTRY(gcw->entry))), "inserted-text",
G_CALLBACK(entry_it_callback), gcw);
g_signal_connect(G_OBJECT(gtk_entry_get_buffer(GTK_ENTRY(gcw->entry))), "deleted-text",
G_CALLBACK(entry_dt_callback), gcw);
return gcw;
}
示例3: _lib_darktable_draw_callback
static gboolean _lib_darktable_draw_callback(GtkWidget *widget, cairo_t *cr, gpointer user_data)
{
dt_lib_module_t *self = (dt_lib_module_t *)user_data;
dt_lib_darktable_t *d = (dt_lib_darktable_t *)self->data;
GtkStyleContext *context = gtk_widget_get_style_context(widget);
GtkAllocation allocation;
gtk_widget_get_allocation(widget, &allocation);
gtk_render_background(context, cr, 0, 0, allocation.width, allocation.height);
GtkStateFlags state = gtk_widget_get_state_flags(widget);
PangoFontDescription *font_desc = NULL;
gtk_style_context_get(context, state, "font", &font_desc, NULL);
/* paint icon image */
if(d->image)
{
cairo_set_source_surface(cr, d->image, 0, (int)DT_PIXEL_APPLY_DPI(7));
cairo_rectangle(cr, 0, 0, d->image_width + (int)DT_PIXEL_APPLY_DPI(8),
d->image_height + (int)DT_PIXEL_APPLY_DPI(8));
cairo_fill(cr);
}
/* create a pango layout and print fancy name/version string */
PangoLayout *layout;
layout = gtk_widget_create_pango_layout(widget, NULL);
pango_font_description_set_weight(font_desc, PANGO_WEIGHT_BOLD);
pango_font_description_set_absolute_size(font_desc, DT_PIXEL_APPLY_DPI(25) * PANGO_SCALE);
pango_layout_set_font_description(layout, font_desc);
pango_layout_set_text(layout, PACKAGE_NAME, -1);
cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 0.5);
cairo_move_to(cr, d->image_width + DT_PIXEL_APPLY_DPI(2.0), DT_PIXEL_APPLY_DPI(5.0));
pango_cairo_show_layout(cr, layout);
/* print version */
pango_font_description_set_absolute_size(font_desc, DT_PIXEL_APPLY_DPI(10) * PANGO_SCALE);
pango_layout_set_font_description(layout, font_desc);
pango_layout_set_text(layout, darktable_package_version, -1);
cairo_move_to(cr, d->image_width + DT_PIXEL_APPLY_DPI(4.0), DT_PIXEL_APPLY_DPI(30.0));
cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 0.3);
pango_cairo_show_layout(cr, layout);
/* cleanup */
g_object_unref(layout);
pango_font_description_free(font_desc);
return TRUE;
}
示例4: gui_init
void gui_init(dt_lib_module_t *self)
{
/* initialize ui widgets */
dt_lib_tool_lighttable_t *d = (dt_lib_tool_lighttable_t *)g_malloc0(sizeof(dt_lib_tool_lighttable_t));
self->data = (void *)d;
self->widget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
d->layout = dt_conf_get_int("plugins/lighttable/layout");
d->previous_layout = d->layout == DT_LIGHTTABLE_LAYOUT_EXPOSE ? DT_LIGHTTABLE_LAYOUT_FILEMANAGER : DT_LIGHTTABLE_LAYOUT_EXPOSE;
d->current_zoom = dt_conf_get_int("plugins/lighttable/images_in_row");
/* create layout selection combobox */
d->layout_combo = gtk_combo_box_text_new();
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(d->layout_combo), _("zoomable light table"));
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(d->layout_combo), _("file manager"));
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(d->layout_combo), _("expose"));
gtk_combo_box_set_active(GTK_COMBO_BOX(d->layout_combo), d->layout);
g_signal_connect(G_OBJECT(d->layout_combo), "changed", G_CALLBACK(_lib_lighttable_layout_changed), (gpointer)self);
gtk_box_pack_start(GTK_BOX(self->widget), d->layout_combo, TRUE, TRUE, 0);
/* create horizontal zoom slider */
d->zoom = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, 1, 21, 1);
gtk_widget_set_size_request(GTK_WIDGET(d->zoom), DT_PIXEL_APPLY_DPI(140), -1);
gtk_scale_set_draw_value(GTK_SCALE(d->zoom), FALSE);
gtk_range_set_increments(GTK_RANGE(d->zoom), 1, 1);
gtk_box_pack_start(GTK_BOX(self->widget), d->zoom, TRUE, TRUE, 0);
/* manual entry of the zoom level */
d->zoom_entry = gtk_entry_new();
gtk_entry_set_alignment(GTK_ENTRY(d->zoom_entry), 1.0);
gtk_entry_set_max_length(GTK_ENTRY(d->zoom_entry), 2);
gtk_entry_set_width_chars(GTK_ENTRY(d->zoom_entry), 3);
gtk_entry_set_max_width_chars(GTK_ENTRY(d->zoom_entry), 3);
dt_gui_key_accel_block_on_focus_connect(d->zoom_entry);
gtk_box_pack_start(GTK_BOX(self->widget), d->zoom_entry, TRUE, TRUE, 0);
g_signal_connect(G_OBJECT(d->zoom), "value-changed", G_CALLBACK(_lib_lighttable_zoom_slider_changed),
(gpointer)self);
g_signal_connect(d->zoom_entry, "key-press-event", G_CALLBACK(_lib_lighttable_zoom_entry_changed), self);
gtk_range_set_value(GTK_RANGE(d->zoom), d->current_zoom);
_lib_lighttable_zoom_slider_changed(GTK_RANGE(d->zoom), self); // the slider defaults to 1 and GTK doesn't
// fire a value-changed signal when setting
// it to 1 => empty text box
gtk_widget_set_no_show_all(d->zoom, TRUE);
gtk_widget_set_no_show_all(d->zoom_entry, TRUE);
_lib_lighttable_layout_changed(GTK_COMBO_BOX(d->layout_combo), self);
darktable.view_manager->proxy.lighttable.module = self;
darktable.view_manager->proxy.lighttable.set_zoom = _lib_lighttable_set_zoom;
darktable.view_manager->proxy.lighttable.get_zoom = _lib_lighttable_get_zoom;
darktable.view_manager->proxy.lighttable.get_layout = _lib_lighttable_get_layout;
darktable.view_manager->proxy.lighttable.set_layout = _lib_lighttable_set_layout;
}
示例5: mouse_moved
int mouse_moved(struct dt_iop_module_t *self, double x, double y, double pressure, int which)
{
dt_iop_graduatednd_gui_data_t *g = (dt_iop_graduatednd_gui_data_t *)self->gui_data;
dt_dev_zoom_t zoom = dt_control_get_dev_zoom();
int closeup = dt_control_get_dev_closeup();
float zoom_scale = dt_dev_get_zoom_scale(self->dev, zoom, closeup ? 2 : 1, 1);
float pzx, pzy;
dt_dev_get_pointer_zoom_pos(self->dev, x, y, &pzx, &pzy);
pzx += 0.5f;
pzy += 0.5f;
// are we dragging something ?
if(g->dragging > 0)
{
if(g->dragging == 1)
{
// we are dragging xa,ya
g->xa = pzx;
g->ya = pzy;
}
else if(g->dragging == 2)
{
// we are dragging xb,yb
g->xb = pzx;
g->yb = pzy;
}
else if(g->dragging == 3)
{
// we are dragging the entire line
g->xa += pzx - g->oldx;
g->xb += pzx - g->oldx;
g->ya += pzy - g->oldy;
g->yb += pzy - g->oldy;
g->oldx = pzx;
g->oldy = pzy;
}
}
else
{
g->selected = 0;
const float ext = DT_PIXEL_APPLY_DPI(0.02f) / zoom_scale;
// are we near extermity ?
if(pzy > g->ya - ext && pzy < g->ya + ext && pzx > g->xa - ext && pzx < g->xa + ext)
{
g->selected = 1;
}
else if(pzy > g->yb - ext && pzy < g->yb + ext && pzx > g->xb - ext && pzx < g->xb + ext)
{
g->selected = 2;
}
else if(dist_seg(g->xa, g->ya, g->xb, g->yb, pzx, pzy) < ext * ext * 0.5)
g->selected = 3;
}
dt_control_queue_redraw_center();
return 1;
}
示例6: gui_init_tab
static inline void gui_init_tab(struct dt_iop_module_t *self, const char *name, GtkWidget **ppcolor,
const GdkRGBA *c, GtkWidget **pphue, GtkWidget **ppsaturation)
{
gtk_box_pack_start(GTK_BOX(self->widget), dt_ui_section_label_new(name), FALSE, FALSE, 5);
// color button
GtkWidget *color;
*ppcolor = color = gtk_color_button_new_with_rgba(c);
gtk_widget_set_size_request(GTK_WIDGET(color), DT_PIXEL_APPLY_DPI(32), DT_PIXEL_APPLY_DPI(32));
gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(color), FALSE);
gtk_color_button_set_title(GTK_COLOR_BUTTON(color), _("select tone color"));
// hue slider
GtkWidget *hue;
*pphue = hue = (dt_bauhaus_slider_new_with_range_and_feedback(self, 0.0f, 1.0f, 0.01f, 0.0f, 2, 0));
dt_bauhaus_slider_set_stop(hue, 0.0f, 1.0f, 0.0f, 0.0f);
dt_bauhaus_widget_set_label(hue, NULL, _("hue"));
dt_bauhaus_slider_set_stop(hue, 0.166f, 1.0f, 1.0f, 0.0f);
dt_bauhaus_slider_set_stop(hue, 0.322f, 0.0f, 1.0f, 0.0f);
dt_bauhaus_slider_set_stop(hue, 0.498f, 0.0f, 1.0f, 1.0f);
dt_bauhaus_slider_set_stop(hue, 0.664f, 0.0f, 0.0f, 1.0f);
dt_bauhaus_slider_set_stop(hue, 0.830f, 1.0f, 0.0f, 1.0f);
dt_bauhaus_slider_set_stop(hue, 1.0f, 1.0f, 0.0f, 0.0f);
g_object_set(G_OBJECT(hue), "tooltip-text", _("select the hue tone"), (char *)NULL);
// saturation slider
GtkWidget *saturation;
*ppsaturation = saturation = dt_bauhaus_slider_new_with_range(self, 0.0f, 1.0f, 0.01f, 0.0f, 2);
dt_bauhaus_widget_set_label(saturation, NULL, _("saturation"));
dt_bauhaus_slider_set_stop(saturation, 0.0f, 0.2f, 0.2f, 0.2f);
dt_bauhaus_slider_set_stop(saturation, 1.0f, 1.0f, 1.0f, 1.0f);
g_object_set(G_OBJECT(saturation), "tooltip-text", _("select the saturation tone"), (char *)NULL);
// pack the widgets
GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE);
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(hue), FALSE, TRUE, 0);
gtk_box_pack_end(GTK_BOX(vbox), GTK_WIDGET(saturation), FALSE, TRUE, 0);
GtkWidget *hbox = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0));
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(vbox), TRUE, TRUE, 0);
gtk_box_pack_end(GTK_BOX(hbox), GTK_WIDGET(color), FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(hbox), TRUE, TRUE, 0);
}
示例7: gui_init
void gui_init(dt_lib_module_t *self)
{
/* initialize ui widgets */
dt_lib_history_t *d = (dt_lib_history_t *)g_malloc0(sizeof(dt_lib_history_t));
self->data = (void *)d;
self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_PIXEL_APPLY_DPI(5));
gtk_widget_set_name(self->widget, "history-ui");
d->history_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
GtkWidget *hhbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, DT_PIXEL_APPLY_DPI(5));
GtkWidget *hbutton = dtgtk_button_new(NULL, /*CPF_DO_NOT_USE_BORDER | CPF_STYLE_FLAT*/0);
gtk_button_set_label(GTK_BUTTON(hbutton), _("compress history stack"));
d->compress_button = hbutton;
g_object_set(G_OBJECT(hbutton), "tooltip-text",
_("create a minimal history stack which produces the same image"), (char *)NULL);
g_signal_connect(G_OBJECT(hbutton), "clicked", G_CALLBACK(_lib_history_compress_clicked_callback), NULL);
/* add toolbar button for creating style */
GtkWidget *hbutton2 = dtgtk_button_new(dtgtk_cairo_paint_styles, CPF_DO_NOT_USE_BORDER);
gtk_widget_set_size_request (hbutton2, DT_PIXEL_APPLY_DPI(24), -1);
g_signal_connect(G_OBJECT(hbutton2), "clicked",
G_CALLBACK(_lib_history_create_style_button_clicked_callback), NULL);
g_object_set(G_OBJECT(hbutton2), "tooltip-text", _("create a style from the current history stack"),
(char *)NULL);
d->create_button = hbutton2;
/* add buttons to buttonbox */
gtk_box_pack_start(GTK_BOX(hhbox), hbutton, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(hhbox), hbutton2, FALSE, FALSE, 0);
/* add history list and buttonbox to widget */
gtk_box_pack_start(GTK_BOX(self->widget), d->history_box, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(self->widget), hhbox, FALSE, FALSE, 0);
gtk_widget_show_all(self->widget);
/* connect to history change signal for updating the history view */
dt_control_signal_connect(darktable.signals, DT_SIGNAL_DEVELOP_HISTORY_CHANGE,
G_CALLBACK(_lib_history_change_callback), self);
}
示例8: gui_init
/*
http://nominatim.openstreetmap.org/search/norrköping?format=xml&limit=5
*/
void gui_init(dt_lib_module_t *self)
{
self->data = calloc(1, sizeof(dt_lib_location_t));
dt_lib_location_t *lib = self->data;
self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_PIXEL_APPLY_DPI(5));
/* add search box */
lib->search = GTK_ENTRY(gtk_entry_new());
dt_gui_key_accel_block_on_focus_connect(GTK_WIDGET(lib->search));
gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(lib->search), FALSE, FALSE, 0);
g_signal_connect(G_OBJECT(lib->search), "activate", G_CALLBACK(_lib_location_entry_activated),
(gpointer)self);
/* add result vbox */
lib->result = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_PIXEL_APPLY_DPI(10));
gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(lib->result), TRUE, FALSE, DT_PIXEL_APPLY_DPI(2));
}
示例9: gui_init
void gui_init(struct dt_iop_module_t *self)
{
self->gui_data = malloc(sizeof(dt_iop_zonesystem_gui_data_t));
dt_iop_zonesystem_gui_data_t *g = (dt_iop_zonesystem_gui_data_t *)self->gui_data;
g->in_preview_buffer = g->out_preview_buffer = NULL;
g->is_dragging = FALSE;
g->hilite_zone = FALSE;
g->preview_width = g->preview_height = 0;
g->mouse_over_output_zones = FALSE;
dt_pthread_mutex_init(&g->lock, NULL);
self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_GUI_IOP_MODULE_CONTROL_SPACING);
g->preview = dtgtk_drawing_area_new_with_aspect_ratio(1.0);
g_signal_connect(G_OBJECT(g->preview), "size-allocate", G_CALLBACK(size_allocate_callback), self);
g_signal_connect(G_OBJECT(g->preview), "draw", G_CALLBACK(dt_iop_zonesystem_preview_draw), self);
gtk_widget_add_events(GTK_WIDGET(g->preview), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_LEAVE_NOTIFY_MASK);
/* create the zonesystem bar widget */
g->zones = gtk_drawing_area_new();
gtk_widget_set_tooltip_text(g->zones, _("lightness zones\nuse mouse scrollwheel to change the number of zones\n"
"left-click on a border to create a marker\n"
"right-click on a marker to delete it"));
g_signal_connect(G_OBJECT(g->zones), "draw", G_CALLBACK(dt_iop_zonesystem_bar_draw), self);
g_signal_connect(G_OBJECT(g->zones), "motion-notify-event", G_CALLBACK(dt_iop_zonesystem_bar_motion_notify),
self);
g_signal_connect(G_OBJECT(g->zones), "leave-notify-event", G_CALLBACK(dt_iop_zonesystem_bar_leave_notify),
self);
g_signal_connect(G_OBJECT(g->zones), "button-press-event", G_CALLBACK(dt_iop_zonesystem_bar_button_press),
self);
g_signal_connect(G_OBJECT(g->zones), "button-release-event",
G_CALLBACK(dt_iop_zonesystem_bar_button_release), self);
g_signal_connect(G_OBJECT(g->zones), "scroll-event", G_CALLBACK(dt_iop_zonesystem_bar_scrolled), self);
gtk_widget_add_events(GTK_WIDGET(g->zones), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_LEAVE_NOTIFY_MASK | GDK_SCROLL_MASK
| GDK_SMOOTH_SCROLL_MASK);
gtk_widget_set_size_request(g->zones, -1, DT_PIXEL_APPLY_DPI(40));
gtk_box_pack_start(GTK_BOX(self->widget), g->preview, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(self->widget), g->zones, TRUE, TRUE, 0);
/* add signal handler for preview pipe finish to redraw the preview */
dt_control_signal_connect(darktable.signals, DT_SIGNAL_DEVELOP_PREVIEW_PIPE_FINISHED,
G_CALLBACK(_iop_zonesystem_redraw_preview_callback), self);
g->image = NULL;
g->image_buffer = NULL;
g->image_width = 0;
g->image_height = 0;
}
示例10: gui_init_tab
static inline int gui_init_tab(struct dt_iop_module_t *self, int line, const char *name, GtkWidget **ppcolor,
const GdkRGBA *c, GtkWidget **pphue, GtkWidget **ppsaturation)
{
GtkGrid *grid = GTK_GRID(self->widget);
gtk_grid_attach(grid, dt_ui_section_label_new(name), 0, line++, 2, 1);
// color button
GtkWidget *color;
*ppcolor = color = gtk_color_button_new_with_rgba(c);
gtk_widget_set_size_request(GTK_WIDGET(color), DT_PIXEL_APPLY_DPI(32), DT_PIXEL_APPLY_DPI(32));
gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(color), FALSE);
gtk_color_button_set_title(GTK_COLOR_BUTTON(color), _("select tone color"));
// hue slider
GtkWidget *hue;
*pphue = hue = (dt_bauhaus_slider_new_with_range_and_feedback(self, 0.0f, 1.0f, 0.01f, 0.0f, 2, 0));
dt_bauhaus_slider_set_stop(hue, 0.0f, 1.0f, 0.0f, 0.0f);
dt_bauhaus_widget_set_label(hue, NULL, _("hue"));
dt_bauhaus_slider_set_stop(hue, 0.166f, 1.0f, 1.0f, 0.0f);
dt_bauhaus_slider_set_stop(hue, 0.322f, 0.0f, 1.0f, 0.0f);
dt_bauhaus_slider_set_stop(hue, 0.498f, 0.0f, 1.0f, 1.0f);
dt_bauhaus_slider_set_stop(hue, 0.664f, 0.0f, 0.0f, 1.0f);
dt_bauhaus_slider_set_stop(hue, 0.830f, 1.0f, 0.0f, 1.0f);
dt_bauhaus_slider_set_stop(hue, 1.0f, 1.0f, 0.0f, 0.0f);
g_object_set(G_OBJECT(hue), "tooltip-text", _("select the hue tone"), (char *)NULL);
// saturation slider
GtkWidget *saturation;
*ppsaturation = saturation = dt_bauhaus_slider_new_with_range(self, 0.0f, 1.0f, 0.01f, 0.0f, 2);
dt_bauhaus_widget_set_label(saturation, NULL, _("saturation"));
dt_bauhaus_slider_set_stop(saturation, 0.0f, 0.2f, 0.2f, 0.2f);
dt_bauhaus_slider_set_stop(saturation, 1.0f, 1.0f, 1.0f, 1.0f);
g_object_set(G_OBJECT(saturation), "tooltip-text", _("select the saturation tone"), (char *)NULL);
// pack the widgets
gtk_widget_set_hexpand(hue, TRUE); // make sure that the color picker doesn't become HUGE
gtk_grid_attach(grid, hue, 0, line, 1, 1);
gtk_grid_attach(grid, color, 1, line++, 1, 2);
gtk_grid_attach(grid, saturation, 0, line++, 1, 1);
return line;
}
示例11: gui_init
void gui_init(dt_lib_module_t *self)
{
/* initialize ui widgets */
dt_lib_duplicate_t *d = (dt_lib_duplicate_t *)g_malloc0(sizeof(dt_lib_duplicate_t));
self->data = (void *)d;
d->imgid = 0;
self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_PIXEL_APPLY_DPI(5));
gtk_widget_set_name(self->widget, "duplicate-ui");
GtkWidget *sw = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(sw), DT_PIXEL_APPLY_DPI(300));
d->duplicate_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
GtkWidget *bt = gtk_label_new(_("existing duplicates"));
gtk_box_pack_start(GTK_BOX(hb), bt, FALSE, FALSE, 0);
bt = dtgtk_button_new(dtgtk_cairo_paint_plusminus, CPF_ACTIVE | CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
g_object_set(G_OBJECT(bt), "tooltip-text", _("create a 'virgin' duplicate of the image without any developpement"), (char *)NULL);
g_signal_connect(G_OBJECT(bt), "button-press-event", G_CALLBACK(_lib_duplicate_new_clicked_callback), self);
gtk_box_pack_end(GTK_BOX(hb), bt, FALSE, FALSE, 0);
bt = dtgtk_button_new(dtgtk_cairo_paint_multiinstance, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
g_object_set(G_OBJECT(bt), "tooltip-text", _("create a duplicate of the image with same history stack"), (char *)NULL);
g_signal_connect(G_OBJECT(bt), "button-press-event", G_CALLBACK(_lib_duplicate_duplicate_clicked_callback), self);
gtk_box_pack_end(GTK_BOX(hb), bt, FALSE, FALSE, 0);
/* add duplicate list and buttonbox to widget */
gtk_box_pack_start(GTK_BOX(self->widget), hb, FALSE, FALSE, 0);
gtk_container_add(GTK_CONTAINER(sw), d->duplicate_box);
gtk_box_pack_start(GTK_BOX(self->widget), sw, FALSE, FALSE, 0);
gtk_widget_show_all(self->widget);
dt_control_signal_connect(darktable.signals, DT_SIGNAL_DEVELOP_IMAGE_CHANGED, G_CALLBACK(_lib_duplicate_init_callback), self);
dt_control_signal_connect(darktable.signals, DT_SIGNAL_DEVELOP_INITIALIZE, G_CALLBACK(_lib_duplicate_init_callback), self);
dt_control_signal_connect(darktable.signals, DT_SIGNAL_COLLECTION_CHANGED,
G_CALLBACK(_lib_duplicate_init_callback), self);
dt_control_signal_connect(darktable.signals, DT_SIGNAL_DEVELOP_MIPMAP_UPDATED, G_CALLBACK(_lib_duplicate_mipmap_updated_callback), (gpointer)self);
}
示例12: gui_init
void gui_init(dt_lib_module_t *self)
{
/* initialize ui widgets */
dt_lib_modulelist_t *d = (dt_lib_modulelist_t *)g_malloc0(sizeof(dt_lib_modulelist_t));
self->data = (void *)d;
self->widget = gtk_scrolled_window_new(NULL, NULL); //GTK_ADJUSTMENT(gtk_adjustment_new(200, 100, 200, 10, 100, 100))
gtk_widget_set_size_request(self->widget, -1, DT_PIXEL_APPLY_DPI(208));
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(self->widget), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
d->tree = GTK_TREE_VIEW(gtk_tree_view_new());
gtk_widget_set_size_request(GTK_WIDGET(d->tree), DT_PIXEL_APPLY_DPI(50), -1);
gtk_container_add(GTK_CONTAINER(self->widget), GTK_WIDGET(d->tree));
/* connect to signal for darktable.develop initialization */
dt_control_signal_connect(darktable.signals,DT_SIGNAL_DEVELOP_INITIALIZE,G_CALLBACK(_lib_modulelist_populate_callback),self);
g_signal_connect(GTK_WIDGET(d->tree), "style-set", G_CALLBACK(_lib_modulelist_style_set), self);
g_signal_connect(GTK_WIDGET(d->tree), "cursor-changed", G_CALLBACK(_lib_modulelist_row_changed_callback), NULL);
darktable.view_manager->proxy.more_module.module = self;
darktable.view_manager->proxy.more_module.update = _lib_modulelist_gui_update;
}
示例13: _slider_size_request
static void _slider_size_request(GtkWidget *widget, GtkRequisition *requisition)
{
g_return_if_fail(widget != NULL);
g_return_if_fail(DTGTK_IS_SLIDER(widget));
g_return_if_fail(requisition != NULL);
GTK_WIDGET_CLASS(_slider_parent_class)->size_request(widget, requisition);
requisition->width = DT_PIXEL_APPLY_DPI(100);
requisition->height = DTGTK_SLIDER_CONTROL_MIN_HEIGHT;
}
示例14: _lib_property_add_to_gui
static void _lib_property_add_to_gui(dt_lib_camera_property_t *prop, dt_lib_camera_t *lib)
{
GtkWidget *hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, DT_PIXEL_APPLY_DPI(5));
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(prop->values), TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(prop->osd), FALSE, FALSE, 0);
gtk_grid_insert_row(lib->gui.main_grid, lib->gui.prop_end); // make space for the new row
gtk_grid_attach(lib->gui.main_grid, GTK_WIDGET(hbox), 0, lib->gui.prop_end, 2, 1);
g_signal_connect(G_OBJECT(prop->osd), "clicked", G_CALLBACK(_osd_button_clicked), prop);
gtk_widget_show_all(GTK_WIDGET(hbox));
lib->gui.rows++;
lib->gui.prop_end++;
}
示例15: gtk_entry_set_text
/* clean entries */
gtk_entry_set_text(GTK_ENTRY(lib->gui.plabel), "");
gtk_entry_set_text(GTK_ENTRY(lib->gui.pname), "");
}
}
}
static void _toggle_capture_mode_clicked(GtkWidget *widget, gpointer user_data)
{
dt_lib_camera_t *lib = (dt_lib_camera_t *)user_data;
GtkWidget *w = NULL;
if(widget == GTK_WIDGET(lib->gui.tb1))
w = lib->gui.sb1;
else if(widget == GTK_WIDGET(lib->gui.tb2))
w = lib->gui.sb2;
else if(widget == GTK_WIDGET(lib->gui.tb3))
{
gtk_widget_set_sensitive(lib->gui.sb3, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)));
gtk_widget_set_sensitive(lib->gui.sb4, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)));
}
if(w) gtk_widget_set_sensitive(w, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)));
}
#define BAR_HEIGHT DT_PIXEL_APPLY_DPI(18) /* also change in views/tethering.c */
static void _expose_info_bar(dt_lib_module_t *self, cairo_t *cr, int32_t width, int32_t height,
int32_t pointerx, int32_t pointery)
{
dt_lib_camera_t *lib = (dt_lib_camera_t *)self->data;
// Draw infobar background at top
cairo_set_source_rgb(cr, .0, .0, .0);
cairo_rectangle(cr, 0, 0, width, BAR_HEIGHT);
cairo_fill(cr);
cairo_set_source_rgb(cr, .8, .8, .8);
// Draw left aligned value camera model value
PangoLayout *layout;
PangoRectangle ink;
PangoFontDescription *desc = pango_font_description_copy_static(darktable.bauhaus->pango_font_desc);
pango_font_description_set_weight(desc, PANGO_WEIGHT_BOLD);
layout = pango_cairo_create_layout(cr);
const int fontsize = DT_PIXEL_APPLY_DPI(11.5);
pango_font_description_set_absolute_size(desc, fontsize * PANGO_SCALE);
pango_layout_set_font_description(layout, desc);
char model[4096] = { 0 };
sprintf(model + strlen(model), "%s", lib->data.camera_model);
pango_layout_set_text(layout, model, -1);
pango_layout_get_pixel_extents(layout, &ink, NULL);
cairo_move_to(cr, DT_PIXEL_APPLY_DPI(5), DT_PIXEL_APPLY_DPI(1) + BAR_HEIGHT - ink.height / 2 - fontsize);
pango_cairo_show_layout(cr, layout);
// Draw right aligned battery value
const char *battery_value = dt_camctl_camera_get_property(darktable.camctl, NULL, "batterylevel");
char battery[4096] = { 0 };
snprintf(battery, sizeof(battery), "%s: %s", _("battery"), battery_value ? battery_value : _("n/a"));
pango_layout_set_text(layout, battery, -1);
pango_layout_get_pixel_extents(layout, &ink, NULL);
cairo_move_to(cr, width - ink.width - DT_PIXEL_APPLY_DPI(5), DT_PIXEL_APPLY_DPI(1) + BAR_HEIGHT - ink.height / 2 - fontsize);
pango_cairo_show_layout(cr, layout);
// Let's cook up the middle part of infobar
gchar center[1024] = { 0 };
for(guint i = 0; i < g_list_length(lib->gui.properties); i++)
{
dt_lib_camera_property_t *prop = (dt_lib_camera_property_t *)g_list_nth_data(lib->gui.properties, i);
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prop->osd)) == TRUE)
{
g_strlcat(center, " ", sizeof(center));
g_strlcat(center, prop->name, sizeof(center));
g_strlcat(center, ": ", sizeof(center));
g_strlcat(center, dt_bauhaus_combobox_get_text(prop->values), sizeof(center));
}
}
g_strlcat(center, " ", sizeof(center));
// Now lets put it in center view...
pango_layout_set_text(layout, center, -1);
pango_layout_get_pixel_extents(layout, &ink, NULL);
cairo_move_to(cr, (width / 2) - (ink.width / 2), DT_PIXEL_APPLY_DPI(1) + BAR_HEIGHT - ink.height / 2 - fontsize);
pango_cairo_show_layout(cr, layout);
pango_font_description_free(desc);
g_object_unref(layout);
}