25#ifdef GDK_WINDOWING_QUARTZ
54 gtk_widget_destroy(dialog);
61 if(allocation->width < 2 || allocation->height < 2)
return;
62 if(preview->
width == allocation->width && preview->
height == allocation->height)
return;
64 preview->
width = allocation->width;
65 preview->
height = allocation->height;
71 gtk_widget_queue_draw(widget);
92 int w = gtk_widget_get_allocated_width(widget);
93 int h = gtk_widget_get_allocated_height(widget);
98 cairo_set_source_rgb(cr, bg_color[0], bg_color[1], bg_color[2]);
113 int width = cairo_image_surface_get_width(preview->
surface);
114 int height = cairo_image_surface_get_height(preview->
surface);
115 double sx = 1.0, sy = 1.0;
116 cairo_surface_get_device_scale(preview->
surface, &sx, &sy);
117 const double logical_width =
width / sx;
118 const double logical_height =
height / sy;
122 double x_offset = (w - logical_width) / 2. + borders;
123 double y_offset = (h - logical_height) / 2. + borders;
124 cairo_set_source_surface(cr, preview->
surface, x_offset, y_offset);
128 GtkStyleContext *context = gtk_widget_get_style_context(widget);
129 gtk_style_context_get_color(context, gtk_widget_get_state_flags(widget), &im_color);
130 cairo_paint_with_alpha(cr, im_color.alpha);
133 gtk_render_frame(context, cr, borders, borders, w, h);
150 gtk_widget_queue_draw(preview->
area);
157 preview->
imgid = imgid;
163 gchar *
name = g_strdup_printf(_(
"Ansel - Preview : %s"), img->
filename);
165 gtk_window_set_title(GTK_WINDOW(dialog),
name);
168#ifdef GDK_WINDOWING_QUARTZ
170 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ON_PARENT);
173 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_CANCEL);
174 gtk_window_set_modal(GTK_WINDOW(dialog),
FALSE);
176 gtk_window_set_default_size(GTK_WINDOW(dialog), 350, 350);
180 preview->
area = gtk_drawing_area_new();
181 gtk_widget_set_hexpand(preview->
area,
TRUE);
182 gtk_widget_set_vexpand(preview->
area,
TRUE);
183 gtk_widget_set_halign(preview->
area, GTK_ALIGN_FILL);
184 gtk_widget_set_valign(preview->
area, GTK_ALIGN_FILL);
185 gtk_widget_set_size_request(preview->
area, 350, 350);
186 gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), preview->
area,
TRUE,
TRUE, 0);
191 gtk_widget_set_visible(preview->
area,
TRUE);
192 gtk_widget_show_all(dialog);
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)
void dt_control_draw_busy_msg(cairo_t *cr, int width, int height)
void dt_print(dt_debug_thread_t thread, const char *msg,...)
static double dt_get_wtime(void)
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
GtkWidget * dt_ui_main_window(dt_ui_t *ui)
get the main window widget
#define DT_PIXEL_APPLY_DPI(value)
void dt_image_cache_read_release(dt_image_cache_t *cache, const dt_image_t *img)
dt_image_t * dt_image_cache_get(dt_image_cache_t *cache, const int32_t imgid, char mode)
float dt_aligned_pixel_t[4]
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)
@ DT_SIGNAL_DARKROOM_UI_CHANGED
Signal that the darkroom GUI color changed.
#define DT_DEBUG_CONTROL_SIGNAL_CONNECT(ctlsig, signal, cb, user_data)
struct _GtkWidget GtkWidget
struct dt_gui_gtk_t * gui
struct dt_colorspaces_t * color_profiles
struct dt_control_signal_t * signals
struct dt_image_cache_t * image_cache
cmsHTRANSFORM transform_xyz_to_display
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.
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)