app: move gimp_display_shell_scale_changed() to gimpdisplayshell-scale.[ch]

and rename it to gimp_display_shell_scale_update().
This commit is contained in:
Michael Natterer 2016-01-05 18:48:22 +01:00
parent b0ce294f8f
commit 095eea6532
6 changed files with 39 additions and 38 deletions

View File

@ -563,7 +563,7 @@ static void
gimp_display_shell_resolution_changed_handler (GimpImage *image,
GimpDisplayShell *shell)
{
gimp_display_shell_scale_changed (shell);
gimp_display_shell_scale_update (shell);
if (shell->dot_for_dot)
{
@ -990,7 +990,7 @@ gimp_display_shell_monitor_res_notify_handler (GObject *config,
shell->monitor_yres = GIMP_DISPLAY_CONFIG (config)->monitor_yres;
}
gimp_display_shell_scale_changed (shell);
gimp_display_shell_scale_update (shell);
if (! shell->dot_for_dot)
{

View File

@ -158,7 +158,7 @@ gimp_display_shell_scale_set_dot_for_dot (GimpDisplayShell *shell,
shell->dot_for_dot = dot_for_dot;
gimp_display_shell_scale_changed (shell);
gimp_display_shell_scale_update (shell);
gimp_display_shell_scale_resize (shell,
shell->display->config->resize_windows_on_zoom,
@ -190,6 +190,34 @@ gimp_display_shell_scale_get_image_size (GimpDisplayShell *shell,
w, h);
}
/* We used to calculate the scale factor in the SCALEFACTOR_X() and
* SCALEFACTOR_Y() macros. But since these are rather frequently
* called and the values rarely change, we now store them in the
* shell and call this function whenever they need to be recalculated.
*/
void
gimp_display_shell_scale_update (GimpDisplayShell *shell)
{
GimpImage *image;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
image = gimp_display_get_image (shell->display);
if (image)
{
gimp_display_shell_calculate_scale_x_and_y (shell,
gimp_zoom_model_get_factor (shell->zoom),
&shell->scale_x,
&shell->scale_y);
}
else
{
shell->scale_x = 1.0;
shell->scale_y = 1.0;
}
}
/**
* gimp_display_shell_scale:
* @shell: the #GimpDisplayShell

View File

@ -29,6 +29,8 @@ void gimp_display_shell_scale_get_image_size (GimpDisplayShell *sh
gint *w,
gint *h);
void gimp_display_shell_scale_update (GimpDisplayShell *shell);
void gimp_display_shell_scale (GimpDisplayShell *shell,
GimpZoomType zoom_type,
gdouble scale,

View File

@ -361,7 +361,7 @@ gimp_display_shell_init (GimpDisplayShell *shell)
/* zoom model callback */
g_signal_connect_swapped (shell->zoom, "zoomed",
G_CALLBACK (gimp_display_shell_scale_changed),
G_CALLBACK (gimp_display_shell_scale_update),
shell);
/* active display callback */
@ -778,7 +778,7 @@ gimp_display_shell_constructed (GObject *object)
}
/* make sure the information is up-to-date */
gimp_display_shell_scale_changed (shell);
gimp_display_shell_scale_update (shell);
}
static void
@ -1521,7 +1521,7 @@ gimp_display_shell_fill (GimpDisplayShell *shell,
gimp_display_shell_set_unit (shell, unit);
gimp_display_shell_set_initial_scale (shell, scale, NULL, NULL);
gimp_display_shell_scale_changed (shell);
gimp_display_shell_scale_update (shell);
gimp_display_shell_sync_config (shell, shell->display->config);
@ -1550,34 +1550,6 @@ gimp_display_shell_fill (GimpDisplayShell *shell,
NULL);
}
/* We used to calculate the scale factor in the SCALEFACTOR_X() and
* SCALEFACTOR_Y() macros. But since these are rather frequently
* called and the values rarely change, we now store them in the
* shell and call this function whenever they need to be recalculated.
*/
void
gimp_display_shell_scale_changed (GimpDisplayShell *shell)
{
GimpImage *image;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
image = gimp_display_get_image (shell->display);
if (image)
{
gimp_display_shell_calculate_scale_x_and_y (shell,
gimp_zoom_model_get_factor (shell->zoom),
&shell->scale_x,
&shell->scale_y);
}
else
{
shell->scale_x = 1.0;
shell->scale_y = 1.0;
}
}
void
gimp_display_shell_scaled (GimpDisplayShell *shell)
{
@ -1847,7 +1819,7 @@ gimp_display_shell_flush (GimpDisplayShell *shell,
gimp_display_shell_title_update (shell);
/* make sure the information is up-to-date */
gimp_display_shell_scale_changed (shell);
gimp_display_shell_scale_update (shell);
gimp_canvas_layer_boundary_set_layer (GIMP_CANVAS_LAYER_BOUNDARY (shell->layer_boundary),
gimp_image_get_active_layer (gimp_display_get_image (shell->display)));

View File

@ -261,8 +261,6 @@ void gimp_display_shell_fill (GimpDisplayShell *shell,
GimpUnit unit,
gdouble scale);
void gimp_display_shell_scale_changed (GimpDisplayShell *shell);
void gimp_display_shell_scaled (GimpDisplayShell *shell);
void gimp_display_shell_scrolled (GimpDisplayShell *shell);
void gimp_display_shell_rotated (GimpDisplayShell *shell);

View File

@ -56,6 +56,7 @@
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-appearance.h"
#include "gimpdisplayshell-close.h"
#include "gimpdisplayshell-scale.h"
#include "gimpdisplayshell-scroll.h"
#include "gimpdisplayshell-tool-events.h"
#include "gimpdisplayshell-transform.h"
@ -777,7 +778,7 @@ gimp_image_window_monitor_changed (GimpWindow *window,
gtk_widget_get_screen (list->data));
/* make it fetch the new monitor's resolution */
gimp_display_shell_scale_changed (GIMP_DISPLAY_SHELL (list->data));
gimp_display_shell_scale_update (GIMP_DISPLAY_SHELL (list->data));
/* make it fetch the right monitor profile */
gimp_color_managed_profile_changed (GIMP_COLOR_MANAGED (list->data));