summaryrefslogtreecommitdiff
path: root/src/gutenprintui2/gutenprintui-internal.h
blob: af3caae2565fa7c53ece521fefe20e9d0bc78469 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
/*
 * "$Id: gutenprintui-internal.h,v 1.3 2005/09/17 21:54:33 rlk Exp $"
 *
 *   Print plug-in for the GIMP.
 *
 *   Copyright 1997-2000 Michael Sweet (mike@easysw.com),
 *	Robert Krawitz (rlk@alum.mit.edu). and Steve Miller (smiller@rni.net
 *
 *   This program is free software; you can redistribute it and/or modify it
 *   under the terms of the GNU General Public License as published by the Free
 *   Software Foundation; either version 2 of the License, or (at your option)
 *   any later version.
 *
 *   This program is distributed in the hope that it will be useful, but
 *   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 *   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 *   for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 *
 * Revision History:
 *
 *   See ChangeLog
 */

#ifndef GUTENPRINTUI_INTERNAL_H
#define GUTENPRINTUI_INTERNAL_H

#ifdef __GNUC__
#define inline __inline__
#endif

#include <sys/types.h>
#include <gtk/gtk.h>

#include <gutenprint/gutenprint.h>

typedef struct
{
  GtkWidget *checkbox;
  int current;
  int deflt;
} boolean_option_t;

typedef struct
{
  gint callback_id;
  char *default_val;
  stp_string_list_t *params;
  GtkWidget *combo;
  GtkWidget *label;
} list_option_t;

typedef struct
{
  GtkObject *adjustment;
  gfloat upper;
  gfloat lower;
  gfloat deflt;
  gfloat scale;
} float_option_t;

typedef struct
{
  GtkWidget *label;
  GtkWidget *button;
  GtkWidget *dialog;
  GtkWidget *gamma_curve;
  const char *help_text;
  stp_curve_t *current;
  const stp_curve_t *deflt;
  gboolean is_visible;
} curve_option_t;

typedef struct
{
  const stp_parameter_t *fast_desc;
  int is_active;
  int is_enabled;
  GtkWidget *checkbox;
  union {
    list_option_t list;
    float_option_t flt;
    curve_option_t curve;
    boolean_option_t bool;
  } info;
} option_t;

typedef struct
{
  const char *name;
  const char *help;
  gdouble scale;
  GtkWidget *checkbox;
  const char *format;
} unit_t;

typedef struct
{
  const char *name;
  const char *help;
  const char *value;
  GtkWidget *button;
} radio_group_t;

typedef struct
{
  unsigned char *base_addr;
  const char *output_type;
  int bpp;
  off_t offset;
  off_t limit;
} priv_t;

#define PLUG_IN_VERSION		VERSION " - " RELEASE_DATE
#define PLUG_IN_NAME		"Print"

#define INVALID_TOP 1
#define INVALID_LEFT 2

#define SCALE_ENTRY_LABEL(adj) \
        GTK_LABEL (gtk_object_get_data (GTK_OBJECT(adj), "label"))

#define SCALE_ENTRY_SCALE(adj) \
        GTK_HSCALE (gtk_object_get_data (GTK_OBJECT(adj), "scale"))
#define SCALE_ENTRY_SCALE_ADJ(adj) \
        gtk_range_get_adjustment \
        (GTK_RANGE (gtk_object_get_data (GTK_OBJECT (adj), "scale")))

#define SCALE_ENTRY_SPINBUTTON(adj) \
        GTK_SPIN_BUTTON (gtk_object_get_data (GTK_OBJECT (adj), "spinbutton"))
#define SCALE_ENTRY_SPINBUTTON_ADJ(adj) \
        gtk_spin_button_get_adjustment \
        (GTK_SPIN_BUTTON (gtk_object_get_data (GTK_OBJECT (adj), "spinbutton")))

extern gint stpui_plist_count;	   /* Number of system printers */
extern gint stpui_plist_current;     /* Current system printer */
extern stpui_plist_t *stpui_plist;		  /* System printers */
extern char *stpui_printrc_current_printer;
extern int stpui_show_all_paper_sizes;
extern stp_string_list_t *stpui_system_print_queues;

/*
 * Function prototypes
 */

extern stpui_plist_t *stpui_plist_create(const char *name, const char *driver);
extern const char *stpui_combo_get_name(GtkWidget   *combo,
					const stp_string_list_t *options);
extern void stpui_table_attach_aligned(GtkTable *table, gint column,
				       gint row, const gchar *label_text,
				       gfloat xalign, gfloat yalign,
				       GtkWidget *widget, gint colspan,
				       gboolean left_align);

extern GtkWidget *stpui_create_entry(GtkWidget *table, int hpos, int vpos,
				     const char *text, const char *help,
				     GCallback callback);
extern GSList *stpui_create_radio_button(radio_group_t *radio, GSList *group,
					 GtkWidget *table, int hpos, int vpos,
					 GCallback callback);
extern void stpui_set_adjustment_tooltip (GtkObject *adj, const gchar *tip);
extern void stpui_create_new_combo(option_t *option, GtkWidget *table,
				   int hpos, int vpos, gboolean is_optional);
extern void stpui_help_init (void);
extern void stpui_help_free (void);
extern void stpui_enable_help (void);
extern void stpui_disable_help (void);
extern void stpui_set_help_data (GtkWidget *widget, const gchar *tooltip);

extern GtkWidget *stpui_dialog_new(const gchar       *title,
				   GtkWindowPosition  position,
				   gboolean           resizable,
				   /* specify action area buttons as va_list:
				    *  const gchar    *label,
				    *  GtkSignalFunc   callback,
				    *  gpointer        data,
				    *  GtkObject      *slot_object,
				    *  GtkWidget     **widget_ptr,
				    *  gboolean        default_action,
				    *  gboolean        connect_delete,
				    */
				   ...);

extern GtkWidget *stpui_option_menu_new(gboolean            menu_only,
					/* specify menu items as va_list:
					 *  const gchar    *label,
					 *  GtkSignalFunc   callback,
					 *  gpointer        data,
					 *  gpointer        user_data,
					 *  GtkWidget     **widget_ptr,
					 *  gboolean        active
					 */
					...);

extern GtkObject *stpui_scale_entry_new(GtkTable    *table,
					gint         column,
					gint         row,
					const gchar *text,
					gint         scale_usize,
					gint         spinbutton_usize,
					gfloat       value,
					gfloat       lower,
					gfloat       upper,
					gfloat       step_increment,
					gfloat       page_increment,
					guint        digits,
					gboolean     constrain,
					gfloat       unconstrained_lower,
					gfloat       unconstrained_upper,
					const gchar *tooltip);

extern void stpui_create_scale_entry(option_t    *option,
				     GtkTable    *table,
				     gint         column,
				     gint         row,
				     const gchar *text,
				     gint         scale_usize,
				     gint         spinbutton_usize,
				     gfloat       value,
				     gfloat       lower,
				     gfloat       upper,
				     gfloat       step_increment,
				     gfloat       page_increment,
				     guint        digits,
				     gboolean     constrain,
				     gfloat       unconstrained_lower,
				     gfloat       unconstrained_upper,
				     const gchar *tooltip,
				     gboolean     is_optional);


/* Thumbnails -- keep it simple! */

stp_image_t *stpui_image_thumbnail_new(const guchar *data, gint w, gint h,
				       gint bpp);

#endif  /* GUTENPRINTUI_INTERNAL_H */