Commit ccfeb254 authored by GMT 1998  Austin Donnelly's avatar GMT 1998 Austin Donnelly Committed by Austin Donnelly
Browse files

app/commands.[ch] app/edit_selection.c app/gdisplay.[ch]

Sat Dec  5 21:31:57 GMT 1998  Austin Donnelly  <austin@greenend.org.uk>

	* app/commands.[ch]
	* app/edit_selection.c
	* app/gdisplay.[ch]
	* app/gdisplay_ops.[ch]
	* app/image_render.c
	* app/info_window.c
	* app/magnify.c
	* app/menus.c
	* app/scale.c: image rendering now happens with float scale
	factors, independent in X and Y axes.  Turning on dot-for-dot in view
	menu does what gimp always used to do (ie one image pixel becomes
	one monitor pixel).  Dot-for-dot is on by default so people
	shouldn't notice any difference unless they load an image that's
	not at 72 dpi and also turn off dot-for-dot.

	* app/app_procs.c
	* app/gimprc.[ch]
	* app/preferences_dialog.c: new gimprc options
	(monitor-xresolution <float>) and corresponding
 	(monitor-yresolution <float>).  Uglyness in preferences dialog to
	add a "Monitor" page to the notebook, allowing user to set their
	monitor's resolution or take it from the X server instead.  This
	badly needs cleaned up :(

	* plug-ins/newsprint/newsprint.c: oops - this hasn't been working
	for grayscale images since my last checkin.  Now fixed.
parent 7a0ad460
......@@ -419,6 +419,17 @@ select_save_cmd_callback (GtkWidget *widget,
gdisplays_flush ();
}
void
view_dot_for_dot_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
gdisp = gdisplay_active ();
gdisplay_set_dot_for_dot (gdisp, GTK_CHECK_MENU_ITEM (widget)->active);
}
void
view_zoomin_cmd_callback (GtkWidget *widget,
gpointer client_data)
......
......@@ -37,6 +37,7 @@ void select_grow_cmd_callback (GtkWidget *, gpointer);
void select_shrink_cmd_callback (GtkWidget *, gpointer);
void select_by_color_cmd_callback (GtkWidget *, gpointer);
void select_save_cmd_callback (GtkWidget *, gpointer);
void view_dot_for_dot_callback (GtkWidget *, gpointer);
void view_zoomin_cmd_callback (GtkWidget *, gpointer);
void view_zoomout_cmd_callback (GtkWidget *, gpointer);
void view_zoom_16_1_callback (GtkWidget *, gpointer);
......
......@@ -34,6 +34,7 @@
#include "curves.h"
#include "devices.h"
#include "gdisplay.h"
#include "gdisplay_ops.h"
#include "colormaps.h"
#include "errorconsole.h"
#include "fileops.h"
......@@ -488,6 +489,13 @@ app_init (void)
if (always_restore_session)
restore_session = TRUE;
/* make sure the monitor resolution is valid */
if (monitor_xres < 1e-5 || monitor_yres < 1e-5)
{
gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
using_xserver_resolution = TRUE;
}
/* Now we are ready to draw the splash-screen-image to the start-up window */
if (no_interface == FALSE)
{
......
......@@ -419,6 +419,17 @@ select_save_cmd_callback (GtkWidget *widget,
gdisplays_flush ();
}
void
view_dot_for_dot_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
gdisp = gdisplay_active ();
gdisplay_set_dot_for_dot (gdisp, GTK_CHECK_MENU_ITEM (widget)->active);
}
void
view_zoomin_cmd_callback (GtkWidget *widget,
gpointer client_data)
......
......@@ -37,6 +37,7 @@ void select_grow_cmd_callback (GtkWidget *, gpointer);
void select_shrink_cmd_callback (GtkWidget *, gpointer);
void select_by_color_cmd_callback (GtkWidget *, gpointer);
void select_save_cmd_callback (GtkWidget *, gpointer);
void view_dot_for_dot_callback (GtkWidget *, gpointer);
void view_zoomin_cmd_callback (GtkWidget *, gpointer);
void view_zoomout_cmd_callback (GtkWidget *, gpointer);
void view_zoom_16_1_callback (GtkWidget *, gpointer);
......
......@@ -100,6 +100,7 @@ gdisplay_new (GimpImage *gimage,
gdisp->offset_x = gdisp->offset_y = 0;
gdisp->scale = scale;
gdisp->dot_for_dot = TRUE;
gdisp->gimage = gimage;
gdisp->window_info_dialog = NULL;
gdisp->depth = g_visual->depth;
......@@ -686,7 +687,7 @@ gdisplay_find_guide (GDisplay *gdisp,
{
GList *tmp_list;
Guide *guide;
double scale;
double scalex, scaley;
int offset_x, offset_y;
int pos;
......@@ -694,7 +695,8 @@ gdisplay_find_guide (GDisplay *gdisp,
{
offset_x = gdisp->offset_x - gdisp->disp_xoffset;
offset_y = gdisp->offset_y - gdisp->disp_yoffset;
scale = (SCALESRC (gdisp) == 1) ? SCALEDEST (gdisp) : 1.0 / SCALESRC (gdisp);
scalex = SCALEFACTOR_X (gdisp);
scaley = SCALEFACTOR_Y (gdisp);
tmp_list = gdisp->gimage->guides;
while (tmp_list)
......@@ -705,14 +707,14 @@ gdisplay_find_guide (GDisplay *gdisp,
switch (guide->orientation)
{
case HORIZONTAL_GUIDE:
pos = (int) (scale * guide->position - offset_y);
pos = (int) (scaley * guide->position - offset_y);
if ((guide->position != -1) &&
(pos > (y - EPSILON)) &&
(pos < (y + EPSILON)))
return guide;
break;
case VERTICAL_GUIDE:
pos = (int) (scale * guide->position - offset_x);
pos = (int) (scalex * guide->position - offset_x);
if ((guide->position != -1) &&
(pos > (x - EPSILON)) &&
(pos < (x + EPSILON)))
......@@ -734,7 +736,7 @@ gdisplay_snap_point (GDisplay *gdisp,
{
GList *tmp_list;
Guide *guide;
double scale;
double scalex, scaley;
int offset_x, offset_y;
int minhdist, minvdist;
int pos, dist;
......@@ -748,7 +750,8 @@ gdisplay_snap_point (GDisplay *gdisp,
{
offset_x = gdisp->offset_x - gdisp->disp_xoffset;
offset_y = gdisp->offset_y - gdisp->disp_yoffset;
scale = (SCALESRC (gdisp) == 1) ? SCALEDEST (gdisp) : 1.0 / SCALESRC (gdisp);
scalex = SCALEFACTOR_X (gdisp);
scaley = SCALEFACTOR_Y (gdisp);
minhdist = G_MAXINT;
minvdist = G_MAXINT;
......@@ -762,7 +765,7 @@ gdisplay_snap_point (GDisplay *gdisp,
switch (guide->orientation)
{
case HORIZONTAL_GUIDE:
pos = (int) (scale * guide->position - offset_y);
pos = (int) (scaley * guide->position - offset_y);
if ((pos > (y - EPSILON)) &&
(pos < (y + EPSILON)))
{
......@@ -777,7 +780,7 @@ gdisplay_snap_point (GDisplay *gdisp,
}
break;
case VERTICAL_GUIDE:
pos = (int) (scale * guide->position - offset_x);
pos = (int) (scalex * guide->position - offset_x);
if ((pos > (x - EPSILON)) &&
(pos < (x + EPSILON)))
{
......@@ -909,6 +912,19 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y)
gdisplay_flush (gdisp);
}
void
gdisplay_set_dot_for_dot (GDisplay *gdisp, int value)
{
if (value != gdisp->dot_for_dot)
{
gdisp->dot_for_dot = value;
resize_display (gdisp, allow_resize_windows, TRUE);
}
}
void
gdisplay_resize_cursor_label (GDisplay *gdisp)
{
......@@ -1016,8 +1032,8 @@ gdisplay_display_area (GDisplay *gdisp,
int dx, dy;
int i, j;
sx = SCALE (gdisp, gdisp->gimage->width);
sy = SCALE (gdisp, gdisp->gimage->height);
sx = SCALEX (gdisp, gdisp->gimage->width);
sy = SCALEY (gdisp, gdisp->gimage->height);
/* Bounds check */
x1 = BOUNDS (x, 0, gdisp->disp_width);
......@@ -1157,12 +1173,13 @@ gdisplay_transform_coords (GDisplay *gdisp,
int *ny,
int use_offsets)
{
double scale;
double scalex;
double scaley;
int offset_x, offset_y;
/* transform from image coordinates to screen coordinates */
scale = (SCALESRC (gdisp) == 1) ? SCALEDEST (gdisp) :
1.0 / SCALESRC (gdisp);
scalex = SCALEFACTOR_X (gdisp);
scaley = SCALEFACTOR_Y (gdisp);
if (use_offsets)
drawable_offsets (gimage_active_drawable (gdisp->gimage), &offset_x, &offset_y);
......@@ -1171,8 +1188,8 @@ gdisplay_transform_coords (GDisplay *gdisp,
offset_x = offset_y = 0;
}
*nx = (int) (scale * (x + offset_x) - gdisp->offset_x);
*ny = (int) (scale * (y + offset_y) - gdisp->offset_y);
*nx = (int) (scalex * (x + offset_x) - gdisp->offset_x);
*ny = (int) (scaley * (y + offset_y) - gdisp->offset_y);
*nx += gdisp->disp_xoffset;
*ny += gdisp->disp_yoffset;
......@@ -1188,15 +1205,16 @@ gdisplay_untransform_coords (GDisplay *gdisp,
int round,
int use_offsets)
{
double scale;
double scalex;
double scaley;
int offset_x, offset_y;
x -= gdisp->disp_xoffset;
y -= gdisp->disp_yoffset;
/* transform from screen coordinates to image coordinates */
scale = (SCALESRC (gdisp) == 1) ? SCALEDEST (gdisp) :
1.0 / SCALESRC (gdisp);
scalex = SCALEFACTOR_X (gdisp);
scaley = SCALEFACTOR_Y (gdisp);
if (use_offsets)
drawable_offsets (gimage_active_drawable (gdisp->gimage), &offset_x, &offset_y);
......@@ -1207,13 +1225,13 @@ gdisplay_untransform_coords (GDisplay *gdisp,
if (round)
{
*nx = ROUND ((x + gdisp->offset_x) / scale - offset_x);
*ny = ROUND ((y + gdisp->offset_y) / scale - offset_y);
*nx = ROUND ((x + gdisp->offset_x) / scalex - offset_x);
*ny = ROUND ((y + gdisp->offset_y) / scaley - offset_y);
}
else
{
*nx = (int) ((x + gdisp->offset_x) / scale - offset_x);
*ny = (int) ((y + gdisp->offset_y) / scale - offset_y);
*nx = (int) ((x + gdisp->offset_x) / scalex - offset_x);
*ny = (int) ((y + gdisp->offset_y) / scaley - offset_y);
}
}
......@@ -1226,12 +1244,13 @@ gdisplay_transform_coords_f (GDisplay *gdisp,
double *ny,
int use_offsets)
{
double scale;
double scalex;
double scaley;
int offset_x, offset_y;
/* transform from gimp coordinates to screen coordinates */
scale = (SCALESRC (gdisp) == 1) ? SCALEDEST (gdisp) :
1.0 / SCALESRC (gdisp);
scalex = SCALEFACTOR_X(gdisp);
scaley = SCALEFACTOR_Y(gdisp);
if (use_offsets)
drawable_offsets (gimage_active_drawable (gdisp->gimage), &offset_x, &offset_y);
......@@ -1240,8 +1259,8 @@ gdisplay_transform_coords_f (GDisplay *gdisp,
offset_x = offset_y = 0;
}
*nx = scale * (x + offset_x) - gdisp->offset_x;
*ny = scale * (y + offset_y) - gdisp->offset_y;
*nx = scalex * (x + offset_x) - gdisp->offset_x;
*ny = scaley * (y + offset_y) - gdisp->offset_y;
*nx += gdisp->disp_xoffset;
*ny += gdisp->disp_yoffset;
......@@ -1256,15 +1275,16 @@ gdisplay_untransform_coords_f (GDisplay *gdisp,
double *ny,
int use_offsets)
{
double scale;
double scalex;
double scaley;
int offset_x, offset_y;
x -= gdisp->disp_xoffset;
y -= gdisp->disp_yoffset;
/* transform from screen coordinates to gimp coordinates */
scale = (SCALESRC (gdisp) == 1) ? SCALEDEST (gdisp) :
1.0 / SCALESRC (gdisp);
scalex = SCALEFACTOR_X(gdisp);
scaley = SCALEFACTOR_Y(gdisp);
if (use_offsets)
drawable_offsets (gimage_active_drawable (gdisp->gimage), &offset_x, &offset_y);
......@@ -1273,8 +1293,8 @@ gdisplay_untransform_coords_f (GDisplay *gdisp,
offset_x = offset_y = 0;
}
*nx = (x + gdisp->offset_x) / scale - offset_x;
*ny = (y + gdisp->offset_y) / scale - offset_y;
*nx = (x + gdisp->offset_x) / scalex - offset_x;
*ny = (y + gdisp->offset_y) / scaley - offset_y;
}
......@@ -1379,6 +1399,7 @@ gdisplay_set_menu_sensitivity (GDisplay *gdisp)
menus_set_state (_("<Image>/View/Toggle Guides"), gdisp->draw_guides);
menus_set_state (_("<Image>/View/Snap To Guides"), gdisp->snap_to_guides);
menus_set_state (_("<Image>/View/Toggle Statusbar"), GTK_WIDGET_VISIBLE (gdisp->statusarea) ? 1 : 0);
menus_set_state (_("<Image>/View/Dot for dot"), gdisp->dot_for_dot);
plug_in_set_menu_sensitivity (type);
}
......
......@@ -31,10 +31,29 @@
/* some useful macros */
/* unpacking the user scale level (char) */
#define SCALESRC(g) (g->scale & 0x00ff)
#define SCALEDEST(g) (g->scale >> 8)
#define SCALE(g,x) ((x * SCALEDEST(g)) / SCALESRC(g))
#define UNSCALE(g,x) ((x * SCALESRC(g)) / SCALEDEST(g))
/* finding the effective screen resolution (float) */
#define SCREEN_XRES(g) (g->dot_for_dot? g->gimage->xresolution : monitor_xres)
#define SCREEN_YRES(g) (g->dot_for_dot? g->gimage->yresolution : monitor_yres)
/* calculate scale factors (float) */
#define SCALEFACTOR_X(g) ((SCALEDEST(g) * SCREEN_XRES(g)) / \
(SCALESRC(g) * g->gimage->xresolution))
#define SCALEFACTOR_Y(g) ((SCALEDEST(g) * SCREEN_YRES(g)) / \
(SCALESRC(g) * g->gimage->yresolution))
/* scale values */
#define SCALEX(g,x) ((int)(x * SCALEFACTOR_X(g)))
#define SCALEY(g,y) ((int)(y * SCALEFACTOR_Y(g)))
/* unscale values */
#define UNSCALEX(g,x) ((int)(x / SCALEFACTOR_X(g)))
#define UNSCALEY(g,y) ((int)(y / SCALEFACTOR_Y(g)))
#define LOWPASS(x) ((x>0) ? x : 0)
/* #define HIGHPASS(x,y) ((x>y) ? y : x) */ /* unused - == MIN */
......@@ -96,6 +115,7 @@ struct _GDisplay
int offset_x, offset_y; /* offset of display image into raw image */
int scale; /* scale factor from original raw image */
int dot_for_dot; /* is monitor resolution being ignored? */
short draw_guides; /* should the guides be drawn? */
short snap_to_guides; /* should the guides be snapped to? */
......@@ -146,6 +166,7 @@ Guide* gdisplay_find_guide (GDisplay *, int, int);
void gdisplay_snap_point (GDisplay *, double , double, double *, double *);
void gdisplay_snap_rectangle (GDisplay *, int, int, int, int, int *, int *);
void gdisplay_update_cursor (GDisplay *, int, int);
void gdisplay_set_dot_for_dot (GDisplay *, int);
void gdisplay_resize_cursor_label (GDisplay *);
/* function declarations */
......
......@@ -205,7 +205,7 @@ info_window_update (InfoDialog *info_win,
gdisp->gimage->xresolution,
gdisp->gimage->yresolution);
/* zoom ratio */
/* user zoom ratio */
sprintf (iwd->scale_str, "%d:%d",
SCALEDEST (gdisp), SCALESRC (gdisp));
......
......@@ -105,6 +105,9 @@ static char * old_pattern_path;
static char * old_palette_path;
static char * old_plug_in_path;
static char * old_gradient_path;
static float old_monitor_xres;
static float old_monitor_yres;
static int old_using_xserver_resolution;
static char * edit_temp_path = NULL;
static char * edit_swap_path = NULL;
......@@ -122,6 +125,8 @@ static int edit_last_opened_size;
static GtkWidget *tile_cache_size_spinbutton = NULL;
static int divided_tile_cache_size;
static int mem_size_unit;
static GtkWidget *xres_spinbutton = NULL;
static GtkWidget *yres_spinbutton = NULL;
/* Some information regarding preferences, compiled by Raph Levien 11/3/97.
......@@ -227,10 +232,20 @@ file_prefs_ok_callback (GtkWidget *widget,
g_message (_("Error: Default height must be one or greater."));
default_height = old_default_height;
return;
}
}
if (monitor_xres < 1e-5 || monitor_yres < 1e-5)
{
g_message (_("Error: monitor resolution must not be zero."));
monitor_xres = old_monitor_xres;
monitor_yres = old_monitor_yres;
return;
}
gtk_widget_destroy (dlg);
prefs_dlg = NULL;
xres_spinbutton = NULL;
yres_spinbutton = NULL;
if (show_tool_tips)
gtk_tooltips_enable (tool_tips);
......@@ -238,6 +253,8 @@ file_prefs_ok_callback (GtkWidget *widget,
gtk_tooltips_disable (tool_tips);
}
static void
file_prefs_save_callback (GtkWidget *widget,
GtkWidget *dlg)
......@@ -342,6 +359,12 @@ file_prefs_save_callback (GtkWidget *widget,
update = g_list_append (update, "transparency-type");
if (transparency_size != old_transparency_size)
update = g_list_append (update, "transparency-size");
if (using_xserver_resolution != old_using_xserver_resolution ||
ABS(monitor_xres - old_monitor_xres) > 1e-5)
update = g_list_append (update, "monitor-xresolution");
if (using_xserver_resolution != old_using_xserver_resolution ||
ABS(monitor_yres - old_monitor_yres) > 1e-5)
update = g_list_append (update, "monitor-yresolution");
if (edit_stingy_memory_use != stingy_memory_use)
{
update = g_list_append (update, "stingy-memory-use");
......@@ -414,8 +437,19 @@ file_prefs_save_callback (GtkWidget *widget,
gradient_path = edit_gradient_path;
restart_notification = TRUE;
}
if (using_xserver_resolution)
{
/* special value of 0 for either x or y res in the gimprc file
* means use the xserver's current resolution */
monitor_xres = 0.0;
monitor_yres = 0.0;
}
save_gimprc (&update, &remove);
if (using_xserver_resolution)
gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
/* Restore variables which must not change */
stingy_memory_use = save_stingy_memory_use;
tile_cache_size = save_tile_cache_size;
......@@ -454,6 +488,8 @@ file_prefs_cancel_callback (GtkWidget *widget,
{
gtk_widget_destroy (dlg);
prefs_dlg = NULL;
xres_spinbutton = NULL;
yres_spinbutton = NULL;
levels_of_undo = old_levels_of_undo;
marching_speed = old_marching_speed;
......@@ -471,6 +507,9 @@ file_prefs_cancel_callback (GtkWidget *widget,
default_width = old_default_width;
default_height = old_default_height;
default_type = old_default_type;
monitor_xres = old_monitor_xres;
monitor_yres = old_monitor_yres;
using_xserver_resolution = old_using_xserver_resolution;
if (preview_size != old_preview_size)
{
......@@ -604,6 +643,16 @@ file_prefs_spinbutton_callback (GtkWidget *widget,
*val = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget));
}
static void
file_prefs_float_spinbutton_callback (GtkWidget *widget,
gpointer data)
{
float *val;
val = data;
*val = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget));
}
static void
file_prefs_string_callback (GtkWidget *widget,
gpointer data)
......@@ -622,6 +671,36 @@ file_prefs_clear_session_info_callback (GtkWidget *widget,
session_info_updates = NULL;
}
static void
file_prefs_res_source_callback (GtkWidget *widget,
gpointer data)
{
if (xres_spinbutton)
gtk_widget_set_sensitive (xres_spinbutton,
! GTK_TOGGLE_BUTTON (widget)->active);
if (yres_spinbutton)
gtk_widget_set_sensitive (yres_spinbutton,
! GTK_TOGGLE_BUTTON (widget)->active);
if (GTK_TOGGLE_BUTTON (widget)->active)
{
gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
using_xserver_resolution = TRUE;
}
else
{
if (xres_spinbutton)
monitor_xres = gtk_spin_button_get_value_as_float (GTK_SPIN_BUTTON
(xres_spinbutton));
if (yres_spinbutton)
monitor_yres = gtk_spin_button_get_value_as_float (GTK_SPIN_BUTTON
(yres_spinbutton));
using_xserver_resolution = FALSE;
}
}
void
file_pref_cmd_callback (GtkWidget *widget,
gpointer client_data)
......@@ -756,6 +835,9 @@ file_pref_cmd_callback (GtkWidget *widget,
old_install_cmap = edit_install_cmap;
old_cycled_marching_ants = edit_cycled_marching_ants;
old_last_opened_size = edit_last_opened_size;
old_monitor_xres = monitor_xres;
old_monitor_yres = monitor_yres;
old_using_xserver_resolution = using_xserver_resolution;
file_prefs_strset (&old_temp_path, edit_temp_path);
file_prefs_strset (&old_swap_path, edit_swap_path);
file_prefs_strset (&old_brush_path, edit_brush_path);
......@@ -1321,6 +1403,100 @@ file_pref_cmd_callback (GtkWidget *widget,
label = gtk_label_new (_("Directories"));
gtk_notebook_append_page (GTK_NOTEBOOK(notebook), out_frame, label);
/* Monitor */
out_frame = gtk_frame_new (_("Monitor information"));
gtk_container_border_width (GTK_CONTAINER (out_frame), 10);
gtk_widget_set_usize (out_frame, 320, 200);
gtk_widget_show (out_frame);
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_border_width (GTK_CONTAINER (vbox), 1);
gtk_container_add (GTK_CONTAINER (out_frame), vbox);
gtk_widget_show (vbox);
label = gtk_label_new (_("Get monitor resolution"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
group = NULL;
button = gtk_radio_button_new_with_label (group, _("from X server"));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "toggled",
GTK_SIGNAL_FUNC (file_prefs_res_source_callback),
NULL);
gtk_widget_show (button);
{
float xres, yres;
char buf[80];
gdisplay_xserver_resolution (&xres, &yres);
sprintf (buf, _("(currently %d x %d dpi)"),
(int)(xres + 0.5), (int)(yres + 0.5));
label = gtk_label_new (buf);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
}
button = gtk_radio_button_new_with_label (group, _("manually:"));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
if (!using_xserver_resolution)
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
abox = gtk_alignment_new (0.5, 0.5, 0.0, 1.0);
gtk_box_pack_start (GTK_BOX (vbox), abox, FALSE, FALSE, 0);
gtk_widget_show (abox);
hbox = gtk_hbox_new (FALSE, 2);
gtk_container_add (GTK_CONTAINER (abox), hbox);
gtk_widget_show (hbox);
adj = (GtkAdjustment *) gtk_adjustment_new (monitor_xres, 1.0,
32768, 1.0,
15.0, 0.0);
xres_spinbutton = gtk_spin_button_new (adj, 1.0, 2.0);
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON(xres_spinbutton),
GTK_SHADOW_NONE);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (xres_spinbutton), TRUE);
gtk_widget_set_usize (xres_spinbutton, 70, 0);
gtk_box_pack_start (GTK_BOX (hbox), xres_spinbutton, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (xres_spinbutton), "changed",
GTK_SIGNAL_FUNC (file_prefs_float_spinbutton_callback),
&monitor_xres);
gtk_widget_set_sensitive (xres_spinbutton, !using_xserver_resolution);
gtk_widget_show (xres_spinbutton);
label = gtk_label_new ( _(" by "));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
adj = (GtkAdjustment *) gtk_adjustment_new (monitor_yres, 1.0,
32768, 1.0,
15.0, 0.0);
yres_spinbutton = gtk_spin_button_new (adj, 1.0, 2.0);
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (yres_spinbutton),