summaryrefslogtreecommitdiff
path: root/src/xsane.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/xsane.h')
-rw-r--r--src/xsane.h364
1 files changed, 284 insertions, 80 deletions
diff --git a/src/xsane.h b/src/xsane.h
index 579bb0c..b54ee50 100644
--- a/src/xsane.h
+++ b/src/xsane.h
@@ -3,7 +3,7 @@
xsane.h
Oliver Rauch <Oliver.Rauch@rauch-domain.de>
- Copyright (C) 1998-2002 Oliver Rauch
+ Copyright (C) 1998-2005 Oliver Rauch
This file is part of the XSANE package.
This program is free software; you can redistribute it and/or modify
@@ -27,53 +27,13 @@
/* ---------------------------------------------------------------------------------------------------------------------- */
-/* #define XSANE_TEST */
-/* #define SUPPORT_RGBA */
-
-/* ---------------------------------------------------------------------------------------------------------------------- */
-
-#define XSANE_VERSION "0.84"
-#define XSANE_AUTHOR "Oliver Rauch"
-#define XSANE_COPYRIGHT "Oliver Rauch"
-#define XSANE_DATE "1998-2002"
-#define XSANE_EMAIL "Oliver.Rauch@xsane.org"
-#define XSANE_HOMEPAGE "http://www.xsane.org"
-#define XSANE_COPYRIGHT_TXT XSANE_DATE " " XSANE_COPYRIGHT
-
-/* ---------------------------------------------------------------------------------------------------------------------- */
-
-#define XSANE_DEBUG_ENVIRONMENT "XSANE_DEBUG"
-
-#define XSANE_DEFAULT_UMASK 0007
-#define XSANE_HOLD_TIME 200
-#define XSANE_CONTINUOUS_HOLD_TIME 10
-#define XSANE_DEFAULT_DEVICE "SANE_DEFAULT_DEVICE"
-
-#ifndef SLASH
-# define SLASH '/'
-#endif
-
-#ifndef XSANE_FIXED_HOME_PATH
-# define XSANE_FIXED_HOME_PATH /tmp
-#endif
-
-#ifndef ENVIRONMENT_HOME_DIR_NAME
-# define ENVIRONMENT_HOME_DIR_NAME HOME
-#endif
-
-#ifndef ENVIRONMENT_TEMP_DIR_NAME
-# define ENVIRONMENT_TEMP_DIR_NAME TMP
-#endif
-
-/* ---------------------------------------------------------------------------------------------------------------------- */
-
/* needed for most of the xsane sources: */
#ifdef _AIX
# include <lalloca.h>
#endif
-#ifdef __hpux
+#if defined(__hpux) || defined(__sgi)
# include <alloca.h>
#endif
@@ -92,25 +52,213 @@
#include <getopt.h>
#include <time.h>
-#include <sys/stat.h>
+/* OS/2 want sys/types before sys/stat */
#include <sys/types.h>
+#include <sys/stat.h>
#include <locale.h>
#include <sane/sane.h>
#include <sane/saneopts.h>
+#include "xsaneopts.h"
#include "../include/config.h"
#include "../include/sanei_signal.h"
+#include <gdk/gdkkeysyms.h>
+#include <gdk/gdk.h>
+#include <gtk/gtk.h>
+
+/* ---------------------------------------------------------------------------------------------------------------------- */
+
+#if 0
+#define DEF_GTK_ACCEL_LOCKED 0
+#else
+#define DEF_GTK_ACCEL_LOCKED GTK_ACCEL_LOCKED
+#endif
+
+/* ---------------------------------------------------------------------------------------------------------------------- */
+
+/* #define XSANE_TEST */
+/* #define SUPPORT_RGBA */
+/* #define HAVE_WORKING_GTK_GAMMACURVE */
+
+/* ---------------------------------------------------------------------------------------------------------------------- */
+
+#define XSANE_VERSION "0.97"
+#define XSANE_AUTHOR "Oliver Rauch"
+#define XSANE_COPYRIGHT "Oliver Rauch"
+#define XSANE_DATE "1998-2005"
+#define XSANE_EMAIL "Oliver.Rauch@xsane.org"
+#define XSANE_HOMEPAGE "http://www.xsane.org"
+#define XSANE_COPYRIGHT_TXT XSANE_DATE " " XSANE_COPYRIGHT
+
+/* ---------------------------------------------------------------------------------------------------------------------- */
+
+#define XSANE_DEBUG_ENVIRONMENT "XSANE_DEBUG"
+
+#define XSANE_DEFAULT_UMASK 0007
+#define XSANE_HOLD_TIME 200
+#define XSANE_CONTINUOUS_HOLD_TIME 10
+#define XSANE_DEFAULT_DEVICE "SANE_DEFAULT_DEVICE"
+#define XSANE_3PASS_BUFFER_RGB_SIZE 1024
+
+#ifdef HAVE_WINDOWS_H
+# define BUGGY_GDK_INPUT_EXCEPTION
+# define _WIN32
+#endif
+
+#ifdef HAVE_LIBPNG
+#ifdef HAVE_LIBZ
+# define XSANE_DEFAULT_MAILTYPE XSANE_FILETYPE_PNG
+# define XSANE_ACTIVATE_MAIL
+#endif
+#endif
+
+#ifndef XSANE_DEFAULT_MAILTYPE
+#ifdef HAVE_LIBJPEG
+# define XSANE_DEFAULT_MAILTYPE XSANE_FILETYPE_JPEG
+# define XSANE_ACTIVATE_MAIL
+#endif
+#endif
+
+#ifndef XSANE_DEFAULT_MAILTYPE
+#ifdef HAVE_LIBTIFF
+# define XSANE_DEFAULT_MAILTYPE XSANE_FILETYPE_TIFF
+# define XSANE_ACTIVATE_MAIL
+#endif
+#endif
+
+#ifndef XSANE_DEFAULT_MAILTYPE
+# define XSANE_DEFAULT_MAILTYPE XSANE_FILETYPE_PNM
+#endif
+
+
+/* ---------------------------------------------------------------------------------------------------------------------- */
+
+#ifndef SLASH
+# ifdef _WIN32
+# define SLASH '\\'
+# elif defined(HAVE_OS2_H)
+# define SLASH '\\'
+# else
+# define SLASH '/'
+# endif
+#endif
+
+/* *** NOT USED IN THE MOMENT. MAY BE USED LATER *** */
+/* ************************************************* */
+#ifndef XSANE_FIXED_HOME_DIR
+# ifdef _WIN32
+# define XSANE_FIXED_HOME_DIR c:\\SANE-Images
+# elif defined(HAVE_OS2_H)
+# define XSANE_FIXED_HOME_DIR c:\\SANE-Images
+# else
+# define XSANE_FIXED_HOME_DIR /tmp
+# endif
+#endif
+
+/* *** FIXED_APPDATA_DIR is used when the environment variable *** */
+/* *** ENVIRONMENT_APPDATA_DIR_NAME does not exist. It is used *** */
+/* *** to store the configuration files of xsane. *** */
+/* *************************************************************** */
+#ifndef XSANE_FIXED_APPDATA_DIR
+# ifdef _WIN32
+# define XSANE_FIXED_APPDATA_DIR c:\\SANE
+# elif defined(HAVE_OS2_H)
+# define XSANE_FIXED_APPDATA_DIR c:\\SANE
+# else
+# define XSANE_FIXED_APPDATA_DIR /tmp
+# endif
+#endif
+
+/* *** NOT USED IN THE MOMENT. MAY BE USED LATER *** */
+/* ************************************************* */
+#ifndef ENVIRONMENT_HOME_DIR_NAME
+# ifdef _WIN32
+# define ENVIRONMENT_HOME_DIR_NAME HOME
+# elif defined(HAVE_OS2_H)
+# define ENVIRONMENT_HOME_DIR_NAME HOME
+# else
+# define ENVIRONMENT_HOME_DIR_NAME HOME
+# endif
+#endif
+
+/* *** ENVIRONMENT_APPDATA_DIR_NAME is used to store the *** */
+/* *** configuration files of xsane. *** */
+/* *************************************************************** */
+#ifndef ENVIRONMENT_APPDATA_DIR_NAME
+# ifdef _WIN32
+# define ENVIRONMENT_APPDATA_DIR_NAME APPDATA
+# elif defined(HAVE_OS2_H)
+# define ENVIRONMENT_APPDATA_DIR_NAME HOME
+# else
+# define ENVIRONMENT_APPDATA_DIR_NAME HOME
+# endif
+#endif
+
+/* *** NOT USED IN THE MOMENT. MAY BE USED LATER *** */
+/* ************************************************* */
+#ifndef ENVIRONMENT_SYSTEMROOT_DIR_NAME
+# ifdef _WIN32
+/* SYSTEMROOT is used on WIN2K and WINXP */
+# define ENVIRONMENT_SYSTEMROOT_DIR_NAME_1 SYSTEMROOT
+# define ENVIRONMENT_SYSTEMROOT_DIR_NAME_2 WINDIR
+/* WINDIR is used on WIN98 and WINME */
+# elif defined(HAVE_OS2_H)
+# define ENVIRONMENT_SYSTEMROOT_DIR_NAME_1 NONE
+# define ENVIRONMENT_SYSTEMROOT_DIR_NAME_2 NONE
+# else
+# define ENVIRONMENT_SYSTEMROOT_DIR_NAME_1 NONE
+# define ENVIRONMENT_SYSTEMROOT_DIR_NAME_2 NONE
+# endif
+#endif
+
+#ifndef ENVIRONMENT_TEMP_DIR_NAME
+# define ENVIRONMENT_TEMP_DIR_NAME TMP
+#endif
+
+#ifndef ENVIRONMENT_BROWSER_NAME
+# define ENVIRONMENT_BROWSER_NAME BROWSER
+#endif
+
+/* *** DEFAULT_BROWSER is used when environment variable *** */
+/* *** BROWSER is not defined at first startup of xsane. *** */
+/* *************************************************************** */
+#ifndef DEFAULT_BROWSER
+# ifdef _WIN32
+# define DEFAULT_BROWSER "iexplore.exe"
+# elif defined(HAVE_OS2_H)
+# define DEFAULT_BROWSER "netscape"
+# else
+# define DEFAULT_BROWSER "netscape"
+# endif
+#endif
+
+/* ---------------------------------------------------------------------------------------------------------------------- */
+
#include "xsane-text.h"
#include "xsane-fixedtext.h"
#include "xsane-icons.h"
#include "xsane-viewer.h"
-#include <gdk/gdkkeysyms.h>
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
+/* ---------------------------------------------------------------------------------------------------------------------- */
+
+#if GTK_MAJOR_VERSION == 2
+# define HAVE_GTK2
+# ifndef _WIN32
+# define USE_GTK2_WINDOW_GET_POSITION
+# endif
+#endif
+
+#ifdef HAVE_GTK2
+# define HAVE_GTK_TEXT_VIEW_H
+# define DEF_GTK_MENU_ACCEL_VISIBLE GTK_ACCEL_VISIBLE
+#else /* we don't have gtk+-2.0 */
+# include "xsane-gtk-1_x-compat.h"
+#endif
+
+/* ---------------------------------------------------------------------------------------------------------------------- */
#ifdef ENABLE_NLS
# include <libintl.h>
@@ -133,14 +281,8 @@
/* ---------------------------------------------------------------------------------------------------------------------- */
-#ifdef HAVE_LIBPNG
-#ifdef HAVE_LIBZ
-# define XSANE_ACTIVATE_MAIL
-#endif
-#endif
-
-#ifdef _WIN32
-# define BUGGY_GTK_TOOLTIPS_SET_COLORS
+#ifdef HAVE_OS2_H
+# define strcasecmp stricmp
#endif
/* ---------------------------------------------------------------------------------------------------------------------- */
@@ -164,6 +306,7 @@ typedef struct
} pref_default_preset_area_t;
/* ---------------------------------------------------------------------------------------------------------------------- */
+
typedef struct
{
/* The option number of the well-known options. Each of these may
@@ -189,30 +332,34 @@ typedef struct
int shadow_r;
int shadow_g;
int shadow_b;
+ int batch_scan_start;
+ int batch_scan_loop;
+ int batch_scan_end;
+ int batch_scan_next_tl_y;
}
-GSGWellKnownOptions;
+WellKnownOptions;
/* ---------------------------------------------------------------------------------------------------------------------- */
typedef struct
{
gchar *label;
- struct GSGDialogElement *elem;
+ struct DialogElement *elem;
gint index;
}
-GSGMenuItem;
+MenuItem;
/* ---------------------------------------------------------------------------------------------------------------------- */
-typedef struct GSGDialogElement
+typedef struct DialogElement
{
- GtkWidget *automatic; /* auto button for options that support this */
GtkWidget *widget;
+ GtkWidget *widget2;
GtkObject *data;
int menu_size; /* # of items in menu (if any) */
- GSGMenuItem *menu;
+ MenuItem *menu;
}
-GSGDialogElement;
+DialogElement;
/* ---------------------------------------------------------------------------------------------------------------------- */
@@ -243,6 +390,8 @@ typedef struct Image_info
double contrast_blue;
double threshold;
+
+ int reduce_to_lineart;
}
Image_info;
@@ -252,30 +401,34 @@ Image_info;
/* ---------------------------------------------------------------------------------------------------------------------- */
-#ifdef HAVE_LIBGIMP_GIMP_H
+#ifdef HAVE_ANY_GIMP
# include <libgimp/gimp.h>
-# ifdef HAVE_LIBGIMP_GIMPFEATURES_H
-# include <libgimp/gimpfeatures.h>
+# ifdef HAVE_GIMP_2
+# define GIMP_HAVE_RESOLUTION_INFO
# else
-# define GIMP_CHECK_VERSION(major, minor, micro) 0
-# endif /* HAVE_LIBGIMP_GIMPFEATURES_H */
+# ifdef HAVE_LIBGIMP_GIMPFEATURES_H
+# include <libgimp/gimpfeatures.h>
+# else
+# define GIMP_CHECK_VERSION(major, minor, micro) 0
+# endif /* HAVE_LIBGIMP_GIMPFEATURES_H */
+# endif
# ifdef GIMP_CHECK_VERSION
# if GIMP_CHECK_VERSION(1,1,25)
-/* ok, we have the new gimp interface */
+/* ok, we have the gimp-1.2 or gimp-2.0 interface */
# else
-/* we have the old gimp interface and need the compatibility header file */
+/* we have the gimp-1.0 interface and need the compatibility header file */
# include "xsane-gimp-1_0-compat.h"
# endif
# else
-/* we have the old gimp interface and need the compatibility header file */
+/* we have the gimp-1.0 interface and need the compatibility header file */
# include "xsane-gimp-1_0-compat.h"
# endif
extern GimpPlugInInfo PLUG_IN_INFO; /* needed for win32 */
-#endif /* HAVE_LIBGIMP_GIMP_H */
+#endif /* HAVE_ANY_GIMP */
/* ---------------------------------------------------------------------------------------------------------------------- */
@@ -288,6 +441,7 @@ extern void xsane_pref_save(void);
extern void xsane_interface(int argc, char **argv);
extern void xsane_fax_project_save(void);
extern void xsane_mail_project_save(void);
+extern void xsane_batch_scan_add(void);
/* ---------------------------------------------------------------------------------------------------------------------- */
@@ -311,18 +465,20 @@ extern void xsane_mail_project_save(void);
#define FAXNORMALOPT "-l"
#define FAXFINEOPT "-m"
#define FAXVIEWER "gv"
+#define FAXCONVERTPSTOPNM "gs -dNOPAUSE -dBATCH -q -r204 -sDEVICE=pnm -sOutputFile="
#define MAILPROJECT "mailproject"
#define MAILCOMMAND "sendmail"
#define MAILVIEWER "xv"
#define OCRCOMMAND "gocr"
#define OCRINPUTFILEOPT "-i"
#define OCROUTPUTFILEOPT "-o"
-#define DOCVIEWER_NETSCAPE "netscape"
-#define DOCVIEWER DOCVIEWER_NETSCAPE
+#define OCROUTFDOPT "-x"
+#define OCRPROGRESSKEY ""
+#define BROWSER_NETSCAPE "netscape"
#define XSANE_MEDIUM_CALIB_BRIGHTNESS_MIN -1000.0
#define XSANE_MEDIUM_CALIB_BRIGHTNESS_MAX 1000.0
-#define XSANE_MEDIUM_CALIB_CONTRAST_MIN 0.0
+#define XSANE_MEDIUM_CALIB_CONTRAST_MIN -1000.0
#define XSANE_MEDIUM_CALIB_CONTRAST_MAX 1000.0
#define XSANE_BRIGHTNESS_MIN -100.0
@@ -344,6 +500,8 @@ extern void xsane_mail_project_save(void);
#define XSANE_HISTOGRAM_POS_Y 50
#define XSANE_GAMMA_POS_X 280
#define XSANE_GAMMA_POS_Y 420
+#define XSANE_BATCH_POS_X 480
+#define XSANE_BATCH_POS_Y 420
#define XSANE_STD_OPTIONS_POS_X 1
#define XSANE_STD_OPTIONS_POS_Y 400
#define XSANE_ADV_OPTIONS_POS_X 280
@@ -376,7 +534,7 @@ extern void xsane_mail_project_save(void);
enum
{
XSANE_UNKNOWN, XSANE_PNM, XSANE_JPEG, XSANE_PNG, XSANE_PS, XSANE_TIFF, XSANE_RGBA,
- XSANE_RAW16, XSANE_PNM16
+ XSANE_RAW16, XSANE_PNM16, XSANE_TEXT
};
/* ---------------------------------------------------------------------------------------------------------------------- */
@@ -409,12 +567,20 @@ typedef struct XsaneSlider
/* ---------------------------------------------------------------------------------------------------------------------- */
+typedef struct XsaneChildprocess
+{
+ pid_t pid;
+ struct XsaneChildprocess *next;
+} XsaneChildprocess;
+
+/* ---------------------------------------------------------------------------------------------------------------------- */
+
typedef struct Xsane
{
SANE_Int sane_backend_versioncode;
char *backend;
+ char *backend_translation;
char *device_set_filename;
- char *filetype;
char *output_filename;
char *dummy_filename;
@@ -436,15 +602,22 @@ typedef struct Xsane
SANE_Handle *dev;
const char *dev_name;
- GSGWellKnownOptions well_known;
+ WellKnownOptions well_known;
int num_elements;
- GSGDialogElement *element;
+ DialogElement *element;
u_int rebuild : 1;
int pixelcolor;
int scanning;
int reading_data;
int cancel_scan;
+ int batch_scan_load_default_list; /* load default list at program startup flag */
+ int batch_loop; /* is set when batch scanning and not last scan */
+ int batch_scan_use_stored_scanmode;
+ int batch_scan_use_stored_resolution;
+ int batch_scan_use_stored_bit_depth;
+ SANE_Status status_of_last_scan;
+
/* free gamma curve widgets */
GtkWidget *gamma_curve_gray;
GtkWidget *gamma_curve_red;
@@ -470,13 +643,21 @@ typedef struct Xsane
GtkWidget *histogram_dialog;
GtkWidget *gamma_dialog;
+ GtkWidget *batch_scan_dialog;
+ GtkWidget *batch_scan_button_box;
+ GtkWidget *batch_scan_action_box;
+ GtkWidget *batch_scan_list;
+ GtkAdjustment *batch_scan_vadjustment;
+
GtkWidget *fax_dialog;
GtkWidget *fax_list;
GtkWidget *fax_project_box;
GtkWidget *fax_project_exists;
GtkWidget *fax_project_not_exists;
GtkWidget *fax_project_entry;
+ GtkWidget *fax_project_entry_box;
GtkWidget *fax_receiver_entry;
+ GtkProgressBar *fax_progress_bar;
GtkWidget *mail_dialog;
GtkWidget *mail_list;
@@ -484,11 +665,12 @@ typedef struct Xsane
GtkWidget *mail_project_exists;
GtkWidget *mail_project_not_exists;
GtkWidget *mail_project_entry;
+ GtkWidget *mail_project_entry_box;
GtkWidget *mail_receiver_entry;
GtkWidget *mail_subject_entry;
GtkWidget *mail_text_widget;
GtkWidget *mail_html_mode_widget;
- GtkWidget *mail_status_label;
+ GtkProgressBar *mail_progress_bar;
GdkPixmap *window_icon_pixmap;
GdkBitmap *window_icon_mask;
@@ -508,16 +690,22 @@ typedef struct Xsane
int main_window_fixed;
int mode_selection;
+#ifndef USE_GTK2_WINDOW_GET_POSITION
int get_deskrelative_origin;
+#endif
/* various scanning related state: */
SANE_Int depth;
size_t num_bytes;
size_t bytes_read;
+ int read_offset_16;
+ char last_offset_16_byte;
+ int lineart_to_grayscale_x;
GtkProgressBar *progress_bar;
int input_tag;
SANE_Parameters param;
int adf_page_counter;
+ int scan_rotation;
/* for standalone mode: */
GtkWidget *filename_entry;
@@ -539,6 +727,7 @@ typedef struct Xsane
struct XsaneSlider slider_red;
struct XsaneSlider slider_green;
struct XsaneSlider slider_blue;
+ guint batch_scan_gamma_timer; /* has to be guint */
guint slider_timer; /* has to be guint */
int slider_timer_restart;
@@ -597,6 +786,7 @@ typedef struct Xsane
GtkWidget *show_preview_widget;
GtkWidget *show_histogram_widget;
GtkWidget *show_gamma_widget;
+ GtkWidget *show_batch_scan_widget;
GtkWidget *show_standard_options_widget;
GtkWidget *show_advanced_options_widget;
GtkWidget *show_resolution_list_widget;
@@ -619,7 +809,6 @@ typedef struct Xsane
SANE_Bool scanner_gamma_color;
SANE_Bool scanner_gamma_gray;
- int fax_fine_mode;
int mail_project_save;
int mail_html_mode;
@@ -632,15 +821,20 @@ typedef struct Xsane
u_char *histogram_gamma_data_red, *histogram_gamma_data_green, *histogram_gamma_data_blue;
u_char *histogram_medium_gamma_data_red, *histogram_medium_gamma_data_green, *histogram_medium_gamma_data_blue;
+ char *fax_status;
char *fax_filename;
char *fax_receiver;
+ float mail_progress_val;
+ int mail_progress_size;
+ int mail_progress_bytes;
char *mail_status;
char *mail_filename;
char *mail_receiver;
char *mail_subject;
int block_update_param;
+ int block_enhancement_update;
int broken_pipe; /* for printercommand pipe */
@@ -667,6 +861,8 @@ typedef struct Xsane
int histogram_dialog_posy;
int gamma_dialog_posx;
int gamma_dialog_posy;
+ int batch_dialog_posx;
+ int batch_dialog_posy;
int preview_dialog_posx;
int preview_dialog_posy;
int preview_dialog_width;
@@ -724,6 +920,9 @@ typedef struct Xsane
/* -------------------------------------------------- */
+ int ipc_pipefd[2]; /* for inter process communication error messages */
+ XsaneChildprocess *childprocess_list;
+
} Xsane;
extern struct Xsane xsane;
@@ -753,6 +952,7 @@ typedef struct XsaneSetup
GtkWidget *overwrite_warning_button;
GtkWidget *increase_filename_counter_button;
GtkWidget *skip_existing_numbers_button;
+ GtkWidget *save_pnm16_as_ascii_button;
GtkWidget *reduce_16bit_to_8bit_button;
GtkWidget *main_window_fixed_button;
@@ -773,7 +973,7 @@ typedef struct XsaneSetup
GtkWidget *disable_gimp_preview_gamma_button;
GtkWidget *preview_oversampling_entry;
GtkWidget *preview_own_cmap_button;
- GtkWidget *doc_viewer_entry;
+ GtkWidget *browser_entry;
GtkWidget *fax_command_entry;
GtkWidget *fax_receiver_option_entry;
@@ -801,6 +1001,9 @@ typedef struct XsaneSetup
GtkWidget *ocr_command_entry;
GtkWidget *ocr_inputfile_option_entry;
GtkWidget *ocr_outputfile_option_entry;
+ GtkWidget *ocr_use_gui_pipe_entry;
+ GtkWidget *ocr_gui_outfd_option_entry;
+ GtkWidget *ocr_progress_keyword_entry;
int filename_counter_len;
@@ -808,6 +1011,7 @@ typedef struct XsaneSetup
int tiff_compression8_nr;
int tiff_compression1_nr;
+ int show_range_mode;
int lineart_mode;
int image_permissions;