static void gimp_display_shell_check_notify_handler (GObject *config, GParamSpec *param_spec, GimpDisplayShell *shell) { GimpCanvasPaddingMode padding_mode; GimpRGB padding_color; if (shell->checkerboard) { cairo_pattern_destroy (shell->checkerboard); shell->checkerboard = NULL; } gimp_display_shell_get_padding (shell, &padding_mode, &padding_color); switch (padding_mode) { case GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK: case GIMP_CANVAS_PADDING_MODE_DARK_CHECK: gimp_display_shell_set_padding (shell, padding_mode, &padding_color); break; default: break; } gimp_display_shell_expose_full (shell); }
static void gimp_display_shell_monitor_res_notify_handler (GObject *config, GParamSpec *param_spec, GimpDisplayShell *shell) { if (GIMP_DISPLAY_CONFIG (config)->monitor_res_from_gdk) { gimp_get_monitor_resolution (gtk_widget_get_screen (GTK_WIDGET (shell)), gimp_widget_get_monitor (GTK_WIDGET (shell)), &shell->monitor_xres, &shell->monitor_yres); } else { shell->monitor_xres = GIMP_DISPLAY_CONFIG (config)->monitor_xres; shell->monitor_yres = GIMP_DISPLAY_CONFIG (config)->monitor_yres; } gimp_display_shell_scale_update (shell); if (! shell->dot_for_dot) { gimp_display_shell_scroll_clamp_and_update (shell); gimp_display_shell_scaled (shell); gimp_display_shell_expose_full (shell); } }
static void gimp_display_shell_quality_notify_handler (GObject *config, GParamSpec *param_spec, GimpDisplayShell *shell) { gimp_display_shell_expose_full (shell); }
/** * gimp_display_shell_scale_resize: * @shell: the #GimpDisplayShell * @resize_window: whether the display window should be resized * @grow_only: whether shrinking of the window is allowed or not * * Function commonly called after a change in display scale to make the changes * visible to the user. If @resize_window is %TRUE then the display window is * resized to accommodate the display image as per * gimp_display_shell_shrink_wrap(). **/ void gimp_display_shell_scale_resize (GimpDisplayShell *shell, gboolean resize_window, gboolean grow_only) { g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); /* freeze the active tool */ gimp_display_shell_pause (shell); if (resize_window) { GimpImageWindow *window = gimp_display_shell_get_window (shell); if (window && gimp_image_window_get_active_shell (window) == shell) { gimp_image_window_shrink_wrap (window, grow_only); } } gimp_display_shell_scroll_clamp_and_update (shell); gimp_display_shell_scaled (shell); gimp_display_shell_expose_full (shell); /* re-enable the active tool */ gimp_display_shell_resume (shell); }
/** * gimp_display_shell_scroll_set_offsets: * @shell: * @offset_x: * @offset_y: * * This function scrolls the image in the shell's viewport. It redraws * the entire canvas. * * Use it for setting the scroll offset on freshly scaled images or * when the window is resized. For panning, use * gimp_display_shell_scroll(). **/ void gimp_display_shell_scroll_set_offset (GimpDisplayShell *shell, gint offset_x, gint offset_y) { g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); if (shell->offset_x == offset_x && shell->offset_y == offset_y) return; gimp_display_shell_scale_save_revert_values (shell); /* freeze the active tool */ gimp_display_shell_pause (shell); shell->offset_x = offset_x; shell->offset_y = offset_y; gimp_display_shell_scroll_clamp_and_update (shell); gimp_display_shell_scrolled (shell); gimp_display_shell_expose_full (shell); /* re-enable the active tool */ gimp_display_shell_resume (shell); }
static void gimp_display_shell_color_config_notify_handler (GObject *config, GParamSpec *param_spec, GimpDisplayShell *shell) { gimp_display_shell_profile_update (shell); gimp_display_shell_expose_full (shell); }
static gboolean gimp_display_shell_filter_changed_idle (gpointer data) { GimpDisplayShell *shell = data; gimp_display_shell_expose_full (shell); shell->filter_idle_id = 0; return FALSE; }
static void gimp_display_shell_size_changed_detailed_handler (GimpImage *image, gint previous_origin_x, gint previous_origin_y, gint previous_width, gint previous_height, GimpDisplayShell *shell) { if (shell->display->config->resize_windows_on_resize) { GimpImageWindow *window = gimp_display_shell_get_window (shell); if (window && gimp_image_window_get_active_shell (window) == shell) { /* If the window is resized just center the image in it when it * has change size */ gimp_image_window_shrink_wrap (window, FALSE); } } else { GimpImage *image = gimp_display_get_image (shell->display); gint new_width = gimp_image_get_width (image); gint new_height = gimp_image_get_height (image); gint scaled_previous_origin_x = SCALEX (shell, previous_origin_x); gint scaled_previous_origin_y = SCALEY (shell, previous_origin_y); gboolean horizontally; gboolean vertically; horizontally = (SCALEX (shell, previous_width) > shell->disp_width && SCALEX (shell, new_width) <= shell->disp_width); vertically = (SCALEY (shell, previous_height) > shell->disp_height && SCALEY (shell, new_height) <= shell->disp_height); gimp_display_shell_scroll_set_offset (shell, shell->offset_x + scaled_previous_origin_x, shell->offset_y + scaled_previous_origin_y); gimp_display_shell_scroll_center_image (shell, horizontally, vertically); /* The above calls might not lead to a call to * gimp_display_shell_scroll_clamp_and_update() in all cases we * need it to be called, so simply call it explicitly here at * the end */ gimp_display_shell_scroll_clamp_and_update (shell); gimp_display_shell_expose_full (shell); } }
static void gimp_display_shell_grid_notify_handler (GimpGrid *grid, GParamSpec *pspec, GimpDisplayShell *shell) { if (shell->grid_gc) { g_object_unref (shell->grid_gc); shell->grid_gc = NULL; } gimp_display_shell_expose_full (shell); /* update item factory */ gimp_display_flush (shell->display); }
void gimp_display_shell_rotate_to (GimpDisplayShell *shell, gdouble value) { g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); while (value < 0.0) value += 360; while (value >= 360.0) value -= 360; shell->rotate_angle = value; gimp_display_shell_rotated (shell); gimp_display_shell_expose_full (shell); }
static void gimp_display_shell_size_changed_detailed_handler (GimpImage *image, gint previous_origin_x, gint previous_origin_y, gint previous_width, gint previous_height, GimpDisplayShell *shell) { GimpDisplayConfig *config = shell->display->config; gboolean resize_window; /* Resize windows only in multi-window mode */ resize_window = (config->resize_windows_on_resize && ! GIMP_GUI_CONFIG (config)->single_window_mode); if (resize_window) { GimpImageWindow *window = gimp_display_shell_get_window (shell); if (window && gimp_image_window_get_active_shell (window) == shell) { /* If the window is resized just center the image in it when it * has change size */ gimp_image_window_shrink_wrap (window, FALSE); } } else { GimpImage *image = gimp_display_get_image (shell->display); gint new_width = gimp_image_get_width (image); gint new_height = gimp_image_get_height (image); gint scaled_previous_origin_x; gint scaled_previous_origin_y; gboolean horizontally; gboolean vertically; scaled_previous_origin_x = SCALEX (shell, previous_origin_x); scaled_previous_origin_y = SCALEY (shell, previous_origin_y); horizontally = (SCALEX (shell, previous_width) > shell->disp_width && SCALEX (shell, new_width) <= shell->disp_width); vertically = (SCALEY (shell, previous_height) > shell->disp_height && SCALEY (shell, new_height) <= shell->disp_height); gimp_display_shell_scroll_set_offset (shell, shell->offset_x + scaled_previous_origin_x, shell->offset_y + scaled_previous_origin_y); gimp_display_shell_scroll_center_image (shell, horizontally, vertically); /* The above calls might not lead to a call to * gimp_display_shell_scroll_clamp_and_update() and * gimp_display_shell_expose_full() in all cases because when * scaling the old and new scroll offset might be the same. * * We need them to be called in all cases, so simply call them * explicitly here at the end */ gimp_display_shell_scroll_clamp_and_update (shell); gimp_display_shell_expose_full (shell); } }