Commit 309bf009 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

removed the monitor calibration from the user installation process. It's

2004-06-10  Sven Neumann  <sven@gimp.org>

	* app/gui/user-install-dialog.c: removed the monitor calibration
	from the user installation process. It's not a vital setting and
	can be done from the Preferences dialog later.

	* app/gui/resolution-calibrate-dialog.[ch]: simplified the
	resolution calibration dialog by removing the hacks that were
	needed for drawing it in the user-installation style.

	* app/gui/preferences-dialog.c: changed accordingly. Also removed
	the separator from the Display page.
parent 9169693e
2004-06-10 Sven Neumann <sven@gimp.org>
* app/gui/user-install-dialog.c: removed the monitor calibration
from the user installation process. It's not a vital setting and
can be done from the Preferences dialog later.
* app/gui/resolution-calibrate-dialog.[ch]: simplified the
resolution calibration dialog by removing the hacks that were
needed for drawing it in the user-installation style.
* app/gui/preferences-dialog.c: changed accordingly. Also removed
the separator from the Display page.
2004-06-10 Sven Neumann <sven@gimp.org>
* app/widgets/gimptemplateeditor.[ch]: added an API to
......
......@@ -398,8 +398,7 @@ prefs_resolution_calibrate_callback (GtkWidget *widget,
image = g_object_get_data (G_OBJECT (notebook), "image");
resolution_calibrate_dialog (sizeentry,
gtk_image_get_pixbuf (GTK_IMAGE (image)),
NULL, NULL, NULL);
gtk_image_get_pixbuf (GTK_IMAGE (image)));
}
static void
......@@ -908,7 +907,6 @@ prefs_dialog_new (Gimp *gimp,
GtkWidget *vbox;
GtkWidget *vbox2;
GtkWidget *hbox;
GtkWidget *abox;
GtkWidget *button;
GtkWidget *fileselection;
GtkWidget *patheditor;
......@@ -916,7 +914,6 @@ prefs_dialog_new (Gimp *gimp,
GtkWidget *label;
GtkWidget *image;
GtkWidget *sizeentry;
GtkWidget *separator;
GtkWidget *calibrate_button;
PangoAttrList *attrs;
PangoAttribute *attr;
......@@ -1653,20 +1650,6 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("Get Monitor Resolution"),
GTK_CONTAINER (vbox), FALSE);
{
gdouble xres, yres;
gchar *str;
gimp_get_screen_resolution (NULL, &xres, &yres);
str = g_strdup_printf (_("(Currently %d x %d dpi)"),
ROUND (xres), ROUND (yres));
label = gtk_label_new (str);
g_free (str);
}
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
{
gchar *pixels_per_unit = g_strconcat (_("Pixels"), "/%s", NULL);
......@@ -1692,27 +1675,28 @@ prefs_dialog_new (Gimp *gimp,
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
_("dpi"), 1, 4, 0.0);
gtk_container_add (GTK_CONTAINER (abox), sizeentry);
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), sizeentry, FALSE, FALSE, 24);
gtk_widget_show (sizeentry);
gtk_widget_set_sensitive (sizeentry, ! display_config->monitor_res_from_gdk);
hbox = gtk_hbox_new (FALSE, 6);
group = NULL;
calibrate_button = gtk_button_new_with_mnemonic (_("C_alibrate"));
gtk_misc_set_padding (GTK_MISC (GTK_BIN (calibrate_button)->child), 4, 0);
gtk_box_pack_start (GTK_BOX (hbox), calibrate_button, FALSE, FALSE, 0);
gtk_widget_show (calibrate_button);
gtk_widget_set_sensitive (calibrate_button,
! display_config->monitor_res_from_gdk);
{
gdouble xres, yres;
gchar *str;
g_signal_connect (calibrate_button, "clicked",
G_CALLBACK (prefs_resolution_calibrate_callback),
sizeentry);
gimp_get_screen_resolution (NULL, &xres, &yres);
group = NULL;
str = g_strdup_printf (_("From _Windowing System (currently %d x %d dpi)"),
ROUND (xres), ROUND (yres));
button = gtk_radio_button_new_with_mnemonic (group, str);
g_free (str);
}
button = gtk_radio_button_new_with_mnemonic (group,
_("From _Windowing System"));
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_widget_show (button);
......@@ -1723,34 +1707,40 @@ prefs_dialog_new (Gimp *gimp,
label);
g_object_set_data (G_OBJECT (button), "inverse_sensitive",
sizeentry);
g_object_set_data (G_OBJECT (sizeentry), "inverse_sensitive",
calibrate_button);
g_signal_connect (button, "toggled",
G_CALLBACK (prefs_resolution_source_callback),
config);
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
gtk_widget_show (label);
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (vbox2), separator, FALSE, FALSE, 0);
gtk_widget_show (separator);
button = gtk_radio_button_new_with_mnemonic (group, _("_Manually"));
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (vbox2), abox, FALSE, FALSE, 0);
gtk_widget_show (abox);
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
if (! display_config->monitor_res_from_gdk)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
calibrate_button = gtk_button_new_with_mnemonic (_("C_alibrate..."));
gtk_misc_set_padding (GTK_MISC (GTK_BIN (calibrate_button)->child), 4, 0);
gtk_box_pack_start (GTK_BOX (hbox), calibrate_button, FALSE, FALSE, 0);
gtk_widget_show (calibrate_button);
gtk_widget_set_sensitive (calibrate_button,
! display_config->monitor_res_from_gdk);
g_object_set_data (G_OBJECT (sizeentry), "inverse_sensitive",
calibrate_button);
g_signal_connect (calibrate_button, "clicked",
G_CALLBACK (prefs_resolution_calibrate_callback),
sizeentry);
/***********************/
/* Window Management */
......
......@@ -29,10 +29,6 @@
#include "gimp-intl.h"
#define SET_STYLE(widget, style) \
if (style) gtk_widget_modify_style (widget, style)
static GtkWidget *calibrate_entry = NULL;
static gdouble calibrate_xres = 1.0;
static gdouble calibrate_yres = 1.0;
......@@ -44,36 +40,24 @@ static gint ruler_height = 1;
* resolution_calibrate_dialog:
* @resolution_entry: a #GimpSizeEntry to connect the dialog to
* @pixbuf: an optional #GdkPixbuf for the upper left corner
* @dialog_style: a #GtkStyle for the main dialog (used by the
* user_installation_dialog)
* @ruler_style: a #GtkStyle for the rulers and the entry area
* (used by the user_installation_dialog)
* @expose_callback: an "expose_event" handler used by the
* user_installation_dialog
*
* Displays a dialog that allows the user to interactively determine
* her monitor resolution. This dialog runs it's own GTK main loop and
* is connected to a #GimpSizeEntry handling the resolution to be set.
* The style and callback parameters must only be used by the
* user_installation_dialog.
**/
void
resolution_calibrate_dialog (GtkWidget *resolution_entry,
GdkPixbuf *pixbuf,
GtkRcStyle *dialog_style,
GtkRcStyle *ruler_style,
GCallback expose_callback)
GdkPixbuf *pixbuf)
{
GtkWidget *dialog;
GtkWidget *table;
GtkWidget *ebox;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *darea;
GtkWidget *ruler;
GtkWidget *label;
GdkScreen *screen;
GList *list;
GtkWidget *dialog;
GtkWidget *table;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *ruler;
GtkWidget *label;
GdkScreen *screen;
PangoAttrList *attrs;
PangoAttribute *attr;
g_return_if_fail (GIMP_IS_SIZE_ENTRY (resolution_entry));
g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
......@@ -93,8 +77,6 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
NULL);
SET_STYLE (dialog, dialog_style);
screen = gtk_widget_get_screen (dialog);
ruler_width = gdk_screen_get_width (screen);
......@@ -118,7 +100,6 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
}
ruler = gtk_hruler_new ();
SET_STYLE (ruler, ruler_style);
gtk_widget_set_size_request (ruler, ruler_width, 32);
gtk_ruler_set_range (GTK_RULER (ruler), 0, ruler_width, 0, ruler_width);
gtk_table_attach (GTK_TABLE (table), ruler, 1, 3, 0, 1,
......@@ -126,79 +107,39 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
gtk_widget_show (ruler);
ruler = gtk_vruler_new ();
SET_STYLE (ruler, ruler_style);
gtk_widget_set_size_request (ruler, 32, ruler_height);
gtk_ruler_set_range (GTK_RULER (ruler), 0, ruler_height, 0, ruler_height);
gtk_table_attach (GTK_TABLE (table), ruler, 0, 1, 1, 3,
GTK_SHRINK, GTK_SHRINK, 0, 0);
gtk_widget_show (ruler);
ebox = gtk_event_box_new ();
SET_STYLE (ebox, ruler_style);
gtk_table_attach (GTK_TABLE (table), ebox, 1, 2, 1, 2,
GTK_SHRINK, GTK_SHRINK, 0, 0);
gtk_widget_show (ebox);
table = gtk_table_new (3, 3, FALSE);
gtk_container_add (GTK_CONTAINER (ebox), table);
gtk_widget_show (table);
darea = gtk_drawing_area_new ();
SET_STYLE (darea, dialog_style);
gtk_widget_set_size_request (darea, 16, 16);
if (expose_callback)
g_signal_connect (darea, "expose_event",
G_CALLBACK (expose_callback),
GINT_TO_POINTER (GTK_CORNER_TOP_LEFT));
gtk_table_attach (GTK_TABLE (table), darea, 0, 1, 0, 1,
GTK_SHRINK, GTK_SHRINK, 0, 0);
gtk_widget_show (darea);
darea = gtk_drawing_area_new ();
SET_STYLE (darea, dialog_style);
gtk_widget_set_size_request (darea, 16, 16);
if (expose_callback)
g_signal_connect (darea, "expose_event",
G_CALLBACK (expose_callback),
GINT_TO_POINTER (GTK_CORNER_BOTTOM_LEFT));
gtk_table_attach (GTK_TABLE (table), darea, 0, 1, 2, 3,
GTK_SHRINK, GTK_SHRINK, 0, 0);
gtk_widget_show (darea);
darea = gtk_drawing_area_new ();
SET_STYLE (darea, dialog_style);
gtk_widget_set_size_request (darea, 16, 16);
if (expose_callback)
g_signal_connect (darea, "expose_event",
G_CALLBACK (expose_callback),
GINT_TO_POINTER (GTK_CORNER_TOP_RIGHT));
gtk_table_attach (GTK_TABLE (table), darea, 2, 3, 0, 1,
GTK_SHRINK, GTK_SHRINK, 0, 0);
gtk_widget_show (darea);
darea = gtk_drawing_area_new ();
SET_STYLE (darea, dialog_style);
gtk_widget_set_size_request (darea, 16, 16);
if (expose_callback)
g_signal_connect (darea, "expose_event",
G_CALLBACK (expose_callback),
GINT_TO_POINTER (GTK_CORNER_BOTTOM_RIGHT));
gtk_table_attach (GTK_TABLE (table), darea, 2, 3, 2, 3,
GTK_SHRINK, GTK_SHRINK, 0, 0);
gtk_widget_show (darea);
vbox = gtk_vbox_new (FALSE, 16);
gtk_table_attach_defaults (GTK_TABLE (table), vbox, 1, 2, 1, 2);
vbox = gtk_vbox_new (FALSE, 12);
gtk_table_attach (GTK_TABLE (table), vbox, 1, 2, 1, 2,
GTK_SHRINK, GTK_SHRINK, 0, 0);
gtk_widget_show (vbox);
label =
gtk_label_new (_("Measure the rulers and enter their lengths below."));
SET_STYLE (label, ruler_style);
gtk_label_new (_("Measure the rulers and enter their lengths:"));
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
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);
attrs = pango_attr_list_new ();
attr = pango_attr_scale_new (PANGO_SCALE_LARGE);
attr->start_index = 0;
attr->end_index = -1;
pango_attr_list_insert (attrs, attr);
attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
attr->start_index = 0;
attr->end_index = -1;
pango_attr_list_insert (attrs, attr);
gtk_label_set_attributes (GTK_LABEL (label), attrs);
pango_attr_list_unref (attrs);
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
......@@ -229,18 +170,6 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
G_CALLBACK (gtk_widget_destroyed),
&calibrate_entry);
if (ruler_style)
{
for (list = GTK_TABLE (calibrate_entry)->children;
list;
list = g_list_next (list))
{
GtkTableChild *child = (GtkTableChild *) list->data;
if (child && GTK_IS_LABEL (child->widget))
SET_STYLE (GTK_WIDGET (child->widget), ruler_style);
}
}
gtk_box_pack_end (GTK_BOX (hbox), calibrate_entry, FALSE, FALSE, 0);
gtk_widget_show (calibrate_entry);
......
......@@ -21,10 +21,7 @@
void resolution_calibrate_dialog (GtkWidget *resolution_entry,
GdkPixbuf *pixbuf,
GtkRcStyle *dialog_style,
GtkRcStyle *ruler_style,
GCallback expose_callback);
GdkPixbuf *pixbuf);
#endif /* __RESOLUTION_CALIBRATE_DIALOG_H__ */
......@@ -46,7 +46,6 @@
#include "widgets/gimppropwidgets.h"
#include "widgets/gimpwidgets-utils.h"
#include "resolution-calibrate-dialog.h"
#include "user-install-dialog.h"
#include "gimp-intl.h"
......@@ -66,7 +65,6 @@ enum
TREE_PAGE,
LOG_PAGE,
TUNING_PAGE,
RESOLUTION_PAGE,
NUM_PAGES
};
......@@ -85,7 +83,6 @@ static void user_install_response (GtkWidget *widget,
static gboolean user_install_run (void);
static void user_install_tuning (GimpRc *gimprc);
static void user_install_resolution (GimpRc *gimprc);
/* private stuff */
......@@ -101,7 +98,6 @@ static GtkWidget *footer_label = NULL;
static GtkWidget *log_page = NULL;
static GtkWidget *tuning_page = NULL;
static GtkWidget *resolution_page = NULL;
static GtkRcStyle *title_style = NULL;
static GtkRcStyle *page_style = NULL;
......@@ -387,11 +383,6 @@ user_install_response (GtkWidget *widget,
break;
case TUNING_PAGE:
user_install_notebook_set_page (GTK_NOTEBOOK (notebook), ++notebook_index);
user_install_resolution (gimprc);
break;
case RESOLUTION_PAGE:
gimp_rc_save (gimprc);
g_object_unref (title_style);
......@@ -401,10 +392,10 @@ user_install_response (GtkWidget *widget,
gtk_main_quit ();
return;
break;
default:
g_assert_not_reached ();
break;
}
}
......@@ -933,18 +924,6 @@ user_install_dialog_run (const gchar *alternate_system_gimprc,
_("<b>For optimal GIMP performance, some settings may have to "
"be adjusted.</b>"));
/* Page 5 */
page = resolution_page =
user_install_notebook_append_page (GTK_NOTEBOOK (notebook),
_("Monitor Resolution"),
_("Click \"Continue\" to start "
"The GIMP."),
24);
add_label (GTK_BOX (resolution_page),
_("<b>To display images in their natural size, "
"GIMP needs to know your monitor resolution.</b>"));
user_install_notebook_set_page (GTK_NOTEBOOK (notebook), 0);
gtk_widget_show (dialog);
......@@ -1178,147 +1157,3 @@ user_install_tuning (GimpRc *gimprc)
gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
}
static void
user_install_resolution_calibrate (GtkWidget *button,
gpointer data)
{
GdkPixbuf *pixbuf;
gchar *filename;
filename = g_build_filename (gimp_data_directory (),
"themes", "Default", "images", "preferences",
"monitor.png", NULL);
pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
g_free (filename);
resolution_calibrate_dialog (GTK_WIDGET (data),
pixbuf,
title_style,
page_style,
G_CALLBACK (user_install_corner_expose));
if (pixbuf)
g_object_unref (pixbuf);
}
static void
user_install_resolution (GimpRc *gimprc)
{
GimpDisplayConfig *config = GIMP_DISPLAY_CONFIG (gimprc);
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *entry;
GimpChainButton *chain;
GtkWidget *toggle;
GtkWidget *button;
GList *list;
gdouble xres, yres;
gchar *pixels_per_unit;
gchar *str;
gimp_get_screen_resolution (NULL, &xres, &yres);
vbox = gtk_vbox_new (FALSE, 8);
gtk_box_pack_start (GTK_BOX (resolution_page), vbox, FALSE, FALSE, 0);
gtk_widget_show (vbox);
add_label (GTK_BOX (vbox),
_("GIMP can obtain this information from the windowing system. "
"However, usually this does not give useful values."));
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
str = g_strdup_printf
(_("Get Resolution from windowing system (Currently %d x %d dpi)"),
ROUND (xres), ROUND (yres));
toggle =
gimp_prop_check_button_new (G_OBJECT (gimprc),
"monitor-resolution-from-windowing-system",
str);
g_free (str);
PAGE_STYLE (GTK_BIN (toggle)->child);
gtk_box_pack_end (GTK_BOX (hbox), toggle, FALSE, FALSE, 0);
gtk_widget_show (toggle);
/* manually */
vbox = gtk_vbox_new (FALSE, 8);
gtk_box_pack_start (GTK_BOX (resolution_page), vbox, FALSE, FALSE, 0);
gtk_widget_show (vbox);
add_label (GTK_BOX (vbox),
_("Alternatively, you can set the monitor resolution manually."));
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
pixels_per_unit = g_strconcat (_("Pixels"), "/%s", NULL);
entry = gimp_prop_coordinates_new (G_OBJECT (gimprc),
"monitor-xresolution",
"monitor-yresolution",
NULL,
pixels_per_unit,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION,
0.0, 0.0, TRUE);
gtk_table_set_col_spacings (GTK_TABLE (entry), 4);
gtk_table_set_row_spacings (GTK_TABLE (entry), 2);
g_free (pixels_per_unit);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (entry),
_("Horizontal"), 0, 1, 0.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (entry),
_("Vertical"), 0, 2, 0.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (entry),
_("dpi"), 1, 4, 0.0);
chain = GIMP_COORDINATES_CHAINBUTTON (entry);
PAGE_STYLE (GTK_WIDGET (chain->line1));
PAGE_STYLE (GTK_WIDGET (chain->line2));
for (list = GTK_TABLE (entry)->children; list; list = g_list_next (list))
{
GtkTableChild *child = (GtkTableChild *) list->data;
if (child && GTK_IS_LABEL (child->widget))
PAGE_STYLE (GTK_WIDGET (child->widget));
}
gtk_box_pack_end (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
gtk_widget_show (entry);
gtk_widget_set_sensitive (entry, !config->monitor_res_from_gdk);
/* calibrate */
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (resolution_page), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
add_label (GTK_BOX (hbox),
_("You can also press the \"Calibrate\" button to open a window "
"which lets you determine your monitor resolution "
"interactively."));
button = gtk_button_new_with_label (_("Calibrate"));
gtk_misc_set_padding (GTK_MISC (GTK_BIN (button)->child), 4, 0);
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_set_sensitive (button, !config->monitor_res_from_gdk);
gtk_widget_show (button);
g_signal_connect (button, "clicked",
G_CALLBACK (user_install_resolution_calibrate),
entry);
g_object_set_data (G_OBJECT (toggle), "inverse_sensitive",
entry);
g_object_set_data (G_OBJECT (entry), "inverse_sensitive",
button);
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_toggle_button_sensitive_update),
NULL);
}
......@@ -398,8 +398,7 @@ prefs_resolution_calibrate_callback (GtkWidget *widget,
image = g_object_get_data (G_OBJECT (notebook), "image");
resolution_calibrate_dialog (sizeentry,
gtk_image_get_pixbuf (GTK_IMAGE (image)),
NULL, NULL, NULL);
gtk_image_get_pixbuf (GTK_IMAGE (image)));
}
static void
......@@ -908,7 +907,6 @@ prefs_dialog_new (Gimp *gimp,
GtkWidget *vbox;
GtkWidget *vbox2;
GtkWidget *hbox;
GtkWidget *abox;
GtkWidget *button;
GtkWidget *fileselection;
GtkWidget *patheditor;
......@@ -916,7 +914,6 @@ prefs_dialog_new (Gimp *gimp,
GtkWidget *label;
GtkWidget *image;
GtkWidget *sizeentry;
GtkWidget *separator;
GtkWidget *calibrate_button;
PangoAttrList *attrs;
PangoAttribute *attr;
......@@ -1653,20 +1650,6 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("Get Monitor Resolution"),
GTK_CONTAINER (vbox), FALSE);