mirror of https://github.com/GNOME/gimp.git
some more code cleanup.
2003-05-05 Michael Natterer <mitch@gimp.org> * app/display/gimpdisplayshell-scale.c: some more code cleanup.
This commit is contained in:
parent
1204865d04
commit
f1d317a302
|
@ -1,3 +1,7 @@
|
|||
2003-05-05 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/display/gimpdisplayshell-scale.c: some more code cleanup.
|
||||
|
||||
2003-05-05 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/display/gimpdisplayshell-scale.[ch]
|
||||
|
|
|
@ -48,12 +48,22 @@
|
|||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
typedef struct _ScaleDialogData ScaleDialogData;
|
||||
|
||||
struct _ScaleDialogData
|
||||
{
|
||||
GimpDisplayShell *shell;
|
||||
GtkObject *src_adj;
|
||||
GtkObject *dest_adj;
|
||||
};
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_display_shell_scale_dialog_ok (GtkWidget *widget,
|
||||
gpointer data);
|
||||
ScaleDialogData *dialog);
|
||||
static void gimp_display_shell_scale_dialog_cancel (GtkWidget *widget,
|
||||
gpointer data);
|
||||
ScaleDialogData *dialog);
|
||||
|
||||
static gdouble img2real (GimpDisplayShell *shell,
|
||||
gboolean xdir,
|
||||
|
@ -345,8 +355,6 @@ gimp_display_shell_scale_fit (GimpDisplayShell *shell)
|
|||
GimpImage *gimage;
|
||||
gint image_width;
|
||||
gint image_height;
|
||||
gdouble zoom_x;
|
||||
gdouble zoom_y;
|
||||
gdouble zoom_factor;
|
||||
gint scalesrc;
|
||||
gint scaledest;
|
||||
|
@ -368,13 +376,8 @@ gimp_display_shell_scale_fit (GimpDisplayShell *shell)
|
|||
config->monitor_yres / gimage->yresolution);
|
||||
}
|
||||
|
||||
zoom_x = (gdouble) shell->disp_width / (gdouble) image_width;
|
||||
zoom_y = (gdouble) shell->disp_height / (gdouble) image_height;
|
||||
|
||||
if ((gdouble) image_height * zoom_x <= (gdouble) shell->disp_height)
|
||||
zoom_factor = zoom_x;
|
||||
else
|
||||
zoom_factor = zoom_y;
|
||||
zoom_factor = MIN ((gdouble) shell->disp_width / (gdouble) image_width,
|
||||
(gdouble) shell->disp_height / (gdouble) image_height);
|
||||
|
||||
gimp_display_shell_scale_calc_fraction (zoom_factor,
|
||||
&scalesrc, &scaledest);
|
||||
|
@ -448,14 +451,6 @@ gimp_display_shell_scale_resize (GimpDisplayShell *shell,
|
|||
tool_manager_control_active (gimp, RESUME, shell->gdisp);
|
||||
}
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GimpDisplayShell *shell;
|
||||
GtkObject *src_adj;
|
||||
GtkObject *dest_adj;
|
||||
} ScaleDialogData;
|
||||
|
||||
void
|
||||
gimp_display_shell_scale_dialog (GimpDisplayShell *shell)
|
||||
{
|
||||
|
@ -483,10 +478,12 @@ gimp_display_shell_scale_dialog (GimpDisplayShell *shell)
|
|||
gimp_standard_help_func,
|
||||
"dialogs/display_scale.html",
|
||||
|
||||
GTK_STOCK_CANCEL, gimp_display_shell_scale_dialog_cancel,
|
||||
GTK_STOCK_CANCEL,
|
||||
gimp_display_shell_scale_dialog_cancel,
|
||||
data, NULL, NULL, FALSE, TRUE,
|
||||
|
||||
GTK_STOCK_OK, gimp_display_shell_scale_dialog_ok,
|
||||
GTK_STOCK_OK,
|
||||
gimp_display_shell_scale_dialog_ok,
|
||||
data, NULL, NULL, TRUE, FALSE,
|
||||
|
||||
NULL);
|
||||
|
@ -537,10 +534,8 @@ gimp_display_shell_scale_dialog (GimpDisplayShell *shell)
|
|||
|
||||
static void
|
||||
gimp_display_shell_scale_dialog_ok (GtkWidget *widget,
|
||||
gpointer data)
|
||||
ScaleDialogData *dialog)
|
||||
{
|
||||
ScaleDialogData *dialog = (ScaleDialogData *) data;
|
||||
|
||||
gint scale_src;
|
||||
gint scale_dest;
|
||||
|
||||
|
@ -555,10 +550,8 @@ gimp_display_shell_scale_dialog_ok (GtkWidget *widget,
|
|||
|
||||
static void
|
||||
gimp_display_shell_scale_dialog_cancel (GtkWidget *widget,
|
||||
gpointer data)
|
||||
ScaleDialogData *dialog)
|
||||
{
|
||||
ScaleDialogData *dialog = (ScaleDialogData *) data;
|
||||
|
||||
/* need to emit "scaled" to get the menu updated */
|
||||
gimp_display_shell_scaled (dialog->shell);
|
||||
dialog->shell->other_scale |= (1 << 30);
|
||||
|
|
Loading…
Reference in New Issue