summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJulien BLACHE <jblache@debian.org>2005-12-03 14:51:29 +0100
committerMattia Rizzolo <mattia@mapreri.org>2014-10-03 14:05:16 +0000
commitf1ab1663d876dc4a57a5c60f0c741957972f6036 (patch)
treef039caca02b838f1a0d33a70cc77f68247e3b933 /src
parent91e0f8f4872781ae41c44747330935d6420534e6 (diff)
parent947f2ec5da522dbe5b474fc7031cd3f224bd7ead (diff)
Imported Debian patch 0.98b-1debian/0.98b-1
Diffstat (limited to 'src')
-rw-r--r--src/.xsane-front-gtk.h.swpbin0 -> 16384 bytes
-rw-r--r--src/xsane-front-gtk.c1
-rw-r--r--src/xsane-front-gtk.h4
-rw-r--r--src/xsane-save.c2
-rw-r--r--src/xsane-scan.c48
-rw-r--r--src/xsane.c43
-rw-r--r--src/xsane.h2
7 files changed, 55 insertions, 45 deletions
diff --git a/src/.xsane-front-gtk.h.swp b/src/.xsane-front-gtk.h.swp
new file mode 100644
index 0000000..d971345
--- /dev/null
+++ b/src/.xsane-front-gtk.h.swp
Binary files differ
diff --git a/src/xsane-front-gtk.c b/src/xsane-front-gtk.c
index 2bf0fd9..3e9196c 100644
--- a/src/xsane-front-gtk.c
+++ b/src/xsane-front-gtk.c
@@ -24,6 +24,7 @@
#include "xsane.h"
#include "xsane-back-gtk.h"
+#include "xsane-front-gtk.h"
#include "xsane-preferences.h"
#include "xsane-preview.h"
#include "xsane-save.h"
diff --git a/src/xsane-front-gtk.h b/src/xsane-front-gtk.h
index 19aad87..53d63a6 100644
--- a/src/xsane-front-gtk.h
+++ b/src/xsane-front-gtk.h
@@ -35,7 +35,7 @@
extern int xsane_parse_options(char *options, char *argv[]);
extern void xsane_get_bounds(const SANE_Option_Descriptor *opt, double *minp, double *maxp);
extern double xsane_find_best_resolution(int well_known_option, double dpi);
-extern int xsane_set_resolution(int well_known_option, double resolution);
+extern double xsane_set_resolution(int well_known_option, double resolution);
extern void xsane_set_all_resolutions(void);
extern void xsane_define_maximum_output_size();
extern void xsane_close_dialog_callback(GtkWidget *widget, gpointer data);
@@ -77,7 +77,7 @@ extern void xsane_define_output_filename(void);
extern int xsane_identify_output_format(char *filename, char *filetype, char **ext);
extern void xsane_change_working_directory(void);
extern int xsane_display_eula(int ask_for_accept);
-extern int xsane_display_gpl(void);
+extern void xsane_display_gpl(void);
extern void xsane_window_get_position(GtkWidget *gtk_window, gint *x, gint *y);
extern void xsane_widget_test_uposition(GtkWidget *gtk_window);
extern int xsane_front_gtk_getname_dialog(const char *dialog_title, const char *desc_text, char *oldname, char **newname);
diff --git a/src/xsane-save.c b/src/xsane-save.c
index decd85a..2567898 100644
--- a/src/xsane-save.c
+++ b/src/xsane-save.c
@@ -4707,7 +4707,7 @@ static void xsane_gimp_run(char *name, int nparams, GimpParam *param, int *nretu
run_mode = param[0].data.d_int32;
xsane.mode = XSANE_GIMP_EXTENSION;
- preferences.xsane_mode = XSANE_SAVE;
+ xsane.xsane_mode = XSANE_SAVE;
*nreturn_vals = 1;
*return_vals = values;
diff --git a/src/xsane-scan.c b/src/xsane-scan.c
index 73953fe..7888a16 100644
--- a/src/xsane-scan.c
+++ b/src/xsane-scan.c
@@ -82,9 +82,9 @@ static int xsane_generate_dummy_filename(int conversion_level)
}
if ( (xsane.mode == XSANE_GIMP_EXTENSION) ||
- (preferences.xsane_mode == XSANE_COPY) ||
- (preferences.xsane_mode == XSANE_VIEWER) ||
- ( (preferences.xsane_mode == XSANE_SAVE) &&
+ (xsane.xsane_mode == XSANE_COPY) ||
+ (xsane.xsane_mode == XSANE_VIEWER) ||
+ ( (xsane.xsane_mode == XSANE_SAVE) &&
(xsane.xsane_output_format != XSANE_PNM) &&
(xsane.xsane_output_format != XSANE_RGBA) ) )
{
@@ -99,14 +99,14 @@ static int xsane_generate_dummy_filename(int conversion_level)
return TRUE;
}
- else if (preferences.xsane_mode == XSANE_FAX) /* no conversion following, save directly to the selected filename */
+ else if (xsane.xsane_mode == XSANE_FAX) /* no conversion following, save directly to the selected filename */
{
xsane.dummy_filename = strdup(xsane.fax_filename);
DBG(DBG_info, "xsane.dummy_filename = %s\n", xsane.dummy_filename);
return FALSE;
}
- else if (preferences.xsane_mode == XSANE_MAIL) /* no conversion following, save directly to the selected filename */
+ else if (xsane.xsane_mode == XSANE_MAIL) /* no conversion following, save directly to the selected filename */
{
xsane.dummy_filename = strdup(xsane.mail_filename);
DBG(DBG_info, "xsane.dummy_filename = %s\n", xsane.dummy_filename);
@@ -1185,13 +1185,13 @@ void xsane_scan_done(SANE_Status status)
}
}
- if (preferences.xsane_mode == XSANE_VIEWER)
+ if (xsane.xsane_mode == XSANE_VIEWER)
{
xsane_viewer_new(xsane.dummy_filename, TRUE, NULL, VIEWER_FULL_MODIFICATION);
xsane.expand_lineart_to_grayscale = 0;
}
- if ((preferences.xsane_mode == XSANE_FAX) || (preferences.xsane_mode == XSANE_MAIL))
+ if ((xsane.xsane_mode == XSANE_FAX) || (xsane.xsane_mode == XSANE_MAIL))
{
xsane.expand_lineart_to_grayscale = 0;
}
@@ -1207,7 +1207,7 @@ void xsane_scan_done(SANE_Status status)
}
}
- if (preferences.xsane_mode == XSANE_SAVE)
+ if (xsane.xsane_mode == XSANE_SAVE)
{
if ( ( (xsane.xsane_output_format != XSANE_PNM) && /* these files do not need any transformation */
(xsane.xsane_output_format != XSANE_RGBA) ) ||
@@ -1259,7 +1259,7 @@ void xsane_scan_done(SANE_Status status)
}
}
}
- else if (preferences.xsane_mode == XSANE_COPY)
+ else if (xsane.xsane_mode == XSANE_COPY)
{
FILE *outfile;
FILE *infile;
@@ -1378,7 +1378,7 @@ void xsane_scan_done(SANE_Status status)
}
}
- if ( (preferences.xsane_mode == XSANE_SAVE) && (xsane.mode == XSANE_STANDALONE) )
+ if ( (xsane.xsane_mode == XSANE_SAVE) && (xsane.mode == XSANE_STANDALONE) )
{
if (!xsane.force_filename) /* user filename selection active */
{
@@ -1395,7 +1395,7 @@ void xsane_scan_done(SANE_Status status)
xsane_update_counter_in_filename(&xsane.external_filename, TRUE, 1, 0);
}
}
- else if (preferences.xsane_mode == XSANE_FAX)
+ else if (xsane.xsane_mode == XSANE_FAX)
{
GtkWidget *list_item;
char *page;
@@ -1437,7 +1437,7 @@ void xsane_scan_done(SANE_Status status)
gtk_progress_bar_update(GTK_PROGRESS_BAR(xsane.fax_progress_bar), 0.0);
}
#ifdef XSANE_ACTIVATE_MAIL
- else if (preferences.xsane_mode == XSANE_MAIL)
+ else if (xsane.xsane_mode == XSANE_MAIL)
{
GtkWidget *list_item;
char *page;
@@ -1628,9 +1628,9 @@ static void xsane_start_scan(void)
}
if ((xsane.param.depth == 1) && ((xsane.scan_rotation) ||
- (preferences.xsane_mode == XSANE_VIEWER) ||
- (preferences.xsane_mode == XSANE_FAX) ||
- (preferences.xsane_mode == XSANE_MAIL))
+ (xsane.xsane_mode == XSANE_VIEWER) ||
+ (xsane.xsane_mode == XSANE_FAX) ||
+ (xsane.xsane_mode == XSANE_MAIL))
) /* We want to do a transformation with a lineart scan */
/* or use the viewer to display a lineart scan, */
/* so we save it as grayscale */
@@ -1755,7 +1755,7 @@ void xsane_scan_dialog(void)
sane_get_parameters(xsane.dev, &xsane.param); /* update xsane.param */
- if ( (xsane.mode == XSANE_STANDALONE) && (preferences.xsane_mode == XSANE_SAVE) )
+ if ( (xsane.mode == XSANE_STANDALONE) && (xsane.xsane_mode == XSANE_SAVE) )
{
/* correct length of filename counter if it is shorter than minimum length */
if (!xsane.force_filename)
@@ -1776,7 +1776,7 @@ void xsane_scan_dialog(void)
{
char *extension;
- if ( (preferences.xsane_mode == XSANE_SAVE) && (preferences.overwrite_warning) ) /* test if filename already used */
+ if ( (xsane.xsane_mode == XSANE_SAVE) && (preferences.overwrite_warning) ) /* test if filename already used */
{
FILE *testfile;
@@ -1798,7 +1798,7 @@ void xsane_scan_dialog(void)
xsane.xsane_output_format = xsane_identify_output_format(xsane.output_filename, preferences.filetype, &extension);
- if (preferences.xsane_mode == XSANE_SAVE)
+ if (xsane.xsane_mode == XSANE_SAVE)
{
if (xsane.xsane_output_format == XSANE_UNKNOWN)
{
@@ -1863,7 +1863,7 @@ void xsane_scan_dialog(void)
}
#endif
- if (preferences.xsane_mode == XSANE_FAX)
+ if (xsane.xsane_mode == XSANE_FAX)
{
mkdir(preferences.fax_project, 7*64 + 0*8 + 0);
}
@@ -1953,7 +1953,7 @@ void xsane_scan_dialog(void)
xsane.gamma_data_green = malloc(gamma_green_size * sizeof(SANE_Int));
xsane.gamma_data_blue = malloc(gamma_blue_size * sizeof(SANE_Int));
- if (preferences.xsane_mode == XSANE_COPY)
+ if (xsane.xsane_mode == XSANE_COPY)
{
gamma_red = xsane.gamma * xsane.gamma_red * preferences.printer[preferences.printernr]->gamma * preferences.printer[preferences.printernr]->gamma_red;
gamma_green = xsane.gamma * xsane.gamma_green * preferences.printer[preferences.printernr]->gamma * preferences.printer[preferences.printernr]->gamma_green;
@@ -2013,7 +2013,7 @@ void xsane_scan_dialog(void)
gamma_gray_size = opt->size / sizeof(opt->type);
gamma_gray_max = opt->constraint.range->max;
- if (preferences.xsane_mode == XSANE_COPY)
+ if (xsane.xsane_mode == XSANE_COPY)
{
gamma = xsane.gamma * preferences.printer[preferences.printernr]->gamma;
}
@@ -2087,7 +2087,7 @@ static void xsane_create_internal_gamma_tables(void)
xsane.gamma_data_green = malloc(size * sizeof(SANE_Int));
xsane.gamma_data_blue = malloc(size * sizeof(SANE_Int));
- if (preferences.xsane_mode == XSANE_COPY)
+ if (xsane.xsane_mode == XSANE_COPY)
{
gamma_red = xsane.gamma_red * preferences.printer[preferences.printernr]->gamma_red;
gamma_green = xsane.gamma_green * preferences.printer[preferences.printernr]->gamma_green;
@@ -2128,7 +2128,7 @@ static void xsane_create_internal_gamma_tables(void)
xsane.gamma_data_green = malloc(size * sizeof(SANE_Int));
xsane.gamma_data_blue = malloc(size * sizeof(SANE_Int));
- if (preferences.xsane_mode == XSANE_COPY)
+ if (xsane.xsane_mode == XSANE_COPY)
{
gamma_red = xsane.gamma * xsane.gamma_red * preferences.printer[preferences.printernr]->gamma * preferences.printer[preferences.printernr]->gamma_red;
gamma_green = xsane.gamma * xsane.gamma_green * preferences.printer[preferences.printernr]->gamma * preferences.printer[preferences.printernr]->gamma_green;
@@ -2173,7 +2173,7 @@ static void xsane_create_internal_gamma_tables(void)
DBG(DBG_info, "creating xsane internal gray gamma table with size %d\n", size);
- if (preferences.xsane_mode == XSANE_COPY)
+ if (xsane.xsane_mode == XSANE_COPY)
{
gamma = xsane.gamma * preferences.printer[preferences.printernr]->gamma;
}
diff --git a/src/xsane.c b/src/xsane.c
index d7cb4d0..30e093c 100644
--- a/src/xsane.c
+++ b/src/xsane.c
@@ -328,7 +328,7 @@ static void xsane_set_modus_defaults(void)
{
DBG(DBG_proc, "xsane_set_modus_defaults\n");
- switch(preferences.xsane_mode)
+ switch(xsane.xsane_mode)
{
case XSANE_VIEWER:
xsane_define_maximum_output_size();
@@ -398,23 +398,24 @@ static void xsane_modus_callback(GtkWidget *xsane_parent, int *num)
{
DBG(DBG_proc, "xsane_modus_callback\n");
+ xsane.xsane_mode = *num;
preferences.xsane_mode = *num;
xsane_set_modus_defaults(); /* set defaults and maximum output size */
xsane_refresh_dialog();
- if ((preferences.xsane_mode == XSANE_SAVE) || (preferences.xsane_mode == XSANE_VIEWER) || (preferences.xsane_mode == XSANE_COPY))
+ if ((xsane.xsane_mode == XSANE_SAVE) || (xsane.xsane_mode == XSANE_VIEWER) || (xsane.xsane_mode == XSANE_COPY))
{
gtk_widget_set_sensitive(GTK_WIDGET(xsane.start_button), TRUE);
}
- if (preferences.xsane_mode != XSANE_FAX)
+ if (xsane.xsane_mode != XSANE_FAX)
{
xsane_fax_dialog_close();
}
#ifdef XSANE_ACTIVATE_MAIL
- if (preferences.xsane_mode != XSANE_MAIL)
+ if (xsane.xsane_mode != XSANE_MAIL)
{
if (xsane.mail_project_save)
{
@@ -1206,7 +1207,7 @@ static void xsane_scanmode_menu_callback(GtkWidget *widget, gpointer data)
opt = xsane_get_option_descriptor(xsane.dev, opt_num);
xsane_back_gtk_set_option(opt_num, menu_item->label, SANE_ACTION_SET_VALUE);
- if (preferences.xsane_mode == XSANE_COPY)
+ if (xsane.xsane_mode == XSANE_COPY)
{
switch (xsane.param.format)
{
@@ -1336,7 +1337,7 @@ GtkWidget *xsane_update_xsane_callback() /* creates the XSane option window */
xsane_back_gtk_set_tooltip(xsane.tooltips, xsane_modus_option_menu, DESC_XSANE_MODE);
gtk_box_pack_end(GTK_BOX(xsane_hbox_xsane_modus), xsane_modus_option_menu, FALSE, FALSE, 2);
gtk_option_menu_set_menu(GTK_OPTION_MENU(xsane_modus_option_menu), xsane_modus_menu);
- gtk_option_menu_set_history(GTK_OPTION_MENU(xsane_modus_option_menu), preferences.xsane_mode);
+ gtk_option_menu_set_history(GTK_OPTION_MENU(xsane_modus_option_menu), xsane.xsane_mode);
gtk_widget_show(xsane_modus_option_menu);
gtk_widget_show(xsane_hbox_xsane_modus);
@@ -1495,7 +1496,7 @@ GtkWidget *xsane_update_xsane_callback() /* creates the XSane option window */
}
- if (preferences.xsane_mode == XSANE_SAVE)
+ if (xsane.xsane_mode == XSANE_SAVE)
{
xsane.copy_number_entry = NULL;
@@ -1505,7 +1506,7 @@ GtkWidget *xsane_update_xsane_callback() /* creates the XSane option window */
}
}
- if ( (preferences.xsane_mode == XSANE_SAVE) || (preferences.xsane_mode == XSANE_VIEWER) )
+ if ( (xsane.xsane_mode == XSANE_SAVE) || (xsane.xsane_mode == XSANE_VIEWER) )
{
/* resolution selection */
if (!xsane_resolution_widget_new(xsane_vbox_xsane_modus, xsane.well_known.dpi_x, &xsane.resolution_x, resolution_x_xpm,
@@ -1520,7 +1521,7 @@ GtkWidget *xsane_update_xsane_callback() /* creates the XSane option window */
DESC_RESOLUTION, XSANE_GTK_NAME_RESOLUTION);
}
}
- else if (preferences.xsane_mode == XSANE_COPY)
+ else if (xsane.xsane_mode == XSANE_COPY)
{
GtkWidget *pixmapwidget, *hbox, *xsane_printer_option_menu, *xsane_printer_menu, *xsane_printer_item;
GdkBitmap *mask;
@@ -1677,7 +1678,7 @@ GtkWidget *xsane_update_xsane_callback() /* creates the XSane option window */
xsane.resolution, zoom_xpm, DESC_ZOOM);
}
}
- else if (preferences.xsane_mode == XSANE_FAX)
+ else if (xsane.xsane_mode == XSANE_FAX)
{
xsane.copy_number_entry = NULL;
@@ -1689,7 +1690,7 @@ GtkWidget *xsane_update_xsane_callback() /* creates the XSane option window */
xsane_fax_dialog();
}
#ifdef XSANE_ACTIVATE_MAIL
- else if (preferences.xsane_mode == XSANE_MAIL)
+ else if (xsane.xsane_mode == XSANE_MAIL)
{
xsane.copy_number_entry = NULL;
@@ -2126,6 +2127,14 @@ static int xsane_pref_restore(void)
}
}
+ if (xsane.mode != XSANE_GIMP_EXTENSION)
+ {
+ if (xsane.xsane_mode < 0)
+ {
+ xsane.xsane_mode = preferences.xsane_mode;
+ }
+ }
+
return result;
}
@@ -8726,23 +8735,23 @@ static int xsane_init(int argc, char **argv)
break;
case 'V': /* --viewer, default */
- preferences.xsane_mode = XSANE_VIEWER;
+ xsane.xsane_mode = XSANE_VIEWER;
break;
case 's': /* --save */
- preferences.xsane_mode = XSANE_SAVE;
+ xsane.xsane_mode = XSANE_SAVE;
break;
case 'c': /* --copy */
- preferences.xsane_mode = XSANE_COPY;
+ xsane.xsane_mode = XSANE_COPY;
break;
case 'f': /* --fax */
- preferences.xsane_mode = XSANE_FAX;
+ xsane.xsane_mode = XSANE_FAX;
break;
case 'm': /* --mail */
- preferences.xsane_mode = XSANE_MAIL;
+ xsane.xsane_mode = XSANE_MAIL;
break;
case 'n': /* --No-mode-selection */
@@ -9009,7 +9018,7 @@ int main(int argc, char **argv)
xsane.main_window_fixed = -1; /* no command line option given, use preferences or fixed */
xsane.mode = XSANE_STANDALONE;
- preferences.xsane_mode = XSANE_VIEWER;
+ xsane.xsane_mode = -1;
xsane.lineart_mode = XSANE_LINEART_STANDARD;
xsane.xsane_output_format = XSANE_PNM;
xsane.mode_selection = 1; /* enable selection of xsane mode */
diff --git a/src/xsane.h b/src/xsane.h
index d26a89c..339cb49 100644
--- a/src/xsane.h
+++ b/src/xsane.h
@@ -711,7 +711,7 @@ typedef struct Xsane
/* saving and transformation values: */
FILE *out;
-// int xsane_mode;
+ int xsane_mode;
int xsane_output_format;
long header_size;
int expand_lineart_to_grayscale;