35#ifdef GDK_WINDOWING_QUARTZ
64 gtk_widget_destroy(dialog);
71 if(allocation->width < 2 || allocation->height < 2)
return;
72 if(
preview->width == allocation->width &&
preview->height == allocation->height)
return;
75 preview->height = allocation->height;
81 gtk_widget_queue_draw(widget);
102 int w = gtk_widget_get_allocated_width(widget);
103 int h = gtk_widget_get_allocated_height(widget);
108 cairo_set_source_rgb(cr, bg_color[0], bg_color[1], bg_color[2]);
123 int width = cairo_image_surface_get_width(
preview->surface);
124 int height = cairo_image_surface_get_height(
preview->surface);
125 double sx = 1.0, sy = 1.0;
126 cairo_surface_get_device_scale(
preview->surface, &sx, &sy);
127 const double logical_width =
width / sx;
128 const double logical_height =
height / sy;
132 double x_offset = (w - logical_width) / 2. + borders;
133 double y_offset = (h - logical_height) / 2. + borders;
134 cairo_set_source_surface(cr,
preview->surface, x_offset, y_offset);
138 GtkStyleContext *context = gtk_widget_get_style_context(widget);
139 gtk_style_context_get_color(context, gtk_widget_get_state_flags(widget), &im_color);
140 cairo_paint_with_alpha(cr, im_color.alpha);
143 gtk_render_frame(context, cr, borders, borders, w, h);
160 gtk_widget_queue_draw(
preview->area);
173 gchar *
name = g_strdup_printf(_(
"Ansel - Preview : %s"), img->
filename);
175 gtk_window_set_title(GTK_WINDOW(dialog),
name);
178#ifdef GDK_WINDOWING_QUARTZ
180 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ON_PARENT);
183 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_CANCEL);
184 gtk_window_set_modal(GTK_WINDOW(dialog),
FALSE);
186 gtk_window_set_default_size(GTK_WINDOW(dialog), 350, 350);
190 preview->area = gtk_drawing_area_new();
193 gtk_widget_set_halign(
preview->area, GTK_ALIGN_FILL);
194 gtk_widget_set_valign(
preview->area, GTK_ALIGN_FILL);
195 gtk_widget_set_size_request(
preview->area, 350, 350);
196 gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
preview->area,
TRUE,
TRUE, 0);
202 gtk_widget_show_all(dialog);
GtkWidget * dt_gui_main_window(void)
void dt_colorprofiles_xyz_to_display(const dt_aligned_pixel_t XYZ, dt_aligned_pixel_t RGB)
Convert one D50 XYZ pixel to display RGB.
The colour-profile module's API: which profiles exist, and how to apply one.
struct _GtkWidget GtkWidget
GtkWidget, opaque, spelled exactly as GTK spells it.
static dt_aligned_pixel_t XYZ
static dt_aligned_pixel_t Lab
static dt_aligned_pixel_t RGB
int dt_conf_get_int(const char *name)
Integer for name, clamped to the bounds declared in the XML.
void dt_control_draw_busy_msg(cairo_t *cr, int width, int height)
GtkWidget * preview
what the selected row actually captures
dt_image_t * dt_image_cache_get(const int32_t imgid, char mode)
void dt_image_cache_read_release(const dt_image_t *img)
void dt_print(dt_debug_thread_t thread, const char *msg,...) __attribute__((format(printf
Print to stdout when thread is enabled, prefixed with seconds since startup.
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
#define dt_free(ptr)
g_free() ptr and set it to NULL, skipping both if it is already NULL.
void dt_osx_disallow_fullscreen(GtkWidget *widget)
static void _close_preview_popup(GtkWidget *dialog, gint response_id, gpointer data)
static void _preview_window_destroy(GtkWidget *dialog, gpointer user_data)
void _preview_redraw(gpointer instance, dt_preview_window_t *preview)
static gboolean _thumb_draw_image(GtkWidget *widget, cairo_t *cr, gpointer user_data)
static void _preview_window_size_allocate(GtkWidget *widget, GtkAllocation *allocation, gpointer user_data)
void dt_preview_window_spawn(const int32_t imgid)
void _colormanage_ui_color(const float L, const float a, const float b, dt_aligned_pixel_t RGB)
#define DT_DEBUG_CONTROL_SIGNAL_DISCONNECT(ctlsig, cb, user_data)
struct dt_control_signal_t * dt_control_signal_get_global(void)
@ DT_SIGNAL_DARKROOM_UI_CHANGED
Signal that the darkroom GUI color changed.
#define DT_DEBUG_CONTROL_SIGNAL_CONNECT(ctlsig, signal, cb, user_data)
DT_ALIGNED_PIXEL float dt_aligned_pixel_t[4]
char filename[DT_MAX_FILENAME_LEN]
cairo_surface_t * surface
dt_view_image_surface_fetcher_t fetcher
Track one asynchronous Cairo surface fetch request for a GUI widget.
static double dt_get_wtime(void)
void dt_view_image_surface_fetcher_invalidate(dt_view_image_surface_fetcher_t *fetcher, cairo_surface_t **target)
void dt_view_image_surface_fetcher_cleanup(dt_view_image_surface_fetcher_t *fetcher)
void dt_view_image_surface_fetcher_init(dt_view_image_surface_fetcher_t *fetcher)
dt_view_surface_value_t dt_view_image_get_surface_async(dt_view_image_surface_fetcher_t *fetcher, int32_t imgid, int width, int height, cairo_surface_t **target, GtkWidget *widget, int zoom)