offset fixes, admit to textline, proper updating of height/font at attr set,
[dia.git] / lib / properties.h
blobd159153efcd30eb9799a8c6d948ace5f5c059051
1 /* Dia -- a diagram creation/manipulation program -*- c -*-
2 * Copyright (C) 1998 Alexander Larsson
4 * Property system for dia objects/shapes.
5 * Copyright (C) 2000 James Henstridge
6 * Copyright (C) 2001 Cyrille Chepelov
7 * Major restructuration done in August 2001 by C. Chepelov
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.
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.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #ifndef LIB_PROPERTIES_H
25 #define LIB_PROPERTIES_H
27 #ifndef WIDGET
28 #ifdef GTK_WIDGET
29 #define WIDGET GtkWidget
30 #else
31 #define WIDGET void
32 #endif
33 #endif
36 #ifdef HAVE_STDDEF_H
37 #include <stddef.h>
38 #endif
40 #include <glib.h>
41 #include "diatypes.h"
43 #include "geometry.h"
44 #include "arrows.h"
45 #include "color.h"
46 #include "font.h"
47 #include "dia_xml.h"
48 #include "intl.h"
49 #include "textattr.h"
51 G_BEGIN_DECLS
53 typedef gboolean (*PropDescToPropPredicate)(const PropDescription *pdesc);
55 struct _PropWidgetAssoc {
56 Property *prop;
57 WIDGET *widget;
60 struct _PropDialog { /* This is to be treated as opaque ! */
61 WIDGET *widget; /* widget of self */
63 GPtrArray *props; /* of Property * */
64 GArray *prop_widgets; /* of PropWidgetAssoc. This is a "flat" listing of
65 properties and widgets (no nesting information is
66 kept here) */
67 DiaObject *obj_copy; /* if !NULL, a copy of the object which can be used
68 as scratch. */
69 DiaObject *orig_obj; /* The original object (do not touch !) */
71 GPtrArray *containers;
72 WIDGET *lastcont;
73 WIDGET *curtable;
74 guint currow;
77 struct _PropEventData {
78 PropDialog *dialog;
79 guint my_index; /* in dialog->propwidgets */
80 WIDGET *widget;
81 Property *self;
84 typedef gboolean (*PropEventHandler) (DiaObject *obj, Property *prop);
86 struct _PropEventHandlerChain {
87 PropEventHandler handler;
88 PropEventHandlerChain *chain;
91 /* PropertyType operations : */
93 /* allocate a new, empty property. */
94 typedef Property * (*PropertyType_New) (const PropDescription *pdesc,
95 PropDescToPropPredicate reason);
96 /* free the property -- must skip NULL values. */
97 typedef void (* PropertyType_Free)(Property *prop);
98 /* Copy the data member of the property. -- must skip NULL values. */
99 typedef Property *(* PropertyType_Copy)(Property *src);
100 /* Create a widget capable of editing the property. Add it to the last container (or
101 add/remove container levels). */
102 typedef WIDGET *(* PropertyType_GetWidget)(Property *prop,
103 PropDialog *dialog);
105 /* Get the value of the property into the widget */
106 typedef void (* PropertyType_ResetWidget)(const Property *prop, WIDGET *widget);
107 /* Set the value of the property from the current value of the widget */
108 typedef void (* PropertyType_SetFromWidget)(Property *prop, WIDGET *widget);
109 /* load/save a property */
110 typedef void (*PropertyType_Load)(Property *prop, AttributeNode attr, DataNode data);
111 typedef void (*PropertyType_Save)(Property *prop, AttributeNode attr);
113 /* If a property descriptor can be merged with another
114 (DONT_MERGE has already been handled) */
115 typedef gboolean (*PropertyType_CanMerge)(const PropDescription *pd1,const PropDescription *pd2);
116 typedef void (*PropertyType_GetFromOffset)(const Property *prop,
117 void *base, guint offset, guint offset2);
118 typedef void (*PropertyType_SetFromOffset)(Property *prop,
119 void *base, guint offset, guint offset2);
120 typedef int (*PropertyType_GetDataSize)(Property *prop);
123 struct _PropertyOps {
124 PropertyType_New new_prop;
125 PropertyType_Free free;
126 PropertyType_Copy copy;
127 PropertyType_Load load;
128 PropertyType_Save save;
129 PropertyType_GetWidget get_widget;
130 PropertyType_ResetWidget reset_widget;
131 PropertyType_SetFromWidget set_from_widget;
133 PropertyType_CanMerge can_merge;
135 PropertyType_GetFromOffset get_from_offset;
136 PropertyType_SetFromOffset set_from_offset;
137 PropertyType_GetDataSize get_data_size;
140 typedef const gchar *PropertyType;
142 /* Basic types (can be used as building blocks) : */
143 #define PROP_TYPE_INVALID "invalid" /* InvalidProperty */
144 #define PROP_TYPE_NOOP "noop" /* NoopProperty */
145 #define PROP_TYPE_UNIMPLEMENTED "unimplemented" /* UnimplementedProperty */
147 /* Integral types : */
148 #define PROP_TYPE_CHAR "char" /* CharProperty */
149 #define PROP_TYPE_BOOL "bool" /* BoolProperty */
150 #define PROP_TYPE_INT "int" /* IntProperty */
151 #define PROP_TYPE_INTARRAY "intarray" /* IntarrayProperty */
152 #define PROP_TYPE_ENUM "enum" /* EnumProperty */
153 #define PROP_TYPE_ENUMARRAY "enumarray" /* EnumarrayProperty */
155 /* Text types : */
156 #define PROP_TYPE_MULTISTRING "multistring" /* StringProperty */
157 /* (same as STRING but with (gint)extra_data lines) */
158 #define PROP_TYPE_STRING "string" /* StringProperty */
159 #define PROP_TYPE_FILE "file" /* StringProperty */
160 #define PROP_TYPE_TEXT "text" /* can't be visible */ /* TextProperty */
161 #define PROP_TYPE_STRINGLIST "stringlist" /* can't be visible */ /* StringListProperty */
163 /* Geometric types : */
164 #define PROP_TYPE_REAL "real" /* RealProperty */
165 #define PROP_TYPE_LENGTH "length" /* LengthProperty */
166 #define PROP_TYPE_FONTSIZE "fontsize" /* FontsizeProperty */
167 #define PROP_TYPE_POINT "point" /* PointProperty */
168 #define PROP_TYPE_POINTARRAY "pointarray" /* PointarrayProperty */
169 #define PROP_TYPE_BEZPOINT "bezpoint" /* BezPointProperty */
170 #define PROP_TYPE_BEZPOINTARRAY "bezpointarray" /* BezPointarrayProperty */
171 #define PROP_TYPE_RECT "rect" /* RectProperty */
172 #define PROP_TYPE_ENDPOINTS "endpoints" /* EndpointsProperty */
173 #define PROP_TYPE_CONNPOINT_LINE "connpoint_line" /* Connpoint_LineProperty */
175 /* Attribute types : */
176 #define PROP_TYPE_LINESTYLE "linestyle" /* LinestyleProperty */
177 #define PROP_TYPE_ARROW "arrow" /* ArrowProperty */
178 #define PROP_TYPE_COLOUR "colour" /* ColorProperty */
179 #define PROP_TYPE_FONT "font" /* FontProperty */
181 /* Widget types : */
182 #define PROP_TYPE_STATIC "static" /* StaticProperty */
183 /* (tooltip is used as a (potentially big) static label) */
184 #define PROP_TYPE_BUTTON "button" /* ButtonProperty */
185 /* (tooltip is the button's label. Put an empty description). */
186 #define PROP_TYPE_NOTEBOOK_BEGIN "nb_begin" /* NotebookProperty */
187 #define PROP_TYPE_NOTEBOOK_END "nb_end" /* NotebookProperty */
188 #define PROP_TYPE_NOTEBOOK_PAGE "nb_page" /* NotebookProperty */
189 #define PROP_TYPE_MULTICOL_BEGIN "mc_begin" /* MulticolProperty */
190 #define PROP_TYPE_MULTICOL_END "mc_end" /* MulticolProperty */
191 #define PROP_TYPE_MULTICOL_COLUMN "mc_col" /* MulticolProperty */
192 #define PROP_TYPE_FRAME_BEGIN "f_begin" /* FrameProperty */
193 #define PROP_TYPE_FRAME_END "f_end" /* FrameProperty */
194 #define PROP_TYPE_LIST "list" /* ListProperty */
195 /* (offset is a GPtrArray of (const gchar *). offset2 is a gint, index of the
196 active item, -1 if none active.) */
198 /* Special types : */
199 #define PROP_TYPE_SARRAY "sarray" /* ArrayProperty */
200 #define PROP_TYPE_DARRAY "darray" /* ArrayProperty */
202 /* **************************************************************** */
204 struct _PropDescription {
205 const gchar *name;
206 PropertyType type;
207 guint flags;
208 const gchar *description;
209 const gchar *tooltip;
211 /* Holds some extra data whose meaning is dependent on the property type.
212 * For example, int or float may use bounds for a spin button, and enums
213 * may use a list of string names for enumeration values. */
214 gpointer extra_data;
216 /* if the property widget can send events when it's somehow interacted with,
217 control will be passed to object_type-supplied event_handler, and
218 event->dialog->obj_copy will be current with the dialog's values.
219 When control comes back, event->dialog->obj_copy's properties will be
220 brought back into the dialog. */
221 PropEventHandler event_handler;
223 GQuark quark; /* quark for property name -- helps speed up lookups. */
224 GQuark type_quark;
226 /* only used by dynamically constructed property descriptors (eg. groups) */
227 PropEventHandlerChain chain_handler;
229 const PropertyOps *ops;
232 #define PROP_FLAG_VISIBLE 0x0001
233 #define PROP_FLAG_DONT_SAVE 0x0002
234 #define PROP_FLAG_DONT_MERGE 0x0004 /* in case group properties are edited */
235 #define PROP_FLAG_NO_DEFAULTS 0x0008 /* don't edit this in defaults dlg. */
236 #define PROP_FLAG_LOAD_ONLY 0x0010 /* for loading old formats */
237 #define PROP_FLAG_STANDARD 0x0020 /* One of the default toolbox props */
238 #define PROP_FLAG_MULTIVALUE 0x0040 /* Multiple values for prop in group */
239 #define PROP_FLAG_WIDGET_ONLY 0x0080 /* only cosmetic property, no data */
240 #define PROP_FLAG_OPTIONAL 0x0100 /* don't complain if it does not exist */
242 #define PROP_DESC_END { NULL, 0, 0, NULL, NULL, NULL, 0 }
244 /* extra data pointers for various property types */
245 struct _PropNumData {
246 gfloat min, max, step;
248 struct _PropEnumData {
249 const gchar *name;
250 guint enumv;
253 typedef gpointer (*NewRecordFunc)(void);
254 typedef void (*FreeRecordFunc)(gpointer rec);
256 struct _PropDescCommonArrayExtra { /* don't use this directly.
257 Use one of below */
258 PropDescription *record;
259 PropOffset *offsets; /* the offsets into the structs in the list/array */
260 const gchar *composite_type; /* can be NULL. */
263 struct _PropDescDArrayExtra {
264 PropDescCommonArrayExtra common; /* must be first */
265 NewRecordFunc newrec;
266 FreeRecordFunc freerec;
269 struct _PropDescSArrayExtra {
270 PropDescCommonArrayExtra common; /* must be first */
271 guint element_size; /* sizeof(record) */
272 guint array_len;
276 /* ******************* */
277 /* The Property itself */
278 /* ******************* */
279 struct _Property {
280 const gchar *name;
281 GQuark name_quark;
282 PropertyType type;
283 GQuark type_quark;
284 const PropDescription *descr;
285 gpointer extra_data;
286 PropEventData self;
287 PropEventHandler event_handler;
288 PropDescToPropPredicate reason; /* why has this property been created from
289 the pdesc ? */
290 guint experience; /* flags PXP_.... */
292 const PropertyOps *ops; /* points to common_prop_ops */
293 const PropertyOps *real_ops; /* == descr->ops */
296 /* prop->experience flags */
297 #define PXP_COPIED 0x00000001 /* has been copied */
298 #define PXP_COPY 0x00000002 /* is a copy */
299 #define PXP_GET_WIDGET 0x00000004
300 #define PXP_RESET_WIDGET 0x00000008
301 #define PXP_SET_FROM_WIDGET 0x00000010
302 #define PXP_LOADED 0x00000020
303 #define PXP_SAVED 0x00000040
304 #define PXP_GFO 0x00000080
305 #define PXP_SFO 0x00000100
306 #define PXP_NOTSET 0x00000200
307 #define PXP_SHAMELESS 0xFFFFFFFF
309 /* ***************************************************************** */
310 /* Operations on property descriptors and property descriptor lists. */
312 void prop_desc_list_calculate_quarks(PropDescription *plist);
313 /* plist must have all quarks calculated in advance */
314 const PropDescription *prop_desc_list_find_prop(const PropDescription *plist,
315 const gchar *name);
316 /* finds the real handler in case there are several levels of indirection */
317 PropEventHandler prop_desc_find_real_handler(const PropDescription *pdesc);
318 /* free a handler indirection list */
319 void prop_desc_free_handler_chain(PropDescription *pdesc);
320 /* free a handler indirection list in a list of descriptors */
321 void prop_desc_list_free_handler_chain(PropDescription *pdesc);
322 /* insert an event handler */
323 void prop_desc_insert_handler(PropDescription *pdesc,
324 PropEventHandler handler);
326 /* operations on lists of property description lists */
327 PropDescription *prop_desc_lists_union(GList *plists);
328 PropDescription *prop_desc_lists_intersection(GList *plists);
331 /* ********************************************* */
332 /* Functions for dealing with the Type Registry */
333 void prop_type_register(PropertyType type, const PropertyOps *ops);
334 const PropertyOps *prop_type_get_ops(PropertyType type);
336 /* *********************************************************** */
337 /* functions for manipulating a property array. */
339 void prop_list_free(GPtrArray *plist);
342 /* copies the whole property structure, including the data. */
343 GPtrArray *prop_list_copy(GPtrArray *plist);
344 /* copies the whole property structure, excluding the data. */
345 GPtrArray *prop_list_copy_empty(GPtrArray *plist);
346 /* Appends copies of the properties in the second list to the first. */
347 void prop_list_add_list (GPtrArray *props, const GPtrArray *ptoadd);
349 GPtrArray *prop_list_from_descs(const PropDescription *plist,
350 PropDescToPropPredicate pred);
352 GPtrArray *prop_list_from_single(Property *prop);
354 /* Some predicates: */
355 gboolean pdtpp_true(const PropDescription *pdesc); /* always true */
356 gboolean pdtpp_is_visible(const PropDescription *pdesc);
357 gboolean pdtpp_is_visible_no_standard(const PropDescription *pdesc);
358 gboolean pdtpp_is_not_visible(const PropDescription *pdesc);
359 gboolean pdtpp_do_save(const PropDescription *pdesc);
360 gboolean pdtpp_do_save_no_standard(const PropDescription *pdesc);
361 gboolean pdtpp_do_load(const PropDescription *pdesc);
362 gboolean pdtpp_do_not_save(const PropDescription *pdesc);
363 /* all but DONT_MERGE and NO_DEFAULTS: */
364 gboolean pdtpp_defaults(const PropDescription *pdesc);
365 /* actually used for the "reason" parameter, not as predicates (synonyms for pdtpp_true) */
366 gboolean pdtpp_synthetic(const PropDescription *pdesc);
367 gboolean pdtpp_from_object(const PropDescription *pdesc);
370 /* Swallows the property into a single property list. Can be given NULL.
371 Don't free yourself the property afterwards; prop_list_free() the list
372 instead.
373 You regain responsibility for the property if you g_ptr_array_destroy() the
374 list. */
375 GPtrArray *prop_list_of_single(Property *prop);
377 /* Create a new property of the required type, with the required name.
378 A PropDescription might be created on the fly. The property's value is not
379 initialised (actually, it's zero). */
380 Property *make_new_prop(const char *name, PropertyType type, guint flags);
384 /* Offset to fields in objects */
386 /* calculates the offset of a structure member within the structure */
387 #ifndef offsetof
388 #define offsetof(type, member) ( (int) & ((type*)0) -> member )
389 #endif
390 struct _PropOffset {
391 const gchar *name;
392 PropertyType type;
393 int offset;
394 int offset2; /* maybe for point lists, etc */
395 GQuark name_quark;
396 GQuark type_quark;
397 const PropertyOps *ops;
400 /* ************************************************ */
401 /* routines used by Objects or to deal with Objects */
403 /* returns TRUE if this object can be handled (at least in part) through this
404 library. */
405 gboolean object_complies_with_stdprop(const DiaObject *obj);
407 /* will do whatever is needed to make the PropDescription * list look good to
408 the rest of the properties code. Can return NULL. */
409 const PropDescription *object_get_prop_descriptions(const DiaObject *obj);
411 gboolean object_get_props_from_offsets(DiaObject *obj, PropOffset *offsets,
412 GPtrArray *props);
413 gboolean object_set_props_from_offsets(DiaObject *obj, PropOffset *offsets,
414 GPtrArray *props);
416 /* apply some properties and return a corresponding object change */
417 ObjectChange *object_apply_props(DiaObject *obj, GPtrArray *props);
419 /* standard properties dialogs that can be used for objects that
420 * implement describe_props, get_props and set_props.
421 * If is_default is set, this is a default dialog, not an object dialog.
423 WIDGET *object_create_props_dialog (DiaObject *obj, gboolean is_default);
424 ObjectChange *object_apply_props_from_dialog (DiaObject *obj, WIDGET *dialog);
426 /* create a property from the object's property descriptors. To be freed with
427 prop->ops->free(prop); or put it into a single property list. NULL if object
428 has nothing matching. Property's value is initialised by the object.
429 Serve cold. */
430 Property *object_prop_by_name(DiaObject *obj, const char *name);
431 Property *object_prop_by_name_type(DiaObject *obj, const char *name, const char *type);
433 /* standard way to load/save properties of an object */
434 void object_load_props(DiaObject *obj, ObjectNode obj_node);
435 void object_save_props(DiaObject *obj, ObjectNode obj_node);
437 /* standard way to copy the properties of an object into another (of the
438 same type) */
439 void object_copy_props(DiaObject *dest, const DiaObject *src,
440 gboolean is_default);
442 /* Return a reference to objects property with 'name' or NULL */
443 Property *object_get_prop_by_name (DiaObject *obj, const char* name);
445 /* ************************************************************* */
447 void stdprops_init(void);
449 /* ************************************************************* */
451 /* standard properties. By using these, the intersection of the properties
452 * of a number of objects should be greater, making setting properties on
453 * groups better. */
455 /* HB: exporting the following two vars by GIMPVAR==dllexport/dllimport,
456 * does mean the pointers used below have to be calculated
457 * at run-time by the loader, because they will exist
458 * only once in the process space and dynamic link libraries may be
459 * relocated. As a result their address is no longer constant.
460 * Indeed it causes compile time errors with MSVC (initialzer
461 * not a constant).
462 * To fix it they are moved form properties.c and declared as static
463 * on Win32
465 #ifdef G_OS_WIN32
466 static PropNumData prop_std_line_width_data = { 0.0f, 10.0f, 0.01f };
467 static PropNumData prop_std_text_height_data = { 0.1f, 10.0f, 0.1f };
468 static PropEnumData prop_std_text_align_data[] = {
469 { N_("Left"), ALIGN_LEFT },
470 { N_("Center"), ALIGN_CENTER },
471 { N_("Right"), ALIGN_RIGHT },
472 { NULL, 0 }
474 #else
475 extern PropNumData prop_std_line_width_data, prop_std_text_height_data;
476 extern PropEnumData prop_std_text_align_data[];
477 #endif
479 #define PROP_STD_LINE_WIDTH \
480 { "line_width", PROP_TYPE_REAL, PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD, \
481 N_("Line width"), NULL, &prop_std_line_width_data }
482 #define PROP_STD_LINE_WIDTH_OPTIONAL \
483 { "line_width", PROP_TYPE_REAL, PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD|PROP_FLAG_OPTIONAL, \
484 N_("Line width"), NULL, &prop_std_line_width_data }
485 #define PROP_STD_LINE_COLOUR \
486 { "line_colour", PROP_TYPE_COLOUR, PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD, \
487 N_("Line color"), NULL, NULL }
488 #define PROP_STD_LINE_COLOUR_OPTIONAL \
489 { "line_colour", PROP_TYPE_COLOUR, PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD|PROP_FLAG_OPTIONAL, \
490 N_("Line color"), NULL, NULL }
491 #define PROP_STD_LINE_STYLE \
492 { "line_style", PROP_TYPE_LINESTYLE, PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD, \
493 N_("Line style"), NULL, NULL }
494 #define PROP_STD_LINE_STYLE_OPTIONAL \
495 { "line_style", PROP_TYPE_LINESTYLE, PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD|PROP_FLAG_OPTIONAL, \
496 N_("Line style"), NULL, NULL }
498 #define PROP_STD_FILL_COLOUR \
499 { "fill_colour", PROP_TYPE_COLOUR, PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD, \
500 N_("Fill color"), NULL, NULL }
501 #define PROP_STD_FILL_COLOUR_OPTIONAL \
502 { "fill_colour", PROP_TYPE_COLOUR, PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD|PROP_FLAG_OPTIONAL, \
503 N_("Fill color"), NULL, NULL }
504 #define PROP_STD_SHOW_BACKGROUND \
505 { "show_background", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE, \
506 N_("Draw background"), NULL, NULL }
507 #define PROP_STD_SHOW_BACKGROUND_OPTIONAL \
508 { "show_background", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL, \
509 N_("Draw background"), NULL, NULL }
511 #define PROP_STD_START_ARROW \
512 { "start_arrow", PROP_TYPE_ARROW, PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD, \
513 N_("Start arrow"), NULL, NULL }
514 #define PROP_STD_END_ARROW \
515 { "end_arrow", PROP_TYPE_ARROW, PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD, \
516 N_("End arrow"), NULL, NULL }
518 #define PROP_STD_TEXT_OPTIONS(options) \
519 { "text", PROP_TYPE_TEXT, (options), \
520 N_("Text"), NULL, NULL }
521 #define PROP_STD_TEXT PROP_STD_TEXT_OPTIONS(PROP_FLAG_DONT_SAVE)
522 #define PROP_STD_SAVED_TEXT PROP_STD_TEXT_OPTIONS(0)
524 #define PROP_STD_TEXT_ALIGNMENT_OPTIONS(options) \
525 { "text_alignment", PROP_TYPE_ENUM, (options), \
526 N_("Text alignment"), NULL, prop_std_text_align_data }
527 #define PROP_STD_TEXT_ALIGNMENT \
528 PROP_STD_TEXT_ALIGNMENT_OPTIONS(PROP_FLAG_VISIBLE|PROP_FLAG_DONT_SAVE)
530 #define PROP_STD_TEXT_FONT_OPTIONS(options) \
531 { "text_font", PROP_TYPE_FONT, (options), N_("Font"), NULL, NULL }
532 #define PROP_STD_TEXT_FONT \
533 PROP_STD_TEXT_FONT_OPTIONS(PROP_FLAG_VISIBLE|PROP_FLAG_DONT_SAVE)
535 #define PROP_STD_TEXT_HEIGHT_OPTIONS(options) \
536 { "text_height", PROP_TYPE_REAL, (options), \
537 N_("Font size"), NULL, &prop_std_text_height_data }
538 #define PROP_STD_TEXT_HEIGHT \
539 PROP_STD_TEXT_HEIGHT_OPTIONS(PROP_FLAG_VISIBLE|PROP_FLAG_DONT_SAVE)
541 #define PROP_STD_TEXT_COLOUR_OPTIONS(options) \
542 { "text_colour", PROP_TYPE_COLOUR, (options), \
543 N_("Text color"), NULL, NULL }
544 #define PROP_STD_TEXT_COLOUR \
545 PROP_STD_TEXT_COLOUR_OPTIONS(PROP_FLAG_VISIBLE|PROP_FLAG_DONT_SAVE|PROP_FLAG_STANDARD)
546 #define PROP_STD_TEXT_COLOUR_OPTIONAL \
547 PROP_STD_TEXT_COLOUR_OPTIONS(PROP_FLAG_VISIBLE|PROP_FLAG_DONT_SAVE|PROP_FLAG_STANDARD|PROP_FLAG_OPTIONAL)
549 /* Convenience macros */
550 #define PROP_NOTEBOOK_BEGIN(name) \
551 { "nbook_" name, PROP_TYPE_NOTEBOOK_BEGIN, \
552 PROP_FLAG_VISIBLE|PROP_FLAG_DONT_SAVE|PROP_FLAG_WIDGET_ONLY, NULL, NULL}
553 #define PROP_STD_NOTEBOOK_BEGIN PROP_NOTEBOOK_BEGIN("std")
554 #define PROP_OFFSET_NOTEBOOK_BEGIN(name) \
555 { "nbook_" name, PROP_TYPE_NOTEBOOK_BEGIN, 0}
556 #define PROP_OFFSET_STD_NOTEBOOK_BEGIN PROP_OFFSET_NOTEBOOK_BEGIN("std")
558 #define PROP_NOTEBOOK_END(name) \
559 { "nbook_" name "_end", PROP_TYPE_NOTEBOOK_END, \
560 PROP_FLAG_VISIBLE|PROP_FLAG_DONT_SAVE|PROP_FLAG_WIDGET_ONLY, NULL, NULL}
561 #define PROP_STD_NOTEBOOK_END PROP_NOTEBOOK_END("std")
562 #define PROP_OFFSET_NOTEBOOK_END(name) \
563 { "nbook_" name "_end", PROP_TYPE_NOTEBOOK_END, 0}
564 #define PROP_OFFSET_STD_NOTEBOOK_END PROP_OFFSET_NOTEBOOK_END("std")
566 #define PROP_NOTEBOOK_PAGE(name,flags,descr) \
567 { "nbook_page_" name, PROP_TYPE_NOTEBOOK_PAGE, \
568 PROP_FLAG_VISIBLE|PROP_FLAG_DONT_SAVE|PROP_FLAG_WIDGET_ONLY|flags,descr,NULL}
569 #define PROP_OFFSET_NOTEBOOK_PAGE(name) \
570 { "nbook_page_" name , PROP_TYPE_NOTEBOOK_PAGE, 0}
572 #define PROP_MULTICOL_BEGIN(name) \
573 { "mcol_" name, PROP_TYPE_MULTICOL_BEGIN, \
574 PROP_FLAG_VISIBLE|PROP_FLAG_DONT_SAVE|PROP_FLAG_WIDGET_ONLY, NULL, NULL}
575 #define PROP_STD_MULTICOL_BEGIN PROP_MULTICOL_BEGIN("std")
576 #define PROP_OFFSET_MULTICOL_BEGIN(name) \
577 { "mcol_" name, PROP_TYPE_NOTEBOOK_BEGIN, 0}
578 #define PROP_OFFSET_STD_MULTICOL_BEGIN PROP_OFFSET_MULTICOL_BEGIN("std")
580 #define PROP_MULTICOL_END(name) \
581 { "mcol_" name "_end", PROP_TYPE_MULTICOL_END, \
582 PROP_FLAG_VISIBLE|PROP_FLAG_DONT_SAVE|PROP_FLAG_WIDGET_ONLY, NULL, NULL}
583 #define PROP_STD_MULTICOL_END PROP_MULTICOL_END("std")
584 #define PROP_OFFSET_MULTICOL_END(name) \
585 { "mcol_" name "_end", PROP_TYPE_NOTEBOOK_END, 0}
586 #define PROP_OFFSET_STD_MULTICOL_END PROP_OFFSET_MULTICOL_END("std")
588 #define PROP_MULTICOL_COLUMN(name) \
589 { "mcol_col_" name, PROP_TYPE_MULTICOL_COLUMN, \
590 PROP_FLAG_VISIBLE|PROP_FLAG_DONT_SAVE|PROP_FLAG_WIDGET_ONLY,NULL,NULL}
591 #define PROP_OFFSET_MULTICOL_COLUMN(name) \
592 { "mcol_col_" name, PROP_TYPE_MULTICOL_COLUMN, 0}
594 #define PROP_FRAME_BEGIN(name,flags,descr) \
595 { "frame_" name, PROP_TYPE_FRAME_BEGIN, \
596 PROP_FLAG_VISIBLE|PROP_FLAG_DONT_SAVE|PROP_FLAG_WIDGET_ONLY|flags, descr, NULL}
597 #define PROP_OFFSET_FRAME_BEGIN(name) \
598 { "frame_" name, PROP_TYPE_FRAME_BEGIN, 0}
600 #define PROP_FRAME_END(name,flags) \
601 { "frame_" name "_end", PROP_TYPE_FRAME_END, \
602 PROP_FLAG_VISIBLE|PROP_FLAG_DONT_SAVE|PROP_FLAG_WIDGET_ONLY|flags, NULL, NULL}
603 #define PROP_OFFSET_FRAME_END(name) \
604 { "frame_" name "_end", PROP_TYPE_FRAME_END, 0}
606 G_END_DECLS
608 #endif