diff options
author | Ivan Briano <sachieru@gmail.com> | 2013-02-17 14:53:25 -0300 |
---|---|---|
committer | Ivan Briano <sachieru@gmail.com> | 2013-02-17 14:53:25 -0300 |
commit | 61b8e2aefe0d988806c9edd080d86b265b53d647 (patch) | |
tree | 20ad42c561e7f378347138f3ed5098ec39090a37 /src | |
parent | d0c0a21240c22dda9f71e1b1b5244fcbef95c0d4 (diff) |
More removal of \r
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/edje/edje_pick.c | 2752 | ||||
-rw-r--r-- | src/lib/ecore_cocoa/ecore_cocoa_private.h | 22 | ||||
-rw-r--r-- | src/lib/ecore_file/ecore_file_monitor_win32.c | 612 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_object_image.c | 78 | ||||
-rw-r--r-- | src/lib/evas/include/evas_private.h | 4 | ||||
-rw-r--r-- | src/modules/evas/engines/software_generic/evas_engine.c | 176 |
6 files changed, 1822 insertions, 1822 deletions
diff --git a/src/bin/edje/edje_pick.c b/src/bin/edje/edje_pick.c index 500ac7c813..05c114e848 100644 --- a/src/bin/edje/edje_pick.c +++ b/src/bin/edje/edje_pick.c | |||
@@ -1,1376 +1,1376 @@ | |||
1 | #ifdef HAVE_CONFIG_H | 1 | #ifdef HAVE_CONFIG_H |
2 | # include "config.h" | 2 | # include "config.h" |
3 | #endif | 3 | #endif |
4 | 4 | ||
5 | #include <stdio.h> | 5 | #include <stdio.h> |
6 | #include <string.h> | 6 | #include <string.h> |
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | #include <errno.h> | 8 | #include <errno.h> |
9 | #include <unistd.h> | 9 | #include <unistd.h> |
10 | #include <fcntl.h> | 10 | #include <fcntl.h> |
11 | #include <ctype.h> | 11 | #include <ctype.h> |
12 | #include <Ecore_Getopt.h> | 12 | #include <Ecore_Getopt.h> |
13 | 13 | ||
14 | #ifdef HAVE_EVIL | 14 | #ifdef HAVE_EVIL |
15 | # include <Evil.h> | 15 | # include <Evil.h> |
16 | #endif | 16 | #endif |
17 | 17 | ||
18 | #include "edje_cc.h" | 18 | #include "edje_cc.h" |
19 | #include "edje_private.h" | 19 | #include "edje_private.h" |
20 | 20 | ||
21 | #define EDJE_PICK_HELP_STRING \ | 21 | #define EDJE_PICK_HELP_STRING \ |
22 | "\nEdje Pick - the \"edj\" merging tool.\n\ | 22 | "\nEdje Pick - the \"edj\" merging tool.\n\ |
23 | ===================================\n\n\ | 23 | ===================================\n\n\ |
24 | Use Edje Pick to compose a single edj file \ | 24 | Use Edje Pick to compose a single edj file \ |
25 | by selecting groups from edj files.\n\n\ | 25 | by selecting groups from edj files.\n\n\ |
26 | Use Edje Pick as follows:\n\ | 26 | Use Edje Pick as follows:\n\ |
27 | Include files with \'--include\' file-name\n\ | 27 | Include files with \'--include\' file-name\n\ |
28 | Follow the included file-name by names of selected groups from this file.\n\ | 28 | Follow the included file-name by names of selected groups from this file.\n\ |
29 | To select a group use: \'--group\' group-name.\n\n\ | 29 | To select a group use: \'--group\' group-name.\n\n\ |
30 | You must specify merged file name with \'--output\' file-name.\n\ | 30 | You must specify merged file name with \'--output\' file-name.\n\ |
31 | Use '--verbose' switch to get detailed log.\n\n\ | 31 | Use '--verbose' switch to get detailed log.\n\n\ |
32 | To produce 3rd file \'out.edj\' that composed of:\n\ | 32 | To produce 3rd file \'out.edj\' that composed of:\n\ |
33 | Group \'test\' from \'ex1.edj\' and \'test2\', \'test3\', from \'ex2.edj\'\n\ | 33 | Group \'test\' from \'ex1.edj\' and \'test2\', \'test3\', from \'ex2.edj\'\n\ |
34 | edje_pick -i ex1.edj -g test -i ex2.edj -g test2 -g test3 -o out.edj\n\n\ | 34 | edje_pick -i ex1.edj -g test -i ex2.edj -g test2 -g test3 -o out.edj\n\n\ |
35 | By using \'--append\' whole file content is selected.\n\ | 35 | By using \'--append\' whole file content is selected.\n\ |
36 | No need to specify selected groups with this switch.\n\ | 36 | No need to specify selected groups with this switch.\n\ |
37 | Note that selected group with will override group with the same name\n\ | 37 | Note that selected group with will override group with the same name\n\ |
38 | from appended-file when using \'--append\' switch.\n\n\ | 38 | from appended-file when using \'--append\' switch.\n\n\ |
39 | Example, the command:\n\ | 39 | Example, the command:\n\ |
40 | edje_pick -a theme1.edj -i default.edj -g elm/button/base/default \ | 40 | edje_pick -a theme1.edj -i default.edj -g elm/button/base/default \ |
41 | -g elm/check/base/default -o hybrid.edj\n\n\ | 41 | -g elm/check/base/default -o hybrid.edj\n\n\ |
42 | will produce a 3rd theme file \'hybrid.edj\',\n\ | 42 | will produce a 3rd theme file \'hybrid.edj\',\n\ |
43 | composed of all theme1.edj components.\n\ | 43 | composed of all theme1.edj components.\n\ |
44 | Replacing the button and check with widgets taken from default theme.\n\ | 44 | Replacing the button and check with widgets taken from default theme.\n\ |
45 | (Given that theme1.edj button, check group-name are as in default.edj)\n" | 45 | (Given that theme1.edj button, check group-name are as in default.edj)\n" |
46 | 46 | ||
47 | struct _Edje_Pick_Id | 47 | struct _Edje_Pick_Id |
48 | { | 48 | { |
49 | int old_id; | 49 | int old_id; |
50 | int new_id; | 50 | int new_id; |
51 | Eina_Bool used; | 51 | Eina_Bool used; |
52 | }; | 52 | }; |
53 | typedef struct _Edje_Pick_Id Edje_Pick_Id; | 53 | typedef struct _Edje_Pick_Id Edje_Pick_Id; |
54 | 54 | ||
55 | struct _Edje_Pick_File_Params | 55 | struct _Edje_Pick_File_Params |
56 | { | 56 | { |
57 | const char *name; | 57 | const char *name; |
58 | Eina_List *groups; | 58 | Eina_List *groups; |
59 | Edje_File *edf; /* Keeps all file data after reading */ | 59 | Edje_File *edf; /* Keeps all file data after reading */ |
60 | Eina_Bool append; /* Take everything from this file */ | 60 | Eina_Bool append; /* Take everything from this file */ |
61 | 61 | ||
62 | /* We hold list of IDs for each file */ | 62 | /* We hold list of IDs for each file */ |
63 | Eina_List *scriptlist; | 63 | Eina_List *scriptlist; |
64 | Eina_List *luascriptlist; | 64 | Eina_List *luascriptlist; |
65 | Eina_List *imagelist; | 65 | Eina_List *imagelist; |
66 | Eina_List *imagesetlist; /* List of IDs (Edje_Pick_Data) for image sets */ | 66 | Eina_List *imagesetlist; /* List of IDs (Edje_Pick_Data) for image sets */ |
67 | Eina_List *samplelist; | 67 | Eina_List *samplelist; |
68 | Eina_List *tonelist; | 68 | Eina_List *tonelist; |
69 | }; | 69 | }; |
70 | typedef struct _Edje_Pick_File_Params Edje_Pick_File_Params; | 70 | typedef struct _Edje_Pick_File_Params Edje_Pick_File_Params; |
71 | 71 | ||
72 | struct _Edje_Pick_Data | 72 | struct _Edje_Pick_Data |
73 | { | 73 | { |
74 | const char *filename; /* Image, Sample File Name */ | 74 | const char *filename; /* Image, Sample File Name */ |
75 | void *entry ; /* used to build output file dir FIXME: REMOVE THIS */ | 75 | void *entry ; /* used to build output file dir FIXME: REMOVE THIS */ |
76 | void *data; /* Data as taken from input file */ | 76 | void *data; /* Data as taken from input file */ |
77 | 77 | ||
78 | int size; | 78 | int size; |
79 | Edje_Pick_Id id; | 79 | Edje_Pick_Id id; |
80 | }; | 80 | }; |
81 | typedef struct _Edje_Pick_Data Edje_Pick_Data; | 81 | typedef struct _Edje_Pick_Data Edje_Pick_Data; |
82 | 82 | ||
83 | struct _Edje_Pick_Tone | 83 | struct _Edje_Pick_Tone |
84 | { | 84 | { |
85 | Edje_Sound_Tone *tone; | 85 | Edje_Sound_Tone *tone; |
86 | Eina_Bool used; | 86 | Eina_Bool used; |
87 | }; | 87 | }; |
88 | typedef struct _Edje_Pick_Tone Edje_Pick_Tone; | 88 | typedef struct _Edje_Pick_Tone Edje_Pick_Tone; |
89 | 89 | ||
90 | struct _Edje_Pick_Font | 90 | struct _Edje_Pick_Font |
91 | { | 91 | { |
92 | Edje_Font *f; | 92 | Edje_Font *f; |
93 | Eina_Bool used; | 93 | Eina_Bool used; |
94 | }; | 94 | }; |
95 | typedef struct _Edje_Pick_Font Edje_Pick_Font; | 95 | typedef struct _Edje_Pick_Font Edje_Pick_Font; |
96 | 96 | ||
97 | struct _Edje_Pick | 97 | struct _Edje_Pick |
98 | { | 98 | { |
99 | Eina_Bool v; /* Verbose */ | 99 | Eina_Bool v; /* Verbose */ |
100 | Edje_Pick_File_Params *current_file; | 100 | Edje_Pick_File_Params *current_file; |
101 | Eina_List *fontlist; | 101 | Eina_List *fontlist; |
102 | }; | 102 | }; |
103 | typedef struct _Edje_Pick Edje_Pick; | 103 | typedef struct _Edje_Pick Edje_Pick; |
104 | 104 | ||
105 | static Edje_Pick context = { EINA_FALSE, NULL, NULL }; | 105 | static Edje_Pick context = { EINA_FALSE, NULL, NULL }; |
106 | 106 | ||
107 | #define VERBOSE(COMMAND) if (context.v) { COMMAND; } | 107 | #define VERBOSE(COMMAND) if (context.v) { COMMAND; } |
108 | 108 | ||
109 | enum _Edje_Pick_Status | 109 | enum _Edje_Pick_Status |
110 | { | 110 | { |
111 | EDJE_PICK_NO_ERROR, | 111 | EDJE_PICK_NO_ERROR, |
112 | EDJE_PICK_OUT_FILENAME_MISSING, | 112 | EDJE_PICK_OUT_FILENAME_MISSING, |
113 | EDJE_PICK_FAILED_OPEN_INP, | 113 | EDJE_PICK_FAILED_OPEN_INP, |
114 | EDJE_PICK_FAILED_READ_INP, | 114 | EDJE_PICK_FAILED_READ_INP, |
115 | EDJE_PICK_GROUP_NOT_FOUND, | 115 | EDJE_PICK_GROUP_NOT_FOUND, |
116 | EDJE_PICK_IMAGE_NOT_FOUND, | 116 | EDJE_PICK_IMAGE_NOT_FOUND, |
117 | EDJE_PICK_SAMPLE_NOT_FOUND, | 117 | EDJE_PICK_SAMPLE_NOT_FOUND, |
118 | EDJE_PICK_INCLUDE_MISSING, | 118 | EDJE_PICK_INCLUDE_MISSING, |
119 | EDJE_PICK_GROUP_MISSING, | 119 | EDJE_PICK_GROUP_MISSING, |
120 | EDJE_PICK_PARSE_FAILED, | 120 | EDJE_PICK_PARSE_FAILED, |
121 | EDJE_PICK_HELP_SHOWN, | 121 | EDJE_PICK_HELP_SHOWN, |
122 | EDJE_PICK_DUP_GROUP | 122 | EDJE_PICK_DUP_GROUP |
123 | }; | 123 | }; |
124 | typedef enum _Edje_Pick_Status Edje_Pick_Status; | 124 | typedef enum _Edje_Pick_Status Edje_Pick_Status; |
125 | 125 | ||
126 | static void | 126 | static void |
127 | _edje_pick_args_show(Eina_List *ifs, char *out) | 127 | _edje_pick_args_show(Eina_List *ifs, char *out) |
128 | { /* Print command-line arguments after parsing phase */ | 128 | { /* Print command-line arguments after parsing phase */ |
129 | Edje_Pick_File_Params *p; | 129 | Edje_Pick_File_Params *p; |
130 | Eina_List *l; | 130 | Eina_List *l; |
131 | char *g; | 131 | char *g; |
132 | 132 | ||
133 | EINA_LOG_INFO("Got args for <%d> input files.\n", eina_list_count(ifs)); | 133 | EINA_LOG_INFO("Got args for <%d> input files.\n", eina_list_count(ifs)); |
134 | 134 | ||
135 | EINA_LIST_FOREACH(ifs, l, p) | 135 | EINA_LIST_FOREACH(ifs, l, p) |
136 | { | 136 | { |
137 | Eina_List *ll; | 137 | Eina_List *ll; |
138 | 138 | ||
139 | if (p->append) | 139 | if (p->append) |
140 | printf("\nFile name: %s\n\tGroups: ALL (append mode)\n", p->name); | 140 | printf("\nFile name: %s\n\tGroups: ALL (append mode)\n", p->name); |
141 | else | 141 | else |
142 | { | 142 | { |
143 | printf("\nFile name: %s\n\tGroups:\n", p->name); | 143 | printf("\nFile name: %s\n\tGroups:\n", p->name); |
144 | EINA_LIST_FOREACH(p->groups, ll, g) | 144 | EINA_LIST_FOREACH(p->groups, ll, g) |
145 | printf("\t\t%s\n", g); | 145 | printf("\t\t%s\n", g); |
146 | } | 146 | } |
147 | } | 147 | } |
148 | 148 | ||
149 | EINA_LOG_INFO("\nOutput file name was <%s>\n", out); | 149 | EINA_LOG_INFO("\nOutput file name was <%s>\n", out); |
150 | } | 150 | } |
151 | 151 | ||
152 | static void | 152 | static void |
153 | _edje_pick_data_free(Eina_List *l) | 153 | _edje_pick_data_free(Eina_List *l) |
154 | { | 154 | { |
155 | Edje_Pick_Data *ep; | 155 | Edje_Pick_Data *ep; |
156 | 156 | ||
157 | EINA_LIST_FREE(l, ep) | 157 | EINA_LIST_FREE(l, ep) |
158 | { | 158 | { |
159 | if (ep->filename) eina_stringshare_del(ep->filename); | 159 | if (ep->filename) eina_stringshare_del(ep->filename); |
160 | free(ep->data); | 160 | free(ep->data); |
161 | free(ep); | 161 | free(ep); |
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
165 | static void | 165 | static void |
166 | _edje_pick_out_file_free(Edje_File *out_file) | 166 | _edje_pick_out_file_free(Edje_File *out_file) |
167 | { | 167 | { |
168 | if (out_file) | 168 | if (out_file) |
169 | { | 169 | { |
170 | /* Free output file memory allocation */ | 170 | /* Free output file memory allocation */ |
171 | if (out_file->ef) | 171 | if (out_file->ef) |
172 | eet_close(out_file->ef); | 172 | eet_close(out_file->ef); |
173 | 173 | ||
174 | if (out_file->external_dir) | 174 | if (out_file->external_dir) |
175 | { | 175 | { |
176 | if (out_file->external_dir->entries) | 176 | if (out_file->external_dir->entries) |
177 | free(out_file->external_dir->entries); | 177 | free(out_file->external_dir->entries); |
178 | 178 | ||
179 | free(out_file->external_dir); | 179 | free(out_file->external_dir); |
180 | } | 180 | } |
181 | 181 | ||
182 | if (out_file->image_dir) | 182 | if (out_file->image_dir) |
183 | { | 183 | { |
184 | if (out_file->image_dir->entries) | 184 | if (out_file->image_dir->entries) |
185 | free(out_file->image_dir->entries); | 185 | free(out_file->image_dir->entries); |
186 | 186 | ||
187 | free(out_file->image_dir); | 187 | free(out_file->image_dir); |
188 | } | 188 | } |
189 | 189 | ||
190 | if (out_file->sound_dir) | 190 | if (out_file->sound_dir) |
191 | { | 191 | { |
192 | if (out_file->sound_dir->samples) | 192 | if (out_file->sound_dir->samples) |
193 | free(out_file->sound_dir->samples); | 193 | free(out_file->sound_dir->samples); |
194 | 194 | ||
195 | if (out_file->sound_dir->tones) | 195 | if (out_file->sound_dir->tones) |
196 | free(out_file->sound_dir->tones); | 196 | free(out_file->sound_dir->tones); |
197 | 197 | ||
198 | free(out_file->sound_dir); | 198 | free(out_file->sound_dir); |
199 | } | 199 | } |
200 | 200 | ||
201 | eina_list_free(out_file->color_classes); | 201 | eina_list_free(out_file->color_classes); |
202 | eina_hash_free_cb_set(out_file->collection, free); | 202 | eina_hash_free_cb_set(out_file->collection, free); |
203 | eina_hash_free(out_file->collection); | 203 | eina_hash_free(out_file->collection); |
204 | eina_stringshare_del(out_file->compiler); | 204 | eina_stringshare_del(out_file->compiler); |
205 | 205 | ||
206 | free(out_file); | 206 | free(out_file); |
207 | } | 207 | } |
208 | } | 208 | } |
209 | 209 | ||
210 | static int | 210 | static int |
211 | _edje_pick_cleanup(Eina_List *ifs, Edje_File *out_file, Edje_Pick_Status s) | 211 | _edje_pick_cleanup(Eina_List *ifs, Edje_File *out_file, Edje_Pick_Status s) |
212 | { | 212 | { |
213 | Edje_Pick_File_Params *p; | 213 | Edje_Pick_File_Params *p; |
214 | Edje_Pick_Font *ft; | 214 | Edje_Pick_Font *ft; |
215 | void *n; | 215 | void *n; |
216 | 216 | ||
217 | _edje_pick_out_file_free(out_file); | 217 | _edje_pick_out_file_free(out_file); |
218 | 218 | ||
219 | EINA_LIST_FREE(ifs, p) | 219 | EINA_LIST_FREE(ifs, p) |
220 | { | 220 | { |
221 | EINA_LIST_FREE(p->groups, n) | 221 | EINA_LIST_FREE(p->groups, n) |
222 | eina_stringshare_del(n); | 222 | eina_stringshare_del(n); |
223 | 223 | ||
224 | _edje_pick_data_free(p->scriptlist); | 224 | _edje_pick_data_free(p->scriptlist); |
225 | p->scriptlist = NULL; | 225 | p->scriptlist = NULL; |
226 | 226 | ||
227 | _edje_pick_data_free(p->luascriptlist); | 227 | _edje_pick_data_free(p->luascriptlist); |
228 | p->luascriptlist = NULL; | 228 | p->luascriptlist = NULL; |
229 | 229 | ||
230 | _edje_pick_data_free(p->imagelist); | 230 | _edje_pick_data_free(p->imagelist); |
231 | p->imagelist = NULL; | 231 | p->imagelist = NULL; |
232 | 232 | ||
233 | _edje_pick_data_free(p->imagesetlist); | 233 | _edje_pick_data_free(p->imagesetlist); |
234 | p->imagesetlist = NULL; | 234 | p->imagesetlist = NULL; |
235 | 235 | ||
236 | _edje_pick_data_free(p->samplelist); | 236 | _edje_pick_data_free(p->samplelist); |
237 | 237 | ||
238 | EINA_LIST_FREE(p->tonelist, n) | 238 | EINA_LIST_FREE(p->tonelist, n) |
239 | free(n); | 239 | free(n); |
240 | 240 | ||
241 | if (p->edf) | 241 | if (p->edf) |
242 | _edje_cache_file_unref(p->edf); | 242 | _edje_cache_file_unref(p->edf); |
243 | 243 | ||
244 | free(p); | 244 | free(p); |
245 | } | 245 | } |
246 | 246 | ||
247 | EINA_LIST_FREE(context.fontlist, ft) | 247 | EINA_LIST_FREE(context.fontlist, ft) |
248 | { | 248 | { |
249 | Edje_Font *st = ft->f; | 249 | Edje_Font *st = ft->f; |
250 | 250 | ||
251 | eina_stringshare_del(st->name); | 251 | eina_stringshare_del(st->name); |
252 | eina_stringshare_del(st->file); | 252 | eina_stringshare_del(st->file); |
253 | free(st); | 253 | free(st); |
254 | free(ft); | 254 | free(ft); |
255 | } | 255 | } |
256 | 256 | ||
257 | switch (s) | 257 | switch (s) |
258 | { | 258 | { |
259 | case EDJE_PICK_OUT_FILENAME_MISSING: | 259 | case EDJE_PICK_OUT_FILENAME_MISSING: |
260 | EINA_LOG_ERR("Output file name missing.\n"); | 260 | EINA_LOG_ERR("Output file name missing.\n"); |
261 | break; | 261 | break; |
262 | case EDJE_PICK_FAILED_OPEN_INP: | 262 | case EDJE_PICK_FAILED_OPEN_INP: |
263 | EINA_LOG_ERR("Failed to open input file.\n"); | 263 | EINA_LOG_ERR("Failed to open input file.\n"); |
264 | break; | 264 | break; |
265 | case EDJE_PICK_FAILED_READ_INP: | 265 | case EDJE_PICK_FAILED_READ_INP: |
266 | EINA_LOG_ERR("Failed to read input file.\n"); | 266 | EINA_LOG_ERR("Failed to read input file.\n"); |
267 | break; | 267 | break; |
268 | case EDJE_PICK_DUP_GROUP: | 268 | case EDJE_PICK_DUP_GROUP: |
269 | EINA_LOG_ERR("Can't fetch groups with identical name from various files.\n"); | 269 | EINA_LOG_ERR("Can't fetch groups with identical name from various files.\n"); |
270 | break; | 270 | break; |
271 | case EDJE_PICK_INCLUDE_MISSING: | 271 | case EDJE_PICK_INCLUDE_MISSING: |
272 | EINA_LOG_ERR("Cannot select groups when no input file included.\n"); | 272 | EINA_LOG_ERR("Cannot select groups when no input file included.\n"); |
273 | break; | 273 | break; |
274 | case EDJE_PICK_GROUP_MISSING: | 274 | case EDJE_PICK_GROUP_MISSING: |
275 | EINA_LOG_ERR("Group name missing for include file.\n"); | 275 | EINA_LOG_ERR("Group name missing for include file.\n"); |
276 | break; | 276 | break; |
277 | case EDJE_PICK_PARSE_FAILED: | 277 | case EDJE_PICK_PARSE_FAILED: |
278 | EINA_LOG_ERR("Command parsing failed.\n"); | 278 | EINA_LOG_ERR("Command parsing failed.\n"); |
279 | break; | 279 | break; |
280 | default: | 280 | default: |
281 | return s; | 281 | return s; |
282 | } | 282 | } |
283 | 283 | ||
284 | _edje_edd_shutdown(); | 284 | _edje_edd_shutdown(); |
285 | eet_shutdown(); | 285 | eet_shutdown(); |
286 | return s; | 286 | return s; |
287 | } | 287 | } |
288 | 288 | ||
289 | /* Look for group name in all input files that are not d1 */ | 289 | /* Look for group name in all input files that are not d1 */ |
290 | static int | 290 | static int |
291 | _group_name_in_other_file(Eina_List *inp_files, void *d1, void *d2) | 291 | _group_name_in_other_file(Eina_List *inp_files, void *d1, void *d2) |
292 | { | 292 | { |
293 | Edje_Pick_File_Params *inp_file = d1; | 293 | Edje_Pick_File_Params *inp_file = d1; |
294 | char *group = d2; /* Group name to search */ | 294 | char *group = d2; /* Group name to search */ |
295 | Eina_List *f; | 295 | Eina_List *f; |
296 | Edje_Pick_File_Params *current_file; | 296 | Edje_Pick_File_Params *current_file; |
297 | 297 | ||
298 | EINA_LIST_FOREACH(inp_files, f, current_file) | 298 | EINA_LIST_FOREACH(inp_files, f, current_file) |
299 | if (inp_file != current_file) | 299 | if (inp_file != current_file) |
300 | if (eina_list_search_unsorted(current_file->groups, | 300 | if (eina_list_search_unsorted(current_file->groups, |
301 | (Eina_Compare_Cb) strcmp, | 301 | (Eina_Compare_Cb) strcmp, |
302 | group)) | 302 | group)) |
303 | return 1; | 303 | return 1; |
304 | 304 | ||
305 | return 0; /* Not found */ | 305 | return 0; /* Not found */ |
306 | } | 306 | } |
307 | 307 | ||
308 | static int | 308 | static int |
309 | _edje_pick_command_line_parse(int argc, char **argv, | 309 | _edje_pick_command_line_parse(int argc, char **argv, |
310 | Eina_List **ifs, char **ofn) | 310 | Eina_List **ifs, char **ofn) |
311 | { /* On return ifs is Input Files List, ofn is Output File Name */ | 311 | { /* On return ifs is Input Files List, ofn is Output File Name */ |
312 | Eina_List *gpf = NULL; /* List including counters of groups-per-file */ | 312 | Eina_List *gpf = NULL; /* List including counters of groups-per-file */ |
313 | Eina_List *a_files = NULL; | 313 | Eina_List *a_files = NULL; |
314 | Eina_List *i_files = NULL; | 314 | Eina_List *i_files = NULL; |
315 | Eina_List *l; | 315 | Eina_List *l; |
316 | Eina_List *ll; | 316 | Eina_List *ll; |
317 | Eina_List *cg; | 317 | Eina_List *cg; |
318 | Eina_List *groups = NULL; | 318 | Eina_List *groups = NULL; |
319 | char *output_filename = NULL; | 319 | char *output_filename = NULL; |
320 | Edje_Pick_File_Params *current_inp = NULL; | 320 | Edje_Pick_File_Params *current_inp = NULL; |
321 | Eina_List *files = NULL; /* List of input files */ | 321 | Eina_List *files = NULL; /* List of input files */ |
322 | int *c = NULL; | 322 | int *c = NULL; |
323 | char *str = NULL; | 323 | char *str = NULL; |
324 | int k; | 324 | int k; |
325 | Eina_Bool show_help = EINA_FALSE; | 325 | Eina_Bool show_help = EINA_FALSE; |
326 | 326 | ||
327 | /* Define args syntax */ | 327 | /* Define args syntax */ |
328 | #define IS_GROUP(x) ((!strcmp(x, "-g")) || (!strcmp(x, "--group"))) | 328 | #define IS_GROUP(x) ((!strcmp(x, "-g")) || (!strcmp(x, "--group"))) |
329 | #define IS_INCLUDE(x) ((!strcmp(x, "-i")) || (!strcmp(x, "--include"))) | 329 | #define IS_INCLUDE(x) ((!strcmp(x, "-i")) || (!strcmp(x, "--include"))) |
330 | #define IS_HELP(x) ((!strcmp(x, "-h")) || (!strcmp(x, "--help"))) | 330 | #define IS_HELP(x) ((!strcmp(x, "-h")) || (!strcmp(x, "--help"))) |
331 | static const Ecore_Getopt optdesc = { | 331 | static const Ecore_Getopt optdesc = { |
332 | "edje_pick", | 332 | "edje_pick", |
333 | NULL, | 333 | NULL, |
334 | "0.0", | 334 | "0.0", |
335 | "(C) 2012 Enlightenment", | 335 | "(C) 2012 Enlightenment", |
336 | "Public domain?", | 336 | "Public domain?", |
337 | "Edje Pick - the \"edj\" merging tool.", | 337 | "Edje Pick - the \"edj\" merging tool.", |
338 | 338 | ||
339 | EINA_TRUE, | 339 | EINA_TRUE, |
340 | { | 340 | { |
341 | ECORE_GETOPT_STORE_TRUE('v', "verbose", "Verbose"), | 341 | ECORE_GETOPT_STORE_TRUE('v', "verbose", "Verbose"), |
342 | ECORE_GETOPT_STORE('o', "output", "Output File", | 342 | ECORE_GETOPT_STORE('o', "output", "Output File", |
343 | ECORE_GETOPT_TYPE_STR), | 343 | ECORE_GETOPT_TYPE_STR), |
344 | ECORE_GETOPT_APPEND_METAVAR('a', "append", "Append File", | 344 | ECORE_GETOPT_APPEND_METAVAR('a', "append", "Append File", |
345 | "STRING", ECORE_GETOPT_TYPE_STR), | 345 | "STRING", ECORE_GETOPT_TYPE_STR), |
346 | ECORE_GETOPT_APPEND_METAVAR('i', "include", "Include File", | 346 | ECORE_GETOPT_APPEND_METAVAR('i', "include", "Include File", |
347 | "STRING", ECORE_GETOPT_TYPE_STR), | 347 | "STRING", ECORE_GETOPT_TYPE_STR), |
348 | ECORE_GETOPT_APPEND_METAVAR('g', "group", "Add Group", | 348 | ECORE_GETOPT_APPEND_METAVAR('g', "group", "Add Group", |
349 | "STRING", ECORE_GETOPT_TYPE_STR), | 349 | "STRING", ECORE_GETOPT_TYPE_STR), |
350 | ECORE_GETOPT_HELP('h', "help"), | 350 | ECORE_GETOPT_HELP('h', "help"), |
351 | ECORE_GETOPT_SENTINEL | 351 | ECORE_GETOPT_SENTINEL |
352 | } | 352 | } |
353 | }; | 353 | }; |
354 | 354 | ||
355 | Ecore_Getopt_Value values[] = { | 355 | Ecore_Getopt_Value values[] = { |
356 | ECORE_GETOPT_VALUE_BOOL(context.v), | 356 | ECORE_GETOPT_VALUE_BOOL(context.v), |
357 | ECORE_GETOPT_VALUE_STR(output_filename), | 357 | ECORE_GETOPT_VALUE_STR(output_filename), |
358 | ECORE_GETOPT_VALUE_LIST(a_files), | 358 | ECORE_GETOPT_VALUE_LIST(a_files), |
359 | ECORE_GETOPT_VALUE_LIST(i_files), | 359 | ECORE_GETOPT_VALUE_LIST(i_files), |
360 | ECORE_GETOPT_VALUE_LIST(groups), | 360 | ECORE_GETOPT_VALUE_LIST(groups), |
361 | ECORE_GETOPT_VALUE_NONE | 361 | ECORE_GETOPT_VALUE_NONE |
362 | }; | 362 | }; |
363 | 363 | ||
364 | /* START - Read command line args */ | 364 | /* START - Read command line args */ |
365 | c = NULL; | 365 | c = NULL; |
366 | for(k = 1; k < argc; k++) | 366 | for(k = 1; k < argc; k++) |
367 | { /* Run through args, count how many groups per file */ | 367 | { /* Run through args, count how many groups per file */ |
368 | if(IS_GROUP(argv[k])) | 368 | if(IS_GROUP(argv[k])) |
369 | { | 369 | { |
370 | if (!c) | 370 | if (!c) |
371 | return _edje_pick_cleanup(files, NULL, | 371 | return _edje_pick_cleanup(files, NULL, |
372 | EDJE_PICK_INCLUDE_MISSING); | 372 | EDJE_PICK_INCLUDE_MISSING); |
373 | 373 | ||
374 | (*c)++; | 374 | (*c)++; |
375 | continue; | 375 | continue; |
376 | } | 376 | } |
377 | 377 | ||
378 | if(IS_INCLUDE(argv[k])) | 378 | if(IS_INCLUDE(argv[k])) |
379 | { | 379 | { |
380 | c = calloc(1, sizeof(int)); | 380 | c = calloc(1, sizeof(int)); |
381 | gpf = eina_list_append(gpf, c); | 381 | gpf = eina_list_append(gpf, c); |
382 | continue; | 382 | continue; |
383 | } | 383 | } |
384 | 384 | ||
385 | show_help |= IS_HELP(argv[k]); | 385 | show_help |= IS_HELP(argv[k]); |
386 | } | 386 | } |
387 | 387 | ||
388 | if (show_help) | 388 | if (show_help) |
389 | puts(EDJE_PICK_HELP_STRING); | 389 | puts(EDJE_PICK_HELP_STRING); |
390 | 390 | ||
391 | if (ecore_getopt_parse(&optdesc, values, argc, argv) < 0) | 391 | if (ecore_getopt_parse(&optdesc, values, argc, argv) < 0) |
392 | { | 392 | { |
393 | EINA_LIST_FREE(gpf, c) | 393 | EINA_LIST_FREE(gpf, c) |
394 | free(c); | 394 | free(c); |
395 | 395 | ||
396 | return _edje_pick_cleanup(files, NULL, EDJE_PICK_PARSE_FAILED); | 396 | return _edje_pick_cleanup(files, NULL, EDJE_PICK_PARSE_FAILED); |
397 | } | 397 | } |
398 | 398 | ||
399 | if (show_help) | 399 | if (show_help) |
400 | { | 400 | { |
401 | EINA_LIST_FREE(gpf, c) | 401 | EINA_LIST_FREE(gpf, c) |
402 | free(c); | 402 | free(c); |
403 | 403 | ||
404 | ecore_getopt_list_free(i_files); | 404 | ecore_getopt_list_free(i_files); |
405 | ecore_getopt_list_free(groups); | 405 | ecore_getopt_list_free(groups); |
406 | return _edje_pick_cleanup(files, NULL, EDJE_PICK_HELP_SHOWN); | 406 | return _edje_pick_cleanup(files, NULL, EDJE_PICK_HELP_SHOWN); |
407 | } | 407 | } |
408 | 408 | ||
409 | if (context.v) /* Changed to INFO if verbose */ | 409 | if (context.v) /* Changed to INFO if verbose */ |
410 | eina_log_level_set(EINA_LOG_LEVEL_INFO); | 410 | eina_log_level_set(EINA_LOG_LEVEL_INFO); |
411 | 411 | ||
412 | EINA_LIST_FOREACH(a_files, l, str) | 412 | EINA_LIST_FOREACH(a_files, l, str) |
413 | { | 413 | { |
414 | current_inp = calloc(1, sizeof(*current_inp)); | 414 | current_inp = calloc(1, sizeof(*current_inp)); |
415 | current_inp->append = EINA_TRUE; | 415 | current_inp->append = EINA_TRUE; |
416 | current_inp->name = eina_stringshare_add(str); | 416 | current_inp->name = eina_stringshare_add(str); |
417 | files = eina_list_append(files, current_inp); | 417 | files = eina_list_append(files, current_inp); |
418 | } | 418 | } |
419 | ecore_getopt_list_free(a_files); | 419 | ecore_getopt_list_free(a_files); |
420 | 420 | ||
421 | ll = gpf; | 421 | ll = gpf; |
422 | cg = groups; | 422 | cg = groups; |
423 | EINA_LIST_FOREACH(i_files, l, str) | 423 | EINA_LIST_FOREACH(i_files, l, str) |
424 | { /* Now match groups from groups-list with included files */ | 424 | { /* Now match groups from groups-list with included files */ |
425 | current_inp = calloc(1, sizeof(*current_inp)); | 425 | current_inp = calloc(1, sizeof(*current_inp)); |
426 | current_inp->name = eina_stringshare_add(str); | 426 | current_inp->name = eina_stringshare_add(str); |
427 | files = eina_list_append(files, current_inp); | 427 | files = eina_list_append(files, current_inp); |
428 | c = eina_list_data_get(ll); | 428 | c = eina_list_data_get(ll); |
429 | if (c) | 429 | if (c) |
430 | { | 430 | { |
431 | while(*c) | 431 | while(*c) |
432 | { | 432 | { |
433 | char *g_name; | 433 | char *g_name; |
434 | if (!cg) | 434 | if (!cg) |
435 | { | 435 | { |
436 | EINA_LIST_FREE(gpf, c) | 436 | EINA_LIST_FREE(gpf, c) |
437 | free(c); | 437 | free(c); |
438 | 438 | ||
439 | ecore_getopt_list_free(i_files); | 439 | ecore_getopt_list_free(i_files); |
440 | ecore_getopt_list_free(groups); | 440 | ecore_getopt_list_free(groups); |
441 | return _edje_pick_cleanup(files, NULL, | 441 | return _edje_pick_cleanup(files, NULL, |
442 | EDJE_PICK_GROUP_MISSING); | 442 | EDJE_PICK_GROUP_MISSING); |
443 | } | 443 | } |
444 | 444 | ||
445 | 445 | ||
446 | g_name = eina_list_data_get(cg); | 446 | g_name = eina_list_data_get(cg); |
447 | if (_group_name_in_other_file(files, current_inp, g_name)) | 447 | if (_group_name_in_other_file(files, current_inp, g_name)) |
448 | return _edje_pick_cleanup(files, NULL, EDJE_PICK_DUP_GROUP); | 448 | return _edje_pick_cleanup(files, NULL, EDJE_PICK_DUP_GROUP); |
449 | 449 | ||
450 | if (!eina_list_search_unsorted(current_inp->groups, | 450 | if (!eina_list_search_unsorted(current_inp->groups, |
451 | (Eina_Compare_Cb) strcmp, g_name)) | 451 | (Eina_Compare_Cb) strcmp, g_name)) |
452 | current_inp->groups = eina_list_append( | 452 | current_inp->groups = eina_list_append( |
453 | current_inp->groups, eina_stringshare_add(g_name)); | 453 | current_inp->groups, eina_stringshare_add(g_name)); |
454 | 454 | ||
455 | cg = eina_list_next(cg); | 455 | cg = eina_list_next(cg); |
456 | (*c)--; | 456 | (*c)--; |
457 | } | 457 | } |
458 | } | 458 | } |
459 | ll = eina_list_next(ll); | 459 | ll = eina_list_next(ll); |
460 | } | 460 | } |
461 | 461 | ||
462 | EINA_LIST_FREE(gpf, c) | 462 | EINA_LIST_FREE(gpf, c) |
463 | free(c); | 463 | free(c); |
464 | 464 | ||
465 | ecore_getopt_list_free(i_files); | 465 | ecore_getopt_list_free(i_files); |
466 | ecore_getopt_list_free(groups); | 466 | ecore_getopt_list_free(groups); |
467 | 467 | ||
468 | 468 | ||
469 | if (!output_filename) | 469 | if (!output_filename) |
470 | return _edje_pick_cleanup(files, NULL, EDJE_PICK_OUT_FILENAME_MISSING); | 470 | return _edje_pick_cleanup(files, NULL, EDJE_PICK_OUT_FILENAME_MISSING); |
471 | /* END - Read command line args */ | 471 | /* END - Read command line args */ |
472 | 472 | ||
473 | /* Set output params, return OK */ | 473 | /* Set output params, return OK */ |
474 | *ifs = files; | 474 | *ifs = files; |
475 | *ofn = output_filename; | 475 | *ofn = output_filename; |
476 | return EDJE_PICK_NO_ERROR; | 476 | return EDJE_PICK_NO_ERROR; |
477 | } | 477 | } |
478 | 478 | ||
479 | static void | 479 | static void |
480 | _edje_pick_external_dir_update(Edje_File *o, Edje_File *edf) | 480 | _edje_pick_external_dir_update(Edje_File *o, Edje_File *edf) |
481 | { | 481 | { |
482 | if (edf->external_dir && edf->external_dir->entries_count) | 482 | if (edf->external_dir && edf->external_dir->entries_count) |
483 | { | 483 | { |
484 | /* Add external-dir entries */ | 484 | /* Add external-dir entries */ |
485 | unsigned int total = 0; | 485 | unsigned int total = 0; |
486 | unsigned int base = 0; | 486 | unsigned int base = 0; |
487 | 487 | ||
488 | if (o->external_dir) | 488 | if (o->external_dir) |
489 | base = total = o->external_dir->entries_count; | 489 | base = total = o->external_dir->entries_count; |
490 | else | 490 | else |
491 | o->external_dir = calloc(1, sizeof(*(o->external_dir))); | 491 | o->external_dir = calloc(1, sizeof(*(o->external_dir))); |
492 | 492 | ||
493 | total += edf->external_dir->entries_count; | 493 | total += edf->external_dir->entries_count; |
494 | 494 | ||
495 | o->external_dir->entries = realloc(o->external_dir->entries, | 495 | o->external_dir->entries = realloc(o->external_dir->entries, |
496 | total * sizeof(Edje_External_Directory_Entry)); | 496 | total * sizeof(Edje_External_Directory_Entry)); |
497 | 497 | ||
498 | memcpy(&o->external_dir->entries[base], edf->external_dir->entries, | 498 | memcpy(&o->external_dir->entries[base], edf->external_dir->entries, |
499 | edf->external_dir->entries_count * | 499 | edf->external_dir->entries_count * |
500 | sizeof(Edje_External_Directory_Entry)); | 500 | sizeof(Edje_External_Directory_Entry)); |
501 | 501 | ||
502 | o->external_dir->entries_count = total; | 502 | o->external_dir->entries_count = total; |
503 | } | 503 | } |
504 | } | 504 | } |
505 | 505 | ||
506 | static Edje_File * | 506 | static Edje_File * |
507 | _edje_pick_output_prepare(Edje_File *o, Edje_File *edf, char *name) | 507 | _edje_pick_output_prepare(Edje_File *o, Edje_File *edf, char *name) |
508 | { | 508 | { |
509 | /* Allocate and prepare header memory buffer */ | 509 | /* Allocate and prepare header memory buffer */ |
510 | if (!o) | 510 | if (!o) |
511 | { | 511 | { |
512 | o = calloc(1, sizeof(Edje_File)); | 512 | o = calloc(1, sizeof(Edje_File)); |
513 | o->compiler = eina_stringshare_add("edje_cc"); | 513 | o->compiler = eina_stringshare_add("edje_cc"); |
514 | o->version = edf->version; | 514 | o->version = edf->version; |
515 | o->minor = edf->minor; | 515 | o->minor = edf->minor; |
516 | o->feature_ver = edf->feature_ver; | 516 | o->feature_ver = edf->feature_ver; |
517 | o->collection = eina_hash_string_small_new(NULL); | 517 | o->collection = eina_hash_string_small_new(NULL); |
518 | 518 | ||
519 | /* Open output file */ | 519 | /* Open output file */ |
520 | o->ef = eet_open(name, EET_FILE_MODE_WRITE); | 520 | o->ef = eet_open(name, EET_FILE_MODE_WRITE); |
521 | } | 521 | } |
522 | else | 522 | else |
523 | { | 523 | { |
524 | if (o->version != edf->version) | 524 | if (o->version != edf->version) |
525 | { | 525 | { |
526 | EINA_LOG_WARN("Warning: Merging files of various version.\n"); | 526 | EINA_LOG_WARN("Warning: Merging files of various version.\n"); |
527 | if (o->version < edf->version) | 527 | if (o->version < edf->version) |
528 | o->version = edf->version; | 528 | o->version = edf->version; |
529 | } | 529 | } |
530 | 530 | ||
531 | if (o->minor != edf->minor) | 531 | if (o->minor != edf->minor) |
532 | { | 532 | { |
533 | EINA_LOG_WARN("Warning: Merging files of various minor.\n"); | 533 | EINA_LOG_WARN("Warning: Merging files of various minor.\n"); |
534 | if (o->minor < edf->minor) | 534 | if (o->minor < edf->minor) |
535 | o->minor = edf->minor; | 535 | o->minor = edf->minor; |
536 | } | 536 | } |
537 | 537 | ||
538 | if (o->feature_ver != edf->feature_ver) | 538 | if (o->feature_ver != edf->feature_ver) |
539 | { | 539 | { |
540 | EINA_LOG_WARN("Warning: Merging files of various feature_ver.\n"); | 540 | EINA_LOG_WARN("Warning: Merging files of various feature_ver.\n"); |
541 | if (o->feature_ver < edf->feature_ver) | 541 | if (o->feature_ver < edf->feature_ver) |
542 | o->feature_ver = edf->feature_ver; | 542 | o->feature_ver = edf->feature_ver; |
543 | } | 543 | } |
544 | } | 544 | } |
545 | 545 | ||
546 | _edje_pick_external_dir_update(o, edf); | 546 | _edje_pick_external_dir_update(o, edf); |
547 | return o; | 547 | return o; |
548 | } | 548 | } |
549 | 549 | ||
550 | static int | 550 | static int |
551 | _edje_pick_header_make(Edje_File *out_file , Edje_File *edf, Eina_List *ifs) | 551 | _edje_pick_header_make(Edje_File *out_file , Edje_File *edf, Eina_List *ifs) |
552 | { | 552 | { |
553 | static int current_group_id = 0; | 553 | static int current_group_id = 0; |
554 | Edje_Part_Collection_Directory_Entry *ce; | 554 | Edje_Part_Collection_Directory_Entry *ce; |
555 | Eina_Bool status = EDJE_PICK_NO_ERROR; | 555 | Eina_Bool status = EDJE_PICK_NO_ERROR; |
556 | Eina_List *l; | 556 | Eina_List *l; |
557 | char *name1 = NULL; | 557 | char *name1 = NULL; |
558 | 558 | ||
559 | 559 | ||
560 | _edje_cache_file_unref(edf); | 560 | _edje_cache_file_unref(edf); |
561 | 561 | ||
562 | /* Build file header */ | 562 | /* Build file header */ |
563 | if (context.current_file->append) | 563 | if (context.current_file->append) |
564 | { | 564 | { |
565 | Eina_Iterator *i; | 565 | Eina_Iterator *i; |
566 | i = eina_hash_iterator_key_new(edf->collection); | 566 | i = eina_hash_iterator_key_new(edf->collection); |
567 | EINA_ITERATOR_FOREACH(i, name1) /* Run through all keys */ | 567 | EINA_ITERATOR_FOREACH(i, name1) /* Run through all keys */ |
568 | { | 568 | { |
569 | Edje_Part_Collection_Directory_Entry *ce_out; | 569 | Edje_Part_Collection_Directory_Entry *ce_out; |
570 | 570 | ||
571 | /* Use ALL groups from this file */ | 571 | /* Use ALL groups from this file */ |
572 | /* Test that no duplicate-group name for files in append mode */ | 572 | /* Test that no duplicate-group name for files in append mode */ |
573 | /* Done here because we don't read EDC before parse cmd line */ | 573 | /* Done here because we don't read EDC before parse cmd line */ |
574 | /* We SKIP group of file in append-mode if we got this group */ | 574 | /* We SKIP group of file in append-mode if we got this group */ |
575 | /* from file in include mode. */ | 575 | /* from file in include mode. */ |
576 | if (_group_name_in_other_file(ifs, context.current_file, name1)) | 576 | if (_group_name_in_other_file(ifs, context.current_file, name1)) |
577 | continue; /* Skip group of file in append mode */ | 577 | continue; /* Skip group of file in append mode */ |
578 | 578 | ||
579 | ce = eina_hash_find(edf->collection, name1); | 579 | ce = eina_hash_find(edf->collection, name1); |
580 | ce_out = malloc(sizeof(*ce_out)); | 580 | ce_out = malloc(sizeof(*ce_out)); |
581 | memcpy(ce_out, ce, sizeof(*ce_out)); | 581 | memcpy(ce_out, ce, sizeof(*ce_out)); |
582 | 582 | ||
583 | ce_out->id = current_group_id; | 583 | ce_out->id = current_group_id; |
584 | EINA_LOG_INFO("Changing ID of group <%d> to <%d>\n", | 584 | EINA_LOG_INFO("Changing ID of group <%d> to <%d>\n", |
585 | ce->id, ce_out->id); | 585 | ce->id, ce_out->id); |
586 | current_group_id++; | 586 | current_group_id++; |
587 | 587 | ||
588 | eina_hash_direct_add(out_file->collection, ce_out->entry, ce_out); | 588 | eina_hash_direct_add(out_file->collection, ce_out->entry, ce_out); |
589 | 589 | ||
590 | /* Add this group to groups to handle for this file */ | 590 | /* Add this group to groups to handle for this file */ |
591 | context.current_file->groups = eina_list_append( | 591 | context.current_file->groups = eina_list_append( |
592 | context.current_file->groups, eina_stringshare_add(name1)); | 592 | context.current_file->groups, eina_stringshare_add(name1)); |
593 | } | 593 | } |
594 | 594 | ||
595 | eina_iterator_free(i); | 595 | eina_iterator_free(i); |
596 | } | 596 | } |
597 | else | 597 | else |
598 | { | 598 | { |
599 | EINA_LIST_FOREACH(context.current_file->groups, l , name1) | 599 | EINA_LIST_FOREACH(context.current_file->groups, l , name1) |
600 | { | 600 | { |
601 | /* Verify group found then add to ouput file header */ | 601 | /* Verify group found then add to ouput file header */ |
602 | ce = eina_hash_find(edf->collection, name1); | 602 | ce = eina_hash_find(edf->collection, name1); |
603 | 603 | ||
604 | if (!ce) | 604 | if (!ce) |
605 | { | 605 | { |
606 | EINA_LOG_ERR("Group <%s> was not found in <%s> file.\n", | 606 | EINA_LOG_ERR("Group <%s> was not found in <%s> file.\n", |
607 | name1, context.current_file->name); | 607 | name1, context.current_file->name); |
608 | status = EDJE_PICK_GROUP_NOT_FOUND; | 608 | status = EDJE_PICK_GROUP_NOT_FOUND; |
609 | } | 609 | } |
610 | else | 610 | else |
611 | { | 611 | { |
612 | Edje_Part_Collection_Directory_Entry *ce_out; | 612 | Edje_Part_Collection_Directory_Entry *ce_out; |
613 | 613 | ||
614 | /* Add this groups to hash, with filname pefix for entries */ | 614 | /* Add this groups to hash, with filname pefix for entries */ |
615 | ce_out = malloc(sizeof(*ce_out)); | 615 | ce_out = malloc(sizeof(*ce_out)); |
616 | 616 | ||
617 | memcpy(ce_out, ce, sizeof(*ce_out)); | 617 | memcpy(ce_out, ce, sizeof(*ce_out)); |
618 | 618 | ||
619 | ce_out->id = current_group_id; | 619 | ce_out->id = current_group_id; |
620 | EINA_LOG_INFO("Changing ID of group <%d> to <%d>\n", | 620 | EINA_LOG_INFO("Changing ID of group <%d> to <%d>\n", |
621 | ce->id, ce_out->id); | 621 | ce->id, ce_out->id); |
622 | current_group_id++; | 622 | current_group_id++; |
623 | 623 | ||
624 | eina_hash_direct_add(out_file->collection,ce_out->entry, | 624 | eina_hash_direct_add(out_file->collection,ce_out->entry, |
625 | ce_out); | 625 | ce_out); |
626 | } | 626 | } |
627 | } | 627 | } |
628 | } | 628 | } |
629 | 629 | ||
630 | return status; | 630 | return status; |
631 | } | 631 | } |
632 | 632 | ||
633 | static int | 633 | static int |
634 | _id_cmp(const void *d1, const void *d2) | 634 | _id_cmp(const void *d1, const void *d2) |
635 | { | 635 | { |
636 | /* Find currect ID struct */ | 636 | /* Find currect ID struct */ |
637 | return (((Edje_Pick_Data *) d1)->id.old_id - ((intptr_t) d2)); | 637 | return (((Edje_Pick_Data *) d1)->id.old_id - ((intptr_t) d2)); |
638 | } | 638 | } |
639 | 639 | ||
640 | static int | 640 | static int |
641 | _edje_pick_new_id_get(Eina_List *id_list, int id, Eina_Bool set_used) | 641 | _edje_pick_new_id_get(Eina_List *id_list, int id, Eina_Bool set_used) |
642 | { | 642 | { |
643 | if (id >= 0) | 643 | if (id >= 0) |
644 | { | 644 | { |
645 | Edje_Pick_Data *p_id = eina_list_search_unsorted(id_list, | 645 | Edje_Pick_Data *p_id = eina_list_search_unsorted(id_list, |
646 | _id_cmp, | 646 | _id_cmp, |
647 | (void *) (intptr_t) id); | 647 | (void *) (intptr_t) id); |
648 | 648 | ||
649 | 649 | ||
650 | if (p_id) | 650 | if (p_id) |
651 | { | 651 | { |
652 | if (set_used) | 652 | if (set_used) |
653 | p_id->id.used = EINA_TRUE; | 653 | p_id->id.used = EINA_TRUE; |
654 | 654 | ||
655 | return p_id->id.new_id; | 655 | return p_id->id.new_id; |
656 | } | 656 | } |
657 | } | 657 | } |
658 | 658 | ||
659 | return id; | 659 | return id; |
660 | } | 660 | } |
661 | 661 | ||
662 | static int | 662 | static int |
663 | _edje_pick_images_add(Edje_File *edf, Edje_File *o) | 663 | _edje_pick_images_add(Edje_File *edf, Edje_File *o) |
664 | { | 664 | { |
665 | char buf[1024]; | 665 | char buf[1024]; |
666 | int size; | 666 | int size; |
667 | unsigned int k; | 667 | unsigned int k; |
668 | void *data; | 668 | void *data; |
669 | Eina_Bool status = EDJE_PICK_NO_ERROR; | 669 | Eina_Bool status = EDJE_PICK_NO_ERROR; |
670 | static int current_img_id = 0; | 670 | static int current_img_id = 0; |
671 | 671 | ||
672 | if (edf->image_dir) | 672 | if (edf->image_dir) |
673 | { | 673 | { |
674 | if (!o->image_dir) /* First time only */ | 674 | if (!o->image_dir) /* First time only */ |
675 | o->image_dir = calloc(1, sizeof(*(o->image_dir))); | 675 | o->image_dir = calloc(1, sizeof(*(o->image_dir))); |
676 | 676 | ||
677 | for (k = 0; k < edf->image_dir->entries_count; k++) | 677 | for (k = 0; k < edf->image_dir->entries_count; k++) |
678 | { /* Copy Images */ | 678 | { /* Copy Images */ |
679 | Edje_Image_Directory_Entry *img = &edf->image_dir->entries[k]; | 679 | Edje_Image_Directory_Entry *img = &edf->image_dir->entries[k]; |
680 | 680 | ||
681 | snprintf(buf, sizeof(buf), "edje/images/%i", img->id); | 681 | snprintf(buf, sizeof(buf), "edje/images/%i", img->id); |
682 | VERBOSE(EINA_LOG_INFO("Trying to read <%s>\n", img->entry)); | 682 | VERBOSE(EINA_LOG_INFO("Trying to read <%s>\n", img->entry)); |
683 | data = eet_read(edf->ef, buf, &size); | 683 | data = eet_read(edf->ef, buf, &size); |
684 | if (size) | 684 | if (size) |
685 | { /* Advance image ID and register this in imagelist */ | 685 | { /* Advance image ID and register this in imagelist */ |
686 | Edje_Pick_Data *image = malloc(sizeof(*image)); | 686 | Edje_Pick_Data *image = malloc(sizeof(*image)); |
687 | 687 | ||
688 | image->filename = eina_stringshare_add(img->entry); | 688 | image->filename = eina_stringshare_add(img->entry); |
689 | image->data = data; | 689 | image->data = data; |
690 | image->size = size; | 690 | image->size = size; |
691 | image->entry = (void *) img; /* for output file image dir */ | 691 | image->entry = (void *) img; /* for output file image dir */ |
692 | image->id.old_id = img->id; | 692 | image->id.old_id = img->id; |
693 | img->id = image->id.new_id = current_img_id; | 693 | img->id = image->id.new_id = current_img_id; |
694 | image->id.used = EINA_FALSE; | 694 | image->id.used = EINA_FALSE; |
695 | 695 | ||
696 | VERBOSE(EINA_LOG_INFO("Read image <%s> data <%p> size <%d>\n", | 696 | VERBOSE(EINA_LOG_INFO("Read image <%s> data <%p> size <%d>\n", |
697 | buf, image->data, image->size)); | 697 | buf, image->data, image->size)); |
698 | 698 | ||
699 | current_img_id++; | 699 | current_img_id++; |
700 | context.current_file->imagelist = eina_list_append( | 700 | context.current_file->imagelist = eina_list_append( |
701 | context.current_file->imagelist, image); | 701 | context.current_file->imagelist, image); |
702 | } | 702 | } |
703 | else | 703 | else |
704 | { | 704 | { |
705 | if (img->entry) | 705 | if (img->entry) |
706 | { | 706 | { |
707 | EINA_LOG_ERR("Image <%s> was not found in <%s> file.\n", | 707 | EINA_LOG_ERR("Image <%s> was not found in <%s> file.\n", |
708 | img->entry , context.current_file->name); | 708 | img->entry , context.current_file->name); |
709 | status = EDJE_PICK_IMAGE_NOT_FOUND; | 709 | status = EDJE_PICK_IMAGE_NOT_FOUND; |
710 | } | 710 | } |
711 | else | 711 | else |
712 | { | 712 | { |
713 | EINA_LOG_ERR("Image entry <%s> was not found in <%s> file.\n", buf , context.current_file->name); | 713 | EINA_LOG_ERR("Image entry <%s> was not found in <%s> file.\n", buf , context.current_file->name); |
714 | status = EDJE_PICK_IMAGE_NOT_FOUND; | 714 | status = EDJE_PICK_IMAGE_NOT_FOUND; |
715 | } | 715 | } |
716 | } | 716 | } |
717 | } | 717 | } |
718 | 718 | ||
719 | if (edf->image_dir->entries) | 719 | if (edf->image_dir->entries) |
720 | { /* Copy image dir entries of current file */ | 720 | { /* Copy image dir entries of current file */ |
721 | k = o->image_dir->entries_count; /* save current entries count */ | 721 | k = o->image_dir->entries_count; /* save current entries count */ |
722 | o->image_dir->entries_count += edf->image_dir->entries_count; | 722 | o->image_dir->entries_count += edf->image_dir->entries_count; |
723 | 723 | ||
724 | /* alloc mem first time or re-allocate again (bigger array) */ | 724 | /* alloc mem first time or re-allocate again (bigger array) */ |
725 | o->image_dir->entries = realloc(o->image_dir->entries, | 725 | o->image_dir->entries = realloc(o->image_dir->entries, |
726 | o->image_dir->entries_count * | 726 | o->image_dir->entries_count * |
727 | sizeof(Edje_Image_Directory_Entry)); | 727 | sizeof(Edje_Image_Directory_Entry)); |
728 | 728 | ||
729 | /* Concatinate current file entries to re-allocaed array */ | 729 | /* Concatinate current file entries to re-allocaed array */ |
730 | memcpy(&o->image_dir->entries[k], edf->image_dir->entries, | 730 | memcpy(&o->image_dir->entries[k], edf->image_dir->entries, |
731 | edf->image_dir->entries_count * | 731 | edf->image_dir->entries_count * |
732 | sizeof(Edje_Image_Directory_Entry)); | 732 | sizeof(Edje_Image_Directory_Entry)); |
733 | } | 733 | } |
734 | 734 | ||
735 | if (edf->image_dir->sets) | 735 | if (edf->image_dir->sets) |
736 | { /* Copy image dir sets of current file */ | 736 | { /* Copy image dir sets of current file */ |
737 | k = o->image_dir->sets_count; /* save current sets count */ | 737 | k = o->image_dir->sets_count; /* save current sets count */ |
738 | o->image_dir->sets_count += edf->image_dir->sets_count; | 738 | o->image_dir->sets_count += edf->image_dir->sets_count; |
739 | /* alloc mem first time or re-allocate again (bigger array) */ | 739 | /* alloc mem first time or re-allocate again (bigger array) */ |
740 | o->image_dir->sets = realloc(o->image_dir->sets, | 740 | o->image_dir->sets = realloc(o->image_dir->sets, |
741 | o->image_dir->sets_count * | 741 | o->image_dir->sets_count * |
742 | sizeof(Edje_Image_Directory_Set_Entry)); | 742 | sizeof(Edje_Image_Directory_Set_Entry)); |
743 | 743 | ||
744 | /* Concatinate current file sets to re-allocaed array */ | 744 | /* Concatinate current file sets to re-allocaed array */ |
745 | memcpy(&o->image_dir->sets[k], edf->image_dir->sets, | 745 | memcpy(&o->image_dir->sets[k], edf->image_dir->sets, |
746 | edf->image_dir->sets_count * | 746 | edf->image_dir->sets_count * |
747 | sizeof(Edje_Image_Directory_Set_Entry)); | 747 | sizeof(Edje_Image_Directory_Set_Entry)); |
748 | 748 | ||
749 | for (; k < o->image_dir->sets_count; k++) | 749 | for (; k < o->image_dir->sets_count; k++) |
750 | { /* Fix IDs in sets to new assigned IDs of entries */ | 750 | { /* Fix IDs in sets to new assigned IDs of entries */ |
751 | Eina_List *l; | 751 | Eina_List *l; |
752 | Edje_Image_Directory_Set_Entry *e; | 752 | Edje_Image_Directory_Set_Entry *e; |
753 | Edje_Pick_Data *set = calloc(1, sizeof(*set)); | 753 | Edje_Pick_Data *set = calloc(1, sizeof(*set)); |
754 | set->id.old_id = o->image_dir->sets[k].id; | 754 | set->id.old_id = o->image_dir->sets[k].id; |
755 | set->id.new_id = k; | 755 | set->id.new_id = k; |
756 | 756 | ||
757 | /* Save IDs in set-list, used in Desc update later */ | 757 | /* Save IDs in set-list, used in Desc update later */ |
758 | context.current_file->imagesetlist = eina_list_append( | 758 | context.current_file->imagesetlist = eina_list_append( |
759 | context.current_file->imagesetlist, set); | 759 | context.current_file->imagesetlist, set); |
760 | 760 | ||
761 | o->image_dir->sets[k].id = k; /* Fix new sets IDs */ | 761 | o->image_dir->sets[k].id = k; /* Fix new sets IDs */ |
762 | EINA_LIST_FOREACH(o->image_dir->sets[k].entries, l, e) | 762 | EINA_LIST_FOREACH(o->image_dir->sets[k].entries, l, e) |
763 | e->id = _edje_pick_new_id_get( | 763 | e->id = _edje_pick_new_id_get( |
764 | context.current_file->imagelist, | 764 | context.current_file->imagelist, |
765 | e->id, EINA_FALSE); | 765 | e->id, EINA_FALSE); |
766 | } | 766 | } |
767 | } | 767 | } |
768 | } | 768 | } |
769 | 769 | ||
770 | return status; | 770 | return status; |
771 | } | 771 | } |
772 | 772 | ||
773 | static int | 773 | static int |
774 | _edje_pick_sounds_add(Edje_File *edf) | 774 | _edje_pick_sounds_add(Edje_File *edf) |
775 | { | 775 | { |
776 | char buf[1024]; | 776 | char buf[1024]; |
777 | int size, k; | 777 | int size, k; |
778 | void *data; | 778 | void *data; |
779 | Eina_Bool status = EDJE_PICK_NO_ERROR; | 779 | Eina_Bool status = EDJE_PICK_NO_ERROR; |
780 | static int current_sample_id = 0; | 780 | static int current_sample_id = 0; |
781 | 781 | ||
782 | if (edf->sound_dir) /* Copy Sounds */ | 782 | if (edf->sound_dir) /* Copy Sounds */ |
783 | { | 783 | { |
784 | for (k = 0; k < (int) edf->sound_dir->samples_count; k++) | 784 | for (k = 0; k < (int) edf->sound_dir->samples_count; k++) |
785 | { | 785 | { |
786 | Edje_Sound_Sample *sample = &edf->sound_dir->samples[k]; | 786 | Edje_Sound_Sample *sample = &edf->sound_dir->samples[k]; |
787 | 787 | ||
788 | snprintf(buf, sizeof(buf), "edje/sounds/%i", sample->id); | 788 | snprintf(buf, sizeof(buf), "edje/sounds/%i", sample->id); |
789 | VERBOSE(EINA_LOG_INFO("Trying to read <%s>\n", sample->name)); | 789 | VERBOSE(EINA_LOG_INFO("Trying to read <%s>\n", sample->name)); |
790 | 790 | ||
791 | data = eet_read(edf->ef, buf, &size); | 791 | data = eet_read(edf->ef, buf, &size); |
792 | if (size) | 792 | if (size) |
793 | { | 793 | { |
794 | Edje_Pick_Data *smpl = malloc(sizeof(*smpl)); | 794 | Edje_Pick_Data *smpl = malloc(sizeof(*smpl)); |
795 | smpl->filename = eina_stringshare_add(sample->name); | 795 | smpl->filename = eina_stringshare_add(sample->name); |
796 | smpl->data = data; | 796 | smpl->data = data; |
797 | smpl->size = size; | 797 | smpl->size = size; |
798 | smpl->entry = (void *) sample; /* for output file sound dir */ | 798 | smpl->entry = (void *) sample; /* for output file sound dir */ |
799 | smpl->id.old_id = sample->id; | 799 | smpl->id.old_id = sample->id; |
800 | sample->id = smpl->id.new_id = current_sample_id; | 800 | sample->id = smpl->id.new_id = current_sample_id; |
801 | smpl->id.used = EINA_FALSE; | 801 | smpl->id.used = EINA_FALSE; |
802 | 802 | ||
803 | VERBOSE(EINA_LOG_INFO("Read <%s> sample data <%p> size <%d>\n", | 803 | VERBOSE(EINA_LOG_INFO("Read <%s> sample data <%p> size <%d>\n", |
804 | buf, smpl->data, smpl->size)); | 804 | buf, smpl->data, smpl->size)); |
805 | 805 | ||
806 | current_sample_id++; | 806 | current_sample_id++; |
807 | context.current_file->samplelist = | 807 | context.current_file->samplelist = |
808 | eina_list_append(context.current_file->samplelist, smpl); | 808 | eina_list_append(context.current_file->samplelist, smpl); |
809 | } | 809 | } |
810 | else | 810 | else |
811 | { | 811 | { |
812 | EINA_LOG_ERR("Sample <%s> was not found in <%s> file.\n", | 812 | EINA_LOG_ERR("Sample <%s> was not found in <%s> file.\n", |
813 | sample->name, context.current_file->name); | 813 | sample->name, context.current_file->name); |
814 | status = EDJE_PICK_SAMPLE_NOT_FOUND; | 814 | status = EDJE_PICK_SAMPLE_NOT_FOUND; |
815 | } | 815 | } |
816 | } | 816 | } |
817 | 817 | ||
818 | for (k = 0; k < (int) edf->sound_dir->tones_count; k++) | 818 | for (k = 0; k < (int) edf->sound_dir->tones_count; k++) |
819 | { | 819 | { |
820 | /* Save all tones as well */ | 820 | /* Save all tones as well */ |
821 | Edje_Pick_Tone *t = malloc(sizeof(*t)); | 821 | Edje_Pick_Tone *t = malloc(sizeof(*t)); |
822 | 822 | ||
823 | t->tone = &edf->sound_dir->tones[k]; | 823 | t->tone = &edf->sound_dir->tones[k]; |
824 | /* Update ID to new ID */ | 824 | /* Update ID to new ID */ |
825 | t->tone->id = _edje_pick_new_id_get(context.current_file->samplelist, /* From samplelist */ | 825 | t->tone->id = _edje_pick_new_id_get(context.current_file->samplelist, /* From samplelist */ |
826 | t->tone->id, EINA_FALSE); | 826 | t->tone->id, EINA_FALSE); |
827 | 827 | ||
828 | t->used = EINA_FALSE; | 828 | t->used = EINA_FALSE; |
829 | context.current_file->tonelist = eina_list_append(context.current_file->tonelist, t); | 829 | context.current_file->tonelist = eina_list_append(context.current_file->tonelist, t); |
830 | } | 830 | } |
831 | } | 831 | } |
832 | 832 | ||
833 | return status; | 833 | return status; |
834 | } | 834 | } |
835 | 835 | ||
836 | static int | 836 | static int |
837 | _font_cmp(const void *d1, const void *d2) | 837 | _font_cmp(const void *d1, const void *d2) |
838 | { | 838 | { |
839 | const Edje_Font *f1 = d1; | 839 | const Edje_Font *f1 = d1; |
840 | const Edje_Font *f2 = d2; | 840 | const Edje_Font *f2 = d2; |
841 | 841 | ||
842 | /* Same font if (d1->name == d2->name) AND (d1->file == d2->file) */ | 842 | /* Same font if (d1->name == d2->name) AND (d1->file == d2->file) */ |
843 | return (strcmp(f1->name, f2->name) | | 843 | return (strcmp(f1->name, f2->name) | |
844 | strcmp(f1->file, f2->file)); | 844 | strcmp(f1->file, f2->file)); |
845 | } | 845 | } |
846 | 846 | ||
847 | static int | 847 | static int |
848 | _Edje_Pick_Fonts_add(Edje_File *edf) | 848 | _Edje_Pick_Fonts_add(Edje_File *edf) |
849 | { | 849 | { |
850 | Eet_Data_Descriptor *_font_list_edd = NULL; | 850 | Eet_Data_Descriptor *_font_list_edd = NULL; |
851 | Eet_Data_Descriptor *_font_edd; | 851 | Eet_Data_Descriptor *_font_edd; |
852 | Edje_Font_List *fl; | 852 | Edje_Font_List *fl; |
853 | Edje_Font *f; | 853 | Edje_Font *f; |
854 | Eina_List *l; | 854 | Eina_List *l; |
855 | 855 | ||
856 | _edje_data_font_list_desc_make(&_font_list_edd, &_font_edd); | 856 | _edje_data_font_list_desc_make(&_font_list_edd, &_font_edd); |
857 | fl = eet_data_read(edf->ef, _font_list_edd, "edje_source_fontmap"); | 857 | fl = eet_data_read(edf->ef, _font_list_edd, "edje_source_fontmap"); |
858 | 858 | ||
859 | EINA_LIST_FOREACH(fl->list, l, f) | 859 | EINA_LIST_FOREACH(fl->list, l, f) |
860 | { | 860 | { |
861 | if (!eina_list_search_unsorted(context.fontlist, | 861 | if (!eina_list_search_unsorted(context.fontlist, |
862 | _font_cmp, f)) | 862 | _font_cmp, f)) |
863 | { | 863 | { |
864 | /* Add only fonts that are NOT regestered in our list */ | 864 | /* Add only fonts that are NOT regestered in our list */ |
865 | Edje_Pick_Font *ft = malloc(sizeof(*ft)); | 865 | Edje_Pick_Font *ft = malloc(sizeof(*ft)); |
866 | Edje_Font *st = malloc(sizeof(*st)); | 866 | Edje_Font *st = malloc(sizeof(*st)); |
867 | 867 | ||
868 | st->name = (char *) eina_stringshare_add(f->name); | 868 | st->name = (char *) eina_stringshare_add(f->name); |
869 | st->file = (char *) eina_stringshare_add(f->file); | 869 | st->file = (char *) eina_stringshare_add(f->file); |
870 | 870 | ||
871 | ft->f = st; | 871 | ft->f = st; |
872 | ft->used = EINA_TRUE; /* TODO: Fix this later */ | 872 | ft->used = EINA_TRUE; /* TODO: Fix this later */ |
873 | context.fontlist = eina_list_append(context.fontlist, ft); | 873 | context.fontlist = eina_list_append(context.fontlist, ft); |
874 | } | 874 | } |
875 | } | 875 | } |
876 | 876 | ||
877 | free(fl); | 877 | free(fl); |
878 | eet_data_descriptor_free(_font_list_edd); | 878 | eet_data_descriptor_free(_font_list_edd); |
879 | eet_data_descriptor_free(_font_edd); | 879 | eet_data_descriptor_free(_font_edd); |
880 | 880 | ||
881 | return EDJE_PICK_NO_ERROR; | 881 | return EDJE_PICK_NO_ERROR; |
882 | } | 882 | } |
883 | 883 | ||
884 | static int | 884 | static int |
885 | _edje_pick_scripts_add(Edje_File *edf, int id, int new_id) | 885 | _edje_pick_scripts_add(Edje_File *edf, int id, int new_id) |
886 | { | 886 | { |
887 | int size; | 887 | int size; |
888 | void *data; | 888 | void *data; |
889 | char buf[1024]; | 889 | char buf[1024]; |
890 | 890 | ||
891 | /* Copy Script */ | 891 | /* Copy Script */ |
892 | snprintf(buf, sizeof(buf), "edje/scripts/embryo/compiled/%i", id); | 892 | snprintf(buf, sizeof(buf), "edje/scripts/embryo/compiled/%i", id); |
893 | data = eet_read(edf->ef, buf, &size); | 893 | data = eet_read(edf->ef, buf, &size); |
894 | if (size) | 894 | if (size) |
895 | { | 895 | { |
896 | Edje_Pick_Data *s = calloc(1, sizeof(*s)); | 896 | Edje_Pick_Data *s = calloc(1, sizeof(*s)); |
897 | 897 | ||
898 | s->data = data; | 898 | s->data = data; |
899 | s->size = size; | 899 | s->size = size; |
900 | s->id.old_id = id; | 900 | s->id.old_id = id; |
901 | s->id.new_id = new_id; | 901 | s->id.new_id = new_id; |
902 | s->id.used = EINA_TRUE; | 902 | s->id.used = EINA_TRUE; |
903 | 903 | ||
904 | VERBOSE(EINA_LOG_INFO("Read embryo script <%s> data <%p> size <%d>\n", | 904 | VERBOSE(EINA_LOG_INFO("Read embryo script <%s> data <%p> size <%d>\n", |
905 | buf, s->data, s->size)); | 905 | buf, s->data, s->size)); |
906 | context.current_file->scriptlist = eina_list_append(context.current_file->scriptlist, s); | 906 | context.current_file->scriptlist = eina_list_append(context.current_file->scriptlist, s); |
907 | } | 907 | } |
908 | 908 | ||
909 | return EDJE_PICK_NO_ERROR; | 909 | return EDJE_PICK_NO_ERROR; |
910 | } | 910 | } |
911 | 911 | ||
912 | static int | 912 | static int |
913 | _edje_pick_lua_scripts_add(Edje_File *edf, int id, int new_id) | 913 | _edje_pick_lua_scripts_add(Edje_File *edf, int id, int new_id) |
914 | { | 914 | { |
915 | int size; | 915 | int size; |
916 | void *data; | 916 | void *data; |
917 | char buf[1024]; | 917 | char buf[1024]; |
918 | 918 | ||
919 | /* Copy Script */ | 919 | /* Copy Script */ |
920 | snprintf(buf, sizeof(buf), "edje/scripts/lua/%i", id); | 920 | snprintf(buf, sizeof(buf), "edje/scripts/lua/%i", id); |
921 | data = eet_read(edf->ef, buf, &size); | 921 | data = eet_read(edf->ef, buf, &size); |
922 | if (size) | 922 | if (size) |
923 | { | 923 | { |
924 | Edje_Pick_Data *s = calloc(1, sizeof(*s)); | 924 | Edje_Pick_Data *s = calloc(1, sizeof(*s)); |
925 | 925 | ||
926 | s->data = data; | 926 | s->data = data; |
927 | s->size = size; | 927 | s->size = size; |
928 | s->id.old_id = id; | 928 | s->id.old_id = id; |
929 | s->id.new_id = new_id; | 929 | s->id.new_id = new_id; |
930 | s->id.used = EINA_TRUE; | 930 | s->id.used = EINA_TRUE; |
931 | 931 | ||
932 | VERBOSE(EINA_LOG_INFO("Read lua script <%s> data <%p> size <%d>\n", | 932 | VERBOSE(EINA_LOG_INFO("Read lua script <%s> data <%p> size <%d>\n", |
933 | buf, s->data, s->size)); | 933 | buf, s->data, s->size)); |
934 | context.current_file->luascriptlist = eina_list_append(context.current_file->luascriptlist, s); | 934 | context.current_file->luascriptlist = eina_list_append(context.current_file->luascriptlist, s); |
935 | } | 935 | } |
936 | 936 | ||
937 | return EDJE_PICK_NO_ERROR; | 937 | return EDJE_PICK_NO_ERROR; |
938 | } | 938 | } |
939 | 939 | ||
940 | static void | 940 | static void |
941 | _edje_pick_styles_update(Edje_File *o, Edje_File *edf) | 941 | _edje_pick_styles_update(Edje_File *o, Edje_File *edf) |
942 | { | 942 | { |
943 | /* Color Class in Edje_File */ | 943 | /* Color Class in Edje_File */ |
944 | Eina_List *l; | 944 | Eina_List *l; |
945 | Edje_Style *stl; | 945 | Edje_Style *stl; |
946 | 946 | ||
947 | EINA_LIST_FOREACH(edf->styles, l, stl) | 947 | EINA_LIST_FOREACH(edf->styles, l, stl) |
948 | o->styles = eina_list_append(o->styles, stl); | 948 | o->styles = eina_list_append(o->styles, stl); |
949 | } | 949 | } |
950 | 950 | ||
951 | static void | 951 | static void |
952 | _edje_pick_color_class_update(Edje_File *o, Edje_File *edf) | 952 | _edje_pick_color_class_update(Edje_File *o, Edje_File *edf) |
953 | { | 953 | { |
954 | /* Color Class in Edje_File */ | 954 | /* Color Class in Edje_File */ |
955 | Eina_List *l; | 955 | Eina_List *l; |
956 | Edje_Color_Class *cc; | 956 | Edje_Color_Class *cc; |
957 | 957 | ||
958 | EINA_LIST_FOREACH(edf->color_classes, l, cc) | 958 | EINA_LIST_FOREACH(edf->color_classes, l, cc) |
959 | o->color_classes = eina_list_append(o->color_classes, cc); | 959 | o->color_classes = eina_list_append(o->color_classes, cc); |
960 | } | 960 | } |
961 | 961 | ||
962 | 962 | ||
963 | static void | 963 | static void |
964 | _edje_pick_images_desc_update(Edje_Part_Description_Image *desc) | 964 | _edje_pick_images_desc_update(Edje_Part_Description_Image *desc) |
965 | { | 965 | { |
966 | /* Update all IDs of images in descs */ | 966 | /* Update all IDs of images in descs */ |
967 | if (desc) | 967 | if (desc) |
968 | { | 968 | { |
969 | unsigned int k; | 969 | unsigned int k; |
970 | int new_id = (desc->image.set) ? | 970 | int new_id = (desc->image.set) ? |
971 | _edje_pick_new_id_get(context.current_file->imagesetlist, | 971 | _edje_pick_new_id_get(context.current_file->imagesetlist, |
972 | desc->image.id, | 972 | desc->image.id, |
973 | EINA_TRUE) : | 973 | EINA_TRUE) : |
974 | _edje_pick_new_id_get(context.current_file->imagelist, | 974 | _edje_pick_new_id_get(context.current_file->imagelist, |
975 | desc->image.id, | 975 | desc->image.id, |
976 | EINA_TRUE); | 976 | EINA_TRUE); |
977 | 977 | ||
978 | desc->image.id = new_id; | 978 | desc->image.id = new_id; |
979 | 979 | ||
980 | for (k = 0; k < desc->image.tweens_count; k++) | 980 | for (k = 0; k < desc->image.tweens_count; k++) |
981 | { | 981 | { |
982 | new_id = (desc->image.set) ? | 982 | new_id = (desc->image.set) ? |
983 | _edje_pick_new_id_get(context.current_file->imagesetlist, | 983 | _edje_pick_new_id_get(context.current_file->imagesetlist, |
984 | desc->image.tweens[k]->id , | 984 | desc->image.tweens[k]->id , |
985 | EINA_TRUE) : | 985 | EINA_TRUE) : |
986 | _edje_pick_new_id_get(context.current_file->imagelist, | 986 | _edje_pick_new_id_get(context.current_file->imagelist, |
987 | desc->image.tweens[k]->id , | 987 | desc->image.tweens[k]->id , |
988 | EINA_TRUE); | 988 | EINA_TRUE); |
989 | 989 | ||
990 | desc->image.tweens[k]->id = new_id; | 990 | desc->image.tweens[k]->id = new_id; |
991 | } | 991 | } |
992 | } | 992 | } |
993 | } | 993 | } |
994 | 994 | ||
995 | static void | 995 | static void |
996 | _edje_pick_images_process(Edje_Part_Collection *edc) | 996 | _edje_pick_images_process(Edje_Part_Collection *edc) |
997 | { | 997 | { |
998 | /* Find what images are used, update IDs, mark as USED */ | 998 | /* Find what images are used, update IDs, mark as USED */ |
999 | unsigned int i; | 999 | unsigned int i; |
1000 | 1000 | ||
1001 | for (i = 0; i < edc->parts_count; i++) | 1001 | for (i = 0; i < edc->parts_count; i++) |
1002 | { | 1002 | { |
1003 | /* Scan all parts, locate what images used */ | 1003 | /* Scan all parts, locate what images used */ |
1004 | Edje_Part *part = edc->parts[i]; | 1004 | Edje_Part *part = edc->parts[i]; |
1005 | 1005 | ||
1006 | if (part->type == EDJE_PART_TYPE_IMAGE) | 1006 | if (part->type == EDJE_PART_TYPE_IMAGE) |
1007 | { | 1007 | { |
1008 | /* Update IDs of all images in ALL descs of this part */ | 1008 | /* Update IDs of all images in ALL descs of this part */ |
1009 | unsigned int k; | 1009 | unsigned int k; |
1010 | 1010 | ||
1011 | _edje_pick_images_desc_update((Edje_Part_Description_Image *) part->default_desc); | 1011 | _edje_pick_images_desc_update((Edje_Part_Description_Image *) part->default_desc); |
1012 | 1012 | ||
1013 | for (k = 0; k < part->other.desc_count; k++) | 1013 | for (k = 0; k < part->other.desc_count; k++) |
1014 | _edje_pick_images_desc_update((Edje_Part_Description_Image *) part->other.desc[k]); | 1014 | _edje_pick_images_desc_update((Edje_Part_Description_Image *) part->other.desc[k]); |
1015 | } | 1015 | } |
1016 | } | 1016 | } |
1017 | } | 1017 | } |
1018 | 1018 | ||
1019 | static int | 1019 | static int |
1020 | _sample_cmp(const void *d1, const void *d2) | 1020 | _sample_cmp(const void *d1, const void *d2) |
1021 | { | 1021 | { |
1022 | /* Locate sample by name */ | 1022 | /* Locate sample by name */ |
1023 | if (d2) | 1023 | if (d2) |
1024 | { | 1024 | { |
1025 | Edje_Sound_Sample *sample = ((Edje_Pick_Data *) d1)->entry; | 1025 | Edje_Sound_Sample *sample = ((Edje_Pick_Data *) d1)->entry; |
1026 | 1026 | ||
1027 | return strcmp(sample->name, d2); | 1027 | return strcmp(sample->name, d2); |
1028 | } | 1028 | } |
1029 | 1029 | ||
1030 | return 1; | 1030 | return 1; |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | static int | 1033 | static int |
1034 | _tone_cmp(const void *d1, const void *d2) | 1034 | _tone_cmp(const void *d1, const void *d2) |
1035 | { | 1035 | { |
1036 | /* Locate tone by name */ | 1036 | /* Locate tone by name */ |
1037 | if (d2) | 1037 | if (d2) |
1038 | { | 1038 | { |
1039 | Edje_Sound_Tone *tone = ((Edje_Pick_Tone *) d1)->tone; | 1039 | Edje_Sound_Tone *tone = ((Edje_Pick_Tone *) d1)->tone; |
1040 | 1040 | ||
1041 | return strcmp(tone->name, d2); | 1041 | return strcmp(tone->name, d2); |
1042 | } | 1042 | } |
1043 | 1043 | ||
1044 | return 1; | 1044 | return 1; |
1045 | } | 1045 | } |
1046 | 1046 | ||
1047 | static void | 1047 | static void |
1048 | _edje_pick_program_update(Edje_Program *prog) | 1048 | _edje_pick_program_update(Edje_Program *prog) |
1049 | { | 1049 | { |
1050 | Edje_Pick_Data *p; | 1050 | Edje_Pick_Data *p; |
1051 | Edje_Pick_Tone *t; | 1051 | Edje_Pick_Tone *t; |
1052 | 1052 | ||
1053 | /* Scan for used samples, update samples IDs */ | 1053 | /* Scan for used samples, update samples IDs */ |
1054 | p = eina_list_search_unsorted(context.current_file->samplelist, | 1054 | p = eina_list_search_unsorted(context.current_file->samplelist, |
1055 | (Eina_Compare_Cb) _sample_cmp, | 1055 | (Eina_Compare_Cb) _sample_cmp, |
1056 | prog->sample_name); | 1056 | prog->sample_name); |
1057 | 1057 | ||
1058 | /* Sample is used by program, should be saved */ | 1058 | /* Sample is used by program, should be saved */ |
1059 | if (p) | 1059 | if (p) |
1060 | p->id.used = EINA_TRUE; | 1060 | p->id.used = EINA_TRUE; |
1061 | 1061 | ||
1062 | /* handle tones as well */ | 1062 | /* handle tones as well */ |
1063 | t = eina_list_search_unsorted(context.current_file->tonelist, | 1063 | t = eina_list_search_unsorted(context.current_file->tonelist, |
1064 | (Eina_Compare_Cb) _tone_cmp, | 1064 | (Eina_Compare_Cb) _tone_cmp, |
1065 | prog->tone_name); | 1065 | prog->tone_name); |
1066 | 1066 | ||
1067 | /* Tone is used by program, should be saved */ | 1067 | /* Tone is used by program, should be saved */ |
1068 | if (t) | 1068 | if (t) |
1069 | t->used = EINA_TRUE; | 1069 | t->used = EINA_TRUE; |
1070 | } | 1070 | } |
1071 | 1071 | ||
1072 | static int | 1072 | static int |
1073 | _edje_pick_programs_process(Edje_Part_Collection *edc) | 1073 | _edje_pick_programs_process(Edje_Part_Collection *edc) |
1074 | { | 1074 | { |
1075 | /* This wil mark which samples are used and should be saved */ | 1075 | /* This wil mark which samples are used and should be saved */ |
1076 | unsigned int i; | 1076 | unsigned int i; |
1077 | 1077 | ||
1078 | for(i = 0; i < edc->programs.fnmatch_count; i++) | 1078 | for(i = 0; i < edc->programs.fnmatch_count; i++) |
1079 | _edje_pick_program_update(edc->programs.fnmatch[i]); | 1079 | _edje_pick_program_update(edc->programs.fnmatch[i]); |
1080 | 1080 | ||
1081 | for(i = 0; i < edc->programs.strcmp_count; i++) | 1081 | for(i = 0; i < edc->programs.strcmp_count; i++) |
1082 | _edje_pick_program_update(edc->programs.strcmp[i]); | 1082 | _edje_pick_program_update(edc->programs.strcmp[i]); |
1083 | 1083 | ||
1084 | for(i = 0; i < edc->programs.strncmp_count; i++) | 1084 | for(i = 0; i < edc->programs.strncmp_count; i++) |
1085 | _edje_pick_program_update(edc->programs.strncmp[i]); | 1085 | _edje_pick_program_update(edc->programs.strncmp[i]); |
1086 | 1086 | ||
1087 | for(i = 0; i < edc->programs.strrncmp_count; i++) | 1087 | for(i = 0; i < edc->programs.strrncmp_count; i++) |
1088 | _edje_pick_program_update(edc->programs.strrncmp[i]); | 1088 | _edje_pick_program_update(edc->programs.strrncmp[i]); |
1089 | 1089 | ||
1090 | for(i = 0; i < edc->programs.nocmp_count; i++) | 1090 | for(i = 0; i < edc->programs.nocmp_count; i++) |
1091 | _edje_pick_program_update(edc->programs.nocmp[i]); | 1091 | _edje_pick_program_update(edc->programs.nocmp[i]); |
1092 | 1092 | ||
1093 | return EDJE_PICK_NO_ERROR; | 1093 | return EDJE_PICK_NO_ERROR; |
1094 | } | 1094 | } |
1095 | 1095 | ||
1096 | static int | 1096 | static int |
1097 | _edje_pick_collection_process(Edje_Part_Collection *edc) | 1097 | _edje_pick_collection_process(Edje_Part_Collection *edc) |
1098 | { | 1098 | { |
1099 | /* Update all IDs, NAMES in current collection */ | 1099 | /* Update all IDs, NAMES in current collection */ |
1100 | static int current_collection_id = 0; | 1100 | static int current_collection_id = 0; |
1101 | 1101 | ||
1102 | edc->id = current_collection_id; | 1102 | edc->id = current_collection_id; |
1103 | current_collection_id++; | 1103 | current_collection_id++; |
1104 | _edje_pick_images_process(edc); | 1104 | _edje_pick_images_process(edc); |
1105 | _edje_pick_programs_process(edc); | 1105 | _edje_pick_programs_process(edc); |
1106 | 1106 | ||
1107 | return EDJE_PICK_NO_ERROR; | 1107 | return EDJE_PICK_NO_ERROR; |
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | static void | 1110 | static void |
1111 | _edje_pick_sound_dir_compose(Eina_List *samples, Eina_List *tones, Edje_File *o) | 1111 | _edje_pick_sound_dir_compose(Eina_List *samples, Eina_List *tones, Edje_File *o) |
1112 | { /* Compose sound_dir array from all used samples, tones */ | 1112 | { /* Compose sound_dir array from all used samples, tones */ |
1113 | if (samples) | 1113 | if (samples) |
1114 | { | 1114 | { |
1115 | Edje_Sound_Sample *sample; | 1115 | Edje_Sound_Sample *sample; |
1116 | Edje_Sound_Sample *p; | 1116 | Edje_Sound_Sample *p; |
1117 | Eina_List *l; | 1117 | Eina_List *l; |
1118 | 1118 | ||
1119 | o->sound_dir = calloc(1, sizeof(*(o->sound_dir))); | 1119 | o->sound_dir = calloc(1, sizeof(*(o->sound_dir))); |
1120 | o->sound_dir->samples = malloc(eina_list_count(samples) * | 1120 | o->sound_dir->samples = malloc(eina_list_count(samples) * |
1121 | sizeof(Edje_Sound_Sample)); | 1121 | sizeof(Edje_Sound_Sample)); |
1122 | 1122 | ||
1123 | p = o->sound_dir->samples; | 1123 | p = o->sound_dir->samples; |
1124 | EINA_LIST_FOREACH(samples, l, sample) | 1124 | EINA_LIST_FOREACH(samples, l, sample) |
1125 | { | 1125 | { |
1126 | memcpy(p, sample, sizeof(Edje_Sound_Sample)); | 1126 | memcpy(p, sample, sizeof(Edje_Sound_Sample)); |
1127 | p++; | 1127 | p++; |
1128 | } | 1128 | } |
1129 | 1129 | ||
1130 | o->sound_dir->samples_count = eina_list_count(samples); | 1130 | o->sound_dir->samples_count = eina_list_count(samples); |
1131 | 1131 | ||
1132 | if (tones) | 1132 | if (tones) |
1133 | { | 1133 | { |
1134 | Edje_Sound_Tone *tone; | 1134 | Edje_Sound_Tone *tone; |
1135 | Edje_Sound_Tone *t; | 1135 | Edje_Sound_Tone *t; |
1136 | 1136 | ||
1137 | o->sound_dir->tones = malloc(eina_list_count(tones) * | 1137 | o->sound_dir->tones = malloc(eina_list_count(tones) * |
1138 | sizeof(Edje_Sound_Tone)); | 1138 | sizeof(Edje_Sound_Tone)); |
1139 | 1139 | ||
1140 | t = o->sound_dir->tones; | 1140 | t = o->sound_dir->tones; |
1141 | EINA_LIST_FOREACH(tones, l, tone) | 1141 | EINA_LIST_FOREACH(tones, l, tone) |
1142 | { | 1142 | { |
1143 | memcpy(t, tone, sizeof(Edje_Sound_Tone)); | 1143 | memcpy(t, tone, sizeof(Edje_Sound_Tone)); |
1144 | t++; | 1144 | t++; |
1145 | } | 1145 | } |
1146 | 1146 | ||
1147 | o->sound_dir->tones_count = eina_list_count(tones); | 1147 | o->sound_dir->tones_count = eina_list_count(tones); |
1148 | } | 1148 | } |
1149 | } | 1149 | } |
1150 | } | 1150 | } |
1151 | 1151 | ||
1152 | int | 1152 | int |
1153 | main(int argc, char **argv) | 1153 | main(int argc, char **argv) |
1154 | { | 1154 | { |
1155 | char *name1, *output_filename = NULL; | 1155 | char *name1, *output_filename = NULL; |
1156 | Eina_List *inp_files = NULL; | 1156 | Eina_List *inp_files = NULL; |
1157 | int comp_mode = EET_COMPRESSION_DEFAULT; | 1157 | int comp_mode = EET_COMPRESSION_DEFAULT; |
1158 | Edje_File *out_file = NULL; | 1158 | Edje_File *out_file = NULL; |
1159 | Eina_List *images = NULL; | 1159 | Eina_List *images = NULL; |
1160 | Eina_List *samples = NULL; | 1160 | Eina_List *samples = NULL; |
1161 | Eina_List *tones = NULL; | 1161 | Eina_List *tones = NULL; |
1162 | Edje_Image_Directory_Set *sets = NULL; /* ALL files sets composed here */ | 1162 | Edje_Image_Directory_Set *sets = NULL; /* ALL files sets composed here */ |
1163 | 1163 | ||
1164 | Edje_Part_Collection *edc; | 1164 | Edje_Part_Collection *edc; |
1165 | Edje_Part_Collection_Directory_Entry *ce; | 1165 | Edje_Part_Collection_Directory_Entry *ce; |
1166 | Eet_File *ef; | 1166 | Eet_File *ef; |
1167 | Edje_Font_List *fl; | 1167 | Edje_Font_List *fl; |
1168 | Eina_List *f, *l; | 1168 | Eina_List *f, *l; |
1169 | char buf[1024]; | 1169 | char buf[1024]; |
1170 | void *n; | 1170 | void *n; |
1171 | int k, bytes; | 1171 | int k, bytes; |
1172 | 1172 | ||
1173 | eina_init(); | 1173 | eina_init(); |
1174 | eet_init(); | 1174 | eet_init(); |
1175 | ecore_init(); | 1175 | ecore_init(); |
1176 | _edje_edd_init(); | 1176 | _edje_edd_init(); |
1177 | eina_log_level_set(EINA_LOG_LEVEL_WARN); /* Changed to INFO if verbose */ | 1177 | eina_log_level_set(EINA_LOG_LEVEL_WARN); /* Changed to INFO if verbose */ |
1178 | 1178 | ||
1179 | k = _edje_pick_command_line_parse(argc, argv, &inp_files, &output_filename); | 1179 | k = _edje_pick_command_line_parse(argc, argv, &inp_files, &output_filename); |
1180 | if ( k != EDJE_PICK_NO_ERROR) | 1180 | if ( k != EDJE_PICK_NO_ERROR) |
1181 | return k; | 1181 | return k; |
1182 | 1182 | ||
1183 | _edje_pick_args_show(inp_files, output_filename); | 1183 | _edje_pick_args_show(inp_files, output_filename); |
1184 | 1184 | ||
1185 | /* START - Main loop scanning input files */ | 1185 | /* START - Main loop scanning input files */ |
1186 | EINA_LIST_FOREACH(inp_files, f, context.current_file) | 1186 | EINA_LIST_FOREACH(inp_files, f, context.current_file) |
1187 | { | 1187 | { |
1188 | Edje_File *edf; | 1188 | Edje_File *edf; |
1189 | 1189 | ||
1190 | ef = eet_open(context.current_file->name, EET_FILE_MODE_READ); | 1190 | ef = eet_open(context.current_file->name, EET_FILE_MODE_READ); |
1191 | if (!ef) | 1191 | if (!ef) |
1192 | return _edje_pick_cleanup(inp_files, out_file, | 1192 | return _edje_pick_cleanup(inp_files, out_file, |
1193 | EDJE_PICK_FAILED_OPEN_INP); | 1193 | EDJE_PICK_FAILED_OPEN_INP); |
1194 | 1194 | ||
1195 | edf = eet_data_read(ef, _edje_edd_edje_file, "edje/file"); | 1195 | edf = eet_data_read(ef, _edje_edd_edje_file, "edje/file"); |
1196 | if (!edf) | 1196 | if (!edf) |
1197 | return _edje_pick_cleanup(inp_files, out_file, | 1197 | return _edje_pick_cleanup(inp_files, out_file, |
1198 | EDJE_PICK_FAILED_READ_INP); | 1198 | EDJE_PICK_FAILED_READ_INP); |
1199 | 1199 | ||
1200 | context.current_file->edf = edf; | 1200 | context.current_file->edf = edf; |
1201 | edf->ef = ef; | 1201 | edf->ef = ef; |
1202 | 1202 | ||
1203 | out_file = _edje_pick_output_prepare(out_file, edf, output_filename); | 1203 | out_file = _edje_pick_output_prepare(out_file, edf, output_filename); |
1204 | 1204 | ||
1205 | k = _edje_pick_header_make(out_file, edf, inp_files); | 1205 | k = _edje_pick_header_make(out_file, edf, inp_files); |
1206 | if (k != EDJE_PICK_NO_ERROR) | 1206 | if (k != EDJE_PICK_NO_ERROR) |
1207 | { | 1207 | { |
1208 | eet_close(ef); | 1208 | eet_close(ef); |
1209 | return _edje_pick_cleanup(inp_files, out_file, k); | 1209 | return _edje_pick_cleanup(inp_files, out_file, k); |
1210 | } | 1210 | } |
1211 | 1211 | ||
1212 | /* Build lists of all images, samples and fonts of input files */ | 1212 | /* Build lists of all images, samples and fonts of input files */ |
1213 | _edje_pick_images_add(edf, out_file); /* Add Images to imagelist */ | 1213 | _edje_pick_images_add(edf, out_file); /* Add Images to imagelist */ |
1214 | _edje_pick_sounds_add(edf); /* Add Sounds to samplelist */ | 1214 | _edje_pick_sounds_add(edf); /* Add Sounds to samplelist */ |
1215 | _Edje_Pick_Fonts_add(edf); /* Add fonts from file to fonts list */ | 1215 | _Edje_Pick_Fonts_add(edf); /* Add fonts from file to fonts list */ |
1216 | 1216 | ||
1217 | /* Copy styles, color class */ | 1217 | /* Copy styles, color class */ |
1218 | _edje_pick_styles_update(out_file, edf); | 1218 | _edje_pick_styles_update(out_file, edf); |
1219 | _edje_pick_color_class_update(out_file, edf); | 1219 | _edje_pick_color_class_update(out_file, edf); |
1220 | 1220 | ||
1221 | /* Process Groups */ | 1221 | /* Process Groups */ |
1222 | EINA_LIST_FOREACH(context.current_file->groups, l , name1) | 1222 | EINA_LIST_FOREACH(context.current_file->groups, l , name1) |
1223 | { /* Read group info */ | 1223 | { /* Read group info */ |
1224 | ce = eina_hash_find(edf->collection, name1); | 1224 | ce = eina_hash_find(edf->collection, name1); |
1225 | if (!ce || (ce->id < 0)) | 1225 | if (!ce || (ce->id < 0)) |
1226 | { | 1226 | { |
1227 | EINA_LOG_ERR("Failed to find group <%s> id\n", name1); | 1227 | EINA_LOG_ERR("Failed to find group <%s> id\n", name1); |
1228 | return _edje_pick_cleanup(inp_files, out_file, | 1228 | return _edje_pick_cleanup(inp_files, out_file, |
1229 | EDJE_PICK_GROUP_NOT_FOUND); | 1229 | EDJE_PICK_GROUP_NOT_FOUND); |
1230 | } | 1230 | } |
1231 | 1231 | ||
1232 | VERBOSE(EINA_LOG_INFO("Copy group: <%s>\n", name1)); | 1232 | VERBOSE(EINA_LOG_INFO("Copy group: <%s>\n", name1)); |
1233 | 1233 | ||
1234 | edje_cache_emp_alloc(ce); | 1234 | edje_cache_emp_alloc(ce); |
1235 | 1235 | ||
1236 | snprintf(buf, sizeof(buf), "edje/collections/%i", ce->id); | 1236 | snprintf(buf, sizeof(buf), "edje/collections/%i", ce->id); |
1237 | EINA_LOG_INFO("Trying to read group <%s>\n", buf); | 1237 | EINA_LOG_INFO("Trying to read group <%s>\n", buf); |
1238 | edc = eet_data_read(edf->ef, _edje_edd_edje_part_collection, buf); | 1238 | edc = eet_data_read(edf->ef, _edje_edd_edje_part_collection, buf); |
1239 | if (!edc) | 1239 | if (!edc) |
1240 | { | 1240 | { |
1241 | EINA_LOG_ERR("Failed to read group <%s> id <%d>\n", name1, ce->id); | 1241 | EINA_LOG_ERR("Failed to read group <%s> id <%d>\n", name1, ce->id); |
1242 | return _edje_pick_cleanup(inp_files, out_file, | 1242 | return _edje_pick_cleanup(inp_files, out_file, |
1243 | EDJE_PICK_GROUP_NOT_FOUND); | 1243 | EDJE_PICK_GROUP_NOT_FOUND); |
1244 | } | 1244 | } |
1245 | 1245 | ||
1246 | /* Update IDs */ | 1246 | /* Update IDs */ |
1247 | _edje_pick_collection_process(edc); | 1247 | _edje_pick_collection_process(edc); |
1248 | 1248 | ||
1249 | /* Build lists of all scripts with new IDs */ | 1249 | /* Build lists of all scripts with new IDs */ |
1250 | _edje_pick_scripts_add(edf, ce->id, edc->id); | 1250 | _edje_pick_scripts_add(edf, ce->id, edc->id); |
1251 | _edje_pick_lua_scripts_add(edf, ce->id, edc->id); | 1251 | _edje_pick_lua_scripts_add(edf, ce->id, edc->id); |
1252 | 1252 | ||
1253 | { | 1253 | { |
1254 | /* Write the group to output file using new id */ | 1254 | /* Write the group to output file using new id */ |
1255 | snprintf(buf, sizeof(buf), | 1255 | snprintf(buf, sizeof(buf), |
1256 | "edje/collections/%i", edc->id); | 1256 | "edje/collections/%i", edc->id); |
1257 | bytes = eet_data_write(out_file->ef, | 1257 | bytes = eet_data_write(out_file->ef, |
1258 | _edje_edd_edje_part_collection, | 1258 | _edje_edd_edje_part_collection, |
1259 | buf, edc, comp_mode); | 1259 | buf, edc, comp_mode); |
1260 | EINA_LOG_INFO("Wrote <%d> bytes for group <%s>\n", bytes,buf); | 1260 | EINA_LOG_INFO("Wrote <%d> bytes for group <%s>\n", bytes,buf); |
1261 | } | 1261 | } |
1262 | 1262 | ||
1263 | free(edc); | 1263 | free(edc); |
1264 | edje_cache_emp_free(ce); | 1264 | edje_cache_emp_free(ce); |
1265 | eet_close(ef); | 1265 | eet_close(ef); |
1266 | } | 1266 | } |
1267 | 1267 | ||
1268 | /* We SKIP writing source, just can't compose it */ | 1268 | /* We SKIP writing source, just can't compose it */ |
1269 | /* FIXME: use Edje_Edit code to generate source */ | 1269 | /* FIXME: use Edje_Edit code to generate source */ |
1270 | } /* END - Main loop scanning input files */ | 1270 | } /* END - Main loop scanning input files */ |
1271 | 1271 | ||
1272 | /* Write rest of output */ | 1272 | /* Write rest of output */ |
1273 | 1273 | ||
1274 | EINA_LIST_FOREACH(inp_files, f, context.current_file) | 1274 | EINA_LIST_FOREACH(inp_files, f, context.current_file) |
1275 | { | 1275 | { |
1276 | /* Write Scripts from ALL files */ | 1276 | /* Write Scripts from ALL files */ |
1277 | Edje_Pick_Data *s; | 1277 | Edje_Pick_Data *s; |
1278 | Edje_Pick_Tone *tn; | 1278 | Edje_Pick_Tone *tn; |
1279 | Eina_List *t; | 1279 | Eina_List *t; |
1280 | 1280 | ||
1281 | EINA_LIST_FOREACH(context.current_file->scriptlist, t, s) | 1281 | EINA_LIST_FOREACH(context.current_file->scriptlist, t, s) |
1282 | { | 1282 | { |
1283 | /* Write Scripts */ | 1283 | /* Write Scripts */ |
1284 | snprintf(buf, sizeof(buf), | 1284 | snprintf(buf, sizeof(buf), |
1285 | "edje/scripts/embryo/compiled/%i", s->id.new_id); | 1285 | "edje/scripts/embryo/compiled/%i", s->id.new_id); |
1286 | VERBOSE(EINA_LOG_INFO("wrote embryo scr <%s> data <%p> size <%d>\n", | 1286 | VERBOSE(EINA_LOG_INFO("wrote embryo scr <%s> data <%p> size <%d>\n", |
1287 | buf, s->data, s->size)); | 1287 | buf, s->data, s->size)); |
1288 | eet_write(out_file->ef, buf, s->data, s->size, comp_mode); | 1288 | eet_write(out_file->ef, buf, s->data, s->size, comp_mode); |
1289 | } | 1289 | } |
1290 | 1290 | ||
1291 | EINA_LIST_FOREACH(context.current_file->luascriptlist, t, s) | 1291 | EINA_LIST_FOREACH(context.current_file->luascriptlist, t, s) |
1292 | { | 1292 | { |
1293 | /* Write Lua Scripts */ | 1293 | /* Write Lua Scripts */ |
1294 | snprintf(buf, sizeof(buf), | 1294 | snprintf(buf, sizeof(buf), |
1295 | "edje/scripts/lua/%i", s->id.new_id); | 1295 | "edje/scripts/lua/%i", s->id.new_id); |
1296 | VERBOSE(EINA_LOG_INFO("wrote lua scr <%s> data <%p> size <%d>\n", | 1296 | VERBOSE(EINA_LOG_INFO("wrote lua scr <%s> data <%p> size <%d>\n", |
1297 | buf, s->data, s->size)); | 1297 | buf, s->data, s->size)); |
1298 | eet_write(out_file->ef, buf, s->data, s->size, comp_mode); | 1298 | eet_write(out_file->ef, buf, s->data, s->size, comp_mode); |
1299 | } | 1299 | } |
1300 | 1300 | ||
1301 | EINA_LIST_FOREACH(context.current_file->imagelist, t, s) | 1301 | EINA_LIST_FOREACH(context.current_file->imagelist, t, s) |
1302 | { | 1302 | { |
1303 | if (context.current_file->append || s->id.used) | 1303 | if (context.current_file->append || s->id.used) |
1304 | { | 1304 | { |
1305 | snprintf(buf, sizeof(buf), "edje/images/%i", s->id.new_id); | 1305 | snprintf(buf, sizeof(buf), "edje/images/%i", s->id.new_id); |
1306 | eet_write(out_file->ef, buf, s->data, s->size, EINA_TRUE); | 1306 | eet_write(out_file->ef, buf, s->data, s->size, EINA_TRUE); |
1307 | VERBOSE(EINA_LOG_INFO("Wrote <%s> image data <%p> size <%d>\n", buf, s->data, s->size)); | 1307 | VERBOSE(EINA_LOG_INFO("Wrote <%s> image data <%p> size <%d>\n", buf, s->data, s->size)); |
1308 | } | 1308 | } |
1309 | } | 1309 | } |
1310 | 1310 | ||
1311 | EINA_LIST_FOREACH(context.current_file->samplelist, l, s) | 1311 | EINA_LIST_FOREACH(context.current_file->samplelist, l, s) |
1312 | { | 1312 | { |
1313 | if (context.current_file->append || s->id.used) | 1313 | if (context.current_file->append || s->id.used) |
1314 | { /* Write only used samples */ | 1314 | { /* Write only used samples */ |
1315 | samples = eina_list_append(samples, s->entry); | 1315 | samples = eina_list_append(samples, s->entry); |
1316 | 1316 | ||
1317 | snprintf(buf, sizeof(buf), "edje/sounds/%i", | 1317 | snprintf(buf, sizeof(buf), "edje/sounds/%i", |
1318 | s->id.new_id); | 1318 | s->id.new_id); |
1319 | eet_write(out_file->ef, buf, | 1319 | eet_write(out_file->ef, buf, |
1320 | s->data, s->size,EINA_TRUE); | 1320 | s->data, s->size,EINA_TRUE); |
1321 | VERBOSE(EINA_LOG_INFO("Wrote <%s> sample data <%p> size <%d>\n", | 1321 | VERBOSE(EINA_LOG_INFO("Wrote <%s> sample data <%p> size <%d>\n", |
1322 | buf, s->data, s->size)); | 1322 | buf, s->data, s->size)); |
1323 | } | 1323 | } |
1324 | } | 1324 | } |
1325 | 1325 | ||
1326 | EINA_LIST_FOREACH(context.current_file->tonelist, l, tn) | 1326 | EINA_LIST_FOREACH(context.current_file->tonelist, l, tn) |
1327 | { | 1327 | { |
1328 | if (context.current_file->append || tn->used) | 1328 | if (context.current_file->append || tn->used) |
1329 | tones = eina_list_append(tones, tn->tone); | 1329 | tones = eina_list_append(tones, tn->tone); |
1330 | } | 1330 | } |
1331 | } | 1331 | } |
1332 | 1332 | ||
1333 | _edje_pick_sound_dir_compose(samples, tones, out_file); | 1333 | _edje_pick_sound_dir_compose(samples, tones, out_file); |
1334 | 1334 | ||
1335 | /* Write file header after processing all groups */ | 1335 | /* Write file header after processing all groups */ |
1336 | bytes = eet_data_write(out_file->ef, _edje_edd_edje_file, "edje/file", | 1336 | bytes = eet_data_write(out_file->ef, _edje_edd_edje_file, "edje/file", |
1337 | out_file, comp_mode); | 1337 | out_file, comp_mode); |
1338 | 1338 | ||
1339 | VERBOSE(EINA_LOG_INFO("Wrote <%d> bytes for file header.\n", bytes)); | 1339 | VERBOSE(EINA_LOG_INFO("Wrote <%d> bytes for file header.\n", bytes)); |
1340 | 1340 | ||
1341 | eina_list_free(images); | 1341 | eina_list_free(images); |
1342 | eina_list_free(samples); | 1342 | eina_list_free(samples); |
1343 | eina_list_free(tones); | 1343 | eina_list_free(tones); |
1344 | 1344 | ||
1345 | fl = calloc(1, sizeof(*fl)); | 1345 | fl = calloc(1, sizeof(*fl)); |
1346 | 1346 | ||
1347 | EINA_LIST_FOREACH(context.fontlist, l, n) | 1347 | EINA_LIST_FOREACH(context.fontlist, l, n) |
1348 | { | 1348 | { |
1349 | /* Create a font list from used fonts */ | 1349 | /* Create a font list from used fonts */ |
1350 | Edje_Pick_Font *fnt = n; | 1350 | Edje_Pick_Font *fnt = n; |
1351 | if (context.current_file->append || fnt->used) | 1351 | if (context.current_file->append || fnt->used) |
1352 | fl->list = eina_list_append(fl->list, fnt->f); | 1352 | fl->list = eina_list_append(fl->list, fnt->f); |
1353 | } | 1353 | } |
1354 | 1354 | ||
1355 | { | 1355 | { |
1356 | /* Write Fonts from all files */ | 1356 | /* Write Fonts from all files */ |
1357 | Eet_Data_Descriptor *_font_list_edd = NULL; | 1357 | Eet_Data_Descriptor *_font_list_edd = NULL; |
1358 | Eet_Data_Descriptor *_font_edd; | 1358 | Eet_Data_Descriptor *_font_edd; |
1359 | 1359 | ||
1360 | _edje_data_font_list_desc_make(&_font_list_edd, &_font_edd); | 1360 | _edje_data_font_list_desc_make(&_font_list_edd, &_font_edd); |
1361 | bytes = eet_data_write(out_file->ef, _font_list_edd, | 1361 | bytes = eet_data_write(out_file->ef, _font_list_edd, |
1362 | "edje_source_fontmap", fl, comp_mode); | 1362 | "edje_source_fontmap", fl, comp_mode); |
1363 | VERBOSE(EINA_LOG_INFO("Wrote <%d> bytes for fontmap.\n", bytes)); | 1363 | VERBOSE(EINA_LOG_INFO("Wrote <%d> bytes for fontmap.\n", bytes)); |
1364 | 1364 | ||
1365 | eet_data_descriptor_free(_font_list_edd); | 1365 | eet_data_descriptor_free(_font_list_edd); |
1366 | eet_data_descriptor_free(_font_edd); | 1366 | eet_data_descriptor_free(_font_edd); |
1367 | } | 1367 | } |
1368 | free(fl); | 1368 | free(fl); |
1369 | 1369 | ||
1370 | if (sets) | 1370 | if (sets) |
1371 | free(sets); | 1371 | free(sets); |
1372 | 1372 | ||
1373 | printf("Wrote <%s> output file.\n", output_filename); | 1373 | printf("Wrote <%s> output file.\n", output_filename); |
1374 | 1374 | ||
1375 | return _edje_pick_cleanup(inp_files, out_file, EDJE_PICK_NO_ERROR); | 1375 | return _edje_pick_cleanup(inp_files, out_file, EDJE_PICK_NO_ERROR); |
1376 | } | 1376 | } |
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_private.h b/src/lib/ecore_cocoa/ecore_cocoa_private.h index 0b4cf3178e..7cd08be9d2 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa_private.h +++ b/src/lib/ecore_cocoa/ecore_cocoa_private.h | |||
@@ -1,11 +1,11 @@ | |||
1 | #ifndef _ECORE_COCOA_PRIVATE_H | 1 | #ifndef _ECORE_COCOA_PRIVATE_H |
2 | #define _ECORE_COCOA_PRIVATE_H | 2 | #define _ECORE_COCOA_PRIVATE_H |
3 | 3 | ||
4 | struct _Ecore_Cocoa_Window | 4 | struct _Ecore_Cocoa_Window |
5 | { | 5 | { |
6 | NSWindow *window; | 6 | NSWindow *window; |
7 | unsigned int borderless : 1; | 7 | unsigned int borderless : 1; |
8 | }; | 8 | }; |
9 | 9 | ||
10 | 10 | ||
11 | #endif | 11 | #endif |
diff --git a/src/lib/ecore_file/ecore_file_monitor_win32.c b/src/lib/ecore_file/ecore_file_monitor_win32.c index 84ac083cfd..52b876a5a7 100644 --- a/src/lib/ecore_file/ecore_file_monitor_win32.c +++ b/src/lib/ecore_file/ecore_file_monitor_win32.c | |||
@@ -1,306 +1,306 @@ | |||
1 | /* | 1 | /* |
2 | * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 | 2 | * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #ifdef HAVE_CONFIG_H | 5 | #ifdef HAVE_CONFIG_H |
6 | # include <config.h> | 6 | # include <config.h> |
7 | #endif | 7 | #endif |
8 | 8 | ||
9 | # define WIN32_LEAN_AND_MEAN | 9 | # define WIN32_LEAN_AND_MEAN |
10 | # include <windows.h> | 10 | # include <windows.h> |
11 | # undef WIN32_LEAN_AND_MEAN | 11 | # undef WIN32_LEAN_AND_MEAN |
12 | # include <process.h> | 12 | # include <process.h> |
13 | 13 | ||
14 | # include "ecore_file_private.h" | 14 | # include "ecore_file_private.h" |
15 | 15 | ||
16 | 16 | ||
17 | typedef struct _Ecore_File_Monitor_Win32 Ecore_File_Monitor_Win32; | 17 | typedef struct _Ecore_File_Monitor_Win32 Ecore_File_Monitor_Win32; |
18 | typedef struct _Ecore_File_Monitor_Win32_Data Ecore_File_Monitor_Win32_Data; | 18 | typedef struct _Ecore_File_Monitor_Win32_Data Ecore_File_Monitor_Win32_Data; |
19 | 19 | ||
20 | /* 4096 = 256 * sizeof(FILE_NOTIFY_INFORMATION) */ | 20 | /* 4096 = 256 * sizeof(FILE_NOTIFY_INFORMATION) */ |
21 | # define ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE 4096 | 21 | # define ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE 4096 |
22 | # define ECORE_FILE_MONITOR_WIN32(x) ((Ecore_File_Monitor_Win32 *)(x)) | 22 | # define ECORE_FILE_MONITOR_WIN32(x) ((Ecore_File_Monitor_Win32 *)(x)) |
23 | 23 | ||
24 | struct _Ecore_File_Monitor_Win32_Data | 24 | struct _Ecore_File_Monitor_Win32_Data |
25 | { | 25 | { |
26 | char buffer[ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE]; | 26 | char buffer[ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE]; |
27 | OVERLAPPED overlapped; | 27 | OVERLAPPED overlapped; |
28 | HANDLE handle; | 28 | HANDLE handle; |
29 | HANDLE event; | 29 | HANDLE event; |
30 | Ecore_File_Monitor *monitor; | 30 | Ecore_File_Monitor *monitor; |
31 | Ecore_Win32_Handler *h; | 31 | Ecore_Win32_Handler *h; |
32 | DWORD buf_length; | 32 | DWORD buf_length; |
33 | int is_dir; | 33 | int is_dir; |
34 | }; | 34 | }; |
35 | 35 | ||
36 | struct _Ecore_File_Monitor_Win32 | 36 | struct _Ecore_File_Monitor_Win32 |
37 | { | 37 | { |
38 | Ecore_File_Monitor monitor; | 38 | Ecore_File_Monitor monitor; |
39 | Ecore_File_Monitor_Win32_Data *file; | 39 | Ecore_File_Monitor_Win32_Data *file; |
40 | Ecore_File_Monitor_Win32_Data *dir; | 40 | Ecore_File_Monitor_Win32_Data *dir; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | static Ecore_File_Monitor *_monitors = NULL; | 43 | static Ecore_File_Monitor *_monitors = NULL; |
44 | 44 | ||
45 | static Eina_Bool _ecore_file_monitor_win32_cb(void *data, Ecore_Win32_Handler *wh); | 45 | static Eina_Bool _ecore_file_monitor_win32_cb(void *data, Ecore_Win32_Handler *wh); |
46 | 46 | ||
47 | 47 | ||
48 | static Ecore_File_Monitor_Win32_Data * | 48 | static Ecore_File_Monitor_Win32_Data * |
49 | _ecore_file_monitor_win32_data_new(Ecore_File_Monitor *monitor, int type) | 49 | _ecore_file_monitor_win32_data_new(Ecore_File_Monitor *monitor, int type) |
50 | { | 50 | { |
51 | Ecore_File_Monitor_Win32_Data *md; | 51 | Ecore_File_Monitor_Win32_Data *md; |
52 | DWORD filter; | 52 | DWORD filter; |
53 | 53 | ||
54 | md = (Ecore_File_Monitor_Win32_Data *)calloc(1, sizeof(Ecore_File_Monitor_Win32_Data)); | 54 | md = (Ecore_File_Monitor_Win32_Data *)calloc(1, sizeof(Ecore_File_Monitor_Win32_Data)); |
55 | if (!md) return NULL; | 55 | if (!md) return NULL; |
56 | 56 | ||
57 | md->handle = CreateFile(monitor->path, | 57 | md->handle = CreateFile(monitor->path, |
58 | FILE_LIST_DIRECTORY, | 58 | FILE_LIST_DIRECTORY, |
59 | FILE_SHARE_READ | | 59 | FILE_SHARE_READ | |
60 | FILE_SHARE_WRITE, | 60 | FILE_SHARE_WRITE, |
61 | NULL, | 61 | NULL, |
62 | OPEN_EXISTING, | 62 | OPEN_EXISTING, |
63 | FILE_FLAG_BACKUP_SEMANTICS | | 63 | FILE_FLAG_BACKUP_SEMANTICS | |
64 | FILE_FLAG_OVERLAPPED, | 64 | FILE_FLAG_OVERLAPPED, |
65 | NULL); | 65 | NULL); |
66 | if (md->handle == INVALID_HANDLE_VALUE) | 66 | if (md->handle == INVALID_HANDLE_VALUE) |
67 | goto free_md; | 67 | goto free_md; |
68 | 68 | ||
69 | md->event = CreateEvent(NULL, FALSE, FALSE, NULL); | 69 | md->event = CreateEvent(NULL, FALSE, FALSE, NULL); |
70 | if (!md->event) | 70 | if (!md->event) |
71 | goto close_handle; | 71 | goto close_handle; |
72 | 72 | ||
73 | ZeroMemory (&md->overlapped, sizeof(md->overlapped)); | 73 | ZeroMemory (&md->overlapped, sizeof(md->overlapped)); |
74 | md->overlapped.hEvent = md->event; | 74 | md->overlapped.hEvent = md->event; |
75 | 75 | ||
76 | filter = (type == 0) ? FILE_NOTIFY_CHANGE_FILE_NAME : FILE_NOTIFY_CHANGE_DIR_NAME; | 76 | filter = (type == 0) ? FILE_NOTIFY_CHANGE_FILE_NAME : FILE_NOTIFY_CHANGE_DIR_NAME; |
77 | filter |= | 77 | filter |= |
78 | FILE_NOTIFY_CHANGE_ATTRIBUTES | | 78 | FILE_NOTIFY_CHANGE_ATTRIBUTES | |
79 | FILE_NOTIFY_CHANGE_SIZE | | 79 | FILE_NOTIFY_CHANGE_SIZE | |
80 | FILE_NOTIFY_CHANGE_LAST_WRITE | | 80 | FILE_NOTIFY_CHANGE_LAST_WRITE | |
81 | FILE_NOTIFY_CHANGE_LAST_ACCESS | | 81 | FILE_NOTIFY_CHANGE_LAST_ACCESS | |
82 | FILE_NOTIFY_CHANGE_CREATION | | 82 | FILE_NOTIFY_CHANGE_CREATION | |
83 | FILE_NOTIFY_CHANGE_SECURITY; | 83 | FILE_NOTIFY_CHANGE_SECURITY; |
84 | 84 | ||
85 | if (!ReadDirectoryChangesW(md->handle, | 85 | if (!ReadDirectoryChangesW(md->handle, |
86 | md->buffer, | 86 | md->buffer, |
87 | ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE, | 87 | ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE, |
88 | FALSE, | 88 | FALSE, |
89 | filter, | 89 | filter, |
90 | &md->buf_length, | 90 | &md->buf_length, |
91 | &md->overlapped, | 91 | &md->overlapped, |
92 | NULL)) | 92 | NULL)) |
93 | goto close_event; | 93 | goto close_event; |
94 | 94 | ||
95 | md->h = ecore_main_win32_handler_add(md->event, | 95 | md->h = ecore_main_win32_handler_add(md->event, |
96 | _ecore_file_monitor_win32_cb, | 96 | _ecore_file_monitor_win32_cb, |
97 | md); | 97 | md); |
98 | if (!md->h) | 98 | if (!md->h) |
99 | goto close_event; | 99 | goto close_event; |
100 | 100 | ||
101 | md->monitor = monitor; | 101 | md->monitor = monitor; |
102 | md->is_dir = type; | 102 | md->is_dir = type; |
103 | 103 | ||
104 | return md; | 104 | return md; |
105 | 105 | ||
106 | close_event: | 106 | close_event: |
107 | CloseHandle(md->event); | 107 | CloseHandle(md->event); |
108 | close_handle: | 108 | close_handle: |
109 | CloseHandle(md->handle); | 109 | CloseHandle(md->handle); |
110 | free_md: | 110 | free_md: |
111 | free(md); | 111 | free(md); |
112 | 112 | ||
113 | return NULL; | 113 | return NULL; |
114 | } | 114 | } |
115 | 115 | ||
116 | static void | 116 | static void |
117 | _ecore_file_monitor_win32_data_free(Ecore_File_Monitor_Win32_Data *md) | 117 | _ecore_file_monitor_win32_data_free(Ecore_File_Monitor_Win32_Data *md) |
118 | { | 118 | { |
119 | if (!md) return; | 119 | if (!md) return; |
120 | 120 | ||
121 | CloseHandle(md->event); | 121 | CloseHandle(md->event); |
122 | CloseHandle (md->handle); | 122 | CloseHandle (md->handle); |
123 | free (md); | 123 | free (md); |
124 | } | 124 | } |
125 | 125 | ||
126 | static Eina_Bool | 126 | static Eina_Bool |
127 | _ecore_file_monitor_win32_cb(void *data, Ecore_Win32_Handler *wh) | 127 | _ecore_file_monitor_win32_cb(void *data, Ecore_Win32_Handler *wh) |
128 | { | 128 | { |
129 | char filename[PATH_MAX]; | 129 | char filename[PATH_MAX]; |
130 | PFILE_NOTIFY_INFORMATION fni; | 130 | PFILE_NOTIFY_INFORMATION fni; |
131 | Ecore_File_Monitor_Win32_Data *md; | 131 | Ecore_File_Monitor_Win32_Data *md; |
132 | wchar_t *wname; | 132 | wchar_t *wname; |
133 | char *name; | 133 | char *name; |
134 | DWORD filter; | 134 | DWORD filter; |
135 | DWORD offset; | 135 | DWORD offset; |
136 | DWORD buf_length; | 136 | DWORD buf_length; |
137 | Ecore_File_Event event = ECORE_FILE_EVENT_NONE; | 137 | Ecore_File_Event event = ECORE_FILE_EVENT_NONE; |
138 | 138 | ||
139 | md = (Ecore_File_Monitor_Win32_Data *)data; | 139 | md = (Ecore_File_Monitor_Win32_Data *)data; |
140 | 140 | ||
141 | if (!GetOverlappedResult (md->handle, &md->overlapped, &buf_length, TRUE)) | 141 | if (!GetOverlappedResult (md->handle, &md->overlapped, &buf_length, TRUE)) |
142 | return 1; | 142 | return 1; |
143 | 143 | ||
144 | fni = (PFILE_NOTIFY_INFORMATION)md->buffer; | 144 | fni = (PFILE_NOTIFY_INFORMATION)md->buffer; |
145 | do { | 145 | do { |
146 | if (!fni) | 146 | if (!fni) |
147 | break; | 147 | break; |
148 | offset = fni->NextEntryOffset; | 148 | offset = fni->NextEntryOffset; |
149 | 149 | ||
150 | wname = (wchar_t *)malloc(sizeof(wchar_t) * (fni->FileNameLength + 1)); | 150 | wname = (wchar_t *)malloc(sizeof(wchar_t) * (fni->FileNameLength + 1)); |
151 | if (!wname) | 151 | if (!wname) |
152 | return 0; | 152 | return 0; |
153 | 153 | ||
154 | memcpy(wname, fni->FileName, fni->FileNameLength); | 154 | memcpy(wname, fni->FileName, fni->FileNameLength); |
155 | wname[fni->FileNameLength]='\0'; | 155 | wname[fni->FileNameLength]='\0'; |
156 | name = evil_wchar_to_char(wname); | 156 | name = evil_wchar_to_char(wname); |
157 | free(wname); | 157 | free(wname); |
158 | if (!name) | 158 | if (!name) |
159 | return 0; | 159 | return 0; |
160 | 160 | ||
161 | _snprintf(filename, PATH_MAX, "%s\\%s", md->monitor->path, name); | 161 | _snprintf(filename, PATH_MAX, "%s\\%s", md->monitor->path, name); |
162 | free(name); | 162 | free(name); |
163 | 163 | ||
164 | switch (fni->Action) | 164 | switch (fni->Action) |
165 | { | 165 | { |
166 | case FILE_ACTION_ADDED: | 166 | case FILE_ACTION_ADDED: |
167 | if (md->is_dir) | 167 | if (md->is_dir) |
168 | event = ECORE_FILE_EVENT_CREATED_DIRECTORY; | 168 | event = ECORE_FILE_EVENT_CREATED_DIRECTORY; |
169 | else | 169 | else |
170 | event = ECORE_FILE_EVENT_CREATED_FILE; | 170 | event = ECORE_FILE_EVENT_CREATED_FILE; |
171 | break; | 171 | break; |
172 | case FILE_ACTION_REMOVED: | 172 | case FILE_ACTION_REMOVED: |
173 | if (md->is_dir) | 173 | if (md->is_dir) |
174 | event = ECORE_FILE_EVENT_DELETED_DIRECTORY; | 174 | event = ECORE_FILE_EVENT_DELETED_DIRECTORY; |
175 | else | 175 | else |
176 | event = ECORE_FILE_EVENT_DELETED_FILE; | 176 | event = ECORE_FILE_EVENT_DELETED_FILE; |
177 | break; | 177 | break; |
178 | case FILE_ACTION_MODIFIED: | 178 | case FILE_ACTION_MODIFIED: |
179 | if (!md->is_dir) | 179 | if (!md->is_dir) |
180 | event = ECORE_FILE_EVENT_MODIFIED; | 180 | event = ECORE_FILE_EVENT_MODIFIED; |
181 | break; | 181 | break; |
182 | case FILE_ACTION_RENAMED_OLD_NAME: | 182 | case FILE_ACTION_RENAMED_OLD_NAME: |
183 | if (md->is_dir) | 183 | if (md->is_dir) |
184 | event = ECORE_FILE_EVENT_DELETED_DIRECTORY; | 184 | event = ECORE_FILE_EVENT_DELETED_DIRECTORY; |
185 | else | 185 | else |
186 | event = ECORE_FILE_EVENT_DELETED_FILE; | 186 | event = ECORE_FILE_EVENT_DELETED_FILE; |
187 | break; | 187 | break; |
188 | case FILE_ACTION_RENAMED_NEW_NAME: | 188 | case FILE_ACTION_RENAMED_NEW_NAME: |
189 | if (md->is_dir) | 189 | if (md->is_dir) |
190 | event = ECORE_FILE_EVENT_CREATED_DIRECTORY; | 190 | event = ECORE_FILE_EVENT_CREATED_DIRECTORY; |
191 | else | 191 | else |
192 | event = ECORE_FILE_EVENT_CREATED_FILE; | 192 | event = ECORE_FILE_EVENT_CREATED_FILE; |
193 | break; | 193 | break; |
194 | default: | 194 | default: |
195 | fprintf(stderr, "unknown event\n"); | 195 | fprintf(stderr, "unknown event\n"); |
196 | event = ECORE_FILE_EVENT_NONE; | 196 | event = ECORE_FILE_EVENT_NONE; |
197 | break; | 197 | break; |
198 | } | 198 | } |
199 | if (event != ECORE_FILE_EVENT_NONE) | 199 | if (event != ECORE_FILE_EVENT_NONE) |
200 | md->monitor->func(md->monitor->data, md->monitor, event, filename); | 200 | md->monitor->func(md->monitor->data, md->monitor, event, filename); |
201 | 201 | ||
202 | fni = (PFILE_NOTIFY_INFORMATION)((LPBYTE)fni + offset); | 202 | fni = (PFILE_NOTIFY_INFORMATION)((LPBYTE)fni + offset); |
203 | } while (offset); | 203 | } while (offset); |
204 | 204 | ||
205 | filter = (md->is_dir == 0) ? FILE_NOTIFY_CHANGE_FILE_NAME : FILE_NOTIFY_CHANGE_DIR_NAME; | 205 | filter = (md->is_dir == 0) ? FILE_NOTIFY_CHANGE_FILE_NAME : FILE_NOTIFY_CHANGE_DIR_NAME; |
206 | filter |= | 206 | filter |= |
207 | FILE_NOTIFY_CHANGE_ATTRIBUTES | | 207 | FILE_NOTIFY_CHANGE_ATTRIBUTES | |
208 | FILE_NOTIFY_CHANGE_SIZE | | 208 | FILE_NOTIFY_CHANGE_SIZE | |
209 | FILE_NOTIFY_CHANGE_LAST_WRITE | | 209 | FILE_NOTIFY_CHANGE_LAST_WRITE | |
210 | FILE_NOTIFY_CHANGE_LAST_ACCESS | | 210 | FILE_NOTIFY_CHANGE_LAST_ACCESS | |
211 | FILE_NOTIFY_CHANGE_CREATION | | 211 | FILE_NOTIFY_CHANGE_CREATION | |
212 | FILE_NOTIFY_CHANGE_SECURITY; | 212 | FILE_NOTIFY_CHANGE_SECURITY; |
213 | 213 | ||
214 | ReadDirectoryChangesW(md->handle, | 214 | ReadDirectoryChangesW(md->handle, |
215 | md->buffer, | 215 | md->buffer, |
216 | ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE, | 216 | ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE, |
217 | FALSE, | 217 | FALSE, |
218 | filter, | 218 | filter, |
219 | &md->buf_length, | 219 | &md->buf_length, |
220 | &md->overlapped, | 220 | &md->overlapped, |
221 | NULL); | 221 | NULL); |
222 | return 1; | 222 | return 1; |
223 | } | 223 | } |
224 | 224 | ||
225 | int | 225 | int |
226 | ecore_file_monitor_backend_init(void) | 226 | ecore_file_monitor_backend_init(void) |
227 | { | 227 | { |
228 | return 1; | 228 | return 1; |
229 | } | 229 | } |
230 | 230 | ||
231 | int | 231 | int |
232 | ecore_file_monitor_backend_shutdown(void) | 232 | ecore_file_monitor_backend_shutdown(void) |
233 | { | 233 | { |
234 | return 1; | 234 | return 1; |
235 | } | 235 | } |
236 | 236 | ||
237 | Ecore_File_Monitor * | 237 | Ecore_File_Monitor * |
238 | ecore_file_monitor_backend_add(const char *path, | 238 | ecore_file_monitor_backend_add(const char *path, |
239 | void (*func) (void *data, Ecore_File_Monitor *em, | 239 | void (*func) (void *data, Ecore_File_Monitor *em, |
240 | Ecore_File_Event event, | 240 | Ecore_File_Event event, |
241 | const char *path), | 241 | const char *path), |
242 | void *data) | 242 | void *data) |
243 | { | 243 | { |
244 | Ecore_File_Monitor_Win32 *m; | 244 | Ecore_File_Monitor_Win32 *m; |
245 | Ecore_File_Monitor *em; | 245 | Ecore_File_Monitor *em; |
246 | size_t len; | 246 | size_t len; |
247 | 247 | ||
248 | if (!path || (*path == '\0')) return NULL; | 248 | if (!path || (*path == '\0')) return NULL; |
249 | if (!ecore_file_exists(path) || !ecore_file_is_dir(path)) | 249 | if (!ecore_file_exists(path) || !ecore_file_is_dir(path)) |
250 | return NULL; | 250 | return NULL; |
251 | if (!func) return NULL; | 251 | if (!func) return NULL; |
252 | 252 | ||
253 | em = (Ecore_File_Monitor *)calloc(1, sizeof(Ecore_File_Monitor_Win32)); | 253 | em = (Ecore_File_Monitor *)calloc(1, sizeof(Ecore_File_Monitor_Win32)); |
254 | if (!em) return NULL; | 254 | if (!em) return NULL; |
255 | 255 | ||
256 | em->func = func; | 256 | em->func = func; |
257 | em->data = data; | 257 | em->data = data; |
258 | 258 | ||
259 | em->path = strdup(path); | 259 | em->path = strdup(path); |
260 | if (!em->path) | 260 | if (!em->path) |
261 | { | 261 | { |
262 | free(em); | 262 | free(em); |
263 | return NULL; | 263 | return NULL; |
264 | } | 264 | } |
265 | len = strlen(em->path); | 265 | len = strlen(em->path); |
266 | if (em->path[len - 1] == '/' || em->path[len - 1] == '\\') | 266 | if (em->path[len - 1] == '/' || em->path[len - 1] == '\\') |
267 | em->path[len - 1] = '\0'; | 267 | em->path[len - 1] = '\0'; |
268 | 268 | ||
269 | m = ECORE_FILE_MONITOR_WIN32(em); | 269 | m = ECORE_FILE_MONITOR_WIN32(em); |
270 | 270 | ||
271 | m->file = _ecore_file_monitor_win32_data_new(em, 0); | 271 | m->file = _ecore_file_monitor_win32_data_new(em, 0); |
272 | if (!m->file) | 272 | if (!m->file) |
273 | { | 273 | { |
274 | free(em->path); | 274 | free(em->path); |
275 | free(em); | 275 | free(em); |
276 | return NULL; | 276 | return NULL; |
277 | } | 277 | } |
278 | 278 | ||
279 | m->dir = _ecore_file_monitor_win32_data_new(em, 1); | 279 | m->dir = _ecore_file_monitor_win32_data_new(em, 1); |
280 | if (!m->dir) | 280 | if (!m->dir) |
281 | { | 281 | { |
282 | _ecore_file_monitor_win32_data_free(m->file); | 282 | _ecore_file_monitor_win32_data_free(m->file); |
283 | free(em->path); | 283 | free(em->path); |
284 | free(em); | 284 | free(em); |
285 | return NULL; | 285 | return NULL; |
286 | } | 286 | } |
287 | 287 | ||
288 | _monitors = ECORE_FILE_MONITOR(eina_inlist_append(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em))); | 288 | _monitors = ECORE_FILE_MONITOR(eina_inlist_append(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em))); |
289 | 289 | ||
290 | return em; | 290 | return em; |
291 | } | 291 | } |
292 | 292 | ||
293 | void | 293 | void |
294 | ecore_file_monitor_backend_del(Ecore_File_Monitor *em) | 294 | ecore_file_monitor_backend_del(Ecore_File_Monitor *em) |
295 | { | 295 | { |
296 | Ecore_File_Monitor_Win32 *m; | 296 | Ecore_File_Monitor_Win32 *m; |
297 | 297 | ||
298 | if (!em) | 298 | if (!em) |
299 | return; | 299 | return; |
300 | 300 | ||
301 | m = ECORE_FILE_MONITOR_WIN32(em); | 301 | m = ECORE_FILE_MONITOR_WIN32(em); |
302 | _ecore_file_monitor_win32_data_free(m->dir); | 302 | _ecore_file_monitor_win32_data_free(m->dir); |
303 | _ecore_file_monitor_win32_data_free(m->file); | 303 | _ecore_file_monitor_win32_data_free(m->file); |
304 | free(em->path); | 304 | free(em->path); |
305 | free(em); | 305 | free(em); |
306 | } | 306 | } |
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c index b3df22b65a..b1c59bb0ed 100644 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c | |||
@@ -4465,7 +4465,7 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj | |||
4465 | Evas_Object_Image *o = eo_data_get(eo_obj, MY_CLASS); | 4465 | Evas_Object_Image *o = eo_data_get(eo_obj, MY_CLASS); |
4466 | int imagew, imageh, uvw, uvh; | 4466 | int imagew, imageh, uvw, uvh; |
4467 | void *pixels; | 4467 | void *pixels; |
4468 | Evas_Func *eng = obj->layer->evas->engine.func; | 4468 | Evas_Func *eng = obj->layer->evas->engine.func; |
4469 | int is_inside = 0; | 4469 | int is_inside = 0; |
4470 | 4470 | ||
4471 | /* the following code is similar to evas_object_image_render(), but doesn't | 4471 | /* the following code is similar to evas_object_image_render(), but doesn't |
@@ -4539,7 +4539,7 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj | |||
4539 | } | 4539 | } |
4540 | else | 4540 | else |
4541 | { | 4541 | { |
4542 | void *im; | 4542 | void *im; |
4543 | DATA32 *data = NULL; | 4543 | DATA32 *data = NULL; |
4544 | int err = 0; | 4544 | int err = 0; |
4545 | 4545 | ||
@@ -4547,8 +4547,8 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj | |||
4547 | (obj->layer->evas->engine.data.output, pixels, 0, &data, &err); | 4547 | (obj->layer->evas->engine.data.output, pixels, 0, &data, &err); |
4548 | if ((!im) || (!data) || (err)) | 4548 | if ((!im) || (!data) || (err)) |
4549 | { | 4549 | { |
4550 | ERR("Couldn't get image pixels %p: im=%p, data=%p, err=%d", | 4550 | ERR("Couldn't get image pixels %p: im=%p, data=%p, err=%d", |
4551 | pixels, im, data, err); | 4551 | pixels, im, data, err); |
4552 | goto end; | 4552 | goto end; |
4553 | } | 4553 | } |
4554 | 4554 | ||
@@ -4596,13 +4596,13 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj | |||
4596 | */ | 4596 | */ |
4597 | { | 4597 | { |
4598 | DATA8 alpha = 0; | 4598 | DATA8 alpha = 0; |
4599 | 4599 | ||
4600 | if (eng->pixel_alpha_get(pixels, px, py, &alpha, | 4600 | if (eng->pixel_alpha_get(pixels, px, py, &alpha, |
4601 | 0, 0, | 4601 | 0, 0, |
4602 | imagew, imageh, | 4602 | imagew, imageh, |
4603 | obj->cur.geometry.x + ix, | 4603 | obj->cur.geometry.x + ix, |
4604 | obj->cur.geometry.y + iy, | 4604 | obj->cur.geometry.y + iy, |
4605 | iw, ih)) | 4605 | iw, ih)) |
4606 | { | 4606 | { |
4607 | is_inside = alpha > 0; | 4607 | is_inside = alpha > 0; |
4608 | dobreak_h = 1; | 4608 | dobreak_h = 1; |
@@ -4663,9 +4663,9 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj | |||
4663 | inw = bl; inh = bt; | 4663 | inw = bl; inh = bt; |
4664 | outx = ox; outy = oy; | 4664 | outx = ox; outy = oy; |
4665 | outw = bsl; outh = bst; | 4665 | outw = bsl; outh = bst; |
4666 | if (eng->pixel_alpha_get(pixels, px, py, &alpha, | 4666 | if (eng->pixel_alpha_get(pixels, px, py, &alpha, |
4667 | inx, iny, inw, inh, | 4667 | inx, iny, inw, inh, |
4668 | outx, outy, outw, outh)) | 4668 | outx, outy, outw, outh)) |
4669 | { | 4669 | { |
4670 | is_inside = alpha > 0; | 4670 | is_inside = alpha > 0; |
4671 | dobreak_h = 1; | 4671 | dobreak_h = 1; |
@@ -4679,9 +4679,9 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj | |||
4679 | inw = imw - bl - br; inh = bt; | 4679 | inw = imw - bl - br; inh = bt; |
4680 | outx = ox + bsl; outy = oy; | 4680 | outx = ox + bsl; outy = oy; |
4681 | outw = iw - bsl - bsr; outh = bst; | 4681 | outw = iw - bsl - bsr; outh = bst; |
4682 | if (eng->pixel_alpha_get(pixels, px, py, &alpha, | 4682 | if (eng->pixel_alpha_get(pixels, px, py, &alpha, |
4683 | inx, iny, inw, inh, | 4683 | inx, iny, inw, inh, |
4684 | outx, outy, outw, outh)) | 4684 | outx, outy, outw, outh)) |
4685 | { | 4685 | { |
4686 | is_inside = alpha > 0; | 4686 | is_inside = alpha > 0; |
4687 | dobreak_h = 1; | 4687 | dobreak_h = 1; |
@@ -4694,9 +4694,9 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj | |||
4694 | inw = br; inh = bt; | 4694 | inw = br; inh = bt; |
4695 | outx = ox + iw - bsr; outy = oy; | 4695 | outx = ox + iw - bsr; outy = oy; |
4696 | outw = bsr; outh = bst; | 4696 | outw = bsr; outh = bst; |
4697 | if (eng->pixel_alpha_get(pixels, px, py, &alpha, | 4697 | if (eng->pixel_alpha_get(pixels, px, py, &alpha, |
4698 | inx, iny, inw, inh, | 4698 | inx, iny, inw, inh, |
4699 | outx, outy, outw, outh)) | 4699 | outx, outy, outw, outh)) |
4700 | { | 4700 | { |
4701 | is_inside = alpha > 0; | 4701 | is_inside = alpha > 0; |
4702 | dobreak_h = 1; | 4702 | dobreak_h = 1; |
@@ -4704,14 +4704,14 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj | |||
4704 | break; | 4704 | break; |
4705 | } | 4705 | } |
4706 | // .-- | 4706 | // .-- |
4707 | // # | 4707 | // # |
4708 | inx = 0; iny = bt; | 4708 | inx = 0; iny = bt; |
4709 | inw = bl; inh = imh - bt - bb; | 4709 | inw = bl; inh = imh - bt - bb; |
4710 | outx = ox; outy = oy + bst; | 4710 | outx = ox; outy = oy + bst; |
4711 | outw = bsl; outh = ih - bst - bsb; | 4711 | outw = bsl; outh = ih - bst - bsb; |
4712 | if (eng->pixel_alpha_get(pixels, px, py, &alpha, | 4712 | if (eng->pixel_alpha_get(pixels, px, py, &alpha, |
4713 | inx, iny, inw, inh, | 4713 | inx, iny, inw, inh, |
4714 | outx, outy, outw, outh)) | 4714 | outx, outy, outw, outh)) |
4715 | { | 4715 | { |
4716 | is_inside = alpha > 0; | 4716 | is_inside = alpha > 0; |
4717 | dobreak_h = 1; | 4717 | dobreak_h = 1; |
@@ -4726,9 +4726,9 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj | |||
4726 | inw = imw - bl - br; inh = imh - bt - bb; | 4726 | inw = imw - bl - br; inh = imh - bt - bb; |
4727 | outx = ox + bsl; outy = oy + bst; | 4727 | outx = ox + bsl; outy = oy + bst; |
4728 | outw = iw - bsl - bsr; outh = ih - bst - bsb; | 4728 | outw = iw - bsl - bsr; outh = ih - bst - bsb; |
4729 | if (eng->pixel_alpha_get(pixels, px, py, &alpha, | 4729 | if (eng->pixel_alpha_get(pixels, px, py, &alpha, |
4730 | inx, iny, inw, inh, | 4730 | inx, iny, inw, inh, |
4731 | outx, outy, outw, outh)) | 4731 | outx, outy, outw, outh)) |
4732 | { | 4732 | { |
4733 | is_inside = alpha > 0; | 4733 | is_inside = alpha > 0; |
4734 | dobreak_h = 1; | 4734 | dobreak_h = 1; |
@@ -4742,9 +4742,9 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj | |||
4742 | inw = br; inh = imh - bt - bb; | 4742 | inw = br; inh = imh - bt - bb; |
4743 | outx = ox + iw - bsr; outy = oy + bst; | 4743 | outx = ox + iw - bsr; outy = oy + bst; |
4744 | outw = bsr; outh = ih - bst - bsb; | 4744 | outw = bsr; outh = ih - bst - bsb; |
4745 | if (eng->pixel_alpha_get(pixels, px, py, &alpha, | 4745 | if (eng->pixel_alpha_get(pixels, px, py, &alpha, |
4746 | inx, iny, inw, inh, | 4746 | inx, iny, inw, inh, |
4747 | outx, outy, outw, outh)) | 4747 | outx, outy, outw, outh)) |
4748 | { | 4748 | { |
4749 | is_inside = alpha > 0; | 4749 | is_inside = alpha > 0; |
4750 | dobreak_h = 1; | 4750 | dobreak_h = 1; |
@@ -4757,9 +4757,9 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj | |||
4757 | inw = bl; inh = bb; | 4757 | inw = bl; inh = bb; |
4758 | outx = ox; outy = oy + ih - bsb; | 4758 | outx = ox; outy = oy + ih - bsb; |
4759 | outw = bsl; outh = bsb; | 4759 | outw = bsl; outh = bsb; |
4760 | if (eng->pixel_alpha_get(pixels, px, py, &alpha, | 4760 | if (eng->pixel_alpha_get(pixels, px, py, &alpha, |
4761 | inx, iny, inw, inh, | 4761 | inx, iny, inw, inh, |
4762 | outx, outy, outw, outh)) | 4762 | outx, outy, outw, outh)) |
4763 | { | 4763 | { |
4764 | is_inside = alpha > 0; | 4764 | is_inside = alpha > 0; |
4765 | dobreak_h = 1; | 4765 | dobreak_h = 1; |
@@ -4772,9 +4772,9 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj | |||
4772 | inw = imw - bl - br; inh = bb; | 4772 | inw = imw - bl - br; inh = bb; |
4773 | outx = ox + bsl; outy = oy + ih - bsb; | 4773 | outx = ox + bsl; outy = oy + ih - bsb; |
4774 | outw = iw - bsl - bsr; outh = bsb; | 4774 | outw = iw - bsl - bsr; outh = bsb; |
4775 | if (eng->pixel_alpha_get(pixels, px, py, &alpha, | 4775 | if (eng->pixel_alpha_get(pixels, px, py, &alpha, |
4776 | inx, iny, inw, inh, | 4776 | inx, iny, inw, inh, |
4777 | outx, outy, outw, outh)) | 4777 | outx, outy, outw, outh)) |
4778 | { | 4778 | { |
4779 | is_inside = alpha > 0; | 4779 | is_inside = alpha > 0; |
4780 | dobreak_h = 1; | 4780 | dobreak_h = 1; |
@@ -4787,9 +4787,9 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj | |||
4787 | inw = br; inh = bb; | 4787 | inw = br; inh = bb; |
4788 | outx = ox + iw - bsr; outy = oy + ih - bsb; | 4788 | outx = ox + iw - bsr; outy = oy + ih - bsb; |
4789 | outw = bsr; outh = bsb; | 4789 | outw = bsr; outh = bsb; |
4790 | if (eng->pixel_alpha_get(pixels, px, py, &alpha, | 4790 | if (eng->pixel_alpha_get(pixels, px, py, &alpha, |
4791 | inx, iny, inw, inh, | 4791 | inx, iny, inw, inh, |
4792 | outx, outy, outw, outh)) | 4792 | outx, outy, outw, outh)) |
4793 | { | 4793 | { |
4794 | is_inside = alpha > 0; | 4794 | is_inside = alpha > 0; |
4795 | dobreak_h = 1; | 4795 | dobreak_h = 1; |
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index 088107eb5a..995f00e6e8 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h | |||
@@ -905,8 +905,8 @@ struct _Evas_Func | |||
905 | 905 | ||
906 | /* multiple font draws */ | 906 | /* multiple font draws */ |
907 | Eina_Bool (*multi_font_draw) (void *data, void *context, void *surface, Evas_Font_Set *font, int x, int y, int w, int h, int ow, int oh, Evas_Font_Array *texts, Eina_Bool do_async); | 907 | Eina_Bool (*multi_font_draw) (void *data, void *context, void *surface, Evas_Font_Set *font, int x, int y, int w, int h, int ow, int oh, Evas_Font_Array *texts, Eina_Bool do_async); |
908 | 908 | ||
909 | Eina_Bool (*pixel_alpha_get) (void *image, int x, int y, DATA8 *alpha, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h); | 909 | Eina_Bool (*pixel_alpha_get) (void *image, int x, int y, DATA8 *alpha, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h); |
910 | }; | 910 | }; |
911 | 911 | ||
912 | struct _Evas_Image_Load_Func | 912 | struct _Evas_Image_Load_Func |
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c index a2e43ff971..8eea25c68a 100644 --- a/src/modules/evas/engines/software_generic/evas_engine.c +++ b/src/modules/evas/engines/software_generic/evas_engine.c | |||
@@ -1831,93 +1831,93 @@ eng_multi_font_draw(void *data EINA_UNUSED, void *context, void *surface, Evas_F | |||
1831 | return EINA_FALSE; | 1831 | return EINA_FALSE; |
1832 | } | 1832 | } |
1833 | 1833 | ||
1834 | static Eina_Bool | 1834 | static Eina_Bool |
1835 | eng_pixel_alpha_get(void *image, int x, int y, DATA8 *alpha, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h) | 1835 | eng_pixel_alpha_get(void *image, int x, int y, DATA8 *alpha, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h) |
1836 | { | 1836 | { |
1837 | RGBA_Image *im = image; | 1837 | RGBA_Image *im = image; |
1838 | int px, py, dx, dy, sx, sy, src_w, src_h; | 1838 | int px, py, dx, dy, sx, sy, src_w, src_h; |
1839 | double scale_w, scale_h; | 1839 | double scale_w, scale_h; |
1840 | 1840 | ||
1841 | if (!im) return EINA_FALSE; | 1841 | if (!im) return EINA_FALSE; |
1842 | 1842 | ||
1843 | if ((dst_region_x > x) || (x >= (dst_region_x + dst_region_w)) || | 1843 | if ((dst_region_x > x) || (x >= (dst_region_x + dst_region_w)) || |
1844 | (dst_region_y > y) || (y >= (dst_region_y + dst_region_h))) | 1844 | (dst_region_y > y) || (y >= (dst_region_y + dst_region_h))) |
1845 | { | 1845 | { |
1846 | *alpha = 0; | 1846 | *alpha = 0; |
1847 | return EINA_FALSE; | 1847 | return EINA_FALSE; |
1848 | } | 1848 | } |
1849 | 1849 | ||
1850 | src_w = im->cache_entry.w; | 1850 | src_w = im->cache_entry.w; |
1851 | src_h = im->cache_entry.h; | 1851 | src_h = im->cache_entry.h; |
1852 | if ((src_w == 0) || (src_h == 0)) | 1852 | if ((src_w == 0) || (src_h == 0)) |
1853 | { | 1853 | { |
1854 | *alpha = 0; | 1854 | *alpha = 0; |
1855 | return EINA_TRUE; | 1855 | return EINA_TRUE; |
1856 | } | 1856 | } |
1857 | 1857 | ||
1858 | EINA_SAFETY_ON_TRUE_GOTO(src_region_x < 0, error_oob); | 1858 | EINA_SAFETY_ON_TRUE_GOTO(src_region_x < 0, error_oob); |
1859 | EINA_SAFETY_ON_TRUE_GOTO(src_region_y < 0, error_oob); | 1859 | EINA_SAFETY_ON_TRUE_GOTO(src_region_y < 0, error_oob); |
1860 | EINA_SAFETY_ON_TRUE_GOTO(src_region_x + src_region_w > src_w, error_oob); | 1860 | EINA_SAFETY_ON_TRUE_GOTO(src_region_x + src_region_w > src_w, error_oob); |
1861 | EINA_SAFETY_ON_TRUE_GOTO(src_region_y + src_region_h > src_h, error_oob); | 1861 | EINA_SAFETY_ON_TRUE_GOTO(src_region_y + src_region_h > src_h, error_oob); |
1862 | 1862 | ||
1863 | scale_w = (double)dst_region_w / (double)src_region_w; | 1863 | scale_w = (double)dst_region_w / (double)src_region_w; |
1864 | scale_h = (double)dst_region_h / (double)src_region_h; | 1864 | scale_h = (double)dst_region_h / (double)src_region_h; |
1865 | 1865 | ||
1866 | /* point at destination */ | 1866 | /* point at destination */ |
1867 | dx = x - dst_region_x; | 1867 | dx = x - dst_region_x; |
1868 | dy = y - dst_region_y; | 1868 | dy = y - dst_region_y; |
1869 | 1869 | ||
1870 | /* point at source */ | 1870 | /* point at source */ |
1871 | sx = dx / scale_w; | 1871 | sx = dx / scale_w; |
1872 | sy = dy / scale_h; | 1872 | sy = dy / scale_h; |
1873 | 1873 | ||
1874 | /* pixel point (translated) */ | 1874 | /* pixel point (translated) */ |
1875 | px = src_region_x + sx; | 1875 | px = src_region_x + sx; |
1876 | py = src_region_y + sy; | 1876 | py = src_region_y + sy; |
1877 | EINA_SAFETY_ON_TRUE_GOTO(px >= src_w, error_oob); | 1877 | EINA_SAFETY_ON_TRUE_GOTO(px >= src_w, error_oob); |
1878 | EINA_SAFETY_ON_TRUE_GOTO(py >= src_h, error_oob); | 1878 | EINA_SAFETY_ON_TRUE_GOTO(py >= src_h, error_oob); |
1879 | 1879 | ||
1880 | switch (im->cache_entry.space) | 1880 | switch (im->cache_entry.space) |
1881 | { | 1881 | { |
1882 | case EVAS_COLORSPACE_ARGB8888: | 1882 | case EVAS_COLORSPACE_ARGB8888: |
1883 | { | 1883 | { |
1884 | DATA32 *pixel; | 1884 | DATA32 *pixel; |
1885 | 1885 | ||
1886 | #ifdef EVAS_CSERVE2 | 1886 | #ifdef EVAS_CSERVE2 |
1887 | if (evas_cserve2_use_get()) | 1887 | if (evas_cserve2_use_get()) |
1888 | evas_cache2_image_load_data(&im->cache_entry); | 1888 | evas_cache2_image_load_data(&im->cache_entry); |
1889 | else | 1889 | else |
1890 | #endif | 1890 | #endif |
1891 | evas_cache_image_load_data(&im->cache_entry); | 1891 | evas_cache_image_load_data(&im->cache_entry); |
1892 | 1892 | ||
1893 | if (!im->cache_entry.flags.loaded) | 1893 | if (!im->cache_entry.flags.loaded) |
1894 | { | 1894 | { |
1895 | ERR("im %p has no pixels loaded yet", im); | 1895 | ERR("im %p has no pixels loaded yet", im); |
1896 | return EINA_FALSE; | 1896 | return EINA_FALSE; |
1897 | } | 1897 | } |
1898 | 1898 | ||
1899 | pixel = im->image.data; | 1899 | pixel = im->image.data; |
1900 | pixel += ((py * src_w) + px); | 1900 | pixel += ((py * src_w) + px); |
1901 | *alpha = ((*pixel) >> 24) & 0xff; | 1901 | *alpha = ((*pixel) >> 24) & 0xff; |
1902 | } | 1902 | } |
1903 | break; | 1903 | break; |
1904 | 1904 | ||
1905 | default: | 1905 | default: |
1906 | ERR("Colorspace %d not supported.", im->cache_entry.space); | 1906 | ERR("Colorspace %d not supported.", im->cache_entry.space); |
1907 | *alpha = 0; | 1907 | *alpha = 0; |
1908 | } | 1908 | } |
1909 | 1909 | ||
1910 | return EINA_TRUE; | 1910 | return EINA_TRUE; |
1911 | 1911 | ||
1912 | error_oob: | 1912 | error_oob: |
1913 | ERR("Invalid region src=(%d, %d, %d, %d), dst=(%d, %d, %d, %d), image=%dx%d", | 1913 | ERR("Invalid region src=(%d, %d, %d, %d), dst=(%d, %d, %d, %d), image=%dx%d", |
1914 | src_region_x, src_region_y, src_region_w, src_region_h, | 1914 | src_region_x, src_region_y, src_region_w, src_region_h, |
1915 | dst_region_x, dst_region_y, dst_region_w, dst_region_h, | 1915 | dst_region_x, dst_region_y, dst_region_w, dst_region_h, |
1916 | src_w, src_h); | 1916 | src_w, src_h); |
1917 | *alpha = 0; | 1917 | *alpha = 0; |
1918 | return EINA_TRUE; | 1918 | return EINA_TRUE; |
1919 | } | 1919 | } |
1920 | 1920 | ||
1921 | static void | 1921 | static void |
1922 | eng_image_cache_flush(void *data EINA_UNUSED) | 1922 | eng_image_cache_flush(void *data EINA_UNUSED) |
1923 | { | 1923 | { |
@@ -2652,7 +2652,7 @@ static Evas_Func func = | |||
2652 | eng_image_animated_frame_set, | 2652 | eng_image_animated_frame_set, |
2653 | NULL, | 2653 | NULL, |
2654 | eng_multi_font_draw, | 2654 | eng_multi_font_draw, |
2655 | eng_pixel_alpha_get, | 2655 | eng_pixel_alpha_get, |
2656 | /* FUTURE software generic calls go here */ | 2656 | /* FUTURE software generic calls go here */ |
2657 | }; | 2657 | }; |
2658 | 2658 | ||