| 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 |
#ifndef GUTENPRINTUI_INTERNAL_H |
| 28 |
#define GUTENPRINTUI_INTERNAL_H |
| 29 |
|
| 30 |
#ifdef __GNUC__ |
| 31 |
#ifndef inline |
| 32 |
#define inline __inline__ |
| 33 |
#endif |
| 34 |
#endif |
| 35 |
|
| 36 |
#include <sys/types.h> |
| 37 |
|
| 38 |
#include <gutenprintui2/gutenprintui.h> |
| 39 |
#include <gutenprint/gutenprint.h> |
| 40 |
|
| 41 |
typedef struct |
| 42 |
{ |
| 43 |
GtkWidget *checkbox; |
| 44 |
int current; |
| 45 |
int deflt; |
| 46 |
} boolean_option_t; |
| 47 |
|
| 48 |
typedef struct |
| 49 |
{ |
| 50 |
gint callback_id; |
| 51 |
char *default_val; |
| 52 |
stp_string_list_t *params; |
| 53 |
GtkWidget *combo; |
| 54 |
GtkWidget *label; |
| 55 |
} list_option_t; |
| 56 |
|
| 57 |
typedef struct |
| 58 |
{ |
| 59 |
GtkObject *adjustment; |
| 60 |
gfloat upper; |
| 61 |
gfloat lower; |
| 62 |
gfloat deflt; |
| 63 |
gfloat scale; |
| 64 |
} float_option_t; |
| 65 |
|
| 66 |
typedef struct |
| 67 |
{ |
| 68 |
GtkWidget *label; |
| 69 |
GtkWidget *button; |
| 70 |
GtkWidget *dialog; |
| 71 |
GtkWidget *gamma_curve; |
| 72 |
const char *help_text; |
| 73 |
stp_curve_t *current; |
| 74 |
const stp_curve_t *deflt; |
| 75 |
gboolean is_visible; |
| 76 |
} curve_option_t; |
| 77 |
|
| 78 |
typedef struct |
| 79 |
{ |
| 80 |
GtkWidget *f_label; |
| 81 |
GtkWidget *f_entry; |
| 82 |
GtkWidget *f_button; |
| 83 |
GtkWidget *f_browser; |
| 84 |
gboolean f_is_visible; |
| 85 |
} file_option_t; |
| 86 |
|
| 87 |
typedef struct |
| 88 |
{ |
| 89 |
const stp_parameter_t *fast_desc; |
| 90 |
int is_active; |
| 91 |
int is_enabled; |
| 92 |
int reset_all; |
| 93 |
GtkWidget *checkbox; |
| 94 |
GtkWidget *reset_btn; |
| 95 |
union { |
| 96 |
list_option_t list; |
| 97 |
float_option_t flt; |
| 98 |
curve_option_t curve; |
| 99 |
boolean_option_t bool; |
| 100 |
file_option_t file; |
| 101 |
} info; |
| 102 |
} option_t; |
| 103 |
|
| 104 |
typedef struct |
| 105 |
{ |
| 106 |
const char *name; |
| 107 |
const char *help; |
| 108 |
gdouble scale; |
| 109 |
GtkWidget *checkbox; |
| 110 |
const char *format; |
| 111 |
} unit_t; |
| 112 |
|
| 113 |
typedef struct |
| 114 |
{ |
| 115 |
const char *name; |
| 116 |
const char *help; |
| 117 |
const char *value; |
| 118 |
GtkWidget *button; |
| 119 |
} radio_group_t; |
| 120 |
|
| 121 |
typedef struct |
| 122 |
{ |
| 123 |
unsigned char *base_addr; |
| 124 |
const char *output_type; |
| 125 |
int bpp; |
| 126 |
off_t offset; |
| 127 |
off_t limit; |
| 128 |
} priv_t; |
| 129 |
|
| 130 |
#define PLUG_IN_VERSION VERSION " - " RELEASE_DATE |
| 131 |
#define PLUG_IN_NAME "Print" |
| 132 |
|
| 133 |
#define INVALID_TOP 1 |
| 134 |
#define INVALID_LEFT 2 |
| 135 |
|
| 136 |
#define SCALE_ENTRY_LABEL(adj) \ |
| 137 |
GTK_LABEL (gtk_object_get_data (GTK_OBJECT(adj), "label")) |
| 138 |
|
| 139 |
#define SCALE_ENTRY_SCALE(adj) \ |
| 140 |
GTK_HSCALE (gtk_object_get_data (GTK_OBJECT(adj), "scale")) |
| 141 |
#define SCALE_ENTRY_SCALE_ADJ(adj) \ |
| 142 |
gtk_range_get_adjustment \ |
| 143 |
(GTK_RANGE (gtk_object_get_data (GTK_OBJECT (adj), "scale"))) |
| 144 |
|
| 145 |
#define SCALE_ENTRY_SPINBUTTON(adj) \ |
| 146 |
GTK_SPIN_BUTTON (gtk_object_get_data (GTK_OBJECT (adj), "spinbutton")) |
| 147 |
#define SCALE_ENTRY_SPINBUTTON_ADJ(adj) \ |
| 148 |
gtk_spin_button_get_adjustment \ |
| 149 |
(GTK_SPIN_BUTTON (gtk_object_get_data (GTK_OBJECT (adj), "spinbutton"))) |
| 150 |
|
| 151 |
extern gint stpui_plist_count; |
| 152 |
extern gint stpui_plist_current; |
| 153 |
extern stpui_plist_t *stpui_plist; |
| 154 |
extern char *stpui_printrc_current_printer; |
| 155 |
extern int stpui_show_all_paper_sizes; |
| 156 |
extern stp_string_list_t *stpui_system_print_queues; |
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
extern stpui_plist_t *stpui_plist_create(const char *name, const char *driver); |
| 163 |
extern const char *stpui_combo_get_name(GtkWidget *combo, |
| 164 |
const stp_string_list_t *options); |
| 165 |
extern void stpui_table_attach_aligned(GtkTable *table, gint column, |
| 166 |
gint row, const gchar *label_text, |
| 167 |
gfloat xalign, gfloat yalign, |
| 168 |
GtkWidget *widget, gint colspan, |
| 169 |
gboolean left_align); |
| 170 |
|
| 171 |
extern GtkWidget *stpui_create_entry(GtkWidget *table, int hpos, int vpos, |
| 172 |
const char *text, const char *help, |
| 173 |
GCallback callback); |
| 174 |
extern GSList *stpui_create_radio_button(radio_group_t *radio, GSList *group, |
| 175 |
GtkWidget *table, int hpos, int vpos, |
| 176 |
GCallback callback); |
| 177 |
extern void stpui_set_adjustment_tooltip (GtkObject *adj, const gchar *tip); |
| 178 |
extern void stpui_create_new_combo(option_t *option, GtkWidget *table, |
| 179 |
int hpos, int vpos, gboolean is_optional); |
| 180 |
extern void stpui_help_init (void); |
| 181 |
extern void stpui_help_free (void); |
| 182 |
extern void stpui_enable_help (void); |
| 183 |
extern void stpui_disable_help (void); |
| 184 |
extern void stpui_set_help_data (GtkWidget *widget, const gchar *tooltip); |
| 185 |
|
| 186 |
extern GtkWidget *stpui_dialog_new(const gchar *title, |
| 187 |
GtkWindowPosition position, |
| 188 |
gboolean resizable, |
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
...); |
| 199 |
|
| 200 |
extern GtkWidget *stpui_option_menu_new(gboolean menu_only, |
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
...); |
| 210 |
|
| 211 |
extern GtkObject *stpui_scale_entry_new(GtkTable *table, |
| 212 |
gint column, |
| 213 |
gint row, |
| 214 |
const gchar *text, |
| 215 |
gint scale_usize, |
| 216 |
gint spinbutton_usize, |
| 217 |
gfloat value, |
| 218 |
gfloat lower, |
| 219 |
gfloat upper, |
| 220 |
gfloat step_increment, |
| 221 |
gfloat page_increment, |
| 222 |
guint digits, |
| 223 |
gboolean constrain, |
| 224 |
gfloat unconstrained_lower, |
| 225 |
gfloat unconstrained_upper, |
| 226 |
const gchar *tooltip); |
| 227 |
|
| 228 |
extern void stpui_create_scale_entry(option_t *option, |
| 229 |
GtkTable *table, |
| 230 |
gint column, |
| 231 |
gint row, |
| 232 |
const gchar *text, |
| 233 |
gint scale_usize, |
| 234 |
gint spinbutton_usize, |
| 235 |
gfloat value, |
| 236 |
gfloat lower, |
| 237 |
gfloat upper, |
| 238 |
gfloat step_increment, |
| 239 |
gfloat page_increment, |
| 240 |
guint digits, |
| 241 |
gboolean constrain, |
| 242 |
gfloat unconstrained_lower, |
| 243 |
gfloat unconstrained_upper, |
| 244 |
const gchar *tooltip, |
| 245 |
gboolean is_optional); |
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
stp_image_t *stpui_image_thumbnail_new(const guchar *data, gint w, gint h, |
| 251 |
gint bpp); |
| 252 |
|
| 253 |
#pragma GCC diagnostic push |
| 254 |
#pragma GCC diagnostic ignored "-Wpointer-to-int-cast" |
| 255 |
static inline gint |
| 256 |
p2gint(void *p) |
| 257 |
{ |
| 258 |
return (gint) p; |
| 259 |
} |
| 260 |
#pragma GCC diagnostic pop |
| 261 |
|
| 262 |
#pragma GCC diagnostic push |
| 263 |
#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" |
| 264 |
static inline void * |
| 265 |
gint2p(int i) |
| 266 |
{ |
| 267 |
return (gpointer) i; |
| 268 |
} |
| 269 |
#pragma GCC diagnostic pop |
| 270 |
|
| 271 |
#pragma GCC diagnostic ignored "-Woverlength-strings" |
| 272 |
#pragma GCC diagnostic push |
| 273 |
#pragma GCC diagnostic ignored "-Wcast-qual" |
| 274 |
static inline void * |
| 275 |
cast_safe(const void *ptr) |
| 276 |
{ |
| 277 |
return (void *)ptr; |
| 278 |
} |
| 279 |
#pragma GCC diagnostic pop |
| 280 |
|
| 281 |
#endif |