1 /*
2  *
3  *   Print plug-in for the GIMP.
4  *
5  *   Copyright 1997-2000 Michael Sweet (mike@easysw.com),
6  *	Robert Krawitz (rlk@alum.mit.edu). and Steve Miller (smiller@rni.net
7  *
8  *   This program is free software; you can redistribute it and/or modify it
9  *   under the terms of the GNU General Public License as published by the Free
10  *   Software Foundation; either version 2 of the License, or (at your option)
11  *   any later version.
12  *
13  *   This program is distributed in the hope that it will be useful, but
14  *   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15  *   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16  *   for more details.
17  *
18  *   You should have received a copy of the GNU General Public License
19  *   along with this program.  If not, see <https://www.gnu.org/licenses/>.
20  *
21  *
22  * Revision History:
23  *
24  *   See ChangeLog
25  */
26 
27 #ifndef GUTENPRINTUI_H
28 #define GUTENPRINTUI_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 
35 #ifdef __GNUC__
36 #ifndef inline
37 #define inline __inline__
38 #endif
39 #endif
40 
41 #pragma GCC diagnostic push
42 #pragma GCC diagnostic ignored "-Wstrict-prototypes"
43 #pragma GCC diagnostic ignored "-Wredundant-decls"
44 #pragma GCC diagnostic ignored "-Wunused-function"
45 #pragma GCC diagnostic ignored "-Wcast-qual"
46 #pragma GCC diagnostic ignored "-Wpedantic"
47 #include <gtk/gtk.h>
48 #pragma GCC diagnostic pop
49 
50 #include <gutenprint/gutenprint.h>
51 
52 #include <gutenprintui2/curve.h>
53 #include <gutenprintui2/gammacurve.h>
54 #include <gutenprintui2/typebuiltins.h>
55 
56 /*
57  * All Gimp-specific code is in this file.
58  */
59 
60 typedef enum
61 {
62   ORIENT_AUTO = -1,
63   ORIENT_PORTRAIT = 0,
64   ORIENT_LANDSCAPE = 1,
65   ORIENT_UPSIDEDOWN = 2,
66   ORIENT_SEASCAPE = 3
67 } orient_t;
68 
69 /*
70  * If this is changed, command_options[] in panel.c must be appropriately
71  * updated.
72  */
73 typedef enum
74 {
75   COMMAND_TYPE_DEFAULT,
76   COMMAND_TYPE_CUSTOM,
77   COMMAND_TYPE_FILE
78 } command_t;
79 
80 typedef struct		/**** Printer List ****/
81 {
82   char		*name;		/* Name of printer */
83   command_t	command_type;
84   char		*queue_name;
85   char		*extra_printer_options;
86   char		*custom_command;
87   char		*current_standard_command;
88   char		*output_filename;
89   float		scaling;      /* Scaling, percent of printable area */
90   orient_t	orientation;
91   int		unit;	  /* Units for preview area 0=Inch 1=Metric */
92   int		auto_size_roll_feed_paper;
93   int		invalid_mask;
94   stp_vars_t	*v;
95 } stpui_plist_t;
96 
97 typedef struct stpui_image
98 {
99   stp_image_t im;
100   void (*transpose)(struct stpui_image *image);
101   void (*hflip)(struct stpui_image *image);
102   void (*vflip)(struct stpui_image *image);
103   void (*rotate_ccw)(struct stpui_image *image);
104   void (*rotate_cw)(struct stpui_image *image);
105   void (*rotate_180)(struct stpui_image *image);
106   void (*crop)(struct stpui_image *image, int left, int top,
107 	       int right, int bottom);
108 } stpui_image_t;
109 
110 /*
111  * Function prototypes
112  */
113 extern void stpui_plist_set_name(stpui_plist_t *p, const char *val);
114 extern void stpui_plist_set_name_n(stpui_plist_t *p, const char *val, int n);
115 extern const char *stpui_plist_get_name(const stpui_plist_t *p);
116 
117 extern void stpui_plist_set_queue_name(stpui_plist_t *p, const char *val);
118 extern void stpui_plist_set_queue_name_n(stpui_plist_t *p, const char *val, int n);
119 extern const char *stpui_plist_get_queue_name(const stpui_plist_t *p);
120 
121 extern void stpui_plist_set_output_filename(stpui_plist_t *p, const char *val);
122 extern void stpui_plist_set_output_filename_n(stpui_plist_t *p, const char *val, int n);
123 extern const char *stpui_plist_get_output_filename(const stpui_plist_t *p);
124 
125 extern void stpui_plist_set_extra_printer_options(stpui_plist_t *p, const char *val);
126 extern void stpui_plist_set_extra_printer_options_n(stpui_plist_t *p, const char *val, int n);
127 extern const char *stpui_plist_get_extra_printer_options(const stpui_plist_t *p);
128 
129 extern void stpui_plist_set_custom_command(stpui_plist_t *p, const char *val);
130 extern void stpui_plist_set_custom_command_n(stpui_plist_t *p, const char *val, int n);
131 extern const char *stpui_plist_get_custom_command(const stpui_plist_t *p);
132 
133 extern void stpui_plist_set_copy_count(stpui_plist_t *p, gint count);
134 extern int stpui_plist_get_copy_count(const stpui_plist_t *p);
135 
136 extern void stpui_plist_set_current_standard_command(stpui_plist_t *p, const char *val);
137 extern void stpui_plist_set_current_standard_command_n(stpui_plist_t *p, const char *val, int n);
138 extern const char *stpui_plist_get_current_standard_command(const stpui_plist_t *p);
139 
140 extern void stpui_plist_set_command_type(stpui_plist_t *p, command_t val);
141 extern command_t stpui_plist_get_command_type(const stpui_plist_t *p);
142 
143 extern void stpui_set_global_parameter(const char *param, const char *value);
144 extern const char *stpui_get_global_parameter(const char *param);
145 
146 extern void stpui_plist_copy(stpui_plist_t *vd, const stpui_plist_t *vs);
147 extern int stpui_plist_add(const stpui_plist_t *key, int add_only);
148 extern void stpui_printer_initialize(stpui_plist_t *printer);
149 extern const stpui_plist_t *stpui_get_current_printer(void);
150 
151 extern char *stpui_build_standard_print_command(const stpui_plist_t *plist,
152 						const stp_printer_t *printer);
153 
154 extern void stpui_set_printrc_file(const char *name);
155 extern const char * stpui_get_printrc_file(void);
156 extern void stpui_printrc_load (void);
157 extern void stpui_get_system_printers (void);
158 extern void stpui_printrc_save (void);
159 extern void stpui_set_image_filename(const char *);
160 extern const char *stpui_get_image_filename(void);
161 extern void stpui_set_errfunc(stp_outfunc_t wfunc);
162 extern stp_outfunc_t stpui_get_errfunc(void);
163 extern void stpui_set_errdata(void *errdata);
164 extern void *stpui_get_errdata(void);
165 
166 extern gint stpui_do_print_dialog (void);
167 
168 extern gint stpui_compute_orientation(void);
169 extern void stpui_set_image_dimensions(gint width, gint height);
170 extern void stpui_set_image_resolution(gdouble xres, gdouble yres);
171 extern void stpui_set_image_type(const char *image_type);
172 extern void stpui_set_image_raw_channels(gint channels);
173 extern void stpui_set_image_channel_depth(gint bit_depth);
174 
175 typedef guchar *(*get_thumbnail_func_t)(void *data, gint *width, gint *height,
176 					gint *bpp, gint page);
177 extern void stpui_set_thumbnail_func(get_thumbnail_func_t);
178 extern get_thumbnail_func_t stpui_get_thumbnail_func(void);
179 extern void stpui_set_thumbnail_data(void *);
180 extern void *stpui_get_thumbnail_data(void);
181 
182 extern int stpui_print(const stpui_plist_t *printer, stpui_image_t *im);
183 
184 
185 #ifdef __cplusplus
186   }
187 #endif
188 
189 #endif  /* GUTENPRINTUI_H */
190