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):
|
||||
don't suggest Shift when a new point cannot be added to point 0.
|
||||
|
|
|
@ -150,6 +150,12 @@ static PSLoadVals plvals =
|
|||
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 */
|
||||
typedef struct
|
||||
|
@ -267,11 +273,14 @@ static void dither_grey (const guchar *grey,
|
|||
|
||||
/* Dialog-handling */
|
||||
|
||||
static gint32 count_ps_pages (const gchar *filename);
|
||||
static gboolean load_dialog (const gchar *filename,
|
||||
gboolean loadPDF);
|
||||
static void load_pages_entry_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static gint32 count_ps_pages (const gchar *filename);
|
||||
static gboolean load_dialog (const gchar *filename,
|
||||
gboolean loadPDF);
|
||||
static void load_pages_entry_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
static gboolean resolution_change_callback (GtkAdjustment *adjustment,
|
||||
gpointer data);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -3099,24 +3108,33 @@ load_dialog (const gchar *filename,
|
|||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
||||
_("Resolution:"), 0.0, 0.5,
|
||||
spinbutton, 1, FALSE);
|
||||
|
||||
g_signal_connect (adj, "value-changed",
|
||||
G_CALLBACK (resolution_change_callback),
|
||||
&plvals.resolution);
|
||||
|
||||
g_signal_connect (adj, "value-changed",
|
||||
G_CALLBACK (gimp_int_adjustment_update),
|
||||
&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,
|
||||
_("_Width:"), 0.0, 0.5,
|
||||
spinbutton, 1, FALSE);
|
||||
ps_width_spinbutton, 1, FALSE);
|
||||
g_signal_connect (adj, "value-changed",
|
||||
G_CALLBACK (gimp_int_adjustment_update),
|
||||
&plvals.width);
|
||||
|
||||
spinbutton = gimp_spin_button_new (&adj, plvals.height,
|
||||
1, GIMP_MAX_IMAGE_SIZE, 1, 10, 0, 1, 0);
|
||||
ps_height_spinbutton = gimp_spin_button_new (&adj, plvals.height,
|
||||
1, GIMP_MAX_IMAGE_SIZE,
|
||||
1, 10, 0, 1, 0);
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
|
||||
_("_Height:"), 0.0, 0.5,
|
||||
spinbutton, 1, FALSE);
|
||||
ps_height_spinbutton, 1, FALSE);
|
||||
g_signal_connect (adj, "value-changed",
|
||||
G_CALLBACK (gimp_int_adjustment_update),
|
||||
&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