mirror of https://github.com/GNOME/gimp.git
add callback to resolution changes in the postscipt load dialog to update
2007-03-01 João S. O. Bueno Calligaris <gwidon@mpc.com.br> * plug-ins/common/postscript.c: add callback to resolution changes in the postscipt load dialog to update the image size in pixels. svn path=/trunk/; revision=22035
This commit is contained in:
parent
39c3a4e80b
commit
4fb0b2a5bf
|
@ -1,4 +1,10 @@
|
||||||
2007-02-29 Raphaël Quinet <raphael@gimp.org>
|
2007-03-01 João S. O. Bueno Calligaris <gwidon@mpc.com.br>
|
||||||
|
|
||||||
|
* plug-ins/common/postscript.c: add callback to resolution
|
||||||
|
changes in the postscipt load dialog to update the image size
|
||||||
|
in pixels.
|
||||||
|
|
||||||
|
2007-03-01 Raphaël Quinet <raphael@gimp.org>
|
||||||
|
|
||||||
* app/tools/gimpmeasuretool.c (gimp_measure_tool_cursor_update):
|
* app/tools/gimpmeasuretool.c (gimp_measure_tool_cursor_update):
|
||||||
don't suggest Shift when a new point cannot be added to point 0.
|
don't suggest Shift when a new point cannot be added to point 0.
|
||||||
|
|
|
@ -130,7 +130,7 @@ static char dversio[] = "v1.17 19-Sep-2004";
|
||||||
/* Load info */
|
/* Load info */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
guint resolution; /* resolution (dpi) at which to run ghostscript */
|
guint resolution; /* resolution (dpi) at which to run ghostscript */
|
||||||
guint width, height; /* desired size (ghostscript may ignore this) */
|
guint width, height; /* desired size (ghostscript may ignore this) */
|
||||||
gint use_bbox; /* 0: use width/height, 1: try to use BoundingBox */
|
gint use_bbox; /* 0: use width/height, 1: try to use BoundingBox */
|
||||||
gchar pages[STR_LENGTH]; /* Pages to load (eg.: 1,3,5-7) */
|
gchar pages[STR_LENGTH]; /* Pages to load (eg.: 1,3,5-7) */
|
||||||
|
@ -150,7 +150,13 @@ static PSLoadVals plvals =
|
||||||
1 /* dont use graphics antialiasing */
|
1 /* dont use graphics antialiasing */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Widgets for width and height of postscript image to
|
||||||
|
* be loaded, so that they can be updated when desired resolution is
|
||||||
|
* changed
|
||||||
|
*/
|
||||||
|
GtkWidget *ps_width_spinbutton;
|
||||||
|
GtkWidget *ps_height_spinbutton;
|
||||||
|
|
||||||
/* Save info */
|
/* Save info */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -267,11 +273,14 @@ static void dither_grey (const guchar *grey,
|
||||||
|
|
||||||
/* Dialog-handling */
|
/* Dialog-handling */
|
||||||
|
|
||||||
static gint32 count_ps_pages (const gchar *filename);
|
static gint32 count_ps_pages (const gchar *filename);
|
||||||
static gboolean load_dialog (const gchar *filename,
|
static gboolean load_dialog (const gchar *filename,
|
||||||
gboolean loadPDF);
|
gboolean loadPDF);
|
||||||
static void load_pages_entry_callback (GtkWidget *widget,
|
static void load_pages_entry_callback (GtkWidget *widget,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
|
static gboolean resolution_change_callback (GtkAdjustment *adjustment,
|
||||||
|
gpointer data);
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -3099,24 +3108,33 @@ load_dialog (const gchar *filename,
|
||||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
||||||
_("Resolution:"), 0.0, 0.5,
|
_("Resolution:"), 0.0, 0.5,
|
||||||
spinbutton, 1, FALSE);
|
spinbutton, 1, FALSE);
|
||||||
|
|
||||||
|
g_signal_connect (adj, "value-changed",
|
||||||
|
G_CALLBACK (resolution_change_callback),
|
||||||
|
&plvals.resolution);
|
||||||
|
|
||||||
g_signal_connect (adj, "value-changed",
|
g_signal_connect (adj, "value-changed",
|
||||||
G_CALLBACK (gimp_int_adjustment_update),
|
G_CALLBACK (gimp_int_adjustment_update),
|
||||||
&plvals.resolution);
|
&plvals.resolution);
|
||||||
|
|
||||||
spinbutton = gimp_spin_button_new (&adj, plvals.width,
|
|
||||||
1, GIMP_MAX_IMAGE_SIZE, 1, 10, 0, 1, 0);
|
|
||||||
|
ps_width_spinbutton = gimp_spin_button_new (&adj, plvals.width,
|
||||||
|
1, GIMP_MAX_IMAGE_SIZE,
|
||||||
|
1, 10, 0, 1, 0);
|
||||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
||||||
_("_Width:"), 0.0, 0.5,
|
_("_Width:"), 0.0, 0.5,
|
||||||
spinbutton, 1, FALSE);
|
ps_width_spinbutton, 1, FALSE);
|
||||||
g_signal_connect (adj, "value-changed",
|
g_signal_connect (adj, "value-changed",
|
||||||
G_CALLBACK (gimp_int_adjustment_update),
|
G_CALLBACK (gimp_int_adjustment_update),
|
||||||
&plvals.width);
|
&plvals.width);
|
||||||
|
|
||||||
spinbutton = gimp_spin_button_new (&adj, plvals.height,
|
ps_height_spinbutton = gimp_spin_button_new (&adj, plvals.height,
|
||||||
1, GIMP_MAX_IMAGE_SIZE, 1, 10, 0, 1, 0);
|
1, GIMP_MAX_IMAGE_SIZE,
|
||||||
|
1, 10, 0, 1, 0);
|
||||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
|
||||||
_("_Height:"), 0.0, 0.5,
|
_("_Height:"), 0.0, 0.5,
|
||||||
spinbutton, 1, FALSE);
|
ps_height_spinbutton, 1, FALSE);
|
||||||
g_signal_connect (adj, "value-changed",
|
g_signal_connect (adj, "value-changed",
|
||||||
G_CALLBACK (gimp_int_adjustment_update),
|
G_CALLBACK (gimp_int_adjustment_update),
|
||||||
&plvals.height);
|
&plvals.height);
|
||||||
|
@ -3496,3 +3514,30 @@ save_unit_toggle_update (GtkWidget *widget,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
resolution_change_callback (GtkAdjustment *adjustment,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
guint *old_resolution = (guint *) data;
|
||||||
|
gdouble ratio;
|
||||||
|
|
||||||
|
if (*old_resolution)
|
||||||
|
{
|
||||||
|
ratio = (gdouble) adjustment->value / *old_resolution;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ratio = 1;
|
||||||
|
}
|
||||||
|
gtk_spin_button_set_value (GTK_SPIN_BUTTON (ps_width_spinbutton),
|
||||||
|
GTK_SPIN_BUTTON (ps_width_spinbutton)->
|
||||||
|
adjustment->value * ratio);
|
||||||
|
|
||||||
|
gtk_spin_button_set_value (GTK_SPIN_BUTTON (ps_height_spinbutton),
|
||||||
|
GTK_SPIN_BUTTON (ps_height_spinbutton)->
|
||||||
|
adjustment->value * ratio);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue