edje - support edc proxy.source_clip
[framework/uifw/edje.git] / src / lib / edje_private.h
1 #ifndef _EDJE_PRIVATE_H
2 #define _EDJE_PRIVATE_H
3
4 #ifdef HAVE_CONFIG_H
5 # include <config.h>
6 #endif
7
8 #ifndef _WIN32
9 # define _GNU_SOURCE
10 #endif
11
12 #ifdef STDC_HEADERS
13 # include <stdlib.h>
14 # include <stddef.h>
15 #else
16 # ifdef HAVE_STDLIB_H
17 #  include <stdlib.h>
18 # endif
19 #endif
20 #ifdef HAVE_ALLOCA_H
21 # include <alloca.h>
22 #elif !defined alloca
23 # ifdef __GNUC__
24 #  define alloca __builtin_alloca
25 # elif defined _AIX
26 #  define alloca __alloca
27 # elif defined _MSC_VER
28 #  include <malloc.h>
29 #  define alloca _alloca
30 # elif !defined HAVE_ALLOCA
31 #  ifdef  __cplusplus
32 extern "C"
33 #  endif
34 void *alloca (size_t);
35 # endif
36 #endif
37
38 #include <string.h>
39 #include <limits.h>
40 #include <sys/stat.h>
41 #include <time.h>
42 #include <sys/time.h>
43 #include <errno.h>
44
45 #ifndef _MSC_VER
46 # include <libgen.h>
47 # include <unistd.h>
48 #endif
49
50 #include <fcntl.h>
51
52 #include <lua.h>
53 #include <lualib.h>
54 #include <lauxlib.h>
55 #include <setjmp.h>
56
57 #ifdef HAVE_LOCALE_H
58 # include <locale.h>
59 #endif
60
61 #ifdef HAVE_EVIL
62 # include <Evil.h>
63 #endif
64
65 #include <Eina.h>
66 #include <Eet.h>
67 #include <Evas.h>
68 #include <Ecore.h>
69 #include <Ecore_Evas.h>
70 #include <Ecore_File.h>
71 #include <Ecore_Input.h>
72 #ifdef HAVE_ECORE_IMF
73 # include <Ecore_IMF.h>
74 # include <Ecore_IMF_Evas.h>
75 #endif
76 #include <Embryo.h>
77
78 #ifdef HAVE_EIO
79 # include <Eio.h>
80 #endif
81
82 #include "Edje.h"
83
84 EAPI extern int _edje_default_log_dom ;
85
86 #ifdef EDJE_DEFAULT_LOG_COLOR
87 # undef EDJE_DEFAULT_LOG_COLOR
88 #endif
89 #define EDJE_DEFAULT_LOG_COLOR EINA_COLOR_CYAN
90 #ifdef ERR
91 # undef ERR
92 #endif
93 #define ERR(...) EINA_LOG_DOM_ERR(_edje_default_log_dom, __VA_ARGS__)
94 #ifdef INF
95 # undef INF
96 #endif
97 #define INF(...) EINA_LOG_DOM_INFO(_edje_default_log_dom, __VA_ARGS__)
98 #ifdef WRN
99 # undef WRN
100 #endif
101 #define WRN(...) EINA_LOG_DOM_WARN(_edje_default_log_dom, __VA_ARGS__)
102 #ifdef CRIT
103 # undef CRIT
104 #endif
105 #define CRIT(...) EINA_LOG_DOM_CRIT(_edje_default_log_dom, __VA_ARGS__)
106 #ifdef DBG
107 # undef DBG
108 #endif
109 #define DBG(...) EINA_LOG_DOM_DBG(_edje_default_log_dom, __VA_ARGS__)
110 #ifdef __GNUC__
111 # if __GNUC__ >= 4
112 // BROKEN in gcc 4 on amd64
113 //#  pragma GCC visibility push(hidden)
114 # endif
115 #endif
116
117 #ifndef ABS
118 #define ABS(x) ((x) < 0 ? -(x) : (x))
119 #endif
120
121 #ifndef CLAMP
122 #define CLAMP(x, min, max) (((x) > (max)) ? (max) : (((x) < (min)) ? (min) : (x)))
123 #endif
124
125 #ifndef MIN
126 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
127 #endif
128
129
130 #ifdef BUILD_EDJE_FP
131
132 #define FLOAT_T Eina_F32p32
133 #define EDJE_T_FLOAT EET_T_F32P32
134 #define MUL(a, b) eina_f32p32_mul(a, b)
135 #define SCALE(a, b) eina_f32p32_scale(a, b)
136 #define DIV(a, b) eina_f32p32_div(a, b)
137 #define DIV2(a) ((a) >> 1)
138 #define ADD(a, b) eina_f32p32_add(a, b)
139 #define SUB(a, b) eina_f32p32_sub(a, b)
140 #define SQRT(a) eina_f32p32_sqrt(a)
141 #define TO_DOUBLE(a) eina_f32p32_double_to(a)
142 #define FROM_DOUBLE(a) eina_f32p32_double_from(a)
143 #define FROM_INT(a) eina_f32p32_int_from(a)
144 #define TO_INT(a) eina_f32p32_int_to(a)
145 #define ZERO 0
146 #define COS(a) eina_f32p32_cos(a)
147 #define SIN(a) eina_f32p32_sin(a)
148 #define PI EINA_F32P32_PI
149
150 #else
151
152 #define FLOAT_T double
153 #define EDJE_T_FLOAT EET_T_DOUBLE
154 #define MUL(a, b) ((a) * (b))
155 #define SCALE(a, b) ((a) * (double)(b))
156 #define DIV(a, b) ((a) / (b))
157 #define DIV2(a) ((a) / 2.0)
158 #define ADD(a, b) ((a) + (b))
159 #define SUB(a, b) ((a) - (b))
160 #define SQRT(a) sqrt(a)
161 #define TO_DOUBLE(a) (double)(a)
162 #define FROM_DOUBLE(a) (a)
163 #define FROM_INT(a) (double)(a)
164 #define TO_INT(a) (int)(a)
165 #define ZERO 0.0
166 #define COS(a) cos(a)
167 #define SIN(a) sin(a)
168 #define PI 3.14159265358979323846
169
170 #endif
171
172 /* Inheritable Edje Smart API. For now private so only Edje Edit makes
173  * use of this, but who knows what will be possible in the future */
174 #define EDJE_SMART_API_VERSION 1
175
176 typedef struct _Edje_Smart_Api Edje_Smart_Api;
177
178 struct _Edje_Smart_Api
179 {
180    Evas_Smart_Class base;
181    int version;
182    Eina_Bool (*file_set)(Evas_Object *obj, const char *file, const char *group, Eina_Array *nested);
183 };
184
185 /* Basic macro to init the Edje Smart API */
186 #define EDJE_SMART_API_INIT(smart_class_init) {smart_class_init, EDJE_SMART_API_VERSION, NULL}
187
188 #define EDJE_SMART_API_INIT_NULL EDJE_SMART_API_INIT(EVAS_SMART_CLASS_INIT_NULL)
189 #define EDJE_SMART_API_INIT_VERSION EDJE_SMART_API_INIT(EVAS_SMART_CLASS_INIT_VERSION)
190 #define EDJE_SMART_API_INIT_NAME_VERSION(name) EDJE_SMART_API_INIT(EVAS_SMART_CLASS_INIT_NAME_VERSION(name))
191
192 /* increment this when the EET data descriptors have changed and old
193  * EETs cannot be loaded/used correctly anymore.
194  */
195 #define EDJE_FILE_VERSION 3
196 /* increment this when you add new feature to edje file format without
197  * breaking backward compatibility.
198  */
199 #define EDJE_FILE_MINOR 4
200
201 /* FIXME:
202  *
203  * More example Edje files
204  *
205  * ? programs can do multiple actions from one signal
206  * ? add containering (hbox, vbox, table, wrapping multi-line hbox & vbox)
207  * ? text entry widget (single line only)
208  *
209  * ? recursions, unsafe callbacks outside Edje etc. with freeze, ref/unref and block/unblock and break_programs needs to be redesigned & fixed
210  * ? all unsafe calls that may result in callbacks must be marked and dealt with
211  */
212
213 typedef enum
214 {
215    EDJE_ASPECT_PREFER_NONE,
216    EDJE_ASPECT_PREFER_VERTICAL,
217    EDJE_ASPECT_PREFER_HORIZONTAL,
218    EDJE_ASPECT_PREFER_BOTH,
219    EDJE_ASPECT_PREFER_SOURCE
220 } Edje_Internal_Aspect;
221
222 struct _Edje_Perspective
223 {
224    Evas_Object *obj;
225    Evas        *e;
226    Evas_Coord   px, py, z0, foc;
227    Eina_List   *users;
228    Eina_Bool    global : 1;
229 };
230
231 struct _Edje_Position_Scale
232 {
233    FLOAT_T x, y;
234 };
235
236 struct _Edje_Position
237 {
238    int x, y;
239 };
240
241 struct _Edje_Size
242 {
243    int w, h;
244    Eina_Bool limit; /* should we limit ourself to the size of the source */
245 };
246
247 struct _Edje_Rectangle
248 {
249    int x, y, w, h;
250 };
251
252 struct _Edje_Color
253 {
254    unsigned char  r, g, b, a;
255 };
256
257 struct _Edje_Aspect_Prefer
258 {
259    FLOAT_T min, max;
260    char prefer;
261 };
262
263 struct _Edje_Aspect
264 {
265    int w, h;
266    Edje_Aspect_Control mode;
267 };
268
269 struct _Edje_String
270 {
271    const char *str;
272    unsigned int id;
273 };
274
275 typedef struct _Edje_Position_Scale                  Edje_Alignment;
276 typedef struct _Edje_Position_Scale                  Edje_Position_Scale;
277 typedef struct _Edje_Position                        Edje_Position;
278 typedef struct _Edje_Size                            Edje_Size;
279 typedef struct _Edje_Rectangle                       Edje_Rectangle;
280 typedef struct _Edje_Color                           Edje_Color;
281 typedef struct _Edje_Aspect_Prefer                   Edje_Aspect_Prefer;
282 typedef struct _Edje_Aspect                          Edje_Aspect;
283 typedef struct _Edje_String                          Edje_String;
284
285 typedef struct _Edje_File                            Edje_File;
286 typedef struct _Edje_Style                           Edje_Style;
287 typedef struct _Edje_Style_Tag                       Edje_Style_Tag;
288 typedef struct _Edje_External_Directory              Edje_External_Directory;
289 typedef struct _Edje_External_Directory_Entry        Edje_External_Directory_Entry;
290 typedef struct _Edje_Font_Directory_Entry            Edje_Font_Directory_Entry;
291 typedef struct _Edje_Image_Directory                 Edje_Image_Directory;
292 typedef struct _Edje_Image_Directory_Entry           Edje_Image_Directory_Entry;
293 typedef struct _Edje_Image_Directory_Set             Edje_Image_Directory_Set;
294 typedef struct _Edje_Image_Directory_Set_Entry       Edje_Image_Directory_Set_Entry;
295 typedef struct _Edje_Limit                           Edje_Limit;
296 typedef struct _Edje_Sound_Sample                    Edje_Sound_Sample;
297 typedef struct _Edje_Sound_Tone                      Edje_Sound_Tone;
298 typedef struct _Edje_Sound_Directory                 Edje_Sound_Directory;
299 typedef struct _Edje_Program                         Edje_Program;
300 typedef struct _Edje_Program_Target                  Edje_Program_Target;
301 typedef struct _Edje_Program_After                   Edje_Program_After;
302 typedef struct _Edje_Part_Collection_Directory_Entry Edje_Part_Collection_Directory_Entry;
303 typedef struct _Edje_Pack_Element                    Edje_Pack_Element;
304 typedef struct _Edje_Part_Collection                 Edje_Part_Collection;
305 typedef struct _Edje_Part                            Edje_Part;
306 typedef struct _Edje_Part_Api                        Edje_Part_Api;
307 typedef struct _Edje_Part_Dragable                   Edje_Part_Dragable;
308 typedef struct _Edje_Part_Image_Id                   Edje_Part_Image_Id;
309 typedef struct _Edje_Part_Description_Image          Edje_Part_Description_Image;
310 typedef struct _Edje_Part_Description_Proxy          Edje_Part_Description_Proxy;
311 typedef struct _Edje_Part_Description_Text           Edje_Part_Description_Text;
312 typedef struct _Edje_Part_Description_Box            Edje_Part_Description_Box;
313 typedef struct _Edje_Part_Description_Table          Edje_Part_Description_Table;
314 typedef struct _Edje_Part_Description_External       Edje_Part_Description_External;
315 typedef struct _Edje_Part_Description_Common         Edje_Part_Description_Common;
316 typedef struct _Edje_Part_Description_Spec_Fill      Edje_Part_Description_Spec_Fill;
317 typedef struct _Edje_Part_Description_Spec_Border    Edje_Part_Description_Spec_Border;
318 typedef struct _Edje_Part_Description_Spec_Image     Edje_Part_Description_Spec_Image;
319 typedef struct _Edje_Part_Description_Spec_Proxy     Edje_Part_Description_Spec_Proxy;
320 typedef struct _Edje_Part_Description_Spec_Text      Edje_Part_Description_Spec_Text;
321 typedef struct _Edje_Part_Description_Spec_Box       Edje_Part_Description_Spec_Box;
322 typedef struct _Edje_Part_Description_Spec_Table     Edje_Part_Description_Spec_Table;
323 typedef struct _Edje_Patterns                        Edje_Patterns;
324 typedef struct _Edje_Part_Box_Animation              Edje_Part_Box_Animation;
325 typedef struct _Edje_Part_Limit                      Edje_Part_Limit;
326
327 typedef struct _Edje Edje;
328 typedef struct _Edje_Real_Part_Text Edje_Real_Part_Text;
329 typedef struct _Edje_Real_Part_Swallow Edje_Real_Part_Swallow;
330 typedef struct _Edje_Real_Part_Container Edje_Real_Part_Container;
331 typedef struct _Edje_Real_Part_State Edje_Real_Part_State;
332 typedef struct _Edje_Real_Part_Drag Edje_Real_Part_Drag;
333 typedef struct _Edje_Real_Part_Set Edje_Real_Part_Set;
334 typedef struct _Edje_Real_Part Edje_Real_Part;
335 typedef struct _Edje_Running_Program Edje_Running_Program;
336 typedef struct _Edje_Signal_Callback Edje_Signal_Callback;
337 typedef struct _Edje_Calc_Params Edje_Calc_Params;
338 typedef struct _Edje_Pending_Program Edje_Pending_Program;
339 typedef struct _Edje_Text_Style Edje_Text_Style;
340 typedef struct _Edje_Color_Class Edje_Color_Class;
341 typedef struct _Edje_Text_Class Edje_Text_Class;
342 typedef struct _Edje_Var Edje_Var;
343 typedef struct _Edje_Var_Int Edje_Var_Int;
344 typedef struct _Edje_Var_Float Edje_Var_Float;
345 typedef struct _Edje_Var_String Edje_Var_String;
346 typedef struct _Edje_Var_List Edje_Var_List;
347 typedef struct _Edje_Var_Hash Edje_Var_Hash;
348 typedef struct _Edje_Var_Animator Edje_Var_Animator;
349 typedef struct _Edje_Var_Timer Edje_Var_Timer;
350 typedef struct _Edje_Var_Pool Edje_Var_Pool;
351 typedef struct _Edje_Signal_Source_Char Edje_Signal_Source_Char;
352 typedef struct _Edje_Text_Insert_Filter_Callback Edje_Text_Insert_Filter_Callback;
353 typedef struct _Edje_Markup_Filter_Callback Edje_Markup_Filter_Callback;
354
355 #define EDJE_INF_MAX_W 100000
356 #define EDJE_INF_MAX_H 100000
357
358 #define EDJE_IMAGE_SOURCE_TYPE_NONE           0
359 #define EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT 1
360 #define EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY   2
361 #define EDJE_IMAGE_SOURCE_TYPE_EXTERNAL       3
362 #define EDJE_IMAGE_SOURCE_TYPE_LAST           4
363
364 #define EDJE_SOUND_SOURCE_TYPE_NONE           0
365 #define EDJE_SOUND_SOURCE_TYPE_INLINE_RAW     1
366 #define EDJE_SOUND_SOURCE_TYPE_INLINE_COMP    2
367 #define EDJE_SOUND_SOURCE_TYPE_INLINE_LOSSY   3
368 #define EDJE_SOUND_SOURCE_TYPE_INLINE_AS_IS   4
369
370 #define EDJE_VAR_NONE   0
371 #define EDJE_VAR_INT    1
372 #define EDJE_VAR_FLOAT  2
373 #define EDJE_VAR_STRING 3
374 #define EDJE_VAR_LIST   4
375 #define EDJE_VAR_HASH   5
376
377 #define EDJE_VAR_MAGIC_BASE 0x12fe84ba
378
379 #define EDJE_STATE_PARAM_NONE            0
380 #define EDJE_STATE_PARAM_ALIGNMENT       1
381 #define EDJE_STATE_PARAM_MIN             2
382 #define EDJE_STATE_PARAM_MAX             3
383 #define EDJE_STATE_PARAM_STEP            4
384 #define EDJE_STATE_PARAM_ASPECT          5
385 #define EDJE_STATE_PARAM_ASPECT_PREF     6
386 #define EDJE_STATE_PARAM_COLOR           7
387 #define EDJE_STATE_PARAM_COLOR2          8
388 #define EDJE_STATE_PARAM_COLOR3          9
389 #define EDJE_STATE_PARAM_COLOR_CLASS    10
390 #define EDJE_STATE_PARAM_REL1           11
391 #define EDJE_STATE_PARAM_REL1_TO        12
392 #define EDJE_STATE_PARAM_REL1_OFFSET    13
393 #define EDJE_STATE_PARAM_REL2           14
394 #define EDJE_STATE_PARAM_REL2_TO        15
395 #define EDJE_STATE_PARAM_REL2_OFFSET    16
396 #define EDJE_STATE_PARAM_IMAGE          17
397 #define EDJE_STATE_PARAM_BORDER         18
398 #define EDJE_STATE_PARAM_FILL_SMOOTH    19
399 #define EDJE_STATE_PARAM_FILL_POS       20
400 #define EDJE_STATE_PARAM_FILL_SIZE      21
401 #define EDJE_STATE_PARAM_TEXT           22
402 #define EDJE_STATE_PARAM_TEXT_CLASS     23
403 #define EDJE_STATE_PARAM_TEXT_FONT      24
404 #define EDJE_STATE_PARAM_TEXT_STYLE     25
405 #define EDJE_STATE_PARAM_TEXT_SIZE      26
406 #define EDJE_STATE_PARAM_TEXT_FIT       27
407 #define EDJE_STATE_PARAM_TEXT_MIN       28
408 #define EDJE_STATE_PARAM_TEXT_MAX       29
409 #define EDJE_STATE_PARAM_TEXT_ALIGN     30
410 #define EDJE_STATE_PARAM_VISIBLE        31
411 #define EDJE_STATE_PARAM_MAP_ON         32
412 #define EDJE_STATE_PARAM_MAP_PERSP      33
413 #define EDJE_STATE_PARAM_MAP_LIGNT      34
414 #define EDJE_STATE_PARAM_MAP_ROT_CENTER 35
415 #define EDJE_STATE_PARAM_MAP_ROT_X      36
416 #define EDJE_STATE_PARAM_MAP_ROT_Y      37
417 #define EDJE_STATE_PARAM_MAP_ROT_Z      38
418 #define EDJE_STATE_PARAM_MAP_BACK_CULL  39
419 #define EDJE_STATE_PARAM_MAP_PERSP_ON   40
420 #define EDJE_STATE_PARAM_PERSP_ZPLANE   41
421 #define EDJE_STATE_PARAM_PERSP_FOCAL    42
422 #define EDJE_STATE_PARAM_LAST           43
423
424 #define EDJE_ENTRY_EDIT_MODE_NONE 0
425 #define EDJE_ENTRY_EDIT_MODE_SELECTABLE 1
426 #define EDJE_ENTRY_EDIT_MODE_EDITABLE 2
427 #define EDJE_ENTRY_EDIT_MODE_PASSWORD 3
428
429 #define EDJE_ENTRY_SELECTION_MODE_DEFAULT 0
430 #define EDJE_ENTRY_SELECTION_MODE_EXPLICIT 1
431 #define EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE 2 // TIZEN ONLY
432
433 #define EDJE_ENTRY_CURSOR_MODE_UNDER 0
434 #define EDJE_ENTRY_CURSOR_MODE_BEFORE 1
435
436 #define EDJE_ORIENTATION_AUTO  0
437 #define EDJE_ORIENTATION_LTR   1
438 #define EDJE_ORIENTATION_RTL   2
439
440 #define EDJE_PART_PATH_SEPARATOR ':'
441 #define EDJE_PART_PATH_SEPARATOR_STRING ":"
442 #define EDJE_PART_PATH_SEPARATOR_INDEXL '['
443 #define EDJE_PART_PATH_SEPARATOR_INDEXR ']'
444
445 #define FLAG_NONE 0
446 #define FLAG_X    0x01
447 #define FLAG_Y    0x02
448 #define FLAG_XY   (FLAG_X | FLAG_Y)
449
450 /*----------*/
451
452 struct _Edje_File
453 {
454    const char                     *path;
455    time_t                          mtime;
456
457    Edje_External_Directory        *external_dir;
458    Edje_Image_Directory           *image_dir;
459    Edje_Sound_Directory           *sound_dir;
460    Eina_List                      *styles;
461
462    Eina_List                      *color_classes;
463    Eina_Hash                      *color_hash;
464
465    int                             references;
466    const char                     *compiler;
467    int                             version;
468    int                             minor;
469    int                             feature_ver;
470
471    Eina_Hash                      *data;
472    Eina_Hash                      *fonts;
473
474    Eina_Hash                      *collection;
475    Eina_List                      *collection_cache;
476
477    Edje_Patterns                  *collection_patterns;
478
479    Eet_File                       *ef;
480
481 #ifdef HAVE_EIO
482    Eio_Monitor                    *monitor;
483    Eina_List                      *edjes;
484    Eina_List                      *handlers;
485    Ecore_Timer                    *timeout;
486 #endif
487
488    unsigned char                   free_strings : 1;
489    unsigned char                   dangling : 1;
490    unsigned char                   warning : 1;
491 };
492
493 struct _Edje_Style
494 {
495    char                           *name;
496    Eina_List                      *tags;
497    Evas_Textblock_Style           *style;
498 };
499
500 struct _Edje_Style_Tag
501 {
502    const char                     *key;
503    const char                     *value;
504    const char                     *font;
505    double                          font_size;
506    const char                     *text_class;
507 };
508
509 /*----------*/
510
511
512 struct _Edje_Font_Directory_Entry
513 {
514    const char *entry; /* the name of the font */
515    const char *file; /* the name of the file */
516 };
517
518 /*----------*/
519
520 struct _Edje_External_Directory
521 {
522    Edje_External_Directory_Entry *entries; /* a list of Edje_External_Directory_Entry */
523    unsigned int entries_count;
524 };
525
526 struct _Edje_External_Directory_Entry
527 {
528    const char *entry; /* the name of the external */
529 };
530
531
532 /*----------*/
533
534
535
536 /*----------*/
537
538 struct _Edje_Image_Directory
539 {
540    Edje_Image_Directory_Entry *entries; /* an array of Edje_Image_Directory_Entry */
541    unsigned int entries_count;
542
543    Edje_Image_Directory_Set *sets;
544    unsigned int sets_count; /* an array of Edje_Image_Directory_Set */
545 };
546
547 struct _Edje_Image_Directory_Entry
548 {
549    const char *entry; /* the nominal name of the image - if any */
550    int   source_type; /* alternate source mode. 0 = none */
551    int   source_param; /* extra params on encoding */
552    int   id; /* the id no. of the image */
553 };
554
555 struct _Edje_Image_Directory_Set
556 {
557    char *name;
558    Eina_List *entries;
559
560    int id;
561 };
562
563 struct _Edje_Image_Directory_Set_Entry
564 {
565    const char *name;
566    int id;
567
568    struct {
569      struct {
570        int w;
571        int h;
572      } min, max;
573    } size;
574 };
575
576 struct _Edje_Sound_Sample /*Sound Sample*/
577 {
578    const char *name; /* the nominal name of the sound */
579    const char *snd_src;  /* Sound source Wav file */
580    int   compression;  /* Compression - RAW, LOSSLESS COMP ,  LOSSY ) */
581    int   mode; /* alternate source mode. 0 = none */
582    double quality;
583    int   id; /* the id no. of the sound */
584 };
585
586 struct _Edje_Sound_Tone /*Sound Sample*/
587 {
588    const char *name; /* the nominal name of the sound - if any */
589    int   value; /* alternate source mode. 0 = none */
590    int   id; /* the id no. of the sound */
591 };
592
593 struct _Edje_Sound_Directory
594 {
595
596    Edje_Sound_Sample *samples;  /* an array of Edje_Sound_Sample entries */
597    unsigned int samples_count;
598
599    Edje_Sound_Tone *tones;  /* an array of Edje_Sound_Tone entries */
600    unsigned int tones_count;
601 };
602
603 /*----------*/
604
605 struct _Edje_Program /* a conditional program to be run */
606 {
607    int         id; /* id of program */
608    const char *name; /* name of the action */
609
610    const char *signal; /* if signal emission name matches the glob here... */
611    const char *source; /* if part that emitted this (name) matches this glob */
612    const char *sample_name;
613    const char *tone_name;
614    double duration;
615    double speed;
616
617    struct {
618       const char *part;
619       const char *state; /* if state is not set, we will try with source */
620    } filter; /* the part filter.part should be in state filter.state for signal to be accepted */
621
622    struct {
623       double   from;
624       double   range;
625    } in;
626
627    int         action; /* type - set state, stop action, set drag pos etc. */
628    const char *state; /* what state of alternates to apply, NULL = default */
629    const char *state2; /* what other state to use - for signal emit action */
630    double      value; /* value of state to apply (if multiple names match) */
631    double      value2; /* other value for drag actions */
632
633    struct {
634       int      mode; /* how to tween - linear, sinusoidal etc. */
635       FLOAT_T  time; /* time to graduate between current and new state */
636       FLOAT_T  v1; /* other value for drag actions */
637       FLOAT_T  v2; /* other value for drag actions */
638    } tween;
639
640    Eina_List  *targets; /* list of target parts to apply the state to */
641
642    Eina_List  *after; /* list of actions to run at the end of this, for looping */
643
644    struct {
645       const char *name;
646       const char *description;
647    } api;
648
649    /* used for PARAM_COPY (param names in state and state2 above!) */
650    struct {
651       int src; /* part where parameter is being retrieved */
652       int dst; /* part where parameter is being stored */
653    } param;
654
655    Eina_Bool exec : 1;
656 };
657
658 struct _Edje_Program_Target /* the target of an action */
659 {
660    int id; /* just the part id no, or action id no */
661 };
662
663 struct _Edje_Program_After /* the action to run after another action */
664 {
665    int id;
666 };
667
668 /*----------*/
669 struct _Edje_Limit
670 {
671    const char *name;
672    int value;
673 };
674
675 /*----------*/
676 #define PART_TYPE_FIELDS(TYPE)    \
677       TYPE      RECTANGLE;        \
678       TYPE      TEXT;             \
679       TYPE      IMAGE;            \
680       TYPE      PROXY;            \
681       TYPE      SWALLOW;          \
682       TYPE      TEXTBLOCK;        \
683       TYPE      GROUP;            \
684       TYPE      BOX;              \
685       TYPE      TABLE;            \
686       TYPE      SPACER;   \
687       TYPE      EXTERNAL;
688
689 struct _Edje_Part_Collection_Directory_Entry
690 {
691    const char *entry; /* the nominal name of the part collection */
692    int         id; /* the id of this named part collection */
693
694    struct
695    {
696       PART_TYPE_FIELDS(int)
697       int      part;
698    } count;
699
700    struct
701    {
702       PART_TYPE_FIELDS(Eina_Mempool *)
703       Eina_Mempool *part;
704    } mp;
705
706    struct
707    {
708       PART_TYPE_FIELDS(Eina_Mempool *)
709    } mp_rtl; /* For Right To Left interface */
710
711    Edje_Part_Collection *ref;
712 };
713
714 /*----------*/
715
716 /*----------*/
717
718 struct _Edje_Pack_Element
719 {
720    unsigned char    type; /* only GROUP supported for now */
721    Edje_Real_Part  *parent; /* pointer to the table/box that hold it, set at runtime */
722    const char      *name; /* if != NULL, will be set with evas_object_name_set */
723    const char      *source; /* group name to use as source for this element */
724    Edje_Size        min, prefer, max;
725    struct {
726            int l, r, t, b;
727    } padding;
728    Edje_Alignment   align;
729    Edje_Alignment   weight;
730    Edje_Aspect      aspect;
731    const char      *options; /* extra options for custom objects */
732    /* table specific follows */
733    int              col, row;
734    unsigned short   colspan, rowspan;
735 };
736
737 typedef enum {
738   EDJE_PART_LIMIT_UNKNOWN = 0,
739   EDJE_PART_LIMIT_BELOW,
740   EDJE_PART_LIMIT_ZERO,
741   EDJE_PART_LIMIT_OVER
742 } Edje_Part_Limit_State;
743
744 struct _Edje_Part_Limit
745 {
746    int part;
747
748    Edje_Part_Limit_State width; /* -1, 0 or 1 */
749    Edje_Part_Limit_State height; /* -1, 0, or 1 */
750 };
751
752 /*----------*/
753
754 struct _Edje_Part_Collection
755 {
756    struct { /* list of Edje_Program */
757       Edje_Program **fnmatch; /* complex match with "*?[\" */
758       unsigned int fnmatch_count;
759
760       Edje_Program **strcmp; /* No special caractere, plain strcmp does the work */
761       unsigned int strcmp_count;
762
763       Edje_Program **strncmp; /* Finish by * or ?, plain strncmp does the work */
764       unsigned int strncmp_count;
765
766       Edje_Program **strrncmp; /* Start with * or ?, reverse strncmp will do the job */
767       unsigned int strrncmp_count;
768
769       Edje_Program **nocmp; /* Empty signal/source that will never match */
770       unsigned int nocmp_count;
771    } programs;
772
773    struct { /* list of limit that need to be monitored */
774       Edje_Limit **vertical;
775       unsigned int vertical_count;
776
777       Edje_Limit **horizontal;
778       unsigned int horizontal_count;
779
780       Edje_Part_Limit *parts;
781       unsigned int parts_count;
782    } limits;
783
784    Edje_Part **parts; /* an array of Edje_Part */
785    unsigned int parts_count;
786
787    Eina_Hash *data;
788
789    int        id; /* the collection id */
790
791    Eina_Hash *alias; /* aliasing part */
792    Eina_Hash *aliased; /* invert match of alias */
793
794    struct {
795       Edje_Size min, max;
796       unsigned char orientation;
797    } prop;
798
799    int        references;
800
801 #ifdef EDJE_PROGRAM_CACHE
802    struct {
803       Eina_Hash                   *no_matches;
804       Eina_Hash                   *matches;
805    } prog_cache;
806 #endif
807
808    Embryo_Program   *script; /* all the embryo script code for this group */
809    const char       *part;
810
811    unsigned char    script_only;
812
813    unsigned char    lua_script_only;
814
815    unsigned char    broadcast_signal;
816
817    unsigned char    checked : 1;
818 };
819
820 struct _Edje_Part_Dragable
821 {
822    int                 step_x; /* drag jumps n pixels (0 = no limit) */
823    int                 step_y; /* drag jumps n pixels (0 = no limit) */
824
825    int                 count_x; /* drag area divided by n (0 = no limit) */
826    int                 count_y; /* drag area divided by n (0 = no limit) */
827
828    int                 confine_id; /* dragging within this bit, -1 = no */
829
830    /* davinchi */
831    int            event_id; /* If it is used as scrollbar */
832
833    signed char         x; /* can u click & drag this bit in x dir */
834    signed char         y; /* can u click & drag this bit in y dir */
835 };
836
837 struct _Edje_Part_Api
838 {
839    const char         *name;
840    const char         *description;
841 };
842
843 typedef struct _Edje_Part_Description_List Edje_Part_Description_List;
844 struct _Edje_Part_Description_List
845 {
846    Edje_Part_Description_Common **desc;
847    Edje_Part_Description_Common **desc_rtl; /* desc for Right To Left interface */
848    unsigned int desc_count;
849 };
850
851 struct _Edje_Part
852 {
853    const char                   *name; /* the name if any of the part */
854    Edje_Part_Description_Common *default_desc; /* the part descriptor for default */
855    Edje_Part_Description_Common *default_desc_rtl; /* default desc for Right To Left interface */
856
857    Edje_Part_Description_List    other; /* other possible descriptors */
858
859    const char           *source, *source2, *source3, *source4, *source5, *source6, *source7, *source8, *source9, *source10, *source11;
860    int                    id; /* its id number */
861    int                    clip_to_id; /* the part id to clip this one to */
862    Edje_Part_Dragable     dragable;
863    Edje_Pack_Element    **items; /* packed items for box and table */
864    unsigned int           items_count;
865    unsigned char          type; /* what type (image, rect, text) */
866    unsigned char          effect; /* 0 = plain... */
867    unsigned char          mouse_events; /* it will affect/respond to mouse events */
868    unsigned char          repeat_events; /* it will repeat events to objects below */
869    Evas_Event_Flags       ignore_flags;
870    unsigned char          scale; /* should certain properties scale with edje scale factor? */
871    unsigned char          precise_is_inside;
872    unsigned char          use_alternate_font_metrics;
873    unsigned char          pointer_mode;
874    unsigned char          entry_mode;
875    unsigned char          select_mode;
876    unsigned char          cursor_mode;
877    unsigned char          multiline;
878    unsigned char          access; /* it will be used accessibility feature */
879    Edje_Part_Api          api;
880    unsigned char          nested_children_count;
881 };
882
883 struct _Edje_Part_Image_Id
884 {
885    int id;
886    Eina_Bool set;
887 };
888
889 struct _Edje_Part_Description_Common
890 {
891    struct {
892       double         value; /* the value of the state (for ranges) */
893       const char    *name; /* the named state if any */
894    } state;
895
896    Edje_Alignment align; /* 0 <-> 1.0 alignment within allocated space */
897
898    struct {
899       unsigned char  w, h; /* width or height is fixed in side (cannot expand with Edje object size) */
900    } fixed;
901
902    struct { // only during recalc
903       unsigned char have;
904       FLOAT_T w, h;
905    } minmul;
906
907    Edje_Size min, max;
908    Edje_Position step; /* size stepping by n pixels, 0 = none */
909    Edje_Aspect_Prefer aspect;
910
911    char      *color_class; /* how to modify the color */
912    Edje_Color color;
913    Edje_Color color2;
914
915    struct {
916       FLOAT_T        relative_x;
917       FLOAT_T        relative_y;
918       int            offset_x;
919       int            offset_y;
920       int            id_x; /* -1 = whole part collection, or part ID */
921       int            id_y; /* -1 = whole part collection, or part ID */
922    } rel1, rel2;
923
924    struct {
925       int id_persp;
926       int id_light;
927       struct {
928          int id_center;
929          FLOAT_T x, y, z;
930       } rot;
931       unsigned char backcull;
932       unsigned char on;
933       unsigned char persp_on;
934       unsigned char smooth;
935       unsigned char alpha;
936    } map;
937
938    struct {
939       int zplane;
940       int focal;
941    } persp;
942
943    unsigned char     visible; /* is it shown */
944    unsigned char     limit; /* 0 == no, 1 = width, 2 = height, 3 = both */
945 };
946
947 struct _Edje_Part_Description_Spec_Fill
948 {
949    FLOAT_T        pos_rel_x; /* fill offset x relative to area */
950    FLOAT_T        rel_x; /* relative size compared to area */
951    FLOAT_T        pos_rel_y; /* fill offset y relative to area */
952    FLOAT_T        rel_y; /* relative size compared to area */
953    int            pos_abs_x; /* fill offset x added to fill offset */
954    int            abs_x; /* size of fill added to relative fill */
955    int            pos_abs_y; /* fill offset y added to fill offset */
956    int            abs_y; /* size of fill added to relative fill */
957    int            angle; /* angle of fill -- currently only used by grads */
958    int            spread; /* spread of fill -- currently only used by grads */
959    char           smooth; /* fill with smooth scaling or not */
960    unsigned char  type; /* fill coordinate from container (SCALE) or from source image (TILE) */
961 };
962
963 struct _Edje_Part_Description_Spec_Border
964 {
965    int            l, r, t, b; /* border scaling on image fill */
966    unsigned char  no_fill; /* do we fill the center of the image if bordered? 1 == NO!!!! */
967    unsigned char  scale; /* scale image border by same as scale factor */
968    FLOAT_T        scale_by; /* when border scale above is enabled, border width OUTPUT is scaled by the object or global scale factor. this value adds another multiplier that the global scale is multiplued by first. if <= 0.0 it is not used, and if 1.0 it i s "ineffective" */
969 };
970
971 struct _Edje_Part_Description_Spec_Image
972 {
973    Edje_Part_Description_Spec_Fill   fill;
974
975    Edje_Part_Image_Id **tweens; /* list of Edje_Part_Image_Id */
976    unsigned int         tweens_count; /* number of tweens */
977
978    int            id; /* the image id to use */
979    int            scale_hint; /* evas scale hint */
980    Eina_Bool      set; /* if image condition it's content */
981
982    Edje_Part_Description_Spec_Border border;
983 };
984
985 struct _Edje_Part_Description_Spec_Proxy
986 {
987    Edje_Part_Description_Spec_Fill   fill;
988
989    int id; /* the part id to use as a source for this state */
990    Eina_Bool source_visible;  /* source object visibility */
991    Eina_Bool source_clip;     /* source object clip */
992 };
993
994 struct _Edje_Part_Description_Spec_Text
995 {
996    Edje_String    text; /* if "" or NULL, then leave text unchanged */
997    char          *text_class; /* how to apply/modify the font */
998    Edje_String    style; /* the text style if a textblock */
999    Edje_String    font; /* if a specific font is asked for */
1000    Edje_String    repch; /* replacement char for password mode entry */
1001
1002    Edje_Alignment align; /* text alignment within bounds */
1003    Edje_Color     color3;
1004
1005    double         elipsis; /* 0.0 - 1.0 defining where the elipsis align */
1006    int            size; /* 0 = use user set size */
1007    int            id_source; /* -1 if none */
1008    int            id_text_source; /* -1 if none */
1009
1010    unsigned char  fit_x; /* resize font size down to fit in x dir */
1011    unsigned char  fit_y; /* resize font size down to fit in y dir */
1012    unsigned char  min_x; /* if text size should be part min size */
1013    unsigned char  min_y; /* if text size should be part min size */
1014    unsigned char  max_x; /* if text size should be part max size */
1015    unsigned char  max_y; /* if text size should be part max size */
1016    int            size_range_min;
1017    int            size_range_max; /* -1 means, no bound. */
1018 };
1019
1020 struct _Edje_Part_Description_Spec_Box
1021 {
1022    char          *layout, *alt_layout;
1023    Edje_Alignment align;
1024    struct {
1025       int x, y;
1026    } padding;
1027    struct {
1028       unsigned char h, v;
1029    } min;
1030 };
1031
1032 struct _Edje_Part_Description_Spec_Table
1033 {
1034    unsigned char  homogeneous;
1035    Edje_Alignment align;
1036    struct {
1037       int x, y;
1038    } padding;
1039    struct {
1040       unsigned char h, v;
1041    } min;
1042 };
1043
1044 struct _Edje_Part_Description_Image
1045 {
1046    Edje_Part_Description_Common common;
1047    Edje_Part_Description_Spec_Image image;
1048 };
1049
1050 struct _Edje_Part_Description_Proxy
1051 {
1052    Edje_Part_Description_Common common;
1053    Edje_Part_Description_Spec_Proxy proxy;
1054 };
1055
1056 struct _Edje_Part_Description_Text
1057 {
1058    Edje_Part_Description_Common common;
1059    Edje_Part_Description_Spec_Text text;
1060 };
1061
1062 struct _Edje_Part_Description_Box
1063 {
1064    Edje_Part_Description_Common common;
1065    Edje_Part_Description_Spec_Box box;
1066 };
1067
1068 struct _Edje_Part_Description_Table
1069 {
1070    Edje_Part_Description_Common common;
1071    Edje_Part_Description_Spec_Table table;
1072 };
1073
1074 struct _Edje_Part_Description_External
1075 {
1076    Edje_Part_Description_Common common;
1077    Eina_List *external_params; /* parameters for external objects */
1078 };
1079
1080 /*----------*/
1081
1082 struct _Edje_Signal_Source_Char
1083 {
1084    EINA_RBTREE;
1085
1086    const char *signal;
1087    const char *source;
1088
1089    Eina_Array  list;
1090 };
1091
1092 struct _Edje_Signals_Sources_Patterns
1093
1094 {
1095    Edje_Patterns *signals_patterns;
1096    Edje_Patterns *sources_patterns;
1097
1098    Eina_Rbtree   *exact_match;
1099
1100    union {
1101       struct {
1102          Edje_Program **globing;
1103          unsigned int  count;
1104       } programs;
1105       struct {
1106          Eina_List     *globing;
1107       } callbacks;
1108    } u;
1109 };
1110
1111 typedef struct _Edje_Signals_Sources_Patterns Edje_Signals_Sources_Patterns;
1112
1113 struct _Edje
1114 {
1115    Evas_Object_Smart_Clipped_Data base;
1116    /* This contains (or should):
1117         Evas_Object          *clipper; // a big rect to clip this Edje to
1118         Evas                 *evas; // the Evas this Edje belongs to
1119    */
1120    const Edje_Smart_Api *api;
1121    const char           *path;
1122    const char           *group;
1123    const char           *parent;
1124
1125    Evas_Coord            x, y, w, h;
1126    Edje_Size             min;
1127    double                paused_at;
1128    Evas_Object          *obj; /* the smart object */
1129    Edje_File            *file; /* the file the data comes form */
1130    Edje_Part_Collection *collection; /* the description being used */
1131    Eina_List            *actions; /* currently running actions */
1132    Eina_List            *callbacks;
1133    Eina_List            *pending_actions;
1134    Eina_Hash            *color_classes;
1135    Eina_List            *text_classes;
1136    /* variable pool for Edje Embryo scripts */
1137    Edje_Var_Pool        *var_pool;
1138    /* for faster lookups to avoid nth list walks */
1139    Edje_Real_Part      **table_parts;
1140    Edje_Program        **table_programs;
1141    Edje_Real_Part       *focused_part;
1142    Eina_List            *subobjs;
1143    Eina_List            *text_insert_filter_callbacks;
1144    Eina_List            *markup_filter_callbacks;
1145    void                 *script_only_data;
1146
1147    int                   table_programs_size;
1148    unsigned int          table_parts_size;
1149
1150    Eina_List            *groups;
1151
1152    struct {
1153       Eina_Hash         *text_class;
1154       Eina_Hash         *color_class;
1155    } members;
1156
1157    Edje_Perspective     *persp;
1158
1159    struct {
1160       Edje_Signals_Sources_Patterns callbacks;
1161       Edje_Signals_Sources_Patterns programs;
1162    } patterns;
1163
1164    int                   references;
1165    int                   block;
1166    int                   load_error;
1167    int                   freeze;
1168    FLOAT_T               scale;
1169    Eina_Bool             is_rtl : 1;
1170
1171    struct {
1172       Edje_Text_Change_Cb  func;
1173       void                *data;
1174    } text_change;
1175
1176    struct {
1177       Edje_Message_Handler_Cb  func;
1178       void                    *data;
1179       int                      num;
1180    } message;
1181    int                   processing_messages;
1182
1183    int                   state;
1184
1185    int                   preload_count;
1186
1187    lua_State            *L;
1188    Eina_Inlist          *lua_objs;
1189    int                   lua_ref;
1190
1191    struct {
1192       Edje_Item_Provider_Cb  func;
1193       void                  *data;
1194    } item_provider;
1195
1196    Eina_List            *user_defined;
1197
1198    int                   walking_callbacks;
1199
1200    Eina_Bool          dirty : 1;
1201    Eina_Bool          recalc : 1;
1202    Eina_Bool          delete_callbacks : 1;
1203    Eina_Bool          just_added_callbacks : 1;
1204    Eina_Bool          have_objects : 1;
1205    Eina_Bool          paused : 1;
1206    Eina_Bool          no_anim : 1;
1207    Eina_Bool          calc_only : 1;
1208    Eina_Bool          walking_actions : 1;
1209    Eina_Bool          block_break : 1;
1210    Eina_Bool          delete_me : 1;
1211    Eina_Bool          postponed : 1;
1212    Eina_Bool          freeze_calc : 1;
1213    Eina_Bool          has_entries : 1;
1214    Eina_Bool          entries_inited : 1;
1215 #ifdef EDJE_CALC_CACHE
1216    Eina_Bool          text_part_change : 1;
1217    Eina_Bool          all_part_change : 1;
1218 #endif
1219    Eina_Bool          have_mapped_part : 1;
1220    Eina_Bool          recalc_call : 1;
1221    Eina_Bool          update_hints : 1;
1222    Eina_Bool          recalc_hints : 1;
1223 };
1224
1225 struct _Edje_Calc_Params
1226 {
1227    int              x, y, w, h; // 16
1228    Edje_Rectangle   req; // 16
1229    Edje_Rectangle   req_drag; // 16
1230    Edje_Color       color; // 4
1231    union {
1232       struct {
1233          struct {
1234             int           x, y, w, h; // 16
1235             int           angle; // 4
1236             int           spread; // 4
1237          } fill; // 24
1238
1239          union {
1240             struct {
1241                int           l, r, t, b; // 16
1242                FLOAT_T       border_scale_by;
1243             } image; // 16
1244          } spec; // 16
1245       } common; // 40
1246       struct {
1247          Edje_Alignment align; /* text alignment within bounds */ // 16
1248          double         elipsis; // 8
1249          int            size; // 4
1250          Edje_Color     color2, color3; // 8
1251       } text; // 36
1252    } type; // 40
1253    struct {
1254       struct {
1255          int x, y, z;
1256       } center; // 12
1257       struct {
1258          FLOAT_T x, y, z;
1259       } rotation; // 24
1260       struct {
1261          int x, y, z;
1262          int r, g, b;
1263          int ar, ag, ab;
1264       } light; // 36
1265       struct {
1266          int x, y, z;
1267          int focal;
1268       } persp;
1269    } map;
1270    unsigned char    persp_on : 1;
1271    unsigned char    lighted : 1;
1272    unsigned char    mapped : 1;
1273    unsigned char    visible : 1;
1274    unsigned char    smooth : 1; // 1
1275 }; // 96
1276
1277 struct _Edje_Real_Part_Set
1278 {
1279   Edje_Image_Directory_Set_Entry *entry; // 4
1280   Edje_Image_Directory_Set       *set; // 4
1281
1282   int                             id; // 4
1283 };
1284
1285 struct _Edje_Real_Part_State
1286 {
1287    Edje_Part_Description_Common *description; // 4
1288    Edje_Part_Description_Common *description_rtl; // 4
1289    Edje_Real_Part        *rel1_to_x; // 4
1290    Edje_Real_Part        *rel1_to_y; // 4
1291    Edje_Real_Part        *rel2_to_x; // 4
1292    Edje_Real_Part        *rel2_to_y; // 4
1293 #ifdef EDJE_CALC_CACHE
1294    int                    state; // 4
1295    Edje_Calc_Params       p; // 96
1296 #endif
1297    void                  *external_params; // 4
1298    Edje_Real_Part_Set    *set; // 4
1299 }; // 32
1300 // WITH EDJE_CALC_CACHE 132
1301
1302 struct _Edje_Real_Part_Drag
1303 {
1304    FLOAT_T               x, y; // 16
1305    Edje_Position_Scale   val, size, step, page; // 64
1306    struct {
1307       unsigned int       count; // 4
1308       int                x, y; // 8
1309    } down;
1310    struct {
1311       int                x, y; // 8
1312    } tmp;
1313    unsigned char         need_reset : 1; // 4
1314    Edje_Real_Part       *confine_to; // 4
1315 }; // 104
1316
1317 #define EDJE_RP_TYPE_NONE 0
1318 #define EDJE_RP_TYPE_TEXT 1
1319 #define EDJE_RP_TYPE_CONTAINER 2
1320 #define EDJE_RP_TYPE_SWALLOW 3
1321
1322 struct _Edje_Real_Part_Text
1323 {
1324    void                  *entry_data; // 4
1325    Edje_Real_Part        *source; // 4
1326    Edje_Real_Part        *text_source; // 4
1327    const char            *text; // 4
1328    const char            *font; // 4
1329    const char            *style; // 4
1330    Edje_Position          offset; // 8
1331    short                  size; // 2
1332    struct {
1333       unsigned char       fit_x, fit_y; // 2
1334       short               in_size; // 2
1335       short               out_size; // 2
1336       float               elipsis; // 4
1337       Evas_Coord          in_w, in_h; // 8
1338       const char         *in_str; // 4
1339       const char         *out_str; // 4
1340       FLOAT_T             align_x, align_y; // 16
1341    } cache;
1342 }; // 76
1343 // FIXME make text a potiner to struct and alloc at end
1344 // if part type is TEXT move common members textblock +
1345 // text to front and have smaller struct for textblock
1346
1347 struct _Edje_Real_Part_Container
1348 {
1349    Eina_List                *items; // 4 //FIXME: only if table/box
1350    Edje_Part_Box_Animation  *anim; // 4 //FIXME: Used only if box
1351 };
1352
1353 struct _Edje_Real_Part_Swallow
1354 {
1355    Evas_Object        *swallowed_object; // 4 // FIXME: move with swallow_params data
1356    struct {
1357       Edje_Size min, max; // 16
1358       Edje_Aspect aspect; // 12
1359    } swallow_params; // 28 // FIXME: only if type SWALLOW
1360 };
1361
1362 struct _Edje_Real_Part
1363 {
1364    Edje                     *edje; // 4
1365    Edje_Part                *part; // 4
1366    int                       x, y, w, h; // 16
1367    Edje_Rectangle            req; // 16
1368    Evas_Object              *object; // 4
1369    Evas_Object              *nested_smart; // 4
1370    Edje_Real_Part_Drag      *drag; // 4
1371    Edje_Real_Part           *events_to; // 4
1372    FLOAT_T                   description_pos; // 8
1373    Edje_Part_Description_Common *chosen_description; // 4
1374    Edje_Real_Part_State      param1; // 32
1375    // WITH EDJE_CALC_CACHE: 140
1376    Edje_Real_Part_State     *param2, *custom; // 8
1377    Edje_Calc_Params         *current; // 4
1378    Edje_Real_Part           *clip_to; // 4
1379    Edje_Running_Program     *program; // 4
1380    union {
1381       Edje_Real_Part_Text      *text;
1382       Edje_Real_Part_Container *container;
1383       Edje_Real_Part_Swallow   *swallow;
1384    } typedata; // 4
1385    int                       clicked_button; // 4
1386 #ifdef EDJE_CALC_CACHE
1387    int                       state; // 4
1388 #endif
1389    unsigned char             type; // 1
1390    unsigned char             calculated; // 1
1391    unsigned char             calculating; // 1
1392    unsigned char             still_in   : 1; // 1
1393 #ifdef EDJE_CALC_CACHE
1394    unsigned char             invalidate : 1; // 0
1395 #endif
1396 }; //  287 -> 126
1397 // WITH EDJE_CALC_CACHE: 404
1398
1399 struct _Edje_Running_Program
1400 {
1401    Edje           *edje;
1402    Edje_Program   *program;
1403    double          start_time;
1404    Eina_Bool       delete_me : 1;
1405 };
1406
1407 struct _Edje_Signal_Callback
1408 {
1409    const char     *signal;
1410    const char     *source;
1411    Edje_Signal_Cb  func;
1412    void           *data;
1413    Eina_Bool       just_added : 1;
1414    Eina_Bool       delete_me : 1;
1415    Eina_Bool       propagate : 1;
1416 };
1417
1418 struct _Edje_Text_Insert_Filter_Callback
1419 {
1420    const char  *part;
1421    Edje_Text_Filter_Cb func;
1422    void        *data;
1423 };
1424
1425 struct _Edje_Markup_Filter_Callback
1426 {
1427    const char  *part;
1428    Edje_Markup_Filter_Cb func;
1429    void        *data;
1430 };
1431
1432 struct _Edje_Pending_Program
1433 {
1434    Edje         *edje;
1435    Edje_Program *program;
1436    Ecore_Timer  *timer;
1437 };
1438
1439 struct _Edje_Text_Style
1440 {
1441    struct {
1442       unsigned char x, y;
1443    } offset;
1444    struct {
1445       unsigned char l, r, t, b;
1446    } pad;
1447    int num;
1448    struct {
1449       unsigned char color; /* 0 = color, 1, 2 = color2, color3 */
1450       signed   char x, y; /* offset */
1451       unsigned char alpha;
1452    } members[32];
1453 };
1454
1455 struct _Edje_Color_Class
1456 {
1457    const char    *name;
1458    unsigned char  r, g, b, a;
1459    unsigned char  r2, g2, b2, a2;
1460    unsigned char  r3, g3, b3, a3;
1461 };
1462
1463 struct _Edje_Text_Class
1464 {
1465    const char     *name;
1466    const char     *font;
1467    Evas_Font_Size  size;
1468 };
1469
1470 struct _Edje_Var_Int
1471 {
1472    int      v;
1473 };
1474
1475 struct _Edje_Var_Float
1476 {
1477    double   v;
1478 };
1479
1480 struct _Edje_Var_String
1481 {
1482    char    *v;
1483 };
1484
1485 struct _Edje_Var_List
1486 {
1487    Eina_List *v;
1488 };
1489
1490 struct _Edje_Var_Hash
1491 {
1492    Eina_Hash *v;
1493 };
1494
1495 struct _Edje_Var_Timer
1496 {
1497    Edje           *edje;
1498    int             id;
1499    Embryo_Function func;
1500    int             val;
1501    Ecore_Timer    *timer;
1502 };
1503
1504 struct _Edje_Var_Animator
1505 {
1506    Edje           *edje;
1507    int             id;
1508    Embryo_Function func;
1509    int             val;
1510    double          start, len;
1511    char            delete_me;
1512 };
1513
1514 struct _Edje_Var_Pool
1515 {
1516    int          id_count;
1517    Eina_List   *timers;
1518    Eina_List   *animators;
1519    int          size;
1520    Edje_Var    *vars;
1521    int          walking_list;
1522 };
1523
1524 struct _Edje_Var
1525 {
1526    union {
1527       Edje_Var_Int    i;
1528       Edje_Var_Float  f;
1529       Edje_Var_String s;
1530       Edje_Var_List   l;
1531       Edje_Var_Hash   h;
1532    } data;
1533    unsigned char type;
1534 };
1535
1536 typedef enum _Edje_Queue
1537 {
1538    EDJE_QUEUE_APP,
1539      EDJE_QUEUE_SCRIPT
1540 } Edje_Queue;
1541
1542 typedef struct _Edje_Message_Signal Edje_Message_Signal;
1543 typedef struct _Edje_Message        Edje_Message;
1544
1545 typedef struct _Edje_Message_Signal_Data Edje_Message_Signal_Data;
1546 struct _Edje_Message_Signal_Data
1547 {
1548    int ref;
1549    void *data;
1550    void (*free_func)(void *);
1551 };
1552
1553 struct _Edje_Message_Signal
1554 {
1555    const char *sig;
1556    const char *src;
1557    Edje_Message_Signal_Data *data;
1558 };
1559
1560 struct _Edje_Message
1561 {
1562    Edje              *edje;
1563    Edje_Queue         queue;
1564    Edje_Message_Type  type;
1565    int                id;
1566    unsigned char     *msg;
1567    Eina_Bool          propagated : 1;
1568 };
1569
1570 typedef enum _Edje_Fill
1571 {
1572    EDJE_FILL_TYPE_SCALE = 0,
1573      EDJE_FILL_TYPE_TILE
1574 } Edje_Fill;
1575
1576 typedef enum _Edje_Match_Error
1577 {
1578    EDJE_MATCH_OK,
1579      EDJE_MATCH_ALLOC_ERROR,
1580      EDJE_MATCH_SYNTAX_ERROR
1581
1582 } Edje_Match_Error;
1583
1584 typedef struct _Edje_States     Edje_States;
1585 struct _Edje_Patterns
1586 {
1587    const char    **patterns;
1588
1589    Edje_States    *states;
1590
1591    int             ref;
1592    Eina_Bool       delete_me : 1;
1593    
1594    size_t          patterns_size;
1595    size_t          max_length;
1596    size_t          finals[];
1597 };
1598
1599 typedef enum _Edje_User_Defined_Type 
1600 {
1601    EDJE_USER_SWALLOW,
1602    EDJE_USER_BOX_PACK,
1603    EDJE_USER_TABLE_PACK,
1604    EDJE_USER_STRING,
1605    EDJE_USER_DRAG_STEP,
1606    EDJE_USER_DRAG_PAGE,
1607    EDJE_USER_DRAG_VALUE,
1608    EDJE_USER_DRAG_SIZE
1609 } Edje_User_Defined_Type;
1610
1611 typedef struct _Edje_User_Defined Edje_User_Defined;
1612 struct _Edje_User_Defined
1613 {
1614    Edje_User_Defined_Type type;
1615    const char *part;
1616    Edje *ed;
1617
1618    union {
1619       struct {
1620          const char *text;
1621       } string;
1622       struct {
1623          Evas_Object *child;
1624       } swallow;
1625       struct {
1626          Evas_Object *child;
1627          int index;
1628       } box;
1629       struct {
1630          Evas_Object *child;
1631          unsigned short col;
1632          unsigned short row;
1633          unsigned short colspan;
1634          unsigned short rowspan;
1635       } table;
1636       struct {
1637          double x, y;
1638       } drag_position;
1639       struct {
1640          double w, h;
1641       } drag_size;
1642    } u;
1643 };
1644
1645 Edje_Patterns   *edje_match_collection_dir_init(const Eina_List *lst);
1646 Edje_Patterns   *edje_match_programs_signal_init(Edje_Program * const *array,
1647                                                  unsigned int count);
1648 Edje_Patterns   *edje_match_programs_source_init(Edje_Program * const *array,
1649                                                  unsigned int count);
1650 Edje_Patterns   *edje_match_callback_signal_init(const Eina_List *lst);
1651 Edje_Patterns   *edje_match_callback_source_init(const Eina_List *lst);
1652
1653 Eina_Bool        edje_match_collection_dir_exec(const Edje_Patterns      *ppat,
1654                                                 const char               *string);
1655 Eina_Bool        edje_match_programs_exec(const Edje_Patterns    *ppat_signal,
1656                                           const Edje_Patterns    *ppat_source,
1657                                           const char             *signal,
1658                                           const char             *source,
1659                                           Edje_Program          **programs,
1660                                           Eina_Bool (*func)(Edje_Program *pr, void *data),
1661                                           void                   *data,
1662                                           Eina_Bool               prop);
1663 int              edje_match_callback_exec(Edje_Patterns          *ppat_signal,
1664                                           Edje_Patterns          *ppat_source,
1665                                           const char             *signal,
1666                                           const char             *source,
1667                                           Eina_List              *callbacks,
1668                                           Edje                   *ed,
1669                                           Eina_Bool               prop);
1670
1671 void             edje_match_patterns_free(Edje_Patterns *ppat);
1672
1673 Eina_List *edje_match_program_hash_build(Edje_Program * const * programs,
1674                                          unsigned int count,
1675                                          Eina_Rbtree **tree);
1676 Eina_List *edje_match_callback_hash_build(const Eina_List *callbacks,
1677                                           Eina_Rbtree **tree);
1678 const Eina_Array *edje_match_signal_source_hash_get(const char *signal,
1679                                                     const char *source,
1680                                                     const Eina_Rbtree *tree);
1681 void edje_match_signal_source_free(Edje_Signal_Source_Char *key, void *data);
1682
1683 // FIXME remove below 2 eapi decls when edje_convert goes
1684 EAPI void _edje_edd_init(void);
1685 EAPI void _edje_edd_shutdown(void);
1686
1687 EAPI extern Eet_Data_Descriptor *_edje_edd_edje_file;
1688 EAPI extern Eet_Data_Descriptor *_edje_edd_edje_part_collection;
1689
1690 extern int              _edje_anim_count;
1691 extern Ecore_Animator  *_edje_timer;
1692 extern Eina_List       *_edje_animators;
1693 extern Eina_List       *_edje_edjes;
1694
1695 extern char            *_edje_fontset_append;
1696 extern FLOAT_T          _edje_scale;
1697 extern int              _edje_freeze_val;
1698 extern int              _edje_freeze_calc_count;
1699 extern Eina_List       *_edje_freeze_calc_list;
1700
1701 extern Eina_Bool        _edje_password_show_last;
1702 extern FLOAT_T          _edje_password_show_last_timeout;
1703
1704 extern Eina_Mempool *_edje_real_part_mp;
1705 extern Eina_Mempool *_edje_real_part_state_mp;
1706
1707 extern Eina_Mempool *_emp_RECTANGLE;
1708 extern Eina_Mempool *_emp_TEXT;
1709 extern Eina_Mempool *_emp_IMAGE;
1710 extern Eina_Mempool *_emp_PROXY;
1711 extern Eina_Mempool *_emp_SWALLOW;
1712 extern Eina_Mempool *_emp_TEXTBLOCK;
1713 extern Eina_Mempool *_emp_GROUP;
1714 extern Eina_Mempool *_emp_BOX;
1715 extern Eina_Mempool *_emp_TABLE;
1716 extern Eina_Mempool *_emp_EXTERNAL;
1717 extern Eina_Mempool *_emp_SPACER;
1718 extern Eina_Mempool *_emp_part;
1719
1720 void  _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, FLOAT_T pos, FLOAT_T v1, FLOAT_T v2);
1721 Edje_Part_Description_Common *_edje_part_description_find(Edje *ed,
1722                                                           Edje_Real_Part *rp,
1723                                                           const char *name, double val);
1724 void  _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char  *d1, double v1, const char *d2, double v2);
1725 void  _edje_recalc(Edje *ed);
1726 void  _edje_recalc_do(Edje *ed);
1727 void  _edje_part_recalc_1(Edje *ed, Edje_Real_Part *ep);
1728 int   _edje_part_dragable_calc(Edje *ed, Edje_Real_Part *ep, FLOAT_T *x, FLOAT_T *y);
1729 void  _edje_dragable_pos_set(Edje *ed, Edje_Real_Part *ep, FLOAT_T x, FLOAT_T y);
1730
1731 Eina_Bool _edje_timer_cb(void *data);
1732 Eina_Bool _edje_pending_timer_cb(void *data);
1733 void  _edje_callbacks_add(Evas_Object *obj, Edje *ed, Edje_Real_Part *rp);
1734 void  _edje_callbacks_focus_add(Evas_Object *obj, Edje *ed, Edje_Real_Part *rp);
1735 void  _edje_callbacks_del(Evas_Object *obj, Edje *ed);
1736 void  _edje_callbacks_focus_del(Evas_Object *obj, Edje *ed);
1737
1738 void  _edje_edd_init(void);
1739 void  _edje_edd_shutdown(void);
1740
1741 int _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *group, const char *parent, Eina_List *group_path, Eina_Array *nested);
1742
1743 void  _edje_file_add(Edje *ed);
1744 void  _edje_file_del(Edje *ed);
1745 void  _edje_file_free(Edje_File *edf);
1746 void  _edje_file_cache_shutdown(void);
1747 void  _edje_collection_free(Edje_File *edf,
1748                             Edje_Part_Collection *ec,
1749                             Edje_Part_Collection_Directory_Entry *ce);
1750 void  _edje_collection_free_part_description_clean(int type,
1751                                                    Edje_Part_Description_Common *desc,
1752                                                    Eina_Bool free_strings);
1753 void _edje_collection_free_part_description_free(int type,
1754                                                  Edje_Part_Description_Common *desc,
1755                                                  Edje_Part_Collection_Directory_Entry *ce,
1756                                                  Eina_Bool free_strings);
1757
1758 void  _edje_object_smart_set(Edje_Smart_Api *sc);
1759 const Edje_Smart_Api * _edje_object_smart_class_get(void);
1760
1761 void  _edje_del(Edje *ed);
1762 void  _edje_ref(Edje *ed);
1763 void  _edje_unref(Edje *ed);
1764 void  _edje_clean_objects(Edje *ed);
1765 void  _edje_ref(Edje *ed);
1766 void  _edje_unref(Edje *ed);
1767
1768 Eina_Bool _edje_program_run_iterate(Edje_Running_Program *runp, double tim);
1769 void  _edje_program_end(Edje *ed, Edje_Running_Program *runp);
1770 void  _edje_program_run(Edje *ed, Edje_Program *pr, Eina_Bool force, const char *ssig, const char *ssrc);
1771 void _edje_programs_patterns_clean(Edje *ed);
1772 void _edje_programs_patterns_init(Edje *ed);
1773 void  _edje_emit(Edje *ed, const char *sig, const char *src);
1774 void _edje_emit_full(Edje *ed, const char *sig, const char *src, void *data, void (*free_func)(void *));
1775 void _edje_emit_handle(Edje *ed, const char *sig, const char *src, Edje_Message_Signal_Data *data, Eina_Bool prop);
1776 void  _edje_signals_sources_patterns_clean(Edje_Signals_Sources_Patterns *ssp);
1777 void  _edje_callbacks_patterns_clean(Edje *ed);
1778
1779 void           _edje_text_init(void);
1780 void           _edje_text_part_on_add(Edje *ed, Edje_Real_Part *ep);
1781 void           _edje_text_part_on_del(Edje *ed, Edje_Part *ep);
1782 void           _edje_text_recalc_apply(Edje *ed,
1783                                        Edje_Real_Part *ep,
1784                                        Edje_Calc_Params *params,
1785                                        Edje_Part_Description_Text *chosen_desc);
1786 Evas_Font_Size _edje_text_size_calc(Evas_Font_Size size, Edje_Text_Class *tc);
1787 const char *   _edje_text_class_font_get(Edje *ed,
1788                                          Edje_Part_Description_Text *chosen_desc,
1789                                          int *size, char **free_later);
1790 const char *   _edje_text_font_get(const char *base, const char *new,
1791                                    char **free_later);
1792
1793
1794
1795 Edje_Real_Part   *_edje_real_part_get(const Edje *ed, const char *part);
1796 Edje_Real_Part   *_edje_real_part_recursive_get(const Edje *ed, const char *part);
1797 Edje_Color_Class *_edje_color_class_find(Edje *ed, const char *color_class);
1798 void              _edje_color_class_member_direct_del(const char *color_class, void *lookup);
1799 void              _edje_color_class_member_add(Edje *ed, const char *color_class);
1800 void              _edje_color_class_member_del(Edje *ed, const char *color_class);
1801 void              _edje_color_class_on_del(Edje *ed, Edje_Part *ep);
1802 void              _edje_color_class_members_free(void);
1803 void              _edje_color_class_hash_free(void);
1804
1805 Edje_Text_Class  *_edje_text_class_find(Edje *ed, const char *text_class);
1806 void              _edje_text_class_member_add(Edje *ed, const char *text_class);
1807 void              _edje_text_class_member_del(Edje *ed, const char *text_class);
1808 void              _edje_text_class_member_direct_del(const char *text_class, void *lookup);
1809 void              _edje_text_class_members_free(void);
1810 void              _edje_text_class_hash_free(void);
1811
1812 Edje             *_edje_fetch(const Evas_Object *obj) EINA_PURE;
1813 int               _edje_freeze(Edje *ed);
1814 int               _edje_thaw(Edje *ed);
1815 int               _edje_block(Edje *ed);
1816 int               _edje_unblock(Edje *ed);
1817 int               _edje_block_break(Edje *ed);
1818 void              _edje_block_violate(Edje *ed);
1819 void              _edje_object_part_swallow_free_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
1820 void              _edje_object_part_swallow_changed_hints_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
1821 void              _edje_real_part_swallow(Edje_Real_Part *rp, Evas_Object *obj_swallow, Eina_Bool hints_update);
1822 void              _edje_real_part_swallow_clear(Edje_Real_Part *rp);
1823 void              _edje_box_init(void);
1824 void              _edje_box_shutdown(void);
1825 Eina_Bool         _edje_box_layout_find(const char *name, Evas_Object_Box_Layout *cb, void **data, void (**free_data)(void *data));
1826 void              _edje_box_recalc_apply(Edje *ed __UNUSED__, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edje_Part_Description_Box *chosen_desc);
1827 Eina_Bool         _edje_box_layout_add_child(Edje_Real_Part *rp, Evas_Object *child_obj);
1828 void              _edje_box_layout_remove_child(Edje_Real_Part *rp, Evas_Object *child_obj);
1829 Edje_Part_Box_Animation * _edje_box_layout_anim_new(Evas_Object *box);
1830 void              _edje_box_layout_free_data(void *data);
1831
1832 Eina_Bool         _edje_real_part_box_append(Edje_Real_Part *rp, Evas_Object *child_obj);
1833 Eina_Bool         _edje_real_part_box_prepend(Edje_Real_Part *rp, Evas_Object *child_obj);
1834 Eina_Bool         _edje_real_part_box_insert_before(Edje_Real_Part *rp, Evas_Object *child_obj, const Evas_Object *ref);
1835 Eina_Bool         _edje_real_part_box_insert_at(Edje_Real_Part *rp, Evas_Object *child_obj, unsigned int pos);
1836 Evas_Object      *_edje_real_part_box_remove(Edje_Real_Part *rp, Evas_Object *child_obj);
1837 Evas_Object      *_edje_real_part_box_remove_at(Edje_Real_Part *rp, unsigned int pos);
1838 Eina_Bool         _edje_real_part_box_remove_all(Edje_Real_Part *rp, Eina_Bool clear);
1839 Eina_Bool         _edje_real_part_table_pack(Edje_Real_Part *rp, Evas_Object *child_obj, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan);
1840 Eina_Bool         _edje_real_part_table_unpack(Edje_Real_Part *rp, Evas_Object *child_obj);
1841 void              _edje_real_part_table_clear(Edje_Real_Part *rp, Eina_Bool clear);
1842 Evas_Object      *_edje_children_get(Edje_Real_Part *rp, const char *partid);
1843
1844 Eina_Bool         _edje_object_part_text_raw_set(Evas_Object *obj, Edje_Real_Part *rp, const char *part, const char *text);
1845 char             *_edje_text_escape(const char *text);
1846 char             *_edje_text_unescape(const char *text);
1847
1848 void          _edje_embryo_script_init      (Edje_Part_Collection *edc);
1849 void          _edje_embryo_script_shutdown  (Edje_Part_Collection *edc);
1850 void          _edje_embryo_script_reset     (Edje *ed);
1851 void          _edje_embryo_test_run         (Edje *ed, const char *fname, const char *sig, const char *src);
1852 Edje_Var     *_edje_var_new                 (void);
1853 void          _edje_var_free                (Edje_Var *var);
1854 void          _edje_var_init                (Edje *ed);
1855 void          _edje_var_shutdown            (Edje *ed);
1856 int           _edje_var_string_id_get       (Edje *ed, const char *string);
1857 int           _edje_var_var_int_get         (Edje *ed, Edje_Var *var);
1858 void          _edje_var_var_int_set         (Edje *ed, Edje_Var *var, int v);
1859 double        _edje_var_var_float_get       (Edje *ed, Edje_Var *var);
1860 void          _edje_var_var_float_set       (Edje *ed, Edje_Var *var, double v);
1861 const char   *_edje_var_var_str_get         (Edje *ed, Edje_Var *var);
1862 void          _edje_var_var_str_set         (Edje *ed, Edje_Var *var, const char *str);
1863 int           _edje_var_int_get             (Edje *ed, int id);
1864 void          _edje_var_int_set             (Edje *ed, int id, int v);
1865 double        _edje_var_float_get           (Edje *ed, int id);
1866 void          _edje_var_float_set           (Edje *ed, int id, double v);
1867 const char   *_edje_var_str_get             (Edje *ed, int id);
1868 void          _edje_var_str_set             (Edje *ed, int id, const char *str);
1869
1870 void          _edje_var_list_var_append(Edje *ed, int id, Edje_Var *var);
1871 void          _edje_var_list_var_prepend(Edje *ed, int id, Edje_Var *var);
1872 void          _edje_var_list_var_append_relative(Edje *ed, int id, Edje_Var *var, Edje_Var *relative);
1873 void          _edje_var_list_var_prepend_relative(Edje *ed, int id, Edje_Var *var, Edje_Var *relative);
1874 Edje_Var     *_edje_var_list_nth(Edje *ed, int id, int n);
1875
1876 int           _edje_var_list_count_get(Edje *ed, int id);
1877 void          _edje_var_list_remove_nth(Edje *ed, int id, int n);
1878
1879 int           _edje_var_list_nth_int_get(Edje *ed, int id, int n);
1880 void          _edje_var_list_nth_int_set(Edje *ed, int id, int n, int v);
1881 void          _edje_var_list_int_append(Edje *ed, int id, int v);
1882 void          _edje_var_list_int_prepend(Edje *ed, int id, int v);
1883 void          _edje_var_list_int_insert(Edje *ed, int id, int n, int v);
1884
1885 double        _edje_var_list_nth_float_get(Edje *ed, int id, int n);
1886 void          _edje_var_list_nth_float_set(Edje *ed, int id, int n, double v);
1887 void          _edje_var_list_float_append(Edje *ed, int id, double v);
1888 void          _edje_var_list_float_prepend(Edje *ed, int id, double v);
1889 void          _edje_var_list_float_insert(Edje *ed, int id, int n, double v);
1890
1891 const char   *_edje_var_list_nth_str_get(Edje *ed, int id, int n);
1892 void          _edje_var_list_nth_str_set(Edje *ed, int id, int n, const char *v);
1893 void          _edje_var_list_str_append(Edje *ed, int id, const char *v);
1894 void          _edje_var_list_str_prepend(Edje *ed, int id, const char *v);
1895 void          _edje_var_list_str_insert(Edje *ed, int id, int n, const char *v);
1896
1897 int           _edje_var_timer_add           (Edje *ed, double in, const char *fname, int val);
1898 void          _edje_var_timer_del           (Edje *ed, int id);
1899
1900 int           _edje_var_anim_add            (Edje *ed, double len, const char *fname, int val);
1901 void          _edje_var_anim_del            (Edje *ed, int id);
1902
1903 void          _edje_message_init            (void);
1904 void          _edje_message_shutdown        (void);
1905 void          _edje_message_cb_set          (Edje *ed, void (*func) (void *data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg), void *data);
1906 Edje_Message *_edje_message_new             (Edje *ed, Edje_Queue queue, Edje_Message_Type type, int id);
1907 void          _edje_message_free            (Edje_Message *em);
1908 void          _edje_message_propornot_send  (Edje *ed, Edje_Queue queue, Edje_Message_Type type, int id, void *emsg, Eina_Bool prop);
1909 void          _edje_message_send            (Edje *ed, Edje_Queue queue, Edje_Message_Type type, int id, void *emsg);
1910 void          _edje_message_parameters_push (Edje_Message *em);
1911 void          _edje_message_process         (Edje_Message *em);
1912 void          _edje_message_queue_process   (void);
1913 void          _edje_message_queue_clear     (void);
1914 void          _edje_message_del             (Edje *ed);
1915
1916 void _edje_textblock_styles_add(Edje *ed);
1917 void _edje_textblock_styles_del(Edje *ed);
1918 void _edje_textblock_style_all_update(Edje *ed);
1919 void _edje_textblock_style_parse_and_fix(Edje_File *edf);
1920 void _edje_textblock_style_cleanup(Edje_File *edf);
1921 Edje_File *_edje_cache_file_coll_open(const char *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret, Edje *ed);
1922 void _edje_cache_coll_clean(Edje_File *edf);
1923 void _edje_cache_coll_flush(Edje_File *edf);
1924 void _edje_cache_coll_unref(Edje_File *edf, Edje_Part_Collection *edc);
1925 void _edje_cache_file_unref(Edje_File *edf);
1926
1927 void _edje_embryo_globals_init(Edje *ed);
1928
1929 #define CHKPARAM(n) if (params[0] != (sizeof(Embryo_Cell) * (n))) return -1;
1930 #define HASNPARAMS(n) (params[0] == (sizeof(Embryo_Cell) * (n)))
1931 #define GETSTR(str, par) { \
1932    Embryo_Cell *___cptr; \
1933    int ___l; \
1934    str = NULL; \
1935    if ((___cptr = embryo_data_address_get(ep, (par)))) { \
1936       ___l = embryo_data_string_length_get(ep, ___cptr); \
1937       if (((str) = alloca(___l + 1))) \
1938         embryo_data_string_get(ep, ___cptr, (str)); } }
1939 #define GETSTREVAS(str, par) { \
1940    if ((str)) { \
1941       if ((par) && (!strcmp((par), (str)))) return 0; \
1942       if ((par)) eina_stringshare_del((par)); \
1943       (par) = (char *)eina_stringshare_add((str)); } \
1944    else (par) = NULL; }
1945 #define GETFLOAT(val, par) { \
1946    float *___cptr; \
1947    if ((___cptr = (float *)embryo_data_address_get(ep, (par)))) { \
1948       val = *___cptr; } }
1949
1950 #define GETFLOAT_T(val, par)                                            \
1951   {                                                                     \
1952      float *___cptr;                                                    \
1953      if ((___cptr = (float *)embryo_data_address_get(ep, (par))))       \
1954        {                                                                \
1955           val = FROM_DOUBLE(*___cptr);                                  \
1956        }                                                                \
1957   }
1958
1959 #define GETINT(val, par) {                      \
1960    int *___cptr; \
1961    if ((___cptr = (int *)embryo_data_address_get(ep, (par)))) { \
1962       val = *___cptr; } }
1963 #define SETSTR(str, par) { \
1964    Embryo_Cell *___cptr; \
1965    if ((___cptr = embryo_data_address_get(ep, (par)))) { \
1966       embryo_data_string_set(ep, str, ___cptr); } }
1967 #define SETSTRALLOCATE(s)                       \
1968   {                                             \
1969      if (s) {                                   \
1970         if ((int) strlen((s)) < params[4]) {    \
1971            SETSTR((s), params[3]); }            \
1972         else {                                  \
1973            char *ss;                            \
1974            ss = alloca(strlen((s)) + 1);        \
1975            strcpy(ss, (s));                     \
1976            ss[params[4] - 2] = 0;               \
1977            SETSTR(ss, params[3]); } }           \
1978      else                                       \
1979        SETSTR("", params[3]);                   \
1980   }
1981 #define SETFLOAT(val, par) { \
1982    float *___cptr; \
1983    if ((___cptr = (float *)embryo_data_address_get(ep, (par)))) { \
1984       *___cptr = (float)val; } }
1985 #define SETFLOAT_T(val, par)                                            \
1986   {                                                                     \
1987      float *___cptr;                                                    \
1988      if ((___cptr = (float *)embryo_data_address_get(ep, (par))))       \
1989        {                                                                \
1990           *___cptr = (float) TO_DOUBLE(val);                            \
1991        }                                                                \
1992   }
1993 #define SETINT(val, par) { \
1994    int *___cptr; \
1995    if ((___cptr = (int *)embryo_data_address_get(ep, (par)))) { \
1996       *___cptr = (int)val; } }
1997
1998 Eina_Bool _edje_script_only(Edje *ed);
1999 void _edje_script_only_init(Edje *ed);
2000 void _edje_script_only_shutdown(Edje *ed);
2001 void _edje_script_only_show(Edje *ed);
2002 void _edje_script_only_hide(Edje *ed);
2003 void _edje_script_only_move(Edje *ed);
2004 void _edje_script_only_resize(Edje *ed);
2005 void _edje_script_only_message(Edje *ed, Edje_Message *em);
2006
2007 extern jmp_buf _edje_lua_panic_jmp;
2008 #define _edje_lua_panic_here() setjmp(_edje_lua_panic_jmp)
2009
2010 lua_State *_edje_lua_state_get();
2011 lua_State *_edje_lua_new_thread(Edje *ed, lua_State *L);
2012 void _edje_lua_free_thread(Edje *ed, lua_State *L);
2013 void _edje_lua_new_reg(lua_State *L, int index, void *ptr);
2014 void _edje_lua_get_reg(lua_State *L, void *ptr);
2015 void _edje_lua_free_reg(lua_State *L, void *ptr);
2016 void _edje_lua_script_fn_new(Edje *ed);
2017 void _edje_lua_group_fn_new(Edje *ed);
2018 void _edje_lua_init();
2019 void _edje_lua_shutdown();
2020
2021 void __edje_lua_error(const char *file, const char *fnc, int line, lua_State *L, int err_code);
2022 #define _edje_lua_error(L, err_code)                                    \
2023   __edje_lua_error(__FILE__, __FUNCTION__, __LINE__, L, err_code)
2024
2025 Eina_Bool  _edje_lua_script_only(Edje *ed);
2026 void _edje_lua_script_only_init(Edje *ed);
2027 void _edje_lua_script_only_shutdown(Edje *ed);
2028 void _edje_lua_script_only_show(Edje *ed);
2029 void _edje_lua_script_only_hide(Edje *ed);
2030 void _edje_lua_script_only_move(Edje *ed);
2031 void _edje_lua_script_only_resize(Edje *ed);
2032 void _edje_lua_script_only_message(Edje *ed, Edje_Message *em);
2033
2034 void _edje_entry_init(Edje *ed);
2035 void _edje_entry_shutdown(Edje *ed);
2036 void _edje_entry_real_part_init(Edje_Real_Part *rp);
2037 void _edje_entry_real_part_shutdown(Edje_Real_Part *rp);
2038 void _edje_entry_real_part_configure(Edje_Real_Part *rp);
2039 const char *_edje_entry_selection_get(Edje_Real_Part *rp);
2040 const char *_edje_entry_text_get(Edje_Real_Part *rp);
2041 void _edje_entry_text_markup_set(Edje_Real_Part *rp, const char *text);
2042 void _edje_entry_text_markup_insert(Edje_Real_Part *rp, const char *text);
2043 void _edje_entry_text_markup_append(Edje_Real_Part *rp, const char *text);
2044 void _edje_entry_set_cursor_start(Edje_Real_Part *rp);
2045 void _edje_entry_set_cursor_end(Edje_Real_Part *rp);
2046 void _edje_entry_cursor_copy(Edje_Real_Part *rp, Edje_Cursor cur, Edje_Cursor dst);
2047 void _edje_entry_select_none(Edje_Real_Part *rp);
2048 void _edje_entry_select_all(Edje_Real_Part *rp);
2049 void _edje_entry_select_begin(Edje_Real_Part *rp);
2050 void _edje_entry_select_extend(Edje_Real_Part *rp);
2051 const Eina_List *_edje_entry_anchor_geometry_get(Edje_Real_Part *rp, const char *anchor);
2052 const Eina_List *_edje_entry_anchors_list(Edje_Real_Part *rp);
2053 Eina_Bool _edje_entry_item_geometry_get(Edje_Real_Part *rp, const char *item, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch);
2054 const Eina_List *_edje_entry_items_list(Edje_Real_Part *rp);
2055 void _edje_entry_cursor_geometry_get(Edje_Real_Part *rp, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch);
2056 void _edje_entry_user_insert(Edje_Real_Part *rp, const char *text);
2057 void _edje_entry_select_allow_set(Edje_Real_Part *rp, Eina_Bool allow);
2058 Eina_Bool _edje_entry_select_allow_get(const Edje_Real_Part *rp);
2059 void _edje_entry_select_abort(Edje_Real_Part *rp);
2060 void *_edje_entry_imf_context_get(Edje_Real_Part *rp);
2061 Eina_Bool _edje_entry_cursor_next(Edje_Real_Part *rp, Edje_Cursor cur);
2062 Eina_Bool _edje_entry_cursor_prev(Edje_Real_Part *rp, Edje_Cursor cur);
2063 Eina_Bool _edje_entry_cursor_up(Edje_Real_Part *rp, Edje_Cursor cur);
2064 Eina_Bool _edje_entry_cursor_down(Edje_Real_Part *rp, Edje_Cursor cur);
2065 void _edje_entry_cursor_begin(Edje_Real_Part *rp, Edje_Cursor cur);
2066 void _edje_entry_cursor_end(Edje_Real_Part *rp, Edje_Cursor cur);
2067 void _edje_entry_cursor_line_begin(Edje_Real_Part *rp, Edje_Cursor cur);
2068 void _edje_entry_cursor_line_end(Edje_Real_Part *rp, Edje_Cursor cur);
2069 Eina_Bool _edje_entry_cursor_coord_set(Edje_Real_Part *rp, Edje_Cursor cur, int x, int y);
2070 Eina_Bool _edje_entry_cursor_is_format_get(Edje_Real_Part *rp, Edje_Cursor cur);
2071 Eina_Bool _edje_entry_cursor_is_visible_format_get(Edje_Real_Part *rp, Edje_Cursor cur);
2072 char *_edje_entry_cursor_content_get(Edje_Real_Part *rp, Edje_Cursor cur);
2073 void _edje_entry_cursor_pos_set(Edje_Real_Part *rp, Edje_Cursor cur, int pos);
2074 int _edje_entry_cursor_pos_get(Edje_Real_Part *rp, Edje_Cursor cur);
2075 void _edje_entry_imf_context_reset(Edje_Real_Part *rp);
2076 void _edje_entry_input_panel_layout_set(Edje_Real_Part *rp, Edje_Input_Panel_Layout layout);
2077 Edje_Input_Panel_Layout _edje_entry_input_panel_layout_get(Edje_Real_Part *rp);
2078 void _edje_entry_input_panel_layout_variation_set(Edje_Real_Part *rp, int variation);
2079 int _edje_entry_input_panel_layout_variation_get(Edje_Real_Part *rp);
2080 void _edje_entry_autocapital_type_set(Edje_Real_Part *rp, Edje_Text_Autocapital_Type autocapital_type);
2081 Edje_Text_Autocapital_Type _edje_entry_autocapital_type_get(Edje_Real_Part *rp);
2082 void _edje_entry_prediction_allow_set(Edje_Real_Part *rp, Eina_Bool prediction);
2083 Eina_Bool _edje_entry_prediction_allow_get(Edje_Real_Part *rp);
2084 void _edje_entry_input_panel_enabled_set(Edje_Real_Part *rp, Eina_Bool enabled);
2085 Eina_Bool _edje_entry_input_panel_enabled_get(Edje_Real_Part *rp);
2086 void _edje_entry_input_panel_show(Edje_Real_Part *rp);
2087 void _edje_entry_input_panel_hide(Edje_Real_Part *rp);
2088 void _edje_entry_input_panel_language_set(Edje_Real_Part *rp, Edje_Input_Panel_Lang lang);
2089 Edje_Input_Panel_Lang _edje_entry_input_panel_language_get(Edje_Real_Part *rp);
2090 void _edje_entry_input_panel_imdata_set(Edje_Real_Part *rp, const void *data, int len);
2091 void _edje_entry_input_panel_imdata_get(Edje_Real_Part *rp, void *data, int *len);
2092 void _edje_entry_input_panel_return_key_type_set(Edje_Real_Part *rp, Edje_Input_Panel_Return_Key_Type return_key_type);
2093 Edje_Input_Panel_Return_Key_Type _edje_entry_input_panel_return_key_type_get(Edje_Real_Part *rp);
2094 void _edje_entry_input_panel_return_key_disabled_set(Edje_Real_Part *rp, Eina_Bool disabled);
2095 Eina_Bool _edje_entry_input_panel_return_key_disabled_get(Edje_Real_Part *rp);
2096
2097 ///////////////////////////// TIZEN ONLY : START /////////////////////////////////////////////////////////////////////////////
2098 Eina_Bool _edje_entry_selection_geometry_get(Edje_Real_Part *rp, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
2099 void _edje_entry_layout_region_set(Edje_Real_Part *rp, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
2100 void _edje_entry_viewport_region_set(Edje_Real_Part *rp, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
2101 void _edje_entry_selection_handler_geometry_get(Edje_Real_Part *rp, Edje_Selection_Handler type, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
2102 Eina_Bool _edje_entry_select_word(Edje_Real_Part *rp);
2103 Eina_Bool _edje_entry_cursor_handler_disabled_get(Edje_Real_Part *rp);
2104 void _edje_entry_cursor_handler_disabled_set(Edje_Real_Part *rp, Eina_Bool disabled);
2105 /* Currently, this is only for freezing and thawing the cursor's movement while style change.(130129) */
2106 void _edje_entry_freeze(Edje_Real_Part *rp);
2107 void _edje_entry_thaw(Edje_Real_Part *rp);
2108 ///////////////////////////// TIZEN ONLY : END   /////////////////////////////////////////////////////////////////////////////
2109
2110 void _edje_external_init();
2111 void _edje_external_shutdown();
2112 Evas_Object *_edje_external_type_add(const char *type_name, Evas *evas, Evas_Object *parent, const Eina_List *params, const char *part_name);
2113 void _edje_external_signal_emit(Evas_Object *obj, const char *emission, const char *source);
2114 Eina_Bool _edje_external_param_set(Evas_Object *obj, Edje_Real_Part *rp, const Edje_External_Param *param) EINA_ARG_NONNULL(2);
2115 Eina_Bool _edje_external_param_get(const Evas_Object *obj, Edje_Real_Part *rp, Edje_External_Param *param) EINA_ARG_NONNULL(2);
2116 Evas_Object *_edje_external_content_get(const Evas_Object *obj, const char *content) EINA_ARG_NONNULL(1, 2);
2117 void _edje_external_params_free(Eina_List *params, Eina_Bool free_strings);
2118 void _edje_external_recalc_apply(Edje *ed, Edje_Real_Part *ep,
2119                                  Edje_Calc_Params *params,
2120                                  Edje_Part_Description_Common *chosen_desc);
2121 void *_edje_external_params_parse(Evas_Object *obj, const Eina_List *params);
2122 void _edje_external_parsed_params_free(Evas_Object *obj, void *params);
2123
2124 Eina_Module *_edje_module_handle_load(const char *module);
2125 void _edje_module_init();
2126 void _edje_module_shutdown();
2127
2128 static inline Eina_Bool
2129 edje_program_is_strncmp(const char *str)
2130 {
2131    size_t length;
2132
2133    length = strlen(str);
2134
2135    if (strpbrk(str, "*?[\\") != str + length)
2136      return EINA_FALSE;
2137    if (str[length] == '['
2138        || str[length] == '\\')
2139      return EINA_FALSE;
2140    return EINA_TRUE;
2141 }
2142
2143 static inline Eina_Bool
2144 edje_program_is_strrncmp(const char *str)
2145 {
2146    if (*str != '*' && *str != '?')
2147      return EINA_FALSE;
2148    if (strpbrk(str + 1, "*?[\\"))
2149      return EINA_FALSE;
2150    return EINA_TRUE;
2151 }
2152 void edje_object_propagate_callback_add(Evas_Object *obj, void (*func) (void *data, Evas_Object *o, const char *emission, const char *source), void *data);
2153
2154
2155 /* used by edje_cc - private still */
2156 EAPI void _edje_program_insert(Edje_Part_Collection *ed, Edje_Program *p);
2157 EAPI void _edje_program_remove(Edje_Part_Collection *ed, Edje_Program *p);
2158
2159 void _edje_lua2_error_full(const char *file, const char *fnc, int line, lua_State *L, int err_code);
2160 #define _edje_lua2_error(L, err_code) _edje_lua2_error_full(__FILE__, __FUNCTION__, __LINE__, L, err_code)
2161 void _edje_lua2_script_init(Edje *ed);
2162 void _edje_lua2_script_shutdown(Edje *ed);
2163 void _edje_lua2_script_load(Edje_Part_Collection *edc, void *data, int size);
2164 void _edje_lua2_script_unload(Edje_Part_Collection *edc);
2165
2166 void _edje_lua2_script_func_shutdown(Edje *ed);
2167 void _edje_lua2_script_func_show(Edje *ed);
2168 void _edje_lua2_script_func_hide(Edje *ed);
2169 void _edje_lua2_script_func_move(Edje *ed);
2170 void _edje_lua2_script_func_resize(Edje *ed);
2171 void _edje_lua2_script_func_message(Edje *ed, Edje_Message *em);
2172 void _edje_lua2_script_func_signal(Edje *ed, const char *sig, const char *src);
2173
2174 const char *edje_string_get(const Edje_String *es);
2175 const char *edje_string_id_get(const Edje_String *es);
2176
2177 void _edje_object_orientation_inform(Evas_Object *obj);
2178
2179 void _edje_lib_ref(void);
2180 void _edje_lib_unref(void);
2181
2182 void _edje_subobj_register(Edje *ed, Evas_Object *ob);
2183 void _edje_subobj_unregister(Edje *ed, Evas_Object *ob);
2184
2185 void _edje_multisense_init(void);
2186 void _edje_multisense_shutdown(void);
2187 Eina_Bool _edje_multisense_internal_sound_sample_play(Edje *ed, const char *sample_name, const double speed);
2188 Eina_Bool _edje_multisense_internal_sound_tone_play(Edje *ed, const char *tone_name, const double duration);
2189
2190 void _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *state);
2191
2192 void _edje_user_definition_remove(Edje_User_Defined *eud, Evas_Object *child);
2193 void _edje_user_definition_free(Edje_User_Defined *eud);
2194
2195 extern Eina_Bool multisense_init;
2196
2197 #ifdef HAVE_LIBREMIX
2198 #include <remix/remix.h>
2199 #endif
2200 #include <Eina.h>
2201
2202 typedef struct _Edje_Multisense_Env  Edje_Multisense_Env;
2203
2204 struct _Edje_Multisense_Env
2205 {
2206 #ifdef HAVE_LIBREMIX
2207    RemixEnv *remixenv;
2208 #endif
2209 };
2210
2211 typedef Eina_Bool (*MULTISENSE_FACTORY_INIT_FUNC) (Edje_Multisense_Env *);
2212 typedef Eina_Bool (*MULTISENSE_FACTORY_SHUTDOWN_FUNC) (Edje_Multisense_Env *);
2213 #ifdef HAVE_LIBREMIX
2214 typedef RemixBase* (*MULTISENSE_SOUND_PLAYER_GET_FUNC) (Edje_Multisense_Env *);
2215 #endif
2216
2217 #endif