1 /*
2  *  object-editor-private.h
3  *  Copyright (C) 2003-2009  Jim Evins <evins@snaught.com>.
4  *
5  *  This file is part of gLabels.
6  *
7  *  gLabels is free software: you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation, either version 3 of the License, or
10  *  (at your option) any later version.
11  *
12  *  gLabels is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef __OBJECT_EDITOR_PRIVATE_H__
22 #define __OBJECT_EDITOR_PRIVATE_H__
23 
24 #include <gtk/gtk.h>
25 #include "label-barcode.h"
26 
27 G_BEGIN_DECLS
28 
29 struct _glObjectEditorPrivate {
30 
31 	GtkBuilder *builder;
32 	GtkWidget  *editor_vbox;
33 
34         glLabel        *label;
35         glLabelObject  *object;
36 
37 	gdouble     units_per_point;
38 
39 	GtkWidget  *title_image;
40 	GtkWidget  *title_label;
41 	GtkWidget  *notebook;
42 
43 	GtkWidget  *pos_page_vbox;
44 	GtkWidget  *pos_x_spin;
45 	GtkWidget  *pos_y_spin;
46 	GtkWidget  *pos_x_units_label;
47 	GtkWidget  *pos_y_units_label;
48 	gdouble     x;
49 	gdouble     y;
50 	gdouble     x_max;
51 	gdouble     y_max;
52 
53 	GtkWidget  *size_page_vbox;
54 	GtkWidget  *size_w_spin;
55 	GtkWidget  *size_h_spin;
56 	GtkWidget  *size_w_units_label;
57 	GtkWidget  *size_h_units_label;
58 	GtkWidget  *size_aspect_vbox;
59 	GtkWidget  *size_aspect_checkbutton;
60 	GtkWidget  *size_reset_image_button;
61 	gdouble     size_aspect_ratio;
62 	gdouble     w;
63 	gdouble     h;
64 	gdouble     w_max;
65 	gdouble     h_max;
66 	gdouble     w_base;
67 	gdouble     h_base;
68 
69 	GtkWidget  *lsize_page_vbox;
70 	GtkWidget  *lsize_r_spin;
71 	GtkWidget  *lsize_theta_spin;
72 	GtkWidget  *lsize_r_units_label;
73 	gdouble     dx;
74 	gdouble     dy;
75 	gdouble     dx_max;
76 	gdouble     dy_max;
77 
78 	GtkWidget  *fill_page_vbox;
79 	GtkWidget  *fill_color_hbox;
80 	GtkWidget  *fill_color_combo;
81 	GtkWidget  *fill_key_hbox;
82 	GtkWidget  *fill_key_combo;
83 	GtkWidget  *fill_key_radio;
84 	GtkWidget  *fill_color_radio;
85 
86 	GtkWidget  *line_page_vbox;
87 	GtkWidget  *line_width_spin;
88 	GtkWidget  *line_color_radio;
89 	GtkWidget  *line_color_hbox;
90 	GtkWidget  *line_color_combo;
91 	GtkWidget  *line_key_radio;
92 	GtkWidget  *line_key_hbox;
93 	GtkWidget  *line_key_combo;
94 
95 	GtkWidget  *img_page_vbox;
96 	GtkWidget  *img_file_radio;
97 	GtkWidget  *img_key_radio;
98 	GtkWidget  *img_file_button;
99 	GtkWidget  *img_key_hbox;
100 	GtkWidget  *img_key_combo;
101 
102 	GtkWidget  *text_page_vbox;
103 	GtkWidget  *text_family_hbox;
104 	GtkWidget  *text_family_combo;
105 	GtkWidget  *text_size_spin;
106 	GtkWidget  *text_bold_toggle;
107 	GtkWidget  *text_italic_toggle;
108 	GtkWidget  *text_color_radio;
109 	GtkWidget  *text_color_hbox;
110 	GtkWidget  *text_color_combo;
111 	GtkWidget  *text_color_key_radio;
112 	GtkWidget  *text_color_key_hbox;
113 	GtkWidget  *text_color_key_combo;
114 	GtkWidget  *text_left_toggle;
115 	GtkWidget  *text_center_toggle;
116 	GtkWidget  *text_right_toggle;
117 	GtkWidget  *text_top_toggle;
118 	GtkWidget  *text_vcenter_toggle;
119 	GtkWidget  *text_bottom_toggle;
120 	GtkWidget  *text_line_spacing_spin;
121 	GtkWidget  *text_auto_shrink_check;
122 
123 	GtkWidget  *edit_page_vbox;
124 	GtkWidget  *edit_text_view;
125 	GtkWidget  *edit_insert_field_vbox;
126 	GtkWidget  *edit_insert_field_button;
127 
128 	GtkWidget  *bc_page_vbox;
129 	GtkWidget  *bc_backend_combo_hbox;
130 	GtkWidget  *bc_backend_combo;
131 	GtkWidget  *bc_style_combo_hbox;
132 	GtkWidget  *bc_style_combo;
133 	GtkWidget  *bc_text_check;
134 	GtkWidget  *bc_cs_check;
135 	GtkWidget  *bc_color_radio;
136 	GtkWidget  *bc_color_hbox;
137 	GtkWidget  *bc_color_combo;
138 	GtkWidget  *bc_key_radio;
139 	GtkWidget  *bc_key_hbox;
140 	GtkWidget  *bc_key_combo;
141         gchar      *current_backend_id;
142 
143 	GtkWidget  *data_page_vbox;
144 	GtkWidget  *data_literal_radio;
145 	GtkWidget  *data_key_radio;
146 	GtkWidget  *data_text_entry;
147 	GtkWidget  *data_key_hbox;
148 	GtkWidget  *data_key_combo;
149 	GtkWidget  *data_format_label;
150 	GtkWidget  *data_ex_label;
151 	GtkWidget  *data_digits_label;
152 	GtkWidget  *data_digits_spin;
153 	gboolean    data_format_fixed_flag;
154 
155 	GtkWidget  *shadow_page_vbox;
156 	GtkWidget  *shadow_enable_check;
157 	GtkWidget  *shadow_controls_table;
158 	GtkWidget  *shadow_x_spin;
159 	GtkWidget  *shadow_y_spin;
160 	GtkWidget  *shadow_x_units_label;
161 	GtkWidget  *shadow_y_units_label;
162 	GtkWidget  *shadow_color_radio;
163 	GtkWidget  *shadow_key_radio;
164 	GtkWidget  *shadow_color_hbox;
165 	GtkWidget  *shadow_color_combo;
166 	GtkWidget  *shadow_key_hbox;
167 	GtkWidget  *shadow_key_combo;
168 	GtkWidget  *shadow_opacity_spin;
169 	gdouble     shadow_x;
170 	gdouble     shadow_y;
171 	gdouble     shadow_x_max;
172 	gdouble     shadow_y_max;
173 
174 };
175 
176 enum {
177 	CHANGED,
178 	SIZE_CHANGED,
179 	LAST_SIGNAL
180 };
181 
182 extern gint gl_object_editor_signals[LAST_SIGNAL];
183 
184 
185 
186 void gl_object_editor_prepare_position_page     (glObjectEditor        *editor);
187 
188 void gl_object_editor_prepare_size_page         (glObjectEditor        *editor);
189 
190 void gl_object_editor_prepare_lsize_page        (glObjectEditor        *editor);
191 
192 void gl_object_editor_prepare_fill_page         (glObjectEditor        *editor);
193 
194 void gl_object_editor_prepare_line_page         (glObjectEditor        *editor);
195 
196 void gl_object_editor_prepare_image_page        (glObjectEditor        *editor);
197 
198 void gl_object_editor_prepare_text_page         (glObjectEditor        *editor);
199 
200 void gl_object_editor_prepare_edit_page         (glObjectEditor        *editor);
201 
202 void gl_object_editor_prepare_bc_page           (glObjectEditor        *editor);
203 
204 void gl_object_editor_prepare_data_page         (glObjectEditor        *editor);
205 
206 void gl_object_editor_prepare_shadow_page       (glObjectEditor        *editor);
207 
208 
209 void gl_object_editor_changed_cb                (glObjectEditor        *editor);
210 void gl_object_editor_size_changed_cb           (glObjectEditor        *editor);
211 
212 void lsize_prefs_changed_cb                     (glObjectEditor        *editor);
213 void size_prefs_changed_cb                      (glObjectEditor        *editor);
214 void position_prefs_changed_cb                  (glObjectEditor        *editor);
215 void shadow_prefs_changed_cb                    (glObjectEditor        *editor);
216 
217 
218 /*
219  * Position Page
220  */
221 void        gl_object_editor_set_position         (glObjectEditor      *editor,
222 						   gdouble              x,
223 						   gdouble              y);
224 
225 void        gl_object_editor_set_max_position     (glObjectEditor      *editor,
226 						   gdouble              x_max,
227 						   gdouble              y_max);
228 
229 void        gl_object_editor_get_position         (glObjectEditor      *editor,
230 						   gdouble             *x,
231 						   gdouble             *y);
232 
233 /*
234  * Size Page
235  */
236 void        gl_object_editor_set_size             (glObjectEditor      *editor,
237 						   gdouble              w,
238 						   gdouble              h);
239 
240 void        gl_object_editor_set_max_size         (glObjectEditor      *editor,
241 						   gdouble              w_max,
242 						   gdouble              h_max);
243 
244 void        gl_object_editor_set_base_size        (glObjectEditor      *editor,
245 						   gdouble              w_max,
246 						   gdouble              h_max);
247 
248 void        gl_object_editor_get_size             (glObjectEditor      *editor,
249 						   gdouble             *w,
250 						   gdouble             *h);
251 
252 
253 /*
254  * Line Size Page
255  */
256 void        gl_object_editor_set_lsize            (glObjectEditor      *editor,
257 						   gdouble              dx,
258 						   gdouble              dy);
259 
260 void        gl_object_editor_set_max_lsize        (glObjectEditor      *editor,
261 						   gdouble              dx_max,
262 						   gdouble              dy_max);
263 
264 void        gl_object_editor_get_lsize            (glObjectEditor      *editor,
265 						   gdouble             *dx,
266 						   gdouble             *dy);
267 
268 
269 /*
270  * Fill Page
271  */
272 void        gl_object_editor_set_fill_color       (glObjectEditor      *editor,
273 						   gboolean             merge_flag,
274 						   glColorNode         *color_node);
275 
276 glColorNode* gl_object_editor_get_fill_color      (glObjectEditor      *editor);
277 
278 
279 /*
280  * Line/Outline Page
281  */
282 void        gl_object_editor_set_line_color       (glObjectEditor      *editor,
283 						   gboolean             merge_flag,
284 						   glColorNode         *color_node);
285 
286 glColorNode* gl_object_editor_get_line_color      (glObjectEditor      *editor);
287 
288 void        gl_object_editor_set_line_width       (glObjectEditor      *editor,
289 						   gdouble              width);
290 
291 gdouble     gl_object_editor_get_line_width       (glObjectEditor      *editor);
292 
293 
294 /*
295  * Image Page
296  */
297 void        gl_object_editor_set_image            (glObjectEditor      *editor,
298 						   gboolean             merge_flag,
299 						   glTextNode          *text_node);
300 
301 glTextNode *gl_object_editor_get_image            (glObjectEditor      *editor);
302 
303 
304 /*
305  * Text Page
306  */
307 void        gl_object_editor_set_font_family      (glObjectEditor      *editor,
308 						   const gchar         *font_family);
309 
310 gchar      *gl_object_editor_get_font_family      (glObjectEditor      *editor);
311 
312 void        gl_object_editor_set_font_size        (glObjectEditor      *editor,
313 						   gdouble              font_size);
314 
315 gdouble     gl_object_editor_get_font_size        (glObjectEditor      *editor);
316 
317 void        gl_object_editor_set_font_weight      (glObjectEditor      *editor,
318 						   PangoWeight          font_weight);
319 
320 PangoWeight gl_object_editor_get_font_weight      (glObjectEditor      *editor);
321 
322 void        gl_object_editor_set_font_italic_flag (glObjectEditor      *editor,
323 						   gboolean             font_italic_flag);
324 
325 gboolean    gl_object_editor_get_font_italic_flag (glObjectEditor      *editor);
326 
327 void        gl_object_editor_set_text_alignment   (glObjectEditor      *editor,
328 						   PangoAlignment       text_alignment);
329 
330 PangoAlignment gl_object_editor_get_text_alignment (glObjectEditor      *editor);
331 
332 void        gl_object_editor_set_text_valignment  (glObjectEditor      *editor,
333 						   glValignment         text_valignment);
334 
335 glValignment gl_object_editor_get_text_valignment (glObjectEditor       *editor);
336 
337 void        gl_object_editor_set_text_line_spacing (glObjectEditor      *editor,
338 						   gdouble               text_line_spacing);
339 
340 gdouble     gl_object_editor_get_text_line_spacing (glObjectEditor      *editor);
341 
342 void        gl_object_editor_set_text_color       (glObjectEditor       *editor,
343 						   gboolean              merge_flag,
344 						   glColorNode          *text_color_node);
345 
346 glColorNode* gl_object_editor_get_text_color      (glObjectEditor      *editor);
347 
348 void        gl_object_editor_set_text_auto_shrink (glObjectEditor      *editor,
349 						   gboolean             auto_shrink);
350 
351 gboolean    gl_object_editor_get_text_auto_shrink (glObjectEditor      *editor);
352 
353 
354 /*
355  * Edit Text Page
356  */
357 void        gl_object_editor_set_text_buffer      (glObjectEditor      *editor,
358 						   GtkTextBuffer       *buffer);
359 
360 /*
361  * Barcode Page
362  */
363 void        gl_object_editor_load_bc_styles        (glObjectEditor            *editor,
364                                                     const gchar               *backend_id);
365 
366 void        gl_object_editor_set_bc_style          (glObjectEditor            *editor,
367                                                     const glLabelBarcodeStyle *bc_style);
368 
369 glLabelBarcodeStyle *gl_object_editor_get_bc_style (glObjectEditor            *editor);
370 
371 void        gl_object_editor_set_bc_color          (glObjectEditor            *editor,
372                                                     gboolean                   merge_flag,
373                                                     glColorNode               *color_node);
374 
375 glColorNode* gl_object_editor_get_bc_color         (glObjectEditor            *editor);
376 
377 
378 /*
379  * Barcode Data Page
380  */
381 void        gl_object_editor_set_data             (glObjectEditor      *editor,
382 						   gboolean             merge_flag,
383 						   glTextNode          *text_node);
384 
385 glTextNode *gl_object_editor_get_data             (glObjectEditor      *editor);
386 
387 
388 /*
389  * Shadow Page
390  */
391 void        gl_object_editor_set_shadow_state     (glObjectEditor      *editor,
392 						   gboolean             state);
393 
394 void        gl_object_editor_set_shadow_offset    (glObjectEditor      *editor,
395 						   gdouble              x,
396 						   gdouble              y);
397 
398 void        gl_object_editor_set_shadow_color     (glObjectEditor      *editor,
399 						   gboolean             merge_flag,
400 						   glColorNode         *color_node);
401 
402 void        gl_object_editor_set_shadow_opacity   (glObjectEditor      *editor,
403 						   gdouble              alpha);
404 
405 void        gl_object_editor_set_max_shadow_offset(glObjectEditor      *editor,
406 						   gdouble              x_max,
407 						   gdouble              y_max);
408 
409 
410 gboolean    gl_object_editor_get_shadow_state     (glObjectEditor      *editor);
411 
412 void        gl_object_editor_get_shadow_offset    (glObjectEditor      *editor,
413 						   gdouble             *x,
414 						   gdouble             *y);
415 
416 glColorNode* gl_object_editor_get_shadow_color    (glObjectEditor      *editor);
417 
418 gdouble     gl_object_editor_get_shadow_opacity   (glObjectEditor      *editor);
419 
420 
421 G_END_DECLS
422 
423 #endif
424 
425 
426 
427 /*
428  * Local Variables:       -- emacs
429  * mode: C                -- emacs
430  * c-basic-offset: 8      -- emacs
431  * tab-width: 8           -- emacs
432  * indent-tabs-mode: nil  -- emacs
433  * End:                   -- emacs
434  */
435