1 /* xsane -- a graphical (X11, gtk) scanner-oriented SANE frontend
2 
3    xsane-back-gtk.h
4 
5    Oliver Rauch <Oliver.Rauch@rauch-domain.de>
6    Copyright (C) 1998-2007 Oliver Rauch
7    This file is part of the XSANE package.
8 
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 2 of the License, or
12    (at your option) any later version.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
22 
23 /* ---------------------------------------------------------------------------------------------------------------------- */
24 
25 #ifndef XSANE_BACK_GTK_H
26 #define XSANE_BACK_GTK_H
27 
28 /* ---------------------------------------------------------------------------------------------------------------------- */
29 
30 #include "xsane.h"
31 #include "xsane-batch-scan.h"
32 
33 /* ---------------------------------------------------------------------------------------------------------------------- */
34 
35 typedef enum
36   {
37     xsane_back_gtk_TL_X,	/* top-left x */
38     xsane_back_gtk_TL_Y,	/* top-left y */
39     xsane_back_gtk_BR_X,	/* bottom-right x */
40     xsane_back_gtk_BR_Y	/* bottom-right y */
41   }
42 CornerCoordinates;
43 
44 /* ---------------------------------------------------------------------------------------------------------------------- */
45 
46 #define XSANE_FILE_FILTER_ALL		1
47 #define XSANE_FILE_FILTER_IMAGES	2
48 #define XSANE_FILE_FILTER_DRC		4
49 #define XSANE_FILE_FILTER_BATCHLIST	8
50 #define XSANE_FILE_FILTER_ICM		16
51 
52 #define XSANE_GET_FILENAME_SHOW_NOTHING 	0
53 #define XSANE_GET_FILENAME_SHOW_FILETYPE 	1
54 #define XSANE_GET_FILENAME_SHOW_CMS_FUNCTION	2
55 
56 
57 typedef enum
58   {
59     XSANE_FILE_CHOOSER_ACTION_OPEN = 1,
60     XSANE_FILE_CHOOSER_ACTION_SELECT_OPEN,
61     XSANE_FILE_CHOOSER_ACTION_SAVE,
62     XSANE_FILE_CHOOSER_ACTION_SELECT_SAVE,
63     XSANE_FILE_CHOOSER_ACTION_SELECT_FOLDER,
64     XSANE_FILE_CHOOSER_ACTION_SELECT_PROJECT
65   }
66 XsaneFileChooserAction;
67 
68 /* ---------------------------------------------------------------------------------------------------------------------- */
69 
70 extern int xsane_back_gtk_message_dialog_active;
71 
72 /* ---------------------------------------------------------------------------------------------------------------------- */
73 
74 extern void xsane_bound_int(int *value, int min, int max);
75 extern void xsane_bound_float(float *value, float min, float max);
76 extern void xsane_bound_double(double *value, double min, double max);
77 extern int xsane_check_bound_double(double value, double min, double max);
78 extern const SANE_Option_Descriptor *xsane_get_option_descriptor(SANE_Handle handle, SANE_Int option);
79 extern SANE_Status xsane_control_option(SANE_Handle handle, SANE_Int option, SANE_Action action, void *val, SANE_Int *info);
80 extern int xsane_back_gtk_make_path(size_t max_len, char *filename_ret, const char *prog_name, const char *dir_name,
81                                     const char *prefix, const char *dev_name, const char *postfix, int local);
82 extern gint xsane_back_gtk_decision(gchar *title, gchar **icon_xpm, gchar *message, gchar *oktext, gchar *rejecttext, int wait);
83 extern void xsane_back_gtk_ipc_dialog_callback(gpointer data, gint source, GdkInputCondition cond);
84 extern void xsane_back_gtk_message(gchar *title, gchar **icon_xpm, gchar *message, int wait);
85 extern void xsane_back_gtk_error(gchar *error_message, int wait);
86 extern void xsane_back_gtk_warning(gchar *warning_message, int wait);
87 extern void xsane_back_gtk_info(gchar *info_message, int wait);
88 extern void xsane_back_gtk_filetype_menu_set_history(GtkWidget *xsane_filetype_option_menu, char *filetype);
89 extern GtkWidget *xsane_back_gtk_filetype_menu_new(char *filetype, GtkSignalFunc filetype_callback);
90 extern GtkWidget *xsane_back_gtk_cms_function_menu_new(int cms_select_function, GtkSignalFunc cms_function_menu_callback);
91 extern int xsane_back_gtk_get_filename(const char *label, const char *default_name, size_t max_len, char *filename, char **filetype, int *cms_function,
92                                        XsaneFileChooserAction action, int show_filetype_menu, int enable_filters, int activate_filter);
93 
94 extern void xsane_back_gtk_update_vector(int opt_num, SANE_Int *vector);
95 extern void xsane_back_gtk_refresh_dialog(void);
96 /* extern void xsane_back_gtk_vector_new(GtkWidget *box, int num_vopts, int *vopts); */
97 extern void xsane_back_gtk_update_scan_window(void);
98 extern void xsane_back_gtk_set_advanced(int advanced);
99 extern void xsane_back_gtk_set_tooltips(int enable);
100 extern void xsane_back_gtk_set_tooltip(GtkTooltips *tooltips, GtkWidget *widget, const char *desc);
101 extern void xsane_back_gtk_set_sensitivity(int sensitive);
102 extern void xsane_set_sensitivity(SANE_Int sensitivity);
103 extern void xsane_back_gtk_destroy_dialog(void);
104 extern void xsane_back_gtk_set_option(int opt_num, void *val, SANE_Action action);
105 extern int xsane_back_gtk_set_option_double(int option, double value);
106 extern int xsane_back_gtk_get_option_double(int option, double *val, SANE_Int *unit);
107 extern void xsane_back_gtk_set_option(int opt_num, void *val, SANE_Action action);
108 extern void xsane_back_gtk_get_batch_parameters(Batch_Scan_Parameters *parameters, SANE_Int *unit);
109 extern void xsane_back_gtk_establish_batch_parameters(Batch_Scan_Parameters *parameters, int panel_rebuild, int set_scanmode, int set_resolution);
110 extern GtkWidget *xsane_back_gtk_group_new (GtkWidget *parent, const char *title);
111 extern void xsane_back_gtk_button_new(GtkWidget *parent, const char *name, SANE_Word val,
112             DialogElement *elem, GtkTooltips *tooltips, const char *desc, SANE_Int settable);
113 extern void xsane_back_gtk_range_new(GtkWidget *parent, const char *name, gfloat val,
114            gfloat min, gfloat max, gfloat quant, int automatic,
115 	   DialogElement *elem, GtkTooltips *tooltips, const char *desc, SANE_Int settable);
116 extern void xsane_back_gtk_value_new(GtkWidget *parent, const char *name, gfloat val,
117 	   gfloat quant, int automatic,
118 	   DialogElement *elem, GtkTooltips *tooltips, const char *desc, SANE_Int settable);
119 extern void xsane_back_gtk_option_menu_new(GtkWidget *parent, const char *name, char *str_list[],
120            const char *val, DialogElement *elem, GtkTooltips *tooltips, const char *desc, SANE_Int settable);
121 extern void xsane_back_gtk_text_entry_new(GtkWidget *parent, const char *name, const char *val,
122                 DialogElement *elem, GtkTooltips *tooltips, const char *desc, SANE_Int settable);
123 extern void xsane_back_gtk_push_button_callback(GtkWidget *widget, gpointer data);
124 extern const char *xsane_back_gtk_unit_string(SANE_Unit unit);
125 extern void xsane_set_window_icon(GtkWidget *gtk_window, gchar **xpm_d);
126 
127 #endif
128