Parent Directory | Revision Log
Honour type in presets
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 | /* the presets type specifies which item type it is */ |
37 | /* appropriate for */ |
38 | #define PRESETS_TYPE_WAY (1<<0) |
39 | #define PRESETS_TYPE_NODE (1<<1) |
40 | #define PRESETS_TYPE_RELATION (1<<2) |
41 | #define PRESETS_TYPE_CLOSEDWAY (1<<3) |
42 | #define PRESETS_TYPE_ALL (0xffff) |
43 | |
44 | typedef struct presets_value_s { |
45 | char *text; |
46 | struct presets_value_s *next; |
47 | } presets_value_t; |
48 | |
49 | typedef struct presets_widget_s { |
50 | presets_widget_type_t type; |
51 | |
52 | char *key, *text; |
53 | gboolean del_if_empty; |
54 | |
55 | union { |
56 | /* a tag with an arbitrary text value */ |
57 | struct { |
58 | char *def; |
59 | } text_w; |
60 | |
61 | /* a combo box with pre-defined values */ |
62 | struct { |
63 | char *def; |
64 | presets_value_t *values; |
65 | } combo_w; |
66 | |
67 | /* a key is just a static key */ |
68 | struct { |
69 | char *value; |
70 | } key_w; |
71 | |
72 | /* single checkbox */ |
73 | struct { |
74 | gboolean def; |
75 | } check_w; |
76 | |
77 | }; |
78 | |
79 | struct presets_widget_s *next; |
80 | } presets_widget_t; |
81 | |
82 | typedef struct presets_item_s { |
83 | int type; |
84 | char *name, *icon, *link; |
85 | gboolean is_group; |
86 | |
87 | union { |
88 | presets_widget_t *widget; |
89 | struct presets_item_s *group; |
90 | }; |
91 | |
92 | struct presets_item_s *next; |
93 | } presets_item_t; |
94 | |
95 | presets_item_t *josm_presets_load(void); |
96 | GtkWidget *josm_presets_select(appdata_t *appdata, tag_context_t *tag_context); |
97 | void josm_presets_free(presets_item_t *presets); |
98 | char *josm_icon_name_adjust(char *name); |
99 | |
100 | #endif // JOSM_PRESETS_H |