summaryrefslogtreecommitdiff
path: root/src/xsane.c
diff options
context:
space:
mode:
authorJulien BLACHE <jblache@debian.org>2007-02-27 22:22:40 +0100
committerMattia Rizzolo <mattia@mapreri.org>2014-10-03 14:05:34 +0000
commit4d8384e7b116e3eb11cc3df9151c8554dbca95fc (patch)
treef049f1240de8a8a971a621a4a3891d5eab2839a1 /src/xsane.c
parent92f35807f68b30405639d4e0a95f748b6bdb793f (diff)
parent129ed4b29e21fdb8bda3bee89c3e5d8cca6ba749 (diff)
Imported Debian patch 0.993-1debian/0.993-1
Diffstat (limited to 'src/xsane.c')
-rw-r--r--src/xsane.c333
1 files changed, 275 insertions, 58 deletions
diff --git a/src/xsane.c b/src/xsane.c
index 9254ea7..38ee7d1 100644
--- a/src/xsane.c
+++ b/src/xsane.c
@@ -3,7 +3,7 @@
xsane.c
Oliver Rauch <Oliver.Rauch@rauch-domain.de>
- Copyright (C) 1998-2005 Oliver Rauch
+ Copyright (C) 1998-2007 Oliver Rauch
This file is part of the XSANE package.
This program is free software; you can redistribute it and/or modify
@@ -56,6 +56,7 @@ struct option long_options[] =
{"version", no_argument, 0, 'v'},
{"license", no_argument, 0, 'l'},
{"device-settings", required_argument, 0, 'd'},
+ {"xsane-rc", required_argument, 0, 'r'},
{"save", no_argument, 0, 's'},
{"viewer", no_argument, 0, 'V'},
{"copy", no_argument, 0, 'c'},
@@ -752,7 +753,7 @@ static void xsane_resolution_list_callback(GtkWidget *widget, gpointer data)
static int xsane_resolution_widget_new(GtkWidget *parent, int well_known_option, double *resolution, const char *image_xpm[],
const gchar *desc, const gchar *widget_name)
{
- GtkObject *resolution_widget;
+ GtkWidget *resolution_widget;
const SANE_Option_Descriptor *opt;
DBG(DBG_proc, "xsane_resolution_widget_new\n");
@@ -1153,6 +1154,14 @@ static void xsane_scanmode_menu_callback(GtkWidget *widget, gpointer data)
}
}
+/* ----------------------------------------------------------------------------------------------------------------- */
+
+static void xsane_cms_function_menu_callback(GtkWidget *widget, gpointer data)
+{
+ preferences.cms_function = (int) data;
+ DBG(DBG_proc, "xsane_cms_function_menu_callback(%d)\n", preferences.cms_function);
+}
+
/* ---------------------------------------------------------------------------------------------------------------------- */
static void xsane_adf_pages_max_callback(GtkWidget *widget, gpointer data)
@@ -1444,6 +1453,31 @@ GtkWidget *xsane_update_xsane_callback() /* creates the XSane option window */
gtk_widget_show(xsane_spinbutton);
}
+#ifdef HAVE_LIBLCMS
+ if ((xsane.enable_color_management) &&
+ ( (xsane.xsane_mode == XSANE_VIEWER) ||
+ (xsane.xsane_mode == XSANE_SAVE) ||
+ (xsane.xsane_mode == XSANE_EMAIL) ||
+ (xsane.xsane_mode == XSANE_MULTIPAGE)
+ )
+ )
+ {
+ hbox = gtk_hbox_new(FALSE, 2);
+ gtk_container_set_border_width(GTK_CONTAINER(hbox), 2);
+ gtk_box_pack_start(GTK_BOX(xsane_vbox_xsane_modus), hbox, FALSE, FALSE, 1);
+ gtk_widget_show(hbox);
+
+ pixmap = gdk_pixmap_create_from_xpm_d(xsane.histogram_dialog->window, &mask, xsane.bg_trans, (gchar **) cms_xpm);
+ pixmapwidget = gtk_image_new_from_pixmap(pixmap, mask);
+ gtk_box_pack_start(GTK_BOX(hbox), pixmapwidget, FALSE, FALSE, 2);
+ gdk_drawable_unref(pixmap);
+ gtk_widget_show(pixmapwidget);
+
+ xsane.cms_function_option_menu = xsane_back_gtk_cms_function_menu_new(preferences.cms_function, (GtkSignalFunc) xsane_cms_function_menu_callback);
+ gtk_box_pack_end(GTK_BOX(hbox), xsane.cms_function_option_menu, FALSE, FALSE, 2);
+ gtk_widget_show(xsane.cms_function_option_menu);
+ }
+#endif
/* input selection */
opt = xsane_get_option_descriptor(xsane.dev, xsane.well_known.scansource);
@@ -1526,7 +1560,8 @@ GtkWidget *xsane_update_xsane_callback() /* creates the XSane option window */
}
- if (xsane.param.depth != 1) /* show medium selection of not lineart mode */
+ /* show medium selection when not lineart mode and no color management */
+ if ((xsane.param.depth != 1) && (!xsane.enable_color_management))
{
/* medium selection */
hbox = gtk_hbox_new(FALSE, 2);
@@ -1658,33 +1693,31 @@ GtkWidget *xsane_update_xsane_callback() /* creates the XSane option window */
}
#endif
- /* test if scanner gamma table is selected */
+ /* test if scanner gamma table is selected */
- xsane.scanner_gamma_gray = FALSE;
- if (xsane.well_known.gamma_vector >0)
- {
- const SANE_Option_Descriptor *opt;
-
- opt = xsane_get_option_descriptor(xsane.dev, xsane.well_known.gamma_vector);
- if (SANE_OPTION_IS_ACTIVE(opt->cap))
- {
- xsane.scanner_gamma_gray = TRUE;
- }
- }
-
- xsane.scanner_gamma_color = FALSE;
- if (xsane.well_known.gamma_vector_r >0)
- {
- const SANE_Option_Descriptor *opt;
+ xsane.scanner_gamma_gray = FALSE;
+ if (xsane.well_known.gamma_vector >0)
+ {
+ const SANE_Option_Descriptor *opt;
- opt = xsane_get_option_descriptor(xsane.dev, xsane.well_known.gamma_vector_r);
- if (SANE_OPTION_IS_ACTIVE(opt->cap))
- {
- xsane.scanner_gamma_color = TRUE;
- }
- }
+ opt = xsane_get_option_descriptor(xsane.dev, xsane.well_known.gamma_vector);
+ if (SANE_OPTION_IS_ACTIVE(opt->cap))
+ {
+ xsane.scanner_gamma_gray = TRUE;
+ }
+ }
+ xsane.scanner_gamma_color = FALSE;
+ if (xsane.well_known.gamma_vector_r >0)
+ {
+ const SANE_Option_Descriptor *opt;
+ opt = xsane_get_option_descriptor(xsane.dev, xsane.well_known.gamma_vector_r);
+ if (SANE_OPTION_IS_ACTIVE(opt->cap))
+ {
+ xsane.scanner_gamma_color = TRUE;
+ }
+ }
/* XSane Frame Enhancement */
@@ -1717,7 +1750,41 @@ GtkWidget *xsane_update_xsane_callback() /* creates the XSane option window */
xsane.slider_gray.active = XSANE_SLIDER_ACTIVE; /* mark slider active */
- if ( (xsane.xsane_colors > 1) && (!xsane.enhancement_rgb_default) )
+
+ if (xsane.enable_color_management) /* do not show gamma widgets when color management is active */
+ {
+ xsane.gamma = 1.0;
+ xsane.gamma_red = 1.0;
+ xsane.gamma_green = 1.0;
+ xsane.gamma_blue = 1.0;
+ xsane.brightness = 0.0;
+ xsane.brightness_red = 0.0;
+ xsane.brightness_green = 0.0;
+ xsane.brightness_blue = 0.0;
+ xsane.contrast = 0.0;
+ xsane.contrast_red = 0.0;
+ xsane.contrast_green = 0.0;
+ xsane.contrast_blue = 0.0;
+ xsane.threshold = 50.0;
+
+ xsane.slider_gray.value[2] = 100.0;
+ xsane.slider_gray.value[1] = 50.0;
+ xsane.slider_gray.value[0] = 0.0;
+ xsane.slider_red.value[2] = 100.0;
+ xsane.slider_red.value[1] = 50.0;
+ xsane.slider_red.value[0] = 0.0;
+ xsane.slider_green.value[2] = 100.0;
+ xsane.slider_green.value[1] = 50.0;
+ xsane.slider_green.value[0] = 0.0;
+ xsane.slider_blue.value[2] = 100.0;
+ xsane.slider_blue.value[1] = 50.0;
+ xsane.slider_blue.value[0] = 0.0;
+
+ return(xsane_hbox);
+ }
+
+
+ if ( (xsane.xsane_channels > 1) && (!xsane.enhancement_rgb_default) )
{
xsane_separator_new(xsane_vbox_xsane_modus, 2);
}
@@ -1725,7 +1792,7 @@ GtkWidget *xsane_update_xsane_callback() /* creates the XSane option window */
xsane_range_new_with_pixmap(xsane.xsane_window->window, GTK_BOX(xsane_vbox_xsane_modus), Gamma_xpm, DESC_GAMMA,
XSANE_GAMMA_MIN, XSANE_GAMMA_MAX, 0.01, 0.1, 2,
&xsane.gamma, &xsane.gamma_widget, 0, xsane_gamma_changed, TRUE);
- if ( (xsane.xsane_colors > 1) && (!xsane.enhancement_rgb_default) )
+ if ( (xsane.xsane_channels > 1) && (!xsane.enhancement_rgb_default) )
{
xsane_range_new_with_pixmap(xsane.xsane_window->window, GTK_BOX(xsane_vbox_xsane_modus), Gamma_red_xpm, DESC_GAMMA_R,
XSANE_GAMMA_MIN, XSANE_GAMMA_MAX, 0.01, 0.1, 2,
@@ -1743,7 +1810,7 @@ GtkWidget *xsane_update_xsane_callback() /* creates the XSane option window */
xsane_range_new_with_pixmap(xsane.xsane_window->window, GTK_BOX(xsane_vbox_xsane_modus), brightness_xpm, DESC_BRIGHTNESS,
xsane.brightness_min, xsane.brightness_max, 0.1, 1.0, 1,
&xsane.brightness, &xsane.brightness_widget, 0, xsane_gamma_changed, TRUE);
- if ( (xsane.xsane_colors > 1) && (!xsane.enhancement_rgb_default) )
+ if ( (xsane.xsane_channels > 1) && (!xsane.enhancement_rgb_default) )
{
xsane_range_new_with_pixmap(xsane.xsane_window->window, GTK_BOX(xsane_vbox_xsane_modus), brightness_red_xpm, DESC_BRIGHTNESS_R,
xsane.brightness_min, xsane.brightness_max, 0.1, 1.0, 1,
@@ -1761,7 +1828,7 @@ GtkWidget *xsane_update_xsane_callback() /* creates the XSane option window */
xsane_range_new_with_pixmap(xsane.xsane_window->window, GTK_BOX(xsane_vbox_xsane_modus), contrast_xpm, DESC_CONTRAST,
xsane.contrast_gray_min, xsane.contrast_max, 0.1, 1.0, 1,
&xsane.contrast, &xsane.contrast_widget, 0, xsane_gamma_changed, TRUE);
- if ( (xsane.xsane_colors > 1) && (!xsane.enhancement_rgb_default) )
+ if ( (xsane.xsane_channels > 1) && (!xsane.enhancement_rgb_default) )
{
xsane_range_new_with_pixmap(xsane.xsane_window->window, GTK_BOX(xsane_vbox_xsane_modus), contrast_red_xpm, DESC_CONTRAST_R,
xsane.contrast_min, xsane.contrast_max, 0.1, 1.0, 1,
@@ -1782,7 +1849,7 @@ GtkWidget *xsane_update_xsane_callback() /* creates the XSane option window */
gtk_box_pack_start(GTK_BOX(xsane_vbox_xsane_modus), xsane_hbox_xsane_enhancement, FALSE, FALSE, 0);
gtk_widget_show(xsane_hbox_xsane_enhancement);
- if (xsane.xsane_colors > 1)
+ if (xsane.xsane_channels > 1)
{
button = xsane_toggle_button_new_with_pixmap(xsane.xsane_window->window, xsane_hbox_xsane_enhancement, rgb_default_xpm, DESC_RGB_DEFAULT,
&xsane.enhancement_rgb_default, xsane_enhancement_rgb_default_callback);
@@ -1795,7 +1862,7 @@ GtkWidget *xsane_update_xsane_callback() /* creates the XSane option window */
button = xsane_button_new_with_pixmap(xsane.xsane_window->window, xsane_hbox_xsane_enhancement, enhance_xpm, DESC_ENH_AUTO,
xsane_auto_enhancement_callback, NULL);
- gtk_widget_add_accelerator(button, "clicked", xsane.accelerator_group, GDK_E, GDK_CONTROL_MASK, DEF_GTK_ACCEL_LOCKED);
+ gtk_widget_add_accelerator(button, "clicked", xsane.accelerator_group, GDK_A, GDK_CONTROL_MASK, DEF_GTK_ACCEL_LOCKED);
button = xsane_button_new_with_pixmap(xsane.xsane_window->window, xsane_hbox_xsane_enhancement, default_enhancement_xpm, DESC_ENH_DEFAULT,
xsane_enhancement_restore_default, NULL);
@@ -1831,7 +1898,8 @@ void xsane_pref_save(void)
DBG(DBG_proc, "xsane_pref_save\n");
/* first save xsane-specific preferences: */
- xsane_back_gtk_make_path(sizeof(filename), filename, "xsane", NULL, "xsane", NULL, ".rc", XSANE_PATH_LOCAL_SANE);
+ xsane_back_gtk_make_path(sizeof(filename), filename, "xsane", NULL, NULL, xsane.xsane_rc_set_filename, ".rc", XSANE_PATH_LOCAL_SANE);
+// xsane_back_gtk_make_path(sizeof(filename), filename, "xsane", NULL, "xsane", NULL, ".rc", XSANE_PATH_LOCAL_SANE);
DBG(DBG_info2, "saving preferences to \"%s\"\n", filename);
@@ -1862,7 +1930,8 @@ static int xsane_pref_restore(void)
DBG(DBG_proc, "xsane_pref_restore\n");
- xsane_back_gtk_make_path(sizeof(filename), filename, "xsane", NULL, "xsane", NULL, ".rc", XSANE_PATH_LOCAL_SANE);
+ xsane_back_gtk_make_path(sizeof(filename), filename, "xsane", NULL, NULL, xsane.xsane_rc_set_filename, ".rc", XSANE_PATH_LOCAL_SANE);
+// xsane_back_gtk_make_path(sizeof(filename), filename, "xsane", NULL, "xsane", NULL, ".rc", XSANE_PATH_LOCAL_SANE);
fd = open(filename, O_RDONLY);
if (fd >= 0)
@@ -1947,7 +2016,23 @@ static int xsane_pref_restore(void)
if (!preferences.filename)
{
- preferences.filename = strdup(OUT_FILENAME);
+ char filename[PATH_MAX];
+ char buf[PATH_MAX];
+
+ if (getenv(STRINGIFY(ENVIRONMENT_HOME_DIR_NAME)) != NULL)
+ {
+ snprintf(buf, sizeof(buf)-2, "%s%c%s", getenv(STRINGIFY(ENVIRONMENT_HOME_DIR_NAME)), SLASH, OUT_FILENAME);
+ preferences.filename = strdup(buf);
+ }
+ else if (getcwd(filename, sizeof(filename)))
+ {
+ snprintf(buf, sizeof(buf)-2, "%s%c%s", filename, SLASH, OUT_FILENAME);
+ preferences.filename = strdup(buf);
+ }
+ else
+ {
+ preferences.filename = strdup("");
+ }
}
if (!preferences.filetype)
@@ -1962,7 +2047,23 @@ static int xsane_pref_restore(void)
if (!preferences.fax_project)
{
- preferences.fax_project = strdup(FAXPROJECT);
+ char filename[PATH_MAX];
+ char buf[PATH_MAX];
+
+ if (getenv(STRINGIFY(ENVIRONMENT_HOME_DIR_NAME)) != NULL)
+ {
+ snprintf(buf, sizeof(buf)-2, "%s%c%s", getenv(STRINGIFY(ENVIRONMENT_HOME_DIR_NAME)), SLASH, FAXPROJECT);
+ preferences.fax_project = strdup(buf);
+ }
+ else if (getcwd(filename, sizeof(filename)))
+ {
+ snprintf(buf, sizeof(buf)-2, "%s%c%s", filename, SLASH, FAXPROJECT);
+ preferences.fax_project = strdup(buf);
+ }
+ else
+ {
+ preferences.fax_project = strdup("");
+ }
}
if (!preferences.fax_command)
@@ -2028,7 +2129,23 @@ static int xsane_pref_restore(void)
if (!preferences.email_project)
{
- preferences.email_project = strdup(EMAILPROJECT);
+ char filename[PATH_MAX];
+ char buf[PATH_MAX];
+
+ if (getenv(STRINGIFY(ENVIRONMENT_HOME_DIR_NAME)) != NULL)
+ {
+ snprintf(buf, sizeof(buf)-2, "%s%c%s", getenv(STRINGIFY(ENVIRONMENT_HOME_DIR_NAME)), SLASH, EMAILPROJECT);
+ preferences.email_project = strdup(buf);
+ }
+ else if (getcwd(filename, sizeof(filename)))
+ {
+ snprintf(buf, sizeof(buf)-2, "%s%c%s", filename, SLASH, EMAILPROJECT);
+ preferences.email_project = strdup(buf);
+ }
+ else
+ {
+ preferences.email_project = strdup("");
+ }
}
if (!preferences.email_filetype)
@@ -2039,7 +2156,23 @@ static int xsane_pref_restore(void)
if (!preferences.multipage_project)
{
- preferences.multipage_project = strdup(MULTIPAGEPROJECT);
+ char filename[PATH_MAX];
+ char buf[PATH_MAX];
+
+ if (getenv(STRINGIFY(ENVIRONMENT_HOME_DIR_NAME)) != NULL)
+ {
+ snprintf(buf, sizeof(buf)-2, "%s%c%s", getenv(STRINGIFY(ENVIRONMENT_HOME_DIR_NAME)), SLASH, MULTIPAGEPROJECT);
+ preferences.multipage_project = strdup(buf);
+ }
+ else if (getcwd(filename, sizeof(filename)))
+ {
+ snprintf(buf, sizeof(buf)-2, "%s%c%s", filename, SLASH, MULTIPAGEPROJECT);
+ preferences.multipage_project = strdup(buf);
+ }
+ else
+ {
+ preferences.multipage_project = strdup("");
+ }
}
if (!preferences.multipage_filetype)
@@ -2076,7 +2209,7 @@ static int xsane_pref_restore(void)
{
if (getenv(STRINGIFY(ENVIRONMENT_BROWSER_NAME)))
{
- preferences.browser = getenv(STRINGIFY(ENVIRONMENT_BROWSER_NAME));
+ preferences.browser = strdup(getenv(STRINGIFY(ENVIRONMENT_BROWSER_NAME)));
}
else
{
@@ -2871,6 +3004,55 @@ static void xsane_set_pref_unit_callback(GtkWidget *widget, gpointer data)
}
/* ---------------------------------------------------------------------------------------------------------------------- */
+#ifdef HAVE_LIBLCMS
+static void xsane_enable_color_management_callback(GtkWidget *widget, gpointer data)
+{
+ DBG(DBG_proc, "xsane_enable_color_management_callback\n");
+
+ xsane.enable_color_management = (GTK_CHECK_MENU_ITEM(widget)->active);
+
+ gtk_widget_set_sensitive(xsane.edit_medium_definition_widget, (xsane.enable_color_management) == 0);
+
+ if (xsane.enable_color_management)
+ {
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(xsane.edit_medium_definition_widget), FALSE);
+ xsane.medium_calibration = FALSE;
+ }
+
+ xsane.gamma = 1.0;
+ xsane.gamma_red = 1.0;
+ xsane.gamma_green = 1.0;
+ xsane.gamma_blue = 1.0;
+ xsane.brightness = 0.0;
+ xsane.brightness_red = 0.0;
+ xsane.brightness_green = 0.0;
+ xsane.brightness_blue = 0.0;
+ xsane.contrast = 0.0;
+ xsane.contrast_red = 0.0;
+ xsane.contrast_green = 0.0;
+ xsane.contrast_blue = 0.0;
+ xsane.threshold = 50.0;
+
+ xsane.slider_gray.value[2] = 100.0;
+ xsane.slider_gray.value[1] = 50.0;
+ xsane.slider_gray.value[0] = 0.0;
+ xsane.slider_red.value[2] = 100.0;
+ xsane.slider_red.value[1] = 50.0;
+ xsane.slider_red.value[0] = 0.0;
+ xsane.slider_green.value[2] = 100.0;
+ xsane.slider_green.value[1] = 50.0;
+ xsane.slider_green.value[0] = 0.0;
+ xsane.slider_blue.value[2] = 100.0;
+ xsane.slider_blue.value[1] = 50.0;
+ xsane.slider_blue.value[0] = 0.0;
+
+ xsane_update_sliders();
+ xsane_update_gamma_curve(FALSE);
+ xsane_batch_scan_update_icon_list();
+ xsane_refresh_dialog();
+}
+#endif
+/* ---------------------------------------------------------------------------------------------------------------------- */
static void xsane_edit_medium_definition_callback(GtkWidget *widget, gpointer data)
{
@@ -3087,7 +3269,7 @@ static void xsane_info_dialog(GtkWidget *widget, gpointer data)
gtk_box_pack_start(GTK_BOX(hbox), table, FALSE, FALSE, 5);
gtk_widget_show(table);
- if ((xsane.xsane_colors > 1) && (xsane.scanner_gamma_color)) /* color gamma correction by scanner */
+ if ((xsane.xsane_channels > 1) && (xsane.scanner_gamma_color)) /* color gamma correction by scanner */
{
const SANE_Option_Descriptor *opt;
@@ -3108,7 +3290,7 @@ static void xsane_info_dialog(GtkWidget *widget, gpointer data)
snprintf(buf, sizeof(buf), "%d bit", (int) (0.5 + log(opt->constraint.range->max+1.0) / log(2.0)));
label = xsane_info_table_text_new(table, buf, 1, 2);
}
- else if ((!xsane.xsane_colors > 1) && (xsane.scanner_gamma_gray)) /* gray gamma correction by scanner */
+ else if ((!xsane.xsane_channels > 1) && (xsane.scanner_gamma_gray)) /* gray gamma correction by scanner */
{
const SANE_Option_Descriptor *opt;
@@ -3996,7 +4178,7 @@ static GtkWidget *xsane_preferences_build_menu(void)
gtk_widget_show(item);
-
+#if 0
/* change working directory */
item = gtk_menu_item_new_with_label(MENU_ITEM_CHANGE_WORKING_DIR);
@@ -4010,6 +4192,18 @@ static GtkWidget *xsane_preferences_build_menu(void)
item = gtk_menu_item_new();
gtk_menu_append(GTK_MENU(menu), item);
gtk_widget_show(item);
+#endif
+
+#ifdef HAVE_LIBLCMS
+ /* enable color management */
+
+ item = gtk_check_menu_item_new_with_label(MENU_ITEM_ENABLE_COLOR_MANAGEMENT);
+ g_signal_connect(GTK_OBJECT(item), "toggled", (GtkSignalFunc) xsane_enable_color_management_callback, NULL);
+ gtk_menu_append(GTK_MENU(menu), item);
+ gtk_widget_show(item);
+ xsane.enable_color_management_widget = item;
+#endif
+
/* edit medium definitions */
@@ -4017,6 +4211,7 @@ static GtkWidget *xsane_preferences_build_menu(void)
g_signal_connect(GTK_OBJECT(item), "toggled", (GtkSignalFunc) xsane_edit_medium_definition_callback, NULL);
gtk_menu_append(GTK_MENU(menu), item);
gtk_widget_show(item);
+ xsane.edit_medium_definition_widget = item;
/* insert separator: */
@@ -4705,12 +4900,16 @@ static void xsane_device_dialog(void)
GtkWidget *xsane_vbox_advanced;
GdkColormap *colormap;
SANE_Status status;
+ SANE_Handle sane_handle;
DBG(DBG_proc, "xsane_device_dialog\n");
devname = xsane.devlist[xsane.selected_dev]->name;
- status = sane_open(devname, (SANE_Handle *) &xsane.dev);
+/* status = sane_open(devname, (SANE_Handle *) &xsane.dev); // old version */
+ status = sane_open(devname, &sane_handle);
+ xsane.dev = sane_handle;
+
if (status != SANE_STATUS_GOOD)
{
snprintf(buf, sizeof(buf), "%s `%s':\n %s.", ERR_DEVICE_OPEN_FAILED, devname, XSANE_STRSTATUS(status));
@@ -4802,7 +5001,6 @@ static void xsane_device_dialog(void)
xsane.device_text = strdup(devicetext);
-
/* if no preferences filename is given on commandline create one from devicenaname */
if (!xsane.device_set_filename)
@@ -5383,27 +5581,27 @@ static void xsane_choose_device(void)
gtk_container_set_border_width(GTK_CONTAINER(hbox), 5);
gtk_widget_show(hbox);
- /* The OK button */
+ /* The Cancel button */
#ifdef HAVE_GTK2
- button = gtk_button_new_from_stock(GTK_STOCK_OK);
+ button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
#else
- button = gtk_button_new_with_label(BUTTON_OK);
+ button = gtk_button_new_with_label(BUTTON_CANCEL);
#endif
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
- g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_choose_dialog_ok_callback, NULL);
+ gtk_widget_add_accelerator(button, "clicked", device_selection_accelerator_group, GDK_Escape, 0, DEF_GTK_ACCEL_LOCKED);
+ g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_exit, NULL);
gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0);
- gtk_widget_grab_default(button);
gtk_widget_show(button);
- /* The Cancel button */
+ /* The OK button */
#ifdef HAVE_GTK2
- button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
+ button = gtk_button_new_from_stock(GTK_STOCK_OK);
#else
- button = gtk_button_new_with_label(BUTTON_CANCEL);
+ button = gtk_button_new_with_label(BUTTON_OK);
#endif
- gtk_widget_add_accelerator(button, "clicked", device_selection_accelerator_group, GDK_Escape, 0, DEF_GTK_ACCEL_LOCKED);
- g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_exit, NULL);
+ GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_choose_dialog_ok_callback, NULL);
gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0);
+ gtk_widget_grab_default(button);
gtk_widget_show(button);
gtk_widget_show(xsane.choose_device_dialog);
@@ -5478,7 +5676,7 @@ static int xsane_init(int argc, char **argv)
{
int ch;
- while((ch = getopt_long(argc, argv, "cd:efghlmnpsvFN:RV", long_options, 0)) != EOF)
+ while((ch = getopt_long(argc, argv, "cd:efghlmnpr:svFN:RV", long_options, 0)) != EOF)
{
switch(ch)
{
@@ -5497,7 +5695,9 @@ static int xsane_init(int argc, char **argv)
g_print(" %s %s\n", TEXT_EMAIL_ADR, XSANE_EMAIL_ADR);
g_print(" %s %s\n", TEXT_PACKAGE, XSANE_PACKAGE_VERSION);
g_print(" %s%d.%d.%d\n", TEXT_GTK_VERSION, GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
-
+#ifdef HAVE_LIBLCMS
+ g_print(" %s\n", TEXT_WITH_CMS_FUNCTION);
+#endif
#ifdef HAVE_ANY_GIMP
g_print(" %s, %s%s\n", TEXT_WITH_GIMP_SUPPORT, TEXT_GIMP_VERSION, GIMP_VERSION);
#else
@@ -5553,6 +5753,10 @@ static int xsane_init(int argc, char **argv)
xsane.device_set_filename = strdup(optarg);
break;
+ case 'r': /* --xsane-rc */
+ xsane.xsane_rc_set_filename = strdup(optarg);
+ break;
+
case 'V': /* --viewer, default */
xsane.xsane_mode = XSANE_VIEWER;
break;
@@ -5606,6 +5810,14 @@ static int xsane_init(int argc, char **argv)
}
}
+ /* if no xsane_rc filename is given on commandline then use "xsane.rc" */
+
+ if (!xsane.xsane_rc_set_filename)
+ {
+ xsane.xsane_rc_set_filename = strdup("xsane"); /* ".rc" is appended later */
+ }
+
+
if (xsane_pref_restore()) /* restore preferences, returns TRUE if license is not accpted yet */
{
if (xsane_display_eula(1)) /* show license and ask for accept/not accept */
@@ -5649,6 +5861,9 @@ static int xsane_init(int argc, char **argv)
device_scanning_dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_position(GTK_WINDOW(device_scanning_dialog), GTK_WIN_POS_CENTER);
gtk_window_set_resizable(GTK_WINDOW(device_scanning_dialog), FALSE);
+/*
+ gtk_window_set_deletable(GTK_WINDOW(device_scanning_dialog), FALSE);
+*/
snprintf(buf, sizeof(buf), "%s %s", xsane.prog_name, XSANE_VERSION);
gtk_window_set_title(GTK_WINDOW(device_scanning_dialog), buf);
g_signal_connect(GTK_OBJECT(device_scanning_dialog), "delete_event", GTK_SIGNAL_FUNC(xsane_quit), NULL);
@@ -5914,11 +6129,13 @@ int main(int argc, char **argv)
xsane.histogram_int = 1;
xsane.histogram_log = 1;
- xsane.xsane_colors = -1; /* unused value to make sure that change of this vlaue is detected */
+ xsane.xsane_channels = -1; /* unused value to make sure that change of this vlaue is detected */
xsane.scanner_gamma_color = FALSE;
xsane.scanner_gamma_gray = FALSE;
xsane.enhancement_rgb_default = TRUE;
+ xsane.enable_color_management = FALSE;
+
xsane.adf_page_counter = 0;
xsane.print_filenames = FALSE;
xsane.force_filename = FALSE;