Store the zoom factor as float, not as a ratio.
2004-01-29 Simon Budig <simon@gimp.org> * app/display/gimpdisplayshell.[ch]: Store the zoom factor as float, not as a ratio. * app/display/gimpdisplayshell-scale.[ch]: change the API to expose the Float instead a weirdly encoded integer. Implement functions to get a ratio from the scale factor. Implement a set as presets as discussed on the mailinglist. Changed Zoom->Other dialog to enable entering a float. * app/display/gimpdisplayshell-title.c * app/display/gimpnavigationview.c * app/gui/image-menu.c * app/gui/info-window.c * app/tools/gimpmagnifytool.c: changed accordingly. * app/core/gimp.[ch] * app/display/gimpdisplay.[ch] * app/gui/gui-vtable.c * app/widgets/widgets-enums.h: Made the various display-creating functions accept a float for the scale. Introduce a new GimpZoomType: GIMP_ZOOM_TO. Generally adjust the API to use floats instead of weird integers. * app/core/gimp-edit.c * app/core/gimptemplate.c * app/display/gimpdisplayshell-callbacks.c * app/file/file-open.c * app/gui/image-commands.c * app/gui/view-commands.[ch] * tools/pdbgen/pdb/display.pdb * app/widgets/gimpimageview.c * app/widgets/gimptoolbox-dnd.c: changed accordingly * app/pdb/display_cmds.c: regenerated
This commit is contained in:
@ -33,15 +33,11 @@
|
||||
#define SCREEN_YRES(s) (s->dot_for_dot ? \
|
||||
s->gdisp->gimage->yresolution : s->monitor_yres)
|
||||
|
||||
/* unpacking the user scale level (char) */
|
||||
#define SCALESRC(s) (s->scale & 0x00ff)
|
||||
#define SCALEDEST(s) (s->scale >> 8)
|
||||
|
||||
/* calculate scale factors (double) */
|
||||
#define SCALEFACTOR_X(s) ((SCALEDEST(s) * SCREEN_XRES(s)) / \
|
||||
(SCALESRC(s) * s->gdisp->gimage->xresolution))
|
||||
#define SCALEFACTOR_Y(s) ((SCALEDEST(s) * SCREEN_YRES(s)) / \
|
||||
(SCALESRC(s) * s->gdisp->gimage->yresolution))
|
||||
#define SCALEFACTOR_X(s) (s->scale * SCREEN_XRES(s) / \
|
||||
s->gdisp->gimage->xresolution)
|
||||
#define SCALEFACTOR_Y(s) (s->scale * SCREEN_YRES(s) / \
|
||||
s->gdisp->gimage->yresolution)
|
||||
|
||||
/* scale values */
|
||||
#define SCALEX(s,x) ((gint) (x * SCALEFACTOR_X(s)))
|
||||
@ -78,8 +74,8 @@ struct _GimpDisplayShell
|
||||
gdouble monitor_xres;
|
||||
gdouble monitor_yres;
|
||||
|
||||
gint scale; /* scale factor from original raw image */
|
||||
gint other_scale; /* scale factor entered in Zoom->Other */
|
||||
gdouble scale; /* scale factor from original raw image */
|
||||
gdouble other_scale; /* scale factor entered in Zoom->Other */
|
||||
gboolean dot_for_dot; /* is monitor resolution being ignored? */
|
||||
|
||||
gint offset_x; /* offset of display image into raw image */
|
||||
@ -174,7 +170,7 @@ struct _GimpDisplayShellClass
|
||||
GType gimp_display_shell_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_display_shell_new (GimpDisplay *gdisp,
|
||||
guint scale,
|
||||
gdouble scale,
|
||||
GimpMenuFactory *menu_factory,
|
||||
GimpItemFactory *popup_factory);
|
||||
|
||||
|
Reference in New Issue
Block a user