Contents of /trunk/src/josm_presets.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 51 - (show annotations)
Thu Feb 5 20:08:46 2009 UTC (15 years, 3 months ago) by harbaum
File MIME type: text/plain
File size: 2152 byte(s)
Updated presets parser
1 /*
2 * Copyright (C) 2008 Till Harbaum <till@harbaum.org>.
3 *
4 * This file is part of OSM2Go.
5 *
6 * OSM2Go is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * OSM2Go is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with OSM2Go. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef JOSM_PRESETS_H
21 #define JOSM_PRESETS_H
22
23 // set this if _all_ josm icons are in data/presets
24 // #define JOSM_PATH_ADJUST
25
26 typedef enum {
27 WIDGET_TYPE_LABEL = 0,
28 WIDGET_TYPE_SEPARATOR,
29 WIDGET_TYPE_SPACE,
30 WIDGET_TYPE_COMBO,
31 WIDGET_TYPE_CHECK,
32 WIDGET_TYPE_TEXT,
33 WIDGET_TYPE_KEY
34 } presets_widget_type_t;
35
36 typedef struct presets_value_s {
37 char *text;
38 struct presets_value_s *next;
39 } presets_value_t;
40
41
42 typedef struct presets_widget_s {
43 presets_widget_type_t type;
44
45 char *key, *text;
46 gboolean del_if_empty;
47
48 union {
49 /* a tag with an arbitrary text value */
50 struct {
51 char *def;
52 } text_w;
53
54 /* a combo box with pre-defined values */
55 struct {
56 char *def;
57 presets_value_t *values;
58 } combo_w;
59
60 /* a key is just a static key */
61 struct {
62 char *value;
63 } key_w;
64
65 /* single checkbox */
66 struct {
67 gboolean def;
68 } check_w;
69
70 };
71
72 struct presets_widget_s *next;
73 } presets_widget_t;
74
75 typedef struct presets_item_s {
76 char *name, *icon, *link;
77 gboolean is_group;
78
79 union {
80 presets_widget_t *widget;
81 struct presets_item_s *group;
82 };
83
84 struct presets_item_s *next;
85 } presets_item_t;
86
87 presets_item_t *josm_presets_load(void);
88 GtkWidget *josm_presets_select(appdata_t *appdata, tag_context_t *tag_context);
89 void josm_presets_free(presets_item_t *presets);
90 char *josm_icon_name_adjust(char *name);
91
92 #endif // JOSM_PRESETS_H