added more values to the GimpZoomType enum.
2005-09-25 Sven Neumann <sven@gimp.org> * libgimpwidgets/gimpwidgetsenums.h: added more values to the GimpZoomType enum. * libgimpwidgets/gimpzoommodel.c (gimp_zoom_model_zoom_step): handle the new enum values. * app/actions/view-commands.c (view_zoom_cmd_callback) use the new values. * app/display/gimpdisplayshell.c (gimp_display_shell_new): cosmetics.
This commit is contained in:

committed by
Sven Neumann

parent
8d60ac2f40
commit
13ebb1ca2b
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
||||
2005-09-25 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* libgimpwidgets/gimpwidgetsenums.h: added more values to the
|
||||
GimpZoomType enum.
|
||||
|
||||
* libgimpwidgets/gimpzoommodel.c (gimp_zoom_model_zoom_step):
|
||||
handle the new enum values.
|
||||
|
||||
* app/actions/view-commands.c (view_zoom_cmd_callback) use the new
|
||||
values.
|
||||
|
||||
* app/display/gimpdisplayshell.c (gimp_display_shell_new): cosmetics.
|
||||
|
||||
2005-09-25 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* libgimpwidgets/gimpzoommodel.[ch]: minor cleanup, documentation.
|
||||
|
@ -135,11 +135,11 @@ view_zoom_cmd_callback (GtkAction *action,
|
||||
switch ((GimpActionSelectType) value)
|
||||
{
|
||||
case GIMP_ACTION_SELECT_FIRST:
|
||||
gimp_display_shell_scale (shell, GIMP_ZOOM_TO, 1.0 / 256.0);
|
||||
gimp_display_shell_scale (shell, GIMP_ZOOM_OUT_MAX, 0.0);
|
||||
break;
|
||||
|
||||
case GIMP_ACTION_SELECT_LAST:
|
||||
gimp_display_shell_scale (shell, GIMP_ZOOM_TO, 256.0);
|
||||
gimp_display_shell_scale (shell, GIMP_ZOOM_IN_MAX, 0.0);
|
||||
break;
|
||||
|
||||
case GIMP_ACTION_SELECT_PREVIOUS:
|
||||
@ -151,17 +151,11 @@ view_zoom_cmd_callback (GtkAction *action,
|
||||
break;
|
||||
|
||||
case GIMP_ACTION_SELECT_SKIP_PREVIOUS:
|
||||
scale = gimp_zoom_model_zoom_step (GIMP_ZOOM_OUT, scale);
|
||||
scale = gimp_zoom_model_zoom_step (GIMP_ZOOM_OUT, scale);
|
||||
scale = gimp_zoom_model_zoom_step (GIMP_ZOOM_OUT, scale);
|
||||
gimp_display_shell_scale (shell, GIMP_ZOOM_TO, scale);
|
||||
gimp_display_shell_scale (shell, GIMP_ZOOM_OUT_MORE, 0.0);
|
||||
break;
|
||||
|
||||
case GIMP_ACTION_SELECT_SKIP_NEXT:
|
||||
scale = gimp_zoom_model_zoom_step (GIMP_ZOOM_IN, scale);
|
||||
scale = gimp_zoom_model_zoom_step (GIMP_ZOOM_IN, scale);
|
||||
scale = gimp_zoom_model_zoom_step (GIMP_ZOOM_IN, scale);
|
||||
gimp_display_shell_scale (shell, GIMP_ZOOM_TO, scale);
|
||||
gimp_display_shell_scale (shell, GIMP_ZOOM_IN_MORE, 0.0);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -650,13 +650,11 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
||||
new_scale = shell->scale * MIN (((gdouble) s_height) / n_height,
|
||||
((gdouble) s_width) / n_width);
|
||||
|
||||
new_scale = gimp_zoom_model_zoom_step (GIMP_ZOOM_OUT,
|
||||
new_scale);
|
||||
new_scale = gimp_zoom_model_zoom_step (GIMP_ZOOM_OUT, new_scale);
|
||||
|
||||
/* since zooming out might skip a zoom step we zoom in again
|
||||
* and test if we are small enough. */
|
||||
shell->scale = gimp_zoom_model_zoom_step (GIMP_ZOOM_IN,
|
||||
new_scale);
|
||||
shell->scale = gimp_zoom_model_zoom_step (GIMP_ZOOM_IN, new_scale);
|
||||
|
||||
if (SCALEX (shell, image_width) > s_width ||
|
||||
SCALEY (shell, image_height) > s_height)
|
||||
|
@ -106,9 +106,13 @@ GType gimp_zoom_type_get_type (void) G_GNUC_CONST;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_ZOOM_IN, /*< desc="Zoom in" >*/
|
||||
GIMP_ZOOM_OUT, /*< desc="Zoom out" >*/
|
||||
GIMP_ZOOM_TO /*< skip >*/
|
||||
GIMP_ZOOM_IN, /*< desc="Zoom in" >*/
|
||||
GIMP_ZOOM_OUT, /*< desc="Zoom out" >*/
|
||||
GIMP_ZOOM_IN_MORE, /*< skip >*/
|
||||
GIMP_ZOOM_OUT_MORE, /*< skip >*/
|
||||
GIMP_ZOOM_IN_MAX, /*< skip >*/
|
||||
GIMP_ZOOM_OUT_MAX, /*< skip >*/
|
||||
GIMP_ZOOM_TO /*< skip >*/
|
||||
} GimpZoomType;
|
||||
|
||||
|
||||
|
@ -31,6 +31,9 @@
|
||||
#include "gimpzoommodel.h"
|
||||
|
||||
|
||||
#define ZOOM_MIN (1.0 / 256.0)
|
||||
#define ZOOM_MAX (256.0)
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
@ -77,21 +80,20 @@ gimp_zoom_model_class_init (GimpZoomModelClass *klass)
|
||||
g_object_class_install_property (object_class, PROP_VALUE,
|
||||
g_param_spec_double ("value",
|
||||
"Value", NULL,
|
||||
1.0 / 256.0, 256.0,
|
||||
ZOOM_MIN, ZOOM_MAX,
|
||||
1.0,
|
||||
G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
|
||||
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (object_class, PROP_MINIMUM,
|
||||
g_param_spec_double ("minimum",
|
||||
"Minimum", NULL,
|
||||
1.0 / 256.0, 256.0,
|
||||
1.0 / 256.0,
|
||||
ZOOM_MIN, ZOOM_MAX,
|
||||
ZOOM_MIN,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (object_class, PROP_MAXIMUM,
|
||||
g_param_spec_double ("maximum",
|
||||
"Maximum", NULL,
|
||||
1.0 / 256.0, 256.0,
|
||||
256.0,
|
||||
ZOOM_MIN, ZOOM_MAX,
|
||||
ZOOM_MAX,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_FRACTION,
|
||||
@ -216,8 +218,9 @@ gimp_zoom_model_zoom_in (GimpZoomModel *model)
|
||||
|
||||
if (priv->value < priv->maximum);
|
||||
{
|
||||
priv->value = gimp_zoom_model_zoom_step (GIMP_ZOOM_IN,
|
||||
priv->value);
|
||||
gdouble scale = gimp_zoom_model_zoom_step (GIMP_ZOOM_IN, priv->value);
|
||||
|
||||
priv->value = CLAMP (scale, priv->minimum, priv->maximum);
|
||||
|
||||
g_object_notify (G_OBJECT (model), "value");
|
||||
g_object_notify (G_OBJECT (model), "fraction");
|
||||
@ -234,8 +237,10 @@ gimp_zoom_model_zoom_out (GimpZoomModel *model)
|
||||
|
||||
if (priv->value > priv->minimum)
|
||||
{
|
||||
priv->value = gimp_zoom_model_zoom_step (GIMP_ZOOM_OUT,
|
||||
priv->value);
|
||||
gdouble scale = gimp_zoom_model_zoom_step (GIMP_ZOOM_OUT, priv->value);
|
||||
|
||||
priv->value = CLAMP (scale, priv->minimum, priv->maximum);
|
||||
|
||||
g_object_notify (G_OBJECT (model), "value");
|
||||
g_object_notify (G_OBJECT (model), "fraction");
|
||||
g_object_notify (G_OBJECT (model), "percentage");
|
||||
@ -274,8 +279,8 @@ gimp_zoom_model_set_range (GimpZoomModel *model,
|
||||
gdouble max)
|
||||
{
|
||||
g_return_if_fail (min < max);
|
||||
g_return_if_fail (min >= 1.0 / 256.0);
|
||||
g_return_if_fail (max <= 256.0);
|
||||
g_return_if_fail (min >= ZOOM_MIN);
|
||||
g_return_if_fail (max <= ZOOM_MAX);
|
||||
|
||||
g_object_set (model,
|
||||
"minimum", min,
|
||||
@ -443,7 +448,7 @@ gimp_zoom_model_get_fraction (gdouble zoom_factor,
|
||||
/**
|
||||
* gimp_zoom_model_zoom_step:
|
||||
* @zoom_type:
|
||||
* @scale:
|
||||
* @scale: ignored unless @zoom_type == %GIMP_ZOOM_TO
|
||||
*
|
||||
* Utility function to calculate a new scale factor.
|
||||
*
|
||||
@ -508,12 +513,34 @@ gimp_zoom_model_zoom_step (GimpZoomType zoom_type,
|
||||
|
||||
break;
|
||||
|
||||
case GIMP_ZOOM_IN_MORE:
|
||||
scale = gimp_zoom_model_zoom_step (GIMP_ZOOM_IN, scale);
|
||||
scale = gimp_zoom_model_zoom_step (GIMP_ZOOM_IN, scale);
|
||||
scale = gimp_zoom_model_zoom_step (GIMP_ZOOM_IN, scale);
|
||||
new_scale = scale;
|
||||
break;
|
||||
|
||||
case GIMP_ZOOM_OUT_MORE:
|
||||
scale = gimp_zoom_model_zoom_step (GIMP_ZOOM_IN, scale);
|
||||
scale = gimp_zoom_model_zoom_step (GIMP_ZOOM_IN, scale);
|
||||
scale = gimp_zoom_model_zoom_step (GIMP_ZOOM_IN, scale);
|
||||
new_scale = scale;
|
||||
break;
|
||||
|
||||
case GIMP_ZOOM_IN_MAX:
|
||||
new_scale = ZOOM_MAX;
|
||||
break;
|
||||
|
||||
case GIMP_ZOOM_OUT_MAX:
|
||||
new_scale = ZOOM_MIN;
|
||||
break;
|
||||
|
||||
case GIMP_ZOOM_TO:
|
||||
new_scale = scale;
|
||||
break;
|
||||
}
|
||||
|
||||
return CLAMP (new_scale, 1.0/256.0, 256.0);
|
||||
return CLAMP (new_scale, ZOOM_MIN, ZOOM_MAX);
|
||||
|
||||
#undef ZOOM_MIN_STEP
|
||||
}
|
||||
|
Reference in New Issue
Block a user