aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/edje/src
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-04 18:41:13 +1000
committerDavid Walter Seikel2012-01-04 18:41:13 +1000
commitdd7595a3475407a7fa96a97393bae8c5220e8762 (patch)
treee341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/edje/src
parentAdd the skeleton. (diff)
downloadSledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to 'libraries/edje/src')
-rw-r--r--libraries/edje/src/Makefile.am4
-rw-r--r--libraries/edje/src/Makefile.in636
-rw-r--r--libraries/edje/src/bin/Makefile.am72
-rw-r--r--libraries/edje/src/bin/Makefile.in1149
-rw-r--r--libraries/edje/src/bin/edje_cc.c250
-rw-r--r--libraries/edje/src/bin/edje_cc.h226
-rw-r--r--libraries/edje/src/bin/edje_cc_handlers.c7763
-rw-r--r--libraries/edje/src/bin/edje_cc_mem.c40
-rw-r--r--libraries/edje/src/bin/edje_cc_out.c1995
-rw-r--r--libraries/edje/src/bin/edje_cc_parse.c1552
-rw-r--r--libraries/edje/src/bin/edje_cc_sources.c259
-rw-r--r--libraries/edje/src/bin/edje_convert.c459
-rw-r--r--libraries/edje/src/bin/edje_convert.h154
-rw-r--r--libraries/edje/src/bin/edje_data_convert.c451
-rw-r--r--libraries/edje/src/bin/edje_decc.c472
-rw-r--r--libraries/edje/src/bin/edje_decc.h61
-rw-r--r--libraries/edje/src/bin/edje_external_inspector.c663
-rw-r--r--libraries/edje/src/bin/edje_inspector.c1639
-rw-r--r--libraries/edje/src/bin/edje_multisense_convert.c329
-rw-r--r--libraries/edje/src/bin/edje_multisense_convert.h25
-rw-r--r--libraries/edje/src/bin/edje_player.c795
-rw-r--r--libraries/edje/src/bin/edje_recc69
-rw-r--r--libraries/edje/src/bin/epp/Makefile.am59
-rw-r--r--libraries/edje/src/bin/epp/Makefile.in756
-rw-r--r--libraries/edje/src/bin/epp/cppalloc.c70
-rw-r--r--libraries/edje/src/bin/epp/cpperror.c147
-rw-r--r--libraries/edje/src/bin/epp/cppexp.c1090
-rw-r--r--libraries/edje/src/bin/epp/cpphash.c198
-rw-r--r--libraries/edje/src/bin/epp/cpphash.h41
-rw-r--r--libraries/edje/src/bin/epp/cpplib.c7427
-rw-r--r--libraries/edje/src/bin/epp/cpplib.h641
-rw-r--r--libraries/edje/src/bin/epp/cppmain.c142
-rw-r--r--libraries/edje/src/examples/Makefile.am107
-rw-r--r--libraries/edje/src/examples/Makefile.in827
-rw-r--r--libraries/edje/src/examples/animations.edc93
-rw-r--r--libraries/edje/src/examples/basic.edc39
-rw-r--r--libraries/edje/src/examples/box.edc142
-rw-r--r--libraries/edje/src/examples/bubble.pngbin0 -> 4737 bytes
-rw-r--r--libraries/edje/src/examples/color-class.edc87
-rw-r--r--libraries/edje/src/examples/drag.edc89
-rw-r--r--libraries/edje/src/examples/edje-animations.c156
-rw-r--r--libraries/edje/src/examples/edje-basic.c226
-rw-r--r--libraries/edje/src/examples/edje-box.c191
-rw-r--r--libraries/edje/src/examples/edje-box2.c204
-rw-r--r--libraries/edje/src/examples/edje-color-class.c257
-rw-r--r--libraries/edje/src/examples/edje-drag.c157
-rw-r--r--libraries/edje/src/examples/edje-perspective.c201
-rw-r--r--libraries/edje/src/examples/edje-signals-messages.c230
-rw-r--r--libraries/edje/src/examples/edje-swallow.c95
-rw-r--r--libraries/edje/src/examples/edje-table.c165
-rw-r--r--libraries/edje/src/examples/edje-text.c92
-rw-r--r--libraries/edje/src/examples/lua_script.edc405
-rw-r--r--libraries/edje/src/examples/perspective.edc140
-rw-r--r--libraries/edje/src/examples/red.pngbin0 -> 225 bytes
-rw-r--r--libraries/edje/src/examples/signals-messages.edc174
-rw-r--r--libraries/edje/src/examples/sigtest.c309
-rw-r--r--libraries/edje/src/examples/sigtest.edc303
-rw-r--r--libraries/edje/src/examples/swallow.edc21
-rw-r--r--libraries/edje/src/examples/table.edc19
-rw-r--r--libraries/edje/src/examples/test.pngbin0 -> 22869 bytes
-rw-r--r--libraries/edje/src/examples/text.edc68
-rw-r--r--libraries/edje/src/lib/Edje.h3926
-rw-r--r--libraries/edje/src/lib/Edje_Edit.h3539
-rw-r--r--libraries/edje/src/lib/Makefile.am140
-rw-r--r--libraries/edje/src/lib/Makefile.in810
-rw-r--r--libraries/edje/src/lib/edje_box_layout.c242
-rw-r--r--libraries/edje/src/lib/edje_cache.c570
-rw-r--r--libraries/edje/src/lib/edje_calc.c2801
-rw-r--r--libraries/edje/src/lib/edje_callbacks.c546
-rw-r--r--libraries/edje/src/lib/edje_container.c955
-rw-r--r--libraries/edje/src/lib/edje_container.h165
-rw-r--r--libraries/edje/src/lib/edje_convert.h143
-rw-r--r--libraries/edje/src/lib/edje_data.c877
-rw-r--r--libraries/edje/src/lib/edje_edit.c7829
-rw-r--r--libraries/edje/src/lib/edje_embryo.c3179
-rw-r--r--libraries/edje/src/lib/edje_entry.c3110
-rw-r--r--libraries/edje/src/lib/edje_external.c559
-rw-r--r--libraries/edje/src/lib/edje_load.c1525
-rw-r--r--libraries/edje/src/lib/edje_lua.c5150
-rw-r--r--libraries/edje/src/lib/edje_lua2.c4129
-rw-r--r--libraries/edje/src/lib/edje_lua_script_only.c59
-rw-r--r--libraries/edje/src/lib/edje_main.c274
-rw-r--r--libraries/edje/src/lib/edje_match.c814
-rw-r--r--libraries/edje/src/lib/edje_message_queue.c865
-rw-r--r--libraries/edje/src/lib/edje_misc.c1
-rw-r--r--libraries/edje/src/lib/edje_module.c154
-rw-r--r--libraries/edje/src/lib/edje_multisense.c408
-rw-r--r--libraries/edje/src/lib/edje_private.h2028
-rw-r--r--libraries/edje/src/lib/edje_program.c2090
-rw-r--r--libraries/edje/src/lib/edje_script_only.c643
-rw-r--r--libraries/edje/src/lib/edje_smart.c336
-rw-r--r--libraries/edje/src/lib/edje_text.c790
-rw-r--r--libraries/edje/src/lib/edje_textblock_styles.c424
-rw-r--r--libraries/edje/src/lib/edje_util.c4317
-rw-r--r--libraries/edje/src/lib/edje_var.c1093
-rw-r--r--libraries/edje/src/modules/Makefile.am10
-rw-r--r--libraries/edje/src/modules/Makefile.in637
-rw-r--r--libraries/edje/src/modules/alsa_snd_player/Makefile.am20
-rw-r--r--libraries/edje/src/modules/alsa_snd_player/Makefile.in634
-rw-r--r--libraries/edje/src/modules/alsa_snd_player/alsa_snd_player.c405
-rw-r--r--libraries/edje/src/modules/eet_snd_reader/Makefile.am17
-rw-r--r--libraries/edje/src/modules/eet_snd_reader/Makefile.in634
-rw-r--r--libraries/edje/src/modules/eet_snd_reader/eet_snd_reader.c498
-rw-r--r--libraries/edje/src/modules/multisense_factory/Makefile.am21
-rw-r--r--libraries/edje/src/modules/multisense_factory/Makefile.in635
-rw-r--r--libraries/edje/src/modules/multisense_factory/multisense_factory.c33
-rw-r--r--libraries/edje/src/tests/Makefile.am27
-rw-r--r--libraries/edje/src/tests/Makefile.in597
-rw-r--r--libraries/edje/src/tests/edje_suite.c101
-rw-r--r--libraries/edje/src/tests/edje_suite.h9
-rw-r--r--libraries/edje/src/tests/edje_test_edje.c28
111 files changed, 93228 insertions, 0 deletions
diff --git a/libraries/edje/src/Makefile.am b/libraries/edje/src/Makefile.am
new file mode 100644
index 0000000..d97f1db
--- /dev/null
+++ b/libraries/edje/src/Makefile.am
@@ -0,0 +1,4 @@
1## Process this file with automake to produce Makefile.in
2
3SUBDIRS = lib bin modules tests examples
4MAINTAINERCLEANFILES = Makefile.in
diff --git a/libraries/edje/src/Makefile.in b/libraries/edje/src/Makefile.in
new file mode 100644
index 0000000..532d75b
--- /dev/null
+++ b/libraries/edje/src/Makefile.in
@@ -0,0 +1,636 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17VPATH = @srcdir@
18pkgdatadir = $(datadir)/@PACKAGE@
19pkgincludedir = $(includedir)/@PACKAGE@
20pkglibdir = $(libdir)/@PACKAGE@
21pkglibexecdir = $(libexecdir)/@PACKAGE@
22am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
23install_sh_DATA = $(install_sh) -c -m 644
24install_sh_PROGRAM = $(install_sh) -c
25install_sh_SCRIPT = $(install_sh) -c
26INSTALL_HEADER = $(INSTALL_DATA)
27transform = $(program_transform_name)
28NORMAL_INSTALL = :
29PRE_INSTALL = :
30POST_INSTALL = :
31NORMAL_UNINSTALL = :
32PRE_UNINSTALL = :
33POST_UNINSTALL = :
34build_triplet = @build@
35host_triplet = @host@
36subdir = src
37DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
38ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
39am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
40 $(top_srcdir)/m4/efl_binary.m4 \
41 $(top_srcdir)/m4/efl_coverage.m4 \
42 $(top_srcdir)/m4/efl_doxygen.m4 \
43 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
44 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
45 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
46 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
47am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
48 $(ACLOCAL_M4)
49mkinstalldirs = $(install_sh) -d
50CONFIG_HEADER = $(top_builddir)/config.h
51CONFIG_CLEAN_FILES =
52CONFIG_CLEAN_VPATH_FILES =
53AM_V_GEN = $(am__v_GEN_$(V))
54am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
55am__v_GEN_0 = @echo " GEN " $@;
56AM_V_at = $(am__v_at_$(V))
57am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
58am__v_at_0 = @
59SOURCES =
60DIST_SOURCES =
61RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
62 html-recursive info-recursive install-data-recursive \
63 install-dvi-recursive install-exec-recursive \
64 install-html-recursive install-info-recursive \
65 install-pdf-recursive install-ps-recursive install-recursive \
66 installcheck-recursive installdirs-recursive pdf-recursive \
67 ps-recursive uninstall-recursive
68RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
69 distclean-recursive maintainer-clean-recursive
70AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
71 $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
72 distdir
73ETAGS = etags
74CTAGS = ctags
75DIST_SUBDIRS = $(SUBDIRS)
76DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
77am__relativize = \
78 dir0=`pwd`; \
79 sed_first='s,^\([^/]*\)/.*$$,\1,'; \
80 sed_rest='s,^[^/]*/*,,'; \
81 sed_last='s,^.*/\([^/]*\)$$,\1,'; \
82 sed_butlast='s,/*[^/]*$$,,'; \
83 while test -n "$$dir1"; do \
84 first=`echo "$$dir1" | sed -e "$$sed_first"`; \
85 if test "$$first" != "."; then \
86 if test "$$first" = ".."; then \
87 dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
88 dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
89 else \
90 first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
91 if test "$$first2" = "$$first"; then \
92 dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
93 else \
94 dir2="../$$dir2"; \
95 fi; \
96 dir0="$$dir0"/"$$first"; \
97 fi; \
98 fi; \
99 dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
100 done; \
101 reldir="$$dir2"
102ACLOCAL = @ACLOCAL@
103ALLOCA = @ALLOCA@
104ALSA_CFLAGS = @ALSA_CFLAGS@
105ALSA_LIBS = @ALSA_LIBS@
106AMTAR = @AMTAR@
107AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
108AR = @AR@
109AS = @AS@
110AUTOCONF = @AUTOCONF@
111AUTOHEADER = @AUTOHEADER@
112AUTOMAKE = @AUTOMAKE@
113AWK = @AWK@
114CC = @CC@
115CCDEPMODE = @CCDEPMODE@
116CFLAGS = @CFLAGS@
117CHECK_CFLAGS = @CHECK_CFLAGS@
118CHECK_LIBS = @CHECK_LIBS@
119CPP = @CPP@
120CPPFLAGS = @CPPFLAGS@
121CYGPATH_W = @CYGPATH_W@
122DEFS = @DEFS@
123DEPDIR = @DEPDIR@
124DLLTOOL = @DLLTOOL@
125DSYMUTIL = @DSYMUTIL@
126DUMPBIN = @DUMPBIN@
127ECHO_C = @ECHO_C@
128ECHO_N = @ECHO_N@
129ECHO_T = @ECHO_T@
130ECORE_IMF_CFLAGS = @ECORE_IMF_CFLAGS@
131ECORE_IMF_LIBS = @ECORE_IMF_LIBS@
132EDJE_CC_CFLAGS = @EDJE_CC_CFLAGS@
133EDJE_CC_LIBS = @EDJE_CC_LIBS@
134EDJE_CC_PRG = @EDJE_CC_PRG@
135EDJE_CFLAGS = @EDJE_CFLAGS@
136EDJE_DECC_CFLAGS = @EDJE_DECC_CFLAGS@
137EDJE_DECC_LIBS = @EDJE_DECC_LIBS@
138EDJE_DECC_PRG = @EDJE_DECC_PRG@
139EDJE_EXTERNAL_INSPECTOR_CFLAGS = @EDJE_EXTERNAL_INSPECTOR_CFLAGS@
140EDJE_EXTERNAL_INSPECTOR_LIBS = @EDJE_EXTERNAL_INSPECTOR_LIBS@
141EDJE_EXTERNAL_INSPECTOR_PRG = @EDJE_EXTERNAL_INSPECTOR_PRG@
142EDJE_INSPECTOR_CFLAGS = @EDJE_INSPECTOR_CFLAGS@
143EDJE_INSPECTOR_LIBS = @EDJE_INSPECTOR_LIBS@
144EDJE_INSPECTOR_PRG = @EDJE_INSPECTOR_PRG@
145EDJE_LIBS = @EDJE_LIBS@
146EDJE_PLAYER_CFLAGS = @EDJE_PLAYER_CFLAGS@
147EDJE_PLAYER_LIBS = @EDJE_PLAYER_LIBS@
148EDJE_PLAYER_PRG = @EDJE_PLAYER_PRG@
149EDJE_RECC_PRG = @EDJE_RECC_PRG@
150EFL_COVERAGE_CFLAGS = @EFL_COVERAGE_CFLAGS@
151EFL_COVERAGE_LIBS = @EFL_COVERAGE_LIBS@
152EFL_EDJE_BUILD = @EFL_EDJE_BUILD@
153EGREP = @EGREP@
154EVIL_CFLAGS = @EVIL_CFLAGS@
155EVIL_LIBS = @EVIL_LIBS@
156EXEEXT = @EXEEXT@
157FGREP = @FGREP@
158FLAC_CFLAGS = @FLAC_CFLAGS@
159FLAC_LIBS = @FLAC_LIBS@
160GREP = @GREP@
161INSTALL = @INSTALL@
162INSTALL_DATA = @INSTALL_DATA@
163INSTALL_PROGRAM = @INSTALL_PROGRAM@
164INSTALL_SCRIPT = @INSTALL_SCRIPT@
165INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
166LD = @LD@
167LDFLAGS = @LDFLAGS@
168LIBOBJS = @LIBOBJS@
169LIBS = @LIBS@
170LIBTOOL = @LIBTOOL@
171LIPO = @LIPO@
172LN_S = @LN_S@
173LTLIBOBJS = @LTLIBOBJS@
174LUA_CFLAGS = @LUA_CFLAGS@
175LUA_LIBS = @LUA_LIBS@
176MAKEINFO = @MAKEINFO@
177MINIMAL_CFLAGS = @MINIMAL_CFLAGS@
178MINIMAL_LIBS = @MINIMAL_LIBS@
179MKDIR_P = @MKDIR_P@
180MODULE_ARCH = @MODULE_ARCH@
181NM = @NM@
182NMEDIT = @NMEDIT@
183OBJDUMP = @OBJDUMP@
184OBJEXT = @OBJEXT@
185OTOOL = @OTOOL@
186OTOOL64 = @OTOOL64@
187PACKAGE = @PACKAGE@
188PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
189PACKAGE_NAME = @PACKAGE_NAME@
190PACKAGE_STRING = @PACKAGE_STRING@
191PACKAGE_TARNAME = @PACKAGE_TARNAME@
192PACKAGE_URL = @PACKAGE_URL@
193PACKAGE_VERSION = @PACKAGE_VERSION@
194PATH_SEPARATOR = @PATH_SEPARATOR@
195PKG_CONFIG = @PKG_CONFIG@
196PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
197PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
198PYTHON = @PYTHON@
199PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
200PYTHON_PLATFORM = @PYTHON_PLATFORM@
201PYTHON_PREFIX = @PYTHON_PREFIX@
202PYTHON_VERSION = @PYTHON_VERSION@
203RANLIB = @RANLIB@
204REMIX_CFLAGS = @REMIX_CFLAGS@
205REMIX_LIBS = @REMIX_LIBS@
206REMIX_PLUGIN_DIR = @REMIX_PLUGIN_DIR@
207SED = @SED@
208SET_MAKE = @SET_MAKE@
209SHELL = @SHELL@
210SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
211SNDFILE_LIBS = @SNDFILE_LIBS@
212STRIP = @STRIP@
213VERSION = @VERSION@
214VMAJ = @VMAJ@
215VORBISENC_CFLAGS = @VORBISENC_CFLAGS@
216VORBISENC_LIBS = @VORBISENC_LIBS@
217abs_builddir = @abs_builddir@
218abs_srcdir = @abs_srcdir@
219abs_top_builddir = @abs_top_builddir@
220abs_top_srcdir = @abs_top_srcdir@
221ac_ct_CC = @ac_ct_CC@
222ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
223am__include = @am__include@
224am__leading_dot = @am__leading_dot@
225am__quote = @am__quote@
226am__tar = @am__tar@
227am__untar = @am__untar@
228bindir = @bindir@
229build = @build@
230build_alias = @build_alias@
231build_cpu = @build_cpu@
232build_os = @build_os@
233build_vendor = @build_vendor@
234builddir = @builddir@
235datadir = @datadir@
236datarootdir = @datarootdir@
237docdir = @docdir@
238dvidir = @dvidir@
239edje_cc = @edje_cc@
240efl_doxygen = @efl_doxygen@
241efl_have_doxygen = @efl_have_doxygen@
242exec_prefix = @exec_prefix@
243have_lcov = @have_lcov@
244host = @host@
245host_alias = @host_alias@
246host_cpu = @host_cpu@
247host_os = @host_os@
248host_vendor = @host_vendor@
249htmldir = @htmldir@
250includedir = @includedir@
251infodir = @infodir@
252install_sh = @install_sh@
253libdir = @libdir@
254libexecdir = @libexecdir@
255localedir = @localedir@
256localstatedir = @localstatedir@
257lt_ECHO = @lt_ECHO@
258lt_enable_auto_import = @lt_enable_auto_import@
259lua_libs = @lua_libs@
260mandir = @mandir@
261mkdir_p = @mkdir_p@
262oldincludedir = @oldincludedir@
263pdfdir = @pdfdir@
264pkgconfig_requires_private = @pkgconfig_requires_private@
265pkgpyexecdir = @pkgpyexecdir@
266pkgpythondir = @pkgpythondir@
267prefix = @prefix@
268program_transform_name = @program_transform_name@
269psdir = @psdir@
270pyexecdir = @pyexecdir@
271pythondir = @pythondir@
272release_info = @release_info@
273requirement_edje = @requirement_edje@
274sbindir = @sbindir@
275sharedstatedir = @sharedstatedir@
276srcdir = @srcdir@
277sysconfdir = @sysconfdir@
278target_alias = @target_alias@
279top_build_prefix = @top_build_prefix@
280top_builddir = @top_builddir@
281top_srcdir = @top_srcdir@
282version_info = @version_info@
283vimdir = @vimdir@
284SUBDIRS = lib bin modules tests examples
285MAINTAINERCLEANFILES = Makefile.in
286all: all-recursive
287
288.SUFFIXES:
289$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
290 @for dep in $?; do \
291 case '$(am__configure_deps)' in \
292 *$$dep*) \
293 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
294 && { if test -f $@; then exit 0; else break; fi; }; \
295 exit 1;; \
296 esac; \
297 done; \
298 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
299 $(am__cd) $(top_srcdir) && \
300 $(AUTOMAKE) --gnu src/Makefile
301.PRECIOUS: Makefile
302Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
303 @case '$?' in \
304 *config.status*) \
305 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
306 *) \
307 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
308 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
309 esac;
310
311$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
312 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
313
314$(top_srcdir)/configure: $(am__configure_deps)
315 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
316$(ACLOCAL_M4): $(am__aclocal_m4_deps)
317 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
318$(am__aclocal_m4_deps):
319
320mostlyclean-libtool:
321 -rm -f *.lo
322
323clean-libtool:
324 -rm -rf .libs _libs
325
326# This directory's subdirectories are mostly independent; you can cd
327# into them and run `make' without going through this Makefile.
328# To change the values of `make' variables: instead of editing Makefiles,
329# (1) if the variable is set in `config.status', edit `config.status'
330# (which will cause the Makefiles to be regenerated when you run `make');
331# (2) otherwise, pass the desired values on the `make' command line.
332$(RECURSIVE_TARGETS):
333 @fail= failcom='exit 1'; \
334 for f in x $$MAKEFLAGS; do \
335 case $$f in \
336 *=* | --[!k]*);; \
337 *k*) failcom='fail=yes';; \
338 esac; \
339 done; \
340 dot_seen=no; \
341 target=`echo $@ | sed s/-recursive//`; \
342 list='$(SUBDIRS)'; for subdir in $$list; do \
343 echo "Making $$target in $$subdir"; \
344 if test "$$subdir" = "."; then \
345 dot_seen=yes; \
346 local_target="$$target-am"; \
347 else \
348 local_target="$$target"; \
349 fi; \
350 ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
351 || eval $$failcom; \
352 done; \
353 if test "$$dot_seen" = "no"; then \
354 $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
355 fi; test -z "$$fail"
356
357$(RECURSIVE_CLEAN_TARGETS):
358 @fail= failcom='exit 1'; \
359 for f in x $$MAKEFLAGS; do \
360 case $$f in \
361 *=* | --[!k]*);; \
362 *k*) failcom='fail=yes';; \
363 esac; \
364 done; \
365 dot_seen=no; \
366 case "$@" in \
367 distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
368 *) list='$(SUBDIRS)' ;; \
369 esac; \
370 rev=''; for subdir in $$list; do \
371 if test "$$subdir" = "."; then :; else \
372 rev="$$subdir $$rev"; \
373 fi; \
374 done; \
375 rev="$$rev ."; \
376 target=`echo $@ | sed s/-recursive//`; \
377 for subdir in $$rev; do \
378 echo "Making $$target in $$subdir"; \
379 if test "$$subdir" = "."; then \
380 local_target="$$target-am"; \
381 else \
382 local_target="$$target"; \
383 fi; \
384 ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
385 || eval $$failcom; \
386 done && test -z "$$fail"
387tags-recursive:
388 list='$(SUBDIRS)'; for subdir in $$list; do \
389 test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
390 done
391ctags-recursive:
392 list='$(SUBDIRS)'; for subdir in $$list; do \
393 test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
394 done
395
396ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
397 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
398 unique=`for i in $$list; do \
399 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
400 done | \
401 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
402 END { if (nonempty) { for (i in files) print i; }; }'`; \
403 mkid -fID $$unique
404tags: TAGS
405
406TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
407 $(TAGS_FILES) $(LISP)
408 set x; \
409 here=`pwd`; \
410 if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
411 include_option=--etags-include; \
412 empty_fix=.; \
413 else \
414 include_option=--include; \
415 empty_fix=; \
416 fi; \
417 list='$(SUBDIRS)'; for subdir in $$list; do \
418 if test "$$subdir" = .; then :; else \
419 test ! -f $$subdir/TAGS || \
420 set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
421 fi; \
422 done; \
423 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
424 unique=`for i in $$list; do \
425 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
426 done | \
427 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
428 END { if (nonempty) { for (i in files) print i; }; }'`; \
429 shift; \
430 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
431 test -n "$$unique" || unique=$$empty_fix; \
432 if test $$# -gt 0; then \
433 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
434 "$$@" $$unique; \
435 else \
436 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
437 $$unique; \
438 fi; \
439 fi
440ctags: CTAGS
441CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
442 $(TAGS_FILES) $(LISP)
443 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
444 unique=`for i in $$list; do \
445 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
446 done | \
447 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
448 END { if (nonempty) { for (i in files) print i; }; }'`; \
449 test -z "$(CTAGS_ARGS)$$unique" \
450 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
451 $$unique
452
453GTAGS:
454 here=`$(am__cd) $(top_builddir) && pwd` \
455 && $(am__cd) $(top_srcdir) \
456 && gtags -i $(GTAGS_ARGS) "$$here"
457
458distclean-tags:
459 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
460
461distdir: $(DISTFILES)
462 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
463 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
464 list='$(DISTFILES)'; \
465 dist_files=`for file in $$list; do echo $$file; done | \
466 sed -e "s|^$$srcdirstrip/||;t" \
467 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
468 case $$dist_files in \
469 */*) $(MKDIR_P) `echo "$$dist_files" | \
470 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
471 sort -u` ;; \
472 esac; \
473 for file in $$dist_files; do \
474 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
475 if test -d $$d/$$file; then \
476 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
477 if test -d "$(distdir)/$$file"; then \
478 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
479 fi; \
480 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
481 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
482 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
483 fi; \
484 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
485 else \
486 test -f "$(distdir)/$$file" \
487 || cp -p $$d/$$file "$(distdir)/$$file" \
488 || exit 1; \
489 fi; \
490 done
491 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
492 if test "$$subdir" = .; then :; else \
493 test -d "$(distdir)/$$subdir" \
494 || $(MKDIR_P) "$(distdir)/$$subdir" \
495 || exit 1; \
496 fi; \
497 done
498 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
499 if test "$$subdir" = .; then :; else \
500 dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
501 $(am__relativize); \
502 new_distdir=$$reldir; \
503 dir1=$$subdir; dir2="$(top_distdir)"; \
504 $(am__relativize); \
505 new_top_distdir=$$reldir; \
506 echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
507 echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
508 ($(am__cd) $$subdir && \
509 $(MAKE) $(AM_MAKEFLAGS) \
510 top_distdir="$$new_top_distdir" \
511 distdir="$$new_distdir" \
512 am__remove_distdir=: \
513 am__skip_length_check=: \
514 am__skip_mode_fix=: \
515 distdir) \
516 || exit 1; \
517 fi; \
518 done
519check-am: all-am
520check: check-recursive
521all-am: Makefile
522installdirs: installdirs-recursive
523installdirs-am:
524install: install-recursive
525install-exec: install-exec-recursive
526install-data: install-data-recursive
527uninstall: uninstall-recursive
528
529install-am: all-am
530 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
531
532installcheck: installcheck-recursive
533install-strip:
534 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
535 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
536 `test -z '$(STRIP)' || \
537 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
538mostlyclean-generic:
539
540clean-generic:
541
542distclean-generic:
543 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
544 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
545
546maintainer-clean-generic:
547 @echo "This command is intended for maintainers to use"
548 @echo "it deletes files that may require special tools to rebuild."
549 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
550clean: clean-recursive
551
552clean-am: clean-generic clean-libtool mostlyclean-am
553
554distclean: distclean-recursive
555 -rm -f Makefile
556distclean-am: clean-am distclean-generic distclean-tags
557
558dvi: dvi-recursive
559
560dvi-am:
561
562html: html-recursive
563
564html-am:
565
566info: info-recursive
567
568info-am:
569
570install-data-am:
571
572install-dvi: install-dvi-recursive
573
574install-dvi-am:
575
576install-exec-am:
577
578install-html: install-html-recursive
579
580install-html-am:
581
582install-info: install-info-recursive
583
584install-info-am:
585
586install-man:
587
588install-pdf: install-pdf-recursive
589
590install-pdf-am:
591
592install-ps: install-ps-recursive
593
594install-ps-am:
595
596installcheck-am:
597
598maintainer-clean: maintainer-clean-recursive
599 -rm -f Makefile
600maintainer-clean-am: distclean-am maintainer-clean-generic
601
602mostlyclean: mostlyclean-recursive
603
604mostlyclean-am: mostlyclean-generic mostlyclean-libtool
605
606pdf: pdf-recursive
607
608pdf-am:
609
610ps: ps-recursive
611
612ps-am:
613
614uninstall-am:
615
616.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
617 install-am install-strip tags-recursive
618
619.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
620 all all-am check check-am clean clean-generic clean-libtool \
621 ctags ctags-recursive distclean distclean-generic \
622 distclean-libtool distclean-tags distdir dvi dvi-am html \
623 html-am info info-am install install-am install-data \
624 install-data-am install-dvi install-dvi-am install-exec \
625 install-exec-am install-html install-html-am install-info \
626 install-info-am install-man install-pdf install-pdf-am \
627 install-ps install-ps-am install-strip installcheck \
628 installcheck-am installdirs installdirs-am maintainer-clean \
629 maintainer-clean-generic mostlyclean mostlyclean-generic \
630 mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
631 uninstall uninstall-am
632
633
634# Tell versions [3.59,3.63) of GNU make to not export all variables.
635# Otherwise a system limit (for SysV at least) may be exceeded.
636.NOEXPORT:
diff --git a/libraries/edje/src/bin/Makefile.am b/libraries/edje/src/bin/Makefile.am
new file mode 100644
index 0000000..a936d5a
--- /dev/null
+++ b/libraries/edje/src/bin/Makefile.am
@@ -0,0 +1,72 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3if BUILD_EPP
4 SUBDIRS = epp
5endif
6
7bin_SCRIPTS = @EDJE_RECC_PRG@
8
9bin_PROGRAMS = @EDJE_CC_PRG@ @EDJE_DECC_PRG@ @EDJE_PLAYER_PRG@ @EDJE_INSPECTOR_PRG@ @EDJE_EXTERNAL_INSPECTOR_PRG@
10
11EXTRA_PROGRAMS = edje_cc edje_decc edje_player edje_inspector edje_external_inspector
12
13edje_cc_SOURCES = \
14edje_cc.c \
15edje_cc_out.c \
16edje_cc_parse.c \
17edje_cc_mem.c \
18edje_cc_handlers.c \
19edje_cc_sources.c \
20edje_multisense_convert.c
21
22edje_cc_CPPFLAGS = \
23-I$(top_srcdir)/src/bin \
24-I$(top_srcdir)/src/lib \
25-DPACKAGE_BIN_DIR=\"$(bindir)\" \
26-DPACKAGE_LIB_DIR=\"$(libdir)\" \
27-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
28-DEPP_DIR=\"$(libdir)/$(PACKAGE)/utils\" \
29@EDJE_CFLAGS@ @EDJE_CC_CFLAGS@ @EVIL_CFLAGS@ @SNDFILE_CFLAGS@
30edje_cc_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_CC_LIBS@ @EVIL_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@ -lm
31edje_cc_LDFLAGS = @lt_enable_auto_import@
32
33
34edje_decc_SOURCES = \
35edje_decc.c \
36edje_decc.h \
37edje_cc_mem.c \
38edje_cc_sources.c
39
40edje_decc_CPPFLAGS = \
41-I$(top_srcdir)/src/bin \
42-I$(top_srcdir)/src/lib \
43@EDJE_CFLAGS@ @EDJE_DECC_CFLAGS@ @EVIL_CFLAGS@
44edje_decc_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_DECC_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@
45edje_decc_LDFLAGS = @lt_enable_auto_import@
46
47edje_player_SOURCES = edje_player.c
48edje_player_CPPFLAGS = \
49-I$(top_srcdir)/src/bin \
50-I$(top_srcdir)/src/lib \
51@EDJE_PLAYER_CFLAGS@ @EVIL_CFLAGS@
52edje_player_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_PLAYER_LIBS@ @EVIL_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@
53edje_player_LDFLAGS = @lt_enable_auto_import@
54
55edje_inspector_SOURCES = edje_inspector.c
56edje_inspector_CPPFLAGS = \
57-I$(top_srcdir)/src/bin \
58-I$(top_srcdir)/src/lib \
59@EDJE_INSPECTOR_CFLAGS@
60edje_inspector_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_INSPECTOR_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@
61edje_inspector_LDFLAGS = @lt_enable_auto_import@
62
63edje_external_inspector_SOURCES = edje_external_inspector.c
64edje_external_inspector_CPPFLAGS = \
65-I$(top_srcdir)/src/bin \
66-I$(top_srcdir)/src/lib \
67@EDJE_EXTERNAL_INSPECTOR_CFLAGS@
68edje_external_inspector_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_EXTERNAL_INSPECTOR_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@
69edje_external_inspector_LDFLAGS = @lt_enable_auto_import@
70
71EXTRA_DIST = @EDJE_RECC_PRG@ edje_cc.h edje_convert.h edje_convert.c edje_multisense_convert.h edje_data_convert.c
72EXTRA_SCRIPTS = edje_recc
diff --git a/libraries/edje/src/bin/Makefile.in b/libraries/edje/src/bin/Makefile.in
new file mode 100644
index 0000000..877bcb2
--- /dev/null
+++ b/libraries/edje/src/bin/Makefile.in
@@ -0,0 +1,1149 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18
19VPATH = @srcdir@
20pkgdatadir = $(datadir)/@PACKAGE@
21pkgincludedir = $(includedir)/@PACKAGE@
22pkglibdir = $(libdir)/@PACKAGE@
23pkglibexecdir = $(libexecdir)/@PACKAGE@
24am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
25install_sh_DATA = $(install_sh) -c -m 644
26install_sh_PROGRAM = $(install_sh) -c
27install_sh_SCRIPT = $(install_sh) -c
28INSTALL_HEADER = $(INSTALL_DATA)
29transform = $(program_transform_name)
30NORMAL_INSTALL = :
31PRE_INSTALL = :
32POST_INSTALL = :
33NORMAL_UNINSTALL = :
34PRE_UNINSTALL = :
35POST_UNINSTALL = :
36build_triplet = @build@
37host_triplet = @host@
38EXTRA_PROGRAMS = edje_cc$(EXEEXT) edje_decc$(EXEEXT) \
39 edje_player$(EXEEXT) edje_inspector$(EXEEXT) \
40 edje_external_inspector$(EXEEXT)
41subdir = src/bin
42DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
43ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
44am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
45 $(top_srcdir)/m4/efl_binary.m4 \
46 $(top_srcdir)/m4/efl_coverage.m4 \
47 $(top_srcdir)/m4/efl_doxygen.m4 \
48 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
49 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
50 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
51 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
52am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
53 $(ACLOCAL_M4)
54mkinstalldirs = $(install_sh) -d
55CONFIG_HEADER = $(top_builddir)/config.h
56CONFIG_CLEAN_FILES =
57CONFIG_CLEAN_VPATH_FILES =
58am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"
59PROGRAMS = $(bin_PROGRAMS)
60am_edje_cc_OBJECTS = edje_cc-edje_cc.$(OBJEXT) \
61 edje_cc-edje_cc_out.$(OBJEXT) edje_cc-edje_cc_parse.$(OBJEXT) \
62 edje_cc-edje_cc_mem.$(OBJEXT) \
63 edje_cc-edje_cc_handlers.$(OBJEXT) \
64 edje_cc-edje_cc_sources.$(OBJEXT) \
65 edje_cc-edje_multisense_convert.$(OBJEXT)
66edje_cc_OBJECTS = $(am_edje_cc_OBJECTS)
67edje_cc_DEPENDENCIES = $(top_builddir)/src/lib/libedje.la
68AM_V_lt = $(am__v_lt_$(V))
69am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
70am__v_lt_0 = --silent
71edje_cc_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
72 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
73 $(edje_cc_LDFLAGS) $(LDFLAGS) -o $@
74am_edje_decc_OBJECTS = edje_decc-edje_decc.$(OBJEXT) \
75 edje_decc-edje_cc_mem.$(OBJEXT) \
76 edje_decc-edje_cc_sources.$(OBJEXT)
77edje_decc_OBJECTS = $(am_edje_decc_OBJECTS)
78edje_decc_DEPENDENCIES = $(top_builddir)/src/lib/libedje.la
79edje_decc_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
80 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
81 $(edje_decc_LDFLAGS) $(LDFLAGS) -o $@
82am_edje_external_inspector_OBJECTS = \
83 edje_external_inspector-edje_external_inspector.$(OBJEXT)
84edje_external_inspector_OBJECTS = \
85 $(am_edje_external_inspector_OBJECTS)
86edje_external_inspector_DEPENDENCIES = \
87 $(top_builddir)/src/lib/libedje.la
88edje_external_inspector_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
89 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
90 $(AM_CFLAGS) $(CFLAGS) $(edje_external_inspector_LDFLAGS) \
91 $(LDFLAGS) -o $@
92am_edje_inspector_OBJECTS = edje_inspector-edje_inspector.$(OBJEXT)
93edje_inspector_OBJECTS = $(am_edje_inspector_OBJECTS)
94edje_inspector_DEPENDENCIES = $(top_builddir)/src/lib/libedje.la
95edje_inspector_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
96 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
97 $(AM_CFLAGS) $(CFLAGS) $(edje_inspector_LDFLAGS) $(LDFLAGS) -o \
98 $@
99am_edje_player_OBJECTS = edje_player-edje_player.$(OBJEXT)
100edje_player_OBJECTS = $(am_edje_player_OBJECTS)
101edje_player_DEPENDENCIES = $(top_builddir)/src/lib/libedje.la
102edje_player_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
103 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
104 $(edje_player_LDFLAGS) $(LDFLAGS) -o $@
105am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
106am__vpath_adj = case $$p in \
107 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
108 *) f=$$p;; \
109 esac;
110am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
111am__install_max = 40
112am__nobase_strip_setup = \
113 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
114am__nobase_strip = \
115 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
116am__nobase_list = $(am__nobase_strip_setup); \
117 for p in $$list; do echo "$$p $$p"; done | \
118 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
119 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
120 if (++n[$$2] == $(am__install_max)) \
121 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
122 END { for (dir in files) print dir, files[dir] }'
123am__base_list = \
124 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
125 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
126SCRIPTS = $(bin_SCRIPTS)
127DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
128depcomp = $(SHELL) $(top_srcdir)/depcomp
129am__depfiles_maybe = depfiles
130am__mv = mv -f
131COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
132 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
133LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
134 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
135 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
136 $(AM_CFLAGS) $(CFLAGS)
137AM_V_CC = $(am__v_CC_$(V))
138am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
139am__v_CC_0 = @echo " CC " $@;
140AM_V_at = $(am__v_at_$(V))
141am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
142am__v_at_0 = @
143CCLD = $(CC)
144LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
145 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
146 $(AM_LDFLAGS) $(LDFLAGS) -o $@
147AM_V_CCLD = $(am__v_CCLD_$(V))
148am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
149am__v_CCLD_0 = @echo " CCLD " $@;
150AM_V_GEN = $(am__v_GEN_$(V))
151am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
152am__v_GEN_0 = @echo " GEN " $@;
153SOURCES = $(edje_cc_SOURCES) $(edje_decc_SOURCES) \
154 $(edje_external_inspector_SOURCES) $(edje_inspector_SOURCES) \
155 $(edje_player_SOURCES)
156DIST_SOURCES = $(edje_cc_SOURCES) $(edje_decc_SOURCES) \
157 $(edje_external_inspector_SOURCES) $(edje_inspector_SOURCES) \
158 $(edje_player_SOURCES)
159RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
160 html-recursive info-recursive install-data-recursive \
161 install-dvi-recursive install-exec-recursive \
162 install-html-recursive install-info-recursive \
163 install-pdf-recursive install-ps-recursive install-recursive \
164 installcheck-recursive installdirs-recursive pdf-recursive \
165 ps-recursive uninstall-recursive
166RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
167 distclean-recursive maintainer-clean-recursive
168AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
169 $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
170 distdir
171ETAGS = etags
172CTAGS = ctags
173DIST_SUBDIRS = epp
174DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
175am__relativize = \
176 dir0=`pwd`; \
177 sed_first='s,^\([^/]*\)/.*$$,\1,'; \
178 sed_rest='s,^[^/]*/*,,'; \
179 sed_last='s,^.*/\([^/]*\)$$,\1,'; \
180 sed_butlast='s,/*[^/]*$$,,'; \
181 while test -n "$$dir1"; do \
182 first=`echo "$$dir1" | sed -e "$$sed_first"`; \
183 if test "$$first" != "."; then \
184 if test "$$first" = ".."; then \
185 dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
186 dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
187 else \
188 first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
189 if test "$$first2" = "$$first"; then \
190 dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
191 else \
192 dir2="../$$dir2"; \
193 fi; \
194 dir0="$$dir0"/"$$first"; \
195 fi; \
196 fi; \
197 dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
198 done; \
199 reldir="$$dir2"
200ACLOCAL = @ACLOCAL@
201ALLOCA = @ALLOCA@
202ALSA_CFLAGS = @ALSA_CFLAGS@
203ALSA_LIBS = @ALSA_LIBS@
204AMTAR = @AMTAR@
205AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
206AR = @AR@
207AS = @AS@
208AUTOCONF = @AUTOCONF@
209AUTOHEADER = @AUTOHEADER@
210AUTOMAKE = @AUTOMAKE@
211AWK = @AWK@
212CC = @CC@
213CCDEPMODE = @CCDEPMODE@
214CFLAGS = @CFLAGS@
215CHECK_CFLAGS = @CHECK_CFLAGS@
216CHECK_LIBS = @CHECK_LIBS@
217CPP = @CPP@
218CPPFLAGS = @CPPFLAGS@
219CYGPATH_W = @CYGPATH_W@
220DEFS = @DEFS@
221DEPDIR = @DEPDIR@
222DLLTOOL = @DLLTOOL@
223DSYMUTIL = @DSYMUTIL@
224DUMPBIN = @DUMPBIN@
225ECHO_C = @ECHO_C@
226ECHO_N = @ECHO_N@
227ECHO_T = @ECHO_T@
228ECORE_IMF_CFLAGS = @ECORE_IMF_CFLAGS@
229ECORE_IMF_LIBS = @ECORE_IMF_LIBS@
230EDJE_CC_CFLAGS = @EDJE_CC_CFLAGS@
231EDJE_CC_LIBS = @EDJE_CC_LIBS@
232EDJE_CC_PRG = @EDJE_CC_PRG@
233EDJE_CFLAGS = @EDJE_CFLAGS@
234EDJE_DECC_CFLAGS = @EDJE_DECC_CFLAGS@
235EDJE_DECC_LIBS = @EDJE_DECC_LIBS@
236EDJE_DECC_PRG = @EDJE_DECC_PRG@
237EDJE_EXTERNAL_INSPECTOR_CFLAGS = @EDJE_EXTERNAL_INSPECTOR_CFLAGS@
238EDJE_EXTERNAL_INSPECTOR_LIBS = @EDJE_EXTERNAL_INSPECTOR_LIBS@
239EDJE_EXTERNAL_INSPECTOR_PRG = @EDJE_EXTERNAL_INSPECTOR_PRG@
240EDJE_INSPECTOR_CFLAGS = @EDJE_INSPECTOR_CFLAGS@
241EDJE_INSPECTOR_LIBS = @EDJE_INSPECTOR_LIBS@
242EDJE_INSPECTOR_PRG = @EDJE_INSPECTOR_PRG@
243EDJE_LIBS = @EDJE_LIBS@
244EDJE_PLAYER_CFLAGS = @EDJE_PLAYER_CFLAGS@
245EDJE_PLAYER_LIBS = @EDJE_PLAYER_LIBS@
246EDJE_PLAYER_PRG = @EDJE_PLAYER_PRG@
247EDJE_RECC_PRG = @EDJE_RECC_PRG@
248EFL_COVERAGE_CFLAGS = @EFL_COVERAGE_CFLAGS@
249EFL_COVERAGE_LIBS = @EFL_COVERAGE_LIBS@
250EFL_EDJE_BUILD = @EFL_EDJE_BUILD@
251EGREP = @EGREP@
252EVIL_CFLAGS = @EVIL_CFLAGS@
253EVIL_LIBS = @EVIL_LIBS@
254EXEEXT = @EXEEXT@
255FGREP = @FGREP@
256FLAC_CFLAGS = @FLAC_CFLAGS@
257FLAC_LIBS = @FLAC_LIBS@
258GREP = @GREP@
259INSTALL = @INSTALL@
260INSTALL_DATA = @INSTALL_DATA@
261INSTALL_PROGRAM = @INSTALL_PROGRAM@
262INSTALL_SCRIPT = @INSTALL_SCRIPT@
263INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
264LD = @LD@
265LDFLAGS = @LDFLAGS@
266LIBOBJS = @LIBOBJS@
267LIBS = @LIBS@
268LIBTOOL = @LIBTOOL@
269LIPO = @LIPO@
270LN_S = @LN_S@
271LTLIBOBJS = @LTLIBOBJS@
272LUA_CFLAGS = @LUA_CFLAGS@
273LUA_LIBS = @LUA_LIBS@
274MAKEINFO = @MAKEINFO@
275MINIMAL_CFLAGS = @MINIMAL_CFLAGS@
276MINIMAL_LIBS = @MINIMAL_LIBS@
277MKDIR_P = @MKDIR_P@
278MODULE_ARCH = @MODULE_ARCH@
279NM = @NM@
280NMEDIT = @NMEDIT@
281OBJDUMP = @OBJDUMP@
282OBJEXT = @OBJEXT@
283OTOOL = @OTOOL@
284OTOOL64 = @OTOOL64@
285PACKAGE = @PACKAGE@
286PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
287PACKAGE_NAME = @PACKAGE_NAME@
288PACKAGE_STRING = @PACKAGE_STRING@
289PACKAGE_TARNAME = @PACKAGE_TARNAME@
290PACKAGE_URL = @PACKAGE_URL@
291PACKAGE_VERSION = @PACKAGE_VERSION@
292PATH_SEPARATOR = @PATH_SEPARATOR@
293PKG_CONFIG = @PKG_CONFIG@
294PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
295PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
296PYTHON = @PYTHON@
297PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
298PYTHON_PLATFORM = @PYTHON_PLATFORM@
299PYTHON_PREFIX = @PYTHON_PREFIX@
300PYTHON_VERSION = @PYTHON_VERSION@
301RANLIB = @RANLIB@
302REMIX_CFLAGS = @REMIX_CFLAGS@
303REMIX_LIBS = @REMIX_LIBS@
304REMIX_PLUGIN_DIR = @REMIX_PLUGIN_DIR@
305SED = @SED@
306SET_MAKE = @SET_MAKE@
307SHELL = @SHELL@
308SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
309SNDFILE_LIBS = @SNDFILE_LIBS@
310STRIP = @STRIP@
311VERSION = @VERSION@
312VMAJ = @VMAJ@
313VORBISENC_CFLAGS = @VORBISENC_CFLAGS@
314VORBISENC_LIBS = @VORBISENC_LIBS@
315abs_builddir = @abs_builddir@
316abs_srcdir = @abs_srcdir@
317abs_top_builddir = @abs_top_builddir@
318abs_top_srcdir = @abs_top_srcdir@
319ac_ct_CC = @ac_ct_CC@
320ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
321am__include = @am__include@
322am__leading_dot = @am__leading_dot@
323am__quote = @am__quote@
324am__tar = @am__tar@
325am__untar = @am__untar@
326bindir = @bindir@
327build = @build@
328build_alias = @build_alias@
329build_cpu = @build_cpu@
330build_os = @build_os@
331build_vendor = @build_vendor@
332builddir = @builddir@
333datadir = @datadir@
334datarootdir = @datarootdir@
335docdir = @docdir@
336dvidir = @dvidir@
337edje_cc = @edje_cc@
338efl_doxygen = @efl_doxygen@
339efl_have_doxygen = @efl_have_doxygen@
340exec_prefix = @exec_prefix@
341have_lcov = @have_lcov@
342host = @host@
343host_alias = @host_alias@
344host_cpu = @host_cpu@
345host_os = @host_os@
346host_vendor = @host_vendor@
347htmldir = @htmldir@
348includedir = @includedir@
349infodir = @infodir@
350install_sh = @install_sh@
351libdir = @libdir@
352libexecdir = @libexecdir@
353localedir = @localedir@
354localstatedir = @localstatedir@
355lt_ECHO = @lt_ECHO@
356lt_enable_auto_import = @lt_enable_auto_import@
357lua_libs = @lua_libs@
358mandir = @mandir@
359mkdir_p = @mkdir_p@
360oldincludedir = @oldincludedir@
361pdfdir = @pdfdir@
362pkgconfig_requires_private = @pkgconfig_requires_private@
363pkgpyexecdir = @pkgpyexecdir@
364pkgpythondir = @pkgpythondir@
365prefix = @prefix@
366program_transform_name = @program_transform_name@
367psdir = @psdir@
368pyexecdir = @pyexecdir@
369pythondir = @pythondir@
370release_info = @release_info@
371requirement_edje = @requirement_edje@
372sbindir = @sbindir@
373sharedstatedir = @sharedstatedir@
374srcdir = @srcdir@
375sysconfdir = @sysconfdir@
376target_alias = @target_alias@
377top_build_prefix = @top_build_prefix@
378top_builddir = @top_builddir@
379top_srcdir = @top_srcdir@
380version_info = @version_info@
381vimdir = @vimdir@
382MAINTAINERCLEANFILES = Makefile.in
383@BUILD_EPP_TRUE@SUBDIRS = epp
384bin_SCRIPTS = @EDJE_RECC_PRG@
385bin_PROGRAMS = @EDJE_CC_PRG@ @EDJE_DECC_PRG@ @EDJE_PLAYER_PRG@ @EDJE_INSPECTOR_PRG@ @EDJE_EXTERNAL_INSPECTOR_PRG@
386edje_cc_SOURCES = \
387edje_cc.c \
388edje_cc_out.c \
389edje_cc_parse.c \
390edje_cc_mem.c \
391edje_cc_handlers.c \
392edje_cc_sources.c \
393edje_multisense_convert.c
394
395edje_cc_CPPFLAGS = \
396-I$(top_srcdir)/src/bin \
397-I$(top_srcdir)/src/lib \
398-DPACKAGE_BIN_DIR=\"$(bindir)\" \
399-DPACKAGE_LIB_DIR=\"$(libdir)\" \
400-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
401-DEPP_DIR=\"$(libdir)/$(PACKAGE)/utils\" \
402@EDJE_CFLAGS@ @EDJE_CC_CFLAGS@ @EVIL_CFLAGS@ @SNDFILE_CFLAGS@
403
404edje_cc_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_CC_LIBS@ @EVIL_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@ -lm
405edje_cc_LDFLAGS = @lt_enable_auto_import@
406edje_decc_SOURCES = \
407edje_decc.c \
408edje_decc.h \
409edje_cc_mem.c \
410edje_cc_sources.c
411
412edje_decc_CPPFLAGS = \
413-I$(top_srcdir)/src/bin \
414-I$(top_srcdir)/src/lib \
415@EDJE_CFLAGS@ @EDJE_DECC_CFLAGS@ @EVIL_CFLAGS@
416
417edje_decc_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_DECC_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@
418edje_decc_LDFLAGS = @lt_enable_auto_import@
419edje_player_SOURCES = edje_player.c
420edje_player_CPPFLAGS = \
421-I$(top_srcdir)/src/bin \
422-I$(top_srcdir)/src/lib \
423@EDJE_PLAYER_CFLAGS@ @EVIL_CFLAGS@
424
425edje_player_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_PLAYER_LIBS@ @EVIL_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@
426edje_player_LDFLAGS = @lt_enable_auto_import@
427edje_inspector_SOURCES = edje_inspector.c
428edje_inspector_CPPFLAGS = \
429-I$(top_srcdir)/src/bin \
430-I$(top_srcdir)/src/lib \
431@EDJE_INSPECTOR_CFLAGS@
432
433edje_inspector_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_INSPECTOR_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@
434edje_inspector_LDFLAGS = @lt_enable_auto_import@
435edje_external_inspector_SOURCES = edje_external_inspector.c
436edje_external_inspector_CPPFLAGS = \
437-I$(top_srcdir)/src/bin \
438-I$(top_srcdir)/src/lib \
439@EDJE_EXTERNAL_INSPECTOR_CFLAGS@
440
441edje_external_inspector_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_EXTERNAL_INSPECTOR_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@
442edje_external_inspector_LDFLAGS = @lt_enable_auto_import@
443EXTRA_DIST = @EDJE_RECC_PRG@ edje_cc.h edje_convert.h edje_convert.c edje_multisense_convert.h edje_data_convert.c
444EXTRA_SCRIPTS = edje_recc
445all: all-recursive
446
447.SUFFIXES:
448.SUFFIXES: .c .lo .o .obj
449$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
450 @for dep in $?; do \
451 case '$(am__configure_deps)' in \
452 *$$dep*) \
453 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
454 && { if test -f $@; then exit 0; else break; fi; }; \
455 exit 1;; \
456 esac; \
457 done; \
458 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/bin/Makefile'; \
459 $(am__cd) $(top_srcdir) && \
460 $(AUTOMAKE) --gnu src/bin/Makefile
461.PRECIOUS: Makefile
462Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
463 @case '$?' in \
464 *config.status*) \
465 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
466 *) \
467 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
468 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
469 esac;
470
471$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
472 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
473
474$(top_srcdir)/configure: $(am__configure_deps)
475 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
476$(ACLOCAL_M4): $(am__aclocal_m4_deps)
477 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
478$(am__aclocal_m4_deps):
479install-binPROGRAMS: $(bin_PROGRAMS)
480 @$(NORMAL_INSTALL)
481 test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
482 @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
483 for p in $$list; do echo "$$p $$p"; done | \
484 sed 's/$(EXEEXT)$$//' | \
485 while read p p1; do if test -f $$p || test -f $$p1; \
486 then echo "$$p"; echo "$$p"; else :; fi; \
487 done | \
488 sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
489 -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
490 sed 'N;N;N;s,\n, ,g' | \
491 $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
492 { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
493 if ($$2 == $$4) files[d] = files[d] " " $$1; \
494 else { print "f", $$3 "/" $$4, $$1; } } \
495 END { for (d in files) print "f", d, files[d] }' | \
496 while read type dir files; do \
497 if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
498 test -z "$$files" || { \
499 echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
500 $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
501 } \
502 ; done
503
504uninstall-binPROGRAMS:
505 @$(NORMAL_UNINSTALL)
506 @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
507 files=`for p in $$list; do echo "$$p"; done | \
508 sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
509 -e 's/$$/$(EXEEXT)/' `; \
510 test -n "$$list" || exit 0; \
511 echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
512 cd "$(DESTDIR)$(bindir)" && rm -f $$files
513
514clean-binPROGRAMS:
515 @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
516 echo " rm -f" $$list; \
517 rm -f $$list || exit $$?; \
518 test -n "$(EXEEXT)" || exit 0; \
519 list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
520 echo " rm -f" $$list; \
521 rm -f $$list
522edje_cc$(EXEEXT): $(edje_cc_OBJECTS) $(edje_cc_DEPENDENCIES)
523 @rm -f edje_cc$(EXEEXT)
524 $(AM_V_CCLD)$(edje_cc_LINK) $(edje_cc_OBJECTS) $(edje_cc_LDADD) $(LIBS)
525edje_decc$(EXEEXT): $(edje_decc_OBJECTS) $(edje_decc_DEPENDENCIES)
526 @rm -f edje_decc$(EXEEXT)
527 $(AM_V_CCLD)$(edje_decc_LINK) $(edje_decc_OBJECTS) $(edje_decc_LDADD) $(LIBS)
528edje_external_inspector$(EXEEXT): $(edje_external_inspector_OBJECTS) $(edje_external_inspector_DEPENDENCIES)
529 @rm -f edje_external_inspector$(EXEEXT)
530 $(AM_V_CCLD)$(edje_external_inspector_LINK) $(edje_external_inspector_OBJECTS) $(edje_external_inspector_LDADD) $(LIBS)
531edje_inspector$(EXEEXT): $(edje_inspector_OBJECTS) $(edje_inspector_DEPENDENCIES)
532 @rm -f edje_inspector$(EXEEXT)
533 $(AM_V_CCLD)$(edje_inspector_LINK) $(edje_inspector_OBJECTS) $(edje_inspector_LDADD) $(LIBS)
534edje_player$(EXEEXT): $(edje_player_OBJECTS) $(edje_player_DEPENDENCIES)
535 @rm -f edje_player$(EXEEXT)
536 $(AM_V_CCLD)$(edje_player_LINK) $(edje_player_OBJECTS) $(edje_player_LDADD) $(LIBS)
537install-binSCRIPTS: $(bin_SCRIPTS)
538 @$(NORMAL_INSTALL)
539 test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
540 @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
541 for p in $$list; do \
542 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
543 if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
544 done | \
545 sed -e 'p;s,.*/,,;n' \
546 -e 'h;s|.*|.|' \
547 -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
548 $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
549 { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
550 if ($$2 == $$4) { files[d] = files[d] " " $$1; \
551 if (++n[d] == $(am__install_max)) { \
552 print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
553 else { print "f", d "/" $$4, $$1 } } \
554 END { for (d in files) print "f", d, files[d] }' | \
555 while read type dir files; do \
556 if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
557 test -z "$$files" || { \
558 echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
559 $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
560 } \
561 ; done
562
563uninstall-binSCRIPTS:
564 @$(NORMAL_UNINSTALL)
565 @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
566 files=`for p in $$list; do echo "$$p"; done | \
567 sed -e 's,.*/,,;$(transform)'`; \
568 test -n "$$list" || exit 0; \
569 echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
570 cd "$(DESTDIR)$(bindir)" && rm -f $$files
571
572mostlyclean-compile:
573 -rm -f *.$(OBJEXT)
574
575distclean-compile:
576 -rm -f *.tab.c
577
578@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_cc-edje_cc.Po@am__quote@
579@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_cc-edje_cc_handlers.Po@am__quote@
580@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_cc-edje_cc_mem.Po@am__quote@
581@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_cc-edje_cc_out.Po@am__quote@
582@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_cc-edje_cc_parse.Po@am__quote@
583@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_cc-edje_cc_sources.Po@am__quote@
584@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_cc-edje_multisense_convert.Po@am__quote@
585@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_decc-edje_cc_mem.Po@am__quote@
586@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_decc-edje_cc_sources.Po@am__quote@
587@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_decc-edje_decc.Po@am__quote@
588@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_external_inspector-edje_external_inspector.Po@am__quote@
589@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_inspector-edje_inspector.Po@am__quote@
590@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_player-edje_player.Po@am__quote@
591
592.c.o:
593@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
594@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
595@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
596@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
597@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
598@am__fastdepCC_FALSE@ $(COMPILE) -c $<
599
600.c.obj:
601@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
602@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
603@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
604@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
605@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
606@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
607
608.c.lo:
609@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
610@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
611@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
612@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
613@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
614@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
615
616edje_cc-edje_cc.o: edje_cc.c
617@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc.o -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc.Tpo -c -o edje_cc-edje_cc.o `test -f 'edje_cc.c' || echo '$(srcdir)/'`edje_cc.c
618@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc.Tpo $(DEPDIR)/edje_cc-edje_cc.Po
619@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
620@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc.c' object='edje_cc-edje_cc.o' libtool=no @AMDEPBACKSLASH@
621@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
622@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc.o `test -f 'edje_cc.c' || echo '$(srcdir)/'`edje_cc.c
623
624edje_cc-edje_cc.obj: edje_cc.c
625@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc.obj -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc.Tpo -c -o edje_cc-edje_cc.obj `if test -f 'edje_cc.c'; then $(CYGPATH_W) 'edje_cc.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc.c'; fi`
626@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc.Tpo $(DEPDIR)/edje_cc-edje_cc.Po
627@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
628@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc.c' object='edje_cc-edje_cc.obj' libtool=no @AMDEPBACKSLASH@
629@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
630@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc.obj `if test -f 'edje_cc.c'; then $(CYGPATH_W) 'edje_cc.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc.c'; fi`
631
632edje_cc-edje_cc_out.o: edje_cc_out.c
633@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc_out.o -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc_out.Tpo -c -o edje_cc-edje_cc_out.o `test -f 'edje_cc_out.c' || echo '$(srcdir)/'`edje_cc_out.c
634@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc_out.Tpo $(DEPDIR)/edje_cc-edje_cc_out.Po
635@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
636@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_out.c' object='edje_cc-edje_cc_out.o' libtool=no @AMDEPBACKSLASH@
637@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
638@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc_out.o `test -f 'edje_cc_out.c' || echo '$(srcdir)/'`edje_cc_out.c
639
640edje_cc-edje_cc_out.obj: edje_cc_out.c
641@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc_out.obj -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc_out.Tpo -c -o edje_cc-edje_cc_out.obj `if test -f 'edje_cc_out.c'; then $(CYGPATH_W) 'edje_cc_out.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_out.c'; fi`
642@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc_out.Tpo $(DEPDIR)/edje_cc-edje_cc_out.Po
643@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
644@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_out.c' object='edje_cc-edje_cc_out.obj' libtool=no @AMDEPBACKSLASH@
645@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
646@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc_out.obj `if test -f 'edje_cc_out.c'; then $(CYGPATH_W) 'edje_cc_out.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_out.c'; fi`
647
648edje_cc-edje_cc_parse.o: edje_cc_parse.c
649@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc_parse.o -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc_parse.Tpo -c -o edje_cc-edje_cc_parse.o `test -f 'edje_cc_parse.c' || echo '$(srcdir)/'`edje_cc_parse.c
650@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc_parse.Tpo $(DEPDIR)/edje_cc-edje_cc_parse.Po
651@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
652@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_parse.c' object='edje_cc-edje_cc_parse.o' libtool=no @AMDEPBACKSLASH@
653@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
654@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc_parse.o `test -f 'edje_cc_parse.c' || echo '$(srcdir)/'`edje_cc_parse.c
655
656edje_cc-edje_cc_parse.obj: edje_cc_parse.c
657@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc_parse.obj -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc_parse.Tpo -c -o edje_cc-edje_cc_parse.obj `if test -f 'edje_cc_parse.c'; then $(CYGPATH_W) 'edje_cc_parse.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_parse.c'; fi`
658@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc_parse.Tpo $(DEPDIR)/edje_cc-edje_cc_parse.Po
659@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
660@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_parse.c' object='edje_cc-edje_cc_parse.obj' libtool=no @AMDEPBACKSLASH@
661@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
662@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc_parse.obj `if test -f 'edje_cc_parse.c'; then $(CYGPATH_W) 'edje_cc_parse.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_parse.c'; fi`
663
664edje_cc-edje_cc_mem.o: edje_cc_mem.c
665@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc_mem.o -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc_mem.Tpo -c -o edje_cc-edje_cc_mem.o `test -f 'edje_cc_mem.c' || echo '$(srcdir)/'`edje_cc_mem.c
666@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc_mem.Tpo $(DEPDIR)/edje_cc-edje_cc_mem.Po
667@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
668@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_mem.c' object='edje_cc-edje_cc_mem.o' libtool=no @AMDEPBACKSLASH@
669@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
670@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc_mem.o `test -f 'edje_cc_mem.c' || echo '$(srcdir)/'`edje_cc_mem.c
671
672edje_cc-edje_cc_mem.obj: edje_cc_mem.c
673@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc_mem.obj -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc_mem.Tpo -c -o edje_cc-edje_cc_mem.obj `if test -f 'edje_cc_mem.c'; then $(CYGPATH_W) 'edje_cc_mem.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_mem.c'; fi`
674@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc_mem.Tpo $(DEPDIR)/edje_cc-edje_cc_mem.Po
675@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
676@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_mem.c' object='edje_cc-edje_cc_mem.obj' libtool=no @AMDEPBACKSLASH@
677@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
678@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc_mem.obj `if test -f 'edje_cc_mem.c'; then $(CYGPATH_W) 'edje_cc_mem.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_mem.c'; fi`
679
680edje_cc-edje_cc_handlers.o: edje_cc_handlers.c
681@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc_handlers.o -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc_handlers.Tpo -c -o edje_cc-edje_cc_handlers.o `test -f 'edje_cc_handlers.c' || echo '$(srcdir)/'`edje_cc_handlers.c
682@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc_handlers.Tpo $(DEPDIR)/edje_cc-edje_cc_handlers.Po
683@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
684@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_handlers.c' object='edje_cc-edje_cc_handlers.o' libtool=no @AMDEPBACKSLASH@
685@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
686@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc_handlers.o `test -f 'edje_cc_handlers.c' || echo '$(srcdir)/'`edje_cc_handlers.c
687
688edje_cc-edje_cc_handlers.obj: edje_cc_handlers.c
689@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc_handlers.obj -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc_handlers.Tpo -c -o edje_cc-edje_cc_handlers.obj `if test -f 'edje_cc_handlers.c'; then $(CYGPATH_W) 'edje_cc_handlers.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_handlers.c'; fi`
690@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc_handlers.Tpo $(DEPDIR)/edje_cc-edje_cc_handlers.Po
691@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
692@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_handlers.c' object='edje_cc-edje_cc_handlers.obj' libtool=no @AMDEPBACKSLASH@
693@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
694@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc_handlers.obj `if test -f 'edje_cc_handlers.c'; then $(CYGPATH_W) 'edje_cc_handlers.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_handlers.c'; fi`
695
696edje_cc-edje_cc_sources.o: edje_cc_sources.c
697@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc_sources.o -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc_sources.Tpo -c -o edje_cc-edje_cc_sources.o `test -f 'edje_cc_sources.c' || echo '$(srcdir)/'`edje_cc_sources.c
698@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc_sources.Tpo $(DEPDIR)/edje_cc-edje_cc_sources.Po
699@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
700@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_sources.c' object='edje_cc-edje_cc_sources.o' libtool=no @AMDEPBACKSLASH@
701@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
702@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc_sources.o `test -f 'edje_cc_sources.c' || echo '$(srcdir)/'`edje_cc_sources.c
703
704edje_cc-edje_cc_sources.obj: edje_cc_sources.c
705@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc_sources.obj -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc_sources.Tpo -c -o edje_cc-edje_cc_sources.obj `if test -f 'edje_cc_sources.c'; then $(CYGPATH_W) 'edje_cc_sources.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_sources.c'; fi`
706@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc_sources.Tpo $(DEPDIR)/edje_cc-edje_cc_sources.Po
707@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
708@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_sources.c' object='edje_cc-edje_cc_sources.obj' libtool=no @AMDEPBACKSLASH@
709@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
710@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc_sources.obj `if test -f 'edje_cc_sources.c'; then $(CYGPATH_W) 'edje_cc_sources.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_sources.c'; fi`
711
712edje_cc-edje_multisense_convert.o: edje_multisense_convert.c
713@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_multisense_convert.o -MD -MP -MF $(DEPDIR)/edje_cc-edje_multisense_convert.Tpo -c -o edje_cc-edje_multisense_convert.o `test -f 'edje_multisense_convert.c' || echo '$(srcdir)/'`edje_multisense_convert.c
714@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_multisense_convert.Tpo $(DEPDIR)/edje_cc-edje_multisense_convert.Po
715@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
716@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_multisense_convert.c' object='edje_cc-edje_multisense_convert.o' libtool=no @AMDEPBACKSLASH@
717@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
718@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_multisense_convert.o `test -f 'edje_multisense_convert.c' || echo '$(srcdir)/'`edje_multisense_convert.c
719
720edje_cc-edje_multisense_convert.obj: edje_multisense_convert.c
721@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_multisense_convert.obj -MD -MP -MF $(DEPDIR)/edje_cc-edje_multisense_convert.Tpo -c -o edje_cc-edje_multisense_convert.obj `if test -f 'edje_multisense_convert.c'; then $(CYGPATH_W) 'edje_multisense_convert.c'; else $(CYGPATH_W) '$(srcdir)/edje_multisense_convert.c'; fi`
722@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_multisense_convert.Tpo $(DEPDIR)/edje_cc-edje_multisense_convert.Po
723@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
724@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_multisense_convert.c' object='edje_cc-edje_multisense_convert.obj' libtool=no @AMDEPBACKSLASH@
725@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
726@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_multisense_convert.obj `if test -f 'edje_multisense_convert.c'; then $(CYGPATH_W) 'edje_multisense_convert.c'; else $(CYGPATH_W) '$(srcdir)/edje_multisense_convert.c'; fi`
727
728edje_decc-edje_decc.o: edje_decc.c
729@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_decc-edje_decc.o -MD -MP -MF $(DEPDIR)/edje_decc-edje_decc.Tpo -c -o edje_decc-edje_decc.o `test -f 'edje_decc.c' || echo '$(srcdir)/'`edje_decc.c
730@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_decc-edje_decc.Tpo $(DEPDIR)/edje_decc-edje_decc.Po
731@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
732@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_decc.c' object='edje_decc-edje_decc.o' libtool=no @AMDEPBACKSLASH@
733@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
734@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_decc-edje_decc.o `test -f 'edje_decc.c' || echo '$(srcdir)/'`edje_decc.c
735
736edje_decc-edje_decc.obj: edje_decc.c
737@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_decc-edje_decc.obj -MD -MP -MF $(DEPDIR)/edje_decc-edje_decc.Tpo -c -o edje_decc-edje_decc.obj `if test -f 'edje_decc.c'; then $(CYGPATH_W) 'edje_decc.c'; else $(CYGPATH_W) '$(srcdir)/edje_decc.c'; fi`
738@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_decc-edje_decc.Tpo $(DEPDIR)/edje_decc-edje_decc.Po
739@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
740@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_decc.c' object='edje_decc-edje_decc.obj' libtool=no @AMDEPBACKSLASH@
741@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
742@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_decc-edje_decc.obj `if test -f 'edje_decc.c'; then $(CYGPATH_W) 'edje_decc.c'; else $(CYGPATH_W) '$(srcdir)/edje_decc.c'; fi`
743
744edje_decc-edje_cc_mem.o: edje_cc_mem.c
745@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_decc-edje_cc_mem.o -MD -MP -MF $(DEPDIR)/edje_decc-edje_cc_mem.Tpo -c -o edje_decc-edje_cc_mem.o `test -f 'edje_cc_mem.c' || echo '$(srcdir)/'`edje_cc_mem.c
746@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_decc-edje_cc_mem.Tpo $(DEPDIR)/edje_decc-edje_cc_mem.Po
747@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
748@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_mem.c' object='edje_decc-edje_cc_mem.o' libtool=no @AMDEPBACKSLASH@
749@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
750@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_decc-edje_cc_mem.o `test -f 'edje_cc_mem.c' || echo '$(srcdir)/'`edje_cc_mem.c
751
752edje_decc-edje_cc_mem.obj: edje_cc_mem.c
753@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_decc-edje_cc_mem.obj -MD -MP -MF $(DEPDIR)/edje_decc-edje_cc_mem.Tpo -c -o edje_decc-edje_cc_mem.obj `if test -f 'edje_cc_mem.c'; then $(CYGPATH_W) 'edje_cc_mem.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_mem.c'; fi`
754@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_decc-edje_cc_mem.Tpo $(DEPDIR)/edje_decc-edje_cc_mem.Po
755@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
756@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_mem.c' object='edje_decc-edje_cc_mem.obj' libtool=no @AMDEPBACKSLASH@
757@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
758@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_decc-edje_cc_mem.obj `if test -f 'edje_cc_mem.c'; then $(CYGPATH_W) 'edje_cc_mem.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_mem.c'; fi`
759
760edje_decc-edje_cc_sources.o: edje_cc_sources.c
761@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_decc-edje_cc_sources.o -MD -MP -MF $(DEPDIR)/edje_decc-edje_cc_sources.Tpo -c -o edje_decc-edje_cc_sources.o `test -f 'edje_cc_sources.c' || echo '$(srcdir)/'`edje_cc_sources.c
762@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_decc-edje_cc_sources.Tpo $(DEPDIR)/edje_decc-edje_cc_sources.Po
763@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
764@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_sources.c' object='edje_decc-edje_cc_sources.o' libtool=no @AMDEPBACKSLASH@
765@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
766@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_decc-edje_cc_sources.o `test -f 'edje_cc_sources.c' || echo '$(srcdir)/'`edje_cc_sources.c
767
768edje_decc-edje_cc_sources.obj: edje_cc_sources.c
769@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_decc-edje_cc_sources.obj -MD -MP -MF $(DEPDIR)/edje_decc-edje_cc_sources.Tpo -c -o edje_decc-edje_cc_sources.obj `if test -f 'edje_cc_sources.c'; then $(CYGPATH_W) 'edje_cc_sources.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_sources.c'; fi`
770@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_decc-edje_cc_sources.Tpo $(DEPDIR)/edje_decc-edje_cc_sources.Po
771@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
772@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_sources.c' object='edje_decc-edje_cc_sources.obj' libtool=no @AMDEPBACKSLASH@
773@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
774@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_decc-edje_cc_sources.obj `if test -f 'edje_cc_sources.c'; then $(CYGPATH_W) 'edje_cc_sources.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_sources.c'; fi`
775
776edje_external_inspector-edje_external_inspector.o: edje_external_inspector.c
777@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_external_inspector_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_external_inspector-edje_external_inspector.o -MD -MP -MF $(DEPDIR)/edje_external_inspector-edje_external_inspector.Tpo -c -o edje_external_inspector-edje_external_inspector.o `test -f 'edje_external_inspector.c' || echo '$(srcdir)/'`edje_external_inspector.c
778@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_external_inspector-edje_external_inspector.Tpo $(DEPDIR)/edje_external_inspector-edje_external_inspector.Po
779@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
780@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_external_inspector.c' object='edje_external_inspector-edje_external_inspector.o' libtool=no @AMDEPBACKSLASH@
781@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
782@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_external_inspector_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_external_inspector-edje_external_inspector.o `test -f 'edje_external_inspector.c' || echo '$(srcdir)/'`edje_external_inspector.c
783
784edje_external_inspector-edje_external_inspector.obj: edje_external_inspector.c
785@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_external_inspector_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_external_inspector-edje_external_inspector.obj -MD -MP -MF $(DEPDIR)/edje_external_inspector-edje_external_inspector.Tpo -c -o edje_external_inspector-edje_external_inspector.obj `if test -f 'edje_external_inspector.c'; then $(CYGPATH_W) 'edje_external_inspector.c'; else $(CYGPATH_W) '$(srcdir)/edje_external_inspector.c'; fi`
786@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_external_inspector-edje_external_inspector.Tpo $(DEPDIR)/edje_external_inspector-edje_external_inspector.Po
787@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
788@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_external_inspector.c' object='edje_external_inspector-edje_external_inspector.obj' libtool=no @AMDEPBACKSLASH@
789@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
790@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_external_inspector_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_external_inspector-edje_external_inspector.obj `if test -f 'edje_external_inspector.c'; then $(CYGPATH_W) 'edje_external_inspector.c'; else $(CYGPATH_W) '$(srcdir)/edje_external_inspector.c'; fi`
791
792edje_inspector-edje_inspector.o: edje_inspector.c
793@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_inspector_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_inspector-edje_inspector.o -MD -MP -MF $(DEPDIR)/edje_inspector-edje_inspector.Tpo -c -o edje_inspector-edje_inspector.o `test -f 'edje_inspector.c' || echo '$(srcdir)/'`edje_inspector.c
794@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_inspector-edje_inspector.Tpo $(DEPDIR)/edje_inspector-edje_inspector.Po
795@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
796@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_inspector.c' object='edje_inspector-edje_inspector.o' libtool=no @AMDEPBACKSLASH@
797@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
798@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_inspector_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_inspector-edje_inspector.o `test -f 'edje_inspector.c' || echo '$(srcdir)/'`edje_inspector.c
799
800edje_inspector-edje_inspector.obj: edje_inspector.c
801@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_inspector_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_inspector-edje_inspector.obj -MD -MP -MF $(DEPDIR)/edje_inspector-edje_inspector.Tpo -c -o edje_inspector-edje_inspector.obj `if test -f 'edje_inspector.c'; then $(CYGPATH_W) 'edje_inspector.c'; else $(CYGPATH_W) '$(srcdir)/edje_inspector.c'; fi`
802@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_inspector-edje_inspector.Tpo $(DEPDIR)/edje_inspector-edje_inspector.Po
803@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
804@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_inspector.c' object='edje_inspector-edje_inspector.obj' libtool=no @AMDEPBACKSLASH@
805@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
806@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_inspector_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_inspector-edje_inspector.obj `if test -f 'edje_inspector.c'; then $(CYGPATH_W) 'edje_inspector.c'; else $(CYGPATH_W) '$(srcdir)/edje_inspector.c'; fi`
807
808edje_player-edje_player.o: edje_player.c
809@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_player_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_player-edje_player.o -MD -MP -MF $(DEPDIR)/edje_player-edje_player.Tpo -c -o edje_player-edje_player.o `test -f 'edje_player.c' || echo '$(srcdir)/'`edje_player.c
810@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_player-edje_player.Tpo $(DEPDIR)/edje_player-edje_player.Po
811@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
812@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_player.c' object='edje_player-edje_player.o' libtool=no @AMDEPBACKSLASH@
813@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
814@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_player_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_player-edje_player.o `test -f 'edje_player.c' || echo '$(srcdir)/'`edje_player.c
815
816edje_player-edje_player.obj: edje_player.c
817@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_player_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_player-edje_player.obj -MD -MP -MF $(DEPDIR)/edje_player-edje_player.Tpo -c -o edje_player-edje_player.obj `if test -f 'edje_player.c'; then $(CYGPATH_W) 'edje_player.c'; else $(CYGPATH_W) '$(srcdir)/edje_player.c'; fi`
818@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_player-edje_player.Tpo $(DEPDIR)/edje_player-edje_player.Po
819@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
820@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_player.c' object='edje_player-edje_player.obj' libtool=no @AMDEPBACKSLASH@
821@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
822@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_player_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_player-edje_player.obj `if test -f 'edje_player.c'; then $(CYGPATH_W) 'edje_player.c'; else $(CYGPATH_W) '$(srcdir)/edje_player.c'; fi`
823
824mostlyclean-libtool:
825 -rm -f *.lo
826
827clean-libtool:
828 -rm -rf .libs _libs
829
830# This directory's subdirectories are mostly independent; you can cd
831# into them and run `make' without going through this Makefile.
832# To change the values of `make' variables: instead of editing Makefiles,
833# (1) if the variable is set in `config.status', edit `config.status'
834# (which will cause the Makefiles to be regenerated when you run `make');
835# (2) otherwise, pass the desired values on the `make' command line.
836$(RECURSIVE_TARGETS):
837 @fail= failcom='exit 1'; \
838 for f in x $$MAKEFLAGS; do \
839 case $$f in \
840 *=* | --[!k]*);; \
841 *k*) failcom='fail=yes';; \
842 esac; \
843 done; \
844 dot_seen=no; \
845 target=`echo $@ | sed s/-recursive//`; \
846 list='$(SUBDIRS)'; for subdir in $$list; do \
847 echo "Making $$target in $$subdir"; \
848 if test "$$subdir" = "."; then \
849 dot_seen=yes; \
850 local_target="$$target-am"; \
851 else \
852 local_target="$$target"; \
853 fi; \
854 ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
855 || eval $$failcom; \
856 done; \
857 if test "$$dot_seen" = "no"; then \
858 $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
859 fi; test -z "$$fail"
860
861$(RECURSIVE_CLEAN_TARGETS):
862 @fail= failcom='exit 1'; \
863 for f in x $$MAKEFLAGS; do \
864 case $$f in \
865 *=* | --[!k]*);; \
866 *k*) failcom='fail=yes';; \
867 esac; \
868 done; \
869 dot_seen=no; \
870 case "$@" in \
871 distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
872 *) list='$(SUBDIRS)' ;; \
873 esac; \
874 rev=''; for subdir in $$list; do \
875 if test "$$subdir" = "."; then :; else \
876 rev="$$subdir $$rev"; \
877 fi; \
878 done; \
879 rev="$$rev ."; \
880 target=`echo $@ | sed s/-recursive//`; \
881 for subdir in $$rev; do \
882 echo "Making $$target in $$subdir"; \
883 if test "$$subdir" = "."; then \
884 local_target="$$target-am"; \
885 else \
886 local_target="$$target"; \
887 fi; \
888 ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
889 || eval $$failcom; \
890 done && test -z "$$fail"
891tags-recursive:
892 list='$(SUBDIRS)'; for subdir in $$list; do \
893 test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
894 done
895ctags-recursive:
896 list='$(SUBDIRS)'; for subdir in $$list; do \
897 test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
898 done
899
900ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
901 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
902 unique=`for i in $$list; do \
903 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
904 done | \
905 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
906 END { if (nonempty) { for (i in files) print i; }; }'`; \
907 mkid -fID $$unique
908tags: TAGS
909
910TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
911 $(TAGS_FILES) $(LISP)
912 set x; \
913 here=`pwd`; \
914 if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
915 include_option=--etags-include; \
916 empty_fix=.; \
917 else \
918 include_option=--include; \
919 empty_fix=; \
920 fi; \
921 list='$(SUBDIRS)'; for subdir in $$list; do \
922 if test "$$subdir" = .; then :; else \
923 test ! -f $$subdir/TAGS || \
924 set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
925 fi; \
926 done; \
927 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
928 unique=`for i in $$list; do \
929 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
930 done | \
931 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
932 END { if (nonempty) { for (i in files) print i; }; }'`; \
933 shift; \
934 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
935 test -n "$$unique" || unique=$$empty_fix; \
936 if test $$# -gt 0; then \
937 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
938 "$$@" $$unique; \
939 else \
940 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
941 $$unique; \
942 fi; \
943 fi
944ctags: CTAGS
945CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
946 $(TAGS_FILES) $(LISP)
947 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
948 unique=`for i in $$list; do \
949 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
950 done | \
951 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
952 END { if (nonempty) { for (i in files) print i; }; }'`; \
953 test -z "$(CTAGS_ARGS)$$unique" \
954 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
955 $$unique
956
957GTAGS:
958 here=`$(am__cd) $(top_builddir) && pwd` \
959 && $(am__cd) $(top_srcdir) \
960 && gtags -i $(GTAGS_ARGS) "$$here"
961
962distclean-tags:
963 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
964
965distdir: $(DISTFILES)
966 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
967 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
968 list='$(DISTFILES)'; \
969 dist_files=`for file in $$list; do echo $$file; done | \
970 sed -e "s|^$$srcdirstrip/||;t" \
971 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
972 case $$dist_files in \
973 */*) $(MKDIR_P) `echo "$$dist_files" | \
974 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
975 sort -u` ;; \
976 esac; \
977 for file in $$dist_files; do \
978 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
979 if test -d $$d/$$file; then \
980 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
981 if test -d "$(distdir)/$$file"; then \
982 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
983 fi; \
984 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
985 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
986 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
987 fi; \
988 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
989 else \
990 test -f "$(distdir)/$$file" \
991 || cp -p $$d/$$file "$(distdir)/$$file" \
992 || exit 1; \
993 fi; \
994 done
995 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
996 if test "$$subdir" = .; then :; else \
997 test -d "$(distdir)/$$subdir" \
998 || $(MKDIR_P) "$(distdir)/$$subdir" \
999 || exit 1; \
1000 fi; \
1001 done
1002 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
1003 if test "$$subdir" = .; then :; else \
1004 dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
1005 $(am__relativize); \
1006 new_distdir=$$reldir; \
1007 dir1=$$subdir; dir2="$(top_distdir)"; \
1008 $(am__relativize); \
1009 new_top_distdir=$$reldir; \
1010 echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
1011 echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
1012 ($(am__cd) $$subdir && \
1013 $(MAKE) $(AM_MAKEFLAGS) \
1014 top_distdir="$$new_top_distdir" \
1015 distdir="$$new_distdir" \
1016 am__remove_distdir=: \
1017 am__skip_length_check=: \
1018 am__skip_mode_fix=: \
1019 distdir) \
1020 || exit 1; \
1021 fi; \
1022 done
1023check-am: all-am
1024check: check-recursive
1025all-am: Makefile $(PROGRAMS) $(SCRIPTS)
1026installdirs: installdirs-recursive
1027installdirs-am:
1028 for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"; do \
1029 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
1030 done
1031install: install-recursive
1032install-exec: install-exec-recursive
1033install-data: install-data-recursive
1034uninstall: uninstall-recursive
1035
1036install-am: all-am
1037 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
1038
1039installcheck: installcheck-recursive
1040install-strip:
1041 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
1042 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
1043 `test -z '$(STRIP)' || \
1044 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
1045mostlyclean-generic:
1046
1047clean-generic:
1048
1049distclean-generic:
1050 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
1051 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
1052
1053maintainer-clean-generic:
1054 @echo "This command is intended for maintainers to use"
1055 @echo "it deletes files that may require special tools to rebuild."
1056 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
1057clean: clean-recursive
1058
1059clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
1060
1061distclean: distclean-recursive
1062 -rm -rf ./$(DEPDIR)
1063 -rm -f Makefile
1064distclean-am: clean-am distclean-compile distclean-generic \
1065 distclean-tags
1066
1067dvi: dvi-recursive
1068
1069dvi-am:
1070
1071html: html-recursive
1072
1073html-am:
1074
1075info: info-recursive
1076
1077info-am:
1078
1079install-data-am:
1080
1081install-dvi: install-dvi-recursive
1082
1083install-dvi-am:
1084
1085install-exec-am: install-binPROGRAMS install-binSCRIPTS
1086
1087install-html: install-html-recursive
1088
1089install-html-am:
1090
1091install-info: install-info-recursive
1092
1093install-info-am:
1094
1095install-man:
1096
1097install-pdf: install-pdf-recursive
1098
1099install-pdf-am:
1100
1101install-ps: install-ps-recursive
1102
1103install-ps-am:
1104
1105installcheck-am:
1106
1107maintainer-clean: maintainer-clean-recursive
1108 -rm -rf ./$(DEPDIR)
1109 -rm -f Makefile
1110maintainer-clean-am: distclean-am maintainer-clean-generic
1111
1112mostlyclean: mostlyclean-recursive
1113
1114mostlyclean-am: mostlyclean-compile mostlyclean-generic \
1115 mostlyclean-libtool
1116
1117pdf: pdf-recursive
1118
1119pdf-am:
1120
1121ps: ps-recursive
1122
1123ps-am:
1124
1125uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS
1126
1127.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
1128 install-am install-strip tags-recursive
1129
1130.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
1131 all all-am check check-am clean clean-binPROGRAMS \
1132 clean-generic clean-libtool ctags ctags-recursive distclean \
1133 distclean-compile distclean-generic distclean-libtool \
1134 distclean-tags distdir dvi dvi-am html html-am info info-am \
1135 install install-am install-binPROGRAMS install-binSCRIPTS \
1136 install-data install-data-am install-dvi install-dvi-am \
1137 install-exec install-exec-am install-html install-html-am \
1138 install-info install-info-am install-man install-pdf \
1139 install-pdf-am install-ps install-ps-am install-strip \
1140 installcheck installcheck-am installdirs installdirs-am \
1141 maintainer-clean maintainer-clean-generic mostlyclean \
1142 mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
1143 pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
1144 uninstall-binPROGRAMS uninstall-binSCRIPTS
1145
1146
1147# Tell versions [3.59,3.63) of GNU make to not export all variables.
1148# Otherwise a system limit (for SysV at least) may be exceeded.
1149.NOEXPORT:
diff --git a/libraries/edje/src/bin/edje_cc.c b/libraries/edje/src/bin/edje_cc.c
new file mode 100644
index 0000000..adcbbb6
--- /dev/null
+++ b/libraries/edje/src/bin/edje_cc.c
@@ -0,0 +1,250 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <string.h>
6#include <locale.h>
7#include <limits.h>
8#include <sys/stat.h>
9
10#include "edje_cc.h"
11int _edje_cc_log_dom = -1;
12static void main_help(void);
13
14Eina_Prefix *pfx = NULL;
15Eina_List *snd_dirs = NULL;
16Eina_List *img_dirs = NULL;
17Eina_List *fnt_dirs = NULL;
18Eina_List *defines = NULL;
19char *file_in = NULL;
20char *tmp_dir = NULL;
21char *file_out = NULL;
22char *progname = NULL;
23int verbose = 0;
24
25int no_lossy = 0;
26int no_comp = 0;
27int no_raw = 0;
28int no_save = 0;
29int min_quality = 0;
30int max_quality = 100;
31
32static void
33main_help(void)
34{
35 printf
36 ("Usage:\n"
37 "\t%s [OPTIONS] input_file.edc [output_file.edj]\n"
38 "\n"
39 "Where OPTIONS is one or more of:\n"
40 "\n"
41 "-id image/directory Add a directory to look in for relative path images\n"
42 "-fd font/directory Add a directory to look in for relative path fonts\n"
43 "-sd sound/directory Add a directory to look in for relative path sounds samples\n"
44 "-td temp/directory Directory to store temporary files\n"
45 "-v Verbose output\n"
46 "-no-lossy Do NOT allow images to be lossy\n"
47 "-no-comp Do NOT allow images to be stored with lossless compression\n"
48 "-no-raw Do NOT allow images to be stored with zero compression (raw)\n"
49 "-no-save Do NOT store the input EDC file in the EDJ file\n"
50 "-min-quality VAL Do NOT allow lossy images with quality < VAL (0-100)\n"
51 "-max-quality VAL Do NOT allow lossy images with quality > VAL (0-100)\n"
52 "-Ddefine_val=to CPP style define to define input macro definitions to the .edc source\n"
53 ,progname);
54}
55
56int
57main(int argc, char **argv)
58{
59 int i;
60 struct stat st;
61 char rpath[PATH_MAX], rpath2[PATH_MAX];
62
63 setlocale(LC_NUMERIC, "C");
64
65 if (!eina_init())
66 return -1;
67
68 _edje_cc_log_dom = eina_log_domain_register
69 ("edje_cc", EDJE_CC_DEFAULT_LOG_COLOR);
70 if (_edje_cc_log_dom < 0)
71 {
72 EINA_LOG_ERR("Enable to create a log domain.");
73 exit(-1);
74 }
75 tmp_dir = getenv("TMPDIR");
76
77 img_dirs = eina_list_append(img_dirs, ".");
78
79 progname = argv[0];
80 for (i = 1; i < argc; i++)
81 {
82 if (!strcmp(argv[i], "-h"))
83 {
84 main_help();
85 exit(0);
86 }
87 else if (!strcmp(argv[i], "-v"))
88 {
89 verbose = 1;
90 }
91 else if (!strcmp(argv[i], "-no-lossy"))
92 {
93 no_lossy = 1;
94 }
95 else if (!strcmp(argv[i], "-no-comp"))
96 {
97 no_comp = 1;
98 }
99 else if (!strcmp(argv[i], "-no-raw"))
100 {
101 no_raw = 1;
102 }
103 else if (!strcmp(argv[i], "-no-save"))
104 {
105 no_save = 1;
106 }
107 else if ((!strcmp(argv[i], "-id") || !strcmp(argv[i], "--image_dir")) && (i < (argc - 1)))
108 {
109 i++;
110 img_dirs = eina_list_append(img_dirs, argv[i]);
111 }
112 else if ((!strcmp(argv[i], "-fd") || !strcmp(argv[i], "--font_dir")) && (i < (argc - 1)))
113 {
114 i++;
115 fnt_dirs = eina_list_append(fnt_dirs, argv[i]);
116 }
117 else if ((!strcmp(argv[i], "-sd") || !strcmp(argv[i], "--sound_dir")) && (i < (argc - 1)))
118 {
119 i++;
120 snd_dirs = eina_list_append(snd_dirs, argv[i]);
121 }
122 else if ((!strcmp(argv[i], "-td") || !strcmp(argv[i], "--tmp_dir")) && (i < (argc - 1)))
123 {
124 i++;
125 if (!tmp_dir)
126 tmp_dir = argv[i];
127 }
128 else if ((!strcmp(argv[i], "-min-quality")) && (i < (argc - 1)))
129 {
130 i++;
131 min_quality = atoi(argv[i]);
132 if (min_quality < 0) min_quality = 0;
133 if (min_quality > 100) min_quality = 100;
134 }
135 else if ((!strcmp(argv[i], "-max-quality")) && (i < (argc - 1)))
136 {
137 i++;
138 max_quality = atoi(argv[i]);
139 if (max_quality < 0) max_quality = 0;
140 if (max_quality > 100) max_quality = 100;
141 }
142 else if (!strncmp(argv[i], "-D", 2))
143 {
144 defines = eina_list_append(defines, mem_strdup(argv[i]));
145 }
146 else if ((!strcmp(argv[i], "-o")) && (i < (argc - 1)))
147 {
148 i++;
149 file_out = argv[i];
150 }
151 else if (!file_in)
152 file_in = argv[i];
153 else if (!file_out)
154 file_out = argv[i];
155 }
156 if (!file_in)
157 {
158 fprintf(stderr, "%s: Error: no input file specified.\n", progname);
159 main_help();
160 exit(-1);
161 }
162
163 pfx = eina_prefix_new(argv[0], /* argv[0] value (optional) */
164 main, /* an optional symbol to check path of */
165 "EDJE", /* env var prefix to use (XXX_PREFIX, XXX_BIN_DIR etc. */
166 "edje", /* dir to add after "share" (PREFIX/share/DIRNAME) */
167 "include/edje.inc", /* a magic file to check for in PREFIX/share/DIRNAME for success */
168 PACKAGE_BIN_DIR, /* package bin dir @ compile time */
169 PACKAGE_LIB_DIR, /* package lib dir @ compile time */
170 PACKAGE_DATA_DIR, /* package data dir @ compile time */
171 PACKAGE_DATA_DIR /* if locale needed use LOCALE_DIR */
172 );
173
174 /* check whether file_in exists */
175#ifdef HAVE_REALPATH
176 if (!realpath(file_in, rpath) || stat(rpath, &st) || !S_ISREG(st.st_mode))
177#else
178 if (stat(file_in, &st) || !S_ISREG(st.st_mode))
179#endif
180 {
181 fprintf(stderr, "%s: Error: file not found: %s.\n", progname, file_in);
182 main_help();
183 exit(-1);
184 }
185
186 if (!file_out)
187 {
188 char *suffix;
189
190 if ((suffix = strstr(file_in,".edc")) && (suffix[4] == 0))
191 {
192 file_out = strdup(file_in);
193 if (file_out)
194 {
195 suffix = strstr(file_out,".edc");
196 strcpy(suffix,".edj");
197 }
198 }
199 }
200 if (!file_out)
201 {
202 fprintf(stderr, "%s: Error: no output file specified.\n", progname);
203 main_help();
204 exit(-1);
205 }
206
207#ifdef HAVE_REALPATH
208 if (realpath(file_out, rpath2) && !strcmp (rpath, rpath2))
209#else
210 if (!strcmp (file_in, file_out))
211#endif
212 {
213 fprintf(stderr, "%s: Error: input file equals output file.\n", progname);
214 main_help();
215 exit(-1);
216 }
217
218 if (!edje_init())
219 exit(-1);
220
221 edje_file = mem_alloc(SZ(Edje_File));
222 edje_file->compiler = strdup("edje_cc");
223 edje_file->version = EDJE_FILE_VERSION;
224 edje_file->minor = EDJE_FILE_MINOR;
225 edje_file->feature_ver = 1; /* increment this every time we add a field
226 * or feature to the edje file format that
227 * does not load nicely as a NULL or 0 value
228 * and needs a special fallback initialization
229 */
230
231 source_edd();
232 source_fetch();
233
234 data_setup();
235 compile();
236 reorder_parts();
237 data_process_scripts();
238 data_process_lookups();
239 data_process_script_lookups();
240 data_write();
241
242 eina_prefix_free(pfx);
243 pfx = NULL;
244
245 edje_shutdown();
246 eina_log_domain_unregister(_edje_cc_log_dom);
247 eina_shutdown();
248
249 return 0;
250}
diff --git a/libraries/edje/src/bin/edje_cc.h b/libraries/edje/src/bin/edje_cc.h
new file mode 100644
index 0000000..bcd31a1
--- /dev/null
+++ b/libraries/edje/src/bin/edje_cc.h
@@ -0,0 +1,226 @@
1#ifndef EDJE_CC_H
2#define EDJE_CC_H
3
4#include <edje_private.h>
5
6extern Eina_Prefix *pfx;
7
8/*
9 * On Windows, if the file is not opened in binary mode,
10 * read does not return the correct size, because of
11 * CR / LF translation.
12 */
13#ifndef O_BINARY
14# define O_BINARY 0
15#endif
16
17/* logging variables */
18extern int _edje_cc_log_dom ;
19#define EDJE_CC_DEFAULT_LOG_COLOR EINA_COLOR_CYAN
20#ifdef ERR
21# undef ERR
22#endif
23#define ERR(...) EINA_LOG_DOM_ERR(_edje_cc_log_dom, __VA_ARGS__)
24#ifdef INF
25# undef INF
26#endif
27#define INF(...) EINA_LOG_DOM_INFO(_edje_cc_log_dom, __VA_ARGS__)
28#ifdef WRN
29# undef WRN
30#endif
31#define WRN(...) EINA_LOG_DOM_WARN(_edje_cc_log_dom, __VA_ARGS__)
32
33
34/* types */
35typedef struct _New_Object_Handler New_Object_Handler;
36typedef struct _New_Statement_Handler New_Statement_Handler;
37typedef struct _External_List External_List;
38typedef struct _External External;
39typedef struct _Font_List Font_List;
40typedef struct _Font Font;
41typedef struct _Code Code;
42typedef struct _Code_Program Code_Program;
43typedef struct _SrcFile SrcFile;
44typedef struct _SrcFile_List SrcFile_List;
45
46typedef struct _Edje_Program_Parser Edje_Program_Parser;
47typedef struct _Edje_Pack_Element_Parser Edje_Pack_Element_Parser;
48typedef struct _Edje_Part_Parser Edje_Part_Parser;
49
50struct _New_Object_Handler
51{
52 const char *type;
53 void (*func)(void);
54};
55
56struct _New_Statement_Handler
57{
58 const char *type;
59 void (*func)(void);
60};
61
62struct _External_List
63{
64 Eina_List *list;
65};
66
67struct _External
68{
69 char *name;
70};
71
72struct _Font_List
73{
74 Eina_List *list;
75};
76
77struct _Font
78{
79 char *name;
80 char *file;
81};
82
83struct _Code
84{
85 int l1, l2;
86 char *shared;
87 char *original;
88 Eina_List *programs;
89 int is_lua;
90};
91
92struct _Code_Program
93{
94 int l1, l2;
95 int id;
96 char *script;
97 char *original;
98};
99
100struct _SrcFile
101{
102 char *name;
103 char *file;
104};
105
106struct _SrcFile_List
107{
108 Eina_List *list;
109};
110
111struct _Edje_Program_Parser
112{
113 Edje_Program common;
114 Eina_Bool can_override;
115};
116
117struct _Edje_Pack_Element_Parser
118{
119 Edje_Pack_Element common;
120 Eina_Bool can_override;
121};
122
123struct _Edje_Part_Parser
124{
125 Edje_Part common;
126 struct {
127 Eina_Bool done;
128 const char *insert_before; /* the part name for insertion in front of */
129 const char *insert_after; /* the part name for insertion behind of */
130 Edje_Part_Parser *before;
131 Edje_Part_Parser *after;
132 int linked_prev; /* the number linked previous part for reorder */
133 int linked_next; /* the number linked next part for reorder */
134 } reorder;
135 Eina_Bool can_override;
136};
137
138/* global fn calls */
139void data_setup(void);
140void data_write(void);
141void data_queue_part_lookup(Edje_Part_Collection *pc, const char *name, int *dest);
142void data_queue_copied_part_lookup(Edje_Part_Collection *pc, int *src, int *dest);
143void data_queue_program_lookup(Edje_Part_Collection *pc, const char *name, int *dest);
144void data_queue_copied_program_lookup(Edje_Part_Collection *pc, int *src, int *dest);
145void data_queue_anonymous_lookup(Edje_Part_Collection *pc, Edje_Program *ep, int *dest);
146void data_queue_copied_anonymous_lookup(Edje_Part_Collection *pc, int *src, int *dest);
147void data_queue_image_lookup(char *name, int *dest, Eina_Bool *set);
148void data_queue_copied_image_lookup(int *src, int *dest, Eina_Bool *set);
149void data_queue_part_slave_lookup(int *master, int *slave);
150void data_queue_image_slave_lookup(int *master, int *slave);
151void data_queue_spectrum_lookup(char *name, int *dest);
152void data_queue_spectrum_slave_lookup(int *master, int *slave);
153void data_process_lookups(void);
154void data_process_scripts(void);
155void data_process_script_lookups(void);
156
157
158int is_verbatim(void);
159void track_verbatim(int on);
160void set_verbatim(char *s, int l1, int l2);
161char *get_verbatim(void);
162int get_verbatim_line1(void);
163int get_verbatim_line2(void);
164void compile(void);
165int is_param(int n);
166int is_num(int n);
167char *parse_str(int n);
168int parse_enum(int n, ...);
169int parse_flags(int n, ...);
170int parse_int(int n);
171int parse_int_range(int n, int f, int t);
172int parse_bool(int n);
173double parse_float(int n);
174double parse_float_range(int n, double f, double t);
175int get_arg_count(void);
176void check_arg_count(int n);
177void check_min_arg_count(int n);
178
179int object_handler_num(void);
180int statement_handler_num(void);
181
182void reorder_parts(void);
183void source_edd(void);
184void source_fetch(void);
185int source_append(Eet_File *ef);
186SrcFile_List *source_load(Eet_File *ef);
187int source_fontmap_save(Eet_File *ef, Eina_List *fonts);
188Font_List *source_fontmap_load(Eet_File *ef);
189
190void *mem_alloc(size_t size);
191char *mem_strdup(const char *s);
192#define SZ sizeof
193
194void error_and_abort(Eet_File *ef, const char *fmt, ...);
195
196/* global vars */
197extern Eina_List *ext_dirs;
198extern Eina_List *img_dirs;
199extern Eina_List *fnt_dirs;
200extern Eina_List *snd_dirs;
201extern char *file_in;
202extern char *tmp_dir;
203extern char *file_out;
204extern char *progname;
205extern int verbose;
206extern int no_lossy;
207extern int no_comp;
208extern int no_raw;
209extern int no_save;
210extern int min_quality;
211extern int max_quality;
212extern int line;
213extern Eina_List *stack;
214extern Eina_List *params;
215extern Edje_File *edje_file;
216extern Eina_List *edje_collections;
217extern Eina_List *externals;
218extern Eina_List *fonts;
219extern Eina_List *codes;
220extern Eina_List *defines;
221extern Eina_List *aliases;
222extern New_Object_Handler object_handlers[];
223extern New_Statement_Handler statement_handlers[];
224
225
226#endif
diff --git a/libraries/edje/src/bin/edje_cc_handlers.c b/libraries/edje/src/bin/edje_cc_handlers.c
new file mode 100644
index 0000000..8bfc262
--- /dev/null
+++ b/libraries/edje/src/bin/edje_cc_handlers.c
@@ -0,0 +1,7763 @@
1/*
2 Concerning the EDC reference:
3
4 The formatting for blocks and properties has been implemented as a table
5 which is filled using ALIASES.
6 For maximum flexibility I implemented them in the \@code/\@encode style,
7 this means that missing one or changing the order most certainly cause
8 formatting errors.
9
10 \@block
11 block name
12 \@context
13 code sample of the block
14 \@description
15 the block's description
16 \@endblock
17
18 \@property
19 property name
20 \@parameters
21 property's parameter list
22 \@effect
23 the property description (lol)
24 \@endproperty
25*/
26
27#ifdef HAVE_CONFIG_H
28# include "config.h"
29#endif
30
31#include <string.h>
32#include <errno.h>
33#include <sys/stat.h>
34#include <fcntl.h>
35#include <sys/mman.h>
36#include <unistd.h>
37
38#include "edje_cc.h"
39
40/**
41 * @page edcref Edje Data Collection reference
42 * An Edje Data Collection, it's a plain text file (normally identified with the
43 * .edc extension),consisting of instructions for the Edje Compiler.
44 *
45 * The syntax for the edje data collection files follows a simple structure of
46 * "blocks { .. }" that can contain "properties: ..", more blocks, or both.
47 *
48 * @anchor sec_quickaccess Quick access to block descriptions:
49 * <ul>
50 * <li>@ref sec_toplevel "Top-Level"</li>
51 * <li>@ref sec_group "Group"</li>
52 * <li>@ref sec_description "State description"</li>
53 * <ul>
54 * <li>@ref sec_description_image "Image"</li>
55 * <li>@ref sec_description_text "Text"</li>
56 * <li>@ref sec_description_box "Box"</li>
57 * <li>@ref sec_description_table "Table"</li>
58 * <li>@ref sec_description_map "Map (3d/transformations)"</li>
59 * </ul>
60 * <li>@ref sec_program "Program block"</li>
61 * </ul>
62 *
63 * @author Andres Blanc (dresb) andresblanc@gmail.com
64 *
65 * <table class="edcref" border="0">
66 */
67
68static Edje_Part_Collection_Directory_Entry *current_de = NULL;
69static Edje_Part *current_part = NULL;
70static Edje_Pack_Element *current_item = NULL;
71static Edje_Part_Description_Common *current_desc = NULL;
72static Edje_Part_Description_Common *parent_desc = NULL;
73static Edje_Program *current_program = NULL;
74
75static void st_externals_external(void);
76
77static void st_images_image(void);
78static void ob_images_set(void);
79static void st_images_set_name(void);
80static void ob_images_set_image(void);
81static void st_images_set_image_image(void);
82static void st_images_set_image_size(void);
83
84static void st_fonts_font(void);
85
86static void st_data_item(void);
87static void st_data_file(void);
88
89static void ob_styles_style(void);
90static void st_styles_style_name(void);
91static void st_styles_style_base(void);
92static void st_styles_style_tag(void);
93
94static void ob_color_class(void);
95static void st_color_class_name(void);
96static void st_color_class_color(void);
97static void st_color_class_color2(void);
98static void st_color_class_color3(void);
99
100static void ob_collections(void);
101
102static void ob_collections_group(void);
103static void st_collections_group_name(void);
104static void st_collections_group_inherit(void);
105static void st_collections_group_script_only(void);
106static void st_collections_group_alias(void);
107static void st_collections_group_min(void);
108static void st_collections_group_max(void);
109static void st_collections_group_data_item(void);
110static void st_collections_group_orientation(void);
111
112static void st_collections_group_limits_vertical(void);
113static void st_collections_group_limits_horizontal(void);
114
115static void ob_collections_group_script(void);
116static void ob_collections_group_lua_script(void);
117
118static void st_collections_group_parts_alias(void);
119
120static void ob_collections_group_parts_part(void);
121static void st_collections_group_parts_part_name(void);
122static void st_collections_group_parts_part_type(void);
123static void st_collections_group_parts_part_insert_before(void);
124static void st_collections_group_parts_part_insert_after(void);
125static void st_collections_group_parts_part_effect(void);
126static void st_collections_group_parts_part_mouse_events(void);
127static void st_collections_group_parts_part_repeat_events(void);
128static void st_collections_group_parts_part_ignore_flags(void);
129static void st_collections_group_parts_part_scale(void);
130static void st_collections_group_parts_part_pointer_mode(void);
131static void st_collections_group_parts_part_precise_is_inside(void);
132static void st_collections_group_parts_part_use_alternate_font_metrics(void);
133static void st_collections_group_parts_part_clip_to_id(void);
134static void st_collections_group_parts_part_source(void);
135static void st_collections_group_parts_part_source2(void);
136static void st_collections_group_parts_part_source3(void);
137static void st_collections_group_parts_part_source4(void);
138static void st_collections_group_parts_part_source5(void);
139static void st_collections_group_parts_part_source6(void);
140static void st_collections_group_parts_part_entry_mode(void);
141static void st_collections_group_parts_part_select_mode(void);
142static void st_collections_group_parts_part_cursor_mode(void);
143static void st_collections_group_parts_part_multiline(void);
144static void st_collections_group_parts_part_dragable_x(void);
145static void st_collections_group_parts_part_dragable_y(void);
146static void st_collections_group_parts_part_dragable_confine(void);
147static void st_collections_group_parts_part_dragable_events(void);
148
149/* box and table items share these */
150static void ob_collections_group_parts_part_box_items_item(void);
151static void st_collections_group_parts_part_box_items_item_type(void);
152static void st_collections_group_parts_part_box_items_item_name(void);
153static void st_collections_group_parts_part_box_items_item_source(void);
154static void st_collections_group_parts_part_box_items_item_min(void);
155static void st_collections_group_parts_part_box_items_item_prefer(void);
156static void st_collections_group_parts_part_box_items_item_max(void);
157static void st_collections_group_parts_part_box_items_item_padding(void);
158static void st_collections_group_parts_part_box_items_item_align(void);
159static void st_collections_group_parts_part_box_items_item_weight(void);
160static void st_collections_group_parts_part_box_items_item_aspect(void);
161static void st_collections_group_parts_part_box_items_item_aspect_mode(void);
162static void st_collections_group_parts_part_box_items_item_options(void);
163/* but these are only for table */
164static void st_collections_group_parts_part_table_items_item_position(void);
165static void st_collections_group_parts_part_table_items_item_span(void);
166
167static void ob_collections_group_parts_part_description(void);
168static void st_collections_group_parts_part_description_inherit(void);
169static void st_collections_group_parts_part_description_source(void);
170static void st_collections_group_parts_part_description_state(void);
171static void st_collections_group_parts_part_description_visible(void);
172static void st_collections_group_parts_part_description_align(void);
173static void st_collections_group_parts_part_description_fixed(void);
174static void st_collections_group_parts_part_description_min(void);
175static void st_collections_group_parts_part_description_max(void);
176static void st_collections_group_parts_part_description_step(void);
177static void st_collections_group_parts_part_description_aspect(void);
178static void st_collections_group_parts_part_description_aspect_preference(void);
179static void st_collections_group_parts_part_description_rel1_relative(void);
180static void st_collections_group_parts_part_description_rel1_offset(void);
181static void st_collections_group_parts_part_description_rel1_to(void);
182static void st_collections_group_parts_part_description_rel1_to_x(void);
183static void st_collections_group_parts_part_description_rel1_to_y(void);
184static void st_collections_group_parts_part_description_rel2_relative(void);
185static void st_collections_group_parts_part_description_rel2_offset(void);
186static void st_collections_group_parts_part_description_rel2_to(void);
187static void st_collections_group_parts_part_description_rel2_to_x(void);
188static void st_collections_group_parts_part_description_rel2_to_y(void);
189static void st_collections_group_parts_part_description_image_normal(void);
190static void st_collections_group_parts_part_description_image_tween(void);
191static void st_collections_group_parts_part_description_image_border(void);
192static void st_collections_group_parts_part_description_image_middle(void);
193static void st_collections_group_parts_part_description_image_border_scale(void);
194static void st_collections_group_parts_part_description_image_border_scale_by(void);
195static void st_collections_group_parts_part_description_image_scale_hint(void);
196static void st_collections_group_parts_part_description_fill_smooth(void);
197static void st_collections_group_parts_part_description_fill_origin_relative(void);
198static void st_collections_group_parts_part_description_fill_origin_offset(void);
199static void st_collections_group_parts_part_description_fill_size_relative(void);
200static void st_collections_group_parts_part_description_fill_size_offset(void);
201static void st_collections_group_parts_part_description_fill_spread(void);
202static void st_collections_group_parts_part_description_fill_type(void);
203static void st_collections_group_parts_part_description_color_class(void);
204static void st_collections_group_parts_part_description_color(void);
205static void st_collections_group_parts_part_description_color2(void);
206static void st_collections_group_parts_part_description_color3(void);
207static void st_collections_group_parts_part_description_text_text(void);
208static void st_collections_group_parts_part_description_text_text_class(void);
209static void st_collections_group_parts_part_description_text_font(void);
210static void st_collections_group_parts_part_description_text_style(void);
211static void st_collections_group_parts_part_description_text_repch(void);
212static void st_collections_group_parts_part_description_text_size(void);
213static void st_collections_group_parts_part_description_text_size_range(void);
214static void st_collections_group_parts_part_description_text_fit(void);
215static void st_collections_group_parts_part_description_text_min(void);
216static void st_collections_group_parts_part_description_text_max(void);
217static void st_collections_group_parts_part_description_text_align(void);
218static void st_collections_group_parts_part_description_text_source(void);
219static void st_collections_group_parts_part_description_text_text_source(void);
220static void st_collections_group_parts_part_description_text_elipsis(void);
221static void st_collections_group_parts_part_description_box_layout(void);
222static void st_collections_group_parts_part_description_box_align(void);
223static void st_collections_group_parts_part_description_box_padding(void);
224static void st_collections_group_parts_part_description_box_min(void);
225static void st_collections_group_parts_part_description_table_homogeneous(void);
226static void st_collections_group_parts_part_description_table_align(void);
227static void st_collections_group_parts_part_description_table_padding(void);
228static void st_collections_group_parts_part_description_table_min(void);
229static void st_collections_group_parts_part_description_map_perspective(void);
230static void st_collections_group_parts_part_description_map_light(void);
231static void st_collections_group_parts_part_description_map_rotation_center(void);
232static void st_collections_group_parts_part_description_map_rotation_x(void);
233static void st_collections_group_parts_part_description_map_rotation_y(void);
234static void st_collections_group_parts_part_description_map_rotation_z(void);
235static void st_collections_group_parts_part_description_map_on(void);
236static void st_collections_group_parts_part_description_map_smooth(void);
237static void st_collections_group_parts_part_description_map_alpha(void);
238static void st_collections_group_parts_part_description_map_backface_cull(void);
239static void st_collections_group_parts_part_description_map_perspective_on(void);
240static void st_collections_group_parts_part_description_perspective_zplane(void);
241static void st_collections_group_parts_part_description_perspective_focal(void);
242static void st_collections_group_parts_part_api(void);
243
244/* external part parameters */
245static void st_collections_group_parts_part_description_params_int(void);
246static void ob_collections_group_programs_program(void);
247static void st_collections_group_parts_part_description_params_double(void);
248
249static void st_collections_group_programs_program_name(void);
250static void st_collections_group_parts_part_description_params_string(void);
251static void st_collections_group_parts_part_description_params_bool(void);
252static void st_collections_group_parts_part_description_params_choice(void);
253static void st_collections_group_programs_program_signal(void);
254static void st_collections_group_programs_program_source(void);
255static void st_collections_group_programs_program_filter(void);
256static void st_collections_group_programs_program_in(void);
257static void st_collections_group_programs_program_action(void);
258static void st_collections_group_programs_program_transition(void);
259static void st_collections_group_programs_program_target(void);
260static void st_collections_group_programs_program_after(void);
261static void st_collections_group_programs_program_api(void);
262
263static void ob_collections_group_programs_program_script(void);
264
265#ifdef ENABLE_MULTISENSE
266static void st_collections_group_sound_sample_name(void);
267static void st_collections_group_sound_sample_source(void);
268static void st_collections_group_sound_tone(void);
269#endif
270
271/*****/
272
273New_Statement_Handler statement_handlers[] =
274{
275 {"externals.external", st_externals_external},
276 {"images.image", st_images_image},
277 {"images.set.name", st_images_set_name},
278 {"images.set.image.image", st_images_set_image_image},
279 {"images.set.image.size", st_images_set_image_size},
280 {"fonts.font", st_fonts_font},
281 {"data.item", st_data_item},
282 {"data.file", st_data_file},
283 {"styles.style.name", st_styles_style_name},
284 {"styles.style.base", st_styles_style_base},
285 {"styles.style.tag", st_styles_style_tag},
286 {"color_classes.color_class.name", st_color_class_name},
287 {"color_classes.color_class.color", st_color_class_color},
288 {"color_classes.color_class.color2", st_color_class_color2},
289 {"color_classes.color_class.color3", st_color_class_color3},
290 {"collections.externals.external", st_externals_external}, /* dup */
291 {"collections.image", st_images_image}, /* dup */
292 {"collections.set.name", st_images_set_name}, /* dup */
293 {"collections.set.image.image", st_images_set_image_image}, /* dup */
294 {"collections.set.image.size", st_images_set_image_size}, /* dup */
295 {"collections.images.image", st_images_image}, /* dup */
296 {"collections.images.set.name", st_images_set_name}, /* dup */
297 {"collections.images.set.image.image", st_images_set_image_image}, /* dup */
298 {"collections.images.set.image.size", st_images_set_image_size}, /* dup */
299 {"collections.font", st_fonts_font}, /* dup */
300 {"collections.fonts.font", st_fonts_font}, /* dup */
301 {"collections.styles.style.name", st_styles_style_name}, /* dup */
302 {"collections.styles.style.base", st_styles_style_base}, /* dup */
303 {"collections.styles.style.tag", st_styles_style_tag}, /* dup */
304 {"collections.color_classes.color_class.name", st_color_class_name}, /* dup */
305 {"collections.color_classes.color_class.color", st_color_class_color}, /* dup */
306 {"collections.color_classes.color_class.color2", st_color_class_color2}, /* dup */
307 {"collections.color_classes.color_class.color3", st_color_class_color3}, /* dup */
308#ifdef ENABLE_MULTISENSE
309 {"collections.sounds.sample.name", st_collections_group_sound_sample_name},
310 {"collections.sounds.sample.source", st_collections_group_sound_sample_source},
311 {"collections.group.sounds.sample.name", st_collections_group_sound_sample_name}, /* dup */
312 {"collections.group.sounds.sample.source", st_collections_group_sound_sample_source}, /* dup */
313 {"collections.sounds.tone", st_collections_group_sound_tone},
314 {"collections.group.sounds.tone", st_collections_group_sound_tone}, /* dup */
315#endif
316 {"collections.group.name", st_collections_group_name},
317 {"collections.group.inherit", st_collections_group_inherit},
318 {"collections.group.script_only", st_collections_group_script_only},
319 {"collections.group.lua_script_only", st_collections_group_script_only},
320 {"collections.group.alias", st_collections_group_alias},
321 {"collections.group.min", st_collections_group_min},
322 {"collections.group.max", st_collections_group_max},
323 {"collections.group.orientation", st_collections_group_orientation},
324 {"collections.group.data.item", st_collections_group_data_item},
325 {"collections.group.limits.horizontal", st_collections_group_limits_horizontal},
326 {"collections.group.limits.vertical", st_collections_group_limits_vertical},
327 {"collections.group.externals.external", st_externals_external}, /* dup */
328 {"collections.group.image", st_images_image}, /* dup */
329 {"collections.group.set.name", st_images_set_name},
330 {"collections.group.set.image.image", st_images_set_image_image},
331 {"collections.group.set.image.size", st_images_set_image_size},
332 {"collections.group.images.image", st_images_image}, /* dup */
333 {"collections.group.images.set.name", st_images_set_name},
334 {"collections.group.images.set.image.image", st_images_set_image_image},
335 {"collections.group.images.set.image.size", st_images_set_image_size},
336 {"collections.group.font", st_fonts_font}, /* dup */
337 {"collections.group.fonts.font", st_fonts_font}, /* dup */
338 {"collections.group.styles.style.name", st_styles_style_name}, /* dup */
339 {"collections.group.styles.style.base", st_styles_style_base}, /* dup */
340 {"collections.group.styles.style.tag", st_styles_style_tag}, /* dup */
341 {"collections.group.color_classes.color_class.name", st_color_class_name}, /* dup */
342 {"collections.group.color_classes.color_class.color", st_color_class_color}, /* dup */
343 {"collections.group.color_classes.color_class.color2", st_color_class_color2}, /* dup */
344 {"collections.group.color_classes.color_class.color3", st_color_class_color3}, /* dup */
345 {"collections.group.parts.alias", st_collections_group_parts_alias },
346 {"collections.group.parts.image", st_images_image}, /* dup */
347 {"collections.group.parts.set.name", st_images_set_name},
348 {"collections.group.parts.set.image.image", st_images_set_image_image},
349 {"collections.group.parts.set.image.size", st_images_set_image_size},
350 {"collections.group.parts.images.image", st_images_image}, /* dup */
351 {"collections.group.parts.images.set.name", st_images_set_name},
352 {"collections.group.parts.images.set.image.image", st_images_set_image_image},
353 {"collections.group.parts.images.set.image.size", st_images_set_image_size},
354 {"collections.group.parts.font", st_fonts_font}, /* dup */
355 {"collections.group.parts.fonts.font", st_fonts_font}, /* dup */
356 {"collections.group.parts.styles.style.name", st_styles_style_name}, /* dup */
357 {"collections.group.parts.styles.style.base", st_styles_style_base}, /* dup */
358 {"collections.group.parts.styles.style.tag", st_styles_style_tag}, /* dup */
359 {"collections.group.parts.color_classes.color_class.name", st_color_class_name}, /* dup */
360 {"collections.group.parts.color_classes.color_class.color", st_color_class_color}, /* dup */
361 {"collections.group.parts.color_classes.color_class.color2", st_color_class_color2}, /* dup */
362 {"collections.group.parts.color_classes.color_class.color3", st_color_class_color3}, /* dup */
363 {"collections.group.parts.part.name", st_collections_group_parts_part_name},
364 {"collections.group.parts.part.api", st_collections_group_parts_part_api},
365 {"collections.group.parts.part.type", st_collections_group_parts_part_type},
366 {"collections.group.parts.part.insert_before", st_collections_group_parts_part_insert_before},
367 {"collections.group.parts.part.insert_after", st_collections_group_parts_part_insert_after},
368 {"collections.group.parts.part.effect", st_collections_group_parts_part_effect},
369 {"collections.group.parts.part.mouse_events", st_collections_group_parts_part_mouse_events},
370 {"collections.group.parts.part.repeat_events", st_collections_group_parts_part_repeat_events},
371 {"collections.group.parts.part.ignore_flags", st_collections_group_parts_part_ignore_flags},
372 {"collections.group.parts.part.scale", st_collections_group_parts_part_scale},
373 {"collections.group.parts.part.pointer_mode", st_collections_group_parts_part_pointer_mode},
374 {"collections.group.parts.part.precise_is_inside", st_collections_group_parts_part_precise_is_inside},
375 {"collections.group.parts.part.use_alternate_font_metrics", st_collections_group_parts_part_use_alternate_font_metrics},
376 {"collections.group.parts.part.clip_to", st_collections_group_parts_part_clip_to_id},
377 {"collections.group.parts.part.source", st_collections_group_parts_part_source},
378 {"collections.group.parts.part.source2", st_collections_group_parts_part_source2},
379 {"collections.group.parts.part.source3", st_collections_group_parts_part_source3},
380 {"collections.group.parts.part.source4", st_collections_group_parts_part_source4},
381 {"collections.group.parts.part.source5", st_collections_group_parts_part_source5},
382 {"collections.group.parts.part.source6", st_collections_group_parts_part_source6},
383 {"collections.group.parts.part.dragable.x", st_collections_group_parts_part_dragable_x},
384 {"collections.group.parts.part.dragable.y", st_collections_group_parts_part_dragable_y},
385 {"collections.group.parts.part.dragable.confine", st_collections_group_parts_part_dragable_confine},
386 {"collections.group.parts.part.dragable.events", st_collections_group_parts_part_dragable_events},
387 {"collections.group.parts.part.entry_mode", st_collections_group_parts_part_entry_mode},
388 {"collections.group.parts.part.select_mode", st_collections_group_parts_part_select_mode},
389 {"collections.group.parts.part.cursor_mode", st_collections_group_parts_part_cursor_mode},
390 {"collections.group.parts.part.multiline", st_collections_group_parts_part_multiline},
391 {"collections.group.parts.part.image", st_images_image}, /* dup */
392 {"collections.group.parts.part.set.name", st_images_set_name},
393 {"collections.group.parts.part.set.image.image", st_images_set_image_image},
394 {"collections.group.parts.part.set.image.size", st_images_set_image_size},
395 {"collections.group.parts.part.images.image", st_images_image}, /* dup */
396 {"collections.group.parts.part.images.set.name", st_images_set_name},
397 {"collections.group.parts.part.images.set.image.image", st_images_set_image_image},
398 {"collections.group.parts.part.images.set.image.size", st_images_set_image_size},
399 {"collections.group.parts.part.font", st_fonts_font}, /* dup */
400 {"collections.group.parts.part.fonts.font", st_fonts_font}, /* dup */
401 {"collections.group.parts.part.styles.style.name", st_styles_style_name}, /* dup */
402 {"collections.group.parts.part.styles.style.base", st_styles_style_base}, /* dup */
403 {"collections.group.parts.part.styles.style.tag", st_styles_style_tag}, /* dup */
404 {"collections.group.parts.part.color_classes.color_class.name", st_color_class_name}, /* dup */
405 {"collections.group.parts.part.color_classes.color_class.color", st_color_class_color}, /* dup */
406 {"collections.group.parts.part.color_classes.color_class.color2", st_color_class_color2}, /* dup */
407 {"collections.group.parts.part.color_classes.color_class.color3", st_color_class_color3}, /* dup */
408 {"collections.group.parts.part.box.items.item.type", st_collections_group_parts_part_box_items_item_type},
409 {"collections.group.parts.part.box.items.item.name", st_collections_group_parts_part_box_items_item_name},
410 {"collections.group.parts.part.box.items.item.source", st_collections_group_parts_part_box_items_item_source},
411 {"collections.group.parts.part.box.items.item.min", st_collections_group_parts_part_box_items_item_min},
412 {"collections.group.parts.part.box.items.item.prefer", st_collections_group_parts_part_box_items_item_prefer},
413 {"collections.group.parts.part.box.items.item.max", st_collections_group_parts_part_box_items_item_max},
414 {"collections.group.parts.part.box.items.item.padding", st_collections_group_parts_part_box_items_item_padding},
415 {"collections.group.parts.part.box.items.item.align", st_collections_group_parts_part_box_items_item_align},
416 {"collections.group.parts.part.box.items.item.weight", st_collections_group_parts_part_box_items_item_weight},
417 {"collections.group.parts.part.box.items.item.aspect", st_collections_group_parts_part_box_items_item_aspect},
418 {"collections.group.parts.part.box.items.item.aspect_mode", st_collections_group_parts_part_box_items_item_aspect_mode},
419 {"collections.group.parts.part.box.items.item.options", st_collections_group_parts_part_box_items_item_options},
420 {"collections.group.parts.part.table.items.item.type", st_collections_group_parts_part_box_items_item_type}, /* dup */
421 {"collections.group.parts.part.table.items.item.name", st_collections_group_parts_part_box_items_item_name}, /* dup */
422 {"collections.group.parts.part.table.items.item.source", st_collections_group_parts_part_box_items_item_source}, /* dup */
423 {"collections.group.parts.part.table.items.item.min", st_collections_group_parts_part_box_items_item_min}, /* dup */
424 {"collections.group.parts.part.table.items.item.prefer", st_collections_group_parts_part_box_items_item_prefer}, /* dup */
425 {"collections.group.parts.part.table.items.item.max", st_collections_group_parts_part_box_items_item_max}, /* dup */
426 {"collections.group.parts.part.table.items.item.padding", st_collections_group_parts_part_box_items_item_padding}, /* dup */
427 {"collections.group.parts.part.table.items.item.align", st_collections_group_parts_part_box_items_item_align}, /* dup */
428 {"collections.group.parts.part.table.items.item.weight", st_collections_group_parts_part_box_items_item_weight}, /* dup */
429 {"collections.group.parts.part.table.items.item.aspect", st_collections_group_parts_part_box_items_item_aspect}, /* dup */
430 {"collections.group.parts.part.table.items.item.aspect_mode", st_collections_group_parts_part_box_items_item_aspect_mode}, /* dup */
431 {"collections.group.parts.part.table.items.item.options", st_collections_group_parts_part_box_items_item_options}, /* dup */
432 {"collections.group.parts.part.table.items.item.position", st_collections_group_parts_part_table_items_item_position},
433 {"collections.group.parts.part.table.items.item.span", st_collections_group_parts_part_table_items_item_span},
434 {"collections.group.parts.part.description.inherit", st_collections_group_parts_part_description_inherit},
435 {"collections.group.parts.part.description.source", st_collections_group_parts_part_description_source},
436 {"collections.group.parts.part.description.state", st_collections_group_parts_part_description_state},
437 {"collections.group.parts.part.description.visible", st_collections_group_parts_part_description_visible},
438 {"collections.group.parts.part.description.align", st_collections_group_parts_part_description_align},
439 {"collections.group.parts.part.description.fixed", st_collections_group_parts_part_description_fixed},
440 {"collections.group.parts.part.description.min", st_collections_group_parts_part_description_min},
441 {"collections.group.parts.part.description.max", st_collections_group_parts_part_description_max},
442 {"collections.group.parts.part.description.step", st_collections_group_parts_part_description_step},
443 {"collections.group.parts.part.description.aspect", st_collections_group_parts_part_description_aspect},
444 {"collections.group.parts.part.description.aspect_preference", st_collections_group_parts_part_description_aspect_preference},
445 {"collections.group.parts.part.description.rel1.relative", st_collections_group_parts_part_description_rel1_relative},
446 {"collections.group.parts.part.description.rel1.offset", st_collections_group_parts_part_description_rel1_offset},
447 {"collections.group.parts.part.description.rel1.to", st_collections_group_parts_part_description_rel1_to},
448 {"collections.group.parts.part.description.rel1.to_x", st_collections_group_parts_part_description_rel1_to_x},
449 {"collections.group.parts.part.description.rel1.to_y", st_collections_group_parts_part_description_rel1_to_y},
450 {"collections.group.parts.part.description.rel2.relative", st_collections_group_parts_part_description_rel2_relative},
451 {"collections.group.parts.part.description.rel2.offset", st_collections_group_parts_part_description_rel2_offset},
452 {"collections.group.parts.part.description.rel2.to", st_collections_group_parts_part_description_rel2_to},
453 {"collections.group.parts.part.description.rel2.to_x", st_collections_group_parts_part_description_rel2_to_x},
454 {"collections.group.parts.part.description.rel2.to_y", st_collections_group_parts_part_description_rel2_to_y},
455 {"collections.group.parts.part.description.image.normal", st_collections_group_parts_part_description_image_normal},
456 {"collections.group.parts.part.description.image.tween", st_collections_group_parts_part_description_image_tween},
457 {"collections.group.parts.part.description.image.image", st_images_image}, /* dup */
458 {"collections.group.parts.part.description.image.set.name", st_images_set_name},
459 {"collections.group.parts.part.description.image.set.image.image", st_images_set_image_image},
460 {"collections.group.parts.part.description.image.set.image.size", st_images_set_image_size},
461 {"collections.group.parts.part.description.image.images.image", st_images_image}, /* dup */
462 {"collections.group.parts.part.description.image.images.set.name", st_images_set_name},
463 {"collections.group.parts.part.description.image.images.set.image.image", st_images_set_image_image},
464 {"collections.group.parts.part.description.image.images.set.image.size", st_images_set_image_size},
465 {"collections.group.parts.part.description.image.border", st_collections_group_parts_part_description_image_border},
466 {"collections.group.parts.part.description.image.middle", st_collections_group_parts_part_description_image_middle},
467 {"collections.group.parts.part.description.image.border_scale", st_collections_group_parts_part_description_image_border_scale},
468 {"collections.group.parts.part.description.image.border_scale_by", st_collections_group_parts_part_description_image_border_scale_by},
469 {"collections.group.parts.part.description.image.scale_hint", st_collections_group_parts_part_description_image_scale_hint},
470 {"collections.group.parts.part.description.fill.smooth", st_collections_group_parts_part_description_fill_smooth},
471 {"collections.group.parts.part.description.fill.origin.relative", st_collections_group_parts_part_description_fill_origin_relative},
472 {"collections.group.parts.part.description.fill.origin.offset", st_collections_group_parts_part_description_fill_origin_offset},
473 {"collections.group.parts.part.description.fill.size.relative", st_collections_group_parts_part_description_fill_size_relative},
474 {"collections.group.parts.part.description.fill.size.offset", st_collections_group_parts_part_description_fill_size_offset},
475 {"collections.group.parts.part.description.fill.spread", st_collections_group_parts_part_description_fill_spread},
476 {"collections.group.parts.part.description.fill.type", st_collections_group_parts_part_description_fill_type},
477 {"collections.group.parts.part.description.color_class", st_collections_group_parts_part_description_color_class},
478 {"collections.group.parts.part.description.color", st_collections_group_parts_part_description_color},
479 {"collections.group.parts.part.description.color2", st_collections_group_parts_part_description_color2},
480 {"collections.group.parts.part.description.color3", st_collections_group_parts_part_description_color3},
481 {"collections.group.parts.part.description.text.text", st_collections_group_parts_part_description_text_text},
482 {"collections.group.parts.part.description.text.text_class", st_collections_group_parts_part_description_text_text_class},
483 {"collections.group.parts.part.description.text.font", st_collections_group_parts_part_description_text_font},
484 {"collections.group.parts.part.description.text.style", st_collections_group_parts_part_description_text_style},
485 {"collections.group.parts.part.description.text.repch", st_collections_group_parts_part_description_text_repch},
486 {"collections.group.parts.part.description.text.size", st_collections_group_parts_part_description_text_size},
487 {"collections.group.parts.part.description.text.size_range", st_collections_group_parts_part_description_text_size_range},
488 {"collections.group.parts.part.description.text.fit", st_collections_group_parts_part_description_text_fit},
489 {"collections.group.parts.part.description.text.min", st_collections_group_parts_part_description_text_min},
490 {"collections.group.parts.part.description.text.max", st_collections_group_parts_part_description_text_max},
491 {"collections.group.parts.part.description.text.align", st_collections_group_parts_part_description_text_align},
492 {"collections.group.parts.part.description.text.source", st_collections_group_parts_part_description_text_source},
493 {"collections.group.parts.part.description.text.text_source", st_collections_group_parts_part_description_text_text_source},
494 {"collections.group.parts.part.description.text.font", st_fonts_font}, /* dup */
495 {"collections.group.parts.part.description.text.fonts.font", st_fonts_font}, /* dup */
496 {"collections.group.parts.part.description.text.elipsis", st_collections_group_parts_part_description_text_elipsis},
497 {"collections.group.parts.part.description.text.ellipsis", st_collections_group_parts_part_description_text_elipsis},
498 {"collections.group.parts.part.description.box.layout", st_collections_group_parts_part_description_box_layout},
499 {"collections.group.parts.part.description.box.align", st_collections_group_parts_part_description_box_align},
500 {"collections.group.parts.part.description.box.padding", st_collections_group_parts_part_description_box_padding},
501 {"collections.group.parts.part.description.box.min", st_collections_group_parts_part_description_box_min},
502 {"collections.group.parts.part.description.table.homogeneous", st_collections_group_parts_part_description_table_homogeneous},
503 {"collections.group.parts.part.description.table.align", st_collections_group_parts_part_description_table_align},
504 {"collections.group.parts.part.description.table.padding", st_collections_group_parts_part_description_table_padding},
505 {"collections.group.parts.part.description.table.min", st_collections_group_parts_part_description_table_min},
506 {"collections.group.parts.part.description.map.perspective", st_collections_group_parts_part_description_map_perspective},
507 {"collections.group.parts.part.description.map.light", st_collections_group_parts_part_description_map_light},
508 {"collections.group.parts.part.description.map.rotation.center", st_collections_group_parts_part_description_map_rotation_center},
509 {"collections.group.parts.part.description.map.rotation.x", st_collections_group_parts_part_description_map_rotation_x},
510 {"collections.group.parts.part.description.map.rotation.y", st_collections_group_parts_part_description_map_rotation_y},
511 {"collections.group.parts.part.description.map.rotation.z", st_collections_group_parts_part_description_map_rotation_z},
512 {"collections.group.parts.part.description.map.on", st_collections_group_parts_part_description_map_on},
513 {"collections.group.parts.part.description.map.smooth", st_collections_group_parts_part_description_map_smooth},
514 {"collections.group.parts.part.description.map.alpha", st_collections_group_parts_part_description_map_alpha},
515 {"collections.group.parts.part.description.map.backface_cull", st_collections_group_parts_part_description_map_backface_cull},
516 {"collections.group.parts.part.description.map.perspective_on", st_collections_group_parts_part_description_map_perspective_on},
517 {"collections.group.parts.part.description.perspective.zplane", st_collections_group_parts_part_description_perspective_zplane},
518 {"collections.group.parts.part.description.perspective.focal", st_collections_group_parts_part_description_perspective_focal},
519 {"collections.group.parts.part.description.params.int", st_collections_group_parts_part_description_params_int},
520 {"collections.group.parts.part.description.params.double", st_collections_group_parts_part_description_params_double},
521 {"collections.group.parts.part.description.params.string", st_collections_group_parts_part_description_params_string},
522 {"collections.group.parts.part.description.params.bool", st_collections_group_parts_part_description_params_bool},
523 {"collections.group.parts.part.description.params.choice", st_collections_group_parts_part_description_params_choice},
524 {"collections.group.parts.part.description.images.image", st_images_image}, /* dup */
525 {"collections.group.parts.part.description.images.set.name", st_images_set_name},
526 {"collections.group.parts.part.description.images.set.image.image", st_images_set_image_image},
527 {"collections.group.parts.part.description.images.set.image.size", st_images_set_image_size},
528 {"collections.group.parts.part.description.font", st_fonts_font}, /* dup */
529 {"collections.group.parts.part.description.fonts.font", st_fonts_font}, /* dup */
530 {"collections.group.parts.part.description.styles.style.name", st_styles_style_name}, /* dup */
531 {"collections.group.parts.part.description.styles.style.base", st_styles_style_base}, /* dup */
532 {"collections.group.parts.part.description.styles.style.tag", st_styles_style_tag}, /* dup */
533 {"collections.group.parts.part.description.color_classes.color_class.name", st_color_class_name}, /* dup */
534 {"collections.group.parts.part.description.color_classes.color_class.color", st_color_class_color}, /* dup */
535 {"collections.group.parts.part.description.color_classes.color_class.color2", st_color_class_color2}, /* dup */
536 {"collections.group.parts.part.description.color_classes.color_class.color3", st_color_class_color3}, /* dup */
537 {"collections.group.parts.part.description.programs.image", st_images_image}, /* dup */
538 {"collections.group.parts.part.description.programs.set.name", st_images_set_name},
539 {"collections.group.parts.part.description.programs.set.image.image", st_images_set_image_image},
540 {"collections.group.parts.part.description.programs.set.image.size", st_images_set_image_size},
541 {"collections.group.parts.part.description.programs.images.image", st_images_image}, /* dup */
542 {"collections.group.parts.part.description.programs.images.set.name", st_images_set_name},
543 {"collections.group.parts.part.description.programs.images.set.image.image", st_images_set_image_image},
544 {"collections.group.parts.part.description.programs.images.set.image.size", st_images_set_image_size},
545 {"collections.group.parts.part.description.programs.font", st_fonts_font}, /* dup */
546 {"collections.group.parts.part.description.programs.fonts.font", st_fonts_font}, /* dup */
547 {"collections.group.parts.part.description.programs.program.name", st_collections_group_programs_program_name}, /* dup */
548 {"collections.group.parts.part.description.programs.program.signal", st_collections_group_programs_program_signal}, /* dup */
549 {"collections.group.parts.part.description.programs.program.source", st_collections_group_programs_program_source}, /* dup */
550 {"collections.group.parts.part.description.programs.program.in", st_collections_group_programs_program_in}, /* dup */
551 {"collections.group.parts.part.description.programs.program.action", st_collections_group_programs_program_action}, /* dup */
552 {"collections.group.parts.part.description.programs.program.transition", st_collections_group_programs_program_transition}, /* dup */
553 {"collections.group.parts.part.description.programs.program.target", st_collections_group_programs_program_target}, /* dup */
554 {"collections.group.parts.part.description.programs.program.after", st_collections_group_programs_program_after}, /* dup */
555 {"collections.group.parts.part.description.programs.program.api", st_collections_group_programs_program_api}, /* dup */
556 {"collections.group.parts.part.description.program.name", st_collections_group_programs_program_name}, /* dup */
557 {"collections.group.parts.part.description.program.signal", st_collections_group_programs_program_signal}, /* dup */
558 {"collections.group.parts.part.description.program.source", st_collections_group_programs_program_source}, /* dup */
559 {"collections.group.parts.part.description.program.in", st_collections_group_programs_program_in}, /* dup */
560 {"collections.group.parts.part.description.program.action", st_collections_group_programs_program_action}, /* dup */
561 {"collections.group.parts.part.description.program.transition", st_collections_group_programs_program_transition}, /* dup */
562 {"collections.group.parts.part.description.program.target", st_collections_group_programs_program_target}, /* dup */
563 {"collections.group.parts.part.description.program.after", st_collections_group_programs_program_after}, /* dup */
564 {"collections.group.parts.part.description.program.api", st_collections_group_programs_program_api}, /* dup */
565 {"collections.group.parts.part.programs.image", st_images_image}, /* dup */
566 {"collections.group.parts.part.programs.set.name", st_images_set_name},
567 {"collections.group.parts.part.programs.set.image.image", st_images_set_image_image},
568 {"collections.group.parts.part.programs.set.image.size", st_images_set_image_size},
569 {"collections.group.parts.part.programs.images.image", st_images_image}, /* dup */
570 {"collections.group.parts.part.programs.images.set.name", st_images_set_name},
571 {"collections.group.parts.part.programs.images.set.image.image", st_images_set_image_image},
572 {"collections.group.parts.part.programs.images.set.image.size", st_images_set_image_size},
573 {"collections.group.parts.part.programs.font", st_fonts_font}, /* dup */
574 {"collections.group.parts.part.programs.fonts.font", st_fonts_font}, /* dup */
575 {"collections.group.parts.part.programs.program.name", st_collections_group_programs_program_name}, /* dup */
576 {"collections.group.parts.part.programs.program.signal", st_collections_group_programs_program_signal}, /* dup */
577 {"collections.group.parts.part.programs.program.source", st_collections_group_programs_program_source}, /* dup */
578 {"collections.group.parts.part.programs.program.in", st_collections_group_programs_program_in}, /* dup */
579 {"collections.group.parts.part.programs.program.action", st_collections_group_programs_program_action}, /* dup */
580 {"collections.group.parts.part.programs.program.transition", st_collections_group_programs_program_transition}, /* dup */
581 {"collections.group.parts.part.programs.program.target", st_collections_group_programs_program_target}, /* dup */
582 {"collections.group.parts.part.programs.program.after", st_collections_group_programs_program_after}, /* dup */
583 {"collections.group.parts.part.programs.program.api", st_collections_group_programs_program_api}, /* dup */
584 {"collections.group.parts.part.program.name", st_collections_group_programs_program_name}, /* dup */
585 {"collections.group.parts.part.program.signal", st_collections_group_programs_program_signal}, /* dup */
586 {"collections.group.parts.part.program.source", st_collections_group_programs_program_source}, /* dup */
587 {"collections.group.parts.part.program.in", st_collections_group_programs_program_in}, /* dup */
588 {"collections.group.parts.part.program.action", st_collections_group_programs_program_action}, /* dup */
589 {"collections.group.parts.part.program.transition", st_collections_group_programs_program_transition}, /* dup */
590 {"collections.group.parts.part.program.target", st_collections_group_programs_program_target}, /* dup */
591 {"collections.group.parts.part.program.after", st_collections_group_programs_program_after}, /* dup */
592 {"collections.group.parts.part.program.api", st_collections_group_programs_program_api}, /* dup */
593 {"collections.group.parts.programs.image", st_images_image}, /* dup */
594 {"collections.group.parts.programs.set.name", st_images_set_name},
595 {"collections.group.parts.programs.set.image.image", st_images_set_image_image},
596 {"collections.group.parts.programs.set.image.size", st_images_set_image_size},
597 {"collections.group.parts.programs.images.image", st_images_image}, /* dup */
598 {"collections.group.parts.programs.images.set.name", st_images_set_name},
599 {"collections.group.parts.programs.images.set.image.image", st_images_set_image_image},
600 {"collections.group.parts.programs.images.set.image.size", st_images_set_image_size},
601 {"collections.group.parts.programs.font", st_fonts_font}, /* dup */
602 {"collections.group.parts.programs.fonts.font", st_fonts_font}, /* dup */
603 {"collections.group.parts.programs.program.name", st_collections_group_programs_program_name}, /* dup */
604 {"collections.group.parts.programs.program.signal", st_collections_group_programs_program_signal}, /* dup */
605 {"collections.group.parts.programs.program.source", st_collections_group_programs_program_source}, /* dup */
606 {"collections.group.parts.programs.program.filter", st_collections_group_programs_program_filter}, /* dup */
607 {"collections.group.parts.programs.program.in", st_collections_group_programs_program_in}, /* dup */
608 {"collections.group.parts.programs.program.action", st_collections_group_programs_program_action}, /* dup */
609 {"collections.group.parts.programs.program.transition", st_collections_group_programs_program_transition}, /* dup */
610 {"collections.group.parts.programs.program.target", st_collections_group_programs_program_target}, /* dup */
611 {"collections.group.parts.programs.program.after", st_collections_group_programs_program_after},
612 {"collections.group.parts.programs.program.api", st_collections_group_programs_program_api},
613 {"collections.group.parts.program.name", st_collections_group_programs_program_name}, /* dup */
614 {"collections.group.parts.program.signal", st_collections_group_programs_program_signal}, /* dup */
615 {"collections.group.parts.program.source", st_collections_group_programs_program_source}, /* dup */
616 {"collections.group.parts.program.filter", st_collections_group_programs_program_filter}, /* dup */
617 {"collections.group.parts.program.in", st_collections_group_programs_program_in}, /* dup */
618 {"collections.group.parts.program.action", st_collections_group_programs_program_action}, /* dup */
619 {"collections.group.parts.program.transition", st_collections_group_programs_program_transition}, /* dup */
620 {"collections.group.parts.program.target", st_collections_group_programs_program_target}, /* dup */
621 {"collections.group.parts.program.after", st_collections_group_programs_program_after}, /* dup */
622 {"collections.group.parts.program.api", st_collections_group_programs_program_api}, /* dup */
623 {"collections.group.program.name", st_collections_group_programs_program_name}, /* dup */
624 {"collections.group.program.signal", st_collections_group_programs_program_signal}, /* dup */
625 {"collections.group.program.source", st_collections_group_programs_program_source}, /* dup */
626 {"collections.group.program.filter", st_collections_group_programs_program_filter}, /* dup */
627 {"collections.group.program.in", st_collections_group_programs_program_in}, /* dup */
628 {"collections.group.program.action", st_collections_group_programs_program_action}, /* dup */
629 {"collections.group.program.transition", st_collections_group_programs_program_transition}, /* dup */
630 {"collections.group.program.target", st_collections_group_programs_program_target}, /* dup */
631 {"collections.group.program.after", st_collections_group_programs_program_after}, /* dup */
632 {"collections.group.program.api", st_collections_group_programs_program_api}, /* dup */
633 {"collections.group.programs.program.name", st_collections_group_programs_program_name},
634 {"collections.group.programs.program.signal", st_collections_group_programs_program_signal},
635 {"collections.group.programs.program.source", st_collections_group_programs_program_source},
636 {"collections.group.programs.program.filter", st_collections_group_programs_program_filter}, /* dup */
637 {"collections.group.programs.program.in", st_collections_group_programs_program_in},
638 {"collections.group.programs.program.action", st_collections_group_programs_program_action},
639 {"collections.group.programs.program.transition", st_collections_group_programs_program_transition},
640 {"collections.group.programs.program.target", st_collections_group_programs_program_target},
641 {"collections.group.programs.program.after", st_collections_group_programs_program_after},
642 {"collections.group.programs.program.api", st_collections_group_programs_program_api},
643 {"collections.group.programs.image", st_images_image}, /* dup */
644 {"collections.group.programs.set.name", st_images_set_name},
645 {"collections.group.programs.set.image.image", st_images_set_image_image},
646 {"collections.group.programs.set.image.size", st_images_set_image_size},
647 {"collections.group.programs.images.image", st_images_image}, /* dup */
648 {"collections.group.programs.images.set.name", st_images_set_name},
649 {"collections.group.programs.images.set.image.image", st_images_set_image_image},
650 {"collections.group.programs.images.set.image.size", st_images_set_image_size},
651 {"collections.group.programs.font", st_fonts_font}, /* dup */
652 {"collections.group.programs.fonts.font", st_fonts_font} /* dup */
653};
654
655New_Object_Handler object_handlers[] =
656{
657 {"externals", NULL},
658 {"images", NULL},
659 {"images.set", ob_images_set},
660 {"images.set.image", ob_images_set_image},
661 {"fonts", NULL},
662 {"data", NULL},
663 {"styles", NULL},
664 {"styles.style", ob_styles_style},
665 {"color_classes", NULL},
666 {"color_classes.color_class", ob_color_class},
667 {"spectra", NULL},
668 {"collections", ob_collections},
669 {"collections.externals", NULL}, /* dup */
670 {"collections.set", ob_images_set}, /* dup */
671 {"collections.set.image", ob_images_set_image}, /* dup */
672 {"collections.images", NULL}, /* dup */
673 {"collections.images.set", ob_images_set}, /* dup */
674 {"collections.images.set.image", ob_images_set_image}, /* dup */
675 {"collections.fonts", NULL}, /* dup */
676 {"collections.styles", NULL}, /* dup */
677 {"collections.styles.style", ob_styles_style}, /* dup */
678 {"collections.color_classes", NULL}, /* dup */
679 {"collections.color_classes.color_class", ob_color_class}, /* dup */
680#ifdef ENABLE_MULTISENSE
681 {"collections.sounds", NULL},
682 {"collections.group.sounds", NULL}, /* dup */
683 {"collections.sounds.sample", NULL},
684 {"collections.group.sounds.sample", NULL}, /* dup */
685#endif
686 {"collections.group", ob_collections_group},
687 {"collections.group.data", NULL},
688 {"collections.group.script", ob_collections_group_script},
689 {"collections.group.lua_script", ob_collections_group_lua_script},
690 {"collections.group.externals", NULL}, /* dup */
691 {"collections.group.set", ob_images_set}, /* dup */
692 {"collections.group.set.image", ob_images_set_image}, /* dup */
693 {"collections.group.images", NULL}, /* dup */
694 {"collections.group.images.set", ob_images_set}, /* dup */
695 {"collections.group.images.set.image", ob_images_set_image}, /* dup */
696 {"collections.group.fonts", NULL}, /* dup */
697 {"collections.group.styles", NULL}, /* dup */
698 {"collections.group.styles.style", ob_styles_style}, /* dup */
699 {"collections.group.color_classes", NULL}, /* dup */
700 {"collections.group.color_classes.color_class", ob_color_class}, /* dup */
701 {"collections.group.parts", NULL},
702 {"collections.group.parts.set", ob_images_set}, /* dup */
703 {"collections.group.parts.set.image", ob_images_set_image}, /* dup */
704 {"collections.group.parts.images", NULL}, /* dup */
705 {"collections.group.parts.images.set", ob_images_set}, /* dup */
706 {"collections.group.parts.images.set.image", ob_images_set_image}, /* dup */
707 {"collections.group.parts.fonts", NULL}, /* dup */
708 {"collections.group.parts.styles", NULL}, /* dup */
709 {"collections.group.parts.styles.style", ob_styles_style}, /* dup */
710 {"collections.group.parts.color_classes", NULL}, /* dup */
711 {"collections.group.parts.color_classes.color_class", ob_color_class}, /* dup */
712 {"collections.group.parts.part", ob_collections_group_parts_part},
713 {"collections.group.parts.part.dragable", NULL},
714 {"collections.group.parts.part.set", ob_images_set}, /* dup */
715 {"collections.group.parts.part.set.image", ob_images_set_image}, /* dup */
716 {"collections.group.parts.part.images", NULL}, /* dup */
717 {"collections.group.parts.part.images.set", ob_images_set}, /* dup */
718 {"collections.group.parts.part.images.set.image", ob_images_set_image}, /* dup */
719 {"collections.group.parts.part.fonts", NULL}, /* dup */
720 {"collections.group.parts.part.styles", NULL}, /* dup */
721 {"collections.group.parts.part.styles.style", ob_styles_style}, /* dup */
722 {"collections.group.parts.part.color_classes", NULL}, /* dup */
723 {"collections.group.parts.part.color_classes.color_class", ob_color_class}, /* dup */
724 {"collections.group.parts.part.box", NULL},
725 {"collections.group.parts.part.box.items", NULL},
726 {"collections.group.parts.part.box.items.item", ob_collections_group_parts_part_box_items_item},
727 {"collections.group.parts.part.table", NULL},
728 {"collections.group.parts.part.table.items", NULL},
729 {"collections.group.parts.part.table.items.item", ob_collections_group_parts_part_box_items_item}, /* dup */
730 {"collections.group.parts.part.description", ob_collections_group_parts_part_description},
731 {"collections.group.parts.part.description.rel1", NULL},
732 {"collections.group.parts.part.description.rel2", NULL},
733 {"collections.group.parts.part.description.image", NULL}, /* dup */
734 {"collections.group.parts.part.description.image.set", ob_images_set}, /* dup */
735 {"collections.group.parts.part.description.image.set.image", ob_images_set_image}, /* dup */
736 {"collections.group.parts.part.description.image.images", NULL}, /* dup */
737 {"collections.group.parts.part.description.image.images.set", ob_images_set}, /* dup */
738 {"collections.group.parts.part.description.image.images.set.image", ob_images_set_image}, /* dup */
739 {"collections.group.parts.part.description.fill", NULL},
740 {"collections.group.parts.part.description.fill.origin", NULL},
741 {"collections.group.parts.part.description.fill.size", NULL},
742 {"collections.group.parts.part.description.text", NULL},
743 {"collections.group.parts.part.description.text.fonts", NULL}, /* dup */
744 {"collections.group.parts.part.description.images", NULL}, /* dup */
745 {"collections.group.parts.part.description.images.set", ob_images_set}, /* dup */
746 {"collections.group.parts.part.description.images.set.image", ob_images_set_image}, /* dup */
747 {"collections.group.parts.part.description.fonts", NULL}, /* dup */
748 {"collections.group.parts.part.description.styles", NULL}, /* dup */
749 {"collections.group.parts.part.description.styles.style", ob_styles_style}, /* dup */
750 {"collections.group.parts.part.description.box", NULL},
751 {"collections.group.parts.part.description.table", NULL},
752 {"collections.group.parts.part.description.map", NULL},
753 {"collections.group.parts.part.description.map.rotation", NULL},
754 {"collections.group.parts.part.description.perspective", NULL},
755 {"collections.group.parts.part.description.params", NULL},
756 {"collections.group.parts.part.description.color_classes", NULL}, /* dup */
757 {"collections.group.parts.part.description.color_classes.color_class", ob_color_class}, /* dup */
758 {"collections.group.parts.part.description.program", ob_collections_group_programs_program}, /* dup */
759 {"collections.group.parts.part.description.program.script", ob_collections_group_programs_program_script}, /* dup */
760 {"collections.group.parts.part.description.programs", NULL}, /* dup */
761 {"collections.group.parts.part.description.programs.set", ob_images_set}, /* dup */
762 {"collections.group.parts.part.description.programs.set.image", ob_images_set_image}, /* dup */
763 {"collections.group.parts.part.description.programs.images", NULL}, /* dup */
764 {"collections.group.parts.part.description.programs.images.set", ob_images_set},
765 {"collections.group.parts.part.description.programs.images.set.image", ob_images_set_image}, /* dup */
766 {"collections.group.parts.part.description.programs.fonts", NULL}, /* dup */
767 {"collections.group.parts.part.description.programs.program", ob_collections_group_programs_program}, /* dup */
768 {"collections.group.parts.part.description.programs.program.script", ob_collections_group_programs_program_script}, /* dup */
769 {"collections.group.parts.part.description.script", ob_collections_group_script}, /* dup */
770 {"collections.group.parts.part.program", ob_collections_group_programs_program}, /* dup */
771 {"collections.group.parts.part.program.script", ob_collections_group_programs_program_script}, /* dup */
772 {"collections.group.parts.part.programs", NULL}, /* dup */
773 {"collections.group.parts.part.programs.set", ob_images_set}, /* dup */
774 {"collections.group.parts.part.programs.set.image", ob_images_set_image}, /* dup */
775 {"collections.group.parts.part.programs.images", NULL}, /* dup */
776 {"collections.group.parts.part.programs.images.set", ob_images_set}, /* dup */
777 {"collections.group.parts.part.programs.images.set.image", ob_images_set_image}, /* dup */
778 {"collections.group.parts.part.programs.fonts", NULL}, /* dup */
779 {"collections.group.parts.part.programs.program", ob_collections_group_programs_program}, /* dup */
780 {"collections.group.parts.part.programs.program.script", ob_collections_group_programs_program_script}, /* dup */
781 {"collections.group.parts.part.script", ob_collections_group_script}, /* dup */
782 {"collections.group.parts.program", ob_collections_group_programs_program}, /* dup */
783 {"collections.group.parts.program.script", ob_collections_group_programs_program_script}, /* dup */
784 {"collections.group.parts.programs", NULL}, /* dup */
785 {"collections.group.parts.programs.set", ob_images_set}, /* dup */
786 {"collections.group.parts.programs.set.image", ob_images_set_image}, /* dup */
787 {"collections.group.parts.programs.images", NULL}, /* dup */
788 {"collections.group.parts.programs.images.set", ob_images_set}, /* dup */
789 {"collections.group.parts.programs.images.set.image", ob_images_set_image}, /* dup */
790 {"collections.group.parts.programs.fonts", NULL}, /* dup */
791 {"collections.group.parts.programs.program", ob_collections_group_programs_program}, /* dup */
792 {"collections.group.parts.programs.program.script", ob_collections_group_programs_program_script}, /* dup */
793 {"collections.group.parts.script", ob_collections_group_script}, /* dup */
794 {"collections.group.program", ob_collections_group_programs_program}, /* dup */
795 {"collections.group.program.script", ob_collections_group_programs_program_script}, /* dup */
796 {"collections.group.programs", NULL},
797 {"collections.group.programs.set", ob_images_set}, /* dup */
798 {"collections.group.programs.set.image", ob_images_set_image}, /* dup */
799 {"collections.group.programs.images", NULL}, /* dup */
800 {"collections.group.programs.images.set", ob_images_set}, /* dup */
801 {"collections.group.programs.images.set.image", ob_images_set_image}, /* dup */
802 {"collections.group.programs.fonts", NULL}, /* dup */
803 {"collections.group.programs.program", ob_collections_group_programs_program},
804 {"collections.group.programs.program.script", ob_collections_group_programs_program_script},
805 {"collections.group.programs.script", ob_collections_group_script} /* dup */
806};
807
808/*****/
809
810int
811object_handler_num(void)
812{
813 return sizeof(object_handlers) / sizeof (New_Object_Handler);
814}
815
816int
817statement_handler_num(void)
818{
819 return sizeof(statement_handlers) / sizeof (New_Object_Handler);
820}
821
822static void
823_edje_part_description_fill(Edje_Part_Description_Spec_Fill *fill)
824{
825 fill->smooth = 1;
826 fill->pos_rel_x = FROM_DOUBLE(0.0);
827 fill->pos_abs_x = 0;
828 fill->rel_x = FROM_DOUBLE(1.0);
829 fill->abs_x = 0;
830 fill->pos_rel_y = FROM_DOUBLE(0.0);
831 fill->pos_abs_y = 0;
832 fill->rel_y = FROM_DOUBLE(1.0);
833 fill->abs_y = 0;
834 fill->angle = 0;
835 fill->spread = 0;
836 fill->type = EDJE_FILL_TYPE_SCALE;
837}
838
839static Edje_Part_Description_Common *
840_edje_part_description_alloc(unsigned char type, const char *collection, const char *part)
841{
842 Edje_Part_Description_Common *result = NULL;
843
844 switch (type)
845 {
846 case EDJE_PART_TYPE_RECTANGLE:
847 case EDJE_PART_TYPE_SWALLOW:
848 case EDJE_PART_TYPE_GROUP:
849 result = mem_alloc(SZ(Edje_Part_Description_Common));
850 break;
851 case EDJE_PART_TYPE_TEXT:
852 case EDJE_PART_TYPE_TEXTBLOCK:
853 {
854 Edje_Part_Description_Text *ed;
855
856 ed = mem_alloc(SZ(Edje_Part_Description_Text));
857
858 ed->text.color3.r = 0;
859 ed->text.color3.g = 0;
860 ed->text.color3.b = 0;
861 ed->text.color3.a = 128;
862 ed->text.align.x = FROM_DOUBLE(0.5);
863 ed->text.align.y = FROM_DOUBLE(0.5);
864 ed->text.id_source = -1;
865 ed->text.id_text_source = -1;
866
867 result = &ed->common;
868 break;
869 }
870 case EDJE_PART_TYPE_IMAGE:
871 {
872 Edje_Part_Description_Image *ed;
873
874 ed = mem_alloc(SZ(Edje_Part_Description_Image));
875
876 ed->image.id = -1;
877
878 _edje_part_description_fill(&ed->image.fill);
879
880 result = &ed->common;
881 break;
882 }
883 case EDJE_PART_TYPE_PROXY:
884 {
885 Edje_Part_Description_Proxy *ed;
886
887 ed = mem_alloc(SZ(Edje_Part_Description_Proxy));
888
889 ed->proxy.id = -1;
890
891 _edje_part_description_fill(&ed->proxy.fill);
892
893 result = &ed->common;
894 break;
895 }
896 case EDJE_PART_TYPE_BOX:
897 {
898 Edje_Part_Description_Box *ed;
899
900 ed = mem_alloc(SZ(Edje_Part_Description_Box));
901
902 ed->box.layout = NULL;
903 ed->box.alt_layout = NULL;
904 ed->box.align.x = FROM_DOUBLE(0.5);
905 ed->box.align.y = FROM_DOUBLE(0.5);
906 ed->box.padding.x = 0;
907 ed->box.padding.y = 0;
908
909 result = &ed->common;
910 break;
911 }
912 case EDJE_PART_TYPE_TABLE:
913 {
914 Edje_Part_Description_Table *ed;
915
916 ed = mem_alloc(SZ(Edje_Part_Description_Table));
917
918 ed->table.homogeneous = EDJE_OBJECT_TABLE_HOMOGENEOUS_NONE;
919 ed->table.align.x = FROM_DOUBLE(0.5);
920 ed->table.align.y = FROM_DOUBLE(0.5);
921 ed->table.padding.x = 0;
922 ed->table.padding.y = 0;
923
924 result = &ed->common;
925 break;
926 }
927 case EDJE_PART_TYPE_EXTERNAL:
928 {
929 Edje_Part_Description_External *ed;
930
931 ed = mem_alloc(SZ(Edje_Part_Description_External));
932
933 ed->external_params = NULL;
934
935 result = &ed->common;
936 break;
937 }
938 }
939
940 if (!result)
941 {
942 ERR("%s: Error. Unknown type %i of part %s in collection %s.", progname, type, part, collection);
943 exit(-1);
944 }
945
946 return result;
947}
948
949static void
950_edje_program_check(const char *name, Edje_Program *me, Edje_Program **pgrms, unsigned int count)
951{
952 Edje_Part_Collection *pc;
953 unsigned int i;
954 Edje_Program_Parser *epp;
955
956 pc = eina_list_data_get(eina_list_last(edje_collections));
957
958 for (i = 0; i < count; ++i)
959 if (pgrms[i]->name)
960 if (pgrms[i] != me && (!strcmp(name, pgrms[i]->name)))
961 {
962 epp = (Edje_Program_Parser *)pgrms[i];
963 if (!epp->can_override)
964 {
965 ERR("%s: Error. parse error %s:%i. There is already a program of the name %s\n",
966 progname, file_in, line - 1, name);
967 exit(-1);
968 }
969 else
970 {
971 _edje_program_remove(pc, me);
972 current_program = pgrms[i];
973 epp->can_override = EINA_FALSE;
974 return;
975 }
976 }
977}
978
979static void
980_edje_program_copy(Edje_Program *ep, Edje_Program *ep2)
981{
982 Edje_Part_Collection *pc;
983 Edje_Program_Target *et, *et2;
984 Edje_Program_After *pa, *pa2;
985 Edje_Program_Parser *epp;
986 Eina_List *l;
987 char *name;
988 char *copy;
989
990 pc = eina_list_data_get(eina_list_last(edje_collections));
991
992 #define STRDUP(x) x ? strdup(x) : NULL
993 ep->name = STRDUP(ep2->name);
994
995 _edje_program_remove(pc, current_program);
996 ep->signal = STRDUP(ep2->signal);
997 ep->source = STRDUP(ep2->source);
998 _edje_program_insert(pc, current_program);
999
1000 ep->filter.part = STRDUP(ep2->filter.part);
1001 ep->filter.state = STRDUP(ep2->filter.state);
1002 ep->in.from = ep2->in.from;
1003 ep->in.range = ep2->in.range;
1004 ep->action = ep2->action;
1005 ep->state = STRDUP(ep2->state);
1006 ep->state2 = STRDUP(ep2->state2);
1007 ep->value = ep2->value;
1008 ep->value2 = ep2->value2;
1009 ep->tween.mode = ep2->tween.mode;
1010 ep->tween.time = ep2->tween.time;
1011 ep->tween.v1 = ep2->tween.v1;
1012 ep->tween.v2 = ep2->tween.v2;
1013
1014 EINA_LIST_FOREACH(ep2->targets, l, et2)
1015 {
1016 name = (char*) (et2 + 1);
1017 et = mem_alloc(SZ(Edje_Program_Target) + strlen(name) + 1);
1018 ep->targets = eina_list_append(ep->targets, et);
1019 copy = (char*) (et + 1);
1020
1021 memcpy(copy, name, strlen(name) + 1);
1022
1023 if (ep2->action == EDJE_ACTION_TYPE_STATE_SET)
1024 data_queue_copied_part_lookup(pc, &(et2->id), &(et->id));
1025 else if (ep2->action == EDJE_ACTION_TYPE_ACTION_STOP)
1026 data_queue_copied_program_lookup(pc, &(et2->id), &(et->id));
1027 else if (ep2->action == EDJE_ACTION_TYPE_DRAG_VAL_SET)
1028 data_queue_copied_part_lookup(pc, &(et2->id), &(et->id));
1029 else if (ep2->action == EDJE_ACTION_TYPE_DRAG_VAL_STEP)
1030 data_queue_copied_part_lookup(pc, &(et2->id), &(et->id));
1031 else if (ep2->action == EDJE_ACTION_TYPE_DRAG_VAL_PAGE)
1032 data_queue_copied_part_lookup(pc, &(et2->id), &(et->id));
1033 else if (ep2->action == EDJE_ACTION_TYPE_FOCUS_SET)
1034
1035 data_queue_copied_part_lookup(pc, &(et2->id), &(et->id));
1036 else if (ep2->action == EDJE_ACTION_TYPE_FOCUS_OBJECT)
1037 data_queue_copied_part_lookup(pc, &(et2->id), &(et->id));
1038 else
1039 {
1040 ERR("%s: Error. parse error %s:%i. "
1041 "target may only be used after action",
1042 progname, file_in, line - 1);
1043 exit(-1);
1044 }
1045 }
1046
1047 EINA_LIST_FOREACH(ep2->after, l, pa2)
1048 {
1049 pa = mem_alloc(SZ(Edje_Program_After));
1050 ep->after = eina_list_append(ep->after, pa);
1051
1052 data_queue_copied_program_lookup(pc, &(pa2->id), &(pa->id));
1053 }
1054
1055 ep->api.name = STRDUP(ep2->api.name);
1056 ep->api.description = STRDUP(ep2->api.description);
1057 data_queue_copied_part_lookup(pc, &(ep2->param.src), &(ep->param.src));
1058 data_queue_copied_part_lookup(pc, &(ep2->param.dst), &(ep->param.dst));
1059
1060 epp = (Edje_Program_Parser *)ep;
1061 epp->can_override = EINA_TRUE;
1062
1063 #undef STRDUP
1064}
1065
1066/*****/
1067
1068/**
1069 @edcsection{toplevel,Top-Level blocks}
1070 */
1071
1072/**
1073 @page edcref
1074
1075 @block
1076 externals
1077 @context
1078 externals {
1079 external: "name";
1080 }
1081 @description
1082 The "externals" block is used to list each external module file that will be used in others
1083 programs.
1084 @endblock
1085
1086 @property
1087 external
1088 @parameters
1089 [external filename]
1090 @effect
1091 Used to add a file to the externals list.
1092 @endproperty
1093 */
1094static void
1095st_externals_external(void)
1096{
1097 External *ex;
1098
1099 check_arg_count(1);
1100
1101 if (!edje_file->external_dir)
1102 edje_file->external_dir = mem_alloc(SZ(Edje_External_Directory));
1103
1104 ex = mem_alloc(SZ(External));
1105 ex->name = parse_str(0);
1106 {
1107 Eina_List *l;
1108 External *lex;
1109
1110 EINA_LIST_FOREACH(externals, l, lex)
1111 {
1112 if (!strcmp(lex->name, ex->name))
1113 {
1114 free(ex->name);
1115 free(ex);
1116 return;
1117 }
1118 }
1119 }
1120 externals = eina_list_append(externals, ex);
1121
1122 if (edje_file->external_dir)
1123 {
1124 edje_file->external_dir->entries_count++;
1125 edje_file->external_dir->entries = realloc(edje_file->external_dir->entries,
1126 sizeof (Edje_External_Directory) * edje_file->external_dir->entries_count);
1127 memset(edje_file->external_dir->entries + edje_file->external_dir->entries_count - 1,
1128 0, sizeof (Edje_External_Directory));
1129 if (!edje_file->external_dir->entries)
1130 {
1131 ERR("%s: Error. not enough memory", progname);
1132 exit(-1);
1133 }
1134
1135 edje_file->external_dir->entries[edje_file->external_dir->entries_count - 1].entry = mem_strdup(ex->name);
1136 }
1137}
1138
1139/**
1140 @page edcref
1141
1142 @block
1143 images
1144 @context
1145 images {
1146 image: "filename1.ext" COMP;
1147 image: "filename2.ext" LOSSY 99;
1148 set {
1149 name: "image_name_used";
1150 image {
1151 image: "filename3.ext" LOSSY 90;
1152 size: 201 201 500 500;
1153 }
1154 image {
1155 image: "filename4.ext" COMP;
1156 size: 51 51 200 200;
1157 }
1158 image {
1159 image: "filename5.ext" COMP;
1160 size: 11 11 50 50;
1161 }
1162 image {
1163 image: "filename6.ext" RAW;
1164 size: 0 0 10 10;
1165 }
1166 }
1167 ..
1168 }
1169 @description
1170 The "images" block is used to list each image file that will be used in
1171 the theme along with its compression method (if any).
1172 Besides the document's root, additional "images" blocks can be
1173 included inside other blocks, normally "collections", "group" and
1174 "part", easing maintenance of the file list when the theme is split
1175 among multiple files.
1176 @endblock
1177
1178 @property
1179 image
1180 @parameters
1181 [image file] [compression method] (compression level)
1182 @effect
1183 Used to include each image file. The full path to the directory holding
1184 the images can be defined later with edje_cc's "-id" option.
1185 Compression methods:
1186 @li RAW: Uncompressed.
1187 @li COMP: Lossless compression.
1188 @li LOSSY [0-100]: Lossy comression with quality from 0 to 100.
1189 @li USER: Do not embed the file, refer to the external file instead.
1190 @endproperty
1191 */
1192static void
1193st_images_image(void)
1194{
1195 Edje_Image_Directory_Entry *img;
1196 const char *tmp;
1197 unsigned int i;
1198 int v;
1199
1200 if (!edje_file->image_dir)
1201 edje_file->image_dir = mem_alloc(SZ(Edje_Image_Directory));
1202
1203 tmp = parse_str(0);
1204
1205 for (i = 0; i < edje_file->image_dir->entries_count; ++i)
1206 if (!strcmp(edje_file->image_dir->entries[i].entry, tmp))
1207 {
1208 free((char*) tmp);
1209 return;
1210 }
1211
1212 edje_file->image_dir->entries_count++;
1213 edje_file->image_dir->entries = realloc(edje_file->image_dir->entries,
1214 sizeof (Edje_Image_Directory_Entry) * edje_file->image_dir->entries_count);
1215 memset(edje_file->image_dir->entries + edje_file->image_dir->entries_count - 1,
1216 0, sizeof (Edje_Image_Directory_Entry));
1217 if (!edje_file->image_dir->entries)
1218 {
1219 ERR("%s: Error. No enough memory.", progname);
1220 exit(-1);
1221 }
1222
1223 img = edje_file->image_dir->entries + edje_file->image_dir->entries_count - 1;
1224
1225 img->entry = tmp;
1226 img->id = edje_file->image_dir->entries_count - 1;
1227 v = parse_enum(1,
1228 "RAW", 0,
1229 "COMP", 1,
1230 "LOSSY", 2,
1231 "USER", 3,
1232 NULL);
1233 if (v == 0)
1234 {
1235 img->source_type = EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT;
1236 img->source_param = 0;
1237 }
1238 else if (v == 1)
1239 {
1240 img->source_type = EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT;
1241 img->source_param = 1;
1242 }
1243 else if (v == 2)
1244 {
1245 img->source_type = EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY;
1246 img->source_param = 0;
1247 }
1248 else if (v == 3)
1249 {
1250 img->source_type = EDJE_IMAGE_SOURCE_TYPE_EXTERNAL;
1251 img->source_param = 0;
1252 }
1253 if (img->source_type != EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY)
1254 check_arg_count(2);
1255 else
1256 {
1257 img->source_param = parse_int_range(2, 0, 100);
1258 check_arg_count(3);
1259 }
1260}
1261
1262/**
1263 @page edcref
1264
1265 @block
1266 set
1267 @context
1268 set {
1269 name: "image_name_used";
1270 image {
1271 image: "filename3.ext" LOSSY 90;
1272 size: 201 201 500 500;
1273 }
1274 image {
1275 image: "filename4.ext" COMP;
1276 size: 51 51 200 200;
1277 }
1278 image {
1279 image: "filename5.ext" COMP;
1280 size: 11 11 50 50;
1281 }
1282 image {
1283 image: "filename6.ext" RAW;
1284 size: 0 0 10 10;
1285 }
1286 }
1287 @description
1288 The "set" block is used to define an image with different content depending on their size.
1289 Besides the document's root, additional "set" blocks can be
1290 included inside other blocks, normally "collections", "group" and
1291 "part", easing maintenance of the file list when the theme is split
1292 among multiple files.
1293 @endblock
1294 */
1295static void
1296ob_images_set(void)
1297{
1298 if (!edje_file->image_dir)
1299 edje_file->image_dir = mem_alloc(SZ(Edje_Image_Directory));
1300
1301 edje_file->image_dir->sets_count++;
1302 edje_file->image_dir->sets = realloc(edje_file->image_dir->sets,
1303 sizeof (Edje_Image_Directory_Set) * edje_file->image_dir->sets_count);
1304 memset(edje_file->image_dir->sets + edje_file->image_dir->sets_count - 1,
1305 0, sizeof (Edje_Image_Directory_Set));
1306 if (!edje_file->image_dir->sets)
1307 {
1308 ERR("%s: Error. Not enough memory.", progname);
1309 exit(-1);
1310 }
1311 edje_file->image_dir->sets[edje_file->image_dir->sets_count - 1].id = edje_file->image_dir->sets_count - 1;
1312}
1313
1314/**
1315 @page edcref
1316
1317 @property
1318 name
1319 @parameters
1320 [image name]
1321 @effect
1322 Define the name that refer to this image description.
1323 @endproperty
1324*/
1325static void
1326st_images_set_name(void)
1327{
1328 check_arg_count(1);
1329
1330 edje_file->image_dir->sets[edje_file->image_dir->sets_count - 1].name = parse_str(0);
1331}
1332
1333static void
1334ob_images_set_image(void)
1335{
1336 Edje_Image_Directory_Set_Entry *entry;
1337 Edje_Image_Directory_Set *set;
1338
1339 set = edje_file->image_dir->sets + edje_file->image_dir->sets_count - 1;
1340
1341 entry = mem_alloc(SZ(Edje_Image_Directory_Set_Entry));
1342
1343 set->entries = eina_list_append(set->entries, entry);
1344}
1345
1346static void
1347st_images_set_image_image(void)
1348{
1349 Edje_Image_Directory_Set_Entry *entry;
1350 Edje_Image_Directory_Set *set;
1351 unsigned int i;
1352
1353 set = edje_file->image_dir->sets + edje_file->image_dir->sets_count - 1;
1354 entry = eina_list_data_get(eina_list_last(set->entries));
1355
1356 /* Add the image to the global pool with the same syntax. */
1357 st_images_image();
1358
1359 entry->name = parse_str(0);
1360
1361 for (i = 0; i < edje_file->image_dir->entries_count; ++i)
1362 if (!strcmp(edje_file->image_dir->entries[i].entry, entry->name))
1363 {
1364 entry->id = i;
1365 return;
1366 }
1367}
1368
1369/**
1370 @page edcref
1371
1372 @property
1373 size
1374 @parameters
1375 [minw minh maxw mawh]
1376 @effect
1377 Define the minimal and maximal size that will select the specified image.
1378 @endproperty
1379*/
1380static void
1381st_images_set_image_size(void)
1382{
1383 Edje_Image_Directory_Set_Entry *entry;
1384 Edje_Image_Directory_Set *set;
1385
1386 set = edje_file->image_dir->sets + edje_file->image_dir->sets_count - 1;
1387 entry = eina_list_data_get(eina_list_last(set->entries));
1388
1389 entry->size.min.w = parse_int(0);
1390 entry->size.min.h = parse_int(1);
1391 entry->size.max.w = parse_int(2);
1392 entry->size.max.h = parse_int(3);
1393
1394 if (entry->size.min.w > entry->size.max.w
1395 || entry->size.min.h > entry->size.max.h)
1396 {
1397 ERR("%s: Error. parse error %s:%i. Image min and max size are not in the right order ([%i, %i] < [%i, %i])",
1398 progname, file_in, line - 1,
1399 entry->size.min.w, entry->size.min.h,
1400 entry->size.max.w, entry->size.max.h);
1401 exit(-1);
1402 }
1403}
1404
1405/**
1406 @page edcref
1407
1408 @block
1409 fonts
1410 @context
1411 fonts {
1412 font: "filename1.ext" "fontname";
1413 font: "filename2.ext" "otherfontname";
1414 ..
1415 }
1416 @description
1417 The "fonts" block is used to list each font file with an alias used later
1418 in the theme. As with the "images" block, additional "fonts" blocks can
1419 be included inside other blocks.
1420 @endblock
1421
1422 @property
1423 font
1424 @parameters
1425 [font filename] [font alias]
1426 @effect
1427 Defines each font "file" and "alias", the full path to the directory
1428 holding the font files can be defined with edje_cc's "-fd" option.
1429 @endproperty
1430 */
1431static void
1432st_fonts_font(void)
1433{
1434 Font *fn;
1435
1436 check_arg_count(2);
1437
1438 if (!edje_file->fonts)
1439 edje_file->fonts = eina_hash_string_small_new(free);
1440
1441 fn = mem_alloc(SZ(Font));
1442 fn->file = parse_str(0);
1443 fn->name = parse_str(1);
1444
1445 if (eina_hash_find(edje_file->fonts, fn->name))
1446 {
1447 free(fn->file);
1448 free(fn->name);
1449 free(fn);
1450 return;
1451 }
1452
1453 eina_hash_direct_add(edje_file->fonts, fn->name, fn);
1454}
1455
1456/**
1457 @page edcref
1458 @block
1459 data
1460 @context
1461 data {
1462 item: "key" "value";
1463 file: "otherkey" "filename.ext";
1464 ..
1465 }
1466 @description
1467 The "data" block is used to pass arbitrary parameters from the theme to
1468 the application. Unlike the "images" and "fonts" blocks, additional
1469 "data" blocks can only be included inside the "group" block.
1470 @endblock
1471
1472 @property
1473 item
1474 @parameters
1475 [parameter name] [parameter value]
1476 @effect
1477 Defines a new parameter, the value will be the string specified next to
1478 it.
1479 @endproperty
1480 */
1481static void
1482st_data_item(void)
1483{
1484 Edje_String *es;
1485 char *key;
1486
1487 check_arg_count(2);
1488
1489 key = parse_str(0);
1490
1491 es = mem_alloc(SZ(Edje_String));
1492 es->str = parse_str(1);
1493
1494 if (!edje_file->data)
1495 edje_file->data = eina_hash_string_small_new(free);
1496
1497 /* FIXME: check if data already exist */
1498 eina_hash_direct_add(edje_file->data, key, es);
1499}
1500
1501/**
1502 @page edcref
1503 @property
1504 file
1505 @parameters
1506 [parameter name] [parameter filename]
1507 @effect
1508 Defines a new parameter , the value will be the contents of the
1509 specified file formated as a single string of text. This property only
1510 works with plain text files.
1511 @endproperty
1512 */
1513static void
1514st_data_file(void)
1515{
1516 const char *data;
1517 const char *over;
1518 Edje_String *es;
1519 char *filename;
1520 char *value;
1521 char *key;
1522 int fd;
1523 int i;
1524 struct stat buf;
1525
1526 check_arg_count(2);
1527
1528 key = parse_str(0);
1529
1530 es = mem_alloc(SZ(Edje_String));
1531 filename = parse_str(1);
1532
1533 fd = open(filename, O_RDONLY | O_BINARY, S_IRUSR | S_IWUSR);
1534 if (fd < 0)
1535 {
1536 ERR("%s: Error. %s:%i when opening file \"%s\": \"%s\"",
1537 progname, file_in, line, filename, strerror(errno));
1538 exit(-1);
1539 }
1540
1541 if (fstat(fd, &buf))
1542 {
1543 ERR("%s: Error. %s:%i when stating file \"%s\": \"%s\"",
1544 progname, file_in, line, filename, strerror(errno));
1545 exit(-1);
1546 }
1547
1548 data = mmap(NULL, buf.st_size, PROT_READ, MAP_SHARED, fd, 0);
1549 if (data == MAP_FAILED)
1550 {
1551 ERR("%s: Error. %s:%i when mapping file \"%s\": \"%s\"",
1552 progname, file_in, line, filename, strerror(errno));
1553 exit(-1);
1554 }
1555
1556 over = data;
1557 for (i = 0; i < buf.st_size; ++i, ++over)
1558 if (*over == '\0')
1559 {
1560 ERR("%s: Error. %s:%i file \"%s\" is a binary file.",
1561 progname, file_in, line, filename);
1562 exit(-1);
1563 }
1564
1565 value = malloc(sizeof (char) * buf.st_size + 1);
1566 snprintf(value, buf.st_size + 1, "%s", data);
1567
1568 munmap((void*)data, buf.st_size);
1569 close(fd);
1570
1571 es->str = value;
1572
1573 eina_hash_direct_add(edje_file->data, key, es);
1574
1575 free(filename);
1576}
1577
1578/**
1579 @page edcref
1580 @block
1581 color_classes
1582 @context
1583 color_classes {
1584 color_class {
1585 name: "colorclassname";
1586 color: [0-255] [0-255] [0-255] [0-255];
1587 color2: [0-255] [0-255] [0-255] [0-255];
1588 color3: [0-255] [0-255] [0-255] [0-255]
1589 }
1590 ..
1591 }
1592 @description
1593 The "color_classes" block contains a list of one or more "color_class"
1594 blocks. Each "color_class" allows the designer to name an arbitrary
1595 group of colors to be used in the theme, the application can use that
1596 name to alter the color values at runtime.
1597 @endblock
1598*/
1599static void
1600ob_color_class(void)
1601{
1602 Edje_Color_Class *cc;
1603
1604 cc = mem_alloc(SZ(Edje_Color_Class));
1605 edje_file->color_classes = eina_list_append(edje_file->color_classes, cc);
1606
1607 cc->r = 0;
1608 cc->g = 0;
1609 cc->b = 0;
1610 cc->a = 0;
1611 cc->r2 = 0;
1612 cc->g2 = 0;
1613 cc->b2 = 0;
1614 cc->a2 = 0;
1615 cc->r3 = 0;
1616 cc->g3 = 0;
1617 cc->b3 = 0;
1618 cc->a3 = 0;
1619}
1620
1621/**
1622 @page edcref
1623
1624 @property
1625 name
1626 @parameters
1627 [color class name]
1628 @effect
1629 Sets the name for the color class, used as reference by both the theme
1630 and the application.
1631 @endproperty
1632*/
1633static void
1634st_color_class_name(void)
1635{
1636 Edje_Color_Class *cc, *tcc;
1637 Eina_List *l;
1638
1639 cc = eina_list_data_get(eina_list_last(edje_file->color_classes));
1640 cc->name = parse_str(0);
1641 EINA_LIST_FOREACH(edje_file->color_classes, l, tcc)
1642 {
1643 if ((cc != tcc) && (!strcmp(cc->name, tcc->name)))
1644 {
1645 fprintf(stderr, "%s: Error. parse error %s:%i. There is already a color class named \"%s\"\n",
1646 progname, file_in, line - 1, cc->name);
1647 exit(-1);
1648 }
1649 }
1650}
1651
1652/**
1653 @page edcref
1654 @property
1655 color
1656 @parameters
1657 [red] [green] [blue] [alpha]
1658 @effect
1659 The main color.
1660 @endproperty
1661*/
1662static void
1663st_color_class_color(void)
1664{
1665 Edje_Color_Class *cc;
1666
1667 check_arg_count(4);
1668
1669 cc = eina_list_data_get(eina_list_last(edje_file->color_classes));
1670 cc->r = parse_int_range(0, 0, 255);
1671 cc->g = parse_int_range(1, 0, 255);
1672 cc->b = parse_int_range(2, 0, 255);
1673 cc->a = parse_int_range(3, 0, 255);
1674}
1675
1676/**
1677 @page edcref
1678 @property
1679 color2
1680 @parameters
1681 [red] [green] [blue] [alpha]
1682 @effect
1683 Used as shadow in text and textblock parts.
1684 @endproperty
1685*/
1686static void
1687st_color_class_color2(void)
1688{
1689 Edje_Color_Class *cc;
1690
1691 check_arg_count(4);
1692
1693 cc = eina_list_data_get(eina_list_last(edje_file->color_classes));
1694 cc->r2 = parse_int_range(0, 0, 255);
1695 cc->g2 = parse_int_range(1, 0, 255);
1696 cc->b2 = parse_int_range(2, 0, 255);
1697 cc->a2 = parse_int_range(3, 0, 255);
1698}
1699
1700/**
1701 @page edcref
1702 @property
1703 color3
1704 @parameters
1705 [red] [green] [blue] [alpha]
1706 @effect
1707 Used as outline in text and textblock parts.
1708 @endproperty
1709*/
1710static void
1711st_color_class_color3(void)
1712{
1713 Edje_Color_Class *cc;
1714
1715 check_arg_count(4);
1716
1717 cc = eina_list_data_get(eina_list_last(edje_file->color_classes));
1718 cc->r3 = parse_int_range(0, 0, 255);
1719 cc->g3 = parse_int_range(1, 0, 255);
1720 cc->b3 = parse_int_range(2, 0, 255);
1721 cc->a3 = parse_int_range(3, 0, 255);
1722}
1723
1724/**
1725 @page edcref
1726 @block
1727 styles
1728 @context
1729 styles {
1730 style {
1731 name: "stylename";
1732 base: "..default style properties..";
1733
1734 tag: "tagname" "..style properties..";
1735 ..
1736 }
1737 ..
1738 }
1739 @description
1740 The "styles" block contains a list of one or more "style" blocks. A
1741 "style" block is used to create style \<tags\> for advanced TEXTBLOCK
1742 formatting.
1743 @endblock
1744*/
1745static void
1746ob_styles_style(void)
1747{
1748 Edje_Style *stl;
1749
1750 stl = mem_alloc(SZ(Edje_Style));
1751 edje_file->styles = eina_list_append(edje_file->styles, stl);
1752}
1753
1754/**
1755 @page edcref
1756 @property
1757 name
1758 @parameters
1759 [style name]
1760 @effect
1761 The name of the style to be used as reference later in the theme.
1762 @endproperty
1763*/
1764static void
1765st_styles_style_name(void)
1766{
1767 Edje_Style *stl, *tstl;
1768 Eina_List *l;
1769
1770 stl = eina_list_data_get(eina_list_last(edje_file->styles));
1771 stl->name = parse_str(0);
1772 EINA_LIST_FOREACH(edje_file->styles, l, tstl)
1773 {
1774 if (stl->name && tstl->name && (stl != tstl) && (!strcmp(stl->name, tstl->name)))
1775 {
1776 ERR("%s: Error. parse error %s:%i. There is already a style named \"%s\"",
1777 progname, file_in, line - 1, stl->name);
1778 exit(-1);
1779 }
1780 }
1781}
1782
1783/**
1784 @page edcref
1785 @property
1786 base
1787 @parameters
1788 [style properties string]
1789 @effect
1790 The default style properties that will be applied to the complete
1791 text.
1792 @endproperty
1793*/
1794static void
1795st_styles_style_base(void)
1796{
1797 Edje_Style *stl;
1798 Edje_Style_Tag *tag;
1799
1800 stl = eina_list_data_get(eina_list_last(edje_file->styles));
1801 if (stl->tags)
1802 {
1803 ERR("%s: Error. parse error %s:%i. There is already a basic format for the style",
1804 progname, file_in, line - 1);
1805 exit(-1);
1806 }
1807 tag = mem_alloc(SZ(Edje_Style_Tag));
1808 tag->key = mem_strdup("DEFAULT");
1809 tag->value = parse_str(0);
1810 stl->tags = eina_list_append(stl->tags, tag);
1811}
1812
1813/**
1814 @page edcref
1815 @property
1816 tag
1817 @parameters
1818 [tag name] [style properties string]
1819 @effect
1820 Style to be applied only to text between style \<tags\>..\</tags\>.
1821 When creating "paired" tags, like \<bold\>\</bold\>, A '+' should be added at the start of the style properties of the first part (\<bold\>).
1822 If the second part (\</bold\>) is also defined, a '-' should be prepended to it's style properties.
1823 This only applies to paired tags; Single tags, like \<tab\>, must not include a starting '+'.
1824 @endproperty
1825*/
1826static void
1827st_styles_style_tag(void)
1828{
1829 Edje_Style *stl;
1830 Edje_Style_Tag *tag;
1831
1832 stl = eina_list_data_get(eina_list_last(edje_file->styles));
1833 tag = mem_alloc(SZ(Edje_Style_Tag));
1834 tag->key = parse_str(0);
1835 tag->value = parse_str(1);
1836 stl->tags = eina_list_append(stl->tags, tag);
1837}
1838
1839#ifdef ENABLE_MULTISENSE
1840/* add to below doc
1841sounds { }
1842 */
1843#endif
1844
1845/**
1846 @page edcref
1847 @block
1848 collections
1849 @context
1850 collections {
1851 ..
1852 group { }
1853 group { }
1854 ..
1855 }
1856 @description
1857 The "collections" block is used to list the groups that compose the
1858 theme. Additional "collections" blocks do not prevent overriding group
1859 names. The "sounds" block comprises of all sound definitions.
1860 @endblock
1861*/
1862static void
1863ob_collections(void)
1864{
1865 if (!edje_file->collection)
1866 edje_file->collection = eina_hash_string_small_new(NULL);
1867}
1868
1869#ifdef ENABLE_MULTISENSE
1870/* * delete space before *
1871 @page edcref
1872 @block
1873 sounds
1874 @context
1875 sounds {
1876 sample {
1877 name: "sound_file1" COMP;
1878 source: "sound_file1.wav";
1879 }
1880 sample {
1881 name: "sound_file2" LOSSY 0.4;
1882 source: "sound_file2.wav";
1883 }
1884 tone: "tone-1" 2300;
1885 }
1886
1887 @description
1888 The "sounds" block contains a list of one or more sound sample and tones items.
1889 @endblock
1890 @block
1891 sample
1892 @context
1893 sample {
1894 name: "sound_file1" RAW;
1895 source: "sound_file1.wav";
1896 }
1897 sample {
1898 name: "sound_file2" LOSSY 0.5;
1899 source: "sound_file2.wav";
1900 }
1901 sample {
1902 name: "sound_file3" COMP;
1903 source: "sound_file3.wav";
1904 }
1905 sample {
1906 name: "sound_file4" AS-IS;
1907 source: "sound_file1.wav";
1908 }
1909 @description
1910 The sample block defines the sound sample.
1911 @endblock
1912 @property
1913 name
1914 @parameters
1915 [sample name] [compression type] [if lossy, then quality]
1916 @effect
1917 Used to include each sound file. The full path to the directory holding
1918 the sounds can be defined later with edje_cc's "-sd" option.
1919 @li RAW: Uncompressed.
1920 @li COMP: Lossless compression.
1921 @li LOSSY [-0.1 - 1.0]: Lossy comression with quality from 0 to 1.0.
1922 @li AS_IS: Check for re-encoding, no compression/encoding, just write the file information as it is.
1923 @endproperty
1924 @since 1.1.0
1925 */
1926static void
1927st_collections_group_sound_sample_name(void)
1928{
1929 Edje_Sound_Sample *sample;
1930 const char *tmp;
1931 unsigned int i;
1932
1933 if (!edje_file->sound_dir)
1934 edje_file->sound_dir = mem_alloc(SZ(Edje_Sound_Directory));
1935
1936 tmp = parse_str(0);
1937
1938 for (i = 0; i < edje_file->sound_dir->samples_count; i++)
1939 {
1940 if (!strcmp(edje_file->sound_dir->samples[i].name, tmp))
1941 {
1942 free((char *)tmp);
1943 return;
1944 }
1945 }
1946
1947 edje_file->sound_dir->samples_count++;
1948 edje_file->sound_dir->samples =
1949 realloc(edje_file->sound_dir->samples,
1950 sizeof(Edje_Sound_Sample) *
1951 edje_file->sound_dir->samples_count);
1952
1953 if (!edje_file->sound_dir->samples)
1954 {
1955 ERR("%s: Error. No enough memory.", progname);
1956 exit(-1);
1957 }
1958
1959 sample =
1960 edje_file->sound_dir->samples +
1961 edje_file->sound_dir->samples_count - 1;
1962 memset(sample, 0, sizeof (Edje_Sound_Sample));
1963
1964 sample->name = tmp;
1965 sample->id = edje_file->sound_dir->samples_count - 1;
1966 sample->compression = parse_enum(1,
1967 "RAW", EDJE_SOUND_SOURCE_TYPE_INLINE_RAW,
1968 "COMP", EDJE_SOUND_SOURCE_TYPE_INLINE_COMP,
1969 "LOSSY", EDJE_SOUND_SOURCE_TYPE_INLINE_LOSSY,
1970 "AS_IS", EDJE_SOUND_SOURCE_TYPE_INLINE_AS_IS,
1971 NULL);
1972
1973 if (sample->compression == EDJE_SOUND_SOURCE_TYPE_INLINE_LOSSY)
1974 {
1975 sample->quality = parse_float_range(2, 45.0, 1000.0);
1976 check_arg_count(3);
1977 }
1978 else
1979 check_arg_count(2);
1980
1981}
1982
1983/* * delete space before *
1984 @page edcref
1985 @property
1986 source
1987 @parameters
1988 [sound file name]
1989 @effect
1990 The Sound source file name (Source can be mono/stereo WAV file.
1991 Only files with 44.1 KHz sample rate supported now)
1992 @endproperty
1993 @since 1.1.0
1994 */
1995static void
1996st_collections_group_sound_sample_source(void)
1997{
1998 Edje_Sound_Sample *sample;
1999
2000 if (!edje_file->sound_dir->samples)
2001 {
2002 ERR("%s: Error. Invalid sound sample source definition.", progname);
2003 exit(-1);
2004 }
2005
2006 sample =
2007 edje_file->sound_dir->samples +
2008 edje_file->sound_dir->samples_count - 1;
2009
2010 if (!sample)
2011 {
2012 ERR("%s: Error. Invalid sound sample source definition.", progname);
2013 exit(-1);
2014 }
2015 sample->snd_src = parse_str(0);
2016 check_arg_count(1);
2017}
2018
2019/* * delete space before *
2020 @page edcref
2021 @property
2022 tone
2023 @parameters
2024 [tone name] [frequency]
2025 @effect
2026 sound of specific frequency
2027 @endproperty
2028 @since 1.1.0
2029 */
2030static void
2031st_collections_group_sound_tone(void)
2032{
2033 Edje_Sound_Tone *tone;
2034 const char *tmp;
2035 unsigned int i;
2036 int value;
2037
2038 check_arg_count(2);
2039
2040 if (!edje_file->sound_dir)
2041 edje_file->sound_dir = mem_alloc(SZ(Edje_Sound_Directory));
2042
2043 tmp = parse_str(0);
2044 /* Audible range 20 to 20KHz */
2045 value = parse_int_range(1, 20, 20000);
2046
2047 /* Check for Tone duplication */
2048 for (i = 0; i < edje_file->sound_dir->tones_count; i++)
2049 {
2050 if (!strcmp(edje_file->sound_dir->tones[i].name, tmp))
2051 {
2052 ERR("%s: Error. Tone name: %s already exist.", progname, tmp);
2053 free((char *)tmp);
2054 exit(-1);
2055 }
2056 if (edje_file->sound_dir->tones[i].value == value)
2057 {
2058 ERR("%s: Error. Tone name %s with same frequency %d exist.",
2059 progname, edje_file->sound_dir->tones[i].name, value);
2060 exit(-1);
2061 }
2062 }
2063 edje_file->sound_dir->tones_count++;
2064 edje_file->sound_dir->tones =
2065 realloc(edje_file->sound_dir->tones,
2066 sizeof (Edje_Sound_Tone) *
2067 edje_file->sound_dir->tones_count);
2068
2069 if (!edje_file->sound_dir->tones)
2070 {
2071 ERR("%s: Error. No enough memory.", progname);
2072 exit(-1);
2073 }
2074
2075 tone = edje_file->sound_dir->tones + edje_file->sound_dir->tones_count - 1;
2076 memset(tone, 0, sizeof (Edje_Sound_Tone));
2077
2078 tone->name = tmp;
2079 tone->value = value;
2080 tone->id = edje_file->sound_dir->tones_count - 1;
2081}
2082#endif
2083
2084/**
2085 @edcsection{group,Group sub blocks}
2086 */
2087
2088/**
2089 @page edcref
2090 @block
2091 group
2092 @context
2093 collections {
2094 ..
2095 group {
2096 name: "nameusedbytheapplication";
2097 alias: "anothername";
2098 min: width height;
2099 max: width height;
2100
2101 data { }
2102 script { }
2103 parts { }
2104 programs { }
2105 }
2106 ..
2107 }
2108 @description
2109 A "group" block contains the list of parts and programs that compose a
2110 given Edje Object.
2111 @endblock
2112*/
2113static void
2114ob_collections_group(void)
2115{
2116 Edje_Part_Collection *pc;
2117 Code *cd;
2118
2119 if (current_de && !current_de->entry)
2120 {
2121 ERR("%p: Error. A collection without a name was detected, that's not allowed.", progname);
2122 exit(-1);
2123 }
2124
2125 current_de = mem_alloc(SZ(Edje_Part_Collection_Directory_Entry));
2126 current_de->id = eina_list_count(edje_collections);
2127
2128 pc = mem_alloc(SZ(Edje_Part_Collection));
2129 edje_collections = eina_list_append(edje_collections, pc);
2130 pc->id = current_de->id;
2131
2132 cd = mem_alloc(SZ(Code));
2133 codes = eina_list_append(codes, cd);
2134}
2135
2136/**
2137 @page edcref
2138 @property
2139 name
2140 @parameters
2141 [group name]
2142 @effect
2143 The name that will be used by the application to load the resulting
2144 Edje object and to identify the group to swallow in a GROUP part. If a
2145 group with the same name exists already it will be completely overriden
2146 by the new group.
2147 @endproperty
2148*/
2149static void
2150st_collections_group_name(void)
2151{
2152 Edje_Part_Collection_Directory_Entry *older;
2153 Edje_Part_Collection *current_pc;
2154
2155 check_arg_count(1);
2156
2157 current_pc = eina_list_data_get(eina_list_last(edje_collections));
2158
2159 current_de->entry = parse_str(0);
2160 current_pc->part = current_de->entry;
2161
2162 older = eina_hash_find(edje_file->collection, current_de->entry);
2163
2164 if (older)
2165 {
2166 Edje_Part_Collection *pc;
2167 Eina_List *l;
2168 Code *cd;
2169 int i = 0;
2170
2171 pc = eina_list_nth(edje_collections, older->id);
2172 cd = eina_list_nth(codes, older->id);
2173
2174 eina_hash_del(edje_file->collection, current_de->entry, older);
2175 edje_collections = eina_list_remove(edje_collections, pc);
2176 codes = eina_list_remove(codes, cd);
2177
2178 EINA_LIST_FOREACH(edje_collections, l, pc)
2179 {
2180 older = eina_hash_find(edje_file->collection, pc->part);
2181
2182 pc->id = i++;
2183 if (older) older->id = pc->id;
2184 }
2185 }
2186
2187 eina_hash_direct_add(edje_file->collection, current_de->entry, current_de);
2188}
2189
2190typedef struct _Edje_List_Foreach_Data Edje_List_Foreach_Data;
2191struct _Edje_List_Foreach_Data
2192{
2193 Eina_List *list;
2194};
2195
2196static Eina_Bool
2197_edje_data_item_list_foreach(const Eina_Hash *hash __UNUSED__, const void *key, void *data __UNUSED__, void *fdata)
2198{
2199 Edje_List_Foreach_Data *fd;
2200
2201 fd = fdata;
2202 fd->list = eina_list_append(fd->list, strdup(key));
2203
2204 return EINA_TRUE;
2205}
2206
2207/**
2208 @page edcref
2209 @property
2210 inherit
2211 @parameters
2212 [parent group name]
2213 @effect
2214 Parent group name for inheritance.
2215 Group "inherit" is used to inherit any predefined group and change
2216 some property which belongs to "part", "description", "items" or "program".
2217 The child group has the same property as parent group. If you specify the
2218 type again in an inherited part, it will cause an error (unless you plan
2219 to fix that).
2220 @endproperty
2221 @since 1.1.0
2222*/
2223static void
2224st_collections_group_inherit(void)
2225{
2226 Edje_Part_Collection *pc, *pc2;
2227 Edje_Part *ep, *ep2;
2228 Edje_Part_Parser *epp, *epp2;
2229 Edje_Pack_Element *item, *item2;
2230 Edje_Pack_Element_Parser *pitem;
2231 Edje_Part_Description_Common *ed, *ed2;
2232 Edje_List_Foreach_Data fdata;
2233 Edje_String *es;
2234 Eina_List *l;
2235 char *parent_name;
2236 unsigned int i, j;
2237
2238 check_arg_count(1);
2239
2240 pc = eina_list_data_get(eina_list_last(edje_collections));
2241
2242 parent_name = parse_str(0);
2243
2244 EINA_LIST_FOREACH(edje_collections, l, pc2)
2245 {
2246 if (!strcmp(parent_name, pc2->part))
2247 break;
2248 }
2249 if (!pc2)
2250 {
2251 ERR("%s: Error. parse error %s:%i. There isn't a group with the name %s",
2252 progname, file_in, line - 1, parent_name);
2253 exit(-1);
2254 }
2255
2256 if (pc2->data)
2257 {
2258 char *key;
2259
2260 memset(&fdata, 0, sizeof(Edje_List_Foreach_Data));
2261 eina_hash_foreach(pc2->data,
2262 _edje_data_item_list_foreach, &fdata);
2263
2264 if (!pc->data)
2265 pc->data = eina_hash_string_small_new(free);
2266
2267
2268 EINA_LIST_FREE(fdata.list, key)
2269 {
2270 es = mem_alloc(SZ(Edje_String));
2271 es = (Edje_String *)eina_hash_find(pc2->data, key);
2272 eina_hash_direct_add(pc->data, key, es);
2273 }
2274 }
2275
2276 pc->prop.min.w = pc2->prop.min.w;
2277 pc->prop.min.h = pc2->prop.min.h;
2278 pc->prop.orientation = pc2->prop.orientation;
2279
2280 pc->lua_script_only = pc2->lua_script_only;
2281
2282 #define STRDUP(x) x ? strdup(x) : NULL
2283 for (i = 0 ; i < pc2->parts_count ; i++)
2284 {
2285 // copy the part
2286 ob_collections_group_parts_part();
2287 ep = pc->parts[i];
2288 ep2 = pc2->parts[i];
2289 ep->name = STRDUP(ep2->name);
2290 ep->source = STRDUP(ep2->source);
2291 ep->source2 = STRDUP(ep2->source2);
2292 ep->source3 = STRDUP(ep2->source3);
2293 ep->source4 = STRDUP(ep2->source4);
2294 ep->source5 = STRDUP(ep2->source5);
2295 ep->source6 = STRDUP(ep2->source6);
2296
2297 data_queue_copied_part_lookup(pc, &(ep2->clip_to_id), &(ep->clip_to_id));
2298
2299 ep->type = ep2->type;
2300 ep->mouse_events = ep2->mouse_events;
2301 ep->repeat_events = ep2->repeat_events;
2302 ep->ignore_flags = ep2->ignore_flags;
2303 ep->scale = ep2->scale;
2304 ep->pointer_mode = ep2->pointer_mode;
2305 ep->precise_is_inside = ep2->precise_is_inside;
2306 ep->use_alternate_font_metrics = ep2->use_alternate_font_metrics;
2307 ep->effect = ep2->effect;
2308 ep->entry_mode = ep2->entry_mode;
2309 ep->select_mode = ep2->select_mode;
2310 ep->cursor_mode = ep2->cursor_mode;
2311 ep->multiline = ep2->multiline;
2312 ep->dragable.x = ep2->dragable.x;
2313 ep->dragable.step_x = ep2->dragable.step_x;
2314 ep->dragable.count_x = ep2->dragable.count_x;
2315 ep->dragable.y = ep2->dragable.y;
2316 ep->dragable.step_y = ep2->dragable.step_y;
2317 ep->dragable.count_y = ep2->dragable.count_y;
2318
2319 data_queue_copied_part_lookup(pc, &(ep2->dragable.confine_id), &(ep->dragable.confine_id));
2320 data_queue_copied_part_lookup(pc, &(ep2->dragable.event_id), &(ep->dragable.event_id));
2321
2322 epp = (Edje_Part_Parser *)ep;
2323 epp2 = (Edje_Part_Parser *)ep2;
2324 epp->reorder.insert_before = STRDUP(epp2->reorder.insert_before);
2325 epp->reorder.insert_after = STRDUP(epp2->reorder.insert_after);
2326 epp->can_override = EINA_TRUE;
2327
2328 for (j = 0 ; j < ep2->items_count ; j++)
2329 {
2330 ob_collections_group_parts_part_box_items_item();
2331 item = ep->items[j];
2332 item2 = ep2->items[j];
2333 item->type = item2->type;
2334 item->name = STRDUP(item2->name);
2335 item->source = STRDUP(item2->source);
2336 item->min.w = item2->min.w;
2337 item->min.h = item2->min.h;
2338 item->prefer.w = item2->prefer.w;
2339 item->prefer.h = item2->prefer.h;
2340 item->max.w = item2->max.w;
2341 item->max.h = item2->max.h;
2342 item->padding.l = item2->padding.l;
2343 item->padding.r = item2->padding.r;
2344 item->padding.t = item2->padding.t;
2345 item->padding.b = item2->padding.b;
2346 item->align.x = item2->align.x;
2347 item->align.y = item2->align.y;
2348 item->weight.x = item2->weight.x;
2349 item->weight.y = item2->weight.y;
2350 item->aspect.w = item2->aspect.w;
2351 item->aspect.h = item2->aspect.h;
2352 item->aspect.mode = item2->aspect.mode;
2353 item->options = STRDUP(item2->options);
2354 item->col = item2->col;
2355 item->row = item2->row;
2356 item->colspan = item2->colspan;
2357 item->rowspan = item2->rowspan;
2358
2359 pitem = (Edje_Pack_Element_Parser *)item;
2360 pitem->can_override = EINA_TRUE;
2361 }
2362
2363 ep->api.name = STRDUP(ep2->api.name);
2364 if (ep2->api.description) ep->api.description = STRDUP(ep2->api.description);
2365
2366 // copy default description
2367 ob_collections_group_parts_part_description();
2368 ed = ep->default_desc;
2369 parent_desc = ed2 = ep2->default_desc;
2370 ed->state.name = STRDUP(ed2->state.name);
2371 ed->state.value = ed2->state.value;
2372 st_collections_group_parts_part_description_inherit();
2373 parent_desc = NULL;
2374
2375 // copy other description
2376 for (j = 0 ; j < ep2->other.desc_count ; j++)
2377 {
2378 ob_collections_group_parts_part_description();
2379 ed = ep->other.desc[j];
2380 parent_desc = ed2 = ep2->other.desc[j];
2381 ed->state.name = STRDUP(ed2->state.name);
2382 ed->state.value = ed2->state.value;
2383 st_collections_group_parts_part_description_inherit();
2384 parent_desc = NULL;
2385 }
2386 }
2387
2388 //copy programs
2389 for (j = 0 ; j < pc2->programs.fnmatch_count ; j++)
2390 {
2391 ob_collections_group_programs_program();
2392 _edje_program_copy(current_program, pc2->programs.fnmatch[j]);
2393 }
2394 for (j = 0 ; j < pc2->programs.strcmp_count ; j++)
2395 {
2396 ob_collections_group_programs_program();
2397 _edje_program_copy(current_program, pc2->programs.strcmp[j]);
2398 }
2399 for (j = 0 ; j < pc2->programs.strncmp_count ; j++)
2400 {
2401 ob_collections_group_programs_program();
2402 _edje_program_copy(current_program, pc2->programs.strncmp[j]);
2403 }
2404 for (j = 0 ; j < pc2->programs.strrncmp_count ; j++)
2405 {
2406 ob_collections_group_programs_program();
2407 _edje_program_copy(current_program, pc2->programs.strrncmp[j]);
2408 }
2409 for (j = 0 ; j < pc2->programs.nocmp_count ; j++)
2410 {
2411 ob_collections_group_programs_program();
2412 _edje_program_copy(current_program, pc2->programs.nocmp[j]);
2413 }
2414
2415 Code *cd, *cd2;
2416 Code_Program *cp, *cp2;
2417 Edje_Part_Collection_Directory_Entry *de;
2418
2419 de = eina_hash_find(edje_file->collection, pc2->part);
2420 cd2 = eina_list_nth(codes, de->id);
2421 cd = eina_list_data_get(eina_list_last(codes));
2422
2423 EINA_LIST_FOREACH(cd2->programs, l, cp2)
2424 {
2425 cp = mem_alloc(SZ(Code_Program));
2426
2427 cp->l1 = cp2->l1;
2428 cp->l2 = cp2->l2;
2429 cp->script = STRDUP(cp2->script);
2430 cd->is_lua = cd2->is_lua;
2431 cd->programs = eina_list_append(cd->programs, cp);
2432 data_queue_copied_anonymous_lookup(pc, &(cp2->id), &(cp->id));
2433 }
2434
2435 free(parent_name);
2436 #undef STRDUP
2437}
2438
2439/**
2440 @page edcref
2441 @property
2442 script_only
2443 @parameters
2444 [on/off]
2445 @effect
2446 The flag (on/off) as to if this group is defined ONLY by script
2447 callbacks such as init(), resize() and shutdown()
2448 @endproperty
2449*/
2450static void
2451st_collections_group_script_only(void)
2452{
2453 Edje_Part_Collection *pc;
2454
2455 check_arg_count(1);
2456
2457 pc = eina_list_data_get(eina_list_last(edje_collections));
2458 pc->lua_script_only = parse_bool(0);
2459}
2460
2461/**
2462 @page edcref
2463 @property
2464 alias
2465 @parameters
2466 [aditional group name]
2467 @effect
2468 Additional name to serve as identifier. Defining multiple aliases is
2469 supported.
2470 @endproperty
2471*/
2472static void
2473st_collections_group_alias(void)
2474{
2475 Edje_Part_Collection_Directory_Entry *alias;
2476
2477 check_arg_count(1);
2478
2479 alias = mem_alloc(SZ(Edje_Part_Collection_Directory_Entry));
2480 alias->id = current_de->id;
2481 alias->entry = parse_str(0);
2482
2483 aliases = eina_list_append(aliases, alias);
2484}
2485
2486/**
2487 @page edcref
2488 @property
2489 min
2490 @parameters
2491 [width] [height]
2492 @effect
2493 The minimum size for the container defined by the composition of the
2494 parts. It is not enforced.
2495 @endproperty
2496*/
2497static void
2498st_collections_group_min(void)
2499{
2500 Edje_Part_Collection *pc;
2501
2502 check_arg_count(2);
2503
2504 pc = eina_list_data_get(eina_list_last(edje_collections));
2505 pc->prop.min.w = parse_int_range(0, 0, 0x7fffffff);
2506 pc->prop.min.h = parse_int_range(1, 0, 0x7fffffff);
2507}
2508
2509/**
2510 @page edcref
2511 @property
2512 max
2513 @parameters
2514 [width] [height]
2515 @effect
2516 The maximum size for the container defined by the totality of the
2517 parts. It is not enforced.
2518 @endproperty
2519*/
2520static void
2521st_collections_group_max(void)
2522{
2523 Edje_Part_Collection *pc;
2524
2525 check_arg_count(2);
2526
2527 pc = eina_list_data_get(eina_list_last(edje_collections));
2528 pc->prop.max.w = parse_int_range(0, 0, 0x7fffffff);
2529 pc->prop.max.h = parse_int_range(1, 0, 0x7fffffff);
2530}
2531
2532/**
2533 @page edcref
2534 @block
2535 script
2536 @context
2537 ..
2538 group {
2539 script {
2540 //embryo script
2541 }
2542 ..
2543 program {
2544 script {
2545 //embryo script
2546 }
2547 }
2548 ..
2549 }
2550 ..
2551 @description
2552 This block is used to "inject" embryo scripts to a given Edje theme and
2553 it functions in two modalities. When it's included inside a "program"
2554 block, the script will be executed every time the program is run, on
2555 the other hand, when included directly into a "group", "part" or
2556 "description" block, it will be executed once at load time, in the
2557 load order.
2558 @endblock
2559*/
2560static void
2561ob_collections_group_script(void)
2562{
2563 Code *cd;
2564
2565 cd = eina_list_data_get(eina_list_last(codes));
2566
2567 if (!is_verbatim()) track_verbatim(1);
2568 else
2569 {
2570 char *s;
2571
2572 s = get_verbatim();
2573 if (s)
2574 {
2575 cd->l1 = get_verbatim_line1();
2576 cd->l2 = get_verbatim_line2();
2577 if (cd->shared)
2578 {
2579 ERR("%s: Error. parse error %s:%i. There is already an existing script section for the group",
2580 progname, file_in, line - 1);
2581 exit(-1);
2582 }
2583 cd->shared = s;
2584 cd->original = strdup(s);
2585 cd->is_lua = 0;
2586 set_verbatim(NULL, 0, 0);
2587 }
2588 }
2589}
2590
2591static void
2592ob_collections_group_lua_script(void)
2593{
2594 Code *cd;
2595
2596 cd = eina_list_data_get(eina_list_last(codes));
2597
2598 if (!is_verbatim()) track_verbatim(1);
2599 else
2600 {
2601 char *s;
2602
2603 s = get_verbatim();
2604 if (s)
2605 {
2606 cd->l1 = get_verbatim_line1();
2607 cd->l2 = get_verbatim_line2();
2608 if (cd->shared)
2609 {
2610 ERR("%s: Error. parse error %s:%i. There is already an existing script section for the group",
2611 progname, file_in, line - 1);
2612 exit(-1);
2613 }
2614 cd->shared = s;
2615 cd->is_lua = 1;
2616 set_verbatim(NULL, 0, 0);
2617 }
2618 }
2619}
2620
2621static void
2622st_collections_group_data_item(void)
2623{
2624 Edje_Part_Collection *pc;
2625 Edje_String *es;
2626 char *key;
2627
2628 check_arg_count(2);
2629
2630 pc = eina_list_data_get(eina_list_last(edje_collections));
2631
2632 if (!pc->data)
2633 pc->data = eina_hash_string_small_new(free);
2634
2635 key = parse_str(0);
2636
2637 es = mem_alloc(SZ(Edje_String));
2638 es->str = parse_str(1);
2639
2640 if (eina_hash_find(pc->data, key))
2641 eina_hash_modify(pc->data, key, es);
2642 else
2643 eina_hash_direct_add(pc->data, key, es);
2644}
2645
2646/**
2647 @page edcref
2648 @property
2649 orientation
2650 @parameters
2651 enum AUTO, LTR, RTL
2652 @effect
2653 This defines GROUP orientation.
2654 This is useful if you want match interface orientation with language.
2655 AUTO - Follow system defs.
2656 LTR - suitable for Left To Right Languages (latin)
2657 RTL - suitable for Right To Left Languages (Hebrew, Arabic interface)
2658 @endproperty
2659*/
2660static void
2661st_collections_group_orientation(void)
2662{
2663 Edje_Part_Collection *pc;
2664
2665 check_arg_count(1);
2666
2667 pc = eina_list_data_get(eina_list_last(edje_collections));
2668 pc->prop.orientation = parse_enum(0,
2669 "AUTO", EDJE_ORIENTATION_AUTO,
2670 "LTR", EDJE_ORIENTATION_LTR,
2671 "RTL", EDJE_ORIENTATION_RTL,
2672 NULL);
2673}
2674
2675/**
2676 @page edcref
2677 @block
2678 limits
2679 @context
2680 group {
2681 limits {
2682 vertical: "limit_name" height_barrier;
2683 horizontal: "limit_name" width_barrier;
2684 ..
2685 }
2686 ..
2687 }
2688 ..
2689 @description
2690 This block is used to trigger some signal when the Edje object is resized.
2691 @endblock
2692
2693 @edcref
2694 @property
2695 vertical
2696 @parameters
2697 [name] [height barrier]
2698 @effect
2699 It will send a signal: "limit,name,over" when the object is resized and pass
2700 the limit by growing over it. And it will send: "limit,name,below" when
2701 it pass below that limit.
2702 This limit will be applied on the y absis.
2703 @endproperty
2704*/
2705static void
2706st_collections_group_limits_vertical(void)
2707{
2708 Edje_Part_Collection *pc;
2709 Edje_Limit *el;
2710
2711 check_arg_count(2);
2712
2713 el = mem_alloc(SZ(Edje_Limit));
2714
2715 pc = eina_list_data_get(eina_list_last(edje_collections));
2716 pc->limits.vertical_count++;
2717 pc->limits.vertical = realloc(pc->limits.vertical, pc->limits.vertical_count * sizeof (Edje_Limit *));
2718 if (!pc->limits.vertical || !el)
2719 {
2720 ERR("%s: Error. Not enough memory.", progname);
2721 exit(-1);
2722 }
2723
2724 pc->limits.vertical[pc->limits.vertical_count - 1] = el;
2725
2726 el->name = parse_str(0);
2727 el->value = parse_int_range(1, 1, 0xffff);
2728}
2729
2730/**
2731 @page edcref
2732 @property
2733 horizontal
2734 @parameters
2735 [name] [width barrier]
2736 @effect
2737 It will send a signal: "limit,name,over" when the object is resized and pass
2738 the limit by growing over it. And it will send: "limit,name,below" when
2739 it pass below that limit.
2740 This limit will be applied on the x absis.
2741 @endproperty
2742*/
2743static void
2744st_collections_group_limits_horizontal(void)
2745{
2746 Edje_Part_Collection *pc;
2747 Edje_Limit *el;
2748
2749 check_arg_count(2);
2750
2751 el = mem_alloc(SZ(Edje_Limit));
2752
2753 pc = eina_list_data_get(eina_list_last(edje_collections));
2754 pc->limits.horizontal_count++;
2755 pc->limits.horizontal = realloc(pc->limits.horizontal, pc->limits.horizontal_count * sizeof (Edje_Limit *));
2756 if (!pc->limits.horizontal || !el)
2757 {
2758 ERR("%s: Error. Not enough memory.", progname);
2759 exit(-1);
2760 }
2761
2762 pc->limits.horizontal[pc->limits.horizontal_count - 1] = el;
2763
2764 el->name = parse_str(0);
2765 el->value = parse_int_range(1, 1, 0xffff);
2766}
2767
2768/**
2769 @page edcref
2770 @block
2771 parts
2772 @context
2773 group {
2774 parts {
2775 alias: "theme_part_path" "real_part_path";
2776 ..
2777 }
2778 }
2779 @description
2780 Alias of part give a chance to let the designer put the real one
2781 in a box or reuse one from a GROUP or inside a BOX.
2782 @endblock
2783*/
2784static void
2785st_collections_group_parts_alias(void)
2786{
2787 Edje_Part_Collection *pc;
2788 const char *alias;
2789 const char *aliased;
2790
2791 check_arg_count(2);
2792
2793 pc = eina_list_data_get(eina_list_last(edje_collections));
2794
2795 alias = parse_str(0);
2796 aliased = parse_str(1);
2797
2798 if (!pc->alias) pc->alias = eina_hash_string_small_new(NULL);
2799 eina_hash_add(pc->alias, alias, aliased);
2800
2801 if (!pc->aliased) pc->aliased = eina_hash_string_small_new(NULL);
2802 eina_hash_add(pc->aliased, aliased, alias);
2803}
2804
2805
2806/**
2807 @page edcref
2808 @block
2809 part
2810 @context
2811 group {
2812 parts {
2813 ..
2814 part {
2815 name: "partname";
2816 type: IMAGE;
2817 mouse_events: 1;
2818 repeat_events: 0;
2819 ignore_flags: NONE;
2820 clip_to: "anotherpart";
2821 source: "groupname";
2822 pointer_mode: AUTOGRAB;
2823 use_alternate_font_metrics: 0;
2824
2825 description { }
2826 dragable { }
2827 items { }
2828 }
2829 ..
2830 }
2831 }
2832 @description
2833 Parts are used to represent the most basic design elements of the
2834 theme, for example, a part can represent a line in a border or a label
2835 on a button.
2836 @endblock
2837*/
2838static void
2839ob_collections_group_parts_part(void)
2840{
2841 Edje_Part_Collection *pc;
2842 Edje_Part *ep;
2843 Edje_Part_Parser *epp;
2844
2845 ep = mem_alloc(SZ(Edje_Part_Parser));
2846
2847 pc = eina_list_data_get(eina_list_last(edje_collections));
2848 pc->parts_count++;
2849 pc->parts = realloc(pc->parts, pc->parts_count * sizeof (Edje_Part *));
2850 if (!pc->parts)
2851 {
2852 ERR("%s: Error. Not enough memory.", progname);
2853 exit(-1);
2854 }
2855 current_part = pc->parts[pc->parts_count - 1] = ep;
2856
2857 ep->id = pc->parts_count - 1;
2858 ep->type = EDJE_PART_TYPE_IMAGE;
2859 ep->mouse_events = 1;
2860 ep->repeat_events = 0;
2861 ep->ignore_flags = EVAS_EVENT_FLAG_NONE;
2862 ep->scale = 0;
2863 ep->pointer_mode = EVAS_OBJECT_POINTER_MODE_AUTOGRAB;
2864 ep->precise_is_inside = 0;
2865 ep->use_alternate_font_metrics = 0;
2866 ep->clip_to_id = -1;
2867 ep->dragable.confine_id = -1;
2868 ep->dragable.event_id = -1;
2869 ep->items = NULL;
2870
2871 epp = (Edje_Part_Parser *)ep;
2872 epp->reorder.insert_before = NULL;
2873 epp->reorder.insert_after = NULL;
2874 epp->reorder.before = NULL;
2875 epp->reorder.after = NULL;
2876 epp->reorder.linked_prev = 0;
2877 epp->reorder.linked_next = 0;
2878 epp->reorder.done = EINA_FALSE;
2879 epp->can_override = EINA_FALSE;
2880}
2881
2882/**
2883 @page edcref
2884 @property
2885 name
2886 @parameters
2887 [part name]
2888 @effect
2889 The part's name will be used as reference in the theme's relative
2890 positioning system, by programs and in some cases by the application.
2891 It must be unique within the group.
2892 @endproperty
2893*/
2894static void
2895st_collections_group_parts_part_name(void)
2896{
2897 Edje_Part_Collection *pc;
2898 Edje_Part *ep;
2899 Edje_Part_Parser *epp;
2900
2901 check_arg_count(1);
2902
2903 pc = eina_list_data_get(eina_list_last(edje_collections));
2904 ep = current_part;
2905 ep->name = parse_str(0);
2906
2907 if (ep->name)
2908 {
2909 unsigned int i;
2910
2911 for (i = 0; i < (pc->parts_count - 1); i++)
2912 {
2913 if (pc->parts[i]->name && (!strcmp(pc->parts[i]->name, ep->name)))
2914 {
2915 epp = (Edje_Part_Parser *)pc->parts[i];
2916 if (!epp->can_override)
2917 {
2918 ERR("%s: Error. parse error %s:%i. There is already a part of the name %s",
2919 progname, file_in, line - 1, ep->name);
2920 exit(-1);
2921 }
2922 else
2923 {
2924 free(ep);
2925 pc->parts_count--;
2926 pc->parts = realloc(pc->parts, pc->parts_count * sizeof (Edje_Part *));
2927 ep = current_part = pc->parts[i];
2928 epp->can_override = EINA_FALSE;
2929 break;
2930 }
2931 }
2932 }
2933 }
2934}
2935
2936/**
2937 @page edcref
2938 @property
2939 type
2940 @parameters
2941 [TYPE]
2942 @effect
2943 Set the type (all caps) from among the available types, it's set to
2944 IMAGE by default. Valid types:
2945 @li RECT
2946 @li TEXT
2947 @li IMAGE
2948 @li SWALLOW
2949 @li TEXTBLOCK
2950 @li GROUP
2951 @li BOX
2952 @li TABLE
2953 @li EXTERNAL
2954 @li PROXY
2955 @endproperty
2956*/
2957static void
2958st_collections_group_parts_part_type(void)
2959{
2960 check_arg_count(1);
2961
2962 current_part->type = parse_enum(0,
2963 "NONE", EDJE_PART_TYPE_NONE,
2964 "RECT", EDJE_PART_TYPE_RECTANGLE,
2965 "TEXT", EDJE_PART_TYPE_TEXT,
2966 "IMAGE", EDJE_PART_TYPE_IMAGE,
2967 "SWALLOW", EDJE_PART_TYPE_SWALLOW,
2968 "TEXTBLOCK", EDJE_PART_TYPE_TEXTBLOCK,
2969 "GROUP", EDJE_PART_TYPE_GROUP,
2970 "BOX", EDJE_PART_TYPE_BOX,
2971 "TABLE", EDJE_PART_TYPE_TABLE,
2972 "EXTERNAL", EDJE_PART_TYPE_EXTERNAL,
2973 "PROXY", EDJE_PART_TYPE_PROXY,
2974 NULL);
2975}
2976
2977/**
2978 @page edcref
2979 @property
2980 insert_before
2981 @parameters
2982 [another part's name]
2983 @effect
2984 The part's name which this part is inserted before. One part cannot
2985 have both insert_before and insert_after. One part cannot refer
2986 more than one by insert_before.
2987 @endproperty
2988 @since 1.1.0
2989*/
2990static void
2991st_collections_group_parts_part_insert_before(void)
2992{
2993 Edje_Part_Parser *epp;
2994 check_arg_count(1);
2995
2996 epp = (Edje_Part_Parser *)current_part;
2997 epp->reorder.insert_before = parse_str(0);
2998}
2999
3000/**
3001 @page edcref
3002 @property
3003 insert_after
3004 @parameters
3005 [another part's name]
3006 @effect
3007 The part's name which this part is inserted after. One part cannot
3008 have both insert_before and insert_after. One part cannot refer
3009 more than one by insert_after.
3010 @endproperty
3011 @since 1.1.0
3012*/
3013static void
3014st_collections_group_parts_part_insert_after(void)
3015{
3016 Edje_Part_Parser *epp;
3017 check_arg_count(1);
3018
3019 epp = (Edje_Part_Parser *)current_part;
3020 epp->reorder.insert_after = parse_str(0);
3021}
3022
3023/**
3024 @page edcref
3025 @property
3026 mouse_events
3027 @parameters
3028 [1 or 0]
3029 @effect
3030 Specifies whether the part will emit signals, although it is named
3031 "mouse_events", disabling it (0) will prevent the part from emitting
3032 any type of signal at all. It's set to 1 by default.
3033 @endproperty
3034*/
3035static void
3036st_collections_group_parts_part_mouse_events(void)
3037{
3038 check_arg_count(1);
3039
3040 current_part->mouse_events = parse_bool(0);
3041}
3042
3043/**
3044 @page edcref
3045 @property
3046 repeat_events
3047 @parameters
3048 [1 or 0]
3049 @effect
3050 Specifies whether a part echoes a mouse event to other parts below the
3051 pointer (1), or not (0). It's set to 0 by default.
3052 @endproperty
3053*/
3054static void
3055st_collections_group_parts_part_repeat_events(void)
3056{
3057 check_arg_count(1);
3058
3059 current_part->repeat_events = parse_bool(0);
3060}
3061
3062/**
3063 @page edcref
3064 @property
3065 ignore_flags
3066 @parameters
3067 [FLAG] ...
3068 @effect
3069 Specifies whether events with the given flags should be ignored,
3070 i.e., will not have the signals emitted to the parts. Multiple flags
3071 must be separated by spaces, the effect will be ignoring all events
3072 with one of the flags specified. Possible flags:
3073 @li NONE (default value, no event will be ignored)
3074 @li ON_HOLD
3075 @endproperty
3076*/
3077static void
3078st_collections_group_parts_part_ignore_flags(void)
3079{
3080 check_min_arg_count(1);
3081
3082 current_part->ignore_flags = parse_flags(0,
3083 "NONE", EVAS_EVENT_FLAG_NONE,
3084 "ON_HOLD", EVAS_EVENT_FLAG_ON_HOLD,
3085 NULL);
3086}
3087
3088/**
3089 @page edcref
3090 @property
3091 scale
3092 @parameters
3093 [1 or 0]
3094 @effect
3095 Specifies whether the part will scale its size with an edje scaling
3096 factor. By default scale is off (0) and the default scale factor is
3097 1.0 - that means no scaling. This would be used to scale properties
3098 such as font size, min/max size of the part, and possibly can be used
3099 to scale based on DPI of the target device. The reason to be selective
3100 is that some things work well being scaled, others do not, so the
3101 designer gets to choose what works best.
3102 @endproperty
3103*/
3104static void
3105st_collections_group_parts_part_scale(void)
3106{
3107 check_arg_count(1);
3108
3109 current_part->scale = parse_bool(0);
3110}
3111
3112/**
3113 @page edcref
3114 @property
3115 pointer_mode
3116 @parameters
3117 [MODE]
3118 @effect
3119 Sets the mouse pointer behavior for a given part. The default value is
3120 AUTOGRAB. Aviable modes:
3121 @li AUTOGRAB, when the part is clicked and the button remains
3122 pressed, the part will be the source of all future mouse
3123 signals emitted, even outside the object, until the button is
3124 released.
3125 @li NOGRAB, the effect will be limited to the part's container.
3126 @endproperty
3127*/
3128static void
3129st_collections_group_parts_part_pointer_mode(void)
3130{
3131 check_arg_count(1);
3132
3133 current_part->pointer_mode = parse_enum(0,
3134 "AUTOGRAB", EVAS_OBJECT_POINTER_MODE_AUTOGRAB,
3135 "NOGRAB", EVAS_OBJECT_POINTER_MODE_NOGRAB,
3136 NULL);
3137}
3138
3139/**
3140 @page edcref
3141 @property
3142 precise_is_inside
3143 @parameters
3144 [1 or 0]
3145 @effect
3146 Enables precise point collision detection for the part, which is more
3147 resource intensive. Disabled by default.
3148 @endproperty
3149*/
3150static void
3151st_collections_group_parts_part_precise_is_inside(void)
3152{
3153 check_arg_count(1);
3154
3155 current_part->precise_is_inside = parse_bool(0);
3156}
3157
3158/**
3159 @page edcref
3160 @property
3161 use_alternate_font_metrics
3162 @parameters
3163 [1 or 0]
3164 @effect
3165 Only affects text and textblock parts, when enabled Edje will use
3166 different size measurement functions. Disabled by default. (note from
3167 the author: I don't know what this is exactlu useful for?)
3168 @endproperty
3169*/
3170static void
3171st_collections_group_parts_part_use_alternate_font_metrics(void)
3172{
3173 check_arg_count(1);
3174
3175 current_part->use_alternate_font_metrics = parse_bool(0);
3176}
3177
3178/**
3179 @page edcref
3180 @property
3181 clip_to
3182 @parameters
3183 [another part's name]
3184 @effect
3185 Only renders the area of part that coincides with another part's
3186 container. Overflowing content will not be displayed.
3187 @endproperty
3188*/
3189static void
3190st_collections_group_parts_part_clip_to_id(void)
3191{
3192 Edje_Part_Collection *pc;
3193
3194 check_arg_count(1);
3195
3196 pc = eina_list_data_get(eina_list_last(edje_collections));
3197 {
3198 char *name;
3199
3200 name = parse_str(0);
3201 data_queue_part_lookup(pc, name, &(current_part->clip_to_id));
3202 free(name);
3203 }
3204}
3205
3206/**
3207 @page edcref
3208 @property
3209 source
3210 @parameters
3211 [another group's name]
3212 @effect
3213 Only available to GROUP or TEXTBLOCK parts. Swallows the specified
3214 group into the part's container if a GROUP. If TEXTBLOCK it is used
3215 for the group to be loaded and used for selection display UNDER the
3216 selected text. source2 is used for on top of the selected text, if
3217 source2 is specified.
3218 @endproperty
3219*/
3220static void
3221st_collections_group_parts_part_source(void)
3222{
3223 check_arg_count(1);
3224
3225 //FIXME: validate this somehow (need to decide on the format also)
3226 current_part->source = parse_str(0);
3227}
3228
3229/**
3230 @page edcref
3231 @property
3232 source2
3233 @parameters
3234 [another group's name]
3235 @effect
3236 Only available to TEXTBLOCK parts. It is used for the group to be
3237 loaded and used for selection display OVER the selected text. source
3238 is used for under of the selected text, if source is specified.
3239 @endproperty
3240*/
3241static void
3242st_collections_group_parts_part_source2(void)
3243{
3244 check_arg_count(1);
3245
3246 //FIXME: validate this somehow (need to decide on the format also)
3247 current_part->source2 = parse_str(0);
3248}
3249
3250/**
3251 @page edcref
3252 @property
3253 source3
3254 @parameters
3255 [another group's name]
3256 @effect
3257 Only available to TEXTBLOCK parts. It is used for the group to be
3258 loaded and used for cursor display UNDER the cursor position. source4
3259 is used for over the cursor text, if source4 is specified.
3260 @endproperty
3261*/
3262static void
3263st_collections_group_parts_part_source3(void)
3264{
3265 check_arg_count(1);
3266
3267 //FIXME: validate this somehow (need to decide on the format also)
3268 current_part->source3 = parse_str(0);
3269}
3270
3271/**
3272 @page edcref
3273 @property
3274 source4
3275 @parameters
3276 [another group's name]
3277 @effect
3278 Only available to TEXTBLOCK parts. It is used for the group to be
3279 loaded and used for cursor display OVER the cursor position. source3
3280 is used for under the cursor text, if source4 is specified.
3281 @endproperty
3282*/
3283static void
3284st_collections_group_parts_part_source4(void)
3285{
3286 check_arg_count(1);
3287
3288 //FIXME: validate this somehow (need to decide on the format also)
3289 current_part->source4 = parse_str(0);
3290}
3291
3292/**
3293 @page edcref
3294 @property
3295 source5
3296 @parameters
3297 [another group's name]
3298 @effect
3299 Only available to TEXTBLOCK parts. It is used for the group to be
3300 loaded and used for anchors display UNDER the anchor position. source6
3301 is used for over the anchors text, if source6 is specified.
3302 @endproperty
3303*/
3304static void
3305st_collections_group_parts_part_source5(void)
3306{
3307 check_arg_count(1);
3308
3309 //FIXME: validate this somehow (need to decide on the format also)
3310 current_part->source5 = parse_str(0);
3311}
3312
3313/**
3314 @page edcref
3315 @property
3316 source6
3317 @parameters
3318 [another group's name]
3319 @effect
3320 Only available to TEXTBLOCK parts. It is used for the group to be
3321 loaded and used for anchor display OVER the anchor position. source5
3322 is used for under the anchor text, if source6 is specified.
3323 @endproperty
3324*/
3325static void
3326st_collections_group_parts_part_source6(void)
3327{
3328 check_arg_count(1);
3329
3330 //FIXME: validate this somehow (need to decide on the format also)
3331 current_part->source6 = parse_str(0);
3332}
3333
3334/**
3335 @page edcref
3336
3337 @property
3338 effect
3339 @parameters
3340 [EFFECT]
3341 (optional) [SHADOW DIRECTION]
3342 @effect
3343 Causes Edje to draw the selected effect among:
3344 @li PLAIN
3345 @li OUTLINE
3346 @li SOFT_OUTLINE
3347 @li SHADOW
3348 @li SOFT_SHADOW
3349 @li OUTLINE_SHADOW
3350 @li OUTLINE_SOFT_SHADOW
3351 @li FAR_SHADOW
3352 @li FAR_SOFT_SHADOW
3353 @li GLOW
3354
3355 Shadow directions (default if not given is BOTTOM_RIGHT):
3356 @li BOTTOM_RIGHT
3357 @li BOTTOM
3358 @li BOTTOM_LEFT
3359 @li LEFT
3360 @li TOP_LEFT
3361 @li TOP
3362 @li TOP_RIGHT
3363 @li RIGHT
3364 @endproperty
3365*/
3366static void
3367st_collections_group_parts_part_effect(void)
3368{
3369 check_min_arg_count(1);
3370
3371 current_part->effect = parse_enum(0,
3372 "NONE", EDJE_TEXT_EFFECT_NONE,
3373 "PLAIN", EDJE_TEXT_EFFECT_PLAIN,
3374 "OUTLINE", EDJE_TEXT_EFFECT_OUTLINE,
3375 "SOFT_OUTLINE", EDJE_TEXT_EFFECT_SOFT_OUTLINE,
3376 "SHADOW", EDJE_TEXT_EFFECT_SHADOW,
3377 "SOFT_SHADOW", EDJE_TEXT_EFFECT_SOFT_SHADOW,
3378 "OUTLINE_SHADOW", EDJE_TEXT_EFFECT_OUTLINE_SHADOW,
3379 "OUTLINE_SOFT_SHADOW", EDJE_TEXT_EFFECT_OUTLINE_SOFT_SHADOW,
3380 "FAR_SHADOW", EDJE_TEXT_EFFECT_FAR_SHADOW,
3381 "FAR_SOFT_SHADOW", EDJE_TEXT_EFFECT_FAR_SOFT_SHADOW,
3382 "GLOW", EDJE_TEXT_EFFECT_GLOW,
3383 NULL);
3384 if (get_arg_count() >= 2)
3385 {
3386 unsigned char shadow;
3387
3388 shadow = parse_enum(1,
3389 "BOTTOM_RIGHT", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_RIGHT,
3390 "BOTTOM", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM,
3391 "BOTTOM_LEFT", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_LEFT,
3392 "LEFT", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_LEFT,
3393 "TOP_LEFT", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP_LEFT,
3394 "TOP", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP,
3395 "TOP_RIGHT", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP_RIGHT,
3396 "RIGHT", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_RIGHT,
3397 NULL);
3398 EDJE_TEXT_EFFECT_SHADOW_DIRECTION_SET(current_part->effect, shadow);
3399 }
3400}
3401
3402/**
3403 @page edcref
3404 @property
3405 entry_mode
3406 @parameters
3407 [MODE]
3408 @effect
3409 Sets the edit mode for a textblock part to one of:
3410 @li NONE
3411 @li PLAIN
3412 @li EDITABLE
3413 @li PASSWORD
3414 It causes the part be editable if the edje object has the keyboard
3415 focus AND the part has the edje focus (or selectable always
3416 regardless of focus) and in the event of password mode, not
3417 selectable and all text chars replaced with *'s but editable and
3418 pastable.
3419 @endproperty
3420*/
3421static void
3422st_collections_group_parts_part_entry_mode(void)
3423{
3424 check_arg_count(1);
3425
3426 current_part->entry_mode = parse_enum(0,
3427 "NONE", EDJE_ENTRY_EDIT_MODE_NONE,
3428 "PLAIN", EDJE_ENTRY_EDIT_MODE_SELECTABLE,
3429 "EDITABLE", EDJE_ENTRY_EDIT_MODE_EDITABLE,
3430 "PASSWORD", EDJE_ENTRY_EDIT_MODE_PASSWORD,
3431 NULL);
3432}
3433
3434/**
3435 @page edcref
3436 @property
3437 select_mode
3438 @parameters
3439 [MODE]
3440 @effect
3441 Sets the selection mode for a textblock part to one of:
3442 @li DEFAULT
3443 @li EXPLICIT
3444 DEFAULT selection mode is what you would expect on any desktop. Press
3445 mouse, drag and release to end. EXPLICIT mode requires the application
3446 controlling the edje object has to explicitly begin and end selection
3447 modes, and the selection itself is dragable at both ends.
3448 @endproperty
3449*/
3450static void
3451st_collections_group_parts_part_select_mode(void)
3452{
3453 check_arg_count(1);
3454
3455 current_part->select_mode = parse_enum(0,
3456 "DEFAULT", EDJE_ENTRY_SELECTION_MODE_DEFAULT,
3457 "EXPLICIT", EDJE_ENTRY_SELECTION_MODE_EXPLICIT,
3458 NULL);
3459}
3460
3461/**
3462 @page edcref
3463 @property
3464 cursor_mode
3465 @parameters
3466 [MODE]
3467 @effect
3468 Sets the cursor mode for a textblock part to one of:
3469 @li UNDER
3470 @li BEFORE
3471 UNDER cursor mode means the cursor will draw below the character pointed
3472 at. That's the default.
3473 BEFORE cursor mode means the cursor is drawn as a vertical line before
3474 the current character, just like many other GUI toolkits handle it.
3475 @endproperty
3476*/
3477static void
3478st_collections_group_parts_part_cursor_mode(void)
3479{
3480 check_arg_count(1);
3481
3482 current_part->cursor_mode = parse_enum(0,
3483 "UNDER", EDJE_ENTRY_CURSOR_MODE_UNDER,
3484 "BEFORE", EDJE_ENTRY_CURSOR_MODE_BEFORE,
3485 NULL);
3486}
3487
3488/**
3489 @page edcref
3490 @property
3491 multiline
3492 @parameters
3493 [1 or 0]
3494 @effect
3495 It causes a textblock that is editable to allow multiple lines for
3496 editing.
3497 @endproperty
3498*/
3499static void
3500st_collections_group_parts_part_multiline(void)
3501{
3502 check_arg_count(1);
3503
3504 current_part->multiline = parse_bool(0);
3505}
3506
3507/**
3508 @page edcref
3509 @block
3510 dragable
3511 @context
3512 part {
3513 ..
3514 dragable {
3515 confine: "another part";
3516 events: "another dragable part";
3517 x: 0 0 0;
3518 y: 0 0 0;
3519 }
3520 ..
3521 }
3522 @description
3523 When this block is used the resulting part can be dragged around the
3524 interface, do not confuse with external drag & drop. By default Edje
3525 (and most applications) will attempt to use the minimal size possible
3526 for a dragable part. If the min property is not set in the description
3527 the part will be (most likely) set to 0px width and 0px height, thus
3528 invisible.
3529 @endblock
3530
3531 @property
3532 x
3533 @parameters
3534 [enable/disable] [step] [count]
3535 @effect
3536 Used to setup dragging events for the X axis. The first parameter is
3537 used to enable (1 or -1) and disable (0) dragging along the axis. When
3538 enabled, 1 will set the starting point at 0.0 and -1 at 1.0. The second
3539 parameter takes any integer and will limit movement to values
3540 divisible by it, causing the part to jump from position to position.
3541 The third parameter, (question from the author: What is count for?).
3542 @endproperty
3543*/
3544static void
3545st_collections_group_parts_part_dragable_x(void)
3546{
3547 check_arg_count(3);
3548
3549 current_part->dragable.x = parse_int_range(0, -1, 1);
3550 current_part->dragable.step_x = parse_int_range(1, 0, 0x7fffffff);
3551 current_part->dragable.count_x = parse_int_range(2, 0, 0x7fffffff);
3552}
3553
3554/**
3555 @page edcref
3556 @property
3557 y
3558 @parameters
3559 [enable/disable] [step] [count]
3560 @effect
3561 Used to setup dragging events for the Y axis. The first parameter is
3562 used to enable (1 or -1) and disable (0) dragging along the axis. When
3563 enabled, 1 will set the starting point at 0.0 and -1 at 1.0. The second
3564 parameter takes any integer and will limit movement to values
3565 divisibles by it, causing the part to jump from position to position.
3566 The third parameter, (question from the author: What is count for?).
3567 @endproperty
3568*/
3569static void
3570st_collections_group_parts_part_dragable_y(void)
3571{
3572 check_arg_count(3);
3573
3574 current_part->dragable.y = parse_int_range(0, -1, 1);
3575 current_part->dragable.step_y = parse_int_range(1, 0, 0x7fffffff);
3576 current_part->dragable.count_y = parse_int_range(2, 0, 0x7fffffff);
3577}
3578
3579/**
3580 @page edcref
3581 @property
3582 confine
3583 @parameters
3584 [another part's name]
3585 @effect
3586 When set, limits the movement of the dragged part to another part's
3587 container. When you use confine don't forget to set a min size for the
3588 part, or the draggie will not show up.
3589 @endproperty
3590*/
3591static void
3592st_collections_group_parts_part_dragable_confine(void)
3593{
3594 Edje_Part_Collection *pc;
3595
3596 check_arg_count(1);
3597
3598 pc = eina_list_data_get(eina_list_last(edje_collections));
3599 {
3600 char *name;
3601
3602 name = parse_str(0);
3603 data_queue_part_lookup(pc, name, &(current_part->dragable.confine_id));
3604 free(name);
3605 }
3606}
3607
3608/**
3609 @page edcref
3610 @property
3611 events
3612 @parameters
3613 [another dragable part's name]
3614 @effect
3615 It causes the part to forward the drag events to another part, thus
3616 ignoring them for itself.
3617 @endproperty
3618*/
3619static void
3620st_collections_group_parts_part_dragable_events(void)
3621{
3622 Edje_Part_Collection *pc;
3623
3624 check_arg_count(1);
3625
3626 pc = eina_list_data_get(eina_list_last(edje_collections));
3627 {
3628 char *name;
3629
3630 name = parse_str(0);
3631 data_queue_part_lookup(pc, name, &(current_part->dragable.event_id));
3632 free(name);
3633 }
3634}
3635
3636/**
3637 @page edcref
3638 @block
3639 items
3640 @context
3641 part {
3642 ..
3643 box {
3644 items {
3645 item {
3646 type: TYPE;
3647 source: "some source";
3648 min: 1 1;
3649 max: 100 100;
3650 padding: 1 1 2 2;
3651 }
3652 item {
3653 type: TYPE;
3654 source: "some other source";
3655 name: "some name";
3656 align: 1.0 0.5;
3657 }
3658 ..
3659 }
3660 }
3661 ..
3662 }
3663 @description
3664 On a part of type BOX, this block can be used to set other groups
3665 as elements of the box. These can be mixed with external objects set
3666 by the application through the edje_object_part_box_* API.
3667 @endblock
3668*/
3669static void ob_collections_group_parts_part_box_items_item(void)
3670{
3671 Edje_Part *ep;
3672 Edje_Pack_Element *item;
3673 Edje_Pack_Element_Parser *pitem;
3674
3675 ep = current_part;
3676
3677 if ((ep->type != EDJE_PART_TYPE_BOX) && (ep->type != EDJE_PART_TYPE_TABLE))
3678 {
3679 ERR("%s: Error. parse error %s:%i. "
3680 "box attributes in non-BOX or TABLE part.",
3681 progname, file_in, line - 1);
3682 exit(-1);
3683 }
3684
3685 ep->items_count++;
3686 ep->items = realloc(ep->items, sizeof (Edje_Pack_Element*) * ep->items_count);
3687 if (!ep->items)
3688 {
3689 ERR("%s: Error. Not enough memory.", progname);
3690 exit(-1);
3691 }
3692
3693 item = mem_alloc(SZ(Edje_Pack_Element_Parser));
3694 current_item = ep->items[ep->items_count - 1] = item;
3695 item->type = EDJE_PART_TYPE_GROUP;
3696 item->name = NULL;
3697 item->source = NULL;
3698 item->min.w = 0;
3699 item->min.h = 0;
3700 item->prefer.w = 0;
3701 item->prefer.h = 0;
3702 item->max.w = -1;
3703 item->max.h = -1;
3704 item->padding.l = 0;
3705 item->padding.r = 0;
3706 item->padding.t = 0;
3707 item->padding.b = 0;
3708 item->align.x = FROM_DOUBLE(0.5);
3709 item->align.y = FROM_DOUBLE(0.5);
3710 item->weight.x = FROM_DOUBLE(0.0);
3711 item->weight.y = FROM_DOUBLE(0.0);
3712 item->aspect.w = 0;
3713 item->aspect.h = 0;
3714 item->aspect.mode = EDJE_ASPECT_CONTROL_NONE;
3715 item->options = NULL;
3716 item->col = -1;
3717 item->row = -1;
3718 item->colspan = 1;
3719 item->rowspan = 1;
3720 pitem = (Edje_Pack_Element_Parser *)item;
3721 pitem->can_override = EINA_FALSE;
3722}
3723
3724/**
3725 @page edcref
3726 @property
3727 type
3728 @parameters
3729 Only GROUP for now (defaults to it)
3730 @effect
3731 Sets the type of the object this item will hold.
3732 @endproperty
3733*/
3734static void st_collections_group_parts_part_box_items_item_type(void)
3735{
3736 check_arg_count(1);
3737
3738 {
3739 char *s;
3740
3741 s = parse_str(0);
3742 if (strcmp(s, "GROUP"))
3743 {
3744 ERR("%s: Error. parse error %s:%i. "
3745 "token %s not one of: GROUP.",
3746 progname, file_in, line - 1, s);
3747 exit(-1);
3748 }
3749 /* FIXME: handle the enum, once everything else is supported */
3750 current_item->type = EDJE_PART_TYPE_GROUP;
3751 }
3752}
3753
3754/**
3755 @page edcref
3756 @property
3757 name
3758 @parameters
3759 [name for the object]
3760 @effect
3761 Sets the name of the object via evas_object_name_set().
3762 @endproperty
3763*/
3764static void st_collections_group_parts_part_box_items_item_name(void)
3765{
3766 Edje_Part *ep;
3767 Edje_Pack_Element *item;
3768 Edje_Pack_Element_Parser *pitem;
3769
3770 check_arg_count(1);
3771
3772 ep = current_part;
3773 item = ep->items[ep->items_count - 1];
3774
3775 item->name = parse_str(0);
3776
3777 {
3778 unsigned int i;
3779
3780 for (i = 0; i < ep->items_count - 1; ++i)
3781 {
3782 if (ep->items[i]->name && (!strcmp(ep->items[i]->name, item->name)))
3783 {
3784 pitem = (Edje_Pack_Element_Parser *)ep->items[i];
3785 if (!pitem->can_override)
3786 {
3787 ERR("%s: Error. parse error %s:%i. There is already a item of the name %s",
3788 progname, file_in, line - 1, item->name);
3789 exit(-1);
3790 }
3791 else
3792 {
3793 free(item);
3794 ep->items_count--;
3795 ep->items = realloc(ep->items, ep->items_count * sizeof (Edje_Pack_Element *));
3796 current_item = ep->items[i];
3797 pitem->can_override = EINA_FALSE;
3798 }
3799 }
3800 }
3801 }
3802}
3803
3804/**
3805 @page edcref
3806 @property
3807 source
3808 @parameters
3809 [another group's name]
3810 @effect
3811 Sets the group this object will be made from.
3812 @endproperty
3813*/
3814static void st_collections_group_parts_part_box_items_item_source(void)
3815{
3816 check_arg_count(1);
3817
3818 current_item->source = parse_str(0);
3819}
3820
3821/**
3822 @page edcref
3823 @property
3824 min
3825 @parameters
3826 [width] [height]
3827 @effect
3828 Sets the minimum size hints for this object.
3829 @endproperty
3830*/
3831static void st_collections_group_parts_part_box_items_item_min(void)
3832{
3833 check_arg_count(2);
3834
3835 current_item->min.w = parse_int_range(0, 0, 0x7ffffff);
3836 current_item->min.h = parse_int_range(1, 0, 0x7ffffff);
3837}
3838
3839/**
3840 @page edcref
3841 @property
3842 prefer
3843 @parameters
3844 [width] [height]
3845 @effect
3846 Sets the preferred size hints for this object.
3847 @endproperty
3848*/
3849static void st_collections_group_parts_part_box_items_item_prefer(void)
3850{
3851 check_arg_count(2);
3852
3853 current_item->prefer.w = parse_int_range(0, 0, 0x7ffffff);
3854 current_item->prefer.h = parse_int_range(1, 0, 0x7ffffff);
3855}
3856/**
3857 @page edcref
3858 @property
3859 max
3860 @parameters
3861 [width] [height]
3862 @effect
3863 Sets the maximum size hints for this object.
3864 @endproperty
3865*/
3866static void st_collections_group_parts_part_box_items_item_max(void)
3867{
3868 check_arg_count(2);
3869
3870 current_item->max.w = parse_int_range(0, 0, 0x7ffffff);
3871 current_item->max.h = parse_int_range(1, 0, 0x7ffffff);
3872}
3873
3874/**
3875 @page edcref
3876 @property
3877 padding
3878 @parameters
3879 [left] [right] [top] [bottom]
3880 @effect
3881 Sets the padding hints for this object.
3882 @endproperty
3883*/
3884static void st_collections_group_parts_part_box_items_item_padding(void)
3885{
3886 check_arg_count(4);
3887
3888 current_item->padding.l = parse_int_range(0, 0, 0x7ffffff);
3889 current_item->padding.r = parse_int_range(1, 0, 0x7ffffff);
3890 current_item->padding.t = parse_int_range(2, 0, 0x7ffffff);
3891 current_item->padding.b = parse_int_range(3, 0, 0x7ffffff);
3892}
3893
3894/**
3895 @page edcref
3896 @property
3897 align
3898 @parameters
3899 [x] [y]
3900 @effect
3901 Sets the alignment hints for this object.
3902 @endproperty
3903*/
3904static void st_collections_group_parts_part_box_items_item_align(void)
3905{
3906 check_arg_count(2);
3907
3908 current_item->align.x = FROM_DOUBLE(parse_float_range(0, -1.0, 1.0));
3909 current_item->align.y = FROM_DOUBLE(parse_float_range(1, -1.0, 1.0));
3910}
3911
3912/**
3913 @page edcref
3914 @property
3915 weight
3916 @parameters
3917 [x] [y]
3918 @effect
3919 Sets the weight hints for this object.
3920 @endproperty
3921*/
3922static void st_collections_group_parts_part_box_items_item_weight(void)
3923{
3924 check_arg_count(2);
3925
3926 current_item->weight.x = FROM_DOUBLE(parse_float_range(0, 0.0, 99999.99));
3927 current_item->weight.y = FROM_DOUBLE(parse_float_range(1, 0.0, 99999.99));
3928}
3929
3930/**
3931 @page edcref
3932 @property
3933 aspect
3934 @parameters
3935 [w] [h]
3936 @effect
3937 Sets the aspect width and height hints for this object.
3938 @endproperty
3939*/
3940static void st_collections_group_parts_part_box_items_item_aspect(void)
3941{
3942 check_arg_count(2);
3943
3944 current_item->aspect.w = parse_int_range(0, 0, 0x7fffffff);
3945 current_item->aspect.h = parse_int_range(1, 0, 0x7fffffff);
3946}
3947
3948/**
3949 @page edcref
3950 @property
3951 aspect_mode
3952 @parameters
3953 NONE, NEITHER, HORIZONTAL, VERTICAL, BOTH
3954 @effect
3955 Sets the aspect control hints for this object.
3956 @endproperty
3957*/
3958static void st_collections_group_parts_part_box_items_item_aspect_mode(void)
3959{
3960 check_arg_count(1);
3961
3962 current_item->aspect.mode = parse_enum(0,
3963 "NONE", EDJE_ASPECT_CONTROL_NONE,
3964 "NEITHER", EDJE_ASPECT_CONTROL_NEITHER,
3965 "HORIZONTAL", EDJE_ASPECT_CONTROL_HORIZONTAL,
3966 "VERTICAL", EDJE_ASPECT_CONTROL_VERTICAL,
3967 "BOTH", EDJE_ASPECT_CONTROL_BOTH,
3968 NULL);
3969}
3970
3971/**
3972 @page edcref
3973 @property
3974 options
3975 @parameters
3976 [extra options]
3977 @effect
3978 Sets extra options for the object. Unused for now.
3979 @endproperty
3980*/
3981static void st_collections_group_parts_part_box_items_item_options(void)
3982{
3983 check_arg_count(1);
3984
3985 current_item->options = parse_str(0);
3986}
3987
3988/**
3989 @page edcref
3990 @property
3991 position
3992 @parameters
3993 [col] [row]
3994 @effect
3995 Sets the position this item will have in the table.
3996 This is required for parts of type TABLE.
3997 @endproperty
3998*/
3999static void st_collections_group_parts_part_table_items_item_position(void)
4000{
4001 check_arg_count(2);
4002
4003 if (current_part->type != EDJE_PART_TYPE_TABLE)
4004 {
4005 ERR("%s: Error. parse error %s:%i. "
4006 "table attributes in non-TABLE part.",
4007 progname, file_in, line - 1);
4008 exit(-1);
4009 }
4010
4011 current_item->col = parse_int_range(0, 0, 0xffff);
4012 current_item->row = parse_int_range(1, 0, 0xffff);
4013}
4014
4015/**
4016 @page edcref
4017 @property
4018 span
4019 @parameters
4020 [col] [row]
4021 @effect
4022 Sets how many columns/rows this item will use.
4023 Defaults to 1 1.
4024 @endproperty
4025*/
4026static void st_collections_group_parts_part_table_items_item_span(void)
4027{
4028 check_arg_count(2);
4029
4030 if (current_part->type != EDJE_PART_TYPE_TABLE)
4031 {
4032 ERR("%s: Error. parse error %s:%i. "
4033 "table attributes in non-TABLE part.",
4034 progname, file_in, line - 1);
4035 exit(-1);
4036 }
4037
4038 current_item->colspan = parse_int_range(0, 1, 0xffff);
4039 current_item->rowspan = parse_int_range(1, 1, 0xffff);
4040}
4041
4042/**
4043 @edcsection{description,State description sub blocks}
4044 */
4045
4046/**
4047 @page edcref
4048 @block
4049 description
4050 @context
4051 description {
4052 inherit: "another_description" INDEX;
4053 state: "description_name" INDEX;
4054 visible: 1;
4055 min: 0 0;
4056 max: -1 -1;
4057 align: 0.5 0.5;
4058 fixed: 0 0;
4059 step: 0 0;
4060 aspect: 1 1;
4061
4062 rel1 {
4063 ..
4064 }
4065
4066 rel2 {
4067 ..
4068 }
4069 }
4070 @description
4071 Every part can have one or more description blocks. Each description is
4072 used to define style and layout properties of a part in a given
4073 "state".
4074 @endblock
4075*/
4076static void
4077ob_collections_group_parts_part_description(void)
4078{
4079 Edje_Part_Collection *pc;
4080 Edje_Part *ep;
4081 Edje_Part_Description_Common *ed;
4082
4083 pc = eina_list_data_get(eina_list_last(edje_collections));
4084 ep = current_part;
4085
4086 ed = _edje_part_description_alloc(ep->type, pc->part, ep->name);
4087
4088 if (!ep->default_desc)
4089 {
4090 current_desc = ep->default_desc = ed;
4091 }
4092 else
4093 {
4094 ep->other.desc_count++;
4095 ep->other.desc = realloc(ep->other.desc,
4096 sizeof (Edje_Part_Description_Common*) * ep->other.desc_count);
4097 current_desc = ep->other.desc[ep->other.desc_count - 1] = ed;
4098 }
4099
4100 ed->visible = 1;
4101 ed->align.x = FROM_DOUBLE(0.5);
4102 ed->align.y = FROM_DOUBLE(0.5);
4103 ed->min.w = 0;
4104 ed->min.h = 0;
4105 ed->fixed.w = 0;
4106 ed->fixed.h = 0;
4107 ed->max.w = -1;
4108 ed->max.h = -1;
4109 ed->rel1.relative_x = FROM_DOUBLE(0.0);
4110 ed->rel1.relative_y = FROM_DOUBLE(0.0);
4111 ed->rel1.offset_x = 0;
4112 ed->rel1.offset_y = 0;
4113 ed->rel1.id_x = -1;
4114 ed->rel1.id_y = -1;
4115 ed->rel2.relative_x = FROM_DOUBLE(1.0);
4116 ed->rel2.relative_y = FROM_DOUBLE(1.0);
4117 ed->rel2.offset_x = -1;
4118 ed->rel2.offset_y = -1;
4119 ed->rel2.id_x = -1;
4120 ed->rel2.id_y = -1;
4121 ed->color_class = NULL;
4122 ed->color.r = 255;
4123 ed->color.g = 255;
4124 ed->color.b = 255;
4125 ed->color.a = 255;
4126 ed->color2.r = 0;
4127 ed->color2.g = 0;
4128 ed->color2.b = 0;
4129 ed->color2.a = 255;
4130 ed->map.id_persp = -1;
4131 ed->map.id_light = -1;
4132 ed->map.rot.id_center = -1;
4133 ed->map.rot.x = FROM_DOUBLE(0.0);
4134 ed->map.rot.y = FROM_DOUBLE(0.0);
4135 ed->map.rot.z = FROM_DOUBLE(0.0);
4136 ed->map.on = 0;
4137 ed->map.smooth = 1;
4138 ed->map.alpha = 1;
4139 ed->map.backcull = 0;
4140 ed->map.persp_on = 0;
4141 ed->persp.zplane = 0;
4142 ed->persp.focal = 1000;
4143}
4144
4145/**
4146 @page edcref
4147 @property
4148 inherit
4149 @parameters
4150 [another description's name] [another description's index]
4151 @effect
4152 When set, the description will inherit all the properties from the
4153 named description. The properties defined in this part will override
4154 the inherited properties, reducing the amount of necessary code for
4155 simple state changes. Note: inheritance in Edje is single level only.
4156 @endproperty
4157*/
4158static void
4159st_collections_group_parts_part_description_inherit(void)
4160{
4161 Edje_Part_Collection *pc;
4162 Edje_Part *ep;
4163 Edje_Part_Description_Common *ed, *parent = NULL;
4164 Edje_Part_Image_Id *iid;
4165 char *parent_name;
4166 const char *state_name;
4167 double parent_val, state_val;
4168
4169 pc = eina_list_data_get(eina_list_last(edje_collections));
4170 ep = current_part;
4171 ed = current_desc;
4172
4173 if (!ed->state.name)
4174 {
4175 ERR("%s: Error. parse error %s:%i. "
4176 "inherit may only be used after state",
4177 progname, file_in, line - 1);
4178 exit(-1);
4179 }
4180
4181 parent = parent_desc;
4182 if (!parent)
4183 {
4184 check_arg_count(2);
4185
4186 /* inherit may not be used in the default description */
4187 if (!ep->other.desc_count)
4188 {
4189 ERR("%s: Error. parse error %s:%i. "
4190 "inherit may not be used in the default description",
4191 progname, file_in, line - 1);
4192 exit(-1);
4193 }
4194
4195 /* find the description that we inherit from */
4196 parent_name = parse_str(0);
4197 parent_val = parse_float_range(1, 0.0, 1.0);
4198
4199 if (!strcmp (parent_name, "default") && parent_val == 0.0)
4200 parent = ep->default_desc;
4201 else
4202 {
4203 Edje_Part_Description_Common *d;
4204 double min_dst = 999.0;
4205 unsigned int i;
4206
4207 if (!strcmp(parent_name, "default"))
4208 {
4209 parent = ep->default_desc;
4210 min_dst = ABS(ep->default_desc->state.value - parent_val);
4211 }
4212
4213 for (i = 0; i < ep->other.desc_count; ++i)
4214 {
4215 d = ep->other.desc[i];
4216
4217 if (!strcmp (d->state.name, parent_name))
4218 {
4219
4220 double dst;
4221
4222 dst = ABS(d->state.value - parent_val);
4223 if (dst < min_dst)
4224 {
4225 parent = d;
4226 min_dst = dst;
4227 }
4228 }
4229 }
4230 }
4231
4232 if (!parent)
4233 {
4234 ERR("%s: Error. parse error %s:%i. "
4235 "cannot find referenced part state %s %lf",
4236 ep->name, file_in, line - 1, parent_name, parent_val);
4237 exit(-1);
4238 }
4239
4240 free(parent_name);
4241 }
4242 /* now do a full copy, only state info will be kept */
4243 state_name = ed->state.name;
4244 state_val = ed->state.value;
4245
4246 *ed = *parent;
4247
4248 ed->state.name = state_name;
4249 ed->state.value = state_val;
4250
4251 data_queue_copied_part_lookup(pc, &parent->rel1.id_x, &ed->rel1.id_x);
4252 data_queue_copied_part_lookup(pc, &parent->rel1.id_y, &ed->rel1.id_y);
4253 data_queue_copied_part_lookup(pc, &parent->rel2.id_x, &ed->rel2.id_x);
4254 data_queue_copied_part_lookup(pc, &parent->rel2.id_y, &ed->rel2.id_y);
4255
4256 data_queue_copied_part_lookup(pc, &parent->map.id_persp, &ed->map.id_persp);
4257 data_queue_copied_part_lookup(pc, &parent->map.id_light, &ed->map.id_light);
4258 data_queue_copied_part_lookup(pc, &parent->map.rot.id_center, &ed->map.rot.id_center);
4259
4260 /* make sure all the allocated memory is getting copied, not just
4261 * referenced
4262 */
4263#define STRDUP(x) x ? strdup(x) : NULL
4264
4265 ed->color_class = STRDUP(ed->color_class);
4266 switch (ep->type)
4267 {
4268 case EDJE_PART_TYPE_RECTANGLE:
4269 case EDJE_PART_TYPE_SWALLOW:
4270 case EDJE_PART_TYPE_GROUP:
4271 /* Nothing todo, this part only have a common description. */
4272 break;
4273 case EDJE_PART_TYPE_TEXT:
4274 case EDJE_PART_TYPE_TEXTBLOCK:
4275 {
4276 Edje_Part_Description_Text *ted = (Edje_Part_Description_Text*) ed;
4277 Edje_Part_Description_Text *tparent = (Edje_Part_Description_Text*) parent;
4278
4279 ted->text = tparent->text;
4280
4281 ted->text.text.str = STRDUP(ted->text.text.str);
4282 ted->text.text_class = STRDUP(ted->text.text_class);
4283 ted->text.font.str = STRDUP(ted->text.font.str);
4284
4285 data_queue_copied_part_lookup(pc, &(tparent->text.id_source), &(ted->text.id_source));
4286 data_queue_copied_part_lookup(pc, &(tparent->text.id_text_source), &(ted->text.id_text_source));
4287
4288 break;
4289 }
4290 case EDJE_PART_TYPE_IMAGE:
4291 {
4292 Edje_Part_Description_Image *ied = (Edje_Part_Description_Image *) ed;
4293 Edje_Part_Description_Image *iparent = (Edje_Part_Description_Image *) parent;
4294 unsigned int i;
4295
4296 ied->image = iparent->image;
4297
4298 data_queue_copied_image_lookup(&iparent->image.id, &ied->image.id, &ied->image.set);
4299
4300 ied->image.tweens = calloc(iparent->image.tweens_count,
4301 sizeof (Edje_Part_Image_Id*));
4302 for (i = 0; i < iparent->image.tweens_count; i++)
4303 {
4304 Edje_Part_Image_Id *iid_new;
4305
4306 iid = iparent->image.tweens[i];
4307
4308 iid_new = mem_alloc(SZ(Edje_Part_Image_Id));
4309 data_queue_copied_image_lookup(&(iid->id), &(iid_new->id), &(iid_new->set));
4310 ied->image.tweens[i] = iid_new;
4311 }
4312
4313 break;
4314 }
4315 case EDJE_PART_TYPE_PROXY:
4316 {
4317 Edje_Part_Description_Proxy *ped = (Edje_Part_Description_Proxy*) ed;
4318 Edje_Part_Description_Proxy *pparent = (Edje_Part_Description_Proxy*) parent;
4319
4320 data_queue_copied_part_lookup(pc, &(pparent->proxy.id), &(ped->proxy.id));
4321
4322 break;
4323 }
4324 case EDJE_PART_TYPE_BOX:
4325 {
4326 Edje_Part_Description_Box *bed = (Edje_Part_Description_Box *) ed;
4327 Edje_Part_Description_Box *bparent = (Edje_Part_Description_Box *) parent;
4328
4329 bed->box = bparent->box;
4330
4331 break;
4332 }
4333 case EDJE_PART_TYPE_TABLE:
4334 {
4335 Edje_Part_Description_Table *ted = (Edje_Part_Description_Table *) ed;
4336 Edje_Part_Description_Table *tparent = (Edje_Part_Description_Table *) parent;
4337
4338 ted->table = tparent->table;
4339
4340 break;
4341 }
4342 case EDJE_PART_TYPE_EXTERNAL:
4343 {
4344 Edje_Part_Description_External *eed = (Edje_Part_Description_External *) ed;
4345 Edje_Part_Description_External *eparent = (Edje_Part_Description_External *) parent;
4346
4347 if (eparent->external_params)
4348 {
4349 Eina_List *l;
4350 Edje_External_Param *param, *new_param;
4351
4352 eed->external_params = NULL;
4353 EINA_LIST_FOREACH(eparent->external_params, l, param)
4354 {
4355 new_param = mem_alloc(SZ(Edje_External_Param));
4356 *new_param = *param;
4357 eed->external_params = eina_list_append(eed->external_params, new_param);
4358 }
4359 }
4360 break;
4361 }
4362 }
4363
4364#undef STRDUP
4365}
4366
4367/**
4368 @page edcref
4369
4370 @property
4371 source
4372 @parameters
4373 [another part's name]
4374 @effect
4375 Causes the part to use another part content as the content of this part.
4376 Only work with PROXY part.
4377 @endproperty
4378*/
4379static void
4380st_collections_group_parts_part_description_source(void)
4381{
4382 Edje_Part_Collection *pc;
4383 Edje_Part_Description_Proxy *ed;
4384 char *name;
4385
4386 check_arg_count(1);
4387
4388 pc = eina_list_data_get(eina_list_last(edje_collections));
4389
4390 if (current_part->type != EDJE_PART_TYPE_PROXY)
4391 {
4392 ERR("%s: Error. parse error %s:%i. "
4393 "source attributes in non-PROXY part.",
4394 progname, file_in, line - 1);
4395 exit(-1);
4396 }
4397
4398 ed = (Edje_Part_Description_Proxy*) current_desc;
4399
4400 name = parse_str(0);
4401
4402 data_queue_part_lookup(pc, name, &(ed->proxy.id));
4403 free(name);
4404}
4405
4406/**
4407 @page edcref
4408 @property
4409 state
4410 @parameters
4411 [a name for the description] [an index]
4412 @effect
4413 Sets a name used to identify a description inside a given part.
4414 Multiple descriptions are used to declare different states of the same
4415 part, like "clicked" or "invisible". All states declarations are also
4416 coupled with an index number between 0.0 and 1.0. All parts must have
4417 at least one description named "default 0.0".
4418 @endproperty
4419*/
4420static void
4421st_collections_group_parts_part_description_state(void)
4422{
4423 Edje_Part *ep;
4424 Edje_Part_Description_Common *ed;
4425 char *s;
4426
4427 check_arg_count(2);
4428
4429 ep = current_part;
4430
4431 ed = ep->default_desc;
4432 if (ep->other.desc_count) ed = ep->other.desc[ep->other.desc_count - 1];
4433
4434 s = parse_str(0);
4435 if (!strcmp (s, "custom"))
4436 {
4437 ERR("%s: Error. parse error %s:%i. "
4438 "invalid state name: '%s'.",
4439 progname, file_in, line - 1, s);
4440 exit(-1);
4441 }
4442
4443 ed->state.name = s;
4444 ed->state.value = parse_float_range(1, 0.0, 1.0);
4445
4446 if (ed != ep->default_desc)
4447 {
4448 if ((ep->default_desc->state.name && !strcmp(s, ep->default_desc->state.name) && ed->state.value == ep->default_desc->state.value) ||
4449 (!ep->default_desc->state.name && !strcmp(s, "default") && ed->state.value == ep->default_desc->state.value))
4450 {
4451 free(ed);
4452 ep->other.desc_count--;
4453 ep->other.desc = realloc(ep->other.desc,
4454 sizeof (Edje_Part_Description_Common*) * ep->other.desc_count);
4455 current_desc = ep->default_desc;
4456 }
4457 else if (ep->other.desc_count)
4458 {
4459 unsigned int i;
4460 for (i = 0; i < ep->other.desc_count - 1; ++i)
4461 {
4462 if (!strcmp(s, ep->other.desc[i]->state.name) && ed->state.value == ep->other.desc[i]->state.value)
4463 {
4464 free(ed);
4465 ep->other.desc_count--;
4466 ep->other.desc = realloc(ep->other.desc,
4467 sizeof (Edje_Part_Description_Common*) * ep->other.desc_count);
4468 current_desc = ep->other.desc[i];
4469 break;
4470 }
4471 }
4472 }
4473 }
4474}
4475
4476/**
4477 @page edcref
4478 @property
4479 visible
4480 @parameters
4481 [0 or 1]
4482 @effect
4483 Takes a boolean value specifying whether part is visible (1) or not
4484 (0). Non-visible parts do not emit signals. The default value is 1.
4485 @endproperty
4486*/
4487static void
4488st_collections_group_parts_part_description_visible(void)
4489{
4490 check_arg_count(1);
4491
4492 current_desc->visible = parse_bool(0);
4493}
4494
4495/**
4496 @page edcref
4497 @property
4498 align
4499 @parameters
4500 [X axis] [Y axis]
4501 @effect
4502 When the displayed object's size is smaller than its container, this
4503 property moves it relatively along both axis inside its container. The
4504 default value is "0.5 0.5".
4505 @endproperty
4506*/
4507static void
4508st_collections_group_parts_part_description_align(void)
4509{
4510 check_arg_count(2);
4511
4512 current_desc->align.x = FROM_DOUBLE(parse_float_range(0, 0.0, 1.0));
4513 current_desc->align.y = FROM_DOUBLE(parse_float_range(1, 0.0, 1.0));
4514}
4515
4516/**
4517 @page edcref
4518 @property
4519 fixed
4520 @parameters
4521 [width, 0 or 1] [height, 0 or 1]
4522 @effect
4523 This affects the minimum size calculation. See
4524 edje_object_size_min_calc() and edje_object_size_min_restricted_calc().
4525 This tells the min size calculation routine that this part does not
4526 change size in width or height (1 for it doesn't, 0 for it does), so
4527 the routine should not try and expand or contract the part.
4528 @endproperty
4529*/
4530static void
4531st_collections_group_parts_part_description_fixed(void)
4532{
4533 check_arg_count(2);
4534
4535 current_desc->fixed.w = parse_float_range(0, 0, 1);
4536 current_desc->fixed.h = parse_float_range(1, 0, 1);
4537}
4538
4539/**
4540 @page edcref
4541 @property
4542 min
4543 @parameters
4544 [width] [height]
4545 @effect
4546 The minimum size of the state.
4547 @endproperty
4548*/
4549static void
4550st_collections_group_parts_part_description_min(void)
4551{
4552 check_arg_count(2);
4553
4554 current_desc->min.w = parse_float_range(0, 0, 0x7fffffff);
4555 current_desc->min.h = parse_float_range(1, 0, 0x7fffffff);
4556}
4557
4558/**
4559 @page edcref
4560 @property
4561 max
4562 @parameters
4563 [width] [height]
4564 @effect
4565 The maximum size of the state. A size of -1.0 means that it will be ignored in one direction.
4566 @endproperty
4567*/
4568static void
4569st_collections_group_parts_part_description_max(void)
4570{
4571 check_arg_count(2);
4572
4573 current_desc->max.w = parse_float_range(0, -1.0, 0x7fffffff);
4574 current_desc->max.h = parse_float_range(1, -1.0, 0x7fffffff);
4575}
4576
4577/**
4578 @page edcref
4579 @property
4580 step
4581 @parameters
4582 [width] [height]
4583 @effect
4584 Restricts resizing of each dimension to values divisibles by its value.
4585 This causes the part to jump from value to value while resizing. The
4586 default value is "0 0" disabling stepping.
4587 @endproperty
4588*/
4589static void
4590st_collections_group_parts_part_description_step(void)
4591{
4592 check_arg_count(2);
4593
4594 current_desc->step.x = parse_float_range(0, 0, 0x7fffffff);
4595 current_desc->step.y = parse_float_range(1, 0, 0x7fffffff);
4596}
4597
4598/**
4599 @page edcref
4600 @property
4601 aspect
4602 @parameters
4603 [min] [max]
4604 @effect
4605 Normally width and height can be resized to any values independently.
4606 The aspect property forces the width to height ratio to be kept between
4607 the minimum and maximum set. For example, "1.0 1.0" will increase the
4608 width a pixel for every pixel added to heigh. The default value is
4609 "0.0 0.0" disabling aspect.
4610 @endproperty
4611*/
4612static void
4613st_collections_group_parts_part_description_aspect(void)
4614{
4615 check_arg_count(2);
4616
4617 current_desc->aspect.min = FROM_DOUBLE(parse_float_range(0, 0.0, 999999999.0));
4618 current_desc->aspect.max = FROM_DOUBLE(parse_float_range(1, 0.0, 999999999.0));
4619}
4620
4621/**
4622 @page edcref
4623 @property
4624 aspect_preference
4625 @parameters
4626 [DIMENSION]
4627 @effect
4628 Sets the scope of the "aspect" property to a given dimension. Available
4629 options are BOTH, VERTICAL, HORIZONTAL and NONE
4630 @endproperty
4631*/
4632static void
4633st_collections_group_parts_part_description_aspect_preference(void)
4634{
4635 check_arg_count(1);
4636
4637 current_desc->aspect.prefer = parse_enum(0,
4638 "NONE", EDJE_ASPECT_PREFER_NONE,
4639 "VERTICAL", EDJE_ASPECT_PREFER_VERTICAL,
4640 "HORIZONTAL", EDJE_ASPECT_PREFER_HORIZONTAL,
4641 "BOTH", EDJE_ASPECT_PREFER_BOTH,
4642 NULL);
4643}
4644
4645/**
4646 @page edcref
4647 @property
4648 color_class
4649 @parameters
4650 [color class name]
4651 @effect
4652 The part will use the color values of the named color_class, these
4653 values can be overrided by the "color", "color2" and "color3"
4654 properties set below.
4655 @endproperty
4656*/
4657static void
4658st_collections_group_parts_part_description_color_class(void)
4659{
4660 check_arg_count(1);
4661
4662 current_desc->color_class = parse_str(0);
4663}
4664
4665/**
4666 @page edcref
4667 @property
4668 color
4669 @parameters
4670 [red] [green] [blue] [alpha]
4671 @effect
4672 Sets the main color to the specified values (between 0 and 255).
4673 @endproperty
4674*/
4675static void
4676st_collections_group_parts_part_description_color(void)
4677{
4678 check_arg_count(4);
4679
4680 current_desc->color.r = parse_int_range(0, 0, 255);
4681 current_desc->color.g = parse_int_range(1, 0, 255);
4682 current_desc->color.b = parse_int_range(2, 0, 255);
4683 current_desc->color.a = parse_int_range(3, 0, 255);
4684}
4685
4686/**
4687 @page edcref
4688 @property
4689 color2
4690 @parameters
4691 [red] [green] [blue] [alpha]
4692 @effect
4693 Sets the text shadow color to the specified values (0 to 255).
4694 @endproperty
4695*/
4696static void
4697st_collections_group_parts_part_description_color2(void)
4698{
4699 check_arg_count(4);
4700
4701 current_desc->color2.r = parse_int_range(0, 0, 255);
4702 current_desc->color2.g = parse_int_range(1, 0, 255);
4703 current_desc->color2.b = parse_int_range(2, 0, 255);
4704 current_desc->color2.a = parse_int_range(3, 0, 255);
4705}
4706
4707/**
4708 @page edcref
4709 @property
4710 color3
4711 @parameters
4712 [red] [green] [blue] [alpha]
4713 @effect
4714 Sets the text outline color to the specified values (0 to 255).
4715 @endproperty
4716*/
4717static void
4718st_collections_group_parts_part_description_color3(void)
4719{
4720 Edje_Part_Collection *pc;
4721 Edje_Part_Description_Text *ed;
4722
4723 check_arg_count(4);
4724
4725 pc = eina_list_data_get(eina_list_last(edje_collections));
4726
4727 if (current_part->type != EDJE_PART_TYPE_TEXT
4728 && current_part->type != EDJE_PART_TYPE_TEXTBLOCK)
4729 {
4730 ERR("%s: Error. Setting color3 in part %s from %s not of type TEXT or TEXTBLOCK.", progname, current_part->name, pc->part);
4731 exit(-1);
4732 }
4733
4734 ed = (Edje_Part_Description_Text*)current_desc;
4735
4736 ed->text.color3.r = parse_int_range(0, 0, 255);
4737 ed->text.color3.g = parse_int_range(1, 0, 255);
4738 ed->text.color3.b = parse_int_range(2, 0, 255);
4739 ed->text.color3.a = parse_int_range(3, 0, 255);
4740}
4741
4742/**
4743 @page edcref
4744 @block
4745 rel1/rel2
4746 @context
4747 description {
4748 ..
4749 rel1 {
4750 relative: 0.0 0.0;
4751 offset: 0 0;
4752 }
4753 ..
4754 rel2 {
4755 relative: 1.0 1.0;
4756 offset: -1 -1;
4757 }
4758 ..
4759 }
4760 @description
4761 The rel1 and rel2 blocks are used to define the position of each corner
4762 of the part's container. With rel1 being the left-up corner and rel2
4763 being the right-down corner.
4764 @endblock
4765
4766 @property
4767 relative
4768 @parameters
4769 [X axis] [Y axis]
4770 @effect
4771 Moves a corner to a relative position inside the container of the
4772 relative "to" part. Values from 0.0 (0%, beginning) to 1.0 (100%, end)
4773 of each axis.
4774 @endproperty
4775*/
4776static void
4777st_collections_group_parts_part_description_rel1_relative(void)
4778{
4779 check_arg_count(2);
4780
4781 current_desc->rel1.relative_x = FROM_DOUBLE(parse_float(0));
4782 current_desc->rel1.relative_y = FROM_DOUBLE(parse_float(1));
4783}
4784
4785/**
4786 @page edcref
4787 @property
4788 offset
4789 @parameters
4790 [X axis] [Y axis]
4791 @effect
4792 Affects the corner position a fixed number of pixels along each axis.
4793 @endproperty
4794*/
4795static void
4796st_collections_group_parts_part_description_rel1_offset(void)
4797{
4798 check_arg_count(2);
4799
4800 current_desc->rel1.offset_x = parse_int(0);
4801 current_desc->rel1.offset_y = parse_int(1);
4802}
4803
4804/**
4805 @page edcref
4806 @property
4807 to
4808 @parameters
4809 [another part's name]
4810 @effect
4811 Causes a corner to be positioned relatively to another part's
4812 container. Setting to "" will un-set this value for inherited
4813 parts.
4814 @endproperty
4815*/
4816static void
4817st_collections_group_parts_part_description_rel1_to(void)
4818{
4819 Edje_Part_Collection *pc;
4820
4821 check_arg_count(1);
4822
4823 pc = eina_list_data_get(eina_list_last(edje_collections));
4824
4825 {
4826 char *name;
4827
4828 name = parse_str(0);
4829 data_queue_part_lookup(pc, name, &(current_desc->rel1.id_x));
4830 data_queue_part_lookup(pc, name, &(current_desc->rel1.id_y));
4831 free(name);
4832 }
4833}
4834
4835/**
4836 @page edcref
4837 @property
4838 to_x
4839 @parameters
4840 [another part's name]
4841 @effect
4842 Causes a corner to be positioned relatively to the X axis of another
4843 part's container. Simply put affects the first parameter of "relative".
4844 Setting to "" will un-set this value for inherited parts.
4845 @endproperty
4846*/
4847static void
4848st_collections_group_parts_part_description_rel1_to_x(void)
4849{
4850 Edje_Part_Collection *pc;
4851
4852 check_arg_count(1);
4853
4854 pc = eina_list_data_get(eina_list_last(edje_collections));
4855
4856 {
4857 char *name;
4858
4859 name = parse_str(0);
4860 data_queue_part_lookup(pc, name, &(current_desc->rel1.id_x));
4861 free(name);
4862 }
4863}
4864
4865/**
4866 @page edcref
4867 @property
4868 to_y
4869 @parameters
4870 [another part's name]
4871 @effect
4872 Causes a corner to be positioned relatively to the Y axis of another
4873 part's container. Simply put, affects the second parameter of
4874 "relative". Setting to "" will un-set this value for inherited parts.
4875 @endproperty
4876*/
4877static void
4878st_collections_group_parts_part_description_rel1_to_y(void)
4879{
4880 Edje_Part_Collection *pc;
4881
4882 check_arg_count(1);
4883
4884 pc = eina_list_data_get(eina_list_last(edje_collections));
4885
4886 {
4887 char *name;
4888
4889 name = parse_str(0);
4890 data_queue_part_lookup(pc, name, &(current_desc->rel1.id_y));
4891 free(name);
4892 }
4893}
4894
4895static void
4896st_collections_group_parts_part_description_rel2_relative(void)
4897{
4898 check_arg_count(2);
4899
4900 current_desc->rel2.relative_x = FROM_DOUBLE(parse_float(0));
4901 current_desc->rel2.relative_y = FROM_DOUBLE(parse_float(1));
4902}
4903
4904static void
4905st_collections_group_parts_part_description_rel2_offset(void)
4906{
4907 check_arg_count(2);
4908
4909 current_desc->rel2.offset_x = parse_int(0);
4910 current_desc->rel2.offset_y = parse_int(1);
4911}
4912
4913static void
4914st_collections_group_parts_part_description_rel2_to(void)
4915{
4916 Edje_Part_Collection *pc;
4917
4918 check_arg_count(1);
4919
4920 pc = eina_list_data_get(eina_list_last(edje_collections));
4921
4922 {
4923 char *name;
4924
4925 name = parse_str(0);
4926 data_queue_part_lookup(pc, name, &(current_desc->rel2.id_x));
4927 data_queue_part_lookup(pc, name, &(current_desc->rel2.id_y));
4928 free(name);
4929 }
4930}
4931
4932static void
4933st_collections_group_parts_part_description_rel2_to_x(void)
4934{
4935 Edje_Part_Collection *pc;
4936
4937 check_arg_count(1);
4938
4939 pc = eina_list_data_get(eina_list_last(edje_collections));
4940
4941 {
4942 char *name;
4943
4944 name = parse_str(0);
4945 data_queue_part_lookup(pc, name, &(current_desc->rel2.id_x));
4946 free(name);
4947 }
4948}
4949
4950static void
4951st_collections_group_parts_part_description_rel2_to_y(void)
4952{
4953 Edje_Part_Collection *pc;
4954
4955 check_arg_count(1);
4956
4957 pc = eina_list_data_get(eina_list_last(edje_collections));
4958
4959 {
4960 char *name;
4961
4962 name = parse_str(0);
4963 data_queue_part_lookup(pc, name, &(current_desc->rel2.id_y));
4964 free(name);
4965 }
4966}
4967
4968/**
4969 @edcsection{description_image,Image state description sub blocks}
4970 */
4971
4972/**
4973 @page edcref
4974 @block
4975 image
4976 @context
4977 description {
4978 ..
4979 image {
4980 normal: "filename.ext";
4981 tween: "filename2.ext";
4982 ..
4983 tween: "filenameN.ext";
4984 border: left right top bottom;
4985 middle: 0/1/NONE/DEFAULT/SOLID;
4986 }
4987 ..
4988 }
4989 @description
4990 @endblock
4991
4992 @property
4993 normal
4994 @parameters
4995 [image's filename]
4996 @effect
4997 Name of image to be used as previously declared in the images block.
4998 In an animation, this is the first and last image displayed. It's
4999 required in any image part
5000 @endproperty
5001*/
5002static void
5003st_collections_group_parts_part_description_image_normal(void)
5004{
5005 Edje_Part_Description_Image *ed;
5006
5007 check_arg_count(1);
5008
5009 if (current_part->type != EDJE_PART_TYPE_IMAGE)
5010 {
5011 ERR("%s: Error. parse error %s:%i. "
5012 "image attributes in non-IMAGE part.",
5013 progname, file_in, line - 1);
5014 exit(-1);
5015 }
5016
5017 ed = (Edje_Part_Description_Image*) current_desc;
5018
5019 {
5020 char *name;
5021
5022 name = parse_str(0);
5023 data_queue_image_lookup(name, &(ed->image.id), &(ed->image.set));
5024 free(name);
5025 }
5026}
5027
5028/**
5029 @page edcref
5030 @property
5031 tween
5032 @parameters
5033 [image's filename]
5034 @effect
5035 Name of an image to be used in an animation loop, an image block can
5036 have none, one or multiple tween declarations. Images are displayed in
5037 the order they are listed.
5038 @endproperty
5039*/
5040static void
5041st_collections_group_parts_part_description_image_tween(void)
5042{
5043 Edje_Part_Description_Image *ed;
5044
5045 check_arg_count(1);
5046
5047 if (current_part->type != EDJE_PART_TYPE_IMAGE)
5048 {
5049 ERR("%s: Error. parse error %s:%i. "
5050 "image attributes in non-IMAGE part.",
5051 progname, file_in, line - 1);
5052 exit(-1);
5053 }
5054
5055 ed = (Edje_Part_Description_Image*) current_desc;
5056
5057 {
5058 char *name;
5059 Edje_Part_Image_Id *iid;
5060
5061 iid = mem_alloc(SZ(Edje_Part_Image_Id));
5062 ed->image.tweens_count++;
5063 ed->image.tweens = realloc(ed->image.tweens,
5064 sizeof (Edje_Part_Image_Id*) * ed->image.tweens_count);
5065 ed->image.tweens[ed->image.tweens_count - 1] = iid;
5066 name = parse_str(0);
5067 data_queue_image_lookup(name, &(iid->id), &(iid->set));
5068 free(name);
5069 }
5070}
5071
5072/**
5073 @page edcref
5074 @property
5075 border
5076 @parameters
5077 [left] [right] [top] [bottom]
5078 @effect
5079 If set, the area (in pixels) of each side of the image will be
5080 displayed as a fixed size border, from the side -> inwards, preventing
5081 the corners from being changed on a resize.
5082 @endproperty
5083*/
5084static void
5085st_collections_group_parts_part_description_image_border(void)
5086{
5087 Edje_Part_Description_Image *ed;
5088
5089 check_arg_count(4);
5090
5091 if (current_part->type != EDJE_PART_TYPE_IMAGE)
5092 {
5093 ERR("%s: Error. parse error %s:%i. "
5094 "image attributes in non-IMAGE part.",
5095 progname, file_in, line - 1);
5096 exit(-1);
5097 }
5098
5099 ed = (Edje_Part_Description_Image*) current_desc;
5100
5101 ed->image.border.l = parse_int_range(0, 0, 0x7fffffff);
5102 ed->image.border.r = parse_int_range(1, 0, 0x7fffffff);
5103 ed->image.border.t = parse_int_range(2, 0, 0x7fffffff);
5104 ed->image.border.b = parse_int_range(3, 0, 0x7fffffff);
5105}
5106
5107/**
5108 @page edcref
5109 @property
5110 middle
5111 @parameters
5112 0, 1, NONE, DEFAULT, SOLID
5113 @effect
5114 If border is set, this value tells Edje if the rest of the
5115 image (not covered by the defined border) will be displayed or not
5116 or be assumed to be solid (without alpha). The default is 1/DEFAULT.
5117 @endproperty
5118*/
5119static void
5120st_collections_group_parts_part_description_image_middle(void)
5121{
5122 Edje_Part_Description_Image *ed;
5123
5124 check_arg_count(1);
5125
5126 if (current_part->type != EDJE_PART_TYPE_IMAGE)
5127 {
5128 ERR("%s: Error. parse error %s:%i. "
5129 "image attributes in non-IMAGE part.",
5130 progname, file_in, line - 1);
5131 exit(-1);
5132 }
5133
5134 ed = (Edje_Part_Description_Image*) current_desc;
5135
5136 ed->image.border.no_fill = parse_enum(0,
5137 "1", 0,
5138 "DEFAULT", 0,
5139 "0", 1,
5140 "NONE", 1,
5141 "SOLID", 2,
5142 NULL);
5143}
5144
5145/**
5146 @page edcref
5147 @property
5148 border_scale_by
5149 @parameters
5150 0.0 or bigger (0.0 or 1.0 to turn it off)
5151 @effect
5152 If border scaling is enabled then normally the OUTPUT border sizes
5153 (e.g. if 3 pixels on the left edge are set as a border, then normally
5154 at scale 1.0, those 3 columns will always be the exact 3 columns of
5155 output, or at scale 2.0 they will be 6 columns, or 0.33 they will merge
5156 into a single column). This property multiplies the input scale
5157 factor by this multiplier, allowing the creation of "supersampled"
5158 borders to make much higher resolution outputs possible by always using
5159 the highest resolution artwork and then runtime scaling it down.
5160 @endproperty
5161*/
5162static void
5163st_collections_group_parts_part_description_image_border_scale_by(void)
5164{
5165 Edje_Part_Description_Image *ed;
5166
5167 check_arg_count(1);
5168
5169 if (current_part->type != EDJE_PART_TYPE_IMAGE)
5170 {
5171 ERR("%s: Error. parse error %s:%i. "
5172 "image attributes in non-IMAGE part.",
5173 progname, file_in, line - 1);
5174 exit(-1);
5175 }
5176
5177 ed = (Edje_Part_Description_Image*) current_desc;
5178
5179 ed->image.border.scale_by = FROM_DOUBLE(parse_float_range(0, 0.0, 999999999.0));
5180}
5181
5182/**
5183 @page edcref
5184 @property
5185 border_scale
5186 @parameters
5187 0, 1
5188 @effect
5189 If border is set, this value tells Edje if the border should be scaled
5190 by the object/global edje scale factors
5191 @endproperty
5192*/
5193static void
5194st_collections_group_parts_part_description_image_border_scale(void)
5195{
5196 Edje_Part_Description_Image *ed;
5197
5198 check_arg_count(1);
5199
5200 if (current_part->type != EDJE_PART_TYPE_IMAGE)
5201 {
5202 ERR("%s: Error. parse error %s:%i. "
5203 "image attributes in non-IMAGE part.",
5204 progname, file_in, line - 1);
5205 exit(-1);
5206 }
5207
5208 ed = (Edje_Part_Description_Image*) current_desc;
5209
5210 ed->image.border.scale = parse_enum(0,
5211 "0", 0,
5212 "1", 1,
5213 NULL);
5214}
5215
5216/**
5217 @page edcref
5218 @property
5219 scale_hint
5220 @parameters
5221 0, NONE, DYNAMIC, STATIC
5222 @effect
5223 Sets the evas image scale hint letting the engine more effectively save
5224 cached copies of the scaled image if it makes sense
5225 @endproperty
5226*/
5227static void
5228st_collections_group_parts_part_description_image_scale_hint(void)
5229{
5230 Edje_Part_Description_Image *ed;
5231
5232 check_arg_count(1);
5233
5234 if (current_part->type != EDJE_PART_TYPE_IMAGE)
5235 {
5236 ERR("%s: Error. parse error %s:%i. "
5237 "image attributes in non-IMAGE part.",
5238 progname, file_in, line - 1);
5239 exit(-1);
5240 }
5241
5242 ed = (Edje_Part_Description_Image*) current_desc;
5243
5244 ed->image.scale_hint = parse_enum(0,
5245 "NONE", EVAS_IMAGE_SCALE_HINT_NONE,
5246 "DYNAMIC", EVAS_IMAGE_SCALE_HINT_DYNAMIC,
5247 "STATIC", EVAS_IMAGE_SCALE_HINT_STATIC,
5248 "0", EVAS_IMAGE_SCALE_HINT_NONE,
5249 NULL);
5250}
5251
5252/**
5253 @page edcref
5254 @block
5255 fill
5256 @context
5257 description {
5258 ..
5259 fill {
5260 smooth: 0-1;
5261 origin {
5262 relative: X-axis Y-axis;
5263 offset: X-axis Y-axis;
5264 }
5265 size {
5266 relative: width height;
5267 offset: width height;
5268 }
5269 }
5270 ..
5271 }
5272 @description
5273 The fill method is an optional block that defines the way an IMAGE part
5274 is going to be displayed inside its container.
5275 @endblock
5276
5277 @property
5278 smooth
5279 @parameters
5280 [0 or 1]
5281 @effect
5282 The smooth property takes a boolean value to decide if the image will
5283 be smoothed on scaling (1) or not (0). The default value is 1.
5284 @endproperty
5285*/
5286static void
5287st_collections_group_parts_part_description_fill_smooth(void)
5288{
5289 Edje_Part_Description_Spec_Fill *fill;
5290
5291 check_arg_count(1);
5292
5293 switch (current_part->type)
5294 {
5295 case EDJE_PART_TYPE_IMAGE:
5296 {
5297 Edje_Part_Description_Image *ed;
5298
5299 ed = (Edje_Part_Description_Image*) current_desc;
5300
5301 fill = &ed->image.fill;
5302 break;
5303 }
5304 case EDJE_PART_TYPE_PROXY:
5305 {
5306 Edje_Part_Description_Proxy *ed;
5307
5308 ed = (Edje_Part_Description_Proxy*) current_desc;
5309
5310 fill = &ed->proxy.fill;
5311 break;
5312 }
5313 default:
5314 {
5315 ERR("%s: Error. parse error %s:%i. "
5316 "image and proxy attributes in non-IMAGE, non-PROXY `%s` part (%i).",
5317 progname, file_in, line - 1, current_part->name, current_part->type);
5318 exit(-1);
5319 }
5320 }
5321
5322 fill->smooth = parse_bool(0);
5323}
5324
5325/**
5326 @page edcref
5327
5328 @property
5329 spread
5330 @parameters
5331 TODO
5332 @effect
5333 TODO
5334 @endproperty
5335*/
5336static void
5337st_collections_group_parts_part_description_fill_spread(void)
5338{
5339#if 0
5340 Edje_Part_Collection *pc;
5341 Edje_Part *ep;
5342 Edje_Part_Description_Image *ed;
5343#endif
5344
5345 check_arg_count(1);
5346
5347 /* XXX this will need to include IMAGES when spread support is added to evas images */
5348 {
5349 ERR("%s: Error. parse error %s:%i. "
5350 "fill.spread not supported yet.",
5351 progname, file_in, line - 1);
5352 exit(-1);
5353 }
5354
5355#if 0
5356 pc = eina_list_data_get(eina_list_last(edje_collections));
5357
5358 ep = pc->parts[pc->parts_count - 1];
5359
5360 if (ep->type != EDJE_PART_TYPE_IMAGE)
5361 {
5362 ERR("%s: Error. parse error %s:%i. "
5363 "image attributes in non-IMAGE part.",
5364 progname, file_in, line - 1);
5365 exit(-1);
5366 }
5367
5368 ed = (Edje_Part_Description_Image*) ep->default_desc;
5369 if (ep->other.desc_count) ed = (Edje_Part_Description_Image*) ep->other.desc[ep->other.desc_count - 1];
5370
5371 ed->image.fill.spread = parse_int_range(0, 0, 1);
5372#endif
5373}
5374
5375/**
5376 @page edcref
5377
5378 @property
5379 type
5380 @parameters
5381 TODO
5382 @effect
5383 TODO
5384 @endproperty
5385*/
5386static void
5387st_collections_group_parts_part_description_fill_type(void)
5388{
5389 Edje_Part_Description_Spec_Fill *fill;
5390
5391 check_arg_count(1);
5392
5393 switch (current_part->type)
5394 {
5395 case EDJE_PART_TYPE_IMAGE:
5396 {
5397 Edje_Part_Description_Image *ed;
5398
5399 ed = (Edje_Part_Description_Image*) current_desc;
5400
5401 fill = &ed->image.fill;
5402 break;
5403 }
5404 case EDJE_PART_TYPE_PROXY:
5405 {
5406 Edje_Part_Description_Proxy *ed;
5407
5408 ed = (Edje_Part_Description_Proxy*) current_desc;
5409
5410 fill = &ed->proxy.fill;
5411 break;
5412 }
5413 default:
5414 {
5415 ERR("%s: Error. parse error %s:%i. "
5416 "image and proxy attributes in non-IMAGE, non-PROXY part.",
5417 progname, file_in, line - 1);
5418 exit(-1);
5419 }
5420 }
5421
5422 fill->type = parse_enum(0,
5423 "SCALE", EDJE_FILL_TYPE_SCALE,
5424 "TILE", EDJE_FILL_TYPE_TILE,
5425 NULL);
5426}
5427
5428/**
5429 @page edcref
5430 @block
5431 origin
5432 @context
5433 description {
5434 ..
5435 fill {
5436 ..
5437 origin {
5438 relative: 0.0 0.0;
5439 offset: 0 0;
5440 }
5441 ..
5442 }
5443 ..
5444 }
5445 @description
5446 The origin block is used to place the starting point, inside the
5447 displayed element, that will be used to render the tile. By default,
5448 the origin is set at the element's left-up corner.
5449 @endblock
5450
5451 @property
5452 relative
5453 @parameters
5454 [X axis] [Y axis]
5455 @effect
5456 Sets the starting point relatively to displayed element's content.
5457 @endproperty
5458*/
5459static void
5460st_collections_group_parts_part_description_fill_origin_relative(void)
5461{
5462 Edje_Part_Description_Spec_Fill *fill;
5463
5464 check_arg_count(2);
5465
5466 switch (current_part->type)
5467 {
5468 case EDJE_PART_TYPE_IMAGE:
5469 {
5470 Edje_Part_Description_Image *ed;
5471
5472 ed = (Edje_Part_Description_Image*) current_desc;
5473
5474 fill = &ed->image.fill;
5475 break;
5476 }
5477 case EDJE_PART_TYPE_PROXY:
5478 {
5479 Edje_Part_Description_Proxy *ed;
5480
5481 ed = (Edje_Part_Description_Proxy*) current_desc;
5482
5483 fill = &ed->proxy.fill;
5484 break;
5485 }
5486 default:
5487 {
5488 ERR("%s: Error. parse error %s:%i. "
5489 "image and proxy attributes in non-IMAGE, non-PROXY part.",
5490 progname, file_in, line - 1);
5491 exit(-1);
5492 }
5493 }
5494
5495 fill->pos_rel_x = FROM_DOUBLE(parse_float_range(0, -999999999.0, 999999999.0));
5496 fill->pos_rel_y = FROM_DOUBLE(parse_float_range(1, -999999999.0, 999999999.0));
5497}
5498
5499/**
5500 @page edcref
5501 @property
5502 offset
5503 @parameters
5504 [X axis] [Y axis]
5505 @effect
5506 Affects the starting point a fixed number of pixels along each axis.
5507 @endproperty
5508*/
5509static void
5510st_collections_group_parts_part_description_fill_origin_offset(void)
5511{
5512 Edje_Part_Description_Spec_Fill *fill;
5513
5514 check_arg_count(2);
5515
5516 switch (current_part->type)
5517 {
5518 case EDJE_PART_TYPE_IMAGE:
5519 {
5520 Edje_Part_Description_Image *ed;
5521
5522 ed = (Edje_Part_Description_Image*) current_desc;
5523
5524 fill = &ed->image.fill;
5525 break;
5526 }
5527 case EDJE_PART_TYPE_PROXY:
5528 {
5529 Edje_Part_Description_Proxy *ed;
5530
5531 ed = (Edje_Part_Description_Proxy*) current_desc;
5532
5533 fill = &ed->proxy.fill;
5534 break;
5535 }
5536 default:
5537 {
5538 ERR("%s: Error. parse error %s:%i. "
5539 "image and proxy attributes in non-IMAGE, non-PROXY part.",
5540 progname, file_in, line - 1);
5541 exit(-1);
5542 }
5543 }
5544
5545 fill->pos_abs_x = parse_int(0);
5546 fill->pos_abs_y = parse_int(1);
5547}
5548
5549/**
5550 @page edcref
5551 @block
5552 size
5553 @context
5554 description {
5555 ..
5556 fill {
5557 ..
5558 size {
5559 relative: 1.0 1.0;
5560 offset: -1 -1;
5561 }
5562 ..
5563 }
5564 ..
5565 }
5566 @description
5567 The size block defines the tile size of the content that will be
5568 displayed.
5569 @endblock
5570
5571 @property
5572 relative
5573 @parameters
5574 [width] [height]
5575 @effect
5576 Takes a pair of decimal values that represent the a percentual value
5577 of the original size of the element. For example, "0.5 0.5" represents
5578 half the size, while "2.0 2.0" represents the double. The default
5579 value is "1.0 1.0".
5580 @endproperty
5581*/
5582static void
5583st_collections_group_parts_part_description_fill_size_relative(void)
5584{
5585 Edje_Part_Description_Spec_Fill *fill;
5586
5587 check_arg_count(2);
5588
5589 switch (current_part->type)
5590 {
5591 case EDJE_PART_TYPE_IMAGE:
5592 {
5593 Edje_Part_Description_Image *ed;
5594
5595 ed = (Edje_Part_Description_Image*) current_desc;
5596
5597 fill = &ed->image.fill;
5598 break;
5599 }
5600 case EDJE_PART_TYPE_PROXY:
5601 {
5602 Edje_Part_Description_Proxy *ed;
5603
5604 ed = (Edje_Part_Description_Proxy*) current_desc;
5605
5606 fill = &ed->proxy.fill;
5607 break;
5608 }
5609 default:
5610 {
5611 ERR("%s: Error. parse error %s:%i. "
5612 "image and proxy attributes in non-IMAGE, non-PROXY part.",
5613 progname, file_in, line - 1);
5614 exit(-1);
5615 }
5616 }
5617
5618 fill->rel_x = FROM_DOUBLE(parse_float_range(0, 0.0, 999999999.0));
5619 fill->rel_y = FROM_DOUBLE(parse_float_range(1, 0.0, 999999999.0));
5620}
5621
5622/**
5623 @page edcref
5624 @property
5625 offset
5626 @parameters
5627 [X axis] [Y axis]
5628 @effect
5629 Affects the size of the tile a fixed number of pixels along each axis.
5630 @endproperty
5631*/
5632static void
5633st_collections_group_parts_part_description_fill_size_offset(void)
5634{
5635 Edje_Part_Description_Spec_Fill *fill;
5636
5637 check_arg_count(2);
5638
5639 switch (current_part->type)
5640 {
5641 case EDJE_PART_TYPE_IMAGE:
5642 {
5643 Edje_Part_Description_Image *ed;
5644
5645 ed = (Edje_Part_Description_Image*) current_desc;
5646
5647 fill = &ed->image.fill;
5648 break;
5649 }
5650 case EDJE_PART_TYPE_PROXY:
5651 {
5652 Edje_Part_Description_Proxy *ed;
5653
5654 ed = (Edje_Part_Description_Proxy*) current_desc;
5655
5656 fill = &ed->proxy.fill;
5657 break;
5658 }
5659 default:
5660 {
5661 ERR("%s: Error. parse error %s:%i. "
5662 "image and proxy attributes in non-IMAGE, non-PROXY part.",
5663 progname, file_in, line - 1);
5664 exit(-1);
5665 }
5666 }
5667
5668 fill->abs_x = parse_int(0);
5669 fill->abs_y = parse_int(1);
5670}
5671
5672
5673/**
5674 @edcsection{description_text,Text state description sub blocks}
5675 */
5676
5677/**
5678 @page edcref
5679
5680 @block
5681 text
5682 @context
5683 part {
5684 description {
5685 ..
5686 text {
5687 text: "some string of text to display";
5688 font: "font_name";
5689 size: SIZE;
5690 text_class: "class_name";
5691 fit: horizontal vertical;
5692 min: horizontal vertical;
5693 max: horizontal vertical;
5694 align: X-axis Y-axis;
5695 source: "part_name";
5696 text_source: "text_part_name";
5697 ellipsis: 0.0-1.0;
5698 style: "stylename";
5699 }
5700 ..
5701 }
5702 }
5703 @description
5704 @endblock
5705
5706 @property
5707 text
5708 @parameters
5709 [a string of text, or nothing]
5710 @effect
5711 Sets the default content of a text part, normally the application is
5712 the one changing its value.
5713 @endproperty
5714*/
5715static void
5716st_collections_group_parts_part_description_text_text(void)
5717{
5718 Edje_Part_Description_Text *ed;
5719 char *str = NULL;
5720 int i;
5721
5722 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
5723 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
5724 {
5725 ERR("%s: Error. parse error %s:%i. "
5726 "text attributes in non-TEXT part.",
5727 progname, file_in, line - 1);
5728 exit(-1);
5729 }
5730
5731 ed = (Edje_Part_Description_Text*) current_desc;
5732
5733 for (i = 0; ;i++)
5734 {
5735 char *s;
5736
5737 if (!is_param(i)) break;
5738 s = parse_str(i);
5739 if (!str) str = s;
5740 else
5741 {
5742 str = realloc(str, strlen(str) + strlen(s) + 1);
5743 strcat(str, s);
5744 free(s);
5745 }
5746 }
5747 ed->text.text.str = str;
5748}
5749
5750/**
5751 @page edcref
5752
5753 @property
5754 text_class
5755 @parameters
5756 [text class name]
5757 @effect
5758 Similar to color_class, this is the name used by the application
5759 to alter the font family and size at runtime.
5760 @endproperty
5761*/
5762static void
5763st_collections_group_parts_part_description_text_text_class(void)
5764{
5765 Edje_Part_Description_Text *ed;
5766
5767 check_arg_count(1);
5768
5769 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
5770 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
5771 {
5772 ERR("%s: Error. parse error %s:%i. "
5773 "text attributes in non-TEXT part.",
5774 progname, file_in, line - 1);
5775 exit(-1);
5776 }
5777
5778 ed = (Edje_Part_Description_Text*) current_desc;
5779
5780 ed->text.text_class = parse_str(0);
5781}
5782
5783/**
5784 @page edcref
5785
5786 @property
5787 font
5788 @parameters
5789 [font alias]
5790 @effect
5791 This sets the font family to one of the aliases set up in the "fonts"
5792 block. Can be overrided by the application.
5793 @endproperty
5794*/
5795static void
5796st_collections_group_parts_part_description_text_font(void)
5797{
5798 Edje_Part_Description_Text *ed;
5799
5800 check_arg_count(1);
5801
5802 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
5803 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
5804 {
5805 ERR("%s: Error. parse error %s:%i. "
5806 "text attributes in non-TEXT part.",
5807 progname, file_in, line - 1);
5808 exit(-1);
5809 }
5810
5811 ed = (Edje_Part_Description_Text*) current_desc;
5812
5813 ed->text.font.str = parse_str(0);
5814}
5815
5816/**
5817 @page edcref
5818
5819 @property
5820 style
5821 @parameters
5822 [the style name]
5823 @effect
5824 Causes the part to use the default style and tags defined in the
5825 "style" block with the specified name.
5826 @endproperty
5827*/
5828static void
5829st_collections_group_parts_part_description_text_style(void)
5830{
5831 Edje_Part_Description_Text *ed;
5832
5833 check_arg_count(1);
5834
5835 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
5836 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
5837 {
5838 ERR("%s: Error. parse error %s:%i. "
5839 "text attributes in non-TEXT part.",
5840 progname, file_in, line - 1);
5841 exit(-1);
5842 }
5843
5844 ed = (Edje_Part_Description_Text*) current_desc;
5845
5846 ed->text.style.str = parse_str(0);
5847}
5848
5849/**
5850 @page edcref
5851
5852 @property
5853 repch
5854 @parameters
5855 [the replacement character string]
5856 @effect
5857 If this is a textblock and is in PASSWORD mode this string is used
5858 to replace every character to hide the details of the entry. Normally
5859 you would use a "*", but you can use anything you like.
5860 @endproperty
5861*/
5862static void
5863st_collections_group_parts_part_description_text_repch(void)
5864{
5865 Edje_Part_Description_Text *ed;
5866
5867 check_arg_count(1);
5868
5869 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
5870 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
5871 {
5872 ERR("%s: Error. parse error %s:%i. "
5873 "text attributes in non-TEXT part.",
5874 progname, file_in, line - 1);
5875 exit(-1);
5876 }
5877
5878 ed = (Edje_Part_Description_Text*) current_desc;
5879
5880 ed->text.repch.str = parse_str(0);
5881}
5882
5883/**
5884 @page edcref
5885
5886 @property
5887 size
5888 @parameters
5889 [font size in points (pt)]
5890 @effect
5891 Sets the default font size for the text part. Can be overrided by the
5892 application.
5893 @endproperty
5894*/
5895static void
5896st_collections_group_parts_part_description_text_size(void)
5897{
5898 Edje_Part_Description_Text *ed;
5899
5900 check_arg_count(1);
5901
5902 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
5903 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
5904 {
5905 ERR("%s: Error. parse error %s:%i. "
5906 "text attributes in non-TEXT part.",
5907 progname, file_in, line - 1);
5908 exit(-1);
5909 }
5910
5911 ed = (Edje_Part_Description_Text*)current_desc;
5912
5913 ed->text.size = parse_int_range(0, 0, 255);
5914}
5915
5916/**
5917 @page edcref
5918
5919 @property
5920 size_range
5921 @parameters
5922 [font min size in points (pt)] [font max size in points (pt)]
5923 @effect
5924 Sets the allowed font size for the text part. Setting min and max to 0
5925 means we won't restrict the sizing (default).
5926 @endproperty
5927 @since 1.1.0
5928*/
5929static void
5930st_collections_group_parts_part_description_text_size_range(void)
5931{
5932 Edje_Part_Description_Text *ed;
5933
5934 check_arg_count(2);
5935
5936 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
5937 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
5938 {
5939 ERR("%s: Error. parse error %s:%i. "
5940 "text attributes in non-TEXT part.",
5941 progname, file_in, line - 1);
5942 exit(-1);
5943 }
5944
5945 ed = (Edje_Part_Description_Text*) current_desc;
5946
5947 ed->text.size_range_min = parse_int_range(0, 0, 255);
5948 ed->text.size_range_max = parse_int_range(1, 0, 255);
5949 if (ed->text.size_range_min > ed->text.size_range_max)
5950 {
5951 ERR("%s: Error. parse error %s:%i. "
5952 "min size is bigger than max size.",
5953 progname, file_in, line - 1);
5954 exit(-1);
5955 }
5956}
5957
5958/**
5959 @page edcref
5960
5961 @property
5962 fit
5963 @parameters
5964 [horizontal] [vertical]
5965 @effect
5966 When any of the parameters is set to 1 edje will resize the text for it
5967 to fit in it's container. Both are disabled by default.
5968 @endproperty
5969*/
5970static void
5971st_collections_group_parts_part_description_text_fit(void)
5972{
5973 Edje_Part_Description_Text *ed;
5974
5975 check_arg_count(2);
5976
5977 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
5978 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
5979 {
5980 ERR("%s: Error. parse error %s:%i. "
5981 "text attributes in non-TEXT part.",
5982 progname, file_in, line - 1);
5983 exit(-1);
5984 }
5985
5986 ed = (Edje_Part_Description_Text*) current_desc;
5987
5988 ed->text.fit_x = parse_bool(0);
5989 ed->text.fit_y = parse_bool(1);
5990}
5991
5992/**
5993 @page edcref
5994
5995 @property
5996 min
5997 @parameters
5998 [horizontal] [vertical]
5999 @effect
6000 When any of the parameters is enabled (1) it forces the minimum size of
6001 the container to be equal to the minimum size of the text. The default
6002 value is "0 0".
6003 @endproperty
6004*/
6005static void
6006st_collections_group_parts_part_description_text_min(void)
6007{
6008 Edje_Part_Description_Text *ed;
6009
6010 check_arg_count(2);
6011
6012 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
6013 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
6014 {
6015 ERR("%s: Error. parse error %s:%i. "
6016 "text attributes in non-TEXT part.",
6017 progname, file_in, line - 1);
6018 exit(-1);
6019 }
6020
6021 ed = (Edje_Part_Description_Text*)current_desc;
6022
6023 ed->text.min_x = parse_bool(0);
6024 ed->text.min_y = parse_bool(1);
6025}
6026
6027/**
6028 @page edcref
6029
6030 @property
6031 max
6032 @parameters
6033 [horizontal] [vertical]
6034 @effect
6035 When any of the parameters is enabled (1) it forces the maximum size of
6036 the container to be equal to the maximum size of the text. The default
6037 value is "0 0".
6038 @endproperty
6039*/
6040static void
6041st_collections_group_parts_part_description_text_max(void)
6042{
6043 Edje_Part_Description_Text *ed;
6044
6045 check_arg_count(2);
6046
6047 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
6048 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
6049 {
6050 ERR("%s: Error. parse error %s:%i. "
6051 "text attributes in non-TEXT part.",
6052 progname, file_in, line - 1);
6053 exit(-1);
6054 }
6055
6056 ed = (Edje_Part_Description_Text*) current_desc;
6057
6058 ed->text.max_x = parse_bool(0);
6059 ed->text.max_y = parse_bool(1);
6060}
6061
6062/**
6063 @page edcref
6064
6065 @property
6066 align
6067 @parameters
6068 [horizontal] [vertical]
6069 @effect
6070 Change the position of the point of balance inside the container. The
6071 default value is 0.5 0.5.
6072 @endproperty
6073*/
6074static void
6075st_collections_group_parts_part_description_text_align(void)
6076{
6077 Edje_Part_Description_Text *ed;
6078
6079 check_arg_count(2);
6080
6081 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
6082 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
6083 {
6084 ERR("%s: Error. parse error %s:%i. "
6085 "text attributes in non-TEXT part.",
6086 progname, file_in, line - 1);
6087 exit(-1);
6088 }
6089
6090 ed = (Edje_Part_Description_Text*) current_desc;
6091
6092 ed->text.align.x = FROM_DOUBLE(parse_float_range(0, -1.0, 1.0));
6093 ed->text.align.y = FROM_DOUBLE(parse_float_range(1, 0.0, 1.0));
6094}
6095
6096/**
6097 @page edcref
6098
6099 @property
6100 source
6101 @parameters
6102 [another TEXT part's name]
6103 @effect
6104 Causes the part to use the text properties (like font and size) of
6105 another part and update them as they change.
6106 @endproperty
6107*/
6108static void
6109st_collections_group_parts_part_description_text_source(void)
6110{
6111 Edje_Part_Collection *pc;
6112 Edje_Part_Description_Text *ed;
6113
6114 check_arg_count(1);
6115
6116 pc = eina_list_data_get(eina_list_last(edje_collections));
6117
6118 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
6119 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
6120 {
6121 ERR("%s: Error. parse error %s:%i. "
6122 "text attributes in non-TEXT part.",
6123 progname, file_in, line - 1);
6124 exit(-1);
6125 }
6126
6127 ed = (Edje_Part_Description_Text*) current_desc;
6128
6129 {
6130 char *name;
6131
6132 name = parse_str(0);
6133 data_queue_part_lookup(pc, name, &(ed->text.id_source));
6134 free(name);
6135 }
6136}
6137
6138/**
6139 @page edcref
6140
6141 @property
6142 text_source
6143 @parameters
6144 [another TEXT part's name]
6145 @effect
6146 Causes the part to display the text content of another part and update
6147 them as they change.
6148 @endproperty
6149*/
6150static void
6151st_collections_group_parts_part_description_text_text_source(void)
6152{
6153 Edje_Part_Collection *pc;
6154 Edje_Part_Description_Text *ed;
6155
6156 check_arg_count(1);
6157
6158 pc = eina_list_data_get(eina_list_last(edje_collections));
6159
6160 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
6161 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
6162 {
6163 ERR("%s: Error. parse error %s:%i. "
6164 "text attributes in non-TEXT part.",
6165 progname, file_in, line - 1);
6166 exit(-1);
6167 }
6168
6169 ed = (Edje_Part_Description_Text*) current_desc;
6170
6171 {
6172 char *name;
6173
6174 name = parse_str(0);
6175 data_queue_part_lookup(pc, name, &(ed->text.id_text_source));
6176 free(name);
6177 }
6178}
6179
6180/**
6181 @page edcref
6182
6183 @property
6184 ellipsis
6185 @parameters
6186 [point of balance]
6187 @effect
6188 Used to balance the text in a relative point from 0.0 to 1.0, this
6189 point is the last section of the string to be cut out in case of a
6190 resize that is smaller than the text itself. The default value is 0.0.
6191 @endproperty
6192*/
6193static void
6194st_collections_group_parts_part_description_text_elipsis(void)
6195{
6196 Edje_Part_Description_Text *ed;
6197
6198 check_arg_count(1);
6199
6200 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
6201 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
6202 {
6203 ERR("%s: Error. parse error %s:%i. "
6204 "text attributes in non-TEXT part.",
6205 progname, file_in, line - 1);
6206 exit(-1);
6207 }
6208
6209 ed = (Edje_Part_Description_Text*) current_desc;
6210
6211 ed->text.elipsis = parse_float_range(0, 0.0, 1.0);
6212}
6213
6214
6215/**
6216 @edcsection{description_box,Box state description sub blocks}
6217 */
6218
6219/**
6220 @page edcref
6221
6222 @block
6223 box
6224 @context
6225 part {
6226 description {
6227 ..
6228 box {
6229 layout: "vertical";
6230 padding: 0 2;
6231 align: 0.5 0.5;
6232 min: 0 0;
6233 }
6234 ..
6235 }
6236 }
6237 @description
6238 A box block can contain other objects and display them in different
6239 layouts, any of the predefined set, or a custom one, set by the
6240 application.
6241 @endblock
6242
6243 @property
6244 layout
6245 @parameters
6246 [primary layout] [fallback layout]
6247 @effect
6248 Sets the layout for the box:
6249 @li horizontal (default)
6250 @li vertical
6251 @li horizontal_homogeneous
6252 @li vertical_homogeneous
6253 @li horizontal_max (homogeneous to the max sized child)
6254 @li vertical_max
6255 @li horizontal_flow
6256 @li vertical_flow
6257 @li stack
6258 @li some_other_custom_layout_set_by_the_application
6259 You could set a custom layout as fallback, it makes very
6260 very little sense though, and if that one fails, it will
6261 default to horizontal.
6262 @endproperty
6263
6264 @property
6265 align
6266 @parameters
6267 [horizontal] [vertical]
6268 @effect
6269 Change the position of the point of balance inside the container. The
6270 default value is 0.5 0.5.
6271 @endproperty
6272
6273 @property
6274 padding
6275 @parameters
6276 [horizontal] [vertical]
6277 @effect
6278 Sets the space between cells in pixels. Defaults to 0 0.
6279 @endproperty
6280
6281 @property
6282 min
6283 @parameters
6284 [horizontal] [vertical]
6285 @effect
6286 When any of the parameters is enabled (1) it forces the minimum size of
6287 the box to be equal to the minimum size of the items. The default
6288 value is "0 0".
6289 @endproperty
6290*/
6291static void st_collections_group_parts_part_description_box_layout(void)
6292{
6293 Edje_Part_Description_Box *ed;
6294
6295 check_min_arg_count(1);
6296
6297 if (current_part->type != EDJE_PART_TYPE_BOX)
6298 {
6299 ERR("%s: Error. parse error %s:%i. "
6300 "box attributes in non-BOX part.",
6301 progname, file_in, line - 1);
6302 exit(-1);
6303 }
6304
6305 ed = (Edje_Part_Description_Box*) current_desc;
6306
6307 ed->box.layout = parse_str(0);
6308 if (is_param(1))
6309 ed->box.alt_layout = parse_str(1);
6310}
6311
6312static void st_collections_group_parts_part_description_box_align(void)
6313{
6314 Edje_Part_Description_Box *ed;
6315
6316 check_arg_count(2);
6317
6318 if (current_part->type != EDJE_PART_TYPE_BOX)
6319 {
6320 ERR("%s: Error. parse error %s:%i. "
6321 "box attributes in non-BOX part.",
6322 progname, file_in, line - 1);
6323 exit(-1);
6324 }
6325
6326 ed = (Edje_Part_Description_Box*) current_desc;
6327
6328 ed->box.align.x = FROM_DOUBLE(parse_float_range(0, -1.0, 1.0));
6329 ed->box.align.y = FROM_DOUBLE(parse_float_range(1, -1.0, 1.0));
6330}
6331
6332static void st_collections_group_parts_part_description_box_padding(void)
6333{
6334 Edje_Part_Description_Box *ed;
6335
6336 check_arg_count(2);
6337
6338 if (current_part->type != EDJE_PART_TYPE_BOX)
6339 {
6340 ERR("%s: Error. parse error %s:%i. "
6341 "box attributes in non-BOX part.",
6342 progname, file_in, line - 1);
6343 exit(-1);
6344 }
6345
6346 ed = (Edje_Part_Description_Box*) current_desc;
6347
6348 ed->box.padding.x = parse_int_range(0, 0, 0x7fffffff);
6349 ed->box.padding.y = parse_int_range(1, 0, 0x7fffffff);
6350}
6351
6352static void
6353st_collections_group_parts_part_description_box_min(void)
6354{
6355 Edje_Part_Description_Box *ed;
6356
6357 check_arg_count(2);
6358
6359 if (current_part->type != EDJE_PART_TYPE_BOX)
6360 {
6361 ERR("%s: Error. parse error %s:%i. "
6362 "box attributes in non-BOX part.",
6363 progname, file_in, line - 1);
6364 exit(-1);
6365 }
6366
6367 ed = (Edje_Part_Description_Box*) current_desc;
6368
6369 ed->box.min.h = parse_bool(0);
6370 ed->box.min.v = parse_bool(1);
6371}
6372
6373
6374/**
6375 @edcsection{description_table,Table state description sub blocks}
6376 */
6377
6378/**
6379 @page edcref
6380
6381 @block
6382 table
6383 @context
6384 part {
6385 description {
6386 ..
6387 table {
6388 homogeneous: TABLE;
6389 padding: 0 2;
6390 align: 0.5 0.5;
6391 min: 0 0;
6392 }
6393 ..
6394 }
6395 }
6396 @description
6397 A table block can contain other objects packed in multiple columns
6398 and rows, and each item can span across more than one column and/or
6399 row.
6400 @endblock
6401
6402 @property
6403 homogeneous
6404 @parameters
6405 [homogeneous mode]
6406 @effect
6407 Sets the homogeneous mode for the table:
6408 @li NONE (default)
6409 @li TABLE
6410 @li ITEM
6411 @endproperty
6412
6413 @property
6414 align
6415 @parameters
6416 [horizontal] [vertical]
6417 @effect
6418 Change the position of the point of balance inside the container. The
6419 default value is 0.5 0.5.
6420 @endproperty
6421
6422 @property
6423 padding
6424 @parameters
6425 [horizontal] [vertical]
6426 @effect
6427 Sets the space between cells in pixels. Defaults to 0 0.
6428 @endproperty
6429
6430 @property
6431 min
6432 @parameters
6433 [horizontal] [vertical]
6434 @effect
6435 When any of the parameters is enabled (1) it forces the minimum size of
6436 the table to be equal to the minimum size of the items. The default
6437 value is "0 0".
6438 @endproperty
6439*/
6440static void st_collections_group_parts_part_description_table_homogeneous(void)
6441{
6442 Edje_Part_Description_Table *ed;
6443
6444 check_min_arg_count(1);
6445
6446 if (current_part->type != EDJE_PART_TYPE_TABLE)
6447 {
6448 ERR("%s: Error. parse error %s:%i. "
6449 "table attributes in non-TABLE part.",
6450 progname, file_in, line - 1);
6451 exit(-1);
6452 }
6453
6454 ed = (Edje_Part_Description_Table*) current_desc;
6455
6456 ed->table.homogeneous = parse_enum(0,
6457 "NONE", EDJE_OBJECT_TABLE_HOMOGENEOUS_NONE,
6458 "TABLE", EDJE_OBJECT_TABLE_HOMOGENEOUS_TABLE,
6459 "ITEM", EDJE_OBJECT_TABLE_HOMOGENEOUS_ITEM,
6460 NULL);
6461}
6462
6463static void st_collections_group_parts_part_description_table_align(void)
6464{
6465 Edje_Part_Description_Table *ed;
6466
6467 check_arg_count(2);
6468
6469 if (current_part->type != EDJE_PART_TYPE_TABLE)
6470 {
6471 ERR("%s: Error. parse error %s:%i. "
6472 "table attributes in non-TABLE part.",
6473 progname, file_in, line - 1);
6474 exit(-1);
6475 }
6476
6477 ed = (Edje_Part_Description_Table*) current_desc;
6478
6479 ed->table.align.x = FROM_DOUBLE(parse_float_range(0, -1.0, 1.0));
6480 ed->table.align.y = FROM_DOUBLE(parse_float_range(1, -1.0, 1.0));
6481}
6482
6483static void st_collections_group_parts_part_description_table_padding(void)
6484{
6485 Edje_Part_Description_Table *ed;
6486
6487 check_arg_count(2);
6488
6489 if (current_part->type != EDJE_PART_TYPE_TABLE)
6490 {
6491 ERR("%s: Error. parse error %s:%i. "
6492 "table attributes in non-TABLE part.",
6493 progname, file_in, line - 1);
6494 exit(-1);
6495 }
6496
6497 ed = (Edje_Part_Description_Table*) current_desc;
6498
6499 ed->table.padding.x = parse_int_range(0, 0, 0x7fffffff);
6500 ed->table.padding.y = parse_int_range(1, 0, 0x7fffffff);
6501}
6502
6503static void
6504st_collections_group_parts_part_description_table_min(void)
6505{
6506 Edje_Part_Description_Table *ed;
6507
6508 check_arg_count(2);
6509
6510 if (current_part->type != EDJE_PART_TYPE_TABLE)
6511 {
6512 ERR("%s: Error. parse error %s:%i. "
6513 "box attributes in non-TABLE part.",
6514 progname, file_in, line - 1);
6515 exit(-1);
6516 }
6517
6518 ed = (Edje_Part_Description_Table*) current_desc;
6519
6520 ed->table.min.h = parse_bool(0);
6521 ed->table.min.v = parse_bool(1);
6522}
6523
6524/**
6525 @edcsection{description_map,Map state description sub blocks}
6526 */
6527
6528/**
6529 @page edcref
6530 @block
6531 map
6532 @context
6533 description {
6534 ..
6535 map {
6536 perspective: "name";
6537 light: "name";
6538 on: 1;
6539 smooth: 1;
6540 perspective_on: 1;
6541 backface_cull: 1;
6542 alpha: 1;
6543
6544 rotation {
6545 ..
6546 }
6547 }
6548 ..
6549 }
6550
6551 @description
6552 @endblock
6553
6554 @property
6555 perspective
6556 @parameters
6557 [another part's name]
6558 @effect
6559 This sets the part that is used as the "perspective point" for giving
6560 a part a "3d look". The perspective point should have a perspective
6561 section that provides zplane and focal properties. The center of this
6562 part will be used as the focal point, so size, color and visibility
6563 etc. are not relevant just center point, zplane and focal are used.
6564 This also implicitly enables perspective transforms (see the on
6565 parameter for the map section).
6566 @endproperty
6567*/
6568static void
6569st_collections_group_parts_part_description_map_perspective(void)
6570{
6571 Edje_Part_Collection *pc;
6572
6573 check_arg_count(1);
6574
6575 pc = eina_list_data_get(eina_list_last(edje_collections));
6576
6577 {
6578 char *name;
6579
6580 name = parse_str(0);
6581 data_queue_part_lookup(pc, name, &(current_desc->map.id_persp));
6582 free(name);
6583 }
6584
6585 current_desc->map.persp_on = 1;
6586}
6587
6588/**
6589 @page edcref
6590 @property
6591 light
6592 @parameters
6593 [another part's name]
6594 @effect
6595 This sets the part that is used as the "light" for calculating the
6596 brightness (based on how directly the part's surface is facing the
6597 light source point). Like the perspective point part, the center point
6598 is used and zplane is used for the z position (0 being the zero-plane
6599 where all 2D objects normally live) and positive values being further
6600 away into the distance. The light part color is used as the light
6601 color (alpha not used for light color). The color2 color is used for
6602 the ambient lighting when calculating brightness (alpha also not
6603 used).
6604 @endproperty
6605*/
6606static void
6607st_collections_group_parts_part_description_map_light(void)
6608{
6609 Edje_Part_Collection *pc;
6610
6611 check_arg_count(1);
6612
6613 pc = eina_list_data_get(eina_list_last(edje_collections));
6614
6615 {
6616 char *name;
6617
6618 name = parse_str(0);
6619 data_queue_part_lookup(pc, name, &(current_desc->map.id_light));
6620 free(name);
6621 }
6622}
6623
6624/**
6625 @page edcref
6626 @property
6627 on
6628 @parameters
6629 [1 or 0]
6630 @effect
6631 This enables mapping for the part. Default is 0.
6632 @endproperty
6633*/
6634static void
6635st_collections_group_parts_part_description_map_on(void)
6636{
6637 check_arg_count(1);
6638
6639 current_desc->map.on = parse_bool(0);
6640}
6641
6642/**
6643 @page edcref
6644 @property
6645 smooth
6646 @parameters
6647 [1 or 0]
6648 @effect
6649 This enable smooth map rendering. This may be linear interpolation,
6650 anisotropic filtering or anything the engine decides is "smooth".
6651 This is a best-effort hint and may not produce precisely the same
6652 results in all engines and situations. Default is 1
6653 @endproperty
6654*/
6655static void
6656st_collections_group_parts_part_description_map_smooth(void)
6657{
6658 check_arg_count(1);
6659
6660 current_desc->map.smooth = parse_bool(0);
6661}
6662
6663/**
6664 @page edcref
6665 @property
6666 alpha
6667 @parameters
6668 [1 or 0]
6669 @effect
6670 This enable alpha channel when map rendering. Default is 1.
6671 @endproperty
6672*/
6673static void
6674st_collections_group_parts_part_description_map_alpha(void)
6675{
6676 check_arg_count(1);
6677
6678 current_desc->map.alpha = parse_bool(0);
6679}
6680
6681/**
6682 @page edcref
6683 @property
6684 backface_cull
6685 @parameters
6686 [1 or 0]
6687 @effect
6688 This enables backface culling (when the rotated part that normally
6689 faces the camera is facing away after being rotated etc.). This means
6690 that the object will be hidden when "backface culled".
6691 @endproperty
6692*/
6693static void
6694st_collections_group_parts_part_description_map_backface_cull(void)
6695{
6696 check_arg_count(1);
6697
6698 current_desc->map.backcull = parse_bool(0);
6699}
6700
6701/**
6702 @page edcref
6703 @property
6704 perspective_on
6705 @parameters
6706 [1 or 0]
6707 @effect
6708 Enable perspective when rotating even without a perspective point object.
6709 This would use perspective set for the object itself or for the
6710 canvas as a whole as the global perspective with
6711 edje_perspective_set() and edje_perspective_global_set().
6712 @endproperty
6713*/
6714static void
6715st_collections_group_parts_part_description_map_perspective_on(void)
6716{
6717 check_arg_count(1);
6718
6719 current_desc->map.persp_on = parse_bool(0);
6720}
6721/**
6722 @page edcref
6723 @block
6724 rotation
6725 @context
6726 map {
6727 ..
6728 rotation {
6729 center: "name";
6730 x: 45.0;
6731 y: 45.0;
6732 z: 45.0;
6733 }
6734 ..
6735 }
6736 @description
6737 Rotates the part, optionally with the center on another part.
6738 @endblock
6739
6740 @property
6741 center
6742 @parameters
6743 [another part's name]
6744 @effect
6745 This sets the part that is used as the center of rotation when
6746 rotating the part with this description. The part's center point
6747 is used as the rotation center when applying rotation around the
6748 x, y and z axes. If no center is given, the parts original center
6749 itself is used for the rotation center.
6750 @endproperty
6751*/
6752static void
6753st_collections_group_parts_part_description_map_rotation_center(void)
6754{
6755 Edje_Part_Collection *pc;
6756
6757 check_arg_count(1);
6758
6759 pc = eina_list_data_get(eina_list_last(edje_collections));
6760
6761 {
6762 char *name;
6763
6764 name = parse_str(0);
6765 data_queue_part_lookup(pc, name, &(current_desc->map.rot.id_center));
6766 free(name);
6767 }
6768}
6769
6770/**
6771 @page edcref
6772 @property
6773 x
6774 @parameters
6775 [X degrees]
6776 @effect
6777 This sets the rotation around the x axis of the part considering
6778 the center set. In degrees.
6779 @endproperty
6780*/
6781static void
6782st_collections_group_parts_part_description_map_rotation_x(void)
6783{
6784 check_arg_count(1);
6785
6786 current_desc->map.rot.x = FROM_DOUBLE(parse_float(0));
6787}
6788
6789/**
6790 @page edcref
6791 @property
6792 y
6793 @parameters
6794 [Y degrees]
6795 @effect
6796 This sets the rotation around the u axis of the part considering
6797 the center set. In degrees.
6798 @endproperty
6799*/
6800static void
6801st_collections_group_parts_part_description_map_rotation_y(void)
6802{
6803 check_arg_count(1);
6804
6805 current_desc->map.rot.y = FROM_DOUBLE(parse_float(0));
6806}
6807
6808/**
6809 @page edcref
6810 @property
6811 z
6812 @parameters
6813 [Z degrees]
6814 @effect
6815 This sets the rotation around the z axis of the part considering
6816 the center set. In degrees.
6817 @endproperty
6818*/
6819static void
6820st_collections_group_parts_part_description_map_rotation_z(void)
6821{
6822 check_arg_count(1);
6823
6824 current_desc->map.rot.z = FROM_DOUBLE(parse_float(0));
6825}
6826
6827/**
6828 @page edcref
6829 @block
6830 perspective
6831 @context
6832 description {
6833 ..
6834 perspective {
6835 zplane: 0;
6836 focal: 1000;
6837 }
6838 ..
6839 }
6840 @description
6841 Adds focal and plane perspective to the part. Active if perspective_on is true.
6842 Must be provided if the part is being used by other part as it's perspective target.
6843 @endblock
6844
6845 @property
6846 zplane
6847 @parameters
6848 [unscaled Z value]
6849 @effect
6850 This sets the z value that will not be scaled. Normally this is 0 as
6851 that is the z distance that all objects are at normally.
6852 @endproperty
6853*/
6854static void
6855st_collections_group_parts_part_description_perspective_zplane(void)
6856{
6857 check_arg_count(1);
6858
6859 current_desc->persp.zplane = parse_int(0);
6860}
6861
6862
6863/**
6864 @page edcref
6865 @property
6866 focal
6867 @parameters
6868 [distance]
6869 @effect
6870 This sets the distance from the focal z plane (zplane) and the
6871 camera - i.e. very much equating to focal length of the camera
6872 @endproperty
6873*/
6874static void
6875st_collections_group_parts_part_description_perspective_focal(void)
6876{
6877 check_arg_count(1);
6878
6879 current_desc->persp.focal = parse_int_range(0, 1, 0x7fffffff);
6880}
6881
6882
6883/**
6884 @edcsection{description_params,Params state description sub blocks}
6885 */
6886
6887/**
6888 @page edcref
6889 @block
6890 params
6891 @context
6892 description {
6893 ..
6894 params {
6895 int: "name" 0;
6896 double: "other_name" 0.0;
6897 string: "another_name" "some text";
6898 bool: "name" 1;
6899 choice: "some_name" "value";
6900 }
6901 ..
6902 }
6903 @description
6904 Set parameters for EXTERNAL parts. The value overwrites previous
6905 definitions with the same name.
6906 @endblock
6907*/
6908static void
6909_st_collections_group_parts_part_description_params(Edje_External_Param_Type type)
6910{
6911 Edje_Part_Description_External *ed;
6912 Edje_External_Param *param;
6913 Eina_List *l;
6914 const char *name;
6915 int found = 0;
6916
6917 check_arg_count(2);
6918
6919 if (current_part->type != EDJE_PART_TYPE_EXTERNAL)
6920 {
6921 ERR("%s: Error. parse error %s:%i. "
6922 "params in non-EXTERNAL part.",
6923 progname, file_in, line - 1);
6924 exit(-1);
6925 }
6926
6927 ed = (Edje_Part_Description_External*) current_desc;
6928
6929 name = parse_str(0);
6930
6931 /* if a param with this name already exists, overwrite it */
6932 EINA_LIST_FOREACH(ed->external_params, l, param)
6933 {
6934 if (!strcmp(param->name, name))
6935 {
6936 found = 1;
6937 break;
6938 }
6939 }
6940
6941 if (!found)
6942 {
6943 param = mem_alloc(SZ(Edje_External_Param));
6944 param->name = name;
6945 }
6946
6947 param->type = type;
6948 param->i = 0;
6949 param->d = 0;
6950 param->s = NULL;
6951
6952 switch (type)
6953 {
6954 case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
6955 case EDJE_EXTERNAL_PARAM_TYPE_INT:
6956 param->i = parse_int(1);
6957 break;
6958 case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
6959 param->d = parse_float(1);
6960 break;
6961 case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
6962 case EDJE_EXTERNAL_PARAM_TYPE_STRING:
6963 param->s = parse_str(1);
6964 break;
6965 default:
6966 ERR("%s: Error. parse error %s:%i. Invalid param type.\n",
6967 progname, file_in, line - 1);
6968 break;
6969 }
6970
6971 if (!found)
6972 ed->external_params = eina_list_append(ed->external_params, param);
6973}
6974
6975/**
6976 @page edcref
6977 @property
6978 int
6979 @parameters
6980 [param_name] [int_value]
6981 @effect
6982 Adds an integer parameter for an external object
6983 @endproperty
6984*/
6985static void
6986st_collections_group_parts_part_description_params_int(void)
6987{
6988 _st_collections_group_parts_part_description_params(EDJE_EXTERNAL_PARAM_TYPE_INT);
6989}
6990
6991/**
6992 @page edcref
6993 @property
6994 double
6995 @parameters
6996 [param_name] [double_value]
6997 @effect
6998 Adds a double parameter for an external object
6999 @endproperty
7000*/
7001static void
7002st_collections_group_parts_part_description_params_double(void)
7003{
7004 _st_collections_group_parts_part_description_params(EDJE_EXTERNAL_PARAM_TYPE_DOUBLE);
7005}
7006
7007/**
7008 @page edcref
7009 @property
7010 string
7011 @parameters
7012 [param_name] [string_value]
7013 @effect
7014 Adds a string parameter for an external object
7015 @endproperty
7016*/
7017static void
7018st_collections_group_parts_part_description_params_string(void)
7019{
7020 _st_collections_group_parts_part_description_params(EDJE_EXTERNAL_PARAM_TYPE_STRING);
7021}
7022
7023/**
7024 @page edcref
7025 @property
7026 bool
7027 @parameters
7028 [param_name] [bool_value]
7029 @effect
7030 Adds an boolean parameter for an external object. Value must be 0 or 1.
7031 @endproperty
7032*/
7033static void
7034st_collections_group_parts_part_description_params_bool(void)
7035{
7036 _st_collections_group_parts_part_description_params(EDJE_EXTERNAL_PARAM_TYPE_BOOL);
7037}
7038
7039/**
7040 @page edcref
7041 @property
7042 choice
7043 @parameters
7044 [param_name] [choice_string]
7045 @effect
7046 Adds a choice parameter for an external object. The possible
7047 choice values are defined by external type at their register time
7048 and will be validated at runtime.
7049 @endproperty
7050*/
7051static void
7052st_collections_group_parts_part_description_params_choice(void)
7053{
7054 _st_collections_group_parts_part_description_params(EDJE_EXTERNAL_PARAM_TYPE_CHOICE);
7055}
7056
7057
7058/**
7059 @edcsection{program, Program block}
7060 */
7061
7062/**
7063 @page edcref
7064 @block
7065 program
7066 @context
7067 group {
7068 programs {
7069 ..
7070 program {
7071 name: "programname";
7072 signal: "signalname";
7073 source: "partname";
7074 filter: "partname" "statename";
7075 in: 0.3 0.0;
7076 action: STATE_SET "statename" state_value;
7077 transition: LINEAR 0.5;
7078 target: "partname";
7079 target: "anotherpart";
7080 after: "programname";
7081 after: "anotherprogram";
7082 }
7083 ..
7084 }
7085 }
7086 @description
7087 Programs define how your interface reacts to events.
7088 Programs can change the state of parts, react to events or trigger
7089 other events.
7090 @endblock
7091*/
7092static void
7093ob_collections_group_programs_program(void)
7094{
7095 Edje_Part_Collection *pc;
7096 Edje_Program *ep;
7097 Edje_Program_Parser *epp;
7098
7099 pc = eina_list_data_get(eina_list_last(edje_collections));
7100
7101 ep = mem_alloc(SZ(Edje_Program_Parser));
7102 ep->id = -1;
7103 ep->tween.mode = EDJE_TWEEN_MODE_LINEAR;
7104 ep->after = NULL;
7105 epp = (Edje_Program_Parser *)ep;
7106 epp->can_override = EINA_FALSE;
7107
7108 _edje_program_insert(pc, ep);
7109
7110 current_program = ep;
7111}
7112
7113/**
7114 @page edcref
7115 @property
7116 name
7117 @parameters
7118 [program name]
7119 @effect
7120 Symbolic name of program as a unique identifier.
7121 @endproperty
7122*/
7123static void
7124st_collections_group_programs_program_name(void)
7125{
7126 Edje_Part_Collection *pc;
7127
7128 check_arg_count(1);
7129
7130 pc = eina_list_data_get(eina_list_last(edje_collections));
7131 current_program->name = parse_str(0);
7132
7133 _edje_program_check(current_program->name, current_program, pc->programs.fnmatch, pc->programs.fnmatch_count);
7134 _edje_program_check(current_program->name, current_program, pc->programs.strcmp, pc->programs.strcmp_count);
7135 _edje_program_check(current_program->name, current_program, pc->programs.strncmp, pc->programs.strncmp_count);
7136 _edje_program_check(current_program->name, current_program, pc->programs.strrncmp, pc->programs.strrncmp_count);
7137 _edje_program_check(current_program->name, current_program, pc->programs.nocmp, pc->programs.nocmp_count);
7138}
7139
7140/**
7141 @page edcref
7142 @property
7143 signal
7144 @parameters
7145 [signal name]
7146 @effect
7147 Specifies signal(s) that should cause the program to run. The signal
7148 received must match the specified source to run.
7149 Signals may be globbed, but only one signal keyword per program
7150 may be used. ex: signal: "mouse,clicked,*"; (clicking any mouse button
7151 that matches source starts program).
7152 @endproperty
7153*/
7154static void
7155st_collections_group_programs_program_signal(void)
7156{
7157 Edje_Part_Collection *pc;
7158
7159 check_arg_count(1);
7160
7161 pc = eina_list_data_get(eina_list_last(edje_collections));
7162
7163 _edje_program_remove(pc, current_program);
7164 current_program->signal = parse_str(0);
7165 _edje_program_insert(pc, current_program);
7166}
7167
7168/**
7169 @page edcref
7170 @property
7171 source
7172 @parameters
7173 [source name]
7174 @effect
7175 Source of accepted signal. Sources may be globbed, but only one source
7176 keyword per program may be used. ex:source: "button-*"; (Signals from
7177 any part or program named "button-*" are accepted).
7178 @endproperty
7179*/
7180static void
7181st_collections_group_programs_program_source(void)
7182{
7183 Edje_Part_Collection *pc;
7184
7185 check_arg_count(1);
7186
7187 pc = eina_list_data_get(eina_list_last(edje_collections));
7188
7189 _edje_program_remove(pc, current_program);
7190 current_program->source = parse_str(0);
7191 _edje_program_insert(pc, current_program);
7192}
7193
7194/**
7195 @page edcref
7196 @property
7197 filter
7198 @parameters
7199 [part] [state]
7200 @effect
7201 Filter signals to be only accepted if the part [part] is in state named [state].
7202 Only one filter per program can be used. If [state] is not given, the source of
7203 the event will be used instead.
7204 @endproperty
7205*/
7206static void
7207st_collections_group_programs_program_filter(void)
7208{
7209 check_min_arg_count(1);
7210
7211 if(is_param(1)) {
7212 current_program->filter.part = parse_str(0);
7213 current_program->filter.state = parse_str(1);
7214 } else {
7215 current_program->filter.state = parse_str(0);
7216 }
7217}
7218
7219/**
7220 @page edcref
7221 @property
7222 in
7223 @parameters
7224 [from] [range]
7225 @effect
7226 Wait 'from' seconds before executing the program. And add a random
7227 number of seconds (from 0 to 'range') to the total waiting time.
7228 @endproperty
7229*/
7230static void
7231st_collections_group_programs_program_in(void)
7232{
7233 check_arg_count(2);
7234
7235 current_program->in.from = parse_float_range(0, 0.0, 999999999.0);
7236 current_program->in.range = parse_float_range(1, 0.0, 999999999.0);
7237}
7238
7239#ifdef ENABLE_MULTISENSE
7240/* add to docs below
7241, PLAY_SAMPLE, PLAY_TONE
7242
7243 action: PLAY_SAMPLE "sample name";\n
7244 action: PLAY_TONE "tone name" duration in seconds ( Range 0.1 to 10.0 );\n
7245*/
7246#endif
7247
7248/**
7249 @page edcref
7250 @property
7251 action
7252 @parameters
7253 [type] [param1] [param2]
7254 @effect
7255 Action to be performed by the program. Valid actions are: STATE_SET,
7256 ACTION_STOP, SIGNAL_EMIT, DRAG_VAL_SET, DRAG_VAL_STEP, DRAG_VAL_PAGE,
7257 FOCUS_SET, PARAM_COPY, PARAM_SET
7258 Only one action can be specified per program. Examples:\n
7259 action: STATE_SET "statename" 0.5;\n
7260 action: ACTION_STOP;\n
7261 action: SIGNAL_EMIT "signalname" "emitter";\n
7262 action: DRAG_VAL_SET 0.5 0.0;\n
7263 action: DRAG_VAL_STEP 1.0 0.0;\n
7264 action: DRAG_VAL_PAGE 0.0 0.0;\n
7265 action: FOCUS_SET;\n
7266 action: FOCUS_OBJECT;\n
7267 action: PARAM_COPY "src_part" "src_param" "dst_part" "dst_param";\n
7268 action: PARAM_SET "part" "param" "value";\n
7269 @endproperty
7270*/
7271static void
7272st_collections_group_programs_program_action(void)
7273{
7274 Edje_Part_Collection *pc;
7275 Edje_Program *ep;
7276
7277 pc = eina_list_data_get(eina_list_last(edje_collections));
7278 ep = current_program;
7279 ep->action = parse_enum(0,
7280 "STATE_SET", EDJE_ACTION_TYPE_STATE_SET,
7281 "ACTION_STOP", EDJE_ACTION_TYPE_ACTION_STOP,
7282 "SIGNAL_EMIT", EDJE_ACTION_TYPE_SIGNAL_EMIT,
7283 "DRAG_VAL_SET", EDJE_ACTION_TYPE_DRAG_VAL_SET,
7284 "DRAG_VAL_STEP", EDJE_ACTION_TYPE_DRAG_VAL_STEP,
7285 "DRAG_VAL_PAGE", EDJE_ACTION_TYPE_DRAG_VAL_PAGE,
7286 "SCRIPT", EDJE_ACTION_TYPE_SCRIPT,
7287 "FOCUS_SET", EDJE_ACTION_TYPE_FOCUS_SET,
7288 "FOCUS_OBJECT", EDJE_ACTION_TYPE_FOCUS_OBJECT,
7289 "PARAM_COPY", EDJE_ACTION_TYPE_PARAM_COPY,
7290 "PARAM_SET", EDJE_ACTION_TYPE_PARAM_SET,
7291#ifdef ENABLE_MULTISENSE
7292 "PLAY_SAMPLE", EDJE_ACTION_TYPE_SOUND_SAMPLE,
7293 "PLAY_TONE", EDJE_ACTION_TYPE_SOUND_TONE,
7294#endif
7295 NULL);
7296 if (ep->action == EDJE_ACTION_TYPE_STATE_SET)
7297 {
7298 ep->state = parse_str(1);
7299 ep->value = parse_float_range(2, 0.0, 1.0);
7300 }
7301 else if (ep->action == EDJE_ACTION_TYPE_SIGNAL_EMIT)
7302 {
7303 ep->state = parse_str(1);
7304 ep->state2 = parse_str(2);
7305 }
7306#ifdef ENABLE_MULTISENSE
7307 else if (ep->action == EDJE_ACTION_TYPE_SOUND_SAMPLE)
7308 {
7309 int i;
7310
7311 ep->sample_name = parse_str(1);
7312 for (i = 0; i < (int)edje_file->sound_dir->samples_count; i++)
7313 {
7314 if (!strcmp(edje_file->sound_dir->samples[i].name, ep->sample_name))
7315 break;
7316 if (i == (int)(edje_file->sound_dir->samples_count - 1))
7317 {
7318 ERR("%s: Error. No Sample name %s exist.", progname,
7319 ep->sample_name);
7320 exit(-1);
7321 }
7322 }
7323 ep->speed = parse_float_range(2, 0.0, 10.0);
7324 }
7325 else if (ep->action == EDJE_ACTION_TYPE_SOUND_TONE)
7326 {
7327 int i;
7328
7329 ep->tone_name = parse_str(1);
7330 for (i = 0; i < (int)edje_file->sound_dir->tones_count; i++)
7331 {
7332 if (!strcmp(edje_file->sound_dir->tones[i].name, ep->tone_name))
7333 break;
7334 if (i == (int)(edje_file->sound_dir->tones_count - 1))
7335 {
7336 ERR("%s: Error. No Tone name %s exist.", progname,
7337 ep->tone_name);
7338 exit(-1);
7339 }
7340 }
7341 ep->duration = parse_float_range(2, 0.1, 10.0);
7342 }
7343#endif
7344 else if (ep->action == EDJE_ACTION_TYPE_DRAG_VAL_SET)
7345 {
7346 ep->value = parse_float(1);
7347 ep->value2 = parse_float(2);
7348 }
7349 else if (ep->action == EDJE_ACTION_TYPE_DRAG_VAL_STEP)
7350 {
7351 ep->value = parse_float(1);
7352 ep->value2 = parse_float(2);
7353 }
7354 else if (ep->action == EDJE_ACTION_TYPE_DRAG_VAL_PAGE)
7355 {
7356 ep->value = parse_float(1);
7357 ep->value2 = parse_float(2);
7358 }
7359 else if (ep->action == EDJE_ACTION_TYPE_PARAM_COPY)
7360 {
7361 char *src_part, *dst_part;
7362
7363 src_part = parse_str(1);
7364 ep->state = parse_str(2);
7365 dst_part = parse_str(3);
7366 ep->state2 = parse_str(4);
7367
7368 data_queue_part_lookup(pc, src_part, &(ep->param.src));
7369 data_queue_part_lookup(pc, dst_part, &(ep->param.dst));
7370
7371 free(src_part);
7372 free(dst_part);
7373 }
7374 else if (ep->action == EDJE_ACTION_TYPE_PARAM_SET)
7375 {
7376 char *part;
7377
7378 part = parse_str(1);
7379 ep->state = parse_str(2);
7380 ep->state2 = parse_str(3);
7381
7382 data_queue_part_lookup(pc, part, &(ep->param.dst));
7383 free(part);
7384 }
7385
7386 switch (ep->action)
7387 {
7388 case EDJE_ACTION_TYPE_ACTION_STOP:
7389 check_arg_count(1);
7390 break;
7391 case EDJE_ACTION_TYPE_SCRIPT:
7392 /* this is implicitly set by script {} so this is here just for
7393 * completeness */
7394 break;
7395 case EDJE_ACTION_TYPE_FOCUS_OBJECT:
7396 case EDJE_ACTION_TYPE_FOCUS_SET:
7397 check_arg_count(1);
7398 break;
7399 case EDJE_ACTION_TYPE_PARAM_COPY:
7400 check_arg_count(5);
7401 break;
7402 case EDJE_ACTION_TYPE_PARAM_SET:
7403 check_arg_count(4);
7404 break;
7405#ifdef ENABLE_MULTISENSE
7406 case EDJE_ACTION_TYPE_SOUND_SAMPLE:
7407 check_arg_count(3);
7408 break;
7409 case EDJE_ACTION_TYPE_SOUND_TONE:
7410 check_arg_count(3);
7411 break;
7412#endif
7413 default:
7414 check_arg_count(3);
7415 }
7416}
7417
7418/**
7419 @page edcref
7420 @property
7421 transition
7422 @parameters
7423 [type] [length] [[interp val 1]] [[interp val 2]] [[option]]
7424 @effect
7425 Defines how transitions occur using STATE_SET action.\n
7426 Where 'type' is the style of the transition and 'length' is a double
7427 specifying the number of seconds in which to preform the transition.\n
7428 Valid types are: LIN or LINEAR, SIN or SINUSOIDAL,
7429 ACCEL or ACCELERATE, DECEL or DECELERATE,
7430 ACCEL_FAC or ACCELERATE_FACTOR, DECEL_FAC or DECELERATE_FACTOR,
7431 SIN_FAC or SINUSOIDAL_FACTOR, DIVIS or DIVISOR_INTERP,
7432 BOUNCE, SPRING.
7433
7434 ACCEL_FAC, DECEL_FAC and SIN_FAC need the extra optional
7435 "interp val 1" to determine the "factor" of curviness. 1.0 is the same
7436 as their non-factor counterparts, where 0.0 is equal to linear.
7437 numbers higher than one make the curve angles steeper with a more
7438 prnounced curve point.
7439
7440 DIVIS, BOUNCE and SPRING also require "interp val 2" in addition
7441 to "interp val 1".
7442
7443 DIVIS uses val 1 as the initial graident start
7444 (0.0 is horizontal, 1.0 is diagonal (linear), 2.0 is twice the
7445 gradient of linear etc.). val 2 is interpreted as an integer factor
7446 defining how much the value swings "outside" the gradient only to come
7447 back to the final resting spot at the end. 0.0 for val 2 is equivalent
7448 to linear interpolation. Note that DIVIS can exceed 1.0
7449
7450 BOUNCE uses val 2 as the number of bounces (so its rounded down to
7451 the nearest integer value), with val 2 determining how much the
7452 bounce decays, with 0.0 giving linear decay per bounce, and higher
7453 values giving much more decay.
7454
7455 SPRING is similar to bounce, where val 2 specifies the number of
7456 spring "swings" and val 1 specifies the decay, but it can exceed 1.0
7457 on the outer swings.
7458
7459 Valid option is CURRENT.
7460
7461 CURRENT is the option which causes the edje object to move from its current position.
7462 It can be used as the last parameter of any transition type. (@since 1.1.0)
7463
7464 @endproperty
7465*/
7466static void
7467st_collections_group_programs_program_transition(void)
7468{
7469 check_min_arg_count(2);
7470
7471 current_program->tween.mode = parse_enum(0,
7472 // short names
7473 "LIN", EDJE_TWEEN_MODE_LINEAR,
7474 "SIN", EDJE_TWEEN_MODE_SINUSOIDAL,
7475 "ACCEL", EDJE_TWEEN_MODE_ACCELERATE,
7476 "DECEL", EDJE_TWEEN_MODE_DECELERATE,
7477 "ACCEL_FAC", EDJE_TWEEN_MODE_ACCELERATE_FACTOR,
7478 "DECEL_FAC", EDJE_TWEEN_MODE_DECELERATE_FACTOR,
7479 "SIN_FAC", EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR,
7480 "DIVIS", EDJE_TWEEN_MODE_DIVISOR_INTERP,
7481
7482 // long/full names
7483 "LINEAR", EDJE_TWEEN_MODE_LINEAR,
7484 "SINUSOIDAL", EDJE_TWEEN_MODE_SINUSOIDAL,
7485 "ACCELERATE", EDJE_TWEEN_MODE_ACCELERATE,
7486 "DECELERATE", EDJE_TWEEN_MODE_DECELERATE,
7487 "ACCELERATE_FACTOR", EDJE_TWEEN_MODE_ACCELERATE_FACTOR,
7488 "DECELERATE_FACTOR", EDJE_TWEEN_MODE_DECELERATE_FACTOR,
7489 "SINUSOIDAL_FACTOR", EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR,
7490 "DIVISOR_INTERP", EDJE_TWEEN_MODE_DIVISOR_INTERP,
7491
7492 // long/full is short enough
7493 "BOUNCE", EDJE_TWEEN_MODE_BOUNCE,
7494 "SPRING", EDJE_TWEEN_MODE_SPRING,
7495 NULL);
7496 current_program->tween.time = FROM_DOUBLE(parse_float_range(1, 0.0, 999999999.0));
7497 if ((current_program->tween.mode >= EDJE_TWEEN_MODE_LINEAR) &&
7498 (current_program->tween.mode <= EDJE_TWEEN_MODE_DECELERATE))
7499 {
7500 if ((get_arg_count() == 3) && (!strcmp(parse_str(2), "CURRENT")))
7501 current_program->tween.mode |= EDJE_TWEEN_MODE_OPT_FROM_CURRENT;
7502 else if (get_arg_count() != 2)
7503 {
7504 ERR("%s: Error. parse error %s:%i. "
7505 "Need 2rd parameter to set time",
7506 progname, file_in, line - 1);
7507 exit(-1);
7508 }
7509 }
7510 // the following need v1
7511 // EDJE_TWEEN_MODE_ACCELERATE_FACTOR
7512 // EDJE_TWEEN_MODE_DECELERATE_FACTOR
7513 // EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR
7514 // current_program->tween.v1
7515 else if ((current_program->tween.mode >= EDJE_TWEEN_MODE_ACCELERATE_FACTOR) &&
7516 (current_program->tween.mode <= EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR))
7517 {
7518 if ((get_arg_count() == 4) && (!strcmp(parse_str(3), "CURRENT")))
7519 current_program->tween.mode |= EDJE_TWEEN_MODE_OPT_FROM_CURRENT;
7520 else if (get_arg_count() != 3)
7521 {
7522 ERR("%s: Error. parse error %s:%i. "
7523 "Need 3rd parameter to set factor",
7524 progname, file_in, line - 1);
7525 exit(-1);
7526 }
7527 current_program->tween.v1 = FROM_DOUBLE(parse_float_range(2, 0.0, 999999999.0));
7528 }
7529 // the followjng also need v2
7530 // EDJE_TWEEN_MODE_DIVISOR_INTERP
7531 // EDJE_TWEEN_MODE_BOUNCE
7532 // EDJE_TWEEN_MODE_SPRING
7533 // current_program->tween.v2
7534 else if ((current_program->tween.mode >= EDJE_TWEEN_MODE_DIVISOR_INTERP) &&
7535 (current_program->tween.mode <= EDJE_TWEEN_MODE_SPRING))
7536 {
7537 if ((get_arg_count() == 5) && (!strcmp(parse_str(4), "CURRENT")))
7538 current_program->tween.mode |= EDJE_TWEEN_MODE_OPT_FROM_CURRENT;
7539 else if (get_arg_count() != 4)
7540 {
7541 ERR("%s: Error. parse error %s:%i. "
7542 "Need 3rd and 4th parameters to set factor and counts",
7543 progname, file_in, line - 1);
7544 exit(-1);
7545 }
7546 current_program->tween.v1 = FROM_DOUBLE(parse_float_range(2, 0.0, 999999999.0));
7547 current_program->tween.v2 = FROM_DOUBLE(parse_float_range(3, 0.0, 999999999.0));
7548 }
7549}
7550
7551/**
7552 @page edcref
7553 @property
7554 target
7555 @parameters
7556 [target]
7557 @effect
7558 Program or part on which the specified action acts. Multiple target
7559 keywords may be specified, one per target. SIGNAL_EMITs do not have
7560 targets.
7561 @endproperty
7562*/
7563static void
7564st_collections_group_programs_program_target(void)
7565{
7566 Edje_Part_Collection *pc;
7567 Edje_Program *ep;
7568
7569 check_arg_count(1);
7570
7571 pc = eina_list_data_get(eina_list_last(edje_collections));
7572 ep = current_program;
7573 {
7574 Edje_Program_Target *et;
7575 Edje_Program_Target *etw;
7576 Eina_List *l;
7577 char *name;
7578 char *copy;
7579
7580 name = parse_str(0);
7581
7582 EINA_LIST_FOREACH(ep->targets, l, etw)
7583 {
7584 if (!strcmp(name, (char*) (etw + 1)))
7585 {
7586 free(name);
7587 return;
7588 }
7589 }
7590
7591 et = mem_alloc(SZ(Edje_Program_Target) + strlen(name) + 1);
7592 ep->targets = eina_list_append(ep->targets, et);
7593 copy = (char*) (et + 1);
7594
7595 memcpy(copy, name, strlen(name) + 1);
7596
7597 if (ep->action == EDJE_ACTION_TYPE_STATE_SET)
7598 data_queue_part_lookup(pc, name, &(et->id));
7599 else if (ep->action == EDJE_ACTION_TYPE_ACTION_STOP)
7600 data_queue_program_lookup(pc, name, &(et->id));
7601 else if (ep->action == EDJE_ACTION_TYPE_DRAG_VAL_SET)
7602 data_queue_part_lookup(pc, name, &(et->id));
7603 else if (ep->action == EDJE_ACTION_TYPE_DRAG_VAL_STEP)
7604 data_queue_part_lookup(pc, name, &(et->id));
7605 else if (ep->action == EDJE_ACTION_TYPE_DRAG_VAL_PAGE)
7606 data_queue_part_lookup(pc, name, &(et->id));
7607 else if (ep->action == EDJE_ACTION_TYPE_FOCUS_SET)
7608 data_queue_part_lookup(pc, name, &(et->id));
7609 else if (ep->action == EDJE_ACTION_TYPE_FOCUS_OBJECT)
7610 data_queue_part_lookup(pc, name, &(et->id));
7611 else
7612 {
7613 ERR("%s: Error. parse error %s:%i. "
7614 "target may only be used after action",
7615 progname, file_in, line - 1);
7616 exit(-1);
7617 }
7618 free(name);
7619 }
7620}
7621
7622/**
7623 @page edcref
7624 @property
7625 after
7626 @parameters
7627 [after]
7628 @effect
7629 Specifies a program to run after the current program completes. The
7630 source and signal parameters of a program run as an "after" are ignored.
7631 Multiple "after" statements can be specified per program.
7632 @endproperty
7633*/
7634static void
7635st_collections_group_programs_program_after(void)
7636{
7637 Edje_Part_Collection *pc;
7638 Edje_Program *ep;
7639
7640 check_arg_count(1);
7641
7642 pc = eina_list_data_get(eina_list_last(edje_collections));
7643 ep = current_program;
7644 {
7645 Edje_Program_After *pa;
7646 char *name;
7647
7648 name = parse_str(0);
7649
7650 pa = mem_alloc(SZ(Edje_Program_After));
7651 pa->id = -1;
7652 ep->after = eina_list_append(ep->after, pa);
7653
7654 data_queue_program_lookup(pc, name, &(pa->id));
7655 free(name);
7656 }
7657}
7658
7659/**
7660 @page edcref
7661 @property
7662 api
7663 @parameters
7664 [name] [description]
7665 @effect
7666 Specifies a hint to let applications (or IDE's) know how to bind
7667 things. The parameter name should contain the name of the function that
7668 the application should use, and description describes how it should
7669 be used.
7670 @endproperty
7671*/
7672static void
7673st_collections_group_programs_program_api(void)
7674{
7675 check_min_arg_count(1);
7676
7677 current_program->api.name = parse_str(0);
7678
7679 if (is_param(1))
7680 {
7681 check_arg_count(2);
7682 current_program->api.description = parse_str(1);
7683 }
7684}
7685
7686static void
7687st_collections_group_parts_part_api(void)
7688{
7689 check_min_arg_count(1);
7690
7691 current_part->api.name = parse_str(0);
7692 if (is_param(1))
7693 {
7694 check_arg_count(2);
7695 current_part->api.description = parse_str(1);
7696 }
7697}
7698
7699static void
7700ob_collections_group_programs_program_script(void)
7701{
7702 Edje_Part_Collection *pc;
7703 Code *cd;
7704
7705 pc = eina_list_data_get(eina_list_last(edje_collections));
7706 cd = eina_list_data_get(eina_list_last(codes));
7707
7708 if (!is_verbatim()) track_verbatim(1);
7709 else
7710 {
7711 Eina_Bool empty = EINA_TRUE;
7712 char *s;
7713 int i, len;
7714
7715 s = get_verbatim();
7716 if (s)
7717 {
7718 Code_Program *cp;
7719
7720 /* FIXME: Need to store the script somewhere to be restored when using edje_edit API */
7721 cp = mem_alloc(SZ(Code_Program));
7722 cp->l1 = get_verbatim_line1();
7723 cp->l2 = get_verbatim_line2();
7724 cp->script = s;
7725 cp->original = strdup(s);
7726 if (cd->shared && cd->is_lua)
7727 {
7728 ERR("%s: Error. parse error %s:%i. You're trying to mix Embryo and Lua scripting in the same group",
7729 progname, file_in, line - 1);
7730 exit(-1);
7731 }
7732 cd->is_lua = 0;
7733
7734 len = strlen(cp->script);
7735 for (i = 0; i < len; i++)
7736 {
7737 if (((cp->script[i] > 'a') && (cp->script[i] < 'z')) ||
7738 ((cp->script[i] > 'A') && (cp->script[i] < 'Z')) ||
7739 ((cp->script[i] > '0') && (cp->script[i] < '9')))
7740 empty = EINA_FALSE;
7741 }
7742
7743 if (!empty)
7744 {
7745 cd->programs = eina_list_append(cd->programs, cp);
7746 data_queue_anonymous_lookup(pc, current_program, &(cp->id));
7747 current_program->action = EDJE_ACTION_TYPE_SCRIPT;
7748 }
7749 else
7750 {
7751 data_queue_anonymous_lookup(pc, current_program, NULL);
7752 free(cp);
7753 cp = NULL;
7754 }
7755
7756 set_verbatim(NULL, 0, 0);
7757 }
7758 }
7759}
7760/**
7761 @page edcref
7762 </table>
7763*/
diff --git a/libraries/edje/src/bin/edje_cc_mem.c b/libraries/edje/src/bin/edje_cc_mem.c
new file mode 100644
index 0000000..7c1a5c9
--- /dev/null
+++ b/libraries/edje/src/bin/edje_cc_mem.c
@@ -0,0 +1,40 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <string.h>
6#include <errno.h>
7
8#include "edje_cc.h"
9
10#ifdef _WIN32
11# define FMT_SIZE_T "%Iu"
12#else
13# define FMT_SIZE_T "%zu"
14#endif
15
16void *
17mem_alloc(size_t size)
18{
19 void *mem;
20
21 mem = calloc(1, size);
22 if (mem) return mem;
23 ERR("%s: Error. %s:%i memory allocation of " FMT_SIZE_T " bytes failed. %s",
24 progname, file_in, line, size, strerror(errno));
25 exit(-1);
26 return NULL;
27}
28
29char *
30mem_strdup(const char *s)
31{
32 void *str;
33
34 str = strdup(s);
35 if (str) return str;
36 ERR("%s: Error. %s:%i memory allocation of " FMT_SIZE_T " bytes failed. %s. string being duplicated: \"%s\"",
37 progname, file_in, line, strlen(s) + 1, strerror(errno), s);
38 exit(-1);
39 return NULL;
40}
diff --git a/libraries/edje/src/bin/edje_cc_out.c b/libraries/edje/src/bin/edje_cc_out.c
new file mode 100644
index 0000000..443a702
--- /dev/null
+++ b/libraries/edje/src/bin/edje_cc_out.c
@@ -0,0 +1,1995 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#ifdef HAVE_ALLOCA_H
6# include <alloca.h>
7#elif defined __GNUC__
8# define alloca __builtin_alloca
9#elif defined _AIX
10# define alloca __alloca
11#elif defined _MSC_VER
12# include <malloc.h>
13# define alloca _alloca
14#else
15# include <stddef.h>
16# ifdef __cplusplus
17extern "C"
18# endif
19void *alloca (size_t);
20#endif
21
22#include <string.h>
23#include <limits.h>
24#include <unistd.h>
25#include <sys/stat.h>
26
27#include <Ecore_Evas.h>
28
29#include "edje_cc.h"
30#include "edje_convert.h"
31#include "edje_multisense_convert.h"
32
33#include <lua.h>
34#include <lauxlib.h>
35
36typedef struct _External_Lookup External_Lookup;
37typedef struct _Part_Lookup Part_Lookup;
38typedef struct _Program_Lookup Program_Lookup;
39typedef struct _Group_Lookup Group_Lookup;
40typedef struct _Image_Lookup Image_Lookup;
41typedef struct _Slave_Lookup Slave_Lookup;
42typedef struct _Code_Lookup Code_Lookup;
43
44
45struct _External_Lookup
46{
47 char *name;
48};
49
50struct _Part_Lookup
51{
52 Edje_Part_Collection *pc;
53 char *name;
54 int *dest;
55};
56
57struct _Program_Lookup
58{
59 Edje_Part_Collection *pc;
60
61 union
62 {
63 char *name;
64 Edje_Program *ep;
65 } u;
66
67 int *dest;
68
69 Eina_Bool anonymous : 1;
70};
71
72struct _Group_Lookup
73{
74 char *name;
75};
76
77struct _String_Lookup
78{
79 char *name;
80 int *dest;
81};
82
83struct _Image_Lookup
84{
85 char *name;
86 int *dest;
87 Eina_Bool *set;
88};
89
90struct _Slave_Lookup
91{
92 int *master;
93 int *slave;
94};
95
96struct _Code_Lookup
97{
98 char *ptr;
99 int len;
100 int val;
101 Eina_Bool set;
102};
103
104static void data_process_string(Edje_Part_Collection *pc, const char *prefix, char *s, void (*func)(Edje_Part_Collection *pc, char *name, char *ptr, int len));
105
106Edje_File *edje_file = NULL;
107Eina_List *edje_collections = NULL;
108Eina_List *externals = NULL;
109Eina_List *fonts = NULL;
110Eina_List *codes = NULL;
111Eina_List *code_lookups = NULL;
112Eina_List *aliases = NULL;
113
114static Eet_Data_Descriptor *edd_edje_file = NULL;
115static Eet_Data_Descriptor *edd_edje_part_collection = NULL;
116
117static Eina_List *part_lookups = NULL;
118static Eina_List *program_lookups = NULL;
119static Eina_List *group_lookups = NULL;
120static Eina_List *image_lookups = NULL;
121static Eina_List *part_slave_lookups = NULL;
122static Eina_List *image_slave_lookups= NULL;
123
124#define ABORT_WRITE(eet_file, file) \
125 eet_close(eet_file); \
126 unlink(file); \
127 exit(-1);
128
129void
130error_and_abort(Eet_File *ef, const char *fmt, ...)
131{
132 va_list ap;
133
134 fprintf(stderr, "%s: Error. ", progname);
135
136 va_start(ap, fmt);
137 vfprintf(stderr, fmt, ap);
138 va_end(ap);
139 ABORT_WRITE(ef, file_out);
140}
141
142void
143data_setup(void)
144{
145 edd_edje_file = _edje_edd_edje_file;
146 edd_edje_part_collection = _edje_edd_edje_part_collection;
147}
148
149static void
150check_image_part_desc (Edje_Part_Collection *pc, Edje_Part *ep,
151 Edje_Part_Description_Image *epd, Eet_File *ef)
152{
153 unsigned int i;
154
155#if 0 /* FIXME: This check sounds like not a useful one */
156 if (epd->image.id == -1)
157 ERR(ef, "Collection %s(%i): image attributes missing for "
158 "part \"%s\", description \"%s\" %f\n",
159 pc->part, pc->id, ep->name, epd->common.state.name, epd->common.state.value);
160#endif
161
162 for (i = 0; i < epd->image.tweens_count; ++i)
163 {
164 if (epd->image.tweens[i]->id == -1)
165 error_and_abort(ef, "Collection %i: tween image id missing for "
166 "part \"%s\", description \"%s\" %f\n",
167 pc->id, ep->name, epd->common.state.name, epd->common.state.value);
168 }
169}
170
171static void
172check_packed_items(Edje_Part_Collection *pc, Edje_Part *ep, Eet_File *ef)
173{
174 unsigned int i;
175
176 for (i = 0; i < ep->items_count; ++i)
177 {
178 if (ep->items[i]->type == EDJE_PART_TYPE_GROUP && !ep->items[i]->source)
179 error_and_abort(ef, "Collection %i: missing source on packed item "
180 "of type GROUP in part \"%s\"\n",
181 pc->id, ep->name);
182 if (ep->type == EDJE_PART_TYPE_TABLE && (ep->items[i]->col < 0 || ep->items[i]->row < 0))
183 error_and_abort(ef, "Collection %i: missing col/row on packed item "
184 "for part \"%s\" of type TABLE\n",
185 pc->id, ep->name);
186 }
187}
188
189static void
190check_nameless_state(Edje_Part_Collection *pc, Edje_Part *ep, Edje_Part_Description_Common *ed, Eet_File *ef)
191{
192 if (!ed->state.name)
193 error_and_abort(ef, "Collection %i: description with state missing on part \"%s\"\n",
194 pc->id, ep->name);
195}
196
197static void
198check_part (Edje_Part_Collection *pc, Edje_Part *ep, Eet_File *ef)
199{
200 unsigned int i;
201 /* FIXME: check image set and sort them. */
202 if (!ep->default_desc)
203 error_and_abort(ef, "Collection %i: default description missing "
204 "for part \"%s\"\n", pc->id, ep->name);
205
206 for (i = 0; i < ep->other.desc_count; ++i)
207 check_nameless_state(pc, ep, ep->other.desc[i], ef);
208
209 if (ep->type == EDJE_PART_TYPE_IMAGE)
210 {
211 check_image_part_desc(pc, ep, (Edje_Part_Description_Image*) ep->default_desc, ef);
212
213 for (i = 0; i < ep->other.desc_count; ++i)
214 check_image_part_desc (pc, ep, (Edje_Part_Description_Image*) ep->other.desc[i], ef);
215 }
216 else if ((ep->type == EDJE_PART_TYPE_BOX) ||
217 (ep->type == EDJE_PART_TYPE_TABLE))
218 check_packed_items(pc, ep, ef);
219}
220
221static void
222check_program (Edje_Part_Collection *pc, Edje_Program *ep, Eet_File *ef)
223{
224 switch (ep->action)
225 {
226 case EDJE_ACTION_TYPE_STATE_SET:
227 case EDJE_ACTION_TYPE_ACTION_STOP:
228 case EDJE_ACTION_TYPE_DRAG_VAL_SET:
229 case EDJE_ACTION_TYPE_DRAG_VAL_STEP:
230 case EDJE_ACTION_TYPE_DRAG_VAL_PAGE:
231 if (!ep->targets)
232 error_and_abort(ef, "Collection %i: target missing in program "
233 "\"%s\"\n", pc->id, ep->name);
234 break;
235 default:
236 break;
237 }
238}
239
240static int
241data_write_header(Eet_File *ef)
242{
243 int bytes = 0;
244
245 if (edje_file)
246 {
247 if (edje_file->collection)
248 {
249 Edje_Part_Collection_Directory_Entry *ce;
250
251 /* copy aliases into collection directory */
252 EINA_LIST_FREE(aliases, ce)
253 {
254 Edje_Part_Collection_Directory_Entry *sce;
255 Eina_Iterator *it;
256
257 if (!ce->entry)
258 error_and_abort(ef, "Collection %i: name missing.\n", ce->id);
259
260 it = eina_hash_iterator_data_new(edje_file->collection);
261
262 EINA_ITERATOR_FOREACH(it, sce)
263 if (ce->id == sce->id)
264 {
265 memcpy(&ce->count, &sce->count, sizeof (ce->count));
266 break;
267 }
268
269 if (!sce)
270 error_and_abort(ef, "Collection %s (%i) can't find an correct alias.\n", ce->entry, ce->id);
271
272 eina_iterator_free(it);
273
274 eina_hash_direct_add(edje_file->collection, ce->entry, ce);
275 }
276 }
277 bytes = eet_data_write(ef, edd_edje_file, "edje/file", edje_file, 1);
278 if (bytes <= 0)
279 error_and_abort(ef, "Unable to write \"edje_file\" entry to \"%s\" \n",
280 file_out);
281 }
282
283 if (verbose)
284 {
285 printf("%s: Wrote %9i bytes (%4iKb) for \"edje_file\" header\n",
286 progname, bytes, (bytes + 512) / 1024);
287 }
288
289 return bytes;
290}
291
292static int
293data_write_fonts(Eet_File *ef, int *font_num, int *input_bytes, int *input_raw_bytes)
294{
295 Eina_Iterator *it;
296 int bytes = 0;
297 int total_bytes = 0;
298 Font *fn;
299
300 if (!edje_file->fonts)
301 return 0;
302
303 it = eina_hash_iterator_data_new(edje_file->fonts);
304 EINA_ITERATOR_FOREACH(it, fn)
305 {
306 void *fdata = NULL;
307 int fsize = 0;
308 Eina_List *ll;
309 FILE *f;
310
311 f = fopen(fn->file, "rb");
312 if (f)
313 {
314 long pos;
315
316 fseek(f, 0, SEEK_END);
317 pos = ftell(f);
318 rewind(f);
319 fdata = malloc(pos);
320 if (fdata)
321 {
322 if (fread(fdata, pos, 1, f) != 1)
323 error_and_abort(ef, "Unable to read all of font "
324 "file \"%s\"\n", fn->file);
325 fsize = pos;
326 }
327 fclose(f);
328 }
329 else
330 {
331 char *data;
332
333 EINA_LIST_FOREACH(fnt_dirs, ll, data)
334 {
335 char buf[4096];
336
337 snprintf(buf, sizeof(buf), "%s/%s", data, fn->file);
338 f = fopen(buf, "rb");
339 if (f)
340 {
341 long pos;
342
343 fseek(f, 0, SEEK_END);
344 pos = ftell(f);
345 rewind(f);
346 fdata = malloc(pos);
347 if (fdata)
348 {
349 if (fread(fdata, pos, 1, f) != 1)
350 error_and_abort(ef, "Unable to read all of font "
351 "file \"%s\"\n", buf);
352 fsize = pos;
353 }
354 fclose(f);
355 if (fdata) break;
356 }
357 }
358 }
359 if (!fdata)
360 {
361 error_and_abort(ef, "Unable to load font part \"%s\" entry "
362 "to %s \n", fn->file, file_out);
363 }
364 else
365 {
366 char buf[4096];
367
368 snprintf(buf, sizeof(buf), "edje/fonts/%s", fn->name);
369 bytes = eet_write(ef, buf, fdata, fsize, 1);
370 if (bytes <= 0)
371 error_and_abort(ef, "Unable to write font part \"%s\" as \"%s\" "
372 "part entry to %s \n", fn->file, buf, file_out);
373
374 *font_num += 1;
375 total_bytes += bytes;
376 *input_bytes += fsize;
377 *input_raw_bytes += fsize;
378
379 if (verbose)
380 {
381 printf("%s: Wrote %9i bytes (%4iKb) for \"%s\" font entry \"%s\" compress: [real: %2.1f%%]\n",
382 progname, bytes, (bytes + 512) / 1024, buf, fn->file,
383 100 - (100 * (double)bytes) / ((double)(fsize))
384 );
385 }
386 free(fdata);
387 }
388 }
389 eina_iterator_free(it);
390
391 return total_bytes;
392}
393
394static void
395error_and_abort_image_load_error(Eet_File *ef, const char *file, int error)
396{
397 const char *errmsg = evas_load_error_str(error);
398 char hint[1024] = "";
399
400 if (error == EVAS_LOAD_ERROR_DOES_NOT_EXIST)
401 {
402 snprintf
403 (hint, sizeof(hint),
404 " Check if path to file \"%s\" is correct "
405 "(both directory and file name).",
406 file);
407 }
408 else if (error == EVAS_LOAD_ERROR_CORRUPT_FILE)
409 {
410 snprintf
411 (hint, sizeof(hint),
412 " Check if file \"%s\" is consistent.",
413 file);
414 }
415 else if (error == EVAS_LOAD_ERROR_UNKNOWN_FORMAT)
416 {
417 const char *ext = strrchr(file, '.');
418 const char **itr, *known_loaders[] = {
419 /* list from evas_image_load.c */
420 "png",
421 "jpg",
422 "jpeg",
423 "jfif",
424 "eet",
425 "edj",
426 "eap",
427 "edb",
428 "xpm",
429 "tiff",
430 "tif",
431 "svg",
432 "svgz",
433 "gif",
434 "pbm",
435 "pgm",
436 "ppm",
437 "pnm",
438 NULL
439 };
440
441 if (!ext)
442 {
443 snprintf
444 (hint, sizeof(hint),
445 " File \"%s\" does not have an extension, "
446 "maybe it should?",
447 file);
448 goto show_err;
449 }
450
451 ext++;
452 for (itr = known_loaders; *itr; itr++)
453 {
454 if (strcasecmp(ext, *itr) == 0)
455 {
456 snprintf
457 (hint, sizeof(hint),
458 " Check if Evas was compiled with %s module enabled and "
459 "all required dependencies exist.",
460 ext);
461 goto show_err;
462 }
463 }
464
465 snprintf(hint, sizeof(hint),
466 " Check if Evas supports loading files of type \"%s\" (%s) "
467 "and this module was compiled and all its dependencies exist.",
468 ext, file);
469 }
470 show_err:
471 error_and_abort
472 (ef, "Unable to load image \"%s\" used by file \"%s\": %s.%s\n",
473 file, file_out, errmsg, hint);
474}
475
476static int
477data_write_images(Eet_File *ef, int *image_num, int *input_bytes, int *input_raw_bytes)
478{
479 unsigned int i;
480 int bytes = 0;
481 int total_bytes = 0;
482
483 if ((edje_file) && (edje_file->image_dir))
484 {
485 Ecore_Evas *ee;
486 Evas *evas;
487 Edje_Image_Directory_Entry *img;
488
489 ecore_init();
490 ecore_evas_init();
491
492 ee = ecore_evas_buffer_new(1, 1);
493 if (!ee)
494 error_and_abort(ef, "Cannot create buffer engine canvas for image "
495 "load.\n");
496
497 evas = ecore_evas_get(ee);
498 for (i = 0; i < edje_file->image_dir->entries_count; i++)
499 {
500 img = &edje_file->image_dir->entries[i];
501
502 if (img->source_type == EDJE_IMAGE_SOURCE_TYPE_EXTERNAL)
503 {
504 }
505 else
506 {
507 Evas_Object *im;
508 Eina_List *ll;
509 char *data;
510 int load_err = EVAS_LOAD_ERROR_NONE;
511
512 im = NULL;
513 EINA_LIST_FOREACH(img_dirs, ll, data)
514 {
515 char buf[4096];
516
517 snprintf(buf, sizeof(buf), "%s/%s",
518 data, img->entry);
519 im = evas_object_image_add(evas);
520 if (im)
521 {
522 evas_object_image_file_set(im, buf, NULL);
523 load_err = evas_object_image_load_error_get(im);
524 if (load_err == EVAS_LOAD_ERROR_NONE)
525 break;
526 evas_object_del(im);
527 im = NULL;
528 if (load_err != EVAS_LOAD_ERROR_DOES_NOT_EXIST)
529 break;
530 }
531 }
532 if ((!im) && (load_err == EVAS_LOAD_ERROR_DOES_NOT_EXIST))
533 {
534 im = evas_object_image_add(evas);
535 if (im)
536 {
537 evas_object_image_file_set(im, img->entry, NULL);
538 load_err = evas_object_image_load_error_get(im);
539 if (load_err != EVAS_LOAD_ERROR_NONE)
540 {
541 evas_object_del(im);
542 im = NULL;
543 }
544 }
545 }
546 if (im)
547 {
548 void *im_data;
549 int im_w, im_h;
550 int im_alpha;
551 char buf[256];
552
553 evas_object_image_size_get(im, &im_w, &im_h);
554 im_alpha = evas_object_image_alpha_get(im);
555 im_data = evas_object_image_data_get(im, 0);
556 if ((im_data) && (im_w > 0) && (im_h > 0))
557 {
558 int mode, qual;
559
560 snprintf(buf, sizeof(buf), "edje/images/%i", img->id);
561 qual = 80;
562 if ((img->source_type == EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT) &&
563 (img->source_param == 0))
564 mode = 0; /* RAW */
565 else if ((img->source_type == EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT) &&
566 (img->source_param == 1))
567 mode = 1; /* COMPRESS */
568 else
569 mode = 2; /* LOSSY */
570 if ((mode == 0) && (no_raw))
571 {
572 mode = 1; /* promote compression */
573 img->source_param = 95;
574 }
575 if ((mode == 2) && (no_lossy)) mode = 1; /* demote compression */
576 if ((mode == 1) && (no_comp))
577 {
578 if (no_lossy) mode = 0; /* demote compression */
579 else if (no_raw)
580 {
581 img->source_param = 90;
582 mode = 2; /* no choice. lossy */
583 }
584 }
585 if (mode == 2)
586 {
587 qual = img->source_param;
588 if (qual < min_quality) qual = min_quality;
589 if (qual > max_quality) qual = max_quality;
590 }
591 if (mode == 0)
592 bytes = eet_data_image_write(ef, buf,
593 im_data, im_w, im_h,
594 im_alpha,
595 0, 0, 0);
596 else if (mode == 1)
597 bytes = eet_data_image_write(ef, buf,
598 im_data, im_w, im_h,
599 im_alpha,
600 1, 0, 0);
601 else if (mode == 2)
602 bytes = eet_data_image_write(ef, buf,
603 im_data, im_w, im_h,
604 im_alpha,
605 0, qual, 1);
606 if (bytes <= 0)
607 error_and_abort(ef, "Unable to write image part "
608 "\"%s\" as \"%s\" part entry to "
609 "%s\n", img->entry, buf,
610 file_out);
611
612 *image_num += 1;
613 total_bytes += bytes;
614 }
615 else
616 {
617 error_and_abort_image_load_error
618 (ef, img->entry, load_err);
619 }
620
621 if (verbose)
622 {
623 struct stat st;
624 const char *file = NULL;
625
626 evas_object_image_file_get(im, &file, NULL);
627 if (!file || (stat(file, &st) != 0))
628 st.st_size = 0;
629 *input_bytes += st.st_size;
630 *input_raw_bytes += im_w * im_h * 4;
631 printf("%s: Wrote %9i bytes (%4iKb) for \"%s\" image entry \"%s\" compress: [raw: %2.1f%%] [real: %2.1f%%]\n",
632 progname, bytes, (bytes + 512) / 1024, buf, img->entry,
633 100 - (100 * (double)bytes) / ((double)(im_w * im_h * 4)),
634 100 - (100 * (double)bytes) / ((double)(st.st_size))
635 );
636 }
637 evas_object_del(im);
638 }
639 else
640 {
641 error_and_abort_image_load_error
642 (ef, img->entry, load_err);
643 }
644 }
645 }
646 ecore_evas_free(ee);
647 ecore_evas_shutdown();
648 ecore_shutdown();
649 }
650
651 return total_bytes;
652}
653
654static int
655data_write_sounds(Eet_File * ef, int *sound_num, int *input_bytes, int *input_raw_bytes)
656{
657 int bytes = 0;
658 int total_bytes = 0;
659
660 if ((edje_file) && (edje_file->sound_dir))
661 {
662 Eina_List *ll;
663 Edje_Sound_Sample *sample;
664#ifdef HAVE_LIBSNDFILE
665 Edje_Sound_Encode *enc_info;
666#endif
667 char *dir_path = NULL;
668 char snd_path[PATH_MAX];
669 char sndid_str[15];
670 void *fdata;
671 FILE *fp = NULL;
672 struct stat st;
673 int size = 0;
674 int i;
675
676 for (i = 0; i < (int)edje_file->sound_dir->samples_count; i++)
677 {
678 sample = &edje_file->sound_dir->samples[i];
679 memset(&st, 0, sizeof(struct stat));
680
681 // Search the Sound file in all the -sd ( sound directory )
682 EINA_LIST_FOREACH(snd_dirs, ll, dir_path)
683 {
684 snprintf((char *)snd_path, sizeof(snd_path), "%s/%s", dir_path,
685 sample->snd_src);
686 stat(snd_path, &st);
687 if (st.st_size) break;
688 }
689 if (!st.st_size)
690 {
691 snprintf((char *)snd_path, sizeof(snd_path), "%s",
692 sample->snd_src);
693 stat(snd_path, &st);
694 }
695 size = st.st_size;
696 if (!size)
697 {
698 ERR("%s: Error. Unable to load sound source file : %s",
699 progname, sample->snd_src);
700 exit(-1);
701 }
702#ifdef HAVE_LIBSNDFILE
703 enc_info = _edje_multisense_encode(snd_path, sample, sample->quality);
704
705 stat(enc_info->file, &st);
706 size = st.st_size;
707 fp = fopen(enc_info->file, "rb");
708#else
709 fp = fopen(snd_path, "rb");
710#endif
711 if (!fp)
712 {
713 ERR("%s: Error: Unable to load sound data of: %s",
714 progname, sample->name);
715 exit(-1);
716 }
717
718 snprintf(sndid_str, sizeof(sndid_str), "edje/sounds/%i", sample->id);
719 fdata = malloc(size);
720 if (!fdata)
721 {
722 ERR("%s: Error. %s:%i while allocating memory to load file \"%s\"",
723 progname, file_in, line, snd_path);
724 exit(-1);
725 }
726 if (fread(fdata, size, 1, fp))
727 bytes = eet_write(ef, sndid_str, fdata, size, EINA_FALSE);
728 free(fdata);
729 fclose(fp);
730
731#ifdef HAVE_LIBSNDFILE
732 //If encoded temporary file, delete it.
733 if (enc_info->encoded) unlink(enc_info->file);
734#endif
735 *sound_num += 1;
736 total_bytes += bytes;
737 *input_bytes += size;
738 *input_raw_bytes += size;
739
740 if (verbose)
741 {
742#ifdef HAVE_LIBSNDFILE
743 printf ("%s: Wrote %9i bytes (%4iKb) for \"%s\" %s sound entry"
744 "\"%s\" \n", progname, bytes, (bytes + 512) / 1024,
745 sndid_str, enc_info->comp_type, sample->name);
746#else
747 printf ("%s: Wrote %9i bytes (%4iKb) for \"%s\" %s sound entry"
748 "\"%s\" \n", progname, bytes, (bytes + 512) / 1024,
749 sndid_str, "RAW PCM", sample->name);
750#endif
751 }
752#ifdef HAVE_LIBSNDFILE
753 if ((enc_info->file) && (!enc_info->encoded)) eina_stringshare_del(enc_info->file);
754 if (enc_info) free(enc_info);
755 enc_info = NULL;
756#endif
757 }
758 }
759 return total_bytes;
760}
761
762static void
763check_groups(Eet_File *ef)
764{
765 Edje_Part_Collection *pc;
766 Eina_List *l;
767
768 /* sanity checks for parts and programs */
769 EINA_LIST_FOREACH(edje_collections, l, pc)
770 {
771 unsigned int i;
772
773 for (i = 0; i < pc->parts_count; ++i)
774 check_part(pc, pc->parts[i], ef);
775
776#define CHECK_PROGRAM(Type, Pc, It) \
777 for (It = 0; It < Pc->programs.Type ## _count; ++It) \
778 check_program(Pc, Pc->programs.Type[i], ef); \
779
780 CHECK_PROGRAM(fnmatch, pc, i);
781 CHECK_PROGRAM(strcmp, pc, i);
782 CHECK_PROGRAM(strncmp, pc, i);
783 CHECK_PROGRAM(strrncmp, pc, i);
784 CHECK_PROGRAM(nocmp, pc, i);
785 }
786}
787
788static int
789data_write_groups(Eet_File *ef, int *collection_num)
790{
791 Eina_List *l;
792 Edje_Part_Collection *pc;
793 int bytes = 0;
794 int total_bytes = 0;
795
796 EINA_LIST_FOREACH(edje_collections, l, pc)
797 {
798 char buf[4096];
799
800 snprintf(buf, sizeof(buf), "edje/collections/%i", pc->id);
801 bytes = eet_data_write(ef, edd_edje_part_collection, buf, pc, 1);
802 if (bytes <= 0)
803 error_and_abort(ef, "Error. Unable to write \"%s\" part entry "
804 "to %s\n", buf, file_out);
805
806 *collection_num += 1;
807 total_bytes += bytes;
808
809 if (verbose)
810 {
811 printf("%s: Wrote %9i bytes (%4iKb) for \"%s\" collection entry\n",
812 progname, bytes, (bytes + 512) / 1024, buf);
813 }
814 }
815
816 return total_bytes;
817}
818
819static void
820create_script_file(Eet_File *ef, const char *filename, const Code *cd, int fd)
821{
822 FILE *f = fdopen(fd, "wb");
823 if (!f)
824 error_and_abort(ef, "Unable to open temp file \"%s\" for script "
825 "compilation.\n", filename);
826
827 Eina_List *ll;
828 Code_Program *cp;
829
830 fprintf(f, "#include <edje>\n");
831 int ln = 2;
832
833 if (cd->shared)
834 {
835 while (ln < (cd->l1 - 1))
836 {
837 fprintf(f, " \n");
838 ln++;
839 }
840 {
841 char *sp;
842 int hash = 0;
843 int newlined = 0;
844
845 for (sp = cd->shared; *sp; sp++)
846 {
847 if ((sp[0] == '#') && (newlined))
848 {
849 hash = 1;
850 }
851 newlined = 0;
852 if (sp[0] == '\n') newlined = 1;
853 if (!hash) fputc(sp[0], f);
854 else if (sp[0] == '\n') hash = 0;
855 }
856 fputc('\n', f);
857 }
858 ln += cd->l2 - cd->l1 + 1;
859 }
860 EINA_LIST_FOREACH(cd->programs, ll, cp)
861 {
862 if (cp->script)
863 {
864 while (ln < (cp->l1 - 1))
865 {
866 fprintf(f, " \n");
867 ln++;
868 }
869 /* FIXME: this prototype needs to be */
870 /* formalised and set in stone */
871 fprintf(f, "public _p%i(sig[], src[]) {", cp->id);
872 {
873 char *sp;
874 int hash = 0;
875 int newlined = 0;
876
877 for (sp = cp->script; *sp; sp++)
878 {
879 if ((sp[0] == '#') && (newlined))
880 {
881 hash = 1;
882 }
883 newlined = 0;
884 if (sp[0] == '\n') newlined = 1;
885 if (!hash) fputc(sp[0], f);
886 else if (sp[0] == '\n') hash = 0;
887 }
888 }
889 fprintf(f, "}\n");
890 ln += cp->l2 - cp->l1 + 1;
891 }
892 }
893
894 fclose(f);
895}
896
897static void
898compile_script_file(Eet_File *ef, const char *source, const char *output,
899 int script_num, int fd)
900{
901 FILE *f;
902 char buf[4096];
903 int ret;
904
905 snprintf(buf, sizeof(buf),
906 "embryo_cc -i %s/include -o %s %s",
907 eina_prefix_data_get(pfx), output, source);
908 ret = system(buf);
909
910 /* accept warnings in the embryo code */
911 if (ret < 0 || ret > 1)
912 error_and_abort(ef, "Compiling script code not clean.\n");
913
914 f = fdopen(fd, "rb");
915 if (!f)
916 error_and_abort(ef, "Unable to open script object \"%s\" for reading.\n",
917 output);
918
919 fseek(f, 0, SEEK_END);
920 int size = ftell(f);
921 rewind(f);
922
923 if (size > 0)
924 {
925 void *data = malloc(size);
926
927 if (data)
928 {
929 if (fread(data, size, 1, f) != 1)
930 error_and_abort(ef, "Unable to read all of script object "
931 "\"%s\"\n", output);
932
933 snprintf(buf, sizeof(buf), "edje/scripts/embryo/compiled/%i", script_num);
934 eet_write(ef, buf, data, size, 1);
935 free(data);
936 }
937 }
938
939 fclose(f);
940}
941
942static void
943data_write_scripts(Eet_File *ef)
944{
945 Eina_List *l;
946 int i;
947
948 if (!tmp_dir)
949#ifdef HAVE_EVIL
950 tmp_dir = (char *)evil_tmpdir_get();
951#else
952 tmp_dir = "/tmp";
953#endif
954
955 for (i = 0, l = codes; l; l = eina_list_next(l), i++)
956 {
957 char tmpn[PATH_MAX];
958 char tmpo[PATH_MAX];
959 int fd;
960 Code *cd = eina_list_data_get(l);
961
962 if (cd->is_lua)
963 continue;
964 if ((!cd->shared) && (!cd->programs))
965 continue;
966
967 snprintf(tmpn, PATH_MAX, "%s/edje_cc.sma-tmp-XXXXXX", tmp_dir);
968 fd = mkstemp(tmpn);
969 if (fd < 0)
970 error_and_abort(ef, "Unable to open temp file \"%s\" for script "
971 "compilation.\n", tmpn);
972
973 create_script_file(ef, tmpn, cd, fd);
974
975 snprintf(tmpo, PATH_MAX, "%s/edje_cc.amx-tmp-XXXXXX", tmp_dir);
976 fd = mkstemp(tmpo);
977 if (fd < 0)
978 {
979 unlink(tmpn);
980 error_and_abort(ef, "Unable to open temp file \"%s\" for script "
981 "compilation.\n", tmpn);
982 }
983 compile_script_file(ef, tmpn, tmpo, i, fd);
984
985 unlink(tmpn);
986 unlink(tmpo);
987
988 if (!no_save)
989 {
990 char buf[PATH_MAX];
991 Eina_List *ll;
992 Code_Program *cp;
993
994 if (cd->original)
995 {
996 snprintf(buf, PATH_MAX, "edje/scripts/embryo/source/%i", i);
997 eet_write(ef, buf, cd->original, strlen(cd->original) + 1, 1);
998 }
999 EINA_LIST_FOREACH(cd->programs, ll, cp)
1000 {
1001 if (!cp->original)
1002 continue;
1003 snprintf(buf, PATH_MAX, "edje/scripts/embryo/source/%i/%i", i,
1004 cp->id);
1005 eet_write(ef, buf, cp->original, strlen(cp->original) + 1, 1);
1006 }
1007 }
1008 }
1009}
1010
1011typedef struct _Edje_Lua_Script_Writer_Struct Edje_Lua_Script_Writer_Struct;
1012
1013struct _Edje_Lua_Script_Writer_Struct
1014{
1015 char *buf;
1016 int size;
1017};
1018
1019#ifdef LUA_BINARY
1020static int
1021_edje_lua_script_writer(lua_State *L __UNUSED__, const void *chunk_buf, size_t chunk_size, void *_data)
1022{
1023 Edje_Lua_Script_Writer_Struct *data;
1024 void *old;
1025
1026 data = (Edje_Lua_Script_Writer_Struct *)_data;
1027 old = data->buf;
1028 data->buf = malloc (data->size + chunk_size);
1029 memcpy (data->buf, old, data->size);
1030 memcpy (&((data->buf)[data->size]), chunk_buf, chunk_size);
1031 if (old)
1032 free (old);
1033 data->size += chunk_size;
1034
1035 return 0;
1036}
1037#endif
1038
1039void
1040_edje_lua_error_and_abort(lua_State * L, int err_code, Eet_File *ef)
1041{
1042 char *err_type;
1043
1044 switch (err_code)
1045 {
1046 case LUA_ERRRUN:
1047 err_type = "runtime";
1048 break;
1049 case LUA_ERRSYNTAX:
1050 err_type = "syntax";
1051 break;
1052 case LUA_ERRMEM:
1053 err_type = "memory allocation";
1054 break;
1055 case LUA_ERRERR:
1056 err_type = "error handler";
1057 break;
1058 default:
1059 err_type = "unknown";
1060 break;
1061 }
1062 error_and_abort(ef, "Lua %s error: %s\n", err_type, lua_tostring(L, -1));
1063}
1064
1065
1066static void
1067data_write_lua_scripts(Eet_File *ef)
1068{
1069 Eina_List *l;
1070 Eina_List *ll;
1071 Code_Program *cp;
1072 int i;
1073
1074 for (i = 0, l = codes; l; l = eina_list_next(l), i++)
1075 {
1076 char buf[4096];
1077 Code *cd;
1078 lua_State *L;
1079 int ln = 1;
1080 luaL_Buffer b;
1081 Edje_Lua_Script_Writer_Struct data;
1082#ifdef LUA_BINARY
1083 int err_code;
1084#endif
1085
1086 cd = (Code *)eina_list_data_get(l);
1087 if (!cd->is_lua)
1088 continue;
1089 if ((!cd->shared) && (!cd->programs))
1090 continue;
1091
1092 L = luaL_newstate();
1093 if (!L)
1094 error_and_abort(ef, "Lua error: Lua state could not be initialized\n");
1095
1096 luaL_buffinit(L, &b);
1097
1098 data.buf = NULL;
1099 data.size = 0;
1100 if (cd->shared)
1101 {
1102 while (ln < (cd->l1 - 1))
1103 {
1104 luaL_addchar(&b, '\n');
1105 ln++;
1106 }
1107 luaL_addstring(&b, cd->shared);
1108 ln += cd->l2 - cd->l1;
1109 }
1110
1111 EINA_LIST_FOREACH(cd->programs, ll, cp)
1112 {
1113 if (cp->script)
1114 {
1115 while (ln < (cp->l1 - 1))
1116 {
1117 luaL_addchar(&b, '\n');
1118 ln++;
1119 }
1120 luaL_addstring(&b, "_G[");
1121 lua_pushnumber(L, cp->id);
1122 luaL_addvalue(&b);
1123 luaL_addstring(&b, "] = function (ed, signal, source)");
1124 luaL_addstring(&b, cp->script);
1125 luaL_addstring(&b, "end\n");
1126 ln += cp->l2 - cp->l1 + 1;
1127 }
1128 }
1129 luaL_pushresult(&b);
1130#ifdef LUA_BINARY
1131 if (err_code = luaL_loadstring(L, lua_tostring (L, -1)))
1132 _edje_lua_error_and_abort(L, err_code, ef);
1133 lua_dump(L, _edje_lua_script_writer, &data);
1134#else // LUA_PLAIN_TEXT
1135 data.buf = (char *)lua_tostring(L, -1);
1136 data.size = strlen(data.buf);
1137#endif
1138 //printf("lua chunk size: %d\n", data.size);
1139
1140 /*
1141 * TODO load and test Lua chunk
1142 */
1143
1144 /*
1145 if (luaL_loadbuffer(L, globbuf, globbufsize, "edje_lua_script"))
1146 printf("lua load error: %s\n", lua_tostring (L, -1));
1147 if (lua_pcall(L, 0, 0, 0))
1148 printf("lua call error: %s\n", lua_tostring (L, -1));
1149 */
1150
1151 snprintf(buf, sizeof(buf), "edje/scripts/lua/%i", i);
1152 eet_write(ef, buf, data.buf, data.size, 1);
1153#ifdef LUA_BINARY
1154 free(data.buf);
1155#endif
1156 lua_close(L);
1157 }
1158}
1159
1160void
1161data_write(void)
1162{
1163 Eet_File *ef;
1164 int input_bytes = 0;
1165 int total_bytes = 0;
1166 int src_bytes = 0;
1167 int fmap_bytes = 0;
1168 int input_raw_bytes = 0;
1169 int image_num = 0;
1170 int sound_num = 0;
1171 int font_num = 0;
1172 int collection_num = 0;
1173
1174 if (!edje_file)
1175 {
1176 ERR("%s: Error. No data to put in \"%s\"",
1177 progname, file_out);
1178 exit(-1);
1179 }
1180
1181 ef = eet_open(file_out, EET_FILE_MODE_WRITE);
1182 if (!ef)
1183 {
1184 ERR("%s: Error. Unable to open \"%s\" for writing output",
1185 progname, file_out);
1186 exit(-1);
1187 }
1188
1189 check_groups(ef);
1190
1191 total_bytes += data_write_header(ef);
1192 total_bytes += data_write_fonts(ef, &font_num, &input_bytes,
1193 &input_raw_bytes);
1194 total_bytes += data_write_images(ef, &image_num, &input_bytes,
1195 &input_raw_bytes);
1196 total_bytes += data_write_sounds(ef, &sound_num, &input_bytes,
1197 &input_raw_bytes);
1198
1199 total_bytes += data_write_groups(ef, &collection_num);
1200 data_write_scripts(ef);
1201 data_write_lua_scripts(ef);
1202
1203 src_bytes = source_append(ef);
1204 total_bytes += src_bytes;
1205 fmap_bytes = source_fontmap_save(ef, fonts);
1206 total_bytes += fmap_bytes;
1207
1208 eet_close(ef);
1209
1210 if (verbose)
1211 {
1212 struct stat st;
1213
1214 if (stat(file_in, &st) != 0)
1215 st.st_size = 0;
1216 input_bytes += st.st_size;
1217 input_raw_bytes += st.st_size;
1218 printf("Summary:\n"
1219 " Wrote %i collections\n"
1220 " Wrote %i images\n"
1221 " Wrote %i sounds\n"
1222 " Wrote %i fonts\n"
1223 " Wrote %i bytes (%iKb) of original source data\n"
1224 " Wrote %i bytes (%iKb) of original source font map\n"
1225 "Conservative compression summary:\n"
1226 " Wrote total %i bytes (%iKb) from %i (%iKb) input data\n"
1227 " Output file is %3.1f%% the size of the input data\n"
1228 " Saved %i bytes (%iKb)\n"
1229 "Raw compression summary:\n"
1230 " Wrote total %i bytes (%iKb) from %i (%iKb) raw input data\n"
1231 " Output file is %3.1f%% the size of the raw input data\n"
1232 " Saved %i bytes (%iKb)\n"
1233 ,
1234 collection_num,
1235 image_num,
1236 sound_num,
1237 font_num,
1238 src_bytes, (src_bytes + 512) / 1024,
1239 fmap_bytes, (fmap_bytes + 512) / 1024,
1240 total_bytes, (total_bytes + 512) / 1024,
1241 input_bytes, (input_bytes + 512) / 1024,
1242 (100.0 * (double)total_bytes) / (double)input_bytes,
1243 input_bytes - total_bytes,
1244 (input_bytes - total_bytes + 512) / 1024,
1245 total_bytes, (total_bytes + 512) / 1024,
1246 input_raw_bytes, (input_raw_bytes + 512) / 1024,
1247 (100.0 * (double)total_bytes) / (double)input_raw_bytes,
1248 input_raw_bytes - total_bytes,
1249 (input_raw_bytes - total_bytes + 512) / 1024);
1250 }
1251}
1252
1253void
1254reorder_parts(void)
1255{
1256 Edje_Part_Collection *pc;
1257 Edje_Part **parts;
1258 Edje_Part_Parser *ep, *ep2;
1259 Eina_List *l;
1260
1261 /* sanity checks for parts and programs */
1262 EINA_LIST_FOREACH(edje_collections, l, pc)
1263 {
1264 unsigned int i, j, k;
1265 Eina_Bool found = EINA_FALSE;
1266
1267 for (i = 0; i < pc->parts_count; i++)
1268 {
1269 ep = (Edje_Part_Parser *)pc->parts[i];
1270 if (ep->reorder.insert_before && ep->reorder.insert_after)
1271 ERR("%s: Error. Unable to use together insert_before and insert_after in part \"%s\".", progname, pc->parts[i]->name);
1272
1273 if (ep->reorder.done)
1274 {
1275 continue;
1276 }
1277 if (ep->reorder.insert_before || ep->reorder.insert_after)
1278 {
1279 found = EINA_FALSE;
1280 for (j = 0; j < pc->parts_count; j++)
1281 {
1282 if (ep->reorder.insert_before &&
1283 !strcmp(ep->reorder.insert_before, pc->parts[j]->name))
1284 {
1285 ep2 = (Edje_Part_Parser *)pc->parts[j];
1286 if (ep2->reorder.after)
1287 ERR("%s: Error. The part \"%s\" is ambiguous ordered part.", progname, pc->parts[i]->name);
1288 if (ep2->reorder.linked_prev)
1289 ERR("%s: Error. Unable to insert two or more parts in same part \"%s\".", progname, pc->parts[j]->name);
1290 k = j - 1;
1291 found = EINA_TRUE;
1292 ep2->reorder.linked_prev += ep->reorder.linked_prev + 1;
1293 ep->reorder.before = (Edje_Part_Parser *)pc->parts[j];
1294 while (ep2->reorder.before)
1295 {
1296 ep2->reorder.before->reorder.linked_prev = ep2->reorder.linked_prev + 1;
1297 ep2 = ep2->reorder.before;
1298 }
1299 break;
1300 }
1301 else if (ep->reorder.insert_after &&
1302 !strcmp(ep->reorder.insert_after, pc->parts[j]->name))
1303 {
1304 ep2 = (Edje_Part_Parser *)pc->parts[j];
1305 if (ep2->reorder.before)
1306 ERR("%s: Error. The part \"%s\" is ambiguous ordered part.", progname, pc->parts[i]->name);
1307 if (ep2->reorder.linked_next)
1308 ERR("%s: Error. Unable to insert two or more parts in same part \"%s\".", progname, pc->parts[j]->name);
1309 k = j;
1310 found = EINA_TRUE;
1311 ep2->reorder.linked_next += ep->reorder.linked_next + 1;
1312 ep->reorder.after = (Edje_Part_Parser *)pc->parts[j];
1313 while (ep2->reorder.after)
1314 {
1315 ep2->reorder.after->reorder.linked_next = ep2->reorder.linked_next + 1;
1316 ep2 = ep2->reorder.after;
1317 }
1318 break;
1319 }
1320 }
1321 if (found)
1322 {
1323 unsigned int amount, linked;
1324
1325 if (((i > k) && ((i - ep->reorder.linked_prev) <= k))
1326 || ((i < k) && ((i + ep->reorder.linked_next) >= k)))
1327 ERR("%s: Error. The part order is wrong. It has circular dependency.",
1328 progname);
1329
1330 amount = ep->reorder.linked_prev + ep->reorder.linked_next + 1;
1331 linked = i - ep->reorder.linked_prev;
1332 parts = malloc(amount * sizeof(Edje_Part));
1333 for (j = 0 ; j < amount ; j++)
1334 {
1335 parts[j] = pc->parts[linked];
1336 linked++;
1337 }
1338 if (i > k)
1339 {
1340 for (j = i - ep->reorder.linked_prev - 1 ; j >= k ; j--)
1341 {
1342 pc->parts[j + amount] = pc->parts[j];
1343 pc->parts[j + amount]->id = j + amount;
1344 }
1345 for (j = 0 ; j < amount ; j++)
1346 {
1347 pc->parts[j + k] = parts[j];
1348 pc->parts[j + k]->id = j + k;
1349 }
1350 }
1351 else if (i < k)
1352 {
1353 for (j = i + ep->reorder.linked_next + 1 ; j <= k ; j++)
1354 {
1355 pc->parts[j - amount] = pc->parts[j];
1356 pc->parts[j - amount]->id = j - amount;
1357 }
1358 for (j = 0 ; j < amount ; j++)
1359 {
1360 pc->parts[j + k - amount + 1] = parts[j];
1361 pc->parts[j + k - amount + 1]->id = j + k - amount + 1;
1362 }
1363 i -= amount;
1364 }
1365 ep->reorder.done = EINA_TRUE;
1366 free(parts);
1367 }
1368 }
1369 }
1370 }
1371}
1372
1373void
1374data_queue_group_lookup(char *name)
1375{
1376 Group_Lookup *gl;
1377
1378 gl = mem_alloc(SZ(Group_Lookup));
1379 group_lookups = eina_list_append(group_lookups, gl);
1380 gl->name = mem_strdup(name);
1381}
1382
1383void
1384data_queue_part_lookup(Edje_Part_Collection *pc, const char *name, int *dest)
1385{
1386 Eina_List *l;
1387 Part_Lookup *pl;
1388
1389 EINA_LIST_FOREACH(part_lookups, l, pl)
1390 {
1391 if ((pl->pc == pc) && (pl->dest == dest))
1392 {
1393 free(pl->name);
1394 if (name[0])
1395 pl->name = mem_strdup(name);
1396 else
1397 {
1398 part_lookups = eina_list_remove(part_lookups, pl);
1399 free(pl);
1400 }
1401 return;
1402 }
1403 }
1404 if (!name[0]) return;
1405
1406 pl = mem_alloc(SZ(Part_Lookup));
1407 part_lookups = eina_list_append(part_lookups, pl);
1408 pl->pc = pc;
1409 pl->name = mem_strdup(name);
1410 pl->dest = dest;
1411}
1412
1413void
1414data_queue_copied_part_lookup(Edje_Part_Collection *pc, int *src, int *dest)
1415{
1416 Eina_List *l;
1417 Part_Lookup *pl;
1418
1419 EINA_LIST_FOREACH(part_lookups, l, pl)
1420 {
1421 if (pl->dest == src)
1422 data_queue_part_lookup(pc, pl->name, dest);
1423 }
1424}
1425
1426void
1427data_queue_anonymous_lookup(Edje_Part_Collection *pc, Edje_Program *ep, int *dest)
1428{
1429 Eina_List *l, *l2;
1430 Program_Lookup *pl;
1431
1432 if (!ep) return ; /* FIXME: should we stop compiling ? */
1433
1434 EINA_LIST_FOREACH(program_lookups, l, pl)
1435 {
1436 if (pl->u.ep == ep)
1437 {
1438 Code *cd;
1439 Code_Program *cp;
1440
1441 cd = eina_list_data_get(eina_list_last(codes));
1442
1443 EINA_LIST_FOREACH(cd->programs, l2, cp)
1444 {
1445 if (&(cp->id) == pl->dest)
1446 {
1447 cd->programs = eina_list_remove(cd->programs, cp);
1448 free(cp);
1449 cp = NULL;
1450 }
1451 }
1452 program_lookups = eina_list_remove(program_lookups, pl);
1453 free(pl);
1454 }
1455 }
1456
1457 if (dest)
1458 {
1459 pl = mem_alloc(SZ(Program_Lookup));
1460 program_lookups = eina_list_append(program_lookups, pl);
1461 pl->pc = pc;
1462 pl->u.ep = ep;
1463 pl->dest = dest;
1464 pl->anonymous = EINA_TRUE;
1465 }
1466}
1467
1468void
1469data_queue_copied_anonymous_lookup(Edje_Part_Collection *pc, int *src, int *dest)
1470{
1471 Eina_List *l;
1472 Program_Lookup *pl;
1473 unsigned int i;
1474
1475 EINA_LIST_FOREACH(program_lookups, l, pl)
1476 {
1477 if (pl->dest == src)
1478 {
1479 for (i = 0 ; i < pc->programs.fnmatch_count ; i++)
1480 {
1481 if (!strcmp(pl->u.ep->name, pc->programs.fnmatch[i]->name))
1482 data_queue_anonymous_lookup(pc, pc->programs.fnmatch[i], dest);
1483 }
1484 for (i = 0 ; i < pc->programs.strcmp_count ; i++)
1485 {
1486 if (!strcmp(pl->u.ep->name, pc->programs.strcmp[i]->name))
1487 data_queue_anonymous_lookup(pc, pc->programs.strcmp[i], dest);
1488 }
1489 for (i = 0 ; i < pc->programs.strncmp_count ; i++)
1490 {
1491 if (!strcmp(pl->u.ep->name, pc->programs.strncmp[i]->name))
1492 data_queue_anonymous_lookup(pc, pc->programs.strncmp[i], dest);
1493 }
1494 for (i = 0 ; i < pc->programs.strrncmp_count ; i++)
1495 {
1496 if (!strcmp(pl->u.ep->name, pc->programs.strrncmp[i]->name))
1497 data_queue_anonymous_lookup(pc, pc->programs.strrncmp[i], dest);
1498 }
1499 for (i = 0 ; i < pc->programs.nocmp_count ; i++)
1500 {
1501 if (!strcmp(pl->u.ep->name, pc->programs.nocmp[i]->name))
1502 data_queue_anonymous_lookup(pc, pc->programs.nocmp[i], dest);
1503 }
1504 }
1505 }
1506}
1507
1508void
1509data_queue_program_lookup(Edje_Part_Collection *pc, const char *name, int *dest)
1510{
1511 Program_Lookup *pl;
1512
1513 if (!name) return ; /* FIXME: should we stop compiling ? */
1514
1515 pl = mem_alloc(SZ(Program_Lookup));
1516 program_lookups = eina_list_append(program_lookups, pl);
1517 pl->pc = pc;
1518 pl->u.name = mem_strdup(name);
1519 pl->dest = dest;
1520 pl->anonymous = EINA_FALSE;
1521}
1522
1523void
1524data_queue_copied_program_lookup(Edje_Part_Collection *pc, int *src, int *dest)
1525{
1526 Eina_List *l;
1527 Program_Lookup *pl;
1528
1529 EINA_LIST_FOREACH(program_lookups, l, pl)
1530 {
1531 if (pl->dest == src)
1532 data_queue_program_lookup(pc, pl->u.name, dest);
1533 }
1534}
1535
1536void
1537data_queue_image_lookup(char *name, int *dest, Eina_Bool *set)
1538{
1539 Image_Lookup *il;
1540
1541 il = mem_alloc(SZ(Image_Lookup));
1542 image_lookups = eina_list_append(image_lookups, il);
1543 il->name = mem_strdup(name);
1544 il->dest = dest;
1545 il->set = set;
1546}
1547
1548void
1549data_queue_copied_image_lookup(int *src, int *dest, Eina_Bool *set)
1550{
1551 Eina_List *l;
1552 Image_Lookup *il;
1553
1554 EINA_LIST_FOREACH(image_lookups, l, il)
1555 {
1556 if (il->dest == src)
1557 data_queue_image_lookup(il->name, dest, set);
1558 }
1559}
1560void
1561data_queue_part_slave_lookup(int *master, int *slave)
1562{
1563 Slave_Lookup *sl;
1564
1565 sl = mem_alloc(SZ(Slave_Lookup));
1566 part_slave_lookups = eina_list_append(part_slave_lookups, sl);
1567 sl->master = master;
1568 sl->slave = slave;
1569}
1570
1571void
1572data_queue_image_slave_lookup(int *master, int *slave)
1573{
1574 Slave_Lookup *sl;
1575
1576 sl = mem_alloc(SZ(Slave_Lookup));
1577 image_slave_lookups = eina_list_append(image_slave_lookups, sl);
1578 sl->master = master;
1579 sl->slave = slave;
1580}
1581
1582void
1583handle_slave_lookup(Eina_List *list, int *master, int value)
1584{
1585 Eina_List *l;
1586 Slave_Lookup *sl;
1587
1588 EINA_LIST_FOREACH(list, l, sl)
1589 if (sl->master == master)
1590 *sl->slave = value;
1591}
1592
1593void
1594data_process_lookups(void)
1595{
1596 Edje_Part_Collection *pc;
1597 Part_Lookup *part;
1598 Program_Lookup *program;
1599 Group_Lookup *group;
1600 Image_Lookup *image;
1601 Eina_List *l;
1602 void *data;
1603
1604 EINA_LIST_FOREACH(edje_collections, l, pc)
1605 {
1606 unsigned int count = 0;
1607 unsigned int i;
1608
1609#define PROGRAM_ID_SET(Type, Pc, It, Count) \
1610 for (It = 0; It < Pc->programs.Type ## _count; ++It) \
1611 { \
1612 Pc->programs.Type[It]->id = Count++; \
1613 }
1614
1615 PROGRAM_ID_SET(fnmatch, pc, i, count);
1616 PROGRAM_ID_SET(strcmp, pc, i, count);
1617 PROGRAM_ID_SET(strncmp, pc, i, count);
1618 PROGRAM_ID_SET(strrncmp, pc, i, count);
1619 PROGRAM_ID_SET(nocmp, pc, i, count);
1620
1621#undef PROGRAM_ID_SET
1622 }
1623
1624 EINA_LIST_FREE(part_lookups, part)
1625 {
1626 Edje_Part *ep;
1627 unsigned int i;
1628
1629 for (i = 0; i < part->pc->parts_count; ++i)
1630 {
1631 ep = part->pc->parts[i];
1632
1633 if ((ep->name) && (!strcmp(ep->name, part->name)))
1634 {
1635 handle_slave_lookup(part_slave_lookups, part->dest, ep->id);
1636 *(part->dest) = ep->id;
1637 break;
1638 }
1639 }
1640
1641 if (i == part->pc->parts_count)
1642 {
1643 ERR("%s: Error. Unable to find part name \"%s\".",
1644 progname, part->name);
1645 exit(-1);
1646 }
1647
1648 free(part->name);
1649 free(part);
1650 }
1651
1652 EINA_LIST_FREE(program_lookups, program)
1653 {
1654 unsigned int i;
1655 Eina_Bool find = EINA_FALSE;
1656
1657#define PROGRAM_MATCH(Type, Pl, It) \
1658 for (It = 0; It < Pl->pc->programs.Type ## _count; ++It) \
1659 { \
1660 Edje_Program *ep; \
1661 \
1662 ep = Pl->pc->programs.Type[It]; \
1663 \
1664 if ((Pl->anonymous && ep == Pl->u.ep) || \
1665 ((!Pl->anonymous) && (ep->name) && (!strcmp(ep->name, Pl->u.name)))) \
1666 { \
1667 *(Pl->dest) = ep->id; \
1668 find = EINA_TRUE; \
1669 break; \
1670 } \
1671 }
1672
1673 PROGRAM_MATCH(fnmatch, program, i);
1674 PROGRAM_MATCH(strcmp, program, i);
1675 PROGRAM_MATCH(strncmp, program, i);
1676 PROGRAM_MATCH(strrncmp, program, i);
1677 PROGRAM_MATCH(nocmp, program, i);
1678
1679#undef PROGRAM_MATCH
1680
1681 if (!find)
1682 {
1683 if (!program->anonymous)
1684 ERR("%s: Error. Unable to find program name \"%s\".",
1685 progname, program->u.name);
1686 else
1687 ERR("%s: Error. Unable to find anonymous program.",
1688 progname);
1689 exit(-1);
1690 }
1691
1692 if (!program->anonymous)
1693 free(program->u.name);
1694 free(program);
1695 }
1696
1697 EINA_LIST_FREE(group_lookups, group)
1698 {
1699 Edje_Part_Collection_Directory_Entry *de;
1700
1701 de = eina_hash_find(edje_file->collection, group->name);
1702
1703 if (!de)
1704 {
1705 ERR("%s: Error. Unable to find group name \"%s\".",
1706 progname, group->name);
1707 exit(-1);
1708 }
1709
1710 free(group->name);
1711 free(group);
1712 }
1713
1714 EINA_LIST_FREE(image_lookups, image)
1715 {
1716 Edje_Image_Directory_Entry *de;
1717 Eina_Bool find = EINA_FALSE;
1718
1719 if (edje_file->image_dir)
1720 {
1721 unsigned int i;
1722
1723 for (i = 0; i < edje_file->image_dir->entries_count; ++i)
1724 {
1725 de = edje_file->image_dir->entries + i;
1726
1727 if ((de->entry) && (!strcmp(de->entry, image->name)))
1728 {
1729 handle_slave_lookup(image_slave_lookups, image->dest, de->id);
1730 if (de->source_type == EDJE_IMAGE_SOURCE_TYPE_EXTERNAL)
1731 *(image->dest) = -de->id - 1;
1732 else
1733 *(image->dest) = de->id;
1734 *(image->set) = EINA_FALSE;
1735 find = EINA_TRUE;
1736 break;
1737 }
1738 }
1739
1740 if (!find)
1741 {
1742 Edje_Image_Directory_Set *set;
1743
1744 for (i = 0; i < edje_file->image_dir->sets_count; ++i)
1745 {
1746 set = edje_file->image_dir->sets + i;
1747
1748 if ((set->name) && (!strcmp(set->name, image->name)))
1749 {
1750 handle_slave_lookup(image_slave_lookups, image->dest, set->id);
1751 *(image->dest) = set->id;
1752 *(image->set) = EINA_TRUE;
1753 find = EINA_TRUE;
1754 break;
1755 }
1756 }
1757 }
1758 }
1759
1760 if (!find)
1761 {
1762 ERR("%s: Error. Unable to find image name \"%s\".",
1763 progname, image->name);
1764 exit(-1);
1765 }
1766
1767 free(image->name);
1768 free(image);
1769 }
1770
1771 EINA_LIST_FREE(part_slave_lookups, data)
1772 free(data);
1773
1774 EINA_LIST_FREE(image_slave_lookups, data)
1775 free(data);
1776}
1777
1778static void
1779data_process_string(Edje_Part_Collection *pc, const char *prefix, char *s, void (*func)(Edje_Part_Collection *pc, char *name, char* ptr, int len))
1780{
1781 char *p;
1782 char *key;
1783 int keyl;
1784 int quote, escape;
1785
1786 key = alloca(strlen(prefix) + 2 + 1);
1787 if (!key) return;
1788 strcpy(key, prefix);
1789 strcat(key, ":\"");
1790 keyl = strlen(key);
1791 quote = 0;
1792 escape = 0;
1793 for (p = s; (p) && (*p); p++)
1794 {
1795 if (!quote)
1796 {
1797 if (*p == '\"')
1798 {
1799 quote = 1;
1800 p++;
1801 }
1802 }
1803 if (!quote)
1804 {
1805 if (!strncmp(p, key, keyl))
1806 {
1807 char *ptr;
1808 int len;
1809 int inesc = 0;
1810 char *name;
1811
1812 ptr = p;
1813 p += keyl;
1814 while ((*p))
1815 {
1816 if (!inesc)
1817 {
1818 if (*p == '\\') inesc = 1;
1819 else if (*p == '\"')
1820 {
1821 /* string concatenation, see below */
1822 if (*(p + 1) != '\"')
1823 break;
1824 else
1825 p++;
1826 }
1827 }
1828 else
1829 inesc = 0;
1830 p++;
1831 }
1832 len = p - ptr + 1;
1833 name = alloca(len);
1834 if (name)
1835 {
1836 char *pp;
1837 int i;
1838
1839 name[0] = 0;
1840 pp = ptr + keyl;
1841 inesc = 0;
1842 i = 0;
1843 while (*pp)
1844 {
1845 if (!inesc)
1846 {
1847 if (*pp == '\\') inesc = 1;
1848 else if (*pp == '\"')
1849 {
1850 /* concat strings like "foo""bar" to "foobar" */
1851 if (*(pp + 1) == '\"')
1852 pp++;
1853 else
1854 {
1855 name[i] = 0;
1856 break;
1857 }
1858 }
1859 else
1860 {
1861 name[i] = *pp;
1862 name[i + 1] = 0;
1863 i++;
1864 }
1865 }
1866 else
1867 inesc = 0;
1868 pp++;
1869 }
1870 func(pc, name, ptr, len);
1871 }
1872 }
1873 }
1874 else
1875 {
1876 if (!escape)
1877 {
1878 if (*p == '\"') quote = 0;
1879 else if (*p == '\\') escape = 1;
1880 }
1881 else if (escape)
1882 {
1883 escape = 0;
1884 }
1885 }
1886 }
1887}
1888
1889static void
1890_data_queue_part_lookup(Edje_Part_Collection *pc, char *name, char *ptr, int len)
1891{
1892 Code_Lookup *cl;
1893 cl = mem_alloc(SZ(Code_Lookup));
1894 cl->ptr = ptr;
1895 cl->len = len;
1896
1897 data_queue_part_lookup(pc, name, &(cl->val));
1898
1899 code_lookups = eina_list_append(code_lookups, cl);
1900}
1901static void
1902_data_queue_program_lookup(Edje_Part_Collection *pc, char *name, char *ptr, int len)
1903{
1904 Code_Lookup *cl;
1905
1906 cl = mem_alloc(SZ(Code_Lookup));
1907 cl->ptr = ptr;
1908 cl->len = len;
1909
1910 data_queue_program_lookup(pc, name, &(cl->val));
1911
1912 code_lookups = eina_list_append(code_lookups, cl);
1913}
1914static void
1915_data_queue_group_lookup(Edje_Part_Collection *pc __UNUSED__, char *name, char *ptr __UNUSED__, int len __UNUSED__)
1916{
1917 data_queue_group_lookup(name);
1918}
1919static void
1920_data_queue_image_pc_lookup(Edje_Part_Collection *pc __UNUSED__, char *name, char *ptr, int len)
1921{
1922 Code_Lookup *cl;
1923
1924 cl = mem_alloc(SZ(Code_Lookup));
1925 cl->ptr = ptr;
1926 cl->len = len;
1927
1928 data_queue_image_lookup(name, &(cl->val), &(cl->set));
1929
1930 code_lookups = eina_list_append(code_lookups, cl);
1931}
1932
1933void
1934data_process_scripts(void)
1935{
1936 Eina_List *l, *l2;
1937
1938 for (l = codes, l2 = edje_collections; (l) && (l2); l = eina_list_next(l), l2 = eina_list_next(l2))
1939 {
1940 Edje_Part_Collection *pc;
1941 Code *cd;
1942
1943 cd = eina_list_data_get(l);
1944 pc = eina_list_data_get(l2);
1945
1946 if ((cd->shared) && (!cd->is_lua))
1947 {
1948 data_process_string(pc, "PART", cd->shared, _data_queue_part_lookup);
1949 data_process_string(pc, "PROGRAM", cd->shared, _data_queue_program_lookup);
1950 data_process_string(pc, "IMAGE", cd->shared, _data_queue_image_pc_lookup);
1951 data_process_string(pc, "GROUP", cd->shared, _data_queue_group_lookup);
1952 }
1953
1954 if (cd->programs)
1955 {
1956 Code_Program *cp;
1957 Eina_List *ll;
1958
1959 EINA_LIST_FOREACH(cd->programs, ll, cp)
1960 {
1961 if (cp->script)
1962 {
1963 data_process_string(pc, "PART", cp->script, _data_queue_part_lookup);
1964 data_process_string(pc, "PROGRAM", cp->script, _data_queue_program_lookup);
1965 data_process_string(pc, "IMAGE", cp->script, _data_queue_image_pc_lookup);
1966 data_process_string(pc, "GROUP", cp->script, _data_queue_group_lookup);
1967 }
1968 }
1969 }
1970 }
1971}
1972
1973void
1974data_process_script_lookups(void)
1975{
1976 Eina_List *l;
1977 Code_Lookup *cl;
1978
1979 EINA_LIST_FOREACH(code_lookups, l, cl)
1980 {
1981 char buf[12];
1982 int n;
1983
1984 /* FIXME !! Handle set in program */
1985 n = eina_convert_itoa(cl->val, buf);
1986 if (n > cl->len)
1987 {
1988 ERR("%s: Error. The unexpected happened. A numeric replacement string was larger than the original!",
1989 progname);
1990 exit(-1);
1991 }
1992 memset(cl->ptr, ' ', cl->len);
1993 strncpy(cl->ptr, buf, n);
1994 }
1995}
diff --git a/libraries/edje/src/bin/edje_cc_parse.c b/libraries/edje/src/bin/edje_cc_parse.c
new file mode 100644
index 0000000..ae68e00
--- /dev/null
+++ b/libraries/edje/src/bin/edje_cc_parse.c
@@ -0,0 +1,1552 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#ifdef HAVE_ALLOCA_H
6# include <alloca.h>
7#elif defined __GNUC__
8# define alloca __builtin_alloca
9#elif defined _AIX
10# define alloca __alloca
11#elif defined _MSC_VER
12# include <malloc.h>
13# define alloca _alloca
14#else
15# include <stddef.h>
16# ifdef __cplusplus
17extern "C"
18# endif
19void *alloca (size_t);
20#endif
21
22#include <string.h>
23#include <ctype.h>
24#include <limits.h>
25#include <errno.h>
26#include <sys/types.h>
27#include <sys/stat.h>
28#include <unistd.h>
29#include <fcntl.h>
30#include <math.h>
31
32#include "edje_cc.h"
33#include <Ecore.h>
34#include <Ecore_File.h>
35
36#ifdef _WIN32
37# define EPP_EXT ".exe"
38#else
39# define EPP_EXT
40#endif
41
42static void new_object(void);
43static void new_statement(void);
44static char *perform_math (char *input);
45static int isdelim(char c);
46static char *next_token(char *p, char *end, char **new_p, int *delim);
47static char *stack_id(void);
48static void stack_chop_top(void);
49static void parse(char *data, off_t size);
50
51/* simple expression parsing protos */
52static int my_atoi(const char * s);
53static char * _alphai(char *s, int * val);
54static char * _betai(char *s, int * val);
55static char * _gammai(char *s, int * val);
56static char * _deltai(char *s, int * val);
57static char * _get_numi(char *s, int * val);
58static int _is_numi(char c);
59static int _is_op1i(char c);
60static int _is_op2i(char c);
61static int _calci(char op, int a, int b);
62
63static double my_atof(const char * s);
64static char * _alphaf(char *s, double * val);
65static char * _betaf(char *s, double * val);
66static char * _gammaf(char *s, double * val);
67static char * _deltaf(char *s, double * val);
68static char * _get_numf(char *s, double * val);
69static int _is_numf(char c);
70static int _is_op1f(char c);
71static int _is_op2f(char c);
72static double _calcf(char op, double a, double b);
73static int strstrip(const char *in, char *out, size_t size);
74
75
76int line = 0;
77Eina_List *stack = NULL;
78Eina_List *params = NULL;
79
80static char file_buf[4096];
81static int verbatim = 0;
82static int verbatim_line1 = 0;
83static int verbatim_line2 = 0;
84static char *verbatim_str = NULL;
85
86static void
87err_show_stack(void)
88{
89 char *s;
90
91 s = stack_id();
92 if (s)
93 {
94 printf("PARSE STACK:\n%s\n", s);
95 free(s);
96 }
97 else
98 printf("NO PARSE STACK\n");
99}
100
101static void
102err_show_params(void)
103{
104 Eina_List *l;
105 char *p;
106
107 printf("PARAMS:");
108 EINA_LIST_FOREACH(params, l, p)
109 {
110 printf(" %s", p);
111 }
112 printf("\n");
113}
114
115static void
116err_show(void)
117{
118 err_show_stack();
119 err_show_params();
120}
121
122static void
123new_object(void)
124{
125 char *id;
126 int i;
127 int handled = 0;
128
129 id = stack_id();
130 for (i = 0; i < object_handler_num(); i++)
131 {
132 if (!strcmp(object_handlers[i].type, id))
133 {
134 handled = 1;
135 if (object_handlers[i].func)
136 {
137 object_handlers[i].func();
138 }
139 break;
140 }
141 }
142 if (!handled)
143 {
144 for (i = 0; i < statement_handler_num(); i++)
145 {
146 if (!strcmp(statement_handlers[i].type, id))
147 {
148 free(id);
149 return;
150 }
151 }
152 }
153 if (!handled)
154 {
155 ERR("%s: Error. %s:%i unhandled keyword %s",
156 progname, file_in, line - 1,
157 (char *)eina_list_data_get(eina_list_last(stack)));
158 err_show();
159 exit(-1);
160 }
161 free(id);
162}
163
164static void
165new_statement(void)
166{
167 char *id;
168 int i;
169 int handled = 0;
170
171 id = stack_id();
172 for (i = 0; i < statement_handler_num(); i++)
173 {
174 if (!strcmp(statement_handlers[i].type, id))
175 {
176 handled = 1;
177 if (statement_handlers[i].func)
178 {
179 statement_handlers[i].func();
180 }
181 break;
182 }
183 }
184 if (!handled)
185 {
186 ERR("%s: Error. %s:%i unhandled keyword %s",
187 progname, file_in, line - 1,
188 (char *)eina_list_data_get(eina_list_last(stack)));
189 err_show();
190 exit(-1);
191 }
192 free(id);
193}
194
195static char *
196perform_math (char *input)
197{
198 char buf[256];
199 double res;
200
201 /* FIXME
202 * Always apply floating-point arithmetic.
203 * Does this cause problems for integer parameters? (yes it will)
204 *
205 * What we should do is, loop over the string and figure out whether
206 * there are floating point operands, too and then switch to
207 * floating point math.
208 */
209 res = my_atof(input);
210 snprintf(buf, sizeof (buf), "%lf", res);
211 return strdup(buf);
212}
213
214static int
215isdelim(char c)
216{
217 const char *delims = "{},;:";
218 char *d;
219
220 d = (char *)delims;
221 while (*d)
222 {
223 if (c == *d) return 1;
224 d++;
225 }
226 return 0;
227}
228
229static char *
230next_token(char *p, char *end, char **new_p, int *delim)
231{
232 char *tok_start = NULL, *tok_end = NULL, *tok = NULL, *sa_start = NULL;
233 int in_tok = 0;
234 int in_quote = 0;
235 int in_parens = 0;
236 int in_comment_ss = 0;
237 int in_comment_cpp = 0;
238 int in_comment_sa = 0;
239 int had_quote = 0;
240 int is_escaped = 0;
241 char *cpp_token_line = NULL;
242 char *cpp_token_file = NULL;
243
244 *delim = 0;
245 if (p >= end) return NULL;
246 while (p < end)
247 {
248 if (*p == '\n')
249 {
250 in_comment_ss = 0;
251 in_comment_cpp = 0;
252 cpp_token_line = NULL;
253 cpp_token_file = NULL;
254 line++;
255 }
256 if ((!in_comment_ss) && (!in_comment_sa))
257 {
258 if ((!in_quote) && (*p == '/') && (p < (end - 1)) && (*(p + 1) == '/'))
259 in_comment_ss = 1;
260 if ((!in_quote) && (*p == '#'))
261 in_comment_cpp = 1;
262 if ((!in_quote) && (*p == '/') && (p < (end - 1)) && (*(p + 1) == '*'))
263 {
264 in_comment_sa = 1;
265 sa_start = p;
266 }
267 }
268 if ((in_comment_cpp) && (*p == '#'))
269 {
270 char *pp, fl[4096];
271 char *tmpstr = NULL;
272 int l, nm;
273
274 /* handle cpp comments */
275 /* their line format is
276 * #line <line no. of next line> <filename from next line on> [??]
277 */
278 cpp_token_line = NULL;
279 cpp_token_file = NULL;
280
281 pp = p;
282 while ((pp < end) && (*pp != '\n'))
283 {
284 pp++;
285 }
286 l = pp - p;
287 tmpstr = alloca(l + 1);
288 if (!tmpstr)
289 {
290 ERR("%s: Error. %s:%i malloc %i bytes failed",
291 progname, file_in, line - 1, l + 1);
292 exit(-1);
293 }
294 strncpy(tmpstr, p, l);
295 tmpstr[l] = 0;
296 l = sscanf(tmpstr, "%*s %i \"%[^\"]\"", &nm, fl);
297 if (l == 2)
298 {
299 strcpy(file_buf, fl);
300 line = nm;
301 file_in = file_buf;
302 }
303 }
304 else if ((!in_comment_ss) && (!in_comment_sa) && (!in_comment_cpp))
305 {
306 if (!in_tok)
307 {
308 if (!in_quote)
309 {
310 if (!isspace(*p))
311 {
312 if (*p == '"')
313 {
314 in_quote = 1;
315 had_quote = 1;
316 }
317 else if (*p == '(')
318 in_parens++;
319
320 in_tok = 1;
321 tok_start = p;
322 if (isdelim(*p)) *delim = 1;
323 }
324 }
325 }
326 else
327 {
328 if (in_quote)
329 {
330 if ((*p) == '\\')
331 is_escaped = !is_escaped;
332 else if (((*p) == '"') && (!is_escaped))
333 {
334 in_quote = 0;
335 had_quote = 1;
336 }
337 else if (is_escaped)
338 is_escaped = 0;
339 }
340 else if (in_parens)
341 {
342 if (((*p) == ')') && (!is_escaped))
343 in_parens--;
344 }
345 else
346 {
347 if (*p == '"')
348 {
349 in_quote = 1;
350 had_quote = 1;
351 }
352 else if (*p == '(')
353 in_parens++;
354
355 /* check for end-of-token */
356 if (
357 (isspace(*p)) ||
358 ((*delim) && (!isdelim(*p))) ||
359 (isdelim(*p))
360 )
361 {/*the line below this is never used because it skips to
362 * the 'done' label which is after the return call for
363 * in_tok being 0. is this intentional?
364 */
365 in_tok = 0;
366
367 tok_end = p - 1;
368 if (*p == '\n') line--;
369 goto done;
370 }
371 }
372 }
373 }
374 if (in_comment_sa)
375 {
376 if ((*p == '/') && (*(p - 1) == '*') && ((p - sa_start) > 2))
377 in_comment_sa = 0;
378 }
379 p++;
380 }
381 if (!in_tok) return NULL;
382 tok_end = p - 1;
383
384 done:
385 *new_p = p;
386
387 tok = mem_alloc(tok_end - tok_start + 2);
388 strncpy(tok, tok_start, tok_end - tok_start + 1);
389 tok[tok_end - tok_start + 1] = 0;
390
391 if (had_quote)
392 {
393 is_escaped = 0;
394 p = tok;
395
396 while (*p)
397 {
398 if ((*p == '\"') && (!is_escaped))
399 {
400 memmove(p, p + 1, strlen(p));
401 }
402 else if ((*p == '\\') && (*(p + 1) == 'n'))
403 {
404 memmove(p, p + 1, strlen(p));
405 *p = '\n';
406 }
407 else if ((*p == '\\') && (*(p + 1) == 't'))
408 {
409 memmove(p, p + 1, strlen(p));
410 *p = '\t';
411 }
412 else if (*p == '\\')
413 {
414 memmove(p, p + 1, strlen(p));
415 if (*p == '\\') p++;
416 else is_escaped = 1;
417 }
418 else
419 {
420 if (is_escaped) is_escaped = 0;
421 p++;
422 }
423 }
424 }
425 else if ((tok) && (*tok == '('))
426 {
427 char *tmp;
428 tmp = tok;
429 tok = perform_math(tok);
430 free(tmp);
431 }
432
433 return tok;
434}
435
436static char *
437stack_id(void)
438{
439 char *id;
440 int len;
441 Eina_List *l;
442 char *data;
443
444 len = 0;
445 EINA_LIST_FOREACH(stack, l, data)
446 len += strlen(data) + 1;
447 id = mem_alloc(len);
448 id[0] = 0;
449 EINA_LIST_FOREACH(stack, l, data)
450 {
451 strcat(id, data);
452 if (eina_list_next(l)) strcat(id, ".");
453 }
454 return id;
455}
456
457static void
458stack_chop_top(void)
459{
460 char *top;
461
462 /* remove top from stack */
463 top = eina_list_data_get(eina_list_last(stack));
464 if (top)
465 {
466 free(top);
467 stack = eina_list_remove(stack, top);
468 }
469 else
470 {
471 ERR("%s: Error. parse error %s:%i. } marker without matching { marker",
472 progname, file_in, line - 1);
473 err_show();
474 exit(-1);
475 }
476}
477
478static void
479parse(char *data, off_t size)
480{
481 char *p, *end, *token;
482 int delim = 0;
483 int do_params = 0;
484
485 if (verbose)
486 {
487 INF("%s: Parsing input file",
488 progname);
489 }
490 p = data;
491 end = data + size;
492 line = 1;
493 while ((token = next_token(p, end, &p, &delim)))
494 {
495 /* if we are in param mode, the only delimiter
496 * we'll accept is the semicolon
497 */
498 if (do_params && delim && *token != ';')
499 {
500 ERR("%s: Error. parse error %s:%i. %c marker before ; marker",
501 progname, file_in, line - 1, *token);
502 err_show();
503 exit(-1);
504 }
505 else if (delim)
506 {
507 if (*token == ',' || *token == ':') do_params = 1;
508 else if (*token == '}')
509 {
510 if (do_params)
511 {
512 ERR("%s: Error. parse error %s:%i. } marker before ; marker",
513 progname, file_in, line - 1);
514 err_show();
515 exit(-1);
516 }
517 else
518 stack_chop_top();
519 }
520 else if (*token == ';')
521 {
522 if (do_params)
523 {
524 do_params = 0;
525 new_statement();
526 /* clear out params */
527 while (params)
528 {
529 free(eina_list_data_get(params));
530 params = eina_list_remove(params, eina_list_data_get(params));
531 }
532 /* remove top from stack */
533 stack_chop_top();
534 }
535 }
536 else if (*token == '{')
537 {
538 if (do_params)
539 {
540 ERR("%s: Error. parse error %s:%i. { marker before ; marker",
541 progname, file_in, line - 1);
542 err_show();
543 exit(-1);
544 }
545 }
546 free(token);
547 }
548 else
549 {
550 if (do_params)
551 params = eina_list_append(params, token);
552 else
553 {
554 stack = eina_list_append(stack, token);
555 new_object();
556 if ((verbatim == 1) && (p < (end - 2)))
557 {
558 int escaped = 0;
559 int inquotes = 0;
560 int insquotes = 0;
561 int squigglie = 1;
562 int l1 = 0, l2 = 0;
563 char *verbatim_1;
564 char *verbatim_2;
565
566 l1 = line;
567 while ((p[0] != '{') && (p < end))
568 {
569 if (*p == '\n') line++;
570 p++;
571 }
572 p++;
573 verbatim_1 = p;
574 verbatim_2 = NULL;
575 for (; p < end; p++)
576 {
577 if (*p == '\n') line++;
578 if (escaped) escaped = 0;
579 if (!escaped)
580 {
581 if (p[0] == '\\') escaped = 1;
582 else if (p[0] == '\"')
583 {
584 if (!insquotes)
585 {
586 if (inquotes) inquotes = 0;
587 else inquotes = 1;
588 }
589 }
590 else if (p[0] == '\'')
591 {
592 if (!inquotes)
593 {
594 if (insquotes) insquotes = 0;
595 else insquotes = 1;
596 }
597 }
598 else if ((!inquotes) && (!insquotes))
599 {
600 if (p[0] == '{') squigglie++;
601 else if (p[0] == '}') squigglie--;
602 if (squigglie == 0)
603 {
604 verbatim_2 = p - 1;
605 l2 = line;
606 break;
607 }
608 }
609 }
610 }
611 if (verbatim_2 > verbatim_1)
612 {
613 int l;
614 char *v;
615
616 l = verbatim_2 - verbatim_1 + 1;
617 v = malloc(l + 1);
618 strncpy(v, verbatim_1, l);
619 v[l] = 0;
620 set_verbatim(v, l1, l2);
621 }
622 else
623 {
624 ERR("%s: Error. parse error %s:%i. { marker does not have matching } marker",
625 progname, file_in, line - 1);
626 err_show();
627 exit(-1);
628 }
629 new_object();
630 verbatim = 0;
631 }
632 }
633 }
634 }
635 if (verbose)
636 {
637 INF("%s: Parsing done",
638 progname);
639 }
640}
641
642static char *clean_file = NULL;
643static void
644clean_tmp_file(void)
645{
646 if (clean_file) unlink(clean_file);
647}
648
649int
650is_verbatim(void)
651{
652 return verbatim;
653}
654
655void
656track_verbatim(int on)
657{
658 verbatim = on;
659}
660
661void
662set_verbatim(char *s, int l1, int l2)
663{
664 verbatim_line1 = l1;
665 verbatim_line2 = l2;
666 verbatim_str = s;
667}
668
669char *
670get_verbatim(void)
671{
672 return verbatim_str;
673}
674
675int
676get_verbatim_line1(void)
677{
678 return verbatim_line1;
679}
680
681int
682get_verbatim_line2(void)
683{
684 return verbatim_line2;
685}
686
687void
688compile(void)
689{
690 char buf[4096], buf2[4096];
691 char inc[4096];
692 static char tmpn[4096];
693 int fd;
694 off_t size;
695 char *data, *p;
696 Eina_List *l;
697 Edje_Style *stl;
698
699 if (!tmp_dir)
700#ifdef HAVE_EVIL
701 tmp_dir = (char *)evil_tmpdir_get();
702#else
703 tmp_dir = "/tmp";
704#endif
705
706 strncpy(inc, file_in, 4000);
707 inc[4001] = 0;
708 p = strrchr(inc, '/');
709 if (!p) strcpy(inc, "./");
710 else *p = 0;
711 snprintf(tmpn, PATH_MAX, "%s/edje_cc.edc-tmp-XXXXXX", tmp_dir);
712 fd = mkstemp(tmpn);
713 if (fd >= 0)
714 {
715 int ret;
716 char *def;
717
718 clean_file = tmpn;
719 close(fd);
720 atexit(clean_tmp_file);
721 if (!defines)
722 def = mem_strdup("");
723 else
724 {
725 int len;
726 char *define;
727
728 len = 0;
729 EINA_LIST_FOREACH(defines, l, define)
730 len += strlen(define) + 1;
731 def = mem_alloc(len + 1);
732 def[0] = 0;
733 EINA_LIST_FOREACH(defines, l, define)
734 {
735 strcat(def, define);
736 strcat(def, " ");
737 }
738 }
739
740 /*
741 * Run the input through the C pre-processor.
742 */
743 ret = -1;
744 snprintf(buf2, sizeof(buf2), "%s/edje/utils/epp" EPP_EXT,
745 eina_prefix_lib_get(pfx));
746 if (ecore_file_exists(buf2))
747 {
748 snprintf(buf, sizeof(buf), "%s %s -I%s %s -o %s",
749 buf2, file_in, inc, def, tmpn);
750 ret = system(buf);
751 }
752 else
753 {
754 ERR("Error. Cannot run epp: %s", buf2);
755 exit(-1);
756 }
757 if (ret == EXIT_SUCCESS)
758 file_in = tmpn;
759 else
760 {
761 ERR("Error. Exit code of epp not clean: %i", ret);
762 exit(-1);
763 }
764 free(def);
765 }
766 fd = open(file_in, O_RDONLY | O_BINARY, S_IRUSR | S_IWUSR);
767 if (fd < 0)
768 {
769 ERR("%s: Error. cannot open file \"%s\" for input. %s",
770 progname, file_in, strerror(errno));
771 exit(-1);
772 }
773 if (verbose)
774 {
775 INF("%s: Opening \"%s\" for input", progname, file_in);
776 }
777
778 size = lseek(fd, 0, SEEK_END);
779 lseek(fd, 0, SEEK_SET);
780 data = malloc(size);
781 if (data && (read(fd, data, size) == size))
782 parse(data, size);
783 else
784 {
785 ERR("%s: Error. cannot read file \"%s\". %s",
786 progname, file_in, strerror(errno));
787 exit(-1);
788 }
789 free(data);
790 close(fd);
791
792 EINA_LIST_FOREACH(edje_file->styles, l, stl)
793 {
794 if (!stl->name)
795 {
796 ERR("%s: Error. style must have a name.", progname);
797 exit(-1);
798 }
799 }
800}
801
802int
803is_param(int n)
804{
805 char *str;
806
807 str = eina_list_nth(params, n);
808 if (str) return 1;
809 return 0;
810}
811
812int
813is_num(int n)
814{
815 char *str;
816 char *end;
817 long int ret;
818
819 str = eina_list_nth(params, n);
820 if (!str)
821 {
822 ERR("%s: Error. %s:%i no parameter supplied as argument %i",
823 progname, file_in, line - 1, n + 1);
824 err_show();
825 exit(-1);
826 }
827 if (str[0] == 0) return 0;
828 end = str;
829 ret = strtol(str, &end, 0);
830 if ((ret == LONG_MIN) || (ret == LONG_MAX))
831 {
832 n = 0; // do nothing. shut gcc warnings up
833 }
834 if ((end != str) && (end[0] == 0)) return 1;
835 return 0;
836}
837
838char *
839parse_str(int n)
840{
841 char *str;
842 char *s;
843
844 str = eina_list_nth(params, n);
845 if (!str)
846 {
847 ERR("%s: Error. %s:%i no parameter supplied as argument %i",
848 progname, file_in, line - 1, n + 1);
849 err_show();
850 exit(-1);
851 }
852 s = mem_strdup(str);
853 return s;
854}
855
856static int
857_parse_enum(char *str, va_list va)
858{
859 va_list va2;
860 va_copy(va2, va); /* iterator for the error message */
861
862 for (;;)
863 {
864 char *s;
865 int v;
866
867 s = va_arg(va, char *);
868
869 /* End of the list, nothing matched. */
870 if (!s)
871 {
872 fprintf(stderr, "%s: Error. %s:%i token %s not one of:",
873 progname, file_in, line - 1, str);
874 s = va_arg(va2, char *);
875 while (s)
876 {
877 va_arg(va2, int);
878 fprintf(stderr, " %s", s);
879 s = va_arg(va2, char *);
880 if (!s) break;
881 }
882 fprintf(stderr, "\n");
883 va_end(va2);
884 va_end(va);
885 err_show();
886 exit(-1);
887 }
888
889 v = va_arg(va, int);
890 if (!strcmp(s, str))
891 {
892 va_end(va2);
893 va_end(va);
894 return v;
895 }
896 }
897 va_end(va2);
898 va_end(va);
899 return 0;
900}
901
902int
903parse_enum(int n, ...)
904{
905 char *str;
906 int result;
907 va_list va;
908
909 str = eina_list_nth(params, n);
910 if (!str)
911 {
912 ERR("%s: Error. %s:%i no parameter supplied as argument %i",
913 progname, file_in, line - 1, n + 1);
914 err_show();
915 exit(-1);
916 }
917
918 va_start(va, n);
919 result = _parse_enum(str, va);
920 va_end(va);
921
922 return result;
923}
924
925int
926parse_flags(int n, ...)
927{
928 Eina_List *lst;
929 int result = 0;
930 va_list va;
931 char *data;
932
933 va_start(va, n);
934 EINA_LIST_FOREACH(eina_list_nth_list(params, n), lst, data)
935 result |= _parse_enum(data, va);
936 va_end(va);
937
938 return result;
939}
940
941int
942parse_int(int n)
943{
944 char *str;
945 int i;
946
947 str = eina_list_nth(params, n);
948 if (!str)
949 {
950 ERR("%s: Error. %s:%i no parameter supplied as argument %i",
951 progname, file_in, line - 1, n + 1);
952 err_show();
953 exit(-1);
954 }
955 i = my_atoi(str);
956 return i;
957}
958
959int
960parse_int_range(int n, int f, int t)
961{
962 char *str;
963 int i;
964
965 str = eina_list_nth(params, n);
966 if (!str)
967 {
968 ERR("%s: Error. %s:%i no parameter supplied as argument %i",
969 progname, file_in, line - 1, n + 1);
970 err_show();
971 exit(-1);
972 }
973 i = my_atoi(str);
974 if ((i < f) || (i > t))
975 {
976 ERR("%s: Error. %s:%i integer %i out of range of %i to %i inclusive",
977 progname, file_in, line - 1, i, f, t);
978 err_show();
979 exit(-1);
980 }
981 return i;
982}
983
984int
985parse_bool(int n)
986{
987 char *str, buf[4096];
988 int i;
989
990 str = eina_list_nth(params, n);
991 if (!str)
992 {
993 ERR("%s: Error. %s:%i no parameter supplied as argument %i",
994 progname, file_in, line - 1, n + 1);
995 err_show();
996 exit(-1);
997 }
998
999 if (!strstrip(str, buf, sizeof (buf)))
1000 {
1001 ERR("%s: Error. %s:%i expression is too long",
1002 progname, file_in, line - 1);
1003 return 0;
1004 }
1005
1006 if (!strcasecmp(buf, "false") || !strcasecmp(buf, "off"))
1007 return 0;
1008 if (!strcasecmp(buf, "true") || !strcasecmp(buf, "on"))
1009 return 1;
1010
1011 i = my_atoi(str);
1012 if ((i < 0) || (i > 1))
1013 {
1014 ERR("%s: Error. %s:%i integer %i out of range of 0 to 1 inclusive",
1015 progname, file_in, line - 1, i);
1016 err_show();
1017 exit(-1);
1018 }
1019 return i;
1020}
1021
1022double
1023parse_float(int n)
1024{
1025 char *str;
1026 double i;
1027
1028 str = eina_list_nth(params, n);
1029 if (!str)
1030 {
1031 ERR("%s: Error. %s:%i no parameter supplied as argument %i",
1032 progname, file_in, line - 1, n + 1);
1033 err_show();
1034 exit(-1);
1035 }
1036 i = my_atof(str);
1037 return i;
1038}
1039
1040double
1041parse_float_range(int n, double f, double t)
1042{
1043 char *str;
1044 double i;
1045
1046 str = eina_list_nth(params, n);
1047 if (!str)
1048 {
1049 ERR("%s: Error. %s:%i no parameter supplied as argument %i",
1050 progname, file_in, line - 1, n + 1);
1051 err_show();
1052 exit(-1);
1053 }
1054 i = my_atof(str);
1055 if ((i < f) || (i > t))
1056 {
1057 ERR("%s: Error. %s:%i float %3.3f out of range of %3.3f to %3.3f inclusive",
1058 progname, file_in, line - 1, i, f, t);
1059 err_show();
1060 exit(-1);
1061 }
1062 return i;
1063}
1064
1065int
1066get_arg_count(void)
1067{
1068 return eina_list_count (params);
1069}
1070
1071void
1072check_arg_count(int required_args)
1073{
1074 int num_args = eina_list_count (params);
1075
1076 if (num_args != required_args)
1077 {
1078 ERR("%s: Error. %s:%i got %i arguments, but expected %i",
1079 progname, file_in, line - 1, num_args, required_args);
1080 err_show();
1081 exit(-1);
1082 }
1083}
1084
1085void
1086check_min_arg_count(int min_required_args)
1087{
1088 int num_args = eina_list_count (params);
1089
1090 if (num_args < min_required_args)
1091 {
1092 ERR("%s: Error. %s:%i got %i arguments, "
1093 "but expected at least %i",
1094 progname, file_in, line - 1, num_args, min_required_args);
1095 err_show();
1096 exit(-1);
1097 }
1098}
1099
1100/* simple expression parsing stuff */
1101
1102/*
1103 * alpha ::= beta + beta || beta
1104 * beta ::= gamma + gamma || gamma
1105 * gamma ::= num || delta
1106 * delta ::= '(' alpha ')'
1107 *
1108 */
1109
1110/* int set of function */
1111
1112static int
1113my_atoi(const char *s)
1114{
1115 int res = 0;
1116 char buf[4096];
1117
1118 if (!s) return 0;
1119 if (!strstrip(s, buf, sizeof(buf)))
1120 {
1121 ERR("%s: Error. %s:%i expression is too long\n",
1122 progname, file_in, line - 1);
1123 return 0;
1124 }
1125 _alphai(buf, &res);
1126 return res;
1127}
1128
1129static char *
1130_deltai(char *s, int *val)
1131{
1132 if (!val) return NULL;
1133 if ('(' != s[0])
1134 {
1135 ERR("%s: Error. %s:%i unexpected character at %s\n",
1136 progname, file_in, line - 1, s);
1137 return s;
1138 }
1139 else
1140 {
1141 s++;
1142 s = _alphai(s, val);
1143 s++;
1144 return s;
1145 }
1146 return s;
1147}
1148
1149static char *
1150_funci(char *s, int *val)
1151{
1152 if (!strncmp(s, "floor(", 6))
1153 {
1154 s += 5;
1155 s = _deltai(s, val);
1156 *val = *val;
1157 }
1158 else if (!strncmp(s, "ceil(", 5))
1159 {
1160 s += 4;
1161 s = _deltai(s, val);
1162 *val = *val;
1163 }
1164 else
1165 {
1166 ERR("%s: Error. %s:%i unexpected character at %s\n",
1167 progname, file_in, line - 1, s);
1168 }
1169 return s;
1170}
1171
1172static char *
1173_gammai(char *s, int *val)
1174{
1175 if (!val) return NULL;
1176 if (_is_numi(s[0]))
1177 {
1178 s = _get_numi(s, val);
1179 return s;
1180 }
1181 else if ('(' == s[0])
1182 {
1183 s = _deltai(s, val);
1184 return s;
1185 }
1186 else
1187 {
1188 s = _funci(s, val);
1189// ERR("%s: Error. %s:%i unexpected character at %s\n",
1190// progname, file_in, line - 1, s);
1191 }
1192 return s;
1193}
1194
1195static char *
1196_betai(char *s, int *val)
1197{
1198 int a1, a2;
1199 char op;
1200
1201 if (!val) return NULL;
1202 s = _gammai(s, &a1);
1203 while (_is_op1i(s[0]))
1204 {
1205 op = s[0];
1206 s++;
1207 s = _gammai(s, &a2);
1208 a1 = _calci(op, a1, a2);
1209 }
1210 (*val) = a1;
1211 return s;
1212}
1213
1214static char *
1215_alphai(char *s, int *val)
1216{
1217 int a1, a2;
1218 char op;
1219
1220 if (!val) return NULL;
1221 s = _betai(s, &a1);
1222 while (_is_op2i(s[0]))
1223 {
1224 op = s[0];
1225 s++;
1226 s = _betai(s, &a2);
1227 a1 = _calci(op, a1, a2);
1228 }
1229 (*val) = a1;
1230 return s;
1231}
1232
1233char *
1234_get_numi(char *s, int *val)
1235{
1236 char buf[4096];
1237 int pos = 0;
1238
1239 if (!val) return s;
1240 while ((('0' <= s[pos]) && ('9' >= s[pos])) ||
1241 ((0 == pos) && ('-' == s[pos])))
1242 {
1243 buf[pos] = s[pos];
1244 pos++;
1245 }
1246 buf[pos] = '\0';
1247 (*val) = atoi(buf);
1248 return (s + pos);
1249}
1250
1251int
1252_is_numi(char c)
1253{
1254 if (((c >= '0') && (c <= '9')) || ('-' == c) || ('+' == c))
1255 return 1;
1256 else
1257 return 0;
1258}
1259
1260int
1261_is_op1i(char c)
1262{
1263 switch (c)
1264 {
1265 case '*':;
1266 case '%':;
1267 case '/': return 1;
1268 default: break;
1269 }
1270 return 0;
1271}
1272
1273int
1274_is_op2i(char c)
1275{
1276 switch (c)
1277 {
1278 case '+':;
1279 case '-': return 1;
1280 default: break;
1281 }
1282 return 0;
1283}
1284
1285int
1286_calci(char op, int a, int b)
1287{
1288 switch(op)
1289 {
1290 case '+':
1291 a += b;
1292 return a;
1293 case '-':
1294 a -= b;
1295 return a;
1296 case '/':
1297 if (0 != b) a /= b;
1298 else
1299 ERR("%s: Error. %s:%i divide by zero\n",
1300 progname, file_in, line - 1);
1301 return a;
1302 case '*':
1303 a *= b;
1304 return a;
1305 case '%':
1306 if (0 != b) a = a % b;
1307 else
1308 ERR("%s: Error. %s:%i modula by zero\n",
1309 progname, file_in, line - 1);
1310 return a;
1311 default:
1312 ERR("%s: Error. %s:%i unexpected character '%c'\n",
1313 progname, file_in, line - 1, op);
1314 }
1315 return a;
1316}
1317
1318/* float set of functoins */
1319
1320double
1321my_atof(const char *s)
1322{
1323 double res = 0;
1324 char buf[4096];
1325
1326 if (!s) return 0;
1327
1328 if (!strstrip(s, buf, sizeof (buf)))
1329 {
1330 ERR("%s: Error. %s:%i expression is too long",
1331 progname, file_in, line - 1);
1332 return 0;
1333 }
1334 _alphaf(buf, &res);
1335 return res;
1336}
1337
1338static char *
1339_deltaf(char *s, double *val)
1340{
1341 if (!val) return NULL;
1342 if ('(' != s[0])
1343 {
1344 ERR("%s: Error. %s:%i unexpected character at %s",
1345 progname, file_in, line - 1, s);
1346 return s;
1347 }
1348 else
1349 {
1350 s++;
1351 s = _alphaf(s, val);
1352 s++;
1353 }
1354 return s;
1355}
1356
1357static char *
1358_funcf(char *s, double *val)
1359{
1360 if (!strncmp(s, "floor(", 6))
1361 {
1362 s += 5;
1363 s = _deltaf(s, val);
1364 *val = floor(*val);
1365 }
1366 else if (!strncmp(s, "ceil(", 5))
1367 {
1368 s += 4;
1369 s = _deltaf(s, val);
1370 *val = ceil(*val);
1371 }
1372 else
1373 {
1374 ERR("%s: Error. %s:%i unexpected character at %s\n",
1375 progname, file_in, line - 1, s);
1376 }
1377 return s;
1378}
1379
1380static char *
1381_gammaf(char *s, double *val)
1382{
1383 if (!val) return NULL;
1384
1385 if (_is_numf(s[0]))
1386 {
1387 s = _get_numf(s, val);
1388 return s;
1389 }
1390 else if ('(' == s[0])
1391 {
1392 s = _deltaf(s, val);
1393 return s;
1394 }
1395 else
1396 {
1397 s = _funcf(s, val);
1398// ERR("%s: Error. %s:%i unexpected character at %s\n",
1399// progname, file_in, line - 1, s);
1400 }
1401 return s;
1402}
1403
1404static char *
1405_betaf(char *s, double *val)
1406{
1407 double a1=0, a2=0;
1408 char op;
1409
1410 if (!val) return NULL;
1411 s = _gammaf(s, &a1);
1412 while (_is_op1f(s[0]))
1413 {
1414 op = s[0];
1415 s++;
1416 s = _gammaf(s, &a2);
1417 a1 = _calcf(op, a1, a2);
1418 }
1419 (*val) = a1;
1420 return s;
1421}
1422
1423static char *
1424_alphaf(char *s, double *val)
1425{
1426 double a1=0, a2=0;
1427 char op;
1428
1429 if (!val) return NULL;
1430 s = _betaf(s, &a1);
1431 while (_is_op2f(s[0]))
1432 {
1433 op = s[0];
1434 s++;
1435 s = _betaf(s, &a2);
1436 a1 = _calcf(op, a1, a2);
1437 }
1438 (*val) = a1;
1439 return s;
1440}
1441
1442static char *
1443_get_numf(char *s, double *val)
1444{
1445 char buf[4096];
1446 int pos = 0;
1447
1448 if (!val) return s;
1449
1450 while ((('0' <= s[pos]) && ('9' >= s[pos])) ||
1451 ('.' == s[pos]) ||
1452 ((0 == pos) && ('-' == s[pos])))
1453 {
1454 buf[pos] = s[pos];
1455 pos++;
1456 }
1457 buf[pos] = '\0';
1458 (*val) = atof(buf);
1459 return (s+pos);
1460}
1461
1462static int
1463_is_numf(char c)
1464{
1465 if (((c >= '0') && (c <= '9'))
1466 || ('-' == c)
1467 || ('.' == c)
1468 || ('+' == c))
1469 return 1;
1470 return 0;
1471}
1472
1473static int
1474_is_op1f(char c)
1475{
1476 switch(c)
1477 {
1478 case '*':;
1479 case '%':;
1480 case '/': return 1;
1481 default: break;
1482 }
1483 return 0;
1484}
1485
1486static int
1487_is_op2f(char c)
1488{
1489 switch(c)
1490 {
1491 case '+':;
1492 case '-': return 1;
1493 default: break;
1494 }
1495 return 0;
1496}
1497
1498static double
1499_calcf(char op, double a, double b)
1500{
1501 switch(op)
1502 {
1503 case '+':
1504 a += b;
1505 return a;
1506 case '-':
1507 a -= b;
1508 return a;
1509 case '/':
1510 if (b != 0) a /= b;
1511 else
1512 ERR("%s: Error. %s:%i divide by zero\n",
1513 progname, file_in, line - 1);
1514 return a;
1515 case '*':
1516 a *= b;
1517 return a;
1518 case '%':
1519 if (0 != b) a = (double)((int)a % (int)b);
1520 else
1521 ERR("%s: Error. %s:%i modula by zero\n",
1522 progname, file_in, line - 1);
1523 return a;
1524 default:
1525 ERR("%s: Error. %s:%i unexpected character '%c'\n",
1526 progname, file_in, line - 1, op);
1527 }
1528 return a;
1529}
1530
1531static int
1532strstrip(const char *in, char *out, size_t size)
1533{
1534 if ((size -1 ) < strlen(in))
1535 {
1536 ERR("%s: Error. %s:%i expression is too long",
1537 progname, file_in, line - 1);
1538 return 0;
1539 }
1540 /* remove spaces and tabs */
1541 while (*in)
1542 {
1543 if ((0x20 != *in) && (0x09 != *in))
1544 {
1545 *out = *in;
1546 out++;
1547 }
1548 in++;
1549 }
1550 *out = '\0';
1551 return 1;
1552}
diff --git a/libraries/edje/src/bin/edje_cc_sources.c b/libraries/edje/src/bin/edje_cc_sources.c
new file mode 100644
index 0000000..d9cd0c1
--- /dev/null
+++ b/libraries/edje/src/bin/edje_cc_sources.c
@@ -0,0 +1,259 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <string.h>
6#include <ctype.h>
7#include <limits.h>
8
9#include "edje_cc.h"
10
11static Eet_Data_Descriptor *_srcfile_edd = NULL;
12static Eet_Data_Descriptor *_srcfile_list_edd = NULL;
13
14static Eet_Data_Descriptor *_external_edd = NULL;
15static Eet_Data_Descriptor *_external_list_edd = NULL;
16
17static Eet_Data_Descriptor *_font_edd = NULL;
18static Eet_Data_Descriptor *_font_list_edd = NULL;
19
20static SrcFile_List srcfiles = {NULL};
21
22void
23source_edd(void)
24{
25 Eet_Data_Descriptor_Class eddc;
26
27 eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "srcfile", sizeof (SrcFile));
28 _srcfile_edd = eet_data_descriptor_stream_new(&eddc);
29 EET_DATA_DESCRIPTOR_ADD_BASIC(_srcfile_edd, SrcFile, "name", name, EET_T_INLINED_STRING);
30 EET_DATA_DESCRIPTOR_ADD_BASIC(_srcfile_edd, SrcFile, "file", file, EET_T_INLINED_STRING);
31
32 eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "srcfile_list", sizeof (SrcFile_List));
33 _srcfile_list_edd = eet_data_descriptor_stream_new(&eddc);
34 EET_DATA_DESCRIPTOR_ADD_LIST(_srcfile_list_edd, SrcFile_List, "list", list, _srcfile_edd);
35
36 eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "external", sizeof (External));
37 _external_edd = eet_data_descriptor_stream_new(&eddc);
38 EET_DATA_DESCRIPTOR_ADD_BASIC(_external_edd, External, "name", name, EET_T_INLINED_STRING);
39
40 eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "external_list", sizeof (External_List));
41 _external_list_edd = eet_data_descriptor_stream_new(&eddc);
42 EET_DATA_DESCRIPTOR_ADD_LIST(_external_list_edd, External_List, "list", list, _external_edd);
43
44 eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "font", sizeof (Font));
45 _font_edd = eet_data_descriptor_stream_new(&eddc);
46 EET_DATA_DESCRIPTOR_ADD_BASIC(_font_edd, Font, "file", file, EET_T_INLINED_STRING);
47 EET_DATA_DESCRIPTOR_ADD_BASIC(_font_edd, Font, "name", name, EET_T_INLINED_STRING);
48
49 eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "font_list", sizeof (Font_List));
50 _font_list_edd = eet_data_descriptor_stream_new(&eddc);
51 EET_DATA_DESCRIPTOR_ADD_LIST(_font_list_edd, Font_List, "list", list, _font_edd);
52}
53
54static void source_fetch_file(const char *fil, const char *filname);
55
56static void
57source_fetch_file(const char *fil, const char *filname)
58{
59 FILE *f;
60 char buf[16 * 1024], *dir = NULL;
61 long sz;
62 size_t tmp;
63 ssize_t dir_len = 0;
64 SrcFile *sf;
65
66 f = fopen(fil, "rb");
67 if (!f)
68 {
69 ERR("%s: Warning. Cannot open file '%s'",
70 progname, fil);
71 exit(-1);
72 }
73
74 fseek(f, 0, SEEK_END);
75 sz = ftell(f);
76 fseek(f, 0, SEEK_SET);
77 sf = mem_alloc(SZ(SrcFile));
78 sf->name = mem_strdup(filname);
79 sf->file = mem_alloc(sz + 1);
80 if (sz > 0)
81 {
82 tmp = fread(sf->file, sz, 1, f);
83 if (tmp != 1)
84 {
85 ERR("%s: Warning file length for (%s) doesn't match !",
86 progname, filname);
87 exit(-1);
88 }
89 }
90
91 sf->file[sz] = '\0';
92 fseek(f, 0, SEEK_SET);
93 srcfiles.list = eina_list_append(srcfiles.list, sf);
94
95 while (fgets(buf, sizeof(buf), f))
96 {
97 char *p, *pp;
98 int got_hash = 0;
99 int forgetit = 0;
100 int haveinclude = 0;
101 char *file = NULL, *fname = NULL;
102
103 p = buf;
104 while ((!forgetit) && (*p))
105 {
106 if (!got_hash)
107 {
108 if (!isspace(*p))
109 {
110 if (*p == '#')
111 got_hash = 1;
112 else
113 forgetit = 1;
114 }
115 p++;
116 }
117
118 if (!haveinclude)
119 {
120 if (!isspace(*p))
121 {
122 if (!strncmp(p, "include", 7))
123 {
124 haveinclude = 1;
125 p += 7;
126 }
127 /* HACK! the logic above should be fixed so
128 * preprocessor statements don't have to begin
129 * in column 0.
130 * otoh, edje_cc should print a warning in that case,
131 * since according to the standard, preprocessor
132 * statements need to be put in column 0.
133 */
134 else if (!strncmp(p, "#include", 8))
135 {
136 haveinclude = 1;
137 p += 8;
138 }
139 else
140 forgetit = 1;
141 }
142 }
143 else
144 {
145 if (!isspace(*p))
146 {
147 char end = '\0';
148
149 if (*p == '"') end = '"';
150 else if (*p == '<') end = '>';
151
152 if (end)
153 {
154 pp = strchr(p + 1, end);
155 if (!pp)
156 forgetit = 1;
157 else
158 {
159 char *slash;
160 ssize_t l = 0;
161
162 /* get the directory of the current file
163 * if we haven't already done so
164 */
165 if ((!dir) && (strrchr(fil, '/')))
166 {
167 dir = mem_strdup(fil);
168 slash = strrchr(dir, '/');
169 *slash = '\0';
170 dir_len = strlen(dir);
171 }
172
173 l = pp - p + dir_len + 1;
174 file = mem_alloc(l);
175
176 if (!dir_len)
177 {
178 snprintf(file, l - 1, "%s", p + 1);
179 file[l - 2] = 0;
180 }
181 else
182 {
183 snprintf(file, l, "%s/%s", dir, p + 1);
184 file[l - 1] = 0;
185 }
186
187
188 fname = strdup(p + 1);
189 pp = strrchr(fname, end);
190 if (pp) *pp = 0;
191 forgetit = 1;
192 }
193 }
194 else
195 forgetit = 1;
196 }
197 else
198 p++;
199 }
200
201 got_hash = 0;
202 }
203 if ((file) && (fname))
204 {
205 source_fetch_file(file, fname);
206 free(file);
207 free(fname);
208 }
209 }
210 free(dir);
211 fclose(f);
212}
213
214void
215source_fetch(void)
216{
217 char buf[PATH_MAX] = {0}, *ptr;
218
219 ptr = strrchr(file_in, '/');
220 if (ptr)
221 {
222 snprintf(buf, sizeof (buf), "%s", ptr + 1);
223 }
224
225 source_fetch_file(file_in, buf[0] ? buf : file_in);
226}
227
228int
229source_append(Eet_File *ef)
230{
231 return eet_data_write(ef, _srcfile_list_edd, "edje_sources", &srcfiles, 1);
232}
233
234SrcFile_List *
235source_load(Eet_File *ef)
236{
237 SrcFile_List *s;
238
239 s = eet_data_read(ef, _srcfile_list_edd, "edje_sources");
240 return s;
241}
242
243int
244source_fontmap_save(Eet_File *ef, Eina_List *font_list)
245{
246 Font_List fl;
247
248 fl.list = font_list;
249 return eet_data_write(ef, _font_list_edd, "edje_source_fontmap", &fl, 1);
250}
251
252Font_List *
253source_fontmap_load(Eet_File *ef)
254{
255 Font_List *fl;
256
257 fl = eet_data_read(ef, _font_list_edd, "edje_source_fontmap");
258 return fl;
259}
diff --git a/libraries/edje/src/bin/edje_convert.c b/libraries/edje/src/bin/edje_convert.c
new file mode 100644
index 0000000..63d11ba
--- /dev/null
+++ b/libraries/edje/src/bin/edje_convert.c
@@ -0,0 +1,459 @@
1#include "edje_private.h"
2
3#include "edje_cc.h"
4#include "edje_convert.h"
5
6static const Edje_File *_current_edje_file = NULL;
7
8const Edje_File *
9_edje_file_get(void)
10{
11 return _current_edje_file;
12}
13
14void
15_edje_file_set(const Edje_File *edf)
16{
17 _current_edje_file = edf;
18}
19
20static Eina_Bool
21_edje_file_convert_external(Edje_File *edf, Old_Edje_File *oedf)
22{
23 Edje_External_Directory_Entry *ede;
24 unsigned int max;
25 unsigned int i = 0;
26
27 edf->external_dir = calloc(1, sizeof (Edje_External_Directory));
28 if (!edf->external_dir) return EINA_FALSE;
29 if (!oedf->external_dir) return EINA_TRUE;
30
31 max = eina_list_count(oedf->external_dir->entries);
32 edf->external_dir->entries = calloc(1, sizeof (Edje_External_Directory_Entry) * max);
33 edf->external_dir->entries_count = max;
34
35 if (!edf->external_dir->entries && max)
36 return EINA_FALSE;
37
38 EINA_LIST_FREE(oedf->external_dir->entries, ede)
39 {
40 edf->external_dir->entries[i++].entry = ede->entry;
41 free(ede);
42 }
43
44 free(oedf->external_dir);
45 oedf->external_dir = NULL;
46
47 return EINA_TRUE;
48}
49
50static Eina_Bool
51_edje_file_convert_images(Edje_File *edf, Old_Edje_File *oedf)
52{
53 Edje_Image_Directory_Entry *de;
54 Edje_Image_Directory_Set *ds;
55 Eina_List *l;
56 int max;
57
58 edf->image_dir = calloc(1, sizeof (Edje_Image_Directory));
59 if (!edf->image_dir) return EINA_FALSE;
60 if (!oedf->image_dir) return EINA_TRUE;
61
62 max = -1;
63 EINA_LIST_FOREACH(oedf->image_dir->entries, l, de)
64 if (max < de->id)
65 max = de->id;
66
67 edf->image_dir->entries = calloc(1, sizeof (Edje_Image_Directory_Entry) * (max + 1));
68 edf->image_dir->entries_count = max + 1;
69
70 if (!edf->image_dir->entries && edf->image_dir->entries_count)
71 return EINA_FALSE;
72
73 EINA_LIST_FREE(oedf->image_dir->entries, de)
74 {
75 memcpy(edf->image_dir->entries + de->id,
76 de,
77 sizeof (Edje_Image_Directory_Entry));
78 free(de);
79 }
80
81 max = -1;
82 EINA_LIST_FOREACH(oedf->image_dir->sets, l, ds)
83 if (max < ds->id)
84 max = ds->id;
85
86 edf->image_dir->sets = calloc(1, sizeof (Edje_Image_Directory_Set) * (max + 1));
87 edf->image_dir->sets_count = max + 1;
88
89 if (!edf->image_dir->sets && edf->image_dir->sets_count)
90 {
91 free(edf->image_dir->entries);
92 edf->image_dir->entries = NULL;
93 return EINA_FALSE;
94 }
95
96 EINA_LIST_FREE(oedf->image_dir->sets, ds)
97 {
98 memcpy(edf->image_dir->sets + ds->id,
99 ds,
100 sizeof (Edje_Image_Directory_Set));
101 free(ds);
102 }
103
104 return EINA_TRUE;
105}
106
107Edje_File *
108_edje_file_convert(Eet_File *ef, Old_Edje_File *oedf)
109{
110 Edje_Part_Collection_Directory_Entry *ce;
111 Edje_Font_Directory_Entry *fnt;
112 Edje_File *edf;
113 Eina_List *l;
114 Old_Edje_Data *ed;
115
116 if (oedf->version < 2) return NULL;
117
118 edf = calloc(1, sizeof (Edje_File));
119 if (!edf) return NULL;
120
121 edf->free_strings = 0;
122
123 edf->fonts = eina_hash_string_small_new(free);
124 edf->collection = eina_hash_string_small_new(free);
125 edf->data = eina_hash_string_small_new(free);
126
127 if (!edf->fonts || !edf->collection || !edf->data)
128 goto on_error;
129
130 EINA_LIST_FREE(oedf->data, ed)
131 {
132 Edje_String *es;
133
134 es = calloc(1, sizeof (Edje_String));
135 if (!es) continue;
136
137 es->str = ed->value;
138
139 eina_hash_direct_add(edf->data, ed->key, es);
140 free(ed);
141 }
142
143 EINA_LIST_FOREACH(oedf->collection_dir->entries, l, ce)
144 if (ce->entry)
145 eina_hash_direct_add(edf->collection, ce->entry, ce);
146 else
147 error_and_abort(ef, "Collection %i: name missing.\n", ce->id);
148
149 if (oedf->font_dir)
150 EINA_LIST_FOREACH(oedf->font_dir->entries, l, fnt)
151 eina_hash_direct_add(edf->fonts, fnt->entry, fnt);
152
153 if (!_edje_file_convert_images(edf, oedf))
154 goto on_error;
155
156 if (!_edje_file_convert_external(edf, oedf))
157 goto on_error;
158
159 edf->styles = oedf->styles;
160 edf->color_classes = oedf->color_classes;
161 edf->version = EDJE_FILE_VERSION;
162 edf->feature_ver = oedf->feature_ver;
163 edf->compiler = oedf->compiler;
164
165 edf->dangling = EINA_FALSE;
166 edf->warning = EINA_FALSE;
167
168 /* Below you will find all memory structure that could be cleaned when under
169 memory pressure */
170 edf->collection_cache = NULL;
171 edf->collection_patterns = NULL;
172
173 return edf;
174
175 on_error:
176 eina_hash_free(edf->fonts);
177 eina_hash_free(edf->collection);
178 eina_hash_free(edf->data);
179 free(edf->image_dir);
180 free(edf->external_dir);
181 free(edf);
182 return NULL;
183}
184
185static void
186_edje_collection_program_add(Edje_Program ***array,
187 unsigned int *count,
188 Edje_Program *add)
189{
190 Edje_Program **tmp;
191
192 tmp = realloc(*array, sizeof (Edje_Program*) * (*count + 1));
193 if (!tmp) return ;
194
195 tmp[(*count)++] = add;
196 *array = tmp;
197}
198
199Edje_Part_Collection *
200_edje_collection_convert(Eet_File *ef, Edje_Part_Collection_Directory_Entry *ce, Old_Edje_Part_Collection *oedc)
201{
202 Edje_Part_Collection *edc;
203 Old_Edje_Part *part;
204 Edje_Program *pg;
205 Old_Edje_Data *di;
206 Eina_List *l;
207 char *buffer;
208 unsigned int k;
209
210 oedc->part = ce->entry;
211
212 /* Count each type part and their respective state */
213 EINA_LIST_FOREACH(oedc->parts, l, part)
214 {
215 int *count;
216 int dummy = 0;
217
218
219 switch (part->type)
220 {
221#define CSP(Tp, Ce) \
222 case EDJE_PART_TYPE_##Tp : \
223 count = &Ce->count.Tp; \
224 break;
225
226 CSP(RECTANGLE, ce);
227 CSP(TEXT, ce);
228 CSP(IMAGE, ce);
229 CSP(SWALLOW, ce);
230 CSP(TEXTBLOCK, ce);
231 CSP(GROUP, ce);
232 CSP(BOX, ce);
233 CSP(TABLE, ce);
234 CSP(EXTERNAL, ce);
235 default:
236 count = &dummy;
237 break;
238 }
239
240 *count += eina_list_count(part->other_desc) + 1;
241 }
242 ce->count.part = eina_list_count(oedc->parts);
243
244#define CONVERT_EMN(Tp, Sz, Ce) \
245 buffer = alloca(strlen(ce->entry) + strlen(#Tp) + 2); \
246 sprintf(buffer, "%s/%s", ce->entry, #Tp); \
247 Ce->mp.Tp = eina_mempool_add("one_big", buffer, NULL, sizeof (Sz), Ce->count.Tp);
248
249 CONVERT_EMN(RECTANGLE, Edje_Part_Description_Common, ce);
250 CONVERT_EMN(TEXT, Edje_Part_Description_Text, ce);
251 CONVERT_EMN(IMAGE, Edje_Part_Description_Image, ce);
252 CONVERT_EMN(SWALLOW, Edje_Part_Description_Common, ce);
253 CONVERT_EMN(TEXTBLOCK, Edje_Part_Description_Text, ce);
254 CONVERT_EMN(GROUP, Edje_Part_Description_Common, ce);
255 CONVERT_EMN(BOX, Edje_Part_Description_Box, ce);
256 CONVERT_EMN(TABLE, Edje_Part_Description_Table, ce);
257 CONVERT_EMN(EXTERNAL, Edje_Part_Description_External, ce);
258 CONVERT_EMN(part, Edje_Part, ce);
259
260 /* Change structure layout */
261 edc = calloc(1, sizeof (Edje_Part_Collection));
262 if (!edc) error_and_abort(ef, "Not enough memory\n");
263 ce->ref = edc;
264
265 EINA_LIST_FREE(oedc->programs, pg)
266 {
267 if (!pg->signal && !pg->source)
268 _edje_collection_program_add(&edc->programs.nocmp,
269 &edc->programs.nocmp_count,
270 pg);
271 else if (pg->signal && !strpbrk(pg->signal, "*?[\\")
272 && pg->source && !strpbrk(pg->source, "*?[\\"))
273 _edje_collection_program_add(&edc->programs.strcmp,
274 &edc->programs.strcmp_count,
275 pg);
276 else if (pg->signal && edje_program_is_strncmp(pg->signal)
277 && pg->source && edje_program_is_strncmp(pg->source))
278 _edje_collection_program_add(&edc->programs.strncmp,
279 &edc->programs.strncmp_count,
280 pg);
281 else if (pg->signal && edje_program_is_strrncmp(pg->signal)
282 && pg->source && edje_program_is_strrncmp(pg->source))
283 _edje_collection_program_add(&edc->programs.strrncmp,
284 &edc->programs.strrncmp_count,
285 pg);
286 else
287 _edje_collection_program_add(&edc->programs.fnmatch,
288 &edc->programs.fnmatch_count,
289 pg);
290 }
291
292 edc->data = eina_hash_string_small_new(NULL);
293 EINA_LIST_FREE(oedc->data, di)
294 {
295 Edje_String *es;
296
297 es = calloc(1, sizeof (Edje_String));
298 if (!es) continue ;
299
300 es->str = di->value;
301
302 eina_hash_direct_add(edc->data, di->key, es);
303 free(di);
304 }
305
306 edc->parts_count = eina_list_count(oedc->parts);
307 edc->parts = calloc(edc->parts_count, sizeof (Edje_Part *));
308 if (edc->parts_count && !edc->parts)
309 error_and_abort(ef, "Not enough memory\n");
310 k = 0;
311
312 EINA_LIST_FREE(oedc->parts, part)
313 {
314 Old_Edje_Part_Description *oepd;
315 Edje_Pack_Element *elm;
316 Edje_Part *replacement;
317 unsigned int i;
318
319 replacement = eina_mempool_malloc(ce->mp.part, sizeof (Edje_Part));
320 if (!replacement)
321 error_and_abort(ef, "Not enough memory\n");
322
323 replacement->name = part->name;
324 replacement->default_desc = _edje_description_convert(part->type, ce, part->default_desc);
325
326 replacement->other.desc_count = eina_list_count(part->other_desc);
327 replacement->other.desc = calloc(replacement->other.desc_count, sizeof (Edje_Part_Description_Common*));
328
329 i = 0;
330 EINA_LIST_FREE(part->other_desc, oepd)
331 replacement->other.desc[i++] = _edje_description_convert(part->type, ce, oepd);
332
333 replacement->source = part->source;
334 replacement->source2 = part->source2;
335 replacement->source3 = part->source3;
336 replacement->source4 = part->source4;
337 replacement->source5 = part->source5;
338 replacement->source6 = part->source6;
339 replacement->id = part->id;
340 replacement->clip_to_id = part->clip_to_id;
341 replacement->dragable = part->dragable;
342 replacement->items_count = eina_list_count(part->items);
343 replacement->items = calloc(replacement->items_count, sizeof (Edje_Pack_Element*));
344
345 i = 0;
346 EINA_LIST_FREE(part->items, elm)
347 replacement->items[i++] = elm;
348
349 replacement->type = part->type;
350 replacement->effect = part->effect;
351 replacement->mouse_events = part->mouse_events;
352 replacement->repeat_events = part->repeat_events;
353 replacement->ignore_flags = part->ignore_flags;
354 replacement->scale = part->scale;
355 replacement->precise_is_inside = part->precise_is_inside;
356 replacement->use_alternate_font_metrics = part->use_alternate_font_metrics;
357 replacement->pointer_mode = part->pointer_mode;
358 replacement->entry_mode = part->entry_mode;
359 replacement->select_mode = part->select_mode;
360 replacement->multiline = part->multiline;
361 replacement->api = part->api;
362
363 edc->parts[k++] = replacement;
364
365 free(part);
366 }
367
368 edc->id = oedc->id;
369 edc->alias = oedc->alias;
370 edc->prop.min = oedc->prop.min;
371 edc->prop.max = oedc->prop.max;
372 edc->script = oedc->script;
373 edc->part = oedc->part;
374 edc->script_only = oedc->script_only;
375 edc->lua_script_only = oedc->lua_script_only;
376 edc->checked = oedc->checked;
377
378 free(oedc);
379
380 return edc;
381}
382
383Edje_Part_Description_Common*
384_edje_description_convert(int type,
385 Edje_Part_Collection_Directory_Entry *ce,
386 Old_Edje_Part_Description *oed)
387{
388 Edje_Part_Description_Common *result = NULL;
389
390 switch (type)
391 {
392 case EDJE_PART_TYPE_RECTANGLE:
393 result = eina_mempool_malloc(ce->mp.RECTANGLE,
394 sizeof (Edje_Part_Description_Common));
395 break;
396 case EDJE_PART_TYPE_SWALLOW:
397 result = eina_mempool_malloc(ce->mp.SWALLOW,
398 sizeof (Edje_Part_Description_Common));
399 break;
400 case EDJE_PART_TYPE_GROUP:
401 result = eina_mempool_malloc(ce->mp.GROUP,
402 sizeof (Edje_Part_Description_Common));
403 break;
404
405 case EDJE_PART_TYPE_IMAGE:
406 {
407 Edje_Part_Description_Image *img;
408 Edje_Part_Image_Id *id;
409 unsigned int i = 0;
410
411 img = eina_mempool_malloc(ce->mp.IMAGE, sizeof (Edje_Part_Description_Image));
412
413 img->image.tweens_count = eina_list_count(oed->image.tween_list);
414 img->image.tweens = calloc(img->image.tweens_count,
415 sizeof (Edje_Part_Image_Id*));
416 if (img->image.tweens_count > 0 && !img->image.tweens)
417 {
418 eina_mempool_free(ce->mp.IMAGE, img);
419 return NULL;
420 }
421
422 EINA_LIST_FREE(oed->image.tween_list, id)
423 img->image.tweens[i++] = id;
424
425 img->image.id = oed->image.id;
426 img->image.scale_hint = oed->image.scale_hint;
427 img->image.set = oed->image.set;
428
429 img->image.border = oed->image.border;
430 img->image.fill = oed->image.fill;
431
432 result = &img->common;
433 break;
434 }
435
436#define CONVERT_ALLOC_POOL(Short, Type, Name) \
437 case EDJE_PART_TYPE_##Short: \
438 { \
439 Edje_Part_Description_##Type *Name; \
440 \
441 Name = eina_mempool_malloc(ce->mp.Short, sizeof (Edje_Part_Description_##Type)); \
442 Name->Name = oed->Name; \
443 result = &Name->common; \
444 break; \
445 }
446
447 CONVERT_ALLOC_POOL(TEXT, Text, text);
448 CONVERT_ALLOC_POOL(TEXTBLOCK, Text, text);
449 CONVERT_ALLOC_POOL(BOX, Box, box);
450 CONVERT_ALLOC_POOL(TABLE, Table, table);
451 CONVERT_ALLOC_POOL(EXTERNAL, External, external_params);
452 }
453
454 if (result)
455 *result = oed->common;
456
457 free(oed);
458 return result;
459}
diff --git a/libraries/edje/src/bin/edje_convert.h b/libraries/edje/src/bin/edje_convert.h
new file mode 100644
index 0000000..0bbb38e
--- /dev/null
+++ b/libraries/edje/src/bin/edje_convert.h
@@ -0,0 +1,154 @@
1#ifndef EDJE_CONVERT_H__
2# define EDJE_CONVERT_H__
3
4
5typedef struct _Old_Edje_File Old_Edje_File;
6typedef struct _Old_Edje_Image_Directory Old_Edje_Image_Directory;
7typedef struct _Old_Edje_Font_Directory Old_Edje_Font_Directory;
8typedef struct _Old_Edje_External_Directory Old_Edje_External_Directory;
9typedef struct _Old_Edje_Part Old_Edje_Part;
10typedef struct _Old_Edje_Part_Collection Old_Edje_Part_Collection;
11typedef struct _Old_Edje_Part_Collection_Directory Old_Edje_Part_Collection_Directory;
12typedef struct _Old_Edje_Part_Description Old_Edje_Part_Description;
13typedef struct _Old_Edje_Part_Description_Spec_Image Old_Edje_Part_Description_Spec_Image;
14typedef struct _Old_Edje_Data Old_Edje_Data;
15
16struct _Old_Edje_Data
17{
18 const char *key;
19 char *value;
20};
21
22/*----------*/
23
24struct _Old_Edje_Font_Directory
25{
26 Eina_List *entries; /* a list of Edje_Font_Directory_Entry */
27};
28
29struct _Old_Edje_Image_Directory
30{
31 Eina_List *entries; /* a list of Edje_Image_Directory_Entry */
32 Eina_List *sets; /* a list of Edje_Image_Directory_Set */
33};
34
35struct _Old_Edje_External_Directory
36{
37 Eina_List *entries; /* a list of Edje_External_Directory_Entry */
38};
39
40struct _Old_Edje_File
41{
42 const char *path;
43 time_t mtime;
44
45 Old_Edje_External_Directory *external_dir;
46 Old_Edje_Font_Directory *font_dir;
47 Old_Edje_Image_Directory *image_dir;
48 Old_Edje_Part_Collection_Directory *collection_dir;
49 Eina_List *data;
50 Eina_List *styles;
51 Eina_List *color_classes;
52
53 const char *compiler;
54 int version;
55 int feature_ver;
56};
57
58struct _Old_Edje_Part_Collection
59{
60 Eina_List *programs; /* a list of Edje_Program */
61 Eina_List *parts; /* a list of Edje_Part */
62 Eina_List *data;
63
64 int id; /* the collection id */
65
66 Eina_Hash *alias; /* aliasing part*/
67
68 struct {
69 Edje_Size min, max;
70 } prop;
71
72 int references;
73#ifdef EDJE_PROGRAM_CACHE
74 struct {
75 Eina_Hash *no_matches;
76 Eina_Hash *matches;
77 } prog_cache;
78#endif
79
80 Embryo_Program *script; /* all the embryo script code for this group */
81 const char *part;
82
83 unsigned char script_only;
84
85 unsigned char lua_script_only;
86
87 unsigned char checked : 1;
88};
89
90struct _Old_Edje_Part
91{
92 const char *name; /* the name if any of the part */
93 Old_Edje_Part_Description *default_desc; /* the part descriptor for default */
94 Eina_List *other_desc; /* other possible descriptors */
95 const char *source, *source2, *source3, *source4, *source5, *source6;
96 int id; /* its id number */
97 int clip_to_id; /* the part id to clip this one to */
98 Edje_Part_Dragable dragable;
99 Eina_List *items; /* packed items for box and table */
100 unsigned char type; /* what type (image, rect, text) */
101 unsigned char effect; /* 0 = plain... */
102 unsigned char mouse_events; /* it will affect/respond to mouse events */
103 unsigned char repeat_events; /* it will repeat events to objects below */
104 Evas_Event_Flags ignore_flags;
105 unsigned char scale; /* should certain properties scale with edje scale factor? */
106 unsigned char precise_is_inside;
107 unsigned char use_alternate_font_metrics;
108 unsigned char pointer_mode;
109 unsigned char entry_mode;
110 unsigned char select_mode;
111 unsigned char multiline;
112 Edje_Part_Api api;
113};
114
115struct _Old_Edje_Part_Description_Spec_Image
116{
117 Eina_List *tween_list; /* list of Edje_Part_Image_Id */
118 int id; /* the image id to use */
119 int scale_hint; /* evas scale hint */
120 Eina_Bool set; /* if image condition it's content */
121
122 Edje_Part_Description_Spec_Border border;
123 Edje_Part_Description_Spec_Fill fill;
124};
125
126struct _Old_Edje_Part_Description
127{
128 Edje_Part_Description_Common common;
129 Old_Edje_Part_Description_Spec_Image image;
130 Edje_Part_Description_Spec_Text text;
131 Edje_Part_Description_Spec_Box box;
132 Edje_Part_Description_Spec_Table table;
133
134 Eina_List *external_params; /* parameters for external objects */
135};
136
137struct _Old_Edje_Part_Collection_Directory
138{
139 Eina_List *entries; /* a list of Edje_Part_Collection_Directory_Entry */
140
141 int references;
142};
143
144Edje_File *_edje_file_convert(Eet_File *ef, Old_Edje_File *oedf);
145Edje_Part_Collection *_edje_collection_convert(Eet_File *ef,
146 Edje_Part_Collection_Directory_Entry *ce,
147 Old_Edje_Part_Collection *oedc);
148Edje_Part_Description_Common *_edje_description_convert(int type,
149 Edje_Part_Collection_Directory_Entry *ce,
150 Old_Edje_Part_Description *oed);
151const Edje_File *_edje_file_get(void);
152void _edje_file_set(const Edje_File *edf);
153
154#endif
diff --git a/libraries/edje/src/bin/edje_data_convert.c b/libraries/edje/src/bin/edje_data_convert.c
new file mode 100644
index 0000000..5fb129e
--- /dev/null
+++ b/libraries/edje/src/bin/edje_data_convert.c
@@ -0,0 +1,451 @@
1#include "edje_private.h"
2#include "edje_convert.h"
3
4Eet_Data_Descriptor *_edje_edd_old_edje_file = NULL;
5Eet_Data_Descriptor *_edje_edd_old_edje_style = NULL;
6Eet_Data_Descriptor *_edje_edd_old_edje_style_tag = NULL;
7Eet_Data_Descriptor *_edje_edd_old_edje_color_class = NULL;
8Eet_Data_Descriptor *_edje_edd_old_edje_data = NULL;
9Eet_Data_Descriptor *_edje_edd_old_edje_external_directory = NULL;
10Eet_Data_Descriptor *_edje_edd_old_edje_external_directory_entry = NULL;
11Eet_Data_Descriptor *_edje_edd_old_edje_font_directory = NULL;
12Eet_Data_Descriptor *_edje_edd_old_edje_font_directory_entry = NULL;
13Eet_Data_Descriptor *_edje_edd_old_edje_image_directory = NULL;
14Eet_Data_Descriptor *_edje_edd_old_edje_image_directory_entry = NULL;
15Eet_Data_Descriptor *_edje_edd_old_edje_image_directory_set = NULL;
16Eet_Data_Descriptor *_edje_edd_old_edje_image_directory_set_entry = NULL;
17Eet_Data_Descriptor *_edje_edd_old_edje_program = NULL;
18Eet_Data_Descriptor *_edje_edd_old_edje_program_target = NULL;
19Eet_Data_Descriptor *_edje_edd_old_edje_program_after = NULL;
20Eet_Data_Descriptor *_edje_edd_old_edje_part_collection_directory = NULL;
21Eet_Data_Descriptor *_edje_edd_old_edje_part_collection_directory_entry = NULL;
22Eet_Data_Descriptor *_edje_edd_old_edje_pack_element = NULL;
23Eet_Data_Descriptor *_edje_edd_old_edje_part_collection = NULL;
24Eet_Data_Descriptor *_edje_edd_old_edje_part = NULL;
25Eet_Data_Descriptor *_edje_edd_old_edje_part_description = NULL;
26Eet_Data_Descriptor *_edje_edd_old_edje_part_image_id = NULL;
27Eet_Data_Descriptor *_edje_edd_old_edje_external_param = NULL;
28
29#define FREED(eed) \
30 if (eed) \
31 { \
32 eet_data_descriptor_free((eed)); \
33 (eed) = NULL; \
34 }
35
36void
37_edje_edd_old_shutdown(void)
38{
39 FREED(_edje_edd_old_edje_file);
40 FREED(_edje_edd_old_edje_style);
41 FREED(_edje_edd_old_edje_style_tag);
42 FREED(_edje_edd_old_edje_color_class);
43 FREED(_edje_edd_old_edje_data);
44 FREED(_edje_edd_old_edje_external_directory);
45 FREED(_edje_edd_old_edje_external_directory_entry);
46 FREED(_edje_edd_old_edje_font_directory);
47 FREED(_edje_edd_old_edje_font_directory_entry);
48 FREED(_edje_edd_old_edje_image_directory);
49 FREED(_edje_edd_old_edje_image_directory_entry);
50 FREED(_edje_edd_old_edje_program);
51 FREED(_edje_edd_old_edje_program_target);
52 FREED(_edje_edd_old_edje_program_after);
53 FREED(_edje_edd_old_edje_part_collection_directory);
54 FREED(_edje_edd_old_edje_part_collection_directory_entry);
55 FREED(_edje_edd_old_edje_pack_element);
56 FREED(_edje_edd_old_edje_part_collection);
57 FREED(_edje_edd_old_edje_part);
58 FREED(_edje_edd_old_edje_part_description);
59 FREED(_edje_edd_old_edje_part_image_id);
60 FREED(_edje_edd_old_edje_external_param);
61 FREED(_edje_edd_old_edje_image_directory_set);
62 FREED(_edje_edd_old_edje_image_directory_set_entry);
63}
64
65void
66_edje_edd_old_init(void)
67{
68 Eet_Data_Descriptor_Class eddc;
69
70 /* external directory */
71 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_External_Directory_Entry);
72 _edje_edd_old_edje_external_directory_entry =
73 eet_data_descriptor_file_new(&eddc);
74 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_external_directory_entry, Edje_External_Directory_Entry, "entry", entry, EET_T_STRING);
75
76 eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
77 "Edje_External_Directory",
78 sizeof (Old_Edje_External_Directory));
79 _edje_edd_old_edje_external_directory =
80 eet_data_descriptor_file_new(&eddc);
81 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_external_directory, Edje_External_Directory, "entries", entries, _edje_edd_old_edje_external_directory_entry);
82
83 /* font directory */
84 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Font_Directory_Entry);
85 _edje_edd_old_edje_font_directory_entry =
86 eet_data_descriptor_file_new(&eddc);
87 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_font_directory_entry, Edje_Font_Directory_Entry, "entry", entry, EET_T_STRING);
88 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_font_directory_entry, Edje_Font_Directory_Entry, "file", file, EET_T_STRING);
89
90 eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
91 "Edje_Font_Directory",
92 sizeof (Old_Edje_Font_Directory));
93 _edje_edd_old_edje_font_directory =
94 eet_data_descriptor_file_new(&eddc);
95 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_font_directory, Old_Edje_Font_Directory, "entries", entries, _edje_edd_old_edje_font_directory_entry);
96
97 /* image directory */
98 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Image_Directory_Entry);
99 _edje_edd_old_edje_image_directory_entry =
100 eet_data_descriptor_file_new(&eddc);
101 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_entry, Edje_Image_Directory_Entry, "entry", entry, EET_T_STRING);
102 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_entry, Edje_Image_Directory_Entry, "source_type", source_type, EET_T_INT);
103 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_entry, Edje_Image_Directory_Entry, "source_param", source_param, EET_T_INT);
104 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_entry, Edje_Image_Directory_Entry, "id", id, EET_T_INT);
105
106 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Image_Directory_Set_Entry);
107 _edje_edd_old_edje_image_directory_set_entry =
108 eet_data_descriptor_file_new(&eddc);
109 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "name", name, EET_T_STRING);
110 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "id", id, EET_T_INT);
111 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "min.w", size.min.w, EET_T_INT);
112 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "min.h", size.min.h, EET_T_INT);
113 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "max.w", size.max.w, EET_T_INT);
114 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "max.h", size.max.h, EET_T_INT);
115
116 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Image_Directory_Set);
117 _edje_edd_old_edje_image_directory_set =
118 eet_data_descriptor_file_new(&eddc);
119 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_set, Edje_Image_Directory_Set, "name", name, EET_T_STRING);
120 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_set, Edje_Image_Directory_Set, "id", id, EET_T_INT);
121 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_image_directory_set, Edje_Image_Directory_Set, "entries", entries, _edje_edd_old_edje_image_directory_set_entry);
122
123 eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
124 "Edje_Image_Directory",
125 sizeof (Old_Edje_Image_Directory));
126 _edje_edd_old_edje_image_directory =
127 eet_data_descriptor_file_new(&eddc);
128 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_image_directory, Old_Edje_Image_Directory, "entries", entries, _edje_edd_old_edje_image_directory_entry);
129 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_image_directory, Old_Edje_Image_Directory, "sets", sets, _edje_edd_old_edje_image_directory_set);
130
131 /* collection directory */
132 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Collection_Directory_Entry);
133 _edje_edd_old_edje_part_collection_directory_entry =
134 eet_data_descriptor_file_new(&eddc);
135 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "entry", entry, EET_T_STRING);
136 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "id", id, EET_T_INT);
137
138 eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
139 "Edje_Part_Collection_Directory",
140 sizeof (Old_Edje_Part_Collection_Directory));
141 _edje_edd_old_edje_part_collection_directory =
142 eet_data_descriptor_file_new(&eddc);
143 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part_collection_directory, Old_Edje_Part_Collection_Directory, "entries", entries, _edje_edd_old_edje_part_collection_directory_entry);
144
145 /* generic data attachment */
146 eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
147 "Edje_Data", sizeof (Old_Edje_Data));
148 _edje_edd_old_edje_data =
149 eet_data_descriptor_file_new(&eddc);
150 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_data, Old_Edje_Data, "key", key, EET_T_STRING);
151 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_data, Old_Edje_Data, "value", value, EET_T_STRING);
152
153 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Style_Tag);
154 _edje_edd_old_edje_style_tag =
155 eet_data_descriptor_file_new(&eddc);
156 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_style_tag, Edje_Style_Tag, "key", key, EET_T_STRING);
157 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_style_tag, Edje_Style_Tag, "value", value, EET_T_STRING);
158
159 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Style);
160 _edje_edd_old_edje_style =
161 eet_data_descriptor_file_new(&eddc);
162 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_style, Edje_Style, "name", name, EET_T_STRING);
163 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_style, Edje_Style, "tags", tags, _edje_edd_old_edje_style_tag);
164
165 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Color_Class);
166 _edje_edd_old_edje_color_class =
167 eet_data_descriptor_file_new(&eddc);
168 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "name", name, EET_T_STRING);
169 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "r", r, EET_T_UCHAR);
170 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "g", g, EET_T_UCHAR);
171 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "b", b, EET_T_UCHAR);
172 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "a", a, EET_T_UCHAR);
173 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "r2", r2, EET_T_UCHAR);
174 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "g2", g2, EET_T_UCHAR);
175 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "b2", b2, EET_T_UCHAR);
176 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "a2", a2, EET_T_UCHAR);
177 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "r3", r3, EET_T_UCHAR);
178 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "g3", g3, EET_T_UCHAR);
179 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "b3", b3, EET_T_UCHAR);
180 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "a3", a3, EET_T_UCHAR);
181
182 /* the main file directory */
183 eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
184 "Edje_File", sizeof (Old_Edje_File));
185 _edje_edd_old_edje_file =
186 eet_data_descriptor_file_new(&eddc);
187 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_file, Old_Edje_File, "compiler", compiler, EET_T_STRING);
188 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_file, Old_Edje_File, "version", version, EET_T_INT);
189 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_file, Old_Edje_File, "feature_ver", feature_ver, EET_T_INT);
190 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_old_edje_file, Old_Edje_File, "external_dir", external_dir, _edje_edd_old_edje_external_directory);
191 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_old_edje_file, Old_Edje_File, "font_dir", font_dir, _edje_edd_old_edje_font_directory);
192 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_old_edje_file, Old_Edje_File, "image_dir", image_dir, _edje_edd_old_edje_image_directory);
193 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_old_edje_file, Old_Edje_File, "collection_dir", collection_dir, _edje_edd_old_edje_part_collection_directory);
194 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_file, Old_Edje_File, "data", data, _edje_edd_old_edje_data);
195 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_file, Old_Edje_File, "styles", styles, _edje_edd_old_edje_style);
196 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_file, Old_Edje_File, "color_classes", color_classes, _edje_edd_old_edje_color_class);
197
198 /* parts & programs - loaded induvidually */
199 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Program_Target);
200 _edje_edd_old_edje_program_target =
201 eet_data_descriptor_file_new(&eddc);
202 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program_target, Edje_Program_Target, "id", id, EET_T_INT);
203
204 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Program_After);
205 _edje_edd_old_edje_program_after =
206 eet_data_descriptor_file_new(&eddc);
207 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program_after,
208 Edje_Program_After, "id", id, EET_T_INT);
209
210 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Program);
211 _edje_edd_old_edje_program =
212 eet_data_descriptor_file_new(&eddc);
213 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "id", id, EET_T_INT);
214 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "name", name, EET_T_STRING);
215 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "signal", signal, EET_T_STRING);
216 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "source", source, EET_T_STRING);
217 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "filter_part", filter.part, EET_T_STRING);
218 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "filter_state", filter.state, EET_T_STRING);
219 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "in.from", in.from, EET_T_DOUBLE);
220 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "in.range", in.range, EET_T_DOUBLE);
221 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "action", action, EET_T_INT);
222 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "state", state, EET_T_STRING);
223 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "state2", state2, EET_T_STRING);
224 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "value", value, EET_T_DOUBLE);
225 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "value2", value2, EET_T_DOUBLE);
226 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "tween.mode", tween.mode, EET_T_INT);
227 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "tween.time", tween.time, EDJE_T_FLOAT);
228 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_program, Edje_Program, "targets", targets, _edje_edd_old_edje_program_target);
229 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_program, Edje_Program, "after", after, _edje_edd_old_edje_program_after);
230 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "api.name", api.name, EET_T_STRING);
231 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "api.description", api.description, EET_T_STRING);
232
233 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "param.src", param.src, EET_T_INT);
234 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "param.dst", param.dst, EET_T_INT);
235
236 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Image_Id);
237 _edje_edd_old_edje_part_image_id =
238 eet_data_descriptor_file_new(&eddc);
239 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_image_id, Edje_Part_Image_Id, "id", id, EET_T_INT);
240 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_image_id, Edje_Part_Image_Id, "set", set, EET_T_UCHAR);
241
242 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_External_Param);
243 _edje_edd_old_edje_external_param =
244 eet_data_descriptor_file_new(&eddc);
245 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_external_param, Edje_External_Param, "name", name, EET_T_STRING);
246 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_external_param, Edje_External_Param, "type", type, EET_T_INT);
247 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_external_param, Edje_External_Param, "i", i, EET_T_INT);
248 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_external_param, Edje_External_Param, "d", d, EET_T_DOUBLE);
249 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_external_param, Edje_External_Param, "s", s, EET_T_STRING);
250
251 eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc), "Edje_Part_Description", sizeof (Old_Edje_Part_Description));
252 _edje_edd_old_edje_part_description =
253 eet_data_descriptor_file_new(&eddc);
254 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "state.name", common.state.name, EET_T_STRING);
255 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "state.value", common.state.value, EET_T_DOUBLE);
256 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "visible", common.visible, EET_T_CHAR);
257 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "align.x", common.align.x, EDJE_T_FLOAT);
258 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "align.y", common.align.y, EDJE_T_FLOAT);
259 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fixed.w", common.fixed.w, EET_T_UCHAR);
260 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fixed.h", common.fixed.h, EET_T_UCHAR);
261 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "min.w", common.min.w, EET_T_INT);
262 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "min.h", common.min.h, EET_T_INT);
263 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "max.w", common.max.w, EET_T_INT);
264 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "max.h", common.max.h, EET_T_INT);
265 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "step.x", common.step.x, EET_T_INT);
266 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "step.y", common.step.y, EET_T_INT);
267 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "aspect.min", common.aspect.min, EDJE_T_FLOAT);
268 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "aspect.max", common.aspect.max, EDJE_T_FLOAT);
269 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "aspect.prefer", common.aspect.prefer, EET_T_CHAR);
270 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel1.relative_x", common.rel1.relative_x, EDJE_T_FLOAT);
271 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel1.relative_y", common.rel1.relative_y, EDJE_T_FLOAT);
272 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel1.offset_x", common.rel1.offset_x, EET_T_INT);
273 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel1.offset_y", common.rel1.offset_y, EET_T_INT);
274 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel1.id_x", common.rel1.id_x, EET_T_INT);
275 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel1.id_y", common.rel1.id_y, EET_T_INT);
276 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel2.relative_x", common.rel2.relative_x, EDJE_T_FLOAT);
277 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel2.relative_y", common.rel2.relative_y, EDJE_T_FLOAT);
278 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel2.offset_x", common.rel2.offset_x, EET_T_INT);
279 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel2.offset_y", common.rel2.offset_y, EET_T_INT);
280 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel2.id_x", common.rel2.id_x, EET_T_INT);
281 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel2.id_y", common.rel2.id_y, EET_T_INT);
282 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "image.id", image.id, EET_T_INT);
283 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "image.set", image.set, EET_T_UCHAR);
284 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "image.tween_list", image.tween_list, _edje_edd_old_edje_part_image_id);
285
286 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "border.l", image.border.l, EET_T_INT);
287 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "border.r", image.border.r, EET_T_INT);
288 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "border.t", image.border.t, EET_T_INT);
289 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "border.b", image.border.b, EET_T_INT);
290 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "border.no_fill", image.border.no_fill, EET_T_UCHAR);
291 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "border.scale", image.border.scale, EET_T_UCHAR);
292 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.smooth", image.fill.smooth, EET_T_CHAR);
293 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.pos_rel_x", image.fill.pos_rel_x, EDJE_T_FLOAT);
294 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.pos_abs_x", image.fill.pos_abs_x, EET_T_INT);
295 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.rel_x", image.fill.rel_x, EDJE_T_FLOAT);
296 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.abs_x", image.fill.abs_x, EET_T_INT);
297 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.pos_rel_y", image.fill.pos_rel_y, EDJE_T_FLOAT);
298 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.pos_abs_y", image.fill.pos_abs_y, EET_T_INT);
299 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.rel_y", image.fill.rel_y, EDJE_T_FLOAT);
300 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.abs_y", image.fill.abs_y, EET_T_INT);
301 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.angle", image.fill.angle, EET_T_INT);
302 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.spread", image.fill.spread, EET_T_INT);
303 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.type", image.fill.type, EET_T_CHAR);
304 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color_class", common.color_class, EET_T_STRING);
305 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color.r", common.color.r, EET_T_UCHAR);
306 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color.g", common.color.g, EET_T_UCHAR);
307 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color.b", common.color.b, EET_T_UCHAR);
308 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color.a", common.color.a, EET_T_UCHAR);
309 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color2.r", common.color2.r, EET_T_UCHAR);
310 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color2.g", common.color2.g, EET_T_UCHAR);
311 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color2.b", common.color2.b, EET_T_UCHAR);
312 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color2.a", common.color2.a, EET_T_UCHAR);
313 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color3.r", text.color3.r, EET_T_UCHAR);
314 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color3.g", text.color3.g, EET_T_UCHAR);
315 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color3.b", text.color3.b, EET_T_UCHAR);
316 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color3.a", text.color3.a, EET_T_UCHAR);
317 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.text", text.text.str, EET_T_STRING);
318 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.text_class", text.text_class, EET_T_STRING);
319 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.style", text.style.str, EET_T_STRING);
320 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.font", text.font.str, EET_T_STRING);
321 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.repch", text.repch.str, EET_T_STRING);
322 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.size", text.size, EET_T_INT);
323 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.fit_x", text.fit_x, EET_T_UCHAR);
324 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.fit_y", text.fit_y, EET_T_UCHAR);
325 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.min_x", text.min_x, EET_T_UCHAR);
326 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.min_y", text.min_y, EET_T_UCHAR);
327 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.max_x", text.max_x, EET_T_UCHAR);
328 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.max_y", text.max_y, EET_T_UCHAR);
329 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.align.x", text.align.x, EDJE_T_FLOAT);
330 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.align.y", text.align.y, EDJE_T_FLOAT);
331 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.id_source", text.id_source, EET_T_INT);
332 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.id_text_source", text.id_text_source, EET_T_INT);
333 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.elipsis", text.elipsis, EET_T_DOUBLE);
334 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "box.layout", box.layout, EET_T_STRING);
335 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "box.alt_layout", box.alt_layout, EET_T_STRING);
336 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "box.align.x", box.align.x, EDJE_T_FLOAT);
337 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "box.align.y", box.align.y, EDJE_T_FLOAT);
338 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "box.padding.x", box.padding.x, EET_T_INT);
339 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "box.padding.y", box.padding.y, EET_T_INT);
340 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "box.min.h", box.min.h, EET_T_UCHAR);
341 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "box.min.v", box.min.v, EET_T_UCHAR);
342 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "table.homogeneous", table.homogeneous, EET_T_UCHAR);
343 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "table.align.x", table.align.x, EDJE_T_FLOAT);
344 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "table.align.y", table.align.y, EDJE_T_FLOAT);
345 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "table.padding.x", table.padding.x, EET_T_INT);
346 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "table.padding.y", table.padding.y, EET_T_INT);
347 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "map.id_persp", common.map.id_persp, EET_T_INT);
348 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "map.id_light", common.map.id_light, EET_T_INT);
349 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "map.rot.id_center", common.map.rot.id_center, EET_T_INT);
350 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "map.rot.x", common.map.rot.x, EDJE_T_FLOAT);
351 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "map.rot.y", common.map.rot.y, EDJE_T_FLOAT);
352 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "map.rot.z", common.map.rot.z, EDJE_T_FLOAT);
353 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "map.on", common.map.on, EET_T_UCHAR);
354 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "map.smooth", common.map.smooth, EET_T_UCHAR);
355 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "map.alpha", common.map.alpha, EET_T_UCHAR);
356 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "map.persp_on", common.map.persp_on, EET_T_UCHAR);
357 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "map.backcull", common.map.backcull, EET_T_UCHAR);
358 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "persp.zplane", common.persp.zplane, EET_T_INT);
359 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "persp.focal", common.persp.focal, EET_T_INT);
360 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "external_params", external_params, _edje_edd_old_edje_external_param);
361
362 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Pack_Element);
363 _edje_edd_old_edje_pack_element =
364 eet_data_descriptor_file_new(&eddc);
365 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "type", type, EET_T_UCHAR);
366 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "name", name, EET_T_STRING);
367 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "source", source, EET_T_STRING);
368 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "min.w", min.w, EET_T_INT);
369 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "min.h", min.h, EET_T_INT);
370 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "prefer.w", prefer.w, EET_T_INT);
371 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "prefer.h", prefer.h, EET_T_INT);
372 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "max.w", max.w, EET_T_INT);
373 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "max.h", max.h, EET_T_INT);
374 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "padding.l", padding.l, EET_T_INT);
375 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "padding.r", padding.r, EET_T_INT);
376 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "padding.t", padding.t, EET_T_INT);
377 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "padding.b", padding.b, EET_T_INT);
378 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "align.x", align.x, EDJE_T_FLOAT);
379 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "align.y", align.y, EDJE_T_FLOAT);
380 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "weight.x", weight.x, EDJE_T_FLOAT);
381 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "weight.y", weight.y, EDJE_T_FLOAT);
382 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "aspect.w", aspect.w, EET_T_INT);
383 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "aspect.h", aspect.h, EET_T_INT);
384 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "aspect.mode", aspect.mode, EET_T_UCHAR);
385 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "options", options, EET_T_STRING);
386 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "col", col, EET_T_INT);
387 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "row", row, EET_T_INT);
388 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "colspan", colspan, EET_T_USHORT);
389 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "rowspan", rowspan, EET_T_USHORT);
390
391 eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc), "Edje_Part", sizeof (Old_Edje_Part));
392 _edje_edd_old_edje_part =
393 eet_data_descriptor_file_new(&eddc);
394 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "name", name, EET_T_STRING);
395 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "id", id, EET_T_INT);
396 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "type", type, EET_T_UCHAR);
397 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "effect", effect, EET_T_UCHAR);
398 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "mouse_events", mouse_events, EET_T_UCHAR);
399 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "repeat_events", repeat_events, EET_T_UCHAR);
400 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "ignore_flags", ignore_flags, EET_T_INT);
401 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "scale", scale, EET_T_UCHAR);
402 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "pointer_mode", pointer_mode, EET_T_UCHAR);
403 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "precise_is_inside", precise_is_inside, EET_T_UCHAR);
404 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "clip_to_id", clip_to_id, EET_T_INT);
405 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "use_alternate_font_metrics", use_alternate_font_metrics, EET_T_UCHAR);
406 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_old_edje_part, Old_Edje_Part, "default_desc", default_desc, _edje_edd_old_edje_part_description);
407 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part, Old_Edje_Part, "other_desc", other_desc, _edje_edd_old_edje_part_description);
408 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "dragable.x", dragable.x, EET_T_CHAR);
409 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "dragable.step_x", dragable.step_x, EET_T_INT);
410 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "dragable.count_x", dragable.count_x, EET_T_INT);
411 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "dragable.y", dragable.y, EET_T_CHAR);
412 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "dragable.step_y", dragable.step_y, EET_T_INT);
413 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "dragable.count_y", dragable.count_y, EET_T_INT);
414 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "dragable.counfine_id", dragable.confine_id, EET_T_INT);
415 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "dragable.events_id", dragable.event_id, EET_T_INT);
416 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "entry_mode", entry_mode, EET_T_UCHAR);
417 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "select_mode", select_mode, EET_T_UCHAR);
418 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "multiline", multiline, EET_T_UCHAR);
419 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source", source, EET_T_STRING);
420 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source2", source2, EET_T_STRING);
421 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source3", source3, EET_T_STRING);
422 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source4", source4, EET_T_STRING);
423 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source5", source5, EET_T_STRING);
424 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source6", source6, EET_T_STRING);
425 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part, Old_Edje_Part, "items", items, _edje_edd_old_edje_pack_element);
426 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "api.name", api.name, EET_T_STRING);
427 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "api.description", api.description, EET_T_STRING);
428
429 eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc), "Edje_Part_Collection", sizeof (Old_Edje_Part_Collection));
430 _edje_edd_old_edje_part_collection =
431 eet_data_descriptor_file_new(&eddc);
432 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "programs", programs, _edje_edd_old_edje_program);
433 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "parts", parts, _edje_edd_old_edje_part);
434 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "data", data, _edje_edd_old_edje_data);
435 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "prop.min.w", prop.min.w, EET_T_INT);
436 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "prop.min.h", prop.min.h, EET_T_INT);
437 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "prop.max.w", prop.max.w, EET_T_INT);
438 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "prop.max.h", prop.max.h, EET_T_INT);
439 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "id", id, EET_T_INT);
440 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "script_only", script_only, EET_T_UCHAR);
441 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "lua_script_only", lua_script_only, EET_T_UCHAR);
442
443 {
444 Old_Edje_Part_Collection epc;
445
446 eet_data_descriptor_element_add(_edje_edd_old_edje_part_collection,
447 "alias", EET_T_STRING, EET_G_HASH,
448 (char *)(&(epc.alias)) - (char *)(&(epc)),
449 0, /* 0, */NULL, NULL);
450 }
451}
diff --git a/libraries/edje/src/bin/edje_decc.c b/libraries/edje/src/bin/edje_decc.c
new file mode 100644
index 0000000..1b79e13
--- /dev/null
+++ b/libraries/edje/src/bin/edje_decc.c
@@ -0,0 +1,472 @@
1/* ugly ugly. avert your eyes. */
2
3#ifdef HAVE_CONFIG_H
4# include <config.h>
5#endif
6
7#include <string.h>
8#include <ctype.h>
9#include <unistd.h>
10#include <locale.h>
11#include <sys/types.h>
12#include <sys/stat.h>
13#include <errno.h>
14
15
16#include <Ecore_File.h>
17#include <Ecore_Evas.h>
18
19#include "edje_decc.h"
20
21int _edje_cc_log_dom = -1;
22char *progname = NULL;
23char *file_in = NULL;
24char *file_out = NULL;
25
26Edje_File *edje_file = NULL;
27SrcFile_List *srcfiles = NULL;
28Font_List *fontlist = NULL;
29
30int line = 0;
31int build_sh = 1;
32int new_dir = 1;
33
34int decomp(void);
35void output(void);
36static int compiler_cmd_is_sane();
37static int root_filename_is_sane();
38
39static void
40main_help(void)
41{
42 printf
43 ("Usage:\n"
44 "\t%s input_file.edj [-main-out file.edc] [-no-build-sh] [-current-dir]\n"
45 "\n"
46 " -main-out\tCreate a symbolic link to the main edc \n"
47 " -no-build-sh\tDon't output build.sh \n"
48 " -current-dir\tOutput to current directory \n"
49 "\n"
50 ,progname);
51}
52
53Eet_File *ef;
54Eet_Dictionary *ed;
55
56int
57main(int argc, char **argv)
58{
59 int i;
60
61 setlocale(LC_NUMERIC, "C");
62 if (!eina_init())
63 exit(-1);
64 _edje_cc_log_dom = eina_log_domain_register
65 ("edje_decc", EDJE_CC_DEFAULT_LOG_COLOR);
66 if (_edje_cc_log_dom < 0)
67 {
68 EINA_LOG_ERR("Impossible to create a log domain.");
69 eina_shutdown();
70 exit(-1);
71 }
72 eina_log_level_set(EINA_LOG_LEVEL_INFO);
73 progname = argv[0];
74 for (i = 1; i < argc; i++)
75 {
76 if (!strcmp(argv[i], "-h"))
77 {
78 main_help();
79 exit(0);
80 }
81 if (!file_in)
82 file_in = argv[i];
83 else if ((!strcmp(argv[i], "-main-out")) && (i < (argc - 1)))
84 {
85 i++;
86 file_out = argv[i];
87 }
88 else if (!strcmp(argv[i], "-no-build-sh"))
89 build_sh = 0;
90 else if (!strcmp(argv[i], "-current-dir"))
91 new_dir = 0;
92 }
93 if (!file_in)
94 {
95 ERR("%s: Error: no input file specified.", progname);
96 main_help();
97 exit(-1);
98 }
99
100 if (!edje_init())
101 exit(-1);
102 source_edd();
103
104 if (!decomp()) return -1;
105 output();
106
107 printf("WARNING! If any Image or audio data was encoded in a LOSSY way, then\n"
108 "re-encoding will drop quality even more. You need access to the original\n"
109 "data to ensure no loss of quality.\n");
110 eet_close(ef);
111 edje_shutdown();
112 eina_log_domain_unregister(_edje_cc_log_dom);
113 _edje_cc_log_dom = -1;
114 eina_shutdown();
115 return 0;
116}
117
118int
119decomp(void)
120{
121 ef = eet_open(file_in, EET_FILE_MODE_READ);
122 if (!ef)
123 {
124 ERR("ERROR: cannot open %s", file_in);
125 return 0;
126 }
127
128 srcfiles = source_load(ef);
129 if (!srcfiles || !srcfiles->list)
130 {
131 ERR("ERROR: %s has no decompile information", file_in);
132 eet_close(ef);
133 return 0;
134 }
135 if (!eina_list_data_get(srcfiles->list) || !root_filename_is_sane())
136 {
137 ERR("ERROR: Invalid root filename: '%s'", (char *) eina_list_data_get(srcfiles->list));
138 eet_close(ef);
139 return 0;
140 }
141 edje_file = eet_data_read(ef, _edje_edd_edje_file, "edje/file");
142 if (!edje_file)
143 {
144 ERR("ERROR: %s does not appear to be an edje file", file_in);
145 eet_close(ef);
146 return 0;
147 }
148 /* force compiler to be edje_cc */
149 edje_file->compiler = strdup("edje_cc");
150 if (!edje_file->compiler)
151 {
152 edje_file->compiler = strdup("edje_cc");
153 }
154 else if (!compiler_cmd_is_sane())
155 {
156 ERR("ERROR: invalid compiler executable: '%s'", edje_file->compiler);
157 eet_close(ef);
158 return 0;
159 }
160 fontlist = source_fontmap_load(ef);
161 return 1;
162}
163
164void
165output(void)
166{
167 Eina_List *l;
168 Eet_File *tef;
169 SrcFile *sf;
170 char *outdir, *p;
171
172 if (!new_dir)
173 outdir = strdup(".");
174 else
175 {
176 p = strrchr(file_in, '/');
177 if (p)
178 outdir = strdup(p + 1);
179 else
180 outdir = strdup(file_in);
181 p = strrchr(outdir, '.');
182 if (p) *p = 0;
183 ecore_file_mkpath(outdir);
184 }
185
186
187 tef = eet_open(file_in, EET_FILE_MODE_READ);
188
189 if (edje_file->image_dir)
190 {
191 Edje_Image_Directory_Entry *ei;
192 unsigned int i;
193
194 for (i = 0; i < edje_file->image_dir->entries_count; ++i)
195 {
196 ei = &edje_file->image_dir->entries[i];
197
198 if ((ei->source_type > EDJE_IMAGE_SOURCE_TYPE_NONE) &&
199 (ei->source_type < EDJE_IMAGE_SOURCE_TYPE_LAST) &&
200 (ei->source_type != EDJE_IMAGE_SOURCE_TYPE_EXTERNAL) &&
201 (ei->entry))
202 {
203 Ecore_Evas *ee;
204 Evas *evas;
205 Evas_Object *im;
206 char buf[4096];
207 char out[4096];
208 char *pp;
209
210 ecore_init();
211 ecore_evas_init();
212 ee = ecore_evas_buffer_new(1, 1);
213 if (!ee)
214 {
215 ERR("Cannot create buffer engine canvas for image save.");
216 exit(-1);
217 }
218 evas = ecore_evas_get(ee);
219 im = evas_object_image_add(evas);
220 if (!im)
221 {
222 ERR("Cannot create image object for save.");
223 exit(-1);
224 }
225 snprintf(buf, sizeof(buf), "edje/images/%i", ei->id);
226 evas_object_image_file_set(im, file_in, buf);
227 snprintf(out, sizeof(out), "%s/%s", outdir, ei->entry);
228 printf("Output Image: %s\n", out);
229 pp = strdup(out);
230 p = strrchr(pp, '/');
231 *p = 0;
232 if (strstr(pp, "../"))
233 {
234 ERR("Potential security violation. attempt to write in parent dir.");
235 exit(-1);
236 }
237 ecore_file_mkpath(pp);
238 free(pp);
239 if (!evas_object_image_save(im, out, NULL, "quality=100 compress=9"))
240 {
241 ERR("Cannot write file %s. Perhaps missing JPEG or PNG saver modules for Evas.", out);
242 exit(-1);
243 }
244 evas_object_del(im);
245 ecore_evas_free(ee);
246 ecore_evas_shutdown();
247 ecore_shutdown();
248 }
249 }
250 }
251
252 EINA_LIST_FOREACH(srcfiles->list, l, sf)
253 {
254 char out[4096];
255 FILE *f;
256 char *pp;
257
258 snprintf(out, sizeof(out), "%s/%s", outdir, sf->name);
259 INF("Output Source File: %s\n", out);
260 pp = strdup(out);
261 p = strrchr(pp, '/');
262 *p = 0;
263 if (strstr(pp, "../"))
264 {
265 ERR("Potential security violation. attempt to write in parent dir.");
266 exit (-1);
267 }
268 ecore_file_mkpath(pp);
269 free(pp);
270 if (strstr(out, "../"))
271 {
272 ERR("Potential security violation. attempt to write in parent dir.");
273 exit (-1);
274 }
275 f = fopen(out, "wb");
276 if (!f)
277 {
278 ERR("Unable to write file (%s).", out);
279 exit (-1);
280 }
281
282 /* if the file is empty, sf->file will be NULL.
283 * note that that's not an error
284 */
285 if (sf->file) fputs(sf->file, f);
286 fclose(f);
287 }
288 if (edje_file->fonts)
289 {
290 Edje_Font_Directory_Entry *fn;
291 Eina_Iterator *it;
292
293 it = eina_hash_iterator_data_new(edje_file->fonts);
294 EINA_ITERATOR_FOREACH(it, fn)
295 {
296 void *font;
297 int fontsize;
298 char out[4096];
299 /* FIXME!!!! */
300 /* should be fn->entry -v */
301 snprintf(out, sizeof(out), "edje/fonts/%s", fn->file);
302 font = eet_read(tef, out, &fontsize);
303 if (font)
304 {
305 FILE *f;
306 char *pp;
307
308 /* should be fn->file -v */
309 snprintf(out, sizeof(out), "%s/%s", outdir, fn->entry);
310 INF("Output Font: %s", out);
311 pp = strdup(out);
312 p = strrchr(pp, '/');
313 *p = 0;
314 if (strstr(pp, "../"))
315 {
316 ERR("Potential security violation. attempt to write in parent dir.");
317 exit (-1);
318 }
319 ecore_file_mkpath(pp);
320 free(pp);
321 if (strstr(out, "../"))
322 {
323 ERR("Potential security violation. attempt to write in parent dir.");
324 exit (-1);
325 }
326 if (!(f = fopen(out, "wb")))
327 {
328 ERR("Could not open file: %s", out);
329 exit (-1);
330 }
331 if (fwrite(font, fontsize, 1, f) != 1)
332 ERR("Could not write font: %s", strerror(errno));
333 if (f) fclose(f);
334 free(font);
335 }
336 }
337 eina_iterator_free(it);
338 }
339 {
340 char out[4096];
341 FILE *f;
342 sf = eina_list_data_get(srcfiles->list);
343
344
345 if (build_sh)
346 {
347 snprintf(out, sizeof(out), "%s/build.sh", outdir);
348 printf("Output Build Script: %s\n", out);
349 if (strstr(out, "../"))
350 {
351 ERR("potential security violation. attempt to write in parent dir.\n");
352 exit (-1);
353 }
354 f = fopen(out, "wb");
355 fprintf(f, "#!/bin/sh\n");
356 fprintf(f, "%s $@ -id . -fd . %s -o %s.edj\n", edje_file->compiler, sf->name, outdir);
357 fclose(f);
358
359 WRN("\n*** CAUTION ***\n"
360 "Please check the build script for anything malicious "
361 "before running it!\n\n");
362 }
363
364 if (file_out)
365 {
366 snprintf(out, sizeof(out), "%s/%s", outdir, file_out);
367 if (ecore_file_symlink(sf->name, out) != EINA_TRUE)
368 {
369 ERR("symlink %s -> %s failed\n", sf->name, out);
370 }
371 }
372
373 chmod(out, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP);
374
375 }
376
377 if (edje_file->sound_dir)
378 {
379 Edje_Sound_Sample *sample;
380 void *sound_data;
381 char out[PATH_MAX];
382 char out1[PATH_MAX];
383 char *pp;
384 int sound_data_size;
385 FILE *f;
386 int i;
387
388 for (i = 0; i < (int)edje_file->sound_dir->samples_count; i++)
389 {
390 sample = &edje_file->sound_dir->samples[i];
391 if ((!sample) || (!sample->name)) continue;
392 snprintf(out, sizeof(out), "edje/sounds/%i", sample->id);
393 sound_data = (void *)eet_read_direct(tef, out, &sound_data_size);
394 if (sound_data)
395 {
396 snprintf(out1, sizeof(out1), "%s/%s", outdir, sample->name);
397 pp = strdup(out1);
398 p = strrchr(pp, '/');
399 *p = 0;
400 if (strstr(pp, "../"))
401 {
402 ERR("Potential security violation. attempt to write in parent dir.");
403 exit(-1);
404 }
405 ecore_file_mkpath(pp);
406 free(pp);
407 if (strstr(out, "../"))
408 {
409 ERR("Potential security violation. attempt to write in parent dir.");
410 exit(-1);
411 }
412 f = fopen(out1, "wb");
413 if (fwrite(sound_data, sound_data_size, 1, f) != 1)
414 ERR("Could not write sound: %s", strerror(errno));
415 fclose(f);
416 free(sound_data);
417 }
418 }
419
420 }
421 eet_close(tef);
422}
423
424static int
425compiler_cmd_is_sane()
426{
427 const char *c = edje_file->compiler, *ptr;
428
429 if ((!c) || (!*c))
430 {
431 return 0;
432 }
433
434 for (ptr = c; ptr && *ptr; ptr++)
435 {
436 /* only allow [a-z][A-Z][0-9]_- */
437 if ((!isalnum(*ptr)) && (*ptr != '_') && (*ptr != '-'))
438 {
439 return 0;
440 }
441 }
442
443 return 1;
444}
445
446static int
447root_filename_is_sane()
448{
449 SrcFile *sf = eina_list_data_get(srcfiles->list);
450 char *f = sf->name, *ptr;
451
452 if (!f || !*f)
453 {
454 return 0;
455 }
456
457 for (ptr = f; ptr && *ptr; ptr++)
458 {
459 /* only allow [a-z][A-Z][0-9]_-./ */
460 switch (*ptr)
461 {
462 case '_': case '-': case '.': case '/':
463 break;
464 default:
465 if (!isalnum(*ptr))
466 {
467 return 0;
468 }
469 }
470 }
471 return 1;
472}
diff --git a/libraries/edje/src/bin/edje_decc.h b/libraries/edje/src/bin/edje_decc.h
new file mode 100644
index 0000000..43e988d
--- /dev/null
+++ b/libraries/edje/src/bin/edje_decc.h
@@ -0,0 +1,61 @@
1#ifndef EDJE_DECC_H
2#define EDJE_DECC_H
3
4#include <edje_private.h>
5
6/* logging variables */
7extern int _edje_cc_log_dom ;
8#define EDJE_CC_DEFAULT_LOG_COLOR EINA_COLOR_CYAN
9#ifdef ERR
10# undef ERR
11#endif
12#define ERR(...) EINA_LOG_DOM_ERR(_edje_cc_log_dom, __VA_ARGS__)
13#ifdef INF
14# undef INF
15#endif
16#define INF(...) EINA_LOG_DOM_INFO(_edje_cc_log_dom, __VA_ARGS__)
17#ifdef WRN
18# undef WRN
19#endif
20#define WRN(...) EINA_LOG_DOM_WARN(_edje_cc_log_dom, __VA_ARGS__)
21
22/* types */
23typedef struct _Font Font;
24typedef struct _Font_List Font_List;
25typedef struct _SrcFile SrcFile;
26typedef struct _SrcFile_List SrcFile_List;
27
28struct _Font
29{
30 char *file;
31 char *name;
32};
33
34struct _Font_List
35{
36 Eina_List *list;
37};
38
39struct _SrcFile
40{
41 char *name;
42 char *file;
43};
44
45struct _SrcFile_List
46{
47 Eina_List *list;
48};
49
50void source_edd(void);
51void source_fetch(void);
52int source_append(Eet_File *ef);
53SrcFile_List *source_load(Eet_File *ef);
54int source_fontmap_save(Eet_File *ef, Eina_List *fonts);
55Font_List *source_fontmap_load(Eet_File *ef);
56
57void *mem_alloc(size_t size);
58char *mem_strdup(const char *s);
59#define SZ sizeof
60
61#endif
diff --git a/libraries/edje/src/bin/edje_external_inspector.c b/libraries/edje/src/bin/edje_external_inspector.c
new file mode 100644
index 0000000..6bd9a35
--- /dev/null
+++ b/libraries/edje/src/bin/edje_external_inspector.c
@@ -0,0 +1,663 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <locale.h>
6#include <fnmatch.h>
7
8#include <Ecore.h>
9#include <Ecore_Getopt.h>
10
11#include "Edje.h"
12
13static int _log_dom;
14#define DBG(...) EINA_LOG_DOM_DBG(_log_dom, __VA_ARGS__)
15#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__)
16#define WRN(...) EINA_LOG_DOM_WARN(_log_dom, __VA_ARGS__)
17#define ERR(...) EINA_LOG_DOM_ERR(_log_dom, __VA_ARGS__)
18#define CRIT(...) EINA_LOG_DOM_CRIT(_log_dom, __VA_ARGS__)
19
20#define INDENT " "
21#define INDENT2 INDENT INDENT
22#define INDENT3 INDENT2 INDENT
23#define INDENT4 INDENT3 INDENT
24
25static char *module_patterns_str = NULL;
26
27static int detail = 1;
28static Eina_Bool machine = EINA_FALSE;
29static char *type_glob = NULL;
30static char * const *module_patterns;
31static const Eina_List *modules;
32
33
34static char *
35_module_patterns_str_new(void)
36{
37 Eina_Strbuf *buf;
38 char * const *itr;
39 char *ret;
40 if (!module_patterns) return strdup("*");
41
42 buf = eina_strbuf_new();
43 for (itr = module_patterns; *itr != NULL; itr++)
44 {
45 eina_strbuf_append(buf, *itr);
46 if (itr[1]) eina_strbuf_append(buf, ", ");
47 }
48 ret = eina_strbuf_string_steal(buf);
49 eina_strbuf_free(buf);
50 return ret;
51}
52
53static Eina_Bool
54module_matches(const char *name)
55{
56 char * const *itr;
57 if (!module_patterns) return EINA_TRUE;
58
59 for (itr = module_patterns; *itr != NULL; itr++)
60 if (fnmatch(*itr, name, 0) == 0) return EINA_TRUE;
61
62 return EINA_FALSE;
63}
64
65static inline Eina_Bool
66type_matches(const char *name)
67{
68 if (!type_glob) return EINA_TRUE;
69 return fnmatch(type_glob, name, 0) == 0;
70}
71
72static int
73_types_sort(const void *pa, const void *pb)
74{
75 const Eina_Hash_Tuple *ha = pa, *hb = pb;
76 const Edje_External_Type *ta = ha->data, *tb = hb->data;
77 const char *na = ha->key, *nb = hb->key;
78 int r;
79
80 if (!ta->module) return -1;
81 if (!tb->module) return 1;
82 r = strcmp(ta->module, tb->module);
83 if (r != 0) return r;
84
85 if (!na) return -1;
86 if (!nb) return 1;
87 return strcmp(na, nb);
88}
89
90static const char *
91_param_type_str_get(const Edje_External_Param_Info *param)
92{
93 switch (param->type)
94 {
95 case EDJE_EXTERNAL_PARAM_TYPE_INT: return "int";
96 case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: return "double";
97 case EDJE_EXTERNAL_PARAM_TYPE_STRING: return "string";
98 case EDJE_EXTERNAL_PARAM_TYPE_BOOL: return "bool";
99 case EDJE_EXTERNAL_PARAM_TYPE_CHOICE: return "choice";
100 default:
101 ERR("Unknown parameter type %d", param->type);
102 return "???";
103 }
104}
105
106static const char *
107_param_value_str_get(const Edje_External_Type *type, const Edje_External_Param_Info *param, char *buf, size_t buflen)
108{
109 switch (param->type)
110 {
111 case EDJE_EXTERNAL_PARAM_TYPE_INT:
112 if (param->info.i.def == EDJE_EXTERNAL_INT_UNSET) return NULL;
113 snprintf(buf, buflen, "%d", param->info.i.def);
114 return buf;
115
116 case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
117 if (param->info.d.def == EDJE_EXTERNAL_DOUBLE_UNSET) return NULL;
118 snprintf(buf, buflen, "%g", param->info.d.def);
119 return buf;
120
121 case EDJE_EXTERNAL_PARAM_TYPE_STRING:
122 return param->info.s.def;
123
124 case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
125 if (param->info.b.def == 0) return "0";
126 else if (param->info.b.def == 1) return "1";
127 return NULL;
128
129 case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
130 {
131 char *def;
132 if (param->info.c.def) return param->info.c.def;
133 if (!param->info.c.def_get) return NULL;
134 def = param->info.c.def_get(type->data, param);
135 if (!def) return NULL;
136 eina_strlcpy(buf, def, buflen);
137 free(def);
138 return buf;
139 }
140
141 default:
142 ERR("Unknown parameter type %d", param->type);
143 return NULL;
144 }
145}
146
147static const char *
148_param_flags_str_get(const Edje_External_Param_Info *param)
149{
150 static char buf[] = "GET|SET|STATE|CONSTRUCTOR";
151
152 if (param->flags == EDJE_EXTERNAL_PARAM_FLAGS_NONE) return "NONE";
153 if (param->flags == EDJE_EXTERNAL_PARAM_FLAGS_REGULAR) return "REGULAR";
154
155 buf[0] = '\0';
156
157 if (param->flags & EDJE_EXTERNAL_PARAM_FLAGS_GET)
158 strcat(buf, "GET");
159
160 if (param->flags & EDJE_EXTERNAL_PARAM_FLAGS_SET)
161 {
162 if (buf[0] != '\0') strcat(buf, "|");
163 strcat(buf, "SET");
164 }
165
166 if (param->flags & EDJE_EXTERNAL_PARAM_FLAGS_STATE)
167 {
168 if (buf[0] != '\0') strcat(buf, "|");
169 strcat(buf, "STATE");
170 }
171
172 if (param->flags & EDJE_EXTERNAL_PARAM_FLAGS_CONSTRUCTOR)
173 {
174 if (buf[0] != '\0') strcat(buf, "|");
175 strcat(buf, "CONSTRUCTOR");
176 }
177
178 return buf;
179}
180
181static void
182_param_choices_print(const char * const *choices)
183{
184 if (machine) puts("CHOICES-BEGIN");
185 else fputs(", choices:", stdout);
186 for (; *choices != NULL; choices++)
187 {
188 if (machine) puts(*choices);
189 else printf(" \"%s\"", *choices);
190 }
191 if (machine) puts("CHOICES-END");
192}
193
194static void
195_param_extra_details(const Edje_External_Type *type, const Edje_External_Param_Info *param)
196{
197 const char *str = _param_flags_str_get(param);
198 if (machine) printf("FLAGS: %s\n", str);
199 else printf(" /* flags: %s", str);
200
201 switch (param->type)
202 {
203 case EDJE_EXTERNAL_PARAM_TYPE_INT:
204 if (param->info.i.min != EDJE_EXTERNAL_INT_UNSET)
205 {
206 if (machine) printf("MIN: %d\n", param->info.i.min);
207 else printf(", min: %d", param->info.i.min);
208 }
209 if (param->info.i.max != EDJE_EXTERNAL_INT_UNSET)
210 {
211 if (machine) printf("MAX: %d\n", param->info.i.max);
212 else printf(", max: %d", param->info.i.max);
213 }
214 if (param->info.i.step != EDJE_EXTERNAL_INT_UNSET)
215 {
216 if (machine) printf("STEP: %d\n", param->info.i.step);
217 else printf(", step: %d", param->info.i.step);
218 }
219 break;
220
221 case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
222 if (param->info.d.min != EDJE_EXTERNAL_DOUBLE_UNSET)
223 {
224 if (machine) printf("MIN: %g\n", param->info.d.min);
225 else printf(", min: %g", param->info.d.min);
226 }
227 if (param->info.d.max != EDJE_EXTERNAL_DOUBLE_UNSET)
228 {
229 if (machine) printf("MAX: %g\n", param->info.d.max);
230 else printf(", max: %g", param->info.d.max);
231 }
232 if (param->info.d.step != EDJE_EXTERNAL_DOUBLE_UNSET)
233 {
234 if (machine) printf("STEP: %g\n", param->info.d.step);
235 else printf(", step: %g", param->info.d.step);
236 }
237 break;
238
239 case EDJE_EXTERNAL_PARAM_TYPE_STRING:
240 if (param->info.s.accept_fmt)
241 {
242 if (machine) printf("ACCEPT_FMT: %s\n", param->info.s.accept_fmt);
243 else printf(", accept_fmt: \"%s\"", param->info.s.accept_fmt);
244 }
245 if (param->info.s.deny_fmt)
246 {
247 if (machine) printf("DENY_FMT: %s\n", param->info.s.deny_fmt);
248 else printf(", deny_fmt: \"%s\"", param->info.s.deny_fmt);
249 }
250 break;
251
252 case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
253 if (param->info.b.false_str)
254 {
255 if (machine) printf("FALSE_STR: %s\n", param->info.b.false_str);
256 else printf(", false_str: \"%s\"", param->info.b.false_str);
257 }
258 if (param->info.b.true_str)
259 {
260 if (machine) printf("TRUE_STR: %s\n", param->info.b.true_str);
261 else printf(", true_str: \"%s\"", param->info.b.true_str);
262 }
263 break;
264
265 case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
266 {
267 if (param->info.c.choices)
268 _param_choices_print(param->info.c.choices);
269 else if (param->info.c.query)
270 {
271 char **choices = param->info.c.query(type->data, param);
272 if (choices)
273 {
274 char **itr;
275 _param_choices_print((const char * const*)choices);
276 for (itr = choices; *itr; itr++) free(*itr);
277 free(choices);
278 }
279 }
280 }
281 break;
282
283 default:
284 ERR("Unknown parameter type %d", param->type);
285 }
286
287 if (!machine) fputs(" */", stdout); /* \n not desired */
288}
289
290static int
291_info_list(void)
292{
293 Eina_Iterator *itr;
294 Eina_List *types;
295 const Eina_Hash_Tuple *tuple;
296 const Eina_List *l;
297 const char *name, *last_module;
298 Eina_Bool module_found = EINA_FALSE, type_found = EINA_FALSE;
299 Eina_Bool in_module = EINA_FALSE;
300
301 EINA_LIST_FOREACH(modules, l, name)
302 {
303 if (!module_matches(name))
304 {
305 DBG("filter out module '%s': does not match '%s'",
306 name, module_patterns_str);
307 continue;
308 }
309
310 if (!edje_module_load(name))
311 {
312 ERR("error loading external '%s'", name);
313 continue;
314 }
315
316 module_found = EINA_TRUE;
317 }
318
319 itr = edje_external_iterator_get();
320 types = NULL;
321 EINA_ITERATOR_FOREACH(itr, tuple)
322 {
323 const Edje_External_Type *type = tuple->data;
324 name = tuple->key;
325
326 if (!type)
327 {
328 ERR("no type value for '%s'", name);
329 continue;
330 }
331 else if (type->abi_version != edje_external_type_abi_version_get())
332 {
333 ERR("type '%s' with incorrect abi_version %u (expected %u)",
334 name, type->abi_version, edje_external_type_abi_version_get());
335 continue;
336 }
337
338 if (!type_matches(name))
339 {
340 DBG("filter out type '%s': does not match '%s'", name, type_glob);
341 continue;
342 }
343
344 types = eina_list_append(types, tuple);
345 type_found = EINA_TRUE;
346 }
347 eina_iterator_free(itr);
348
349 last_module = NULL;
350 types = eina_list_sort(types, 0, _types_sort);
351 EINA_LIST_FREE(types, tuple)
352 {
353 Eina_Bool changed_module = EINA_FALSE;
354 const Edje_External_Type *type = tuple->data;
355 const Edje_External_Param_Info *param;
356 name = tuple->key;
357
358 if ((last_module) && (type->module))
359 {
360 changed_module = ((last_module != type->module) &&
361 (!strcmp(last_module, type->module)));
362 }
363 else if ((!last_module) && (type->module))
364 changed_module = EINA_TRUE;
365
366 if (changed_module)
367 {
368 if (in_module)
369 {
370 if (machine) puts("TYPES-END\nMODULE-END");
371 else puts(INDENT "}\n}");
372 }
373
374 if (machine)
375 printf("MODULE-BEGIN\n"
376 "NAME: %s\n"
377 "FRIENDLY-NAME: %s\n"
378 "TYPES-BEGIN\n",
379 type->module, type->module_name);
380 else
381 printf("module {\n"
382 INDENT "name: \"%s\";\n"
383 INDENT "friendly_name: \"%s\";\n"
384 INDENT "types {\n",
385 type->module, type->module_name);
386
387 in_module = EINA_TRUE;
388 }
389
390 if (machine) printf("TYPE-BEGIN\nNAME: %s\n", name);
391 else printf(INDENT2 "type {\n" INDENT3 "name: \"%s\";\n", name);
392
393 if (detail > 1)
394 {
395 const char *str;
396
397 if (!type->label_get) str = NULL;
398 else str = type->label_get(type->data);
399 if (machine) printf("LABEL: %s\n", str ? str : "");
400 else if (str) printf(INDENT3 "label: \"%s\";\n", str);
401
402 if (!type->description_get) str = NULL;
403 else str = type->description_get(type->data);
404 if (machine) printf("DESCRIPTION: %s\n", str ? str : "");
405 else if (str) printf(INDENT3 "description: \"%s\";\n", str);
406 }
407
408 if (machine) puts("PARAMS-BEGIN");
409 else puts(INDENT3 "params {");
410
411 for (param = type->parameters_info; param->name != NULL; param++)
412 {
413 const char *pt = _param_type_str_get(param);
414 char buf[128];
415
416 if (machine)
417 printf("PARAM-BEGIN\nNAME: %s\nTYPE: %s\n", param->name, pt);
418 else printf(INDENT4 "%s: \"%s\"", pt, param->name);
419
420 if (detail > 0)
421 {
422 const char *str = _param_value_str_get
423 (type, param, buf, sizeof(buf));
424 if (machine) printf("DEFAULT: %s\n", str ? str : "");
425 else if (str) printf(" \"%s\"", str);
426
427 if (detail > 1)
428 {
429 if (!machine) putchar(';');
430 _param_extra_details(type, param);
431 }
432 }
433
434 if (machine) puts("PARAM-END");
435 else if (detail > 1) putchar('\n');
436 else puts(";");
437 }
438
439 if (machine) puts("PARAMS-END\nTYPE-END");
440 else puts(INDENT3 "}\n" INDENT2 "}");
441
442 last_module = type->module;
443 }
444
445 if (in_module)
446 {
447 if (machine) puts("MODULE-END");
448 else puts(INDENT "}\n}");
449 }
450
451 if (!module_found) WRN("no modules match '%s'", module_patterns_str);
452 if (!type_found) WRN("no types match '%s'", type_glob);
453 return (!module_found) || (!type_found);
454}
455
456static int
457_types_names_list(void)
458{
459 Eina_Iterator *itr;
460 Eina_List *types;
461 const Eina_Hash_Tuple *tuple;
462 const Eina_List *l;
463 const char *name;
464 Eina_Bool module_found = EINA_FALSE, type_found = EINA_FALSE;
465
466 EINA_LIST_FOREACH(modules, l, name)
467 {
468 if (!module_matches(name))
469 {
470 DBG("filter out module '%s': does not match '%s'",
471 name, module_patterns_str);
472 continue;
473 }
474
475 if (!edje_module_load(name))
476 {
477 ERR("error loading external '%s'", name);
478 continue;
479 }
480
481 module_found = EINA_TRUE;
482 }
483
484 itr = edje_external_iterator_get();
485 types = NULL;
486 EINA_ITERATOR_FOREACH(itr, tuple)
487 {
488 const Edje_External_Type *type = tuple->data;
489 name = tuple->key;
490
491 if (!type)
492 {
493 ERR("no type value for '%s'", name);
494 continue;
495 }
496 else if (type->abi_version != edje_external_type_abi_version_get())
497 {
498 ERR("type '%s' with incorrect abi_version %u (expected %u)",
499 name, type->abi_version, edje_external_type_abi_version_get());
500 continue;
501 }
502
503 if (!type_matches(name))
504 {
505 DBG("filter out type '%s': does not match '%s'", name, type_glob);
506 continue;
507 }
508
509 types = eina_list_append(types, tuple);
510 type_found = EINA_TRUE;
511 }
512 eina_iterator_free(itr);
513
514 types = eina_list_sort(types, 0, _types_sort);
515 EINA_LIST_FREE(types, tuple)
516 puts(tuple->key);
517
518 if (!module_found) WRN("no modules match '%s'", module_patterns_str);
519 if (!type_found) WRN("no types match '%s'", type_glob);
520 return (!module_found) || (!type_found);
521}
522
523static int
524_modules_names_list(void)
525{
526 const Eina_List *l;
527 const char *name;
528 Eina_Bool found = EINA_FALSE;
529
530 EINA_LIST_FOREACH(modules, l, name)
531 {
532 if (!module_matches(name))
533 {
534 DBG("filter out module '%s': does not match '%s'",
535 name, module_patterns_str);
536 continue;
537 }
538 found = EINA_TRUE;
539 puts(name);
540 }
541
542 if (!found) WRN("no modules match '%s'", module_patterns_str);
543 return !found;
544}
545
546static const char *mode_choices[] = {
547 "info",
548 "modules-names",
549 "types-names",
550 NULL,
551};
552
553static const char *detail_choices[] = {
554 "none",
555 "terse",
556 "all",
557 NULL
558};
559
560const Ecore_Getopt optdesc = {
561 "edje_external_inspector",
562 "%prog [options] [module|module-glob] ... [module|module-glob]",
563 PACKAGE_VERSION,
564 "(C) 2010 - The Enlightenment Project",
565 "BSD",
566 "Edje external module inspector.",
567 0,
568 {
569 ECORE_GETOPT_CHOICE('m', "mode", "Choose which mode to operate.",
570 mode_choices),
571 ECORE_GETOPT_STORE_STR('t', "type", "Limit output to type (or glob)."),
572 ECORE_GETOPT_CHOICE('d', "detail", "Choose detail level (default=terse)",
573 detail_choices),
574 ECORE_GETOPT_STORE_TRUE('M', "machine", "Produce machine readable output."),
575 ECORE_GETOPT_LICENSE('L', "license"),
576 ECORE_GETOPT_COPYRIGHT('C', "copyright"),
577 ECORE_GETOPT_VERSION('V', "version"),
578 ECORE_GETOPT_HELP('h', "help"),
579 ECORE_GETOPT_SENTINEL
580 }
581};
582
583int
584main(int argc, char **argv)
585{
586 Eina_Bool quit_option = EINA_FALSE;
587 char *mode = NULL;
588 char *detail_name = NULL;
589 int arg_index;
590 int ret = 0;
591 Ecore_Getopt_Value values[] = {
592 ECORE_GETOPT_VALUE_STR(mode),
593 ECORE_GETOPT_VALUE_STR(type_glob),
594 ECORE_GETOPT_VALUE_STR(detail_name),
595 ECORE_GETOPT_VALUE_BOOL(machine),
596 ECORE_GETOPT_VALUE_BOOL(quit_option),
597 ECORE_GETOPT_VALUE_BOOL(quit_option),
598 ECORE_GETOPT_VALUE_BOOL(quit_option),
599 ECORE_GETOPT_VALUE_BOOL(quit_option),
600 ECORE_GETOPT_VALUE_NONE
601 };
602
603 setlocale(LC_NUMERIC, "C");
604
605 ecore_init();
606 eina_init();
607 edje_init();
608
609 _log_dom = eina_log_domain_register
610 ("edje_external_inspector", EINA_COLOR_YELLOW);
611 if (_log_dom < 0)
612 {
613 EINA_LOG_CRIT
614 ("could not register log domain 'edje_external_inspector'");
615 ret = 1;
616 goto error_log;
617 }
618
619 arg_index = ecore_getopt_parse(&optdesc, values, argc, argv);
620 if (arg_index < 0)
621 {
622 ERR("could not parse arguments.");
623 ret = 1;
624 goto error_getopt;
625 }
626 else if (quit_option) goto error_getopt;
627
628 if (!mode) mode = (char *)mode_choices[0];
629
630 if (detail_name)
631 {
632 if (!strcmp(detail_name, "none")) detail = 0;
633 else if (!strcmp(detail_name, "terse")) detail = 1;
634 else if (!strcmp(detail_name, "all")) detail = 2;
635 else ERR("Unknown detail level: '%s'", detail_name);
636 }
637
638 if (arg_index < argc) module_patterns = argv + arg_index;
639 else module_patterns = NULL;
640
641 modules = edje_available_modules_get();
642 module_patterns_str = _module_patterns_str_new();
643
644 if (!strcmp(mode, "info")) ret = _info_list();
645 else if (!strcmp(mode, "modules-names")) ret = _modules_names_list();
646 else if (!strcmp(mode, "types-names")) ret = _types_names_list();
647 else
648 {
649 ERR("Unknown mode: %s", mode);
650 ret = 1;
651 }
652
653 free(module_patterns_str);
654
655 error_getopt:
656 eina_log_domain_unregister(_log_dom);
657 error_log:
658 edje_shutdown();
659 ecore_shutdown();
660 eina_shutdown();
661
662 return ret;
663}
diff --git a/libraries/edje/src/bin/edje_inspector.c b/libraries/edje/src/bin/edje_inspector.c
new file mode 100644
index 0000000..ed3baaf
--- /dev/null
+++ b/libraries/edje/src/bin/edje_inspector.c
@@ -0,0 +1,1639 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include "Edje.h"
6#define EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT 1
7#include "Edje_Edit.h"
8
9#include <Ecore.h>
10#include <Ecore_Evas.h>
11#include <Ecore_Getopt.h>
12#include <locale.h>
13#include <fnmatch.h>
14#include <unistd.h>
15
16static int _log_dom;
17#define DBG(...) EINA_LOG_DOM_DBG(_log_dom, __VA_ARGS__)
18#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__)
19#define WRN(...) EINA_LOG_DOM_WARN(_log_dom, __VA_ARGS__)
20#define ERR(...) EINA_LOG_DOM_ERR(_log_dom, __VA_ARGS__)
21#define CRIT(...) EINA_LOG_DOM_CRIT(_log_dom, __VA_ARGS__)
22
23#define INDENT " "
24#define INDENT2 INDENT INDENT
25#define INDENT3 INDENT2 INDENT
26#define INDENT4 INDENT3 INDENT
27#define INDENT5 INDENT4 INDENT
28#define INDENT6 INDENT5 INDENT
29#define INDENT7 INDENT6 INDENT
30
31#define FLOAT_PRECISION 0.0001
32#define FDIFF(a, b) (fabs((a) - (b)) > FLOAT_PRECISION)
33
34#ifdef _WIN32
35# define FMT_UCHAR "%c"
36#else
37# define FMT_UCHAR "%hhu"
38#endif
39
40/* context */
41static Eina_List *groups;
42static Ecore_Evas *ee;
43
44/* options */
45static const char *file;
46static char *group = NULL;
47static char *part = NULL;
48static char *program = NULL;
49static int detail = 1;
50static Eina_Bool api_only = EINA_FALSE;
51static Eina_Bool api_fix = EINA_FALSE;
52static Eina_Bool machine = EINA_FALSE;
53
54static const char *mode_choices[] = {
55 "groups",
56 "parts",
57 "programs",
58 "groups-names",
59 "part-names",
60 "global-data",
61 "images",
62 "fonts",
63 "externals",
64 NULL,
65};
66
67static const char *detail_choices[] = {
68 "none",
69 "terse",
70 "all",
71 NULL
72};
73
74const Ecore_Getopt optdesc = {
75 "edje_inspector",
76 "%prog [options] <file.edj>",
77 PACKAGE_VERSION,
78 "(C) 2010 - The Enlightenment Project",
79 "BSD",
80 "Edje file inspector, let one see groups, parts, programs and other details "
81 "of a compiled (binary) edje file.\n",
82 0,
83 {
84 ECORE_GETOPT_CHOICE('m', "mode", "Choose which mode to operate on file.",
85 mode_choices),
86 ECORE_GETOPT_CHOICE('d', "detail", "Choose detail level (default=terse)",
87 detail_choices),
88 ECORE_GETOPT_STORE_STR('g', "group", "Limit output to group (or glob)."),
89 ECORE_GETOPT_STORE_STR('p', "part", "Limit output to part (or glob)."),
90 ECORE_GETOPT_STORE_STR('r', "program",
91 "Limit output to program (or glob)."),
92 ECORE_GETOPT_STORE_TRUE('a', "api-only", "Limit to just api parts or "
93 "programs."),
94 ECORE_GETOPT_STORE_TRUE('A', "api-fix", "Fix API names to be C compliant."),
95 ECORE_GETOPT_STORE_TRUE('M', "machine", "Produce machine readable output."),
96 ECORE_GETOPT_LICENSE('L', "license"),
97 ECORE_GETOPT_COPYRIGHT('C', "copyright"),
98 ECORE_GETOPT_VERSION('V', "version"),
99 ECORE_GETOPT_HELP('h', "help"),
100 ECORE_GETOPT_SENTINEL
101 }
102};
103
104static inline Eina_Bool
105matches(const char *name, const char *pattern)
106{
107 if (!pattern) return EINA_TRUE;
108 return fnmatch(pattern, name, 0) == 0;
109}
110
111static void
112group_begin(const char *name)
113{
114 if (machine) printf("GROUP-BEGIN\nNAME: %s\n", name);
115 else printf("group { name: '%s';\n", name);
116}
117
118static void
119group_end(void)
120{
121 if (machine) puts("GROUP-END");
122 else puts("}");
123}
124
125static void
126group_details(Evas_Object *ed)
127{
128 int w, h;
129
130 if (detail < 1) return;
131
132 if (machine) puts("GROUP-DETAILS-BEGIN");
133
134 w = edje_edit_group_min_w_get(ed);
135 h = edje_edit_group_min_h_get(ed);
136 if (machine) printf("MIN-W: %d\nMIN-H: %d\n", w, h);
137 else if ((w > 0) || (h > 0)) printf(INDENT "min: %d %d;\n", w, h);
138
139 w = edje_edit_group_max_w_get(ed);
140 h = edje_edit_group_max_h_get(ed);
141 if (machine) printf("MAX-W: %d\nMAX-H: %d\n", w, h);
142 else if ((w > 0) || (h > 0)) printf(INDENT "max: %d %d;\n", w, h);
143
144 if (detail > 1)
145 {
146 Eina_List *dl;
147 dl = edje_edit_group_data_list_get(ed);
148 if (dl)
149 {
150 Eina_List *l;
151 const char *k;
152 if (machine) puts(INDENT "GROUP-DETAILS-DATA-BEGIN");
153 else puts(INDENT "data {");
154
155 EINA_LIST_FOREACH(dl, l, k)
156 {
157 const char *v = edje_edit_group_data_value_get(ed, k);
158 if (machine) printf("ITEM: \"%s\" \"%s\"\n", k, v);
159 else printf(INDENT2 "item: \"%s\" \"%s\";\n", k, v);
160 }
161
162 edje_edit_string_list_free(dl);
163
164 if (machine) puts(INDENT "GROUP-DETAILS-DATA-END");
165 else puts(INDENT "}");
166 }
167 }
168
169 if (machine) puts("GROUP-DETAILS-END");
170}
171
172static void
173parts_begin(void)
174{
175 if (machine) puts("PARTS-BEGIN");
176 else puts(INDENT "parts {");
177}
178
179static void
180parts_end(void)
181{
182 if (machine) puts("PARTS-END");
183 else puts(INDENT "}");
184}
185
186static const char *
187part_type_name_get(Edje_Part_Type t)
188{
189 switch (t)
190 {
191 case EDJE_PART_TYPE_RECTANGLE:
192 return "RECT";
193 case EDJE_PART_TYPE_TEXT:
194 return "TEXT";
195 case EDJE_PART_TYPE_IMAGE:
196 return "IMAGE";
197 case EDJE_PART_TYPE_PROXY:
198 return "PROXY";
199 case EDJE_PART_TYPE_SWALLOW:
200 return "SWALLOW";
201 case EDJE_PART_TYPE_TEXTBLOCK:
202 return "TEXTBLOCK";
203 case EDJE_PART_TYPE_GRADIENT:
204 return "GRADIENT";
205 case EDJE_PART_TYPE_GROUP:
206 return "GROUP";
207 case EDJE_PART_TYPE_BOX:
208 return "BOX";
209 case EDJE_PART_TYPE_TABLE:
210 return "TABLE";
211 case EDJE_PART_TYPE_EXTERNAL:
212 return "EXTERNAL";
213
214 case EDJE_PART_TYPE_NONE:
215 case EDJE_PART_TYPE_LAST:
216 ERR("Invalid part type %d", t);
217 return "???";
218 default:
219 ERR("Unknown part type %d", t);
220 return "???";
221 }
222}
223
224static void
225state_begin(const char *state, double value)
226{
227 if (machine)
228 printf("PART-STATE-BEGIN\nNAME: %s\nVALUE: %2.1f\n", state, value);
229 else
230 {
231 printf(INDENT3 "description { state: \"%s\" %2.1f;", state, value);
232 if (detail > 0) putchar('\n');
233 }
234}
235
236static const char *
237aspect_pref_name_get(int id)
238{
239 switch (id)
240 {
241 case 0: return "NONE";
242 case 1: return "VERTICAL";
243 case 2: return "HORIZONTAL";
244 case 3: return "BOTH";
245 default:
246 ERR("Unknown aspect preference %d", id);
247 return "???";
248 }
249}
250
251static const char *
252border_fill_name_get(int id)
253{
254 switch (id)
255 {
256 case 0: return "NONE";
257 case 1: return "DEFAULT";
258 case 2: return "SOLID";
259 default:
260 ERR("Unknown border fill %d", id);
261 return "???";
262 }
263}
264
265static void
266state_details(Evas_Object *ed, const char *part, const char *state, double value)
267{
268 Edje_Part_Type t = edje_edit_part_type_get(ed, part);
269 double dx, dy;
270 const char *str, *str2;
271 int x, y, r, g, b, a;
272
273 if (detail < 1) return;
274
275 b = edje_edit_state_visible_get(ed, part, state, value);
276 if (machine) printf("VISIBLE: %d\n", b);
277 else if (!b) puts(INDENT4 "visible: 0;");
278
279 edje_edit_state_color_get(ed, part, state, value, &r, &g, &b, &a);
280 if (machine)
281 printf("COLOR-R: %d\nCOLOR-G: %d\nCOLOR-B: %d\nCOLOR-A: %d\n", r, g, b, a);
282 else if ((r != 255) || (g != 255) || (b != 255) || (a != 255))
283 printf(INDENT4 "color: %d %d %d %d;\n", r, g, b, a);
284
285 if (detail > 1)
286 {
287 edje_edit_state_color2_get(ed, part, state, value, &r, &g, &b, &a);
288 if (machine)
289 printf("COLOR2-R: %d\nCOLOR2-G: %d\nCOLOR2-B: %d\nCOLOR2-A: %d\n",
290 r, g, b, a);
291 else if ((r != 255) || (g != 255) || (b != 255) || (a != 255))
292 printf(INDENT4 "color2: %d %d %d %d;\n", r, g, b, a);
293
294 edje_edit_state_color3_get(ed, part, state, value, &r, &g, &b, &a);
295 if (machine)
296 printf("COLOR3-R: %d\nCOLOR3-G: %d\nCOLOR3-B: %d\nCOLOR3-A: %d\n",
297 r, g, b, a);
298 else if ((r != 255) || (g != 255) || (b != 255) || (a != 255))
299 printf(INDENT4 "color3: %d %d %d %d;\n", r, g, b, a);
300 }
301
302 dx = edje_edit_state_align_x_get(ed, part, state, value);
303 dy = edje_edit_state_align_y_get(ed, part, state, value);
304 if (machine) printf("ALIGN-X: %g\nALIGN-Y: %g\n", dx, dy);
305 else if (FDIFF(dx, 0.5) || FDIFF(dy, 0.5))
306 printf(INDENT4 "align: %g %g;\n", dx, dy);
307
308 x = edje_edit_state_min_w_get(ed, part, state, value);
309 y = edje_edit_state_min_h_get(ed, part, state, value);
310 if (machine) printf("MIN-W: %d\nMIN-H: %d\n", x, y);
311 else if ((x) || (y)) printf(INDENT4 "min: %d %d;\n", x, y);
312
313 x = edje_edit_state_max_w_get(ed, part, state, value);
314 y = edje_edit_state_max_h_get(ed, part, state, value);
315 if (machine) printf("MAX-W: %d\nMAX-H: %d\n", x, y);
316 else if ((x != -1) || (y != -1)) printf(INDENT4 "max: %d %d;\n", x, y);
317
318 //TODO Support fixed
319 //TODO Support step
320
321 if (detail > 1)
322 {
323 dx = edje_edit_state_aspect_min_get(ed, part, state, value);
324 dy = edje_edit_state_aspect_max_get(ed, part, state, value);
325 if (machine) printf("ASPECT-MIN: %g\nASPECT-MAX: %g\n", dx, dy);
326 else if (FDIFF(dx, 0.0) || FDIFF(dy, 0.0))
327 printf(INDENT4 "aspect: %g %g;\n", dx, dy);
328
329 x = edje_edit_state_aspect_pref_get(ed, part, state, value);
330 str = aspect_pref_name_get(x);
331 if (machine) printf("ASPECT-PREFERENCE: %s\n", str);
332 else if (x) printf(INDENT4 "aspect_preference: %s;\n", str);
333 /* do not free this str! */
334
335 str = edje_edit_state_color_class_get(ed, part, state, value);
336 if (machine) printf("COLOR_CLASS: %s\n", str ? str : "");
337 else if (str) printf(INDENT4 "color_class: \"%s\";\n", str);
338 edje_edit_string_free(str);
339 }
340
341 dx = edje_edit_state_rel1_relative_x_get(ed, part, state, value);
342 dy = edje_edit_state_rel1_relative_y_get(ed, part, state, value);
343 x = edje_edit_state_rel1_offset_x_get(ed, part, state, value);
344 y = edje_edit_state_rel1_offset_y_get(ed, part, state, value);
345 str = edje_edit_state_rel1_to_x_get(ed, part, state, value);
346 str2 = edje_edit_state_rel1_to_y_get(ed, part, state, value);
347 if (FDIFF(dx, 0.0) || FDIFF(dy, 0.0) || (x) || (y) || (str) || (str2))
348 {
349 if (machine) puts("REL1-BEGIN");
350 else puts(INDENT4 "rel1 {");
351
352 if (machine) printf("RELATIVE-X: %g\nRELATIVE-Y: %g\n", dx, dy);
353 else if (FDIFF(dx, 0.0) || FDIFF(dy, 0.0))
354 printf(INDENT5 "relative: %g %g;\n", dx, dy);
355
356 if (machine) printf("OFFSET-X: %d\nOFFSET-Y: %d\n", x, y);
357 else if ((x) || (y)) printf(INDENT5 "offset: %d %d;\n", x, y);
358
359 if (machine)
360 printf("TO-X: %s\nTO-Y: %s\n", str ? str : "", str2 ? str2 : "");
361 else if (((str) && (str2)) && (!strcmp(str, str2)))
362 printf(INDENT5 "to: \"%s\";\n", str);
363 else
364 {
365 if (str) printf(INDENT5 "to_x: \"%s\";\n", str);
366 if (str2) printf(INDENT5 "to_y: \"%s\";\n", str2);
367 }
368
369 if (machine) puts("REL1-END");
370 else puts(INDENT4 "}");
371 }
372 edje_edit_string_free(str);
373 edje_edit_string_free(str2);
374
375 dx = edje_edit_state_rel2_relative_x_get(ed, part, state, value);
376 dy = edje_edit_state_rel2_relative_y_get(ed, part, state, value);
377 x = edje_edit_state_rel2_offset_x_get(ed, part, state, value);
378 y = edje_edit_state_rel2_offset_y_get(ed, part, state, value);
379 str = edje_edit_state_rel2_to_x_get(ed, part, state, value);
380 str2 = edje_edit_state_rel2_to_y_get(ed, part, state, value);
381 if (FDIFF(dx, 1.0) || FDIFF(dy, 1.0) || (x != -1) || (y != -1) ||
382 (str) || (str2))
383 {
384 if (machine) puts("REL2-BEGIN");
385 else puts(INDENT4 "rel2 {");
386
387 if (machine) printf("RELATIVE-X: %g\nRELATIVE-Y: %g\n", dx, dy);
388 else if (FDIFF(dx, 1.0) || FDIFF(dy, 1.0))
389 printf(INDENT5 "relative: %g %g;\n", dx, dy);
390
391 if (machine) printf("OFFSET-X: %d\nOFFSET-Y: %d\n", x, y);
392 else if ((x != -1) || (y != -1))
393 printf(INDENT5 "offset: %d %d;\n", x, y);
394
395 if (machine)
396 printf("TO-X: %s\nTO-Y: %s\n", str ? str : "", str2 ? str2 : "");
397 else if (((str) && (str2)) && (!strcmp(str, str2)))
398 printf(INDENT5 "to: \"%s\";\n", str);
399 else
400 {
401 if (str) printf(INDENT5 "to_x: \"%s\";\n", str);
402 if (str2) printf(INDENT5 "to_y: \"%s\";\n", str2);
403 }
404
405 if (machine) puts("REL2-END");
406 else puts(INDENT4 "}");
407 }
408 edje_edit_string_free(str);
409 edje_edit_string_free(str2);
410
411 if (t == EDJE_PART_TYPE_IMAGE)
412 {
413 str = edje_edit_state_image_get(ed, part, state, value);
414
415 if (machine) printf("IMAGE-BEGIN\nNORMAL: %s\n", str ? str : "");
416 else if (detail > 1)
417 {
418 puts(INDENT4 "image {");
419 if (str) printf(INDENT5 "normal: \"%s\";\n", str);
420 }
421 else if (str) printf(INDENT4 "image.normal: \"%s\";\n", str);
422
423 edje_edit_string_free(str);
424
425 if (detail > 1)
426 {
427 Eina_List *tweens, *l;
428 int bl, br, bt, bb, x2, y2;
429 double dx2, dy2;
430 Eina_Bool has_orgin, has_size;
431
432 tweens = edje_edit_state_tweens_list_get(ed, part, state, value);
433 EINA_LIST_FOREACH(tweens, l, str)
434 {
435 if (machine) printf("TWEEN: %s\n", str);
436 else printf(INDENT5 "tween: \"%s\";\n", str);
437 }
438 edje_edit_string_list_free(tweens);
439
440 edje_edit_state_image_border_get
441 (ed, part, state, value, &bl, &br, &bt, &bb);
442 if (machine)
443 printf("BORDER-LEFT: %d\nBORDER-RIGHT: %d\n"
444 "BORDER-TOP: %d\nBORDER-BOTTOM: %d\n", bl, br, bt, bb);
445 else if ((bl) || (br) || (bt) || (bb))
446 printf(INDENT5 "border: %d %d %d %d;\n", bl, br, bt, bb);
447
448 x = edje_edit_state_image_border_fill_get(ed, part, state, value);
449 str = border_fill_name_get(x);
450 if (machine) printf("BORDER-FILL: %s\n", str);
451 else if (x != 1) printf(INDENT5 "middle: %s;\n", str);
452 /* do not free str! */
453
454 // TODO support image.fill.smooth
455
456 dx = edje_edit_state_fill_origin_relative_x_get
457 (ed, part, state, value);
458 dy = edje_edit_state_fill_origin_relative_y_get
459 (ed, part, state, value);
460 x = edje_edit_state_fill_origin_offset_x_get
461 (ed, part, state, value);
462 y = edje_edit_state_fill_origin_offset_y_get
463 (ed, part, state, value);
464
465 dx2 = edje_edit_state_fill_size_relative_x_get
466 (ed, part, state, value);
467 dy2 = edje_edit_state_fill_size_relative_y_get
468 (ed, part, state, value);
469 x2 = edje_edit_state_fill_size_offset_x_get
470 (ed, part, state, value);
471 y2 = edje_edit_state_fill_size_offset_y_get
472 (ed, part, state, value);
473
474 has_orgin = (FDIFF(dx, 0.0) || FDIFF(dy, 0.0) || (x) || (y));
475 has_size = (FDIFF(dx2, 1.0) || FDIFF(dy2, 1.0) || (x2) || (y2));
476
477 if ((has_orgin) || (has_size))
478 {
479 if (machine) puts("IMAGE-FILL-BEGIN");
480 else puts(INDENT5 "fill {");
481
482 if (has_orgin)
483 {
484 if (machine)
485 printf("ORIGIN-RELATIVE-X: %g\n"
486 "ORIGIN-RELATIVE-Y: %g\n"
487 "ORIGIN-OFFSET-X: %d\n"
488 "ORIGIN-OFFSET-Y: %d\n",
489 dx, dy, x, y);
490 else
491 printf(INDENT6 "origin {\n"
492 INDENT7 "relative: %g %g;\n"
493 INDENT7 "offset: %d %d;\n"
494 INDENT6 "}\n",
495 dx, dy, x, y);
496 }
497
498 if (has_size)
499 {
500 if (machine)
501 printf("SIZE-RELATIVE-X: %g\n"
502 "SIZE-RELATIVE-Y: %g\n"
503 "SIZE-OFFSET-X: %d\n"
504 "SIZE-OFFSET-Y: %d\n",
505 dx2, dy2, x2, y2);
506 else
507 printf(INDENT6 "size {\n"
508 INDENT7 "relative: %g %g;\n"
509 INDENT7 "offset: %d %d;\n"
510 INDENT6 "}\n",
511 dx2, dy2, x2, y2);
512 }
513
514 if (machine) puts("IMAGE-FILL-END");
515 else puts(INDENT5 "}");
516 }
517 }
518
519 if (machine) puts("IMAGE-END");
520 else if (detail > 1) puts(INDENT4 "}");
521 }
522 else if (t == EDJE_PART_TYPE_PROXY)
523 {
524 int x2, y2;
525 double dx2, dy2;
526 Eina_Bool has_orgin, has_size;
527
528 if (machine) puts("PROXY-BEGIN");
529 else puts(INDENT4 "proxy {");
530 // TODO Support source
531 // TODO support proxy.fill.smooth
532
533 dx = edje_edit_state_fill_origin_relative_x_get
534 (ed, part, state, value);
535 dy = edje_edit_state_fill_origin_relative_y_get
536 (ed, part, state, value);
537 x = edje_edit_state_fill_origin_offset_x_get
538 (ed, part, state, value);
539 y = edje_edit_state_fill_origin_offset_y_get
540 (ed, part, state, value);
541
542 dx2 = edje_edit_state_fill_size_relative_x_get
543 (ed, part, state, value);
544 dy2 = edje_edit_state_fill_size_relative_y_get
545 (ed, part, state, value);
546 x2 = edje_edit_state_fill_size_offset_x_get
547 (ed, part, state, value);
548 y2 = edje_edit_state_fill_size_offset_y_get
549 (ed, part, state, value);
550
551 has_orgin = (FDIFF(dx, 0.0) || FDIFF(dy, 0.0) || (x) || (y));
552 has_size = (FDIFF(dx2, 1.0) || FDIFF(dy2, 1.0) || (x2) || (y2));
553
554 if ((has_orgin) || (has_size))
555 {
556 if (machine) puts("PROXY-FILL-BEGIN");
557 else puts(INDENT5 "fill {");
558
559 if (has_orgin)
560 {
561 if (machine)
562 printf("ORIGIN-RELATIVE-X: %g\n"
563 "ORIGIN-RELATIVE-Y: %g\n"
564 "ORIGIN-OFFSET-X: %d\n"
565 "ORIGIN-OFFSET-Y: %d\n",
566 dx, dy, x, y);
567 else
568 printf(INDENT6 "origin {\n"
569 INDENT7 "relative: %g %g;\n"
570 INDENT7 "offset: %d %d;\n"
571 INDENT6 "}\n",
572 dx, dy, x, y);
573 }
574
575 if (has_size)
576 {
577 if (machine)
578 printf("SIZE-RELATIVE-X: %g\n"
579 "SIZE-RELATIVE-Y: %g\n"
580 "SIZE-OFFSET-X: %d\n"
581 "SIZE-OFFSET-Y: %d\n",
582 dx2, dy2, x2, y2);
583 else
584 printf(INDENT6 "size {\n"
585 INDENT7 "relative: %g %g;\n"
586 INDENT7 "offset: %d %d;\n"
587 INDENT6 "}\n",
588 dx2, dy2, x2, y2);
589 }
590
591 if (machine) puts("PROXY-FILL-END");
592 else puts(INDENT5 "}");
593 }
594
595 if (machine) puts("PROXY-END");
596 else puts(INDENT4 "}");
597 }
598 else if ((t == EDJE_PART_TYPE_TEXTBLOCK) || (t == EDJE_PART_TYPE_TEXT))
599 {
600 if (machine) puts("TEXT-BEGIN");
601 else puts(INDENT4 "text {");
602
603 str = edje_edit_state_text_get(ed, part, state, value);
604 if (machine) printf("TEXT: %s\n", str ? str : "");
605 else if (str) printf(INDENT5 "text: \"%s\";\n", str);
606 edje_edit_string_free(str);
607
608 str = edje_edit_state_font_get(ed, part, state, value);
609 if (machine) printf("FONT: %s\n", str ? str : "");
610 else if (str) printf(INDENT5 "font: \"%s\";\n", str);
611 edje_edit_string_free(str);
612
613 x = edje_edit_state_text_size_get(ed, part, state, value);
614 if (machine) printf("SIZE: %d\n", x);
615 else if (x > 0) printf(INDENT5 "size: %d;\n", x);
616
617 // TODO text_class
618
619 dx = edje_edit_state_text_align_x_get(ed, part, state, value);
620 dy = edje_edit_state_text_align_y_get(ed, part, state, value);
621 if (machine) printf("TEXT-ALIGN-X: %g\nTEXT-ALIGN-Y: %g\n", dx, dy);
622 else if (FDIFF(dx, 0.5) || FDIFF(dy, 0.5))
623 printf(INDENT5 "align: %g %g;\n", dx, dy);
624
625 x = edje_edit_state_text_fit_x_get(ed, part, state, value);
626 y = edje_edit_state_text_fit_y_get(ed, part, state, value);
627 if (machine) printf("TEXT-FIT-X: %d\nTEXT-FIT-Y: %d\n", x, y);
628 else if ((x) || (y)) printf(INDENT5 "fit: %d %d;\n", x, y);
629
630 dx = edje_edit_state_text_elipsis_get(ed, part, state, value);
631 if (machine) printf("TEXT-ELIPSIS: %g\n", dx);
632 else if (FDIFF(dx, 0.5)) printf(INDENT5 "elipsis: %g;\n", dx);
633
634 if (machine) puts("TEXT-END");
635 else puts(INDENT4 "}");
636 }
637 else if (t == EDJE_PART_TYPE_EXTERNAL)
638 {
639 const Eina_List *params, *l;
640 const Edje_External_Param *p;
641
642 params = edje_edit_state_external_params_list_get
643 (ed, part, state, value);
644
645 if (params)
646 {
647 if (machine) puts("PARAMS-BEGIN");
648 else puts(INDENT4 "params {");
649
650 EINA_LIST_FOREACH(params, l, p)
651 switch (p->type)
652 {
653 case EDJE_EXTERNAL_PARAM_TYPE_INT:
654 printf(INDENT5 "int: \"%s\" \"%d\";\n", p->name, p->i);
655 break;
656 case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
657 printf(INDENT5 "double: \"%s\" \"%g\";\n", p->name, p->d);
658 break;
659 case EDJE_EXTERNAL_PARAM_TYPE_STRING:
660 if (p->s)
661 printf(INDENT5 "string: \"%s\" \"%s\";\n",
662 p->name, p->s);
663 break;
664 case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
665 printf(INDENT5 "bool: \"%s\" \"%d\";\n", p->name, p->i);
666 break;
667 case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
668 if (p->s)
669 printf(INDENT5 "choice: \"%s\" \"%s\";\n",
670 p->name, p->s);
671 break;
672 default:
673 break;
674 }
675
676 if (machine) puts("PARAMS-END");
677 else puts(INDENT4 "}");
678 }
679 }
680}
681
682static void
683state_end(void)
684{
685 if (machine) puts("PART-STATE-END");
686 else if (detail > 0) puts(INDENT3 "}");
687 else puts(" }");
688}
689
690static void
691part_begin(Evas_Object *ed, const char *name)
692{
693 const char *type = part_type_name_get(edje_edit_part_type_get(ed, name));
694 if (machine) printf("PART-BEGIN\nNAME: %s\nTYPE: %s\n", name, type);
695 else
696 {
697 printf(INDENT2 "part { name: '%s'; type: %s;", name, type);
698 if (detail > 0) putchar('\n');
699 }
700}
701
702static const char *
703text_effect_name_get(Edje_Text_Effect effect)
704{
705 switch (effect)
706 {
707 case EDJE_TEXT_EFFECT_NONE:
708 return "NONE";
709 case EDJE_TEXT_EFFECT_PLAIN:
710 return "PLAIN";
711 case EDJE_TEXT_EFFECT_OUTLINE:
712 return "OUTLINE";
713 case EDJE_TEXT_EFFECT_SOFT_OUTLINE:
714 return "SOFT_OUTLINE";
715 case EDJE_TEXT_EFFECT_SHADOW:
716 return "SHADOW";
717 case EDJE_TEXT_EFFECT_SOFT_SHADOW:
718 return "SOFT_SHADOW";
719 case EDJE_TEXT_EFFECT_OUTLINE_SHADOW:
720 return "OUTLINE_SHADOW";
721 case EDJE_TEXT_EFFECT_OUTLINE_SOFT_SHADOW:
722 return "OUTLINE_SOFT_SHADOW";
723 case EDJE_TEXT_EFFECT_FAR_SHADOW:
724 return "FAR_SHADOW";
725 case EDJE_TEXT_EFFECT_FAR_SOFT_SHADOW:
726 return "FAR_SOFT_SHADOW";
727 case EDJE_TEXT_EFFECT_GLOW:
728 return "GLOW";
729
730 case EDJE_TEXT_EFFECT_LAST:
731 ERR("Invalid part type %d", effect);
732 return "???";
733 default:
734 ERR("Unknown effect type %d", effect);
735 return "???";
736 }
737}
738
739static inline Eina_Bool
740_c_id_allowed(char c)
741{
742 if ((c >= '0') && (c <= '9')) return EINA_TRUE;
743 if ((c >= 'a') && (c <= 'z')) return EINA_TRUE;
744 if ((c >= 'A') && (c <= 'Z')) return EINA_TRUE;
745 return EINA_FALSE;
746}
747
748static char *
749_api_name_fix(const char *orig)
750{
751 char *d, *d_end, buf[256];
752 const char *s;
753
754 if (!orig) return NULL;
755 if (!api_fix) return strdup(orig);
756
757 s = orig;
758 d = buf;
759 d_end = d + sizeof(buf) - 1;
760 for (; (*s != '\0') && (d < d_end); s++, d++)
761 if (_c_id_allowed(*s)) *d = *s;
762 else *d = '_';
763 *d = '\0';
764
765 return strdup(buf);
766}
767
768static char *
769_part_api_name_get(Evas_Object *ed, const char *part)
770{
771 const char *orig = edje_edit_part_api_name_get(ed, part);
772 char *fix = _api_name_fix(orig);
773 edje_edit_string_free(orig);
774 return fix;
775}
776
777static void
778part_details(Evas_Object *ed, const char *part)
779{
780 Eina_List *states, *l;
781 Eina_Bool b;
782 const char *str, *str2;
783 char *api;
784
785 if (detail < 1) return;
786
787 if (machine) puts("PART-DETAILS-BEGIN");
788
789 str = api =_part_api_name_get(ed, part);
790 str2 = edje_edit_part_api_description_get(ed, part);
791 if (machine)
792 {
793 printf("API-NAME: %s\n", str ? str : "");
794 printf("API-DESCRIPTION: %s\n", str2 ? str2 : "");
795 }
796 else if ((str) || (str2))
797 printf(INDENT3 "api: \"%s\" \"%s\";\n", str ? str : "", str2 ? str2 : "");
798 free(api);
799 edje_edit_string_free(str2);
800
801 b = edje_edit_part_mouse_events_get(ed, part);
802 if (machine) printf("MOUSE_EVENTS: %d\n", b);
803 else if (!b) puts(INDENT3 "mouse_events: 0;");
804
805 if (detail > 1)
806 {
807 b = edje_edit_part_repeat_events_get(ed, part);
808 if (machine) printf("REPEAT_EVENTS: %d\n", b);
809 else if (b) puts(INDENT3 "repeat_events: 1;");
810
811 b = edje_edit_part_scale_get(ed, part);
812 if (machine) printf("SCALE: %d\n", b);
813 else if (b) puts(INDENT3 "scale: 1;");
814 }
815
816 str = edje_edit_part_clip_to_get(ed, part);
817 if (machine) printf("CLIP_TO: %s\n", str ? str : "");
818 else if (str) printf(INDENT3 "clip_to: \"%s\";\n", str);
819 edje_edit_string_free(str);
820
821 str = edje_edit_part_source_get(ed, part);
822 if (machine) printf("SOURCE: %s\n", str ? str : "");
823 else if (str) printf(INDENT3 "source: \"%s\";\n", str);
824 edje_edit_string_free(str);
825
826 if (detail > 1)
827 {
828 if (edje_edit_part_type_get(ed, part) == EDJE_PART_TYPE_TEXT)
829 {
830 str = text_effect_name_get(edje_edit_part_effect_get(ed, part));
831 if (machine) printf("EFFECT: %s\n", str ? str : "");
832 else if (str) printf(INDENT3 "effect: %s;\n", str);
833 /* do not free this str! */
834 }
835
836 if (edje_edit_part_drag_x_get(ed, part) ||
837 edje_edit_part_drag_y_get(ed, part))
838 {
839 int dir, step, count;
840
841 if (machine) puts("DRAGABLE-BEGIN");
842 else puts(INDENT3 "dragable {");
843
844 dir = edje_edit_part_drag_x_get(ed, part);
845 step = edje_edit_part_drag_step_x_get(ed, part);
846 count = edje_edit_part_drag_count_x_get(ed, part);
847 if (machine) printf("DRAG-X: %d %d %d\n", dir, step, count);
848 else printf(INDENT4 "x: %d %d %d;\n", dir, step, count);
849
850 dir = edje_edit_part_drag_y_get(ed, part);
851 step = edje_edit_part_drag_step_y_get(ed, part);
852 count = edje_edit_part_drag_count_y_get(ed, part);
853 if (machine) printf("DRAG-Y: %d %d %d\n", dir, step, count);
854 else printf(INDENT4 "y: %d %d %d;\n", dir, step, count);
855
856 str = edje_edit_part_drag_confine_get(ed, part);
857 if (machine) printf("DRAG-CONFINE: %s\n", str ? str : "");
858 else if (str) printf(INDENT4 "confine: \"%s\";\n", str);
859 edje_edit_string_free(str);
860
861 str = edje_edit_part_drag_event_get(ed, part);
862 if (machine) printf("DRAG-EVENTS: %s\n", str ? str : "");
863 else if (str) printf(INDENT4 "events: \"%s\";\n", str);
864 edje_edit_string_free(str);
865
866 if (machine) puts("DRAGABLE-END");
867 else puts(INDENT3 "}");
868 }
869 }
870
871 states = edje_edit_part_states_list_get(ed, part);
872 EINA_LIST_FOREACH(states, l, str)
873 {
874 char state[512], *delim;
875 double value;
876 eina_strlcpy(state, str, sizeof(state)); /* bad states_list! :-( */
877 delim = strchr(state, ' ');
878 *delim = '\0';
879 delim++;
880 value = strtod(delim, NULL);
881 state_begin(state, value);
882 state_details(ed, part, state, value);
883 state_end();
884 }
885 edje_edit_string_list_free(states);
886
887 if (machine) puts("PART-DETAILS-END");
888}
889
890static void
891part_end(void)
892{
893 if (machine) puts("PART-END");
894 else if (detail > 0) puts(INDENT2 "}");
895 else puts(" }");
896}
897
898static int
899_groups_names_list(void)
900{
901 Eina_List *l;
902 const char *name;
903 Eina_Bool found = EINA_FALSE;
904
905 EINA_LIST_FOREACH(groups, l, name)
906 {
907 if (!matches(name, group))
908 {
909 DBG("filter out group '%s': does not match '%s'", name, group);
910 continue;
911 }
912 found = EINA_TRUE;
913 puts(name);
914 }
915
916 if (!found) WRN("no groups match '%s'", group);
917 return !found;
918}
919
920static int
921_parts_names_list(void)
922{
923 Eina_List *gl, *pl, *parts;
924 const char *gname, *pname;
925 Eina_Bool found_group = EINA_FALSE, found_part = EINA_FALSE;
926
927 EINA_LIST_FOREACH(groups, gl, gname)
928 {
929 Evas_Object *ed;
930
931 if (!matches(gname, group))
932 {
933 DBG("filter out group '%s': does not match '%s'", gname, group);
934 continue;
935 }
936
937 ed = edje_edit_object_add(ecore_evas_get(ee));
938 if (!edje_object_file_set(ed, file, gname))
939 {
940 Edje_Load_Error err = edje_object_load_error_get(ed);
941 const char *errmsg = edje_load_error_str(err);
942 ERR("could not load group '%s' from file '%s': %s",
943 gname, file, errmsg);
944 evas_object_del(ed);
945 continue;
946 }
947
948 found_group = EINA_TRUE;
949 group_begin(gname);
950
951 parts = edje_edit_parts_list_get(ed);
952 EINA_LIST_FOREACH(parts, pl, pname)
953 {
954 if (!matches(pname, part))
955 {
956 DBG("filter out part '%s': does not match '%s'", pname, part);
957 continue;
958 }
959 if (api_only)
960 {
961 if (!edje_edit_part_api_name_get(ed, pname))
962 {
963 DBG("filter out part '%s': not API.", pname);
964 continue;
965 }
966 }
967 if (machine) printf("PART: %s\n", pname);
968 else printf(INDENT "part: %s\n", pname);
969 }
970 edje_edit_string_list_free(parts);
971
972 group_end();
973 evas_object_del(ed);
974 }
975
976 if (!found_group) WRN("no groups match '%s'", group);
977 if (!found_part) WRN("no parts match '%s'", part);
978 return (!found_group) || (!found_part);
979}
980
981static Eina_Bool
982_group_parts_list(Evas_Object *ed)
983{
984 Eina_Bool found = EINA_FALSE;
985 Eina_List *parts, *l;
986 const char *name;
987
988 parts_begin();
989
990 parts = edje_edit_parts_list_get(ed);
991 EINA_LIST_FOREACH(parts, l, name)
992 {
993 if (!matches(name, part))
994 {
995 DBG("filter out part '%s': does not match '%s'", name, part);
996 continue;
997 }
998 if (api_only)
999 {
1000 if (!edje_edit_part_api_name_get(ed, name))
1001 {
1002 DBG("filter out part '%s': not API.", name);
1003 continue;
1004 }
1005 }
1006
1007 found = EINA_TRUE;
1008 part_begin(ed, name);
1009 part_details(ed, name);
1010 part_end();
1011 }
1012
1013 parts_end();
1014 return found;
1015}
1016
1017static void
1018programs_begin(void)
1019{
1020 if (machine) puts("PROGRAMS-BEGIN");
1021 else puts(INDENT "programs {");
1022}
1023
1024static void
1025programs_end(void)
1026{
1027 if (machine) puts("PROGRAMS-END");
1028 else puts(INDENT "}");
1029}
1030
1031static void
1032program_begin(const char *name)
1033{
1034 if (machine) printf("PROGRAM-BEGIN\nNAME: %s\n", name ? name : "");
1035 else
1036 {
1037 printf(INDENT2 "program { name: '%s';\n", name ? name : "");
1038 }
1039}
1040
1041static void
1042program_end(void)
1043{
1044 if (machine) puts("PROGRAM-END");
1045 else puts(INDENT2 "}");
1046}
1047
1048
1049static char *
1050_program_api_name_get(Evas_Object *ed, const char *program)
1051{
1052 const char *orig = edje_edit_program_api_name_get(ed, program);
1053 char *fix = _api_name_fix(orig);
1054 edje_edit_string_free(orig);
1055 return fix;
1056}
1057
1058static const char *
1059_transition_name_get(Edje_Tween_Mode mode)
1060{
1061 switch (mode)
1062 {
1063 case EDJE_TWEEN_MODE_LINEAR: return "LINEAR";
1064 case EDJE_TWEEN_MODE_ACCELERATE: return "ACCELERATE";
1065 case EDJE_TWEEN_MODE_DECELERATE: return "DECELERATE";
1066 case EDJE_TWEEN_MODE_SINUSOIDAL: return "SINUSOIDAL";
1067 default:
1068 ERR("Unknown transition mode %d", mode);
1069 return "???";
1070 }
1071}
1072
1073static void
1074program_details(Evas_Object *ed, const char *program)
1075{
1076 const char *str, *str2;
1077 char *api;
1078
1079 if (detail < 1) return;
1080
1081 if (machine) puts("PROGRAM-DETAILS-BEGIN");
1082
1083 str = api =_program_api_name_get(ed, program);
1084 str2 = edje_edit_program_api_description_get(ed, program);
1085 if (machine)
1086 {
1087 printf("API-NAME: %s\n", str ? str : "");
1088 printf("API-DESCRIPTION: %s\n", str2 ? str2 : "");
1089 }
1090 else if ((str) || (str2))
1091 printf(INDENT3 "api: \"%s\" \"%s\";\n", str ? str : "", str2 ? str2 : "");
1092 free(api);
1093 edje_edit_string_free(str2);
1094
1095 str = edje_edit_program_signal_get(ed, program);
1096 if (machine) printf("SIGNAL: %s\n", str ? str : "");
1097 else if (str) printf(INDENT3 "signal: \"%s\";\n", str);
1098 edje_edit_string_free(str);
1099
1100 str = edje_edit_program_source_get(ed, program);
1101 if (machine) printf("SOURCE: %s\n", str ? str : "");
1102 else if (str) printf(INDENT3 "source: \"%s\";\n", str);
1103 edje_edit_string_free(str);
1104
1105 if (detail >= 1)
1106 {
1107 Eina_List *lst, *l;
1108 Edje_Action_Type type = edje_edit_program_action_get(ed, program);
1109 switch (type)
1110 {
1111 case EDJE_ACTION_TYPE_ACTION_STOP:
1112 if (machine) puts("ACTION: ACTION_STOP");
1113 else puts(INDENT3 "action: ACTION_STOP;");
1114 break;
1115 case EDJE_ACTION_TYPE_STATE_SET:
1116 str = edje_edit_program_state_get(ed, program);
1117 if (machine)
1118 printf("ACTION: STATE_SET\nACTION-STATE: %s %g\n",
1119 str, edje_edit_program_value_get(ed, program));
1120 else
1121 printf(INDENT3 "action: STATE_SET \"%s\" %2.1f;\n",
1122 str, edje_edit_program_value_get(ed, program));
1123 edje_edit_string_free(str);
1124 break;
1125 case EDJE_ACTION_TYPE_SIGNAL_EMIT:
1126 str = edje_edit_program_state_get(ed, program);
1127 str2 = edje_edit_program_state2_get(ed, program);
1128 if (machine)
1129 printf("ACTION: SIGNAL_EMIT\nACTION-SIGNAL: %s\n"
1130 "ACTION-SOURCE: %s\n",
1131 str ? str : "", str2 ? str2 : "");
1132 else if ((str) || (str2))
1133 printf(INDENT3 "action: SIGNAL_EMIT \"%s\" \"%s\";\n",
1134 str ? str : "", str2 ? str2 : "");
1135 edje_edit_string_free(str);
1136 edje_edit_string_free(str2);
1137 break;
1138 //TODO Support Drag
1139 //~ case EDJE_ACTION_TYPE_DRAG_VAL_SET:
1140 //~ eina_strbuf_append(buf, I4"action: DRAG_VAL_SET TODO;\n");
1141 //~ break;
1142 //~ case EDJE_ACTION_TYPE_DRAG_VAL_STEP:
1143 //~ eina_strbuf_append(buf, I4"action: DRAG_VAL_STEP TODO;\n");
1144 //~ break;
1145 //~ case EDJE_ACTION_TYPE_DRAG_VAL_PAGE:
1146 //~ eina_strbuf_append(buf, I4"action: DRAG_VAL_PAGE TODO;\n");
1147 //~ break;
1148 default:
1149 ERR("Unhandled program action type %d", type);
1150 break;
1151 }
1152
1153 if (detail > 1)
1154 {
1155 double from, range;
1156
1157 from = edje_edit_program_transition_time_get(ed, program);
1158 if (from > 0.0)
1159 {
1160 str = _transition_name_get
1161 (edje_edit_program_transition_get(ed, program));
1162 if (machine)
1163 printf("TRANSITION-NAME: %s\nTRANSITION-DURATION: %g\n",
1164 str, from);
1165 else printf(INDENT3 "transition: %s %g;\n", str, from);
1166 /* do not free str! */
1167 }
1168
1169 from = edje_edit_program_in_from_get(ed, program);
1170 range = edje_edit_program_in_range_get(ed, program);
1171 if (FDIFF(from, 0.0) || FDIFF(range, 0.0))
1172 {
1173 if (machine)
1174 printf("IN-FROM: %g\nIN-RANGE: %g\n", from, range);
1175 else printf(INDENT3 "in: %g %g;\n", from, range);
1176 }
1177 }
1178
1179 lst = edje_edit_program_targets_get(ed, program);
1180 EINA_LIST_FOREACH(lst, l, str)
1181 if (machine) printf("TARGET: %s\n", str);
1182 else printf(INDENT3 "target: \"%s\";\n", str);
1183 edje_edit_string_list_free(lst);
1184
1185 lst = edje_edit_program_afters_get(ed, program);
1186 EINA_LIST_FOREACH(lst, l, str)
1187 if (machine) printf("AFTER: %s\n", str);
1188 else printf(INDENT3 "after: \"%s\";\n", str);
1189 edje_edit_string_list_free(lst);
1190
1191 // TODO Support script {}
1192 }
1193
1194 if (machine) puts("PROGRAM-DETAILS-END");
1195}
1196
1197static Eina_Bool
1198_group_programs_list(Evas_Object *ed)
1199{
1200 Eina_Bool found = EINA_FALSE;
1201 Eina_List *programs, *l;
1202 const char *name;
1203
1204 programs_begin();
1205
1206 /* TODO: change programs to operate on their ID instead of names!
1207 * needs huge change in Edje_Edit.h
1208 */
1209 WRN("listing only programs with names!");
1210 programs = edje_edit_programs_list_get(ed);
1211 EINA_LIST_FOREACH(programs, l, name)
1212 {
1213 if (!matches(name, program))
1214 {
1215 DBG("filter out program '%s': does not match '%s'", name, program);
1216 continue;
1217 }
1218 if (api_only)
1219 {
1220 if (!edje_edit_program_api_name_get(ed, name))
1221 {
1222 DBG("filter out program '%s': not API.", name);
1223 continue;
1224 }
1225 }
1226
1227 found = EINA_TRUE;
1228 program_begin(name);
1229 program_details(ed, name);
1230 program_end();
1231 }
1232
1233 programs_end();
1234 return found;
1235}
1236
1237static int
1238_list(const char *mode)
1239{
1240 Eina_List *l;
1241 const char *name;
1242 int ret = 0;
1243 Eina_Bool found_group = EINA_FALSE;
1244 Eina_Bool req_part, found_part, req_prog, found_prog;
1245
1246 if ((!strcmp(mode, "parts")) || (!strcmp(mode, "groups")))
1247 {
1248 req_part = EINA_TRUE;
1249 found_part = EINA_FALSE;
1250 }
1251 else
1252 {
1253 req_part = EINA_FALSE;
1254 found_part = EINA_TRUE;
1255 }
1256
1257 if ((!strcmp(mode, "programs")) || (!strcmp(mode, "groups")))
1258 {
1259 req_prog = EINA_TRUE;
1260 found_prog = EINA_FALSE;
1261 }
1262 else
1263 {
1264 req_prog = EINA_FALSE;
1265 found_prog = EINA_TRUE;
1266 }
1267
1268 EINA_LIST_FOREACH(groups, l, name)
1269 {
1270 Evas_Object *ed;
1271
1272 if (!matches(name, group))
1273 {
1274 DBG("filter out group '%s': does not match '%s'", name, group);
1275 continue;
1276 }
1277
1278 ed = edje_edit_object_add(ecore_evas_get(ee));
1279 if (!edje_object_file_set(ed, file, name))
1280 {
1281 Edje_Load_Error err = edje_object_load_error_get(ed);
1282 const char *errmsg = edje_load_error_str(err);
1283 ERR("could not load group '%s' from file '%s': %s",
1284 name, file, errmsg);
1285 evas_object_del(ed);
1286 continue;
1287 }
1288
1289 found_group = EINA_TRUE;
1290 group_begin(name);
1291 group_details(ed);
1292
1293 if (req_part) found_part |= _group_parts_list(ed);
1294 if (req_prog) found_prog |= _group_programs_list(ed);
1295
1296 group_end();
1297 evas_object_del(ed);
1298 }
1299
1300 /* no hard requirement for parts or programs for group listing */
1301 if (!strcmp(mode, "groups")) req_part = req_prog = EINA_FALSE;
1302
1303 if (!found_group)
1304 {
1305 WRN("no groups match '%s'", group);
1306 ret = 1;
1307 }
1308 if ((req_part) && (!found_part))
1309 {
1310 WRN("no parts match '%s'", part);
1311 ret = 1;
1312 }
1313 if ((req_prog) && (!found_prog))
1314 {
1315 WRN("no programs match '%s'", program);
1316 ret = 1;
1317 }
1318 return ret;
1319}
1320
1321static Evas_Object *
1322_edje_object_any_get(void)
1323{
1324 Evas_Object *ed = edje_edit_object_add(ecore_evas_get(ee));
1325 Eina_List *l;
1326 const char *name;
1327 if (!ed) return NULL;
1328 EINA_LIST_FOREACH(groups, l, name)
1329 if (edje_object_file_set(ed, file, name)) return ed;
1330 evas_object_del(ed);
1331 return NULL;
1332}
1333
1334static Eina_Bool
1335_gdata_list(void)
1336{
1337 Evas_Object *ed = _edje_object_any_get();
1338 Eina_List *l, *data;
1339 const char *key;
1340
1341 if (!ed) return EINA_FALSE;
1342
1343 data = edje_edit_data_list_get(ed);
1344
1345 if (machine) puts("DATA-BEGIN");
1346 else puts("data {");
1347
1348 EINA_LIST_FOREACH(data, l, key)
1349 {
1350 const char *value = edje_edit_data_value_get(ed, key);
1351 if (machine) printf("ITEM: \"%s\" \"%s\"\n", key, value);
1352 else printf(INDENT "item: \"%s\" \"%s\";\n", key, value);
1353 }
1354
1355 if (machine) puts("DATA-END");
1356 else puts("}");
1357
1358 edje_edit_string_list_free(data);
1359 evas_object_del(ed);
1360 return EINA_TRUE;
1361}
1362
1363static const char *
1364_comp_str_get(Evas_Object *ed, const char *img)
1365{
1366 static char buf[128];
1367 Edje_Edit_Image_Comp type = edje_edit_image_compression_type_get(ed, img);
1368 int rate;
1369
1370 switch (type)
1371 {
1372 case EDJE_EDIT_IMAGE_COMP_RAW:
1373 return "RAW";
1374 case EDJE_EDIT_IMAGE_COMP_USER:
1375 return "USER";
1376 case EDJE_EDIT_IMAGE_COMP_COMP:
1377 return "COMP";
1378 case EDJE_EDIT_IMAGE_COMP_LOSSY:
1379 rate = edje_edit_image_compression_rate_get(ed, img);
1380 snprintf(buf, sizeof(buf), "LOSSY %d", rate);
1381 return buf;
1382 default:
1383 ERR("Unknown compression type %d", type);
1384 return "???";
1385 }
1386}
1387
1388static Eina_Bool
1389_images_list(void)
1390{
1391 Evas_Object *ed = _edje_object_any_get();
1392 Eina_List *l, *images;
1393 const char *img;
1394
1395 if (!ed) return EINA_FALSE;
1396
1397 images = edje_edit_images_list_get(ed);
1398
1399 if (machine) puts("IMAGES-BEGIN");
1400 else puts("images {");
1401
1402 EINA_LIST_FOREACH(images, l, img)
1403 {
1404 int id = edje_edit_image_id_get(ed, img);
1405 const char *comp = _comp_str_get(ed, img);
1406
1407 if (detail < 1)
1408 {
1409 if (machine) printf("IMAGE: %s\n", img);
1410 else printf(INDENT "image: \"%s\" %s;\n", img, comp);
1411 }
1412 else if (detail == 1)
1413 {
1414 if (machine) printf("IMAGE: \"%s\" \"%s\"\n", img, comp);
1415 else printf(INDENT "image: \"%s\" %s;\n", img, comp);
1416 }
1417 else
1418 {
1419 if (machine)
1420 printf("IMAGE: \"edje/images/%d\" \"%s\" \"%s\"\n",
1421 id, img, comp);
1422 else
1423 printf(INDENT "image: \"%s\" %s; /* id: \"edje/images/%d\" */\n",
1424 img, comp, id);
1425 }
1426 }
1427
1428 if (machine) puts("IMAGES-END");
1429 else puts("}");
1430
1431 edje_edit_string_list_free(images);
1432 evas_object_del(ed);
1433 return EINA_TRUE;
1434}
1435
1436static Eina_Bool
1437_fonts_list(void)
1438{
1439 Evas_Object *ed = _edje_object_any_get();
1440 Eina_List *l, *fonts;
1441 const char *alias;
1442
1443 if (!ed) return EINA_FALSE;
1444
1445 fonts = edje_edit_fonts_list_get(ed);
1446
1447 if (machine) puts("FONTS-BEGIN");
1448 else puts("fonts {");
1449
1450 EINA_LIST_FOREACH(fonts, l, alias)
1451 {
1452 const char *path = edje_edit_font_path_get(ed, alias);
1453
1454 if (detail < 1)
1455 {
1456 if (machine) printf("FONT: %s\n", alias);
1457 else printf(INDENT "font: \"%s\" \"%s\";\n", path, alias);
1458 }
1459 else if (detail == 1)
1460 {
1461 if (machine) printf("FONT: \"%s\" \"%s\"\n", path, alias);
1462 else printf(INDENT "font: \"%s\" \"%s\";\n", path, alias);
1463 }
1464 else
1465 {
1466 if (machine)
1467 printf("FONT: \"edje/fonts/%s\" \"%s\" \"%s\"\n",
1468 alias, path, alias);
1469 else
1470 printf(INDENT
1471 "font: \"%s\" \"%s\"; /* id: \"edje/fonts/%s\" */\n",
1472 path, alias, alias);
1473 }
1474
1475 edje_edit_string_free(path);
1476 }
1477
1478 if (machine) puts("FONTS-END");
1479 else puts("}");
1480
1481 edje_edit_string_list_free(fonts);
1482 evas_object_del(ed);
1483 return EINA_TRUE;
1484}
1485
1486static Eina_Bool
1487_externals_list(void)
1488{
1489 Evas_Object *ed = _edje_object_any_get();
1490 Eina_List *l, *externals;
1491 const char *key;
1492
1493 if (!ed) return EINA_FALSE;
1494
1495 externals = edje_edit_externals_list_get(ed);
1496
1497 if (machine) puts("EXTERNALS-BEGIN");
1498 else puts("externals {");
1499
1500 EINA_LIST_FOREACH(externals, l, key)
1501 {
1502 if (machine) printf("EXTERNAL: %s\n", key);
1503 else printf(INDENT "external: \"%s\";\n", key);
1504 }
1505
1506 if (machine) puts("EXTERNALS-END");
1507 else puts("}");
1508
1509 edje_edit_string_list_free(externals);
1510 evas_object_del(ed);
1511 return EINA_TRUE;
1512}
1513
1514
1515int
1516main(int argc, char **argv)
1517{
1518 Eina_Bool quit_option = EINA_FALSE;
1519 char *mode = NULL;
1520 char *detail_name = NULL;
1521 int arg_index;
1522 int ret = 0;
1523 Ecore_Getopt_Value values[] = {
1524 ECORE_GETOPT_VALUE_STR(mode),
1525 ECORE_GETOPT_VALUE_STR(detail_name),
1526 ECORE_GETOPT_VALUE_STR(group),
1527 ECORE_GETOPT_VALUE_STR(part),
1528 ECORE_GETOPT_VALUE_STR(program),
1529 ECORE_GETOPT_VALUE_BOOL(api_only),
1530 ECORE_GETOPT_VALUE_BOOL(api_fix),
1531 ECORE_GETOPT_VALUE_BOOL(machine),
1532 ECORE_GETOPT_VALUE_BOOL(quit_option),
1533 ECORE_GETOPT_VALUE_BOOL(quit_option),
1534 ECORE_GETOPT_VALUE_BOOL(quit_option),
1535 ECORE_GETOPT_VALUE_BOOL(quit_option),
1536 ECORE_GETOPT_VALUE_NONE
1537 };
1538
1539 setlocale(LC_NUMERIC, "C");
1540
1541 ecore_init();
1542 ecore_evas_init();
1543 eina_init();
1544 edje_init();
1545
1546 _log_dom = eina_log_domain_register("edje_inspector", EINA_COLOR_YELLOW);
1547 if (_log_dom < 0)
1548 {
1549 EINA_LOG_CRIT("could not register log domain 'edje_inspector'");
1550 ret = 1;
1551 goto error_log;
1552 }
1553
1554 arg_index = ecore_getopt_parse(&optdesc, values, argc, argv);
1555 if (arg_index < 0)
1556 {
1557 ERR("could not parse arguments.");
1558 ret = 1;
1559 goto error_getopt;
1560 }
1561 else if (quit_option) goto error_getopt;
1562 else if (arg_index != argc - 1)
1563 {
1564 ERR("incorrect number of parameters. Requires one single file.");
1565 ret = 1;
1566 goto error_getopt;
1567 }
1568
1569 if (!mode) mode = (char *)mode_choices[0];
1570
1571 if (detail_name)
1572 {
1573 if (!strcmp(detail_name, "none")) detail = 0;
1574 else if (!strcmp(detail_name, "terse")) detail = 1;
1575 else if (!strcmp(detail_name, "all")) detail = 2;
1576 else ERR("Unknown detail level: '%s'", detail_name);
1577 }
1578
1579 file = argv[arg_index];
1580
1581 // check if the file is accessible
1582 if (access(file, R_OK) == -1)
1583 {
1584 int e = errno;
1585 ERR("File '%s' not accessible, error %d (%s).\n",
1586 file, e, strerror(e));
1587 ret = 1;
1588 goto error_getopt;
1589 }
1590
1591 DBG("mode=%s, detail=%d(%s), group=%s, part=%s, program=%s, api-only=" FMT_UCHAR
1592 ", api-fix=" FMT_UCHAR ", machine=" FMT_UCHAR ", file=%s",
1593 mode, detail, detail_name,
1594 group ? group : "",
1595 part ? part : "",
1596 program ? program : "",
1597 api_only, api_fix, machine, file);
1598
1599
1600 groups = edje_file_collection_list(file);
1601 if (!groups)
1602 {
1603 ERR("no groups in edje file '%s'", file);
1604 ret = 1;
1605 goto error_getopt;
1606 }
1607
1608 if (!strcmp(mode, "groups-names")) ret = _groups_names_list();
1609 else
1610 {
1611 ee = ecore_evas_buffer_new(1, 1);
1612 if (!ee)
1613 {
1614 ERR("could not create ecore_evas_buffer");
1615 ret = 1;
1616 }
1617 else
1618 {
1619 if (!strcmp(mode, "parts-names")) ret = _parts_names_list();
1620 else if (!strcmp(mode, "global-data")) ret = _gdata_list();
1621 else if (!strcmp(mode, "images")) ret = _images_list();
1622 else if (!strcmp(mode, "fonts")) ret = _fonts_list();
1623 else if (!strcmp(mode, "externals")) ret = _externals_list();
1624 else ret = _list(mode);
1625 ecore_evas_free(ee);
1626 }
1627 }
1628
1629 edje_file_collection_list_free(groups);
1630 error_getopt:
1631 eina_log_domain_unregister(_log_dom);
1632 error_log:
1633 edje_shutdown();
1634 ecore_evas_shutdown();
1635 ecore_shutdown();
1636 eina_shutdown();
1637
1638 return ret;
1639}
diff --git a/libraries/edje/src/bin/edje_multisense_convert.c b/libraries/edje/src/bin/edje_multisense_convert.c
new file mode 100644
index 0000000..d37d218
--- /dev/null
+++ b/libraries/edje/src/bin/edje_multisense_convert.c
@@ -0,0 +1,329 @@
1#include "edje_multisense_convert.h"
2
3#ifdef HAVE_LIBSNDFILE
4# define READBUF 1024
5# ifdef HAVE_VORBIS
6# include <vorbis/vorbisenc.h>
7# endif
8
9# ifdef HAVE_LIBFLAC
10# include <FLAC/metadata.h>
11# include <FLAC/stream_encoder.h>
12# endif
13
14Edje_Sound_Encode *
15_edje_multisense_encode(const char *filename, Edje_Sound_Sample *sample, double quality)
16{
17 SF_INFO sfinfo;
18 SNDFILE* sfile;
19 Edje_Sound_Encode *enc_info;
20
21 enc_info = calloc(1, sizeof(Edje_Sound_Encode));
22 if (!enc_info)
23 {
24 ERR("Error. while allocating memory to load file ");
25 exit(-1);
26 }
27 memset (&sfinfo, 0, sizeof (SF_INFO));
28
29 enc_info->encoded = EINA_FALSE;
30 enc_info->comp_type = "RAW PCM";
31
32 // Open wav file using sndfile
33 sfile = sf_open (filename, SFM_READ, &sfinfo);
34 if (!sfile)
35 {
36 ERR("Error. Unable to open audio file : %s", filename);
37 exit(-1);
38 }
39
40 if (!sf_format_check(&sfinfo))
41 {
42 ERR("Error. Unknown file, not a valid audio file");
43 exit(-1);
44 }
45
46 if (sample->compression == EDJE_SOUND_SOURCE_TYPE_INLINE_COMP)
47 {
48 sf_close(sfile);
49#ifdef HAVE_LIBFLAC
50 //encode provided wav file to flac
51 enc_info->file = _edje_multisense_encode_to_flac((char *)filename, sfinfo);
52 if (enc_info->file)
53 {
54 enc_info->comp_type = "FLAC";
55 enc_info->encoded = EINA_TRUE;
56 }
57#else
58 WRN("WARNING: Unable to encode sound %s to FLAC compression",
59 sample->name);
60#endif
61 }
62 else if (sample->compression == EDJE_SOUND_SOURCE_TYPE_INLINE_LOSSY)
63 {
64 sf_close(sfile);
65#ifdef HAVE_VORBIS
66 //encode provided wav file to ogg-vorbis
67 enc_info->file = _edje_multisense_encode_to_ogg_vorbis((char *)filename,
68 quality, sfinfo);
69 if (enc_info->file)
70 {
71 enc_info->comp_type = "OGG-VORBIS";
72 enc_info->encoded = EINA_TRUE;
73 }
74#else
75 WRN("WARNING: Unable to encode sound %s to Ogg-Vorbis",
76 sample->name);
77#endif
78 }
79 else
80 eina_stringshare_replace(&enc_info->file, filename);
81 return enc_info;
82}
83
84#ifdef HAVE_LIBFLAC
85const char*
86_edje_multisense_encode_to_flac(char *snd_path, SF_INFO sfinfo)
87{
88 unsigned int total_samples = 0; /* can use a 32-bit number due to WAVE size limitations */
89 FLAC__bool ok = 1;
90 FLAC__StreamEncoder *encoder = 0;
91 FLAC__StreamEncoderInitStatus init_status;
92 FLAC__StreamMetadata *metadata[2];
93 FLAC__StreamMetadata_VorbisComment_Entry entry;
94 SNDFILE *sfile;
95 sf_count_t size;
96 char *tmp;
97
98 sfile = sf_open(snd_path, SFM_READ, &sfinfo);
99 if (!sfile) return NULL;
100 if (!sf_format_check(&sfinfo))
101 {
102 sf_close(sfile);
103 return NULL;
104 }
105 size = sf_seek(sfile, 0, SEEK_END);
106 sf_seek(sfile, 0, SEEK_SET);
107 tmp = malloc(strlen(snd_path) + 1 + 5);
108 if (!tmp)
109 {
110 sf_close(sfile);
111 return NULL;
112 }
113 strcpy(tmp, snd_path);
114 snd_path = tmp;
115 strcat(snd_path, ".flac");
116
117 total_samples = size;
118
119 /* allocate the encoder */
120 if ((encoder = FLAC__stream_encoder_new()) == NULL)
121 {
122 ERR("ERROR: Creating FLAC encoder\n");
123 free(snd_path);
124 sf_close(sfile);
125 return NULL;
126 }
127
128 /* Verify it's own encoded output. This will slow the encoding process. */
129 ok &= FLAC__stream_encoder_set_verify(encoder, 1);
130
131 //Levels range from 0 (fastest, least compression) to 8 (slowest, most compression).
132 //A value larger than 8 will be treated as 8.
133 //5 is used for good compression and moderate compression/decompression speed.
134 ok &= FLAC__stream_encoder_set_compression_level(encoder, 5);
135 ok &= FLAC__stream_encoder_set_channels(encoder, sfinfo.channels);
136 ok &= FLAC__stream_encoder_set_bits_per_sample(encoder, 16);
137 ok &= FLAC__stream_encoder_set_sample_rate(encoder, sfinfo.samplerate);
138 ok &= FLAC__stream_encoder_set_total_samples_estimate(encoder, total_samples);
139
140 /* now add some metadata; we'll add some tags and a padding block */
141 if (ok)
142 {
143 if ((metadata[0] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT)) == NULL
144 || (metadata[1] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING)) == NULL
145 || !FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(&entry, "Encoder", "flac")
146 || !FLAC__metadata_object_vorbiscomment_append_comment(metadata[0], entry, 0))
147 {
148 ERR("ERROR: out of memory error or tag error\n");
149 ok = 0;
150 }
151 metadata[1]->length = 16; /* set the padding length */
152 ok = FLAC__stream_encoder_set_metadata(encoder, metadata, 2);
153 }
154
155 /* initialize encoder */
156 if (ok)
157 {
158 init_status = FLAC__stream_encoder_init_file(encoder, snd_path, NULL,
159 (void *)(long)(total_samples));
160 if (init_status != FLAC__STREAM_ENCODER_INIT_STATUS_OK)
161 {
162 ERR("ERROR: unable to initialize FLAC encoder: %s\n",
163 FLAC__StreamEncoderInitStatusString[init_status]);
164 ok = 0;
165 }
166 }
167
168 /* read blocks of samples from WAVE file and feed to encoder */
169 while (ok)
170 {
171 FLAC__int32 readbuffer[READBUF * 2];
172 sf_count_t count;
173 int i;
174
175 count = sf_readf_int(sfile, readbuffer, READBUF);
176 if (count <= 0) break;
177 for (i = 0; i < (count * sfinfo.channels); i++)
178 readbuffer[i] = readbuffer[i] >> 16;
179 ok = FLAC__stream_encoder_process_interleaved(encoder, readbuffer,
180 count);
181 }
182
183 FLAC__stream_encoder_finish(encoder);
184 /* now that encoding is finished, the metadata can be freed */
185 FLAC__metadata_object_delete(metadata[0]);
186 FLAC__metadata_object_delete(metadata[1]);
187
188 FLAC__stream_encoder_delete(encoder);
189 sf_close(sfile);
190 return (snd_path);
191}
192#endif
193
194#ifdef HAVE_VORBIS
195const char *
196_edje_multisense_encode_to_ogg_vorbis(char *snd_path, double quality, SF_INFO sfinfo)
197{
198 ogg_stream_state os; /* take physical pages, weld into a logical stream of packets */
199 ogg_page og; /* one Ogg bitstream page. Vorbis packets are inside */
200 ogg_packet op; /* one raw packet of data for decode */
201 vorbis_info vi; /* struct that stores all the static vorbis bitstream settings */
202 vorbis_comment vc; /* struct that stores all the user comments */
203 vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
204 vorbis_block vb; /* local working space for packet->PCM decode */
205 int eos = 0, ret;
206 char *tmp;
207 SNDFILE *sfile;
208 FILE *fout;
209
210 sfile = sf_open(snd_path, SFM_READ, &sfinfo);
211 if (!sfile) return NULL;
212 if (!sf_format_check(&sfinfo))
213 {
214 sf_close(sfile);
215 return NULL;
216 }
217 tmp = malloc(strlen(snd_path) + 1 + 4);
218 if (!tmp)
219 {
220 sf_close(sfile);
221 return NULL;
222 }
223 strcpy(tmp, snd_path);
224 snd_path = tmp;
225 strcat(snd_path, ".ogg");
226 fout = fopen(snd_path, "wb");
227 if (!fout)
228 {
229 free(snd_path);
230 sf_close(sfile);
231 return NULL;
232 }
233
234 /********** Encode setup ************/
235 vorbis_info_init(&vi);
236 ret = vorbis_encode_init(&vi, sfinfo.channels, sfinfo.samplerate,
237 -1, (long)(quality * 1000), -1);
238 if (ret == OV_EFAULT) printf("OV_EFAULT\n");
239 if (ret == OV_EINVAL) printf("OV_EINVAL\n");
240 if (ret == OV_EIMPL) printf("OV_EIMPL\n");
241
242 if (ret)
243 {
244 fclose(fout);
245 free(snd_path);
246 sf_close(sfile);
247 return NULL;
248 }
249
250 /* add a comment */
251 vorbis_comment_init(&vc);
252 vorbis_comment_add_tag(&vc, "", "");
253
254 /* set up the analysis state and auxiliary encoding storage */
255 vorbis_analysis_init(&vd, &vi);
256 vorbis_block_init(&vd, &vb);
257
258 srand(time(NULL));
259 ogg_stream_init(&os, rand());
260
261 ogg_packet header;
262 ogg_packet header_comm;
263 ogg_packet header_code;
264
265 vorbis_analysis_headerout(&vd, &vc, &header, &header_comm, &header_code);
266 ogg_stream_packetin(&os, &header); /* automatically placed in its own page */
267 ogg_stream_packetin(&os, &header_comm);
268 ogg_stream_packetin(&os, &header_code);
269
270 while (!eos)
271 {
272 int result = ogg_stream_flush(&os, &og);
273 if (!result) break;
274 fwrite(og.header, 1, og.header_len, fout);
275 fwrite(og.body, 1, og.body_len, fout);
276 }
277
278 while (!eos)
279 {
280 int i, ch;
281 float readbuffer[READBUF * 2];
282 sf_count_t count;
283
284 count = sf_readf_float(sfile, readbuffer, READBUF);
285
286 if (!count)
287 vorbis_analysis_wrote(&vd, 0);
288 else
289 {
290 float **buffer = vorbis_analysis_buffer(&vd, count);
291
292 /* uninterleave samples */
293 for (i = 0; i < count; i++)
294 {
295 for (ch = 0; ch < sfinfo.channels; ch++)
296 buffer[ch][i]= readbuffer[(i * sfinfo.channels) + ch];
297 }
298 vorbis_analysis_wrote(&vd, i);
299 }
300 while (vorbis_analysis_blockout(&vd, &vb) == 1)
301 {
302 vorbis_analysis(&vb, NULL);
303 vorbis_bitrate_addblock(&vb);
304
305 while (vorbis_bitrate_flushpacket(&vd, &op))
306 {
307 ogg_stream_packetin(&os, &op);
308 while (!eos)
309 {
310 int result = ogg_stream_pageout(&os, &og);
311 if (!result) break;
312 fwrite(og.header, 1, og.header_len, fout);
313 fwrite(og.body, 1, og.body_len, fout);
314 if (ogg_page_eos(&og)) eos = 1;
315 }
316 }
317 }
318 }
319 ogg_stream_clear(&os);
320 vorbis_block_clear(&vb);
321 vorbis_dsp_clear(&vd);
322 vorbis_comment_clear(&vc);
323 vorbis_info_clear(&vi);
324 sf_close(sfile);
325 fclose (fout);
326 return snd_path;
327}
328#endif
329#endif
diff --git a/libraries/edje/src/bin/edje_multisense_convert.h b/libraries/edje/src/bin/edje_multisense_convert.h
new file mode 100644
index 0000000..05ee2f7
--- /dev/null
+++ b/libraries/edje/src/bin/edje_multisense_convert.h
@@ -0,0 +1,25 @@
1#ifndef EDJE_SND_CONVERT_H__
2# define EDJE_SND_CONVERT_H__
3#include "edje_private.h"
4
5#ifdef HAVE_LIBSNDFILE
6#include <sndfile.h>
7
8#define SF_CONTAINER(x) ((x) & SF_FORMAT_TYPEMASK)
9#define SF_CODEC(x) ((x) & SF_FORMAT_SUBMASK)
10
11typedef struct _Edje_Sound_Encode Edje_Sound_Encode;
12
13struct _Edje_Sound_Encode /*Encoding information*/
14{
15 const char *file; /* the encode sound file path */
16 Eina_Bool encoded; /* True if encoding is successful else False */
17 char *comp_type; /* either LOSSLESS (FLAC) or LOSSY (Ogg/Vorbis) Compression */
18};
19
20Edje_Sound_Encode *_edje_multisense_encode(const char* filename, Edje_Sound_Sample *sample, double quality);
21const char *_edje_multisense_encode_to_flac(char *snd_path, SF_INFO sfinfo);
22const char *_edje_multisense_encode_to_ogg_vorbis(char *snd_path, double quality, SF_INFO sfinfo);
23
24#endif
25#endif
diff --git a/libraries/edje/src/bin/edje_player.c b/libraries/edje/src/bin/edje_player.c
new file mode 100644
index 0000000..4d0c0a3
--- /dev/null
+++ b/libraries/edje/src/bin/edje_player.c
@@ -0,0 +1,795 @@
1#ifdef HAVE_CONFIG_H
2#include <config.h>
3#endif
4
5#include <stdio.h>
6#include <string.h>
7#include <stdlib.h>
8#include <errno.h>
9#include <unistd.h>
10#include <fcntl.h>
11#include <ctype.h>
12
13#ifdef HAVE_EVIL
14# include <Evil.h>
15#endif
16
17#include <Evas.h>
18#include <Ecore.h>
19#include <Ecore_Getopt.h>
20#include <Ecore_Evas.h>
21#include <Edje.h>
22
23#ifdef _WIN32
24# define FMT_UCHAR "%c"
25#else
26# define FMT_UCHAR "%hhu"
27#endif
28
29struct opts {
30 char *file;
31 char *group;
32 Eina_Bool list_groups;
33 char *engine;
34 Eina_Rectangle size;
35 unsigned char color[3];
36 Eina_Bool borderless;
37 Eina_Bool sticky;
38 Eina_Bool shaped;
39 Eina_Bool alpha;
40 Eina_Bool print;
41 Eina_Bool slave_mode;
42 double scale;
43 char *title;
44};
45
46static Ecore_Evas *win;
47
48static void
49_win_title_set(const char *group, const char *file)
50{
51 char buf[1024];
52 snprintf(buf, sizeof(buf), "Edje_Player - %s of %s", group, file);
53 ecore_evas_title_set(win, buf);
54}
55
56static char *
57_slave_mode_tok(char **p_arg)
58{
59 char *s, *e;
60 Eina_Bool is_quoted;
61
62 if (!*p_arg) return NULL;
63
64 s = *p_arg;
65 while (isspace(*s))
66 s++;
67
68 if (*s == '\0')
69 {
70 *p_arg = NULL;
71 return NULL;
72 }
73 else if (*s == '"')
74 {
75 is_quoted = EINA_TRUE;
76 s++;
77 *p_arg = s;
78 }
79 else
80 {
81 is_quoted = EINA_FALSE;
82 *p_arg = s;
83 }
84
85 for (e = s; *e != '\0'; e++)
86 {
87 if ((!is_quoted) && (isspace(*e)))
88 break;
89 else if ((is_quoted) && (*e == '"'))
90 break;
91 }
92
93 if (*e == '\0') return NULL;
94
95 *e = '\0';
96 return e + 1;
97}
98
99static void
100_slave_mode_signal(Evas_Object *edje, char *args)
101{
102 char *emission, *source;
103
104 emission = args;
105 source = _slave_mode_tok(&emission);
106 _slave_mode_tok(&source);
107
108 if ((!emission) || (!source))
109 {
110 fputs("ERROR: Invalid command arguments.\n", stderr);
111 return;
112 }
113
114 edje_object_signal_emit(edje, emission, source);
115}
116
117static void
118_slave_mode_info(Evas_Object *edje, char *args)
119{
120 _slave_mode_tok(&args);
121
122 if (!args)
123 {
124 fputs("ERROR: Invalid command arguments.\n", stderr);
125 return;
126 }
127
128 if (!edje_object_part_exists(edje, args))
129 {
130 printf("INFO: \"%s\" does not exist.\n", args);
131 }
132 else
133 {
134 Evas_Coord x, y, w, h;
135 edje_object_part_geometry_get(edje, args, &x, &y, &w, &h);
136 printf("INFO: \"%s\" %d,%d,%d,%d\n", args, x, y, w, h);
137 }
138}
139
140static void
141_slave_mode_quit(Evas_Object *edje __UNUSED__, char *args __UNUSED__)
142{
143 puts("Bye!");
144 ecore_main_loop_quit();
145}
146
147static void
148_slave_mode_help(Evas_Object *edje __UNUSED__, char *args __UNUSED__)
149{
150 puts("Help:\n"
151 "One command per line, arguments separated by space. Strings may have "
152 "spaces if enclosed in quotes (\").\n"
153 "\n"
154 "\t<command> [arguments]\n"
155 "\n"
156 "Available commands:\n"
157 "\tsignal <emission> <source>\n"
158 "\t sends a signal to edje\n"
159 "\tinfo <part>\n"
160 "\t Print part geometry: <x>,<y>,<w>,<h>\n"
161 "\tquit\n"
162 "\t exit edje player.\n"
163 "\thelp\n"
164 "\t shows this message.\n");
165 /*
166 * Extension ideas (are they useful?):
167 * - message: send a message
168 * - data: show data value
169 * - color_class: set color class values (maybe also list?)
170 * - text_class: set text class values (maybe also list?)
171 * - play_set: change play state
172 * - animation_set: change animation state
173 */
174}
175
176struct slave_cmd
177{
178 const char *cmd;
179 void (*func)(Evas_Object *edje, char *args);
180} _slave_mode_commands[] = {
181 {"signal", _slave_mode_signal},
182 {"info", _slave_mode_info},
183 {"quit", _slave_mode_quit},
184 {"help", _slave_mode_help},
185 {NULL, NULL}
186};
187
188static Eina_Bool
189_slave_mode(void *data, Ecore_Fd_Handler *fd_handler)
190{
191 Evas_Object *edje = data;
192 char buf[1024], *p;
193 const struct slave_cmd *itr;
194 size_t len;
195
196 if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_ERROR))
197 {
198 fputs("ERROR: error on stdin! Exit.\n", stderr);
199 ecore_main_loop_quit();
200 return ECORE_CALLBACK_CANCEL;
201 }
202 if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ))
203 return ECORE_CALLBACK_RENEW;
204
205 if (!fgets(buf, sizeof(buf), stdin))
206 {
207 fputs("ERROR: end of stdin! Exit.\n", stderr);
208 ecore_main_loop_quit();
209 return ECORE_CALLBACK_CANCEL;
210 }
211
212 len = strlen(buf);
213 if (len < 1)
214 {
215 fputs("ERROR: no input! Try: help\n", stderr);
216 return ECORE_CALLBACK_RENEW;
217 }
218 if (buf[len - 1] == '\n')
219 {
220 len--;
221 buf[len] = '\0';
222 }
223
224 p = strchr(buf, ' ');
225 if (p)
226 {
227 *p = '\0';
228 p++;
229
230 while (isspace(*p))
231 p++;
232 if (*p == '\0')
233 p = NULL;
234
235 if (p)
236 {
237 char *q = p + strlen(p) - 1;
238 while (isspace(*q))
239 {
240 *q = '\0';
241 q--;
242 }
243 }
244 }
245
246 for (itr = _slave_mode_commands; itr->cmd; itr++)
247 {
248 if (strcmp(itr->cmd, buf) == 0)
249 {
250 itr->func(edje, p);
251 break;
252 }
253 }
254
255 return ECORE_CALLBACK_RENEW;
256}
257
258static void
259_print_signal(void *data __UNUSED__, Evas_Object *o __UNUSED__, const char *emission, const char *source)
260{
261 printf("SIGNAL: \"%s\" \"%s\"\n", emission, source);
262}
263
264static void
265_print_message(void *data __UNUSED__, Evas_Object *edje __UNUSED__, Edje_Message_Type type, int id, void *msg)
266{
267 const char *typestr;
268 char buf[64];
269
270 switch (type)
271 {
272 case EDJE_MESSAGE_NONE:
273 typestr = "NONE";
274 break;
275 case EDJE_MESSAGE_SIGNAL:
276 typestr = "SIGNAL";
277 break;
278 case EDJE_MESSAGE_STRING:
279 typestr = "STRING";
280 break;
281 case EDJE_MESSAGE_INT:
282 typestr = "INT";
283 break;
284 case EDJE_MESSAGE_FLOAT:
285 typestr = "FLOAT";
286 break;
287 case EDJE_MESSAGE_STRING_SET:
288 typestr = "STRING_SET";
289 break;
290 case EDJE_MESSAGE_INT_SET:
291 typestr = "INT_SET";
292 break;
293 case EDJE_MESSAGE_FLOAT_SET:
294 typestr = "FLOAT_SET";
295 break;
296 case EDJE_MESSAGE_STRING_INT:
297 typestr = "STRING_INT";
298 break;
299 case EDJE_MESSAGE_STRING_FLOAT:
300 typestr = "STRING_FLOAT";
301 break;
302 case EDJE_MESSAGE_STRING_INT_SET:
303 typestr = "INT_SET";
304 break;
305 case EDJE_MESSAGE_STRING_FLOAT_SET:
306 typestr = "FLOAT_SET";
307 break;
308 default:
309 snprintf(buf, sizeof(buf), "UNKNOWN(%d)", type);
310 typestr = buf;
311 }
312
313 printf("MESSAGE: type=%s, id=%d", typestr, id);
314
315 switch (type)
316 {
317 case EDJE_MESSAGE_NONE: break;
318 case EDJE_MESSAGE_SIGNAL: break;
319 case EDJE_MESSAGE_STRING:
320 {
321 Edje_Message_String *m = msg;
322 printf(" \"%s\"", m->str);
323 }
324 break;
325 case EDJE_MESSAGE_INT:
326 {
327 Edje_Message_Int *m = msg;
328 printf(" %d", m->val);
329 }
330 break;
331 case EDJE_MESSAGE_FLOAT:
332 {
333 Edje_Message_Float *m = msg;
334 printf(" %f", m->val);
335 }
336 break;
337 case EDJE_MESSAGE_STRING_SET:
338 {
339 Edje_Message_String_Set *m = msg;
340 int i;
341 for (i = 0; i < m->count; i++)
342 printf(" \"%s\"", m->str[i]);
343 }
344 break;
345 case EDJE_MESSAGE_INT_SET:
346 {
347 Edje_Message_Int_Set *m = msg;
348 int i;
349 for (i = 0; i < m->count; i++)
350 printf(" %d", m->val[i]);
351 }
352 break;
353 case EDJE_MESSAGE_FLOAT_SET:
354 {
355 Edje_Message_Float_Set *m = msg;
356 int i;
357 for (i = 0; i < m->count; i++)
358 printf(" %f", m->val[i]);
359 }
360 break;
361 case EDJE_MESSAGE_STRING_INT:
362 {
363 Edje_Message_String_Int *m = msg;
364 printf(" \"%s\" %d", m->str, m->val);
365 }
366 break;
367 case EDJE_MESSAGE_STRING_FLOAT:
368 {
369 Edje_Message_String_Float *m = msg;
370 printf(" \"%s\" %f", m->str, m->val);
371 }
372 break;
373 case EDJE_MESSAGE_STRING_INT_SET:
374 {
375 Edje_Message_String_Int_Set *m = msg;
376 int i;
377 printf(" \"%s\"", m->str);
378 for (i = 0; i < m->count; i++)
379 printf(" %d", m->val[i]);
380 }
381 break;
382 case EDJE_MESSAGE_STRING_FLOAT_SET:
383 {
384 Edje_Message_String_Float_Set *m = msg;
385 int i;
386 printf(" \"%s\"", m->str);
387 for (i = 0; i < m->count; i++)
388 printf(" %f", m->val[i]);
389 }
390 break;
391 default:
392 break;
393 }
394
395 putchar('\n');
396}
397
398static void
399_reset_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *stack, void *event_info __UNUSED__)
400{
401 Evas_Coord minw, minh;
402 Evas_Object *edje = data;
403
404 edje_object_size_min_get(edje, &minw, &minh);
405 if ((minw <= 0) && (minh <= 0))
406 edje_object_size_min_calc(edje, &minw, &minh);
407
408 evas_object_size_hint_min_set(stack, minw, minh);
409}
410
411static void
412_key_down(void *data, Evas *e __UNUSED__, Evas_Object *stack __UNUSED__, void *event_info)
413{
414 Evas_Event_Key_Down *ev = event_info;
415 struct opts *opts = data;
416
417 if ((!strcmp(ev->keyname, "equal")) ||
418 (!strcmp(ev->keyname, "plus")))
419 opts->scale += 0.1;
420 else if ((!strcmp(ev->keyname, "minus")) ||
421 (!strcmp(ev->keyname, "underscore")))
422 opts->scale -= 0.1;
423 else if ((!strcmp(ev->keyname, "0")))
424 opts->scale = 1.0;
425 if (opts->scale < 0.1) opts->scale = 0.1;
426 else if (opts->scale > 10.0) opts->scale = 1.0;
427 edje_scale_set(opts->scale);
428}
429
430static Evas_Object *
431_create_stack(Evas *evas, const struct opts *opts)
432{
433 Evas_Object *stack = evas_object_box_add(evas);
434 if (!stack)
435 {
436 fputs("ERROR: could not create object stack (box).\n", stderr);
437 return NULL;
438 }
439 evas_object_box_layout_set(stack, evas_object_box_layout_stack, NULL, NULL);
440 evas_object_resize(stack, opts->size.w, opts->size.h);
441 evas_object_size_hint_weight_set(stack, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
442 evas_object_size_hint_align_set(stack, EVAS_HINT_FILL, EVAS_HINT_FILL);
443 evas_object_show(stack);
444 return stack;
445}
446
447static Evas_Object *
448_create_bg(Evas *evas, const struct opts *opts)
449{
450 const unsigned char *color = opts->color;
451 Evas_Object *bg = evas_object_rectangle_add(evas);
452 if (!bg)
453 {
454 fputs("ERROR: could not create background.\n", stderr);
455 return NULL;
456 }
457 evas_object_resize(bg, opts->size.w, opts->size.h);
458 evas_object_color_set(bg, color[0], color[1], color[2], 255);
459 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
460 evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
461 evas_object_show(bg);
462 return bg;
463}
464
465static Eina_Bool
466_edje_load_or_show_error(Evas_Object *edje, const char *file, const char *group)
467{
468 const char *errmsg;
469 int err;
470
471 if (edje_object_file_set(edje, file, group))
472 {
473 evas_object_focus_set(edje, EINA_TRUE);
474 return EINA_TRUE;
475 }
476
477 err = edje_object_load_error_get(edje);
478 errmsg = edje_load_error_str(err);
479 fprintf(stderr, "ERROR: could not load edje file '%s', group '%s': %s\n",
480 file, group, errmsg);
481 return EINA_FALSE;
482}
483
484static Evas_Object *
485_create_edje(Evas *evas, const struct opts *opts)
486{
487 Evas_Coord minw, minh, maxw, maxh;
488 Evas_Object *edje = edje_object_add(evas);
489 if (!edje)
490 {
491 fputs("ERROR: could not create edje.\n", stderr);
492 return NULL;
493 }
494
495 if (opts->group)
496 {
497 if (!_edje_load_or_show_error(edje, opts->file, opts->group))
498 {
499 evas_object_del(edje);
500 return NULL;
501 }
502 if (!opts->title) _win_title_set(opts->group, opts->file);
503 }
504 else
505 {
506 if (edje_file_group_exists(opts->file, "main"))
507 {
508 if (!_edje_load_or_show_error(edje, opts->file, "main"))
509 {
510 evas_object_del(edje);
511 return NULL;
512 }
513 if (!opts->title) _win_title_set("main", opts->file);
514 }
515 else
516 {
517 Eina_List *groups = edje_file_collection_list(opts->file);
518 const char *group;
519 if (!groups)
520 {
521 fprintf(stderr, "ERROR: file '%s' has no groups!\n",
522 opts->file);
523 evas_object_del(edje);
524 return NULL;
525 }
526 group = groups->data;
527 if (!_edje_load_or_show_error(edje, opts->file, group))
528 {
529 edje_file_collection_list_free(groups);
530 evas_object_del(edje);
531 return NULL;
532 }
533 if (!opts->title) _win_title_set(group, opts->file);
534 edje_file_collection_list_free(groups);
535 }
536 }
537
538 edje_object_size_max_get(edje, &maxw, &maxh);
539 edje_object_size_min_get(edje, &minw, &minh);
540 if ((minw <= 0) && (minh <= 0))
541 edje_object_size_min_calc(edje, &minw, &minh);
542
543 evas_object_size_hint_max_set(edje, maxw, maxh);
544 evas_object_size_hint_min_set(edje, minw, minh);
545
546 evas_object_size_hint_weight_set(edje, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
547 evas_object_size_hint_align_set(edje, EVAS_HINT_FILL, EVAS_HINT_FILL);
548 evas_object_show(edje);
549
550 return edje;
551}
552
553static unsigned char _parse_color(__UNUSED__ const Ecore_Getopt *parser, __UNUSED__ const Ecore_Getopt_Desc *desc, const char *str, __UNUSED__ void *data, Ecore_Getopt_Value *storage)
554{
555 unsigned char *color = (unsigned char *)storage->ptrp;
556
557 if (sscanf(str, FMT_UCHAR "," FMT_UCHAR "," FMT_UCHAR, color, color + 1, color + 2) != 3)
558 {
559 fprintf(stderr, "ERROR: incorrect color value '%s'\n", str);
560 return 0;
561 }
562
563 return 1;
564}
565
566static void _cb_delete(__UNUSED__ Ecore_Evas *ee)
567{
568 ecore_main_loop_quit();
569}
570
571const Ecore_Getopt optdesc = {
572 "edje_player",
573 "%prog [options] <filename.edj>",
574 PACKAGE_VERSION,
575 "(C) 2010 Enlightenment",
576 "BSD with advertisement clause",
577 "Simple application to view edje files.",
578 0,
579 {
580 ECORE_GETOPT_STORE_STR
581 ('g', "group", "The edje group to view (defaults to 'main')."),
582 ECORE_GETOPT_STORE_TRUE
583 ('G', "list-groups", "The groups in the given file."),
584 ECORE_GETOPT_STORE_STR
585 ('e', "engine", "The Ecore-Evas engine to use (see --list-engines)"),
586 ECORE_GETOPT_CALLBACK_NOARGS
587 ('E', "list-engines", "list Ecore-Evas engines",
588 ecore_getopt_callback_ecore_evas_list_engines, NULL),
589 ECORE_GETOPT_CALLBACK_ARGS
590 ('Z', "size", "size to use in wxh form.", "WxH",
591 ecore_getopt_callback_size_parse, NULL),
592 ECORE_GETOPT_CALLBACK_ARGS
593 ('c', "bg-color", "Color of the background (if not shaped or alpha)",
594 "RRGGBB", _parse_color, NULL),
595 ECORE_GETOPT_STORE_TRUE
596 ('b', "borderless", "Display window without border."),
597 ECORE_GETOPT_STORE_TRUE
598 ('y', "sticky", "Display window sticky."),
599 ECORE_GETOPT_STORE_TRUE
600 ('s', "shaped", "Display window shaped."),
601 ECORE_GETOPT_STORE_TRUE
602 ('a', "alpha", "Display window with alpha channel "
603 "(needs composite manager!)"),
604 ECORE_GETOPT_STORE_STR
605 ('t', "title", "Define the window title string"),
606 ECORE_GETOPT_STORE_TRUE
607 ('p', "print", "Print signals and messages to stdout"),
608 ECORE_GETOPT_STORE_TRUE
609 ('S', "slave-mode", "Listen for commands on stdin"),
610 ECORE_GETOPT_STORE_DOUBLE
611 ('z', "scale", "Set scale factor"),
612 ECORE_GETOPT_LICENSE('L', "license"),
613 ECORE_GETOPT_COPYRIGHT('C', "copyright"),
614 ECORE_GETOPT_VERSION('V', "version"),
615 ECORE_GETOPT_HELP('h', "help"),
616 ECORE_GETOPT_SENTINEL
617 }
618};
619
620int main(int argc, char **argv)
621{
622 Evas *evas;
623 Evas_Object *stack, *edje;
624 struct opts opts;
625 Eina_Bool quit_option = EINA_FALSE;
626 int args;
627 Ecore_Getopt_Value values[] = {
628 ECORE_GETOPT_VALUE_STR(opts.group),
629 ECORE_GETOPT_VALUE_BOOL(opts.list_groups),
630 ECORE_GETOPT_VALUE_STR(opts.engine),
631 ECORE_GETOPT_VALUE_BOOL(quit_option),
632 ECORE_GETOPT_VALUE_PTR_CAST(opts.size),
633 ECORE_GETOPT_VALUE_PTR_CAST(opts.color),
634 ECORE_GETOPT_VALUE_BOOL(opts.borderless),
635 ECORE_GETOPT_VALUE_BOOL(opts.sticky),
636 ECORE_GETOPT_VALUE_BOOL(opts.shaped),
637 ECORE_GETOPT_VALUE_BOOL(opts.alpha),
638 ECORE_GETOPT_VALUE_STR(opts.title),
639 ECORE_GETOPT_VALUE_BOOL(opts.print),
640 ECORE_GETOPT_VALUE_BOOL(opts.slave_mode),
641 ECORE_GETOPT_VALUE_DOUBLE(opts.scale),
642 ECORE_GETOPT_VALUE_BOOL(quit_option),
643 ECORE_GETOPT_VALUE_BOOL(quit_option),
644 ECORE_GETOPT_VALUE_BOOL(quit_option),
645 ECORE_GETOPT_VALUE_BOOL(quit_option),
646 ECORE_GETOPT_VALUE_NONE
647 };
648
649 memset(&opts, 0, sizeof(opts));
650 opts.scale = 1.0;
651
652 if (!ecore_evas_init())
653 return EXIT_FAILURE;
654 if (!edje_init())
655 goto shutdown_ecore_evas;
656 edje_frametime_set(1.0/60.0);
657
658 args = ecore_getopt_parse(&optdesc, values, argc, argv);
659 if (args < 0)
660 {
661 fputs("Could not parse arguments.\n", stderr);
662 goto shutdown_edje;
663 }
664 else if (quit_option)
665 {
666 goto end;
667 }
668 else if (args >= argc)
669 {
670 fputs("Missing edje file to load.\n", stderr);
671 goto shutdown_edje;
672 }
673
674 ecore_app_args_set(argc, (const char **)argv);
675 edje_scale_set(opts.scale);
676
677 // check if the given edj file is there
678 if (access(argv[args], R_OK) == -1)
679 {
680 int e = errno;
681 fprintf(stderr, "ERROR: file '%s' not accessible, error %d (%s).\n",
682 argv[args], e, strerror(e));
683 goto end;
684 }
685
686 opts.file = argv[args];
687 if (opts.list_groups)
688 {
689 Eina_List *groups, *n;
690 const char *group;
691 groups = edje_file_collection_list(opts.file);
692 printf("%d groups in file '%s':\n", eina_list_count(groups), opts.file);
693 EINA_LIST_FOREACH(groups, n, group)
694 printf("\t'%s'\n", group);
695 edje_file_collection_list_free(groups);
696 goto end;
697 }
698
699 win = ecore_evas_new(opts.engine, 0, 0, opts.size.w, opts.size.h, NULL);
700 if (!win)
701 {
702 fprintf(stderr,
703 "ERROR: could not create window of "
704 "size %dx%d using engine %s.\n",
705 opts.size.w, opts.size.h, opts.engine ? opts.engine : "(auto)");
706 goto shutdown_edje;
707 }
708
709 ecore_evas_callback_delete_request_set(win, _cb_delete);
710 evas = ecore_evas_get(win);
711 stack = _create_stack(evas, &opts);
712 if (!stack)
713 {
714 goto free_ecore_evas;
715 }
716
717 ecore_evas_object_associate(win, stack, ECORE_EVAS_OBJECT_ASSOCIATE_BASE);
718
719 if (opts.alpha)
720 ecore_evas_alpha_set(win, EINA_TRUE);
721 else if (opts.shaped)
722 ecore_evas_shaped_set(win, EINA_TRUE);
723 else
724 {
725 Evas_Object *bg = _create_bg(evas, &opts);
726 if (bg) evas_object_box_append(stack, bg);
727 }
728
729 edje = _create_edje(evas, &opts);
730 if (edje)
731 evas_object_box_append(stack, edje);
732 else
733 {
734 goto free_ecore_evas;
735 }
736
737 evas_object_focus_set(stack, EINA_TRUE);
738 evas_object_event_callback_add(stack, EVAS_CALLBACK_KEY_DOWN,
739 _key_down, &opts);
740 evas_object_event_callback_add(stack, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
741 _reset_size_hints, edje);
742
743 if (opts.print)
744 {
745 edje_object_signal_callback_add(edje, "*", "*", _print_signal, NULL);
746 edje_object_message_handler_set(edje, _print_message, NULL);
747 }
748
749 if (opts.slave_mode)
750 {
751#ifndef _WIN32
752 int flags;
753 flags = fcntl(STDIN_FILENO, F_GETFL, 0);
754 flags |= O_NONBLOCK;
755 if (fcntl(STDIN_FILENO, F_SETFL, flags) < 0)
756 {
757 fprintf(stderr, "ERROR: Could not set stdin to non-block: %s\n",
758 strerror(errno));
759 goto free_ecore_evas;
760 }
761 ecore_main_fd_handler_add(STDIN_FILENO, ECORE_FD_READ | ECORE_FD_ERROR,
762 _slave_mode, edje, NULL, NULL);
763#else
764 /* TODO: port the code above to Windows */
765 fprintf (stderr, "ERROR: slave mode not working on Windows\n");
766 goto free_ecore_evas;
767#endif
768 }
769
770 ecore_evas_borderless_set(win, opts.borderless);
771 ecore_evas_sticky_set(win, opts.sticky);
772 if (opts.title)
773 ecore_evas_title_set(win, opts.title);
774
775 if (opts.size.w <= 0) opts.size.w = 320;
776 if (opts.size.h <= 0) opts.size.h = 240;
777 ecore_evas_resize(win, opts.size.w, opts.size.h);
778 ecore_evas_show(win);
779 ecore_main_loop_begin();
780
781 ecore_evas_free(win);
782 end:
783 edje_shutdown();
784 ecore_evas_shutdown();
785
786 return 0;
787
788 free_ecore_evas:
789 ecore_evas_free(win);
790 shutdown_edje:
791 edje_shutdown();
792 shutdown_ecore_evas:
793 ecore_evas_shutdown();
794 return EXIT_FAILURE;
795}
diff --git a/libraries/edje/src/bin/edje_recc b/libraries/edje/src/bin/edje_recc
new file mode 100644
index 0000000..2ae81ad
--- /dev/null
+++ b/libraries/edje/src/bin/edje_recc
@@ -0,0 +1,69 @@
1#!/bin/sh
2
3set -e
4
5usage () {
6 echo "Usage:"
7 echo " edje_recc [OPTIONS] input_file.edj"
8 echo ""
9 echo "Where OPTIONS is one or more of:"
10 echo ""
11 echo "-v Verbose output"
12 echo "-no-lossy Do NOT allow images to be lossy"
13 echo "-no-comp Do NOT allow images to be lossless compression"
14 echo "-no-raw Do NOT allow images to be zero compression"
15 echo "-min-quality VAL Do NOT allow lossy images with quality < VAL (0-100)"
16 echo "-max-quality VAL Do NOT allow lossy images with quality > VAL (0-100)"
17 exit -1
18}
19
20if [ $# -lt 1 ]; then
21 usage
22fi
23
24OPT=""
25if [ $# -ge 1 ]; then
26 for I in $@; do
27 case "$I" in
28 -h)
29 usage
30 ;;
31
32 -help)
33 usage
34 ;;
35
36 --help)
37 usage
38 ;;
39
40 *.edj)
41 IN=$I
42 ;;
43
44 *)
45 OPT=$OPT" "$I
46 ;;
47 esac
48 done
49fi
50
51if [ -z "$IN" ]; then
52 echo "ERROR: NO input file.edj provided!"
53 echo ""
54 usage;
55fi
56
57F=`basename $IN`
58B=`basename $F .edj`
59T="./...edje_tmp"
60rm -rf $T
61mkdir -p $T
62cp $IN $T
63cd $T
64edje_decc $F
65cd $B
66./build.sh $OPT
67cd ../..
68mv $T/$B/$F $IN
69rm -rf $T
diff --git a/libraries/edje/src/bin/epp/Makefile.am b/libraries/edje/src/bin/epp/Makefile.am
new file mode 100644
index 0000000..6db5016
--- /dev/null
+++ b/libraries/edje/src/bin/epp/Makefile.am
@@ -0,0 +1,59 @@
1# Makefile for GNU C compiler.
2# Copyright (C) 1987, 88, 90-94, 1995 Free Software Foundation, Inc.
3
4#This file is part of GNU CC.
5
6#GNU CC is free software; you can redistribute it and/or modify
7#it under the terms of the GNU General Public License as published by
8#the Free Software Foundation; either version 2, or (at your option)
9#any later version.
10
11#GNU CC is distributed in the hope that it will be useful,
12#but WITHOUT ANY WARRANTY; without even the implied warranty of
13#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14#GNU General Public License for more details.
15
16#You should have received a copy of the GNU General Public License
17#along with GNU CC; see the file COPYING. If not, write to
18#the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19
20MAINTAINERCLEANFILES = Makefile.in
21
22eppdir = @libdir@/@PACKAGE@/utils
23
24epp_PROGRAMS = epp
25
26epp_SOURCES = \
27cpplib.h \
28cpphash.h \
29cppalloc.c \
30cpperror.c \
31cppexp.c \
32cpphash.c \
33cpplib.c \
34cppmain.c
35
36epp_CPPFLAGS = \
37-I$(top_builddir) \
38$(CWARNFLAGS)
39
40DEFS= \
41-DHAVE_CONFIG_H \
42-DHAVE_STRERROR \
43-DFATAL_EXIT_CODE=1 \
44-DSUCCESS_EXIT_CODE=0 \
45-DGCC_INCLUDE_DIR=\"/usr/include\" \
46-DGPLUSPLUS_INCLUDE_DIR=\"/usr/include\" \
47-DTOOL_INCLUDE_DIR=\"/usr/bin\" \
48-DHOST_BITS_PER_LONG=32 \
49-DBITS_PER_UNIT=8 \
50-DHOST_BITS_PER_INT=32 \
51-DBITS_PER_WORD=16 \
52-DTARGET_BELL=7 \
53-DTARGET_BS=8 \
54-DTARGET_FF=12 \
55-DTARGET_NEWLINE=10 \
56-DTARGET_CR=13 \
57-DTARGET_TAB=9 \
58-DTARGET_VT=11
59
diff --git a/libraries/edje/src/bin/epp/Makefile.in b/libraries/edje/src/bin/epp/Makefile.in
new file mode 100644
index 0000000..2ef2e56
--- /dev/null
+++ b/libraries/edje/src/bin/epp/Makefile.in
@@ -0,0 +1,756 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18# Makefile for GNU C compiler.
19# Copyright (C) 1987, 88, 90-94, 1995 Free Software Foundation, Inc.
20
21#This file is part of GNU CC.
22
23#GNU CC is free software; you can redistribute it and/or modify
24#it under the terms of the GNU General Public License as published by
25#the Free Software Foundation; either version 2, or (at your option)
26#any later version.
27
28#GNU CC is distributed in the hope that it will be useful,
29#but WITHOUT ANY WARRANTY; without even the implied warranty of
30#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31#GNU General Public License for more details.
32
33#You should have received a copy of the GNU General Public License
34#along with GNU CC; see the file COPYING. If not, write to
35#the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
36
37VPATH = @srcdir@
38pkgdatadir = $(datadir)/@PACKAGE@
39pkgincludedir = $(includedir)/@PACKAGE@
40pkglibdir = $(libdir)/@PACKAGE@
41pkglibexecdir = $(libexecdir)/@PACKAGE@
42am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
43install_sh_DATA = $(install_sh) -c -m 644
44install_sh_PROGRAM = $(install_sh) -c
45install_sh_SCRIPT = $(install_sh) -c
46INSTALL_HEADER = $(INSTALL_DATA)
47transform = $(program_transform_name)
48NORMAL_INSTALL = :
49PRE_INSTALL = :
50POST_INSTALL = :
51NORMAL_UNINSTALL = :
52PRE_UNINSTALL = :
53POST_UNINSTALL = :
54build_triplet = @build@
55host_triplet = @host@
56epp_PROGRAMS = epp$(EXEEXT)
57subdir = src/bin/epp
58DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
59ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
60am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
61 $(top_srcdir)/m4/efl_binary.m4 \
62 $(top_srcdir)/m4/efl_coverage.m4 \
63 $(top_srcdir)/m4/efl_doxygen.m4 \
64 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
65 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
66 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
67 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
68am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
69 $(ACLOCAL_M4)
70mkinstalldirs = $(install_sh) -d
71CONFIG_HEADER = $(top_builddir)/config.h
72CONFIG_CLEAN_FILES =
73CONFIG_CLEAN_VPATH_FILES =
74am__installdirs = "$(DESTDIR)$(eppdir)"
75PROGRAMS = $(epp_PROGRAMS)
76am_epp_OBJECTS = epp-cppalloc.$(OBJEXT) epp-cpperror.$(OBJEXT) \
77 epp-cppexp.$(OBJEXT) epp-cpphash.$(OBJEXT) \
78 epp-cpplib.$(OBJEXT) epp-cppmain.$(OBJEXT)
79epp_OBJECTS = $(am_epp_OBJECTS)
80epp_LDADD = $(LDADD)
81AM_V_lt = $(am__v_lt_$(V))
82am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
83am__v_lt_0 = --silent
84DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
85depcomp = $(SHELL) $(top_srcdir)/depcomp
86am__depfiles_maybe = depfiles
87am__mv = mv -f
88COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
89 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
90LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
91 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
92 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
93 $(AM_CFLAGS) $(CFLAGS)
94AM_V_CC = $(am__v_CC_$(V))
95am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
96am__v_CC_0 = @echo " CC " $@;
97AM_V_at = $(am__v_at_$(V))
98am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
99am__v_at_0 = @
100CCLD = $(CC)
101LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
102 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
103 $(AM_LDFLAGS) $(LDFLAGS) -o $@
104AM_V_CCLD = $(am__v_CCLD_$(V))
105am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
106am__v_CCLD_0 = @echo " CCLD " $@;
107AM_V_GEN = $(am__v_GEN_$(V))
108am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
109am__v_GEN_0 = @echo " GEN " $@;
110SOURCES = $(epp_SOURCES)
111DIST_SOURCES = $(epp_SOURCES)
112ETAGS = etags
113CTAGS = ctags
114DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
115ACLOCAL = @ACLOCAL@
116ALLOCA = @ALLOCA@
117ALSA_CFLAGS = @ALSA_CFLAGS@
118ALSA_LIBS = @ALSA_LIBS@
119AMTAR = @AMTAR@
120AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
121AR = @AR@
122AS = @AS@
123AUTOCONF = @AUTOCONF@
124AUTOHEADER = @AUTOHEADER@
125AUTOMAKE = @AUTOMAKE@
126AWK = @AWK@
127CC = @CC@
128CCDEPMODE = @CCDEPMODE@
129CFLAGS = @CFLAGS@
130CHECK_CFLAGS = @CHECK_CFLAGS@
131CHECK_LIBS = @CHECK_LIBS@
132CPP = @CPP@
133CPPFLAGS = @CPPFLAGS@
134CYGPATH_W = @CYGPATH_W@
135DEFS = \
136-DHAVE_CONFIG_H \
137-DHAVE_STRERROR \
138-DFATAL_EXIT_CODE=1 \
139-DSUCCESS_EXIT_CODE=0 \
140-DGCC_INCLUDE_DIR=\"/usr/include\" \
141-DGPLUSPLUS_INCLUDE_DIR=\"/usr/include\" \
142-DTOOL_INCLUDE_DIR=\"/usr/bin\" \
143-DHOST_BITS_PER_LONG=32 \
144-DBITS_PER_UNIT=8 \
145-DHOST_BITS_PER_INT=32 \
146-DBITS_PER_WORD=16 \
147-DTARGET_BELL=7 \
148-DTARGET_BS=8 \
149-DTARGET_FF=12 \
150-DTARGET_NEWLINE=10 \
151-DTARGET_CR=13 \
152-DTARGET_TAB=9 \
153-DTARGET_VT=11
154
155DEPDIR = @DEPDIR@
156DLLTOOL = @DLLTOOL@
157DSYMUTIL = @DSYMUTIL@
158DUMPBIN = @DUMPBIN@
159ECHO_C = @ECHO_C@
160ECHO_N = @ECHO_N@
161ECHO_T = @ECHO_T@
162ECORE_IMF_CFLAGS = @ECORE_IMF_CFLAGS@
163ECORE_IMF_LIBS = @ECORE_IMF_LIBS@
164EDJE_CC_CFLAGS = @EDJE_CC_CFLAGS@
165EDJE_CC_LIBS = @EDJE_CC_LIBS@
166EDJE_CC_PRG = @EDJE_CC_PRG@
167EDJE_CFLAGS = @EDJE_CFLAGS@
168EDJE_DECC_CFLAGS = @EDJE_DECC_CFLAGS@
169EDJE_DECC_LIBS = @EDJE_DECC_LIBS@
170EDJE_DECC_PRG = @EDJE_DECC_PRG@
171EDJE_EXTERNAL_INSPECTOR_CFLAGS = @EDJE_EXTERNAL_INSPECTOR_CFLAGS@
172EDJE_EXTERNAL_INSPECTOR_LIBS = @EDJE_EXTERNAL_INSPECTOR_LIBS@
173EDJE_EXTERNAL_INSPECTOR_PRG = @EDJE_EXTERNAL_INSPECTOR_PRG@
174EDJE_INSPECTOR_CFLAGS = @EDJE_INSPECTOR_CFLAGS@
175EDJE_INSPECTOR_LIBS = @EDJE_INSPECTOR_LIBS@
176EDJE_INSPECTOR_PRG = @EDJE_INSPECTOR_PRG@
177EDJE_LIBS = @EDJE_LIBS@
178EDJE_PLAYER_CFLAGS = @EDJE_PLAYER_CFLAGS@
179EDJE_PLAYER_LIBS = @EDJE_PLAYER_LIBS@
180EDJE_PLAYER_PRG = @EDJE_PLAYER_PRG@
181EDJE_RECC_PRG = @EDJE_RECC_PRG@
182EFL_COVERAGE_CFLAGS = @EFL_COVERAGE_CFLAGS@
183EFL_COVERAGE_LIBS = @EFL_COVERAGE_LIBS@
184EFL_EDJE_BUILD = @EFL_EDJE_BUILD@
185EGREP = @EGREP@
186EVIL_CFLAGS = @EVIL_CFLAGS@
187EVIL_LIBS = @EVIL_LIBS@
188EXEEXT = @EXEEXT@
189FGREP = @FGREP@
190FLAC_CFLAGS = @FLAC_CFLAGS@
191FLAC_LIBS = @FLAC_LIBS@
192GREP = @GREP@
193INSTALL = @INSTALL@
194INSTALL_DATA = @INSTALL_DATA@
195INSTALL_PROGRAM = @INSTALL_PROGRAM@
196INSTALL_SCRIPT = @INSTALL_SCRIPT@
197INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
198LD = @LD@
199LDFLAGS = @LDFLAGS@
200LIBOBJS = @LIBOBJS@
201LIBS = @LIBS@
202LIBTOOL = @LIBTOOL@
203LIPO = @LIPO@
204LN_S = @LN_S@
205LTLIBOBJS = @LTLIBOBJS@
206LUA_CFLAGS = @LUA_CFLAGS@
207LUA_LIBS = @LUA_LIBS@
208MAKEINFO = @MAKEINFO@
209MINIMAL_CFLAGS = @MINIMAL_CFLAGS@
210MINIMAL_LIBS = @MINIMAL_LIBS@
211MKDIR_P = @MKDIR_P@
212MODULE_ARCH = @MODULE_ARCH@
213NM = @NM@
214NMEDIT = @NMEDIT@
215OBJDUMP = @OBJDUMP@
216OBJEXT = @OBJEXT@
217OTOOL = @OTOOL@
218OTOOL64 = @OTOOL64@
219PACKAGE = @PACKAGE@
220PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
221PACKAGE_NAME = @PACKAGE_NAME@
222PACKAGE_STRING = @PACKAGE_STRING@
223PACKAGE_TARNAME = @PACKAGE_TARNAME@
224PACKAGE_URL = @PACKAGE_URL@
225PACKAGE_VERSION = @PACKAGE_VERSION@
226PATH_SEPARATOR = @PATH_SEPARATOR@
227PKG_CONFIG = @PKG_CONFIG@
228PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
229PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
230PYTHON = @PYTHON@
231PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
232PYTHON_PLATFORM = @PYTHON_PLATFORM@
233PYTHON_PREFIX = @PYTHON_PREFIX@
234PYTHON_VERSION = @PYTHON_VERSION@
235RANLIB = @RANLIB@
236REMIX_CFLAGS = @REMIX_CFLAGS@
237REMIX_LIBS = @REMIX_LIBS@
238REMIX_PLUGIN_DIR = @REMIX_PLUGIN_DIR@
239SED = @SED@
240SET_MAKE = @SET_MAKE@
241SHELL = @SHELL@
242SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
243SNDFILE_LIBS = @SNDFILE_LIBS@
244STRIP = @STRIP@
245VERSION = @VERSION@
246VMAJ = @VMAJ@
247VORBISENC_CFLAGS = @VORBISENC_CFLAGS@
248VORBISENC_LIBS = @VORBISENC_LIBS@
249abs_builddir = @abs_builddir@
250abs_srcdir = @abs_srcdir@
251abs_top_builddir = @abs_top_builddir@
252abs_top_srcdir = @abs_top_srcdir@
253ac_ct_CC = @ac_ct_CC@
254ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
255am__include = @am__include@
256am__leading_dot = @am__leading_dot@
257am__quote = @am__quote@
258am__tar = @am__tar@
259am__untar = @am__untar@
260bindir = @bindir@
261build = @build@
262build_alias = @build_alias@
263build_cpu = @build_cpu@
264build_os = @build_os@
265build_vendor = @build_vendor@
266builddir = @builddir@
267datadir = @datadir@
268datarootdir = @datarootdir@
269docdir = @docdir@
270dvidir = @dvidir@
271edje_cc = @edje_cc@
272efl_doxygen = @efl_doxygen@
273efl_have_doxygen = @efl_have_doxygen@
274exec_prefix = @exec_prefix@
275have_lcov = @have_lcov@
276host = @host@
277host_alias = @host_alias@
278host_cpu = @host_cpu@
279host_os = @host_os@
280host_vendor = @host_vendor@
281htmldir = @htmldir@
282includedir = @includedir@
283infodir = @infodir@
284install_sh = @install_sh@
285libdir = @libdir@
286libexecdir = @libexecdir@
287localedir = @localedir@
288localstatedir = @localstatedir@
289lt_ECHO = @lt_ECHO@
290lt_enable_auto_import = @lt_enable_auto_import@
291lua_libs = @lua_libs@
292mandir = @mandir@
293mkdir_p = @mkdir_p@
294oldincludedir = @oldincludedir@
295pdfdir = @pdfdir@
296pkgconfig_requires_private = @pkgconfig_requires_private@
297pkgpyexecdir = @pkgpyexecdir@
298pkgpythondir = @pkgpythondir@
299prefix = @prefix@
300program_transform_name = @program_transform_name@
301psdir = @psdir@
302pyexecdir = @pyexecdir@
303pythondir = @pythondir@
304release_info = @release_info@
305requirement_edje = @requirement_edje@
306sbindir = @sbindir@
307sharedstatedir = @sharedstatedir@
308srcdir = @srcdir@
309sysconfdir = @sysconfdir@
310target_alias = @target_alias@
311top_build_prefix = @top_build_prefix@
312top_builddir = @top_builddir@
313top_srcdir = @top_srcdir@
314version_info = @version_info@
315vimdir = @vimdir@
316MAINTAINERCLEANFILES = Makefile.in
317eppdir = @libdir@/@PACKAGE@/utils
318epp_SOURCES = \
319cpplib.h \
320cpphash.h \
321cppalloc.c \
322cpperror.c \
323cppexp.c \
324cpphash.c \
325cpplib.c \
326cppmain.c
327
328epp_CPPFLAGS = \
329-I$(top_builddir) \
330$(CWARNFLAGS)
331
332all: all-am
333
334.SUFFIXES:
335.SUFFIXES: .c .lo .o .obj
336$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
337 @for dep in $?; do \
338 case '$(am__configure_deps)' in \
339 *$$dep*) \
340 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
341 && { if test -f $@; then exit 0; else break; fi; }; \
342 exit 1;; \
343 esac; \
344 done; \
345 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/bin/epp/Makefile'; \
346 $(am__cd) $(top_srcdir) && \
347 $(AUTOMAKE) --gnu src/bin/epp/Makefile
348.PRECIOUS: Makefile
349Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
350 @case '$?' in \
351 *config.status*) \
352 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
353 *) \
354 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
355 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
356 esac;
357
358$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
359 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
360
361$(top_srcdir)/configure: $(am__configure_deps)
362 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
363$(ACLOCAL_M4): $(am__aclocal_m4_deps)
364 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
365$(am__aclocal_m4_deps):
366install-eppPROGRAMS: $(epp_PROGRAMS)
367 @$(NORMAL_INSTALL)
368 test -z "$(eppdir)" || $(MKDIR_P) "$(DESTDIR)$(eppdir)"
369 @list='$(epp_PROGRAMS)'; test -n "$(eppdir)" || list=; \
370 for p in $$list; do echo "$$p $$p"; done | \
371 sed 's/$(EXEEXT)$$//' | \
372 while read p p1; do if test -f $$p || test -f $$p1; \
373 then echo "$$p"; echo "$$p"; else :; fi; \
374 done | \
375 sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
376 -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
377 sed 'N;N;N;s,\n, ,g' | \
378 $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
379 { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
380 if ($$2 == $$4) files[d] = files[d] " " $$1; \
381 else { print "f", $$3 "/" $$4, $$1; } } \
382 END { for (d in files) print "f", d, files[d] }' | \
383 while read type dir files; do \
384 if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
385 test -z "$$files" || { \
386 echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(eppdir)$$dir'"; \
387 $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(eppdir)$$dir" || exit $$?; \
388 } \
389 ; done
390
391uninstall-eppPROGRAMS:
392 @$(NORMAL_UNINSTALL)
393 @list='$(epp_PROGRAMS)'; test -n "$(eppdir)" || list=; \
394 files=`for p in $$list; do echo "$$p"; done | \
395 sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
396 -e 's/$$/$(EXEEXT)/' `; \
397 test -n "$$list" || exit 0; \
398 echo " ( cd '$(DESTDIR)$(eppdir)' && rm -f" $$files ")"; \
399 cd "$(DESTDIR)$(eppdir)" && rm -f $$files
400
401clean-eppPROGRAMS:
402 @list='$(epp_PROGRAMS)'; test -n "$$list" || exit 0; \
403 echo " rm -f" $$list; \
404 rm -f $$list || exit $$?; \
405 test -n "$(EXEEXT)" || exit 0; \
406 list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
407 echo " rm -f" $$list; \
408 rm -f $$list
409epp$(EXEEXT): $(epp_OBJECTS) $(epp_DEPENDENCIES)
410 @rm -f epp$(EXEEXT)
411 $(AM_V_CCLD)$(LINK) $(epp_OBJECTS) $(epp_LDADD) $(LIBS)
412
413mostlyclean-compile:
414 -rm -f *.$(OBJEXT)
415
416distclean-compile:
417 -rm -f *.tab.c
418
419@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epp-cppalloc.Po@am__quote@
420@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epp-cpperror.Po@am__quote@
421@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epp-cppexp.Po@am__quote@
422@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epp-cpphash.Po@am__quote@
423@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epp-cpplib.Po@am__quote@
424@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epp-cppmain.Po@am__quote@
425
426.c.o:
427@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
428@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
429@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
430@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
431@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
432@am__fastdepCC_FALSE@ $(COMPILE) -c $<
433
434.c.obj:
435@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
436@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
437@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
438@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
439@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
440@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
441
442.c.lo:
443@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
444@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
445@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
446@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
447@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
448@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
449
450epp-cppalloc.o: cppalloc.c
451@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cppalloc.o -MD -MP -MF $(DEPDIR)/epp-cppalloc.Tpo -c -o epp-cppalloc.o `test -f 'cppalloc.c' || echo '$(srcdir)/'`cppalloc.c
452@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cppalloc.Tpo $(DEPDIR)/epp-cppalloc.Po
453@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
454@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cppalloc.c' object='epp-cppalloc.o' libtool=no @AMDEPBACKSLASH@
455@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
456@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cppalloc.o `test -f 'cppalloc.c' || echo '$(srcdir)/'`cppalloc.c
457
458epp-cppalloc.obj: cppalloc.c
459@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cppalloc.obj -MD -MP -MF $(DEPDIR)/epp-cppalloc.Tpo -c -o epp-cppalloc.obj `if test -f 'cppalloc.c'; then $(CYGPATH_W) 'cppalloc.c'; else $(CYGPATH_W) '$(srcdir)/cppalloc.c'; fi`
460@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cppalloc.Tpo $(DEPDIR)/epp-cppalloc.Po
461@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
462@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cppalloc.c' object='epp-cppalloc.obj' libtool=no @AMDEPBACKSLASH@
463@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
464@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cppalloc.obj `if test -f 'cppalloc.c'; then $(CYGPATH_W) 'cppalloc.c'; else $(CYGPATH_W) '$(srcdir)/cppalloc.c'; fi`
465
466epp-cpperror.o: cpperror.c
467@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cpperror.o -MD -MP -MF $(DEPDIR)/epp-cpperror.Tpo -c -o epp-cpperror.o `test -f 'cpperror.c' || echo '$(srcdir)/'`cpperror.c
468@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cpperror.Tpo $(DEPDIR)/epp-cpperror.Po
469@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
470@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpperror.c' object='epp-cpperror.o' libtool=no @AMDEPBACKSLASH@
471@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
472@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cpperror.o `test -f 'cpperror.c' || echo '$(srcdir)/'`cpperror.c
473
474epp-cpperror.obj: cpperror.c
475@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cpperror.obj -MD -MP -MF $(DEPDIR)/epp-cpperror.Tpo -c -o epp-cpperror.obj `if test -f 'cpperror.c'; then $(CYGPATH_W) 'cpperror.c'; else $(CYGPATH_W) '$(srcdir)/cpperror.c'; fi`
476@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cpperror.Tpo $(DEPDIR)/epp-cpperror.Po
477@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
478@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpperror.c' object='epp-cpperror.obj' libtool=no @AMDEPBACKSLASH@
479@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
480@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cpperror.obj `if test -f 'cpperror.c'; then $(CYGPATH_W) 'cpperror.c'; else $(CYGPATH_W) '$(srcdir)/cpperror.c'; fi`
481
482epp-cppexp.o: cppexp.c
483@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cppexp.o -MD -MP -MF $(DEPDIR)/epp-cppexp.Tpo -c -o epp-cppexp.o `test -f 'cppexp.c' || echo '$(srcdir)/'`cppexp.c
484@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cppexp.Tpo $(DEPDIR)/epp-cppexp.Po
485@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
486@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cppexp.c' object='epp-cppexp.o' libtool=no @AMDEPBACKSLASH@
487@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
488@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cppexp.o `test -f 'cppexp.c' || echo '$(srcdir)/'`cppexp.c
489
490epp-cppexp.obj: cppexp.c
491@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cppexp.obj -MD -MP -MF $(DEPDIR)/epp-cppexp.Tpo -c -o epp-cppexp.obj `if test -f 'cppexp.c'; then $(CYGPATH_W) 'cppexp.c'; else $(CYGPATH_W) '$(srcdir)/cppexp.c'; fi`
492@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cppexp.Tpo $(DEPDIR)/epp-cppexp.Po
493@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
494@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cppexp.c' object='epp-cppexp.obj' libtool=no @AMDEPBACKSLASH@
495@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
496@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cppexp.obj `if test -f 'cppexp.c'; then $(CYGPATH_W) 'cppexp.c'; else $(CYGPATH_W) '$(srcdir)/cppexp.c'; fi`
497
498epp-cpphash.o: cpphash.c
499@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cpphash.o -MD -MP -MF $(DEPDIR)/epp-cpphash.Tpo -c -o epp-cpphash.o `test -f 'cpphash.c' || echo '$(srcdir)/'`cpphash.c
500@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cpphash.Tpo $(DEPDIR)/epp-cpphash.Po
501@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
502@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpphash.c' object='epp-cpphash.o' libtool=no @AMDEPBACKSLASH@
503@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
504@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cpphash.o `test -f 'cpphash.c' || echo '$(srcdir)/'`cpphash.c
505
506epp-cpphash.obj: cpphash.c
507@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cpphash.obj -MD -MP -MF $(DEPDIR)/epp-cpphash.Tpo -c -o epp-cpphash.obj `if test -f 'cpphash.c'; then $(CYGPATH_W) 'cpphash.c'; else $(CYGPATH_W) '$(srcdir)/cpphash.c'; fi`
508@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cpphash.Tpo $(DEPDIR)/epp-cpphash.Po
509@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
510@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpphash.c' object='epp-cpphash.obj' libtool=no @AMDEPBACKSLASH@
511@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
512@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cpphash.obj `if test -f 'cpphash.c'; then $(CYGPATH_W) 'cpphash.c'; else $(CYGPATH_W) '$(srcdir)/cpphash.c'; fi`
513
514epp-cpplib.o: cpplib.c
515@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cpplib.o -MD -MP -MF $(DEPDIR)/epp-cpplib.Tpo -c -o epp-cpplib.o `test -f 'cpplib.c' || echo '$(srcdir)/'`cpplib.c
516@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cpplib.Tpo $(DEPDIR)/epp-cpplib.Po
517@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
518@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpplib.c' object='epp-cpplib.o' libtool=no @AMDEPBACKSLASH@
519@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
520@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cpplib.o `test -f 'cpplib.c' || echo '$(srcdir)/'`cpplib.c
521
522epp-cpplib.obj: cpplib.c
523@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cpplib.obj -MD -MP -MF $(DEPDIR)/epp-cpplib.Tpo -c -o epp-cpplib.obj `if test -f 'cpplib.c'; then $(CYGPATH_W) 'cpplib.c'; else $(CYGPATH_W) '$(srcdir)/cpplib.c'; fi`
524@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cpplib.Tpo $(DEPDIR)/epp-cpplib.Po
525@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
526@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpplib.c' object='epp-cpplib.obj' libtool=no @AMDEPBACKSLASH@
527@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
528@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cpplib.obj `if test -f 'cpplib.c'; then $(CYGPATH_W) 'cpplib.c'; else $(CYGPATH_W) '$(srcdir)/cpplib.c'; fi`
529
530epp-cppmain.o: cppmain.c
531@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cppmain.o -MD -MP -MF $(DEPDIR)/epp-cppmain.Tpo -c -o epp-cppmain.o `test -f 'cppmain.c' || echo '$(srcdir)/'`cppmain.c
532@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cppmain.Tpo $(DEPDIR)/epp-cppmain.Po
533@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
534@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cppmain.c' object='epp-cppmain.o' libtool=no @AMDEPBACKSLASH@
535@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
536@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cppmain.o `test -f 'cppmain.c' || echo '$(srcdir)/'`cppmain.c
537
538epp-cppmain.obj: cppmain.c
539@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cppmain.obj -MD -MP -MF $(DEPDIR)/epp-cppmain.Tpo -c -o epp-cppmain.obj `if test -f 'cppmain.c'; then $(CYGPATH_W) 'cppmain.c'; else $(CYGPATH_W) '$(srcdir)/cppmain.c'; fi`
540@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cppmain.Tpo $(DEPDIR)/epp-cppmain.Po
541@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
542@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cppmain.c' object='epp-cppmain.obj' libtool=no @AMDEPBACKSLASH@
543@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
544@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cppmain.obj `if test -f 'cppmain.c'; then $(CYGPATH_W) 'cppmain.c'; else $(CYGPATH_W) '$(srcdir)/cppmain.c'; fi`
545
546mostlyclean-libtool:
547 -rm -f *.lo
548
549clean-libtool:
550 -rm -rf .libs _libs
551
552ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
553 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
554 unique=`for i in $$list; do \
555 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
556 done | \
557 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
558 END { if (nonempty) { for (i in files) print i; }; }'`; \
559 mkid -fID $$unique
560tags: TAGS
561
562TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
563 $(TAGS_FILES) $(LISP)
564 set x; \
565 here=`pwd`; \
566 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
567 unique=`for i in $$list; do \
568 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
569 done | \
570 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
571 END { if (nonempty) { for (i in files) print i; }; }'`; \
572 shift; \
573 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
574 test -n "$$unique" || unique=$$empty_fix; \
575 if test $$# -gt 0; then \
576 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
577 "$$@" $$unique; \
578 else \
579 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
580 $$unique; \
581 fi; \
582 fi
583ctags: CTAGS
584CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
585 $(TAGS_FILES) $(LISP)
586 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
587 unique=`for i in $$list; do \
588 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
589 done | \
590 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
591 END { if (nonempty) { for (i in files) print i; }; }'`; \
592 test -z "$(CTAGS_ARGS)$$unique" \
593 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
594 $$unique
595
596GTAGS:
597 here=`$(am__cd) $(top_builddir) && pwd` \
598 && $(am__cd) $(top_srcdir) \
599 && gtags -i $(GTAGS_ARGS) "$$here"
600
601distclean-tags:
602 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
603
604distdir: $(DISTFILES)
605 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
606 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
607 list='$(DISTFILES)'; \
608 dist_files=`for file in $$list; do echo $$file; done | \
609 sed -e "s|^$$srcdirstrip/||;t" \
610 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
611 case $$dist_files in \
612 */*) $(MKDIR_P) `echo "$$dist_files" | \
613 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
614 sort -u` ;; \
615 esac; \
616 for file in $$dist_files; do \
617 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
618 if test -d $$d/$$file; then \
619 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
620 if test -d "$(distdir)/$$file"; then \
621 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
622 fi; \
623 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
624 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
625 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
626 fi; \
627 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
628 else \
629 test -f "$(distdir)/$$file" \
630 || cp -p $$d/$$file "$(distdir)/$$file" \
631 || exit 1; \
632 fi; \
633 done
634check-am: all-am
635check: check-am
636all-am: Makefile $(PROGRAMS)
637installdirs:
638 for dir in "$(DESTDIR)$(eppdir)"; do \
639 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
640 done
641install: install-am
642install-exec: install-exec-am
643install-data: install-data-am
644uninstall: uninstall-am
645
646install-am: all-am
647 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
648
649installcheck: installcheck-am
650install-strip:
651 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
652 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
653 `test -z '$(STRIP)' || \
654 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
655mostlyclean-generic:
656
657clean-generic:
658
659distclean-generic:
660 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
661 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
662
663maintainer-clean-generic:
664 @echo "This command is intended for maintainers to use"
665 @echo "it deletes files that may require special tools to rebuild."
666 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
667clean: clean-am
668
669clean-am: clean-eppPROGRAMS clean-generic clean-libtool mostlyclean-am
670
671distclean: distclean-am
672 -rm -rf ./$(DEPDIR)
673 -rm -f Makefile
674distclean-am: clean-am distclean-compile distclean-generic \
675 distclean-tags
676
677dvi: dvi-am
678
679dvi-am:
680
681html: html-am
682
683html-am:
684
685info: info-am
686
687info-am:
688
689install-data-am: install-eppPROGRAMS
690
691install-dvi: install-dvi-am
692
693install-dvi-am:
694
695install-exec-am:
696
697install-html: install-html-am
698
699install-html-am:
700
701install-info: install-info-am
702
703install-info-am:
704
705install-man:
706
707install-pdf: install-pdf-am
708
709install-pdf-am:
710
711install-ps: install-ps-am
712
713install-ps-am:
714
715installcheck-am:
716
717maintainer-clean: maintainer-clean-am
718 -rm -rf ./$(DEPDIR)
719 -rm -f Makefile
720maintainer-clean-am: distclean-am maintainer-clean-generic
721
722mostlyclean: mostlyclean-am
723
724mostlyclean-am: mostlyclean-compile mostlyclean-generic \
725 mostlyclean-libtool
726
727pdf: pdf-am
728
729pdf-am:
730
731ps: ps-am
732
733ps-am:
734
735uninstall-am: uninstall-eppPROGRAMS
736
737.MAKE: install-am install-strip
738
739.PHONY: CTAGS GTAGS all all-am check check-am clean clean-eppPROGRAMS \
740 clean-generic clean-libtool ctags distclean distclean-compile \
741 distclean-generic distclean-libtool distclean-tags distdir dvi \
742 dvi-am html html-am info info-am install install-am \
743 install-data install-data-am install-dvi install-dvi-am \
744 install-eppPROGRAMS install-exec install-exec-am install-html \
745 install-html-am install-info install-info-am install-man \
746 install-pdf install-pdf-am install-ps install-ps-am \
747 install-strip installcheck installcheck-am installdirs \
748 maintainer-clean maintainer-clean-generic mostlyclean \
749 mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
750 pdf pdf-am ps ps-am tags uninstall uninstall-am \
751 uninstall-eppPROGRAMS
752
753
754# Tell versions [3.59,3.63) of GNU make to not export all variables.
755# Otherwise a system limit (for SysV at least) may be exceeded.
756.NOEXPORT:
diff --git a/libraries/edje/src/bin/epp/cppalloc.c b/libraries/edje/src/bin/epp/cppalloc.c
new file mode 100644
index 0000000..4ce0dd0
--- /dev/null
+++ b/libraries/edje/src/bin/epp/cppalloc.c
@@ -0,0 +1,70 @@
1/* Part of CPP library. (memory allocation - xmalloc etc)
2 * Copyright (C) 1986, 87, 89, 92, 93, 94, 1995 Free Software Foundation, Inc.
3 * Written by Per Bothner, 1994.
4 * Based on CCCP program by by Paul Rubin, June 1986
5 * Adapted to ANSI C, Richard Stallman, Jan 1987
6 * Copyright (C) 2003-2011 Kim Woelders
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
11 * later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * In other words, you are welcome to use, share and improve this program.
23 * You are forbidden to forbid anyone else to use, share and improve
24 * what you give them. Help stamp out software-hoarding! */
25
26#ifdef HAVE_CONFIG_H
27# include <config.h>
28#endif
29
30#include <stdlib.h>
31
32#include "cpplib.h"
33
34static void
35memory_full(void)
36{
37 cpp_fatal("Memory exhausted.");
38}
39
40void *
41xmalloc(unsigned size)
42{
43 char *ptr = (char *)malloc(size);
44
45 if (ptr)
46 return (ptr);
47 memory_full();
48 /*NOTREACHED */
49 return 0;
50}
51
52void *
53xrealloc(void *old, unsigned size)
54{
55 char *ptr = (char *)realloc(old, size);
56
57 if (!ptr)
58 memory_full();
59 return ptr;
60}
61
62void *
63xcalloc(unsigned number, unsigned size)
64{
65 char *ptr = (char *)calloc(number, size);
66
67 if (!ptr)
68 memory_full();
69 return ptr;
70}
diff --git a/libraries/edje/src/bin/epp/cpperror.c b/libraries/edje/src/bin/epp/cpperror.c
new file mode 100644
index 0000000..f4cd5eb
--- /dev/null
+++ b/libraries/edje/src/bin/epp/cpperror.c
@@ -0,0 +1,147 @@
1/* Default error handlers for CPP Library.
2 * Copyright (C) 1986, 87, 89, 92, 93, 94, 1995 Free Software Foundation, Inc.
3 * Written by Per Bothner, 1994.
4 * Based on CCCP program by by Paul Rubin, June 1986
5 * Adapted to ANSI C, Richard Stallman, Jan 1987
6 * Copyright (C) 2003-2011 Kim Woelders
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
11 * later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * In other words, you are welcome to use, share and improve this program.
23 * You are forbidden to forbid anyone else to use, share and improve
24 * what you give them. Help stamp out software-hoarding! */
25
26#ifdef HAVE_CONFIG_H
27# include <config.h>
28#endif
29
30#include <stdio.h>
31#include <stdlib.h>
32
33#include "cpplib.h"
34
35/* Print the file names and line numbers of the #include
36 * commands which led to the current file. */
37
38void
39cpp_print_containing_files(cpp_reader * pfile)
40{
41 cpp_buffer *ip;
42 int first = 1;
43
44 /* If stack of files hasn't changed since we last printed
45 * this info, don't repeat it. */
46 if (pfile->input_stack_listing_current)
47 return;
48
49 ip = cpp_file_buffer(pfile);
50
51 /* Give up if we don't find a source file. */
52 if (!ip)
53 return;
54
55 /* Find the other, outer source files. */
56 while ((ip = CPP_PREV_BUFFER(ip)), ip != CPP_NULL_BUFFER(pfile))
57 {
58 long line, col;
59
60 cpp_buf_line_and_col(ip, &line, &col);
61 if (ip->fname)
62 {
63 if (first)
64 {
65 first = 0;
66 fprintf(stderr, "In file included");
67 }
68 else
69 fprintf(stderr, ",\n ");
70 }
71 }
72 if (!first)
73 fprintf(stderr, ":\n");
74
75 /* Record we have printed the status as of this time. */
76 pfile->input_stack_listing_current = 1;
77}
78
79void
80cpp_file_line_for_message(cpp_reader * pfile __UNUSED__, const char *filename,
81 int line, int column)
82{
83 if (column > 0)
84 {
85 fprintf(stderr, "%s:%d:%d: ", filename, line, column);
86 }
87 else
88 {
89 fprintf(stderr, "%s:%d: ", filename, line);
90 }
91}
92
93/* IS_ERROR is 1 for error, 0 for warning */
94void
95cpp_message_v(cpp_reader * pfile, int is_error, const char *msg, va_list args)
96{
97 if (is_error)
98 pfile->errors++;
99 else
100 fprintf(stderr, "warning: ");
101 vfprintf(stderr, msg, args);
102 fprintf(stderr, "\n");
103}
104
105void
106cpp_message(cpp_reader * pfile, int is_error, const char *msg, ...)
107{
108 va_list args;
109
110 va_start(args, msg);
111
112 cpp_message_v(pfile, is_error, msg, args);
113
114 va_end(args);
115}
116
117static void
118cpp_fatal_v(const char *msg, va_list args)
119{
120 fprintf(stderr, "%s: ", progname);
121 vfprintf(stderr, msg, args);
122 fprintf(stderr, "\n");
123 exit(FATAL_EXIT_CODE);
124}
125
126void
127cpp_fatal(const char *msg, ...)
128{
129 va_list args;
130
131 va_start(args, msg);
132
133 cpp_fatal_v(msg, args);
134
135 va_end(args);
136}
137
138void
139cpp_pfatal_with_name(cpp_reader * pfile, const char *name)
140{
141 cpp_perror_with_name(pfile, name);
142#ifdef VMS
143 exit(vaxc$errno);
144#else
145 exit(FATAL_EXIT_CODE);
146#endif
147}
diff --git a/libraries/edje/src/bin/epp/cppexp.c b/libraries/edje/src/bin/epp/cppexp.c
new file mode 100644
index 0000000..5fcb33f
--- /dev/null
+++ b/libraries/edje/src/bin/epp/cppexp.c
@@ -0,0 +1,1090 @@
1/* Parse C expressions for CCCP.
2 * Copyright (C) 1987, 1992, 1994, 1995 Free Software Foundation.
3 * Copyright (C) 2003-2011 Kim Woelders
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2, or (at your option) any
8 * later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * In other words, you are welcome to use, share and improve this program.
20 * You are forbidden to forbid anyone else to use, share and improve
21 * what you give them. Help stamp out software-hoarding!
22 *
23 * Written by Per Bothner 1994. */
24
25/* Parse a C expression from text in a string */
26
27#ifdef HAVE_CONFIG_H
28# include <config.h>
29#endif
30
31#ifdef __EMX__
32# include <strings.h>
33#endif
34
35#ifdef MULTIBYTE_CHARS
36# include <locale.h>
37#endif
38
39#include <stdlib.h>
40#include <stdio.h>
41#include <string.h>
42
43#include "cpplib.h"
44#include "cpphash.h"
45
46/* This is used for communicating lists of keywords with cccp.c. */
47struct arglist {
48 struct arglist *next;
49 unsigned char *name;
50 int length;
51 int argno;
52};
53
54/* Define a generic NULL if one hasn't already been defined. */
55
56#ifndef NULL
57#define NULL 0
58#endif
59
60#ifndef GENERIC_PTR
61#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
62#define GENERIC_PTR void *
63#else
64#define GENERIC_PTR char *
65#endif
66#endif
67
68#ifndef NULL_PTR
69#define NULL_PTR ((GENERIC_PTR)0)
70#endif
71
72#ifndef CHAR_TYPE_SIZE
73#define CHAR_TYPE_SIZE BITS_PER_UNIT
74#endif
75
76#ifndef INT_TYPE_SIZE
77#define INT_TYPE_SIZE BITS_PER_WORD
78#endif
79
80#ifndef LONG_TYPE_SIZE
81#define LONG_TYPE_SIZE BITS_PER_WORD
82#endif
83
84#ifndef WCHAR_TYPE_SIZE
85#define WCHAR_TYPE_SIZE INT_TYPE_SIZE
86#endif
87
88#ifndef MAX_CHAR_TYPE_SIZE
89#define MAX_CHAR_TYPE_SIZE CHAR_TYPE_SIZE
90#endif
91
92#ifndef MAX_INT_TYPE_SIZE
93#define MAX_INT_TYPE_SIZE INT_TYPE_SIZE
94#endif
95
96#ifndef MAX_LONG_TYPE_SIZE
97#define MAX_LONG_TYPE_SIZE LONG_TYPE_SIZE
98#endif
99
100#ifndef MAX_WCHAR_TYPE_SIZE
101#define MAX_WCHAR_TYPE_SIZE WCHAR_TYPE_SIZE
102#endif
103
104/* Yield nonzero if adding two numbers with A's and B's signs can yield a
105 * number with SUM's sign, where A, B, and SUM are all C integers. */
106#define possible_sum_sign(a, b, sum) ((((a) ^ (b)) | ~ ((a) ^ (sum))) < 0)
107
108#define ERROR 299
109#define OROR 300
110#define ANDAND 301
111#define EQUAL 302
112#define NOTEQUAL 303
113#define LEQ 304
114#define GEQ 305
115#define LSH 306
116#define RSH 307
117#define NAME 308
118#define INT 309
119#define CHAR 310
120
121#define LEFT_OPERAND_REQUIRED 1
122#define RIGHT_OPERAND_REQUIRED 2
123#define HAVE_VALUE 4
124/* SKIP_OPERAND is set for '&&' '||' '?' and ':' when the
125 * following operand should be short-circuited instead of evaluated. */
126#define SKIP_OPERAND 8
127/*#define UNSIGNEDP 16 */
128
129struct operation {
130 short op;
131 char rprio; /* Priority of op (relative to it right operand). */
132 char flags;
133 char unsignedp; /* true if value should be treated as unsigned */
134 HOST_WIDE_INT value; /* The value logically "right" of op. */
135};
136
137/* Take care of parsing a number (anything that starts with a digit).
138 * LEN is the number of characters in it. */
139
140/* maybe needs to actually deal with floating point numbers */
141
142static void
143parse_number(struct operation *op, cpp_reader * pfile, const char *start,
144 int olen)
145{
146 const char *p = start;
147 int c;
148 unsigned long n = 0, nd, ULONG_MAX_over_base;
149 int base = 10;
150 int len = olen;
151 int overflow = 0;
152 int digit, largest_digit = 0;
153 int spec_long = 0;
154
155 op->unsignedp = 0;
156
157 for (c = 0; c < len; c++)
158 if (p[c] == '.')
159 {
160 /* It's a float since it contains a point. */
161 cpp_error(pfile,
162 "floating point numbers not allowed in #if expressions");
163 op->op = ERROR;
164 return;
165 }
166 if (len >= 3 && (!strncmp(p, "0x", 2) || !strncmp(p, "0X", 2)))
167 {
168 p += 2;
169 base = 16;
170 len -= 2;
171 }
172 else if (*p == '0')
173 base = 8;
174
175 /* Some buggy compilers (e.g. MPW C) seem to need both casts. */
176 ULONG_MAX_over_base = ((unsigned long)-1) / ((unsigned long)base);
177
178 for (; len > 0; len--)
179 {
180 c = *p++;
181
182 if (c >= '0' && c <= '9')
183 digit = c - '0';
184 else if (base == 16 && c >= 'a' && c <= 'f')
185 digit = c - 'a' + 10;
186 else if (base == 16 && c >= 'A' && c <= 'F')
187 digit = c - 'A' + 10;
188 else
189 {
190 /* `l' means long, and `u' means unsigned. */
191 while (1)
192 {
193 if (c == 'l' || c == 'L')
194 {
195 if (spec_long)
196 cpp_error(pfile, "two `l's in integer constant");
197 spec_long = 1;
198 }
199 else if (c == 'u' || c == 'U')
200 {
201 if (op->unsignedp)
202 cpp_error(pfile, "two `u's in integer constant");
203 op->unsignedp = 1;
204 }
205 else
206 break;
207
208 if (--len == 0)
209 break;
210 c = *p++;
211 }
212 /* Don't look for any more digits after the suffixes. */
213 break;
214 }
215 if (largest_digit < digit)
216 largest_digit = digit;
217 nd = n * base + digit;
218 overflow |= (ULONG_MAX_over_base < n) | (nd < n);
219 n = nd;
220 }
221
222 if (len != 0)
223 {
224 cpp_error(pfile, "Invalid number in #if expression");
225 op->op = ERROR;
226 return;
227 }
228 if (base <= largest_digit)
229 cpp_warning(pfile, "integer constant contains digits beyond the radix");
230
231 if (overflow)
232 cpp_warning(pfile, "integer constant out of range");
233
234 /* If too big to be signed, consider it unsigned. */
235 if ((long)n < 0 && !op->unsignedp)
236 {
237 if (base == 10)
238 cpp_warning(pfile,
239 "integer constant is so large that it is unsigned");
240 op->unsignedp = 1;
241 }
242 op->value = n;
243 op->op = INT;
244}
245
246struct token {
247 const char *oper;
248 int token;
249};
250
251static struct token tokentab2[] = {
252 {"&&", ANDAND},
253 {"||", OROR},
254 {"<<", LSH},
255 {">>", RSH},
256 {"==", EQUAL},
257 {"!=", NOTEQUAL},
258 {"<=", LEQ},
259 {">=", GEQ},
260 {"++", ERROR},
261 {"--", ERROR},
262 {NULL, ERROR}
263};
264
265/* Read one token. */
266
267static void
268cpp_lex(struct operation *op, cpp_reader * pfile)
269{
270 int c;
271 struct token *toktab;
272 enum cpp_token token;
273 unsigned char *tok_start, *tok_end;
274 int old_written;
275
276 op->value = 0;
277 op->unsignedp = 0;
278
279 retry:
280
281 old_written = CPP_WRITTEN(pfile);
282 cpp_skip_hspace(pfile);
283 c = CPP_BUF_PEEK(CPP_BUFFER(pfile));
284 if (c == '#')
285 {
286 parse_number(op, pfile, cpp_read_check_assertion(pfile) ? "1" : "0", 1);
287 return;
288 }
289
290 if (c == '\n')
291 {
292 op->op = 0;
293 return;
294 }
295 token = cpp_get_token(pfile);
296 tok_start = pfile->token_buffer + old_written;
297 tok_end = CPP_PWRITTEN(pfile);
298 pfile->limit = tok_start;
299 switch (token)
300 {
301 case CPP_EOF: /* Should not happen ... */
302 op->op = 0;
303 break;
304
305 case CPP_VSPACE:
306 case CPP_POP:
307 if (CPP_BUFFER(pfile)->fname)
308 {
309 op->op = 0;
310 break;
311 }
312 goto retry;
313
314 case CPP_HSPACE:
315 case CPP_COMMENT:
316 goto retry;
317
318 case CPP_NUMBER:
319 parse_number(op, pfile, (char *)tok_start, tok_end - tok_start);
320 break;
321
322 case CPP_STRING:
323 cpp_error(pfile, "string constants not allowed in #if expressions");
324 op->op = ERROR;
325 break;
326
327 case CPP_CHAR:
328 /* This code for reading a character constant
329 * handles multicharacter constants and wide characters.
330 * It is mostly copied from c-lex.c. */
331 {
332 int result = 0;
333 int num_chars = 0;
334 unsigned width = MAX_CHAR_TYPE_SIZE;
335 int wide_flag = 0;
336 int max_chars;
337 char *ptr = (char *)tok_start;
338
339#ifdef MULTIBYTE_CHARS
340 char token_buffer[MAX_LONG_TYPE_SIZE /
341 MAX_CHAR_TYPE_SIZE + MB_CUR_MAX];
342#endif
343
344 if (*ptr == 'L')
345 {
346 ptr++;
347 wide_flag = 1;
348 width = MAX_WCHAR_TYPE_SIZE;
349#ifdef MULTIBYTE_CHARS
350 max_chars = MB_CUR_MAX;
351#else
352 max_chars = 1;
353#endif
354 }
355 else
356 max_chars = MAX_LONG_TYPE_SIZE / width;
357
358 while (1)
359 {
360 if (ptr >= (char *)CPP_PWRITTEN(pfile) || (c = *ptr++) == '\'')
361 break;
362
363 if (c == '\\')
364 {
365 c = cpp_parse_escape(pfile, &ptr);
366 if (width < HOST_BITS_PER_INT
367 && (unsigned)c >= (unsigned)(1 << width))
368 cpp_pedwarn(pfile,
369 "escape sequence out of range for character");
370 }
371 num_chars++;
372
373 /* Merge character into result; ignore excess chars. */
374 if (num_chars < max_chars + 1)
375 {
376 if (width < HOST_BITS_PER_INT)
377 result = (result << width) | (c & ((1 << width) - 1));
378 else
379 result = c;
380#ifdef MULTIBYTE_CHARS
381 token_buffer[num_chars - 1] = c;
382#endif
383 }
384 }
385
386#ifdef MULTIBYTE_CHARS
387 token_buffer[num_chars] = 0;
388#endif
389
390 if (c != '\'')
391 cpp_error(pfile, "malformatted character constant");
392 else if (num_chars == 0)
393 cpp_error(pfile, "empty character constant");
394 else if (num_chars > max_chars)
395 {
396 num_chars = max_chars;
397 cpp_error(pfile, "character constant too long");
398 }
399 else if (num_chars != 1 && !CPP_TRADITIONAL(pfile))
400 cpp_warning(pfile, "multi-character character constant");
401
402 /* If char type is signed, sign-extend the constant. */
403 if (!wide_flag)
404 {
405 int num_bits = num_chars * width;
406
407 if (cpp_lookup("__CHAR_UNSIGNED__",
408 sizeof("__CHAR_UNSIGNED__") - 1, -1)
409 || ((result >> (num_bits - 1)) & 1) == 0)
410 op->value =
411 result & ((unsigned long)~0 >>
412 (HOST_BITS_PER_LONG - num_bits));
413 else
414 op->value =
415 result | ~((unsigned long)~0 >>
416 (HOST_BITS_PER_LONG - num_bits));
417 }
418 else
419 {
420#ifdef MULTIBYTE_CHARS
421 /* Set the initial shift state and convert the next sequence. */
422 result = 0;
423 /* In all locales L'\0' is zero and mbtowc will return zero,
424 * so don't use it. */
425 if (num_chars > 1
426 || (num_chars == 1 && token_buffer[0] != '\0'))
427 {
428 wchar_t wc;
429
430 (void)mbtowc(NULL_PTR, NULL_PTR, 0);
431 if (mbtowc(&wc, token_buffer, num_chars) == num_chars)
432 result = wc;
433 else
434 cpp_warning(pfile,
435 "Ignoring invalid multibyte character");
436 }
437#endif
438 op->value = result;
439 }
440 }
441
442 /* This is always a signed type. */
443 op->unsignedp = 0;
444 op->op = CHAR;
445 break;
446
447 case CPP_NAME:
448 parse_number(op, pfile, "0", 0);
449 break;
450
451 case CPP_OTHER:
452 /* See if it is a special token of length 2. */
453 if (tok_start + 2 == tok_end)
454 {
455 for (toktab = tokentab2; toktab->oper; toktab++)
456 if (tok_start[0] == toktab->oper[0]
457 && tok_start[1] == toktab->oper[1])
458 break;
459 if (toktab->token == ERROR)
460 {
461 char *buf = (char *)malloc(40);
462
463 memset(buf, 0, 40);
464
465 sprintf(buf, "`%s' not allowed in operand of `#if'",
466 tok_start);
467 cpp_error(pfile, buf);
468 free(buf);
469 }
470 op->op = toktab->token;
471 break;
472 }
473 /* fall through */
474 default:
475 op->op = *tok_start;
476 break;
477 }
478}
479
480/* Parse a C escape sequence. STRING_PTR points to a variable
481 * containing a pointer to the string to parse. That pointer
482 * is updated past the characters we use. The value of the
483 * escape sequence is returned.
484 *
485 * A negative value means the sequence \ newline was seen,
486 * which is supposed to be equivalent to nothing at all.
487 *
488 * If \ is followed by a null character, we return a negative
489 * value and leave the string pointer pointing at the null character.
490 *
491 * If \ is followed by 000, we return 0 and leave the string pointer
492 * after the zeros. A value of 0 does not mean end of string. */
493
494int
495cpp_parse_escape(cpp_reader * pfile, char **string_ptr)
496{
497 int c = *(*string_ptr)++;
498
499 switch (c)
500 {
501 case 'a':
502 return TARGET_BELL;
503 case 'b':
504 return TARGET_BS;
505 case 'e':
506 case 'E':
507 if (CPP_PEDANTIC(pfile))
508 cpp_pedwarn(pfile, "non-ANSI-standard escape sequence, `\\%c'", c);
509 return 033;
510 case 'f':
511 return TARGET_FF;
512 case 'n':
513 return TARGET_NEWLINE;
514 case 'r':
515 return TARGET_CR;
516 case 't':
517 return TARGET_TAB;
518 case 'v':
519 return TARGET_VT;
520 case '\n':
521 return -2;
522 case 0:
523 (*string_ptr)--;
524 return 0;
525
526 case '0':
527 case '1':
528 case '2':
529 case '3':
530 case '4':
531 case '5':
532 case '6':
533 case '7':
534 {
535 int i = c - '0';
536 int count = 0;
537
538 while (++count < 3)
539 {
540 c = *(*string_ptr)++;
541 if (c >= '0' && c <= '7')
542 i = (i << 3) + c - '0';
543 else
544 {
545 (*string_ptr)--;
546 break;
547 }
548 }
549 if ((i & ~((1 << MAX_CHAR_TYPE_SIZE) - 1)) != 0)
550 {
551 i &= (1 << MAX_CHAR_TYPE_SIZE) - 1;
552 cpp_warning(pfile,
553 "octal character constant does not fit in a byte");
554 }
555 return i;
556 }
557 case 'x':
558 {
559 unsigned i = 0, overflow = 0, digits_found = 0, digit;
560
561 for (;;)
562 {
563 c = *(*string_ptr)++;
564 if (c >= '0' && c <= '9')
565 digit = c - '0';
566 else if (c >= 'a' && c <= 'f')
567 digit = c - 'a' + 10;
568 else if (c >= 'A' && c <= 'F')
569 digit = c - 'A' + 10;
570 else
571 {
572 (*string_ptr)--;
573 break;
574 }
575 overflow |= i ^ (i << 4 >> 4);
576 i = (i << 4) + digit;
577 digits_found = 1;
578 }
579 if (!digits_found)
580 cpp_error(pfile, "\\x used with no following hex digits");
581 if (overflow | (i & ~((1 << BITS_PER_UNIT) - 1)))
582 {
583 i &= (1 << BITS_PER_UNIT) - 1;
584 cpp_warning(pfile,
585 "hex character constant does not fit in a byte");
586 }
587 return i;
588 }
589 default:
590 return c;
591 }
592}
593
594static void
595integer_overflow(cpp_reader * pfile)
596{
597 if (CPP_PEDANTIC(pfile))
598 cpp_pedwarn(pfile, "integer overflow in preprocessor expression");
599}
600
601static long
602left_shift(cpp_reader * pfile, long a, int unsignedp, unsigned long b)
603{
604 if (b >= HOST_BITS_PER_LONG)
605 {
606 if (!unsignedp && a != 0)
607 integer_overflow(pfile);
608 return 0;
609 }
610 else if (unsignedp)
611 return (unsigned long)a << b;
612 else
613 {
614 long l = a << b;
615
616 if (l >> b != a)
617 integer_overflow(pfile);
618 return l;
619 }
620}
621
622static long
623right_shift(cpp_reader * pfile __UNUSED__, long a, int unsignedp,
624 unsigned long b)
625{
626 if (b >= HOST_BITS_PER_LONG)
627 {
628 return unsignedp ? 0 : a >> (HOST_BITS_PER_LONG - 1);
629 }
630 else if (unsignedp)
631 {
632 return (unsigned long)a >> b;
633 }
634 else
635 {
636 return a >> b;
637 }
638}
639
640/* These priorities are all even, so we can handle associatively. */
641#define PAREN_INNER_PRIO 0
642#define COMMA_PRIO 4
643#define COND_PRIO (COMMA_PRIO+2)
644#define OROR_PRIO (COND_PRIO+2)
645#define ANDAND_PRIO (OROR_PRIO+2)
646#define OR_PRIO (ANDAND_PRIO+2)
647#define XOR_PRIO (OR_PRIO+2)
648#define AND_PRIO (XOR_PRIO+2)
649#define EQUAL_PRIO (AND_PRIO+2)
650#define LESS_PRIO (EQUAL_PRIO+2)
651#define SHIFT_PRIO (LESS_PRIO+2)
652#define PLUS_PRIO (SHIFT_PRIO+2)
653#define MUL_PRIO (PLUS_PRIO+2)
654#define UNARY_PRIO (MUL_PRIO+2)
655#define PAREN_OUTER_PRIO (UNARY_PRIO+2)
656
657#define COMPARE(OP) \
658 top->unsignedp = 0;\
659 top->value = (unsigned1 || unsigned2) ? (unsigned long) v1 OP (unsigned long) v2 : (v1 OP v2)
660
661/* Parse and evaluate a C expression, reading from PFILE.
662 * Returns the value of the expression. */
663
664HOST_WIDE_INT
665cpp_parse_expr(cpp_reader * pfile)
666{
667 /* The implementation is an operator precedence parser,
668 * i.e. a bottom-up parser, using a stack for not-yet-reduced tokens.
669 *
670 * The stack base is 'stack', and the current stack pointer is 'top'.
671 * There is a stack element for each operator (only),
672 * and the most recently pushed operator is 'top->op'.
673 * An operand (value) is stored in the 'value' field of the stack
674 * element of the operator that precedes it.
675 * In that case the 'flags' field has the HAVE_VALUE flag set. */
676
677#define INIT_STACK_SIZE 20
678 struct operation init_stack[INIT_STACK_SIZE];
679 struct operation *stack = init_stack;
680 struct operation *limit = stack + INIT_STACK_SIZE;
681 struct operation *top = stack;
682 int lprio = 0, rprio = 0;
683 int skip_evaluation = 0;
684
685 top->rprio = 0;
686 top->flags = 0;
687 for (;;)
688 {
689 struct operation op;
690 char flags = 0;
691
692 /* Read a token */
693 cpp_lex(&op, pfile);
694
695 /* See if the token is an operand, in which case go to set_value.
696 * If the token is an operator, figure out its left and right
697 * priorities, and then goto maybe_reduce. */
698
699 switch (op.op)
700 {
701 case NAME:
702 top->value = 0, top->unsignedp = 0;
703 goto set_value;
704 case INT:
705 case CHAR:
706 top->value = op.value;
707 top->unsignedp = op.unsignedp;
708 goto set_value;
709 case 0:
710 lprio = 0;
711 goto maybe_reduce;
712 case '+':
713 case '-':
714 /* Is this correct if unary ? FIXME */
715 flags = RIGHT_OPERAND_REQUIRED;
716 lprio = PLUS_PRIO;
717 rprio = lprio + 1;
718 goto maybe_reduce;
719 case '!':
720 case '~':
721 flags = RIGHT_OPERAND_REQUIRED;
722 rprio = UNARY_PRIO;
723 lprio = rprio + 1;
724 goto maybe_reduce;
725 case '*':
726 case '/':
727 case '%':
728 lprio = MUL_PRIO;
729 goto binop;
730 case '<':
731 case '>':
732 case LEQ:
733 case GEQ:
734 lprio = LESS_PRIO;
735 goto binop;
736 case EQUAL:
737 case NOTEQUAL:
738 lprio = EQUAL_PRIO;
739 goto binop;
740 case LSH:
741 case RSH:
742 lprio = SHIFT_PRIO;
743 goto binop;
744 case '&':
745 lprio = AND_PRIO;
746 goto binop;
747 case '^':
748 lprio = XOR_PRIO;
749 goto binop;
750 case '|':
751 lprio = OR_PRIO;
752 goto binop;
753 case ANDAND:
754 lprio = ANDAND_PRIO;
755 goto binop;
756 case OROR:
757 lprio = OROR_PRIO;
758 goto binop;
759 case ',':
760 lprio = COMMA_PRIO;
761 goto binop;
762 case '(':
763 lprio = PAREN_OUTER_PRIO;
764 rprio = PAREN_INNER_PRIO;
765 goto maybe_reduce;
766 case ')':
767 lprio = PAREN_INNER_PRIO;
768 rprio = PAREN_OUTER_PRIO;
769 goto maybe_reduce;
770 case ':':
771 lprio = COND_PRIO;
772 rprio = COND_PRIO;
773 goto maybe_reduce;
774 case '?':
775 lprio = COND_PRIO + 1;
776 rprio = COND_PRIO;
777 goto maybe_reduce;
778 binop:
779 flags = LEFT_OPERAND_REQUIRED | RIGHT_OPERAND_REQUIRED;
780 rprio = lprio + 1;
781 goto maybe_reduce;
782 default:
783 cpp_error(pfile, "invalid character in #if");
784 goto syntax_error;
785 }
786
787 set_value:
788 /* Push a value onto the stack. */
789 if (top->flags & HAVE_VALUE)
790 {
791 cpp_error(pfile, "syntax error in #if");
792 goto syntax_error;
793 }
794 top->flags |= HAVE_VALUE;
795 continue;
796
797 maybe_reduce:
798 /* Push an operator, and check if we can reduce now. */
799 while (top->rprio > lprio)
800 {
801 long v1 = top[-1].value, v2 = top[0].value;
802 int unsigned1 = top[-1].unsignedp, unsigned2 =
803 top[0].unsignedp;
804
805 top--;
806 if ((top[1].flags & LEFT_OPERAND_REQUIRED)
807 && !(top[0].flags & HAVE_VALUE))
808 {
809 cpp_error(pfile, "syntax error - missing left operand");
810 goto syntax_error;
811 }
812 if ((top[1].flags & RIGHT_OPERAND_REQUIRED)
813 && !(top[1].flags & HAVE_VALUE))
814 {
815 cpp_error(pfile, "syntax error - missing right operand");
816 goto syntax_error;
817 }
818 /* top[0].value = (top[1].op)(v1, v2); */
819 switch (top[1].op)
820 {
821 case '+':
822 if (!(top->flags & HAVE_VALUE))
823 { /* Unary '+' */
824 top->value = v2;
825 top->unsignedp = unsigned2;
826 top->flags |= HAVE_VALUE;
827 }
828 else
829 {
830 top->value = v1 + v2;
831 top->unsignedp = unsigned1 || unsigned2;
832 if (!top->unsignedp && !skip_evaluation
833 && !possible_sum_sign(v1, v2, top->value))
834 integer_overflow(pfile);
835 }
836 break;
837 case '-':
838 if (skip_evaluation); /* do nothing */
839 else if (!(top->flags & HAVE_VALUE))
840 { /* Unary '-' */
841 top->value = -v2;
842 if ((top->value & v2) < 0 && !unsigned2)
843 integer_overflow(pfile);
844 top->unsignedp = unsigned2;
845 top->flags |= HAVE_VALUE;
846 }
847 else
848 { /* Binary '-' */
849 top->value = v1 - v2;
850 top->unsignedp = unsigned1 || unsigned2;
851 if (!top->unsignedp
852 && !possible_sum_sign(top->value, v2, v1))
853 integer_overflow(pfile);
854 }
855 break;
856 case '*':
857 top->unsignedp = unsigned1 || unsigned2;
858 if (top->unsignedp)
859 top->value = (unsigned long)v1 *v2;
860
861 else if (!skip_evaluation)
862 {
863 top->value = v1 * v2;
864 if (v1
865 && (top->value / v1 != v2
866 || (top->value & v1 & v2) < 0))
867 integer_overflow(pfile);
868 }
869 break;
870 case '/':
871 if (skip_evaluation)
872 break;
873 if (v2 == 0)
874 {
875 cpp_error(pfile, "division by zero in #if");
876 v2 = 1;
877 }
878 top->unsignedp = unsigned1 || unsigned2;
879 if (top->unsignedp)
880 top->value = (unsigned long)v1 / v2;
881 else
882 {
883 top->value = v1 / v2;
884 if ((top->value & v1 & v2) < 0)
885 integer_overflow(pfile);
886 }
887 break;
888 case '%':
889 if (skip_evaluation)
890 break;
891 if (v2 == 0)
892 {
893 cpp_error(pfile, "division by zero in #if");
894 v2 = 1;
895 }
896 top->unsignedp = unsigned1 || unsigned2;
897 if (top->unsignedp)
898 top->value = (unsigned long)v1 % v2;
899 else
900 top->value = v1 % v2;
901 break;
902 case '!':
903 if (top->flags & HAVE_VALUE)
904 {
905 cpp_error(pfile, "syntax error");
906 goto syntax_error;
907 }
908 top->value = !v2;
909 top->unsignedp = 0;
910 top->flags |= HAVE_VALUE;
911 break;
912 case '~':
913 if (top->flags & HAVE_VALUE)
914 {
915 cpp_error(pfile, "syntax error");
916 goto syntax_error;
917 }
918 top->value = ~v2;
919 top->unsignedp = unsigned2;
920 top->flags |= HAVE_VALUE;
921 break;
922 case '<':
923 COMPARE(<);
924 break;
925 case '>':
926 COMPARE(>);
927 break;
928 case LEQ:
929 COMPARE(<=);
930 break;
931 case GEQ:
932 COMPARE(>=);
933 break;
934 case EQUAL:
935 top->value = (v1 == v2);
936 top->unsignedp = 0;
937 break;
938 case NOTEQUAL:
939 top->value = (v1 != v2);
940 top->unsignedp = 0;
941 break;
942 case LSH:
943 if (skip_evaluation)
944 break;
945 top->unsignedp = unsigned1;
946 if (v2 < 0 && !unsigned2)
947 top->value = right_shift(pfile, v1, unsigned1, -v2);
948 else
949 top->value = left_shift(pfile, v1, unsigned1, v2);
950 break;
951 case RSH:
952 if (skip_evaluation)
953 break;
954 top->unsignedp = unsigned1;
955 if (v2 < 0 && !unsigned2)
956 top->value = left_shift(pfile, v1, unsigned1, -v2);
957 else
958 top->value = right_shift(pfile, v1, unsigned1, v2);
959 break;
960#define LOGICAL(OP) \
961 top->value = v1 OP v2;\
962 top->unsignedp = unsigned1 || unsigned2;
963 case '&':
964 LOGICAL(&);
965 break;
966 case '^':
967 LOGICAL(^);
968 break;
969 case '|':
970 LOGICAL(|);
971 break;
972 case ANDAND:
973 top->value = v1 && v2;
974 top->unsignedp = 0;
975 if (!v1)
976 skip_evaluation--;
977 break;
978 case OROR:
979 top->value = v1 || v2;
980 top->unsignedp = 0;
981 if (v1)
982 skip_evaluation--;
983 break;
984 case ',':
985 if (CPP_PEDANTIC(pfile))
986 cpp_pedwarn(pfile, "comma operator in operand of `#if'");
987 top->value = v2;
988 top->unsignedp = unsigned2;
989 break;
990 case '(':
991 case '?':
992 cpp_error(pfile, "syntax error in #if");
993 goto syntax_error;
994 case ':':
995 if (top[0].op != '?')
996 {
997 cpp_error(pfile,
998 "syntax error ':' without preceding '?'");
999 goto syntax_error;
1000 }
1001 else if (!(top[1].flags & HAVE_VALUE)
1002 || !(top[-1].flags & HAVE_VALUE)
1003 || !(top[0].flags & HAVE_VALUE))
1004 {
1005 cpp_error(pfile, "bad syntax for ?: operator");
1006 goto syntax_error;
1007 }
1008 else
1009 {
1010 top--;
1011 if (top->value)
1012 skip_evaluation--;
1013 top->value = top->value ? v1 : v2;
1014 top->unsignedp = unsigned1 || unsigned2;
1015 }
1016 break;
1017 case ')':
1018 if ((top[1].flags & HAVE_VALUE)
1019 || !(top[0].flags & HAVE_VALUE)
1020 || top[0].op != '(' || (top[-1].flags & HAVE_VALUE))
1021 {
1022 cpp_error(pfile, "mismatched parentheses in #if");
1023 goto syntax_error;
1024 }
1025 else
1026 {
1027 top--;
1028 top->value = v1;
1029 top->unsignedp = unsigned1;
1030 top->flags |= HAVE_VALUE;
1031 }
1032 break;
1033 default:
1034 fprintf(stderr,
1035 top[1].op >= ' ' && top[1].op <= '~'
1036 ? "unimplemented operator '%c'\n"
1037 : "unimplemented operator '\\%03o'\n", top[1].op);
1038 }
1039 }
1040 if (op.op == 0)
1041 {
1042 if (top != stack)
1043 cpp_error(pfile, "internal error in #if expression");
1044 if (stack != init_stack)
1045 free(stack);
1046 return top->value;
1047 }
1048 top++;
1049
1050 /* Check for and handle stack overflow. */
1051 if (top == limit)
1052 {
1053 struct operation *new_stack;
1054 int old_size = (char *)limit - (char *)stack;
1055 int new_size = 2 * old_size;
1056
1057 if (stack != init_stack)
1058 new_stack = (struct operation *)xrealloc(stack, new_size);
1059 else
1060 {
1061 new_stack = (struct operation *)xmalloc(new_size);
1062 memcpy((char *)new_stack, (char *)stack, old_size);
1063 }
1064 stack = new_stack;
1065 top = (struct operation *)((char *)new_stack + old_size);
1066 limit = (struct operation *)((char *)new_stack + new_size);
1067 }
1068 top->flags = flags;
1069 top->rprio = rprio;
1070 top->op = op.op;
1071 if ((op.op == OROR && top[-1].value)
1072 || (op.op == ANDAND && !top[-1].value)
1073 || (op.op == '?' && !top[-1].value))
1074 {
1075 skip_evaluation++;
1076 }
1077 else if (op.op == ':')
1078 {
1079 if (top[-2].value) /* Was condition true? */
1080 skip_evaluation++;
1081 else
1082 skip_evaluation--;
1083 }
1084 }
1085 syntax_error:
1086 if (stack != init_stack)
1087 free(stack);
1088 skip_rest_of_line(pfile);
1089 return 0;
1090}
diff --git a/libraries/edje/src/bin/epp/cpphash.c b/libraries/edje/src/bin/epp/cpphash.c
new file mode 100644
index 0000000..e3b68e0
--- /dev/null
+++ b/libraries/edje/src/bin/epp/cpphash.c
@@ -0,0 +1,198 @@
1/* Part of CPP library. (Macro hash table support.)
2 * Copyright (C) 1986, 87, 89, 92, 93, 94, 1995 Free Software Foundation, Inc.
3 * Written by Per Bothner, 1994.
4 * Based on CCCP program by by Paul Rubin, June 1986
5 * Adapted to ANSI C, Richard Stallman, Jan 1987
6 * Copyright (C) 2003-2011 Kim Woelders
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
11 * later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * In other words, you are welcome to use, share and improve this program.
23 * You are forbidden to forbid anyone else to use, share and improve
24 * what you give them. Help stamp out software-hoarding! */
25
26#ifdef HAVE_CONFIG_H
27# include <config.h>
28#endif
29
30#include <string.h>
31#include <stdlib.h>
32
33#include "cpplib.h"
34#include "cpphash.h"
35
36static HASHNODE *hashtab[HASHSIZE];
37
38#define IS_IDCHAR(ch) is_idchar[(unsigned char)(ch)]
39
40/*
41 * return hash function on name. must be compatible with the one
42 * computed a step at a time, elsewhere
43 */
44int
45hashf(const char *name, int len, int hashsize)
46{
47 int r = 0;
48
49 while (len--)
50 r = HASHSTEP(r, *name++);
51
52 return MAKE_POS(r) % hashsize;
53}
54
55/*
56 * find the most recent hash node for name name (ending with first
57 * non-identifier char) installed by install
58 *
59 * If LEN is >= 0, it is the length of the name.
60 * Otherwise, compute the length by scanning the entire name.
61 *
62 * If HASH is >= 0, it is the precomputed hash code.
63 * Otherwise, compute the hash code.
64 */
65HASHNODE *
66cpp_lookup(const char *name, int len, int hash)
67{
68 const char *bp;
69 HASHNODE *bucket;
70
71 if (len < 0)
72 {
73 for (bp = name; IS_IDCHAR(*bp); bp++)
74 ;
75 len = bp - name;
76 }
77 if (hash < 0)
78 hash = hashf(name, len, HASHSIZE);
79
80 bucket = hashtab[hash];
81 while (bucket)
82 {
83 if (bucket->length == len
84 && strncmp((const char *)bucket->name, name, len) == 0)
85 return bucket;
86 bucket = bucket->next;
87 }
88 return (HASHNODE *) 0;
89}
90
91/*
92 * Delete a hash node. Some weirdness to free junk from macros.
93 * More such weirdness will have to be added if you define more hash
94 * types that need it.
95 */
96
97/* Note that the DEFINITION of a macro is removed from the hash table
98 * but its storage is not freed. This would be a storage leak
99 * except that it is not reasonable to keep undefining and redefining
100 * large numbers of macros many times.
101 * In any case, this is necessary, because a macro can be #undef'd
102 * in the middle of reading the arguments to a call to it.
103 * If #undef freed the DEFINITION, that would crash. */
104
105void
106delete_macro(HASHNODE * hp)
107{
108
109 if (hp->prev)
110 hp->prev->next = hp->next;
111 if (hp->next)
112 hp->next->prev = hp->prev;
113
114 /* make sure that the bucket chain header that
115 * the deleted guy was on points to the right thing afterwards. */
116 if (hp == *hp->bucket_hdr)
117 *hp->bucket_hdr = hp->next;
118
119 if (hp->type == T_MACRO)
120 {
121 DEFINITION *d = hp->value.defn;
122 struct reflist *ap, *nextap;
123
124 for (ap = d->pattern; ap; ap = nextap)
125 {
126 nextap = ap->next;
127 free(ap);
128 }
129 if (d->nargs >= 0)
130 free(d->args.argnames);
131 free(d);
132 }
133 free(hp);
134}
135/*
136 * install a name in the main hash table, even if it is already there.
137 * name stops with first non alphanumeric, except leading '#'.
138 * caller must check against redefinition if that is desired.
139 * delete_macro () removes things installed by install () in fifo order.
140 * this is important because of the `defined' special symbol used
141 * in #if, and also if pushdef/popdef directives are ever implemented.
142 *
143 * If LEN is >= 0, it is the length of the name.
144 * Otherwise, compute the length by scanning the entire name.
145 *
146 * If HASH is >= 0, it is the precomputed hash code.
147 * Otherwise, compute the hash code.
148 */
149HASHNODE *
150install(const char *name, int len, enum node_type type, int ivalue, char *value,
151 int hash)
152{
153 HASHNODE *hp;
154 int i, bucket;
155 const char *p;
156
157 if (len < 0)
158 {
159 p = name;
160 while (IS_IDCHAR(*p))
161 p++;
162 len = p - name;
163 }
164 if (hash < 0)
165 hash = hashf(name, len, HASHSIZE);
166
167 i = sizeof(HASHNODE) + len + 1;
168 hp = (HASHNODE *) xmalloc(i);
169 bucket = hash;
170 hp->bucket_hdr = &hashtab[bucket];
171 hp->next = hashtab[bucket];
172 hashtab[bucket] = hp;
173 hp->prev = NULL;
174 if (hp->next)
175 hp->next->prev = hp;
176 hp->type = type;
177 hp->length = len;
178 if (hp->type == T_CONST)
179 hp->value.ival = ivalue;
180 else
181 hp->value.cpval = value;
182 hp->name = ((char *)hp) + sizeof(HASHNODE);
183 memcpy(hp->name, name, len);
184 hp->name[len] = 0;
185 return hp;
186}
187
188void
189cpp_hash_cleanup(cpp_reader * pfile __UNUSED__)
190{
191 int i;
192
193 for (i = HASHSIZE; --i >= 0;)
194 {
195 while (hashtab[i])
196 delete_macro(hashtab[i]);
197 }
198}
diff --git a/libraries/edje/src/bin/epp/cpphash.h b/libraries/edje/src/bin/epp/cpphash.h
new file mode 100644
index 0000000..524a850
--- /dev/null
+++ b/libraries/edje/src/bin/epp/cpphash.h
@@ -0,0 +1,41 @@
1enum node_type;
2
3/* different kinds of things that can appear in the value field
4 of a hash node. Actually, this may be useless now. */
5union hashval {
6 int ival;
7 char *cpval;
8 DEFINITION *defn;
9};
10
11struct hashnode {
12 struct hashnode *next; /* double links for easy deletion */
13 struct hashnode *prev;
14 struct hashnode **bucket_hdr; /* also, a back pointer to this node's hash
15 * chain is kept, in case the node is the head
16 * of the chain and gets deleted. */
17 enum node_type type; /* type of special token */
18 int length; /* length of token, for quick comparison */
19 char *name; /* the actual name */
20 union hashval value; /* pointer to expansion, or whatever */
21};
22
23typedef struct hashnode HASHNODE;
24
25/* Some definitions for the hash table. The hash function MUST be
26 computed as shown in hashf () below. That is because the rescan
27 loop computes the hash value `on the fly' for most tokens,
28 in order to avoid the overhead of a lot of procedure calls to
29 the hashf () function. Hashf () only exists for the sake of
30 politeness, for use when speed isn't so important. */
31
32#define HASHSIZE 1403
33#define HASHSTEP(old, c) ((old << 2) + c)
34#define MAKE_POS(v) (v & 0x7fffffff) /* make number positive */
35
36extern int hashf(const char *name, int len, int hashsize);
37extern HASHNODE *cpp_lookup(const char *name, int len, int hash);
38extern void delete_macro(HASHNODE * hp);
39extern HASHNODE *install(const char *name, int len, enum node_type type,
40 int ivalue, char *value, int hash);
41extern void cpp_hash_cleanup(cpp_reader * pfile);
diff --git a/libraries/edje/src/bin/epp/cpplib.c b/libraries/edje/src/bin/epp/cpplib.c
new file mode 100644
index 0000000..132d2a9
--- /dev/null
+++ b/libraries/edje/src/bin/epp/cpplib.c
@@ -0,0 +1,7427 @@
1/* CPP Library.
2 * Copyright (C) 1986, 87, 89, 92, 93, 94, 1995 Free Software Foundation, Inc.
3 * Written by Per Bothner, 1994-95.
4 * Based on CCCP program by by Paul Rubin, June 1986
5 * Adapted to ANSI C, Richard Stallman, Jan 1987
6 * Copyright (C) 2003-2011 Kim Woelders
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
11 * later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * In other words, you are welcome to use, share and improve this program.
23 * You are forbidden to forbid anyone else to use, share and improve
24 * what you give them. Help stamp out software-hoarding! */
25
26#ifdef HAVE_CONFIG_H
27# include <config.h>
28#endif
29
30#ifdef HAVE_ALLOCA_H
31# include <alloca.h>
32#elif defined __GNUC__
33# define alloca __builtin_alloca
34#elif defined _AIX
35# define alloca __alloca
36#elif defined _MSC_VER
37# include <malloc.h>
38# define alloca _alloca
39#else
40# include <stddef.h>
41void *alloca (size_t);
42#endif
43
44#ifdef __EMX__
45#include <strings.h>
46#endif
47
48#ifndef STANDARD_INCLUDE_DIR
49#define STANDARD_INCLUDE_DIR "/usr/include"
50#endif
51
52#ifndef LOCAL_INCLUDE_DIR
53#define LOCAL_INCLUDE_DIR "/usr/local/include"
54#endif
55
56#include "cpplib.h"
57#include "cpphash.h"
58
59/*
60 * On Windows, if the file is not opened in binary mode,
61 * read does not return the correct size, because of
62 * CR / LF translation.
63 */
64#ifndef O_BINARY
65# define O_BINARY 0
66#endif
67
68const char *version_string = "0.0.0";
69
70#ifndef STDC_VALUE
71#define STDC_VALUE 1
72#endif
73
74/* By default, colon separates directories in a path. */
75#ifndef PATH_SEPARATOR
76#define PATH_SEPARATOR ':'
77#endif
78
79#include <ctype.h>
80#include <stdio.h>
81#include <string.h>
82#include <signal.h>
83#include <stdlib.h>
84#include <unistd.h>
85#include <sys/types.h>
86#include <sys/stat.h>
87#include <fcntl.h>
88#include <stdlib.h>
89
90#ifndef VMS
91#ifndef USG
92#include <time.h>
93#include <sys/time.h> /* for __DATE__ and __TIME__ */
94#ifdef HAVE_SYS_RESOURCE_H
95# include <sys/resource.h>
96#endif
97#else
98#include <sys/param.h> /* CYGNUS LOCAL: shebs -noquiet */
99#include <sys/times.h>
100#include <time.h>
101#include <fcntl.h>
102#endif /* USG */
103#endif /* not VMS */
104
105/* This defines "errno" properly for VMS, and gives us EACCES. */
106#include <errno.h>
107
108#ifndef O_RDONLY
109#define O_RDONLY 0
110#endif
111
112#undef MIN
113#undef MAX
114#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
115#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
116
117#ifndef S_ISREG
118#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
119#endif
120
121#ifndef S_ISDIR
122#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
123#endif
124
125/* Define a generic NULL if one hasn't already been defined. */
126
127#ifndef GENERIC_PTR
128#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
129#define GENERIC_PTR void *
130#else
131#define GENERIC_PTR char *
132#endif
133#endif
134
135#ifndef INCLUDE_LEN_FUDGE
136#define INCLUDE_LEN_FUDGE 0
137#endif
138
139#define USE_FILE_NAME_MAPS 0
140
141/* Symbols to predefine. */
142
143#ifdef CPP_PREDEFINES
144static const char *predefs = CPP_PREDEFINES;
145
146#else
147static const char *predefs = "";
148
149#endif
150
151/* We let tm.h override the types used here, to handle trivial differences
152 * such as the choice of unsigned int or long unsigned int for size_t.
153 * When machines start needing nontrivial differences in the size type,
154 * it would be best to do something here to figure out automatically
155 * from other information what type to use. */
156
157/* The string value for __SIZE_TYPE__. */
158
159#ifndef SIZE_TYPE
160#define SIZE_TYPE "long unsigned int"
161#endif
162
163/* The string value for __PTRDIFF_TYPE__. */
164
165#ifndef PTRDIFF_TYPE
166#define PTRDIFF_TYPE "long int"
167#endif
168
169/* The string value for __WCHAR_TYPE__. */
170
171#ifndef WCHAR_TYPE
172#define WCHAR_TYPE "int"
173#endif
174#define CPP_WCHAR_TYPE(PFILE) \
175 (CPP_OPTIONS (PFILE)->cplusplus ? "__wchar_t" : WCHAR_TYPE)
176
177/* The string value for __USER_LABEL_PREFIX__ */
178
179#ifndef USER_LABEL_PREFIX
180#define USER_LABEL_PREFIX ""
181#endif
182
183/* The string value for __REGISTER_PREFIX__ */
184
185#ifndef REGISTER_PREFIX
186#define REGISTER_PREFIX ""
187#endif
188
189struct directive {
190 int length;
191 int (*func) (cpp_reader * pfile, struct directive * keyword,
192 unsigned char *buf, unsigned char *limit);
193 const char *name;
194 enum node_type type;
195 char command_reads_line;
196 char traditional_comments;
197 char pass_thru;
198};
199
200/* In the definition of a #assert name, this structure forms
201 * a list of the individual values asserted.
202 * Each value is itself a list of "tokens".
203 * These are strings that are compared by name. */
204
205struct tokenlist_list {
206 struct tokenlist_list *next;
207 struct arglist *tokens;
208};
209
210struct assertion_hashnode {
211 struct assertion_hashnode *next; /* double links for easy deletion */
212 struct assertion_hashnode *prev;
213 /* also, a back pointer to this node's hash
214 * chain is kept, in case the node is the head
215 * of the chain and gets deleted. */
216 struct assertion_hashnode **bucket_hdr;
217 int length; /* length of token, for quick comparison */
218 char *name; /* the actual name */
219 /* List of token-sequences. */
220 struct tokenlist_list *value;
221};
222
223#define SKIP_WHITE_SPACE(p) do { while (is_hor_space[(unsigned char)(*p)]) p++; } while (0)
224#define SKIP_ALL_WHITE_SPACE(p) do { while (is_space[(unsigned char)(*p)]) p++; } while (0)
225
226#define PEEKN(N) (CPP_BUFFER (pfile)->rlimit - CPP_BUFFER (pfile)->cur >= (N) ? CPP_BUFFER (pfile)->cur[N] : EOF)
227#define FORWARD(N) CPP_FORWARD (CPP_BUFFER (pfile), (N))
228#define GETC() CPP_BUF_GET (CPP_BUFFER (pfile))
229#define PEEKC() CPP_BUF_PEEK (CPP_BUFFER (pfile))
230/* CPP_IS_MACRO_BUFFER is true if the buffer contains macro expansion.
231 * (Note that it is false while we're expanding marco *arguments*.) */
232#define CPP_IS_MACRO_BUFFER(PBUF) ((PBUF)->cleanup == macro_cleanup)
233
234/* Move all backslash-newline pairs out of embarrassing places.
235 * Exchange all such pairs following BP
236 * with any potentially-embarrassing characters that follow them.
237 * Potentially-embarrassing characters are / and *
238 * (because a backslash-newline inside a comment delimiter
239 * would cause it not to be recognized). */
240
241#define NEWLINE_FIX \
242 do {while (PEEKC() == '\\' && PEEKN(1) == '\n') FORWARD(2); } while(0)
243
244/* Same, but assume we've already read the potential '\\' into C. */
245#define NEWLINE_FIX1(C) do { \
246 while ((C) == '\\' && PEEKC() == '\n') { FORWARD(1); (C) = GETC(); }\
247 } while(0)
248
249/* Name under which this program was invoked. */
250
251char *progname;
252
253struct cpp_pending {
254 struct cpp_pending *next;
255 const char *cmd;
256 const char *arg;
257};
258
259/* Structure returned by create_definition */
260typedef struct {
261 struct definition *defn;
262 char *symnam;
263 int symlen;
264} MACRODEF;
265
266/* Forward declarations. */
267typedef struct file_name_list file_name_list;
268
269static void add_import(cpp_reader * pfile, int fd, char *fname);
270static int finclude(cpp_reader * pfile, int f, const char *fname,
271 int system_header_p, file_name_list * dirptr);
272static void validate_else(cpp_reader * pfile, const char *directive);
273static int comp_def_part(int first, unsigned char *beg1, int len1,
274 unsigned char *beg2, int len2, int last);
275static int lookup_import(cpp_reader * pfile, char *filename,
276 file_name_list * searchptr);
277static int redundant_include_p(cpp_reader * pfile, char *name);
278
279static int is_system_include(cpp_reader * pfile, char *filename);
280
281static int open_include_file(cpp_reader * pfile, char *filename,
282 file_name_list * searchptr);
283static int check_macro_name(cpp_reader * pfile, unsigned char *symname,
284 const char *usage);
285
286static int compare_token_lists(struct arglist *l1, struct arglist *l2);
287static HOST_WIDE_INT eval_if_expression(cpp_reader * pfile, unsigned char *buf,
288 int length);
289
290static int file_size_and_mode(int fd, int *mode_pointer,
291 long int *size_pointer);
292static struct arglist *read_token_list(cpp_reader * pfile, int *error_flag);
293static void free_token_list(struct arglist *tokens);
294static int safe_read(int desc, char *ptr, int len);
295static void push_macro_expansion(cpp_reader * pfile,
296 unsigned char *x,
297 int xbuf_len, HASHNODE * hp);
298
299static struct cpp_pending *nreverse_pending(struct cpp_pending *list);
300static char *savestring(const char *input);
301
302static void conditional_skip(cpp_reader * pfile, int skip,
303 enum node_type type,
304 unsigned char *control_macro);
305static void skip_if_group(cpp_reader * pfile, int any);
306
307static void cpp_error_with_line(cpp_reader * pfile, int line,
308 int column, const char *msg);
309static void cpp_pedwarn_with_line(cpp_reader * pfile, int line,
310 int column, const char *msg);
311static void cpp_pedwarn_with_file_and_line(cpp_reader * pfile,
312 const char *file, int line,
313 const char *msg,
314 const char *arg1,
315 const char *arg2,
316 const char *arg3);
317static void cpp_error_from_errno(cpp_reader * pfile, const char *name);
318
319static cpp_buffer *cpp_push_buffer(cpp_reader * pfile, unsigned char *buffer,
320 long length);
321static cpp_buffer *cpp_pop_buffer(cpp_reader * pfile);
322
323/* Last arg to output_line_command. */
324enum file_change_code {
325 same_file, enter_file, leave_file
326};
327
328/* These functions are declared to return int instead of void since they
329 * are going to be placed in a table and some old compilers have trouble with
330 * pointers to functions returning void. */
331
332static int do_define(cpp_reader * pfile, struct directive *keyword,
333 unsigned char *buf, unsigned char *limit);
334
335static int do_line(cpp_reader * pfile, struct directive *keyword,
336 unsigned char *unused1, unsigned char *unused2);
337
338static int do_include(cpp_reader * pfile, struct directive *keyword,
339 unsigned char *unused1, unsigned char *unused2);
340
341static int do_undef(cpp_reader * pfile, struct directive *keyword,
342 unsigned char *buf, unsigned char *limit);
343
344static int do_error(cpp_reader * pfile, struct directive *keyword,
345 unsigned char *buf, unsigned char *limit);
346
347static int do_pragma(cpp_reader * pfile, struct directive *keyword,
348 unsigned char *buf, unsigned char *limit);
349
350static int do_ident(cpp_reader * pfile, struct directive *keyword,
351 unsigned char *buf, unsigned char *limit);
352
353static int do_if(cpp_reader * pfile, struct directive *keyword,
354 unsigned char *buf, unsigned char *limit);
355
356static int do_xifdef(cpp_reader * pfile, struct directive *keyword,
357 unsigned char *buf, unsigned char *limit);
358
359static int do_else(cpp_reader * pfile, struct directive *keyword,
360 unsigned char *buf, unsigned char *limit);
361
362static int do_elif(cpp_reader * pfile, struct directive *keyword,
363 unsigned char *buf, unsigned char *limit);
364
365static int do_endif(cpp_reader * pfile, struct directive *keyword,
366 unsigned char *buf, unsigned char *limit);
367
368static int do_assert(cpp_reader * pfile, struct directive *keyword,
369 unsigned char *buf, unsigned char *limit);
370
371static int do_unassert(cpp_reader * pfile, struct directive *keyword,
372 unsigned char *buf, unsigned char *limit);
373
374static int do_warning(cpp_reader * pfile, struct directive *keyword,
375 unsigned char *buf, unsigned char *limit);
376
377struct arglist *reverse_token_list(struct arglist *tokens);
378
379static int parse_name(cpp_reader * pfile, int c);
380
381static void parse_set_mark(struct parse_marker *pmark,
382 cpp_reader * pfile);
383static void parse_clear_mark(struct parse_marker *pmark);
384static void parse_goto_mark(struct parse_marker *pmark,
385 cpp_reader * pfile);
386static void parse_move_mark(struct parse_marker *pmark,
387 cpp_reader * pfile);
388
389struct file_name_list {
390 file_name_list *next;
391 char *fname;
392 /* If the following is nonzero, it is a macro name.
393 * Don't include the file again if that macro is defined. */
394 unsigned char *control_macro;
395 /* If the following is nonzero, it is a C-language system include
396 * directory. */
397 int c_system_include_path;
398 /* Mapping of file names for this directory. */
399 struct file_name_map *name_map;
400 /* Non-zero if name_map is valid. */
401 int got_name_map;
402};
403
404/* If a buffer's dir field is SELF_DIR_DUMMY, it means the file was found
405 * via the same directory as the file that #included it. */
406#define SELF_DIR_DUMMY ((file_name_list*)(~0))
407
408/* #include "file" looks in source file dir, then stack. */
409/* #include <file> just looks in the stack. */
410/* -I directories are added to the end, then the defaults are added. */
411/* The */
412static struct default_include {
413 const char *fname; /* The name of the directory. */
414 int cplusplus; /* Only look here if we're compiling C++. */
415 int cxx_aware; /* Includes in this directory don't need to
416 * be wrapped in extern "C" when compiling
417 * C++. */
418} include_defaults_array[]
419#ifdef INCLUDE_DEFAULTS
420 = INCLUDE_DEFAULTS;
421
422#else
423 =
424{
425 /* Pick up GNU C++ specific include files. */
426 {
427 GPLUSPLUS_INCLUDE_DIR, 1, 1}
428 ,
429#ifdef CROSS_COMPILE
430 /* This is the dir for fixincludes. Put it just before
431 * the files that we fix. */
432 {
433 GCC_INCLUDE_DIR, 0, 0}
434 ,
435 /* For cross-compilation, this dir name is generated
436 * automatically in Makefile.in. */
437 {
438 CROSS_INCLUDE_DIR, 0, 0}
439 ,
440 /* This is another place that the target system's headers might be. */
441 {
442 TOOL_INCLUDE_DIR, 0, 1}
443 ,
444#else /* not CROSS_COMPILE */
445 /* This should be /usr/local/include and should come before
446 * the fixincludes-fixed header files. */
447 {
448 LOCAL_INCLUDE_DIR, 0, 1}
449 ,
450 /* This is here ahead of GCC_INCLUDE_DIR because assert.h goes here.
451 * Likewise, behind LOCAL_INCLUDE_DIR, where glibc puts its assert.h. */
452 {
453 TOOL_INCLUDE_DIR, 0, 1}
454 ,
455 /* This is the dir for fixincludes. Put it just before
456 * the files that we fix. */
457 {
458 GCC_INCLUDE_DIR, 0, 0}
459 ,
460 /* Some systems have an extra dir of include files. */
461#ifdef SYSTEM_INCLUDE_DIR
462 {
463 SYSTEM_INCLUDE_DIR, 0, 0}
464 ,
465#endif
466 {
467 STANDARD_INCLUDE_DIR, 0, 0}
468 ,
469#endif /* not CROSS_COMPILE */
470 {
471 0, 0, 0}
472};
473
474#endif /* no INCLUDE_DEFAULTS */
475
476/* Here is the actual list of #-directives, most-often-used first.
477 * The initialize_builtins function assumes #define is the very first. */
478
479static struct directive directive_table[] = {
480 {6, do_define, "define", T_DEFINE, 0, 1, 0},
481 {5, do_xifdef, "ifdef", T_IFDEF, 1, 0, 0},
482 {6, do_xifdef, "ifndef", T_IFNDEF, 1, 0, 0},
483 {7, do_include, "include", T_INCLUDE, 1, 0, 0},
484 {12, do_include, "include_next", T_INCLUDE_NEXT, 1, 0, 0},
485 {6, do_include, "import", T_IMPORT, 1, 0, 0},
486 {5, do_endif, "endif", T_ENDIF, 1, 0, 0},
487 {4, do_else, "else", T_ELSE, 1, 0, 0},
488 {2, do_if, "if", T_IF, 1, 0, 0},
489 {4, do_elif, "elif", T_ELIF, 1, 0, 0},
490 {5, do_undef, "undef", T_UNDEF, 0, 0, 0},
491 {5, do_error, "error", T_ERROR, 0, 0, 0},
492 {7, do_warning, "warning", T_WARNING, 0, 0, 0},
493 {6, do_pragma, "pragma", T_PRAGMA, 0, 0, 1},
494 {4, do_line, "line", T_LINE, 1, 0, 0},
495 {5, do_ident, "ident", T_IDENT, 1, 0, 1},
496#ifdef SCCS_DIRECTIVE
497 {4, do_sccs, "sccs", T_SCCS, 0, 0, 0},
498#endif
499 {6, do_assert, "assert", T_ASSERT, 1, 0, 0},
500 {8, do_unassert, "unassert", T_UNASSERT, 1, 0, 0},
501 {-1, 0, "", T_UNUSED, 0, 0, 0},
502};
503
504/* table to tell if char can be part of a C identifier. */
505unsigned char is_idchar[256];
506
507/* table to tell if char can be first char of a c identifier. */
508unsigned char is_idstart[256];
509
510/* table to tell if c is horizontal space. */
511unsigned char is_hor_space[256];
512
513/* table to tell if c is horizontal or vertical space. */
514static unsigned char is_space[256];
515
516/* Initialize syntactic classifications of characters. */
517
518static void
519initialize_char_syntax(struct cpp_options *opts)
520{
521 int i;
522
523 /*
524 * Set up is_idchar and is_idstart tables. These should be
525 * faster than saying (is_alpha (c) || c == '_'), etc.
526 * Set up these things before calling any routines tthat
527 * refer to them.
528 */
529 for (i = 'a'; i <= 'z'; i++)
530 {
531 is_idchar[i - 'a' + 'A'] = 1;
532 is_idchar[i] = 1;
533 is_idstart[i - 'a' + 'A'] = 1;
534 is_idstart[i] = 1;
535 }
536 for (i = '0'; i <= '9'; i++)
537 is_idchar[i] = 1;
538 is_idchar[(unsigned char)'_'] = 1;
539 is_idstart[(unsigned char)'_'] = 1;
540 is_idchar[(unsigned char)'$'] = opts->dollars_in_ident;
541 is_idstart[(unsigned char)'$'] = opts->dollars_in_ident;
542
543 /* horizontal space table */
544 is_hor_space[(unsigned char)' '] = 1;
545 is_hor_space[(unsigned char)'\t'] = 1;
546 is_hor_space[(unsigned char)'\v'] = 1;
547 is_hor_space[(unsigned char)'\f'] = 1;
548 is_hor_space[(unsigned char)'\r'] = 1;
549
550 is_space[(unsigned char)' '] = 1;
551 is_space[(unsigned char)'\t'] = 1;
552 is_space[(unsigned char)'\v'] = 1;
553 is_space[(unsigned char)'\f'] = 1;
554 is_space[(unsigned char)'\n'] = 1;
555 is_space[(unsigned char)'\r'] = 1;
556}
557
558/* Place into PFILE a quoted string representing the string SRC.
559 * Caller must reserve enough space in pfile->token_buffer. */
560static void
561quote_string(cpp_reader * pfile, const char *src)
562{
563 unsigned char c;
564
565 CPP_PUTC_Q(pfile, '\"');
566 for (;;)
567 switch ((c = *src++))
568 {
569 default:
570 if (isprint(c))
571 CPP_PUTC_Q(pfile, c);
572 else
573 {
574 sprintf((char *)CPP_PWRITTEN(pfile), "\\%03o", c);
575 CPP_ADJUST_WRITTEN(pfile, 4);
576 }
577 break;
578
579 case '\"':
580 case '\\':
581 CPP_PUTC_Q(pfile, '\\');
582 CPP_PUTC_Q(pfile, c);
583 break;
584
585 case '\0':
586 CPP_PUTC_Q(pfile, '\"');
587 CPP_NUL_TERMINATE_Q(pfile);
588 return;
589 }
590}
591
592/* Make sure PFILE->token_buffer will hold at least N more chars. */
593
594void
595cpp_grow_buffer(cpp_reader * pfile, long n)
596{
597 long old_written = CPP_WRITTEN(pfile);
598
599 pfile->token_buffer_size = n + 2 * pfile->token_buffer_size;
600 pfile->token_buffer =
601 (unsigned char *)xrealloc(pfile->token_buffer, pfile->token_buffer_size);
602 CPP_SET_WRITTEN(pfile, old_written);
603}
604
605/*
606 * process a given definition string, for initialization
607 * If STR is just an identifier, define it with value 1.
608 * If STR has anything after the identifier, then it should
609 * be identifier=definition.
610 */
611
612void
613cpp_define(cpp_reader * pfile, unsigned char *str)
614{
615 unsigned char *buf, *p;
616
617 buf = str;
618 p = str;
619 if (!is_idstart[*p])
620 {
621 cpp_error(pfile, "malformed option `-D %s'", str);
622 return;
623 }
624 while (is_idchar[*++p])
625 ;
626 if (*p == 0)
627 {
628 buf = (unsigned char *)alloca(p - buf + 4);
629 strcpy((char *)buf, (const char *)str);
630 strcat((char *)buf, " 1");
631 }
632 else if (*p != '=')
633 {
634 cpp_error(pfile, "malformed option `-D %s'", str);
635 return;
636 }
637 else
638 {
639 unsigned char *q;
640
641 /* Copy the entire option so we can modify it. */
642 buf = (unsigned char *)alloca(2 * strlen((char *)str) + 1);
643 strncpy((char *)buf, (const char *)str, p - str);
644 /* Change the = to a space. */
645 buf[p - str] = ' ';
646 /* Scan for any backslash-newline and remove it. */
647 p++;
648 q = &buf[p - str];
649 while (*p)
650 {
651 if (*p == '\\' && p[1] == '\n')
652 p += 2;
653 else
654 *q++ = *p++;
655 }
656 *q = 0;
657 }
658
659 do_define(pfile, NULL, buf, buf + strlen((char *)buf));
660}
661
662/* Process the string STR as if it appeared as the body of a #assert.
663 * OPTION is the option name for which STR was the argument. */
664
665static void
666make_assertion(cpp_reader * pfile, const char *option, const char *str)
667{
668 unsigned char *buf, *p, *q;
669
670 /* Copy the entire option so we can modify it. */
671 buf = (unsigned char *)alloca(strlen((char *)str) + 1);
672 strcpy((char *)buf, (const char *)str);
673 /* Scan for any backslash-newline and remove it. */
674 p = q = buf;
675 while (*p)
676 {
677 *q++ = *p++;
678 }
679 *q = 0;
680
681 p = buf;
682 if (!is_idstart[*p])
683 {
684 cpp_error(pfile, "malformed option `%s %s'", option, str);
685 return;
686 }
687 while (is_idchar[*++p])
688 ;
689 while (*p == ' ' || *p == '\t')
690 p++;
691 if (!(*p == 0 || *p == '('))
692 {
693 cpp_error(pfile, "malformed option `%s %s'", option, str);
694 return;
695 }
696 cpp_push_buffer(pfile, buf, strlen((char *)buf));
697 do_assert(pfile, NULL, NULL, NULL);
698 cpp_pop_buffer(pfile);
699}
700
701/* Append a chain of `file_name_list's
702 * to the end of the main include chain.
703 * FIRST is the beginning of the chain to append, and LAST is the end. */
704
705static void
706append_include_chain(cpp_reader * pfile, file_name_list * first,
707 file_name_list * last)
708{
709 struct cpp_options *opts = CPP_OPTIONS(pfile);
710 file_name_list *dir;
711
712 if (!first || !last)
713 return;
714
715 if (!opts->include)
716 opts->include = first;
717 else
718 opts->last_include->next = first;
719
720 if (!opts->first_bracket_include)
721 opts->first_bracket_include = first;
722
723 for (dir = first;; dir = dir->next)
724 {
725 int len = strlen(dir->fname) + INCLUDE_LEN_FUDGE;
726
727 if (len > pfile->max_include_len)
728 pfile->max_include_len = len;
729 if (dir == last)
730 break;
731 }
732
733 last->next = NULL;
734 opts->last_include = last;
735}
736
737/* Add output to `deps_buffer' for the -M switch.
738 * STRING points to the text to be output.
739 * SPACER is ':' for targets, ' ' for dependencies, zero for text
740 * to be inserted literally. */
741
742static void
743deps_output(cpp_reader * pfile, const char *string, int spacer)
744{
745 int size = strlen(string);
746
747 if (size == 0)
748 return;
749
750#ifndef MAX_OUTPUT_COLUMNS
751#define MAX_OUTPUT_COLUMNS 72
752#endif
753 if (spacer
754 && pfile->deps_column > 0
755 && (pfile->deps_column + size) > MAX_OUTPUT_COLUMNS)
756 {
757 deps_output(pfile, " \\\n ", 0);
758 pfile->deps_column = 0;
759 }
760 if (pfile->deps_size + size + 8 > pfile->deps_allocated_size)
761 {
762 pfile->deps_allocated_size = (pfile->deps_size + size + 50) * 2;
763 pfile->deps_buffer = (char *)xrealloc(pfile->deps_buffer,
764 pfile->deps_allocated_size);
765 }
766 if (spacer == ' ' && pfile->deps_column > 0)
767 pfile->deps_buffer[pfile->deps_size++] = ' ';
768 memcpy(&pfile->deps_buffer[pfile->deps_size], string, size);
769 pfile->deps_size += size;
770 pfile->deps_column += size;
771 if (spacer == ':')
772 pfile->deps_buffer[pfile->deps_size++] = ':';
773 pfile->deps_buffer[pfile->deps_size] = 0;
774}
775
776/* Given a colon-separated list of file names PATH,
777 * add all the names to the search path for include files. */
778
779static void
780path_include(cpp_reader * pfile, char *path)
781{
782 char *p;
783
784 p = path;
785
786 if (*p)
787 while (1)
788 {
789 char *q = p;
790 char *name;
791 file_name_list *dirtmp;
792
793 /* Find the end of this name. */
794 while (*q != 0 && *q != PATH_SEPARATOR)
795 q++;
796 if (p == q)
797 {
798 /* An empty name in the path stands for the current directory. */
799 name = (char *)xmalloc(2);
800 name[0] = '.';
801 name[1] = 0;
802 }
803 else
804 {
805 /* Otherwise use the directory that is named. */
806 name = (char *)xmalloc(q - p + 1);
807 memcpy(name, p, q - p);
808 name[q - p] = 0;
809 }
810
811 dirtmp = (file_name_list *) xmalloc(sizeof(file_name_list));
812
813 dirtmp->next = 0; /* New one goes on the end */
814 dirtmp->control_macro = 0;
815 dirtmp->c_system_include_path = 0;
816 dirtmp->fname = name;
817 dirtmp->got_name_map = 0;
818 append_include_chain(pfile, dirtmp, dirtmp);
819
820 /* Advance past this name. */
821 p = q;
822 if (*p == 0)
823 break;
824 /* Skip the colon. */
825 p++;
826 }
827}
828
829void
830init_parse_options(struct cpp_options *opts)
831{
832 memset((char *)opts, 0, sizeof *opts);
833 opts->in_fname = NULL;
834 opts->out_fname = NULL;
835
836 /* Initialize is_idchar to allow $. */
837 opts->dollars_in_ident = 1;
838 initialize_char_syntax(opts);
839 opts->dollars_in_ident = DOLLARS_IN_IDENTIFIERS > 0;
840
841 opts->no_line_commands = 0;
842 opts->no_trigraphs = 1;
843 opts->put_out_comments = 0;
844 opts->print_include_names = 0;
845 opts->dump_macros = dump_none;
846 opts->no_output = 0;
847 opts->cplusplus = 0;
848 opts->cplusplus_comments = 1;
849
850 opts->verbose = 0;
851 opts->objc = 0;
852 opts->lang_asm = 0;
853 opts->for_lint = 0;
854 opts->chill = 0;
855 opts->pedantic_errors = 0;
856 opts->inhibit_warnings = 0;
857 opts->warn_comments = 0;
858 opts->warn_import = 1;
859 opts->warnings_are_errors = 0;
860}
861
862static enum cpp_token
863null_underflow(cpp_reader * pfile __UNUSED__)
864{
865 return CPP_EOF;
866}
867
868static int
869null_cleanup(cpp_buffer * pbuf __UNUSED__, cpp_reader * pfile __UNUSED__)
870{
871 return 0;
872}
873
874static int
875macro_cleanup(cpp_buffer * pbuf, cpp_reader * pfile __UNUSED__)
876{
877 HASHNODE *macro = (HASHNODE *) pbuf->data;
878
879 if (macro->type == T_DISABLED)
880 macro->type = T_MACRO;
881 if (macro->type != T_MACRO || pbuf->buf != macro->value.defn->expansion)
882 free(pbuf->buf);
883 return 0;
884}
885
886static int
887file_cleanup(cpp_buffer * pbuf, cpp_reader * pfile __UNUSED__)
888{
889 if (pbuf->buf)
890 {
891 free(pbuf->buf);
892 pbuf->buf = 0;
893 }
894 return 0;
895}
896
897/* Assuming we have read '/'.
898 * If this is the start of a comment (followed by '*' or '/'),
899 * skip to the end of the comment, and return ' '.
900 * Return EOF if we reached the end of file before the end of the comment.
901 * If not the start of a comment, return '/'. */
902
903static int
904skip_comment(cpp_reader * pfile, long *linep)
905{
906 int c = 0;
907
908 while (PEEKC() == '\\' && PEEKN(1) == '\n')
909 {
910 if (linep)
911 (*linep)++;
912 FORWARD(2);
913 }
914 if (PEEKC() == '*')
915 {
916 FORWARD(1);
917 for (;;)
918 {
919 int prev_c = c;
920
921 c = GETC();
922 if (c == EOF)
923 return EOF;
924 while (c == '\\' && PEEKC() == '\n')
925 {
926 if (linep)
927 (*linep)++;
928 FORWARD(1), c = GETC();
929 }
930 if (prev_c == '*' && c == '/')
931 return ' ';
932 if (c == '\n' && linep)
933 (*linep)++;
934 }
935 }
936 else if (PEEKC() == '/' && CPP_OPTIONS(pfile)->cplusplus_comments)
937 {
938 FORWARD(1);
939 for (;;)
940 {
941 c = GETC();
942 if (c == EOF)
943 return ' '; /* Allow // to be terminated by EOF. */
944 while (c == '\\' && PEEKC() == '\n')
945 {
946 FORWARD(1);
947 c = GETC();
948 if (linep)
949 (*linep)++;
950 }
951 if (c == '\n')
952 {
953 /* Don't consider final '\n' to be part of comment. */
954 FORWARD(-1);
955 return ' ';
956 }
957 }
958 }
959 else
960 return '/';
961}
962
963/* Skip whitespace \-newline and comments. Does not macro-expand. */
964void
965cpp_skip_hspace(cpp_reader * pfile)
966{
967 while (1)
968 {
969 int c = PEEKC();
970
971 if (c == EOF)
972 return; /* FIXME */
973 if (is_hor_space[c])
974 {
975 if ((c == '\f' || c == '\v') && CPP_PEDANTIC(pfile))
976 cpp_pedwarn(pfile, "%s in preprocessing directive",
977 c == '\f' ? "formfeed" : "vertical tab");
978 FORWARD(1);
979 }
980 else if (c == '/')
981 {
982 FORWARD(1);
983 c = skip_comment(pfile, NULL);
984 if (c == '/')
985 FORWARD(-1);
986 if (c == EOF || c == '/')
987 return;
988 }
989 else if (c == '\\' && PEEKN(1) == '\n')
990 {
991 FORWARD(2);
992 }
993 else if (c == '@' && CPP_BUFFER(pfile)->has_escapes
994 && is_hor_space[PEEKN(1)])
995 {
996 FORWARD(1);
997 }
998 else
999 return;
1000 }
1001}
1002
1003/* Read the rest of the current line.
1004 * The line is appended to PFILE's output buffer. */
1005
1006static void
1007copy_rest_of_line(cpp_reader * pfile)
1008{
1009 struct cpp_options *opts = CPP_OPTIONS(pfile);
1010
1011 for (;;)
1012 {
1013 int c = GETC();
1014 int nextc;
1015
1016 switch (c)
1017 {
1018 case EOF:
1019 goto end_directive;
1020 case '\\':
1021 if (PEEKC() == '\n')
1022 {
1023 FORWARD(1);
1024 continue;
1025 }
1026 case '\'':
1027 case '\"':
1028 goto scan_directive_token;
1029 break;
1030 case '/':
1031 nextc = PEEKC();
1032 if (nextc == '*' || (opts->cplusplus_comments && nextc == '*'))
1033 goto scan_directive_token;
1034 break;
1035 case '\f':
1036 case '\v':
1037 if (CPP_PEDANTIC(pfile))
1038 cpp_pedwarn(pfile, "%s in preprocessing directive",
1039 c == '\f' ? "formfeed" : "vertical tab");
1040 break;
1041
1042 case '\n':
1043 FORWARD(-1);
1044 goto end_directive;
1045 scan_directive_token:
1046 FORWARD(-1);
1047 cpp_get_token(pfile);
1048 continue;
1049 }
1050 CPP_PUTC(pfile, c);
1051 }
1052 end_directive:;
1053 CPP_NUL_TERMINATE(pfile);
1054}
1055
1056void
1057skip_rest_of_line(cpp_reader * pfile)
1058{
1059 long old = CPP_WRITTEN(pfile);
1060
1061 copy_rest_of_line(pfile);
1062 CPP_SET_WRITTEN(pfile, old);
1063}
1064
1065/* Handle a possible # directive.
1066 * '#' has already been read. */
1067
1068static int
1069handle_directive(cpp_reader * pfile)
1070{
1071 int c;
1072 struct directive *kt;
1073 int ident_length;
1074 long after_ident = 0;
1075 unsigned char *ident, *line_end;
1076 long old_written = CPP_WRITTEN(pfile);
1077
1078 cpp_skip_hspace(pfile);
1079
1080 c = PEEKC();
1081 if (c >= '0' && c <= '9')
1082 {
1083 /* Handle # followed by a line number. */
1084 if (CPP_PEDANTIC(pfile))
1085 cpp_pedwarn(pfile, "`#' followed by integer");
1086 do_line(pfile, NULL, NULL, NULL);
1087 goto done_a_directive;
1088 }
1089 /* Now find the directive name. */
1090 CPP_PUTC(pfile, '#');
1091 parse_name(pfile, GETC());
1092 ident = pfile->token_buffer + old_written + 1;
1093 ident_length = CPP_PWRITTEN(pfile) - ident;
1094 if (ident_length == 0 && PEEKC() == '\n')
1095 {
1096 /* A line of just `#' becomes blank. */
1097 goto done_a_directive;
1098 }
1099 /*
1100 * Decode the keyword and call the appropriate expansion
1101 * routine, after moving the input pointer up to the next line.
1102 */
1103 for (kt = directive_table;; kt++)
1104 {
1105 if (kt->length <= 0)
1106 goto not_a_directive;
1107 if (kt->length == ident_length
1108 && !strncmp(kt->name, (const char *)ident, ident_length))
1109 break;
1110 }
1111
1112 if (!kt->command_reads_line)
1113 {
1114 /* Nonzero means do not delete comments within the directive.
1115 * #define needs this when -traditional. */
1116 int comments = 0;
1117 int save_put_out_comments =
1118 CPP_OPTIONS(pfile)->put_out_comments;
1119
1120 CPP_OPTIONS(pfile)->put_out_comments = comments;
1121 after_ident = CPP_WRITTEN(pfile);
1122 copy_rest_of_line(pfile);
1123 CPP_OPTIONS(pfile)->put_out_comments = save_put_out_comments;
1124 }
1125 /* For #pragma and #define, we may want to pass through the directive.
1126 * Other directives may create output, but we don't want the directive
1127 * itself out, so we pop it now. For example #include may write a #line
1128 * command (see comment in do_include), and conditionals may emit
1129 * #failed ... #endfailed stuff. But note that popping the buffer
1130 * means the parameters to kt->func may point after pfile->limit
1131 * so these parameters are invalid as soon as something gets appended
1132 * to the token_buffer. */
1133
1134 line_end = CPP_PWRITTEN(pfile);
1135 if (!kt->pass_thru && kt->type != T_DEFINE)
1136 CPP_SET_WRITTEN(pfile, old_written);
1137
1138 (*kt->func) (pfile, kt, pfile->token_buffer + after_ident, line_end);
1139 if (kt->pass_thru
1140 || (kt->type == T_DEFINE
1141 && CPP_OPTIONS(pfile)->dump_macros == dump_definitions))
1142 {
1143 /* Just leave the entire #define in the output stack. */
1144 }
1145 else if (kt->type == T_DEFINE
1146 && CPP_OPTIONS(pfile)->dump_macros == dump_names)
1147 {
1148 unsigned char *p = pfile->token_buffer + old_written + 7; /* Skip "#define". */
1149
1150 SKIP_WHITE_SPACE(p);
1151 while (is_idchar[*p])
1152 p++;
1153 pfile->limit = p;
1154 CPP_PUTC(pfile, '\n');
1155 }
1156 else if (kt->type == T_DEFINE)
1157 CPP_SET_WRITTEN(pfile, old_written);
1158 done_a_directive:
1159 return 1;
1160
1161 not_a_directive:
1162 return 0;
1163}
1164
1165/* Pass a directive through to the output file.
1166 * BUF points to the contents of the directive, as a contiguous string.
1167 * LIMIT points to the first character past the end of the directive.
1168 * KEYWORD is the keyword-table entry for the directive. */
1169
1170static void
1171pass_thru_directive(char *buf, char *limit, cpp_reader * pfile,
1172 struct directive *keyword)
1173{
1174 unsigned keyword_length = keyword->length;
1175
1176 CPP_RESERVE(pfile, 1 + keyword_length + (limit - buf));
1177 CPP_PUTC_Q(pfile, '#');
1178 CPP_PUTS_Q(pfile, keyword->name, keyword_length);
1179 if (limit != buf && buf[0] != ' ')
1180 CPP_PUTC_Q(pfile, ' ');
1181 CPP_PUTS_Q(pfile, buf, limit - buf);
1182}
1183
1184/* The arglist structure is built by do_define to tell
1185 * collect_definition where the argument names begin. That
1186 * is, for a define like "#define f(x,y,z) foo+x-bar*y", the arglist
1187 * would contain pointers to the strings x, y, and z.
1188 * Collect_definition would then build a DEFINITION node,
1189 * with reflist nodes pointing to the places x, y, and z had
1190 * appeared. So the arglist is just convenience data passed
1191 * between these two routines. It is not kept around after
1192 * the current #define has been processed and entered into the
1193 * hash table. */
1194
1195struct arglist {
1196 struct arglist *next;
1197 char *name;
1198 int length;
1199 int argno;
1200 char rest_args;
1201};
1202
1203/* Read a replacement list for a macro with parameters.
1204 * Build the DEFINITION structure.
1205 * Reads characters of text starting at BUF until END.
1206 * ARGLIST specifies the formal parameters to look for
1207 * in the text of the definition; NARGS is the number of args
1208 * in that list, or -1 for a macro name that wants no argument list.
1209 * MACRONAME is the macro name itself (so we can avoid recursive expansion)
1210 * and NAMELEN is its length in characters.
1211 *
1212 * Note that comments, backslash-newlines, and leading white space
1213 * have already been deleted from the argument. */
1214
1215static DEFINITION *
1216collect_expansion(cpp_reader * pfile, unsigned char *buf, unsigned char *limit,
1217 int nargs, struct arglist *arglist)
1218{
1219 DEFINITION *defn;
1220 unsigned char *p, *lastp, *exp_p;
1221 reflist *endpat = NULL;
1222
1223 /* Pointer to first nonspace after last ## seen. */
1224 unsigned char *concat = 0;
1225
1226 /* Pointer to first nonspace after last single-# seen. */
1227 unsigned char *stringify = 0;
1228 int maxsize;
1229 int expected_delimiter = '\0';
1230
1231 /* Scan thru the replacement list, ignoring comments and quoted
1232 * strings, picking up on the macro calls. It does a linear search
1233 * thru the arg list on every potential symbol. Profiling might say
1234 * that something smarter should happen. */
1235
1236 if (limit < buf)
1237 abort();
1238
1239 /* Find the beginning of the trailing whitespace. */
1240 p = buf;
1241 while (p < limit && is_space[limit[-1]])
1242 limit--;
1243
1244 /* Allocate space for the text in the macro definition.
1245 * Leading and trailing whitespace chars need 2 bytes each.
1246 * Each other input char may or may not need 1 byte,
1247 * so this is an upper bound. The extra 5 are for invented
1248 * leading and trailing newline-marker and final null. */
1249 maxsize = (sizeof(DEFINITION) + (limit - p) + 5);
1250 /* Occurrences of '@' get doubled, so allocate extra space for them. */
1251 while (p < limit)
1252 if (*p++ == '@')
1253 maxsize++;
1254 defn = (DEFINITION *) xcalloc(1, maxsize);
1255
1256 defn->nargs = nargs;
1257 exp_p = defn->expansion = (unsigned char *)defn + sizeof(DEFINITION);
1258 lastp = exp_p;
1259
1260 p = buf;
1261
1262 /* Add one initial space escape-marker to prevent accidental
1263 * token-pasting (often removed by macroexpand). */
1264 *exp_p++ = '@';
1265 *exp_p++ = ' ';
1266
1267 if (limit - p >= 2 && p[0] == '#' && p[1] == '#')
1268 {
1269 cpp_error(pfile, "`##' at start of macro definition");
1270 p += 2;
1271 }
1272 /* Process the main body of the definition. */
1273 while (p < limit)
1274 {
1275 int skipped_arg = 0;
1276 unsigned char c = *p++;
1277
1278 *exp_p++ = c;
1279
1280 switch (c)
1281 {
1282 case '\'':
1283 case '\"':
1284 if (expected_delimiter != '\0')
1285 {
1286 if (c == expected_delimiter)
1287 expected_delimiter = '\0';
1288 }
1289 else
1290 expected_delimiter = c;
1291 break;
1292
1293 case '\\':
1294 if (p < limit && expected_delimiter)
1295 {
1296 /* In a string, backslash goes through
1297 * and makes next char ordinary. */
1298 *exp_p++ = *p++;
1299 }
1300 break;
1301
1302 case '@':
1303 /* An '@' in a string or character constant stands for itself,
1304 * and does not need to be escaped. */
1305 if (!expected_delimiter)
1306 *exp_p++ = c;
1307 break;
1308
1309 case '#':
1310 /* # is ordinary inside a string. */
1311 if (expected_delimiter)
1312 break;
1313 if (p < limit && *p == '#')
1314 {
1315 /* ##: concatenate preceding and following tokens. */
1316 /* Take out the first #, discard preceding whitespace. */
1317 exp_p--;
1318 while (exp_p > lastp && is_hor_space[exp_p[-1]])
1319 --exp_p;
1320 /* Skip the second #. */
1321 p++;
1322 /* Discard following whitespace. */
1323 SKIP_WHITE_SPACE(p);
1324 concat = p;
1325 if (p == limit)
1326 cpp_error(pfile, "`##' at end of macro definition");
1327 }
1328 else if (nargs >= 0)
1329 {
1330 /* Single #: stringify following argument ref.
1331 * Don't leave the # in the expansion. */
1332 exp_p--;
1333 SKIP_WHITE_SPACE(p);
1334 if (p == limit || !is_idstart[*p])
1335 cpp_error(pfile,
1336 "`#' operator is not followed by a macro argument name");
1337 else
1338 stringify = p;
1339 }
1340 break;
1341 }
1342
1343 /* Handle the start of a symbol. */
1344 if (is_idchar[c] && nargs > 0)
1345 {
1346 unsigned char *id_beg = p - 1;
1347 int id_len;
1348
1349 --exp_p;
1350 while (p != limit && is_idchar[*p])
1351 p++;
1352 id_len = p - id_beg;
1353
1354 if (is_idstart[c])
1355 {
1356 struct arglist *arg;
1357
1358 for (arg = arglist; arg; arg = arg->next)
1359 {
1360 reflist *tpat;
1361
1362 if (arg->name[0] == c
1363 && arg->length == id_len
1364 && strncmp((const char *)arg->name,
1365 (const char *)id_beg, id_len) == 0)
1366 {
1367 if (expected_delimiter
1368 && CPP_OPTIONS(pfile)->warn_stringify)
1369 {
1370 cpp_warning(pfile,
1371 "macro arg `%.*s' would be stringified with -traditional.",
1372 id_len, arg->name);
1373 }
1374 /* If ANSI, don't actually substitute inside a string. */
1375 if (expected_delimiter)
1376 break;
1377 /* make a pat node for this arg and append it to the end of
1378 * the pat list */
1379 tpat = (reflist *) xmalloc(sizeof(reflist));
1380
1381 tpat->next = NULL;
1382 tpat->raw_before = concat == id_beg;
1383 tpat->raw_after = 0;
1384 tpat->rest_args = arg->rest_args;
1385 tpat->stringify = (stringify == id_beg);
1386
1387 if (!endpat)
1388 defn->pattern = tpat;
1389 else
1390 endpat->next = tpat;
1391 endpat = tpat;
1392
1393 tpat->argno = arg->argno;
1394 tpat->nchars = exp_p - lastp;
1395 {
1396 unsigned char *p1 = p;
1397
1398 SKIP_WHITE_SPACE(p1);
1399 if (p1 + 2 <= limit && p1[0] == '#'
1400 && p1[1] == '#')
1401 tpat->raw_after = 1;
1402 }
1403 lastp = exp_p; /* place to start copying from next time */
1404 skipped_arg = 1;
1405 break;
1406 }
1407 }
1408 }
1409 /* If this was not a macro arg, copy it into the expansion. */
1410 if (!skipped_arg)
1411 {
1412 unsigned char *lim1 = p;
1413
1414 p = id_beg;
1415 while (p != lim1)
1416 *exp_p++ = *p++;
1417 if (stringify == id_beg)
1418 cpp_error(pfile,
1419 "`#' operator should be followed by a macro argument name");
1420 }
1421 }
1422 }
1423
1424 if (expected_delimiter == 0)
1425 {
1426 /* If ANSI, put in a "@ " marker to prevent token pasting.
1427 * But not if "inside a string" (which in ANSI mode
1428 * happens only for -D option). */
1429 *exp_p++ = '@';
1430 *exp_p++ = ' ';
1431 }
1432 *exp_p = '\0';
1433
1434 defn->length = exp_p - defn->expansion;
1435
1436 /* Crash now if we overrun the allocated size. */
1437 if (defn->length + 1 > maxsize)
1438 abort();
1439
1440 return defn;
1441}
1442
1443/*
1444 * special extension string that can be added to the last macro argument to
1445 * allow it to absorb the "rest" of the arguments when expanded. Ex:
1446 * #define wow(a, b...) process (b, a, b)
1447 * { wow (1, 2, 3); } -> { process (2, 3, 1, 2, 3); }
1448 * { wow (one, two); } -> { process (two, one, two); }
1449 * if this "rest_arg" is used with the concat token '##' and if it is not
1450 * supplied then the token attached to with ## will not be outputted. Ex:
1451 * #define wow (a, b...) process (b ## , a, ## b)
1452 * { wow (1, 2); } -> { process (2, 1, 2); }
1453 * { wow (one); } -> { process (one); {
1454 */
1455static char rest_extension[] = "...";
1456
1457#define REST_EXTENSION_LENGTH (sizeof (rest_extension) - 1)
1458
1459/* Create a DEFINITION node from a #define directive. Arguments are
1460 * as for do_define. */
1461static void
1462create_definition(MACRODEF * mdef, unsigned char *buf, unsigned char *limit,
1463 cpp_reader * pfile, int predefinition)
1464{
1465 unsigned char *bp; /* temp ptr into input buffer */
1466 unsigned char *symname; /* remember where symbol name starts */
1467 int sym_length; /* and how long it is */
1468 int rest_args = 0;
1469 long line, col;
1470 const char *file =
1471 CPP_BUFFER(pfile) ? CPP_BUFFER(pfile)->nominal_fname : "";
1472 DEFINITION *defn;
1473 int arglengths = 0; /* Accumulate lengths of arg names
1474 * plus number of args. */
1475
1476 cpp_buf_line_and_col(CPP_BUFFER(pfile), &line, &col);
1477
1478 bp = buf;
1479
1480 while (is_hor_space[*bp])
1481 bp++;
1482
1483 symname = bp; /* remember where it starts */
1484
1485 sym_length = check_macro_name(pfile, bp, "macro");
1486 bp += sym_length;
1487
1488 /* Lossage will occur if identifiers or control keywords are broken
1489 * across lines using backslash. This is not the right place to take
1490 * care of that. */
1491
1492 if (*bp == '(')
1493 {
1494 struct arglist *arg_ptrs = NULL;
1495 int argno = 0;
1496
1497 bp++; /* skip '(' */
1498 SKIP_WHITE_SPACE(bp);
1499
1500 /* Loop over macro argument names. */
1501 while (*bp != ')')
1502 {
1503 struct arglist *temp;
1504
1505 temp = (struct arglist *)alloca(sizeof(struct arglist));
1506
1507 temp->name = (char *)bp;
1508 temp->next = arg_ptrs;
1509 temp->argno = argno++;
1510 temp->rest_args = 0;
1511 arg_ptrs = temp;
1512
1513 if (rest_args)
1514 cpp_pedwarn(pfile, "another parameter follows `%s'",
1515 rest_extension);
1516
1517 if (!is_idstart[*bp])
1518 cpp_pedwarn(pfile, "invalid character in macro parameter name");
1519
1520 /* Find the end of the arg name. */
1521 while (is_idchar[*bp])
1522 {
1523 bp++;
1524 /* do we have a "special" rest-args extension here? */
1525 if ((unsigned)(limit - bp) > REST_EXTENSION_LENGTH &&
1526 strncmp(rest_extension, (const char *)bp,
1527 REST_EXTENSION_LENGTH) == 0)
1528 {
1529 rest_args = 1;
1530 temp->rest_args = 1;
1531 break;
1532 }
1533 }
1534 temp->length = (char *)bp - temp->name;
1535 if (rest_args == 1)
1536 bp += REST_EXTENSION_LENGTH;
1537 arglengths += temp->length + 2;
1538 SKIP_WHITE_SPACE(bp);
1539 if (temp->length == 0 || (*bp != ',' && *bp != ')'))
1540 {
1541 cpp_error(pfile,
1542 "badly punctuated parameter list in `#define'");
1543 goto nope;
1544 }
1545 if (*bp == ',')
1546 {
1547 bp++;
1548 SKIP_WHITE_SPACE(bp);
1549 }
1550 if (bp >= limit)
1551 {
1552 cpp_error(pfile, "unterminated parameter list in `#define'");
1553 goto nope;
1554 }
1555 {
1556 struct arglist *otemp;
1557
1558 for (otemp = temp->next; otemp; otemp = otemp->next)
1559 if (temp->length == otemp->length &&
1560 strncmp((const char *)temp->name,
1561 (const char *)otemp->name, temp->length) == 0)
1562 {
1563 char *name;
1564
1565 name = (char *)alloca(temp->length + 1);
1566 strncpy(name, (const char *)temp->name, temp->length);
1567 name[temp->length] = '\0';
1568 cpp_error(pfile,
1569 "duplicate argument name `%s' in `#define'",
1570 name);
1571 goto nope;
1572 }
1573 }
1574 }
1575
1576 ++bp; /* skip paren */
1577 SKIP_WHITE_SPACE(bp);
1578 /* now everything from bp before limit is the definition. */
1579 defn = collect_expansion(pfile, bp, limit, argno, arg_ptrs);
1580 defn->rest_args = rest_args;
1581
1582 /* Now set defn->args.argnames to the result of concatenating
1583 * the argument names in reverse order
1584 * with comma-space between them. */
1585 defn->args.argnames = (unsigned char *)xmalloc(arglengths + 1);
1586 {
1587 struct arglist *temp;
1588 int i = 0;
1589
1590 for (temp = arg_ptrs; temp; temp = temp->next)
1591 {
1592 memcpy(&defn->args.argnames[i], temp->name, temp->length);
1593 i += temp->length;
1594 if (temp->next)
1595 {
1596 defn->args.argnames[i++] = ',';
1597 defn->args.argnames[i++] = ' ';
1598 }
1599 }
1600 defn->args.argnames[i] = 0;
1601 }
1602 }
1603 else
1604 {
1605 /* Simple expansion or empty definition. */
1606
1607 if (bp < limit)
1608 {
1609 if (is_hor_space[*bp])
1610 {
1611 bp++;
1612 SKIP_WHITE_SPACE(bp);
1613 }
1614 else
1615 {
1616 switch (*bp)
1617 {
1618 case '!':
1619 case '"':
1620 case '#':
1621 case '%':
1622 case '&':
1623 case '\'':
1624 case ')':
1625 case '*':
1626 case '+':
1627 case ',':
1628 case '-':
1629 case '.':
1630 case '/':
1631 case ':':
1632 case ';':
1633 case '<':
1634 case '=':
1635 case '>':
1636 case '?':
1637 case '[':
1638 case '\\':
1639 case ']':
1640 case '^':
1641 case '{':
1642 case '|':
1643 case '}':
1644 case '~':
1645 cpp_warning(pfile,
1646 "missing white space after `#define %.*s'",
1647 sym_length, symname);
1648 break;
1649
1650 default:
1651 cpp_pedwarn(pfile,
1652 "missing white space after `#define %.*s'",
1653 sym_length, symname);
1654 break;
1655 }
1656 }
1657 }
1658 /* now everything from bp before limit is the definition. */
1659 defn = collect_expansion(pfile, bp, limit, -1, NULL);
1660 defn->args.argnames = (unsigned char *)"";
1661 }
1662
1663 defn->line = line;
1664 defn->file = file;
1665
1666 /* OP is null if this is a predefinition */
1667 defn->predefined = predefinition;
1668 mdef->defn = defn;
1669 mdef->symnam = (char *)symname;
1670 mdef->symlen = sym_length;
1671
1672 return;
1673
1674 nope:
1675 mdef->defn = 0;
1676}
1677
1678/* Check a purported macro name SYMNAME, and yield its length.
1679 * USAGE is the kind of name this is intended for. */
1680
1681static int
1682check_macro_name(cpp_reader * pfile, unsigned char *symname, const char *usage)
1683{
1684 unsigned char *p;
1685 int sym_length;
1686
1687 for (p = symname; is_idchar[*p]; p++)
1688 ;
1689 sym_length = p - symname;
1690 if (sym_length == 0)
1691 {
1692 cpp_error(pfile, "invalid %s name", usage);
1693 }
1694 else if (!is_idstart[*symname])
1695 {
1696 unsigned char *msg; /* what pain... */
1697
1698 msg = (unsigned char *)alloca(sym_length + 1);
1699 memcpy(msg, symname, sym_length);
1700 msg[sym_length] = 0;
1701 cpp_error(pfile, "invalid %s name `%s'", usage, msg);
1702 }
1703 else
1704 {
1705 if (!strncmp((const char *)symname, "defined", 7) && sym_length == 7)
1706 cpp_error(pfile, "invalid %s name `defined'", usage);
1707 }
1708 return sym_length;
1709}
1710
1711/*
1712 * return zero if two DEFINITIONs are isomorphic
1713 */
1714static int
1715compare_defs(DEFINITION * d1, DEFINITION * d2)
1716{
1717 reflist *a1, *a2;
1718 unsigned char *p1 = d1->expansion;
1719 unsigned char *p2 = d2->expansion;
1720 int first = 1;
1721
1722 if (d1->nargs != d2->nargs)
1723 return 1;
1724 if (strcmp((char *)d1->args.argnames, (char *)d2->args.argnames))
1725 return 1;
1726 for (a1 = d1->pattern, a2 = d2->pattern; a1 && a2;
1727 a1 = a1->next, a2 = a2->next)
1728 {
1729 if (!
1730 ((a1->nchars == a2->nchars
1731 && !strncmp((const char *)p1, (const char *)p2, a1->nchars))
1732 || !comp_def_part(first, p1, a1->nchars, p2, a2->nchars, 0))
1733 || a1->argno != a2->argno || a1->stringify != a2->stringify
1734 || a1->raw_before != a2->raw_before
1735 || a1->raw_after != a2->raw_after)
1736 return 1;
1737 first = 0;
1738 p1 += a1->nchars;
1739 p2 += a2->nchars;
1740 }
1741 if (a1 != a2)
1742 return 1;
1743 if (comp_def_part(first, p1, d1->length - (p1 - d1->expansion),
1744 p2, d2->length - (p2 - d2->expansion), 1))
1745 return 1;
1746 return 0;
1747}
1748
1749/* Return 1 if two parts of two macro definitions are effectively different.
1750 * One of the parts starts at BEG1 and has LEN1 chars;
1751 * the other has LEN2 chars at BEG2.
1752 * Any sequence of whitespace matches any other sequence of whitespace.
1753 * FIRST means these parts are the first of a macro definition;
1754 * so ignore leading whitespace entirely.
1755 * LAST means these parts are the last of a macro definition;
1756 * so ignore trailing whitespace entirely. */
1757
1758static int
1759comp_def_part(int first, unsigned char *beg1, int len1,
1760 unsigned char *beg2, int len2, int last)
1761{
1762 unsigned char *end1 = beg1 + len1;
1763 unsigned char *end2 = beg2 + len2;
1764
1765 if (first)
1766 {
1767 while (beg1 != end1 && is_space[*beg1])
1768 beg1++;
1769 while (beg2 != end2 && is_space[*beg2])
1770 beg2++;
1771 }
1772 if (last)
1773 {
1774 while (beg1 != end1 && is_space[end1[-1]])
1775 end1--;
1776 while (beg2 != end2 && is_space[end2[-1]])
1777 end2--;
1778 }
1779 while (beg1 != end1 && beg2 != end2)
1780 {
1781 if (is_space[*beg1] && is_space[*beg2])
1782 {
1783 while (beg1 != end1 && is_space[*beg1])
1784 beg1++;
1785 while (beg2 != end2 && is_space[*beg2])
1786 beg2++;
1787 }
1788 else if (*beg1 == *beg2)
1789 {
1790 beg1++;
1791 beg2++;
1792 }
1793 else
1794 break;
1795 }
1796 return (beg1 != end1) || (beg2 != end2);
1797}
1798
1799/* Process a #define command.
1800 * BUF points to the contents of the #define command, as a contiguous string.
1801 * LIMIT points to the first character past the end of the definition.
1802 * KEYWORD is the keyword-table entry for #define,
1803 * or NULL for a "predefined" macro. */
1804
1805static int
1806do_define(cpp_reader * pfile, struct directive *keyword,
1807 unsigned char *buf, unsigned char *limit)
1808{
1809 int hashcode;
1810 MACRODEF mdef;
1811 HASHNODE *hp;
1812
1813 create_definition(&mdef, buf, limit, pfile, !keyword);
1814 if (!mdef.defn)
1815 return 1;
1816
1817 hashcode = hashf(mdef.symnam, mdef.symlen, HASHSIZE);
1818
1819 if ((hp = cpp_lookup(mdef.symnam, mdef.symlen, hashcode)))
1820 {
1821 int ok = 0;
1822
1823 /* Redefining a precompiled key is ok. */
1824 if (hp->type == T_PCSTRING)
1825 ok = 1;
1826 /* Redefining a macro is ok if the definitions are the same. */
1827 else if (hp->type == T_MACRO)
1828 ok = !compare_defs(mdef.defn, hp->value.defn);
1829 /* Redefining a constant is ok with -D. */
1830 else if (hp->type == T_CONST)
1831 ok = !CPP_OPTIONS(pfile)->done_initializing;
1832 /* Print the warning if it's not ok. */
1833 if (!ok)
1834 {
1835 char *msg; /* what pain... */
1836
1837 /* If we are passing through #define and #undef directives, do
1838 * that for this re-definition now. */
1839 if (CPP_OPTIONS(pfile)->debug_output && keyword)
1840 pass_thru_directive((char *)buf, (char *)limit, pfile, keyword);
1841
1842 msg = (char *)alloca(mdef.symlen + 22);
1843 *msg = '`';
1844 memcpy(msg + 1, mdef.symnam, mdef.symlen);
1845 strcpy((msg + mdef.symlen + 1), "' redefined");
1846 cpp_pedwarn(pfile, msg);
1847 if (hp->type == T_MACRO)
1848 cpp_pedwarn_with_file_and_line(pfile, hp->value.defn->file,
1849 hp->value.defn->line,
1850 "this is the location of the previous definition",
1851 NULL, NULL, NULL);
1852 }
1853 /* Replace the old definition. */
1854 hp->type = T_MACRO;
1855 hp->value.defn = mdef.defn;
1856 }
1857 else
1858 {
1859 /* If we are passing through #define and #undef directives, do
1860 * that for this new definition now. */
1861 if (CPP_OPTIONS(pfile)->debug_output && keyword)
1862 pass_thru_directive((char *)buf, (char *)limit, pfile, keyword);
1863 install(mdef.symnam, mdef.symlen, T_MACRO, 0,
1864 (char *)mdef.defn, hashcode);
1865 }
1866
1867 return 0;
1868}
1869
1870/* This structure represents one parsed argument in a macro call.
1871 * `raw' points to the argument text as written (`raw_length' is its length).
1872 * `expanded' points to the argument's macro-expansion
1873 * (its length is `expand_length').
1874 * `stringified_length' is the length the argument would have
1875 * if stringified.
1876 * `use_count' is the number of times this macro arg is substituted
1877 * into the macro. If the actual use count exceeds 10,
1878 * the value stored is 10. */
1879
1880/* raw and expanded are relative to ARG_BASE */
1881#define ARG_BASE ((pfile)->token_buffer)
1882
1883struct argdata {
1884 /* Strings relative to pfile->token_buffer */
1885 long raw, expanded, stringified;
1886 int raw_length, expand_length;
1887 int stringified_length;
1888 char newlines;
1889 char use_count;
1890};
1891
1892cpp_buffer *
1893cpp_push_buffer(cpp_reader * pfile, unsigned char *buffer, long length)
1894{
1895#ifdef STATIC_BUFFERS
1896 cpp_buffer *buf = CPP_BUFFER(pfile);
1897
1898 if (buf == pfile->buffer_stack)
1899 cpp_fatal("macro or `#include' recursion too deep");
1900 buf--;
1901 memset((char *)buf, 0, sizeof(cpp_buffer));
1902 CPP_BUFFER(pfile) = buf;
1903#else
1904 cpp_buffer *buf = (cpp_buffer *) xmalloc(sizeof(cpp_buffer));
1905
1906 memset((char *)buf, 0, sizeof(cpp_buffer));
1907 CPP_PREV_BUFFER(buf) = CPP_BUFFER(pfile);
1908 CPP_BUFFER(pfile) = buf;
1909#endif
1910 buf->if_stack = pfile->if_stack;
1911 buf->cleanup = null_cleanup;
1912 buf->underflow = null_underflow;
1913 buf->buf = buf->cur = buffer;
1914 buf->alimit = buf->rlimit = buffer + length;
1915
1916 return buf;
1917}
1918
1919static cpp_buffer *
1920cpp_pop_buffer(cpp_reader * pfile)
1921{
1922 cpp_buffer *buf = CPP_BUFFER(pfile);
1923
1924#ifdef STATIC_BUFFERS
1925 (*buf->cleanup) (buf, pfile);
1926 return ++CPP_BUFFER(pfile);
1927#else
1928 cpp_buffer *next_buf = CPP_PREV_BUFFER(buf);
1929
1930 (*buf->cleanup) (buf, pfile);
1931 CPP_BUFFER(pfile) = next_buf;
1932 free(buf);
1933 return next_buf;
1934#endif
1935}
1936
1937/* Scan until CPP_BUFFER (PFILE) is exhausted into PFILE->token_buffer.
1938 * Pop the buffer when done. */
1939
1940static void
1941cpp_scan_buffer(cpp_reader * pfile)
1942{
1943 cpp_buffer *buffer = CPP_BUFFER(pfile);
1944
1945 for (;;)
1946 {
1947 enum cpp_token token = cpp_get_token(pfile);
1948
1949 if (token == CPP_EOF) /* Should not happen ... */
1950 break;
1951 if (token == CPP_POP && CPP_BUFFER(pfile) == buffer)
1952 {
1953 cpp_pop_buffer(pfile);
1954 break;
1955 }
1956 }
1957}
1958
1959/*
1960 * Rescan a string (which may have escape marks) into pfile's buffer.
1961 * Place the result in pfile->token_buffer.
1962 *
1963 * The input is copied before it is scanned, so it is safe to pass
1964 * it something from the token_buffer that will get overwritten
1965 * (because it follows CPP_WRITTEN). This is used by do_include.
1966 */
1967
1968static void
1969cpp_expand_to_buffer(cpp_reader * pfile, unsigned char *buf, int length)
1970{
1971 cpp_buffer *ip;
1972 unsigned char *limit = buf + length;
1973 unsigned char *buf1;
1974
1975 if (length < 0)
1976 abort();
1977
1978 /* Set up the input on the input stack. */
1979
1980 buf1 = (unsigned char *)alloca(length + 1);
1981 {
1982 unsigned char *p1 = buf;
1983 unsigned char *p2 = buf1;
1984 int in_string = 0;
1985
1986#if 0 /* old behavior */
1987 while (p1 != limit) *p2++ = *p1++;
1988#else /* new one - handle \ escapes if not in string */
1989 while (p1 != limit)
1990 {
1991 if (!in_string)
1992 {
1993 if (*p1 == '"') in_string = 1;
1994 if (*p1 == '\\')
1995 {
1996 p1++;
1997 if (p1 != limit) *p2++ = *p1++;
1998 }
1999 else
2000 *p2++ = *p1++;
2001 }
2002 else
2003 {
2004 if ((*p1 == '"') && (p1 > buf) && (p1[-1] != '\\'))
2005 in_string = 0;
2006 *p2++ = *p1++;
2007 }
2008 }
2009#endif
2010 *p2 = 0;
2011 length = p2 - buf1;
2012 }
2013
2014 ip = cpp_push_buffer(pfile, buf1, length);
2015 ip->has_escapes = 1;
2016
2017 /* Scan the input, create the output. */
2018 cpp_scan_buffer(pfile);
2019
2020 CPP_NUL_TERMINATE(pfile);
2021}
2022
2023static void
2024adjust_position(unsigned char *buf, unsigned char *limit, long *linep,
2025 long *colp)
2026{
2027 while (buf < limit)
2028 {
2029 unsigned char ch = *buf++;
2030
2031 if (ch == '\n')
2032 (*linep)++, (*colp) = 1;
2033 else
2034 (*colp)++;
2035 }
2036}
2037
2038/* Move line_base forward, updating lineno and colno. */
2039
2040static void
2041update_position(cpp_buffer * pbuf)
2042{
2043 unsigned char *old_pos = pbuf->buf + pbuf->line_base;
2044 unsigned char *new_pos = pbuf->cur;
2045 struct parse_marker *mark;
2046
2047 for (mark = pbuf->marks; mark; mark = mark->next)
2048 {
2049 if (pbuf->buf + mark->position < new_pos)
2050 new_pos = pbuf->buf + mark->position;
2051 }
2052 pbuf->line_base += new_pos - old_pos;
2053 adjust_position(old_pos, new_pos, &pbuf->lineno, &pbuf->colno);
2054}
2055
2056void
2057cpp_buf_line_and_col(cpp_buffer * pbuf, long *linep, long *colp)
2058{
2059 long dummy;
2060
2061 if (!colp)
2062 colp = &dummy;
2063 if (pbuf)
2064 {
2065 *linep = pbuf->lineno;
2066 *colp = pbuf->colno;
2067 adjust_position(pbuf->buf + pbuf->line_base, pbuf->cur, linep, colp);
2068 }
2069 else
2070 {
2071 *linep = 0;
2072 *colp = 0;
2073 }
2074}
2075
2076/* Return the cpp_buffer that corresponds to a file (not a macro). */
2077
2078cpp_buffer *
2079cpp_file_buffer(cpp_reader * pfile)
2080{
2081 cpp_buffer *ip = CPP_BUFFER(pfile);
2082
2083 for (; ip != CPP_NULL_BUFFER(pfile); ip = CPP_PREV_BUFFER(ip))
2084 if (ip->fname)
2085 return ip;
2086 return NULL;
2087}
2088
2089static long
2090count_newlines(unsigned char *buf, unsigned char *limit)
2091{
2092 long count = 0;
2093
2094 while (buf < limit)
2095 {
2096 unsigned char ch = *buf++;
2097
2098 if (ch == '\n')
2099 count++;
2100 }
2101 return count;
2102}
2103
2104/*
2105 * write out a #line command, for instance, after an #include file.
2106 * If CONDITIONAL is nonzero, we can omit the #line if it would
2107 * appear to be a no-op, and we can output a few newlines instead
2108 * if we want to increase the line number by a small amount.
2109 * FILE_CHANGE says whether we are entering a file, leaving, or neither.
2110 */
2111
2112static void
2113output_line_command(cpp_reader * pfile, int conditional,
2114 enum file_change_code file_change)
2115{
2116 long line, col;
2117 cpp_buffer *ip = CPP_BUFFER(pfile);
2118
2119 if (CPP_OPTIONS(pfile)->no_line_commands
2120 || !ip->fname || CPP_OPTIONS(pfile)->no_output)
2121 {
2122 return;
2123 }
2124 update_position(ip);
2125 line = CPP_BUFFER(pfile)->lineno;
2126 col = CPP_BUFFER(pfile)->colno;
2127 adjust_position(CPP_LINE_BASE(ip), ip->cur, &line, &col);
2128
2129 if (conditional)
2130 {
2131 if (line == pfile->lineno)
2132 return;
2133
2134 /* If the inherited line number is a little too small,
2135 * output some newlines instead of a #line command. */
2136 if (line > pfile->lineno && line < pfile->lineno + 8)
2137 {
2138 CPP_RESERVE(pfile, 20);
2139 while (line > pfile->lineno)
2140 {
2141 CPP_PUTC_Q(pfile, '\n');
2142 pfile->lineno++;
2143 }
2144 return;
2145 }
2146 }
2147
2148 CPP_RESERVE(pfile, 4 * strlen(ip->nominal_fname) + 50);
2149 {
2150 static char sharp_line[] = "#line ";
2151
2152 CPP_PUTS_Q(pfile, sharp_line, sizeof(sharp_line) - 1);
2153 }
2154
2155 sprintf((char *)CPP_PWRITTEN(pfile), "%d ", (int)line);
2156 CPP_ADJUST_WRITTEN(pfile, strlen((char *)CPP_PWRITTEN(pfile)));
2157
2158 quote_string(pfile, ip->nominal_fname);
2159 if (file_change != same_file)
2160 {
2161 CPP_PUTC_Q(pfile, ' ');
2162 CPP_PUTC_Q(pfile, file_change == enter_file ? '1' : '2');
2163 }
2164 /* Tell cc1 if following text comes from a system header file. */
2165 if (ip->system_header_p)
2166 {
2167 CPP_PUTC_Q(pfile, ' ');
2168 CPP_PUTC_Q(pfile, '3');
2169 }
2170#ifndef NO_IMPLICIT_EXTERN_C
2171 /* Tell cc1plus if following text should be treated as C. */
2172 if (ip->system_header_p == 2 && CPP_OPTIONS(pfile)->cplusplus)
2173 {
2174 CPP_PUTC_Q(pfile, ' ');
2175 CPP_PUTC_Q(pfile, '4');
2176 }
2177#endif
2178 CPP_PUTC_Q(pfile, '\n');
2179 pfile->lineno = line;
2180}
2181
2182/*
2183 * Parse a macro argument and append the info on PFILE's token_buffer.
2184 * REST_ARGS means to absorb the rest of the args.
2185 * Return nonzero to indicate a syntax error.
2186 */
2187
2188static enum cpp_token
2189macarg(cpp_reader * pfile, int rest_args)
2190{
2191 int paren = 0;
2192 enum cpp_token token;
2193 char save_put_out_comments =
2194 CPP_OPTIONS(pfile)->put_out_comments;
2195
2196 CPP_OPTIONS(pfile)->put_out_comments = 0;
2197
2198 token = CPP_OTHER;
2199 /* Try to parse as much of the argument as exists at this
2200 * input stack level. */
2201 pfile->no_macro_expand++;
2202 for (;;)
2203 {
2204 token = cpp_get_token(pfile);
2205 switch (token)
2206 {
2207 case CPP_EOF:
2208 goto done;
2209 case CPP_POP:
2210 /* If we've hit end of file, it's an error (reported by caller).
2211 * Ditto if it's the end of cpp_expand_to_buffer text.
2212 * If we've hit end of macro, just continue. */
2213 if (!CPP_IS_MACRO_BUFFER(CPP_BUFFER(pfile)))
2214 goto done;
2215 break;
2216 case CPP_LPAREN:
2217 paren++;
2218 break;
2219 case CPP_RPAREN:
2220 if (--paren < 0)
2221 goto found;
2222 break;
2223 case CPP_COMMA:
2224 /* if we've returned to lowest level and
2225 * we aren't absorbing all args */
2226 if (paren == 0 && rest_args == 0)
2227 goto found;
2228 break;
2229 found:
2230 /* Remove ',' or ')' from argument buffer. */
2231 CPP_ADJUST_WRITTEN(pfile, -1);
2232 goto done;
2233 default:;
2234 }
2235 }
2236
2237 done:
2238 CPP_OPTIONS(pfile)->put_out_comments = save_put_out_comments;
2239 pfile->no_macro_expand--;
2240
2241 return token;
2242}
2243
2244/* Turn newlines to spaces in the string of length LENGTH at START,
2245 * except inside of string constants.
2246 * The string is copied into itself with its beginning staying fixed. */
2247
2248static int
2249change_newlines(unsigned char *start, int length)
2250{
2251 unsigned char *ibp;
2252 unsigned char *obp;
2253 unsigned char *limit;
2254 int c;
2255
2256 ibp = start;
2257 limit = start + length;
2258 obp = start;
2259
2260 while (ibp < limit)
2261 {
2262 *obp++ = c = *ibp++;
2263 switch (c)
2264 {
2265
2266 case '\'':
2267 case '\"':
2268 /* Notice and skip strings, so that we don't delete newlines in them. */
2269 {
2270 int quotec = c;
2271
2272 while (ibp < limit)
2273 {
2274 *obp++ = c = *ibp++;
2275 if (c == quotec)
2276 break;
2277 if (c == '\n' && quotec == '\'')
2278 break;
2279 }
2280 }
2281 break;
2282 }
2283 }
2284
2285 return obp - start;
2286}
2287
2288static struct tm *
2289timestamp(cpp_reader * pfile)
2290{
2291 if (!pfile->timebuf)
2292 {
2293 time_t t = time((time_t *) 0);
2294
2295 pfile->timebuf = localtime(&t);
2296 }
2297 return pfile->timebuf;
2298}
2299
2300static const char *monthnames[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
2301 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
2302};
2303
2304/*
2305 * expand things like __FILE__. Place the expansion into the output
2306 * buffer *without* rescanning.
2307 */
2308
2309static void
2310special_symbol(HASHNODE * hp, cpp_reader * pfile)
2311{
2312 const char *buf;
2313 char *bufx;
2314 int len;
2315 int true_indepth;
2316 cpp_buffer *ip = NULL;
2317 struct tm *timebuf;
2318
2319 int paren = 0; /* For special `defined' keyword */
2320
2321 for (ip = CPP_BUFFER(pfile);; ip = CPP_PREV_BUFFER(ip))
2322 {
2323 if (!ip)
2324 {
2325 cpp_error(pfile, "cccp error: not in any file?!");
2326 return; /* the show must go on */
2327 }
2328 if (ip->fname)
2329 break;
2330 }
2331
2332 switch (hp->type)
2333 {
2334 case T_FILE:
2335 case T_BASE_FILE:
2336 {
2337 const char *string;
2338
2339 if (hp->type == T_BASE_FILE)
2340 {
2341 while (CPP_PREV_BUFFER(ip))
2342 ip = CPP_PREV_BUFFER(ip);
2343 }
2344 string = ip->nominal_fname;
2345
2346 if (!string)
2347 string = "";
2348 CPP_RESERVE(pfile, 3 + 4 * strlen(string));
2349 quote_string(pfile, string);
2350 return;
2351 }
2352
2353 case T_INCLUDE_LEVEL:
2354 true_indepth = 0;
2355 for (ip = CPP_BUFFER(pfile); ip; ip = CPP_PREV_BUFFER(ip))
2356 if (ip->fname)
2357 true_indepth++;
2358
2359 bufx = (char *)alloca(8); /* Eight bytes ought to be more than enough */
2360 sprintf(bufx, "%d", true_indepth - 1);
2361 buf = bufx;
2362 break;
2363
2364 case T_VERSION:
2365 bufx = (char *)alloca(3 + strlen(version_string));
2366 sprintf(bufx, "\"%s\"", version_string);
2367 buf = bufx;
2368 break;
2369
2370#ifndef NO_BUILTIN_SIZE_TYPE
2371 case T_SIZE_TYPE:
2372 buf = SIZE_TYPE;
2373 break;
2374#endif
2375
2376#ifndef NO_BUILTIN_PTRDIFF_TYPE
2377 case T_PTRDIFF_TYPE:
2378 buf = PTRDIFF_TYPE;
2379 break;
2380#endif
2381
2382 case T_WCHAR_TYPE:
2383 buf = CPP_WCHAR_TYPE(pfile);
2384 break;
2385
2386 case T_USER_LABEL_PREFIX_TYPE:
2387 buf = USER_LABEL_PREFIX;
2388 break;
2389
2390 case T_REGISTER_PREFIX_TYPE:
2391 buf = REGISTER_PREFIX;
2392 break;
2393
2394 case T_CONST:
2395 bufx = (char *)alloca(4 * sizeof(int));
2396 sprintf(bufx, "%d", hp->value.ival);
2397 buf = bufx;
2398 break;
2399
2400 case T_SPECLINE:
2401 {
2402 long line = ip->lineno;
2403 long col = ip->colno;
2404
2405 adjust_position(CPP_LINE_BASE(ip), ip->cur, &line, &col);
2406
2407 bufx = (char *)alloca(10);
2408 sprintf(bufx, "%d", (int)line);
2409 buf = bufx;
2410 }
2411 break;
2412
2413 case T_DATE:
2414 case T_TIME:
2415 bufx = (char *)alloca(20);
2416 timebuf = timestamp(pfile);
2417 if (hp->type == T_DATE)
2418 sprintf(bufx, "\"%s %2d %4d\"", monthnames[timebuf->tm_mon],
2419 timebuf->tm_mday, timebuf->tm_year + 1900);
2420 else
2421 sprintf(bufx, "\"%02d:%02d:%02d\"", timebuf->tm_hour,
2422 timebuf->tm_min, timebuf->tm_sec);
2423 buf = bufx;
2424 break;
2425
2426 case T_SPEC_DEFINED:
2427 buf = " 0 "; /* Assume symbol is not defined */
2428 ip = CPP_BUFFER(pfile);
2429 SKIP_WHITE_SPACE(ip->cur);
2430 if (*ip->cur == '(')
2431 {
2432 paren++;
2433 ip->cur++; /* Skip over the paren */
2434 SKIP_WHITE_SPACE(ip->cur);
2435 }
2436 if (!is_idstart[*ip->cur])
2437 goto oops;
2438 if ((hp = cpp_lookup((const char *)ip->cur, -1, -1)))
2439 {
2440 buf = " 1 ";
2441 }
2442 while (is_idchar[*ip->cur])
2443 ++ip->cur;
2444 SKIP_WHITE_SPACE(ip->cur);
2445 if (paren)
2446 {
2447 if (*ip->cur != ')')
2448 goto oops;
2449 ++ip->cur;
2450 }
2451 break;
2452
2453 oops:
2454
2455 cpp_error(pfile, "`defined' without an identifier");
2456 break;
2457
2458 default:
2459 cpp_error(pfile, "cccp error: invalid special hash type"); /* time for gdb */
2460 abort();
2461 }
2462 len = strlen(buf);
2463 CPP_RESERVE(pfile, len + 1);
2464 CPP_PUTS_Q(pfile, buf, len);
2465 CPP_NUL_TERMINATE_Q(pfile);
2466
2467 return;
2468}
2469
2470/* Initialize the built-in macros. */
2471
2472static void
2473initialize_builtins(cpp_reader * pfile)
2474{
2475 install("__LINE__", -1, T_SPECLINE, 0, 0, -1);
2476 install("__DATE__", -1, T_DATE, 0, 0, -1);
2477 install("__FILE__", -1, T_FILE, 0, 0, -1);
2478 install("__BASE_FILE__", -1, T_BASE_FILE, 0, 0, -1);
2479 install("__INCLUDE_LEVEL__", -1, T_INCLUDE_LEVEL, 0, 0, -1);
2480 install("__VERSION__", -1, T_VERSION, 0, 0, -1);
2481#ifndef NO_BUILTIN_SIZE_TYPE
2482 install("__SIZE_TYPE__", -1, T_SIZE_TYPE, 0, 0, -1);
2483#endif
2484#ifndef NO_BUILTIN_PTRDIFF_TYPE
2485 install("__PTRDIFF_TYPE__ ", -1, T_PTRDIFF_TYPE, 0, 0, -1);
2486#endif
2487 install("__WCHAR_TYPE__", -1, T_WCHAR_TYPE, 0, 0, -1);
2488 install("__USER_LABEL_PREFIX__", -1, T_USER_LABEL_PREFIX_TYPE, 0, 0, -1);
2489 install("__REGISTER_PREFIX__", -1, T_REGISTER_PREFIX_TYPE, 0, 0, -1);
2490 install("__TIME__", -1, T_TIME, 0, 0, -1);
2491 install("__STDC__", -1, T_CONST, STDC_VALUE, 0, -1);
2492 if (CPP_OPTIONS(pfile)->objc)
2493 install("__OBJC__", -1, T_CONST, 1, 0, -1);
2494/* This is supplied using a -D by the compiler driver
2495 * so that it is present only when truly compiling with GNU C. */
2496/* install ("__GNUC__", -1, T_CONST, 2, 0, -1); */
2497
2498 if (CPP_OPTIONS(pfile)->debug_output)
2499 {
2500 char directive[2048];
2501 struct directive *dp = &directive_table[0];
2502 struct tm *timebuf = timestamp(pfile);
2503 cpp_buffer *pbuffer = CPP_BUFFER(pfile);
2504
2505 while (CPP_PREV_BUFFER(pbuffer))
2506 pbuffer = CPP_PREV_BUFFER(pbuffer);
2507 sprintf(directive, " __BASE_FILE__ \"%s\"\n", pbuffer->nominal_fname);
2508 output_line_command(pfile, 0, same_file);
2509 pass_thru_directive(directive, &directive[strlen(directive)], pfile,
2510 dp);
2511
2512 sprintf(directive, " __VERSION__ \"%s\"\n", version_string);
2513 output_line_command(pfile, 0, same_file);
2514 pass_thru_directive(directive, &directive[strlen(directive)], pfile,
2515 dp);
2516
2517#ifndef NO_BUILTIN_SIZE_TYPE
2518 sprintf(directive, " __SIZE_TYPE__ %s\n", SIZE_TYPE);
2519 output_line_command(pfile, 0, same_file);
2520 pass_thru_directive(directive, &directive[strlen(directive)], pfile,
2521 dp);
2522#endif
2523
2524#ifndef NO_BUILTIN_PTRDIFF_TYPE
2525 sprintf(directive, " __PTRDIFF_TYPE__ %s\n", PTRDIFF_TYPE);
2526 output_line_command(pfile, 0, same_file);
2527 pass_thru_directive(directive, &directive[strlen(directive)], pfile,
2528 dp);
2529#endif
2530
2531 sprintf(directive, " __WCHAR_TYPE__ %s\n", CPP_WCHAR_TYPE(pfile));
2532 output_line_command(pfile, 0, same_file);
2533 pass_thru_directive(directive, &directive[strlen(directive)], pfile,
2534 dp);
2535
2536 sprintf(directive, " __DATE__ \"%s %2d %4d\"\n",
2537 monthnames[timebuf->tm_mon],
2538 timebuf->tm_mday, timebuf->tm_year + 1900);
2539 output_line_command(pfile, 0, same_file);
2540 pass_thru_directive(directive, &directive[strlen(directive)], pfile,
2541 dp);
2542
2543 sprintf(directive, " __TIME__ \"%02d:%02d:%02d\"\n",
2544 timebuf->tm_hour, timebuf->tm_min, timebuf->tm_sec);
2545 output_line_command(pfile, 0, same_file);
2546 pass_thru_directive(directive, &directive[strlen(directive)], pfile,
2547 dp);
2548
2549 sprintf(directive, " __STDC__ 1");
2550 output_line_command(pfile, 0, same_file);
2551 pass_thru_directive(directive, &directive[strlen(directive)],
2552 pfile, dp);
2553 }
2554}
2555
2556/* Return 1 iff a token ending in C1 followed directly by a token C2
2557 * could cause mis-tokenization. */
2558
2559static int
2560unsafe_chars(int c1, int c2)
2561{
2562// printf("unsafe %c %c ...", c1, c2);
2563 switch (c1)
2564 {
2565 case '+':
2566 case '-':
2567 case '.':
2568// printf(" no0\n");
2569 return 0;
2570 case '0':
2571 case '1':
2572 case '2':
2573 case '3':
2574 case '4':
2575 case '5':
2576 case '6':
2577 case '7':
2578 case '8':
2579 case '9':
2580 case 'e':
2581 case 'E':
2582 if (c2 == '-' || c2 == '+')
2583 {
2584// printf(" yes2\n");
2585 return 1; /* could extend a pre-processing number */
2586 }
2587 goto letter;
2588 case 'L':
2589 if (c2 == '\'' || c2 == '\"')
2590 {
2591// printf(" yes3\n");
2592 return 1; /* Could turn into L"xxx" or L'xxx'. */
2593 }
2594 goto letter;
2595 letter:
2596 case '_':
2597 case 'a':
2598 case 'b':
2599 case 'c':
2600 case 'd':
2601 case 'f':
2602 case 'g':
2603 case 'h':
2604 case 'i':
2605 case 'j':
2606 case 'k':
2607 case 'l':
2608 case 'm':
2609 case 'n':
2610 case 'o':
2611 case 'p':
2612 case 'q':
2613 case 'r':
2614 case 's':
2615 case 't':
2616 case 'u':
2617 case 'v':
2618 case 'w':
2619 case 'x':
2620 case 'y':
2621 case 'z':
2622 case 'A':
2623 case 'B':
2624 case 'C':
2625 case 'D':
2626 case 'F':
2627 case 'G':
2628 case 'H':
2629 case 'I':
2630 case 'J':
2631 case 'K':
2632 case 'M':
2633 case 'N':
2634 case 'O':
2635 case 'P':
2636 case 'Q':
2637 case 'R':
2638 case 'S':
2639 case 'T':
2640 case 'U':
2641 case 'V':
2642 case 'W':
2643 case 'X':
2644 case 'Y':
2645 case 'Z':
2646 /* We're in the middle of either a name or a pre-processing number. */
2647 if (is_idchar[c2] || c2 == '.')
2648 {
2649// printf(" yes4 %i %i\n", is_idchar[c2], c2 == '.');
2650 return 1;
2651 }
2652 else
2653 {
2654// printf(" no5\n");
2655 return 0;
2656 }
2657 case '<':
2658 case '>':
2659 case '!':
2660 case '%':
2661 case '#':
2662 case ':':
2663 case '^':
2664 case '&':
2665 case '|':
2666 case '*':
2667 case '/':
2668 case '=':
2669 if (c2 == c1 || c2 == '=')
2670 {
2671// printf(" yes6\n");
2672 return 1;
2673 }
2674 else
2675 {
2676// printf(" no7\n");
2677 return 0;
2678 }
2679 }
2680// printf(" no8\n");
2681 return 0;
2682}
2683
2684/* Expand a macro call.
2685 * HP points to the symbol that is the macro being called.
2686 * Put the result of expansion onto the input stack
2687 * so that subsequent input by our caller will use it.
2688 *
2689 * If macro wants arguments, caller has already verified that
2690 * an argument list follows; arguments come from the input stack. */
2691
2692static void
2693macroexpand(cpp_reader * pfile, HASHNODE * hp)
2694{
2695 int nargs;
2696 DEFINITION *defn = hp->value.defn;
2697 unsigned char *xbuf;
2698 long start_line, start_column;
2699 int xbuf_len;
2700 struct argdata *args;
2701 long old_written = CPP_WRITTEN(pfile);
2702
2703 int rest_args, rest_zero;
2704 int i;
2705
2706 pfile->output_escapes++;
2707 cpp_buf_line_and_col(cpp_file_buffer(pfile), &start_line, &start_column);
2708
2709 rest_zero = 0;
2710 args = NULL;
2711 nargs = defn->nargs;
2712
2713 if (nargs >= 0)
2714 {
2715 enum cpp_token token;
2716
2717 token = CPP_OTHER;
2718
2719 args = (struct argdata *)alloca((nargs + 1) * sizeof(struct argdata));
2720
2721 for (i = 0; i < nargs; i++)
2722 {
2723 args[i].raw = args[i].expanded = 0;
2724 args[i].raw_length = 0;
2725 args[i].expand_length = args[i].stringified_length = -1;
2726 args[i].use_count = 0;
2727 }
2728
2729 /* Parse all the macro args that are supplied. I counts them.
2730 * The first NARGS args are stored in ARGS.
2731 * The rest are discarded. If rest_args is set then we assume
2732 * macarg absorbed the rest of the args. */
2733 i = 0;
2734 rest_args = 0;
2735 rest_args = 0;
2736 FORWARD(1); /* Discard the open-parenthesis before the first arg. */
2737 do
2738 {
2739 if (rest_args)
2740 continue;
2741 if (i < nargs || (nargs == 0 && i == 0))
2742 {
2743 unsigned char *bp;
2744
2745 /* if we are working on last arg which absorbs rest of args... */
2746 if (i == nargs - 1 && defn->rest_args)
2747 rest_args = 1;
2748 args[i].raw = CPP_WRITTEN(pfile);
2749 token = macarg(pfile, rest_args);
2750 args[i].raw_length = CPP_WRITTEN(pfile) - args[i].raw;
2751 args[i].newlines = 0; /* FIXME */
2752 bp = ARG_BASE + args[i].raw;
2753 while (is_space[(unsigned char)(*bp)]) { bp++; }
2754 args[i].raw_length -= bp - (ARG_BASE + args[i].raw);
2755 args[i].raw = bp - ARG_BASE;
2756 if (args[i].raw_length > 0)
2757 {
2758 bp = ARG_BASE + args[i].raw + args[i].raw_length - 1;
2759 while (is_space[(unsigned char)(*bp)])
2760 {
2761 bp--;
2762 args[i].raw_length--;
2763 if (args[i].raw_length < 1) break;
2764 }
2765 }
2766 }
2767 else
2768 token = macarg(pfile, 0);
2769 if (token == CPP_EOF || token == CPP_POP)
2770 {
2771 cpp_error_with_line(pfile, start_line, start_column,
2772 "unterminated macro call");
2773 return;
2774 }
2775 i++;
2776 }
2777 while (token == CPP_COMMA);
2778
2779 /* If we got one arg but it was just whitespace, call that 0 args. */
2780 if (i == 1)
2781 {
2782 unsigned char *bp = ARG_BASE + args[0].raw;
2783 unsigned char *lim = bp + args[0].raw_length;
2784
2785 /* cpp.texi says for foo ( ) we provide one argument.
2786 * However, if foo wants just 0 arguments, treat this as 0. */
2787 if (nargs == 0)
2788 while (bp != lim && is_space[*bp])
2789 bp++;
2790 if (bp == lim)
2791 i = 0;
2792 }
2793 /* Don't output an error message if we have already output one for
2794 * a parse error above. */
2795 if (nargs == 0 && i > 0)
2796 {
2797 cpp_error(pfile, "arguments given to macro `%s'", hp->name);
2798 }
2799 else if (i < nargs)
2800 {
2801 if (i == nargs - 1 && defn->rest_args)
2802 rest_zero = 1;
2803 else if (i == 0)
2804 cpp_error(pfile, "macro `%s' used without args", hp->name);
2805 else if (i == 1)
2806 cpp_error(pfile, "macro `%s' used with just one arg", hp->name);
2807 else
2808 cpp_error(pfile, "macro `%s' used with only %d args",
2809 hp->name, i);
2810 }
2811 else if (i > nargs)
2812 {
2813 cpp_error(pfile,
2814 "macro `%s' used with too many (%d) args", hp->name, i);
2815 }
2816 }
2817 /* If macro wants zero args, we parsed the arglist for checking only.
2818 * Read directly from the macro definition. */
2819 if (nargs <= 0)
2820 {
2821 xbuf = defn->expansion;
2822 xbuf_len = defn->length;
2823 }
2824 else
2825 {
2826 unsigned char *exp = defn->expansion;
2827 int offset; /* offset in expansion,
2828 * copied a piece at a time */
2829 int totlen; /* total amount of exp buffer filled so far */
2830 reflist *ap, *last_ap;
2831
2832 /* Macro really takes args. Compute the expansion of this call. */
2833
2834 /* Compute length in characters of the macro's expansion.
2835 * Also count number of times each arg is used. */
2836 xbuf_len = defn->length;
2837 for (ap = defn->pattern; ap; ap = ap->next)
2838 {
2839 if (ap->stringify)
2840 {
2841 struct argdata *arg = &args[ap->argno];
2842
2843 /* Stringify it it hasn't already been */
2844 if (arg->stringified_length < 0)
2845 {
2846 int arglen = arg->raw_length;
2847 int escaped = 0;
2848 int in_string = 0;
2849 int c;
2850
2851 /* Initially need_space is -1. Otherwise, 1 means the
2852 * previous character was a space, but we suppressed it;
2853 * 0 means the previous character was a non-space. */
2854 int need_space = -1;
2855
2856 i = 0;
2857 arg->stringified = CPP_WRITTEN(pfile);
2858 CPP_PUTC(pfile, '\"'); /* insert beginning quote */
2859 for (; i < arglen; i++)
2860 {
2861 c = (ARG_BASE + arg->raw)[i];
2862
2863 if (!in_string)
2864 {
2865 /* Internal sequences of whitespace are replaced by
2866 * one space except within an string or char token. */
2867 if (is_space[c])
2868 {
2869 if (CPP_WRITTEN(pfile) > arg->stringified
2870 && (CPP_PWRITTEN(pfile))[-1] == '@')
2871 {
2872 /* "@ " escape markers are removed */
2873 CPP_ADJUST_WRITTEN(pfile, -1);
2874 continue;
2875 }
2876 if (need_space == 0)
2877 need_space = 1;
2878 continue;
2879 }
2880 else if (need_space > 0)
2881 CPP_PUTC(pfile, ' ');
2882 need_space = 0;
2883 }
2884 if (escaped)
2885 escaped = 0;
2886 else
2887 {
2888 if (c == '\\')
2889 escaped = 1;
2890 if (in_string)
2891 {
2892 if (c == in_string)
2893 in_string = 0;
2894 }
2895 else if (c == '\"' || c == '\'')
2896 in_string = c;
2897 }
2898
2899 /* Escape these chars */
2900 if (c == '\"' || (in_string && c == '\\'))
2901 CPP_PUTC(pfile, '\\');
2902 if (isprint(c))
2903 CPP_PUTC(pfile, c);
2904 else
2905 {
2906 CPP_RESERVE(pfile, 4);
2907 sprintf((char *)CPP_PWRITTEN(pfile), "\\%03o",
2908 (unsigned int)c);
2909 CPP_ADJUST_WRITTEN(pfile, 4);
2910 }
2911 }
2912 CPP_PUTC(pfile, '\"'); /* insert ending quote */
2913 arg->stringified_length
2914 = CPP_WRITTEN(pfile) - arg->stringified;
2915 }
2916 xbuf_len += args[ap->argno].stringified_length;
2917 }
2918 else if (ap->raw_before || ap->raw_after)
2919 {
2920 /* Add 4 for two newline-space markers to prevent
2921 * token concatenation. */
2922 xbuf_len += args[ap->argno].raw_length + 4;
2923 }
2924 else
2925 {
2926 /* We have an ordinary (expanded) occurrence of the arg.
2927 * So compute its expansion, if we have not already. */
2928 if (args[ap->argno].expand_length < 0)
2929 {
2930 args[ap->argno].expanded = CPP_WRITTEN(pfile);
2931 cpp_expand_to_buffer(pfile,
2932 ARG_BASE + args[ap->argno].raw,
2933 args[ap->argno].raw_length);
2934
2935 args[ap->argno].expand_length
2936 = CPP_WRITTEN(pfile) - args[ap->argno].expanded;
2937 }
2938 /* Add 4 for two newline-space markers to prevent
2939 * token concatenation. */
2940 xbuf_len += args[ap->argno].expand_length + 4;
2941 }
2942 if (args[ap->argno].use_count < 10)
2943 args[ap->argno].use_count++;
2944 }
2945
2946 xbuf = (unsigned char *)xmalloc(xbuf_len + 1);
2947
2948 /* Generate in XBUF the complete expansion
2949 * with arguments substituted in.
2950 * TOTLEN is the total size generated so far.
2951 * OFFSET is the index in the definition
2952 * of where we are copying from. */
2953 offset = totlen = 0;
2954 for (last_ap = NULL, ap = defn->pattern; ap;
2955 last_ap = ap, ap = ap->next)
2956 {
2957 struct argdata *arg = &args[ap->argno];
2958 int count_before = totlen;
2959
2960 /* Add chars to XBUF. */
2961 for (i = 0; i < ap->nchars; i++, offset++)
2962 xbuf[totlen++] = exp[offset];
2963
2964 /* If followed by an empty rest arg with concatenation,
2965 * delete the last run of nonwhite chars. */
2966 if (rest_zero && totlen > count_before
2967 && ((ap->rest_args && ap->raw_before)
2968 || (last_ap && last_ap->rest_args && last_ap->raw_after)))
2969 {
2970 /* Delete final whitespace. */
2971 while (totlen > count_before && is_space[xbuf[totlen - 1]])
2972 totlen--;
2973
2974 /* Delete the nonwhites before them. */
2975 while (totlen > count_before && !is_space[xbuf[totlen - 1]])
2976 totlen--;
2977 }
2978 if (ap->stringify != 0)
2979 {
2980 memcpy(xbuf + totlen, ARG_BASE + arg->stringified,
2981 arg->stringified_length);
2982 totlen += arg->stringified_length;
2983 }
2984 else if (ap->raw_before || ap->raw_after)
2985 {
2986 unsigned char *p1 = ARG_BASE + arg->raw;
2987 unsigned char *l1 = p1 + arg->raw_length;
2988
2989 if (ap->raw_before)
2990 {
2991 while (p1 != l1 && is_space[*p1])
2992 p1++;
2993 while (p1 != l1 && is_idchar[*p1])
2994 xbuf[totlen++] = *p1++;
2995 }
2996 if (ap->raw_after)
2997 {
2998 /* Arg is concatenated after: delete trailing whitespace,
2999 * whitespace markers, and no-reexpansion markers. */
3000 while (p1 != l1)
3001 {
3002 if (is_space[l1[-1]])
3003 l1--;
3004 else if (l1[-1] == '-')
3005 {
3006 unsigned char *p2 = l1 - 1;
3007
3008 /* If a `-' is preceded by an odd number of newlines then it
3009 * and the last newline are a no-reexpansion marker. */
3010 while (p2 != p1 && p2[-1] == '\n')
3011 p2--;
3012 if ((l1 - 1 - p2) & 1)
3013 {
3014 l1 -= 2;
3015 }
3016 else
3017 break;
3018 }
3019 else
3020 break;
3021 }
3022 }
3023 memcpy(xbuf + totlen, p1, l1 - p1);
3024 totlen += l1 - p1;
3025 }
3026 else
3027 {
3028 unsigned char *expanded = ARG_BASE + arg->expanded;
3029
3030 if (!ap->raw_before && totlen > 0 && arg->expand_length
3031 && unsafe_chars(xbuf[totlen - 1], expanded[0]))
3032 {
3033 xbuf[totlen++] = '@';
3034 xbuf[totlen++] = ' ';
3035 }
3036 memcpy(xbuf + totlen, expanded, arg->expand_length);
3037 totlen += arg->expand_length;
3038
3039 if (!ap->raw_after && totlen > 0 && offset < defn->length
3040 && unsafe_chars(xbuf[totlen - 1], exp[offset]))
3041 {
3042 xbuf[totlen++] = '@';
3043 xbuf[totlen++] = ' ';
3044 }
3045 /* If a macro argument with newlines is used multiple times,
3046 * then only expand the newlines once. This avoids creating
3047 * output lines which don't correspond to any input line,
3048 * which confuses gdb and gcov. */
3049 if (arg->use_count > 1 && arg->newlines > 0)
3050 {
3051 /* Don't bother doing change_newlines for subsequent
3052 * uses of arg. */
3053 arg->use_count = 1;
3054 arg->expand_length
3055 = change_newlines(expanded, arg->expand_length);
3056 }
3057 }
3058
3059 if (totlen > xbuf_len)
3060 abort();
3061 }
3062 /* if there is anything left of the definition
3063 * after handling the arg list, copy that in too. */
3064
3065 for (i = offset; i < defn->length; i++)
3066 {
3067 /* if we've reached the end of the macro */
3068 if (exp[i] == ')')
3069 rest_zero = 0;
3070 if (!(rest_zero && last_ap && last_ap->rest_args
3071 && last_ap->raw_after))
3072 xbuf[totlen++] = exp[i];
3073 }
3074
3075 xbuf[totlen] = 0;
3076 xbuf_len = totlen;
3077 }
3078
3079 pfile->output_escapes--;
3080
3081 /* Now put the expansion on the input stack
3082 * so our caller will commence reading from it. */
3083 push_macro_expansion(pfile, xbuf, xbuf_len, hp);
3084 CPP_BUFFER(pfile)->has_escapes = 1;
3085
3086 /* Pop the space we've used in the token_buffer for argument expansion. */
3087 CPP_SET_WRITTEN(pfile, old_written);
3088
3089 /* Recursive macro use sometimes works traditionally.
3090 * #define foo(x,y) bar (x (y,0), y)
3091 * foo (foo, baz) */
3092
3093 hp->type = T_DISABLED;
3094}
3095
3096static void
3097push_macro_expansion(cpp_reader * pfile, unsigned char *xbuf, int xbuf_len,
3098 HASHNODE * hp)
3099{
3100 cpp_buffer *mbuf = cpp_push_buffer(pfile, xbuf, xbuf_len);
3101
3102 mbuf->cleanup = macro_cleanup;
3103 mbuf->data = hp;
3104
3105 /* The first chars of the expansion should be a "@ " added by
3106 * collect_expansion. This is to prevent accidental token-pasting
3107 * between the text preceding the macro invocation, and the macro
3108 * expansion text.
3109 *
3110 * We would like to avoid adding unneeded spaces (for the sake of
3111 * tools that use cpp, such as imake). In some common cases we can
3112 * tell that it is safe to omit the space.
3113 *
3114 * The character before the macro invocation cannot have been an
3115 * idchar (or else it would have been pasted with the idchars of
3116 * the macro name). Therefore, if the first non-space character
3117 * of the expansion is an idchar, we do not need the extra space
3118 * to prevent token pasting.
3119 *
3120 * Also, we don't need the extra space if the first char is '(',
3121 * or some other (less common) characters. */
3122
3123 if (xbuf[0] == '@' && xbuf[1] == ' '
3124 && (is_idchar[xbuf[2]] || xbuf[2] == '(' || xbuf[2] == '\''
3125 || xbuf[2] == '\"'))
3126 mbuf->cur += 2;
3127}
3128
3129/* Like cpp_get_token, except that it does not read past end-of-line.
3130 * Also, horizontal space is skipped, and macros are popped. */
3131
3132static enum cpp_token
3133get_directive_token(cpp_reader * pfile)
3134{
3135 for (;;)
3136 {
3137 long old_written = CPP_WRITTEN(pfile);
3138 enum cpp_token token;
3139
3140 cpp_skip_hspace(pfile);
3141 if (PEEKC() == '\n')
3142 return CPP_VSPACE;
3143 token = cpp_get_token(pfile);
3144 switch (token)
3145 {
3146 case CPP_POP:
3147 if (!CPP_IS_MACRO_BUFFER(CPP_BUFFER(pfile)))
3148 return token;
3149 /* ... else fall though ... */
3150 case CPP_HSPACE:
3151 case CPP_COMMENT:
3152 CPP_SET_WRITTEN(pfile, old_written);
3153 break;
3154 default:
3155 return token;
3156 }
3157 }
3158}
3159
3160/* Handle #include and #import.
3161 * This function expects to see "fname" or <fname> on the input.
3162 *
3163 * The input is normally in part of the output_buffer following
3164 * CPP_WRITTEN, and will get overwritten by output_line_command.
3165 * I.e. in input file specification has been popped by handle_directive.
3166 * This is safe. */
3167
3168static int
3169do_include(cpp_reader * pfile, struct directive *keyword,
3170 unsigned char *unused1 __UNUSED__, unsigned char *unused2 __UNUSED__)
3171{
3172 int importing = (keyword->type == T_IMPORT);
3173 int skip_dirs = (keyword->type == T_INCLUDE_NEXT);
3174 char *fname; /* Dynamically allocated fname buffer */
3175 unsigned char *fbeg, *fend; /* Beginning and end of fname */
3176 enum cpp_token token;
3177
3178 /* Chain of dirs to search */
3179 file_name_list *search_start = CPP_OPTIONS(pfile)->include;
3180 file_name_list dsp[1]; /* First in chain, if #include "..." */
3181 file_name_list *searchptr = 0;
3182 long old_written = CPP_WRITTEN(pfile);
3183 int flen;
3184 int f; /* file number */
3185 int angle_brackets = 0; /* 0 for "...", 1 for <...> */
3186
3187 f = -1; /* JF we iz paranoid! */
3188
3189 if (importing && CPP_OPTIONS(pfile)->warn_import
3190 && !CPP_OPTIONS(pfile)->inhibit_warnings
3191 && !CPP_BUFFER(pfile)->system_header_p && !pfile->import_warning)
3192 {
3193 pfile->import_warning = 1;
3194 cpp_warning(pfile, "using `#import' is not recommended");
3195 fprintf(stderr,
3196 "The fact that a certain header file need not be processed more than once\n");
3197 fprintf(stderr,
3198 "should be indicated in the header file, not where it is used.\n");
3199 fprintf(stderr,
3200 "The best way to do this is with a conditional of this form:\n\n");
3201 fprintf(stderr, " #ifndef _FOO_H_INCLUDED\n");
3202 fprintf(stderr, " #define _FOO_H_INCLUDED\n");
3203 fprintf(stderr, " ... <real contents of file> ...\n");
3204 fprintf(stderr, " #endif /* Not _FOO_H_INCLUDED */\n\n");
3205 fprintf(stderr, "Then users can use `#include' any number of times.\n");
3206 fprintf(stderr,
3207 "GNU C automatically avoids processing the file more than once\n");
3208 fprintf(stderr, "when it is equipped with such a conditional.\n");
3209 }
3210 pfile->parsing_include_directive++;
3211 token = get_directive_token(pfile);
3212 pfile->parsing_include_directive--;
3213
3214 if (token == CPP_STRING)
3215 {
3216 /* FIXME - check no trailing garbage */
3217 fbeg = pfile->token_buffer + old_written + 1;
3218 fend = CPP_PWRITTEN(pfile) - 1;
3219 if (fbeg[-1] == '<')
3220 {
3221 angle_brackets = 1;
3222 /* If -I-, start with the first -I dir after the -I-. */
3223 if (CPP_OPTIONS(pfile)->first_bracket_include)
3224 search_start = CPP_OPTIONS(pfile)->first_bracket_include;
3225 }
3226 /* If -I- was specified, don't search current dir, only spec'd ones. */
3227 else if (!CPP_OPTIONS(pfile)->ignore_srcdir)
3228 {
3229 cpp_buffer *fp;
3230
3231 /* We have "filename". Figure out directory this source
3232 * file is coming from and put it on the front of the list. */
3233
3234 for (fp = CPP_BUFFER(pfile); fp; fp = CPP_PREV_BUFFER(fp))
3235 {
3236 int n;
3237 const char *ep, *nam;
3238
3239 if ((nam = fp->nominal_fname))
3240 {
3241 /* Found a named file. Figure out dir of the file,
3242 * and put it in front of the search list. */
3243 dsp[0].next = search_start;
3244 search_start = dsp;
3245#ifndef VMS
3246 ep = strrchr(nam, '/');
3247#else /* VMS */
3248 ep = strrchr(nam, ']');
3249 if (!ep)
3250 ep = strrchr(nam, '>');
3251 if (!ep)
3252 ep = strrchr(nam, ':');
3253 if (ep)
3254 ep++;
3255#endif /* VMS */
3256 if (ep)
3257 {
3258 n = ep - nam;
3259 dsp[0].fname = (char *)alloca(n + 1);
3260 strncpy(dsp[0].fname, nam, n);
3261 dsp[0].fname[n] = '\0';
3262 if (n + INCLUDE_LEN_FUDGE > pfile->max_include_len)
3263 pfile->max_include_len = n + INCLUDE_LEN_FUDGE;
3264 }
3265 else
3266 {
3267 dsp[0].fname = 0; /* Current directory */
3268 }
3269 dsp[0].got_name_map = 0;
3270 break;
3271 }
3272 }
3273 }
3274 }
3275 else
3276 {
3277 cpp_error(pfile,
3278 "`#%s' expects \"FILENAME\" or <FILENAME>", keyword->name);
3279 CPP_SET_WRITTEN(pfile, old_written);
3280 skip_rest_of_line(pfile);
3281 return 0;
3282 }
3283
3284 *fend = 0;
3285
3286 token = get_directive_token(pfile);
3287 if (token != CPP_VSPACE)
3288 {
3289 cpp_error(pfile, "junk at end of `#include'");
3290 while (token != CPP_VSPACE && token != CPP_EOF && token != CPP_POP)
3291 token = get_directive_token(pfile);
3292 }
3293 /* For #include_next, skip in the search path
3294 * past the dir in which the containing file was found. */
3295 if (skip_dirs)
3296 {
3297 cpp_buffer *fp;
3298
3299 for (fp = CPP_BUFFER(pfile); fp; fp = CPP_PREV_BUFFER(fp))
3300 if (fp->fname)
3301 {
3302 /* fp->dir is null if the containing file was specified with
3303 * an absolute file name. In that case, don't skip anything. */
3304 if (fp->dir == SELF_DIR_DUMMY)
3305 search_start = CPP_OPTIONS(pfile)->include;
3306 else if (fp->dir)
3307 search_start = fp->dir->next;
3308 break;
3309 }
3310 }
3311 CPP_SET_WRITTEN(pfile, old_written);
3312
3313 flen = fend - fbeg;
3314
3315 if (flen == 0)
3316 {
3317 cpp_error(pfile, "empty file name in `#%s'", keyword->name);
3318 return 0;
3319 }
3320 /* Allocate this permanently, because it gets stored in the definitions
3321 * of macros. */
3322 fname = (char *)xmalloc(pfile->max_include_len + flen + 4);
3323 /* + 2 above for slash and terminating null. */
3324 /* + 2 added for '.h' on VMS (to support '#include filename') */
3325
3326 /* If specified file name is absolute, just open it. */
3327
3328#ifndef __EMX__
3329 if (*fbeg == '/')
3330#else
3331 if (_fnisabs(fbeg))
3332#endif
3333 {
3334 strncpy(fname, (const char *)fbeg, flen);
3335 fname[flen] = 0;
3336 if (redundant_include_p(pfile, fname))
3337 return 0;
3338 if (importing)
3339 f = lookup_import(pfile, fname, NULL);
3340 else
3341 f = open_include_file(pfile, fname, NULL);
3342 if (f == -2)
3343 return 0; /* Already included this file */
3344 }
3345 else
3346 {
3347 /* Search directory path, trying to open the file.
3348 * Copy each filename tried into FNAME. */
3349
3350 for (searchptr = search_start; searchptr; searchptr = searchptr->next)
3351 {
3352 if (searchptr->fname)
3353 {
3354 /* The empty string in a search path is ignored.
3355 * This makes it possible to turn off entirely
3356 * a standard piece of the list. */
3357 if (searchptr->fname[0] == 0)
3358 continue;
3359 strcpy(fname, searchptr->fname);
3360 strcat(fname, "/");
3361 fname[strlen(fname) + flen] = 0;
3362 }
3363 else
3364 {
3365 fname[0] = 0;
3366 }
3367 strncat(fname, (const char *)fbeg, flen);
3368#ifdef VMS
3369 /* Change this 1/2 Unix 1/2 VMS file specification into a
3370 * full VMS file specification */
3371 if (searchptr->fname && (searchptr->fname[0] != 0))
3372 {
3373 /* Fix up the filename */
3374 hack_vms_include_specification(fname);
3375 }
3376 else
3377 {
3378 /* This is a normal VMS filespec, so use it unchanged. */
3379 strncpy(fname, fbeg, flen);
3380 fname[flen] = 0;
3381 /* if it's '#include filename', add the missing .h */
3382 if (!strchr(fname, '.'))
3383 {
3384 strcat(fname, ".h");
3385 }
3386 }
3387#endif /* VMS */
3388 /* ??? There are currently 3 separate mechanisms for avoiding processing
3389 * of redundant include files: #import, #pragma once, and
3390 * redundant_include_p. It would be nice if they were unified. */
3391 if (redundant_include_p(pfile, fname))
3392 return 0;
3393 if (importing)
3394 f = lookup_import(pfile, fname, searchptr);
3395 else
3396 f = open_include_file(pfile, fname, searchptr);
3397 if (f == -2)
3398 return 0; /* Already included this file */
3399#ifdef EACCES
3400 else if (f == -1 && errno == EACCES)
3401 cpp_warning(pfile, "Header file %s exists, but is not readable",
3402 fname);
3403#endif
3404 if (f >= 0)
3405 break;
3406 }
3407 }
3408
3409 if (f < 0)
3410 {
3411 /* A file that was not found. */
3412 strncpy(fname, (const char *)fbeg, flen);
3413 fname[flen] = 0;
3414 /* If generating dependencies and -MG was specified, we assume missing
3415 * files are leaf files, living in the same directory as the source file
3416 * or other similar place; these missing files may be generated from
3417 * other files and may not exist yet (eg: y.tab.h). */
3418
3419 if (CPP_OPTIONS(pfile)->print_deps_missing_files
3420 && CPP_PRINT_DEPS(pfile)
3421 > (angle_brackets || (pfile->system_include_depth > 0)))
3422 {
3423 /* If it was requested as a system header file,
3424 * then assume it belongs in the first place to look for such. */
3425 if (angle_brackets)
3426 {
3427 for (searchptr = search_start; searchptr;
3428 searchptr = searchptr->next)
3429 {
3430 if (searchptr->fname)
3431 {
3432 char *p;
3433
3434 if (searchptr->fname[0] == 0)
3435 continue;
3436 p = (char *)alloca(strlen(searchptr->fname)
3437 + strlen(fname) + 2);
3438 strcpy(p, searchptr->fname);
3439 strcat(p, "/");
3440 strcat(p, fname);
3441 deps_output(pfile, p, ' ');
3442 break;
3443 }
3444 }
3445 }
3446 else
3447 {
3448 /* Otherwise, omit the directory, as if the file existed
3449 * in the directory with the source. */
3450 deps_output(pfile, fname, ' ');
3451 }
3452 }
3453 /* If -M was specified, and this header file won't be added to the
3454 * dependency list, then don't count this as an error, because we can
3455 * still produce correct output. Otherwise, we can't produce correct
3456 * output, because there may be dependencies we need inside the missing
3457 * file, and we don't know what directory this missing file exists in. */
3458 else if (CPP_PRINT_DEPS(pfile)
3459 && (CPP_PRINT_DEPS(pfile)
3460 <= (angle_brackets || (pfile->system_include_depth > 0))))
3461 cpp_warning(pfile, "No include path in which to find %s", fname);
3462 else if (search_start)
3463 cpp_error_from_errno(pfile, fname);
3464 else
3465 cpp_error(pfile, "No include path in which to find %s", fname);
3466 }
3467 else
3468 {
3469 /* Check to see if this include file is a once-only include file.
3470 * If so, give up. */
3471
3472 file_name_list *ptr;
3473
3474 for (ptr = pfile->dont_repeat_files; ptr; ptr = ptr->next)
3475 {
3476 if (!strcmp(ptr->fname, fname))
3477 {
3478 close(f);
3479 return 0; /* This file was once'd. */
3480 }
3481 }
3482
3483 for (ptr = pfile->all_include_files; ptr; ptr = ptr->next)
3484 {
3485 if (!strcmp(ptr->fname, fname))
3486 break; /* This file was included before. */
3487 }
3488
3489 if (!ptr)
3490 {
3491 /* This is the first time for this file. */
3492 /* Add it to list of files included. */
3493
3494 ptr = (file_name_list *) xmalloc(sizeof(file_name_list));
3495
3496 ptr->control_macro = 0;
3497 ptr->c_system_include_path = 0;
3498 ptr->next = pfile->all_include_files;
3499 pfile->all_include_files = ptr;
3500 ptr->fname = savestring(fname);
3501 ptr->got_name_map = 0;
3502
3503 /* For -M, add this file to the dependencies. */
3504 if (CPP_PRINT_DEPS(pfile)
3505 > (angle_brackets || (pfile->system_include_depth > 0)))
3506 deps_output(pfile, fname, ' ');
3507 }
3508 /* Handle -H option. */
3509 if (CPP_OPTIONS(pfile)->print_include_names)
3510 {
3511 cpp_buffer *buf = CPP_BUFFER(pfile);
3512
3513 while ((buf = CPP_PREV_BUFFER(buf)))
3514 putc('.', stderr);
3515 fprintf(stderr, "%s\n", fname);
3516 }
3517 if (angle_brackets)
3518 pfile->system_include_depth++;
3519
3520 /* Actually process the file. */
3521
3522 /* Record file on "seen" list for #import. */
3523 add_import(pfile, f, fname);
3524
3525 /* Actually process the file */
3526 cpp_push_buffer(pfile, NULL, 0);
3527 if (finclude(pfile, f, fname, is_system_include(pfile, fname),
3528 searchptr != dsp ? searchptr : SELF_DIR_DUMMY))
3529 {
3530 output_line_command(pfile, 0, enter_file);
3531 pfile->only_seen_white = 2;
3532 }
3533 if (angle_brackets)
3534 pfile->system_include_depth--;
3535 }
3536 return 0;
3537}
3538
3539/* Return nonzero if there is no need to include file NAME
3540 * because it has already been included and it contains a conditional
3541 * to make a repeated include do nothing. */
3542
3543static int
3544redundant_include_p(cpp_reader * pfile, char *name)
3545{
3546 file_name_list *l = pfile->all_include_files;
3547
3548 for (; l; l = l->next)
3549 if (!strcmp(name, l->fname)
3550 && l->control_macro
3551 && cpp_lookup((const char *)l->control_macro, -1, -1))
3552 return 1;
3553 return 0;
3554}
3555
3556/* Return nonzero if the given FILENAME is an absolute pathname which
3557 * designates a file within one of the known "system" include file
3558 * directories. We assume here that if the given FILENAME looks like
3559 * it is the name of a file which resides either directly in a "system"
3560 * include file directory, or within any subdirectory thereof, then the
3561 * given file must be a "system" include file. This function tells us
3562 * if we should suppress pedantic errors/warnings for the given FILENAME.
3563 *
3564 * The value is 2 if the file is a C-language system header file
3565 * for which C++ should (on most systems) assume `extern "C"'. */
3566
3567static int
3568is_system_include(cpp_reader * pfile, char *filename)
3569{
3570 file_name_list *searchptr;
3571
3572 for (searchptr = CPP_OPTIONS(pfile)->first_system_include; searchptr;
3573 searchptr = searchptr->next)
3574 if (searchptr->fname)
3575 {
3576 char *sys_dir = searchptr->fname;
3577 unsigned length = strlen(sys_dir);
3578
3579 if (!strncmp(sys_dir, filename, length) && filename[length] == '/')
3580 {
3581 if (searchptr->c_system_include_path)
3582 return 2;
3583 else
3584 return 1;
3585 }
3586 }
3587 return 0;
3588}
3589
3590/*
3591 * Install a name in the assertion hash table.
3592 *
3593 * If LEN is >= 0, it is the length of the name.
3594 * Otherwise, compute the length by scanning the entire name.
3595 *
3596 * If HASH is >= 0, it is the precomputed hash code.
3597 * Otherwise, compute the hash code.
3598 */
3599static ASSERTION_HASHNODE *
3600assertion_install(cpp_reader * pfile, const char *name, int len, int hash)
3601{
3602 ASSERTION_HASHNODE *hp;
3603 int i, bucket;
3604
3605 i = sizeof(ASSERTION_HASHNODE) + len + 1;
3606 hp = (ASSERTION_HASHNODE *) xmalloc(i);
3607 bucket = hash;
3608 hp->bucket_hdr = &pfile->assertion_hashtab[bucket];
3609 hp->next = pfile->assertion_hashtab[bucket];
3610 pfile->assertion_hashtab[bucket] = hp;
3611 hp->prev = NULL;
3612 if (hp->next)
3613 hp->next->prev = hp;
3614 hp->length = len;
3615 hp->value = 0;
3616 hp->name = ((char *)hp) + sizeof(ASSERTION_HASHNODE);
3617 memcpy(hp->name, name, len);
3618 hp->name[len] = 0;
3619 return hp;
3620}
3621/*
3622 * find the most recent hash node for name name (ending with first
3623 * non-identifier char) installed by install
3624 *
3625 * If LEN is >= 0, it is the length of the name.
3626 * Otherwise, compute the length by scanning the entire name.
3627 *
3628 * If HASH is >= 0, it is the precomputed hash code.
3629 * Otherwise, compute the hash code.
3630 */
3631
3632static ASSERTION_HASHNODE *
3633assertion_lookup(cpp_reader * pfile, const char *name, int len, int hash)
3634{
3635 ASSERTION_HASHNODE *bucket;
3636
3637 bucket = pfile->assertion_hashtab[hash];
3638 while (bucket)
3639 {
3640 if (bucket->length == len && strncmp(bucket->name, name, len) == 0)
3641 return bucket;
3642 bucket = bucket->next;
3643 }
3644 return NULL;
3645}
3646
3647static void
3648delete_assertion(ASSERTION_HASHNODE * hp)
3649{
3650 struct tokenlist_list *tail;
3651
3652 if (hp->prev)
3653 hp->prev->next = hp->next;
3654 if (hp->next)
3655 hp->next->prev = hp->prev;
3656
3657 for (tail = hp->value; tail;)
3658 {
3659 struct tokenlist_list *next = tail->next;
3660
3661 free_token_list(tail->tokens);
3662 free(tail);
3663 tail = next;
3664 }
3665
3666 /* make sure that the bucket chain header that
3667 * the deleted guy was on points to the right thing afterwards. */
3668 if (hp == *hp->bucket_hdr)
3669 *hp->bucket_hdr = hp->next;
3670
3671 free(hp);
3672}
3673
3674/* Convert a character string literal into a nul-terminated string.
3675 * The input string is [IN ... LIMIT).
3676 * The result is placed in RESULT. RESULT can be the same as IN.
3677 * The value returned in the end of the string written to RESULT,
3678 * or NULL on error. */
3679
3680static char *
3681convert_string(cpp_reader * pfile, char *result, char *in, char *limit,
3682 int handle_escapes)
3683{
3684 unsigned char c;
3685
3686 c = *in++;
3687 if (c != '\"')
3688 return NULL;
3689 while (in < limit)
3690 {
3691 c = *in++;
3692
3693 switch (c)
3694 {
3695 case '\0':
3696 return NULL;
3697 case '\"':
3698 limit = in;
3699 break;
3700 case '\\':
3701 if (handle_escapes)
3702 {
3703 char *bpc = in;
3704 int i =
3705 (unsigned char)cpp_parse_escape(pfile, &bpc);
3706
3707 in = bpc;
3708 if (i >= 0)
3709 *result++ = (unsigned char)c;
3710 break;
3711 }
3712 /* else fall through */
3713 default:
3714 *result++ = c;
3715 }
3716 }
3717 *result = 0;
3718 return result;
3719}
3720
3721/*
3722 * interpret #line command. Remembers previously seen fnames
3723 * in its very own hash table.
3724 */
3725#define FNAME_HASHSIZE 37
3726
3727static int
3728do_line(cpp_reader * pfile, struct directive *keyword __UNUSED__,
3729 unsigned char *unused1 __UNUSED__, unsigned char *unused2 __UNUSED__)
3730{
3731 cpp_buffer *ip = CPP_BUFFER(pfile);
3732 int new_lineno;
3733 long old_written = CPP_WRITTEN(pfile);
3734 enum file_change_code file_change = same_file;
3735 enum cpp_token token;
3736
3737 token = get_directive_token(pfile);
3738
3739 if (token != CPP_NUMBER || !isdigit(pfile->token_buffer[old_written]))
3740 {
3741 cpp_error(pfile, "invalid format `#line' command");
3742 goto bad_line_directive;
3743 }
3744 /* The Newline at the end of this line remains to be processed.
3745 * To put the next line at the specified line number,
3746 * we must store a line number now that is one less. */
3747 new_lineno = atoi((char *)(pfile->token_buffer + old_written)) - 1;
3748 CPP_SET_WRITTEN(pfile, old_written);
3749
3750 /* NEW_LINENO is one less than the actual line number here. */
3751 if (CPP_PEDANTIC(pfile) && new_lineno < 0)
3752 cpp_pedwarn(pfile, "line number out of range in `#line' command");
3753
3754 token = get_directive_token(pfile);
3755
3756 if (token == CPP_STRING)
3757 {
3758 char *fname = (char *)pfile->token_buffer + old_written;
3759 char *end_name;
3760 static HASHNODE *fname_table[FNAME_HASHSIZE];
3761 HASHNODE *hp, **hash_bucket;
3762 unsigned char *p;
3763 long num_start;
3764 int fname_length;
3765
3766 /* Turn the file name, which is a character string literal,
3767 * into a null-terminated string. Do this in place. */
3768 end_name =
3769 convert_string(pfile, fname, fname, (char *)CPP_PWRITTEN(pfile), 1);
3770 if (!end_name)
3771 {
3772 cpp_error(pfile, "invalid format `#line' command");
3773 goto bad_line_directive;
3774 }
3775 fname_length = end_name - fname;
3776
3777 num_start = CPP_WRITTEN(pfile);
3778 token = get_directive_token(pfile);
3779 if (token != CPP_VSPACE && token != CPP_EOF && token != CPP_POP)
3780 {
3781 p = pfile->token_buffer + num_start;
3782 if (CPP_PEDANTIC(pfile))
3783 cpp_pedwarn(pfile, "garbage at end of `#line' command");
3784
3785 if (token != CPP_NUMBER || *p < '0' || *p > '4' || p[1] != '\0')
3786 {
3787 cpp_error(pfile, "invalid format `#line' command");
3788 goto bad_line_directive;
3789 }
3790 if (*p == '1')
3791 file_change = enter_file;
3792 else if (*p == 2)
3793 file_change = leave_file;
3794 else if (*p == 3)
3795 ip->system_header_p = 1;
3796 else /* if (*p == 4) */
3797 ip->system_header_p = 2;
3798
3799 CPP_SET_WRITTEN(pfile, num_start);
3800 token = get_directive_token(pfile);
3801 p = pfile->token_buffer + num_start;
3802 if (token == CPP_NUMBER && p[1] == '\0'
3803 && (*p == '3' || *p == '4'))
3804 {
3805 ip->system_header_p = *p == 3 ? 1 : 2;
3806 token = get_directive_token(pfile);
3807 }
3808 if (token != CPP_VSPACE)
3809 {
3810 cpp_error(pfile, "invalid format `#line' command");
3811 goto bad_line_directive;
3812 }
3813 }
3814 hash_bucket = &fname_table[hashf(fname, fname_length, FNAME_HASHSIZE)];
3815 for (hp = *hash_bucket; hp; hp = hp->next)
3816 if (hp->length == fname_length &&
3817 strncmp(hp->value.cpval, fname, fname_length) == 0)
3818 {
3819 ip->nominal_fname = hp->value.cpval;
3820 break;
3821 }
3822 if (!hp)
3823 {
3824 /* Didn't find it; cons up a new one. */
3825 hp = (HASHNODE *) xcalloc(1, sizeof(HASHNODE) + fname_length + 1);
3826 hp->next = *hash_bucket;
3827 *hash_bucket = hp;
3828
3829 hp->length = fname_length;
3830 ip->nominal_fname = hp->value.cpval =
3831 ((char *)hp) + sizeof(HASHNODE);
3832 memcpy(hp->value.cpval, fname, fname_length);
3833 }
3834 }
3835 else if (token != CPP_VSPACE && token != CPP_EOF)
3836 {
3837 cpp_error(pfile, "invalid format `#line' command");
3838 goto bad_line_directive;
3839 }
3840 ip->lineno = new_lineno;
3841 bad_line_directive:
3842 skip_rest_of_line(pfile);
3843 CPP_SET_WRITTEN(pfile, old_written);
3844 output_line_command(pfile, 0, file_change);
3845 return 0;
3846}
3847
3848/*
3849 * remove the definition of a symbol from the symbol table.
3850 * according to un*x /lib/cpp, it is not an error to undef
3851 * something that has no definitions, so it isn't one here either.
3852 */
3853
3854static int
3855do_undef(cpp_reader * pfile, struct directive *keyword, unsigned char *buf,
3856 unsigned char *limit)
3857{
3858 int sym_length;
3859 HASHNODE *hp;
3860 unsigned char *orig_buf = buf;
3861
3862 SKIP_WHITE_SPACE(buf);
3863 sym_length = check_macro_name(pfile, buf, "macro");
3864
3865 while ((hp = cpp_lookup((const char *)buf, sym_length, -1)))
3866 {
3867 /* If we are generating additional info for debugging (with -g) we
3868 * need to pass through all effective #undef commands. */
3869 if (CPP_OPTIONS(pfile)->debug_output && keyword)
3870 pass_thru_directive((char *)orig_buf, (char *)limit, pfile, keyword);
3871 if (hp->type != T_MACRO)
3872 cpp_warning(pfile, "undefining `%s'", hp->name);
3873 delete_macro(hp);
3874 }
3875
3876 if (CPP_PEDANTIC(pfile))
3877 {
3878 buf += sym_length;
3879 SKIP_WHITE_SPACE(buf);
3880 if (buf != limit)
3881 cpp_pedwarn(pfile, "garbage after `#undef' directive");
3882 }
3883 return 0;
3884}
3885
3886/*
3887 * Report an error detected by the program we are processing.
3888 * Use the text of the line in the error message.
3889 * (We use error because it prints the filename & line#.)
3890 */
3891
3892static int
3893do_error(cpp_reader * pfile, struct directive *keyword __UNUSED__,
3894 unsigned char *buf, unsigned char *limit)
3895{
3896 int length = limit - buf;
3897 unsigned char *copy = (unsigned char *)xmalloc(length + 1);
3898
3899 memcpy(copy, buf, length);
3900 copy[length] = 0;
3901 SKIP_WHITE_SPACE(copy);
3902 cpp_error(pfile, "#error %s", copy);
3903 return 0;
3904}
3905
3906/*
3907 * Report a warning detected by the program we are processing.
3908 * Use the text of the line in the warning message, then continue.
3909 * (We use error because it prints the filename & line#.)
3910 */
3911
3912static int
3913do_warning(cpp_reader * pfile, struct directive *keyword __UNUSED__,
3914 unsigned char *buf, unsigned char *limit)
3915{
3916 int length = limit - buf;
3917 unsigned char *copy = (unsigned char *)xmalloc(length + 1);
3918
3919 memcpy(copy, buf, length);
3920 copy[length] = 0;
3921 SKIP_WHITE_SPACE(copy);
3922 cpp_warning(pfile, "#warning %s", copy);
3923 return 0;
3924}
3925
3926/* Remember the name of the current file being read from so that we can
3927 * avoid ever including it again. */
3928
3929static int
3930do_once(cpp_reader * pfile)
3931{
3932 cpp_buffer *ip = NULL;
3933 file_name_list *new_;
3934
3935 for (ip = CPP_BUFFER(pfile);; ip = CPP_PREV_BUFFER(ip))
3936 {
3937 if (!ip)
3938 return 0;
3939 if (ip->fname)
3940 break;
3941 }
3942
3943 new_ = (file_name_list *) xmalloc(sizeof(file_name_list));
3944
3945 new_->next = pfile->dont_repeat_files;
3946 pfile->dont_repeat_files = new_;
3947 new_->fname = savestring(ip->fname);
3948 new_->control_macro = 0;
3949 new_->got_name_map = 0;
3950 new_->c_system_include_path = 0;
3951
3952 return 0;
3953}
3954
3955/* #ident has already been copied to the output file, so just ignore it. */
3956
3957static int
3958do_ident(cpp_reader * pfile, struct directive *keyword __UNUSED__,
3959 unsigned char *buf __UNUSED__, unsigned char *limit __UNUSED__)
3960{
3961/* long old_written = CPP_WRITTEN (pfile); */
3962
3963 /* Allow #ident in system headers, since that's not user's fault. */
3964 if (CPP_PEDANTIC(pfile) && !CPP_BUFFER(pfile)->system_header_p)
3965 cpp_pedwarn(pfile, "ANSI C does not allow `#ident'");
3966
3967 /* Leave rest of line to be read by later calls to cpp_get_token. */
3968
3969 return 0;
3970}
3971
3972/* #pragma and its argument line have already been copied to the output file.
3973 * Just check for some recognized pragmas that need validation here. */
3974
3975static int
3976do_pragma(cpp_reader * pfile, struct directive *keyword __UNUSED__,
3977 unsigned char *buf, unsigned char *limit __UNUSED__)
3978{
3979 while (*buf == ' ' || *buf == '\t')
3980 buf++;
3981
3982 if (!strncmp((const char *)buf, "once", 4))
3983 {
3984 /* Allow #pragma once in system headers, since that's not the user's
3985 * fault. */
3986 if (!CPP_BUFFER(pfile)->system_header_p)
3987 cpp_warning(pfile, "`#pragma once' is obsolete");
3988 do_once(pfile);
3989 }
3990 if (!strncmp((const char *)buf, "implementation", 14))
3991 {
3992 /* Be quiet about `#pragma implementation' for a file only if it hasn't
3993 * been included yet. */
3994 file_name_list *ptr;
3995 char *p = (char *)buf + 14, *fname, *inc_fname;
3996 int fname_len;
3997
3998 SKIP_WHITE_SPACE(p);
3999 if (*p == '\n' || *p != '\"')
4000 return 0;
4001
4002 fname = p + 1;
4003 p = strchr(fname, '\"');
4004 fname_len = (p) ? (int)(p - fname) : (int)strlen(fname);
4005
4006 for (ptr = pfile->all_include_files; ptr; ptr = ptr->next)
4007 {
4008 inc_fname = strrchr(ptr->fname, '/');
4009 inc_fname = inc_fname ? inc_fname + 1 : (char *)ptr->fname;
4010 if (inc_fname && !strncmp(inc_fname, fname, fname_len))
4011 cpp_warning(pfile,
4012 "`#pragma implementation' for `%s' appears after file is included",
4013 fname);
4014 }
4015 }
4016 return 0;
4017}
4018
4019/* Just ignore #sccs, on systems where we define it at all. */
4020
4021/*
4022 * handle #if command by
4023 * 1) inserting special `defined' keyword into the hash table
4024 * that gets turned into 0 or 1 by special_symbol (thus,
4025 * if the luser has a symbol called `defined' already, it won't
4026 * work inside the #if command)
4027 * 2) rescan the input into a temporary output buffer
4028 * 3) pass the output buffer to the yacc parser and collect a value
4029 * 4) clean up the mess left from steps 1 and 2.
4030 * 5) call conditional_skip to skip til the next #endif (etc.),
4031 * or not, depending on the value from step 3.
4032 */
4033
4034static int
4035do_if(cpp_reader * pfile, struct directive *keyword __UNUSED__,
4036 unsigned char *buf, unsigned char *limit)
4037{
4038 HOST_WIDE_INT value = eval_if_expression(pfile, buf, limit - buf);
4039
4040 conditional_skip(pfile, value == 0, T_IF, NULL);
4041 return 0;
4042}
4043
4044/*
4045 * handle a #elif directive by not changing if_stack either.
4046 * see the comment above do_else.
4047 */
4048
4049static int
4050do_elif(cpp_reader * pfile, struct directive *keyword __UNUSED__,
4051 unsigned char *buf, unsigned char *limit)
4052{
4053 if (pfile->if_stack == CPP_BUFFER(pfile)->if_stack)
4054 {
4055 cpp_error(pfile, "`#elif' not within a conditional");
4056 return 0;
4057 }
4058 else
4059 {
4060 if (pfile->if_stack->type != T_IF && pfile->if_stack->type != T_ELIF)
4061 {
4062 cpp_error(pfile, "`#elif' after `#else'");
4063 if (pfile->if_stack->fname
4064 && CPP_BUFFER(pfile)->fname
4065 && strcmp(pfile->if_stack->fname,
4066 CPP_BUFFER(pfile)->nominal_fname) != 0)
4067 fprintf(stderr, ", file %s", pfile->if_stack->fname);
4068 fprintf(stderr, ")\n");
4069 }
4070 pfile->if_stack->type = T_ELIF;
4071 }
4072
4073 if (pfile->if_stack->if_succeeded)
4074 skip_if_group(pfile, 0);
4075 else
4076 {
4077 HOST_WIDE_INT value = eval_if_expression(pfile, buf, limit - buf);
4078
4079 if (value == 0)
4080 skip_if_group(pfile, 0);
4081 else
4082 {
4083 ++pfile->if_stack->if_succeeded; /* continue processing input */
4084 output_line_command(pfile, 1, same_file);
4085 }
4086 }
4087 return 0;
4088}
4089
4090/*
4091 * evaluate a #if expression in BUF, of length LENGTH,
4092 * then parse the result as a C expression and return the value as an int.
4093 */
4094static HOST_WIDE_INT
4095eval_if_expression(cpp_reader * pfile, unsigned char *buf __UNUSED__,
4096 int length __UNUSED__)
4097{
4098 HASHNODE *save_defined;
4099 HOST_WIDE_INT value;
4100 long old_written = CPP_WRITTEN(pfile);
4101
4102 save_defined = install("defined", -1, T_SPEC_DEFINED, 0, 0, -1);
4103 pfile->pcp_inside_if = 1;
4104
4105 value = cpp_parse_expr(pfile);
4106 pfile->pcp_inside_if = 0;
4107 delete_macro(save_defined); /* clean up special symbol */
4108
4109 CPP_SET_WRITTEN(pfile, old_written); /* Pop */
4110
4111 return value;
4112}
4113
4114/*
4115 * routine to handle ifdef/ifndef. Try to look up the symbol,
4116 * then do or don't skip to the #endif/#else/#elif depending
4117 * on what directive is actually being processed.
4118 */
4119
4120static int
4121do_xifdef(cpp_reader * pfile, struct directive *keyword,
4122 unsigned char *unused1 __UNUSED__, unsigned char *unused2 __UNUSED__)
4123{
4124 int skip;
4125 cpp_buffer *ip = CPP_BUFFER(pfile);
4126 char *ident;
4127 int ident_length;
4128 enum cpp_token token;
4129 int start_of_file = 0;
4130 unsigned char *control_macro = 0;
4131 int old_written = CPP_WRITTEN(pfile);
4132 int c;
4133
4134 /* Detect a #ifndef at start of file (not counting comments). */
4135 if (ip->fname != 0 && keyword->type == T_IFNDEF)
4136 start_of_file = pfile->only_seen_white == 2;
4137
4138 pfile->no_macro_expand++;
4139 token = get_directive_token(pfile);
4140 pfile->no_macro_expand--;
4141
4142 ident = (char *)pfile->token_buffer + old_written;
4143 ident_length = CPP_WRITTEN(pfile) - old_written;
4144 CPP_SET_WRITTEN(pfile, old_written); /* Pop */
4145
4146 if (token == CPP_VSPACE || token == CPP_POP || token == CPP_EOF)
4147 {
4148 skip = (keyword->type == T_IFDEF);
4149 cpp_pedwarn(pfile, "`#%s' with no argument", keyword->name);
4150 }
4151 else if (token == CPP_NAME)
4152 {
4153 HASHNODE *hp = cpp_lookup(ident, ident_length, -1);
4154
4155 skip = (!hp) ^ (keyword->type == T_IFNDEF);
4156 if (start_of_file && !skip)
4157 {
4158 control_macro = (unsigned char *)xmalloc(ident_length + 1);
4159 memcpy(control_macro, ident, ident_length + 1);
4160 }
4161 }
4162 else
4163 {
4164 skip = (keyword->type == T_IFDEF);
4165 cpp_error(pfile, "`#%s' with invalid argument", keyword->name);
4166 }
4167
4168 cpp_skip_hspace(pfile);
4169 c = PEEKC();
4170 if (c != EOF && c != '\n')
4171 cpp_pedwarn(pfile, "garbage at end of `#%s' argument",
4172 keyword->name);
4173 skip_rest_of_line(pfile);
4174
4175 conditional_skip(pfile, skip, T_IF, control_macro);
4176 return 0;
4177}
4178
4179/* Push TYPE on stack; then, if SKIP is nonzero, skip ahead.
4180 * If this is a #ifndef starting at the beginning of a file,
4181 * CONTROL_MACRO is the macro name tested by the #ifndef.
4182 * Otherwise, CONTROL_MACRO is 0. */
4183
4184static void
4185conditional_skip(cpp_reader * pfile, int skip, enum node_type type,
4186 unsigned char *control_macro)
4187{
4188 IF_STACK_FRAME *temp;
4189
4190 temp = (IF_STACK_FRAME *) xcalloc(1, sizeof(IF_STACK_FRAME));
4191 temp->fname = CPP_BUFFER(pfile)->nominal_fname;
4192 temp->next = pfile->if_stack;
4193 temp->control_macro = control_macro;
4194 pfile->if_stack = temp;
4195
4196 pfile->if_stack->type = type;
4197
4198 if (skip != 0)
4199 {
4200 skip_if_group(pfile, 0);
4201 return;
4202 }
4203 else
4204 {
4205 ++pfile->if_stack->if_succeeded;
4206 output_line_command(pfile, 1, same_file);
4207 }
4208}
4209
4210/*
4211 * skip to #endif, #else, or #elif. adjust line numbers, etc.
4212 * leaves input ptr at the sharp sign found.
4213 * If ANY is nonzero, return at next directive of any sort.
4214 */
4215
4216static void
4217skip_if_group(cpp_reader * pfile, int any)
4218{
4219 int c;
4220 struct directive *kt;
4221 IF_STACK_FRAME *save_if_stack = pfile->if_stack; /* don't pop past here */
4222
4223 int ident_length;
4224 char *ident;
4225 struct parse_marker line_start_mark;
4226
4227 parse_set_mark(&line_start_mark, pfile);
4228
4229 if (CPP_OPTIONS(pfile)->output_conditionals)
4230 {
4231 static char failed[] = "#failed\n";
4232
4233 CPP_PUTS(pfile, failed, sizeof(failed) - 1);
4234 pfile->lineno++;
4235 output_line_command(pfile, 1, same_file);
4236 }
4237 beg_of_line:
4238 if (CPP_OPTIONS(pfile)->output_conditionals)
4239 {
4240 cpp_buffer *pbuf = CPP_BUFFER(pfile);
4241 unsigned char *start_line = pbuf->buf + line_start_mark.position;
4242
4243 CPP_PUTS(pfile, start_line, pbuf->cur - start_line);
4244 }
4245 parse_move_mark(&line_start_mark, pfile);
4246 cpp_skip_hspace(pfile);
4247 c = GETC();
4248 if (c == '#')
4249 {
4250 int old_written = CPP_WRITTEN(pfile);
4251
4252 cpp_skip_hspace(pfile);
4253
4254 parse_name(pfile, GETC());
4255 ident_length = CPP_WRITTEN(pfile) - old_written;
4256 ident = (char *)pfile->token_buffer + old_written;
4257 pfile->limit = (unsigned char *)ident;
4258
4259 for (kt = directive_table; kt->length >= 0; kt++)
4260 {
4261 IF_STACK_FRAME *temp;
4262
4263 if (ident_length == kt->length
4264 && strncmp(ident, kt->name, kt->length) == 0)
4265 {
4266 /* If we are asked to return on next directive, do so now. */
4267 if (any)
4268 goto done;
4269
4270 switch (kt->type)
4271 {
4272 case T_IF:
4273 case T_IFDEF:
4274 case T_IFNDEF:
4275 temp
4276 =
4277 (IF_STACK_FRAME *) xcalloc(1, sizeof(IF_STACK_FRAME));
4278 temp->next = pfile->if_stack;
4279 pfile->if_stack = temp;
4280 temp->fname = CPP_BUFFER(pfile)->nominal_fname;
4281 temp->type = kt->type;
4282 break;
4283 case T_ELSE:
4284 case T_ENDIF:
4285 if (CPP_PEDANTIC(pfile)
4286 && pfile->if_stack != save_if_stack)
4287 validate_else(pfile,
4288 kt->type ==
4289 T_ELSE ? "#else" : "#endif");
4290 case T_ELIF:
4291 if (pfile->if_stack == CPP_BUFFER(pfile)->if_stack)
4292 {
4293 cpp_error(pfile,
4294 "`#%s' not within a conditional",
4295 kt->name);
4296 break;
4297 }
4298 else if (pfile->if_stack == save_if_stack)
4299 goto done; /* found what we came for */
4300
4301 if (kt->type != T_ENDIF)
4302 {
4303 if (pfile->if_stack->type == T_ELSE)
4304 cpp_error(pfile,
4305 "`#else' or `#elif' after `#else'");
4306 pfile->if_stack->type = kt->type;
4307 break;
4308 }
4309 temp = pfile->if_stack;
4310 pfile->if_stack = temp->next;
4311 free(temp);
4312 break;
4313 default:;
4314 }
4315 break;
4316 }
4317 /* Don't let erroneous code go by. */
4318 if (kt->length < 0 && !CPP_OPTIONS(pfile)->lang_asm
4319 && CPP_PEDANTIC(pfile))
4320 cpp_pedwarn(pfile, "invalid preprocessor directive name");
4321 }
4322 c = GETC();
4323 }
4324 /* We're in the middle of a line. Skip the rest of it. */
4325 for (;;)
4326 {
4327 switch (c)
4328 {
4329 long old;
4330
4331 case EOF:
4332 goto done;
4333 case '/': /* possible comment */
4334 c = skip_comment(pfile, NULL);
4335 if (c == EOF)
4336 goto done;
4337 break;
4338 case '\"':
4339 case '\'':
4340 FORWARD(-1);
4341 old = CPP_WRITTEN(pfile);
4342 cpp_get_token(pfile);
4343 CPP_SET_WRITTEN(pfile, old);
4344 break;
4345 case '\\':
4346 /* Char after backslash loses its special meaning. */
4347 if (PEEKC() == '\n')
4348 FORWARD(1);
4349 break;
4350 case '\n':
4351 goto beg_of_line;
4352 break;
4353 }
4354 c = GETC();
4355 }
4356 done:
4357 if (CPP_OPTIONS(pfile)->output_conditionals)
4358 {
4359 static char end_failed[] = "#endfailed\n";
4360
4361 CPP_PUTS(pfile, end_failed, sizeof(end_failed) - 1);
4362 pfile->lineno++;
4363 }
4364 pfile->only_seen_white = 1;
4365 parse_goto_mark(&line_start_mark, pfile);
4366 parse_clear_mark(&line_start_mark);
4367}
4368
4369/*
4370 * handle a #else directive. Do this by just continuing processing
4371 * without changing if_stack ; this is so that the error message
4372 * for missing #endif's etc. will point to the original #if. It
4373 * is possible that something different would be better.
4374 */
4375
4376static int
4377do_else(cpp_reader * pfile, struct directive *keyword __UNUSED__,
4378 unsigned char *buf __UNUSED__, unsigned char *limit __UNUSED__)
4379{
4380 cpp_buffer *ip = CPP_BUFFER(pfile);
4381
4382 if (CPP_PEDANTIC(pfile))
4383 validate_else(pfile, "#else");
4384 skip_rest_of_line(pfile);
4385
4386 if (pfile->if_stack == CPP_BUFFER(pfile)->if_stack)
4387 {
4388 cpp_error(pfile, "`#else' not within a conditional");
4389 return 0;
4390 }
4391 else
4392 {
4393 /* #ifndef can't have its special treatment for containing the whole file
4394 * if it has a #else clause. */
4395 pfile->if_stack->control_macro = 0;
4396
4397 if (pfile->if_stack->type != T_IF && pfile->if_stack->type != T_ELIF)
4398 {
4399 cpp_error(pfile, "`#else' after `#else'");
4400 fprintf(stderr, " (matches line %d", pfile->if_stack->lineno);
4401 if (strcmp(pfile->if_stack->fname, ip->nominal_fname) != 0)
4402 fprintf(stderr, ", file %s", pfile->if_stack->fname);
4403 fprintf(stderr, ")\n");
4404 }
4405 pfile->if_stack->type = T_ELSE;
4406 }
4407
4408 if (pfile->if_stack->if_succeeded)
4409 skip_if_group(pfile, 0);
4410 else
4411 {
4412 ++pfile->if_stack->if_succeeded; /* continue processing input */
4413 output_line_command(pfile, 1, same_file);
4414 }
4415 return 0;
4416}
4417
4418/*
4419 * unstack after #endif command
4420 */
4421
4422static int
4423do_endif(cpp_reader * pfile, struct directive *keyword __UNUSED__,
4424 unsigned char *buf __UNUSED__, unsigned char *limit __UNUSED__)
4425{
4426 if (CPP_PEDANTIC(pfile))
4427 validate_else(pfile, "#endif");
4428 skip_rest_of_line(pfile);
4429
4430 if (pfile->if_stack == CPP_BUFFER(pfile)->if_stack)
4431 {
4432 cpp_error(pfile, "unbalanced `#endif'");
4433 }
4434 else
4435 {
4436 IF_STACK_FRAME *temp = pfile->if_stack;
4437
4438 pfile->if_stack = temp->next;
4439 if (temp->control_macro)
4440 {
4441 /* This #endif matched a #ifndef at the start of the file.
4442 * See if it is at the end of the file. */
4443 struct parse_marker start_mark;
4444 int c;
4445
4446 parse_set_mark(&start_mark, pfile);
4447
4448 for (;;)
4449 {
4450 cpp_skip_hspace(pfile);
4451 c = GETC();
4452 if (c != '\n')
4453 break;
4454 }
4455 parse_goto_mark(&start_mark, pfile);
4456 parse_clear_mark(&start_mark);
4457
4458 if (c == EOF)
4459 {
4460 /* If we get here, this #endif ends a #ifndef
4461 * that contains all of the file (aside from whitespace).
4462 * Arrange not to include the file again
4463 * if the macro that was tested is defined.
4464 *
4465 * Do not do this for the top-level file in a -include or any
4466 * file in a -imacros. */
4467 {
4468 file_name_list *ifile = pfile->all_include_files;
4469
4470 for (; ifile; ifile = ifile->next)
4471 {
4472 if (!strcmp(ifile->fname, CPP_BUFFER(pfile)->fname))
4473 {
4474 ifile->control_macro = temp->control_macro;
4475 break;
4476 }
4477 }
4478 }
4479 }
4480 }
4481 free(temp);
4482 output_line_command(pfile, 1, same_file);
4483 }
4484 return 0;
4485}
4486
4487/* When an #else or #endif is found while skipping failed conditional,
4488 * if -pedantic was specified, this is called to warn about text after
4489 * the command name. P points to the first char after the command name. */
4490
4491static void
4492validate_else(cpp_reader * pfile, const char *directive)
4493{
4494 int c;
4495
4496 cpp_skip_hspace(pfile);
4497 c = PEEKC();
4498 if (c != EOF && c != '\n')
4499 cpp_pedwarn(pfile,
4500 "text following `%s' violates ANSI standard", directive);
4501}
4502
4503/* Get the next token, and add it to the text in pfile->token_buffer.
4504 * Return the kind of token we got. */
4505
4506enum cpp_token
4507cpp_get_token(cpp_reader * pfile)
4508{
4509 int c, c2, c3;
4510 long old_written = 0;
4511 long start_line = 0, start_column = 0;
4512 enum cpp_token token;
4513 struct cpp_options *opts = CPP_OPTIONS(pfile);
4514
4515 CPP_BUFFER(pfile)->prev = CPP_BUFFER(pfile)->cur;
4516 get_next:
4517 c = GETC();
4518 if (c == EOF)
4519 {
4520 handle_eof:
4521 if (CPP_BUFFER(pfile)->seen_eof)
4522 {
4523 if (cpp_pop_buffer(pfile) != CPP_NULL_BUFFER(pfile))
4524 goto get_next;
4525 else
4526 return CPP_EOF;
4527 }
4528 else
4529 {
4530 cpp_buffer *next_buf = CPP_PREV_BUFFER(CPP_BUFFER(pfile));
4531
4532 CPP_BUFFER(pfile)->seen_eof = 1;
4533 if (CPP_BUFFER(pfile)->nominal_fname && next_buf)
4534 {
4535 /* We're about to return from an #include file.
4536 * Emit #line information now (as part of the CPP_POP) result.
4537 * But the #line refers to the file we will pop to. */
4538 cpp_buffer *cur_buffer = CPP_BUFFER(pfile);
4539
4540 CPP_BUFFER(pfile) = next_buf;
4541 pfile->input_stack_listing_current = 0;
4542 output_line_command(pfile, 0, leave_file);
4543 CPP_BUFFER(pfile) = cur_buffer;
4544 }
4545 return CPP_POP;
4546 }
4547 }
4548 else
4549 {
4550 switch (c)
4551 {
4552 long newlines;
4553 struct parse_marker start_mark;
4554
4555 case '/':
4556 if (PEEKC() == '=')
4557 goto op2;
4558 if (opts->put_out_comments)
4559 parse_set_mark(&start_mark, pfile);
4560 newlines = 0;
4561 cpp_buf_line_and_col(cpp_file_buffer(pfile),
4562 &start_line, &start_column);
4563 c = skip_comment(pfile, &newlines);
4564 if (opts->put_out_comments && (c == '/' || c == EOF))
4565 parse_clear_mark(&start_mark);
4566 if (c == '/')
4567 goto randomchar;
4568 if (c == EOF)
4569 {
4570 cpp_error_with_line(pfile, start_line, start_column,
4571 "unterminated comment");
4572 goto handle_eof;
4573 }
4574 c = '/'; /* Initial letter of comment. */
4575 return_comment:
4576 /* Comments are equivalent to spaces.
4577 * For -traditional, a comment is equivalent to nothing. */
4578 if (opts->put_out_comments)
4579 {
4580 cpp_buffer *pbuf = CPP_BUFFER(pfile);
4581 unsigned char *start = pbuf->buf + start_mark.position;
4582 int len = pbuf->cur - start;
4583
4584 CPP_RESERVE(pfile, 1 + len);
4585 CPP_PUTC_Q(pfile, c);
4586 CPP_PUTS_Q(pfile, start, len);
4587 pfile->lineno += newlines;
4588 parse_clear_mark(&start_mark);
4589 return CPP_COMMENT;
4590 }
4591 else if (newlines > 0)
4592 {
4593 output_line_command(pfile, 0, same_file);
4594 CPP_RESERVE(pfile, 1);
4595 CPP_PUTC_Q(pfile, ' ');
4596 return CPP_VSPACE;
4597 }
4598 else
4599 {
4600 CPP_RESERVE(pfile, 1);
4601 CPP_PUTC_Q(pfile, ' ');
4602 return CPP_HSPACE;
4603 }
4604
4605 case '#':
4606 if (!pfile->only_seen_white)
4607 goto randomchar;
4608 if (handle_directive(pfile))
4609 return CPP_DIRECTIVE;
4610 pfile->only_seen_white = 0;
4611 return CPP_OTHER;
4612
4613 case '\"':
4614 case '\'':
4615 /* A single quoted string is treated like a double -- some
4616 * programs (e.g., troff) are perverse this way */
4617 cpp_buf_line_and_col(cpp_file_buffer(pfile),
4618 &start_line, &start_column);
4619 old_written = CPP_WRITTEN(pfile);
4620 string:
4621 CPP_PUTC(pfile, c);
4622 while (1)
4623 {
4624 int cc = GETC();
4625
4626 if (cc == EOF)
4627 {
4628 if (CPP_IS_MACRO_BUFFER(CPP_BUFFER(pfile)))
4629 {
4630 /* try harder: this string crosses a macro expansion
4631 * boundary. This can happen naturally if -traditional.
4632 * Otherwise, only -D can make a macro with an unmatched
4633 * quote. */
4634 cpp_buffer *next_buf
4635 = CPP_PREV_BUFFER(CPP_BUFFER(pfile));
4636
4637 (*CPP_BUFFER(pfile)->cleanup)
4638 (CPP_BUFFER(pfile), pfile);
4639 CPP_BUFFER(pfile) = next_buf;
4640 continue;
4641 }
4642 cpp_error_with_line(pfile, start_line, start_column,
4643 "unterminated string or character constant");
4644 if (pfile->multiline_string_line != start_line
4645 && pfile->multiline_string_line != 0)
4646 cpp_error_with_line(pfile,
4647 pfile->multiline_string_line,
4648 -1,
4649 "possible real start of unterminated constant");
4650 pfile->multiline_string_line = 0;
4651 break;
4652 }
4653 CPP_PUTC(pfile, cc);
4654 switch (cc)
4655 {
4656 case '\n':
4657 /* Traditionally, end of line ends a string constant with
4658 * no error. So exit the loop and record the new line. */
4659 if (c == '\'')
4660 {
4661 cpp_error_with_line(pfile, start_line, start_column,
4662 "unterminated character constant");
4663 goto while2end;
4664 }
4665 if (CPP_PEDANTIC(pfile)
4666 && pfile->multiline_string_line == 0)
4667 {
4668 cpp_pedwarn_with_line(pfile, start_line,
4669 start_column,
4670 "string constant runs past end of line");
4671 }
4672 if (pfile->multiline_string_line == 0)
4673 pfile->multiline_string_line = start_line;
4674 break;
4675
4676 case '\\':
4677 cc = GETC();
4678 if (cc == '\n')
4679 {
4680 /* Backslash newline is replaced by nothing at all. */
4681 CPP_ADJUST_WRITTEN(pfile, -1);
4682 pfile->lineno++;
4683 }
4684 else
4685 {
4686 /* ANSI stupidly requires that in \\ the second \
4687 * is *not* prevented from combining with a newline. */
4688 NEWLINE_FIX1(cc);
4689 if (cc != EOF)
4690 CPP_PUTC(pfile, cc);
4691 }
4692 break;
4693
4694 case '\"':
4695 case '\'':
4696 if (cc == c)
4697 goto while2end;
4698 break;
4699 }
4700 }
4701 while2end:
4702 pfile->lineno += count_newlines(pfile->token_buffer + old_written,
4703 CPP_PWRITTEN(pfile));
4704 pfile->only_seen_white = 0;
4705 return c == '\'' ? CPP_CHAR : CPP_STRING;
4706
4707 case '$':
4708 if (!opts->dollars_in_ident)
4709 goto randomchar;
4710 goto letter;
4711
4712 case ':':
4713 if (opts->cplusplus && PEEKC() == ':')
4714 goto op2;
4715 goto randomchar;
4716
4717 case '&':
4718 case '+':
4719 case '|':
4720 NEWLINE_FIX;
4721 c2 = PEEKC();
4722 if (c2 == c || c2 == '=')
4723 goto op2;
4724 goto randomchar;
4725
4726 case '*':
4727 case '!':
4728 case '%':
4729 case '=':
4730 case '^':
4731 NEWLINE_FIX;
4732 if (PEEKC() == '=')
4733 goto op2;
4734 goto randomchar;
4735
4736 case '-':
4737 NEWLINE_FIX;
4738 c2 = PEEKC();
4739 if (c2 == '-' && opts->chill)
4740 {
4741 /* Chill style comment */
4742 if (opts->put_out_comments)
4743 parse_set_mark(&start_mark, pfile);
4744 FORWARD(1); /* Skip second '-'. */
4745 for (;;)
4746 {
4747 c = GETC();
4748 if (c == EOF)
4749 break;
4750 if (c == '\n')
4751 {
4752 /* Don't consider final '\n' to be part of comment. */
4753 FORWARD(-1);
4754 break;
4755 }
4756 }
4757 c = '-';
4758 goto return_comment;
4759 }
4760 if (c2 == '-' || c2 == '=' || c2 == '>')
4761 goto op2;
4762 goto randomchar;
4763
4764 case '<':
4765 if (pfile->parsing_include_directive)
4766 {
4767 for (;;)
4768 {
4769 CPP_PUTC(pfile, c);
4770 if (c == '>')
4771 break;
4772 c = GETC();
4773 NEWLINE_FIX1(c);
4774 if (c == '\n' || c == EOF)
4775 {
4776 cpp_error(pfile,
4777 "missing '>' in `#include <FILENAME>'");
4778 break;
4779 }
4780 }
4781 return CPP_STRING;
4782 }
4783 /* else fall through */
4784 case '>':
4785 NEWLINE_FIX;
4786 c2 = PEEKC();
4787 if (c2 == '=')
4788 goto op2;
4789 if (c2 != c)
4790 goto randomchar;
4791 FORWARD(1);
4792 CPP_RESERVE(pfile, 4);
4793 CPP_PUTC(pfile, c);
4794 CPP_PUTC(pfile, c2);
4795 NEWLINE_FIX;
4796 c3 = PEEKC();
4797 if (c3 == '=')
4798 CPP_PUTC_Q(pfile, GETC());
4799 CPP_NUL_TERMINATE_Q(pfile);
4800 pfile->only_seen_white = 0;
4801 return CPP_OTHER;
4802
4803 case '@':
4804 if (CPP_BUFFER(pfile)->has_escapes)
4805 {
4806 c = GETC();
4807 // fix macro expansions starting with - losing the -
4808 if (c == '-')
4809 {
4810 CPP_PUTS(pfile, "-", 1);
4811 return CPP_OTHER;
4812 }
4813 // fix macro expansions starting with - losing the +
4814 else if (c == '+')
4815 {
4816 CPP_PUTS(pfile, "+", 1);
4817 return CPP_OTHER;
4818 }
4819 // fix macro expansions starting with - losing the .
4820 else if (c == '.')
4821 {
4822 CPP_PUTS(pfile, ".", 1);
4823 return CPP_OTHER;
4824 }
4825 else if (is_space[c])
4826 {
4827 CPP_RESERVE(pfile, 1);
4828 if (pfile->output_escapes)
4829 CPP_PUTC_Q(pfile, '@');
4830 return CPP_HSPACE;
4831 }
4832 }
4833 if (pfile->output_escapes)
4834 {
4835 CPP_PUTS(pfile, "@@", 2);
4836 return CPP_OTHER;
4837 }
4838 goto randomchar;
4839
4840 case '.':
4841 NEWLINE_FIX;
4842 c2 = PEEKC();
4843 if (isdigit(c2))
4844 {
4845 CPP_RESERVE(pfile, 2);
4846 CPP_PUTC_Q(pfile, '.');
4847 c = GETC();
4848 goto number;
4849 }
4850 /* FIXME - misses the case "..\\\n." */
4851 if (c2 == '.' && PEEKN(1) == '.')
4852 {
4853 CPP_RESERVE(pfile, 4);
4854 CPP_PUTC_Q(pfile, '.');
4855 CPP_PUTC_Q(pfile, '.');
4856 CPP_PUTC_Q(pfile, '.');
4857 FORWARD(2);
4858 CPP_NUL_TERMINATE_Q(pfile);
4859 pfile->only_seen_white = 0;
4860 return CPP_3DOTS;
4861 }
4862 goto randomchar;
4863
4864 op2:
4865 token = CPP_OTHER;
4866 pfile->only_seen_white = 0;
4867 op2any:
4868 CPP_RESERVE(pfile, 3);
4869 CPP_PUTC_Q(pfile, c);
4870 CPP_PUTC_Q(pfile, GETC());
4871 CPP_NUL_TERMINATE_Q(pfile);
4872 return token;
4873
4874 case 'L':
4875 NEWLINE_FIX;
4876 c2 = PEEKC();
4877 if ((c2 == '\'' || c2 == '\"'))
4878 {
4879 CPP_PUTC(pfile, c);
4880 c = GETC();
4881 goto string;
4882 }
4883 goto letter;
4884
4885 case '0':
4886 case '1':
4887 case '2':
4888 case '3':
4889 case '4':
4890 case '5':
4891 case '6':
4892 case '7':
4893 case '8':
4894 case '9':
4895 number:
4896 c2 = '.';
4897 for (;;)
4898 {
4899 CPP_RESERVE(pfile, 2);
4900 CPP_PUTC_Q(pfile, c);
4901 NEWLINE_FIX;
4902 c = PEEKC();
4903 if (c == EOF)
4904 break;
4905 if (!is_idchar[c] && c != '.'
4906 && ((c2 != 'e' && c2 != 'E') || (c != '+' && c != '-')))
4907 break;
4908 FORWARD(1);
4909 c2 = c;
4910 }
4911 CPP_NUL_TERMINATE_Q(pfile);
4912 pfile->only_seen_white = 0;
4913 return CPP_NUMBER;
4914 case 'b':
4915 case 'c':
4916 case 'd':
4917 case 'h':
4918 case 'o':
4919 case 'B':
4920 case 'C':
4921 case 'D':
4922 case 'H':
4923 case 'O':
4924 if (opts->chill && PEEKC() == '\'')
4925 {
4926 pfile->only_seen_white = 0;
4927 CPP_RESERVE(pfile, 2);
4928 CPP_PUTC_Q(pfile, c);
4929 CPP_PUTC_Q(pfile, '\'');
4930 FORWARD(1);
4931 for (;;)
4932 {
4933 c = GETC();
4934 if (c == EOF)
4935 goto chill_number_eof;
4936 if (!is_idchar[c])
4937 {
4938 if (c == '\\' && PEEKC() == '\n')
4939 {
4940 FORWARD(2);
4941 continue;
4942 }
4943 break;
4944 }
4945 CPP_PUTC(pfile, c);
4946 }
4947 if (c == '\'')
4948 {
4949 CPP_RESERVE(pfile, 2);
4950 CPP_PUTC_Q(pfile, c);
4951 CPP_NUL_TERMINATE_Q(pfile);
4952 return CPP_STRING;
4953 }
4954 else
4955 {
4956 FORWARD(-1);
4957 chill_number_eof:
4958 CPP_NUL_TERMINATE(pfile);
4959 return CPP_NUMBER;
4960 }
4961 }
4962 else
4963 goto letter;
4964 case '_':
4965 case 'a':
4966 case 'e':
4967 case 'f':
4968 case 'g':
4969 case 'i':
4970 case 'j':
4971 case 'k':
4972 case 'l':
4973 case 'm':
4974 case 'n':
4975 case 'p':
4976 case 'q':
4977 case 'r':
4978 case 's':
4979 case 't':
4980 case 'u':
4981 case 'v':
4982 case 'w':
4983 case 'x':
4984 case 'y':
4985 case 'z':
4986 case 'A':
4987 case 'E':
4988 case 'F':
4989 case 'G':
4990 case 'I':
4991 case 'J':
4992 case 'K':
4993 case 'M':
4994 case 'N':
4995 case 'P':
4996 case 'Q':
4997 case 'R':
4998 case 'S':
4999 case 'T':
5000 case 'U':
5001 case 'V':
5002 case 'W':
5003 case 'X':
5004 case 'Y':
5005 case 'Z':
5006 letter:
5007 {
5008 HASHNODE *hp;
5009 char *ident;
5010 int before_name_written = CPP_WRITTEN(pfile);
5011 int ident_len;
5012
5013 parse_name(pfile, c);
5014 pfile->only_seen_white = 0;
5015 if (pfile->no_macro_expand)
5016 return CPP_NAME;
5017 ident = (char *)pfile->token_buffer + before_name_written;
5018 ident_len = CPP_PWRITTEN(pfile) - (unsigned char *)ident;
5019 hp = cpp_lookup(ident, ident_len, -1);
5020 if (!hp)
5021 return CPP_NAME;
5022 if (hp->type == T_DISABLED)
5023 {
5024 if (pfile->output_escapes)
5025 { /* Return "@-IDENT", followed by '\0'. */
5026 int i;
5027
5028 CPP_RESERVE(pfile, 3);
5029 ident =
5030 (char *)pfile->token_buffer + before_name_written;
5031 CPP_ADJUST_WRITTEN(pfile, 2);
5032 for (i = ident_len; i >= 0; i--)
5033 ident[i + 2] = ident[i];
5034 ident[0] = '@';
5035 ident[1] = '-';
5036 }
5037 return CPP_NAME;
5038 }
5039 /* If macro wants an arglist, verify that a '(' follows.
5040 * first skip all whitespace, copying it to the output
5041 * after the macro name. Then, if there is no '(',
5042 * decide this is not a macro call and leave things that way. */
5043 if (hp->type == T_MACRO && hp->value.defn->nargs >= 0)
5044 {
5045 struct parse_marker macro_mark;
5046 int is_macro_call;
5047
5048 while (CPP_IS_MACRO_BUFFER(CPP_BUFFER(pfile)))
5049 {
5050 cpp_buffer *next_buf;
5051
5052 cpp_skip_hspace(pfile);
5053 if (PEEKC() != EOF)
5054 break;
5055 next_buf = CPP_PREV_BUFFER(CPP_BUFFER(pfile));
5056 (*CPP_BUFFER(pfile)->cleanup) (CPP_BUFFER(pfile),
5057 pfile);
5058 CPP_BUFFER(pfile) = next_buf;
5059 }
5060 parse_set_mark(&macro_mark, pfile);
5061 for (;;)
5062 {
5063 cpp_skip_hspace(pfile);
5064 c = PEEKC();
5065 is_macro_call = c == '(';
5066 if (c != '\n')
5067 break;
5068 FORWARD(1);
5069 }
5070 if (!is_macro_call)
5071 parse_goto_mark(&macro_mark, pfile);
5072 parse_clear_mark(&macro_mark);
5073 if (!is_macro_call)
5074 return CPP_NAME;
5075 }
5076 /* This is now known to be a macro call. */
5077
5078 /* it might not actually be a macro. */
5079 if (hp->type != T_MACRO)
5080 {
5081 int xbuf_len;
5082 unsigned char *xbuf;
5083
5084 CPP_SET_WRITTEN(pfile, before_name_written);
5085 special_symbol(hp, pfile);
5086 xbuf_len = CPP_WRITTEN(pfile) - before_name_written;
5087 xbuf = (unsigned char *)xmalloc(xbuf_len + 1);
5088 CPP_SET_WRITTEN(pfile, before_name_written);
5089 memcpy(xbuf, CPP_PWRITTEN(pfile), xbuf_len + 1);
5090 push_macro_expansion(pfile, xbuf, xbuf_len, hp);
5091 }
5092 else
5093 {
5094 /* Expand the macro, reading arguments as needed,
5095 * and push the expansion on the input stack. */
5096 macroexpand(pfile, hp);
5097 CPP_SET_WRITTEN(pfile, before_name_written);
5098 }
5099
5100 /* An extra "@ " is added to the end of a macro expansion
5101 * to prevent accidental token pasting. We prefer to avoid
5102 * unneeded extra spaces (for the sake of cpp-using tools like
5103 * imake). Here we remove the space if it is safe to do so. */
5104 if (pfile->buffer->rlimit - pfile->buffer->cur >= 3
5105 && pfile->buffer->rlimit[-2] == '@'
5106 && pfile->buffer->rlimit[-1] == ' ')
5107 {
5108 int c1 = pfile->buffer->rlimit[-3];
5109
5110 c2 = CPP_BUF_PEEK(CPP_PREV_BUFFER(CPP_BUFFER(pfile)));
5111
5112 if (c2 == EOF || !unsafe_chars(c1, c2))
5113 pfile->buffer->rlimit -= 2;
5114 }
5115 }
5116 goto get_next;
5117
5118 case ' ':
5119 case '\t':
5120 case '\v':
5121 case '\r':
5122 for (;;)
5123 {
5124 CPP_PUTC(pfile, c);
5125 c = PEEKC();
5126 if (c == EOF || !is_hor_space[c])
5127 break;
5128 FORWARD(1);
5129 }
5130 return CPP_HSPACE;
5131
5132 case '\\':
5133 c2 = PEEKC();
5134 if (c2 != '\n')
5135 goto randomchar;
5136 token = CPP_HSPACE;
5137 goto op2any;
5138
5139 case '\n':
5140 CPP_PUTC(pfile, c);
5141 if (pfile->only_seen_white == 0)
5142 pfile->only_seen_white = 1;
5143 pfile->lineno++;
5144 output_line_command(pfile, 1, same_file);
5145 return CPP_VSPACE;
5146
5147 case '(':
5148 token = CPP_LPAREN;
5149 goto char1;
5150 case ')':
5151 token = CPP_RPAREN;
5152 goto char1;
5153 case '{':
5154 token = CPP_LBRACE;
5155 goto char1;
5156 case '}':
5157 token = CPP_RBRACE;
5158 goto char1;
5159 case ',':
5160 token = CPP_COMMA;
5161 goto char1;
5162 case ';':
5163 token = CPP_SEMICOLON;
5164 goto char1;
5165
5166 randomchar:
5167 default:
5168 token = CPP_OTHER;
5169 char1:
5170 pfile->only_seen_white = 0;
5171 CPP_PUTC(pfile, c);
5172 return token;
5173 }
5174 }
5175}
5176
5177#if 0 /* Unused */
5178/* Like cpp_get_token, but skip spaces and comments. */
5179enum cpp_token
5180cpp_get_non_space_token(cpp_reader * pfile)
5181{
5182 int old_written = CPP_WRITTEN(pfile);
5183
5184 for (;;)
5185 {
5186 enum cpp_token token = cpp_get_token(pfile);
5187
5188 if (token != CPP_COMMENT && token != CPP_POP
5189 && token != CPP_HSPACE && token != CPP_VSPACE)
5190 return token;
5191 CPP_SET_WRITTEN(pfile, old_written);
5192 }
5193}
5194#endif
5195
5196/* Parse an identifier starting with C. */
5197
5198int
5199parse_name(cpp_reader * pfile, int c)
5200{
5201 for (;;)
5202 {
5203 if (!is_idchar[c])
5204 {
5205 if (c == '\\' && PEEKC() == '\n')
5206 {
5207 FORWARD(2);
5208 continue;
5209 }
5210 FORWARD(-1);
5211 break;
5212 }
5213 CPP_RESERVE(pfile, 2); /* One more for final NUL. */
5214 CPP_PUTC_Q(pfile, c);
5215 c = GETC();
5216 if (c == EOF)
5217 break;
5218 }
5219 CPP_NUL_TERMINATE_Q(pfile);
5220 return 1;
5221}
5222
5223/* Maintain and search list of included files, for #import. */
5224
5225/* Hash a file name for import_hash_table. */
5226
5227static int
5228import_hash(char *f)
5229{
5230 int val = 0;
5231
5232 while (*f)
5233 val += *f++;
5234 return (val % IMPORT_HASH_SIZE);
5235}
5236
5237/* Search for file FILENAME in import_hash_table.
5238 * Return -2 if found, either a matching name or a matching inode.
5239 * Otherwise, open the file and return a file descriptor if successful
5240 * or -1 if unsuccessful. */
5241
5242static int
5243lookup_import(cpp_reader * pfile, char *filename, file_name_list * searchptr)
5244{
5245 struct import_file *i;
5246 int h;
5247 int hashval;
5248 struct stat sb;
5249 int fd;
5250
5251 hashval = import_hash(filename);
5252
5253 /* Attempt to find file in list of already included files */
5254 i = pfile->import_hash_table[hashval];
5255
5256 while (i)
5257 {
5258 if (!strcmp(filename, i->name))
5259 return -2; /* return found */
5260 i = i->next;
5261 }
5262 /* Open it and try a match on inode/dev */
5263 fd = open_include_file(pfile, filename, searchptr);
5264 if (fd < 0)
5265 return fd;
5266 fstat(fd, &sb);
5267 for (h = 0; h < IMPORT_HASH_SIZE; h++)
5268 {
5269 i = pfile->import_hash_table[h];
5270 while (i)
5271 {
5272 /* Compare the inode and the device.
5273 * Supposedly on some systems the inode is not a scalar. */
5274 if (!memcmp
5275 ((char *)&i->inode, (char *)&sb.st_ino, sizeof(sb.st_ino))
5276 && i->dev == sb.st_dev)
5277 {
5278 close(fd);
5279 return -2; /* return found */
5280 }
5281 i = i->next;
5282 }
5283 }
5284 return fd; /* Not found, return open file */
5285}
5286
5287/* Add the file FNAME, open on descriptor FD, to import_hash_table. */
5288
5289static void
5290add_import(cpp_reader * pfile, int fd, char *fname)
5291{
5292 struct import_file *i;
5293 int hashval;
5294 struct stat sb;
5295
5296 hashval = import_hash(fname);
5297 fstat(fd, &sb);
5298 i = (struct import_file *)xmalloc(sizeof(struct import_file));
5299
5300 i->name = (char *)xmalloc(strlen(fname) + 1);
5301 strcpy(i->name, fname);
5302 memcpy((char *)&i->inode, (char *)&sb.st_ino, sizeof(sb.st_ino));
5303 i->dev = sb.st_dev;
5304 i->next = pfile->import_hash_table[hashval];
5305 pfile->import_hash_table[hashval] = i;
5306}
5307
5308/* The file_name_map structure holds a mapping of file names for a
5309 * particular directory. This mapping is read from the file named
5310 * FILE_NAME_MAP_FILE in that directory. Such a file can be used to
5311 * map filenames on a file system with severe filename restrictions,
5312 * such as DOS. The format of the file name map file is just a series
5313 * of lines with two tokens on each line. The first token is the name
5314 * to map, and the second token is the actual name to use. */
5315
5316struct file_name_map {
5317 struct file_name_map *map_next;
5318 char *map_from;
5319 char *map_to;
5320};
5321
5322#if USE_FILE_NAME_MAPS
5323
5324#define FILE_NAME_MAP_FILE "header.gcc"
5325
5326/* Read a space delimited string of unlimited length from a stdio
5327 * file. */
5328
5329static char *
5330read_filename_string(int ch, FILE * f)
5331{
5332 char *alloc, *set;
5333 int len;
5334
5335 len = 20;
5336 set = alloc = (char *)xmalloc(len + 1);
5337 if (!is_space[ch])
5338 {
5339 *set++ = ch;
5340 while ((ch = getc(f)) != EOF && !is_space[ch])
5341 {
5342 if (set - alloc == len)
5343 {
5344 len *= 2;
5345 alloc = (char *)xrealloc(alloc, len + 1);
5346 set = alloc + len / 2;
5347 }
5348 *set++ = ch;
5349 }
5350 }
5351 *set = '\0';
5352 ungetc(ch, f);
5353 return alloc;
5354}
5355
5356/* This structure holds a linked list of file name maps, one per directory. */
5357struct file_name_map_list {
5358 struct file_name_map_list *map_list_next;
5359 char *map_list_name;
5360 struct file_name_map *map_list_map;
5361};
5362
5363/* Read the file name map file for DIRNAME. */
5364
5365static struct file_name_map *
5366read_name_map(cpp_reader * pfile, const char *dirname)
5367{
5368 struct file_name_map_list *map_list_ptr;
5369 char *name;
5370 FILE *f;
5371
5372 for (map_list_ptr = CPP_OPTIONS(pfile)->map_list; map_list_ptr;
5373 map_list_ptr = map_list_ptr->map_list_next)
5374 if (!strcmp(map_list_ptr->map_list_name, dirname))
5375 return map_list_ptr->map_list_map;
5376
5377 map_list_ptr =
5378 ((struct file_name_map_list *)xmalloc(sizeof(struct file_name_map_list)));
5379
5380 map_list_ptr->map_list_name = savestring(dirname);
5381 map_list_ptr->map_list_map = NULL;
5382
5383 name = (char *)alloca(strlen(dirname) + strlen(FILE_NAME_MAP_FILE) + 2);
5384 strcpy(name, dirname);
5385 if (*dirname)
5386 strcat(name, "/");
5387 strcat(name, FILE_NAME_MAP_FILE);
5388#ifndef __EMX__
5389 f = fopen(name, "rb");
5390#else
5391 f = fopen(name, "rtb");
5392#endif
5393 if (!f)
5394 map_list_ptr->map_list_map = NULL;
5395 else
5396 {
5397 int ch;
5398 int dirlen = strlen(dirname);
5399
5400 while ((ch = getc(f)) != EOF)
5401 {
5402 char *from, *to;
5403 struct file_name_map *ptr;
5404
5405 if (is_space[ch])
5406 continue;
5407 from = read_filename_string(ch, f);
5408 while ((ch = getc(f)) != EOF && is_hor_space[ch]);
5409 to = read_filename_string(ch, f);
5410
5411 ptr =
5412 ((struct file_name_map *)xmalloc(sizeof(struct file_name_map)));
5413
5414 ptr->map_from = from;
5415
5416 /* Make the real filename absolute. */
5417 if (*to == '/')
5418 ptr->map_to = to;
5419 else
5420 {
5421 ptr->map_to = (char *)xmalloc(dirlen + strlen(to) + 2);
5422 strcpy(ptr->map_to, dirname);
5423 ptr->map_to[dirlen] = '/';
5424 strcpy(ptr->map_to + dirlen + 1, to);
5425 free(to);
5426 }
5427
5428 ptr->map_next = map_list_ptr->map_list_map;
5429 map_list_ptr->map_list_map = ptr;
5430
5431 while ((ch = getc(f)) != '\n')
5432 if (ch == EOF)
5433 break;
5434 }
5435 fclose(f);
5436 }
5437
5438 map_list_ptr->map_list_next = CPP_OPTIONS(pfile)->map_list;
5439 CPP_OPTIONS(pfile)->map_list = map_list_ptr;
5440
5441 return map_list_ptr->map_list_map;
5442}
5443
5444/* Try to open include file FILENAME. SEARCHPTR is the directory
5445 * being tried from the include file search path. This function maps
5446 * filenames on file systems based on information read by
5447 * read_name_map. */
5448
5449static int
5450open_include_file(cpp_reader * pfile, char *filename,
5451 file_name_list * searchptr)
5452{
5453 struct file_name_map *map;
5454 const char *from;
5455 const char *p, *dir;
5456
5457 if (searchptr && !searchptr->got_name_map)
5458 {
5459 searchptr->name_map = read_name_map(pfile,
5460 searchptr->fname
5461 ? searchptr->fname : ".");
5462 searchptr->got_name_map = 1;
5463 }
5464 /* First check the mapping for the directory we are using. */
5465 if (searchptr && searchptr->name_map)
5466 {
5467 from = filename;
5468 if (searchptr->fname)
5469 from += strlen(searchptr->fname) + 1;
5470 for (map = searchptr->name_map; map; map = map->map_next)
5471 {
5472 if (!strcmp(map->map_from, from))
5473 {
5474 /* Found a match. */
5475 return open(map->map_to, O_RDONLY | O_BINARY, 0666);
5476 }
5477 }
5478 }
5479 /* Try to find a mapping file for the particular directory we are
5480 * looking in. Thus #include <sys/types.h> will look up sys/types.h
5481 * in /usr/include/header.gcc and look up types.h in
5482 * /usr/include/sys/header.gcc. */
5483 p = strrchr(filename, '/');
5484 if (!p)
5485 p = filename;
5486 if (searchptr
5487 && searchptr->fname
5488 && strlen(searchptr->fname) == (unsigned)(p - filename)
5489 && !strncmp(searchptr->fname, filename, p - filename))
5490 {
5491 /* FILENAME is in SEARCHPTR, which we've already checked. */
5492 return open(filename, O_RDONLY | O_BINARY, 0666);
5493 }
5494 if (p == filename)
5495 {
5496 dir = ".";
5497 from = filename;
5498 }
5499 else
5500 {
5501 char *s;
5502
5503 s = (char *)alloca(p - filename + 1);
5504 memcpy(s, filename, p - filename);
5505 s[p - filename] = '\0';
5506 from = p + 1;
5507 dir = s;
5508 }
5509 for (map = read_name_map(pfile, dir); map; map = map->map_next)
5510 if (!strcmp(map->map_from, from))
5511 return open(map->map_to, O_RDONLY | O_BINARY, 0666);
5512
5513 return open(filename, O_RDONLY | O_BINARY, 0666);
5514}
5515
5516#else
5517
5518static int
5519open_include_file(cpp_reader * pfile __UNUSED__, char *filename,
5520 file_name_list * searchptr __UNUSED__)
5521{
5522 return open(filename, O_RDONLY | O_BINARY, 0666);
5523}
5524
5525#endif /* USE_FILE_NAME_MAPS */
5526
5527static int
5528dos2unix(cpp_buffer *fp, int length)
5529{
5530 unsigned char *tbuf;
5531 int nlen = 0, i;
5532
5533 tbuf = xmalloc(length + 4);
5534 if (!tbuf) return length;
5535 for (i = 0; i < length; i++)
5536 {
5537 if ((fp->buf[i] == '\r') &&
5538 (fp->buf[i + 1] == '\n'))
5539 {
5540 // skip \r in \r\n
5541 continue;
5542 }
5543 tbuf[nlen] = fp->buf[i];
5544 nlen++;
5545 }
5546 tbuf[nlen] = 0;
5547
5548 free(fp->buf);
5549 fp->buf = tbuf;
5550 return nlen;
5551}
5552
5553/* Process the contents of include file FNAME, already open on descriptor F,
5554 * with output to OP.
5555 * SYSTEM_HEADER_P is 1 if this file resides in any one of the known
5556 * "system" include directories (as decided by the `is_system_include'
5557 * function above).
5558 * DIRPTR is the link in the dir path through which this file was found,
5559 * or 0 if the file name was absolute or via the current directory.
5560 * Return 1 on success, 0 on failure.
5561 *
5562 * The caller is responsible for the cpp_push_buffer. */
5563
5564static int
5565finclude(cpp_reader * pfile, int f, const char *fname, int system_header_p,
5566 file_name_list * dirptr)
5567{
5568 int st_mode;
5569 long st_size;
5570 long i;
5571 int length;
5572 cpp_buffer *fp; /* For input stack frame */
5573
5574 if (file_size_and_mode(f, &st_mode, &st_size) < 0)
5575 {
5576 cpp_perror_with_name(pfile, fname);
5577 close(f);
5578 cpp_pop_buffer(pfile);
5579 return 0;
5580 }
5581 fp = CPP_BUFFER(pfile);
5582 fp->nominal_fname = fp->fname = fname;
5583 fp->dir = dirptr;
5584 fp->system_header_p = system_header_p;
5585 fp->lineno = 1;
5586 fp->colno = 1;
5587 fp->cleanup = file_cleanup;
5588
5589 if (S_ISREG(st_mode))
5590 {
5591 fp->buf = (unsigned char *)xmalloc(st_size + 2);
5592 /* Read the file contents, knowing that st_size is an upper bound
5593 * on the number of bytes we can read. */
5594 length = safe_read(f, (char *)fp->buf, st_size);
5595 length = dos2unix(fp, length);
5596
5597 fp->alimit = fp->buf + st_size + 2;
5598 fp->cur = fp->buf;
5599 fp->rlimit = fp->buf + length;
5600 if (length < 0)
5601 goto nope;
5602 }
5603 else if (S_ISDIR(st_mode))
5604 {
5605 cpp_error(pfile, "directory `%s' specified in #include", fname);
5606 close(f);
5607 return 0;
5608 }
5609 else
5610 {
5611 /* Cannot count its file size before reading.
5612 * First read the entire file into heap and
5613 * copy them into buffer on stack. */
5614
5615 int bsize = 2000;
5616
5617 st_size = 0;
5618 fp->buf = (unsigned char *)xmalloc(bsize + 2);
5619
5620 for (;;)
5621 {
5622 i = safe_read(f, (char *)(fp->buf + st_size), bsize - st_size);
5623 if (i < 0)
5624 goto nope; /* error! */
5625 st_size += i;
5626 if (st_size != bsize)
5627 break; /* End of file */
5628 bsize *= 2;
5629 fp->buf = (unsigned char *)xrealloc(fp->buf, bsize + 2);
5630 }
5631 length = st_size;
5632 length = dos2unix(fp, length);
5633 }
5634
5635 if ((length > 0 && fp->buf[length - 1] != '\n')
5636 /* Backslash-newline at end is not good enough. */
5637 || (length > 1 && fp->buf[length - 2] == '\\'))
5638 {
5639 fp->buf[length++] = '\n';
5640 }
5641 fp->buf[length] = '\0';
5642
5643 fp->rlimit = fp->buf + length;
5644
5645 /* Close descriptor now, so nesting does not use lots of descriptors. */
5646 close(f);
5647
5648 /* Must do this before calling trigraph_pcp, so that the correct file name
5649 * will be printed in warning messages. */
5650
5651 pfile->input_stack_listing_current = 0;
5652
5653 return 1;
5654
5655 nope:
5656
5657 cpp_perror_with_name(pfile, fname);
5658 close(f);
5659 free(fp->buf);
5660 return 1;
5661}
5662
5663int
5664push_parse_file(cpp_reader * pfile, const char *fname)
5665{
5666 struct cpp_options *opts = CPP_OPTIONS(pfile);
5667 struct cpp_pending *pend;
5668 char *p;
5669 int f;
5670 cpp_buffer *fp;
5671
5672 /* The code looks at the defaults through this pointer, rather than through
5673 * the constant structure above. This pointer gets changed if an environment
5674 * variable specifies other defaults. */
5675 struct default_include *include_defaults = include_defaults_array;
5676
5677 /* Add dirs from CPATH after dirs from -I. */
5678 /* There seems to be confusion about what CPATH should do,
5679 * so for the moment it is not documented. */
5680 /* Some people say that CPATH should replace the standard include dirs,
5681 * but that seems pointless: it comes before them, so it overrides them
5682 * anyway. */
5683 p = (char *)getenv("CPATH");
5684 if (p && !opts->no_standard_includes)
5685 path_include(pfile, p);
5686
5687 /* Now that dollars_in_ident is known, initialize is_idchar. */
5688 initialize_char_syntax(opts);
5689
5690 /* Do partial setup of input buffer for the sake of generating
5691 * early #line directives (when -g is in effect). */
5692 fp = cpp_push_buffer(pfile, NULL, 0);
5693 if (!opts->in_fname)
5694 opts->in_fname = "";
5695 fp->nominal_fname = fp->fname = opts->in_fname;
5696 fp->lineno = 0;
5697
5698 /* Install __LINE__, etc. Must follow initialize_char_syntax
5699 * and option processing. */
5700 initialize_builtins(pfile);
5701
5702 /* Do standard #defines and assertions
5703 * that identify system and machine type. */
5704
5705 if (!opts->inhibit_predefs)
5706 {
5707 p = (char *)alloca(strlen(predefs) + 1);
5708
5709 strcpy(p, predefs);
5710 while (*p)
5711 {
5712 char *q;
5713
5714 while (*p == ' ' || *p == '\t')
5715 p++;
5716 /* Handle -D options. */
5717 if (p[0] == '-' && p[1] == 'D')
5718 {
5719 q = &p[2];
5720 while (*p && *p != ' ' && *p != '\t')
5721 p++;
5722 if (*p != 0)
5723 *p++ = 0;
5724 if (opts->debug_output)
5725 output_line_command(pfile, 0, same_file);
5726 cpp_define(pfile, (unsigned char *)q);
5727 while (*p == ' ' || *p == '\t')
5728 p++;
5729 }
5730 else if (p[0] == '-' && p[1] == 'A')
5731 {
5732 /* Handle -A options (assertions). */
5733 char *assertion;
5734 char *past_name;
5735 char *value;
5736 char *past_value;
5737 char *termination;
5738 int save_char;
5739
5740 assertion = &p[2];
5741 past_name = assertion;
5742 /* Locate end of name. */
5743 while (*past_name && *past_name != ' '
5744 && *past_name != '\t' && *past_name != '(')
5745 past_name++;
5746 /* Locate `(' at start of value. */
5747 value = past_name;
5748 while (*value && (*value == ' ' || *value == '\t'))
5749 value++;
5750 if (*value++ != '(')
5751 abort();
5752 while (*value && (*value == ' ' || *value == '\t'))
5753 value++;
5754 past_value = value;
5755 /* Locate end of value. */
5756 while (*past_value && *past_value != ' '
5757 && *past_value != '\t' && *past_value != ')')
5758 past_value++;
5759 termination = past_value;
5760 while (*termination
5761 && (*termination == ' ' || *termination == '\t'))
5762 termination++;
5763 if (*termination++ != ')')
5764 abort();
5765 if (*termination && *termination != ' '
5766 && *termination != '\t')
5767 abort();
5768 /* Temporarily null-terminate the value. */
5769 save_char = *termination;
5770 *termination = '\0';
5771 /* Install the assertion. */
5772 make_assertion(pfile, "-A", assertion);
5773 *termination = (char)save_char;
5774 p = termination;
5775 while (*p == ' ' || *p == '\t')
5776 p++;
5777 }
5778 else
5779 {
5780 abort();
5781 }
5782 }
5783 }
5784 /* Now handle the command line options. */
5785
5786 /* Do -U's, -D's and -A's in the order they were seen. */
5787 /* First reverse the list. */
5788 opts->pending = nreverse_pending(opts->pending);
5789
5790 for (pend = opts->pending; pend; pend = pend->next)
5791 {
5792 if (pend->cmd && pend->cmd[0] == '-')
5793 {
5794 switch (pend->cmd[1])
5795 {
5796 case 'U':
5797 if (opts->debug_output)
5798 output_line_command(pfile, 0, same_file);
5799 do_undef(pfile, NULL, (unsigned char *)pend->arg,
5800 (unsigned char *)pend->arg + strlen(pend->arg));
5801 break;
5802 case 'D':
5803 if (opts->debug_output)
5804 output_line_command(pfile, 0, same_file);
5805 cpp_define(pfile, (unsigned char *)pend->arg);
5806 break;
5807 case 'A':
5808 make_assertion(pfile, "-A", pend->arg);
5809 break;
5810 }
5811 }
5812 }
5813
5814 opts->done_initializing = 1;
5815
5816 { /* read the appropriate environment variable and if it exists
5817 * replace include_defaults with the listed path. */
5818 char *epath = 0;
5819
5820 switch ((opts->objc << 1) + opts->cplusplus)
5821 {
5822 case 0:
5823 epath = getenv("C_INCLUDE_PATH");
5824 break;
5825 case 1:
5826 epath = getenv("CPLUS_INCLUDE_PATH");
5827 break;
5828 case 2:
5829 epath = getenv("OBJC_INCLUDE_PATH");
5830 break;
5831 case 3:
5832 epath = getenv("OBJCPLUS_INCLUDE_PATH");
5833 break;
5834 }
5835 /* If the environment var for this language is set,
5836 * add to the default list of include directories. */
5837 if (epath)
5838 {
5839 char *nstore = (char *)alloca(strlen(epath) + 2);
5840 int num_dirs;
5841 char *startp, *endp;
5842
5843 for (num_dirs = 1, startp = epath; *startp; startp++)
5844 if (*startp == PATH_SEPARATOR)
5845 num_dirs++;
5846 include_defaults
5847 = (struct default_include *)xmalloc((num_dirs
5848 *
5849 sizeof(struct
5850 default_include)) +
5851 sizeof
5852 (include_defaults_array));
5853
5854 startp = endp = epath;
5855 num_dirs = 0;
5856 while (1)
5857 {
5858 /* Handle cases like c:/usr/lib:d:/gcc/lib */
5859 if ((*endp == PATH_SEPARATOR) || *endp == 0)
5860 {
5861 strncpy(nstore, startp, endp - startp);
5862 if (endp == startp)
5863 strcpy(nstore, ".");
5864 else
5865 nstore[endp - startp] = '\0';
5866
5867 include_defaults[num_dirs].fname = savestring(nstore);
5868 include_defaults[num_dirs].cplusplus = opts->cplusplus;
5869 include_defaults[num_dirs].cxx_aware = 1;
5870 num_dirs++;
5871 if (*endp == '\0')
5872 break;
5873 endp = startp = endp + 1;
5874 }
5875 else
5876 endp++;
5877 }
5878 /* Put the usual defaults back in at the end. */
5879 memcpy((char *)&include_defaults[num_dirs],
5880 (char *)include_defaults_array,
5881 sizeof(include_defaults_array));
5882 }
5883 }
5884
5885 append_include_chain(pfile, opts->before_system, opts->last_before_system);
5886 opts->first_system_include = opts->before_system;
5887
5888 /* Unless -fnostdinc,
5889 * tack on the standard include file dirs to the specified list */
5890 if (!opts->no_standard_includes)
5891 {
5892 struct default_include *di = include_defaults;
5893 char *specd_prefix = opts->include_prefix;
5894 char *default_prefix = savestring(GCC_INCLUDE_DIR);
5895 int default_len = 0;
5896
5897 /* Remove the `include' from /usr/local/lib/gcc.../include. */
5898 if (!strcmp(default_prefix + strlen(default_prefix) - 8, "/include"))
5899 {
5900 default_len = strlen(default_prefix) - 7;
5901 default_prefix[default_len] = 0;
5902 }
5903 /* Search "translated" versions of GNU directories.
5904 * These have /usr/local/lib/gcc... replaced by specd_prefix. */
5905 if (specd_prefix && default_len != 0)
5906 for (di = include_defaults; di->fname; di++)
5907 {
5908 /* Some standard dirs are only for C++. */
5909 if (!di->cplusplus
5910 || (opts->cplusplus
5911 && !opts->no_standard_cplusplus_includes))
5912 {
5913 /* Does this dir start with the prefix? */
5914 if (!strncmp(di->fname, default_prefix, default_len))
5915 {
5916 /* Yes; change prefix and add to search list. */
5917 file_name_list *new_
5918 =
5919 (file_name_list *) xmalloc(sizeof(file_name_list));
5920 int this_len =
5921 strlen(specd_prefix) + strlen(di->fname) -
5922 default_len;
5923 char *str =
5924 (char *)xmalloc(this_len + 1);
5925
5926 strcpy(str, specd_prefix);
5927 strcat(str, di->fname + default_len);
5928 new_->fname = str;
5929 new_->control_macro = 0;
5930 new_->c_system_include_path = !di->cxx_aware;
5931 new_->got_name_map = 0;
5932 append_include_chain(pfile, new_, new_);
5933 if (!opts->first_system_include)
5934 opts->first_system_include = new_;
5935 }
5936 }
5937 }
5938 /* Search ordinary names for GNU include directories. */
5939 for (di = include_defaults; di->fname; di++)
5940 {
5941 /* Some standard dirs are only for C++. */
5942 if (!di->cplusplus
5943 || (opts->cplusplus && !opts->no_standard_cplusplus_includes))
5944 {
5945 file_name_list *new_
5946 = (file_name_list *) xmalloc(sizeof(file_name_list));
5947
5948 new_->control_macro = 0;
5949 new_->c_system_include_path = !di->cxx_aware;
5950 new_->fname = (char *)di->fname;
5951 new_->got_name_map = 0;
5952 append_include_chain(pfile, new_, new_);
5953 if (!opts->first_system_include)
5954 opts->first_system_include = new_;
5955 }
5956 }
5957 }
5958 /* Tack the after_include chain at the end of the include chain. */
5959 append_include_chain(pfile, opts->after_include, opts->last_after_include);
5960 if (!opts->first_system_include)
5961 opts->first_system_include = opts->after_include;
5962
5963 /* With -v, print the list of dirs to search. */
5964 if (opts->verbose)
5965 {
5966 file_name_list *fl;
5967
5968 fprintf(stderr, "#include \"...\" search starts here:\n");
5969 for (fl = opts->include; fl; fl = fl->next)
5970 {
5971 if (fl == opts->first_bracket_include)
5972 fprintf(stderr, "#include <...> search starts here:\n");
5973 fprintf(stderr, " %s\n", fl->fname);
5974 }
5975 fprintf(stderr, "End of search list.\n");
5976 }
5977 /* Scan the -imacros files before the main input.
5978 * Much like #including them, but with no_output set
5979 * so that only their macro definitions matter. */
5980
5981 opts->no_output++;
5982 pfile->no_record_file++;
5983 for (pend = opts->pending; pend; pend = pend->next)
5984 {
5985 if (pend->cmd && strcmp(pend->cmd, "-imacros") == 0)
5986 {
5987 int fd = open(pend->arg, O_RDONLY | O_BINARY, 0666);
5988
5989 if (fd < 0)
5990 {
5991 cpp_perror_with_name(pfile, pend->arg);
5992 return FATAL_EXIT_CODE;
5993 }
5994 cpp_push_buffer(pfile, NULL, 0);
5995 finclude(pfile, fd, pend->arg, 0, NULL);
5996 cpp_scan_buffer(pfile);
5997 }
5998 }
5999 opts->no_output--;
6000 pfile->no_record_file--;
6001
6002 /* Copy the entire contents of the main input file into
6003 * the stacked input buffer previously allocated for it. */
6004 if (!fname || *fname == 0)
6005 {
6006 fname = "";
6007 f = 0;
6008 }
6009 else if ((f = open(fname, O_RDONLY | O_BINARY, 0666)) < 0)
6010 cpp_pfatal_with_name(pfile, fname);
6011
6012 /* -MG doesn't select the form of output and must be specified with one of
6013 * -M or -MM. -MG doesn't make sense with -MD or -MMD since they don't
6014 * inhibit compilation. */
6015 if (opts->print_deps_missing_files
6016 && (opts->print_deps == 0 || !opts->no_output))
6017 cpp_fatal("-MG must be specified with one of -M or -MM");
6018
6019 /* Either of two environment variables can specify output of deps.
6020 * Its value is either "OUTPUT_FILE" or "OUTPUT_FILE DEPS_TARGET",
6021 * where OUTPUT_FILE is the file to write deps info to
6022 * and DEPS_TARGET is the target to mention in the deps. */
6023
6024 if (opts->print_deps == 0
6025 && (getenv("SUNPRO_DEPENDENCIES") != 0
6026 || getenv("DEPENDENCIES_OUTPUT") != 0))
6027 {
6028 char *spec = getenv("DEPENDENCIES_OUTPUT");
6029 char *s;
6030 char *output_file;
6031
6032 if (!spec)
6033 {
6034 spec = getenv("SUNPRO_DEPENDENCIES");
6035 opts->print_deps = 2;
6036 }
6037 else
6038 opts->print_deps = 1;
6039
6040 s = spec;
6041 /* Find the space before the DEPS_TARGET, if there is one. */
6042 /* This should use index. (mrs) */
6043 while (*s != 0 && *s != ' ')
6044 s++;
6045 if (*s != 0)
6046 {
6047 opts->deps_target = s + 1;
6048 output_file = (char *)xmalloc(s - spec + 1);
6049 memcpy(output_file, spec, s - spec);
6050 output_file[s - spec] = 0;
6051 }
6052 else
6053 {
6054 opts->deps_target = 0;
6055 output_file = spec;
6056 }
6057
6058 opts->deps_file = output_file;
6059 opts->print_deps_append = 1;
6060 }
6061 /* For -M, print the expected object file name
6062 * as the target of this Make-rule. */
6063 if (opts->print_deps)
6064 {
6065 pfile->deps_allocated_size = 200;
6066 pfile->deps_buffer = (char *)xmalloc(pfile->deps_allocated_size);
6067 pfile->deps_buffer[0] = 0;
6068 pfile->deps_size = 0;
6069 pfile->deps_column = 0;
6070
6071 if (opts->deps_target)
6072 deps_output(pfile, opts->deps_target, ':');
6073 else if (*opts->in_fname == 0)
6074 deps_output(pfile, "-", ':');
6075 else
6076 {
6077 char *q;
6078 int len;
6079
6080 /* Discard all directory prefixes from filename. */
6081 if ((q = (char *)strrchr(opts->in_fname, '/'))
6082#ifdef DIR_SEPARATOR
6083 && (q = strrchr(opts->in_fname, DIR_SEPARATOR))
6084#endif
6085 )
6086 ++q;
6087 else
6088 q = (char *)opts->in_fname;
6089
6090 /* Copy remainder to mungable area. */
6091 p = (char *)alloca(strlen(q) + 8);
6092 strcpy(p, q);
6093
6094 /* Output P, but remove known suffixes. */
6095 len = strlen(p);
6096 q = p + len;
6097 if (len >= 2 && p[len - 2] == '.' && strchr("cCsSm", p[len - 1]))
6098 q = p + (len - 2);
6099 else if (len >= 3
6100 && p[len - 3] == '.'
6101 && p[len - 2] == 'c' && p[len - 1] == 'c')
6102 q = p + (len - 3);
6103 else if (len >= 4
6104 && p[len - 4] == '.'
6105 && p[len - 3] == 'c'
6106 && p[len - 2] == 'x' && p[len - 1] == 'x')
6107 q = p + (len - 4);
6108 else if (len >= 4
6109 && p[len - 4] == '.'
6110 && p[len - 3] == 'c'
6111 && p[len - 2] == 'p' && p[len - 1] == 'p')
6112 q = p + (len - 4);
6113
6114 /* Supply our own suffix. */
6115 strcpy(q, ".o");
6116
6117 deps_output(pfile, p, ':');
6118 deps_output(pfile, opts->in_fname, ' ');
6119 }
6120 }
6121
6122 /* Scan the -include files before the main input.
6123 * We push these in reverse order, so that the first one is handled first. */
6124
6125 pfile->no_record_file++;
6126 opts->pending = nreverse_pending(opts->pending);
6127 for (pend = opts->pending; pend; pend = pend->next)
6128 {
6129 if (pend->cmd && strcmp(pend->cmd, "-include") == 0)
6130 {
6131 int fd = open(pend->arg, O_RDONLY | O_BINARY, 0666);
6132
6133 if (fd < 0)
6134 {
6135 cpp_perror_with_name(pfile, pend->arg);
6136 return FATAL_EXIT_CODE;
6137 }
6138 cpp_push_buffer(pfile, NULL, 0);
6139 finclude(pfile, fd, pend->arg, 0, NULL);
6140 }
6141 }
6142 pfile->no_record_file--;
6143
6144 /* Free the pending list. */
6145 for (pend = opts->pending; pend;)
6146 {
6147 struct cpp_pending *next = pend->next;
6148
6149 free(pend);
6150 pend = next;
6151 }
6152 opts->pending = NULL;
6153
6154 if (finclude(pfile, f, fname, 0, NULL))
6155 output_line_command(pfile, 0, same_file);
6156 return SUCCESS_EXIT_CODE;
6157}
6158
6159void
6160init_parse_file(cpp_reader * pfile)
6161{
6162 memset((char *)pfile, 0, sizeof(cpp_reader));
6163 pfile->get_token = cpp_get_token;
6164
6165 pfile->token_buffer_size = 200;
6166 pfile->token_buffer = (unsigned char *)xmalloc(pfile->token_buffer_size);
6167 CPP_SET_WRITTEN(pfile, 0);
6168
6169 pfile->system_include_depth = 0;
6170 pfile->dont_repeat_files = 0;
6171 pfile->all_include_files = 0;
6172 pfile->max_include_len = 0;
6173 pfile->timebuf = NULL;
6174 pfile->only_seen_white = 1;
6175 pfile->buffer = CPP_NULL_BUFFER(pfile);
6176}
6177
6178static struct cpp_pending *
6179nreverse_pending(struct cpp_pending *list)
6180{
6181 struct cpp_pending *prev = 0, *next, *pend;
6182
6183 for (pend = list; pend; pend = next)
6184 {
6185 next = pend->next;
6186 pend->next = prev;
6187 prev = pend;
6188 }
6189 return prev;
6190}
6191
6192static void
6193push_pending(cpp_reader * pfile, const char *cmd, const char *arg)
6194{
6195 struct cpp_pending *pend
6196 = (struct cpp_pending *)xmalloc(sizeof(struct cpp_pending));
6197
6198 pend->cmd = cmd;
6199 pend->arg = arg;
6200 pend->next = CPP_OPTIONS(pfile)->pending;
6201 CPP_OPTIONS(pfile)->pending = pend;
6202}
6203
6204/* Handle command-line options in (argc, argv).
6205 * Can be called multiple times, to handle multiple sets of options.
6206 * Returns if an unrecognized option is seen.
6207 * Returns number of handled arguments. */
6208
6209int
6210cpp_handle_options(cpp_reader * pfile, int argc, char **argv)
6211{
6212 int i;
6213 struct cpp_options *opts = CPP_OPTIONS(pfile);
6214
6215 for (i = 0; i < argc; i++)
6216 {
6217 if (argv[i][0] != '-')
6218 {
6219 if (opts->out_fname)
6220 cpp_fatal("Usage: %s [switches] input output", argv[0]);
6221 else if (opts->in_fname)
6222 opts->out_fname = argv[i];
6223 else
6224 opts->in_fname = argv[i];
6225 }
6226 else
6227 {
6228 switch (argv[i][1])
6229 {
6230
6231 case 'i':
6232 if (!strcmp(argv[i], "-include")
6233 || !strcmp(argv[i], "-imacros"))
6234 {
6235 if (i + 1 == argc)
6236 cpp_fatal("Filename missing after `%s' option",
6237 argv[i]);
6238 else
6239 push_pending(pfile, argv[i], argv[i + 1]), i++;
6240 }
6241 if (!strcmp(argv[i], "-iprefix"))
6242 {
6243 if (i + 1 == argc)
6244 cpp_fatal("Filename missing after `-iprefix' option");
6245 else
6246 opts->include_prefix = argv[++i];
6247 }
6248 if (!strcmp(argv[i], "-ifoutput"))
6249 {
6250 opts->output_conditionals = 1;
6251 }
6252 if (!strcmp(argv[i], "-isystem"))
6253 {
6254 file_name_list *dirtmp;
6255
6256 if (i + 1 == argc)
6257 cpp_fatal("Filename missing after `-isystem' option");
6258
6259 dirtmp =
6260 (file_name_list *) xmalloc(sizeof(file_name_list));
6261
6262 dirtmp->next = 0;
6263 dirtmp->control_macro = 0;
6264 dirtmp->c_system_include_path = 1;
6265 dirtmp->fname = (char *)xmalloc(strlen(argv[i + 1]) + 1);
6266 strcpy(dirtmp->fname, argv[++i]);
6267 dirtmp->got_name_map = 0;
6268
6269 if (!opts->before_system)
6270 opts->before_system = dirtmp;
6271 else
6272 opts->last_before_system->next = dirtmp;
6273 opts->last_before_system = dirtmp; /* Tail follows the last one */
6274 }
6275 /* Add directory to end of path for includes,
6276 * with the default prefix at the front of its name. */
6277 if (!strcmp(argv[i], "-iwithprefix"))
6278 {
6279 file_name_list *dirtmp;
6280 char *prefix;
6281
6282 if (opts->include_prefix)
6283 prefix = opts->include_prefix;
6284 else
6285 {
6286 prefix = savestring(GCC_INCLUDE_DIR);
6287 /* Remove the `include' from /usr/local/lib/gcc.../include. */
6288 if (!strcmp
6289 (prefix + strlen(prefix) - 8, "/include"))
6290 prefix[strlen(prefix) - 7] = 0;
6291 }
6292
6293 dirtmp =
6294 (file_name_list *) xmalloc(sizeof(file_name_list));
6295
6296 dirtmp->next = 0; /* New one goes on the end */
6297 dirtmp->control_macro = 0;
6298 dirtmp->c_system_include_path = 0;
6299 if (i + 1 == argc)
6300 cpp_fatal
6301 ("Directory name missing after `-iwithprefix' option");
6302
6303 dirtmp->fname = (char *)xmalloc(strlen(argv[i + 1])
6304 + strlen(prefix) + 1);
6305 strcpy(dirtmp->fname, prefix);
6306 strcat(dirtmp->fname, argv[++i]);
6307 dirtmp->got_name_map = 0;
6308
6309 if (!opts->after_include)
6310 opts->after_include = dirtmp;
6311 else
6312 opts->last_after_include->next = dirtmp;
6313 opts->last_after_include = dirtmp; /* Tail follows the last one */
6314 }
6315 /* Add directory to main path for includes,
6316 * with the default prefix at the front of its name. */
6317 if (!strcmp(argv[i], "-iwithprefixbefore"))
6318 {
6319 file_name_list *dirtmp;
6320 char *prefix;
6321
6322 if (opts->include_prefix)
6323 prefix = opts->include_prefix;
6324 else
6325 {
6326 prefix = savestring(GCC_INCLUDE_DIR);
6327 /* Remove the `include' from /usr/local/lib/gcc.../include. */
6328 if (!strcmp
6329 (prefix + strlen(prefix) - 8, "/include"))
6330 prefix[strlen(prefix) - 7] = 0;
6331 }
6332
6333 dirtmp =
6334 (file_name_list *) xmalloc(sizeof(file_name_list));
6335
6336 dirtmp->next = 0; /* New one goes on the end */
6337 dirtmp->control_macro = 0;
6338 dirtmp->c_system_include_path = 0;
6339 if (i + 1 == argc)
6340 cpp_fatal
6341 ("Directory name missing after `-iwithprefixbefore' option");
6342
6343 dirtmp->fname = (char *)xmalloc(strlen(argv[i + 1])
6344 + strlen(prefix) + 1);
6345 strcpy(dirtmp->fname, prefix);
6346 strcat(dirtmp->fname, argv[++i]);
6347 dirtmp->got_name_map = 0;
6348
6349 append_include_chain(pfile, dirtmp, dirtmp);
6350 }
6351 /* Add directory to end of path for includes. */
6352 if (!strcmp(argv[i], "-idirafter"))
6353 {
6354 file_name_list *dirtmp;
6355
6356 dirtmp =
6357 (file_name_list *) xmalloc(sizeof(file_name_list));
6358
6359 dirtmp->next = 0; /* New one goes on the end */
6360 dirtmp->control_macro = 0;
6361 dirtmp->c_system_include_path = 0;
6362 if (i + 1 == argc)
6363 cpp_fatal
6364 ("Directory name missing after `-idirafter' option");
6365 else
6366 dirtmp->fname = argv[++i];
6367 dirtmp->got_name_map = 0;
6368
6369 if (!opts->after_include)
6370 opts->after_include = dirtmp;
6371 else
6372 opts->last_after_include->next = dirtmp;
6373 opts->last_after_include = dirtmp; /* Tail follows the last one */
6374 }
6375 break;
6376
6377 case 'o':
6378 if (opts->out_fname)
6379 cpp_fatal("Output filename specified twice");
6380 if (i + 1 == argc)
6381 cpp_fatal("Filename missing after -o option");
6382 opts->out_fname = argv[++i];
6383 if (!strcmp(opts->out_fname, "-"))
6384 opts->out_fname = "";
6385 break;
6386
6387 case 'p':
6388 if (!strcmp(argv[i], "-pedantic"))
6389 CPP_PEDANTIC(pfile) = 1;
6390 else if (!strcmp(argv[i], "-pedantic-errors"))
6391 {
6392 CPP_PEDANTIC(pfile) = 1;
6393 opts->pedantic_errors = 1;
6394 }
6395 break;
6396
6397 case 't':
6398 if (!strcmp(argv[i], "-trigraphs"))
6399 {
6400 if (!opts->chill)
6401 opts->no_trigraphs = 0;
6402 }
6403 break;
6404
6405 case 'l':
6406 if (!strcmp(argv[i], "-lang-c"))
6407 opts->cplusplus = 0, opts->cplusplus_comments =
6408 0, opts->objc = 0;
6409 if (!strcmp(argv[i], "-lang-c++"))
6410 opts->cplusplus = 1, opts->cplusplus_comments =
6411 1, opts->objc = 0;
6412 if (!strcmp(argv[i], "-lang-c-c++-comments"))
6413 opts->cplusplus = 0, opts->cplusplus_comments =
6414 1, opts->objc = 0;
6415 if (!strcmp(argv[i], "-lang-objc"))
6416 opts->objc = 1, opts->cplusplus =
6417 0, opts->cplusplus_comments = 1;
6418 if (!strcmp(argv[i], "-lang-objc++"))
6419 opts->objc = 1, opts->cplusplus =
6420 1, opts->cplusplus_comments = 1;
6421 if (!strcmp(argv[i], "-lang-asm"))
6422 opts->lang_asm = 1;
6423 if (!strcmp(argv[i], "-lint"))
6424 opts->for_lint = 1;
6425 if (!strcmp(argv[i], "-lang-chill"))
6426 opts->objc = 0, opts->cplusplus = 0, opts->chill = 1,
6427 opts->traditional = 1, opts->no_trigraphs = 1;
6428 break;
6429
6430 case '+':
6431 opts->cplusplus = 1, opts->cplusplus_comments = 1;
6432 break;
6433
6434 case 'w':
6435 opts->inhibit_warnings = 1;
6436 break;
6437
6438 case 'W':
6439 if (!strcmp(argv[i], "-Wtrigraphs"))
6440 opts->warn_trigraphs = 1;
6441 else if (!strcmp(argv[i], "-Wno-trigraphs"))
6442 opts->warn_trigraphs = 0;
6443 else if (!strcmp(argv[i], "-Wcomment"))
6444 opts->warn_comments = 1;
6445 else if (!strcmp(argv[i], "-Wno-comment"))
6446 opts->warn_comments = 0;
6447 else if (!strcmp(argv[i], "-Wcomments"))
6448 opts->warn_comments = 1;
6449 else if (!strcmp(argv[i], "-Wno-comments"))
6450 opts->warn_comments = 0;
6451 else if (!strcmp(argv[i], "-Wtraditional"))
6452 opts->warn_stringify = 1;
6453 else if (!strcmp(argv[i], "-Wno-traditional"))
6454 opts->warn_stringify = 0;
6455 else if (!strcmp(argv[i], "-Wimport"))
6456 opts->warn_import = 1;
6457 else if (!strcmp(argv[i], "-Wno-import"))
6458 opts->warn_import = 0;
6459 else if (!strcmp(argv[i], "-Werror"))
6460 opts->warnings_are_errors = 1;
6461 else if (!strcmp(argv[i], "-Wno-error"))
6462 opts->warnings_are_errors = 0;
6463 else if (!strcmp(argv[i], "-Wall"))
6464 {
6465 opts->warn_trigraphs = 1;
6466 opts->warn_comments = 1;
6467 }
6468 break;
6469
6470 case 'M':
6471 /* The style of the choices here is a bit mixed.
6472 * The chosen scheme is a hybrid of keeping all options in one string
6473 * and specifying each option in a separate argument:
6474 * -M|-MM|-MD file|-MMD file [-MG]. An alternative is:
6475 * -M|-MM|-MD file|-MMD file|-MG|-MMG; or more concisely:
6476 * -M[M][G][D file]. This is awkward to handle in specs, and is not
6477 * as extensible. */
6478 /* ??? -MG must be specified in addition to one of -M or -MM.
6479 * This can be relaxed in the future without breaking anything.
6480 * The converse isn't true. */
6481
6482 /* -MG isn't valid with -MD or -MMD. This is checked for later. */
6483 if (!strcmp(argv[i], "-MG"))
6484 {
6485 opts->print_deps_missing_files = 1;
6486 break;
6487 }
6488 if (!strcmp(argv[i], "-M"))
6489 opts->print_deps = 2;
6490 else if (!strcmp(argv[i], "-MM"))
6491 opts->print_deps = 1;
6492 else if (!strcmp(argv[i], "-MD"))
6493 opts->print_deps = 2;
6494 else if (!strcmp(argv[i], "-MMD"))
6495 opts->print_deps = 1;
6496 /* For -MD and -MMD options, write deps on file named by next arg. */
6497 if (!strcmp(argv[i], "-MD") || !strcmp(argv[i], "-MMD"))
6498 {
6499 if (i + 1 == argc)
6500 cpp_fatal("Filename missing after %s option",
6501 argv[i]);
6502 opts->deps_file = argv[++i];
6503 }
6504 else
6505 {
6506 /* For -M and -MM, write deps on standard output
6507 * and suppress the usual output. */
6508 opts->no_output = 1;
6509 }
6510 break;
6511
6512 case 'd':
6513 {
6514 char *p = argv[i] + 2;
6515 char c;
6516
6517 while ((c = *p++) != 0)
6518 {
6519 /* Arg to -d specifies what parts of macros to dump */
6520 switch (c)
6521 {
6522 case 'M':
6523 opts->dump_macros = dump_only;
6524 opts->no_output = 1;
6525 break;
6526 case 'N':
6527 opts->dump_macros = dump_names;
6528 break;
6529 case 'D':
6530 opts->dump_macros = dump_definitions;
6531 break;
6532 }
6533 }
6534 }
6535 break;
6536
6537 case 'g':
6538 if (argv[i][2] == '3')
6539 opts->debug_output = 1;
6540 break;
6541
6542 case 'v':
6543 fprintf(stderr, "GNU CPP version %s", version_string);
6544#ifdef TARGET_VERSION
6545 TARGET_VERSION;
6546#endif
6547 fprintf(stderr, "\n");
6548 opts->verbose = 1;
6549 break;
6550
6551 case 'H':
6552 opts->print_include_names = 1;
6553 break;
6554
6555 case 'D':
6556 if (argv[i][2] != 0)
6557 push_pending(pfile, "-D", argv[i] + 2);
6558 else if (i + 1 == argc)
6559 cpp_fatal("Macro name missing after -D option");
6560 else
6561 i++, push_pending(pfile, "-D", argv[i]);
6562 break;
6563
6564 case 'A':
6565 {
6566 char *p = NULL;
6567
6568 if (argv[i][2] != 0)
6569 p = argv[i] + 2;
6570 else if (i + 1 == argc)
6571 cpp_fatal("Assertion missing after -A option");
6572 else
6573 p = argv[++i];
6574
6575 if (!strcmp(p, "-"))
6576 {
6577 struct cpp_pending **ptr;
6578
6579 /* -A- eliminates all predefined macros and assertions.
6580 * Let's include also any that were specified earlier
6581 * on the command line. That way we can get rid of any
6582 * that were passed automatically in from GCC. */
6583
6584 opts->inhibit_predefs = 1;
6585 for (ptr = &opts->pending; *ptr;)
6586 {
6587 struct cpp_pending *pend = *ptr;
6588
6589 if (pend->cmd && pend->cmd[0] == '-'
6590 && (pend->cmd[1] == 'D'
6591 || pend->cmd[1] == 'A'))
6592 {
6593 *ptr = pend->next;
6594 free(pend);
6595 }
6596 else
6597 ptr = &pend->next;
6598 }
6599 }
6600 else
6601 {
6602 push_pending(pfile, "-A", p);
6603 }
6604 }
6605 break;
6606
6607 case 'U': /* JF #undef something */
6608 if (argv[i][2] != 0)
6609 push_pending(pfile, "-U", argv[i] + 2);
6610 else if (i + 1 == argc)
6611 cpp_fatal("Macro name missing after -U option");
6612 else
6613 push_pending(pfile, "-U", argv[i + 1]), i++;
6614 break;
6615
6616 case 'C':
6617 opts->put_out_comments = 1;
6618 break;
6619
6620 case 'E': /* -E comes from cc -E; ignore it. */
6621 break;
6622
6623 case 'P':
6624 opts->no_line_commands = 1;
6625 break;
6626
6627 case '$': /* Don't include $ in identifiers. */
6628 opts->dollars_in_ident = 0;
6629 break;
6630
6631 case 'I': /* Add directory to path for includes. */
6632 {
6633 file_name_list *dirtmp;
6634
6635 if (!CPP_OPTIONS(pfile)->ignore_srcdir
6636 && !strcmp(argv[i] + 2, "-"))
6637 {
6638 CPP_OPTIONS(pfile)->ignore_srcdir = 1;
6639 /* Don't use any preceding -I directories for #include <...>. */
6640 CPP_OPTIONS(pfile)->first_bracket_include = 0;
6641 }
6642 else
6643 {
6644 dirtmp =
6645 (file_name_list *) xmalloc(sizeof(file_name_list));
6646
6647 dirtmp->next = 0; /* New one goes on the end */
6648 dirtmp->control_macro = 0;
6649 dirtmp->c_system_include_path = 0;
6650 if (argv[i][2] != 0)
6651 dirtmp->fname = argv[i] + 2;
6652 else if (i + 1 == argc)
6653 cpp_fatal
6654 ("Directory name missing after -I option");
6655 else
6656 dirtmp->fname = argv[++i];
6657 dirtmp->got_name_map = 0;
6658 append_include_chain(pfile, dirtmp, dirtmp);
6659 }
6660 }
6661 break;
6662
6663 case 'n':
6664 if (!strcmp(argv[i], "-nostdinc"))
6665 /* -nostdinc causes no default include directories.
6666 * You must specify all include-file directories with -I. */
6667 opts->no_standard_includes = 1;
6668 else if (!strcmp(argv[i], "-nostdinc++"))
6669 /* -nostdinc++ causes no default C++-specific include directories. */
6670 opts->no_standard_cplusplus_includes = 1;
6671 break;
6672
6673 case 'u':
6674 /* Sun compiler passes undocumented switch "-undef".
6675 * Let's assume it means to inhibit the predefined symbols. */
6676 opts->inhibit_predefs = 1;
6677 break;
6678
6679 case '\0': /* JF handle '-' as file name meaning stdin or stdout */
6680 if (!opts->in_fname)
6681 {
6682 opts->in_fname = "";
6683 break;
6684 }
6685 else if (!opts->out_fname)
6686 {
6687 opts->out_fname = "";
6688 break;
6689 } /* else fall through into error */
6690 default:
6691 return i;
6692 }
6693 }
6694 }
6695 return i;
6696}
6697
6698void
6699cpp_finish(cpp_reader * pfile)
6700{
6701 struct cpp_options *opts = CPP_OPTIONS(pfile);
6702
6703 if (opts->print_deps)
6704 {
6705 /* Stream on which to print the dependency information. */
6706 FILE *deps_stream;
6707
6708 /* Don't actually write the deps file if compilation has failed. */
6709 if (pfile->errors == 0)
6710 {
6711 const char *deps_mode =
6712 opts->print_deps_append ? "ab" : "wb";
6713
6714 if (!opts->deps_file)
6715 deps_stream = stdout;
6716 else if (!(deps_stream = fopen(opts->deps_file, deps_mode)))
6717 cpp_pfatal_with_name(pfile, opts->deps_file);
6718 fputs(pfile->deps_buffer, deps_stream);
6719 putc('\n', deps_stream);
6720 if (opts->deps_file)
6721 {
6722 if (ferror(deps_stream) || fclose(deps_stream) != 0)
6723 cpp_fatal("I/O error on output");
6724 }
6725 }
6726 }
6727}
6728
6729static int
6730do_assert(cpp_reader * pfile, struct directive *keyword __UNUSED__,
6731 unsigned char *buf __UNUSED__, unsigned char *limit __UNUSED__)
6732{
6733 long symstart; /* remember where symbol name starts */
6734 int c;
6735 int sym_length; /* and how long it is */
6736 struct arglist *tokens = NULL;
6737
6738 if (CPP_PEDANTIC(pfile) && CPP_OPTIONS(pfile)->done_initializing
6739 && !CPP_BUFFER(pfile)->system_header_p)
6740 cpp_pedwarn(pfile, "ANSI C does not allow `#assert'");
6741
6742 cpp_skip_hspace(pfile);
6743 symstart = CPP_WRITTEN(pfile); /* remember where it starts */
6744 parse_name(pfile, GETC());
6745 sym_length = check_macro_name(pfile, pfile->token_buffer + symstart,
6746 "assertion");
6747
6748 cpp_skip_hspace(pfile);
6749 if (PEEKC() != '(')
6750 {
6751 cpp_error(pfile, "missing token-sequence in `#assert'");
6752 goto error;
6753 }
6754 {
6755 int error_flag = 0;
6756
6757 tokens = read_token_list(pfile, &error_flag);
6758 if (error_flag)
6759 goto error;
6760 if (!tokens)
6761 {
6762 cpp_error(pfile, "empty token-sequence in `#assert'");
6763 goto error;
6764 }
6765 cpp_skip_hspace(pfile);
6766 c = PEEKC();
6767 if (c != EOF && c != '\n')
6768 cpp_pedwarn(pfile, "junk at end of `#assert'");
6769 skip_rest_of_line(pfile);
6770 }
6771
6772 /* If this name isn't already an assertion name, make it one.
6773 * Error if it was already in use in some other way. */
6774
6775 {
6776 ASSERTION_HASHNODE *hp;
6777 const char *symname = (char *)pfile->token_buffer + symstart;
6778 int hashcode =
6779 hashf(symname, sym_length, ASSERTION_HASHSIZE);
6780 struct tokenlist_list *value =
6781 (struct tokenlist_list *)xmalloc(sizeof(struct tokenlist_list));
6782
6783 hp = assertion_lookup(pfile, symname, sym_length, hashcode);
6784 if (!hp)
6785 {
6786 if (sym_length == 7 && !strncmp(symname, "defined", sym_length))
6787 cpp_error(pfile, "`defined' redefined as assertion");
6788 hp = assertion_install(pfile, symname, sym_length, hashcode);
6789 }
6790 /* Add the spec'd token-sequence to the list of such. */
6791 value->tokens = tokens;
6792 value->next = hp->value;
6793 hp->value = value;
6794 }
6795 CPP_SET_WRITTEN(pfile, symstart); /* Pop */
6796 return 0;
6797 error:
6798 CPP_SET_WRITTEN(pfile, symstart); /* Pop */
6799 skip_rest_of_line(pfile);
6800 return 1;
6801}
6802
6803static int
6804do_unassert(cpp_reader * pfile, struct directive *keyword __UNUSED__,
6805 unsigned char *buf __UNUSED__, unsigned char *limit __UNUSED__)
6806{
6807 long symstart; /* remember where symbol name starts */
6808 int sym_length; /* and how long it is */
6809 int c;
6810
6811 struct arglist *tokens = NULL;
6812 int tokens_specified = 0;
6813
6814 if (CPP_PEDANTIC(pfile) && CPP_OPTIONS(pfile)->done_initializing
6815 && !CPP_BUFFER(pfile)->system_header_p)
6816 cpp_pedwarn(pfile, "ANSI C does not allow `#unassert'");
6817
6818 cpp_skip_hspace(pfile);
6819
6820 symstart = CPP_WRITTEN(pfile); /* remember where it starts */
6821 parse_name(pfile, GETC());
6822 sym_length = check_macro_name(pfile, pfile->token_buffer + symstart,
6823 "assertion");
6824
6825 cpp_skip_hspace(pfile);
6826 if (PEEKC() == '(')
6827 {
6828 int error_flag = 0;
6829
6830 tokens = read_token_list(pfile, &error_flag);
6831 if (error_flag)
6832 goto error;
6833 if (!tokens)
6834 {
6835 cpp_error(pfile, "empty token list in `#unassert'");
6836 goto error;
6837 }
6838 tokens_specified = 1;
6839 }
6840 cpp_skip_hspace(pfile);
6841 c = PEEKC();
6842 if (c != EOF && c != '\n')
6843 cpp_error(pfile, "junk at end of `#unassert'");
6844 skip_rest_of_line(pfile);
6845
6846 {
6847 ASSERTION_HASHNODE *hp;
6848 const char *symname = (char *)pfile->token_buffer + symstart;
6849 int hashcode =
6850 hashf(symname, sym_length, ASSERTION_HASHSIZE);
6851 struct tokenlist_list *tail, *prev;
6852
6853 hp = assertion_lookup(pfile, symname, sym_length, hashcode);
6854 if (!hp)
6855 return 1;
6856
6857 /* If no token list was specified, then eliminate this assertion
6858 * entirely. */
6859 if (!tokens_specified)
6860 delete_assertion(hp);
6861 else
6862 {
6863 /* If a list of tokens was given, then delete any matching list. */
6864
6865 tail = hp->value;
6866 prev = 0;
6867 while (tail)
6868 {
6869 struct tokenlist_list *next = tail->next;
6870
6871 if (compare_token_lists(tail->tokens, tokens))
6872 {
6873 if (prev)
6874 prev->next = next;
6875 else
6876 hp->value = tail->next;
6877 free_token_list(tail->tokens);
6878 free(tail);
6879 }
6880 else
6881 {
6882 prev = tail;
6883 }
6884 tail = next;
6885 }
6886 }
6887 }
6888
6889 CPP_SET_WRITTEN(pfile, symstart); /* Pop */
6890 return 0;
6891 error:
6892 CPP_SET_WRITTEN(pfile, symstart); /* Pop */
6893 skip_rest_of_line(pfile);
6894 return 1;
6895}
6896
6897/* Test whether there is an assertion named NAME
6898 * and optionally whether it has an asserted token list TOKENS.
6899 * NAME is not null terminated; its length is SYM_LENGTH.
6900 * If TOKENS_SPECIFIED is 0, then don't check for any token list. */
6901
6902static int
6903check_assertion(cpp_reader * pfile, const char *name, int sym_length,
6904 int tokens_specified, struct arglist *tokens)
6905{
6906 ASSERTION_HASHNODE *hp;
6907 int hashcode = hashf(name, sym_length, ASSERTION_HASHSIZE);
6908
6909 if (CPP_PEDANTIC(pfile) && !CPP_BUFFER(pfile)->system_header_p)
6910 cpp_pedwarn(pfile, "ANSI C does not allow testing assertions");
6911
6912 hp = assertion_lookup(pfile, name, sym_length, hashcode);
6913 if (!hp)
6914 /* It is not an assertion; just return false. */
6915 return 0;
6916
6917 /* If no token list was specified, then value is 1. */
6918 if (!tokens_specified)
6919 return 1;
6920
6921 {
6922 struct tokenlist_list *tail;
6923
6924 tail = hp->value;
6925
6926 /* If a list of tokens was given,
6927 * then succeed if the assertion records a matching list. */
6928
6929 while (tail)
6930 {
6931 if (compare_token_lists(tail->tokens, tokens))
6932 return 1;
6933 tail = tail->next;
6934 }
6935
6936 /* Fail if the assertion has no matching list. */
6937 return 0;
6938 }
6939}
6940
6941/* Compare two lists of tokens for equality including order of tokens. */
6942
6943static int
6944compare_token_lists(struct arglist *l1, struct arglist *l2)
6945{
6946 while (l1 && l2)
6947 {
6948 if (l1->length != l2->length)
6949 return 0;
6950 if (strncmp(l1->name, l2->name, l1->length))
6951 return 0;
6952 l1 = l1->next;
6953 l2 = l2->next;
6954 }
6955
6956 /* Succeed if both lists end at the same time. */
6957 return l1 == l2;
6958}
6959
6960struct arglist *
6961reverse_token_list(struct arglist *tokens)
6962{
6963 struct arglist *prev = 0, *cur, *next;
6964
6965 for (cur = tokens; cur; cur = next)
6966 {
6967 next = cur->next;
6968 cur->next = prev;
6969 prev = cur;
6970 }
6971 return prev;
6972}
6973
6974/* Read a space-separated list of tokens ending in a close parenthesis.
6975 * Return a list of strings, in the order they were written.
6976 * (In case of error, return 0 and store -1 in *ERROR_FLAG.) */
6977
6978static struct arglist *
6979read_token_list(cpp_reader * pfile, int *error_flag)
6980{
6981 struct arglist *token_ptrs = 0;
6982 int depth = 1;
6983 int length;
6984
6985 *error_flag = 0;
6986 FORWARD(1); /* Skip '(' */
6987
6988 /* Loop over the assertion value tokens. */
6989 while (depth > 0)
6990 {
6991 struct arglist *temp;
6992 long name_written = CPP_WRITTEN(pfile);
6993 int c;
6994
6995 cpp_skip_hspace(pfile);
6996
6997 c = GETC();
6998
6999 /* Find the end of the token. */
7000 if (c == '(')
7001 {
7002 CPP_PUTC(pfile, c);
7003 depth++;
7004 }
7005 else if (c == ')')
7006 {
7007 depth--;
7008 if (depth == 0)
7009 break;
7010 CPP_PUTC(pfile, c);
7011 }
7012 else if (c == '"' || c == '\'')
7013 {
7014 FORWARD(-1);
7015 cpp_get_token(pfile);
7016 }
7017 else if (c == '\n')
7018 break;
7019 else
7020 {
7021 while (c != EOF && !is_space[c] && c != '(' && c != ')'
7022 && c != '"' && c != '\'')
7023 {
7024 CPP_PUTC(pfile, c);
7025 c = GETC();
7026 }
7027 if (c != EOF)
7028 FORWARD(-1);
7029 }
7030
7031 length = CPP_WRITTEN(pfile) - name_written;
7032 temp = (struct arglist *)xmalloc(sizeof(struct arglist) + length + 1);
7033
7034 temp->name = (char *)(temp + 1);
7035 memcpy(temp->name, (char *)(pfile->token_buffer + name_written),
7036 length);
7037 temp->name[length] = 0;
7038 temp->next = token_ptrs;
7039 token_ptrs = temp;
7040 temp->length = length;
7041
7042 CPP_ADJUST_WRITTEN(pfile, -length); /* pop */
7043
7044 if (c == EOF || c == '\n')
7045 { /* FIXME */
7046 cpp_error(pfile,
7047 "unterminated token sequence following `#' operator");
7048 return 0;
7049 }
7050 }
7051
7052 /* We accumulated the names in reverse order.
7053 * Now reverse them to get the proper order. */
7054 return reverse_token_list(token_ptrs);
7055}
7056
7057static void
7058free_token_list(struct arglist *tokens)
7059{
7060 while (tokens)
7061 {
7062 struct arglist *next = tokens->next;
7063
7064 free(tokens->name);
7065 free(tokens);
7066 tokens = next;
7067 }
7068}
7069
7070/* Get the file-mode and data size of the file open on FD
7071 * and store them in *MODE_POINTER and *SIZE_POINTER. */
7072
7073static int
7074file_size_and_mode(int fd, int *mode_pointer, long int *size_pointer)
7075{
7076 struct stat sbuf;
7077
7078 if (fstat(fd, &sbuf) < 0)
7079 return (-1);
7080 if (mode_pointer)
7081 *mode_pointer = sbuf.st_mode;
7082 if (size_pointer)
7083 *size_pointer = sbuf.st_size;
7084 return 0;
7085}
7086
7087/* Read LEN bytes at PTR from descriptor DESC, for file FILENAME,
7088 * retrying if necessary. Return a negative value if an error occurs,
7089 * otherwise return the actual number of bytes read,
7090 * which must be LEN unless end-of-file was reached. */
7091
7092static int
7093safe_read(int desc, char *ptr, int len)
7094{
7095 int left = len;
7096
7097 while (left > 0)
7098 {
7099 int nchars = read(desc, ptr, left);
7100
7101 if (nchars < 0)
7102 {
7103#ifdef EINTR
7104 if (errno == EINTR)
7105 continue;
7106#endif
7107 return nchars;
7108 }
7109 if (nchars == 0)
7110 break;
7111 ptr += nchars;
7112 left -= nchars;
7113 }
7114 return len - left;
7115}
7116
7117static char *
7118savestring(const char *input)
7119{
7120 unsigned size = strlen(input);
7121 char *output = (char *)xmalloc(size + 1);
7122
7123 strcpy(output, input);
7124 return output;
7125}
7126
7127/* Initialize PMARK to remember the current position of PFILE. */
7128void
7129parse_set_mark(struct parse_marker *pmark, cpp_reader * pfile)
7130{
7131 cpp_buffer *pbuf = CPP_BUFFER(pfile);
7132
7133 pmark->next = pbuf->marks;
7134 pbuf->marks = pmark;
7135 pmark->buf = pbuf;
7136 pmark->position = pbuf->cur - pbuf->buf;
7137}
7138
7139/* Cleanup PMARK - we no longer need it. */
7140static void
7141parse_clear_mark(struct parse_marker *pmark)
7142{
7143 struct parse_marker **pp = &pmark->buf->marks;
7144
7145 for (;; pp = &(*pp)->next)
7146 {
7147 if (!*pp)
7148 cpp_fatal("internal error", "in parse_set_mark");
7149 if (*pp == pmark)
7150 break;
7151 }
7152 *pp = pmark->next;
7153}
7154
7155/* Backup the current position of PFILE to that saved in PMARK. */
7156
7157static void
7158parse_goto_mark(struct parse_marker *pmark, cpp_reader * pfile)
7159{
7160 cpp_buffer *pbuf = CPP_BUFFER(pfile);
7161
7162 if (pbuf != pmark->buf)
7163 cpp_fatal("internal error %s", "parse_goto_mark");
7164 pbuf->cur = pbuf->buf + pmark->position;
7165}
7166
7167/* Reset PMARK to point to the current position of PFILE. (Same
7168 * as parse_clear_mark (PMARK), parse_set_mark (PMARK, PFILE) but faster. */
7169
7170static void
7171parse_move_mark(struct parse_marker *pmark, cpp_reader * pfile)
7172{
7173 cpp_buffer *pbuf = CPP_BUFFER(pfile);
7174
7175 if (pbuf != pmark->buf)
7176 cpp_fatal("internal error %s", "parse_move_mark");
7177 pmark->position = pbuf->cur - pbuf->buf;
7178}
7179
7180int
7181cpp_read_check_assertion(cpp_reader * pfile)
7182{
7183 int name_start = CPP_WRITTEN(pfile);
7184 int name_length, name_written;
7185 int result;
7186
7187 FORWARD(1); /* Skip '#' */
7188 cpp_skip_hspace(pfile);
7189 parse_name(pfile, GETC());
7190 name_written = CPP_WRITTEN(pfile);
7191 name_length = name_written - name_start;
7192 cpp_skip_hspace(pfile);
7193 if (CPP_BUF_PEEK(CPP_BUFFER(pfile)) == '(')
7194 {
7195 int error_flag;
7196 struct arglist *token_ptrs = read_token_list(pfile, &error_flag);
7197
7198 result = check_assertion(pfile,
7199 (char *)pfile->token_buffer + name_start,
7200 name_length, 1, token_ptrs);
7201 }
7202 else
7203 result = check_assertion(pfile,
7204 (char *)pfile->token_buffer + name_start,
7205 name_length, 0, NULL);
7206 CPP_ADJUST_WRITTEN(pfile, -name_length); /* pop */
7207 return result;
7208}
7209
7210static void
7211cpp_print_file_and_line(cpp_reader * pfile)
7212{
7213 cpp_buffer *ip = cpp_file_buffer(pfile);
7214
7215 if (ip)
7216 {
7217 long line, col;
7218
7219 cpp_buf_line_and_col(ip, &line, &col);
7220 cpp_file_line_for_message(pfile, ip->nominal_fname,
7221 line, pfile->show_column ? col : -1);
7222 }
7223}
7224
7225static void
7226cpp_error_v(cpp_reader * pfile, const char *msg, va_list args)
7227{
7228 cpp_print_containing_files(pfile);
7229 cpp_print_file_and_line(pfile);
7230 cpp_message_v(pfile, 1, msg, args);
7231}
7232
7233void
7234cpp_error(cpp_reader * pfile, const char *msg, ...)
7235{
7236 va_list args;
7237
7238 va_start(args, msg);
7239
7240 cpp_error_v(pfile, msg, args);
7241
7242 va_end(args);
7243}
7244
7245/* Print error message but don't count it. */
7246
7247static void
7248cpp_warning_v(cpp_reader * pfile, const char *msg, va_list args)
7249{
7250 if (CPP_OPTIONS(pfile)->inhibit_warnings)
7251 return;
7252
7253 if (CPP_OPTIONS(pfile)->warnings_are_errors)
7254 pfile->errors++;
7255
7256 cpp_print_containing_files(pfile);
7257 cpp_print_file_and_line(pfile);
7258 cpp_message_v(pfile, 0, msg, args);
7259}
7260
7261void
7262cpp_warning(cpp_reader * pfile, const char *msg, ...)
7263{
7264 va_list args;
7265
7266 va_start(args, msg);
7267
7268 cpp_warning_v(pfile, msg, args);
7269
7270 va_end(args);
7271}
7272
7273/* Print an error message and maybe count it. */
7274
7275void
7276cpp_pedwarn(cpp_reader * pfile, const char *msg, ...)
7277{
7278 va_list args;
7279
7280 va_start(args, msg);
7281
7282 if (CPP_OPTIONS(pfile)->pedantic_errors)
7283 cpp_error_v(pfile, msg, args);
7284 else
7285 cpp_warning_v(pfile, msg, args);
7286
7287 va_end(args);
7288}
7289
7290static void
7291cpp_error_with_line(cpp_reader * pfile, int line, int column, const char *msg)
7292{
7293 cpp_buffer *ip = cpp_file_buffer(pfile);
7294
7295 cpp_print_containing_files(pfile);
7296
7297 if (ip)
7298 cpp_file_line_for_message(pfile, ip->nominal_fname, line, column);
7299
7300 cpp_message(pfile, 1, msg, NULL, NULL, NULL);
7301}
7302
7303static void
7304cpp_warning_with_line(cpp_reader * pfile, int line, int column, const char *msg)
7305{
7306 cpp_buffer *ip;
7307
7308 if (CPP_OPTIONS(pfile)->inhibit_warnings)
7309 return;
7310
7311 if (CPP_OPTIONS(pfile)->warnings_are_errors)
7312 pfile->errors++;
7313
7314 cpp_print_containing_files(pfile);
7315
7316 ip = cpp_file_buffer(pfile);
7317
7318 if (ip)
7319 cpp_file_line_for_message(pfile, ip->nominal_fname, line, column);
7320
7321 cpp_message(pfile, 0, msg, NULL, NULL, NULL);
7322}
7323
7324static void
7325cpp_pedwarn_with_line(cpp_reader * pfile, int line, int column, const char *msg)
7326{
7327 if (CPP_OPTIONS(pfile)->pedantic_errors)
7328 cpp_error_with_line(pfile, column, line, msg);
7329 else
7330 cpp_warning_with_line(pfile, line, column, msg);
7331}
7332
7333/* Report a warning (or an error if pedantic_errors)
7334 * giving specified file name and line number, not current. */
7335
7336void
7337cpp_pedwarn_with_file_and_line(cpp_reader * pfile,
7338 const char *file, int line,
7339 const char *msg, const char *arg1,
7340 const char *arg2, const char *arg3)
7341{
7342 if (!CPP_OPTIONS(pfile)->pedantic_errors
7343 && CPP_OPTIONS(pfile)->inhibit_warnings)
7344 return;
7345 if (file)
7346 cpp_file_line_for_message(pfile, file, line, -1);
7347 cpp_message(pfile, CPP_OPTIONS(pfile)->pedantic_errors,
7348 msg, arg1, arg2, arg3);
7349}
7350
7351/* This defines "errno" properly for VMS, and gives us EACCES. */
7352#include <errno.h>
7353#ifndef errno
7354extern int errno;
7355
7356#endif
7357
7358#ifndef HAVE_STRERROR
7359extern int sys_nerr;
7360
7361#if defined(bsd4_4)
7362extern const char *const sys_errlist[];
7363
7364#else
7365extern char *sys_errlist[];
7366
7367#endif
7368#endif /* HAVE_STRERROR */
7369
7370/*
7371 * my_strerror - return the descriptive text associated with an `errno' code.
7372 */
7373
7374static const char *
7375my_strerror(int errnum)
7376{
7377 const char *result;
7378
7379#ifndef HAVE_STRERROR
7380 result = ((errnum < sys_nerr) ? sys_errlist[errnum] : 0);
7381#else
7382 result = strerror(errnum);
7383#endif
7384
7385 if (!result)
7386 result = "undocumented I/O error";
7387
7388 return result;
7389}
7390
7391/* Error including a message from `errno'. */
7392
7393static void
7394cpp_error_from_errno(cpp_reader * pfile, const char *name)
7395{
7396 cpp_buffer *ip = cpp_file_buffer(pfile);
7397
7398 cpp_print_containing_files(pfile);
7399
7400 if (ip)
7401 cpp_file_line_for_message(pfile, ip->nominal_fname, ip->lineno, -1);
7402
7403 cpp_message(pfile, 1, "%s: %s", name, my_strerror(errno), NULL);
7404}
7405
7406void
7407cpp_perror_with_name(cpp_reader * pfile, const char *name)
7408{
7409 cpp_message(pfile, 1, "%s: %s: %s", progname, name, my_strerror(errno));
7410}
7411
7412/* TODO:
7413 * No pre-compiled header file support.
7414 *
7415 * Possibly different enum token codes for each C/C++ token.
7416 *
7417 * Should clean up remaining directives to that do_XXX functions
7418 * only take two arguments and all have command_reads_line.
7419 *
7420 * Find and cleanup remaining uses of static variables,
7421 *
7422 * Support for trigraphs.
7423 *
7424 * Support -dM flag (dump_all_macros).
7425 *
7426 * Support for_lint flag.
7427 */
diff --git a/libraries/edje/src/bin/epp/cpplib.h b/libraries/edje/src/bin/epp/cpplib.h
new file mode 100644
index 0000000..5653dd2
--- /dev/null
+++ b/libraries/edje/src/bin/epp/cpplib.h
@@ -0,0 +1,641 @@
1/* Definitions for CPP library.
2 Copyright (C) 1995 Free Software Foundation, Inc.
3 Written by Per Bothner, 1994-95.
4
5This program is free software; you can redistribute it and/or modify it
6under the terms of the GNU General Public License as published by the
7Free Software Foundation; either version 2, or (at your option) any
8later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 In other words, you are welcome to use, share and improve this program.
20 You are forbidden to forbid anyone else to use, share and improve
21 what you give them. Help stamp out software-hoarding! */
22
23#include <stdarg.h>
24#include <sys/types.h>
25#include <sys/stat.h>
26
27#ifndef HOST_BITS_PER_WIDE_INT
28
29#if HOST_BITS_PER_LONG > HOST_BITS_PER_INT
30#define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
31#define HOST_WIDE_INT long
32#else
33#define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_INT
34#define HOST_WIDE_INT int
35#endif
36
37#endif
38
39#define STATIC_BUFFERS
40
41typedef struct cpp_reader cpp_reader;
42typedef struct cpp_buffer cpp_buffer;
43typedef struct cpp_options cpp_options;
44
45enum cpp_token {
46 CPP_EOF = -1,
47 CPP_OTHER = 0,
48 CPP_COMMENT = 1,
49 CPP_HSPACE,
50 CPP_VSPACE, /* newlines and #line directives */
51 CPP_NAME,
52 CPP_NUMBER,
53 CPP_CHAR,
54 CPP_STRING,
55 CPP_DIRECTIVE,
56 CPP_LPAREN, /* "(" */
57 CPP_RPAREN, /* ")" */
58 CPP_LBRACE, /* "{" */
59 CPP_RBRACE, /* "}" */
60 CPP_COMMA, /* "," */
61 CPP_SEMICOLON, /* ";" */
62 CPP_3DOTS, /* "..." */
63 /* POP_TOKEN is returned when we've popped a cpp_buffer. */
64 CPP_POP
65};
66
67typedef enum cpp_token (*parse_underflow_t) (cpp_reader *);
68typedef int (*parse_cleanup_t) (cpp_buffer *, cpp_reader *);
69
70/* A parse_marker indicates a previous position,
71 which we can backtrack to. */
72
73struct parse_marker {
74 cpp_buffer *buf;
75 struct parse_marker *next;
76 int position;
77};
78
79extern int cpp_handle_options(cpp_reader * pfile, int, char **);
80extern enum cpp_token cpp_get_token(cpp_reader * pfile);
81extern void cpp_skip_hspace(cpp_reader * pfile);
82
83/* Maintain and search list of included files, for #import. */
84
85#define IMPORT_HASH_SIZE 31
86
87struct import_file {
88 char *name;
89 ino_t inode;
90 dev_t dev;
91 struct import_file *next;
92};
93
94/* If we have a huge buffer, may need to cache more recent counts */
95#define CPP_LINE_BASE(BUF) ((BUF)->buf + (BUF)->line_base)
96
97enum dump_type {
98 dump_none = 0, dump_only, dump_names, dump_definitions
99};
100
101struct cpp_buffer {
102 unsigned char *buf;
103 unsigned char *cur;
104 unsigned char *rlimit; /* end of valid data */
105 unsigned char *alimit; /* end of allocated buffer */
106 unsigned char *prev; /* start of current token */
107
108 const char *fname;
109 /* Filename specified with #line command. */
110 const char *nominal_fname;
111
112 /* Record where in the search path this file was found.
113 * For #include_next. */
114 struct file_name_list *dir;
115
116 long line_base;
117 long lineno; /* Line number at CPP_LINE_BASE. */
118 long colno; /* Column number at CPP_LINE_BASE. */
119#ifndef STATIC_BUFFERS
120 cpp_buffer *chain;
121#endif
122 parse_underflow_t underflow;
123 parse_cleanup_t cleanup;
124 void *data;
125 struct parse_marker *marks;
126 /* Value of if_stack at start of this file.
127 * Used to prohibit unmatched #endif (etc) in an include file. */
128 struct if_stack *if_stack;
129
130 /* True if this is a header file included using <FILENAME>. */
131 char system_header_p;
132 char seen_eof;
133
134 /* True if buffer contains escape sequences.
135 * Currently there are are only two kind:
136 * "@-" means following identifier should not be macro-expanded.
137 * "@ " means a token-separator. This turns into " " in final output
138 * if not stringizing and needed to separate tokens; otherwise nothing.
139 * "@@" means a normal '@'.
140 * (An '@' inside a string stands for itself and is never an escape.) */
141 char has_escapes;
142};
143
144struct cpp_pending; /* Forward declaration - for C++. */
145struct file_name_map_list;
146
147typedef struct assertion_hashnode ASSERTION_HASHNODE;
148
149#define ASSERTION_HASHSIZE 37
150
151#ifdef STATIC_BUFFERS
152/* Maximum nesting of cpp_buffers. We use a static limit, partly for
153 efficiency, and partly to limit runaway recursion. */
154#define CPP_STACK_MAX 200
155#endif
156
157struct cpp_reader {
158 unsigned char *limit;
159 parse_underflow_t get_token;
160 cpp_buffer *buffer;
161#ifdef STATIC_BUFFERS
162 cpp_buffer buffer_stack[CPP_STACK_MAX];
163#endif
164
165 int errors; /* Error counter for exit code */
166 void *data;
167
168 unsigned char *token_buffer;
169 int token_buffer_size;
170
171 /* Line where a newline was first seen in a string constant. */
172 int multiline_string_line;
173
174 /* Current depth in #include directives that use <...>. */
175 int system_include_depth;
176
177 /* List of included files that contained #pragma once. */
178 struct file_name_list *dont_repeat_files;
179
180 /* List of other included files.
181 * If ->control_macro if nonzero, the file had a #ifndef
182 * around the entire contents, and ->control_macro gives the macro name. */
183 struct file_name_list *all_include_files;
184
185 /* Current maximum length of directory names in the search path
186 * for include files. (Altered as we get more of them.) */
187 int max_include_len;
188
189 /* Hash table of files already included with #include or #import. */
190 struct import_file *import_hash_table[IMPORT_HASH_SIZE];
191
192 struct if_stack *if_stack;
193
194 /* Nonzero means we are inside an IF during a -pcp run. In this mode
195 * macro expansion is done, and preconditions are output for all macro
196 * uses requiring them. */
197 char pcp_inside_if;
198
199 /* Nonzero means we have printed (while error reporting) a list of
200 * containing files that matches the current status. */
201 char input_stack_listing_current;
202
203 /* If non-zero, macros are not expanded. */
204 char no_macro_expand;
205
206 /* Print column number in error messages. */
207 char show_column;
208
209 /* We're printed a warning recommending against using #import. */
210 char import_warning;
211
212 /* If true, character between '<' and '>' are a single (string) token. */
213 char parsing_include_directive;
214
215 /* True if escape sequences (as described for has_escapes in
216 * parse_buffer) should be emitted. */
217 char output_escapes;
218
219 /* 0: Have seen non-white-space on this line.
220 * 1: Only seen white space so far on this line.
221 * 2: Only seen white space so far in this file. */
222 char only_seen_white;
223
224 /* Nonzero means this file was included with a -imacros or -include
225 * command line and should not be recorded as an include file. */
226
227 int no_record_file;
228
229 long lineno;
230
231 struct tm *timebuf;
232
233 ASSERTION_HASHNODE *assertion_hashtab[ASSERTION_HASHSIZE];
234
235 /* Buffer of -M output. */
236 char *deps_buffer;
237
238 /* Number of bytes allocated in above. */
239 int deps_allocated_size;
240
241 /* Number of bytes used. */
242 int deps_size;
243
244 /* Number of bytes since the last newline. */
245 int deps_column;
246};
247
248#define CPP_BUF_PEEK(BUFFER) \
249 ((BUFFER)->cur < (BUFFER)->rlimit ? *(BUFFER)->cur : EOF)
250#define CPP_BUF_GET(BUFFER) \
251 ((BUFFER)->cur < (BUFFER)->rlimit ? *(BUFFER)->cur++ : EOF)
252#define CPP_FORWARD(BUFFER, N) ((BUFFER)->cur += (N))
253
254/* Number of characters currently in PFILE's output buffer. */
255#define CPP_WRITTEN(PFILE) ((PFILE)->limit - (PFILE)->token_buffer)
256#define CPP_PWRITTEN(PFILE) ((PFILE)->limit)
257
258/* Make sure PFILE->token_buffer has space for at least N more characters. */
259#define CPP_RESERVE(PFILE, N) \
260 ((unsigned int)(CPP_WRITTEN (PFILE) + N) > (unsigned int) (PFILE)->token_buffer_size \
261 && (cpp_grow_buffer (PFILE, N), 0))
262
263/* Append string STR (of length N) to PFILE's output buffer.
264 Assume there is enough space. */
265#define CPP_PUTS_Q(PFILE, STR, N) \
266 do { memcpy ((PFILE)->limit, STR, (N)); (PFILE)->limit += (N); } while(0)
267/* Append string STR (of length N) to PFILE's output buffer. Make space. */
268#define CPP_PUTS(PFILE, STR, N) \
269 do { CPP_RESERVE(PFILE, N); CPP_PUTS_Q(PFILE, STR,N); } while(0)
270/* Append character CH to PFILE's output buffer. Assume sufficient space. */
271#define CPP_PUTC_Q(PFILE, CH) (*(PFILE)->limit++ = (CH))
272/* Append character CH to PFILE's output buffer. Make space if need be. */
273#define CPP_PUTC(PFILE, CH) \
274 do { CPP_RESERVE (PFILE, 1); CPP_PUTC_Q (PFILE, CH); } while(0)
275/* Make sure PFILE->limit is followed by '\0'. */
276#define CPP_NUL_TERMINATE_Q(PFILE) (*(PFILE)->limit = 0)
277#define CPP_NUL_TERMINATE(PFILE) \
278 do { CPP_RESERVE(PFILE, 1); *(PFILE)->limit = 0; } while(0)
279#define CPP_ADJUST_WRITTEN(PFILE,DELTA) ((PFILE)->limit += (DELTA))
280#define CPP_SET_WRITTEN(PFILE,N) ((PFILE)->limit = (PFILE)->token_buffer + (N))
281
282#define CPP_OPTIONS(PFILE) ((cpp_options*)(PFILE)->data)
283#define CPP_BUFFER(PFILE) ((PFILE)->buffer)
284#ifdef STATIC_BUFFERS
285#define CPP_PREV_BUFFER(BUFFER) ((BUFFER)+1)
286#define CPP_NULL_BUFFER(PFILE) (&(PFILE)->buffer_stack[CPP_STACK_MAX])
287#else
288#define CPP_PREV_BUFFER(BUFFER) ((BUFFER)->chain)
289#define CPP_NULL_BUFFER(PFILE) ((cpp_buffer*)0)
290#endif
291
292/* Pointed to by parse_file::data. */
293struct cpp_options {
294 const char *in_fname;
295
296 /* Name of output file, for error messages. */
297 const char *out_fname;
298
299 struct file_name_map_list *map_list;
300
301 /* Non-0 means -v, so print the full set of include dirs. */
302 char verbose;
303
304 /* Nonzero means use extra default include directories for C++. */
305
306 char cplusplus;
307
308 /* Nonzero means handle cplusplus style comments */
309
310 char cplusplus_comments;
311
312 /* Nonzero means handle #import, for objective C. */
313
314 char objc;
315
316 /* Nonzero means this is an assembly file, and allow
317 * unknown directives, which could be comments. */
318
319 int lang_asm;
320
321 /* Nonzero means turn NOTREACHED into #pragma NOTREACHED etc */
322
323 char for_lint;
324
325 /* Nonzero means handle CHILL comment syntax
326 * and output CHILL string delimiter for __DATE___ etc. */
327
328 char chill;
329
330 /* Nonzero means copy comments into the output file. */
331
332 char put_out_comments;
333
334 /* Nonzero means don't process the ANSI trigraph sequences. */
335
336 char no_trigraphs;
337
338 /* Nonzero means print the names of included files rather than
339 * the preprocessed output. 1 means just the #include "...",
340 * 2 means #include <...> as well. */
341
342 char print_deps;
343
344 /* Nonzero if missing .h files in -M output are assumed to be generated
345 * files and not errors. */
346
347 char print_deps_missing_files;
348
349 /* If true, fopen (deps_file, "a") else fopen (deps_file, "w"). */
350 char print_deps_append;
351
352 /* Nonzero means print names of header files (-H). */
353
354 char print_include_names;
355
356 /* Nonzero means try to make failure to fit ANSI C an error. */
357
358 char pedantic_errors;
359
360 /* Nonzero means don't print warning messages. -w. */
361
362 char inhibit_warnings;
363
364 /* Nonzero means warn if slash-star appears in a comment. */
365
366 char warn_comments;
367
368 /* Nonzero means warn if there are any trigraphs. */
369
370 char warn_trigraphs;
371
372 /* Nonzero means warn if #import is used. */
373
374 char warn_import;
375
376 /* Nonzero means warn if a macro argument is (or would be)
377 * stringified with -traditional. */
378
379 char warn_stringify;
380
381 /* Nonzero means turn warnings into errors. */
382
383 char warnings_are_errors;
384
385 /* Nonzero causes output not to be done,
386 * but directives such as #define that have side effects
387 * are still obeyed. */
388
389 char no_output;
390
391 /* Nonzero means don't output line number information. */
392
393 char no_line_commands;
394
395/* Nonzero means output the text in failing conditionals,
396 inside #failed ... #endfailed. */
397
398 char output_conditionals;
399
400 /* Nonzero means -I- has been seen,
401 * so don't look for #include "foo" the source-file directory. */
402 char ignore_srcdir;
403
404/* Zero means dollar signs are punctuation.
405 -$ stores 0; -traditional may store 1. Default is 1 for VMS, 0 otherwise.
406 This must be 0 for correct processing of this ANSI C program:
407 #define foo(a) #a
408 #define lose(b) foo (b)
409 #define test$
410 lose (test) */
411 char dollars_in_ident;
412#ifndef DOLLARS_IN_IDENTIFIERS
413#define DOLLARS_IN_IDENTIFIERS 1
414#endif
415
416 /* Nonzero means try to imitate old fashioned non-ANSI preprocessor. */
417 char traditional;
418
419 /* Nonzero means give all the error messages the ANSI standard requires. */
420 char pedantic;
421
422 char done_initializing;
423
424 struct file_name_list *include; /* First dir to search */
425 /* First dir to search for <file> */
426 /* This is the first element to use for #include <...>.
427 * If it is 0, use the entire chain for such includes. */
428 struct file_name_list *first_bracket_include;
429 /* This is the first element in the chain that corresponds to
430 * a directory of system header files. */
431 struct file_name_list *first_system_include;
432 struct file_name_list *last_include; /* Last in chain */
433
434 /* Chain of include directories to put at the end of the other chain. */
435 struct file_name_list *after_include;
436 struct file_name_list *last_after_include; /* Last in chain */
437
438 /* Chain to put at the start of the system include files. */
439 struct file_name_list *before_system;
440 struct file_name_list *last_before_system; /* Last in chain */
441
442 /* Directory prefix that should replace `/usr' in the standard
443 * include file directories. */
444 char *include_prefix;
445
446 char inhibit_predefs;
447 char no_standard_includes;
448 char no_standard_cplusplus_includes;
449
450/* dump_only means inhibit output of the preprocessed text
451 and instead output the definitions of all user-defined
452 macros in a form suitable for use as input to cccp.
453 dump_names means pass #define and the macro name through to output.
454 dump_definitions means pass the whole definition (plus #define) through
455*/
456
457 enum dump_type dump_macros;
458
459/* Nonzero means pass all #define and #undef directives which we actually
460 process through to the output stream. This feature is used primarily
461 to allow cc1 to record the #defines and #undefs for the sake of
462 debuggers which understand about preprocessor macros, but it may
463 also be useful with -E to figure out how symbols are defined, and
464 where they are defined. */
465 int debug_output;
466
467 /* Pending -D, -U and -A options, in reverse order. */
468 struct cpp_pending *pending;
469
470 /* File name which deps are being written to.
471 * This is 0 if deps are being written to stdout. */
472 char *deps_file;
473
474 /* Target-name to write with the dependency information. */
475 char *deps_target;
476};
477
478#define CPP_TRADITIONAL(PFILE) (CPP_OPTIONS(PFILE)-> traditional)
479#define CPP_PEDANTIC(PFILE) (CPP_OPTIONS (PFILE)->pedantic)
480#define CPP_PRINT_DEPS(PFILE) (CPP_OPTIONS (PFILE)->print_deps)
481
482/* Name under which this program was invoked. */
483
484extern char *progname;
485
486/* The structure of a node in the hash table. The hash table
487 has entries for all tokens defined by #define commands (type T_MACRO),
488 plus some special tokens like __LINE__ (these each have their own
489 type, and the appropriate code is run when that type of node is seen.
490 It does not contain control words like "#define", which are recognized
491 by a separate piece of code. */
492
493/* different flavors of hash nodes --- also used in keyword table */
494enum node_type {
495 T_DEFINE = 1, /* the `#define' keyword */
496 T_INCLUDE, /* the `#include' keyword */
497 T_INCLUDE_NEXT, /* the `#include_next' keyword */
498 T_IMPORT, /* the `#import' keyword */
499 T_IFDEF, /* the `#ifdef' keyword */
500 T_IFNDEF, /* the `#ifndef' keyword */
501 T_IF, /* the `#if' keyword */
502 T_ELSE, /* `#else' */
503 T_PRAGMA, /* `#pragma' */
504 T_ELIF, /* `#elif' */
505 T_UNDEF, /* `#undef' */
506 T_LINE, /* `#line' */
507 T_ERROR, /* `#error' */
508 T_WARNING, /* `#warning' */
509 T_ENDIF, /* `#endif' */
510 T_SCCS, /* `#sccs', used on system V. */
511 T_IDENT, /* `#ident', used on system V. */
512 T_ASSERT, /* `#assert', taken from system V. */
513 T_UNASSERT, /* `#unassert', taken from system V. */
514 T_SPECLINE, /* special symbol `__LINE__' */
515 T_DATE, /* `__DATE__' */
516 T_FILE, /* `__FILE__' */
517 T_BASE_FILE, /* `__BASE_FILE__' */
518 T_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */
519 T_VERSION, /* `__VERSION__' */
520 T_SIZE_TYPE, /* `__SIZE_TYPE__' */
521 T_PTRDIFF_TYPE, /* `__PTRDIFF_TYPE__' */
522 T_WCHAR_TYPE, /* `__WCHAR_TYPE__' */
523 T_USER_LABEL_PREFIX_TYPE, /* `__USER_LABEL_PREFIX__' */
524 T_REGISTER_PREFIX_TYPE, /* `__REGISTER_PREFIX__' */
525 T_TIME, /* `__TIME__' */
526 T_CONST, /* Constant value, used by `__STDC__' */
527 T_MACRO, /* macro defined by `#define' */
528 T_DISABLED, /* macro temporarily turned off for rescan */
529 T_SPEC_DEFINED, /* special `defined' macro for use in #if statements */
530 T_PCSTRING, /* precompiled string (hashval is KEYDEF *) */
531 T_UNUSED /* Used for something not defined. */
532};
533
534/* Structure allocated for every #define. For a simple replacement
535 such as
536 #define foo bar ,
537 nargs = -1, the `pattern' list is null, and the expansion is just
538 the replacement text. Nargs = 0 means a functionlike macro with no args,
539 e.g.,
540 #define getchar() getc (stdin) .
541 When there are args, the expansion is the replacement text with the
542 args squashed out, and the reflist is a list describing how to
543 build the output from the input: e.g., "3 chars, then the 1st arg,
544 then 9 chars, then the 3rd arg, then 0 chars, then the 2nd arg".
545 The chars here come from the expansion. Whatever is left of the
546 expansion after the last arg-occurrence is copied after that arg.
547 Note that the reflist can be arbitrarily long---
548 its length depends on the number of times the arguments appear in
549 the replacement text, not how many args there are. Example:
550 #define f(x) x+x+x+x+x+x+x would have replacement text "++++++" and
551 pattern list
552 { (0, 1), (1, 1), (1, 1), ..., (1, 1), NULL }
553 where (x, y) means (nchars, argno). */
554
555typedef struct reflist reflist;
556struct reflist {
557 reflist *next;
558 char stringify; /* nonzero if this arg was preceded by a
559 * # operator. */
560 char raw_before; /* Nonzero if a ## operator before arg. */
561 char raw_after; /* Nonzero if a ## operator after arg. */
562 char rest_args; /* Nonzero if this arg. absorbs the rest */
563 int nchars; /* Number of literal chars to copy before
564 * this arg occurrence. */
565 int argno; /* Number of arg to substitute (origin-0) */
566};
567
568typedef struct definition DEFINITION;
569struct definition {
570 int nargs;
571 int length; /* length of expansion string */
572 int predefined; /* True if the macro was builtin or */
573 /* came from the command line */
574 unsigned char *expansion;
575 int line; /* Line number of definition */
576 const char *file; /* File of definition */
577 char rest_args; /* Nonzero if last arg. absorbs the rest */
578 reflist *pattern;
579 union {
580 /* Names of macro args, concatenated in reverse order
581 * with comma-space between them.
582 * The only use of this is that we warn on redefinition
583 * if this differs between the old and new definitions. */
584 unsigned char *argnames;
585 } args;
586};
587
588extern unsigned char is_idchar[256];
589
590/* Stack of conditionals currently in progress
591 (including both successful and failing conditionals). */
592
593struct if_stack {
594 struct if_stack *next; /* for chaining to the next stack frame */
595 const char *fname; /* copied from input when frame is made */
596 int lineno; /* similarly */
597 int if_succeeded; /* true if a leg of this if-group
598 * has been passed through rescan */
599 unsigned char *control_macro; /* For #ifndef at start of file,
600 * this is the macro name tested. */
601 enum node_type type; /* type of last directive seen in this group */
602};
603typedef struct if_stack IF_STACK_FRAME;
604
605extern void cpp_buf_line_and_col(cpp_buffer *, long *, long *);
606extern cpp_buffer *cpp_file_buffer(cpp_reader *);
607extern void cpp_define(cpp_reader *, unsigned char *);
608
609extern void cpp_error(cpp_reader * pfile, const char *msg, ...);
610extern void cpp_warning(cpp_reader * pfile, const char *msg, ...);
611extern void cpp_pedwarn(cpp_reader * pfile, const char *msg, ...);
612extern void cpp_fatal(const char *msg, ...);
613extern void cpp_file_line_for_message(cpp_reader * pfile,
614 const char *filename, int line,
615 int column);
616extern void cpp_perror_with_name(cpp_reader * pfile, const char *name);
617extern void cpp_pfatal_with_name(cpp_reader * pfile, const char *name);
618extern void cpp_message(cpp_reader * pfile, int is_error,
619 const char *msg, ...);
620extern void cpp_message_v(cpp_reader * pfile, int is_error,
621 const char *msg, va_list args);
622
623extern void cpp_grow_buffer(cpp_reader * pfile, long n);
624extern int cpp_parse_escape(cpp_reader * pfile, char **string_ptr);
625
626void cpp_print_containing_files(cpp_reader * pfile);
627HOST_WIDE_INT cpp_parse_expr(cpp_reader * pfile);
628void skip_rest_of_line(cpp_reader * pfile);
629void init_parse_file(cpp_reader * pfile);
630void init_parse_options(struct cpp_options *opts);
631int push_parse_file(cpp_reader * pfile, const char *fname);
632void cpp_finish(cpp_reader * pfile);
633int cpp_read_check_assertion(cpp_reader * pfile);
634
635void *xmalloc(unsigned size);
636void *xrealloc(void *old, unsigned size);
637void *xcalloc(unsigned number, unsigned size);
638
639#ifdef __EMX__
640#define PATH_SEPARATOR ';'
641#endif
diff --git a/libraries/edje/src/bin/epp/cppmain.c b/libraries/edje/src/bin/epp/cppmain.c
new file mode 100644
index 0000000..45b67b5
--- /dev/null
+++ b/libraries/edje/src/bin/epp/cppmain.c
@@ -0,0 +1,142 @@
1/* CPP main program, using CPP Library.
2 * Copyright (C) 1995 Free Software Foundation, Inc.
3 * Written by Per Bothner, 1994-95.
4 * Copyright (C) 2003-2011 Kim Woelders
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
9 * later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 * In other words, you are welcome to use, share and improve this program.
21 * You are forbidden to forbid anyone else to use, share and improve
22 * what you give them. Help stamp out software-hoarding! */
23
24#ifdef HAVE_CONFIG_H
25# include <config.h>
26#endif
27
28#include <stdio.h>
29#include <string.h>
30#include <stdlib.h>
31
32#include "cpplib.h"
33
34#define EPP_DEBUG 0
35
36cpp_reader parse_in;
37cpp_options options;
38
39int
40main(int argc, char **argv)
41{
42 char *p;
43 int i;
44 int argi = 1; /* Next argument to handle. */
45 struct cpp_options *opts = &options;
46 enum cpp_token kind;
47 int got_text;
48
49 p = argv[0] + strlen(argv[0]);
50#ifndef __EMX__
51 while (p != argv[0] && p[-1] != '/')
52#else
53 while (p != argv[0] && p[-1] != '/' && p[-1] != '\\')
54#endif
55 --p;
56 progname = p;
57
58 init_parse_file(&parse_in);
59 parse_in.data = opts;
60
61 init_parse_options(opts);
62
63 argi += cpp_handle_options(&parse_in, argc - argi, argv + argi);
64 if (argi < argc)
65 cpp_fatal("Invalid option `%s'", argv[argi]);
66 parse_in.show_column = 1;
67
68 i = push_parse_file(&parse_in, opts->in_fname);
69 if (i != SUCCESS_EXIT_CODE)
70 return i;
71
72 /* Now that we know the input file is valid, open the output. */
73
74 if (!opts->out_fname || !strcmp(opts->out_fname, ""))
75 opts->out_fname = "stdout";
76 else if (!freopen(opts->out_fname, "w", stdout))
77 cpp_pfatal_with_name(&parse_in, opts->out_fname);
78
79 got_text = 0;
80 for (i = 0;; i++)
81 {
82 kind = cpp_get_token(&parse_in);
83#if EPP_DEBUG
84 fprintf(stderr, "%03d: kind=%d len=%d out=%d text=%d\n", i,
85 kind, CPP_WRITTEN(&parse_in), !opts->no_output, got_text);
86#endif
87 switch (kind)
88 {
89 case CPP_EOF:
90 goto done;
91
92 case CPP_HSPACE:
93 continue;
94
95 case CPP_VSPACE:
96 break;
97
98 default:
99 case CPP_OTHER:
100 case CPP_NAME:
101 case CPP_NUMBER:
102 case CPP_CHAR:
103 case CPP_STRING:
104 case CPP_LPAREN:
105 case CPP_RPAREN:
106 case CPP_LBRACE:
107 case CPP_RBRACE:
108 case CPP_COMMA:
109 case CPP_SEMICOLON:
110 case CPP_3DOTS:
111 got_text = 1;
112 continue;
113
114 case CPP_COMMENT:
115 case CPP_DIRECTIVE:
116 case CPP_POP:
117 continue;
118 }
119#if EPP_DEBUG
120 fprintf(stderr, "'");
121 fwrite(parse_in.token_buffer, 1, CPP_WRITTEN(&parse_in), stderr);
122 fprintf(stderr, "'\n");
123#endif
124 if (!opts->no_output)
125 {
126 size_t n;
127
128 n = CPP_WRITTEN(&parse_in);
129 if (fwrite(parse_in.token_buffer, 1, n, stdout) != n)
130 exit(FATAL_EXIT_CODE);
131 }
132 parse_in.limit = parse_in.token_buffer;
133 got_text = 0;
134 }
135
136 done:
137 cpp_finish(&parse_in);
138
139 if (parse_in.errors)
140 exit(FATAL_EXIT_CODE);
141 exit(SUCCESS_EXIT_CODE);
142}
diff --git a/libraries/edje/src/examples/Makefile.am b/libraries/edje/src/examples/Makefile.am
new file mode 100644
index 0000000..20e2c81
--- /dev/null
+++ b/libraries/edje/src/examples/Makefile.am
@@ -0,0 +1,107 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3pkglibdir = $(datadir)/$(PACKAGE)/examples
4if ENABLE_MULTISENSE
5MULTISENSE_EDC_FILE = multisense.edc
6SND_DIR = -sd $(srcdir)
7endif
8#put here all EDCs one needs to the examples
9EDCS = basic.edc \
10 swallow.edc \
11 text.edc \
12 table.edc \
13 box.edc \
14 drag.edc \
15 signals-messages.edc \
16 color-class.edc \
17 perspective.edc \
18 animations.edc \
19 lua_script.edc \
20 sigtest.edc \
21 $(MULTISENSE_EDC_FILE)
22
23filesdir = $(datadir)/$(PACKAGE)/examples
24files_DATA =
25
26if BUILD_EXAMPLES
27
28AM_CPPFLAGS = \
29-I. \
30-I$(top_srcdir)/src/lib \
31-I$(top_srcdir)/src/lib/include \
32-DPACKAGE_BIN_DIR=\"$(bindir)\" \
33-DPACKAGE_LIB_DIR=\"$(libdir)\" \
34-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
35-DPACKAGE_EXAMPLES_DIR=\"$(datadir)/$(PACKAGE)/examples\"
36
37pkglib_PROGRAMS =
38
39#the ones using ecore_evas follow
40AM_CPPFLAGS += @EDJE_CFLAGS@
41
42pkglib_PROGRAMS += \
43 edje-basic \
44 edje-swallow \
45 edje-text \
46 edje-table \
47 edje-box \
48 edje-box2 \
49 edje-drag\
50 edje-signals-messages \
51 edje-color-class \
52 edje-perspective \
53 edje-animations \
54 sigtest
55
56LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_LIBS@
57
58.edc.edj:
59 $(edje_cc) -v -id $(srcdir) $(SND_DIR) $< $(builddir)/$(@F)
60
61EDJS = $(EDCS:%.edc=%.edj)
62
63files_DATA += $(EDJS)
64
65endif # if BUILD_EXAMPLES
66
67if INSTALL_EXAMPLES
68
69#put here additional data when installing examples
70files_DATA += \
71 $(srcdir)/bubble.png \
72 $(srcdir)/red.png \
73 $(srcdir)/test.png \
74 $(srcdir)/Vera.ttf
75
76files_DATA += \
77 $(EDCS) \
78 $(srcdir)/edje-basic.c \
79 $(srcdir)/edje-swallow.c \
80 $(srcdir)/edje-text.c \
81 $(srcdir)/edje-table.c \
82 $(srcdir)/edje-box.c \
83 $(srcdir)/edje-box2.c \
84 $(srcdir)/edje-drag.c \
85 $(srcdir)/edje-signals-messages.c \
86 $(srcdir)/edje-color-class.c \
87 $(srcdir)/edje-perspective.c \
88 $(srcdir)/edje-animations.c \
89 $(srcdir)/sigtest.c
90endif
91
92EXTRA_DIST = $(EDCS) \
93 $(srcdir)/bubble.png \
94 $(srcdir)/red.png \
95 $(srcdir)/test.png \
96 $(srcdir)/edje-basic.c \
97 $(srcdir)/edje-swallow.c \
98 $(srcdir)/edje-text.c \
99 $(srcdir)/edje-table.c \
100 $(srcdir)/edje-box.c \
101 $(srcdir)/edje-box2.c \
102 $(srcdir)/edje-drag.c \
103 $(srcdir)/edje-signals-messages.c \
104 $(srcdir)/edje-color-class.c \
105 $(srcdir)/edje-perspective.c \
106 $(srcdir)/edje-animations.c \
107 $(srcdir)/sigtest.c
diff --git a/libraries/edje/src/examples/Makefile.in b/libraries/edje/src/examples/Makefile.in
new file mode 100644
index 0000000..bde628f
--- /dev/null
+++ b/libraries/edje/src/examples/Makefile.in
@@ -0,0 +1,827 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18
19VPATH = @srcdir@
20pkgdatadir = $(datadir)/@PACKAGE@
21pkgincludedir = $(includedir)/@PACKAGE@
22pkglibexecdir = $(libexecdir)/@PACKAGE@
23am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
24install_sh_DATA = $(install_sh) -c -m 644
25install_sh_PROGRAM = $(install_sh) -c
26install_sh_SCRIPT = $(install_sh) -c
27INSTALL_HEADER = $(INSTALL_DATA)
28transform = $(program_transform_name)
29NORMAL_INSTALL = :
30PRE_INSTALL = :
31POST_INSTALL = :
32NORMAL_UNINSTALL = :
33PRE_UNINSTALL = :
34POST_UNINSTALL = :
35build_triplet = @build@
36host_triplet = @host@
37@BUILD_EXAMPLES_TRUE@pkglib_PROGRAMS = edje-basic$(EXEEXT) \
38@BUILD_EXAMPLES_TRUE@ edje-swallow$(EXEEXT) edje-text$(EXEEXT) \
39@BUILD_EXAMPLES_TRUE@ edje-table$(EXEEXT) edje-box$(EXEEXT) \
40@BUILD_EXAMPLES_TRUE@ edje-box2$(EXEEXT) edje-drag$(EXEEXT) \
41@BUILD_EXAMPLES_TRUE@ edje-signals-messages$(EXEEXT) \
42@BUILD_EXAMPLES_TRUE@ edje-color-class$(EXEEXT) \
43@BUILD_EXAMPLES_TRUE@ edje-perspective$(EXEEXT) \
44@BUILD_EXAMPLES_TRUE@ edje-animations$(EXEEXT) sigtest$(EXEEXT)
45@BUILD_EXAMPLES_TRUE@am__append_1 = $(EDJS)
46
47#put here additional data when installing examples
48@INSTALL_EXAMPLES_TRUE@am__append_2 = $(srcdir)/bubble.png \
49@INSTALL_EXAMPLES_TRUE@ $(srcdir)/red.png $(srcdir)/test.png \
50@INSTALL_EXAMPLES_TRUE@ $(srcdir)/Vera.ttf $(EDCS) \
51@INSTALL_EXAMPLES_TRUE@ $(srcdir)/edje-basic.c \
52@INSTALL_EXAMPLES_TRUE@ $(srcdir)/edje-swallow.c \
53@INSTALL_EXAMPLES_TRUE@ $(srcdir)/edje-text.c \
54@INSTALL_EXAMPLES_TRUE@ $(srcdir)/edje-table.c \
55@INSTALL_EXAMPLES_TRUE@ $(srcdir)/edje-box.c \
56@INSTALL_EXAMPLES_TRUE@ $(srcdir)/edje-box2.c \
57@INSTALL_EXAMPLES_TRUE@ $(srcdir)/edje-drag.c \
58@INSTALL_EXAMPLES_TRUE@ $(srcdir)/edje-signals-messages.c \
59@INSTALL_EXAMPLES_TRUE@ $(srcdir)/edje-color-class.c \
60@INSTALL_EXAMPLES_TRUE@ $(srcdir)/edje-perspective.c \
61@INSTALL_EXAMPLES_TRUE@ $(srcdir)/edje-animations.c \
62@INSTALL_EXAMPLES_TRUE@ $(srcdir)/sigtest.c
63subdir = src/examples
64DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
65ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
66am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
67 $(top_srcdir)/m4/efl_binary.m4 \
68 $(top_srcdir)/m4/efl_coverage.m4 \
69 $(top_srcdir)/m4/efl_doxygen.m4 \
70 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
71 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
72 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
73 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
74am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
75 $(ACLOCAL_M4)
76mkinstalldirs = $(install_sh) -d
77CONFIG_HEADER = $(top_builddir)/config.h
78CONFIG_CLEAN_FILES =
79CONFIG_CLEAN_VPATH_FILES =
80am__installdirs = "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(filesdir)"
81PROGRAMS = $(pkglib_PROGRAMS)
82edje_animations_SOURCES = edje-animations.c
83edje_animations_OBJECTS = edje-animations.$(OBJEXT)
84edje_animations_LDADD = $(LDADD)
85@BUILD_EXAMPLES_TRUE@edje_animations_DEPENDENCIES = \
86@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libedje.la
87AM_V_lt = $(am__v_lt_$(V))
88am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
89am__v_lt_0 = --silent
90edje_basic_SOURCES = edje-basic.c
91edje_basic_OBJECTS = edje-basic.$(OBJEXT)
92edje_basic_LDADD = $(LDADD)
93@BUILD_EXAMPLES_TRUE@edje_basic_DEPENDENCIES = \
94@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libedje.la
95edje_box_SOURCES = edje-box.c
96edje_box_OBJECTS = edje-box.$(OBJEXT)
97edje_box_LDADD = $(LDADD)
98@BUILD_EXAMPLES_TRUE@edje_box_DEPENDENCIES = \
99@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libedje.la
100edje_box2_SOURCES = edje-box2.c
101edje_box2_OBJECTS = edje-box2.$(OBJEXT)
102edje_box2_LDADD = $(LDADD)
103@BUILD_EXAMPLES_TRUE@edje_box2_DEPENDENCIES = \
104@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libedje.la
105edje_color_class_SOURCES = edje-color-class.c
106edje_color_class_OBJECTS = edje-color-class.$(OBJEXT)
107edje_color_class_LDADD = $(LDADD)
108@BUILD_EXAMPLES_TRUE@edje_color_class_DEPENDENCIES = \
109@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libedje.la
110edje_drag_SOURCES = edje-drag.c
111edje_drag_OBJECTS = edje-drag.$(OBJEXT)
112edje_drag_LDADD = $(LDADD)
113@BUILD_EXAMPLES_TRUE@edje_drag_DEPENDENCIES = \
114@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libedje.la
115edje_perspective_SOURCES = edje-perspective.c
116edje_perspective_OBJECTS = edje-perspective.$(OBJEXT)
117edje_perspective_LDADD = $(LDADD)
118@BUILD_EXAMPLES_TRUE@edje_perspective_DEPENDENCIES = \
119@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libedje.la
120edje_signals_messages_SOURCES = edje-signals-messages.c
121edje_signals_messages_OBJECTS = edje-signals-messages.$(OBJEXT)
122edje_signals_messages_LDADD = $(LDADD)
123@BUILD_EXAMPLES_TRUE@edje_signals_messages_DEPENDENCIES = \
124@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libedje.la
125edje_swallow_SOURCES = edje-swallow.c
126edje_swallow_OBJECTS = edje-swallow.$(OBJEXT)
127edje_swallow_LDADD = $(LDADD)
128@BUILD_EXAMPLES_TRUE@edje_swallow_DEPENDENCIES = \
129@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libedje.la
130edje_table_SOURCES = edje-table.c
131edje_table_OBJECTS = edje-table.$(OBJEXT)
132edje_table_LDADD = $(LDADD)
133@BUILD_EXAMPLES_TRUE@edje_table_DEPENDENCIES = \
134@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libedje.la
135edje_text_SOURCES = edje-text.c
136edje_text_OBJECTS = edje-text.$(OBJEXT)
137edje_text_LDADD = $(LDADD)
138@BUILD_EXAMPLES_TRUE@edje_text_DEPENDENCIES = \
139@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libedje.la
140sigtest_SOURCES = sigtest.c
141sigtest_OBJECTS = sigtest.$(OBJEXT)
142sigtest_LDADD = $(LDADD)
143@BUILD_EXAMPLES_TRUE@sigtest_DEPENDENCIES = \
144@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libedje.la
145DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
146depcomp = $(SHELL) $(top_srcdir)/depcomp
147am__depfiles_maybe = depfiles
148am__mv = mv -f
149COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
150 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
151LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
152 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
153 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
154 $(AM_CFLAGS) $(CFLAGS)
155AM_V_CC = $(am__v_CC_$(V))
156am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
157am__v_CC_0 = @echo " CC " $@;
158AM_V_at = $(am__v_at_$(V))
159am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
160am__v_at_0 = @
161CCLD = $(CC)
162LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
163 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
164 $(AM_LDFLAGS) $(LDFLAGS) -o $@
165AM_V_CCLD = $(am__v_CCLD_$(V))
166am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
167am__v_CCLD_0 = @echo " CCLD " $@;
168AM_V_GEN = $(am__v_GEN_$(V))
169am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
170am__v_GEN_0 = @echo " GEN " $@;
171SOURCES = edje-animations.c edje-basic.c edje-box.c edje-box2.c \
172 edje-color-class.c edje-drag.c edje-perspective.c \
173 edje-signals-messages.c edje-swallow.c edje-table.c \
174 edje-text.c sigtest.c
175DIST_SOURCES = edje-animations.c edje-basic.c edje-box.c edje-box2.c \
176 edje-color-class.c edje-drag.c edje-perspective.c \
177 edje-signals-messages.c edje-swallow.c edje-table.c \
178 edje-text.c sigtest.c
179am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
180am__vpath_adj = case $$p in \
181 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
182 *) f=$$p;; \
183 esac;
184am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
185am__install_max = 40
186am__nobase_strip_setup = \
187 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
188am__nobase_strip = \
189 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
190am__nobase_list = $(am__nobase_strip_setup); \
191 for p in $$list; do echo "$$p $$p"; done | \
192 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
193 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
194 if (++n[$$2] == $(am__install_max)) \
195 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
196 END { for (dir in files) print dir, files[dir] }'
197am__base_list = \
198 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
199 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
200DATA = $(files_DATA)
201ETAGS = etags
202CTAGS = ctags
203DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
204pkglibdir = $(datadir)/$(PACKAGE)/examples
205ACLOCAL = @ACLOCAL@
206ALLOCA = @ALLOCA@
207ALSA_CFLAGS = @ALSA_CFLAGS@
208ALSA_LIBS = @ALSA_LIBS@
209AMTAR = @AMTAR@
210AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
211AR = @AR@
212AS = @AS@
213AUTOCONF = @AUTOCONF@
214AUTOHEADER = @AUTOHEADER@
215AUTOMAKE = @AUTOMAKE@
216AWK = @AWK@
217CC = @CC@
218CCDEPMODE = @CCDEPMODE@
219CFLAGS = @CFLAGS@
220CHECK_CFLAGS = @CHECK_CFLAGS@
221CHECK_LIBS = @CHECK_LIBS@
222CPP = @CPP@
223CPPFLAGS = @CPPFLAGS@
224CYGPATH_W = @CYGPATH_W@
225DEFS = @DEFS@
226DEPDIR = @DEPDIR@
227DLLTOOL = @DLLTOOL@
228DSYMUTIL = @DSYMUTIL@
229DUMPBIN = @DUMPBIN@
230ECHO_C = @ECHO_C@
231ECHO_N = @ECHO_N@
232ECHO_T = @ECHO_T@
233ECORE_IMF_CFLAGS = @ECORE_IMF_CFLAGS@
234ECORE_IMF_LIBS = @ECORE_IMF_LIBS@
235EDJE_CC_CFLAGS = @EDJE_CC_CFLAGS@
236EDJE_CC_LIBS = @EDJE_CC_LIBS@
237EDJE_CC_PRG = @EDJE_CC_PRG@
238EDJE_CFLAGS = @EDJE_CFLAGS@
239EDJE_DECC_CFLAGS = @EDJE_DECC_CFLAGS@
240EDJE_DECC_LIBS = @EDJE_DECC_LIBS@
241EDJE_DECC_PRG = @EDJE_DECC_PRG@
242EDJE_EXTERNAL_INSPECTOR_CFLAGS = @EDJE_EXTERNAL_INSPECTOR_CFLAGS@
243EDJE_EXTERNAL_INSPECTOR_LIBS = @EDJE_EXTERNAL_INSPECTOR_LIBS@
244EDJE_EXTERNAL_INSPECTOR_PRG = @EDJE_EXTERNAL_INSPECTOR_PRG@
245EDJE_INSPECTOR_CFLAGS = @EDJE_INSPECTOR_CFLAGS@
246EDJE_INSPECTOR_LIBS = @EDJE_INSPECTOR_LIBS@
247EDJE_INSPECTOR_PRG = @EDJE_INSPECTOR_PRG@
248EDJE_LIBS = @EDJE_LIBS@
249EDJE_PLAYER_CFLAGS = @EDJE_PLAYER_CFLAGS@
250EDJE_PLAYER_LIBS = @EDJE_PLAYER_LIBS@
251EDJE_PLAYER_PRG = @EDJE_PLAYER_PRG@
252EDJE_RECC_PRG = @EDJE_RECC_PRG@
253EFL_COVERAGE_CFLAGS = @EFL_COVERAGE_CFLAGS@
254EFL_COVERAGE_LIBS = @EFL_COVERAGE_LIBS@
255EFL_EDJE_BUILD = @EFL_EDJE_BUILD@
256EGREP = @EGREP@
257EVIL_CFLAGS = @EVIL_CFLAGS@
258EVIL_LIBS = @EVIL_LIBS@
259EXEEXT = @EXEEXT@
260FGREP = @FGREP@
261FLAC_CFLAGS = @FLAC_CFLAGS@
262FLAC_LIBS = @FLAC_LIBS@
263GREP = @GREP@
264INSTALL = @INSTALL@
265INSTALL_DATA = @INSTALL_DATA@
266INSTALL_PROGRAM = @INSTALL_PROGRAM@
267INSTALL_SCRIPT = @INSTALL_SCRIPT@
268INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
269LD = @LD@
270LDFLAGS = @LDFLAGS@
271LIBOBJS = @LIBOBJS@
272LIBS = @LIBS@
273LIBTOOL = @LIBTOOL@
274LIPO = @LIPO@
275LN_S = @LN_S@
276LTLIBOBJS = @LTLIBOBJS@
277LUA_CFLAGS = @LUA_CFLAGS@
278LUA_LIBS = @LUA_LIBS@
279MAKEINFO = @MAKEINFO@
280MINIMAL_CFLAGS = @MINIMAL_CFLAGS@
281MINIMAL_LIBS = @MINIMAL_LIBS@
282MKDIR_P = @MKDIR_P@
283MODULE_ARCH = @MODULE_ARCH@
284NM = @NM@
285NMEDIT = @NMEDIT@
286OBJDUMP = @OBJDUMP@
287OBJEXT = @OBJEXT@
288OTOOL = @OTOOL@
289OTOOL64 = @OTOOL64@
290PACKAGE = @PACKAGE@
291PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
292PACKAGE_NAME = @PACKAGE_NAME@
293PACKAGE_STRING = @PACKAGE_STRING@
294PACKAGE_TARNAME = @PACKAGE_TARNAME@
295PACKAGE_URL = @PACKAGE_URL@
296PACKAGE_VERSION = @PACKAGE_VERSION@
297PATH_SEPARATOR = @PATH_SEPARATOR@
298PKG_CONFIG = @PKG_CONFIG@
299PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
300PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
301PYTHON = @PYTHON@
302PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
303PYTHON_PLATFORM = @PYTHON_PLATFORM@
304PYTHON_PREFIX = @PYTHON_PREFIX@
305PYTHON_VERSION = @PYTHON_VERSION@
306RANLIB = @RANLIB@
307REMIX_CFLAGS = @REMIX_CFLAGS@
308REMIX_LIBS = @REMIX_LIBS@
309REMIX_PLUGIN_DIR = @REMIX_PLUGIN_DIR@
310SED = @SED@
311SET_MAKE = @SET_MAKE@
312SHELL = @SHELL@
313SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
314SNDFILE_LIBS = @SNDFILE_LIBS@
315STRIP = @STRIP@
316VERSION = @VERSION@
317VMAJ = @VMAJ@
318VORBISENC_CFLAGS = @VORBISENC_CFLAGS@
319VORBISENC_LIBS = @VORBISENC_LIBS@
320abs_builddir = @abs_builddir@
321abs_srcdir = @abs_srcdir@
322abs_top_builddir = @abs_top_builddir@
323abs_top_srcdir = @abs_top_srcdir@
324ac_ct_CC = @ac_ct_CC@
325ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
326am__include = @am__include@
327am__leading_dot = @am__leading_dot@
328am__quote = @am__quote@
329am__tar = @am__tar@
330am__untar = @am__untar@
331bindir = @bindir@
332build = @build@
333build_alias = @build_alias@
334build_cpu = @build_cpu@
335build_os = @build_os@
336build_vendor = @build_vendor@
337builddir = @builddir@
338datadir = @datadir@
339datarootdir = @datarootdir@
340docdir = @docdir@
341dvidir = @dvidir@
342edje_cc = @edje_cc@
343efl_doxygen = @efl_doxygen@
344efl_have_doxygen = @efl_have_doxygen@
345exec_prefix = @exec_prefix@
346have_lcov = @have_lcov@
347host = @host@
348host_alias = @host_alias@
349host_cpu = @host_cpu@
350host_os = @host_os@
351host_vendor = @host_vendor@
352htmldir = @htmldir@
353includedir = @includedir@
354infodir = @infodir@
355install_sh = @install_sh@
356libdir = @libdir@
357libexecdir = @libexecdir@
358localedir = @localedir@
359localstatedir = @localstatedir@
360lt_ECHO = @lt_ECHO@
361lt_enable_auto_import = @lt_enable_auto_import@
362lua_libs = @lua_libs@
363mandir = @mandir@
364mkdir_p = @mkdir_p@
365oldincludedir = @oldincludedir@
366pdfdir = @pdfdir@
367pkgconfig_requires_private = @pkgconfig_requires_private@
368pkgpyexecdir = @pkgpyexecdir@
369pkgpythondir = @pkgpythondir@
370prefix = @prefix@
371program_transform_name = @program_transform_name@
372psdir = @psdir@
373pyexecdir = @pyexecdir@
374pythondir = @pythondir@
375release_info = @release_info@
376requirement_edje = @requirement_edje@
377sbindir = @sbindir@
378sharedstatedir = @sharedstatedir@
379srcdir = @srcdir@
380sysconfdir = @sysconfdir@
381target_alias = @target_alias@
382top_build_prefix = @top_build_prefix@
383top_builddir = @top_builddir@
384top_srcdir = @top_srcdir@
385version_info = @version_info@
386vimdir = @vimdir@
387MAINTAINERCLEANFILES = Makefile.in
388@ENABLE_MULTISENSE_TRUE@MULTISENSE_EDC_FILE = multisense.edc
389@ENABLE_MULTISENSE_TRUE@SND_DIR = -sd $(srcdir)
390#put here all EDCs one needs to the examples
391EDCS = basic.edc \
392 swallow.edc \
393 text.edc \
394 table.edc \
395 box.edc \
396 drag.edc \
397 signals-messages.edc \
398 color-class.edc \
399 perspective.edc \
400 animations.edc \
401 lua_script.edc \
402 sigtest.edc \
403 $(MULTISENSE_EDC_FILE)
404
405filesdir = $(datadir)/$(PACKAGE)/examples
406files_DATA = $(am__append_1) $(am__append_2)
407
408#the ones using ecore_evas follow
409@BUILD_EXAMPLES_TRUE@AM_CPPFLAGS = -I. -I$(top_srcdir)/src/lib \
410@BUILD_EXAMPLES_TRUE@ -I$(top_srcdir)/src/lib/include \
411@BUILD_EXAMPLES_TRUE@ -DPACKAGE_BIN_DIR=\"$(bindir)\" \
412@BUILD_EXAMPLES_TRUE@ -DPACKAGE_LIB_DIR=\"$(libdir)\" \
413@BUILD_EXAMPLES_TRUE@ -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
414@BUILD_EXAMPLES_TRUE@ -DPACKAGE_EXAMPLES_DIR=\"$(datadir)/$(PACKAGE)/examples\" \
415@BUILD_EXAMPLES_TRUE@ @EDJE_CFLAGS@ $(am__empty)
416@BUILD_EXAMPLES_TRUE@LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_LIBS@
417@BUILD_EXAMPLES_TRUE@EDJS = $(EDCS:%.edc=%.edj)
418EXTRA_DIST = $(EDCS) \
419 $(srcdir)/bubble.png \
420 $(srcdir)/red.png \
421 $(srcdir)/test.png \
422 $(srcdir)/edje-basic.c \
423 $(srcdir)/edje-swallow.c \
424 $(srcdir)/edje-text.c \
425 $(srcdir)/edje-table.c \
426 $(srcdir)/edje-box.c \
427 $(srcdir)/edje-box2.c \
428 $(srcdir)/edje-drag.c \
429 $(srcdir)/edje-signals-messages.c \
430 $(srcdir)/edje-color-class.c \
431 $(srcdir)/edje-perspective.c \
432 $(srcdir)/edje-animations.c \
433 $(srcdir)/sigtest.c
434
435all: all-am
436
437.SUFFIXES:
438.SUFFIXES: .c .edc .edj .lo .o .obj
439$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
440 @for dep in $?; do \
441 case '$(am__configure_deps)' in \
442 *$$dep*) \
443 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
444 && { if test -f $@; then exit 0; else break; fi; }; \
445 exit 1;; \
446 esac; \
447 done; \
448 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/examples/Makefile'; \
449 $(am__cd) $(top_srcdir) && \
450 $(AUTOMAKE) --gnu src/examples/Makefile
451.PRECIOUS: Makefile
452Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
453 @case '$?' in \
454 *config.status*) \
455 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
456 *) \
457 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
458 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
459 esac;
460
461$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
462 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
463
464$(top_srcdir)/configure: $(am__configure_deps)
465 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
466$(ACLOCAL_M4): $(am__aclocal_m4_deps)
467 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
468$(am__aclocal_m4_deps):
469install-pkglibPROGRAMS: $(pkglib_PROGRAMS)
470 @$(NORMAL_INSTALL)
471 test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)"
472 @list='$(pkglib_PROGRAMS)'; test -n "$(pkglibdir)" || list=; \
473 for p in $$list; do echo "$$p $$p"; done | \
474 sed 's/$(EXEEXT)$$//' | \
475 while read p p1; do if test -f $$p || test -f $$p1; \
476 then echo "$$p"; echo "$$p"; else :; fi; \
477 done | \
478 sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
479 -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
480 sed 'N;N;N;s,\n, ,g' | \
481 $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
482 { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
483 if ($$2 == $$4) files[d] = files[d] " " $$1; \
484 else { print "f", $$3 "/" $$4, $$1; } } \
485 END { for (d in files) print "f", d, files[d] }' | \
486 while read type dir files; do \
487 if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
488 test -z "$$files" || { \
489 echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(pkglibdir)$$dir'"; \
490 $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(pkglibdir)$$dir" || exit $$?; \
491 } \
492 ; done
493
494uninstall-pkglibPROGRAMS:
495 @$(NORMAL_UNINSTALL)
496 @list='$(pkglib_PROGRAMS)'; test -n "$(pkglibdir)" || list=; \
497 files=`for p in $$list; do echo "$$p"; done | \
498 sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
499 -e 's/$$/$(EXEEXT)/' `; \
500 test -n "$$list" || exit 0; \
501 echo " ( cd '$(DESTDIR)$(pkglibdir)' && rm -f" $$files ")"; \
502 cd "$(DESTDIR)$(pkglibdir)" && rm -f $$files
503
504clean-pkglibPROGRAMS:
505 @list='$(pkglib_PROGRAMS)'; test -n "$$list" || exit 0; \
506 echo " rm -f" $$list; \
507 rm -f $$list || exit $$?; \
508 test -n "$(EXEEXT)" || exit 0; \
509 list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
510 echo " rm -f" $$list; \
511 rm -f $$list
512edje-animations$(EXEEXT): $(edje_animations_OBJECTS) $(edje_animations_DEPENDENCIES)
513 @rm -f edje-animations$(EXEEXT)
514 $(AM_V_CCLD)$(LINK) $(edje_animations_OBJECTS) $(edje_animations_LDADD) $(LIBS)
515edje-basic$(EXEEXT): $(edje_basic_OBJECTS) $(edje_basic_DEPENDENCIES)
516 @rm -f edje-basic$(EXEEXT)
517 $(AM_V_CCLD)$(LINK) $(edje_basic_OBJECTS) $(edje_basic_LDADD) $(LIBS)
518edje-box$(EXEEXT): $(edje_box_OBJECTS) $(edje_box_DEPENDENCIES)
519 @rm -f edje-box$(EXEEXT)
520 $(AM_V_CCLD)$(LINK) $(edje_box_OBJECTS) $(edje_box_LDADD) $(LIBS)
521edje-box2$(EXEEXT): $(edje_box2_OBJECTS) $(edje_box2_DEPENDENCIES)
522 @rm -f edje-box2$(EXEEXT)
523 $(AM_V_CCLD)$(LINK) $(edje_box2_OBJECTS) $(edje_box2_LDADD) $(LIBS)
524edje-color-class$(EXEEXT): $(edje_color_class_OBJECTS) $(edje_color_class_DEPENDENCIES)
525 @rm -f edje-color-class$(EXEEXT)
526 $(AM_V_CCLD)$(LINK) $(edje_color_class_OBJECTS) $(edje_color_class_LDADD) $(LIBS)
527edje-drag$(EXEEXT): $(edje_drag_OBJECTS) $(edje_drag_DEPENDENCIES)
528 @rm -f edje-drag$(EXEEXT)
529 $(AM_V_CCLD)$(LINK) $(edje_drag_OBJECTS) $(edje_drag_LDADD) $(LIBS)
530edje-perspective$(EXEEXT): $(edje_perspective_OBJECTS) $(edje_perspective_DEPENDENCIES)
531 @rm -f edje-perspective$(EXEEXT)
532 $(AM_V_CCLD)$(LINK) $(edje_perspective_OBJECTS) $(edje_perspective_LDADD) $(LIBS)
533edje-signals-messages$(EXEEXT): $(edje_signals_messages_OBJECTS) $(edje_signals_messages_DEPENDENCIES)
534 @rm -f edje-signals-messages$(EXEEXT)
535 $(AM_V_CCLD)$(LINK) $(edje_signals_messages_OBJECTS) $(edje_signals_messages_LDADD) $(LIBS)
536edje-swallow$(EXEEXT): $(edje_swallow_OBJECTS) $(edje_swallow_DEPENDENCIES)
537 @rm -f edje-swallow$(EXEEXT)
538 $(AM_V_CCLD)$(LINK) $(edje_swallow_OBJECTS) $(edje_swallow_LDADD) $(LIBS)
539edje-table$(EXEEXT): $(edje_table_OBJECTS) $(edje_table_DEPENDENCIES)
540 @rm -f edje-table$(EXEEXT)
541 $(AM_V_CCLD)$(LINK) $(edje_table_OBJECTS) $(edje_table_LDADD) $(LIBS)
542edje-text$(EXEEXT): $(edje_text_OBJECTS) $(edje_text_DEPENDENCIES)
543 @rm -f edje-text$(EXEEXT)
544 $(AM_V_CCLD)$(LINK) $(edje_text_OBJECTS) $(edje_text_LDADD) $(LIBS)
545sigtest$(EXEEXT): $(sigtest_OBJECTS) $(sigtest_DEPENDENCIES)
546 @rm -f sigtest$(EXEEXT)
547 $(AM_V_CCLD)$(LINK) $(sigtest_OBJECTS) $(sigtest_LDADD) $(LIBS)
548
549mostlyclean-compile:
550 -rm -f *.$(OBJEXT)
551
552distclean-compile:
553 -rm -f *.tab.c
554
555@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje-animations.Po@am__quote@
556@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje-basic.Po@am__quote@
557@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje-box.Po@am__quote@
558@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje-box2.Po@am__quote@
559@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje-color-class.Po@am__quote@
560@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje-drag.Po@am__quote@
561@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje-perspective.Po@am__quote@
562@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje-signals-messages.Po@am__quote@
563@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje-swallow.Po@am__quote@
564@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje-table.Po@am__quote@
565@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje-text.Po@am__quote@
566@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigtest.Po@am__quote@
567
568.c.o:
569@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
570@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
571@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
572@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
573@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
574@am__fastdepCC_FALSE@ $(COMPILE) -c $<
575
576.c.obj:
577@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
578@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
579@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
580@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
581@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
582@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
583
584.c.lo:
585@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
586@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
587@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
588@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
589@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
590@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
591
592mostlyclean-libtool:
593 -rm -f *.lo
594
595clean-libtool:
596 -rm -rf .libs _libs
597install-filesDATA: $(files_DATA)
598 @$(NORMAL_INSTALL)
599 test -z "$(filesdir)" || $(MKDIR_P) "$(DESTDIR)$(filesdir)"
600 @list='$(files_DATA)'; test -n "$(filesdir)" || list=; \
601 for p in $$list; do \
602 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
603 echo "$$d$$p"; \
604 done | $(am__base_list) | \
605 while read files; do \
606 echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(filesdir)'"; \
607 $(INSTALL_DATA) $$files "$(DESTDIR)$(filesdir)" || exit $$?; \
608 done
609
610uninstall-filesDATA:
611 @$(NORMAL_UNINSTALL)
612 @list='$(files_DATA)'; test -n "$(filesdir)" || list=; \
613 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
614 test -n "$$files" || exit 0; \
615 echo " ( cd '$(DESTDIR)$(filesdir)' && rm -f" $$files ")"; \
616 cd "$(DESTDIR)$(filesdir)" && rm -f $$files
617
618ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
619 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
620 unique=`for i in $$list; do \
621 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
622 done | \
623 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
624 END { if (nonempty) { for (i in files) print i; }; }'`; \
625 mkid -fID $$unique
626tags: TAGS
627
628TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
629 $(TAGS_FILES) $(LISP)
630 set x; \
631 here=`pwd`; \
632 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
633 unique=`for i in $$list; do \
634 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
635 done | \
636 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
637 END { if (nonempty) { for (i in files) print i; }; }'`; \
638 shift; \
639 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
640 test -n "$$unique" || unique=$$empty_fix; \
641 if test $$# -gt 0; then \
642 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
643 "$$@" $$unique; \
644 else \
645 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
646 $$unique; \
647 fi; \
648 fi
649ctags: CTAGS
650CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
651 $(TAGS_FILES) $(LISP)
652 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
653 unique=`for i in $$list; do \
654 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
655 done | \
656 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
657 END { if (nonempty) { for (i in files) print i; }; }'`; \
658 test -z "$(CTAGS_ARGS)$$unique" \
659 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
660 $$unique
661
662GTAGS:
663 here=`$(am__cd) $(top_builddir) && pwd` \
664 && $(am__cd) $(top_srcdir) \
665 && gtags -i $(GTAGS_ARGS) "$$here"
666
667distclean-tags:
668 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
669
670distdir: $(DISTFILES)
671 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
672 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
673 list='$(DISTFILES)'; \
674 dist_files=`for file in $$list; do echo $$file; done | \
675 sed -e "s|^$$srcdirstrip/||;t" \
676 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
677 case $$dist_files in \
678 */*) $(MKDIR_P) `echo "$$dist_files" | \
679 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
680 sort -u` ;; \
681 esac; \
682 for file in $$dist_files; do \
683 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
684 if test -d $$d/$$file; then \
685 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
686 if test -d "$(distdir)/$$file"; then \
687 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
688 fi; \
689 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
690 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
691 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
692 fi; \
693 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
694 else \
695 test -f "$(distdir)/$$file" \
696 || cp -p $$d/$$file "$(distdir)/$$file" \
697 || exit 1; \
698 fi; \
699 done
700check-am: all-am
701check: check-am
702all-am: Makefile $(PROGRAMS) $(DATA)
703installdirs:
704 for dir in "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(filesdir)"; do \
705 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
706 done
707install: install-am
708install-exec: install-exec-am
709install-data: install-data-am
710uninstall: uninstall-am
711
712install-am: all-am
713 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
714
715installcheck: installcheck-am
716install-strip:
717 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
718 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
719 `test -z '$(STRIP)' || \
720 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
721mostlyclean-generic:
722
723clean-generic:
724
725distclean-generic:
726 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
727 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
728
729maintainer-clean-generic:
730 @echo "This command is intended for maintainers to use"
731 @echo "it deletes files that may require special tools to rebuild."
732 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
733clean: clean-am
734
735clean-am: clean-generic clean-libtool clean-pkglibPROGRAMS \
736 mostlyclean-am
737
738distclean: distclean-am
739 -rm -rf ./$(DEPDIR)
740 -rm -f Makefile
741distclean-am: clean-am distclean-compile distclean-generic \
742 distclean-tags
743
744dvi: dvi-am
745
746dvi-am:
747
748html: html-am
749
750html-am:
751
752info: info-am
753
754info-am:
755
756install-data-am: install-filesDATA
757
758install-dvi: install-dvi-am
759
760install-dvi-am:
761
762install-exec-am: install-pkglibPROGRAMS
763
764install-html: install-html-am
765
766install-html-am:
767
768install-info: install-info-am
769
770install-info-am:
771
772install-man:
773
774install-pdf: install-pdf-am
775
776install-pdf-am:
777
778install-ps: install-ps-am
779
780install-ps-am:
781
782installcheck-am:
783
784maintainer-clean: maintainer-clean-am
785 -rm -rf ./$(DEPDIR)
786 -rm -f Makefile
787maintainer-clean-am: distclean-am maintainer-clean-generic
788
789mostlyclean: mostlyclean-am
790
791mostlyclean-am: mostlyclean-compile mostlyclean-generic \
792 mostlyclean-libtool
793
794pdf: pdf-am
795
796pdf-am:
797
798ps: ps-am
799
800ps-am:
801
802uninstall-am: uninstall-filesDATA uninstall-pkglibPROGRAMS
803
804.MAKE: install-am install-strip
805
806.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
807 clean-libtool clean-pkglibPROGRAMS ctags distclean \
808 distclean-compile distclean-generic distclean-libtool \
809 distclean-tags distdir dvi dvi-am html html-am info info-am \
810 install install-am install-data install-data-am install-dvi \
811 install-dvi-am install-exec install-exec-am install-filesDATA \
812 install-html install-html-am install-info install-info-am \
813 install-man install-pdf install-pdf-am install-pkglibPROGRAMS \
814 install-ps install-ps-am install-strip installcheck \
815 installcheck-am installdirs maintainer-clean \
816 maintainer-clean-generic mostlyclean mostlyclean-compile \
817 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
818 tags uninstall uninstall-am uninstall-filesDATA \
819 uninstall-pkglibPROGRAMS
820
821
822@BUILD_EXAMPLES_TRUE@.edc.edj:
823@BUILD_EXAMPLES_TRUE@ $(edje_cc) -v -id $(srcdir) $(SND_DIR) $< $(builddir)/$(@F)
824
825# Tell versions [3.59,3.63) of GNU make to not export all variables.
826# Otherwise a system limit (for SysV at least) may be exceeded.
827.NOEXPORT:
diff --git a/libraries/edje/src/examples/animations.edc b/libraries/edje/src/examples/animations.edc
new file mode 100644
index 0000000..f25296f
--- /dev/null
+++ b/libraries/edje/src/examples/animations.edc
@@ -0,0 +1,93 @@
1collections {
2 group {
3 name: "animations_group";
4 min: 100 80;
5
6 parts {
7 part {
8 name: "part_one";
9 type: RECT;
10 scale: 1;
11 description {
12 min: 50 50;
13 state: "default" 0.0;
14 color: 0 0 0 255; /* black */
15 rel1.relative: 0.0 0.0;
16 rel2.relative: 0.33 1.0;
17 }
18 description {
19 state: "invert" 1.0;
20 inherit: "default" 0.0;
21 rel1.relative: 0.0 0.0;
22 rel2.relative: 1.0 0.33;
23 }
24 }
25
26 part {
27 name: "part_two";
28 type: RECT;
29 scale: 1;
30 description {
31 min: 50 50;
32 state: "default" 0.0;
33 color: 255 255 0 255; /* yellow */
34 rel1.relative: 0.33 0.0;
35 rel2.relative: 0.66 1.0;
36 }
37 description {
38 state: "invert" 1.0;
39 inherit: "default" 0.0;
40 rel1.relative: 0.0 0.66;
41 rel2.relative: 1.0 1.0;
42 }
43 }
44
45 part {
46 name: "part_three";
47 type: RECT;
48 description {
49 state: "default" 0.0;
50 color: 255 0 0 255; /* red */
51 rel1.relative: 0.66 0.0;
52 rel2.relative: 1.0 1.0;
53 }
54 description {
55 state: "invert" 1.0;
56 inherit: "default" 0.0;
57 rel1.relative: 0.0 0.33;
58 rel2.relative: 1.0 0.66;
59 }
60 }
61 }
62
63 program {
64 signal: "load";
65 source: "";
66 in: 2.0 0.0;
67 after: "animation,state1";
68 }
69 program {
70 name: "animation,state1";
71 signal: "animation,start";
72 source: "";
73 in: 1.0 0.0;
74 action: STATE_SET "invert" 1.0;
75 target: "part_one";
76 target: "part_two";
77 target: "part_three";
78 transition: LINEAR 0.6;
79 after: "animation,state2";
80 }
81 program {
82 name: "animation,state2";
83 signal: "animation,start";
84 source: "";
85 in: 1.0 0.0;
86 action: STATE_SET "default" 0.0;
87 target: "part_one";
88 target: "part_two";
89 target: "part_three";
90 transition: LINEAR 0.6;
91 after: "animation,state1";
92 }
93}
diff --git a/libraries/edje/src/examples/basic.edc b/libraries/edje/src/examples/basic.edc
new file mode 100644
index 0000000..a708b50
--- /dev/null
+++ b/libraries/edje/src/examples/basic.edc
@@ -0,0 +1,39 @@
1collections {
2 group {
3 name: "example_group";
4 max: 500 500;
5 min: 50 50;
6
7 data {
8 item: "example_data" "a string";
9 }
10
11 parts {
12 part {
13 name: "part_one";
14 type: RECT;
15 scale: 1;
16 description {
17 min: 50 50;
18 max: 50 50;
19 state: "default" 0.0;
20 color: 0 0 255 255; /* blue */
21 rel1.relative: 0.0 0.0;
22 rel2.relative: 1.0 1.0;
23 }
24 }
25
26 part {
27 name: "part_two";
28 type: RECT;
29 description {
30 state: "default" 0.0;
31 color: 0 255 0 255; /* green */
32 rel1.relative: -1.0 -1.0;
33 rel2.relative: 0.0 0.0;
34 }
35 }
36 }
37
38 }
39}
diff --git a/libraries/edje/src/examples/box.edc b/libraries/edje/src/examples/box.edc
new file mode 100644
index 0000000..79d04a8
--- /dev/null
+++ b/libraries/edje/src/examples/box.edc
@@ -0,0 +1,142 @@
1collections {
2
3 group {
4 name: "example/group";
5
6 parts {
7 part {
8 name: "bg";
9 type: RECT;
10
11 description {
12 state: "default" 0.0;
13 color: 128 128 128 255;
14 rel1.offset: 20 20;
15 rel2.offset: -21 -21;
16 }
17 }
18
19 part {
20 name: "example/title";
21 type: TEXT;
22
23 description {
24 state: "default" 0.0;
25 color: 0 0 0 255;
26 rel1 {
27 relative: 0.0 0.0;
28 offset: 0 0;
29 to: "bg";
30 }
31 rel2 {
32 relative: 1.0 0.2;
33 offset: -1 -1;
34 to: "bg";
35 }
36 text {
37 text: "Box Example";
38 size: 16;
39 font: "sans";
40 min: 1 1;
41 }
42 }
43 }
44
45 part {
46 name: "example/box";
47 type: BOX;
48
49 description {
50 state: "default" 0.0;
51
52 box {
53 layout: "horizontal_flow";
54 padding: 2 2;
55 align: 0.5 0.5;
56 min: 1 1;
57 }
58 rel1 {
59 relative: 0.0 0.2;
60 offset: 0 0;
61 to: "bg";
62 }
63 rel2 {
64 relative: 1.0 1.0;
65 offset: -1 -61;
66 to: "bg";
67 }
68 }
69 } // example/box
70 }
71 }
72
73 group {
74 name: "example/group2";
75
76 parts {
77 part {
78 name: "bg";
79 type: RECT;
80
81 description {
82 state: "default" 0.0;
83 color: 128 128 128 255;
84 rel1.offset: 20 20;
85 rel2.offset: -21 -21;
86 }
87 }
88
89 part {
90 name: "example/title";
91 type: TEXT;
92
93 description {
94 state: "default" 0.0;
95 color: 0 0 0 255;
96 rel1 {
97 relative: 0.0 0.0;
98 offset: 0 0;
99 to: "bg";
100 }
101 rel2 {
102 relative: 1.0 0.2;
103 offset: -1 -1;
104 to: "bg";
105 }
106 text {
107 text: "Box Example 2";
108 size: 16;
109 font: "sans";
110 min: 1 1;
111 }
112 }
113 }
114
115 part {
116 name: "example/box";
117 type: BOX;
118
119 description {
120 state: "default" 0.0;
121
122 box {
123 layout: "custom_layout";
124 padding: 2 2;
125 align: 0.5 0.5;
126 min: 1 1;
127 }
128 rel1 {
129 relative: 0.0 0.2;
130 offset: 0 0;
131 to: "bg";
132 }
133 rel2 {
134 relative: 1.0 1.0;
135 offset: -1 -61;
136 to: "bg";
137 }
138 }
139 } // example/box
140 }
141 }
142}
diff --git a/libraries/edje/src/examples/bubble.png b/libraries/edje/src/examples/bubble.png
new file mode 100644
index 0000000..8fc50f9
--- /dev/null
+++ b/libraries/edje/src/examples/bubble.png
Binary files differ
diff --git a/libraries/edje/src/examples/color-class.edc b/libraries/edje/src/examples/color-class.edc
new file mode 100644
index 0000000..c025455
--- /dev/null
+++ b/libraries/edje/src/examples/color-class.edc
@@ -0,0 +1,87 @@
1color_classes {
2 color_class {
3 name: "red_class";
4 color: 255 0 0 255; /* red */
5 color2: 255 0 0 255; /* red */
6 color3: 255 0 0 255; /* red */
7 }
8 color_class {
9 name: "green_class";
10 color: 0 255 0 255; /* green */
11 color2: 0 255 0 255; /* green */
12 color3: 0 255 0 255; /* green */
13 }
14 color_class {
15 name: "blue_class";
16 color: 0 0 255 255; /* blue */
17 color2: 0 0 255 255; /* blue */
18 color3: 0 0 255 255; /* blue */
19 }
20}
21
22collections {
23 group {
24 name: "example_color_class";
25 max: 500 500;
26 min: 50 50;
27
28 parts {
29 part {
30 name: "part_one";
31 type: RECT;
32 scale: 1;
33 description {
34 state: "default" 0.0;
35 color: 255 255 255 255;
36 color_class: "blue_class";
37 rel1.relative: 0.0 0.0;
38 rel2.relative: 0.5 0.5;
39 }
40 }
41
42 part {
43 name: "part_two";
44 type: RECT;
45 description {
46 state: "default" 0.0;
47 color: 255 255 255 255;
48 color_class: "green_class";
49 rel1.relative: 0.5 0.0;
50 rel2.relative: 1.0 0.5;
51 }
52 }
53 part {
54 name: "part_three";
55 type: RECT;
56 description {
57 state: "default" 0.0;
58 color: 255 255 255 255;
59 color_class: "red_class";
60 rel1.relative: 0.0 0.5;
61 rel2.relative: 1.0 1.0;
62 }
63 }
64 part {
65 name: "part_four";
66 type: TEXT;
67 effect: OUTLINE_SHADOW;
68 description {
69 state: "default" 0.0;
70 min: 50 50;
71 color: 255 255 255 255;
72 color2: 255 255 255 255;
73 color3: 255 255 255 255;
74 color_class: "blue_class";
75 rel1.relative: 0.0 0.5;
76 rel2.relative: 1.0 1.0;
77 text {
78 text_class: "example";
79 font: "arial";
80 size: 45;
81 min: 1 1;
82 }
83 }
84 }
85 }
86 }
87}
diff --git a/libraries/edje/src/examples/drag.edc b/libraries/edje/src/examples/drag.edc
new file mode 100644
index 0000000..b9247ec
--- /dev/null
+++ b/libraries/edje/src/examples/drag.edc
@@ -0,0 +1,89 @@
1collections {
2 group {
3 name: "example/group";
4
5 min: 160 160;
6
7 parts {
8 part {
9 name: "bg";
10 type: RECT;
11
12 mouse_events: 0;
13
14 description {
15 state: "default" 0.0;
16 }
17 } // bg
18
19 part {
20 name: "title";
21 type: TEXT;
22 mouse_events: 0;
23
24 description {
25 state: "default" 0.0;
26 color: 0 0 0 255;
27 rel1 {
28 relative: 0.0 0.0;
29 offset: 0 0;
30 to: "bg";
31 }
32 rel2 {
33 relative: 1.0 0.2;
34 offset: -1 -1;
35 to: "bg";
36 }
37 text {
38 text: "Drag Example";
39 size: 16;
40 font: "sans";
41 min: 1 1;
42 }
43 }
44 }
45
46 part {
47 name: "drag_area";
48 type: RECT;
49
50 mouse_events: 0;
51
52 description {
53 state: "default" 0.0;
54 color: 0 0 0 255;
55 rel1 {
56 relative: 0.5 0.3;
57 offset: -5 0;
58 }
59
60 rel2 {
61 relative: 0.5 0.9;
62 offset: 4 0;
63 }
64 }
65 } // drag_area
66
67 part {
68 name: "example/knob";
69 type: RECT;
70
71 mouse_events: 1;
72
73 dragable {
74 confine: "drag_area";
75 x: 0 0 0;
76 y: 1 1 0;
77 }
78
79 description {
80 state: "default" 0.0;
81
82 color: 255 0 0 200;
83
84 }
85 } // example/knob
86
87 }
88 }
89}
diff --git a/libraries/edje/src/examples/edje-animations.c b/libraries/edje/src/examples/edje-animations.c
new file mode 100644
index 0000000..9363471
--- /dev/null
+++ b/libraries/edje/src/examples/edje-animations.c
@@ -0,0 +1,156 @@
1/**
2 * Simple Edje example illustrating animations functions.
3 *
4 * You'll need at least one Evas engine built for it (excluding the
5 * buffer one). See stdout/stderr for output.
6 *
7 * @verbatim
8 * edje_cc animations.edc && gcc -o edje-animations edje-animations.c `pkg-config --libs --cflags evas ecore ecore-evas edje`
9 * @endverbatim
10 */
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#else
15#define PACKAGE_EXAMPLES_DIR "."
16#define __UNUSED__
17#endif
18
19#include <Ecore.h>
20#include <Ecore_Evas.h>
21#include <Edje.h>
22
23#define WIDTH (400)
24#define HEIGHT (300)
25
26static const char *edje_file_path = PACKAGE_EXAMPLES_DIR "/animations.edj";
27static Ecore_Evas *ee;
28static Evas_Object *bg, *edje_obj;
29static double frametime = 1.0/30.0; /* default value */
30
31static void
32_on_delete_cb(Ecore_Evas *ee)
33{
34 ecore_main_loop_quit();
35}
36
37static void
38_canvas_resize_cb(Ecore_Evas *ee)
39{
40 int w, h;
41
42 ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
43 evas_object_resize(bg, w, h);
44 evas_object_resize(edje_obj, w, h);
45}
46
47static void
48_on_key_down_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
49{
50 Evas_Event_Key_Down *ev = event_info;
51 double ft;
52
53 if (!strcmp(ev->key, "plus"))
54 {
55 frametime *= 2.0;
56 fprintf(stdout, "Increasing frametime to: %f\n", frametime);
57 edje_frametime_set(frametime);
58 }
59 else if (!strcmp(ev->key, "minus"))
60 {
61 frametime /= 2.0;
62 fprintf(stdout, "Decreasing frametime to: %f\n", frametime);
63 edje_frametime_set(frametime);
64 }
65 else if (!strcmp(ev->key, "equal"))
66 {
67 ft = edje_frametime_get();
68 fprintf(stdout, "Frametime: %f\n", ft);
69 if (edje_object_play_get(obj))
70 fprintf(stdout, "Object is playing\n");
71 else
72 fprintf(stdout, "Object was paused\n");
73 if (edje_object_animation_get(obj))
74 fprintf(stdout, "Animation is running\n");
75 else
76 fprintf(stdout, "Animation was stopped\n");
77 }
78 else if (!strcmp(ev->key, "s"))
79 {
80 edje_object_play_set(obj, EINA_FALSE);
81 fprintf(stdout, "Pausing the object\n");
82 }
83 else if (!strcmp(ev->key, "p"))
84 {
85 edje_object_play_set(obj, EINA_TRUE);
86 fprintf(stdout, "Playing the object\n");
87 }
88 else if (!strcmp(ev->key, "f"))
89 fprintf(stdout, "Freezing object. Count: %d\n", edje_object_freeze(obj));
90 else if (!strcmp(ev->key, "t"))
91 fprintf(stdout, "Thawing object. Count: %d\n", edje_object_thaw(obj));
92 else if (!strcmp(ev->key, "F"))
93 {
94 edje_freeze();
95 fprintf(stdout, "Freezing all objects\n");
96 }
97 else if (!strcmp(ev->key, "T"))
98 {
99 edje_thaw();
100 fprintf(stdout, "Thawing all objects\n");
101 }
102 else if (!strcmp(ev->key, "a"))
103 {
104 edje_object_animation_set(obj, EINA_TRUE);
105 fprintf(stdout, "Starting the animation in the Edje object\n");
106 }
107 else if (!strcmp(ev->key, "A"))
108 {
109 edje_object_animation_set(obj, EINA_FALSE);
110 fprintf(stdout, "Stopping the animation in the Edje object\n");
111 }
112}
113
114int
115main(int argc, char *argv[])
116{
117 Evas *evas;
118
119 ecore_evas_init();
120 edje_init();
121
122 /* this will give you a window with an Evas canvas under the first
123 * engine available */
124 ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
125
126 ecore_evas_callback_delete_request_set(ee, _on_delete_cb);
127 ecore_evas_callback_resize_set(ee, _canvas_resize_cb);
128 ecore_evas_title_set(ee, "Edje Animations Example");
129 ecore_evas_show(ee);
130
131 evas = ecore_evas_get(ee);
132
133 bg = evas_object_rectangle_add(evas);
134 evas_object_color_set(bg, 255, 255, 255, 255); /* white bg */
135 evas_object_move(bg, 0, 0); /* at canvas' origin */
136 evas_object_resize(bg, WIDTH, HEIGHT); /* covers full canvas */
137 evas_object_show(bg);
138
139 edje_obj = edje_object_add(evas);
140
141 edje_object_file_set(edje_obj, edje_file_path, "animations_group");
142 evas_object_move(edje_obj, 0, 0);
143 evas_object_resize(edje_obj, WIDTH, HEIGHT);
144 evas_object_show(edje_obj);
145
146 evas_object_event_callback_add(edje_obj, EVAS_CALLBACK_KEY_DOWN,
147 _on_key_down_cb, NULL);
148 evas_object_focus_set(edje_obj, EINA_TRUE);
149
150 ecore_main_loop_begin();
151
152 ecore_evas_free(ee);
153 ecore_evas_shutdown();
154 edje_shutdown();
155 return 0;
156}
diff --git a/libraries/edje/src/examples/edje-basic.c b/libraries/edje/src/examples/edje-basic.c
new file mode 100644
index 0000000..2a7a862
--- /dev/null
+++ b/libraries/edje/src/examples/edje-basic.c
@@ -0,0 +1,226 @@
1/**
2 * Simple Edje example illustrating the very basic functions of the
3 * library
4 *
5 * You'll need at least one Evas engine built for it (excluding the
6 * buffer one). See stdout/stderr for output.
7 *
8 * @verbatim
9 * gcc -o edje-basic edje-basic.c `pkg-config --libs --cflags evas ecore ecore-evas edje`
10 * @endverbatim
11 */
12
13#ifdef HAVE_CONFIG_H
14#include "config.h"
15#else
16#define PACKAGE_EXAMPLES_DIR "."
17#define __UNUSED__
18#endif
19
20#include <Ecore.h>
21#include <Ecore_Evas.h>
22#include <Edje.h>
23#include <stdio.h>
24
25#define WIDTH (300)
26#define HEIGHT (300)
27
28static const char *border_img_path = PACKAGE_EXAMPLES_DIR "/red.png";
29static const char *edje_file_path = PACKAGE_EXAMPLES_DIR "/basic.edj";
30
31static Ecore_Evas *ee;
32static Evas_Object *edje_obj;
33
34static const char commands[] = \
35 "commands are:\n"
36 "\ts - change Edje's global scaling factor\n"
37 "\tr - change center rectangle's scaling factor\n"
38 "\th - print help\n";
39
40static void
41_on_keydown(void *data __UNUSED__,
42 Evas *evas __UNUSED__,
43 Evas_Object *o __UNUSED__,
44 void *einfo)
45{
46 Evas_Event_Key_Down *ev = einfo;
47
48 if (strcmp(ev->keyname, "h") == 0) /* print help */
49 {
50 fprintf(stdout, commands);
51 return;
52 }
53
54 if (strcmp(ev->keyname, "s") == 0) /* global scaling factor */
55 {
56 double scale = edje_scale_get();
57
58 printf("got scale %f\n", scale);
59
60 if (scale != 1.0) scale = 1.0;
61 else scale = 2.0;
62
63 edje_scale_set(scale);
64
65 fprintf(stdout, "Setting global scaling factor to %f.\n", scale);
66
67 return;
68 }
69
70 if (strcmp(ev->keyname, "r") == 0) /* individual scaling factor */
71 {
72 double scale = edje_object_scale_get(edje_obj);
73
74 printf("got scale %f\n", scale);
75
76 if (!scale) scale = 1.0;
77 else if (scale == 1.0) scale = 2.0;
78 else scale = 0.0;
79
80 edje_object_scale_set(edje_obj, scale);
81
82 fprintf(stdout, "Setting center rectangle's scaling factor to %f.\n",
83 scale);
84
85 return;
86 }
87}
88
89static void
90_on_delete(Ecore_Evas *ee __UNUSED__)
91{
92 ecore_main_loop_quit();
93}
94
95int
96main(void)
97{
98 Evas_Object *border, *bg;
99 int x, y, w, h;
100 Evas *evas;
101
102 if (!ecore_evas_init())
103 return EXIT_FAILURE;
104
105 if (!edje_init())
106 return EXIT_FAILURE;
107
108 /* this will give you a window with an Evas canvas under the first
109 * engine available */
110 ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
111 if (!ee)
112 goto error;
113
114 ecore_evas_callback_delete_request_set(ee, _on_delete);
115 ecore_evas_title_set(ee, "Edje Basics Example");
116 ecore_evas_show(ee);
117
118 evas = ecore_evas_get(ee);
119
120 bg = evas_object_rectangle_add(evas);
121 evas_object_color_set(bg, 255, 255, 255, 255); /* white bg */
122 evas_object_move(bg, 0, 0); /* at canvas' origin */
123 evas_object_resize(bg, WIDTH, HEIGHT); /* covers full canvas */
124 evas_object_show(bg);
125 ecore_evas_object_associate(ee, bg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE);
126
127 evas_object_focus_set(bg, EINA_TRUE);
128 evas_object_event_callback_add(
129 bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL);
130
131 edje_obj = edje_object_add(evas);
132
133 /* exercising Edje loading error, on purpose */
134 if (!edje_object_file_set(edje_obj, edje_file_path, "unexistant_group"))
135 {
136 int err = edje_object_load_error_get(edje_obj);
137 const char *errmsg = edje_load_error_str(err);
138 fprintf(stderr, "Could not load 'unexistant_group' from basic.edj:"
139 " %s\n", errmsg);
140 }
141
142 if (!edje_object_file_set(edje_obj, edje_file_path, "example_group"))
143 {
144 int err = edje_object_load_error_get(edje_obj);
145 const char *errmsg = edje_load_error_str(err);
146 fprintf(stderr, "Could not load 'example_group' from basic.edj: %s\n",
147 errmsg);
148
149 evas_object_del(edje_obj);
150 goto error_edj;
151 }
152
153 fprintf(stdout, "Loaded Edje object bound to group 'example_group' from"
154 " file basic.edj with success!\n");
155
156 evas_object_move(edje_obj, 20, 20);
157 evas_object_resize(edje_obj, WIDTH - 40, HEIGHT - 40);
158 evas_object_show(edje_obj);
159
160 /* this is a border around the Edje object above, here just to
161 * emphasize its geometry */
162 border = evas_object_image_filled_add(evas);
163 evas_object_image_file_set(border, border_img_path, NULL);
164 evas_object_image_border_set(border, 2, 2, 2, 2);
165 evas_object_image_border_center_fill_set(border, EVAS_BORDER_FILL_NONE);
166
167 evas_object_resize(border, WIDTH - 40 + 4, HEIGHT - 40 + 4);
168 evas_object_move(border, 20 - 2, 20 - 2);
169 evas_object_show(border);
170
171 fprintf(stdout, "'example_data' data field in group 'example_group' has "
172 "the value: %s\n", edje_object_data_get(edje_obj,
173 "example_data"));
174
175 fprintf(stdout, "Testing if 'part_one' part exists: %s\n",
176 edje_object_part_exists(edje_obj, "part_one") ? "yes!" : "no");
177
178 edje_object_part_geometry_get(edje_obj, "part_one", &x, &y, &w, &h);
179 fprintf(stdout, "The geometry of that part inside the Edje object's area "
180 "is: x = %d, y = %d, w = %d, h = %d\n", x, y, w, h);
181
182 evas_object_color_get(edje_object_part_object_get(edje_obj, "part_one"),
183 &x, &y, &w, &h);
184 fprintf(stdout, "That part's color components are: r = %d, g = %d, b = %d,"
185 " a = %d\n", x, y, w, h);
186
187 edje_object_size_max_get(edje_obj, &w, &h);
188 fprintf(stdout, "The Edje object's max. size is: %d, %d\n", w, h);
189
190 edje_object_size_min_get(edje_obj, &w, &h);
191 fprintf(stdout, "The Edje object's min. size is: %d, %d\n", w, h);
192
193 edje_object_size_min_calc(edje_obj, &w, &h);
194 fprintf(stdout, "The Edje object's min. size reported by min. size"
195 " calculation is: w = %d, h = %d\n", w, h);
196
197 edje_object_size_min_restricted_calc(edje_obj, &w, &h, 500, 500);
198 fprintf(stdout, "The Edje object's min. size reported by *restricted* "
199 "min. size calculation is: w = %d, h = %d\n", w, h);
200
201 edje_object_parts_extends_calc(edje_obj, &x, &y, &w, &h);
202 fprintf(stdout, "The Edje object's \"extended\" geometry is: x = %d, "
203 "y = %d, w = %d, h = %d\n", x, y, w, h);
204
205 fprintf(stdout, commands);
206 ecore_main_loop_begin();
207
208 ecore_evas_free(ee);
209 ecore_evas_shutdown();
210 edje_shutdown();
211 return 0;
212
213error:
214 fprintf(stderr, "You got to have at least one evas engine built"
215 " and linked up to ecore-evas for this example to run"
216 " properly.\n");
217 ecore_evas_shutdown();
218 return -1;
219
220error_edj:
221 fprintf(stderr, "Failed to load basic.edj!\n");
222
223 ecore_evas_shutdown();
224 return -2;
225}
226
diff --git a/libraries/edje/src/examples/edje-box.c b/libraries/edje/src/examples/edje-box.c
new file mode 100644
index 0000000..7fffba3
--- /dev/null
+++ b/libraries/edje/src/examples/edje-box.c
@@ -0,0 +1,191 @@
1/**
2 * Simple Edje example illustrating box functions.
3 *
4 * You'll need at least one Evas engine built for it (excluding the
5 * buffer one). See stdout/stderr for output.
6 *
7 * @verbatim
8 * edje_cc box.edc && gcc -o edje-box edje-box.c `pkg-config --libs --cflags evas ecore ecore-evas edje`
9 * @endverbatim
10 */
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#else
15#define PACKAGE_EXAMPLES_DIR "."
16#define __UNUSED__
17#endif
18
19#include <Ecore.h>
20#include <Ecore_Evas.h>
21#include <Edje.h>
22
23#define WIDTH 300
24#define HEIGHT 300
25
26#define RECTW 30
27#define RECTH 30
28
29#define NRECTS 20
30
31static const char *edje_file_path = PACKAGE_EXAMPLES_DIR "/box.edj";
32
33struct _App {
34 Ecore_Evas *ee;
35 Evas_Object *edje;
36 Evas_Object *bg;
37};
38
39static void
40_on_destroy(Ecore_Evas *ee __UNUSED__)
41{
42 ecore_main_loop_quit();
43}
44
45/* here just to keep our example's window size and background image's
46 * size in synchrony */
47static void
48_canvas_resize_cb(Ecore_Evas *ee)
49{
50 int w, h;
51 struct _App *app = ecore_evas_data_get(ee, "app");
52
53 ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
54 evas_object_resize(app->bg, w, h);
55 evas_object_resize(app->edje, w, h);
56}
57
58static void
59_rect_mouse_down(void *data, Evas *e, Evas_Object *o, void *event_info)
60{
61 struct _App *app = data;
62 Evas_Event_Mouse_Down *ev = event_info;
63
64 if (ev->button == 1)
65 {
66 printf("Removing rect %p under the mouse pointer.\n", o);
67 edje_object_part_box_remove(app->edje, "example/box", o);
68 evas_object_del(o);
69 }
70 else if (ev->button == 3)
71 {
72 Evas_Object *rect;
73 Eina_Bool r;
74
75 rect = evas_object_rectangle_add(e);
76 evas_object_color_set(rect, 0, 0, 255, 255);
77 evas_object_resize(rect, RECTW + 10, RECTH);
78 evas_object_show(rect);
79
80 printf("Inserting rect %p before the rectangle under the mouse pointer.\n", rect);
81 r = edje_object_part_box_insert_before(app->edje, "example/box", rect, o);
82 if (!r)
83 printf("An error ocurred when appending rect %p to the box.\n", rect);
84
85 evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_DOWN, _rect_mouse_down, app);
86 }
87}
88
89static void
90_bg_key_down(void *data, Evas *e, Evas_Object *o __UNUSED__, void *event_info)
91{
92 struct _App *app = data;
93 Evas_Event_Key_Down *ev = event_info;
94 Evas_Object *rect;
95 Eina_Bool r;
96
97
98 if (!strcmp(ev->keyname, "i"))
99 {
100 rect = evas_object_rectangle_add(e);
101 evas_object_color_set(rect, 0, 0, 128, 255);
102 evas_object_resize(rect, RECTW + 30, RECTH);
103 evas_object_show(rect);
104
105 printf("Inserting rect %p before the rectangle under the mouse pointer.\n", rect);
106 r = edje_object_part_box_insert_at(app->edje, "example/box", rect, 0);
107 if (!r)
108 printf("An error ocurred when appending rect %p to the box.\n", rect);
109
110 evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_DOWN, _rect_mouse_down, app);
111 }
112 else if (!strcmp(ev->keyname, "a"))
113 {
114 rect = evas_object_rectangle_add(e);
115 evas_object_color_set(rect, 0, 128, 0, 255);
116 evas_object_resize(rect, RECTW, RECTH);
117 evas_object_show(rect);
118
119 printf("Inserting rect %p before the rectangle under the mouse pointer.\n", rect);
120 r = edje_object_part_box_append(app->edje, "example/box", rect);
121 if (!r)
122 printf("An error ocurred when appending rect %p to the box.\n", rect);
123
124 evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_DOWN, _rect_mouse_down, app);
125 }
126 else if (!strcmp(ev->keyname, "c"))
127 edje_object_part_box_remove_all(app->edje, "example/box", EINA_TRUE);
128}
129
130int
131main(void)
132{
133 Evas *evas;
134 struct _App app;
135 int i;
136
137 ecore_evas_init();
138 edje_init();
139
140 /* this will give you a window with an Evas canvas under the first
141 * engine available */
142 app.ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
143
144 ecore_evas_callback_destroy_set(app.ee, _on_destroy);
145 ecore_evas_callback_resize_set(app.ee, _canvas_resize_cb);
146 ecore_evas_title_set(app.ee, "Edje Box Example");
147 ecore_evas_show(app.ee);
148
149 ecore_evas_data_set(app.ee, "app", &app);
150
151 evas = ecore_evas_get(app.ee);
152
153 app.bg = evas_object_rectangle_add(evas);
154 evas_object_color_set(app.bg, 255, 255, 255, 255);
155 evas_object_resize(app.bg, WIDTH, HEIGHT);
156 evas_object_focus_set(app.bg, EINA_TRUE);
157 evas_object_show(app.bg);
158
159 evas_object_event_callback_add(app.bg, EVAS_CALLBACK_KEY_DOWN, _bg_key_down, &app);
160
161 app.edje = edje_object_add(evas);
162
163 edje_object_file_set(app.edje, edje_file_path, "example/group");
164 evas_object_move(app.edje, 0, 0);
165 evas_object_resize(app.edje, WIDTH, HEIGHT);
166 evas_object_show(app.edje);
167
168 for (i = 0; i < NRECTS; i++)
169 {
170 Evas_Object *rect;
171 Eina_Bool r = EINA_FALSE;
172 int red = (i * 10) % 256;
173 rect = evas_object_rectangle_add(evas);
174 evas_object_color_set(rect, red, 0, 0, 255);
175 evas_object_resize(rect, RECTW, RECTH);
176 r = edje_object_part_box_append(app.edje, "example/box", rect);
177 if (!r)
178 printf("An error ocurred when appending rect #%d to the box.\n", i);
179 evas_object_show(rect);
180
181 evas_object_event_callback_add(
182 rect, EVAS_CALLBACK_MOUSE_DOWN, _rect_mouse_down, &app);
183 }
184
185 ecore_main_loop_begin();
186
187 ecore_evas_free(app.ee);
188 ecore_evas_shutdown();
189 edje_shutdown();
190 return 0;
191}
diff --git a/libraries/edje/src/examples/edje-box2.c b/libraries/edje/src/examples/edje-box2.c
new file mode 100644
index 0000000..b3f4e40
--- /dev/null
+++ b/libraries/edje/src/examples/edje-box2.c
@@ -0,0 +1,204 @@
1/**
2 * Simple Edje example illustrating a custom box layout.
3 *
4 * You'll need at least one Evas engine built for it (excluding the
5 * buffer one). See stdout/stderr for output.
6 *
7 * @verbatim
8 * edje_cc box.edc && gcc -o edje-box2 edje-box2.c `pkg-config --libs --cflags evas ecore ecore-evas edje`
9 * @endverbatim
10 */
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#else
15#define PACKAGE_EXAMPLES_DIR "."
16#define __UNUSED__
17#endif
18
19#include <Ecore.h>
20#include <Evas.h>
21#include <Ecore_Evas.h>
22#include <Edje.h>
23
24#include <stdlib.h>
25#include <stdio.h>
26#include <string.h>
27
28static const char *edje_file_path = PACKAGE_EXAMPLES_DIR "/box.edj";
29
30struct _App {
31 Ecore_Evas *ee;
32 Evas *evas;
33 Evas_Object *bg;
34 Evas_Object *box;
35};
36
37static struct _App app;
38
39static void
40custom_layout(Evas_Object *o, Evas_Object_Box_Data *p, void *data)
41{
42 int x, y, w, h;
43 int xx, yy, ww, hh;
44 int count;
45 Eina_List *l;
46 Evas_Object_Box_Option *opt;
47
48 evas_object_geometry_get(o, &x, &y, &w, &h);
49 count = eina_list_count(p->children);
50 ww = w / (count?:1);
51 hh = h / (count?:1);
52 if (ww < 1) ww = 1;
53 if (hh < 1) hh = 1;
54
55 xx = x;
56 yy = y;
57 EINA_LIST_FOREACH(p->children, l, opt)
58 {
59 evas_object_move(opt->obj, xx, yy);
60 xx += ww;
61 yy += hh;
62 }
63}
64
65static Evas_Object *
66new_greenie_block(Evas *e)
67{
68 Evas_Object *o;
69
70 o = evas_object_rectangle_add(e);
71 evas_object_resize(o, 10, 10);
72 evas_object_color_set(o, 0, 255, 0, 255);
73 evas_object_show(o);
74
75 return o;
76}
77
78static void
79on_keydown(void *data, Evas *evas, Evas_Object *o, void *einfo)
80{
81 struct _App *app = data;
82 Evas_Event_Key_Down *ev = einfo;
83 const Evas_Modifier *mods;
84
85 mods = evas_key_modifier_get(evas);
86 if (evas_key_modifier_is_set(mods, "Shift"))
87 {
88 int pos;
89 Evas_Object *obj = NULL;
90 pos = atoi(ev->keyname);
91 obj = edje_object_part_box_remove_at(app->box, "example/box", pos);
92 if (obj)
93 evas_object_del(obj);
94 return;
95 }
96 if (evas_key_modifier_is_set(mods, "Control"))
97 {
98 Evas_Object *o;
99 int pos;
100 pos = atoi(ev->keyname);
101 o = new_greenie_block(app->evas);
102 if (!edje_object_part_box_insert_at(app->box, "example/box", o, pos))
103 edje_object_part_box_append(app->box, "example/box", o);
104 return;
105 }
106 if (strcmp(ev->keyname, "Escape") == 0)
107 ecore_main_loop_quit();
108}
109
110static Evas_Object *
111box_new(Evas *evas, const char *name, int x, int y, int w, int h)
112{
113 Evas_Object *o;
114
115 o = edje_object_add(evas);
116 evas_object_move(o, x, y);
117 evas_object_resize(o, w, h);
118 if (!edje_object_file_set(o, edje_file_path, "example/group2"))
119 {
120 printf("error: could not load file object.\n");
121 }
122 evas_object_show(o);
123
124 evas_object_name_set(o, name);
125
126 return o;
127}
128
129static void
130on_resize(Ecore_Evas *ee)
131{
132 int w, h;
133
134 evas_output_viewport_get(app.evas, NULL, NULL, &w, &h);
135 evas_object_resize(app.bg, w, h);
136 evas_object_resize(app.box, w, h);
137}
138
139static void
140on_destroy(Ecore_Evas *ee)
141{
142 ecore_main_loop_quit();
143}
144
145int
146main(int argc, char *argv[])
147{
148 Ecore_Evas *ee;
149 int w, h, i;
150 Evas_Object *last;
151 Evas_Object *o;
152
153 evas_init();
154 ecore_init();
155 ecore_evas_init();
156 edje_init();
157
158 ee = ecore_evas_new(NULL, 0, 0, 640, 480, NULL);
159 ecore_evas_show(ee);
160
161 app.ee = ee;
162 app.evas = ecore_evas_get(ee);
163
164 ecore_evas_callback_resize_set(ee, on_resize);
165 ecore_evas_callback_destroy_set(ee, on_destroy);
166
167 evas_output_viewport_get(app.evas, NULL, NULL, &w, &h);
168
169 app.bg = evas_object_rectangle_add(app.evas);
170 evas_object_resize(app.bg, w, h);
171 evas_object_show(app.bg);
172 evas_object_focus_set(app.bg, 1);
173 evas_object_event_callback_add(
174 app.bg, EVAS_CALLBACK_KEY_DOWN, on_keydown, &app);
175
176 edje_box_layout_register("custom_layout", custom_layout, NULL, NULL, NULL, NULL);
177
178 app.box = box_new(app.evas, "box", 0, 0, w, h);
179
180 for (i = 1; i <= 5; i++)
181 {
182 o = last = evas_object_rectangle_add(app.evas);
183 evas_object_size_hint_min_set(o, 50, 50);
184 evas_object_resize(o, 50, 50);
185 evas_object_color_set(o, 255, 0, 0, 128);
186 evas_object_show(o);
187
188 if (!edje_object_part_box_append(app.box, "example/box", o))
189 {
190 fprintf(stderr, "error appending child object!\n");
191 return 1;
192 }
193 }
194
195 ecore_main_loop_begin();
196
197 edje_shutdown();
198 ecore_evas_shutdown();
199 ecore_shutdown();
200 evas_shutdown();
201
202
203 return 0;
204}
diff --git a/libraries/edje/src/examples/edje-color-class.c b/libraries/edje/src/examples/edje-color-class.c
new file mode 100644
index 0000000..9ac8653
--- /dev/null
+++ b/libraries/edje/src/examples/edje-color-class.c
@@ -0,0 +1,257 @@
1/**
2 * Simple Edje example illustrating color class functions.
3 *
4 * You'll need at least one Evas engine built for it (excluding the
5 * buffer one). See stdout/stderr for output.
6 *
7 * @verbatim
8 * edje_cc color-class.edc && gcc -o edje-table edje-color-class.c `pkg-config --libs --cflags evas ecore ecore-evas edje`
9 * @endverbatim
10 */
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#else
15#define PACKAGE_EXAMPLES_DIR "."
16#define __UNUSED__
17#endif
18
19#include <Ecore.h>
20#include <Ecore_Evas.h>
21#include <Edje.h>
22
23#define WIDTH (400)
24#define HEIGHT (400)
25
26static const char *edje_file_path = PACKAGE_EXAMPLES_DIR "/color-class.edj";
27
28typedef int color[4]; /* rgba */
29
30static Ecore_Evas *ee, *ee2;
31static Evas *evas, *evas2;
32static Evas_Object *bg, *edje_obj, *bg2, *edje_obj2;
33static const char *selected_class;
34
35static color colors_init_data[] =
36 {{255, 0, 0, 255}, /* red */
37 {0, 255, 0, 255}, /* green */
38 {0, 0, 255, 255}, /* blue */
39 {0, 0, 0, 255}, /* black */
40 {255, 255, 255, 255}, /* white */
41 {128, 128, 128, 255}, /* gray */
42 {255, 255, 0, 255}, /* yellow */
43 {255, 0, 255, 255} /* pink */
44 };
45
46static char *color_names[] =
47 {"red", "green", "blue", "black", "white",
48 "gray", "yellow", "pink"};
49
50static Eina_Bool
51_get_color_from_name(const char *n, color *c)
52{
53 int i;
54 for (i = 0; i < 8; i++)
55 if (!strcmp(n, color_names[i]))
56 {
57 (*c)[0] = (colors_init_data[i])[0];
58 (*c)[1] = (colors_init_data[i])[1];
59 (*c)[2] = (colors_init_data[i])[2];
60 (*c)[3] = (colors_init_data[i])[3];
61 return EINA_TRUE;
62 }
63
64 return EINA_FALSE;
65}
66
67static void
68_color_classes_print(void)
69{
70 Eina_List *classes;
71 char *class_name;
72
73 fprintf(stdout, "Getting the color classes\n\n");
74 classes = edje_color_class_list();
75 EINA_LIST_FREE(classes, class_name)
76 {
77 int r1, r2, r3, g1, g2, g3, b1, b2, b3,
78 a1, a2, a3;
79
80 fprintf(stdout, "\ncolor class: %s\n", class_name);
81 if (!edje_color_class_get(class_name, &r1, &g1, &b1, &a1,
82 &r2, &g2, &b2, &a2, &r3, &g3, &b3, &a3))
83 fprintf(stderr, "Cannot get the color class\n");
84 else
85 {
86
87 fprintf(stdout,"Object color r: %d g: %d b: %d a: %d\n",
88 r1, g1, b1, a1);
89 fprintf(stdout,"Text outline color r: %d g: %d b: %d a: %d\n",
90 r2, g2, b2, a2);
91 fprintf(stdout,"Text shadow color r: %d g: %d b: %d a: %d\n",
92 r3, g3, b3, a3);
93 }
94 free(class_name);
95 }
96}
97
98static void
99_on_destroy(Ecore_Evas *ee)
100{
101 ecore_main_loop_quit();
102}
103
104static void
105_on_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info)
106{
107 Evas_Event_Mouse_Down *ev = event_info;
108
109 if (ev->button == 1)
110 if (obj == edje_obj)
111 edje_color_class_del(selected_class);
112 else
113 edje_object_color_class_del(edje_obj2, selected_class);
114}
115
116/* here just to keep our example's window size
117 * in synchrony. */
118static void
119_canvas_resize_cb(Ecore_Evas *_ee)
120{
121 int w, h;
122
123 ecore_evas_geometry_get(_ee, NULL, NULL, &w, &h);
124
125 if (_ee == ee)
126 {
127 evas_object_resize(bg, w, h);
128 evas_object_resize(edje_obj, w, h);
129 }
130 else
131 {
132 evas_object_resize(bg2, w, h);
133 evas_object_resize(edje_obj2, w, h);
134 }
135}
136
137static void
138_color_class_callback_delete(void *data, Evas *evas, Evas_Object *obj,
139 const char *emission, void *source)
140{
141 if (!strcmp(data, "process"))
142 fprintf(stdout, "Color class: %s deleted on process level\n", emission);
143 else
144 fprintf(stdout, "Color class: %s deleted on object level\n", emission);
145}
146
147static void
148_create_windows(void)
149{
150 /* this will give you a window with an Evas canvas under the first
151 * engine available */
152 ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
153 ee2 = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
154
155 ecore_evas_callback_destroy_set(ee, _on_destroy);
156 ecore_evas_callback_resize_set(ee, _canvas_resize_cb);
157 ecore_evas_title_set(ee, "Edje Color Class Example");
158 ecore_evas_show(ee);
159
160 ecore_evas_callback_destroy_set(ee2, _on_destroy);
161 ecore_evas_callback_resize_set(ee2, _canvas_resize_cb);
162 ecore_evas_title_set(ee2, "Edje Object Color Class Example");
163 ecore_evas_show(ee2);
164
165 evas = ecore_evas_get(ee);
166 evas2 = ecore_evas_get(ee2);
167
168 bg = evas_object_rectangle_add(evas);
169 evas_object_color_set(bg, 255, 255, 255, 255); /* white bg */
170 evas_object_move(bg, 0, 0); /* at canvas' origin */
171 evas_object_resize(bg, WIDTH, HEIGHT); /* covers full canvas */
172 evas_object_show(bg);
173
174 bg2 = evas_object_rectangle_add(evas2);
175 evas_object_color_set(bg2, 255, 255, 255, 255); /* white bg */
176 evas_object_move(bg2, 0, 0); /* at canvas' origin */
177 evas_object_resize(bg2, WIDTH, HEIGHT); /* covers full canvas */
178 evas_object_show(bg2);
179
180 edje_obj = edje_object_add(evas);
181 evas_object_event_callback_add(edje_obj, EVAS_CALLBACK_MOUSE_DOWN,
182 _on_mouse_down, NULL);
183
184 edje_object_file_set(edje_obj, edje_file_path, "example_color_class");
185 evas_object_move(edje_obj, 0, 0); /* at canvas' origin */
186 evas_object_resize(edje_obj, WIDTH, HEIGHT);
187 edje_object_part_text_set(edje_obj, "part_four", "EDJE EXAMPLE");
188 edje_object_signal_callback_add(edje_obj, "color_class,del", "*",
189 (Edje_Signal_Cb) _color_class_callback_delete,
190 "process");
191 evas_object_show(edje_obj);
192
193 edje_obj2 = edje_object_add(evas2);
194 evas_object_event_callback_add(edje_obj2, EVAS_CALLBACK_MOUSE_DOWN,
195 _on_mouse_down, NULL);
196
197 edje_object_file_set(edje_obj2, edje_file_path, "example_color_class");
198 evas_object_move(edje_obj2, 0, 0); /* at canvas' origin */
199 evas_object_resize(edje_obj2, WIDTH, HEIGHT);
200 edje_object_part_text_set(edje_obj2, "part_four", "EDJE OBJECT EXAMPLE");
201 edje_object_signal_callback_add(edje_obj2, "color_class,del", "*",
202 (Edje_Signal_Cb) _color_class_callback_delete,
203 "object");
204 evas_object_show(edje_obj2);
205}
206
207int
208main(int argc, char *argv[])
209{
210 color c1, c2, c3;
211 int i;
212
213 if (argc != 5)
214 {
215 fprintf(stderr, "You have to use: %s color_class_name color1, color2," \
216 "color3\n", argv[0]);
217 fprintf(stderr, "Available colors:\n");
218 for (i = 0; i < 8; i++)
219 fprintf(stderr, "%s\n", color_names[i]);
220
221 return 1;
222 }
223
224 selected_class = argv[1];
225 if (!(_get_color_from_name(argv[2], &c1) &&
226 _get_color_from_name(argv[3], &c2) &&
227 _get_color_from_name(argv[4], &c3)))
228 {
229 fprintf(stderr, "Color not available!\n");
230 return 2;
231 }
232
233 ecore_evas_init();
234 edje_init();
235
236 _create_windows();
237
238 edje_color_class_set(argv[1], /* class name */
239 c1[0], c1[1], c1[2], c1[3], /* Object color */
240 c2[0], c2[1], c2[2], c2[3], /* Text outline */
241 c3[0], c3[1], c3[2], c3[3]); /* Text shadow */
242
243 /* Setting an arbitrary value just to see the difference between */
244 /* process level and object level */
245 edje_object_color_class_set(edje_obj2, argv[1], /* class name */
246 128, 180, 77, 255, /* Object color */
247 200, 22, 86, 255, /* Text outline */
248 39, 90, 187, 255); /* Text shadow */
249
250 _color_classes_print();
251 ecore_main_loop_begin();
252 ecore_evas_free(ee);
253 ecore_evas_free(ee2);
254 ecore_evas_shutdown();
255 edje_shutdown();
256 return 0;
257}
diff --git a/libraries/edje/src/examples/edje-drag.c b/libraries/edje/src/examples/edje-drag.c
new file mode 100644
index 0000000..78e2e72
--- /dev/null
+++ b/libraries/edje/src/examples/edje-drag.c
@@ -0,0 +1,157 @@
1/**
2 * Simple Edje example illustrating drag functions.
3 *
4 * You'll need at least one Evas engine built for it (excluding the
5 * buffer one). See stdout/stderr for output.
6 *
7 * @verbatim
8 * edje_cc drag.edc && gcc -o drag-box drag-box.c `pkg-config --libs --cflags evas ecore ecore-evas edje`
9 * @endverbatim
10 */
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#else
15#define PACKAGE_EXAMPLES_DIR "."
16#define __UNUSED__
17#endif
18
19#include <Ecore.h>
20#include <Ecore_Evas.h>
21#include <Edje.h>
22
23#define WIDTH 300
24#define HEIGHT 300
25
26#define RECTW 30
27#define RECTH 30
28
29#define NRECTS 20
30
31static const char *PARTNAME = "example/knob";
32
33static const char *edje_file_path = PACKAGE_EXAMPLES_DIR "/drag.edj";
34
35struct _App {
36 Ecore_Evas *ee;
37 Evas_Object *edje;
38 Evas_Object *bg;
39};
40
41static void
42_on_destroy(Ecore_Evas *ee __UNUSED__)
43{
44 ecore_main_loop_quit();
45}
46
47/* here just to keep our example's window size and background image's
48 * size in synchrony */
49static void
50_canvas_resize_cb(Ecore_Evas *ee)
51{
52 int w, h;
53 struct _App *app = ecore_evas_data_get(ee, "app");
54
55 ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
56 evas_object_resize(app->bg, w, h);
57 evas_object_resize(app->edje, w, h);
58}
59
60static void
61_bg_key_down(void *data, Evas *e, Evas_Object *o __UNUSED__, void *event_info)
62{
63 struct _App *app = data;
64 Evas_Event_Key_Down *ev = event_info;
65 Evas_Object *rect;
66 Eina_Bool r;
67
68
69 if (!strcmp(ev->keyname, "Down"))
70 {
71 edje_object_part_drag_step(app->edje, PARTNAME, 0, 1.0);
72 }
73 else if (!strcmp(ev->keyname, "Up"))
74 {
75 edje_object_part_drag_step(app->edje, PARTNAME, 0, -1.0);
76 }
77 else if (!strcmp(ev->keyname, "m"))
78 {
79 edje_object_part_drag_value_set(app->edje, PARTNAME, 0.0, 0.5);
80 }
81 else if (!strcmp(ev->keyname, "Prior"))
82 {
83 edje_object_part_drag_page(app->edje, PARTNAME, 0.0, -1.0);
84 }
85 else if (!strcmp(ev->keyname, "Next"))
86 {
87 edje_object_part_drag_page(app->edje, PARTNAME, 0.0, 1.0);
88 }
89 else if (!strcmp(ev->keyname, "Escape"))
90 ecore_main_loop_quit();
91 else
92 printf("unhandled key: %s\n", ev->keyname);
93}
94
95static void
96_knob_moved_cb(void *data, Evas_Object *o, const char *emission, const char *source)
97{
98 double val;
99 edje_object_part_drag_value_get(o, PARTNAME, NULL, &val);
100 printf("value changed to: %0.3f\n", val);
101}
102
103int
104main(void)
105{
106 Evas *evas;
107 struct _App app;
108 int i;
109
110 ecore_evas_init();
111 edje_init();
112
113 /* this will give you a window with an Evas canvas under the first
114 * engine available */
115 app.ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
116
117 ecore_evas_callback_destroy_set(app.ee, _on_destroy);
118 ecore_evas_callback_resize_set(app.ee, _canvas_resize_cb);
119 ecore_evas_title_set(app.ee, "Edje Box Example");
120 ecore_evas_show(app.ee);
121
122 ecore_evas_data_set(app.ee, "app", &app);
123
124 evas = ecore_evas_get(app.ee);
125
126 app.bg = evas_object_rectangle_add(evas);
127 evas_object_color_set(app.bg, 255, 255, 255, 255);
128 evas_object_resize(app.bg, WIDTH, HEIGHT);
129 evas_object_focus_set(app.bg, EINA_TRUE);
130 evas_object_show(app.bg);
131
132 evas_object_event_callback_add(app.bg, EVAS_CALLBACK_KEY_DOWN, _bg_key_down, &app);
133
134 app.edje = edje_object_add(evas);
135
136 edje_object_file_set(app.edje, edje_file_path, "example/group");
137 evas_object_move(app.edje, 0, 0);
138 evas_object_resize(app.edje, WIDTH, HEIGHT);
139 evas_object_show(app.edje);
140
141 edje_object_part_drag_size_set(app.edje, PARTNAME, 1.0, 0.4);
142
143 if (!edje_object_part_drag_step_set(app.edje, PARTNAME, 0.0, 0.1))
144 printf("error when setting drag step size.\n");
145
146 if (!edje_object_part_drag_page_set(app.edje, PARTNAME, 0.0, 0.3))
147 printf("error when setting drag page step size.\n");
148
149 edje_object_signal_callback_add(app.edje, "drag", PARTNAME, _knob_moved_cb, &app);
150
151 ecore_main_loop_begin();
152
153 ecore_evas_free(app.ee);
154 ecore_evas_shutdown();
155 edje_shutdown();
156 return 0;
157}
diff --git a/libraries/edje/src/examples/edje-perspective.c b/libraries/edje/src/examples/edje-perspective.c
new file mode 100644
index 0000000..5220b74
--- /dev/null
+++ b/libraries/edje/src/examples/edje-perspective.c
@@ -0,0 +1,201 @@
1/**
2 * Simple Edje example illustrating drag functions.
3 *
4 * You'll need at least one Evas engine built for it (excluding the
5 * buffer one). See stdout/stderr for output.
6 *
7 * @verbatim
8 * edje_cc drag.edc && gcc -o drag-box drag-box.c `pkg-config --libs --cflags evas ecore ecore-evas edje`
9 * @endverbatim
10 */
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#else
15#define PACKAGE_EXAMPLES_DIR "."
16#define __UNUSED__
17#endif
18
19#include <Ecore.h>
20#include <Ecore_Evas.h>
21#include <Edje.h>
22
23#define WIDTH 480
24#define HEIGHT 320
25
26static const char *edje_file_path = PACKAGE_EXAMPLES_DIR "/perspective.edj";
27
28struct _App {
29 Ecore_Evas *ee;
30 Evas_Object *edje;
31 Evas_Object *bg;
32 Edje_Perspective *ps;
33 Eina_Bool animating;
34 int x, y; // relative position of part in the screen
35 int focal;
36};
37
38static void
39_on_destroy(Ecore_Evas *ee __UNUSED__)
40{
41 ecore_main_loop_quit();
42}
43
44/* here just to keep our example's window size and background image's
45 * size in synchrony */
46static void
47_canvas_resize_cb(Ecore_Evas *ee)
48{
49 int w, h;
50 struct _App *app = ecore_evas_data_get(ee, "app");
51
52 ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
53 evas_object_resize(app->bg, w, h);
54 evas_object_resize(app->edje, w, h);
55}
56
57static void
58_part_move(struct _App *app, int dx, int dy)
59{
60 char emission[64];
61
62 if (app->animating)
63 return;
64
65 app->x += dx;
66 app->y += dy;
67 if (app->x > 1)
68 app->x = 1;
69 if (app->x < 0)
70 app->x = 0;
71 if (app->y > 1)
72 app->y = 1;
73 if (app->y < 0)
74 app->y = 0;
75
76 snprintf(emission, sizeof(emission), "move,%d,%d", app->x, app->y);
77 edje_object_signal_emit(app->edje, emission, "");
78 app->animating = EINA_TRUE;
79}
80
81
82static void
83_bg_key_down(void *data, Evas *e, Evas_Object *o __UNUSED__, void *event_info)
84{
85 struct _App *app = data;
86 Evas_Event_Key_Down *ev = event_info;
87
88
89 // just moving the part and text
90 if (!strcmp(ev->keyname, "Down"))
91 {
92 _part_move(app, 0, 1);
93 }
94 else if (!strcmp(ev->keyname, "Up"))
95 {
96 _part_move(app, 0, -1);
97 }
98 else if (!strcmp(ev->keyname, "Left"))
99 {
100 _part_move(app, -1, 0);
101 }
102 else if (!strcmp(ev->keyname, "Right"))
103 {
104 _part_move(app, 1, 0);
105 }
106 else if (!strcmp(ev->keyname, "Prior"))
107 {
108 _part_move(app, -1, -1);
109 }
110 else if (!strcmp(ev->keyname, "Next"))
111 {
112 _part_move(app, 1, 1);
113 }
114 // adjusting the perspective focal point distance
115 else if (!strcmp(ev->keyname, "KP_Add"))
116 {
117 app->focal += 5;
118 edje_perspective_set(app->ps, 240, 160, 0, app->focal);
119 edje_object_calc_force(app->edje);
120 }
121 else if (!strcmp(ev->keyname, "KP_Subtract"))
122 {
123 app->focal -= 5;
124 if (app->focal < 5)
125 app->focal = 5;
126
127 edje_perspective_set(app->ps, 240, 160, 0, app->focal);
128 edje_object_calc_force(app->edje);
129 }
130 // exiting
131 else if (!strcmp(ev->keyname, "Escape"))
132 ecore_main_loop_quit();
133 else
134 printf("unhandled key: %s\n", ev->keyname);
135}
136
137static void
138_animation_end_cb(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
139{
140 struct _App *app = data;
141
142 app->animating = EINA_FALSE;
143}
144
145int
146main(void)
147{
148 Evas *evas;
149 struct _App app;
150 int i;
151
152 ecore_evas_init();
153 edje_init();
154
155 edje_frametime_set(((double)1) / 60);
156
157 /* this will give you a window with an Evas canvas under the first
158 * engine available */
159 app.animating = EINA_FALSE;
160 app.x = 0;
161 app.y = 0;
162 app.focal = 50;
163 app.ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
164
165 ecore_evas_callback_destroy_set(app.ee, _on_destroy);
166 ecore_evas_callback_resize_set(app.ee, _canvas_resize_cb);
167 ecore_evas_title_set(app.ee, "Edje Box Example");
168 ecore_evas_show(app.ee);
169
170 ecore_evas_data_set(app.ee, "app", &app);
171
172 evas = ecore_evas_get(app.ee);
173
174 app.bg = evas_object_rectangle_add(evas);
175 evas_object_color_set(app.bg, 255, 255, 255, 255);
176 evas_object_resize(app.bg, WIDTH, HEIGHT);
177 evas_object_focus_set(app.bg, EINA_TRUE);
178 evas_object_show(app.bg);
179
180 evas_object_event_callback_add(app.bg, EVAS_CALLBACK_KEY_DOWN, _bg_key_down, &app);
181
182 app.edje = edje_object_add(evas);
183
184 edje_object_file_set(app.edje, edje_file_path, "example/group");
185 evas_object_move(app.edje, 0, 0);
186 evas_object_resize(app.edje, WIDTH, HEIGHT);
187 evas_object_show(app.edje);
188
189 edje_object_signal_callback_add(app.edje, "animation,end", "", _animation_end_cb, &app);
190
191 app.ps = edje_perspective_new(evas);
192 edje_perspective_set(app.ps, 240, 160, 0, app.focal);
193 edje_perspective_global_set(app.ps, EINA_TRUE);
194
195 ecore_main_loop_begin();
196
197 ecore_evas_free(app.ee);
198 ecore_evas_shutdown();
199 edje_shutdown();
200 return 0;
201}
diff --git a/libraries/edje/src/examples/edje-signals-messages.c b/libraries/edje/src/examples/edje-signals-messages.c
new file mode 100644
index 0000000..2345738
--- /dev/null
+++ b/libraries/edje/src/examples/edje-signals-messages.c
@@ -0,0 +1,230 @@
1/**
2 * Simple Edje example illustrating the Edje signals and messages
3 *
4 * You'll need at least one Evas engine built for it (excluding the
5 * buffer one). See stdout/stderr for output.
6 *
7 * @verbatim
8 * gcc -o edje-signals-messages edje-signals-messages.c `pkg-config --libs --cflags evas ecore ecore-evas edje`
9 * @endverbatim
10 */
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#else
15#define PACKAGE_EXAMPLES_DIR "."
16#define __UNUSED__
17#endif
18
19#include <Ecore.h>
20#include <Ecore_Evas.h>
21#include <Edje.h>
22#include <stdio.h>
23
24#define WIDTH (300)
25#define HEIGHT (300)
26
27#define MSG_COLOR 1
28#define MSG_TEXT 2
29
30static const char *border_img_path = PACKAGE_EXAMPLES_DIR "/red.png";
31static const char *edje_file_path = \
32 PACKAGE_EXAMPLES_DIR "/signals-messages.edj";
33
34static Ecore_Evas *ee;
35static Evas_Object *edje_obj;
36static Eina_Bool right_rect_show = EINA_TRUE;
37
38static const char *commands = \
39 "commands are:\n"
40 "\tt - toggle right rectangle's visibility\n"
41 "\th - print help\n";
42
43static void
44_on_keydown(void *data __UNUSED__,
45 Evas *evas __UNUSED__,
46 Evas_Object *o __UNUSED__,
47 void *einfo)
48{
49 Evas_Event_Key_Down *ev = einfo;
50
51 if (strcmp(ev->keyname, "h") == 0) /* print help */
52 {
53 fprintf(stdout, commands);
54 return;
55 }
56
57 if (strcmp(ev->keyname, "t") == 0) /* toggle right rectangle's visibility */
58 {
59 char buf[1024];
60
61 right_rect_show = !right_rect_show;
62 snprintf(buf, sizeof(buf), "part_right,%s",
63 right_rect_show ? "show" : "hide");
64
65 printf("emitting %s\n", buf);
66
67 edje_object_signal_emit(edje_obj, buf, "");
68
69 return;
70 }
71}
72
73static void
74_on_delete(Ecore_Evas *ee __UNUSED__)
75{
76 ecore_main_loop_quit();
77}
78
79/* print signals coming from theme */
80static void
81_sig_print(const char *emission,
82 const char *source)
83{
84 fprintf(stdout, "Signal %s coming from part %s!\n", emission, source);
85}
86
87static void
88_mouse_wheel_cb(void *data __UNUSED__,
89 Evas_Object *obj __UNUSED__,
90 const char *emission,
91 const char *source)
92{
93 _sig_print(emission, source);
94}
95
96/* mouse over signals */
97static void
98_mouse_over_cb(void *data __UNUSED__,
99 Evas_Object *obj __UNUSED__,
100 const char *emission,
101 const char *source)
102{
103 int i;
104
105 _sig_print(emission, source);
106
107 Edje_Message_Int_Set *msg = malloc(sizeof(*msg) + 3 * sizeof(int));
108 msg->count = 4;
109 for (i = 0; i < 4; i++)
110 msg->val[i] = rand() % 256;
111
112 edje_object_message_send(edje_obj, EDJE_MESSAGE_INT_SET, MSG_COLOR, msg);
113
114 free(msg);
115}
116
117/* print out received message string */
118static void
119_message_handle(void *data __UNUSED__,
120 Evas_Object *obj __UNUSED__,
121 Edje_Message_Type type,
122 int id,
123 void *msg)
124{
125 Edje_Message_String *m;
126
127 if (type != EDJE_MESSAGE_STRING) return;
128 if (id != MSG_TEXT) return;
129
130 m = msg;
131
132 fprintf(stdout, "String message received: %s\n", m->str);
133}
134
135int
136main(void)
137{
138 Evas_Object *border, *bg;
139 Evas *evas;
140
141 srand(time(NULL));
142
143 if (!ecore_evas_init())
144 return EXIT_FAILURE;
145
146 if (!edje_init())
147 return EXIT_FAILURE;
148
149 /* this will give you a window with an Evas canvas under the first
150 * engine available */
151 ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
152 if (!ee)
153 goto error;
154
155 ecore_evas_callback_delete_request_set(ee, _on_delete);
156 ecore_evas_title_set(ee, "Edje Basics Example");
157 ecore_evas_show(ee);
158
159 evas = ecore_evas_get(ee);
160
161 bg = evas_object_rectangle_add(evas);
162 evas_object_color_set(bg, 255, 255, 255, 255); /* white bg */
163 evas_object_move(bg, 0, 0); /* at canvas' origin */
164 evas_object_resize(bg, WIDTH, HEIGHT); /* covers full canvas */
165 evas_object_show(bg);
166 ecore_evas_object_associate(ee, bg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE);
167
168 evas_object_focus_set(bg, EINA_TRUE);
169 evas_object_event_callback_add(
170 bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL);
171
172 edje_obj = edje_object_add(evas);
173
174 if (!edje_object_file_set(edje_obj, edje_file_path, "example_group"))
175 {
176 int err = edje_object_load_error_get(edje_obj);
177 const char *errmsg = edje_load_error_str(err);
178 fprintf(stderr, "Could not load 'example_group' from "
179 "signals-messages.edj: %s\n", errmsg);
180
181 evas_object_del(edje_obj);
182 goto error_edj;
183 }
184
185 edje_object_signal_callback_add(edje_obj, "mouse,wheel,*", "part_left",
186 _mouse_wheel_cb, NULL);
187
188 edje_object_signal_callback_add(edje_obj, "mouse,over", "part_right",
189 _mouse_over_cb, NULL);
190
191 edje_object_message_handler_set(edje_obj, _message_handle, NULL);
192
193 evas_object_move(edje_obj, 20, 20);
194 evas_object_resize(edje_obj, WIDTH - 40, HEIGHT - 40);
195 evas_object_show(edje_obj);
196
197 /* this is a border around the Edje object above, here just to
198 * emphasize its geometry */
199 border = evas_object_image_filled_add(evas);
200 evas_object_image_file_set(border, border_img_path, NULL);
201 evas_object_image_border_set(border, 2, 2, 2, 2);
202 evas_object_image_border_center_fill_set(border, EVAS_BORDER_FILL_NONE);
203
204 evas_object_resize(border, WIDTH - 40 + 4, HEIGHT - 40 + 4);
205 evas_object_move(border, 20 - 2, 20 - 2);
206 evas_object_repeat_events_set(border, EINA_TRUE);
207 evas_object_show(border);
208
209 fprintf(stdout, commands);
210 ecore_main_loop_begin();
211
212 ecore_evas_free(ee);
213 ecore_evas_shutdown();
214 edje_shutdown();
215 return 0;
216
217error:
218 fprintf(stderr, "You got to have at least one Evas engine built"
219 " and linked up to ecore-evas for this example to run"
220 " properly.\n");
221 ecore_evas_shutdown();
222 return -1;
223
224error_edj:
225 fprintf(stderr, "Failed to load signals-messages.edj!\n");
226
227 ecore_evas_shutdown();
228 return -2;
229}
230
diff --git a/libraries/edje/src/examples/edje-swallow.c b/libraries/edje/src/examples/edje-swallow.c
new file mode 100644
index 0000000..a1d30e2
--- /dev/null
+++ b/libraries/edje/src/examples/edje-swallow.c
@@ -0,0 +1,95 @@
1/**
2 * Simple Edje example illustrating swallow functions.
3 *
4 * You'll need at least one Evas engine built for it (excluding the
5 * buffer one). See stdout/stderr for output.
6 *
7 * @verbatim
8 * edje_cc swallow.edc && gcc -o edje-swallow edje-swallow.c `pkg-config --libs --cflags evas ecore ecore-evas edje`
9 * @endverbatim
10 */
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#else
15#define PACKAGE_EXAMPLES_DIR "."
16#define __UNUSED__
17#endif
18
19#include <Ecore.h>
20#include <Ecore_Evas.h>
21#include <Edje.h>
22
23#define WIDTH (300)
24#define HEIGHT (300)
25
26static const char *edje_file_path = PACKAGE_EXAMPLES_DIR "/swallow.edj";
27
28static Ecore_Evas *ee;
29static Evas_Object *bg;
30
31static void
32_on_delete(Ecore_Evas *ee __UNUSED__)
33{
34 ecore_main_loop_quit();
35}
36
37/* here just to keep our example's window size and background image's
38 * size in synchrony */
39static void
40_canvas_resize_cb(Ecore_Evas *ee)
41{
42 int w, h;
43
44 ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
45 evas_object_resize(bg, w, h);
46}
47
48int
49main(void)
50{
51 Evas_Object *edje_obj, *rect, *obj;
52 Evas *evas;
53
54 ecore_evas_init();
55 edje_init();
56
57 /* this will give you a window with an Evas canvas under the first
58 * engine available */
59 ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
60
61 ecore_evas_callback_delete_request_set(ee, _on_delete);
62 ecore_evas_callback_resize_set(ee, _canvas_resize_cb);
63 ecore_evas_title_set(ee, "Edje Swallow Example");
64 ecore_evas_show(ee);
65
66 evas = ecore_evas_get(ee);
67
68 bg = evas_object_rectangle_add(evas);
69 evas_object_color_set(bg, 255, 255, 255, 255); /* white bg */
70 evas_object_move(bg, 0, 0); /* at canvas' origin */
71 evas_object_resize(bg, WIDTH, HEIGHT); /* covers full canvas */
72 evas_object_show(bg);
73
74 edje_obj = edje_object_add(evas);
75
76 edje_object_file_set(edje_obj, edje_file_path, "example_group");
77 evas_object_move(edje_obj, 20, 20);
78 evas_object_resize(edje_obj, WIDTH - 40, HEIGHT - 40);
79 evas_object_show(edje_obj);
80
81 rect = evas_object_rectangle_add(evas);
82 evas_object_color_set(rect, 255, 0, 0, 255);
83 edje_object_part_swallow(edje_obj, "part_one", rect);
84
85 obj = edje_object_part_swallow_get(edje_obj, "part_one");
86 if(obj == rect)
87 printf("Swallowing worked!\n");
88
89 ecore_main_loop_begin();
90
91 ecore_evas_free(ee);
92 ecore_evas_shutdown();
93 edje_shutdown();
94 return 0;
95}
diff --git a/libraries/edje/src/examples/edje-table.c b/libraries/edje/src/examples/edje-table.c
new file mode 100644
index 0000000..3866d22
--- /dev/null
+++ b/libraries/edje/src/examples/edje-table.c
@@ -0,0 +1,165 @@
1/**
2 * Simple Edje example illustrating table functions.
3 *
4 * You'll need at least one Evas engine built for it (excluding the
5 * buffer one). See stdout/stderr for output.
6 *
7 * @verbatim
8 * edje_cc table.edc && gcc -o edje-table edje-table.c `pkg-config --libs --cflags evas ecore ecore-evas edje`
9 * @endverbatim
10 */
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#else
15#define PACKAGE_EXAMPLES_DIR "."
16#define __UNUSED__
17#endif
18
19#include <Ecore.h>
20#include <Ecore_Evas.h>
21#include <Edje.h>
22
23#define WIDTH (400)
24#define HEIGHT (400)
25
26static const char *edje_file_path = PACKAGE_EXAMPLES_DIR "/table.edj";
27
28static Ecore_Evas *ee;
29static Evas *evas;
30static Evas_Object *bg, *edje_obj, *rects[4];
31
32static void
33_on_delete(Ecore_Evas *ee __UNUSED__)
34{
35 ecore_main_loop_quit();
36}
37
38/* Try to get the number of columns and rows of the table
39 * and print them. */
40static void
41_columns_rows_print(void)
42{
43 int cols, rows;
44
45 if (edje_object_part_table_col_row_size_get(edje_obj, "table_part", &cols,
46 &rows))
47 fprintf(stdout, "Number of columns: %d\nNumber of rows: %d\n", cols, rows);
48 else
49 fprintf(stderr, "Cannot get the number of columns and rows\n");
50}
51
52/* here just to keep our example's window size and table items
53 * size in synchrony. */
54static void
55_canvas_resize_cb(Ecore_Evas *ee)
56{
57 int i, w, h;
58
59 ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
60
61 evas_object_resize(bg, w, h);
62 evas_object_resize(edje_obj, w, h);
63
64 for (i = 0; i < 4; i++)
65 evas_object_size_hint_min_set(rects[i], w/2, h/2);
66}
67
68/* Mouse button 1 = remove the clicked item
69 * any other button = remove all items. */
70static void
71_on_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info)
72{
73 Evas_Event_Mouse_Down *ev = event_info;
74
75 if (ev->button != 1)
76 edje_object_part_table_clear(edje_obj, "table_part", EINA_TRUE);
77 else if (!edje_object_part_table_unpack(edje_obj, "table_part", obj))
78 fprintf(stderr, "Cannot remove the selected rectangle\n");
79
80 evas_object_del(obj);
81 _columns_rows_print();
82}
83
84static void
85_rects_create(void)
86{
87 int i;
88
89 for (i = 0; i < 4; i++)
90 {
91 rects[i] = evas_object_rectangle_add(evas);
92 evas_object_size_hint_min_set(rects[i], 200, 200);
93 evas_object_size_hint_weight_set(rects[i], 1.0, 1.0);
94 evas_object_show(rects[i]);
95 evas_object_event_callback_add(rects[i], EVAS_CALLBACK_MOUSE_DOWN,
96 _on_mouse_down, NULL);
97 }
98}
99
100int
101main(void)
102{
103 int i;
104
105 ecore_evas_init();
106 edje_init();
107
108 /* this will give you a window with an Evas canvas under the first
109 * engine available */
110 ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
111
112 ecore_evas_callback_delete_request_set(ee, _on_delete);
113 ecore_evas_callback_resize_set(ee, _canvas_resize_cb);
114 ecore_evas_title_set(ee, "Edje Table Example");
115 ecore_evas_show(ee);
116
117 evas = ecore_evas_get(ee);
118
119 bg = evas_object_rectangle_add(evas);
120 evas_object_color_set(bg, 255, 255, 255, 255); /* white bg */
121 evas_object_move(bg, 0, 0); /* at canvas' origin */
122 evas_object_resize(bg, WIDTH, HEIGHT); /* covers full canvas */
123 evas_object_show(bg);
124
125 edje_obj = edje_object_add(evas);
126
127 edje_object_file_set(edje_obj, edje_file_path, "example_table");
128 evas_object_move(edje_obj, 0, 0); /* at canvas' origin */
129 evas_object_resize(edje_obj, WIDTH, HEIGHT);
130 evas_object_show(edje_obj);
131
132 _rects_create();
133
134 /* Colouring the rectangles */
135 evas_object_color_set(rects[0], 255, 0, 0, 255);
136 evas_object_color_set(rects[1], 0, 255, 0, 255);
137 evas_object_color_set(rects[2], 0, 0, 255, 255);
138 evas_object_color_set(rects[3], 128, 128, 128, 255);
139
140 /* Packing the rectangles into the table */
141 if (!edje_object_part_table_pack(edje_obj, "table_part", rects[0],
142 0, 0, 1, 2))
143 fprintf(stderr, "Cannot add the rectangle 1 to table\n");
144
145 if (!edje_object_part_table_pack(edje_obj, "table_part", rects[1],
146 0, 1, 1, 1))
147 fprintf(stderr, "Cannot add the rectangle 2 to table\n");
148
149 if (!edje_object_part_table_pack(edje_obj, "table_part", rects[2],
150 1, 0, 1, 1))
151 fprintf(stderr, "Cannot add the rectangle 3 to table\n");
152
153 if (!edje_object_part_table_pack(edje_obj, "table_part", rects[3],
154 1, 1, 1, 1))
155 fprintf(stderr, "Cannot add the rectangle 4 to table\n");
156
157 _columns_rows_print();
158
159 ecore_main_loop_begin();
160
161 ecore_evas_free(ee);
162 ecore_evas_shutdown();
163 edje_shutdown();
164 return 0;
165}
diff --git a/libraries/edje/src/examples/edje-text.c b/libraries/edje/src/examples/edje-text.c
new file mode 100644
index 0000000..0916509
--- /dev/null
+++ b/libraries/edje/src/examples/edje-text.c
@@ -0,0 +1,92 @@
1/**
2 * Simple Edje example illustrating text functions.
3 *
4 * You'll need at least one Evas engine built for it (excluding the
5 * buffer one). See stdout/stderr for output.
6 *
7 * @verbatim
8 * edje_cc text.edc && gcc -o edje-text edje-text.c `pkg-config --libs --cflags ecore-evas edje`
9 * @endverbatim
10 */
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#else
15#define PACKAGE_EXAMPLES_DIR "."
16#define __UNUSED__
17#endif
18
19#include <Ecore.h>
20#include <Ecore_Evas.h>
21#include <Edje.h>
22
23#define WIDTH (300)
24#define HEIGHT (300)
25
26static const char *edje_file_path = PACKAGE_EXAMPLES_DIR "/text.edj";
27
28static Ecore_Evas *ee;
29static Evas_Object *bg;
30
31static void
32_on_delete(Ecore_Evas *ee __UNUSED__)
33{
34 ecore_main_loop_quit();
35}
36
37static void
38_cb(void *data, Evas_Object *obj, const char *part)
39{
40 printf("text: %s\n", edje_object_part_text_unescaped_get(obj, part));
41}
42
43int
44main(void)
45{
46 Evas_Object *edje_obj, *rect, *obj;
47 Evas *evas;
48
49 ecore_evas_init();
50 edje_init();
51
52 /* this will give you a window with an Evas canvas under the first
53 * engine available */
54 ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
55
56 ecore_evas_callback_delete_request_set(ee, _on_delete);
57 ecore_evas_title_set(ee, "Edje text Example");
58 ecore_evas_show(ee);
59
60 evas = ecore_evas_get(ee);
61
62 bg = evas_object_rectangle_add(evas);
63 evas_object_color_set(bg, 255, 255, 255, 255); /* white bg */
64 evas_object_move(bg, 0, 0); /* at canvas' origin */
65 evas_object_resize(bg, WIDTH, HEIGHT); /* covers full canvas */
66 evas_object_show(bg);
67 ecore_evas_object_associate(ee, bg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE);
68
69 edje_obj = edje_object_add(evas);
70
71 edje_object_file_set(edje_obj, edje_file_path, "example_group");
72 evas_object_move(edje_obj, 20, 20);
73 evas_object_resize(edje_obj, WIDTH - 40, HEIGHT - 40);
74 evas_object_show(edje_obj);
75
76 edje_object_text_change_cb_set(edje_obj, _cb, NULL);
77 edje_object_part_text_set(edje_obj, "part_one", "one");
78 edje_object_part_text_set(edje_obj, "part_two", "<b>two");
79
80 edje_object_part_text_select_allow_set(edje_obj, "part_two", EINA_TRUE);
81 edje_object_part_text_select_all(edje_obj, "part_two");
82 printf("selection: %s\n", edje_object_part_text_selection_get(edje_obj, "part_two"));
83 edje_object_part_text_select_none(edje_obj, "part_two");
84 printf("selection: %s\n", edje_object_part_text_selection_get(edje_obj, "part_two"));
85
86 ecore_main_loop_begin();
87
88 ecore_evas_free(ee);
89 ecore_evas_shutdown();
90 edje_shutdown();
91 return 0;
92}
diff --git a/libraries/edje/src/examples/lua_script.edc b/libraries/edje/src/examples/lua_script.edc
new file mode 100644
index 0000000..24e8ebe
--- /dev/null
+++ b/libraries/edje/src/examples/lua_script.edc
@@ -0,0 +1,405 @@
1color_classes {
2 color_class { name: "test_colour"; color: 255 255 255 255; }
3}
4
5fonts {
6 font: "Vera.ttf" "default";
7}
8
9images {
10 image: "bubble.png" COMP;
11 image: "test.png" COMP;
12}
13
14collections {
15 group {
16 name: "main";
17 lua_script_only: 1;
18 lua_script {
19 --// stick object private/local vars here
20 local D;
21 local count = 0;
22 local fndata = 99;
23 local text_geom;
24
25 --// Functions to print tables.
26 local print_table, print_table_start;
27
28 function print_table_start(table, space, name)
29 print(space .. name .. ": ");
30 print(space .. "{");
31 print_table(table, space .. " ");
32 print(space .. "}");
33 end
34
35 function print_table(table, space)
36 for k, v in pairs(table) do
37 if type(v) == "table" then
38 print_table_start(v, space, k);
39 elseif type(v) == "string" then
40 print(space .. k .. ': "' .. v .. '";')
41 else
42 print(space .. k .. ": " .. v .. ";")
43 end
44 end
45 end
46
47 local function mycb3 (v)
48 print("lua::callback transition " .. D.val .. " v: " .. v);
49 d = {};
50 d = edje.size(d);
51 print("lua::objsize= " .. d.w .. " , " .. d.h);
52 sz = {w=v * 80, h=v * 40};
53 D.rect:geom(((d.w / 2) * math.sin(v * 2 * math.pi)) + ((d.w - sz.w) / 2),
54 ((d.h / 2) * math.cos(v * 2 * math.pi)) + ((d.h - sz.h) / 2),
55 sz.w, sz.h);
56 D.rect:color(255, 128, v * 255, 255);
57 d = D.rect:move(d);
58 print("lua::pos= " .. d.x .. " , " .. d.y);
59
60 r = D.rect:above();
61 if (r ~= nil) then
62 print("lua::rcol");
63 r:color(20, v * 255, 60, 255);
64 else
65 print("lua::r none!!!!!!!!!!!!!!1");
66 end
67 d = edje.size();
68 D.clip:geom(10, 10, d.w - 20, d.h - 20);
69 c = D.clip:clipees();
70 for i=1,table.getn(c),1 do
71 d = c[i]:geom();
72 print("lua::" .. i .. " geom = " .. d.x .. "," .. d.y .. " " .. d.w .. "x" .. d.h);
73 end
74 return true; --// repeat the timer
75 end
76
77 local function mycb2 ()
78 print("lua::callback animator " .. count .. " seconds: " .. edje.seconds() .. " looptime: " .. edje.looptime());
79 edje.color_class("test_colour", 255, (count * 10) % 255, 255, 255);
80 edje.text_class("test_text_class", "Sans:style=Bold", ((count * 3) % 100) + 8);
81 if (5 > (count % 10)) then
82 D.text:font("default", 32);
83 else
84 D.text:font("Sans:style=Bold", 32);
85 end
86 edje_geom = edje.geom();
87 text_geom = D.text:geom();
88 D.text:move((edje_geom.w - text_geom.w) / 2, (edje_geom.h - text_geom.h) / 8);
89 return true; --// repeat the timer
90 end
91
92 local function mycb ()
93 print("lua::callback timer " .. count .. " fndata = " .. fndata);
94 count = count + 1; --// keep count of calls - object data
95 fndata = fndata + 3; --// play with object vars to see if they persist
96 D.tim = edje.timer(0.25, mycb); --// inside cb add new timer
97 return false; --// cease repeating the timer
98 end
99
100 --// init object here
101 D = {}; --// data is empty table to start
102 D.val = math.random(); --// start with some random value so
103 fndata = fndata + D.val; --// func data start point
104 print("lua::init ... " .. D.val);
105 edje.echo("lua::echo('hello world')");
106
107 --// actually add the timer to call mycb in 1.23 sec
108 D.tim = edje.timer(1.23, mycb);
109 D.tra = edje.transition(5.0, mycb3);
110 D.ani = edje.animator(mycb2);
111 edje_geom = edje.geom();
112
113 if (edje.spanky) then edje.spanky(); end
114
115 local date = edje.date();
116 print("lua:: date: " ..
117 date.year .. "|" ..
118 date.month .. "|" ..
119 date.day .. "|" ..
120 date.yearday .. "|" ..
121 date.weekday .. "|" ..
122 date.hour .. "|" ..
123 date.min .. "|" ..
124 date.sec
125 );
126
127 --// send some random edje message
128 edje.messagesend(7, "none" );
129 edje.messagesend(7, "sig", "signal", "source");
130 edje.messagesend(7, "str", "hello world");
131 edje.messagesend(7, "int", 987);
132 edje.messagesend(7, "float", 987.321);
133 edje.messagesend(7, "strset", {"hello", "there", "world"});
134 edje.messagesend(7, "intset", {1, 2, 3});
135 edje.messagesend(7, "floatset", {1.1, 2.2, 3.3});
136 edje.messagesend(7, "strint", "hello world", 7);
137 edje.messagesend(7, "strfloat", "hello world", 7.654);
138 edje.messagesend(7, "strintset","hello world", {1, 2, 3});
139
140 D.edje = edje.edje();
141 D.edje:file("plain/edje/group");
142 D.edje:show();
143
144 D.rect = edje.rect();
145 D.rect:geom (5, 10, 50, 30);
146 D.rect:color (255, 128, 60, 255);
147 D.rect:show ();
148
149 D.rect2 = edje.rect();
150 D.rect2:geom (50, 50, 50, 50);
151 D.rect2:color (20, 30, 60, 120);
152 D.rect2:show ();
153
154 D.clip = edje.rect();
155 D.clip:geom (10, 10, 150, 150);
156 D.clip:color (200, 200, 50, 200);
157 D.clip:show ();
158
159 D.rect2:clip(D.clip);
160 D.rect:clip(D.clip);
161
162 D.text = edje.text();
163 D.text:geom (50, 5, 150, 50);
164 D.text:color (255, 0, 0, 255);
165 D.text:font("Sans:style=Bold", 32);
166 D.text:text("Lua rocks!");
167 text_geom = D.text:geom();
168 print(D.text:text());
169 D.text:show();
170
171 --// Fun with maps!
172 D.map = edje.map(4); --// 4 is the only supported map size at the moment.
173 --// These all do the same thing.
174 --// Note, lua likes to start at 1, C (and thus evas) at 0. I choose to agree with C.
175 D.map:coord(0, 50, 50, 0);
176 D.map:coord(1, 100, 50, 0);
177 D.map:coord(2, 100, 100, 0);
178 D.map:coord(3, 50, 100, 0);
179 D.map:populate(50, 50, 50, 50, 0);
180 D.map:populate(D.rect2, 0);
181 D.map:populate(D.rect2);
182
183 --// print the results
184 D.coord = D.map:coord(0);
185 print("lua::map coords for point 0 x=" .. D.coord.x .. " y=" .. D.coord.y .. " z=" .. D.coord.z);
186 D.coord = D.map:coord(1);
187 print("lua::map coords for point 1 x=" .. D.coord.x .. " y=" .. D.coord.y .. " z=" .. D.coord.z);
188 D.coord = D.map:coord(2);
189 print("lua::map coords for point 2 x=" .. D.coord.x .. " y=" .. D.coord.y .. " z=" .. D.coord.z);
190 D.coord = D.map:coord(3);
191 print("lua::map coords for point 3 x=" .. D.coord.x .. " y=" .. D.coord.y .. " z=" .. D.coord.z);
192
193 D.map:smooth(false);
194 D.map:alpha(true);
195
196 if (D.map:alpha()) then
197 print("lua::map is alpha");
198 end
199
200 if (D.map:smooth()) then
201 print("lua::map is smooooth");
202 end
203
204 if (D.map:clockwise()) then
205 print("lua::map is clockwise");
206 end
207
208 D.map:color(255, 255, 255, 255); // set all points to this colour.
209 D.map:color(1, 255, 0, 255, 255); // set just one point to this colour.
210
211 D.map:lighting(75, 75, 10, 255, 255, 255, 0, 255, 0); // Ambient light and a 3D light source.
212
213 --// Toss it around.
214 D.map:rotate(45.0, 75, 75);
215 D.map:zoom(1.5, 1.5, 75, 75);
216 D.map:rotate3d(10.0, 20.0, 30.0, 75, 75, 0);
217 D.map:perspective(200, 200, 0, 20);
218
219 --// For image UV mapping.
220 D.map:uv(0, 0.0, 0.0);
221 D.map:uv(1, 50.0, 0.0);
222 D.map:uv(2, 50.0, 50.0);
223 D.map:uv(3, 0.0, 50.0);
224
225 --// Actually apply the resulting transformations.
226 D.rect2:map(D.map);
227 D.rect2:map_enable(true);
228 if (D.rect2:map_enable()) then
229 print("lua::map enabled");
230 end
231
232 D.rect2:map_source(D.rect); --// Don't think this is actually implemented in evas.
233
234--// D.map:dup();
235--// D.map:size(); --// perhaps overide the # operator? For now it's only gonna return 4 anyway.
236
237 --// example of deleting something
238 --// D.tim:del();
239
240 --// test the color_class stuff
241 colour = edje.color_class("test_colour");
242 print("lua::color_class= " .. colour.r .. "," .. colour.g .. "," .. colour.b .. "," .. colour.a);
243 colour = edje.color_class("test_colour", 32, 64, 255, 128);
244 print("lua::color_class= " .. colour.r .. "," .. colour.g .. "," .. colour.b .. "," .. colour.a);
245 colour = edje.color_class("test_colour", { r=255, g=0, b=255, a=255 });
246 print("lua::color_class= " .. colour.r .. "," .. colour.g .. "," .. colour.b .. "," .. colour.a);
247 text = edje.text_class("test_text_class", "Sans:style=Bold", 8);
248 print("lua::text_class= " .. text.font .. " size " .. text.size);
249
250 --// Do something bad, just to see what happens.
251--// edje.color_class(nil);
252
253 --// shutdown func - generally empty or not there. everything garbage collected for you
254 function shutdown ()
255 print("lua::shutdown ... " .. D.val);
256 end
257
258 function show ()
259 print("lua::show ... " .. D.val);
260 end
261
262 function hide ()
263 print("lua::hide ... " .. D.val);
264 end
265
266 function move (x, y)
267 print("lua::move x=" .. x .. " x=" .. y);
268 D.edje:move(0, 0);
269 end
270
271 function resize (w, h)
272 print("lua::resize w=" .. w .. " h=" .. h);
273 D.text:move((w - text_geom.w) / 2, (h - text_geom.h) / 8);
274 D.edje:resize(w, h);
275 end
276
277 function message (id, type, ...)
278 print("lua::message id=" .. id .. " type=" .. type);
279 --// handle your message type here. check id + type then use the
280 --// vararg appropriately. they are the same as the params passed
281 --// to edje:messagesend() (if any are passed at all). Any array
282 --// arguments are passed as a single table.
283
284 if ("none" == type) then
285 print("lua::message no args");
286 elseif ("strset" == type) then
287 strs = ... ;
288 print_table_start(strs, "", "lua::message strings");
289 elseif ("intset" == type) then
290 ints = ... ;
291 print_table_start(ints, "", "lua::message ints");
292 elseif ("floatset" == type) then
293 floats = ... ;
294 print_table_start(floats, "", "lua::message floats");
295 elseif ("strintset" == type) then
296 str, ints = ... ;
297 print("lua::message " .. str);
298 print_table_start(ints, "", "lua::message ints");
299 elseif ("strfloatset" == type) then
300 str, floats = ... ;
301 print("lua::message " .. str);
302 print_table_start(floats, "", "lua::message floats");
303 else
304 print("lua::message " .. ... );
305 end
306 end
307
308 function signal (sig, src)
309 print("lua::signal sig= " .. sig .. " src= " .. src);
310 end
311 }
312 }
313
314 // The group name NEEDS a / in it,
315 // or the part below that tries to swallow it won't work.
316 // Leaving just the lua part visible.
317 group {
318 name: "bubbles/lua";
319 lua_script_only: 1;
320 lua_script {
321 local bubbles = { };
322 local bubbleCols = 8;
323 local bubbleRows = 6;
324
325 for i = 1, bubbleRows do
326 row = { };
327 for j = 1, bubbleCols do
328 image = edje.image();
329 image:image("bubble.png");
330 image:show();
331 table.insert(row, image);
332 end
333 table.insert(bubbles, row);
334 end
335
336 function resize (w, h)
337 for i = 1, bubbleRows do
338 for j = 1, bubbleCols do
339 w1 = w / bubbleCols;
340 h1 = h / bubbleRows;
341 bubbles[i][j]:geom((j - 1) * w1, (i - 1) * h1, w1, h1);
342 if ((1 == i) or (1 == j) or (bubbleRows == i) or (bubbleCols == j)) then
343 bubbles[i][j]:color(0, 255, 0, 200);
344 else
345 bubbles[i][j]:color(math.random(200) + 55, 0, math.random(255) + 55, 200);
346 end
347 end
348 end
349 end
350 }
351 }
352
353 group {
354 name: "plain/edje/group";
355 parts {
356 part {
357 name: "background";
358 type: RECT;
359 mouse_events: 0;
360 description {
361 state: "default" 0.0;
362 color: 0 0 0 255;
363 }
364 }
365
366 // A lua group embedded in an edje group.
367 part {
368 name: "bubbles_lua";
369 type: GROUP;
370 source: "bubbles/lua";
371 mouse_events: 0;
372 description { state: "default" 0.0; }
373 }
374
375 part {
376 name: "background_image";
377 type: IMAGE;
378 mouse_events: 0;
379 description {
380 state: "default" 0.0;
381 aspect_preference: HORIZONTAL;
382 color_class: "test_colour";
383 image { normal: "test.png"; }
384 }
385 }
386
387 part {
388 name: "some_text";
389 type: TEXT;
390 mouse_events: 0;
391 description {
392 state: "default" 0;
393 text
394 {
395 text: "This is test text.";
396 text_class: "test_text_class";
397 }
398 }
399 }
400
401 }
402 }
403
404}
405
diff --git a/libraries/edje/src/examples/perspective.edc b/libraries/edje/src/examples/perspective.edc
new file mode 100644
index 0000000..810ae18
--- /dev/null
+++ b/libraries/edje/src/examples/perspective.edc
@@ -0,0 +1,140 @@
1collections {
2 group {
3 name: "example/group";
4
5 min: 480 320;
6
7 parts {
8 part {
9 name: "bg";
10 type: RECT;
11 mouse_events: 1;
12
13 description {
14 state: "default" 0.0;
15 }
16 } // bg
17
18 part {
19 name: "rectangle";
20 type: RECT;
21 mouse_events: 0;
22
23 description {
24 state: "default" 0.0;
25 color: 255 0 0 128;
26
27 rel1 {
28 offset: -5 -5;
29 to: "title";
30 }
31 rel2 {
32 offset: 4 4;
33 to: "title";
34 }
35
36 map {
37 on: 1;
38 perspective_on: 1;
39 rotation {
40 x: 45;
41 }
42 }
43 }
44 } // rectangle
45
46 part {
47 name: "title";
48 type: TEXT;
49 mouse_events: 0;
50
51 description {
52 state: "default" 0.0;
53 color: 200 200 200 255;
54
55 align: 0.0 0.5;
56
57 rel1.relative: 0.1 0.1;
58 rel2.relative: 0.1 0.1;
59
60 text {
61 text: "Perspective example";
62 font: "Sans";
63 size: 16;
64 min: 1 1;
65 }
66
67 map {
68 on: 1;
69 perspective_on: 1;
70 rotation {
71 x: 45;
72 }
73 }
74 }
75
76 description {
77 state: "right" 0.0;
78 inherit: "default" 0.0;
79
80 rel1.relative: 0.5 0.1;
81 rel2.relative: 0.5 0.1;
82 }
83 description {
84 state: "bottom" 0.0;
85 inherit: "default" 0.0;
86
87 rel1.relative: 0.1 0.9;
88 rel2.relative: 0.1 0.9;
89 }
90 description {
91 state: "bottomright" 0.0;
92 inherit: "default" 0.0;
93
94 rel1.relative: 0.5 0.9;
95 rel2.relative: 0.5 0.9;
96 }
97 } // title
98 }
99
100 programs {
101 program {
102 name: "move,right";
103 signal: "move,1,0";
104 action: STATE_SET "right" 0.0;
105 transition: SINUSOIDAL 1.0;
106 target: "title";
107 after: "animation,end";
108 }
109 program {
110 name: "move,bottom";
111 signal: "move,0,1";
112 action: STATE_SET "bottom" 0.0;
113 transition: SINUSOIDAL 1.0;
114 target: "title";
115 after: "animation,end";
116 }
117 program {
118 name: "move,bottomright";
119 signal: "move,1,1";
120 action: STATE_SET "bottomright" 0.0;
121 transition: SINUSOIDAL 1.0;
122 target: "title";
123 after: "animation,end";
124 }
125 program {
126 name: "move,default";
127 signal: "move,0,0";
128 action: STATE_SET "default" 0.0;
129 transition: SINUSOIDAL 1.0;
130 target: "title";
131 after: "animation,end";
132 }
133
134 program {
135 name: "animation,end";
136 action: SIGNAL_EMIT "animation,end" "";
137 }
138 }
139 }
140}
diff --git a/libraries/edje/src/examples/red.png b/libraries/edje/src/examples/red.png
new file mode 100644
index 0000000..dd03528
--- /dev/null
+++ b/libraries/edje/src/examples/red.png
Binary files differ
diff --git a/libraries/edje/src/examples/signals-messages.edc b/libraries/edje/src/examples/signals-messages.edc
new file mode 100644
index 0000000..45d9c58
--- /dev/null
+++ b/libraries/edje/src/examples/signals-messages.edc
@@ -0,0 +1,174 @@
1#define MSG_COLOR 1
2#define MSG_TEXT 2
3
4collections {
5 group {
6 name: "example_group";
7
8 parts {
9 part {
10 name: "part_right";
11 type: RECT;
12 clip_to: "part_right_clipper";
13 description {
14 min: 50 50;
15 max: 50 50;
16 state: "default" 0.0;
17 color: 0 0 255 255; /* blue */
18 rel1.relative: 1.0 0.5;
19 rel1.offset: -49 0;
20 rel2.relative: 1.0 0.5;
21 }
22 }
23
24 part {
25 name: "part_left";
26 type: RECT;
27 description {
28 color_class: "cc";
29 min: 50 50;
30 max: 50 50;
31 state: "default" 0.0;
32 rel1.relative: 0.0 0.5;
33 rel2.relative: 0.0 0.5;
34 rel2.offset: 50 -1;
35 }
36 }
37
38 part {
39 name: "text";
40 type: TEXT;
41 description {
42 min: 150 50;
43 max: 150 50;
44 fixed: 1 1;
45 color: 0 0 0 255;
46 state: "default" 0.0;
47 rel1.relative: 0.5 0.5;
48 rel2.relative: 0.5 0.5;
49 text {
50 font: "Sans";
51 size: 20;
52 min: 1 1;
53 align: 0.5 0.5;
54 }
55 }
56 }
57
58 part {
59 name: "part_right_clipper";
60 type: RECT;
61 repeat_events: 1;
62
63 description {
64 min: 50 50;
65 max: 50 50;
66
67 state: "default" 0.0;
68 rel1.relative: 1.0 0.5;
69 rel1.offset: -49 0;
70 rel2.relative: 1.0 0.5;
71 }
72
73 description {
74 state: "hidden" 0.0;
75 inherit: "default" 0.0;
76 visible: 0;
77 }
78 }
79 }
80
81 script {
82 public global_str0;
83 public global_str1;
84 public global_str2;
85 public str_idx;
86
87 public set_text_string() {
88 new tmp[1024];
89 new idx;
90 idx = get_int(str_idx);
91
92 if (idx == 0)
93 get_str(global_str0, tmp, 1024);
94 else if (idx == 1)
95 get_str(global_str1, tmp, 1024);
96 else if (idx == 2)
97 get_str(global_str2, tmp, 1024);
98 else return;
99
100 set_text(PART:"text", tmp);
101 send_message(MSG_STRING, MSG_TEXT, tmp);
102 }
103
104 public message(Msg_Type:type, id, ...) {
105 if ((type == MSG_INT_SET) && (id == MSG_COLOR)) {
106 new r, g, b, a;
107
108 r = getarg(3);
109 g = getarg(4);
110 b = getarg(5);
111 a = getarg(6);
112
113 set_color_class("cc", r, g, b, a);
114 }
115 }
116 }
117
118 programs {
119 program {
120 name: "bootstrap";
121 signal: "load";
122 source: "";
123 script {
124 set_str(global_str0, "String one");
125 set_str(global_str1, "String two");
126 set_str(global_str2, "String three");
127 set_int(str_idx, 0);
128 set_text_string();
129 }
130 }
131
132 program { /* custom signal */
133 name: "part_right,hovered";
134 signal: "mouse,move";
135 source: "part_right";
136 action: SIGNAL_EMIT "mouse,over" "part_right";
137 }
138
139 program { /* hide right rectangle */
140 name: "part_right,hide";
141 signal: "part_right,hide";
142 source: "";
143 action: STATE_SET "hidden" 0.0;
144 target: "part_right_clipper";
145 }
146
147 program {
148 name: "part_right,show";
149 signal: "part_right,show";
150 source: "";
151 action: STATE_SET "default" 0.0;
152 target: "part_right_clipper";
153 }
154
155 program { /* change text part's string value */
156 name: "text,change";
157 signal: "mouse,clicked,1";
158 source: "part_left";
159 script {
160 new idx;
161 idx = get_int(str_idx);
162 idx = idx + 1;
163
164 if (idx > 2)
165 set_int(str_idx, 0);
166 else
167 set_int(str_idx, idx);
168
169 set_text_string();
170 }
171 }
172 }
173 }
174}
diff --git a/libraries/edje/src/examples/sigtest.c b/libraries/edje/src/examples/sigtest.c
new file mode 100644
index 0000000..6e4d85f
--- /dev/null
+++ b/libraries/edje/src/examples/sigtest.c
@@ -0,0 +1,309 @@
1#ifdef HAVE_CONFIG_H
2#include "config.h"
3#else
4#define PACKAGE_EXAMPLES_DIR "."
5#define __UNUSED__
6#endif
7
8#include <Ecore.h>
9#include <Ecore_Evas.h>
10#include <Edje.h>
11#include <stdio.h>
12
13#define WIDTH (300)
14#define HEIGHT (300)
15
16static const char *border_img_path = PACKAGE_EXAMPLES_DIR "/red.png";
17static const char *edje_file_path = PACKAGE_EXAMPLES_DIR "/sigtest.edj";
18
19static Ecore_Evas *ee;
20static Evas_Object *edje_obj;
21
22static const char commands[] = \
23 "commands are:\n"
24 "\te - change te edje base\n"
25 "\tl - change to lua base\n"
26 "\tm - send message\n"
27 "\ts - send signal\n"
28 "\th - print help\n";
29
30static void
31_on_keydown(void *data __UNUSED__,
32 Evas *evas __UNUSED__,
33 Evas_Object *o __UNUSED__,
34 void *einfo)
35{
36 Evas_Event_Key_Down *ev = einfo;
37
38 if (strcmp(ev->keyname, "h") == 0)
39 {
40 fprintf(stdout, commands);
41 return;
42 }
43
44 if (strcmp(ev->keyname, "e") == 0)
45 {
46 if (!edje_object_file_set(edje_obj, edje_file_path, "plain/edje/group"))
47 {
48 int err = edje_object_load_error_get(edje_obj);
49 const char *errmsg = edje_load_error_str(err);
50
51 fprintf(stderr, "Could not load 'plain/edje/group' from sigtest.edj: %s\n", errmsg);
52 }
53 else
54 fprintf(stdout, "Loaded Edje object bound to group 'plain/edje/group' from"
55 " file sigtest.edj with success!\n");
56 return;
57 }
58
59 if (strcmp(ev->keyname, "l") == 0)
60 {
61 if (!edje_object_file_set(edje_obj, edje_file_path, "lua_base"))
62 {
63 int err = edje_object_load_error_get(edje_obj);
64 const char *errmsg = edje_load_error_str(err);
65
66 fprintf(stderr, "Could not load 'lua_base' from sigtest.edj: %s\n", errmsg);
67 }
68 else
69 fprintf(stdout, "Loaded Edje object bound to group 'lua_base' from"
70 " file sigtest.edj with success!\n");
71 return;
72 }
73
74 if (strcmp(ev->keyname, "m") == 0)
75 {
76 Edje_Message_String *msg = malloc(sizeof(*msg));
77
78 fprintf(stdout, "\n");
79 msg->str = strdup("C message text");
80 edje_object_message_send(edje_obj, EDJE_MESSAGE_STRING, 2, msg);
81 free(msg);
82 fprintf(stdout, "C message sent\n");
83 return;
84 }
85
86 if (strcmp(ev->keyname, "s") == 0)
87 {
88 fprintf(stdout, "\n");
89 edje_object_signal_emit(edje_obj, "C signal 1", "Csource");
90 edje_object_signal_emit(edje_obj, "bubbles_lua:C signal 2", "Csource");
91 fprintf(stdout, "C signal sent\n");
92 return;
93 }
94}
95
96static void
97_on_message(void *data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg)
98{
99 int i;
100
101 fprintf(stdout, "C::message id=%d type=%d ", id, type);
102 switch (type)
103 {
104 case EDJE_MESSAGE_NONE :
105 {
106 fprintf(stdout, " NONE");
107 break;
108 }
109
110 case EDJE_MESSAGE_SIGNAL :
111 {
112 fprintf(stdout, " SIGNAL ");
113 break;
114 }
115
116 case EDJE_MESSAGE_STRING :
117 {
118 Edje_Message_String *mmsg = msg;
119
120 fprintf(stdout, " STRING %s", mmsg->str);
121 break;
122 }
123
124 case EDJE_MESSAGE_INT :
125 {
126 Edje_Message_Int *mmsg = msg;
127
128 fprintf(stdout, " INT %d", mmsg->val);
129 break;
130 }
131
132 case EDJE_MESSAGE_FLOAT :
133 {
134 Edje_Message_Float *mmsg = msg;
135
136 fprintf(stdout, " FLOAT %f", mmsg->val);
137 break;
138 }
139
140 case EDJE_MESSAGE_STRING_SET :
141 {
142 Edje_Message_String_Set *mmsg = msg;
143
144 fprintf(stdout, " STRING_SET -\n");
145 for (i = 0; i < mmsg->count; i++)
146 fprintf(stdout, " %s\n", mmsg->str[i]);
147 break;
148 }
149
150 case EDJE_MESSAGE_INT_SET :
151 {
152 Edje_Message_Int_Set *mmsg = msg;
153
154 fprintf(stdout, " INT_SET -\n");
155 for (i = 0; i < mmsg->count; i++)
156 fprintf(stdout, " %d\n", mmsg->val[i]);
157 break;
158 }
159
160 case EDJE_MESSAGE_FLOAT_SET :
161 {
162 Edje_Message_Float_Set *mmsg = msg;
163
164 fprintf(stdout, " FLOAT_SET -\n");
165 for (i = 0; i < mmsg->count; i++)
166 fprintf(stdout, " %f\n", mmsg->val[i]);
167 break;
168 }
169
170 case EDJE_MESSAGE_STRING_INT :
171 {
172 Edje_Message_String_Int *mmsg = msg;
173
174 fprintf(stdout, " STRING_INT %s %d", mmsg->str, mmsg->val);
175 break;
176 }
177
178 case EDJE_MESSAGE_STRING_FLOAT :
179 {
180 Edje_Message_String_Float *mmsg = msg;
181
182 fprintf(stdout, " STRING_FLOAT %s %f", mmsg->str, mmsg->val);
183 break;
184 }
185
186 case EDJE_MESSAGE_STRING_INT_SET :
187 {
188 Edje_Message_String_Int_Set *mmsg = msg;
189
190 fprintf(stdout, " STRING_INT_SET %s -\n", mmsg->str);
191 for (i = 0; i < mmsg->count; i++)
192 fprintf(stdout, " %d\n", mmsg->val[i]);
193 break;
194 }
195
196 case EDJE_MESSAGE_STRING_FLOAT_SET :
197 {
198 Edje_Message_String_Float_Set *mmsg = msg;
199
200 fprintf(stdout, " STRING_FLOAT_SET %s -\n", mmsg->str);
201 for (i = 0; i < mmsg->count; i++)
202 fprintf(stdout, " %f\n", mmsg->val[i]);
203 break;
204 }
205 }
206 fprintf(stdout, "\n");
207}
208
209static void
210_on_signal(void *data, Evas_Object *obj __UNUSED__, const char *emission, const char *source)
211{
212 fprintf(stdout, "C::signal sig=|%s| src=|%s|\n", emission, source);
213}
214
215static void
216_on_delete(Ecore_Evas *ee __UNUSED__)
217{
218 ecore_main_loop_quit();
219}
220
221int
222main(void)
223{
224 Evas_Object *border, *bg;
225 Evas *evas;
226
227 if (!ecore_evas_init())
228 return EXIT_FAILURE;
229
230 if (!edje_init())
231 return EXIT_FAILURE;
232
233 /* this will give you a window with an Evas canvas under the first
234 * engine available */
235 ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
236 if (!ee)
237 goto error;
238
239 ecore_evas_callback_delete_request_set(ee, _on_delete);
240 ecore_evas_title_set(ee, "Signals and wessages tester");
241 ecore_evas_show(ee);
242
243 evas = ecore_evas_get(ee);
244
245 bg = evas_object_rectangle_add(evas);
246 evas_object_color_set(bg, 255, 255, 255, 255); /* white bg */
247 evas_object_move(bg, 0, 0); /* at canvas' origin */
248 evas_object_resize(bg, WIDTH, HEIGHT); /* covers full canvas */
249 evas_object_show(bg);
250 ecore_evas_object_associate(ee, bg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE);
251
252 evas_object_focus_set(bg, EINA_TRUE);
253 evas_object_event_callback_add(
254 bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL);
255
256 edje_obj = edje_object_add(evas);
257
258 edje_object_message_handler_set(edje_obj, _on_message, NULL);
259 edje_object_signal_callback_add(edje_obj, "*", "*", _on_signal, NULL);
260
261 if (!edje_object_file_set(edje_obj, edje_file_path, "lua_base"))
262 {
263 int err = edje_object_load_error_get(edje_obj);
264 const char *errmsg = edje_load_error_str(err);
265 fprintf(stderr, "Could not load 'lua_base' from sigtest.edj: %s\n",
266 errmsg);
267
268 evas_object_del(edje_obj);
269 goto error_edj;
270 }
271
272 fprintf(stdout, "Loaded Edje object bound to group 'lua_base' from"
273 " file sigtest.edj with success!\n");
274
275 evas_object_move(edje_obj, 20, 20);
276 evas_object_resize(edje_obj, WIDTH - 40, HEIGHT - 40);
277 evas_object_show(edje_obj);
278
279 /* this is a border around the Edje object above, here just to
280 * emphasize its geometry */
281 border = evas_object_image_filled_add(evas);
282 evas_object_image_file_set(border, border_img_path, NULL);
283 evas_object_image_border_set(border, 2, 2, 2, 2);
284 evas_object_image_border_center_fill_set(border, EVAS_BORDER_FILL_NONE);
285
286 evas_object_resize(border, WIDTH - 40 + 4, HEIGHT - 40 + 4);
287 evas_object_move(border, 20 - 2, 20 - 2);
288 evas_object_show(border);
289
290 ecore_main_loop_begin();
291
292 ecore_evas_free(ee);
293 ecore_evas_shutdown();
294 edje_shutdown();
295 return 0;
296
297error:
298 fprintf(stderr, "You got to have at least one evas engine built"
299 " and linked up to ecore-evas for this example to run"
300 " properly.\n");
301 ecore_evas_shutdown();
302 return -1;
303
304error_edj:
305 fprintf(stderr, "Failed to load sigtest.edj!\n");
306
307 ecore_evas_shutdown();
308 return -2;
309}
diff --git a/libraries/edje/src/examples/sigtest.edc b/libraries/edje/src/examples/sigtest.edc
new file mode 100644
index 0000000..ef2a854
--- /dev/null
+++ b/libraries/edje/src/examples/sigtest.edc
@@ -0,0 +1,303 @@
1fonts {
2 font: "Vera.ttf" "default";
3}
4
5images {
6 image: "bubble.png" COMP;
7}
8
9collections {
10 group {
11 name: "lua_base";
12 lua_script_only: 1;
13 lua_script {
14 --// stick object private/local vars here
15 local D;
16 local text_geom;
17
18 --// Functions to print tables.
19 local print_table, print_table_start;
20
21 function print_table_start(table, space, name)
22 print(space .. name .. ": ");
23 print(space .. "{");
24 print_table(table, space .. " ");
25 print(space .. "}");
26 end
27
28 function print_table(table, space)
29 for k, v in pairs(table) do
30 if type(v) == "table" then
31 print_table_start(v, space, k);
32 elseif type(v) == "string" then
33 print(space .. k .. ': "' .. v .. '";')
34 else
35 print(space .. k .. ": " .. v .. ";")
36 end
37 end
38 end
39
40
41 --// init object here
42 D = {}; --// data is empty table to start
43 edje_geom = edje.geom();
44
45 D.edje = edje.edje();
46 D.edje:file("plain/edje/group");
47 D.edje:move(0, 0);
48 D.edje:resize(edje_geom.w, edje_geom.h);
49 D.edje:show();
50
51 edje.text_class("test_text_class", "Sans:style=Bold", 10);
52
53 --// send some random edje message
54 edje.messagesend(7, "none" );
55 edje.messagesend(7, "sig", "lua message signal", "luaSource");
56 edje.messagesend(7, "str", "hello world");
57 edje.messagesend(7, "int", 987);
58 edje.messagesend(7, "float", 987.321);
59 edje.messagesend(7, "strset", {"hello", "there", "world"});
60 edje.messagesend(7, "intset", {1, 2, 3});
61 edje.messagesend(7, "floatset", {1.1, 2.2, 3.3});
62 edje.messagesend(7, "strint", "hello world", 7);
63 edje.messagesend(7, "strfloat", "hello world", 7.654);
64 edje.messagesend(7, "strintset","hello world", {1, 2, 3});
65 --// and a signal
66 edje.emit("lua signal", "luaSource");
67
68
69 function move (x, y)
70 print("lua::move x=" .. x .. " x=" .. y);
71 D.edje:move(0, 0);
72 end
73
74 function resize (w, h)
75 print("lua::resize w=" .. w .. " h=" .. h);
76 D.edje:resize(w, h);
77 end
78
79 function message (id, type, ...)
80 print("lua::message id=" .. id .. " type=" .. type);
81 --// handle your message type here. check id + type then use the
82 --// vararg appropriately. they are the same as the params passed
83 --// to edje:messagesend() (if any are passed at all). Any array
84 --// arguments are passed as a single table.
85
86 if ("none" == type) then
87 print("lua::message no args");
88 elseif ("strset" == type) then
89 strs = ... ;
90 print_table_start(strs, "", "lua::message strings");
91 elseif ("intset" == type) then
92 ints = ... ;
93 print_table_start(ints, "", "lua::message ints");
94 elseif ("floatset" == type) then
95 floats = ... ;
96 print_table_start(floats, "", "lua::message floats");
97 elseif ("strintset" == type) then
98 str, ints = ... ;
99 print("lua::message " .. str);
100 print_table_start(ints, "", "lua::message ints");
101 elseif ("strfloatset" == type) then
102 str, floats = ... ;
103 print("lua::message " .. str);
104 print_table_start(floats, "", "lua::message floats");
105 else
106 print("lua::message " .. ... );
107 end
108 end
109
110 function signal (sig, src)
111 print("lua::signal sig=|" .. sig .. "| src=" .. src .. "|");
112 end
113 }
114 }
115
116 // The group name NEEDS a / in it,
117 // or the part below that tries to swallow it won't work.
118 // Leaving just the lua part visible.
119 group {
120 name: "bubbles/lua";
121 lua_script_only: 1;
122 lua_script {
123 local bubbles = { };
124 local bubbleCols = 8;
125 local bubbleRows = 6;
126
127 --// Functions to print tables.
128 local print_table, print_table_start;
129
130 function print_table_start(table, space, name)
131 print(space .. name .. ": ");
132 print(space .. "{");
133 print_table(table, space .. " ");
134 print(space .. "}");
135 end
136
137 function print_table(table, space)
138 for k, v in pairs(table) do
139 if type(v) == "table" then
140 print_table_start(v, space, k);
141 elseif type(v) == "string" then
142 print(space .. k .. ': "' .. v .. '";')
143 else
144 print(space .. k .. ": " .. v .. ";")
145 end
146 end
147 end
148
149
150 for i = 1, bubbleRows do
151 row = { };
152 for j = 1, bubbleCols do
153 image = edje.image();
154 image:image("bubble.png");
155 image:show();
156 table.insert(row, image);
157 end
158 table.insert(bubbles, row);
159 end
160
161 function resize (w, h)
162 for i = 1, bubbleRows do
163 for j = 1, bubbleCols do
164 w1 = w / bubbleCols;
165 h1 = h / bubbleRows;
166 bubbles[i][j]:geom((j - 1) * w1, (i - 1) * h1, w1, h1);
167 if ((1 == i) or (1 == j) or (bubbleRows == i) or (bubbleCols == j)) then
168 bubbles[i][j]:color(0, 255, 0, 200);
169 else
170 bubbles[i][j]:color(math.random(200) + 55, 0, math.random(255) + 55, 200);
171 end
172 end
173 end
174 end
175
176 function message (id, type, ...)
177 print("bubbles::message id=" .. id .. " type=" .. type);
178 --// handle your message type here. check id + type then use the
179 --// vararg appropriately. they are the same as the params passed
180 --// to edje:messagesend() (if any are passed at all). Any array
181 --// arguments are passed as a single table.
182
183 if ("none" == type) then
184 print("bubbles::message no args");
185 elseif ("strset" == type) then
186 strs = ... ;
187 print_table_start(strs, "", "bubbles::message strings");
188 elseif ("intset" == type) then
189 ints = ... ;
190 print_table_start(ints, "", "bubbles::message ints");
191 elseif ("floatset" == type) then
192 floats = ... ;
193 print_table_start(floats, "", "bubbles::message floats");
194 elseif ("strintset" == type) then
195 str, ints = ... ;
196 print("bubbles::message " .. str);
197 print_table_start(ints, "", "bubbles::message ints");
198 elseif ("strfloatset" == type) then
199 str, floats = ... ;
200 print("bubbles::message " .. str);
201 print_table_start(floats, "", "bubbles::message floats");
202 else
203 print("bubbles::message " .. ... );
204 end
205 end
206
207 function signal (sig, src)
208 print("bubbles::signal sig=|" .. sig .. "| src=|" .. src .. "|");
209 end
210 }
211 }
212
213 group {
214 name: "plain/edje/group";
215 parts {
216 part {
217 name: "background";
218 type: RECT;
219 mouse_events: 0;
220 description {
221 state: "default" 0.0;
222 color: 0 0 0 255;
223 }
224 }
225
226 // A lua group embedded in an edje group.
227 part {
228 name: "bubbles_lua";
229 type: GROUP;
230 source: "bubbles/lua";
231 mouse_events: 0;
232 description { state: "default" 0.0; visible: 1; }
233 }
234
235 part {
236 name: "some_text";
237 type: TEXT;
238 mouse_events: 0;
239 description {
240 state: "default" 0;
241 visible: 1;
242 text
243 {
244 text: "This is test text.";
245 text_class: "test_text_class";
246 }
247 }
248 }
249
250 program { name: "show_signals";
251 signal: "*";
252 source: "*";
253 script
254 {
255 new buf[128];
256
257 snprintf(buf, 128, "edje::signal sig=%s sig=%s", sig, src);
258 set_text(PART:"some_text", buf);
259 }
260 }
261
262 script {
263 public global_str0;
264 public global_str1;
265 public global_str2;
266 public str_idx;
267
268 public set_text_string() {
269 new tmp[1024];
270 new idx;
271 idx = get_int(str_idx);
272
273 if (idx == 0)
274 get_str(global_str0, tmp, 1024);
275 else if (idx == 1)
276 get_str(global_str1, tmp, 1024);
277 else if (idx == 2)
278 get_str(global_str2, tmp, 1024);
279 else return;
280
281 set_text(PART:"some_text", tmp);
282 send_message(MSG_STRING, 1, tmp);
283 }
284
285 public message(Msg_Type:type, id, ...) {
286 if (type == MSG_STRING) {
287 new text[64];
288 new buf[128];
289
290 getsarg(3, text, 64);
291 snprintf(buf, 128, "embryo::message |%s|", text);
292 set_text(PART:"some_text", buf);
293 }
294 }
295
296
297 }
298
299 }
300 }
301
302}
303
diff --git a/libraries/edje/src/examples/swallow.edc b/libraries/edje/src/examples/swallow.edc
new file mode 100644
index 0000000..a62a0b5
--- /dev/null
+++ b/libraries/edje/src/examples/swallow.edc
@@ -0,0 +1,21 @@
1collections {
2 group {
3 name: "example_group";
4 max: 500 500;
5 min: 50 50;
6
7 parts {
8 part {
9 name: "part_one";
10 type: SWALLOW;
11 description {
12 min: 50 50;
13 state: "default" 0.0;
14 rel1.relative: 0.0 0.0;
15 rel2.relative: 1.0 1.0;
16 }
17 }
18 }
19
20 }
21}
diff --git a/libraries/edje/src/examples/table.edc b/libraries/edje/src/examples/table.edc
new file mode 100644
index 0000000..5453705
--- /dev/null
+++ b/libraries/edje/src/examples/table.edc
@@ -0,0 +1,19 @@
1collections {
2 group {
3 name: "example_table";
4 min: 50 50;
5
6 parts {
7 part {
8 name: "table_part";
9 type: TABLE;
10 description {
11 min: 50 50;
12 state: "default" 0.0;
13 rel1.relative: 0.0 0.0;
14 rel2.relative: 1.0 1.0;
15 }
16 }
17 }
18 }
19}
diff --git a/libraries/edje/src/examples/test.png b/libraries/edje/src/examples/test.png
new file mode 100644
index 0000000..fb620d7
--- /dev/null
+++ b/libraries/edje/src/examples/test.png
Binary files differ
diff --git a/libraries/edje/src/examples/text.edc b/libraries/edje/src/examples/text.edc
new file mode 100644
index 0000000..257a078
--- /dev/null
+++ b/libraries/edje/src/examples/text.edc
@@ -0,0 +1,68 @@
1collections {
2 group {
3 name: "sel_group";
4 parts {
5 part {
6 name: "rect";
7 type: RECT;
8 description {
9 state: "default" 0.0;
10 color: 0 255 0 255; /* green */
11 rel1.relative: 0.0 0.0;
12 rel2.relative: 1.0 1.0;
13 }
14 }
15 }
16 }
17 group {
18 name: "example_group";
19 max: 500 500;
20 min: 50 50;
21
22 styles {
23 style {
24 name: "textblock_style";
25 base: "font=Sans font_size=22 color=#600 wrap=word";
26 tag: "br" "\n";
27 tag: "hilight" "+ font_weight=Bold";
28 tag: "b" "+ font_weight=Bold";
29 tag: "tab" "\t";
30 }
31 }
32 parts {
33 part {
34 name: "part_one";
35 type: TEXT;
36 description {
37 min: 50 50;
38 state: "default" 0.0;
39 color: 0 0 255 255; /* blue */
40 rel1.relative: 0.0 0.0;
41 rel2.relative: 1.0 0.5;
42 text {
43 font: "arial";
44 size: 22;
45 min: 1 1;
46 }
47 }
48 }
49 part {
50 name: "part_two";
51 type: TEXTBLOCK;
52 select_mode: EXPLICIT;
53 source: "sel_group";
54 entry_mode: PLAIN;
55 description {
56 min: 50 50;
57 state: "default" 0.0;
58 rel1.relative: 0.0 0.5;
59 rel2.relative: 1.0 1.0;
60 text {
61 style: "textblock_style";
62 min: 1 1;
63 }
64 }
65 }
66 }
67 }
68}
diff --git a/libraries/edje/src/lib/Edje.h b/libraries/edje/src/lib/Edje.h
new file mode 100644
index 0000000..c8094b4
--- /dev/null
+++ b/libraries/edje/src/lib/Edje.h
@@ -0,0 +1,3926 @@
1/**
2@brief Edje Graphical Design Library
3
4These routines are used for Edje.
5
6@mainpage Edje Library Documentation
7@version 1.1
8@date 2003-2011
9
10Please see the @ref authors page for contact details.
11
12
13
14
15
16
17
18@section intro What is Edje?
19
20Edje is a complex graphical design & layout library.
21
22It doesn't pretend to do containing and regular layout like a widget
23set, but it is the base for such components. Based on the requirements
24of Enlightenment 0.17, Edje should serve all the purposes of creating
25visual elements (borders of windows, buttons, scrollbars, etc.) and
26allow the designer the ability to animate, layout and control the look
27and feel of any program using Edje as its basic GUI constructor. This
28library allows for multiple collections of Layouts in one file,
29sharing the same image and font database and thus allowing a whole
30theme to be conveniently packaged into 1 file and shipped around.
31
32Edje separates the layout and behavior logic. Edje files ship with an
33image and font database, used by all the parts in all the collections
34to source graphical data. It has a directory of logical part names
35pointing to the part collection entry ID in the file (thus allowing
36for multiple logical names to point to the same part collection,
37allowing for the sharing of data between display elements). Each part
38collection consists of a list of visual parts, as well as a list of
39programs. A program is a conditionally run program that if a
40particular event occurs (a button is pressed, a mouse enters or leaves
41a part) will trigger an action that may affect other parts. In this
42way a part collection can be "programmed" via its file as to hilight
43buttons when the mouse passes over them or show hidden parts when a
44button is clicked somewhere etc. The actions performed in changing
45from one state to another are also allowed to transition over a period
46of time, allowing animation. Programs and animations can be run in
47"parallel".
48
49This separation and simplistic event driven style of programming can produce
50almost any look and feel one could want for basic visual elements. Anything
51more complex is likely the domain of an application or widget set that may
52use Edje as a convenient way of being able to configure parts of the display.
53
54For details of Edje's history, see the \ref history section.
55
56
57@section requirements What does Edje require?
58
59Edje requires fairly little on your system. to use the Edje runtime library
60you need:
61
62 - Evas (library)
63 - Ecore (library)
64 - Eet (library)
65 - Embryo (library)
66 - Eina (library)
67 - Lua 5.1 (library)
68
69Evas needs to be build with the JPEG, PNG and EET image loaders enabled at a
70minimum. You will also need the buffer engine (which requires the
71software_generic engine) as well.
72
73Ecore needs the ECORE, ECORE_EVAS and ECORE_X modules built at a minimum.
74It's suggested to build all the Ecore modules. You will beed the Buffer
75engine support built into Ecore_Evas for edje?_cc to function.
76
77
78@section compiling How to compile and test Edje
79
80Now you need to compile and install Edje.
81
82@verbatim
83 ./configure
84 make
85 sudo make install
86@endverbatim
87
88You now have it installed and ready to go, but you need input
89data. There are lots of examples in SVN, the best one is
90Enlightenment's own theme file.
91
92You may use different tools to edit and view the generated ".edj"
93files, for instance:
94
95 - edje_player (provided by Edje)
96 - editje (http://trac.enlightenment.org/e/wiki/Editje)
97 - edje_viewer (http://trac.enlightenment.org/e/wiki/Edje_Viewer)
98
99
100@section details So how does this all work?
101
102Edje internally holds a geometry state machine and state graph of what is
103visible, not, where, at what size, with what colors etc. This is described
104to Edje from an Edje .edj file containing this information. These files can
105be produced by using edje_cc to take a text file (a .edc file) and "compile"
106an output .edj file that contains this information, images and any other
107data needed.
108
109The application using Edje will then create an object in its Evas
110canvas and set the bundle file to use, specifying the @b group name to
111use. Edje will load such information and create all the required
112children objects with the specified properties as defined in each @b
113part of the given group. See the following annotated example:
114
115@code
116
117#include <Eina.h>
118#include <Evas.h>
119#include <Ecore.h>
120#include <Ecore_Evas.h>
121#include <Edje.h>
122
123#define WIDTH 320
124#define HEIGHT 240
125
126static Evas_Object *create_my_group(Evas *canvas, const char *text)
127{
128 Evas_Object *edje;
129
130 edje = edje_object_add(canvas);
131 if (!edje)
132 {
133 EINA_LOG_CRIT("could not create edje object!");
134 return NULL;
135 }
136
137 if (!edje_object_file_set(edje, "edje_example.edj", "my_group"))
138 {
139 int err = edje_object_load_error_get(edje);
140 const char *errmsg = edje_load_error_str(err);
141 EINA_LOG_ERR("could not load 'my_group' from edje_example.edj: %s",
142 errmsg);
143
144 evas_object_del(edje);
145 return NULL;
146 }
147
148 if (text)
149 {
150 if (!edje_object_part_text_set(edje, "text", text))
151 {
152 EINA_LOG_WARN("could not set the text. "
153 "Maybe part 'text' does not exist?");
154 }
155 }
156
157 evas_object_move(edje, 0, 0);
158 evas_object_resize(edje, WIDTH, HEIGHT);
159 evas_object_show(edje);
160 return edje;
161}
162
163int main(int argc, char *argv[])
164{
165 Ecore_Evas *window;
166 Evas *canvas;
167 Evas_Object *edje;
168 const char *text;
169
170 eina_init();
171 evas_init();
172 ecore_init();
173 ecore_evas_init();
174 edje_init();
175
176 window = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
177 if (!window)
178 {
179 EINA_LOG_CRIT("could not create window.");
180 return -1;
181 }
182 canvas = ecore_evas_get(window);
183
184 text = (argc > 1) ? argv[1] : NULL;
185
186 edje = create_my_group(canvas, text);
187 if (!edje)
188 return -2;
189
190 ecore_evas_show(window);
191 ecore_main_loop_begin();
192
193 evas_object_del(edje);
194 ecore_evas_free(window);
195
196 return 0;
197}
198@endcode
199
200It requires the following source Edje file:
201@code
202// compile: edje_cc edje_example.edc
203collections {
204 group {
205 name: "my_group"; // must be the same as in edje_example.c
206
207 parts {
208 part {
209 name: "background";
210 type: RECT; // plain boring rectangle
211 mouse_events: 0; // we don't need any mouse event on the background
212
213 // just one state "default"
214 description {
215 state: "default" 0.0; // must always exist
216 color: 255 255 255 255; // white
217
218 // define part coordinates:
219
220 rel1 { // top-left point at (0, 0) [WIDTH * 0 + 0, HEIGHT * 0 + 0]
221 relative: 0.0 0.0;
222 offset: 0 0;
223 }
224 rel2 { // bottom-right point at (WIDTH * 1.0 - 1, HEIGHT * 1.0 - 1)
225 relative: 1.0 1.0;
226 offset: -1 -1;
227 }
228 }
229 }
230
231 part {
232 name: "text";
233 type: TEXT;
234 mouse_events: 1; // we want to change the color on mouse-over
235
236 // 2 states, one "default" and another "over" to be used
237 // on mouse over effect
238
239 description {
240 state: "default" 0.0;
241 color: 255 0 0 255; // red
242
243 // define part coordinates:
244
245 rel1 { // top-left at (WIDTH * 0.1 + 5, HEIGHT * 0.2 + 10)
246 relative: 0.1 0.2;
247 offset: 5 10;
248 }
249 rel2 { // bottom-right at (WIDTH * 0.9 - 6, HEIGHT * 0.8 - 11)
250 relative: 0.9 0.8;
251 offset: -6 -11;
252 }
253
254 // define text specific state details
255 text {
256 font: "Sans"; // using fontconfig name!
257 size: 10;
258 text: "hello world";
259 }
260 }
261
262 description {
263 state: "over" 0.0;
264 inherit: "default" 0.0; // copy everything from "default" at this point
265
266 color: 0 255 0 255; // override color, now it is green
267 }
268 }
269
270 // do programs to change color on text mouse in/out (over)
271 programs {
272 program {
273 // what triggers this program:
274 signal: "mouse,in";
275 source: "text";
276
277 // what this program does:
278 action: STATE_SET "over" 0.0;
279 target: "text";
280
281 // do the state-set in a nice interpolation animation
282 // using linear time in 0.1 second
283 transition: LINEAR 0.1;
284 }
285
286 program {
287 // what triggers this program:
288 signal: "mouse,out";
289 source: "text";
290
291 // what this program does:
292 action: STATE_SET "default" 0.0;
293 target: "text";
294
295 // do the state-set in a nice interpolation animation
296 // using linear time in 0.1 second
297 transition: LINEAR 0.1;
298 }
299 }
300 }
301 }
302}
303@endcode
304
305
306One should save these files as edje_example.c and edje_example.edc then:
307@verbatim
308gcc -o edje_example edje_example.c `pkg-config --cflags --libs eina evas ecore ecore-evas edje`
309edje_cc edje_example.edc
310
311./edje_example "some text"
312@endverbatim
313
314Although simple, this example illustrates that animations and state
315changes can be done from the Edje file itself without any requirement
316in the C application.
317
318Before digging into changing or creating your own Edje source (edc)
319files, read the @ref edcref.
320
321
322
323@section history Edje History
324
325It's a sequel to "Ebits" which has serviced the needs of Enlightenment
326development for early version 0.17. The original design parameters under
327which Ebits came about were a lot more restricted than the resulting
328use of them, thus Edje was born.
329
330Edje is a more complex layout engine compared to Ebits. It doesn't
331pretend to do containing and regular layout like a widget set. It
332still inherits the more simplistic layout ideas behind Ebits, but it
333now does them a lot more cleanly, allowing for easy expansion, and the
334ability to cover much more ground than Ebits ever could. For the
335purposes of Enlightenment 0.17, Edje was conceived to serve all the
336purposes of creating visual elements (borders of windows, buttons,
337scrollbars, etc.) and allow the designer the ability to animate,
338layout and control the look and feel of any program using Edje as its
339basic GUI constructor.
340
341Unlike Ebits, Edje separates the layout and behavior logic.
342
343
344
345@section Edje_Examples Examples on Edje's usage
346
347What follows is a list with various commented examples, covering a great
348part of Edje's API:
349
350- @ref Example_Edje_Basics
351- @ref tutorial_edje_swallow
352- @ref tutorial_edje_table
353- @ref tutorial_edje_box
354- @ref tutorial_edje_box2
355- @ref tutorial_edje_color_class
356- @ref tutorial_edje_animations
357- @ref Example_Edje_Signals_Messages
358
359
360*/
361
362/**
363@page authors Authors
364@author Carsten Haitzler <raster@@rasterman.com>
365@author Tilman Sauerbeck (tilman at code-monkey de)
366@author ZigsMcKenzie <zigsmckenzie@@gmail.com>
367@author Cedric BAIL <cedric.bail@@free.fr>
368@author Brian Mattern <rephorm@@rephorm.com>
369@author Mathieu Taillefumier <mathieu.taillefumier@@free.fr>
370@author Tristan <blunderer@@gmail.com>
371@author Gustavo Lima Chaves <glima@@profusion.mobi>
372@author Bruno Dilly <bdilly@@profusion.mobi>
373@author Fabiano Fidêncio <fidencio@@profusion.mobi>
374@author Jihoon Kim <jihoon48.kim@@samsung.com>
375@author Tiago Falcão <tiago@@profusion.mobi>
376@author Davide Andreoli <dave@@gurumeditation.it>
377@author Sebastian Dransfeld <sd@@tango.flipp.net>
378@author Tom Hacohen <tom@@stosb.com>
379@author Aharon Hillel <a.hillel@@partner.samsung.com>
380
381Please contact <enlightenment-devel@lists.sourceforge.net> to get in
382contact with the developers and maintainers.
383*/
384
385
386/**
387
388@example embryo_custom_state.edc
389This example show how to create a custom state from embryo. Clicking on the
3903 labels will rotate the object in the given direction.
391
392@example embryo_pong.edc
393Super-simple Pong implementation in pure embryo.
394
395@example embryo_run_program.edc
396This example show how to run an edje program from embryo code.
397
398@example embryo_set_state.edc
399This example show how to change the state of a part from embryo code.
400
401@example embryo_set_text.edc
402This example show how to set the text in TEXT part from embryo code.
403
404@example embryo_timer.edc
405This example show the usage of timers in embryo.
406
407@example external_elm_anchorblock.edc
408This example use an elementary anchorblock and a button to animate the text.
409
410@example external_elm_button.edc
411This example create some elementary buttons and do some actions on user click.
412
413@example external_elm_check.edc
414This example show EXTERNAL checkbox in action.
415
416@example external_elm_panes.edc
417This example show EXTERNAL elementary panes in action.
418
419@example external_emotion_elm.edc
420Super-concise video player example using Edje/Emotion/Elementary.
421
422@example lua_script.edc
423This example show the usage of lua scripting to create and animate some
424objects in the canvas.
425
426@example toggle_using_filter.edc
427This example show how to toggle the state of a part using the 'filter'
428param in edje programs
429
430*/
431
432#ifndef _EDJE_H
433#define _EDJE_H
434
435#ifndef _MSC_VER
436# include <stdint.h>
437#endif
438#include <math.h>
439#include <float.h>
440#include <limits.h>
441
442#include <Evas.h>
443
444#ifdef EAPI
445# undef EAPI
446#endif
447
448#ifdef _WIN32
449# ifdef EFL_EDJE_BUILD
450# ifdef DLL_EXPORT
451# define EAPI __declspec(dllexport)
452# else
453# define EAPI
454# endif /* ! DLL_EXPORT */
455# else
456# define EAPI __declspec(dllimport)
457# endif /* ! EFL_EDJE_BUILD */
458#else
459# ifdef __GNUC__
460# if __GNUC__ >= 4
461# define EAPI __attribute__ ((visibility("default")))
462# else
463# define EAPI
464# endif
465# else
466# define EAPI
467# endif
468#endif
469
470#ifdef __cplusplus
471extern "C" {
472#endif
473
474#define EDJE_VERSION_MAJOR 1
475#define EDJE_VERSION_MINOR 0
476
477 typedef struct _Edje_Version
478 {
479 int major;
480 int minor;
481 int micro;
482 int revision;
483 } Edje_Version;
484
485 EAPI extern Edje_Version *edje_version;
486
487/**
488 * @file Edje.h
489 * @brief Edje Graphical Design Library
490 *
491 * These routines are used for Edje.
492 */
493
494/**
495 * Identifiers of Edje message types, which can be sent back and forth
496 * code and a given Edje object's theme file/group.
497 *
498 * @see edje_object_message_send()
499 * @see edje_object_message_handler_set()
500 */
501typedef enum _Edje_Message_Type
502{
503 EDJE_MESSAGE_NONE = 0,
504
505 EDJE_MESSAGE_SIGNAL = 1, /* DONT USE THIS */
506
507 EDJE_MESSAGE_STRING = 2, /**< A message with a string as value. Use #Edje_Message_String structs as message body, for this type. */
508 EDJE_MESSAGE_INT = 3, /**< A message with an integer number as value. Use #Edje_Message_Int structs as message body, for this type. */
509 EDJE_MESSAGE_FLOAT = 4, /**< A message with a floating pointer number as value. Use #Edje_Message_Float structs as message body, for this type. */
510
511 EDJE_MESSAGE_STRING_SET = 5, /**< A message with a list of strings as value. Use #Edje_Message_String_Set structs as message body, for this type. */
512 EDJE_MESSAGE_INT_SET = 6, /**< A message with a list of integer numbers as value. Use #Edje_Message_Int_Set structs as message body, for this type. */
513 EDJE_MESSAGE_FLOAT_SET = 7, /**< A message with a list of floating point numbers as value. Use #Edje_Message_Float_Set structs as message body, for this type. */
514
515 EDJE_MESSAGE_STRING_INT = 8, /**< A message with a struct containing a string and an integer number as value. Use #Edje_Message_String_Int structs as message body, for this type. */
516 EDJE_MESSAGE_STRING_FLOAT = 9, /**< A message with a struct containing a string and a floating point number as value. Use #Edje_Message_String_Float structs as message body, for this type. */
517
518 EDJE_MESSAGE_STRING_INT_SET = 10, /**< A message with a struct containing a string and list of integer numbers as value. Use #Edje_Message_String_Int_Set structs as message body, for this type. */
519 EDJE_MESSAGE_STRING_FLOAT_SET = 11 /**< A message with a struct containing a string and list of floating point numbers as value. Use #Edje_Message_String_Float_Set structs as message body, for this type. */
520} Edje_Message_Type;
521
522typedef enum _Edje_Aspect_Control
523{
524 EDJE_ASPECT_CONTROL_NONE = 0,
525 EDJE_ASPECT_CONTROL_NEITHER = 1,
526 EDJE_ASPECT_CONTROL_HORIZONTAL = 2,
527 EDJE_ASPECT_CONTROL_VERTICAL = 3,
528 EDJE_ASPECT_CONTROL_BOTH = 4
529} Edje_Aspect_Control;
530
531typedef enum _Edje_Object_Table_Homogeneous_Mode
532{
533 EDJE_OBJECT_TABLE_HOMOGENEOUS_NONE = 0,
534 EDJE_OBJECT_TABLE_HOMOGENEOUS_TABLE = 1,
535 EDJE_OBJECT_TABLE_HOMOGENEOUS_ITEM = 2
536} Edje_Object_Table_Homogeneous_Mode;
537
538typedef enum _Edje_Part_Type
539{
540 EDJE_PART_TYPE_NONE = 0,
541 EDJE_PART_TYPE_RECTANGLE = 1,
542 EDJE_PART_TYPE_TEXT = 2,
543 EDJE_PART_TYPE_IMAGE = 3,
544 EDJE_PART_TYPE_SWALLOW = 4,
545 EDJE_PART_TYPE_TEXTBLOCK = 5,
546 EDJE_PART_TYPE_GRADIENT = 6,
547 EDJE_PART_TYPE_GROUP = 7,
548 EDJE_PART_TYPE_BOX = 8,
549 EDJE_PART_TYPE_TABLE = 9,
550 EDJE_PART_TYPE_EXTERNAL = 10,
551 EDJE_PART_TYPE_PROXY = 11,
552 EDJE_PART_TYPE_LAST = 12
553} Edje_Part_Type;
554
555typedef enum _Edje_Text_Effect
556{
557#define EDJE_TEXT_EFFECT_MASK_BASIC 0xf
558#define EDJE_TEXT_EFFECT_BASIC_SET(x, s) \
559 do { x = ((x) & ~EDJE_TEXT_EFFECT_MASK_BASIC) | (s); } while (0)
560 EDJE_TEXT_EFFECT_NONE = 0,
561 EDJE_TEXT_EFFECT_PLAIN = 1,
562 EDJE_TEXT_EFFECT_OUTLINE = 2,
563 EDJE_TEXT_EFFECT_SOFT_OUTLINE = 3,
564 EDJE_TEXT_EFFECT_SHADOW = 4,
565 EDJE_TEXT_EFFECT_SOFT_SHADOW = 5,
566 EDJE_TEXT_EFFECT_OUTLINE_SHADOW = 6,
567 EDJE_TEXT_EFFECT_OUTLINE_SOFT_SHADOW = 7,
568 EDJE_TEXT_EFFECT_FAR_SHADOW = 8,
569 EDJE_TEXT_EFFECT_FAR_SOFT_SHADOW = 9,
570 EDJE_TEXT_EFFECT_GLOW = 10,
571
572 EDJE_TEXT_EFFECT_LAST = 11,
573
574#define EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION (0x7 << 4)
575#define EDJE_TEXT_EFFECT_SHADOW_DIRECTION_SET(x, s) \
576 do { x = ((x) & ~EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION) | (s); } while (0)
577 EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_RIGHT = (0x0 << 4),
578 EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM = (0x1 << 4),
579 EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_LEFT = (0x2 << 4),
580 EDJE_TEXT_EFFECT_SHADOW_DIRECTION_LEFT = (0x3 << 4),
581 EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP_LEFT = (0x4 << 4),
582 EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP = (0x5 << 4),
583 EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP_RIGHT = (0x6 << 4),
584 EDJE_TEXT_EFFECT_SHADOW_DIRECTION_RIGHT = (0x7 << 4)
585} Edje_Text_Effect;
586
587typedef enum _Edje_Action_Type
588{
589 EDJE_ACTION_TYPE_NONE = 0,
590 EDJE_ACTION_TYPE_STATE_SET = 1,
591 EDJE_ACTION_TYPE_ACTION_STOP = 2,
592 EDJE_ACTION_TYPE_SIGNAL_EMIT = 3,
593 EDJE_ACTION_TYPE_DRAG_VAL_SET = 4,
594 EDJE_ACTION_TYPE_DRAG_VAL_STEP = 5,
595 EDJE_ACTION_TYPE_DRAG_VAL_PAGE = 6,
596 EDJE_ACTION_TYPE_SCRIPT = 7,
597 EDJE_ACTION_TYPE_FOCUS_SET = 8,
598 EDJE_ACTION_TYPE_RESERVED00 = 9,
599 EDJE_ACTION_TYPE_FOCUS_OBJECT = 10,
600 EDJE_ACTION_TYPE_PARAM_COPY = 11,
601 EDJE_ACTION_TYPE_PARAM_SET = 12,
602 EDJE_ACTION_TYPE_SOUND_SAMPLE = 13, /**< @since 1.1 */
603 EDJE_ACTION_TYPE_SOUND_TONE = 14, /**< @since 1.1 */
604 EDJE_ACTION_TYPE_LAST = 15
605} Edje_Action_Type;
606
607typedef enum _Edje_Tween_Mode
608{
609 EDJE_TWEEN_MODE_NONE = 0,
610 EDJE_TWEEN_MODE_LINEAR = 1,
611 EDJE_TWEEN_MODE_SINUSOIDAL = 2,
612 EDJE_TWEEN_MODE_ACCELERATE = 3,
613 EDJE_TWEEN_MODE_DECELERATE = 4,
614 EDJE_TWEEN_MODE_ACCELERATE_FACTOR = 5,
615 EDJE_TWEEN_MODE_DECELERATE_FACTOR = 6,
616 EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR = 7,
617 EDJE_TWEEN_MODE_DIVISOR_INTERP = 8,
618 EDJE_TWEEN_MODE_BOUNCE = 9,
619 EDJE_TWEEN_MODE_SPRING = 10,
620 EDJE_TWEEN_MODE_LAST = 11,
621 EDJE_TWEEN_MODE_MASK = 0xff,
622 EDJE_TWEEN_MODE_OPT_FROM_CURRENT = (1 << 31)
623} Edje_Tween_Mode;
624
625typedef enum _Edje_Cursor
626{
627 EDJE_CURSOR_MAIN,
628 EDJE_CURSOR_SELECTION_BEGIN,
629 EDJE_CURSOR_SELECTION_END,
630 EDJE_CURSOR_PREEDIT_START,
631 EDJE_CURSOR_PREEDIT_END,
632 EDJE_CURSOR_USER,
633 EDJE_CURSOR_USER_EXTRA,
634 // more later
635} Edje_Cursor;
636
637struct _Edje_Entry_Change_Info
638{
639 union {
640 struct {
641 const char *content;
642 size_t pos;
643 size_t plain_length; /* Number of cursor positions represented
644 in content. */
645 } insert;
646 struct {
647 const char *content;
648 size_t start, end;
649 } del;
650 } change;
651 Eina_Bool insert : 1; /**< True if the "change" union's "insert" is valid */
652 Eina_Bool merge : 1; /**< True if can be merged with the previous one. Used for example with insertion when something is already selected. */
653};
654
655/**
656 * @since 1.1.0
657 */
658typedef struct _Edje_Entry_Change_Info Edje_Entry_Change_Info;
659
660typedef struct _Edje_Message_String Edje_Message_String;
661typedef struct _Edje_Message_Int Edje_Message_Int;
662typedef struct _Edje_Message_Float Edje_Message_Float;
663typedef struct _Edje_Message_String_Set Edje_Message_String_Set;
664typedef struct _Edje_Message_Int_Set Edje_Message_Int_Set;
665typedef struct _Edje_Message_Float_Set Edje_Message_Float_Set;
666typedef struct _Edje_Message_String_Int Edje_Message_String_Int;
667typedef struct _Edje_Message_String_Float Edje_Message_String_Float;
668typedef struct _Edje_Message_String_Int_Set Edje_Message_String_Int_Set;
669typedef struct _Edje_Message_String_Float_Set Edje_Message_String_Float_Set;
670
671struct _Edje_Message_String
672{
673 char *str; /**< The message's string pointer */
674}; /**< Structure passed as value on #EDJE_MESSAGE_STRING messages. The string in it is automatically freed be Edje if passed to you by Edje */
675
676struct _Edje_Message_Int
677{
678 int val; /**< The message's value */
679}; /**< Structure passed as value on #EDJE_MESSAGE_INT messages */
680
681struct _Edje_Message_Float
682{
683 double val; /**< The message's value */
684}; /**< Structure passed as value on #EDJE_MESSAGE_FLOAT messages */
685
686struct _Edje_Message_String_Set
687{
688 int count; /**< The size of the message's array (may be greater than 1) */
689 char *str[1]; /**< The message's @b array of string pointers */
690}; /**< Structure passed as value on #EDJE_MESSAGE_STRING_SET messages. The array in it is automatically freed be Edje if passed to you by Edje */
691
692struct _Edje_Message_Int_Set
693{
694 int count; /**< The size of the message's array (may be greater than 1) */
695 int val[1]; /**< The message's @b array of integers */
696}; /**< Structure passed as value on #EDJE_MESSAGE_INT_SET messages. The array in it is automatically freed be Edje if passed to you by Edje */
697
698struct _Edje_Message_Float_Set
699{
700 int count; /**< The size of the message's array (may be greater than 1) */
701 double val[1]; /**< The message's @b array of floats */
702}; /**< Structure passed as value on #EDJE_MESSAGE_FLOAT_SET messages. The array in it is automatically freed be Edje if passed to you by Edje */
703
704struct _Edje_Message_String_Int
705{
706 char *str; /**< The message's string value */
707 int val; /**< The message's integer value */
708}; /**< Structure passed as value on #EDJE_MESSAGE_STRING_INT messages. The string in it is automatically freed be Edje if passed to you by Edje */
709
710struct _Edje_Message_String_Float
711{
712 char *str; /**< The message's string value */
713 double val; /**< The message's float value */
714}; /**< Structure passed as value on #EDJE_MESSAGE_STRING_FLOAT messages. The string in it is automatically freed be Edje if passed to you by Edje */
715
716struct _Edje_Message_String_Int_Set
717{
718 char *str; /**< The message's string value */
719 int count; /**< The size of the message's array (may be greater than 1) */
720 int val[1]; /**< The message's @b array of integers */
721}; /**< Structure passed as value on #EDJE_MESSAGE_STRING_INT_SET messages. The array and string in it are automatically freed be Edje if passed to you by Edje */
722
723struct _Edje_Message_String_Float_Set
724{
725 char *str; /**< The message's string value */
726 int count; /**< The size of the message's array (may be greater than 1) */
727 double val[1]; /**< The message's @b array of floats */
728}; /**< Structure passed as value on #EDJE_MESSAGE_STRING_FLOAT_SET messages. The array and string in it are automatically freed be Edje if passed to you by Edje */
729
730typedef enum _Edje_Drag_Dir
731{
732 EDJE_DRAG_DIR_NONE = 0,
733 EDJE_DRAG_DIR_X = 1,
734 EDJE_DRAG_DIR_Y = 2,
735 EDJE_DRAG_DIR_XY = 3
736} Edje_Drag_Dir;
737
738typedef enum _Edje_Load_Error
739{
740 EDJE_LOAD_ERROR_NONE = 0, /**< No error happened, the loading was successful */
741 EDJE_LOAD_ERROR_GENERIC = 1, /**< A generic error happened during the loading */
742 EDJE_LOAD_ERROR_DOES_NOT_EXIST = 2, /**< The file pointed to did not exist */
743 EDJE_LOAD_ERROR_PERMISSION_DENIED = 3, /**< Permission to read the given file was denied */
744 EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED = 4, /**< Resource allocation failed during the loading */
745 EDJE_LOAD_ERROR_CORRUPT_FILE = 5, /**< The file pointed to was corrupt */
746 EDJE_LOAD_ERROR_UNKNOWN_FORMAT = 6, /**< The file pointed to had an unknown format */
747 EDJE_LOAD_ERROR_INCOMPATIBLE_FILE = 7, /**< The file pointed to is incompatible, i.e., it doesn't match the library's current version's format */
748 EDJE_LOAD_ERROR_UNKNOWN_COLLECTION = 8, /**< The group/collection set to load from was @b not found in the file */
749 EDJE_LOAD_ERROR_RECURSIVE_REFERENCE = 9 /**< The group/collection set to load from had <b>recursive references</b> on its components */
750} Edje_Load_Error; /**< Edje file loading error codes one can get - see edje_load_error_str() too. */
751
752typedef enum _Edje_Text_Filter_Type
753{
754 EDJE_TEXT_FILTER_TEXT = 0,
755 EDJE_TEXT_FILTER_FORMAT = 1,
756 EDJE_TEXT_FILTER_MARKUP = 2
757} Edje_Text_Filter_Type;
758
759typedef enum _Edje_Text_Autocapital_Type
760{
761 EDJE_TEXT_AUTOCAPITAL_TYPE_NONE,
762 EDJE_TEXT_AUTOCAPITAL_TYPE_WORD,
763 EDJE_TEXT_AUTOCAPITAL_TYPE_SENTENCE,
764 EDJE_TEXT_AUTOCAPITAL_TYPE_ALLCHARACTER
765} Edje_Text_Autocapital_Type;
766
767/**
768 * The possible types the parameters of an EXTERNAL part can be.
769 */
770typedef enum _Edje_External_Param_Type
771{
772 EDJE_EXTERNAL_PARAM_TYPE_INT, /**< Parameter value is an integer. */
773 EDJE_EXTERNAL_PARAM_TYPE_DOUBLE, /**< Parameter value is a double. */
774 EDJE_EXTERNAL_PARAM_TYPE_STRING, /**< Paramater value is a string. */
775 EDJE_EXTERNAL_PARAM_TYPE_BOOL, /**< Parameter value is boolean. */
776 EDJE_EXTERNAL_PARAM_TYPE_CHOICE, /**< Parameter value is one of a set of
777 predefined string choices. */
778 EDJE_EXTERNAL_PARAM_TYPE_MAX /**< Sentinel. Don't use. */
779} Edje_External_Param_Type;
780
781/**
782 * Flags that determine how a parameter may be accessed in different
783 * circumstances.
784 */
785typedef enum _Edje_External_Param_Flags
786{
787 EDJE_EXTERNAL_PARAM_FLAGS_NONE = 0, /**< Propery is incapable of operations, this is used to catch bogus flags. */
788 EDJE_EXTERNAL_PARAM_FLAGS_GET = (1 << 0), /**< Property can be read/get. */
789 EDJE_EXTERNAL_PARAM_FLAGS_SET = (1 << 1), /**< Property can be written/set. This only enables edje_object_part_external_param_set() and Embryo scripts. To enable the parameter being set from state description whenever it changes state, use #EDJE_EXTERNAL_PARAM_FLAGS_STATE. */
790 EDJE_EXTERNAL_PARAM_FLAGS_STATE = (1 << 2), /**< Property can be set from state dsecription. */
791 EDJE_EXTERNAL_PARAM_FLAGS_CONSTRUCTOR = (1 << 3), /**< This property is only set once when the object is constructed using its value from "default" 0.0 state description. Setting this overrides #EDJE_EXTERNAL_PARAM_FLAGS_STATE. */
792 EDJE_EXTERNAL_PARAM_FLAGS_REGULAR = (EDJE_EXTERNAL_PARAM_FLAGS_GET |
793 EDJE_EXTERNAL_PARAM_FLAGS_SET |
794 EDJE_EXTERNAL_PARAM_FLAGS_STATE) /**< Convenience flag that sets property as GET, SET and STATE. */
795} Edje_External_Param_Flags;
796
797typedef enum
798{
799 EDJE_INPUT_PANEL_LAYOUT_NORMAL, /**< Default layout */
800 EDJE_INPUT_PANEL_LAYOUT_NUMBER, /**< Number layout */
801 EDJE_INPUT_PANEL_LAYOUT_EMAIL, /**< Email layout */
802 EDJE_INPUT_PANEL_LAYOUT_URL, /**< URL layout */
803 EDJE_INPUT_PANEL_LAYOUT_PHONENUMBER, /**< Phone Number layout */
804 EDJE_INPUT_PANEL_LAYOUT_IP, /**< IP layout */
805 EDJE_INPUT_PANEL_LAYOUT_MONTH, /**< Month layout */
806 EDJE_INPUT_PANEL_LAYOUT_NUMBERONLY, /**< Number Only layout */
807 EDJE_INPUT_PANEL_LAYOUT_INVALID
808} Edje_Input_Panel_Layout;
809
810/**
811 * @brief Converts type identifier to string nicer representation.
812 *
813 * This may be used to debug or other informational purposes.
814 *
815 * @param type the identifier to convert.
816 * @return the string with the string representation, or @c "(unknown)".
817 */
818EAPI const char *edje_external_param_type_str(Edje_External_Param_Type type) EINA_PURE;
819
820/**
821 * Struct that holds parameters for parts of type EXTERNAL.
822 */
823struct _Edje_External_Param
824{
825 const char *name; /**< The name of the parameter. */
826 Edje_External_Param_Type type; /**< The type of the parameter. This defines
827 which of the next three variables holds
828 the value for it. */
829 // XXX these could be in a union, but eet doesn't support them (or does it?)
830 int i; /**< Used by both integer and boolean */
831 double d; /**< Used by double */
832 const char *s; /**< Used by both string and choice */
833};
834/**
835 * Struct that holds parameters for parts of type EXTERNAL.
836 */
837typedef struct _Edje_External_Param Edje_External_Param;
838
839/**
840 * Helper macro to indicate an EXTERNAL's integer parameter is undefined.
841 */
842#define EDJE_EXTERNAL_INT_UNSET INT_MAX
843/**
844 * Helper macro to indicate an EXTERNAL's double parameter is undefined.
845 */
846#define EDJE_EXTERNAL_DOUBLE_UNSET DBL_MAX
847
848/**
849 * Struct holding information about an EXTERNAL part's parameters.
850 *
851 * When creating types to use with EXTERNAL parts, an array of this type is
852 * used to describe the different parameters the object uses.
853 *
854 * This struct holds the name, type and flags that define how and when the
855 * parameter is used, as well as information specific to each type, like the
856 * maximum or minimum value, that can be used by editors to restrict the
857 * range of values to set for each parameter.
858 */
859typedef struct _Edje_External_Param_Info Edje_External_Param_Info;
860/**
861 * Struct holding information about an EXTERNAL part's parameters.
862 *
863 * When creating types to use with EXTERNAL parts, an array of this type is
864 * used to describe the different parameters the object uses.
865 *
866 * This struct holds the name, type and flags that define how and when the
867 * parameter is used, as well as information specific to each type, like the
868 * maximum or minimum value, that can be used by editors to restrict the
869 * range of values to set for each parameter.
870 */
871struct _Edje_External_Param_Info
872{
873 const char *name; /**< Name of the parameter. */
874 Edje_External_Param_Type type; /**< Type of the parameter. */
875 Edje_External_Param_Flags flags; /**< Flags indicating how this parameter is
876 used. */
877 union {
878 struct {
879 int def, /**< Default value for the paramter. */
880 min, /**< Minimum value it can have. */
881 max, /**< Maximum value it can have. */
882 step; /**< Values will be a multiple of this. */
883 } i; /**< Info about integer type parametrs. Use #EDJE_EXTERNAL_INT_UNSET
884 on any of them to indicate they are not defined.*/
885 struct {
886 double def, /**< Default value for the paramter. */
887 min, /**< Minimum value it can have. */
888 max, /**< Maximum value it can have. */
889 step; /**< Values will be a multiple of this. */
890 } d; /**< Info about double type parametrs. Use
891#EDJE_EXTERNAL_DOUBLE_UNSET on any of them to indicate they are not defined.*/
892 struct {
893 const char *def; /**< Default value. */
894 const char *accept_fmt; /**< Not implemented. */
895 const char *deny_fmt; /**< Not implemented */
896 } s; /**< Info about string type parameters. NULL indicates undefined. */
897 struct {
898 int def; /**< Default value. */
899 const char *false_str; /**< String shown by editors to indicate the false state. */
900 const char *true_str; /**< String shown by editors to indicate the true state. */
901 } b; /**< Info about boolean type parameters.*/
902 struct {
903 const char *def; /**< Default value. */
904 const char **choices; /* Array of strings, each represents a
905 valid value for this parameter. The
906 last element of the array must be
907 NULL. */
908 char *(*def_get)(void *data, const Edje_External_Param_Info *info); /** return malloc() memory with the default choice, should be used if def is NULL. First parameter is Edje_External_Type::data */
909 char **(*query)(void *data, const Edje_External_Param_Info *info); /** NULL terminated array of strings, memory is dynamically allocated and should be freed with free() for array and each element. First parameter is Edje_External_Type::data */
910 } c; /**< Info about choice type parameters. */
911 } info;
912};
913
914#define EDJE_EXTERNAL_PARAM_INFO_INT_FULL_FLAGS(name, def, min, max, step, flags) \
915 {name, EDJE_EXTERNAL_PARAM_TYPE_INT, flags, {.i = {def, min, max, step}}}
916#define EDJE_EXTERNAL_PARAM_INFO_DOUBLE_FULL_FLAGS(name, def, min, max, step, flags) \
917 {name, EDJE_EXTERNAL_PARAM_TYPE_DOUBLE, flags, {.d = {def, min, max, step}}}
918#define EDJE_EXTERNAL_PARAM_INFO_STRING_FULL_FLAGS(name, def, accept, deny, flags) \
919 {name, EDJE_EXTERNAL_PARAM_TYPE_STRING, flags, {.s = {def, accept, deny}}}
920#define EDJE_EXTERNAL_PARAM_INFO_BOOL_FULL_FLAGS(name, def, false_str, true_str, flags) \
921 {name, EDJE_EXTERNAL_PARAM_TYPE_BOOL, flags, {.b = {def, false_str, true_str}}}
922#define EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL_FLAGS(name, def, choices, flags) \
923 {name, EDJE_EXTERNAL_PARAM_TYPE_CHOICE, flags, {.c = {def, choices, NULL, NULL}}}
924#define EDJE_EXTERNAL_PARAM_INFO_CHOICE_DYNAMIC_FULL_FLAGS(name, def_get, query, flags) \
925 {name, EDJE_EXTERNAL_PARAM_TYPE_CHOICE, flags, {.c = {NULL, NULL, def_get, query}}}
926
927#define EDJE_EXTERNAL_PARAM_INFO_INT_FULL(name, def, min, max, step) \
928 EDJE_EXTERNAL_PARAM_INFO_INT_FULL_FLAGS(name, def, min, max, step, EDJE_EXTERNAL_PARAM_FLAGS_REGULAR)
929#define EDJE_EXTERNAL_PARAM_INFO_DOUBLE_FULL(name, def, min, max, step) \
930 EDJE_EXTERNAL_PARAM_INFO_DOUBLE_FULL_FLAGS(name, def, min, max, step, EDJE_EXTERNAL_PARAM_FLAGS_REGULAR)
931#define EDJE_EXTERNAL_PARAM_INFO_STRING_FULL(name, def, accept, deny) \
932 EDJE_EXTERNAL_PARAM_INFO_STRING_FULL_FLAGS(name, def, accept, deny, EDJE_EXTERNAL_PARAM_FLAGS_REGULAR)
933#define EDJE_EXTERNAL_PARAM_INFO_BOOL_FULL(name, def, false_str, true_str) \
934 EDJE_EXTERNAL_PARAM_INFO_BOOL_FULL_FLAGS(name, def, false_str, true_str, EDJE_EXTERNAL_PARAM_FLAGS_REGULAR)
935#define EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL(name, def, choices) \
936 EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL_FLAGS(name, def, choices, EDJE_EXTERNAL_PARAM_FLAGS_REGULAR)
937#define EDJE_EXTERNAL_PARAM_INFO_CHOICE_DYNAMIC_FULL(name, def_get, query) \
938 EDJE_EXTERNAL_PARAM_INFO_CHOICE_DYNAMIC_FULL_FLAGS(name, def_get, query, EDJE_EXTERNAL_PARAM_FLAGS_REGULAR)
939
940#define EDJE_EXTERNAL_PARAM_INFO_INT_DEFAULT(name, def) \
941 EDJE_EXTERNAL_PARAM_INFO_INT_FULL(name, def, EDJE_EXTERNAL_INT_UNSET, EDJE_EXTERNAL_INT_UNSET, EDJE_EXTERNAL_INT_UNSET)
942#define EDJE_EXTERNAL_PARAM_INFO_DOUBLE_DEFAULT(name, def) \
943 EDJE_EXTERNAL_PARAM_INFO_DOUBLE_FULL(name, def, EDJE_EXTERNAL_DOUBLE_UNSET, EDJE_EXTERNAL_DOUBLE_UNSET, EDJE_EXTERNAL_DOUBLE_UNSET)
944#define EDJE_EXTERNAL_PARAM_INFO_STRING_DEFAULT(name, def) \
945 EDJE_EXTERNAL_PARAM_INFO_STRING_FULL(name, def, NULL, NULL)
946#define EDJE_EXTERNAL_PARAM_INFO_BOOL_DEFAULT(name, def) \
947 EDJE_EXTERNAL_PARAM_INFO_BOOL_FULL(name, def, "false", "true")
948
949#define EDJE_EXTERNAL_PARAM_INFO_INT_DEFAULT_FLAGS(name, def, flags) \
950 EDJE_EXTERNAL_PARAM_INFO_INT_FULL_FLAGS(name, def, EDJE_EXTERNAL_INT_UNSET, EDJE_EXTERNAL_INT_UNSET, EDJE_EXTERNAL_INT_UNSET, flags)
951#define EDJE_EXTERNAL_PARAM_INFO_DOUBLE_DEFAULT_FLAGS(name, def, flags) \
952 EDJE_EXTERNAL_PARAM_INFO_DOUBLE_FULL_FLAGS(name, def, EDJE_EXTERNAL_DOUBLE_UNSET, EDJE_EXTERNAL_DOUBLE_UNSET, EDJE_EXTERNAL_DOUBLE_UNSET, flags)
953#define EDJE_EXTERNAL_PARAM_INFO_STRING_DEFAULT_FLAGS(name, def, flags) \
954 EDJE_EXTERNAL_PARAM_INFO_STRING_FULL_FLAGS(name, def, NULL, NULL, flags)
955#define EDJE_EXTERNAL_PARAM_INFO_BOOL_DEFAULT_FLAGS(name, def, flags) \
956 EDJE_EXTERNAL_PARAM_INFO_BOOL_FULL_FLAGS(name, def, "false", "true", flags)
957
958#define EDJE_EXTERNAL_PARAM_INFO_INT(name) \
959 EDJE_EXTERNAL_PARAM_INFO_INT_DEFAULT(name, 0)
960#define EDJE_EXTERNAL_PARAM_INFO_DOUBLE(name) \
961 EDJE_EXTERNAL_PARAM_INFO_DOUBLE_DEFAULT(name, 0.0)
962#define EDJE_EXTERNAL_PARAM_INFO_STRING(name) \
963 EDJE_EXTERNAL_PARAM_INFO_STRING_DEFAULT(name, NULL)
964#define EDJE_EXTERNAL_PARAM_INFO_BOOL(name) \
965 EDJE_EXTERNAL_PARAM_INFO_BOOL_DEFAULT(name, 0)
966
967#define EDJE_EXTERNAL_PARAM_INFO_INT_FLAGS(name, flags) \
968 EDJE_EXTERNAL_PARAM_INFO_INT_DEFAULT_FLAGS(name, 0, flags)
969#define EDJE_EXTERNAL_PARAM_INFO_DOUBLE_FLAGS(name, flags) \
970 EDJE_EXTERNAL_PARAM_INFO_DOUBLE_DEFAULT_FLAGS(name, 0.0, flags)
971#define EDJE_EXTERNAL_PARAM_INFO_STRING_FLAGS(name, flags) \
972 EDJE_EXTERNAL_PARAM_INFO_STRING_DEFAULT_FLAGS(name, NULL, flags)
973#define EDJE_EXTERNAL_PARAM_INFO_BOOL_FLAGS(name, flags) \
974 EDJE_EXTERNAL_PARAM_INFO_BOOL_DEFAULT_FLAGS(name, 0, flags)
975
976#define EDJE_EXTERNAL_PARAM_INFO_SENTINEL {NULL, 0, 0, {.s = {NULL, NULL, NULL}}}
977
978/**
979 * @struct _Edje_External_Type
980 *
981 * @brief Information about an external type to be used.
982 *
983 * This structure provides information on how to display and modify a
984 * third party Evas_Object in Edje.
985 *
986 * Some function pointers are not really used by Edje, but provide
987 * means for Edje users to better interact with such objects. For
988 * instance, an editor may use label_get() and icon_get() to list all
989 * registered external types.
990 *
991 * @note The function pointers provided in this structure must check
992 * for errors and invalid or out-of-range values as for
993 * performance reasons Edje will not enforce hints provided as
994 * #Edje_External_Param_Info in the member parameters_info.
995 */
996struct _Edje_External_Type
997{
998#define EDJE_EXTERNAL_TYPE_ABI_VERSION (3)
999 unsigned int abi_version; /**< always use:
1000 * - #EDJE_EXTERNAL_TYPE_ABI_VERSION to declare.
1001 * - edje_external_type_abi_version_get() to check.
1002 */
1003 const char *module; /**< Name of the module that holds these definitions,
1004 as used in the externals {} block of a theme
1005 definition. */
1006 const char *module_name; /**< Canonical name of the module, for displaying
1007 in edition programs, for example. */
1008 Evas_Object *(*add) (void *data, Evas *evas, Evas_Object *parent, const Eina_List *params, const char *part_name); /**< Creates the object to be used by Edje as the part. @p part_name is the name of the part that holds the object and can be used to forward callbacks from the object as signals from Edje. @p params is the list of #Edje_External_Param, not parsed, from the default state of the part. Parameters of type #EDJE_EXTERNAL_PARAM_FLAGS_CONSTRUCTOR should be set on
1009 the object here. */
1010 void (*state_set) (void *data, Evas_Object *obj, const void *from_params, const void *to_params, float pos); /**< Called upon state changes, including the initial "default" 0.0 state. Parameters are the value returned by params_parse(). The @p pos parameter is a value between 0.0 and 1.0 indicating the position in time within the state transition. */
1011 void (*signal_emit) (void *data, Evas_Object *obj, const char *emission, const char *source); /**< Feed a signal emitted with emission originally set as part_name:signal to this object (without the "part_name:" prefix) */
1012 Eina_Bool (*param_set) (void *data, Evas_Object *obj, const Edje_External_Param *param); /**< Dynamically change a parameter of this external, called by scripts and user code. Returns @c EINA_TRUE on success */
1013 Eina_Bool (*param_get) (void *data, const Evas_Object *obj, Edje_External_Param *param); /**< Dynamically fetch a parameter of this external, called by scripts and user code. Returns @c EINA_TRUE on success. (Must check parameter name and type!) */
1014 Evas_Object *(*content_get) (void *data, const Evas_Object *obj, const char *content); /**< Dynamically fetch a sub object of this external, called by scripts and user code. Returns @c Evas_Object * on success. (Must check parameter name and type!) */
1015 void *(*params_parse) (void *data, Evas_Object *obj, const Eina_List *params); /**< Parses the list of parameters, converting into a friendly representation. Used with state_set() */
1016 void (*params_free) (void *params); /**< Free parameters parsed with params_parse() */
1017
1018 /* The following callbacks aren't used by Edje itself, but by UI design
1019 tools instead */
1020 const char *(*label_get) (void *data); /**< Get a label to use to identify this EXTERNAL. (For editors) */
1021 const char *(*description_get) (void *data); /**< Get a user friendly description of this EXTERNAL. (For editors) */
1022 Evas_Object *(*icon_add) (void *data, Evas *e); /**< Get an icon to use to identify this EXTERNAL. (For editors) */
1023 Evas_Object *(*preview_add) (void *data, Evas *e); /**< Get a preview of the EXTERNAL object in use. (For editors) */
1024 const char *(*translate) (void *data, const char *orig); /**< called to translate parameters_info name properties for use in user interfaces that support internationalization (i18n) (For editors) */
1025
1026 Edje_External_Param_Info *parameters_info; /**< An array of #Edje_External_Param_Info describing the different parameters this EXTERNAL may have. The last element in the array must be #EDJE_EXTERNAL_PARAM_INFO_SENTINEL. */
1027 void *data; /**< Private user data that will be passed to all of the class functions. */
1028};
1029typedef struct _Edje_External_Type Edje_External_Type;
1030
1031/**
1032 * Convenience struct used to mass-register types of EXTERNAL objects.
1033 *
1034 * Used with edje_external_type_array_register().
1035 */
1036struct _Edje_External_Type_Info
1037{
1038 const char *name; /**< The name of the type to register. */
1039 const Edje_External_Type *info; /**< The type definition. */
1040};
1041typedef struct _Edje_External_Type_Info Edje_External_Type_Info;
1042
1043typedef void (*Edje_Signal_Cb) (void *data, Evas_Object *obj, const char *emission, const char *source); /**< Edje signal callback functions's prototype definition. @c data will have the auxiliary data pointer set at the time the callback registration. @c obj will be a pointer the Edje object where the signal comes from. @c emission will identify the exact signal's emission string and @c source the exact signal's source one. */
1044typedef void (*Edje_Text_Change_Cb) (void *data, Evas_Object *obj, const char *part);
1045typedef void (*Edje_Message_Handler_Cb) (void *data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg); /**< Edje message handler callback functions's prototype definition. @c data will have the auxiliary data pointer set at the time the callback registration. @c obj will be a pointer the Edje object where the message comes from. @c type will identify the type of the given message and @c msg will be a pointer the message's contents, de facto, which depend on @c type. */
1046typedef void (*Edje_Text_Filter_Cb) (void *data, Evas_Object *obj, const char *part, Edje_Text_Filter_Type type, char **text);
1047typedef Evas_Object *(*Edje_Item_Provider_Cb) (void *data, Evas_Object *obj, const char *part, const char *item);
1048
1049/**
1050 * @brief Initialize the Edje library.
1051 *
1052 * @return The new init count. The initial value is zero.
1053 *
1054 * This function initializes the Ejde library, making the proper calls
1055 * to internal initialization functions. It will also initialize its
1056 * @b dependencies, making calls to @c eina_init(), @c ecore_init(),
1057 * @c embryo_init() and @c eet_init(). So, there is no need to call
1058 * those functions again, in your code. To shutdown Edje there is the
1059 * function edje_shutdown().
1060 *
1061 * @see edje_shutdown()
1062 * @see eina_init()
1063 * @see ecore_init()
1064 * @see embryo_init()
1065 * @see eet_init()
1066 *
1067 */
1068EAPI int edje_init (void);
1069
1070/**
1071 * @brief Shutdown the Edje library.
1072 *
1073 * @return The number of times the library has been initialised
1074 * without being shutdown.
1075 *
1076 * This function shuts down the Edje library. It will also call the
1077 * shutdown functions of its @b dependencies, which are @c
1078 * eina_shutdown(), @c ecore_shutdown(), @c embryo_shutdown() and @c
1079 * eet_shutdown(), so there is no need to call these functions again,
1080 * in your code.
1081 *
1082 * @see edje_init()
1083 * @see eina_shutdown()
1084 * @see ecore_shutdown()
1085 * @see embryo_shutdown()
1086 * @see eet_shutdown()
1087 *
1088 */
1089EAPI int edje_shutdown (void);
1090
1091/**
1092 * @brief Set edje trasitions' frame time.
1093 *
1094 * @param t The frame time, in seconds. Default value is 1/30.
1095 *
1096 * This function sets the edje built-in animations' frame time (thus,
1097 * affecting their resolution) by calling
1098 * ecore_animator_frametime_set(). This frame time can be retrieved
1099 * with edje_frametime_get().
1100 *
1101 * @see edje_frametime_get()
1102 *
1103 */
1104EAPI void edje_frametime_set (double t);
1105
1106/**
1107 * @brief Get edje trasitions' frame time.
1108 *
1109 * @return The frame time, in seconds.
1110 *
1111 * This function returns the edje frame time set by
1112 * edje_frametime_set() or the default value 1/30.
1113 *
1114 * @see edje_frametime_set()
1115 *
1116 */
1117EAPI double edje_frametime_get (void);
1118
1119/**
1120 * @brief Freeze Edje objects.
1121 *
1122 * This function freezes all Edje animations in the current process.
1123 *
1124 * @note: for freeze a specific object @see edje_object_freeze().
1125 *
1126 * @see edje_thaw()
1127 *
1128 */
1129EAPI void edje_freeze (void);
1130
1131/**
1132 * @brief Thaw Edje objects.
1133 *
1134 * This function thaws all Edje animations in the current process.
1135 *
1136 * @note for thaw a specific object @see edje_object_thaw().
1137 *
1138 * @see edje_freeze()
1139 *
1140 */
1141EAPI void edje_thaw (void);
1142
1143/**
1144 * @brief Set the edje append fontset.
1145 *
1146 * @param fonts The fontset to append.
1147 *
1148 * This function sets the edje append fontset.
1149 *
1150 */
1151EAPI void edje_fontset_append_set (const char *fonts);
1152
1153/**
1154 * @brief Get the edje append fontset.
1155 *
1156 * @return The edje append fontset.
1157 *
1158 * This function returns the edje append fontset set by
1159 * edje_fontset_append_set() function.
1160 *
1161 * @see edje_fontset_append_set().
1162 *
1163 */
1164EAPI const char *edje_fontset_append_get (void);
1165
1166/**
1167 * @brief Set Edje's global scaling factor.
1168 *
1169 * @param scale The global scaling factor (the default value is @c 1.0)
1170 *
1171 * Edje allows one to build scalable interfaces. Scaling factors,
1172 * which are set to neutral (@c 1.0) values by default (no scaling,
1173 * actual sizes), are of two types: @b global and @b individual.
1174 * Edje's global scaling factor will affect all its objects which
1175 * hadn't their individual scaling factors altered from the default
1176 * value (which is zero). If they had it set differently, by
1177 * edje_object_scale_set(), that factor will @b override the global
1178 * one.
1179 *
1180 * Scaling affects the values of mininum/maximum @b part sizes, which
1181 * are @b multiplied by it. Font sizes are scaled, too.
1182 *
1183 * @warning Only parts which, at EDC level, had the @c "scale"
1184 * property set to @c 1, will be affected by this function. Check the
1185 * complete @ref edcref "syntax reference" for EDC files.
1186 *
1187 * @see edje_scale_get().
1188 */
1189EAPI void edje_scale_set (double scale);
1190
1191/**
1192 * @brief Retrieve Edje's global scaling factor.
1193 *
1194 * @return The global scaling factor
1195 *
1196 * This function returns Edje's global scaling factor.
1197 *
1198 * @see edje_scale_set() for more details
1199 *
1200 */
1201EAPI double edje_scale_get (void);
1202
1203/**
1204 * @brief Show last character in password mode.
1205 *
1206 * @param password_show_last If TRUE enable last character show in password mode.
1207 *
1208 * This function enables last input to be visible when in password mode for few seconds
1209 * or until the next input is entered.
1210 *
1211 * The time out value is obtained by edje_password_show_last_timeout_set function.
1212 *
1213 * @see edje_password_show_last_timeout_set().
1214 */
1215EAPI void edje_password_show_last_set(Eina_Bool password_show_last);
1216
1217/**
1218 * @brief Set's the timeout value in last show password mode.
1219 *
1220 * @param password_show_last_timeout The timeout value.
1221 *
1222 * This functions sets the time out value for which the last input entered in password
1223 * mode will be visible.
1224 *
1225 * This value can be used only when last show mode is set in password mode.
1226 *
1227 * @see edje_password_show_last_set().
1228 *
1229 */
1230EAPI void edje_password_show_last_timeout_set(double password_show_last_timeout);
1231
1232/**
1233 * @brief Set the scaling factor for a given Edje object.
1234 *
1235 * @param obj A handle to an Edje object
1236 * @param scale The scaling factor (the default value is @c 0.0,
1237 * meaning indivinual scaling @b not set)
1238 *
1239 * This function sets an @b individual scaling factor on the @a obj
1240 * Edje object. This property (or Edje's global scaling factor, when
1241 * applicable), will affect this object's part sizes. If @p scale is
1242 * not zero, than the individual scaling will @b override any global
1243 * scaling set, for the object @p obj's parts. Put it back to zero to
1244 * get the effects of the global scaling again.
1245 *
1246 * @warning Only parts which, at EDC level, had the @c "scale"
1247 * property set to @c 1, will be affected by this function. Check the
1248 * complete @ref edcref "syntax reference" for EDC files.
1249 *
1250 * @see edje_object_scale_get()
1251 * @see edje_scale_get() for more details
1252 */
1253EAPI Eina_Bool edje_object_scale_set (Evas_Object *obj, double scale);
1254
1255/**
1256 * @brief Get a given Edje object's scaling factor.
1257 *
1258 * @param obj A handle to an Edje object
1259 *
1260 * This function returns the @c individual scaling factor set on the
1261 * @a obj Edje object.
1262 *
1263 * @see edje_object_scale_set() for more details
1264 *
1265 */
1266EAPI double edje_object_scale_get (const Evas_Object *obj);
1267
1268/**
1269 * @brief Set the RTL orientation for this object.
1270 *
1271 * @param obj A handle to an Edje object.
1272 * @rtl new value of flag EINA_TRUE/EINA_FALSE
1273 * @since 1.1.0
1274 */
1275EAPI void edje_object_mirrored_set (Evas_Object *obj, Eina_Bool rtl);
1276
1277/**
1278 * @brief Get the RTL orientation for this object.
1279 *
1280 * You can RTL orientation explicitly with edje_object_mirrored_set.
1281 *
1282 * @param obj A handle to an Edje object.
1283 * @return @c EINA_TRUE if the flag is set or @c EINA_FALSE if not.
1284 * @since 1.1.0
1285 */
1286EAPI Eina_Bool edje_object_mirrored_get (const Evas_Object *obj);
1287
1288/**
1289 * Get a list of groups in an edje file
1290 * @param file The path to the edje file
1291 *
1292 * @return The Eina_List of group names (char *)
1293 *
1294 * Note: the list must be freed using edje_file_collection_list_free()
1295 * when you are done with it.
1296 */
1297EAPI Eina_List *edje_file_collection_list (const char *file);
1298
1299/**
1300 * Free file collection list
1301 * @param lst The Eina_List of groups
1302 *
1303 * Frees the list returned by edje_file_collection_list().
1304 */
1305EAPI void edje_file_collection_list_free (Eina_List *lst);
1306
1307/**
1308 * Determine whether a group matching glob exists in an edje file.
1309 * @param file The file path
1310 * @param glob A glob to match on
1311 *
1312 * @return 1 if a match is found, 0 otherwise
1313 */
1314EAPI Eina_Bool edje_file_group_exists (const char *file, const char *glob);
1315
1316/**
1317 * Get data from the file level data block of an edje file
1318 * @param file The path to the .edj file
1319 * @param key The data key
1320 * @return The string value of the data. Must be freed by the user when no
1321 * longer needed.
1322 *
1323 * If an edje file is built from the following edc:
1324 *
1325 * data {
1326 * item: "key1" "value1";
1327 * item: "key2" "value2";
1328 * }
1329 * collections { ... }
1330 *
1331 * Then, edje_file_data_get("key1") will return "value1"
1332 */
1333EAPI char *edje_file_data_get (const char *file, const char *key);
1334
1335/**
1336 * @brief Set the file cache size.
1337 *
1338 * @param count The file cache size in edje file units. Default is 16.
1339 *
1340 * This function sets the file cache size. Edje keeps this cache in
1341 * order to prevent duplicates of edje file entries in memory. The
1342 * file cache size can be retrieved with edje_file_cache_get().
1343 *
1344 * @see edje_file_cache_get()
1345 * @see edje_file_cache_flush()
1346 *
1347 */
1348EAPI void edje_file_cache_set (int count);
1349
1350/**
1351 * @brief Return the file cache size.
1352 *
1353 * @return The file cache size in edje file units. Default is 16.
1354 *
1355 * This function returns the file cache size set by
1356 * edje_file_cache_set().
1357 *
1358 * @see edje_file_cache_set()
1359 * @see edje_file_cache_flush()
1360 *
1361 */
1362EAPI int edje_file_cache_get (void);
1363
1364/**
1365 * @brief Clean the file cache.
1366 *
1367 * This function cleans the file cache entries, but keeps this cache's
1368 * size to the last value set.
1369 *
1370 * @see edje_file_cache_set()
1371 * @see edje_file_cache_get()
1372 *
1373 */
1374EAPI void edje_file_cache_flush (void);
1375
1376/**
1377 * @brief Set the collection cache size.
1378 *
1379 * @param count The collection cache size, in edje object units. Default is 16.
1380 *
1381 * This function sets the collection cache size. Edje keeps this cache
1382 * in order to prevent duplicates of edje {collection,group,part}
1383 * entries in memory. The collection cache size can be retrieved with
1384 * edje_collection_cache_get().
1385 *
1386 * @see edje_collection_cache_get()
1387 * @see edje_collection_cache_flush()
1388 *
1389 */
1390EAPI void edje_collection_cache_set (int count);
1391
1392/**
1393 * @brief Return the collection cache size.
1394 *
1395 * @return The collection cache size, in edje object units. Default is 16.
1396 *
1397 * This function returns the collection cache size set by
1398 * edje_collection_cache_set().
1399 *
1400 * @see edje_collection_cache_set()
1401 * @see edje_collection_cache_flush()
1402 *
1403 */
1404EAPI int edje_collection_cache_get (void);
1405
1406/**
1407 * @brief Clean the collection cache.
1408 *
1409 * This function cleans the collection cache, but keeps this cache's
1410 * size to the last value set.
1411 *
1412 * @see edje_collection_cache_set()
1413 * @see edje_collection_cache_get()
1414 *
1415 */
1416EAPI void edje_collection_cache_flush (void);
1417
1418/**
1419 * @brief Set Edje color class.
1420 *
1421 * @param color_class
1422 * @param r Object Red value
1423 * @param g Object Green value
1424 * @param b Object Blue value
1425 * @param a Object Alpha value
1426 * @param r2 Outline Red value
1427 * @param g2 Outline Green value
1428 * @param b2 Outline Blue value
1429 * @param a2 Outline Alpha value
1430 * @param r3 Shadow Red value
1431 * @param g3 Shadow Green value
1432 * @param b3 Shadow Blue value
1433 * @param a3 Shadow Alpha value
1434 *
1435 * This function sets the color values for a process level color
1436 * class. This will cause all edje parts in the current process that
1437 * have the specified color class to have their colors multiplied by
1438 * these values. (Object level color classes set by
1439 * edje_object_color_class_set() will override the values set by this
1440 * function).
1441 *
1442 * The first color is the object, the second is the text outline, and
1443 * the third is the text shadow. (Note that the second two only apply
1444 * to text parts).
1445 *
1446 * Setting color emits a signal "color_class,set" with source being
1447 * the given color class in all objects.
1448 *
1449 * @see edje_color_class_set().
1450 *
1451 * @note unlike Evas, Edje colors are @b not pre-multiplied. That is,
1452 * half-transparent white is 255 255 255 128.
1453 */
1454EAPI Eina_Bool edje_color_class_set (const char *color_class, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3);
1455
1456/**
1457 * @brief Get Edje color class.
1458 *
1459 * @param color_class
1460 * @param r Object Red value
1461 * @param g Object Green value
1462 * @param b Object Blue value
1463 * @param a Object Alpha value
1464 * @param r2 Outline Red value
1465 * @param g2 Outline Green value
1466 * @param b2 Outline Blue value
1467 * @param a2 Outline Alpha value
1468 * @param r3 Shadow Red value
1469 * @param g3 Shadow Green value
1470 * @param b3 Shadow Blue value
1471 * @param a3 Shadow Alpha value
1472 *
1473 * @return EINA_TRUE if found or EINA_FALSE if not found and all
1474 * values are zeroed.
1475 *
1476 * This function gets the color values for a process level color
1477 * class. This value is the globally set and not per-object, that is,
1478 * the value that would be used by objects if they did not override with
1479 * edje_object_color_class_set().
1480 *
1481 * The first color is the object, the second is the text outline, and
1482 * the third is the text shadow. (Note that the second two only apply
1483 * to text parts).
1484 *
1485 * @see edje_color_class_set().
1486 *
1487 * @note unlike Evas, Edje colors are @b not pre-multiplied. That is,
1488 * half-transparent white is 255 255 255 128.
1489 */
1490EAPI Eina_Bool edje_color_class_get (const char *color_class, int *r, int *g, int *b, int *a, int *r2, int *g2, int *b2, int *a2, int *r3, int *g3, int *b3, int *a3);
1491
1492/**
1493 * @brief Delete edje color class.
1494 *
1495 * @param color_class
1496 *
1497 * This function deletes any values at the process level for the
1498 * specified color class.
1499 * @note Deleting the color class will revert it to the
1500 * values defined in the theme file.
1501 *
1502 * Deleting the color class will emit the signal "color_class,del"
1503 * to all the Edje objects in the running program.
1504 */
1505EAPI void edje_color_class_del (const char *color_class);
1506
1507/**
1508 * @brief Lists color classes.
1509 *
1510 * @return A list of color class names (strings). These strings and
1511 * the list must be free()'d by the caller.
1512 *
1513 * This function lists all color classes known about by the current
1514 * process.
1515 *
1516 */
1517EAPI Eina_List *edje_color_class_list (void);
1518
1519/**
1520 * @brief Set the Edje text class.
1521 *
1522 * @param text_class The text class name
1523 * @param font The font name
1524 * @param size The font size
1525 *
1526 * @return @c EINA_TRUE, on success or @c EINA_FALSE, on error
1527 *
1528 * This function updates all Edje members at the process level which
1529 * belong to this text class with the new font attributes.
1530 *
1531 * @see edje_text_class_get().
1532 *
1533 */
1534EAPI Eina_Bool edje_text_class_set (const char *text_class, const char *font, Evas_Font_Size size);
1535
1536/**
1537 * @brief Delete the text class.
1538 *
1539 * @param text_class The text class name string
1540 *
1541 * This function deletes any values at the process level for the
1542 * specified text class.
1543 *
1544 */
1545EAPI void edje_text_class_del (const char *text_class);
1546
1547/**
1548 * @brief List text classes.
1549 *
1550 * @return A list of text class names (strings). These strings are
1551 * stringshares and the list must be free()'d by the caller.
1552 *
1553 * This function lists all text classes known about by the current
1554 * process.
1555 *
1556 */
1557EAPI Eina_List *edje_text_class_list (void);
1558
1559/**
1560 * @brief Set the object minimum size.
1561 *
1562 * @param obj A valid Evas_Object handle
1563 * @param minw The minimum width
1564 * @param minh The minimum height
1565 *
1566 * This sets the minimum size restriction for the object.
1567 */
1568EAPI void edje_extern_object_min_size_set (Evas_Object *obj, Evas_Coord minw, Evas_Coord minh);
1569
1570/**
1571 * @brief Set the object maximum size.
1572 *
1573 * @param obj A valid Evas_Object handle
1574 * @param maxw The maximum width
1575 * @param maxh The maximum height
1576 *
1577 * This sets the maximum size restriction for the object.
1578 */
1579EAPI void edje_extern_object_max_size_set (Evas_Object *obj, Evas_Coord maxw, Evas_Coord maxh);
1580
1581/**
1582 * @brief Set the object aspect size.
1583 *
1584 * @param obj A valid Evas_Object handle
1585 * @param aspect The aspect control axes
1586 * @param aw The aspect radio width
1587 * @param ah The aspect ratio height
1588 *
1589 * This sets the desired aspect ratio to keep an object that will be
1590 * swallowed by Edje. The width and height define a preferred size
1591 * ASPECT and the object may be scaled to be larger or smaller, but
1592 * retaining the relative scale of both aspect width and height.
1593 */
1594EAPI void edje_extern_object_aspect_set (Evas_Object *obj, Edje_Aspect_Control aspect, Evas_Coord aw, Evas_Coord ah);
1595
1596/**
1597 * @brief Registers a custom layout to be used in edje boxes.
1598 *
1599 * @param name The name of the layout
1600 * @param func The function defining the layout
1601 * @param layout_data_get This function gets the custom data pointer
1602 * for func
1603 * @param layout_data_free Passed to func to free its private data
1604 * when needed
1605 * @param free_data Frees data
1606 * @param data Private pointer passed to layout_data_get
1607 *
1608 * This function registers custom layouts that can be referred from
1609 * themes by the registered name. The Evas_Object_Box_Layout
1610 * functions receive two pointers for internal use, one being private
1611 * data, and the other the function to free that data when it's not
1612 * longer needed. From Edje, this private data will be retrieved by
1613 * calling layout_data_get, and layout_data_free will be the free
1614 * function passed to func. layout_data_get will be called with data
1615 * as its parameter, and this one will be freed by free_data whenever
1616 * the layout is unregistered from Edje.
1617 */
1618EAPI void edje_box_layout_register (const char *name, Evas_Object_Box_Layout func, void *(*layout_data_get)(void *), void (*layout_data_free)(void *), void (*free_data)(void *), void *data);
1619
1620/**
1621 * @brief Instantiate a new Edje object
1622 *
1623 * @param evas A valid Evas handle, the canvas to place the new object
1624 * in
1625 * @return A handle to the new object created or @c NULL, on errors.
1626 *
1627 * This function creates a new Edje smart object, returning its @c
1628 * Evas_Object handle. An Edje object is useless without a (source)
1629 * file set to it, so you'd most probably call edje_object_file_set()
1630 * afterwards, like in:
1631 * @code
1632 * Evas_Object *edje;
1633 *
1634 * edje = edje_object_add(canvas);
1635 * if (!edje)
1636 * {
1637 * fprintf(stderr, "could not create edje object!\n");
1638 * return NULL;
1639 * }
1640 *
1641 * if (!edje_object_file_set(edje, "theme.edj", "group_name"))
1642 * {
1643 * int err = edje_object_load_error_get(edje);
1644 * const char *errmsg = edje_load_error_str(err);
1645 * fprintf(stderr, "could not load 'group_name' from theme.edj: %s",
1646 * errmsg);
1647 *
1648 * evas_object_del(edje);
1649 * return NULL;
1650 * }
1651 *
1652 * @endcode
1653 *
1654 * @note before creating the first Edje object in your code, remember
1655 * to initialize the library, with edje_init(), or unexpected behavior
1656 * might occur.
1657 */
1658EAPI Evas_Object *edje_object_add (Evas *evas);
1659
1660/**
1661 * @brief Retrive an <b>EDC data field's value</b> from a given Edje
1662 * object's group.
1663 *
1664 * @param obj A handle to an Edje object
1665 * @param key The data field's key string
1666 * @return The data's value string. Must not be freed.
1667 *
1668 * This function fetches an EDC data field's value, which is declared
1669 * on the objects building EDC file, <b>under its group</b>. EDC data
1670 * blocks are most commonly used to pass arbitrary parameters from an
1671 * application's theme to its code.
1672 *
1673 * They look like the following:
1674 *
1675 * @code
1676 * collections {
1677 * group {
1678 * name: "a_group";
1679 * data {
1680 * item: "key1" "value1";
1681 * item: "key2" "value2";
1682 * }
1683 * }
1684 * }
1685 * @endcode
1686 *
1687 * EDC data fields always hold @b strings as values, hence the return
1688 * type of this function. Check the complete @ref edcref "syntax reference"
1689 * for EDC files.
1690 *
1691 * @warning Do not confuse this call with edje_file_data_get(), which
1692 * queries for a @b global EDC data field on an EDC declaration file.
1693 *
1694 * @see edje_object_file_set()
1695 */
1696EAPI const char *edje_object_data_get (const Evas_Object *obj, const char *key);
1697
1698/**
1699 * @brief Sets the @b EDJ file (and group within it) to load an Edje
1700 * object's contents from
1701 *
1702 * @param obj A handle to an Edje object
1703 * @param file The path to the EDJ file to load @p from
1704 * @param group The name of the group, in @p file, which implements an
1705 * Edje object
1706 * @return @c EINA_TRUE, on success or @c EINA_FALSE, on errors (check
1707 * edje_object_load_error_get() after this call to get errors causes)
1708 *
1709 * Edje expects EDJ files, which are theming objects' descriptions and
1710 * resources packed together in an EET file, to read Edje object
1711 * definitions from. They usually are created with the @c .edj
1712 * extension. EDJ files, in turn, are assembled from @b textual object
1713 * description files, where one describes Edje objects declaratively
1714 * -- the EDC files (see @ref edcref "the syntax" for those files).
1715 *
1716 * Those description files were designed so that many Edje object
1717 * definitions -- also called @b groups (or collections) -- could be
1718 * packed together <b>in the same EDJ file</b>, so that a whole
1719 * application's theme could be packed in one file only. This is the
1720 * reason for the @p group argument.
1721 *
1722 * Use this function after you instantiate a new Edje object, so that
1723 * you can "give him life", telling where to get its contents from.
1724 *
1725 * @see edje_object_add()
1726 * @see edje_object_file_get()
1727 */
1728EAPI Eina_Bool edje_object_file_set (Evas_Object *obj, const char *file, const char *group);
1729
1730/**
1731 * @brief Get the file and group name that a given Edje object is bound to
1732 *
1733 * @param obj A handle to an Edje object
1734 * @param file A pointer to a variable whero to store the <b>file's
1735 * path</b>
1736 * @param group A pointer to a variable where to store the <b>group
1737 * name</b> in
1738 *
1739 * This gets the EDJ file's path, with the respective group set for
1740 * the given Edje object. If @a obj is either not an Edje file, or has
1741 * not had its file/group set previously, by edje_object_file_set(),
1742 * then both @p file and @p group will be set to @c NULL, indicating
1743 * an error.
1744 *
1745 * @see edje_object_file_set()
1746 *
1747 * @note Use @c NULL pointers on the file/group components you're not
1748 * interested in: they'll be ignored by the function.
1749 */
1750EAPI void edje_object_file_get (const Evas_Object *obj, const char **file, const char **group);
1751
1752/**
1753 * @brief Gets the (last) file loading error for a given Edje object
1754 *
1755 * @param obj A handlet to an Edje object
1756 *
1757 * @return The Edje loading error, one of:
1758 * - #EDJE_LOAD_ERROR_NONE
1759 * - #EDJE_LOAD_ERROR_GENERIC
1760 * - #EDJE_LOAD_ERROR_DOES_NOT_EXIST
1761 * - #EDJE_LOAD_ERROR_PERMISSION_DENIED
1762 * - #EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED
1763 * - #EDJE_LOAD_ERROR_CORRUPT_FILE
1764 * - #EDJE_LOAD_ERROR_UNKNOWN_FORMAT
1765 * - #EDJE_LOAD_ERROR_INCOMPATIBLE_FILE
1766 * - #EDJE_LOAD_ERROR_UNKNOWN_COLLECTION
1767 * - #EDJE_LOAD_ERROR_RECURSIVE_REFERENCE
1768 *
1769 * This function is meant to be used after an Edje EDJ <b>file
1770 * loading</b>, what takes place with the edje_object_file_set()
1771 * function. If that function does not return @c EINA_TRUE, one should
1772 * check for the reason of failure with this one.
1773 *
1774 * @see edje_load_error_str()
1775 */
1776EAPI Edje_Load_Error edje_object_load_error_get (const Evas_Object *obj);
1777
1778/**
1779 * Converts the given Edje file load error code into a string
1780 * describing it in English.
1781 *
1782 * @param error the error code, a value in ::Edje_Load_Error.
1783 * @return Always returns a valid string. If the given @p error is not
1784 * supported, <code>"Unknown error"</code> is returned.
1785 *
1786 * edje_object_file_set() is a function which sets an error value,
1787 * afterwards, which can be fetched with
1788 * edje_object_load_error_get(). The function in question is meant
1789 * to be used in conjunction with the latter, for pretty-printing any
1790 * possible error cause.
1791 */
1792EAPI const char *edje_load_error_str (Edje_Load_Error error);
1793
1794/**
1795 * @brief Preload the images on the Edje Object in the background.
1796 *
1797 * @param obj A handle to an Edje object
1798 * @param cancel @c EINA_FALSE will add it the preloading work queue,
1799 * @c EINA_TRUE will remove it (if it was issued before).
1800 * @return @c EINA_FASLE if obj was not a valid Edje object
1801 * otherwise @c EINA_TRUE
1802 *
1803 * This function requests the preload of all data images (on the given
1804 * object) in the background. The work is queued before being processed
1805 * (because there might be other pending requests of this type).
1806 * It emits a signal "preload,done" when finished.
1807 *
1808 * @note Use @c EINA_TRUE on scenarios where you don't need
1809 * the image data preloaded anymore.
1810 */
1811EAPI Eina_Bool edje_object_preload (Evas_Object *obj, Eina_Bool cancel);
1812
1813/**
1814 * @brief Add a callback for an arriving Edje signal, emitted by
1815 * a given Ejde object.
1816 *
1817 * @param obj A handle to an Edje object
1818 * @param emission The signal's "emission" string
1819 * @param source The signal's "source" string
1820 * @param func The callback function to be executed when the signal is
1821 * emitted.
1822 * @param data A pointer to data to pass in to @p func.
1823 *
1824 * Edje signals are one of the communication interfaces between
1825 * @b code and a given Edje object's @b theme. With signals, one can
1826 * communicate two string values at a time, which are:
1827 * - "emission" value: the name of the signal, in general
1828 * - "source" value: a name for the signal's context, in general
1829 *
1830 * Though there are those common uses for the two strings, one is free
1831 * to use them however they like.
1832 *
1833 * This function adds a callback function to a signal emitted by @a obj, to
1834 * be issued every time an EDC program like the following
1835 * @code
1836 * program {
1837 * name: "emit_example";
1838 * action: SIGNAL_EMIT "a_signal" "a_source";
1839 * }
1840 * @endcode
1841 * is run, if @p emission and @p source are given those same values,
1842 * here.
1843 *
1844 * Signal callback registration is powerful, in the way that @b blobs
1845 * may be used to match <b>multiple signals at once</b>. All the @c
1846 * "*?[\" set of @c fnmatch() operators can be used, both for @p
1847 * emission and @p source.
1848 *
1849 * Edje has @b internal signals it will emit, automatically, on
1850 * various actions taking place on group parts. For example, the mouse
1851 * cursor being moved, pressed, released, etc., over a given part's
1852 * area, all generate individual signals.
1853 *
1854 * By using something like
1855 * @code
1856 * edje_object_signal_callback_add(obj, "mouse,down,*", "button.*",
1857 * signal_cb, NULL);
1858 * @endcode
1859 * being @c "button.*" the pattern for the names of parts implementing
1860 * buttons on an interface, you'd be registering for notifications on
1861 * events of mouse buttons being pressed down on either of those parts
1862 * (those events all have the @c "mouse,down," common prefix on their
1863 * names, with a suffix giving the button number). The actual emisson
1864 * and source strings of an event will be passed in as the @a emission
1865 * and @a source parameters of the callback function (e.g. @c
1866 * "mouse,down,2" and @c "button.close"), for each of those events.
1867 *
1868 * @note See @ref edcref "the syntax" for EDC files
1869 * @see edje_object_signal_emit() on how to emits Edje signals from
1870 * code to a an object
1871 * @see edje_object_signal_callback_del_full()
1872 */
1873EAPI void edje_object_signal_callback_add (Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data);
1874
1875/**
1876 * @brief Remove a signal-triggered callback from an object.
1877 *
1878 * @param obj A valid Evas_Object handle.
1879 * @param emission The emission string.
1880 * @param source The source string.
1881 * @param func The callback function.
1882 * @return The data pointer
1883 *
1884 * This function removes a callback, previously attached to the
1885 * emittion of a signal, from the object @a obj. The parameters @a
1886 * emission, @a source and @a func must match exactly those passed to
1887 * a previous call to edje_object_signal_callback_add(). The data
1888 * pointer that was passed to this call will be returned.
1889 *
1890 * @see edje_object_signal_callback_add().
1891 * @see edje_object_signal_callback_del_full().
1892 *
1893 */
1894EAPI void *edje_object_signal_callback_del (Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func);
1895
1896/**
1897 * @brief Unregister/delete a callback set for an arriving Edje
1898 * signal, emitted by a given Ejde object.
1899 *
1900 * @param obj A handle to an Edje object
1901 * @param emission The signal's "emission" string
1902 * @param source The signal's "source" string
1903 * @param func The callback function passed on the callback's
1904 * registration
1905 * @param data The pointer given to be passed as data to @p func
1906 * @return @p data, on success or @c NULL, on errors (or if @p data
1907 * had this value)
1908 *
1909 * This function removes a callback, previously attached to the
1910 * emittion of a signal, from the object @a obj. The parameters
1911 * @a emission, @a source, @a func and @a data must match exactly those
1912 * passed to a previous call to edje_object_signal_callback_add(). The
1913 * data pointer that was passed to this call will be returned.
1914 *
1915 * @see edje_object_signal_callback_add().
1916 * @see edje_object_signal_callback_del().
1917 *
1918 */
1919EAPI void *edje_object_signal_callback_del_full(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data);
1920
1921/**
1922 * @brief Send/emit an Edje signal to a given Edje object
1923 *
1924 * @param obj A handle to an Edje object
1925 * @param emission The signal's "emission" string
1926 * @param source The signal's "source" string
1927 *
1928 * This function sends a signal to the object @a obj. An Edje program,
1929 * at @p obj's EDC specification level, can respond to a signal by
1930 * having declared matching @c 'signal' and @c 'source' fields on its
1931 * block (see @ref edcref "the syntax" for EDC files).
1932 *
1933 * As an example,
1934 * @code
1935 * edje_object_signal_emit(obj, "a_signal", "");
1936 * @endcode
1937 * would trigger a program which had an EDC declaration block like
1938 * @code
1939 * program {
1940 * name: "a_program";
1941 * signal: "a_signal";
1942 * source: "";
1943 * action: ...
1944 * }
1945 * @endcode
1946 *
1947 * @see edje_object_signal_callback_add() for more on Edje signals.
1948 */
1949EAPI void edje_object_signal_emit (Evas_Object *obj, const char *emission, const char *source);
1950
1951/**
1952 * @brief Get extra data passed to callbacks.
1953 *
1954 * @return the extra data for that callback.
1955 *
1956 * Some callbacks pass extra information. This function gives access to that
1957 * extra information. It's somehow like event_info in smart callbacks.
1958 *
1959 * @see edje_object_signal_callback_add() for more on Edje signals.
1960 * @since 1.1.0
1961 */
1962EAPI void * edje_object_signal_callback_extra_data_get(void);
1963
1964/**
1965 * @brief Set the Edje object to playing or paused states.
1966 *
1967 * @param obj A handle to an Edje object.
1968 * @param play Object state (@c EINA_TRUE to playing,
1969 * @c EINA_FALSE to paused).
1970 *
1971 * This function sets the Edje object @a obj to playing or paused
1972 * states, depending on the parameter @a play. This has no effect if
1973 * the object was already at that state.
1974 *
1975 * @see edje_object_play_get().
1976 *
1977 */
1978EAPI void edje_object_play_set (Evas_Object *obj, Eina_Bool play);
1979
1980/**
1981 * @brief Get the Edje object's state.
1982 *
1983 * @param obj A handle to an Edje object.
1984 * @return @c EINA_FALSE if the object is not connected, its @c delete_me flag
1985 * is set, or it is at paused state; @c EINA_TRUE if the object is at playing
1986 * state.
1987 *
1988 * This function tells if an Edje object is playing or not. This state
1989 * is set by edje_object_play_set().
1990 *
1991 * @see edje_object_play_set().
1992 *
1993 */
1994EAPI Eina_Bool edje_object_play_get (const Evas_Object *obj);
1995
1996/**
1997 * @brief Set the object's animation state.
1998 *
1999 * @param obj A handle to an Edje object.
2000 * @param on The animation state. @c EINA_TRUE to starts or
2001 * @c EINA_FALSE to stops.
2002 *
2003 * This function starts or stops an Edje object's animation. The
2004 * information if it's stopped can be retrieved by
2005 * edje_object_animation_get().
2006 *
2007 * @see edje_object_animation_get()
2008 *
2009 */
2010EAPI void edje_object_animation_set (Evas_Object *obj, Eina_Bool on);
2011
2012/**
2013 * @brief Get the Edje object's animation state.
2014 *
2015 * @param obj A handle to an Edje object.
2016 * @return @c EINA_FALSE on error or if object is not animated;
2017 * @c EINA_TRUE if animated.
2018 *
2019 * This function returns if the animation is stopped or not. The
2020 * animation state is set by edje_object_animation_set().
2021 *
2022 * @see edje_object_animation_set().
2023 *
2024 */
2025EAPI Eina_Bool edje_object_animation_get (const Evas_Object *obj);
2026
2027/**
2028 * @brief Freezes the Edje object.
2029 *
2030 * @param obj A handle to an Edje object.
2031 * @return The frozen state or 0 on Error
2032 *
2033 * This function puts all changes on hold. Successive freezes will
2034 * nest, requiring an equal number of thaws.
2035 *
2036 * @see edje_object_thaw()
2037 */
2038EAPI int edje_object_freeze (Evas_Object *obj);
2039
2040/**
2041 * @brief Thaws the Edje object.
2042 *
2043 * @param obj A handle to an Edje object.
2044 * @return The frozen state or 0 if the object is not frozen or on error.
2045 *
2046 * This function thaws the given Edje object.
2047 *
2048 * @note: If sucessives freezes were done, an equal number of
2049 * thaws will be required.
2050 *
2051 * @see edje_object_freeze()
2052 */
2053EAPI int edje_object_thaw (Evas_Object *obj);
2054
2055/**
2056 * @brief Sets the object color class.
2057 *
2058 * @param obj A valid Evas_Object handle
2059 * @param color_class
2060 * @param r Object Red value
2061 * @param g Object Green value
2062 * @param b Object Blue value
2063 * @param a Object Alpha value
2064 * @param r2 Outline Red value
2065 * @param g2 Outline Green value
2066 * @param b2 Outline Blue value
2067 * @param a2 Outline Alpha value
2068 * @param r3 Shadow Red value
2069 * @param g3 Shadow Green value
2070 * @param b3 Shadow Blue value
2071 * @param a3 Shadow Alpha value
2072 *
2073 * This function sets the color values for an object level color
2074 * class. This will cause all edje parts in the specified object that
2075 * have the specified color class to have their colors multiplied by
2076 * these values.
2077 *
2078 * The first color is the object, the second is the text outline, and
2079 * the third is the text shadow. (Note that the second two only apply
2080 * to text parts).
2081 *
2082 * Setting color emits a signal "color_class,set" with source being
2083 * the given color.
2084 *
2085 * @note unlike Evas, Edje colors are @b not pre-multiplied. That is,
2086 * half-transparent white is 255 255 255 128.
2087 */
2088EAPI Eina_Bool edje_object_color_class_set (Evas_Object *obj, const char *color_class, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3);
2089
2090/**
2091 * @brief Gets the object color class.
2092 *
2093 * @param o A valid Evas_Object handle
2094 * @param color_class
2095 * @param r Object Red value
2096 * @param g Object Green value
2097 * @param b Object Blue value
2098 * @param a Object Alpha value
2099 * @param r2 Outline Red value
2100 * @param g2 Outline Green value
2101 * @param b2 Outline Blue value
2102 * @param a2 Outline Alpha value
2103 * @param r3 Shadow Red value
2104 * @param g3 Shadow Green value
2105 * @param b3 Shadow Blue value
2106 * @param a3 Shadow Alpha value
2107 *
2108 * @return EINA_TRUE if found or EINA_FALSE if not found and all
2109 * values are zeroed.
2110 *
2111 * This function gets the color values for an object level color
2112 * class. If no explicit object color is set, then global values will
2113 * be used.
2114 *
2115 * The first color is the object, the second is the text outline, and
2116 * the third is the text shadow. (Note that the second two only apply
2117 * to text parts).
2118 *
2119 * @note unlike Evas, Edje colors are @b not pre-multiplied. That is,
2120 * half-transparent white is 255 255 255 128.
2121 */
2122EAPI Eina_Bool edje_object_color_class_get (const Evas_Object *o, const char *color_class, int *r, int *g, int *b, int *a, int *r2, int *g2, int *b2, int *a2, int *r3, int *g3, int *b3, int *a3);
2123
2124/**
2125 * @brief Delete the object color class.
2126 *
2127 * @param obj The edje object's reference.
2128 * @param color_class The color class to be deleted.
2129 *
2130 * This function deletes any values at the object level for the
2131 * specified object and color class.
2132 * @note Deleting the color class will revert it to the values
2133 * defined by edje_color_class_set() or the color class
2134 * defined in the theme file.
2135 *
2136 * Deleting the color class will emit the signal "color_class,del"
2137 * for the given Edje object.
2138 */
2139 EAPI void edje_object_color_class_del (Evas_Object *obj, const char *color_class);
2140
2141/**
2142 * @brief Sets Edje text class.
2143 *
2144 * @param obj A valid Evas_Object handle
2145 * @param text_class The text class name
2146 * @param font Font name
2147 * @param size Font Size
2148 *
2149 * @return @c EINA_TRUE, on success or @c EINA_FALSE, on error
2150 *
2151 * This function sets the text class for the Edje.
2152 *
2153 */
2154EAPI Eina_Bool edje_object_text_class_set (Evas_Object *obj, const char *text_class, const char *font, Evas_Font_Size size);
2155
2156/**
2157 * @brief Get the minimum size specified -- as an EDC property -- for a
2158 * given Edje object
2159 *
2160 * @param obj A handle to an Edje object
2161 * @param minw Pointer to a variable where to store the minimum width
2162 * @param minh Pointer to a variable where to store the minimum height
2163 *
2164 * This function retrieves the @p obj object's minimum size values,
2165 * <b>as declared in its EDC group definition</b>. Minimum size of
2166 * groups have the following syntax
2167 * @code
2168 * collections {
2169 * group {
2170 * name: "a_group";
2171 * min: 100 100;
2172 * }
2173 * }
2174 * @endcode
2175 *
2176 * where one declares a minimum size of 100 pixels both for width and
2177 * height. Those are (hint) values which should be respected when the
2178 * given object/group is to be controlled by a given container object
2179 * (e.g. an Edje object being "swallowed" into a given @c SWALLOW
2180 * typed part, as in edje_object_part_swallow()). Check the complete
2181 * @ref edcref "syntax reference" for EDC files.
2182 *
2183 * @note If the @c min EDC property was not declared for @p obj, this
2184 * call will return the value 0, for each axis.
2185 *
2186 * @note On failure, this function will make all non-@c NULL size
2187 * pointers' pointed variables be set to zero.
2188 *
2189 * @see edje_object_size_max_get()
2190 */
2191EAPI void edje_object_size_min_get (const Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh);
2192
2193/**
2194 * @brief Get the maximum size specified -- as an EDC property -- for a
2195 * given Edje object
2196 *
2197 * @param obj A handle to an Edje object
2198 * @param maxw Pointer to a variable where to store the maximum width
2199 * @param maxh Pointer to a variable where to store the maximum height
2200 *
2201 * This function retrieves the @p obj object's maximum size values,
2202 * <b>as declared in its EDC group definition</b>. Maximum size of
2203 * groups have the following syntax
2204 * @code
2205 * collections {
2206 * group {
2207 * name: "a_group";
2208 * max: 100 100;
2209 * }
2210 * }
2211 * @endcode
2212 *
2213 * where one declares a maximum size of 100 pixels both for width and
2214 * height. Those are (hint) values which should be respected when the
2215 * given object/group is to be controlled by a given container object
2216 * (e.g. an Edje object being "swallowed" into a given @c SWALLOW
2217 * typed part, as in edje_object_part_swallow()). Check the complete
2218 * @ref edcref "syntax reference" for EDC files.
2219 *
2220 * @note If the @c max EDC property was not declared for @p obj, this
2221 * call will return the maximum size a given Edje object may have, for
2222 * each axis.
2223 *
2224 * @note On failure, this function will make all non-@c NULL size
2225 * pointers' pointed variables be set to zero.
2226 *
2227 * @see edje_object_size_min_get()
2228 */
2229EAPI void edje_object_size_max_get (const Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh);
2230
2231/**
2232 * @brief Force a Size/Geometry calculation.
2233 *
2234 * @param obj A valid Evas_Object handle
2235 *
2236 * Forces the object @p obj to recalculation layout regardless of
2237 * freeze/thaw.
2238 */
2239EAPI void edje_object_calc_force (Evas_Object *obj);
2240
2241/**
2242 * @brief Calculate the minimum required size for a given Edje object.
2243 *
2244 * @param obj A handle to an Edje object
2245 * @param minw Pointer to a variable where to store the minimum
2246 * required width
2247 * @param minh Pointer to a variable where to store the minimum
2248 * required height
2249 *
2250 * This call works exactly as edje_object_size_min_restricted_calc(),
2251 * with the last two arguments set to 0. Please refer to its
2252 * documentation, then.
2253 */
2254EAPI void edje_object_size_min_calc (Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh);
2255
2256/**
2257 * Calculate the geometry of the region, relative to a given Edje
2258 * object's area, <b>occupied by all parts in the object</b>
2259 *
2260 * @param obj A handle to an Edje object
2261 * @param part The Edje part's name
2262 * @param x A pointer to a variable where to store the parts region's
2263 * x coordinate
2264 * @param y A pointer to a variable where to store the parts region's
2265 * y coordinate
2266 * @param w A pointer to a variable where to store the parts region's
2267 * width
2268 * @param h A pointer to a variable where to store the parts region's
2269 * height
2270 *
2271 * This function gets the geometry of the rectangle equal to the area
2272 * required to group all parts in @p obj's group/collection. The @p x
2273 * and @p y coordinates are relative to the top left corner of the
2274 * whole @p obj object's area. Parts placed out of the group's
2275 * boundaries will also be taken in account, so that @p x and @p y
2276 * <b>may be negative</b>.
2277 *
2278 * @note Use @c NULL pointers on the geometry components you're not
2279 * interested in: they'll be ignored by the function.
2280 *
2281 * @note On failure, this function will make all non-@c NULL geometry
2282 * pointers' pointed variables be set to zero.
2283 */
2284EAPI Eina_Bool edje_object_parts_extends_calc (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
2285
2286/**
2287 * @brief Calculate the minimum required size for a given Edje object.
2288 *
2289 * @param obj A handle to an Edje object
2290 * @param minw Pointer to a variable where to store the minimum
2291 * required width
2292 * @param minh Pointer to a variable where to store the minimum
2293 * required height
2294 * @param restrictedw Do not allow object's calculated (minimum) width
2295 * to be less than this value
2296 * @param restrictedh Do not allow object's calculated (minimum)
2297 * height to be less than this value
2298 *
2299 * This call will trigger an internal recalculation of all parts of
2300 * the @p obj object, in order to return its minimum required
2301 * dimensions for width and height. The user might choose to @b impose
2302 * those minimum sizes, making the resulting calculation to get to values
2303 * equal or bigger than @p restrictedw and @p restrictedh, for width and
2304 * height, respectively.
2305 *
2306 * @note At the end of this call, @p obj @b won't be automatically
2307 * resized to new dimensions, but just return the calculated
2308 * sizes. The caller is the one up to change its geometry or not.
2309 *
2310 * @warning Be advised that invisible parts in @p obj @b will be taken
2311 * into account in this calculation.
2312 */
2313EAPI void edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh, Evas_Coord restrictedw, Evas_Coord restrictedh);
2314
2315/**
2316 * @brief Check if an Edje part exists in a given Edje object's group
2317 * definition..
2318 *
2319 * @param obj A handle to an Edje object
2320 * @param part The part's name to check for existence in @p obj's
2321 * group
2322 * @return @c EINA_TRUE, if the Edje part exists in @p obj's group or
2323 * @c EINA_FALSE, otherwise (and on errors)
2324 *
2325 * This function returns if a given part exists in the Edje group
2326 * bound to object @p obj (with edje_object_file_set()).
2327 *
2328 * This call is useful, for example, when one could expect or not a
2329 * given GUI element, depending on the @b theme applied to @p obj.
2330 */
2331EAPI Eina_Bool edje_object_part_exists (const Evas_Object *obj, const char *part);
2332
2333/**
2334 * @brief Get a handle to the Evas object implementing a given Edje
2335 * part, in an Edje object.
2336 *
2337 * @param obj A handle to an Edje object
2338 * @param part The Edje part's name
2339 * @return A pointer to the Evas object implementing the given part,
2340 * or @c NULL on failure (e.g. the given part doesn't exist)
2341 *
2342 * This function gets a pointer the Evas object corresponding to a
2343 * given part in the @p obj object's group.
2344 *
2345 * You should @b never modify the state of the returned object (with
2346 * @c evas_object_move() or @c evas_object_hide() for example),
2347 * because it's meant to be managed be Edje, solely. You are safe to
2348 * query information about its current state (with @c
2349 * evas_object_visible_get() or @c evas_object_color_get() for
2350 * example), though.
2351 */
2352EAPI const Evas_Object *edje_object_part_object_get (const Evas_Object *obj, const char *part);
2353
2354/**
2355 * @brief Retrieve the geometry of a given Edje part, in a given Edje
2356 * object's group definition, <b>relative to the object's area</b>
2357 *
2358 * @param obj A handle to an Edje object
2359 * @param part The Edje part's name
2360 * @param x A pointer to a variable where to store the part's x
2361 * coordinate
2362 * @param y A pointer to a variable where to store the part's y
2363 * coordinate
2364 * @param w A pointer to a variable where to store the part's width
2365 * @param h A pointer to a variable where to store the part's height
2366 *
2367 * This function gets the geometry of an Edje part within its
2368 * group. The @p x and @p y coordinates are relative to the top left
2369 * corner of the whole @p obj object's area.
2370 *
2371 * @note Use @c NULL pointers on the geometry components you're not
2372 * interested in: they'll be ignored by the function.
2373 *
2374 * @note On failure, this function will make all non-@c NULL geometry
2375 * pointers' pointed variables be set to zero.
2376 */
2377EAPI Eina_Bool edje_object_part_geometry_get (const Evas_Object *obj, const char *part, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
2378
2379
2380/**
2381 * @brief Set the function that provides item objects for named items in an edje entry text
2382 *
2383 * @param obj A valid Evas Object handle
2384 * @param func The function to call (or NULL to disable) to get item objects
2385 * @param data The data pointer to pass to the @p func callback
2386 *
2387 * Item objects may be deleted any time by Edje, and will be deleted when the
2388 * Edje object is deleted (or file is set to a new file).
2389 */
2390EAPI void edje_object_item_provider_set (Evas_Object *obj, Edje_Item_Provider_Cb func, void *data);
2391
2392
2393/**
2394 * @brief Set the object text callback.
2395 *
2396 * @param obj A valid Evas_Object handle
2397 * @param func The callback function to handle the text change
2398 * @param data The data associated to the callback function.
2399 *
2400 * This function sets the callback to be called when the text changes.
2401 */
2402EAPI void edje_object_text_change_cb_set (Evas_Object *obj, Edje_Text_Change_Cb func, void *data);
2403
2404/**
2405 * @brief Sets the text for an object part
2406 *
2407 * @param obj A valid Evas Object handle
2408 * @param part The part name
2409 * @param text The text string
2410 */
2411EAPI Eina_Bool edje_object_part_text_set (Evas_Object *obj, const char *part, const char *text);
2412
2413/**
2414 * @brief Return the text of the object part.
2415 *
2416 * @param obj A valid Evas_Object handle
2417 * @param part The part name
2418 *
2419 * @return The text string
2420 *
2421 * This function returns the text associated to the object part.
2422 *
2423 * @see edje_object_part_text_set().
2424 */
2425EAPI const char *edje_object_part_text_get (const Evas_Object *obj, const char *part);
2426
2427/**
2428 * @brief Sets the raw (non escaped) text for an object part.
2429 *
2430 * @param obj A valid Evas Object handle
2431 * @param part The part name
2432 * @param text_to_escape The text string
2433 *
2434 * This funciton will not do escape for you if it is a TEXTBLOCK part, that is,
2435 * if text contain tags, these tags will not be interpreted/parsed by TEXTBLOCK.
2436 *
2437 * @see edje_object_part_text_unescaped_get().
2438 */
2439EAPI Eina_Bool edje_object_part_text_unescaped_set (Evas_Object *obj, const char *part, const char *text_to_escape);
2440
2441/**
2442 * @brief Returns the text of the object part, without escaping.
2443 *
2444 * @param obj A valid Evas_Object handle
2445 * @param part The part name
2446 * @return The @b allocated text string without escaping, or NULL on
2447 * problems.
2448 *
2449 * This function is the counterpart of
2450 * edje_object_part_text_unescaped_set(). Please notice that the
2451 * result is newly allocated memory and should be released with free()
2452 * when done.
2453 *
2454 * @see edje_object_part_text_unescaped_set().
2455 */
2456EAPI char *edje_object_part_text_unescaped_get (const Evas_Object *obj, const char *part);
2457
2458/**
2459 * @brief Return the selection text of the object part.
2460 *
2461 * @param obj A valid Evas_Object handle
2462 * @param part The part name
2463 * @return The text string
2464 *
2465 * This function returns selection text of the object part.
2466 *
2467 * @see edje_object_part_text_select_all()
2468 * @see edje_object_part_text_select_none()
2469 */
2470EAPI const char *edje_object_part_text_selection_get (const Evas_Object *obj, const char *part);
2471
2472/**
2473 * @brief Set the selection to be none.
2474 *
2475 * @param obj A valid Evas_Object handle
2476 * @param part The part name
2477 *
2478 * This function sets the selection text to be none.
2479 */
2480EAPI void edje_object_part_text_select_none (const Evas_Object *obj, const char *part);
2481
2482/**
2483 * @brief Set the selection to be everything.
2484 *
2485 * @param obj A valid Evas_Object handle
2486 * @param part The part name
2487 *
2488 * This function selects all text of the object of the part.
2489 */
2490EAPI void edje_object_part_text_select_all (const Evas_Object *obj, const char *part);
2491
2492/**
2493 * @brief Insert text for an object part.
2494 *
2495 * @param obj A valid Evas Object handle
2496 * @param part The part name
2497 * @param text The text string
2498 *
2499 * This function inserts the text for an object part just before the
2500 * cursor position.
2501 *
2502 */
2503EAPI void edje_object_part_text_insert (Evas_Object *obj, const char *part, const char *text);
2504
2505/**
2506 * @brief Insert text for an object part.
2507 *
2508 * @param obj A valid Evas Object handle
2509 * @param part The part name
2510 * @param text The text string
2511 *
2512 * This function inserts the text for an object part at the end; It does not
2513 * move the cursor.
2514 *
2515 * @since 1.1
2516 */
2517EAPI void edje_object_part_text_append(Evas_Object *obj, const char *part, const char *text);
2518
2519/**
2520 * @brief Return a list of char anchor names.
2521 *
2522 * @param obj A valid Evas_Object handle
2523 * @param part The part name
2524 *
2525 * @return The list of anchors (const char *), do not modify!
2526 *
2527 * This function returns a list of char anchor names.
2528 *
2529 */
2530EAPI const Eina_List *edje_object_part_text_anchor_list_get (const Evas_Object *obj, const char *part);
2531
2532/**
2533 * @brief Return a list of Evas_Textblock_Rectangle anchor rectangles.
2534 *
2535 * @param obj A valid Evas_Object handle
2536 * @param part The part name
2537 * @param anchor The anchor name
2538 *
2539 * @return The list of anchor rects (const Evas_Textblock_Rectangle
2540 * *), do not modify! Geometry is relative to entry part.
2541 *
2542 * This function return a list of Evas_Textblock_Rectangle anchor
2543 * rectangles.
2544 *
2545 */
2546EAPI const Eina_List *edje_object_part_text_anchor_geometry_get (const Evas_Object *obj, const char *part, const char *anchor);
2547
2548/**
2549 * @brief Return a list of char item names.
2550 *
2551 * @param obj A valid Evas_Object handle
2552 * @param part The part name
2553 *
2554 * @return The list of items (const char *), do not modify!
2555 *
2556 * This function returns a list of char item names.
2557 *
2558 */
2559EAPI const Eina_List *edje_object_part_text_item_list_get (const Evas_Object *obj, const char *part);
2560
2561/**
2562 * @brief Return item geometry.
2563 *
2564 * @param obj A valid Evas_Object handle
2565 * @param part The part name
2566 * @param item The item name
2567 * @param cx Item x return (relative to entry part)
2568 * @param cy Item y return (relative to entry part)
2569 * @param cw Item width return
2570 * @param ch Item height return
2571 *
2572 * @return 1 if item exists, 0 if not
2573 *
2574 * This function return a list of Evas_Textblock_Rectangle item
2575 * rectangles.
2576 *
2577 */
2578EAPI Eina_Bool edje_object_part_text_item_geometry_get (const Evas_Object *obj, const char *part, const char *item, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch);
2579
2580/**
2581 * @brief Returns the cursor geometry of the part relative to the edje
2582 * object.
2583 *
2584 * @param obj A valid Evas_Object handle
2585 * @param part The part name
2586 * @param x Cursor X position
2587 * @param y Cursor Y position
2588 * @param w Cursor width
2589 * @param h Cursor height
2590 *
2591 */
2592EAPI void edje_object_part_text_cursor_geometry_get (const Evas_Object *obj, const char *part, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
2593
2594/**
2595 * @brief Enables selection if the entry is an EXPLICIT selection mode
2596 * type.
2597 *
2598 * @param obj A valid Evas_Object handle
2599 * @param part The part name
2600 * @param allow EINA_TRUE to enable, EINA_FALSE otherwise
2601 *
2602 * The default is to @b not allow selection. This function only affects user
2603 * selection, functions such as edje_object_part_text_select_all() and
2604 * edje_object_part_text_select_none() are not affected.
2605 */
2606EAPI void edje_object_part_text_select_allow_set (const Evas_Object *obj, const char *part, Eina_Bool allow);
2607
2608/**
2609 * @brief Aborts any selection action on a part.
2610 *
2611 * @param obj A valid Evas_Object handle
2612 * @param part The part name
2613 */
2614EAPI void edje_object_part_text_select_abort (const Evas_Object *obj, const char *part);
2615
2616/**
2617 * @brief Starts selecting at current cursor position
2618 *
2619 * @param obj A valid Evas_Object handle
2620 * @param part The part name
2621 */
2622EAPI void edje_object_part_text_select_begin (const Evas_Object *obj, const char *part);
2623
2624/**
2625 * @brief Extends the current selection to the current cursor position
2626 *
2627 * @param obj A valid Evas_Object handle
2628 * @param part The part name
2629 */
2630EAPI void edje_object_part_text_select_extend (const Evas_Object *obj, const char *part);
2631
2632
2633/**
2634 * @brief Advances the cursor to the next cursor position.
2635 * @see evas_textblock_cursor_char_next
2636 *
2637 * @param obj A valid Evas_Object handle
2638 * @param part The part name
2639 * @param cur The edje cursor to advance
2640 */
2641EAPI Eina_Bool edje_object_part_text_cursor_next (Evas_Object *obj, const char *part, Edje_Cursor cur);
2642
2643/**
2644 * @brief Moves the cursor to the previous char
2645 * @see evas_textblock_cursor_char_prev
2646 *
2647 * @param obj A valid Evas_Object handle
2648 * @param part The part name
2649 * @param cur the edje cursor to work on
2650 */
2651EAPI Eina_Bool edje_object_part_text_cursor_prev (Evas_Object *obj, const char *part, Edje_Cursor cur);
2652
2653/**
2654 * @brief Move the cursor to the char above the current cursor position.
2655 *
2656 * @param obj A valid Evas_Object handle
2657 * @param part The part name
2658 * @param cur the edje cursor to work on
2659 */
2660EAPI Eina_Bool edje_object_part_text_cursor_up (Evas_Object *obj, const char *part, Edje_Cursor cur);
2661
2662/**
2663 * @brief Moves the cursor to the char below the current cursor position.
2664 *
2665 * @param obj A valid Evas_Object handle
2666 * @param part The part name
2667 * @param cur the edje cursor to work on
2668 */
2669EAPI Eina_Bool edje_object_part_text_cursor_down (Evas_Object *obj, const char *part, Edje_Cursor cur);
2670
2671/**
2672 * @brief Moves the cursor to the beginning of the text part
2673 * @see evas_textblock_cursor_paragraph_first
2674 *
2675 * @param obj A valid Evas_Object handle
2676 * @param part The part name
2677 * @param cur the edje cursor to work on
2678 */
2679EAPI void edje_object_part_text_cursor_begin_set (Evas_Object *obj, const char *part, Edje_Cursor cur);
2680
2681/**
2682 * @brief Moves the cursor to the end of the text part.
2683 * @see evas_textblock_cursor_paragraph_last
2684 *
2685 * @param obj A valid Evas_Object handle
2686 * @param part The part name
2687 * @param cur the edje cursor to work on
2688 */
2689EAPI void edje_object_part_text_cursor_end_set (Evas_Object *obj, const char *part, Edje_Cursor cur);
2690
2691/**
2692 * @brief Copy the cursor to another cursor.
2693 *
2694 * @param obj A valid Evas_Object handle
2695 * @param part The part name
2696 * @param sry the cursor to copy from
2697 * @param dst the cursor to copy to
2698 */
2699EAPI void edje_object_part_text_cursor_copy (Evas_Object *obj, const char *part, Edje_Cursor src, Edje_Cursor dst);
2700
2701/**
2702 * @brief Move the cursor to the beginning of the line.
2703 * @see evas_textblock_cursor_line_char_first
2704 *
2705 * @param obj A valid Evas_Object handle
2706 * @param part The part name
2707 * @param cur the edje cursor to work on
2708 */
2709EAPI void edje_object_part_text_cursor_line_begin_set (Evas_Object *obj, const char *part, Edje_Cursor cur);
2710
2711/**
2712 * @brief Move the cursor to the end of the line.
2713 * @see evas_textblock_cursor_line_char_last
2714 *
2715 * @param obj A valid Evas_Object handle
2716 * @param part The part name
2717 * @param cur the edje cursor to work on
2718 */
2719EAPI void edje_object_part_text_cursor_line_end_set (Evas_Object *obj, const char *part, Edje_Cursor cur);
2720
2721/**
2722 * Position the given cursor to a X,Y position.
2723 *
2724 * This is frequently used with the user cursor.
2725 *
2726 * @param obj An Edje object.
2727 * @param part The part containing the object.
2728 * @param cur The cursor to adjust.
2729 * @param x X Coordinate.
2730 * @param y Y Coordinate.
2731 * @return True on success, false on error.
2732 */
2733EAPI Eina_Bool edje_object_part_text_cursor_coord_set (Evas_Object *obj, const char *part, Edje_Cursor cur, Evas_Coord x, Evas_Coord y);
2734
2735/**
2736 * @brief Returns whether the cursor points to a format.
2737 * @see evas_textblock_cursor_is_format
2738 *
2739 * @param obj A valid Evas_Object handle
2740 * @param part The part name
2741 * @param cur The cursor to adjust.
2742 * @return EINA_TRUE if it's true, EINA_FALSE otherwise.
2743 */
2744EAPI Eina_Bool edje_object_part_text_cursor_is_format_get (const Evas_Object *obj, const char *part, Edje_Cursor cur);
2745
2746/**
2747 * @brief Return true if the cursor points to a visible format
2748 * For example \t, \n, item and etc.
2749 * @see evas_textblock_cursor_format_is_visible_get
2750 *
2751 * @param obj A valid Evas_Object handle
2752 * @param part The part name
2753 * @param cur The cursor to adjust.
2754 */
2755EAPI Eina_Bool edje_object_part_text_cursor_is_visible_format_get(const Evas_Object *obj, const char *part, Edje_Cursor cur);
2756
2757/**
2758 * @brief Returns the content (char) at the cursor position.
2759 * @see evas_textblock_cursor_content_get
2760 *
2761 * @param obj A valid Evas_Object handle
2762 * @param part The part name
2763 * @param cur The cursor to use
2764 */
2765EAPI const char *edje_object_part_text_cursor_content_get (const Evas_Object *obj, const char *part, Edje_Cursor cur);
2766
2767/**
2768 * @brief Sets the cursor position to the given value
2769 *
2770 * @param obj A valid Evas_Object handle
2771 * @param part The part name
2772 * @param cur The cursor to move
2773 * @param pos the position of the cursor
2774 * @since 1.1.0
2775 */
2776EAPI void edje_object_part_text_cursor_pos_set (Evas_Object *obj, const char *part, Edje_Cursor cur, int pos);
2777
2778/**
2779 * @brief Retrieves the current position of the cursor
2780 *
2781 * @param obj A valid Evas_Object handle
2782 * @param part The part name
2783 * @param cur The cursor to get the position
2784 * @return The cursor position
2785 * @since 1.1.0
2786 */
2787EAPI int edje_object_part_text_cursor_pos_get (const Evas_Object *obj, const char *part, Edje_Cursor cur);
2788
2789/**
2790 * @brief Set the layout of the input panel.
2791 *
2792 * The layout of the input panel or virtual keyboard can make it easier or
2793 * harder to enter content. This allows you to hint what kind of input you
2794 * are expecting to enter and thus have the input panel automatically
2795 * come up with the right mode.
2796 *
2797 * @param obj A valid Evas_Object handle
2798 * @param part The part name
2799 * @param layout layout type
2800 * @since 1.1
2801 */
2802EAPI void edje_object_part_text_input_panel_layout_set (const Evas_Object *obj, const char *part, Edje_Input_Panel_Layout layout);
2803
2804/**
2805 * @brief Get the layout of the input panel.
2806 *
2807 * @param obj A valid Evas_Object handle
2808 * @param part The part name
2809 *
2810 * @return Layout type of the input panel
2811 *
2812 * @see edje_object_part_text_input_panel_layout_set
2813 * @since 1.1
2814 */
2815EAPI Edje_Input_Panel_Layout edje_object_part_text_input_panel_layout_get (const Evas_Object *obj, const char *part);
2816
2817/**
2818 * @brief Set the autocapitalization type on the immodule.
2819 *
2820 * @param obj A valid Evas_Object handle
2821 * @param part The part name
2822 * @param autocapital_type The type of autocapitalization
2823 * @since 1.1.0
2824 */
2825EAPI void edje_object_part_text_autocapital_type_set (const Evas_Object *obj, const char *part, Edje_Text_Autocapital_Type autocapital_type);
2826
2827/**
2828 * @brief Retrieves the autocapitalization type
2829 *
2830 * @param obj A valid Evas_Object handle
2831 * @param part The part name
2832 * @return The autocapitalization type
2833 * @since 1.1.0
2834 */
2835EAPI Edje_Text_Autocapital_Type edje_object_part_text_autocapital_type_get (const Evas_Object *obj, const char *part);
2836
2837/**
2838 * @brief Sets the attribute to show the input panel automatically.
2839 *
2840 * @param obj A valid Evas_Object handle
2841 * @param part The part name
2842 * @param enabled If true, the input panel is appeared when entry is clicked or has a focus
2843 * @since 1.1.0
2844 */
2845EAPI void edje_object_part_text_input_panel_enabled_set (const Evas_Object *obj, const char *part, Eina_Bool enabled);
2846
2847/**
2848 * @brief Retrieve the attribute to show the input panel automatically.
2849 * @see edje_object_part_text_input_panel_enabled_set
2850 *
2851 * @param obj A valid Evas_Object handle
2852 * @param part The part name
2853 * @return EINA_TRUE if it supports or EINA_FALSE otherwise
2854 * @since 1.1.0
2855 */
2856EAPI Eina_Bool edje_object_part_text_input_panel_enabled_get (const Evas_Object *obj, const char *part);
2857
2858/**
2859 * Add a filter function for newly inserted text.
2860 *
2861 * Whenever text is inserted (not the same as set) into the given @p part,
2862 * the list of filter functions will be called to decide if and how the new
2863 * text will be accepted.
2864 * There are three types of filters, EDJE_TEXT_FILTER_TEXT,
2865 * EDJE_TEXT_FILTER_FORMAT and EDJE_TEXT_FILTER_MARKUP.
2866 * The text parameter in the @p func filter can be modified by the user and
2867 * it's up to him to free the one passed if he's to change the pointer. If
2868 * doing so, the newly set text should be malloc'ed, as once all the filters
2869 * are called Edje will free it.
2870 * If the text is to be rejected, freeing it and setting the pointer to NULL
2871 * will make Edje break out of the filter cycle and reject the inserted
2872 * text.
2873 *
2874 * @see edje_object_text_insert_filter_callback_del
2875 * @see edje_object_text_insert_filter_callback_del_full
2876 *
2877 * @param obj A valid Evas_Object handle
2878 * @param part The part name
2879 * @param func The callback function that will act as filter
2880 * @param data User provided data to pass to the filter function
2881 */
2882EAPI void edje_object_text_insert_filter_callback_add (Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func, void *data);
2883
2884/**
2885 * Delete a function from the filter list.
2886 *
2887 * Delete the given @p func filter from the list in @p part. Returns
2888 * the user data pointer given when added.
2889 *
2890 * @see edje_object_text_insert_filter_callback_add
2891 * @see edje_object_text_insert_filter_callback_del_full
2892 *
2893 * @param obj A valid Evas_Object handle
2894 * @param part The part name
2895 * @param func The function callback to remove
2896 *
2897 * @return The user data pointer if succesful, or NULL otherwise
2898 */
2899EAPI void *edje_object_text_insert_filter_callback_del (Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func);
2900
2901/**
2902 * Delete a function and matching user data from the filter list.
2903 *
2904 * Delete the given @p func filter and @p data user data from the list
2905 * in @p part.
2906 * Returns the user data pointer given when added.
2907 *
2908 * @see edje_object_text_insert_filter_callback_add
2909 * @see edje_object_text_insert_filter_callback_del
2910 *
2911 * @param obj A valid Evas_Object handle
2912 * @param part The part name
2913 * @param func The function callback to remove
2914 * @param data The data passed to the callback function
2915 *
2916 * @return The same data pointer if succesful, or NULL otherwise
2917 */
2918EAPI void *edje_object_text_insert_filter_callback_del_full (Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func, void *data);
2919
2920/**
2921 * @brief Swallows an object into the edje.
2922 *
2923 * @param obj A valid Evas_Object handle
2924 * @param part The part name
2925 * @param obj_swallow The object to swallow
2926 *
2927 * Swallows the object into the edje part so that all geometry changes
2928 * for the part affect the swallowed object. (e.g. resize, move, show,
2929 * raise/lower, etc.).
2930 *
2931 * If an object has already been swallowed into this part, then it
2932 * will first be unswallowed before the new object is swallowed.
2933 */
2934EAPI Eina_Bool edje_object_part_swallow (Evas_Object *obj, const char *part, Evas_Object *obj_swallow);
2935
2936/**
2937 * @brief Unswallow an object.
2938 *
2939 * @param obj A valid Evas_Object handle
2940 * @param obj_swallow The swallowed object
2941 *
2942 * Causes the edje to regurgitate a previously swallowed object. :)
2943 *
2944 * @note @p obj_swallow will @b not be deleted.
2945 */
2946EAPI void edje_object_part_unswallow (Evas_Object *obj, Evas_Object *obj_swallow);
2947
2948/**
2949 * @brief Get the object currently swallowed by a part.
2950 *
2951 * @param obj A valid Evas_Object handle
2952 * @param part The part name
2953 * @return The swallowed object, or NULL if there is none.
2954 */
2955EAPI Evas_Object *edje_object_part_swallow_get (const Evas_Object *obj, const char *part);
2956
2957/**
2958 * @brief Returns the state of the Edje part.
2959 *
2960 * @param obj A valid Evas_Object handle
2961 * @param part The part name
2962 * @param val_ret
2963 *
2964 * @return The part state:\n
2965 * "default" for the default state\n
2966 * "" for other states
2967 */
2968EAPI const char *edje_object_part_state_get (const Evas_Object *obj, const char *part, double *val_ret);
2969
2970/**
2971 * @brief Determine dragable directions.
2972 *
2973 * @param obj A valid Evas_Object handle
2974 * @param part The part name
2975 *
2976 * The dragable directions are defined in the EDC file, inside the @c dragable
2977 * section, by the attributes @c x and @c y. See the @ref edcref for more
2978 * information.
2979 *
2980 * @return #EDJE_DRAG_DIR_NONE: Not dragable\n
2981 * #EDJE_DRAG_DIR_X: Dragable in X direction\n
2982 * #EDJE_DRAG_DIR_Y: Dragable in Y direction\n
2983 * #EDJE_DRAG_DIR_XY: Dragable in X & Y directions
2984 */
2985EAPI Edje_Drag_Dir edje_object_part_drag_dir_get (const Evas_Object *obj, const char *part);
2986
2987/**
2988 * @brief Set the dragable object location.
2989 *
2990 * @param obj A valid Evas_Object handle
2991 * @param part The part name
2992 * @param dx The x value
2993 * @param dy The y value
2994 *
2995 * Places the dragable object at the given location.
2996 *
2997 * Values for @p dx and @p dy are real numbers that range from 0 to 1,
2998 * representing the relative position to the dragable area on that axis.
2999 *
3000 * This value means, for the vertical axis, that 0.0 will be at the top if the
3001 * first parameter of @c y in the dragable part theme is 1, and at bottom if it
3002 * is -1.
3003 *
3004 * For the horizontal axis, 0.0 means left if the first parameter of @c x in the
3005 * dragable part theme is 1, and right if it is -1.
3006 *
3007 * @see edje_object_part_drag_value_get()
3008 */
3009EAPI Eina_Bool edje_object_part_drag_value_set (Evas_Object *obj, const char *part, double dx, double dy);
3010
3011/**
3012 * @brief Get the dragable object location.
3013 *
3014 * @param obj A valid Evas_Object handle
3015 * @param part The part name
3016 * @param dx The X value pointer
3017 * @param dy The Y value pointer
3018 *
3019 * Values for @p dx and @p dy are real numbers that range from 0 to 1,
3020 * representing the relative position to the dragable area on that axis.
3021 *
3022 * @see edje_object_part_drag_value_set()
3023 *
3024 * Gets the drag location values.
3025 */
3026EAPI Eina_Bool edje_object_part_drag_value_get (const Evas_Object *obj, const char *part, double *dx, double *dy);
3027
3028/**
3029 * @brief Set the dragable object size.
3030 *
3031 * @param obj A valid Evas_Object handle
3032 * @param part The part name
3033 * @param dw The drag width
3034 * @param dh The drag height
3035 *
3036 * Values for @p dw and @p dh are real numbers that range from 0 to 1,
3037 * representing the relative size of the dragable area on that axis.
3038 *
3039 * Sets the size of the dragable object.
3040 *
3041 * @see edje_object_part_drag_size_get()
3042 */
3043EAPI Eina_Bool edje_object_part_drag_size_set (Evas_Object *obj, const char *part, double dw, double dh);
3044
3045/**
3046 * @brief Get the dragable object size.
3047 *
3048 * @param obj A valid Evas_Object handle
3049 * @param part The part name
3050 * @param dw The drag width pointer
3051 * @param dh The drag height pointer
3052 *
3053 * Gets the dragable object size.
3054 *
3055 * @see edje_object_part_drag_size_set()
3056 */
3057EAPI Eina_Bool edje_object_part_drag_size_get (const Evas_Object *obj, const char *part, double *dw, double *dh);
3058
3059/**
3060 * @brief Sets the drag step increment.
3061 *
3062 * @param obj A valid Evas_Object handle
3063 * @param part The part name
3064 * @param dx The x step amount
3065 * @param dy The y step amount
3066 *
3067 * Sets the x,y step increments for a dragable object.
3068 *
3069 * Values for @p dx and @p dy are real numbers that range from 0 to 1,
3070 * representing the relative size of the dragable area on that axis by which the
3071 * part will be moved.
3072 *
3073 * @see edje_object_part_drag_step_get()
3074 */
3075EAPI Eina_Bool edje_object_part_drag_step_set (Evas_Object *obj, const char *part, double dx, double dy);
3076
3077/**
3078 * @brief Gets the drag step increment values.
3079 *
3080 * @param obj A valid Evas_Object handle
3081 * @param part The part
3082 * @param dx The x step increment pointer
3083 * @param dy The y step increment pointer
3084 *
3085 * Gets the x and y step increments for the dragable object.
3086 *
3087 *
3088 * @see edje_object_part_drag_step_set()
3089 */
3090EAPI Eina_Bool edje_object_part_drag_step_get (const Evas_Object *obj, const char *part, double *dx, double *dy);
3091
3092/**
3093 * @brief Sets the page step increments.
3094 *
3095 * @param obj A valid Evas_Object handle
3096 * @param part The part name
3097 * @param dx The x page step increment
3098 * @param dy The y page step increment
3099 *
3100 * Sets the x,y page step increment values.
3101 *
3102 * Values for @p dx and @p dy are real numbers that range from 0 to 1,
3103 * representing the relative size of the dragable area on that axis by which the
3104 * part will be moved.
3105 *
3106 * @see edje_object_part_drag_page_get()
3107 */
3108EAPI Eina_Bool edje_object_part_drag_page_set (Evas_Object *obj, const char *part, double dx, double dy);
3109
3110/**
3111 * @brief Gets the page step increments.
3112 *
3113 * @param obj A valid Evas_Object handle
3114 * @param part The part name
3115 * @param dx The dx page increment pointer
3116 * @param dy The dy page increment pointer
3117 *
3118 * Gets the x,y page step increments for the dragable object.
3119 *
3120 * @see edje_object_part_drag_page_set()
3121 */
3122EAPI Eina_Bool edje_object_part_drag_page_get (const Evas_Object *obj, const char *part, double *dx, double *dy);
3123
3124/**
3125 * @brief Steps the dragable x,y steps.
3126 *
3127 * @param obj A valid Evas_Object handle
3128 * @param part The part name
3129 * @param dx The x step
3130 * @param dy The y step
3131 *
3132 * Steps x,y where the step increment is the amount set by
3133 * edje_object_part_drag_step_set.
3134 *
3135 * Values for @p dx and @p dy are real numbers that range from 0 to 1.
3136 *
3137 * @see edje_object_part_drag_page()
3138 */
3139EAPI Eina_Bool edje_object_part_drag_step (Evas_Object *obj, const char *part, double dx, double dy);
3140
3141/**
3142 * @brief Pages x,y steps.
3143 *
3144 * @param obj A valid Evas_Object handle
3145 * @param part The part name
3146 * @param dx The x step
3147 * @param dy The y step
3148 *
3149 * Pages x,y where the increment is defined by
3150 * edje_object_part_drag_page_set.
3151 *
3152 * Values for @p dx and @p dy are real numbers that range from 0 to 1.
3153 *
3154 * @warning Paging is bugged!
3155 *
3156 * @see edje_object_part_drag_step()
3157 */
3158EAPI Eina_Bool edje_object_part_drag_page (Evas_Object *obj, const char *part, double dx, double dy);
3159
3160
3161/**
3162 * @brief Get the object created by this external part.
3163 *
3164 * Parts of type external creates the part object using information
3165 * provided by external plugins. It's somehow like "swallow"
3166 * (edje_object_part_swallow()), but it's all set automatically.
3167 *
3168 * This function returns the part created by such external plugins and
3169 * being currently managed by this Edje.
3170 *
3171 * @note Almost all swallow rules apply: you should not move, resize,
3172 * hide, show, set the color or clipper of such part. It's a bit
3173 * more restrictive as one must @b never delete this object!
3174 *
3175 * @param obj A valid Evas_Object handle
3176 * @param part The part name
3177 * @return The externally created object, or NULL if there is none or
3178 * part is not an external.
3179 */
3180EAPI Evas_Object *edje_object_part_external_object_get (const Evas_Object *obj, const char *part);
3181
3182/**
3183 * @brief Set the parameter for the external part.
3184 *
3185 * Parts of type external may carry extra properties that have
3186 * meanings defined by the external plugin. For instance, it may be a
3187 * string that defines a button label and setting this property will
3188 * change that label on the fly.
3189 *
3190 * @note external parts have parameters set when they change
3191 * states. Those parameters will never be changed by this
3192 * function. The interpretation of how state_set parameters and
3193 * param_set will interact is up to the external plugin.
3194 *
3195 * @note this function will not check if parameter value is valid
3196 * using #Edje_External_Param_Info minimum, maximum, valid
3197 * choices and others. However these should be checked by the
3198 * underlying implementation provided by the external
3199 * plugin. This is done for performance reasons.
3200 *
3201 * @param obj A valid Evas_Object handle
3202 * @param part The part name
3203 * @param param the parameter details, including its name, type and
3204 * actual value. This pointer should be valid, and the
3205 * parameter must exist in
3206 * #Edje_External_Type::parameters_info, with the exact type,
3207 * otherwise the operation will fail and @c EINA_FALSE will be
3208 * returned.
3209 *
3210 * @return @c EINA_TRUE if everything went fine, @c EINA_FALSE on errors.
3211 */
3212EAPI Eina_Bool edje_object_part_external_param_set (Evas_Object *obj, const char *part, const Edje_External_Param *param);
3213
3214/**
3215 * @brief Get the parameter for the external part.
3216 *
3217 * Parts of type external may carry extra properties that have
3218 * meanings defined by the external plugin. For instance, it may be a
3219 * string that defines a button label. This property can be modifed by
3220 * state parameters, by explicit calls to
3221 * edje_object_part_external_param_set() or getting the actual object
3222 * with edje_object_part_external_object_get() and calling native
3223 * functions.
3224 *
3225 * This function asks the external plugin what is the current value,
3226 * independent on how it was set.
3227 *
3228 * @param obj A valid Evas_Object handle
3229 * @param part The part name
3230
3231 * @param param the parameter details. It is used as both input and
3232 * output variable. This pointer should be valid, and the
3233 * parameter must exist in
3234 * #Edje_External_Type::parameters_info, with the exact type,
3235 * otherwise the operation will fail and @c EINA_FALSE will be
3236 * returned.
3237 *
3238 * @return @c EINA_TRUE if everything went fine and @p param members
3239 * are filled with information, @c EINA_FALSE on errors and @p
3240 * param member values are not set or valid.
3241 */
3242EAPI Eina_Bool edje_object_part_external_param_get (const Evas_Object *obj, const char *part, Edje_External_Param *param);
3243
3244/**
3245 * @brief Get an object contained in an part of type EXTERNAL
3246 *
3247 * The @p content string must not be NULL. Its actual value depends on the
3248 * code providing the EXTERNAL.
3249 *
3250 * @param obj The Edje object
3251 * @param part The name of the part holding the EXTERNAL
3252 * @param content A string identifying which content from the EXTERNAL to get
3253 */
3254EAPI Evas_Object *edje_object_part_external_content_get (const Evas_Object *obj, const char *part, const char *content);
3255
3256/**
3257 * Facility to query the type of the given parameter of the given part.
3258 *
3259 * @param obj A valid Evas_Object handle
3260 * @param part The part name
3261 * @param param the parameter name to use.
3262 *
3263 * @return @c EDJE_EXTERNAL_PARAM_TYPE_MAX on errors, or another value
3264 * from #Edje_External_Param_Type on success.
3265 */
3266EAPI Edje_External_Param_Type edje_object_part_external_param_type_get (const Evas_Object *obj, const char *part, const char *param);
3267
3268
3269/**
3270 * @brief Appends an object to the box.
3271 *
3272 * @param obj A valid Evas_Object handle
3273 * @param part The part name
3274 * @param child The object to append
3275 *
3276 * @return @c EINA_TRUE: Successfully added.\n
3277 * @c EINA_FALSE: An error occurred.
3278 *
3279 * Appends child to the box indicated by part.
3280 *
3281 * @see edje_object_part_box_prepend()
3282 * @see edje_object_part_box_insert_before()
3283 * @see edje_object_part_box_insert_at()
3284 */
3285EAPI Eina_Bool edje_object_part_box_append (Evas_Object *obj, const char *part, Evas_Object *child);
3286
3287/**
3288 * @brief Prepends an object to the box.
3289 *
3290 * @param obj A valid Evas_Object handle
3291 * @param part The part name
3292 * @param child The object to prepend
3293 *
3294 * @return @c EINA_TRUE: Successfully added.\n
3295 * @c EINA_FALSE: An error occurred.
3296 *
3297 * Prepends child to the box indicated by part.
3298 *
3299 * @see edje_object_part_box_append()
3300 * @see edje_object_part_box_insert_before()
3301 * @see edje_object_part_box_insert_at()
3302 */
3303EAPI Eina_Bool edje_object_part_box_prepend (Evas_Object *obj, const char *part, Evas_Object *child);
3304
3305/**
3306 * @brief Adds an object to the box.
3307 *
3308 * @param obj A valid Evas_Object handle
3309 * @param part The part name
3310 * @param child The object to insert
3311 * @param reference The object to be used as reference
3312 *
3313 * @return @c EINA_TRUE: Successfully added.\n
3314 * @c EINA_FALSE: An error occurred.
3315 *
3316 * Inserts child in the box given by part, in the position marked by
3317 * reference.
3318 *
3319 * @see edje_object_part_box_append()
3320 * @see edje_object_part_box_prepend()
3321 * @see edje_object_part_box_insert_at()
3322 */
3323EAPI Eina_Bool edje_object_part_box_insert_before (Evas_Object *obj, const char *part, Evas_Object *child, const Evas_Object *reference);
3324
3325/**
3326 * @brief Inserts an object to the box.
3327 *
3328 * @param obj A valid Evas_Object handle
3329 * @param part The part name
3330 * @param child The object to insert
3331 * @param pos The position where to insert child
3332 *
3333 * @return @c EINA_TRUE: Successfully added.\n
3334 * @c EINA_FALSE: An error occurred.
3335 *
3336 * Adds child to the box indicated by part, in the position given by
3337 * pos.
3338 *
3339 * @see edje_object_part_box_append()
3340 * @see edje_object_part_box_prepend()
3341 * @see edje_object_part_box_insert_before()
3342 */
3343EAPI Eina_Bool edje_object_part_box_insert_at (Evas_Object *obj, const char *part, Evas_Object *child, unsigned int pos);
3344
3345/**
3346 * @brief Removes an object from the box.
3347 *
3348 * @param obj A valid Evas_Object handle
3349 * @param part The part name
3350 * @param child The object to remove
3351 *
3352 * @return Pointer to the object removed, or @c NULL.
3353 *
3354 * Removes child from the box indicated by part.
3355 *
3356 * @see edje_object_part_box_remove_at()
3357 * @see edje_object_part_box_remove_all()
3358 */
3359EAPI Evas_Object *edje_object_part_box_remove (Evas_Object *obj, const char *part, Evas_Object *child);
3360
3361/**
3362 * @brief Removes an object from the box.
3363 *
3364 * @param obj A valid Evas_Object handle
3365 * @param part The part name
3366 * @param pos The position index of the object (starts counting from 0)
3367 *
3368 * @return Pointer to the object removed, or @c NULL.
3369 *
3370 * Removes from the box indicated by part, the object in the position
3371 * pos.
3372 *
3373 * @see edje_object_part_box_remove()
3374 * @see edje_object_part_box_remove_all()
3375 */
3376EAPI Evas_Object *edje_object_part_box_remove_at (Evas_Object *obj, const char *part, unsigned int pos);
3377
3378/**
3379 * @brief Removes all elements from the box.
3380 *
3381 * @param obj A valid Evas_Object handle
3382 * @param part The part name
3383 * @param clear Delete objects on removal
3384 *
3385 * @return 1: Successfully cleared.\n
3386 * 0: An error occurred.
3387 *
3388 * Removes all the external objects from the box indicated by part.
3389 * Elements created from the theme will not be removed.
3390 *
3391 * @see edje_object_part_box_remove()
3392 * @see edje_object_part_box_remove_at()
3393 */
3394EAPI Eina_Bool edje_object_part_box_remove_all (Evas_Object *obj, const char *part, Eina_Bool clear);
3395
3396/**
3397 * @brief Retrieve a child from a table
3398 *
3399 * @param obj A valid Evas_Object handle
3400 * @param part The part name
3401 * @param col The column of the child to get
3402 * @param row The row of the child to get
3403 * @return The child Evas_Object
3404 */
3405EAPI Evas_Object *edje_object_part_table_child_get (Evas_Object *obj, const char *part, unsigned int col, unsigned int row);
3406
3407/**
3408 * @brief Packs an object into the table.
3409 *
3410 * @param obj A valid Evas_Object handle
3411 * @param part The part name
3412 * @param child_obj The object to pack in
3413 * @param col The column to place it in
3414 * @param row The row to place it in
3415 * @param colspan Columns the child will take
3416 * @param rowspan Rows the child will take
3417 *
3418 * @return @c EINA_TRUE object was added, @c EINA_FALSE on failure
3419 *
3420 * Packs an object into the table indicated by part.
3421 */
3422EAPI Eina_Bool edje_object_part_table_pack (Evas_Object *obj, const char *part, Evas_Object *child_obj, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan);
3423
3424/**
3425 * @brief Removes an object from the table.
3426 *
3427 * @param obj A valid Evas_Object handle
3428 * @param part The part name
3429 * @param child_obj The object to pack in
3430 *
3431 * @return @c EINA_TRUE object removed, @c EINA_FALSE on failure
3432 *
3433 * Removes an object from the table indicated by part.
3434 */
3435EAPI Eina_Bool edje_object_part_table_unpack (Evas_Object *obj, const char *part, Evas_Object *child_obj);
3436
3437/**
3438 * @brief Gets the number of columns and rows the table has.
3439 *
3440 * @param obj A valid Evas_Object handle
3441 * @param part The part name
3442 * @param cols Pointer where to store number of columns (can be NULL)
3443 * @param rows Pointer where to store number of rows (can be NULL)
3444 *
3445 * @return @c EINA_TRUE get some data, @c EINA_FALSE on failure
3446 *
3447 * Retrieves the size of the table in number of columns and rows.
3448 */
3449EAPI Eina_Bool edje_object_part_table_col_row_size_get (const Evas_Object *obj, const char *part, int *cols, int *rows);
3450
3451/**
3452 * @brief Removes all object from the table.
3453 *
3454 * @param obj A valid Evas_Object handle
3455 * @param part The part name
3456 * @param clear If set, will delete subobjs on remove
3457 *
3458 * @return @c EINA_TRUE clear the table, @c EINA_FALSE on failure
3459 *
3460 * Removes all object from the table indicated by part, except the
3461 * internal ones set from the theme.
3462 */
3463EAPI Eina_Bool edje_object_part_table_clear (Evas_Object *obj, const char *part, Eina_Bool clear);
3464
3465/**
3466 * @brief Send an (Edje) message to a given Edje object
3467 *
3468 * @param obj A handle to an Edje object
3469 * @param type The type of message to send to @p obj
3470 * @param id A identification number for the message to be sent
3471 * @param msg The message's body, a struct depending on @p type
3472 *
3473 * This function sends an Edje message to @p obj and to all of its
3474 * child objects, if it has any (swallowed objects are one kind of
3475 * child object). @p type and @p msg @b must be matched accordingly,
3476 * as documented in #Edje_Message_Type.
3477 *
3478 * The @p id argument as a form of code and theme defining a common
3479 * interface on message communication. One should define the same IDs
3480 * on both code and EDC declaration (see @ref edcref "the syntax" for
3481 * EDC files), to individualize messages (binding them to a given
3482 * context).
3483 *
3484 * The function to handle messages arriving @b from @b obj is set with
3485 * edje_object_message_handler_set().
3486 */
3487EAPI void edje_object_message_send (Evas_Object *obj, Edje_Message_Type type, int id, void *msg);
3488
3489/**
3490 * @brief Set an Edje message handler function for a given Edje object.
3491 *
3492 * @param obj A handle to an Edje object
3493 * @param func The function to handle messages @b coming from @p obj
3494 * @param data Auxiliary data to be passed to @p func
3495 *
3496 * Edje messages are one of the communication interfaces between
3497 * @b code and a given Edje object's @b theme. With messages, one can
3498 * communicate values beyond strings (which are the subject of Edje
3499 * signals -- see edje_object_signal_emit()), like float and integer
3500 * numbers. Moreover, messages can be identified by integer
3501 * numbers. See #Edje_Message_Type for the full list of message types.
3502 *
3503 * For scriptable programs on an Edje object's defining EDC file which
3504 * send messages with the @c send_message() primitive, one can attach
3505 * <b>handler functions</b>, to be called in the code which creates
3506 * that object (see @ref edcref "the syntax" for EDC files).
3507 *
3508 * This function associates a message handler function and the
3509 * attached data pointer to the object @p obj.
3510 *
3511 * @see edje_object_message_send()
3512 */
3513EAPI void edje_object_message_handler_set (Evas_Object *obj, Edje_Message_Handler_Cb func, void *data);
3514
3515/**
3516 * @brief Process an object's message queue.
3517 *
3518 * @param obj A handle to an Edje object.
3519 *
3520 * This function goes through the object message queue processing the
3521 * pending messages for @b this specific Edje object. Normally they'd
3522 * be processed only at idle time.
3523 *
3524 */
3525EAPI void edje_object_message_signal_process (Evas_Object *obj);
3526
3527
3528/**
3529 * @brief Process all queued up edje messages.
3530 *
3531 * This function triggers the processing of messages addressed to any
3532 * (alive) edje objects.
3533 *
3534 */
3535EAPI void edje_message_signal_process (void);
3536
3537/**
3538 * Register a type to be used by EXTERNAL parts.
3539 *
3540 * Edje supports parts of type EXTERNAL, which will call user defined functions
3541 * to create and manipulate the object that's allocated in that part. This is
3542 * done by expecifying in the @c source property of the part the name of the
3543 * external to use, which must be one registered with this function.
3544 *
3545 * @param type_name name to register and be known by edje's "source:"
3546 * parameter of "type: EXTERNAL" parts.
3547 * @param type_info meta-information describing how to interact with it.
3548 *
3549 * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (like
3550 * type already registered).
3551 *
3552 * @see edje_external_type_array_register()
3553 */
3554EAPI Eina_Bool edje_external_type_register (const char *type_name, const Edje_External_Type *type_info);
3555
3556/**
3557 * Unregister a previously registered EXTERNAL type.
3558 *
3559 * @param type_name name to unregister. It should have been registered with
3560 * edje_external_type_register() before.
3561 *
3562 * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (like
3563 * type_name did not exist).
3564 *
3565 * @see edje_external_type_array_unregister()
3566 */
3567EAPI Eina_Bool edje_external_type_unregister (const char *type_name);
3568
3569/**
3570 * Register a batch of types and their information.
3571 *
3572 * When several types will be registered it is recommended to use this
3573 * function instead of several calls to edje_external_type_register(), as it
3574 * is faster.
3575 *
3576 * @note The contents of the array will be referenced directly for as long as
3577 * the type remains registered, so both the @c name and @c info in the
3578 * @p array must be kept alive during all this period (usually, the entire
3579 * program lifetime). The most common case would be to keep the array as a
3580 * @c static @c const type anyway.
3581 *
3582 * @param array @c NULL terminated array with type name and
3583 * information. Note that type name or information are
3584 * referenced directly, so they must be kept alive after
3585 * this function returns!
3586 *
3587 * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (like
3588 * type already registered).
3589 *
3590 * @see edje_external_type_register()
3591 */
3592EAPI void edje_external_type_array_register (const Edje_External_Type_Info *array);
3593
3594/**
3595 * Unregister a batch of given external type previously registered.
3596 *
3597 * @param array @c NULL terminated array, should be the same as the
3598 * one used to register with edje_external_type_array_register()
3599 *
3600 * @see edje_external_type_unregister()
3601 */
3602EAPI void edje_external_type_array_unregister (const Edje_External_Type_Info *array);
3603
3604/**
3605 * Return the current ABI version for Edje_External_Type structure.
3606 *
3607 * Always check this number before accessing Edje_External_Type in
3608 * your own software. If the number is not the same, your software may
3609 * access invalid memory and crash, or just get garbage values.
3610 *
3611 * @warning @b NEVER, EVER define your own Edje_External_Type using the
3612 * return of this function as it will change as Edje library
3613 * (libedje.so) changes, but your type definition will
3614 * not. Instead, use #EDJE_EXTERNAL_TYPE_ABI_VERSION.
3615 *
3616 * Summary:
3617 * - use edje_external_type_abi_version_get() to check.
3618 * - use #EDJE_EXTERNAL_TYPE_ABI_VERSION to define/declare.
3619 *
3620 * @return The external ABI version the Edje library was compiled with. That
3621 * is, the value #EDJE_EXTERNAL_TYPE_ABI_VERSION had at that moment.
3622 */
3623EAPI unsigned int edje_external_type_abi_version_get (void) EINA_CONST;
3624
3625/**
3626 * Returns an interator of all the registered EXTERNAL types.
3627 *
3628 * Each item in the iterator is an @c Eina_Hash_Tuple which has the type
3629 * of the external in the @c key and #Edje_External_Type as @c data.
3630 *
3631 * @code
3632 * const Eina_Hash_Tuple *tuple;
3633 * Eina_Iterator *itr;
3634 * const Eina_List *l, *modules;
3635 * const char *s;
3636 *
3637 * modules = edje_available_modules_get();
3638 * EINA_LIST_FOREACH(modules, l, s)
3639 * {
3640 * if (!edje_module_load(s))
3641 * printf("Error loading edje module: %s\n", s);
3642 * }
3643 *
3644 * itr = edje_external_iterator_get();
3645 * EINA_ITERATOR_FOREACH(itr, tuple)
3646 * {
3647 * const char *name = tuple->key;
3648 * const Edje_External_Type *type = tuple->data;
3649 *
3650 * if ((!type) ||
3651 * (type->abi_version != edje_external_type_abi_version_get()))
3652 * {
3653 * printf("Error: invalid type %p (abi: %d, expected: %d)\n",
3654 * type, type ? type->abi_version : 0,
3655 * edje_external_type_abi_version_get());
3656 * continue;
3657 * }
3658 *
3659 * printf("%s: %s (%s) label='%s' desc='%s'\n",
3660 * name, type->module, type->module_name,
3661 * type->label_get ? type->label_get(type->data) : "",
3662 * type->description_get ? type->description_get(type->data) : "");
3663 * }
3664 *
3665 * @endcode
3666 */
3667EAPI Eina_Iterator *edje_external_iterator_get (void);
3668
3669/**
3670 * Conevenience function to find a specific parameter in a list of them.
3671 *
3672 * @param params The list of parameters for the external
3673 * @param key The parameter to look for
3674 *
3675 * @return The matching #Edje_External_Param or NULL if it's not found.
3676 */
3677 EAPI Edje_External_Param *edje_external_param_find (const Eina_List *params, const char *key);
3678/**
3679 * Get the value of the given parameter of integer type.
3680 *
3681 * Look for the @p key parameter in the @p params list and return its value in
3682 * @p ret. If the parameter is found and is of type
3683 * #EDJE_EXTERNAL_PARAM_TYPE_INT, its value will be stored in the int pointed
3684 * by @p ret, returning EINA_TRUE. In any other case, the function returns
3685 * EINA_FALSE.
3686 *
3687 * @param params List of parameters where to look
3688 * @param key Name of the parameter to fetch
3689 * @param ret Int pointer where to store the value, must not be NULL.
3690 *
3691 * @return EINA_TRUE if the parameter was found and is of integer type,
3692 * EINA_FALSE otherwise.
3693 */
3694 EAPI Eina_Bool edje_external_param_int_get (const Eina_List *params, const char *key, int *ret);
3695/**
3696 * Get the value of the given parameter of double type.
3697 *
3698 * Look for the @p key parameter in the @p params list and return its value in
3699 * @p ret. If the parameter is found and is of type
3700 * #EDJE_EXTERNAL_PARAM_TYPE_DOUBLE, its value will be stored in the double
3701 * pointed by @p ret, returning EINA_TRUE. In any other case, the function
3702 * returns EINA_FALSE.
3703 *
3704 * @param params List of parameters where to look
3705 * @param key Name of the parameter to fetch
3706 * @param ret Double pointer where to store the value, must not be NULL.
3707 *
3708 * @return EINA_TRUE if the parameter was found and is of double type,
3709 * EINA_FALSE otherwise.
3710 */
3711 EAPI Eina_Bool edje_external_param_double_get (const Eina_List *params, const char *key, double *ret);
3712/**
3713 * Get the value of the given parameter of string type.
3714 *
3715 * Look for the @p key parameter in the @p params list and return its value in
3716 * @p ret. If the parameter is found and is of type
3717 * #EDJE_EXTERNAL_PARAM_TYPE_STRING, its value will be stored in the pointer
3718 * pointed by @p ret, returning EINA_TRUE. In any other case, the function
3719 * returns EINA_FALSE.
3720 *
3721 * The string stored in @p ret must not be freed or modified.
3722 *
3723 * @param params List of parameters where to look
3724 * @param key Name of the parameter to fetch
3725 * @param ret String pointer where to store the value, must not be NULL.
3726 *
3727 * @return EINA_TRUE if the parameter was found and is of string type,
3728 * EINA_FALSE otherwise.
3729 */
3730 EAPI Eina_Bool edje_external_param_string_get (const Eina_List *params, const char *key, const char **ret);
3731/**
3732 * Get the value of the given parameter of boolean type.
3733 *
3734 * Look for the @p key parameter in the @p params list and return its value in
3735 * @p ret. If the parameter is found and is of type
3736 * #EDJE_EXTERNAL_PARAM_TYPE_BOOL, its value will be stored in the Eina_Bool
3737 * pointed by @p ret, returning EINA_TRUE. In any other case, the function
3738 * returns EINA_FALSE.
3739 *
3740 * @param params List of parameters where to look
3741 * @param key Name of the parameter to fetch
3742 * @param ret Eina_Bool pointer where to store the value, must not be NULL.
3743 *
3744 * @return EINA_TRUE if the parameter was found and is of boolean type,
3745 * EINA_FALSE otherwise.
3746 */
3747 EAPI Eina_Bool edje_external_param_bool_get (const Eina_List *params, const char *key, Eina_Bool *ret);
3748/**
3749 * Get the value of the given parameter of choice type.
3750 *
3751 * Look for the @p key parameter in the @p params list and return its value in
3752 * @p ret. If the parameter is found and is of type
3753 * #EDJE_EXTERNAL_PARAM_TYPE_CHOICE, its value will be stored in the string
3754 * pointed by @p ret, returning EINA_TRUE. In any other case, the function
3755 * returns EINA_FALSE.
3756 *
3757 * The string stored in @p ret must not be freed or modified.
3758 *
3759 * @param params List of parameters where to look
3760 * @param key Name of the parameter to fetch
3761 * @param ret String pointer where to store the value, must not be NULL.
3762 *
3763 * @return EINA_TRUE if the parameter was found and is of integer type,
3764 * EINA_FALSE otherwise.
3765 */
3766 EAPI Eina_Bool edje_external_param_choice_get (const Eina_List *params, const char *key, const char **ret);
3767
3768/**
3769 * Get the array of parameters information about a type given its name.
3770 *
3771 * @note the type names and other strings are static, that means they are
3772 * @b NOT translated. One must use
3773 * Edje_External_Type::translate() to translate those.
3774 *
3775 * @return the NULL terminated array, or @c NULL if type is unknown or
3776 * it does not have any parameter information.
3777 *
3778 * @see edje_external_type_get()
3779 */
3780EAPI const Edje_External_Param_Info *edje_external_param_info_get (const char *type_name);
3781
3782/**
3783 * Get the #Edje_External_Type that defines an EXTERNAL type registered with
3784 * the name @p type_name.
3785 */
3786 EAPI const Edje_External_Type *edje_external_type_get (const char *type_name);
3787
3788 EAPI Eina_Bool edje_module_load (const char *module);
3789 EAPI const Eina_List *edje_available_modules_get (void);
3790
3791 /* perspective info for maps inside edje objects */
3792 typedef struct _Edje_Perspective Edje_Perspective;
3793
3794 /**
3795 * Creates a new perspective in the given canvas.
3796 *
3797 * @param e The given canvas (Evas).
3798 * @return An @ref Edje_Perspective object for this canvas, or @c NULL on errors.
3799 *
3800 * This function creates a perspective object that can be set on an Edje
3801 * object, or globally to all Edje objects on this canvas.
3802 *
3803 * @see edje_perspective_set()
3804 * @see edje_perspective_free()
3805 */
3806 EAPI Edje_Perspective *edje_perspective_new (Evas *e);
3807 /**
3808 * Delete the given perspective object.
3809 *
3810 * @param ps A valid perspective object, or @c NULL.
3811 *
3812 * This function will delete the perspective object. If the perspective
3813 * effect was being applied to any Edje object or part, this effect won't be
3814 * applied anymore.
3815 *
3816 * @see edje_perspective_new()
3817 */
3818 EAPI void edje_perspective_free (Edje_Perspective *ps);
3819 /**
3820 * Setup the transform for this perspective object.
3821 *
3822 * This sets the parameters of the perspective transformation. X, Y and Z
3823 * values are used. The px and py points specify the "infinite distance" point
3824 * in the 3D conversion (where all lines converge to like when artists draw
3825 * 3D by hand). The @p z0 value specifis the z value at which there is a 1:1
3826 * mapping between spatial coorinates and screen coordinates. Any points
3827 * on this z value will not have their X and Y values modified in the transform.
3828 * Those further away (Z value higher) will shrink into the distance, and
3829 * those less than this value will expand and become bigger. The @p foc value
3830 * determines the "focal length" of the camera. This is in reality the distance
3831 * between the camera lens plane itself (at or closer than this rendering
3832 * results are undefined) and the "z0" z value. This allows for some "depth"
3833 * control and @p foc must be greater than 0.
3834 *
3835 * @param m map to change.
3836 * @param px The pespective distance X coordinate
3837 * @param py The pespective distance Y coordinate
3838 * @param z0 The "0" z plane value
3839 * @param foc The focal distance
3840 */
3841 EAPI void edje_perspective_set (Edje_Perspective *ps, Evas_Coord px, Evas_Coord py, Evas_Coord z0, Evas_Coord foc);
3842 /**
3843 * Make this perspective object be global for its canvas.
3844 *
3845 * @param ps The given perspective object
3846 * @param global @c EINA_TRUE if the perspective should be global, @c
3847 * EINA_FALSE otherwise.
3848 *
3849 * The canvas which this perspective object is being set as global is the one
3850 * given as argument upon the object creation (the @p evas parameter on the
3851 * function @c edje_perspective_new(evas) ).
3852 *
3853 * There can be only one global perspective object set per canvas, and if
3854 * a perspective object is set to global when there was already another
3855 * global perspective set, the old one will be set as non-global.
3856 *
3857 * A global perspective just affects a part if its Edje object doesn't have a
3858 * perspective object set to it, and if the part doesn't point to another
3859 * part to be used as perspective.
3860 *
3861 * @see edje_object_perspective_set()
3862 * @see edje_perspective_global_get()
3863 * @see edje_perspective_new()
3864 */
3865 EAPI void edje_perspective_global_set (Edje_Perspective *ps, Eina_Bool global);
3866 /**
3867 * Get whether the given perspective object is global or not.
3868 *
3869 * @param ps The given perspective object.
3870 * @return @c EINA_TRUE if this perspective object is global, @c EINA_FALSE
3871 * otherwise.
3872 *
3873 * @see edje_perspective_global_set()
3874 */
3875 EAPI Eina_Bool edje_perspective_global_get (const Edje_Perspective *ps);
3876 /**
3877 * Get the global perspective object set for this canvas.
3878 *
3879 * @param e The given canvas (Evas).
3880 * @return The perspective object set as global for this canvas. Or @c NULL
3881 * if there is no global perspective set and on errors.
3882 *
3883 * This function will return the perspective object that was set as global
3884 * with edje_perspective_global_set().
3885 *
3886 * @see edje_perspective_global_set()
3887 * @see edje_perspective_global_get()
3888 */
3889 EAPI const Edje_Perspective *edje_evas_global_perspective_get(const Evas *e);
3890 /**
3891 * Set the given perspective object on this Edje object.
3892 *
3893 * @param obj The Edje object on the perspective will be set.
3894 * @param ps The perspective object that will be used.
3895 *
3896 * Make the given perspective object be the default perspective for this Edje
3897 * object.
3898 *
3899 * There can be only one perspective object per Edje object, and if a
3900 * previous one was set, it will be removed and the new perspective object
3901 * will be used.
3902 *
3903 * An Edje perspective will only affect a part if it doesn't point to another
3904 * part to be used as perspective.
3905 *
3906 * @see edje_object_perspective_new()
3907 * @see edje_object_perspective_get()
3908 * @see edje_perspective_set()
3909 */
3910 EAPI void edje_object_perspective_set (Evas_Object *obj, Edje_Perspective *ps);
3911 /**
3912 * Get the current perspective used on this Edje object.
3913 *
3914 * @param obj the given Edje object.
3915 * @return The perspective object being used on this Edje object. Or @c NULL
3916 * if there was none, and on errors.
3917 *
3918 * @see edje_object_perspective_set()
3919 */
3920 EAPI const Edje_Perspective *edje_object_perspective_get (const Evas_Object *obj);
3921
3922#ifdef __cplusplus
3923}
3924#endif
3925
3926#endif
diff --git a/libraries/edje/src/lib/Edje_Edit.h b/libraries/edje/src/lib/Edje_Edit.h
new file mode 100644
index 0000000..935d661
--- /dev/null
+++ b/libraries/edje/src/lib/Edje_Edit.h
@@ -0,0 +1,3539 @@
1#ifndef _EDJE_EDIT_H
2#define _EDJE_EDIT_H
3
4#ifndef EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT
5#error "Do not use the Edje_Edit API unless you know what you are doing. It's meant only for writing editors and nothing else."
6#endif
7
8#include <Edje.h>
9
10#ifdef EAPI
11# undef EAPI
12#endif
13
14#ifdef _WIN32
15# ifdef EFL_EDJE_BUILD
16# ifdef DLL_EXPORT
17# define EAPI __declspec(dllexport)
18# else
19# define EAPI
20# endif /* ! DLL_EXPORT */
21# else
22# define EAPI __declspec(dllimport)
23# endif /* ! EFL_EDJE_BUILD */
24#else
25# ifdef __GNUC__
26# if __GNUC__ >= 4
27# define EAPI __attribute__ ((visibility("default")))
28# else
29# define EAPI
30# endif
31# else
32# define EAPI
33# endif
34#endif
35
36
37typedef enum _Edje_Edit_Image_Comp
38{
39 EDJE_EDIT_IMAGE_COMP_RAW,
40 EDJE_EDIT_IMAGE_COMP_USER,
41 EDJE_EDIT_IMAGE_COMP_COMP,
42 EDJE_EDIT_IMAGE_COMP_LOSSY
43} Edje_Edit_Image_Comp;
44
45struct _Edje_Edit_Script_Error
46{
47 const char *program_name; /* null == group shared script */
48 int line;
49 const char *error_str;
50};
51typedef struct _Edje_Edit_Script_Error Edje_Edit_Script_Error;
52
53/**
54 * @file
55 * @brief Functions to deal with edje internal object. Don't use in standard
56 * situations. The use of any of the edje_edit_* functions can break your
57 * theme ability, remember that the program must be separated from the interface!
58 *
59 * This was intended ONLY for use in an actual edje editor program. Unless
60 * you are writing one of these, do NOT use this API here.
61 *
62 * The API can be used to query or set every part of an edje object in real time.
63 * You can manage every aspect of parts, part states, programs, script and whatever
64 * is contained in the edje file. For a reference of what all parameter means
65 * look at the complete @ref edcref.
66 *
67 * Don't forget to free all the strings and the lists returned by any edje_edit_*()
68 * functions using edje_edit_string_free() and edje_edit_string_list_free() when
69 * you don't need anymore.
70 *
71 * Example: print all the part in a loaded edje_object
72 * @code
73 * Eina_List *parts, *l;
74 * char *part;
75 *
76 * parts = edje_edit_parts_list_get(edje_object);
77 * EINA_LIST_FOREACH(parts, l, part)
78 * {
79 * printf("Part: %s\n", part);
80 * }
81 * edje_edit_string_list_free(parts);
82 * @endcode
83 *
84 * Example: Change the color of a rect inside an edje file
85 * @code
86 * Evas_Object *edje;
87 *
88 * edje = edje_edit_object_add(evas);
89 * edje_object_file_set(edje, "edj/file/name", "group to load");
90 * edje_edit_state_color_set(edje, "MyRectName", "default", 0.00, 255, 255, 0, 255);
91 * edje_edit_save(edje);
92 * @endcode
93 *
94*/
95
96
97#ifdef __cplusplus
98extern "C" {
99#endif
100
101/******************************************************************************/
102/************************** GENERAL API ***********************************/
103/******************************************************************************/
104/** @name General API
105 * General functions that don't fit in other cateories.
106 */ //@{
107
108/** Adds an editable Edje object to the canvas.
109 *
110 * An Edje_Edit object is, for the most part, a standard Edje object. Only
111 * difference is you can use the Edje_Edit API on them.
112 *
113 * @param e Evas canvas where to add the object.
114 *
115 * @return An Evas_Object of type Edje_Edit, or NULL if an error occurred.
116 */
117EAPI Evas_Object * edje_edit_object_add(Evas *e);
118
119/** Free a generic Eina_List of (char *) allocated by an edje_edit_*_get() function.
120 *
121 * @param lst List of strings to free.
122 */
123EAPI void edje_edit_string_list_free(Eina_List *lst);
124
125/** Free a generic string (char *) allocated by an edje_edit_*_get() function.
126 *
127 * @param str String to free.
128 */
129EAPI void edje_edit_string_free(const char *str);
130
131/** Get the name of the program that compiled the edje file.
132 * Can be 'edje_cc' or 'edje_edit'
133 *
134 * @param obj Object being edited.
135 *
136 * @return Compiler stored in the Edje file
137 */
138EAPI const char * edje_edit_compiler_get(Evas_Object *obj);
139
140/** Save the modified edje object back to his file.
141 *
142 * Use this function when you are done with your editing, all the change made
143 * to the current loaded group will be saved back to the original file.
144 *
145 * @note Source for the whole file will be auto generated and will overwrite
146 * any previously stored source.
147 *
148 * @param obj Object to save back to the file it was loaded from.
149 *
150 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
151 *
152 * @todo Add a way to check what the error actually was, the way Edje Load does.
153 */
154EAPI Eina_Bool edje_edit_save(Evas_Object *obj);
155
156/** Saves every group back into the file.
157 *
158 * @param obj Object to save.
159 *
160 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
161 *
162 * @see edje_edit_save()
163 */
164EAPI Eina_Bool edje_edit_save_all(Evas_Object *obj);
165
166/** Print on standard output many information about the internal status
167 * of the edje object.
168 *
169 * This is probably only useful to debug.
170 *
171 * @param obj Object being edited.
172 */
173EAPI void edje_edit_print_internal_status(Evas_Object *obj);
174
175
176//@}
177/******************************************************************************/
178/************************** GROUPS API ************************************/
179/******************************************************************************/
180/** @name Groups API
181 * Functions to deal with groups property (see @ref edcref).
182 */ //@{
183
184/** Create a new empty group in the given edje.
185 *
186 * If a group with the same name exist none is created.
187 *
188 * @param obj Object being edited.
189 * @param name Name of the new group.
190 *
191 * @return EINA_TRUE if successfully added the group, EINA_FALSE if an error
192 * occurred or if a group with the same name exists.
193 */
194
195/**
196 * @brief Add an edje (empty) group to an edje object's group set.
197 *
198 * @param obj The pointer to edje object.
199 * @param name The name of the group.
200 *
201 * @return 1 If it could allocate memory to the part group added
202 * or zero if not.
203 *
204 * This function adds, at run time, one more group, which will reside
205 * in memory, to the group set found in the .edj file which @a obj was
206 * loaded with. This group can be manipulated by other API functions,
207 * like @c edje_edit_part_add(), for example. If desired, the new
208 * group can be actually committed the respective .edj by use of @c
209 * edje_edit_save().
210 *
211 */
212EAPI Eina_Bool edje_edit_group_add(Evas_Object *obj, const char *name);
213
214/** Delete the specified group from the given edje.
215 *
216 * You can only delete a currently unused group.
217 * All the parts and the programs inside the group will be deleted as well,
218 * but not image or font embedded in the edje.
219 *
220 * @param obj Object being edited.
221 * @param group_name Name of group to delete.
222 *
223 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
224 */
225
226/**
227 * @brief Delete the specified group from the edje file.
228 *
229 * @param obj The pointer to the edje object.
230 * @param group_name Group to delete.
231 *
232 * @return @c EINA_TRUE on success, @c EINA_FALSE on failure.
233 *
234 * This function deletes the given group from the file @a obj is set to. This
235 * operation can't be undone as all references to the group are removed from
236 * the file.
237 * This function may fail if the group to be deleted is currently in use.
238 *
239 */
240EAPI Eina_Bool edje_edit_group_del(Evas_Object *obj, const char *group_name);
241
242/** Check if a group with the given name exist in the edje.
243 *
244 * @param obj Object being edited.
245 * @param group Group name to check for.
246 *
247 * @return EINA_TRUE if group exists, EINA_FALSE if not.
248 */
249EAPI Eina_Bool edje_edit_group_exist(Evas_Object *obj, const char *group);
250
251/** Set a new name for the current open group.
252 *
253 * You can only rename a group that is currently loaded
254 * Note that the relative getter function don't exist as it doesn't make sense ;)
255 * @param obj Object being edited.
256 * @param new_name New name for the group.
257 *
258 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
259 */
260EAPI Eina_Bool edje_edit_group_name_set(Evas_Object *obj, const char *new_name);
261
262/** Get the group minimum width.
263 *
264 * @param obj Object being edited.
265 *
266 * @return The minimum width set for the group. -1 if an error occurred.
267 */
268EAPI int edje_edit_group_min_w_get(Evas_Object *obj);
269
270/** Set the group minimum width.
271 *
272 * @param obj Object being edited.
273 * @param w New minimum width for the group.
274 */
275EAPI void edje_edit_group_min_w_set(Evas_Object *obj, int w);
276
277/** Get the group minimum height.
278 *
279 * @param obj Object being edited.
280 *
281 * @return The minimum height set for the group. -1 if an error occurred.
282 */
283EAPI int edje_edit_group_min_h_get(Evas_Object *obj);
284
285/** Set the group minimum height.
286 *
287 * @param obj Object being edited.
288 * @param h New minimum height for the group.
289 */
290EAPI void edje_edit_group_min_h_set(Evas_Object *obj, int h);
291
292/** Get the group maximum width.
293 *
294 * @param obj Object being edited.
295 *
296 * @return The maximum width set for the group. -1 if an error occurred.
297 */
298EAPI int edje_edit_group_max_w_get(Evas_Object *obj);
299
300/** Set the group maximum width.
301 *
302 * @param obj Object being edited.
303 * @param w New maximum width for the group.
304 */
305EAPI void edje_edit_group_max_w_set(Evas_Object *obj, int w);
306
307/** Get the group maximum height.
308 *
309 * @param obj Object being edited.
310 *
311 * @return The maximum height set for the group. -1 if an error occurred.
312 */
313EAPI int edje_edit_group_max_h_get(Evas_Object *obj);
314
315/** Set the group maximum height.
316 *
317 * @param obj Object being edited.
318 * @param h New maximum height for the group.
319 */
320EAPI void edje_edit_group_max_h_set(Evas_Object *obj, int h);
321
322
323//@}
324/******************************************************************************/
325/************************** DATA API **************************************/
326/******************************************************************************/
327/** @name Data API
328 * Functions to deal with data embedded in the edje (see @ref edcref).
329 */ //@{
330
331/** Retrieves a list with the item names inside the data block.
332 *
333 * @param obj Object being edited.
334 *
335 * @return List of strings, each being a name entry in the global data block for the file.
336 */
337EAPI Eina_List * edje_edit_data_list_get(Evas_Object *obj);
338
339/** Create a new *global* data object in the given edje file.
340 *
341 * If another data entry with the same name exists, nothing is created and
342 * EINA_FALSE is returned.
343 *
344 * @param obj Object being edited.
345 * @param itemname Name for the new data entry.
346 * @param value Value for the new data entry.
347 *
348 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
349 */
350EAPI Eina_Bool edje_edit_data_add(Evas_Object *obj, const char *itemname, const char *value);
351
352/** Delete the given data object from edje.
353 *
354 * @param obj Object being edited.
355 * @param itemname Data entry to remove from the global data block.
356 *
357 * @return EINA_TRUE on success, EINA_FALSE otherwise.
358 */
359EAPI Eina_Bool edje_edit_data_del(Evas_Object *obj, const char *itemname);
360
361/** Get the data associated with the given itemname.
362 *
363 * @param obj Object being edited.
364 * @param itemname Name of the data entry to fetch the value for.
365 *
366 * @return Value of the given entry, or NULL if not found.
367 */
368EAPI const char * edje_edit_data_value_get(Evas_Object *obj, const char *itemname);
369
370/** Set the data associated with the given itemname.
371 *
372 * @param obj Object being edited.
373 * @param itemname Name of data entry to change the value.
374 * @param value New value for the entry.
375 *
376 * @return EINA_TRUE on success, EINA_FALSE otherwise.
377 */
378EAPI Eina_Bool edje_edit_data_value_set(Evas_Object *obj, const char *itemname, const char *value);
379
380/** Change the name of the given data object.
381 *
382 * @param obj Object being edited.
383 * @param itemname Data entry to rename.
384 * @param newname New name for the data entry.
385 *
386 * @return EINA_TRUE on success, EINA_FALSE otherwise.
387 */
388EAPI Eina_Bool edje_edit_data_name_set(Evas_Object *obj, const char *itemname, const char *newname);
389
390/** Retrieves a list with the item names inside the data block at the group level.
391 *
392 * @param obj Object being edited.
393 *
394 * @return List of strings, each being a name entry in the data block for the group.
395 */
396EAPI Eina_List * edje_edit_group_data_list_get(Evas_Object *obj);
397
398/** Create a new data object in the given edje file *belonging to the current group*.
399 *
400 * If another data entry with the same name exists,
401 * nothing is created and EINA_FALSE is returned.
402 *
403 * @param obj Object being edited.
404 * @param itemname Name for the new data entry.
405 * @param value Value for the new data entry.
406 *
407 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
408 */
409EAPI Eina_Bool edje_edit_group_data_add(Evas_Object *obj, const char *itemname, const char *value);
410
411/** Delete the given data object from the group.
412 *
413 * @param obj Object being edited.
414 * @param itemname Name of the data entry to remove.
415 *
416 * @return EINA_TRUE on success, EINA_FALSE otherwise.
417 */
418EAPI Eina_Bool edje_edit_group_data_del(Evas_Object *obj, const char *itemname);
419
420/** Get the data associated with the given itemname.
421 *
422 * @param obj Object being edited.
423 * @param itemname Name of the data entry.
424 *
425 * @return Value of the data entry or NULL if not found.
426 */
427EAPI const char * edje_edit_group_data_value_get(Evas_Object *obj, const char *itemname);
428
429/** Set the data associated with the given itemname.
430 *
431 * @param obj Object being edited.
432 * @param itemname Name of the data entry to set the value.
433 * @param value Value to set for the data entry.
434 *
435 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
436 */
437EAPI Eina_Bool edje_edit_group_data_value_set(Evas_Object *obj, const char *itemname, const char *value);
438
439/** Change the name of the given data object.
440 *
441 * @param obj Object being edited.
442 * @param itemname Name of the data entry to rename.
443 * @param newname New name for the data entry.
444 *
445 * @return EINA_TRUE on success, EINA_FALSE otherwise.
446 */
447EAPI Eina_Bool edje_edit_group_data_name_set(Evas_Object *obj, const char *itemname, const char *newname);
448
449
450//@}
451/******************************************************************************/
452/*********************** COLOR CLASSES API ********************************/
453/******************************************************************************/
454/** @name Color Classes API
455 * Functions to deal with Color Classes (see @ref edcref).
456 */ //@{
457
458/** Get the list of all the Color Classes in the given edje object.
459 *
460 * @param obj Object being edited.
461 *
462 * @return List of strings, each being one color class.
463 */
464EAPI Eina_List * edje_edit_color_classes_list_get(Evas_Object *obj);
465
466/** Create a new color class object in the given edje.
467 *
468 * If another class with the same name exists nothing is created and EINA_FALSE is returned.
469 *
470 * @param obj Object being edited.
471 * @param name Name for the new color class.
472 *
473 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
474 */
475EAPI Eina_Bool edje_edit_color_class_add(Evas_Object *obj, const char *name);
476
477/** Delete the given class object from edje.
478 *
479 * @param obj Object being edited.
480 * @param name Color class to delete.
481 *
482 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
483 */
484EAPI Eina_Bool edje_edit_color_class_del(Evas_Object *obj, const char *name);
485
486/** Get all the colors that compose the class.
487 *
488 * You can pass NULL to colors you are not intrested in.
489 *
490 * @param obj Object being edited.
491 * @param class_name Color class to fetch values.
492 * @param r Red component of main color.
493 * @param g Green component of main color.
494 * @param b Blue component of main color.
495 * @param a Alpha component of main color.
496 * @param r2 Red component of secondary color.
497 * @param g2 Green component of secondary color.
498 * @param b2 Blue component of secondary color.
499 * @param a2 Alpha component of secondary color.
500 * @param r3 Red component of tertiary color.
501 * @param g3 Green component of tertiary color.
502 * @param b3 Blue component of tertiary color.
503 * @param a3 Alpha component of tertiary color.
504 *
505 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
506 */
507EAPI Eina_Bool edje_edit_color_class_colors_get(Evas_Object *obj, const char *class_name, int *r, int *g, int *b, int *a, int *r2, int *g2, int *b2, int *a2, int *r3, int *g3, int *b3, int *a3);
508
509/** Set the colors for the given color class.
510 *
511 * If you set a color to -1 it will not be touched.
512 *
513 * @param obj Object being edited.
514 * @param class_name Color class to fetch values.
515 * @param r Red component of main color.
516 * @param g Green component of main color.
517 * @param b Blue component of main color.
518 * @param a Alpha component of main color.
519 * @param r2 Red component of secondary color.
520 * @param g2 Green component of secondary color.
521 * @param b2 Blue component of secondary color.
522 * @param a2 Alpha component of secondary color.
523 * @param r3 Red component of tertiary color.
524 * @param g3 Green component of tertiary color.
525 * @param b3 Blue component of tertiary color.
526 * @param a3 Alpha component of tertiary color.
527 *
528 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
529 */
530EAPI Eina_Bool edje_edit_color_class_colors_set(Evas_Object *obj, const char *class_name, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3);
531
532/** Change the name of a color class.
533 *
534 * @param obj Object being edited.
535 * @param name Color class to rename.
536 * @param newname New name for the color class.
537 *
538 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
539 */
540EAPI Eina_Bool edje_edit_color_class_name_set(Evas_Object *obj, const char *name, const char *newname);
541
542//@}
543
544
545/******************************************************************************/
546/************************** TEXT STYLES *************************************/
547/******************************************************************************/
548/** @name Text styles API
549 * Functions to deal with text styles (see @ref edcref).
550 */ //@{
551
552/** Get the list of all the text styles in the given edje object.
553 *
554 * @param obj Object being edited.
555 *
556 * @return List of strings, each being the name for a text style.
557 */
558EAPI Eina_List * edje_edit_styles_list_get(Evas_Object *obj);
559
560/** Create a new text style object in the given edje.
561 *
562 * If another style with the same name exists nothing is created and EINA_FALSE is returned.
563 *
564 * @param obj Object being edited.
565 * @param style Name for the new style.
566 *
567 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
568 */
569EAPI Eina_Bool edje_edit_style_add(Evas_Object *obj, const char *style);
570
571/** Delete the given text style and all the child tags.
572 *
573 * @param obj Object being edited.
574 * @param style Style to delete.
575 */
576EAPI void edje_edit_style_del(Evas_Object *obj, const char *style);
577
578/** Get the list of all the tags name in the given text style.
579 *
580 * @param obj Object being edited.
581 * @param style Style to get the tags for.
582 *
583 * @return List of strings, each being one tag in the given style.
584 */
585EAPI Eina_List * edje_edit_style_tags_list_get(Evas_Object *obj, const char *style);
586
587/** Get the value of the given tag.
588 *
589 * @param obj Object being edited.
590 * @param style Style containing the tag being.
591 * @param tag Tag to get the value for.
592 *
593 * @return Value of the given tag.
594 */
595EAPI const char * edje_edit_style_tag_value_get(Evas_Object *obj, const char *style, const char *tag);
596
597/** Set the value of the given tag.
598 *
599 * @param obj Object being edited.
600 * @param style Style containing the tag to change.
601 * @param tag Name of the tag to set the value for.
602 * @param new_value Value for the tag.
603 */
604EAPI void edje_edit_style_tag_value_set(Evas_Object *obj, const char *style, const char *tag, const char *new_value);
605
606/** Set the name of the given tag.
607 *
608 * @param obj Object being edited.
609 * @param style Style containing the tag to rename.
610 * @param tag Tag to rename.
611 * @param new_name New name for the tag.
612 */
613EAPI void edje_edit_style_tag_name_set(Evas_Object *obj, const char *style, const char *tag, const char *new_name);
614
615/** Add a new tag to the given text style.
616 *
617 * If another tag with the same name exists nothing is created and EINA_FALSE is returned.
618 *
619 * @param obj Object being edited.
620 * @param style Style where to add the new tag.
621 * @param tag_name Name for the new tag.
622 *
623 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
624 */
625EAPI Eina_Bool edje_edit_style_tag_add(Evas_Object *obj, const char *style, const char *tag_name);
626
627/** Delete the given tag.
628 *
629 * @param obj Object being edited.
630 * @param style Style from where to remove the tag.
631 * @param tag Tag to delete.
632 */
633EAPI void edje_edit_style_tag_del(Evas_Object *obj, const char *style, const char *tag);
634
635
636//@}
637/******************************************************************************/
638/************************ EXTERNALS API ***********************************/
639/******************************************************************************/
640/** @name Externals API
641 * Functions to deal with list of external modules (see @ref edcref).
642 */ //@{
643
644/** Get the list of all the externals requested in the given edje object.
645 *
646 * @param obj Object being edited.
647 *
648 * @return List of strings, each being an entry in the block of automatically loaded external modules.
649 */
650EAPI Eina_List * edje_edit_externals_list_get(Evas_Object *obj);
651
652/** Add an external module to be requested on edje load.
653 *
654 * @param obj Object being edited.
655 * @param external Name of the external module to add to the list of autoload.
656 *
657 * @return EINA_TRUE on success (or it was already there), EINA_FALSE otherwise.
658 */
659EAPI Eina_Bool edje_edit_external_add(Evas_Object *obj, const char *external);
660
661/** Delete the given external from the list.
662 *
663 * @param obj Object being edited.
664 * @param external Name of the external module to remove from the autoload list.
665 *
666 * @return EINA_TRUE on success, EINA_FALSE otherwise.
667 */
668EAPI Eina_Bool edje_edit_external_del(Evas_Object *obj, const char *external);
669
670
671//@}
672/******************************************************************************/
673/************************** PARTS API *************************************/
674/******************************************************************************/
675/** @name Parts API
676 * Functions to deal with part objects (see @ref edcref).
677 */ //@{
678
679/** Get the list of all the parts in the given edje object.
680 *
681 * @param obj Object being edited.
682 *
683 * @return List of strings, each being the name for a part in the open group.
684 */
685EAPI Eina_List * edje_edit_parts_list_get(Evas_Object *obj);
686
687/** Create a new part in the given edje.
688 *
689 * If another part with the same name just exists nothing is created and EINA_FALSE is returned.
690 * Note that this function also create a default description for the part.
691 *
692 * @param obj Object being edited.
693 * @param name Name for the new part.
694 * @param type Type of the new part. See @ref edcref for more info on this.
695 *
696 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
697 */
698EAPI Eina_Bool edje_edit_part_add(Evas_Object *obj, const char *name, Edje_Part_Type type);
699
700/** Create a new part of type EXTERNAL in the given edje.
701 *
702 * If another part with the same name just exists nothing is created and EINA_FALSE is returned.
703 * Note that this function also create a default description for the part.
704 *
705 * @param obj Object being edited.
706 * @param name Name for the new part.
707 * @param source The registered external type to use for this part.
708 *
709 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
710 */
711EAPI Eina_Bool edje_edit_part_external_add(Evas_Object *obj, const char *name, const char *source);
712
713/** Delete the given part from the edje.
714 *
715 * All the reference to this part will be zeroed.
716 *
717 * @param obj Object being edited.
718 * @param part Name of part to delete.
719 *
720 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
721 */
722EAPI Eina_Bool edje_edit_part_del(Evas_Object *obj, const char *part);
723
724/** Check if a part with the given name exist in the edje object.
725 *
726 * @param obj Object being edited.
727 * @param part Name of part to check for its existence.
728 *
729 * @return EINA_TRUE if the part exists, EINA_FALSE if not.
730 */
731EAPI Eina_Bool edje_edit_part_exist(Evas_Object *obj, const char *part);
732
733/** Get the name of part stacked above the one passed.
734 *
735 * @param obj Object being edited.
736 * @param part Name of part of which to check the one above.
737 *
738 * @return Name of the part above. NULL if an error occurred or if @p part is
739 * the topmost part in the group.
740 */
741EAPI const char * edje_edit_part_above_get(Evas_Object *obj, const char *part);
742
743/** Get the name of part stacked below the one passed.
744 *
745 * @param obj Object being edited.
746 * @param part Name of part of which to check the one below.
747 *
748 * @return Name of the part below. NULL if an error occurred or if @p part is
749 * the bottommost part in the group.
750 */
751EAPI const char * edje_edit_part_below_get(Evas_Object *obj, const char *part);
752
753/** Move the given part below the previous one.
754 *
755 * @param obj Object being edited.
756 * @param part Name of part to move one step below.
757 *
758 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
759 */
760EAPI Eina_Bool edje_edit_part_restack_below(Evas_Object *obj, const char *part);
761
762/** Move the given part above the next one.
763 *
764 * @param obj Object being edited.
765 * @param part Name of part to move one step above.
766 *
767 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
768 */
769EAPI Eina_Bool edje_edit_part_restack_above(Evas_Object *obj, const char *part);
770
771/** Set a new name for part.
772 *
773 * Note that the relative getter function don't exist as it don't make sense ;)
774 *
775 * @param obj Object being edited.
776 * @param part Name of part to rename.
777 * @param new_name New name for the given part.
778 *
779 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
780 */
781EAPI Eina_Bool edje_edit_part_name_set(Evas_Object *obj, const char *part, const char *new_name);
782
783/** Get api's name of a part.
784 *
785 * @param obj Object being edited.
786 * @param part Name of the part.
787 *
788 * @return name of the api if successful, NULL otherwise.
789 */
790EAPI const char * edje_edit_part_api_name_get(Evas_Object *obj, const char *part);
791
792/** Get api's description of a part.
793 *
794 * @param obj Object being edited.
795 * @param part Name of the part.
796 *
797 * @return description of the api if successful, NULL otherwise.
798 */
799EAPI const char * edje_edit_part_api_description_get(Evas_Object *obj, const char *part);
800
801/** Set api's name of a part.
802 *
803 * @param obj Object being edited.
804 * @param part Name of the part.
805 * @param name New name for the api property.
806 *
807 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
808 */
809EAPI Eina_Bool edje_edit_part_api_name_set(Evas_Object *obj, const char *part, const char *name);
810
811/** Set api's description of a part.
812 *
813 * @param obj Object being edited.
814 * @param part Name of part.
815 * @param description New description for the api property.
816 *
817 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
818 */
819EAPI Eina_Bool edje_edit_part_api_description_set(Evas_Object *obj, const char *part, const char *description);
820
821/** Get the type of a part.
822 *
823 * @param obj Object being edited.
824 * @param part Name of part to get the type of.
825 *
826 * @return Type of the part. See @ref edcref for details.
827 */
828EAPI Edje_Part_Type edje_edit_part_type_get(Evas_Object *obj, const char *part);
829
830/** Get the clip_to part.
831 *
832 * @param obj Object being edited.
833 * @param part Name of the part whose clipper to get.
834 *
835 * @return Name of the part @p part is clipped to. NULL is returned on errors and if the part don't have a clip.
836 */
837EAPI const char * edje_edit_part_clip_to_get(Evas_Object *obj, const char *part);
838
839/** Set a part to clip part to.
840 *
841 * @param obj Object being edited.
842 * @param part Part to set the clipper to.
843 * @param clip_to Part to use as clipper, if NULL then the clipping value will be cancelled (unset clipping).
844 *
845 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
846 */
847EAPI Eina_Bool edje_edit_part_clip_to_set(Evas_Object *obj, const char *part, const char *clip_to);
848
849/** Get the source of part.
850 *
851 * The meaning of this parameter varies depending on the type of the part.
852 * For GROUP parts, it's the name of another group in the Edje file which will
853 * be autoloaded and swallowed on this part.
854 * For TEXTBLOCK parts, it's the name of a group to be used for selection
855 * display under the text.
856 * For EXTERNAL parts, it's the name of the registered external widget to load
857 * and swallow on this part.
858 *
859 * @param obj Object being edited.
860 * @param part Part to get the source from.
861 *
862 * @return Content of the source parameter or NULL if nothing set or an error occurred.
863 */
864EAPI const char * edje_edit_part_source_get(Evas_Object *obj, const char *part);
865
866/** Set the source of part.
867 *
868 * @param obj Object being edited.
869 * @param part Part to set the source of.
870 * @param source Value for the source parameter.
871 *
872 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
873 *
874 * @see edje_edit_part_source_get()
875 *
876 * @note You can't change the source for EXTERNAL parts, it's akin to changing
877 * the type of the part.
878 *
879 * NOTE: This is not applied now. You must reload the edje to see the change.
880 */
881EAPI Eina_Bool edje_edit_part_source_set(Evas_Object *obj, const char *part, const char *source);
882
883/** Get the effect for a given part.
884 *
885 * Gets the effect used for parts of type TEXT. See @ref edcref for more details.
886 *
887 * @param obj Object being edited.
888 * @param part Part to get the effect of.
889 *
890 * @return The effect set for the part.
891 */
892EAPI Edje_Text_Effect edje_edit_part_effect_get(Evas_Object *obj, const char *part);
893
894/** Set the effect for a given part.
895 *
896 * @param obj Object being edited.
897 * @param part Part to set the effect to. Only makes sense on type TEXT.
898 * @param effect Effect to set for the part.
899 */
900EAPI void edje_edit_part_effect_set(Evas_Object *obj, const char *part, Edje_Text_Effect effect);
901
902/** Get the current selected state in part.
903 *
904 * @param obj Object being edited.
905 * @param part Part to get the selected state of.
906 * @param value Pointer to a double where the value of the state will be stored.
907 *
908 * @return The name of the currently selected state for the part.
909 */
910EAPI const char * edje_edit_part_selected_state_get(Evas_Object *obj, const char *part, double *value);
911
912/** Set the current state in part.
913 *
914 * @param obj Object being edited.
915 * @param part Part to set the state of.
916 * @param state Name of the state to set.
917 * @param value Value of the state.
918 *
919 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
920 */
921EAPI Eina_Bool edje_edit_part_selected_state_set(Evas_Object *obj, const char *part, const char *state, double value);
922
923/** Get mouse_events for part.
924 *
925 * @param obj Object being edited.
926 * @param part Part to get if the mouse events is accepted.
927 *
928 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
929 */
930EAPI Eina_Bool edje_edit_part_mouse_events_get(Evas_Object *obj, const char *part);
931
932/** Set mouse_events for part.
933 *
934 * @param obj Object being edited.
935 * @param part The part to set if the mouse events is accepted.
936 * @param mouse_events EINA_TRUE if part will accept mouse events, EINA_FALSE otherwise.
937 */
938EAPI void edje_edit_part_mouse_events_set(Evas_Object *obj, const char *part, Eina_Bool mouse_events);
939
940/** Get repeat_events for part.
941 *
942 * @param obj Object being edited.
943 * @param part Part to set if will pass all events to the other parts.
944 *
945 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
946 */
947EAPI Eina_Bool edje_edit_part_repeat_events_get(Evas_Object *obj, const char *part);
948
949/** Set repeat_events for part.
950 *
951 * @param obj Object being edited.
952 * @param part Part to set if will repeat all the received mouse events to other parts.
953 * @param repeat_events EINA_TRUE if the events received will propagate to other parts, EINA_FALSE otherwise
954 */
955EAPI void edje_edit_part_repeat_events_set(Evas_Object *obj, const char *part, Eina_Bool repeat_events);
956
957/** Get ignore_flags for part.
958 *
959 * @param obj Object being edited.
960 * @param part Part to get which event_flags are being ignored.
961 *
962 * @return The Event flags set to the part.
963 */
964EAPI Evas_Event_Flags edje_edit_part_ignore_flags_get(Evas_Object *obj, const char *part);
965
966/** Set ignore_flags for part.
967 *
968 * @param obj Object being edited.
969 * @param part Part to set which event flags will be ignored.
970 * @param ignore_flags The Event flags to be ignored by the part.
971 */
972EAPI void edje_edit_part_ignore_flags_set(Evas_Object *obj, const char *part, Evas_Event_Flags ignore_flags);
973
974/** Set scale property for the part.
975 *
976 * This property tells Edje that the given part should be scaled by the
977 * Edje scale factor.
978 *
979 * @param obj Object being edited.
980 * @param part Part to set scale for.
981 * @param scale Scale value to set.
982 */
983EAPI void edje_edit_part_scale_set(Evas_Object *obj, const char *part, Eina_Bool scale);
984
985/** Get scale for the part.
986 *
987 * @param obj Object being edited.
988 * @param part Part to get the scale value of.
989 *
990 * @return Whether scale is on (EINA_TRUE) or not.
991 */
992EAPI Eina_Bool edje_edit_part_scale_get(Evas_Object *obj, const char *part);
993
994/** Get horizontal dragable state for part.
995 *
996 * @param obj Object being edited.
997 * @param part Part to get if can be dragged horizontally;
998 *
999 * @return 1 (or -1) if the part can be dragged horizontally, 0 otherwise.
1000 */
1001EAPI int edje_edit_part_drag_x_get(Evas_Object *obj, const char *part);
1002
1003/** Set horizontal dragable state for part.
1004 *
1005 * @param obj Object being edited.
1006 * @param part Part to set if should be dragged horizontally.
1007 * @param drag 1 (or -1) if the part should be dragged horizontally, 0 otherwise.
1008 */
1009EAPI void edje_edit_part_drag_x_set(Evas_Object *obj, const char *part, int drag);
1010
1011/** Get vertical dragable state for part.
1012 *
1013 * @param obj Object being edited.
1014 * @param part Part to get if can be dragged vertically.
1015 *
1016 * @return 1 (or - 1) if the part can be dragged vertically, 0 otherwise.
1017 */
1018EAPI int edje_edit_part_drag_y_get(Evas_Object *obj, const char *part);
1019
1020/** Set vertical dragable state for part.
1021 *
1022 * @param obj Object being edited.
1023 * @param part Part to set if should be dragged vertically.
1024 * @param drag 1 (or -1) of the part shpuld be dragged vertically, 0 otherwise.
1025 */
1026EAPI void edje_edit_part_drag_y_set(Evas_Object *obj, const char *part, int drag);
1027
1028/** Get horizontal dragable step for part.
1029 *
1030 * @param obj Object being edited.
1031 * @param part Part to get the drag horizontal step value.
1032 *
1033 * @return The step value.
1034 */
1035EAPI int edje_edit_part_drag_step_x_get(Evas_Object *obj, const char *part);
1036
1037/** Set horizontal dragable state for part.
1038 *
1039 * @param obj Object being edited.
1040 * @param part Part to set the drag horizontal step value.
1041 * @param step The step the will be dragged.
1042 */
1043EAPI void edje_edit_part_drag_step_x_set(Evas_Object *obj, const char *part, int step);
1044
1045/** Get vertical dragable step for part.
1046 *
1047 * @param obj Object being edited.
1048 * @param part Part to get the drag vertical step value.
1049 *
1050 * @return The step value.
1051 */
1052EAPI int edje_edit_part_drag_step_y_get(Evas_Object *obj, const char *part);
1053
1054/** Set vertical dragable state for part.
1055 *
1056 * @param obj Object being edited.
1057 * @param part Part to set the drag vertical step value.
1058 * @param step The step the will be dragged.
1059 */
1060EAPI void edje_edit_part_drag_step_y_set(Evas_Object *obj, const char *part, int step);
1061
1062/** Get horizontal dragable count for part.
1063 *
1064 * @param obj Object being edited.
1065 * @param part Part to get the drag horizontal count value.
1066 */
1067EAPI int edje_edit_part_drag_count_x_get(Evas_Object *obj, const char *part);
1068
1069/** Set horizontal dragable count for part.
1070 *
1071 * @param obj Object being edited.
1072 * @param part Part to set the drag horizontal count value.
1073 * @param count The count value.
1074 */
1075EAPI void edje_edit_part_drag_count_x_set(Evas_Object *obj, const char *part, int count);
1076
1077/** Get vertical dragable count for part.
1078 *
1079 * @param obj Object being edited.
1080 * @param part Part to get the drag vertical count value.
1081 */
1082EAPI int edje_edit_part_drag_count_y_get(Evas_Object *obj, const char *part);
1083
1084/** Set vertical dragable count for part.
1085 *
1086 * @param obj Object being edited.
1087 * @param part Part to set the drag vertical count value.
1088 * @param count The count value.
1089 */
1090EAPI void edje_edit_part_drag_count_y_set(Evas_Object *obj, const char *part, int count);
1091
1092/** Get the name of the part that is used as 'confine' for the given draggies.
1093 *
1094 * @param obj Object being edited.
1095 * @param part Part to get the name that is used as 'confine' for the given draggies.
1096 *
1097 * @return The name of the confine part or NULL (if unset).
1098 */
1099EAPI const char * edje_edit_part_drag_confine_get(Evas_Object *obj, const char *part);
1100
1101/** Set the name of the part that is used as 'confine' for the given draggies.
1102 *
1103 * @param obj Object being edited.
1104 * @param part Part to set the name that is used as 'confine' for the given draggies.
1105 * @param confine The name of the confine part or NULL to unset confine.
1106 */
1107EAPI void edje_edit_part_drag_confine_set(Evas_Object *obj, const char *part, const char *confine);
1108
1109/** Get the name of the part that is used as the receiver of the drag event.
1110 *
1111 * @param obj Object being edited.
1112 * @param part Part to get the name that is used as the receiver of the drag event.
1113 *
1114 * @return The name of the part that will receive events, or NULL (if unset).
1115 */
1116EAPI const char * edje_edit_part_drag_event_get(Evas_Object *obj, const char *part);
1117
1118/** Set the name of the part that will receive events from the given draggies.
1119 *
1120 * @param obj Object being edited.
1121 * @param part Part to set the name that will receive events from the given draggies.
1122 * @param event The name of the part that will receive events, or NULL to unset.
1123 */
1124EAPI void edje_edit_part_drag_event_set(Evas_Object *obj, const char *part, const char *event);
1125
1126
1127//@}
1128/******************************************************************************/
1129/************************** STATES API ************************************/
1130/******************************************************************************/
1131/** @name States API
1132 * Functions to deal with part states (see @ref edcref).
1133 */ //@{
1134
1135/** Get the list of all the states in the given part.
1136 *
1137 * @param obj Object being edited.
1138 * @param part Part to get the states names list.
1139 *
1140 * @return An Eina_List* of string (char *)containing all the states names found
1141 * in part, including the float value (ex: "default 0.00").
1142 *
1143 * Use edje_edit_string_list_free() when you don't need it anymore.
1144 */
1145EAPI Eina_List * edje_edit_part_states_list_get(Evas_Object *obj, const char *part);
1146
1147/** Set a new name for the given state in the given part.
1148 *
1149 * @param obj Object being edited.
1150 * @param part Part that contain state.
1151 * @param state Name of the state to rename.
1152 * @param value Value of the state to rename.
1153 * @param new_name The new name for the state.
1154 * @param new_value The new value for the state.
1155 *
1156 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
1157 */
1158EAPI Eina_Bool edje_edit_state_name_set(Evas_Object *obj, const char *part, const char *state, double value, const char *new_name, double new_value);
1159
1160/** Create a new state to the give part.
1161 *
1162 * @param obj Object being edited.
1163 * @param part Part to set the name of the new state.
1164 * @param name Name for the new state (not including the state value).
1165 * @param value The state value.
1166 *
1167 * @return EINA_TRUE if successfully, EINA_FALSE otherwise.
1168 */
1169EAPI Eina_Bool edje_edit_state_add(Evas_Object *obj, const char *part, const char *name, double value);
1170
1171/** Delete the given part state from the edje.
1172 *
1173 * @param obj Object being edited.
1174 * @param part Part that contain state.
1175 * @param state The current name of the state (not including the state value).
1176 * @param value The state value.
1177 *
1178 * @return EINA_TRUE if successfully, EINA_FALSE otherwise.
1179 */
1180EAPI Eina_Bool edje_edit_state_del(Evas_Object *obj, const char *part, const char *state, double value);
1181
1182/** Check if a part state with the given name exist.
1183 *
1184 * @param obj Object being edited.
1185 * @param part Part that contain state.
1186 * @param state The name of the state to check (not including the state value).
1187 * @param value The state value.
1188 *
1189 * @return EINA_TRUE if the part state exist, EINA_FALSE otherwise.
1190 */
1191EAPI Eina_Bool edje_edit_state_exist(Evas_Object *obj, const char *part, const char *state, double value);
1192
1193/** Copies the state @p from into @p to. If @p to doesn't exist it will be created.
1194 *
1195 * @param obj Object being edited.
1196 * @param part Part that contain state.
1197 * @param from State to copy from (not including state value).
1198 * @param val_from The value of the state to copy from.
1199 * @param to State to copy into (not including state value).
1200 * @param val_to The value of the state to copy into.
1201 *
1202 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
1203 */
1204EAPI Eina_Bool edje_edit_state_copy(Evas_Object *obj, const char *part, const char *from, double val_from, const char *to, double val_to);
1205
1206/** Get the 'rel1 relative X' value of state.
1207 *
1208 * @param obj Object being edited.
1209 * @param part Part that contain state.
1210 * @param state The name of the state to get 'rel1 relative X' (not including the state value).
1211 * @param value The state value.
1212 *
1213 * @return The 'rel1 relative X' value of the part state.
1214 */
1215EAPI double edje_edit_state_rel1_relative_x_get(Evas_Object *obj, const char *part, const char *state, double value);
1216
1217/** Get the 'rel1 relative Y' value of state.
1218 *
1219 * @param obj Object being edited.
1220 * @param part Part that contain state.
1221 * @param state The name of the state to get 'rel1 relative Y' (not including the state value).
1222 * @param value The state value.
1223 *
1224 * @return The 'rel1 relative Y' value of the part state.
1225 */
1226EAPI double edje_edit_state_rel1_relative_y_get(Evas_Object *obj, const char *part, const char *state, double value);
1227
1228/** Get the 'rel2 relative X' value of state.
1229 *
1230 * @param obj Object being edited.
1231 * @param part Part that contain state.
1232 * @param state The name of the state to get 'rel2 relative X' (not including the state value).
1233 * @param value The state value.
1234 *
1235 * @return The 'rel2 relative X' value of the part state.
1236 */
1237EAPI double edje_edit_state_rel2_relative_x_get(Evas_Object *obj, const char *part, const char *state, double value);
1238
1239/** Get the 'rel2 relative Y' value of state.
1240 *
1241 * @param obj Object being edited.
1242 * @param part Part that contain state.
1243 * @param state The name of the state to get 'rel2 relative Y' (not including the state value).
1244 * @param value The state value.
1245 *
1246 * @return The 'rel2 relative Y' value of the part state.
1247 */
1248EAPI double edje_edit_state_rel2_relative_y_get(Evas_Object *obj, const char *part, const char *state, double value);
1249
1250/** Set the 'rel1 relative X' value of state.
1251 *
1252 * @param obj Object being edited.
1253 * @param part Part that contain state.
1254 * @param state The name of the state to set 'rel1 relative X' (not including the state value).
1255 * @param value The state value.
1256 * @param x The new 'rel1 relative X' value to set'.
1257 */
1258EAPI void edje_edit_state_rel1_relative_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x);
1259
1260/** Set the 'rel1 relative Y' value of state.
1261 *
1262 * @param obj Object being edited.
1263 * @param part Part that contain state.
1264 * @param state The name of the state to set 'rel1 relative Y' (not including the state value).
1265 * @param value The state value.
1266 * @param y The new 'rel1 relative Y' value to set'.
1267 */
1268EAPI void edje_edit_state_rel1_relative_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y);
1269
1270/** Set the 'rel2 relative X' value of state.
1271 *
1272 * @param obj Object being edited.
1273 * @param part Part that contain state.
1274 * @param state The name of the state to set 'rel2 relative X' (not including the state value).
1275 * @param value The state value.
1276 * @param x The new 'rel2 relative X' value to set'.
1277 */
1278EAPI void edje_edit_state_rel2_relative_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x);
1279
1280/** Set the 'rel2 relative Y' value of state.
1281 *
1282 * @param obj Object being edited.
1283 * @param part Part that contain state.
1284 * @param state The name of the state to set 'rel2 relative Y' (not including the state value).
1285 * @param value The state value.
1286 * @param y The new 'rel2 relative Y' value to set'.
1287 */
1288EAPI void edje_edit_state_rel2_relative_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y);
1289
1290/** Get the 'rel1 offset X' value of state.
1291 *
1292 * @param obj Object being edited.
1293 * @param part Part that contain state.
1294 * @param state The name of the state to get 'rel1 offset X' (not including the state value).
1295 * @param value The state value.
1296 *
1297 * @return The 'rel1 offset X' value of the part state.
1298 */
1299EAPI int edje_edit_state_rel1_offset_x_get(Evas_Object *obj, const char *part, const char *state, double value);
1300
1301/** Get the 'rel1 offset Y' value of state.
1302 *
1303 * @param obj Object being edited.
1304 * @param part Part that contain state.
1305 * @param state The name of the state to get 'rel1 offset Y' (not including the state value).
1306 * @param value The state value.
1307 *
1308 * @return The 'rel1 offset Y' value of the part state.
1309 */
1310EAPI int edje_edit_state_rel1_offset_y_get(Evas_Object *obj, const char *part, const char *state, double value);
1311
1312/** Get the 'rel2 offset X' value of state.
1313 *
1314 * @param obj Object being edited.
1315 * @param part Part that contain state.
1316 * @param state The name of the state to get 'rel2 offset X' (not including the state value).
1317 * @param value The state value.
1318 *
1319 * @return The 'rel2 offset X' value of the part state.
1320 */
1321EAPI int edje_edit_state_rel2_offset_x_get(Evas_Object *obj, const char *part, const char *state, double value);
1322
1323/** Get the 'rel2 offset Y' value of state.
1324 *
1325 * @param obj Object being edited.
1326 * @param part Part that contain state.
1327 * @param state The name of the state to get 'rel2 offset Y' (not including the state value).
1328 * @param value The state value.
1329 *
1330 * @return The 'rel2 offset Y' value of the part state.
1331 */
1332EAPI int edje_edit_state_rel2_offset_y_get(Evas_Object *obj, const char *part, const char *state, double value);
1333
1334/** Set the 'rel1 offset X' value of state.
1335 *
1336 * @param obj Object being edited.
1337 * @param part Part that contain state.
1338 * @param state The name of the state to set 'rel1 offset X' (not including the state value).
1339 * @param value The state value.
1340 * @param x The new 'rel1 offset X' value to set'.
1341 */
1342EAPI void edje_edit_state_rel1_offset_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x);
1343
1344/** Set the 'rel1 offset Y' value of state.
1345 *
1346 * @param obj Object being edited.
1347 * @param part Part that contain state.
1348 * @param state The name of the state to set 'rel1 offset Y' (not including the state value).
1349 * @param value The state value.
1350 * @param y The new 'rel1 offset Y' value to set'.
1351 */
1352EAPI void edje_edit_state_rel1_offset_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y);
1353
1354/** Set the 'rel2 offset X' value of state.
1355 *
1356 * @param obj Object being edited.
1357 * @param part Part that contain state.
1358 * @param state The name of the state to set 'rel2 offset X' (not including the state value).
1359 * @param value The state value.
1360 * @param x The new 'rel2 offset X' value to set'.
1361 */
1362EAPI void edje_edit_state_rel2_offset_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x);
1363
1364/** Set the 'rel2 offset Y' value of state.
1365 *
1366 * @param obj Object being edited.
1367 * @param part Part that contain state.
1368 * @param state The name of the state to set 'rel2 offset Y' (not including the state value).
1369 * @param value The state value.
1370 * @param y The new 'rel2 offset Y' value to set'.
1371 */
1372EAPI void edje_edit_state_rel2_offset_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y);
1373
1374/** Get the part name rel1x is relative to.
1375 *
1376 * @param obj Object being edited.
1377 * @param part Part that contain state.
1378 * @param state The state that contain which the part name rel1x is relative to (not including the state value).
1379 * @param value The state value.
1380 *
1381 * @return The part name rel1x is relative to or NULL if the part is relative to the whole interface.
1382 */
1383EAPI const char * edje_edit_state_rel1_to_x_get(Evas_Object *obj, const char *part, const char *state, double value);
1384
1385/** Get the part name rel1y is relative to.
1386 *
1387 * @param obj Object being edited.
1388 * @param part Part that contain state.
1389 * @param state The state that contain which the part name rel1y is relative to (not including the state value).
1390 * @param value The state value.
1391 *
1392 * @return The part name rel1y is relative to or NULL if the part is relative to the whole interface.
1393 */
1394EAPI const char * edje_edit_state_rel1_to_y_get(Evas_Object *obj, const char *part, const char *state, double value);
1395
1396/** Get the part name rel2x is relative to.
1397 *
1398 * @param obj Object being edited.
1399 * @param part Part that contain state.
1400 * @param state The state that contain which the part name rel2x is relative to (not including the state value).
1401 * @param value The state value.
1402 *
1403 * @return The part name rel2x is relative to or NULL if the part is relative to the whole interface.
1404 */
1405EAPI const char * edje_edit_state_rel2_to_x_get(Evas_Object *obj, const char *part, const char *state, double value);
1406
1407/** Get the part name rel2y is relative to.
1408 *
1409 * @param obj Object being edited.
1410 * @param part Part that contain state.
1411 * @param state The state that contain which the part name rel2y is relative to (not including the state value).
1412 * @param value The state value.
1413 *
1414 * @return The part name rel2y is relative to or NULL if the part is relative to the whole interface.
1415 */
1416EAPI const char * edje_edit_state_rel2_to_y_get(Evas_Object *obj, const char *part, const char *state, double value);
1417
1418/** Set the part rel1x is relative to.
1419 *
1420 * @param obj Object being edited.
1421 * @param part Part that contain state.
1422 * @param state The name of the state to set rel1x is relative to (not including the state value).
1423 * @param value The state value.
1424 * @param rel_to The name of the part that is used as container/parent (NULL make the part relative to the whole interface).
1425 *
1426 * @return The part name rel1x is relative to or NULL if the part is relative to the whole interface.
1427 */
1428EAPI void edje_edit_state_rel1_to_x_set(Evas_Object *obj, const char *part, const char *state, double value, const char *rel_to);
1429
1430/** Set the part rel1y is relative to.
1431 *
1432 * @param obj Object being edited.
1433 * @param part Part that contain state.
1434 * @param state The name of the state to set rel1y is relative to (not including the state value).
1435 * @param value The state value.
1436 * @param rel_to The name of the part that is used as container/parent (NULL make the part relative to the whole interface).
1437 *
1438 * @return The part name rel1y is relative to or NULL if the part is relative to the whole interface.
1439 */
1440EAPI void edje_edit_state_rel1_to_y_set(Evas_Object *obj, const char *part, const char *state, double value, const char *rel_to);
1441
1442/** Set the part rel2x is relative to.
1443 *
1444 * @param obj Object being edited.
1445 * @param part Part that contain state.
1446 * @param state The name of the state to set rel2x is relative to (not including the state value).
1447 * @param value The state value.
1448 * @param rel_to The name of the part that is used as container/parent (NULL make the part relative to the whole interface).
1449 *
1450 * @return The part name rel2x is relative to or NULL if the part is relative to the whole interface.
1451 */
1452EAPI void edje_edit_state_rel2_to_x_set(Evas_Object *obj, const char *part, const char *state, double value, const char *rel_to);
1453
1454/** Set the part rel2y is relative to.
1455 *
1456 * @param obj Object being edited.
1457 * @param part Part that contain state.
1458 * @param state The name of the state to set rel2y is relative to (not including the state value).
1459 * @param value The state value.
1460 * @param rel_to The name of the part that is used as container/parent (NULL make the part relative to the whole interface).
1461 *
1462 * @return The part name rel2y is relative to or NULL if the part is relative to the whole interface.
1463 */
1464EAPI void edje_edit_state_rel2_to_y_set(Evas_Object *obj, const char *part, const char *state, double value, const char *rel_to);
1465
1466/** Get the color of a part state.
1467 *
1468 * @param obj Object being edited.
1469 * @param part Part that contain state.
1470 * @param state The name of the state to get color (not including the state value).
1471 * @param value The state value.
1472 * @param r A pointer to store the red value.
1473 * @param g A pointer to store the green value.
1474 * @param b A pointer to store the blue value.
1475 * @param a A pointer to store the alpha value.
1476 */
1477EAPI void edje_edit_state_color_get(Evas_Object *obj, const char *part, const char *state, double value, int *r, int *g, int *b, int *a);
1478
1479/** Get the color2 of a part state.
1480 *
1481 * @param obj Object being edited.
1482 * @param part Part that contain state.
1483 * @param state The name of the state to get color (not including the state value).
1484 * @param value The state value.
1485 * @param r A pointer to store the red value.
1486 * @param g A pointer to store the green value.
1487 * @param b A pointer to store the blue value.
1488 * @param a A pointer to store the alpha value.
1489 */
1490EAPI void edje_edit_state_color2_get(Evas_Object *obj, const char *part, const char *state, double value, int *r, int *g, int *b, int *a);
1491
1492/** Get the color3 of a part state.
1493 *
1494 * @param obj Object being edited.
1495 * @param part Part that contain state.
1496 * @param state The name of the state to get color (not including the state value).
1497 * @param value The state value.
1498 * @param r A pointer to store the red value.
1499 * @param g A pointer to store the green value.
1500 * @param b A pointer to store the blue value.
1501 * @param a A pointer to store the alpha value.
1502 */
1503EAPI void edje_edit_state_color3_get(Evas_Object *obj, const char *part, const char *state, double value, int *r, int *g, int *b, int *a);
1504
1505/** Set the color of a part state.
1506 *
1507 * @param obj Object being edited.
1508 * @param part Part that contain state.
1509 * @param state The name of the state to set color (not including the state value).
1510 * @param value The state value.
1511 * @param r The red value of the color.
1512 * @param g The green value of the color.
1513 * @param b The blue value of the color.
1514 * @param a The alpha value of the color.
1515 */
1516EAPI void edje_edit_state_color_set(Evas_Object *obj, const char *part, const char *state, double value, int r, int g, int b, int a);
1517
1518/** Set the color2 of a part state.
1519 *
1520 * @param obj Object being edited.
1521 * @param part Part that contain state.
1522 * @param state The name of the state to set color (not including the state value).
1523 * @param value The state value.
1524 * @param r The red value of the color.
1525 * @param g The green value of the color.
1526 * @param b The blue value of the color.
1527 * @param a The alpha value of the color.
1528 */
1529EAPI void edje_edit_state_color2_set(Evas_Object *obj, const char *part, const char *state, double value, int r, int g, int b, int a);
1530
1531/** Set the color3 of a part state.
1532 *
1533 * @param obj Object being edited.
1534 * @param part Part that contain state.
1535 * @param state The name of the state to set color (not including the state value).
1536 * @param value The state value.
1537 * @param r The red value of the color.
1538 * @param g The green value of the color.
1539 * @param b The blue value of the color.
1540 * @param a The alpha value of the color.
1541 */
1542EAPI void edje_edit_state_color3_set(Evas_Object *obj, const char *part, const char *state, double value, int r, int g, int b, int a);
1543
1544/** Get the horizontal align value of a part state.
1545 *
1546 * @param obj Object being edited.
1547 * @param part Part that contain state.
1548 * @param state The name of the state to get horizontal align (not including the state value).
1549 * @param value The state value.
1550 *
1551 * @return The horizontal align value for the given state
1552 */
1553EAPI double edje_edit_state_align_x_get(Evas_Object *obj, const char *part, const char *state, double value);
1554
1555/** Get the vertical align value of a part state.
1556 *
1557 * @param obj Object being edited.
1558 * @param part Part that contain state.
1559 * @param state The name of the state to get horizontal align (not including the state value).
1560 * @param value The state value.
1561 *
1562 * @return The vertical align value for the given state
1563 */
1564EAPI double edje_edit_state_align_y_get(Evas_Object *obj, const char *part, const char *state, double value);
1565
1566/** Set the horizontal align value of a part state.
1567 *
1568 * @param obj Object being edited.
1569 * @param part Part that contain state.
1570 * @param state The name of the state to get horizontal align (not including the state value).
1571 * @param value The state value.
1572 * @param align The new vertical align value.
1573 */
1574EAPI void edje_edit_state_align_x_set(Evas_Object *obj, const char *part, const char *state, double value, double align);
1575
1576/** Set the vertical align value of a part state.
1577 *
1578 * @param obj Object being edited.
1579 * @param part Part that contain state.
1580 * @param state The name of the state to get vertical align (not including the state value).
1581 * @param value The state value.
1582 * @param align The new vertical align value.
1583 */
1584EAPI void edje_edit_state_align_y_set(Evas_Object *obj, const char *part, const char *state, double value, double align);
1585
1586/** Get the minimum width value of a part state.
1587 *
1588 * @param obj Object being edited.
1589 * @param part Part that contain state.
1590 * @param state The name of the state to get minimum width (not including the state value).
1591 * @param value The state value.
1592 *
1593 * @return The minimum width value.
1594 */
1595EAPI int edje_edit_state_min_w_get(Evas_Object *obj, const char *part, const char *state, double value);
1596
1597/** Set the minimum width value of a part state.
1598 *
1599 * @param obj Object being edited.
1600 * @param part Part that contain state.
1601 * @param state The name of the state to set minimum width (not including the state value).
1602 * @param value The state value.
1603 * @param min_w Minimum width value.
1604 */
1605EAPI void edje_edit_state_min_w_set(Evas_Object *obj, const char *part, const char *state, double value, int min_w);
1606
1607/** Get the minimum height value of a part state.
1608 *
1609 * @param obj Object being edited.
1610 * @param part Part that contain state.
1611 * @param state The name of the state to get minimum height (not including the state value).
1612 * @param value The state value.
1613 *
1614 * @return The minimum height value.
1615 */
1616EAPI int edje_edit_state_min_h_get(Evas_Object *obj, const char *part, const char *state, double value);
1617
1618/** Set the minimum height value of a part state.
1619 *
1620 * @param obj Object being edited.
1621 * @param part Part that contain state.
1622 * @param state The name of the state to set minimum height (not including the state value).
1623 * @param value The state value.
1624 * @param min_h Minimum height value.
1625 */
1626EAPI void edje_edit_state_min_h_set(Evas_Object *obj, const char *part, const char *state, double value, int min_h);
1627
1628/** Get the maximum width value of a part state.
1629 *
1630 * @param obj Object being edited.
1631 * @param part Part that contain state.
1632 * @param state The name of the state to get maximum width (not including the state value).
1633 * @param value The state value.
1634 *
1635 * @return The maximum width value.
1636 */
1637EAPI int edje_edit_state_max_w_get(Evas_Object *obj, const char *part, const char *state, double value);
1638
1639/** Set the maximum width value of a part state.
1640 *
1641 * @param obj Object being edited.
1642 * @param part Part that contain state.
1643 * @param state The name of the state to set maximum width (not including the state value).
1644 * @param value The state value.
1645 * @param max_w Maximum width value.
1646 */
1647EAPI void edje_edit_state_max_w_set(Evas_Object *obj, const char *part, const char *state, double value, int max_w);
1648
1649/** Get the maximum height value of a part state.
1650 *
1651 * @param obj Object being edited.
1652 * @param part Part that contain state.
1653 * @param state The name of the state to get maximum height (not including the state value).
1654 * @param value The state value.
1655 *
1656 * @return The maximum height value.
1657 */
1658EAPI int edje_edit_state_max_h_get(Evas_Object *obj, const char *part, const char *state, double value);
1659
1660/** Set the maximum height value of a part state.
1661 *
1662 * @param obj Object being edited.
1663 * @param part Part that contain state.
1664 * @param state The name of the state to set maximum height (not including the state value).
1665 * @param value The state value.
1666 * @param max_h Maximum height value.
1667 */
1668EAPI void edje_edit_state_max_h_set(Evas_Object *obj, const char *part, const char *state, double value, int max_h);
1669
1670/** Get the minimum aspect value of a part state.
1671 *
1672 * @param obj Object being edited.
1673 * @param part Part that contain state.
1674 * @param state The name of the state to get minimum aspect (not including the state value).
1675 * @param value The state value.
1676 *
1677 * @return The minimum aspect
1678 */
1679EAPI double edje_edit_state_aspect_min_get(Evas_Object *obj, const char *part, const char *state, double value);
1680
1681/** Get the maximum aspect value of a part state.
1682 *
1683 * @param obj Object being edited.
1684 * @param part Part that contain state.
1685 * @param state The name of the state to get maximum aspect (not including the state value).
1686 * @param value The state value.
1687 *
1688 * @return The maximum aspect
1689 */
1690EAPI double edje_edit_state_aspect_max_get(Evas_Object *obj, const char *part, const char *state, double value);
1691
1692/** Set the minimum aspect value of a part state.
1693 *
1694 * @param obj Object being edited.
1695 * @param part Part that contain state.
1696 * @param state The name of the state to set minimum aspect (not including the state value).
1697 * @param value The state value.
1698 * @param aspect Minimum aspect value.
1699 */
1700EAPI void edje_edit_state_aspect_min_set(Evas_Object *obj, const char *part, const char *state, double value, double aspect);
1701
1702/** Set the maximum aspect value of a part state.
1703 *
1704 * @param obj Object being edited.
1705 * @param part Part that contain state.
1706 * @param state The name of the state to set maximum aspect (not including the state value).
1707 * @param value The state value.
1708 * @param aspect Maximum aspect value.
1709 */
1710EAPI void edje_edit_state_aspect_max_set(Evas_Object *obj, const char *part, const char *state, double value, double aspect);
1711
1712/** Get the aspect preference of a part state.
1713 *
1714 * @param obj Object being edited.
1715 * @param part Part that contain state.
1716 * @param state The name of the state to get aspect preference (not including the state value).
1717 * @param value The state value.
1718 *
1719 * @return The aspect preference (0 = None, 1 = Vertical, 2 = Horizontal, 3 = Both)
1720 */
1721EAPI unsigned char edje_edit_state_aspect_pref_get(Evas_Object *obj, const char *part, const char *state, double value);
1722
1723/** Set the aspect preference of a part state.
1724 *
1725 * @param obj Object being edited.
1726 * @param part Part that contain state.
1727 * @param state The name of the state to set aspect preference (not
1728 * including the state value).
1729 * @param value The state value.
1730 * @param pref The aspect preference to set (0 = None, 1 = Vertical, 2
1731 * = Horizontal, 3 = Both)
1732 */
1733EAPI void edje_edit_state_aspect_pref_set(Evas_Object *obj, const char *part, const char *state, double value, unsigned char pref);
1734
1735/** Get the fill horizontal origin relative value of a part state.
1736 *
1737 * @param obj Object being edited.
1738 * @param part Part that contain state.
1739 * @param state The name of the state to get the fill horizontal origin relative to area (not including the state value).
1740 * @param value The state value.
1741 *
1742 * @return The fill horizontal origin relative to area.
1743 */
1744EAPI double edje_edit_state_fill_origin_relative_x_get(Evas_Object *obj, const char *part, const char *state, double value);
1745
1746/** Get the fill vertical origin relative value of a part state.
1747 *
1748 * @param obj Object being edited.
1749 * @param part Part that contain state.
1750 * @param state The name of the state to get fill vertical origin relative to area (not including the state value).
1751 * @param value The state value.
1752 *
1753 * @return The fill vertical origin relative to area.
1754 */
1755EAPI double edje_edit_state_fill_origin_relative_y_get(Evas_Object *obj, const char *part, const char *state, double value);
1756
1757/** Get the fill horizontal origin offset value of a part state.
1758 *
1759 * @param obj Object being edited.
1760 * @param part Part that contain state.
1761 * @param state The name of the state to get fill horizontal origin offset relative to area (not including the state value).
1762 * @param value The state value.
1763 *
1764 * @return The fill horizontal origin offset relative to area.
1765 */
1766EAPI int edje_edit_state_fill_origin_offset_x_get(Evas_Object *obj, const char *part, const char *state, double value);
1767
1768/** Get the fill vertical origin offset value of a part state.
1769 *
1770 * @param obj Object being edited.
1771 * @param part Part that contain state.
1772 * @param state The name of the state to get fill vertical origin offset relative to area (not including the state value).
1773 * @param value The state value.
1774 *
1775 * @return The fill vertical origin offset value.
1776 */
1777EAPI int edje_edit_state_fill_origin_offset_y_get(Evas_Object *obj, const char *part, const char *state, double value);
1778
1779/** Set the fill horizontal origin relative value of a part state.
1780 *
1781 * @param obj Object being edited.
1782 * @param part Part that contain state.
1783 * @param state The name of the state to set fill horizontal origin relative to area (not including the state value).
1784 * @param value The state value.
1785 * @param x The fill horizontal origin value.
1786 */
1787EAPI void edje_edit_state_fill_origin_relative_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x);
1788
1789/** Set the fill horizontal origin relative value of a part state.
1790 *
1791 * @param obj Object being edited.
1792 * @param part Part that contain state.
1793 * @param state The name of the state to set fill vertical origin relative to area (not including the state value).
1794 * @param value The state value.
1795 * @param y The fill vertical origin value.
1796 */
1797EAPI void edje_edit_state_fill_origin_relative_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y);
1798
1799/** Set the fill horizontal origin offset value of a part state.
1800 *
1801 * @param obj Object being edited.
1802 * @param part Part that contain state.
1803 * @param state The name of the state to set fill horizontal origin offset relative to area (not including the state value).
1804 * @param value The state value.
1805 * @param x The fill horizontal origin offset value.
1806 */
1807EAPI void edje_edit_state_fill_origin_offset_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x);
1808
1809/** Set the fill vertical origin offset value of a part state.
1810 *
1811 * @param obj Object being edited.
1812 * @param part Part that contain state.
1813 * @param state The name of the state to set fill vertical origin offset relative to area (not including the state value).
1814 * @param value The state value.
1815 * @param y The fill vertical origin offset value.
1816 */
1817EAPI void edje_edit_state_fill_origin_offset_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y);
1818
1819/** Get the fill horizontal size relative value of a part state.
1820 *
1821 * @param obj Object being edited.
1822 * @param part Part that contain state.
1823 * @param state The name of the state to get fill horizontal size relative to area (not including the state value).
1824 * @param value The state value.
1825 *
1826 * @return The fill horizontal size relative to area.
1827 */
1828EAPI double edje_edit_state_fill_size_relative_x_get(Evas_Object *obj, const char *part, const char *state, double value);
1829
1830/** Get the fill vertical size relative value of a part state.
1831 *
1832 * @param obj Object being edited.
1833 * @param part Part that contain state.
1834 * @param state The name of the state to get fill vertical size relative to area (not including the state value).
1835 * @param value The state value.
1836 *
1837 * @return The fill vertical size relative to area.
1838 */
1839EAPI double edje_edit_state_fill_size_relative_y_get(Evas_Object *obj, const char *part, const char *state, double value);
1840
1841/** Get the fill horizontal size offset value of a part state.
1842 *
1843 * @param obj Object being edited.
1844 * @param part Part that contain state.
1845 * @param state The name of the state to get fill horizontal size
1846 * offset relative to area (not including the state value).
1847 * @param value The state value.
1848 *
1849 * @return The fill horizontal size offset relative to area.
1850 */
1851EAPI int edje_edit_state_fill_size_offset_x_get(Evas_Object *obj, const char *part, const char *state, double value);
1852
1853/** Get the fill vertical size offset value of a part state.
1854 *
1855 * @param obj Object being edited.
1856 * @param part Part that contain state.
1857 * @param state The name of the state to get fill vertical size offset
1858 * relative to area (not including the state value).
1859 * @param value The state value.
1860 *
1861 * @return The fill vertical size offset relative to area.
1862 */
1863EAPI int edje_edit_state_fill_size_offset_y_get(Evas_Object *obj, const char *part, const char *state, double value);
1864
1865/** Set the fill horizontal size relative value of a part state.
1866 *
1867 * @param obj Object being edited.
1868 * @param part Part that contain state.
1869 * @param state The name of the state to set fill horizontal size
1870 * relative value (not including the state value).
1871 * @param value The state value.
1872 * @param x The horizontal size relative value.
1873 */
1874EAPI void edje_edit_state_fill_size_relative_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x);
1875
1876/** Set the fill vertical size relative value of a part state.
1877 *
1878 * @param obj Object being edited.
1879 * @param part Part that contain state.
1880 * @param state The name of the state to set fill vertical size
1881 * relative value (not including the state value).
1882 * @param value The state value.
1883 * @param x The vertical size relative value.
1884 */
1885EAPI void edje_edit_state_fill_size_relative_y_set(Evas_Object *obj, const char *part, const char *state, double value, double x);
1886
1887/** Set the fill horizontal size offset value of a part state.
1888 *
1889 * @param obj Object being edited.
1890 * @param part Part that contain state.
1891 * @param state The name of the state to set fill horizontal size
1892 * offset relative value (not including the state value).
1893 * @param value The state value.
1894 * @param x The horizontal size offset value.
1895 */
1896EAPI void edje_edit_state_fill_size_offset_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x);
1897
1898/** Set the fill vertical size offset value of a part state.
1899 *
1900 * @param obj Object being edited.
1901 * @param part Part that contain state.
1902 * @param state The name of the state to set fill vertical size offset
1903 * relative value (not including the state value).
1904 * @param value The state value.
1905 * @param y The vertical size offset value.
1906 */
1907EAPI void edje_edit_state_fill_size_offset_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y);
1908
1909/** Get the visibility of a part state.
1910 *
1911 * @param obj Object being edited.
1912 * @param part Part that contain state.
1913 * @param state The name of the state to get visibility (not including the state value).
1914 * @param value The state value.
1915 *
1916 * @return EINA_TRUE if the state is visible, EINA_FALSE otherwise.
1917 */
1918EAPI Eina_Bool edje_edit_state_visible_get(Evas_Object *obj, const char *part, const char *state, double value);
1919
1920/** Set the visibility of a part state.
1921 *
1922 * @param obj Object being edited.
1923 * @param part Part that contain state.
1924 * @param state The name of the state to set visibility (not including the state value).
1925 * @param value The state value.
1926 * @param visible To set state visible (EINA_TRUE if the state is visible, EINA_FALSE otherwise)
1927 */
1928EAPI void edje_edit_state_visible_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool visible);
1929
1930/** Get the color class of the given part state.
1931 *
1932 * Remember to free the string with edje_edit_string_free()
1933 *
1934 * @param obj Object being edited.
1935 * @param part Part that contain state.
1936 * @param state The name of the state to get color class (not including the state value).
1937 * @param value The state value.
1938 *
1939 * @return The current color class.
1940 */
1941EAPI const char *edje_edit_state_color_class_get(Evas_Object *obj, const char *part, const char *state, double value);
1942
1943/** Set the color class of the given part state.
1944 *
1945 * @param obj Object being edited.
1946 * @param part Part that contain state.
1947 * @param state The name of the state to set color class (not including the state value).
1948 * @param value The state value.
1949 * @param color_class The color class to assign.
1950 */
1951EAPI void edje_edit_state_color_class_set(Evas_Object *obj, const char *part, const char *state, double value, const char *color_class);
1952
1953/** Get the list of parameters for an external part.
1954 *
1955 * DO NOT FREE THE LIST!
1956 *
1957 * @param obj Object being edited.
1958 * @param part Part that contain state.
1959 * @param state The name of the state to get list of Edje_External_Param (not including the state value).
1960 * @param value The state value.
1961 *
1962 * @return The list of Edje_External_Param.
1963 */
1964EAPI const Eina_List * edje_edit_state_external_params_list_get(Evas_Object *obj, const char *part, const char *state, double value);
1965
1966/** Get the external parameter type and value.
1967 *
1968 * @param obj Object being edited.
1969 * @param part Part that contain state.
1970 * @param state The name of the state to get external parameter (not including the state value).
1971 * @param value The state value.
1972 * @param param The name of the paramter to look for.
1973 * @param type The type of the parameter will be stored here.
1974 * @param val Pointer to value will be stored here - DO NOT FREE IT!
1975 *
1976 * @return EINA_TRUE if the parameter was found, EINA_FALSE otherwise.
1977 */
1978EAPI Eina_Bool edje_edit_state_external_param_get(Evas_Object *obj, const char *part, const char *state, double value, const char *param, Edje_External_Param_Type *type, void **val);
1979
1980/** Get external parameter of type INT.
1981 *
1982 * @param obj Object being edited.
1983 * @param part Part that contain state.
1984 * @param state The name of the state to get external parameter of type INT (not including the state value).
1985 * @param value The state value.
1986 * @param param The name of the paramter.
1987 * @param val The value of the parameter.
1988 *
1989 * @return EINA_TRUE if successful. EINA_FALSE if not found or is of different type.
1990 */
1991EAPI Eina_Bool edje_edit_state_external_param_int_get(Evas_Object *obj, const char *part, const char *state, double value, const char *param, int *val);
1992
1993/** Get external parameter of type BOOL.
1994 *
1995 * @param obj Object being edited.
1996 * @param part Part that contain state.
1997 * @param state The name of the state to get external parameter of type BOOL (not including the state value).
1998 * @param value The state value.
1999 * @param param The name of the paramter.
2000 * @param val The value of the parameter.
2001 *
2002 * @return EINA_TRUE if successful. EINA_FALSE if not found or is of different type.
2003 */
2004EAPI Eina_Bool edje_edit_state_external_param_bool_get(Evas_Object *obj, const char *part, const char *state, double value, const char *param, Eina_Bool *val);
2005
2006/** Get external parameter of type DOUBLE.
2007 *
2008 * @param obj Object being edited.
2009 * @param part Part that contain state.
2010 * @param state The name of the state to get external parameter of type DOUBLE (not including the state value).
2011 * @param value The state value.
2012 * @param param The name of the paramter.
2013 * @param val The value of the parameter.
2014 *
2015 * @return EINA_TRUE if successful. EINA_FALSE if not found or is of different type.
2016 */
2017EAPI Eina_Bool edje_edit_state_external_param_double_get(Evas_Object *obj, const char *part, const char *state, double value, const char *param, double *val);
2018
2019/** Get external parameter of type STRING.
2020 *
2021 * @param obj Object being edited.
2022 * @param part Part that contain state.
2023 * @param state The name of the state to get external parameter of
2024 * type STRING (not including the state value).
2025 * @param value The state value.
2026 * @param param The name of the paramter.
2027 * @param val The value of the parameter.
2028 *
2029 * @return EINA_TRUE if successful. EINA_FALSE if not found or is of
2030 * different type.
2031 */
2032EAPI Eina_Bool edje_edit_state_external_param_string_get(Evas_Object *obj, const char *part, const char *state, double value, const char *param, const char **val);
2033
2034/** Get external parameter of type CHOICE.
2035 *
2036 * @param obj Object being edited.
2037 * @param part Part that contain state.
2038 * @param state The name of the state to get external parameter of
2039 * type CHOICE (not including the state value).
2040 * @param value The state value.
2041 * @param param The name of the paramter.
2042 * @param val The value of the parameter.
2043 *
2044 * @return EINA_TRUE if successful. EINA_FALSE if not found or is of
2045 * different type.
2046 */
2047EAPI Eina_Bool edje_edit_state_external_param_choice_get(Evas_Object *obj, const char *part, const char *state, double value, const char *param, const char **val);
2048
2049/** Set the external parameter type and value, adding it if it didn't
2050 * exist before.
2051 *
2052 * @param obj Object being edited.
2053
2054 * @param part Part that contain state.
2055 * @param state The name of the state to get external parameter (not
2056 * including the state value).
2057 * @param value The state value.
2058 * @param param The name of the paramter set.
2059 * @param type The type of the parameter.
2060 *
2061 * @return EINA_TRUE if it was set, EINA_FALSE otherwise.
2062 */
2063
2064/**
2065 * Arguments should have proper sized values matching their types:
2066 * - EDJE_EXTERNAL_PARAM_TYPE_INT: int
2067 * - EDJE_EXTERNAL_PARAM_TYPE_BOOL: int
2068 * - EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: double
2069 * - EDJE_EXTERNAL_PARAM_TYPE_STRING: char*
2070 * - EDJE_EXTERNAL_PARAM_TYPE_CHOICE: char*
2071 *
2072 * @note: The validation of the parameter will occur only if the part
2073 * is in the same state as the one being modified.
2074 */
2075EAPI Eina_Bool edje_edit_state_external_param_set(Evas_Object *obj, const char *part, const char *state, double value, const char *param, Edje_External_Param_Type type, ...);
2076
2077/** Set external parameter of type INT.
2078 *
2079 * @param obj Object being edited.
2080 * @param part Part that contain state.
2081 * @param state The name of the state to get external parameter of
2082 * type INT (not including the state value).
2083 * @param value The state value.
2084 * @param param The name of the paramter.
2085 * @param val Value will be stored here.
2086 *
2087 * @return EINA_TRUE if it was set, EINA_FALSE otherwise.
2088 */
2089EAPI Eina_Bool edje_edit_state_external_param_int_set(Evas_Object *obj, const char *part, const char *state, double value, const char *param, int val);
2090
2091/** Set external parameter of type BOOL.
2092 *
2093 * @param obj Object being edited.
2094 * @param part Part that contain state.
2095 * @param state The name of the state to get external parameter of type BOOL (not including the state value).
2096 * @param value The state value.
2097 * @param param The name of the paramter.
2098 * @param val Value will be stored here.
2099 *
2100 * @return EINA_TRUE if it was set, EINA_FALSE otherwise.
2101 */
2102EAPI Eina_Bool edje_edit_state_external_param_bool_set(Evas_Object *obj, const char *part, const char *state, double value, const char *param, Eina_Bool val);
2103
2104/** Set external parameter of type DOUBLE.
2105 *
2106 * @param obj Object being edited.
2107 * @param part Part that contain state.
2108 * @param state The name of the state to get external parameter of type DOUBLE (not including the state value).
2109 * @param value The state value.
2110 * @param param The name of the paramter.
2111 * @param val Value will be stored here.
2112 *
2113 * @return EINA_TRUE if it was set, EINA_FALSE otherwise.
2114 */
2115EAPI Eina_Bool edje_edit_state_external_param_double_set(Evas_Object *obj, const char *part, const char *state, double value, const char *param, double val);
2116
2117/** Set external parameter of type STRING.
2118 *
2119 * @param obj Object being edited.
2120 * @param part Part that contain state.
2121 * @param state The name of the state to get external parameter of type STRING (not including the state value).
2122 * @param value The state value.
2123 * @param param The name of the paramter.
2124 * @param val Value will be stored here.
2125 *
2126 * @return EINA_TRUE if it was set, EINA_FALSE otherwise.
2127 */
2128EAPI Eina_Bool edje_edit_state_external_param_string_set(Evas_Object *obj, const char *part, const char *state, double value, const char *param, const char *val);
2129
2130/** Set external parameter of type CHOICE.
2131 *
2132 * @param obj Object being edited.
2133 * @param part Part that contain state.
2134 * @param state The name of the state to get external parameter of type CHOICE (not including the state value).
2135 * @param value The state value.
2136 * @param param The name of the paramter.
2137 * @param val Value will be stored here.
2138 *
2139 * @return EINA_TRUE if it was set, EINA_FALSE otherwise.
2140 */
2141EAPI Eina_Bool edje_edit_state_external_param_choice_set(Evas_Object *obj, const char *part, const char *state, double value, const char *param, const char *val);
2142
2143
2144//@}
2145/******************************************************************************/
2146/************************** TEXT API ************************************/
2147/******************************************************************************/
2148/** @name Text API
2149 * Functions to deal with text objects (see @ref edcref).
2150 */ //@{
2151
2152/** Get the text of a part state.
2153 *
2154 * Remember to free the returned string with edje_edit_string_free().
2155 *
2156 * @param obj Object being edited.
2157 * @param part Part that contain state.
2158 * @param state The name of the state to get text (not including the state value).
2159 * @param value The state value.
2160 *
2161 * @return A newly allocated string containing the text for the given state.
2162 */
2163EAPI const char * edje_edit_state_text_get(Evas_Object *obj, const char *part, const char *state, double value);
2164
2165/** Set the text of a part state.
2166 *
2167 * @param obj Object being edited.
2168 * @param part Part that contain state.
2169 * @param state The name of the state to set text (not including the state value).
2170 * @param value The state value.
2171 * @param text The new text to assign.
2172 */
2173EAPI void edje_edit_state_text_set(Evas_Object *obj, const char *part, const char *state, double value,const char *text);
2174
2175/** Get font name for a given part state.
2176 *
2177 * @param obj Object being edited.
2178 * @param part The name of the part to get the font of.
2179 * @param state The state of the part to get the font of.
2180 * @param value Value of the state.
2181 *
2182 * @return Font used by the part or NULL if error or nothing is set.
2183 */
2184EAPI const char * edje_edit_state_font_get(Evas_Object *obj, const char *part, const char *state, double value);
2185
2186/** Set font name for a given part state.
2187 *
2188 * Font name can be any alias of an internal font in the Edje file and,
2189 * if it doesn't match any, Edje will look for a font with the given name
2190 * in the system fonts.
2191 *
2192 * @param obj Object being edited.
2193 * @param part Part to set the font of.
2194 * @param state State in which the font is set.
2195 * @param value Value of the state.
2196 * @param font The font name to use.
2197 */
2198EAPI void edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state, double value, const char *font);
2199
2200/** Get the text size of a part state
2201 *
2202 * @param obj Object being edited.
2203 * @param part Part that contain state.
2204 * @param state The name of the state to get text size (not including the state value).
2205 * @param value The state value.
2206 *
2207 * @return The text size or -1 on errors.
2208 */
2209EAPI int edje_edit_state_text_size_get(Evas_Object *obj, const char *part, const char *state, double value);
2210
2211/** Set the text size of a part state.
2212 *
2213 * @param obj Object being edited.
2214 * @param part Part that contain state.
2215 * @param state The name of the state to set text size (not including the state value).
2216 * @param value The state value.
2217 * @param size The new font size to set (in pixel)
2218 */
2219EAPI void edje_edit_state_text_size_set(Evas_Object *obj, const char *part, const char *state, double value, int size);
2220
2221/** Get the text horizontal align of a part state.
2222 *
2223 * The value range is from 0.0(right) to 1.0(left)
2224 *
2225 * @param obj Object being edited.
2226 * @param part Part that contain state.
2227 * @param state The name of the state to get the text horizontal align (not including the state value).
2228 * @param value The state value.
2229 *
2230 * @return The text horizont align value
2231 */
2232EAPI double edje_edit_state_text_align_x_get(Evas_Object *obj, const char *part, const char *state, double value);
2233
2234/** Get the text vertical align of a part state.
2235 *
2236 * The value range is from 0.0(top) to 1.0(bottom)
2237 *
2238 * @param obj Object being edited.
2239 * @param part Part that contain state.
2240 * @param state The name of the state to get the text vertical align (not including the state value).
2241 * @param value The state value.
2242 *
2243 * @return The text horizont align value
2244 */
2245EAPI double edje_edit_state_text_align_y_get(Evas_Object *obj, const char *part, const char *state, double value);
2246
2247/** Set the text horizontal align of a part state.
2248 *
2249 * The value range is from 0.0(right) to 1.0(left)
2250 *
2251 * @param obj Object being edited.
2252 * @param part Part that contain state.
2253 * @param state The name of the state to set the text horizontal align (not including the state value).
2254 * @param value The state value.
2255 * @param align The new text horizontal align value
2256 */
2257EAPI void edje_edit_state_text_align_x_set(Evas_Object *obj, const char *part, const char *state, double value, double align);
2258
2259/** Set the text vertical align of a part state.
2260 *
2261 * The value range is from 0.0(top) to 1.0(bottom)
2262 *
2263 * @param obj Object being edited.
2264 * @param part Part that contain state.
2265 * @param state The name of the state to set the text vertical align (not including the state value).
2266 * @param value The state value.
2267 * @param align The new text vertical align value
2268 */
2269EAPI void edje_edit_state_text_align_y_set(Evas_Object *obj, const char *part, const char *state, double value, double align);
2270
2271/** Get the text elipsis of a part state.
2272 *
2273 * The value range is from 0.0(right) to 1.0(left)
2274 *
2275 * @param obj Object being edited.
2276 * @param part Part that contain state.
2277 * @param state The name of the state to get the text elipses value (not including the state value).
2278 * @param value The state value.
2279 *
2280 * @return The text elipsis value
2281 */
2282EAPI double edje_edit_state_text_elipsis_get(Evas_Object *obj, const char *part, const char *state, double value);
2283
2284/** Set the text vertical align of a part state.
2285 *
2286 * The value range is from 0.0(right) to 1.0(left)
2287 *
2288 * @param obj Object being edited.
2289 * @param part Part that contain state.
2290 * @param state The name of the state to set the text elipses value (not including the state value).
2291 * @param value The state value.
2292 * @param balance The position where to cut the string
2293 */
2294EAPI void edje_edit_state_text_elipsis_set(Evas_Object *obj, const char *part, const char *state, double value, double balance);
2295
2296/** Get if the text part fit it's container horizontally
2297 *
2298 * @param obj Object being edited.
2299 * @param part Part that contain state.
2300 * @param state The name of the state to get the if the text part fit it's container horizontally (not including the state value).
2301 * @param value The state value.
2302 *
2303 * @return EINA_TRUE If the part fit it's container horizontally, EINA_FALSE otherwise.
2304 */
2305EAPI Eina_Bool edje_edit_state_text_fit_x_get(Evas_Object *obj, const char *part, const char *state, double value);
2306
2307/** Set if the text part should fit it's container horizontally
2308 *
2309 * @param obj Object being edited.
2310 * @param part Part that contain state.
2311 * @param state The name of the state to set the if the text part fit it's container horizontally (not including the state value).
2312 * @param value The state value.
2313 * @param fit EINA_TRUE to make the text fit it's container horizontally, EINA_FALSE otherwise.
2314 */
2315EAPI void edje_edit_state_text_fit_x_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool fit);
2316
2317/** Get if the text part fit it's container vertically
2318 *
2319 * @param obj Object being edited.
2320 * @param part Part that contain state.
2321 * @param state The name of the state to get the if the text part fit it's container vertically (not including the state value).
2322 * @param value The state value.
2323 *
2324 * @return EINA_TRUE If the part fit it's container vertically, EINA_FALSE otherwise.
2325 */
2326EAPI Eina_Bool edje_edit_state_text_fit_y_get(Evas_Object *obj, const char *part, const char *state, double value);
2327
2328/** Set if the text part should fit it's container vertically
2329 *
2330 * @param obj Object being edited.
2331 * @param part Part that contain state.
2332 * @param state The name of the state to set the if the text part fit it's container vertically (not including the state value).
2333 * @param value The state value.
2334 * @param fit EINA_TRUE to make the text fit it's container vertically, EINA_FALSE otherwise.
2335 */
2336EAPI void edje_edit_state_text_fit_y_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool fit);
2337
2338/** Get the list of all the fonts in the given edje.
2339 *
2340 * Use edje_edit_string_list_free() when you don't need the list anymore.
2341 *
2342 * @param obj Object being edited.
2343 *
2344 * @return A list containing all the fonts names found in the edje file.
2345 */
2346EAPI Eina_List * edje_edit_fonts_list_get(Evas_Object *obj);
2347
2348/** Add a new font to the edje file.
2349 *
2350 * The newly created font will be available to all the groups in the edje, not only the current one.
2351 *
2352 * @param obj Object being edited.
2353 * @param path The file path to load the font from.
2354 * @param alias The alias for file, or NULL to use filename
2355 *
2356 * @return EINA_TRUE if font cat be loaded, EINA_FALSE otherwise.
2357 */
2358EAPI Eina_Bool edje_edit_font_add(Evas_Object *obj, const char *path, const char* alias);
2359
2360/** Delete font from the edje file.
2361 *
2362 * The font will be removed from all the groups in the edje, not only the current one.
2363 *
2364 * @param obj Object being edited.
2365 * @param alias The font alias
2366 *
2367 * @return EINA_TRUE if successful, EINA_FALSE otherwise (including the
2368 * case when the alias is not valid).
2369 */
2370EAPI Eina_Bool edje_edit_font_del(Evas_Object *obj, const char* alias);
2371
2372/** Get font path for a given font alias.
2373 *
2374 * Remember to free the string with edje_edit_string_free()
2375 *
2376 * @param obj Object being edited.
2377 * @param alias The font alias.
2378 *
2379 * @return The path of the given font alias.
2380 */
2381EAPI const char *edje_edit_font_path_get(Evas_Object *obj, const char *alias);
2382
2383
2384/** Get font name for a given part state.
2385 *
2386 * Remember to free the returned string using edje_edit_string_free().
2387 *
2388 * @param obj Object being edited.
2389 * @param part Part that contain state.
2390 * @param state The name of the state to get the name of the font used (not including the state value).
2391 * @param value The state value.
2392 *
2393 * @return The name of the font used in the given part state.
2394 */
2395EAPI const char * edje_edit_state_font_get(Evas_Object *obj, const char *part, const char *state, double value);
2396
2397/** Set font name for a given part state.
2398 *
2399 * @param obj Object being edited.
2400 * @param part Part that contain state.
2401 * @param state The name of the state to set the name of the font that will be used (not including the state value).
2402 * @param value The state value.
2403 * @param font The name of the font to use in the given part state.
2404 */
2405EAPI void edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state, double value, const char *font);
2406
2407
2408//@}
2409/******************************************************************************/
2410/************************** IMAGES API ************************************/
2411/******************************************************************************/
2412/** @name Images API
2413 * Functions to deal with image objects (see @ref edcref).
2414 */ //@{
2415
2416/** Get the list of all the images in the given edje.
2417 * Use edje_edit_string_list_free() when you don't need the list anymore.
2418 *
2419 * @param obj Object being edited.
2420 *
2421 * @return A List containing all images names found in the edje file.
2422 */
2423EAPI Eina_List * edje_edit_images_list_get(Evas_Object *obj);
2424
2425/** Add an new image to the image collection
2426 *
2427 * This function add the given image inside the edje. Don't add a new image part
2428 * but only put the image inside the edje file. It actually write directly to
2429 * the file so you don't have to save.
2430 * After you have to create a new image_part that use this image. Note that all
2431 * the parts in the edje share the same image collection, thus you can/must use
2432 * the same image for different part.
2433 *
2434 * The format of the image files that can be loaded depend on the evas engine on your system
2435 *
2436 * @param obj Object being edited.
2437 * @param path The name of the image file to include in the edje.
2438 *
2439 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
2440 */
2441EAPI Eina_Bool edje_edit_image_add(Evas_Object *obj, const char *path);
2442
2443/** Delete an image from the image collection
2444 *
2445 * It actually write directly to the file so you don't have to save.
2446 *
2447 * @param obj Object being edited.
2448 * @param name The name of the image file to include in the edje.
2449 *
2450 * @return EINA_TRUE if successful, EINA_FALSE otherwise (including the
2451 * case when the name is not valid).
2452 */
2453EAPI Eina_Bool edje_edit_image_del(Evas_Object *obj, const char *name);
2454
2455/** Add an image entry to the image collection
2456 *
2457 * This function adds the given image entry to the edje image collection. The
2458 * image needs to be inside the eet already, with key name "images/id". After
2459 * you have to create a new image_part that use this image, referring to it as
2460 * "name". Note that all the parts in the edje share the same image collection,
2461 * thus you can/must use the same image for different part.
2462 *
2463 * @param obj Object being edited.
2464 * @param name The image entry name.
2465 * @param id The image id.
2466 *
2467 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
2468 */
2469EAPI Eina_Bool edje_edit_image_data_add(Evas_Object *obj, const char *name, int id);
2470
2471/** Get normal image name for a given part state.
2472 *
2473 * @param obj Object being edited.
2474 * @param part Part that contain state.
2475 * @param state The name of the state to get the name that is being used (not including the state value).
2476 * @param value The state value.
2477 *
2478 * @return The name of the image used by state.
2479 */
2480EAPI const char * edje_edit_state_image_get(Evas_Object *obj, const char *part, const char *state, double value);
2481
2482/** Set normal image for a given part state.
2483 *
2484 * @param obj Object being edited.
2485 * @param part Part that contain state.
2486 * @param state The name of the state to set the image that will be used (not including the state value).
2487 * @param value The state value.
2488 * @param image The name of the image (must be an image contained in the edje file).
2489 */
2490EAPI void edje_edit_state_image_set(Evas_Object *obj, const char *part, const char *state, double value, const char *image);
2491
2492/** Get image id for a given image name.
2493 *
2494 * @param obj Object being edited.
2495 * @param image_name The image name.
2496 *
2497 * @return The id of the given image name.
2498 */
2499EAPI int edje_edit_image_id_get(Evas_Object *obj, const char *image_name);
2500
2501/** Get compression type for the given image.
2502 *
2503 * @param obj Object being edited.
2504 * @param image The name of the image.
2505 *
2506 * @return One of Image Compression types.
2507 * (EDJE_EDIT_IMAGE_COMP_RAW, EDJE_EDIT_IMAGE_COMP_USER, EDJE_EDIT_IMAGE_COMP_COMP, EDJE_EDIT_IMAGE_COMP_LOSSY).
2508 */
2509EAPI Edje_Edit_Image_Comp edje_edit_image_compression_type_get(Evas_Object *obj, const char *image);
2510
2511/** Get compression rate for the given image.
2512 *
2513 * @param obj Object being edited.
2514 * @param image The name of the image.
2515 *
2516 * @return The compression rate (if the imnage is @c
2517 * EDJE_EDIT_IMAGE_COMP_LOSSY) or < 0, on errors.
2518 */
2519EAPI int edje_edit_image_compression_rate_get(Evas_Object *obj, const char *image);
2520
2521/** Get the image border of a part state.
2522 *
2523 * Pass NULL to any of [r,g,b,a] to get only the others.
2524 *
2525 * @param obj Object being edited.
2526 * @param part Part that contain state.
2527 * @param state The name of the state to get the image border (not
2528 * including the state value).
2529 * @param value The state value.
2530 * @param l A pointer to store the left value
2531 * @param r A pointer to store the right value
2532 * @param t A pointer to store the top value
2533 * @param b A pointer to store the bottom value
2534 */
2535EAPI void edje_edit_state_image_border_get(Evas_Object *obj, const char *part, const char *state, double value, int *l, int *r, int *t, int *b);
2536
2537/** Set the image border of a part state.
2538 *
2539 * Pass -1 to any of [l,r,t,b] to leave the value untouched.
2540 *
2541 * @param obj Object being edited.
2542 * @param part Part that contain state.
2543 * @param state The name of the state to set the image border (not
2544 * including the state value).
2545 * @param value The state value.
2546 * @param l Left border value (or -1).
2547 * @param r Right border value (or -1).
2548 * @param t Top border value (or -1).
2549 * @param b Bottom border value (or -1).
2550 */
2551EAPI void edje_edit_state_image_border_set(Evas_Object *obj, const char *part, const char *state, double value, int l, int r, int t, int b);
2552
2553/** Get if the image center should be draw.
2554 *
2555 * 1 means to draw the center, 0 to don't draw it.
2556 *
2557 * @param obj Object being edited.
2558 * @param part Part that contain state.
2559 * @param state The name of the state to get the image border fill (not including the state value).
2560 * @param value The state value.
2561 *
2562 * @return 1 if the center of the bordered image is draw, 0 otherwise.
2563 */
2564EAPI unsigned char edje_edit_state_image_border_fill_get(Evas_Object *obj, const char *part, const char *state, double value);
2565
2566/** Set if the image center should be draw.
2567 *
2568 * 1 means to draw the center, 0 to don't draw it.
2569 *
2570 * @param obj Object being edited.
2571 * @param part Part that contain state.
2572 * @param state The name of the state to set the image border fill (not including the state value).
2573 * @param value The state value.
2574 * @param fill Fill to be se. 1 if the center of the bordered image is draw, 0 otherwise.
2575 */
2576EAPI void edje_edit_state_image_border_fill_set(Evas_Object *obj, const char *part, const char *state, double value, unsigned char fill);
2577
2578/** Get the list of all the tweens images in the given part state.
2579 *
2580 * Use edje_edit_string_list_free() when you don't need it anymore.
2581 *
2582 * @param obj Object being edited.
2583 * @param part Part that contain state.
2584 * @param state The name of the state to get the list of all the tweens images (not including the state value).
2585 * @param value The state value.
2586 *
2587 * @return A string list containing all the image name that form a tween animation in the given part state.
2588 */
2589EAPI Eina_List * edje_edit_state_tweens_list_get(Evas_Object *obj, const char *part, const char *state, double value);
2590
2591/** Add a new tween frame to the given part state.
2592 *
2593 * The tween param must be the name of an existing image.
2594 *
2595 * @param obj Object being edited.
2596 * @param part Part that contain state.
2597 * @param state The name of the state to add a new tween frame (not including the state value).
2598 * @param value The state value.
2599 * @param tween The name of the image to add.
2600 *
2601 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
2602 */
2603EAPI Eina_Bool edje_edit_state_tween_add(Evas_Object *obj, const char *part, const char *state, double value, const char *tween);
2604
2605/** Remove the first tween with the given name.
2606 *
2607 * The image is not removed from the edje.
2608 *
2609 * @param obj Object being edited.
2610 * @param part Part that contain state.
2611 * @param state The name of the state to del the tween (not including the state value).
2612 * @param value The state value.
2613 * @param tween The name of the image to del.
2614 *
2615 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
2616 */
2617EAPI Eina_Bool edje_edit_state_tween_del(Evas_Object *obj, const char *part, const char *state, double value, const char *tween);
2618
2619
2620//@}
2621/******************************************************************************/
2622/************************* SPECTRUM API ***********************************/
2623/******************************************************************************/
2624/** @name Spectrum API
2625 * Functions to manage spectrum (see @ref edcref).
2626 */ //@{
2627
2628/** Get the list of all the spectrum in the given edje object.
2629 *
2630 * Use edje_edit_string_list_free() when you don't need it anymore.
2631 *
2632 * @param obj Object being edited.
2633 *
2634 * @return A list containing all the spectra names.
2635 */
2636EAPI Eina_List * edje_edit_spectrum_list_get(Evas_Object *obj);
2637
2638/** Add a new spectra in the given edje object.
2639 *
2640 * @param obj Object being edited.
2641 * @param name The name of the spectra to include in the edje.
2642 *
2643 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
2644 */
2645EAPI Eina_Bool edje_edit_spectra_add(Evas_Object *obj, const char *name);
2646
2647/** Delete the given spectra from the edje object.
2648 *
2649 * @param obj Object being edited.
2650 * @param spectra The name of the spectra to delete.
2651 *
2652 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
2653 */
2654EAPI Eina_Bool edje_edit_spectra_del(Evas_Object *obj, const char *spectra);
2655
2656/** Change the name of the given spectra.
2657 *
2658 * @param obj Object being edited.
2659 * @param spectra The name of the current spectra.
2660 * @param name The new name to assign.
2661 *
2662 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
2663 */
2664EAPI Eina_Bool edje_edit_spectra_name_set(Evas_Object *obj, const char *spectra, const char *name);
2665
2666/** Get the number of stops in the given spectra.
2667 *
2668 * @param obj Object being edited.
2669 * @param spectra The name of the spectra.
2670 *
2671 * @return The number of stops (or 0 on errors).
2672 */
2673EAPI int edje_edit_spectra_stop_num_get(Evas_Object *obj, const char *spectra);
2674
2675/** Set the number of stops in the given spectra.
2676 *
2677 * @param obj Object being edited.
2678 * @param spectra The name of the spectra.
2679 * @param num The number of stops you want
2680 *
2681 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
2682 */
2683EAPI Eina_Bool edje_edit_spectra_stop_num_set(Evas_Object *obj, const char *spectra, int num);
2684
2685/** Get the colors of the given stop.
2686 *
2687 * @param obj Object being edited.
2688 * @param spectra The name of the spectra.
2689 * @param stop_number The number of the stop,
2690 * @param r Where to store the red color value,
2691 * @param g Where to store the green color value,
2692 * @param b Where to store the blue color value,
2693 * @param a Where to store the alpha color value,
2694 * @param d Where to store the delta stop value,
2695 *
2696 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
2697 */
2698EAPI Eina_Bool edje_edit_spectra_stop_color_get(Evas_Object *obj, const char *spectra, int stop_number, int *r, int *g, int *b, int *a, int *d);
2699
2700/** Set the colors of the given stop.
2701 *
2702 * @param obj Object being edited.
2703 * @param spectra The name of the spectra.
2704 * @param stop_number The number of the stops,
2705 * @param r The red color value to set,
2706 * @param g The green color value to set,
2707 * @param b The blue color value to set,
2708 * @param a The alpha color value to set,
2709 * @param d The delta stop value to set,
2710 */
2711EAPI Eina_Bool edje_edit_spectra_stop_color_set(Evas_Object *obj, const char *spectra, int stop_number, int r, int g, int b, int a, int d);
2712
2713
2714//@}
2715/******************************************************************************/
2716/************************* GRADIENT API ***********************************/
2717/******************************************************************************/
2718/** @name Gradient API
2719 * Functions to deal with gradient objects (see @ref edcref).
2720 */ //@{
2721
2722/** Get the type of gradient.
2723 *
2724 * Remember to free the string with edje_edit_string_free().
2725 *
2726 * @param obj Object being edited.
2727 * @param part The part that contain state.
2728 * @param state The name of the state to get the gradient type (not including the state value).
2729 * @param value The state value.
2730 *
2731 * @return The type of gradient used in state.
2732 * (linear, linear.diag, linear.codiag, radial, rectangular, angular, sinosoidal)
2733 */
2734EAPI const char * edje_edit_state_gradient_type_get(Evas_Object *obj, const char *part, const char *state, double value);
2735
2736/** Set the type of gradient.
2737 *
2738 * Gradient type can be on of the following: linear, linear.diag, linear.codiag, radial, rectangular, angular, sinusoidal
2739 *
2740 * @param obj Object being edited.
2741 * @param part The part that contain state.
2742 * @param state The name of the state to set the gradient type (not including the state value).
2743 * @param value The state value.
2744 * @param type The type of gradient to use.
2745 *
2746 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
2747 */
2748EAPI Eina_Bool edje_edit_state_gradient_type_set(Evas_Object *obj, const char *part, const char *state, double value, const char *type);
2749
2750/** Get if the current gradient use the fill properties or the gradient_rel as params.
2751 *
2752 * @param obj Object being edited.
2753 * @param part The part that contain state.
2754 * @param state The name of the state to set the gradient type (not including the state value).
2755 * @param value The state value.
2756 *
2757 * @return EINA_TRUE if gradient use the fill properties, EINA_FALSE otherwise.
2758 * */
2759EAPI Eina_Bool edje_edit_state_gradient_use_fill_get(Evas_Object *obj, const char *part, const char *state, double value);
2760
2761/** Get the spectra used by part state.
2762 *
2763 * Remember to free the string with edje_edit_string_free().
2764 *
2765 * @param obj Object being edited.
2766 * @param part The part that contain state.
2767 * @param state The name of the state to get the spectra name used (not including the state value).
2768 * @param value The state value.
2769 *
2770 * @return The spectra name used in state.
2771 */
2772EAPI const char * edje_edit_state_gradient_spectra_get(Evas_Object *obj, const char *part, const char *state, double value);
2773
2774/** Set the spectra used by part state.
2775 *
2776 * @param obj Object being edited.
2777 * @param part The part that contain state.
2778 * @param state The name of the state to set the spectra (not including the state value).
2779 * @param value The state value.
2780 * @param spectra The spectra name to assign
2781 *
2782 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
2783 */
2784EAPI Eina_Bool edje_edit_state_gradient_spectra_set(Evas_Object *obj, const char *part, const char *state, double value, const char *spectra);
2785
2786/** Get the angle of the gradient.
2787 *
2788 * @param obj Object being edited.
2789 * @param part The part that contain state.
2790 * @param state The name of the state to get the angle (not including the state value).
2791 * @param value The state value.
2792 *
2793 * @return The angle of the gradient.
2794 */
2795EAPI int edje_edit_state_gradient_angle_get(Evas_Object *obj, const char *part, const char *state, double value);
2796
2797/** Set the angle of the gradient.
2798 *
2799 * @param obj Object being edited.
2800 * @param part The part that contain state.
2801 * @param state The name of the state to set the angle (not including the state value).
2802 * @param value The state value.
2803 * @param angle The angle to set.
2804 */
2805EAPI void edje_edit_state_gradient_angle_set(Evas_Object *obj, const char *part, const char *state, double value, int angle);
2806
2807/** Get the gradient rel1 horizontal relative value
2808 *
2809 * @param obj Object being edited.
2810 * @param part The part that contain state.
2811 * @param state The name of the state to get rel1 relative x value (not including the state value).
2812 * @param value The state value.
2813 *
2814 * @return The gradient rel1 horizontal relative value.
2815 */
2816EAPI double edje_edit_state_gradient_rel1_relative_x_get(Evas_Object *obj, const char *part, const char *state, double value);
2817
2818/** Get the gradient rel1 vertical relative value
2819 *
2820 * @param obj Object being edited.
2821 * @param part The part that contain state.
2822 * @param state The name of the state to get rel1 relative y value (not including the state value).
2823 * @param value The state value.
2824 *
2825 * @return The gradient rel1 vertical relative value.
2826 */
2827EAPI double edje_edit_state_gradient_rel1_relative_y_get(Evas_Object *obj, const char *part, const char *state, double value);
2828
2829/** Get the gradient rel2 horizontal relative value
2830 *
2831 * @param obj Object being edited.
2832 * @param part The part that contain state.
2833 * @param state The name of the state to get rel2 relative x value (not including the state value).
2834 * @param value The state value.
2835 *
2836 * @return The gradient rel2 horizontal relative value.
2837 */
2838EAPI double edje_edit_state_gradient_rel2_relative_x_get(Evas_Object *obj, const char *part, const char *state, double value);
2839
2840/** Get the gradient rel2 vertical relative value
2841 *
2842 * @param obj Object being edited.
2843 * @param part The part that contain state.
2844 * @param state The name of the state to get rel2 relative y value (not including the state value).
2845 * @param value The state value.
2846 *
2847 * @return The gradient rel2 vertical relative value.
2848 */
2849EAPI double edje_edit_state_gradient_rel2_relative_y_get(Evas_Object *obj, const char *part, const char *state, double value);
2850
2851
2852/** Set the gradient rel1 horizontal relative value
2853 *
2854 * @param obj Object being edited.
2855 * @param part The part that contain state.
2856 * @param state The name of the state to set rel1 relative x value (not including the state value).
2857 * @param value The state value.
2858 * @param val The rel1 relative x to be set,
2859 *
2860 * @return EINA_TRUE if successful, EINA_FALSE otherwise..
2861 */
2862EAPI Eina_Bool edje_edit_state_gradient_rel1_relative_x_set(Evas_Object *obj, const char *part, const char *state, double value, double val);
2863
2864
2865/** Set the gradient rel1 vertical relative value
2866 *
2867 * @param obj Object being edited.
2868 * @param part The part that contain state.
2869 * @param state The name of the state to set rel1 relative y value (not including the state value).
2870 * @param value The state value.
2871 * @param val The rel1 relative y to be set,
2872 *
2873 * @return EINA_TRUE if successful, EINA_FALSE otherwise..
2874 */
2875EAPI Eina_Bool edje_edit_state_gradient_rel1_relative_y_set(Evas_Object *obj, const char *part, const char *state, double value, double val);
2876
2877/** Set the gradient rel2 horizontal relative value
2878 *
2879 * @param obj Object being edited.
2880 * @param part The part that contain state.
2881 * @param state The name of the state to set rel2 relative x value (not including the state value).
2882 * @param value The state value.
2883 * @param val The rel2 relative x to be set,
2884 *
2885 * @return EINA_TRUE if successful, EINA_FALSE otherwise..
2886 */
2887EAPI Eina_Bool edje_edit_state_gradient_rel2_relative_x_set(Evas_Object *obj, const char *part, const char *state, double value, double val);
2888
2889/** Set the gradient rel2 vertical relative value
2890 *
2891 * @param obj Object being edited.
2892 * @param part The part that contain state.
2893 * @param state The name of the state to set rel2 relative y value (not including the state value).
2894 * @param value The state value.
2895 * @param val The rel2 relative y to be set,
2896 *
2897 * @return EINA_TRUE if successful, EINA_FALSE otherwise..
2898 */
2899EAPI Eina_Bool edje_edit_state_gradient_rel2_relative_y_set(Evas_Object *obj, const char *part, const char *state, double value, double val);
2900
2901/** Get the gradient rel1 horizontal offset value
2902 *
2903 * @param obj Object being edited.
2904 * @param part The part that contain state.
2905 * @param state The name of the state to get rel1 offset x value (not including the state value).
2906 * @param value The state value.
2907 *
2908 * @return The gradient rel1 horizontal offset value.
2909 */
2910EAPI int edje_edit_state_gradient_rel1_offset_x_get(Evas_Object *obj, const char *part, const char *state, double value);
2911
2912/** Get the gradient rel1 vertical offset value
2913 *
2914 * @param obj Object being edited.
2915 * @param part The part that contain state.
2916 * @param state The name of the state to get rel1 offset y value (not including the state value).
2917 * @param value The state value.
2918 *
2919 * @return The gradient rel1 vertical offset value.
2920 */
2921EAPI int edje_edit_state_gradient_rel1_offset_y_get(Evas_Object *obj, const char *part, const char *state, double value);
2922
2923/** Get the gradient rel2 horizontal offset value
2924 *
2925 * @param obj Object being edited.
2926 * @param part The part that contain state.
2927 * @param state The name of the state to get rel2 offset x value (not including the state value).
2928 * @param value The state value.
2929 *
2930 * @return The gradient rel2 horizontal offset value.
2931 */
2932EAPI int edje_edit_state_gradient_rel2_offset_x_get(Evas_Object *obj, const char *part, const char *state, double value);
2933
2934/** Get the gradient rel2 vertical offset value
2935 *
2936 * @param obj Object being edited.
2937 * @param part The part that contain state.
2938 * @param state The name of the state to get rel2 offset y value (not including the state value).
2939 * @param value The state value.
2940 *
2941 * @return The gradient rel2 vertical offset value.
2942 */
2943EAPI int edje_edit_state_gradient_rel2_offset_y_get(Evas_Object *obj, const char *part, const char *state, double value);
2944
2945/** Set the gradient rel1 horizontal offset value
2946 *
2947 * @param obj Object being edited.
2948 * @param part The part that contain state.
2949 * @param state The name of the state to set rel1 offset x value (not including the state value).
2950 * @param value The state value.
2951 * @param val The rel1 offset x value.
2952 *
2953 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
2954 */
2955EAPI Eina_Bool edje_edit_state_gradient_rel1_offset_x_set(Evas_Object *obj, const char *part, const char *state, double value, int val);
2956
2957/** Set the gradient rel1 vertical offset value
2958 *
2959 * @param obj Object being edited.
2960 * @param part The part that contain state.
2961 * @param state The name of the state to set rel1 offset y value (not including the state value).
2962 * @param value The state value.
2963 * @param val The rel1 offset y value.
2964 *
2965 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
2966 */
2967EAPI Eina_Bool edje_edit_state_gradient_rel1_offset_y_set(Evas_Object *obj, const char *part, const char *state, double value, int val);
2968
2969/** Set the gradient rel2 horizontal offset value
2970 *
2971 * @param obj Object being edited.
2972 * @param part The part that contain state.
2973 * @param state The name of the state to set rel2 offset x value (not including the state value).
2974 * @param value The state value.
2975 * @param val The rel2 offset x value.
2976 *
2977 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
2978 */
2979EAPI Eina_Bool edje_edit_state_gradient_rel2_offset_x_set(Evas_Object *obj, const char *part, const char *state, double value, int val);
2980
2981/** Set the gradient rel2 vertical offset value
2982 *
2983 * @param obj Object being edited.
2984 * @param part The part that contain state.
2985 * @param state The name of the state to set rel2 offset y value (not including the state value).
2986 * @param value The state value.
2987 * @param val The rel2 offset y value.
2988 *
2989 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
2990 */
2991EAPI Eina_Bool edje_edit_state_gradient_rel2_offset_y_set(Evas_Object *obj, const char *part, const char *state, double value, int val);
2992
2993
2994//@}
2995/******************************************************************************/
2996/************************* PROGRAMS API ***********************************/
2997/******************************************************************************/
2998/** @name Programs API
2999 * Functions to deal with programs (see @ref edcref).
3000 */ //@{
3001
3002/** Get the list of all the programs in the given edje object.
3003 *
3004 * Use edje_edit_string_list_free() when you don't need it anymore.
3005 *
3006 * @param obj Object being edited.
3007 *
3008 * @return A list containing all the program names.
3009 */
3010EAPI Eina_List * edje_edit_programs_list_get(Evas_Object *obj);
3011
3012/** Add a new program to the edje file
3013 *
3014 * If a program with the same name just exist the function will fail.
3015 *
3016 * @param obj Object being edited.
3017 * @param name The name of the new program.
3018 *
3019 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
3020 */
3021EAPI Eina_Bool edje_edit_program_add(Evas_Object *obj, const char *name);
3022
3023/** Remove the given program from the edje file.
3024 *
3025 * @param obj Object being edited.
3026 * @param prog The name of the program to remove.
3027 *
3028 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
3029 */
3030EAPI Eina_Bool edje_edit_program_del(Evas_Object *obj, const char *prog);
3031
3032/** Check if a program with the given name exist in the edje object.
3033 *
3034 * @param obj Object being edited.
3035 * @param prog The prog of the program that will be searched.
3036 *
3037 * @return EINA_TRUE if the program exist, EINA_FALSE otherwise.
3038 */
3039EAPI Eina_Bool edje_edit_program_exist(Evas_Object *obj, const char *prog);
3040
3041/** Run the given program.
3042 *
3043 * @param obj Object being edited.
3044 * @param prog The name of the program to execute.
3045 *
3046 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
3047 */
3048EAPI Eina_Bool edje_edit_program_run(Evas_Object *obj, const char *prog);
3049
3050/** Set a new name for the given program
3051 *
3052 * @param obj Object being edited.
3053 * @param prog The current program name.
3054 * @param new_name The new name to assign.
3055 *
3056 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
3057 */
3058EAPI Eina_Bool edje_edit_program_name_set(Evas_Object *obj, const char *prog, const char *new_name);
3059
3060/** Get source of a given program.
3061 *
3062 * Remember to free the returned string using edje_edit_string_free().
3063 *
3064 * @param obj Object being edited.
3065 * @param prog The name of the program to get source.
3066 *
3067 * @return The source value por program.
3068 */
3069EAPI const char * edje_edit_program_source_get(Evas_Object *obj, const char *prog);
3070
3071/** Set source of the given program.
3072 *
3073 * @param obj Object being edited.
3074 * @param prog The name of the program to set source.
3075 * @param source The new source value.
3076 *
3077 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
3078 */
3079EAPI Eina_Bool edje_edit_program_source_set(Evas_Object *obj, const char *prog, const char *source);
3080
3081/** Get signal of a given program.
3082 *
3083 * Remember to free the returned string using edje_edit_string_free().
3084 *
3085 * @param obj Object being edited.
3086 * @param prog The name of the program to get the signal.
3087 *
3088 * @return The signal value for program.
3089 */
3090EAPI const char * edje_edit_program_signal_get(Evas_Object *obj, const char *prog);
3091
3092/** Set signal of the given program.
3093 *
3094 * @param obj Object being edited.
3095 * @param prog The name of the program to set the signal.
3096 * @param signal The new signal value.
3097 *
3098 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
3099 */
3100EAPI Eina_Bool edje_edit_program_signal_set(Evas_Object *obj, const char *prog, const char *signal);
3101
3102/** Get in.from of a given program.
3103 *
3104 * @param obj Object being edited.
3105 * @param prog The name of the program to get the delay.
3106 *
3107 * @return The delay.
3108 */
3109EAPI double edje_edit_program_in_from_get(Evas_Object *obj, const char *prog);
3110
3111/** Set in.from of a given program.
3112 *
3113 * @param obj Object being edited.
3114 * @param prog The name of the program to set the delay.
3115 * @param seconds Number of seconds to delay the program execution
3116 *
3117 * */
3118EAPI Eina_Bool edje_edit_program_in_from_set(Evas_Object *obj, const char *prog, double seconds);
3119
3120/** Get in.range of a given program.
3121 *
3122 * @param obj Object being edited.
3123 * @param prog The name of the program to get random delay.
3124 *
3125 * @return The delay random.
3126 */
3127EAPI double edje_edit_program_in_range_get(Evas_Object *obj, const char *prog);
3128
3129/** Set in.range of a given program.
3130 *
3131 * @param obj Object being edited.
3132 * @param prog The name of the program to set random delay.
3133 * @param seconds Max random number of seconds to delay.
3134 *
3135 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
3136 */
3137EAPI Eina_Bool edje_edit_program_in_range_set(Evas_Object *obj, const char *prog, double seconds);
3138
3139/** Get the action of a given program.
3140 *
3141 * @param obj Object being edited.
3142 * @param prog The name of the program to get the action.
3143 *
3144 * @return The action type, or -1 on errors.
3145 * Action can be one of EDJE_ACTION_TYPE_NONE, _STATE_SET, ACTION_STOP, SIGNAL_EMIT, DRAG_VAL_SET, _DRAG_VAL_STEP, _DRAG_VAL_PAGE, _SCRIPT
3146 */
3147EAPI Edje_Action_Type edje_edit_program_action_get(Evas_Object *obj, const char *prog);
3148
3149/** Set the action of a given program.
3150 *
3151 * Action can be one of EDJE_ACTION_TYPE_NONE, _STATE_SET, ACTION_STOP, SIGNAL_EMIT, DRAG_VAL_SET, _DRAG_VAL_STEP, _DRAG_VAL_PAGE, _SCRIPT
3152 *
3153 * @param obj Object being edited.
3154 * @param prog The name of the program to set the action.
3155 * @param action The new action type.
3156 *
3157 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
3158 */
3159EAPI Eina_Bool edje_edit_program_action_set(Evas_Object *obj, const char *prog, Edje_Action_Type action);
3160
3161/** Get the list of the targets for the given program.
3162 *
3163 * Use edje_edit_string_list_free() when you don't need it anymore.
3164 *
3165 * @param obj Object being edited.
3166 * @param prog The name of the progrem to get the list of the targets.
3167 *
3168 * @return A list with all the targets names, or NULL on error.
3169 */
3170EAPI Eina_List * edje_edit_program_targets_get(Evas_Object *obj, const char *prog);
3171
3172/** Add a new target program to the list of 'targets' in the given program.
3173 *
3174 * If program action is @c EDJE_ACTION_TYPE_ACTION_STOP, then 'target'
3175 * must be an existing program name. If it's @c
3176 * EDJE_ACTION_TYPE_STATE_SET, then 'target' must be an existing part
3177 * name.
3178 *
3179 * @param obj Object being edited.
3180 * @param prog The name of the program to add a new target.
3181 * @param target The name of the new target itself.
3182 *
3183 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
3184 */
3185EAPI Eina_Bool edje_edit_program_target_add(Evas_Object *obj, const char *prog, const char *target);
3186
3187/** Deletes a target from the list of 'targets' in the given program.
3188 *
3189 * If program action is EDJE_ACTION_TYPE_ACTION_STOP then 'target' must be an existing program name.
3190 * If action is EDJE_ACTION_TYPE_STATE_SET then 'target' must be an existing part name.
3191 *
3192 * @param obj Object being edited.
3193 * @param prog The name of the program to del a target from the list of targets.
3194 * @param target The name of another program or another part.
3195 *
3196 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
3197 */
3198EAPI Eina_Bool edje_edit_program_target_del(Evas_Object *obj, const char *prog, const char *target);
3199
3200/** Clear the 'targets' list of the given program
3201 *
3202 * @param obj Object being edited.
3203 * @param prog The name of the program to cleaar the 'targets' list.
3204 *
3205 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
3206 */
3207EAPI Eina_Bool edje_edit_program_targets_clear(Evas_Object *obj, const char *prog);
3208
3209/** Get the list of action that will be run after the give program
3210 *
3211 * Use edje_edit_string_list_free() when you don't need it anymore.
3212 *
3213 * @param obj Object being edited.
3214 * @param prog The name of the program to get the list of actions
3215 *
3216 * @return A list with all program names. or NULL on error.
3217 */
3218EAPI Eina_List * edje_edit_program_afters_get(Evas_Object *obj, const char *prog);
3219
3220/** Add a new program name to the list of 'afters' in the given program.
3221 *
3222 * All the programs listed in 'afters' will be executed after program execution.
3223 *
3224 * @param obj Object being edited.
3225 * @param prog The name of the program that contains the list of afters
3226 * @param after The name of another program to add to the afters list
3227 *
3228 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
3229 */
3230EAPI Eina_Bool edje_edit_program_after_add(Evas_Object *obj, const char *prog, const char *after);
3231
3232/** Delete the given program from the list of 'afters' of the program.
3233 *
3234 * @param obj Object being edited.
3235 * @param prog The name of the program from where to remove the after.
3236 * @param after The name of the program to remove from the list of afters.
3237 *
3238 * @return EINA_TRUE is successful or not in the list, EINA_FALSE otherwise.
3239 */
3240EAPI Eina_Bool edje_edit_program_after_del(Evas_Object *obj, const char *prog, const char *after);
3241
3242/** Clear the 'afters' list of the given program.
3243 *
3244 * @param obj Object being edited.
3245 * @param prog The name of the program to clear the 'afters' list.
3246 *
3247 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
3248 */
3249EAPI Eina_Bool edje_edit_program_afters_clear(Evas_Object *obj, const char *prog);
3250
3251/** Get the state for the given program
3252 *
3253 * In a STATE_SET action this is the name of state to set.
3254 * In a SIGNAL_EMIT action is the name of the signal to emit.
3255 *
3256 * @param obj Object being edited.
3257 * @param prog The name of the program to get the state.
3258 *
3259 * @return The name of the state.
3260 */
3261EAPI const char * edje_edit_program_state_get(Evas_Object *obj, const char *prog);
3262
3263/** Get api's name of a program.
3264 *
3265 * @param obj Object being edited.
3266 * @param prog Name of program.
3267 *
3268 * @return name of the api if successful, NULL otherwise.
3269 */
3270EAPI const char * edje_edit_program_api_name_get(Evas_Object *obj, const char *prog);
3271
3272/** Get api's description of a program.
3273 *
3274 * @param obj Object being edited.
3275 * @param prog Name of program.
3276 *
3277 * @return description of the api if successful, NULL otherwise.
3278 */
3279EAPI const char * edje_edit_program_api_description_get(Evas_Object *obj, const char *prog);
3280
3281/** Set api's name of a program.
3282 *
3283 * @param obj Object being edited.
3284 * @param prog Name of the part.
3285 * @param name New name for the api property.
3286 *
3287 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
3288 */
3289EAPI Eina_Bool edje_edit_program_api_name_set(Evas_Object *obj, const char *prog, const char *name);
3290
3291/** Set api's description of a program.
3292 *
3293 * @param obj Object being edited.
3294 * @param prog Name of the program.
3295 * @param description New description for the api property.
3296 *
3297 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
3298 */
3299EAPI Eina_Bool edje_edit_program_api_description_set(Evas_Object *obj, const char *prog, const char *description);
3300
3301/** Set the state for the given program
3302 *
3303 * In a STATE_SET action this is the name of state to set.
3304 * In a SIGNAL_EMIT action is the name of the signal to emit.
3305 *
3306 * @param obj Object being edited.
3307 * @param prog The name of the program to set a state.
3308 * @param state The nameo of the state to set (not including the state value)
3309 *
3310 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
3311 */
3312EAPI Eina_Bool edje_edit_program_state_set(Evas_Object *obj, const char *prog, const char *state);
3313
3314/** Get the value of state for the given program.
3315 *
3316 * In a STATE_SET action this is the value of state to set.
3317 * Not used on SIGNAL_EMIT action.
3318 *
3319 * @param obj Object being edited.
3320 * @param prog The name of the program to get the value of state.
3321 *
3322 * @return The value of state for the program.
3323 */
3324EAPI double edje_edit_program_value_get(Evas_Object *obj, const char *prog);
3325
3326/** Set the value of state for the given program.
3327 *
3328 * In a STATE_SET action this is the value of state to set.
3329 * Not used on SIGNAL_EMIT action.
3330 *
3331 * @param obj Object being edited.
3332 * @param prog The name of the program to set the value of state.
3333 * @param value The vale to set.
3334 *
3335 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
3336 */
3337EAPI Eina_Bool edje_edit_program_value_set(Evas_Object *obj, const char *prog, double value);
3338
3339/** Get the state2 for the given program
3340 *
3341 * In a STATE_SET action is not used
3342 * In a SIGNAL_EMIT action is the source of the emitted signal.
3343 *
3344 * @param obj Object being edited.
3345 * @param prog The name of the program to get the state2.
3346 *
3347 * @return The source to emit for the program.
3348 */
3349EAPI const char * edje_edit_program_state2_get(Evas_Object *obj, const char *prog);
3350
3351/** Set the state2 for the given program
3352 *
3353 * In a STATE_SET action is not used
3354 * In a SIGNAL_EMIT action is the source of the emitted signal.
3355 *
3356 * @param obj Object being edited.
3357 * @param prog The name of the program to set the state2.
3358 * @param state2 The name of the state to set.
3359 *
3360 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
3361 */
3362EAPI Eina_Bool edje_edit_program_state2_set(Evas_Object *obj, const char *prog, const char *state2);
3363
3364/** Get the value of state2 for the given program.
3365 *
3366 * @param obj Object being edited.
3367 * @param prog The name of the program to get the state2 value.
3368 *
3369 * @return The vale of the state2 for the program.
3370 */
3371EAPI double edje_edit_program_value2_get(Evas_Object *obj, const char *prog);
3372
3373/** Set the value2 of state for the given program.
3374 *
3375 * This is used in DRAG_ACTION
3376 *
3377 * @param obj Object being edited.
3378 * @param prog The name of the program to set the state2 value.
3379 * @param value The value of the state2 to set.
3380 */
3381EAPI Eina_Bool edje_edit_program_value2_set(Evas_Object *obj, const char *prog, double value);
3382
3383/** Get the type of transition to use when apply animations.
3384 *
3385 * Can be one of: EDJE_TWEEN_MODE_NONE, EDJE_TWEEN_MODE_LINEAR, EDJE_TWEEN_MODE_SINUSOIDAL, EDJE_TWEEN_MODE_ACCELERATE or EDJE_TWEEN_MODE_DECELERATE.
3386 *
3387 * @param obj Object being edited.
3388 * @param prog The name of the program to get the transition.
3389 *
3390 * @return The type of transition used by program.
3391 */
3392EAPI Edje_Tween_Mode edje_edit_program_transition_get(Evas_Object *obj, const char *prog);
3393
3394/** Set the type of transition to use when apply animations.
3395 *
3396 * Can be one of: EDJE_TWEEN_MODE_NONE, EDJE_TWEEN_MODE_LINEAR, EDJE_TWEEN_MODE_SINUSOIDAL, EDJE_TWEEN_MODE_ACCELERATE or EDJE_TWEEN_MODE_DECELERATE.
3397 *
3398 * @param obj Object being edited.
3399 * @param prog The name of the program to set the transition.
3400 * @param transition The transition type to set
3401 *
3402 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
3403 */
3404EAPI Eina_Bool edje_edit_program_transition_set(Evas_Object *obj, const char *prog, Edje_Tween_Mode transition);
3405
3406/** Get the duration of the transition in seconds.
3407 *
3408 * @param obj Object being edited.
3409 * @param prog The name of the program to get the transition time.
3410 *
3411 * @return The duration of the transition.
3412 */
3413EAPI double edje_edit_program_transition_time_get(Evas_Object *obj, const char *prog);
3414
3415/** Set the duration of the transition in seconds.
3416 *
3417 * @param obj Object being edited.
3418 * @param prog The name of the program to set the transition time.
3419 * @param seconds The duration of the transition (in seconds).
3420 *
3421 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
3422 */
3423EAPI Eina_Bool edje_edit_program_transition_time_set(Evas_Object *obj, const char *prog, double seconds);
3424
3425EAPI const char * edje_edit_program_filter_part_get(Evas_Object *obj, const char *prog);
3426EAPI Eina_Bool edje_edit_program_filter_part_set(Evas_Object *obj, const char *prog, const char *filter_part);
3427
3428//@}
3429/******************************************************************************/
3430/************************** SCRIPTS API ***********************************/
3431/******************************************************************************/
3432/** @name Scripts API
3433 * Functions to deal with embryo scripts (see @ref edcref).
3434 */ //@{
3435
3436/**
3437 * Get the Embryo script for the group of the given object.
3438 *
3439 * Get the shared script for the group under edition. Shared script means
3440 * the script {} block for the group, not counting what's in each program.
3441 * It returns a malloc'd duplicate of the code, so users are free to modify
3442 * the contents directly and they should remember to free() it when done.
3443 * NULL will be returned if there's no script or an error occurred.
3444 *
3445 * @param obj Object being edited.
3446 *
3447 * @return The shared script code for this group.
3448 */
3449EAPI char *edje_edit_script_get(Evas_Object *obj);
3450
3451/**
3452 * Set the code for the group script.
3453 *
3454 * Set the Embryo source code for the shared script of the edited group.
3455 * Note that changing the code itself will not update the running VM, you
3456 * need to call edje_edit_script_compile for it to get updated.
3457 *
3458 * @param obj The object being edited
3459 * @param code The Embryo source
3460 */
3461EAPI void edje_edit_script_set(Evas_Object *obj, const char *code);
3462
3463/**
3464 * Get the Embryo script for the given program.
3465 *
3466 * Get the script code for the given program. Like the group script, this
3467 * function returns a duplicate of the code that the user can modify at will
3468 * and must free when done using it.
3469 * NULL will be returned if the program doesn't exist, doesn't have any
3470 * script or is not of type script.
3471 *
3472 * @param obj Object being edited
3473 * @param prog Program name
3474 *
3475 * @return The program script code
3476 */
3477EAPI char *edje_edit_script_program_get(Evas_Object *obj, const char *prog);
3478
3479/**
3480 * Set the Embryo script for the given program.
3481 *
3482 * Set the Embryo source code for the program @p prog. It must be an
3483 * existing program of type EDJE_ACTION_TYPE_SCRIPT, or the function
3484 * will fail and do nothing.
3485 * Note that changing the code itself will not update the running VM, you
3486 * need to call edje_edit_script_compile for it to get updated.
3487 *
3488 * @param obj The object being edited
3489 * @param prog The program name.
3490 * @param code The Embryo source
3491 */
3492EAPI void edje_edit_script_program_set(Evas_Object *obj, const char *prog, const char *code);
3493
3494/**
3495 * Compile the Embryo script for the given object
3496 *
3497 * If required, this function will process all script code for the group and
3498 * build the bytecode, updating the running Embryo VM Program if the build
3499 * is succesful.
3500 *
3501 * @param obj The object being edited
3502 *
3503 */
3504EAPI Eina_Bool edje_edit_script_compile(Evas_Object *obj);
3505
3506/**
3507 * Get the list of errors resulting from the last script build
3508 *
3509 * Get the list of errors that resulted from the last attempt to rebuild
3510 * the Embryo script for the edited group. This will be a standard Eina_List
3511 * with Edje_Edit_Script_Error pointers as its data.
3512 * The user should not do anything else but read the contents of this list.
3513 * These errors can be the output of the embryo compiler, or internal errors
3514 * generated by Edje_Edit if the preprocessing of the scripts failed.
3515 *
3516 * @param obj The object being edited
3517 *
3518 * @return A constant list of Edje_Edit_Script_Error, or NULL if there are none
3519 */
3520EAPI const Eina_List *edje_edit_script_error_list_get(Evas_Object *obj);
3521
3522//@}
3523/******************************************************************************/
3524/************************** ERROR API ***********************************/
3525/******************************************************************************/
3526/** @name Error API
3527 * to deal with error messages (see @ref edcref).
3528 */ //@{
3529
3530EAPI extern Eina_Error EDJE_EDIT_ERROR_GROUP_CURRENTLY_USED;
3531EAPI extern Eina_Error EDJE_EDIT_ERROR_GROUP_REFERENCED;
3532EAPI extern Eina_Error EDJE_EDIT_ERROR_GROUP_DOES_NOT_EXIST;
3533
3534
3535#ifdef __cplusplus
3536}
3537#endif
3538
3539#endif
diff --git a/libraries/edje/src/lib/Makefile.am b/libraries/edje/src/lib/Makefile.am
new file mode 100644
index 0000000..5a76ef3
--- /dev/null
+++ b/libraries/edje/src/lib/Makefile.am
@@ -0,0 +1,140 @@
1
2MAINTAINERCLEANFILES = Makefile.in
3
4AM_CPPFLAGS = \
5-I. \
6-I$(top_srcdir) \
7-I$(top_srcdir)/src/bin \
8-I$(top_srcdir)/src/lib \
9-DPACKAGE_BIN_DIR=\"$(bindir)\" \
10-DPACKAGE_LIB_DIR=\"$(libdir)\" \
11-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
12@EVIL_CFLAGS@ \
13@EDJE_CFLAGS@ \
14@ECORE_IMF_CFLAGS@ \
15@EFL_EDJE_BUILD@ \
16@REMIX_CFLAGS@ \
17@SNDFILE_CFLAGS@
18
19lib_LTLIBRARIES = libedje.la
20
21includes_HEADERS = Edje.h Edje_Edit.h
22includesdir = $(includedir)/edje-@VMAJ@
23
24base_sources = \
25edje_box_layout.c \
26edje_cache.c \
27edje_calc.c \
28edje_callbacks.c \
29edje_container.c \
30edje_data.c \
31edje_edit.c \
32edje_embryo.c \
33edje_entry.c \
34edje_external.c \
35edje_load.c \
36edje_lua.c \
37edje_lua2.c \
38edje_lua_script_only.c \
39edje_main.c \
40edje_match.c \
41edje_message_queue.c \
42edje_misc.c \
43edje_module.c \
44edje_multisense.c \
45edje_program.c \
46edje_script_only.c \
47edje_smart.c \
48edje_text.c \
49edje_textblock_styles.c \
50edje_util.c \
51edje_var.c
52
53if EDJE_AMALGAMATION
54nodist_libedje_la_SOURCES = edje_amalgamation.c
55
56edje_amalgamation.c: $(base_sources) Makefile
57 -rm -f edje_amalgamation.c
58
59 @echo "#ifdef HAVE_CONFIG_H" >> edje_amalgamation.c
60 @echo "# include \"config.h\"" >> edje_amalgamation.c
61 @echo "#endif" >> edje_amalgamation.c
62
63 @echo "#ifndef _WIN32" >> edje_amalgamation.c
64 @echo "#define _GNU_SOURCE" >> edje_amalgamation.c
65 @echo "#endif" >> edje_amalgamation.c
66
67 @echo "#ifdef HAVE_ALLOCA_H" >> edje_amalgamation.c
68 @echo "# include <alloca.h>" >> edje_amalgamation.c
69 @echo "#elif defined __GNUC__" >> edje_amalgamation.c
70 @echo "# define alloca __builtin_alloca" >> edje_amalgamation.c
71 @echo "#elif defined _AIX" >> edje_amalgamation.c
72 @echo "# define alloca __alloca" >> edje_amalgamation.c
73 @echo "#elif defined _MSC_VER" >> edje_amalgamation.c
74 @echo "# include <malloc.h>" >> edje_amalgamation.c
75 @echo "# define alloca _alloca" >> edje_amalgamation.c
76 @echo "#else" >> edje_amalgamation.c
77 @echo "# include <stddef.h>" >> edje_amalgamation.c
78 @echo "# ifdef __cplusplus" >> edje_amalgamation.c
79 @echo "#extern \"C\"" >> edje_amalgamation.c
80 @echo "# endif" >> edje_amalgamation.c
81 @echo "#void *alloca (size_t);" >> edje_amalgamation.c
82 @echo "#endif" >> edje_amalgamation.c
83
84 @echo "#include <string.h>" >> edje_amalgamation.c
85 @echo "#include <math.h>" >> edje_amalgamation.c
86 @echo "#include <time.h>" >> edje_amalgamation.c
87 @echo "#include <limits.h>" >> edje_amalgamation.c
88 @echo "#include <errno.h>" >> edje_amalgamation.c
89 @echo "#include <sys/stat.h>" >> edje_amalgamation.c
90 @echo "#include <fcntl.h>" >> edje_amalgamation.c
91
92 @echo "#ifndef _MSC_VER" >> edje_amalgamation.c
93 @echo "# include <unistd.h>" >> edje_amalgamation.c
94 @echo "#endif" >> edje_amalgamation.c
95
96 @echo "#ifdef HAVE_LOCALE_H" >> edje_amalgamation.c
97 @echo "# include <locale.h>" >> edje_amalgamation.c
98 @echo "#endif" >> edje_amalgamation.c
99
100 @echo "#include <lua.h>" >> edje_amalgamation.c
101 @echo "#include <lauxlib.h>" >> edje_amalgamation.c
102
103 @echo "#ifdef HAVE_EVIL" >> edje_amalgamation.c
104 @echo "# include <Evil.h>" >> edje_amalgamation.c
105 @echo "#endif" >> edje_amalgamation.c
106
107 @echo "#include <Eina.h>" >> edje_amalgamation.c
108 @echo "#include <Edje.h>" >> edje_amalgamation.c
109 @echo "#include <Evas.h>" >> edje_amalgamation.c
110 @echo "#include <Ecore.h>" >> edje_amalgamation.c
111 @echo "#include <Embryo.h>" >> edje_amalgamation.c
112
113 @echo "#ifdef HAVE_ECORE_IMF" >> edje_amalgamation.c
114 @echo "# include <Ecore_IMF.h>" >> edje_amalgamation.c
115 @echo "#endif" >> edje_amalgamation.c
116
117 @echo "#include <edje_private.h>" >> edje_amalgamation.c
118
119 @for f in $(base_sources); do \
120 if [ `echo $$f | sed -e 's/^...\(.\).*/\1/'` != '/' ]; then \
121 file="$(srcdir)/$$f" ; \
122 else \
123 file="$$f" ; \
124 fi ; \
125 echo "/* file: $$file */" >> edje_amalgamation.c; \
126 grep -v -e '^# *include \+.\(config\|\|Evil\|Eina\|Eet\|Evas\|Ecore\|Embryo\|Ecore_IMF\|string\|math\|limits\|sys/stat\|errno\|time\|unistd\|locale\|lua\|lauxlib\|edje_private\)[.]h.*' $$file >> edje_amalgamation.c; \
127 done
128 @echo "edje_amalgamation.c generated"
129
130else
131libedje_la_SOURCES = $(base_sources)
132endif
133
134libedje_la_LIBADD = @EDJE_LIBS@ @ECORE_IMF_LIBS@ @EVIL_LIBS@ @REMIX_LIBS@ @SNDFILE_LIBS@ -lm
135libedje_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
136
137EXTRA_DIST = edje_private.h edje_container.h edje_convert.h
138
139clean-local:
140 @rm -rf *.gcno edje_amalgamation.c
diff --git a/libraries/edje/src/lib/Makefile.in b/libraries/edje/src/lib/Makefile.in
new file mode 100644
index 0000000..cf73390
--- /dev/null
+++ b/libraries/edje/src/lib/Makefile.in
@@ -0,0 +1,810 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18
19VPATH = @srcdir@
20pkgdatadir = $(datadir)/@PACKAGE@
21pkgincludedir = $(includedir)/@PACKAGE@
22pkglibdir = $(libdir)/@PACKAGE@
23pkglibexecdir = $(libexecdir)/@PACKAGE@
24am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
25install_sh_DATA = $(install_sh) -c -m 644
26install_sh_PROGRAM = $(install_sh) -c
27install_sh_SCRIPT = $(install_sh) -c
28INSTALL_HEADER = $(INSTALL_DATA)
29transform = $(program_transform_name)
30NORMAL_INSTALL = :
31PRE_INSTALL = :
32POST_INSTALL = :
33NORMAL_UNINSTALL = :
34PRE_UNINSTALL = :
35POST_UNINSTALL = :
36build_triplet = @build@
37host_triplet = @host@
38subdir = src/lib
39DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \
40 $(srcdir)/Makefile.in
41ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
42am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
43 $(top_srcdir)/m4/efl_binary.m4 \
44 $(top_srcdir)/m4/efl_coverage.m4 \
45 $(top_srcdir)/m4/efl_doxygen.m4 \
46 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
47 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
48 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
49 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
50am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
51 $(ACLOCAL_M4)
52mkinstalldirs = $(install_sh) -d
53CONFIG_HEADER = $(top_builddir)/config.h
54CONFIG_CLEAN_FILES =
55CONFIG_CLEAN_VPATH_FILES =
56am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
57am__vpath_adj = case $$p in \
58 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
59 *) f=$$p;; \
60 esac;
61am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
62am__install_max = 40
63am__nobase_strip_setup = \
64 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
65am__nobase_strip = \
66 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
67am__nobase_list = $(am__nobase_strip_setup); \
68 for p in $$list; do echo "$$p $$p"; done | \
69 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
70 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
71 if (++n[$$2] == $(am__install_max)) \
72 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
73 END { for (dir in files) print dir, files[dir] }'
74am__base_list = \
75 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
76 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
77am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"
78LTLIBRARIES = $(lib_LTLIBRARIES)
79libedje_la_DEPENDENCIES =
80am__libedje_la_SOURCES_DIST = edje_box_layout.c edje_cache.c \
81 edje_calc.c edje_callbacks.c edje_container.c edje_data.c \
82 edje_edit.c edje_embryo.c edje_entry.c edje_external.c \
83 edje_load.c edje_lua.c edje_lua2.c edje_lua_script_only.c \
84 edje_main.c edje_match.c edje_message_queue.c edje_misc.c \
85 edje_module.c edje_multisense.c edje_program.c \
86 edje_script_only.c edje_smart.c edje_text.c \
87 edje_textblock_styles.c edje_util.c edje_var.c
88am__objects_1 = edje_box_layout.lo edje_cache.lo edje_calc.lo \
89 edje_callbacks.lo edje_container.lo edje_data.lo edje_edit.lo \
90 edje_embryo.lo edje_entry.lo edje_external.lo edje_load.lo \
91 edje_lua.lo edje_lua2.lo edje_lua_script_only.lo edje_main.lo \
92 edje_match.lo edje_message_queue.lo edje_misc.lo \
93 edje_module.lo edje_multisense.lo edje_program.lo \
94 edje_script_only.lo edje_smart.lo edje_text.lo \
95 edje_textblock_styles.lo edje_util.lo edje_var.lo
96@EDJE_AMALGAMATION_FALSE@am_libedje_la_OBJECTS = $(am__objects_1)
97@EDJE_AMALGAMATION_TRUE@nodist_libedje_la_OBJECTS = \
98@EDJE_AMALGAMATION_TRUE@ edje_amalgamation.lo
99libedje_la_OBJECTS = $(am_libedje_la_OBJECTS) \
100 $(nodist_libedje_la_OBJECTS)
101AM_V_lt = $(am__v_lt_$(V))
102am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
103am__v_lt_0 = --silent
104libedje_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
105 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
106 $(libedje_la_LDFLAGS) $(LDFLAGS) -o $@
107DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
108depcomp = $(SHELL) $(top_srcdir)/depcomp
109am__depfiles_maybe = depfiles
110am__mv = mv -f
111COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
112 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
113LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
114 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
115 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
116 $(AM_CFLAGS) $(CFLAGS)
117AM_V_CC = $(am__v_CC_$(V))
118am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
119am__v_CC_0 = @echo " CC " $@;
120AM_V_at = $(am__v_at_$(V))
121am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
122am__v_at_0 = @
123CCLD = $(CC)
124LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
125 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
126 $(AM_LDFLAGS) $(LDFLAGS) -o $@
127AM_V_CCLD = $(am__v_CCLD_$(V))
128am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
129am__v_CCLD_0 = @echo " CCLD " $@;
130AM_V_GEN = $(am__v_GEN_$(V))
131am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
132am__v_GEN_0 = @echo " GEN " $@;
133SOURCES = $(libedje_la_SOURCES) $(nodist_libedje_la_SOURCES)
134DIST_SOURCES = $(am__libedje_la_SOURCES_DIST)
135HEADERS = $(includes_HEADERS)
136ETAGS = etags
137CTAGS = ctags
138DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
139ACLOCAL = @ACLOCAL@
140ALLOCA = @ALLOCA@
141ALSA_CFLAGS = @ALSA_CFLAGS@
142ALSA_LIBS = @ALSA_LIBS@
143AMTAR = @AMTAR@
144AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
145AR = @AR@
146AS = @AS@
147AUTOCONF = @AUTOCONF@
148AUTOHEADER = @AUTOHEADER@
149AUTOMAKE = @AUTOMAKE@
150AWK = @AWK@
151CC = @CC@
152CCDEPMODE = @CCDEPMODE@
153CFLAGS = @CFLAGS@
154CHECK_CFLAGS = @CHECK_CFLAGS@
155CHECK_LIBS = @CHECK_LIBS@
156CPP = @CPP@
157CPPFLAGS = @CPPFLAGS@
158CYGPATH_W = @CYGPATH_W@
159DEFS = @DEFS@
160DEPDIR = @DEPDIR@
161DLLTOOL = @DLLTOOL@
162DSYMUTIL = @DSYMUTIL@
163DUMPBIN = @DUMPBIN@
164ECHO_C = @ECHO_C@
165ECHO_N = @ECHO_N@
166ECHO_T = @ECHO_T@
167ECORE_IMF_CFLAGS = @ECORE_IMF_CFLAGS@
168ECORE_IMF_LIBS = @ECORE_IMF_LIBS@
169EDJE_CC_CFLAGS = @EDJE_CC_CFLAGS@
170EDJE_CC_LIBS = @EDJE_CC_LIBS@
171EDJE_CC_PRG = @EDJE_CC_PRG@
172EDJE_CFLAGS = @EDJE_CFLAGS@
173EDJE_DECC_CFLAGS = @EDJE_DECC_CFLAGS@
174EDJE_DECC_LIBS = @EDJE_DECC_LIBS@
175EDJE_DECC_PRG = @EDJE_DECC_PRG@
176EDJE_EXTERNAL_INSPECTOR_CFLAGS = @EDJE_EXTERNAL_INSPECTOR_CFLAGS@
177EDJE_EXTERNAL_INSPECTOR_LIBS = @EDJE_EXTERNAL_INSPECTOR_LIBS@
178EDJE_EXTERNAL_INSPECTOR_PRG = @EDJE_EXTERNAL_INSPECTOR_PRG@
179EDJE_INSPECTOR_CFLAGS = @EDJE_INSPECTOR_CFLAGS@
180EDJE_INSPECTOR_LIBS = @EDJE_INSPECTOR_LIBS@
181EDJE_INSPECTOR_PRG = @EDJE_INSPECTOR_PRG@
182EDJE_LIBS = @EDJE_LIBS@
183EDJE_PLAYER_CFLAGS = @EDJE_PLAYER_CFLAGS@
184EDJE_PLAYER_LIBS = @EDJE_PLAYER_LIBS@
185EDJE_PLAYER_PRG = @EDJE_PLAYER_PRG@
186EDJE_RECC_PRG = @EDJE_RECC_PRG@
187EFL_COVERAGE_CFLAGS = @EFL_COVERAGE_CFLAGS@
188EFL_COVERAGE_LIBS = @EFL_COVERAGE_LIBS@
189EFL_EDJE_BUILD = @EFL_EDJE_BUILD@
190EGREP = @EGREP@
191EVIL_CFLAGS = @EVIL_CFLAGS@
192EVIL_LIBS = @EVIL_LIBS@
193EXEEXT = @EXEEXT@
194FGREP = @FGREP@
195FLAC_CFLAGS = @FLAC_CFLAGS@
196FLAC_LIBS = @FLAC_LIBS@
197GREP = @GREP@
198INSTALL = @INSTALL@
199INSTALL_DATA = @INSTALL_DATA@
200INSTALL_PROGRAM = @INSTALL_PROGRAM@
201INSTALL_SCRIPT = @INSTALL_SCRIPT@
202INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
203LD = @LD@
204LDFLAGS = @LDFLAGS@
205LIBOBJS = @LIBOBJS@
206LIBS = @LIBS@
207LIBTOOL = @LIBTOOL@
208LIPO = @LIPO@
209LN_S = @LN_S@
210LTLIBOBJS = @LTLIBOBJS@
211LUA_CFLAGS = @LUA_CFLAGS@
212LUA_LIBS = @LUA_LIBS@
213MAKEINFO = @MAKEINFO@
214MINIMAL_CFLAGS = @MINIMAL_CFLAGS@
215MINIMAL_LIBS = @MINIMAL_LIBS@
216MKDIR_P = @MKDIR_P@
217MODULE_ARCH = @MODULE_ARCH@
218NM = @NM@
219NMEDIT = @NMEDIT@
220OBJDUMP = @OBJDUMP@
221OBJEXT = @OBJEXT@
222OTOOL = @OTOOL@
223OTOOL64 = @OTOOL64@
224PACKAGE = @PACKAGE@
225PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
226PACKAGE_NAME = @PACKAGE_NAME@
227PACKAGE_STRING = @PACKAGE_STRING@
228PACKAGE_TARNAME = @PACKAGE_TARNAME@
229PACKAGE_URL = @PACKAGE_URL@
230PACKAGE_VERSION = @PACKAGE_VERSION@
231PATH_SEPARATOR = @PATH_SEPARATOR@
232PKG_CONFIG = @PKG_CONFIG@
233PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
234PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
235PYTHON = @PYTHON@
236PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
237PYTHON_PLATFORM = @PYTHON_PLATFORM@
238PYTHON_PREFIX = @PYTHON_PREFIX@
239PYTHON_VERSION = @PYTHON_VERSION@
240RANLIB = @RANLIB@
241REMIX_CFLAGS = @REMIX_CFLAGS@
242REMIX_LIBS = @REMIX_LIBS@
243REMIX_PLUGIN_DIR = @REMIX_PLUGIN_DIR@
244SED = @SED@
245SET_MAKE = @SET_MAKE@
246SHELL = @SHELL@
247SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
248SNDFILE_LIBS = @SNDFILE_LIBS@
249STRIP = @STRIP@
250VERSION = @VERSION@
251VMAJ = @VMAJ@
252VORBISENC_CFLAGS = @VORBISENC_CFLAGS@
253VORBISENC_LIBS = @VORBISENC_LIBS@
254abs_builddir = @abs_builddir@
255abs_srcdir = @abs_srcdir@
256abs_top_builddir = @abs_top_builddir@
257abs_top_srcdir = @abs_top_srcdir@
258ac_ct_CC = @ac_ct_CC@
259ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
260am__include = @am__include@
261am__leading_dot = @am__leading_dot@
262am__quote = @am__quote@
263am__tar = @am__tar@
264am__untar = @am__untar@
265bindir = @bindir@
266build = @build@
267build_alias = @build_alias@
268build_cpu = @build_cpu@
269build_os = @build_os@
270build_vendor = @build_vendor@
271builddir = @builddir@
272datadir = @datadir@
273datarootdir = @datarootdir@
274docdir = @docdir@
275dvidir = @dvidir@
276edje_cc = @edje_cc@
277efl_doxygen = @efl_doxygen@
278efl_have_doxygen = @efl_have_doxygen@
279exec_prefix = @exec_prefix@
280have_lcov = @have_lcov@
281host = @host@
282host_alias = @host_alias@
283host_cpu = @host_cpu@
284host_os = @host_os@
285host_vendor = @host_vendor@
286htmldir = @htmldir@
287includedir = @includedir@
288infodir = @infodir@
289install_sh = @install_sh@
290libdir = @libdir@
291libexecdir = @libexecdir@
292localedir = @localedir@
293localstatedir = @localstatedir@
294lt_ECHO = @lt_ECHO@
295lt_enable_auto_import = @lt_enable_auto_import@
296lua_libs = @lua_libs@
297mandir = @mandir@
298mkdir_p = @mkdir_p@
299oldincludedir = @oldincludedir@
300pdfdir = @pdfdir@
301pkgconfig_requires_private = @pkgconfig_requires_private@
302pkgpyexecdir = @pkgpyexecdir@
303pkgpythondir = @pkgpythondir@
304prefix = @prefix@
305program_transform_name = @program_transform_name@
306psdir = @psdir@
307pyexecdir = @pyexecdir@
308pythondir = @pythondir@
309release_info = @release_info@
310requirement_edje = @requirement_edje@
311sbindir = @sbindir@
312sharedstatedir = @sharedstatedir@
313srcdir = @srcdir@
314sysconfdir = @sysconfdir@
315target_alias = @target_alias@
316top_build_prefix = @top_build_prefix@
317top_builddir = @top_builddir@
318top_srcdir = @top_srcdir@
319version_info = @version_info@
320vimdir = @vimdir@
321MAINTAINERCLEANFILES = Makefile.in
322AM_CPPFLAGS = \
323-I. \
324-I$(top_srcdir) \
325-I$(top_srcdir)/src/bin \
326-I$(top_srcdir)/src/lib \
327-DPACKAGE_BIN_DIR=\"$(bindir)\" \
328-DPACKAGE_LIB_DIR=\"$(libdir)\" \
329-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
330@EVIL_CFLAGS@ \
331@EDJE_CFLAGS@ \
332@ECORE_IMF_CFLAGS@ \
333@EFL_EDJE_BUILD@ \
334@REMIX_CFLAGS@ \
335@SNDFILE_CFLAGS@
336
337lib_LTLIBRARIES = libedje.la
338includes_HEADERS = Edje.h Edje_Edit.h
339includesdir = $(includedir)/edje-@VMAJ@
340base_sources = \
341edje_box_layout.c \
342edje_cache.c \
343edje_calc.c \
344edje_callbacks.c \
345edje_container.c \
346edje_data.c \
347edje_edit.c \
348edje_embryo.c \
349edje_entry.c \
350edje_external.c \
351edje_load.c \
352edje_lua.c \
353edje_lua2.c \
354edje_lua_script_only.c \
355edje_main.c \
356edje_match.c \
357edje_message_queue.c \
358edje_misc.c \
359edje_module.c \
360edje_multisense.c \
361edje_program.c \
362edje_script_only.c \
363edje_smart.c \
364edje_text.c \
365edje_textblock_styles.c \
366edje_util.c \
367edje_var.c
368
369@EDJE_AMALGAMATION_TRUE@nodist_libedje_la_SOURCES = edje_amalgamation.c
370@EDJE_AMALGAMATION_FALSE@libedje_la_SOURCES = $(base_sources)
371libedje_la_LIBADD = @EDJE_LIBS@ @ECORE_IMF_LIBS@ @EVIL_LIBS@ @REMIX_LIBS@ @SNDFILE_LIBS@ -lm
372libedje_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
373EXTRA_DIST = edje_private.h edje_container.h edje_convert.h
374all: all-am
375
376.SUFFIXES:
377.SUFFIXES: .c .lo .o .obj
378$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
379 @for dep in $?; do \
380 case '$(am__configure_deps)' in \
381 *$$dep*) \
382 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
383 && { if test -f $@; then exit 0; else break; fi; }; \
384 exit 1;; \
385 esac; \
386 done; \
387 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/Makefile'; \
388 $(am__cd) $(top_srcdir) && \
389 $(AUTOMAKE) --gnu src/lib/Makefile
390.PRECIOUS: Makefile
391Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
392 @case '$?' in \
393 *config.status*) \
394 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
395 *) \
396 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
397 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
398 esac;
399
400$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
401 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
402
403$(top_srcdir)/configure: $(am__configure_deps)
404 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
405$(ACLOCAL_M4): $(am__aclocal_m4_deps)
406 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
407$(am__aclocal_m4_deps):
408install-libLTLIBRARIES: $(lib_LTLIBRARIES)
409 @$(NORMAL_INSTALL)
410 test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
411 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
412 list2=; for p in $$list; do \
413 if test -f $$p; then \
414 list2="$$list2 $$p"; \
415 else :; fi; \
416 done; \
417 test -z "$$list2" || { \
418 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
419 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
420 }
421
422uninstall-libLTLIBRARIES:
423 @$(NORMAL_UNINSTALL)
424 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
425 for p in $$list; do \
426 $(am__strip_dir) \
427 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
428 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
429 done
430
431clean-libLTLIBRARIES:
432 -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
433 @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
434 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
435 test "$$dir" != "$$p" || dir=.; \
436 echo "rm -f \"$${dir}/so_locations\""; \
437 rm -f "$${dir}/so_locations"; \
438 done
439libedje.la: $(libedje_la_OBJECTS) $(libedje_la_DEPENDENCIES)
440 $(AM_V_CCLD)$(libedje_la_LINK) -rpath $(libdir) $(libedje_la_OBJECTS) $(libedje_la_LIBADD) $(LIBS)
441
442mostlyclean-compile:
443 -rm -f *.$(OBJEXT)
444
445distclean-compile:
446 -rm -f *.tab.c
447
448@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_amalgamation.Plo@am__quote@
449@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_box_layout.Plo@am__quote@
450@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_cache.Plo@am__quote@
451@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_calc.Plo@am__quote@
452@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_callbacks.Plo@am__quote@
453@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_container.Plo@am__quote@
454@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_data.Plo@am__quote@
455@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_edit.Plo@am__quote@
456@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_embryo.Plo@am__quote@
457@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_entry.Plo@am__quote@
458@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_external.Plo@am__quote@
459@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_load.Plo@am__quote@
460@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_lua.Plo@am__quote@
461@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_lua2.Plo@am__quote@
462@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_lua_script_only.Plo@am__quote@
463@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_main.Plo@am__quote@
464@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_match.Plo@am__quote@
465@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_message_queue.Plo@am__quote@
466@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_misc.Plo@am__quote@
467@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_module.Plo@am__quote@
468@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_multisense.Plo@am__quote@
469@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_program.Plo@am__quote@
470@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_script_only.Plo@am__quote@
471@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_smart.Plo@am__quote@
472@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_text.Plo@am__quote@
473@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_textblock_styles.Plo@am__quote@
474@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_util.Plo@am__quote@
475@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_var.Plo@am__quote@
476
477.c.o:
478@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
479@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
480@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
481@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
482@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
483@am__fastdepCC_FALSE@ $(COMPILE) -c $<
484
485.c.obj:
486@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
487@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
488@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
489@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
490@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
491@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
492
493.c.lo:
494@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
495@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
496@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
497@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
498@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
499@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
500
501mostlyclean-libtool:
502 -rm -f *.lo
503
504clean-libtool:
505 -rm -rf .libs _libs
506install-includesHEADERS: $(includes_HEADERS)
507 @$(NORMAL_INSTALL)
508 test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)"
509 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
510 for p in $$list; do \
511 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
512 echo "$$d$$p"; \
513 done | $(am__base_list) | \
514 while read files; do \
515 echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \
516 $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \
517 done
518
519uninstall-includesHEADERS:
520 @$(NORMAL_UNINSTALL)
521 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
522 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
523 test -n "$$files" || exit 0; \
524 echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \
525 cd "$(DESTDIR)$(includesdir)" && rm -f $$files
526
527ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
528 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
529 unique=`for i in $$list; do \
530 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
531 done | \
532 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
533 END { if (nonempty) { for (i in files) print i; }; }'`; \
534 mkid -fID $$unique
535tags: TAGS
536
537TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
538 $(TAGS_FILES) $(LISP)
539 set x; \
540 here=`pwd`; \
541 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
542 unique=`for i in $$list; do \
543 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
544 done | \
545 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
546 END { if (nonempty) { for (i in files) print i; }; }'`; \
547 shift; \
548 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
549 test -n "$$unique" || unique=$$empty_fix; \
550 if test $$# -gt 0; then \
551 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
552 "$$@" $$unique; \
553 else \
554 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
555 $$unique; \
556 fi; \
557 fi
558ctags: CTAGS
559CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
560 $(TAGS_FILES) $(LISP)
561 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
562 unique=`for i in $$list; do \
563 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
564 done | \
565 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
566 END { if (nonempty) { for (i in files) print i; }; }'`; \
567 test -z "$(CTAGS_ARGS)$$unique" \
568 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
569 $$unique
570
571GTAGS:
572 here=`$(am__cd) $(top_builddir) && pwd` \
573 && $(am__cd) $(top_srcdir) \
574 && gtags -i $(GTAGS_ARGS) "$$here"
575
576distclean-tags:
577 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
578
579distdir: $(DISTFILES)
580 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
581 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
582 list='$(DISTFILES)'; \
583 dist_files=`for file in $$list; do echo $$file; done | \
584 sed -e "s|^$$srcdirstrip/||;t" \
585 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
586 case $$dist_files in \
587 */*) $(MKDIR_P) `echo "$$dist_files" | \
588 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
589 sort -u` ;; \
590 esac; \
591 for file in $$dist_files; do \
592 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
593 if test -d $$d/$$file; then \
594 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
595 if test -d "$(distdir)/$$file"; then \
596 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
597 fi; \
598 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
599 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
600 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
601 fi; \
602 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
603 else \
604 test -f "$(distdir)/$$file" \
605 || cp -p $$d/$$file "$(distdir)/$$file" \
606 || exit 1; \
607 fi; \
608 done
609check-am: all-am
610check: check-am
611all-am: Makefile $(LTLIBRARIES) $(HEADERS)
612installdirs:
613 for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \
614 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
615 done
616install: install-am
617install-exec: install-exec-am
618install-data: install-data-am
619uninstall: uninstall-am
620
621install-am: all-am
622 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
623
624installcheck: installcheck-am
625install-strip:
626 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
627 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
628 `test -z '$(STRIP)' || \
629 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
630mostlyclean-generic:
631
632clean-generic:
633
634distclean-generic:
635 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
636 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
637
638maintainer-clean-generic:
639 @echo "This command is intended for maintainers to use"
640 @echo "it deletes files that may require special tools to rebuild."
641 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
642clean: clean-am
643
644clean-am: clean-generic clean-libLTLIBRARIES clean-libtool clean-local \
645 mostlyclean-am
646
647distclean: distclean-am
648 -rm -rf ./$(DEPDIR)
649 -rm -f Makefile
650distclean-am: clean-am distclean-compile distclean-generic \
651 distclean-tags
652
653dvi: dvi-am
654
655dvi-am:
656
657html: html-am
658
659html-am:
660
661info: info-am
662
663info-am:
664
665install-data-am: install-includesHEADERS
666
667install-dvi: install-dvi-am
668
669install-dvi-am:
670
671install-exec-am: install-libLTLIBRARIES
672
673install-html: install-html-am
674
675install-html-am:
676
677install-info: install-info-am
678
679install-info-am:
680
681install-man:
682
683install-pdf: install-pdf-am
684
685install-pdf-am:
686
687install-ps: install-ps-am
688
689install-ps-am:
690
691installcheck-am:
692
693maintainer-clean: maintainer-clean-am
694 -rm -rf ./$(DEPDIR)
695 -rm -f Makefile
696maintainer-clean-am: distclean-am maintainer-clean-generic
697
698mostlyclean: mostlyclean-am
699
700mostlyclean-am: mostlyclean-compile mostlyclean-generic \
701 mostlyclean-libtool
702
703pdf: pdf-am
704
705pdf-am:
706
707ps: ps-am
708
709ps-am:
710
711uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES
712
713.MAKE: install-am install-strip
714
715.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
716 clean-libLTLIBRARIES clean-libtool clean-local ctags distclean \
717 distclean-compile distclean-generic distclean-libtool \
718 distclean-tags distdir dvi dvi-am html html-am info info-am \
719 install install-am install-data install-data-am install-dvi \
720 install-dvi-am install-exec install-exec-am install-html \
721 install-html-am install-includesHEADERS install-info \
722 install-info-am install-libLTLIBRARIES install-man install-pdf \
723 install-pdf-am install-ps install-ps-am install-strip \
724 installcheck installcheck-am installdirs maintainer-clean \
725 maintainer-clean-generic mostlyclean mostlyclean-compile \
726 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
727 tags uninstall uninstall-am uninstall-includesHEADERS \
728 uninstall-libLTLIBRARIES
729
730
731@EDJE_AMALGAMATION_TRUE@edje_amalgamation.c: $(base_sources) Makefile
732@EDJE_AMALGAMATION_TRUE@ -rm -f edje_amalgamation.c
733
734@EDJE_AMALGAMATION_TRUE@ @echo "#ifdef HAVE_CONFIG_H" >> edje_amalgamation.c
735@EDJE_AMALGAMATION_TRUE@ @echo "# include \"config.h\"" >> edje_amalgamation.c
736@EDJE_AMALGAMATION_TRUE@ @echo "#endif" >> edje_amalgamation.c
737
738@EDJE_AMALGAMATION_TRUE@ @echo "#ifndef _WIN32" >> edje_amalgamation.c
739@EDJE_AMALGAMATION_TRUE@ @echo "#define _GNU_SOURCE" >> edje_amalgamation.c
740@EDJE_AMALGAMATION_TRUE@ @echo "#endif" >> edje_amalgamation.c
741
742@EDJE_AMALGAMATION_TRUE@ @echo "#ifdef HAVE_ALLOCA_H" >> edje_amalgamation.c
743@EDJE_AMALGAMATION_TRUE@ @echo "# include <alloca.h>" >> edje_amalgamation.c
744@EDJE_AMALGAMATION_TRUE@ @echo "#elif defined __GNUC__" >> edje_amalgamation.c
745@EDJE_AMALGAMATION_TRUE@ @echo "# define alloca __builtin_alloca" >> edje_amalgamation.c
746@EDJE_AMALGAMATION_TRUE@ @echo "#elif defined _AIX" >> edje_amalgamation.c
747@EDJE_AMALGAMATION_TRUE@ @echo "# define alloca __alloca" >> edje_amalgamation.c
748@EDJE_AMALGAMATION_TRUE@ @echo "#elif defined _MSC_VER" >> edje_amalgamation.c
749@EDJE_AMALGAMATION_TRUE@ @echo "# include <malloc.h>" >> edje_amalgamation.c
750@EDJE_AMALGAMATION_TRUE@ @echo "# define alloca _alloca" >> edje_amalgamation.c
751@EDJE_AMALGAMATION_TRUE@ @echo "#else" >> edje_amalgamation.c
752@EDJE_AMALGAMATION_TRUE@ @echo "# include <stddef.h>" >> edje_amalgamation.c
753@EDJE_AMALGAMATION_TRUE@ @echo "# ifdef __cplusplus" >> edje_amalgamation.c
754@EDJE_AMALGAMATION_TRUE@ @echo "#extern \"C\"" >> edje_amalgamation.c
755@EDJE_AMALGAMATION_TRUE@ @echo "# endif" >> edje_amalgamation.c
756@EDJE_AMALGAMATION_TRUE@ @echo "#void *alloca (size_t);" >> edje_amalgamation.c
757@EDJE_AMALGAMATION_TRUE@ @echo "#endif" >> edje_amalgamation.c
758
759@EDJE_AMALGAMATION_TRUE@ @echo "#include <string.h>" >> edje_amalgamation.c
760@EDJE_AMALGAMATION_TRUE@ @echo "#include <math.h>" >> edje_amalgamation.c
761@EDJE_AMALGAMATION_TRUE@ @echo "#include <time.h>" >> edje_amalgamation.c
762@EDJE_AMALGAMATION_TRUE@ @echo "#include <limits.h>" >> edje_amalgamation.c
763@EDJE_AMALGAMATION_TRUE@ @echo "#include <errno.h>" >> edje_amalgamation.c
764@EDJE_AMALGAMATION_TRUE@ @echo "#include <sys/stat.h>" >> edje_amalgamation.c
765@EDJE_AMALGAMATION_TRUE@ @echo "#include <fcntl.h>" >> edje_amalgamation.c
766
767@EDJE_AMALGAMATION_TRUE@ @echo "#ifndef _MSC_VER" >> edje_amalgamation.c
768@EDJE_AMALGAMATION_TRUE@ @echo "# include <unistd.h>" >> edje_amalgamation.c
769@EDJE_AMALGAMATION_TRUE@ @echo "#endif" >> edje_amalgamation.c
770
771@EDJE_AMALGAMATION_TRUE@ @echo "#ifdef HAVE_LOCALE_H" >> edje_amalgamation.c
772@EDJE_AMALGAMATION_TRUE@ @echo "# include <locale.h>" >> edje_amalgamation.c
773@EDJE_AMALGAMATION_TRUE@ @echo "#endif" >> edje_amalgamation.c
774
775@EDJE_AMALGAMATION_TRUE@ @echo "#include <lua.h>" >> edje_amalgamation.c
776@EDJE_AMALGAMATION_TRUE@ @echo "#include <lauxlib.h>" >> edje_amalgamation.c
777
778@EDJE_AMALGAMATION_TRUE@ @echo "#ifdef HAVE_EVIL" >> edje_amalgamation.c
779@EDJE_AMALGAMATION_TRUE@ @echo "# include <Evil.h>" >> edje_amalgamation.c
780@EDJE_AMALGAMATION_TRUE@ @echo "#endif" >> edje_amalgamation.c
781
782@EDJE_AMALGAMATION_TRUE@ @echo "#include <Eina.h>" >> edje_amalgamation.c
783@EDJE_AMALGAMATION_TRUE@ @echo "#include <Edje.h>" >> edje_amalgamation.c
784@EDJE_AMALGAMATION_TRUE@ @echo "#include <Evas.h>" >> edje_amalgamation.c
785@EDJE_AMALGAMATION_TRUE@ @echo "#include <Ecore.h>" >> edje_amalgamation.c
786@EDJE_AMALGAMATION_TRUE@ @echo "#include <Embryo.h>" >> edje_amalgamation.c
787
788@EDJE_AMALGAMATION_TRUE@ @echo "#ifdef HAVE_ECORE_IMF" >> edje_amalgamation.c
789@EDJE_AMALGAMATION_TRUE@ @echo "# include <Ecore_IMF.h>" >> edje_amalgamation.c
790@EDJE_AMALGAMATION_TRUE@ @echo "#endif" >> edje_amalgamation.c
791
792@EDJE_AMALGAMATION_TRUE@ @echo "#include <edje_private.h>" >> edje_amalgamation.c
793
794@EDJE_AMALGAMATION_TRUE@ @for f in $(base_sources); do \
795@EDJE_AMALGAMATION_TRUE@ if [ `echo $$f | sed -e 's/^...\(.\).*/\1/'` != '/' ]; then \
796@EDJE_AMALGAMATION_TRUE@ file="$(srcdir)/$$f" ; \
797@EDJE_AMALGAMATION_TRUE@ else \
798@EDJE_AMALGAMATION_TRUE@ file="$$f" ; \
799@EDJE_AMALGAMATION_TRUE@ fi ; \
800@EDJE_AMALGAMATION_TRUE@ echo "/* file: $$file */" >> edje_amalgamation.c; \
801@EDJE_AMALGAMATION_TRUE@ grep -v -e '^# *include \+.\(config\|\|Evil\|Eina\|Eet\|Evas\|Ecore\|Embryo\|Ecore_IMF\|string\|math\|limits\|sys/stat\|errno\|time\|unistd\|locale\|lua\|lauxlib\|edje_private\)[.]h.*' $$file >> edje_amalgamation.c; \
802@EDJE_AMALGAMATION_TRUE@ done
803@EDJE_AMALGAMATION_TRUE@ @echo "edje_amalgamation.c generated"
804
805clean-local:
806 @rm -rf *.gcno edje_amalgamation.c
807
808# Tell versions [3.59,3.63) of GNU make to not export all variables.
809# Otherwise a system limit (for SysV at least) may be exceeded.
810.NOEXPORT:
diff --git a/libraries/edje/src/lib/edje_box_layout.c b/libraries/edje/src/lib/edje_box_layout.c
new file mode 100644
index 0000000..3585046
--- /dev/null
+++ b/libraries/edje/src/lib/edje_box_layout.c
@@ -0,0 +1,242 @@
1#include "edje_private.h"
2
3typedef struct _Edje_Transition_Animation_Data Edje_Transition_Animation_Data;
4struct _Edje_Transition_Animation_Data
5{
6 Evas_Object *obj;
7 struct
8 {
9 Evas_Coord x, y, w, h;
10 } start, end;
11};
12
13struct _Edje_Part_Box_Animation
14{
15 struct
16 {
17 Evas_Object_Box_Layout layout;
18 void *data;
19 void(*free_data)(void *data);
20 Edje_Alignment align;
21 Evas_Point padding;
22 } start, end;
23 Eina_List *objs;
24 Eina_Bool recalculate:1;
25 Evas_Object *box;
26 double progress;
27 double start_progress;
28 int box_start_w, box_start_h;
29};
30
31static void
32_edje_box_layout_find_all(const char *name, const char *name_alt, Evas_Object_Box_Layout *cb, void **data, void (**free_data)(void *data))
33{
34 if (!_edje_box_layout_find(name, cb, data, free_data))
35 {
36 if ((!name_alt) ||
37 (!_edje_box_layout_find(name_alt, cb, data, free_data)))
38 {
39 ERR("box layout '%s' (fallback '%s') not available, using horizontal.",
40 name, name_alt);
41 *cb = evas_object_box_layout_horizontal;
42 *free_data = NULL;
43 *data = NULL;
44 }
45 }
46}
47
48static void
49_edje_box_layout_calculate_coords(Evas_Object *obj, Evas_Object_Box_Data *priv, Edje_Part_Box_Animation *anim)
50{
51 Eina_List *l;
52 Edje_Transition_Animation_Data *tad;
53 Evas_Coord x, y;
54
55 evas_object_geometry_get(obj, &x, &y, &anim->box_start_w, &anim->box_start_h);
56 EINA_LIST_FOREACH(anim->objs, l, tad)
57 {
58 evas_object_geometry_get(tad->obj, &tad->start.x, &tad->start.y,
59 &tad->start.w, &tad->start.h);
60 tad->start.x = tad->start.x - x;
61 tad->start.y = tad->start.y - y;
62 }
63 evas_object_box_padding_set(obj, anim->end.padding.x, anim->end.padding.y);
64 evas_object_box_align_set(obj, TO_DOUBLE(anim->end.align.x), TO_DOUBLE(anim->end.align.y));
65 anim->end.layout(obj, priv, anim->end.data);
66 EINA_LIST_FOREACH(anim->objs, l, tad)
67 {
68 evas_object_geometry_get(tad->obj, &tad->end.x, &tad->end.y,
69 &tad->end.w, &tad->end.h);
70 tad->end.x = tad->end.x - x;
71 tad->end.y = tad->end.y - y;
72 }
73}
74
75static void
76_edje_box_layout_exec(Evas_Object *obj, Edje_Part_Box_Animation *anim)
77{
78 Eina_List *l;
79 Edje_Transition_Animation_Data *tad;
80 Evas_Coord x, y, w, h;
81 Evas_Coord cur_x, cur_y, cur_w, cur_h;
82 double progress;
83
84 evas_object_geometry_get(obj, &x, &y, &w, &h);
85 progress = (anim->progress - anim->start_progress) / (1 - anim->start_progress);
86
87 EINA_LIST_FOREACH(anim->objs, l, tad)
88 {
89 cur_x = x + (tad->start.x + ((tad->end.x - tad->start.x) * progress)) * (w / (double)anim->box_start_w);
90 cur_y = y + (tad->start.y + ((tad->end.y - tad->start.y) * progress)) * (h / (double)anim->box_start_h);
91 cur_w = (w / (double)anim->box_start_w) * (tad->start.w + ((tad->end.w - tad->start.w) * progress));
92 cur_h = (h / (double)anim->box_start_h) * (tad->start.h + ((tad->end.h - tad->start.h) * progress));
93 evas_object_move(tad->obj, cur_x, cur_y);
94 evas_object_resize(tad->obj, cur_w, cur_h);
95 }
96}
97
98static void
99_edje_box_layout(Evas_Object *obj, Evas_Object_Box_Data *priv, void *data)
100{
101 Edje_Part_Box_Animation *anim = data;
102 if (anim->progress < 0.01)
103 {
104 if (anim->start.layout)
105 {
106 evas_object_box_padding_set(obj, anim->start.padding.x, anim->start.padding.y);
107 evas_object_box_align_set(obj, TO_DOUBLE(anim->start.align.x), TO_DOUBLE(anim->start.align.y));
108 anim->start.layout(obj, priv, anim->start.data);
109 }
110 return;
111 }
112
113 if (anim->recalculate)
114 {
115 _edje_box_layout_calculate_coords(obj, priv, anim);
116 anim->start_progress = anim->progress;
117 anim->recalculate = EINA_FALSE;
118 }
119
120 if ((anim->progress > 0) && (anim->start_progress < 1))
121 _edje_box_layout_exec(obj, anim);
122}
123
124void
125_edje_box_layout_free_data(void *data)
126{
127 Edje_Transition_Animation_Data *tad;
128 Edje_Part_Box_Animation *anim = data;
129 if (anim->start.free_data && anim->start.data)
130 anim->start.free_data(anim->start.data);
131 if (anim->end.free_data && anim->end.data)
132 anim->end.free_data(anim->end.data);
133 EINA_LIST_FREE(anim->objs, tad)
134 free(tad);
135 free(data);
136}
137
138Edje_Part_Box_Animation *
139_edje_box_layout_anim_new(Evas_Object *box)
140{
141 Edje_Part_Box_Animation *anim = calloc(1, sizeof(Edje_Part_Box_Animation));
142 if (!anim)
143 return NULL;
144
145 anim->box = box;
146 evas_object_box_layout_set(box, _edje_box_layout, anim, NULL);
147
148 return anim;
149}
150
151void
152_edje_box_recalc_apply(Edje *ed __UNUSED__, Edje_Real_Part *ep, Edje_Calc_Params *p3 __UNUSED__, Edje_Part_Description_Box *chosen_desc)
153{
154 Evas_Object_Box_Data *priv;
155#if 0
156 int min_w, min_h;
157#endif
158 if ((ep->param2) && (ep->description_pos != ZERO))
159 {
160 Edje_Part_Description_Box *param2_desc = (Edje_Part_Description_Box *)ep->param2->description;
161 if (ep->anim->end.layout == NULL)
162 {
163 _edje_box_layout_find_all(param2_desc->box.layout, param2_desc->box.alt_layout, &ep->anim->end.layout, &ep->anim->end.data, &ep->anim->end.free_data);
164 ep->anim->end.padding.x = param2_desc->box.padding.x;
165 ep->anim->end.padding.y = param2_desc->box.padding.y;
166 ep->anim->end.align.x = param2_desc->box.align.x;
167 ep->anim->end.align.y = param2_desc->box.align.y;
168
169 priv = evas_object_smart_data_get(ep->object);
170 if (priv == NULL)
171 return;
172
173 evas_object_box_padding_set(ep->object, ep->anim->start.padding.x, ep->anim->start.padding.y);
174 evas_object_box_align_set(ep->object, TO_DOUBLE(ep->anim->start.align.x), TO_DOUBLE(ep->anim->start.align.y));
175 ep->anim->start.layout(ep->object, priv, ep->anim->start.data);
176 _edje_box_layout_calculate_coords(ep->object, priv, ep->anim);
177 ep->anim->start_progress = 0.0;
178 }
179 evas_object_smart_changed(ep->object);
180 }
181 else
182 {
183 ep->anim->end.layout = NULL;
184 }
185
186 if (ep->description_pos < 0.01 || !ep->anim->start.layout)
187 {
188 _edje_box_layout_find_all(chosen_desc->box.layout, chosen_desc->box.alt_layout, &ep->anim->start.layout, &ep->anim->start.data, &ep->anim->start.free_data);
189 ep->anim->start.padding.x = chosen_desc->box.padding.x;
190 ep->anim->start.padding.y = chosen_desc->box.padding.y;
191 ep->anim->start.align.x = chosen_desc->box.align.x;
192 ep->anim->start.align.y = chosen_desc->box.align.y;
193 evas_object_smart_changed(ep->object);
194 }
195
196 ep->anim->progress = ep->description_pos;
197
198 if (evas_object_smart_need_recalculate_get(ep->object))
199 {
200 evas_object_smart_need_recalculate_set(ep->object, 0);
201 evas_object_smart_calculate(ep->object);
202 }
203#if 0 /* Why the hell do we affect part size after resize ??? */
204 evas_object_size_hint_min_get(ep->object, &min_w, &min_h);
205 if (chosen_desc->box.min.h && (p3->w < min_w))
206 p3->w = min_w;
207 if (chosen_desc->box.min.v && (p3->h < min_h))
208 p3->h = min_h;
209#endif
210}
211
212Eina_Bool
213_edje_box_layout_add_child(Edje_Real_Part *rp, Evas_Object *child_obj)
214{
215 Edje_Transition_Animation_Data *tad;
216 tad = calloc(1, sizeof(Edje_Transition_Animation_Data));
217 if (!tad)
218 return EINA_FALSE;
219 tad->obj = child_obj;
220 rp->anim->objs = eina_list_append(rp->anim->objs, tad);
221 rp->anim->recalculate = EINA_TRUE;
222 return EINA_TRUE;
223}
224
225void
226_edje_box_layout_remove_child(Edje_Real_Part *rp, Evas_Object *child_obj)
227{
228 Eina_List *l;
229 Edje_Transition_Animation_Data *tad;
230
231 EINA_LIST_FOREACH(rp->anim->objs, l, tad)
232 {
233 if (tad->obj == child_obj)
234 {
235 free(eina_list_data_get(l));
236 rp->anim->objs = eina_list_remove_list(rp->anim->objs, l);
237 rp->anim->recalculate = EINA_TRUE;
238 break;
239 }
240 }
241 rp->anim->recalculate = EINA_TRUE;
242}
diff --git a/libraries/edje/src/lib/edje_cache.c b/libraries/edje/src/lib/edje_cache.c
new file mode 100644
index 0000000..a8b355f
--- /dev/null
+++ b/libraries/edje/src/lib/edje_cache.c
@@ -0,0 +1,570 @@
1#include "edje_private.h"
2
3
4/**
5 * @cond
6 */
7
8static Eina_Hash *_edje_file_hash = NULL;
9static int _edje_file_cache_size = 16;
10static Eina_List *_edje_file_cache = NULL;
11
12static int _edje_collection_cache_size = 16;
13
14static Edje_Part_Collection *
15_edje_file_coll_open(Edje_File *edf, const char *coll)
16{
17 Edje_Part_Collection *edc = NULL;
18 Edje_Part_Collection_Directory_Entry *ce;
19 int id = -1, size = 0;
20 Eina_List *l;
21 char buf[256];
22 char *buffer;
23 void *data;
24
25 ce = eina_hash_find(edf->collection, coll);
26 if (!ce) return NULL;
27
28 if (ce->ref)
29 {
30 ce->ref->references++;
31 return ce->ref;
32 }
33
34 EINA_LIST_FOREACH(edf->collection_cache, l, edc)
35 {
36 if (!strcmp(edc->part, coll))
37 {
38 edc->references = 1;
39 ce->ref = edc;
40
41 edf->collection_cache = eina_list_remove_list(edf->collection_cache, l);
42 return ce->ref;
43 }
44 }
45
46 id = ce->id;
47 if (id < 0) return NULL;
48
49#define INIT_EMP(Tp, Sz, Ce) \
50 buffer = alloca(strlen(ce->entry) + strlen(#Tp) + 2); \
51 sprintf(buffer, "%s/%s", ce->entry, #Tp); \
52 Ce->mp.Tp = eina_mempool_add("one_big", buffer, NULL, sizeof (Sz), Ce->count.Tp); \
53 _emp_##Tp = Ce->mp.Tp;
54
55#define INIT_EMP_BOTH(Tp, Sz, Ce) \
56 INIT_EMP(Tp, Sz, Ce) \
57 Ce->mp_rtl.Tp = eina_mempool_add("one_big", buffer, NULL, \
58 sizeof (Sz), Ce->count.Tp);
59
60 INIT_EMP_BOTH(RECTANGLE, Edje_Part_Description_Common, ce);
61 INIT_EMP_BOTH(TEXT, Edje_Part_Description_Text, ce);
62 INIT_EMP_BOTH(IMAGE, Edje_Part_Description_Image, ce);
63 INIT_EMP_BOTH(PROXY, Edje_Part_Description_Proxy, ce);
64 INIT_EMP_BOTH(SWALLOW, Edje_Part_Description_Common, ce);
65 INIT_EMP_BOTH(TEXTBLOCK, Edje_Part_Description_Text, ce);
66 INIT_EMP_BOTH(GROUP, Edje_Part_Description_Common, ce);
67 INIT_EMP_BOTH(BOX, Edje_Part_Description_Box, ce);
68 INIT_EMP_BOTH(TABLE, Edje_Part_Description_Table, ce);
69 INIT_EMP_BOTH(EXTERNAL, Edje_Part_Description_External, ce);
70 INIT_EMP(part, Edje_Part, ce);
71
72 snprintf(buf, sizeof(buf), "edje/collections/%i", id);
73 edc = eet_data_read(edf->ef, _edje_edd_edje_part_collection, buf);
74 if (!edc) return NULL;
75
76 edc->references = 1;
77 edc->part = ce->entry;
78
79 /* For Edje file build with Edje 1.0, people expect text.align to be 0.0 0.0 */
80 if (edf->version <= 3 && edf->minor <= 1)
81 {
82 /* This will preserve previous rendering */
83 unsigned int i;
84
85 for (i = 0; i < edc->parts_count; ++i)
86 {
87 if (edc->parts[i]->type == EDJE_PART_TYPE_TEXTBLOCK)
88 {
89 Edje_Part_Description_Text *text;
90 unsigned int j;
91
92 text = (Edje_Part_Description_Text*) edc->parts[i]->default_desc;
93 text->text.align.x = TO_DOUBLE(0.0);
94 text->text.align.y = TO_DOUBLE(0.0);
95
96 for (j = 0; j < edc->parts[i]->other.desc_count; ++j)
97 {
98 text = (Edje_Part_Description_Text*) edc->parts[i]->other.desc[j];
99 text->text.align.x = TO_DOUBLE(0.0);
100 text->text.align.y = TO_DOUBLE(0.0);
101 }
102 }
103 }
104 }
105
106 snprintf(buf, sizeof(buf), "edje/scripts/embryo/compiled/%i", id);
107 data = eet_read(edf->ef, buf, &size);
108
109 if (data)
110 {
111 edc->script = embryo_program_new(data, size);
112 _edje_embryo_script_init(edc);
113 free(data);
114 }
115
116 snprintf(buf, sizeof(buf), "edje/scripts/lua/%i", id);
117 data = eet_read(edf->ef, buf, &size);
118
119 if (data)
120 {
121 _edje_lua2_script_load(edc, data, size);
122 free(data);
123 }
124
125 ce->ref = edc;
126
127 return edc;
128}
129
130static Edje_File *
131_edje_file_open(const char *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret)
132{
133 Edje_File *edf;
134 Edje_Part_Collection *edc;
135 Eet_File *ef;
136 struct stat st;
137
138 if (stat(file, &st) != 0)
139 {
140 *error_ret = EDJE_LOAD_ERROR_DOES_NOT_EXIST;
141 return NULL;
142 }
143
144 ef = eet_open(file, EET_FILE_MODE_READ);
145 if (!ef)
146 {
147 *error_ret = EDJE_LOAD_ERROR_UNKNOWN_FORMAT;
148 return NULL;
149 }
150 edf = eet_data_read(ef, _edje_edd_edje_file, "edje/file");
151 if (!edf)
152 {
153 *error_ret = EDJE_LOAD_ERROR_CORRUPT_FILE;
154 eet_close(ef);
155 return NULL;
156 }
157
158 edf->ef = ef;
159 edf->mtime = st.st_mtime;
160
161 if (edf->version != EDJE_FILE_VERSION)
162 {
163 *error_ret = EDJE_LOAD_ERROR_INCOMPATIBLE_FILE;
164 _edje_file_free(edf);
165 return NULL;
166 }
167 if (!edf->collection)
168 {
169 *error_ret = EDJE_LOAD_ERROR_CORRUPT_FILE;
170 _edje_file_free(edf);
171 return NULL;
172 }
173
174 if (edf->minor > EDJE_FILE_MINOR)
175 {
176 WRN("`%s` may use feature from a newer edje and could not show up as expected.", file);
177 }
178
179 edf->path = eina_stringshare_add(file);
180 edf->references = 1;
181
182 /* This should be done at edje generation time */
183 _edje_textblock_style_parse_and_fix(edf);
184
185 if (coll)
186 {
187 edc = _edje_file_coll_open(edf, coll);
188 if (!edc)
189 {
190 *error_ret = EDJE_LOAD_ERROR_UNKNOWN_COLLECTION;
191 }
192 if (edc_ret) *edc_ret = edc;
193 }
194
195 return edf;
196}
197
198static void
199_edje_file_dangling(Edje_File *edf)
200{
201 if (edf->dangling) return;
202 edf->dangling = EINA_TRUE;
203
204 eina_hash_del(_edje_file_hash, edf->path, edf);
205 if (!eina_hash_population(_edje_file_hash))
206 {
207 eina_hash_free(_edje_file_hash);
208 _edje_file_hash = NULL;
209 }
210}
211
212Edje_File *
213_edje_cache_file_coll_open(const char *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret)
214{
215 Edje_File *edf;
216 Eina_List *l, *hist;
217 Edje_Part_Collection *edc;
218 Edje_Part *ep;
219 struct stat st;
220
221 if (stat(file, &st) != 0)
222 return NULL;
223
224 if (!_edje_file_hash)
225 {
226 _edje_file_hash = eina_hash_string_small_new(NULL);
227 goto open_new;
228 }
229
230 edf = eina_hash_find(_edje_file_hash, file);
231 if (edf)
232 {
233 if (edf->mtime != st.st_mtime)
234 {
235 _edje_file_dangling(edf);
236 goto open_new;
237 }
238
239 edf->references++;
240 goto open;
241 }
242
243 EINA_LIST_FOREACH(_edje_file_cache, l, edf)
244 {
245 if (!strcmp(edf->path, file))
246 {
247 if (edf->mtime != st.st_mtime)
248 {
249 _edje_file_cache = eina_list_remove_list(_edje_file_cache, l);
250 _edje_file_free(edf);
251 goto open_new;
252 }
253
254 edf->references = 1;
255 _edje_file_cache = eina_list_remove_list(_edje_file_cache, l);
256 eina_hash_add(_edje_file_hash, file, edf);
257 goto open;
258 }
259 }
260
261open_new:
262 if (!_edje_file_hash)
263 _edje_file_hash = eina_hash_string_small_new(NULL);
264
265 edf = _edje_file_open(file, coll, error_ret, edc_ret);
266 if (!edf)
267 return NULL;
268
269 eina_hash_add(_edje_file_hash, file, edf);
270 return edf;
271
272open:
273 if (!coll)
274 return edf;
275
276 edc = _edje_file_coll_open(edf, coll);
277 if (!edc)
278 {
279 *error_ret = EDJE_LOAD_ERROR_UNKNOWN_COLLECTION;
280 }
281 else
282 {
283 if (!edc->checked)
284 {
285 unsigned int j;
286
287 for (j = 0; j < edc->parts_count; ++j)
288 {
289 Edje_Part *ep2;
290
291 ep = edc->parts[j];
292
293 /* Register any color classes in this parts descriptions. */
294 hist = NULL;
295 hist = eina_list_append(hist, ep);
296 ep2 = ep;
297 while (ep2->dragable.confine_id >= 0)
298 {
299 if (ep2->dragable.confine_id >= (int) edc->parts_count)
300 {
301 ERR("confine_to above limit. invalidating it.");
302 ep2->dragable.confine_id = -1;
303 break;
304 }
305
306 ep2 = edc->parts[ep2->dragable.confine_id];
307 if (eina_list_data_find(hist, ep2))
308 {
309 ERR("confine_to loops. invalidating loop.");
310 ep2->dragable.confine_id = -1;
311 break;
312 }
313 hist = eina_list_append(hist, ep2);
314 }
315 eina_list_free(hist);
316 hist = NULL;
317 hist = eina_list_append(hist, ep);
318 ep2 = ep;
319 while (ep2->dragable.event_id >= 0)
320 {
321 Edje_Part* prev;
322
323 if (ep2->dragable.event_id >= (int) edc->parts_count)
324 {
325 ERR("event_id above limit. invalidating it.");
326 ep2->dragable.event_id = -1;
327 break;
328 }
329 prev = ep2;
330
331 ep2 = edc->parts[ep2->dragable.event_id];
332 if (!ep2->dragable.x && !ep2->dragable.y)
333 {
334 prev->dragable.event_id = -1;
335 break;
336 }
337
338 if (eina_list_data_find(hist, ep2))
339 {
340 ERR("events_to loops. invalidating loop.");
341 ep2->dragable.event_id = -1;
342 break;
343 }
344 hist = eina_list_append(hist, ep2);
345 }
346 eina_list_free(hist);
347 hist = NULL;
348 hist = eina_list_append(hist, ep);
349 ep2 = ep;
350 while (ep2->clip_to_id >= 0)
351 {
352 if (ep2->clip_to_id >= (int) edc->parts_count)
353 {
354 ERR("clip_to_id above limit. invalidating it.");
355 ep2->clip_to_id = -1;
356 break;
357 }
358
359 ep2 = edc->parts[ep2->clip_to_id];
360 if (eina_list_data_find(hist, ep2))
361 {
362 ERR("clip_to loops. invalidating loop.");
363 ep2->clip_to_id = -1;
364 break;
365 }
366 hist = eina_list_append(hist, ep2);
367 }
368 eina_list_free(hist);
369 hist = NULL;
370 }
371 edc->checked = 1;
372 }
373 }
374 if (edc_ret) *edc_ret = edc;
375
376 return edf;
377}
378
379void
380_edje_cache_coll_clean(Edje_File *edf)
381{
382 while ((edf->collection_cache) &&
383 (eina_list_count(edf->collection_cache) > (unsigned int) _edje_collection_cache_size))
384 {
385 Edje_Part_Collection_Directory_Entry *ce;
386 Edje_Part_Collection *edc;
387
388 edc = eina_list_data_get(eina_list_last(edf->collection_cache));
389 edf->collection_cache = eina_list_remove_list(edf->collection_cache, eina_list_last(edf->collection_cache));
390
391 ce = eina_hash_find(edf->collection, edc->part);
392 _edje_collection_free(edf, edc, ce);
393 }
394}
395
396void
397_edje_cache_coll_flush(Edje_File *edf)
398{
399 while (edf->collection_cache)
400 {
401 Edje_Part_Collection_Directory_Entry *ce;
402 Edje_Part_Collection *edc;
403 Eina_List *last;
404
405 last = eina_list_last(edf->collection_cache);
406 edc = eina_list_data_get(last);
407 edf->collection_cache = eina_list_remove_list(edf->collection_cache,
408 last);
409
410 ce = eina_hash_find(edf->collection, edc->part);
411 _edje_collection_free(edf, edc, ce);
412 }
413}
414
415void
416_edje_cache_coll_unref(Edje_File *edf, Edje_Part_Collection *edc)
417{
418 Edje_Part_Collection_Directory_Entry *ce;
419
420 edc->references--;
421 if (edc->references != 0) return;
422
423 ce = eina_hash_find(edf->collection, edc->part);
424 if (!ce)
425 {
426 ERR("Something is wrong with reference count of '%s'.", edc->part);
427 }
428 else if (ce->ref)
429 {
430 ce->ref = NULL;
431
432 if (edf->dangling)
433 {
434 /* No need to keep the collection around if the file is dangling */
435 _edje_collection_free(edf, edc, ce);
436 _edje_cache_coll_flush(edf);
437 }
438 else
439 {
440 edf->collection_cache = eina_list_prepend(edf->collection_cache, edc);
441 _edje_cache_coll_clean(edf);
442 }
443 }
444}
445
446static void
447_edje_cache_file_clean(void)
448{
449 int count;
450
451 count = eina_list_count(_edje_file_cache);
452 while ((_edje_file_cache) && (count > _edje_file_cache_size))
453 {
454 Eina_List *last;
455 Edje_File *edf;
456
457 last = eina_list_last(_edje_file_cache);
458 edf = eina_list_data_get(last);
459 _edje_file_cache = eina_list_remove_list(_edje_file_cache, last);
460 _edje_file_free(edf);
461 count = eina_list_count(_edje_file_cache);
462 }
463}
464
465void
466_edje_cache_file_unref(Edje_File *edf)
467{
468 edf->references--;
469 if (edf->references != 0) return;
470
471 if (edf->dangling)
472 {
473 _edje_file_free(edf);
474 return;
475 }
476
477 eina_hash_del(_edje_file_hash, edf->path, edf);
478 if (!eina_hash_population(_edje_file_hash))
479 {
480 eina_hash_free(_edje_file_hash);
481 _edje_file_hash = NULL;
482 }
483 _edje_file_cache = eina_list_prepend(_edje_file_cache, edf);
484 _edje_cache_file_clean();
485}
486
487void
488_edje_file_cache_shutdown(void)
489{
490 edje_file_cache_flush();
491}
492
493
494
495/**
496 * @endcond
497 */
498
499/*============================================================================*
500 * Global *
501 *============================================================================*/
502
503/*============================================================================*
504 * API *
505 *============================================================================*/
506
507
508EAPI void
509edje_file_cache_set(int count)
510{
511 if (count < 0) count = 0;
512 _edje_file_cache_size = count;
513 _edje_cache_file_clean();
514}
515
516
517EAPI int
518edje_file_cache_get(void)
519{
520 return _edje_file_cache_size;
521}
522
523
524EAPI void
525edje_file_cache_flush(void)
526{
527 int ps;
528
529 ps = _edje_file_cache_size;
530 _edje_file_cache_size = 0;
531 _edje_cache_file_clean();
532 _edje_file_cache_size = ps;
533}
534
535
536EAPI void
537edje_collection_cache_set(int count)
538{
539 Eina_List *l;
540 Edje_File *edf;
541
542 if (count < 0) count = 0;
543 _edje_collection_cache_size = count;
544 EINA_LIST_FOREACH(_edje_file_cache, l, edf)
545 _edje_cache_coll_clean(edf);
546 /* FIXME: freach in file hash too! */
547}
548
549
550EAPI int
551edje_collection_cache_get(void)
552{
553 return _edje_collection_cache_size;
554}
555
556
557EAPI void
558edje_collection_cache_flush(void)
559{
560 int ps;
561 Eina_List *l;
562 Edje_File *edf;
563
564 ps = _edje_collection_cache_size;
565 _edje_collection_cache_size = 0;
566 EINA_LIST_FOREACH(_edje_file_cache, l, edf)
567 _edje_cache_coll_flush(edf);
568 /* FIXME: freach in file hash too! */
569 _edje_collection_cache_size = ps;
570}
diff --git a/libraries/edje/src/lib/edje_calc.c b/libraries/edje/src/lib/edje_calc.c
new file mode 100644
index 0000000..d9fd51d
--- /dev/null
+++ b/libraries/edje/src/lib/edje_calc.c
@@ -0,0 +1,2801 @@
1#include "edje_private.h"
2
3static void _edje_part_make_rtl(Edje_Part_Description_Common *desc);
4static Edje_Part_Description_Common *_edje_get_description_by_orientation(Edje *ed, Edje_Part_Description_Common *src, Edje_Part_Description_Common **dst, unsigned char type);
5
6static void _edje_part_recalc_single(Edje *ed, Edje_Real_Part *ep,
7 Edje_Part_Description_Common *desc, Edje_Part_Description_Common *chosen_desc,
8 Edje_Real_Part *center, Edje_Real_Part *light, Edje_Real_Part *persp,
9 Edje_Real_Part *rel1_to_x, Edje_Real_Part *rel1_to_y,
10 Edje_Real_Part *rel2_to_x, Edje_Real_Part *rel2_to_y,
11 Edje_Real_Part *confine_to, Edje_Calc_Params *params);
12
13void
14_edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, FLOAT_T pos, FLOAT_T v1, FLOAT_T v2)
15{
16 FLOAT_T fp_pos;
17 FLOAT_T npos;
18
19 pos = CLAMP(pos, ZERO, FROM_INT(1));
20
21 fp_pos = pos;
22
23 npos = ZERO;
24#if 0 // old code - easy to enable for comparing float vs fixed point
25 /* take linear pos along timescale and use interpolation method */
26 switch (mode)
27 {
28 case EDJE_TWEEN_MODE_SINUSOIDAL:
29 /* npos = (1.0 - cos(pos * PI)) / 2.0; */
30 npos = DIV2(SUB(FROM_INT(1),
31 COS(MUL(fp_pos,
32 PI))));
33 break;
34 case EDJE_TWEEN_MODE_ACCELERATE:
35 /* npos = 1.0 - sin((PI / 2.0) + (pos * PI / 2.0)); */
36 npos = SUB(FROM_INT(1),
37 SIN(ADD(DIV2(PI),
38 MUL(fp_pos,
39 DIV2(PI)))));
40 break;
41 case EDJE_TWEEN_MODE_DECELERATE:
42 /* npos = sin(pos * PI / 2.0); */
43 npos = SIN(MUL(fp_pos,
44 DIV2(PI)));
45 break;
46 case EDJE_TWEEN_MODE_LINEAR:
47 npos = fp_pos;
48 break;
49 default:
50 npos = fp_pos;
51 break;
52 }
53#else
54 switch (mode & EDJE_TWEEN_MODE_MASK)
55 {
56 case EDJE_TWEEN_MODE_SINUSOIDAL:
57 npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos),
58 ECORE_POS_MAP_SINUSOIDAL,
59 0.0, 0.0));
60 break;
61 case EDJE_TWEEN_MODE_ACCELERATE:
62 npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos),
63 ECORE_POS_MAP_ACCELERATE,
64 0.0, 0.0));
65 break;
66 case EDJE_TWEEN_MODE_DECELERATE:
67 npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos),
68 ECORE_POS_MAP_DECELERATE,
69 0.0, 0.0));
70 break;
71 case EDJE_TWEEN_MODE_LINEAR:
72 npos = fp_pos;
73/* npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos),
74 ECORE_POS_MAP_LINEAR,
75 0.0, 0.0));
76 */
77 break;
78 case EDJE_TWEEN_MODE_ACCELERATE_FACTOR:
79 npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos),
80 ECORE_POS_MAP_ACCELERATE_FACTOR,
81 TO_DOUBLE(v1), 0.0));
82 break;
83 case EDJE_TWEEN_MODE_DECELERATE_FACTOR:
84 npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos),
85 ECORE_POS_MAP_DECELERATE_FACTOR,
86 TO_DOUBLE(v1), 0.0));
87 break;
88 case EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR:
89 npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos),
90 ECORE_POS_MAP_SINUSOIDAL_FACTOR,
91 TO_DOUBLE(v1), 0.0));
92 break;
93 case EDJE_TWEEN_MODE_DIVISOR_INTERP:
94 npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos),
95 ECORE_POS_MAP_DIVISOR_INTERP,
96 TO_DOUBLE(v1), TO_DOUBLE(v2)));
97 break;
98 case EDJE_TWEEN_MODE_BOUNCE:
99 npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos),
100 ECORE_POS_MAP_BOUNCE,
101 TO_DOUBLE(v1), TO_DOUBLE(v2)));
102 break;
103 case EDJE_TWEEN_MODE_SPRING:
104 npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos),
105 ECORE_POS_MAP_SPRING,
106 TO_DOUBLE(v1), TO_DOUBLE(v2)));
107 break;
108 default:
109 npos = fp_pos;
110 break;
111 }
112#endif
113 if (npos == ep->description_pos) return;
114
115 ep->description_pos = npos;
116
117 ed->dirty = 1;
118#ifdef EDJE_CALC_CACHE
119 ep->invalidate = 1;
120#endif
121}
122
123
124/**
125 * Returns part description
126 *
127 * @internal
128 *
129 * Converts part description to RTL-desc.
130 *
131 * @param desc Pointer to desc buffer.
132 *
133 **/
134static void
135_edje_part_make_rtl(Edje_Part_Description_Common *desc)
136{
137 double t;
138 int i;
139
140 if(!desc)
141 return;
142
143 /* This makes alignment right-oriented */
144 desc->align.x = 1.0 - desc->align.x;
145
146 /* same as above for relative components */
147 t = desc->rel1.relative_x;
148 desc->rel1.relative_x = 1.0 - desc->rel2.relative_x;
149 desc->rel2.relative_x = 1.0 - t;
150
151 /* +1 and +1 are because how edje works with right
152 * side borders - nothing is printed beyond that limit
153 *
154 * rel2 is now to the left of rel1, and Edje assumes
155 * the opposite so we switch corners on x-axis to define
156 * offset from right to left */
157 i = desc->rel1.offset_x;
158 desc->rel1.offset_x = -(desc->rel2.offset_x + 1);
159 desc->rel2.offset_x = -(i + 1);
160
161 i = desc->rel1.id_x;
162 desc->rel1.id_x = desc->rel2.id_x;
163 desc->rel2.id_x = i;
164}
165
166/**
167 * Returns part description
168 *
169 * @internal
170 *
171 * Returns part description according to object orientation.
172 * When object is in RTL-orientation (RTL flag is set)
173 * this returns the RTL-desc of it.
174 * RTL-desc would be allocated if was not created by a previous call.
175 * The dst pointer is updated in case of an allocation.
176 *
177 * @param ed Edje object.
178 * @param src The Left To Right (LTR), original desc.
179 * @param dst Pointer to Right To Left (RTL) desc-list.
180 * @param type name of dec type. Example: "default".
181 *
182 * @return Edje part description.
183 *
184 **/
185static Edje_Part_Description_Common *
186_edje_get_description_by_orientation(Edje *ed, Edje_Part_Description_Common *src, Edje_Part_Description_Common **dst, unsigned char type)
187{
188 Edje_Part_Description_Common *desc_rtl = NULL;
189 Edje_Part_Collection_Directory_Entry *ce;
190 size_t memsize = 0;
191
192 /* RTL flag is not set, return original description */
193 if(!edje_object_mirrored_get(ed->obj))
194 return src;
195
196 if(*dst)
197 return *dst; /* Was allocated before and we should use it */
198
199#define EDIT_ALLOC_POOL_RTL(Short, Type, Name) \
200 case EDJE_PART_TYPE_##Short: \
201 { \
202 Edje_Part_Description_##Type *Name; \
203 Name = eina_mempool_malloc(ce->mp_rtl.Short, \
204 sizeof (Edje_Part_Description_##Type)); \
205 memset(Name, 0, sizeof(Edje_Part_Description_##Type)); \
206 desc_rtl = &Name->common; \
207 memsize = sizeof(Edje_Part_Description_##Type); \
208 break; \
209 }
210
211 ce = eina_hash_find(ed->file->collection, ed->group);
212
213 switch (type)
214 {
215 case EDJE_PART_TYPE_RECTANGLE:
216 desc_rtl = eina_mempool_malloc(ce->mp_rtl.RECTANGLE,
217 sizeof (Edje_Part_Description_Common));
218 ce->count.RECTANGLE++;
219 memsize = sizeof(Edje_Part_Description_Common);
220 break;
221 case EDJE_PART_TYPE_SWALLOW:
222 desc_rtl = eina_mempool_malloc(ce->mp_rtl.SWALLOW,
223 sizeof (Edje_Part_Description_Common));
224 ce->count.SWALLOW++;
225 memsize = sizeof(Edje_Part_Description_Common);
226 break;
227 case EDJE_PART_TYPE_GROUP:
228 desc_rtl = eina_mempool_malloc(ce->mp_rtl.GROUP,
229 sizeof (Edje_Part_Description_Common));
230 ce->count.GROUP++;
231 memsize = sizeof(Edje_Part_Description_Common);
232 break;
233 EDIT_ALLOC_POOL_RTL(TEXT, Text, text);
234 EDIT_ALLOC_POOL_RTL(TEXTBLOCK, Text, text);
235 EDIT_ALLOC_POOL_RTL(IMAGE, Image, image);
236 EDIT_ALLOC_POOL_RTL(PROXY, Proxy, proxy);
237 EDIT_ALLOC_POOL_RTL(BOX, Box, box);
238 EDIT_ALLOC_POOL_RTL(TABLE, Table, table);
239 EDIT_ALLOC_POOL_RTL(EXTERNAL, External, external_params);
240 }
241
242 if(desc_rtl)
243 memcpy(desc_rtl, src, memsize);
244
245 _edje_part_make_rtl(desc_rtl);
246
247 *dst = desc_rtl;
248 return desc_rtl;
249}
250
251Edje_Part_Description_Common *
252_edje_part_description_find(Edje *ed, Edje_Real_Part *rp, const char *name,
253 double val)
254{
255 Edje_Part *ep = rp->part;
256 Edje_Part_Description_Common *ret = NULL;
257 Edje_Part_Description_Common *d;
258
259 double min_dst = 99999.0;
260 unsigned int i;
261
262 /* RTL flag is set, return RTL description */
263 if(edje_object_mirrored_get(ed->obj))
264 if(!ep->other.desc_rtl)
265 ep->other.desc_rtl = (Edje_Part_Description_Common **)
266 calloc(ep->other.desc_count,
267 sizeof (Edje_Part_Description_Common *));
268
269 if (!strcmp(name, "default") && val == 0.0)
270 return _edje_get_description_by_orientation(ed,
271 ep->default_desc, &ep->default_desc_rtl, ep->type);
272
273 if (!strcmp(name, "custom"))
274 return rp->custom ?
275 _edje_get_description_by_orientation(ed, rp->custom->description,
276 &rp->custom->description_rtl, ep->type) : NULL;
277
278 if (!strcmp(name, "default"))
279 {
280 ret = _edje_get_description_by_orientation(ed, ep->default_desc,
281 &ep->default_desc_rtl, ep->type);
282
283 min_dst = ABS(ep->default_desc->state.value - val);
284 }
285
286 for (i = 0; i < ep->other.desc_count; ++i)
287 {
288 d = ep->other.desc[i];
289
290 if (d->state.name && (d->state.name == name || !strcmp(d->state.name, name)))
291 {
292 double dst;
293
294 dst = ABS(d->state.value - val);
295 if (dst < min_dst)
296 {
297 ret = _edje_get_description_by_orientation(ed, d,
298 &ep->other.desc_rtl[i], ep->type);
299 min_dst = dst;
300 }
301 }
302 }
303
304 return ret;
305}
306
307static void
308_edje_real_part_rel_to_apply(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part_State *state)
309{
310 state->rel1_to_x = state->rel1_to_y = NULL;
311 state->rel2_to_x = state->rel2_to_y = NULL;
312
313 if (state->description)
314 {
315 if (state->description->rel1.id_x >= 0)
316 state->rel1_to_x = ed->table_parts[state->description->rel1.id_x % ed->table_parts_size];
317 if (state->description->rel1.id_y >= 0)
318 state->rel1_to_y = ed->table_parts[state->description->rel1.id_y % ed->table_parts_size];
319 if (state->description->rel2.id_x >= 0)
320 state->rel2_to_x = ed->table_parts[state->description->rel2.id_x % ed->table_parts_size];
321 if (state->description->rel2.id_y >= 0)
322 state->rel2_to_y = ed->table_parts[state->description->rel2.id_y % ed->table_parts_size];
323
324 if (ep->part->type == EDJE_PART_TYPE_EXTERNAL)
325 {
326 Edje_Part_Description_External *external;
327
328 external = (Edje_Part_Description_External*) state->description;
329
330 if (state->external_params)
331 _edje_external_parsed_params_free(ep->swallowed_object, state->external_params);
332 state->external_params = _edje_external_params_parse(ep->swallowed_object, external->external_params);
333 }
334 }
335}
336
337void
338_edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, double v1, const char *d2, double v2)
339{
340 Edje_Part_Description_Common *epd1;
341 Edje_Part_Description_Common *epd2 = NULL;
342 Edje_Part_Description_Common *chosen_desc;
343
344 Edje_Part_Description_Image *epdi;
345
346 if (!d1) d1 = "default";
347
348 epd1 = _edje_part_description_find(ed, ep, d1, v1);
349 if (!epd1)
350 epd1 = ep->part->default_desc; /* never NULL */
351
352 if (d2)
353 epd2 = _edje_part_description_find(ed, ep, d2, v2);
354
355 epdi = (Edje_Part_Description_Image*) epd2;
356
357 /* There is an animation if both description are different or if description is an image with tweens */
358 if (epd2 && (epd1 != epd2 || (ep->part->type == EDJE_PART_TYPE_IMAGE && epdi->image.tweens_count)))
359 {
360 if (!ep->param2)
361 {
362 ep->param2 = eina_mempool_malloc(_edje_real_part_state_mp, sizeof (Edje_Real_Part_State));
363 memset(ep->param2, 0, sizeof (Edje_Real_Part_State));
364 }
365 else if (ep->part->type == EDJE_PART_TYPE_EXTERNAL)
366 _edje_external_parsed_params_free(ep->swallowed_object, ep->param2->external_params);
367 ep->param2->external_params = NULL;
368 }
369 else
370 if (ep->param2)
371 {
372 if (ep->part->type == EDJE_PART_TYPE_EXTERNAL)
373 _edje_external_parsed_params_free(ep->swallowed_object, ep->param2->external_params);
374 if (ep->param2)
375 free(ep->param2->set);
376 eina_mempool_free(_edje_real_part_state_mp, ep->param2);
377 ep->param2 = NULL;
378 }
379
380 chosen_desc = ep->chosen_description;
381 ep->param1.description = epd1;
382 ep->chosen_description = epd1;
383
384 _edje_real_part_rel_to_apply(ed, ep, &ep->param1);
385
386 if (ep->param2)
387 {
388 ep->param2->description = epd2;
389
390 _edje_real_part_rel_to_apply(ed, ep, ep->param2);
391
392 if (ep->description_pos != 0.0)
393 ep->chosen_description = epd2;
394 }
395
396 if (chosen_desc != ep->chosen_description &&
397 ep->part->type == EDJE_PART_TYPE_EXTERNAL)
398 _edje_external_recalc_apply(ed, ep, NULL, chosen_desc);
399
400 ed->dirty = 1;
401#ifdef EDJE_CALC_CACHE
402 ep->invalidate = 1;
403#endif
404}
405
406void
407_edje_recalc(Edje *ed)
408{
409 if ((ed->freeze > 0) || (_edje_freeze_val > 0))
410 {
411 ed->recalc = 1;
412 if (!ed->calc_only)
413 {
414 if (_edje_freeze_val > 0)
415 {
416 if (!ed->freeze_calc)
417 {
418 _edje_freeze_calc_count++;
419 _edje_freeze_calc_list = eina_list_append(_edje_freeze_calc_list, ed);
420 ed->freeze_calc = 1;
421 }
422 }
423 return;
424 }
425 }
426 if (ed->postponed) return;
427 evas_object_smart_changed(ed->obj);
428 ed->postponed = 1;
429}
430
431void
432_edje_recalc_do(Edje *ed)
433{
434 unsigned int i;
435
436 ed->postponed = 0;
437 evas_object_smart_need_recalculate_set(ed->obj, 0);
438 if (!ed->dirty) return;
439 ed->have_mapped_part = 0;
440 ed->dirty = 0;
441 ed->state++;
442 for (i = 0; i < ed->table_parts_size; i++)
443 {
444 Edje_Real_Part *ep;
445
446 ep = ed->table_parts[i];
447 ep->calculated = FLAG_NONE;
448 ep->calculating = FLAG_NONE;
449 }
450 for (i = 0; i < ed->table_parts_size; i++)
451 {
452 Edje_Real_Part *ep;
453
454 ep = ed->table_parts[i];
455 if (ep->calculated != FLAG_XY)
456 _edje_part_recalc(ed, ep, (~ep->calculated) & FLAG_XY, NULL);
457 }
458 if (!ed->calc_only) ed->recalc = 0;
459#ifdef EDJE_CALC_CACHE
460 ed->all_part_change = 0;
461 ed->text_part_change = 0;
462#endif
463}
464
465void
466_edje_part_recalc_1(Edje *ed, Edje_Real_Part *ep)
467{
468 _edje_part_recalc(ed, ep, FLAG_XY, NULL);
469}
470
471int
472_edje_part_dragable_calc(Edje *ed __UNUSED__, Edje_Real_Part *ep, FLOAT_T *x, FLOAT_T *y)
473{
474 if (ep->drag)
475 {
476 if (ep->drag->confine_to)
477 {
478 FLOAT_T dx, dy, dw, dh;
479 int ret = 0;
480
481 if ((ep->part->dragable.x != 0) &&
482 (ep->part->dragable.y != 0 )) ret = 3;
483 else if (ep->part->dragable.x != 0) ret = 1;
484 else if (ep->part->dragable.y != 0) ret = 2;
485
486 dx = FROM_INT(ep->x - ep->drag->confine_to->x);
487 dw = FROM_INT(ep->drag->confine_to->w - ep->w);
488 if (dw != ZERO) dx = DIV(dx, dw);
489 else dx = ZERO;
490
491 dy = FROM_INT(ep->y - ep->drag->confine_to->y);
492 dh = FROM_INT(ep->drag->confine_to->h - ep->h);
493 if (dh != ZERO) dy = DIV(dy, dh);
494 else dy = ZERO;
495
496 if (x) *x = dx;
497 if (y) *y = dy;
498
499 return ret;
500 }
501 else
502 {
503 if (x) *x = ADD(FROM_INT(ep->drag->tmp.x), ep->drag->x);
504 if (y) *y = ADD(FROM_INT(ep->drag->tmp.y), ep->drag->y);
505 return 0;
506 }
507 }
508 if (x) *x = ZERO;
509 if (y) *y = ZERO;
510 return 0;
511}
512
513void
514_edje_dragable_pos_set(Edje *ed, Edje_Real_Part *ep, FLOAT_T x, FLOAT_T y)
515{
516 /* check whether this part is dragable at all */
517 if (!ep->drag) return ;
518
519 /* instead of checking for equality, we really should check that
520 * the difference is greater than foo, but I have no idea what
521 * value we would set foo to, because it would depend on the
522 * size of the dragable...
523 */
524 if (ep->drag->x != x || ep->drag->tmp.x)
525 {
526 ep->drag->x = x;
527 ep->drag->tmp.x = 0;
528 ep->drag->need_reset = 0;
529 ed->dirty = 1;
530 }
531
532 if (ep->drag->y != y || ep->drag->tmp.y)
533 {
534 ep->drag->y = y;
535 ep->drag->tmp.y = 0;
536 ep->drag->need_reset = 0;
537 ed->dirty = 1;
538 }
539
540#ifdef EDJE_CALC_CACHE
541 ep->invalidate = 1;
542#endif
543 _edje_recalc(ed); /* won't do anything if dirty flag isn't set */
544}
545
546static void
547_edje_part_recalc_single_rel(Edje *ed,
548 Edje_Real_Part *ep __UNUSED__,
549 Edje_Part_Description_Common *desc,
550 Edje_Real_Part *rel1_to_x,
551 Edje_Real_Part *rel1_to_y,
552 Edje_Real_Part *rel2_to_x,
553 Edje_Real_Part *rel2_to_y,
554 Edje_Calc_Params *params)
555{
556 FLOAT_T x, w;
557 FLOAT_T y, h;
558
559 if (rel1_to_x)
560 x = ADD(FROM_INT(desc->rel1.offset_x + rel1_to_x->x),
561 SCALE(desc->rel1.relative_x, rel1_to_x->w));
562 else
563 x = ADD(FROM_INT(desc->rel1.offset_x),
564 SCALE(desc->rel1.relative_x, ed->w));
565 params->x = TO_INT(x);
566
567 if (rel2_to_x)
568 w = ADD(SUB(ADD(FROM_INT(desc->rel2.offset_x + rel2_to_x->x),
569 SCALE(desc->rel2.relative_x, rel2_to_x->w)),
570 x),
571 FROM_INT(1));
572 else
573 w = ADD(SUB(ADD(FROM_INT(desc->rel2.offset_x),
574 SCALE(desc->rel2.relative_x, ed->w)),
575 x),
576 FROM_INT(1));
577 params->w = TO_INT(w);
578
579 if (rel1_to_y)
580 y = ADD(FROM_INT(desc->rel1.offset_y + rel1_to_y->y),
581 SCALE(desc->rel1.relative_y, rel1_to_y->h));
582 else
583 y = ADD(FROM_INT(desc->rel1.offset_y),
584 SCALE(desc->rel1.relative_y, ed->h));
585 params->y = TO_INT(y);
586
587 if (rel2_to_y)
588 h = ADD(SUB(ADD(FROM_INT(desc->rel2.offset_y + rel2_to_y->y),
589 SCALE(desc->rel2.relative_y, rel2_to_y->h)),
590 y),
591 FROM_INT(1));
592 else
593 h = ADD(SUB(ADD(FROM_INT(desc->rel2.offset_y),
594 SCALE(desc->rel2.relative_y, ed->h)),
595 y),
596 FROM_INT(1));
597 params->h = TO_INT(h);
598}
599
600static Edje_Internal_Aspect
601_edje_part_recalc_single_aspect(Edje_Real_Part *ep,
602 Edje_Part_Description_Common *desc,
603 Edje_Calc_Params *params,
604 int *minw, int *minh,
605 int *maxw, int *maxh)
606{
607 Edje_Internal_Aspect apref = EDJE_ASPECT_PREFER_NONE;
608 FLOAT_T aspect, amax, amin;
609 FLOAT_T new_w = ZERO, new_h = ZERO, want_x, want_y, want_w, want_h;
610
611 if (params->h <= ZERO) aspect = FROM_INT(999999);
612 else aspect = DIV(FROM_INT(params->w), FROM_INT(params->h));
613 amax = desc->aspect.max;
614 amin = desc->aspect.min;
615 if ((ep->swallow_params.aspect.w > 0) &&
616 (ep->swallow_params.aspect.h > 0))
617 amin = amax =
618 DIV(FROM_INT(ep->swallow_params.aspect.w),
619 FROM_INT(ep->swallow_params.aspect.h));
620 want_x = FROM_INT(params->x);
621 want_w = new_w = FROM_INT(params->w);
622
623 want_y = FROM_INT(params->y);
624 want_h = new_h = FROM_INT(params->h);
625
626 if ((amin > ZERO) && (amax > ZERO))
627 {
628 apref = desc->aspect.prefer;
629 if (ep->swallow_params.aspect.mode > EDJE_ASPECT_CONTROL_NONE)
630 {
631 switch (ep->swallow_params.aspect.mode)
632 {
633 case EDJE_ASPECT_CONTROL_NEITHER:
634 apref = EDJE_ASPECT_PREFER_NONE;
635 break;
636 case EDJE_ASPECT_CONTROL_HORIZONTAL:
637 apref = EDJE_ASPECT_PREFER_HORIZONTAL;
638 break;
639 case EDJE_ASPECT_CONTROL_VERTICAL:
640 apref = EDJE_ASPECT_PREFER_VERTICAL;
641 break;
642 case EDJE_ASPECT_CONTROL_BOTH:
643 apref = EDJE_ASPECT_PREFER_BOTH;
644 break;
645 default:
646 break;
647 }
648 }
649 switch (apref)
650 {
651 case EDJE_ASPECT_PREFER_NONE:
652 /* keep both dimensions in check */
653 /* adjust for min aspect (width / height) */
654 if ((amin > ZERO) && (aspect < amin))
655 {
656 new_h = DIV(FROM_INT(params->w), amin);
657 new_w = SCALE(amin, params->h);
658 }
659 /* adjust for max aspect (width / height) */
660 if ((amax > ZERO) && (aspect > amax))
661 {
662 new_h = DIV(FROM_INT(params->w), amax);
663 new_w = SCALE(amax, params->h);
664 }
665 if ((amax > ZERO) && (new_w < FROM_INT(params->w)))
666 {
667 new_w = FROM_INT(params->w);
668 new_h = DIV(FROM_INT(params->w), amax);
669 }
670 if ((amax > ZERO) && (new_h < FROM_INT(params->h)))
671 {
672 new_w = SCALE(amax, params->h);
673 new_h = FROM_INT(params->h);
674 }
675 break;
676 /* prefer vertical size as determiner */
677 case EDJE_ASPECT_PREFER_VERTICAL:
678 /* keep both dimensions in check */
679 /* adjust for max aspect (width / height) */
680 if ((amax > ZERO) && (aspect > amax))
681 new_w = SCALE(amax, params->h);
682 /* adjust for min aspect (width / height) */
683 if ((amin > ZERO) && (aspect < amin))
684 new_w = SCALE(amin, params->h);
685 break;
686 /* prefer horizontal size as determiner */
687 case EDJE_ASPECT_PREFER_HORIZONTAL:
688 /* keep both dimensions in check */
689 /* adjust for max aspect (width / height) */
690 if ((amax > ZERO) && (aspect > amax))
691 new_h = DIV(FROM_INT(params->w), amax);
692 /* adjust for min aspect (width / height) */
693 if ((amin > ZERO) && (aspect < amin))
694 new_h = DIV(FROM_INT(params->w), amin);
695 break;
696 case EDJE_ASPECT_PREFER_BOTH:
697 /* keep both dimensions in check */
698 /* adjust for max aspect (width / height) */
699 if ((amax > ZERO) && (aspect > amax))
700 {
701 new_w = SCALE(amax, params->h);
702 new_h = DIV(FROM_INT(params->w), amax);
703 }
704 /* adjust for min aspect (width / height) */
705 if ((amin > ZERO) && (aspect < amin))
706 {
707 new_w = SCALE(amin, params->h);
708 new_h = DIV(FROM_INT(params->w), amin);
709 }
710 break;
711 default:
712 break;
713 }
714
715 if (!((amin > ZERO) && (amax > ZERO) && (apref == EDJE_ASPECT_PREFER_NONE)))
716 {
717 if ((*maxw >= 0) && (new_w > FROM_INT(*maxw)))
718 new_w = FROM_INT(*maxw);
719 if (new_w < FROM_INT(*minw))
720 new_w = FROM_INT(*minw);
721
722 if ((FROM_INT(*maxh) >= 0) && (new_h > FROM_INT(*maxh)))
723 new_h = FROM_INT(*maxh);
724 if (new_h < FROM_INT(*minh))
725 new_h = FROM_INT(*minh);
726 }
727
728 /* do real adjustment */
729 if (apref == EDJE_ASPECT_PREFER_BOTH)
730 {
731 if (amin == ZERO) amin = amax;
732 if (amin != ZERO)
733 {
734 /* fix h and vary w */
735 if (new_w > FROM_INT(params->w))
736 {
737 // params->w = new_w;
738 // EXCEEDS BOUNDS in W
739 new_h = DIV(FROM_INT(params->w), amin);
740 new_w = FROM_INT(params->w);
741 if (new_h > FROM_INT(params->h))
742 {
743 new_h = FROM_INT(params->h);
744 new_w = SCALE(amin, params->h);
745 }
746 }
747 /* fix w and vary h */
748 else
749 {
750 // params->h = new_h;
751 // EXCEEDS BOUNDS in H
752 new_h = FROM_INT(params->h);
753 new_w = SCALE(amin, params->h);
754 if (new_w > FROM_INT(params->w))
755 {
756 new_h = DIV(FROM_INT(params->w), amin);
757 new_w = FROM_INT(params->w);
758 }
759 }
760 params->w = TO_INT(new_w);
761 params->h = TO_INT(new_h);
762 }
763 }
764 }
765 if (apref != EDJE_ASPECT_PREFER_BOTH)
766 {
767 if ((amin > 0.0) && (amax > ZERO) && (apref == EDJE_ASPECT_PREFER_NONE))
768 {
769 params->w = TO_INT(new_w);
770 params->h = TO_INT(new_h);
771 }
772 else if ((FROM_INT(params->h) - new_h) > (FROM_INT(params->w) - new_w))
773 {
774 if (params->h < TO_INT(new_h))
775 params->h = TO_INT(new_h);
776 else if (params->h > TO_INT(new_h))
777 params->h = TO_INT(new_h);
778 if (apref == EDJE_ASPECT_PREFER_VERTICAL)
779 params->w = TO_INT(new_w);
780 }
781 else
782 {
783 if (params->w < TO_INT(new_w))
784 params->w = TO_INT(new_w);
785 else if (params->w > TO_INT(new_w))
786 params->w = TO_INT(new_w);
787 if (apref == EDJE_ASPECT_PREFER_HORIZONTAL)
788 params->h = TO_INT(new_h);
789 }
790 }
791 params->x = TO_INT(ADD(want_x,
792 MUL(SUB(want_w, FROM_INT(params->w)),
793 desc->align.x)));
794 params->y = TO_INT(ADD(want_y,
795 MUL(SUB(want_h, FROM_INT(params->h)),
796 desc->align.y)));
797 return apref;
798}
799
800static void
801_edje_part_recalc_single_step(Edje_Part_Description_Common *desc,
802 Edje_Calc_Params *params)
803{
804 if (desc->step.x > 0)
805 {
806 int steps;
807 int new_w;
808
809 steps = params->w / desc->step.x;
810 new_w = desc->step.x * steps;
811 if (params->w > new_w)
812 {
813 params->x += TO_INT(SCALE(desc->align.x, (params->w - new_w)));
814 params->w = new_w;
815 }
816 }
817
818 if (desc->step.y > 0)
819 {
820 int steps;
821 int new_h;
822
823 steps = params->h / desc->step.y;
824 new_h = desc->step.y * steps;
825 if (params->h > new_h)
826 {
827 params->y += TO_INT(SCALE(desc->align.y, (params->h - new_h)));
828 params->h = new_h;
829 }
830 }
831}
832
833static void
834_edje_part_recalc_single_textblock(FLOAT_T sc,
835 Edje *ed,
836 Edje_Real_Part *ep,
837 Edje_Part_Description_Text *chosen_desc,
838 Edje_Calc_Params *params,
839 int *minw, int *minh,
840 int *maxw, int *maxh)
841{
842 if (chosen_desc)
843 {
844 Evas_Coord tw, th, ins_l, ins_r, ins_t, ins_b;
845 const char *text = "";
846 const char *style = "";
847 Edje_Style *stl = NULL;
848 const char *tmp;
849 Eina_List *l;
850
851 if (chosen_desc->text.id_source >= 0)
852 {
853 ep->text.source = ed->table_parts[chosen_desc->text.id_source % ed->table_parts_size];
854
855 tmp = edje_string_get(&((Edje_Part_Description_Text *)ep->text.source->chosen_description)->text.style);
856 if (tmp) style = tmp;
857 }
858 else
859 {
860 ep->text.source = NULL;
861
862 tmp = edje_string_get(&chosen_desc->text.style);
863 if (tmp) style = tmp;
864 }
865
866 if (chosen_desc->text.id_text_source >= 0)
867 {
868 ep->text.text_source = ed->table_parts[chosen_desc->text.id_text_source % ed->table_parts_size];
869 text = edje_string_get(&((Edje_Part_Description_Text*)ep->text.text_source->chosen_description)->text.text);
870
871 if (ep->text.text_source->text.text) text = ep->text.text_source->text.text;
872 }
873 else
874 {
875 ep->text.text_source = NULL;
876 text = edje_string_get(&chosen_desc->text.text);
877 if (ep->text.text) text = ep->text.text;
878 }
879
880 EINA_LIST_FOREACH(ed->file->styles, l, stl)
881 {
882 if ((stl->name) && (!strcmp(stl->name, style))) break;
883 stl = NULL;
884 }
885
886 if (ep->part->scale)
887 evas_object_scale_set(ep->object, TO_DOUBLE(sc));
888
889 if (stl)
890 {
891 const char *ptxt;
892
893 if (evas_object_textblock_style_get(ep->object) != stl->style)
894 evas_object_textblock_style_set(ep->object, stl->style);
895 // FIXME: need to account for editing
896 if (ep->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
897 {
898 // do nothing - should be done elsewhere
899 }
900 else
901 {
902 ptxt = evas_object_textblock_text_markup_get(ep->object);
903 if (((!ptxt) && (text)) ||
904 ((ptxt) && (text) && (strcmp(ptxt, text))) ||
905 ((ptxt) && (!text)))
906 evas_object_textblock_text_markup_set(ep->object, text);
907 }
908 if ((chosen_desc->text.min_x) || (chosen_desc->text.min_y))
909 {
910 int mw = 0, mh = 0;
911
912 tw = th = 0;
913 if (!chosen_desc->text.min_x)
914 {
915 evas_object_resize(ep->object, params->w, params->h);
916 evas_object_textblock_size_formatted_get(ep->object, &tw, &th);
917 }
918 else
919 evas_object_textblock_size_native_get(ep->object, &tw, &th);
920 evas_object_textblock_style_insets_get(ep->object, &ins_l, &ins_r, &ins_t, &ins_b);
921 mw = ins_l + tw + ins_r;
922 mh = ins_t + th + ins_b;
923 if (chosen_desc->text.min_x)
924 {
925 if (mw > *minw) *minw = mw;
926 }
927 if (chosen_desc->text.min_y)
928 {
929 if (mh > *minh) *minh = mh;
930 }
931 }
932 }
933 if ((chosen_desc->text.max_x) || (chosen_desc->text.max_y))
934 {
935 int mw = 0, mh = 0;
936
937 tw = th = 0;
938 if (!chosen_desc->text.max_x)
939 {
940 evas_object_resize(ep->object, params->w, params->h);
941 evas_object_textblock_size_formatted_get(ep->object, &tw, &th);
942 }
943 else
944 evas_object_textblock_size_native_get(ep->object, &tw, &th);
945 evas_object_textblock_style_insets_get(ep->object, &ins_l, &ins_r, &ins_t, &ins_b);
946 mw = ins_l + tw + ins_r;
947 mh = ins_t + th + ins_b;
948 if (chosen_desc->text.max_x)
949 {
950 if (mw > *maxw) *maxw = mw;
951 if (*maxw < *minw) *maxw = *minw;
952 }
953 if (chosen_desc->text.max_y)
954 {
955 if (mh > *maxw) *maxh = mh;
956 if (*maxh < *minh) *maxh = *minh;
957 }
958 }
959 evas_object_textblock_valign_set(ep->object, chosen_desc->text.align.y);
960 }
961}
962
963static void
964_edje_part_recalc_single_text(FLOAT_T sc __UNUSED__,
965 Edje *ed,
966 Edje_Real_Part *ep,
967 Edje_Part_Description_Text *desc,
968 Edje_Part_Description_Text *chosen_desc,
969 Edje_Calc_Params *params,
970 int *minw, int *minh,
971 int *maxw, int *maxh)
972#define RECALC_SINGLE_TEXT_USING_APPLY 1
973#if RECALC_SINGLE_TEXT_USING_APPLY
974/*
975 * XXX TODO NOTE:
976 *
977 * Original _edje_part_recalc_single_text() was not working as
978 * expected since it was not doing size fit, range, ellipsis and so
979 * on.
980 *
981 * The purpose of this function compared with
982 * _edje_text_recalc_apply() is to be faster, not calling Evas update
983 * functions. However for text this is quite difficult given that to
984 * fit we need to set the font, size, style, etc. If it was done
985 * correctly, we'd save some calls to move and some color sets,
986 * however those shouldn't matter much in the overall picture.
987 *
988 * I've changed this to force applying the value, it should be more
989 * correct and not so slow. The previous code is kept below for
990 * reference but should be removed before next release!
991 *
992 * -- Gustavo Barbieri at 20-Aug-2011
993 */
994{
995 int tw, th, mw, mh, l, r, t, b, size;
996 char *sfont = NULL;
997
998 _edje_text_class_font_get(ed, desc, &size, &sfont);
999 free(sfont);
1000 params->type.text.size = size; /* XXX TODO used by further calcs, go inside recalc_apply? */
1001
1002 _edje_text_recalc_apply(ed, ep, params, chosen_desc);
1003
1004 evas_object_geometry_get(ep->object, NULL, NULL, &tw, &th);
1005
1006 if ((!chosen_desc) ||
1007 ((!chosen_desc->text.min_x) && (!chosen_desc->text.min_y) &&
1008 (!chosen_desc->text.max_x) && (!chosen_desc->text.max_y)))
1009 return;
1010
1011 evas_object_geometry_get(ep->object, NULL, NULL, &tw, &th);
1012 evas_object_text_style_pad_get(ep->object, &l, &r, &t, &b);
1013
1014 mw = tw + l + r;
1015 mh = th + t + b;
1016
1017 if (chosen_desc->text.max_x)
1018 {
1019 if ((*maxw < 0) || (mw < *maxw)) *maxw = mw;
1020 }
1021 if (chosen_desc->text.max_y)
1022 {
1023 if ((*maxh < 0) || (mh < *maxh)) *maxh = mh;
1024 }
1025 if (chosen_desc->text.min_x)
1026 {
1027 if (mw > *minw) *minw = mw;
1028 }
1029 if (chosen_desc->text.min_y)
1030 {
1031 if (mh > *minh) *minh = mh;
1032 }
1033}
1034#else
1035{
1036 char *sfont = NULL;
1037 int size;
1038
1039 if (chosen_desc)
1040 {
1041 const char *text;
1042 const char *font;
1043 Evas_Coord tw, th;
1044 int inlined_font = 0;
1045
1046 /* Update a object_text part */
1047
1048 if (chosen_desc->text.id_source >= 0)
1049 ep->text.source = ed->table_parts[chosen_desc->text.id_source % ed->table_parts_size];
1050 else
1051 ep->text.source = NULL;
1052
1053 if (chosen_desc->text.id_text_source >= 0)
1054 ep->text.text_source = ed->table_parts[chosen_desc->text.id_text_source % ed->table_parts_size];
1055 else
1056 ep->text.text_source = NULL;
1057
1058 if (ep->text.text_source)
1059 text = edje_string_get(&(((Edje_Part_Description_Text*)ep->text.text_source->chosen_description)->text.text));
1060 else
1061 text = edje_string_get(&chosen_desc->text.text);
1062
1063 if (ep->text.source)
1064 font = _edje_text_class_font_get(ed, ((Edje_Part_Description_Text*)ep->text.source->chosen_description), &size, &sfont);
1065 else
1066 font = _edje_text_class_font_get(ed, chosen_desc, &size, &sfont);
1067
1068 if (!font) font = "";
1069
1070 if (ep->text.text_source)
1071 {
1072 if (ep->text.text_source->text.text) text = ep->text.text_source->text.text;
1073 }
1074 else
1075 {
1076 if (ep->text.text) text = ep->text.text;
1077 }
1078
1079 if (ep->text.source)
1080 {
1081 if (ep->text.source->text.font) font = ep->text.source->text.font;
1082 if (ep->text.source->text.size > 0) size = ep->text.source->text.size;
1083 }
1084 else
1085 {
1086 if (ep->text.font) font = ep->text.font;
1087 if (ep->text.size > 0) size = ep->text.size;
1088 }
1089 if (!text) text = "";
1090
1091 /* check if the font is embedded in the .eet */
1092 if (ed->file->fonts)
1093 {
1094 Edje_Font_Directory_Entry *fnt;
1095
1096 fnt = eina_hash_find(ed->file->fonts, font);
1097
1098 if (fnt)
1099 {
1100 char *font2;
1101
1102 size_t len = strlen(font) + sizeof("edje/fonts/") + 1;
1103 font2 = alloca(len);
1104 sprintf(font2, "edje/fonts/%s", font);
1105 font = font2;
1106 inlined_font = 1;
1107 }
1108 }
1109 if (ep->part->scale)
1110 evas_object_scale_set(ep->object, TO_DOUBLE(sc));
1111 if (inlined_font)
1112 {
1113 evas_object_text_font_source_set(ep->object, ed->path);
1114 }
1115 else evas_object_text_font_source_set(ep->object, NULL);
1116
1117 if ((_edje_fontset_append) && (font))
1118 {
1119 char *font2;
1120
1121 font2 = malloc(strlen(font) + 1 + strlen(_edje_fontset_append) + 1);
1122 if (font2)
1123 {
1124 strcpy(font2, font);
1125 strcat(font2, ",");
1126 strcat(font2, _edje_fontset_append);
1127 evas_object_text_font_set(ep->object, font2, size);
1128 free(font2);
1129 }
1130 }
1131 else
1132 evas_object_text_font_set(ep->object, font, size);
1133 if ((chosen_desc->text.min_x) || (chosen_desc->text.min_y) ||
1134 (chosen_desc->text.max_x) || (chosen_desc->text.max_y))
1135 {
1136 int mw, mh;
1137 Evas_Text_Style_Type
1138 style = EVAS_TEXT_STYLE_PLAIN,
1139 shadow = EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT;
1140 const Evas_Text_Style_Type styles[] = {
1141 EVAS_TEXT_STYLE_PLAIN,
1142 EVAS_TEXT_STYLE_PLAIN,
1143 EVAS_TEXT_STYLE_OUTLINE,
1144 EVAS_TEXT_STYLE_SOFT_OUTLINE,
1145 EVAS_TEXT_STYLE_SHADOW,
1146 EVAS_TEXT_STYLE_SOFT_SHADOW,
1147 EVAS_TEXT_STYLE_OUTLINE_SHADOW,
1148 EVAS_TEXT_STYLE_OUTLINE_SOFT_SHADOW,
1149 EVAS_TEXT_STYLE_FAR_SHADOW,
1150 EVAS_TEXT_STYLE_FAR_SOFT_SHADOW,
1151 EVAS_TEXT_STYLE_GLOW
1152 };
1153 const Evas_Text_Style_Type shadows[] = {
1154 EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT,
1155 EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM,
1156 EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_LEFT,
1157 EVAS_TEXT_STYLE_SHADOW_DIRECTION_LEFT,
1158 EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_LEFT,
1159 EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP,
1160 EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT,
1161 EVAS_TEXT_STYLE_SHADOW_DIRECTION_RIGHT
1162 };
1163
1164 if ((ep->part->effect & EVAS_TEXT_STYLE_MASK_BASIC)
1165 < EDJE_TEXT_EFFECT_LAST)
1166 style = styles[ep->part->effect];
1167 shadow = shadows
1168 [(ep->part->effect & EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION) >> 4];
1169 EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(style, shadow);
1170
1171 evas_object_text_style_set(ep->object, style);
1172 evas_object_text_text_set(ep->object, text);
1173 evas_object_geometry_get(ep->object, NULL, NULL, &tw, &th);
1174 if (chosen_desc->text.max_x)
1175 {
1176 int l, r;
1177 evas_object_text_style_pad_get(ep->object, &l, &r, NULL, NULL);
1178 mw = tw + l + r;
1179 if ((*maxw < 0) || (mw < *maxw)) *maxw = mw;
1180 }
1181 if (chosen_desc->text.max_y)
1182 {
1183 int t, b;
1184 evas_object_text_style_pad_get(ep->object, NULL, NULL, &t, &b);
1185 mh = th + t + b;
1186 if ((*maxh < 0) || (mh < *maxh)) *maxh = mh;
1187 }
1188 if (chosen_desc->text.min_x)
1189 {
1190 int l, r;
1191 evas_object_text_style_pad_get(ep->object, &l, &r, NULL, NULL);
1192 mw = tw + l + r;
1193 if (mw > *minw) *minw = mw;
1194 }
1195 if (chosen_desc->text.min_y)
1196 {
1197 int t, b;
1198 evas_object_text_style_pad_get(ep->object, NULL, NULL, &t, &b);
1199 mh = th + t + b;
1200 if (mh > *minh) *minh = mh;
1201 }
1202 }
1203 if (sfont) free(sfont);
1204 }
1205
1206 /* FIXME: Do we really need to call it twice if chosen_desc ? */
1207 sfont = NULL;
1208 _edje_text_class_font_get(ed, desc, &size, &sfont);
1209 free(sfont);
1210 params->type.text.size = size;
1211}
1212#endif
1213
1214static void
1215_edje_part_recalc_single_min_length(FLOAT_T align, int *start, int *length, int min)
1216{
1217 if (min >= 0)
1218 {
1219 if (*length < min)
1220 {
1221 *start += TO_INT(SCALE(align, (*length - min)));
1222 *length = min;
1223 }
1224 }
1225}
1226
1227static void
1228_edje_part_recalc_single_min(Edje_Part_Description_Common *desc,
1229 Edje_Calc_Params *params,
1230 int minw, int minh,
1231 Edje_Internal_Aspect aspect)
1232{
1233 int tmp;
1234 int w;
1235 int h;
1236
1237 w = params->w ? params->w : 99999;
1238 h = params->h ? params->h : 99999;
1239
1240 switch (aspect)
1241 {
1242 case EDJE_ASPECT_PREFER_NONE:
1243 break;
1244 case EDJE_ASPECT_PREFER_VERTICAL:
1245 tmp = minh * params->w / h;
1246 if (tmp >= minw)
1247 {
1248 minw = tmp;
1249 break;
1250 }
1251 case EDJE_ASPECT_PREFER_HORIZONTAL:
1252 tmp = minw * params->h / w;
1253 if (tmp >= minh)
1254 {
1255 minh = tmp;
1256 break;
1257 }
1258 case EDJE_ASPECT_PREFER_BOTH:
1259 tmp = minh * params->w / h;
1260 if (tmp >= minw)
1261 {
1262 minw = tmp;
1263 break;
1264 }
1265
1266 tmp = minw * params->h / w;
1267 if (tmp >= minh)
1268 {
1269 minh = tmp;
1270 break;
1271 }
1272
1273 break;
1274 }
1275
1276 _edje_part_recalc_single_min_length(desc->align.x, &params->x, &params->w, minw);
1277 _edje_part_recalc_single_min_length(desc->align.y, &params->y, &params->h, minh);
1278}
1279
1280static void
1281_edje_part_recalc_single_max_length(FLOAT_T align, int *start, int *length, int max)
1282{
1283 if (max >= 0)
1284 {
1285 if (*length > max)
1286 {
1287 *start += TO_INT(SCALE(align, (*length - max)));
1288 *length = max;
1289 }
1290 }
1291}
1292
1293static void
1294_edje_part_recalc_single_max(Edje_Part_Description_Common *desc,
1295 Edje_Calc_Params *params,
1296 int maxw, int maxh,
1297 Edje_Internal_Aspect aspect)
1298{
1299 int tmp;
1300 int w;
1301 int h;
1302
1303 w = params->w ? params->w : 99999;
1304 h = params->h ? params->h : 99999;
1305
1306 switch (aspect)
1307 {
1308 case EDJE_ASPECT_PREFER_NONE:
1309 break;
1310 case EDJE_ASPECT_PREFER_VERTICAL:
1311 tmp = maxh * params->w / h;
1312 if (tmp <= maxw)
1313 {
1314 maxw = tmp;
1315 break;
1316 }
1317 case EDJE_ASPECT_PREFER_HORIZONTAL:
1318 tmp = maxw * params->h / w;
1319 if (tmp <= maxh)
1320 {
1321 maxh = tmp;
1322 break;
1323 }
1324 case EDJE_ASPECT_PREFER_BOTH:
1325 tmp = maxh * params->w / h;
1326 if (tmp <= maxw)
1327 {
1328 maxw = tmp;
1329 break;
1330 }
1331
1332 tmp = maxw * params->h / w;
1333 if (tmp <= maxh)
1334 {
1335 maxh = tmp;
1336 break;
1337 }
1338
1339 break;
1340 }
1341
1342 _edje_part_recalc_single_max_length(desc->align.x, &params->x, &params->w, maxw);
1343 _edje_part_recalc_single_max_length(desc->align.y, &params->y, &params->h, maxh);
1344}
1345
1346static void
1347_edje_part_recalc_single_drag(Edje_Real_Part *ep,
1348 Edje_Real_Part *confine_to,
1349 Edje_Calc_Params *params,
1350 int minw, int minh,
1351 int maxw, int maxh)
1352{
1353 /* confine */
1354 if (confine_to)
1355 {
1356 int offset;
1357 int step;
1358 FLOAT_T v;
1359
1360 /* complex dragable params */
1361 v = SCALE(ep->drag->size.x, confine_to->w);
1362
1363 if ((minw > 0) && (TO_INT(v) < minw)) params->w = minw;
1364 else if ((maxw >= 0) && (TO_INT(v) > maxw)) params->w = maxw;
1365 else params->w = TO_INT(v);
1366
1367 offset = TO_INT(SCALE(ep->drag->x, (confine_to->w - params->w)))
1368 + ep->drag->tmp.x;
1369 if (ep->part->dragable.step_x > 0)
1370 {
1371 params->x = confine_to->x +
1372 ((offset / ep->part->dragable.step_x) * ep->part->dragable.step_x);
1373 }
1374 else if (ep->part->dragable.count_x > 0)
1375 {
1376 step = (confine_to->w - params->w) / ep->part->dragable.count_x;
1377 if (step < 1) step = 1;
1378 params->x = confine_to->x +
1379 ((offset / step) * step);
1380 }
1381 params->req_drag.x = params->x;
1382 params->req_drag.w = params->w;
1383
1384 v = SCALE(ep->drag->size.y, confine_to->h);
1385
1386 if ((minh > 0) && (TO_INT(v) < minh)) params->h = minh;
1387 else if ((maxh >= 0) && (TO_INT(v) > maxh)) params->h = maxh;
1388 else params->h = TO_INT(v);
1389
1390 offset = TO_INT(SCALE(ep->drag->y, (confine_to->h - params->h)))
1391 + ep->drag->tmp.y;
1392 if (ep->part->dragable.step_y > 0)
1393 {
1394 params->y = confine_to->y +
1395 ((offset / ep->part->dragable.step_y) * ep->part->dragable.step_y);
1396 }
1397 else if (ep->part->dragable.count_y > 0)
1398 {
1399 step = (confine_to->h - params->h) / ep->part->dragable.count_y;
1400 if (step < 1) step = 1;
1401 params->y = confine_to->y +
1402 ((offset / step) * step);
1403 }
1404 params->req_drag.y = params->y;
1405 params->req_drag.h = params->h;
1406
1407 /* limit to confine */
1408 if (params->x < confine_to->x)
1409 {
1410 params->x = confine_to->x;
1411 }
1412 if ((params->x + params->w) > (confine_to->x + confine_to->w))
1413 {
1414 params->x = confine_to->x + confine_to->w - params->w;
1415 }
1416 if (params->y < confine_to->y)
1417 {
1418 params->y = confine_to->y;
1419 }
1420 if ((params->y + params->h) > (confine_to->y + confine_to->h))
1421 {
1422 params->y = confine_to->y + confine_to->h - params->h;
1423 }
1424 }
1425 else
1426 {
1427 /* simple dragable params */
1428 params->x += TO_INT(ep->drag->x) + ep->drag->tmp.x;
1429 params->req_drag.x = params->x;
1430 params->req_drag.w = params->w;
1431
1432 params->y += TO_INT(ep->drag->y) + ep->drag->tmp.y;
1433 params->req_drag.y = params->y;
1434 params->req_drag.h = params->h;
1435 }
1436}
1437
1438static void
1439_edje_part_recalc_single_fill(Edje_Real_Part *ep,
1440 Edje_Part_Description_Spec_Fill *fill,
1441 Edje_Calc_Params *params)
1442{
1443 int fw;
1444 int fh;
1445
1446 params->smooth = fill->smooth;
1447
1448 if (fill->type == EDJE_FILL_TYPE_TILE)
1449 evas_object_image_size_get(ep->object, &fw, NULL);
1450 else
1451 fw = params->w;
1452
1453 params->type.common.fill.x = fill->pos_abs_x
1454 + TO_INT(SCALE(fill->pos_rel_x, fw));
1455 params->type.common.fill.w = fill->abs_x
1456 + TO_INT(SCALE(fill->rel_x, fw));
1457
1458 if (fill->type == EDJE_FILL_TYPE_TILE)
1459 evas_object_image_size_get(ep->object, NULL, &fh);
1460 else
1461 fh = params->h;
1462
1463 params->type.common.fill.y = fill->pos_abs_y
1464 + TO_INT(SCALE(fill->pos_rel_y, fh));
1465 params->type.common.fill.h = fill->abs_y
1466 + TO_INT(SCALE(fill->rel_y, fh));
1467
1468 params->type.common.fill.angle = fill->angle;
1469 params->type.common.fill.spread = fill->spread;
1470}
1471
1472static void
1473_edje_part_recalc_single_min_max(FLOAT_T sc,
1474 Edje_Real_Part *ep,
1475 Edje_Part_Description_Common *desc,
1476 int *minw, int *minh,
1477 int *maxw, int *maxh)
1478{
1479 *minw = desc->min.w;
1480 if (ep->part->scale) *minw = TO_INT(SCALE(sc, *minw));
1481 if (ep->swallow_params.min.w > desc->min.w)
1482 *minw = ep->swallow_params.min.w;
1483
1484 /* XXX TODO: remove need of EDJE_INF_MAX_W, see edje_util.c */
1485 if ((ep->swallow_params.max.w <= 0) ||
1486 (ep->swallow_params.max.w == EDJE_INF_MAX_W))
1487 {
1488 *maxw = desc->max.w;
1489 if (*maxw > 0)
1490 {
1491 if (ep->part->scale) *maxw = TO_INT(SCALE(sc, *maxw));
1492 if (*maxw < 1) *maxw = 1;
1493 }
1494 }
1495 else
1496 {
1497 if (desc->max.w <= 0)
1498 *maxw = ep->swallow_params.max.w;
1499 else
1500 {
1501 *maxw = desc->max.w;
1502 if (*maxw > 0)
1503 {
1504 if (ep->part->scale) *maxw = TO_INT(SCALE(sc, *maxw));
1505 if (*maxw < 1) *maxw = 1;
1506 }
1507 if (ep->swallow_params.max.w < *maxw)
1508 *maxw = ep->swallow_params.max.w;
1509 }
1510 }
1511 if (*maxw >= 0)
1512 {
1513 if (*maxw < *minw) *maxw = *minw;
1514 }
1515
1516 *minh = desc->min.h;
1517 if (ep->part->scale) *minh = TO_INT(SCALE(sc, *minh));
1518 if (ep->swallow_params.min.h > desc->min.h)
1519 *minh = ep->swallow_params.min.h;
1520
1521 /* XXX TODO: remove need of EDJE_INF_MAX_H, see edje_util.c */
1522 if ((ep->swallow_params.max.h <= 0) ||
1523 (ep->swallow_params.max.h == EDJE_INF_MAX_H))
1524 {
1525 *maxh = desc->max.h;
1526 if (*maxh > 0)
1527 {
1528 if (ep->part->scale) *maxh = TO_INT(SCALE(sc, *maxh));
1529 if (*maxh < 1) *maxh = 1;
1530 }
1531 }
1532 else
1533 {
1534 if (desc->max.h <= 0)
1535 *maxh = ep->swallow_params.max.h;
1536 else
1537 {
1538 *maxh = desc->max.h;
1539 if (*maxh > 0)
1540 {
1541 if (ep->part->scale) *maxh = TO_INT(SCALE(sc, *maxh));
1542 if (*maxh < 1) *maxh = 1;
1543 }
1544 if (ep->swallow_params.max.h < *maxh)
1545 *maxh = ep->swallow_params.max.h;
1546 }
1547 }
1548 if (*maxh >= 0)
1549 {
1550 if (*maxh < *minh) *maxh = *minh;
1551 }
1552}
1553
1554static void
1555_edje_part_recalc_single_map(Edje *ed,
1556 Edje_Real_Part *ep __UNUSED__,
1557 Edje_Real_Part *center,
1558 Edje_Real_Part *light,
1559 Edje_Real_Part *persp,
1560 Edje_Part_Description_Common *desc,
1561 Edje_Part_Description_Common *chosen_desc,
1562 Edje_Calc_Params *params)
1563{
1564 params->mapped = chosen_desc->map.on;
1565 params->lighted = params->mapped ? !!light : 0;
1566 params->persp_on = params->mapped ? !!persp : 0;
1567
1568 if (!params->mapped) return ;
1569
1570 if (center)
1571 {
1572 params->map.center.x = ed->x + center->x + (center->w / 2);
1573 params->map.center.y = ed->y + center->y + (center->h / 2);
1574 }
1575 else
1576 {
1577 params->map.center.x = ed->x + params->x + (params->w / 2);
1578 params->map.center.y = ed->y + params->y + (params->h / 2);
1579 }
1580 params->map.center.z = 0;
1581
1582 params->map.rotation.x = TO_DOUBLE(desc->map.rot.x);
1583 params->map.rotation.y = TO_DOUBLE(desc->map.rot.y);
1584 params->map.rotation.z = TO_DOUBLE(desc->map.rot.z);
1585
1586 if (light)
1587 {
1588 Edje_Part_Description_Common *light_desc2;
1589 FLOAT_T pos, pos2;
1590
1591 params->map.light.x = ed->x + light->x + (light->w / 2);
1592 params->map.light.y = ed->y + light->y + (light->h / 2);
1593
1594 pos = light->description_pos;
1595 pos2 = (pos < ZERO) ? ZERO : ((pos > FROM_INT(1)) ? FROM_INT(1) : pos);
1596
1597 light_desc2 = light->param2 ? light->param2->description : NULL;
1598
1599 /* take into account CURRENT state also */
1600 if (pos != ZERO && light_desc2)
1601 {
1602 params->map.light.z = light->param1.description->persp.zplane +
1603 TO_INT(SCALE(pos, light_desc2->persp.zplane - light->param1.description->persp.zplane));
1604 params->map.light.r = light->param1.description->color.r +
1605 TO_INT(SCALE(pos2, light_desc2->color.r - light->param1.description->color.r));
1606 params->map.light.g = light->param1.description->color.g +
1607 TO_INT(SCALE(pos2, light_desc2->color.g - light->param1.description->color.g));
1608 params->map.light.b = light->param1.description->color.b +
1609 TO_INT(SCALE(pos2, light_desc2->color.b - light->param1.description->color.b));
1610 params->map.light.ar = light->param1.description->color2.r +
1611 TO_INT(SCALE(pos2, light_desc2->color2.r - light->param1.description->color2.r));
1612 params->map.light.ag = light->param1.description->color2.g +
1613 TO_INT(SCALE(pos2, light_desc2->color2.g - light->param1.description->color2.g));
1614 params->map.light.ab = light->param1.description->color2.b +
1615 TO_INT(SCALE(pos2, light_desc2->color2.b - light->param1.description->color2.b));
1616 }
1617 else
1618 {
1619 params->map.light.z = light->param1.description->persp.zplane;
1620 params->map.light.r = light->param1.description->color.r;
1621 params->map.light.g = light->param1.description->color.g;
1622 params->map.light.b = light->param1.description->color.b;
1623 params->map.light.ar = light->param1.description->color2.r;
1624 params->map.light.ag = light->param1.description->color2.g;
1625 params->map.light.ab = light->param1.description->color2.b;
1626 }
1627 }
1628
1629 if (persp)
1630 {
1631 FLOAT_T pos;
1632
1633 params->map.persp.x = ed->x + persp->x + (persp->w / 2);
1634 params->map.persp.y = ed->y + persp->y + (persp->h / 2);
1635
1636 pos = persp->description_pos;
1637
1638 if (pos != 0 && persp->param2)
1639 {
1640 params->map.persp.z = persp->param1.description->persp.zplane +
1641 TO_INT(SCALE(pos, persp->param2->description->persp.zplane -
1642 persp->param1.description->persp.zplane));
1643 params->map.persp.focal = persp->param1.description->persp.focal +
1644 TO_INT(SCALE(pos, persp->param2->description->persp.focal -
1645 persp->param1.description->persp.focal));
1646 }
1647 else
1648 {
1649 params->map.persp.z = persp->param1.description->persp.zplane;
1650 params->map.persp.focal = persp->param1.description->persp.focal;
1651 }
1652 }
1653}
1654
1655static void
1656_edje_part_recalc_single(Edje *ed,
1657 Edje_Real_Part *ep,
1658 Edje_Part_Description_Common *desc,
1659 Edje_Part_Description_Common *chosen_desc,
1660 Edje_Real_Part *center,
1661 Edje_Real_Part *light,
1662 Edje_Real_Part *persp,
1663 Edje_Real_Part *rel1_to_x,
1664 Edje_Real_Part *rel1_to_y,
1665 Edje_Real_Part *rel2_to_x,
1666 Edje_Real_Part *rel2_to_y,
1667 Edje_Real_Part *confine_to,
1668 Edje_Calc_Params *params)
1669{
1670 Edje_Color_Class *cc = NULL;
1671 Edje_Internal_Aspect apref;
1672 int minw = 0, minh = 0, maxw = 0, maxh = 0;
1673 FLOAT_T sc;
1674
1675 sc = ed->scale;
1676 if (sc == ZERO) sc = _edje_scale;
1677 _edje_part_recalc_single_min_max(sc, ep, desc, &minw, &minh, &maxw, &maxh);
1678
1679 /* relative coords of top left & bottom right */
1680 _edje_part_recalc_single_rel(ed, ep, desc, rel1_to_x, rel1_to_y, rel2_to_x, rel2_to_y, params);
1681
1682 /* aspect */
1683 apref = _edje_part_recalc_single_aspect(ep, desc, params, &minw, &minh, &maxw, &maxh);
1684
1685 /* size step */
1686 _edje_part_recalc_single_step(desc, params);
1687
1688 /* if we have text that wants to make the min size the text size... */
1689 if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK)
1690 _edje_part_recalc_single_textblock(sc, ed, ep, (Edje_Part_Description_Text*) chosen_desc, params, &minw, &minh, &maxw, &maxh);
1691 else if (ep->part->type == EDJE_PART_TYPE_TEXT)
1692 _edje_part_recalc_single_text(sc, ed, ep, (Edje_Part_Description_Text*) desc, (Edje_Part_Description_Text*) chosen_desc, params, &minw, &minh, &maxw, &maxh);
1693
1694 if ((ep->part->type == EDJE_PART_TYPE_TABLE) &&
1695 (((((Edje_Part_Description_Table *)chosen_desc)->table.min.h) ||
1696 (((Edje_Part_Description_Table *)chosen_desc)->table.min.v))))
1697 {
1698 Evas_Coord lminw = 0, lminh = 0;
1699
1700 evas_object_smart_need_recalculate_set(ep->object, 1);
1701 evas_object_smart_calculate(ep->object);
1702 evas_object_size_hint_min_get(ep->object, &lminw, &lminh);
1703 if (((Edje_Part_Description_Table *)chosen_desc)->table.min.h)
1704 {
1705 if (lminw > minw) minw = lminw;
1706 }
1707 if (((Edje_Part_Description_Table *)chosen_desc)->table.min.v)
1708 {
1709 if (lminh > minh) minh = lminh;
1710 }
1711 }
1712 else if ((ep->part->type == EDJE_PART_TYPE_BOX) &&
1713 ((((Edje_Part_Description_Box *)chosen_desc)->box.min.h) ||
1714 (((Edje_Part_Description_Box *)chosen_desc)->box.min.v)))
1715 {
1716 Evas_Coord lminw = 0, lminh = 0;
1717
1718 evas_object_smart_need_recalculate_set(ep->object, 1);
1719 evas_object_smart_calculate(ep->object);
1720 evas_object_size_hint_min_get(ep->object, &lminw, &lminh);
1721 if (((Edje_Part_Description_Box *)chosen_desc)->box.min.h)
1722 {
1723 if (lminw > minw) minw = lminw;
1724 }
1725 if (((Edje_Part_Description_Box *)chosen_desc)->box.min.v)
1726 {
1727 if (lminh > minh) minh = lminh;
1728 }
1729 }
1730
1731 /* remember what our size is BEFORE we go limit it */
1732 params->req.x = params->x;
1733 params->req.y = params->y;
1734 params->req.w = params->w;
1735 params->req.h = params->h;
1736
1737 /* adjust for min size */
1738 _edje_part_recalc_single_min(desc, params, minw, minh, apref);
1739
1740 /* adjust for max size */
1741 _edje_part_recalc_single_max(desc, params, maxw, maxh, apref);
1742
1743 /* take care of dragable part */
1744 if (ep->drag)
1745 _edje_part_recalc_single_drag(ep, confine_to, params, minw, minh, maxw, maxh);
1746
1747 /* fill */
1748 if (ep->part->type == EDJE_PART_TYPE_IMAGE)
1749 _edje_part_recalc_single_fill(ep, &((Edje_Part_Description_Image *)desc)->image.fill, params);
1750 else if (ep->part->type == EDJE_PART_TYPE_PROXY)
1751 _edje_part_recalc_single_fill(ep, &((Edje_Part_Description_Proxy *)desc)->proxy.fill, params);
1752
1753 /* colors */
1754 if ((desc->color_class) && (*desc->color_class))
1755 cc = _edje_color_class_find(ed, desc->color_class);
1756
1757 if (cc)
1758 {
1759 params->color.r = (((int)cc->r + 1) * desc->color.r) >> 8;
1760 params->color.g = (((int)cc->g + 1) * desc->color.g) >> 8;
1761 params->color.b = (((int)cc->b + 1) * desc->color.b) >> 8;
1762 params->color.a = (((int)cc->a + 1) * desc->color.a) >> 8;
1763 }
1764 else
1765 {
1766 params->color.r = desc->color.r;
1767 params->color.g = desc->color.g;
1768 params->color.b = desc->color.b;
1769 params->color.a = desc->color.a;
1770 }
1771
1772 /* visible */
1773 params->visible = desc->visible;
1774
1775 switch (ep->part->type)
1776 {
1777 case EDJE_PART_TYPE_IMAGE:
1778 {
1779 Edje_Part_Description_Image *img_desc = (Edje_Part_Description_Image*) desc;
1780
1781 /* border */
1782 params->type.common.spec.image.l = img_desc->image.border.l;
1783 params->type.common.spec.image.r = img_desc->image.border.r;
1784
1785 params->type.common.spec.image.t = img_desc->image.border.t;
1786 params->type.common.spec.image.b = img_desc->image.border.b;
1787 break;
1788 }
1789 case EDJE_PART_TYPE_TEXT:
1790 case EDJE_PART_TYPE_TEXTBLOCK:
1791 {
1792 Edje_Part_Description_Text *text_desc = (Edje_Part_Description_Text*) desc;
1793
1794 /* text.align */
1795 params->type.text.align.x = text_desc->text.align.x;
1796 params->type.text.align.y = text_desc->text.align.y;
1797 params->type.text.elipsis = text_desc->text.elipsis;
1798
1799 /* text colors */
1800 if (cc)
1801 {
1802 params->type.text.color2.r = (((int)cc->r2 + 1) * text_desc->common.color2.r) >> 8;
1803 params->type.text.color2.g = (((int)cc->g2 + 1) * text_desc->common.color2.g) >> 8;
1804 params->type.text.color2.b = (((int)cc->b2 + 1) * text_desc->common.color2.b) >> 8;
1805 params->type.text.color2.a = (((int)cc->a2 + 1) * text_desc->common.color2.a) >> 8;
1806 params->type.text.color3.r = (((int)cc->r3 + 1) * text_desc->text.color3.r) >> 8;
1807 params->type.text.color3.g = (((int)cc->g3 + 1) * text_desc->text.color3.g) >> 8;
1808 params->type.text.color3.b = (((int)cc->b3 + 1) * text_desc->text.color3.b) >> 8;
1809 params->type.text.color3.a = (((int)cc->a3 + 1) * text_desc->text.color3.a) >> 8;
1810 }
1811 else
1812 {
1813 params->type.text.color2.r = text_desc->common.color2.r;
1814 params->type.text.color2.g = text_desc->common.color2.g;
1815 params->type.text.color2.b = text_desc->common.color2.b;
1816 params->type.text.color2.a = text_desc->common.color2.a;
1817 params->type.text.color3.r = text_desc->text.color3.r;
1818 params->type.text.color3.g = text_desc->text.color3.g;
1819 params->type.text.color3.b = text_desc->text.color3.b;
1820 params->type.text.color3.a = text_desc->text.color3.a;
1821 }
1822
1823 break;
1824 }
1825 case EDJE_PART_TYPE_RECTANGLE:
1826 case EDJE_PART_TYPE_BOX:
1827 case EDJE_PART_TYPE_TABLE:
1828 case EDJE_PART_TYPE_SWALLOW:
1829 case EDJE_PART_TYPE_GROUP:
1830 case EDJE_PART_TYPE_PROXY:
1831 break;
1832 case EDJE_PART_TYPE_GRADIENT:
1833 /* FIXME: THIS ONE SHOULD NEVER BE TRIGGERED. */
1834 break;
1835 default:
1836 break;
1837 }
1838
1839 _edje_part_recalc_single_map(ed, ep, center, light, persp, desc, chosen_desc, params);
1840}
1841
1842static void
1843_edje_table_recalc_apply(Edje *ed __UNUSED__,
1844 Edje_Real_Part *ep,
1845 Edje_Calc_Params *p3 __UNUSED__,
1846 Edje_Part_Description_Table *chosen_desc)
1847{
1848 evas_object_table_homogeneous_set(ep->object, chosen_desc->table.homogeneous);
1849 evas_object_table_align_set(ep->object, TO_DOUBLE(chosen_desc->table.align.x), TO_DOUBLE(chosen_desc->table.align.y));
1850 evas_object_table_padding_set(ep->object, chosen_desc->table.padding.x, chosen_desc->table.padding.y);
1851 if (evas_object_smart_need_recalculate_get(ep->object))
1852 {
1853 evas_object_smart_need_recalculate_set(ep->object, 0);
1854 evas_object_smart_calculate(ep->object);
1855 }
1856}
1857
1858static int
1859_edje_image_find(Evas_Object *obj, Edje *ed, Edje_Real_Part_Set **eps, Edje_Part_Description_Image *st, Edje_Part_Image_Id *imid)
1860{
1861 Edje_Image_Directory_Set_Entry *entry;
1862 Edje_Image_Directory_Set *set = NULL;
1863 Eina_List *l;
1864 int w = 0;
1865 int h = 0;
1866 int id;
1867
1868 if (!st && !imid)
1869 return -1;
1870
1871 if (st && !st->image.set)
1872 return st->image.id;
1873
1874 if (imid && !imid->set)
1875 return imid->id;
1876
1877 if (imid)
1878 id = imid->id;
1879 else
1880 id = st->image.id;
1881
1882 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1883
1884 if (eps && *eps)
1885 {
1886 if ((*eps)->id == id)
1887 set = (*eps)->set;
1888
1889 if (set)
1890 if ((*eps)->entry->size.min.w <= w && w <= (*eps)->entry->size.max.w)
1891 if ((*eps)->entry->size.min.h <= h && h <= (*eps)->entry->size.max.h)
1892 return (*eps)->entry->id;
1893 }
1894
1895 if (!set)
1896 set = ed->file->image_dir->sets + id;
1897
1898 EINA_LIST_FOREACH(set->entries, l, entry)
1899 {
1900 if (entry->size.min.w <= w && w <= entry->size.max.w)
1901 if (entry->size.min.h <= h && h <= entry->size.max.h)
1902 {
1903 if (eps)
1904 {
1905 if (!*eps)
1906 *eps = calloc(1, sizeof (Edje_Real_Part_Set));
1907
1908 if (*eps)
1909 {
1910 (*eps)->entry = entry;
1911 (*eps)->set = set;
1912 (*eps)->id = id;
1913 }
1914 }
1915 return entry->id;
1916 }
1917 }
1918
1919 return -1;
1920}
1921
1922static void
1923_edje_proxy_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edje_Part_Description_Proxy *chosen_desc, FLOAT_T pos)
1924{
1925 Edje_Real_Part *pp;
1926 int part_id = -1;
1927
1928 if (pos >= 0.5)
1929 part_id = ((Edje_Part_Description_Proxy*) ep->param2->description)->proxy.id;
1930 else
1931 part_id = chosen_desc->proxy.id;
1932
1933 if ((p3->type.common.fill.w == 0) || (p3->type.common.fill.h == 0) ||
1934 (part_id < 0))
1935 {
1936 evas_object_image_source_set(ep->object, NULL);
1937 return;
1938 }
1939 pp = ed->table_parts[part_id % ed->table_parts_size];
1940
1941 switch (pp->part->type)
1942 {
1943 case EDJE_PART_TYPE_IMAGE:
1944 case EDJE_PART_TYPE_TEXT:
1945 case EDJE_PART_TYPE_TEXTBLOCK:
1946 case EDJE_PART_TYPE_RECTANGLE:
1947 case EDJE_PART_TYPE_BOX:
1948 case EDJE_PART_TYPE_TABLE:
1949 case EDJE_PART_TYPE_PROXY:
1950 evas_object_image_source_set(ep->object, pp->object);
1951 break;
1952 case EDJE_PART_TYPE_GRADIENT:
1953 /* FIXME: THIS ONE SHOULD NEVER BE TRIGGERED. */
1954 break;
1955 case EDJE_PART_TYPE_GROUP:
1956 case EDJE_PART_TYPE_SWALLOW:
1957 case EDJE_PART_TYPE_EXTERNAL:
1958 evas_object_image_source_set(ep->object, pp->swallowed_object);
1959 break;
1960 }
1961
1962 evas_object_image_fill_set(ep->object, p3->type.common.fill.x, p3->type.common.fill.y,
1963 p3->type.common.fill.w, p3->type.common.fill.h);
1964 evas_object_image_smooth_scale_set(ep->object, p3->smooth);
1965}
1966
1967static void
1968_edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edje_Part_Description_Image *chosen_desc, FLOAT_T pos)
1969{
1970 int image_id;
1971 int image_count, image_num;
1972 FLOAT_T sc;
1973
1974 sc = ed->scale;
1975 if (sc == 0.0) sc = _edje_scale;
1976 evas_object_image_fill_set(ep->object, p3->type.common.fill.x, p3->type.common.fill.y,
1977 p3->type.common.fill.w, p3->type.common.fill.h);
1978 evas_object_image_smooth_scale_set(ep->object, p3->smooth);
1979 if (chosen_desc->image.border.scale)
1980 {
1981 if (chosen_desc->image.border.scale_by > FROM_DOUBLE(0.0))
1982 {
1983 FLOAT_T sc2 = MUL(sc, chosen_desc->image.border.scale_by);
1984 evas_object_image_border_scale_set(ep->object, TO_DOUBLE(sc2));
1985 }
1986 else
1987 evas_object_image_border_scale_set(ep->object, TO_DOUBLE(sc));
1988 }
1989 else
1990 {
1991 if (chosen_desc->image.border.scale_by > FROM_DOUBLE(0.0))
1992 evas_object_image_border_scale_set
1993 (ep->object, TO_DOUBLE(chosen_desc->image.border.scale_by));
1994 else
1995 evas_object_image_border_scale_set(ep->object, 1.0);
1996 }
1997 evas_object_image_border_set(ep->object, p3->type.common.spec.image.l, p3->type.common.spec.image.r,
1998 p3->type.common.spec.image.t, p3->type.common.spec.image.b);
1999 if (chosen_desc->image.border.no_fill == 0)
2000 evas_object_image_border_center_fill_set(ep->object, EVAS_BORDER_FILL_DEFAULT);
2001 else if (chosen_desc->image.border.no_fill == 1)
2002 evas_object_image_border_center_fill_set(ep->object, EVAS_BORDER_FILL_NONE);
2003 else if (chosen_desc->image.border.no_fill == 2)
2004 evas_object_image_border_center_fill_set(ep->object, EVAS_BORDER_FILL_SOLID);
2005
2006 image_id = _edje_image_find(ep->object, ed,
2007 &ep->param1.set,
2008 (Edje_Part_Description_Image*) ep->param1.description,
2009 NULL);
2010 if (image_id < 0)
2011 {
2012 Edje_Image_Directory_Entry *ie;
2013
2014 if (!ed->file->image_dir) ie = NULL;
2015 else ie = ed->file->image_dir->entries + (-image_id) - 1;
2016 if ((ie) &&
2017 (ie->source_type == EDJE_IMAGE_SOURCE_TYPE_EXTERNAL) &&
2018 (ie->entry))
2019 {
2020 evas_object_image_file_set(ep->object, ie->entry, NULL);
2021 }
2022 }
2023 else
2024 {
2025 image_count = 2;
2026 if (ep->param2)
2027 image_count += ((Edje_Part_Description_Image*) ep->param2->description)->image.tweens_count;
2028 image_num = TO_INT(MUL(pos, SUB(FROM_INT(image_count),
2029 FROM_DOUBLE(0.5))));
2030 if (image_num > (image_count - 1))
2031 image_num = image_count - 1;
2032 if (image_num == 0)
2033 {
2034 image_id = _edje_image_find(ep->object, ed,
2035 &ep->param1.set,
2036 (Edje_Part_Description_Image*) ep->param1.description,
2037 NULL);
2038 }
2039 else
2040 if (ep->param2)
2041 {
2042 if (image_num == (image_count - 1))
2043 {
2044 image_id = _edje_image_find(ep->object, ed,
2045 &ep->param2->set,
2046 (Edje_Part_Description_Image*) ep->param2->description,
2047 NULL);
2048 }
2049 else
2050 {
2051 Edje_Part_Image_Id *imid;
2052
2053 imid = ((Edje_Part_Description_Image*) ep->param2->description)->image.tweens[image_num - 1];
2054 image_id = _edje_image_find(ep->object, ed, NULL, NULL, imid);
2055 }
2056 }
2057 if (image_id < 0)
2058 {
2059 ERR("¨Part \"%s\" has description, "
2060 "\"%s\" %3.3f with a missing image id!!!",
2061 ep->part->name,
2062 ep->param1.description->state.name,
2063 ep->param1.description->state.value);
2064 }
2065 else
2066 {
2067 char buf[1024];
2068
2069 /* Replace snprint("edje/images/%i") == memcpy + itoa */
2070#define IMAGES "edje/images/"
2071 memcpy(buf, IMAGES, strlen(IMAGES));
2072 eina_convert_itoa(image_id, buf + strlen(IMAGES)); /* No need to check length as 2³² need only 10 characteres. */
2073
2074 evas_object_image_file_set(ep->object, ed->file->path, buf);
2075 if (evas_object_image_load_error_get(ep->object) != EVAS_LOAD_ERROR_NONE)
2076 {
2077 ERR("Error loading image collection \"%s\" from "
2078 "file \"%s\". Missing EET Evas loader module?",
2079 buf, ed->file->path);
2080 switch (evas_object_image_load_error_get(ep->object))
2081 {
2082 case EVAS_LOAD_ERROR_GENERIC:
2083 ERR("Error type: EVAS_LOAD_ERROR_GENERIC");
2084 break;
2085 case EVAS_LOAD_ERROR_DOES_NOT_EXIST:
2086 ERR("Error type: EVAS_LOAD_ERROR_DOES_NOT_EXIST");
2087 break;
2088 case EVAS_LOAD_ERROR_PERMISSION_DENIED:
2089 ERR("Error type: EVAS_LOAD_ERROR_PERMISSION_DENIED");
2090 break;
2091 case EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED:
2092 ERR("Error type: EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED");
2093 break;
2094 case EVAS_LOAD_ERROR_CORRUPT_FILE:
2095 ERR("Error type: EVAS_LOAD_ERROR_CORRUPT_FILE");
2096 break;
2097 case EVAS_LOAD_ERROR_UNKNOWN_FORMAT:
2098 ERR("Error type: EVAS_LOAD_ERROR_UNKNOWN_FORMAT");
2099 break;
2100 default:
2101 ERR("Error type: ???");
2102 break;
2103 }
2104 }
2105 }
2106 }
2107}
2108
2109static Edje_Real_Part *
2110_edje_real_part_state_get(Edje *ed, Edje_Real_Part *ep, int flags, int id, int *state)
2111{
2112 Edje_Real_Part *result = NULL;
2113
2114 if (id >= 0 && id != ep->part->id)
2115 {
2116 result = ed->table_parts[id % ed->table_parts_size];
2117 if (result)
2118 {
2119 if (!result->calculated) _edje_part_recalc(ed, result, flags, NULL);
2120#ifdef EDJE_CALC_CACHE
2121 if (state) *state = result->state;
2122#else
2123 (void) state;
2124#endif
2125 }
2126 }
2127 return result;
2128}
2129
2130void
2131_edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *state)
2132{
2133#ifdef EDJE_CALC_CACHE
2134 Eina_Bool proxy_invalidate = EINA_FALSE;
2135 int state1 = -1;
2136 int state2 = -1;
2137 int statec = -1;
2138#else
2139 Edje_Calc_Params lp1, lp2;
2140#endif
2141 int statec1 = -1;
2142 int statec2 = -1;
2143 int statel1 = -1;
2144 int statel2 = -1;
2145 int statep1 = -1;
2146 int statep2 = -1;
2147 Edje_Real_Part *center[2] = { NULL, NULL };
2148 Edje_Real_Part *light[2] = { NULL, NULL };
2149 Edje_Real_Part *persp[2] = { NULL, NULL };
2150 Edje_Calc_Params *p1, *pf;
2151 Edje_Part_Description_Common *chosen_desc;
2152 Edje_Real_Part *confine_to = NULL;
2153 FLOAT_T pos = ZERO, pos2;
2154 Edje_Calc_Params lp3;
2155
2156 /* GRADIENT ARE GONE, WE MUST IGNORE IT FROM OLD FILE. */
2157 if (ep->part->type == EDJE_PART_TYPE_GRADIENT)
2158 {
2159 ERR("GRADIENT spotted during recalc ! That should never happen ! Send your edje file to devel ml.");
2160 return;
2161 }
2162
2163 if ((ep->calculated & FLAG_XY) == FLAG_XY && !state)
2164 {
2165 return;
2166 }
2167 if (ep->calculating & flags)
2168 {
2169#if 1
2170 const char *axes = "NONE", *faxes = "NONE";
2171
2172 if ((ep->calculating & FLAG_X) &&
2173 (ep->calculating & FLAG_Y))
2174 axes = "XY";
2175 else if ((ep->calculating & FLAG_X))
2176 axes = "X";
2177 else if ((ep->calculating & FLAG_Y))
2178 axes = "Y";
2179
2180 if ((flags & FLAG_X) &&
2181 (flags & FLAG_Y))
2182 faxes = "XY";
2183 else if ((flags & FLAG_X))
2184 faxes = "X";
2185 else if ((flags & FLAG_Y))
2186 faxes = "Y";
2187 ERR("Circular dependency when calculating part \"%s\". "
2188 "Already calculating %s [%02x] axes. "
2189 "Need to calculate %s [%02x] axes",
2190 ep->part->name,
2191 axes, ep->calculating,
2192 faxes, flags);
2193#endif
2194 return;
2195 }
2196#ifdef EDJE_CALC_CACHE
2197 if (ep->state == ed->state && !state)
2198 return ;
2199#endif
2200
2201 if (flags & FLAG_X)
2202 {
2203 ep->calculating |= flags & FLAG_X;
2204 if (ep->param1.rel1_to_x)
2205 {
2206 _edje_part_recalc(ed, ep->param1.rel1_to_x, FLAG_X, NULL);
2207#ifdef EDJE_CALC_CACHE
2208 state1 = ep->param1.rel1_to_x->state;
2209#endif
2210 }
2211 if (ep->param1.rel2_to_x)
2212 {
2213 _edje_part_recalc(ed, ep->param1.rel2_to_x, FLAG_X, NULL);
2214#ifdef EDJE_CALC_CACHE
2215 if (state1 < ep->param1.rel2_to_x->state)
2216 state1 = ep->param1.rel2_to_x->state;
2217#endif
2218 }
2219 if (ep->param2)
2220 {
2221 if (ep->param2->rel1_to_x)
2222 {
2223 _edje_part_recalc(ed, ep->param2->rel1_to_x, FLAG_X, NULL);
2224#ifdef EDJE_CALC_CACHE
2225 state2 = ep->param2->rel1_to_x->state;
2226#endif
2227 }
2228 if (ep->param2->rel2_to_x)
2229 {
2230 _edje_part_recalc(ed, ep->param2->rel2_to_x, FLAG_X, NULL);
2231#ifdef EDJE_CALC_CACHE
2232 if (state2 < ep->param2->rel2_to_x->state)
2233 state2 = ep->param2->rel2_to_x->state;
2234#endif
2235 }
2236 }
2237 }
2238 if (flags & FLAG_Y)
2239 {
2240 ep->calculating |= flags & FLAG_Y;
2241 if (ep->param1.rel1_to_y)
2242 {
2243 _edje_part_recalc(ed, ep->param1.rel1_to_y, FLAG_Y, NULL);
2244#ifdef EDJE_CALC_CACHE
2245 if (state1 < ep->param1.rel1_to_y->state)
2246 state1 = ep->param1.rel1_to_y->state;
2247#endif
2248 }
2249 if (ep->param1.rel2_to_y)
2250 {
2251 _edje_part_recalc(ed, ep->param1.rel2_to_y, FLAG_Y, NULL);
2252#ifdef EDJE_CALC_CACHE
2253 if (state1 < ep->param1.rel2_to_y->state)
2254 state1 = ep->param1.rel2_to_y->state;
2255#endif
2256 }
2257 if (ep->param2)
2258 {
2259 if (ep->param2->rel1_to_y)
2260 {
2261 _edje_part_recalc(ed, ep->param2->rel1_to_y, FLAG_Y, NULL);
2262#ifdef EDJE_CALC_CACHE
2263 if (state2 < ep->param2->rel1_to_y->state)
2264 state2 = ep->param2->rel1_to_y->state;
2265#endif
2266 }
2267 if (ep->param2->rel2_to_y)
2268 {
2269 _edje_part_recalc(ed, ep->param2->rel2_to_y, FLAG_Y, NULL);
2270#ifdef EDJE_CALC_CACHE
2271 if (state2 < ep->param2->rel2_to_y->state)
2272 state2 = ep->param2->rel2_to_y->state;
2273#endif
2274 }
2275 }
2276 }
2277 if (ep->drag && ep->drag->confine_to)
2278 {
2279 confine_to = ep->drag->confine_to;
2280 _edje_part_recalc(ed, confine_to, flags, NULL);
2281#ifdef EDJE_CALC_CACHE
2282 statec = confine_to->state;
2283#endif
2284 }
2285// if (ep->text.source) _edje_part_recalc(ed, ep->text.source, flags);
2286// if (ep->text.text_source) _edje_part_recalc(ed, ep->text.text_source, flags);
2287
2288 /* actually calculate now */
2289 chosen_desc = ep->chosen_description;
2290 if (!chosen_desc)
2291 {
2292 ep->calculating = FLAG_NONE;
2293 ep->calculated |= flags;
2294 return;
2295 }
2296
2297 if (ep->part->type == EDJE_PART_TYPE_PROXY)
2298 {
2299 Edje_Real_Part *pp;
2300 int part_id = -1;
2301
2302 if (pos >= 0.5)
2303 part_id = ((Edje_Part_Description_Proxy*) ep->param2->description)->proxy.id;
2304 else
2305 part_id = ((Edje_Part_Description_Proxy*) chosen_desc)->proxy.id;
2306
2307 pp = _edje_real_part_state_get(ed, ep, flags, part_id, NULL);
2308 if (pp && pp->invalidate) proxy_invalidate = EINA_TRUE;
2309 }
2310
2311 /* Recalc if needed the map center && light source */
2312 if (ep->param1.description->map.on)
2313 {
2314 center[0] = _edje_real_part_state_get(ed, ep, flags, ep->param1.description->map.rot.id_center, &statec1);
2315 light[0] = _edje_real_part_state_get(ed, ep, flags, ep->param1.description->map.id_light, &statel1);
2316
2317 if (chosen_desc->map.persp_on)
2318 {
2319 persp[0] = _edje_real_part_state_get(ed, ep, flags, ep->param1.description->map.id_persp, &statep1);
2320 }
2321 }
2322
2323 if (ep->param2 && ep->param2->description->map.on)
2324 {
2325 center[1] = _edje_real_part_state_get(ed, ep, flags, ep->param2->description->map.rot.id_center, &statec2);
2326 light[1] = _edje_real_part_state_get(ed, ep, flags, ep->param2->description->map.id_light, &statel2);
2327
2328 if (chosen_desc->map.persp_on)
2329 {
2330 persp[1] = _edje_real_part_state_get(ed, ep, flags, ep->param2->description->map.id_persp, &statep2);
2331 }
2332 }
2333
2334#ifndef EDJE_CALC_CACHE
2335 p1 = &lp1;
2336#else
2337 p1 = &ep->param1.p;
2338#endif
2339
2340 if (ep->param1.description)
2341 {
2342#ifdef EDJE_CALC_CACHE
2343 if (ed->all_part_change ||
2344 ep->invalidate ||
2345 state1 >= ep->param1.state ||
2346 statec >= ep->param1.state ||
2347 statec1 >= ep->param1.state ||
2348 statel1 >= ep->param1.state ||
2349 statep1 >= ep->param1.state ||
2350 proxy_invalidate ||
2351 state ||
2352 ((ep->part->type == EDJE_PART_TYPE_TEXT || ep->part->type == EDJE_PART_TYPE_TEXTBLOCK) && ed->text_part_change))
2353#endif
2354 {
2355 _edje_part_recalc_single(ed, ep, ep->param1.description, chosen_desc, center[0], light[0], persp[0],
2356 ep->param1.rel1_to_x, ep->param1.rel1_to_y, ep->param1.rel2_to_x, ep->param1.rel2_to_y,
2357 confine_to,
2358 p1);
2359
2360#ifdef EDJE_CALC_CACHE
2361 ep->param1.state = ed->state;
2362#endif
2363 }
2364 }
2365 if (ep->param2)
2366 {
2367 int beginning_pos, part_type;
2368 Edje_Calc_Params *p2, *p3;
2369
2370 if (ep->current)
2371 {
2372 /* FIXME: except for text, we don't need in that case to recalc p1 at all*/
2373 memcpy(p1, ep->current, sizeof (Edje_Calc_Params));
2374 p1->x += ed->x;
2375 p1->y += ed->y;
2376 p1->map.center.x += ed->x;
2377 p1->map.center.y += ed->y;
2378 p1->map.light.x += ed->x;
2379 p1->map.light.y += ed->y;
2380 p1->map.persp.x += ed->x;
2381 p1->map.persp.y += ed->y;
2382 }
2383
2384 p3 = &lp3;
2385
2386#ifndef EDJE_CALC_CACHE
2387 p2 = &lp2;
2388#else
2389 p2 = &ep->param2->p;
2390
2391 if (ed->all_part_change ||
2392 ep->invalidate ||
2393 state2 >= ep->param2->state ||
2394 statec >= ep->param2->state ||
2395 statec2 >= ep->param2->state ||
2396 statel2 >= ep->param2->state ||
2397 statep2 >= ep->param2->state ||
2398 proxy_invalidate ||
2399 state ||
2400 ((ep->part->type == EDJE_PART_TYPE_TEXT || ep->part->type == EDJE_PART_TYPE_TEXTBLOCK) && ed->text_part_change))
2401#endif
2402 {
2403 _edje_part_recalc_single(ed, ep, ep->param2->description, chosen_desc, center[1], light[1], persp[1],
2404 ep->param2->rel1_to_x, ep->param2->rel1_to_y, ep->param2->rel2_to_x, ep->param2->rel2_to_y,
2405 confine_to,
2406 p2);
2407#ifdef EDJE_CALC_CACHE
2408 ep->param2->state = ed->state;
2409#endif
2410 }
2411
2412 pos = ep->description_pos;
2413 pos2 = pos;
2414 if (pos2 < ZERO) pos2 = ZERO;
2415 else if (pos2 > FROM_INT(1)) pos2 = FROM_INT(1);
2416 beginning_pos = (pos < FROM_DOUBLE(0.5));
2417 part_type = ep->part->type;
2418
2419 /* visible is special */
2420 if ((p1->visible) && (!p2->visible))
2421 p3->visible = (pos != FROM_INT(1));
2422 else if ((!p1->visible) && (p2->visible))
2423 p3->visible = (pos != ZERO);
2424 else
2425 p3->visible = p1->visible;
2426
2427 p3->smooth = (beginning_pos) ? p1->smooth : p2->smooth;
2428
2429 /* FIXME: do x and y separately base on flag */
2430#define FINTP(_x1, _x2, _p) \
2431 (((_x1) == (_x2)) \
2432 ? FROM_INT((_x1)) \
2433 : ADD(FROM_INT(_x1), \
2434 SCALE((_p), (_x2) - (_x1))))
2435
2436#define FFP(_x1, _x2, _p) \
2437 (((_x1) == (_x2)) \
2438 ? (_x1) \
2439 : ADD(_x1, MUL(_p, SUB(_x2, _x1))));
2440
2441#define INTP(_x1, _x2, _p) TO_INT(FINTP(_x1, _x2, _p))
2442
2443 p3->x = INTP(p1->x, p2->x, pos);
2444 p3->y = INTP(p1->y, p2->y, pos);
2445 p3->w = INTP(p1->w, p2->w, pos);
2446 p3->h = INTP(p1->h, p2->h, pos);
2447
2448 p3->req.x = INTP(p1->req.x, p2->req.x, pos);
2449 p3->req.y = INTP(p1->req.y, p2->req.y, pos);
2450 p3->req.w = INTP(p1->req.w, p2->req.w, pos);
2451 p3->req.h = INTP(p1->req.h, p2->req.h, pos);
2452
2453 if (ep->part->dragable.x)
2454 {
2455 p3->req_drag.x = INTP(p1->req_drag.x, p2->req_drag.x, pos);
2456 p3->req_drag.w = INTP(p1->req_drag.w, p2->req_drag.w, pos);
2457 }
2458 if (ep->part->dragable.y)
2459 {
2460 p3->req_drag.y = INTP(p1->req_drag.y, p2->req_drag.y, pos);
2461 p3->req_drag.h = INTP(p1->req_drag.h, p2->req_drag.h, pos);
2462 }
2463
2464 p3->color.r = INTP(p1->color.r, p2->color.r, pos2);
2465 p3->color.g = INTP(p1->color.g, p2->color.g, pos2);
2466 p3->color.b = INTP(p1->color.b, p2->color.b, pos2);
2467 p3->color.a = INTP(p1->color.a, p2->color.a, pos2);
2468
2469 switch (part_type)
2470 {
2471 case EDJE_PART_TYPE_IMAGE:
2472 p3->type.common.spec.image.l = INTP(p1->type.common.spec.image.l, p2->type.common.spec.image.l, pos);
2473 p3->type.common.spec.image.r = INTP(p1->type.common.spec.image.r, p2->type.common.spec.image.r, pos);
2474 p3->type.common.spec.image.t = INTP(p1->type.common.spec.image.t, p2->type.common.spec.image.t, pos);
2475 p3->type.common.spec.image.b = INTP(p1->type.common.spec.image.b, p2->type.common.spec.image.b, pos);
2476 case EDJE_PART_TYPE_PROXY:
2477 p3->type.common.fill.x = INTP(p1->type.common.fill.x, p2->type.common.fill.x, pos);
2478 p3->type.common.fill.y = INTP(p1->type.common.fill.y, p2->type.common.fill.y, pos);
2479 p3->type.common.fill.w = INTP(p1->type.common.fill.w, p2->type.common.fill.w, pos);
2480 p3->type.common.fill.h = INTP(p1->type.common.fill.h, p2->type.common.fill.h, pos);
2481 break;
2482 case EDJE_PART_TYPE_TEXT:
2483 p3->type.text.size = INTP(p1->type.text.size, p2->type.text.size, pos);
2484 case EDJE_PART_TYPE_TEXTBLOCK:
2485 p3->type.text.color2.r = INTP(p1->type.text.color2.r, p2->type.text.color2.r, pos2);
2486 p3->type.text.color2.g = INTP(p1->type.text.color2.g, p2->type.text.color2.g, pos2);
2487 p3->type.text.color2.b = INTP(p1->type.text.color2.b, p2->type.text.color2.b, pos2);
2488 p3->type.text.color2.a = INTP(p1->type.text.color2.a, p2->type.text.color2.a, pos2);
2489
2490 p3->type.text.color3.r = INTP(p1->type.text.color3.r, p2->type.text.color3.r, pos2);
2491 p3->type.text.color3.g = INTP(p1->type.text.color3.g, p2->type.text.color3.g, pos2);
2492 p3->type.text.color3.b = INTP(p1->type.text.color3.b, p2->type.text.color3.b, pos2);
2493 p3->type.text.color3.a = INTP(p1->type.text.color3.a, p2->type.text.color3.a, pos2);
2494
2495 p3->type.text.align.x = FFP(p1->type.text.align.x, p2->type.text.align.x, pos);
2496 p3->type.text.align.y = FFP(p1->type.text.align.y, p2->type.text.align.y, pos);
2497 p3->type.text.elipsis = TO_DOUBLE(FINTP(p1->type.text.elipsis, p2->type.text.elipsis, pos2));
2498 break;
2499 }
2500
2501 p3->mapped = p1->mapped;
2502 p3->persp_on = p3->mapped ? p1->persp_on | p2->persp_on : 0;
2503 p3->lighted = p3->mapped ? p1->lighted | p2->lighted : 0;
2504 if (p1->mapped)
2505 {
2506 p3->map.center.x = INTP(p1->map.center.x, p2->map.center.x, pos);
2507 p3->map.center.y = INTP(p1->map.center.y, p2->map.center.y, pos);
2508 p3->map.center.z = INTP(p1->map.center.z, p2->map.center.z, pos);
2509 p3->map.rotation.x = FFP(p1->map.rotation.x, p2->map.rotation.x, pos);
2510 p3->map.rotation.y = FFP(p1->map.rotation.y, p2->map.rotation.y, pos);
2511 p3->map.rotation.z = FFP(p1->map.rotation.z, p2->map.rotation.z, pos);
2512
2513#define MIX(P1, P2, P3, pos, info) \
2514 P3->info = P1->info + TO_INT(SCALE(pos, P2->info - P1->info));
2515
2516 if (p1->lighted && p2->lighted)
2517 {
2518 MIX(p1, p2, p3, pos, map.light.x);
2519 MIX(p1, p2, p3, pos, map.light.y);
2520 MIX(p1, p2, p3, pos, map.light.z);
2521 MIX(p1, p2, p3, pos, map.light.r);
2522 MIX(p1, p2, p3, pos, map.light.g);
2523 MIX(p1, p2, p3, pos, map.light.b);
2524 MIX(p1, p2, p3, pos, map.light.ar);
2525 MIX(p1, p2, p3, pos, map.light.ag);
2526 MIX(p1, p2, p3, pos, map.light.ab);
2527 }
2528 else if (p1->lighted)
2529 {
2530 memcpy(&p3->map.light, &p1->map.light, sizeof (p1->map.light));
2531 }
2532 else if (p2->lighted)
2533 {
2534 memcpy(&p3->map.light, &p2->map.light, sizeof (p2->map.light));
2535 }
2536
2537 if (p1->persp_on && p2->persp_on)
2538 {
2539 MIX(p1, p2, p3, pos, map.persp.x);
2540 MIX(p1, p2, p3, pos, map.persp.y);
2541 MIX(p1, p2, p3, pos, map.persp.z);
2542 MIX(p1, p2, p3, pos, map.persp.focal);
2543 }
2544 else if (p1->persp_on)
2545 {
2546 memcpy(&p3->map.persp, &p1->map.persp, sizeof (p1->map.light));
2547 }
2548 else if (p2->persp_on)
2549 {
2550 memcpy(&p3->map.persp, &p2->map.persp, sizeof (p2->map.light));
2551 }
2552 }
2553
2554 pf = p3;
2555 }
2556 else
2557 {
2558 pf = p1;
2559 }
2560
2561 if (!pf->persp_on && chosen_desc->map.persp_on)
2562 {
2563 if (ed->persp)
2564 {
2565 pf->map.persp.x = ed->persp->px;
2566 pf->map.persp.y = ed->persp->py;
2567 pf->map.persp.z = ed->persp->z0;
2568 pf->map.persp.focal = ed->persp->foc;
2569 }
2570 else
2571 {
2572 const Edje_Perspective *ps;
2573
2574 // fixme: a tad inefficient as this is a has lookup
2575 ps = edje_object_perspective_get(ed->obj);
2576 if (!ps)
2577 ps = edje_evas_global_perspective_get(evas_object_evas_get(ed->obj));
2578 if (ps)
2579 {
2580 pf->map.persp.x = ps->px;
2581 pf->map.persp.y = ps->py;
2582 pf->map.persp.z = ps->z0;
2583 pf->map.persp.focal = ps->foc;
2584 }
2585 else
2586 {
2587 pf->map.persp.x = ed->x + (ed->w / 2);
2588 pf->map.persp.y = ed->y + (ed->h / 2);
2589 pf->map.persp.z = 0;
2590 pf->map.persp.focal = 1000;
2591 }
2592 }
2593 }
2594
2595 if (state)
2596 {
2597 memcpy(state, pf, sizeof (Edje_Calc_Params));
2598 }
2599
2600 ep->req = pf->req;
2601
2602 if (ep->drag && ep->drag->need_reset)
2603 {
2604 FLOAT_T dx, dy;
2605
2606 dx = ZERO;
2607 dy = ZERO;
2608 _edje_part_dragable_calc(ed, ep, &dx, &dy);
2609 ep->drag->x = dx;
2610 ep->drag->y = dy;
2611 ep->drag->tmp.x = 0;
2612 ep->drag->tmp.y = 0;
2613 ep->drag->need_reset = 0;
2614 }
2615 if (!ed->calc_only)
2616 {
2617 Evas_Object *mo;
2618
2619 /* Common move, resize and color_set for all part. */
2620 switch (ep->part->type)
2621 {
2622 case EDJE_PART_TYPE_IMAGE:
2623 {
2624 Edje_Part_Description_Image *img_desc = (Edje_Part_Description_Image*) chosen_desc;
2625
2626 evas_object_image_scale_hint_set(ep->object,
2627 img_desc->image.scale_hint);
2628 }
2629 case EDJE_PART_TYPE_PROXY:
2630 case EDJE_PART_TYPE_RECTANGLE:
2631 case EDJE_PART_TYPE_TEXTBLOCK:
2632 case EDJE_PART_TYPE_BOX:
2633 case EDJE_PART_TYPE_TABLE:
2634 evas_object_color_set(ep->object,
2635 (pf->color.r * pf->color.a) / 255,
2636 (pf->color.g * pf->color.a) / 255,
2637 (pf->color.b * pf->color.a) / 255,
2638 pf->color.a);
2639 if (!pf->visible)
2640 {
2641 evas_object_hide(ep->object);
2642 break;
2643 }
2644 evas_object_show(ep->object);
2645 /* move and resize are needed for all previous object => no break here. */
2646 case EDJE_PART_TYPE_SWALLOW:
2647 case EDJE_PART_TYPE_GROUP:
2648 case EDJE_PART_TYPE_EXTERNAL:
2649 /* visibility and color have no meaning on SWALLOW and GROUP part. */
2650 evas_object_move(ep->object, ed->x + pf->x, ed->y + pf->y);
2651 evas_object_resize(ep->object, pf->w, pf->h);
2652 if (ep->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
2653 _edje_entry_real_part_configure(ep);
2654 break;
2655 case EDJE_PART_TYPE_TEXT:
2656 /* This is correctly handle in _edje_text_recalc_apply at the moment. */
2657 break;
2658 case EDJE_PART_TYPE_GRADIENT:
2659 /* FIXME: definitivly remove this code when we switch to new format. */
2660 abort();
2661 break;
2662 }
2663
2664 /* Some object need special recalc. */
2665 switch (ep->part->type)
2666 {
2667 case EDJE_PART_TYPE_TEXT:
2668 _edje_text_recalc_apply(ed, ep, pf, (Edje_Part_Description_Text*) chosen_desc);
2669 break;
2670 case EDJE_PART_TYPE_PROXY:
2671 _edje_proxy_recalc_apply(ed, ep, pf, (Edje_Part_Description_Proxy*) chosen_desc, pos);
2672 break;
2673 case EDJE_PART_TYPE_IMAGE:
2674 _edje_image_recalc_apply(ed, ep, pf, (Edje_Part_Description_Image*) chosen_desc, pos);
2675 break;
2676 case EDJE_PART_TYPE_BOX:
2677 _edje_box_recalc_apply(ed, ep, pf, (Edje_Part_Description_Box*) chosen_desc);
2678 break;
2679 case EDJE_PART_TYPE_TABLE:
2680 _edje_table_recalc_apply(ed, ep, pf, (Edje_Part_Description_Table*) chosen_desc);
2681 break;
2682 case EDJE_PART_TYPE_EXTERNAL:
2683 case EDJE_PART_TYPE_RECTANGLE:
2684 case EDJE_PART_TYPE_SWALLOW:
2685 case EDJE_PART_TYPE_GROUP:
2686 case EDJE_PART_TYPE_TEXTBLOCK:
2687 /* Nothing special to do for this type of object. */
2688 break;
2689 case EDJE_PART_TYPE_GRADIENT:
2690 /* FIXME: definitivly remove this code when we switch to new format. */
2691 abort();
2692 break;
2693 }
2694
2695 if (ep->swallowed_object)
2696 {
2697//// the below really is wrong - swallow color shouldn't affect swallowed object
2698//// color - the edje color as a WHOLE should though - and that should be
2699//// done via the clipper anyway. this created bugs when objects had their
2700//// colro set and were swallowed - then had their color changed.
2701// evas_object_color_set(ep->swallowed_object,
2702// (pf->color.r * pf->color.a) / 255,
2703// (pf->color.g * pf->color.a) / 255,
2704// (pf->color.b * pf->color.a) / 255,
2705// pf->color.a);
2706 if (pf->visible)
2707 {
2708 evas_object_move(ep->swallowed_object, ed->x + pf->x, ed->y + pf->y);
2709 evas_object_resize(ep->swallowed_object, pf->w, pf->h);
2710 evas_object_show(ep->swallowed_object);
2711 }
2712 else evas_object_hide(ep->swallowed_object);
2713 mo = ep->swallowed_object;
2714 }
2715 else mo = ep->object;
2716 if (chosen_desc->map.on)
2717 {
2718 Evas_Map *map;
2719
2720 ed->have_mapped_part = 1;
2721 // create map and populate with part geometry
2722 map = evas_map_new(4);
2723 evas_map_util_points_populate_from_object(map, ep->object);
2724 if (ep->part->type == EDJE_PART_TYPE_IMAGE)
2725 {
2726 int iw = 1, ih = 1;
2727
2728 evas_object_image_size_get(mo, &iw, &ih);
2729 evas_map_point_image_uv_set(map, 0, 0.0, 0.0);
2730 evas_map_point_image_uv_set(map, 1, iw , 0.0);
2731 evas_map_point_image_uv_set(map, 2, iw , ih );
2732 evas_map_point_image_uv_set(map, 3, 0.0, ih );
2733 }
2734
2735 evas_map_util_3d_rotate(map,
2736 pf->map.rotation.x, pf->map.rotation.y, pf->map.rotation.z,
2737 pf->map.center.x, pf->map.center.y, pf->map.center.z);
2738
2739 // calculate light color & position etc. if there is one
2740 if (pf->lighted)
2741 {
2742 evas_map_util_3d_lighting(map,
2743 pf->map.light.x, pf->map.light.y, pf->map.light.z,
2744 pf->map.light.r, pf->map.light.g, pf->map.light.b,
2745 pf->map.light.ar, pf->map.light.ag, pf->map.light.ab);
2746 }
2747
2748 // calculate perspective point
2749 if (chosen_desc->map.persp_on)
2750 {
2751 evas_map_util_3d_perspective(map,
2752 pf->map.persp.x, pf->map.persp.y, pf->map.persp.z,
2753 pf->map.persp.focal);
2754 }
2755
2756 // handle backface culling (object is facing away from view
2757 if (chosen_desc->map.backcull)
2758 {
2759 if (pf->visible)
2760 {
2761 if (evas_map_util_clockwise_get(map))
2762 evas_object_show(mo);
2763 else evas_object_hide(mo);
2764 }
2765 }
2766
2767 // handle smooth
2768 if (chosen_desc->map.smooth) evas_map_smooth_set(map, 1);
2769 else evas_map_smooth_set(map, 0);
2770 // handle alpha
2771 if (chosen_desc->map.alpha) evas_map_alpha_set(map, 1);
2772 else evas_map_alpha_set(map, 0);
2773
2774 evas_object_map_set(mo, map);
2775 evas_object_map_enable_set(mo, 1);
2776 evas_map_free(map);
2777 }
2778 else
2779 {
2780 evas_object_map_enable_set(mo, 0);
2781 evas_object_map_set(mo, NULL);
2782 }
2783 }
2784
2785 ep->x = pf->x;
2786 ep->y = pf->y;
2787 ep->w = pf->w;
2788 ep->h = pf->h;
2789
2790 ep->calculated |= flags;
2791 ep->calculating = FLAG_NONE;
2792
2793#ifdef EDJE_CALC_CACHE
2794 if (ep->calculated == FLAG_XY)
2795 {
2796 ep->state = ed->state;
2797 ep->invalidate = 0;
2798 }
2799#endif
2800
2801}
diff --git a/libraries/edje/src/lib/edje_callbacks.c b/libraries/edje/src/lib/edje_callbacks.c
new file mode 100644
index 0000000..e0b0eae
--- /dev/null
+++ b/libraries/edje/src/lib/edje_callbacks.c
@@ -0,0 +1,546 @@
1#include "edje_private.h"
2
3static void
4_edje_hold_signal_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
5{
6 Evas_Event_Hold *ev;
7 Edje *ed;
8 Edje_Real_Part *rp;
9
10 ev = event_info;
11 ed = data;
12 rp = evas_object_data_get(obj, "real_part");
13 if (!rp) return;
14 if (ev->hold)
15 _edje_emit(ed, "hold,on", rp->part->name);
16 else
17 _edje_emit(ed, "hold,off", rp->part->name);
18}
19
20static void
21_edje_focus_in_signal_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
22{
23 Edje *ed;
24 Edje_Real_Part *rp;
25
26 ed = data;
27 rp = evas_object_data_get(obj, "real_part");
28 if ((!rp) || (!ed))
29 return;
30
31 _edje_emit(ed, "focus,part,in", rp->part->name);
32}
33
34static void
35_edje_focus_out_signal_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
36{
37 Edje *ed;
38 Edje_Real_Part *rp;
39
40 ed = data;
41 rp = evas_object_data_get(obj, "real_part");
42 if ((!rp) || (!ed))
43 return;
44
45 _edje_emit(ed, "focus,part,out", rp->part->name);
46}
47
48static void
49_edje_mouse_in_signal_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
50{
51 Evas_Event_Mouse_In *ev;
52 Edje *ed;
53 Edje_Real_Part *rp;
54
55 ev = event_info;
56 ed = data;
57 rp = evas_object_data_get(obj, "real_part");
58 if ((!rp) ||
59 ((ev->event_flags) &&
60 (rp->part->ignore_flags & ev->event_flags))) return;
61 _edje_emit(ed, "mouse,in", rp->part->name);
62}
63
64static void
65_edje_mouse_out_signal_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
66{
67 Evas_Event_Mouse_Out *ev;
68 Edje *ed;
69 Edje_Real_Part *rp;
70
71 ev = event_info;
72 ed = data;
73 rp = evas_object_data_get(obj, "real_part");
74 if ((!rp) ||
75 ((ev->event_flags) &&
76 (rp->part->ignore_flags & ev->event_flags))) return;
77 _edje_emit(ed, "mouse,out", rp->part->name);
78}
79
80static void
81_edje_mouse_down_signal_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
82{
83 Evas_Event_Mouse_Down *ev;
84 Edje *ed;
85 Edje_Real_Part *rp;
86 char buf[256];
87 int ignored;
88
89 ev = event_info;
90 ed = data;
91 rp = evas_object_data_get(obj, "real_part");
92 if (!rp) return;
93
94 ignored = rp->part->ignore_flags & ev->event_flags;
95
96 _edje_ref(ed);
97 _edje_freeze(ed);
98
99 if ((!ev->event_flags) || (!ignored))
100 {
101 if (ev->flags & EVAS_BUTTON_TRIPLE_CLICK)
102 snprintf(buf, sizeof(buf), "mouse,down,%i,triple", ev->button);
103 else if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
104 snprintf(buf, sizeof(buf), "mouse,down,%i,double", ev->button);
105 else
106 snprintf(buf, sizeof(buf), "mouse,down,%i", ev->button);
107 _edje_emit(ed, buf, rp->part->name);
108 }
109
110 if (rp->events_to)
111 {
112 int x = 0, y = 0;
113 Edje_Real_Part *events;
114
115 events = rp->events_to;
116 evas_object_geometry_get(rp->object, &x, &y, NULL, NULL);
117
118 if ((events->part->dragable.x) || (events->part->dragable.y))
119 {
120 if (events->part->dragable.x)
121 {
122 events->drag->down.x = ev->canvas.x;
123 events->drag->tmp.x = 0;
124 }
125 if (events->part->dragable.y)
126 {
127 events->drag->down.y = ev->canvas.y;
128 events->drag->tmp.y = 0;
129 }
130
131 if (!ignored)
132 {
133 snprintf(buf, sizeof(buf), "mouse,down,%i", ev->button);
134 _edje_emit(ed, buf, events->part->name);
135 }
136 ed->dirty = 1;
137#ifdef EDJE_CALC_CACHE
138 rp->invalidate = 1;
139#endif
140 }
141 _edje_recalc_do(ed);
142 /*
143 _edje_thaw(ed);
144 _edje_unref(ed);
145 _edje_ref(ed);
146 _edje_freeze(ed);
147 */
148 rp = events;
149 {
150 FLOAT_T dx = ZERO, dy = ZERO;
151
152 _edje_part_dragable_calc(ed, rp, &dx, &dy);
153
154 if ((dx != rp->drag->val.x) || (dy != rp->drag->val.y))
155 {
156 rp->drag->val.x = dx;
157 rp->drag->val.y = dy;
158 if (!ignored)
159 _edje_emit(ed, "drag", rp->part->name);
160 ed->dirty = 1;
161#ifdef EDJE_CALC_CACHE
162 rp->invalidate = 1;
163#endif
164 rp->drag->need_reset = 1;
165 _edje_recalc_do(ed);
166 }
167 }
168 }
169
170 if (rp->drag)
171 {
172 if (rp->drag->down.count == 0)
173 {
174 if (rp->part->dragable.x)
175 rp->drag->down.x = ev->canvas.x;
176 if (rp->part->dragable.y)
177 rp->drag->down.y = ev->canvas.y;
178 if (!ignored)
179 _edje_emit(ed, "drag,start", rp->part->name);
180 }
181 rp->drag->down.count++;
182 }
183
184 if (rp->clicked_button == 0)
185 {
186 rp->clicked_button = ev->button;
187 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
188 rp->still_in = 1;
189 }
190// _edje_recalc_do(ed);
191 _edje_thaw(ed);
192 _edje_unref(ed);
193}
194
195static void
196_edje_mouse_up_signal_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
197{
198 Evas_Event_Mouse_Up *ev;
199 Edje *ed;
200 Edje_Real_Part *rp;
201 char buf[256];
202 int ignored;
203
204 ev = event_info;
205 ed = data;
206 rp = evas_object_data_get(obj, "real_part");
207 if (!rp) return;
208
209 ignored = rp->part->ignore_flags & ev->event_flags;
210
211 _edje_ref(ed);
212 _edje_freeze(ed);
213
214 if ((!ev->event_flags) || (!ignored))
215 {
216 snprintf(buf, sizeof(buf), "mouse,up,%i", ev->button);
217 _edje_emit(ed, buf, rp->part->name);
218 }
219
220 if (rp->events_to)
221 {
222 rp = rp->events_to;
223 if (!ignored)
224 {
225 snprintf(buf, sizeof(buf), "mouse,up,%i", ev->button);
226 _edje_emit(ed, buf, rp->part->name);
227 }
228 }
229
230 if (rp->drag)
231 {
232 if (rp->drag->down.count > 0)
233 {
234 rp->drag->down.count--;
235 if (rp->drag->down.count == 0)
236 {
237 rp->drag->need_reset = 1;
238 ed->dirty = 1;
239#ifdef EDJE_CALC_CACHE
240 rp->invalidate = 1;
241#endif
242 if (!ignored)
243 _edje_emit(ed, "drag,stop", rp->part->name);
244 }
245 }
246 }
247
248 if ((rp->still_in) && (rp->clicked_button == ev->button) && (!ignored))
249 {
250 snprintf(buf, sizeof(buf), "mouse,clicked,%i", ev->button);
251 _edje_emit(ed, buf, rp->part->name);
252 }
253 rp->clicked_button = 0;
254 rp->still_in = 0;
255
256// _edje_recalc_do(ed);
257 _edje_thaw(ed);
258 _edje_unref(ed);
259}
260
261static void
262_edje_mouse_move_signal_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
263{
264 Evas_Event_Mouse_Move *ev;
265 Edje *ed;
266 Edje_Real_Part *rp;
267 int ignored;
268
269 ev = event_info;
270 ed = data;
271 rp = evas_object_data_get(obj, "real_part");
272 if (!rp) return;
273 if (rp->events_to) rp = rp->events_to;
274
275 ignored = rp->part->ignore_flags & ev->event_flags;
276
277 _edje_ref(ed);
278 if ((!ev->event_flags) || (!ignored))
279 _edje_emit(ed, "mouse,move", rp->part->name);
280
281 if (rp->still_in)
282 {
283
284 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
285 rp->still_in = 0;
286 else
287 {
288 Evas_Coord x, y, w, h;
289
290 evas_object_geometry_get(obj, &x, &y, &w, &h);
291 if ((ev->cur.canvas.x < x) || (ev->cur.canvas.y < y) ||
292 (ev->cur.canvas.x >= (x + w)) || (ev->cur.canvas.y >= (y + h)))
293 rp->still_in = 0;
294 }
295 }
296 else
297 {
298 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
299 {
300 Evas_Coord x, y, w, h;
301
302 evas_object_geometry_get(obj, &x, &y, &w, &h);
303 if ((ev->cur.canvas.x >= x) && (ev->cur.canvas.y >= y) &&
304 (ev->cur.canvas.x < (x + w)) && (ev->cur.canvas.y < (y + h)))
305 rp->still_in = 1;
306 }
307 }
308 _edje_freeze(ed);
309 if (rp->drag)
310 {
311 if (rp->drag->down.count > 0)
312 {
313 if (rp->part->dragable.x)
314 rp->drag->tmp.x = ev->cur.canvas.x - rp->drag->down.x;
315 if (rp->part->dragable.y)
316 rp->drag->tmp.y = ev->cur.canvas.y - rp->drag->down.y;
317 ed->dirty = 1;
318#ifdef EDJE_CALC_CACHE
319 rp->invalidate = 1;
320#endif
321 }
322 _edje_recalc_do(ed);
323
324 if (rp->drag->down.count > 0)
325 {
326 FLOAT_T dx, dy;
327
328 _edje_part_dragable_calc(ed, rp, &dx, &dy);
329 if ((dx != rp->drag->val.x) || (dy != rp->drag->val.y))
330 {
331 rp->drag->val.x = dx;
332 rp->drag->val.y = dy;
333 if (!ignored)
334 _edje_emit(ed, "drag", rp->part->name);
335 ed->dirty = 1;
336#ifdef EDJE_CALC_CACHE
337 rp->invalidate = 1;
338#endif
339 _edje_recalc_do(ed);
340 }
341 }
342 }
343 _edje_unref(ed);
344 _edje_thaw(ed);
345}
346
347static void
348_edje_mouse_wheel_signal_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
349{
350 Evas_Event_Mouse_Wheel *ev;
351 Edje *ed;
352 Edje_Real_Part *rp;
353 char buf[256];
354
355 ev = event_info;
356 ed = data;
357 rp = evas_object_data_get(obj, "real_part");
358 if ((!rp) ||
359 ((ev->event_flags) &&
360 (!(rp->part->ignore_flags & ev->event_flags)))) return;
361
362 snprintf(buf, sizeof(buf), "mouse,wheel,%i,%i", ev->direction, (ev->z < 0) ? (-1) : (1));
363 _edje_emit(ed, buf, rp->part->name);
364}
365
366Eina_Bool
367_edje_timer_cb(void *data __UNUSED__)
368{
369 double t;
370 Eina_List *l;
371 Eina_List *animl = NULL;
372 Edje *ed;
373
374 t = ecore_loop_time_get();
375 EINA_LIST_FOREACH(_edje_animators, l, ed)
376 {
377 _edje_ref(ed);
378 animl = eina_list_append(animl, ed);
379 }
380 while (animl)
381 {
382 Eina_List *newl = NULL;
383
384 ed = eina_list_data_get(animl);
385 _edje_block(ed);
386 _edje_freeze(ed);
387 animl = eina_list_remove(animl, eina_list_data_get(animl));
388 if ((!ed->paused) && (!ed->delete_me))
389 {
390 const void *tmp;
391
392 ed->walking_actions = 1;
393 EINA_LIST_FOREACH(ed->actions, l, tmp)
394 newl = eina_list_append(newl, tmp);
395 while (newl)
396 {
397 Edje_Running_Program *runp;
398
399 runp = eina_list_data_get(newl);
400 newl = eina_list_remove(newl, eina_list_data_get(newl));
401 if (!runp->delete_me)
402 _edje_program_run_iterate(runp, t);
403 if (_edje_block_break(ed))
404 {
405 eina_list_free(newl);
406 newl = NULL;
407 goto break_prog;
408 }
409 }
410 EINA_LIST_FOREACH(ed->actions, l, tmp)
411 newl = eina_list_append(newl, tmp);
412 while (newl)
413 {
414 Edje_Running_Program *runp;
415
416 runp = eina_list_data_get(newl);
417 newl = eina_list_remove(newl, eina_list_data_get(newl));
418 if (runp->delete_me)
419 {
420 _edje_anim_count--;
421 runp->edje->actions =
422 eina_list_remove(runp->edje->actions, runp);
423 if (!runp->edje->actions)
424 _edje_animators =
425 eina_list_remove(_edje_animators, runp->edje);
426 free(runp);
427 }
428 }
429 ed->walking_actions = 0;
430 }
431 break_prog:
432 _edje_unblock(ed);
433 _edje_thaw(ed);
434 _edje_unref(ed);
435 }
436 if (_edje_anim_count > 0) return ECORE_CALLBACK_RENEW;
437 _edje_timer = NULL;
438 return ECORE_CALLBACK_CANCEL;
439}
440
441Eina_Bool
442_edje_pending_timer_cb(void *data)
443{
444 Edje_Pending_Program *pp;
445
446 pp = data;
447 pp->edje->pending_actions = eina_list_remove(pp->edje->pending_actions, pp);
448 _edje_program_run(pp->edje, pp->program, 1, "", "");
449 free(pp);
450 return ECORE_CALLBACK_CANCEL;
451}
452
453void
454_edje_callbacks_add(Evas_Object *obj, Edje *ed, Edje_Real_Part *rp)
455{
456 evas_object_event_callback_add(obj,
457 EVAS_CALLBACK_HOLD,
458 _edje_hold_signal_cb,
459 ed);
460 evas_object_event_callback_add(obj,
461 EVAS_CALLBACK_MOUSE_IN,
462 _edje_mouse_in_signal_cb,
463 ed);
464 evas_object_event_callback_add(obj,
465 EVAS_CALLBACK_MOUSE_OUT,
466 _edje_mouse_out_signal_cb,
467 ed);
468 evas_object_event_callback_add(obj,
469 EVAS_CALLBACK_MOUSE_DOWN,
470 _edje_mouse_down_signal_cb,
471 ed);
472 evas_object_event_callback_add(obj,
473 EVAS_CALLBACK_MOUSE_UP,
474 _edje_mouse_up_signal_cb,
475 ed);
476 evas_object_event_callback_add(obj,
477 EVAS_CALLBACK_MOUSE_MOVE,
478 _edje_mouse_move_signal_cb,
479 ed);
480 evas_object_event_callback_add(obj,
481 EVAS_CALLBACK_MOUSE_WHEEL,
482 _edje_mouse_wheel_signal_cb,
483 ed);
484 evas_object_data_set(obj, "real_part", rp);
485}
486
487void
488_edje_callbacks_del(Evas_Object *obj, Edje *ed)
489{
490 evas_object_event_callback_del_full(obj,
491 EVAS_CALLBACK_HOLD,
492 _edje_hold_signal_cb,
493 ed);
494 evas_object_event_callback_del_full(obj,
495 EVAS_CALLBACK_MOUSE_IN,
496 _edje_mouse_in_signal_cb,
497 ed);
498 evas_object_event_callback_del_full(obj,
499 EVAS_CALLBACK_MOUSE_OUT,
500 _edje_mouse_out_signal_cb,
501 ed);
502 evas_object_event_callback_del_full(obj,
503 EVAS_CALLBACK_MOUSE_DOWN,
504 _edje_mouse_down_signal_cb,
505 ed);
506 evas_object_event_callback_del_full(obj,
507 EVAS_CALLBACK_MOUSE_UP,
508 _edje_mouse_up_signal_cb,
509 ed);
510 evas_object_event_callback_del_full(obj,
511 EVAS_CALLBACK_MOUSE_MOVE,
512 _edje_mouse_move_signal_cb,
513 ed);
514 evas_object_event_callback_del_full(obj,
515 EVAS_CALLBACK_MOUSE_WHEEL,
516 _edje_mouse_wheel_signal_cb,
517 ed);
518 evas_object_data_del(obj, "real_part");
519}
520
521void
522_edje_callbacks_focus_add(Evas_Object *obj, Edje *ed, Edje_Real_Part *rp)
523{
524 evas_object_event_callback_add(obj,
525 EVAS_CALLBACK_FOCUS_IN,
526 _edje_focus_in_signal_cb,
527 ed);
528 evas_object_event_callback_add(obj,
529 EVAS_CALLBACK_FOCUS_OUT,
530 _edje_focus_out_signal_cb,
531 ed);
532 evas_object_data_set(obj, "real_part", rp);
533}
534
535void
536_edje_callbacks_focus_del(Evas_Object *obj, Edje *ed)
537{
538 evas_object_event_callback_del_full(obj,
539 EVAS_CALLBACK_FOCUS_IN,
540 _edje_focus_in_signal_cb,
541 ed);
542 evas_object_event_callback_del_full(obj,
543 EVAS_CALLBACK_FOCUS_OUT,
544 _edje_focus_out_signal_cb,
545 ed);
546}
diff --git a/libraries/edje/src/lib/edje_container.c b/libraries/edje/src/lib/edje_container.c
new file mode 100644
index 0000000..357d607
--- /dev/null
+++ b/libraries/edje/src/lib/edje_container.c
@@ -0,0 +1,955 @@
1#include "edje_private.h"
2#include "edje_container.h"
3
4#if 0
5
6static void
7_edje_container_relayout(Smart_Data *sd)
8{
9 Eina_List *l;
10 Evas_Coord x, y, w, h, sw;
11 Edje_Item *ei;
12
13 if (sd->freeze > 0) return;
14 if (!sd->need_layout) return;
15
16 if (sd->w < sd->min_w) sw = sd->min_w;
17 else if (sd->w > sd->max_w) sw = sd->max_w;
18 else sw = sd->w;
19
20 y = 0;
21 x = 0;
22 w = 0;
23 h = 0;
24
25 EINA_LIST_FOREACH(sd->children, l, ei)
26 {
27 if (sd->homogenous) h = sd->min_row_h;
28
29 ei->y = y;
30 ei->h = h;
31// ei->w = w;
32// ei->h = h;
33 }
34
35 sd->need_layout = 0;
36}
37
38static void
39_edje_container_recalc(Smart_Data *sd)
40{
41 Eina_List *l;
42 Edje_Item *ei;
43 int any_max_h = 0, any_max_w = 0;
44 int i;
45
46 if (sd->freeze > 0) return;
47 if (!sd->changed) return;
48
49 sd->min_h = 0;
50 sd->max_h = -1;
51 sd->min_w = 0;
52 sd->max_w = -1;
53 sd->min_row_h = 0;
54 sd->max_row_h = -1;
55 sd->contents_h = 0;
56 sd->contents_w = 0;
57
58 for (i = 0; i < sd->cols; i++)
59 {
60 sd->min_w += sd->colinfo[i].minw;
61 if (sd->colinfo[i].maxw >= 0)
62 {
63 if (sd->max_w >= 0)
64 sd->max_w += sd->colinfo[i].maxw;
65 else
66 sd->max_w = sd->colinfo[i].maxw;
67 }
68 else
69 any_max_w = 1;
70 }
71 if (any_max_w) sd->max_w = -1;
72
73 if (sd->w < sd->min_w)
74 sd->contents_w = sd->min_w;
75 else if ((sd->max_w >= 0) && (sd->w < sd->max_w))
76 sd->w = sd->max_w;
77
78 EINA_LIST_FOREACH(sd->children, l, ei)
79 {
80 if (ei->minh > sd->min_row_h)
81 sd->min_row_h = ei->minh;
82 if (sd->max_row_h >= 0)
83 {
84 if (ei->maxh >= 0)
85 {
86 if (sd->max_row_h > ei->maxh)
87 sd->max_row_h = ei->maxh;
88 }
89 else
90 any_max_h = 1;
91 }
92 sd->min_h += ei->minh;
93 if (ei->maxh >= 0)
94 {
95 if (sd->max_h >= 0)
96 sd->max_h += ei->maxh;
97 else
98 sd->max_h = ei->maxh;
99 }
100 else
101 any_max_h = 1;
102 }
103 if (any_max_h)
104 {
105 sd->max_h = -1;
106 sd->max_row_h = -1;
107 }
108 if (sd->homogenous)
109 {
110 sd->min_h = eina_list_count(sd->children) * sd->min_row_h;
111 }
112
113 sd->changed = 0;
114 sd->change_child = 0;
115 sd->change_child_list = 0;
116 sd->change_cols = 0;
117
118 sd->need_layout = 1;
119 _edje_container_relayout(sd);
120}
121
122static void
123_edje_item_recalc(Edje_Item *ei)
124{
125 int i;
126
127 if (ei->freeze > 0) return;
128 if (!ei->recalc) return;
129 if (!ei->sd) return;
130
131 ei->minh = 0;
132 ei->maxh = -1;
133 for (i = 0; i < ((Smart_Data *)(ei->sd))->cols; i++)
134 {
135 if (ei->cells[i].minh > ei->minh) ei->minh = ei->cells[i].minh;
136 if (ei->cells[i].maxh >= 0)
137 {
138 if (ei->maxh >= 0)
139 {
140 if (ei->cells[i].maxh < ei->maxh)
141 ei->maxh = ei->cells[i].maxh;
142 }
143 else
144 ei->maxh = ei->cells[i].maxh;
145 }
146 if (((Smart_Data *)(ei->sd))->colinfo[i].minw < ei->cells[i].minw)
147 ((Smart_Data *)(ei->sd))->colinfo[i].minw = ei->cells[i].minw;
148 if (((Smart_Data *)(ei->sd))->colinfo[i].maxw >= 0)
149 {
150 if (ei->cells[i].maxw >= 0)
151 {
152 if (((Smart_Data *)(ei->sd))->colinfo[i].maxw > ei->cells[i].maxw)
153 ((Smart_Data *)(ei->sd))->colinfo[i].maxw = ei->cells[i].maxw;
154 }
155 }
156 else
157 ((Smart_Data *)(ei->sd))->colinfo[i].maxw = ei->cells[i].maxw;
158 }
159
160 ei->recalc = 0;
161
162 _edje_container_recalc(ei->sd);
163}
164
165
166/*****************************/
167/**
168 * @endcond
169 */
170
171/*============================================================================*
172 * Global *
173 *============================================================================*/
174
175/*============================================================================*
176 * API *
177 *============================================================================*/
178
179/**
180 * @addtogroup Edje_container_Group Container
181 *
182 * @brief These functions provides an abstraction layer between the application
183 * code and the interface, while allowing extremely flexible dynamic layouts
184 * and animations.
185 *
186 * For more information, you can look at the @ref tutorial_list_page.
187 *
188 * @{
189 */
190
191/**
192 * @brief Create an edje item.
193 *
194 * @param cl The edje item of type Edje_Item_Class.
195 * @param data The edje item data.
196 *
197 * @return The new edje item created.
198 *
199 * This function creates an new edje item. The edje item data can be
200 * retrieved with edje_item_data_get().
201 *
202 * @see edje_item_del()
203 * @see edje_item_data_set()
204 * @see edje_item_data_get()
205 *
206 */
207
208Edje_Item *
209edje_item_add(Edje_Item_Class *cl, void *data)
210{
211 Edje_Item *ei;
212
213 ei = calloc(sizeof(Edje_Item), 1);
214
215 ei->class = cl;
216 ei->class_data = data;
217
218 return ei;
219}
220
221/**
222 * @brief Delete an edje item.
223 *
224 * @param ei The edje item to be deleted.
225 *
226 * This function deletes the edje item from memory.
227 *
228 * @see edje_item_add()
229 * @see edje_item_data_set()
230 * @see edje_item_data_get()
231 *
232 */
233
234void
235edje_item_del(Edje_Item *ei)
236{
237 Smart_Data *sd;
238
239 sd = ei->sd;
240 if (ei->object) evas_object_del(ei->object);
241 if (ei->overlay_object) evas_object_del(ei->overlay_object);
242 free(ei);
243 if (!sd) return;
244 sd->changed = 1;
245 sd->change_child_list = 1;
246 _edje_container_recalc(sd);
247}
248
249/**
250 * @brief Return the smart object of the edje item.
251 *
252 * @param ei The edje item which the smart object of type Evas_Object is get
253 * from.
254 *
255 * This function returns the smart object in the edje item.
256 *
257 */
258
259Evas_Object *
260edje_item_container_get(Edje_Item *ei)
261{
262 if (!ei->sd) return NULL;
263 return ((Smart_Data *)(ei->sd))->smart_obj;
264}
265
266/* an arbitrary data pointer to use to track other data */
267/**
268 * @brief Set the edje item data.
269 *
270 * @param ei The edje item of type Edje_Item_Class.
271 * @param data The edje item data.
272 *
273 * This function set the data of the edje item. The edje item data can be
274 * retrieved with edje_item_data_get().
275 *
276 * @see edje_item_add()
277 * @see edje_item_del()
278 * @see edje_item_data_get()
279 *
280 */
281
282void
283edje_item_data_set(Edje_Item *ei, void *data)
284{
285 ei->data = data;
286}
287
288/**
289 * @brief Get the data of the edje item.
290 *
291 * @param ei The edje item of type Edje_Item_Class.
292 *
293 * This function get the data of the edje item set by edje_item_data_set().
294 *
295 * @see edje_item_data_set()
296 * @see edje_item_add()
297 * @see edje_item_del()
298 *
299 */
300
301void *
302edje_item_data_get(Edje_Item *ei)
303{
304 return ei->data;
305}
306
307/* this object covers the entire item */
308
309void
310edje_item_overlay_object_set(Edje_Item *ei, Evas_Object *obj)
311{
312 if (ei->overlay_object)
313 {
314 /* FIXME: if it changed - remove...*/
315 }
316 ei->overlay_object = obj;
317 if (ei->sd)
318 evas_object_smart_member_add(((Smart_Data *)(ei->sd))->smart_obj, obj);
319}
320
321
322
323Evas_Object *
324edje_item_overlay_object_get(Edje_Item *ei)
325{
326 return ei->overlay_object;
327}
328
329/* this object goes under entire item */
330void
331edje_item_object_set(Edje_Item *ei, Evas_Object *obj)
332{
333 if (ei->object)
334 {
335 /* FIXME: if it changed - remove...*/
336 }
337 ei->object = obj;
338 if (ei->sd)
339 evas_object_smart_member_add(((Smart_Data *)(ei->sd))->smart_obj, obj);
340}
341
342Evas_Object *
343edje_item_object_get(Edje_Item *ei)
344{
345 return ei->object;
346}
347
348/* optionally you can manage each column's object yourself OR let Edje do it */
349void
350edje_item_object_column_set(Edje_Item *ei, int col, Evas_Object *obj)
351{
352 if (ei->cells_num <= (col + 1))
353 {
354 /* FIXME: unsafe realloc */
355 ei->cells = realloc(ei->cells, sizeof(Edje_Item_Cell) * col);
356 ei->cells_num = col + 1;
357 }
358 ei->cells[col].obj = obj;
359}
360
361Evas_Object *
362edje_item_object_column_get(Edje_Item *ei, int col)
363{
364 if (ei->cells_num <= (col + 1)) return NULL;
365 return ei->cells[col].obj;
366}
367
368/* query the item for the items preferred co-ords */
369void
370edje_item_geometry_get(Edje_Item *ei, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
371{
372 if (!ei->sd)
373 {
374 if (x) *x = 0;
375 if (y) *y = 0;
376 if (w) *w = 0;
377 if (h) *h = 0;
378 return;
379 }
380 if (x) *x = ((Smart_Data *)(ei->sd))->x;
381 if (y) *y = ((Smart_Data *)(ei->sd))->y + ei->y;
382 if (w) *w = ((Smart_Data *)(ei->sd))->w;
383 if (h) *h = ei->h;
384}
385
386/* freeze and thaw items if u are about to do a bunch of changes */
387int
388edje_item_freeze(Edje_Item *ei)
389{
390 ei->freeze++;
391 return ei->freeze;
392}
393
394int
395edje_item_thaw(Edje_Item *ei)
396{
397 ei->freeze--;
398 if (ei->freeze > 0) return ei->freeze;
399 if (!ei->sd) return ei->freeze;
400 if (ei->recalc) _edje_item_recalc(ei);
401 return ei->freeze;
402}
403
404/* column info */
405void
406edje_item_column_size_set(Edje_Item *ei, int col, Evas_Coord minw, Evas_Coord maxw, Evas_Coord minh, Evas_Coord maxh)
407{
408 if (ei->cells_num <= (col + 1))
409 {
410 /* FIXME: unsafe realloc */
411 ei->cells = realloc(ei->cells, sizeof(Edje_Item_Cell) * col);
412 ei->cells_num = col + 1;
413 }
414 if ((ei->cells[col].minw == minw) &&
415 (ei->cells[col].minh == minh) &&
416 (ei->cells[col].maxw == maxw) &&
417 (ei->cells[col].maxh == maxh)) return;
418 ei->cells[col].minh = minh;
419 ei->cells[col].maxh = maxh;
420 ei->cells[col].minw = minw;
421 ei->cells[col].maxw = maxw;
422 ei->recalc = 1;
423 if (ei->sd)
424 {
425 ((Smart_Data *)(ei->sd))->changed = 1;
426 ((Smart_Data *)(ei->sd))->change_child = 1;
427 }
428 _edje_item_recalc(ei);
429}
430
431void
432edje_item_column_size_get(Edje_Item *ei, int col, Evas_Coord *minw, Evas_Coord *maxw, Evas_Coord *minh, Evas_Coord *maxh)
433{
434 if (ei->cells_num <= (col + 1))
435 {
436 if (minw) *minw = 0;
437 if (minh) *minh = 0;
438 if (maxw) *maxw = -1;
439 if (maxh) *maxh = -1;
440 }
441 if (minw) *minw = ei->cells[col].minw;
442 if (minh) *minh = ei->cells[col].minh;
443 if (maxw) *maxw = ei->cells[col].maxw;
444 if (maxh) *maxh = ei->cells[col].maxh;
445}
446
447/* selection stuff */
448void
449edje_item_select(Edje_Item *ei)
450{
451 ei->selected = 1;
452 /* FIXME: trigger item to change visually */
453}
454
455void
456edje_item_unselect(Edje_Item *ei)
457{
458 ei->selected = 0;
459 /* FIXME: trigger item to change visually */
460}
461
462/* focus stuff - only 1 can be focuesd */
463void
464edje_item_focus(Edje_Item *ei)
465{
466// ei->focused = 1;
467}
468
469void
470edje_item_unfocus(Edje_Item *ei)
471{
472// ei->focused = 0;
473}
474
475/* disable/enable stuff - stops focus and selection working on these items */
476void
477edje_item_enable(Edje_Item *ei)
478{
479// ei->disabled = 0;
480}
481
482void
483edje_item_disable(Edje_Item *ei)
484{
485// ei->disabled = 1;
486}
487
488/* item utils */
489int
490edje_item_selected_get(Edje_Item *ei)
491{
492 return ei->selected;
493}
494
495int
496edje_item_focused_get(Edje_Item *ei)
497{
498 return ei->focused;
499}
500
501int
502edje_item_disabled_get(Edje_Item *ei)
503{
504 return ei->disabled;
505}
506
507/***** container calls *****/
508
509int
510edje_container_freeze(Evas_Object *obj)
511{
512 Smart_Data *sd;
513
514 sd = evas_object_smart_data_get(obj);
515 if (!sd) return 0;
516 sd->freeze++;
517 return sd->freeze;
518}
519
520int
521edje_container_thaw(Evas_Object *obj)
522{
523 Smart_Data *sd;
524
525 sd = evas_object_smart_data_get(obj);
526 if (!sd) return 0;
527 sd->freeze--;
528 if (sd->freeze <= 0) _edje_container_recalc(sd);
529 return sd->freeze;
530}
531
532void
533edje_container_item_append(Evas_Object *obj, Edje_Item *ei)
534{
535 Smart_Data *sd;
536
537 sd = evas_object_smart_data_get(obj);
538 if (!sd) return;
539 sd->children = eina_list_append(sd->children, ei);
540 sd->changed = 1;
541 sd->change_child_list = 1;
542 sd->rows = eina_list_count(sd->children);
543 _edje_container_recalc(sd);
544}
545
546void
547edje_container_item_prepend(Evas_Object *obj, Edje_Item *ei)
548{
549 Smart_Data *sd;
550
551 sd = evas_object_smart_data_get(obj);
552 if (!sd) return;
553 sd->children = eina_list_prepend(sd->children, ei);
554 sd->changed = 1;
555 sd->change_child_list = 1;
556 sd->rows = eina_list_count(sd->children);
557 _edje_container_recalc(sd);
558}
559
560void
561edje_container_item_append_relative(Evas_Object *obj, Edje_Item *ei, Edje_Item *rel)
562{
563 Smart_Data *sd;
564
565 sd = evas_object_smart_data_get(obj);
566 if (!sd) return;
567 sd->children = eina_list_append_relative(sd->children, ei, rel);
568 sd->changed = 1;
569 sd->change_child_list = 1;
570 sd->rows = eina_list_count(sd->children);
571 _edje_container_recalc(sd);
572}
573
574void
575edje_container_item_prepend_relative(Evas_Object *obj, Edje_Item *ei, Edje_Item *rel)
576{
577 Smart_Data *sd;
578
579 sd = evas_object_smart_data_get(obj);
580 if (!sd) return;
581 sd->children = eina_list_prepend_relative(sd->children, ei, rel);
582 sd->changed = 1;
583 sd->change_child_list = 1;
584 sd->rows = eina_list_count(sd->children);
585 _edje_container_recalc(sd);
586}
587
588void
589edje_container_item_insert(Evas_Object *obj, Edje_Item *ei, int n)
590{
591 Smart_Data *sd;
592 void *rel;
593
594 sd = evas_object_smart_data_get(obj);
595 if (!sd) return;
596 rel = eina_list_nth(sd->children, n);
597 if (!rel)
598 sd->children = eina_list_append(sd->children, ei);
599 else
600 sd->children = eina_list_append_relative(sd->children, ei, rel);
601 sd->changed = 1;
602 sd->change_child_list = 1;
603 sd->rows = eina_list_count(sd->children);
604 _edje_container_recalc(sd);
605}
606
607void
608edje_container_item_remove(Evas_Object *obj, Edje_Item *ei)
609{
610 Smart_Data *sd;
611
612 sd = evas_object_smart_data_get(obj);
613 if (!sd) return;
614 sd->children = eina_list_remove(sd->children, ei);
615 sd->changed = 1;
616 sd->change_child_list = 1;
617 sd->rows = eina_list_count(sd->children);
618 _edje_container_recalc(sd);
619}
620
621void
622edje_container_columns_set(Evas_Object *obj, int cols)
623{
624 Smart_Data *sd;
625
626 sd = evas_object_smart_data_get(obj);
627 if (!sd) return;
628 if (sd->cols == cols) return;
629 sd->colinfo = realloc(sd->colinfo, cols * sizeof(Smart_Data_Colinfo));
630 if (cols > sd->cols)
631 {
632 int i;
633
634 for (i = sd->cols; i < cols; i++)
635 {
636 sd->colinfo[i].minw = 0;
637 sd->colinfo[i].maxw = -1;
638 }
639 }
640 sd->cols = cols;
641 sd->changed = 1;
642 sd->change_cols = 1;
643 _edje_container_recalc(sd);
644}
645
646int
647edje_container_columns_get(Evas_Object *obj)
648{
649 Smart_Data *sd;
650
651 sd = evas_object_smart_data_get(obj);
652 if (!sd) return 0;
653 return sd->cols;
654}
655
656void
657edje_container_min_size_get(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh)
658{
659 Smart_Data *sd;
660
661 sd = evas_object_smart_data_get(obj);
662 if (!sd) return;
663 if (sd->changed)
664 {
665 int freeze;
666
667 freeze = sd->freeze;
668 sd->freeze = 0;
669 _edje_container_recalc(sd);
670 sd->freeze = freeze;
671 }
672 if (minw) *minw = sd->min_w;
673 if (minh) *minh = sd->min_h;
674}
675
676void
677edje_container_max_size_get(Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh)
678{
679 Smart_Data *sd;
680
681 sd = evas_object_smart_data_get(obj);
682 if (!sd) return;
683 if (sd->changed)
684 {
685 int freeze;
686
687 freeze = sd->freeze;
688 sd->freeze = 0;
689 _edje_container_recalc(sd);
690 sd->freeze = freeze;
691 }
692 if (maxw) *maxw = sd->max_w;
693 if (maxh) *maxh = sd->max_h;
694}
695
696void
697edje_containter_align_set(Evas_Object *obj, double halign, double valign)
698{
699 Smart_Data *sd;
700
701 sd = evas_object_smart_data_get(obj);
702 if (!sd) return;
703 if ((sd->align_x == halign) && (sd->align_y == valign)) return;
704 sd->align_x = halign;
705 sd->align_y = valign;
706 sd->need_layout = 1;
707 _edje_container_relayout(sd);
708}
709
710void
711edje_container_align_get(Evas_Object *obj, double *halign, double *valign)
712{
713 Smart_Data *sd;
714
715 sd = evas_object_smart_data_get(obj);
716 if (!sd) return;
717 if (halign) *halign = sd->align_x;
718 if (valign) *valign = sd->align_y;
719}
720
721int
722edje_container_count_get(Evas_Object *obj)
723{
724 Smart_Data *sd;
725
726 sd = evas_object_smart_data_get(obj);
727 if (!sd) return 0;
728 return eina_list_count(sd->children);
729}
730
731Edje_Item *
732edje_container_item_first_get(Evas_Object *obj)
733{
734 Smart_Data *sd;
735
736 sd = evas_object_smart_data_get(obj);
737 if (!sd) return NULL;
738 if (!sd->children) return NULL;
739 return eina_list_data_get(sd->children);
740}
741
742Edje_Item *
743edje_container_item_last_get(Evas_Object *obj)
744{
745 Smart_Data *sd;
746
747 sd = evas_object_smart_data_get(obj);
748 if (!sd) return NULL;
749 if (!sd->children) return NULL;
750 return0 eina_list_data_get(eina_list_last(sd->children));
751}
752
753Edje_Item *
754edje_container_item_nth_get(Evas_Object *obj, int n)
755{
756 Smart_Data *sd;
757
758 sd = evas_object_smart_data_get(obj);
759 if (!sd) return NULL;
760 return eina_list_nth(sd->children, n);
761}
762
763void
764edje_container_homogenous_size_set(Evas_Object *obj, int homog)
765{
766 Smart_Data *sd;
767
768 sd = evas_object_smart_data_get(obj);
769 if (!sd) return;
770 if (((homog) && (sd->homogenous)) ||
771 ((!homog) && (!sd->homogenous))) return;
772 sd->homogenous = homog;
773 sd->changed = 1;
774 sd->change_child = 1;
775 _edje_container_recalc(sd);
776}
777
778int
779edje_container_homogenous_size_get(Evas_Object *obj)
780{
781 Smart_Data *sd;
782
783 sd = evas_object_smart_data_get(obj);
784 if (!sd) return 0;
785 return sd->homogenous;
786}
787
788void
789edje_container_scroll_set(Evas_Object *obj, double pos, double shift)
790{
791 Smart_Data *sd;
792
793 sd = evas_object_smart_data_get(obj);
794 if (!sd) return;
795 if ((sd->scroll_y == pos) && (sd->scroll_x == shift)) return;
796 sd->scroll_y = pos;
797 sd->scroll_x = shift;
798 sd->need_layout = 1;
799 _edje_container_relayout(sd);
800}
801
802void
803edje_container_scroll_get(Evas_Object *obj, double *pos, double *shift)
804{
805 Smart_Data *sd;
806
807 sd = evas_object_smart_data_get(obj);
808 if (!sd) return;
809 if (pos) *pos = sd->scroll_y;
810 if (shift) *shift = sd->scroll_x;
811}
812
813static void _smart_init(void);
814static void _smart_add(Evas_Object * obj);
815static void _smart_del(Evas_Object * obj);
816static void _smart_move(Evas_Object * obj, Evas_Coord x, Evas_Coord y);
817static void _smart_resize(Evas_Object * obj, Evas_Coord w, Evas_Coord h);
818static void _smart_show(Evas_Object * obj);
819static void _smart_hide(Evas_Object * obj);
820static void _smart_color_set(Evas_Object * obj, int r, int g, int b, int a);
821static void _smart_clip_set(Evas_Object * obj, Evas_Object * clip);
822static void _smart_clip_unset(Evas_Object * obj);
823
824static Evas_Smart *smart = NULL;
825
826Evas_Object *
827edje_container_object_add(Evas *evas)
828{
829 _smart_init();
830 return evas_object_smart_add(evas, smart);
831}
832
833/*******************************************/
834/* Internal smart object required routines */
835/*******************************************/
836static void
837_smart_init(void)
838{
839 if (smart) return;
840 {
841 static const Evas_Smart_Class sc =
842 {
843 E_OBJ_NAME,
844 _smart_add,
845 _smart_del,
846 _smart_move,
847 _smart_resize,
848 _smart_show,
849 _smart_hide,
850 _smart_color_set,
851 _smart_clip_set,
852 _smart_clip_unset,
853 NULL,
854 NULL,
855 NULL
856 };
857 smart = evas_smart_class_new(&sc);
858 }
859}
860
861static void
862_smart_add(Evas_Object *obj)
863{
864 Smart_Data *sd;
865
866 sd = calloc(1, sizeof(Smart_Data));
867 if (!sd) return;
868// evas_object_smart_member_add(sd->obj, obj);
869 evas_object_smart_data_set(obj, sd);
870 sd->smart_obj = obj;
871}
872
873static void
874_smart_del(Evas_Object *obj)
875{
876 Smart_Data *sd;
877
878 sd = evas_object_smart_data_get(obj);
879 if (!sd) return;
880 if (sd->colinfo) free(sd->colinfo);
881// evas_object_del(sd->obj);
882 free(sd);
883}
884
885static void
886_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
887{
888 Smart_Data *sd;
889
890 sd = evas_object_smart_data_get(obj);
891 if (!sd) return;
892// evas_object_move(sd->obj, x, y);
893}
894
895static void
896_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
897{
898 Smart_Data *sd;
899
900 sd = evas_object_smart_data_get(obj);
901 if (!sd) return;
902// evas_object_resize(sd->obj, w, h);
903}
904
905static void
906_smart_show(Evas_Object *obj)
907{
908 Smart_Data *sd;
909
910 sd = evas_object_smart_data_get(obj);
911 if (!sd) return;
912// evas_object_show(sd->obj);
913}
914
915static void
916_smart_hide(Evas_Object *obj)
917{
918 Smart_Data *sd;
919
920 sd = evas_object_smart_data_get(obj);
921 if (!sd) return;
922// evas_object_hide(sd->obj);
923}
924
925static void
926_smart_color_set(Evas_Object *obj, int r, int g, int b, int a)
927{
928 Smart_Data *sd;
929
930 sd = evas_object_smart_data_get(obj);
931 if (!sd) return;
932// evas_object_color_set(sd->obj, r, g, b, a);
933}
934
935static void
936_smart_clip_set(Evas_Object *obj, Evas_Object *clip)
937{
938 Smart_Data *sd;
939
940 sd = evas_object_smart_data_get(obj);
941 if (!sd) return;
942// evas_object_clip_set(sd->obj, clip);
943}
944
945static void
946_smart_clip_unset(Evas_Object *obj)
947{
948 Smart_Data *sd;
949
950 sd = evas_object_smart_data_get(obj);
951 if (!sd) return;
952// evas_object_clip_unset(sd->obj);
953}
954
955#endif
diff --git a/libraries/edje/src/lib/edje_container.h b/libraries/edje/src/lib/edje_container.h
new file mode 100644
index 0000000..0fba62c
--- /dev/null
+++ b/libraries/edje/src/lib/edje_container.h
@@ -0,0 +1,165 @@
1#include "edje_private.h"
2
3
4#define E_SMART_OBJ_GET(smart, o, type) \
5 { \
6 char *_e_smart_str; \
7 \
8 if (!o) return; \
9 smart = evas_object_smart_data_get(o); \
10 if (!smart) return; \
11 _e_smart_str = (char *)evas_object_type_get(o); \
12 if (!_e_smart_str) return; \
13 if (strcmp(_e_smart_str, type)) return; \
14 }
15
16#define E_SMART_OBJ_GET_RETURN(smart, o, type, ret) \
17 { \
18 char *_e_smart_str; \
19 \
20 if (!o) return ret; \
21 smart = evas_object_smart_data_get(o); \
22 if (!smart) return ret; \
23 _e_smart_str = (char *)evas_object_type_get(o); \
24 if (!_e_smart_str) return ret; \
25 if (strcmp(_e_smart_str, type)) return ret; \
26 }
27
28#define E_OBJ_NAME "edje_container_object"
29
30typedef struct _Smart_Data Smart_Data;
31typedef struct _Smart_Data_Colinfo Smart_Data_Colinfo;
32
33struct _Smart_Data
34{
35 Evas_Coord x, y, w, h;
36 Eina_List *children;
37 Evas_Object *smart_obj;
38 int cols, rows;
39
40 Evas_Coord contents_w, contents_h;
41 Evas_Coord min_row_h, max_row_h;
42 Evas_Coord min_w, max_w, min_h, max_h;
43
44 Smart_Data_Colinfo *colinfo;
45
46 int freeze;
47
48 double scroll_x, scroll_y;
49 double align_x, align_y;
50
51 unsigned char changed : 1;
52 unsigned char change_child : 1;
53 unsigned char change_child_list : 1;
54 unsigned char change_cols : 1;
55 unsigned char change_scroll : 1;
56
57 unsigned char need_layout : 1;
58
59 unsigned char homogenous : 1;
60};
61
62struct _Smart_Data_Colinfo
63{
64 Evas_Coord minw, maxw;
65};
66
67/* All items are virtual constructs that provide Evas_Objects at some point.
68 * Edje may move, resize, show, hide, clip, unclip, raise, lower etc. this
69 * item AFTER it calls the item's add() method and before it calls the del()
70 * method. Edje may call add() and del() at any time as often items may not
71 * be visible and so may not need to exist at all - they are merely information
72 * used for layout, and nothing more. this helps save cpu and memory keeping
73 * things responsive for BIG lists of items. you create an item from an item
74 * class then ask that item to be appended/prepended etc. to the container.
75 */
76typedef struct _Edje_Item Edje_Item;
77typedef struct _Edje_Item_Cell Edje_Item_Cell;
78typedef struct _Edje_Item_Class Edje_Item_Class;
79
80struct _Edje_Item_Class
81{
82 Evas_Object *(*add) (Edje_Item *ei);
83 void (*del) (Edje_Item *ei);
84 void (*select) (Edje_Item *ei);
85 void (*deselect) (Edje_Item *ei);
86 void (*focus) (Edje_Item *ei);
87 void (*unfocus) (Edje_Item *ei);
88};
89
90/* private */
91struct _Edje_Item
92{
93 Edje_Item_Class *class;
94 void *class_data;
95
96 void *sd;
97
98 void *data;
99
100 Evas_Object *object;
101 Evas_Object *overlay_object;
102 int freeze;
103 Evas_Coord y, h;
104
105 Evas_Coord minh, maxh;
106
107 int cells_num;
108 Edje_Item_Cell *cells;
109
110 unsigned char accessible : 1;
111
112 unsigned char recalc : 1;
113 unsigned char selected : 1;
114 unsigned char disabled : 1;
115 unsigned char focused : 1;
116};
117
118struct _Edje_Item_Cell
119{
120 Evas_Object *obj;
121 Evas_Coord x, w;
122 Evas_Coord minw, minh, maxw, maxh;
123};
124
125/* here is an item for a vertical list - with 1 or more columns. this has 3 */
126/* just rotate for a horizontal list */
127
128/*
129 * COL 0 COL 1 COL 2
130 *
131 * +-----------------------------+ +-------+ +----------------+
132 * | pad_top | | | | |
133 * | pad_left OBJECT pad_right | | OBJ | | OBJECT | ROW 0
134 * | pad_bottom | | | | |
135 * +-----------------------------+ +-------+ +----------------+
136 * /\ /|\
137 * space_row || +-- space_col
138 * \/
139 * +-----------------------------+ +-------+ +----------------+
140 * | | | | | |
141 * | | | | | | ROW 1
142 * | | | | | |
143 * +-----------------------------+ +-------+ +----------------+
144 *
145 * spacer object:
146 * 1 Edje object goes in-between each row as a spacer object (opt)
147 * 1 Edje object goes in-between each column as a spacer object (opt)
148 *
149 * surround object:
150 * 1 Edje object goes around each item - item swallowed into "item" part (opt)
151 * if no "item" part then just underlay it
152 * on select send "select" "" signal
153 * on unselect send "unselect" "" signal
154 * on focus send "focus" "" signal
155 * on unfocus send "unfocus" signal
156 *
157 * if any list item/cell is an Edje object emit this to them too.
158 *
159 * also call callbacks.
160 * if a surround object emits such a signal itself then call callbacks too
161 *
162 * only 1 or 0 items can be focused
163 * disabled items cannot be focused or selected/deselected
164 *
165 */
diff --git a/libraries/edje/src/lib/edje_convert.h b/libraries/edje/src/lib/edje_convert.h
new file mode 100644
index 0000000..fcc2781
--- /dev/null
+++ b/libraries/edje/src/lib/edje_convert.h
@@ -0,0 +1,143 @@
1#ifndef EDJE_CONVERT_H__
2# define EDJE_CONVERT_H__
3
4typedef struct _Old_Edje_Image_Directory Old_Edje_Image_Directory;
5typedef struct _Old_Edje_Font_Directory Old_Edje_Font_Directory;
6typedef struct _Old_Edje_External_Directory Old_Edje_External_Directory;
7typedef struct _Old_Edje_Part Old_Edje_Part;
8typedef struct _Old_Edje_Part_Collection Old_Edje_Part_Collection;
9typedef struct _Old_Edje_Part_Description Old_Edje_Part_Description;
10typedef struct _Old_Edje_Part_Description_Spec_Image Old_Edje_Part_Description_Spec_Image;
11typedef struct _Edje_Data Edje_Data;
12
13struct _Edje_Data
14{
15 const char *key;
16 char *value;
17};
18
19/*----------*/
20
21struct _Old_Edje_Font_Directory
22{
23 Eina_List *entries; /* a list of Edje_Font_Directory_Entry */
24};
25
26struct _Old_Edje_Image_Directory
27{
28 Eina_List *entries; /* a list of Edje_Image_Directory_Entry */
29 Eina_List *sets; /* a list of Edje_Image_Directory_Set */
30};
31
32struct _Old_Edje_External_Directory
33{
34 Eina_List *entries; /* a list of Edje_External_Directory_Entry */
35};
36
37struct _Old_Edje_File
38{
39 const char *path;
40 time_t mtime;
41
42 Old_Edje_External_Directory *external_dir;
43 Old_Edje_Font_Directory *font_dir;
44 Old_Edje_Image_Directory *image_dir;
45 Edje_Part_Collection_Directory *collection_dir;
46 Eina_List *data;
47 Eina_List *styles;
48 Eina_List *color_classes;
49
50 const char *compiler;
51 int version;
52 int feature_ver;
53};
54
55struct _Old_Edje_Part_Collection
56{
57 Eina_List *programs; /* a list of Edje_Program */
58 Eina_List *parts; /* a list of Edje_Part */
59 Eina_List *data;
60
61 int id; /* the collection id */
62
63 Eina_Hash *alias; /* aliasing part*/
64
65 struct {
66 Edje_Size min, max;
67 } prop;
68
69 int references;
70#ifdef EDJE_PROGRAM_CACHE
71 struct {
72 Eina_Hash *no_matches;
73 Eina_Hash *matches;
74 } prog_cache;
75#endif
76
77 Embryo_Program *script; /* all the embryo script code for this group */
78 const char *part;
79
80 unsigned char script_only;
81
82 unsigned char lua_script_only;
83
84 unsigned char checked : 1;
85};
86
87struct _Old_Edje_Part
88{
89 const char *name; /* the name if any of the part */
90 Old_Edje_Part_Description *default_desc; /* the part descriptor for default */
91 Eina_List *other_desc; /* other possible descriptors */
92 const char *source, *source2, *source3, *source4, *source5, *source6;
93 int id; /* its id number */
94 int clip_to_id; /* the part id to clip this one to */
95 Edje_Part_Dragable dragable;
96 Eina_List *items; /* packed items for box and table */
97 unsigned char type; /* what type (image, rect, text) */
98 unsigned char effect; /* 0 = plain... */
99 unsigned char mouse_events; /* it will affect/respond to mouse events */
100 unsigned char repeat_events; /* it will repeat events to objects below */
101 Evas_Event_Flags ignore_flags;
102 unsigned char scale; /* should certain properties scale with edje scale factor? */
103 unsigned char precise_is_inside;
104 unsigned char use_alternate_font_metrics;
105 unsigned char pointer_mode;
106 unsigned char entry_mode;
107 unsigned char select_mode;
108 unsigned char multiline;
109 Edje_Part_Api api;
110};
111
112struct _Old_Edje_Part_Description_Spec_Image
113{
114 Eina_List *tween_list; /* list of Edje_Part_Image_Id */
115 int id; /* the image id to use */
116 int scale_hint; /* evas scale hint */
117 Eina_Bool set; /* if image condition it's content */
118
119 Edje_Part_Description_Spec_Border border;
120 Edje_Part_Description_Spec_Fill fill;
121};
122
123struct _Old_Edje_Part_Description
124{
125 Edje_Part_Description_Common common;
126 Old_Edje_Part_Description_Spec_Image image;
127 Edje_Part_Description_Spec_Text text;
128 Edje_Part_Description_Spec_Box box;
129 Edje_Part_Description_Spec_Table table;
130
131 Eina_List *external_params; /* parameters for external objects */
132};
133
134Edje_File *_edje_file_convert(Eet_File *file, Old_Edje_File *oedf);
135Edje_Part_Collection *_edje_collection_convert(Edje_File *file,
136 Old_Edje_Part_Collection *oedc);
137Edje_Part_Description_Common *_edje_description_convert(int type,
138 Edje_Part_Collection_Directory_Entry *ce,
139 Old_Edje_Part_Description *oed);
140const Edje_File *_edje_file_get(void);
141void _edje_file_set(const Edje_File *edf);
142
143#endif
diff --git a/libraries/edje/src/lib/edje_data.c b/libraries/edje/src/lib/edje_data.c
new file mode 100644
index 0000000..6b7b395
--- /dev/null
+++ b/libraries/edje/src/lib/edje_data.c
@@ -0,0 +1,877 @@
1#include "edje_private.h"
2
3EAPI Eet_Data_Descriptor *_edje_edd_edje_file = NULL;
4EAPI Eet_Data_Descriptor *_edje_edd_edje_part_collection = NULL;
5
6Eet_Data_Descriptor *_edje_edd_edje_string = NULL;
7Eet_Data_Descriptor *_edje_edd_edje_style = NULL;
8Eet_Data_Descriptor *_edje_edd_edje_style_tag = NULL;
9Eet_Data_Descriptor *_edje_edd_edje_color_class = NULL;
10Eet_Data_Descriptor *_edje_edd_edje_external_directory = NULL;
11Eet_Data_Descriptor *_edje_edd_edje_external_directory_entry = NULL;
12Eet_Data_Descriptor *_edje_edd_edje_font_directory_entry = NULL;
13Eet_Data_Descriptor *_edje_edd_edje_image_directory = NULL;
14Eet_Data_Descriptor *_edje_edd_edje_image_directory_entry = NULL;
15Eet_Data_Descriptor *_edje_edd_edje_image_directory_set = NULL;
16Eet_Data_Descriptor *_edje_edd_edje_image_directory_set_entry = NULL;
17Eet_Data_Descriptor *_edje_edd_edje_limit = NULL;
18Eet_Data_Descriptor *_edje_edd_edje_limit_pointer = NULL;
19Eet_Data_Descriptor *_edje_edd_edje_sound_sample = NULL;
20Eet_Data_Descriptor *_edje_edd_edje_sound_tone = NULL;
21Eet_Data_Descriptor *_edje_edd_edje_sound_directory = NULL;
22Eet_Data_Descriptor *_edje_edd_edje_program = NULL;
23Eet_Data_Descriptor *_edje_edd_edje_program_pointer = NULL;
24Eet_Data_Descriptor *_edje_edd_edje_program_target = NULL;
25Eet_Data_Descriptor *_edje_edd_edje_program_after = NULL;
26Eet_Data_Descriptor *_edje_edd_edje_part_collection_directory_entry = NULL;
27Eet_Data_Descriptor *_edje_edd_edje_pack_element = NULL;
28Eet_Data_Descriptor *_edje_edd_edje_pack_element_pointer = NULL;
29Eet_Data_Descriptor *_edje_edd_edje_part = NULL;
30Eet_Data_Descriptor *_edje_edd_edje_part_pointer = NULL;
31Eet_Data_Descriptor *_edje_edd_edje_part_description_variant = NULL;
32Eet_Data_Descriptor *_edje_edd_edje_part_description_rectangle = NULL;
33Eet_Data_Descriptor *_edje_edd_edje_part_description_swallow = NULL;
34Eet_Data_Descriptor *_edje_edd_edje_part_description_group = NULL;
35Eet_Data_Descriptor *_edje_edd_edje_part_description_image = NULL;
36Eet_Data_Descriptor *_edje_edd_edje_part_description_proxy = NULL;
37Eet_Data_Descriptor *_edje_edd_edje_part_description_text = NULL;
38Eet_Data_Descriptor *_edje_edd_edje_part_description_textblock = NULL;
39Eet_Data_Descriptor *_edje_edd_edje_part_description_box = NULL;
40Eet_Data_Descriptor *_edje_edd_edje_part_description_table = NULL;
41Eet_Data_Descriptor *_edje_edd_edje_part_description_external = NULL;
42Eet_Data_Descriptor *_edje_edd_edje_part_description_variant_list = NULL;
43Eet_Data_Descriptor *_edje_edd_edje_part_description_rectangle_pointer = NULL;
44Eet_Data_Descriptor *_edje_edd_edje_part_description_swallow_pointer = NULL;
45Eet_Data_Descriptor *_edje_edd_edje_part_description_group_pointer = NULL;
46Eet_Data_Descriptor *_edje_edd_edje_part_description_image_pointer = NULL;
47Eet_Data_Descriptor *_edje_edd_edje_part_description_proxy_pointer = NULL;
48Eet_Data_Descriptor *_edje_edd_edje_part_description_text_pointer = NULL;
49Eet_Data_Descriptor *_edje_edd_edje_part_description_textblock_pointer = NULL;
50Eet_Data_Descriptor *_edje_edd_edje_part_description_box_pointer = NULL;
51Eet_Data_Descriptor *_edje_edd_edje_part_description_table_pointer = NULL;
52Eet_Data_Descriptor *_edje_edd_edje_part_description_external_pointer = NULL;
53Eet_Data_Descriptor *_edje_edd_edje_part_image_id = NULL;
54Eet_Data_Descriptor *_edje_edd_edje_part_image_id_pointer = NULL;
55Eet_Data_Descriptor *_edje_edd_edje_external_param = NULL;
56
57#define EMP(Type, Minus) \
58 Eina_Mempool *_emp_##Type = NULL; \
59 \
60 static void * \
61 mem_alloc_##Minus(size_t size) \
62 { \
63 void *data; \
64 \
65 data = eina_mempool_malloc(_emp_##Type, size); \
66 memset(data, 0, size); \
67 return data; \
68 } \
69 \
70 static void \
71 mem_free_##Minus(void *data) \
72 { \
73 eina_mempool_free(_emp_##Type, data); \
74 }
75
76EMP(RECTANGLE, rectangle);
77EMP(TEXT, text);
78EMP(IMAGE, image);
79EMP(PROXY, proxy);
80EMP(SWALLOW, swallow);
81EMP(TEXTBLOCK, textblock);
82EMP(GROUP, group);
83EMP(BOX, box);
84EMP(TABLE, table);
85EMP(EXTERNAL, external);
86EMP(part, part);
87
88#define FREED(eed) \
89 if (eed) \
90 { \
91 eet_data_descriptor_free((eed)); \
92 (eed) = NULL; \
93 }
94
95struct {
96 Edje_Part_Type type;
97 const char *name;
98} variant_convertion[] = {
99 { EDJE_PART_TYPE_RECTANGLE, "rectangle" },
100 { EDJE_PART_TYPE_SWALLOW, "swallow" },
101 { EDJE_PART_TYPE_GROUP, "group" },
102 { EDJE_PART_TYPE_IMAGE, "image" },
103 { EDJE_PART_TYPE_TEXT, "text" },
104 { EDJE_PART_TYPE_TEXTBLOCK, "textblock" },
105 { EDJE_PART_TYPE_BOX, "box" },
106 { EDJE_PART_TYPE_TABLE, "table" },
107 { EDJE_PART_TYPE_EXTERNAL, "external" },
108 { EDJE_PART_TYPE_PROXY, "proxy" }
109};
110
111static const char *
112_edje_description_variant_type_get(const void *data, Eina_Bool *unknow __UNUSED__)
113{
114 const unsigned char *type;
115 unsigned int i;
116
117 type = data;
118
119 for (i = 0; i < (sizeof (variant_convertion) / sizeof (variant_convertion[0])); ++i)
120 if (*type == variant_convertion[i].type)
121 return variant_convertion[i].name;
122
123 return NULL;
124}
125
126static Eina_Bool
127_edje_description_variant_type_set(const char *type, void *data, Eina_Bool unknow __UNUSED__)
128{
129 unsigned char *dt;
130 unsigned int i;
131
132 dt = data;
133
134 for (i = 0; i < (sizeof (variant_convertion) / sizeof (variant_convertion[0])); ++i)
135 if (!strcmp(variant_convertion[i].name, type))
136 {
137 *dt = variant_convertion[i].type;
138 return EINA_TRUE;
139 }
140
141 return EINA_FALSE;
142}
143
144static Eina_Hash *
145_edje_eina_hash_add_alloc(Eina_Hash *hash,
146 const char *key,
147 void *data)
148{
149 if (!hash)
150 hash = eina_hash_string_small_new(free);
151
152 if (!hash)
153 return NULL;
154
155 eina_hash_add(hash, key, data);
156 return hash;
157}
158
159// FIXME: remove EAPI when edje_convert goes
160EAPI void
161_edje_edd_shutdown(void)
162{
163 FREED(_edje_edd_edje_file);
164 FREED(_edje_edd_edje_string);
165 FREED(_edje_edd_edje_style);
166 FREED(_edje_edd_edje_style_tag);
167 FREED(_edje_edd_edje_color_class);
168 FREED(_edje_edd_edje_external_directory);
169 FREED(_edje_edd_edje_external_directory_entry);
170 FREED(_edje_edd_edje_font_directory_entry);
171 FREED(_edje_edd_edje_image_directory);
172 FREED(_edje_edd_edje_image_directory_entry);
173 FREED(_edje_edd_edje_limit);
174 FREED(_edje_edd_edje_limit_pointer);
175 FREED(_edje_edd_edje_sound_sample);
176 FREED(_edje_edd_edje_sound_tone);
177 FREED(_edje_edd_edje_sound_directory);
178 FREED(_edje_edd_edje_program);
179 FREED(_edje_edd_edje_program_pointer);
180 FREED(_edje_edd_edje_program_target);
181 FREED(_edje_edd_edje_program_after);
182 FREED(_edje_edd_edje_part_collection_directory_entry);
183 FREED(_edje_edd_edje_pack_element);
184 FREED(_edje_edd_edje_pack_element_pointer);
185 FREED(_edje_edd_edje_part_collection);
186 FREED(_edje_edd_edje_part);
187 FREED(_edje_edd_edje_part_pointer);
188 FREED(_edje_edd_edje_part_description_variant);
189 FREED(_edje_edd_edje_part_description_rectangle);
190 FREED(_edje_edd_edje_part_description_swallow);
191 FREED(_edje_edd_edje_part_description_group);
192 FREED(_edje_edd_edje_part_description_image);
193 FREED(_edje_edd_edje_part_description_proxy);
194 FREED(_edje_edd_edje_part_description_text);
195 FREED(_edje_edd_edje_part_description_textblock);
196 FREED(_edje_edd_edje_part_description_box);
197 FREED(_edje_edd_edje_part_description_table);
198 FREED(_edje_edd_edje_part_description_external);
199 FREED(_edje_edd_edje_part_description_variant_list);
200 FREED(_edje_edd_edje_part_description_rectangle_pointer);
201 FREED(_edje_edd_edje_part_description_swallow_pointer);
202 FREED(_edje_edd_edje_part_description_group_pointer);
203 FREED(_edje_edd_edje_part_description_image_pointer);
204 FREED(_edje_edd_edje_part_description_proxy_pointer);
205 FREED(_edje_edd_edje_part_description_text_pointer);
206 FREED(_edje_edd_edje_part_description_textblock_pointer);
207 FREED(_edje_edd_edje_part_description_box_pointer);
208 FREED(_edje_edd_edje_part_description_table_pointer);
209 FREED(_edje_edd_edje_part_description_external_pointer);
210 FREED(_edje_edd_edje_part_image_id);
211 FREED(_edje_edd_edje_part_image_id_pointer);
212 FREED(_edje_edd_edje_external_param);
213 FREED(_edje_edd_edje_image_directory_set);
214 FREED(_edje_edd_edje_image_directory_set_entry);
215}
216
217#define EDJE_DEFINE_POINTER_TYPE(Type, Name) \
218 { \
219 typedef struct _Edje_##Type##_Pointer Edje_##Type##_Pointer; \
220 struct _Edje_##Type##_Pointer \
221 { \
222 Edje_##Type *pointer; \
223 }; \
224 \
225 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_##Type##_Pointer); \
226 _edje_edd_edje_##Name##_pointer = \
227 eet_data_descriptor_file_new(&eddc); \
228 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_##Name##_pointer, Edje_##Type##_Pointer, "pointer", pointer, _edje_edd_edje_##Name); \
229 }
230
231// FIXME: remove EAPI when edje_convert goes
232EAPI void
233_edje_edd_init(void)
234{
235 Eet_Data_Descriptor_Class eddc;
236
237 /* localisable string */
238 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_String);
239 _edje_edd_edje_string = eet_data_descriptor_file_new(&eddc);
240 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_string, Edje_String, "str", str, EET_T_STRING);
241 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_string, Edje_String, "id", id, EET_T_UINT);
242
243 /* external directory */
244 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_External_Directory_Entry);
245 _edje_edd_edje_external_directory_entry =
246 eet_data_descriptor_file_new(&eddc);
247 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_external_directory_entry, Edje_External_Directory_Entry, "entry", entry, EET_T_STRING);
248
249 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_External_Directory);
250 _edje_edd_edje_external_directory =
251 eet_data_descriptor_file_new(&eddc);
252 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_external_directory, Edje_External_Directory, "entries", entries, _edje_edd_edje_external_directory_entry);
253
254 /* font directory */
255 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Font_Directory_Entry);
256 _edje_edd_edje_font_directory_entry =
257 eet_data_descriptor_file_new(&eddc);
258 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_font_directory_entry, Edje_Font_Directory_Entry, "entry", entry, EET_T_STRING);
259 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_font_directory_entry, Edje_Font_Directory_Entry, "file", file, EET_T_STRING);
260
261 /* image directory */
262 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Image_Directory_Entry);
263 _edje_edd_edje_image_directory_entry =
264 eet_data_descriptor_file_new(&eddc);
265 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_entry, Edje_Image_Directory_Entry, "entry", entry, EET_T_STRING);
266 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_entry, Edje_Image_Directory_Entry, "source_type", source_type, EET_T_INT);
267 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_entry, Edje_Image_Directory_Entry, "source_param", source_param, EET_T_INT);
268 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_entry, Edje_Image_Directory_Entry, "id", id, EET_T_INT);
269
270 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Image_Directory_Set_Entry);
271 _edje_edd_edje_image_directory_set_entry =
272 eet_data_descriptor_file_new(&eddc);
273 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "name", name, EET_T_STRING);
274 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "id", id, EET_T_INT);
275 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "min.w", size.min.w, EET_T_INT);
276 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "min.h", size.min.h, EET_T_INT);
277 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "max.w", size.max.w, EET_T_INT);
278 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "max.h", size.max.h, EET_T_INT);
279
280 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Image_Directory_Set);
281 _edje_edd_edje_image_directory_set =
282 eet_data_descriptor_file_new(&eddc);
283 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set, Edje_Image_Directory_Set, "name", name, EET_T_STRING);
284 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set, Edje_Image_Directory_Set, "id", id, EET_T_INT);
285 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_image_directory_set, Edje_Image_Directory_Set, "entries", entries, _edje_edd_edje_image_directory_set_entry);
286
287 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Image_Directory);
288 _edje_edd_edje_image_directory =
289 eet_data_descriptor_file_new(&eddc);
290 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_image_directory, Edje_Image_Directory, "entries", entries, _edje_edd_edje_image_directory_entry);
291 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_image_directory, Edje_Image_Directory, "sets", sets, _edje_edd_edje_image_directory_set);
292
293 /* Sound */
294 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Sound_Sample);
295 _edje_edd_edje_sound_sample =
296 eet_data_descriptor_file_new(&eddc);
297 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_sound_sample, Edje_Sound_Sample, "name", name, EET_T_STRING);
298 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_sound_sample, Edje_Sound_Sample, "snd_src", snd_src, EET_T_STRING);
299 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_sound_sample, Edje_Sound_Sample, "compression", compression, EET_T_INT);
300 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_sound_sample, Edje_Sound_Sample, "mode", mode, EET_T_INT);
301 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_sound_sample, Edje_Sound_Sample, "quality", quality, EET_T_DOUBLE);
302 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_sound_sample, Edje_Sound_Sample, "id", id, EET_T_INT);
303 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Sound_Tone);
304 _edje_edd_edje_sound_tone =
305 eet_data_descriptor_file_new(&eddc);
306 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_sound_tone, Edje_Sound_Tone, "name", name, EET_T_STRING);
307 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_sound_tone, Edje_Sound_Tone, "value", value, EET_T_INT);
308 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_sound_tone, Edje_Sound_Tone, "id", id, EET_T_INT);
309
310 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Sound_Directory);
311 _edje_edd_edje_sound_directory =
312 eet_data_descriptor_file_new(&eddc);
313 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_sound_directory, Edje_Sound_Directory, "samples", samples, _edje_edd_edje_sound_sample);
314 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_sound_directory, Edje_Sound_Directory, "tones", tones, _edje_edd_edje_sound_tone);
315
316 /* collection directory */
317 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Collection_Directory_Entry);
318 _edje_edd_edje_part_collection_directory_entry =
319 eet_data_descriptor_file_new(&eddc);
320 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "entry", entry, EET_T_STRING);
321 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "id", id, EET_T_INT);
322 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "count.RECTANGLE", count.RECTANGLE, EET_T_INT);
323 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "count.TEXT", count.TEXT, EET_T_INT);
324 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "count.IMAGE", count.IMAGE, EET_T_INT);
325 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "count.PROXY", count.PROXY, EET_T_INT);
326 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "count.SWALLOW", count.SWALLOW, EET_T_INT);
327 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "count.TEXTBLOCK", count.TEXTBLOCK, EET_T_INT);
328 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "count.GROUP", count.GROUP, EET_T_INT);
329 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "count.BOX", count.BOX, EET_T_INT);
330 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "count.TABLE", count.TABLE, EET_T_INT);
331 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "count.EXTERNAL", count.EXTERNAL, EET_T_INT);
332 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "count.part", count.part, EET_T_INT);
333
334 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Style_Tag);
335 _edje_edd_edje_style_tag =
336 eet_data_descriptor_file_new(&eddc);
337 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_style_tag, Edje_Style_Tag, "key", key, EET_T_STRING);
338 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_style_tag, Edje_Style_Tag, "value", value, EET_T_STRING);
339
340 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Style);
341 _edje_edd_edje_style =
342 eet_data_descriptor_file_new(&eddc);
343 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_style, Edje_Style, "name", name, EET_T_STRING);
344 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_style, Edje_Style, "tags", tags, _edje_edd_edje_style_tag);
345
346 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Color_Class);
347 _edje_edd_edje_color_class =
348 eet_data_descriptor_file_new(&eddc);
349 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "name", name, EET_T_STRING);
350 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "r", r, EET_T_UCHAR);
351 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "g", g, EET_T_UCHAR);
352 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "b", b, EET_T_UCHAR);
353 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "a", a, EET_T_UCHAR);
354 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "r2", r2, EET_T_UCHAR);
355 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "g2", g2, EET_T_UCHAR);
356 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "b2", b2, EET_T_UCHAR);
357 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "a2", a2, EET_T_UCHAR);
358 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "r3", r3, EET_T_UCHAR);
359 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "g3", g3, EET_T_UCHAR);
360 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "b3", b3, EET_T_UCHAR);
361 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "a3", a3, EET_T_UCHAR);
362
363 /* the main file directory */
364 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_File);
365 eddc.func.hash_add = (void * (*)(void *, const char *, void *)) _edje_eina_hash_add_alloc;
366 _edje_edd_edje_file = eet_data_descriptor_file_new(&eddc);
367 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_file, Edje_File, "compiler", compiler, EET_T_STRING);
368 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_file, Edje_File, "version", version, EET_T_INT);
369 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_file, Edje_File, "minor", minor, EET_T_INT);
370 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_file, Edje_File, "feature_ver", feature_ver, EET_T_INT);
371 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "external_dir", external_dir, _edje_edd_edje_external_directory);
372 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "image_dir", image_dir, _edje_edd_edje_image_directory);
373 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "sound_dir", sound_dir, _edje_edd_edje_sound_directory);
374 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_file, Edje_File, "styles", styles, _edje_edd_edje_style);
375 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_file, Edje_File, "color_classes", color_classes, _edje_edd_edje_color_class);
376 EET_DATA_DESCRIPTOR_ADD_HASH(_edje_edd_edje_file, Edje_File, "data", data, _edje_edd_edje_string);
377 EET_DATA_DESCRIPTOR_ADD_HASH(_edje_edd_edje_file, Edje_File, "fonts", fonts, _edje_edd_edje_font_directory_entry);
378 EET_DATA_DESCRIPTOR_ADD_HASH(_edje_edd_edje_file, Edje_File, "collection", collection, _edje_edd_edje_part_collection_directory_entry);
379
380 /* parts & limit & programs - loaded induvidually */
381 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Limit);
382 _edje_edd_edje_limit = eet_data_descriptor_file_new(&eddc);
383 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_limit, Edje_Limit, "name", name, EET_T_STRING);
384 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_limit, Edje_Limit, "value", value, EET_T_INT);
385
386 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Program_Target);
387 _edje_edd_edje_program_target =
388 eet_data_descriptor_file_new(&eddc);
389 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program_target, Edje_Program_Target, "id", id, EET_T_INT);
390
391 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Program_After);
392 _edje_edd_edje_program_after =
393 eet_data_descriptor_file_new(&eddc);
394 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program_after,
395 Edje_Program_After, "id", id, EET_T_INT);
396
397 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Program);
398 _edje_edd_edje_program =
399 eet_data_descriptor_file_new(&eddc);
400 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "id", id, EET_T_INT);
401 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "name", name, EET_T_STRING);
402 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "signal", signal, EET_T_STRING);
403 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "source", source, EET_T_STRING);
404 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "filter_part", filter.part, EET_T_STRING);
405 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "filter_state", filter.state, EET_T_STRING);
406 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "in.from", in.from, EET_T_DOUBLE);
407 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "in.range", in.range, EET_T_DOUBLE);
408 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "action", action, EET_T_INT);
409
410 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "sample_name", sample_name, EET_T_STRING);
411 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "tone_name", tone_name, EET_T_STRING);
412 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program ,"duration", duration, EET_T_DOUBLE);
413 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program ,"speed", speed, EET_T_DOUBLE);
414 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "state", state, EET_T_STRING);
415 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "state2", state2, EET_T_STRING);
416 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "value", value, EET_T_DOUBLE);
417 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "value2", value2, EET_T_DOUBLE);
418 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "tween.mode", tween.mode, EET_T_INT);
419 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "tween.time", tween.time, EDJE_T_FLOAT);
420 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "v1", tween.v1, EDJE_T_FLOAT);
421 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "v2", tween.v2, EDJE_T_FLOAT);
422 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_program, Edje_Program, "targets", targets, _edje_edd_edje_program_target);
423 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_program, Edje_Program, "after", after, _edje_edd_edje_program_after);
424 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "api.name", api.name, EET_T_STRING);
425 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "api.description", api.description, EET_T_STRING);
426
427 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "param.src", param.src, EET_T_INT);
428 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "param.dst", param.dst, EET_T_INT);
429
430 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Image_Id);
431 _edje_edd_edje_part_image_id =
432 eet_data_descriptor_file_new(&eddc);
433 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_image_id, Edje_Part_Image_Id, "id", id, EET_T_INT);
434 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_image_id, Edje_Part_Image_Id, "set", set, EET_T_UCHAR);
435
436 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_External_Param);
437 _edje_edd_edje_external_param =
438 eet_data_descriptor_file_new(&eddc);
439 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_external_param, Edje_External_Param, "name", name, EET_T_STRING);
440 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_external_param, Edje_External_Param, "type", type, EET_T_INT);
441 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_external_param, Edje_External_Param, "i", i, EET_T_INT);
442 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_external_param, Edje_External_Param, "d", d, EET_T_DOUBLE);
443 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_external_param, Edje_External_Param, "s", s, EET_T_STRING);
444
445#define EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON(Edd, Type) \
446 { \
447 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "state.name", state.name, EET_T_STRING); \
448 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "state.value", state.value, EET_T_DOUBLE); \
449 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "visible", visible, EET_T_CHAR); \
450 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "align.x", align.x, EDJE_T_FLOAT); \
451 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "align.y", align.y, EDJE_T_FLOAT); \
452 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "fixed.w", fixed.w, EET_T_UCHAR); \
453 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "fixed.h", fixed.h, EET_T_UCHAR); \
454 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "min.w", min.w, EET_T_INT); \
455 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "min.h", min.h, EET_T_INT); \
456 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "max.w", max.w, EET_T_INT); \
457 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "max.h", max.h, EET_T_INT); \
458 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "step.x", step.x, EET_T_INT); \
459 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "step.y", step.y, EET_T_INT); \
460 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.min", aspect.min, EDJE_T_FLOAT); \
461 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.max", aspect.max, EDJE_T_FLOAT); \
462 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.prefer", aspect.prefer, EET_T_CHAR); \
463 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.relative_x", rel1.relative_x, EDJE_T_FLOAT); \
464 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.relative_y", rel1.relative_y, EDJE_T_FLOAT); \
465 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.offset_x", rel1.offset_x, EET_T_INT); \
466 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.offset_y", rel1.offset_y, EET_T_INT); \
467 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.id_x", rel1.id_x, EET_T_INT); \
468 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.id_y", rel1.id_y, EET_T_INT); \
469 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.relative_x", rel2.relative_x, EDJE_T_FLOAT); \
470 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.relative_y", rel2.relative_y, EDJE_T_FLOAT); \
471 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.offset_x", rel2.offset_x, EET_T_INT); \
472 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.offset_y", rel2.offset_y, EET_T_INT); \
473 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.id_x", rel2.id_x, EET_T_INT); \
474 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.id_y", rel2.id_y, EET_T_INT); \
475 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color_class", color_class, EET_T_STRING); \
476 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.r", color.r, EET_T_UCHAR); \
477 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.g", color.g, EET_T_UCHAR); \
478 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.b", color.b, EET_T_UCHAR); \
479 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.a", color.a, EET_T_UCHAR); \
480 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.r", color2.r, EET_T_UCHAR); \
481 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.g", color2.g, EET_T_UCHAR); \
482 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.b", color2.b, EET_T_UCHAR); \
483 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.a", color2.a, EET_T_UCHAR); \
484 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.id_persp", map.id_persp, EET_T_INT); \
485 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.id_light", map.id_light, EET_T_INT); \
486 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.id_center", map.rot.id_center, EET_T_INT); \
487 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.x", map.rot.x, EDJE_T_FLOAT); \
488 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.y", map.rot.y, EDJE_T_FLOAT); \
489 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.z", map.rot.z, EDJE_T_FLOAT); \
490 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.on", map.on, EET_T_UCHAR); \
491 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.smooth", map.smooth, EET_T_UCHAR); \
492 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.alpha", map.alpha, EET_T_UCHAR); \
493 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.persp_on", map.persp_on, EET_T_UCHAR); \
494 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.backcull", map.backcull, EET_T_UCHAR); \
495 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "persp.zplane", persp.zplane, EET_T_INT); \
496 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "persp.focal", persp.focal, EET_T_INT); \
497 }
498
499#define EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB(Edd, Type, Dec) \
500 { \
501 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "state.name", Dec.state.name, EET_T_STRING); \
502 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "state.value", Dec.state.value, EET_T_DOUBLE); \
503 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "visible", Dec.visible, EET_T_CHAR); \
504 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "align.x", Dec.align.x, EDJE_T_FLOAT); \
505 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "align.y", Dec.align.y, EDJE_T_FLOAT); \
506 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "fixed.w", Dec.fixed.w, EET_T_UCHAR); \
507 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "fixed.h", Dec.fixed.h, EET_T_UCHAR); \
508 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "min.w", Dec.min.w, EET_T_INT); \
509 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "min.h", Dec.min.h, EET_T_INT); \
510 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "max.w", Dec.max.w, EET_T_INT); \
511 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "max.h", Dec.max.h, EET_T_INT); \
512 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "step.x", Dec.step.x, EET_T_INT); \
513 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "step.y", Dec.step.y, EET_T_INT); \
514 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.min", Dec.aspect.min, EDJE_T_FLOAT); \
515 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.max", Dec.aspect.max, EDJE_T_FLOAT); \
516 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.prefer", Dec.aspect.prefer, EET_T_CHAR); \
517 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.relative_x", Dec.rel1.relative_x, EDJE_T_FLOAT); \
518 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.relative_y", Dec.rel1.relative_y, EDJE_T_FLOAT); \
519 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.offset_x", Dec.rel1.offset_x, EET_T_INT); \
520 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.offset_y", Dec.rel1.offset_y, EET_T_INT); \
521 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.id_x", Dec.rel1.id_x, EET_T_INT); \
522 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.id_y", Dec.rel1.id_y, EET_T_INT); \
523 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.relative_x", Dec.rel2.relative_x, EDJE_T_FLOAT); \
524 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.relative_y", Dec.rel2.relative_y, EDJE_T_FLOAT); \
525 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.offset_x", Dec.rel2.offset_x, EET_T_INT); \
526 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.offset_y", Dec.rel2.offset_y, EET_T_INT); \
527 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.id_x", Dec.rel2.id_x, EET_T_INT); \
528 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.id_y", Dec.rel2.id_y, EET_T_INT); \
529 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color_class", Dec.color_class, EET_T_STRING); \
530 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.r", Dec.color.r, EET_T_UCHAR); \
531 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.g", Dec.color.g, EET_T_UCHAR); \
532 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.b", Dec.color.b, EET_T_UCHAR); \
533 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.a", Dec.color.a, EET_T_UCHAR); \
534 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.r", Dec.color2.r, EET_T_UCHAR); \
535 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.g", Dec.color2.g, EET_T_UCHAR); \
536 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.b", Dec.color2.b, EET_T_UCHAR); \
537 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.a", Dec.color2.a, EET_T_UCHAR); \
538 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.id_persp", Dec.map.id_persp, EET_T_INT); \
539 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.id_light", Dec.map.id_light, EET_T_INT); \
540 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.id_center", Dec.map.rot.id_center, EET_T_INT); \
541 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.x", Dec.map.rot.x, EDJE_T_FLOAT); \
542 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.y", Dec.map.rot.y, EDJE_T_FLOAT); \
543 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.z", Dec.map.rot.z, EDJE_T_FLOAT); \
544 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.on", Dec.map.on, EET_T_UCHAR); \
545 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.smooth", Dec.map.smooth, EET_T_UCHAR); \
546 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.alpha", Dec.map.alpha, EET_T_UCHAR); \
547 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.persp_on", Dec.map.persp_on, EET_T_UCHAR); \
548 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.backcull", Dec.map.backcull, EET_T_UCHAR); \
549 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "persp.zplane", Dec.persp.zplane, EET_T_INT); \
550 EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "persp.focal", Dec.persp.focal, EET_T_INT); \
551 }
552
553 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Common);
554 eddc.func.mem_free = mem_free_rectangle;
555 eddc.func.mem_alloc = mem_alloc_rectangle;
556 _edje_edd_edje_part_description_rectangle =
557 eet_data_descriptor_file_new(&eddc);
558 EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON(_edje_edd_edje_part_description_rectangle, Edje_Part_Description_Common);
559
560 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Common);
561 eddc.func.mem_free = mem_free_swallow;
562 eddc.func.mem_alloc = mem_alloc_swallow;
563 _edje_edd_edje_part_description_swallow =
564 eet_data_descriptor_file_new(&eddc);
565 EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON(_edje_edd_edje_part_description_swallow, Edje_Part_Description_Common);
566
567 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Common);
568 eddc.func.mem_free = mem_free_group;
569 eddc.func.mem_alloc = mem_alloc_group;
570 _edje_edd_edje_part_description_group =
571 eet_data_descriptor_file_new(&eddc);
572 EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON(_edje_edd_edje_part_description_group, Edje_Part_Description_Common);
573
574 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Image);
575 eddc.func.mem_free = mem_free_image;
576 eddc.func.mem_alloc = mem_alloc_image;
577 _edje_edd_edje_part_description_image =
578 eet_data_descriptor_file_new(&eddc);
579 EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, common);
580
581 EDJE_DEFINE_POINTER_TYPE(Part_Image_Id, part_image_id);
582 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.tweens", image.tweens, _edje_edd_edje_part_image_id_pointer);
583
584 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.id", image.id, EET_T_INT);
585 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.set", image.set, EET_T_UCHAR);
586 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.border.l", image.border.l, EET_T_INT);
587 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.border.r", image.border.r, EET_T_INT);
588 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.border.t", image.border.t, EET_T_INT);
589 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.border.b", image.border.b, EET_T_INT);
590 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.border.no_fill", image.border.no_fill, EET_T_UCHAR);
591 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.border.scale", image.border.scale, EET_T_UCHAR);
592 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.border.scale_by", image.border.scale_by, EDJE_T_FLOAT);
593 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.smooth", image.fill.smooth, EET_T_CHAR);
594 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.pos_rel_x", image.fill.pos_rel_x, EDJE_T_FLOAT);
595 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.pos_abs_x", image.fill.pos_abs_x, EET_T_INT);
596 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.rel_x", image.fill.rel_x, EDJE_T_FLOAT);
597 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.abs_x", image.fill.abs_x, EET_T_INT);
598 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.pos_rel_y", image.fill.pos_rel_y, EDJE_T_FLOAT);
599 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.pos_abs_y", image.fill.pos_abs_y, EET_T_INT);
600 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.rel_y", image.fill.rel_y, EDJE_T_FLOAT);
601 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.abs_y", image.fill.abs_y, EET_T_INT);
602 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.angle", image.fill.angle, EET_T_INT);
603 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.spread", image.fill.spread, EET_T_INT);
604 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.type", image.fill.type, EET_T_CHAR);
605
606 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Proxy);
607 eddc.func.mem_free = mem_free_proxy;
608 eddc.func.mem_alloc = mem_alloc_proxy;
609 _edje_edd_edje_part_description_proxy =
610 eet_data_descriptor_file_new(&eddc);
611 EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB(_edje_edd_edje_part_description_proxy, Edje_Part_Description_Proxy, common);
612
613 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_proxy, Edje_Part_Description_Proxy, "proxy.id", proxy.id, EET_T_INT);
614 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_proxy, Edje_Part_Description_Proxy, "proxy.fill.smooth", proxy.fill.smooth, EET_T_CHAR);
615 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_proxy, Edje_Part_Description_Proxy, "proxy.fill.pos_rel_x", proxy.fill.pos_rel_x, EDJE_T_FLOAT);
616 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_proxy, Edje_Part_Description_Proxy, "proxy.fill.pos_abs_x", proxy.fill.pos_abs_x, EET_T_INT);
617 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_proxy, Edje_Part_Description_Proxy, "proxy.fill.rel_x", proxy.fill.rel_x, EDJE_T_FLOAT);
618 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_proxy, Edje_Part_Description_Proxy, "proxy.fill.abs_x", proxy.fill.abs_x, EET_T_INT);
619 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_proxy, Edje_Part_Description_Proxy, "proxy.fill.pos_rel_y", proxy.fill.pos_rel_y, EDJE_T_FLOAT);
620 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_proxy, Edje_Part_Description_Proxy, "proxy.fill.pos_abs_y", proxy.fill.pos_abs_y, EET_T_INT);
621 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_proxy, Edje_Part_Description_Proxy, "proxy.fill.rel_y", proxy.fill.rel_y, EDJE_T_FLOAT);
622 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_proxy, Edje_Part_Description_Proxy, "proxy.fill.abs_y", proxy.fill.abs_y, EET_T_INT);
623 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_proxy, Edje_Part_Description_Proxy, "proxy.fill.angle", proxy.fill.angle, EET_T_INT);
624 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_proxy, Edje_Part_Description_Proxy, "proxy.fill.spread", proxy.fill.spread, EET_T_INT);
625 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_proxy, Edje_Part_Description_Proxy, "proxy.fill.type", proxy.fill.type, EET_T_CHAR);
626
627 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Text);
628 eddc.func.mem_free = mem_free_text;
629 eddc.func.mem_alloc = mem_alloc_text;
630 _edje_edd_edje_part_description_text =
631 eet_data_descriptor_file_new(&eddc);
632 EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, common);
633 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.color3.r", text.color3.r, EET_T_UCHAR);
634 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.color3.g", text.color3.g, EET_T_UCHAR);
635 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.color3.b", text.color3.b, EET_T_UCHAR);
636 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.color3.a", text.color3.a, EET_T_UCHAR);
637 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.text", text.text, EET_T_STRING);
638 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.text_class", text.text_class, EET_T_STRING);
639 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.style", text.style, EET_T_STRING);
640 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.font", text.font, EET_T_STRING);
641 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.size_range_min", text.size_range_min, EET_T_INT);
642 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.size_range_max", text.size_range_max, EET_T_INT);
643 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.repch", text.repch, EET_T_STRING);
644 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.size", text.size, EET_T_INT);
645 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.fit_x", text.fit_x, EET_T_UCHAR);
646 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.fit_y", text.fit_y, EET_T_UCHAR);
647 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.min_x", text.min_x, EET_T_UCHAR);
648 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.min_y", text.min_y, EET_T_UCHAR);
649 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.max_x", text.max_x, EET_T_UCHAR);
650 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.max_y", text.max_y, EET_T_UCHAR);
651 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.align.x", text.align.x, EDJE_T_FLOAT);
652 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.align.y", text.align.y, EDJE_T_FLOAT);
653 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.id_source", text.id_source, EET_T_INT);
654 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.id_text_source", text.id_text_source, EET_T_INT);
655 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.elipsis", text.elipsis, EET_T_DOUBLE);
656
657 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Text);
658 eddc.func.mem_free = mem_free_textblock;
659 eddc.func.mem_alloc = mem_alloc_textblock;
660 _edje_edd_edje_part_description_textblock =
661 eet_data_descriptor_file_new(&eddc);
662 EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, common);
663 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.color3.r", text.color3.r, EET_T_UCHAR);
664 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.color3.g", text.color3.g, EET_T_UCHAR);
665 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.color3.b", text.color3.b, EET_T_UCHAR);
666 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.color3.a", text.color3.a, EET_T_UCHAR);
667 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.text", text.text, EET_T_STRING);
668 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.text_class", text.text_class, EET_T_STRING);
669 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.style", text.style, EET_T_STRING);
670 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.font", text.font, EET_T_STRING);
671 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.repch", text.repch, EET_T_STRING);
672 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.size", text.size, EET_T_INT);
673 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.size_range_min", text.size_range_min, EET_T_INT);
674 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.size_range_max", text.size_range_max, EET_T_INT);
675 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.fit_x", text.fit_x, EET_T_UCHAR);
676 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.fit_y", text.fit_y, EET_T_UCHAR);
677 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.min_x", text.min_x, EET_T_UCHAR);
678 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.min_y", text.min_y, EET_T_UCHAR);
679 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.max_x", text.max_x, EET_T_UCHAR);
680 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.max_y", text.max_y, EET_T_UCHAR);
681 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.align.x", text.align.x, EDJE_T_FLOAT);
682 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.align.y", text.align.y, EDJE_T_FLOAT);
683 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.id_source", text.id_source, EET_T_INT);
684 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.id_text_source", text.id_text_source, EET_T_INT);
685 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.elipsis", text.elipsis, EET_T_DOUBLE);
686
687 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Box);
688 eddc.func.mem_free = mem_free_box;
689 eddc.func.mem_alloc = mem_alloc_box;
690 _edje_edd_edje_part_description_box =
691 eet_data_descriptor_file_new(&eddc);
692 EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB(_edje_edd_edje_part_description_box, Edje_Part_Description_Box, common);
693 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_box, Edje_Part_Description_Box, "box.layout", box.layout, EET_T_STRING);
694 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_box, Edje_Part_Description_Box, "box.alt_layout", box.alt_layout, EET_T_STRING);
695 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_box, Edje_Part_Description_Box, "box.align.x", box.align.x, EDJE_T_FLOAT);
696 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_box, Edje_Part_Description_Box, "box.align.y", box.align.y, EDJE_T_FLOAT);
697 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_box, Edje_Part_Description_Box, "box.padding.x", box.padding.x, EET_T_INT);
698 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_box, Edje_Part_Description_Box, "box.padding.y", box.padding.y, EET_T_INT);
699 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_box, Edje_Part_Description_Box, "box.min.h", box.min.h, EET_T_UCHAR);
700 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_box, Edje_Part_Description_Box, "box.min.v", box.min.v, EET_T_UCHAR);
701
702 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Table);
703 eddc.func.mem_free = mem_free_table;
704 eddc.func.mem_alloc = mem_alloc_table;
705 _edje_edd_edje_part_description_table =
706 eet_data_descriptor_file_new(&eddc);
707 EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, common);
708 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, "table.homogeneous", table.homogeneous, EET_T_UCHAR);
709 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, "table.align.x", table.align.x, EDJE_T_FLOAT);
710 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, "table.align.y", table.align.y, EDJE_T_FLOAT);
711 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, "table.padding.x", table.padding.x, EET_T_INT);
712 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, "table.padding.y", table.padding.y, EET_T_INT);
713 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, "table.min.h", table.min.h, EET_T_UCHAR);
714 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, "table.min.v", table.min.v, EET_T_UCHAR);
715
716 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_External);
717 eddc.func.mem_free = mem_free_external;
718 eddc.func.mem_alloc = mem_alloc_external;
719 _edje_edd_edje_part_description_external =
720 eet_data_descriptor_file_new(&eddc);
721 EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB(_edje_edd_edje_part_description_external, Edje_Part_Description_External, common);
722 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_part_description_external, Edje_Part_Description_External, "external_params", external_params, _edje_edd_edje_external_param);
723
724 EDJE_DEFINE_POINTER_TYPE(Part_Description_Common, part_description_rectangle);
725 EDJE_DEFINE_POINTER_TYPE(Part_Description_Common, part_description_swallow);
726 EDJE_DEFINE_POINTER_TYPE(Part_Description_Common, part_description_group);
727 EDJE_DEFINE_POINTER_TYPE(Part_Description_Image, part_description_image);
728 EDJE_DEFINE_POINTER_TYPE(Part_Description_Proxy, part_description_proxy);
729 EDJE_DEFINE_POINTER_TYPE(Part_Description_Text, part_description_text);
730 EDJE_DEFINE_POINTER_TYPE(Part_Description_Text, part_description_textblock);
731 EDJE_DEFINE_POINTER_TYPE(Part_Description_Box, part_description_box);
732 EDJE_DEFINE_POINTER_TYPE(Part_Description_Table, part_description_table);
733 EDJE_DEFINE_POINTER_TYPE(Part_Description_External, part_description_external);
734
735 eddc.version = EET_DATA_DESCRIPTOR_CLASS_VERSION;
736 eddc.func.type_get = _edje_description_variant_type_get;
737 eddc.func.type_set = _edje_description_variant_type_set;
738 _edje_edd_edje_part_description_variant = eet_data_descriptor_file_new(&eddc);
739
740 EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "rectangle", _edje_edd_edje_part_description_rectangle);
741 EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "swallow", _edje_edd_edje_part_description_swallow);
742 EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "group", _edje_edd_edje_part_description_group);
743 EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "image", _edje_edd_edje_part_description_image);
744 EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "proxy", _edje_edd_edje_part_description_proxy);
745 EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "text", _edje_edd_edje_part_description_text);
746 EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "textblock", _edje_edd_edje_part_description_textblock);
747 EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "box", _edje_edd_edje_part_description_box);
748 EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "table", _edje_edd_edje_part_description_table);
749 EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "external", _edje_edd_edje_part_description_external);
750
751#define EDJE_ADD_ARRAY_MAPPING(Variant, Type, Minus) \
752 { \
753 Edje_Part_Description_List tmp; \
754 \
755 eet_data_descriptor_element_add(Variant, Type, \
756 EET_T_UNKNOW, EET_G_VAR_ARRAY, \
757 0, (char*)(&tmp.desc_count) - (char*)(&tmp), \
758 NULL, \
759 _edje_edd_edje_part_description_##Minus##_pointer); \
760 }
761
762 _edje_edd_edje_part_description_variant_list = eet_data_descriptor_file_new(&eddc);
763
764 EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "rectangle", rectangle);
765 EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "swallow", swallow);
766 EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "group", group);
767 EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "image", image);
768 EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "proxy", proxy);
769 EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "text", text);
770 EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "textblock", textblock);
771 EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "box", box);
772 EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "table", table);
773 EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "external", external);
774
775 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Pack_Element);
776 _edje_edd_edje_pack_element =
777 eet_data_descriptor_file_new(&eddc);
778 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "type", type, EET_T_UCHAR);
779 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "name", name, EET_T_STRING);
780 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "source", source, EET_T_STRING);
781 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "min.w", min.w, EET_T_INT);
782 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "min.h", min.h, EET_T_INT);
783 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "prefer.w", prefer.w, EET_T_INT);
784 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "prefer.h", prefer.h, EET_T_INT);
785 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "max.w", max.w, EET_T_INT);
786 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "max.h", max.h, EET_T_INT);
787 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "padding.l", padding.l, EET_T_INT);
788 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "padding.r", padding.r, EET_T_INT);
789 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "padding.t", padding.t, EET_T_INT);
790 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "padding.b", padding.b, EET_T_INT);
791 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "align.x", align.x, EDJE_T_FLOAT);
792 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "align.y", align.y, EDJE_T_FLOAT);
793 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "weight.x", weight.x, EDJE_T_FLOAT);
794 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "weight.y", weight.y, EDJE_T_FLOAT);
795 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "aspect.w", aspect.w, EET_T_INT);
796 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "aspect.h", aspect.h, EET_T_INT);
797 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "aspect.mode", aspect.mode, EET_T_UCHAR);
798 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "options", options, EET_T_STRING);
799 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "col", col, EET_T_INT);
800 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "row", row, EET_T_INT);
801 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "colspan", colspan, EET_T_USHORT);
802 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "rowspan", rowspan, EET_T_USHORT);
803
804 EDJE_DEFINE_POINTER_TYPE(Pack_Element, pack_element);
805
806 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part);
807 eddc.func.mem_free = mem_free_part;
808 eddc.func.mem_alloc = mem_alloc_part;
809 _edje_edd_edje_part =
810 eet_data_descriptor_file_new(&eddc);
811 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "name", name, EET_T_STRING);
812 EET_DATA_DESCRIPTOR_ADD_VARIANT(_edje_edd_edje_part, Edje_Part, "default_desc", default_desc, type, _edje_edd_edje_part_description_variant);
813 EET_DATA_DESCRIPTOR_ADD_VARIANT(_edje_edd_edje_part, Edje_Part, "other", other, type, _edje_edd_edje_part_description_variant_list);
814 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source", source, EET_T_STRING);
815 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source2", source2, EET_T_STRING);
816 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source3", source3, EET_T_STRING);
817 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source4", source4, EET_T_STRING);
818 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source5", source5, EET_T_STRING);
819 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source6", source6, EET_T_STRING);
820 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "id", id, EET_T_INT);
821 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "clip_to_id", clip_to_id, EET_T_INT);
822 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.x", dragable.x, EET_T_CHAR);
823 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.step_x", dragable.step_x, EET_T_INT);
824 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.count_x", dragable.count_x, EET_T_INT);
825 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.y", dragable.y, EET_T_CHAR);
826 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.step_y", dragable.step_y, EET_T_INT);
827 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.count_y", dragable.count_y, EET_T_INT);
828 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.counfine_id", dragable.confine_id, EET_T_INT);
829 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.events_id", dragable.event_id, EET_T_INT);
830 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part, Edje_Part, "items", items, _edje_edd_edje_pack_element_pointer);
831 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "type", type, EET_T_UCHAR);
832 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "effect", effect, EET_T_UCHAR);
833 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "mouse_events", mouse_events, EET_T_UCHAR);
834 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "repeat_events", repeat_events, EET_T_UCHAR);
835 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "ignore_flags", ignore_flags, EET_T_INT);
836 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "scale", scale, EET_T_UCHAR);
837 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "precise_is_inside", precise_is_inside, EET_T_UCHAR);
838 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "use_alternate_font_metrics", use_alternate_font_metrics, EET_T_UCHAR);
839 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "pointer_mode", pointer_mode, EET_T_UCHAR);
840 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "entry_mode", entry_mode, EET_T_UCHAR);
841 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "select_mode", select_mode, EET_T_UCHAR);
842 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "cursor_mode", cursor_mode, EET_T_UCHAR);
843 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "multiline", multiline, EET_T_UCHAR);
844 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "api.name", api.name, EET_T_STRING);
845 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "api.description", api.description, EET_T_STRING);
846
847 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Collection);
848 _edje_edd_edje_part_collection =
849 eet_data_descriptor_file_new(&eddc);
850
851 EDJE_DEFINE_POINTER_TYPE(Program, program);
852 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part_collection, Edje_Part_Collection, "programs.fnmatch", programs.fnmatch, _edje_edd_edje_program_pointer);
853 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part_collection, Edje_Part_Collection, "programs.strcmp", programs.strcmp, _edje_edd_edje_program_pointer);
854 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part_collection, Edje_Part_Collection, "programs.strncmp", programs.strncmp, _edje_edd_edje_program_pointer);
855 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part_collection, Edje_Part_Collection, "programs.strrncmp", programs.strrncmp, _edje_edd_edje_program_pointer);
856 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part_collection, Edje_Part_Collection, "programs.nocmp", programs.nocmp, _edje_edd_edje_program_pointer);
857
858 EDJE_DEFINE_POINTER_TYPE(Part, part);
859 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part_collection, Edje_Part_Collection, "parts", parts, _edje_edd_edje_part_pointer);
860
861 EDJE_DEFINE_POINTER_TYPE(Limit, limit);
862 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part_collection, Edje_Part_Collection, "limits.vertical", limits.vertical, _edje_edd_edje_limit_pointer);
863 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part_collection, Edje_Part_Collection, "limits.horizontal", limits.horizontal, _edje_edd_edje_limit_pointer);
864
865 EET_DATA_DESCRIPTOR_ADD_HASH(_edje_edd_edje_part_collection, Edje_Part_Collection, "data", data, _edje_edd_edje_string);
866 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "id", id, EET_T_INT);
867 EET_DATA_DESCRIPTOR_ADD_HASH_STRING(_edje_edd_edje_part_collection, Edje_Part_Collection, "alias", alias);
868 EET_DATA_DESCRIPTOR_ADD_HASH_STRING(_edje_edd_edje_part_collection, Edje_Part_Collection, "aliased", aliased);
869 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "prop.min.w", prop.min.w, EET_T_INT);
870 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "prop.min.h", prop.min.h, EET_T_INT);
871 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "prop.max.w", prop.max.w, EET_T_INT);
872 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "prop.max.h", prop.max.h, EET_T_INT);
873 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "part", part, EET_T_STRING);
874 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "script_only", script_only, EET_T_UCHAR);
875 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "lua_script_only", lua_script_only, EET_T_UCHAR);
876 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "prop.orientation", prop.orientation, EET_T_INT);
877}
diff --git a/libraries/edje/src/lib/edje_edit.c b/libraries/edje/src/lib/edje_edit.c
new file mode 100644
index 0000000..901a1b1
--- /dev/null
+++ b/libraries/edje/src/lib/edje_edit.c
@@ -0,0 +1,7829 @@
1/*
2 * TODO
3 * -----------------------------------------------------------------
4 * Add LUA Support :)
5 * Remove images/fonts
6 * Clean the saving routines
7 *
8 */
9
10#include "edje_private.h"
11
12#define EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT
13#include "Edje_Edit.h"
14
15static const char EDJE_EDIT_ERROR_GROUP_CURRENTLY_USED_STR[] = "Current group cannot be deleted";
16static const char EDJE_EDIT_ERROR_GROUP_REFERENCED_STR[] = "Group still in use";
17static const char EDJE_EDIT_ERROR_GROUP_DOES_NOT_EXIST_STR[] = "Group does not exist";
18
19EAPI Eina_Error EDJE_EDIT_ERROR_GROUP_CURRENTLY_USED = 0 ;
20EAPI Eina_Error EDJE_EDIT_ERROR_GROUP_REFERENCED = 0;
21EAPI Eina_Error EDJE_EDIT_ERROR_GROUP_DOES_NOT_EXIST = 0;
22
23/* Get ed(Edje*) from obj(Evas_Object*) */
24#define GET_ED_OR_RETURN(RET) \
25 Edje *ed; \
26 Edje_Edit *eed; \
27 if (!evas_object_smart_type_check_ptr(obj, _edje_edit_type)) \
28 return RET; \
29 eed = evas_object_smart_data_get(obj); \
30 if (!eed) return RET; \
31 ed = (Edje *)eed;
32
33/* Get rp(Edje_Real_Part*) from obj(Evas_Object*) and part(char*) */
34#define GET_RP_OR_RETURN(RET) \
35 Edje *ed; \
36 Edje_Edit *eed; \
37 Edje_Real_Part *rp; \
38 if (!evas_object_smart_type_check_ptr(obj, _edje_edit_type)) \
39 return RET; \
40 eed = evas_object_smart_data_get(obj); \
41 if (!eed) return RET; \
42 ed = (Edje *)eed; \
43 rp = _edje_real_part_get(ed, part); \
44 if (!rp) return RET;
45
46/* Get pd(Edje_Part_Description*) from obj(Evas_Object*), part(char*) and state (char*) */
47#define GET_PD_OR_RETURN(RET) \
48 Edje *ed; \
49 Edje_Edit *eed; \
50 Edje_Real_Part *rp; \
51 Edje_Part_Description_Common *pd; \
52 if (!evas_object_smart_type_check_ptr(obj, _edje_edit_type)) \
53 return RET; \
54 eed = evas_object_smart_data_get(obj); \
55 if (!eed) return RET; \
56 ed = (Edje *)eed; \
57 rp = _edje_real_part_get(ed, part); \
58 if (!rp) return RET; \
59 pd = _edje_part_description_find_byname(eed, part, state, value); \
60 if (!pd) return RET;
61
62/* Get epr(Edje_Program*) from obj(Evas_Object*) and prog(char*)*/
63#define GET_EPR_OR_RETURN(RET) \
64 Edje_Program *epr; \
65 if (!evas_object_smart_type_check_ptr(obj, _edje_edit_type)) \
66 return RET; \
67 epr = _edje_program_get_byname(obj, prog); \
68 if (!epr) return RET;
69
70static void *
71_alloc(size_t size)
72{
73 void *mem;
74
75 mem = calloc(1, size);
76 if (mem) return mem;
77 ERR("Edje_Edit: Error. memory allocation of %i bytes failed. %s",
78 (int)size, strerror(errno));
79 return NULL;
80}
81
82/*************/
83/* INTERNALS */
84/*************/
85
86/* Edje_Edit smart! Overloads the edje one adding some more control stuff */
87static const char _edje_edit_type[] = "edje_edit";
88
89typedef struct _Edje_Edit Edje_Edit;
90struct _Edje_Edit
91{
92 Edje base;
93
94 void *bytecode;
95 int bytecode_size;
96
97 char *embryo_source;
98 char *embryo_processed;
99 Eina_Hash *program_scripts;
100
101 Eina_List *errors;
102
103 Eina_Bool bytecode_dirty:1;
104 Eina_Bool embryo_source_dirty:1;
105 Eina_Bool all_dirty:1;
106 Eina_Bool script_need_recompile:1;
107};
108
109typedef struct _Program_Script Program_Script;
110struct _Program_Script
111{
112 int id;
113 char *code;
114 char *processed;
115 Eina_Bool dirty:1;
116 Eina_Bool delete_me:1;
117};
118
119static void _edje_edit_smart_add(Evas_Object *obj);
120static void _edje_edit_smart_del(Evas_Object *obj);
121
122static Eina_Bool _edje_edit_smart_file_set(Evas_Object *obj, const char *file, const char *group);
123static Eina_Bool _edje_edit_edje_file_save(Eet_File *eetf, Edje_File *ef);
124
125EVAS_SMART_SUBCLASS_NEW(_edje_edit_type, _edje_edit, Edje_Smart_Api,
126 Edje_Smart_Api, _edje_object_smart_class_get, NULL)
127
128static void
129_edje_edit_smart_set_user(Edje_Smart_Api *sc)
130{
131 sc->base.add = _edje_edit_smart_add;
132 sc->base.del = _edje_edit_smart_del;
133 sc->file_set = _edje_edit_smart_file_set;
134}
135
136static void
137_edje_edit_smart_add(Evas_Object *obj)
138{
139 Edje_Edit *eed;
140
141 eed = evas_object_smart_data_get(obj);
142 if (!eed)
143 {
144 const Evas_Smart *smart;
145 const Evas_Smart_Class *sc;
146
147 eed = calloc(1, sizeof(Edje_Edit));
148 if (!eed) return;
149
150 smart = evas_object_smart_smart_get(obj);
151 sc = evas_smart_class_get(smart);
152 eed->base.api = (const Edje_Smart_Api *)sc;
153
154 evas_object_smart_data_set(obj, eed);
155 }
156
157 _edje_edit_parent_sc->base.add(obj);
158}
159
160static void
161_edje_edit_data_clean(Edje_Edit *eed)
162{
163 Edje_Edit_Script_Error *se;
164
165 free(eed->bytecode);
166 free(eed->embryo_source);
167 free(eed->embryo_processed);
168
169 if (eed->program_scripts)
170 eina_hash_free(eed->program_scripts);
171
172 EINA_LIST_FREE(eed->errors, se)
173 {
174 eina_stringshare_del(se->program_name);
175 eina_stringshare_del(se->error_str);
176 free(se);
177 }
178
179 eed->bytecode = NULL;
180 eed->embryo_source = NULL;
181 eed->embryo_processed = NULL;
182 eed->program_scripts = NULL;
183 eed->bytecode_size = 0;
184 eed->bytecode_dirty = EINA_FALSE;
185 eed->embryo_source_dirty = EINA_FALSE;
186 eed->all_dirty = EINA_FALSE;
187 eed->script_need_recompile = EINA_FALSE;
188}
189
190static void
191_edje_edit_smart_del(Evas_Object *obj)
192{
193 Edje_Edit *eed;
194
195 eed = evas_object_smart_data_get(obj);
196
197 _edje_edit_data_clean(eed);
198
199 _edje_edit_parent_sc->base.del(obj);
200}
201
202static void
203_edje_edit_program_script_free(Program_Script *ps)
204{
205 free(ps->code);
206 free(ps->processed);
207 free(ps);
208}
209
210static Eina_Bool
211_edje_edit_smart_file_set(Evas_Object *obj, const char *file, const char *group)
212{
213 Edje_Edit *eed;
214 Eet_File *ef;
215 char **keys, buf[64];
216 int count, i;
217 int len = strlen("edje/scripts/embryo/source/");
218
219 eed = evas_object_smart_data_get(obj);
220
221 _edje_edit_data_clean(eed);
222
223 /* TODO and maybes:
224 * * The whole point of this thing is keep track of stuff such as
225 * strings to free and who knows what, so we need to take care
226 * of those if the file/group changes.
227 * * Maybe have the possibility to open just files, not always with
228 * a group given.
229 * * A way to skip the cache? Could help avoid some issues when editing
230 * a group being used by the application in some other way, or multiple
231 * opens of the same file.
232 * * Here we probably want to allow opening groups with broken references
233 * (GROUP parts or BOX/TABLE items pointing to non-existent/renamed
234 * groups).
235 */
236 if (!_edje_edit_parent_sc->file_set(obj, file, group))
237 return EINA_FALSE;
238
239 eed->program_scripts = eina_hash_int32_new((Eina_Free_Cb)_edje_edit_program_script_free);
240
241 ef = eet_open(file, EET_FILE_MODE_READ);
242
243 snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%i",
244 eed->base.collection->id);
245 eed->embryo_source = eet_read(ef, buf, &count);
246
247 snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%i/*",
248 eed->base.collection->id);
249 keys = eet_list(ef, buf, &count);
250 for (i = 0; i < count; i++)
251 {
252 Program_Script *ps;
253 int size;
254
255 ps = calloc(1, sizeof(Program_Script));
256
257 sscanf(keys[i] + len, "%*i/%i", &ps->id);
258 ps->code = eet_read(ef, keys[i], &size);
259 eina_hash_add(eed->program_scripts, &ps->id, ps);
260 }
261 if (keys) free(keys);
262 return EINA_TRUE;
263}
264
265static void
266_edje_edit_error_register(void)
267{
268 EDJE_EDIT_ERROR_GROUP_DOES_NOT_EXIST =
269 eina_error_msg_static_register(EDJE_EDIT_ERROR_GROUP_DOES_NOT_EXIST_STR);
270 EDJE_EDIT_ERROR_GROUP_CURRENTLY_USED =
271 eina_error_msg_static_register(EDJE_EDIT_ERROR_GROUP_CURRENTLY_USED_STR);
272 EDJE_EDIT_ERROR_GROUP_REFERENCED =
273 eina_error_msg_static_register(EDJE_EDIT_ERROR_GROUP_REFERENCED_STR);
274}
275
276EAPI Evas_Object *
277edje_edit_object_add(Evas *e)
278{
279 eina_error_set(0);
280
281 if (!EDJE_EDIT_ERROR_GROUP_DOES_NOT_EXIST)
282 _edje_edit_error_register();
283
284 return evas_object_smart_add(e, _edje_edit_smart_class_new());
285}
286/* End of Edje_Edit smart stuff */
287
288static Edje_Part_Description_Common *
289_edje_part_description_find_byname(Edje_Edit *eed, const char *part, const char *state, double value)
290{
291 Edje_Real_Part *rp;
292 Edje_Part_Description_Common *pd;
293
294 if (!eed || !part || !state) return NULL;
295
296 rp = _edje_real_part_get((Edje *)eed, part);
297 if (!rp) return NULL;
298
299 pd = _edje_part_description_find((Edje *)eed, rp, state, value);
300
301 return pd;
302}
303
304static int
305_edje_image_id_find(Edje_Edit *eed, const char *image_name)
306{
307 unsigned int i;
308
309 if (!eed->base.file) return -1;
310 if (!eed->base.file->image_dir) return -1;
311
312 //printf("SEARCH IMAGE %s\n", image_name);
313
314 for (i = 0; i < eed->base.file->image_dir->entries_count; ++i)
315 if (eed->base.file->image_dir->entries[i].entry
316 && !strcmp(image_name, eed->base.file->image_dir->entries[i].entry))
317 return i;
318
319 return -1;
320}
321
322static const char *
323_edje_image_name_find(Edje_Edit *eed, int image_id)
324{
325 if (!eed->base.file) return NULL;
326 if (!eed->base.file->image_dir) return NULL;
327
328 /* Special case for external image */
329 if (image_id < 0) image_id = -image_id - 1;
330
331 //printf("SEARCH IMAGE ID %d\n", image_id);
332 if ((unsigned int) image_id >= eed->base.file->image_dir->entries_count)
333 return NULL;
334 return eed->base.file->image_dir->entries[image_id].entry;
335}
336
337static void
338_edje_real_part_free(Edje_Real_Part *rp)
339{
340 if (!rp) return;
341
342 if (rp->object)
343 {
344 _edje_callbacks_del(rp->object, rp->edje);
345 evas_object_del(rp->object);
346 }
347
348 if (rp->swallowed_object)
349 {
350 evas_object_smart_member_del(rp->swallowed_object);
351 evas_object_event_callback_del(rp->swallowed_object,
352 EVAS_CALLBACK_FREE,
353 _edje_object_part_swallow_free_cb);
354 evas_object_clip_unset(rp->swallowed_object);
355 evas_object_data_del(rp->swallowed_object, "\377 edje.swallowing_part");
356 if (rp->part->mouse_events)
357 _edje_callbacks_del(rp->swallowed_object, rp->edje);
358
359 if (rp->part->type == EDJE_PART_TYPE_GROUP ||
360 rp->part->type == EDJE_PART_TYPE_EXTERNAL)
361 evas_object_del(rp->swallowed_object);
362
363 rp->swallowed_object = NULL;
364 }
365
366 if (rp->text.text) eina_stringshare_del(rp->text.text);
367 if (rp->text.font) eina_stringshare_del(rp->text.font);
368 if (rp->text.cache.in_str) eina_stringshare_del(rp->text.cache.in_str);
369 if (rp->text.cache.out_str) eina_stringshare_del(rp->text.cache.out_str);
370
371 if (rp->custom)
372 {
373 _edje_collection_free_part_description_clean(rp->part->type, rp->custom->description, 0);
374 if (rp->custom) free(rp->custom->set);
375 eina_mempool_free(_edje_real_part_state_mp, rp->custom);
376 rp->custom = NULL;
377 }
378
379 free(rp->drag);
380
381 if (rp->param2) free(rp->param2->set);
382 eina_mempool_free(_edje_real_part_state_mp, rp->param2);
383
384 _edje_unref(rp->edje);
385 eina_mempool_free(_edje_real_part_mp, rp);
386}
387
388static Eina_Bool
389_edje_import_font_file(Edje *ed, const char *path, const char *entry)
390{
391 void *fdata = NULL;
392 long fsize = 0;
393
394 /* Read font data from file */
395 {
396 FILE *f = fopen(path, "rb");
397 if (!f)
398 {
399 ERR("Unable to open font file \"%s\"", path);
400 return EINA_FALSE;
401 }
402
403 fseek(f, 0, SEEK_END);
404 fsize = ftell(f);
405 rewind(f);
406 fdata = malloc(fsize);
407 if (!fdata)
408 {
409 ERR("Unable to alloc font file \"%s\"", path);
410 fclose(f);
411 return EINA_FALSE;
412 }
413 if (fread(fdata, fsize, 1, f) != 1)
414 {
415 free(fdata);
416 fclose(f);
417 ERR("Unable to read all of font file \"%s\"", path);
418 return EINA_FALSE;
419 }
420 fclose(f);
421 }
422
423 /* Write font to edje file */
424 {
425 /* open the eet file */
426 Eet_File *eetf = eet_open(ed->path, EET_FILE_MODE_READ_WRITE);
427 if (!eetf)
428 {
429 ERR("Unable to open \"%s\" for writing output", ed->path);
430 free(fdata);
431 return EINA_FALSE;
432 }
433
434 if (eet_write(eetf, entry, fdata, fsize, 1) <= 0)
435 {
436 ERR("Unable to write font part \"%s\" as \"%s\" part entry",
437 path, entry);
438 eet_close(eetf);
439 free(fdata);
440 return EINA_FALSE;
441 }
442
443 free(fdata);
444
445 /* write the edje_file */
446 if (!_edje_edit_edje_file_save(eetf, ed->file))
447 {
448 eet_delete(eetf, entry);
449 eet_close(eetf);
450 return EINA_FALSE;
451 }
452
453 eet_close(eetf);
454 }
455
456 return EINA_TRUE;
457}
458
459
460static Eina_Bool
461_edje_import_image_file(Edje *ed, const char *path, int id)
462{
463 char entry[PATH_MAX];
464 Evas_Object *im;
465 Eet_File *eetf;
466 void *im_data;
467 int im_w, im_h;
468 int im_alpha;
469 int bytes;
470
471 /* Try to load the file */
472 im = evas_object_image_add(ed->base.evas);
473 if (!im) return EINA_FALSE;
474
475 evas_object_image_file_set(im, path, NULL);
476 if (evas_object_image_load_error_get(im) != EVAS_LOAD_ERROR_NONE)
477 {
478 ERR("Edje_Edit: unable to load image \"%s\"."
479 "Missing PNG or JPEG loader modules for Evas or "
480 "file does not exist, or is not readable.", path);
481 evas_object_del(im);
482 im = NULL;
483 return EINA_FALSE;
484 }
485
486 /* Write the loaded image to the edje file */
487
488 evas_object_image_size_get(im, &im_w, &im_h);
489 im_alpha = evas_object_image_alpha_get(im);
490 im_data = evas_object_image_data_get(im, 0);
491 if ((!im_data) || !(im_w > 0) || !(im_h > 0))
492 {
493 evas_object_del(im);
494 return EINA_FALSE;
495 }
496
497 /* open the eet file */
498 eetf = eet_open(ed->path, EET_FILE_MODE_READ_WRITE);
499 if (!eetf)
500 {
501 ERR("Unable to open \"%s\" for writing output", ed->path);
502 evas_object_del(im);
503 return EINA_FALSE;
504 }
505
506 snprintf(entry, sizeof(entry), "edje/images/%i", id);
507
508 /* write the image data */
509 bytes = eet_data_image_write(eetf, entry,
510 im_data, im_w, im_h,
511 im_alpha,
512 0, 100, 1);
513 if (bytes <= 0)
514 {
515 ERR("Unable to write image part \"%s\" part entry to %s",
516 entry, ed->path);
517 eet_close(eetf);
518 evas_object_del(im);
519 return EINA_FALSE;
520 }
521
522 evas_object_del(im);
523
524 /* write the edje_file */
525 if (!_edje_edit_edje_file_save(eetf, ed->file))
526 {
527 eet_delete(eetf, entry);
528 eet_close(eetf);
529 return EINA_FALSE;
530 }
531
532 eet_close(eetf);
533 return EINA_TRUE;
534}
535
536static int
537_edje_part_id_find(Edje *ed, const char *part)
538{
539 unsigned int id;
540
541 for (id = 0; id < ed->table_parts_size; id++)
542 {
543 Edje_Real_Part *rp = ed->table_parts[id];
544
545 if (!strcmp(rp->part->name, part))
546 return id;
547 }
548 return -1;
549}
550
551static void
552_edje_part_description_id_set(int type, Edje_Part_Description_Common *c, int old_id, int new_id)
553{
554 if (c->rel1.id_x == old_id) c->rel1.id_x = new_id;
555 if (c->rel1.id_y == old_id) c->rel1.id_y = new_id;
556 if (c->rel2.id_x == old_id) c->rel2.id_x = new_id;
557 if (c->rel2.id_y == old_id) c->rel2.id_y = new_id;
558
559 if (type == EDJE_PART_TYPE_TEXT
560 || type == EDJE_PART_TYPE_TEXTBLOCK)
561 {
562 Edje_Part_Description_Text *t;
563
564 t = (Edje_Part_Description_Text *) c;
565
566 if (t->text.id_source == old_id) t->text.id_source = new_id;
567 if (t->text.id_text_source == old_id) t->text.id_text_source = new_id;
568 }
569}
570
571static void
572_edje_part_program_id_set(Edje_Program *epr, int old_id, int new_id)
573{
574 Edje_Program_Target *pt;
575 Eina_List *ll, *l_next;
576
577 if (epr->action != EDJE_ACTION_TYPE_STATE_SET)
578 return;
579
580 EINA_LIST_FOREACH_SAFE(epr->targets, ll, l_next, pt)
581 {
582 if (pt->id == old_id)
583 {
584 if (new_id == -1)
585 epr->targets = eina_list_remove_list(epr->targets, ll);
586 else
587 pt->id = new_id;
588 }
589 }
590}
591
592static void
593_edje_part_id_set(Edje *ed, Edje_Real_Part *rp, int new_id)
594{
595 /* This function change the id of a given real_part.
596 * All the depedency will be updated too.
597 * Also the table_parts is updated, and the current *rp in the table
598 * is lost.
599 * If new Id = -1 then all the depencies will be deleted
600 */
601 Edje_Part *part;
602 unsigned int j;
603 int old_id;
604
605 part = rp->part;
606
607 if (!part) return;
608 //printf("CHANGE ID OF PART %s TO %d\n", part->name, new_id);
609
610 if (!ed || new_id < -1) return;
611
612 if (part->id == new_id) return;
613
614 old_id = part->id;
615 part->id = new_id;
616
617 /* Fix all the dependecies in all parts... */
618 for (j = 0; j < ed->collection->parts_count; ++j)
619 {
620 Edje_Part *p;
621 unsigned int k;
622
623 p = ed->collection->parts[j];
624
625 //printf(" search id: %d in %s\n", old_id, p->name);
626 if (p->clip_to_id == old_id) p->clip_to_id = new_id;
627 if (p->dragable.confine_id == old_id) p->dragable.confine_id = new_id;
628
629 /* ...in default description */
630 _edje_part_description_id_set(p->type, p->default_desc, old_id, new_id);
631
632 /* ...and in all other descriptions */
633 for (k = 0; k < p->other.desc_count; ++k)
634 _edje_part_description_id_set(p->type, p->other.desc[k], old_id, new_id);
635 }
636
637 /*...and also in programs targets */
638#define EDJE_EDIT_PROGRAM_ID_SET(Array, Ed, It, Old, New) \
639 for (It = 0; It < Ed->collection->programs.Array##_count; ++It) \
640 _edje_part_program_id_set(Ed->collection->programs.Array[It], Old, New);
641
642 EDJE_EDIT_PROGRAM_ID_SET(fnmatch, ed, j, old_id, new_id);
643 EDJE_EDIT_PROGRAM_ID_SET(strcmp, ed, j, old_id, new_id);
644 EDJE_EDIT_PROGRAM_ID_SET(strncmp, ed, j, old_id, new_id);
645 EDJE_EDIT_PROGRAM_ID_SET(strrncmp, ed, j, old_id, new_id);
646 EDJE_EDIT_PROGRAM_ID_SET(nocmp, ed, j, old_id, new_id);
647
648 /* Adjust table_parts */
649 if (new_id >= 0)
650 ed->table_parts[new_id] = rp;
651}
652
653static void
654_edje_part_description_id_switch(int type, Edje_Part_Description_Common *c, int id1, int id2)
655{
656 if (c->rel1.id_x == id1) c->rel1.id_x = id2;
657 else if (c->rel1.id_x == id2) c->rel1.id_x = id1;
658 if (c->rel1.id_y == id1) c->rel1.id_y = id2;
659 else if (c->rel1.id_y == id2) c->rel1.id_y = id1;
660 if (c->rel2.id_x == id1) c->rel2.id_x = id2;
661 else if (c->rel2.id_x == id2) c->rel2.id_x = id1;
662 if (c->rel2.id_y == id1) c->rel2.id_y = id2;
663 else if (c->rel2.id_y == id2) c->rel2.id_y = id1;
664
665 if (type == EDJE_PART_TYPE_TEXT
666 || type == EDJE_PART_TYPE_TEXTBLOCK)
667 {
668 Edje_Part_Description_Text *t;
669
670 t = (Edje_Part_Description_Text *) c;
671
672 if (t->text.id_source == id1) t->text.id_source = id2;
673 else if (t->text.id_source == id2) t->text.id_source = id1;
674 if (t->text.id_text_source == id1) t->text.id_text_source = id2;
675 else if (t->text.id_text_source == id2) t->text.id_text_source = id2;
676 }
677}
678
679static void
680_edje_part_program_id_switch(Edje_Program *epr, int id1, int id2)
681{
682 Edje_Program_Target *pt;
683 Eina_List *ll;
684
685 if (epr->action != EDJE_ACTION_TYPE_STATE_SET)
686 return;
687
688 EINA_LIST_FOREACH(epr->targets, ll, pt)
689 {
690 if (pt->id == id1) pt->id = id2;
691 else if (pt->id == id2) pt->id = id1;
692 }
693}
694
695static void
696_edje_parts_id_switch(Edje *ed, Edje_Real_Part *rp1, Edje_Real_Part *rp2)
697{
698 /* This function switch the id of two parts.
699 * All the depedency will be updated too.
700 * Also the table_parts is updated,
701 * The parts list isn't touched
702 */
703 int id1;
704 int id2;
705 unsigned int i;
706
707 //printf("SWITCH ID OF PART %d AND %d\n", rp1->part->id, rp2->part->id);
708
709 if (!ed || !rp1 || !rp2) return;
710 if (rp1 == rp2) return;
711
712 id1 = rp1->part->id;
713 id2 = rp2->part->id;
714
715 /* Switch ids */
716 rp1->part->id = id2;
717 rp2->part->id = id1;
718
719 /* adjust table_parts */
720 ed->table_parts[id1] = rp2;
721 ed->table_parts[id2] = rp1;
722
723 // Fix all the dependecies in all parts...
724 for (i = 0; i < ed->collection->parts_count; ++i)
725 {
726 unsigned int j;
727 Edje_Part *p;
728
729 p = ed->collection->parts[i];
730
731 //printf(" search id: %d in %s\n", old_id, p->name);
732 if (p->clip_to_id == id1) p->clip_to_id = id2;
733 else if (p->clip_to_id == id2) p->clip_to_id = id1;
734 if (p->dragable.confine_id == id1) p->dragable.confine_id = id2;
735 else if (p->dragable.confine_id == id2) p->dragable.confine_id = id1;
736
737 // ...in default description
738 _edje_part_description_id_switch(p->type, p->default_desc, id1, id2);
739
740 // ...and in all other descriptions
741 for (j = 0; j < p->other.desc_count; ++j)
742 _edje_part_description_id_switch(p->type, p->other.desc[j], id1, id2);
743 }
744
745 //...and also in programs targets
746#define EDJE_EDIT_PROGRAM_SWITCH(Array, Ed, It, Id1, Id2) \
747 for (It = 0; It < Ed->collection->programs.Array##_count; ++It) \
748 _edje_part_program_id_switch(Ed->collection->programs.Array[i], Id1, Id2);
749
750 EDJE_EDIT_PROGRAM_SWITCH(fnmatch, ed, i, id1, id2);
751 EDJE_EDIT_PROGRAM_SWITCH(strcmp, ed, i, id1, id2);
752 EDJE_EDIT_PROGRAM_SWITCH(strncmp, ed, i, id1, id2);
753 EDJE_EDIT_PROGRAM_SWITCH(strrncmp, ed, i, id1, id2);
754 EDJE_EDIT_PROGRAM_SWITCH(nocmp, ed, i, id1, id2);
755 //TODO Real part dependencies are ok?
756}
757
758static void
759_edje_fix_parts_id(Edje *ed)
760{
761 /* We use this to clear the id hole leaved when a part is removed.
762 * After the execution of this function all parts will have a right
763 * (uniqe & ordered) id. The table_parts is also updated.
764 */
765 unsigned int i;
766 int correct_id;
767 unsigned int count;
768
769 //printf("FIXING PARTS ID \n");
770
771 //TODO order the list first to be more robust
772
773 /* Give a correct id to all the parts */
774 correct_id = 0;
775 for (i = 0; i < ed->collection->parts_count; ++i)
776 {
777 Edje_Part *p;
778
779 p = ed->collection->parts[i];
780
781 //printf(" [%d]Checking part: %s id: %d\n", correct_id, p->name, p->id);
782 if (p->id != correct_id)
783 if (ed->table_parts[p->id])
784 _edje_part_id_set(ed, ed->table_parts[p->id], correct_id);
785
786 correct_id++;
787 }
788
789 /* If we have removed some parts realloc table_parts */
790 count = ed->collection->parts_count;
791 if (count != ed->table_parts_size)
792 {
793 ed->table_parts = realloc(ed->table_parts, sizeof(Edje_Real_Part *) * count);
794 ed->table_parts_size = count;
795 }
796
797 //printf("\n");
798}
799
800static void
801_edje_if_string_free(Edje *ed, const char *str)
802{
803 Eet_Dictionary *dict;
804
805 if (!ed || !str) return;
806
807 dict = eet_dictionary_get(ed->file->ef);
808 if (eet_dictionary_string_check(dict, str)) return;
809 eina_stringshare_del(str);
810 str = NULL;
811}
812
813static Edje_Style *
814_edje_edit_style_get(Edje *ed, const char *name)
815{
816 Eina_List *l;
817 Edje_Style *s;
818
819 if (!ed || !ed->file || !ed->file->styles || !name)
820 return NULL;
821
822 EINA_LIST_FOREACH(ed->file->styles, l, s)
823 if (s->name && !strcmp(s->name, name))
824 return s;
825
826 return NULL;
827}
828
829static Edje_Style_Tag *
830_edje_edit_style_tag_get(Edje *ed, const char *style, const char *name)
831{
832 Eina_List *l;
833 Edje_Style *s;
834 Edje_Style_Tag *t;
835
836 if (!ed || !ed->file || !ed->file->styles || !name)
837 return NULL;
838
839 s = _edje_edit_style_get(ed, style);
840
841 EINA_LIST_FOREACH(s->tags, l, t)
842 if (t->key && !strcmp(t->key, name))
843 return t;
844
845 return NULL;
846}
847
848static Edje_External_Directory_Entry *
849_edje_edit_external_get(Edje *ed, const char *name)
850{
851 unsigned int i;
852
853 if (!ed || !ed->file || !ed->file->external_dir || !name)
854 return NULL;
855
856 for (i = 0; i < ed->file->external_dir->entries_count; ++i)
857 if (ed->file->external_dir->entries[i].entry
858 && !strcmp(ed->file->external_dir->entries[i].entry, name))
859 return ed->file->external_dir->entries + i;
860
861 return NULL;
862}
863
864static void
865_edje_edit_group_references_update(Evas_Object *obj, const char *old_group_name, const char *new_group_name)
866{
867 Eina_Iterator *i;
868 Eina_List *pll, *pl;
869// Edje_Part_Collection *pc;
870 Edje_Part_Collection_Directory_Entry *pce;
871 char *part_name;
872 const char *source, *old;
873 Edje_Part_Type type;
874 Evas_Object *part_obj;
875
876 GET_ED_OR_RETURN();
877
878// pc = ed->collection;
879
880 part_obj = edje_edit_object_add(ed->base.evas);
881
882 old = eina_stringshare_add(old_group_name);
883
884 i = eina_hash_iterator_data_new(ed->file->collection);
885
886 EINA_ITERATOR_FOREACH(i, pce)
887 {
888 edje_object_file_set(part_obj, ed->file->path, pce->entry);
889
890 pl = edje_edit_parts_list_get(part_obj);
891
892 EINA_LIST_FOREACH(pl, pll, part_name)
893 {
894 source = edje_edit_part_source_get(part_obj, part_name);
895 type = edje_edit_part_type_get(part_obj, part_name);
896
897 if (type == EDJE_PART_TYPE_GROUP && source == old)
898 edje_edit_part_source_set(part_obj, part_name, new_group_name);
899
900 if (source)
901 eina_stringshare_del(source);
902 }
903 }
904
905 eina_iterator_free(i);
906
907 eina_stringshare_del(old);
908
909 evas_object_del(part_obj);
910}
911
912static void
913_edje_edit_flag_script_dirty(Edje_Edit *eed, Eina_Bool all)
914{
915 eed->script_need_recompile = EINA_TRUE;
916 if (all)
917 eed->all_dirty = EINA_TRUE;
918}
919
920/*****************/
921/* GENERAL API */
922/*****************/
923
924EAPI void
925edje_edit_string_list_free(Eina_List *lst)
926{
927 eina_error_set(0);
928 //printf("FREE LIST: \n");
929 while (lst)
930 {
931 if (eina_list_data_get(lst)) eina_stringshare_del(eina_list_data_get(lst));
932 //printf("FREE: %s\n", eina_list_data_get(lst));
933 lst = eina_list_remove(lst, eina_list_data_get(lst));
934 }
935}
936
937EAPI void
938edje_edit_string_free(const char *str)
939{
940 eina_error_set(0);
941
942 if (str) eina_stringshare_del(str);
943}
944
945EAPI const char*
946edje_edit_compiler_get(Evas_Object *obj)
947{
948 eina_error_set(0);
949
950 GET_ED_OR_RETURN(0);
951 return eina_stringshare_add(ed->file->compiler);
952}
953
954/****************/
955/* GROUPS API */
956/****************/
957
958EAPI Eina_Bool
959edje_edit_group_add(Evas_Object *obj, const char *name)
960{
961 Edje_Part_Collection_Directory_Entry *de;
962 Edje_Part_Collection_Directory_Entry *d;
963 Edje_Part_Collection *pc;
964 int id;
965 int search;
966 //Code *cd;
967
968 eina_error_set(0);
969
970 GET_ED_OR_RETURN(EINA_FALSE);
971
972 //printf("ADD GROUP: %s \n", name);
973
974 /* check if a group with the same name already exists */
975 if (eina_hash_find(ed->file->collection, name))
976 return EINA_FALSE;
977
978 /* Create structs */
979 de = _alloc(sizeof(Edje_Part_Collection_Directory_Entry));
980 if (!de) return EINA_FALSE;
981
982 pc = _alloc(sizeof(Edje_Part_Collection));
983 if (!pc)
984 {
985 free(de);
986 return EINA_FALSE;
987 }
988
989 /* Search first free id */
990 id = -1;
991 search = 0;
992 while (id == -1)
993 {
994 Eina_Iterator *i;
995 Eina_Bool found = 0;
996
997 i = eina_hash_iterator_data_new(ed->file->collection);
998
999 EINA_ITERATOR_FOREACH(i, d)
1000 {
1001 // printf("search if %d is free [id %d]\n", search, d->id);
1002 if (search == d->id)
1003 {
1004 found = 1;
1005 break;
1006 }
1007 }
1008
1009 eina_iterator_free(i);
1010
1011 if (!found) id = search;
1012 else search++;
1013 }
1014
1015 /* Init Edje_Part_Collection_Directory_Entry */
1016 //printf(" new id: %d\n", id);
1017 de->id = id;
1018 de->entry = eina_stringshare_add(name);
1019 eina_hash_direct_add(ed->file->collection, de->entry, de);
1020
1021 /* Init Edje_Part_Collection */
1022 pc->id = id;
1023 pc->references = 0;
1024 memset(&pc->programs, 0, sizeof (pc->programs));
1025 pc->parts = NULL;
1026 pc->data = NULL;
1027 pc->script = NULL;
1028 pc->part = eina_stringshare_add(name);
1029
1030 //cd = _alloc(sizeof(Code));
1031 //codes = eina_list_append(codes, cd);
1032#define EDIT_EMN(Tp, Sz, Ce) \
1033 Ce->mp.Tp = eina_mempool_add("chained_mempool", #Tp, NULL, sizeof (Sz), 10);
1034
1035 EDIT_EMN(RECTANGLE, Edje_Part_Description_Common, de);
1036 EDIT_EMN(TEXT, Edje_Part_Description_Text, de);
1037 EDIT_EMN(IMAGE, Edje_Part_Description_Image, de);
1038 EDIT_EMN(SWALLOW, Edje_Part_Description_Common, de);
1039 EDIT_EMN(TEXTBLOCK, Edje_Part_Description_Text, de);
1040 EDIT_EMN(GROUP, Edje_Part_Description_Common, de);
1041 EDIT_EMN(BOX, Edje_Part_Description_Box, de);
1042 EDIT_EMN(TABLE, Edje_Part_Description_Table, de);
1043 EDIT_EMN(EXTERNAL, Edje_Part_Description_External, de);
1044 EDIT_EMN(part, Edje_Part, de);
1045
1046 ed->file->collection_cache = eina_list_prepend(ed->file->collection_cache, pc);
1047 _edje_cache_coll_clean(ed->file);
1048
1049 return EINA_TRUE;
1050}
1051
1052EAPI Eina_Bool
1053edje_edit_group_del(Evas_Object *obj, const char *group_name)
1054{
1055 Edje_Part_Collection_Directory_Entry *e;
1056 Edje_Part_Collection *die = NULL;
1057 Edje_Part_Collection *g;
1058 Eina_List *l;
1059 Eet_File *eetf;
1060 char buf[64], **keys;
1061 int count;
1062
1063 eina_error_set(0);
1064
1065 GET_ED_OR_RETURN(EINA_FALSE);
1066
1067 /* if (eina_hash_find(ed->file->collection_hash, group_name)) */
1068 /* return EINA_FALSE; */
1069
1070 if (strcmp(ed->group, group_name) == 0)
1071 {
1072 eina_error_set(EDJE_EDIT_ERROR_GROUP_CURRENTLY_USED);
1073 return EINA_FALSE;
1074 }
1075
1076 e = eina_hash_find(ed->file->collection, group_name);
1077 if (!e)
1078 {
1079 eina_error_set(EDJE_EDIT_ERROR_GROUP_DOES_NOT_EXIST);
1080 return EINA_FALSE;
1081 }
1082
1083 if (e->id == ed->collection->id)
1084 {
1085 eina_error_set(EDJE_EDIT_ERROR_GROUP_CURRENTLY_USED);
1086 return EINA_FALSE;
1087 }
1088
1089 if (e->ref)
1090 {
1091 eina_error_set(EDJE_EDIT_ERROR_GROUP_REFERENCED);
1092 return EINA_FALSE;
1093 }
1094
1095 _edje_edit_group_references_update(obj, group_name, NULL);
1096
1097 EINA_LIST_FOREACH(ed->file->collection_cache, l, g)
1098 if (g->id == e->id)
1099 {
1100 ed->file->collection_cache =
1101 eina_list_remove_list(ed->file->collection_cache, l);
1102 die = g;
1103 break;
1104 }
1105
1106 /* Remove collection/id from eet file */
1107 eetf = eet_open(ed->file->path, EET_FILE_MODE_READ_WRITE);
1108 if (!eetf)
1109 {
1110 ERR("Edje_Edit: Error. unable to open \"%s\" "
1111 "for writing output", ed->file->path);
1112 return EINA_FALSE;
1113 }
1114 snprintf(buf, sizeof(buf), "edje/collections/%d", e->id);
1115 eet_delete(eetf, buf);
1116 snprintf(buf, sizeof(buf), "edje/scripts/embryo/compiled/%d", e->id);
1117 eet_delete(eetf, buf);
1118 snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%d", e->id);
1119 eet_delete(eetf, buf);
1120 snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%d/*", e->id);
1121 keys = eet_list(eetf, buf, &count);
1122 if (keys)
1123 {
1124 do
1125 {
1126 count--;
1127 eet_delete(eetf, keys[count]);
1128 }
1129 while(count);
1130 free(keys);
1131 }
1132 eet_close(eetf);
1133
1134 /* Free Group */
1135 if (die) _edje_collection_free(ed->file, die, e);
1136 eina_hash_del(ed->file->collection, group_name, e);
1137
1138 /* we need to save everything to make sure the file won't have broken
1139 * references the next time is loaded */
1140 edje_edit_save_all(obj);
1141
1142 return EINA_TRUE;
1143}
1144
1145EAPI Eina_Bool
1146edje_edit_group_exist(Evas_Object *obj, const char *group)
1147{
1148 eina_error_set(0);
1149
1150 GET_ED_OR_RETURN(EINA_FALSE);
1151
1152 if (eina_hash_find(ed->file->collection, group))
1153 return EINA_TRUE;
1154 return EINA_FALSE;
1155}
1156
1157EAPI Eina_Bool
1158edje_edit_group_name_set(Evas_Object *obj, const char *new_name)
1159{
1160 Edje_Part_Collection_Directory_Entry *pce;
1161 Edje_Part_Collection *pc;
1162
1163 eina_error_set(0);
1164
1165 GET_ED_OR_RETURN(EINA_FALSE);
1166
1167 if (!new_name) return EINA_FALSE;
1168
1169 pc = ed->collection;
1170
1171 if (!strcmp(pc->part, new_name)) return EINA_TRUE;
1172
1173 if (edje_edit_group_exist(obj, new_name)) return EINA_FALSE;
1174
1175 _edje_edit_group_references_update(obj, pc->part, new_name);
1176
1177 //printf("Set name of current group: %s [id: %d][new name: %s]\n",
1178 // pc->part, pc->id, new_name);
1179
1180 //if (pc->part && ed->file->free_strings) eina_stringshare_del(pc->part); TODO FIXME
1181 pce = eina_hash_find(ed->file->collection, pc->part);
1182
1183 eina_hash_move(ed->file->collection, pce->entry, new_name);
1184
1185 pce->entry = eina_stringshare_add(new_name);
1186 pc->part = pce->entry;
1187 eina_stringshare_replace(&ed->group, new_name);
1188
1189 return EINA_TRUE;
1190}
1191
1192#define FUNC_GROUP_ACCESSOR(Class, Value) \
1193 EAPI int \
1194 edje_edit_group_##Class##_##Value##_get(Evas_Object *obj) \
1195 { \
1196 eina_error_set(0); \
1197 GET_ED_OR_RETURN(-1); \
1198 if (!ed->collection) return -1; \
1199 return ed->collection->prop.Class.Value; \
1200 } \
1201 EAPI void \
1202 edje_edit_group_##Class##_##Value##_set(Evas_Object *obj, int v) \
1203 { \
1204 eina_error_set(0); \
1205 GET_ED_OR_RETURN(); \
1206 ed->collection->prop.Class.Value = v; \
1207 }
1208
1209FUNC_GROUP_ACCESSOR(min, w);
1210FUNC_GROUP_ACCESSOR(min, h);
1211FUNC_GROUP_ACCESSOR(max, w);
1212FUNC_GROUP_ACCESSOR(max, h);
1213
1214/***************/
1215/* DATA API */
1216/***************/
1217
1218EAPI Eina_List *
1219edje_edit_group_data_list_get(Evas_Object * obj)
1220{
1221 Eina_Iterator *it;
1222 Eina_List *datas = NULL;
1223 const char *key;
1224
1225 eina_error_set(0);
1226
1227 GET_ED_OR_RETURN(NULL);
1228
1229 if (!ed->file || !ed->collection || !ed->collection->data)
1230 return NULL;
1231
1232 it = eina_hash_iterator_key_new(ed->collection->data);
1233 if (!it) return NULL;
1234
1235 EINA_ITERATOR_FOREACH(it, key)
1236 datas = eina_list_append(datas, eina_stringshare_add(key));
1237
1238 eina_iterator_free(it);
1239
1240 return datas;
1241}
1242
1243EAPI Eina_List *
1244edje_edit_data_list_get(Evas_Object * obj)
1245{
1246 Eina_Iterator *i;
1247 Eina_List *datas = NULL;
1248 const char *key;
1249
1250 eina_error_set(0);
1251
1252 GET_ED_OR_RETURN(NULL);
1253
1254 if (!ed->file || !ed->file->data)
1255 return NULL;
1256
1257 i = eina_hash_iterator_key_new(ed->file->data);
1258
1259 EINA_ITERATOR_FOREACH(i, key)
1260 datas = eina_list_append(datas, eina_stringshare_add(key));
1261
1262 eina_iterator_free(i);
1263
1264 return datas;
1265}
1266
1267EAPI Eina_Bool
1268edje_edit_group_data_add(Evas_Object *obj, const char *key, const char *value)
1269{
1270 Edje_String *es;
1271
1272 eina_error_set(0);
1273
1274 GET_ED_OR_RETURN(EINA_FALSE);
1275
1276 if (!key || !ed->file || !ed->collection)
1277 return EINA_FALSE;
1278
1279 if (!ed->collection->data)
1280 ed->collection->data = eina_hash_string_small_new(NULL);
1281
1282 if (eina_hash_find(ed->collection->data, key))
1283 return EINA_FALSE;
1284
1285 es = calloc(1, sizeof(Edje_String));
1286 if (!es)
1287 return EINA_FALSE;
1288 es->str = eina_stringshare_add(value);
1289
1290 if (!eina_hash_add(ed->collection->data, key, es))
1291 {
1292 eina_stringshare_del(es->str);
1293 free(es);
1294 return EINA_FALSE;
1295 }
1296 return EINA_TRUE;
1297}
1298
1299EAPI Eina_Bool
1300edje_edit_data_add(Evas_Object *obj, const char *itemname, const char *value)
1301{
1302 Edje_String *es;
1303
1304 eina_error_set(0);
1305
1306 GET_ED_OR_RETURN(EINA_FALSE);
1307
1308 if (!itemname || !ed->file)
1309 return EINA_FALSE;
1310
1311 if (eina_hash_find(ed->file->data, itemname))
1312 return EINA_FALSE;
1313
1314 es = calloc(1, sizeof(Edje_String));
1315 if (!es)
1316 return EINA_FALSE;
1317 es->str = eina_stringshare_add(value);
1318
1319 if (!eina_hash_add(ed->file->data, itemname, es))
1320 {
1321 eina_stringshare_del(es->str);
1322 free(es);
1323 return EINA_FALSE;
1324 }
1325 return EINA_TRUE;
1326}
1327
1328EAPI Eina_Bool
1329edje_edit_group_data_del(Evas_Object *obj, const char *key)
1330{
1331 Edje_String *value;
1332
1333 eina_error_set(0);
1334
1335 GET_ED_OR_RETURN(EINA_FALSE);
1336
1337 if (!key || !ed->file || !ed->collection)
1338 return EINA_FALSE;
1339
1340 value = eina_hash_find(ed->collection->data, key);
1341 if (!value) return EINA_FALSE;
1342
1343 eina_hash_del(ed->collection->data, key, value);
1344 _edje_if_string_free(ed, value->str);
1345 free(value);
1346
1347 return EINA_TRUE;
1348}
1349
1350EAPI Eina_Bool
1351edje_edit_data_del(Evas_Object *obj, const char *itemname)
1352{
1353 Edje_String *value;
1354
1355 eina_error_set(0);
1356
1357 GET_ED_OR_RETURN(EINA_FALSE);
1358
1359 if (!itemname || !ed->file || !ed->file->data)
1360 return 0;
1361
1362 value = eina_hash_find(ed->file->data, itemname);
1363 if (!value)
1364 return EINA_FALSE;
1365
1366 eina_hash_del(ed->file->data, itemname, value);
1367 _edje_if_string_free(ed, value->str);
1368 free(value);
1369
1370 return EINA_TRUE;
1371}
1372
1373EAPI const char *
1374edje_edit_group_data_value_get(Evas_Object * obj, const char *key)
1375{
1376 Edje_String *value;
1377
1378 eina_error_set(0);
1379
1380 GET_ED_OR_RETURN(NULL);
1381
1382 if (!key || !ed->file || !ed->collection)
1383 return NULL;
1384
1385 value = eina_hash_find(ed->collection->data, key);
1386 if (!value)
1387 return NULL;
1388
1389 return eina_stringshare_add(edje_string_get(value));
1390}
1391
1392EAPI const char *
1393edje_edit_data_value_get(Evas_Object * obj, const char *itemname)
1394{
1395 Edje_String *value;
1396
1397 eina_error_set(0);
1398
1399 GET_ED_OR_RETURN(NULL);
1400
1401 if (!itemname || !ed->file || !ed->file->data)
1402 return NULL;
1403
1404 value = eina_hash_find(ed->file->data, itemname);
1405 if (!value)
1406 return NULL;
1407
1408 return eina_stringshare_add(edje_string_get(value));
1409}
1410
1411EAPI Eina_Bool
1412edje_edit_group_data_value_set(Evas_Object *obj, const char *key, const char *value)
1413{
1414 Edje_String *es;
1415
1416 eina_error_set(0);
1417
1418 GET_ED_OR_RETURN(EINA_FALSE);
1419
1420 if (!key || !value || !ed->file || !ed->collection)
1421 return EINA_FALSE;
1422
1423 es = eina_hash_find(ed->collection->data, key);
1424 if (es)
1425 {
1426 _edje_if_string_free(ed, es->str);
1427 es->str = eina_stringshare_add(value);
1428 es->id = 0;
1429 return EINA_TRUE;
1430 }
1431
1432 return EINA_FALSE;
1433}
1434
1435EAPI Eina_Bool
1436edje_edit_data_value_set(Evas_Object *obj, const char *itemname, const char *value)
1437{
1438 Edje_String *es;
1439
1440 eina_error_set(0);
1441
1442 GET_ED_OR_RETURN(EINA_FALSE);
1443
1444 if (!itemname || !value || !ed->file || !ed->file->data)
1445 return EINA_FALSE;
1446
1447 es = eina_hash_find(ed->file->data, itemname);
1448 if (es)
1449 {
1450 _edje_if_string_free(ed, es->str);
1451 es->str = eina_stringshare_add(value);
1452 es->id = 0;
1453 return EINA_TRUE;
1454 }
1455 return EINA_FALSE;
1456}
1457
1458EAPI Eina_Bool
1459edje_edit_group_data_name_set(Evas_Object *obj, const char *key, const char *new_key)
1460{
1461
1462 eina_error_set(0);
1463
1464 GET_ED_OR_RETURN(EINA_FALSE);
1465
1466 if (!key || !new_key || !ed->file || !ed->collection) {
1467 return EINA_FALSE;
1468 }
1469
1470 return eina_hash_move(ed->collection->data, key, new_key);
1471}
1472
1473EAPI Eina_Bool
1474edje_edit_data_name_set(Evas_Object *obj, const char *itemname, const char *newname)
1475{
1476
1477 eina_error_set(0);
1478
1479 GET_ED_OR_RETURN(EINA_FALSE);
1480
1481 if (!itemname || !newname || !ed->file || !ed->file->data)
1482 return EINA_FALSE;
1483
1484 return eina_hash_move(ed->file->data, itemname, newname);
1485}
1486
1487/***********************/
1488/* COLOR CLASSES API */
1489/***********************/
1490
1491EAPI Eina_List *
1492edje_edit_color_classes_list_get(Evas_Object * obj)
1493{
1494 Eina_List *classes = NULL;
1495 Eina_List *l;
1496 Edje_Color_Class *cc;
1497
1498 eina_error_set(0);
1499
1500 GET_ED_OR_RETURN(NULL);
1501
1502 if (!ed->file || !ed->file->color_classes)
1503 return NULL;
1504 //printf("GET CLASSES LIST %d %d\n", eina_list_count(ed->color_classes), eina_list_count(ed->file->color_classes));
1505 EINA_LIST_FOREACH(ed->file->color_classes, l, cc)
1506 classes = eina_list_append(classes, eina_stringshare_add(cc->name));
1507
1508 return classes;
1509}
1510
1511EAPI Eina_Bool
1512edje_edit_color_class_colors_get(Evas_Object *obj, const char *class_name, int *r, int *g, int *b, int *a, int *r2, int *g2, int *b2, int *a2, int *r3, int *g3, int *b3, int *a3)
1513{
1514 Eina_List *l;
1515 Edje_Color_Class *cc;
1516
1517 eina_error_set(0);
1518
1519 GET_ED_OR_RETURN(EINA_FALSE);
1520
1521 if (!ed->file || !ed->file->color_classes)
1522 return EINA_FALSE;
1523
1524 EINA_LIST_FOREACH(ed->file->color_classes, l, cc)
1525 if (!strcmp(cc->name, class_name))
1526 {
1527 if (r) *r = cc->r;
1528 if (g) *g = cc->g;
1529 if (b) *b = cc->b;
1530 if (a) *a = cc->a;
1531
1532 if (r2) *r2 = cc->r2;
1533 if (g2) *g2 = cc->g2;
1534 if (b2) *b2 = cc->b2;
1535 if (a2) *a2 = cc->a2;
1536
1537 if (r3) *r3 = cc->r3;
1538 if (g3) *g3 = cc->g3;
1539 if (b3) *b3 = cc->b3;
1540 if (a3) *a3 = cc->a3;
1541
1542 return EINA_TRUE;
1543 }
1544 return EINA_FALSE;
1545}
1546
1547EAPI Eina_Bool
1548edje_edit_color_class_colors_set(Evas_Object *obj, const char *class_name, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3)
1549{
1550 Eina_List *l;
1551 Edje_Color_Class *cc;
1552
1553 eina_error_set(0);
1554
1555 GET_ED_OR_RETURN(EINA_FALSE);
1556
1557 if (!ed->file || !ed->file->color_classes)
1558 return EINA_FALSE;
1559
1560 EINA_LIST_FOREACH(ed->file->color_classes, l, cc)
1561 if (!strcmp(cc->name, class_name))
1562 {
1563 if (r > -1) cc->r = r;
1564 if (g > -1) cc->g = g;
1565 if (b > -1) cc->b = b;
1566 if (a > -1) cc->a = a;
1567
1568 if (r2 > -1) cc->r2 = r2;
1569 if (g2 > -1) cc->g2 = g2;
1570 if (b2 > -1) cc->b2 = b2;
1571 if (a2 > -1) cc->a2 = a2;
1572
1573 if (r3 > -1) cc->r3 = r3;
1574 if (g3 > -1) cc->g3 = g3;
1575 if (b3 > -1) cc->b3 = b3;
1576 if (a3 > -1) cc->a3 = a3;
1577
1578 return EINA_TRUE;
1579 }
1580 return EINA_FALSE;
1581}
1582
1583EAPI Eina_Bool
1584edje_edit_color_class_add(Evas_Object *obj, const char *name)
1585{
1586 Eina_List *l;
1587 Edje_Color_Class *c;
1588 Edje_Color_Class *cc;
1589
1590 eina_error_set(0);
1591
1592 GET_ED_OR_RETURN(EINA_FALSE);
1593
1594 if (!name || !ed->file)
1595 return EINA_FALSE;
1596
1597 EINA_LIST_FOREACH(ed->file->color_classes, l, cc)
1598 if (strcmp(cc->name, name) == 0)
1599 return EINA_FALSE;
1600
1601 c = _alloc(sizeof(Edje_Color_Class));
1602 if (!c) return EINA_FALSE;
1603
1604 c->name = (char*)eina_stringshare_add(name);
1605 c->r = c->g = c->b = c->a = 255;
1606 c->r2 = c->g2 = c->b2 = c->a2 = 255;
1607 c->r3 = c->g3 = c->b3 = c->a3 = 255;
1608
1609 ed->file->color_classes = eina_list_append(ed->file->color_classes, c);
1610
1611 return EINA_TRUE;
1612}
1613
1614EAPI Eina_Bool
1615edje_edit_color_class_del(Evas_Object *obj, const char *name)
1616{
1617 Eina_List *l;
1618 Edje_Color_Class *cc;
1619
1620 eina_error_set(0);
1621
1622 GET_ED_OR_RETURN(EINA_FALSE);
1623
1624 if (!name || !ed->file || !ed->file->color_classes)
1625 return EINA_FALSE;
1626
1627 EINA_LIST_FOREACH(ed->file->color_classes, l, cc)
1628 if (strcmp(cc->name, name) == 0)
1629 {
1630 _edje_if_string_free(ed, cc->name);
1631 ed->file->color_classes = eina_list_remove(ed->file->color_classes, cc);
1632 free(cc);
1633 return EINA_TRUE;
1634 }
1635 return EINA_FALSE;
1636}
1637
1638EAPI Eina_Bool
1639edje_edit_color_class_name_set(Evas_Object *obj, const char *name, const char *newname)
1640{
1641 Eina_List *l;
1642 Edje_Color_Class *cc;
1643
1644 eina_error_set(0);
1645
1646 GET_ED_OR_RETURN(EINA_FALSE);
1647
1648 if (!ed->file || !ed->file->color_classes)
1649 return EINA_FALSE;
1650
1651 EINA_LIST_FOREACH(ed->file->color_classes, l, cc)
1652 if (!strcmp(cc->name, name))
1653 {
1654 _edje_if_string_free(ed, cc->name);
1655 cc->name = (char*)eina_stringshare_add(newname);
1656 return EINA_TRUE;
1657 }
1658
1659 return EINA_FALSE;
1660}
1661
1662
1663
1664/*********************/
1665/* TEXT STYLES API */
1666/*********************/
1667
1668EAPI Eina_List *
1669edje_edit_styles_list_get(Evas_Object * obj)
1670{
1671 Eina_List *styles = NULL;
1672 Eina_List *l;
1673 Edje_Style *s;
1674
1675 eina_error_set(0);
1676
1677 GET_ED_OR_RETURN(NULL);
1678
1679 if (!ed->file || !ed->file->styles)
1680 return NULL;
1681 //printf("GET STYLES LIST %d\n", eina_list_count(ed->file->styles));
1682 EINA_LIST_FOREACH(ed->file->styles, l, s)
1683 styles = eina_list_append(styles, eina_stringshare_add(s->name));
1684
1685 return styles;
1686}
1687
1688EAPI Eina_Bool
1689edje_edit_style_add(Evas_Object * obj, const char* style)
1690{
1691 Edje_Style *s;
1692
1693 eina_error_set(0);
1694
1695 GET_ED_OR_RETURN(EINA_FALSE);
1696 //printf("ADD STYLE '%s'\n", style);
1697
1698 s = _edje_edit_style_get(ed, style);
1699 if (s) return EINA_FALSE;
1700
1701 s = _alloc(sizeof(Edje_Style));
1702 if (!s) return EINA_FALSE;
1703 s->name = (char*)eina_stringshare_add(style);
1704 s->tags = NULL;
1705 s->style = NULL;
1706
1707 ed->file->styles = eina_list_append(ed->file->styles, s);
1708 return EINA_TRUE;
1709}
1710
1711EAPI void
1712edje_edit_style_del(Evas_Object * obj, const char* style)
1713{
1714 Edje_Style *s;
1715
1716 eina_error_set(0);
1717
1718 GET_ED_OR_RETURN();
1719 //printf("DEL STYLE '%s'\n", style);
1720
1721 s = _edje_edit_style_get(ed, style);
1722 if (!s) return;
1723
1724 ed->file->styles = eina_list_remove(ed->file->styles, s);
1725
1726 _edje_if_string_free(ed, s->name);
1727 //~ //s->style HOWTO FREE ???
1728 while (s->tags)
1729 {
1730 Edje_Style_Tag *t;
1731
1732 t = s->tags->data;
1733
1734 s->tags = eina_list_remove(s->tags, t);
1735 _edje_if_string_free(ed, t->key);
1736 _edje_if_string_free(ed, t->value);
1737 _edje_if_string_free(ed, t->font);
1738 _edje_if_string_free(ed, t->text_class);
1739 free(t);
1740 t = NULL;
1741 }
1742 free(s);
1743 s = NULL;
1744 s = NULL;
1745}
1746
1747
1748EAPI Eina_List *
1749edje_edit_style_tags_list_get(Evas_Object * obj, const char* style)
1750{
1751 Eina_List *tags = NULL;
1752 Eina_List *l;
1753 Edje_Style *s;
1754 Edje_Style_Tag *t;
1755
1756 eina_error_set(0);
1757
1758 GET_ED_OR_RETURN(NULL);
1759 if (!ed->file || !ed->file->styles || !style)
1760 return NULL;
1761
1762 s = _edje_edit_style_get(ed, style);
1763
1764 //printf("GET STYLE TAG LIST %d\n", eina_list_count(s->tags));
1765 EINA_LIST_FOREACH(s->tags, l, t)
1766 tags = eina_list_append(tags, eina_stringshare_add(t->key));
1767
1768 return tags;
1769}
1770
1771EAPI void
1772edje_edit_style_tag_name_set(Evas_Object * obj, const char* style, const char* tag, const char*new_name)
1773{
1774 Edje_Style_Tag *t;
1775
1776 eina_error_set(0);
1777
1778 GET_ED_OR_RETURN();
1779 //printf("SET TAG NAME for '%s' FOR STYLE '%s'\n", tag, style);
1780
1781 if (!ed->file || !ed->file->styles || !style || !tag)
1782 return;
1783
1784 t = _edje_edit_style_tag_get(ed, style, tag);
1785 if (!t) return;
1786 _edje_if_string_free(ed, t->key);
1787 t->key = eina_stringshare_add(new_name);
1788}
1789
1790EAPI const char*
1791edje_edit_style_tag_value_get(Evas_Object * obj, const char* style, const char* tag)
1792{
1793 Edje_Style_Tag *t;
1794
1795 eina_error_set(0);
1796
1797 GET_ED_OR_RETURN(NULL);
1798 //printf("GET TAG '%s' FOR STYLE '%s'\n", tag, style);
1799
1800 if (!ed->file || !ed->file->styles || !style || !tag)
1801 return NULL;
1802
1803 t = _edje_edit_style_tag_get(ed, style, tag);
1804 if (t && t->value)
1805 return eina_stringshare_add(t->value);
1806
1807 return NULL;
1808}
1809
1810EAPI void
1811edje_edit_style_tag_value_set(Evas_Object * obj, const char* style, const char* tag, const char*new_value)
1812{
1813 Edje_Style_Tag *t;
1814
1815 eina_error_set(0);
1816
1817 GET_ED_OR_RETURN();
1818 //printf("SET TAG VALUE for '%s' FOR STYLE '%s'\n", tag, style);
1819
1820 if (!ed->file || !ed->file->styles || !style || !tag)
1821 return;
1822
1823 t = _edje_edit_style_tag_get(ed, style, tag);
1824 if (!t) return;
1825 _edje_if_string_free(ed, t->value);
1826 t->value = eina_stringshare_add(new_value);
1827}
1828
1829EAPI Eina_Bool
1830edje_edit_style_tag_add(Evas_Object * obj, const char* style, const char* tag_name)
1831{
1832 Edje_Style *s;
1833 Edje_Style_Tag *t;
1834
1835 eina_error_set(0);
1836
1837 GET_ED_OR_RETURN(EINA_FALSE);
1838 //printf("ADD TAG '%s' IN STYLE '%s'\n", tag_name, style);
1839
1840 t = _edje_edit_style_tag_get(ed, style, tag_name);
1841 if (t) return EINA_FALSE;
1842 s = _edje_edit_style_get(ed, style);
1843 if (!s) return EINA_FALSE;
1844
1845 t = _alloc(sizeof(Edje_Style_Tag));
1846 if (!t) return EINA_FALSE;
1847 t->key = eina_stringshare_add(tag_name);
1848 t->value = NULL;
1849 t->font = NULL;
1850 t->text_class = NULL;
1851
1852 s->tags = eina_list_append(s->tags, t);
1853 return EINA_TRUE;
1854}
1855
1856EAPI void
1857edje_edit_style_tag_del(Evas_Object * obj, const char* style, const char* tag)
1858{
1859 Edje_Style *s;
1860 Edje_Style_Tag *t;
1861
1862 eina_error_set(0);
1863
1864 GET_ED_OR_RETURN();
1865 //printf("DEL TAG '%s' IN STYLE '%s'\n", tag, style);
1866
1867 s = _edje_edit_style_get(ed, style);
1868 t = _edje_edit_style_tag_get(ed, style, tag);
1869
1870 s->tags = eina_list_remove(s->tags, t);
1871 _edje_if_string_free(ed, t->key);
1872 _edje_if_string_free(ed, t->value);
1873 _edje_if_string_free(ed, t->font);
1874 _edje_if_string_free(ed, t->text_class);
1875 free(t);
1876 t = NULL;
1877}
1878
1879/*******************/
1880/* EXTERNALS API */
1881/*******************/
1882
1883EAPI Eina_List *
1884edje_edit_externals_list_get(Evas_Object *obj)
1885{
1886 Eina_List *externals = NULL;
1887 unsigned int i;
1888
1889 eina_error_set(0);
1890
1891 GET_ED_OR_RETURN(NULL);
1892
1893 if (!ed->file || !ed->file->external_dir)
1894 return NULL;
1895 //printf("GET STYLES LIST %d\n", eina_list_count(ed->file->styles));
1896 for (i = 0; i < ed->file->external_dir->entries_count; ++i)
1897 externals = eina_list_append(externals,
1898 eina_stringshare_add(ed->file->external_dir->entries[i].entry));
1899
1900 return externals;
1901}
1902
1903EAPI Eina_Bool
1904edje_edit_external_add(Evas_Object *obj, const char *external)
1905{
1906 Edje_External_Directory_Entry *e;
1907 unsigned int freeid;
1908 unsigned int i;
1909
1910 eina_error_set(0);
1911
1912 GET_ED_OR_RETURN(EINA_FALSE);
1913
1914 e = _edje_edit_external_get(ed, external);
1915 if (e) return EINA_FALSE;
1916
1917 if (!ed->file->external_dir)
1918 ed->file->external_dir = _alloc(sizeof(Edje_External_Directory));
1919
1920 for (i = 0; i < ed->file->external_dir->entries_count; ++i)
1921 if (!ed->file->external_dir->entries[i].entry)
1922 break ;
1923
1924 if (i == ed->file->external_dir->entries_count)
1925 {
1926 Edje_External_Directory_Entry *tmp;
1927 unsigned int max;
1928
1929 max = ed->file->external_dir->entries_count + 1;
1930 tmp = realloc(ed->file->external_dir->entries,
1931 sizeof (Edje_External_Directory_Entry) * max);
1932
1933 if (!tmp) return EINA_FALSE;
1934
1935 ed->file->external_dir->entries = tmp;
1936 freeid = ed->file->external_dir->entries_count;
1937 ed->file->external_dir->entries_count = max;
1938 }
1939 else
1940 freeid = i;
1941
1942 ed->file->external_dir->entries[freeid].entry = (char*)eina_stringshare_add(external);
1943
1944 return EINA_TRUE;
1945}
1946
1947EAPI Eina_Bool
1948edje_edit_external_del(Evas_Object *obj, const char *external)
1949{
1950 Edje_External_Directory_Entry *e;
1951
1952 eina_error_set(0);
1953
1954 GET_ED_OR_RETURN(EINA_FALSE);
1955
1956 e = _edje_edit_external_get(ed, external);
1957 if (!e) return EINA_FALSE;
1958
1959 _edje_if_string_free(ed, e->entry);
1960 e->entry = NULL;
1961
1962 return EINA_TRUE;
1963}
1964
1965/***************/
1966/* PARTS API */
1967/***************/
1968
1969EAPI Eina_List *
1970edje_edit_parts_list_get(Evas_Object *obj)
1971{
1972 Eina_List *parts = NULL;
1973 unsigned int i;
1974
1975 eina_error_set(0);
1976
1977 GET_ED_OR_RETURN(NULL);
1978
1979 //printf("EE: Found %d parts\n", ed->table_parts_size);
1980
1981 parts = NULL;
1982 for (i = 0; i < ed->table_parts_size; i++)
1983 {
1984 Edje_Real_Part *rp;
1985
1986 rp = ed->table_parts[i];
1987 parts = eina_list_append(parts, eina_stringshare_add(rp->part->name));
1988 }
1989
1990 return parts;
1991}
1992
1993EAPI Eina_Bool
1994edje_edit_part_name_set(Evas_Object *obj, const char* part, const char* new_name)
1995{
1996 eina_error_set(0);
1997
1998 GET_RP_OR_RETURN(EINA_FALSE);
1999
2000 if (!new_name) return EINA_FALSE;
2001 if (!strcmp(part, new_name)) return EINA_TRUE;
2002 if (_edje_real_part_get(ed, new_name)) return EINA_FALSE;
2003
2004 //printf("Set name of part: %s [new name: %s]\n", part, new_name);
2005
2006 _edje_if_string_free(ed, rp->part->name);
2007 rp->part->name = (char *)eina_stringshare_add(new_name);
2008
2009 _edje_edit_flag_script_dirty(eed, EINA_TRUE);
2010
2011 return EINA_TRUE;
2012}
2013
2014#define FUNC_PART_API_STRING(Value) \
2015 EAPI const char * \
2016 edje_edit_part_api_##Value##_get(Evas_Object *obj, const char *part) \
2017 { \
2018 eina_error_set(0); \
2019 GET_RP_OR_RETURN(NULL); \
2020 return eina_stringshare_add(rp->part->api.Value); \
2021 } \
2022 EAPI Eina_Bool \
2023 edje_edit_part_api_##Value##_set(Evas_Object *obj, const char *part, const char *s) \
2024 { \
2025 eina_error_set(0); \
2026 GET_RP_OR_RETURN(EINA_FALSE); \
2027 _edje_if_string_free(ed, rp->part->api.Value); \
2028 rp->part->api.Value = eina_stringshare_add(s); \
2029 return EINA_TRUE; \
2030 }
2031
2032FUNC_PART_API_STRING(name);
2033FUNC_PART_API_STRING(description);
2034
2035static Eina_Bool
2036_edje_edit_real_part_add(Evas_Object *obj, const char *name, Edje_Part_Type type, const char *source)
2037{
2038 Edje_Part_Collection_Directory_Entry *ce;
2039 Edje_Part_Collection *pc;
2040 Edje_Part **tmp;
2041 Edje_Part *ep;
2042 Edje_Real_Part *rp;
2043 int id;
2044
2045 GET_ED_OR_RETURN(EINA_FALSE);
2046
2047 //printf("ADD PART: %s [type: %d]\n", name, type);
2048
2049 /* Check if part already exists */
2050 if (_edje_real_part_get(ed, name))
2051 return EINA_FALSE;
2052
2053 ce = eina_hash_find(ed->file->collection, ed->group);
2054
2055 /* Alloc Edje_Part or return */
2056 ep = eina_mempool_malloc(ce->mp.part, sizeof(Edje_Part));
2057 if (!ep) return EINA_FALSE;
2058 memset(ep, 0, sizeof(Edje_Part));
2059
2060 /* Alloc Edje_Real_Part or return */
2061 rp = eina_mempool_malloc(_edje_real_part_mp, sizeof(Edje_Real_Part));
2062 if (!rp)
2063 {
2064 eina_mempool_free(ce->mp.part, ep);
2065 return EINA_FALSE;
2066 }
2067 memset(rp, 0, sizeof(Edje_Real_Part));
2068
2069 /* Init Edje_Part */
2070 pc = ed->collection;
2071
2072 tmp = realloc(pc->parts, (pc->parts_count + 1) * sizeof (Edje_Part *));
2073 if (!tmp)
2074 {
2075 eina_mempool_free(ce->mp.part, ep);
2076 eina_mempool_free(_edje_real_part_mp, rp);
2077 return EINA_FALSE;
2078 }
2079
2080 id = pc->parts_count++;
2081
2082 pc->parts = tmp;
2083 pc->parts[id] = ep;
2084
2085 ep->id = id;
2086 ep->type = type;
2087 ep->name = eina_stringshare_add(name);
2088 ep->mouse_events = 1;
2089 ep->repeat_events = 0;
2090 ep->ignore_flags = EVAS_EVENT_FLAG_NONE;
2091 ep->pointer_mode = EVAS_OBJECT_POINTER_MODE_AUTOGRAB;
2092 ep->precise_is_inside = 0;
2093 ep->use_alternate_font_metrics = 0;
2094 ep->clip_to_id = -1;
2095 ep->dragable.confine_id = -1;
2096 ep->dragable.event_id = -1;
2097 if (source)
2098 ep->source = eina_stringshare_add(source);
2099
2100 ep->default_desc = NULL;
2101 ep->other.desc = NULL;
2102 ep->other.desc_count = 0;
2103
2104 /* Init Edje_Real_Part */
2105 rp->edje = ed;
2106 _edje_ref(rp->edje);
2107 rp->part = ep;
2108
2109 if (ep->type == EDJE_PART_TYPE_RECTANGLE)
2110 rp->object = evas_object_rectangle_add(ed->base.evas);
2111 else if (ep->type == EDJE_PART_TYPE_IMAGE || ep->type == EDJE_PART_TYPE_PROXY)
2112 rp->object = evas_object_image_add(ed->base.evas);
2113 else if (ep->type == EDJE_PART_TYPE_TEXT)
2114 {
2115 _edje_text_part_on_add(ed, rp);
2116 rp->object = evas_object_text_add(ed->base.evas);
2117 evas_object_text_font_source_set(rp->object, ed->path);
2118 }
2119 else if (ep->type == EDJE_PART_TYPE_SWALLOW ||
2120 ep->type == EDJE_PART_TYPE_GROUP ||
2121 ep->type == EDJE_PART_TYPE_EXTERNAL)
2122 {
2123 rp->object = evas_object_rectangle_add(ed->base.evas);
2124 evas_object_color_set(rp->object, 0, 0, 0, 0);
2125 evas_object_pass_events_set(rp->object, 1);
2126 evas_object_pointer_mode_set(rp->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
2127 }
2128 else if (ep->type == EDJE_PART_TYPE_TEXTBLOCK)
2129 rp->object = evas_object_textblock_add(ed->base.evas);
2130 else
2131 ERR("wrong part type %i!", ep->type);
2132 if (rp->object)
2133 {
2134 evas_object_show(rp->object);
2135 evas_object_smart_member_add(rp->object, ed->obj);
2136 evas_object_layer_set(rp->object, evas_object_layer_get(ed->obj));
2137 if (ep->type != EDJE_PART_TYPE_SWALLOW && ep->type != EDJE_PART_TYPE_GROUP)
2138 {
2139 if (ep->mouse_events)
2140 {
2141 _edje_callbacks_add(rp->object, ed, rp);
2142 if (ep->repeat_events)
2143 evas_object_repeat_events_set(rp->object, 1);
2144
2145 if (ep->pointer_mode != EVAS_OBJECT_POINTER_MODE_AUTOGRAB)
2146 evas_object_pointer_mode_set(rp->object, ep->pointer_mode);
2147 }
2148 else
2149 {
2150 evas_object_pass_events_set(rp->object, 1);
2151 evas_object_pointer_mode_set(rp->object,
2152 EVAS_OBJECT_POINTER_MODE_NOGRAB);
2153 }
2154 if (ep->precise_is_inside)
2155 evas_object_precise_is_inside_set(rp->object, 1);
2156 }
2157 if (ep->type == EDJE_PART_TYPE_EXTERNAL)
2158 {
2159 Evas_Object *child;
2160 child = _edje_external_type_add(source, evas_object_evas_get(ed->obj), ed->obj, NULL, name);
2161 if (child)
2162 _edje_real_part_swallow(rp, child, EINA_TRUE);
2163 }
2164 evas_object_clip_set(rp->object, ed->base.clipper);
2165 evas_object_show(ed->base.clipper);
2166 }
2167
2168 /* Update table_parts */
2169 ed->table_parts_size++;
2170 ed->table_parts = realloc(ed->table_parts,
2171 sizeof(Edje_Real_Part *) * ed->table_parts_size);
2172
2173 ed->table_parts[ep->id % ed->table_parts_size] = rp;
2174
2175 /* Create default description */
2176 if (!edje_edit_state_add(obj, name, "default", 0.0))
2177 {
2178 _edje_if_string_free(ed, ep->name);
2179 if (source)
2180 _edje_if_string_free(ed, ep->source);
2181 eina_mempool_free(ce->mp.part, ep);
2182 eina_mempool_free(_edje_real_part_mp, rp);
2183 return EINA_FALSE;
2184 }
2185 edje_edit_part_selected_state_set(obj, name, "default", 0.0);
2186
2187 ce->count.part++;
2188
2189 return EINA_TRUE;
2190}
2191
2192EAPI Eina_Bool
2193edje_edit_part_add(Evas_Object *obj, const char *name, Edje_Part_Type type)
2194{
2195 eina_error_set(0);
2196
2197 if (type == EDJE_PART_TYPE_EXTERNAL)
2198 return EINA_FALSE;
2199 return _edje_edit_real_part_add(obj, name, type, NULL);
2200}
2201
2202EAPI Eina_Bool
2203edje_edit_part_external_add(Evas_Object *obj, const char *name, const char *source)
2204{
2205 eina_error_set(0);
2206
2207 if (!source)
2208 return EINA_FALSE;
2209 return _edje_edit_real_part_add(obj, name, EDJE_PART_TYPE_EXTERNAL, source);
2210}
2211
2212EAPI Eina_Bool
2213edje_edit_part_del(Evas_Object *obj, const char* part)
2214{
2215 Edje_Part_Collection_Directory_Entry *ce;
2216 Edje_Part_Collection *pc;
2217 Edje_Part *ep;
2218 unsigned int k;
2219 unsigned int id;
2220 unsigned int i;
2221
2222 eina_error_set(0);
2223
2224 GET_RP_OR_RETURN(EINA_FALSE);
2225
2226 //printf("REMOVE PART: %s\n", part);
2227
2228 ep = rp->part;
2229 id = ep->id;
2230
2231 /* Unlik Edje_Real_Parts that link to the removed one */
2232 for (i = 0; i < ed->table_parts_size; i++)
2233 {
2234 Edje_Real_Part *real;
2235
2236 if (i == id) continue; //don't check the deleted id
2237 real = ed->table_parts[i];
2238
2239 if (real->text.source == rp) real->text.source = NULL;
2240 if (real->text.text_source == rp) real->text.text_source = NULL;
2241
2242 if (real->param1.rel1_to_x == rp) real->param1.rel1_to_x = NULL;
2243 if (real->param1.rel1_to_y == rp) real->param1.rel1_to_y = NULL;
2244 if (real->param1.rel2_to_x == rp) real->param1.rel2_to_x = NULL;
2245 if (real->param1.rel2_to_y == rp) real->param1.rel2_to_y = NULL;
2246
2247 if (real->param2)
2248 {
2249 if (real->param2->rel1_to_x == rp) real->param2->rel1_to_x = NULL;
2250 if (real->param2->rel1_to_y == rp) real->param2->rel1_to_y = NULL;
2251 if (real->param2->rel2_to_x == rp) real->param2->rel2_to_x = NULL;
2252 if (real->param2->rel2_to_y == rp) real->param2->rel2_to_y = NULL;
2253 }
2254
2255 if (real->custom)
2256 {
2257 if (real->custom->rel1_to_x == rp) real->custom->rel1_to_x = NULL;
2258 if (real->custom->rel1_to_y == rp) real->custom->rel1_to_y = NULL;
2259 if (real->custom->rel2_to_x == rp) real->custom->rel2_to_x = NULL;
2260 if (real->custom->rel2_to_y == rp) real->custom->rel2_to_y = NULL;
2261 }
2262
2263 if (real->clip_to == rp)
2264 {
2265 evas_object_clip_set(real->object, ed->base.clipper);
2266 real->clip_to = NULL;
2267 }
2268 if (real->drag && real->drag->confine_to == rp)
2269 real->drag->confine_to = NULL;
2270 }
2271
2272 /* Unlink all the parts and descriptions that refer to id */
2273 _edje_part_id_set(ed, rp, -1);
2274
2275 /* Remove part from parts list */
2276 pc = ed->collection;
2277 pc->parts_count--;
2278 if (id < pc->parts_count) /* Forward parts */
2279 {
2280 int mcount = (pc->parts_count - id) * sizeof(Edje_Part *);
2281 memmove(&pc->parts[id], &pc->parts[id+1], mcount);
2282 }
2283 pc->parts[pc->parts_count] = NULL;
2284 _edje_fix_parts_id(ed);
2285
2286 /* Free Edje_Part and all descriptions */
2287 ce = eina_hash_find(ed->file->collection, ed->group);
2288
2289 _edje_if_string_free(ed, ep->name);
2290 if (ep->default_desc)
2291 {
2292 _edje_collection_free_part_description_free(ep->type, ep->default_desc, ce, 0);
2293 ep->default_desc = NULL;
2294 }
2295
2296 for (k = 0; k < ep->other.desc_count; ++k)
2297 _edje_collection_free_part_description_free(ep->type, ep->other.desc[k], ce, 0);
2298
2299 free(ep->other.desc);
2300 eina_mempool_free(ce->mp.part, ep);
2301
2302 /* Free Edje_Real_Part */
2303 _edje_real_part_free(rp);
2304
2305 /* if all parts are gone, hide the clipper */
2306 if (ed->table_parts_size == 0)
2307 evas_object_hide(ed->base.clipper);
2308
2309 edje_object_calc_force(obj);
2310
2311 ce->count.part--;
2312
2313 _edje_edit_flag_script_dirty(eed, EINA_TRUE);
2314
2315 return EINA_TRUE;
2316}
2317
2318EAPI Eina_Bool
2319edje_edit_part_exist(Evas_Object *obj, const char *part)
2320{
2321 eina_error_set(0);
2322
2323 GET_RP_OR_RETURN(EINA_FALSE);
2324 return EINA_TRUE;
2325}
2326
2327EAPI const char*
2328edje_edit_part_below_get(Evas_Object *obj, const char* part)
2329{
2330 Edje_Real_Part *prev;
2331
2332 eina_error_set(0);
2333
2334 GET_RP_OR_RETURN(0);
2335
2336 if (rp->part->id < 1) return NULL;
2337
2338 prev = ed->table_parts[(rp->part->id - 1) % ed->table_parts_size];
2339
2340 return eina_stringshare_add(prev->part->name);
2341}
2342
2343EAPI const char*
2344edje_edit_part_above_get(Evas_Object *obj, const char* part)
2345{
2346 Edje_Real_Part *next;
2347
2348 eina_error_set(0);
2349
2350 GET_RP_OR_RETURN(0);
2351
2352 if ((unsigned int) rp->part->id >= ed->table_parts_size - 1) return 0;
2353
2354 next = ed->table_parts[(rp->part->id + 1) % ed->table_parts_size];
2355
2356 return eina_stringshare_add(next->part->name);
2357}
2358
2359EAPI Eina_Bool
2360edje_edit_part_restack_below(Evas_Object *obj, const char* part)
2361{
2362 Edje_Part_Collection *group;
2363 Edje_Real_Part *prev;
2364 Edje_Part *swap;
2365
2366 eina_error_set(0);
2367
2368 GET_RP_OR_RETURN(EINA_FALSE);
2369
2370 //printf("RESTACK PART: %s BELOW\n", part);
2371
2372 if (rp->part->id < 1) return EINA_FALSE;
2373 group = ed->collection;
2374
2375 /* update parts list */
2376 prev = ed->table_parts[(rp->part->id - 1) % ed->table_parts_size];
2377
2378 swap = group->parts[rp->part->id];
2379 group->parts[rp->part->id] = group->parts[prev->part->id];
2380 group->parts[prev->part->id] = swap;
2381
2382 _edje_parts_id_switch(ed, rp, prev);
2383
2384 evas_object_stack_below(rp->object, prev->object);
2385 if (rp->swallowed_object)
2386 evas_object_stack_above(rp->swallowed_object, rp->object);
2387
2388 _edje_edit_flag_script_dirty(eed, EINA_TRUE);
2389
2390 return EINA_TRUE;
2391}
2392
2393EAPI Eina_Bool
2394edje_edit_part_restack_above(Evas_Object *obj, const char* part)
2395{
2396 Edje_Part_Collection *group;
2397 Edje_Real_Part *next;
2398 Edje_Part *swap;
2399
2400 eina_error_set(0);
2401
2402 GET_RP_OR_RETURN(EINA_FALSE);
2403
2404 //printf("RESTACK PART: %s ABOVE\n", part);
2405
2406 if ((unsigned int) rp->part->id >= ed->table_parts_size - 1) return EINA_FALSE;
2407
2408 group = ed->collection;
2409
2410 /* update parts list */
2411 next = ed->table_parts[(rp->part->id + 1) % ed->table_parts_size];
2412
2413 swap = group->parts[rp->part->id];
2414 group->parts[rp->part->id] = group->parts[next->part->id];
2415 group->parts[next->part->id] = swap;
2416
2417 /* update ids */
2418 _edje_parts_id_switch(ed, rp, next);
2419
2420 evas_object_stack_above(rp->object, next->object);
2421 if (rp->swallowed_object)
2422 evas_object_stack_above(rp->swallowed_object, rp->object);
2423
2424 _edje_edit_flag_script_dirty(eed, EINA_TRUE);
2425
2426 return EINA_TRUE;
2427}
2428
2429EAPI Edje_Part_Type
2430edje_edit_part_type_get(Evas_Object *obj, const char *part)
2431{
2432
2433 eina_error_set(0);
2434
2435 GET_RP_OR_RETURN(0);
2436
2437 return rp->part->type;
2438}
2439
2440EAPI const char *
2441edje_edit_part_selected_state_get(Evas_Object *obj, const char *part, double *value)
2442{
2443 eina_error_set(0);
2444
2445 GET_RP_OR_RETURN(NULL);
2446
2447 if (!rp->chosen_description)
2448 {
2449 if (value) *value = 0.0; // FIXME: Make sure edje_edit supports correctly the default having any value
2450 return eina_stringshare_add("default");
2451 }
2452
2453 if (value) *value = rp->chosen_description->state.value;
2454 return eina_stringshare_add(rp->chosen_description->state.name);
2455}
2456
2457EAPI Eina_Bool
2458edje_edit_part_selected_state_set(Evas_Object *obj, const char *part, const char *state, double value)
2459{
2460 Edje_Part_Description_Common *pd;
2461
2462 eina_error_set(0);
2463
2464 GET_RP_OR_RETURN(EINA_FALSE);
2465
2466 pd = _edje_part_description_find_byname(eed, part, state, value);
2467 if (!pd) return EINA_FALSE;
2468
2469 //printf("EDJE: Set state: %s %f\n", pd->state.name, pd->state.value);
2470 _edje_part_description_apply(ed, rp, pd->state.name, pd->state.value, NULL, 0.0);
2471
2472 edje_object_calc_force(obj);
2473 return EINA_TRUE;
2474}
2475
2476EAPI const char *
2477edje_edit_part_clip_to_get(Evas_Object *obj, const char *part)
2478{
2479 Edje_Real_Part *clip = NULL;
2480
2481 eina_error_set(0);
2482
2483 GET_RP_OR_RETURN(NULL);
2484
2485 //printf("Get clip_to for part: %s [to_id: %d]\n", part, rp->part->clip_to_id);
2486 if (rp->part->clip_to_id < 0) return NULL;
2487
2488 clip = ed->table_parts[rp->part->clip_to_id % ed->table_parts_size];
2489 if (!clip || !clip->part || !clip->part->name) return NULL;
2490
2491 return eina_stringshare_add(clip->part->name);
2492}
2493
2494EAPI Eina_Bool
2495edje_edit_part_clip_to_set(Evas_Object *obj, const char *part, const char *clip_to)
2496{
2497 Edje_Real_Part *clip;
2498 Evas_Object *o, *oo;
2499
2500 eina_error_set(0);
2501
2502 GET_RP_OR_RETURN(EINA_FALSE);
2503
2504 /* unset clipping */
2505 if (!clip_to)
2506 {
2507 //printf("UnSet clip_to for part: %s\n", part);
2508
2509 if (rp->clip_to && rp->clip_to->object)
2510 {
2511 evas_object_pointer_mode_set(rp->clip_to->object,
2512 EVAS_OBJECT_POINTER_MODE_AUTOGRAB);
2513 evas_object_clip_unset(rp->object);
2514 }
2515
2516 evas_object_clip_set(rp->object, ed->base.clipper);
2517 if (rp->swallowed_object)
2518 evas_object_clip_set(rp->swallowed_object, ed->base.clipper);
2519
2520 rp->part->clip_to_id = -1;
2521 rp->clip_to = NULL;
2522
2523 edje_object_calc_force(obj);
2524
2525 return EINA_TRUE;
2526 }
2527
2528 /* set clipping */
2529 //printf("Set clip_to for part: %s [to: %s]\n", part, clip_to);
2530 clip = _edje_real_part_get(ed, clip_to);
2531 if (!clip || !clip->part) return EINA_FALSE;
2532 o = clip->object;
2533 while ((oo = evas_object_clip_get(o)))
2534 {
2535 if (o == rp->object)
2536 return EINA_FALSE;
2537 o = oo;
2538 }
2539
2540 rp->part->clip_to_id = clip->part->id;
2541 rp->clip_to = clip;
2542
2543 evas_object_pass_events_set(rp->clip_to->object, 1);
2544 evas_object_pointer_mode_set(rp->clip_to->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
2545 evas_object_clip_set(rp->object, rp->clip_to->object);
2546 if (rp->swallowed_object)
2547 evas_object_clip_set(rp->swallowed_object, rp->clip_to->object);
2548
2549 edje_object_calc_force(obj);
2550
2551 return EINA_TRUE;
2552}
2553
2554EAPI Eina_Bool
2555edje_edit_part_mouse_events_get(Evas_Object *obj, const char *part)
2556{
2557 eina_error_set(0);
2558
2559 GET_RP_OR_RETURN(EINA_FALSE);
2560 //printf("Get mouse_events for part: %s [%d]\n", part, rp->part->mouse_events);
2561 return rp->part->mouse_events;
2562}
2563
2564EAPI void
2565edje_edit_part_mouse_events_set(Evas_Object *obj, const char *part, Eina_Bool mouse_events)
2566{
2567 eina_error_set(0);
2568
2569 GET_RP_OR_RETURN();
2570
2571 if (!rp->object) return;
2572
2573 //printf("Set mouse_events for part: %s [%d]\n", part, mouse_events);
2574
2575 rp->part->mouse_events = mouse_events ? 1 : 0;
2576
2577 if (mouse_events)
2578 {
2579 evas_object_pass_events_set(rp->object, 0);
2580 _edje_callbacks_add(rp->object, ed, rp);
2581 }
2582 else
2583 {
2584 evas_object_pass_events_set(rp->object, 1);
2585 _edje_callbacks_del(rp->object, ed);
2586 }
2587}
2588
2589EAPI Eina_Bool
2590edje_edit_part_repeat_events_get(Evas_Object *obj, const char *part)
2591{
2592 eina_error_set(0);
2593
2594 GET_RP_OR_RETURN(EINA_FALSE);
2595
2596 //printf("Get repeat_events for part: %s [%d]\n", part, rp->part->repeat_events);
2597 return rp->part->repeat_events;
2598}
2599
2600EAPI void
2601edje_edit_part_repeat_events_set(Evas_Object *obj, const char *part, Eina_Bool repeat_events)
2602{
2603 eina_error_set(0);
2604
2605 GET_RP_OR_RETURN();
2606
2607 if (!rp->object) return;
2608
2609 //printf("Set repeat_events for part: %s [%d]\n", part, repeat_events);
2610
2611 rp->part->repeat_events = repeat_events ? 1 : 0;
2612
2613 if (repeat_events)
2614 evas_object_repeat_events_set(rp->object, 1);
2615 else
2616 evas_object_repeat_events_set(rp->object, 0);
2617}
2618
2619EAPI Evas_Event_Flags
2620edje_edit_part_ignore_flags_get(Evas_Object *obj, const char *part)
2621{
2622 eina_error_set(0);
2623
2624 GET_RP_OR_RETURN(0);
2625
2626 return rp->part->ignore_flags;
2627}
2628
2629EAPI void
2630edje_edit_part_ignore_flags_set(Evas_Object *obj, const char *part, Evas_Event_Flags ignore_flags)
2631{
2632 eina_error_set(0);
2633
2634 GET_RP_OR_RETURN();
2635
2636 if (!rp->object) return;
2637 //printf("Set ignore_flags for part: %s [%#x]\n", part, ignore_flags);
2638
2639 rp->part->ignore_flags = ignore_flags;
2640}
2641
2642EAPI void
2643edje_edit_part_scale_set(Evas_Object *obj, const char *part, Eina_Bool scale)
2644{
2645 eina_error_set(0);
2646
2647 GET_RP_OR_RETURN();
2648
2649 rp->part->scale = scale;
2650 edje_object_calc_force(obj);
2651}
2652
2653EAPI Eina_Bool
2654edje_edit_part_scale_get(Evas_Object *obj, const char *part)
2655{
2656 eina_error_set(0);
2657
2658 GET_RP_OR_RETURN(EINA_FALSE);
2659
2660 return rp->part->scale;
2661}
2662
2663EAPI const char *
2664edje_edit_part_source_get(Evas_Object *obj, const char *part)
2665{
2666 //Edje_Real_Part *clip = NULL;
2667 eina_error_set(0);
2668
2669 GET_RP_OR_RETURN(NULL);
2670
2671 //printf("Get source for part: %s\n", part);
2672 if (!rp->part->source) return NULL;
2673
2674 return eina_stringshare_add(rp->part->source);
2675}
2676
2677EAPI Eina_Bool
2678edje_edit_part_source_set(Evas_Object *obj, const char *part, const char *source)
2679{
2680 eina_error_set(0);
2681
2682 GET_RP_OR_RETURN(EINA_FALSE);
2683
2684 Evas_Object *child_obj;
2685 //printf("Set source for part: %s [source: %s]\n", part, source);
2686
2687 if (rp->part->type == EDJE_PART_TYPE_EXTERNAL)
2688 return EINA_FALSE;
2689
2690 _edje_if_string_free(ed, rp->part->source);
2691
2692 if (rp->swallowed_object)
2693 {
2694 _edje_real_part_swallow_clear(rp);
2695 evas_object_del(rp->swallowed_object);
2696 rp->swallowed_object = NULL;
2697 }
2698 if (source)
2699 {
2700 rp->part->source = eina_stringshare_add(source);
2701 child_obj = edje_object_add(ed->base.evas);
2702 edje_object_file_set(child_obj, ed->file->path, source);
2703 _edje_real_part_swallow(rp, child_obj, EINA_TRUE);
2704 }
2705 else
2706 rp->part->source = NULL;
2707 return EINA_TRUE;
2708}
2709
2710EAPI int
2711edje_edit_part_drag_x_get(Evas_Object *obj, const char *part)
2712{
2713 eina_error_set(0);
2714
2715 GET_RP_OR_RETURN(0);
2716 //printf("Get dragX for part: %s\n", part);
2717 return rp->part->dragable.x;
2718}
2719
2720EAPI void
2721edje_edit_part_drag_x_set(Evas_Object *obj, const char *part, int drag)
2722{
2723 eina_error_set(0);
2724
2725 GET_RP_OR_RETURN();
2726 //printf("Set dragX for part: %s\n", part);
2727 rp->part->dragable.x = drag;
2728
2729 if (!drag && !rp->part->dragable.y)
2730 {
2731 free(rp->drag);
2732 rp->drag = NULL;
2733 return ;
2734 }
2735
2736 if (rp->drag) return;
2737
2738 rp->drag = _alloc(sizeof (Edje_Real_Part_Drag));
2739 if (!rp->drag) return;
2740
2741 rp->drag->step.x = rp->part->dragable.step_x;
2742 rp->drag->step.y = rp->part->dragable.step_y;
2743}
2744
2745EAPI int
2746edje_edit_part_drag_y_get(Evas_Object *obj, const char *part)
2747{
2748 eina_error_set(0);
2749
2750 GET_RP_OR_RETURN(0);
2751 //printf("Get dragY for part: %s\n", part);
2752 return rp->part->dragable.y;
2753}
2754
2755EAPI void
2756edje_edit_part_drag_y_set(Evas_Object *obj, const char *part, int drag)
2757{
2758 eina_error_set(0);
2759
2760 GET_RP_OR_RETURN();
2761 //printf("Set dragY for part: %s\n", part);
2762 rp->part->dragable.y = drag;
2763
2764 if (!drag && !rp->part->dragable.x)
2765 {
2766 free(rp->drag);
2767 rp->drag = NULL;
2768 return ;
2769 }
2770
2771 if (rp->drag) return;
2772
2773 rp->drag = _alloc(sizeof (Edje_Real_Part_Drag));
2774 if (!rp->drag) return;
2775
2776 rp->drag->step.x = rp->part->dragable.step_x;
2777 rp->drag->step.y = rp->part->dragable.step_y;
2778}
2779
2780#define FUNC_PART_DRAG_INT(Class, Value) \
2781 EAPI int \
2782 edje_edit_part_drag_##Class##_##Value##_get(Evas_Object *obj, const char *part) \
2783 { \
2784 eina_error_set(0); \
2785 GET_RP_OR_RETURN(0); \
2786 return rp->part->dragable.Class##_##Value; \
2787 } \
2788 EAPI void \
2789 edje_edit_part_drag_##Class##_##Value##_set(Evas_Object *obj, const char *part, int v) \
2790 { \
2791 eina_error_set(0); \
2792 GET_RP_OR_RETURN(); \
2793 rp->part->dragable.Class##_##Value = v; \
2794 }
2795
2796FUNC_PART_DRAG_INT(step, x);
2797FUNC_PART_DRAG_INT(step, y);
2798FUNC_PART_DRAG_INT(count, x);
2799FUNC_PART_DRAG_INT(count, y);
2800
2801#define FUNC_PART_DRAG_ID(Id) \
2802 EAPI const char* \
2803 edje_edit_part_drag_##Id##_get(Evas_Object *obj, const char *part) \
2804 { \
2805 Edje_Real_Part *p; \
2806 \
2807 eina_error_set(0); \
2808 \
2809 GET_RP_OR_RETURN(NULL); \
2810 \
2811 if (rp->part->dragable.Id##_id < 0) \
2812 return NULL; \
2813 \
2814 p = ed->table_parts[rp->part->dragable.Id##_id]; \
2815 return eina_stringshare_add(p->part->name); \
2816 } \
2817 EAPI void \
2818 edje_edit_part_drag_##Id##_set(Evas_Object *obj, const char *part, const char *e) \
2819 { \
2820 Edje_Real_Part *e_part; \
2821 \
2822 eina_error_set(0); \
2823 \
2824 GET_RP_OR_RETURN(); \
2825 if (!e) \
2826 { \
2827 rp->part->dragable.Id##_id = -1; \
2828 return ; \
2829 } \
2830 \
2831 e_part = _edje_real_part_get(ed, e); \
2832 rp->part->dragable.Id##_id = e_part->part->id; \
2833 }
2834
2835FUNC_PART_DRAG_ID(confine);
2836FUNC_PART_DRAG_ID(event);
2837
2838/*********************/
2839/* PART STATES API */
2840/*********************/
2841EAPI Eina_List *
2842edje_edit_part_states_list_get(Evas_Object *obj, const char *part)
2843{
2844 char state_name[PATH_MAX];
2845 Eina_List *states = NULL;
2846 unsigned int i;
2847
2848 eina_error_set(0);
2849
2850 GET_RP_OR_RETURN(NULL);
2851
2852 //Is there a better place to put this? maybe edje_edit_init() ?
2853#ifdef HAVE_LOCALE_H
2854 setlocale(LC_NUMERIC, "C");
2855#endif
2856
2857 states = NULL;
2858
2859 //append default state
2860 snprintf(state_name, PATH_MAX,
2861 "%s %.2f",
2862 rp->part->default_desc->state.name,
2863 rp->part->default_desc->state.value);
2864 states = eina_list_append(states, eina_stringshare_add(state_name));
2865 //printf("NEW STATE def: %s\n", state->state.name);
2866
2867 //append other states
2868 for (i = 0; i < rp->part->other.desc_count; ++i)
2869 {
2870 snprintf(state_name, sizeof(state_name),
2871 "%s %.2f",
2872 rp->part->other.desc[i]->state.name,
2873 rp->part->other.desc[i]->state.value);
2874 states = eina_list_append(states, eina_stringshare_add(state_name));
2875 //printf("NEW STATE: %s\n", state_name);
2876 }
2877 return states;
2878}
2879
2880EAPI Eina_Bool
2881edje_edit_state_name_set(Evas_Object *obj, const char *part, const char *state, double value, const char *new_name, double new_value)
2882{
2883 int part_id;
2884 int i;
2885
2886 eina_error_set(0);
2887
2888 GET_PD_OR_RETURN(EINA_FALSE);
2889 //printf("Set name of state: %s in part: %s [new name: %s]\n",
2890 // part, state, new_name);
2891
2892 if (!new_name) return EINA_FALSE;
2893
2894 /* update programs */
2895 /* update the 'state' field in all programs. update only if program has
2896 a single target */
2897 part_id = _edje_part_id_find(ed, part);
2898 for (i = 0; i < ed->table_programs_size; i++)
2899 {
2900 Edje_Program *epr = ed->table_programs[i];
2901
2902 if (eina_list_count(epr->targets) == 1)
2903 {
2904 Edje_Program_Target *t = eina_list_data_get(epr->targets);
2905
2906 if (t->id == part_id &&
2907 !strcmp(epr->state, pd->state.name) &&
2908 pd->state.value == epr->value)
2909 {
2910 _edje_if_string_free(ed, epr->state);
2911 epr->state = eina_stringshare_add(new_name);
2912 epr->value = value;
2913 }
2914 }
2915 }
2916
2917 /* set name */
2918 _edje_if_string_free(ed, pd->state.name);
2919 pd->state.name = (char *)eina_stringshare_add(new_name);
2920 /* set value */
2921 pd->state.value = new_value;
2922
2923 return EINA_TRUE;
2924}
2925
2926EAPI Eina_Bool
2927edje_edit_state_del(Evas_Object *obj, const char *part, const char *state, double value)
2928{
2929 Edje_Part_Collection_Directory_Entry *ce;
2930 Edje_Part_Description_Common *pd;
2931 unsigned int i;
2932
2933 eina_error_set(0);
2934
2935 GET_RP_OR_RETURN(EINA_FALSE);
2936
2937 if (!edje_edit_state_exist(obj, part, state, value))
2938 return EINA_FALSE;
2939
2940 pd = _edje_part_description_find_byname(eed, part, state, value);
2941 if (!pd) return EINA_FALSE;
2942
2943 /* Don't allow to delete default state, for now at least; */
2944 if (pd == rp->part->default_desc)
2945 return EINA_FALSE;
2946
2947 /* And if we are deleting the current state, go back to default first */
2948 if (pd == rp->chosen_description)
2949 _edje_part_description_apply(ed, rp, "default", 0.0, NULL, 0.0);
2950
2951 ce = eina_hash_find(ed->file->collection, ed->group);
2952
2953 for (i = 0; i < rp->part->other.desc_count; ++i)
2954 if (pd == rp->part->other.desc[i])
2955 {
2956 memmove(rp->part->other.desc + i,
2957 rp->part->other.desc + i + 1,
2958 sizeof (Edje_Part_Description_Common*) * (rp->part->other.desc_count - i - 1));
2959 rp->part->other.desc_count--;
2960 break;
2961 }
2962
2963 _edje_collection_free_part_description_free(rp->part->type, pd, ce, 0);
2964 return EINA_TRUE;
2965}
2966
2967static Edje_Part_Description_Common *
2968_edje_edit_state_alloc(int type, Edje *ed)
2969{
2970 Edje_Part_Collection_Directory_Entry *ce;
2971 Edje_Part_Description_Common *pd = NULL;
2972
2973 ce = eina_hash_find(ed->file->collection, ed->group);
2974
2975 switch (type)
2976 {
2977 case EDJE_PART_TYPE_RECTANGLE:
2978 pd = eina_mempool_malloc(ce->mp.RECTANGLE, sizeof (Edje_Part_Description_Common));
2979 ce->count.RECTANGLE++;
2980 break;
2981 case EDJE_PART_TYPE_SWALLOW:
2982 pd = eina_mempool_malloc(ce->mp.SWALLOW, sizeof (Edje_Part_Description_Common));
2983 ce->count.SWALLOW++;
2984 break;
2985 case EDJE_PART_TYPE_GROUP:
2986 pd = eina_mempool_malloc(ce->mp.GROUP, sizeof (Edje_Part_Description_Common));
2987 ce->count.GROUP++;
2988 break;
2989
2990#define EDIT_ALLOC_POOL(Short, Type, Name) \
2991 case EDJE_PART_TYPE_##Short: \
2992 { \
2993 Edje_Part_Description_##Type *Name; \
2994 \
2995 Name = eina_mempool_malloc(ce->mp.Short, \
2996 sizeof (Edje_Part_Description_##Type)); \
2997 memset(Name, 0, sizeof(Edje_Part_Description_##Type)); \
2998 pd = &Name->common; \
2999 ce->count.Short++; \
3000 break; \
3001 }
3002
3003 EDIT_ALLOC_POOL(IMAGE, Image, image);
3004 EDIT_ALLOC_POOL(TEXT, Text, text);
3005 EDIT_ALLOC_POOL(TEXTBLOCK, Text, text);
3006 EDIT_ALLOC_POOL(BOX, Box, box);
3007 EDIT_ALLOC_POOL(TABLE, Table, table);
3008 EDIT_ALLOC_POOL(EXTERNAL, External, external_params);
3009 }
3010
3011 return pd;
3012}
3013
3014EAPI Eina_Bool
3015edje_edit_state_add(Evas_Object *obj, const char *part, const char *name, double value)
3016{
3017 Edje_Part_Description_Common *pd;
3018
3019 GET_RP_OR_RETURN(EINA_FALSE);
3020
3021 if (edje_edit_state_exist(obj, part, name, value))
3022 return EINA_FALSE;
3023
3024 //printf("ADD STATE: %s TO PART: %s\n", name , part);
3025 pd = _edje_edit_state_alloc(rp->part->type, ed);
3026 if (!pd) return EINA_FALSE;
3027
3028 if (!rp->part->default_desc)
3029 {
3030 rp->part->default_desc = pd;
3031 }
3032 else
3033 {
3034 Edje_Part_Description_Common **tmp;
3035
3036 tmp = realloc(rp->part->other.desc,
3037 sizeof (Edje_Part_Description_Common *) * (rp->part->other.desc_count + 1));
3038 if (!tmp)
3039 {
3040 free(pd);
3041 return EINA_FALSE;
3042 }
3043 rp->part->other.desc = tmp;
3044 rp->part->other.desc[rp->part->other.desc_count++] = pd;
3045 }
3046
3047 memset(pd, 0, sizeof (*pd));
3048
3049 pd->state.name = eina_stringshare_add(name);
3050 pd->state.value = value;
3051 pd->visible = 1;
3052 pd->align.x = 0.5;
3053 pd->align.y = 0.5;
3054 pd->min.w = 0;
3055 pd->min.h = 0;
3056 pd->fixed.w = 0;
3057 pd->fixed.h = 0;
3058 pd->max.w = -1;
3059 pd->max.h = -1;
3060 pd->rel1.relative_x = 0.0;
3061 pd->rel1.relative_y = 0.0;
3062 pd->rel1.offset_x = 0;
3063 pd->rel1.offset_y = 0;
3064 pd->rel1.id_x = -1;
3065 pd->rel1.id_y = -1;
3066 pd->rel2.relative_x = 1.0;
3067 pd->rel2.relative_y = 1.0;
3068 pd->rel2.offset_x = -1;
3069 pd->rel2.offset_y = -1;
3070 pd->rel2.id_x = -1;
3071 pd->rel2.id_y = -1;
3072 pd->color_class = NULL;
3073 pd->color.r = 255;
3074 pd->color.g = 255;
3075 pd->color.b = 255;
3076 pd->color.a = 255;
3077 pd->color2.r = 0;
3078 pd->color2.g = 0;
3079 pd->color2.b = 0;
3080 pd->color2.a = 255;
3081 pd->map.id_persp = -1;
3082 pd->map.id_light = -1;
3083 pd->map.rot.id_center = -1;
3084 pd->map.rot.x = FROM_DOUBLE(0.0);
3085 pd->map.rot.y = FROM_DOUBLE(0.0);
3086 pd->map.rot.z = FROM_DOUBLE(0.0);
3087 pd->map.on = 0;
3088 pd->map.smooth = 1;
3089 pd->map.alpha = 1;
3090 pd->map.backcull = 0;
3091 pd->map.persp_on = 0;
3092 pd->persp.zplane = 0;
3093 pd->persp.focal = 1000;
3094
3095 if (rp->part->type == EDJE_PART_TYPE_TEXT
3096 || rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
3097 {
3098 Edje_Part_Description_Text *text;
3099
3100 text = (Edje_Part_Description_Text*) pd;
3101
3102 memset(&text->text, 0, sizeof (text->text));
3103
3104 text->text.color3.r = 0;
3105 text->text.color3.g = 0;
3106 text->text.color3.b = 0;
3107 text->text.color3.a = 128;
3108 text->text.align.x = 0.5;
3109 text->text.align.y = 0.5;
3110 text->text.id_source = -1;
3111 text->text.id_text_source = -1;
3112 }
3113 else if (rp->part->type == EDJE_PART_TYPE_IMAGE)
3114 {
3115 Edje_Part_Description_Image *img;
3116
3117 img = (Edje_Part_Description_Image*) pd;
3118
3119 memset(&img->image, 0, sizeof (img->image));
3120
3121 img->image.id = -1;
3122 img->image.fill.smooth = 1;
3123 img->image.fill.pos_rel_x = 0.0;
3124 img->image.fill.pos_abs_x = 0;
3125 img->image.fill.rel_x = 1.0;
3126 img->image.fill.abs_x = 0;
3127 img->image.fill.pos_rel_y = 0.0;
3128 img->image.fill.pos_abs_y = 0;
3129 img->image.fill.rel_y = 1.0;
3130 img->image.fill.abs_y = 0;
3131 img->image.fill.angle = 0;
3132 img->image.fill.spread = 0;
3133 img->image.fill.type = EDJE_FILL_TYPE_SCALE;
3134 }
3135 else if (rp->part->type == EDJE_PART_TYPE_PROXY)
3136 {
3137 Edje_Part_Description_Proxy *pro;
3138
3139 pro = (Edje_Part_Description_Proxy*) pd;
3140
3141 memset(&pro->proxy, 0, sizeof (pro->proxy));
3142
3143 pro->proxy.id = -1;
3144 pro->proxy.fill.smooth = 1;
3145 pro->proxy.fill.pos_rel_x = 0.0;
3146 pro->proxy.fill.pos_abs_x = 0;
3147 pro->proxy.fill.rel_x = 1.0;
3148 pro->proxy.fill.abs_x = 0;
3149 pro->proxy.fill.pos_rel_y = 0.0;
3150 pro->proxy.fill.pos_abs_y = 0;
3151 pro->proxy.fill.rel_y = 1.0;
3152 pro->proxy.fill.abs_y = 0;
3153 pro->proxy.fill.angle = 0;
3154 pro->proxy.fill.spread = 0;
3155 pro->proxy.fill.type = EDJE_FILL_TYPE_SCALE;
3156 }
3157 else if (rp->part->type == EDJE_PART_TYPE_EXTERNAL)
3158 {
3159 Edje_Part_Description_External *external;
3160 Edje_External_Param_Info *pi;
3161
3162 external = (Edje_Part_Description_External*) pd;
3163
3164 external->external_params = NULL;
3165
3166 if (rp->part->source)
3167 {
3168 pi = (Edje_External_Param_Info *)edje_external_param_info_get(rp->part->source);
3169 while (pi && pi->name)
3170 {
3171 Edje_External_Param *p;
3172 p = _alloc(sizeof(Edje_External_Param));
3173 /* error checking.. meh */
3174 p->name = eina_stringshare_add(pi->name);
3175 p->type = pi->type;
3176 switch(p->type)
3177 {
3178 case EDJE_EXTERNAL_PARAM_TYPE_INT:
3179 case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
3180 if (pi->info.i.def != EDJE_EXTERNAL_INT_UNSET)
3181 p->i = pi->info.i.def;
3182 break;
3183 case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
3184 if (pi->info.d.def != EDJE_EXTERNAL_DOUBLE_UNSET)
3185 p->d = pi->info.d.def;
3186 break;
3187 case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
3188 if (pi->info.c.def)
3189 p->s = eina_stringshare_add(pi->info.c.def);
3190 break;
3191 case EDJE_EXTERNAL_PARAM_TYPE_STRING:
3192 if (pi->info.s.def)
3193 p->s = eina_stringshare_add(pi->info.s.def);
3194 break;
3195 default:
3196 ERR("unknown external parameter type '%d'", p->type);
3197 }
3198 external->external_params = eina_list_append(external->external_params, p);
3199 pi++;
3200 }
3201 if (external->external_params)
3202 rp->param1.external_params = _edje_external_params_parse(rp->swallowed_object, external->external_params);
3203 }
3204 }
3205 else if (rp->part->type == EDJE_PART_TYPE_BOX)
3206 {
3207 Edje_Part_Description_Box *box;
3208
3209 box = (Edje_Part_Description_Box*) pd;
3210 memset(&box->box, 0, sizeof (box->box));
3211 }
3212 else if (rp->part->type == EDJE_PART_TYPE_TABLE)
3213 {
3214 Edje_Part_Description_Table *table;
3215
3216 table = (Edje_Part_Description_Table*) pd;
3217 memset(&table->table, 0, sizeof (table->table));
3218 }
3219
3220 return EINA_TRUE;
3221}
3222
3223EAPI Eina_Bool
3224edje_edit_state_exist(Evas_Object *obj, const char *part, const char *state, double value)
3225{
3226 eina_error_set(0);
3227
3228 GET_PD_OR_RETURN(EINA_FALSE);
3229 return EINA_TRUE;
3230}
3231
3232EAPI Eina_Bool
3233edje_edit_state_copy(Evas_Object *obj, const char *part, const char *from, double val_from, const char *to, double val_to)
3234{
3235 Edje_Part_Description_Common *pdfrom, *pdto;
3236 Edje_External_Param *p;
3237
3238 eina_error_set(0);
3239
3240 GET_RP_OR_RETURN(EINA_FALSE);
3241
3242 pdfrom = _edje_part_description_find_byname(eed, part, from, val_from);
3243 if (!pdfrom)
3244 return EINA_FALSE;
3245
3246 pdto = _edje_part_description_find_byname(eed, part, to, val_to);
3247 if (!pdto)
3248 {
3249 Edje_Part_Description_Common **tmp;
3250
3251 pdto = _edje_edit_state_alloc(rp->part->type, ed);
3252 if (!pdto) return EINA_FALSE;
3253 /* No need to check for default desc, at this point it must exist */
3254
3255 tmp = realloc(rp->part->other.desc,
3256 sizeof (Edje_Part_Description_Common *) * (rp->part->other.desc_count + 1));
3257 if (!tmp)
3258 {
3259 free(pdto);
3260 return EINA_FALSE;
3261 }
3262 rp->part->other.desc = tmp;
3263 rp->part->other.desc[rp->part->other.desc_count++] = pdto;
3264 }
3265
3266#define PD_STRING_COPY(To, From, _x) \
3267 _edje_if_string_free(ed, To->_x); \
3268 To->_x = (char *)eina_stringshare_add(From->_x);
3269
3270 /* Copy all value */
3271 *pdto = *pdfrom;
3272 /* Keeping the pdto state name and value */
3273 pdto->state.name = eina_stringshare_add(to);
3274 pdto->state.value = val_to;
3275 /* Update pointer. */
3276 PD_STRING_COPY(pdto, pdfrom, color_class);
3277
3278 switch (rp->part->type)
3279 {
3280 case EDJE_PART_TYPE_PROXY:
3281 {
3282 Edje_Part_Description_Proxy *pro_to = (Edje_Part_Description_Proxy*) pdto;
3283 Edje_Part_Description_Proxy *pro_from = (Edje_Part_Description_Proxy*) pdfrom;
3284
3285 pro_to->proxy = pro_from->proxy;
3286
3287 break;
3288 }
3289 case EDJE_PART_TYPE_IMAGE:
3290 {
3291 Edje_Part_Description_Image *img_to = (Edje_Part_Description_Image*) pdto;
3292 Edje_Part_Description_Image *img_from = (Edje_Part_Description_Image*) pdfrom;
3293 unsigned int i;
3294
3295 img_to->image = img_from->image;
3296
3297 /* Update pointers. */
3298 for (i = 0; i < img_to->image.tweens_count; ++i)
3299 free(img_to->image.tweens[i]);
3300 if (img_to->image.tweens_count > 0)
3301 free(img_to->image.tweens);
3302
3303 img_to->image.tweens_count = img_from->image.tweens_count;
3304 img_to->image.tweens = calloc(img_to->image.tweens_count,
3305 sizeof (Edje_Part_Image_Id*));
3306 if (!img_to->image.tweens)
3307 break;
3308
3309 for (i = 0; i < img_to->image.tweens_count; ++i)
3310 {
3311 Edje_Part_Image_Id *new_i;
3312 new_i = _alloc(sizeof(Edje_Part_Image_Id));
3313 if (!new_i) continue ;
3314
3315 *new_i = *img_from->image.tweens[i];
3316
3317 img_to->image.tweens[i] = new_i;
3318 }
3319 break;
3320 }
3321 case EDJE_PART_TYPE_TEXT:
3322 case EDJE_PART_TYPE_TEXTBLOCK:
3323 {
3324 Edje_Part_Description_Text *text_to = (Edje_Part_Description_Text*) pdto;
3325 Edje_Part_Description_Text *text_from = (Edje_Part_Description_Text*) pdfrom;
3326
3327 text_to->text = text_from->text;
3328
3329 /* Update pointers. */
3330 PD_STRING_COPY(text_to, text_from, text.text.str);
3331 PD_STRING_COPY(text_to, text_from, text.text_class);
3332 PD_STRING_COPY(text_to, text_from, text.style.str);
3333 PD_STRING_COPY(text_to, text_from, text.font.str);
3334 PD_STRING_COPY(text_to, text_from, text.repch.str);
3335 break;
3336 }
3337 case EDJE_PART_TYPE_BOX:
3338 {
3339 Edje_Part_Description_Box *box_to = (Edje_Part_Description_Box*) pdto;
3340 Edje_Part_Description_Box *box_from = (Edje_Part_Description_Box*) pdfrom;
3341
3342 box_to->box = box_from->box;
3343
3344 PD_STRING_COPY(box_to, box_from, box.layout);
3345 PD_STRING_COPY(box_to, box_from, box.alt_layout);
3346 break;
3347 }
3348 case EDJE_PART_TYPE_TABLE:
3349 {
3350 Edje_Part_Description_Table *table_to = (Edje_Part_Description_Table*) pdto;
3351 Edje_Part_Description_Table *table_from = (Edje_Part_Description_Table*) pdfrom;
3352
3353 table_to->table = table_from->table;
3354 break;
3355 }
3356 case EDJE_PART_TYPE_EXTERNAL:
3357 {
3358 Edje_Part_Description_External *ext_to = (Edje_Part_Description_External*) pdto;
3359 Edje_Part_Description_External *ext_from = (Edje_Part_Description_External*) pdfrom;
3360 Eina_List *l;
3361
3362 /* XXX: optimize this, most likely we don't need to remove and add */
3363 EINA_LIST_FREE(ext_to->external_params, p)
3364 {
3365 _edje_if_string_free(ed, p->name);
3366 if (p->s)
3367 _edje_if_string_free(ed, p->s);
3368 free(p);
3369 }
3370 EINA_LIST_FOREACH(ext_from->external_params, l, p)
3371 {
3372 Edje_External_Param *new_p;
3373 new_p = _alloc(sizeof(Edje_External_Param));
3374 new_p->name = eina_stringshare_add(p->name);
3375 new_p->type = p->type;
3376 switch (p->type)
3377 {
3378 case EDJE_EXTERNAL_PARAM_TYPE_INT:
3379 new_p->i = p->i;
3380 break;
3381 case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
3382 new_p->d = p->d;
3383 break;
3384 case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
3385 case EDJE_EXTERNAL_PARAM_TYPE_STRING:
3386 new_p->s = eina_stringshare_add(p->s);
3387 break;
3388 default:
3389 break;
3390 }
3391 ext_to->external_params = eina_list_append(ext_to->external_params, new_p);
3392 }
3393 break;
3394 }
3395 }
3396
3397#undef PD_STRING_COPY
3398
3399 return EINA_TRUE;
3400}
3401
3402#define FUNC_STATE_RELATIVE_DOUBLE(Sub, Value) \
3403 EAPI double \
3404 edje_edit_state_##Sub##_relative_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \
3405 { \
3406 eina_error_set(0); \
3407 GET_PD_OR_RETURN(0); \
3408 return TO_DOUBLE(pd->Sub.relative_##Value); \
3409 } \
3410 EAPI void \
3411 edje_edit_state_##Sub##_relative_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \
3412 { \
3413 eina_error_set(0); \
3414 GET_PD_OR_RETURN(); \
3415 pd->Sub.relative_##Value = FROM_DOUBLE(v); \
3416 edje_object_calc_force(obj); \
3417 }
3418
3419FUNC_STATE_RELATIVE_DOUBLE(rel1, x);
3420FUNC_STATE_RELATIVE_DOUBLE(rel1, y);
3421FUNC_STATE_RELATIVE_DOUBLE(rel2, x);
3422FUNC_STATE_RELATIVE_DOUBLE(rel2, y);
3423
3424#define FUNC_STATE_OFFSET_INT(Sub, Value) \
3425 EAPI int \
3426 edje_edit_state_##Sub##_offset_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \
3427 { \
3428 eina_error_set(0); \
3429 GET_PD_OR_RETURN(0); \
3430 return pd->Sub.offset_##Value; \
3431 } \
3432 EAPI void \
3433 edje_edit_state_##Sub##_offset_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \
3434 { \
3435 eina_error_set(0); \
3436 GET_PD_OR_RETURN(); \
3437 pd->Sub.offset_##Value = TO_INT(FROM_DOUBLE(v)); \
3438 edje_object_calc_force(obj); \
3439 }
3440
3441FUNC_STATE_OFFSET_INT(rel1, x);
3442FUNC_STATE_OFFSET_INT(rel1, y);
3443FUNC_STATE_OFFSET_INT(rel2, x);
3444FUNC_STATE_OFFSET_INT(rel2, y);
3445
3446#define FUNC_STATE_REL(Sub, Value) \
3447 EAPI const char * \
3448 edje_edit_state_##Sub##_to_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \
3449 { \
3450 Edje_Real_Part *rel; \
3451 \
3452 eina_error_set(0); \
3453 \
3454 GET_PD_OR_RETURN(NULL); \
3455 \
3456 if (pd->Sub.id_##Value == -1) return NULL; \
3457 \
3458 rel = ed->table_parts[pd->Sub.id_##Value % ed->table_parts_size]; \
3459 \
3460 if (rel->part->name) return eina_stringshare_add(rel->part->name); \
3461 return NULL; \
3462 } \
3463 EAPI void \
3464 edje_edit_state_##Sub##_to_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, const char *to) \
3465 { \
3466 Edje_Real_Part *relp; \
3467 \
3468 eina_error_set(0); \
3469 \
3470 GET_PD_OR_RETURN(); \
3471 \
3472 if (to) \
3473 { \
3474 relp = _edje_real_part_get(ed, to); \
3475 if (!relp) return; \
3476 pd->Sub.id_##Value = relp->part->id; \
3477 } \
3478 else \
3479 pd->Sub.id_##Value = -1; \
3480 \
3481 }
3482//note after this call edje_edit_part_selected_state_set() to update !! need to fix this
3483//_edje_part_description_apply(ed, rp, pd->state.name, pd->state.value, "state", 0.1); //Why segfault??
3484// edje_object_calc_force(obj);//don't work for redraw
3485
3486FUNC_STATE_REL(rel1, x);
3487FUNC_STATE_REL(rel1, y);
3488FUNC_STATE_REL(rel2, x);
3489FUNC_STATE_REL(rel2, y);
3490
3491//colors
3492#define FUNC_COLOR(Code) \
3493 EAPI void \
3494 edje_edit_state_##Code##_get(Evas_Object *obj, const char *part, const char *state, double value, int *r, int *g, int *b, int *a) \
3495 { \
3496 eina_error_set(0); \
3497 GET_PD_OR_RETURN(); \
3498 \
3499 if (r) *r = pd->Code.r; \
3500 if (g) *g = pd->Code.g; \
3501 if (b) *b = pd->Code.b; \
3502 if (a) *a = pd->Code.a; \
3503 } \
3504 EAPI void \
3505 edje_edit_state_##Code##_set(Evas_Object *obj, const char *part, const char *state, double value, int r, int g, int b, int a) \
3506 { \
3507 eina_error_set(0); \
3508 GET_PD_OR_RETURN(); \
3509 \
3510 if (r > -1 && r < 256) pd->Code.r = r; \
3511 if (g > -1 && g < 256) pd->Code.g = g; \
3512 if (b > -1 && b < 256) pd->Code.b = b; \
3513 if (a > -1 && a < 256) pd->Code.a = a; \
3514 \
3515 edje_object_calc_force(obj); \
3516 }
3517
3518FUNC_COLOR(color);
3519FUNC_COLOR(color2);
3520
3521EAPI void
3522edje_edit_state_color3_get(Evas_Object *obj, const char *part, const char *state, double value, int *r, int *g, int *b, int *a)
3523{
3524 Edje_Part_Description_Text *txt;
3525
3526 eina_error_set(0);
3527
3528 GET_PD_OR_RETURN();
3529
3530 if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
3531 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
3532 {
3533 if (r) *r = 0;
3534 if (g) *g = 0;
3535 if (b) *b = 0;
3536 if (a) *a = 0;
3537 return;
3538 }
3539
3540 txt = (Edje_Part_Description_Text*) pd;
3541
3542 if (r) *r = txt->text.color3.r;
3543 if (g) *g = txt->text.color3.g;
3544 if (b) *b = txt->text.color3.b;
3545 if (a) *a = txt->text.color3.a;
3546}
3547
3548EAPI void
3549edje_edit_state_color3_set(Evas_Object *obj, const char *part, const char *state, double value, int r, int g, int b, int a)
3550{
3551 Edje_Part_Description_Text *txt;
3552
3553 eina_error_set(0);
3554
3555 GET_PD_OR_RETURN();
3556
3557 if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
3558 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
3559 return;
3560
3561 txt = (Edje_Part_Description_Text*) pd;
3562
3563 if (r > -1 && r < 256) txt->text.color3.r = r;
3564 if (g > -1 && g < 256) txt->text.color3.g = g;
3565 if (b > -1 && b < 256) txt->text.color3.b = b;
3566 if (a > -1 && a < 256) txt->text.color3.a = a;
3567
3568 edje_object_calc_force(obj);
3569}
3570
3571#define FUNC_STATE_DOUBLE(Class, Value) \
3572 EAPI double \
3573 edje_edit_state_##Class##_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \
3574 { \
3575 eina_error_set(0); \
3576 GET_PD_OR_RETURN(0); \
3577 return TO_DOUBLE(pd->Class.Value); \
3578 } \
3579 EAPI void \
3580 edje_edit_state_##Class##_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \
3581 { \
3582 eina_error_set(0); \
3583 GET_PD_OR_RETURN(); \
3584 pd->Class.Value = FROM_DOUBLE(v); \
3585 edje_object_calc_force(obj); \
3586 }
3587
3588#define FUNC_STATE_INT(Class, Value) \
3589 EAPI int \
3590 edje_edit_state_##Class##_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \
3591 { \
3592 eina_error_set(0); \
3593 GET_PD_OR_RETURN(0); \
3594 return pd->Class.Value; \
3595 } \
3596 EAPI void \
3597 edje_edit_state_##Class##_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, int v) \
3598 { \
3599 eina_error_set(0); \
3600 GET_PD_OR_RETURN(); \
3601 pd->Class.Value = v; \
3602 edje_object_calc_force(obj); \
3603 }
3604
3605FUNC_STATE_DOUBLE(align, x);
3606FUNC_STATE_DOUBLE(align, y);
3607FUNC_STATE_INT(min, w);
3608FUNC_STATE_INT(min, h);
3609FUNC_STATE_INT(max, w);
3610FUNC_STATE_INT(max, h);
3611FUNC_STATE_DOUBLE(aspect, min);
3612FUNC_STATE_DOUBLE(aspect, max);
3613
3614#define FUNC_STATE_DOUBLE_FILL(Class, Type, Value) \
3615 EAPI double \
3616 edje_edit_state_fill_##Type##_relative_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \
3617 { \
3618 eina_error_set(0); \
3619 \
3620 GET_PD_OR_RETURN(0); \
3621 \
3622 switch (rp->part->type) \
3623 { \
3624 case EDJE_PART_TYPE_IMAGE: \
3625 { \
3626 Edje_Part_Description_Image *img; \
3627 \
3628 img = (Edje_Part_Description_Image*) pd; \
3629 \
3630 return TO_DOUBLE(img->image.fill.Class##rel_##Value); \
3631 } \
3632 case EDJE_PART_TYPE_PROXY: \
3633 { \
3634 Edje_Part_Description_Proxy *pro; \
3635 \
3636 pro = (Edje_Part_Description_Proxy*) pd; \
3637 \
3638 return TO_DOUBLE(pro->proxy.fill.Class##rel_##Value); \
3639 } \
3640 } \
3641 \
3642 return 0; \
3643 } \
3644 EAPI void \
3645 edje_edit_state_fill_##Type##_relative_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \
3646 { \
3647 eina_error_set(0); \
3648 \
3649 GET_PD_OR_RETURN(); \
3650 \
3651 switch (rp->part->type) \
3652 { \
3653 case EDJE_PART_TYPE_IMAGE: \
3654 { \
3655 Edje_Part_Description_Image *img; \
3656 \
3657 img = (Edje_Part_Description_Image*) pd; \
3658 \
3659 img->image.fill.Class##rel_##Value = FROM_DOUBLE(v); \
3660 \
3661 break; \
3662 } \
3663 case EDJE_PART_TYPE_PROXY: \
3664 { \
3665 Edje_Part_Description_Proxy *pro; \
3666 \
3667 pro = (Edje_Part_Description_Proxy*) pd; \
3668 \
3669 pro->proxy.fill.Class##rel_##Value = FROM_DOUBLE(v); \
3670 \
3671 break; \
3672 } \
3673 default: \
3674 return; \
3675 } \
3676 \
3677 edje_object_calc_force(obj); \
3678 }
3679
3680#define FUNC_STATE_INT_FILL(Class, Type, Value) \
3681 EAPI int \
3682 edje_edit_state_fill_##Type##_offset_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \
3683 { \
3684 eina_error_set(0); \
3685 \
3686 GET_PD_OR_RETURN(0); \
3687 \
3688 switch (rp->part->type) \
3689 { \
3690 case EDJE_PART_TYPE_IMAGE: \
3691 { \
3692 Edje_Part_Description_Image *img; \
3693 \
3694 img = (Edje_Part_Description_Image*) pd; \
3695 \
3696 return img->image.fill.Class##abs_##Value; \
3697 } \
3698 case EDJE_PART_TYPE_PROXY: \
3699 { \
3700 Edje_Part_Description_Proxy *pro; \
3701 \
3702 pro = (Edje_Part_Description_Proxy*) pd; \
3703 \
3704 return pro->proxy.fill.Class##abs_##Value; \
3705 } \
3706 } \
3707 return 0; \
3708 } \
3709 EAPI void \
3710 edje_edit_state_fill_##Type##_offset_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \
3711 { \
3712 eina_error_set(0); \
3713 \
3714 GET_PD_OR_RETURN(); \
3715 \
3716 switch (rp->part->type) \
3717 { \
3718 case EDJE_PART_TYPE_IMAGE: \
3719 { \
3720 Edje_Part_Description_Image *img; \
3721 \
3722 img = (Edje_Part_Description_Image*) pd; \
3723 \
3724 img->image.fill.Class##abs_##Value = FROM_DOUBLE(v); \
3725 return; \
3726 } \
3727 case EDJE_PART_TYPE_PROXY: \
3728 { \
3729 Edje_Part_Description_Proxy *pro; \
3730 \
3731 pro = (Edje_Part_Description_Proxy*) pd; \
3732 \
3733 pro->proxy.fill.Class##abs_##Value = FROM_DOUBLE(v); \
3734 return; \
3735 } \
3736 default: \
3737 return; \
3738 } \
3739 \
3740 edje_object_calc_force(obj); \
3741 }
3742
3743FUNC_STATE_DOUBLE_FILL(pos_, origin, x);
3744FUNC_STATE_DOUBLE_FILL(pos_, origin, y);
3745FUNC_STATE_INT_FILL(pos_, origin, x);
3746FUNC_STATE_INT_FILL(pos_, origin, y);
3747
3748FUNC_STATE_DOUBLE_FILL(, size, x);
3749FUNC_STATE_DOUBLE_FILL(, size, y);
3750FUNC_STATE_INT_FILL(, size, x);
3751FUNC_STATE_INT_FILL(, size, y);
3752
3753EAPI Eina_Bool
3754edje_edit_state_visible_get(Evas_Object *obj, const char *part, const char *state, double value)
3755{
3756 eina_error_set(0);
3757
3758 GET_PD_OR_RETURN(EINA_FALSE);
3759
3760 //printf("Get state visible flag of part: %s state: %s\n", part, state);
3761 return pd->visible;
3762}
3763
3764EAPI void
3765edje_edit_state_visible_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool visible)
3766{
3767 eina_error_set(0);
3768
3769 GET_PD_OR_RETURN();
3770 //printf("Set state visible flag of part: %s state: %s to: %d\n", part, state, visible);
3771 if (visible) pd->visible = 1;
3772 else pd->visible = 0;
3773 edje_object_calc_force(obj);
3774}
3775
3776EAPI unsigned char
3777edje_edit_state_aspect_pref_get(Evas_Object *obj, const char *part, const char *state, double value)
3778{
3779 eina_error_set(0);
3780
3781 GET_PD_OR_RETURN(0);
3782
3783 //printf("GET ASPECT_PREF of state '%s' [%d]\n", state, pd->aspect.prefer);
3784 return pd->aspect.prefer;
3785}
3786
3787EAPI void
3788edje_edit_state_aspect_pref_set(Evas_Object *obj, const char *part, const char *state, double value, unsigned char pref)
3789{
3790 eina_error_set(0);
3791
3792 GET_PD_OR_RETURN();
3793
3794 //printf("SET ASPECT_PREF of state '%s' [to: %d]\n", state, pref);
3795 pd->aspect.prefer = pref;
3796}
3797
3798EAPI const char*
3799edje_edit_state_color_class_get(Evas_Object *obj, const char *part, const char *state, double value)
3800{
3801 eina_error_set(0);
3802
3803 GET_PD_OR_RETURN(NULL);
3804 //printf("Get ColorClass of part: %s state: %s\n", part, state);
3805 return eina_stringshare_add(pd->color_class);
3806}
3807
3808EAPI void
3809edje_edit_state_color_class_set(Evas_Object *obj, const char *part, const char *state, double value, const char *color_class)
3810{
3811 eina_error_set(0);
3812
3813 GET_PD_OR_RETURN();
3814 //printf("Set ColorClass of part: %s state: %s [to: %s]\n", part, state, color_class);
3815 _edje_if_string_free(ed, pd->color_class);
3816 pd->color_class = (char*)eina_stringshare_add(color_class);
3817}
3818
3819EAPI const Eina_List *
3820edje_edit_state_external_params_list_get(Evas_Object *obj, const char *part, const char *state, double value)
3821{
3822 Edje_Part_Description_External *external;
3823
3824 eina_error_set(0);
3825
3826 GET_PD_OR_RETURN(NULL);
3827
3828 if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
3829 return NULL;
3830
3831 external = (Edje_Part_Description_External *) pd;
3832
3833 return external->external_params;
3834}
3835
3836EAPI Eina_Bool
3837edje_edit_state_external_param_get(Evas_Object *obj, const char *part, const char *state, double value, const char *param, Edje_External_Param_Type *type, void **val)
3838{
3839 Edje_Part_Description_External *external;
3840 Edje_External_Param *p;
3841 Eina_List *l;
3842
3843 eina_error_set(0);
3844
3845 GET_PD_OR_RETURN(EINA_FALSE);
3846
3847 if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
3848 return EINA_FALSE;
3849
3850 external = (Edje_Part_Description_External *) pd;
3851
3852 EINA_LIST_FOREACH(external->external_params, l, p)
3853 if (!strcmp(p->name, param))
3854 {
3855 if (type) *type = p->type;
3856 if (val)
3857 switch (p->type)
3858 {
3859 case EDJE_EXTERNAL_PARAM_TYPE_INT:
3860 case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
3861 *val = &p->i;
3862 break;
3863 case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
3864 *val = &p->d;
3865 break;
3866 case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
3867 case EDJE_EXTERNAL_PARAM_TYPE_STRING:
3868 *val = (void *)p->s;
3869 break;
3870 default:
3871 ERR("unknown external parameter type '%d'", p->type);
3872 }
3873 return EINA_TRUE;
3874 }
3875
3876 return EINA_FALSE;
3877}
3878
3879EAPI Eina_Bool
3880edje_edit_state_external_param_int_get(Evas_Object *obj, const char *part, const char *state, double value, const char *param, int *val)
3881{
3882 Edje_Part_Description_External *external;
3883 Edje_External_Param *p;
3884 Eina_List *l;
3885
3886 eina_error_set(0);
3887
3888 GET_PD_OR_RETURN(EINA_FALSE);
3889
3890 if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
3891 {
3892 if (val) *val = 0;
3893 return EINA_FALSE;
3894 }
3895
3896 external = (Edje_Part_Description_External *) pd;
3897
3898 EINA_LIST_FOREACH(external->external_params, l, p)
3899 if (!strcmp(p->name, param))
3900 {
3901 if (p->type != EDJE_EXTERNAL_PARAM_TYPE_INT)
3902 return EINA_FALSE;
3903 if (val)
3904 *val = p->i;
3905 return EINA_TRUE;
3906 }
3907
3908 return EINA_FALSE;
3909}
3910
3911EAPI Eina_Bool
3912edje_edit_state_external_param_bool_get(Evas_Object *obj, const char *part, const char *state, double value, const char *param, Eina_Bool *val)
3913{
3914 Edje_Part_Description_External *external;
3915 Edje_External_Param *p;
3916 Eina_List *l;
3917
3918 eina_error_set(0);
3919
3920 GET_PD_OR_RETURN(EINA_FALSE);
3921
3922 if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
3923 {
3924 if (val) *val = 0;
3925 return EINA_FALSE;
3926 }
3927
3928 external = (Edje_Part_Description_External *) pd;
3929
3930 EINA_LIST_FOREACH(external->external_params, l, p)
3931 if (!strcmp(p->name, param))
3932 {
3933 if (p->type != EDJE_EXTERNAL_PARAM_TYPE_BOOL)
3934 return EINA_FALSE;
3935 if (val)
3936 *val = p->i;
3937 return EINA_TRUE;
3938 }
3939
3940 return EINA_FALSE;
3941}
3942
3943EAPI Eina_Bool
3944edje_edit_state_external_param_double_get(Evas_Object *obj, const char *part, const char *state, double value, const char *param, double *val)
3945{
3946 Edje_Part_Description_External *external;
3947 Edje_External_Param *p;
3948 Eina_List *l;
3949
3950 eina_error_set(0);
3951
3952 GET_PD_OR_RETURN(EINA_FALSE);
3953
3954 if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
3955 {
3956 if (val) *val = 0;
3957 return EINA_FALSE;
3958 }
3959
3960 external = (Edje_Part_Description_External *) pd;
3961
3962 EINA_LIST_FOREACH(external->external_params, l, p)
3963 if (!strcmp(p->name, param))
3964 {
3965 if (p->type != EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
3966 return EINA_FALSE;
3967 if (val)
3968 *val = p->d;
3969 return EINA_TRUE;
3970 }
3971
3972 return EINA_FALSE;
3973}
3974
3975EAPI Eina_Bool
3976edje_edit_state_external_param_string_get(Evas_Object *obj, const char *part, const char *state, double value, const char *param, const char **val)
3977{
3978 Edje_Part_Description_External *external;
3979 Edje_External_Param *p;
3980 Eina_List *l;
3981
3982 eina_error_set(0);
3983
3984 GET_PD_OR_RETURN(EINA_FALSE);
3985
3986 if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
3987 {
3988 if (val) *val = NULL;
3989 return EINA_FALSE;
3990 }
3991
3992 external = (Edje_Part_Description_External *) pd;
3993
3994 EINA_LIST_FOREACH(external->external_params, l, p)
3995 if (!strcmp(p->name, param))
3996 {
3997 if (p->type != EDJE_EXTERNAL_PARAM_TYPE_STRING)
3998 return EINA_FALSE;
3999 if (val)
4000 *val = p->s;
4001 return EINA_TRUE;
4002 }
4003
4004 return EINA_FALSE;
4005}
4006
4007EAPI Eina_Bool
4008edje_edit_state_external_param_choice_get(Evas_Object *obj, const char *part, const char *state, double value, const char *param, const char **val)
4009{
4010 Edje_Part_Description_External *external;
4011 Edje_External_Param *p;
4012 Eina_List *l;
4013
4014 eina_error_set(0);
4015
4016 GET_PD_OR_RETURN(EINA_FALSE);
4017
4018 if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
4019 {
4020 if (val) *val = NULL;
4021 return EINA_FALSE;
4022 }
4023
4024 external = (Edje_Part_Description_External *) pd;
4025
4026 EINA_LIST_FOREACH(external->external_params, l, p)
4027 if (!strcmp(p->name, param))
4028 {
4029 if (p->type != EDJE_EXTERNAL_PARAM_TYPE_CHOICE)
4030 return EINA_FALSE;
4031 if (val)
4032 *val = p->s;
4033 return EINA_TRUE;
4034 }
4035
4036 return EINA_FALSE;
4037}
4038
4039EAPI Eina_Bool
4040edje_edit_state_external_param_set(Evas_Object *obj, const char *part, const char *state, double value, const char *param, Edje_External_Param_Type type, ...)
4041{
4042 va_list ap;
4043 Eina_List *l;
4044 Edje_Part_Description_External *external;
4045 Edje_External_Param *p = NULL, old_p = { 0, 0, 0, 0, 0 };
4046 int found = 0;
4047
4048 eina_error_set(0);
4049
4050 GET_PD_OR_RETURN(EINA_FALSE);
4051
4052 if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
4053 return EINA_FALSE;
4054
4055 external = (Edje_Part_Description_External *) pd;
4056
4057 va_start(ap, type);
4058
4059 EINA_LIST_FOREACH(external->external_params, l, p)
4060 if (!strcmp(p->name, param))
4061 {
4062 found = 1;
4063 old_p = *p;
4064 break;
4065 }
4066
4067 if (!found)
4068 {
4069 p = _alloc(sizeof(Edje_External_Param));
4070 if (!p)
4071 {
4072 va_end(ap);
4073 return EINA_FALSE;
4074 }
4075 p->name = eina_stringshare_add(param);
4076 }
4077
4078 p->type = type;
4079 p->i = 0;
4080 p->d = 0;
4081 _edje_if_string_free(ed, p->s);
4082 p->s = NULL;
4083
4084 switch (type)
4085 {
4086 case EDJE_EXTERNAL_PARAM_TYPE_INT:
4087 case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
4088 p->i = (int)va_arg(ap, int);
4089 break;
4090 case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
4091 p->d = (double)va_arg(ap, double);
4092 break;
4093 case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
4094 case EDJE_EXTERNAL_PARAM_TYPE_STRING:
4095 p->s = eina_stringshare_add((const char *)va_arg(ap, char *));
4096 break;
4097 default:
4098 ERR("unknown external parameter type '%d'", type);
4099 va_end(ap);
4100 if (!found) free(p);
4101 else *p = old_p;
4102 return EINA_FALSE;
4103 }
4104
4105 va_end(ap);
4106
4107 //FIXME:
4108 //For now, we're just setting the value if the state is the selected state.
4109 //This is a conceptual error and is incoherent with the rest of the API!
4110 {
4111 const char *sname;
4112 double svalue;
4113 sname = edje_edit_part_selected_state_get(obj, part, &svalue);
4114 if (!strcmp(state, sname) && svalue == value)
4115 if (!edje_object_part_external_param_set(obj, part, p))
4116 if ((type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) ||
4117 (type == EDJE_EXTERNAL_PARAM_TYPE_STRING))
4118 {
4119 _edje_if_string_free(ed, p->s);
4120 if (!found) free(p);
4121 else *p = old_p;
4122 eina_stringshare_del(sname);
4123 return EINA_FALSE;
4124 }
4125 eina_stringshare_del(sname);
4126 }
4127
4128 if (!found)
4129 external->external_params = eina_list_append(external->external_params, p);
4130
4131 _edje_external_parsed_params_free(rp->swallowed_object,
4132 rp->param1.external_params);
4133 rp->param1.external_params = \
4134 _edje_external_params_parse(rp->swallowed_object,
4135 external->external_params);
4136
4137
4138 return EINA_TRUE;
4139}
4140
4141EAPI Eina_Bool
4142edje_edit_state_external_param_int_set(Evas_Object *obj, const char *part, const char *state, double value, const char *param, int val)
4143{
4144 eina_error_set(0);
4145 return edje_edit_state_external_param_set(obj, part, state, value, param, EDJE_EXTERNAL_PARAM_TYPE_INT, val);
4146}
4147
4148EAPI Eina_Bool
4149edje_edit_state_external_param_bool_set(Evas_Object *obj, const char *part, const char *state, double value, const char *param, Eina_Bool val)
4150{
4151 eina_error_set(0);
4152 return edje_edit_state_external_param_set(obj, part, state, value, param, EDJE_EXTERNAL_PARAM_TYPE_BOOL, (int)val);
4153}
4154
4155EAPI Eina_Bool
4156edje_edit_state_external_param_double_set(Evas_Object *obj, const char *part, const char *state, double value, const char *param, double val)
4157{
4158 eina_error_set(0);
4159 return edje_edit_state_external_param_set(obj, part, state, value, param, EDJE_EXTERNAL_PARAM_TYPE_DOUBLE, val);
4160}
4161
4162EAPI Eina_Bool
4163edje_edit_state_external_param_string_set(Evas_Object *obj, const char *part, const char *state, double value, const char *param, const char *val)
4164{
4165 eina_error_set(0);
4166 return edje_edit_state_external_param_set(obj, part, state, value, param, EDJE_EXTERNAL_PARAM_TYPE_STRING, val);
4167}
4168
4169EAPI Eina_Bool
4170edje_edit_state_external_param_choice_set(Evas_Object *obj, const char *part, const char *state, double value, const char *param, const char *val)
4171{
4172 eina_error_set(0);
4173 return edje_edit_state_external_param_set(obj, part, state, value, param, EDJE_EXTERNAL_PARAM_TYPE_CHOICE, val);
4174}
4175
4176/**************/
4177/* TEXT API */
4178/**************/
4179
4180EAPI const char *
4181edje_edit_state_text_get(Evas_Object *obj, const char *part, const char *state, double value)
4182{
4183 Edje_Part_Description_Text *txt;
4184
4185 eina_error_set(0);
4186
4187 GET_PD_OR_RETURN(NULL);
4188
4189 if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
4190 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
4191 return NULL;
4192
4193 txt = (Edje_Part_Description_Text *) pd;
4194 //printf("GET TEXT of state: %s\n", state);
4195
4196 return eina_stringshare_add(edje_string_get(&txt->text.text));
4197}
4198
4199EAPI void
4200edje_edit_state_text_set(Evas_Object *obj, const char *part, const char *state, double value, const char *text)
4201{
4202 Edje_Part_Description_Text *txt;
4203
4204 eina_error_set(0);
4205
4206 GET_PD_OR_RETURN();
4207
4208 //printf("SET TEXT of state: %s\n", state);
4209
4210 if (!text) return;
4211
4212 if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
4213 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
4214 return;
4215
4216 txt = (Edje_Part_Description_Text *) pd;
4217
4218 _edje_if_string_free(ed, txt->text.text.str);
4219 txt->text.text.str = (char *)eina_stringshare_add(text);
4220 txt->text.text.id = 0;
4221
4222 edje_object_calc_force(obj);
4223}
4224
4225EAPI int
4226edje_edit_state_text_size_get(Evas_Object *obj, const char *part, const char *state, double value)
4227{
4228 Edje_Part_Description_Text *txt;
4229
4230 eina_error_set(0);
4231
4232 GET_PD_OR_RETURN(-1);
4233
4234 if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
4235 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
4236 return -1;
4237
4238 txt = (Edje_Part_Description_Text *) pd;
4239 //printf("GET TEXT_SIZE of state: %s [%d]\n", state, pd->text.size);
4240 return txt->text.size;
4241}
4242
4243EAPI void
4244edje_edit_state_text_size_set(Evas_Object *obj, const char *part, const char *state, double value, int size)
4245{
4246 Edje_Part_Description_Text *txt;
4247
4248 eina_error_set(0);
4249
4250 GET_PD_OR_RETURN();
4251
4252 //printf("SET TEXT_SIZE of state: %s [%d]\n", state, size);
4253
4254 if (size < 0) return;
4255
4256 if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
4257 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
4258 return;
4259
4260 txt = (Edje_Part_Description_Text *) pd;
4261
4262 txt->text.size = size;
4263
4264 edje_object_calc_force(obj);
4265}
4266
4267#define FUNC_TEXT_DOUBLE(Name, Value) \
4268 EAPI double \
4269 edje_edit_state_text_##Name##_get(Evas_Object *obj, const char *part, const char *state, double value) \
4270 { \
4271 Edje_Part_Description_Text *txt; \
4272 \
4273 eina_error_set(0); \
4274 \
4275 GET_PD_OR_RETURN(0); \
4276 \
4277 if ((rp->part->type != EDJE_PART_TYPE_TEXT) && \
4278 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \
4279 return 0; \
4280 \
4281 txt = (Edje_Part_Description_Text *) pd; \
4282 return TO_DOUBLE(txt->text.Value); \
4283 } \
4284 EAPI void \
4285 edje_edit_state_text_##Name##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \
4286 { \
4287 Edje_Part_Description_Text *txt; \
4288 \
4289 eina_error_set(0); \
4290 \
4291 GET_PD_OR_RETURN(); \
4292 \
4293 if ((rp->part->type != EDJE_PART_TYPE_TEXT) && \
4294 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \
4295 return; \
4296 \
4297 txt = (Edje_Part_Description_Text *) pd; \
4298 txt->text.Value = FROM_DOUBLE(v); \
4299 edje_object_calc_force(obj); \
4300 } \
4301
4302FUNC_TEXT_DOUBLE(align_x, align.x);
4303FUNC_TEXT_DOUBLE(align_y, align.y);
4304FUNC_TEXT_DOUBLE(elipsis, elipsis);
4305
4306#define FUNC_TEXT_BOOL_FIT(Value) \
4307 EAPI Eina_Bool \
4308 edje_edit_state_text_fit_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \
4309 { \
4310 Edje_Part_Description_Text *txt; \
4311 \
4312 eina_error_set(0); \
4313 \
4314 GET_PD_OR_RETURN(EINA_FALSE); \
4315 \
4316 if ((rp->part->type != EDJE_PART_TYPE_TEXT) && \
4317 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \
4318 return EINA_FALSE; \
4319 \
4320 txt = (Edje_Part_Description_Text *) pd; \
4321 return txt->text.fit_##Value; \
4322 } \
4323 EAPI void \
4324 edje_edit_state_text_fit_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool fit) \
4325 { \
4326 Edje_Part_Description_Text *txt; \
4327 \
4328 GET_PD_OR_RETURN(); \
4329 \
4330 if ((rp->part->type != EDJE_PART_TYPE_TEXT) && \
4331 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \
4332 return; \
4333 \
4334 txt = (Edje_Part_Description_Text *) pd; \
4335 txt->text.fit_##Value = fit ? 1 : 0; \
4336 edje_object_calc_force(obj); \
4337 }
4338
4339FUNC_TEXT_BOOL_FIT(x);
4340FUNC_TEXT_BOOL_FIT(y);
4341
4342EAPI Eina_List *
4343edje_edit_fonts_list_get(Evas_Object *obj)
4344{
4345 Eina_Iterator *it;
4346 Eina_List *fonts = NULL;
4347 Edje_Font_Directory_Entry *f;
4348
4349 eina_error_set(0);
4350
4351 GET_ED_OR_RETURN(NULL);
4352
4353 if (!ed->file || !ed->file->fonts) return NULL;
4354
4355 it = eina_hash_iterator_data_new(ed->file->fonts);
4356 if (!it) return NULL;
4357
4358 EINA_ITERATOR_FOREACH(it, f)
4359 fonts = eina_list_append(fonts, eina_stringshare_add(f->entry));
4360
4361 eina_iterator_free(it);
4362
4363 return fonts;
4364}
4365
4366EAPI Eina_Bool
4367edje_edit_font_add(Evas_Object *obj, const char* path, const char* alias)
4368{
4369 char entry[PATH_MAX];
4370 char *new_path;
4371 struct stat st;
4372 Edje_Font_Directory_Entry *fnt;
4373
4374 eina_error_set(0);
4375
4376 GET_ED_OR_RETURN(EINA_FALSE);
4377
4378 INF("ADD FONT: %s", path);
4379
4380 if (!path) return EINA_FALSE;
4381 if (stat(path, &st) || !S_ISREG(st.st_mode)) return EINA_FALSE;
4382 if (!ed->file) return EINA_FALSE;
4383 if (!ed->path) return EINA_FALSE;
4384
4385 /* Alias */
4386 if (alias)
4387 {
4388 if ((new_path = strrchr(path, '/'))) new_path ++;
4389 else new_path = (char *)path;
4390 }
4391 else
4392 {
4393 if ((alias = strrchr(path, '/'))) alias ++;
4394 else alias = (char *)path;
4395 new_path = (char *)alias;
4396 }
4397 snprintf(entry, sizeof(entry), "edje/fonts/%s", alias);
4398
4399 /* Initializing a new font hash, if no exist */
4400 if (!ed->file->fonts)
4401 {
4402 ed->file->fonts = eina_hash_string_small_new(NULL);
4403 if (!ed->file->fonts) return EINA_FALSE;
4404 }
4405
4406 /* Check if exists */
4407 fnt = eina_hash_find(ed->file->fonts, alias);
4408 if (fnt)
4409 return EINA_FALSE;
4410
4411 /* Create Edje_Font_Directory_Entry */
4412 fnt = _alloc(sizeof(Edje_Font_Directory_Entry));
4413 if (!fnt)
4414 {
4415 ERR("Unable to alloc font entry part \"%s\"", alias);
4416 return EINA_FALSE;
4417 }
4418 fnt->file = eina_stringshare_add(new_path);
4419 fnt->entry = eina_stringshare_add(alias);
4420
4421 eina_hash_direct_add(ed->file->fonts, fnt->entry, fnt);
4422
4423 /* Import font */
4424 if (!_edje_import_font_file(ed, path, entry))
4425 {
4426 eina_hash_del(ed->file->fonts, fnt->entry, fnt);
4427 eina_stringshare_del(fnt->file);
4428 eina_stringshare_del(fnt->entry);
4429 return EINA_FALSE;
4430 }
4431
4432 return EINA_TRUE;
4433}
4434
4435EAPI Eina_Bool
4436edje_edit_font_del(Evas_Object *obj, const char* alias)
4437{
4438 Edje_Font_Directory_Entry *fnt;
4439
4440 eina_error_set(0);
4441
4442 GET_ED_OR_RETURN(EINA_FALSE);
4443
4444 INF("DEL FONT: %s", alias);
4445
4446 if (!alias) return EINA_FALSE;
4447 if (!ed->file) return EINA_FALSE;
4448 if (!ed->path) return EINA_FALSE;
4449
4450 fnt = eina_hash_find(ed->file->fonts, alias);
4451 if (!fnt)
4452 {
4453 WRN("Unable to find font entry part \"%s\"", alias);
4454 return EINA_FALSE;
4455 }
4456
4457 /* Erase font to edje file */
4458 {
4459 char entry[PATH_MAX];
4460 Eet_File *eetf;
4461
4462 /* open the eet file */
4463 eetf = eet_open(ed->path, EET_FILE_MODE_READ_WRITE);
4464 if (!eetf)
4465 {
4466 ERR("Unable to open \"%s\" for writing output", ed->path);
4467 return EINA_FALSE;
4468 }
4469
4470 snprintf(entry, sizeof(entry), "edje/fonts/%s", alias);
4471
4472 if (eet_delete(eetf, entry) <= 0)
4473 {
4474 ERR("Unable to delete \"%s\" font entry", entry);
4475 eet_close(eetf);
4476 return EINA_FALSE;
4477 }
4478
4479 /* write the edje_file */
4480 if (!_edje_edit_edje_file_save(eetf, ed->file))
4481 {
4482 eet_close(eetf);
4483 return EINA_FALSE;
4484 }
4485 eet_close(eetf);
4486 }
4487
4488 eina_hash_del(ed->file->fonts, alias, fnt);
4489
4490 return EINA_TRUE;
4491}
4492
4493EAPI const char *
4494edje_edit_font_path_get(Evas_Object *obj, const char *alias)
4495{
4496 Eina_Iterator *it;
4497 Edje_Font_Directory_Entry *f;
4498 const char *str = NULL;
4499
4500 eina_error_set(0);
4501
4502 if (!alias) return NULL;
4503 GET_ED_OR_RETURN(NULL);
4504
4505 if (!ed->file || !ed->file->fonts) return NULL;
4506
4507 it = eina_hash_iterator_data_new(ed->file->fonts);
4508 if (!it) return NULL;
4509
4510 EINA_ITERATOR_FOREACH(it, f)
4511 if (!strcmp(f->entry, alias))
4512 {
4513 str = f->file;
4514 break;
4515 }
4516
4517 eina_iterator_free(it);
4518 return eina_stringshare_add(str);
4519}
4520
4521EAPI const char *
4522edje_edit_state_font_get(Evas_Object *obj, const char *part, const char *state, double value)
4523{
4524 Edje_Part_Description_Text *txt;
4525
4526 eina_error_set(0);
4527
4528 GET_PD_OR_RETURN(NULL);
4529
4530 if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
4531 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
4532 return NULL;
4533
4534 txt = (Edje_Part_Description_Text*) pd;
4535
4536 return eina_stringshare_add(edje_string_get(&txt->text.font));
4537}
4538
4539EAPI void
4540edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state, double value, const char *font)
4541{
4542 Edje_Part_Description_Text *txt;
4543
4544 eina_error_set(0);
4545
4546 GET_PD_OR_RETURN();
4547
4548 if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
4549 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
4550 return;
4551
4552 txt = (Edje_Part_Description_Text*) pd;
4553
4554 _edje_if_string_free(ed, txt->text.font.str);
4555 txt->text.font.str = (char *)eina_stringshare_add(font);
4556 txt->text.font.id = 0;
4557
4558 edje_object_calc_force(obj);
4559}
4560
4561EAPI Edje_Text_Effect
4562edje_edit_part_effect_get(Evas_Object *obj, const char *part)
4563{
4564 eina_error_set(0);
4565
4566 GET_RP_OR_RETURN(0);
4567
4568 //printf("GET EFFECT of part: %s\n", part);
4569 return rp->part->effect;
4570}
4571
4572EAPI void
4573edje_edit_part_effect_set(Evas_Object *obj, const char *part, Edje_Text_Effect effect)
4574{
4575 eina_error_set(0);
4576
4577 GET_RP_OR_RETURN();
4578
4579 //printf("SET EFFECT of part: %s [%d]\n", part, effect);
4580 rp->part->effect = effect;
4581
4582 edje_object_calc_force(obj);
4583}
4584
4585/****************/
4586/* IMAGES API */
4587/****************/
4588
4589EAPI Eina_List *
4590edje_edit_images_list_get(Evas_Object *obj)
4591{
4592 Eina_List *images = NULL;
4593 unsigned int i;
4594
4595 eina_error_set(0);
4596
4597 GET_ED_OR_RETURN(NULL);
4598
4599 if (!ed->file) return NULL;
4600 if (!ed->file->image_dir) return NULL;
4601
4602 //printf("GET IMAGES LIST for %s\n", ed->file->path);
4603 for (i = 0; i < ed->file->image_dir->entries_count; ++i)
4604 images = eina_list_append(images,
4605 eina_stringshare_add(ed->file->image_dir->entries[i].entry));
4606
4607 return images;
4608}
4609
4610EAPI Eina_Bool
4611edje_edit_image_add(Evas_Object *obj, const char* path)
4612{
4613 Edje_Image_Directory_Entry *de;
4614 unsigned int i;
4615 int free_id = -1;
4616 char *name;
4617
4618 eina_error_set(0);
4619
4620 GET_ED_OR_RETURN(EINA_FALSE);
4621
4622 if (!path) return EINA_FALSE;
4623 if (!ed->file) return EINA_FALSE;
4624 if (!ed->path) return EINA_FALSE;
4625
4626 /* Create Image_Directory if not exist */
4627 if (!ed->file->image_dir)
4628 {
4629 ed->file->image_dir = _alloc(sizeof(Edje_Image_Directory));
4630 if (!ed->file->image_dir) return EINA_FALSE;
4631 }
4632
4633 /* Image name */
4634 if ((name = strrchr(path, '/'))) name++;
4635 else name = (char *)path;
4636
4637 /* Loop trough image directory to find if image exist */
4638 for (i = 0; i < ed->file->image_dir->entries_count; ++i)
4639 {
4640 de = ed->file->image_dir->entries + i;
4641
4642 if (!de->entry)
4643 free_id = i;
4644 else if (!strcmp(name, de->entry))
4645 return EINA_FALSE;
4646 }
4647
4648 if (free_id == -1)
4649 {
4650 Edje_Image_Directory_Entry *tmp;
4651 unsigned int count;
4652
4653 count = ed->file->image_dir->entries_count + 1;
4654
4655 tmp = realloc(ed->file->image_dir->entries,
4656 sizeof (Edje_Image_Directory_Entry) * count);
4657 if (!tmp) return EINA_FALSE;
4658
4659 ed->file->image_dir->entries = tmp;
4660 free_id = ed->file->image_dir->entries_count;
4661 ed->file->image_dir->entries_count = count;
4662 }
4663
4664 /* Set Image Entry */
4665 de = ed->file->image_dir->entries + free_id;
4666 de->entry = eina_stringshare_add(name);
4667 de->id = free_id;
4668 de->source_type = 1;
4669 de->source_param = 1;
4670
4671 /* Import image */
4672 if (!_edje_import_image_file(ed, path, free_id))
4673 {
4674 eina_stringshare_del(de->entry);
4675 de->entry = NULL;
4676 return EINA_FALSE;
4677 }
4678
4679 return EINA_TRUE;
4680}
4681
4682EAPI Eina_Bool
4683edje_edit_image_del(Evas_Object *obj, const char* name)
4684{
4685 Edje_Image_Directory_Entry *de;
4686 unsigned int i;
4687
4688 eina_error_set(0);
4689
4690 GET_ED_OR_RETURN(EINA_FALSE);
4691
4692 if (!name) return EINA_FALSE;
4693 if (!ed->file) return EINA_FALSE;
4694 if (!ed->path) return EINA_FALSE;
4695
4696 /* Create Image_Directory if not exist */
4697 if (!ed->file->image_dir)
4698 goto invalid_image;
4699
4700 return EINA_TRUE;
4701
4702 for (i = 0; i < ed->file->image_dir->entries_count; ++i)
4703 {
4704 de = ed->file->image_dir->entries + i;
4705
4706 if (de->entry
4707 && !strcmp(name, de->entry))
4708 break;
4709 }
4710
4711 if (i == ed->file->image_dir->entries_count)
4712 goto invalid_image;
4713
4714 {
4715 char entry[PATH_MAX];
4716 Eet_File *eetf;
4717
4718 /* open the eet file */
4719 eetf = eet_open(ed->path, EET_FILE_MODE_READ_WRITE);
4720 if (!eetf)
4721 {
4722 ERR("Unable to open \"%s\" for writing output", ed->path);
4723 return EINA_FALSE;
4724 }
4725
4726 snprintf(entry, sizeof(entry), "edje/images/%i", de->id);
4727
4728 if (eet_delete(eetf, entry) <= 0)
4729 {
4730 ERR("Unable to delete \"%s\" font entry", entry);
4731 eet_close(eetf);
4732 return EINA_FALSE;
4733 }
4734
4735 /* write the edje_file */
4736 if (!_edje_edit_edje_file_save(eetf, ed->file))
4737 {
4738 eet_close(eetf);
4739 return EINA_FALSE;
4740 }
4741
4742 eet_close(eetf);
4743 }
4744
4745 _edje_if_string_free(ed, de->entry);
4746 de->entry = NULL;
4747
4748 _edje_edit_flag_script_dirty(eed, EINA_TRUE);
4749
4750 return EINA_TRUE;
4751
4752invalid_image:
4753 WRN("Unable to find image entry part \"%s\"", name);
4754 return EINA_FALSE;
4755}
4756
4757EAPI Eina_Bool
4758edje_edit_image_data_add(Evas_Object *obj, const char *name, int id)
4759{
4760 Edje_Image_Directory_Entry *de;
4761
4762 eina_error_set(0);
4763
4764 GET_ED_OR_RETURN(EINA_FALSE);
4765
4766 if (!name) return EINA_FALSE;
4767 if (!ed->file) return EINA_FALSE;
4768 if (!ed->path) return EINA_FALSE;
4769
4770 /* Create Image_Directory if not exist */
4771 if (!ed->file->image_dir)
4772 {
4773 ed->file->image_dir = _alloc(sizeof(Edje_Image_Directory));
4774 if (!ed->file->image_dir) return EINA_FALSE;
4775 }
4776
4777 /* Loop trough image directory to find if image exist */
4778 if (id < 0) id = - id - 1;
4779 if ((unsigned int) id >= ed->file->image_dir->entries_count) return EINA_FALSE;
4780
4781 de = ed->file->image_dir->entries + id;
4782 eina_stringshare_replace(&de->entry, name);
4783 de->source_type = 1;
4784 de->source_param = 1;
4785
4786 return EINA_TRUE;
4787}
4788
4789EAPI int
4790edje_edit_image_id_get(Evas_Object *obj, const char *image_name)
4791{
4792 eina_error_set(0);
4793
4794 GET_ED_OR_RETURN(-1);
4795
4796 return _edje_image_id_find(eed, image_name);
4797}
4798
4799EAPI Edje_Edit_Image_Comp
4800edje_edit_image_compression_type_get(Evas_Object *obj, const char *image)
4801{
4802 Edje_Image_Directory_Entry *de = NULL;
4803 unsigned int i;
4804
4805 eina_error_set(0);
4806
4807 GET_ED_OR_RETURN(-1);
4808
4809 if (!ed->file) return -1;
4810 if (!ed->file->image_dir) return -1;
4811
4812 for (i = 0; i < ed->file->image_dir->entries_count; ++i)
4813 {
4814 de = ed->file->image_dir->entries + i;
4815
4816 if (de->entry
4817 && !strcmp(image, de->entry))
4818 break;
4819 }
4820
4821 if (i == ed->file->image_dir->entries_count) return -1;
4822
4823 switch(de->source_type)
4824 {
4825 case EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT:
4826 if (de->source_param == 0) // RAW
4827 return EDJE_EDIT_IMAGE_COMP_RAW;
4828 else // COMP
4829 return EDJE_EDIT_IMAGE_COMP_COMP;
4830 break;
4831 case EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY: // LOSSY
4832 return EDJE_EDIT_IMAGE_COMP_LOSSY;
4833 break;
4834 case EDJE_IMAGE_SOURCE_TYPE_EXTERNAL: // USER
4835 return EDJE_EDIT_IMAGE_COMP_USER;
4836 break;
4837 }
4838
4839 return -1;
4840}
4841
4842EAPI int
4843edje_edit_image_compression_rate_get(Evas_Object *obj, const char *image)
4844{
4845 Edje_Image_Directory_Entry *de;
4846 unsigned int i;
4847
4848 eina_error_set(0);
4849
4850 GET_ED_OR_RETURN(-1);
4851
4852 // Gets the Image Entry
4853 for (i = 0; i < ed->file->image_dir->entries_count; ++i)
4854 {
4855 de = ed->file->image_dir->entries + i;
4856 if (de->entry
4857 && !strcmp(de->entry, image))
4858 break;
4859 }
4860
4861 if (i == ed->file->image_dir->entries_count) return -1;
4862 if (de->source_type != EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY) return -2;
4863
4864 return de->source_param;
4865}
4866
4867EAPI const char *
4868edje_edit_state_image_get(Evas_Object *obj, const char *part, const char *state, double value)
4869{
4870 Edje_Part_Description_Image *img;
4871 const char *image;
4872
4873 eina_error_set(0);
4874
4875 GET_PD_OR_RETURN(NULL);
4876
4877 if (rp->part->type != EDJE_PART_TYPE_IMAGE)
4878 return NULL;
4879
4880 img = (Edje_Part_Description_Image *) pd;
4881
4882 image = _edje_image_name_find(eed, img->image.id);
4883 if (!image) return NULL;
4884
4885 //printf("GET IMAGE for %s [%s]\n", state, image);
4886 return eina_stringshare_add(image);
4887}
4888
4889EAPI void
4890edje_edit_state_image_set(Evas_Object *obj, const char *part, const char *state, double value, const char *image)
4891{
4892 Edje_Part_Description_Image *img;
4893 int id;
4894
4895 eina_error_set(0);
4896
4897 GET_PD_OR_RETURN();
4898
4899 if (!image) return;
4900
4901 if (rp->part->type != EDJE_PART_TYPE_IMAGE)
4902 return;
4903
4904 id = _edje_image_id_find(eed, image);
4905 //printf("SET IMAGE for %s [%s]\n", state, image);
4906
4907 img = (Edje_Part_Description_Image *) pd;
4908
4909 if (id > -1) img->image.id = id;
4910
4911 edje_object_calc_force(obj);
4912}
4913
4914EAPI Eina_List *
4915edje_edit_state_tweens_list_get(Evas_Object *obj, const char *part, const char *state, double value)
4916{
4917 Edje_Part_Description_Image *img;
4918 Eina_List *tweens = NULL;
4919 const char *name;
4920 unsigned int i;
4921
4922 eina_error_set(0);
4923
4924 GET_PD_OR_RETURN(NULL);
4925
4926 if (rp->part->type != EDJE_PART_TYPE_IMAGE)
4927 return NULL;
4928
4929 img = (Edje_Part_Description_Image *) pd;
4930
4931 for (i = 0; i < img->image.tweens_count; ++i)
4932 {
4933 name = _edje_image_name_find(eed, img->image.tweens[i]->id);
4934 //printf(" t: %s\n", name);
4935 tweens = eina_list_append(tweens, eina_stringshare_add(name));
4936 }
4937
4938 return tweens;
4939}
4940
4941EAPI Eina_Bool
4942edje_edit_state_tween_add(Evas_Object *obj, const char *part, const char *state, double value, const char *tween)
4943{
4944 Edje_Part_Description_Image *img;
4945 Edje_Part_Image_Id **tmp;
4946 Edje_Part_Image_Id *i;
4947 int id;
4948
4949 eina_error_set(0);
4950
4951 GET_PD_OR_RETURN(EINA_FALSE);
4952
4953 if (rp->part->type != EDJE_PART_TYPE_IMAGE)
4954 return EINA_FALSE;
4955
4956 id = _edje_image_id_find(eed, tween);
4957 if (id < EINA_FALSE) return 0;
4958
4959 /* alloc Edje_Part_Image_Id */
4960 i = _alloc(sizeof(Edje_Part_Image_Id));
4961 if (!i) return EINA_FALSE;
4962 i->id = id;
4963
4964 img = (Edje_Part_Description_Image *) pd;
4965
4966 /* add to tween list */
4967 tmp = realloc(img->image.tweens,
4968 sizeof (Edje_Part_Image_Id*) * img->image.tweens_count);
4969 if (!tmp)
4970 {
4971 free(i);
4972 return EINA_FALSE;
4973 }
4974
4975 tmp[img->image.tweens_count++] = i;
4976 img->image.tweens = tmp;
4977
4978 return EINA_TRUE;
4979}
4980
4981EAPI Eina_Bool
4982edje_edit_state_tween_del(Evas_Object *obj, const char *part, const char *state, double value, const char *tween)
4983{
4984 Edje_Part_Description_Image *img;
4985 unsigned int i;
4986 int search;
4987
4988 eina_error_set(0);
4989
4990 GET_PD_OR_RETURN(EINA_FALSE);
4991
4992 if (rp->part->type != EDJE_PART_TYPE_IMAGE)
4993 return EINA_FALSE;
4994
4995 img = (Edje_Part_Description_Image *) pd;
4996
4997 if (!img->image.tweens_count) return EINA_FALSE;
4998
4999 search = _edje_image_id_find(eed, tween);
5000 if (search < 0) return EINA_FALSE;
5001
5002 for (i = 0; i < img->image.tweens_count; ++i)
5003 {
5004 if (img->image.tweens[i]->id == search)
5005 {
5006 img->image.tweens_count--;
5007 free(img->image.tweens[i]);
5008 memmove(img->image.tweens + i,
5009 img->image.tweens + i + 1,
5010 sizeof (Edje_Part_Description_Image*) * (img->image.tweens_count - i));
5011 return EINA_TRUE;
5012 }
5013 }
5014 return EINA_FALSE;
5015}
5016
5017EAPI void
5018edje_edit_state_image_border_get(Evas_Object *obj, const char *part, const char *state, double value, int *l, int *r, int *t, int *b)
5019{
5020 Edje_Part_Description_Image *img;
5021
5022 eina_error_set(0);
5023
5024 GET_PD_OR_RETURN();
5025
5026 if (rp->part->type != EDJE_PART_TYPE_IMAGE)
5027 {
5028 if (l) *l = 0;
5029 if (r) *r = 0;
5030 if (t) *t = 0;
5031 if (b) *b = 0;
5032 return;
5033 }
5034
5035 img = (Edje_Part_Description_Image *) pd;
5036
5037 //printf("GET IMAGE_BORDER of state '%s'\n", state);
5038
5039 if (l) *l = img->image.border.l;
5040 if (r) *r = img->image.border.r;
5041 if (t) *t = img->image.border.t;
5042 if (b) *b = img->image.border.b;
5043}
5044
5045EAPI void
5046edje_edit_state_image_border_set(Evas_Object *obj, const char *part, const char *state, double value, int l, int r, int t, int b)
5047{
5048 Edje_Part_Description_Image *img;
5049
5050 eina_error_set(0);
5051
5052 GET_PD_OR_RETURN();
5053
5054 if (rp->part->type != EDJE_PART_TYPE_IMAGE)
5055 return;
5056
5057 img = (Edje_Part_Description_Image *) pd;
5058
5059 //printf("SET IMAGE_BORDER of state '%s'\n", state);
5060
5061 if (l > -1) img->image.border.l = l;
5062 if (r > -1) img->image.border.r = r;
5063 if (t > -1) img->image.border.t = t;
5064 if (b > -1) img->image.border.b = b;
5065
5066 edje_object_calc_force(obj);
5067}
5068
5069EAPI unsigned char
5070edje_edit_state_image_border_fill_get(Evas_Object *obj, const char *part, const char *state, double value)
5071{
5072 Edje_Part_Description_Image *img;
5073
5074 eina_error_set(0);
5075
5076 GET_PD_OR_RETURN(0);
5077
5078 if (rp->part->type != EDJE_PART_TYPE_IMAGE)
5079 return 0;
5080
5081 img = (Edje_Part_Description_Image *) pd;
5082
5083 if (img->image.border.no_fill == 0) return 1;
5084 else if (img->image.border.no_fill == 1) return 0;
5085 else if (img->image.border.no_fill == 2) return 2;
5086 return 0;
5087}
5088
5089EAPI void
5090edje_edit_state_image_border_fill_set(Evas_Object *obj, const char *part, const char *state, double value, unsigned char fill)
5091{
5092 Edje_Part_Description_Image *img;
5093
5094 eina_error_set(0);
5095
5096 GET_PD_OR_RETURN();
5097
5098 if (rp->part->type != EDJE_PART_TYPE_IMAGE)
5099 return;
5100
5101 img = (Edje_Part_Description_Image *) pd;
5102
5103 if (fill == 0) img->image.border.no_fill = 1;
5104 else if (fill == 1) img->image.border.no_fill = 0;
5105 else if (fill == 2) img->image.border.no_fill = 2;
5106
5107 edje_object_calc_force(obj);
5108}
5109
5110/******************/
5111/* PROGRAMS API */
5112/******************/
5113static int
5114_edje_program_id_find(Edje_Edit *eed, const char *program)
5115{
5116 Edje_Program *epr;
5117 int i;
5118
5119 for (i = 0; i < eed->base.table_programs_size; i++)
5120 {
5121 epr = eed->base.table_programs[i];
5122 if (epr->name && !strcmp(epr->name, program))
5123 return epr->id;
5124 }
5125 return -1;
5126}
5127
5128static Edje_Program *
5129_edje_program_get_byname(Evas_Object *obj, const char *prog_name)
5130{
5131 Edje_Program *epr;
5132 int i;
5133
5134 GET_ED_OR_RETURN(NULL);
5135
5136 if (!prog_name) return NULL;
5137
5138 for (i = 0; i < ed->table_programs_size; i++)
5139 {
5140 epr = ed->table_programs[i];
5141 if ((epr->name) && (strcmp(epr->name, prog_name) == 0))
5142 return epr;
5143 }
5144 return NULL;
5145}
5146
5147EAPI Eina_List *
5148edje_edit_programs_list_get(Evas_Object *obj)
5149{
5150 Eina_List *progs = NULL;
5151 int i;
5152
5153 eina_error_set(0);
5154
5155 GET_ED_OR_RETURN(NULL);
5156
5157 //printf("EE: Found %d programs\n", ed->table_programs_size);
5158
5159 for (i = 0; i < ed->table_programs_size; i++)
5160 {
5161 Edje_Program *epr;
5162
5163 epr = ed->table_programs[i];
5164 /* XXX: bad, we miss programs this way, but since you can't access
5165 * them in any way without a name, better ignore them. */
5166 if (!epr->name) continue;
5167 progs = eina_list_append(progs, eina_stringshare_add(epr->name));
5168 }
5169
5170 return progs;
5171}
5172
5173EAPI Eina_Bool
5174edje_edit_program_add(Evas_Object *obj, const char *name)
5175{
5176 Edje_Program *epr;
5177 Edje_Part_Collection *pc;
5178
5179 eina_error_set(0);
5180
5181 GET_ED_OR_RETURN(EINA_FALSE);
5182
5183 //printf("ADD PROGRAM [new name: %s]\n", name);
5184
5185 //Check if program already exists
5186 if (_edje_program_get_byname(obj, name))
5187 return EINA_FALSE;
5188
5189 //Alloc Edje_Program or return
5190 epr = _alloc(sizeof(Edje_Program));
5191 if (!epr) return EINA_FALSE;
5192
5193 //Add program to group
5194 pc = ed->collection;
5195
5196 /* By default, source and signal are empty, so they fill in nocmp category */
5197 ed->collection->programs.nocmp = realloc(ed->collection->programs.nocmp,
5198 sizeof (Edje_Program*) * (ed->collection->programs.nocmp_count + 1));
5199 ed->collection->programs.nocmp[ed->collection->programs.nocmp_count++] = epr;
5200
5201 //Init Edje_Program
5202 epr->id = ed->table_programs_size;
5203 epr->name = eina_stringshare_add(name);
5204 epr->signal = NULL;
5205 epr->source = NULL;
5206 epr->filter.part = NULL;
5207 epr->filter.state = NULL;
5208 epr->in.from = 0.0;
5209 epr->in.range = 0.0;
5210 epr->action = 0;
5211 epr->state = NULL;
5212 epr->value = 0.0;
5213 epr->state2 = NULL;
5214 epr->value2 = 0.0;
5215 epr->tween.mode = 1;
5216 epr->tween.time = ZERO;
5217 epr->targets = NULL;
5218 epr->after = NULL;
5219
5220
5221 //Update table_programs
5222 ed->table_programs_size++;
5223 ed->table_programs = realloc(ed->table_programs,
5224 sizeof(Edje_Program *) * ed->table_programs_size);
5225 ed->table_programs[epr->id % ed->table_programs_size] = epr;
5226
5227 //Update patterns
5228 _edje_programs_patterns_clean(ed);
5229 _edje_programs_patterns_init(ed);
5230
5231 return EINA_TRUE;
5232}
5233
5234EAPI Eina_Bool
5235edje_edit_program_del(Evas_Object *obj, const char *prog)
5236{
5237 Eina_List *l, *l_next;
5238 Edje_Program_Target *prt;
5239 Edje_Program_After *pa;
5240 Edje_Part_Collection *pc;
5241 Edje_Program *p;
5242 Program_Script *ps, *old_ps;
5243 int id, i;
5244 int old_id = -1;
5245
5246 eina_error_set(0);
5247
5248 GET_ED_OR_RETURN(EINA_FALSE);
5249 GET_EPR_OR_RETURN(EINA_FALSE);
5250
5251 pc = ed->collection;
5252
5253 //Remove program from programs list
5254 id = epr->id;
5255 _edje_program_remove(ed->collection, epr);
5256
5257 /* fix table program */
5258 if (epr->id != ed->table_programs_size - 1)
5259 {
5260 /* If the removed program is not the last in the list/table,
5261 * put the last one in its place and update references to it later */
5262 ed->table_programs[epr->id] = ed->table_programs[ed->table_programs_size - 1];
5263 old_id = ed->table_programs_size - 1;
5264 ed->table_programs[epr->id]->id = epr->id;
5265 }
5266
5267 ps = eina_hash_find(eed->program_scripts, &id);
5268 old_ps = eina_hash_find(eed->program_scripts, &old_id);
5269 if (old_ps)
5270 {
5271 if (!ps)
5272 {
5273 ps = _alloc(sizeof(Program_Script));
5274 ps->id = id;
5275 eina_hash_add(eed->program_scripts, &id, ps);
5276 }
5277 else
5278 {
5279 free(ps->code);
5280 free(ps->processed);
5281 ps->processed = NULL;
5282 ps->delete_me = EINA_FALSE;
5283 }
5284 ps->code = old_ps->code;
5285 old_ps->code = NULL;
5286 free(old_ps->processed);
5287 old_ps->processed = NULL;
5288 ps->dirty = EINA_TRUE;
5289 old_ps->dirty = EINA_FALSE;
5290 old_ps->delete_me = EINA_TRUE;
5291 }
5292 else if (ps)
5293 {
5294 ps->dirty = EINA_FALSE;
5295 ps->delete_me = EINA_TRUE;
5296 }
5297
5298 //Free Edje_Program
5299 _edje_if_string_free(ed, epr->name);
5300 _edje_if_string_free(ed, epr->signal);
5301 _edje_if_string_free(ed, epr->source);
5302 _edje_if_string_free(ed, epr->filter.part);
5303 _edje_if_string_free(ed, epr->filter.state);
5304 _edje_if_string_free(ed, epr->state);
5305 _edje_if_string_free(ed, epr->state2);
5306
5307 EINA_LIST_FREE(epr->targets, prt)
5308 free(prt);
5309 EINA_LIST_FREE(epr->after, pa)
5310 free(pa);
5311 free(epr);
5312
5313 ed->table_programs_size--;
5314 ed->table_programs = realloc(ed->table_programs,
5315 sizeof(Edje_Program *) * ed->table_programs_size);
5316
5317 //We also update all other programs that point to old_id and id
5318 for (i = 0; i < ed->table_programs_size; i++)
5319 {
5320 p = ed->table_programs[i];
5321
5322 /* check in afters */
5323 EINA_LIST_FOREACH_SAFE(p->after, l, l_next, pa)
5324 {
5325 if (pa->id == old_id)
5326 pa->id = id;
5327 else if (pa->id == id)
5328 {
5329 p->after = eina_list_remove_list(p->after, l);
5330 free(pa);
5331 }
5332 }
5333 /* check in targets */
5334 if (p->action == EDJE_ACTION_TYPE_ACTION_STOP)
5335 {
5336 Edje_Program_Target *pt;
5337
5338 EINA_LIST_FOREACH_SAFE(p->targets, l, l_next, pt)
5339 {
5340 if (pt->id == old_id)
5341 pt->id = id;
5342 else if (pt->id == id)
5343 {
5344 p->targets = eina_list_remove_list(p->targets, l);
5345 free(pt);
5346 }
5347 }
5348 }
5349 }
5350
5351 _edje_edit_flag_script_dirty(eed, EINA_TRUE);
5352
5353 return EINA_TRUE;
5354}
5355
5356EAPI Eina_Bool
5357edje_edit_program_exist(Evas_Object *obj, const char *prog)
5358{
5359 eina_error_set(0);
5360
5361 GET_EPR_OR_RETURN(EINA_FALSE);
5362
5363 return EINA_TRUE;
5364}
5365
5366EAPI Eina_Bool
5367edje_edit_program_run(Evas_Object *obj, const char *prog)
5368{
5369 eina_error_set(0);
5370
5371 GET_ED_OR_RETURN(EINA_FALSE);
5372 GET_EPR_OR_RETURN(EINA_FALSE);
5373
5374 _edje_program_run(ed, epr, 0, "", "");
5375 return EINA_TRUE;
5376}
5377
5378EAPI Eina_Bool
5379edje_edit_program_name_set(Evas_Object *obj, const char *prog, const char* new_name)
5380{
5381 eina_error_set(0);
5382
5383 GET_ED_OR_RETURN(EINA_FALSE);
5384 GET_EPR_OR_RETURN(EINA_FALSE);
5385
5386 if (!new_name) return EINA_FALSE;
5387
5388 if (_edje_program_get_byname(obj, new_name)) return EINA_FALSE;
5389
5390 //printf("SET NAME for program: %s [new name: %s]\n", prog, new_name);
5391
5392 _edje_if_string_free(ed, epr->name);
5393 epr->name = eina_stringshare_add(new_name);
5394
5395 _edje_edit_flag_script_dirty(eed, EINA_TRUE);
5396
5397 return EINA_TRUE;
5398}
5399
5400EAPI const char *
5401edje_edit_program_source_get(Evas_Object *obj, const char *prog)
5402{
5403 eina_error_set(0);
5404
5405 GET_EPR_OR_RETURN(NULL);
5406
5407 if (!epr->source) return NULL;
5408 //printf("GET SOURCE for program: %s [%s]\n", prog, epr->source);
5409 return eina_stringshare_add(epr->source);
5410}
5411
5412EAPI Eina_Bool
5413edje_edit_program_source_set(Evas_Object *obj, const char *prog, const char *source)
5414{
5415 eina_error_set(0);
5416
5417 GET_ED_OR_RETURN(EINA_FALSE);
5418 GET_EPR_OR_RETURN(EINA_FALSE);
5419
5420 if (!source) return EINA_FALSE;
5421
5422 /* Remove from program array */
5423 _edje_program_remove(ed->collection, epr);
5424 _edje_if_string_free(ed, epr->source);
5425
5426 /* Insert it back */
5427 epr->source = eina_stringshare_add(source);
5428 _edje_program_insert(ed->collection, epr);
5429
5430 //Update patterns
5431 _edje_programs_patterns_clean(ed);
5432 _edje_programs_patterns_init(ed);
5433
5434 return EINA_TRUE;
5435}
5436
5437EAPI const char *
5438edje_edit_program_filter_part_get(Evas_Object *obj, const char *prog)
5439{
5440 eina_error_set(0);
5441
5442 GET_EPR_OR_RETURN(NULL);
5443
5444 if (!epr->filter.part) return NULL;
5445 return eina_stringshare_add(epr->filter.part);
5446}
5447
5448EAPI Eina_Bool
5449edje_edit_program_filter_part_set(Evas_Object *obj, const char *prog, const char *filter_part)
5450{
5451 eina_error_set(0);
5452
5453 GET_ED_OR_RETURN(EINA_FALSE);
5454 GET_EPR_OR_RETURN(EINA_FALSE);
5455
5456 if (!filter_part) return EINA_FALSE;
5457
5458 _edje_if_string_free(ed, epr->filter.part);
5459 epr->filter.part = eina_stringshare_add(filter_part);
5460
5461 return EINA_TRUE;
5462}
5463
5464EAPI const char *
5465edje_edit_program_filter_state_get(Evas_Object *obj, const char *prog)
5466{
5467 eina_error_set(0);
5468
5469 GET_EPR_OR_RETURN(NULL);
5470
5471 if (!epr->filter.state) return NULL;
5472 return eina_stringshare_add(epr->filter.state);
5473}
5474
5475EAPI Eina_Bool
5476edje_edit_program_filter_state_set(Evas_Object *obj, const char *prog, const char *filter_state)
5477{
5478 eina_error_set(0);
5479
5480 GET_ED_OR_RETURN(EINA_FALSE);
5481 GET_EPR_OR_RETURN(EINA_FALSE);
5482
5483 if (!filter_state) return EINA_FALSE;
5484
5485 _edje_if_string_free(ed, epr->filter.state);
5486 epr->filter.state = eina_stringshare_add(filter_state);
5487
5488 return EINA_TRUE;
5489}
5490
5491EAPI const char *
5492edje_edit_program_signal_get(Evas_Object *obj, const char *prog)
5493{
5494 eina_error_set(0);
5495
5496 GET_EPR_OR_RETURN(NULL);
5497
5498 if (!epr->signal) return NULL;
5499 //printf("GET SIGNAL for program: %s [%s]\n", prog, epr->signal);
5500 return eina_stringshare_add(epr->signal);
5501}
5502
5503EAPI Eina_Bool
5504edje_edit_program_signal_set(Evas_Object *obj, const char *prog, const char *sig)
5505{
5506 eina_error_set(0);
5507
5508 GET_ED_OR_RETURN(EINA_FALSE);
5509 GET_EPR_OR_RETURN(EINA_FALSE);
5510
5511 if (!sig) return EINA_FALSE;
5512
5513 /* Remove from program array */
5514 _edje_program_remove(ed->collection, epr);
5515 _edje_if_string_free(ed, epr->signal);
5516
5517 /* Insert it back */
5518 epr->signal = eina_stringshare_add(sig);
5519 _edje_program_insert(ed->collection, epr);
5520
5521 //Update patterns
5522 _edje_programs_patterns_clean(ed);
5523 _edje_programs_patterns_init(ed);
5524
5525 return EINA_TRUE;
5526}
5527
5528EAPI const char *
5529edje_edit_program_state_get(Evas_Object *obj, const char *prog)
5530{
5531 eina_error_set(0);
5532
5533 GET_EPR_OR_RETURN(NULL);
5534
5535 if (!epr->state) return NULL;
5536 //printf("GET STATE for program: %s [%s %.2f]\n", prog, epr->state, epr->value);
5537 return eina_stringshare_add(epr->state);
5538}
5539
5540EAPI Eina_Bool
5541edje_edit_program_state_set(Evas_Object *obj, const char *prog, const char *state)
5542{
5543 eina_error_set(0);
5544
5545 GET_ED_OR_RETURN(EINA_FALSE);
5546 GET_EPR_OR_RETURN(EINA_FALSE);
5547
5548 //printf("SET STATE for program: %s\n", prog);
5549
5550 _edje_if_string_free(ed, epr->state);
5551 epr->state = eina_stringshare_add(state);
5552
5553 return EINA_TRUE;
5554}
5555
5556EAPI const char *
5557edje_edit_program_state2_get(Evas_Object *obj, const char *prog)
5558{
5559 eina_error_set(0);
5560
5561 GET_EPR_OR_RETURN(NULL);
5562
5563 if (!epr->state2) return NULL;
5564 //printf("GET STATE2 for program: %s [%s %.2f]\n", prog, epr->state2, epr->value2);
5565 return eina_stringshare_add(epr->state2);
5566}
5567
5568EAPI Eina_Bool
5569edje_edit_program_state2_set(Evas_Object *obj, const char *prog, const char *state2)
5570{
5571 eina_error_set(0);
5572
5573 GET_ED_OR_RETURN(EINA_FALSE);
5574 GET_EPR_OR_RETURN(EINA_FALSE);
5575
5576 //printf("SET STATE2 for program: %s\n", prog);
5577
5578 _edje_if_string_free(ed, epr->state2);
5579 epr->state2 = eina_stringshare_add(state2);
5580
5581 return EINA_TRUE;
5582}
5583
5584EAPI double
5585edje_edit_program_value_get(Evas_Object *obj, const char *prog)
5586{
5587 eina_error_set(0);
5588
5589 GET_EPR_OR_RETURN(-1);
5590
5591 //printf("GET VALUE for program: %s [%s %.2f]\n", prog, epr->state, epr->value);
5592 return epr->value;
5593}
5594
5595EAPI Eina_Bool
5596edje_edit_program_value_set(Evas_Object *obj, const char *prog, double value)
5597{
5598 eina_error_set(0);
5599
5600 GET_EPR_OR_RETURN(EINA_FALSE);
5601
5602 //printf("SET VALUE for program: %s [%.2f]\n", prog, value);
5603 epr->value = value;
5604 return EINA_TRUE;
5605}
5606
5607EAPI double
5608edje_edit_program_value2_get(Evas_Object *obj, const char *prog)
5609{
5610 eina_error_set(0);
5611
5612 GET_EPR_OR_RETURN(-1);
5613
5614 //printf("GET VALUE2 for program: %s [%s %.2f]\n", prog, epr->state2, epr->value2);
5615 return epr->value2;
5616}
5617
5618EAPI Eina_Bool
5619edje_edit_program_value2_set(Evas_Object *obj, const char *prog, double value)
5620{
5621 eina_error_set(0);
5622
5623 GET_EPR_OR_RETURN(EINA_FALSE);
5624
5625 //printf("SET VALUE for program: %s [%.2f]\n", prog, value);
5626 epr->value2 = value;
5627 return EINA_TRUE;
5628}
5629
5630EAPI double
5631edje_edit_program_in_from_get(Evas_Object *obj, const char *prog)
5632{
5633 eina_error_set(0);
5634
5635 GET_EPR_OR_RETURN(0);
5636
5637 //printf("GET IN.FROM for program: %s [%f]\n", prog, epr->in.from);
5638 return epr->in.from;
5639}
5640
5641EAPI Eina_Bool
5642edje_edit_program_in_from_set(Evas_Object *obj, const char *prog, double seconds)
5643{
5644 eina_error_set(0);
5645
5646 GET_EPR_OR_RETURN(EINA_FALSE);
5647
5648 //printf("SET IN.FROM for program: %s [%f]\n", prog, epr->in.from);
5649 epr->in.from = seconds;
5650 return EINA_TRUE;
5651}
5652
5653EAPI double
5654edje_edit_program_in_range_get(Evas_Object *obj, const char *prog)
5655{
5656 eina_error_set(0);
5657
5658 GET_EPR_OR_RETURN(0);
5659
5660 //printf("GET IN.RANGE for program: %s [%f]\n", prog, epr->in.range);
5661 return epr->in.range;
5662}
5663
5664EAPI Eina_Bool
5665edje_edit_program_in_range_set(Evas_Object *obj, const char *prog, double seconds)
5666{
5667 eina_error_set(0);
5668
5669 GET_EPR_OR_RETURN(EINA_FALSE);
5670
5671 //printf("SET IN.RANGE for program: %s [%f]\n", prog, epr->in.range);
5672 epr->in.range = seconds;
5673 return EINA_TRUE;
5674}
5675
5676EAPI Edje_Tween_Mode
5677edje_edit_program_transition_get(Evas_Object *obj, const char *prog)
5678{
5679 eina_error_set(0);
5680
5681 GET_EPR_OR_RETURN(-1);
5682
5683 //printf("GET TRANSITION for program: %s [%d]\n", prog, epr->tween.mode);
5684 return epr->tween.mode;
5685}
5686
5687EAPI Eina_Bool
5688edje_edit_program_transition_set(Evas_Object *obj, const char *prog, Edje_Tween_Mode transition)
5689{
5690 eina_error_set(0);
5691
5692 GET_EPR_OR_RETURN(EINA_FALSE);
5693
5694 //printf("GET TRANSITION for program: %s [%d]\n", prog, epr->tween.mode);
5695 epr->tween.mode = transition;
5696 return EINA_TRUE;
5697}
5698
5699EAPI double
5700edje_edit_program_transition_time_get(Evas_Object *obj, const char *prog)
5701{
5702 eina_error_set(0);
5703
5704 GET_EPR_OR_RETURN(-1);
5705
5706 //printf("GET TRANSITION_TIME for program: %s [%.4f]\n", prog, epr->tween.time);
5707 return TO_DOUBLE(epr->tween.time);
5708}
5709
5710EAPI Eina_Bool
5711edje_edit_program_transition_time_set(Evas_Object *obj, const char *prog, double seconds)
5712{
5713 eina_error_set(0);
5714
5715 GET_EPR_OR_RETURN(EINA_FALSE);
5716
5717 //printf("GET TRANSITION_TIME for program: %s [%.4f]\n", prog, epr->tween.time);
5718 epr->tween.time = FROM_DOUBLE(seconds);
5719 return EINA_TRUE;
5720}
5721
5722EAPI Edje_Action_Type
5723edje_edit_program_action_get(Evas_Object *obj, const char *prog)
5724{
5725 eina_error_set(0);
5726
5727 GET_EPR_OR_RETURN(-1);
5728
5729 //printf("GET ACTION for program: %s [%d]\n", prog, epr->action);
5730 return epr->action;
5731}
5732
5733EAPI Eina_Bool
5734edje_edit_program_action_set(Evas_Object *obj, const char *prog, Edje_Action_Type action)
5735{
5736 Program_Script *ps;
5737
5738 eina_error_set(0);
5739
5740 GET_ED_OR_RETURN(EINA_FALSE);
5741 GET_EPR_OR_RETURN(EINA_FALSE);
5742
5743 //printf("SET ACTION for program: %s [%d]\n", prog, action);
5744 if (action >= EDJE_ACTION_TYPE_LAST) return EINA_FALSE;
5745
5746 if ((Edje_Action_Type)epr->action == action)
5747 return EINA_TRUE;
5748
5749 if (action == EDJE_ACTION_TYPE_SCRIPT)
5750 {
5751 ps = eina_hash_find(eed->program_scripts, &epr->id);
5752 if (!ps)
5753 {
5754 ps = _alloc(sizeof(Program_Script));
5755 if (!ps)
5756 return EINA_FALSE;
5757 }
5758 ps->id = epr->id;
5759 ps->code = strdup("");
5760 ps->dirty = EINA_TRUE;
5761 ps->delete_me = EINA_FALSE;
5762 eina_hash_set(eed->program_scripts, &ps->id, ps);
5763 _edje_edit_flag_script_dirty(eed, EINA_FALSE);
5764 }
5765 if (epr->action == EDJE_ACTION_TYPE_SCRIPT)
5766 {
5767 ps = eina_hash_find(eed->program_scripts, &epr->id);
5768 if (ps)
5769 {
5770 free(ps->code);
5771 free(ps->processed);
5772 ps->code = ps->processed = NULL;
5773 ps->dirty = EINA_FALSE;
5774 ps->delete_me = EINA_TRUE;
5775 _edje_edit_flag_script_dirty(eed, EINA_FALSE);
5776 }
5777 }
5778
5779 epr->action = action;
5780 return EINA_TRUE;
5781}
5782
5783EAPI Eina_List *
5784edje_edit_program_targets_get(Evas_Object *obj, const char *prog)
5785{
5786 Eina_List *l, *targets = NULL;
5787 Edje_Program_Target *t;
5788
5789 eina_error_set(0);
5790
5791 GET_ED_OR_RETURN(NULL);
5792 GET_EPR_OR_RETURN(NULL);
5793
5794 //printf("GET TARGETS for program: %s [count: %d]\n", prog, eina_list_count(epr->targets));
5795 EINA_LIST_FOREACH(epr->targets, l, t)
5796 {
5797 if (epr->action == EDJE_ACTION_TYPE_STATE_SET)
5798 {
5799 /* the target is a part */
5800 Edje_Real_Part *p = NULL;
5801
5802 p = ed->table_parts[t->id % ed->table_parts_size];
5803 if (p && p->part && p->part->name)
5804 targets = eina_list_append(targets,
5805 eina_stringshare_add(p->part->name));
5806 }
5807 else if (epr->action == EDJE_ACTION_TYPE_ACTION_STOP)
5808 {
5809 /* the target is a program */
5810 Edje_Program *p;
5811
5812 p = ed->table_programs[t->id % ed->table_programs_size];
5813 if (p && p->name)
5814 targets = eina_list_append(targets,
5815 eina_stringshare_add(p->name));
5816 }
5817 }
5818 return targets;
5819}
5820
5821EAPI Eina_Bool
5822edje_edit_program_targets_clear(Evas_Object *obj, const char *prog)
5823{
5824 eina_error_set(0);
5825
5826 GET_EPR_OR_RETURN(EINA_FALSE);
5827
5828 while (epr->targets)
5829 {
5830 Edje_Program_Target *prt;
5831
5832 prt = eina_list_data_get(epr->targets);
5833 epr->targets = eina_list_remove_list(epr->targets, epr->targets);
5834 free(prt);
5835 }
5836
5837 return EINA_TRUE;
5838}
5839
5840EAPI Eina_Bool
5841edje_edit_program_target_add(Evas_Object *obj, const char *prog, const char *target)
5842{
5843 int id;
5844 Edje_Program_Target *t;
5845
5846 eina_error_set(0);
5847
5848 GET_ED_OR_RETURN(EINA_FALSE);
5849 GET_EPR_OR_RETURN(EINA_FALSE);
5850
5851 if (epr->action == EDJE_ACTION_TYPE_STATE_SET)
5852 {
5853 /* the target is a part */
5854 Edje_Real_Part *rp;
5855
5856 rp = _edje_real_part_get(ed, target);
5857 if (!rp) return EINA_FALSE;
5858 id = rp->part->id;
5859 }
5860 else if (epr->action == EDJE_ACTION_TYPE_ACTION_STOP)
5861 {
5862 /* the target is a program */
5863 Edje_Program *tar;
5864
5865 tar = _edje_program_get_byname(obj, target);
5866 if (!tar) return EINA_FALSE;
5867 id = tar->id;
5868 }
5869 else
5870 return EINA_FALSE;
5871
5872 t = _alloc(sizeof(Edje_Program_Target));
5873 if (!t) return EINA_FALSE;
5874
5875 t->id = id;
5876 epr->targets = eina_list_append(epr->targets, t);
5877
5878 return EINA_TRUE;
5879}
5880
5881EAPI Eina_Bool
5882edje_edit_program_target_del(Evas_Object *obj, const char *prog, const char *target)
5883{
5884 int id;
5885 Eina_List *l;
5886 Edje_Program_Target *t;
5887
5888 eina_error_set(0);
5889
5890 GET_ED_OR_RETURN(EINA_FALSE);
5891 GET_EPR_OR_RETURN(EINA_FALSE);
5892
5893 if (epr->action == EDJE_ACTION_TYPE_STATE_SET)
5894 {
5895 /* the target is a part */
5896 Edje_Real_Part *rp;
5897
5898 rp = _edje_real_part_get(ed, target);
5899 if (!rp) return EINA_FALSE;
5900 id = rp->part->id;
5901 }
5902 else if (epr->action == EDJE_ACTION_TYPE_ACTION_STOP)
5903 {
5904 /* the target is a program */
5905 Edje_Program *tar;
5906
5907 tar = _edje_program_get_byname(obj, target);
5908 if (!tar) return EINA_FALSE;
5909 id = tar->id;
5910 }
5911 else
5912 return EINA_FALSE;
5913
5914 EINA_LIST_FOREACH(epr->targets, l, t)
5915 if (t->id == id)
5916 break;
5917 epr->targets = eina_list_remove_list(epr->targets, l);
5918 free(t);
5919
5920 return EINA_TRUE;
5921}
5922
5923EAPI Eina_List *
5924edje_edit_program_afters_get(Evas_Object *obj, const char *prog)
5925{
5926 Eina_List *l, *afters = NULL;
5927 Edje_Program_After *a;
5928
5929 eina_error_set(0);
5930
5931 GET_ED_OR_RETURN(NULL);
5932 GET_EPR_OR_RETURN(NULL);
5933
5934 // printf("GET AFTERS for program: %s [count: %d]\n", prog, eina_list_count(epr->after));
5935 EINA_LIST_FOREACH(epr->after, l, a)
5936 {
5937 Edje_Program *p = NULL;
5938
5939 p = ed->table_programs[a->id % ed->table_programs_size];
5940 if (p && p->name)
5941 {
5942 //printf(" a: %d name: %s\n", a->id, p->name);
5943 afters = eina_list_append(afters, eina_stringshare_add(p->name));
5944 }
5945 }
5946 return afters;
5947}
5948
5949EAPI Eina_Bool
5950edje_edit_program_afters_clear(Evas_Object *obj, const char *prog)
5951{
5952 eina_error_set(0);
5953
5954 GET_EPR_OR_RETURN(EINA_FALSE);
5955
5956 while (epr->after)
5957 {
5958 Edje_Program_After *pa;
5959
5960 pa = eina_list_data_get(epr->after);
5961 epr->after = eina_list_remove_list(epr->after, epr->after);
5962 free(pa);
5963 }
5964
5965 return EINA_TRUE;
5966}
5967
5968EAPI Eina_Bool
5969edje_edit_program_after_add(Evas_Object *obj, const char *prog, const char *after)
5970{
5971 Edje_Program *af;
5972 Edje_Program_After *a;
5973
5974 eina_error_set(0);
5975
5976 GET_EPR_OR_RETURN(EINA_FALSE);
5977
5978 af = _edje_program_get_byname(obj, after);
5979 if (!af) return EINA_FALSE;
5980
5981 a = _alloc(sizeof(Edje_Program_After));
5982 if (!a) return EINA_FALSE;
5983
5984 a->id = af->id;
5985
5986 epr->after = eina_list_append(epr->after, a);
5987
5988 return EINA_TRUE;
5989}
5990
5991EAPI Eina_Bool
5992edje_edit_program_after_del(Evas_Object *obj, const char *prog, const char *after)
5993{
5994 Edje_Program *af;
5995 Edje_Program_After *a;
5996 Eina_List *l;
5997
5998 eina_error_set(0);
5999
6000 GET_EPR_OR_RETURN(EINA_FALSE);
6001
6002 af = _edje_program_get_byname(obj, after);
6003 if (!af) return EINA_FALSE;
6004
6005 EINA_LIST_FOREACH(epr->after, l, a)
6006 if (a->id == af->id)
6007 {
6008 epr->after = eina_list_remove_list(epr->after, l);
6009 break;
6010 }
6011
6012 return EINA_TRUE;
6013}
6014
6015EAPI const char *
6016edje_edit_program_api_name_get(Evas_Object *obj, const char *prog)
6017{
6018 eina_error_set(0);
6019
6020 GET_EPR_OR_RETURN(NULL);
6021
6022 return eina_stringshare_add(epr->api.name);
6023}
6024
6025EAPI const char *
6026edje_edit_program_api_description_get(Evas_Object *obj, const char *prog)
6027{
6028 eina_error_set(0);
6029
6030 GET_EPR_OR_RETURN(NULL);
6031
6032 return eina_stringshare_add(epr->api.description);
6033}
6034
6035EAPI Eina_Bool
6036edje_edit_program_api_name_set(Evas_Object *obj, const char *prog, const char* name)
6037{
6038 eina_error_set(0);
6039
6040 GET_ED_OR_RETURN(EINA_FALSE);
6041 GET_EPR_OR_RETURN(EINA_FALSE);
6042
6043 _edje_if_string_free(ed, epr->api.name);
6044 epr->api.name = eina_stringshare_add(name);
6045
6046 return EINA_TRUE;
6047}
6048
6049EAPI Eina_Bool
6050edje_edit_program_api_description_set(Evas_Object *obj, const char *prog, const char *description)
6051{
6052 eina_error_set(0);
6053
6054 GET_ED_OR_RETURN(EINA_FALSE);
6055 GET_EPR_OR_RETURN(EINA_FALSE);
6056
6057 _edje_if_string_free(ed, epr->api.description);
6058 epr->api.description = eina_stringshare_add(description);
6059
6060 return EINA_TRUE;
6061}
6062
6063/*************************/
6064/* EMBRYO SCRIPTS API */
6065/*************************/
6066EAPI char *
6067edje_edit_script_get(Evas_Object *obj)
6068{
6069 eina_error_set(0);
6070
6071 GET_ED_OR_RETURN(NULL);
6072
6073 if (!ed->collection) return NULL;
6074 if (!eed->embryo_source) return NULL;
6075
6076 return strdup(eed->embryo_source);
6077}
6078
6079EAPI void
6080edje_edit_script_set(Evas_Object *obj, const char *code)
6081{
6082 eina_error_set(0);
6083
6084 GET_ED_OR_RETURN();
6085
6086 free(eed->embryo_source);
6087 free(eed->embryo_processed);
6088
6089 if (code)
6090 eed->embryo_source = strdup(code);
6091 else
6092 eed->embryo_source = NULL;
6093 eed->embryo_processed = NULL;
6094
6095 eed->embryo_source_dirty = EINA_TRUE;
6096
6097 _edje_edit_flag_script_dirty(eed, EINA_FALSE);
6098}
6099
6100EAPI char *
6101edje_edit_script_program_get(Evas_Object *obj, const char *prog)
6102{
6103 Program_Script *ps;
6104
6105 eina_error_set(0);
6106
6107 GET_ED_OR_RETURN(NULL);
6108 GET_EPR_OR_RETURN(NULL);
6109
6110 if (epr->action != EDJE_ACTION_TYPE_SCRIPT)
6111 return NULL;
6112
6113 ps = eina_hash_find(eed->program_scripts, prog);
6114 if (!ps) /* mmm? it should be there, even if empty */
6115 return NULL;
6116
6117 return ps->code ? strdup(ps->code) : NULL;
6118}
6119
6120EAPI void
6121edje_edit_script_program_set(Evas_Object *obj, const char *prog, const char *code)
6122{
6123 Program_Script *ps;
6124
6125 eina_error_set(0);
6126
6127 GET_ED_OR_RETURN();
6128 GET_EPR_OR_RETURN();
6129
6130 if (epr->action != EDJE_ACTION_TYPE_SCRIPT)
6131 return;
6132
6133 ps = eina_hash_find(eed->program_scripts, prog);
6134 if (!ps) /* ???? how so? */
6135 return;
6136
6137 free(ps->code);
6138 free(ps->processed);
6139
6140 if (code)
6141 ps->code = strdup(code);
6142 else
6143 ps->code = NULL;
6144 ps->processed = NULL;
6145 ps->dirty = EINA_TRUE;
6146
6147 _edje_edit_flag_script_dirty(eed, EINA_FALSE);
6148}
6149
6150static int
6151__part_replace(Edje_Edit *eed, char *pcode, char *name)
6152{
6153 int id;
6154
6155 id = _edje_part_id_find((Edje *)eed, name);
6156 if (id < 0)
6157 return 0;
6158 return eina_convert_itoa(id, pcode);
6159}
6160
6161static int
6162__program_replace(Edje_Edit *eed, char *pcode, char *name)
6163{
6164 int id;
6165
6166 id = _edje_program_id_find(eed, name);
6167 if (id < 0)
6168 return 0;
6169 return eina_convert_itoa(id, pcode);
6170}
6171
6172static int
6173__group_replace(Edje_Edit *eed __UNUSED__, char *pcode, char *name)
6174{
6175 strcpy(pcode, name);
6176 return strlen(name) + 1;
6177}
6178
6179static int
6180__image_replace(Edje_Edit *eed, char *pcode, char *name)
6181{
6182 int id;
6183
6184 id = _edje_image_id_find(eed, name);
6185 if (id < 0)
6186 return 0;
6187 return eina_convert_itoa(id, pcode);
6188}
6189
6190static char *
6191_edje_edit_script_process(Edje_Edit *eed, const char *progname, char *code)
6192{
6193 char *pcode, *psrc, *pdst;
6194 int codesize, pcodesize;
6195 int quoted = 0, escaped = 0;
6196 int line = 1;
6197 Eina_Bool success = EINA_TRUE;
6198
6199 codesize = strlen(code);
6200 pcode = malloc(codesize + 1);
6201 if (!pcode)
6202 return NULL;
6203
6204 pcodesize = 0;
6205 psrc = code;
6206 pdst = pcode;
6207 while (*psrc)
6208 {
6209 if (!quoted)
6210 {
6211 char *ptr = NULL;
6212 const char *what = NULL;
6213 int (*func)(Edje_Edit *, char *, char *);
6214
6215 if (*psrc == 'P')
6216 {
6217 if (!strncmp(psrc, "PART:\"", 6))
6218 {
6219 psrc += 6;
6220 ptr = psrc;
6221 func = __part_replace;
6222 what = "part";
6223 }
6224 else if (!strncmp(psrc, "PROGRAM:\"", 9))
6225 {
6226 psrc += 9;
6227 ptr = psrc;
6228 func = __program_replace;
6229 what = "program";
6230 }
6231 }
6232 else if (*psrc == 'G')
6233 {
6234 if (!strncmp(psrc, "GROUP:\"", 7))
6235 {
6236 psrc += 7;
6237 ptr = psrc;
6238 func = __group_replace;
6239 what = "group";
6240 }
6241 }
6242 else if (*psrc == 'I')
6243 {
6244 if (!strncmp(psrc, "IMAGE:\"", 7))
6245 {
6246 psrc += 7;
6247 ptr = psrc;
6248 func = __image_replace;
6249 what = "image";
6250 }
6251 }
6252 else if (*psrc == '#')
6253 {
6254 while (*psrc)
6255 if (*psrc == '\n')
6256 break;
6257 line++;
6258 continue;
6259 }
6260 else if (*psrc == '\"')
6261 quoted = 1;
6262 else if (*psrc == '\n')
6263 line++;
6264
6265 if (ptr)
6266 {
6267 int i = 0, inesc = 0;
6268 char *name;
6269 while (*psrc)
6270 {
6271 if (!inesc)
6272 {
6273 if (*psrc == '\\')
6274 inesc = 1;
6275 else if (*psrc == '\"')
6276 {
6277 /* string concatenation as in "foo""bar" */
6278 if (*(psrc + 1) != '\"')
6279 {
6280 psrc++;
6281 break;
6282 }
6283 else
6284 psrc++;
6285 }
6286 }
6287 else
6288 inesc = 0;
6289 psrc++;
6290 }
6291 name = alloca(psrc - ptr);
6292 inesc = 0;
6293 while (*ptr)
6294 {
6295 if (!inesc)
6296 {
6297 if (*ptr == '\\')
6298 inesc = 1;
6299 else if (*ptr == '\"')
6300 {
6301 if (*(ptr + 1) == '\"')
6302 ptr++;
6303 else
6304 {
6305 name[i] = 0;
6306 break;
6307 }
6308 }
6309 else
6310 {
6311 name[i] = *ptr;
6312 name[i + 1] = 0;
6313 i++;
6314 }
6315 }
6316 else
6317 inesc = 0;
6318 ptr++;
6319 }
6320 i = func(eed, pdst, name);
6321 if (!i)
6322 {
6323 Edje_Edit_Script_Error *se;
6324 se = malloc(sizeof(Edje_Edit_Script_Error));
6325 se->program_name = progname ?
6326 eina_stringshare_add(progname) : NULL;
6327 se->line = line;
6328 se->error_str = eina_stringshare_printf(
6329 "Referenced %s '%s' could not be found in object.",
6330 what, name);
6331 eed->errors = eina_list_append(eed->errors, se);
6332 success = EINA_FALSE;
6333 }
6334 else
6335 {
6336 pcodesize += i;
6337 pdst += i;
6338 }
6339 /* replaced reference for the right value, now go
6340 * to the next iteration */
6341 continue;
6342 }
6343 }
6344 else
6345 {
6346 if (!escaped)
6347 {
6348 if (*psrc == '\"')
6349 quoted = 0;
6350 else if (*psrc == '\\')
6351 escaped = 1;
6352 }
6353 else if (escaped)
6354 escaped = 0;
6355 }
6356 *pdst = *psrc;
6357 pdst++;
6358 psrc++;
6359 pcodesize++;
6360 }
6361
6362 if (!success)
6363 {
6364 free(pcode);
6365 return NULL;
6366 }
6367
6368 if (pcodesize < codesize)
6369 pcode = realloc(pcode, pcodesize + 1);
6370 pcode[pcodesize] = 0;
6371
6372 return pcode;
6373}
6374
6375static Eina_Bool
6376_edje_edit_embryo_rebuild(Edje_Edit *eed)
6377{
6378 FILE *f;
6379 int fd, size, ret;
6380 const char *tmp_dir;
6381 char tmp_in[PATH_MAX];
6382 char tmp_out[PATH_MAX];
6383 char buf[4096];
6384 Eina_Iterator *it;
6385 Program_Script *ps;
6386 Edje_Part_Collection *edc;
6387 Eina_Bool success = EINA_TRUE; /* we are optimists! */
6388 Edje_Edit_Script_Error *se;
6389
6390 EINA_LIST_FREE(eed->errors, se)
6391 {
6392 eina_stringshare_del(se->program_name);
6393 eina_stringshare_del(se->error_str);
6394 free(se);
6395 }
6396
6397#ifdef HAVE_EVIL
6398 tmp_dir = evil_tmpdir_get();
6399#else
6400 tmp_dir = "/tmp";
6401#endif
6402
6403 snprintf(tmp_in, sizeof(tmp_in), "%s/edje_edit.sma-tmp-XXXXXX", tmp_dir);
6404 snprintf(tmp_out, sizeof(tmp_out), "%s/edje_edit.amx-tmp-XXXXXX", tmp_dir);
6405
6406 fd = mkstemp(tmp_in);
6407 if (fd < 0)
6408 return EINA_FALSE; /* FIXME: report something */
6409
6410 f = fdopen(fd, "w");
6411 if (!f)
6412 {
6413 close(fd);
6414 unlink(tmp_in);
6415 return EINA_FALSE;
6416 }
6417
6418 fprintf(f, "#include <edje>\n");
6419 if (eed->embryo_source)
6420 {
6421 if (eed->all_dirty)
6422 {
6423 free(eed->embryo_processed);
6424 eed->embryo_processed = NULL;
6425 }
6426 if (!eed->embryo_processed)
6427 eed->embryo_processed = _edje_edit_script_process(eed, NULL,
6428 eed->embryo_source);
6429 if (!eed->embryo_processed)
6430 {
6431 /* oops.. an error finding references parts or something.
6432 * we could flag it and do some lighter processing of the
6433 * rest of the scripts, in order to find all the errors of
6434 * this kind and report them at once, but knowing already
6435 * that the script will not compile we can avoid some work
6436 */
6437 success = EINA_FALSE;
6438 }
6439 else
6440 fprintf(f, "%s", eed->embryo_processed);
6441 }
6442
6443 it = eina_hash_iterator_data_new(eed->program_scripts);
6444 EINA_ITERATOR_FOREACH(it, ps)
6445 {
6446 Edje_Program *epr;
6447
6448 if (ps->delete_me)
6449 continue;
6450 if (eed->all_dirty)
6451 {
6452 free(ps->processed);
6453 ps->processed = NULL;
6454 }
6455 epr = eed->base.table_programs[ps->id];
6456 if (!ps->processed)
6457 ps->processed = _edje_edit_script_process(eed, epr->name, ps->code);
6458 if (!ps->processed)
6459 {
6460 /* oops.. an error finding references parts or something.
6461 * we could flag it and do some lighter processing of the
6462 * rest of the scripts, in order to find all the errors of
6463 * this kind and report them at once, but knowing already
6464 * that the script will not compile we can avoid some work
6465 */
6466 success = EINA_FALSE;
6467 continue;
6468 }
6469 fprintf(f, "public _p%i(sig[], src[]) {\n", ps->id);
6470 fprintf(f, "%s", ps->processed);
6471 fprintf(f, "}\n");
6472 }
6473 eina_iterator_free(it);
6474
6475 fclose(f);
6476
6477 if (!success)
6478 goto almost_out;
6479
6480 fd = mkstemp(tmp_out);
6481 if (fd < 0)
6482 {
6483 success = EINA_FALSE;
6484 goto almost_out;
6485 }
6486
6487 snprintf(buf, sizeof(buf), "embryo_cc -i %s/include -o %s %s",
6488 PACKAGE_DATA_DIR, tmp_out, tmp_in);
6489 ret = system(buf);
6490
6491 if ((ret < 0) || (ret > 1))
6492 {
6493 success = EINA_FALSE;
6494 close(fd);
6495 goto the_doorway;
6496 }
6497
6498 f = fdopen(fd, "rb");
6499 if (!f)
6500 {
6501 success = EINA_FALSE;
6502 close(fd);
6503 goto the_doorway;
6504 }
6505
6506 fseek(f, 0, SEEK_END);
6507 size = ftell(f);
6508 rewind(f);
6509
6510 free(eed->bytecode);
6511 if (size > 0)
6512 {
6513 eed->bytecode = malloc(size);
6514 if (!eed->bytecode)
6515 {
6516 success = EINA_FALSE;
6517 goto the_way_out;
6518 }
6519 if (fread(eed->bytecode, size, 1, f) != 1)
6520 {
6521 success = EINA_FALSE;
6522 goto the_way_out;
6523 }
6524 }
6525 else
6526 eed->bytecode = NULL; /* correctness mostly, I don't see why we
6527 would get a 0 sized program */
6528
6529 eed->bytecode_size = size;
6530 eed->bytecode_dirty = EINA_TRUE;
6531 eed->script_need_recompile = EINA_FALSE;
6532 eed->all_dirty = EINA_FALSE;
6533
6534 edc = eed->base.collection;
6535 embryo_program_free(edc->script);
6536 edc->script = embryo_program_new(eed->bytecode, eed->bytecode_size);
6537 _edje_embryo_script_init(edc);
6538 _edje_var_init((Edje *)eed);
6539
6540the_way_out:
6541 fclose(f);
6542the_doorway:
6543 unlink(tmp_out);
6544almost_out:
6545 unlink(tmp_in);
6546
6547 return success;
6548}
6549
6550EAPI Eina_Bool
6551edje_edit_script_compile(Evas_Object *obj)
6552{
6553 GET_ED_OR_RETURN(EINA_FALSE);
6554
6555 if (!eed->script_need_recompile)
6556 return EINA_TRUE;
6557
6558 return _edje_edit_embryo_rebuild(eed);
6559}
6560
6561EAPI const Eina_List *
6562edje_edit_script_error_list_get(Evas_Object *obj)
6563{
6564 GET_ED_OR_RETURN(NULL);
6565 return eed->errors;
6566}
6567
6568/***************************/
6569/* EDC SOURCE GENERATION */
6570/***************************/
6571#define I0 ""
6572#define I1 " "
6573#define I2 " "
6574#define I3 " "
6575#define I4 " "
6576#define I5 " "
6577#define I6 " "
6578#define I7 " "
6579
6580#define BUF_APPEND(STR) \
6581 ret &= eina_strbuf_append(buf, STR)
6582
6583#define BUF_APPENDF(FMT, ...) \
6584 ret &= eina_strbuf_append_printf(buf, FMT, ##__VA_ARGS__)
6585
6586static const char *types[] = {"NONE", "RECT", "TEXT", "IMAGE", "SWALLOW", "TEXTBLOCK", "GRADIENT", "GROUP", "BOX", "TABLE", "EXTERNAL"};
6587static const char *effects[] = {"NONE", "PLAIN", "OUTLINE", "SOFT_OUTLINE", "SHADOW", "SOFT_SHADOW", "OUTLINE_SHADOW", "OUTLINE_SOFT_SHADOW ", "FAR_SHADOW ", "FAR_SOFT_SHADOW", "GLOW"};
6588static const char *prefers[] = {"NONE", "VERTICAL", "HORIZONTAL", "BOTH"};
6589
6590 static Eina_Bool
6591_edje_generate_source_of_colorclass(Edje * ed, const char *name, Eina_Strbuf *buf)
6592{
6593 Eina_List *l;
6594 Edje_Color_Class *cc;
6595 Eina_Bool ret = EINA_TRUE;
6596
6597 EINA_LIST_FOREACH(ed->file->color_classes, l, cc)
6598 if (!strcmp(cc->name, name))
6599 {
6600 BUF_APPENDF(I1 "color_class { name: \"%s\";\n", cc->name);
6601 BUF_APPENDF(I2 "color: %d %d %d %d;\n", cc->r, cc->g, cc->b, cc->a);
6602 BUF_APPENDF(I2 "color2: %d %d %d %d;\n", cc->r2, cc->g2, cc->b2, cc->a2);
6603 BUF_APPENDF(I2 "color3: %d %d %d %d;\n", cc->r3, cc->g3, cc->b3, cc->a3);
6604 BUF_APPEND(I1 "}\n");
6605 }
6606 return ret;
6607}
6608
6609 static Eina_Bool
6610_edje_generate_source_of_style(Edje * ed, const char *name, Eina_Strbuf *buf)
6611{
6612 Eina_List *l, *ll;
6613 Edje_Style *s;
6614 Edje_Style_Tag *t;
6615 Eina_Bool ret = EINA_TRUE;
6616
6617 EINA_LIST_FOREACH(ed->file->styles, l, s)
6618 if (!strcmp(s->name, name))
6619 {
6620 t = s->tags ? s->tags->data : NULL;
6621 BUF_APPENDF(I1 "style { name:\"%s\";\n", s->name);
6622 if (t && t->value)
6623 BUF_APPENDF(I2 "base: \"%s\";\n", t->value);
6624
6625 EINA_LIST_FOREACH(s->tags, ll, t)
6626 if (ll->prev && t && t->value)
6627 BUF_APPENDF(I2 "tag: \"%s\" \"%s\";\n", t->key,
6628 t->value);
6629 BUF_APPEND(I1 "}\n");
6630 return ret;
6631 }
6632 return EINA_FALSE;
6633}
6634
6635static Eina_Bool
6636_edje_generate_source_of_program(Evas_Object *obj, const char *program, Eina_Strbuf *buf)
6637{
6638 Eina_List *l, *ll;
6639 const char *s, *s2;
6640 double db, db2;
6641 char *data;
6642 Eina_Bool ret = EINA_TRUE;
6643 const char *api_name, *api_description;
6644 Edje_Program *epr;
6645
6646 GET_ED_OR_RETURN(EINA_FALSE);
6647
6648 epr = _edje_program_get_byname(obj, program);
6649
6650 BUF_APPENDF(I3"program { name: \"%s\";\n", program);
6651
6652 /* Signal */
6653 if ((s = edje_edit_program_signal_get(obj, program)))
6654 {
6655 BUF_APPENDF(I4"signal: \"%s\";\n", s);
6656 edje_edit_string_free(s);
6657 }
6658
6659 /* Source */
6660 if ((s = edje_edit_program_source_get(obj, program)))
6661 {
6662 BUF_APPENDF(I4"source: \"%s\";\n", s);
6663 edje_edit_string_free(s);
6664 }
6665
6666 /* Action */
6667 switch (edje_edit_program_action_get(obj, program))
6668 {
6669 case EDJE_ACTION_TYPE_ACTION_STOP:
6670 BUF_APPEND(I4"action: ACTION_STOP;\n");
6671 break;
6672 case EDJE_ACTION_TYPE_STATE_SET:
6673 if ((s = edje_edit_program_state_get(obj, program)))
6674 {
6675 BUF_APPENDF(I4"action: STATE_SET \"%s\" %.2f;\n", s,
6676 edje_edit_program_value_get(obj, program));
6677 edje_edit_string_free(s);
6678 }
6679 break;
6680 case EDJE_ACTION_TYPE_SIGNAL_EMIT:
6681 s = edje_edit_program_state_get(obj, program);
6682 s2 = edje_edit_program_state2_get(obj, program);
6683 if (s && s2)
6684 {
6685 BUF_APPENDF(I4"action: SIGNAL_EMIT \"%s\" \"%s\";\n", s, s2);
6686 edje_edit_string_free(s);
6687 edje_edit_string_free(s2);
6688 }
6689 break;
6690 case EDJE_ACTION_TYPE_SCRIPT:
6691 {
6692 Program_Script *ps;
6693
6694 ps = eina_hash_find(eed->program_scripts, &epr->id);
6695 if (ps && !ps->delete_me)
6696 {
6697 BUF_APPEND(I4"script {\n");
6698 BUF_APPEND(ps->code);
6699 BUF_APPEND(I4"}\n");
6700 }
6701 }
6702 break;
6703 //TODO Support Drag
6704 //~ case EDJE_ACTION_TYPE_DRAG_VAL_SET:
6705 //~ eina_strbuf_append(buf, I4"action: DRAG_VAL_SET TODO;\n");
6706 //~ break;
6707 //~ case EDJE_ACTION_TYPE_DRAG_VAL_STEP:
6708 //~ eina_strbuf_append(buf, I4"action: DRAG_VAL_STEP TODO;\n");
6709 //~ break;
6710 //~ case EDJE_ACTION_TYPE_DRAG_VAL_PAGE:
6711 //~ eina_strbuf_append(buf, I4"action: DRAG_VAL_PAGE TODO;\n");
6712 //~ break;
6713 default:
6714 break;
6715 }
6716
6717 /* Transition */
6718 db = edje_edit_program_transition_time_get(obj, program);
6719 switch (edje_edit_program_transition_get(obj, program))
6720 {
6721 case EDJE_TWEEN_MODE_LINEAR:
6722 if (db)
6723 BUF_APPENDF(I4"transition: LINEAR %.5f;\n", db);
6724 break;
6725 case EDJE_TWEEN_MODE_ACCELERATE:
6726 BUF_APPENDF(I4"transition: ACCELERATE %.5f;\n", db);
6727 break;
6728 case EDJE_TWEEN_MODE_DECELERATE:
6729 BUF_APPENDF(I4"transition: DECELERATE %.5f;\n", db);
6730 break;
6731 case EDJE_TWEEN_MODE_SINUSOIDAL:
6732 BUF_APPENDF(I4"transition: SINUSOIDAL %.5f;\n", db);
6733 break;
6734 default:
6735 break;
6736 }
6737
6738 /* In */
6739 db = edje_edit_program_in_from_get(obj, program);
6740 db2 = edje_edit_program_in_range_get(obj, program);
6741 if (db || db2)
6742 BUF_APPENDF(I4"in: %.5f %.5f;\n", db, db2);
6743
6744 /* Targets */
6745 if ((ll = edje_edit_program_targets_get(obj, program)))
6746 {
6747 EINA_LIST_FOREACH(ll, l, data)
6748 BUF_APPENDF(I4"target: \"%s\";\n", data);
6749 edje_edit_string_list_free(ll);
6750 }
6751
6752 /* Afters */
6753 if ((ll = edje_edit_program_afters_get(obj, program)))
6754 {
6755 EINA_LIST_FOREACH(ll, l, data)
6756 BUF_APPENDF(I4"after: \"%s\";\n", data);
6757 edje_edit_string_list_free(ll);
6758 }
6759
6760 // TODO Support script {}
6761 /* api */
6762 api_name = edje_edit_program_api_name_get(obj, program);
6763 api_description = edje_edit_program_api_description_get(obj, program);
6764
6765 if (api_name || api_description)
6766 {
6767 if (api_name && api_description)
6768 {
6769 BUF_APPENDF(I4"api: \"%s\" \"%s\";\n", api_name, api_description);
6770 edje_edit_string_free(api_name);
6771 edje_edit_string_free(api_description);
6772 }
6773 else
6774 if (api_name)
6775 {
6776 BUF_APPENDF(I4"api: \"%s\" \"\";\n", api_name);
6777 edje_edit_string_free(api_name);
6778 }
6779 else
6780 {
6781 BUF_APPENDF(I4"api: \"\" \"%s\";\n", api_description);
6782 edje_edit_string_free(api_description);
6783 }
6784 }
6785
6786 BUF_APPEND(I3 "}\n");
6787 return ret;
6788}
6789
6790static Eina_Bool
6791_edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *state, double value, Eina_Strbuf *buf)
6792{
6793 Eina_List *l, *ll;
6794 Eina_Bool ret = EINA_TRUE;
6795
6796 GET_PD_OR_RETURN(EINA_FALSE);
6797
6798 BUF_APPENDF(I4"description { state: \"%s\" %g;\n", pd->state.name, pd->state.value);
6799 //TODO Support inherit
6800
6801 if (!pd->visible)
6802 BUF_APPEND(I5"visible: 0;\n");
6803
6804 if (pd->align.x != 0.5 || pd->align.y != 0.5)
6805 BUF_APPENDF(I5"align: %g %g;\n", TO_DOUBLE(pd->align.x), TO_DOUBLE(pd->align.y));
6806
6807 //TODO Support fixed
6808
6809 if (pd->min.w || pd->min.h)
6810 BUF_APPENDF(I5"min: %d %d;\n", pd->min.w, pd->min.h);
6811 if (pd->max.w != -1 || pd->max.h != -1)
6812 BUF_APPENDF(I5"max: %d %d;\n", pd->max.w, pd->max.h);
6813
6814 //TODO Support step
6815
6816 if (pd->aspect.min || pd->aspect.max)
6817 BUF_APPENDF(I5"aspect: %g %g;\n", TO_DOUBLE(pd->aspect.min), TO_DOUBLE(pd->aspect.max));
6818 if (pd->aspect.prefer)
6819 BUF_APPENDF(I5"aspect_preference: %s;\n", prefers[pd->aspect.prefer]);
6820
6821 if (pd->color_class)
6822 BUF_APPENDF(I5"color_class: \"%s\";\n", pd->color_class);
6823
6824 if (pd->color.r != 255 || pd->color.g != 255 ||
6825 pd->color.b != 255 || pd->color.a != 255)
6826 BUF_APPENDF(I5"color: %d %d %d %d;\n",
6827 pd->color.r, pd->color.g, pd->color.b, pd->color.a);
6828 if (pd->color2.r != 0 || pd->color2.g != 0 ||
6829 pd->color2.b != 0 || pd->color2.a != 255)
6830 BUF_APPENDF(I5"color2: %d %d %d %d;\n",
6831 pd->color2.r, pd->color2.g, pd->color2.b, pd->color2.a);
6832
6833 if (rp->part->type == EDJE_PART_TYPE_TEXT
6834 || rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
6835 {
6836 Edje_Part_Description_Text *txt;
6837
6838 txt = (Edje_Part_Description_Text *) pd;
6839
6840 if (txt->text.color3.r != 0 || txt->text.color3.g != 0 ||
6841 txt->text.color3.b != 0 || txt->text.color3.a != 128)
6842 BUF_APPENDF(I5"color3: %d %d %d %d;\n",
6843 txt->text.color3.r, txt->text.color3.g, txt->text.color3.b, txt->text.color3.a);
6844 }
6845
6846 //Rel1
6847 if (pd->rel1.relative_x || pd->rel1.relative_y || pd->rel1.offset_x ||
6848 pd->rel1.offset_y || pd->rel1.id_x != -1 || pd->rel1.id_y != -1)
6849 {
6850 BUF_APPEND(I5"rel1 {\n");
6851 if (pd->rel1.relative_x || pd->rel1.relative_y)
6852 BUF_APPENDF(I6"relative: %g %g;\n", TO_DOUBLE(pd->rel1.relative_x), TO_DOUBLE(pd->rel1.relative_y));
6853 if (pd->rel1.offset_x || pd->rel1.offset_y)
6854 BUF_APPENDF(I6"offset: %d %d;\n", pd->rel1.offset_x, pd->rel1.offset_y);
6855 if (pd->rel1.id_x != -1 && pd->rel1.id_x == pd->rel1.id_y)
6856 BUF_APPENDF(I6"to: \"%s\";\n", ed->table_parts[pd->rel1.id_x]->part->name);
6857 else
6858 {
6859 if (pd->rel1.id_x != -1)
6860 BUF_APPENDF(I6"to_x: \"%s\";\n", ed->table_parts[pd->rel1.id_x]->part->name);
6861 if (pd->rel1.id_y != -1)
6862 BUF_APPENDF(I6"to_y: \"%s\";\n", ed->table_parts[pd->rel1.id_y]->part->name);
6863 }
6864 BUF_APPEND(I5"}\n");//rel1
6865 }
6866
6867 //Rel2
6868 if (pd->rel2.relative_x != 1.0 || pd->rel2.relative_y != 1.0 ||
6869 pd->rel2.offset_x != -1 || pd->rel2.offset_y != -1 ||
6870 pd->rel2.id_x != -1 || pd->rel2.id_y != -1)
6871 {
6872 BUF_APPEND(I5"rel2 {\n");
6873 if (TO_DOUBLE(pd->rel2.relative_x) != 1.0 || TO_DOUBLE(pd->rel2.relative_y) != 1.0)
6874 BUF_APPENDF(I6"relative: %g %g;\n", TO_DOUBLE(pd->rel2.relative_x), TO_DOUBLE(pd->rel2.relative_y));
6875 if (pd->rel2.offset_x != -1 || pd->rel2.offset_y != -1)
6876 BUF_APPENDF(I6"offset: %d %d;\n", pd->rel2.offset_x, pd->rel2.offset_y);
6877 if (pd->rel2.id_x != -1 && pd->rel2.id_x == pd->rel2.id_y)
6878 BUF_APPENDF(I6"to: \"%s\";\n", ed->table_parts[pd->rel2.id_x]->part->name);
6879 else
6880 {
6881 if (pd->rel2.id_x != -1)
6882 BUF_APPENDF(I6"to_x: \"%s\";\n", ed->table_parts[pd->rel2.id_x]->part->name);
6883 if (pd->rel2.id_y != -1)
6884 BUF_APPENDF(I6"to_y: \"%s\";\n", ed->table_parts[pd->rel2.id_y]->part->name);
6885 }
6886 BUF_APPEND(I5"}\n");//rel2
6887 }
6888
6889 //Image
6890 if (rp->part->type == EDJE_PART_TYPE_IMAGE)
6891 {
6892 char *data;
6893 const char *image_name;
6894
6895 Edje_Part_Description_Image *img;
6896
6897 img = (Edje_Part_Description_Image *) pd;
6898
6899 BUF_APPEND(I5"image {\n");
6900
6901 image_name = _edje_image_name_find(eed, img->image.id);
6902 if (image_name)
6903 BUF_APPENDF(I6"normal: \"%s\";\n", image_name);
6904
6905 ll = edje_edit_state_tweens_list_get(obj, part, state, value);
6906 EINA_LIST_FOREACH(ll, l, data)
6907 BUF_APPENDF(I6"tween: \"%s\";\n", data);
6908 edje_edit_string_list_free(ll);
6909
6910 if (img->image.border.l || img->image.border.r || img->image.border.t || img->image.border.b)
6911 BUF_APPENDF(I6"border: %d %d %d %d;\n", img->image.border.l, img->image.border.r, img->image.border.t, img->image.border.b);
6912 if (img->image.border.no_fill == 1)
6913 BUF_APPEND(I6"middle: NONE;\n");
6914 else if (img->image.border.no_fill == 0)
6915 BUF_APPEND(I6"middle: DEFAULT;\n");
6916 else if (img->image.border.no_fill == 2)
6917 BUF_APPEND(I6"middle: SOLID;\n");
6918
6919 BUF_APPEND(I5"}\n");//image
6920
6921 //Fill
6922
6923 BUF_APPEND(I5"fill {\n");
6924 if (!img->image.fill.smooth)
6925 BUF_APPEND(I6"smooth: 0;\n");
6926 //TODO Support spread
6927
6928 if (img->image.fill.pos_rel_x || img->image.fill.pos_rel_y ||
6929 img->image.fill.pos_abs_x || img->image.fill.pos_abs_y)
6930 {
6931 BUF_APPEND(I6"origin {\n");
6932 if (img->image.fill.pos_rel_x || img->image.fill.pos_rel_y)
6933 BUF_APPENDF(I7"relative: %g %g;\n", TO_DOUBLE(img->image.fill.pos_rel_x), TO_DOUBLE(img->image.fill.pos_rel_y));
6934 if (img->image.fill.pos_abs_x || img->image.fill.pos_abs_y)
6935 BUF_APPENDF(I7"offset: %d %d;\n", img->image.fill.pos_abs_x, img->image.fill.pos_abs_y);
6936 BUF_APPEND(I6"}\n");
6937 }
6938
6939 if (TO_DOUBLE(img->image.fill.rel_x) != 1.0 || TO_DOUBLE(img->image.fill.rel_y) != 1.0 ||
6940 img->image.fill.abs_x || img->image.fill.abs_y)
6941 {
6942 BUF_APPEND(I6"size {\n");
6943 if (img->image.fill.rel_x != 1.0 || img->image.fill.rel_y != 1.0)
6944 BUF_APPENDF(I7"relative: %g %g;\n", TO_DOUBLE(img->image.fill.rel_x), TO_DOUBLE(img->image.fill.rel_y));
6945 if (img->image.fill.abs_x || img->image.fill.abs_y)
6946 BUF_APPENDF(I7"offset: %d %d;\n", img->image.fill.abs_x, img->image.fill.abs_y);
6947 BUF_APPEND(I6"}\n");
6948 }
6949
6950 BUF_APPEND(I5"}\n");
6951 }
6952
6953 if (rp->part->type == EDJE_PART_TYPE_PROXY)
6954 {
6955 Edje_Part_Description_Proxy *pro;
6956
6957 pro = (Edje_Part_Description_Proxy *) pd;
6958
6959 //Fill
6960
6961 BUF_APPEND(I5"fill {\n");
6962 if (!pro->proxy.fill.smooth)
6963 BUF_APPEND(I6"smooth: 0;\n");
6964 //TODO Support spread
6965 //TODO Support source
6966
6967 if (pro->proxy.fill.pos_rel_x || pro->proxy.fill.pos_rel_y ||
6968 pro->proxy.fill.pos_abs_x || pro->proxy.fill.pos_abs_y)
6969 {
6970 BUF_APPEND(I6"origin {\n");
6971 if (pro->proxy.fill.pos_rel_x || pro->proxy.fill.pos_rel_y)
6972 BUF_APPENDF(I7"relative: %g %g;\n", TO_DOUBLE(pro->proxy.fill.pos_rel_x), TO_DOUBLE(pro->proxy.fill.pos_rel_y));
6973 if (pro->proxy.fill.pos_abs_x || pro->proxy.fill.pos_abs_y)
6974 BUF_APPENDF(I7"offset: %d %d;\n", pro->proxy.fill.pos_abs_x, pro->proxy.fill.pos_abs_y);
6975 BUF_APPEND(I6"}\n");
6976 }
6977
6978 if (TO_DOUBLE(pro->proxy.fill.rel_x) != 1.0 || TO_DOUBLE(pro->proxy.fill.rel_y) != 1.0 ||
6979 pro->proxy.fill.abs_x || pro->proxy.fill.abs_y)
6980 {
6981 BUF_APPEND(I6"size {\n");
6982 if (pro->proxy.fill.rel_x != 1.0 || pro->proxy.fill.rel_y != 1.0)
6983 BUF_APPENDF(I7"relative: %g %g;\n", TO_DOUBLE(pro->proxy.fill.rel_x), TO_DOUBLE(pro->proxy.fill.rel_y));
6984 if (pro->proxy.fill.abs_x || pro->proxy.fill.abs_y)
6985 BUF_APPENDF(I7"offset: %d %d;\n", pro->proxy.fill.abs_x, pro->proxy.fill.abs_y);
6986 BUF_APPEND(I6"}\n");
6987 }
6988
6989 BUF_APPEND(I5"}\n");
6990 }
6991
6992 //Text
6993 if (rp->part->type == EDJE_PART_TYPE_TEXT)
6994 {
6995 Edje_Part_Description_Text *txt;
6996
6997 txt = (Edje_Part_Description_Text *) pd;
6998
6999 BUF_APPEND(I5"text {\n");
7000 if (edje_string_get(&txt->text.text))
7001 {
7002 if (txt->text.text.id)
7003 BUF_APPENDF(I6"text: _(\"%s\");\n", edje_string_id_get(&txt->text.text));
7004 else
7005 BUF_APPENDF(I6"text: \"%s\";\n", edje_string_get(&txt->text.text));
7006 }
7007 if (edje_string_get(&txt->text.font))
7008 {
7009 if (txt->text.font.id)
7010 BUF_APPENDF(I6"font: _(\"%s\");\n", edje_string_id_get(&txt->text.font));
7011 else
7012 BUF_APPENDF(I6"font: \"%s\";\n", edje_string_get(&txt->text.font));
7013 }
7014 if (txt->text.size)
7015 BUF_APPENDF(I6"size: %d;\n", txt->text.size);
7016 if (txt->text.text_class)
7017 BUF_APPENDF(I6"text_class: \"%s\";\n", txt->text.text_class);
7018 if (txt->text.fit_x || txt->text.fit_y)
7019 BUF_APPENDF(I6"fit: %d %d;\n", txt->text.fit_x, txt->text.fit_y);
7020 //TODO Support min & max
7021 if (TO_DOUBLE(txt->text.align.x) != 0.5 || TO_DOUBLE(txt->text.align.y) != 0.5)
7022 BUF_APPENDF(I6"align: %g %g;\n", TO_DOUBLE(txt->text.align.x), TO_DOUBLE(txt->text.align.y));
7023 //TODO Support source
7024 //TODO Support text_source
7025 if (txt->text.elipsis)
7026 BUF_APPENDF(I6"elipsis: %g;\n", txt->text.elipsis);
7027 BUF_APPEND(I5"}\n");
7028 }
7029
7030 //External
7031 if (rp->part->type == EDJE_PART_TYPE_EXTERNAL)
7032 {
7033 if ((ll = (Eina_List *)edje_edit_state_external_params_list_get(obj, part, state, value)))
7034 {
7035 Edje_External_Param *p;
7036
7037 BUF_APPEND(I5"params {\n");
7038 EINA_LIST_FOREACH(ll, l, p)
7039 {
7040 switch (p->type)
7041 {
7042 case EDJE_EXTERNAL_PARAM_TYPE_INT:
7043 BUF_APPENDF(I6"int: \"%s\" \"%d\";\n", p->name, p->i);
7044 break;
7045 case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
7046 BUF_APPENDF(I6"double: \"%s\" \"%g\";\n", p->name, p->d);
7047 break;
7048 case EDJE_EXTERNAL_PARAM_TYPE_STRING:
7049 if (p->s)
7050 BUF_APPENDF(I6"string: \"%s\" \"%s\";\n", p->name,
7051 p->s);
7052 break;
7053 case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
7054 BUF_APPENDF(I6"bool: \"%s\" \"%d\";\n", p->name, p->i);
7055 break;
7056 case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
7057 if (p->s)
7058 BUF_APPENDF(I6"choice: \"%s\" \"%s\";\n", p->name,
7059 p->s);
7060 break;
7061 default:
7062 break;
7063 }
7064 }
7065 BUF_APPEND(I5"}\n");
7066 }
7067 }
7068
7069 BUF_APPEND(I4"}\n");//description
7070 return ret;
7071}
7072
7073static Eina_Bool
7074_edje_generate_source_of_part(Evas_Object *obj, Edje_Part *ep, Eina_Strbuf *buf)
7075{
7076 const char *part = ep->name;
7077 const char *str;
7078 Eina_List *l, *ll;
7079 char *data;
7080 Eina_Bool ret = EINA_TRUE;
7081 const char *api_name, *api_description;
7082
7083 BUF_APPENDF(I3"part { name: \"%s\";\n", part);
7084 BUF_APPENDF(I4"type: %s;\n", types[edje_edit_part_type_get(obj, part)]);
7085 if (!edje_edit_part_mouse_events_get(obj, part))
7086 BUF_APPEND(I4"mouse_events: 0;\n");
7087 if (edje_edit_part_repeat_events_get(obj, part))
7088 BUF_APPEND(I4"repeat_events: 1;\n");
7089 if (edje_edit_part_scale_get(obj, part))
7090 BUF_APPEND(I4"scale: 1;\n");
7091 //TODO Support ignore_flags
7092 //TODO Support pointer_mode
7093 //TODO Support precise_is_inside
7094 //TODO Support use_alternate_font_metrics
7095 if ((str = edje_edit_part_clip_to_get(obj, part)))
7096 {
7097 BUF_APPENDF(I4"clip_to: \"%s\";\n", str);
7098 edje_edit_string_free(str);
7099 }
7100 if ((str = edje_edit_part_source_get(obj, part)))
7101 {
7102 BUF_APPENDF(I4"source: \"%s\";\n", str);
7103 edje_edit_string_free(str);
7104 }
7105 if (edje_edit_part_effect_get(obj, part))
7106 BUF_APPENDF(I4"effect: %s;\n",
7107 effects[edje_edit_part_effect_get(obj, part)]);
7108
7109 //Dragable
7110 if (edje_edit_part_drag_x_get(obj, part) ||
7111 edje_edit_part_drag_y_get(obj, part))
7112 {
7113 BUF_APPEND(I4"dragable {\n");
7114 BUF_APPENDF(I5"x: %d %d %d;\n",
7115 edje_edit_part_drag_x_get(obj, part),
7116 edje_edit_part_drag_step_x_get(obj, part),
7117 edje_edit_part_drag_count_x_get(obj, part));
7118 BUF_APPENDF(I5"y: %d %d %d;\n",
7119 edje_edit_part_drag_y_get(obj, part),
7120 edje_edit_part_drag_step_y_get(obj, part),
7121 edje_edit_part_drag_count_y_get(obj, part));
7122 if ((str = edje_edit_part_drag_confine_get(obj, part)))
7123 {
7124 BUF_APPENDF(I5"confine: \"%s\";\n", str);
7125 edje_edit_string_free(str);
7126 }
7127 if ((str = edje_edit_part_drag_event_get(obj, part)))
7128 {
7129 BUF_APPENDF(I5"events: \"%s\";\n", str);
7130 edje_edit_string_free(str);
7131 }
7132 BUF_APPEND(I4"}\n");
7133 }
7134
7135 //Descriptions
7136 ll = edje_edit_part_states_list_get(obj, part);
7137 EINA_LIST_FOREACH(ll, l, data)
7138 {
7139 char state[512], *delim;
7140 double value;
7141 strncpy(state, data, sizeof(state) - 1); /* if we go over it, too bad.. the list of states may need to change to provide name and value separated */
7142 delim = strchr(state, ' ');
7143 *delim = '\0';
7144 delim++;
7145 value = strtod(delim, NULL);
7146 ret &= _edje_generate_source_of_state(obj, part, state, value, buf);
7147 }
7148 edje_edit_string_list_free(ll);
7149
7150 api_name = edje_edit_part_api_name_get(obj, part);
7151 api_description = edje_edit_part_api_description_get(obj, part);
7152
7153 if (api_name || api_description)
7154 {
7155 if (api_name && api_description)
7156 {
7157 BUF_APPENDF(I4"api: \"%s\" \"%s\";\n", api_name, api_description);
7158 edje_edit_string_free(api_name);
7159 edje_edit_string_free(api_description);
7160 }
7161 else
7162 if (api_name)
7163 {
7164 BUF_APPENDF(I4"api: \"%s\" \"\";\n", api_name);
7165 edje_edit_string_free(api_name);
7166 }
7167 else
7168 {
7169 BUF_APPENDF(I4"api: \"\" \"%s\";\n", api_description);
7170 edje_edit_string_free(api_description);
7171 }
7172 }
7173
7174 BUF_APPEND(I3"}\n");//part
7175 return ret;
7176}
7177
7178static Eina_Bool
7179_edje_generate_source_of_group(Edje *ed, Edje_Part_Collection_Directory_Entry *pce, Eina_Strbuf *buf)
7180{
7181 Edje_Edit *eed;
7182 Eet_File *ef;
7183 Evas_Object *obj;
7184 Eina_List *l, *ll;
7185 unsigned int i;
7186 int w, h;
7187 char *data;
7188 const char *group = pce->entry;
7189 Edje_Part_Collection *pc;
7190 Eina_Bool ret = EINA_TRUE;
7191
7192 obj = edje_edit_object_add(ed->base.evas);
7193 if (!edje_object_file_set(obj, ed->file->path, group)) return EINA_FALSE;
7194
7195 ef = eet_open(ed->file->path, EET_FILE_MODE_READ);
7196 if (!ef)
7197 {
7198 evas_object_del(obj);
7199 return EINA_FALSE;
7200 }
7201
7202 eed = evas_object_smart_data_get(obj);
7203 pc = eed->base.collection;
7204
7205 BUF_APPENDF(I1"group { name: \"%s\";\n", group);
7206 //TODO Support alias:
7207 w = edje_edit_group_min_w_get(obj);
7208 h = edje_edit_group_min_h_get(obj);
7209 if ((w > 0) || (h > 0))
7210 BUF_APPENDF(I2"min: %d %d;\n", w, h);
7211 w = edje_edit_group_max_w_get(obj);
7212 h = edje_edit_group_max_h_get(obj);
7213 if ((w > 0) || (h > 0))
7214 BUF_APPENDF(I2"max: %d %d;\n", w, h);
7215
7216 /* Data */
7217 if (pc->data)
7218 {
7219 Eina_Iterator *it;
7220 Eina_Hash_Tuple *tuple;
7221 BUF_APPEND(I2"data {\n");
7222
7223 it = eina_hash_iterator_tuple_new(pc->data);
7224
7225 if (!it)
7226 {
7227 ERR("Generating EDC for Group[%s] data.", group);
7228 return EINA_FALSE;
7229 }
7230
7231 EINA_ITERATOR_FOREACH(it, tuple)
7232 BUF_APPENDF(I3"item: \"%s\" \"%s\";\n", (char *)tuple->key,
7233 edje_string_get(tuple->data));
7234
7235 eina_iterator_free(it);
7236 BUF_APPEND(I2"}\n");
7237 }
7238
7239 if (eed->embryo_source)
7240 {
7241 BUF_APPEND(I2"script {\n");
7242 BUF_APPEND(eed->embryo_source);
7243 BUF_APPEND(I2"}\n");
7244 }
7245
7246 /* Parts */
7247 BUF_APPEND(I2"parts {\n");
7248 for (i = 0; i < pc->parts_count; i++)
7249 {
7250 Edje_Part *ep;
7251 ep = pc->parts[i];
7252 ret &= _edje_generate_source_of_part(obj, ep, buf);
7253 }
7254 BUF_APPEND(I2"}\n");//parts
7255
7256 if (!ret)
7257 {
7258 ERR("Generating EDC for Group[%s] Parts.", group);
7259 return EINA_FALSE;
7260 }
7261
7262 /* Programs */
7263 if ((ll = edje_edit_programs_list_get(obj)))
7264 {
7265 BUF_APPEND(I2 "programs {\n");
7266 EINA_LIST_FOREACH(ll, l, data)
7267 ret &= _edje_generate_source_of_program(obj, data, buf);
7268 BUF_APPEND(I2 "}\n");
7269 edje_edit_string_list_free(ll);
7270 }
7271 BUF_APPEND(I1"}\n");//group
7272
7273 if (!ret)
7274 {
7275 ERR("Generating EDC for Group[%s] Programs.", group);
7276 evas_object_del(obj);
7277 return EINA_FALSE;
7278 }
7279
7280 eet_close(ef);
7281 evas_object_del(obj);
7282 return ret;
7283}
7284
7285static Eina_Strbuf*
7286_edje_generate_source(Evas_Object *obj)
7287{
7288 Eina_Strbuf *buf;
7289
7290 Eina_List *l, *ll;
7291 Edje_Font_Directory_Entry *fnt;
7292
7293 char *entry;
7294 Eina_Bool ret = EINA_TRUE;
7295
7296 GET_ED_OR_RETURN(NULL);
7297
7298 /* Open a str buffer */
7299
7300 buf = eina_strbuf_new();
7301 if (!buf) return NULL;
7302
7303 /* Write edc into file */
7304 //TODO Probably we need to save the file before generation
7305
7306 /* Images */
7307 if ((ll = edje_edit_images_list_get(obj)))
7308 {
7309 BUF_APPEND(I0"images {\n");
7310
7311 EINA_LIST_FOREACH(ll, l, entry)
7312 {
7313 int comp = edje_edit_image_compression_type_get(obj, entry);
7314 if (comp < 0) continue;
7315
7316 BUF_APPENDF(I1"image: \"%s\" ", entry);
7317
7318 if (comp == EDJE_EDIT_IMAGE_COMP_LOSSY)
7319 BUF_APPENDF("LOSSY %d;\n",
7320 edje_edit_image_compression_rate_get(obj, entry));
7321 else if (comp == EDJE_EDIT_IMAGE_COMP_RAW)
7322 BUF_APPEND("RAW;\n");
7323 else if (comp == EDJE_EDIT_IMAGE_COMP_USER)
7324 BUF_APPEND("USER;\n");
7325 else
7326 BUF_APPEND("COMP;\n");
7327 }
7328 BUF_APPEND(I0"}\n\n");
7329 edje_edit_string_list_free(ll);
7330
7331 if (!ret)
7332 {
7333 ERR("Generating EDC for Images");
7334 eina_strbuf_free(buf);
7335 return NULL;
7336 }
7337 }
7338
7339 /* Fonts */
7340 if (ed->file->fonts)
7341 {
7342 Eina_Iterator *it;
7343
7344 it = eina_hash_iterator_data_new(ed->file->fonts);
7345 if (it)
7346 {
7347 BUF_APPEND(I0"fonts {\n");
7348
7349 EINA_ITERATOR_FOREACH(it, fnt)
7350 BUF_APPENDF(I1"font: \"%s\" \"%s\";\n", fnt->file,
7351 fnt->entry);
7352
7353 BUF_APPEND(I0"}\n\n");
7354 eina_iterator_free(it);
7355
7356 if (!ret)
7357 {
7358 ERR("Generating EDC for Fonts");
7359 eina_strbuf_free(buf);
7360 return NULL;
7361 }
7362 }
7363 }
7364
7365 /* Data */
7366 if ((ll = edje_edit_data_list_get(obj)))
7367 {
7368 BUF_APPEND(I0 "data {\n");
7369
7370 EINA_LIST_FOREACH(ll, l, entry)
7371 BUF_APPENDF(I1 "item: \"%s\" \"%s\";\n", entry,
7372 edje_edit_data_value_get(obj, entry));
7373
7374 BUF_APPEND(I0 "}\n\n");
7375 edje_edit_string_list_free(ll);
7376
7377 if (!ret)
7378 {
7379 ERR("Generating EDC for Data");
7380 eina_strbuf_free(buf);
7381 return NULL;
7382 }
7383 }
7384
7385 /* Color Classes */
7386 if ((ll = edje_edit_color_classes_list_get(obj)))
7387 {
7388 BUF_APPEND(I0 "color_classes {\n");
7389
7390 EINA_LIST_FOREACH(ll, l, entry)
7391 _edje_generate_source_of_colorclass(ed, entry, buf);
7392
7393 BUF_APPEND(I0 "}\n\n");
7394 edje_edit_string_list_free(ll);
7395
7396 if (!ret)
7397 {
7398 ERR("Generating EDC for Color Classes");
7399 eina_strbuf_free(buf);
7400 return NULL;
7401 }
7402 }
7403
7404 /* Styles */
7405 if ((ll = edje_edit_styles_list_get(obj)))
7406 {
7407 BUF_APPEND(I0 "styles {\n");
7408 EINA_LIST_FOREACH(ll, l, entry)
7409 _edje_generate_source_of_style(ed, entry, buf);
7410 BUF_APPEND(I0 "}\n\n");
7411 edje_edit_string_list_free(ll);
7412
7413 if (!ret)
7414 {
7415 ERR("Generating EDC for Styles");
7416 eina_strbuf_free(buf);
7417 return NULL;
7418 }
7419 }
7420
7421 /* Externals */
7422 if ((ll = edje_edit_externals_list_get(obj)))
7423 {
7424 BUF_APPEND(I0 "externals {\n");
7425 EINA_LIST_FOREACH(ll, l, entry)
7426 BUF_APPENDF(I1 "external: \"%s\";\n", entry);
7427
7428 BUF_APPEND(I0 "}\n\n");
7429 edje_edit_string_list_free(ll);
7430
7431 if (!ret)
7432 {
7433 ERR("Generating EDC for Externals");
7434 eina_strbuf_free(buf);
7435 return NULL;
7436 }
7437 }
7438
7439 /* Collections */
7440 if (ed->file->collection)
7441 {
7442 Eina_Iterator *it;
7443 Edje_Part_Collection_Directory_Entry *pce;
7444 BUF_APPEND("collections {\n");
7445
7446 it = eina_hash_iterator_data_new(ed->file->collection);
7447
7448 if (!it)
7449 {
7450 ERR("Generating EDC for Collections");
7451 eina_strbuf_free(buf);
7452 return NULL;
7453 }
7454
7455 EINA_ITERATOR_FOREACH(it, pce)
7456 {
7457 ret &= _edje_generate_source_of_group(ed, pce, buf);
7458 }
7459
7460 eina_iterator_free(it);
7461 BUF_APPEND("}\n\n");
7462 }
7463
7464 return buf;
7465}
7466
7467
7468
7469/*********************/
7470/* SAVING ROUTINES */
7471/*********************/
7472////////////////////////////////////////
7473typedef struct _SrcFile SrcFile;
7474typedef struct _SrcFile_List SrcFile_List;
7475
7476struct _SrcFile
7477{
7478 char *name;
7479 const char *file;
7480};
7481
7482struct _SrcFile_List
7483{
7484 Eina_List *list;
7485};
7486
7487static Eet_Data_Descriptor *_srcfile_edd = NULL;
7488static Eet_Data_Descriptor *_srcfile_list_edd = NULL;
7489
7490static void
7491source_edd(void)
7492{
7493 Eet_Data_Descriptor_Class eddc;
7494
7495 if (_srcfile_edd) return;
7496
7497 eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "srcfile", sizeof(SrcFile));
7498 _srcfile_edd = eet_data_descriptor_stream_new(&eddc);
7499 EET_DATA_DESCRIPTOR_ADD_BASIC(_srcfile_edd, SrcFile, "name", name, EET_T_INLINED_STRING);
7500 EET_DATA_DESCRIPTOR_ADD_BASIC(_srcfile_edd, SrcFile, "file", file, EET_T_INLINED_STRING);
7501
7502 eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "srcfile_list", sizeof(SrcFile_List));
7503 _srcfile_list_edd = eet_data_descriptor_stream_new(&eddc);
7504 EET_DATA_DESCRIPTOR_ADD_LIST(_srcfile_list_edd, SrcFile_List, "list", list, _srcfile_edd);
7505}
7506/////////////////////////////////////////
7507
7508static Eina_Bool
7509_edje_edit_edje_file_save(Eet_File *eetf, Edje_File *ef)
7510{
7511 /* Write Edje_File structure */
7512 INF("** Writing Edje_File* ed->file");
7513 if (eet_data_write(eetf, _edje_edd_edje_file, "edje/file", ef, 1) <= 0)
7514 {
7515 ERR("Error. unable to write \"edje_file\" entry to \"%s\"", ef->path);
7516 return EINA_FALSE;
7517 }
7518 return EINA_TRUE;
7519}
7520
7521static Eina_Bool
7522_edje_edit_collection_save(Eet_File *eetf, Edje_Part_Collection *epc)
7523{
7524 char buf[256];
7525
7526 snprintf(buf, sizeof(buf), "edje/collections/%i", epc->id);
7527
7528 if (eet_data_write(eetf, _edje_edd_edje_part_collection, buf, epc, 1) > 0)
7529 return EINA_TRUE;
7530
7531 ERR("Error. unable to write \"%s\" part entry", buf);
7532 return EINA_FALSE;
7533}
7534
7535static Eina_Bool
7536_edje_edit_source_save(Eet_File *eetf, Evas_Object *obj)
7537{
7538 SrcFile *sf;
7539 SrcFile_List *sfl;
7540 Eina_Strbuf *source_file;
7541 Eina_Bool ret = EINA_TRUE;
7542
7543 source_file = _edje_generate_source(obj);
7544 if (!source_file)
7545 {
7546 ERR("Can't create edc source");
7547 return EINA_FALSE;
7548 }
7549
7550 //open the temp file and put the contents in SrcFile
7551 sf = _alloc(sizeof(SrcFile));
7552 if (!sf)
7553 {
7554 ERR("Unable to create source file struct");
7555 ret = EINA_FALSE;
7556 goto save_free_source;
7557 }
7558 sf->name = strdup("generated_source.edc");
7559 if (!sf->name)
7560 {
7561 ERR("Unable to alloc filename");
7562 ret = EINA_FALSE;
7563 goto save_free_sf;
7564 }
7565
7566 sf->file = eina_strbuf_string_get(source_file);
7567
7568 //create the needed list of source files (only one)
7569 sfl = _alloc(sizeof(SrcFile_List));
7570 if (!sfl)
7571 {
7572 ERR("Unable to create file list");
7573 ret = EINA_FALSE;
7574 goto save_free_filename;
7575 }
7576 sfl->list = NULL;
7577 sfl->list = eina_list_append(sfl->list, sf);
7578 if (!sfl->list)
7579 {
7580 ERR("Error. unable to append file in list");
7581 ret = EINA_FALSE;
7582 goto save_free_sfl;
7583 }
7584
7585 // write the sources list to the eet file
7586 source_edd();
7587 if (eet_data_write(eetf, _srcfile_list_edd, "edje_sources", sfl, 1) <= 0)
7588 {
7589 ERR("Unable to write edc source");
7590 ret = EINA_FALSE;
7591 }
7592
7593 /* Clear stuff */
7594 eina_list_free(sfl->list);
7595save_free_sfl:
7596 free(sfl);
7597save_free_filename:
7598 free(sf->name);
7599save_free_sf:
7600 free(sf);
7601save_free_source:
7602 eina_strbuf_free(source_file);
7603 return ret;
7604}
7605
7606Eina_Bool
7607_edje_edit_internal_save(Evas_Object *obj, int current_only)
7608{
7609 Edje_File *ef;
7610 Eet_File *eetf;
7611
7612 GET_ED_OR_RETURN(EINA_FALSE);
7613
7614 ef = ed->file;
7615 if (!ef) return EINA_FALSE;
7616
7617 INF("*********** Saving file ******************");
7618 INF("** path: %s", ef->path);
7619
7620 /* Open the eet file */
7621 eetf = eet_open(ef->path, EET_FILE_MODE_READ_WRITE);
7622 if (!eetf)
7623 {
7624 ERR("Error. unable to open \"%s\" for writing output",
7625 ef->path);
7626 return EINA_FALSE;
7627 }
7628
7629 /* Set compiler name */
7630 if (strcmp(ef->compiler, "edje_edit"))
7631 {
7632 _edje_if_string_free(ed, ef->compiler);
7633 ef->compiler = (char *)eina_stringshare_add("edje_edit");
7634 }
7635
7636 if (!_edje_edit_edje_file_save(eetf, ef))
7637 {
7638 eet_close(eetf);
7639 return EINA_FALSE;
7640 }
7641
7642 if (current_only)
7643 {
7644 if (ed->collection)
7645 {
7646 INF("** Writing Edje_Part_Collection* ed->collection "
7647 "[id: %d]", ed->collection->id);
7648 if (!_edje_edit_collection_save(eetf, ed->collection))
7649 {
7650 eet_close(eetf);
7651 return EINA_FALSE;
7652 }
7653 }
7654 }
7655 else
7656 {
7657 Eina_List *l;
7658 Edje_Part_Collection *edc;
7659 Edje_Part_Collection_Directory_Entry *ce;
7660 Eina_Iterator *it;
7661
7662 INF("** Writing all collections");
7663
7664 it = eina_hash_iterator_data_new(ef->collection);
7665 while (eina_iterator_next(it, (void **)&ce))
7666 {
7667 if (ce->ref)
7668 {
7669 INF("** Writing hash Edje_Part_Collection* ed->collection "
7670 "[id: %d]", ce->id);
7671 if(!_edje_edit_collection_save(eetf, ce->ref))
7672 {
7673 eet_close(eetf);
7674 return EINA_FALSE;
7675 }
7676 }
7677 }
7678 eina_iterator_free(it);
7679
7680 EINA_LIST_FOREACH(ef->collection_cache, l, edc)
7681 {
7682 INF("** Writing cache Edje_Part_Collection* ed->collection "
7683 "[id: %d]", edc->id);
7684 if(!_edje_edit_collection_save(eetf, edc))
7685 {
7686 eet_close(eetf);
7687 return EINA_FALSE;
7688 }
7689 }
7690 }
7691
7692 if (eed->bytecode_dirty || eed->script_need_recompile)
7693 {
7694 char buf[64];
7695 Eina_Iterator *it;
7696 Program_Script *ps;
7697 Eina_List *deathnote = NULL;
7698
7699 if (eed->bytecode_dirty)
7700 {
7701 snprintf(buf, sizeof(buf), "edje/scripts/embryo/compiled/%i",
7702 ed->collection->id);
7703 eet_write(eetf, buf, eed->bytecode, eed->bytecode_size, 1);
7704 free(eed->bytecode);
7705 eed->bytecode = NULL;
7706 eed->bytecode_size = 0;
7707 eed->bytecode_dirty = EINA_FALSE;
7708 }
7709
7710 if (eed->embryo_source_dirty)
7711 {
7712 snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%i",
7713 ed->collection->id);
7714 eet_write(eetf, buf, eed->embryo_source,
7715 strlen(eed->embryo_source) +1, 1);
7716 eed->embryo_source_dirty = EINA_FALSE;
7717 }
7718
7719 it = eina_hash_iterator_data_new(eed->program_scripts);
7720 EINA_ITERATOR_FOREACH(it, ps)
7721 {
7722 if (ps->dirty)
7723 {
7724 snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%i/%i",
7725 ed->collection->id, ps->id);
7726 eet_write(eetf, buf, ps->code, strlen(ps->code) + 1, 1);
7727 ps->dirty = EINA_FALSE;
7728 }
7729 else if (ps->delete_me)
7730 {
7731 snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%i/%i",
7732 ed->collection->id, ps->id);
7733 eet_delete(eetf, buf);
7734 deathnote = eina_list_append(deathnote, ps);
7735 }
7736 }
7737 eina_iterator_free(it);
7738
7739 EINA_LIST_FREE(deathnote, ps)
7740 eina_hash_del(eed->program_scripts, &ps->id, ps);
7741 }
7742
7743 if (!_edje_edit_source_save(eetf, obj))
7744 {
7745 eet_close(eetf);
7746 return EINA_FALSE;
7747 }
7748
7749 eet_close(eetf);
7750
7751 /* Update mtime */
7752 {
7753 struct stat st;
7754 if (stat(ed->path, &st) != 0)
7755 return EINA_FALSE;
7756 ef->mtime = st.st_mtime;
7757 }
7758
7759 INF("*********** Saving DONE ******************");
7760 return EINA_TRUE;
7761}
7762
7763EAPI Eina_Bool
7764edje_edit_save(Evas_Object *obj)
7765{
7766 eina_error_set(0);
7767
7768 return _edje_edit_internal_save(obj, 1);
7769}
7770
7771EAPI Eina_Bool
7772edje_edit_save_all(Evas_Object *obj)
7773{
7774 eina_error_set(0);
7775
7776 return _edje_edit_internal_save(obj, 0);
7777}
7778
7779EAPI void
7780edje_edit_print_internal_status(Evas_Object *obj)
7781{
7782/*
7783 Edje_Program *epr;
7784 unsigned int i;
7785 int j;
7786*/
7787 eina_error_set(0);
7788
7789 GET_ED_OR_RETURN();
7790
7791 _edje_generate_source(obj);
7792/*
7793 INF("****** CHECKIN' INTERNAL STRUCTS STATUS *********");
7794
7795 INF("path: '%s', group: '%s', parent: '%s'",
7796 ed->path, ed->group, ed->parent);
7797
7798 INF("Parts [table:%d list:%d]", ed->table_parts_size,
7799 ed->collection->parts_count);
7800 for (i = 0; i < ed->collection->parts_count; ++i)
7801 {
7802 Edje_Real_Part *rp;
7803 Edje_Part *p;
7804
7805 p = ed->collection->parts[i];
7806
7807 rp = ed->table_parts[p->id % ed->table_parts_size];
7808 printf("part[%d]: '%s' ", p->id, p->name);
7809 if (p == rp->part)
7810 printf("OK!\n");
7811 else
7812 printf("WRONG (table[%d]->name = '%s')\n", p->id, rp->part->name);
7813 }
7814
7815 INF("Programs [table:%d list:%d,%d,%d,%d,%d]", ed->table_programs_size,
7816 ed->collection->programs.fnmatch_count,
7817 ed->collection->programs.strcmp_count,
7818 ed->collection->programs.strncmp_count,
7819 ed->collection->programs.strrncmp_count,
7820 ed->collection->programs.nocmp_count);
7821 for(j = 0; j < ed->table_programs_size; ++j)
7822 {
7823 epr = ed->table_programs[i % ed->table_programs_size];
7824 printf("program[%d]: '%s'\n", epr->id, epr->name);
7825 }
7826
7827 INF("****************** END ************************");
7828 */
7829}
diff --git a/libraries/edje/src/lib/edje_embryo.c b/libraries/edje/src/lib/edje_embryo.c
new file mode 100644
index 0000000..c89a4f4
--- /dev/null
+++ b/libraries/edje/src/lib/edje_embryo.c
@@ -0,0 +1,3179 @@
1#include "edje_private.h"
2
3/*
4 * ALREADY EXPORTED BY EMBRYO:
5 *
6 * enum Float_Round_Method {
7 * ROUND, FLOOR, CEIL, TOZERO
8 * };
9 * enum Float_Angle_Mode {
10 * RADIAN, DEGREES, GRADES
11 * };
12 *
13 * numargs();
14 * getarg(arg, index=0);
15 * setarg(arg, index=0, value);
16 *
17 * Float:atof(string[]);
18 * Float:fract(Float:value);
19 * round(Float:value, Float_Round_Method:method=ROUND);
20 * Float:sqrt(Float:value);
21 * Float:pow(Float:value, Float:exponent);
22 * Float:log(Float:value, Float:base=10.0);
23 * Float:sin(Float:value, Float_Angle_Mode:mode=RADIAN);
24 * Float:cos(Float:value, Float_Angle_Mode:mode=RADIAN);
25 * Float:tan(Float:value, Float_Angle_Mode:mode=RADIAN);
26 * Float:abs(Float:value);
27 * atoi(str[]);
28 * fnmatch(glob[], str[]);
29 * strcmp(str1[], str2[]);
30 * strncmp(str1[], str2[]);
31 * strcpy(dst[], src[]);
32 * strncpy(dst[], src[], n);
33 * strlen(str[]);
34 * strcat(dst[], src[]);
35 * strncat(dst[], src[], n);
36 * strprep(dst[], src[]);
37 * strnprep(dst[], src[], n);
38 * strcut(dst[], str[], n, n2);
39 * snprintf(dst[], dstn, fmt[], ...);
40 * strstr(str[], ndl[]);
41 * strchr(str[], ch[]);
42 * strrchr(str[], ch[]);
43 * rand();
44 * Float:randf();
45 * Float:seconds();
46 * date(&year, &month, &day, &yearday, &weekday, &hr, &min, &Float:sec);
47 *
48 */
49
50/* EDJE...
51 *
52 * implemented so far as examples:
53 *
54 * enum Msg_Type {
55 * MSG_NONE, MSG_STRING, MSG_INT, MSG_FLOAT, MSG_STRING_SET, MSG_INT_SET,
56 * MSG_FLOAT_SET, MSG_STRING_INT, MSG_INT_FLOAT, MSG_STRING_INT_SET,
57 * MSG_INT_FLOAT_SET
58 * };
59 *
60 * get_int(id)
61 * set_int(id, v)
62 * Float:get_float (id)
63 * set_float(id, Float:v)
64 * get_strlen(id)
65 * get_str(id, dst[], maxlen)
66 * set_str(id, str[])
67 * timer(Float:in, fname[], val)
68 * cancel_timer(id)
69 * anim(Float:len, fname[], val)
70 * cancel_anim(id)
71 * emit(sig[], src[])
72 * set_state(part_id, state[], Float:state_val)
73 * get_state(part_id, dst[], maxlen, &Float:val)
74 * set_tween_state(part_id, Float:tween, state1[], Float:state1_val, state2[], Float:state2_val)
75 * play_sample(sample_name, speed)
76 * play_tone(tone_name, duration)
77 * run_program(program_id)
78 * Direction:get_drag_dir(part_id)
79 * get_drag(part_id, &Float:dx, &Float:&dy)
80 * set_drag(part_id, Float:dx, Float:dy)
81 * get_drag_size(part_id, &Float:dx, &Float:&dy)
82 * set_drag_size(part_id, Float:dx, Float:dy)
83 * set_text(part_id, str[])
84 * get_text(part_id, dst[], maxlen)
85 * get_min_size(w, h)
86 * get_max_size(w, h)
87 * set_color_class(class[], r, g, b, a)
88 * get_color_class(class[], &r, &g, &b, &a)
89 * set_text_class(class[], font[], Float:size)
90 * get_text_class(class[], font[], &Float:size)
91 * get_drag_step(part_id, &Float:dx, &Float:&dy)
92 * set_drag_step(part_id, Float:dx, Float:dy)
93 * get_drag_page(part_id, &Float:dx, &Float:&dy)
94 * set_drag_page(part_id, Float:dx, Float:dy)
95 * get_geometry(part_id, &Float:x, &Float:y, &Float:w, &Float:h)
96 * get_mouse(&x, &y)
97 * stop_program(program_id)
98 * stop_programs_on(part_id)
99 * set_min_size(w, h)
100 * set_max_size(w, h)
101 * send_message(Msg_Type:type, id, ...)
102 *
103 * count(id)
104 * remove(id, n)
105 *
106 * append_int(id, v)
107 * prepend_int(id, v)
108 * insert_int(id, n, v)
109 * replace_int(id, n, v)
110 * fetch_int(id, n)
111 *
112 * append_str(id, str[])
113 * prepend_str(id, str[])
114 * insert_str(id, n, str[])
115 * replace_str(id, n, str[])
116 * fetch_str(id, n, dst[], maxlen)
117 *
118 * append_float(id, Float:v)
119 * prepend_float(id, Float:v)
120 * insert_float(id, n, Float:v)
121 * replace_float(id, n, Float:v)
122 * Float:fetch_float(id, n)
123 *
124 * custom_state(part_id, state[], Float:state_val = 0.0)
125 * set_state_val(part_id, State_Param:param, ...)
126 * get_state_val(part_id, State_Param:param, ...)
127 *
128 * Supported parameters:
129 * align[Float:x, Float:y]
130 * min[w, h]
131 * max[w, h]
132 * step[x,y]
133 * aspect[Float:min, Float:max]
134 * color[r,g,b,a]
135 * color2[r,g,b,a]
136 * color3[r,g,b,a]
137 * aspect_preference
138 * rel1[relx,rely]
139 * rel1[part_id,part_id]
140 * rel1[offx,offy]
141 * rel2[relx,relyr]
142 * rel2[part_id,part_id]
143 * rel2[offx,offy]
144 * image[image_id] <- all images have an Id not name in the edje
145 * border[l,r,t,b]
146 * fill[smooth]
147 * fill[pos_relx,pos_rely,pos_offx,pos_offy]
148 * fill[sz_relx,sz_rely,sz_offx,sz_offy]
149 * color_class
150 * text[text]
151 * text[text_class]
152 * text[font]
153 * text[size]
154 * text[style]
155 * text[fit_x,fit_y]
156 * text[min_x,min_y]
157 * text[align_x,align_y]
158 * visible[on]
159 * map_on[on]
160 * map_persp[part_id]
161 * map_light[part_id]
162 * map_rot_center[part_id]
163 * map_rot_x[deg]
164 * map_rot_y[deg]
165 * map_rot_z[deg]
166 * map_back_cull[on]
167 * map_persp_on[on]
168 * persp_zplane[z]
169 * persp_focal[z]
170 *
171 * ** part_id and program_id need to be able to be "found" from strings
172 *
173 * get_drag_count(part_id, &Float:dx, &Float:&dy)
174 * set_drag_count(part_id, Float:dx, Float:dy)
175 * set_drag_confine(part_id, confine_part_id)
176 * get_size(&w, &h);
177 * resize_request(w, h)
178 * get_mouse_buttons()
179 * //set_type(part_id, Type:type)
180 * //set_effect(part_id, Effect:fx)
181 * set_mouse_events(part_id, ev)
182 * get_mouse_events(part_id)
183 * set_repeat_events(part_id, rep)
184 * get_repeat_events(part_id)
185 * set_clip(part_id, clip_part_id)
186 * get_clip(part_id)
187 *
188 * part_swallow(part_id, group_name)
189 *
190 * external_param_get_int(id, param_name[])
191 * external_param_set_int(id, param_name[], value)
192 * Float:external_param_get_float(id, param_name[])
193 * external_param_set_float(id, param_name[], Float:value)
194 * external_param_get_strlen(id, param_name[])
195 * external_param_get_str(id, param_name[], value[], value_maxlen)
196 * external_param_set_str(id, param_name[], value[])
197 * external_param_get_choice_len(id, param_name[])
198 * external_param_get_choice(id, param_name[], value[], value_maxlen)
199 * external_param_set_choice(id, param_name[], value[])
200 * external_param_get_bool(id, param_name[])
201 * external_param_set_bool(id, param_name[], value)
202 *
203 * ADD/DEL CUSTOM OBJECTS UNDER SOLE EMBRYO SCRIPT CONTROL
204 *
205 */
206
207/* get_int(id) */
208static Embryo_Cell
209_edje_embryo_fn_get_int(Embryo_Program *ep, Embryo_Cell *params)
210{
211 Edje *ed;
212
213 CHKPARAM(1);
214 ed = embryo_program_data_get(ep);
215 return (Embryo_Cell)_edje_var_int_get(ed, (int)params[1]);
216}
217
218/* set_int(id, v) */
219static Embryo_Cell
220_edje_embryo_fn_set_int(Embryo_Program *ep, Embryo_Cell *params)
221{
222 Edje *ed;
223
224 CHKPARAM(2);
225 ed = embryo_program_data_get(ep);
226 _edje_var_int_set(ed, (int)params[1], (int)params[2]);
227 return 0;
228}
229
230/* get_float(id) */
231static Embryo_Cell
232_edje_embryo_fn_get_float(Embryo_Program *ep, Embryo_Cell *params)
233{
234 Edje *ed;
235 float v;
236
237 CHKPARAM(1);
238 ed = embryo_program_data_get(ep);
239 v = (float)_edje_var_float_get(ed, params[1]);
240 return EMBRYO_FLOAT_TO_CELL(v);
241}
242
243/* set_float(id, v) */
244static Embryo_Cell
245_edje_embryo_fn_set_float(Embryo_Program *ep, Embryo_Cell *params)
246{
247 Edje *ed;
248 float v;
249
250 CHKPARAM(2);
251 ed = embryo_program_data_get(ep);
252 v = EMBRYO_CELL_TO_FLOAT(params[2]);
253 _edje_var_float_set(ed, (int)params[1], (double)v);
254 return 0;
255}
256
257/* get_str(id, dst[], maxlen) */
258static Embryo_Cell
259_edje_embryo_fn_get_str(Embryo_Program *ep, Embryo_Cell *params)
260{
261 Edje *ed;
262 char *s;
263
264 CHKPARAM(3);
265 if (params[3] < 1) return 0;
266 ed = embryo_program_data_get(ep);
267 s = (char *)_edje_var_str_get(ed, (int)params[1]);
268 if (s)
269 {
270 if ((int) strlen(s) < params[3])
271 {
272 SETSTR(s, params[2]);
273 }
274 else
275 {
276 char *ss;
277
278 ss = alloca(strlen(s) + 1);
279 strcpy(ss, s);
280 ss[params[3] - 1] = 0;
281 SETSTR(ss, params[2]);
282 }
283 }
284 else
285 {
286 SETSTR("", params[2]);
287 }
288 return 0;
289}
290
291/* get_strlen(id) */
292static Embryo_Cell
293_edje_embryo_fn_get_strlen(Embryo_Program *ep, Embryo_Cell *params)
294{
295 Edje *ed;
296 char *s;
297
298 CHKPARAM(1);
299 ed = embryo_program_data_get(ep);
300 s = (char *)_edje_var_str_get(ed, (int)params[1]);
301 if (s)
302 {
303 return strlen(s);
304 }
305 return 0;
306}
307
308/* set_str(id, str[]) */
309static Embryo_Cell
310_edje_embryo_fn_set_str(Embryo_Program *ep, Embryo_Cell *params)
311{
312 Edje *ed;
313 char *s;
314
315 CHKPARAM(2);
316 ed = embryo_program_data_get(ep);
317 GETSTR(s, params[2]);
318 if (s)
319 {
320 _edje_var_str_set(ed, (int)params[1], s);
321 }
322 return 0;
323}
324
325/* count(id) */
326static Embryo_Cell
327_edje_embryo_fn_count(Embryo_Program *ep, Embryo_Cell *params)
328{
329 Edje *ed = embryo_program_data_get(ep);
330
331 CHKPARAM(1);
332
333 return (Embryo_Cell)_edje_var_list_count_get(ed, (int) params[1]);
334}
335
336/* remove(id, n) */
337static Embryo_Cell
338_edje_embryo_fn_remove(Embryo_Program *ep, Embryo_Cell *params)
339{
340 Edje *ed = embryo_program_data_get(ep);
341
342 CHKPARAM(2);
343
344 _edje_var_list_remove_nth(ed, (int) params[1], (int) params[2]);
345
346 return 0;
347}
348
349/* append_int(id, var) */
350static Embryo_Cell
351_edje_embryo_fn_append_int(Embryo_Program *ep, Embryo_Cell *params)
352{
353 Edje *ed = embryo_program_data_get(ep);
354
355 CHKPARAM(2);
356
357 _edje_var_list_int_append(ed, (int) params[1], (int) params[2]);
358
359 return 0;
360}
361
362/* prepend_int(id, var) */
363static Embryo_Cell
364_edje_embryo_fn_prepend_int(Embryo_Program *ep, Embryo_Cell *params)
365{
366 Edje *ed = embryo_program_data_get(ep);
367
368 CHKPARAM(2);
369
370 _edje_var_list_int_prepend(ed, (int) params[1], (int) params[2]);
371
372 return 0;
373}
374
375/* insert_int(id, pos, var) */
376static Embryo_Cell
377_edje_embryo_fn_insert_int(Embryo_Program *ep, Embryo_Cell *params)
378{
379 Edje *ed = embryo_program_data_get(ep);
380
381 CHKPARAM(3);
382
383 _edje_var_list_int_insert(ed, (int) params[1], (int) params[2],
384 (int) params[3]);
385
386 return 0;
387}
388
389/* replace_int(id, pos, var) */
390static Embryo_Cell
391_edje_embryo_fn_replace_int(Embryo_Program *ep, Embryo_Cell *params)
392{
393 Edje *ed = embryo_program_data_get(ep);
394
395 CHKPARAM(3);
396
397 _edje_var_list_nth_int_set(ed, (int) params[1], (int) params[2],
398 (int) params[3]);
399
400 return 0;
401}
402
403/* fetch_int(id, pos) */
404static Embryo_Cell
405_edje_embryo_fn_fetch_int(Embryo_Program *ep, Embryo_Cell *params)
406{
407 Edje *ed = embryo_program_data_get(ep);
408
409 CHKPARAM(2);
410
411 return _edje_var_list_nth_int_get(ed, (int) params[1],
412 (int) params[2]);
413}
414
415/* append_str(id, str[]) */
416static Embryo_Cell
417_edje_embryo_fn_append_str(Embryo_Program *ep, Embryo_Cell *params)
418{
419 Edje *ed = embryo_program_data_get(ep);
420 char *s;
421
422 CHKPARAM(2);
423
424 GETSTR(s, params[2]);
425 if (s)
426 _edje_var_list_str_append(ed, (int) params[1], s);
427
428 return 0;
429}
430
431/* prepend_str(id, str[]) */
432static Embryo_Cell
433_edje_embryo_fn_prepend_str(Embryo_Program *ep, Embryo_Cell *params)
434{
435 Edje *ed = embryo_program_data_get(ep);
436 char *s;
437
438 CHKPARAM(2);
439
440 GETSTR(s, params[2]);
441 if (s)
442 _edje_var_list_str_prepend(ed, (int) params[1], s);
443
444 return 0;
445}
446
447/* insert_str(id, pos, str[]) */
448static Embryo_Cell
449_edje_embryo_fn_insert_str(Embryo_Program *ep, Embryo_Cell *params)
450{
451 Edje *ed = embryo_program_data_get(ep);
452 char *s;
453
454 CHKPARAM(3);
455
456 GETSTR(s, params[3]);
457 if (s)
458 _edje_var_list_str_insert(ed, (int) params[1], (int) params[2], s);
459
460 return 0;
461}
462
463/* replace_str(id, pos, str[]) */
464static Embryo_Cell
465_edje_embryo_fn_replace_str(Embryo_Program *ep, Embryo_Cell *params)
466{
467 Edje *ed = embryo_program_data_get(ep);
468 char *s;
469
470 CHKPARAM(3);
471
472 GETSTR(s, params[3]);
473 if (s)
474 _edje_var_list_nth_str_set(ed, (int) params[1], (int) params[2], s);
475
476 return 0;
477}
478
479
480/* fetch_str(id, pos, dst[], maxlen) */
481static Embryo_Cell
482_edje_embryo_fn_fetch_str(Embryo_Program *ep, Embryo_Cell *params)
483{
484 Edje *ed = embryo_program_data_get(ep);
485 char *s;
486
487 CHKPARAM(4);
488
489 s = (char *) _edje_var_list_nth_str_get(ed, (int) params[1],
490 (int) params[2]);
491 if (s)
492 {
493 if ((int) strlen(s) < params[4])
494 {
495 SETSTR(s, params[3]);
496 }
497 else
498 {
499 char *ss;
500
501 ss = alloca(strlen(s) + 1);
502 strcpy(ss, s);
503 ss[params[4] - 1] = 0;
504 SETSTR(ss, params[3]);
505 }
506 }
507 else
508 {
509 SETSTR("", params[3]);
510 }
511
512 return 0;
513}
514
515/* append_float(id, Float:f) */
516static Embryo_Cell
517_edje_embryo_fn_append_float(Embryo_Program *ep, Embryo_Cell *params)
518{
519 Edje *ed = embryo_program_data_get(ep);
520 float f;
521
522 CHKPARAM(2);
523
524 f = EMBRYO_CELL_TO_FLOAT(params[2]);
525 _edje_var_list_float_append(ed, (int) params[1], f);
526
527 return 0;
528}
529
530/* prepend_float(id, Float:f) */
531static Embryo_Cell
532_edje_embryo_fn_prepend_float(Embryo_Program *ep, Embryo_Cell *params)
533{
534 Edje *ed = embryo_program_data_get(ep);
535 float f;
536
537 CHKPARAM(2);
538
539 f = EMBRYO_CELL_TO_FLOAT(params[2]);
540 _edje_var_list_float_prepend(ed, (int) params[1], f);
541
542 return 0;
543}
544
545/* insert_float(id, pos, Float:f) */
546static Embryo_Cell
547_edje_embryo_fn_insert_float(Embryo_Program *ep, Embryo_Cell *params)
548{
549 Edje *ed = embryo_program_data_get(ep);
550 float f;
551
552 CHKPARAM(3);
553
554 f = EMBRYO_CELL_TO_FLOAT(params[3]);
555 _edje_var_list_float_insert(ed, (int) params[1], (int) params[2], f);
556
557 return 0;
558}
559
560/* replace_float(id, pos, Float:f) */
561static Embryo_Cell
562_edje_embryo_fn_replace_float(Embryo_Program *ep, Embryo_Cell *params)
563{
564 Edje *ed = embryo_program_data_get(ep);
565
566 CHKPARAM(3);
567
568 _edje_var_list_nth_float_set(ed, (int) params[1], (int) params[2],
569 EMBRYO_CELL_TO_FLOAT(params[3]));
570
571 return 0;
572}
573
574/* Float:fetch_float(id, pos) */
575static Embryo_Cell
576_edje_embryo_fn_fetch_float(Embryo_Program *ep, Embryo_Cell *params)
577{
578 Edje *ed = embryo_program_data_get(ep);
579 float f;
580
581 CHKPARAM(2);
582
583 f = _edje_var_list_nth_float_get(ed, (int) params[1], (int) params[2]);
584
585 return EMBRYO_FLOAT_TO_CELL(f);
586}
587
588/* timer(Float:in, fname[], val) */
589static Embryo_Cell
590_edje_embryo_fn_timer(Embryo_Program *ep, Embryo_Cell *params)
591{
592 Edje *ed;
593 char *fname = NULL;
594 float f;
595 double in;
596 int val;
597
598 CHKPARAM(3);
599 ed = embryo_program_data_get(ep);
600 GETSTR(fname, params[2]);
601 if ((!fname)) return 0;
602 f = EMBRYO_CELL_TO_FLOAT(params[1]);
603 in = (double)f;
604 val = params[3];
605 return _edje_var_timer_add(ed, in, fname, val);
606}
607
608/* cancel_timer(id) */
609static Embryo_Cell
610_edje_embryo_fn_cancel_timer(Embryo_Program *ep, Embryo_Cell *params)
611{
612 Edje *ed;
613 int id;
614
615 CHKPARAM(1);
616 ed = embryo_program_data_get(ep);
617 id = params[1];
618 if (id <= 0) return 0;
619 _edje_var_timer_del(ed, id);
620 return 0;
621}
622
623/* anim(Float:len, fname[], val) */
624static Embryo_Cell
625_edje_embryo_fn_anim(Embryo_Program *ep, Embryo_Cell *params)
626{
627 Edje *ed;
628 char *fname = NULL;
629 float f;
630 double len;
631 int val;
632
633 CHKPARAM(3);
634 ed = embryo_program_data_get(ep);
635 GETSTR(fname, params[2]);
636 if ((!fname)) return 0;
637 f = EMBRYO_CELL_TO_FLOAT(params[1]);
638 len = (double)f;
639 val = params[3];
640 return _edje_var_anim_add(ed, len, fname, val);
641}
642
643/* cancel_anim(id) */
644static Embryo_Cell
645_edje_embryo_fn_cancel_anim(Embryo_Program *ep, Embryo_Cell *params)
646{
647 Edje *ed;
648 int id;
649
650 CHKPARAM(1);
651 ed = embryo_program_data_get(ep);
652 id = params[1];
653 if (id <= 0) return 0;
654 _edje_var_anim_del(ed, id);
655 return 0;
656}
657
658/* set_min_size(Float:w, Float:h) */
659static Embryo_Cell
660_edje_embryo_fn_set_min_size(Embryo_Program *ep, Embryo_Cell *params)
661{
662 Edje *ed;
663 float f = 0.0;
664 double w = 0.0, h = 0.0;
665
666 CHKPARAM(2);
667 ed = embryo_program_data_get(ep);
668 f = EMBRYO_CELL_TO_FLOAT(params[1]);
669 w = (double)f;
670 f = EMBRYO_CELL_TO_FLOAT(params[2]);
671 h = (double)f;
672
673 if (w < 0.0) w = 0.0;
674 if (h < 0.0) h = 0.0;
675 ed->collection->prop.min.w = w;
676 ed->collection->prop.min.h = h;
677 ed->dirty = 1;
678#ifdef EDJE_CALC_CACHE
679 ed->all_part_change = 1;
680#endif
681 _edje_recalc(ed);
682 return 0;
683}
684
685/* set_max_size(Float:w, Float:h) */
686static Embryo_Cell
687_edje_embryo_fn_set_max_size(Embryo_Program *ep, Embryo_Cell *params)
688{
689 Edje *ed;
690 float f = 0.0;
691 double w = 0.0, h = 0.0;
692
693 CHKPARAM(2);
694 ed = embryo_program_data_get(ep);
695 f = EMBRYO_CELL_TO_FLOAT(params[1]);
696 w = (double)f;
697 f = EMBRYO_CELL_TO_FLOAT(params[2]);
698 h = (double)f;
699
700 if (w < 0.0) w = 0.0;
701 if (h < 0.0) h = 0.0;
702 ed->collection->prop.max.w = w;
703 ed->collection->prop.max.h = h;
704 ed->dirty = 1;
705#ifdef EDJE_CALC_CACHE
706 ed->all_part_change = 1;
707#endif
708 _edje_recalc(ed);
709
710 return 0;
711}
712
713/* stop_program(program_id) */
714static Embryo_Cell
715_edje_embryo_fn_stop_program(Embryo_Program *ep, Embryo_Cell *params)
716{
717 Edje *ed;
718 int program_id = 0;
719 Edje_Running_Program *runp;
720 Eina_List *l;
721
722 CHKPARAM(1);
723 ed = embryo_program_data_get(ep);
724 program_id = params[1];
725 if (program_id < 0) return 0;
726
727 ed->walking_actions = 1;
728
729 EINA_LIST_FOREACH(ed->actions, l, runp)
730 if (program_id == runp->program->id)
731 _edje_program_end(ed, runp);
732
733 ed->walking_actions = 0;
734
735 return 0;
736}
737
738/* stop_programs_on(part_id) */
739static Embryo_Cell
740_edje_embryo_fn_stop_programs_on(Embryo_Program *ep, Embryo_Cell *params)
741{
742 Edje *ed;
743
744 int part_id = 0;
745 Edje_Real_Part *rp;
746
747 CHKPARAM(1);
748 ed = embryo_program_data_get(ep);
749 part_id = params[1];
750 if (part_id < 0) return 0;
751 rp = ed->table_parts[part_id % ed->table_parts_size];
752 if (rp)
753 {
754 /* there is only ever 1 program acting on a part at any time */
755 if (rp->program) _edje_program_end(ed, rp->program);
756 }
757 return 0;
758}
759
760/* get_mouse(&x, &y) */
761static Embryo_Cell
762_edje_embryo_fn_get_mouse(Embryo_Program *ep, Embryo_Cell *params)
763{
764 Edje *ed;
765 Evas_Coord x = 0, y = 0;
766
767 CHKPARAM(2);
768 ed = embryo_program_data_get(ep);
769 evas_pointer_canvas_xy_get(ed->base.evas, &x, &y);
770 x -= ed->x;
771 y -= ed->y;
772 SETINT((int)x, params[1]);
773 SETINT((int)y, params[2]);
774 return 0;
775}
776
777/* get_mouse_buttons() */
778static Embryo_Cell
779_edje_embryo_fn_get_mouse_buttons(Embryo_Program *ep, Embryo_Cell *params)
780{
781 Edje *ed;
782
783 CHKPARAM(0);
784 ed = embryo_program_data_get(ep);
785 return evas_pointer_button_down_mask_get(ed->base.evas);
786}
787
788/* emit(sig[], src[]) */
789static Embryo_Cell
790_edje_embryo_fn_emit(Embryo_Program *ep, Embryo_Cell *params)
791{
792 Edje *ed;
793 char *sig = NULL, *src = NULL;
794
795 CHKPARAM(2);
796 ed = embryo_program_data_get(ep);
797 GETSTR(sig, params[1]);
798 GETSTR(src, params[2]);
799 if ((!sig) || (!src)) return 0;
800 _edje_emit(ed, sig, src);
801 return 0;
802}
803
804/* get_part_id(part[]) */
805static Embryo_Cell
806_edje_embryo_fn_get_part_id(Embryo_Program *ep, Embryo_Cell *params)
807{
808 Edje *ed;
809 Edje_Part_Collection *col;
810 Edje_Part **part;
811 char *p;
812 unsigned int i;
813
814 CHKPARAM(1);
815 ed = embryo_program_data_get(ep);
816 GETSTR(p, params[1]);
817 if (!p) return -1;
818 col = ed->collection;
819 if (!col) return -1;
820 part = col->parts;
821 for (i = 0; i < col->parts_count; i++, part++)
822 {
823 if (!(*part)->name) continue;
824 if (!strcmp((*part)->name, p)) return (*part)->id;
825 }
826 return -1;
827}
828
829static Embryo_Cell
830_edje_embryo_fn_play_sample(Embryo_Program *ep, Embryo_Cell *params)
831{
832 Edje *ed;
833 char *sample_name = NULL;
834 float speed = 1.0;
835
836 CHKPARAM(1);
837 ed = embryo_program_data_get(ep);
838 GETSTR(sample_name, params[1]);
839 if ((!sample_name)) return 0;
840 speed = EMBRYO_CELL_TO_FLOAT(params[2]);
841 _edje_multisense_internal_sound_sample_play(ed, sample_name, (double)speed);
842 return 0;
843}
844
845static Embryo_Cell
846_edje_embryo_fn_play_tone(Embryo_Program *ep, Embryo_Cell *params)
847{
848 Edje *ed;
849 char *tone_name = NULL;
850 float duration = 0.1;
851
852 CHKPARAM(2);
853 ed = embryo_program_data_get(ep);
854 GETSTR(tone_name, params[1]);
855 if ((!tone_name)) return 0;
856 duration = EMBRYO_CELL_TO_FLOAT(params[2]);
857 _edje_multisense_internal_sound_tone_play(ed, tone_name, (double) duration);
858 return 0;
859}
860
861/* set_state(part_id, state[], Float:state_val) */
862static Embryo_Cell
863_edje_embryo_fn_set_state(Embryo_Program *ep, Embryo_Cell *params)
864{
865 Edje *ed;
866 char *state = NULL;
867 int part_id = 0;
868 float f = 0.0;
869 double value = 0.0;
870 Edje_Real_Part *rp;
871
872 CHKPARAM(3);
873 ed = embryo_program_data_get(ep);
874 GETSTR(state, params[2]);
875 if ((!state)) return 0;
876 part_id = params[1];
877 if (part_id < 0) return 0;
878 f = EMBRYO_CELL_TO_FLOAT(params[3]);
879 value = (double)f;
880 rp = ed->table_parts[part_id % ed->table_parts_size];
881 if (rp)
882 {
883 if (rp->program) _edje_program_end(ed, rp->program);
884 _edje_part_description_apply(ed, rp, state, value, NULL, 0.0);
885 _edje_part_pos_set(ed, rp, EDJE_TWEEN_MODE_LINEAR, ZERO, ZERO, ZERO);
886 _edje_recalc(ed);
887 }
888 return 0;
889}
890
891/* get_state(part_id, dst[], maxlen, &Float:val) */
892static Embryo_Cell
893_edje_embryo_fn_get_state(Embryo_Program *ep, Embryo_Cell *params)
894{
895 Edje *ed;
896 int part_id = 0;
897 Edje_Real_Part *rp;
898 const char *s;
899
900 CHKPARAM(4);
901 ed = embryo_program_data_get(ep);
902 part_id = params[1];
903 if (part_id < 0) return 0;
904 rp = ed->table_parts[part_id % ed->table_parts_size];
905 if (rp->chosen_description)
906 {
907 SETFLOAT(rp->chosen_description->state.value, params[4]);
908 s = rp->chosen_description->state.name;
909 if (s)
910 {
911 if ((int) strlen(s) < params[3])
912 {
913 SETSTR(s, params[2]);
914 }
915 else
916 {
917 char *ss;
918
919 ss = alloca(strlen(s) + 1);
920 strcpy(ss, s);
921 ss[params[3] - 1] = 0;
922 SETSTR(ss, params[2]);
923 }
924 }
925 else
926 {
927 SETSTR("", params[2]);
928 }
929 }
930 else
931 {
932 SETFLOAT(0.0, params[4]);
933 SETSTR("", params[2]);
934 }
935 return 0;
936}
937
938/* set_tween_state(part_id, Float:tween, state1[], Float:state1_val, state2[], Float:state2_val) */
939static Embryo_Cell
940_edje_embryo_fn_set_tween_state(Embryo_Program *ep, Embryo_Cell *params)
941{
942 Edje *ed;
943 char *state1 = NULL, *state2 = NULL;
944 int part_id = 0;
945 float f = 0.0;
946 double tween = 0.0, value1 = 0.0, value2 = 0.0;
947 Edje_Real_Part *rp;
948
949 CHKPARAM(6);
950 ed = embryo_program_data_get(ep);
951 GETSTR(state1, params[3]);
952 GETSTR(state2, params[5]);
953 if ((!state1) || (!state2)) return 0;
954 part_id = params[1];
955 if (part_id < 0) return 0;
956 f = EMBRYO_CELL_TO_FLOAT(params[2]);
957 tween = (double)f;
958 f = EMBRYO_CELL_TO_FLOAT(params[4]);
959 value1 = (double)f;
960 f = EMBRYO_CELL_TO_FLOAT(params[6]);
961 value2 = (double)f;
962 rp = ed->table_parts[part_id % ed->table_parts_size];
963 if (rp)
964 {
965 if (rp->program) _edje_program_end(ed, rp->program);
966 _edje_part_description_apply(ed, rp, state1, value1, state2, value2);
967 _edje_part_pos_set(ed, rp, EDJE_TWEEN_MODE_LINEAR, FROM_DOUBLE(tween), ZERO, ZERO);
968 _edje_recalc(ed);
969 }
970 return 0;
971}
972
973/* run_program(program_id) */
974static Embryo_Cell
975_edje_embryo_fn_run_program(Embryo_Program *ep, Embryo_Cell *params)
976{
977 Edje *ed;
978 int program_id = 0;
979 Edje_Program *pr;
980
981 CHKPARAM(1);
982 ed = embryo_program_data_get(ep);
983 program_id = params[1];
984 if (program_id < 0) return 0;
985 pr = ed->table_programs[program_id % ed->table_programs_size];
986 if (pr)
987 {
988 _edje_program_run(ed, pr, 0, "", "");
989 }
990 return 0;
991}
992
993/* get_drag_dir(part_id) */
994static Embryo_Cell
995_edje_embryo_fn_get_drag_dir(Embryo_Program *ep, Embryo_Cell *params)
996{
997 Edje *ed;
998 int part_id = 0;
999 Edje_Real_Part *rp;
1000
1001 CHKPARAM(1);
1002 ed = embryo_program_data_get(ep);
1003 part_id = params[1];
1004 if (part_id < 0) return 0;
1005 rp = ed->table_parts[part_id % ed->table_parts_size];
1006 return edje_object_part_drag_dir_get(ed->obj, rp->part->name);
1007}
1008
1009/* get_drag(part_id, &Float:dx, &Float:dy) */
1010static Embryo_Cell
1011_edje_embryo_fn_get_drag(Embryo_Program *ep, Embryo_Cell *params)
1012{
1013 Edje *ed;
1014 int part_id = 0;
1015 Edje_Real_Part *rp;
1016 double dx = 0.0, dy = 0.0;
1017
1018 CHKPARAM(3);
1019 ed = embryo_program_data_get(ep);
1020 part_id = params[1];
1021 if (part_id < 0) return 0;
1022 rp = ed->table_parts[part_id % ed->table_parts_size];
1023 edje_object_part_drag_value_get(ed->obj, rp->part->name, &dx, &dy);
1024 SETFLOAT(dx, params[2]);
1025 SETFLOAT(dy, params[3]);
1026
1027 return 0;
1028}
1029
1030/* set_drag(part_id, Float:dx, Float:dy) */
1031static Embryo_Cell
1032_edje_embryo_fn_set_drag(Embryo_Program *ep, Embryo_Cell *params)
1033{
1034 Edje *ed;
1035 int part_id = 0;
1036 Edje_Real_Part *rp;
1037
1038 CHKPARAM(3);
1039 ed = embryo_program_data_get(ep);
1040 part_id = params[1];
1041 if (part_id < 0) return 0;
1042 rp = ed->table_parts[part_id % ed->table_parts_size];
1043 edje_object_part_drag_value_set(ed->obj, rp->part->name,
1044 (double)EMBRYO_CELL_TO_FLOAT(params[2]),
1045 (double)EMBRYO_CELL_TO_FLOAT(params[3]));
1046 return(0);
1047}
1048
1049/* get_drag_size(part_id, &Float:dx, &Float:dy) */
1050static Embryo_Cell
1051_edje_embryo_fn_get_drag_size(Embryo_Program *ep, Embryo_Cell *params)
1052{
1053 Edje *ed;
1054 int part_id = 0;
1055 Edje_Real_Part *rp;
1056 double dx = 0.0, dy = 0.0;
1057
1058 CHKPARAM(3);
1059 ed = embryo_program_data_get(ep);
1060 part_id = params[1];
1061 if (part_id < 0) return 0;
1062 rp = ed->table_parts[part_id % ed->table_parts_size];
1063 edje_object_part_drag_size_get(ed->obj, rp->part->name, &dx, &dy);
1064 SETFLOAT(dx, params[2]);
1065 SETFLOAT(dy, params[3]);
1066
1067 return 0;
1068}
1069
1070/* set_drag_size(part_id, Float:dx, Float:dy) */
1071static Embryo_Cell
1072_edje_embryo_fn_set_drag_size(Embryo_Program *ep, Embryo_Cell *params)
1073{
1074 Edje *ed;
1075 int part_id = 0;
1076 Edje_Real_Part *rp;
1077
1078 CHKPARAM(3);
1079 ed = embryo_program_data_get(ep);
1080 part_id = params[1];
1081 if (part_id < 0) return 0;
1082 rp = ed->table_parts[part_id % ed->table_parts_size];
1083 edje_object_part_drag_size_set(ed->obj, rp->part->name,
1084 (double)EMBRYO_CELL_TO_FLOAT(params[2]),
1085 (double)EMBRYO_CELL_TO_FLOAT(params[3]));
1086 return(0);
1087}
1088
1089/* set_text(part_id, str[]) */
1090static Embryo_Cell
1091_edje_embryo_fn_set_text(Embryo_Program *ep, Embryo_Cell *params)
1092{
1093 Edje *ed;
1094 int part_id = 0;
1095 Edje_Real_Part *rp;
1096 char *s;
1097
1098 CHKPARAM(2);
1099 ed = embryo_program_data_get(ep);
1100 part_id = params[1];
1101 if (part_id < 0) return 0;
1102 rp = ed->table_parts[part_id % ed->table_parts_size];
1103 GETSTR(s, params[2]);
1104 if (s){
1105 edje_object_part_text_set(ed->obj, rp->part->name, s);
1106 }
1107 return(0);
1108}
1109
1110/* get_text(part_id, dst[], maxlen) */
1111static Embryo_Cell
1112_edje_embryo_fn_get_text(Embryo_Program *ep, Embryo_Cell *params)
1113{
1114 Edje *ed;
1115 int part_id = 0;
1116 Edje_Real_Part *rp;
1117 char *s;
1118
1119 CHKPARAM(3);
1120 ed = embryo_program_data_get(ep);
1121 part_id = params[1];
1122 if (part_id < 0) return 0;
1123 rp = ed->table_parts[part_id % ed->table_parts_size];
1124 s = (char *)edje_object_part_text_get(ed->obj, rp->part->name);
1125 if (s)
1126 {
1127 if ((int) strlen(s) < params[3])
1128 {
1129 SETSTR(s, params[2]);
1130 }
1131 else
1132 {
1133 char *ss;
1134
1135 ss = alloca(strlen(s) + 1);
1136 strcpy(ss, s);
1137 ss[params[3] - 1] = 0;
1138 SETSTR(ss, params[2]);
1139 }
1140 }
1141 else
1142 {
1143 SETSTR("", params[2]);
1144 }
1145 return 0;
1146}
1147
1148/* get_min_size(&w, &h) */
1149static Embryo_Cell
1150_edje_embryo_fn_get_min_size(Embryo_Program *ep, Embryo_Cell *params)
1151{
1152 Edje *ed;
1153 Evas_Coord w = 0, h = 0;
1154
1155 CHKPARAM(2);
1156 ed = embryo_program_data_get(ep);
1157 edje_object_size_min_get(ed->obj, &w, &h);
1158 SETINT(w, params[1]);
1159 SETINT(h, params[2]);
1160 return 0;
1161}
1162
1163/* get_max_size(&w, &h) */
1164static Embryo_Cell
1165_edje_embryo_fn_get_max_size(Embryo_Program *ep, Embryo_Cell *params)
1166{
1167 Edje *ed;
1168 Evas_Coord w = 0, h = 0;
1169
1170 CHKPARAM(2);
1171 ed = embryo_program_data_get(ep);
1172 edje_object_size_max_get(ed->obj, &w, &h);
1173 SETINT(w, params[1]);
1174 SETINT(h, params[2]);
1175 return 0;
1176
1177}
1178
1179/* get_color_class(class[], &r, &g, &b, &a) */
1180static Embryo_Cell
1181_edje_embryo_fn_get_color_class(Embryo_Program *ep, Embryo_Cell *params)
1182{
1183 Edje *ed;
1184 Edje_Color_Class *c_class;
1185 char *class;
1186
1187 CHKPARAM(5);
1188 ed = embryo_program_data_get(ep);
1189 GETSTR(class, params[1]);
1190 if (!class) return 0;
1191 c_class = _edje_color_class_find(ed, class);
1192 if (!c_class) return 0;
1193 SETINT(c_class->r, params[2]);
1194 SETINT(c_class->g, params[3]);
1195 SETINT(c_class->b, params[4]);
1196 SETINT(c_class->a, params[5]);
1197 return 0;
1198}
1199
1200/* set_color_class(class[], r, g, b, a) */
1201static Embryo_Cell
1202_edje_embryo_fn_set_color_class(Embryo_Program *ep, Embryo_Cell *params)
1203{
1204 Edje *ed;
1205 char *class;
1206
1207 CHKPARAM(5);
1208 ed = embryo_program_data_get(ep);
1209 GETSTR(class, params[1]);
1210 if (!class) return 0;
1211 edje_object_color_class_set(ed->obj, class, params[2], params[3], params[4], params[5],
1212 params[2], params[3], params[4], params[5],
1213 params[2], params[3], params[4], params[5]);
1214 return 0;
1215}
1216
1217/* set_text_class(class[], font[], Float:size) */
1218static Embryo_Cell
1219_edje_embryo_fn_set_text_class(Embryo_Program *ep, Embryo_Cell *params)
1220{
1221 Edje *ed;
1222 char *class, *font;
1223 Evas_Font_Size fsize;
1224
1225 CHKPARAM(3);
1226 ed = embryo_program_data_get(ep);
1227 GETSTR(class, params[1]);
1228 GETSTR(font, params[2]);
1229 if( !class || !font ) return 0;
1230 fsize = (Evas_Font_Size) EMBRYO_CELL_TO_FLOAT(params[3]);
1231 edje_object_text_class_set(ed->obj, class, font, fsize);
1232 return 0;
1233}
1234
1235/* get_text_class(class[], font[], &Float:size) */
1236static Embryo_Cell
1237_edje_embryo_fn_get_text_class(Embryo_Program *ep, Embryo_Cell *params)
1238{
1239 Edje *ed;
1240 char *class;
1241 Edje_Text_Class *t_class;
1242
1243 CHKPARAM(3);
1244 ed = embryo_program_data_get(ep);
1245 GETSTR(class, params[1]);
1246 if (!class) return 0;
1247 t_class = _edje_text_class_find(ed, class);
1248 if (!t_class) return 0;
1249 SETSTR((char *)t_class->font, params[2]);
1250 SETFLOAT(t_class->size, params[3]);
1251 return 0;
1252}
1253
1254/* get_drag_step(part_id, &Float:dx, &Float:&dy) */
1255static Embryo_Cell
1256_edje_embryo_fn_get_drag_step(Embryo_Program *ep, Embryo_Cell *params)
1257{
1258 Edje *ed;
1259 int part_id = 0;
1260 Edje_Real_Part *rp;
1261 double dx = 0.0, dy = 0.0;
1262
1263 CHKPARAM(3);
1264 ed = embryo_program_data_get(ep);
1265 part_id = params[1];
1266 if (part_id < 0) return 0;
1267 rp = ed->table_parts[part_id % ed->table_parts_size];
1268 edje_object_part_drag_step_get(ed->obj, rp->part->name, &dx, &dy);
1269 SETFLOAT(dx, params[2]);
1270 SETFLOAT(dy, params[3]);
1271
1272 return 0;
1273}
1274
1275/* set_drag_step(part_id, Float:dx, Float:dy) */
1276static Embryo_Cell
1277_edje_embryo_fn_set_drag_step(Embryo_Program *ep, Embryo_Cell *params)
1278{
1279 Edje *ed;
1280 int part_id = 0;
1281 Edje_Real_Part *rp;
1282
1283 CHKPARAM(3);
1284 ed = embryo_program_data_get(ep);
1285 part_id = params[1];
1286 if (part_id < 0) return 0;
1287 rp = ed->table_parts[part_id % ed->table_parts_size];
1288 edje_object_part_drag_step_set(ed->obj, rp->part->name,
1289 (double)EMBRYO_CELL_TO_FLOAT(params[2]),
1290 (double)EMBRYO_CELL_TO_FLOAT(params[3]));
1291 return(0);
1292}
1293
1294/* get_drag_page(part_id, &Float:dx, &Float:&dy) */
1295static Embryo_Cell
1296_edje_embryo_fn_get_drag_page(Embryo_Program *ep, Embryo_Cell *params)
1297{
1298 Edje *ed;
1299 int part_id = 0;
1300 Edje_Real_Part *rp;
1301 double dx = 0.0, dy = 0.0;
1302
1303 CHKPARAM(3);
1304 ed = embryo_program_data_get(ep);
1305 part_id = params[1];
1306 if (part_id < 0) return 0;
1307 rp = ed->table_parts[part_id % ed->table_parts_size];
1308 edje_object_part_drag_page_get(ed->obj, rp->part->name, &dx, &dy);
1309 SETFLOAT(dx, params[2]);
1310 SETFLOAT(dy, params[3]);
1311
1312 return 0;
1313}
1314
1315/* get_geometry(pard_id, &x, &y, &w, &h) */
1316static Embryo_Cell
1317_edje_embryo_fn_get_geometry(Embryo_Program *ep, Embryo_Cell *params)
1318{
1319 Edje *ed;
1320 int part_id = 0;
1321 Edje_Real_Part *rp;
1322 Evas_Coord x = 0.0, y = 0.0, w = 0.0, h = 0.0;
1323
1324 CHKPARAM(5);
1325 ed = embryo_program_data_get(ep);
1326 part_id = params[1];
1327 if (part_id < 0) return 0;
1328 rp = ed->table_parts[part_id % ed->table_parts_size];
1329 edje_object_part_geometry_get(ed->obj, rp->part->name, &x, &y, &w, &h);
1330 SETINT(x, params[2]);
1331 SETINT(y, params[3]);
1332 SETINT(w, params[4]);
1333 SETINT(h, params[5]);
1334
1335 return 0;
1336}
1337
1338/* set_drag_page(part_id, Float:dx, Float:dy) */
1339static Embryo_Cell
1340_edje_embryo_fn_set_drag_page(Embryo_Program *ep, Embryo_Cell *params)
1341{
1342 Edje *ed;
1343 int part_id = 0;
1344 Edje_Real_Part *rp;
1345
1346 CHKPARAM(3);
1347 ed = embryo_program_data_get(ep);
1348 part_id = params[1];
1349 if (part_id < 0) return 0;
1350 rp = ed->table_parts[part_id % ed->table_parts_size];
1351 edje_object_part_drag_page_set(ed->obj, rp->part->name,
1352 (double)EMBRYO_CELL_TO_FLOAT(params[2]),
1353 (double)EMBRYO_CELL_TO_FLOAT(params[3]));
1354 return(0);
1355}
1356
1357/* send_message(Msg_Type:type, id,...); */
1358static Embryo_Cell
1359_edje_embryo_fn_send_message(Embryo_Program *ep, Embryo_Cell *params)
1360{
1361 Edje *ed;
1362 Edje_Message_Type type;
1363 int id, i, n;
1364 Embryo_Cell *ptr;
1365
1366 if (params[0] < (int) (sizeof(Embryo_Cell) * (2))) return 0;
1367 ed = embryo_program_data_get(ep);
1368 type = params[1];
1369 id = params[2];
1370 switch (type)
1371 {
1372 case EDJE_MESSAGE_NONE:
1373 _edje_message_send(ed, EDJE_QUEUE_APP, type, id, NULL);
1374 break;
1375 case EDJE_MESSAGE_SIGNAL:
1376 break;
1377 case EDJE_MESSAGE_STRING:
1378 {
1379 Embryo_Cell *cptr;
1380
1381 cptr = embryo_data_address_get(ep, params[3]);
1382 if (cptr)
1383 {
1384 Edje_Message_String *emsg;
1385 int l;
1386 char *s;
1387
1388 l = embryo_data_string_length_get(ep, cptr);
1389 s = alloca(l + 1);
1390 s[0] = 0;
1391 embryo_data_string_get(ep, cptr, s);
1392 emsg = alloca(sizeof(Edje_Message_String));
1393 emsg->str = s;
1394 _edje_message_send(ed, EDJE_QUEUE_APP, type, id, emsg);
1395 }
1396 }
1397 break;
1398 case EDJE_MESSAGE_INT:
1399 {
1400 Edje_Message_Int *emsg;
1401
1402 emsg = alloca(sizeof(Edje_Message_Int));
1403 ptr = embryo_data_address_get(ep, params[3]);
1404 if (ptr) emsg->val = (int)*ptr;
1405 else emsg->val = 0;
1406 _edje_message_send(ed, EDJE_QUEUE_APP, type, id, emsg);
1407 }
1408 break;
1409 case EDJE_MESSAGE_FLOAT:
1410 {
1411 Edje_Message_Float *emsg;
1412 float f;
1413
1414 emsg = alloca(sizeof(Edje_Message_Float));
1415 ptr = embryo_data_address_get(ep, params[3]);
1416 if (ptr)
1417 {
1418 f = EMBRYO_CELL_TO_FLOAT(*ptr);
1419 emsg->val = (double)f;
1420 }
1421 else
1422 emsg->val = 0.0;
1423 _edje_message_send(ed, EDJE_QUEUE_APP, type, id, emsg);
1424 }
1425 break;
1426 case EDJE_MESSAGE_STRING_SET:
1427 {
1428 Edje_Message_String_Set *emsg;
1429
1430 n = (params[0] / sizeof(Embryo_Cell)) + 1;
1431 emsg = alloca(sizeof(Edje_Message_String_Set) + ((n - 3 - 1) * sizeof(char *)));
1432 emsg->count = n - 3;
1433 for (i = 3; i < n; i++)
1434 {
1435 Embryo_Cell *cptr;
1436
1437 cptr = embryo_data_address_get(ep, params[i]);
1438 if (cptr)
1439 {
1440 int l;
1441 char *s;
1442
1443 l = embryo_data_string_length_get(ep, cptr);
1444 s = alloca(l + 1);
1445 s[0] = 0;
1446 embryo_data_string_get(ep, cptr, s);
1447 emsg->str[i - 3] = s;
1448 }
1449 }
1450 _edje_message_send(ed, EDJE_QUEUE_APP, type, id, emsg);
1451 }
1452 break;
1453 case EDJE_MESSAGE_INT_SET:
1454 {
1455 Edje_Message_Int_Set *emsg;
1456
1457 n = (params[0] / sizeof(Embryo_Cell)) + 1;
1458 emsg = alloca(sizeof(Edje_Message_Int_Set) + ((n - 3 - 1) * sizeof(int)));
1459 emsg->count = n - 3;
1460 for (i = 3; i < n; i++)
1461 {
1462 ptr = embryo_data_address_get(ep, params[i]);
1463 if (ptr) emsg->val[i - 3] = (int)*ptr;
1464 else emsg->val[i - 3] = 0;
1465 }
1466 _edje_message_send(ed, EDJE_QUEUE_APP, type, id, emsg);
1467 }
1468 break;
1469 case EDJE_MESSAGE_FLOAT_SET:
1470 {
1471 Edje_Message_Float_Set *emsg;
1472
1473 n = (params[0] / sizeof(Embryo_Cell)) + 1;
1474 emsg = alloca(sizeof(Edje_Message_Float_Set) + ((n - 3 - 1) * sizeof(double)));
1475 emsg->count = n - 3;
1476 for (i = 3; i < n; i++)
1477 {
1478 float f;
1479
1480 ptr = embryo_data_address_get(ep, params[i]);
1481 if (ptr)
1482 {
1483 f = EMBRYO_CELL_TO_FLOAT(*ptr);
1484 emsg->val[i - 3] = (double)f;
1485 }
1486 else
1487 emsg->val[i - 3] = 0.0;
1488 }
1489 _edje_message_send(ed, EDJE_QUEUE_APP, type, id, emsg);
1490 }
1491 break;
1492 case EDJE_MESSAGE_STRING_INT:
1493 {
1494 Edje_Message_String_Int *emsg;
1495 Embryo_Cell *cptr;
1496
1497 cptr = embryo_data_address_get(ep, params[3]);
1498 if (cptr)
1499 {
1500 int l;
1501 char *s;
1502
1503 l = embryo_data_string_length_get(ep, cptr);
1504 s = alloca(l + 1);
1505 s[0] = 0;
1506 embryo_data_string_get(ep, cptr, s);
1507 emsg = alloca(sizeof(Edje_Message_String_Int));
1508 emsg->str = s;
1509 ptr = embryo_data_address_get(ep, params[4]);
1510 if (ptr) emsg->val = (int)*ptr;
1511 else emsg->val = 0;
1512 _edje_message_send(ed, EDJE_QUEUE_APP, type, id, emsg);
1513 }
1514 }
1515 break;
1516 case EDJE_MESSAGE_STRING_FLOAT:
1517 {
1518 Edje_Message_String_Float *emsg;
1519 Embryo_Cell *cptr;
1520
1521 cptr = embryo_data_address_get(ep, params[3]);
1522 if (cptr)
1523 {
1524 int l;
1525 char *s;
1526 float f;
1527
1528 l = embryo_data_string_length_get(ep, cptr);
1529 s = alloca(l + 1);
1530 s[0] = 0;
1531 embryo_data_string_get(ep, cptr, s);
1532 emsg = alloca(sizeof(Edje_Message_String_Float));
1533 emsg->str = s;
1534 ptr = embryo_data_address_get(ep, params[4]);
1535 if (ptr)
1536 {
1537 f = EMBRYO_CELL_TO_FLOAT(*ptr);
1538 emsg->val = (double)f;
1539 }
1540 else
1541 emsg->val = 0.0;
1542 _edje_message_send(ed, EDJE_QUEUE_APP, type, id, emsg);
1543 }
1544 }
1545 break;
1546 case EDJE_MESSAGE_STRING_INT_SET:
1547 {
1548 Edje_Message_String_Int_Set *emsg;
1549 Embryo_Cell *cptr;
1550
1551 cptr = embryo_data_address_get(ep, params[3]);
1552 if (cptr)
1553 {
1554 int l;
1555 char *s;
1556
1557 l = embryo_data_string_length_get(ep, cptr);
1558 s = alloca(l + 1);
1559 s[0] = 0;
1560 embryo_data_string_get(ep, cptr, s);
1561 n = (params[0] / sizeof(Embryo_Cell)) + 1;
1562 emsg = alloca(sizeof(Edje_Message_String_Int_Set) + ((n - 4 - 1) * sizeof(int)));
1563 emsg->str = s;
1564 emsg->count = n - 4;
1565 for (i = 4; i < n; i++)
1566 {
1567 ptr = embryo_data_address_get(ep, params[i]);
1568 if (ptr) emsg->val[i - 4] = (int)*ptr;
1569 else emsg->val[i - 4] = 0;
1570 }
1571 _edje_message_send(ed, EDJE_QUEUE_APP, type, id, emsg);
1572 }
1573 }
1574 break;
1575 case EDJE_MESSAGE_STRING_FLOAT_SET:
1576 {
1577 Edje_Message_String_Float_Set *emsg;
1578 Embryo_Cell *cptr;
1579
1580 cptr = embryo_data_address_get(ep, params[3]);
1581 if (cptr)
1582 {
1583 int l;
1584 char *s;
1585
1586 l = embryo_data_string_length_get(ep, cptr);
1587 s = alloca(l + 1);
1588 s[0] = 0;
1589 embryo_data_string_get(ep, cptr, s);
1590 n = (params[0] / sizeof(Embryo_Cell)) + 1;
1591 emsg = alloca(sizeof(Edje_Message_String_Float_Set) + ((n - 4 - 1) * sizeof(double)));
1592 emsg->str = s;
1593 emsg->count = n - 4;
1594 for (i = 4; i < n; i++)
1595 {
1596 float f;
1597
1598 ptr = embryo_data_address_get(ep, params[i]);
1599 if (ptr)
1600 {
1601 f = EMBRYO_CELL_TO_FLOAT(*ptr);
1602 emsg->val[i - 4] = (double)f;
1603 }
1604 else
1605 emsg->val[i - 4] = 0.0;
1606 }
1607 _edje_message_send(ed, EDJE_QUEUE_APP, type, id, emsg);
1608 }
1609 }
1610 break;
1611 default:
1612 break;
1613 }
1614 return(0);
1615}
1616
1617/* custom_state(part_id, state[], Float:state_val = 0.0) */
1618static Embryo_Cell
1619_edje_embryo_fn_custom_state(Embryo_Program *ep, Embryo_Cell *params)
1620{
1621 Edje *ed = embryo_program_data_get(ep);
1622 Edje_Real_Part *rp;
1623 Edje_Part_Description_Common *parent, *d = NULL;
1624 char *name;
1625 float val;
1626
1627 CHKPARAM(3);
1628
1629 if (params[1] < 0)
1630 return 0;
1631
1632 if (!(rp = ed->table_parts[params[1] % ed->table_parts_size]))
1633 return 0;
1634
1635 /* check whether this part already has a "custom" state */
1636 if (rp->custom)
1637 return 0;
1638
1639 GETSTR(name, params[2]);
1640 if (!name)
1641 return 0;
1642
1643 val = EMBRYO_CELL_TO_FLOAT(params[3]);
1644
1645 if (!(parent = _edje_part_description_find(ed, rp, name, val)))
1646 return 0;
1647
1648 /* now create the custom state */
1649 switch (rp->part->type)
1650 {
1651#define ALLOC_DESC(Short, Type, To) \
1652 case EDJE_PART_TYPE_##Short: To = calloc(1, sizeof (Edje_Part_Description_##Type)); break;
1653
1654#define ALLOC_COPY_DESC(Short, Type, To, Spec) \
1655 case EDJE_PART_TYPE_##Short: \
1656 { \
1657 Edje_Part_Description_##Type *tmp; \
1658 Edje_Part_Description_##Type *new; \
1659 \
1660 tmp = (Edje_Part_Description_##Type *) parent; \
1661 \
1662 new = calloc(1, sizeof (Edje_Part_Description_##Type)); \
1663 new->Spec = tmp->Spec; \
1664 d = &new->common; \
1665 break; \
1666 }
1667
1668 ALLOC_DESC(RECTANGLE, Common, d);
1669 ALLOC_DESC(SWALLOW, Common, d);
1670 ALLOC_DESC(GROUP, Common, d);
1671
1672 ALLOC_COPY_DESC(IMAGE, Image, d, image);
1673 ALLOC_COPY_DESC(TEXT, Text, d, text);
1674 ALLOC_COPY_DESC(TEXTBLOCK, Text, d, text);
1675 ALLOC_COPY_DESC(BOX, Box, d, box);
1676 ALLOC_COPY_DESC(TABLE, Table, d, table);
1677 ALLOC_COPY_DESC(EXTERNAL, External, d, external_params);
1678 }
1679
1680 if (!d) return 0;
1681
1682 rp->custom = eina_mempool_malloc(_edje_real_part_state_mp, sizeof (Edje_Real_Part_State));
1683 if (!rp->custom)
1684 {
1685 free(d);
1686 return 0;
1687 }
1688
1689 memset(rp->custom, 0, sizeof (Edje_Real_Part_State));
1690
1691 *d = *parent;
1692
1693 d->state.name = (char *)eina_stringshare_add("custom");
1694 d->state.value = 0.0;
1695
1696 /* make sure all the allocated memory is getting copied,
1697 * not just referenced
1698 */
1699 if (rp->part->type == EDJE_PART_TYPE_IMAGE)
1700 {
1701 Edje_Part_Description_Image *img_desc;
1702 Edje_Part_Description_Image *parent_img_desc;
1703
1704 img_desc = (Edje_Part_Description_Image*) d;
1705 parent_img_desc = (Edje_Part_Description_Image*) parent;
1706
1707 img_desc->image.tweens_count = parent_img_desc->image.tweens_count;
1708 img_desc->image.tweens = calloc(img_desc->image.tweens_count,
1709 sizeof(Edje_Part_Image_Id*));
1710 if (img_desc->image.tweens)
1711 {
1712 unsigned int i;
1713
1714 for (i = 0; i < parent_img_desc->image.tweens_count; ++i)
1715 {
1716 Edje_Part_Image_Id *iid_new;
1717
1718 iid_new = calloc(1, sizeof(Edje_Part_Image_Id));
1719 if (!iid_new) continue;
1720
1721 *iid_new = *parent_img_desc->image.tweens[i];
1722
1723 img_desc->image.tweens[i] = iid_new;
1724 }
1725 }
1726 }
1727
1728#define DUP(x) x ? (char *)eina_stringshare_add(x) : NULL
1729 d->color_class = DUP(d->color_class);
1730
1731 if (rp->part->type == EDJE_PART_TYPE_TEXT
1732 || rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
1733 {
1734 Edje_Part_Description_Text *text_desc;
1735
1736 text_desc = (Edje_Part_Description_Text*) d;
1737
1738 text_desc->text.text_class = DUP(text_desc->text.text_class);
1739 text_desc->text.text.str = DUP(edje_string_get(&text_desc->text.text));
1740 text_desc->text.text.id = 0;
1741 text_desc->text.font.str = DUP(edje_string_get(&text_desc->text.font));
1742 text_desc->text.font.id = 0;
1743 text_desc->text.style.str = DUP(edje_string_get(&text_desc->text.style));
1744 text_desc->text.style.id = 0;
1745 }
1746#undef DUP
1747
1748 rp->custom->description = d;
1749
1750 return 0;
1751}
1752
1753/* set_state_val(part_id, State_Param:p, ...) */
1754static Embryo_Cell
1755_edje_embryo_fn_set_state_val(Embryo_Program *ep, Embryo_Cell *params)
1756{
1757 Edje *ed = embryo_program_data_get(ep);
1758 Edje_Real_Part *rp;
1759 char *s;
1760
1761 /* we need at least 3 arguments */
1762 if (params[0] < (int) (sizeof(Embryo_Cell) * 3))
1763 return 0;
1764
1765 if (params[1] < 0)
1766 return 0;
1767
1768 if (!(rp = ed->table_parts[params[1] % ed->table_parts_size]))
1769 return 0;
1770
1771 /* check whether this part has a "custom" state */
1772 if (!rp->custom)
1773 return 0;
1774
1775 switch (params[2])
1776 {
1777 case EDJE_STATE_PARAM_ALIGNMENT:
1778 CHKPARAM(4);
1779
1780 GETFLOAT_T(rp->custom->description->align.x, params[3]);
1781 GETFLOAT_T(rp->custom->description->align.y, params[4]);
1782
1783 break;
1784 case EDJE_STATE_PARAM_MIN:
1785 CHKPARAM(4);
1786
1787 GETINT(rp->custom->description->min.w, params[3]);
1788 GETINT(rp->custom->description->min.h, params[4]);
1789
1790 break;
1791 case EDJE_STATE_PARAM_MAX:
1792 CHKPARAM(4);
1793
1794 GETINT(rp->custom->description->max.w, params[3]);
1795 GETINT(rp->custom->description->max.h, params[4]);
1796
1797 break;
1798 case EDJE_STATE_PARAM_STEP:
1799 CHKPARAM(4);
1800
1801 GETINT(rp->custom->description->step.x, params[3]);
1802 GETINT(rp->custom->description->step.y, params[4]);
1803
1804 break;
1805 case EDJE_STATE_PARAM_ASPECT:
1806 CHKPARAM(4);
1807
1808 GETFLOAT_T(rp->custom->description->aspect.min, params[3]);
1809 GETFLOAT_T(rp->custom->description->aspect.max, params[4]);
1810
1811 break;
1812 case EDJE_STATE_PARAM_ASPECT_PREF:
1813 CHKPARAM(3);
1814
1815 GETINT(rp->custom->description->aspect.prefer, params[3]);
1816
1817 break;
1818 case EDJE_STATE_PARAM_COLOR:
1819 CHKPARAM(6);
1820
1821 GETINT(rp->custom->description->color.r, params[3]);
1822 GETINT(rp->custom->description->color.g, params[4]);
1823 GETINT(rp->custom->description->color.b, params[5]);
1824 GETINT(rp->custom->description->color.a, params[6]);
1825
1826 break;
1827 case EDJE_STATE_PARAM_COLOR2:
1828 CHKPARAM(6);
1829
1830 GETINT(rp->custom->description->color2.r, params[3]);
1831 GETINT(rp->custom->description->color2.g, params[4]);
1832 GETINT(rp->custom->description->color2.b, params[5]);
1833 GETINT(rp->custom->description->color2.a, params[6]);
1834
1835 break;
1836 case EDJE_STATE_PARAM_COLOR3:
1837 {
1838 Edje_Part_Description_Text *text;
1839
1840 if ( (rp->part->type != EDJE_PART_TYPE_TEXT) &&
1841 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
1842 return 0;
1843
1844 CHKPARAM(6);
1845
1846 text = (Edje_Part_Description_Text*) rp->custom->description;
1847
1848 GETINT(text->text.color3.r, params[3]);
1849 GETINT(text->text.color3.g, params[4]);
1850 GETINT(text->text.color3.b, params[5]);
1851 GETINT(text->text.color3.a, params[6]);
1852 break;
1853 }
1854 case EDJE_STATE_PARAM_COLOR_CLASS:
1855 CHKPARAM(3);
1856
1857 GETSTR(s, params[3]);
1858 GETSTREVAS(s, rp->custom->description->color_class);
1859
1860 break;
1861 case EDJE_STATE_PARAM_REL1:
1862 CHKPARAM(4);
1863
1864 GETFLOAT_T(rp->custom->description->rel1.relative_x, params[3]);
1865 GETFLOAT_T(rp->custom->description->rel1.relative_y, params[4]);
1866
1867 break;
1868 case EDJE_STATE_PARAM_REL1_TO:
1869 CHKPARAM(4);
1870
1871 GETINT(rp->custom->description->rel1.id_x, params[3]);
1872 GETINT(rp->custom->description->rel1.id_y, params[4]);
1873
1874 if (rp->param1.description->rel1.id_x >= 0)
1875 rp->param1.rel1_to_x = ed->table_parts[rp->param1.description->rel1.id_x % ed->table_parts_size];
1876 if (rp->param1.description->rel1.id_y >= 0)
1877 rp->param1.rel1_to_y = ed->table_parts[rp->param1.description->rel1.id_y % ed->table_parts_size];
1878
1879 break;
1880 case EDJE_STATE_PARAM_REL1_OFFSET:
1881 CHKPARAM(4);
1882
1883 GETINT(rp->custom->description->rel1.offset_x, params[3]);
1884 GETINT(rp->custom->description->rel1.offset_y, params[4]);
1885
1886 break;
1887 case EDJE_STATE_PARAM_REL2:
1888 CHKPARAM(4);
1889
1890 GETFLOAT_T(rp->custom->description->rel2.relative_x, params[3]);
1891 GETFLOAT_T(rp->custom->description->rel2.relative_y, params[4]);
1892
1893 break;
1894 case EDJE_STATE_PARAM_REL2_TO:
1895 CHKPARAM(4);
1896
1897 GETINT(rp->custom->description->rel2.id_x, params[3]);
1898 GETINT(rp->custom->description->rel2.id_y, params[4]);
1899
1900 if (rp->param1.description->rel2.id_x >= 0)
1901 rp->param1.rel2_to_x = ed->table_parts[rp->param1.description->rel2.id_x % ed->table_parts_size];
1902 if (rp->param1.description->rel2.id_y >= 0)
1903 rp->param1.rel2_to_y = ed->table_parts[rp->param1.description->rel2.id_y % ed->table_parts_size];
1904
1905 break;
1906 case EDJE_STATE_PARAM_REL2_OFFSET:
1907 CHKPARAM(4);
1908
1909 GETINT(rp->custom->description->rel2.offset_x, params[3]);
1910 GETINT(rp->custom->description->rel2.offset_y, params[4]);
1911
1912 break;
1913 case EDJE_STATE_PARAM_IMAGE:
1914 {
1915 Edje_Part_Description_Image *img;
1916
1917 if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
1918 CHKPARAM(3);
1919
1920 img = (Edje_Part_Description_Image*) rp->custom->description;
1921 GETINT(img->image.id, params[3]);
1922
1923 break;
1924 }
1925 case EDJE_STATE_PARAM_BORDER:
1926 {
1927 Edje_Part_Description_Image *img;
1928
1929 if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
1930 CHKPARAM(6);
1931
1932 img = (Edje_Part_Description_Image*) rp->custom->description;
1933
1934 GETINT(img->image.border.l, params[3]);
1935 GETINT(img->image.border.r, params[4]);
1936 GETINT(img->image.border.t, params[5]);
1937 GETINT(img->image.border.b, params[6]);
1938
1939 break;
1940 }
1941 case EDJE_STATE_PARAM_FILL_SMOOTH:
1942 {
1943 Edje_Part_Description_Image *img;
1944
1945 if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
1946 CHKPARAM(3);
1947
1948 img = (Edje_Part_Description_Image*) rp->custom->description;
1949
1950 GETINT(img->image.fill.smooth, params[3]);
1951
1952 break;
1953 }
1954 case EDJE_STATE_PARAM_FILL_POS:
1955 {
1956 Edje_Part_Description_Image *img;
1957
1958 if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
1959 CHKPARAM(6);
1960
1961 img = (Edje_Part_Description_Image*) rp->custom->description;
1962
1963 GETFLOAT_T(img->image.fill.pos_rel_x, params[3]);
1964 GETFLOAT_T(img->image.fill.pos_rel_y, params[4]);
1965 GETINT(img->image.fill.pos_abs_x, params[5]);
1966 GETINT(img->image.fill.pos_abs_y, params[6]);
1967
1968 break;
1969 }
1970 case EDJE_STATE_PARAM_FILL_SIZE:
1971 {
1972 Edje_Part_Description_Image *img;
1973
1974 if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
1975 CHKPARAM(6);
1976
1977 img = (Edje_Part_Description_Image*) rp->custom->description;
1978
1979 GETFLOAT_T(img->image.fill.rel_x, params[3]);
1980 GETFLOAT_T(img->image.fill.rel_y, params[4]);
1981 GETINT(img->image.fill.abs_x, params[5]);
1982 GETINT(img->image.fill.abs_y, params[6]);
1983
1984 break;
1985 }
1986 case EDJE_STATE_PARAM_TEXT:
1987 {
1988 Edje_Part_Description_Text *text;
1989
1990 if ( (rp->part->type != EDJE_PART_TYPE_TEXT) &&
1991 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
1992 return 0;
1993 CHKPARAM(3);
1994
1995 GETSTR(s, params[3]);
1996
1997 text = (Edje_Part_Description_Text*) rp->custom->description;
1998 GETSTREVAS(s, text->text.text.str);
1999
2000 break;
2001 }
2002 case EDJE_STATE_PARAM_TEXT_CLASS:
2003 {
2004 Edje_Part_Description_Text *text;
2005
2006 if ( (rp->part->type != EDJE_PART_TYPE_TEXT) &&
2007 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
2008 return 0;
2009 CHKPARAM(3);
2010
2011 GETSTR(s, params[3]);
2012
2013 text = (Edje_Part_Description_Text*) rp->custom->description;
2014 GETSTREVAS(s, text->text.text_class);
2015
2016 break;
2017 }
2018 case EDJE_STATE_PARAM_TEXT_FONT:
2019 {
2020 Edje_Part_Description_Text *text;
2021
2022 if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
2023 CHKPARAM(3);
2024
2025 GETSTR(s, params[3]);
2026
2027 text = (Edje_Part_Description_Text*) rp->custom->description;
2028 GETSTREVAS(s, text->text.font.str);
2029
2030 break;
2031 }
2032 case EDJE_STATE_PARAM_TEXT_STYLE:
2033 {
2034 Edje_Part_Description_Text *text;
2035
2036 if ((rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return 0;
2037 CHKPARAM(3);
2038
2039 GETSTR(s, params[3]);
2040
2041 text = (Edje_Part_Description_Text*) rp->custom->description;
2042 GETSTREVAS(s, text->text.style.str);
2043
2044 break;
2045 }
2046 case EDJE_STATE_PARAM_TEXT_SIZE:
2047 {
2048 Edje_Part_Description_Text *text;
2049
2050 if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
2051 CHKPARAM(3);
2052
2053 text = (Edje_Part_Description_Text*) rp->custom->description;
2054 GETINT(text->text.size, params[3]);
2055
2056 break;
2057 }
2058 case EDJE_STATE_PARAM_TEXT_FIT:
2059 {
2060 Edje_Part_Description_Text *text;
2061
2062 if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
2063 CHKPARAM(4);
2064
2065 text = (Edje_Part_Description_Text*) rp->custom->description;
2066
2067 GETINT(text->text.fit_x, params[3]);
2068 GETINT(text->text.fit_y, params[4]);
2069
2070 break;
2071 }
2072 case EDJE_STATE_PARAM_TEXT_MIN:
2073 {
2074 Edje_Part_Description_Text *text;
2075
2076 if ( (rp->part->type != EDJE_PART_TYPE_TEXT) &&
2077 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
2078 return 0;
2079 CHKPARAM(4);
2080
2081 text = (Edje_Part_Description_Text*) rp->custom->description;
2082
2083 GETINT(text->text.min_x, params[3]);
2084 GETINT(text->text.min_y, params[4]);
2085
2086 break;
2087 }
2088 case EDJE_STATE_PARAM_TEXT_MAX:
2089 {
2090 Edje_Part_Description_Text *text;
2091
2092 if ( (rp->part->type != EDJE_PART_TYPE_TEXT) &&
2093 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
2094 return 0;
2095 CHKPARAM(4);
2096
2097 text = (Edje_Part_Description_Text*) rp->custom->description;
2098
2099 GETINT(text->text.max_x, params[3]);
2100 GETINT(text->text.max_y, params[4]);
2101
2102 break;
2103 }
2104 case EDJE_STATE_PARAM_TEXT_ALIGN:
2105 {
2106 Edje_Part_Description_Text *text;
2107
2108 if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
2109 CHKPARAM(4);
2110
2111 text = (Edje_Part_Description_Text*) rp->custom->description;
2112
2113 GETFLOAT_T(text->text.align.x, params[3]);
2114 GETFLOAT_T(text->text.align.y, params[4]);
2115
2116 break;
2117 }
2118 case EDJE_STATE_PARAM_VISIBLE:
2119 CHKPARAM(3);
2120
2121 GETINT(rp->custom->description->visible, params[3]);
2122
2123 break;
2124 case EDJE_STATE_PARAM_MAP_OM:
2125 CHKPARAM(3);
2126
2127 GETINT(rp->custom->description->map.on, params[3]);
2128
2129 break;
2130 case EDJE_STATE_PARAM_MAP_PERSP:
2131 CHKPARAM(3);
2132
2133 GETINT(rp->custom->description->map.id_persp, params[3]);
2134
2135 break;
2136 case EDJE_STATE_PARAM_MAP_LIGNT:
2137 CHKPARAM(3);
2138
2139 GETINT(rp->custom->description->map.id_light, params[3]);
2140
2141 break;
2142 case EDJE_STATE_PARAM_MAP_ROT_CENTER:
2143 CHKPARAM(3);
2144
2145 GETINT(rp->custom->description->map.rot.id_center, params[3]);
2146
2147 break;
2148 case EDJE_STATE_PARAM_MAP_ROT_X:
2149 CHKPARAM(3);
2150
2151 GETFLOAT_T(rp->custom->description->map.rot.x, params[3]);
2152
2153 break;
2154 case EDJE_STATE_PARAM_MAP_ROT_Y:
2155 CHKPARAM(3);
2156
2157 GETFLOAT_T(rp->custom->description->map.rot.y, params[3]);
2158
2159 break;
2160 case EDJE_STATE_PARAM_MAP_ROT_Z:
2161 CHKPARAM(3);
2162
2163 GETFLOAT_T(rp->custom->description->map.rot.z, params[3]);
2164
2165 break;
2166 case EDJE_STATE_PARAM_MAP_BACK_CULL:
2167 CHKPARAM(3);
2168
2169 GETINT(rp->custom->description->map.backcull, params[3]);
2170
2171 break;
2172 case EDJE_STATE_PARAM_MAP_PERSP_ON:
2173 CHKPARAM(3);
2174
2175 GETINT(rp->custom->description->map.persp_on, params[3]);
2176
2177 break;
2178 case EDJE_STATE_PARAM_PERSP_ZPLANE:
2179 CHKPARAM(3);
2180
2181 GETINT(rp->custom->description->persp.zplane, params[3]);
2182
2183 break;
2184 case EDJE_STATE_PARAM_PERSP_FOCAL:
2185 CHKPARAM(3);
2186
2187 GETINT(rp->custom->description->persp.focal, params[3]);
2188
2189 break;
2190 default:
2191 break;
2192 }
2193
2194#ifdef EDJE_CALC_CACHE
2195 rp->invalidate = 1;
2196#endif
2197 ed->dirty=1;
2198 return 0;
2199}
2200
2201/* get_state_val(part_id, State_Param:p, ...) */
2202static Embryo_Cell
2203_edje_embryo_fn_get_state_val(Embryo_Program *ep, Embryo_Cell *params)
2204{
2205 Edje *ed = embryo_program_data_get(ep);
2206 Edje_Real_Part *rp;
2207 char *s;
2208
2209 /* we need at least 3 arguments */
2210 if (params[0] < (int) (sizeof(Embryo_Cell) * 3))
2211 return 0;
2212
2213 if (params[1] < 0)
2214 return 0;
2215
2216 if (!(rp = ed->table_parts[params[1] % ed->table_parts_size]))
2217 return 0;
2218
2219 /* check whether this part has a "custom" state */
2220 if (!rp->custom)
2221 return 0;
2222
2223 switch (params[2])
2224 {
2225 case EDJE_STATE_PARAM_ALIGNMENT:
2226 CHKPARAM(4);
2227
2228 SETFLOAT_T(rp->custom->description->align.x, params[3]);
2229 SETFLOAT_T(rp->custom->description->align.y, params[4]);
2230
2231 break;
2232 case EDJE_STATE_PARAM_MIN:
2233 CHKPARAM(4);
2234
2235 SETINT(rp->custom->description->min.w, params[3]);
2236 SETINT(rp->custom->description->min.h, params[4]);
2237
2238 break;
2239 case EDJE_STATE_PARAM_MAX:
2240 CHKPARAM(4);
2241
2242 SETINT(rp->custom->description->max.w, params[3]);
2243 SETINT(rp->custom->description->max.h, params[4]);
2244
2245 break;
2246 case EDJE_STATE_PARAM_STEP:
2247 CHKPARAM(4);
2248
2249 SETINT(rp->custom->description->step.x, params[3]);
2250 SETINT(rp->custom->description->step.y, params[4]);
2251
2252 break;
2253 case EDJE_STATE_PARAM_ASPECT:
2254 CHKPARAM(4);
2255
2256 SETFLOAT_T(rp->custom->description->aspect.min, params[3]);
2257 SETFLOAT_T(rp->custom->description->aspect.max, params[4]);
2258
2259 break;
2260 case EDJE_STATE_PARAM_ASPECT_PREF:
2261 CHKPARAM(3);
2262
2263 SETINT(rp->custom->description->aspect.prefer, params[3]);
2264
2265 break;
2266 case EDJE_STATE_PARAM_COLOR:
2267 CHKPARAM(6);
2268
2269 SETINT(rp->custom->description->color.r, params[3]);
2270 SETINT(rp->custom->description->color.g, params[4]);
2271 SETINT(rp->custom->description->color.b, params[5]);
2272 SETINT(rp->custom->description->color.a, params[6]);
2273
2274 break;
2275 case EDJE_STATE_PARAM_COLOR2:
2276 CHKPARAM(6);
2277
2278 SETINT(rp->custom->description->color2.r, params[3]);
2279 SETINT(rp->custom->description->color2.g, params[4]);
2280 SETINT(rp->custom->description->color2.b, params[5]);
2281 SETINT(rp->custom->description->color2.a, params[6]);
2282
2283 break;
2284 case EDJE_STATE_PARAM_COLOR3:
2285 {
2286 Edje_Part_Description_Text *text;
2287
2288 if (rp->part->type == EDJE_PART_TYPE_TEXT
2289 || rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
2290 return 0;
2291
2292 CHKPARAM(6);
2293
2294 text = (Edje_Part_Description_Text*) rp->custom->description;
2295
2296 SETINT(text->text.color3.r, params[3]);
2297 SETINT(text->text.color3.g, params[4]);
2298 SETINT(text->text.color3.b, params[5]);
2299 SETINT(text->text.color3.a, params[6]);
2300
2301 break;
2302 }
2303 case EDJE_STATE_PARAM_COLOR_CLASS:
2304 CHKPARAM(4);
2305
2306 s = rp->custom->description->color_class;
2307 SETSTRALLOCATE(s);
2308
2309 break;
2310 case EDJE_STATE_PARAM_REL1:
2311 CHKPARAM(4);
2312
2313 SETFLOAT_T(rp->custom->description->rel1.relative_x, params[3]);
2314 SETFLOAT_T(rp->custom->description->rel1.relative_y, params[4]);
2315
2316 break;
2317 case EDJE_STATE_PARAM_REL1_TO:
2318 CHKPARAM(4);
2319
2320 SETINT(rp->custom->description->rel1.id_x, params[3]);
2321 SETINT(rp->custom->description->rel1.id_y, params[4]);
2322
2323 break;
2324 case EDJE_STATE_PARAM_REL1_OFFSET:
2325 CHKPARAM(4);
2326
2327 SETINT(rp->custom->description->rel1.offset_x, params[3]);
2328 SETINT(rp->custom->description->rel1.offset_y, params[4]);
2329
2330 break;
2331 case EDJE_STATE_PARAM_REL2:
2332 CHKPARAM(4);
2333
2334 SETFLOAT_T(rp->custom->description->rel2.relative_x, params[3]);
2335 SETFLOAT_T(rp->custom->description->rel2.relative_y, params[4]);
2336
2337 break;
2338 case EDJE_STATE_PARAM_REL2_TO:
2339 CHKPARAM(4);
2340
2341 SETINT(rp->custom->description->rel2.id_x, params[3]);
2342 SETINT(rp->custom->description->rel2.id_y, params[4]);
2343
2344 break;
2345 case EDJE_STATE_PARAM_REL2_OFFSET:
2346 CHKPARAM(4);
2347
2348 SETINT(rp->custom->description->rel2.offset_x, params[3]);
2349 SETINT(rp->custom->description->rel2.offset_y, params[4]);
2350
2351 break;
2352 case EDJE_STATE_PARAM_IMAGE:
2353 {
2354 Edje_Part_Description_Image *img;
2355
2356 if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
2357 CHKPARAM(3);
2358
2359 img = (Edje_Part_Description_Image*) rp->custom->description;
2360
2361 SETINT(img->image.id, params[3]);
2362
2363 break;
2364 }
2365 case EDJE_STATE_PARAM_BORDER:
2366 {
2367 Edje_Part_Description_Image *img;
2368
2369 if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
2370 CHKPARAM(6);
2371
2372 img = (Edje_Part_Description_Image*) rp->custom->description;
2373
2374 SETINT(img->image.border.l, params[3]);
2375 SETINT(img->image.border.r, params[4]);
2376 SETINT(img->image.border.t, params[5]);
2377 SETINT(img->image.border.b, params[6]);
2378
2379 break;
2380 }
2381 case EDJE_STATE_PARAM_FILL_SMOOTH:
2382 {
2383 Edje_Part_Description_Image *img;
2384
2385 if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
2386 CHKPARAM(3);
2387
2388 img = (Edje_Part_Description_Image*) rp->custom->description;
2389
2390 SETINT(img->image.fill.smooth, params[3]);
2391
2392 break;
2393 }
2394 case EDJE_STATE_PARAM_FILL_POS:
2395 {
2396 Edje_Part_Description_Image *img;
2397
2398 if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
2399 CHKPARAM(6);
2400
2401 img = (Edje_Part_Description_Image*) rp->custom->description;
2402
2403 SETFLOAT_T(img->image.fill.pos_rel_x, params[3]);
2404 SETFLOAT_T(img->image.fill.pos_rel_y, params[4]);
2405 SETINT(img->image.fill.pos_abs_x, params[5]);
2406 SETINT(img->image.fill.pos_abs_y, params[6]);
2407
2408 break;
2409 }
2410 case EDJE_STATE_PARAM_FILL_SIZE:
2411 {
2412 Edje_Part_Description_Image *img;
2413
2414 if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
2415 CHKPARAM(6);
2416
2417 img = (Edje_Part_Description_Image*) rp->custom->description;
2418
2419 SETFLOAT_T(img->image.fill.rel_x, params[3]);
2420 SETFLOAT_T(img->image.fill.rel_y, params[4]);
2421 SETINT(img->image.fill.abs_x, params[5]);
2422 SETINT(img->image.fill.abs_y, params[6]);
2423
2424 break;
2425 }
2426 case EDJE_STATE_PARAM_TEXT:
2427 {
2428 Edje_Part_Description_Text *text;
2429
2430 if (rp->part->type == EDJE_PART_TYPE_TEXT
2431 || rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
2432 return 0;
2433
2434 CHKPARAM(4);
2435
2436 text = (Edje_Part_Description_Text*) rp->custom->description;
2437
2438 s = (char *)text->text.text.str;
2439 SETSTRALLOCATE(s);
2440
2441 break;
2442 }
2443 case EDJE_STATE_PARAM_TEXT_CLASS:
2444 {
2445 Edje_Part_Description_Text *text;
2446
2447 if ( (rp->part->type != EDJE_PART_TYPE_TEXT) &&
2448 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
2449 return 0;
2450
2451 CHKPARAM(4);
2452
2453 text = (Edje_Part_Description_Text*) rp->custom->description;
2454
2455 s = text->text.text_class;
2456 SETSTRALLOCATE(s);
2457
2458 break;
2459 }
2460 case EDJE_STATE_PARAM_TEXT_FONT:
2461 {
2462 Edje_Part_Description_Text *text;
2463
2464 if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
2465
2466 CHKPARAM(4);
2467
2468 text = (Edje_Part_Description_Text*) rp->custom->description;
2469
2470 s = (char *)text->text.font.str;
2471 SETSTRALLOCATE(s);
2472
2473 break;
2474 }
2475 case EDJE_STATE_PARAM_TEXT_STYLE:
2476 {
2477 Edje_Part_Description_Text *text;
2478
2479 if ((rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return 0;
2480
2481 CHKPARAM(4);
2482
2483 text = (Edje_Part_Description_Text*) rp->custom->description;
2484
2485 s = (char *)text->text.style.str;
2486 SETSTRALLOCATE(s);
2487
2488 break;
2489 }
2490 case EDJE_STATE_PARAM_TEXT_SIZE:
2491 {
2492 Edje_Part_Description_Text *text;
2493
2494 if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
2495
2496 CHKPARAM(3);
2497
2498 text = (Edje_Part_Description_Text*) rp->custom->description;
2499
2500 SETINT(text->text.size, params[3]);
2501
2502 break;
2503 }
2504 case EDJE_STATE_PARAM_TEXT_FIT:
2505 {
2506 Edje_Part_Description_Text *text;
2507
2508 if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
2509 CHKPARAM(4);
2510
2511 text = (Edje_Part_Description_Text*) rp->custom->description;
2512
2513 SETINT(text->text.fit_x, params[3]);
2514 SETINT(text->text.fit_y, params[4]);
2515
2516 break;
2517 }
2518 case EDJE_STATE_PARAM_TEXT_MIN:
2519 {
2520 Edje_Part_Description_Text *text;
2521
2522 if ( (rp->part->type != EDJE_PART_TYPE_TEXT) &&
2523 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
2524 return 0;
2525
2526 CHKPARAM(4);
2527
2528 text = (Edje_Part_Description_Text*) rp->custom->description;
2529
2530 SETINT(text->text.min_x, params[3]);
2531 SETINT(text->text.min_y, params[4]);
2532
2533 break;
2534 }
2535 case EDJE_STATE_PARAM_TEXT_MAX:
2536 {
2537 Edje_Part_Description_Text *text;
2538
2539 if ( (rp->part->type != EDJE_PART_TYPE_TEXT) &&
2540 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
2541 return 0;
2542
2543 CHKPARAM(4);
2544
2545 text = (Edje_Part_Description_Text*) rp->custom->description;
2546
2547 SETINT(text->text.max_x, params[3]);
2548 SETINT(text->text.max_y, params[4]);
2549
2550 break;
2551 }
2552 case EDJE_STATE_PARAM_TEXT_ALIGN:
2553 {
2554 Edje_Part_Description_Text *text;
2555
2556 if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
2557
2558 CHKPARAM(4);
2559
2560 text = (Edje_Part_Description_Text*) rp->custom->description;
2561
2562 SETFLOAT_T(text->text.align.x, params[3]);
2563 SETFLOAT_T(text->text.align.y, params[4]);
2564
2565 break;
2566 }
2567 case EDJE_STATE_PARAM_VISIBLE:
2568 CHKPARAM(3);
2569
2570 SETINT(rp->custom->description->visible, params[3]);
2571
2572 break;
2573 default:
2574 break;
2575 }
2576
2577 return 0;
2578}
2579
2580/* part_swallow(part_id, group_name) */
2581static Embryo_Cell
2582_edje_embryo_fn_part_swallow(Embryo_Program *ep, Embryo_Cell *params)
2583{
2584 int part_id = 0;
2585 char* group_name = 0;
2586 Edje *ed;
2587 Edje_Real_Part *rp;
2588 Evas_Object *new_obj;
2589
2590 CHKPARAM(2);
2591
2592 part_id = params[1];
2593 if (part_id < 0) return 0;
2594
2595 GETSTR(group_name, params[2]);
2596 if (!group_name) return 0;
2597
2598 ed = embryo_program_data_get(ep);
2599
2600 rp = ed->table_parts[part_id % ed->table_parts_size];
2601 if (!rp) return 0;
2602
2603 new_obj = edje_object_add(ed->base.evas);
2604 if (!new_obj) return 0;
2605
2606 if (!edje_object_file_set(new_obj, ed->file->path, group_name))
2607 {
2608 evas_object_del(new_obj);
2609 return 0;
2610 }
2611 edje_object_part_swallow(ed->obj, rp->part->name, new_obj);
2612 _edje_subobj_register(ed, new_obj);
2613
2614 return 0;
2615}
2616
2617/* external_param_get_int(id, param_name[]) */
2618static Embryo_Cell
2619_edje_embryo_fn_external_param_get_int(Embryo_Program *ep, Embryo_Cell *params)
2620{
2621 Edje *ed;
2622 int part_id;
2623 Edje_Real_Part *rp;
2624 Edje_External_Param eep;
2625 char *param_name;
2626
2627 CHKPARAM(2);
2628 ed = embryo_program_data_get(ep);
2629
2630 part_id = params[1];
2631 if (part_id < 0) return 0;
2632 rp = ed->table_parts[part_id % ed->table_parts_size];
2633
2634 GETSTR(param_name, params[2]);
2635 if (!param_name) return 0;
2636 eep.name = param_name;
2637 eep.type = EDJE_EXTERNAL_PARAM_TYPE_INT;
2638 eep.i = 0;
2639 _edje_external_param_get(NULL, rp, &eep);
2640 return eep.i;
2641}
2642
2643/* external_param_set_int(id, param_name[], val) */
2644static Embryo_Cell
2645_edje_embryo_fn_external_param_set_int(Embryo_Program *ep, Embryo_Cell *params)
2646{
2647 Edje *ed;
2648 int part_id;
2649 Edje_Real_Part *rp;
2650 Edje_External_Param eep;
2651 char *param_name;
2652
2653 CHKPARAM(3);
2654 ed = embryo_program_data_get(ep);
2655
2656 part_id = params[1];
2657 if (part_id < 0) return 0;
2658 rp = ed->table_parts[part_id % ed->table_parts_size];
2659
2660 GETSTR(param_name, params[2]);
2661 if (!param_name) return 0;
2662 eep.name = param_name;
2663 eep.type = EDJE_EXTERNAL_PARAM_TYPE_INT;
2664 eep.i = params[3];
2665 return _edje_external_param_set(NULL, rp, &eep);
2666}
2667
2668/* Float:external_param_get_float(id, param_name[]) */
2669static Embryo_Cell
2670_edje_embryo_fn_external_param_get_float(Embryo_Program *ep, Embryo_Cell *params)
2671{
2672 Edje *ed;
2673 int part_id;
2674 Edje_Real_Part *rp;
2675 Edje_External_Param eep;
2676 char *param_name;
2677 float v;
2678
2679 CHKPARAM(2);
2680 ed = embryo_program_data_get(ep);
2681
2682 part_id = params[1];
2683 if (part_id < 0) return 0;
2684 rp = ed->table_parts[part_id % ed->table_parts_size];
2685
2686 GETSTR(param_name, params[2]);
2687 if (!param_name) return 0;
2688 eep.name = param_name;
2689 eep.type = EDJE_EXTERNAL_PARAM_TYPE_DOUBLE;
2690 eep.d = 0.0;
2691 _edje_external_param_get(NULL, rp, &eep);
2692 v = eep.d;
2693 return EMBRYO_FLOAT_TO_CELL(v);
2694}
2695
2696/* external_param_set_float(id, param_name[], Float:val) */
2697static Embryo_Cell
2698_edje_embryo_fn_external_param_set_float(Embryo_Program *ep, Embryo_Cell *params)
2699{
2700 Edje *ed;
2701 int part_id;
2702 Edje_Real_Part *rp;
2703 Edje_External_Param eep;
2704 char *param_name;
2705
2706 CHKPARAM(3);
2707 ed = embryo_program_data_get(ep);
2708
2709 part_id = params[1];
2710 if (part_id < 0) return 0;
2711 rp = ed->table_parts[part_id % ed->table_parts_size];
2712
2713 GETSTR(param_name, params[2]);
2714 if (!param_name) return 0;
2715 eep.name = param_name;
2716 eep.type = EDJE_EXTERNAL_PARAM_TYPE_DOUBLE;
2717 eep.d = EMBRYO_CELL_TO_FLOAT(params[3]);
2718 return _edje_external_param_set(NULL, rp, &eep);
2719}
2720
2721/* external_param_get_strlen(id, param_name[]) */
2722static Embryo_Cell
2723_edje_embryo_fn_external_param_get_strlen(Embryo_Program *ep, Embryo_Cell *params)
2724{
2725 Edje *ed;
2726 int part_id;
2727 Edje_Real_Part *rp;
2728 Edje_External_Param eep;
2729 char *param_name;
2730
2731 CHKPARAM(2);
2732 ed = embryo_program_data_get(ep);
2733
2734 part_id = params[1];
2735 if (part_id < 0) return 0;
2736 rp = ed->table_parts[part_id % ed->table_parts_size];
2737
2738 GETSTR(param_name, params[2]);
2739 if (!param_name) return 0;
2740 eep.name = param_name;
2741 eep.type = EDJE_EXTERNAL_PARAM_TYPE_STRING;
2742 eep.s = NULL;
2743 _edje_external_param_get(NULL, rp, &eep);
2744 if (!eep.s) return 0;
2745 return strlen(eep.s);
2746}
2747
2748/* external_param_get_str(id, param_name[], val[], val_maxlen) */
2749static Embryo_Cell
2750_edje_embryo_fn_external_param_get_str(Embryo_Program *ep, Embryo_Cell *params)
2751{
2752 Edje *ed;
2753 int part_id;
2754 Edje_Real_Part *rp;
2755 Edje_External_Param eep;
2756 char *param_name;
2757 size_t src_len, dst_len;
2758
2759 CHKPARAM(4);
2760 dst_len = params[4];
2761 if (dst_len < 1) goto error;
2762
2763 ed = embryo_program_data_get(ep);
2764
2765 part_id = params[1];
2766 if (part_id < 0) goto error;
2767 rp = ed->table_parts[part_id % ed->table_parts_size];
2768
2769 GETSTR(param_name, params[2]);
2770 if (!param_name) return 0;
2771 eep.name = param_name;
2772 eep.type = EDJE_EXTERNAL_PARAM_TYPE_STRING;
2773 eep.s = NULL;
2774 _edje_external_param_get(NULL, rp, &eep);
2775 if (!eep.s) goto error;
2776 src_len = strlen(eep.s);
2777 if (src_len < dst_len)
2778 {
2779 SETSTR(eep.s, params[3]);
2780 }
2781 else
2782 {
2783 char *tmp = alloca(dst_len);
2784 memcpy(tmp, eep.s, dst_len - 1);
2785 tmp[dst_len] = '\0';
2786 SETSTR(tmp, params[3]);
2787 }
2788 return 1;
2789
2790 error:
2791 SETSTR("", params[3]);
2792 return 0;
2793}
2794
2795/* external_param_set_str(id, param_name[], val[]) */
2796static Embryo_Cell
2797_edje_embryo_fn_external_param_set_str(Embryo_Program *ep, Embryo_Cell *params)
2798{
2799 Edje *ed;
2800 int part_id;
2801 Edje_Real_Part *rp;
2802 Edje_External_Param eep;
2803 char *param_name, *val;
2804
2805 CHKPARAM(3);
2806 ed = embryo_program_data_get(ep);
2807
2808 part_id = params[1];
2809 if (part_id < 0) return 0;
2810 rp = ed->table_parts[part_id % ed->table_parts_size];
2811
2812 GETSTR(param_name, params[2]);
2813 if (!param_name) return 0;
2814 eep.name = param_name;
2815 eep.type = EDJE_EXTERNAL_PARAM_TYPE_STRING;
2816 GETSTR(val, params[3]);
2817 if (!val) return 0;
2818 eep.s = val;
2819 return _edje_external_param_set(NULL, rp, &eep);
2820}
2821
2822/* external_param_get_choice_len(id, param_name[]) */
2823static Embryo_Cell
2824_edje_embryo_fn_external_param_get_choice_len(Embryo_Program *ep, Embryo_Cell *params)
2825{
2826 Edje *ed;
2827 int part_id;
2828 Edje_Real_Part *rp;
2829 Edje_External_Param eep;
2830 char *param_name;
2831
2832 CHKPARAM(2);
2833 ed = embryo_program_data_get(ep);
2834
2835 part_id = params[1];
2836 if (part_id < 0) return 0;
2837 rp = ed->table_parts[part_id % ed->table_parts_size];
2838
2839 GETSTR(param_name, params[2]);
2840 if (!param_name) return 0;
2841 eep.name = param_name;
2842 eep.type = EDJE_EXTERNAL_PARAM_TYPE_CHOICE;
2843 eep.s = NULL;
2844 _edje_external_param_get(NULL, rp, &eep);
2845 if (!eep.s) return 0;
2846 return strlen(eep.s);
2847}
2848
2849/* external_param_get_choice(id, param_name[], val[], val_maxlen) */
2850static Embryo_Cell
2851_edje_embryo_fn_external_param_get_choice(Embryo_Program *ep, Embryo_Cell *params)
2852{
2853 Edje *ed;
2854 int part_id;
2855 Edje_Real_Part *rp;
2856 Edje_External_Param eep;
2857 char *param_name;
2858 size_t src_len, dst_len;
2859
2860 CHKPARAM(4);
2861 dst_len = params[4];
2862 if (dst_len < 1) goto error;
2863
2864 ed = embryo_program_data_get(ep);
2865
2866 part_id = params[1];
2867 if (part_id < 0) goto error;
2868 rp = ed->table_parts[part_id % ed->table_parts_size];
2869
2870 GETSTR(param_name, params[2]);
2871 if (!param_name) return 0;
2872 eep.name = param_name;
2873 eep.type = EDJE_EXTERNAL_PARAM_TYPE_CHOICE;
2874 eep.s = NULL;
2875 _edje_external_param_get(NULL, rp, &eep);
2876 if (!eep.s) goto error;
2877 src_len = strlen(eep.s);
2878 if (src_len < dst_len)
2879 {
2880 SETSTR(eep.s, params[3]);
2881 }
2882 else
2883 {
2884 char *tmp = alloca(dst_len);
2885 memcpy(tmp, eep.s, dst_len - 1);
2886 tmp[dst_len] = '\0';
2887 SETSTR(tmp, params[3]);
2888 }
2889 return 1;
2890
2891 error:
2892 SETSTR("", params[3]);
2893 return 0;
2894}
2895
2896/* external_param_set_choice(id, param_name[], val[]) */
2897static Embryo_Cell
2898_edje_embryo_fn_external_param_set_choice(Embryo_Program *ep, Embryo_Cell *params)
2899{
2900 Edje *ed;
2901 int part_id;
2902 Edje_Real_Part *rp;
2903 Edje_External_Param eep;
2904 char *param_name, *val;
2905
2906 CHKPARAM(3);
2907 ed = embryo_program_data_get(ep);
2908
2909 part_id = params[1];
2910 if (part_id < 0) return 0;
2911 rp = ed->table_parts[part_id % ed->table_parts_size];
2912
2913 GETSTR(param_name, params[2]);
2914 if (!param_name) return 0;
2915 eep.name = param_name;
2916 eep.type = EDJE_EXTERNAL_PARAM_TYPE_CHOICE;
2917 GETSTR(val, params[3]);
2918 if (!val) return 0;
2919 eep.s = val;
2920 return _edje_external_param_set(NULL, rp, &eep);
2921}
2922
2923/* external_param_get_bool(id, param_name[]) */
2924static Embryo_Cell
2925_edje_embryo_fn_external_param_get_bool(Embryo_Program *ep, Embryo_Cell *params)
2926{
2927 Edje *ed;
2928 int part_id;
2929 Edje_Real_Part *rp;
2930 Edje_External_Param eep;
2931 char *param_name;
2932
2933 CHKPARAM(2);
2934 ed = embryo_program_data_get(ep);
2935
2936 part_id = params[1];
2937 if (part_id < 0) return 0;
2938 rp = ed->table_parts[part_id % ed->table_parts_size];
2939
2940 GETSTR(param_name, params[2]);
2941 if (!param_name) return 0;
2942 eep.name = param_name;
2943 eep.type = EDJE_EXTERNAL_PARAM_TYPE_BOOL;
2944 eep.i = 0;
2945 _edje_external_param_get(NULL, rp, &eep);
2946 return eep.i;
2947}
2948
2949/* external_param_set_bool(id, param_name[], val) */
2950static Embryo_Cell
2951_edje_embryo_fn_external_param_set_bool(Embryo_Program *ep, Embryo_Cell *params)
2952{
2953 Edje *ed;
2954 int part_id;
2955 Edje_Real_Part *rp;
2956 Edje_External_Param eep;
2957 char *param_name;
2958
2959 CHKPARAM(3);
2960 ed = embryo_program_data_get(ep);
2961
2962 part_id = params[1];
2963 if (part_id < 0) return 0;
2964 rp = ed->table_parts[part_id % ed->table_parts_size];
2965
2966 GETSTR(param_name, params[2]);
2967 if (!param_name) return 0;
2968 eep.name = param_name;
2969 eep.type = EDJE_EXTERNAL_PARAM_TYPE_BOOL;
2970 eep.i = params[3];
2971 return _edje_external_param_set(NULL, rp, &eep);
2972}
2973
2974void
2975_edje_embryo_script_init(Edje_Part_Collection *edc)
2976{
2977 Embryo_Program *ep;
2978
2979 if (!edc) return;
2980 if (!edc->script) return;
2981
2982 ep = edc->script;
2983 /* first advertise all the edje "script" calls */
2984 embryo_program_native_call_add(ep, "get_int", _edje_embryo_fn_get_int);
2985 embryo_program_native_call_add(ep, "set_int", _edje_embryo_fn_set_int);
2986 embryo_program_native_call_add(ep, "get_float", _edje_embryo_fn_get_float);
2987 embryo_program_native_call_add(ep, "set_float", _edje_embryo_fn_set_float);
2988 embryo_program_native_call_add(ep, "get_str", _edje_embryo_fn_get_str);
2989 embryo_program_native_call_add(ep, "get_strlen", _edje_embryo_fn_get_strlen);
2990 embryo_program_native_call_add(ep, "set_str", _edje_embryo_fn_set_str);
2991 embryo_program_native_call_add(ep, "count", _edje_embryo_fn_count);
2992 embryo_program_native_call_add(ep, "remove", _edje_embryo_fn_remove);
2993 embryo_program_native_call_add(ep, "append_int", _edje_embryo_fn_append_int);
2994 embryo_program_native_call_add(ep, "prepend_int", _edje_embryo_fn_prepend_int);
2995 embryo_program_native_call_add(ep, "insert_int", _edje_embryo_fn_insert_int);
2996 embryo_program_native_call_add(ep, "replace_int", _edje_embryo_fn_replace_int);
2997 embryo_program_native_call_add(ep, "fetch_int", _edje_embryo_fn_fetch_int);
2998 embryo_program_native_call_add(ep, "append_str", _edje_embryo_fn_append_str);
2999 embryo_program_native_call_add(ep, "prepend_str", _edje_embryo_fn_prepend_str);
3000 embryo_program_native_call_add(ep, "insert_str", _edje_embryo_fn_insert_str);
3001 embryo_program_native_call_add(ep, "replace_str", _edje_embryo_fn_replace_str);
3002 embryo_program_native_call_add(ep, "fetch_str", _edje_embryo_fn_fetch_str);
3003 embryo_program_native_call_add(ep, "append_float", _edje_embryo_fn_append_float);
3004 embryo_program_native_call_add(ep, "prepend_float", _edje_embryo_fn_prepend_float);
3005 embryo_program_native_call_add(ep, "insert_float", _edje_embryo_fn_insert_float);
3006 embryo_program_native_call_add(ep, "replace_float", _edje_embryo_fn_replace_float);
3007 embryo_program_native_call_add(ep, "fetch_float", _edje_embryo_fn_fetch_float);
3008
3009 embryo_program_native_call_add(ep, "timer", _edje_embryo_fn_timer);
3010 embryo_program_native_call_add(ep, "cancel_timer", _edje_embryo_fn_cancel_timer);
3011
3012 embryo_program_native_call_add(ep, "anim", _edje_embryo_fn_anim);
3013 embryo_program_native_call_add(ep, "cancel_anim", _edje_embryo_fn_cancel_anim);
3014
3015 embryo_program_native_call_add(ep, "emit", _edje_embryo_fn_emit);
3016 embryo_program_native_call_add(ep, "get_part_id", _edje_embryo_fn_get_part_id);
3017 embryo_program_native_call_add(ep, "set_state", _edje_embryo_fn_set_state);
3018 embryo_program_native_call_add(ep, "get_state", _edje_embryo_fn_get_state);
3019 embryo_program_native_call_add(ep, "set_tween_state", _edje_embryo_fn_set_tween_state);
3020 embryo_program_native_call_add(ep, "run_program", _edje_embryo_fn_run_program);
3021 embryo_program_native_call_add(ep, "get_drag_dir", _edje_embryo_fn_get_drag_dir);
3022 embryo_program_native_call_add(ep, "get_drag", _edje_embryo_fn_get_drag);
3023 embryo_program_native_call_add(ep, "set_drag", _edje_embryo_fn_set_drag);
3024 embryo_program_native_call_add(ep, "get_drag_size", _edje_embryo_fn_get_drag_size);
3025 embryo_program_native_call_add(ep, "set_drag_size", _edje_embryo_fn_set_drag_size);
3026 embryo_program_native_call_add(ep, "set_text", _edje_embryo_fn_set_text);
3027 embryo_program_native_call_add(ep, "get_text", _edje_embryo_fn_get_text);
3028 embryo_program_native_call_add(ep, "get_min_size", _edje_embryo_fn_get_min_size);
3029 embryo_program_native_call_add(ep, "get_max_size", _edje_embryo_fn_get_max_size);
3030 embryo_program_native_call_add(ep, "get_color_class", _edje_embryo_fn_get_color_class);
3031 embryo_program_native_call_add(ep, "set_color_class", _edje_embryo_fn_set_color_class);
3032 embryo_program_native_call_add(ep, "set_text_class", _edje_embryo_fn_set_text_class);
3033 embryo_program_native_call_add(ep, "get_text_class", _edje_embryo_fn_get_text_class);
3034 embryo_program_native_call_add(ep, "get_drag_step", _edje_embryo_fn_get_drag_step);
3035 embryo_program_native_call_add(ep, "set_drag_step", _edje_embryo_fn_set_drag_step);
3036 embryo_program_native_call_add(ep, "get_drag_page", _edje_embryo_fn_get_drag_page);
3037 embryo_program_native_call_add(ep, "set_drag_page", _edje_embryo_fn_set_drag_page);
3038 embryo_program_native_call_add(ep, "get_mouse", _edje_embryo_fn_get_mouse);
3039 embryo_program_native_call_add(ep, "get_mouse_buttons", _edje_embryo_fn_get_mouse_buttons);
3040 embryo_program_native_call_add(ep, "stop_program", _edje_embryo_fn_stop_program);
3041 embryo_program_native_call_add(ep, "stop_programs_on", _edje_embryo_fn_stop_programs_on);
3042 embryo_program_native_call_add(ep, "set_min_size", _edje_embryo_fn_set_min_size);
3043 embryo_program_native_call_add(ep, "set_max_size", _edje_embryo_fn_set_max_size);
3044 embryo_program_native_call_add(ep, "play_sample", _edje_embryo_fn_play_sample);
3045 embryo_program_native_call_add(ep, "play_tone", _edje_embryo_fn_play_tone);
3046 embryo_program_native_call_add(ep, "send_message", _edje_embryo_fn_send_message);
3047 embryo_program_native_call_add(ep, "get_geometry", _edje_embryo_fn_get_geometry);
3048 embryo_program_native_call_add(ep, "custom_state", _edje_embryo_fn_custom_state);
3049 embryo_program_native_call_add(ep, "set_state_val", _edje_embryo_fn_set_state_val);
3050 embryo_program_native_call_add(ep, "get_state_val", _edje_embryo_fn_get_state_val);
3051
3052 embryo_program_native_call_add(ep, "part_swallow", _edje_embryo_fn_part_swallow);
3053
3054 embryo_program_native_call_add(ep, "external_param_get_int", _edje_embryo_fn_external_param_get_int);
3055 embryo_program_native_call_add(ep, "external_param_set_int", _edje_embryo_fn_external_param_set_int);
3056 embryo_program_native_call_add(ep, "external_param_get_float", _edje_embryo_fn_external_param_get_float);
3057 embryo_program_native_call_add(ep, "external_param_set_float", _edje_embryo_fn_external_param_set_float);
3058 embryo_program_native_call_add(ep, "external_param_get_strlen", _edje_embryo_fn_external_param_get_strlen);
3059 embryo_program_native_call_add(ep, "external_param_get_str", _edje_embryo_fn_external_param_get_str);
3060 embryo_program_native_call_add(ep, "external_param_set_str", _edje_embryo_fn_external_param_set_str);
3061 embryo_program_native_call_add(ep, "external_param_get_choice_len", _edje_embryo_fn_external_param_get_choice_len);
3062 embryo_program_native_call_add(ep, "external_param_get_choice", _edje_embryo_fn_external_param_get_choice);
3063 embryo_program_native_call_add(ep, "external_param_set_choice", _edje_embryo_fn_external_param_set_choice);
3064 embryo_program_native_call_add(ep, "external_param_get_bool", _edje_embryo_fn_external_param_get_bool);
3065 embryo_program_native_call_add(ep, "external_param_set_bool", _edje_embryo_fn_external_param_set_bool);
3066}
3067
3068void
3069_edje_embryo_script_shutdown(Edje_Part_Collection *edc)
3070{
3071 if (!edc) return;
3072 if (!edc->script) return;
3073 if (embryo_program_recursion_get(edc->script) > 0) return;
3074 embryo_program_free(edc->script);
3075 edc->script = NULL;
3076}
3077
3078void
3079_edje_embryo_script_reset(Edje *ed)
3080{
3081 if (!ed) return;
3082 if (!ed->collection) return;
3083 if (!ed->collection->script) return;
3084 if (embryo_program_recursion_get(ed->collection->script) > 0) return;
3085 embryo_program_vm_reset(ed->collection->script);
3086 _edje_embryo_globals_init(ed);
3087}
3088
3089/* this may change in future - thus "test_run" is its name */
3090void
3091_edje_embryo_test_run(Edje *ed, const char *fname, const char *sig, const char *src)
3092{
3093 Embryo_Function fn;
3094
3095 if (!ed) return;
3096 if (!ed->collection) return;
3097 if (!ed->collection->script) return;
3098 embryo_program_vm_push(ed->collection->script);
3099 _edje_embryo_globals_init(ed);
3100
3101 // _edje_embryo_script_reset(ed);
3102 fn = embryo_program_function_find(ed->collection->script, (char *)fname);
3103 if (fn != EMBRYO_FUNCTION_NONE)
3104 {
3105 void *pdata;
3106 int ret;
3107
3108 embryo_parameter_string_push(ed->collection->script, (char *)sig);
3109 embryo_parameter_string_push(ed->collection->script, (char *)src);
3110 pdata = embryo_program_data_get(ed->collection->script);
3111 embryo_program_data_set(ed->collection->script, ed);
3112 /* 5 million instructions is an arbitrary number. on my p4-2.6 here */
3113 /* IF embryo is ONLY running embryo stuff and NO native calls thats */
3114 /* about 0.016 seconds, and longer on slower cpu's. if a simple */
3115 /* embryo script snippet hasn't managed to do its work in 5 MILLION */
3116 /* embryo virtual machine instructions - something is wrong, or */
3117 /* embryo is simply being mis-used. Embryo is meant to be minimal */
3118 /* logic enhancment - not entire applications. this cycle count */
3119 /* does NOT include time spent in native function calls, that the */
3120 /* script may call to do the REAL work, so in terms of time this */
3121 /* will likely end up being much longer than 0.016 seconds - more */
3122 /* like 0.03 - 0.05 seconds or even more */
3123 embryo_program_max_cycle_run_set(ed->collection->script, 5000000);
3124 ret = embryo_program_run(ed->collection->script, fn);
3125 if (ret == EMBRYO_PROGRAM_FAIL)
3126 {
3127 ERR("ERROR with embryo script. "
3128 "OBJECT NAME: '%s', "
3129 "OBJECT FILE: '%s', "
3130 "ENTRY POINT: '%s', "
3131 "SIGNAL: '%s', "
3132 "SOURCE: '%s', "
3133 "ERROR: '%s'",
3134 ed->collection->part,
3135 ed->file->path,
3136 fname,
3137 sig, src,
3138 embryo_error_string_get(embryo_program_error_get(ed->collection->script)));
3139 }
3140 else if (ret == EMBRYO_PROGRAM_TOOLONG)
3141 {
3142 ERR("ERROR with embryo script. "
3143 "OBJECT NAME: '%s', "
3144 "OBJECT FILE: '%s', "
3145 "ENTRY POINT: '%s', "
3146 "SIGNAL: '%s', "
3147 "SOURCE: '%s', "
3148 "ERROR: 'Script exceeded maximum allowed cycle count of %i'",
3149 ed->collection->part,
3150 ed->file->path,
3151 fname,
3152 sig, src,
3153 embryo_program_max_cycle_run_get(ed->collection->script));
3154 }
3155 embryo_program_data_set(ed->collection->script, pdata);
3156 }
3157 embryo_program_vm_pop(ed->collection->script);
3158}
3159
3160void
3161_edje_embryo_globals_init(Edje *ed)
3162{
3163 int n, i;
3164 Embryo_Program *ep;
3165
3166 ep = ed->collection->script;
3167 n = embryo_program_variable_count_get(ep);
3168 for (i = 0; i < n; i++)
3169 {
3170 Embryo_Cell cell, *cptr;
3171
3172 cell = embryo_program_variable_get(ep, i);
3173 if (cell != EMBRYO_CELL_NONE)
3174 {
3175 cptr = embryo_data_address_get(ep, cell);
3176 if (cptr) *cptr = EDJE_VAR_MAGIC_BASE + i;
3177 }
3178 }
3179}
diff --git a/libraries/edje/src/lib/edje_entry.c b/libraries/edje/src/lib/edje_entry.c
new file mode 100644
index 0000000..e25397a
--- /dev/null
+++ b/libraries/edje/src/lib/edje_entry.c
@@ -0,0 +1,3110 @@
1#include "edje_private.h"
2
3#ifdef HAVE_ECORE_IMF
4static Eina_Bool _edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos);
5static Eina_Bool _edje_entry_imf_event_commit_cb(void *data, int type, void *event);
6static Eina_Bool _edje_entry_imf_event_preedit_changed_cb(void *data, int type, void *event);
7static Eina_Bool _edje_entry_imf_event_delete_surrounding_cb(void *data, int type, void *event);
8#endif
9
10typedef struct _Entry Entry;
11typedef struct _Sel Sel;
12typedef struct _Anchor Anchor;
13
14static void _edje_entry_imf_cursor_info_set(Entry *en);
15static void _edje_entry_imf_context_reset(Entry *en);
16
17struct _Entry
18{
19 Edje_Real_Part *rp;
20 Evas_Object *cursor_bg;
21 Evas_Object *cursor_fg;
22 Evas_Textblock_Cursor *cursor;
23 Evas_Textblock_Cursor *sel_start, *sel_end;
24 Evas_Textblock_Cursor *cursor_user, *cursor_user_extra;
25 Evas_Textblock_Cursor *preedit_start, *preedit_end;
26 Ecore_Timer *pw_timer;
27 Eina_List *sel;
28 Eina_List *anchors;
29 Eina_List *anchorlist;
30 Eina_List *itemlist;
31 char *selection;
32 Eina_Bool selecting : 1;
33 Eina_Bool have_selection : 1;
34 Eina_Bool select_allow : 1;
35 Eina_Bool select_mod_start : 1;
36 Eina_Bool select_mod_end : 1;
37 Eina_Bool had_sel : 1;
38
39#ifdef HAVE_ECORE_IMF
40 Eina_Bool have_preedit : 1;
41 Ecore_IMF_Context *imf_context;
42
43 Ecore_Event_Handler *imf_ee_handler_commit;
44 Ecore_Event_Handler *imf_ee_handler_delete;
45 Ecore_Event_Handler *imf_ee_handler_changed;
46#endif
47};
48
49struct _Sel
50{
51 Evas_Textblock_Rectangle rect;
52 Evas_Object *obj_fg, *obj_bg, *obj, *sobj;
53};
54
55struct _Anchor
56{
57 Entry *en;
58 char *name;
59 Evas_Textblock_Cursor *start, *end;
60 Eina_List *sel;
61 Eina_Bool item : 1;
62};
63
64#ifdef HAVE_ECORE_IMF
65static void
66_preedit_clear(Entry *en)
67{
68 if (en->preedit_start)
69 {
70 evas_textblock_cursor_free(en->preedit_start);
71 en->preedit_start = NULL;
72 }
73
74 if (en->preedit_end)
75 {
76 evas_textblock_cursor_free(en->preedit_end);
77 en->preedit_end = NULL;
78 }
79
80 en->have_preedit = EINA_FALSE;
81}
82
83static void
84_preedit_del(Entry *en)
85{
86 if (!en || !en->have_preedit) return;
87 if (!en->preedit_start || !en->preedit_end) return;
88 if (!evas_textblock_cursor_compare(en->preedit_start, en->preedit_end)) return;
89
90 /* delete the preedit characters */
91 evas_textblock_cursor_range_delete(en->preedit_start, en->preedit_end);
92}
93
94static void
95_edje_entry_focus_in_cb(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
96{
97 Edje_Real_Part *rp;
98 Entry *en;
99
100 rp = data;
101 if (!rp || !rp->entry_data || !rp->edje || !rp->edje->obj) return;
102
103 en = rp->entry_data;
104 if (!en || !en->imf_context) return;
105
106 if (evas_object_focus_get(rp->edje->obj))
107 {
108 ecore_imf_context_reset(en->imf_context);
109 ecore_imf_context_focus_in(en->imf_context);
110 _edje_entry_imf_cursor_info_set(en);
111 }
112}
113
114static void
115_edje_entry_focus_out_cb(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
116{
117 Edje_Real_Part *rp;
118 Entry *en;
119
120 rp = data;
121 if (!rp || !rp->entry_data) return;
122
123 en = rp->entry_data;
124 if (!en || !en->imf_context) return;
125
126 ecore_imf_context_reset(en->imf_context);
127 _edje_entry_imf_cursor_info_set(en);
128 ecore_imf_context_focus_out(en->imf_context);
129}
130#endif
131
132static void
133_edje_focus_in_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
134{
135 Edje *ed = data;
136#ifdef HAVE_ECORE_IMF
137 Edje_Real_Part *rp;
138 Entry *en;
139#endif
140
141 _edje_emit(ed, "focus,in", "");
142#ifdef HAVE_ECORE_IMF
143 rp = ed->focused_part;
144 if (!rp) return;
145
146 en = rp->entry_data;
147 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
148 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE))
149 return;
150
151 if (!en->imf_context) return;
152
153 ecore_imf_context_reset(en->imf_context);
154 ecore_imf_context_focus_in(en->imf_context);
155 _edje_entry_imf_cursor_info_set(en);
156#endif
157}
158
159static void
160_edje_focus_out_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
161{
162 Edje *ed = data;
163#ifdef HAVE_ECORE_IMF
164 Edje_Real_Part *rp = ed->focused_part;
165 Entry *en;
166#endif
167
168 _edje_emit(ed, "focus,out", "");
169
170#ifdef HAVE_ECORE_IMF
171 if (!rp) return;
172 en = rp->entry_data;
173 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
174 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE))
175 return;
176
177 if (!en->imf_context) return;
178
179 ecore_imf_context_reset(en->imf_context);
180 _edje_entry_imf_cursor_info_set(en);
181 ecore_imf_context_focus_out(en->imf_context);
182#endif
183}
184
185static void
186_text_filter_text_prepend(Entry *en, Evas_Textblock_Cursor *c, const char *text)
187{
188 char *text2;
189 Edje_Text_Insert_Filter_Callback *cb;
190 Eina_List *l;
191
192 text2 = strdup(text);
193 EINA_LIST_FOREACH(en->rp->edje->text_insert_filter_callbacks, l, cb)
194 {
195 if (!strcmp(cb->part, en->rp->part->name))
196 {
197 cb->func(cb->data, en->rp->edje->obj, cb->part, EDJE_TEXT_FILTER_TEXT, &text2);
198 if (!text2) break;
199 }
200 }
201 if (text2)
202 {
203 evas_textblock_cursor_text_prepend(c, text2);
204 free(text2);
205 }
206}
207
208static void
209_text_filter_format_prepend(Entry *en, Evas_Textblock_Cursor *c, const char *text)
210{
211 char *text2;
212 Edje_Text_Insert_Filter_Callback *cb;
213 Eina_List *l;
214
215 text2 = strdup(text);
216 EINA_LIST_FOREACH(en->rp->edje->text_insert_filter_callbacks, l, cb)
217 {
218 if (!strcmp(cb->part, en->rp->part->name))
219 {
220 cb->func(cb->data, en->rp->edje->obj, cb->part, EDJE_TEXT_FILTER_FORMAT, &text2);
221 if (!text2) break;
222 }
223 }
224 if (text2)
225 {
226 evas_textblock_cursor_format_prepend(c, text2);
227 free(text2);
228 }
229}
230
231static void
232_text_filter_markup_prepend(Entry *en, Evas_Textblock_Cursor *c, const char *text)
233{
234 char *text2;
235 Edje_Text_Insert_Filter_Callback *cb;
236 Eina_List *l;
237
238 text2 = strdup(text);
239 EINA_LIST_FOREACH(en->rp->edje->text_insert_filter_callbacks, l, cb)
240 {
241 if (!strcmp(cb->part, en->rp->part->name))
242 {
243 cb->func(cb->data, en->rp->edje->obj, cb->part, EDJE_TEXT_FILTER_MARKUP, &text2);
244 if (!text2) break;
245 }
246 }
247 if (text2)
248 {
249 evas_object_textblock_text_markup_prepend(c, text2);
250 free(text2);
251 }
252}
253
254static void
255_curs_update_from_curs(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__, Entry *en, Evas_Coord *cx, Evas_Coord *cy)
256{
257 Evas_Coord cw, ch;
258 Evas_Textblock_Cursor_Type cur_type;
259 if (c != en->cursor) return;
260 switch (en->rp->part->cursor_mode)
261 {
262 case EDJE_ENTRY_CURSOR_MODE_BEFORE:
263 cur_type = EVAS_TEXTBLOCK_CURSOR_BEFORE;
264 break;
265 case EDJE_ENTRY_CURSOR_MODE_UNDER:
266 /* no break for a resaon */
267 default:
268 cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER;
269 }
270 evas_textblock_cursor_geometry_get(c, cx, cy, &cw, &ch, NULL, cur_type);
271 *cx += (cw / 2);
272 *cy += (ch / 2);
273}
274
275static void
276_curs_back(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__,
277 Entry *en __UNUSED__)
278{
279 evas_textblock_cursor_char_prev(c);
280}
281
282static void
283_curs_next(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__,
284 Entry *en __UNUSED__)
285{
286 evas_textblock_cursor_char_next(c);
287}
288
289static int
290_curs_line_last_get(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en __UNUSED__)
291{
292 Evas_Textblock_Cursor *cc;
293 int ln;
294
295 cc = evas_object_textblock_cursor_new(o);
296 evas_textblock_cursor_paragraph_last(cc);
297 ln = evas_textblock_cursor_line_geometry_get(cc, NULL, NULL, NULL, NULL);
298 evas_textblock_cursor_free(cc);
299 return ln;
300}
301
302static void
303_curs_lin_start(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__,
304 Entry *en __UNUSED__)
305{
306 evas_textblock_cursor_line_char_first(c);
307}
308
309static void
310_curs_lin_end(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__,
311 Entry *en __UNUSED__)
312{
313 evas_textblock_cursor_line_char_last(c);
314}
315
316static void
317_curs_start(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__,
318 Entry *en __UNUSED__)
319{
320 evas_textblock_cursor_paragraph_first(c);
321}
322
323static void
324_curs_end(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__, Entry *en __UNUSED__)
325{
326 evas_textblock_cursor_paragraph_last(c);
327}
328
329static void
330_curs_jump_line(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en, int ln)
331{
332 Evas_Coord cx, cy;
333 Evas_Coord lx, ly, lw, lh;
334 int last = _curs_line_last_get(c, o, en);
335
336 if (ln < 0) ln = 0;
337 else
338 {
339 if (ln > last) ln = last;
340 }
341
342 _curs_update_from_curs(c, o, en, &cx, &cy);
343
344 if (!evas_object_textblock_line_number_geometry_get(o, ln, &lx, &ly, &lw, &lh))
345 return;
346 if (evas_textblock_cursor_char_coord_set(c, cx, ly + (lh / 2)))
347 return;
348 evas_textblock_cursor_line_set(c, ln);
349 if (cx < (lx + (lw / 2)))
350 {
351 if (ln == last) _curs_end(c, o, en);
352 _curs_lin_start(c, o, en);
353 }
354 else
355 {
356 if (ln == last)
357 _curs_end(c, o, en);
358 else
359 _curs_lin_end(c, o, en);
360 }
361}
362
363static void
364_curs_jump_line_by(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en, int by)
365{
366 int ln;
367
368 ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL) + by;
369 _curs_jump_line(c, o, en, ln);
370}
371
372static void
373_curs_up(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
374{
375 _curs_jump_line_by(c, o, en, -1);
376}
377
378static void
379_curs_down(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
380{
381 _curs_jump_line_by(c, o, en, 1);
382}
383
384static void
385_sel_start(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
386{
387 if (en->sel_start) return;
388 en->sel_start = evas_object_textblock_cursor_new(o);
389 evas_textblock_cursor_copy(c, en->sel_start);
390 en->sel_end = evas_object_textblock_cursor_new(o);
391 evas_textblock_cursor_copy(c, en->sel_end);
392
393 en->have_selection = EINA_FALSE;
394 if (en->selection)
395 {
396 free(en->selection);
397 en->selection = NULL;
398 }
399}
400
401static void
402_sel_enable(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, Entry *en)
403{
404 if (en->have_selection) return;
405 en->have_selection = EINA_TRUE;
406 if (en->selection)
407 {
408 free(en->selection);
409 en->selection = NULL;
410 }
411 _edje_emit(en->rp->edje, "selection,start", en->rp->part->name);
412}
413
414static void
415_sel_extend(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
416{
417 if (!en->sel_end) return;
418 _sel_enable(c, o, en);
419 if (!evas_textblock_cursor_compare(c, en->sel_end)) return;
420 evas_textblock_cursor_copy(c, en->sel_end);
421 if (en->selection)
422 {
423 free(en->selection);
424 en->selection = NULL;
425 }
426 _edje_emit(en->rp->edje, "selection,changed", en->rp->part->name);
427 _edje_entry_imf_context_reset(en);
428}
429
430static void
431_sel_preextend(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
432{
433 if (!en->sel_end) return;
434 _sel_enable(c, o, en);
435 if (!evas_textblock_cursor_compare(c, en->sel_start)) return;
436 evas_textblock_cursor_copy(c, en->sel_start);
437 if (en->selection)
438 {
439 free(en->selection);
440 en->selection = NULL;
441 }
442 _edje_emit(en->rp->edje, "selection,changed", en->rp->part->name);
443 _edje_entry_imf_context_reset(en);
444}
445
446static void
447_sel_clear(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, Entry *en)
448{
449 en->had_sel = EINA_FALSE;
450 if (en->sel_start)
451 {
452 evas_textblock_cursor_free(en->sel_start);
453 evas_textblock_cursor_free(en->sel_end);
454 en->sel_start = NULL;
455 en->sel_end = NULL;
456 }
457 if (en->selection)
458 {
459 free(en->selection);
460 en->selection = NULL;
461 }
462 while (en->sel)
463 {
464 Sel *sel;
465
466 sel = en->sel->data;
467 if (sel->obj_bg) evas_object_del(sel->obj_bg);
468 if (sel->obj_fg) evas_object_del(sel->obj_fg);
469 free(sel);
470 en->sel = eina_list_remove_list(en->sel, en->sel);
471 }
472 if (en->have_selection)
473 {
474 en->have_selection = EINA_FALSE;
475 _edje_emit(en->rp->edje, "selection,cleared", en->rp->part->name);
476 }
477}
478
479static void
480_sel_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en)
481{
482 Eina_List *range = NULL, *l;
483 Sel *sel;
484 Evas_Coord x, y, w, h;
485 Evas_Object *smart, *clip;
486
487 smart = evas_object_smart_parent_get(o);
488 clip = evas_object_clip_get(o);
489 if (en->sel_start)
490 range = evas_textblock_cursor_range_geometry_get(en->sel_start, en->sel_end);
491 else
492 return;
493 if (eina_list_count(range) != eina_list_count(en->sel))
494 {
495 while (en->sel)
496 {
497 sel = en->sel->data;
498 if (sel->obj_bg) evas_object_del(sel->obj_bg);
499 if (sel->obj_fg) evas_object_del(sel->obj_fg);
500 free(sel);
501 en->sel = eina_list_remove_list(en->sel, en->sel);
502 }
503 if (en->have_selection)
504 {
505 for (l = range; l; l = eina_list_next(l))
506 {
507 Evas_Object *ob;
508
509 sel = calloc(1, sizeof(Sel));
510 en->sel = eina_list_append(en->sel, sel);
511 ob = edje_object_add(en->rp->edje->base.evas);
512 edje_object_file_set(ob, en->rp->edje->path, en->rp->part->source);
513 evas_object_smart_member_add(ob, smart);
514 evas_object_stack_below(ob, o);
515 evas_object_clip_set(ob, clip);
516 evas_object_pass_events_set(ob, EINA_TRUE);
517 evas_object_show(ob);
518 sel->obj_bg = ob;
519 _edje_subobj_register(en->rp->edje, sel->obj_bg);
520
521 ob = edje_object_add(en->rp->edje->base.evas);
522 edje_object_file_set(ob, en->rp->edje->path, en->rp->part->source2);
523 evas_object_smart_member_add(ob, smart);
524 evas_object_stack_above(ob, o);
525 evas_object_clip_set(ob, clip);
526 evas_object_pass_events_set(ob, EINA_TRUE);
527 evas_object_show(ob);
528 sel->obj_fg = ob;
529 _edje_subobj_register(en->rp->edje, sel->obj_fg);
530 }
531 }
532 }
533 x = y = w = h = -1;
534 evas_object_geometry_get(o, &x, &y, &w, &h);
535 if (en->have_selection)
536 {
537 EINA_LIST_FOREACH(en->sel, l, sel)
538 {
539 Evas_Textblock_Rectangle *r;
540
541 r = range->data;
542 if (sel->obj_bg)
543 {
544 evas_object_move(sel->obj_bg, x + r->x, y + r->y);
545 evas_object_resize(sel->obj_bg, r->w, r->h);
546 }
547 if (sel->obj_fg)
548 {
549 evas_object_move(sel->obj_fg, x + r->x, y + r->y);
550 evas_object_resize(sel->obj_fg, r->w, r->h);
551 }
552 *(&(sel->rect)) = *r;
553 range = eina_list_remove_list(range, range);
554 free(r);
555 }
556 }
557 else
558 {
559 while (range)
560 {
561 free(range->data);
562 range = eina_list_remove_list(range, range);
563 }
564 }
565}
566
567static void
568_edje_anchor_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
569{
570 Anchor *an = data;
571 Evas_Event_Mouse_Down *ev = event_info;
572 Edje_Real_Part *rp = an->en->rp;
573 char *buf, *n;
574 size_t len;
575 int ignored;
576 Entry *en;
577
578 en = rp->entry_data;
579 if ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) &&
580 (en->select_allow))
581 return;
582 ignored = rp->part->ignore_flags & ev->event_flags;
583 if ((!ev->event_flags) || (!ignored))
584 {
585 n = an->name;
586 if (!n) n = "";
587 len = 200 + strlen(n);
588 buf = alloca(len);
589 if (ev->flags & EVAS_BUTTON_TRIPLE_CLICK)
590 snprintf(buf, len, "anchor,mouse,down,%i,%s,triple", ev->button, n);
591 else if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
592 snprintf(buf, len, "anchor,mouse,down,%i,%s,double", ev->button, n);
593 else
594 snprintf(buf, len, "anchor,mouse,down,%i,%s", ev->button, n);
595 _edje_emit(rp->edje, buf, rp->part->name);
596 }
597}
598
599static void
600_edje_anchor_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
601{
602 Anchor *an = data;
603 Evas_Event_Mouse_Up *ev = event_info;
604 Edje_Real_Part *rp = an->en->rp;
605 char *buf, *n;
606 size_t len;
607 int ignored;
608 Entry *en;
609
610 en = rp->entry_data;
611 ignored = rp->part->ignore_flags & ev->event_flags;
612 if ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) &&
613 (en->select_allow))
614 return;
615 n = an->name;
616 if (!n) n = "";
617 len = 200 + strlen(n);
618 buf = alloca(len);
619 if ((!ev->event_flags) || (!ignored))
620 {
621 snprintf(buf, len, "anchor,mouse,up,%i,%s", ev->button, n);
622 _edje_emit(rp->edje, buf, rp->part->name);
623 }
624 if ((rp->still_in) && (rp->clicked_button == ev->button) && (!ignored))
625 {
626 snprintf(buf, len, "anchor,mouse,clicked,%i,%s", ev->button, n);
627 _edje_emit(rp->edje, buf, rp->part->name);
628 }
629}
630
631static void
632_edje_anchor_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
633{
634 Anchor *an = data;
635 Evas_Event_Mouse_Move *ev = event_info;
636 Edje_Real_Part *rp = an->en->rp;
637 char *buf, *n;
638 size_t len;
639 int ignored;
640 Entry *en;
641
642 en = rp->entry_data;
643 if ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) &&
644 (en->select_allow))
645 return;
646 ignored = rp->part->ignore_flags & ev->event_flags;
647 if ((!ev->event_flags) || (!ignored))
648 {
649 n = an->name;
650 if (!n) n = "";
651 len = 200 + strlen(n);
652 buf = alloca(len);
653 snprintf(buf, len, "anchor,mouse,move,%s", n);
654 _edje_emit(rp->edje, buf, rp->part->name);
655 }
656}
657
658static void
659_edje_anchor_mouse_in_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
660{
661 Anchor *an = data;
662 Evas_Event_Mouse_In *ev = event_info;
663 Edje_Real_Part *rp = an->en->rp;
664 char *buf, *n;
665 size_t len;
666 int ignored;
667
668 ignored = rp->part->ignore_flags & ev->event_flags;
669 if ((!ev->event_flags) || (!ignored))
670 {
671 n = an->name;
672 if (!n) n = "";
673 len = 200 + strlen(n);
674 buf = alloca(len);
675 snprintf(buf, len, "anchor,mouse,in,%s", n);
676 _edje_emit(rp->edje, buf, rp->part->name);
677 }
678}
679
680static void
681_edje_anchor_mouse_out_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
682{
683 Anchor *an = data;
684 Evas_Event_Mouse_Out *ev = event_info;
685 Edje_Real_Part *rp = an->en->rp;
686 char *buf, *n;
687 size_t len;
688 int ignored;
689
690 ignored = rp->part->ignore_flags & ev->event_flags;
691 if ((!ev->event_flags) || (!ignored))
692 {
693 n = an->name;
694 if (!n) n = "";
695 len = 200 + strlen(n);
696 buf = alloca(len);
697 snprintf(buf, len, "anchor,mouse,out,%s", n);
698 _edje_emit(rp->edje, buf, rp->part->name);
699 }
700}
701
702static void
703_anchors_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en)
704{
705 Eina_List *l, *ll, *range = NULL;
706 Evas_Coord x, y, w, h;
707 Evas_Object *smart, *clip;
708 Sel *sel;
709 Anchor *an;
710
711 smart = evas_object_smart_parent_get(o);
712 clip = evas_object_clip_get(o);
713 x = y = w = h = -1;
714 evas_object_geometry_get(o, &x, &y, &w, &h);
715 EINA_LIST_FOREACH(en->anchors, l, an)
716 {
717 // for item anchors
718 if (an->item)
719 {
720 Evas_Object *ob;
721
722 if (!an->sel)
723 {
724 while (an->sel)
725 {
726 sel = an->sel->data;
727 if (sel->obj_bg) evas_object_del(sel->obj_bg);
728 if (sel->obj_fg) evas_object_del(sel->obj_fg);
729 if (sel->obj) evas_object_del(sel->obj);
730 free(sel);
731 an->sel = eina_list_remove_list(an->sel, an->sel);
732 }
733
734 sel = calloc(1, sizeof(Sel));
735 an->sel = eina_list_append(an->sel, sel);
736
737 if (en->rp->edje->item_provider.func)
738 {
739 ob = en->rp->edje->item_provider.func
740 (en->rp->edje->item_provider.data, smart,
741 en->rp->part->name, an->name);
742 evas_object_smart_member_add(ob, smart);
743 evas_object_stack_above(ob, o);
744 evas_object_clip_set(ob, clip);
745 evas_object_pass_events_set(ob, EINA_TRUE);
746 evas_object_show(ob);
747 sel->obj = ob;
748 }
749 }
750 }
751 // for link anchors
752 else
753 {
754 range =
755 evas_textblock_cursor_range_geometry_get(an->start, an->end);
756 if (eina_list_count(range) != eina_list_count(an->sel))
757 {
758 while (an->sel)
759 {
760 sel = an->sel->data;
761 if (sel->obj_bg) evas_object_del(sel->obj_bg);
762 if (sel->obj_fg) evas_object_del(sel->obj_fg);
763 if (sel->obj) evas_object_del(sel->obj);
764 free(sel);
765 an->sel = eina_list_remove_list(an->sel, an->sel);
766 }
767 for (ll = range; ll; ll = eina_list_next(ll))
768 {
769 Evas_Object *ob;
770
771 sel = calloc(1, sizeof(Sel));
772 an->sel = eina_list_append(an->sel, sel);
773 ob = edje_object_add(en->rp->edje->base.evas);
774 edje_object_file_set(ob, en->rp->edje->path, en->rp->part->source5);
775 evas_object_smart_member_add(ob, smart);
776 evas_object_stack_below(ob, o);
777 evas_object_clip_set(ob, clip);
778 evas_object_pass_events_set(ob, EINA_TRUE);
779 evas_object_show(ob);
780 sel->obj_bg = ob;
781 _edje_subobj_register(en->rp->edje, sel->obj_bg);
782
783 ob = edje_object_add(en->rp->edje->base.evas);
784 edje_object_file_set(ob, en->rp->edje->path, en->rp->part->source6);
785 evas_object_smart_member_add(ob, smart);
786 evas_object_stack_above(ob, o);
787 evas_object_clip_set(ob, clip);
788 evas_object_pass_events_set(ob, EINA_TRUE);
789 evas_object_show(ob);
790 sel->obj_fg = ob;
791 _edje_subobj_register(en->rp->edje, sel->obj_fg);
792
793 ob = evas_object_rectangle_add(en->rp->edje->base.evas);
794 evas_object_color_set(ob, 0, 0, 0, 0);
795 evas_object_smart_member_add(ob, smart);
796 evas_object_stack_above(ob, o);
797 evas_object_clip_set(ob, clip);
798 evas_object_repeat_events_set(ob, EINA_TRUE);
799 evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_DOWN, _edje_anchor_mouse_down_cb, an);
800 evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_UP, _edje_anchor_mouse_up_cb, an);
801 evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_MOVE, _edje_anchor_mouse_move_cb, an);
802 evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_IN, _edje_anchor_mouse_in_cb, an);
803 evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_OUT, _edje_anchor_mouse_out_cb, an);
804 evas_object_show(ob);
805 sel->obj = ob;
806 }
807 }
808 }
809 EINA_LIST_FOREACH(an->sel, ll, sel)
810 {
811 if (an->item)
812 {
813 Evas_Coord cx, cy, cw, ch;
814
815 if (!evas_textblock_cursor_format_item_geometry_get
816 (an->start, &cx, &cy, &cw, &ch))
817 continue;
818 evas_object_move(sel->obj, x + cx, y + cy);
819 evas_object_resize(sel->obj, cw, ch);
820 }
821 else
822 {
823 Evas_Textblock_Rectangle *r;
824
825 r = range->data;
826 *(&(sel->rect)) = *r;
827 if (sel->obj_bg)
828 {
829 evas_object_move(sel->obj_bg, x + r->x, y + r->y);
830 evas_object_resize(sel->obj_bg, r->w, r->h);
831 }
832 if (sel->obj_fg)
833 {
834 evas_object_move(sel->obj_fg, x + r->x, y + r->y);
835 evas_object_resize(sel->obj_fg, r->w, r->h);
836 }
837 if (sel->obj)
838 {
839 evas_object_move(sel->obj, x + r->x, y + r->y);
840 evas_object_resize(sel->obj, r->w, r->h);
841 }
842 range = eina_list_remove_list(range, range);
843 free(r);
844 }
845 }
846 }
847}
848
849static void
850_anchors_clear(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, Entry *en)
851{
852 while (en->anchorlist)
853 {
854 free(en->anchorlist->data);
855 en->anchorlist = eina_list_remove_list(en->anchorlist, en->anchorlist);
856 }
857 while (en->itemlist)
858 {
859 free(en->itemlist->data);
860 en->itemlist = eina_list_remove_list(en->itemlist, en->itemlist);
861 }
862 while (en->anchors)
863 {
864 Anchor *an = en->anchors->data;
865
866 evas_textblock_cursor_free(an->start);
867 evas_textblock_cursor_free(an->end);
868 while (an->sel)
869 {
870 Sel *sel = an->sel->data;
871 if (sel->obj_bg) evas_object_del(sel->obj_bg);
872 if (sel->obj_fg) evas_object_del(sel->obj_fg);
873 if (sel->obj) evas_object_del(sel->obj);
874 free(sel);
875 an->sel = eina_list_remove_list(an->sel, an->sel);
876 }
877 free(an->name);
878 free(an);
879 en->anchors = eina_list_remove_list(en->anchors, en->anchors);
880 }
881}
882
883static void
884_anchors_get(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
885{
886 const Eina_List *anchors_a, *anchors_item;
887 Anchor *an = NULL;
888 _anchors_clear(c, o, en);
889
890 anchors_a = evas_textblock_node_format_list_get(o, "a");
891 anchors_item = evas_textblock_node_format_list_get(o, "item");
892
893 if (anchors_a)
894 {
895 const Evas_Object_Textblock_Node_Format *node;
896 const Eina_List *itr;
897 EINA_LIST_FOREACH(anchors_a, itr, node)
898 {
899 const char *s = evas_textblock_node_format_text_get(node);
900 char *p;
901 an = calloc(1, sizeof(Anchor));
902 if (!an)
903 break;
904
905 an->en = en;
906 p = strstr(s, "href=");
907 if (p)
908 {
909 an->name = strdup(p + 5);
910 }
911 en->anchors = eina_list_append(en->anchors, an);
912 an->start = evas_object_textblock_cursor_new(o);
913 an->end = evas_object_textblock_cursor_new(o);
914 evas_textblock_cursor_at_format_set(an->start, node);
915 evas_textblock_cursor_copy(an->start, an->end);
916
917 /* Close the anchor, if the anchor was without text,
918 * free it as well */
919 node = evas_textblock_node_format_next_get(node);
920 for (; node; node = evas_textblock_node_format_next_get(node))
921 {
922 s = evas_textblock_node_format_text_get(node);
923 if ((!strcmp(s, "- a")) || (!strcmp(s, "-a")))
924 break;
925 }
926
927 if (node)
928 {
929 evas_textblock_cursor_at_format_set(an->end, node);
930 }
931 else if (!evas_textblock_cursor_compare(an->start, an->end))
932 {
933 if (an->name) free(an->name);
934 evas_textblock_cursor_free(an->start);
935 evas_textblock_cursor_free(an->end);
936 en->anchors = eina_list_remove(en->anchors, an);
937 free(an);
938 }
939 an = NULL;
940 }
941 }
942
943 if (anchors_item)
944 {
945 const Evas_Object_Textblock_Node_Format *node;
946 const Eina_List *itr;
947 EINA_LIST_FOREACH(anchors_item, itr, node)
948 {
949 const char *s = evas_textblock_node_format_text_get(node);
950 char *p;
951 an = calloc(1, sizeof(Anchor));
952 if (!an)
953 break;
954
955 an->en = en;
956 an->item = 1;
957 p = strstr(s, "href=");
958 if (p)
959 {
960 an->name = strdup(p + 5);
961 }
962 en->anchors = eina_list_append(en->anchors, an);
963 an->start = evas_object_textblock_cursor_new(o);
964 an->end = evas_object_textblock_cursor_new(o);
965 evas_textblock_cursor_at_format_set(an->start, node);
966 evas_textblock_cursor_copy(an->start, an->end);
967 /* Although needed in textblock, don't bother with finding the end
968 * here cause it doesn't really matter. */
969 }
970 }
971}
972
973static void
974_free_entry_change_info(void *_info)
975{
976 Edje_Entry_Change_Info *info = (Edje_Entry_Change_Info *) _info;
977 if (info->insert)
978 {
979 eina_stringshare_del(info->change.insert.content);
980 }
981 else
982 {
983 eina_stringshare_del(info->change.del.content);
984 }
985 free(info);
986}
987
988static void
989_range_del_emit(Edje *ed, Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, Entry *en)
990{
991 size_t start, end;
992 char *tmp;
993 Edje_Entry_Change_Info *info = calloc(1, sizeof(*info));
994 info->insert = EINA_FALSE;
995 start = evas_textblock_cursor_pos_get(en->sel_start);
996 end = evas_textblock_cursor_pos_get(en->sel_end);
997 info->change.del.start = start;
998 info->change.del.end = end;
999
1000 tmp = evas_textblock_cursor_range_text_get(en->sel_start, en->sel_end, EVAS_TEXTBLOCK_TEXT_MARKUP);
1001 info->change.del.content = eina_stringshare_add(tmp);
1002 if (tmp) free(tmp);
1003 evas_textblock_cursor_range_delete(en->sel_start, en->sel_end);
1004 _edje_emit(ed, "entry,changed", en->rp->part->name);
1005 _edje_emit_full(ed, "entry,changed,user", en->rp->part->name, info,
1006 _free_entry_change_info);
1007}
1008
1009static void
1010_range_del(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, Entry *en)
1011{
1012 evas_textblock_cursor_range_delete(en->sel_start, en->sel_end);
1013}
1014
1015static void
1016_delete_emit(Edje *ed, Evas_Textblock_Cursor *c, Entry *en, size_t pos,
1017 Eina_Bool backspace)
1018{
1019 if (!evas_textblock_cursor_char_next(c))
1020 {
1021 return;
1022 }
1023 evas_textblock_cursor_char_prev(c);
1024
1025 Edje_Entry_Change_Info *info = calloc(1, sizeof(*info));
1026 char *tmp = evas_textblock_cursor_content_get(c);
1027
1028 info->insert = EINA_FALSE;
1029 if (backspace)
1030 {
1031 info->change.del.start = pos - 1;
1032 info->change.del.end = pos;
1033 }
1034 else
1035 {
1036 info->change.del.start = pos + 1;
1037 info->change.del.end = pos;
1038 }
1039
1040 info->change.del.content = eina_stringshare_add(tmp);
1041 if (tmp) free(tmp);
1042
1043 evas_textblock_cursor_char_delete(c);
1044 _edje_emit(ed, "entry,changed", en->rp->part->name);
1045 _edje_emit_full(ed, "entry,changed,user", en->rp->part->name,
1046 info, _free_entry_change_info);
1047}
1048
1049static void
1050_edje_entry_hide_visible_password(Edje_Real_Part *rp)
1051{
1052 const Evas_Object_Textblock_Node_Format *node;
1053 node = evas_textblock_node_format_first_get(rp->object);
1054 for (; node; node = evas_textblock_node_format_next_get(node))
1055 {
1056 const char *text = evas_textblock_node_format_text_get(node);
1057 if (text)
1058 {
1059 if (!strcmp(text, "+ password=off"))
1060 {
1061 evas_textblock_node_format_remove_pair(rp->object,
1062 (Evas_Object_Textblock_Node_Format *) node);
1063 break;
1064 }
1065 }
1066 }
1067 _edje_entry_real_part_configure(rp);
1068 _edje_emit(rp->edje, "entry,changed", rp->part->name);
1069}
1070
1071static Eina_Bool
1072_password_timer_cb(void *data)
1073{
1074 Entry *en = (Entry *)data;
1075 _edje_entry_hide_visible_password(en->rp);
1076 en->pw_timer = NULL;
1077 return ECORE_CALLBACK_CANCEL;
1078}
1079
1080static void
1081_edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1082{
1083 Edje *ed = data;
1084 Evas_Event_Key_Down *ev = event_info;
1085 Edje_Real_Part *rp = ed->focused_part;
1086 Entry *en;
1087 Eina_Bool control, alt, shift;
1088 Eina_Bool multiline;
1089 Eina_Bool cursor_changed;
1090 int old_cur_pos;
1091 if (!rp) return;
1092 en = rp->entry_data;
1093 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
1094 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE))
1095 return;
1096 if (!ev->key) return;
1097
1098#ifdef HAVE_ECORE_IMF
1099 if (en->imf_context)
1100 {
1101 Ecore_IMF_Event_Key_Down ecore_ev;
1102 ecore_imf_evas_event_key_down_wrap(ev, &ecore_ev);
1103 if (ecore_imf_context_filter_event(en->imf_context,
1104 ECORE_IMF_EVENT_KEY_DOWN,
1105 (Ecore_IMF_Event *)&ecore_ev))
1106 return;
1107 }
1108#endif
1109
1110 old_cur_pos = evas_textblock_cursor_pos_get(en->cursor);
1111
1112 control = evas_key_modifier_is_set(ev->modifiers, "Control");
1113 alt = evas_key_modifier_is_set(ev->modifiers, "Alt");
1114 shift = evas_key_modifier_is_set(ev->modifiers, "Shift");
1115 multiline = rp->part->multiline;
1116 cursor_changed = EINA_FALSE;
1117 if (!strcmp(ev->key, "Escape"))
1118 {
1119 // dead keys here. Escape for now (should emit these)
1120 _edje_emit(ed, "entry,key,escape", rp->part->name);
1121 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1122 }
1123 else if (!strcmp(ev->key, "Up") || !strcmp(ev->key, "KP_Up"))
1124 {
1125 if (multiline)
1126 {
1127 if (en->select_allow)
1128 {
1129 if (shift) _sel_start(en->cursor, rp->object, en);
1130 else _sel_clear(en->cursor, rp->object, en);
1131 }
1132 _curs_up(en->cursor, rp->object, en);
1133 if (en->select_allow)
1134 {
1135 if (shift) _sel_extend(en->cursor, rp->object, en);
1136 }
1137 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1138 }
1139 _sel_clear(en->cursor, rp->object, en);
1140 _edje_emit(ed, "entry,key,up", rp->part->name);
1141 }
1142 else if (!strcmp(ev->key, "Down") || !strcmp(ev->key, "KP_Down"))
1143 {
1144 if (multiline)
1145 {
1146 if (en->select_allow)
1147 {
1148 if (shift) _sel_start(en->cursor, rp->object, en);
1149 else _sel_clear(en->cursor, rp->object, en);
1150 }
1151 _curs_down(en->cursor, rp->object, en);
1152 if (en->select_allow)
1153 {
1154 if (shift) _sel_extend(en->cursor, rp->object, en);
1155 }
1156 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1157 }
1158 _sel_clear(en->cursor, rp->object, en);
1159 _edje_emit(ed, "entry,key,down", rp->part->name);
1160 }
1161 else if (!strcmp(ev->key, "Left") || !strcmp(ev->key, "KP_Left"))
1162 {
1163 if (en->select_allow)
1164 {
1165 if (shift) _sel_start(en->cursor, rp->object, en);
1166 else _sel_clear(en->cursor, rp->object, en);
1167 }
1168 _curs_back(en->cursor, rp->object, en);
1169 if (en->select_allow)
1170 {
1171 if (shift) _sel_extend(en->cursor, rp->object, en);
1172 }
1173 _sel_clear(en->cursor, rp->object, en);
1174 _edje_emit(ed, "entry,key,left", rp->part->name);
1175 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1176 }
1177 else if (!strcmp(ev->key, "Right") || !strcmp(ev->key, "KP_Right"))
1178 {
1179 if (en->select_allow)
1180 {
1181 if (shift) _sel_start(en->cursor, rp->object, en);
1182 else _sel_clear(en->cursor, rp->object, en);
1183 }
1184 _curs_next(en->cursor, rp->object, en);
1185 if (en->select_allow)
1186 {
1187 if (shift) _sel_extend(en->cursor, rp->object, en);
1188 }
1189 _sel_clear(en->cursor, rp->object, en);
1190 _edje_emit(ed, "entry,key,right", rp->part->name);
1191 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1192 }
1193 else if (!strcmp(ev->key, "BackSpace"))
1194 {
1195 if (control)
1196 {
1197 // del to start of previous word
1198 }
1199 else if ((alt) && (shift))
1200 {
1201 // undo last action
1202 }
1203 else
1204 {
1205 if (en->have_selection)
1206 {
1207 _range_del_emit(ed, en->cursor, rp->object, en);
1208 }
1209 else
1210 {
1211 if (evas_textblock_cursor_char_prev(en->cursor))
1212 {
1213 _delete_emit(ed, en->cursor, en, old_cur_pos, EINA_TRUE);
1214 }
1215 }
1216 }
1217 _sel_clear(en->cursor, rp->object, en);
1218 _anchors_get(en->cursor, rp->object, en);
1219 _edje_emit(ed, "entry,key,backspace", rp->part->name);
1220 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1221 }
1222 else if (!strcmp(ev->key, "Delete") || !strcmp(ev->key, "KP_Delete"))
1223 {
1224 if (control)
1225 {
1226 // del to end of next word
1227 }
1228 else if (shift)
1229 {
1230 // cut
1231 }
1232 else
1233 {
1234 if (en->have_selection)
1235 {
1236 _range_del_emit(ed, en->cursor, rp->object, en);
1237 }
1238 else
1239 {
1240 _delete_emit(ed, en->cursor, en, old_cur_pos, EINA_FALSE);
1241 }
1242 }
1243 _sel_clear(en->cursor, rp->object, en);
1244 _anchors_get(en->cursor, rp->object, en);
1245 _edje_emit(ed, "entry,key,delete", rp->part->name);
1246 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1247 }
1248 else if (!strcmp(ev->key, "Home") || !strcmp(ev->key, "KP_Home"))
1249 {
1250 if (en->select_allow)
1251 {
1252 if (shift) _sel_start(en->cursor, rp->object, en);
1253 else _sel_clear(en->cursor, rp->object, en);
1254 }
1255 if ((control) && (multiline))
1256 _curs_start(en->cursor, rp->object, en);
1257 else
1258 _curs_lin_start(en->cursor, rp->object, en);
1259 if (en->select_allow)
1260 {
1261 if (shift) _sel_extend(en->cursor, rp->object, en);
1262 }
1263 _edje_emit(ed, "entry,key,home", rp->part->name);
1264 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1265 }
1266 else if (!strcmp(ev->key, "End") || !strcmp(ev->key, "KP_End"))
1267 {
1268 if (en->select_allow)
1269 {
1270 if (shift) _sel_start(en->cursor, rp->object, en);
1271 else _sel_clear(en->cursor, rp->object, en);
1272 }
1273 if ((control) && (multiline))
1274 _curs_end(en->cursor, rp->object, en);
1275 else
1276 _curs_lin_end(en->cursor, rp->object, en);
1277 if (en->select_allow)
1278 {
1279 if (shift) _sel_extend(en->cursor, rp->object, en);
1280 }
1281 _edje_emit(ed, "entry,key,end", rp->part->name);
1282 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1283 }
1284 else if (!strcmp(ev->key, "Shift_L") || !strcmp(ev->key, "Shift_R"))
1285 {
1286 return;
1287 }
1288 else if ((control) && (!strcmp(ev->key, "v")))
1289 {
1290 _edje_emit(ed, "entry,paste,request", rp->part->name);
1291 _edje_emit(ed, "entry,paste,request,3", rp->part->name);
1292 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1293 }
1294 else if ((control) && (!strcmp(ev->key, "a")))
1295 {
1296 _edje_emit(ed, "entry,selection,all,request", rp->part->name);
1297 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1298 }
1299 else if ((control) && (!strcmp(ev->key, "A")))
1300 {
1301 _edje_emit(ed, "entry,selection,none,request", rp->part->name);
1302 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1303 }
1304 else if ((control) && ((!strcmp(ev->key, "c") || (!strcmp(ev->key, "Insert")))))
1305 {
1306 // FIXME: copy - save selection
1307 _edje_emit(ed, "entry,copy,notify", rp->part->name);
1308 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1309 }
1310 else if ((control) && ((!strcmp(ev->key, "x") || (!strcmp(ev->key, "m")))))
1311 {
1312 // FIXME: cut - save selection, delete seletion
1313 _edje_emit(ed, "entry,cut,notify", rp->part->name);
1314 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1315 }
1316 else if ((control) && (!strcmp(ev->key, "z")))
1317 {
1318 if (shift)
1319 {
1320 // redo
1321 _edje_emit(ed, "entry,redo,request", rp->part->name);
1322 }
1323 else
1324 {
1325 // undo
1326 _edje_emit(ed, "entry,undo,request", rp->part->name);
1327 }
1328 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1329 }
1330 else if ((control) && (!strcmp(ev->key, "y")))
1331 {
1332 // redo
1333 _edje_emit(ed, "entry,redo,request", rp->part->name);
1334 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1335 }
1336 else if ((control) && (!strcmp(ev->key, "w")))
1337 {
1338 _sel_clear(en->cursor, rp->object, en);
1339 // select current word
1340 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1341 }
1342 else if (!strcmp(ev->key, "Tab"))
1343 {
1344 if (multiline)
1345 {
1346 if (shift)
1347 {
1348 // remove a tab
1349 }
1350 else
1351 {
1352 Edje_Entry_Change_Info *info = calloc(1, sizeof(*info));
1353 info->insert = EINA_TRUE;
1354 info->change.insert.plain_length = 1;
1355
1356 if (en->have_selection)
1357 {
1358 _range_del_emit(ed, en->cursor, rp->object, en);
1359 info->merge = EINA_TRUE;
1360 }
1361 _sel_clear(en->cursor, rp->object, en);
1362 info->change.insert.pos =
1363 evas_textblock_cursor_pos_get(en->cursor);
1364 info->change.insert.content = eina_stringshare_add("<\t>");
1365 //yy
1366// evas_textblock_cursor_format_prepend(en->cursor, "\t");
1367 _text_filter_format_prepend(en, en->cursor, "\t");
1368 _anchors_get(en->cursor, rp->object, en);
1369 _edje_emit(ed, "entry,changed", rp->part->name);
1370 _edje_emit_full(ed, "entry,changed,user", rp->part->name,
1371 info, _free_entry_change_info);
1372 }
1373 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1374 }
1375 _edje_emit(ed, "entry,key,tab", rp->part->name);
1376 }
1377 else if ((!strcmp(ev->key, "ISO_Left_Tab")) && (multiline))
1378 {
1379 // remove a tab
1380 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1381 }
1382 else if (!strcmp(ev->key, "Prior") || !strcmp(ev->key, "KP_Prior"))
1383 {
1384 if (en->select_allow)
1385 {
1386 if (shift) _sel_start(en->cursor, rp->object, en);
1387 else _sel_clear(en->cursor, rp->object, en);
1388 }
1389 _curs_jump_line_by(en->cursor, rp->object, en, -10);
1390 if (en->select_allow)
1391 {
1392 if (shift) _sel_extend(en->cursor, rp->object, en);
1393 }
1394 _sel_clear(en->cursor, rp->object, en);
1395 _edje_emit(ed, "entry,key,pgup", rp->part->name);
1396 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1397 }
1398 else if (!strcmp(ev->key, "Next") || !strcmp(ev->key, "KP_Next"))
1399 {
1400 if (en->select_allow)
1401 {
1402 if (shift) _sel_start(en->cursor, rp->object, en);
1403 else _sel_clear(en->cursor, rp->object, en);
1404 }
1405 _curs_jump_line_by(en->cursor, rp->object, en, 10);
1406 if (en->select_allow)
1407 {
1408 if (shift) _sel_extend(en->cursor, rp->object, en);
1409 }
1410 _sel_clear(en->cursor, rp->object, en);
1411 _edje_emit(ed, "entry,key,pgdn", rp->part->name);
1412 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1413 }
1414 else if ((!strcmp(ev->key, "Return")) || (!strcmp(ev->key, "KP_Enter")))
1415 {
1416 if (multiline)
1417 {
1418 Edje_Entry_Change_Info *info = calloc(1, sizeof(*info));
1419 info->insert = EINA_TRUE;
1420 info->change.insert.plain_length = 1;
1421 if (en->have_selection)
1422 {
1423 _range_del_emit(ed, en->cursor, rp->object, en);
1424 info->merge = EINA_TRUE;
1425 }
1426 _sel_clear(en->cursor, rp->object, en);
1427
1428 info->change.insert.pos =
1429 evas_textblock_cursor_pos_get(en->cursor);
1430 if (shift)
1431 {
1432 //yy
1433// evas_textblock_cursor_format_prepend(en->cursor, "\n");
1434 _text_filter_format_prepend(en, en->cursor, "\n");
1435 info->change.insert.content = eina_stringshare_add("<\n>");
1436 }
1437 else
1438 {
1439 //yy
1440// evas_textblock_cursor_format_prepend(en->cursor, "ps");
1441 _text_filter_format_prepend(en, en->cursor, "ps");
1442 info->change.insert.content = eina_stringshare_add("<ps>");
1443 }
1444 _anchors_get(en->cursor, rp->object, en);
1445 _edje_emit(ed, "entry,changed", rp->part->name);
1446 _edje_emit_full(ed, "entry,changed,user", rp->part->name,
1447 info, _free_entry_change_info);
1448 _edje_emit(ed, "cursor,changed", rp->part->name);
1449 cursor_changed = EINA_TRUE;
1450 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1451 }
1452 _edje_emit(ed, "entry,key,enter", rp->part->name);
1453 }
1454 else
1455 {
1456 if (ev->string)
1457 {
1458 Edje_Entry_Change_Info *info = calloc(1, sizeof(*info));
1459 info->insert = EINA_TRUE;
1460 info->change.insert.plain_length = 1;
1461 info->change.insert.content = eina_stringshare_add(ev->string);
1462
1463 if (en->have_selection)
1464 {
1465 _range_del_emit(ed, en->cursor, rp->object, en);
1466 info->merge = EINA_TRUE;
1467 }
1468 _sel_clear(en->cursor, rp->object, en);
1469
1470 info->change.insert.pos =
1471 evas_textblock_cursor_pos_get(en->cursor);
1472 // if PASSWORD_SHOW_LAST mode, appending text with password=off tag
1473 if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) &&
1474 _edje_password_show_last)
1475 {
1476 _edje_entry_hide_visible_password(en->rp);
1477 _text_filter_format_prepend(en, en->cursor, "+ password=off");
1478 _text_filter_text_prepend(en, en->cursor, ev->string);
1479 _text_filter_format_prepend(en, en->cursor, "- password");
1480 if (en->pw_timer)
1481 {
1482 ecore_timer_del(en->pw_timer);
1483 en->pw_timer = NULL;
1484 }
1485 en->pw_timer = ecore_timer_add(_edje_password_show_last_timeout,
1486 _password_timer_cb, en);
1487 }
1488 else
1489 _text_filter_text_prepend(en, en->cursor, ev->string);
1490 _anchors_get(en->cursor, rp->object, en);
1491 _edje_emit(ed, "entry,changed", rp->part->name);
1492 _edje_emit_full(ed, "entry,changed,user", rp->part->name,
1493 info, _free_entry_change_info);
1494 _edje_emit(ed, "cursor,changed", rp->part->name);
1495 cursor_changed = EINA_TRUE;
1496 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1497 }
1498 }
1499 if (!cursor_changed && (old_cur_pos != evas_textblock_cursor_pos_get(en->cursor)))
1500 _edje_emit(ed, "cursor,changed", rp->part->name);
1501
1502 _edje_entry_imf_context_reset(en);
1503 _edje_entry_imf_cursor_info_set(en);
1504 _edje_entry_real_part_configure(rp);
1505}
1506
1507static void
1508_edje_key_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1509{
1510 Edje *ed = data;
1511 Edje_Real_Part *rp = ed->focused_part;
1512 Entry *en;
1513
1514 if (!rp) return;
1515 en = rp->entry_data;
1516 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
1517 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE))
1518 return;
1519
1520#ifdef HAVE_ECORE_IMF
1521 if (en->imf_context)
1522 {
1523 Evas_Event_Key_Up *ev = event_info;
1524 Ecore_IMF_Event_Key_Up ecore_ev;
1525
1526 ecore_imf_evas_event_key_up_wrap(ev, &ecore_ev);
1527 if (ecore_imf_context_filter_event(en->imf_context,
1528 ECORE_IMF_EVENT_KEY_UP,
1529 (Ecore_IMF_Event *)&ecore_ev))
1530 return;
1531 }
1532#else
1533 (void) event_info;
1534#endif
1535}
1536
1537static void
1538_edje_part_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1539{
1540 Edje_Real_Part *rp = data;
1541 Entry *en;
1542 if (!rp) return;
1543 en = rp->entry_data;
1544 if (!en) return;
1545 _edje_entry_imf_cursor_info_set(en);
1546}
1547
1548static void
1549_edje_part_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1550{
1551 Evas_Coord cx, cy;
1552 Edje_Real_Part *rp = data;
1553 Evas_Event_Mouse_Down *ev = event_info;
1554 Entry *en;
1555 Evas_Coord x, y, w, h;
1556 // Eina_Bool multiline;
1557 Evas_Textblock_Cursor *tc;
1558 Eina_Bool dosel = EINA_FALSE;
1559 if (!rp) return;
1560 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
1561 en = rp->entry_data;
1562 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
1563 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
1564 return;
1565 if ((ev->button != 1) && (ev->button != 2)) return;
1566
1567#ifdef HAVE_ECORE_IMF
1568 if (en->imf_context)
1569 {
1570 Ecore_IMF_Event_Mouse_Down ecore_ev;
1571 ecore_imf_evas_event_mouse_down_wrap(ev, &ecore_ev);
1572 if (ecore_imf_context_filter_event(en->imf_context,
1573 ECORE_IMF_EVENT_MOUSE_DOWN,
1574 (Ecore_IMF_Event *)&ecore_ev))
1575 return;
1576 }
1577#endif
1578
1579 en->select_mod_start = EINA_FALSE;
1580 en->select_mod_end = EINA_FALSE;
1581 if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_DEFAULT)
1582 dosel = EINA_TRUE;
1583 else if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT)
1584 {
1585 if (en->select_allow) dosel = EINA_TRUE;
1586 }
1587 if (ev->button == 2) dosel = EINA_FALSE;
1588 if (dosel)
1589 {
1590 // double click -> select word
1591 // triple click -> select line
1592 }
1593 tc = evas_object_textblock_cursor_new(rp->object);
1594 evas_textblock_cursor_copy(en->cursor, tc);
1595 // multiline = rp->part->multiline;
1596 evas_object_geometry_get(rp->object, &x, &y, &w, &h);
1597 cx = ev->canvas.x - x;
1598 cy = ev->canvas.y - y;
1599 if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, cy))
1600 {
1601 Evas_Coord lx, ly, lw, lh;
1602 int line;
1603
1604 line = evas_textblock_cursor_line_coord_set(en->cursor, cy);
1605 if (line == -1)
1606 {
1607 if (rp->part->multiline)
1608 _curs_end(en->cursor, rp->object, en);
1609 else
1610 {
1611 evas_textblock_cursor_paragraph_first(en->cursor);
1612 evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
1613 if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, ly + (lh / 2)))
1614 _curs_end(en->cursor, rp->object, en);
1615 }
1616 }
1617 else
1618 {
1619 int lnum;
1620
1621 lnum = evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
1622 if (lnum < 0)
1623 {
1624 _curs_lin_start(en->cursor, rp->object, en);
1625 }
1626 else
1627 {
1628 if (cx <= lx)
1629 _curs_lin_start(en->cursor, rp->object, en);
1630 else
1631 _curs_lin_end(en->cursor, rp->object, en);
1632 }
1633 }
1634 }
1635 if (dosel)
1636 {
1637 if ((en->have_selection) &&
1638 (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT))
1639 {
1640 Eina_List *first, *last;
1641 FLOAT_T sc;
1642
1643 first = en->sel;
1644 last = eina_list_last(en->sel);
1645 if (first && last)
1646 {
1647 Evas_Textblock_Rectangle *r1, *r2;
1648 Evas_Coord d, d1, d2;
1649
1650 r1 = first->data;
1651 r2 = last->data;
1652 d = r1->x - cx;
1653 d1 = d * d;
1654 d = (r1->y + (r1->h / 2)) - cy;
1655 d1 += d * d;
1656 d = r2->x + r2->w - 1 - cx;
1657 d2 = d * d;
1658 d = (r2->y + (r2->h / 2)) - cy;
1659 d2 += d * d;
1660 sc = rp->edje->scale;
1661 if (sc == ZERO) sc = _edje_scale;
1662 d = (Evas_Coord)MUL(FROM_INT(20), sc); // FIXME: maxing number!
1663 d = d * d;
1664 if (d1 < d2)
1665 {
1666 if (d1 <= d)
1667 {
1668 en->select_mod_start = EINA_TRUE;
1669 en->selecting = EINA_TRUE;
1670 }
1671 }
1672 else
1673 {
1674 if (d2 <= d)
1675 {
1676 en->select_mod_end = EINA_TRUE;
1677 en->selecting = EINA_TRUE;
1678 }
1679 }
1680 }
1681 }
1682 else
1683 {
1684 en->selecting = EINA_TRUE;
1685 _sel_clear(en->cursor, rp->object, en);
1686 if (en->select_allow)
1687 {
1688 _sel_start(en->cursor, rp->object, en);
1689 }
1690 }
1691 }
1692 if (evas_textblock_cursor_compare(tc, en->cursor))
1693 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
1694 evas_textblock_cursor_free(tc);
1695
1696 _edje_entry_imf_context_reset(en);
1697 _edje_entry_imf_cursor_info_set(en);
1698
1699 _edje_entry_real_part_configure(rp);
1700 if (ev->button == 2)
1701 {
1702 _edje_emit(rp->edje, "entry,paste,request", rp->part->name);
1703 _edje_emit(rp->edje, "entry,paste,request,1", rp->part->name);
1704 }
1705}
1706
1707static void
1708_edje_part_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1709{
1710 Evas_Coord cx, cy;
1711 Edje_Real_Part *rp = data;
1712 Evas_Event_Mouse_Up *ev = event_info;
1713 Entry *en;
1714 Evas_Coord x, y, w, h;
1715 Evas_Textblock_Cursor *tc;
1716 if (ev->button != 1) return;
1717 if (!rp) return;
1718 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
1719 en = rp->entry_data;
1720 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
1721 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
1722 return;
1723
1724#ifdef HAVE_ECORE_IMF
1725 if (en->imf_context)
1726 {
1727 Ecore_IMF_Event_Mouse_Up ecore_ev;
1728 ecore_imf_evas_event_mouse_up_wrap(ev, &ecore_ev);
1729 if (ecore_imf_context_filter_event(en->imf_context,
1730 ECORE_IMF_EVENT_MOUSE_UP,
1731 (Ecore_IMF_Event *)&ecore_ev))
1732 return;
1733 }
1734#endif
1735
1736 tc = evas_object_textblock_cursor_new(rp->object);
1737 evas_textblock_cursor_copy(en->cursor, tc);
1738 evas_object_geometry_get(rp->object, &x, &y, &w, &h);
1739 cx = ev->canvas.x - x;
1740 cy = ev->canvas.y - y;
1741 if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, cy))
1742 {
1743 Evas_Coord lx, ly, lw, lh;
1744 int line;
1745
1746 line = evas_textblock_cursor_line_coord_set(en->cursor, cy);
1747 if (line == -1)
1748 {
1749 if (rp->part->multiline)
1750 _curs_end(en->cursor, rp->object, en);
1751 else
1752 {
1753 evas_textblock_cursor_paragraph_first(en->cursor);
1754 evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
1755 if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, ly + (lh / 2)))
1756 _curs_end(en->cursor, rp->object, en);
1757 }
1758 }
1759 else
1760 {
1761 int lnum;
1762
1763 lnum = evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
1764 if (lnum < 0)
1765 {
1766 _curs_lin_start(en->cursor, rp->object, en);
1767 }
1768 else
1769 {
1770 if (cx <= lx)
1771 _curs_lin_start(en->cursor, rp->object, en);
1772 else
1773 _curs_lin_end(en->cursor, rp->object, en);
1774 }
1775 }
1776 }
1777 if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT)
1778 {
1779 if (en->select_allow)
1780 {
1781 if (en->had_sel)
1782 {
1783 if (en->select_mod_end)
1784 _sel_extend(en->cursor, rp->object, en);
1785 else if (en->select_mod_start)
1786 _sel_preextend(en->cursor, rp->object, en);
1787 }
1788 else
1789 _sel_extend(en->cursor, rp->object, en);
1790 //evas_textblock_cursor_copy(en->cursor, en->sel_end);
1791 }
1792 }
1793 else
1794 evas_textblock_cursor_copy(en->cursor, en->sel_end);
1795 if (en->selecting)
1796 {
1797 if (en->have_selection)
1798 en->had_sel = EINA_TRUE;
1799 en->selecting = EINA_FALSE;
1800 }
1801 if (evas_textblock_cursor_compare(tc, en->cursor))
1802 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
1803 evas_textblock_cursor_free(tc);
1804
1805 _edje_entry_imf_context_reset(en);
1806 _edje_entry_imf_cursor_info_set(en);
1807 _edje_entry_real_part_configure(rp);
1808}
1809
1810static void
1811_edje_part_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1812{
1813 Evas_Coord cx, cy;
1814 Edje_Real_Part *rp = data;
1815 Evas_Event_Mouse_Move *ev = event_info;
1816 Entry *en;
1817 Evas_Coord x, y, w, h;
1818 Evas_Textblock_Cursor *tc;
1819 if (!rp) return;
1820 en = rp->entry_data;
1821 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
1822 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
1823 return;
1824
1825#ifdef HAVE_ECORE_IMF
1826 if (en->imf_context)
1827 {
1828 Ecore_IMF_Event_Mouse_Move ecore_ev;
1829 ecore_imf_evas_event_mouse_move_wrap(ev, &ecore_ev);
1830 if (ecore_imf_context_filter_event(en->imf_context,
1831 ECORE_IMF_EVENT_MOUSE_MOVE,
1832 (Ecore_IMF_Event *)&ecore_ev))
1833 return;
1834 }
1835#endif
1836
1837 if (en->selecting)
1838 {
1839 tc = evas_object_textblock_cursor_new(rp->object);
1840 evas_textblock_cursor_copy(en->cursor, tc);
1841 evas_object_geometry_get(rp->object, &x, &y, &w, &h);
1842 cx = ev->cur.canvas.x - x;
1843 cy = ev->cur.canvas.y - y;
1844 if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, cy))
1845 {
1846 Evas_Coord lx, ly, lw, lh;
1847
1848 if (evas_textblock_cursor_line_coord_set(en->cursor, cy) < 0)
1849 {
1850 if (rp->part->multiline)
1851 _curs_end(en->cursor, rp->object, en);
1852 else
1853 {
1854 evas_textblock_cursor_paragraph_first(en->cursor);
1855 evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
1856 if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, ly + (lh / 2)))
1857 _curs_end(en->cursor, rp->object, en);
1858 }
1859 }
1860 else
1861 {
1862 evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
1863 if (cx <= lx)
1864 _curs_lin_start(en->cursor, rp->object, en);
1865 else
1866 _curs_lin_end(en->cursor, rp->object, en);
1867 }
1868 }
1869 if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT)
1870 {
1871 if (en->select_allow)
1872 {
1873 if (en->had_sel)
1874 {
1875 if (en->select_mod_end)
1876 _sel_extend(en->cursor, rp->object, en);
1877 else if (en->select_mod_start)
1878 _sel_preextend(en->cursor, rp->object, en);
1879 }
1880 else
1881 _sel_extend(en->cursor, rp->object, en);
1882 }
1883 }
1884 else
1885 {
1886 _sel_extend(en->cursor, rp->object, en);
1887 }
1888 if (en->select_allow)
1889 {
1890 if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) != 0)
1891 _sel_enable(en->cursor, rp->object, en);
1892 if (en->have_selection)
1893 _sel_update(en->cursor, rp->object, en);
1894 }
1895 if (evas_textblock_cursor_compare(tc, en->cursor))
1896 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
1897 evas_textblock_cursor_free(tc);
1898
1899 _edje_entry_imf_context_reset(en);
1900 _edje_entry_imf_cursor_info_set(en);
1901
1902 _edje_entry_real_part_configure(rp);
1903 }
1904}
1905
1906static void
1907_evas_focus_in_cb(void *data, Evas *e, __UNUSED__ void *event_info)
1908{
1909 Edje *ed = (Edje *)data;
1910
1911 if (evas_focus_get(e) == ed->obj)
1912 {
1913 _edje_focus_in_cb(data, NULL, NULL, NULL);
1914 }
1915}
1916
1917static void
1918_evas_focus_out_cb(void *data, Evas *e, __UNUSED__ void *event_info)
1919{
1920 Edje *ed = (Edje *)data;
1921
1922 if (evas_focus_get(e) == ed->obj)
1923 {
1924 _edje_focus_out_cb(data, NULL, NULL, NULL);
1925 }
1926}
1927
1928/***************************************************************/
1929void
1930_edje_entry_init(Edje *ed)
1931{
1932 if (!ed->has_entries)
1933 return;
1934 if (ed->entries_inited)
1935 return;
1936 ed->entries_inited = EINA_TRUE;
1937
1938 evas_object_event_callback_add(ed->obj, EVAS_CALLBACK_FOCUS_IN, _edje_focus_in_cb, ed);
1939 evas_object_event_callback_add(ed->obj, EVAS_CALLBACK_FOCUS_OUT, _edje_focus_out_cb, ed);
1940 evas_object_event_callback_add(ed->obj, EVAS_CALLBACK_KEY_DOWN, _edje_key_down_cb, ed);
1941 evas_object_event_callback_add(ed->obj, EVAS_CALLBACK_KEY_UP, _edje_key_up_cb, ed);
1942 evas_event_callback_add(ed->base.evas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _evas_focus_in_cb, ed);
1943 evas_event_callback_add(ed->base.evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, _evas_focus_out_cb, ed);
1944}
1945
1946void
1947_edje_entry_shutdown(Edje *ed)
1948{
1949 if (!ed->has_entries)
1950 return;
1951 if (!ed->entries_inited)
1952 return;
1953 ed->entries_inited = EINA_FALSE;
1954
1955 evas_object_event_callback_del(ed->obj, EVAS_CALLBACK_FOCUS_IN, _edje_focus_in_cb);
1956 evas_object_event_callback_del(ed->obj, EVAS_CALLBACK_FOCUS_OUT, _edje_focus_out_cb);
1957 evas_object_event_callback_del(ed->obj, EVAS_CALLBACK_KEY_DOWN, _edje_key_down_cb);
1958 evas_object_event_callback_del(ed->obj, EVAS_CALLBACK_KEY_UP, _edje_key_up_cb);
1959 if (evas_event_callback_del_full(ed->base.evas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _evas_focus_in_cb, ed) != ed)
1960 ERR("could not unregister EVAS_CALLBACK_FOCUS_IN");
1961 if (evas_event_callback_del_full(ed->base.evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, _evas_focus_out_cb, ed) != ed)
1962 ERR("could not unregister EVAS_CALLBACK_FOCUS_OUT");
1963}
1964
1965void
1966_edje_entry_real_part_init(Edje_Real_Part *rp)
1967{
1968 Entry *en;
1969#ifdef HAVE_ECORE_IMF
1970 const char *ctx_id;
1971 const Ecore_IMF_Context_Info *ctx_info;
1972#endif
1973
1974 en = calloc(1, sizeof(Entry));
1975 if (!en) return;
1976 rp->entry_data = en;
1977 en->rp = rp;
1978
1979 evas_object_event_callback_add(rp->object, EVAS_CALLBACK_MOVE, _edje_part_move_cb, rp);
1980
1981 evas_object_event_callback_add(rp->object, EVAS_CALLBACK_MOUSE_DOWN, _edje_part_mouse_down_cb, rp);
1982 evas_object_event_callback_add(rp->object, EVAS_CALLBACK_MOUSE_UP, _edje_part_mouse_up_cb, rp);
1983 evas_object_event_callback_add(rp->object, EVAS_CALLBACK_MOUSE_MOVE, _edje_part_mouse_move_cb, rp);
1984
1985 if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_DEFAULT)
1986 en->select_allow = EINA_TRUE;
1987
1988 if (rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD)
1989 {
1990 Edje_Part_Description_Text *txt;
1991
1992 txt = (Edje_Part_Description_Text *)rp->chosen_description;
1993
1994 en->select_allow = EINA_FALSE;
1995 if (txt && edje_string_get(&txt->text.repch))
1996 evas_object_textblock_replace_char_set(rp->object, edje_string_get(&txt->text.repch));
1997 else
1998 evas_object_textblock_replace_char_set(rp->object, "*");
1999 }
2000
2001 en->cursor_bg = edje_object_add(rp->edje->base.evas);
2002 edje_object_file_set(en->cursor_bg, rp->edje->path, rp->part->source3);
2003 evas_object_smart_member_add(en->cursor_bg, rp->edje->obj);
2004 evas_object_stack_below(en->cursor_bg, rp->object);
2005 evas_object_clip_set(en->cursor_bg, evas_object_clip_get(rp->object));
2006 evas_object_pass_events_set(en->cursor_bg, EINA_TRUE);
2007 _edje_subobj_register(en->rp->edje, en->cursor_bg);
2008
2009 en->cursor_fg = edje_object_add(rp->edje->base.evas);
2010 edje_object_file_set(en->cursor_fg, rp->edje->path, rp->part->source4);
2011 evas_object_smart_member_add(en->cursor_fg, rp->edje->obj);
2012 evas_object_stack_above(en->cursor_fg, rp->object);
2013 evas_object_clip_set(en->cursor_fg, evas_object_clip_get(rp->object));
2014 evas_object_pass_events_set(en->cursor_fg, EINA_TRUE);
2015 _edje_subobj_register(en->rp->edje, en->cursor_fg);
2016
2017 if (rp->part->entry_mode >= EDJE_ENTRY_EDIT_MODE_EDITABLE)
2018 {
2019 evas_object_show(en->cursor_bg);
2020 evas_object_show(en->cursor_fg);
2021#ifdef HAVE_ECORE_IMF
2022 ecore_imf_init();
2023
2024 edje_object_signal_callback_add(rp->edje->obj, "focus,part,in", rp->part->name, _edje_entry_focus_in_cb, rp);
2025 edje_object_signal_callback_add(rp->edje->obj, "focus,part,out", rp->part->name, _edje_entry_focus_out_cb, rp);
2026
2027 ctx_id = ecore_imf_context_default_id_get();
2028 if (ctx_id)
2029 {
2030 ctx_info = ecore_imf_context_info_by_id_get(ctx_id);
2031 if (!ctx_info->canvas_type ||
2032 strcmp(ctx_info->canvas_type, "evas") == 0)
2033 {
2034 en->imf_context = ecore_imf_context_add(ctx_id);
2035 }
2036 else
2037 {
2038 ctx_id = ecore_imf_context_default_id_by_canvas_type_get("evas");
2039 if (ctx_id)
2040 {
2041 en->imf_context = ecore_imf_context_add(ctx_id);
2042 }
2043 }
2044 }
2045 else
2046 en->imf_context = NULL;
2047
2048 if (!en->imf_context) goto done;
2049
2050 ecore_imf_context_client_window_set
2051 (en->imf_context,
2052 (void *)ecore_evas_window_get
2053 (ecore_evas_ecore_evas_get(rp->edje->base.evas)));
2054 ecore_imf_context_client_canvas_set(en->imf_context, rp->edje->base.evas);
2055
2056 ecore_imf_context_retrieve_surrounding_callback_set(en->imf_context,
2057 _edje_entry_imf_retrieve_surrounding_cb, rp->edje);
2058 en->imf_ee_handler_commit = ecore_event_handler_add(ECORE_IMF_EVENT_COMMIT, _edje_entry_imf_event_commit_cb, rp->edje);
2059 en->imf_ee_handler_delete = ecore_event_handler_add(ECORE_IMF_EVENT_DELETE_SURROUNDING, _edje_entry_imf_event_delete_surrounding_cb, rp->edje);
2060 en->imf_ee_handler_changed = ecore_event_handler_add(ECORE_IMF_EVENT_PREEDIT_CHANGED, _edje_entry_imf_event_preedit_changed_cb, rp->edje);
2061 ecore_imf_context_input_mode_set(en->imf_context,
2062 rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD ?
2063 ECORE_IMF_INPUT_MODE_INVISIBLE : ECORE_IMF_INPUT_MODE_FULL);
2064#endif
2065 }
2066#ifdef HAVE_ECORE_IMF
2067done:
2068#endif
2069 en->cursor = (Evas_Textblock_Cursor *)evas_object_textblock_cursor_get(rp->object);
2070}
2071
2072void
2073_edje_entry_real_part_shutdown(Edje_Real_Part *rp)
2074{
2075 Entry *en = rp->entry_data;
2076 if (!en) return;
2077 rp->entry_data = NULL;
2078 _sel_clear(en->cursor, rp->object, en);
2079 _anchors_clear(en->cursor, rp->object, en);
2080#ifdef HAVE_ECORE_IMF
2081 _preedit_clear(en);
2082#endif
2083 evas_object_del(en->cursor_bg);
2084 evas_object_del(en->cursor_fg);
2085
2086 if (en->pw_timer)
2087 {
2088 ecore_timer_del(en->pw_timer);
2089 en->pw_timer = NULL;
2090 }
2091
2092#ifdef HAVE_ECORE_IMF
2093 if (rp->part->entry_mode >= EDJE_ENTRY_EDIT_MODE_EDITABLE)
2094 {
2095 if (en->imf_context)
2096 {
2097 if (en->imf_ee_handler_commit)
2098 {
2099 ecore_event_handler_del(en->imf_ee_handler_commit);
2100 en->imf_ee_handler_commit = NULL;
2101 }
2102
2103 if (en->imf_ee_handler_delete)
2104 {
2105 ecore_event_handler_del(en->imf_ee_handler_delete);
2106 en->imf_ee_handler_delete = NULL;
2107 }
2108
2109 if (en->imf_ee_handler_changed)
2110 {
2111 ecore_event_handler_del(en->imf_ee_handler_changed);
2112 en->imf_ee_handler_changed = NULL;
2113 }
2114
2115 ecore_imf_context_del(en->imf_context);
2116 en->imf_context = NULL;
2117 }
2118
2119 edje_object_signal_callback_del(rp->edje->obj, "focus,part,in", rp->part->name, _edje_entry_focus_in_cb);
2120 edje_object_signal_callback_del(rp->edje->obj, "focus,part,out", rp->part->name, _edje_entry_focus_out_cb);
2121 ecore_imf_shutdown();
2122 }
2123#endif
2124
2125 free(en);
2126}
2127
2128void
2129_edje_entry_real_part_configure(Edje_Real_Part *rp)
2130{
2131 Evas_Coord x, y, w, h, xx, yy, ww, hh;
2132 Entry *en = rp->entry_data;
2133 Evas_Textblock_Cursor_Type cur_type;
2134 if (!en) return;
2135 switch (rp->part->cursor_mode)
2136 {
2137 case EDJE_ENTRY_CURSOR_MODE_BEFORE:
2138 cur_type = EVAS_TEXTBLOCK_CURSOR_BEFORE;
2139 break;
2140 case EDJE_ENTRY_CURSOR_MODE_UNDER:
2141 /* no break for a resaon */
2142 default:
2143 cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER;
2144 }
2145
2146 _sel_update(en->cursor, rp->object, en);
2147 _anchors_update(en->cursor, rp->object, en);
2148 x = y = w = h = -1;
2149 xx = yy = ww = hh = -1;
2150 evas_object_geometry_get(rp->object, &x, &y, &w, &h);
2151 evas_textblock_cursor_geometry_get(en->cursor, &xx, &yy, &ww, &hh, NULL, cur_type);
2152 if (ww < 1) ww = 1;
2153 if (hh < 1) hh = 1;
2154 if (en->cursor_bg)
2155 {
2156 evas_object_move(en->cursor_bg, x + xx, y + yy);
2157 evas_object_resize(en->cursor_bg, ww, hh);
2158 }
2159 if (en->cursor_fg)
2160 {
2161 evas_object_move(en->cursor_fg, x + xx, y + yy);
2162 evas_object_resize(en->cursor_fg, ww, hh);
2163 }
2164}
2165
2166const char *
2167_edje_entry_selection_get(Edje_Real_Part *rp)
2168{
2169 Entry *en = rp->entry_data;
2170 if (!en) return NULL;
2171 // get selection - convert to markup
2172 if ((!en->selection) && (en->have_selection))
2173 en->selection = evas_textblock_cursor_range_text_get
2174 (en->sel_start, en->sel_end, EVAS_TEXTBLOCK_TEXT_MARKUP);
2175 return en->selection;
2176}
2177
2178const char *
2179_edje_entry_text_get(Edje_Real_Part *rp)
2180{
2181 Entry *en = rp->entry_data;
2182 if (!en) return NULL;
2183 // get text - convert to markup
2184 return evas_object_textblock_text_markup_get(rp->object);
2185}
2186
2187void
2188_edje_entry_text_markup_set(Edje_Real_Part *rp, const char *text)
2189{
2190 Entry *en = rp->entry_data;
2191 if (!en) return;
2192
2193 // set text as markup
2194 _sel_clear(en->cursor, rp->object, en);
2195 evas_object_textblock_text_markup_set(rp->object, text);
2196 _edje_entry_set_cursor_start(rp);
2197
2198 _anchors_get(en->cursor, rp->object, en);
2199 _edje_emit(rp->edje, "entry,changed", rp->part->name);
2200 _edje_entry_imf_cursor_info_set(en);
2201#if 0
2202 /* Don't emit cursor changed cause it didn't. It's just init to 0. */
2203 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
2204#endif
2205}
2206
2207void
2208_edje_entry_text_markup_append(Edje_Real_Part *rp, const char *text)
2209{
2210 Entry *en = rp->entry_data;
2211 Evas_Textblock_Cursor *end_cur;
2212 if (!en) return;
2213 end_cur = evas_object_textblock_cursor_new(rp->object);
2214 evas_textblock_cursor_paragraph_last(end_cur);
2215
2216 _text_filter_markup_prepend(en, end_cur, text);
2217 evas_textblock_cursor_free(end_cur);
2218
2219 /* We are updating according to the real cursor on purpose */
2220 _anchors_get(en->cursor, rp->object, en);
2221 _edje_emit(rp->edje, "entry,changed", rp->part->name);
2222
2223 _edje_entry_real_part_configure(rp);
2224}
2225
2226void
2227_edje_entry_text_markup_insert(Edje_Real_Part *rp, const char *text)
2228{
2229 Entry *en = rp->entry_data;
2230 if (!en) return;
2231 // prepend markup @ cursor pos
2232 if (en->have_selection)
2233 _range_del(en->cursor, rp->object, en);
2234 _sel_clear(en->cursor, rp->object, en);
2235 //xx
2236// evas_object_textblock_text_markup_prepend(en->cursor, text);
2237 _text_filter_markup_prepend(en, en->cursor, text);
2238 _anchors_get(en->cursor, rp->object, en);
2239 _edje_emit(rp->edje, "entry,changed", rp->part->name);
2240 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
2241
2242 _edje_entry_imf_context_reset(en);
2243 _edje_entry_imf_cursor_info_set(en);
2244
2245 _edje_entry_real_part_configure(rp);
2246}
2247
2248void
2249_edje_entry_set_cursor_start(Edje_Real_Part *rp)
2250{
2251 Entry *en = rp->entry_data;
2252 if (!en) return;
2253 _curs_start(en->cursor, rp->object, en);
2254
2255 _edje_entry_imf_cursor_info_set(en);
2256}
2257
2258void
2259_edje_entry_set_cursor_end(Edje_Real_Part *rp)
2260{
2261 Entry *en = rp->entry_data;
2262 if (!en) return;
2263 _curs_end(en->cursor, rp->object, en);
2264
2265 _edje_entry_imf_cursor_info_set(en);
2266}
2267
2268void
2269_edje_entry_select_none(Edje_Real_Part *rp)
2270{
2271 Entry *en = rp->entry_data;
2272 if (!en) return;
2273 _sel_clear(en->cursor, rp->object, en);
2274}
2275
2276void
2277_edje_entry_select_all(Edje_Real_Part *rp)
2278{
2279 Entry *en = rp->entry_data;
2280 if (!en) return;
2281 _sel_clear(en->cursor, rp->object, en);
2282 _curs_start(en->cursor, rp->object, en);
2283 _sel_enable(en->cursor, rp->object, en);
2284 _sel_start(en->cursor, rp->object, en);
2285 _curs_end(en->cursor, rp->object, en);
2286 _sel_extend(en->cursor, rp->object, en);
2287
2288 _edje_entry_imf_context_reset(en);
2289 _edje_entry_imf_cursor_info_set(en);
2290 _edje_entry_real_part_configure(rp);
2291}
2292
2293void
2294_edje_entry_select_begin(Edje_Real_Part *rp)
2295{
2296 Entry *en = rp->entry_data;
2297 if (!en) return;
2298 _sel_clear(en->cursor, rp->object, en);
2299 _sel_enable(en->cursor, rp->object, en);
2300 _sel_start(en->cursor, rp->object, en);
2301 _sel_extend(en->cursor, rp->object, en);
2302
2303 _edje_entry_imf_context_reset(en);
2304 _edje_entry_imf_cursor_info_set(en);
2305
2306 _edje_entry_real_part_configure(rp);
2307}
2308
2309void
2310_edje_entry_select_extend(Edje_Real_Part *rp)
2311{
2312 Entry *en = rp->entry_data;
2313 if (!en) return;
2314 _sel_extend(en->cursor, rp->object, en);
2315
2316 _edje_entry_imf_context_reset(en);
2317 _edje_entry_imf_cursor_info_set(en);
2318
2319 _edje_entry_real_part_configure(rp);
2320}
2321
2322const Eina_List *
2323_edje_entry_anchor_geometry_get(Edje_Real_Part *rp, const char *anchor)
2324{
2325 Entry *en = rp->entry_data;
2326 Eina_List *l;
2327 Anchor *an;
2328
2329 if (!en) return NULL;
2330 EINA_LIST_FOREACH(en->anchors, l, an)
2331 {
2332 if (an->item) continue;
2333 if (!strcmp(anchor, an->name))
2334 return an->sel;
2335 }
2336 return NULL;
2337}
2338
2339const Eina_List *
2340_edje_entry_anchors_list(Edje_Real_Part *rp)
2341{
2342 Entry *en = rp->entry_data;
2343 Eina_List *l, *anchors = NULL;
2344 Anchor *an;
2345
2346 if (!en) return NULL;
2347 if (!en->anchorlist)
2348 {
2349 EINA_LIST_FOREACH(en->anchors, l, an)
2350 {
2351 const char *n = an->name;
2352 if (an->item) continue;
2353 if (!n) n = "";
2354 anchors = eina_list_append(anchors, strdup(n));
2355 }
2356 en->anchorlist = anchors;
2357 }
2358 return en->anchorlist;
2359}
2360
2361Eina_Bool
2362_edje_entry_item_geometry_get(Edje_Real_Part *rp, const char *item, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
2363{
2364 Entry *en = rp->entry_data;
2365 Eina_List *l;
2366 Anchor *an;
2367
2368 if (!en) return EINA_FALSE;
2369 EINA_LIST_FOREACH(en->anchors, l, an)
2370 {
2371 if (an->item) continue;
2372 if (!strcmp(item, an->name))
2373 {
2374 evas_textblock_cursor_format_item_geometry_get(an->start, cx, cy, cw, ch);
2375 return EINA_TRUE;
2376 }
2377 }
2378 return EINA_FALSE;
2379}
2380
2381const Eina_List *
2382_edje_entry_items_list(Edje_Real_Part *rp)
2383{
2384 Entry *en = rp->entry_data;
2385 Eina_List *l, *items = NULL;
2386 Anchor *an;
2387
2388 if (!en) return NULL;
2389 if (!en->itemlist)
2390 {
2391 EINA_LIST_FOREACH(en->anchors, l, an)
2392 {
2393 const char *n = an->name;
2394 if (an->item) continue;
2395 if (!n) n = "";
2396 items = eina_list_append(items, strdup(n));
2397 }
2398 en->itemlist = items;
2399 }
2400 return en->itemlist;
2401}
2402
2403void
2404_edje_entry_cursor_geometry_get(Edje_Real_Part *rp, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
2405{
2406 Evas_Coord x, y, w, h, xx, yy, ww, hh;
2407 Entry *en = rp->entry_data;
2408 Evas_Textblock_Cursor_Type cur_type;
2409 if (!en) return;
2410 switch (rp->part->cursor_mode)
2411 {
2412 case EDJE_ENTRY_CURSOR_MODE_BEFORE:
2413 cur_type = EVAS_TEXTBLOCK_CURSOR_BEFORE;
2414 break;
2415 case EDJE_ENTRY_CURSOR_MODE_UNDER:
2416 /* no break for a resaon */
2417 default:
2418 cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER;
2419 }
2420
2421 x = y = w = h = -1;
2422 xx = yy = ww = hh = -1;
2423 evas_object_geometry_get(rp->object, &x, &y, &w, &h);
2424 evas_textblock_cursor_geometry_get(en->cursor, &xx, &yy, &ww, &hh, NULL, cur_type);
2425 if (ww < 1) ww = 1;
2426 if (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE)
2427 edje_object_size_min_restricted_calc(en->cursor_fg, &ww, NULL, ww, 0);
2428 if (hh < 1) hh = 1;
2429 if (cx) *cx = x + xx;
2430 if (cy) *cy = y + yy;
2431 if (cw) *cw = ww;
2432 if (ch) *ch = hh;
2433}
2434
2435void
2436_edje_entry_select_allow_set(Edje_Real_Part *rp, Eina_Bool allow)
2437{
2438 Entry *en = rp->entry_data;
2439 if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_DEFAULT)
2440 return;
2441 en->select_allow = allow;
2442}
2443
2444Eina_Bool
2445_edje_entry_select_allow_get(const Edje_Real_Part *rp)
2446{
2447 const Entry *en = rp->entry_data;
2448 return en->select_allow;
2449}
2450
2451void
2452_edje_entry_select_abort(Edje_Real_Part *rp)
2453{
2454 Entry *en = rp->entry_data;
2455 if (en->selecting)
2456 {
2457 en->selecting = EINA_FALSE;
2458
2459 _edje_entry_imf_context_reset(en);
2460 _edje_entry_imf_cursor_info_set(en);
2461 _edje_entry_real_part_configure(rp);
2462 }
2463}
2464
2465void
2466_edje_entry_autocapital_type_set(Edje_Real_Part *rp, Edje_Text_Autocapital_Type autocapital_type)
2467{
2468 Entry *en = rp->entry_data;
2469 if (!en) return;
2470
2471 if (rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD)
2472 autocapital_type = EDJE_TEXT_AUTOCAPITAL_TYPE_NONE;
2473
2474#ifdef HAVE_ECORE_IMF
2475 if (en->imf_context)
2476 ecore_imf_context_autocapital_type_set(en->imf_context, autocapital_type);
2477#endif
2478}
2479
2480Edje_Text_Autocapital_Type
2481_edje_entry_autocapital_type_get(Edje_Real_Part *rp)
2482{
2483 Entry *en = rp->entry_data;
2484 if (!en) return EDJE_TEXT_AUTOCAPITAL_TYPE_NONE;
2485
2486#ifdef HAVE_ECORE_IMF
2487 if (en->imf_context)
2488 return ecore_imf_context_autocapital_type_get(en->imf_context);
2489#endif
2490
2491 return EDJE_TEXT_AUTOCAPITAL_TYPE_NONE;
2492}
2493
2494void
2495_edje_entry_input_panel_enabled_set(Edje_Real_Part *rp, Eina_Bool enabled)
2496{
2497 Entry *en = rp->entry_data;
2498
2499 if (!en) return;
2500#ifdef HAVE_ECORE_IMF
2501 if (en->imf_context)
2502 ecore_imf_context_input_panel_enabled_set(en->imf_context, enabled);
2503#else
2504 (void) enabled;
2505#endif
2506}
2507
2508Eina_Bool
2509_edje_entry_input_panel_enabled_get(Edje_Real_Part *rp)
2510{
2511 Entry *en = rp->entry_data;
2512 if (!en) return EINA_FALSE;
2513#ifdef HAVE_ECORE_IMF
2514 if (en->imf_context)
2515 return ecore_imf_context_input_panel_enabled_get(en->imf_context);
2516#endif
2517
2518 return EINA_FALSE;
2519}
2520
2521static Evas_Textblock_Cursor *
2522_cursor_get(Edje_Real_Part *rp, Edje_Cursor cur)
2523{
2524 Entry *en = rp->entry_data;
2525 if (!en) return NULL;
2526
2527 switch (cur)
2528 {
2529 case EDJE_CURSOR_MAIN:
2530 return en->cursor;
2531 case EDJE_CURSOR_SELECTION_BEGIN:
2532 return en->sel_start;
2533 case EDJE_CURSOR_SELECTION_END:
2534 return en->sel_end;
2535 case EDJE_CURSOR_PREEDIT_START:
2536 if (!en->preedit_start)
2537 en->preedit_start = evas_object_textblock_cursor_new(rp->object);
2538 return en->preedit_start;
2539 case EDJE_CURSOR_PREEDIT_END:
2540 if (!en->preedit_end)
2541 en->preedit_end = evas_object_textblock_cursor_new(rp->object);
2542 return en->preedit_end;
2543 case EDJE_CURSOR_USER:
2544 if (!en->cursor_user)
2545 en->cursor_user = evas_object_textblock_cursor_new(rp->object);
2546 return en->cursor_user;
2547 case EDJE_CURSOR_USER_EXTRA:
2548 if (!en->cursor_user_extra)
2549 en->cursor_user_extra = evas_object_textblock_cursor_new(rp->object);
2550 return en->cursor_user_extra;
2551 default:
2552 break;
2553 }
2554 return NULL;
2555}
2556
2557Eina_Bool
2558_edje_entry_cursor_next(Edje_Real_Part *rp, Edje_Cursor cur)
2559{
2560 Entry *en = rp->entry_data;
2561 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
2562 if (!c) return EINA_FALSE;
2563 if (!evas_textblock_cursor_char_next(c))
2564 {
2565 return EINA_FALSE;
2566 }
2567 _sel_update(c, rp->object, rp->entry_data);
2568
2569 _edje_entry_imf_context_reset(en);
2570 _edje_entry_imf_cursor_info_set(en);
2571
2572 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
2573 _edje_entry_real_part_configure(rp);
2574 return EINA_TRUE;
2575}
2576
2577Eina_Bool
2578_edje_entry_cursor_prev(Edje_Real_Part *rp, Edje_Cursor cur)
2579{
2580 Entry *en = rp->entry_data;
2581 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
2582 if (!c) return EINA_FALSE;
2583 if (!evas_textblock_cursor_char_prev(c))
2584 {
2585 if (evas_textblock_cursor_paragraph_prev(c)) goto ok;
2586 else return EINA_FALSE;
2587 }
2588ok:
2589 _sel_update(c, rp->object, rp->entry_data);
2590
2591 _edje_entry_imf_context_reset(en);
2592 _edje_entry_imf_cursor_info_set(en);
2593
2594 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
2595 _edje_entry_real_part_configure(rp);
2596 return EINA_TRUE;
2597}
2598
2599Eina_Bool
2600_edje_entry_cursor_up(Edje_Real_Part *rp, Edje_Cursor cur)
2601{
2602 Entry *en = rp->entry_data;
2603 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
2604 Evas_Coord lx, ly, lw, lh, cx, cy, cw, ch;
2605 int ln;
2606 if (!c) return EINA_FALSE;
2607 ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL);
2608 ln--;
2609 if (ln < 0) return EINA_FALSE;
2610 if (!evas_object_textblock_line_number_geometry_get(rp->object, ln,
2611 &lx, &ly, &lw, &lh))
2612 return EINA_FALSE;
2613 evas_textblock_cursor_char_geometry_get(c, &cx, &cy, &cw, &ch);
2614 if (!evas_textblock_cursor_char_coord_set(c, cx, ly + (lh / 2)))
2615 {
2616 if (cx < (lx + (lw / 2)))
2617 evas_textblock_cursor_line_char_last(c);
2618 else
2619 evas_textblock_cursor_line_char_last(c);
2620 }
2621 _sel_update(c, rp->object, rp->entry_data);
2622
2623 _edje_entry_imf_context_reset(en);
2624 _edje_entry_imf_cursor_info_set(en);
2625
2626 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
2627 _edje_entry_real_part_configure(rp);
2628 return EINA_TRUE;
2629}
2630
2631Eina_Bool
2632_edje_entry_cursor_down(Edje_Real_Part *rp, Edje_Cursor cur)
2633{
2634 Entry *en = rp->entry_data;
2635 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
2636 Evas_Coord lx, ly, lw, lh, cx, cy, cw, ch;
2637 int ln;
2638 if (!c) return EINA_FALSE;
2639 ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL);
2640 ln++;
2641 if (!evas_object_textblock_line_number_geometry_get(rp->object, ln,
2642 &lx, &ly, &lw, &lh))
2643 return EINA_FALSE;
2644 evas_textblock_cursor_char_geometry_get(c, &cx, &cy, &cw, &ch);
2645 if (!evas_textblock_cursor_char_coord_set(c, cx, ly + (lh / 2)))
2646 {
2647 if (cx < (lx + (lw / 2)))
2648 evas_textblock_cursor_line_char_last(c);
2649 else
2650 evas_textblock_cursor_line_char_last(c);
2651 }
2652 _sel_update(c, rp->object, rp->entry_data);
2653
2654 _edje_entry_imf_context_reset(en);
2655 _edje_entry_imf_cursor_info_set(en);
2656 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
2657 _edje_entry_real_part_configure(rp);
2658 return EINA_TRUE;
2659}
2660
2661void
2662_edje_entry_cursor_begin(Edje_Real_Part *rp, Edje_Cursor cur)
2663{
2664 Entry *en = rp->entry_data;
2665 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
2666 if (!c) return;
2667 evas_textblock_cursor_paragraph_first(c);
2668 _sel_update(c, rp->object, rp->entry_data);
2669
2670 _edje_entry_imf_context_reset(en);
2671 _edje_entry_imf_cursor_info_set(en);
2672 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
2673 _edje_entry_real_part_configure(rp);
2674}
2675
2676void
2677_edje_entry_cursor_end(Edje_Real_Part *rp, Edje_Cursor cur)
2678{
2679 Entry *en = rp->entry_data;
2680 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
2681 if (!c) return;
2682 _curs_end(c, rp->object, rp->entry_data);
2683 _sel_update(c, rp->object, rp->entry_data);
2684
2685 _edje_entry_imf_context_reset(en);
2686 _edje_entry_imf_cursor_info_set(en);
2687
2688 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
2689 _edje_entry_real_part_configure(rp);
2690}
2691
2692void
2693_edje_entry_cursor_copy(Edje_Real_Part *rp, Edje_Cursor cur, Edje_Cursor dst)
2694{
2695 Entry *en = rp->entry_data;
2696 Evas_Textblock_Cursor *c;
2697 Evas_Textblock_Cursor *d;
2698
2699 c = _cursor_get(rp, cur);
2700 if (!c) return;
2701 d = _cursor_get(rp, dst);
2702 if (!d) return;
2703 evas_textblock_cursor_copy(c, d);
2704 _sel_update(c, rp->object, rp->entry_data);
2705
2706 _edje_entry_imf_context_reset(en);
2707 _edje_entry_imf_cursor_info_set(en);
2708 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
2709 _edje_entry_real_part_configure(rp);
2710}
2711
2712void
2713_edje_entry_cursor_line_begin(Edje_Real_Part *rp, Edje_Cursor cur)
2714{
2715 Entry *en = rp->entry_data;
2716 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
2717 if (!c) return;
2718 evas_textblock_cursor_line_char_first(c);
2719 _sel_update(c, rp->object, rp->entry_data);
2720
2721 _edje_entry_imf_context_reset(en);
2722 _edje_entry_imf_cursor_info_set(en);
2723
2724 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
2725 _edje_entry_real_part_configure(rp);
2726}
2727
2728void
2729_edje_entry_cursor_line_end(Edje_Real_Part *rp, Edje_Cursor cur)
2730{
2731 Entry *en = rp->entry_data;
2732 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
2733 if (!c) return;
2734 evas_textblock_cursor_line_char_last(c);
2735 _sel_update(c, rp->object, rp->entry_data);
2736
2737 _edje_entry_imf_context_reset(en);
2738 _edje_entry_imf_cursor_info_set(en);
2739 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
2740 _edje_entry_real_part_configure(rp);
2741}
2742
2743Eina_Bool
2744_edje_entry_cursor_coord_set(Edje_Real_Part *rp, Edje_Cursor cur,
2745 Evas_Coord x, Evas_Coord y)
2746{
2747 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
2748 if (!c) return EINA_FALSE;
2749 return evas_textblock_cursor_char_coord_set(c, x, y);
2750}
2751
2752Eina_Bool
2753_edje_entry_cursor_is_format_get(Edje_Real_Part *rp, Edje_Cursor cur)
2754{
2755 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
2756 if (!c) return EINA_FALSE;
2757 if (evas_textblock_cursor_is_format(c)) return EINA_TRUE;
2758 return EINA_FALSE;
2759}
2760
2761Eina_Bool
2762_edje_entry_cursor_is_visible_format_get(Edje_Real_Part *rp, Edje_Cursor cur)
2763{
2764 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
2765 if (!c) return EINA_FALSE;
2766 return evas_textblock_cursor_format_is_visible_get(c);
2767}
2768
2769const char *
2770_edje_entry_cursor_content_get(Edje_Real_Part *rp, Edje_Cursor cur)
2771{
2772 static char *s = NULL;
2773 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
2774
2775 if (!c) return NULL;
2776 if (s)
2777 {
2778 free(s);
2779 s = NULL;
2780 }
2781
2782 s = evas_textblock_cursor_content_get(c);
2783 return s;
2784}
2785
2786void
2787_edje_entry_cursor_pos_set(Edje_Real_Part *rp, Edje_Cursor cur, int pos)
2788{
2789 Entry *en = rp->entry_data;
2790 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
2791 if (!c) return;
2792 /* Abort if cursor position didn't really change */
2793 if (evas_textblock_cursor_pos_get(c) == pos)
2794 return;
2795
2796 evas_textblock_cursor_pos_set(c, pos);
2797 _sel_update(c, rp->object, rp->entry_data);
2798
2799 _edje_entry_imf_context_reset(en);
2800 _edje_entry_imf_cursor_info_set(en);
2801 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
2802 _edje_entry_real_part_configure(rp);
2803}
2804
2805int
2806_edje_entry_cursor_pos_get(Edje_Real_Part *rp, Edje_Cursor cur)
2807{
2808 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
2809 if (!c) return 0;
2810 return evas_textblock_cursor_pos_get(c);
2811}
2812
2813void
2814_edje_entry_input_panel_layout_set(Edje_Real_Part *rp, Edje_Input_Panel_Layout layout)
2815{
2816 Entry *en = rp->entry_data;
2817 if (!en) return;
2818#ifdef HAVE_ECORE_IMF
2819 if (en->imf_context)
2820 ecore_imf_context_input_panel_layout_set(en->imf_context, layout);
2821#else
2822 (void) layout;
2823#endif
2824}
2825
2826Edje_Input_Panel_Layout
2827_edje_entry_input_panel_layout_get(Edje_Real_Part *rp)
2828{
2829 Entry *en = rp->entry_data;
2830 if (!en) return EDJE_INPUT_PANEL_LAYOUT_INVALID;
2831#ifdef HAVE_ECORE_IMF
2832 if (en->imf_context)
2833 return ecore_imf_context_input_panel_layout_get(en->imf_context);
2834#endif
2835
2836 return EDJE_INPUT_PANEL_LAYOUT_INVALID;
2837}
2838
2839static void
2840_edje_entry_imf_context_reset(Entry *en)
2841{
2842#ifdef HAVE_ECORE_IMF
2843 if (en->imf_context)
2844 ecore_imf_context_reset(en->imf_context);
2845#else
2846 (void) en;
2847#endif
2848}
2849
2850static void
2851_edje_entry_imf_cursor_info_set(Entry *en)
2852{
2853#ifdef HAVE_ECORE_IMF
2854 Evas_Coord cx, cy, cw, ch;
2855 if (!en || !en->rp || !en->imf_context) return;
2856
2857 _edje_entry_cursor_geometry_get(en->rp, &cx, &cy, &cw, &ch);
2858
2859 ecore_imf_context_cursor_position_set(en->imf_context,
2860 evas_textblock_cursor_pos_get(en->cursor));
2861 ecore_imf_context_cursor_location_set(en->imf_context, cx, cy, cw, ch);
2862#else
2863 (void) en;
2864#endif
2865}
2866
2867#ifdef HAVE_ECORE_IMF
2868static Eina_Bool
2869_edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx __UNUSED__, char **text, int *cursor_pos)
2870{
2871 Edje *ed = data;
2872 Edje_Real_Part *rp = ed->focused_part;
2873 Entry *en;
2874 const char *str;
2875
2876 if (!rp) return EINA_FALSE;
2877 en = rp->entry_data;
2878 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
2879 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
2880 return EINA_FALSE;
2881
2882 if (text)
2883 {
2884 str = _edje_entry_text_get(rp);
2885 *text = str ? strdup(str) : strdup("");
2886 }
2887
2888 if (cursor_pos)
2889 *cursor_pos = evas_textblock_cursor_pos_get(en->cursor);
2890
2891 return EINA_TRUE;
2892}
2893
2894static Eina_Bool
2895_edje_entry_imf_event_commit_cb(void *data, int type __UNUSED__, void *event)
2896{
2897 Edje *ed = data;
2898 Edje_Real_Part *rp = ed->focused_part;
2899 Entry *en;
2900 Ecore_IMF_Event_Commit *ev = event;
2901 Evas_Textblock_Cursor *tc;
2902 Eina_Bool cursor_move = EINA_FALSE;
2903
2904 if ((!rp) || (!ev) || (!ev->str)) return ECORE_CALLBACK_PASS_ON;
2905
2906 en = rp->entry_data;
2907 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
2908 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
2909 return ECORE_CALLBACK_PASS_ON;
2910
2911 if (!en->imf_context) return ECORE_CALLBACK_PASS_ON;
2912 if (en->imf_context != ev->ctx) return ECORE_CALLBACK_PASS_ON;
2913
2914 if (en->have_selection)
2915 {
2916 if (strcmp(ev->str, ""))
2917 {
2918 /* delete selected characters */
2919 _range_del(en->cursor, rp->object, en);
2920 _sel_clear(en->cursor, rp->object, en);
2921 }
2922 }
2923
2924 tc = evas_object_textblock_cursor_new(rp->object);
2925
2926 /* calculate the cursor position to insert commit string */
2927 if (en->preedit_start)
2928 evas_textblock_cursor_copy(en->preedit_start, tc);
2929 else
2930 evas_textblock_cursor_copy(en->cursor, tc);
2931
2932#ifdef HAVE_ECORE_IMF
2933 /* delete preedit characters */
2934 _preedit_del(en);
2935 _preedit_clear(en);
2936#endif
2937
2938 if (evas_textblock_cursor_compare(en->cursor, tc))
2939 cursor_move = EINA_TRUE;
2940 if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) &&
2941 _edje_password_show_last)
2942 _edje_entry_hide_visible_password(en->rp);
2943 if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) &&
2944 _edje_password_show_last && (!en->preedit_start))
2945 {
2946 _text_filter_format_prepend(en, tc, "+ password=off");
2947 _text_filter_markup_prepend(en, tc, ev->str);
2948 _text_filter_format_prepend(en, tc, "- password");
2949 if (en->pw_timer)
2950 {
2951 ecore_timer_del(en->pw_timer);
2952 en->pw_timer = NULL;
2953 }
2954 en->pw_timer = ecore_timer_add(_edje_password_show_last_timeout,
2955 _password_timer_cb, en);
2956 }
2957 else
2958 _text_filter_text_prepend(en, tc, ev->str);
2959
2960 if (!cursor_move)
2961 {
2962 /* move cursor to the end of commit string */
2963 evas_textblock_cursor_copy(tc, en->cursor);
2964 }
2965
2966 evas_textblock_cursor_free(tc);
2967
2968 _edje_entry_imf_cursor_info_set(en);
2969 _anchors_get(en->cursor, rp->object, en);
2970 _edje_emit(rp->edje, "entry,changed", rp->part->name);
2971 _edje_emit(ed, "entry,changed,user", rp->part->name);
2972 _edje_emit(ed, "cursor,changed", rp->part->name);
2973
2974 return ECORE_CALLBACK_DONE;
2975}
2976
2977static Eina_Bool
2978_edje_entry_imf_event_preedit_changed_cb(void *data, int type __UNUSED__, void *event)
2979{
2980 Edje *ed = data;
2981 Edje_Real_Part *rp = ed->focused_part;
2982 Entry *en;
2983 Ecore_IMF_Event_Preedit_Changed *ev = event;
2984 int cursor_pos;
2985 int preedit_start_pos, preedit_end_pos;
2986 char *preedit_string;
2987 int i;
2988 Eina_Bool preedit_end_state = EINA_FALSE;
2989
2990 if ((!rp) || (!ev)) return ECORE_CALLBACK_PASS_ON;
2991
2992 en = rp->entry_data;
2993 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
2994 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
2995 return ECORE_CALLBACK_PASS_ON;
2996
2997 if (!en->imf_context) return ECORE_CALLBACK_PASS_ON;
2998
2999 if (en->imf_context != ev->ctx) return ECORE_CALLBACK_PASS_ON;
3000
3001 ecore_imf_context_preedit_string_get(en->imf_context, &preedit_string, &cursor_pos);
3002 if (!preedit_string) return ECORE_CALLBACK_PASS_ON;
3003
3004 if (!strcmp(preedit_string, ""))
3005 preedit_end_state = EINA_TRUE;
3006
3007 if (en->have_selection && !preedit_end_state)
3008 {
3009 /* delete selected characters */
3010 _range_del(en->cursor, rp->object, en);
3011 _sel_clear(en->cursor, rp->object, en);
3012 }
3013
3014 /* delete preedit characters */
3015 _preedit_del(en);
3016
3017 preedit_start_pos = evas_textblock_cursor_pos_get(en->cursor);
3018
3019 /* insert preedit character(s) */
3020 if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) &&
3021 _edje_password_show_last)
3022 {
3023 _text_filter_format_prepend(en, en->cursor, "+ password=off");
3024 _text_filter_markup_prepend(en, en->cursor, preedit_string);
3025 _text_filter_format_prepend(en, en->cursor, "- password");
3026 if (en->pw_timer)
3027 {
3028 ecore_timer_del(en->pw_timer);
3029 en->pw_timer = NULL;
3030 }
3031 en->pw_timer = ecore_timer_add(_edje_password_show_last_timeout,
3032 _password_timer_cb, en);
3033 }
3034 else
3035 {
3036 _text_filter_markup_prepend(en, en->cursor, preedit_string);
3037 }
3038
3039 if (!preedit_end_state)
3040 {
3041 /* set preedit start cursor */
3042 if (!en->preedit_start)
3043 en->preedit_start = evas_object_textblock_cursor_new(rp->object);
3044 evas_textblock_cursor_copy(en->cursor, en->preedit_start);
3045
3046 /* set preedit end cursor */
3047 if (!en->preedit_end)
3048 en->preedit_end = evas_object_textblock_cursor_new(rp->object);
3049 evas_textblock_cursor_copy(en->cursor, en->preedit_end);
3050
3051 preedit_end_pos = evas_textblock_cursor_pos_get(en->cursor);
3052
3053 for (i = 0; i < (preedit_end_pos - preedit_start_pos); i++)
3054 {
3055 evas_textblock_cursor_char_prev(en->preedit_start);
3056 }
3057
3058 en->have_preedit = EINA_TRUE;
3059
3060 /* set cursor position */
3061 evas_textblock_cursor_pos_set(en->cursor, preedit_start_pos + cursor_pos);
3062 }
3063
3064 _edje_entry_imf_cursor_info_set(en);
3065 _anchors_get(en->cursor, rp->object, en);
3066 _edje_emit(rp->edje, "preedit,changed", rp->part->name);
3067 _edje_emit(ed, "cursor,changed", rp->part->name);
3068
3069 free(preedit_string);
3070
3071 return ECORE_CALLBACK_DONE;
3072}
3073
3074static Eina_Bool
3075_edje_entry_imf_event_delete_surrounding_cb(void *data, int type __UNUSED__, void *event)
3076{
3077 Edje *ed = data;
3078 Edje_Real_Part *rp = ed->focused_part;
3079 Entry *en;
3080 Ecore_IMF_Event_Delete_Surrounding *ev = event;
3081 Evas_Textblock_Cursor *del_start, *del_end;
3082 int cursor_pos;
3083
3084 if ((!rp) || (!ev)) return ECORE_CALLBACK_PASS_ON;
3085 en = rp->entry_data;
3086 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
3087 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
3088 return ECORE_CALLBACK_PASS_ON;
3089
3090 if (!en->imf_context) return ECORE_CALLBACK_PASS_ON;
3091 if (en->imf_context != ev->ctx) return ECORE_CALLBACK_PASS_ON;
3092
3093 cursor_pos = evas_textblock_cursor_pos_get(en->cursor);
3094
3095 del_start = evas_object_textblock_cursor_new(en->rp->object);
3096 evas_textblock_cursor_pos_set(del_start, cursor_pos + ev->offset);
3097
3098 del_end = evas_object_textblock_cursor_new(en->rp->object);
3099 evas_textblock_cursor_pos_set(del_end, cursor_pos + ev->offset + ev->n_chars);
3100
3101 evas_textblock_cursor_range_delete(del_start, del_end);
3102
3103 evas_textblock_cursor_free(del_start);
3104 evas_textblock_cursor_free(del_end);
3105
3106 return ECORE_CALLBACK_DONE;
3107}
3108#endif
3109
3110/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
diff --git a/libraries/edje/src/lib/edje_external.c b/libraries/edje/src/lib/edje_external.c
new file mode 100644
index 0000000..8bf6256
--- /dev/null
+++ b/libraries/edje/src/lib/edje_external.c
@@ -0,0 +1,559 @@
1#include "edje_private.h"
2
3static Eina_Hash *type_registry = NULL;
4static int init_count = 0;
5
6EAPI const char *
7edje_external_param_type_str(Edje_External_Param_Type type)
8{
9 switch (type)
10 {
11 case EDJE_EXTERNAL_PARAM_TYPE_INT:
12 return "INT";
13 case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
14 return "DOUBLE";
15 case EDJE_EXTERNAL_PARAM_TYPE_STRING:
16 return "STRING";
17 case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
18 return "BOOL";
19 case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
20 return "CHOICE";
21 default:
22 return "(unknown)";
23 }
24}
25
26EAPI Evas_Object *
27edje_object_part_external_object_get(const Evas_Object *obj, const char *part)
28{
29 Edje *ed;
30 Edje_Real_Part *rp;
31
32 ed = _edje_fetch(obj);
33 if ((!ed) || (!part)) return NULL;
34
35 /* Need to recalc before providing the object. */
36 _edje_recalc_do(ed);
37
38 rp = _edje_real_part_recursive_get(ed, (char *)part);
39 if (!rp)
40 {
41 ERR("no part '%s'", part);
42 return NULL;
43 }
44 if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
45 {
46 ERR("cannot get external object of a part '%s' that is not EXTERNAL",
47 rp->part->name);
48 return NULL;
49 }
50 return rp->swallowed_object;
51}
52
53EAPI Eina_Bool
54edje_object_part_external_param_set(Evas_Object *obj, const char *part, const Edje_External_Param *param)
55{
56 Edje *ed;
57 Edje_Real_Part *rp;
58
59 if ((!param) || (!param->name)) return EINA_FALSE;
60
61 ed = _edje_fetch(obj);
62 if ((!ed) || (!part)) return EINA_FALSE;
63
64 rp = _edje_real_part_recursive_get(ed, (char *)part);
65 if (!rp)
66 {
67 ERR("no part '%s'", part);
68 return EINA_FALSE;
69 }
70
71 return _edje_external_param_set(obj, rp, param);
72}
73
74EAPI Eina_Bool
75edje_object_part_external_param_get(const Evas_Object *obj, const char *part, Edje_External_Param *param)
76{
77 Edje *ed;
78 Edje_Real_Part *rp;
79
80 if ((!param) || (!param->name)) return EINA_FALSE;
81
82 ed = _edje_fetch(obj);
83 if ((!ed) || (!part)) return EINA_FALSE;
84
85 rp = _edje_real_part_recursive_get(ed, (char *)part);
86 if (!rp)
87 {
88 ERR("no part '%s'", part);
89 return EINA_FALSE;
90 }
91
92 return _edje_external_param_get(obj, rp, param);
93}
94
95
96
97EAPI Evas_Object *
98edje_object_part_external_content_get(const Evas_Object *obj, const char *part, const char *content)
99{
100 Edje *ed;
101 Edje_Real_Part *rp;
102
103 if (!content) return EINA_FALSE;
104
105 ed = _edje_fetch(obj);
106 if ((!ed) || (!part)) return EINA_FALSE;
107
108 rp = _edje_real_part_recursive_get(ed, (char *)part);
109 if (!rp)
110 {
111 ERR("no part '%s'", part);
112 return EINA_FALSE;
113 }
114
115 return _edje_external_content_get(rp->swallowed_object, content);
116}
117
118EAPI Edje_External_Param_Type
119edje_object_part_external_param_type_get(const Evas_Object *obj, const char *part, const char *param)
120{
121 Edje *ed;
122 Edje_Real_Part *rp;
123 Edje_External_Type *type;
124 Edje_External_Param_Info *info;
125
126 ed = _edje_fetch(obj);
127 if ((!ed) || (!part)) return EDJE_EXTERNAL_PARAM_TYPE_MAX;
128
129 rp = _edje_real_part_recursive_get(ed, (char *)part);
130 if (!rp)
131 {
132 ERR("no part '%s'", part);
133 return EDJE_EXTERNAL_PARAM_TYPE_MAX;
134 }
135 type = evas_object_data_get(rp->swallowed_object, "Edje_External_Type");
136 if (!type)
137 {
138 ERR("no external type for object %p", obj);
139 return EDJE_EXTERNAL_PARAM_TYPE_MAX;
140 }
141 if (!type->parameters_info)
142 {
143 ERR("no parameters information for external type '%s'",
144 type->module_name);
145 return EDJE_EXTERNAL_PARAM_TYPE_MAX;
146 }
147 for (info = type->parameters_info; info->name; info++)
148 if (strcmp(info->name, param) == 0)
149 return info->type;
150
151 ERR("no parameter '%s' external type '%s'", param, type->module_name);
152 return EDJE_EXTERNAL_PARAM_TYPE_MAX;
153}
154
155
156EAPI Eina_Bool
157edje_external_type_register(const char *type_name, const Edje_External_Type *type_info)
158{
159 if (!type_name)
160 return EINA_FALSE;
161 if (!type_info)
162 return EINA_FALSE;
163
164 if (type_info->abi_version != EDJE_EXTERNAL_TYPE_ABI_VERSION)
165 {
166 ERR("external type '%s' (%p) has incorrect abi version. "
167 "got %#x where %#x was expected.",
168 type_name, type_info,
169 type_info->abi_version, EDJE_EXTERNAL_TYPE_ABI_VERSION);
170 return EINA_FALSE;
171 }
172
173 if (eina_hash_find(type_registry, type_name))
174 {
175 ERR("External type '%s' already registered", type_name);
176 return EINA_FALSE;
177 }
178 return eina_hash_add(type_registry, type_name, type_info);
179}
180
181EAPI Eina_Bool
182edje_external_type_unregister(const char *type_name)
183{
184 if (!type_name)
185 return EINA_FALSE;
186 return eina_hash_del_by_key(type_registry, type_name);
187}
188
189EAPI void
190edje_external_type_array_register(const Edje_External_Type_Info *array)
191{
192 const Edje_External_Type_Info *itr;
193
194 if (!array)
195 return;
196
197 for (itr = array; itr->name; itr++)
198 {
199 if (itr->info->abi_version != EDJE_EXTERNAL_TYPE_ABI_VERSION)
200 {
201 ERR("external type '%s' (%p) has incorrect abi "
202 "version. got %#x where %#x was expected.",
203 itr->name, itr->info,
204 itr->info->abi_version, EDJE_EXTERNAL_TYPE_ABI_VERSION);
205 continue;
206 }
207
208 eina_hash_direct_add(type_registry, itr->name, itr->info);
209 }
210}
211
212EAPI void
213edje_external_type_array_unregister(const Edje_External_Type_Info *array)
214{
215 const Edje_External_Type_Info *itr;
216
217 if (!array)
218 return;
219
220 for (itr = array; itr->name; itr++)
221 eina_hash_del(type_registry, itr->name, itr->info);
222}
223
224EAPI unsigned int
225edje_external_type_abi_version_get(void)
226{
227 return EDJE_EXTERNAL_TYPE_ABI_VERSION;
228}
229
230EAPI Eina_Iterator *
231edje_external_iterator_get(void)
232{
233 return eina_hash_iterator_tuple_new(type_registry);
234}
235
236EAPI Edje_External_Param *
237edje_external_param_find(const Eina_List *params, const char *key)
238{
239 const Eina_List *l;
240 Edje_External_Param *param;
241
242 EINA_LIST_FOREACH(params, l, param)
243 if (!strcmp(param->name, key)) return param;
244
245 return NULL;
246}
247
248EAPI Eina_Bool
249edje_external_param_int_get(const Eina_List *params, const char *key, int *ret)
250{
251 Edje_External_Param *param;
252
253 if (!params) return EINA_FALSE;
254 param = edje_external_param_find(params, key);
255
256 if (param && param->type == EDJE_EXTERNAL_PARAM_TYPE_INT && ret)
257 {
258 *ret = param->i;
259 return EINA_TRUE;
260 }
261
262 return EINA_FALSE;
263}
264
265EAPI Eina_Bool
266edje_external_param_double_get(const Eina_List *params, const char *key, double *ret)
267{
268 Edje_External_Param *param;
269
270 if (!params) return EINA_FALSE;
271 param = edje_external_param_find(params, key);
272
273 if (param && param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE && ret)
274 {
275 *ret = param->d;
276 return EINA_TRUE;
277 }
278
279 return EINA_FALSE;
280}
281
282EAPI Eina_Bool
283edje_external_param_string_get(const Eina_List *params, const char *key, const char **ret)
284{
285 Edje_External_Param *param;
286
287 if (!params) return EINA_FALSE;
288 param = edje_external_param_find(params, key);
289
290 if (param && param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING && ret)
291 {
292 *ret = param->s;
293 return EINA_TRUE;
294 }
295
296 return EINA_FALSE;
297}
298
299EAPI Eina_Bool
300edje_external_param_bool_get(const Eina_List *params, const char *key, Eina_Bool *ret)
301{
302 Edje_External_Param *param;
303
304 if (!params) return EINA_FALSE;
305 param = edje_external_param_find(params, key);
306
307 if (param && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL && ret)
308 {
309 *ret = param->i;
310 return EINA_TRUE;
311 }
312
313 return EINA_FALSE;
314}
315
316EAPI Eina_Bool
317edje_external_param_choice_get(const Eina_List *params, const char *key, const char **ret)
318{
319 Edje_External_Param *param;
320
321 if (!params) return EINA_FALSE;
322 param = edje_external_param_find(params, key);
323
324 if (param && param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE && ret)
325 {
326 *ret = param->s;
327 return EINA_TRUE;
328 }
329
330 return EINA_FALSE;
331}
332
333EAPI const Edje_External_Param_Info *
334edje_external_param_info_get(const char *type_name)
335{
336 Edje_External_Type *type;
337
338 type = eina_hash_find(type_registry, type_name);
339 if (!type)
340 return NULL;
341 return type->parameters_info;
342}
343
344EAPI const Edje_External_Type *
345edje_external_type_get(const char *type_name)
346{
347 return eina_hash_find(type_registry, type_name);
348}
349
350void
351_edje_external_init()
352{
353 if (!type_registry)
354 type_registry = eina_hash_string_superfast_new(NULL);
355
356 init_count++;
357}
358
359void
360_edje_external_shutdown()
361{
362 if (--init_count == 0)
363 {
364 eina_hash_free(type_registry);
365 type_registry = NULL;
366 }
367}
368
369Evas_Object *
370_edje_external_type_add(const char *type_name, Evas *evas, Evas_Object *parent, const Eina_List *params, const char *part_name)
371{
372 Edje_External_Type *type;
373 Evas_Object *obj;
374
375 type = eina_hash_find(type_registry, type_name);
376 if (!type)
377 {
378 ERR("external type '%s' not registered", type_name);
379 return NULL;
380 }
381
382 obj = type->add(type->data, evas, parent, params, part_name);
383 if (!obj)
384 {
385 ERR("External type '%s' returned NULL from constructor", type_name);
386 return NULL;
387 }
388
389 evas_object_data_set(obj, "Edje_External_Type", type);
390
391 return obj;
392}
393
394void
395_edje_external_signal_emit(Evas_Object *obj, const char *emission, const char *source)
396{
397 Edje_External_Type *type;
398
399 type = evas_object_data_get(obj, "Edje_External_Type");
400 if (!type)
401 {
402 ERR("External type data not found.");
403 return;
404 }
405
406 type->signal_emit(type->data, obj, emission, source);
407}
408
409Eina_Bool
410_edje_external_param_set(Evas_Object *obj, Edje_Real_Part *rp, const Edje_External_Param *param)
411{
412 Evas_Object *swallowed_object = rp->swallowed_object;
413 Edje_External_Type *type = evas_object_data_get(swallowed_object, "Edje_External_Type");
414 if (!type)
415 {
416 if ((rp->part->type == EDJE_PART_TYPE_TEXT) ||
417 (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK))
418 {
419 if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) &&
420 (!strcmp (param->name, "text")) && (obj))
421 {
422 return edje_object_part_text_set(obj, rp->part->name, param->s);
423 }
424 }
425
426 ERR("no external type for object %p", swallowed_object);
427 return EINA_FALSE;
428 }
429 if (!type->param_set)
430 {
431 ERR("external type '%s' from module '%s' does not provide param_set()",
432 type->module_name, type->module);
433 return EINA_FALSE;
434 }
435 return type->param_set(type->data, swallowed_object, param);
436}
437
438Eina_Bool
439_edje_external_param_get(const Evas_Object *obj, Edje_Real_Part *rp, Edje_External_Param *param)
440{
441 Evas_Object *swallowed_object = rp->swallowed_object;
442 Edje_External_Type *type = evas_object_data_get(swallowed_object, "Edje_External_Type");
443 if (!type)
444 {
445 if ((rp->part->type == EDJE_PART_TYPE_TEXT) ||
446 (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK))
447 {
448 const char *text;
449 param->type = EDJE_EXTERNAL_PARAM_TYPE_STRING;
450 param->name = "text";
451 text = edje_object_part_text_get(obj, rp->part->name);
452 param->s = text;
453 return EINA_TRUE;
454 }
455
456 ERR("no external type for object %p", swallowed_object);
457 return EINA_FALSE;
458 }
459 if (!type->param_get)
460 {
461 ERR("external type '%s' from module '%s' does not provide param_get()",
462 type->module_name, type->module);
463 return EINA_FALSE;
464 }
465 return type->param_get(type->data, swallowed_object, param);
466}
467
468Evas_Object*
469_edje_external_content_get(const Evas_Object *obj, const char *content)
470{
471 Edje_External_Type *type = evas_object_data_get(obj, "Edje_External_Type");
472 if (!type)
473 {
474 ERR("no external type for object %p", obj);
475 return EINA_FALSE;
476 }
477 if (!type->content_get)
478 {
479 ERR("external type '%s' from module '%s' does not provide content_get()",
480 type->module_name, type->module);
481 return EINA_FALSE;
482 }
483 return type->content_get(type->data, obj, content);
484}
485
486void
487_edje_external_params_free(Eina_List *external_params, Eina_Bool free_strings)
488{
489 Edje_External_Param *param;
490
491 EINA_LIST_FREE(external_params, param)
492 {
493 if (free_strings)
494 {
495 if (param->name) eina_stringshare_del(param->name);
496 if (param->s) eina_stringshare_del(param->s);
497 }
498 free(param);
499 }
500}
501
502void
503_edje_external_recalc_apply(Edje *ed __UNUSED__, Edje_Real_Part *ep,
504 Edje_Calc_Params *params __UNUSED__,
505 Edje_Part_Description_Common *chosen_desc __UNUSED__)
506{
507 Edje_External_Type *type;
508 Edje_Part_Description_External *ext;
509 void *params1, *params2 = NULL;
510
511 if (!ep->swallowed_object) return;
512 type = evas_object_data_get(ep->swallowed_object, "Edje_External_Type");
513
514 if ((!type) || (!type->state_set)) return;
515
516 ext = (Edje_Part_Description_External*) ep->param1.description;
517
518 params1 = ep->param1.external_params ?
519 ep->param1.external_params : ext->external_params;
520
521 if (ep->param2 && ep->param2->description)
522 {
523 ext = (Edje_Part_Description_External*) ep->param2->description;
524
525 params2 = ep->param2->external_params ?
526 ep->param2->external_params : ext->external_params;
527 }
528
529 type->state_set(type->data, ep->swallowed_object,
530 params1, params2, ep->description_pos);
531}
532
533void *
534_edje_external_params_parse(Evas_Object *obj, const Eina_List *params)
535{
536 Edje_External_Type *type;
537
538 type = evas_object_data_get(obj, "Edje_External_Type");
539 if (!type) return NULL;
540
541 if (!type->params_parse) return NULL;
542
543 return type->params_parse(type->data, obj, params);
544}
545
546void
547_edje_external_parsed_params_free(Evas_Object *obj, void *params)
548{
549 Edje_External_Type *type;
550
551 if (!params) return;
552
553 type = evas_object_data_get(obj, "Edje_External_Type");
554 if (!type) return;
555
556 if (!type->params_free) return;
557
558 type->params_free(params);
559}
diff --git a/libraries/edje/src/lib/edje_load.c b/libraries/edje/src/lib/edje_load.c
new file mode 100644
index 0000000..644bb7c
--- /dev/null
+++ b/libraries/edje/src/lib/edje_load.c
@@ -0,0 +1,1525 @@
1#include "edje_private.h"
2
3#ifdef EDJE_PROGRAM_CACHE
4static Eina_Bool _edje_collection_free_prog_cache_matches_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata);
5#endif
6static void _edje_object_pack_item_hints_set(Evas_Object *obj, Edje_Pack_Element *it);
7static void _cb_signal_repeat(void *data, Evas_Object *obj, const char *signal, const char *source);
8
9static Eina_List *_edje_swallows_collect(Edje *ed);
10
11/************************** API Routines **************************/
12
13EAPI Eina_Bool
14edje_object_file_set(Evas_Object *obj, const char *file, const char *group)
15{
16 Eina_Bool ret;
17 Edje *ed;
18
19 ed = _edje_fetch(obj);
20 if (!ed)
21 return EINA_FALSE;
22 ret = ed->api->file_set(obj, file, group);
23 _edje_object_orientation_inform(obj);
24 return ret;
25}
26
27EAPI void
28edje_object_file_get(const Evas_Object *obj, const char **file, const char **group)
29{
30 Edje *ed;
31
32 ed = _edje_fetch(obj);
33 if (!ed)
34 {
35 if (file) *file = NULL;
36 if (group) *group = NULL;
37 return;
38 }
39 if (file) *file = ed->path;
40 if (group) *group = ed->group;
41}
42
43EAPI Edje_Load_Error
44edje_object_load_error_get(const Evas_Object *obj)
45{
46 Edje *ed;
47
48 ed = _edje_fetch(obj);
49 if (!ed) return EDJE_LOAD_ERROR_NONE;
50 return ed->load_error;
51}
52
53EAPI const char *
54edje_load_error_str(Edje_Load_Error error)
55{
56 switch (error)
57 {
58 case EDJE_LOAD_ERROR_NONE:
59 return "No Error";
60 case EDJE_LOAD_ERROR_GENERIC:
61 return "Generic Error";
62 case EDJE_LOAD_ERROR_DOES_NOT_EXIST:
63 return "File Does Not Exist";
64 case EDJE_LOAD_ERROR_PERMISSION_DENIED:
65 return "Permission Denied";
66 case EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED:
67 return "Resource Allocation Failed";
68 case EDJE_LOAD_ERROR_CORRUPT_FILE:
69 return "Corrupt File";
70 case EDJE_LOAD_ERROR_UNKNOWN_FORMAT:
71 return "Unknown Format";
72 case EDJE_LOAD_ERROR_INCOMPATIBLE_FILE:
73 return "Incompatible File";
74 case EDJE_LOAD_ERROR_UNKNOWN_COLLECTION:
75 return "Unknown Collection";
76 case EDJE_LOAD_ERROR_RECURSIVE_REFERENCE:
77 return "Recursive Reference";
78 default:
79 return "Unknown Error";
80 }
81}
82
83
84EAPI Eina_List *
85edje_file_collection_list(const char *file)
86{
87 Eina_List *lst = NULL;
88 Edje_File *edf;
89 int error_ret = 0;
90
91 if ((!file) || (!*file)) return NULL;
92 edf = _edje_cache_file_coll_open(file, NULL, &error_ret, NULL);
93 if (edf)
94 {
95 Eina_Iterator *i;
96 const char *key;
97
98 i = eina_hash_iterator_key_new(edf->collection);
99
100 EINA_ITERATOR_FOREACH(i, key)
101 lst = eina_list_append(lst, eina_stringshare_add(key));
102
103 eina_iterator_free(i);
104
105 _edje_cache_file_unref(edf);
106 }
107 return lst;
108}
109
110EAPI void
111edje_file_collection_list_free(Eina_List *lst)
112{
113 while (lst)
114 {
115 if (eina_list_data_get(lst)) eina_stringshare_del(eina_list_data_get(lst));
116 lst = eina_list_remove(lst, eina_list_data_get(lst));
117 }
118}
119
120EAPI Eina_Bool
121edje_file_group_exists(const char *file, const char *glob)
122{
123 Edje_File *edf;
124 int error_ret = 0;
125 Eina_Bool succeed = EINA_FALSE;
126 Eina_Bool is_glob = EINA_FALSE;
127 const char *p;
128
129 if ((!file) || (!*file))
130 return EINA_FALSE;
131
132 edf = _edje_cache_file_coll_open(file, NULL, &error_ret, NULL);
133 if (!edf)
134 return EINA_FALSE;
135
136 for (p = glob; *p; p++)
137 {
138 if ((*p == '*') || (*p == '?') || (*p == '['))
139 {
140 is_glob = EINA_TRUE;
141 break;
142 }
143 }
144
145 if (is_glob)
146 {
147 if (!edf->collection_patterns)
148 {
149 Edje_Part_Collection_Directory_Entry *ce;
150 Eina_Iterator *i;
151 Eina_List *l = NULL;
152
153 i = eina_hash_iterator_data_new(edf->collection);
154
155 EINA_ITERATOR_FOREACH(i, ce)
156 l = eina_list_append(l, ce);
157
158 eina_iterator_free(i);
159
160 edf->collection_patterns = edje_match_collection_dir_init(l);
161 eina_list_free(l);
162 }
163
164 succeed = edje_match_collection_dir_exec(edf->collection_patterns, glob);
165 if (edf->collection_patterns)
166 {
167 edje_match_patterns_free(edf->collection_patterns);
168 edf->collection_patterns = NULL;
169 }
170 }
171 else
172 {
173 if (eina_hash_find(edf->collection, glob)) succeed = EINA_TRUE;
174 }
175 _edje_cache_file_unref(edf);
176
177 INF("edje_file_group_exists: '%s', '%s': %i\n", file, glob, succeed);
178
179 return succeed;
180}
181
182
183EAPI char *
184edje_file_data_get(const char *file, const char *key)
185{
186 Edje_File *edf;
187 char *str = NULL;
188 int error_ret = 0;
189
190 if (key)
191 {
192 edf = _edje_cache_file_coll_open(file, NULL, &error_ret, NULL);
193 if (edf)
194 {
195 str = (char*) edje_string_get(eina_hash_find(edf->data, key));
196
197 if (str) str = strdup(str);
198
199 _edje_cache_file_unref(edf);
200 }
201 }
202 return str;
203}
204
205void
206_edje_programs_patterns_clean(Edje *ed)
207{
208 _edje_signals_sources_patterns_clean(&ed->patterns.programs);
209
210 eina_rbtree_delete(ed->patterns.programs.exact_match,
211 EINA_RBTREE_FREE_CB(edje_match_signal_source_free),
212 NULL);
213 ed->patterns.programs.exact_match = NULL;
214
215 free(ed->patterns.programs.u.programs.globing);
216 ed->patterns.programs.u.programs.globing = NULL;
217}
218
219void
220_edje_programs_patterns_init(Edje *ed)
221{
222 Edje_Signals_Sources_Patterns *ssp = &ed->patterns.programs;
223 Edje_Program **all;
224 unsigned int i, j;
225
226 if (ssp->signals_patterns)
227 return;
228
229 edje_match_program_hash_build(ed->collection->programs.strcmp,
230 ed->collection->programs.strcmp_count,
231 &ssp->exact_match);
232
233 j = ed->collection->programs.strncmp_count
234 + ed->collection->programs.strrncmp_count
235 + ed->collection->programs.fnmatch_count
236 + ed->collection->programs.nocmp_count;
237 if (j == 0) return ;
238
239 all = malloc(sizeof (Edje_Program *) * j);
240 if (!all) return ;
241 j = 0;
242
243 /* FIXME: Build specialized data type for each case */
244#define EDJE_LOAD_PROGRAMS_ADD(Array, Ed, It, Git, All) \
245 for (It = 0; It < Ed->collection->programs.Array##_count; ++It, ++Git) \
246 All[Git] = Ed->collection->programs.Array[It];
247
248 EDJE_LOAD_PROGRAMS_ADD(fnmatch, ed, i, j, all);
249 EDJE_LOAD_PROGRAMS_ADD(strncmp, ed, i, j, all);
250 EDJE_LOAD_PROGRAMS_ADD(strrncmp, ed, i, j, all);
251 /* FIXME: Do a special pass for that one */
252 EDJE_LOAD_PROGRAMS_ADD(nocmp, ed, i, j, all);
253
254 ssp->u.programs.globing = all;
255 ssp->u.programs.count = j;
256 ssp->signals_patterns = edje_match_programs_signal_init(all, j);
257 ssp->sources_patterns = edje_match_programs_source_init(all, j);
258}
259
260int
261_edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *group, const char *parent, Eina_List *group_path)
262{
263 Edje *ed;
264 Evas *tev;
265 Eina_List *old_swallows;
266 unsigned int n;
267 Eina_List *parts = NULL;
268 int group_path_started = 0;
269
270 ed = _edje_fetch(obj);
271 if (!ed) return 0;
272 if (!file) file = "";
273 if (!group) group = "";
274 if (((ed->path) && (!strcmp(file, ed->path))) &&
275 (ed->group) && (!strcmp(group, ed->group)))
276 return 1;
277
278 tev = evas_object_evas_get(obj);
279 evas_event_freeze(tev);
280 old_swallows = _edje_swallows_collect(ed);
281
282 if (_edje_script_only(ed)) _edje_script_only_shutdown(ed);
283 if (_edje_lua_script_only(ed)) _edje_lua_script_only_shutdown(ed);
284 _edje_file_del(ed);
285
286 eina_stringshare_replace(&ed->path, file);
287 eina_stringshare_replace(&ed->group, group);
288
289 ed->parent = eina_stringshare_add(parent);
290
291 ed->load_error = EDJE_LOAD_ERROR_NONE;
292 _edje_file_add(ed);
293
294 if (ed->file && ed->file->external_dir)
295 {
296 unsigned int i;
297
298 for (i = 0; i < ed->file->external_dir->entries_count; ++i)
299 edje_module_load(ed->file->external_dir->entries[i].entry);
300 }
301
302 _edje_textblock_styles_add(ed);
303 _edje_textblock_style_all_update(ed);
304
305 ed->has_entries = EINA_FALSE;
306
307 if (ed->collection)
308 {
309 if (ed->collection->prop.orientation != EDJE_ORIENTATION_AUTO)
310 ed->is_rtl = (ed->collection->prop.orientation ==
311 EDJE_ORIENTATION_RTL);
312
313 if (ed->collection->script_only)
314 {
315 ed->load_error = EDJE_LOAD_ERROR_NONE;
316 _edje_script_only_init(ed);
317 }
318 else if (ed->collection->lua_script_only)
319 {
320 ed->load_error = EDJE_LOAD_ERROR_NONE;
321 _edje_lua_script_only_init(ed);
322 }
323 else
324 {
325 unsigned int i;
326 int errors = 0;
327
328 /* colorclass stuff */
329 for (i = 0; i < ed->collection->parts_count; ++i)
330 {
331 Edje_Part *ep;
332 unsigned int k;
333
334 ep = ed->collection->parts[i];
335
336 if (errors)
337 break;
338 /* Register any color classes in this parts descriptions. */
339 if ((ep->default_desc) && (ep->default_desc->color_class))
340 _edje_color_class_member_add(ed, ep->default_desc->color_class);
341
342 for (k = 0; k < ep->other.desc_count; k++)
343 {
344 Edje_Part_Description_Common *desc;
345
346 desc = ep->other.desc[k];
347
348 if (desc->color_class)
349 _edje_color_class_member_add(ed, desc->color_class);
350 }
351 }
352 /* build real parts */
353 for (n = 0; n < ed->collection->parts_count; n++)
354 {
355 Edje_Part *ep;
356 Edje_Real_Part *rp;
357
358 ep = ed->collection->parts[n];
359 rp = eina_mempool_malloc(_edje_real_part_mp, sizeof(Edje_Real_Part));
360 if (!rp)
361 {
362 ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
363 evas_event_thaw(tev);
364 evas_event_thaw_eval(tev);
365 return 0;
366 }
367
368 memset(rp, 0, sizeof (Edje_Real_Part));
369
370 if ((ep->dragable.x != 0) || (ep->dragable.y != 0))
371 {
372 rp->drag = calloc(1, sizeof (Edje_Real_Part_Drag));
373 if (!rp->drag)
374 {
375 ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
376 free(rp);
377 evas_event_thaw(tev);
378 evas_event_thaw_eval(tev);
379 return 0;
380 }
381
382 rp->drag->step.x = FROM_INT(ep->dragable.step_x);
383 rp->drag->step.y = FROM_INT(ep->dragable.step_y);
384 }
385
386 rp->edje = ed;
387 _edje_ref(rp->edje);
388 rp->part = ep;
389 parts = eina_list_append(parts, rp);
390 rp->param1.description =
391 _edje_part_description_find(ed, rp, "default", 0.0);
392 rp->chosen_description = rp->param1.description;
393 if (!rp->param1.description)
394 ERR("no default part description!");
395
396 switch (ep->type)
397 {
398 case EDJE_PART_TYPE_RECTANGLE:
399 rp->object = evas_object_rectangle_add(ed->base.evas);
400 break;
401 case EDJE_PART_TYPE_PROXY:
402 case EDJE_PART_TYPE_IMAGE:
403 rp->object = evas_object_image_add(ed->base.evas);
404 break;
405 case EDJE_PART_TYPE_TEXT:
406 _edje_text_part_on_add(ed, rp);
407 rp->object = evas_object_text_add(ed->base.evas);
408 evas_object_text_font_source_set(rp->object, ed->path);
409 break;
410 case EDJE_PART_TYPE_SWALLOW:
411 case EDJE_PART_TYPE_GROUP:
412 case EDJE_PART_TYPE_EXTERNAL:
413 rp->object = evas_object_rectangle_add(ed->base.evas);
414 evas_object_color_set(rp->object, 0, 0, 0, 0);
415 evas_object_pass_events_set(rp->object, 1);
416 evas_object_pointer_mode_set(rp->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
417 _edje_callbacks_focus_add(rp->object, ed, rp);
418 break;
419 case EDJE_PART_TYPE_TEXTBLOCK:
420 rp->object = evas_object_textblock_add(ed->base.evas);
421 break;
422 case EDJE_PART_TYPE_BOX:
423 rp->object = evas_object_box_add(ed->base.evas);
424 rp->anim = _edje_box_layout_anim_new(rp->object);
425 break;
426 case EDJE_PART_TYPE_TABLE:
427 rp->object = evas_object_table_add(ed->base.evas);
428 break;
429 case EDJE_PART_TYPE_GRADIENT:
430 ERR("SPANK ! SPANK ! SPANK ! YOU ARE USING GRADIENT IN PART %s FROM GROUP %s INSIDE FILE %s !! THEY ARE NOW REMOVED !",
431 ep->name, group, file);
432 default:
433 ERR("wrong part type %i!", ep->type);
434 break;
435 }
436
437 if (rp->object)
438 {
439 evas_object_smart_member_add(rp->object, ed->obj);
440// evas_object_layer_set(rp->object, evas_object_layer_get(ed->obj));
441 if (ep->type != EDJE_PART_TYPE_SWALLOW && ep->type != EDJE_PART_TYPE_GROUP && ep->type != EDJE_PART_TYPE_EXTERNAL)
442 {
443 if (ep->mouse_events)
444 {
445 _edje_callbacks_add(rp->object, ed, rp);
446 if (ep->repeat_events)
447 evas_object_repeat_events_set(rp->object, 1);
448
449 if (ep->pointer_mode != EVAS_OBJECT_POINTER_MODE_AUTOGRAB)
450 evas_object_pointer_mode_set(rp->object, ep->pointer_mode);
451 }
452 else
453 {
454 evas_object_pass_events_set(rp->object, 1);
455 evas_object_pointer_mode_set(rp->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
456 }
457 if (ep->precise_is_inside)
458 evas_object_precise_is_inside_set(rp->object, 1);
459 }
460 if (rp->part->clip_to_id < 0)
461 evas_object_clip_set(rp->object, ed->base.clipper);
462 }
463 }
464 if (n > 0)
465 {
466 Edje_Real_Part *rp;
467 Eina_List *l;
468
469 ed->table_parts = malloc(sizeof(Edje_Real_Part *) * n);
470 ed->table_parts_size = n;
471 /* FIXME: check malloc return */
472 n = 0;
473 EINA_LIST_FOREACH(parts, l, rp)
474 {
475 ed->table_parts[n] = rp;
476 n++;
477 }
478 eina_list_free(parts);
479 for (i = 0; i < ed->table_parts_size; i++)
480 {
481 rp = ed->table_parts[i];
482 if (rp->param1.description) /* FIXME: prevent rel to gone radient part to go wrong. You may
483 be able to remove this when all theme are correctly rewritten. */
484 {
485 if (rp->param1.description->rel1.id_x >= 0)
486 rp->param1.rel1_to_x = ed->table_parts[rp->param1.description->rel1.id_x % ed->table_parts_size];
487 if (rp->param1.description->rel1.id_y >= 0)
488 rp->param1.rel1_to_y = ed->table_parts[rp->param1.description->rel1.id_y % ed->table_parts_size];
489 if (rp->param1.description->rel2.id_x >= 0)
490 rp->param1.rel2_to_x = ed->table_parts[rp->param1.description->rel2.id_x % ed->table_parts_size];
491 if (rp->param1.description->rel2.id_y >= 0)
492 rp->param1.rel2_to_y = ed->table_parts[rp->param1.description->rel2.id_y % ed->table_parts_size];
493 }
494 if (rp->part->clip_to_id >= 0)
495 {
496 rp->clip_to = ed->table_parts[rp->part->clip_to_id % ed->table_parts_size];
497 if (rp->clip_to)
498 {
499 evas_object_pass_events_set(rp->clip_to->object, 1);
500 evas_object_pointer_mode_set(rp->clip_to->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
501 evas_object_clip_set(rp->object, rp->clip_to->object);
502 }
503 }
504 if (rp->drag)
505 {
506 if (rp->part->dragable.confine_id >= 0)
507 rp->drag->confine_to = ed->table_parts[rp->part->dragable.confine_id % ed->table_parts_size];
508 }
509
510 /* replay events for dragable */
511 if (rp->part->dragable.event_id >= 0)
512 {
513 rp->events_to =
514 ed->table_parts[rp->part->dragable.event_id % ed->table_parts_size];
515 /* events_to may be used only with dragable */
516 if (!rp->events_to->part->dragable.x &&
517 !rp->events_to->part->dragable.y)
518 rp->events_to = NULL;
519 }
520
521 rp->swallow_params.min.w = 0;
522 rp->swallow_params.min.w = 0;
523 rp->swallow_params.max.w = -1;
524 rp->swallow_params.max.h = -1;
525
526 if (rp->part->type == EDJE_PART_TYPE_TEXT
527 || rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
528 {
529 Edje_Part_Description_Text *text;
530
531 text = (Edje_Part_Description_Text *) rp->param1.description;
532
533 if (ed->file->feature_ver < 1)
534 {
535 text->text.id_source = -1;
536 text->text.id_text_source = -1;
537 }
538
539 if (text->text.id_source >= 0)
540 rp->text.source = ed->table_parts[text->text.id_source % ed->table_parts_size];
541 if (text->text.id_text_source >= 0)
542 rp->text.text_source = ed->table_parts[text->text.id_text_source % ed->table_parts_size];
543 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
544 {
545 _edje_entry_real_part_init(rp);
546 if (!ed->has_entries)
547 ed->has_entries = EINA_TRUE;
548 }
549 }
550 }
551 }
552
553 _edje_programs_patterns_init(ed);
554
555 n = ed->collection->programs.fnmatch_count +
556 ed->collection->programs.strcmp_count +
557 ed->collection->programs.strncmp_count +
558 ed->collection->programs.strrncmp_count +
559 ed->collection->programs.nocmp_count;
560 if (n > 0)
561 {
562 Edje_Program *pr;
563
564 ed->table_programs = malloc(sizeof(Edje_Program *) * n);
565 if (ed->table_programs)
566 {
567 ed->table_programs_size = n;
568
569#define EDJE_LOAD_BUILD_TABLE(Array, Ed, It, Tmp) \
570 for (It = 0; It < Ed->collection->programs.Array##_count; ++It) \
571 { \
572 Tmp = Ed->collection->programs.Array[It]; \
573 Ed->table_programs[Tmp->id] = Tmp; \
574 }
575
576 EDJE_LOAD_BUILD_TABLE(fnmatch, ed, i, pr);
577 EDJE_LOAD_BUILD_TABLE(strcmp, ed, i, pr);
578 EDJE_LOAD_BUILD_TABLE(strncmp, ed, i, pr);
579 EDJE_LOAD_BUILD_TABLE(strrncmp, ed, i, pr);
580 EDJE_LOAD_BUILD_TABLE(nocmp, ed, i, pr);
581 }
582 }
583 _edje_ref(ed);
584 _edje_block(ed);
585 _edje_freeze(ed);
586// if (ed->collection->script) _edje_embryo_script_init(ed);
587 _edje_var_init(ed);
588 for (i = 0; i < ed->table_parts_size; i++)
589 {
590 Edje_Real_Part *rp;
591
592 rp = ed->table_parts[i];
593 evas_object_show(rp->object);
594 if (_edje_block_break(ed)) break;
595 if (rp->drag)
596 {
597 if (rp->part->dragable.x < 0) rp->drag->val.x = FROM_DOUBLE(1.0);
598 if (rp->part->dragable.y < 0) rp->drag->val.x = FROM_DOUBLE(1.0);
599 _edje_dragable_pos_set(ed, rp, rp->drag->val.x, rp->drag->val.y);
600 }
601 }
602 ed->dirty = 1;
603#ifdef EDJE_CALC_CACHE
604 ed->all_part_change = 1;
605#endif
606 if ((evas_object_clipees_get(ed->base.clipper)) &&
607 (evas_object_visible_get(obj)))
608 evas_object_show(ed->base.clipper);
609
610 /* instantiate 'internal swallows' */
611 for (i = 0; i < ed->table_parts_size; i++)
612 {
613 Edje_Real_Part *rp;
614 /* XXX: curr_item and pack_it don't require to be NULL since
615 * XXX: they are just used when source != NULL and type == BOX,
616 * XXX: and they're always set in this case, but GCC fails to
617 * XXX: notice that, so let's shut it up
618 */
619 Edje_Pack_Element **curr_item = NULL;
620 unsigned int item_count = 0;
621 Edje_Pack_Element *pack_it = NULL;
622 const char *source = NULL;
623
624 rp = ed->table_parts[i];
625
626 switch (rp->part->type)
627 {
628 case EDJE_PART_TYPE_GROUP:
629 source = rp->part->source;
630 break;
631 case EDJE_PART_TYPE_BOX:
632 case EDJE_PART_TYPE_TABLE:
633 if (rp->part->items)
634 {
635 curr_item = rp->part->items;
636 item_count = rp->part->items_count;
637 if (item_count > 0)
638 {
639 pack_it = *curr_item;
640 source = pack_it->source;
641 item_count--;
642 curr_item++;
643 }
644 }
645 break;
646 case EDJE_PART_TYPE_EXTERNAL:
647 {
648 Edje_Part_Description_External *external;
649 Evas_Object *child_obj;
650
651 external = (Edje_Part_Description_External *) rp->part->default_desc;
652 child_obj = _edje_external_type_add(rp->part->source,
653 evas_object_evas_get(ed->obj), ed->obj,
654 external->external_params, rp->part->name);
655 if (child_obj)
656 {
657 _edje_real_part_swallow(rp, child_obj, EINA_TRUE);
658 rp->param1.external_params = _edje_external_params_parse(child_obj,
659 external->external_params);
660 _edje_external_recalc_apply(ed, rp, NULL, rp->chosen_description);
661 }
662 }
663 continue;
664 default:
665 continue;
666 }
667
668 while (source)
669 {
670 Eina_List *l;
671 Evas_Object *child_obj;
672 const char *group_path_entry = eina_stringshare_add(source);
673 const char *data;
674
675 if (!group_path)
676 {
677 group_path = eina_list_append(NULL, eina_stringshare_add(group));
678 group_path_started = 1;
679 }
680 /* make sure that this group isn't already in the tree of parents */
681 EINA_LIST_FOREACH(group_path, l, data)
682 {
683 if (data == group_path_entry)
684 {
685 _edje_thaw(ed);
686 _edje_unblock(ed);
687 _edje_unref(ed);
688 _edje_file_del(ed);
689 eina_stringshare_del(group_path_entry);
690 if (group_path_started)
691 {
692 eina_stringshare_del(eina_list_data_get(group_path));
693 eina_list_free(group_path);
694 }
695 ed->load_error = EDJE_LOAD_ERROR_RECURSIVE_REFERENCE;
696 evas_event_thaw(tev);
697 evas_event_thaw_eval(tev);
698 return 0;
699 }
700 }
701
702 child_obj = edje_object_add(ed->base.evas);
703 group_path = eina_list_append(group_path, group_path_entry);
704 if (rp->part->type == EDJE_PART_TYPE_GROUP)
705 {
706 _edje_real_part_swallow(rp, child_obj, EINA_FALSE);
707 }
708
709 if (!_edje_object_file_set_internal(child_obj, file, source, rp->part->name, group_path))
710 {
711 _edje_thaw(ed);
712 _edje_unblock(ed);
713 _edje_unref(ed);
714 _edje_file_del(ed);
715
716 if (group_path_started)
717 {
718 while (group_path)
719 {
720 eina_stringshare_del(eina_list_data_get(group_path));
721 group_path = eina_list_remove_list(group_path, group_path);
722 }
723 }
724 ed->load_error = edje_object_load_error_get(child_obj);
725 evas_object_del(child_obj);
726 evas_event_thaw(tev);
727 evas_event_thaw_eval(tev);
728 return 0;
729 }
730
731 group_path = eina_list_remove(group_path, group_path_entry);
732 eina_stringshare_del(group_path_entry);
733
734 edje_object_propagate_callback_add(child_obj,
735 _cb_signal_repeat,
736 obj);
737 if (rp->part->type == EDJE_PART_TYPE_GROUP)
738 {
739 _edje_real_part_swallow(rp, child_obj, EINA_TRUE);
740 _edje_subobj_register(ed, child_obj);
741 source = NULL;
742 }
743 else
744 {
745 pack_it->parent = rp;
746
747 _edje_object_pack_item_hints_set(child_obj, pack_it);
748 if (pack_it->name)
749 evas_object_name_set(child_obj, pack_it->name);
750
751 if (rp->part->type == EDJE_PART_TYPE_BOX)
752 {
753 _edje_real_part_box_append(rp, child_obj);
754 evas_object_data_set(child_obj, "\377 edje.box_item", pack_it);
755 }
756 else if (rp->part->type == EDJE_PART_TYPE_TABLE)
757 {
758 _edje_real_part_table_pack(rp, child_obj, pack_it->col, pack_it->row, pack_it->colspan, pack_it->rowspan);
759 evas_object_data_set(child_obj, "\377 edje.table_item", pack_it);
760 }
761 _edje_subobj_register(ed, child_obj);
762 evas_object_show(child_obj);
763 rp->items = eina_list_append(rp->items, child_obj);
764
765 if (item_count > 0)
766 {
767 pack_it = *curr_item;
768 source = pack_it->source;
769 curr_item++;
770 item_count--;
771 }
772 else
773 {
774 source = NULL;
775 curr_item = NULL;
776 pack_it = NULL;
777 }
778 }
779 }
780 }
781
782 if (group_path_started)
783 {
784 const char *str;
785
786 EINA_LIST_FREE(group_path, str)
787 eina_stringshare_del(str);
788 }
789
790 /* reswallow any swallows that existed before setting the file */
791 if (old_swallows)
792 {
793 while (old_swallows)
794 {
795 const char *name;
796 Evas_Object *swallow;
797
798 name = eina_list_data_get(old_swallows);
799 old_swallows = eina_list_remove_list(old_swallows, old_swallows);
800
801 swallow = eina_list_data_get(old_swallows);
802 old_swallows = eina_list_remove_list(old_swallows, old_swallows);
803
804 edje_object_part_swallow(obj, name, swallow);
805 eina_stringshare_del(name);
806 }
807 }
808
809 _edje_recalc(ed);
810 _edje_thaw(ed);
811 _edje_unblock(ed);
812 _edje_unref(ed);
813 ed->load_error = EDJE_LOAD_ERROR_NONE;
814 _edje_emit(ed, "load", NULL);
815 /* instantiate 'internal swallows' */
816 for (i = 0; i < ed->table_parts_size; i++)
817 {
818 Edje_Real_Part *rp;
819
820 rp = ed->table_parts[i];
821 if ((rp->part->type == EDJE_PART_TYPE_TEXTBLOCK) &&
822 (rp->part->default_desc))
823 {
824 Edje_Part_Description_Text *text;
825 Edje_Style *stl = NULL;
826 const char *style;
827
828 text = (Edje_Part_Description_Text *) rp->part->default_desc;
829 style = edje_string_get(&text->text.style);
830 if (style)
831 {
832 Eina_List *l;
833
834 EINA_LIST_FOREACH(ed->file->styles, l, stl)
835 {
836 if ((stl->name) && (!strcmp(stl->name, style))) break;
837 stl = NULL;
838 }
839 }
840 if (stl)
841 {
842 if (evas_object_textblock_style_get(rp->object) != stl->style)
843 evas_object_textblock_style_set(rp->object, stl->style);
844 }
845 }
846 }
847 }
848 _edje_entry_init(ed);
849 evas_event_thaw(tev);
850 evas_event_thaw_eval(tev);
851 return 1;
852 }
853 else
854 {
855 evas_event_thaw(tev);
856 evas_event_thaw_eval(tev);
857 return 0;
858 }
859 ed->load_error = EDJE_LOAD_ERROR_NONE;
860 _edje_entry_init(ed);
861 evas_event_thaw(tev);
862 evas_event_thaw_eval(tev);
863 return 1;
864}
865
866void
867_edje_file_add(Edje *ed)
868{
869 if (!_edje_edd_edje_file) return;
870 ed->file = _edje_cache_file_coll_open(ed->path, ed->group,
871 &(ed->load_error),
872 &(ed->collection));
873
874 if (!ed->collection)
875 {
876 if (ed->file)
877 {
878 _edje_cache_file_unref(ed->file);
879 ed->file = NULL;
880 }
881 }
882}
883
884static Eina_List *
885_edje_swallows_collect(Edje *ed)
886{
887 Eina_List *swallows = NULL;
888 unsigned int i;
889
890 if (!ed->file || !ed->table_parts) return NULL;
891 for (i = 0; i < ed->table_parts_size; i++)
892 {
893 Edje_Real_Part *rp;
894
895 rp = ed->table_parts[i];
896 if (rp->part->type != EDJE_PART_TYPE_SWALLOW || !rp->swallowed_object) continue;
897 swallows = eina_list_append(swallows, eina_stringshare_add(rp->part->name));
898 swallows = eina_list_append(swallows, rp->swallowed_object);
899 }
900 return swallows;
901}
902
903void
904_edje_file_del(Edje *ed)
905{
906 Evas *tev = evas_object_evas_get(ed->obj);
907
908 evas_event_freeze(tev);
909 if (ed->freeze_calc)
910 {
911 _edje_freeze_calc_list = eina_list_remove(_edje_freeze_calc_list, ed);
912 ed->freeze_calc = 0;
913 _edje_freeze_calc_count--;
914 }
915 _edje_entry_shutdown(ed);
916 _edje_message_del(ed);
917 _edje_block_violate(ed);
918 _edje_var_shutdown(ed);
919 _edje_programs_patterns_clean(ed);
920// if (ed->collection)
921// {
922// if (ed->collection->script) _edje_embryo_script_shutdown(ed);
923// }
924
925 if (!((ed->file) && (ed->collection)))
926 {
927 evas_event_thaw(tev);
928 evas_event_thaw_eval(tev);
929 return;
930 }
931 if (ed->table_parts)
932 {
933 unsigned int i;
934 for (i = 0; i < ed->table_parts_size; i++)
935 {
936 Edje_Real_Part *rp;
937
938 rp = ed->table_parts[i];
939 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
940 _edje_entry_real_part_shutdown(rp);
941 if (rp->object)
942 {
943 _edje_callbacks_del(rp->object, ed);
944 _edje_callbacks_focus_del(rp->object, ed);
945 evas_object_del(rp->object);
946 }
947 if (rp->swallowed_object)
948 {
949 _edje_real_part_swallow_clear(rp);
950 /* Objects swallowed by the app do not get deleted,
951 but those internally swallowed (GROUP type) do. */
952 switch (rp->part->type)
953 {
954 case EDJE_PART_TYPE_EXTERNAL:
955 _edje_external_parsed_params_free(rp->swallowed_object, rp->param1.external_params);
956 if (rp->param2)
957 _edje_external_parsed_params_free(rp->swallowed_object, rp->param2->external_params);
958 case EDJE_PART_TYPE_GROUP:
959 evas_object_del(rp->swallowed_object);
960 default:
961 break;
962 }
963 rp->swallowed_object = NULL;
964 }
965 if (rp->items)
966 {
967 /* evas_box/table handles deletion of objects */
968 rp->items = eina_list_free(rp->items);
969 }
970 if (rp->anim)
971 {
972 _edje_box_layout_free_data(rp->anim);
973 rp->anim = NULL;
974 }
975 if (rp->text.text) eina_stringshare_del(rp->text.text);
976 if (rp->text.font) eina_stringshare_del(rp->text.font);
977 if (rp->text.cache.in_str) eina_stringshare_del(rp->text.cache.in_str);
978 if (rp->text.cache.out_str) eina_stringshare_del(rp->text.cache.out_str);
979
980 if (rp->custom)
981 {
982 // xxx: lua2
983 _edje_collection_free_part_description_clean(rp->part->type,
984 rp->custom->description,
985 ed->file->free_strings);
986 free(rp->custom->description);
987 rp->custom->description = NULL;
988 }
989
990 /* Cleanup optional part. */
991 free(rp->drag);
992 free(rp->param1.set);
993
994 if (rp->param2)
995 free(rp->param2->set);
996 eina_mempool_free(_edje_real_part_state_mp, rp->param2);
997
998 if (rp->custom)
999 free(rp->custom->set);
1000 eina_mempool_free(_edje_real_part_state_mp, rp->custom);
1001
1002 _edje_unref(rp->edje);
1003 eina_mempool_free(_edje_real_part_mp, rp);
1004 }
1005 }
1006 if ((ed->file) && (ed->collection))
1007 {
1008 Edje_Part *ep;
1009 unsigned int i;
1010
1011 _edje_textblock_styles_del(ed);
1012 for (i = 0; i < ed->collection->parts_count; ++i)
1013 {
1014 ep = ed->collection->parts[i];
1015
1016 _edje_text_part_on_del(ed, ep);
1017 _edje_color_class_on_del(ed, ep);
1018 }
1019
1020 _edje_cache_coll_unref(ed->file, ed->collection);
1021 ed->collection = NULL;
1022 }
1023 if (ed->file)
1024 {
1025 _edje_cache_file_unref(ed->file);
1026 ed->file = NULL;
1027 }
1028 if (ed->actions)
1029 {
1030 Edje_Running_Program *runp;
1031
1032 EINA_LIST_FREE(ed->actions, runp)
1033 {
1034 _edje_anim_count--;
1035 free(runp);
1036 }
1037 }
1038 _edje_animators = eina_list_remove(_edje_animators, ed);
1039 if (ed->pending_actions)
1040 {
1041 Edje_Pending_Program *pp;
1042
1043 EINA_LIST_FREE(ed->pending_actions, pp)
1044 {
1045 ecore_timer_del(pp->timer);
1046 free(pp);
1047 }
1048 }
1049 if (ed->L) _edje_lua2_script_shutdown(ed);
1050 while (ed->subobjs) evas_object_del(ed->subobjs->data);
1051 if (ed->table_parts) free(ed->table_parts);
1052 ed->table_parts = NULL;
1053 ed->table_parts_size = 0;
1054 if (ed->table_programs) free(ed->table_programs);
1055 ed->table_programs = NULL;
1056 ed->table_programs_size = 0;
1057 ed->focused_part = NULL;
1058 evas_event_thaw(tev);
1059 evas_event_thaw_eval(tev);
1060}
1061
1062void
1063_edje_file_free(Edje_File *edf)
1064{
1065 Edje_Color_Class *ecc;
1066
1067#define HASH_FREE(Hash) \
1068 if (Hash) eina_hash_free(Hash); \
1069 Hash = NULL;
1070
1071 /* Clean cache before cleaning memory pool */
1072 if (edf->collection_cache) _edje_cache_coll_flush(edf);
1073
1074 HASH_FREE(edf->fonts);
1075 HASH_FREE(edf->collection);
1076 HASH_FREE(edf->data);
1077
1078 if (edf->image_dir)
1079 {
1080 unsigned int i;
1081
1082 if (edf->free_strings)
1083 {
1084 for (i = 0; i < edf->image_dir->entries_count; ++i)
1085 eina_stringshare_del(edf->image_dir->entries[i].entry);
1086 }
1087
1088 /* Sets have been added after edje received eet dictionnary support */
1089 for (i = 0; i < edf->image_dir->sets_count; ++i)
1090 {
1091 Edje_Image_Directory_Set_Entry *se;
1092
1093 EINA_LIST_FREE(edf->image_dir->sets[i].entries, se)
1094 free(se);
1095
1096 }
1097
1098 free(edf->image_dir->entries);
1099 free(edf->image_dir->sets);
1100 free(edf->image_dir);
1101 }
1102 if (edf->sound_dir)
1103 {
1104 unsigned int i;
1105
1106 if (edf->free_strings)
1107 {
1108 for (i = 0; i < edf->sound_dir->samples_count; ++i)
1109 {
1110 eina_stringshare_del(edf->sound_dir->samples[i].name);
1111 eina_stringshare_del(edf->sound_dir->samples[i].snd_src);
1112 }
1113
1114 for (i = 0; i < edf->sound_dir->tones_count; ++i)
1115 eina_stringshare_del(edf->sound_dir->tones[i].name);
1116 }
1117 free(edf->sound_dir->samples);
1118 free(edf->sound_dir->tones);
1119 free(edf->sound_dir);
1120 }
1121
1122 if (edf->external_dir)
1123 {
1124 if (edf->external_dir->entries) free(edf->external_dir->entries);
1125 free(edf->external_dir);
1126 }
1127
1128 EINA_LIST_FREE(edf->color_classes, ecc)
1129 {
1130 if (edf->free_strings && ecc->name) eina_stringshare_del(ecc->name);
1131 free(ecc);
1132 }
1133
1134 if (edf->collection_patterns) edje_match_patterns_free(edf->collection_patterns);
1135 if (edf->path) eina_stringshare_del(edf->path);
1136 if (edf->free_strings && edf->compiler) eina_stringshare_del(edf->compiler);
1137 _edje_textblock_style_cleanup(edf);
1138 if (edf->ef) eet_close(edf->ef);
1139 free(edf);
1140}
1141
1142static void
1143_edje_program_free(Edje_Program *pr, Eina_Bool free_strings)
1144{
1145 Edje_Program_Target *prt;
1146 Edje_Program_After *pa;
1147
1148 if (free_strings)
1149 {
1150 if (pr->name) eina_stringshare_del(pr->name);
1151 if (pr->signal) eina_stringshare_del(pr->signal);
1152 if (pr->source) eina_stringshare_del(pr->source);
1153 if (pr->filter.part) eina_stringshare_del(pr->filter.part);
1154 if (pr->filter.state) eina_stringshare_del(pr->filter.state);
1155 if (pr->state) eina_stringshare_del(pr->state);
1156 if (pr->state2) eina_stringshare_del(pr->state2);
1157 if (pr->sample_name) eina_stringshare_del(pr->sample_name);
1158 if (pr->tone_name) eina_stringshare_del(pr->tone_name);
1159 }
1160 EINA_LIST_FREE(pr->targets, prt)
1161 free(prt);
1162 EINA_LIST_FREE(pr->after, pa)
1163 free(pa);
1164 free(pr);
1165}
1166
1167void
1168_edje_collection_free(Edje_File *edf, Edje_Part_Collection *ec, Edje_Part_Collection_Directory_Entry *ce)
1169{
1170 unsigned int i;
1171
1172 _edje_embryo_script_shutdown(ec);
1173
1174#define EDJE_LOAD_PROGRAM_FREE(Array, Ec, It, FreeStrings) \
1175 for (It = 0; It < Ec->programs.Array##_count; ++It) \
1176 _edje_program_free(Ec->programs.Array[It], FreeStrings); \
1177 free(Ec->programs.Array);
1178
1179 EDJE_LOAD_PROGRAM_FREE(fnmatch, ec, i, edf->free_strings);
1180 EDJE_LOAD_PROGRAM_FREE(strcmp, ec, i, edf->free_strings);
1181 EDJE_LOAD_PROGRAM_FREE(strncmp, ec, i, edf->free_strings);
1182 EDJE_LOAD_PROGRAM_FREE(strrncmp, ec, i, edf->free_strings);
1183 EDJE_LOAD_PROGRAM_FREE(nocmp, ec, i, edf->free_strings);
1184
1185 for (i = 0; i < ec->parts_count; ++i)
1186 {
1187 Edje_Part *ep;
1188 unsigned int j;
1189
1190 ep = ec->parts[i];
1191
1192 if (edf->free_strings && ep->name) eina_stringshare_del(ep->name);
1193 if (ep->default_desc)
1194 {
1195 _edje_collection_free_part_description_clean(ep->type, ep->default_desc, edf->free_strings);
1196 ep->default_desc = NULL;
1197 }
1198 for (j = 0; j < ep->other.desc_count; ++j)
1199 _edje_collection_free_part_description_clean(ep->type, ep->other.desc[j], edf->free_strings);
1200
1201 free(ep->other.desc);
1202 /* Alloc for RTL objects in edje_calc.c:_edje_part_description_find() */
1203 if(ep->other.desc_rtl)
1204 free(ep->other.desc_rtl);
1205
1206 free(ep->items);
1207// technically need this - but we ASSUME we use "one_big" so everything gets
1208// freed in one go lower down when we del the mempool... but what if pool goes
1209// "over"?
1210 eina_mempool_free(ce->mp.part, ep);
1211 }
1212 free(ec->parts);
1213 ec->parts = NULL;
1214
1215 if (ec->data)
1216 {
1217 Eina_Iterator *it;
1218 Edje_String *es;
1219
1220 it = eina_hash_iterator_data_new(ec->data);
1221 EINA_ITERATOR_FOREACH(it, es)
1222 free(es);
1223 eina_iterator_free(it);
1224
1225 eina_hash_free(ec->data);
1226 }
1227#ifdef EDJE_PROGRAM_CACHE
1228 if (ec->prog_cache.no_matches) eina_hash_free(ec->prog_cache.no_matches);
1229 if (ec->prog_cache.matches)
1230 {
1231 eina_hash_foreach(ec->prog_cache.matches,
1232 _edje_collection_free_prog_cache_matches_free_cb,
1233 NULL);
1234 eina_hash_free(ec->prog_cache.matches);
1235 }
1236#endif
1237 if (ec->script) embryo_program_free(ec->script);
1238 _edje_lua2_script_unload(ec);
1239
1240 /* Destroy all part and description. */
1241 eina_mempool_del(ce->mp.RECTANGLE);
1242 eina_mempool_del(ce->mp.TEXT);
1243 eina_mempool_del(ce->mp.IMAGE);
1244 eina_mempool_del(ce->mp.PROXY);
1245 eina_mempool_del(ce->mp.SWALLOW);
1246 eina_mempool_del(ce->mp.TEXTBLOCK);
1247 eina_mempool_del(ce->mp.GROUP);
1248 eina_mempool_del(ce->mp.BOX);
1249 eina_mempool_del(ce->mp.TABLE);
1250 eina_mempool_del(ce->mp.EXTERNAL);
1251 eina_mempool_del(ce->mp.part);
1252 memset(&ce->mp, 0, sizeof (ce->mp));
1253
1254 eina_mempool_del(ce->mp_rtl.RECTANGLE);
1255 eina_mempool_del(ce->mp_rtl.TEXT);
1256 eina_mempool_del(ce->mp_rtl.IMAGE);
1257 eina_mempool_del(ce->mp_rtl.PROXY);
1258 eina_mempool_del(ce->mp_rtl.SWALLOW);
1259 eina_mempool_del(ce->mp_rtl.TEXTBLOCK);
1260 eina_mempool_del(ce->mp_rtl.GROUP);
1261 eina_mempool_del(ce->mp_rtl.BOX);
1262 eina_mempool_del(ce->mp_rtl.TABLE);
1263 eina_mempool_del(ce->mp_rtl.EXTERNAL);
1264 memset(&ce->mp_rtl, 0, sizeof (ce->mp_rtl));
1265 free(ec);
1266 ce->ref = NULL;
1267}
1268
1269void
1270_edje_collection_free_part_description_clean(int type, Edje_Part_Description_Common *desc, Eina_Bool free_strings)
1271{
1272 if (free_strings && desc->color_class) eina_stringshare_del(desc->color_class);
1273
1274 switch (type)
1275 {
1276 case EDJE_PART_TYPE_IMAGE:
1277 {
1278 Edje_Part_Description_Image *img;
1279 unsigned int i;
1280
1281 img = (Edje_Part_Description_Image *) desc;
1282
1283 for (i = 0; i < img->image.tweens_count; ++i)
1284 free(img->image.tweens[i]);
1285 free(img->image.tweens);
1286 break;
1287 }
1288 case EDJE_PART_TYPE_EXTERNAL:
1289 {
1290 Edje_Part_Description_External *external;
1291
1292 external = (Edje_Part_Description_External *) desc;
1293
1294 if (external->external_params)
1295 _edje_external_params_free(external->external_params, free_strings);
1296 break;
1297 }
1298 case EDJE_PART_TYPE_TEXT:
1299 case EDJE_PART_TYPE_TEXTBLOCK:
1300 if (free_strings)
1301 {
1302 Edje_Part_Description_Text *text;
1303
1304 text = (Edje_Part_Description_Text *) desc;
1305
1306 if (text->text.text.str) eina_stringshare_del(text->text.text.str);
1307 if (text->text.text_class) eina_stringshare_del(text->text.text_class);
1308 if (text->text.style.str) eina_stringshare_del(text->text.style.str);
1309 if (text->text.font.str) eina_stringshare_del(text->text.font.str);
1310 }
1311 break;
1312 }
1313}
1314
1315void
1316_edje_collection_free_part_description_free(int type,
1317 Edje_Part_Description_Common *desc,
1318 Edje_Part_Collection_Directory_Entry *ce,
1319 Eina_Bool free_strings)
1320{
1321#define FREE_POOL(Type, Ce, Desc) \
1322 case EDJE_PART_TYPE_##Type: eina_mempool_free(Ce->mp.Type, Desc); \
1323 ce->count.Type--; \
1324 break;
1325
1326 _edje_collection_free_part_description_clean(type, desc, free_strings);
1327
1328 switch (type)
1329 {
1330 FREE_POOL(RECTANGLE, ce, desc);
1331 FREE_POOL(TEXT, ce, desc);
1332 FREE_POOL(IMAGE, ce, desc);
1333 FREE_POOL(PROXY, ce, desc);
1334 FREE_POOL(SWALLOW, ce, desc);
1335 FREE_POOL(TEXTBLOCK, ce, desc);
1336 FREE_POOL(GROUP, ce, desc);
1337 FREE_POOL(BOX, ce, desc);
1338 FREE_POOL(TABLE, ce, desc);
1339 FREE_POOL(EXTERNAL, ce, desc);
1340 }
1341}
1342
1343#ifdef EDJE_PROGRAM_CACHE
1344static Eina_Bool
1345_edje_collection_free_prog_cache_matches_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata)
1346{
1347 eina_list_free((Eina_List *)data);
1348 return EINA_TRUE;
1349 key = NULL;
1350 hash = NULL;
1351 fdata = NULL;
1352}
1353#endif
1354
1355static void
1356_edje_object_pack_item_hints_set(Evas_Object *obj, Edje_Pack_Element *it)
1357{
1358 Evas_Coord w = 0, h = 0, minw, minh;
1359
1360 minw = it->min.w;
1361 minh = it->min.h;
1362
1363 if ((minw <= 0) && (minh <= 0))
1364 {
1365 edje_object_size_min_get(obj, &w, &h);
1366 if ((w <= 0) && (h <= 0))
1367 edje_object_size_min_calc(obj, &w, &h);
1368 }
1369 else
1370 {
1371 w = minw;
1372 h = minh;
1373 }
1374 if (((minw <= 0) && (minh <= 0)) && ((w > 0) || (h > 0)))
1375 evas_object_size_hint_min_set(obj, w, h);
1376 else
1377 evas_object_size_hint_min_set(obj, minw, minh);
1378
1379 evas_object_size_hint_request_set(obj, it->prefer.w, it->prefer.h);
1380 evas_object_size_hint_max_set(obj, it->max.w, it->max.h);
1381 evas_object_size_hint_padding_set(obj, it->padding.l, it->padding.r, it->padding.t, it->padding.b);
1382 evas_object_size_hint_align_set(obj, it->align.x, it->align.y);
1383 evas_object_size_hint_weight_set(obj, it->weight.x, it->weight.y);
1384 evas_object_size_hint_aspect_set(obj, it->aspect.mode, it->aspect.w, it->aspect.h);
1385
1386 evas_object_resize(obj, w, h);
1387}
1388
1389static const char *
1390_edje_find_alias(Eina_Hash *aliased, char *src, int *length)
1391{
1392 const char *alias;
1393 char *search;
1394
1395 *length = strlen(src);
1396 if (*length == 0) return NULL;
1397
1398 alias = eina_hash_find(aliased, src);
1399 if (alias) return alias;
1400
1401 search = strrchr(src, EDJE_PART_PATH_SEPARATOR);
1402 if (search == NULL) return NULL;
1403
1404 *search = '\0';
1405 alias = _edje_find_alias(aliased, src, length);
1406 *search = EDJE_PART_PATH_SEPARATOR;
1407
1408 return alias;
1409}
1410
1411static void
1412_cb_signal_repeat(void *data, Evas_Object *obj, const char *sig, const char *source)
1413{
1414 Edje_Pack_Element *pack_it;
1415 Evas_Object *parent;
1416 Edje *ed;
1417 Edje *ed_parent;
1418 char new_src[4096]; /* XXX is this max reasonable? */
1419 size_t length_parent = 0;
1420 size_t length_index = 0;
1421 size_t length_source;
1422 int i = 0;
1423 const char *alias = NULL;
1424 Edje_Message_Signal emsg;
1425
1426 parent = data;
1427 ed = _edje_fetch(obj);
1428 if (!ed) return;
1429
1430 pack_it = evas_object_data_get(obj, "\377 edje.box_item");
1431 if (!pack_it) pack_it = evas_object_data_get(obj, "\377 edje.table_item");
1432 if (pack_it)
1433 {
1434 if (!pack_it->name)
1435 {
1436 Eina_List *child = NULL;
1437 Evas_Object *o;
1438
1439 if (pack_it->parent->part->type == EDJE_PART_TYPE_BOX)
1440 {
1441 child = evas_object_box_children_get(pack_it->parent->object);
1442 }
1443 else if (pack_it->parent->part->type == EDJE_PART_TYPE_TABLE)
1444 {
1445 child = evas_object_table_children_get(pack_it->parent->object);
1446 }
1447
1448 EINA_LIST_FREE(child, o)
1449 {
1450 if (o == obj) break;
1451 i++;
1452 }
1453
1454 eina_list_free(child);
1455
1456 length_index = 12;
1457 }
1458 else
1459 {
1460 length_index = strlen(pack_it->name) + 2;
1461 }
1462 }
1463
1464 /* Replace snprint("%s%c%s") == memcpy + *new_src + memcat */
1465 if (ed->parent)
1466 length_parent = strlen(ed->parent);
1467 length_source = strlen(source);
1468 if (length_source + length_parent + 2 + length_index > sizeof(new_src))
1469 return;
1470
1471 if (ed->parent)
1472 memcpy(new_src, ed->parent, length_parent);
1473 if (ed->parent && length_index)
1474 {
1475 new_src[length_parent++] = EDJE_PART_PATH_SEPARATOR_INDEXL;
1476 if (length_index == 12)
1477 length_parent += eina_convert_itoa(i, new_src + length_parent);
1478 else
1479 {
1480 memcpy(new_src + length_parent, pack_it->name, length_index);
1481 length_parent += length_index - 2;
1482 }
1483 new_src[length_parent++] = EDJE_PART_PATH_SEPARATOR_INDEXR;
1484 }
1485
1486 new_src[length_parent] = EDJE_PART_PATH_SEPARATOR;
1487 memcpy(new_src + length_parent + 1, source, length_source + 1);
1488
1489 /* Handle alias renaming */
1490 ed_parent = _edje_fetch(parent);
1491 if (ed_parent && ed_parent->collection && ed_parent->collection->aliased)
1492 {
1493 int length;
1494
1495 alias = _edje_find_alias(ed_parent->collection->aliased, new_src, &length);
1496
1497 if (alias)
1498 {
1499 int origin;
1500
1501 /* Add back the end of the source */
1502 origin = strlen(new_src);
1503 length ++; /* Remove the trailing ':' from the count */
1504 if (origin > length)
1505 {
1506 char *tmp;
1507 size_t alias_length;
1508
1509 alias_length = strlen(alias);
1510 tmp = alloca(alias_length + origin - length + 2);
1511 memcpy(tmp, alias, alias_length);
1512 tmp[alias_length] = EDJE_PART_PATH_SEPARATOR;
1513 memcpy(tmp + alias_length + 1, new_src + length, origin - length + 1);
1514
1515 alias = tmp;
1516 }
1517 }
1518 }
1519
1520 emsg.sig = sig;
1521 emsg.src = alias ? alias : new_src;
1522 emsg.data = NULL;
1523 _edje_message_send(ed_parent, EDJE_QUEUE_SCRIPT,
1524 EDJE_MESSAGE_SIGNAL, 0, &emsg);
1525}
diff --git a/libraries/edje/src/lib/edje_lua.c b/libraries/edje/src/lib/edje_lua.c
new file mode 100644
index 0000000..d431d75
--- /dev/null
+++ b/libraries/edje/src/lib/edje_lua.c
@@ -0,0 +1,5150 @@
1#include "edje_private.h"
2
3#if 0
4/////////////////////////////////////////////////////////////////////////////
5// the below is deprecated and here for reference only until removed. look
6// at edje_lua2.c for the active workign code
7/////////////////////////////////////////////////////////////////////////////
8
9#include <lauxlib.h>
10#include <lualib.h>
11
12#define EDJE_LUA_GET 1
13#define EDJE_LUA_SET 2
14#define EDJE_LUA_FN 3
15
16typedef struct _Edje_Lua_Alloc Edje_Lua_Alloc;
17
18typedef struct _Edje_Lua_Ref Edje_Lua_Ref;
19
20typedef struct _Edje_Lua_Reg Edje_Lua_Reg;
21
22typedef struct _Edje_Lua_Timer Edje_Lua_Timer;
23
24typedef struct _Edje_Lua_Animator Edje_Lua_Animator;
25
26typedef struct _Edje_Lua_Poller Edje_Lua_Poller;
27
28typedef struct _Edje_Lua_Transform Edje_Lua_Transform;
29
30typedef struct _Edje_Lua_Transition Edje_Lua_Transition;
31
32typedef struct _Edje_Lua_Evas_Object Edje_Lua_Evas_Object;
33
34typedef struct _Edje_Lua_Edje_Part_Object Edje_Lua_Edje_Part_Object;
35
36typedef struct _Edje_Lua_Edje_Part_Description Edje_Lua_Edje_Part_Description;
37
38struct _Edje_Lua_Alloc
39{
40 size_t max, cur; /* maximal and current memory used by Lua */
41};
42
43struct _Edje_Lua_Ref
44{
45 int id;
46 lua_State *L;
47};
48
49struct _Edje_Lua_Reg
50{
51 const luaL_Reg *mt, *get, *set, *fn;
52};
53
54struct _Edje_Lua_Timer
55{
56 lua_State *L;
57 Ecore_Timer *et;
58 Edje_Lua_Ref *cb;
59};
60
61struct _Edje_Lua_Animator
62{
63 lua_State *L;
64 Ecore_Animator *ea;
65 Edje_Lua_Ref *cb;
66};
67
68struct _Edje_Lua_Poller
69{
70 lua_State *L;
71 Ecore_Poller *ep;
72 Edje_Lua_Ref *cb;
73};
74
75struct _Edje_Lua_Transform
76{
77 lua_State *L;
78 Evas_Transform et;
79};
80
81struct _Edje_Lua_Transition
82{
83 lua_State *L;
84 Ecore_Timer *et;
85 Edje_Lua_Ref *trans;
86 Edje_Lua_Ref *cb;
87 Edje_Lua_Ref *ref;
88 double dur;
89};
90
91struct _Edje_Lua_Evas_Object
92{
93 lua_State *L;
94 Edje *ed;
95 Evas_Object *eo;
96 Eina_Bool mouse_events;
97 Eina_List *cb;
98};
99
100struct _Edje_Lua_Edje_Part_Object
101{
102 lua_State *L;
103 Edje *ed;
104 Evas_Object *eo;
105 Edje_Real_Part *rp;
106 const char *key;
107};
108
109struct _Edje_Lua_Edje_Part_Description
110{
111 lua_State *L;
112 Edje *ed;
113 Evas_Object *eo;
114 Edje_Real_Part *rp;
115 Edje_Part_Description *pd;
116};
117
118jmp_buf _edje_lua_panic_jmp;
119
120static int
121_edje_lua_custom_panic(__UNUSED__ lua_State *L)
122{
123 CRITICAL("PANIC");
124 longjmp(_edje_lua_panic_jmp, 1);
125 return 1; /* longjmp() never returns, but this keep gcc happy */
126}
127
128void
129__edje_lua_error(const char *file, const char *fnc, int line, lua_State *L, int err_code)
130{
131 char *err_type;
132
133 switch (err_code)
134 {
135 case LUA_ERRRUN:
136 err_type = "runtime";
137 break;
138 case LUA_ERRSYNTAX:
139 err_type = "syntax";
140 break;
141 case LUA_ERRMEM:
142 err_type = "memory allocation";
143 break;
144 case LUA_ERRERR:
145 err_type = "error handler";
146 break;
147 default:
148 err_type = "unknown";
149 break;
150 }
151 eina_log_print
152 (_edje_default_log_dom, EINA_LOG_LEVEL_ERR, file, fnc, line,
153 "Lua %s error: %s", err_type, lua_tostring(L, -1));
154 // don't exit. this is BAD. lua script bugs will cause thngs like e to
155 // exit mysteriously ending your x session. bad!
156 // exit(-1);
157}
158
159lua_State *
160_edje_lua_new_thread(Edje *ed, lua_State *L)
161{
162#if 1 // newlua
163 lua_newtable(L);
164 ed->lua_ref = luaL_ref(L, LUA_REGISTRYINDEX);
165 /* inherit new environment from global environment */
166 lua_createtable(L, 1, 0);
167 lua_pushvalue(L, LUA_GLOBALSINDEX);
168 lua_setfield(L, -2, "__index");
169 lua_setmetatable(L, -2);
170 lua_setfenv(L, -2);
171 return L;
172#else
173 /* create new thread */
174 lua_State *thread = lua_newthread(L);
175 //printf ("new thread %d->%d\n", L, thread);
176 /* create new environment for new thread */
177 lua_newtable(L);
178 /* inherit new environment from global environment */
179 lua_createtable(L, 1, 0);
180 lua_pushvalue(L, LUA_GLOBALSINDEX);
181 lua_setfield(L, -2, "__index");
182 lua_setmetatable(L, -2);
183 lua_setfenv(L, -2);
184 return thread;
185#endif
186}
187
188void
189_edje_lua_free_thread(Edje *ed, lua_State *L)
190{
191#if 1 // newlua
192 luaL_unref(L, LUA_REGISTRYINDEX, ed->lua_ref);
193 lua_gc(L, LUA_GCCOLLECT, 0);
194#else
195 lua_pushthread(L);
196 lua_getfenv(L, -1);
197 lua_pushnil(L);
198 while (lua_next(L, -2))
199 {
200 // key at -2, value at -1
201 lua_pop(L, 1);
202 lua_pushvalue(L, -1);
203 lua_pushnil(L);
204 lua_rawset(L, -4);
205 }
206 lua_settop(L, 0);
207 lua_gc(L, LUA_GCCOLLECT, 0);
208#endif
209}
210
211/*
212 * only for debug, returns number of objects in registry
213 */
214static int
215_edje_lua_reg_count (lua_State *L)
216{
217 int count = 0;
218 lua_pushvalue(L, LUA_REGISTRYINDEX);
219 lua_pushnil(L);
220 while (lua_next(L, -2))
221 {
222 // key at -2, value at -1
223 lua_pop(L, 1);
224 count++;
225 }
226 lua_pop(L, 1);
227 return count;
228}
229
230static Edje_Lua_Ref *
231_edje_lua_new_ref(lua_State *L, int index)
232{
233 lua_pushvalue(L, index);
234 Edje_Lua_Ref *ref = malloc(sizeof(Edje_Lua_Ref));
235 ref->id = luaL_ref(L, LUA_REGISTRYINDEX);
236 ref->L = L;
237 return ref;
238}
239
240static void
241_edje_lua_get_ref(lua_State *L, Edje_Lua_Ref *ref)
242{
243 lua_rawgeti(L, LUA_REGISTRYINDEX, ref->id);
244}
245
246static void
247_edje_lua_free_ref(lua_State *L, Edje_Lua_Ref *ref)
248{
249 //printf ("_edje_lua_free_ref %d %d %d\n", L, lua_objlen(L, LUA_REGISTRYINDEX), _edje_lua_reg_count(L));
250 luaL_unref(L, LUA_REGISTRYINDEX, ref->id);
251 free(ref);
252 lua_gc(L, LUA_GCCOLLECT, 0);
253}
254
255void
256_edje_lua_new_reg(lua_State *L, int index, void *ptr)
257{
258 //printf ("_edje_lua_new_reg %d %d %d\n", L, ptr, _edje_lua_reg_count(L));
259 lua_pushvalue(L, index);
260 lua_pushlightuserdata(L, ptr);
261 lua_insert(L, -2);
262 lua_rawset(L, LUA_REGISTRYINDEX); /* freed in _edje_lua_free_reg */
263}
264
265void
266_edje_lua_get_reg(lua_State *L, void *ptr)
267{
268 //printf ("_edje_lua_get_reg %d %d\n", L, ptr);
269 lua_pushlightuserdata(L, ptr);
270 lua_rawget(L, LUA_REGISTRYINDEX);
271}
272
273void
274_edje_lua_free_reg(lua_State *L, void *ptr)
275{
276 //printf ("_edje_lua_free_reg %d %d %d\n", L, ptr, _edje_lua_reg_count(L));
277 lua_pushlightuserdata(L, ptr);
278 lua_pushnil(L);
279 lua_rawset(L, LUA_REGISTRYINDEX); /* created in _edje_lua_new_reg */
280 lua_gc(L, LUA_GCCOLLECT, 0);
281}
282
283static void
284_edje_lua_rawsetfield(lua_State *L, int index, const char *key)
285{
286 lua_pushstring(L, key);
287 lua_insert(L, -2);
288 if (index < 0)
289 lua_rawset(L, index - 1);
290 else
291 lua_rawset(L, index);
292}
293
294static void
295_edje_lua_rawgetfield(lua_State *L, int index, const char *key)
296{
297 lua_pushstring(L, key);
298 if (index < 0)
299 lua_rawget(L, index - 1);
300 else
301 lua_rawget(L, index);
302}
303
304static void
305_edje_lua_new_const(lua_State *L, const char *id, int val)
306{
307 lua_pushnumber(L, val);
308 lua_setglobal(L, id);
309}
310
311static void
312_edje_lua_new_metatable(lua_State *L, const Edje_Lua_Reg ** class)
313{
314 lua_newtable(L);
315 lua_pushlightuserdata(L, class);
316 lua_pushvalue(L, -2);
317 lua_rawset(L, LUA_REGISTRYINDEX); /* freed in _edje_lua_free_metatable */
318 lua_pushvalue(L, -1);
319 lua_pushlightuserdata(L, class);
320 lua_rawset(L, LUA_REGISTRYINDEX); /* freed in _edje_lua_free_metatable */
321}
322
323static void
324_edje_lua_get_metatable(lua_State *L, const Edje_Lua_Reg ** class)
325{
326 lua_pushlightuserdata(L, class);
327 lua_rawget(L, LUA_REGISTRYINDEX);
328}
329
330static void
331_edje_lua_free_metatable(lua_State *L, const Edje_Lua_Reg ** class)
332{
333 lua_pushlightuserdata(L, class);
334 lua_rawget(L, LUA_REGISTRYINDEX);
335 lua_pushnil(L);
336 lua_rawset(L, LUA_REGISTRYINDEX); /* created in _edje_lua_new_metatable */
337 lua_pushlightuserdata(L, class);
338 lua_pushnil(L);
339 lua_rawset(L, LUA_REGISTRYINDEX); /* created in _edje_lua_new_metatable */
340 lua_gc(L, LUA_GCCOLLECT, 0);
341}
342
343static void *
344_edje_lua_checkudata(lua_State *L, int pos, const Edje_Lua_Reg * module)
345{
346 luaL_checktype(L, pos, LUA_TUSERDATA);
347 lua_getmetatable(L, pos);
348 lua_rawget(L, LUA_REGISTRYINDEX);
349 Edje_Lua_Reg **class = lua_touserdata(L, -1);
350 lua_pop(L, 1); // class
351 int flag = 0;
352 int ptr = 0;
353 while (class[ptr] && !flag)
354 if (class[ptr++] == module)
355 flag = 1;
356 if (!flag)
357 {
358 lua_pushstring(L, "class type mismatch");
359 lua_error(L);
360 }
361 return lua_touserdata(L, pos);
362}
363
364static void
365_edje_lua_new_class(lua_State *L, const Edje_Lua_Reg ** class)
366{
367 int n = 0;
368 _edje_lua_new_metatable(L, class);
369 while (class && (class[n] != NULL))
370 {
371 luaL_register(L, NULL, class[n]->mt);
372 lua_pushstring(L, "hands off, it's none of your business!");
373 _edje_lua_rawsetfield(L, -2, "__metatable");
374
375 if (n == 0)
376 {
377 lua_newtable(L);
378 luaL_register(L, NULL, class[n]->set);
379 lua_rawseti (L, -2, EDJE_LUA_SET);
380
381 lua_newtable(L);
382 luaL_register(L, NULL, class[n]->get);
383 lua_rawseti (L, -2, EDJE_LUA_GET);
384
385 lua_newtable(L);
386 luaL_register(L, NULL, class[n]->fn);
387 lua_rawseti (L, -2, EDJE_LUA_FN);
388 }
389 else
390 {
391 lua_rawgeti(L, -1, EDJE_LUA_SET);
392 luaL_register(L, NULL, class[n]->set);
393 lua_pop(L, 1);
394
395 lua_rawgeti(L, -1, EDJE_LUA_GET);
396 luaL_register(L, NULL, class[n]->get);
397 lua_pop(L, 1);
398
399 lua_rawgeti(L, -1, EDJE_LUA_FN);
400 luaL_register(L, NULL, class[n]->fn);
401 lua_pop(L, 1);
402 }
403 n += 1;
404 }
405}
406
407static void
408_edje_lua_set_class(lua_State *L, int index, const Edje_Lua_Reg ** class)
409{
410 lua_newtable(L);
411 if (index < 0)
412 lua_setfenv(L, index - 1);
413 else
414 lua_setfenv(L, index);
415
416 _edje_lua_get_metatable(L, class);
417 if (index < 0)
418 lua_setmetatable(L, index - 1);
419 else
420 lua_setmetatable(L, index);
421}
422
423static int
424_edje_lua_look_fn(lua_State *L)
425{
426 lua_rawgeti(L, -1, EDJE_LUA_FN);
427 lua_pushvalue(L, 2); // key
428 lua_rawget(L, -2); // .fn[key]
429 if (lua_iscfunction(L, -1))
430 return 1;
431 else
432 {
433 lua_pop(L, 2); // .fn[key], .fn
434 return 0;
435 }
436}
437
438static int
439_edje_lua_look_get(lua_State *L)
440{
441 lua_rawgeti(L, -1, EDJE_LUA_GET);
442 lua_pushvalue(L, 2); // key
443 lua_rawget(L, -2); // .get[key]
444 if (lua_iscfunction(L, -1))
445 {
446 int err_code;
447
448 lua_pushvalue(L, 1);
449
450 if ((err_code = lua_pcall(L, 1, 1, 0)))
451 _edje_lua_error(L, err_code);
452 return 1;
453 }
454 else
455 {
456 lua_pop(L, 2); // .get[key], .get
457 return 0;
458 }
459}
460
461static int
462_edje_lua_look_set(lua_State *L)
463{
464 lua_rawgeti(L, -1, EDJE_LUA_SET);
465 lua_pushvalue(L, 2); // key
466 lua_rawget(L, -2); // .set[key]
467 if (lua_iscfunction(L, -1))
468 {
469 int err_code;
470
471 lua_pushvalue(L, 1); // obj
472 lua_pushvalue(L, 3); // value
473
474 if ((err_code = lua_pcall(L, 2, 0, 0))) // .set[key](obj,key,value)
475 _edje_lua_error(L, err_code);
476 return 1;
477 }
478 else
479 {
480 lua_pop(L, 2); // .set[key], .set
481 return 0;
482 }
483}
484
485/*
486 * Lua Class bindings
487 */
488
489const luaL_Reg lNil[] = {
490 {NULL, NULL} // sentinel
491};
492
493const luaL_Reg lClass_mt[];
494
495const luaL_Reg lClass_fn[];
496
497const Edje_Lua_Reg mClass = {
498 lClass_mt,
499 lNil,
500 lNil,
501 lClass_fn
502};
503
504static int
505_edje_lua_class_mt_index(lua_State *L)
506{
507 _edje_lua_checkudata(L, 1, &mClass);
508 lua_getmetatable(L, 1);
509 if (!_edje_lua_look_fn(L)) // look in lClass_fn
510 if (!_edje_lua_look_get(L)) // look in lClass_get
511 { // look in obj ref hash
512 lua_getfenv(L, 1);
513 lua_pushvalue(L, 2); // key
514 lua_rawget(L, -2);
515 }
516 return 1;
517}
518
519static int
520_edje_lua_class_mt_newindex(lua_State *L)
521{
522 _edje_lua_checkudata(L, 1, &mClass);
523 lua_getmetatable(L, 1);
524 if (!_edje_lua_look_set(L)) // look in lClass_set
525 { // look in obj ref hash
526 lua_getfenv(L, 1);
527 lua_pushvalue(L, 2);
528 lua_pushvalue(L, 3);
529 lua_rawset(L, -3);
530 }
531 return 0;
532}
533
534static int
535_edje_lua_class_mt_gc(lua_State *L)
536{
537 _edje_lua_checkudata(L, 1, &mClass);
538 //printf("_edje_lua_class_mt_gc\n");
539 /* FIXME has to be commented to not raise an error, solve differently
540 lua_getfield(L, 1, "del");
541 if (!lua_isnil(L, -1))
542 {
543 lua_pushvalue(L, 1);
544 int err_code;
545
546 if (err_code = lua_pcall(L, 1, 0, 0))
547 _edje_lua_error(L, err_code);
548 }
549 lua_pop(L, 1);
550 */
551 return 0;
552}
553
554static int
555_edje_lua_class_fn_set(lua_State *L)
556{
557 _edje_lua_checkudata(L, 1, &mClass);
558 /*
559 * for k,v in pairs(table) do
560 * obj[k] = v
561 * end
562 */
563 lua_pushnil(L);
564 while (lua_next(L, 2))
565 {
566 // key at -2, value at -1
567 lua_pushvalue(L, -2);
568 lua_insert(L, -2);
569 lua_settable(L, 1);
570 }
571 return 0;
572}
573
574static int
575_edje_lua_class_fn_get(lua_State *L)
576{
577 _edje_lua_checkudata(L, 1, &mClass);
578 /*
579 * res = {}
580 * mtG = getmetatable(obj)['.get']
581 * for k,v in pairs(mtG) do
582 * res[k] = obj[k]
583 * end
584 */
585 lua_newtable(L); // res
586 lua_getmetatable(L, 1); // mt
587 lua_getfield(L, -1, ".get");
588 lua_remove(L, -2); // mt
589
590 lua_pushnil(L);
591 while (lua_next(L, -2))
592 {
593 // key at -2, value at -1
594 lua_pop(L, 1); // value = cfunction
595 lua_pushvalue(L, -1); // key
596 lua_pushvalue(L, -1); // key
597 lua_gettable(L, 1); // obj[key]
598 lua_settable(L, 2); // res[key]
599 }
600 lua_pop(L, 1); // .get
601 return 1;
602}
603
604static int
605_edje_lua_class_itr_call(lua_State *L, int id)
606{
607 int err_code;
608
609 _edje_lua_checkudata(L, 1, &mClass);
610 lua_getmetatable(L, 1); // mt
611 lua_rawgeti(L, -1, id);
612 lua_remove(L, -2); // mt
613 lua_getglobal(L, "pairs");
614 lua_insert(L, -2);
615
616 if ((err_code = lua_pcall(L, 1, 3, 0)))
617 _edje_lua_error(L, err_code);
618 return 3;
619}
620
621static int
622_edje_lua_class_fn_gpairs(lua_State *L)
623{
624 _edje_lua_checkudata(L, 1, &mClass);
625 return _edje_lua_class_itr_call(L, EDJE_LUA_GET);
626}
627
628static int
629_edje_lua_class_fn_spairs(lua_State *L)
630{
631 _edje_lua_checkudata(L, 1, &mClass);
632 return _edje_lua_class_itr_call(L, EDJE_LUA_SET);
633}
634
635static int
636_edje_lua_class_fn_fpairs(lua_State *L)
637{
638 _edje_lua_checkudata(L, 1, &mClass);
639 return _edje_lua_class_itr_call(L, EDJE_LUA_FN);
640}
641
642static int
643_edje_lua_class_fn_pairs(lua_State *L)
644{
645 int err_code;
646
647 _edje_lua_checkudata(L, 1, &mClass);
648 lua_getfenv(L, 1);
649 lua_getglobal(L, "pairs");
650 lua_insert(L, -2);
651
652 if ((err_code = lua_pcall(L, 1, 3, 0)))
653 _edje_lua_error(L, err_code);
654 return 3;
655}
656
657static int
658_edje_lua_class_fn_ipairs(lua_State *L)
659{
660 int err_code;
661
662 _edje_lua_checkudata(L, 1, &mClass);
663 lua_getfenv(L, 1);
664 lua_getglobal(L, "ipairs");
665 lua_insert(L, -2);
666
667 if ((err_code = lua_pcall(L, 1, 3, 0)))
668 _edje_lua_error(L, err_code);
669 return 3;
670}
671
672const luaL_Reg lClass_mt[] = {
673 {"__index", _edje_lua_class_mt_index},
674 {"__newindex", _edje_lua_class_mt_newindex},
675 {"__gc", _edje_lua_class_mt_gc},
676 {NULL, NULL} // sentinel
677};
678
679const luaL_Reg lClass_fn[] = {
680 {"get", _edje_lua_class_fn_get},
681 {"set", _edje_lua_class_fn_set},
682 {"gpairs", _edje_lua_class_fn_gpairs},
683 {"spairs", _edje_lua_class_fn_spairs},
684 {"fpairs", _edje_lua_class_fn_fpairs},
685 {"pairs", _edje_lua_class_fn_pairs},
686 {"ipairs", _edje_lua_class_fn_ipairs},
687 {NULL, NULL} // sentinel
688};
689
690
691const luaL_Reg lTimer_get[];
692
693const luaL_Reg lTimer_set[];
694
695const luaL_Reg lTimer_fn[];
696
697const Edje_Lua_Reg mTimer = {
698 lNil,
699 lTimer_get,
700 lTimer_set,
701 lTimer_fn
702};
703
704const Edje_Lua_Reg *cTimer[] = {
705 &mClass,
706 &mTimer,
707 NULL // sentinel
708};
709
710static Eina_Bool
711_edje_lua_timer_cb(void *data)
712{
713 Edje_Lua_Timer *obj = data;
714 lua_State *L = obj->L;
715 int err_code;
716 Eina_Bool res;
717
718 _edje_lua_get_ref(L, obj->cb); // callback function
719 _edje_lua_get_reg(L, obj);
720
721 if ((err_code = lua_pcall(L, 1, 1, 0)))
722 {
723 _edje_lua_error(L, err_code);
724 return ECORE_CALLBACK_CANCEL;
725 }
726
727 res = luaL_optint(L, -1, ECORE_CALLBACK_CANCEL);
728 lua_pop(L, 1); // -- res
729
730/*
731 if (_edje_lua_panic_here())
732 printf("blahc\n");
733 else
734 lua_pop(L, 1); // -- res
735 */
736 if (res == ECORE_CALLBACK_CANCEL)
737 {
738 // delete object
739 _edje_lua_get_reg(L, obj);
740 lua_pushvalue(L, -1);
741 lua_pushstring(L, "del");
742 lua_gettable(L, -2);
743 lua_insert(L, -2);
744 if ((err_code = lua_pcall(L, 1, 0, 0)))
745 _edje_lua_error(L, err_code);
746 }
747 return res;
748}
749
750static int
751_edje_lua_timer_get_pending(lua_State *L)
752{
753 Edje_Lua_Timer *obj = _edje_lua_checkudata(L, 1, &mTimer);
754 if (obj->et)
755 lua_pushnumber(L, ecore_timer_pending_get(obj->et));
756 else
757 lua_pushnil(L);
758 return 1;
759}
760
761static int
762_edje_lua_timer_get_precision(lua_State *L)
763{
764 Edje_Lua_Timer *obj = _edje_lua_checkudata(L, 1, &mTimer);
765
766 if (obj->et)
767 lua_pushnumber(L, ecore_timer_precision_get());
768 else
769 lua_pushnil(L);
770
771 return 1;
772}
773
774static int
775_edje_lua_timer_get_interval(lua_State *L)
776{
777 Edje_Lua_Timer *obj = _edje_lua_checkudata(L, 1, &mTimer);
778
779 if (obj->et)
780 lua_pushnumber(L, ecore_timer_interval_get(obj->et));
781 else
782 lua_pushnil(L);
783
784 return 1;
785}
786
787const luaL_Reg lTimer_get[] = {
788 {"pending", _edje_lua_timer_get_pending},
789 {"precision", _edje_lua_timer_get_precision},
790 {"interval", _edje_lua_timer_get_interval},
791 {NULL, NULL} // sentinel
792};
793
794static int
795_edje_lua_timer_set_interval(lua_State *L)
796{
797 Edje_Lua_Timer *obj = _edje_lua_checkudata(L, 1, &mTimer);
798 if (obj->et)
799 ecore_timer_interval_set(obj->et, luaL_checknumber(L, 2));
800 return 0;
801}
802
803const luaL_Reg lTimer_set[] = {
804 {"interval", _edje_lua_timer_set_interval},
805 {NULL, NULL} // sentinel
806};
807
808static int
809_edje_lua_timer_fn_del(lua_State *L)
810{
811 Edje_Lua_Timer *obj = _edje_lua_checkudata(L, 1, &mTimer);
812 if (obj->et)
813 {
814 ecore_timer_del(obj->et);
815 obj->et = NULL;
816 }
817 if (obj->cb)
818 {
819 _edje_lua_free_ref(L, obj->cb); // created in _edje_lua_group_fn_timer
820 obj->cb = NULL;
821 }
822 _edje_lua_free_reg(L, obj); // created in _edje_lua_group_fn_timer
823 return 0;
824}
825
826static int
827_edje_lua_timer_fn_freeze(lua_State *L)
828{
829 Edje_Lua_Timer *obj = _edje_lua_checkudata(L, 1, &mTimer);
830 if (obj->et)
831 ecore_timer_freeze(obj->et);
832 return 0;
833}
834
835static int
836_edje_lua_timer_fn_thaw(lua_State *L)
837{
838 Edje_Lua_Timer *obj = _edje_lua_checkudata(L, 1, &mTimer);
839 if (obj->et)
840 ecore_timer_thaw(obj->et);
841 return 0;
842}
843
844static int
845_edje_lua_timer_fn_delay(lua_State *L)
846{
847 Edje_Lua_Timer *obj = _edje_lua_checkudata(L, 1, &mTimer);
848 if (obj->et)
849 ecore_timer_delay(obj->et, luaL_checknumber(L, 2));
850 return 0;
851}
852
853const luaL_Reg lTimer_fn[] = {
854 {"del", _edje_lua_timer_fn_del},
855 {"freeze", _edje_lua_timer_fn_freeze},
856 {"thaw", _edje_lua_timer_fn_thaw},
857 {"delay", _edje_lua_timer_fn_delay},
858 {NULL, NULL} // sentinel
859};
860
861const luaL_Reg lAnimator_get[];
862
863const luaL_Reg lAnimator_fn[];
864
865const Edje_Lua_Reg mAnimator = {
866 lNil,
867 lAnimator_get,
868 lNil,
869 lAnimator_fn
870};
871
872const Edje_Lua_Reg *cAnimator[] = {
873 &mClass,
874 &mAnimator,
875 NULL // sentinel
876};
877
878static Eina_Bool
879_edje_lua_animator_cb(void *data)
880{
881 Eina_Bool res;
882 int err;
883 Edje_Lua_Animator *obj = data;
884 lua_State *L = obj->L;
885
886 _edje_lua_get_ref(L, obj->cb);
887 _edje_lua_get_reg(L, obj);
888
889 if ((err = lua_pcall(L, 1, 1, 0)))
890 {
891 _edje_lua_error(L, err);
892 return ECORE_CALLBACK_CANCEL;
893 }
894
895 res = luaL_checkint(L, -1);
896 lua_pop(L, 1); // Pop res off the stack
897 if (res == ECORE_CALLBACK_CANCEL)
898 {
899 /* delete animator */
900 _edje_lua_get_reg(L, obj);
901 lua_pushvalue(L, -1);
902 lua_pushstring(L, "del");
903 lua_gettable(L, -2);
904 lua_insert(L, -2);
905 if ((err = lua_pcall(L, 1, 0, 0)))
906 _edje_lua_error(L, err);
907 }
908
909 return res;
910}
911
912static int
913_edje_lua_animator_get_frametime(lua_State *L)
914{
915 Edje_Lua_Animator *obj = _edje_lua_checkudata(L, 1, &mAnimator);
916
917 if (obj->ea)
918 lua_pushnumber(L, ecore_animator_frametime_get());
919 else
920 lua_pushnil(L);
921
922 return 1;
923}
924
925const luaL_Reg lAnimator_get[] = {
926 {"frametime", _edje_lua_animator_get_frametime},
927 {NULL, NULL}
928};
929
930static int
931_edje_lua_animator_fn_del(lua_State *L)
932{
933 Edje_Lua_Animator *obj = _edje_lua_checkudata(L, 1, &mAnimator);
934 if (obj->ea)
935 {
936 ecore_animator_del(obj->ea);
937 obj->ea = NULL;
938 }
939 if (obj->cb)
940 {
941 _edje_lua_free_ref(L, obj->cb); // created in _edje_lua_group_fn_animator
942 obj->cb = NULL;
943 }
944 _edje_lua_free_reg(L, obj); // created in _edje_lua_group_fn_animator
945 return 0;
946}
947
948const luaL_Reg lAnimator_fn[] = {
949 {"del", _edje_lua_animator_fn_del},
950 {NULL, NULL} // sentinel
951};
952
953const luaL_Reg lPoller_get[];
954
955const luaL_Reg lPoller_fn[];
956
957const Edje_Lua_Reg mPoller = {
958 lNil,
959 lPoller_get,
960 lNil,
961 lPoller_fn
962};
963
964const Edje_Lua_Reg *cPoller[] = {
965 &mClass,
966 &mPoller,
967 NULL // sentinel
968};
969
970static Eina_Bool
971_edje_lua_poller_cb(void *data)
972{
973 Eina_Bool res;
974 int err;
975 Edje_Lua_Poller *obj = data;
976 lua_State *L = obj->L;
977
978 _edje_lua_get_ref(L, obj->cb);
979 _edje_lua_get_reg(L, obj);
980
981 if ((err = lua_pcall(L, 1, 1, 0)))
982 {
983 _edje_lua_error(L, err);
984 return ECORE_CALLBACK_CANCEL;
985 }
986
987 res = luaL_checkint(L, -1);
988 lua_pop(L, 1); // Pop res off the stack
989 if (res == ECORE_CALLBACK_CANCEL)
990 {
991 /* delete poller */
992 _edje_lua_get_reg(L, obj);
993 lua_pushvalue(L, -1);
994 lua_pushstring(L, "del");
995 lua_gettable(L, -2);
996 lua_insert(L, -2);
997 if ((err = lua_pcall(L, 1, 0, 0)))
998 _edje_lua_error(L, err);
999 }
1000
1001 return res;
1002}
1003
1004static int
1005_edje_lua_poller_get_interval(lua_State *L)
1006{
1007 Edje_Lua_Poller *obj = _edje_lua_checkudata(L, 1, &mPoller);
1008
1009 if (obj->ep)
1010 lua_pushnumber(L, ecore_poller_poll_interval_get(ECORE_POLLER_CORE));
1011 else
1012 lua_pushnil(L);
1013
1014 return 1;
1015}
1016
1017const luaL_Reg lPoller_get[] = {
1018 {"interval", _edje_lua_poller_get_interval},
1019 {NULL, NULL}
1020};
1021
1022static int
1023_edje_lua_poller_fn_del(lua_State *L)
1024{
1025 Edje_Lua_Poller *obj = _edje_lua_checkudata(L, 1, &mPoller);
1026 if (obj->ep)
1027 {
1028 ecore_poller_del(obj->ep);
1029 obj->ep = NULL;
1030 }
1031
1032 if (obj->cb)
1033 {
1034 _edje_lua_free_ref(L, obj->cb); // created in _edje_lua_group_fn_poller
1035 obj->cb = NULL;
1036 }
1037 _edje_lua_free_reg(L, obj); // created in _edje_lua_group_fn_poller
1038
1039 return 0;
1040}
1041
1042const luaL_Reg lPoller_fn[] = {
1043 {"del", _edje_lua_poller_fn_del},
1044 {NULL, NULL}
1045};
1046
1047/*
1048 * Lua Edje Transform bindings
1049 */
1050
1051const luaL_Reg lTransform_get[];
1052
1053const luaL_Reg lTransform_set[];
1054
1055const luaL_Reg lTransform_fn[];
1056
1057const Edje_Lua_Reg mTransform = {
1058 lNil,
1059 lTransform_get,
1060 lTransform_set,
1061 lTransform_fn
1062};
1063
1064const Edje_Lua_Reg *cTransform[] = {
1065 &mClass,
1066 &mTransform,
1067 NULL // sentinel
1068};
1069
1070static int
1071_edje_lua_transform_get_matrix(lua_State *L)
1072{
1073 Edje_Lua_Transform *obj = _edje_lua_checkudata(L, 1, &mTransform);
1074 lua_createtable(L, 3, 0);
1075 lua_createtable(L, 3, 0);
1076 lua_pushnumber(L, obj->et.mxx); lua_rawseti(L, -2, 1);
1077 lua_pushnumber(L, obj->et.mxy); lua_rawseti(L, -2, 2);
1078 lua_pushnumber(L, obj->et.mxz); lua_rawseti(L, -2, 3);
1079 lua_rawseti(L, -2, 1);
1080 lua_createtable(L, 3, 0);
1081 lua_pushnumber(L, obj->et.myx); lua_rawseti(L, -2, 1);
1082 lua_pushnumber(L, obj->et.myy); lua_rawseti(L, -2, 2);
1083 lua_pushnumber(L, obj->et.myz); lua_rawseti(L, -2, 3);
1084 lua_rawseti(L, -2, 2);
1085 lua_createtable(L, 3, 0);
1086 lua_pushnumber(L, obj->et.mzx); lua_rawseti(L, -2, 1);
1087 lua_pushnumber(L, obj->et.mzy); lua_rawseti(L, -2, 2);
1088 lua_pushnumber(L, obj->et.mzz); lua_rawseti(L, -2, 3);
1089 lua_rawseti(L, -2, 3);
1090 return 1;
1091}
1092
1093const luaL_Reg lTransform_get[] = {
1094 {"matrix", _edje_lua_transform_get_matrix},
1095 {NULL, NULL} // sentinel
1096};
1097
1098static int
1099_edje_lua_transform_set_matrix(lua_State *L)
1100{
1101 Edje_Lua_Transform *obj = _edje_lua_checkudata(L, 1, &mTransform);
1102 luaL_checktype(L, 2, LUA_TTABLE);
1103 lua_rawgeti(L, 2, 1);
1104 luaL_checktype(L, -1, LUA_TTABLE);
1105 lua_rawgeti(L, -1, 1); obj->et.mxx = luaL_checknumber(L, -1); lua_pop(L, 1);
1106 lua_rawgeti(L, -1, 2); obj->et.mxy = luaL_checknumber(L, -1); lua_pop(L, 1);
1107 lua_rawgeti(L, -1, 3); obj->et.mxz = luaL_checknumber(L, -1); lua_pop(L, 1);
1108 lua_pop(L, 1);
1109 lua_rawgeti(L, 2, 2);
1110 luaL_checktype(L, -1, LUA_TTABLE);
1111 lua_rawgeti(L, -1, 1); obj->et.myx = luaL_checknumber(L, -1); lua_pop(L, 1);
1112 lua_rawgeti(L, -1, 2); obj->et.myy = luaL_checknumber(L, -1); lua_pop(L, 1);
1113 lua_rawgeti(L, -1, 3); obj->et.myz = luaL_checknumber(L, -1); lua_pop(L, 1);
1114 lua_pop(L, 1);
1115 lua_rawgeti(L, 2, 3);
1116 luaL_checktype(L, -1, LUA_TTABLE);
1117 lua_rawgeti(L, -1, 1); obj->et.mzx = luaL_checknumber(L, -1); lua_pop(L, 1);
1118 lua_rawgeti(L, -1, 2); obj->et.mzy = luaL_checknumber(L, -1); lua_pop(L, 1);
1119 lua_rawgeti(L, -1, 3); obj->et.mzz = luaL_checknumber(L, -1); lua_pop(L, 1);
1120 lua_pop(L, 1);
1121 return 0;
1122}
1123
1124const luaL_Reg lTransform_set[] = {
1125 {"matrix", _edje_lua_transform_set_matrix},
1126 {NULL, NULL} // sentinel
1127};
1128
1129static int
1130_edje_lua_transform_fn_identity(lua_State *L)
1131{
1132 Edje_Lua_Transform *obj = _edje_lua_checkudata(L, 1, &mTransform);
1133 evas_transform_identity_set(&(obj->et));
1134 return 0;
1135}
1136
1137static int
1138_edje_lua_transform_fn_rotate(lua_State *L)
1139{
1140 Edje_Lua_Transform *obj = _edje_lua_checkudata(L, 1, &mTransform);
1141 evas_transform_rotate(luaL_checknumber(L, 2), &(obj->et));
1142 return 0;
1143}
1144
1145static int
1146_edje_lua_transform_fn_translate(lua_State *L)
1147{
1148 Edje_Lua_Transform *obj = _edje_lua_checkudata(L, 1, &mTransform);
1149 evas_transform_translate(luaL_checknumber(L, 2), luaL_checknumber(L, 3), &(obj->et));
1150 return 0;
1151}
1152
1153static int
1154_edje_lua_transform_fn_scale(lua_State *L)
1155{
1156 Edje_Lua_Transform *obj = _edje_lua_checkudata(L, 1, &mTransform);
1157 evas_transform_scale(luaL_checknumber(L, 2), luaL_checknumber(L, 3), &(obj->et));
1158 return 0;
1159}
1160
1161static int
1162_edje_lua_transform_fn_shear(lua_State *L)
1163{
1164 Edje_Lua_Transform *obj = _edje_lua_checkudata(L, 1, &mTransform);
1165 evas_transform_shear(luaL_checknumber(L, 2), luaL_checknumber(L, 3), &(obj->et));
1166 return 0;
1167}
1168
1169static int
1170_edje_lua_transform_fn_compose(lua_State *L)
1171{
1172 Edje_Lua_Transform *obj = _edje_lua_checkudata(L, 1, &mTransform);
1173 Edje_Lua_Transform *tar = _edje_lua_checkudata(L, 2, &mTransform);
1174 evas_transform_compose(&(tar->et), &(obj->et));
1175 return 0;
1176}
1177
1178const luaL_Reg lTransform_fn[] = {
1179 {"identity", _edje_lua_transform_fn_identity},
1180 {"rotate", _edje_lua_transform_fn_rotate},
1181 {"translate", _edje_lua_transform_fn_translate},
1182 {"scale", _edje_lua_transform_fn_scale},
1183 {"shear", _edje_lua_transform_fn_shear},
1184 {"compose", _edje_lua_transform_fn_compose},
1185 {NULL, NULL} // sentinel
1186};
1187
1188/*
1189 * Lua Edje Transition bindings
1190 */
1191
1192const luaL_Reg lTransition_get[];
1193
1194const luaL_Reg lTransition_set[];
1195
1196const luaL_Reg lTransition_fn[];
1197
1198const Edje_Lua_Reg mTransition = {
1199 lNil,
1200 lTransition_get,
1201 lTransition_set,
1202 lTransition_fn
1203};
1204
1205const Edje_Lua_Reg *cTransition[] = {
1206 &mClass,
1207 &mTransition,
1208 NULL // sentinel
1209};
1210
1211const luaL_Reg lTransition_get[] = {
1212 {NULL, NULL} // sentinel
1213};
1214
1215const luaL_Reg lTransition_set[] = {
1216 {NULL, NULL} // sentinel
1217};
1218
1219const luaL_Reg lTransition_fn[] = {
1220 {NULL, NULL} // sentinel
1221};
1222
1223const luaL_Reg lObject_get[];
1224
1225const luaL_Reg lObject_set[];
1226
1227const luaL_Reg lObject_fn[];
1228
1229const Edje_Lua_Reg mObject = {
1230 lNil,
1231 lObject_get,
1232 lObject_set,
1233 lObject_fn
1234};
1235
1236static void
1237_edje_lua_object_del_cb(void *data, __UNUSED__ Evas * e, Evas_Object * obj, __UNUSED__ void *event_info)
1238{
1239 //printf("_edje_lua_object_delete_cb\n");
1240 lua_State *L = data;
1241 _edje_lua_get_reg(L, obj);
1242 Edje_Lua_Evas_Object *udata = _edje_lua_checkudata(L, -1, &mObject);
1243 lua_pop(L, 1);
1244 _edje_lua_free_reg(L, udata); // created in EDJE_LUA_SCRIPT_FN_ADD
1245 _edje_lua_free_reg(L, obj); // created in EDJE_LUA_SCRIPT_FN_ADD
1246
1247 Edje_Lua_Ref *ref;
1248 EINA_LIST_FREE(udata->cb, ref)
1249 _edje_lua_free_ref(L, ref);
1250}
1251
1252static int
1253_edje_lua_object_fn_del(lua_State *L)
1254{
1255 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1256
1257 if (obj->eo)
1258 {
1259 evas_object_del(obj->eo);
1260 obj->eo = NULL;
1261 obj->ed = NULL;
1262 }
1263 return 0;
1264}
1265
1266static int
1267_edje_lua_object_fn_show(lua_State *L)
1268{
1269 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1270 evas_object_show(obj->eo);
1271 return 0;
1272}
1273
1274static int
1275_edje_lua_object_fn_hide(lua_State *L)
1276{
1277 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1278 evas_object_hide(obj->eo);
1279 return 0;
1280}
1281
1282static int
1283_edje_lua_object_fn_move(lua_State *L)
1284{
1285 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1286 //printf ("%i %i %i %i\n", obj->ed->x, obj->ed->y, luaL_checkint (L, 2), luaL_checkint (L, 3));
1287 evas_object_move(obj->eo,
1288 obj->ed->x + luaL_checkint(L, 2),
1289 obj->ed->y + luaL_checkint(L, 3));
1290 return 0;
1291}
1292
1293static int
1294_edje_lua_object_fn_resize(lua_State *L)
1295{
1296 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1297 evas_object_resize(obj->eo, luaL_checkint(L, 2), luaL_checkint(L, 3));
1298 return 0;
1299}
1300
1301static int
1302_edje_lua_object_fn_raise(lua_State *L)
1303{
1304 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1305 evas_object_raise(obj->eo);
1306 return 0;
1307}
1308
1309static int
1310_edje_lua_object_fn_lower(lua_State *L)
1311{
1312 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1313 evas_object_lower(obj->eo);
1314 return 0;
1315}
1316
1317static int
1318_edje_lua_object_fn_stack_above(lua_State *L)
1319{
1320 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1321 Edje_Lua_Evas_Object *tar = _edje_lua_checkudata(L, 2, &mObject);
1322 evas_object_stack_above(obj->eo, tar->eo);
1323 return 0;
1324}
1325
1326static int
1327_edje_lua_object_fn_stack_below(lua_State *L)
1328{
1329 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1330 Edje_Lua_Evas_Object *tar = _edje_lua_checkudata(L, 2, &mObject);
1331 evas_object_stack_below(obj->eo, tar->eo);
1332 return 0;
1333}
1334
1335static int
1336_edje_lua_object_fn_clip_unset(lua_State *L)
1337{
1338 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1339 evas_object_clip_unset(obj->eo);
1340 return 0;
1341}
1342
1343const luaL_Reg lObject_fn[] = {
1344 {"del", _edje_lua_object_fn_del},
1345 {"show", _edje_lua_object_fn_show},
1346 {"hide", _edje_lua_object_fn_hide},
1347 {"move", _edje_lua_object_fn_move},
1348 {"resize", _edje_lua_object_fn_resize},
1349 {"raise", _edje_lua_object_fn_raise},
1350 {"lower", _edje_lua_object_fn_lower},
1351 {"stack_above", _edje_lua_object_fn_stack_above},
1352 {"stack_below", _edje_lua_object_fn_stack_below},
1353 {"clip_unset", _edje_lua_object_fn_clip_unset},
1354 {NULL, NULL} // sentinel
1355};
1356
1357static int
1358_edje_lua_object_get_name(lua_State *L)
1359{
1360 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1361 lua_pushstring(L, evas_object_name_get(obj->eo));
1362 return 1;
1363}
1364
1365static int
1366_edje_lua_object_get_geometry(lua_State *L)
1367{
1368 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1369 int x, y, w, h;
1370 evas_object_geometry_get(obj->eo, &x, &y, &w, &h);
1371 lua_createtable(L, 4, 0);
1372 lua_pushnumber(L, x);
1373 lua_rawseti(L, -2, 1);
1374 lua_pushnumber(L, y);
1375 lua_rawseti(L, -2, 2);
1376 lua_pushnumber(L, w);
1377 lua_rawseti(L, -2, 3);
1378 lua_pushnumber(L, h);
1379 lua_rawseti(L, -2, 4);
1380 return 1;
1381}
1382
1383static int
1384_edje_lua_object_get_type(lua_State *L)
1385{
1386 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1387 lua_pushstring(L, evas_object_type_get(obj->eo));
1388 return 1;
1389}
1390
1391static int
1392_edje_lua_object_get_layer(lua_State *L)
1393{
1394 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1395 lua_pushnumber(L, evas_object_layer_get(obj->eo));
1396 return 1;
1397}
1398
1399static int
1400_edje_lua_object_get_above(lua_State *L)
1401{
1402 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1403 Evas_Object *above = evas_object_above_get(obj->eo);
1404 _edje_lua_get_reg(L, above);
1405 // TODO create object if it does not already exist?
1406 return 1;
1407}
1408
1409static int
1410_edje_lua_object_get_below(lua_State *L)
1411{
1412 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1413 Evas_Object *below = evas_object_below_get(obj->eo);
1414 _edje_lua_get_reg(L, below);
1415 // TODO create object if it does not already exist?
1416 return 1;
1417}
1418
1419static int
1420_edje_lua_object_get_size_hint_min(lua_State *L)
1421{
1422 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1423 int w, h;
1424 evas_object_size_hint_min_get(obj->eo, &w, &h);
1425 lua_createtable(L, 2, 0);
1426 lua_pushnumber(L, w);
1427 lua_rawseti(L, -2, 1);
1428 lua_pushnumber(L, h);
1429 lua_rawseti(L, -2, 2);
1430 return 1;
1431}
1432
1433static int
1434_edje_lua_object_get_size_hint_max(lua_State *L)
1435{
1436 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1437 int w, h;
1438 evas_object_size_hint_max_get(obj->eo, &w, &h);
1439 lua_createtable(L, 2, 0);
1440 lua_pushnumber(L, w);
1441 lua_rawseti(L, -2, 1);
1442 lua_pushnumber(L, h);
1443 lua_rawseti(L, -2, 2);
1444 return 1;
1445}
1446
1447static int
1448_edje_lua_object_get_size_hint_request(lua_State *L)
1449{
1450 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1451 int w, h;
1452 evas_object_size_hint_request_get(obj->eo, &w, &h);
1453 lua_createtable(L, 2, 0);
1454 lua_pushnumber(L, w);
1455 lua_rawseti(L, -2, 1);
1456 lua_pushnumber(L, h);
1457 lua_rawseti(L, -2, 2);
1458 return 1;
1459}
1460
1461static int
1462_edje_lua_object_get_size_hint_aspect(lua_State *L)
1463{
1464 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1465 Evas_Aspect_Control a;
1466 int w, h;
1467 evas_object_size_hint_aspect_get(obj->eo, &a, &w, &h);
1468 lua_createtable(L, 3, 0);
1469 lua_pushnumber(L, a);
1470 lua_rawseti(L, -2, 1);
1471 lua_pushnumber(L, w);
1472 lua_rawseti(L, -2, 2);
1473 lua_pushnumber(L, h);
1474 lua_rawseti(L, -2, 3);
1475 return 1;
1476}
1477
1478static int
1479_edje_lua_object_get_size_hint_align(lua_State *L)
1480{
1481 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1482 double w, h;
1483 evas_object_size_hint_align_get(obj->eo, &w, &h);
1484 lua_createtable(L, 2, 0);
1485 lua_pushnumber(L, w);
1486 lua_rawseti(L, -2, 1);
1487 lua_pushnumber(L, h);
1488 lua_rawseti(L, -2, 2);
1489 return 1;
1490}
1491
1492static int
1493_edje_lua_object_get_size_hint_weight(lua_State *L)
1494{
1495 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1496 double w, h;
1497 evas_object_size_hint_weight_get(obj->eo, &w, &h);
1498 lua_createtable(L, 2, 0);
1499 lua_pushnumber(L, w);
1500 lua_rawseti(L, -2, 1);
1501 lua_pushnumber(L, h);
1502 lua_rawseti(L, -2, 2);
1503 return 1;
1504}
1505
1506static int
1507_edje_lua_object_get_size_hint_padding(lua_State *L)
1508{
1509 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1510 int l, r, t, b;
1511 evas_object_size_hint_padding_get(obj->eo, &l, &r, &t, &b);
1512 lua_createtable(L, 4, 0);
1513 lua_pushnumber(L, l);
1514 lua_rawseti(L, -2, 1);
1515 lua_pushnumber(L, r);
1516 lua_rawseti(L, -2, 2);
1517 lua_pushnumber(L, t);
1518 lua_rawseti(L, -2, 3);
1519 lua_pushnumber(L, b);
1520 lua_rawseti(L, -2, 4);
1521 return 1;
1522}
1523
1524static int
1525_edje_lua_object_get_visible(lua_State *L)
1526{
1527 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1528 lua_pushboolean(L, evas_object_visible_get(obj->eo));
1529 return 1;
1530}
1531
1532static int
1533_edje_lua_object_get_render_op(lua_State *L)
1534{
1535 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1536 lua_pushnumber(L, evas_object_render_op_get(obj->eo));
1537 return 1;
1538}
1539
1540static int
1541_edje_lua_object_get_anti_alias(lua_State *L)
1542{
1543 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1544 lua_pushboolean(L, evas_object_anti_alias_get(obj->eo));
1545 return 1;
1546}
1547
1548static int
1549_edje_lua_object_get_scale(lua_State *L)
1550{
1551 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1552 lua_pushnumber(L, evas_object_scale_get(obj->eo));
1553 return 1;
1554}
1555
1556static int
1557_edje_lua_object_get_color(lua_State *L)
1558{
1559 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1560 int r, g, b, a;
1561 evas_object_color_get(obj->eo, &r, &g, &b, &a);
1562 lua_createtable(L, 4, 0);
1563 lua_pushnumber(L, r);
1564 lua_rawseti(L, -2, 1);
1565 lua_pushnumber(L, g);
1566 lua_rawseti(L, -2, 2);
1567 lua_pushnumber(L, b);
1568 lua_rawseti(L, -2, 3);
1569 lua_pushnumber(L, a);
1570 lua_rawseti(L, -2, 4);
1571 return 1;
1572}
1573
1574static int
1575_edje_lua_object_get_color_interpolation(lua_State *L)
1576{
1577 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1578 lua_pushnumber(L, evas_object_color_interpolation_get(obj->eo));
1579 return 1;
1580}
1581
1582static int
1583_edje_lua_object_get_clip(lua_State *L)
1584{
1585 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1586 Evas_Object *clip = evas_object_clip_get(obj->eo);
1587 _edje_lua_get_reg(L, clip);
1588 // TODO create object if it does not already exist?
1589 return 1;
1590}
1591
1592static int
1593_edje_lua_object_get_clipees(lua_State *L)
1594{
1595 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1596 Eina_List *clipees = (Eina_List *) evas_object_clipees_get(obj->eo);
1597 Eina_List *l;
1598 Evas_Object *clip;
1599 int i = 1;
1600 lua_createtable(L, eina_list_count(clipees), 0);
1601 EINA_LIST_FOREACH(clipees, l, clip)
1602 {
1603 _edje_lua_get_reg(L, clip);
1604 // TODO create object if it does not already exist?
1605 lua_rawseti(L, -2, i++);
1606 }
1607 return 1;
1608}
1609
1610static int
1611_edje_lua_object_get_evas(lua_State *L)
1612{
1613 //Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1614 lua_pushnil(L);
1615 // FIXME implement Evas class in the first place?
1616 return 1;
1617}
1618
1619static int
1620_edje_lua_object_get_pass_events(lua_State *L)
1621{
1622 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1623 lua_pushboolean(L, evas_object_pass_events_get(obj->eo));
1624 return 1;
1625}
1626
1627static int
1628_edje_lua_object_get_repeat_events(lua_State *L)
1629{
1630 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1631 lua_pushboolean(L, evas_object_repeat_events_get(obj->eo));
1632 return 1;
1633}
1634
1635static int
1636_edje_lua_object_get_propagate_events(lua_State *L)
1637{
1638 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1639 lua_pushboolean(L, evas_object_propagate_events_get(obj->eo));
1640 return 1;
1641}
1642
1643static int
1644_edje_lua_object_get_focus(lua_State *L)
1645{
1646 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1647 lua_pushboolean(L, evas_object_focus_get(obj->eo));
1648 return 1;
1649}
1650
1651static int
1652_edje_lua_object_get_pointer_mode(lua_State *L)
1653{
1654 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1655 lua_pushnumber(L, evas_object_pointer_mode_get(obj->eo));
1656 return 1;
1657}
1658
1659static int
1660_edje_lua_object_get_precise_is_inside(lua_State *L)
1661{
1662 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1663 lua_pushboolean(L, evas_object_precise_is_inside_get(obj->eo));
1664 return 1;
1665}
1666
1667static int
1668_edje_lua_object_get_mouse_events(lua_State *L)
1669{
1670 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1671 lua_pushboolean(L, obj->mouse_events);
1672 return 1;
1673}
1674
1675const luaL_Reg lObject_get[] = {
1676 {"name", _edje_lua_object_get_name},
1677 {"geometry", _edje_lua_object_get_geometry},
1678 {"type", _edje_lua_object_get_type},
1679 {"layer", _edje_lua_object_get_layer},
1680 {"above", _edje_lua_object_get_above},
1681 {"below", _edje_lua_object_get_below},
1682 {"size_hint_min", _edje_lua_object_get_size_hint_min},
1683 {"size_hint_max", _edje_lua_object_get_size_hint_max},
1684 {"size_hint_request", _edje_lua_object_get_size_hint_request},
1685 {"size_hint_aspect", _edje_lua_object_get_size_hint_aspect},
1686 {"size_hint_align", _edje_lua_object_get_size_hint_align},
1687 {"size_hint_weight", _edje_lua_object_get_size_hint_weight},
1688 {"size_hint_padding", _edje_lua_object_get_size_hint_padding},
1689 {"visible", _edje_lua_object_get_visible},
1690 {"render_op", _edje_lua_object_get_render_op},
1691 {"anti_alias", _edje_lua_object_get_anti_alias},
1692 {"scale", _edje_lua_object_get_scale},
1693 {"color", _edje_lua_object_get_color},
1694 {"color_interpolation", _edje_lua_object_get_color_interpolation},
1695 {"clip", _edje_lua_object_get_clip},
1696 {"clipees", _edje_lua_object_get_clipees},
1697 {"evas", _edje_lua_object_get_evas},
1698 {"pass_events", _edje_lua_object_get_pass_events},
1699 {"repeat_events", _edje_lua_object_get_repeat_events},
1700 {"propagate_events", _edje_lua_object_get_propagate_events},
1701 {"focus", _edje_lua_object_get_focus},
1702 {"pointer_mode", _edje_lua_object_get_pointer_mode},
1703 {"precise_is_inside", _edje_lua_object_get_precise_is_inside},
1704 {"mouse_events", _edje_lua_object_get_mouse_events},
1705 {NULL, NULL} // sentinel
1706};
1707
1708static int
1709_edje_lua_object_set_name(lua_State *L)
1710{
1711 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1712 evas_object_name_set(obj->eo, luaL_checkstring(L, 2));
1713 return 0;
1714}
1715
1716static int
1717_edje_lua_object_set_layer(lua_State *L)
1718{
1719 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1720 evas_object_layer_set(obj->eo, luaL_checkint(L, 2));
1721 return 0;
1722}
1723
1724static int
1725_edje_lua_object_set_size_hint_min(lua_State *L)
1726{
1727 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1728 luaL_checktype(L, 2, LUA_TTABLE);
1729 lua_rawgeti(L, 2, 1);
1730 lua_rawgeti(L, 2, 2);
1731 evas_object_size_hint_min_set(obj->eo,
1732 luaL_checkint(L, -2),
1733 luaL_checkint(L, -1));
1734 return 0;
1735}
1736
1737static int
1738_edje_lua_object_set_size_hint_max(lua_State *L)
1739{
1740 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1741 luaL_checktype(L, 2, LUA_TTABLE);
1742 lua_rawgeti(L, 2, 1);
1743 lua_rawgeti(L, 2, 2);
1744 evas_object_size_hint_max_set(obj->eo,
1745 luaL_checkint(L, -2),
1746 luaL_checkint(L, -1));
1747 return 0;
1748}
1749
1750static int
1751_edje_lua_object_set_size_hint_request(lua_State *L)
1752{
1753 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1754 luaL_checktype(L, 2, LUA_TTABLE);
1755 lua_rawgeti(L, 2, 1);
1756 lua_rawgeti(L, 2, 2);
1757 evas_object_size_hint_request_set(obj->eo,
1758 luaL_checkint(L, -2),
1759 luaL_checkint(L, -1));
1760 return 0;
1761}
1762
1763static int
1764_edje_lua_object_set_size_hint_aspect(lua_State *L)
1765{
1766 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1767 luaL_checktype(L, 2, LUA_TTABLE);
1768 lua_rawgeti(L, 2, 1);
1769 lua_rawgeti(L, 2, 2);
1770 lua_rawgeti(L, 2, 3);
1771 evas_object_size_hint_aspect_set(obj->eo,
1772 luaL_checkint(L, -3),
1773 luaL_checkint(L, -2),
1774 luaL_checkint(L, -1));
1775 return 0;
1776}
1777
1778static int
1779_edje_lua_object_set_size_hint_align(lua_State *L)
1780{
1781 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1782 luaL_checktype(L, 2, LUA_TTABLE);
1783 lua_rawgeti(L, 2, 1);
1784 lua_rawgeti(L, 2, 2);
1785 evas_object_size_hint_align_set(obj->eo,
1786 luaL_checknumber(L, -2),
1787 luaL_checknumber(L, -1));
1788 return 0;
1789}
1790
1791static int
1792_edje_lua_object_set_size_hint_weight(lua_State *L)
1793{
1794 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1795 luaL_checktype(L, 2, LUA_TTABLE);
1796 lua_rawgeti(L, 2, 1);
1797 lua_rawgeti(L, 2, 2);
1798 evas_object_size_hint_weight_set(obj->eo,
1799 luaL_checknumber(L, -2),
1800 luaL_checknumber(L, -1));
1801 return 0;
1802}
1803
1804static int
1805_edje_lua_object_set_size_hint_padding(lua_State *L)
1806{
1807 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1808 luaL_checktype(L, 2, LUA_TTABLE);
1809 lua_rawgeti(L, 2, 1);
1810 lua_rawgeti(L, 2, 2);
1811 lua_rawgeti(L, 2, 3);
1812 lua_rawgeti(L, 2, 4);
1813 evas_object_size_hint_padding_set(obj->eo,
1814 luaL_checknumber(L, -4),
1815 luaL_checknumber(L, -3),
1816 luaL_checknumber(L, -2),
1817 luaL_checknumber(L, -1));
1818 return 0;
1819}
1820
1821static int
1822_edje_lua_object_set_render_op(lua_State *L)
1823{
1824 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1825 evas_object_render_op_set(obj->eo, luaL_checkint(L, 2));
1826 return 0;
1827}
1828
1829static int
1830_edje_lua_object_set_anti_alias(lua_State *L)
1831{
1832 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1833 evas_object_anti_alias_set(obj->eo, lua_toboolean(L, 2));
1834 return 0;
1835}
1836
1837static int
1838_edje_lua_object_set_scale(lua_State *L)
1839{
1840 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1841 evas_object_scale_set(obj->eo, luaL_checknumber(L, 2));
1842 return 0;
1843}
1844
1845static int
1846_edje_lua_object_set_color(lua_State *L)
1847{
1848 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1849 luaL_checktype(L, 2, LUA_TTABLE);
1850 lua_rawgeti(L, 2, 1);
1851 lua_rawgeti(L, 2, 2);
1852 lua_rawgeti(L, 2, 3);
1853 lua_rawgeti(L, 2, 4);
1854 evas_object_color_set(obj->eo,
1855 luaL_checkint(L, -4),
1856 luaL_checkint(L, -3),
1857 luaL_checkint(L, -2),
1858 luaL_checkint(L, -1));
1859 return 0;
1860}
1861
1862static int
1863_edje_lua_object_set_color_interpolation(lua_State *L)
1864{
1865 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1866 evas_object_color_interpolation_set(obj->eo, luaL_checkint(L, 2));
1867 return 0;
1868}
1869
1870static int
1871_edje_lua_object_set_clip(lua_State *L)
1872{
1873 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1874 Edje_Lua_Evas_Object *clip = _edje_lua_checkudata(L, 2, &mObject);
1875 evas_object_clip_set(obj->eo, clip->eo);
1876 return 0;
1877}
1878
1879static int
1880_edje_lua_object_set_pass_events(lua_State *L)
1881{
1882 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1883 evas_object_pass_events_set(obj->eo, lua_toboolean(L, 2));
1884 return 0;
1885}
1886
1887static int
1888_edje_lua_object_set_repeat_events(lua_State *L)
1889{
1890 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1891 evas_object_repeat_events_set(obj->eo, lua_toboolean(L, 2));
1892 return 0;
1893}
1894
1895static int
1896_edje_lua_object_set_propagate_events(lua_State *L)
1897{
1898 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1899 evas_object_propagate_events_set(obj->eo, lua_toboolean(L, 2));
1900 return 0;
1901}
1902
1903static int
1904_edje_lua_object_set_focus(lua_State *L)
1905{
1906 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1907 evas_object_focus_set(obj->eo, lua_toboolean(L, 2));
1908 return 0;
1909}
1910
1911static int
1912_edje_lua_object_set_pointer_mode(lua_State *L)
1913{
1914 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1915 evas_object_pointer_mode_set(obj->eo, luaL_checkint(L, 2));
1916 return 0;
1917}
1918
1919static int
1920_edje_lua_object_set_precise_is_inside(lua_State *L)
1921{
1922 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
1923 evas_object_precise_is_inside_set(obj->eo, lua_toboolean(L, 2));
1924 return 0;
1925}
1926
1927#define OBJECT_CB_MACRO(KEY) \
1928 lua_State *L = data; \
1929 _edje_lua_get_reg(L, obj); \
1930 lua_getfield(L, -1, KEY); \
1931 if (lua_type(L, -1) != LUA_TFUNCTION) \
1932 { \
1933 lua_pop(L, 2); \
1934 return; \
1935 } \
1936 lua_insert(L, -2);
1937
1938static void
1939_edje_lua_object_cb_mouse_in(void *data, __UNUSED__ Evas * e, Evas_Object * obj,
1940 void *event_info)
1941{
1942 OBJECT_CB_MACRO("mouse_in");
1943 Evas_Event_Mouse_In * ev = event_info;
1944 int err_code;
1945
1946 lua_pushnumber(L, ev->output.x);
1947 lua_pushnumber(L, ev->output.y);
1948 lua_pushnumber(L, ev->canvas.x);
1949 lua_pushnumber(L, ev->canvas.y);
1950
1951 if ((err_code = lua_pcall(L, 5, 0, 0)))
1952 _edje_lua_error(L, err_code);
1953}
1954
1955static void
1956_edje_lua_object_cb_mouse_out(void *data, __UNUSED__ Evas * e, Evas_Object * obj,
1957 void *event_info)
1958{
1959 OBJECT_CB_MACRO("mouse_out");
1960 Evas_Event_Mouse_In * ev = event_info;
1961 int err_code;
1962
1963 lua_pushnumber(L, ev->output.x);
1964 lua_pushnumber(L, ev->output.y);
1965 lua_pushnumber(L, ev->canvas.x);
1966 lua_pushnumber(L, ev->canvas.y);
1967
1968 if ((err_code = lua_pcall(L, 5, 0, 0)))
1969 _edje_lua_error(L, err_code);
1970}
1971
1972static void
1973_edje_lua_object_cb_mouse_down(void *data, __UNUSED__ Evas * e, Evas_Object * obj,
1974 void *event_info)
1975{
1976 OBJECT_CB_MACRO("mouse_down");
1977 Evas_Event_Mouse_Down * ev = event_info;
1978 int err_code;
1979
1980 lua_pushnumber(L, ev->button);
1981 lua_pushnumber(L, ev->output.x);
1982 lua_pushnumber(L, ev->output.y);
1983 lua_pushnumber(L, ev->canvas.x);
1984 lua_pushnumber(L, ev->canvas.y);
1985
1986 if ((err_code = lua_pcall(L, 6, 0, 0)))
1987 _edje_lua_error(L, err_code);
1988}
1989
1990static void
1991_edje_lua_object_cb_mouse_up(void *data, __UNUSED__ Evas * e, Evas_Object * obj,
1992 void *event_info)
1993{
1994 OBJECT_CB_MACRO("mouse_up");
1995 Evas_Event_Mouse_Up * ev = event_info;
1996 int err_code;
1997
1998 lua_pushnumber(L, ev->button);
1999 lua_pushnumber(L, ev->output.x);
2000 lua_pushnumber(L, ev->output.y);
2001 lua_pushnumber(L, ev->canvas.x);
2002 lua_pushnumber(L, ev->canvas.y);
2003
2004 if ((err_code = lua_pcall(L, 6, 0, 0)))
2005 _edje_lua_error(L, err_code);
2006}
2007
2008static void
2009_edje_lua_object_cb_mouse_move(void *data, __UNUSED__ Evas * e, Evas_Object * obj,
2010 void *event_info)
2011{
2012 OBJECT_CB_MACRO("mouse_move");
2013 Evas_Event_Mouse_Move * ev = event_info;
2014 int err_code;
2015
2016 lua_pushnumber(L, ev->buttons);
2017 lua_pushnumber(L, ev->cur.output.x);
2018 lua_pushnumber(L, ev->cur.output.y);
2019 lua_pushnumber(L, ev->cur.canvas.x);
2020 lua_pushnumber(L, ev->cur.canvas.y);
2021
2022 if ((err_code = lua_pcall(L, 6, 0, 0)))
2023 _edje_lua_error(L, err_code);
2024}
2025
2026static void
2027_edje_lua_object_cb_mouse_wheel(void *data, __UNUSED__ Evas * e, Evas_Object * obj,
2028 void *event_info)
2029{
2030 OBJECT_CB_MACRO("mouse_wheel");
2031 Evas_Event_Mouse_Wheel * ev = event_info;
2032 int err_code;
2033
2034 lua_pushnumber(L, ev->z);
2035 lua_pushnumber(L, ev->output.x);
2036 lua_pushnumber(L, ev->output.y);
2037 lua_pushnumber(L, ev->canvas.x);
2038 lua_pushnumber(L, ev->canvas.y);
2039
2040 if ((err_code = lua_pcall(L, 6, 0, 0)))
2041 _edje_lua_error(L, err_code);
2042}
2043
2044static int
2045_edje_lua_object_set_mouse_events(lua_State *L)
2046{
2047 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
2048 obj->mouse_events = lua_toboolean(L, 2);
2049 if (obj->mouse_events)
2050 {
2051 // add all mouse events
2052 evas_object_event_callback_add(obj->eo, EVAS_CALLBACK_MOUSE_IN, _edje_lua_object_cb_mouse_in, L);
2053 evas_object_event_callback_add(obj->eo, EVAS_CALLBACK_MOUSE_OUT, _edje_lua_object_cb_mouse_out, L);
2054 evas_object_event_callback_add(obj->eo, EVAS_CALLBACK_MOUSE_DOWN, _edje_lua_object_cb_mouse_down, L);
2055 evas_object_event_callback_add(obj->eo, EVAS_CALLBACK_MOUSE_UP, _edje_lua_object_cb_mouse_up, L);
2056 evas_object_event_callback_add(obj->eo, EVAS_CALLBACK_MOUSE_MOVE, _edje_lua_object_cb_mouse_move, L);
2057 evas_object_event_callback_add(obj->eo, EVAS_CALLBACK_MOUSE_WHEEL, _edje_lua_object_cb_mouse_wheel, L);
2058 }
2059 else
2060 {
2061 // delete all mouse events
2062 evas_object_event_callback_del(obj->eo, EVAS_CALLBACK_MOUSE_IN, _edje_lua_object_cb_mouse_in);
2063 evas_object_event_callback_del(obj->eo, EVAS_CALLBACK_MOUSE_OUT, _edje_lua_object_cb_mouse_out);
2064 evas_object_event_callback_del(obj->eo, EVAS_CALLBACK_MOUSE_DOWN, _edje_lua_object_cb_mouse_down);
2065 evas_object_event_callback_del(obj->eo, EVAS_CALLBACK_MOUSE_UP, _edje_lua_object_cb_mouse_up);
2066 evas_object_event_callback_del(obj->eo, EVAS_CALLBACK_MOUSE_MOVE, _edje_lua_object_cb_mouse_move);
2067 evas_object_event_callback_del(obj->eo, EVAS_CALLBACK_MOUSE_WHEEL, _edje_lua_object_cb_mouse_wheel);
2068 }
2069 return 0;
2070}
2071
2072const luaL_Reg lObject_set[] = {
2073 {"name", _edje_lua_object_set_name},
2074 {"layer", _edje_lua_object_set_layer},
2075 {"size_hint_min", _edje_lua_object_set_size_hint_min},
2076 {"size_hint_max", _edje_lua_object_set_size_hint_max},
2077 {"size_hint_request", _edje_lua_object_set_size_hint_request},
2078 {"size_hint_aspect", _edje_lua_object_set_size_hint_aspect},
2079 {"size_hint_align", _edje_lua_object_set_size_hint_align},
2080 {"size_hint_weight", _edje_lua_object_set_size_hint_weight},
2081 {"size_hint_padding", _edje_lua_object_set_size_hint_padding},
2082 {"render_op", _edje_lua_object_set_render_op},
2083 {"anti_alias", _edje_lua_object_set_anti_alias},
2084 {"scale", _edje_lua_object_set_scale},
2085 {"color", _edje_lua_object_set_color},
2086 {"color_interpolation", _edje_lua_object_set_color_interpolation},
2087 {"clip", _edje_lua_object_set_clip},
2088 {"pass_events", _edje_lua_object_set_pass_events},
2089 {"repeat_events", _edje_lua_object_set_repeat_events},
2090 {"propagate_events", _edje_lua_object_set_propagate_events},
2091 {"focus", _edje_lua_object_set_focus},
2092 {"pointer_mode", _edje_lua_object_get_pointer_mode},
2093 {"precise_is_inside", _edje_lua_object_get_precise_is_inside},
2094 {"mouse_events", _edje_lua_object_set_mouse_events},
2095 {NULL, NULL} // sentinel
2096};
2097
2098const Edje_Lua_Reg *cRectangle[] = {
2099 &mClass,
2100 &mObject,
2101 NULL // sentinel
2102};
2103
2104const luaL_Reg lImage_get[];
2105
2106const luaL_Reg lImage_set[];
2107
2108const Edje_Lua_Reg mImage = {
2109 lNil,
2110 lImage_get,
2111 lImage_set,
2112 lNil
2113};
2114
2115const Edje_Lua_Reg *cImage[] = {
2116 &mClass,
2117 &mObject,
2118 &mImage,
2119 NULL // sentinel
2120};
2121
2122static int
2123_edje_lua_image_get_size(lua_State *L)
2124{
2125 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mImage);
2126 int w, h;
2127 evas_object_image_size_get(obj->eo, &w, &h);
2128 lua_createtable(L, 2, 0);
2129 lua_pushnumber(L, w);
2130 lua_rawseti(L, -2, 1);
2131 lua_pushnumber(L, h);
2132 lua_rawseti(L, -2, 2);
2133 return 1;
2134};
2135
2136const luaL_Reg lImage_get[] = {
2137 {"size", _edje_lua_image_get_size},
2138 {NULL, NULL} // sentinel
2139};
2140
2141static int
2142_edje_lua_image_set_file(lua_State *L)
2143{
2144 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mImage);
2145 int id = edje_edit_image_id_get(obj->ed->obj, luaL_checkstring(L, 2));
2146 char buf[256];
2147 sprintf(buf, "edje/images/%i", id);
2148 evas_object_image_file_set(obj->eo, obj->ed->path, buf);
2149 return 0;
2150}
2151
2152static int
2153_edje_lua_image_set_fill(lua_State *L)
2154{
2155 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mImage);
2156 luaL_checktype(L, 2, LUA_TTABLE);
2157 lua_rawgeti(L, 2, 1);
2158 lua_rawgeti(L, 2, 2);
2159 lua_rawgeti(L, 2, 3);
2160 lua_rawgeti(L, 2, 4);
2161 evas_object_image_fill_set(obj->eo,
2162 luaL_checkint(L, -4),
2163 luaL_checkint(L, -3),
2164 luaL_checkint(L, -2), luaL_checkint(L, -1));
2165 return 0;
2166}
2167
2168static int
2169_edje_lua_image_set_fill_transform(lua_State *L)
2170{
2171 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mImage);
2172 Edje_Lua_Transform *tar = _edje_lua_checkudata(L, 2, &mTransform);
2173 evas_object_image_fill_transform_set(obj->eo, &(tar->et));
2174 return 0;
2175}
2176
2177static int
2178_edje_lua_image_set_alpha(lua_State *L)
2179{
2180 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject);
2181 evas_object_image_alpha_set(obj->eo, lua_toboolean(L, 2));
2182 return 0;
2183}
2184
2185const luaL_Reg lImage_set[] = {
2186 {"file", _edje_lua_image_set_file},
2187 {"fill", _edje_lua_image_set_fill},
2188 {"fill_transform", _edje_lua_image_set_fill_transform},
2189 {"alpha", _edje_lua_image_set_alpha},
2190 {NULL, NULL} // sentinel
2191};
2192
2193const luaL_Reg lLine_get[];
2194const luaL_Reg lLine_set[];
2195
2196const Edje_Lua_Reg mLine = {
2197 lNil,
2198 lLine_get,
2199 lLine_set,
2200 lNil
2201};
2202
2203const Edje_Lua_Reg *cLine[] = {
2204 &mClass,
2205 &mObject,
2206 &mLine,
2207 NULL // sentinel
2208};
2209
2210static int
2211_edje_lua_line_get_xy(lua_State *L)
2212{
2213 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mLine);
2214 int x1, y1, x2, y2;
2215 evas_object_line_xy_get(obj->eo, &x1, &y1, &x2, &y2);
2216 lua_createtable(L, 4, 0);
2217 lua_pushnumber(L, x1); lua_rawseti(L, -2, 1);
2218 lua_pushnumber(L, y1); lua_rawseti(L, -2, 2);
2219 lua_pushnumber(L, x2); lua_rawseti(L, -2, 3);
2220 lua_pushnumber(L, y2); lua_rawseti(L, -2, 4);
2221 return 1;
2222}
2223
2224const luaL_Reg lLine_get[] = {
2225 {"xy", _edje_lua_line_get_xy},
2226 {NULL, NULL} // sentinel
2227};
2228
2229static int
2230_edje_lua_line_set_xy(lua_State *L)
2231{
2232 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mLine);
2233 luaL_checktype(L, 2, LUA_TTABLE);
2234 lua_rawgeti(L, 2, 1);
2235 lua_rawgeti(L, 2, 2);
2236 lua_rawgeti(L, 2, 3);
2237 lua_rawgeti(L, 2, 4);
2238 evas_object_line_xy_set(obj->eo,
2239 luaL_checkint(L, -4),
2240 luaL_checkint(L, -3),
2241 luaL_checkint(L, -2),
2242 luaL_checkint(L, -1));
2243 return 0;
2244}
2245
2246const luaL_Reg lLine_set[] = {
2247 {"xy", _edje_lua_line_set_xy},
2248 {NULL, NULL} // sentinel
2249};
2250
2251const luaL_Reg lPolygon_fn[];
2252
2253const Edje_Lua_Reg mPolygon = {
2254 lNil,
2255 lNil,
2256 lNil,
2257 lPolygon_fn
2258};
2259
2260const Edje_Lua_Reg *cPolygon[] = {
2261 &mClass,
2262 &mObject,
2263 &mPolygon,
2264 NULL // sentinel
2265};
2266
2267static int
2268_edje_lua_polygon_fn_point_add(lua_State *L)
2269{
2270 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mPolygon);
2271 evas_object_polygon_point_add(obj->eo,
2272 luaL_checknumber(L, 2),
2273 luaL_checknumber(L, 3));
2274 return 0;
2275}
2276
2277static int
2278_edje_lua_polygon_fn_points_clear(lua_State *L)
2279{
2280 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mPolygon);
2281 evas_object_polygon_points_clear(obj->eo);
2282 return 0;
2283}
2284
2285const luaL_Reg lPolygon_fn[] = {
2286 {"point_add", _edje_lua_polygon_fn_point_add},
2287 {"points_clear", _edje_lua_polygon_fn_points_clear},
2288 {NULL, NULL} // sentinel
2289};
2290
2291const luaL_Reg lTable_get[];
2292
2293const luaL_Reg lTable_set[];
2294
2295const luaL_Reg lTable_fn[];
2296
2297const Edje_Lua_Reg mTable = {
2298 lNil,
2299 lTable_get,
2300 lTable_set,
2301 lTable_fn
2302};
2303
2304const Edje_Lua_Reg *cTable[] = {
2305 &mClass,
2306 &mObject,
2307 &mTable,
2308 NULL // sentinel
2309};
2310
2311static int
2312_edje_lua_table_get_homogeneous(lua_State *L)
2313{
2314 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mTable);
2315 lua_pushnumber(L, evas_object_table_homogeneous_get(obj->eo));
2316 return 1;
2317}
2318
2319static int
2320_edje_lua_table_get_padding(lua_State *L)
2321{
2322 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mTable);
2323 int x, y;
2324 evas_object_table_padding_get(obj->eo, &x, &y);
2325 lua_createtable(L, 2, 0);
2326 lua_pushnumber(L, x);
2327 lua_rawseti(L, -2, 1);
2328 lua_pushnumber(L, y);
2329 lua_rawseti(L, -2, 2);
2330 return 1;
2331}
2332
2333static int
2334_edje_lua_table_get_align(lua_State *L)
2335{
2336 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mTable);
2337 double x, y;
2338 evas_object_table_align_get(obj->eo, &x, &y);
2339 lua_createtable(L, 2, 0);
2340 lua_pushnumber(L, x);
2341 lua_rawseti(L, -2, 1);
2342 lua_pushnumber(L, y);
2343 lua_rawseti(L, -2, 2);
2344 return 1;
2345}
2346
2347static int
2348_edje_lua_table_get_col_row_size(lua_State *L)
2349{
2350 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mTable);
2351 int x, y;
2352 evas_object_table_col_row_size_get(obj->eo, &x, &y);
2353 lua_createtable(L, 2, 0);
2354 lua_pushnumber(L, x);
2355 lua_rawseti(L, -2, 1);
2356 lua_pushnumber(L, y);
2357 lua_rawseti(L, -2, 2);
2358 return 1;
2359}
2360
2361static int
2362_edje_lua_table_get_children(lua_State *L)
2363{
2364 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mTable);
2365 Eina_List *children = (Eina_List *) evas_object_table_children_get(obj->eo);
2366 Eina_List *l;
2367 Evas_Object *child;
2368 int i = 1;
2369 lua_createtable(L, eina_list_count(children), 0);
2370 EINA_LIST_FOREACH(children, l, child)
2371 {
2372 _edje_lua_get_reg(L, child);
2373 // TODO create object if it does not already exist?
2374 lua_rawseti(L, -2, i++);
2375 }
2376 return 1;
2377}
2378
2379const luaL_Reg lTable_get[] = {
2380 {"homogeneous", _edje_lua_table_get_homogeneous},
2381 {"padding", _edje_lua_table_get_padding},
2382 {"align", _edje_lua_table_get_align},
2383 {"col_row_size", _edje_lua_table_get_col_row_size},
2384 {"children", _edje_lua_table_get_children},
2385 {NULL, NULL} // sentinel
2386};
2387
2388static int
2389_edje_lua_table_set_homogeneous(lua_State *L)
2390{
2391 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mTable);
2392 evas_object_table_homogeneous_set(obj->eo,
2393 luaL_checkint(L, 2));
2394 return 0;
2395}
2396
2397static int
2398_edje_lua_table_set_padding(lua_State *L)
2399{
2400 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mTable);
2401 luaL_checktype(L, 2, LUA_TTABLE);
2402 lua_rawgeti(L, 2, 1);
2403 lua_rawgeti(L, 2, 2);
2404 evas_object_table_padding_set(obj->eo,
2405 luaL_checkint(L, -2),
2406 luaL_checkint(L, -1));
2407 return 0;
2408}
2409
2410static int
2411_edje_lua_table_set_align(lua_State *L)
2412{
2413 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mTable);
2414 luaL_checktype(L, 2, LUA_TTABLE);
2415 lua_rawgeti(L, 2, 1);
2416 lua_rawgeti(L, 2, 2);
2417 evas_object_table_align_set(obj->eo,
2418 luaL_checknumber(L, -2),
2419 luaL_checknumber(L, -1));
2420 return 0;
2421}
2422
2423const luaL_Reg lTable_set[] = {
2424 {"homogeneous", _edje_lua_table_set_homogeneous},
2425 {"padding", _edje_lua_table_set_padding},
2426 {"align", _edje_lua_table_set_align},
2427 {NULL, NULL} // sentinel
2428};
2429
2430static int
2431_edje_lua_table_fn_pack(lua_State *L)
2432{
2433 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mTable);
2434 Edje_Lua_Evas_Object *tar = _edje_lua_checkudata(L, 2, &mObject);
2435 lua_pushboolean(L,
2436 evas_object_table_pack(obj->eo, tar->eo,
2437 luaL_checkint(L, 3),
2438 luaL_checkint(L, 4),
2439 luaL_checkint(L, 5),
2440 luaL_checkint(L, 6)));
2441 return 1;
2442}
2443
2444static int
2445_edje_lua_table_fn_unpack(lua_State *L)
2446{
2447 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mTable);
2448 Edje_Lua_Evas_Object *tar = _edje_lua_checkudata(L, 2, &mObject);
2449 lua_pushboolean(L,
2450 evas_object_table_unpack(obj->eo, tar->eo));
2451 return 1;
2452}
2453
2454static int
2455_edje_lua_table_fn_clear(lua_State *L)
2456{
2457 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mTable);
2458 evas_object_table_clear(obj->eo, lua_toboolean(L, 2));
2459 return 0;
2460}
2461
2462const luaL_Reg lTable_fn[] = {
2463 {"pack", _edje_lua_table_fn_pack},
2464 {"unpack", _edje_lua_table_fn_unpack},
2465 {"clear", _edje_lua_table_fn_clear},
2466 {NULL, NULL} // sentinel
2467};
2468
2469const luaL_Reg lDescription_get[];
2470
2471const luaL_Reg lDescription_set[];
2472
2473const Edje_Lua_Reg mDescription = {
2474 lNil,
2475 lDescription_get,
2476 lDescription_set,
2477 lNil
2478};
2479
2480const Edje_Lua_Reg *cDescription[] = {
2481 &mClass,
2482 &mObject,
2483 &mDescription,
2484 NULL // sentinel
2485};
2486
2487static int
2488_edje_lua_description_get_alignment(lua_State *L)
2489{
2490 Edje_Lua_Edje_Part_Description *obj =
2491 _edje_lua_checkudata(L, 1, &mDescription);
2492 if (!obj->rp->custom) return 0;
2493 lua_createtable(L, 2, 0);
2494 lua_pushnumber(L, TO_DOUBLE(obj->rp->custom->description->align.x));
2495 lua_rawseti(L, -2, 1);
2496 lua_pushnumber(L, TO_DOUBLE(obj->rp->custom->description->align.y));
2497 lua_rawseti(L, -2, 1);
2498 return 1;
2499}
2500
2501static int
2502_edje_lua_description_get_min(lua_State *L)
2503{
2504 Edje_Lua_Edje_Part_Description *obj =
2505 _edje_lua_checkudata(L, 1, &mDescription);
2506 if (!obj->rp->custom) return 0;
2507 lua_createtable(L, 2, 0);
2508 lua_pushnumber(L, obj->rp->custom->description->min.w);
2509 lua_rawseti(L, -2, 1);
2510 lua_pushnumber(L, obj->rp->custom->description->min.h);
2511 lua_rawseti(L, -2, 1);
2512 return 1;
2513}
2514
2515static int
2516_edje_lua_description_get_max(lua_State *L)
2517{
2518 Edje_Lua_Edje_Part_Description *obj =
2519 _edje_lua_checkudata(L, 1, &mDescription);
2520 if (!obj->rp->custom) return 0;
2521 lua_createtable(L, 2, 0);
2522 lua_pushnumber(L, obj->rp->custom->description->max.w);
2523 lua_rawseti(L, -2, 1);
2524 lua_pushnumber(L, obj->rp->custom->description->max.h);
2525 lua_rawseti(L, -2, 1);
2526 return 1;
2527}
2528
2529static int
2530_edje_lua_description_get_step(lua_State *L)
2531{
2532 Edje_Lua_Edje_Part_Description *obj =
2533 _edje_lua_checkudata(L, 1, &mDescription);
2534 if (!obj->rp->custom) return 0;
2535 lua_createtable(L, 2, 0);
2536 lua_pushnumber(L, obj->rp->custom->description->step.x);
2537 lua_rawseti(L, -2, 1);
2538 lua_pushnumber(L, obj->rp->custom->description->step.y);
2539 lua_rawseti(L, -2, 1);
2540 return 1;
2541}
2542
2543static int
2544_edje_lua_description_get_aspect(lua_State *L)
2545{
2546 Edje_Lua_Edje_Part_Description *obj =
2547 _edje_lua_checkudata(L, 1, &mDescription);
2548 if (!obj->rp->custom) return 0;
2549 lua_createtable(L, 2, 0);
2550 lua_pushnumber(L, TO_DOUBLE(obj->rp->custom->description->aspect.min));
2551 lua_rawseti(L, -2, 1);
2552 lua_pushnumber(L, TO_DOUBLE(obj->rp->custom->description->aspect.max));
2553 lua_rawseti(L, -2, 1);
2554 return 1;
2555}
2556
2557static int
2558_edje_lua_description_get_aspect_pref(lua_State *L)
2559{
2560 Edje_Lua_Edje_Part_Description *obj =
2561 _edje_lua_checkudata(L, 1, &mDescription);
2562 if (!obj->rp->custom) return 0;
2563 lua_pushnumber(L, obj->rp->custom->description->aspect.prefer);
2564 return 1;
2565}
2566
2567static int
2568_edje_lua_description_get_color(lua_State *L)
2569{
2570 Edje_Lua_Edje_Part_Description *obj =
2571 _edje_lua_checkudata(L, 1, &mDescription);
2572 /* check whether this part has a "custom" state */
2573 if (!obj->rp->custom) return 0;
2574 lua_createtable(L, 4, 0);
2575 lua_pushnumber(L, obj->rp->custom->description->color.r);
2576 lua_rawseti(L, -2, 1);
2577 lua_pushnumber(L, obj->rp->custom->description->color.g);
2578 lua_rawseti(L, -2, 2);
2579 lua_pushnumber(L, obj->rp->custom->description->color.b);
2580 lua_rawseti(L, -2, 3);
2581 lua_pushnumber(L, obj->rp->custom->description->color.a);
2582 lua_rawseti(L, -2, 4);
2583 return 1;
2584}
2585
2586static int
2587_edje_lua_description_get_color2(lua_State *L)
2588{
2589 Edje_Lua_Edje_Part_Description *obj =
2590 _edje_lua_checkudata(L, 1, &mDescription);
2591 if (!obj->rp->custom) return 0;
2592 lua_createtable(L, 4, 0);
2593 lua_pushnumber(L, obj->rp->custom->description->color2.r);
2594 lua_rawseti(L, -2, 1);
2595 lua_pushnumber(L, obj->rp->custom->description->color2.g);
2596 lua_rawseti(L, -2, 2);
2597 lua_pushnumber(L, obj->rp->custom->description->color2.b);
2598 lua_rawseti(L, -2, 3);
2599 lua_pushnumber(L, obj->rp->custom->description->color2.a);
2600 lua_rawseti(L, -2, 4);
2601 return 1;
2602}
2603
2604static int
2605_edje_lua_description_get_color3(lua_State *L)
2606{
2607 Edje_Lua_Edje_Part_Description *obj =
2608 _edje_lua_checkudata(L, 1, &mDescription);
2609 if (!obj->rp->custom) return 0;
2610 lua_createtable(L, 4, 0);
2611 lua_pushnumber(L, obj->rp->custom->description->color3.r);
2612 lua_rawseti(L, -2, 1);
2613 lua_pushnumber(L, obj->rp->custom->description->color3.g);
2614 lua_rawseti(L, -2, 2);
2615 lua_pushnumber(L, obj->rp->custom->description->color3.b);
2616 lua_rawseti(L, -2, 3);
2617 lua_pushnumber(L, obj->rp->custom->description->color3.a);
2618 lua_rawseti(L, -2, 4);
2619 return 1;
2620}
2621
2622static int
2623_edje_lua_description_get_color_class(lua_State *L)
2624{
2625 Edje_Lua_Edje_Part_Description *obj =
2626 _edje_lua_checkudata(L, 1, &mDescription);
2627 if (!obj->rp->custom) return 0;
2628 lua_pushstring(L, obj->rp->custom->description->color_class);
2629 return 1;
2630}
2631
2632static int
2633_edje_lua_description_get_rel1(lua_State *L)
2634{
2635 Edje_Lua_Edje_Part_Description *obj =
2636 _edje_lua_checkudata(L, 1, &mDescription);
2637 if (!obj->rp->custom) return 0;
2638 lua_createtable(L, 2, 0);
2639 lua_pushnumber(L, TO_DOUBLE(obj->rp->custom->description->rel1.relative_x));
2640 lua_rawseti(L, -2, 1);
2641 lua_pushnumber(L, TO_DOUBLE(obj->rp->custom->description->rel1.relative_y));
2642 lua_rawseti(L, -2, 2);
2643 return 1;
2644}
2645
2646static int
2647_edje_lua_description_get_rel1_to(lua_State *L)
2648{
2649 Edje_Lua_Edje_Part_Description *obj =
2650 _edje_lua_checkudata(L, 1, &mDescription);
2651 if (!obj->rp->custom) return 0;
2652 lua_createtable(L, 2, 0);
2653 lua_pushnumber(L, obj->rp->custom->description->rel1.id_x);
2654 lua_rawseti(L, -2, 1);
2655 lua_pushnumber(L, obj->rp->custom->description->rel1.id_y);
2656 lua_rawseti(L, -2, 2);
2657 return 1;
2658}
2659
2660static int
2661_edje_lua_description_get_rel1_offset(lua_State *L)
2662{
2663 Edje_Lua_Edje_Part_Description *obj =
2664 _edje_lua_checkudata(L, 1, &mDescription);
2665 if (!obj->rp->custom) return 0;
2666 lua_createtable(L, 2, 0);
2667 lua_pushnumber(L, obj->rp->custom->description->rel1.offset_x);
2668 lua_rawseti(L, -2, 1);
2669 lua_pushnumber(L, obj->rp->custom->description->rel1.offset_y);
2670 lua_rawseti(L, -2, 2);
2671 return 1;
2672}
2673
2674static int
2675_edje_lua_description_get_rel2(lua_State *L)
2676{
2677 Edje_Lua_Edje_Part_Description *obj =
2678 _edje_lua_checkudata(L, 1, &mDescription);
2679 if (!obj->rp->custom) return 0;
2680 lua_createtable(L, 2, 0);
2681 lua_pushnumber(L, TO_DOUBLE(obj->rp->custom->description->rel2.relative_x));
2682 lua_rawseti(L, -2, 1);
2683 lua_pushnumber(L, TO_DOUBLE(obj->rp->custom->description->rel2.relative_y));
2684 lua_rawseti(L, -2, 2);
2685 return 1;
2686}
2687
2688static int
2689_edje_lua_description_get_rel2_to(lua_State *L)
2690{
2691 Edje_Lua_Edje_Part_Description *obj =
2692 _edje_lua_checkudata(L, 1, &mDescription);
2693 if (!obj->rp->custom) return 0;
2694 lua_createtable(L, 2, 0);
2695 lua_pushnumber(L, obj->rp->custom->description->rel2.id_x);
2696 lua_rawseti(L, -2, 1);
2697 lua_pushnumber(L, obj->rp->custom->description->rel2.id_y);
2698 lua_rawseti(L, -2, 2);
2699 return 1;
2700}
2701
2702static int
2703_edje_lua_description_get_rel2_offset(lua_State *L)
2704{
2705 Edje_Lua_Edje_Part_Description *obj =
2706 _edje_lua_checkudata(L, 1, &mDescription);
2707 if (!obj->rp->custom) return 0;
2708 lua_createtable(L, 2, 0);
2709 lua_pushnumber(L, obj->rp->custom->description->rel2.offset_x);
2710 lua_rawseti(L, -2, 1);
2711 lua_pushnumber(L, obj->rp->custom->description->rel2.offset_y);
2712 lua_rawseti(L, -2, 2);
2713 return 1;
2714}
2715
2716static int
2717_edje_lua_description_get_image(lua_State *L)
2718{
2719 Edje_Lua_Edje_Part_Description *obj =
2720 _edje_lua_checkudata(L, 1, &mDescription);
2721 if (!obj->rp->custom) return 0;
2722 if ((obj->rp->part->type != EDJE_PART_TYPE_IMAGE))
2723 return 0;
2724 // TODO
2725 return 0;
2726}
2727
2728static int
2729_edje_lua_description_get_border(lua_State *L)
2730{
2731 Edje_Lua_Edje_Part_Description *obj =
2732 _edje_lua_checkudata(L, 1, &mDescription);
2733 if ((obj->rp->part->type != EDJE_PART_TYPE_IMAGE))
2734 return 0;
2735 if (!obj->rp->custom) return 0;
2736 lua_createtable(L, 4, 0);
2737 lua_pushnumber(L, obj->rp->custom->description->border.l);
2738 lua_rawseti(L, -2, 1);
2739 lua_pushnumber(L, obj->rp->custom->description->border.r);
2740 lua_rawseti(L, -2, 2);
2741 lua_pushnumber(L, obj->rp->custom->description->border.t);
2742 lua_rawseti(L, -2, 3);
2743 lua_pushnumber(L, obj->rp->custom->description->border.b);
2744 lua_rawseti(L, -2, 4);
2745 return 1;
2746}
2747
2748static int
2749_edje_lua_description_get_fill_smooth(lua_State *L)
2750{
2751 Edje_Lua_Edje_Part_Description *obj =
2752 _edje_lua_checkudata(L, 1, &mDescription);
2753 if ((obj->rp->part->type != EDJE_PART_TYPE_IMAGE))
2754 return 0;
2755 if (!obj->rp->custom) return 0;
2756 lua_pushboolean(L, obj->rp->custom->description->fill.smooth);
2757 return 1;
2758}
2759
2760static int
2761_edje_lua_description_get_fill_pos(lua_State *L)
2762{
2763 Edje_Lua_Edje_Part_Description *obj =
2764 _edje_lua_checkudata(L, 1, &mDescription);
2765 if ((obj->rp->part->type != EDJE_PART_TYPE_IMAGE))
2766 return 0;
2767 if (!obj->rp->custom) return 0;
2768 lua_createtable(L, 4, 0);
2769 lua_pushnumber(L, TO_DOUBLE(obj->rp->custom->description->fill.pos_rel_x));
2770 lua_rawseti(L, -2, 1);
2771 lua_pushnumber(L, TO_DOUBLE(obj->rp->custom->description->fill.pos_rel_y));
2772 lua_rawseti(L, -2, 2);
2773 lua_pushnumber(L, obj->rp->custom->description->fill.pos_abs_x);
2774 lua_rawseti(L, -2, 3);
2775 lua_pushnumber(L, obj->rp->custom->description->fill.pos_abs_y);
2776 lua_rawseti(L, -2, 4);
2777 return 1;
2778}
2779
2780static int
2781_edje_lua_description_get_fill_size(lua_State *L)
2782{
2783 Edje_Lua_Edje_Part_Description *obj =
2784 _edje_lua_checkudata(L, 1, &mDescription);
2785 if ((obj->rp->part->type != EDJE_PART_TYPE_IMAGE))
2786 return 0;
2787 if (!obj->rp->custom) return 0;
2788 lua_createtable(L, 4, 0);
2789 lua_pushnumber(L, TO_DOUBLE(obj->rp->custom->description->fill.rel_x));
2790 lua_rawseti(L, -2, 1);
2791 lua_pushnumber(L, TO_DOUBLE(obj->rp->custom->description->fill.rel_y));
2792 lua_rawseti(L, -2, 2);
2793 lua_pushnumber(L, obj->rp->custom->description->fill.abs_x);
2794 lua_rawseti(L, -2, 3);
2795 lua_pushnumber(L, obj->rp->custom->description->fill.abs_y);
2796 lua_rawseti(L, -2, 4);
2797 return 1;
2798}
2799
2800static int
2801_edje_lua_description_get_text(lua_State *L)
2802{
2803 Edje_Lua_Edje_Part_Description *obj =
2804 _edje_lua_checkudata(L, 1, &mDescription);
2805 if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT)
2806 && (obj->rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
2807 return 0;
2808 if (!obj->rp->custom) return 0;
2809 lua_pushstring(L, obj->rp->custom->description->text.text);
2810 return 1;
2811}
2812
2813static int
2814_edje_lua_description_get_text_class(lua_State *L)
2815{
2816 Edje_Lua_Edje_Part_Description *obj =
2817 _edje_lua_checkudata(L, 1, &mDescription);
2818 if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT)
2819 && (obj->rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
2820 return 0;
2821 if (!obj->rp->custom) return 0;
2822 lua_pushstring(L, obj->rp->custom->description->text.text_class);
2823 return 1;
2824}
2825
2826static int
2827_edje_lua_description_get_text_font(lua_State *L)
2828{
2829 Edje_Lua_Edje_Part_Description *obj =
2830 _edje_lua_checkudata(L, 1, &mDescription);
2831 if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT))
2832 return 0;
2833 if (!obj->rp->custom) return 0;
2834 lua_pushstring(L, obj->rp->custom->description->text.text_class);
2835 return 1;
2836}
2837
2838static int
2839_edje_lua_description_get_text_style(lua_State *L)
2840{
2841 Edje_Lua_Edje_Part_Description *obj =
2842 _edje_lua_checkudata(L, 1, &mDescription);
2843 if ((obj->rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
2844 return 0;
2845 if (!obj->rp->custom) return 0;
2846 lua_pushstring(L, obj->rp->custom->description->text.style);
2847 return 1;
2848}
2849
2850static int
2851_edje_lua_description_get_text_size(lua_State *L)
2852{
2853 Edje_Lua_Edje_Part_Description *obj =
2854 _edje_lua_checkudata(L, 1, &mDescription);
2855 if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT))
2856 return 0;
2857 if (!obj->rp->custom) return 0;
2858 lua_pushnumber(L, obj->rp->custom->description->text.size);
2859 return 1;
2860}
2861
2862static int
2863_edje_lua_description_get_text_fit(lua_State *L)
2864{
2865 Edje_Lua_Edje_Part_Description *obj =
2866 _edje_lua_checkudata(L, 1, &mDescription);
2867 if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT))
2868 return 0;
2869 if (!obj->rp->custom) return 0;
2870 lua_createtable(L, 2, 0);
2871 lua_pushboolean(L, obj->rp->custom->description->text.fit_x);
2872 lua_rawseti(L, -2, 1);
2873 lua_pushboolean(L, obj->rp->custom->description->text.fit_y);
2874 lua_rawseti(L, -2, 2);
2875 return 1;
2876}
2877
2878static int
2879_edje_lua_description_get_text_min(lua_State *L)
2880{
2881 Edje_Lua_Edje_Part_Description *obj =
2882 _edje_lua_checkudata(L, 1, &mDescription);
2883 if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT)
2884 && (obj->rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
2885 return 0;
2886 if (!obj->rp->custom) return 0;
2887 lua_createtable(L, 2, 0);
2888 lua_pushnumber(L, obj->rp->custom->description->text.min_x);
2889 lua_rawseti(L, -2, 1);
2890 lua_pushnumber(L, obj->rp->custom->description->text.min_y);
2891 lua_rawseti(L, -2, 2);
2892 return 1;
2893}
2894
2895static int
2896_edje_lua_description_get_text_max(lua_State *L)
2897{
2898 Edje_Lua_Edje_Part_Description *obj =
2899 _edje_lua_checkudata(L, 1, &mDescription);
2900 if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT)
2901 && (obj->rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
2902 return 0;
2903 if (!obj->rp->custom) return 0;
2904 lua_createtable(L, 2, 0);
2905 lua_pushnumber(L, obj->rp->custom->description->text.max_x);
2906 lua_rawseti(L, -2, 1);
2907 lua_pushnumber(L, obj->rp->custom->description->text.max_y);
2908 lua_rawseti(L, -2, 2);
2909 return 1;
2910}
2911
2912static int
2913_edje_lua_description_get_text_align(lua_State *L)
2914{
2915 Edje_Lua_Edje_Part_Description *obj =
2916 _edje_lua_checkudata(L, 1, &mDescription);
2917 if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT))
2918 return 0;
2919 if (!obj->rp->custom) return 0;
2920 lua_createtable(L, 2, 0);
2921 lua_pushnumber(L, TO_DOUBLE(obj->rp->custom->description->text.align.x));
2922 lua_rawseti(L, -2, 1);
2923 lua_pushnumber(L, TO_DOUBLE(obj->rp->custom->description->text.align.y));
2924 lua_rawseti(L, -2, 2);
2925 return 1;
2926}
2927
2928static int
2929_edje_lua_description_get_visible(lua_State *L)
2930{
2931 Edje_Lua_Edje_Part_Description *obj =
2932 _edje_lua_checkudata(L, 1, &mDescription);
2933 if (!obj->rp->custom) return 0;
2934 lua_pushboolean(L, obj->rp->custom->description->visible);
2935 return 1;
2936}
2937
2938const luaL_Reg lDescription_get[] = {
2939 {"alignment", _edje_lua_description_get_alignment},
2940 {"min", _edje_lua_description_get_min},
2941 {"max", _edje_lua_description_get_max},
2942 {"step", _edje_lua_description_get_step},
2943 {"aspect", _edje_lua_description_get_aspect},
2944 {"aspect_pref", _edje_lua_description_get_aspect_pref},
2945 {"color", _edje_lua_description_get_color},
2946 {"color2", _edje_lua_description_get_color2},
2947 {"color3", _edje_lua_description_get_color3},
2948 {"color_class", _edje_lua_description_get_color_class},
2949 {"rel1", _edje_lua_description_get_rel1},
2950 {"rel1_to", _edje_lua_description_get_rel1_to},
2951 {"rel1_offset", _edje_lua_description_get_rel1_offset},
2952 {"rel2", _edje_lua_description_get_rel2},
2953 {"rel2_to", _edje_lua_description_get_rel2_to},
2954 {"rel2_offset", _edje_lua_description_get_rel2_offset},
2955 {"image", _edje_lua_description_get_image},
2956 {"border", _edje_lua_description_get_border},
2957 {"fill_smooth", _edje_lua_description_get_fill_smooth},
2958 {"fill_pos", _edje_lua_description_get_fill_pos},
2959 {"fill_size", _edje_lua_description_get_fill_size},
2960 {"text", _edje_lua_description_get_text},
2961 {"text_class", _edje_lua_description_get_text_class},
2962 {"text_font", _edje_lua_description_get_text_font},
2963 {"text_style", _edje_lua_description_get_text_style},
2964 {"text_size", _edje_lua_description_get_text_size},
2965 {"text_fit", _edje_lua_description_get_text_fit},
2966 {"text_min", _edje_lua_description_get_text_min},
2967 {"text_max", _edje_lua_description_get_text_max},
2968 {"text_align", _edje_lua_description_get_text_align},
2969 {"visible", _edje_lua_description_get_visible},
2970 {NULL, NULL} // sentinel
2971};
2972
2973static int
2974_edje_lua_description_set_alignment(lua_State *L)
2975{
2976 Edje_Lua_Edje_Part_Description *obj =
2977 _edje_lua_checkudata(L, 1, &mDescription);
2978 if (!obj->rp->custom) return 0;
2979 luaL_checktype(L, 2, LUA_TTABLE);
2980 lua_rawgeti(L, 2, 1);
2981 lua_rawgeti(L, 2, 2);
2982 obj->rp->custom->description->align.x = FROM_DOUBLE(luaL_checknumber(L, -2));
2983 obj->rp->custom->description->align.y = FROM_DOUBLE(luaL_checknumber(L, -1));
2984 return 0;
2985}
2986
2987static int
2988_edje_lua_description_set_min(lua_State *L)
2989{
2990 Edje_Lua_Edje_Part_Description *obj =
2991 _edje_lua_checkudata(L, 1, &mDescription);
2992 if (!obj->rp->custom) return 0;
2993 lua_rawgeti(L, 2, 1);
2994 lua_rawgeti(L, 2, 2);
2995 obj->rp->custom->description->min.w = luaL_checkint(L, -2);
2996 obj->rp->custom->description->min.h = luaL_checkint(L, -1);
2997 return 0;
2998}
2999
3000static int
3001_edje_lua_description_set_max(lua_State *L)
3002{
3003 Edje_Lua_Edje_Part_Description *obj =
3004 _edje_lua_checkudata(L, 1, &mDescription);
3005 if (!obj->rp->custom) return 0;
3006 lua_rawgeti(L, 2, 1);
3007 lua_rawgeti(L, 2, 2);
3008 obj->rp->custom->description->max.w = luaL_checkint(L, -2);
3009 obj->rp->custom->description->max.h = luaL_checkint(L, -1);
3010 return 0;
3011}
3012
3013static int
3014_edje_lua_description_set_step(lua_State *L)
3015{
3016 Edje_Lua_Edje_Part_Description *obj =
3017 _edje_lua_checkudata(L, 1, &mDescription);
3018 if (!obj->rp->custom) return 0;
3019 lua_rawgeti(L, 2, 1);
3020 lua_rawgeti(L, 2, 2);
3021 obj->rp->custom->description->step.x = luaL_checkint(L, -2);
3022 obj->rp->custom->description->step.y = luaL_checkint(L, -1);
3023 return 0;
3024}
3025
3026static int
3027_edje_lua_description_set_aspect(lua_State *L)
3028{
3029 Edje_Lua_Edje_Part_Description *obj =
3030 _edje_lua_checkudata(L, 1, &mDescription);
3031 if (!obj->rp->custom) return 0;
3032 lua_rawgeti(L, 2, 1);
3033 lua_rawgeti(L, 2, 2);
3034 obj->rp->custom->description->aspect.min = FROM_DOUBLE(luaL_checknumber(L, -2));
3035 obj->rp->custom->description->aspect.max = FROM_DOUBLE(luaL_checknumber(L, -1));
3036 return 0;
3037
3038}
3039
3040static int
3041_edje_lua_description_set_aspect_pref(lua_State *L)
3042{
3043 Edje_Lua_Edje_Part_Description *obj =
3044 _edje_lua_checkudata(L, 1, &mDescription);
3045 if (!obj->rp->custom) return 0;
3046 obj->rp->custom->description->aspect.prefer = luaL_checknumber(L, 2);
3047 return 0;
3048
3049}
3050
3051static int
3052_edje_lua_description_set_color(lua_State *L)
3053{
3054 Edje_Lua_Edje_Part_Description *obj =
3055 _edje_lua_checkudata(L, 1, &mDescription);
3056 if (!obj->rp->custom) return 0;
3057 luaL_checktype(L, 2, LUA_TTABLE);
3058 lua_rawgeti(L, 2, 1);
3059 lua_rawgeti(L, 2, 2);
3060 lua_rawgeti(L, 2, 3);
3061 lua_rawgeti(L, 2, 4);
3062 obj->rp->custom->description->color.r = luaL_checkint(L, -4);
3063 obj->rp->custom->description->color.g = luaL_checkint(L, -3);
3064 obj->rp->custom->description->color.b = luaL_checkint(L, -2);
3065 obj->rp->custom->description->color.a = luaL_checkint(L, -1);
3066 return 0;
3067}
3068
3069static int
3070_edje_lua_description_set_color2(lua_State *L)
3071{
3072 Edje_Lua_Edje_Part_Description *obj =
3073 _edje_lua_checkudata(L, 1, &mDescription);
3074 if (!obj->rp->custom) return 0;
3075 luaL_checktype(L, 2, LUA_TTABLE);
3076 lua_rawgeti(L, 2, 1);
3077 lua_rawgeti(L, 2, 2);
3078 lua_rawgeti(L, 2, 3);
3079 lua_rawgeti(L, 2, 4);
3080 obj->rp->custom->description->color2.r = luaL_checkint(L, -4);
3081 obj->rp->custom->description->color2.g = luaL_checkint(L, -3);
3082 obj->rp->custom->description->color2.b = luaL_checkint(L, -2);
3083 obj->rp->custom->description->color2.a = luaL_checkint(L, -1);
3084 return 0;
3085}
3086
3087static int
3088_edje_lua_description_set_color3(lua_State *L)
3089{
3090 Edje_Lua_Edje_Part_Description *obj =
3091 _edje_lua_checkudata(L, 1, &mDescription);
3092 if (!obj->rp->custom) return 0;
3093 luaL_checktype(L, 2, LUA_TTABLE);
3094 lua_rawgeti(L, 2, 1);
3095 lua_rawgeti(L, 2, 2);
3096 lua_rawgeti(L, 2, 3);
3097 lua_rawgeti(L, 2, 4);
3098 obj->rp->custom->description->color3.r = luaL_checkint(L, -4);
3099 obj->rp->custom->description->color3.g = luaL_checkint(L, -3);
3100 obj->rp->custom->description->color3.b = luaL_checkint(L, -2);
3101 obj->rp->custom->description->color3.a = luaL_checkint(L, -1);
3102 return 0;
3103}
3104
3105static int
3106_edje_lua_description_set_color_class(lua_State *L)
3107{
3108 Edje_Lua_Edje_Part_Description *obj =
3109 _edje_lua_checkudata(L, 1, &mDescription);
3110 if (!obj->rp->custom) return 0;
3111 obj->rp->custom->description->color_class = (char *)luaL_checkstring(L, 2);
3112 return 0;
3113}
3114
3115static int
3116_edje_lua_description_set_rel1(lua_State *L)
3117{
3118 Edje_Lua_Edje_Part_Description *obj =
3119 _edje_lua_checkudata(L, 1, &mDescription);
3120 if (!obj->rp->custom) return 0;
3121 luaL_checktype(L, 2, LUA_TTABLE);
3122 lua_rawgeti(L, 2, 1);
3123 lua_rawgeti(L, 2, 2);
3124 obj->rp->custom->description->rel1.relative_x = FROM_DOUBLE(luaL_checknumber(L, -2));
3125 obj->rp->custom->description->rel1.relative_y = FROM_DOUBLE(luaL_checknumber(L, -1));
3126 return 0;
3127}
3128
3129static int
3130_edje_lua_description_set_rel1_to(lua_State *L)
3131{
3132 Edje_Lua_Edje_Part_Description *obj =
3133 _edje_lua_checkudata(L, 1, &mDescription);
3134 if (!obj->rp->custom) return 0;
3135 luaL_checktype(L, 2, LUA_TTABLE);
3136 lua_rawgeti(L, 2, 1);
3137 lua_rawgeti(L, 2, 2);
3138 obj->rp->custom->description->rel1.id_x = luaL_checknumber(L, -2);
3139 obj->rp->custom->description->rel1.id_y = luaL_checknumber(L, -1);
3140 if (obj->rp->param1.description->rel1.id_x >= 0)
3141 obj->rp->param1.rel1_to_x = obj->ed->table_parts[obj->rp->param1.description->rel1.id_x % obj->ed->table_parts_size];
3142 if (obj->rp->param1.description->rel1.id_y >= 0)
3143 obj->rp->param1.rel1_to_y = obj->ed->table_parts[obj->rp->param1.description->rel1.id_y % obj->ed->table_parts_size];
3144 return 0;
3145}
3146
3147static int
3148_edje_lua_description_set_rel1_offset(lua_State *L)
3149{
3150 Edje_Lua_Edje_Part_Description *obj =
3151 _edje_lua_checkudata(L, 1, &mDescription);
3152 if (!obj->rp->custom) return 0;
3153 luaL_checktype(L, 2, LUA_TTABLE);
3154 lua_rawgeti(L, 2, 1);
3155 lua_rawgeti(L, 2, 2);
3156 obj->rp->custom->description->rel1.offset_x = luaL_checkint(L, -2);
3157 obj->rp->custom->description->rel1.offset_y = luaL_checkint(L, -1);
3158 return 0;
3159}
3160
3161static int
3162_edje_lua_description_set_rel2(lua_State *L)
3163{
3164 Edje_Lua_Edje_Part_Description *obj =
3165 _edje_lua_checkudata(L, 1, &mDescription);
3166 if (!obj->rp->custom) return 0;
3167 luaL_checktype(L, 2, LUA_TTABLE);
3168 lua_rawgeti(L, 2, 1);
3169 lua_rawgeti(L, 2, 2);
3170 obj->rp->custom->description->rel2.relative_x = FROM_DOUBLE(luaL_checknumber(L, -2));
3171 obj->rp->custom->description->rel2.relative_y = FROM_DOUBLE(luaL_checknumber(L, -1));
3172 return 0;
3173}
3174
3175static int
3176_edje_lua_description_set_rel2_to(lua_State *L)
3177{
3178 Edje_Lua_Edje_Part_Description *obj =
3179 _edje_lua_checkudata(L, 1, &mDescription);
3180 if (!obj->rp->custom) return 0;
3181 luaL_checktype(L, 2, LUA_TTABLE);
3182 lua_rawgeti(L, 2, 1);
3183 lua_rawgeti(L, 2, 2);
3184 obj->rp->custom->description->rel2.id_x = luaL_checknumber(L, -2);
3185 obj->rp->custom->description->rel2.id_y = luaL_checknumber(L, -1);
3186 if (obj->rp->param1.description->rel2.id_x >= 0)
3187 obj->rp->param1.rel2_to_x = obj->ed->table_parts[obj->rp->param1.description->rel2.id_x % obj->ed->table_parts_size];
3188 if (obj->rp->param1.description->rel2.id_y >= 0)
3189 obj->rp->param1.rel2_to_y = obj->ed->table_parts[obj->rp->param1.description->rel2.id_y % obj->ed->table_parts_size];
3190 return 0;
3191}
3192
3193static int
3194_edje_lua_description_set_rel2_offset(lua_State *L)
3195{
3196 Edje_Lua_Edje_Part_Description *obj =
3197 _edje_lua_checkudata(L, 1, &mDescription);
3198 if (!obj->rp->custom) return 0;
3199 luaL_checktype(L, 2, LUA_TTABLE);
3200 lua_rawgeti(L, 2, 1);
3201 lua_rawgeti(L, 2, 2);
3202 obj->rp->custom->description->rel2.offset_x = luaL_checkint(L, -2);
3203 obj->rp->custom->description->rel2.offset_y = luaL_checkint(L, -1);
3204 return 0;
3205}
3206
3207static int
3208_edje_lua_description_set_image(lua_State *L)
3209{
3210 Edje_Lua_Edje_Part_Description *obj =
3211 _edje_lua_checkudata(L, 1, &mDescription);
3212 if (!obj->rp->custom) return 0;
3213 if ((obj->rp->part->type != EDJE_PART_TYPE_IMAGE))
3214 return 0;
3215 obj->rp->custom->description->image.id =
3216 edje_edit_image_id_get(obj->ed->obj, (char *)luaL_checkstring(L, 2));
3217 return 0;
3218}
3219
3220static int
3221_edje_lua_description_set_border(lua_State *L)
3222{
3223 Edje_Lua_Edje_Part_Description *obj =
3224 _edje_lua_checkudata(L, 1, &mDescription);
3225 if ((obj->rp->part->type != EDJE_PART_TYPE_IMAGE))
3226 return 0;
3227 if (!obj->rp->custom) return 0;
3228 luaL_checktype(L, 2, LUA_TTABLE);
3229 lua_rawgeti(L, 2, 1);
3230 lua_rawgeti(L, 2, 2);
3231 lua_rawgeti(L, 2, 3);
3232 lua_rawgeti(L, 2, 4);
3233 obj->rp->custom->description->border.l = luaL_checkint(L, -2);
3234 obj->rp->custom->description->border.r = luaL_checkint(L, -1);
3235 obj->rp->custom->description->border.t = luaL_checkint(L, -2);
3236 obj->rp->custom->description->border.b = luaL_checkint(L, -1);
3237 return 0;
3238}
3239
3240static int
3241_edje_lua_description_set_fill_smooth(lua_State *L)
3242{
3243 Edje_Lua_Edje_Part_Description *obj =
3244 _edje_lua_checkudata(L, 1, &mDescription);
3245 if ((obj->rp->part->type != EDJE_PART_TYPE_IMAGE))
3246 return 0;
3247 if (!obj->rp->custom) return 0;
3248 obj->rp->custom->description->fill.smooth = lua_toboolean(L, 2);
3249 return 0;
3250}
3251
3252static int
3253_edje_lua_description_set_fill_pos(lua_State *L)
3254{
3255 Edje_Lua_Edje_Part_Description *obj =
3256 _edje_lua_checkudata(L, 1, &mDescription);
3257 if ((obj->rp->part->type != EDJE_PART_TYPE_IMAGE))
3258 return 0;
3259 if (!obj->rp->custom) return 0;
3260 luaL_checktype(L, 2, LUA_TTABLE);
3261 lua_rawgeti(L, 2, 1);
3262 lua_rawgeti(L, 2, 2);
3263 lua_rawgeti(L, 2, 3);
3264 lua_rawgeti(L, 2, 4);
3265 obj->rp->custom->description->fill.pos_rel_x = luaL_checkint(L, -2);
3266 obj->rp->custom->description->fill.pos_rel_y = luaL_checkint(L, -1);
3267 obj->rp->custom->description->fill.pos_abs_x = luaL_checkint(L, -2);
3268 obj->rp->custom->description->fill.pos_abs_y = luaL_checkint(L, -1);
3269 return 0;
3270}
3271
3272static int
3273_edje_lua_description_set_fill_size(lua_State *L)
3274{
3275 Edje_Lua_Edje_Part_Description *obj =
3276 _edje_lua_checkudata(L, 1, &mDescription);
3277 if ((obj->rp->part->type != EDJE_PART_TYPE_IMAGE))
3278 return 0;
3279 if (!obj->rp->custom) return 0;
3280 luaL_checktype(L, 2, LUA_TTABLE);
3281 lua_rawgeti(L, 2, 1);
3282 lua_rawgeti(L, 2, 2);
3283 lua_rawgeti(L, 2, 3);
3284 lua_rawgeti(L, 2, 4);
3285 obj->rp->custom->description->fill.rel_x = luaL_checkint(L, -2);
3286 obj->rp->custom->description->fill.rel_y = luaL_checkint(L, -1);
3287 obj->rp->custom->description->fill.abs_x = luaL_checkint(L, -2);
3288 obj->rp->custom->description->fill.abs_y = luaL_checkint(L, -1);
3289 return 0;
3290}
3291
3292static int
3293_edje_lua_description_set_text(lua_State *L)
3294{
3295 Edje_Lua_Edje_Part_Description *obj =
3296 _edje_lua_checkudata(L, 1, &mDescription);
3297 if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT)
3298 && (obj->rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
3299 return 0;
3300 if (!obj->rp->custom) return 0;
3301 obj->rp->custom->description->text.text = (char *)luaL_checkstring(L, 2);
3302 return 0;
3303}
3304
3305static int
3306_edje_lua_description_set_text_class(lua_State *L)
3307{
3308 Edje_Lua_Edje_Part_Description *obj =
3309 _edje_lua_checkudata(L, 1, &mDescription);
3310 if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT)
3311 && (obj->rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
3312 return 0;
3313 if (!obj->rp->custom) return 0;
3314 obj->rp->custom->description->text.text_class =
3315 (char *)luaL_checkstring(L, 2);
3316 return 0;
3317}
3318
3319static int
3320_edje_lua_description_set_text_font(lua_State *L)
3321{
3322 Edje_Lua_Edje_Part_Description *obj =
3323 _edje_lua_checkudata(L, 1, &mDescription);
3324 if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT))
3325 return 0;
3326 if (!obj->rp->custom) return 0;
3327 obj->rp->custom->description->text.font = (char *)luaL_checkstring(L, 2);
3328 return 0;
3329}
3330
3331static int
3332_edje_lua_description_set_text_style(lua_State *L)
3333{
3334 Edje_Lua_Edje_Part_Description *obj =
3335 _edje_lua_checkudata(L, 1, &mDescription);
3336 if ((obj->rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
3337 return 0;
3338 if (!obj->rp->custom) return 0;
3339 obj->rp->custom->description->text.style = (char *)luaL_checkstring(L, 2);
3340 return 0;
3341}
3342
3343static int
3344_edje_lua_description_set_text_size(lua_State *L)
3345{
3346 Edje_Lua_Edje_Part_Description *obj =
3347 _edje_lua_checkudata(L, 1, &mDescription);
3348 if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT))
3349 return 0;
3350 if (!obj->rp->custom) return 0;
3351 obj->rp->custom->description->text.size = luaL_checkint(L, 2);
3352 return 0;
3353}
3354
3355static int
3356_edje_lua_description_set_text_fit(lua_State *L)
3357{
3358 Edje_Lua_Edje_Part_Description *obj =
3359 _edje_lua_checkudata(L, 1, &mDescription);
3360 if (!obj->rp->custom) return 0;
3361 luaL_checktype(L, 2, LUA_TTABLE);
3362 lua_rawgeti(L, 2, 1);
3363 lua_rawgeti(L, 2, 2);
3364 obj->rp->custom->description->text.fit_x = lua_toboolean(L, -2);
3365 obj->rp->custom->description->text.fit_y = lua_toboolean(L, -1);
3366 return 0;
3367}
3368
3369static int
3370_edje_lua_description_set_text_min(lua_State *L)
3371{
3372 Edje_Lua_Edje_Part_Description *obj =
3373 _edje_lua_checkudata(L, 1, &mDescription);
3374 if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT)
3375 && (obj->rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
3376 return 0;
3377 if (!obj->rp->custom) return 0;
3378 luaL_checktype(L, 2, LUA_TTABLE);
3379 lua_rawgeti(L, 2, 1);
3380 lua_rawgeti(L, 2, 2);
3381 obj->rp->custom->description->text.min_x = luaL_checkint(L, -2);
3382 obj->rp->custom->description->text.min_y = luaL_checkint(L, -1);
3383 return 0;
3384}
3385
3386static int
3387_edje_lua_description_set_text_max(lua_State *L)
3388{
3389 Edje_Lua_Edje_Part_Description *obj =
3390 _edje_lua_checkudata(L, 1, &mDescription);
3391 if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT)
3392 && (obj->rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
3393 return 0;
3394 if (!obj->rp->custom) return 0;
3395 luaL_checktype(L, 2, LUA_TTABLE);
3396 lua_rawgeti(L, 2, 1);
3397 lua_rawgeti(L, 2, 2);
3398 obj->rp->custom->description->text.max_x = luaL_checkint(L, -2);
3399 obj->rp->custom->description->text.max_y = luaL_checkint(L, -1);
3400 return 0;
3401}
3402
3403static int
3404_edje_lua_description_set_text_align(lua_State *L)
3405{
3406 Edje_Lua_Edje_Part_Description *obj =
3407 _edje_lua_checkudata(L, 1, &mDescription);
3408 if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT))
3409 return 0;
3410 if (!obj->rp->custom) return 0;
3411 luaL_checktype(L, 2, LUA_TTABLE);
3412 lua_rawgeti(L, 2, 1);
3413 lua_rawgeti(L, 2, 2);
3414 obj->rp->custom->description->text.align.x = FROM_DOUBLE(luaL_checknumber(L, -2));
3415 obj->rp->custom->description->text.align.y = FROM_DOUBLE(luaL_checknumber(L, -1));
3416 return 0;
3417}
3418
3419static int
3420_edje_lua_description_set_visible(lua_State *L)
3421{
3422 Edje_Lua_Edje_Part_Description *obj =
3423 _edje_lua_checkudata(L, 1, &mDescription);
3424 if (!obj->rp->custom) return 0;
3425 obj->rp->custom->description->visible = lua_toboolean(L, 2);
3426 return 0;
3427}
3428
3429const luaL_Reg lDescription_set[] = {
3430 {"alignment", _edje_lua_description_set_alignment},
3431 {"min", _edje_lua_description_set_min},
3432 {"max", _edje_lua_description_set_max},
3433 {"step", _edje_lua_description_set_step},
3434 {"aspect", _edje_lua_description_set_aspect},
3435 {"aspect_pref", _edje_lua_description_set_aspect_pref},
3436 {"color", _edje_lua_description_set_color},
3437 {"color2", _edje_lua_description_set_color2},
3438 {"color3", _edje_lua_description_set_color3},
3439 {"color_class", _edje_lua_description_set_color_class},
3440 {"rel1", _edje_lua_description_set_rel1},
3441 {"rel1_to", _edje_lua_description_set_rel1_to},
3442 {"rel1_offset", _edje_lua_description_set_rel1_offset},
3443 {"rel2", _edje_lua_description_set_rel2},
3444 {"rel2_to", _edje_lua_description_set_rel2_to},
3445 {"rel2_offset", _edje_lua_description_set_rel2_offset},
3446 {"image", _edje_lua_description_set_image},
3447 {"border", _edje_lua_description_set_border},
3448 {"fill_smooth", _edje_lua_description_set_fill_smooth},
3449 {"fill_pos", _edje_lua_description_set_fill_pos},
3450 {"fill_size", _edje_lua_description_set_fill_size},
3451 {"text", _edje_lua_description_set_text},
3452 {"text_class", _edje_lua_description_set_text_class},
3453 {"text_font", _edje_lua_description_set_text_font},
3454 {"text_style", _edje_lua_description_set_text_style},
3455 {"text_size", _edje_lua_description_set_text_size},
3456 {"text_fit", _edje_lua_description_set_text_fit},
3457 {"text_min", _edje_lua_description_set_text_min},
3458 {"text_max", _edje_lua_description_set_text_max},
3459 {"text_align", _edje_lua_description_set_text_align},
3460 {"visible", _edje_lua_description_set_visible},
3461 {NULL, NULL} // sentinel
3462};
3463
3464const luaL_Reg lPart_get[];
3465
3466const luaL_Reg lPart_set[];
3467
3468const luaL_Reg lPart_fn[];
3469
3470const Edje_Lua_Reg mPart = {
3471 lNil,
3472 lPart_get,
3473 lPart_set,
3474 lPart_fn
3475};
3476
3477static void
3478_edje_lua_edje_part_del_cb(void *data, __UNUSED__ Evas * e, Evas_Object * obj,
3479 __UNUSED__ void *event_info)
3480{
3481 //printf("_edje_lua_object_delete_cb\n");
3482 lua_State *L = data;
3483 _edje_lua_get_reg(L, obj);
3484 Edje_Lua_Edje_Part_Object *udata = _edje_lua_checkudata(L, -1, &mPart);
3485 lua_pop(L, 1);
3486 _edje_lua_free_reg(L, udata); // created in _edje_lua_group_mt_index
3487 _edje_lua_free_reg(L, obj); // created in _edje_lua_group_mt_index
3488}
3489
3490const Edje_Lua_Reg *cPart[] = {
3491 &mClass,
3492 &mObject,
3493 &mPart,
3494 NULL // sentinel
3495};
3496
3497static int
3498_edje_lua_part_get_swallow(lua_State *L)
3499{
3500 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3501 Evas_Object *swa = edje_object_part_swallow_get(obj->ed->obj, obj->key);
3502 _edje_lua_get_reg(L, swa);
3503 // TODO create object if it does not already exist?
3504 return 1;
3505}
3506
3507static int
3508_edje_lua_part_get_type(lua_State *L)
3509{
3510 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3511 lua_pushnumber(L, edje_edit_part_type_get(obj->ed->obj, obj->key));
3512 return 1;
3513}
3514
3515static int
3516_edje_lua_part_get_effect(lua_State *L)
3517{
3518 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3519 lua_pushnumber(L, edje_edit_part_effect_get(obj->ed->obj, obj->key));
3520 return 1;
3521}
3522
3523static int
3524_edje_lua_part_get_mouse_events(lua_State *L)
3525{
3526 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3527 lua_pushboolean(L, edje_edit_part_mouse_events_get(obj->ed->obj, obj->key));
3528 return 1;
3529}
3530
3531static int
3532_edje_lua_part_get_repeat_events(lua_State *L)
3533{
3534 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3535 lua_pushboolean(L, edje_edit_part_repeat_events_get(obj->ed->obj, obj->key));
3536 return 1;
3537}
3538
3539static int
3540_edje_lua_part_get_states_list(lua_State *L)
3541{
3542 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3543 Eina_List *slist = edje_edit_part_states_list_get(obj->ed->obj, obj->key);
3544 Eina_List *ilist;
3545 lua_newtable(L);
3546 int i = 1;
3547 for (ilist = slist; ilist; ilist = eina_list_next(ilist))
3548 {
3549 lua_pushstring(L, eina_list_data_get(ilist));
3550 lua_rawseti(L, -2, i++);
3551 }
3552 edje_edit_string_list_free(slist);
3553 return 1;
3554};
3555
3556static int
3557_edje_lua_part_get_state(lua_State *L)
3558{
3559 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3560 const char *state;
3561 double val;
3562 state = edje_object_part_state_get(obj->ed->obj, obj->key, &val);
3563 lua_createtable(L, 2, 0);
3564 lua_pushstring(L, state);
3565 lua_rawseti(L, -2, 1);
3566 lua_pushnumber(L, val);
3567 lua_rawseti(L, -2, 2);
3568 return 1;
3569};
3570
3571static int
3572_edje_lua_part_get_text(lua_State *L)
3573{
3574 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3575 lua_pushstring(L, edje_object_part_text_get(obj->ed->obj, obj->key));
3576 return 1;
3577};
3578
3579static int
3580_edje_lua_part_get_text_selection(lua_State *L)
3581{
3582 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3583 lua_pushstring(L,
3584 edje_object_part_text_selection_get(obj->ed->obj, obj->key));
3585 return 1;
3586};
3587
3588static int
3589_edje_lua_part_get_drag_dir(lua_State *L)
3590{
3591 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3592 lua_pushnumber(L, edje_object_part_drag_dir_get(obj->ed->obj, obj->key));
3593 return 1;
3594}
3595
3596static int
3597_edje_lua_part_get_drag_value(lua_State *L)
3598{
3599 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3600 double dx, dy;
3601 edje_object_part_drag_value_get(obj->ed->obj, obj->key, &dx, &dy);
3602 lua_createtable(L, 2, 0);
3603 lua_pushnumber(L, dx);
3604 lua_rawseti(L, -2, 1);
3605 lua_pushnumber(L, dy);
3606 lua_rawseti(L, -2, 2);
3607 return 1;
3608}
3609
3610static int
3611_edje_lua_part_get_drag_size(lua_State *L)
3612{
3613 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3614 double dx, dy;
3615 edje_object_part_drag_size_get(obj->ed->obj, obj->key, &dx, &dy);
3616 lua_createtable(L, 2, 0);
3617 lua_pushnumber(L, dx);
3618 lua_rawseti(L, -2, 1);
3619 lua_pushnumber(L, dy);
3620 lua_rawseti(L, -2, 2);
3621 return 1;
3622}
3623
3624static int
3625_edje_lua_part_get_drag_step(lua_State *L)
3626{
3627 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3628 double dx, dy;
3629 edje_object_part_drag_step_get(obj->ed->obj, obj->key, &dx, &dy);
3630 lua_createtable(L, 2, 0);
3631 lua_pushnumber(L, dx);
3632 lua_rawseti(L, -2, 1);
3633 lua_pushnumber(L, dy);
3634 lua_rawseti(L, -2, 2);
3635 return 1;
3636}
3637
3638static int
3639_edje_lua_part_get_drag_page(lua_State *L)
3640{
3641 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3642 double dx, dy;
3643 edje_object_part_drag_page_get(obj->ed->obj, obj->key, &dx, &dy);
3644 lua_createtable(L, 2, 0);
3645 lua_pushnumber(L, dx);
3646 lua_rawseti(L, -2, 1);
3647 lua_pushnumber(L, dy);
3648 lua_rawseti(L, -2, 2);
3649 return 1;
3650}
3651
3652static int
3653_edje_lua_part_get_text_cursor_geometry(lua_State *L)
3654{
3655 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3656 Evas_Coord x, y, w, h;
3657 edje_object_part_text_cursor_geometry_get(obj->ed->obj, obj->key,
3658 &x, &y, &w, &h);
3659 lua_createtable(L, 4, 0);
3660 lua_pushnumber(L, x);
3661 lua_rawseti(L, -2, 1);
3662 lua_pushnumber(L, y);
3663 lua_rawseti(L, -2, 2);
3664 lua_pushnumber(L, w);
3665 lua_rawseti(L, -2, 3);
3666 lua_pushnumber(L, h);
3667 lua_rawseti(L, -2, 4);
3668 return 1;
3669}
3670
3671static int
3672_edje_lua_part_get_geometry(lua_State *L)
3673{
3674 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3675 Evas_Coord x, y, w, h;
3676 edje_object_part_geometry_get(obj->ed->obj, obj->key, &x, &y, &w, &h);
3677 lua_createtable(L, 4, 0);
3678 lua_pushnumber(L, x);
3679 lua_rawseti(L, -2, 1);
3680 lua_pushnumber(L, y);
3681 lua_rawseti(L, -2, 2);
3682 lua_pushnumber(L, w);
3683 lua_rawseti(L, -2, 3);
3684 lua_pushnumber(L, h);
3685 lua_rawseti(L, -2, 4);
3686 return 1;
3687}
3688
3689static int
3690_edje_lua_part_get_table_col_row_size(lua_State *L)
3691{
3692 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3693 int cols, rows;
3694 edje_object_part_table_col_row_size_get(obj->ed->obj, obj->key, &cols, &rows);
3695 lua_createtable(L, 2, 0);
3696 lua_pushnumber(L, cols); lua_rawseti(L, -2, 1);
3697 lua_pushnumber(L, rows); lua_rawseti(L, -2, 2);
3698 return 1;
3699}
3700
3701static int _edje_lua_part_fn_custom_state(lua_State *L);
3702
3703const luaL_Reg lPart_get[] = {
3704 {"custom_state", _edje_lua_part_fn_custom_state},
3705 {"Swallow", _edje_lua_part_get_swallow}, //TODO it the capital S correct?
3706
3707 {"drag_dir", _edje_lua_part_get_drag_dir},
3708 {"drag_value", _edje_lua_part_get_drag_value},
3709 {"drag_size", _edje_lua_part_get_drag_size},
3710 {"drag_step", _edje_lua_part_get_drag_step},
3711 {"drag_page", _edje_lua_part_get_drag_page},
3712
3713 {"type", _edje_lua_part_get_type},
3714 {"effect", _edje_lua_part_get_effect},
3715 {"mouse_events", _edje_lua_part_get_mouse_events},
3716 {"repeat_events", _edje_lua_part_get_repeat_events},
3717 {"states_list", _edje_lua_part_get_states_list},
3718 {"state", _edje_lua_part_get_state},
3719
3720 {"text", _edje_lua_part_get_text},
3721 {"text_selection", _edje_lua_part_get_text_selection},
3722 {"text_cursor_geometry", _edje_lua_part_get_text_cursor_geometry},
3723
3724 {"geometry", _edje_lua_part_get_geometry},
3725 {"part_col_row_size", _edje_lua_part_get_table_col_row_size},
3726 {NULL, NULL} // sentinel
3727};
3728
3729static int
3730_edje_lua_part_set_effect(lua_State *L)
3731{
3732 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3733 edje_edit_part_effect_set(obj->ed->obj, obj->key, luaL_checkint(L, 2));
3734 return 0;
3735}
3736
3737static int
3738_edje_lua_part_set_mouse_events(lua_State *L)
3739{
3740 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3741 edje_edit_part_mouse_events_set(obj->ed->obj, obj->key, lua_toboolean(L, 2));
3742 return 0;
3743}
3744
3745static int
3746_edje_lua_part_set_repeat_events(lua_State *L)
3747{
3748 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3749 edje_edit_part_repeat_events_set(obj->ed->obj, obj->key,
3750 lua_toboolean(L, 2));
3751 return 0;
3752}
3753
3754static int
3755_edje_lua_part_set_state(lua_State *L)
3756{
3757 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3758 luaL_checktype(L, 2, LUA_TTABLE);
3759 lua_rawgeti(L, 2, 1);
3760 lua_rawgeti(L, 2, 2);
3761 _edje_part_description_apply(obj->ed, obj->rp,
3762 luaL_checkstring(L, -2), luaL_checknumber(L, -1),
3763 NULL, 0.0);
3764 _edje_part_pos_set(obj->ed, obj->rp, EDJE_TWEEN_MODE_LINEAR, ZERO, ZERO, ZERO);
3765 _edje_recalc(obj->ed);
3766 return 0;
3767}
3768
3769static int
3770_edje_lua_part_set_tween_state(lua_State *L)
3771{
3772 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3773 luaL_checktype(L, 2, LUA_TTABLE);
3774 lua_rawgeti(L, 2, 1);
3775 lua_rawgeti(L, 2, 2);
3776 lua_rawgeti(L, 2, 3);
3777 lua_rawgeti(L, 2, 4);
3778 lua_rawgeti(L, 2, 5);
3779 _edje_part_description_apply(obj->ed, obj->rp,
3780 luaL_checkstring(L, -4), luaL_checknumber(L, -3),
3781 luaL_checkstring(L, -2), luaL_checknumber(L, -1));
3782 _edje_part_pos_set(obj->ed, obj->rp, EDJE_TWEEN_MODE_LINEAR,
3783 FROM_DOUBLE(luaL_checknumber(L, -5)), ZERO, ZERO);
3784 _edje_recalc(obj->ed);
3785 return 0;
3786}
3787
3788static int
3789_edje_lua_part_set_text(lua_State *L)
3790{
3791 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3792 edje_object_part_text_set(obj->ed->obj, obj->key, luaL_checkstring(L, 2));
3793 return 0;
3794}
3795
3796static int
3797_edje_lua_part_set_drag_value(lua_State *L)
3798{
3799 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3800 lua_rawgeti(L, 2, 1);
3801 lua_rawgeti(L, 2, 2);
3802 edje_object_part_drag_value_set(obj->ed->obj, obj->key,
3803 luaL_checknumber(L, -2),
3804 luaL_checknumber(L, -1));
3805 return 0;
3806}
3807
3808static int
3809_edje_lua_part_set_drag_size(lua_State *L)
3810{
3811 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3812 lua_rawgeti(L, 2, 1);
3813 lua_rawgeti(L, 2, 2);
3814 edje_object_part_drag_size_set(obj->ed->obj, obj->key,
3815 luaL_checknumber(L, -2),
3816 luaL_checknumber(L, -1));
3817 return 0;
3818}
3819
3820static int
3821_edje_lua_part_set_drag_step(lua_State *L)
3822{
3823 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3824 lua_rawgeti(L, 2, 1);
3825 lua_rawgeti(L, 2, 2);
3826 edje_object_part_drag_step_set(obj->ed->obj, obj->key,
3827 luaL_checknumber(L, -2),
3828 luaL_checknumber(L, -1));
3829 return 0;
3830}
3831
3832static int
3833_edje_lua_part_set_drag_page(lua_State *L)
3834{
3835 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3836 lua_rawgeti(L, 2, 1);
3837 lua_rawgeti(L, 2, 2);
3838 edje_object_part_drag_page_set(obj->ed->obj, obj->key,
3839 luaL_checknumber(L, -2),
3840 luaL_checknumber(L, -1));
3841 return 0;
3842}
3843
3844const luaL_Reg lPart_set[] = {
3845 {"drag_value", _edje_lua_part_set_drag_value},
3846 {"drag_size", _edje_lua_part_set_drag_size},
3847 {"drag_step", _edje_lua_part_set_drag_step},
3848 {"drag_page", _edje_lua_part_set_drag_page},
3849
3850 {"effect", _edje_lua_part_set_effect},
3851 {"mouse_events", _edje_lua_part_set_mouse_events},
3852 {"repeat_events", _edje_lua_part_set_repeat_events},
3853 {"state", _edje_lua_part_set_state},
3854 {"tween_state", _edje_lua_part_set_tween_state},
3855 {"text", _edje_lua_part_set_text},
3856 {NULL, NULL} // sentinel
3857};
3858
3859static int
3860_edje_lua_part_fn_swallow(lua_State *L)
3861{
3862 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3863 Edje_Lua_Evas_Object *swa = _edje_lua_checkudata(L, 2, &mObject);
3864 edje_object_part_swallow(obj->ed->obj, obj->key, swa->eo);
3865 return 0;
3866}
3867
3868static int
3869_edje_lua_part_fn_unswallow(lua_State *L)
3870{
3871 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3872 edje_object_part_unswallow(obj->ed->obj, obj->eo);
3873 return 0;
3874}
3875
3876static int
3877_edje_lua_part_fn_text_select_none(lua_State *L)
3878{
3879 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3880 edje_object_part_text_select_none(obj->ed->obj, obj->key);
3881 return 0;
3882}
3883
3884static int
3885_edje_lua_part_fn_text_select_all(lua_State *L)
3886{
3887 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3888 edje_object_part_text_select_all(obj->ed->obj, obj->key);
3889 return 0;
3890}
3891
3892static int
3893_edje_lua_part_fn_text_insert(lua_State *L)
3894{
3895 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3896 edje_object_part_text_insert(obj->ed->obj, obj->key, luaL_checkstring(L, 2));
3897 return 0;
3898}
3899
3900static int
3901_edje_lua_part_fn_custom_state(lua_State *L)
3902{
3903 char *name;
3904 float val;
3905 Edje_Part_Description *parent;
3906 Edje_Part_Image_Id *iid;
3907 Eina_List *l;
3908 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3909 /* check whether this part already has a "custom" state */
3910 if (obj->rp->custom)
3911 {
3912 _edje_lua_get_reg(L, obj->rp->custom->description);
3913 return 1;
3914 }
3915
3916 name = (char *)luaL_checkstring(L, 2); // state name
3917 val = luaL_checknumber(L, 3); // state val
3918 if (!(parent = _edje_part_description_find(obj->ed, obj->rp, name, val)))
3919 {
3920 lua_pushnil(L);
3921 return 1;
3922 }
3923 /* now create the custom state */
3924 Edje_Lua_Edje_Part_Description *tar =
3925 lua_newuserdata(L, sizeof(Edje_Lua_Edje_Part_Description));
3926 tar->rp = obj->rp;
3927 _edje_lua_set_class(L, -1, cDescription);
3928 _edje_lua_new_reg(L, -1, tar); // freed in edje_load.c::_edje_file_del
3929 if (!(tar->pd = calloc(1, sizeof(Edje_Part_Description))))
3930 {
3931 lua_pushnil(L);
3932 return 1;
3933 }
3934
3935 obj->rp->custom = eina_mempool_malloc(_edje_real_part_state_mp, sizeof (Edje_Real_Part_State));
3936 if (!obj->rp->custom)
3937 {
3938 free(tar->pd);
3939 tar->pd = NULL;
3940 lua_pushnil(L);
3941 return 1;
3942 }
3943
3944 *(tar->pd) = *parent;
3945 tar->pd->state.name = (char *)eina_stringshare_add("custom");
3946 tar->pd->state.value = 0.0;
3947 /*
3948 * make sure all the allocated memory is getting copied,
3949 * not just referenced
3950 */
3951 tar->pd->image.tween_list = NULL;
3952 EINA_LIST_FOREACH(parent->image.tween_list, l, iid)
3953 {
3954 Edje_Part_Image_Id *iid_new;
3955 iid_new = calloc(1, sizeof(Edje_Part_Image_Id));
3956 iid_new->id = iid->id;
3957
3958 tar->pd->image.tween_list =
3959 eina_list_append(tar->pd->image.tween_list, iid_new);
3960 }
3961#define DUP(x) x ? (char *)eina_stringshare_add(x) : NULL
3962 tar->pd->color_class = DUP(tar->pd->color_class);
3963 tar->pd->text.text = DUP(tar->pd->text.text);
3964 tar->pd->text.text_class = DUP(tar->pd->text.text_class);
3965 tar->pd->text.font = DUP(tar->pd->text.font);
3966 tar->pd->text.style = DUP(tar->pd->text.style);
3967#undef DUP
3968 obj->rp->custom->description = tar->pd;
3969 _edje_lua_new_reg(L, -1, obj->rp->custom->description); // freed in edje_load.c::_edje_file_del
3970 return 1;
3971}
3972
3973static int
3974_edje_lua_part_fn_table_pack(lua_State *L)
3975{
3976 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3977 Edje_Lua_Evas_Object *tar = _edje_lua_checkudata(L, 2, &mObject);
3978 lua_pushboolean(L,
3979 edje_object_part_table_pack(obj->ed->obj, obj->key, tar->eo,
3980 luaL_checkint(L, 3),
3981 luaL_checkint(L, 4),
3982 luaL_checkint(L, 5),
3983 luaL_checkint(L, 6)));
3984 return 1;
3985}
3986
3987static int
3988_edje_lua_part_fn_table_unpack(lua_State *L)
3989{
3990 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
3991 Edje_Lua_Evas_Object *tar = _edje_lua_checkudata(L, 2, &mObject);
3992 lua_pushboolean(L,
3993 edje_object_part_table_unpack(obj->ed->obj, obj->key, tar->eo));
3994 return 1;
3995}
3996
3997static int
3998_edje_lua_part_fn_table_clear(lua_State *L)
3999{
4000 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
4001 lua_pushboolean(L,
4002 edje_object_part_table_clear(obj->ed->obj, obj->key, lua_toboolean(L, 2)));
4003 return 1;
4004}
4005
4006static int
4007_edje_lua_part_fn_box_append(lua_State *L)
4008{
4009 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
4010 Edje_Lua_Evas_Object *tar = _edje_lua_checkudata(L, 2, &mObject);
4011 lua_pushboolean(L,
4012 edje_object_part_box_append(obj->ed->obj, obj->key, tar->eo));
4013 return 1;
4014}
4015
4016static int
4017_edje_lua_part_fn_box_prepend(lua_State *L)
4018{
4019 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
4020 Edje_Lua_Evas_Object *tar = _edje_lua_checkudata(L, 2, &mObject);
4021 lua_pushboolean(L,
4022 edje_object_part_box_prepend(obj->ed->obj, obj->key, tar->eo));
4023 return 1;
4024}
4025
4026static int
4027_edje_lua_part_fn_box_insert_before(lua_State *L)
4028{
4029 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
4030 Edje_Lua_Evas_Object *tar = _edje_lua_checkudata(L, 2, &mObject);
4031 Edje_Lua_Evas_Object *ref = _edje_lua_checkudata(L, 3, &mObject);
4032 lua_pushboolean(L,
4033 edje_object_part_box_insert_before(obj->ed->obj, obj->key, tar->eo, ref->eo));
4034 return 1;
4035}
4036
4037static int
4038_edje_lua_part_fn_box_insert_at(lua_State *L)
4039{
4040 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
4041 Edje_Lua_Evas_Object *tar = _edje_lua_checkudata(L, 2, &mObject);
4042 lua_pushboolean(L,
4043 edje_object_part_box_insert_at(obj->ed->obj, obj->key, tar->eo, luaL_checkint(L, 3)));
4044 return 1;
4045}
4046
4047static int
4048_edje_lua_part_fn_box_remove(lua_State *L)
4049{
4050 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
4051 Edje_Lua_Evas_Object *tar = _edje_lua_checkudata(L, 2, &mObject);
4052 edje_object_part_box_remove(obj->ed->obj, obj->key, tar->eo);
4053 lua_pushvalue(L, 2);
4054 return 1;
4055}
4056
4057static int
4058_edje_lua_part_fn_box_remove_at(lua_State *L)
4059{
4060 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
4061 _edje_lua_get_reg(L, edje_object_part_box_remove_at(obj->ed->obj, obj->key, luaL_checkint(L, 2)));
4062 return 1;
4063}
4064
4065static int
4066_edje_lua_part_fn_box_remove_all(lua_State *L)
4067{
4068 Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart);
4069 lua_pushboolean(L,
4070 edje_object_part_box_remove_all(obj->ed->obj, obj->key, lua_toboolean(L, 2)));
4071 return 1;
4072}
4073
4074const luaL_Reg lPart_fn[] = {
4075 {"swallow", _edje_lua_part_fn_swallow},
4076 {"unswallow", _edje_lua_part_fn_unswallow},
4077
4078 {"custom_state", _edje_lua_part_fn_custom_state},
4079
4080 {"text_select_none", _edje_lua_part_fn_text_select_none},
4081 {"text_select_all", _edje_lua_part_fn_text_select_all},
4082 {"text_insert", _edje_lua_part_fn_text_insert},
4083
4084 {"table_pack", _edje_lua_part_fn_table_pack},
4085 {"table_unpack", _edje_lua_part_fn_table_unpack},
4086 {"table_clear", _edje_lua_part_fn_table_clear},
4087
4088 {"box_append", _edje_lua_part_fn_box_append},
4089 {"box_prepend", _edje_lua_part_fn_box_prepend},
4090 {"box_insert_before", _edje_lua_part_fn_box_insert_before},
4091 {"box_insert_at", _edje_lua_part_fn_box_insert_at},
4092 {"box_remove", _edje_lua_part_fn_box_remove},
4093 {"box_remove_at", _edje_lua_part_fn_box_remove_at},
4094 {"box_remove_all", _edje_lua_part_fn_box_remove_all},
4095 {NULL, NULL} // sentinel
4096};
4097
4098const luaL_Reg lGroup_mt[];
4099
4100const luaL_Reg lGroup_get[];
4101
4102const luaL_Reg lGroup_set[];
4103
4104const luaL_Reg lGroup_fn[];
4105
4106const Edje_Lua_Reg mGroup = {
4107 lGroup_mt,
4108 lGroup_get,
4109 lGroup_set,
4110 lGroup_fn
4111};
4112
4113const Edje_Lua_Reg *cGroup[] = {
4114 &mClass,
4115 &mObject,
4116 &mGroup,
4117 NULL // sentinel
4118};
4119
4120static int
4121_edje_lua_group_mt_index(lua_State *L)
4122{
4123 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4124 lua_getmetatable(L, 1);
4125 if (!_edje_lua_look_fn(L))
4126 {
4127 // look in lGroup_fn
4128 if (!_edje_lua_look_get(L))
4129 {
4130 // look in lGroup_get
4131 const char *key = luaL_checkstring(L, 2);
4132 Edje *ed = _edje_fetch(obj->eo);
4133 Edje_Real_Part *rp = _edje_real_part_recursive_get(ed, key);
4134 if (rp)
4135 {
4136 // check if lua userdata exists
4137 Evas_Object *part = (Evas_Object *) edje_object_part_object_get(obj->eo, key);
4138 _edje_lua_get_reg(L, part);
4139 if (lua_isnil(L, -1))
4140 {
4141 // create it
4142 lua_pop(L, 1);
4143 Edje_Lua_Edje_Part_Object *tar =
4144 lua_newuserdata(L, sizeof(Edje_Lua_Edje_Part_Object));
4145 tar->eo = part;
4146 tar->ed = ed;
4147 tar->key = key;
4148 tar->L = L;
4149 tar->rp = rp;
4150 _edje_lua_set_class(L, -1, cPart);
4151 _edje_lua_new_reg(L, -1, tar); // freed in _edje_lua_edje_part_del_cb
4152 _edje_lua_new_reg(L, -1, part); // freed in _edje_lua_edje_part_del_cb
4153 evas_object_event_callback_add(tar->eo,
4154 EVAS_CALLBACK_DEL,
4155 _edje_lua_edje_part_del_cb,
4156 L);
4157 }
4158 }
4159 else
4160 {
4161 // look in obj environment table
4162 lua_getfenv(L, 1);
4163 lua_pushvalue(L, 2); // key
4164 lua_rawget(L, -2);
4165 }
4166 }
4167 }
4168 return 1;
4169}
4170
4171const luaL_Reg lGroup_mt[] = {
4172 {"__index", _edje_lua_group_mt_index},
4173 {NULL, NULL} // sentinel
4174};
4175
4176static int
4177_edje_lua_group_get_group(lua_State *L)
4178{
4179 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4180 const char *file, *group;
4181 edje_object_file_get(obj->eo, &file, &group);
4182 lua_pushstring(L, group);
4183 return 1;
4184}
4185
4186static int
4187_edje_lua_group_get_mouse(lua_State *L)
4188{
4189 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4190 int x, y;
4191 evas_pointer_canvas_xy_get(evas_object_evas_get(obj->eo), &x, &y);
4192 x -= obj->ed->x;
4193 y -= obj->ed->y;
4194 lua_createtable(L, 2, 0);
4195 lua_pushnumber(L, x);
4196 lua_rawseti(L, -2, 1);
4197 lua_pushnumber(L, y);
4198 lua_rawseti(L, -2, 2);
4199 return 1;
4200}
4201
4202static int
4203_edje_lua_group_get_mouse_buttons(lua_State *L)
4204{
4205 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4206 lua_pushnumber(L, evas_pointer_button_down_mask_get(obj->ed->evas));
4207 return 1;
4208}
4209
4210static int
4211_edje_lua_group_get_size_min(lua_State *L)
4212{
4213 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4214 int w, h;
4215 edje_object_size_min_get(obj->eo, &w, &h);
4216 lua_createtable(L, 2, 0);
4217 lua_pushnumber(L, w);
4218 lua_rawseti(L, -2, 1);
4219 lua_pushnumber(L, h);
4220 lua_rawseti(L, -2, 2);
4221 return 1;
4222}
4223
4224static int
4225_edje_lua_group_get_size_max(lua_State *L)
4226{
4227 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4228 int w, h;
4229 edje_object_size_max_get(obj->eo, &w, &h);
4230 lua_createtable(L, 2, 0);
4231 lua_pushnumber(L, w);
4232 lua_rawseti(L, -2, 1);
4233 lua_pushnumber(L, h);
4234 lua_rawseti(L, -2, 2);
4235 return 1;
4236}
4237
4238static int
4239_edje_lua_group_get_scale(lua_State *L)
4240{
4241 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4242 lua_pushnumber(L, edje_object_scale_get(obj->eo));
4243 return 1;
4244}
4245
4246static int
4247_edje_lua_group_get_load_error(lua_State *L)
4248{
4249 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4250 lua_pushnumber(L, edje_object_load_error_get(obj->eo));
4251 return 1;
4252}
4253
4254static int
4255_edje_lua_group_get_load_error_str(lua_State *L)
4256{
4257 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4258 lua_pushstring(L, edje_load_error_str(edje_object_load_error_get(obj->eo)));
4259 return 1;
4260}
4261
4262static int
4263_edje_lua_group_get_play(lua_State *L)
4264{
4265 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4266 lua_pushboolean(L, edje_object_play_get(obj->eo));
4267 return 1;
4268}
4269
4270static int
4271_edje_lua_group_get_animation(lua_State *L)
4272{
4273 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4274 lua_pushboolean(L, edje_object_animation_get(obj->eo));
4275 return 1;
4276}
4277
4278static int
4279_edje_lua_group_get_frametime(lua_State *L)
4280{
4281 lua_pushnumber(L, edje_frametime_get());
4282 return 1;
4283}
4284
4285const luaL_Reg lGroup_get[] = {
4286 {"group", _edje_lua_group_get_group},
4287 {"mouse", _edje_lua_group_get_mouse},
4288 {"mouse_buttons", _edje_lua_group_get_mouse_buttons},
4289 {"size_min", _edje_lua_group_get_size_min},
4290 {"size_max", _edje_lua_group_get_size_max},
4291 {"scale", _edje_lua_group_get_scale},
4292 {"load_error", _edje_lua_group_get_load_error},
4293 {"load_error_str", _edje_lua_group_get_load_error_str},
4294 {"play", _edje_lua_group_get_play},
4295 {"animation", _edje_lua_group_get_animation},
4296 {"frametime", _edje_lua_group_get_frametime},
4297 {NULL, NULL} // sentinel
4298};
4299
4300static int
4301_edje_lua_group_set_group(lua_State *L)
4302{
4303 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4304 edje_object_file_set(obj->eo, obj->ed->file->path, luaL_checkstring(L, 2));
4305 return 0;
4306}
4307
4308static int
4309_edje_lua_group_set_size_min(lua_State *L)
4310{
4311 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4312
4313 luaL_checktype(L, 2, LUA_TTABLE);
4314 lua_rawgeti(L, 2, 1);
4315 lua_rawgeti(L, 2, 2);
4316 obj->ed->collection->prop.min.w = luaL_checkint(L, -2);
4317 obj->ed->collection->prop.min.h = luaL_checkint(L, -1);
4318 obj->ed->dirty = 1;
4319 _edje_recalc(obj->ed);
4320 return 0;
4321}
4322
4323static int
4324_edje_lua_group_set_size_max(lua_State *L)
4325{
4326 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4327 luaL_checktype(L, 2, LUA_TTABLE);
4328 lua_rawgeti(L, 2, 1);
4329 lua_rawgeti(L, 2, 2);
4330 obj->ed->collection->prop.max.w = luaL_checkint(L, -2);
4331 obj->ed->collection->prop.max.h = luaL_checkint(L, -1);
4332 obj->ed->dirty = 1;
4333 _edje_recalc(obj->ed);
4334 return 0;
4335}
4336
4337static int
4338_edje_lua_group_set_scale(lua_State *L)
4339{
4340 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4341 edje_object_scale_set(obj->eo, luaL_checknumber(L, 2));
4342 return 0;
4343}
4344
4345static int
4346_edje_lua_group_set_play(lua_State *L)
4347{
4348 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4349 edje_object_play_set(obj->eo, lua_toboolean(L, 2));
4350 return 0;
4351}
4352
4353static int
4354_edje_lua_group_set_animation(lua_State *L)
4355{
4356 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4357 edje_object_animation_set(obj->eo, lua_toboolean(L, 2));
4358 return 0;
4359}
4360
4361static void
4362_edje_lua_group_text_change_cb(void* data, Evas_Object *obj, const char* part)
4363{
4364 Edje_Lua_Ref *ref = data;
4365 lua_State *L = ref->L;
4366 int err_code;
4367
4368 _edje_lua_get_ref(L, ref);
4369 _edje_lua_get_reg(L, obj);
4370 lua_pushstring(L, part);
4371
4372 if ((err_code = lua_pcall(L, 2, 0, 0)))
4373 _edje_lua_error(L, err_code);
4374}
4375
4376static int
4377_edje_lua_group_set_text_change_cb(lua_State *L)
4378{
4379 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4380 edje_object_text_change_cb_set(obj->eo, _edje_lua_group_text_change_cb, _edje_lua_new_ref(L, 2));
4381 return 0;
4382}
4383
4384static int
4385_edje_lua_group_set_frametime(lua_State *L)
4386{
4387 edje_frametime_set(luaL_checknumber(L, 2));
4388 return 0;
4389}
4390const luaL_Reg lGroup_set[] = {
4391 {"group", _edje_lua_group_set_group},
4392 {"size_min", _edje_lua_group_set_size_min},
4393 {"size_max", _edje_lua_group_set_size_max},
4394 {"scale", _edje_lua_group_set_scale},
4395 {"play", _edje_lua_group_set_play},
4396 {"animation", _edje_lua_group_set_animation},
4397 {"text_change_cb", _edje_lua_group_set_text_change_cb},
4398 {"frametime", _edje_lua_group_set_frametime},
4399 {NULL, NULL} // sentinel
4400};
4401
4402static int
4403_edje_lua_group_fn_timer(lua_State *L)
4404{
4405 Edje_Lua_Timer *tar = lua_newuserdata(L, sizeof(Edje_Lua_Timer));
4406
4407 _edje_lua_set_class(L, -1, cTimer);
4408 /* ^^^^^^^^^^^^^^^^(L, index, class)
4409 lua_newtable(L);
4410 if (index < 0)
4411 lua_setfenv(L, index - 1);
4412 else
4413 lua_setfenv(L, index);
4414
4415 _edje_lua_get_metatable(L, class);
4416 if (index < 0)
4417 lua_setmetatable(L, index - 1);
4418 else
4419 lua_setmetatable(L, index);
4420 */
4421
4422 tar->et = ecore_timer_add(luaL_checknumber(L, 2), _edje_lua_timer_cb, tar);
4423 tar->L = L;
4424
4425 _edje_lua_new_reg(L, -1, tar); // freed in _edje_lua_timer_cb/del
4426 /* ^^^^^^^^^^^^^^(L, index, ptr)
4427 lua_pushvalue(L, index);
4428 lua_pushlightuserdata(L, ptr);
4429 lua_insert(L, -2);
4430 lua_rawset(L, LUA_REGISTRYINDEX); // freed in _edje_lua_free_reg
4431 */
4432
4433 tar->cb = _edje_lua_new_ref(L, 3); // freed in _edje_lua_timer_cb/del
4434 /* ^^^^^^^^^^^^^^^^^^^^^^^^(L, index)
4435 lua_pushvalue(L, index);
4436 Edje_Lua_Ref *ref = malloc(sizeof(Edje_Lua_Ref));
4437 ref->id = luaL_ref(L, LUA_REGISTRYINDEX);
4438 ref->L = L;
4439 return ref;
4440 */
4441 return 1;
4442}
4443
4444static int
4445_edje_lua_group_fn_animator(lua_State *L)
4446{
4447 Edje_Lua_Animator *tar = lua_newuserdata(L, sizeof(Edje_Lua_Animator));
4448 _edje_lua_set_class(L, -1, cAnimator);
4449 tar->ea = ecore_animator_add(_edje_lua_animator_cb, tar);
4450 tar->L = L;
4451 _edje_lua_new_reg(L, -1, tar); // freed in _edje_lua_animator_cb/del
4452 tar->cb = _edje_lua_new_ref(L, 2); // freed in _edje_lua_animator_cb/del
4453 return 1;
4454}
4455
4456static int
4457_edje_lua_group_fn_poller(lua_State *L)
4458{
4459 int interval;
4460 Edje_Lua_Poller *tar;
4461 tar = lua_newuserdata(L, sizeof(Edje_Lua_Poller));
4462 _edje_lua_set_class(L, -1, cPoller);
4463
4464 interval = luaL_checknumber(L, 2);
4465 if ((interval <= 0) || ((interval & 1) != 0))
4466 {
4467 return 0;
4468 }
4469
4470 // Only 1 type of poller currently implemented in ecore
4471 tar->ep = ecore_poller_add(ECORE_POLLER_CORE, interval,
4472 _edje_lua_poller_cb, tar);
4473 tar->L = L;
4474 _edje_lua_new_reg(L, -1, tar); // freed in _edje_lua_poller_cb/del
4475 tar->cb = _edje_lua_new_ref(L, 3); // freed in _edje_lua_poller_cb/del
4476
4477 return 1;
4478}
4479
4480static int
4481_edje_lua_group_fn_transform(lua_State *L)
4482{
4483 Edje_Lua_Transform *tar = lua_newuserdata(L, sizeof(Edje_Lua_Transform));
4484 evas_transform_identity_set (&(tar->et));
4485 _edje_lua_set_class(L, -1, cTransform);
4486 tar->L = L;
4487 return 1;
4488}
4489
4490static int
4491_edje_lua_group_fn_signal_emit(lua_State *L)
4492{
4493 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4494 edje_object_signal_emit(obj->eo,
4495 luaL_checkstring(L, 2), luaL_checkstring(L, 3));
4496 return 0;
4497}
4498
4499static Edje_Program *
4500_edje_lua_program_get_byname(Evas_Object * obj, const char *prog_name)
4501{
4502 Edje_Program *epr;
4503 int i;
4504 Edje *ed;
4505 ed = _edje_fetch(obj);
4506 if (!ed)
4507 return NULL;
4508 if (!prog_name)
4509 return NULL;
4510 for (i = 0; i < ed->table_programs_size; i++)
4511 {
4512 epr = ed->table_programs[i];
4513 if ((epr->name) && (strcmp(epr->name, prog_name) == 0))
4514 return epr;
4515 }
4516 return NULL;
4517}
4518
4519static int
4520_edje_lua_group_fn_program_run(lua_State *L)
4521{
4522 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4523 Edje_Program *pr =
4524 _edje_lua_program_get_byname(obj->eo, luaL_checkstring(L, 2));
4525 if (pr)
4526 _edje_program_run(obj->ed, pr, 0, "", "");
4527 return 0;
4528}
4529
4530static int
4531_edje_lua_group_fn_program_stop(lua_State *L)
4532{
4533 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4534 Edje_Program *pr =
4535 _edje_lua_program_get_byname(obj->eo, luaL_checkstring(L, 2));
4536 int program_id = pr->id;
4537 Edje_Running_Program *runp;
4538 Eina_List *l;
4539 obj->ed->walking_actions = 1;
4540 EINA_LIST_FOREACH(obj->ed->actions, l, runp)
4541 if (program_id == runp->program->id)
4542 _edje_program_end(obj->ed, runp);
4543 obj->ed->walking_actions = 0;
4544 return 0;
4545}
4546
4547static int
4548_edje_lua_group_fn_message_send(lua_State *L)
4549{
4550 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4551 int type = luaL_checkint(L, 2);
4552 void *msg = NULL;
4553 int i;
4554 int size;
4555 switch (type)
4556 {
4557 case EDJE_MESSAGE_NONE:
4558 break;
4559 case EDJE_MESSAGE_SIGNAL:
4560 break;
4561 case EDJE_MESSAGE_STRING:
4562 {
4563 Edje_Message_String *msg_string =
4564 malloc(sizeof(Edje_Message_String));
4565 msg_string->str = (char *)luaL_checkstring(L, 4);
4566 msg = msg_string;
4567 }
4568 break;
4569 case EDJE_MESSAGE_INT:
4570 {
4571 Edje_Message_Int *msg_int = malloc(sizeof(Edje_Message_Int));
4572
4573 msg_int->val = luaL_checkint(L, 4);
4574 msg = msg_int;
4575 }
4576 break;
4577 case EDJE_MESSAGE_FLOAT:
4578 {
4579 Edje_Message_Float *msg_float = malloc(sizeof(Edje_Message_Float));
4580
4581 msg_float->val = luaL_checknumber(L, 4);
4582 msg = msg_float;
4583 }
4584 break;
4585 case EDJE_MESSAGE_STRING_SET:
4586 {
4587 if (lua_type(L, 4) != LUA_TTABLE)
4588 break;
4589 size = lua_objlen(L, 4);
4590 Edje_Message_String_Set *msg_string_set =
4591 malloc(sizeof(Edje_Message_String_Set) +
4592 (size - 1) * sizeof(char *));
4593 msg_string_set->count = size;
4594 for (i = 0; i < size; i++)
4595 {
4596 lua_rawgeti(L, 4, i + 1);
4597 msg_string_set->str[i] = (char *)luaL_checkstring(L, -1);
4598 lua_pop(L, 1);
4599 }
4600 msg = msg_string_set;
4601 }
4602 break;
4603 case EDJE_MESSAGE_INT_SET:
4604 {
4605 if (lua_type(L, 4) != LUA_TTABLE)
4606 break;
4607 size = lua_objlen(L, 4);
4608 Edje_Message_Int_Set *msg_int_set =
4609 malloc(sizeof(Edje_Message_Int_Set) + (size - 1) * sizeof(int));
4610 msg_int_set->count = size;
4611 for (i = 0; i < size; i++)
4612 {
4613 lua_rawgeti(L, 4, i + 1);
4614 msg_int_set->val[i] = luaL_checkint(L, -1);
4615 lua_pop(L, 1);
4616 }
4617 msg = msg_int_set;
4618 }
4619 break;
4620 case EDJE_MESSAGE_FLOAT_SET:
4621 {
4622 if (lua_type(L, 4) != LUA_TTABLE)
4623 break;
4624 size = lua_objlen(L, 4);
4625 Edje_Message_Float_Set *msg_float_set =
4626 malloc(sizeof(Edje_Message_Float_Set) +
4627 (size - 1) * sizeof(double));
4628 msg_float_set->count = size;
4629 for (i = 0; i < size; i++)
4630 {
4631 lua_rawgeti(L, 4, i + 1);
4632 msg_float_set->val[i] = luaL_checknumber(L, -1);
4633 lua_pop(L, 1);
4634 }
4635 msg = msg_float_set;
4636 }
4637 break;
4638 case EDJE_MESSAGE_STRING_INT:
4639 {
4640 Edje_Message_String_Int *msg_string_int =
4641 malloc(sizeof(Edje_Message_String_Int));
4642 msg_string_int->str = (char *)luaL_checkstring(L, 4);
4643 msg_string_int->val = luaL_checkint(L, 5);
4644 msg = msg_string_int;
4645 }
4646 break;
4647 case EDJE_MESSAGE_STRING_FLOAT:
4648 {
4649 Edje_Message_String_Float *msg_string_float =
4650 malloc(sizeof(Edje_Message_String_Float));
4651 msg_string_float->str = (char *)luaL_checkstring(L, 4);
4652 msg_string_float->val = luaL_checknumber(L, 5);
4653 msg = msg_string_float;
4654 }
4655 break;
4656 case EDJE_MESSAGE_STRING_INT_SET:
4657 {
4658 if (lua_type(L, 5) != LUA_TTABLE)
4659 break;
4660 size = lua_objlen(L, 5);
4661 Edje_Message_String_Int_Set *msg_string_int_set =
4662 malloc(sizeof(Edje_Message_String_Int_Set) +
4663 (size - 1) * sizeof(int));
4664 msg_string_int_set->str = (char *)luaL_checkstring(L, 4);
4665 msg_string_int_set->count = size;
4666 for (i = 0; i < size; i++)
4667 {
4668 lua_rawgeti(L, 5, i + 1);
4669 msg_string_int_set->val[i] = luaL_checkint(L, -1);
4670 lua_pop(L, 1);
4671 }
4672 msg = msg_string_int_set;
4673 }
4674 break;
4675 case EDJE_MESSAGE_STRING_FLOAT_SET:
4676 {
4677 if (lua_type(L, 5) != LUA_TTABLE)
4678 break;
4679 size = lua_objlen(L, 5);
4680 Edje_Message_String_Float_Set *msg_string_float_set =
4681 malloc(sizeof(Edje_Message_String_Float_Set) +
4682 (size - 1) * sizeof(double));
4683 msg_string_float_set->str = (char *)luaL_checkstring(L, 4);
4684 msg_string_float_set->count = size;
4685 for (i = 0; i < size; i++)
4686 {
4687 lua_rawgeti(L, 5, i + 1);
4688 msg_string_float_set->val[i] = luaL_checknumber(L, -1);
4689 lua_pop(L, 1);
4690 }
4691 msg = msg_string_float_set;
4692 }
4693 break;
4694 default:
4695 break;
4696 }
4697
4698 if (msg)
4699 {
4700 edje_object_message_send(obj->eo, type, luaL_checkint(L, 3), msg);
4701 free(msg);
4702 }
4703
4704 return 0;
4705}
4706
4707static void
4708_edje_lua_group_signal_callback(void *data, Evas_Object * edj,
4709 const char *signal, const char *source)
4710{
4711 Edje_Lua_Ref *cb = data;
4712 lua_State *L = cb->L;
4713 _edje_lua_get_ref(L, cb); // signal callback function
4714 if (lua_isfunction(L, -1))
4715 {
4716 int err_code;
4717
4718 _edje_lua_get_reg(L, edj);
4719 lua_pushstring(L, signal); // signal
4720 lua_pushstring(L, source); // source
4721
4722 if ((err_code = lua_pcall(L, 3, 0, 0)))
4723 _edje_lua_error(L, err_code);
4724 }
4725}
4726
4727static int
4728_edje_lua_group_fn_signal_callback_add(lua_State *L)
4729{
4730 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4731 if (lua_type(L, 4) == LUA_TFUNCTION)
4732 {
4733 Edje_Lua_Ref *ref = _edje_lua_new_ref(L, 4);
4734 obj->cb = eina_list_append(obj->cb, ref);
4735 edje_object_signal_callback_add(obj->eo,
4736 luaL_checkstring(L, 2),
4737 luaL_checkstring(L, 3),
4738 _edje_lua_group_signal_callback,
4739 ref); // freed in _edje_lua_group_fn_signal_callback_del
4740 }
4741 return 0;
4742}
4743
4744static int
4745_edje_lua_group_fn_signal_callback_del(lua_State *L)
4746{
4747 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4748 Edje_Lua_Ref *ref = edje_object_signal_callback_del(obj->eo,
4749 luaL_checkstring(L, 2),
4750 luaL_checkstring(L, 3),
4751 _edje_lua_group_signal_callback);
4752 obj->cb = eina_list_remove(obj->cb, ref);
4753 _edje_lua_free_ref(L, ref); // created in _edje_lua_group_fn_signal_callback_add
4754 return 0;
4755}
4756
4757static int
4758_edje_lua_group_fn_freeze(lua_State *L)
4759{
4760 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4761 edje_object_freeze(obj->eo);
4762 return 0;
4763}
4764
4765static int
4766_edje_lua_group_fn_thaw(lua_State *L)
4767{
4768 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup);
4769 edje_object_thaw(obj->eo);
4770 return 0;
4771}
4772
4773const luaL_Reg lGroup_fn[] = {
4774 {"timer", _edje_lua_group_fn_timer},
4775 {"animator", _edje_lua_group_fn_animator},
4776 {"poller", _edje_lua_group_fn_poller},
4777 {"transform", _edje_lua_group_fn_transform},
4778 {"signal_emit", _edje_lua_group_fn_signal_emit},
4779 {"message_send", _edje_lua_group_fn_message_send},
4780 {"program_run", _edje_lua_group_fn_program_run},
4781 {"program_stop", _edje_lua_group_fn_program_stop},
4782 {"signal_callback_add", _edje_lua_group_fn_signal_callback_add},
4783 {"signal_callback_del", _edje_lua_group_fn_signal_callback_del},
4784 {"freeze", _edje_lua_group_fn_freeze},
4785 {"thaw", _edje_lua_group_fn_thaw},
4786 {NULL, NULL} // sentinel
4787};
4788
4789/*
4790 * Lua bindings
4791 */
4792
4793const luaL_Reg lScript_get[];
4794
4795const luaL_Reg lScript_set[];
4796
4797const luaL_Reg lScript_fn[];
4798
4799const Edje_Lua_Reg mScript = {
4800 lNil,
4801 lScript_get,
4802 lScript_set,
4803 lScript_fn
4804};
4805
4806const Edje_Lua_Reg *cScript[] = {
4807 &mClass,
4808 &mObject,
4809 &mGroup,
4810 &mScript,
4811 NULL // sentinel
4812};
4813
4814/*
4815 * macro for adding an evas_object in the lua_script_only object
4816 */
4817#define _EDJE_LUA_SCRIPT_FN_ADD(DEF, CLASS, FUNC) \
4818 static int \
4819 DEF (lua_State *L) \
4820 { \
4821 int set = lua_gettop (L) == 2; \
4822 Edje_Lua_Evas_Object *obj = _edje_lua_checkudata (L, 1, &mScript); \
4823 Edje_Lua_Evas_Object *tar = lua_newuserdata (L, sizeof (Edje_Lua_Evas_Object)); \
4824 _edje_lua_set_class (L, -1, CLASS); \
4825 tar->eo = FUNC (obj->ed->evas); \
4826 tar->ed = obj->ed; \
4827 tar->L = L; \
4828 tar->cb = NULL; \
4829 evas_object_move (tar->eo, obj->ed->x, obj->ed->y); \
4830 _edje_lua_new_reg (L, -1, tar); /* freed in _edje_lua_object_del_cb */ \
4831 _edje_lua_new_reg (L, -1, tar->eo); /* freed in _edje_lua_object_del_cb */ \
4832 evas_object_smart_member_add (tar->eo, obj->eo); \
4833 evas_object_clip_set (tar->eo, obj->ed->clipper); \
4834 evas_object_event_callback_add (tar->eo, EVAS_CALLBACK_DEL, _edje_lua_object_del_cb, L); \
4835 if (set) \
4836 { \
4837 int err_code; \
4838 lua_getfield (L, -1, "set"); \
4839 lua_pushvalue (L, -2); \
4840 lua_pushvalue (L, 2); \
4841 if ((err_code = lua_pcall (L, 2, 0, 0))) \
4842 _edje_lua_error (L, err_code); \
4843 } \
4844 return 1; \
4845 }
4846
4847_EDJE_LUA_SCRIPT_FN_ADD(_edje_lua_script_fn_rectangle,
4848 cRectangle,
4849 evas_object_rectangle_add)
4850_EDJE_LUA_SCRIPT_FN_ADD(_edje_lua_script_fn_image,
4851 cImage,
4852 evas_object_image_add)
4853_EDJE_LUA_SCRIPT_FN_ADD(_edje_lua_script_fn_table,
4854 cTable,
4855 evas_object_table_add)
4856_EDJE_LUA_SCRIPT_FN_ADD(_edje_lua_script_fn_line,
4857 cLine,
4858 evas_object_line_add)
4859_EDJE_LUA_SCRIPT_FN_ADD(_edje_lua_script_fn_polygon,
4860 cPolygon,
4861 evas_object_polygon_add)
4862_EDJE_LUA_SCRIPT_FN_ADD(_edje_lua_script_fn_group, cGroup, edje_object_add)
4863
4864const luaL_Reg lScript_fn[] = {
4865 {"rectangle", _edje_lua_script_fn_rectangle},
4866 {"image", _edje_lua_script_fn_image},
4867 {"table", _edje_lua_script_fn_table},
4868 {"line", _edje_lua_script_fn_line},
4869 {"polygon", _edje_lua_script_fn_polygon},
4870 {"group", _edje_lua_script_fn_group},
4871 {NULL, NULL} // sentinel
4872};
4873
4874const luaL_Reg lScript_get[] = {
4875 {NULL, NULL} // sentinel
4876};
4877
4878const luaL_Reg lScript_set[] = {
4879 {NULL, NULL} // sentinel
4880};
4881
4882/*
4883 * creates and exports a lua_script_only object
4884 */
4885void
4886_edje_lua_script_fn_new(Edje * ed)
4887{
4888 lua_State *L = ed->L;
4889 Edje_Lua_Evas_Object *tar = lua_newuserdata(L, sizeof(Edje_Lua_Evas_Object));
4890 _edje_lua_set_class(L, -1, cScript);
4891 tar->eo = ed->obj;
4892 tar->ed = ed;
4893 tar->L = L;
4894 tar->cb = NULL;
4895 _edje_lua_new_reg(L, -1, tar); // freed in _edje_lua_object_del_cb
4896 _edje_lua_new_reg(L, -1, ed); // freed in edje_load.c::_edje_file_del
4897 _edje_lua_new_reg(L, -1, ed->obj); // freed in _edje_lua_object_del_cb
4898 evas_object_event_callback_add(tar->eo, EVAS_CALLBACK_DEL,
4899 _edje_lua_object_del_cb, L);
4900}
4901
4902/*
4903 * creates and exports an Edje group with associated Lua scripts in the parts and programs sections
4904 */
4905void
4906_edje_lua_group_fn_new(Edje * ed)
4907{
4908 lua_State *L = ed->L;
4909 Edje_Lua_Evas_Object *tar = lua_newuserdata(L, sizeof(Edje_Lua_Evas_Object));
4910 _edje_lua_set_class(L, -1, cGroup);
4911 tar->eo = ed->obj;
4912 tar->ed = ed;
4913 tar->L = L;
4914 tar->cb = NULL;
4915 _edje_lua_new_reg(L, -1, tar); // freed in _edje_lua_object_del_cb
4916 _edje_lua_new_reg(L, -1, ed); // freed in edje_load.c::_edje_file_del
4917 _edje_lua_new_reg(L, -1, ed->obj); // freed in _edje_lua_object_del_cb
4918 evas_object_event_callback_add(tar->eo, EVAS_CALLBACK_DEL,
4919 _edje_lua_object_del_cb, L);
4920}
4921
4922/*
4923 * this function loads all the Lua bindings into the global Lua state
4924 */
4925static void
4926_edje_lua_open(lua_State *L)
4927{
4928 /*
4929 * export classes
4930 */
4931 _edje_lua_new_class(L, cTimer);
4932 _edje_lua_new_class(L, cAnimator);
4933 _edje_lua_new_class(L, cPoller);
4934 _edje_lua_new_class(L, cTransform);
4935 _edje_lua_new_class(L, cRectangle);
4936 _edje_lua_new_class(L, cImage);
4937 _edje_lua_new_class(L, cTable);
4938 _edje_lua_new_class(L, cLine);
4939 _edje_lua_new_class(L, cPolygon);
4940 _edje_lua_new_class(L, cGroup);
4941 _edje_lua_new_class(L, cDescription);
4942 _edje_lua_new_class(L, cPart);
4943 _edje_lua_new_class(L, cScript);
4944
4945 /*
4946 * export constants
4947 */
4948 _edje_lua_new_const(L, "MESSAGE_NONE", EDJE_MESSAGE_NONE);
4949 _edje_lua_new_const(L, "MESSAGE_SIGNAL", EDJE_MESSAGE_SIGNAL);
4950 _edje_lua_new_const(L, "MESSAGE_STRING", EDJE_MESSAGE_STRING);
4951 _edje_lua_new_const(L, "MESSAGE_INT", EDJE_MESSAGE_INT);
4952 _edje_lua_new_const(L, "MESSAGE_FLOAT", EDJE_MESSAGE_FLOAT);
4953 _edje_lua_new_const(L, "MESSAGE_STRING_SET", EDJE_MESSAGE_STRING_SET);
4954 _edje_lua_new_const(L, "MESSAGE_INT_SET", EDJE_MESSAGE_INT_SET);
4955 _edje_lua_new_const(L, "MESSAGE_FLOAT_SET", EDJE_MESSAGE_FLOAT_SET);
4956 _edje_lua_new_const(L, "MESSAGE_STRING_INT", EDJE_MESSAGE_STRING_INT);
4957 _edje_lua_new_const(L, "MESSAGE_STRING_FLOAT", EDJE_MESSAGE_STRING_FLOAT);
4958 _edje_lua_new_const(L, "MESSAGE_STRING_INT_SET", EDJE_MESSAGE_STRING_INT_SET);
4959 _edje_lua_new_const(L, "MESSAGE_STRING_FLOAT_SET", EDJE_MESSAGE_STRING_FLOAT_SET);
4960
4961 _edje_lua_new_const(L, "PART_TYPE_NONE", EDJE_PART_TYPE_NONE);
4962 _edje_lua_new_const(L, "PART_TYPE_RECTANGLE", EDJE_PART_TYPE_RECTANGLE);
4963 _edje_lua_new_const(L, "PART_TYPE_TEXT", EDJE_PART_TYPE_TEXT);
4964 _edje_lua_new_const(L, "PART_TYPE_IMAGE", EDJE_PART_TYPE_IMAGE);
4965 _edje_lua_new_const(L, "PART_TYPE_SWALLOW", EDJE_PART_TYPE_SWALLOW);
4966 _edje_lua_new_const(L, "PART_TYPE_TEXTBLOCK", EDJE_PART_TYPE_TEXTBLOCK);
4967 _edje_lua_new_const(L, "PART_TYPE_GRADIENT", EDJE_PART_TYPE_GRADIENT);
4968 _edje_lua_new_const(L, "PART_TYPE_GROUP", EDJE_PART_TYPE_GROUP);
4969 _edje_lua_new_const(L, "PART_TYPE_BOX", EDJE_PART_TYPE_BOX);
4970
4971 _edje_lua_new_const(L, "TEXT_EFFECT_NONE", EDJE_TEXT_EFFECT_NONE);
4972 _edje_lua_new_const(L, "TEXT_EFFECT_PLAIN", EDJE_TEXT_EFFECT_PLAIN);
4973 _edje_lua_new_const(L, "TEXT_EFFECT_OUTLINE", EDJE_TEXT_EFFECT_OUTLINE);
4974 _edje_lua_new_const(L, "TEXT_EFFECT_OTLINE", EDJE_TEXT_EFFECT_SOFT_OUTLINE);
4975 _edje_lua_new_const(L, "TEXT_EFFECT_SHADOW", EDJE_TEXT_EFFECT_SHADOW);
4976 _edje_lua_new_const(L, "TEXT_EFFECT_SOFT_SHADOW", EDJE_TEXT_EFFECT_SOFT_SHADOW);
4977 _edje_lua_new_const(L, "TEXT_EFFECT_OUTLINE_SHADOW", EDJE_TEXT_EFFECT_OUTLINE_SHADOW);
4978 _edje_lua_new_const(L, "TEXT_EFFECT_OUTLINE_SOFT_SHADOW", EDJE_TEXT_EFFECT_OUTLINE_SOFT_SHADOW);
4979 _edje_lua_new_const(L, "TEXT_EFFECT_FAR_SHADOW", EDJE_TEXT_EFFECT_FAR_SHADOW);
4980 _edje_lua_new_const(L, "TEXT_EFFECT_FAR_SOFT_SHADOW", EDJE_TEXT_EFFECT_FAR_SOFT_SHADOW);
4981 _edje_lua_new_const(L, "TEXT_EFFECT_GLOW", EDJE_TEXT_EFFECT_GLOW);
4982
4983 _edje_lua_new_const(L, "RENDER_BLEND", EVAS_RENDER_BLEND);
4984 _edje_lua_new_const(L, "RENDER_BLEND_REL", EVAS_RENDER_BLEND_REL);
4985 _edje_lua_new_const(L, "RENDER_COPY", EVAS_RENDER_COPY);
4986 _edje_lua_new_const(L, "RENDER_COPY_REL", EVAS_RENDER_COPY_REL);
4987 _edje_lua_new_const(L, "RENDER_ADD", EVAS_RENDER_ADD);
4988 _edje_lua_new_const(L, "RENDER_ADD_REL", EVAS_RENDER_ADD_REL);
4989 _edje_lua_new_const(L, "RENDER_SUB", EVAS_RENDER_SUB);
4990 _edje_lua_new_const(L, "RENDER_SUB_REL", EVAS_RENDER_SUB_REL);
4991 _edje_lua_new_const(L, "RENDER_TINT", EVAS_RENDER_TINT);
4992 _edje_lua_new_const(L, "RENDER_TINT_REL", EVAS_RENDER_TINT_REL);
4993 _edje_lua_new_const(L, "RENDER_MASK", EVAS_RENDER_MASK);
4994 _edje_lua_new_const(L, "RENDER_MUL", EVAS_RENDER_MUL);
4995
4996 _edje_lua_new_const(L, "BORDER_FILL_NONE", EVAS_BORDER_FILL_NONE);
4997 _edje_lua_new_const(L, "BORDER_FILL_DEFAULT", EVAS_BORDER_FILL_DEFAULT);
4998 _edje_lua_new_const(L, "BORDER_FILL_SOLID", EVAS_BORDER_FILL_SOLID);
4999
5000 _edje_lua_new_const(L, "POINTER_MODE_AUTOGRAB", EVAS_OBJECT_POINTER_MODE_AUTOGRAB);
5001 _edje_lua_new_const(L, "POINTER_MODE_NOGRAB", EVAS_OBJECT_POINTER_MODE_NOGRAB);
5002
5003 _edje_lua_new_const(L, "ASPECT_CONTROL_NEITHER", EVAS_ASPECT_CONTROL_NEITHER);
5004 _edje_lua_new_const(L, "ASPECT_CONTROL_HORIZONTAL", EVAS_ASPECT_CONTROL_HORIZONTAL);
5005 _edje_lua_new_const(L, "ASPECT_CONTROL_VERTICAL", EVAS_ASPECT_CONTROL_VERTICAL);
5006 _edje_lua_new_const(L, "ASPECT_CONTROL_BOTH", EVAS_ASPECT_CONTROL_BOTH);
5007
5008 _edje_lua_new_const(L, "CALLBACK_RENEW", ECORE_CALLBACK_RENEW);
5009 _edje_lua_new_const(L, "CALLBACK_CANCEL", ECORE_CALLBACK_CANCEL);
5010}
5011
5012/*
5013 * main Lua state
5014 * created by edje_init ()
5015 * closed by edje_shutdown ()
5016 * any other private Lua state inherits from this global state
5017 */
5018static lua_State *Ledje = NULL;
5019
5020lua_State *
5021_edje_lua_state_get ()
5022{
5023 return Ledje;
5024}
5025
5026/*
5027 * custom memory allocation function
5028 * raises an error, if memory usage is above the given maximum
5029 */
5030static void *
5031_edje_lua_alloc(void *ud, void *ptr, size_t osize, size_t nsize)
5032{
5033 Edje_Lua_Alloc *ela = ud;
5034 void *ptr2;
5035
5036 ela->cur += nsize - osize;
5037 if (ela->cur > ela->max)
5038 {
5039 ERR("Edje Lua memory limit of %zu bytes reached (%zu allocated)",
5040 ela->max, ela->cur);
5041 return NULL;
5042 }
5043 if (nsize == 0)
5044 {
5045 free(ptr); /* ANSI requires that free(NULL) has no effect */
5046 return NULL;
5047 }
5048
5049 /* ANSI requires that realloc(NULL, size) == malloc(size) */
5050 ptr2 = realloc(ptr, nsize);
5051 if (ptr2) return ptr2;
5052 ERR("Edje Lua cannot re-allocate %zu bytes", nsize);
5053 return ptr2;
5054}
5055
5056void
5057_edje_lua_init()
5058{
5059 if (Ledje != NULL) return;
5060 /*
5061 * create main Lua state with the custom memory allocation function
5062 */
5063 static Edje_Lua_Alloc ela = { 1e7, 0 }; // TODO make the memory limit configurable?
5064 Ledje = lua_newstate(_edje_lua_alloc, &ela);
5065 if (!Ledje)
5066 {
5067 ERR("Lua error: Lua state could not be initialized");
5068 exit(-1);
5069 }
5070
5071 lua_atpanic(Ledje, _edje_lua_custom_panic);
5072
5073 /*
5074 * configure Lua garbage collector
5075 * TODO optimize garbage collector for typical edje use or make it configurable
5076 */
5077 lua_gc(Ledje, LUA_GCSETPAUSE, 200);
5078 lua_gc(Ledje, LUA_GCSETSTEPMUL, 200);
5079
5080 /*
5081 * sandbox Lua
5082 * no access to io, os and package routines
5083 * no loading and execution of files
5084 * no loading and execution of strings
5085 * no access to the OS environment
5086 */
5087 luaopen_base(Ledje);
5088 luaopen_table(Ledje);
5089 luaopen_string(Ledje);
5090 luaopen_math(Ledje);
5091 luaopen_os(Ledje);
5092
5093 /*
5094 * FIXME
5095 * this is just for debug purposes
5096 * remove it in the final version
5097 */
5098 lua_pushnil(Ledje);
5099 lua_setglobal(Ledje, "load");
5100 lua_pushnil(Ledje);
5101 lua_setglobal(Ledje, "loadfile");
5102 lua_pushnil(Ledje);
5103 lua_setglobal(Ledje, "loadstring");
5104 lua_pushnil(Ledje);
5105 lua_setglobal(Ledje, "dofile");
5106 lua_pushnil(Ledje);
5107 lua_setglobal(Ledje, "dostring");
5108
5109 lua_getglobal(Ledje, "os");
5110 lua_pushnil(Ledje);
5111 lua_setfield(Ledje, -2, "exit");
5112 lua_pushnil(Ledje);
5113 lua_setfield(Ledje, -2, "setlocale");
5114 lua_pushnil(Ledje);
5115 lua_setfield(Ledje, -2, "getenv");
5116 lua_pushnil(Ledje);
5117 lua_setfield(Ledje, -2, "remove");
5118 lua_pushnil(Ledje);
5119 lua_setfield(Ledje, -2, "tmpname");
5120 lua_pushnil(Ledje);
5121 lua_setfield(Ledje, -2, "rename");
5122 lua_pushnil(Ledje);
5123 lua_setfield(Ledje, -2, "execute");
5124 lua_pushnil(Ledje);
5125
5126 /*
5127 * we need a weak value registry
5128 * so that deleted and unused objects can be garbage collected
5129 */
5130 lua_createtable(Ledje, 1, 0);
5131 //lua_pushstring(Ledje, "v");
5132 lua_pushstring(Ledje, "");
5133 lua_setfield(Ledje, -2, "__mode");
5134 lua_setmetatable(Ledje, LUA_REGISTRYINDEX);
5135
5136 /*
5137 * load Lua Evas/Edje bindings
5138 */
5139 _edje_lua_open(Ledje);
5140}
5141
5142void
5143_edje_lua_shutdown()
5144{
5145 if (Ledje == NULL) return;
5146 lua_close(Ledje);
5147 Ledje = NULL;
5148}
5149
5150#endif
diff --git a/libraries/edje/src/lib/edje_lua2.c b/libraries/edje/src/lib/edje_lua2.c
new file mode 100644
index 0000000..2318af9
--- /dev/null
+++ b/libraries/edje/src/lib/edje_lua2.c
@@ -0,0 +1,4129 @@
1// FIXME: Some error checking would be nice.
2
3
4#include "edje_private.h"
5#include <ctype.h>
6
7#define RASTER_FORGOT_WHY "this is here."
8
9#ifdef _WIN32
10# define FMT_SIZE_T "%Iu"
11#else
12# define FMT_SIZE_T "%zu"
13#endif
14
15//--------------------------------------------------------------------------//
16#define MAX_LUA_MEM (4 * (1024 * 1024))
17#define ELO "|-ELO"
18
19#define LC(...) EINA_LOG_DOM_CRIT(_log_domain, __VA_ARGS__)
20#define LE(...) EINA_LOG_DOM_ERR(_log_domain, __VA_ARGS__)
21#define LW(...) EINA_LOG_DOM_WARN(_log_domain, __VA_ARGS__)
22#define LI(...) EINA_LOG_DOM_INFO(_log_domain, __VA_ARGS__)
23#define LD(...) EINA_LOG_DOM_DBG(_log_domain, __VA_ARGS__)
24
25/**
26@page luaref Edje Lua scripting
27
28@section intro Introduction
29
30Lua is intended for script-only objects at this point (with embryo left
31for augmenting standard programs). Since script-only objects effectively
32define objects entirely via Lua script (resize handling, event handling
33etc. etc.) this places many more demands on them, and thus a more powerful
34language is in order. Lua is that language.
35
36To get you started, here's an example that uses most of this lua API:
37@ref lua_script.edc
38
39Most of these lua functions are wrappers around various evas, ecore, and edje C
40functions. Refer to their documentation for more in depth details and up to
41date documentation. A lot of this documentation is simple copied from the C
42functions it wraps.
43
44@section args Lua function argument and return syntax
45
46Some of the lua functions can accept a table as well as separate arguments.
47Some of them return tables.
48
49@section classes Lua classes
50
51*/
52
53/*
54Lua functions stack usage.
55
56In the definition of the lua functions provided, always mention the stack usage,
57using the same notation that is used in the Lua 5.1 Reference Manual.
58http://www.lua.org/manual/5.1/manual.html#3.7 describes that notation.
59
60On the other hand, lua discards excess stack entries when control passes back to
61it, but it's good to maintain proper discipline.
62
63Should do the same for the support functions. These ARE more important to check.
64*/
65
66//--------------------------------------------------------------------------//
67typedef struct _Edje_Lua_Alloc Edje_Lua_Alloc;
68typedef struct _Edje_Lua_Obj Edje_Lua_Obj;
69typedef struct _Edje_Lua_Animator Edje_Lua_Animator;
70typedef struct _Edje_Lua_Timer Edje_Lua_Timer;
71typedef struct _Edje_Lua_Transition Edje_Lua_Transition;
72typedef struct _Edje_Lua_Evas_Object Edje_Lua_Evas_Object;
73typedef struct _Edje_Lua_Map Edje_Lua_Map;
74
75struct _Edje_Lua_Alloc
76{
77 size_t max, cur;
78};
79
80struct _Edje_Lua_Obj
81{
82 EINA_INLIST;
83
84 Edje *ed;
85 void (*free_func) (void *obj);
86 const char *meta;
87};
88
89struct _Edje_Lua_Animator
90{
91 Edje_Lua_Obj obj;
92 Ecore_Animator *animator;
93 int fn_ref;
94};
95
96struct _Edje_Lua_Timer
97{
98 Edje_Lua_Obj obj;
99 Ecore_Timer *timer;
100 int fn_ref;
101};
102
103struct _Edje_Lua_Transition
104{
105 Edje_Lua_Obj obj;
106 Ecore_Animator *animator;
107 double transition, start;
108 int fn_ref;
109};
110
111struct _Edje_Lua_Evas_Object
112{
113 Edje_Lua_Obj obj;
114 Evas_Object *evas_obj;
115 int x, y;
116};
117
118struct _Edje_Lua_Map
119{
120 Edje_Lua_Obj obj;
121 Evas_Map *map;
122};
123
124
125static void _elua_add_functions(lua_State *L, const char *api, const luaL_Reg *funcs, const char *meta, const char *parent, const char *base);
126static Eina_Bool _elua_isa(Edje_Lua_Obj *obj, const char *type);
127
128//--------------------------------------------------------------------------//
129#ifndef RASTER_FORGOT_WHY
130static lua_State *lstate = NULL;
131#endif
132static const char *_elua_key = "key";
133static const char *_elua_objs = "objs";
134/* This is not needed, pcalls don't longjmp(), that's why they are protected.
135static jmp_buf panic_jmp;
136*/
137static int panics = 0;
138static int _log_domain = -1;
139static int _log_count = 0;
140
141// FIXME: methods lua script can provide that edje will call (not done yet):
142// // scale set
143// // key down
144// // key up
145// // get dragable pos
146// // set dragable pos
147// // set drag size, step, page
148// // get drag size, step, page
149// // dragable step
150// // dragable page
151// // get part text
152// // set part text
153// // get swallow part
154// // set swallow part
155// // unswallow part
156// // textclass change
157// // colorclass change
158// // min size get <- ?? maybe set fn
159// // max size get <- ?? maybe set fn
160// // min size caclc (min/max restriction)
161// // preload
162// // preload cancel
163// // play set
164// // animation set
165// // parts extends calc
166// // part object get
167// // part geometry get
168//
169// // LATER: all the entry calls
170// // LATER: box and table calls
171// // LATER: perspective stuff change
172//
173
174// Grumble, pre-declare these.
175static const char *_elua_edje_meta = "edje_meta";
176static const char *_elua_evas_meta = "evas_meta";
177static const char *_elua_evas_edje_meta = "evas_edje_meta";
178static const char *_elua_evas_image_meta = "evas_image_meta";
179static const char *_elua_evas_line_meta = "evas_line_meta";
180static const char *_elua_evas_map_meta = "evas_map_meta";
181static const char *_elua_evas_polygon_meta = "evas_polygon_meta";
182static const char *_elua_evas_text_meta = "evas_text_meta";
183static const char *_elua_ecore_animator_meta = "ecore_animator_meta";
184static const char *_elua_ecore_timer_meta = "ecore_timer_meta";
185
186static int _elua_obj_gc(lua_State *L);
187
188static const struct luaL_reg _elua_edje_gc_funcs [] =
189{
190 {"__gc", _elua_obj_gc}, // garbage collector func for edje objects
191
192 {NULL, NULL} // end
193};
194
195static const luaL_Reg _elua_libs[] =
196{
197 {"", luaopen_base},
198// {LUA_LOADLIBNAME, luaopen_package}, // disable this lib - don't want
199 {LUA_TABLIBNAME, luaopen_table},
200// {LUA_IOLIBNAME, luaopen_io}, // disable this lib - don't want
201// {LUA_OSLIBNAME, luaopen_os}, // FIXME: audit os lib - maybe not provide or only provide specific calls
202 {LUA_STRLIBNAME, luaopen_string},
203 {LUA_MATHLIBNAME, luaopen_math},
204// {LUA_DBLIBNAME, luaopen_debug}, // disable this lib - don't want
205
206 {NULL, NULL} // end
207};
208
209//--------------------------------------------------------------------------//
210static void *
211_elua_alloc(void *ud, void *ptr, size_t osize, size_t nsize)
212{
213 Edje_Lua_Alloc *ela = ud;
214 void *ptr2;
215
216 ela->cur += nsize - osize;
217 if (ela->cur > ela->max)
218 {
219 ERR("Lua memory limit of " FMT_SIZE_T " bytes reached (" FMT_SIZE_T " allocated)",
220 ela->max, ela->cur);
221 return NULL;
222 }
223 if (nsize == 0)
224 {
225 free(ptr);
226 return NULL;
227 }
228
229 ptr2 = realloc(ptr, nsize);
230 if (ptr2) return ptr2;
231 ERR("Lua cannot re-allocate " FMT_SIZE_T " bytes", nsize);
232 return ptr2;
233}
234
235static int
236_elua_custom_panic(lua_State *L) // Stack usage [-0, +0, m]
237{
238 // If we somehow manage to have multiple panics, it's likely due to being out
239 // of memory in the following lua_tostring() call.
240 panics++;
241 if (panics)
242 {
243 EINA_LOG_DOM_CRIT(_edje_default_log_dom, "Lua PANICS!!!!!");
244 }
245 else
246 {
247 EINA_LOG_DOM_CRIT(_edje_default_log_dom,
248 "Lua PANIC!!!!!: %s", lua_tostring(L, -1)); // Stack usage [-0, +0, m]
249 }
250 // The docs say that this will cause an exit(EXIT_FAILURE) if we return,
251 // and that we we should long jump some where to avoid that. This is only
252 // called for things not called from a protected environment. We always
253 // use pcalls though, except for the library load calls. If we can't load
254 // the standard libraries, then perhaps a crash is the right thing.
255 return 0;
256}
257
258// Really only used to manage the pointer to our edje.
259static void
260_elua_table_ptr_set(lua_State *L, const void *key, const void *val) // Stack usage [-2, +2, e]
261{
262 lua_pushlightuserdata(L, (void *)key); // Stack usage [-0, +1, -]
263 lua_pushlightuserdata(L, (void *)val); // Stack usage [-0, +1, -]
264 lua_settable(L, LUA_REGISTRYINDEX); // Stack usage [-2, +0, e]
265}
266
267static const void *
268_elua_table_ptr_get(lua_State *L, const void *key) // Stack usage [-2, +2, e]
269{
270 const void *ptr;
271 lua_pushlightuserdata(L, (void *)key); // Stack usage [-0, +1, -]
272 lua_gettable(L, LUA_REGISTRYINDEX); // Stack usage [-1, +1, e]
273 ptr = lua_topointer(L, -1); // Stack usage [-0, +0, -]
274 lua_pop(L, 1); // Stack usage [-n, +0, -]
275 return ptr;
276}
277
278/* XXX: not used
279static void
280_elua_table_ptr_del(lua_State *L, const void *key) // Stack usage [-2, +2, e]
281{
282 lua_pushlightuserdata(L, (void *)key); // Stack usage [-0, +1, -]
283 lua_pushnil(L); // Stack usage [-0, +1, -]
284 lua_settable(L, LUA_REGISTRYINDEX); // Stack usage [-2, +0, e]
285}
286*/
287
288/*
289 * Cori: Assumes object to be saved on top of stack
290 */
291static void
292_elua_ref_set(lua_State *L, void *key) // Stack usage [-4, +4, m]
293{
294 lua_pushlightuserdata(L, &_elua_objs); // Stack usage [-0, +1, -]
295 lua_rawget(L, LUA_REGISTRYINDEX); // Stack usage [-1, +1, -]
296 lua_pushlightuserdata(L, key); // Stack usage [-0, +1, -]
297 lua_pushvalue(L,-3); // Stack usage [-0, +1, -]
298 lua_rawset(L, -3); // Stack usage [-2, +0, m]
299 lua_pop(L, 1); // Stack usage [-n, +0, -]
300}
301
302/*
303 * Cori: Get an object from the object table
304 */
305static void *
306_elua_ref_get(lua_State *L, void *key) // Stack usage [-3, +4, -]
307{
308 lua_pushlightuserdata(L, &_elua_objs); // Stack usage [-0, +1, -]
309 lua_rawget(L, LUA_REGISTRYINDEX); // Stack usage [-1, +1, -]
310 lua_pushlightuserdata(L, key); // Stack usage [-0, +1, -]
311 lua_rawget(L, -2); // Stack usage [-1, +1, -]
312 lua_remove(L, -2); // Stack usage [-1, +0, -]
313 return lua_touserdata(L, -2); // Stack usage [-0, +0, -]
314}
315
316static Edje_Lua_Obj *
317_elua_obj_new(lua_State *L, Edje *ed, int size, const char *metatable) // Stack usage [-5, +6, m]
318{
319 Edje_Lua_Obj *obj;
320
321 obj = (Edje_Lua_Obj *)lua_newuserdata(L, size); // Stack usage [-0, +1, m]
322 memset(obj, 0, size);
323 ed->lua_objs = eina_inlist_append(ed->lua_objs, EINA_INLIST_GET(obj));
324
325 luaL_getmetatable(L, metatable); // Stack usage [-0, +1, -]
326 lua_setmetatable(L, -2); // Stack usage [-1, +0, -]
327 obj->ed = ed;
328 obj->meta = metatable;
329
330 _elua_ref_set(L, obj); // Stack usage [-4, +4, m]
331 return obj;
332}
333
334static void
335_elua_obj_free(lua_State *L __UNUSED__, Edje_Lua_Obj *obj)
336{
337 if (!obj->free_func) return;
338 obj->free_func(obj);
339 obj->ed->lua_objs = eina_inlist_remove(obj->ed->lua_objs, EINA_INLIST_GET(obj));
340 obj->free_func = NULL;
341 obj->ed = NULL;
342}
343
344static int
345_elua_obj_gc(lua_State *L) // Stack usage [-0, +0, -]
346{
347 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
348 if (!obj) return 0;
349 _elua_obj_free(L, obj);
350 return 0;
351}
352
353static int
354_elua_obj_del(lua_State *L) // Stack usage [-0, +0, -]
355{
356 return _elua_obj_gc(L); // Stack usage [-0, +0, -]
357}
358
359static void
360_elua_gc(lua_State *L) // Stack usage [-0, +0, e]
361{
362 lua_gc(L, LUA_GCCOLLECT, 0); // Stack usage [-0, +0, e]
363}
364
365// These are what the various symbols are for each type -
366// int %
367// num #
368// str $
369// bool !
370// FIXME: Still to do, if we ever use them -
371// func &
372// userdata +
373// lightuserdata *
374// table @
375// thread ^
376// nil ~
377
378static char *
379_elua_push_name(lua_State *L, char *q, int index) // Stack usage [-0, +1, e or m]
380{
381 char *p = q;
382 char temp = '\0';
383
384 // A simplistic scan through an identifier, it's wrong, but it's quick,
385 // and we don't mind that it's wrong, coz this is only internal.
386 while (isalnum((int)*q))
387 q++;
388 temp = *q;
389 *q = '\0';
390 if (index > 0)
391 lua_getfield(L, index, p); // Stack usage [-0, +1, e]
392 else
393 lua_pushstring(L, p); // Stack usage [-0, +1, m]
394 *q = temp;
395
396 return q;
397}
398
399static int
400_elua_scan_params(lua_State *L, int i, char *params, ...) // Stack usage -
401 // if i is a table
402 // [-n, +n, e]
403 // else
404 // [-0, +0, -]
405{
406 va_list vl;
407 char *f = strdup(params);
408 char *p = f;
409 int n = 0, j = i, count = 0;
410 Eina_Bool table = EINA_FALSE;
411
412 if (!f) return -1;
413 va_start(vl, params);
414
415 if (lua_istable(L, i)) // Stack usage [-0, +0, -]
416 {
417 j = -1;
418 table = EINA_TRUE;
419 }
420
421 while (*p)
422 {
423 char *q;
424 Eina_Bool get = EINA_TRUE;
425
426 while (isspace((int)*p))
427 p++;
428 q = p + 1;
429 switch (*p)
430 {
431 case '%':
432 {
433 if (table)
434 {
435 q = _elua_push_name(L, q, i); // Stack usage [-0, +1, e]
436 }
437 if (lua_isnumber(L, j)) // Stack usage [-0, +0, -]
438 {
439 int *v = va_arg(vl, int *);
440 *v = lua_tointeger(L, j); // Stack usage [-0, +0, -]
441 n++;
442 }
443 break;
444 }
445 case '#':
446 {
447 if (table)
448 {
449 q = _elua_push_name(L, q, i); // Stack usage [-0, +1, e]
450 }
451 if (lua_isnumber(L, j)) // Stack usage [-0, +0, -]
452 {
453 double *v = va_arg(vl, double *);
454 *v = lua_tonumber(L, j); // Stack usage [-0, +0, -]
455 n++;
456 }
457 break;
458 }
459 case '$':
460 {
461 if (table)
462 {
463 q = _elua_push_name(L, q, i); // Stack usage [-0, +1, e]
464 }
465 if (lua_isstring(L, j)) // Stack usage [-0, +0, -]
466 {
467 char **v = va_arg(vl, char **);
468 size_t len;
469 char *temp = (char *) lua_tolstring(L, j, &len); // Stack usage [-0, +0, m]
470
471 len++; // Cater for the null at the end.
472 *v = malloc(len);
473 if (*v)
474 {
475 memcpy(*v, temp, len);
476 n++;
477 }
478 }
479 break;
480 }
481 case '!':
482 {
483 if (table)
484 {
485 q = _elua_push_name(L, q, i); // Stack usage [-0, +1, e]
486 }
487 if (lua_isboolean(L, j)) // Stack usage [-0, +0, -]
488 {
489 int *v = va_arg(vl, int *);
490 *v = lua_toboolean(L, j); // Stack usage [-0, +0, -]
491 n++;
492 }
493 break;
494 }
495 default:
496 {
497 get = EINA_FALSE;
498 break;
499 }
500 }
501
502 if (get)
503 {
504 if (table)
505 {
506 // If this is a table, then we pushed a value on the stack, pop it off.
507 lua_pop(L, 1); // Stack usage [-n, +0, -]
508 }
509 else
510 j++;
511 count++;
512 }
513 p = q;
514 }
515
516 free(f);
517 va_end(vl);
518 if (count > n)
519 n = 0;
520 else if (table)
521 n = 1;
522 return n;
523}
524
525static int
526_elua_ret(lua_State *L, char *params, ...) // Stack usage [-(2*n), +(2*n+1), em]
527{
528 va_list vl;
529 char *f = strdup(params);
530 char *p = f;
531 int n = 0;
532
533 if (!f) return -1;
534
535 lua_newtable(L); // Stack usage [-0, +1, m]
536 va_start(vl, params);
537
538 while (*p)
539 {
540 char *q;
541 Eina_Bool set = EINA_TRUE;
542
543 while (isspace((int)*p))
544 p++;
545 q = p + 1;
546 switch (*p)
547 {
548 case '%':
549 {
550 q = _elua_push_name(L, q, -1); // Stack usage [-0, +1, m]
551 lua_pushinteger(L, va_arg(vl, int)); // Stack usage [-0, +1, -]
552 break;
553 }
554 case '#':
555 {
556 q = _elua_push_name(L, q, -1); // Stack usage [-0, +1, m]
557 lua_pushnumber(L, va_arg(vl, double)); // Stack usage [-0, +1, -]
558 break;
559 }
560 case '$':
561 {
562 q = _elua_push_name(L, q, -1); // Stack usage [-0, +1, m]
563 lua_pushstring(L, va_arg(vl, char *)); // Stack usage [-0, +1, m]
564 break;
565 }
566 case '!':
567 {
568 q = _elua_push_name(L, q, -1); // Stack usage [-0, +1, m]
569 lua_pushboolean(L, va_arg(vl, int)); // Stack usage [-0, +1, -]
570 break;
571 }
572 default:
573 {
574 set = EINA_FALSE;
575 break;
576 }
577 }
578
579 if (set)
580 {
581 lua_settable(L, -3); // Stack usage [-2, +0, e]
582 n++;
583 }
584 p = q;
585 }
586
587 free(f);
588 va_end(vl);
589 return n;
590}
591
592static void
593_elua_color_fix(int *r, int *g, int *b, int *a)
594{
595 if (*r > *a) *r = *a;
596 if (*g > *a) *g = *a;
597 if (*b > *a) *b = *a;
598}
599
600//--------------------------------------------------------------------------//
601
602/**
603@page luaref
604@subsection edje Edje class.
605
606The lua edje class includes functions for dealing with the lua script only group
607as an edje object, basic functions, and functions to create other objects.
608
609In the following, "edje" is the actual global table used to access these edje functions.
610*/
611
612static int _elua_echo(lua_State *L);
613
614static int _elua_date(lua_State *L);
615static int _elua_looptime(lua_State *L);
616static int _elua_seconds(lua_State *L);
617
618static int _elua_objgeom(lua_State *L);
619static int _elua_objpos(lua_State *L);
620static int _elua_objsize(lua_State *L);
621
622static int _elua_emit(lua_State *L);
623static int _elua_messagesend(lua_State *L);
624
625static int _elua_animator(lua_State *L);
626static int _elua_timer(lua_State *L);
627static int _elua_transition(lua_State *L);
628
629static int _elua_color_class(lua_State *L);
630static int _elua_text_class(lua_State *L);
631
632static int _elua_edje(lua_State *L);
633static int _elua_image(lua_State *L);
634static int _elua_line(lua_State *L);
635static int _elua_map(lua_State *L);
636static int _elua_polygon(lua_State *L);
637static int _elua_rect(lua_State *L);
638static int _elua_text(lua_State *L);
639//static int _elua_textblock(lua_State *L); /* XXX: disabled until there are enough textblock functions implemented to make it actually useful
640
641static const char *_elua_edje_api = "edje";
642static const struct luaL_reg _elua_edje_funcs [] =
643{
644 // add an echo too to make it more shelly
645 {"echo", _elua_echo}, // test func - echo (i know we have print. test)
646 // FIXME: add logging functions here, probably to it's own domain, or even a script defined domain.
647
648 // system information (time, date blah blah)
649 {"date", _elua_date}, // get date in a table
650 {"looptime", _elua_looptime}, // get loop time
651 {"seconds", _elua_seconds}, // get seconds
652
653 // query edje - size, pos
654 {"geom", _elua_objgeom}, // get while edje object geometry in canvas
655 {"pos", _elua_objpos}, // get while edje object pos in canvas
656 {"size", _elua_objsize}, // get while edje object pos in canvas
657
658 // talk to application/caller
659 {"emit", _elua_emit}, // emit signal + src
660 {"messagesend", _elua_messagesend}, // send a structured message
661
662 // time based "callback" systems
663 {"animator", _elua_animator}, // add animator
664 {"timer", _elua_timer}, // add timer
665 {"transition", _elua_transition}, // add transition
666 // FIXME: need poller
667
668 // set and query color / text class
669 {"color_class", _elua_color_class},
670 {"text_class", _elua_text_class},
671
672 // create new objects
673 {"edje", _elua_edje},
674 {"image", _elua_image}, // defaults to a filled image.
675 {"line", _elua_line},
676 {"map", _elua_map},
677 {"polygon", _elua_polygon},
678 {"rect", _elua_rect},
679 {"text", _elua_text},
680// {"textblock", _elua_textblock}, /* XXX: disabled until there are enough textblock functions implemented to make it actually useful
681
682 // FIXME: add the new sound stuff.
683
684 {NULL, NULL} // end
685};
686
687/**
688@page luaref
689@subsubsection edje_echo edje:echo(text)
690
691Make lua a bit shelly. Prints a string to the console
692
693@param text The string to print.
694*/
695static int
696_elua_echo(lua_State *L) // Stack usage [-0, +0, v]
697{
698 const char *string = luaL_checkstring(L, 1); // Stack usage [-0, +0, v]
699 LD("%s\n", string);
700 return 0;
701}
702
703//-------------
704/**
705@page luaref
706@subsubsection edje_date edje:date()
707
708Retrieves the current time and date.
709
710Wraps gettimeofday(), as passed through localtime().
711
712@return A table with these fields:
713 - integer year: Year.
714 - integer month: Month of the year.
715 - integer day: Day of the month.
716 - integer yearday: Day of the year.
717 - integer weekday: Day of the week.
718 - integer hour: Hour of the day (24 hour format).
719 - integer min: Minute of the hour.
720 - number sec: Seconds as a number.
721
722*/
723static int
724_elua_date(lua_State *L) // Stack usage [-16, +17, em]
725{
726 static time_t last_tzset = 0;
727 struct timeval timev;
728 struct tm *tm;
729 time_t tt;
730
731 gettimeofday(&timev, NULL);
732 tt = (time_t)(timev.tv_sec);
733 if ((tt > (last_tzset + 1)) || (tt < (last_tzset - 1)))
734 {
735 last_tzset = tt;
736 tzset();
737 }
738 tm = localtime(&tt);
739 if (tm)
740 { // Stack usage [-16, +17, em]
741 _elua_ret(L, "%year %month %day %yearday %weekday %hour %min #sec",
742 (int)(tm->tm_year + 1900),
743 (int)(tm->tm_mon + 1),
744 (int)(tm->tm_mday),
745 (int)(tm->tm_yday),
746 (int)((tm->tm_wday + 6) % 7),
747 (int)(tm->tm_hour),
748 (int)(tm->tm_min),
749 (double)((double)tm->tm_sec + (((double)timev.tv_usec) / 1000000))
750 );
751
752
753 }
754 return 1;
755}
756
757/**
758@page luaref
759@subsubsection edje_looptime edje:looptime()
760
761Retrieves the time at which the last loop stopped waiting for timeouts or events.
762
763This gets the time that the main loop ceased waiting for timouts and/or events
764to come in or for signals or any other interrupt source. This should be
765considered a reference point for all time based activity that should calculate
766its timepoint from the return of edje:looptime(). Use this UNLESS you absolutely
767must get the current actual timepoint - then use edje:seconds(). Note that this
768time is meant to be used as relative to other times obtained on this run.
769
770Wraps ecore_loop_time_get().
771
772@returns A number of seconds.
773*/
774static int
775_elua_looptime(lua_State *L) // Stack usage [-0, +1, -]
776{
777 double t = ecore_loop_time_get();
778 lua_pushnumber(L, t); // Stack usage [-0, +1, -]
779 return 1;
780}
781
782/**
783@page luaref
784@subsubsection edje_seconds edje:seconds()
785
786Retrieves the current system time as a floating point value in seconds.
787
788This uses a monotonic clock and thus never goes back in time while machine is
789live (even if user changes time or timezone changes, however it may be reset
790whenever the machine is restarted).
791
792Wraps ecore_time_get().
793
794@returns A number of seconds.
795*/
796static int
797_elua_seconds(lua_State *L) // Stack usage [-0, +1, -]
798{
799 double t = ecore_time_get();
800 lua_pushnumber(L, t); // Stack usage [-0, +1, -]
801 return 1;
802}
803
804//-------------
805/**
806@page luaref
807@subsubsection edje_geom edje:geom()
808
809Retrieves the position and size of the edje object that this lua group is in.
810
811@returns A table with these fields:
812 - integer x: The edjes X position.
813 - integer y: The edjes Y position.
814 - integer w: The edjes width.
815 - integer h: The edjes height.
816*/
817static int
818_elua_objgeom(lua_State *L) // Stack usage [-10, +11, em]
819{
820 Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e]
821 _elua_ret(L, "%x %y %w %h", ed->x, ed->y, ed->w, ed->h); // Stack usage [-8, +9, em]
822 return 1;
823}
824
825/**
826@page luaref
827@subsubsection edje_pos edje:pos()
828
829
830Retrieves the position of the edje object that this lua group is in.
831
832@returns A table with these fields:
833 - integer x: The edjes X position.
834 - integer y: The edjes Y position.
835*/
836static int
837_elua_objpos(lua_State *L) // Stack usage [-6, +7, em]
838{
839 Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e]
840 _elua_ret(L, "%x %y", ed->x, ed->y); // Stack usage [-4, +5, em]
841 return 1;
842}
843
844/**
845@page luaref
846@subsubsection edje_size edje:size()
847
848
849Retrieves the size of the edje object that this lua group is in.
850
851@returns A table with these fields:
852 - integer w: The edjes width.
853 - integer h: The edjes height.
854*/
855static int
856_elua_objsize(lua_State *L) // Stack usage [-6, +7, em]
857{
858 Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e]
859 _elua_ret(L, "%w %h", ed->w, ed->h); // Stack usage [-4, +5, em]
860 return 1;
861}
862
863//-------------
864/**
865@page luaref
866@subsubsection edje_emit edje:emit(signal, source)
867
868Emit a signal.
869
870Wraps edje_object_signal_emit().
871
872@param signal The signal string to send.
873@param source The source string of the signal.
874
875NOTE: The source string will have a name and a colon prepended to in when it is
876delivered to things that are not this edje, like C and other edje groups.
877If this edje is a top level edje, then it will be the name of the group (I think).
878If this edje is swallowed into some other part, then it will be the name of the
879part:
880
881 group_name:source
882
883FIXME: I actually have no idea what happens if it's swallowed into another lua
884edje group.
885*/
886static int
887_elua_emit(lua_State *L) // Stack usage [-2, +2, ev]
888{
889 Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e]
890 const char *sig = luaL_checkstring(L, 1); // Stack usage [-0, +0, v]
891 const char *src = luaL_checkstring(L, 2); // Stack usage [-0, +0, v]
892 if ((!sig) || (!src)) return 0;
893 _edje_emit(ed, sig, src);
894 return 0;
895}
896
897/**
898@page luaref
899@subsubsection edje_message_send edje:messagesend(id, type, ...)
900
901Send a message to this edje, and all it's child objects.
902
903Wraps edje_object_message_send().
904
905@param id An identification integer for the message.
906@param type The type of message to send.
907@param ... Zero or more things to send as part of the message, depending on the type.
908
909The type can be one of:
910 - none: No msg.
911 - sig: The msg is two strings (signal, source), sent as a signal.
912 - str: The msg is a C string.
913 - int: The message is a C integer.
914 - float: The message is a C float.
915 - strset: The message is an array of C strings.
916 - intset: The message is an array of C integers.
917 - floatset: The message is an array of C floats.
918 - strint: The message is a C stnring and a C integer.
919 - strfloat: The message is a C string and a C float.
920 - strintset: The message is a C string and an array of C integers.
921 - strfloatset: The message is a G string and an array of C floats.
922
923For the array types, the lua caller passes a table.
924*/
925static int
926_elua_messagesend(lua_State *L) // Stack usage [-2, +2, ev] plus [-2, +2] for every element if it's an array message.
927{
928 Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e]
929 int id = luaL_checkinteger(L, 1); // Stack usage [-0, +0, v]
930 const char *type = luaL_checkstring(L, 2); // Stack usage [-0, +0, v]
931 if (!type) return 0;
932 if (!strcmp(type, "none"))
933 {
934 _edje_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_NONE, id, NULL);
935 }
936 else if (!strcmp(type, "sig"))
937 {
938 const char *sig = luaL_checkstring(L, 3); // Stack usage [-0, +0, v]
939 const char *src = luaL_checkstring(L, 4); // Stack usage [-0, +0, v]
940 _edje_emit(ed, sig, src);
941 }
942 else if (!strcmp(type, "str"))
943 {
944 Edje_Message_String *emsg;
945 const char *str = luaL_checkstring(L, 3); // Stack usage [-0, +0, v]
946 emsg = alloca(sizeof(Edje_Message_String));
947 emsg->str = (char *)str;
948 _edje_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_STRING, id, emsg);
949 }
950 else if (!strcmp(type, "int"))
951 {
952 Edje_Message_Int *emsg;
953 int val = luaL_checkinteger(L, 3); // Stack usage [-0, +0, v]
954 emsg = alloca(sizeof(Edje_Message_Int));
955 emsg->val = val;
956 _edje_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_INT, id, emsg);
957 }
958 else if (!strcmp(type, "float"))
959 {
960 Edje_Message_Float *emsg;
961 float val = luaL_checknumber(L, 3); // Stack usage [-0, +0, v]
962 emsg = alloca(sizeof(Edje_Message_Float));
963 emsg->val = val;
964 _edje_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_FLOAT, id, emsg);
965 }
966 else if (!strcmp(type, "strset"))
967 {
968 Edje_Message_String_Set *emsg;
969 int i, n;
970 const char *str;
971 luaL_checktype(L, 3, LUA_TTABLE); // Stack usage [-0, +0, v]
972 n = lua_objlen(L, 3); // Stack usage [-0, +0, -]
973 emsg = alloca(sizeof(Edje_Message_String_Set) + ((n - 1) * sizeof(char *)));
974 emsg->count = n;
975 for (i = 1; i <= n; i ++)
976 {
977 lua_pushinteger(L, i); // Stack usage [-0, +1, -]
978 lua_gettable(L, 3); // Stack usage [-1, +1, e]
979 str = lua_tostring(L, -1); // Stack usage [-0, +0, m]
980 lua_pop(L, 1); // Stack usage [-n, +0, -]
981 emsg->str[i - 1] = (char *)str;
982 }
983 _edje_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_STRING_SET, id, emsg);
984 }
985 else if (!strcmp(type, "intset"))
986 {
987 Edje_Message_Int_Set *emsg;
988 int i, n;
989 luaL_checktype(L, 3, LUA_TTABLE); // Stack usage [-0, +0, v]
990 n = lua_objlen(L, 3); // Stack usage [-0, +0, -]
991 emsg = alloca(sizeof(Edje_Message_Int_Set) + ((n - 1) * sizeof(int)));
992 emsg->count = n;
993 for (i = 1; i <= n; i ++)
994 {
995 lua_pushinteger(L, i); // Stack usage [-0, +1, -]
996 lua_gettable(L, 3); // Stack usage [-1, +1, e]
997 emsg->val[i - 1] = lua_tointeger(L, -1); // Stack usage [-0, +0, -]
998 lua_pop(L, 1); // Stack usage [-n, +0, -]
999 }
1000 _edje_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_INT_SET, id, emsg);
1001 }
1002 else if (!strcmp(type, "floatset"))
1003 {
1004 Edje_Message_Float_Set *emsg;
1005 int i, n;
1006 luaL_checktype(L, 3, LUA_TTABLE); // Stack usage [-0, +0, v]
1007 n = lua_objlen(L, 3); // Stack usage [-0, +0, -]
1008 emsg = alloca(sizeof(Edje_Message_Float_Set) + ((n - 1) * sizeof(double)));
1009 emsg->count = n;
1010 for (i = 1; i <= n; i ++)
1011 {
1012 lua_pushinteger(L, i); // Stack usage [-0, +1, -]
1013 lua_gettable(L, 3); // Stack usage [-1, +1, e]
1014 emsg->val[i - 1] = lua_tonumber(L, -1); // Stack usage [-0, +0, -]
1015 lua_pop(L, 1); // Stack usage [-n, +0, -]
1016 }
1017 _edje_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_FLOAT_SET, id, emsg);
1018 }
1019 else if (!strcmp(type, "strint"))
1020 {
1021 Edje_Message_String_Int *emsg;
1022 const char *str = luaL_checkstring(L, 3); // Stack usage [-0, +0, v]
1023 emsg = alloca(sizeof(Edje_Message_String_Int));
1024 emsg->str = (char *)str;
1025 emsg->val = luaL_checkinteger(L, 4); // Stack usage [-0, +0, v]
1026 _edje_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_STRING_INT, id, emsg);
1027 }
1028 else if (!strcmp(type, "strfloat"))
1029 {
1030 Edje_Message_String_Float *emsg;
1031 const char *str = luaL_checkstring(L, 3); // Stack usage [-0, +0, v]
1032 emsg = alloca(sizeof(Edje_Message_String_Float));
1033 emsg->str = (char *)str;
1034 emsg->val = luaL_checknumber(L, 4); // Stack usage [-0, +0, v]
1035 _edje_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_STRING_FLOAT, id, emsg);
1036 }
1037 else if (!strcmp(type, "strintset"))
1038 {
1039 Edje_Message_String_Int_Set *emsg;
1040 int i, n;
1041 const char *str = luaL_checkstring(L, 3); // Stack usage [-0, +0, v]
1042 if (!str) return 0;
1043 luaL_checktype(L, 4, LUA_TTABLE); // Stack usage [-0, +0, v]
1044 n = lua_objlen(L, 4); // Stack usage [-0, +0, -]
1045 emsg = alloca(sizeof(Edje_Message_String_Int_Set) + ((n - 1) * sizeof(int)));
1046 emsg->str = (char *)str;
1047 emsg->count = n;
1048 for (i = 1; i <= n; i ++)
1049 {
1050 lua_pushinteger(L, i); // Stack usage [-0, +1, -]
1051 lua_gettable(L, 4); // Stack usage [-1, +1, e]
1052 emsg->val[i - 1] = lua_tointeger(L, -1); // Stack usage [-0, +0, -]
1053 lua_pop(L, 1); // Stack usage [-n, +0, -]
1054 }
1055 _edje_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_STRING_INT_SET, id, emsg);
1056 }
1057 else if (!strcmp(type, "strfloatset"))
1058 {
1059 Edje_Message_String_Float_Set *emsg;
1060 int i, n;
1061 const char *str = luaL_checkstring(L, 3); // Stack usage [-0, +0, v]
1062 if (!str) return 0;
1063 luaL_checktype(L, 4, LUA_TTABLE); // Stack usage [-0, +0, v]
1064 n = lua_objlen(L, 4);
1065 emsg = alloca(sizeof(Edje_Message_String_Float_Set) + ((n - 1) * sizeof(double)));
1066 emsg->str = (char *)str;
1067 emsg->count = n;
1068 for (i = 1; i <= n; i ++)
1069 {
1070 lua_pushinteger(L, i); // Stack usage [-0, +1, -]
1071 lua_gettable(L, 4); // Stack usage [-1, +1, e]
1072 emsg->val[i - 1] = lua_tonumber(L, -1); // Stack usage [-0, +0, -]
1073 lua_pop(L, 1); // Stack usage [-n, +0, -]
1074 }
1075 _edje_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_STRING_FLOAT_SET, id, emsg);
1076 }
1077 return 0;
1078}
1079
1080//-------------
1081static Eina_Bool
1082_elua_animator_cb(void *data) // Stack usage [-2, +2, em]
1083{
1084 Edje_Lua_Animator *ela = data;
1085 lua_State *L;
1086 int ret = 0, err = 0;
1087
1088 if (!ela->obj.ed) return 0;
1089 L = ela->obj.ed->L;
1090 if (!L) return 0;
1091 /* This is not needed, pcalls don't longjmp(), that's why they are protected.
1092 if (setjmp(panic_jmp) == 1)
1093 {
1094 LE("Animator callback panic");
1095 _edje_lua2_error(L, err); // Stack usage [-0, +0, m]
1096 _elua_obj_free(L, (Edje_Lua_Obj *)ela);
1097 _elua_gc(L); // Stack usage [-0, +0, e]
1098 return 0;
1099 }
1100 */
1101 lua_rawgeti(L, LUA_REGISTRYINDEX, ela->fn_ref); // Stack usage [-0, +1, -]
1102 if ((err = lua_pcall(L, 0, 1, 0))) // Stack usage [-1, +1, -]
1103 {
1104 _edje_lua2_error(L, err); // Stack usage [-0, +0, m]
1105 _elua_obj_free(L, (Edje_Lua_Obj *)ela);
1106 _elua_gc(L); // Stack usage [-0, +0, e]
1107 return 0;
1108 }
1109 ret = lua_toboolean(L, -1); // Stack usage [-0, +0, -]
1110 lua_pop(L, 1); // Stack usage [-n, +0, -]
1111 if (ret == 0) _elua_obj_free(L, (Edje_Lua_Obj *)ela);
1112 _elua_gc(L); // Stack usage [-0, +0, e]
1113 return ret;
1114}
1115
1116static void
1117_elua_animator_free(void *obj) // Stack usage [-0, +0, -]
1118{
1119 Edje_Lua_Animator *ela = obj;
1120 lua_State *L;
1121 if (!ela->obj.ed) return;
1122 L = ela->obj.ed->L;
1123 luaL_unref(L, LUA_REGISTRYINDEX, ela->fn_ref); // Stack usage [-0, +0, -]
1124 ela->fn_ref = 0;
1125 ecore_animator_del(ela->animator);
1126 ela->animator = NULL;
1127}
1128
1129/**
1130@page luaref
1131@subsubsection edje_animator edje:animator(func)
1132
1133This function adds an animator and returns its handle on success and NULL on
1134failure. The function func will be called every frame tick. Note that setting
1135the frame tick is not available as a lua function, so has to be done from C.
1136The default tick is 1/30 second.
1137
1138When the animator func is called, it must return a value of either true or false.
1139If it returns true it will be called again at the next tick, or if it returns
1140false it will be deleted automatically making any references/handles for it
1141invalid.
1142
1143Wraps ecore_animator_add().
1144
1145@param func The function to call when the animator triggers.
1146
1147@returns A userdata that is an ecore animator.
1148*/
1149static int
1150_elua_animator(lua_State *L) // Stack usage [-8, +9, emv]
1151{
1152 Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e]
1153 Edje_Lua_Animator *ela;
1154
1155 luaL_checkany(L, 1); // Stack usage [-0, +0, v]
1156
1157 // FIXME: Allow lua to set a data to be sent back with the callback.
1158 ela = (Edje_Lua_Animator *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Animator), _elua_ecore_animator_meta);
1159 // Stack usage [-5, +6, m]
1160 ela->obj.free_func = _elua_animator_free;
1161 ela->animator = ecore_animator_add(_elua_animator_cb, ela);
1162 lua_pushvalue(L, 1); // Stack usage [-0, +1, -]
1163 ela->fn_ref = luaL_ref(L, LUA_REGISTRYINDEX); // Stack usage [-1, +0, m]
1164 _elua_gc(L); // Stack usage [-0, +0, e]
1165 return 1;
1166}
1167
1168static Eina_Bool
1169_elua_timer_cb(void *data) // Stack usage [-2, +2, em]
1170{
1171 Edje_Lua_Timer *elt = data;
1172 lua_State *L;
1173 int ret = 0, err = 0;
1174
1175 if (!elt->obj.ed) return 0;
1176 L = elt->obj.ed->L;
1177 if (!L) return 0;
1178 /* This is not needed, pcalls don't longjmp(), that's why they are protected.
1179 if (setjmp(panic_jmp) == 1)
1180 {
1181 LE("Timer callback panic");
1182 _edje_lua2_error(L, err); // Stack usage [-0, +0, m]
1183 _elua_obj_free(L, (Edje_Lua_Obj *)elt);
1184 _elua_gc(L); // Stack usage [-0, +0, e]
1185 return 0;
1186 }
1187 */
1188 lua_rawgeti(L, LUA_REGISTRYINDEX, elt->fn_ref); // Stack usage [-0, +1, -]
1189 if ((err = lua_pcall(L, 0, 1, 0))) // Stack usage [-1, +1, -]
1190 {
1191 _edje_lua2_error(L, err);
1192 _elua_obj_free(L, (Edje_Lua_Obj *)elt); // Stack usage [-0, +0, m]
1193 _elua_gc(L); // Stack usage [-0, +0, e]
1194 return 0;
1195 }
1196 ret = lua_toboolean(L, -1); // Stack usage [-0, +0, -]
1197 lua_pop(L, 1); // Stack usage [-n, +0, -]
1198 if (ret == 0) _elua_obj_free(L, (Edje_Lua_Obj *)elt);
1199 _elua_gc(L); // Stack usage [-0, +0, e]
1200 return ret;
1201}
1202
1203static void
1204_elua_timer_free(void *obj) // Stack usage [-0, +0, -]
1205{
1206 Edje_Lua_Timer *elt = obj;
1207 lua_State *L;
1208 if (!elt->obj.ed) return;
1209 L = elt->obj.ed->L;
1210 luaL_unref(L, LUA_REGISTRYINDEX, elt->fn_ref); // Stack usage [-0, +0, -]
1211 elt->fn_ref = 0;
1212 ecore_timer_del(elt->timer);
1213 elt->timer = NULL;
1214}
1215
1216/**
1217@page luaref
1218@subsubsection edje_timer edje:timer(tick, func)
1219
1220This function adds a timer and returns its handle on success and NULL on failure.
1221The function func will be called every tick seconds.
1222
1223When the timer func is called, it must return a value of either true or false.
1224If it returns true, it will be called again at the next tick, or if it returns
1225false it will be deleted automatically making any references/handles for it
1226invalid.
1227
1228Wraps ecore_timer_add().
1229
1230@param tick How often, in seconds, to call the function.
1231@param func The function to call when the timer triggers.
1232
1233@returns A userdata that is an ecore timer.
1234*/
1235static int
1236_elua_timer(lua_State *L) // Stack usage [-8, +9, emv]
1237{
1238 Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e]
1239 Edje_Lua_Timer *elt;
1240 double val;
1241
1242 val = luaL_checknumber(L, 1); // Stack usage [-0, +0, v]
1243 luaL_checkany(L, 2); // Stack usage [-0, +0, v]
1244
1245 elt = (Edje_Lua_Timer *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Timer), _elua_ecore_timer_meta);
1246 // Stack usage [-5, +6, m]
1247 elt->obj.free_func = _elua_timer_free;
1248 elt->timer = ecore_timer_add(val, _elua_timer_cb, elt);
1249 lua_pushvalue(L, 2); // Stack usage [-0, +1, -]
1250 elt->fn_ref = luaL_ref(L, LUA_REGISTRYINDEX); // Stack usage [-1, +0, m]
1251 _elua_gc(L); // Stack usage [-0, +0, e]
1252 return 1;
1253}
1254
1255static Eina_Bool
1256_elua_transition_cb(void *data) // Stack usage [-3, +3, em]
1257{
1258 Edje_Lua_Transition *elt = data;
1259 lua_State *L;
1260 int ret = 0, err = 0;
1261 double t;
1262
1263 if (!elt->obj.ed) return 0;
1264 L = elt->obj.ed->L;
1265 if (!L) return 0;
1266 t = (ecore_loop_time_get() - elt->start) / elt->transition;
1267 if (t > 1.0) t = 1.0;
1268 /* This is not needed, pcalls don't longjmp(), that's why they are protected.
1269 if (setjmp(panic_jmp) == 1)
1270 {
1271 LE("Transition callback panic");
1272 _edje_lua2_error(L, err); // Stack usage [-0, +0, m]
1273 _elua_obj_free(L, (Edje_Lua_Obj *)elt);
1274 _elua_gc(L); // Stack usage [-0, +0, e]
1275 return 0;
1276 }
1277 */
1278 lua_rawgeti(L, LUA_REGISTRYINDEX, elt->fn_ref); // Stack usage [-0, +1, -]
1279 lua_pushnumber(L, t); // Stack usage [-0, +1, -]
1280 if ((err = lua_pcall(L, 1, 1, 0))) // Stack usage [-2, +1, -]
1281 {
1282 _edje_lua2_error(L, err);
1283 _elua_obj_free(L, (Edje_Lua_Obj *)elt); // Stack usage [-0, +0, m]
1284 _elua_gc(L); // Stack usage [-0, +0, e]
1285 return 0;
1286 }
1287 ret = lua_toboolean(L, -1); // Stack usage [-0, +0, -]
1288 lua_pop(L, 1); // Stack usage [-n, +0, -]
1289 if (t >= 1.0) ret = 0;
1290 if (ret == 0) _elua_obj_free(L, (Edje_Lua_Obj *)elt);
1291 _elua_gc(L); // Stack usage [-0, +0, e]
1292 return ret;
1293}
1294
1295static void
1296_elua_transition_free(void *obj) // Stack usage [-0, +0, -]
1297{
1298 Edje_Lua_Transition *elt = obj;
1299 lua_State *L;
1300 if (!elt->obj.ed) return;
1301 L = elt->obj.ed->L;
1302 luaL_unref(L, LUA_REGISTRYINDEX, elt->fn_ref); // Stack usage [-0, +0, -]
1303 elt->fn_ref = 0;
1304 ecore_animator_del(elt->animator);
1305 elt->animator = NULL;
1306}
1307
1308/**
1309@page luaref
1310@subsubsection edje_transition edje:transition(div, func)
1311
1312Just like edje:animator(), except that the callback function gets called with an
1313argument. The argument is the amount of time since the transition was created,
1314divided by the div parameter.
1315
1316@param div A number to divide the time since creation by.
1317@param func The function to call when the transition triggers.
1318
1319@returns A userdata that is a transition (ecore animator, plus other info).
1320*/
1321static int
1322_elua_transition(lua_State *L) // Stack usage [-8, +9, emv]
1323{
1324 Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e]
1325 Edje_Lua_Transition *elt;
1326 double val;
1327
1328 val = luaL_checknumber(L, 1); // Stack usage [-0, +0, v]
1329 luaL_checkany(L, 2); // Stack usage [-0, +0, v]
1330
1331 elt = (Edje_Lua_Transition *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Transition), _elua_ecore_animator_meta);
1332 // Stack usage [-5, +6, m]
1333 elt->obj.free_func = _elua_transition_free;
1334 elt->animator = ecore_animator_add(_elua_transition_cb, elt);
1335 if (val < 0.0000001) val = 0.0000001;
1336 elt->transition = val;
1337 elt->start = ecore_loop_time_get();
1338 lua_pushvalue(L, 2); // Stack usage [-0, +1, -]
1339 elt->fn_ref = luaL_ref(L, LUA_REGISTRYINDEX); // Stack usage [-1, +0, m]
1340 _elua_gc(L); // Stack usage [-0, +0, e]
1341 return 1;
1342}
1343
1344//-------------
1345/**
1346@page luaref
1347@subsubsection edje_colour_class edje:color_class(class, r, g, b, a)
1348
1349Gets, (and optionally sets) the colours for a color class.
1350
1351Wraps edje_object_color_class_set().
1352
1353@param class A color class name.
1354@param r The new red value.
1355@param g The new green value.
1356@param b The new blue value.
1357@param a The new alpha value.
1358
1359Note that the r, g, b, and a arguments are optional, without them this function
1360just queries the current values. The r, g, b, and a arguments can be separate
1361values, or named fields in a table.
1362
1363@return A table with these fields:
1364 - integer r: The red value.
1365 - integer g: The green value.
1366 - integer b: The blue value.
1367 - integer a: The alpha value.
1368
1369@since 1.1.0
1370*/
1371static int
1372_elua_color_class(lua_State *L) // Stack usage [-(10|14), +(11|15), ?]
1373{
1374 Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e]
1375 Edje_Color_Class *c_class;
1376 const char *class = luaL_checkstring(L, 1); // Stack usage [-0, +0, v]
1377 int r, g, b, a;
1378
1379 if (!class) return 0;
1380
1381 if (_elua_scan_params(L, 2, "%r %g %b %a", &r, &g, &b, &a) > 0)
1382 { // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e]
1383 _elua_color_fix(&r, &g, &b, &a);
1384 // This is the way that embryo does it -
1385 //edje_object_color_class_set(ed->obj, class, r, g, b, a, r, g, b, a, r, g, b, a);
1386 // But that deals with object scope, which is currently useless in lua,
1387 // since we have no objects that can use color_class yet.
1388 // So we do it at global scope instead.
1389 // LATER - Should do both?
1390 edje_color_class_set(class, r, g, b, a, r, g, b, a, r, g, b, a);
1391 }
1392
1393 c_class = _edje_color_class_find(ed, class);
1394 if (!c_class) return 0;
1395
1396 _elua_ret(L, "%r %g %b %a", c_class->r, c_class->g, c_class->b, c_class->a);
1397 // Stack usage [-8, +9, em]
1398 return 1;
1399}
1400
1401/**
1402@page luaref
1403@subsubsection edje_text_class edje:text_class(class, font, size)
1404
1405Gets, (and optionally sets) the details for a text class.
1406
1407Wraps edje_object_text_class_set().
1408
1409@param class A text class name.
1410@param font The new font name.
1411@param size The new font size.
1412
1413Note that the font and size arguments are optional, without them this function
1414just queries the current values. The font and size arguments can be separate
1415values, or named fields in a table. The font name can refer to a font in the
1416edje file, or an external font.
1417
1418@return A table with these fields:
1419 - string font: The font name.
1420 - integer size: The font size.
1421
1422@since 1.1.0
1423*/
1424static int
1425_elua_text_class(lua_State *L) // Stack usage [-(6|8), +(7|9), emv]
1426{
1427 Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e]
1428 Edje_Text_Class *t_class;
1429 const char *class = luaL_checkstring(L, 1); // Stack usage [-0, +0, v]
1430 char *font = NULL;
1431 Evas_Font_Size size = 0;
1432
1433 if (!class) return 0;
1434
1435 // Just like color_class above, this does things differently from embryo,
1436 // for the same reason.
1437 if (_elua_scan_params(L, 2, "$font %size", &font, &size) > 0)
1438 // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e]
1439 edje_text_class_set(class, font, size);
1440
1441 t_class = _edje_text_class_find(ed, class);
1442 if (!t_class) return 0;
1443
1444 _elua_ret(L, "$font %size", t_class->font, t_class->size);
1445 // Stack usage [-4, +5, em]
1446 return 1;
1447}
1448
1449//-------------
1450static void
1451_elua_evas_obj_free(void *obj)
1452{
1453 Edje_Lua_Evas_Object *elo = obj;
1454
1455 if (!elo->obj.ed) return;
1456 evas_object_del(elo->evas_obj);
1457 elo->evas_obj = NULL;
1458}
1459
1460// Stack usage [-7, +8, em]
1461#define _ELUA_PLANT_EVAS_OBJECT(type, meta, free) \
1462 Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); \
1463 type *elo; \
1464 elo = (type *)_elua_obj_new(L, ed, sizeof(type), meta); \
1465 elo->obj.free_func = free;
1466// Stack usage [-2, +2, e]
1467// Stack usage [-5, +6, m]
1468
1469static void
1470_elua_polish_evas_object(Edje *ed, Edje_Lua_Evas_Object *elo)
1471{
1472 evas_object_smart_member_add(elo->evas_obj, ed->obj);
1473 evas_object_clip_set(elo->evas_obj, ed->base.clipper);
1474 evas_object_move(elo->evas_obj, ed->x, ed->y);
1475 evas_object_resize(elo->evas_obj, 0, 0);
1476 evas_object_data_set(elo->evas_obj, ELO, elo);
1477}
1478
1479/**
1480@page luaref
1481@subsubsection edje_edje edje:edje()
1482
1483Create an edje object, and add it to the edje.
1484
1485Wraps edje_object_add().
1486
1487@returns A userdata that is an edje object.
1488
1489@since 1.1.0
1490*/
1491static int
1492_elua_edje(lua_State *L) // Stack usage [-7, +8, em]
1493{
1494 _ELUA_PLANT_EVAS_OBJECT(Edje_Lua_Evas_Object, _elua_evas_edje_meta, _elua_evas_obj_free)
1495 // Stack usage [-7, +8, em]
1496 elo->evas_obj = edje_object_add(evas_object_evas_get(ed->obj));
1497 _edje_subobj_register(ed, elo->evas_obj);
1498 _elua_polish_evas_object(ed, elo);
1499 return 1;
1500}
1501
1502/**
1503@page luaref
1504@subsubsection edje_image edje:image()
1505
1506Create an evas image, and add it to the edje.
1507
1508Wraps evas_object_image_add().
1509
1510@returns A userdata that is an evas image.
1511
1512@since 1.1.0
1513*/
1514static int
1515_elua_image(lua_State *L) // Stack usage [-7, +8, em]
1516{
1517 _ELUA_PLANT_EVAS_OBJECT(Edje_Lua_Evas_Object, _elua_evas_image_meta, _elua_evas_obj_free)
1518 // Stack usage [-7, +8, em]
1519 elo->evas_obj = evas_object_image_filled_add(evas_object_evas_get(ed->obj));
1520 _elua_polish_evas_object(ed, elo);
1521 return 1;
1522}
1523
1524/**
1525@page luaref
1526@subsubsection edje_line edje:line()
1527
1528Create an evas line, and add it to the edje.
1529
1530Wraps evas_object_line_add().
1531
1532@returns A userdata that is an evas line.
1533
1534@since 1.1.0
1535*/
1536static int
1537_elua_line(lua_State *L) // Stack usage [-7, +8, em]
1538{
1539 _ELUA_PLANT_EVAS_OBJECT(Edje_Lua_Evas_Object, _elua_evas_line_meta, _elua_evas_obj_free)
1540 // Stack usage [-7, +8, em]
1541 elo->evas_obj = evas_object_line_add(evas_object_evas_get(ed->obj));
1542 _elua_polish_evas_object(ed, elo);
1543 return 1;
1544}
1545
1546static void
1547_elua_map_free(void *obj)
1548{
1549 Edje_Lua_Map *elm = obj;
1550 if (!elm->obj.ed) return;
1551 evas_map_free(elm->map);
1552 elm->map = NULL;
1553}
1554
1555/**
1556@page luaref
1557@subsubsection edje_map edje:map()
1558
1559Create an evas map.
1560
1561Wraps evas_map_new().
1562
1563@returns A userdata that is an evas map.
1564
1565@since 1.1.0
1566*/
1567static int
1568_elua_map(lua_State *L) // Stack usage [-7, +8, emv]
1569{
1570 _ELUA_PLANT_EVAS_OBJECT(Edje_Lua_Map, _elua_evas_map_meta, _elua_map_free)
1571 // Stack usage [-7, +8, em]
1572 elo->map = evas_map_new(luaL_checkinteger(L, 1)); // Stack usage [-0, +0, v]
1573 return 1;
1574}
1575
1576/**
1577@page luaref
1578@subsubsection edje_polygon edje:polygon()
1579
1580Create an evas polygon, and add it to the edje.
1581
1582Wraps evas_object_polygon_add().
1583
1584@returns A userdata that is an evas polygon.
1585
1586@since 1.1.0
1587*/
1588static int
1589_elua_polygon(lua_State *L) // Stack usage [-7, +8, em]
1590{
1591 _ELUA_PLANT_EVAS_OBJECT(Edje_Lua_Evas_Object, _elua_evas_polygon_meta, _elua_evas_obj_free)
1592 // Stack usage [-7, +8, em]
1593 elo->evas_obj = evas_object_polygon_add(evas_object_evas_get(ed->obj));
1594 _elua_polish_evas_object(ed, elo);
1595 return 1;
1596}
1597
1598/**
1599@page luaref
1600@subsubsection edje_rect edje:rect()
1601
1602Create an evas rectangle, and add it to the edje.
1603
1604Wraps evas_object_rectangle_add().
1605
1606@returns A userdata that is an evas rectangle.
1607*/
1608static int
1609_elua_rect(lua_State *L) // Stack usage [-7, +8, em]
1610{
1611 _ELUA_PLANT_EVAS_OBJECT(Edje_Lua_Evas_Object, _elua_evas_meta, _elua_evas_obj_free)
1612 // Stack usage [-7, +8, em]
1613 elo->evas_obj = evas_object_rectangle_add(evas_object_evas_get(ed->obj));
1614 _elua_polish_evas_object(ed, elo);
1615 return 1;
1616}
1617
1618/**
1619@page luaref
1620@subsubsection edje_text edje:text()
1621
1622Create an evas text object, and add it to the edje.
1623
1624Wraps evas_object_text_add().
1625
1626@returns A userdata that is an evas text object.
1627
1628@since 1.1.0
1629*/
1630static int
1631_elua_text(lua_State *L) // Stack usage [-7, +8, em]
1632{
1633 _ELUA_PLANT_EVAS_OBJECT(Edje_Lua_Evas_Object, _elua_evas_text_meta, _elua_evas_obj_free)
1634 // Stack usage [-7, +8, em]
1635 elo->evas_obj = evas_object_text_add(evas_object_evas_get(ed->obj));
1636 _elua_polish_evas_object(ed, elo);
1637 return 1;
1638}
1639
1640/* XXX: disabled until there are enough textblock functions implemented to make it actually useful
1641_elua_textblock(lua_State *L) // Stack usage [-7, +8, em]
1642{
1643 _ELUA_PLANT_EVAS_OBJECT(Edje_Lua_Evas_Object, _elua_evas_textblock_meta, _elua_evas_obj_free)
1644 // Stack usage [-7, +8, em]
1645 elo->evas_obj = evas_object_textblock_add(evas_object_evas_get(ed->obj));
1646 _elua_polish_evas_object(ed, elo);
1647 return 1;
1648}
1649*/
1650
1651//-------------
1652//-------------
1653
1654/**
1655@page luaref
1656@subsection evas Evas class.
1657
1658The lua evas class includes functions for dealing with evas objects. The evas
1659objects must have been previously created by lua using one of the lua ezas
1660object creation functions from the lua edje class.
1661
1662In the following, "evas_object" is a place holder for any lua variable that
1663holds a reference to an evas object.
1664*/
1665
1666static int _elua_obj_del(lua_State *L);
1667
1668static int _elua_hide(lua_State *L);
1669static int _elua_show(lua_State *L);
1670static int _elua_visible(lua_State *L);
1671
1672static int _elua_above(lua_State *L);
1673static int _elua_below(lua_State *L);
1674static int _elua_bottom(lua_State *L);
1675static int _elua_lower(lua_State *L);
1676static int _elua_raise(lua_State *L);
1677static int _elua_top(lua_State *L);
1678
1679static int _elua_geom(lua_State *L);
1680static int _elua_move(lua_State *L);
1681static int _elua_pos(lua_State *L);
1682static int _elua_resize(lua_State *L);
1683static int _elua_size(lua_State *L);
1684
1685static int _elua_clip(lua_State *L);
1686static int _elua_clipees(lua_State *L);
1687static int _elua_unclip(lua_State *L);
1688
1689static int _elua_type(lua_State *L);
1690
1691static int _elua_pass(lua_State *L);
1692static int _elua_precise(lua_State *L);
1693static int _elua_repeat(lua_State *L);
1694
1695static int _elua_color(lua_State *L);
1696
1697static int _elua_obj_map(lua_State *L);
1698static int _elua_obj_map_enable(lua_State *L);
1699static int _elua_obj_map_source(lua_State *L);
1700
1701static const char *_elua_evas_api = "evas";
1702static const struct luaL_reg _elua_evas_funcs [] =
1703{
1704 {"del", _elua_obj_del}, // generic del any object created for edje (evas objects, timers, animators, transitions... everything)
1705
1706 {"hide", _elua_hide}, // hide, return current visibility
1707 {"show", _elua_show}, // show, return current visibility
1708 {"visible", _elua_visible}, // get object visibility
1709
1710 {"above", _elua_above}, // get object above or stack obj above given obj
1711 {"below", _elua_below}, // get object below or stack obj below given obj
1712 {"bottom", _elua_bottom}, // get bottom
1713 {"lower", _elua_lower}, // lower to bottom
1714 {"raise", _elua_raise}, // raise to top
1715 {"top", _elua_top}, // get top
1716
1717 {"geom", _elua_geom}, // move and resize and return current geometry
1718 {"move", _elua_move}, // move, return current position
1719 {"pos", _elua_pos}, // move, return current position
1720 {"resize", _elua_resize}, // resize, return current size
1721 {"size", _elua_size}, // resize, return current size
1722
1723 {"clip", _elua_clip}, // set clip obj, return clip object
1724 {"clipees", _elua_clipees}, // get clip children
1725 {"unclip", _elua_unclip}, // clear clip obj
1726
1727 {"type", _elua_type}, // get object type
1728
1729 {"pass", _elua_pass}, // set pass events, get pass events
1730 {"precise", _elua_precise}, // set precise inside flag, get precise
1731 {"repeat", _elua_repeat}, // set repeat events, get repeat events
1732
1733 {"color", _elua_color}, // set color, return color
1734// {"color_class", _elua_object_color_class}, // get or set object color class
1735
1736 // FIXME: set callbacks (mouse down, up, blah blah blah)
1737 //
1738 // FIXME: set scale (explicit value)
1739 // FIXME: need to set auto-scale (same as scale: 1)
1740
1741 // FIXME: later - set render op, anti-alias, pointer mode (autograb, nograb)
1742
1743 // map api here
1744 {"map", _elua_obj_map},
1745 {"map_enable", _elua_obj_map_enable},
1746 {"map_source", _elua_obj_map_source},
1747
1748 {NULL, NULL} // end
1749};
1750
1751//-------------
1752/**
1753@page luaref
1754@subsubsection evas_hide evas_object:hide()
1755
1756Hides the object.
1757
1758Wraps evas_object_hide().
1759
1760@returns A boolean representing the current visibility.
1761*/
1762static int
1763_elua_hide(lua_State *L) // Stack usage [-0, +1, -]
1764{
1765 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
1766 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
1767 if (!_elua_isa(obj, _elua_evas_meta)) return 0;
1768 evas_object_hide(elo->evas_obj);
1769 lua_pushboolean(L, evas_object_visible_get(elo->evas_obj)); // Stack usage [-0, +1, -]
1770 return 1;
1771}
1772
1773/**
1774@page luaref
1775@subsubsection evas_show evas_object:show()
1776
1777Shows the object.
1778
1779Wraps evas_object_show().
1780
1781@returns A boolean representing the current visibility.
1782*/
1783static int
1784_elua_show(lua_State *L) // Stack usage [-0, +1, -]
1785{
1786 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
1787 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
1788 if (!_elua_isa(obj, _elua_evas_meta)) return 0;
1789 evas_object_show(elo->evas_obj);
1790 lua_pushboolean(L, evas_object_visible_get(elo->evas_obj)); // Stack usage [-0, +1, -]
1791 return 1;
1792}
1793
1794/**
1795@page luaref
1796@subsubsection evas_visible evas_object:visible(visibility)
1797
1798Gets (and optionally sets) this objects visibility.
1799
1800Wraps evas_object_hide() or evas_object_show().
1801
1802@param visibility The new visibility you want to change it to.
1803
1804Note that the argument is optional, without it this function just queries the
1805current value.
1806
1807@returns A boolean representing the current visibility.
1808*/
1809static int
1810_elua_visible(lua_State *L) // Stack usage [-0, +1, -]
1811{
1812 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
1813 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
1814 int n;
1815 if (!_elua_isa(obj, _elua_evas_meta)) return 0;
1816 n = lua_gettop(L); // Stack usage [-0, +0, -]
1817 if (n == 2)
1818 {
1819 if (lua_isboolean(L, 2)) // Stack usage [-0, +0, -]
1820 {
1821 if (lua_toboolean(L, 2)) evas_object_show(elo->evas_obj);
1822 // Stack usage [-0, +0, -]
1823 else evas_object_hide(elo->evas_obj);
1824 }
1825 }
1826 lua_pushboolean(L, evas_object_visible_get(elo->evas_obj)); // Stack usage [-0, +1, -]
1827 return 1;
1828}
1829
1830//-------------
1831/**
1832@page luaref
1833@subsubsection evas_above evas_object:above()
1834
1835Figure out what, if anything, is above us.
1836
1837Wraps evas_object_above_get().
1838
1839Note that it may not return any value.
1840
1841@returns A reference to the object above this one.
1842*/
1843static int
1844_elua_above(lua_State *L) // Stack usage [-3, +4, -]
1845{
1846 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
1847 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
1848 Edje_Lua_Evas_Object *elo2;
1849 Evas_Object *o;
1850 if (!_elua_isa(obj, _elua_evas_meta)) return 0;
1851 if (!(o = evas_object_above_get(elo->evas_obj))) return 0;
1852 if (!(elo2 = evas_object_data_get(o, ELO))) return 0;
1853 _elua_ref_get(L, elo2); // Stack usage [-3, +4, -]
1854 return 1;
1855}
1856
1857/**
1858@page luaref
1859@subsubsection evas_below evas_object:below()
1860
1861Figure out what, if anything, is below us.
1862
1863Wraps evas_object_below_get().
1864
1865Note that it may not return any value.
1866
1867@returns A reference to the object below this one.
1868*/
1869static int
1870_elua_below(lua_State *L) // Stack usage [-3, +4, -]
1871{
1872 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
1873 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
1874 Edje_Lua_Evas_Object *elo2;
1875 Evas_Object *o;
1876 if (!_elua_isa(obj, _elua_evas_meta)) return 0;
1877 if (!(o = evas_object_below_get(elo->evas_obj))) return 0;
1878 if (!(elo2 = evas_object_data_get(o, ELO))) return 0;
1879 _elua_ref_get(L, elo2); // Stack usage [-3, +4, -]
1880 return 1;
1881}
1882
1883/**
1884@page luaref
1885@subsubsection evas_bottom evas_object:bottom()
1886
1887Figure out what, if anything, is waaaay below us.
1888
1889Note that it may not return any value.
1890
1891@returns A reference to the object at the bottom.
1892*/
1893static int
1894_elua_bottom(lua_State *L) // Stack usage [-(0|3), +(0|4), -]
1895{
1896 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
1897 Edje_Lua_Evas_Object *elo2;
1898 Evas_Object *o;
1899 Eina_List *list, *l;
1900 if (!_elua_isa(obj, _elua_evas_meta)) return 0;
1901 if (!(list = (Eina_List *)evas_object_smart_members_get(obj->ed->obj))) return 0;
1902 for (l = list; l; l = l->next)
1903 {
1904 o = l->data;
1905 if ((elo2 = evas_object_data_get(o, ELO)))
1906 {
1907 _elua_ref_get(L, elo2); // Stack usage [-3, +4, -]
1908 return 1;
1909 }
1910 }
1911 return 0;
1912}
1913
1914/**
1915@page luaref
1916@subsubsection evas_lower evas_object:lower()
1917
1918Lower this object to the bottom.
1919
1920Wraps evas_object_lower().
1921*/
1922static int
1923_elua_lower(lua_State *L) // Stack usage [-0, +0, -]
1924{
1925 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
1926 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
1927 if (!_elua_isa(obj, _elua_evas_meta)) return 0;
1928 evas_object_lower(elo->evas_obj);
1929 return 0;
1930}
1931
1932/**
1933@page luaref
1934@subsubsection evas_raise evas_object:raise()
1935
1936Raise this object to the top.
1937
1938Wraps evas_object_raise().
1939*/
1940static int
1941_elua_raise(lua_State *L) // Stack usage [-0, +0, -]
1942{
1943 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
1944 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
1945 if (!_elua_isa(obj, _elua_evas_meta)) return 0;
1946 evas_object_raise(elo->evas_obj);
1947 return 0;
1948}
1949
1950/**
1951@page luaref
1952@subsubsection evas_top evas_object:top()
1953
1954Figure out what, if anything, is waaaay above us.
1955
1956Note that it may not return any value.
1957
1958@returns A reference to the object at the top.
1959*/
1960static int
1961_elua_top(lua_State *L) // Stack usage [-(0|3), +(0|4), -]
1962{
1963 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-(0, +0, -]
1964 Edje_Lua_Evas_Object *elo2;
1965 Evas_Object *o;
1966 Eina_List *list, *l;
1967 if (!_elua_isa(obj, _elua_evas_meta)) return 0;
1968 if (!(list = (Eina_List *)evas_object_smart_members_get(obj->ed->obj))) return 0;
1969 if (!list) return 0;
1970 for (l = eina_list_last(list); l; l = l->prev)
1971 {
1972 o = l->data;
1973 if ((elo2 = evas_object_data_get(o, ELO)))
1974 {
1975 _elua_ref_get(L, elo2); // Stack usage [-3, +4, -]
1976 return 1;
1977 }
1978 }
1979 return 0;
1980}
1981
1982//-------------
1983/**
1984@page luaref
1985@subsubsection evas_geom evas_object:geom(x, y, w, h)
1986
1987Gets (and optionally sets) this objects geometry.
1988
1989Wraps evas_object_move() and evas_object_resize.
1990
1991@param x The new X coordinate.
1992@param y The new Y coordinate.
1993@param w The new width.
1994@param h The new height.
1995
1996Note that the arguments are optional, without them this function just queries
1997the current values. The arguments can be separate values, or named fields in a
1998table.
1999
2000@return A table with these fields:
2001 - integer x: X coordinate.
2002 - integer x: Y coordinate.
2003 - integer w: Width.
2004 - integer w: Height.
2005*/
2006static int
2007_elua_geom(lua_State *L) // Stack usage [-(8|12), +(9|13), em]
2008{
2009 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
2010 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
2011 Evas_Coord ox, oy, ow, oh;
2012 int x, y, w, h;
2013
2014 if (!_elua_isa(obj, _elua_evas_meta)) return 0;
2015 evas_object_geometry_get(elo->evas_obj, &ox, &oy, &ow, &oh);
2016 if (_elua_scan_params(L, 2, "%x %y %w %h", &x, &y, &w, &h) > 0)
2017 { // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e]
2018 if ((x != (ox - obj->ed->x)) || (y != (oy - obj->ed->y)))
2019 {
2020 evas_object_move(elo->evas_obj,
2021 obj->ed->x + x,
2022 obj->ed->y + y);
2023 }
2024 if ((w != ow) || (h != oh))
2025 {
2026 evas_object_resize(elo->evas_obj, w, h);
2027 }
2028 evas_object_geometry_get(elo->evas_obj, &ox, &oy, &ow, &oh);
2029 elo->x = ox - obj->ed->x;
2030 elo->y = oy - obj->ed->y;
2031 }
2032 _elua_ret(L, "%x %y %w %h", elo->x, elo->y, ow, oh);
2033 // Stack usage [-8, +9, em]
2034 return 1;
2035}
2036
2037/**
2038@page luaref
2039@subsubsection evas_move evas_object:move(x, y)
2040
2041Gets (and optionally sets) this objects position.
2042
2043Wraps evas_object_move().
2044
2045@param x The new X coordinate.
2046@param y The new Y coordinate.
2047
2048Note that the arguments are optional, without them this function just queries
2049the current values. The arguments can be separate values, or named fields in a
2050table.
2051
2052@return A table with these fields:
2053 - integer x: X coordinate.
2054 - integer x: Y coordinate.
2055*/
2056static int
2057_elua_move(lua_State *L) // Stack usage [-(4|6), +(5|7), em]
2058{
2059 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
2060 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
2061 Evas_Coord ox, oy;
2062 int x, y;
2063
2064 if (!_elua_isa(obj, _elua_evas_meta)) return 0;
2065 evas_object_geometry_get(elo->evas_obj, &ox, &oy, NULL, NULL);
2066 if (_elua_scan_params(L, 2, "%x %y", &x, &y) > 0)
2067 { // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e]
2068 if ((x != (ox - obj->ed->x)) || (y != (oy - obj->ed->y)))
2069 {
2070 evas_object_move(elo->evas_obj,
2071 obj->ed->x + x,
2072 obj->ed->y + y);
2073 evas_object_geometry_get(elo->evas_obj, &ox, &oy, NULL, NULL);
2074 }
2075 elo->x = ox - obj->ed->x;
2076 elo->y = oy - obj->ed->y;
2077 }
2078 _elua_ret(L, "%x %y", elo->x, elo->y);
2079 // Stack usage [-4, +5, em]
2080 return 1;
2081}
2082
2083/**
2084@page luaref
2085@subsubsection evas_pos evas_object:pos(x, y)
2086
2087An alias for evas_object:move().
2088*/
2089static int
2090_elua_pos(lua_State *L) // Stack usage [-(4|6), +(5|7), em]
2091{
2092 return _elua_move(L);
2093}
2094
2095/**
2096@page luaref
2097@subsubsection evas_resize evas_object:resize(w, h)
2098
2099Gets (and optionally sets) this objects size.
2100
2101Wraps evas_object_resize().
2102
2103@param w The new width.
2104@param h The new height.
2105
2106Note that the arguments are optional, without them this function just queries
2107the current values. The arguments can be separate values, or named fields in a
2108table.
2109
2110@return A table with these fields:
2111 - integer w: Width.
2112 - integer w: Height.
2113*/
2114static int
2115_elua_resize(lua_State *L) // Stack usage [-(4|6), +(5|7), em]
2116{
2117 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
2118 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
2119 Evas_Coord ow, oh;
2120 int w, h;
2121
2122 if (!_elua_isa(obj, _elua_evas_meta)) return 0;
2123 evas_object_geometry_get(elo->evas_obj, NULL, NULL, &ow, &oh);
2124 if (_elua_scan_params(L, 2, "%w %h", &w, &h) > 0)
2125 { // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e]
2126 if ((w != ow) || (h != oh))
2127 {
2128 evas_object_resize(elo->evas_obj, w, h);
2129 evas_object_geometry_get(elo->evas_obj, NULL, NULL, &ow, &oh);
2130 }
2131 }
2132 _elua_ret(L, "%w %h", ow, oh);
2133 // Stack usage [-4, +5, em]
2134 return 1;
2135}
2136
2137/**
2138@page luaref
2139@subsubsection evas_size evas_object:size()
2140
2141An alias for evas_object:resize().
2142*/
2143static int
2144_elua_size(lua_State *L) // Stack usage [-(4|6), +(5|7), em]
2145{
2146 return _elua_resize(L);
2147}
2148
2149//-------------
2150/**
2151@page luaref
2152@subsubsection evas_clip evas_object:clip(evas_object2)
2153
2154Get (and optionally set) the object that clips this object.
2155
2156Note that the argument is optional, without it this function just queries the
2157current value.
2158
2159Wraps evas_object_clip_set().
2160
2161@param evas_object2 A reference to the object to clip this object with.
2162
2163@returns A reference to the object clipping this object, if any.
2164*/
2165static int
2166_elua_clip(lua_State *L) // Stack usage [-3, +4, -]
2167{
2168 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
2169 Edje_Lua_Evas_Object *elo2, *elo = (Edje_Lua_Evas_Object *)obj;
2170 Evas_Object *o;
2171 int n;
2172 if (!_elua_isa(obj, _elua_evas_meta)) return 0;
2173 n = lua_gettop(L); // Stack usage [-0, +0, -]
2174 if (n == 2)
2175 {
2176 Edje_Lua_Obj *obj2 = (Edje_Lua_Obj *)lua_touserdata(L, 2); // Stack usage [-0, +0, -]
2177 elo2 = (Edje_Lua_Evas_Object *)obj2;
2178 if (!_elua_isa(obj2, _elua_evas_meta)) return 0;
2179 evas_object_clip_set(elo->evas_obj, elo2->evas_obj);
2180 }
2181 o = evas_object_clip_get(elo->evas_obj);
2182 if (!o) return 0;
2183 if (!(elo2 = evas_object_data_get(o, ELO))) return 0;
2184 _elua_ref_get(L, elo2); // Stack usage [-3, +4, -]
2185 return 1;
2186}
2187
2188/**
2189@page luaref
2190@subsubsection evas_clipees evas_object:clipees()
2191
2192Gets the list of objects this objects clips.
2193
2194Wraps evas_object_clipees_get().
2195
2196@return A table, that holds all the objects this clips, if any,
2197 otherwise an empty table.
2198*/
2199static int
2200_elua_clipees(lua_State *L) // Stack usage [-0, +1, me] plus [-5, +5] for each clipee.
2201{
2202 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
2203 Edje_Lua_Evas_Object *elo2, *elo = (Edje_Lua_Evas_Object *)obj;
2204 Eina_List *list, *l;
2205 Evas_Object *o;
2206 int n = 0;
2207 if (!_elua_isa(obj, _elua_evas_meta)) return 0;
2208 list = (Eina_List *)evas_object_clipees_get(elo->evas_obj);
2209 lua_newtable(L); // Stack usage [-0, +1, m]
2210 EINA_LIST_FOREACH(list, l, o)
2211 {
2212 if (!(elo2 = evas_object_data_get(o, ELO))) continue;
2213 lua_pushinteger(L, n + 1); // Stack usage [-0, +1, -]
2214 _elua_ref_get(L, elo2); // Stack usage [-3, +4, -]
2215 lua_settable(L, -3); // Stack usage [-2, +0, e]
2216 n++;
2217 }
2218 return 1;
2219}
2220
2221/**
2222@page luaref
2223@subsubsection evas_unclip evas_object:unclip()
2224
2225Remove any clipping on this object.
2226
2227Wraps evas_object_clip_unset().
2228*/
2229static int
2230_elua_unclip(lua_State *L) // Stack usage [-0, +0, -]
2231{
2232 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
2233 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
2234 if (!_elua_isa(obj, _elua_evas_meta)) return 0;
2235 evas_object_clip_unset(elo->evas_obj);
2236 return 0;
2237}
2238
2239//-------------
2240/**
2241@page luaref
2242@subsubsection evas_type evas_object:type()
2243
2244Get the type of this object. See the documentation of the evas_object_type_get()
2245C function for details.
2246
2247Wraps evas_object_type_get().
2248
2249@return A string with this objects type in it.
2250*/
2251static int
2252_elua_type(lua_State *L) // Stack usage [-0, +1, m]
2253{
2254 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
2255 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
2256 const char *t;
2257 if (!_elua_isa(obj, _elua_evas_meta)) return 0;
2258 t = evas_object_type_get(elo->evas_obj);
2259 if (!t) return 0;
2260 lua_pushstring(L, t); // Stack usage [-0, +1, m]
2261 return 1;
2262}
2263
2264//-------------
2265/**
2266@page luaref
2267@subsubsection evas_pass evas_object:pass(pass)
2268
2269Get (and optionally set) whether this object ignores events, passing them to the
2270next object underneath it.
2271
2272Wraps evas_object_pass_events_set().
2273
2274@param pass A boolean saying if this object passes events.
2275
2276Note that the argument is optional, without it this function just queries the
2277current value.
2278
2279@return A boolean saying if this object passes events.
2280*/
2281static int
2282_elua_pass(lua_State *L) // Stack usage [-0, +1, -]
2283{
2284 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
2285 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
2286 int n;
2287 if (!_elua_isa(obj, _elua_evas_meta)) return 0;
2288 n = lua_gettop(L); // Stack usage [-0, +0, -]
2289 if (n == 2)
2290 {
2291 if (lua_isboolean(L, 2)) // Stack usage [-0, +0, -]
2292 {
2293 evas_object_pass_events_set(elo->evas_obj, lua_toboolean(L, 2));
2294 // Stack usage [-0, +0, -]
2295 }
2296 }
2297 lua_pushboolean(L, evas_object_pass_events_get(elo->evas_obj));
2298 // Stack usage [-0, +1, -]
2299 return 1;
2300}
2301
2302/**
2303@page luaref
2304@subsubsection evas_precise evas_object:precise(precise)
2305
2306Get (and optionally set) whether to use precise (usually expensive) point
2307collision detection for this object.
2308
2309Wraps evas_object_precise_is_inside_set().
2310
2311@param precise A boolean saying if this object is precisely detected.
2312
2313Note that the argument is optional, without it this function just queries the
2314current value.
2315
2316@return A boolean saying if this object is precisely detected.
2317*/
2318static int
2319_elua_precise(lua_State *L) // Stack usage [-0, +1, -]
2320{
2321 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
2322 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
2323 int n;
2324 if (!_elua_isa(obj, _elua_evas_meta)) return 0;
2325 n = lua_gettop(L); // Stack usage [-0, +0, -]
2326 if (n == 2)
2327 {
2328 if (lua_isboolean(L, 2)) // Stack usage [-0, +0, -]
2329 {
2330 evas_object_precise_is_inside_set(elo->evas_obj, lua_toboolean(L, 2));
2331 // Stack usage [-0, +0, -]
2332 }
2333 }
2334 lua_pushboolean(L, evas_object_precise_is_inside_get(elo->evas_obj));
2335 // Stack usage [-0, +1, -]
2336 return 1;
2337}
2338
2339/**
2340@page luaref
2341@subsubsection evas_repeat evas_object:repeat(repeat)
2342
2343Get (and optionally set) whether this object repeats events.
2344
2345Wraps evas_object_repeat_events_set().
2346
2347@param repeat A boolean saying if this object repeats events to lower objects.
2348
2349Note that the argument is optional, without it this function just queries the
2350current value.
2351
2352@return A boolean saying if this object repeats events.
2353*/
2354static int
2355_elua_repeat(lua_State *L) // Stack usage [-0, +1, -]
2356{
2357 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
2358 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
2359 int n;
2360 if (!_elua_isa(obj, _elua_evas_meta)) return 0;
2361 n = lua_gettop(L); // Stack usage [-0, +0, -]
2362 if (n == 2)
2363 {
2364 if (lua_isboolean(L, 2)) // Stack usage [-0, +0, -]
2365 {
2366 evas_object_repeat_events_set(elo->evas_obj, lua_toboolean(L, 2));
2367 // Stack usage [-0, +0, -]
2368 }
2369 }
2370 lua_pushboolean(L, evas_object_repeat_events_get(elo->evas_obj));
2371 // Stack usage [-0, +1, -]
2372 return 1;
2373}
2374
2375//-------------
2376/**
2377@page luaref
2378@subsubsection evas_colour evas_object:color(r, g, b, a)
2379
2380Gets (and optionally sets) this objects colour.
2381
2382Wraps evas_object_color_set().
2383
2384@param r The new red value.
2385@param g The new green value.
2386@param b The new blue value.
2387@param a The new alpha value.
2388
2389Note that the arguments are optional, without them this function just queries
2390the current values. The arguments can be separate values, or named fields in a
2391table.
2392
2393@return A table with these fields:
2394 - integer r: The red value.
2395 - integer g: The green value.
2396 - integer b: The blue value.
2397 - integer a: The alpha value.
2398*/
2399static int
2400_elua_color(lua_State *L) // Stack usage [-(8|12), +(9|13), em]
2401{
2402 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
2403 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
2404 int r, g, b, a;
2405
2406 if (!_elua_isa(obj, _elua_evas_meta)) return 0;
2407 if (_elua_scan_params(L, 2, "%r %g %b %a", &r, &g, &b, &a) > 0)
2408 { // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e]
2409 _elua_color_fix(&r, &g, &b, &a);
2410 evas_object_color_set(elo->evas_obj, r, g, b, a);
2411 }
2412 evas_object_color_get(elo->evas_obj, &r, &g, &b, &a);
2413 _elua_ret(L, "%r %g %b %a", r, g, b, a);
2414 // Stack usage [-8, +9, em]
2415 return 1;
2416}
2417
2418//-------------
2419/**
2420@page luaref
2421@subsubsection evas_map evas_object:map(map)
2422
2423Attach a map to this object.
2424
2425Wraps evas_object_map_set().
2426
2427@param map The map to attach.
2428
2429@since 1.1.0
2430*/
2431static int
2432_elua_obj_map(lua_State *L) // Stack usage [-0, +0, -]
2433{
2434 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
2435 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
2436 Edje_Lua_Obj *obj2 = (Edje_Lua_Obj *)lua_touserdata(L, 2); // Stack usage [-0, +0, -]
2437 Edje_Lua_Map *elm = (Edje_Lua_Map *)obj2;
2438 if (!_elua_isa(obj, _elua_evas_meta)) return 0;
2439 if (!_elua_isa(obj2, _elua_evas_map_meta)) return 0;
2440
2441 evas_object_map_set(elo->evas_obj, elm->map);
2442
2443 return 0;
2444}
2445
2446/**
2447@page luaref
2448@subsubsection evas_map_enable evas_object:map_enable(enable)
2449
2450Enable or disable the map attached to this object.
2451
2452Wraps evas_object_map_enable_set().
2453
2454@param enable A booleon that controls if the attached map is enabled or not.
2455
2456@return A boolean reflecting the map enabled status of this object.
2457
2458@since 1.1.0
2459*/
2460static int
2461_elua_obj_map_enable(lua_State *L) // Stack usage [-0, +1, -]
2462{
2463 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
2464 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
2465 int n;
2466 if (!_elua_isa(obj, _elua_evas_meta)) return 0;
2467
2468 n = lua_gettop(L); // Stack usage [-0, +0, -]
2469 if (n == 2)
2470 {
2471 evas_object_map_enable_set(elo->evas_obj, lua_toboolean(L, 2));
2472 // Stack usage [-0, +0, -]
2473 }
2474 lua_pushboolean(L, evas_object_map_enable_get(elo->evas_obj));
2475 // Stack usage [-0, +1, -]
2476 return 1;
2477}
2478
2479/**
2480@page luaref
2481@subsubsection evas_map_source evas_object:map_source(object)
2482
2483Sets the object as the map source for this object.
2484
2485Wraps evas_object_map_source_set().
2486
2487@param object The map source object.
2488
2489@return A userdata reference to the current map source object.
2490
2491@since 1.1.0
2492*/
2493static int
2494_elua_obj_map_source(lua_State *L) // Stack usage [-3, +4, -]
2495{
2496 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
2497 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
2498 Evas_Object *o;
2499 Edje_Lua_Evas_Object *elo2;
2500 int n;
2501
2502 if (!_elua_isa(obj, _elua_evas_meta)) return 0;
2503
2504 n = lua_gettop(L); // Stack usage [-0, +0, -]
2505 if (n == 2)
2506 {
2507 Edje_Lua_Obj *obj2 = (Edje_Lua_Obj *)lua_touserdata(L, 2); // Stack usage [-0, +0, -]
2508 const Edje_Lua_Evas_Object *source = (Edje_Lua_Evas_Object *)obj2;
2509
2510 if (!_elua_isa(obj2, _elua_evas_meta)) return 0;
2511 evas_object_map_source_set(elo->evas_obj, source->evas_obj);
2512 }
2513
2514 if (!(o = evas_object_map_source_get(elo->evas_obj))) return 0;
2515 if (!(elo2 = evas_object_data_get(o, ELO))) return 0;
2516 _elua_ref_get(L, elo2); // Stack usage [-3, +4, -]
2517
2518 return 1;
2519}
2520
2521//-------------
2522//-------------
2523/**
2524@page luaref
2525@subsection ecore_animator Ecore animator class.
2526
2527The lua ecore animator class includes functions for dealing with ecore animator objects.
2528The ecore animator objects must have been previously created by lua using the lua
2529edje object creation function edje:animator() or edje:transition().
2530
2531In the following, "animator_object" is a place holder for any lua variable that
2532holds a reference to an ecore animator object.
2533*/
2534static const char *_elua_ecore_animator_api = "ecore_animator";
2535static const struct luaL_reg _elua_ecore_animator_funcs [] =
2536{
2537 {NULL, NULL} // end
2538};
2539
2540//-------------
2541//-------------
2542/**
2543@page luaref
2544@subsection ecore_timer Ecore timer class.
2545
2546The lua ecore timer class includes functions for dealing with ecore timer objects.
2547The ecore timer objects must have been previously created by lua using the lua
2548edje object creation function edje:timer().
2549
2550In the following, "timer_object" is a place holder for any lua variable that
2551holds a reference to an ecore timer object.
2552*/
2553
2554static const char *_elua_ecore_timer_api = "ecore_timer";
2555static const struct luaL_reg _elua_ecore_timer_funcs [] =
2556{
2557 {NULL, NULL} // end
2558};
2559
2560//-------------
2561//-------------
2562/**
2563@page luaref
2564@subsection evas_edje Evas edje class.
2565
2566The lua evas edje class includes functions for dealing with evas edje objects.
2567The evas edje objects must have been previously created by lua using the lua
2568edje object creation function edje:edje().
2569
2570In the following, "edje_object" is a place holder for any lua variable that
2571holds a reference to an evas edje object. NOT the edje class specified earlier
2572though.
2573
2574@since 1.1.0
2575*/
2576
2577static int _elua_edje_file(lua_State *L);
2578
2579static const char *_elua_evas_edje_api = "evas_edje";
2580static const char *_elua_evas_edje_parent = "evas_edje_parent";
2581static const struct luaL_reg _elua_evas_edje_funcs [] =
2582{
2583 {"file", _elua_edje_file}, // get or set edje file and group
2584
2585 {NULL, NULL} // end
2586};
2587
2588/**
2589@page luaref
2590@subsubsection edje_file edje_object:file(file, group)
2591
2592Load an edje group into this edje object.
2593
2594Wraps edje_object_file_set().
2595
2596@param file An edje file name (ignored, sandboxed to the file this lua script is in).
2597@param group The group within the edje file to be loaded.
2598
2599Note that the arguments are optional, without them this function just queries
2600the current values. The arguments can be separate values, or named fields in a
2601table. The file argument is optional, and ignored anyway.
2602
2603@return A table with these fields:
2604 - string file: The name of the edje file this edje's group is loaded from.
2605 - string group: The name of the group this edje is loaded from.
2606
2607@since 1.1.0
2608*/
2609static int
2610_elua_edje_file(lua_State *L) // Stack usage [-(4|6), +(5|7), em]
2611{
2612 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
2613 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
2614 const char *file = NULL, *group = NULL;
2615 int n = lua_gettop(L); // Stack usage [-0, +0, -]
2616
2617 if (!_elua_isa(obj, _elua_evas_edje_meta)) return 0;
2618
2619 n = _elua_scan_params(L, 2, "$file $group", &file, &group);
2620 // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e]
2621 if (0 >= n)
2622 {
2623 file = (char *) obj->ed->file->path;
2624 group = (char *) lua_tostring(L, 2); // Stack usage [-0, +0, m]
2625 n = 2;
2626 }
2627
2628 if (1 < n)
2629 {
2630 // Sandbox lua - Only allow access to groups within the same file.
2631 // By the simple expedient of completely ignoring what file was requested.
2632 file = (char *) obj->ed->file->path;
2633 if (!edje_object_file_set(elo->evas_obj, file, group))
2634 {
2635 Edje_Load_Error err = edje_object_load_error_get(elo->evas_obj);
2636
2637 switch (err)
2638 {
2639 case EDJE_LOAD_ERROR_NONE : LE("Edje file loading errer %s %s - no error happened, but you should not see this.\n", obj->ed->file->path, group); break;
2640 case EDJE_LOAD_ERROR_GENERIC : LE("Edje file loading errer %s %s - generic error.\n", obj->ed->file->path, group); break;
2641 case EDJE_LOAD_ERROR_DOES_NOT_EXIST : LE("Edje file loading errer %s %s - file does not exist.\n", obj->ed->file->path, group); break;
2642 case EDJE_LOAD_ERROR_PERMISSION_DENIED : LE("Edje file loading errer %s %s - permission denied reading the file.\n", obj->ed->file->path, group); break;
2643 case EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED : LE("Edje file loading errer %s %s - resource allocation failed.\n", obj->ed->file->path, group); break;
2644 case EDJE_LOAD_ERROR_CORRUPT_FILE : LE("Edje file loading errer %s %s - corrupt file.\n", obj->ed->file->path, group); break;
2645 case EDJE_LOAD_ERROR_UNKNOWN_FORMAT : LE("Edje file loading errer %s %s - unknown file format.\n", obj->ed->file->path, group); break;
2646 case EDJE_LOAD_ERROR_INCOMPATIBLE_FILE : LE("Edje file loading errer %s %s - incompatible file.\n", obj->ed->file->path, group); break;
2647 case EDJE_LOAD_ERROR_UNKNOWN_COLLECTION : LE("Edje file loading errer %s %s - unknown group.\n", obj->ed->file->path, group); break;
2648 case EDJE_LOAD_ERROR_RECURSIVE_REFERENCE : LE("Edje file loading errer %s %s - recursive reference in group.\n", obj->ed->file->path, group); break;
2649 }
2650 }
2651 }
2652 edje_object_file_get(elo->evas_obj, &file, &group);
2653 _elua_ret(L, "$file $group", file, group);
2654 // Stack usage [-4, +5, em]
2655 return 1;
2656}
2657
2658//-------------
2659//-------------
2660/**
2661@page luaref
2662@subsection evas_image Evas image class.
2663
2664The lua evas image class includes functions for dealing with evas image objects.
2665The evas image objects must have been previously created by lua using the lua
2666image object creation function edje:image().
2667
2668In the following, "image_object" is a place holder for any lua variable that
2669holds a reference to an evas image object.
2670
2671@since 1.1.0
2672*/
2673
2674static int _elua_image_fill(lua_State *L);
2675static int _elua_image_filled(lua_State *L);
2676static int _elua_image_image(lua_State *L);
2677
2678static const char *_elua_evas_image_api = "evas_image";
2679static const char *_elua_evas_image_parent = "evas_image_parent";
2680static const struct luaL_reg _elua_evas_image_funcs [] =
2681{
2682 {"fill", _elua_image_fill}, // get or set the fill parameters
2683 {"filled", _elua_image_filled}, // get or set the filled state (overrides fill())
2684 {"image", _elua_image_image}, // get or set image
2685
2686 {NULL, NULL} // end
2687};
2688
2689/**
2690@page luaref
2691@subsubsection image_fill image_object:fill(x, y, w, h)
2692
2693Gets (and optionally sets) how to fill this image's drawing rectangle given the
2694(real) image bound to it.
2695
2696Wraps evas_object_image_fill_set().
2697
2698@param x The x coordinate (from the top left corner of the bound image) to start drawing from.
2699@param y The y coordinate (from the top left corner of the bound image) to start drawing from.
2700@param w The width the bound image will be displayed at.
2701@param h The height the bound image will be displayed at.
2702
2703Note that the arguments are optional, without them this function just queries
2704the current values. The arguments can be separate values, or named fields in a
2705table.
2706
2707@return A table with these fields:
2708 - integer x: The x coordinate (from the top left corner of the bound image) to start drawing from.
2709 - integer y: The y coordinate (from the top left corner of the bound image) to start drawing from.
2710 - integer w: The width the bound image will be displayed at.
2711 - integer h: The height the bound image will be displayed at.
2712
2713@since 1.1.0
2714*/
2715static int
2716_elua_image_fill(lua_State *L) // Stack usage [-(8|12), +(9|13), em]
2717{
2718 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
2719 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
2720 Evas_Coord x, y, w, h;
2721
2722 if (!_elua_isa(obj, _elua_evas_image_meta)) return 0;
2723
2724 if (_elua_scan_params(L, 2, "%x %y %w %h", &x, &y, &w, &h) > 0)
2725 { // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e]
2726 evas_object_image_fill_set(elo->evas_obj, x, y, w, h);
2727 }
2728 evas_object_image_fill_get(elo->evas_obj, &x, &y, &w, &h);
2729 _elua_ret(L, "%x %y %w %h", x, y, w, h);
2730 // Stack usage [-8, +9, em]
2731 return 1;
2732}
2733
2734/**
2735@page luaref
2736@subsubsection image_filled image_object:filled(filled)
2737
2738Get (and optionally set) whether this image fills the object.
2739
2740Wraps evas_object_image_filled_set().
2741
2742@param filled A boolean saying if this image fills the object.
2743
2744Note that the argument is optional, without it this function just queries the
2745current value.
2746
2747@return A boolean saying if this image fills the object.
2748
2749@since 1.1.0
2750*/
2751static int
2752_elua_image_filled(lua_State *L) // Stack usage [-0, +0, -]
2753{
2754 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
2755 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
2756 int n;
2757
2758 if (!_elua_isa(obj, _elua_evas_image_meta)) return 0;
2759
2760 n = lua_gettop(L); // Stack usage [-0, +0, -]
2761 if (n == 2)
2762 {
2763 evas_object_image_filled_set(elo->evas_obj, lua_toboolean(L, 2));
2764 // Stack usage [-0, +0, -]
2765 }
2766 lua_pushboolean(L, evas_object_image_filled_get(elo->evas_obj));
2767 // Stack usage [-0, +0, -]
2768 return 1;
2769}
2770
2771/**
2772@page luaref
2773@subsubsection image_image image_object:image(file, key)
2774
2775Load an image into this edje object.
2776
2777Wraps evas_object_image_file_set().
2778
2779@param file An edje file name (ignored, sandboxed to the file this lua script is in).
2780@param group The name of an image.
2781
2782Note that the arguments are optional, without them this function just queries
2783the current values. The arguments can be separate values, or named fields in a
2784table. The file argument is optional, and ignored anyway.
2785
2786@return A table with these fields:
2787 - string file: The name of the edje file the image is loaded from.
2788 - string key: The name of the image within the edje file.
2789
2790@since 1.1.0
2791*/
2792static int
2793_elua_image_image(lua_State *L) // Stack usage [-(4|6), +(5|7), em]
2794{
2795 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
2796 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
2797 const char *file = NULL, *key = NULL;
2798 int n, id = -1;
2799
2800 if (!_elua_isa(obj, _elua_evas_image_meta)) return 0;
2801
2802 n = _elua_scan_params(L, 2, "$file $key", &file, &key);
2803 // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e]
2804 if (0 >= n)
2805 {
2806 file = (char *) obj->ed->file->path;
2807 key = (char *) lua_tostring(L, 2); // Stack usage [-0, +0, m]
2808 n = 2;
2809 }
2810
2811 if (1 < n)
2812 {
2813 if (obj->ed->file->image_dir)
2814 {
2815 Edje_Image_Directory_Entry *de;
2816 unsigned int i;
2817 char *name;
2818
2819 /* Image name */
2820 if ((name = strrchr(key, '/'))) name++;
2821 else name = (char *)key;
2822
2823 /* Loop through image directory to find if image exists */
2824 for (i = 0; i < obj->ed->file->image_dir->entries_count; ++i)
2825 {
2826 de = obj->ed->file->image_dir->entries + i;
2827
2828 if (de->entry)
2829 {
2830 if (strcmp(name, de->entry) == 0)
2831 {
2832 char buf[32];
2833
2834 id = i;
2835 // This is copied from _edje_image_recalc_apply()), dunno if it provides any benefit over sprintf().
2836 /* Replace snprint("edje/images/%i") == memcpy + itoa */
2837#define IMAGES "edje/images/"
2838 memcpy(buf, IMAGES, strlen(IMAGES));
2839 eina_convert_itoa(id, buf + strlen(IMAGES)); /* No need to check length as 2³² need only 10 characters. */
2840 evas_object_image_file_set(elo->evas_obj, obj->ed->file->path, buf);
2841 break;
2842 }
2843 }
2844 }
2845 }
2846
2847 /* Sandbox lua - Only allow access to images within the same edje file. I'm not so sure we need this level of sandboxing though. So leaving it here, just in case.
2848 if (-1 == id)
2849 {
2850 LI("Image %s not found in our edje file, trying external image file %s.\n", key, file);
2851 evas_object_image_file_set(elo->evas_obj, file, key);
2852 }
2853 */
2854 }
2855 evas_object_image_file_get(elo->evas_obj, &file, &key);
2856 _elua_ret(L, "$file $key", file, key);
2857 // Stack usage [-4, +5, em]
2858 return 1;
2859}
2860
2861//-------------
2862//-------------
2863/**
2864@page luaref
2865@subsection evas_line Evas line class.
2866
2867The lua evas line class includes functions for dealing with evas line objects.
2868The evas line objects must have been previously created by lua using the lua
2869line object creation function edje:line().
2870
2871In the following, "line_object" is a place holder for any lua variable that
2872holds a reference to an evas line object.
2873
2874@since 1.1.0
2875*/
2876
2877static int _elua_line_xy(lua_State *L);
2878
2879static const char *_elua_evas_line_api = "evas_line";
2880static const char *_elua_evas_line_parent = "evas_line_parent";
2881static const struct luaL_reg _elua_evas_line_funcs [] =
2882{
2883 {"xy", _elua_line_xy}, // get or set line coords
2884
2885 {NULL, NULL} // end
2886};
2887
2888/**
2889@page luaref
2890@subsubsection line_xy line_object:xy(x1, y1, x2, y2)
2891
2892Sets the end points of this line.
2893
2894Wraps evas_object_line_xy_set().
2895
2896@param x1 The X coordinate of the first line end.
2897@param y1 The Y coordinate of the first line end.
2898@param x2 The X coordinate of the other line end.
2899@param y2 The Y coordinate of the other line end.
2900
2901Note that the arguments are optional, without them this function just queries
2902the current values. The arguments can be separate values, or named fields in a
2903table.
2904
2905@return A table with these fields:
2906 - integer x1: The X coordinate of the first line end.
2907 - integer y1: The Y coordinate of the first line end.
2908 - integer x2: The X coordinate of the other line end.
2909 - integer y2: The Y coordinate of the other line end.
2910
2911@since 1.1.0
2912*/
2913static int _elua_line_xy(lua_State *L) // Stack usage [-(8|12), +(9|13), em]
2914{
2915 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
2916 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
2917 Evas_Coord x1, y1, x2, y2;
2918
2919 if (!_elua_isa(obj, _elua_evas_line_meta)) return 0;
2920
2921 if (_elua_scan_params(L, 2, "%x1 %y1 %x2 %y2", &x1, &y1, &x2, &y2) > 0)
2922 { // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e]
2923 evas_object_line_xy_set(elo->evas_obj, x1, y1, x2, y2);
2924 }
2925 evas_object_line_xy_get(elo->evas_obj, &x1, &y1, &x2, &y2);
2926 _elua_ret(L, "%x1 %y1 %x2 %y2", x1, y1, x2, y2);
2927 // Stack usage [-8, +9, em]
2928 return 1;
2929}
2930
2931//-------------
2932//-------------
2933/**
2934@page luaref
2935@subsection evas_object_map Evas map class.
2936
2937The lua evas map class includes functions for dealing with evas map objects.
2938The evas map objects must have been previously created by lua using the lua
2939map object creation function edje:map().
2940
2941In the following, "map_object" is a place holder for any lua variable that
2942holds a reference to an evas map object.
2943
2944@since 1.1.0
2945*/
2946
2947static int _elua_map_alpha(lua_State *L);
2948static int _elua_map_clockwise(lua_State *L);
2949static int _elua_map_colour(lua_State *L);
2950static int _elua_map_coord(lua_State *L);
2951static int _elua_map_lighting(lua_State *L);
2952static int _elua_map_perspective(lua_State *L);
2953static int _elua_map_populate(lua_State *L);
2954static int _elua_map_rotate(lua_State *L);
2955static int _elua_map_rotate3d(lua_State *L);
2956static int _elua_map_smooth(lua_State *L);
2957static int _elua_map_uv(lua_State *L);
2958static int _elua_map_zoom(lua_State *L);
2959
2960static const char *_elua_evas_map_api = "ewas_map";
2961static const struct luaL_reg _elua_evas_map_funcs [] =
2962{
2963 {"alpha", _elua_map_alpha},
2964// {"dup", _elua_map_dup}, // not sure of proper api for this.
2965 {"clockwise", _elua_map_clockwise},
2966 {"color", _elua_map_colour},
2967 {"coord", _elua_map_coord},
2968 {"lighting", _elua_map_lighting},
2969 {"perspective", _elua_map_perspective},
2970 {"populate", _elua_map_populate},
2971 {"rotate", _elua_map_rotate},
2972 {"rotate3d", _elua_map_rotate3d},
2973// {"size", _elua_map_size}, // not sure of proper API for this
2974 {"smooth", _elua_map_smooth},
2975 {"uv", _elua_map_uv},
2976 {"zoom", _elua_map_zoom},
2977
2978 {NULL, NULL} // end
2979};
2980
2981/**
2982@page luaref
2983@subsubsection map_alpha map_object:alpha()
2984
2985
2986@since 1.1.0
2987*/
2988static int
2989_elua_map_alpha(lua_State *L) // Stack usage [-0, +1, -]
2990{
2991 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
2992 Edje_Lua_Map *elm = (Edje_Lua_Map *)obj;
2993 int n;
2994
2995 if (!_elua_isa(obj, _elua_evas_map_meta)) return 0;
2996
2997 n = lua_gettop(L); // Stack usage [-0, +0, -]
2998 if (n == 2)
2999 {
3000 evas_map_alpha_set(elm->map, lua_toboolean(L, 2));
3001 // Stack usage [-0, +0, -]
3002 }
3003 lua_pushboolean(L, evas_map_alpha_get(elm->map)); // Stack usage [-0, +1, -]
3004 return 1;
3005}
3006
3007/**
3008@page luaref
3009@subsubsection map_clockwise map_object:clockwise()
3010
3011
3012@since 1.1.0
3013*/
3014static int
3015_elua_map_clockwise(lua_State *L) // Stack usage [-0, +1, -]
3016{
3017 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
3018 Edje_Lua_Map *elm = (Edje_Lua_Map *)obj;
3019
3020 if (!_elua_isa(obj, _elua_evas_map_meta)) return 0;
3021
3022 lua_pushboolean(L, evas_map_util_clockwise_get(elm->map)); // Stack usage [-0, +1, -]
3023 return 1;
3024}
3025
3026/**
3027@page luaref
3028@subsubsection map_colour map_object:colour()
3029
3030
3031@since 1.1.0
3032*/
3033static int
3034_elua_map_colour(lua_State *L) // Stack usage [-(8|12), +(9|13), em]
3035{
3036 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
3037 Edje_Lua_Map *elm = (Edje_Lua_Map *)obj;
3038 int r, g, b, a;
3039 int n;
3040
3041 if (!_elua_isa(obj, _elua_evas_map_meta)) return 0;
3042 n = lua_gettop(L); // Stack usage [-0, +0, -]
3043
3044 switch (n)
3045 {
3046 case 5 :
3047 {
3048 if (_elua_scan_params(L, 2, "%r %g %b %a", &r, &g, &b, &a) > 0)
3049 { // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e]
3050 evas_map_util_points_color_set(elm->map, r, g, b, a);
3051 }
3052 break;
3053 }
3054
3055 case 1 :
3056 case 6 :
3057 {
3058 if (_elua_scan_params(L, 3, "%r %g %b %a", &r, &g, &b, &a) > 0)
3059 { // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e]
3060 evas_map_point_color_set(elm->map, lua_tointeger(L, 2), r, g, b, a);
3061 // Stack usage [-0, +0, -]
3062 }
3063 evas_map_point_color_get(elm->map, lua_tointeger(L, 2), &r, &g, &b, &a);
3064 // Stack usage [-0, +0, -]
3065 _elua_ret(L, "%r %g %b %a", r, g, b, a);
3066 // Stack usage [-8, +9, em]
3067 return 1;
3068 }
3069 }
3070
3071 return 0;
3072}
3073
3074/**
3075@page luaref
3076@subsubsection map_coord map_object:coord()
3077
3078
3079@since 1.1.0
3080*/
3081static int
3082_elua_map_coord(lua_State *L) // Stack usage [-(6|9), +(7|10), em]
3083{
3084 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
3085 Edje_Lua_Map *elm = (Edje_Lua_Map *)obj;
3086 Evas_Coord x, y, z;
3087 int n;
3088
3089 if (!_elua_isa(obj, _elua_evas_map_meta)) return 0;
3090 n = lua_gettop(L); // Stack usage [-0, +0, -]
3091 if (2 > n) return 0;
3092
3093 if (_elua_scan_params(L, 2, "%x %y %z", &x, &y, &z) > 0)
3094 { // Stack usage [-0, +0, m] unless it's in a table [-3, +3, e]
3095 evas_map_point_coord_set(elm->map, lua_tointeger(L, 2), x, y, z);
3096 // Stack usage [-0, +0, -]
3097 }
3098 evas_map_point_coord_get(elm->map, lua_tointeger(L, 2), &x, &y, &z);
3099 // Stack usage [-0, +0, -]
3100 _elua_ret(L, "%x %y %z", x, y, z);
3101 // Stack usage [-6, +7, em]
3102 return 1;
3103}
3104
3105/**
3106@page luaref
3107@subsubsection map_lighting map_object:lighting()
3108
3109
3110@since 1.1.0
3111*/
3112static int
3113_elua_map_lighting(lua_State *L) // Stack usage [-(0|9), +(0|9), e]
3114{
3115 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
3116 Edje_Lua_Map *elm = (Edje_Lua_Map *)obj;
3117 Evas_Coord x, y, z;
3118 int r, g, b, r1, g1, b1;
3119 int n;
3120
3121 if (!_elua_isa(obj, _elua_evas_map_meta)) return 0;
3122
3123 if ((n = _elua_scan_params(L, 2, "%x %y %z", &x, &y, &z)) > 0)
3124 // Stack usage [-0, +0, m] unless it's in a table [-3, +3, e]
3125 if (n += _elua_scan_params(L, 2 + n, "%r %g %b", &r, &g, &b) > 0)
3126 // Stack usage [-0, +0, m] unless it's in a table [-3, +3, e]
3127 if (_elua_scan_params(L, 2 + n, "%r %g %b", &r1, &g1, &b1) > 0)
3128 { // Stack usage [-0, +0, m] unless it's in a table [-3, +3, e]
3129 evas_map_util_3d_lighting(elm->map, x, y, z, r, g, b, r1, g1, b1);
3130 }
3131 return 0;
3132}
3133
3134/**
3135@page luaref
3136@subsubsection map_perspective map_object:perspective()
3137
3138
3139@since 1.1.0
3140*/
3141static int
3142_elua_map_perspective(lua_State *L) // Stack usage [-(0|4), +(0|4), e]
3143{
3144 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
3145 Edje_Lua_Map *elm = (Edje_Lua_Map *)obj;
3146 Evas_Coord x, y, z, f;
3147
3148 if (!_elua_isa(obj, _elua_evas_map_meta)) return 0;
3149
3150 if (_elua_scan_params(L, 2, "%x %y %z %f", &x, &y, &z, &f) > 0)
3151 { // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e]
3152 evas_map_util_3d_perspective(elm->map, x, y, z, f);
3153 }
3154 return 0;
3155}
3156
3157/**
3158@page luaref
3159@subsubsection map_populate map_object:populate()
3160
3161
3162@since 1.1.0
3163*/
3164static int
3165_elua_map_populate(lua_State *L) // Stack usage [-(0|4), +(0|4), e]
3166{
3167 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
3168 Edje_Lua_Map *elm = (Edje_Lua_Map *)obj;
3169 int n;
3170
3171 if (!_elua_isa(obj, _elua_evas_map_meta)) return 0;
3172 n = lua_gettop(L); // Stack usage [-0, +0, -]
3173
3174 switch (n)
3175 {
3176 case 2 :
3177 {
3178 Edje_Lua_Obj *obj2 = (Edje_Lua_Obj *)lua_touserdata(L, 2); // Stack usage [-0, +0, -]
3179 const Edje_Lua_Evas_Object *source = (Edje_Lua_Evas_Object *)obj2;
3180
3181 if (!_elua_isa(obj2, _elua_evas_meta)) return 0;
3182 evas_map_util_points_populate_from_object(elm->map, source->evas_obj);
3183 break;
3184 }
3185
3186 case 3 :
3187 {
3188 Edje_Lua_Obj *obj2 = (Edje_Lua_Obj *)lua_touserdata(L, 2); // Stack usage [-0, +0, -]
3189 const Edje_Lua_Evas_Object *source = (Edje_Lua_Evas_Object *)obj2;
3190 Evas_Coord z = lua_tointeger(L, 3);
3191
3192 if (!_elua_isa(obj2, _elua_evas_meta)) return 0;
3193 evas_map_util_points_populate_from_object_full(elm->map, source->evas_obj, z);
3194 break;
3195 }
3196
3197 case 6 :
3198 {
3199 Evas_Coord x, y, w, h;
3200
3201 if ((n = _elua_scan_params(L, 2, "%x %y %w %h", &x, &y, &w, &h)) > 0)
3202 { // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e]
3203 evas_map_util_points_populate_from_geometry(elm->map, x, y, w, h, lua_tointeger(L, 2 + n));
3204 }
3205 break;
3206 }
3207 }
3208 return 0;
3209}
3210
3211/**
3212@page luaref
3213@subsubsection map_rotate map_object:rotate()
3214
3215
3216@since 1.1.0
3217*/
3218static int
3219_elua_map_rotate(lua_State *L) // Stack usage [-(0|2), +(0|2), e]
3220{
3221 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
3222 Edje_Lua_Map *elm = (Edje_Lua_Map *)obj;
3223 double degrees;
3224 Evas_Coord x, y;
3225 int n;
3226
3227 if (!_elua_isa(obj, _elua_evas_map_meta)) return 0;
3228 n = lua_gettop(L); // Stack usage [-0, +0, -]
3229 if (4 != n) return 0;
3230
3231 degrees = lua_tonumber(L, 2);
3232 if (_elua_scan_params(L, 3, "%x %y", &x, &y) > 0)
3233 { // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e]
3234 evas_map_util_rotate(elm->map, degrees, x, y);
3235 }
3236 return 0;
3237}
3238
3239/**
3240@page luaref
3241@subsubsection map_rotate3d map_object:rotate3d()
3242
3243
3244@since 1.1.0
3245*/
3246static int
3247_elua_map_rotate3d(lua_State *L) // Stack usage [-(0|6), +(0|6), e]
3248{
3249 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
3250 Edje_Lua_Map *elm = (Edje_Lua_Map *)obj;
3251 double zx, zy, zz;
3252 Evas_Coord x, y, z;
3253 int n;
3254
3255 if (!_elua_isa(obj, _elua_evas_map_meta)) return 0;
3256
3257 if ((n = _elua_scan_params(L, 2, "#x #y #z", &zx, &zy, &zz)) > 0)
3258 // Stack usage [-0, +0, m] unless it's in a table [-3, +3, e]
3259 if (_elua_scan_params(L, 2 + n, "%x %y %z", &x, &y, &z) > 0)
3260 { // Stack usage [-0, +0, m] unless it's in a table [-3, +3, e]
3261 evas_map_util_3d_rotate(elm->map, zx, zy, zz, x, y, z);
3262 }
3263 return 0;
3264}
3265
3266/**
3267@page luaref
3268@subsubsection map_smooth map_object:smooth()
3269
3270
3271@since 1.1.0
3272*/
3273static int
3274_elua_map_smooth(lua_State *L) // Stack usage [-0, +1, -]
3275{
3276 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
3277 Edje_Lua_Map *elm = (Edje_Lua_Map *)obj;
3278 int n;
3279
3280 if (!_elua_isa(obj, _elua_evas_map_meta)) return 0;
3281
3282 n = lua_gettop(L); // Stack usage [-0, +0, -]
3283 if (n == 2)
3284 {
3285 evas_map_smooth_set(elm->map, lua_toboolean(L, 2));
3286 // Stack usage [-0, +0, -]
3287 }
3288 lua_pushboolean(L, evas_map_smooth_get(elm->map)); // Stack usage [-0, +1, -]
3289 return 1;
3290}
3291
3292/**
3293@page luaref
3294@subsubsection map_uv map_object:uv()
3295
3296
3297@since 1.1.0
3298*/
3299static int
3300_elua_map_uv(lua_State *L) // Stack usage [-(4|6), +(5|7), em]
3301{
3302 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
3303 Edje_Lua_Map *elm = (Edje_Lua_Map *)obj;
3304 double u, v;
3305 int n;
3306
3307 if (!_elua_isa(obj, _elua_evas_map_meta)) return 0;
3308 n = lua_gettop(L); // Stack usage [-0, +0, -]
3309 if (2 > n) return 0;
3310
3311 if (_elua_scan_params(L, 3, "#u #v", &u, &v) > 0)
3312 { // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e]
3313 evas_map_point_image_uv_set(elm->map, lua_tonumber(L, 2), u, v);
3314 // Stack usage [-0, +0, -]
3315 }
3316 evas_map_point_image_uv_get(elm->map, lua_tonumber(L, 2), &u, &v);
3317 // Stack usage [-0, +0, -]
3318 _elua_ret(L, "#u #v", u, v);
3319 // Stack usage [-4, +5, em]
3320 return 1;
3321}
3322
3323/**
3324@page luaref
3325@subsubsection map_zoom map_object:zoom()
3326
3327
3328@since 1.1.0
3329*/
3330static int
3331_elua_map_zoom(lua_State *L) // Stack usage [-(0|4), +(0|4), e]
3332{
3333 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
3334 Edje_Lua_Map *elm = (Edje_Lua_Map *)obj;
3335 double zx, zy;
3336 Evas_Coord x, y;
3337 int n;
3338
3339 if (!_elua_isa(obj, _elua_evas_map_meta)) return 0;
3340
3341 if ((n = _elua_scan_params(L, 2, "#x #y", &zx, &zy)) > 0)
3342 // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e]
3343 if (_elua_scan_params(L, 2 + n, "%x %y", &x, &y) > 0)
3344 { // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e]
3345 evas_map_util_zoom(elm->map, zx, zy, x, y);
3346 }
3347 return 0;
3348}
3349
3350//-------------
3351//-------------
3352/**
3353@page luaref
3354@subsection evas_polygon Evas polygon class.
3355
3356The lua evas polygon class includes functions for dealing with evas polygon objects.
3357The evas polygon objects must have been previously created by lua using the lua
3358polygon object creation function edje:polygon().
3359
3360In the following, "polygon_object" is a place holder for any lua variable that
3361holds a reference to an evas polygon object.
3362
3363@since 1.1.0
3364*/
3365
3366static int _elua_polygon_clear(lua_State *L);
3367static int _elua_polygon_point(lua_State *L);
3368
3369static const char *_elua_evas_polygon_api = "evas_polygon";
3370static const char *_elua_evas_polygon_parent = "evas_polygon_parent";
3371static const struct luaL_reg _elua_evas_polygon_funcs [] =
3372{
3373 {"clear", _elua_polygon_clear}, // clear all polygon points
3374 {"point", _elua_polygon_point}, // add a polygon point
3375
3376 {NULL, NULL} // end
3377};
3378
3379/**
3380@page luaref
3381@subsubsection polygon_clear polygon_object:clear()
3382
3383Clears all points from the polygon.
3384
3385Wraps evas_object_polygon_points_clear(),
3386
3387@since 1.1.0
3388*/
3389static int
3390_elua_polygon_clear(lua_State *L) // Stack usage [-0, +0, -]
3391{
3392 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
3393 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
3394
3395 if (!_elua_isa(obj, _elua_evas_polygon_meta)) return 0;
3396 evas_object_polygon_points_clear(elo->evas_obj);
3397 return 0;
3398}
3399
3400/**
3401@page luaref
3402@subsubsection polygon_point polygon_object:point(x, y)
3403
3404Adds a point to this polygon.
3405
3406Wraps evas_object_polygon_point_add().
3407
3408@param x The X coordinate of the point.
3409@param y The Y coordinate of the point.
3410
3411@since 1.1.0
3412*/
3413static int
3414_elua_polygon_point(lua_State *L) // Stack usage [-(0|2), +(0|2), e]
3415{
3416 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
3417 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
3418 Evas_Coord x, y;
3419
3420 if (!_elua_isa(obj, _elua_evas_polygon_meta)) return 0;
3421
3422 if (_elua_scan_params(L, 2, "%x %y", &x, &y) > 0)
3423 { // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e]
3424 evas_object_polygon_point_add(elo->evas_obj, x, y);
3425 }
3426
3427 return 0;
3428}
3429
3430//-------------
3431//-------------
3432/**
3433@page luaref
3434@subsection evas_text Evas text class.
3435
3436The lua evas text class includes functions for dealing with evas text objects.
3437The evas text objects must have been previously created by lua using the lua
3438text object creation function edje:text().
3439
3440In the following, "text_object" is a place holder for any lua variable that
3441holds a reference to an evas text object.
3442
3443@since 1.1.0
3444*/
3445
3446static int _elua_text_font(lua_State *L);
3447static int _elua_text_text(lua_State *L);
3448
3449static const char *_elua_evas_text_api = "evas_text";
3450static const char *_elua_evas_text_parent = "evas_text_parent";
3451static const struct luaL_reg _elua_evas_text_funcs [] =
3452{
3453 {"font", _elua_text_font}, // get or set text font
3454 {"text", _elua_text_text}, // get or set text
3455// {"text_class", _elua_object_text_class}, // get or set object text class
3456
3457 {NULL, NULL} // end
3458};
3459
3460/**
3461@page luaref
3462@subsubsection text_font text_object:font(font, size)
3463
3464Gets, (and optionally sets) the font for this text object.
3465
3466Wraps evas_object_text_font_set().
3467
3468@param font The new font name.
3469@param size The new font size.
3470
3471Note that the font and size arguments are optional, without them this function
3472just queries the current values. The font and size arguments can be separate
3473values, or named fields in a table. The font name can refer to a font in the
3474edje file, or an external font.
3475
3476@return A table with these fields:
3477 - string font: The font name.
3478 - integer size: The font size.
3479
3480@since 1.1.0
3481*/
3482static int
3483_elua_text_font(lua_State *L) // Stack usage [-(4|6), +(5|7), em]
3484{
3485 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
3486 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
3487 char *font, *font2 = NULL;
3488 Evas_Font_Size size;
3489 int inlined_font = 0;
3490
3491 if (!_elua_isa(obj, _elua_evas_text_meta)) return 0;
3492
3493 if (_elua_scan_params(L, 2, "$font %size", &font, &size) > 0)
3494 { // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e]
3495 /* Check if the font is embedded in the .edj
3496 * This is a simple check.
3497 * There is a much more complicated version in edje_text.c _edje_text_recalc_apply().
3498 * If we need to get more complicated, we can do that later,
3499 * and maybe refactor things.
3500 */
3501 if (obj->ed->file->fonts)
3502 {
3503 Edje_Font_Directory_Entry *fnt = eina_hash_find(obj->ed->file->fonts, font);
3504
3505 if (fnt)
3506 {
3507 size_t len = strlen(font) + sizeof("edje/fonts/") + 1;
3508 font2 = alloca(len);
3509 sprintf(font2, "edje/fonts/%s", font);
3510 font = font2;
3511 inlined_font = 1;
3512 font2 = NULL;
3513 }
3514 }
3515
3516 if (inlined_font) evas_object_text_font_source_set(elo->evas_obj, obj->ed->path);
3517 else evas_object_text_font_source_set(elo->evas_obj, NULL);
3518
3519 evas_object_text_font_set(elo->evas_obj, font, size);
3520 }
3521
3522 // When one external API says it's gotta be const, and another one says not, then one of them's gotta be cast. :-P
3523 evas_object_text_font_get(elo->evas_obj, (const char **) &font, &size);
3524 _elua_ret(L, "$font %size", font, size);
3525 // Stack usage [-4, +5, em]
3526 return 1;
3527}
3528
3529/**
3530@page luaref
3531@subsubsection text_text text_object:text(text)
3532
3533Get (and optionally set) the actual tetx for this text object.
3534
3535Wraps evas_object_text_text_set().
3536
3537@param text The text to set for this text object.
3538
3539Note that the argument is optional, without it this function just queries the
3540current value.
3541
3542@return A string of the text on this text object.
3543
3544@since 1.1.0
3545*/
3546static int
3547_elua_text_text(lua_State *L) // Stack usage [-0, +1, m]
3548{
3549 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -]
3550 Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
3551 int n;
3552
3553 if (!_elua_isa(obj, _elua_evas_text_meta)) return 0;
3554 n = lua_gettop(L); // Stack usage [-0, +0, -]
3555 if (n == 2)
3556 {
3557 if (lua_isstring(L, 2))
3558 {
3559 const char *str;
3560
3561 if ((str = lua_tostring(L, 2))) // Extra parenthesis, coz Mikes compiler has a lisp.
3562 // Stack usage [-0, +0, m]
3563 evas_object_text_text_set(elo->evas_obj, str);
3564 }
3565 }
3566 lua_pushstring(L, evas_object_text_text_get(elo->evas_obj)); // Stack usage [-0, +1, m]
3567 return 1;
3568}
3569
3570
3571//--------------------------------------------------------------------------//
3572// Brain dead inheritance thingy, built for speed. Kinda. Part 1.
3573static void
3574_elua_add_functions(lua_State *L, const char *api, const luaL_Reg *funcs, const char *meta, const char *parent, const char *base) // Stack usage [-3, +5, m] if inheriting [-6, +11, em]
3575{
3576 luaL_register(L, api, funcs); // Stack usage [-0, +1, m]
3577 luaL_newmetatable(L, meta); // Stack usage [-0, +1, m]
3578 luaL_register(L, 0, _elua_edje_gc_funcs); // Stack usage [-1, +1, m]
3579 lua_pushliteral(L, "__index"); // Stack usage [-0, +1, m]
3580 lua_pushvalue(L, -3); // Stack usage [-0, +1, -]
3581 lua_rawset(L, -3); // Stack usage [-2, +0, m]
3582
3583 if (base && parent)
3584 {
3585 // Inherit from base
3586 lua_getglobal(L, base); // Stack usage [-0, +1, e]
3587 luaL_newmetatable(L, parent); // Stack usage [-0, +1, m]
3588 lua_pushliteral(L, "__index"); // Stack usage [-0, +1, m]
3589 lua_pushvalue(L, -3); // Stack usage [-0, +1, -]
3590 lua_rawset(L, -3); // Stack usage [-2, +0, m]
3591 lua_getglobal(L, api); // Stack usage [-0, +1, e]
3592 luaL_getmetatable(L, parent); // Stack usage [-0, +1, -]
3593 lua_setmetatable(L, -2); // Stack usage [-1, +0, -]
3594 }
3595}
3596
3597// Brain dead inheritance thingy, built for speed. Kinda. Part 2.
3598static Eina_Bool
3599_elua_isa(Edje_Lua_Obj *obj, const char *type)
3600{
3601 Eina_Bool isa = EINA_FALSE;
3602
3603 if (!obj) return isa;
3604 if (obj->meta == type)
3605 isa = EINA_TRUE;
3606 if (_elua_evas_meta == type)
3607 {
3608 if (obj->meta == _elua_evas_image_meta)
3609 isa = EINA_TRUE;
3610 else if (obj->meta == _elua_evas_text_meta)
3611 isa = EINA_TRUE;
3612 else if (obj->meta == _elua_evas_edje_meta)
3613 isa = EINA_TRUE;
3614 else if (obj->meta == _elua_evas_line_meta)
3615 isa = EINA_TRUE;
3616 else if (obj->meta == _elua_evas_polygon_meta)
3617 isa = EINA_TRUE;
3618 }
3619 return isa;
3620}
3621
3622#ifndef RASTER_FORGOT_WHY
3623static void
3624_elua_init(void) // Stack usage [-16, +20, em]
3625{
3626 static Edje_Lua_Alloc ela = { MAX_LUA_MEM, 0 };
3627 const luaL_Reg *l;
3628 lua_State *L;
3629
3630 if (lstate) return;
3631
3632 lstate = L = lua_newstate(_elua_alloc, &ela); // Stack usage [-0, +0, -]
3633 lua_atpanic(L, _elua_custom_panic); // Stack usage [-0, +0, -]
3634
3635// FIXME: figure out optimal gc settings later
3636// lua_gc(L, LUA_GCSETPAUSE, 200); // Stack usage [-0, +0, e]
3637// lua_gc(L, LUA_GCSETSTEPMUL, 200); // Stack usage [-0, +0, e]
3638
3639 for (l = _elua_libs; l->func; l++) // Currently * 4
3640 {
3641 lua_pushcfunction(L, l->func); // Stack usage [-0, +1, m]
3642 lua_pushstring(L, l->name); // Stack usage [-0, +1, m]
3643 lua_call(L, 1, 0); // Stack usage [-2, +0, e]
3644 }
3645
3646 luaL_register(L, _elua_edje_api, _elua_edje_funcs); // Stack usage [-0, +1, m]
3647 luaL_newmetatable(L, _elua_edje_meta); // Stack usage [-0, +1, m]
3648 luaL_register(L, 0, _elua_edje_gc_funcs); // Stack usage [-1, +1, m]
3649
3650 _elua_add_functions(L, _elua_evas_api, _elua_evas_funcs, _elua_evas_meta, NULL, NULL); // Stack usage [-3, +5, m]
3651
3652 // weak table for our objects
3653 lua_pushlightuserdata(L, &_elua_objs); // Stack usage [-0, +1, -]
3654 lua_newtable(L); // Stack usage [-0, +1, m]
3655 lua_pushstring(L, "__mode"); // Stack usage [-0, +1, m]
3656 lua_pushstring(L, "v"); // Stack usage [-0, +1, m]
3657 lua_rawset(L, -3); // Stack usage [-2, +0, m]
3658 lua_rawset(L, LUA_REGISTRYINDEX); // Stack usage [-2, +0, m]
3659}
3660#endif
3661
3662void
3663_edje_lua2_script_init(Edje *ed) // Stack usage [-63, +99, em]
3664{
3665 static Edje_Lua_Alloc ela = { MAX_LUA_MEM, 0 };
3666 const luaL_Reg *l;
3667 char buf[256];
3668 void *data;
3669 int size;
3670 lua_State *L;
3671
3672 if (ed->L) return;
3673 if (0 > _log_domain)
3674 _log_domain = eina_log_domain_register("lua", NULL);
3675 if (0 <= _log_domain)
3676 {
3677 _log_count++;
3678 eina_log_domain_level_set("lua", EINA_LOG_LEVEL_WARN);
3679 }
3680
3681#ifndef RASTER_FORGOT_WHY
3682 _elua_init(); // This is actually truly pointless, even if raster remembers.
3683#endif
3684 L = ed->L = lua_newstate(_elua_alloc, &ela); // Stack usage [-0, +0, -]
3685 lua_atpanic(L, _elua_custom_panic); // Stack usage [-0, +0, -]
3686
3687// FIXME: figure out optimal gc settings later
3688// lua_gc(L, LUA_GCSETPAUSE, 200); // Stack usage [-0, +0, e]
3689// lua_gc(L, LUA_GCSETSTEPMUL, 200); // Stack usage [-0, +0, e]
3690
3691 for (l = _elua_libs; l->func; l++) // Currently * 4
3692 {
3693 lua_pushcfunction(L, l->func); // Stack usage [-0, +1, m]
3694 lua_pushstring(L, l->name); // Stack usage [-0, +1, m]
3695 lua_call(L, 1, 0); // Stack usage [-2, +0, m]
3696 }
3697
3698 luaL_register(L, _elua_edje_api, _elua_edje_funcs); // Stack usage [-0, +1, m]
3699 luaL_newmetatable(L, _elua_edje_meta); // Stack usage [-0, +1, m]
3700 luaL_register(L, 0, _elua_edje_gc_funcs); // Stack usage [-1, +1, m]
3701
3702 lua_pop(L, 2); // Stack usage [-n, +0, -]
3703
3704 _elua_add_functions(L, _elua_evas_api, _elua_evas_funcs, _elua_evas_meta, NULL, NULL);
3705 // Stack usage [-3, +5, m]
3706 _elua_add_functions(L, _elua_ecore_timer_api, _elua_ecore_timer_funcs, _elua_ecore_timer_meta, NULL, NULL);
3707 // Stack usage [-3, +5, m]
3708 _elua_add_functions(L, _elua_ecore_animator_api, _elua_ecore_animator_funcs, _elua_ecore_animator_meta, NULL, NULL);
3709 // Stack usage [-6, +11, m]
3710 _elua_add_functions(L, _elua_evas_edje_api, _elua_evas_edje_funcs, _elua_evas_edje_meta, _elua_evas_edje_parent, _elua_evas_api);
3711 // Stack usage [-6, +11, em]
3712 _elua_add_functions(L, _elua_evas_image_api, _elua_evas_image_funcs, _elua_evas_image_meta, _elua_evas_image_parent, _elua_evas_api);
3713 // Stack usage [-6, +11, em]
3714 _elua_add_functions(L, _elua_evas_line_api, _elua_evas_line_funcs, _elua_evas_line_meta, _elua_evas_line_parent, _elua_evas_api);
3715 // Stack usage [-6, +11, em]
3716 _elua_add_functions(L, _elua_evas_map_api, _elua_evas_map_funcs, _elua_evas_map_meta, NULL, NULL);
3717 // Stack usage [-3, +5, m]
3718 _elua_add_functions(L, _elua_evas_polygon_api, _elua_evas_polygon_funcs, _elua_evas_polygon_meta, _elua_evas_polygon_parent, _elua_evas_api);
3719 // Stack usage [-6, +11, em]
3720 _elua_add_functions(L, _elua_evas_text_api, _elua_evas_text_funcs, _elua_evas_text_meta, _elua_evas_text_parent, _elua_evas_api);
3721 // Stack usage [-6, +11, em]
3722
3723 // weak table for our objects
3724 lua_pushlightuserdata(L, &_elua_objs); // Stack usage [-0, +1, -]
3725 lua_newtable(L); // Stack usage [-0, +1, m]
3726 lua_pushstring(L, "__mode"); // Stack usage [-0, +1, m]
3727 lua_pushstring(L, "v"); // Stack usage [-0, +1, m]
3728 lua_rawset(L, -3); // Stack usage [-2, +0, m]
3729 lua_rawset(L, LUA_REGISTRYINDEX); // Stack usage [-2, +0, m]
3730
3731 _elua_table_ptr_set(L, _elua_key, ed); // Stack usage [-2, +2, e]
3732
3733 snprintf(buf, sizeof(buf), "edje/scripts/lua/%i", ed->collection->id);
3734 data = eet_read(ed->file->ef, buf, &size);
3735
3736 if (data)
3737 {
3738 int err;
3739
3740 err = luaL_loadbuffer(L, data, size, "edje_lua_script"); // Stack usage [-0, +1, m]
3741 if (err)
3742 {
3743 if (err == LUA_ERRSYNTAX)
3744 ERR("Lua load syntax error: %s",
3745 lua_tostring(L, -1)); // Stack usage [-0, +0, m]
3746 else if (err == LUA_ERRMEM)
3747 ERR("Lua load memory allocation error: %s",
3748 lua_tostring(L, -1)); // Stack usage [-0, +0, m]
3749 }
3750 free(data);
3751 /* This is not needed, pcalls don't longjmp(), that's why they are protected.
3752 if (setjmp(panic_jmp) == 1)
3753 {
3754 ERR("Lua script init panic");
3755 return;
3756 }
3757 */
3758 if ((err = lua_pcall(L, 0, 0, 0))) // Stack usage [-1, +0, -]
3759 _edje_lua2_error(L, err); // Stack usage [-0, +0, m]
3760 }
3761}
3762
3763void
3764_edje_lua2_script_shutdown(Edje *ed)
3765{
3766 if (!ed->L) return;
3767 lua_close(ed->L); // Stack usage irrelevant, as it's all gone now.
3768 ed->L = NULL;
3769 while (ed->lua_objs)
3770 {
3771 Edje_Lua_Obj *obj = (Edje_Lua_Obj *)ed->lua_objs;
3772 if (obj->free_func)
3773 {
3774 ERR("uncollected Lua object %p", obj);
3775 ed->lua_objs = eina_inlist_remove(ed->lua_objs, ed->lua_objs);
3776 }
3777 else
3778 {
3779 ERR("dangling Lua object %p", obj);
3780 ed->lua_objs = eina_inlist_remove(ed->lua_objs, ed->lua_objs);
3781 }
3782 }
3783
3784 if (0 <= _log_domain)
3785 {
3786 _log_count--;
3787 if (0 >= _log_count)
3788 {
3789 eina_log_domain_unregister(_log_domain);
3790 _log_domain = -1;
3791 }
3792 }
3793}
3794
3795void
3796_edje_lua2_script_load(Edje_Part_Collection *edc __UNUSED__, void *data __UNUSED__, int size __UNUSED__) // Stack usage [-16, +20, em]
3797{
3798#ifndef RASTER_FORGOT_WHY
3799 _elua_init(); // Stack usage [-16, +20, em]
3800#endif
3801}
3802
3803void
3804_edje_lua2_script_unload(Edje_Part_Collection *edc __UNUSED__) // Stack usage [-0, +0, e]
3805{
3806#ifndef RASTER_FORGOT_WHY
3807 lua_State *L;
3808
3809 if (!lstate) return;
3810 L = lstate;
3811 lua_gc(L, LUA_GCCOLLECT, 0); // Stack usage [-0, +0, e]
3812#endif
3813}
3814
3815void
3816_edje_lua2_error_full(const char *file, const char *fnc, int line,
3817 lua_State *L, int err_code) // Stack usage [-0, +0, m]
3818{
3819 const char *err_type;
3820
3821 switch (err_code)
3822 {
3823 case LUA_ERRRUN:
3824 err_type = "runtime";
3825 break;
3826 case LUA_ERRSYNTAX:
3827 err_type = "syntax";
3828 break;
3829 case LUA_ERRMEM:
3830 err_type = "memory allocation";
3831 break;
3832 case LUA_ERRERR:
3833 err_type = "error handler";
3834 break;
3835 default:
3836 err_type = "unknown";
3837 break;
3838 }
3839 eina_log_print
3840 (_edje_default_log_dom, EINA_LOG_LEVEL_ERR, file, fnc, line,
3841 "Lua %s error: %s", err_type, lua_tostring(L, -1)); // Stack usage [-0, +0, m]
3842}
3843
3844/**
3845@page luaref
3846@section callbacks Lua callbacks
3847
3848These are lua functions that are called by the lua edje system when certain
3849events occur. If the functions don't exist in the lua group, they don't get
3850called.
3851
3852 */
3853
3854/**
3855@page luaref
3856@subsection edje_shutdown Edje shutdown() callback.
3857
3858If a function called "shutdown" exists in a lua edje group, then it is called when
3859that edje gets deleted.
3860*/
3861void
3862_edje_lua2_script_func_shutdown(Edje *ed) // Stack usage [-1, +1, em]
3863{
3864 int err;
3865
3866 lua_getglobal(ed->L, "shutdown"); // Stack usage [-0, +1, e]
3867 if (!lua_isnil(ed->L, -1)) // Stack usage [-0, +0, -]
3868 {
3869 if ((err = lua_pcall(ed->L, 0, 0, 0))) // Stack usage [-1, +0, -]
3870 _edje_lua2_error(ed->L, err); // Stack usage [-0, +0, m]
3871 }
3872 else
3873 lua_pop(ed->L, 1); // Stack usage [-n, +0, -]
3874 _edje_lua2_script_shutdown(ed);
3875}
3876
3877/**
3878@page luaref
3879@subsection edje_show Edje show() callback.
3880
3881If a function called "show" exists in a lua edje group, then it is called when
3882that edje gets shown.
3883*/
3884void
3885_edje_lua2_script_func_show(Edje *ed) // Stack usage [-1, +1, e]
3886{
3887 int err;
3888
3889 lua_getglobal(ed->L, "show");
3890 if (!lua_isnil(ed->L, -1))
3891 {
3892 if ((err = lua_pcall(ed->L, 0, 0, 0)))
3893 _edje_lua2_error(ed->L, err);
3894 }
3895 else
3896 lua_pop(ed->L, 1);
3897}
3898
3899/**
3900@page luaref
3901@subsection edje_hide Edje hide() callback.
3902
3903If a function called "hide" exists in a lua edje group, then it is called when
3904that edje gets hidden.
3905*/
3906void
3907_edje_lua2_script_func_hide(Edje *ed) // Stack usage [-1, +1, e]
3908{
3909 int err;
3910
3911 lua_getglobal(ed->L, "hide");
3912 if (!lua_isnil(ed->L, -1))
3913 {
3914 if ((err = lua_pcall(ed->L, 0, 0, 0)))
3915 _edje_lua2_error(ed->L, err);
3916 }
3917 else
3918 lua_pop(ed->L, 1);
3919}
3920
3921/**
3922@page luaref
3923@subsection edje_move Edje move(x, y) callback.
3924
3925If a function called "move" exists in a lua edje group, then it is called when
3926that edje gets moved, with the new position passed to it.
3927*/
3928void
3929_edje_lua2_script_func_move(Edje *ed) // Stack usage [-3, +3, e] or [-1, +1, e] if no matching function.
3930{
3931 int err;
3932
3933 // FIXME: move all objects created by script
3934 lua_getglobal(ed->L, "move"); // Stack usage [-0, +1, e]
3935 if (!lua_isnil(ed->L, -1)) // Stack usage [-0, +0, -]
3936 {
3937 lua_pushinteger(ed->L, ed->x); // Stack usage [-0, +1, -]
3938 lua_pushinteger(ed->L, ed->y); // Stack usage [-0, +1, -]
3939 if ((err = lua_pcall(ed->L, 2, 0, 0))) // Stack usage [-3, +0, -]
3940 _edje_lua2_error(ed->L, err);
3941 }
3942 else
3943 lua_pop(ed->L, 1); // Stack usage [-n, +0, -]
3944}
3945
3946/**
3947@page luaref
3948@subsection edje_resize Edje resize(w, h) callback.
3949
3950If a function called "resize" exists in a lua edje group, then it is called when
3951that edje gets resized, with the new size passed to it.
3952*/
3953void
3954_edje_lua2_script_func_resize(Edje *ed) // Stack usage [-3, +3, e] or [-1, +1, e] if no matching function.
3955{
3956 int err;
3957
3958 lua_getglobal(ed->L, "resize");
3959 if (!lua_isnil(ed->L, -1))
3960 {
3961 lua_pushinteger(ed->L, ed->w);
3962 lua_pushinteger(ed->L, ed->h);
3963 if ((err = lua_pcall(ed->L, 2, 0, 0)))
3964 _edje_lua2_error(ed->L, err);
3965 }
3966 else
3967 lua_pop(ed->L, 1);
3968}
3969
3970/**
3971@page luaref
3972@subsection edje_message Edje message(id, type, ...) callback.
3973
3974If a function called "message" exists in a lua edje group, then it is called when
3975that edje gets gets a message sent to it, with the message details passed to it.
3976See edje:messagesend() for details of what each type means. The arrays are
3977passed as a table.
3978*/
3979void
3980_edje_lua2_script_func_message(Edje *ed, Edje_Message *em) // Stack usage [-?, +?, em] It's complicated, but it's even at least.
3981{
3982 int err, n, c, i;
3983
3984 lua_getglobal(ed->L, "message"); // Stack usage [-0, +1, e]
3985 if (!lua_isnil(ed->L, -1)) // Stack usage [-0, +0, -]
3986 {
3987 n = 2;
3988 lua_pushinteger(ed->L, em->id); // Stack usage [-0, +1, -]
3989 switch (em->type)
3990 {
3991 case EDJE_MESSAGE_NONE:
3992 lua_pushstring(ed->L, "none"); // Stack usage [-0, +1, m]
3993 break;
3994 case EDJE_MESSAGE_SIGNAL:
3995 break;
3996 case EDJE_MESSAGE_STRING:
3997 lua_pushstring(ed->L, "str"); // Stack usage [-0, +1, m]
3998 lua_pushstring(ed->L, ((Edje_Message_String *)em->msg)->str);
3999 // Stack usage [-0, +1, m]
4000 n += 1;
4001 break;
4002 case EDJE_MESSAGE_INT:
4003 lua_pushstring(ed->L, "int"); // Stack usage [-0, +1, m]
4004 lua_pushinteger(ed->L, ((Edje_Message_Int *)em->msg)->val);
4005 // Stack usage [-0, +1, -]
4006 n += 1;
4007 break;
4008 case EDJE_MESSAGE_FLOAT:
4009 lua_pushstring(ed->L, "float"); // Stack usage [-0, +1, m]
4010 lua_pushnumber(ed->L, ((Edje_Message_Float *)em->msg)->val);
4011 // Stack usage [-0, +1, -]
4012 n += 1;
4013 break;
4014 case EDJE_MESSAGE_STRING_SET:
4015 lua_pushstring(ed->L, "strset"); // Stack usage [-0, +1, m]
4016 c = ((Edje_Message_String_Set *)em->msg)->count;
4017 lua_createtable(ed->L, c, 0); // Stack usage [-0, +1, m]
4018 for (i = 0; i < c; i++)
4019 {
4020 lua_pushstring(ed->L, ((Edje_Message_String_Set *)em->msg)->str[i]);
4021 // Stack usage [-0, +1, m]
4022 // It's OK to bypass the metatable in these cases,
4023 // we create the table, and know there is no metatable. B-)
4024 lua_rawseti(ed->L, -2, i + 1); // Stack usage [-1, +0, m]
4025 }
4026 n += 1;
4027 break;
4028 case EDJE_MESSAGE_INT_SET:
4029 lua_pushstring(ed->L, "intset"); // Stack usage [-0, +1, m]
4030 c = ((Edje_Message_Int_Set *)em->msg)->count;
4031 lua_createtable(ed->L, c, 0); // Stack usage [-0, +1, m]
4032 for (i = 0; i < c; i++)
4033 {
4034 lua_pushinteger(ed->L, ((Edje_Message_Int_Set *)em->msg)->val[i]);
4035 // Stack usage [-0, +1, -]
4036 lua_rawseti(ed->L, -2, i + 1); // Stack usage [-1, +0, m]
4037 }
4038 n += 1;
4039 break;
4040 case EDJE_MESSAGE_FLOAT_SET:
4041 lua_pushstring(ed->L, "floatset"); // Stack usage [-0, +1, m]
4042 c = ((Edje_Message_Float_Set *)em->msg)->count;
4043 lua_createtable(ed->L, c, 0); // Stack usage [-0, +1, m]
4044 for (i = 0; i < c; i++)
4045 {
4046 lua_pushnumber(ed->L, ((Edje_Message_Float_Set *)em->msg)->val[i]);
4047 // Stack usage [-0, +1, -]
4048 lua_rawseti(ed->L, -2, i + 1); // Stack usage [-1, +0, m]
4049 }
4050 n += 1;
4051 break;
4052 case EDJE_MESSAGE_STRING_INT:
4053 lua_pushstring(ed->L, "strint"); // Stack usage [-0, +1, m]
4054 lua_pushstring(ed->L, ((Edje_Message_String_Int *)em->msg)->str);
4055 // Stack usage [-0, +1, m]
4056 lua_pushinteger(ed->L, ((Edje_Message_String_Int *)em->msg)->val);
4057 // Stack usage [-0, +1, -]
4058 n += 2;
4059 break;
4060 case EDJE_MESSAGE_STRING_FLOAT:
4061 lua_pushstring(ed->L, "strfloat"); // Stack usage [-0, +1, m]
4062 lua_pushstring(ed->L, ((Edje_Message_String_Float *)em->msg)->str);
4063 // Stack usage [-0, +1, m]
4064 lua_pushnumber(ed->L, ((Edje_Message_String_Float *)em->msg)->val);
4065 // Stack usage [-0, +1, -]
4066 n += 2;
4067 break;
4068 case EDJE_MESSAGE_STRING_INT_SET:
4069 lua_pushstring(ed->L, "strintset"); // Stack usage [-0, +1, m]
4070 lua_pushstring(ed->L, ((Edje_Message_String_Int_Set *)em->msg)->str);
4071 // Stack usage [-0, +1, m]
4072 c = ((Edje_Message_String_Int_Set *)em->msg)->count;
4073 lua_createtable(ed->L, c, 0); // Stack usage [-0, +1, m]
4074 for (i = 0; i < c; i++)
4075 {
4076 lua_pushinteger(ed->L, ((Edje_Message_String_Int_Set *)em->msg)->val[i]);
4077 // Stack usage [-0, +1, -]
4078 lua_rawseti(ed->L, -2, i + 1); // Stack usage [-1, +0, m]
4079 }
4080 n += 2;
4081 break;
4082 case EDJE_MESSAGE_STRING_FLOAT_SET:
4083 lua_pushstring(ed->L, "strfloatset"); // Stack usage [-0, +1, m]
4084 lua_pushstring(ed->L, ((Edje_Message_String_Float_Set *)em->msg)->str);
4085 // Stack usage [-0, +1, m]
4086 c = ((Edje_Message_String_Float_Set *)em->msg)->count;
4087 lua_createtable(ed->L, c, 0); // Stack usage [-0, +1, m]
4088 for (i = 0; i < c; i++)
4089 {
4090 lua_pushnumber(ed->L, ((Edje_Message_String_Float_Set *)em->msg)->val[i]);
4091 // Stack usage [-0, +1, -]
4092 lua_rawseti(ed->L, -2, i + 1); // Stack usage [-1, +0, m]
4093 }
4094 n += 2;
4095 break;
4096 default:
4097 break;
4098 }
4099 if ((err = lua_pcall(ed->L, n, 0, 0))) // Stack usage [-n+1, +0, -]
4100 _edje_lua2_error(ed->L, err);
4101 }
4102 else
4103 lua_pop(ed->L, 1); // Stack usage [-n, +0, -]
4104}
4105
4106/**
4107@page luaref
4108@subsection edje_signal Edje signal(signal, source) callback.
4109
4110If a function called "signal" exists in a lua edje group, then it is called when
4111ever a signal arrives, with the signal details passed to it.
4112
4113*/
4114void
4115_edje_lua2_script_func_signal(Edje *ed, const char *sig, const char *src) // Stack usage [-3, +3, em] or [-1, +1, e] if no matching function.
4116{
4117 int err;
4118
4119 lua_getglobal(ed->L, "signal");
4120 if (!lua_isnil(ed->L, -1))
4121 {
4122 lua_pushstring(ed->L, sig);
4123 lua_pushstring(ed->L, src);
4124 if ((err = lua_pcall(ed->L, 2, 0, 0)))
4125 _edje_lua2_error(ed->L, err);
4126 }
4127 else
4128 lua_pop(ed->L, 1);
4129}
diff --git a/libraries/edje/src/lib/edje_lua_script_only.c b/libraries/edje/src/lib/edje_lua_script_only.c
new file mode 100644
index 0000000..e283c83
--- /dev/null
+++ b/libraries/edje/src/lib/edje_lua_script_only.c
@@ -0,0 +1,59 @@
1#include "edje_private.h"
2
3Eina_Bool
4_edje_lua_script_only(Edje *ed)
5{
6 if ((ed->collection) && (ed->collection->lua_script_only))
7 return EINA_TRUE;
8 return EINA_FALSE;
9}
10
11void
12_edje_lua_script_only_init(Edje *ed)
13{
14 if (ed->collection)
15 _edje_lua2_script_init(ed);
16}
17
18void
19_edje_lua_script_only_shutdown(Edje *ed)
20{
21 if (ed->collection && ed->L)
22 _edje_lua2_script_func_shutdown(ed);
23}
24
25void
26_edje_lua_script_only_show(Edje * ed)
27{
28 if (ed->collection && ed->L)
29 _edje_lua2_script_func_show(ed);
30}
31
32void
33_edje_lua_script_only_hide(Edje * ed)
34{
35 if (ed->collection && ed->L)
36 _edje_lua2_script_func_hide(ed);
37}
38
39void
40_edje_lua_script_only_move(Edje * ed)
41{
42 if (ed->collection && ed->L)
43 _edje_lua2_script_func_move(ed);
44}
45
46void
47_edje_lua_script_only_resize(Edje * ed)
48{
49 if (ed->collection && ed->L)
50 _edje_lua2_script_func_resize(ed);
51}
52
53void
54_edje_lua_script_only_message(Edje * ed, Edje_Message * em)
55{
56 if (ed->collection && ed->L)
57 _edje_lua2_script_func_message(ed, em);
58}
59
diff --git a/libraries/edje/src/lib/edje_main.c b/libraries/edje/src/lib/edje_main.c
new file mode 100644
index 0000000..cf443c7
--- /dev/null
+++ b/libraries/edje/src/lib/edje_main.c
@@ -0,0 +1,274 @@
1#include "edje_private.h"
2
3static Edje_Version _version = { VMAJ, VMIN, VMIC, VREV };
4EAPI Edje_Version *edje_version = &_version;
5
6static int _edje_init_count = 0;
7int _edje_default_log_dom = -1;
8Eina_Mempool *_edje_real_part_mp = NULL;
9Eina_Mempool *_edje_real_part_state_mp = NULL;
10
11/*============================================================================*
12 * API *
13 *============================================================================*/
14
15
16EAPI int
17edje_init(void)
18{
19 if (++_edje_init_count != 1)
20 return _edje_init_count;
21
22 srand(time(NULL));
23
24 if (!eina_init())
25 {
26 fprintf(stderr, "Edje: Eina init failed");
27 return --_edje_init_count;
28 }
29
30 _edje_default_log_dom = eina_log_domain_register
31 ("edje", EDJE_DEFAULT_LOG_COLOR);
32 if (_edje_default_log_dom < 0)
33 {
34 EINA_LOG_ERR("Edje Can not create a general log domain.");
35 goto shutdown_eina;
36 }
37
38 if (!ecore_init())
39 {
40 ERR("Ecore init failed");
41 goto unregister_log_domain;
42 }
43
44 if (!embryo_init())
45 {
46 ERR("Embryo init failed");
47 goto shutdown_ecore;
48 }
49
50 if (!eet_init())
51 {
52 ERR("Eet init failed");
53 goto shutdown_embryo;
54 }
55
56 _edje_scale = FROM_DOUBLE(1.0);
57
58 _edje_edd_init();
59 _edje_text_init();
60 _edje_box_init();
61 _edje_external_init();
62 _edje_module_init();
63 _edje_message_init();
64 _edje_multisense_init();
65
66 _edje_real_part_mp = eina_mempool_add("chained_mempool",
67 "Edje_Real_Part", NULL,
68 sizeof (Edje_Real_Part), 128);
69 if (!_edje_real_part_mp)
70 {
71 ERR("Mempool for Edje_Real_Part cannot be allocated.");
72 goto shutdown_eet;
73 }
74
75 _edje_real_part_state_mp = eina_mempool_add("chained_mempool",
76 "Edje_Real_Part_State", NULL,
77 sizeof (Edje_Real_Part_State), 256);
78 if (!_edje_real_part_state_mp)
79 {
80 ERR("Mempool for Edje_Real_Part_State cannot be allocated.");
81 goto shutdown_eet;
82 }
83
84 return _edje_init_count;
85
86 shutdown_eet:
87 eina_mempool_del(_edje_real_part_state_mp);
88 eina_mempool_del(_edje_real_part_mp);
89 _edje_real_part_state_mp = NULL;
90 _edje_real_part_mp = NULL;
91 _edje_message_shutdown();
92 _edje_module_shutdown();
93 _edje_external_shutdown();
94 _edje_box_shutdown();
95 _edje_text_class_members_free();
96 _edje_text_class_hash_free();
97 _edje_edd_shutdown();
98 eet_shutdown();
99 shutdown_embryo:
100 embryo_shutdown();
101 shutdown_ecore:
102 ecore_shutdown();
103 unregister_log_domain:
104 eina_log_domain_unregister(_edje_default_log_dom);
105 _edje_default_log_dom = -1;
106 shutdown_eina:
107 eina_shutdown();
108 return --_edje_init_count;
109}
110
111static int _edje_users = 0;
112
113static void
114_edje_shutdown_core(void)
115{
116 if (_edje_users > 0) return;
117
118 _edje_file_cache_shutdown();
119 _edje_color_class_members_free();
120 _edje_color_class_hash_free();
121
122 eina_mempool_del(_edje_real_part_state_mp);
123 eina_mempool_del(_edje_real_part_mp);
124 _edje_real_part_state_mp = NULL;
125 _edje_real_part_mp = NULL;
126
127 _edje_multisense_shutdown();
128 _edje_message_shutdown();
129 _edje_module_shutdown();
130 _edje_external_shutdown();
131 _edje_box_shutdown();
132 _edje_text_class_members_free();
133 _edje_text_class_hash_free();
134 _edje_edd_shutdown();
135
136 eet_shutdown();
137 embryo_shutdown();
138 ecore_shutdown();
139 eina_log_domain_unregister(_edje_default_log_dom);
140 _edje_default_log_dom = -1;
141 eina_shutdown();
142}
143
144void
145_edje_lib_ref(void)
146{
147 _edje_users++;
148}
149
150void
151_edje_lib_unref(void)
152{
153 _edje_users--;
154 if (_edje_users != 0) return;
155 if (_edje_init_count == 0) _edje_shutdown_core();
156}
157
158EAPI int
159edje_shutdown(void)
160{
161 if (--_edje_init_count != 0)
162 return _edje_init_count;
163
164 if (_edje_timer)
165 ecore_animator_del(_edje_timer);
166 _edje_timer = NULL;
167
168 _edje_shutdown_core();
169
170 return _edje_init_count;
171}
172
173/* Private Routines */
174static Eina_Bool
175_class_member_free(const Eina_Hash *hash __UNUSED__,
176 const void *key,
177 void *data,
178 void *fdata)
179{
180 void (*_edje_class_member_direct_del)(const char *class, void *l) = fdata;
181
182 _edje_class_member_direct_del(key, data);
183 return EINA_TRUE;
184}
185
186void
187_edje_del(Edje *ed)
188{
189 Edje_Running_Program *runp;
190 Edje_Pending_Program *pp;
191 Edje_Signal_Callback *escb;
192 Edje_Color_Class *cc;
193 Edje_Text_Class *tc;
194 Edje_Text_Insert_Filter_Callback *cb;
195
196 if (ed->processing_messages)
197 {
198 ed->delete_me = 1;
199 return;
200 }
201 _edje_message_del(ed);
202 _edje_callbacks_patterns_clean(ed);
203 _edje_file_del(ed);
204 if (ed->path) eina_stringshare_del(ed->path);
205 if (ed->group) eina_stringshare_del(ed->group);
206 if (ed->parent) eina_stringshare_del(ed->parent);
207 ed->path = NULL;
208 ed->group = NULL;
209 if ((ed->actions) || (ed->pending_actions))
210 {
211 _edje_animators = eina_list_remove(_edje_animators, ed);
212 }
213 EINA_LIST_FREE(ed->actions, runp)
214 free(runp);
215 EINA_LIST_FREE(ed->pending_actions, pp)
216 free(pp);
217 EINA_LIST_FREE(ed->callbacks, escb)
218 {
219 if (escb->signal) eina_stringshare_del(escb->signal);
220 if (escb->source) eina_stringshare_del(escb->source);
221 free(escb);
222 }
223 EINA_LIST_FREE(ed->color_classes, cc)
224 {
225 if (cc->name) eina_stringshare_del(cc->name);
226 free(cc);
227 }
228 EINA_LIST_FREE(ed->text_classes, tc)
229 {
230 if (tc->name) eina_stringshare_del(tc->name);
231 if (tc->font) eina_stringshare_del(tc->font);
232 free(tc);
233 }
234 EINA_LIST_FREE(ed->text_insert_filter_callbacks, cb)
235 {
236 eina_stringshare_del(cb->part);
237 free(cb);
238 }
239
240 if (ed->members.text_class)
241 {
242 eina_hash_foreach(ed->members.text_class, _class_member_free, _edje_text_class_member_direct_del);
243 eina_hash_free(ed->members.text_class);
244 }
245 if (ed->members.color_class)
246 {
247 eina_hash_foreach(ed->members.color_class, _class_member_free, _edje_color_class_member_direct_del);
248 eina_hash_free(ed->members.color_class);
249 }
250 free(ed);
251}
252
253void
254_edje_clean_objects(Edje *ed)
255{
256 evas_object_del(ed->base.clipper);
257 ed->base.evas = NULL;
258 ed->obj = NULL;
259 ed->base.clipper = NULL;
260}
261
262void
263_edje_ref(Edje *ed)
264{
265 if (ed->references <= 0) return;
266 ed->references++;
267}
268
269void
270_edje_unref(Edje *ed)
271{
272 ed->references--;
273 if (ed->references == 0) _edje_del(ed);
274}
diff --git a/libraries/edje/src/lib/edje_match.c b/libraries/edje/src/lib/edje_match.c
new file mode 100644
index 0000000..f113f7b
--- /dev/null
+++ b/libraries/edje/src/lib/edje_match.c
@@ -0,0 +1,814 @@
1#include "edje_private.h"
2
3/* States manipulations. */
4
5typedef struct _Edje_State Edje_State;
6struct _Edje_State
7{
8 size_t idx;
9 size_t pos;
10};
11
12struct _Edje_States
13{
14 size_t size;
15 Edje_State *states;
16 Eina_Bool *has;
17};
18
19static void
20_edje_match_states_free(Edje_States *states,
21 size_t states_size)
22{
23 (void) states_size;
24 free(states);
25}
26
27#define ALIGN(Size) \
28 { \
29 Size--; \
30 Size |= sizeof (void*) - 1; \
31 Size++; \
32 };
33
34static int
35_edje_match_states_alloc(Edje_Patterns *ppat, int n)
36{
37 Edje_States *l;
38
39 const size_t patterns_size = ppat->patterns_size;
40 const size_t patterns_max_length = ppat->max_length;
41
42 const size_t array_len = (patterns_max_length + 1) * patterns_size;
43
44 size_t states_size;
45 size_t has_size;
46 size_t states_has_size;
47 size_t struct_size;
48
49 unsigned char *states;
50 unsigned char *has;
51
52 int i;
53
54 states_size = sizeof (*l->states) * array_len;
55 ALIGN(states_size);
56
57 has_size = sizeof (*l->has) * array_len;
58 ALIGN(has_size);
59
60 states_has_size = states_size + has_size;
61
62 struct_size = sizeof (*l);
63 ALIGN(struct_size);
64 struct_size += states_has_size;
65
66 l = malloc(n * struct_size);
67 if (!l) return 0;
68
69 ppat->states = l;
70 ppat->states->size = 0;
71
72 states = (unsigned char *) (l + n);
73 has = states + states_size;
74
75 for (i = 0; i < n; ++i)
76 {
77 l[i].states = (Edje_State *) states;
78 l[i].has = (Eina_Bool *) has;
79 l[i].size = 0;
80
81 memset(l[i].has, 0, has_size);
82
83 states += states_has_size;
84 has += states_has_size;
85 }
86
87 return 1;
88}
89
90static void
91_edje_match_states_insert(Edje_States *list,
92 size_t patterns_max_length,
93 size_t idx,
94 size_t pos)
95{
96 size_t i;
97
98 i = (idx * (patterns_max_length + 1)) + pos;
99
100 if (i < list->size)
101 {
102 if (list->has[i]) return;
103 }
104 list->has[i] = 1;
105
106 i = list->size;
107 list->states[i].idx = idx;
108 list->states[i].pos = pos;
109 list->has[i] = 0;
110 list->size++;
111}
112
113static void
114_edje_match_states_clear(Edje_States *list,
115 __UNUSED__ size_t patterns_size,
116 __UNUSED__ size_t patterns_max_length)
117{
118 list->size = 0;
119}
120
121/* Token manipulation. */
122
123enum status
124{
125 patterns_not_found = 0,
126 patterns_found = 1,
127 patterns_syntax_error = 2
128};
129
130static size_t
131_edje_match_patterns_exec_class_token(enum status *status,
132 const char *cl_tok,
133 char c)
134{
135 if (! *cl_tok)
136 {
137 *status = patterns_syntax_error;
138 return 0;
139 }
140 else if (cl_tok[1] == '-' && cl_tok[2] != ']')
141 {
142 if (*cl_tok <= c && c <= cl_tok[2])
143 *status = patterns_found;
144 return 3;
145 }
146 else
147 {
148 if (c == *cl_tok)
149 *status = patterns_found;
150 return 1;
151 }
152}
153
154static Edje_Match_Error
155_edje_match_patterns_exec_class_complement(const char *cl_tok, size_t *ret)
156{
157 switch (*cl_tok)
158 {
159 case 0:
160 return EDJE_MATCH_SYNTAX_ERROR;
161
162 case '!':
163 *ret = 1;
164 return EDJE_MATCH_OK;
165
166 default:
167 *ret = 0;
168 return EDJE_MATCH_OK;
169 }
170}
171
172static Edje_Match_Error
173_edje_match_patterns_exec_class(const char *cl,
174 char c,
175 size_t *ret)
176{
177 enum status status = patterns_not_found;
178 int pos = 1;
179 size_t neg;
180
181 if (_edje_match_patterns_exec_class_complement(cl + 1, &neg) != EDJE_MATCH_OK)
182 return EDJE_MATCH_SYNTAX_ERROR;
183
184 pos += neg;
185
186 do
187 {
188 pos += _edje_match_patterns_exec_class_token(&status, cl + pos, c);
189 }
190 while (cl[pos] && cl[pos] != ']');
191
192 if (status == patterns_syntax_error || ! cl[pos])
193 return EDJE_MATCH_SYNTAX_ERROR;
194
195 if (status == patterns_found)
196 *ret = neg ? 0 : pos + 1;
197 else
198 *ret = neg ? pos + 1 : 0;
199
200 return EDJE_MATCH_OK;
201}
202
203static Edje_Match_Error
204_edje_match_patterns_exec_token(const char *tok,
205 char c,
206 size_t *ret)
207{
208 switch (*tok)
209 {
210 case '\\':
211 if (tok[1])
212 {
213 *ret = tok[1] == c ? 2 : 0;
214 return EDJE_MATCH_OK;
215 }
216 return EDJE_MATCH_SYNTAX_ERROR;
217
218 case '?':
219 *ret = 1;
220 return EDJE_MATCH_OK;
221
222 case '[':
223 return _edje_match_patterns_exec_class(tok, c, ret);
224
225 default:
226 *ret = *tok == c ? 1 : 0;
227 return EDJE_MATCH_OK;
228 }
229}
230
231static void
232_edje_match_patterns_exec_init_states(Edje_States *states,
233 size_t patterns_size,
234 size_t patterns_max_length)
235{
236 size_t i;
237
238 states->size = patterns_size;
239
240 for (i = 0; i < patterns_size; ++i)
241 {
242 states->states[i].idx = i;
243 states->states[i].pos = 0;
244 states->has[i * (patterns_max_length + 1)] = 1;
245 }
246}
247
248/* Exported function. */
249
250#define EDJE_MATCH_INIT_LIST(Func, Type, Source, Show) \
251 Edje_Patterns* \
252 Func(const Eina_List *lst) \
253 { \
254 Edje_Patterns *r; \
255 size_t i; \
256 \
257 if (!lst || eina_list_count(lst) <= 0) \
258 return NULL; \
259 \
260 r = malloc(sizeof (Edje_Patterns) + \
261 eina_list_count(lst) \
262 * sizeof(*r->finals) \
263 * sizeof(*r->patterns)); \
264 if (!r) return NULL; \
265 \
266 r->ref = 1; \
267 r->delete_me = 0; \
268 r->patterns_size = eina_list_count(lst); \
269 r->max_length = 0; \
270 r->patterns = (const char **) r->finals + r->patterns_size + 1; \
271 \
272 for (i = 0; lst; ++i) \
273 { \
274 const char *str; \
275 Type *data; \
276 size_t j; \
277 int special = 0; \
278 \
279 data = eina_list_data_get(lst); \
280 if (!data) \
281 { \
282 free(r); \
283 return NULL; \
284 } \
285 \
286 str = data->Source; \
287 if (!str) str = ""; \
288 r->patterns[i] = str; \
289 \
290 if (Show) \
291 INF("%lu [%s]", (unsigned long)i, str); \
292 \
293 r->finals[i] = 0; \
294 for (j = 0; str[j]; ++j) \
295 if (str[j] != '*') \
296 { \
297 r->finals[i] = j + 1; \
298 special++; \
299 } \
300 j += special ? special + 1 : 0; \
301 \
302 if (j > r->max_length) \
303 r->max_length = j; \
304 \
305 lst = eina_list_next(lst); \
306 } \
307 \
308 if (!_edje_match_states_alloc(r, 2)) \
309 { \
310 free(r); \
311 return NULL; \
312 } \
313 \
314 return r; \
315 }
316
317#define EDJE_MATCH_INIT_ARRAY(Func, Type, Source, Show) \
318 Edje_Patterns* \
319 Func(Type * const *lst, unsigned int count) \
320 { \
321 Edje_Patterns *r; \
322 size_t i; \
323 \
324 if (!lst || count == 0) \
325 return NULL; \
326 \
327 r = malloc(sizeof (Edje_Patterns) + \
328 count \
329 * sizeof(*r->finals) \
330 * sizeof(*r->patterns)); \
331 if (!r) return NULL; \
332 \
333 r->ref = 1; \
334 r->delete_me = 0; \
335 r->patterns_size = count; \
336 r->max_length = 0; \
337 r->patterns = (const char **) r->finals + r->patterns_size + 1; \
338 \
339 for (i = 0; i < count; ++i) \
340 { \
341 const char *str; \
342 size_t j; \
343 int special = 0; \
344 \
345 if (!lst[i]) \
346 { \
347 free(r); \
348 return NULL; \
349 } \
350 \
351 str = lst[i]->Source; \
352 if (!str) str = ""; \
353 r->patterns[i] = str; \
354 \
355 if (Show) \
356 INF("%lu [%s]", (unsigned long)i, str); \
357 \
358 r->finals[i] = 0; \
359 for (j = 0; str[j]; ++j) \
360 if (str[j] != '*') \
361 { \
362 r->finals[i] = j + 1; \
363 special++; \
364 } \
365 j += special ? special + 1 : 0; \
366 \
367 if (j > r->max_length) \
368 r->max_length = j; \
369 } \
370 \
371 if (!_edje_match_states_alloc(r, 2)) \
372 { \
373 free(r); \
374 return NULL; \
375 } \
376 \
377 return r; \
378 }
379
380EDJE_MATCH_INIT_LIST(edje_match_collection_dir_init,
381 Edje_Part_Collection_Directory_Entry,
382 entry, 0);
383EDJE_MATCH_INIT_ARRAY(edje_match_programs_signal_init,
384 Edje_Program,
385 signal, 0);
386EDJE_MATCH_INIT_ARRAY(edje_match_programs_source_init,
387 Edje_Program,
388 source, 0);
389EDJE_MATCH_INIT_LIST(edje_match_callback_signal_init,
390 Edje_Signal_Callback,
391 signal, 0);
392EDJE_MATCH_INIT_LIST(edje_match_callback_source_init,
393 Edje_Signal_Callback,
394 source, 0);
395
396static Eina_Bool
397_edje_match_collection_dir_exec_finals(const size_t *finals,
398 const Edje_States *states)
399{
400 size_t i;
401
402 for (i = 0; i < states->size; ++i)
403 {
404 if (states->states[i].pos >= finals[states->states[i].idx])
405 return EINA_TRUE;
406 }
407 return EINA_FALSE;
408}
409
410static Eina_Bool
411edje_match_programs_exec_check_finals(const size_t *signal_finals,
412 const size_t *source_finals,
413 const Edje_States *signal_states,
414 const Edje_States *source_states,
415 Edje_Program **programs,
416 Eina_Bool (*func)(Edje_Program *pr, void *data),
417 void *data,
418 Eina_Bool prop __UNUSED__)
419{
420 size_t i;
421 size_t j;
422
423 /* when not enought memory, they could be NULL */
424 if (!signal_finals || !source_finals) return EINA_TRUE;
425
426 for (i = 0; i < signal_states->size; ++i)
427 {
428 if (signal_states->states[i].pos >= signal_finals[signal_states->states[i].idx])
429 {
430 for (j = 0; j < source_states->size; ++j)
431 {
432 if (signal_states->states[i].idx == source_states->states[j].idx
433 && source_states->states[j].pos >= source_finals[source_states->states[j].idx])
434 {
435 Edje_Program *pr;
436
437 pr = programs[signal_states->states[i].idx];
438 if (pr)
439 {
440 if (func(pr, data))
441 return EINA_FALSE;
442 }
443 }
444 }
445 }
446 }
447
448 return EINA_TRUE;
449}
450
451static int
452edje_match_callback_exec_check_finals(const Edje_Patterns *singal_ppat,
453 const Edje_Patterns *source_ppat,
454 const size_t *signal_finals,
455 const size_t *source_finals,
456 const Edje_States *signal_states,
457 const Edje_States *source_states,
458 const char *sig,
459 const char *source,
460 Eina_List *callbacks,
461 Edje *ed,
462 Eina_Bool prop
463 )
464{
465 size_t i;
466 size_t j;
467 int r = 1;
468
469 for (i = 0; i < signal_states->size; ++i)
470 {
471 if (signal_states->states[i].pos >= signal_finals[signal_states->states[i].idx])
472 {
473 for (j = 0; j < source_states->size; ++j)
474 {
475 if (signal_states->states[i].idx == source_states->states[j].idx
476 && source_states->states[j].pos >= source_finals[source_states->states[j].idx])
477 {
478 Edje_Signal_Callback *escb;
479
480 escb = eina_list_nth(callbacks, signal_states->states[i].idx);
481 if (escb)
482 {
483 if ((prop) && (escb->propagate)) continue;
484 if ((!escb->just_added)
485 && (!escb->delete_me))
486 {
487 escb->func(escb->data, ed->obj, sig, source);
488 r = 2;
489 }
490 if (_edje_block_break(ed))
491 return 0;
492 if ((singal_ppat->delete_me) || (source_ppat->delete_me))
493 return 0;
494 }
495 }
496 }
497 }
498 }
499
500 return r;
501}
502
503
504static Edje_States*
505_edje_match_fn(const Edje_Patterns *ppat,
506 const char *string,
507 Edje_States *states)
508{
509 Edje_States *new_states = states + 1;
510 const char *c;
511
512 for (c = string; *c && states->size; ++c)
513 {
514 size_t i;
515
516 _edje_match_states_clear(new_states, ppat->patterns_size, ppat->max_length);
517
518 for (i = 0; i < states->size; ++i)
519 {
520 const size_t idx = states->states[i].idx;
521 const size_t pos = states->states[i].pos;
522
523 if (!ppat->patterns[idx][pos])
524 continue;
525 else if (ppat->patterns[idx][pos] == '*')
526 {
527 _edje_match_states_insert(states, ppat->max_length, idx, pos + 1);
528 _edje_match_states_insert(new_states, ppat->max_length, idx, pos);
529 }
530 else
531 {
532 size_t m;
533
534 if (_edje_match_patterns_exec_token(ppat->patterns[idx] + pos,
535 *c,
536 &m) != EDJE_MATCH_OK)
537 return NULL;
538
539 if (m)
540 _edje_match_states_insert(new_states, ppat->max_length, idx, pos + m);
541 }
542 }
543 {
544 Edje_States *tmp = states;
545
546 states = new_states;
547 new_states = tmp;
548 }
549 }
550
551 return states;
552}
553
554Eina_Bool
555edje_match_collection_dir_exec(const Edje_Patterns *ppat,
556 const char *string)
557{
558 Edje_States *result;
559 Eina_Bool r = EINA_FALSE;
560
561 /* under high memory presure, it could be NULL */
562 if (!ppat) return EINA_FALSE;
563
564 _edje_match_patterns_exec_init_states(ppat->states, ppat->patterns_size, ppat->max_length);
565
566 result = _edje_match_fn(ppat, string, ppat->states);
567
568 if (result)
569 r = _edje_match_collection_dir_exec_finals(ppat->finals, result);
570
571 return r;
572}
573
574Eina_Bool
575edje_match_programs_exec(const Edje_Patterns *ppat_signal,
576 const Edje_Patterns *ppat_source,
577 const char *sig,
578 const char *source,
579 Edje_Program **programs,
580 Eina_Bool (*func)(Edje_Program *pr, void *data),
581 void *data,
582 Eina_Bool prop)
583{
584 Edje_States *signal_result;
585 Edje_States *source_result;
586 Eina_Bool r = EINA_FALSE;
587
588 /* under high memory presure, they could be NULL */
589 if (!ppat_source || !ppat_signal) return EINA_FALSE;
590
591 _edje_match_patterns_exec_init_states(ppat_signal->states,
592 ppat_signal->patterns_size,
593 ppat_signal->max_length);
594 _edje_match_patterns_exec_init_states(ppat_source->states,
595 ppat_source->patterns_size,
596 ppat_source->max_length);
597
598 signal_result = _edje_match_fn(ppat_signal, sig, ppat_signal->states);
599 source_result = _edje_match_fn(ppat_source, source, ppat_source->states);
600
601 if (signal_result && source_result)
602 r = edje_match_programs_exec_check_finals(ppat_signal->finals,
603 ppat_source->finals,
604 signal_result,
605 source_result,
606 programs,
607 func,
608 data,
609 prop);
610 return r;
611}
612
613int
614edje_match_callback_exec(Edje_Patterns *ppat_signal,
615 Edje_Patterns *ppat_source,
616 const char *sig,
617 const char *source,
618 Eina_List *callbacks,
619 Edje *ed,
620 Eina_Bool prop
621 )
622{
623 Edje_States *signal_result;
624 Edje_States *source_result;
625 int r = 0;
626
627 /* under high memory presure, they could be NULL */
628 if (!ppat_source || !ppat_signal) return 0;
629
630 ppat_signal->ref++;
631 ppat_source->ref++;
632 _edje_match_patterns_exec_init_states(ppat_signal->states,
633 ppat_signal->patterns_size,
634 ppat_signal->max_length);
635 _edje_match_patterns_exec_init_states(ppat_source->states,
636 ppat_source->patterns_size,
637 ppat_source->max_length);
638
639 signal_result = _edje_match_fn(ppat_signal, sig, ppat_signal->states);
640 source_result = _edje_match_fn(ppat_source, source, ppat_source->states);
641
642 if (signal_result && source_result)
643 r = edje_match_callback_exec_check_finals(ppat_signal,
644 ppat_source,
645 ppat_signal->finals,
646 ppat_source->finals,
647 signal_result,
648 source_result,
649 sig,
650 source,
651 callbacks,
652 ed,
653 prop);
654 ppat_signal->ref--;
655 ppat_source->ref--;
656 if (ppat_signal->ref <= 0) edje_match_patterns_free(ppat_signal);
657 if (ppat_source->ref <= 0) edje_match_patterns_free(ppat_source);
658 return r;
659}
660
661void
662edje_match_patterns_free(Edje_Patterns *ppat)
663{
664 if (!ppat) return ;
665
666 ppat->delete_me = 1;
667 ppat->ref--;
668 if (ppat->ref > 0) return;
669 _edje_match_states_free(ppat->states, 2);
670 free(ppat);
671}
672
673void
674_edje_signals_sources_patterns_clean(Edje_Signals_Sources_Patterns *ssp)
675{
676 if (!ssp->signals_patterns)
677 return;
678
679 edje_match_patterns_free(ssp->signals_patterns);
680 edje_match_patterns_free(ssp->sources_patterns);
681 ssp->signals_patterns = NULL;
682 ssp->sources_patterns = NULL;
683}
684
685static Eina_Rbtree_Direction
686_edje_signal_source_node_cmp(const Edje_Signal_Source_Char *n1,
687 const Edje_Signal_Source_Char *n2,
688 __UNUSED__ void *data)
689{
690 int cmp;
691
692 cmp = strcmp(n1->signal, n2->signal);
693 if (cmp) return cmp < 0 ? EINA_RBTREE_LEFT : EINA_RBTREE_RIGHT;
694
695 return strcmp(n1->source, n2->source) < 0 ? EINA_RBTREE_LEFT : EINA_RBTREE_RIGHT;
696}
697
698static int
699_edje_signal_source_key_cmp(const Edje_Signal_Source_Char *node,
700 const char *sig,
701 __UNUSED__ int length,
702 const char *source)
703{
704 int cmp;
705
706 cmp = strcmp(node->signal, sig);
707 if (cmp) return cmp;
708
709 return strcmp(node->source, source);
710}
711
712
713Eina_List *
714edje_match_program_hash_build(Edje_Program * const *programs,
715 unsigned int count,
716 Eina_Rbtree **tree)
717{
718 Eina_List *result = NULL;
719 Eina_Rbtree *new = NULL;
720 unsigned int i;
721
722 for (i = 0; i < count; ++i)
723 {
724 if (programs[i]->signal && !strpbrk(programs[i]->signal, "*?[\\")
725 && programs[i]->source && !strpbrk(programs[i]->source, "*?[\\"))
726 {
727 Edje_Signal_Source_Char *item;
728
729 item = (Edje_Signal_Source_Char*) eina_rbtree_inline_lookup(new, programs[i]->signal, 0,
730 EINA_RBTREE_CMP_KEY_CB(_edje_signal_source_key_cmp), programs[i]->source);
731 if (!item)
732 {
733 item = malloc(sizeof (Edje_Signal_Source_Char));
734 if (!item) continue;
735
736 item->signal = programs[i]->signal;
737 item->source = programs[i]->source;
738 item->list = NULL;
739
740 new = eina_rbtree_inline_insert(new, EINA_RBTREE_GET(item),
741 EINA_RBTREE_CMP_NODE_CB(_edje_signal_source_node_cmp), NULL);
742 }
743
744 item->list = eina_list_prepend(item->list, programs[i]);
745 }
746 else
747 result = eina_list_prepend(result, programs[i]);
748 }
749
750 *tree = new;
751 return result;
752}
753
754Eina_List *
755edje_match_callback_hash_build(const Eina_List *callbacks,
756 Eina_Rbtree **tree)
757{
758 Eina_List *result = NULL;
759 Eina_Rbtree *new = NULL;
760 Edje_Signal_Callback *callback;
761 const Eina_List *l;
762
763 EINA_LIST_FOREACH(callbacks, l, callback)
764 {
765 if (callback->signal && !strpbrk(callback->signal, "*?[\\")
766 && callback->source && !strpbrk(callback->source, "*?[\\"))
767 {
768 Edje_Signal_Source_Char *item;
769
770 item = (Edje_Signal_Source_Char*) eina_rbtree_inline_lookup(new, callback->signal, 0,
771 EINA_RBTREE_CMP_KEY_CB(_edje_signal_source_key_cmp), callback->source);
772 if (!item)
773 {
774 item = malloc(sizeof (Edje_Signal_Source_Char));
775 if (!item) continue;
776
777 item->signal = callback->signal;
778 item->source = callback->source;
779 item->list = NULL;
780
781 new = eina_rbtree_inline_insert(new, EINA_RBTREE_GET(item),
782 EINA_RBTREE_CMP_NODE_CB(_edje_signal_source_node_cmp), NULL);
783 }
784
785 item->list = eina_list_prepend(item->list, callback);
786 }
787 else
788 result = eina_list_prepend(result, callback);
789 }
790
791 *tree = new;
792 return result;
793}
794
795const Eina_List *
796edje_match_signal_source_hash_get(const char *sig,
797 const char *source,
798 const Eina_Rbtree *tree)
799{
800 Edje_Signal_Source_Char *lookup;
801
802 lookup = (Edje_Signal_Source_Char*) eina_rbtree_inline_lookup(tree, sig, 0,
803 EINA_RBTREE_CMP_KEY_CB(_edje_signal_source_key_cmp), source);
804
805 if (lookup) return lookup->list;
806 return NULL;
807}
808
809void
810edje_match_signal_source_free(Edje_Signal_Source_Char *key, __UNUSED__ void *data)
811{
812 eina_list_free(key->list);
813 free(key);
814}
diff --git a/libraries/edje/src/lib/edje_message_queue.c b/libraries/edje/src/lib/edje_message_queue.c
new file mode 100644
index 0000000..1a313a5
--- /dev/null
+++ b/libraries/edje/src/lib/edje_message_queue.c
@@ -0,0 +1,865 @@
1#include "edje_private.h"
2
3static void _edje_object_message_popornot_send(Evas_Object *obj, Edje_Message_Type type, int id, void *msg, Eina_Bool prop);
4
5static int _injob = 0;
6static Ecore_Job *_job = NULL;
7static Ecore_Timer *_job_loss_timer = NULL;
8
9static Eina_List *msgq = NULL;
10static Eina_List *tmp_msgq = NULL;
11static int tmp_msgq_processing = 0;
12static int tmp_msgq_restart = 0;
13
14/*============================================================================*
15 * API *
16 *============================================================================*/
17
18static void
19_edje_object_message_popornot_send(Evas_Object *obj, Edje_Message_Type type, int id, void *msg, Eina_Bool prop)
20{
21 Edje *ed;
22 Eina_List *l;
23 Evas_Object *o;
24
25 ed = _edje_fetch(obj);
26 if (!ed) return;
27 _edje_message_propornot_send(ed, EDJE_QUEUE_SCRIPT, type, id, msg, prop);
28 EINA_LIST_FOREACH(ed->subobjs, l, o)
29 {
30 _edje_object_message_popornot_send(o, type, id, msg, EINA_TRUE);
31 }
32}
33
34EAPI void
35edje_object_message_send(Evas_Object *obj, Edje_Message_Type type, int id, void *msg)
36{
37 _edje_object_message_popornot_send(obj, type, id, msg, EINA_FALSE);
38}
39
40
41EAPI void
42edje_object_message_handler_set(Evas_Object *obj, Edje_Message_Handler_Cb func, void *data)
43{
44 Edje *ed;
45
46 ed = _edje_fetch(obj);
47 if (!ed) return;
48 _edje_message_cb_set(ed, func, data);
49}
50
51
52EAPI void
53edje_object_message_signal_process(Evas_Object *obj)
54{
55 Eina_List *l, *ln, *tmpq = NULL;
56 Edje *ed;
57 Edje_Message *em;
58 int gotos = 0;
59
60 ed = _edje_fetch(obj);
61 if (!ed) return;
62
63 for (l = msgq; l; )
64 {
65 ln = l->next;
66 em = l->data;
67 if (em->edje == ed)
68 {
69 tmpq = eina_list_append(tmpq, em);
70 msgq = eina_list_remove_list(msgq, l);
71 }
72 l = ln;
73 }
74 /* a temporary message queue */
75 if (tmp_msgq)
76 {
77 while (tmpq)
78 {
79 tmp_msgq = eina_list_append(tmp_msgq, tmpq->data);
80 tmpq = eina_list_remove_list(tmpq, tmpq);
81 }
82 }
83 else
84 {
85 tmp_msgq = tmpq;
86 tmpq = NULL;
87 }
88
89 tmp_msgq_processing++;
90again:
91 EINA_LIST_FOREACH_SAFE(tmp_msgq, l, ln, em)
92 {
93 if (em->edje != ed) continue;
94 tmp_msgq = eina_list_remove_list(tmp_msgq, l);
95 if (!ed->delete_me)
96 {
97 ed->processing_messages++;
98 _edje_message_process(em);
99 _edje_message_free(em);
100 ed->processing_messages--;
101 }
102 else
103 _edje_message_free(em);
104 if (ed->processing_messages == 0)
105 {
106 if (ed->delete_me) _edje_del(ed);
107 }
108 // if some child callback in _edje_message_process called
109 // edje_object_message_signal_process() or
110 // edje_message_signal_process() then those will mark the restart
111 // flag when they finish - it mabsicammyt means tmp_msgq and
112 // any item in it has potentially become invalid - so that means l
113 // and ln could be rogue pointers, so start again from the beginning
114 // and skip anything that is not this object and process only what is.
115 // to avoid self-feeding loops allow a max of 1024 loops.
116 if (tmp_msgq_restart)
117 {
118 tmp_msgq_restart = 0;
119 gotos++;
120 if (gotos < 1024) goto again;
121 else
122 {
123 WRN("Edje is in a self-feeding message loop (> 1024 gotos needed in a row)");
124 goto end;
125 }
126 }
127 }
128end:
129 tmp_msgq_processing--;
130 if (tmp_msgq_processing == 0)
131 tmp_msgq_restart = 0;
132 else
133 tmp_msgq_restart = 1;
134}
135
136
137EAPI void
138edje_message_signal_process(void)
139{
140 _edje_message_queue_process();
141}
142
143
144static Eina_Bool
145_edje_dummy_timer(void *data __UNUSED__)
146{
147 return ECORE_CALLBACK_CANCEL;
148}
149
150static void
151_edje_job(void *data __UNUSED__)
152{
153 if (_job_loss_timer)
154 {
155 ecore_timer_del(_job_loss_timer);
156 _job_loss_timer = NULL;
157 }
158 _job = NULL;
159 _injob++;
160 _edje_message_queue_process();
161 _injob--;
162}
163
164static Eina_Bool
165_edje_job_loss_timer(void *data __UNUSED__)
166{
167 _job_loss_timer = NULL;
168 if (!_job)
169 {
170 _job = ecore_job_add(_edje_job, NULL);
171 }
172 return ECORE_CALLBACK_CANCEL;
173}
174
175void
176_edje_message_init(void)
177{
178}
179
180void
181_edje_message_shutdown(void)
182{
183 _edje_message_queue_clear();
184 if (_job_loss_timer)
185 {
186 ecore_timer_del(_job_loss_timer);
187 _job_loss_timer = NULL;
188 }
189 if (_job)
190 {
191 ecore_job_del(_job);
192 _job = NULL;
193 }
194}
195
196void
197_edje_message_cb_set(Edje *ed, void (*func) (void *data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg), void *data)
198{
199 Eina_List *l;
200 Evas_Object *o;
201
202 ed->message.func = func;
203 ed->message.data = data;
204 EINA_LIST_FOREACH(ed->subobjs, l, o)
205 {
206 Edje *edj2 = _edje_fetch(o);
207 if (!edj2) continue;
208 _edje_message_cb_set(edj2, func, data);
209 }
210}
211
212Edje_Message *
213_edje_message_new(Edje *ed, Edje_Queue queue, Edje_Message_Type type, int id)
214{
215 Edje_Message *em;
216
217 em = calloc(1, sizeof(Edje_Message));
218 if (!em) return NULL;
219 em->edje = ed;
220 em->queue = queue;
221 em->type = type;
222 em->id = id;
223 em->edje->message.num++;
224 return em;
225}
226
227void
228_edje_message_free(Edje_Message *em)
229{
230 if (em->msg)
231 {
232 int i;
233
234 switch (em->type)
235 {
236 case EDJE_MESSAGE_STRING:
237 {
238 Edje_Message_String *emsg;
239
240 emsg = (Edje_Message_String *)em->msg;
241 free(emsg->str);
242 free(emsg);
243 }
244 break;
245 case EDJE_MESSAGE_INT:
246 {
247 Edje_Message_Int *emsg;
248
249 emsg = (Edje_Message_Int *)em->msg;
250 free(emsg);
251 }
252 break;
253 case EDJE_MESSAGE_FLOAT:
254 {
255 Edje_Message_Float *emsg;
256
257 emsg = (Edje_Message_Float *)em->msg;
258 free(emsg);
259 }
260 break;
261 case EDJE_MESSAGE_INT_SET:
262 {
263 Edje_Message_Int_Set *emsg;
264
265 emsg = (Edje_Message_Int_Set *)em->msg;
266 free(emsg);
267 }
268 break;
269 case EDJE_MESSAGE_FLOAT_SET:
270 {
271 Edje_Message_Float_Set *emsg;
272
273 emsg = (Edje_Message_Float_Set *)em->msg;
274 free(emsg);
275 }
276 break;
277 case EDJE_MESSAGE_STRING_FLOAT:
278 {
279 Edje_Message_String_Float *emsg;
280
281 emsg = (Edje_Message_String_Float *)em->msg;
282 free(emsg->str);
283 free(emsg);
284 }
285 break;
286 case EDJE_MESSAGE_STRING_INT:
287 {
288 Edje_Message_String_Int *emsg;
289
290 emsg = (Edje_Message_String_Int *)em->msg;
291 free(emsg->str);
292 free(emsg);
293 }
294 break;
295 case EDJE_MESSAGE_STRING_FLOAT_SET:
296 {
297 Edje_Message_String_Float_Set *emsg;
298
299 emsg = (Edje_Message_String_Float_Set *)em->msg;
300 free(emsg->str);
301 free(emsg);
302 }
303 break;
304 case EDJE_MESSAGE_STRING_INT_SET:
305 {
306 Edje_Message_String_Int_Set *emsg;
307
308 emsg = (Edje_Message_String_Int_Set *)em->msg;
309 free(emsg->str);
310 free(emsg);
311 }
312 break;
313 case EDJE_MESSAGE_SIGNAL:
314 {
315 Edje_Message_Signal *emsg;
316
317 emsg = (Edje_Message_Signal *)em->msg;
318 if (emsg->sig) eina_stringshare_del(emsg->sig);
319 if (emsg->src) eina_stringshare_del(emsg->src);
320 if (emsg->data && (--(emsg->data->ref) == 0))
321 {
322 if (emsg->data->free_func)
323 {
324 emsg->data->free_func(emsg->data->data);
325 }
326 free(emsg->data);
327 }
328 free(emsg);
329 }
330 break;
331 case EDJE_MESSAGE_STRING_SET:
332 {
333 Edje_Message_String_Set *emsg;
334
335 emsg = (Edje_Message_String_Set *)em->msg;
336 for (i = 0; i < emsg->count; i++)
337 free(emsg->str[i]);
338 free(emsg);
339 }
340 break;
341 case EDJE_MESSAGE_NONE:
342 default:
343 break;
344 }
345 }
346 free(em);
347}
348
349void
350_edje_message_propornot_send(Edje *ed, Edje_Queue queue, Edje_Message_Type type, int id, void *emsg, Eina_Bool prop)
351{
352 /* FIXME: check all malloc & strdup fails and gracefully unroll and exit */
353 Edje_Message *em;
354 int i;
355 unsigned char *msg = NULL;
356
357 em = _edje_message_new(ed, queue, type, id);
358 if (!em) return;
359 em->propagated = prop;
360 if (_job)
361 {
362 ecore_job_del(_job);
363 _job = NULL;
364 }
365 if (_injob > 0)
366 {
367 if (_job_loss_timer) ecore_timer_del(_job_loss_timer);
368 _job_loss_timer = ecore_timer_add(0.001, _edje_job_loss_timer, NULL);
369 }
370 else
371 {
372 if (!_job)
373 {
374 _job = ecore_job_add(_edje_job, NULL);
375 }
376 if (_job_loss_timer)
377 {
378 ecore_timer_del(_job_loss_timer);
379 _job_loss_timer = NULL;
380 }
381 }
382 switch (em->type)
383 {
384 case EDJE_MESSAGE_NONE:
385 break;
386 case EDJE_MESSAGE_SIGNAL:
387 {
388 Edje_Message_Signal *emsg2, *emsg3;
389
390 emsg2 = (Edje_Message_Signal *)emsg;
391 emsg3 = calloc(1, sizeof(Edje_Message_Signal));
392 if (emsg2->sig) emsg3->sig = eina_stringshare_add(emsg2->sig);
393 if (emsg2->src) emsg3->src = eina_stringshare_add(emsg2->src);
394 if (emsg2->data)
395 {
396 emsg3->data = emsg2->data;
397 emsg3->data->ref++;
398 }
399 msg = (unsigned char *)emsg3;
400 }
401 break;
402 case EDJE_MESSAGE_STRING:
403 {
404 Edje_Message_String *emsg2, *emsg3;
405
406 emsg2 = (Edje_Message_String *)emsg;
407
408 emsg3 = malloc(sizeof(Edje_Message_String));
409 emsg3->str = strdup(emsg2->str);
410 msg = (unsigned char *)emsg3;
411 }
412 break;
413 case EDJE_MESSAGE_INT:
414 {
415 Edje_Message_Int *emsg2, *emsg3;
416
417 emsg2 = (Edje_Message_Int *)emsg;
418 emsg3 = malloc(sizeof(Edje_Message_Int));
419 emsg3->val = emsg2->val;
420 msg = (unsigned char *)emsg3;
421 }
422 break;
423 case EDJE_MESSAGE_FLOAT:
424 {
425 Edje_Message_Float *emsg2, *emsg3;
426
427 emsg2 = (Edje_Message_Float *)emsg;
428 emsg3 = malloc(sizeof(Edje_Message_Float));
429 emsg3->val = emsg2->val;
430 msg = (unsigned char *)emsg3;
431 }
432 break;
433 case EDJE_MESSAGE_STRING_SET:
434 {
435 Edje_Message_String_Set *emsg2, *emsg3;
436
437 emsg2 = (Edje_Message_String_Set *)emsg;
438 emsg3 = malloc(sizeof(Edje_Message_String_Set) + ((emsg2->count - 1) * sizeof(char *)));
439 emsg3->count = emsg2->count;
440 for (i = 0; i < emsg3->count; i++)
441 emsg3->str[i] = strdup(emsg2->str[i]);
442 msg = (unsigned char *)emsg3;
443 }
444 break;
445 case EDJE_MESSAGE_INT_SET:
446 {
447 Edje_Message_Int_Set *emsg2, *emsg3;
448
449 emsg2 = (Edje_Message_Int_Set *)emsg;
450 emsg3 = malloc(sizeof(Edje_Message_Int_Set) + ((emsg2->count - 1) * sizeof(int)));
451 emsg3->count = emsg2->count;
452 for (i = 0; i < emsg3->count; i++)
453 emsg3->val[i] = emsg2->val[i];
454 msg = (unsigned char *)emsg3;
455 }
456 break;
457 case EDJE_MESSAGE_FLOAT_SET:
458 {
459 Edje_Message_Float_Set *emsg2, *emsg3;
460
461 emsg2 = (Edje_Message_Float_Set *)emsg;
462 emsg3 = malloc(sizeof(Edje_Message_Float_Set) + ((emsg2->count - 1) * sizeof(double)));
463 emsg3->count = emsg2->count;
464 for (i = 0; i < emsg3->count; i++)
465 emsg3->val[i] = emsg2->val[i];
466 msg = (unsigned char *)emsg3;
467 }
468 break;
469 case EDJE_MESSAGE_STRING_INT:
470 {
471 Edje_Message_String_Int *emsg2, *emsg3;
472
473 emsg2 = (Edje_Message_String_Int *)emsg;
474 emsg3 = malloc(sizeof(Edje_Message_String_Int));
475 emsg3->str = strdup(emsg2->str);
476 emsg3->val = emsg2->val;
477 msg = (unsigned char *)emsg3;
478 }
479 break;
480 case EDJE_MESSAGE_STRING_FLOAT:
481 {
482 Edje_Message_String_Float *emsg2, *emsg3;
483
484 emsg2 = (Edje_Message_String_Float *)emsg;
485 emsg3 = malloc(sizeof(Edje_Message_String_Float));
486 emsg3->str = strdup(emsg2->str);
487 emsg3->val = emsg2->val;
488 msg = (unsigned char *)emsg3;
489 }
490 break;
491 case EDJE_MESSAGE_STRING_INT_SET:
492 {
493 Edje_Message_String_Int_Set *emsg2, *emsg3;
494
495 emsg2 = (Edje_Message_String_Int_Set *)emsg;
496 emsg3 = malloc(sizeof(Edje_Message_String_Int_Set) + ((emsg2->count - 1) * sizeof(int)));
497 emsg3->str = strdup(emsg2->str);
498 emsg3->count = emsg2->count;
499 for (i = 0; i < emsg3->count; i++)
500 emsg3->val[i] = emsg2->val[i];
501 msg = (unsigned char *)emsg3;
502 }
503 break;
504 case EDJE_MESSAGE_STRING_FLOAT_SET:
505 {
506 Edje_Message_String_Float_Set *emsg2, *emsg3;
507
508 emsg2 = (Edje_Message_String_Float_Set *)emsg;
509 emsg3 = malloc(sizeof(Edje_Message_String_Float_Set) + ((emsg2->count - 1) * sizeof(double)));
510 emsg3->str = strdup(emsg2->str);
511 emsg3->count = emsg2->count;
512 for (i = 0; i < emsg3->count; i++)
513 emsg3->val[i] = emsg2->val[i];
514 msg = (unsigned char *)emsg3;
515 }
516 break;
517 default:
518 break;
519 }
520
521 em->msg = msg;
522 msgq = eina_list_append(msgq, em);
523}
524
525void
526_edje_message_send(Edje *ed, Edje_Queue queue, Edje_Message_Type type, int id, void *emsg)
527{
528 _edje_message_propornot_send(ed, queue, type, id, emsg, EINA_FALSE);
529}
530
531void
532_edje_message_parameters_push(Edje_Message *em)
533{
534 int i;
535
536 /* these params ALWAYS go on */
537 /* first param is the message type - always */
538 embryo_parameter_cell_push(em->edje->collection->script,
539 (Embryo_Cell)em->type);
540 /* 2nd param is the integer of the event id - always there */
541 embryo_parameter_cell_push(em->edje->collection->script,
542 (Embryo_Cell)em->id);
543 /* the rest is varags of whatever is in the msg */
544 switch (em->type)
545 {
546 case EDJE_MESSAGE_NONE:
547 break;
548 case EDJE_MESSAGE_STRING:
549 embryo_parameter_string_push(em->edje->collection->script,
550 ((Edje_Message_String *)em->msg)->str);
551 break;
552 case EDJE_MESSAGE_INT:
553 {
554 Embryo_Cell v;
555
556 v = (Embryo_Cell)((Edje_Message_Int *)em->msg)->val;
557 embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1);
558 }
559 break;
560 case EDJE_MESSAGE_FLOAT:
561 {
562 Embryo_Cell v;
563 float fv;
564
565 fv = ((Edje_Message_Float *)em->msg)->val;
566 v = EMBRYO_FLOAT_TO_CELL(fv);
567 embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1);
568 }
569 break;
570 case EDJE_MESSAGE_STRING_SET:
571 for (i = 0; i < ((Edje_Message_String_Set *)em->msg)->count; i++)
572 embryo_parameter_string_push(em->edje->collection->script,
573 ((Edje_Message_String_Set *)em->msg)->str[i]);
574 break;
575 case EDJE_MESSAGE_INT_SET:
576 for (i = 0; i < ((Edje_Message_Int_Set *)em->msg)->count; i++)
577 {
578 Embryo_Cell v;
579
580 v = (Embryo_Cell)((Edje_Message_Int_Set *)em->msg)->val[i];
581 embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1);
582 }
583 break;
584 case EDJE_MESSAGE_FLOAT_SET:
585 for (i = 0; i < ((Edje_Message_Float_Set *)em->msg)->count; i++)
586 {
587 Embryo_Cell v;
588 float fv;
589
590 fv = ((Edje_Message_Float_Set *)em->msg)->val[i];
591 v = EMBRYO_FLOAT_TO_CELL(fv);
592 embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1);
593 }
594 break;
595 case EDJE_MESSAGE_STRING_INT:
596 embryo_parameter_string_push(em->edje->collection->script,
597 ((Edje_Message_String_Int *)em->msg)->str);
598 {
599 Embryo_Cell v;
600
601 v = (Embryo_Cell)((Edje_Message_String_Int *)em->msg)->val;
602 embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1);
603 }
604 break;
605 case EDJE_MESSAGE_STRING_FLOAT:
606 embryo_parameter_string_push(em->edje->collection->script,
607 ((Edje_Message_String_Float *)em->msg)->str);
608 {
609 Embryo_Cell v;
610 float fv;
611
612 fv = ((Edje_Message_String_Float *)em->msg)->val;
613 v = EMBRYO_FLOAT_TO_CELL(fv);
614 embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1);
615 }
616 break;
617 case EDJE_MESSAGE_STRING_INT_SET:
618 embryo_parameter_string_push(em->edje->collection->script,
619 ((Edje_Message_String_Int_Set *)em->msg)->str);
620 for (i = 0; i < ((Edje_Message_String_Int_Set *)em->msg)->count; i++)
621 {
622 Embryo_Cell v;
623
624 v = (Embryo_Cell)((Edje_Message_String_Int_Set *)em->msg)->val[i];
625 embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1);
626 }
627 break;
628 case EDJE_MESSAGE_STRING_FLOAT_SET:
629 embryo_parameter_string_push(em->edje->collection->script,
630 ((Edje_Message_String_Float_Set *)em->msg)->str);
631 for (i = 0; i < ((Edje_Message_String_Float_Set *)em->msg)->count; i++)
632 {
633 Embryo_Cell v;
634 float fv;
635
636 fv = ((Edje_Message_String_Float_Set *)em->msg)->val[i];
637 v = EMBRYO_FLOAT_TO_CELL(fv);
638 embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1);
639 }
640 break;
641 default:
642 break;
643 }
644}
645
646void
647_edje_message_process(Edje_Message *em)
648{
649 Embryo_Function fn;
650 void *pdata;
651 int ret;
652
653 /* signals are only handled one way */
654 if (em->type == EDJE_MESSAGE_SIGNAL)
655 {
656 _edje_emit_handle(em->edje,
657 ((Edje_Message_Signal *)em->msg)->sig,
658 ((Edje_Message_Signal *)em->msg)->src,
659 ((Edje_Message_Signal *)em->msg)->data,
660 em->propagated);
661 return;
662 }
663 /* if this has been queued up for the app then just call the callback */
664 if (em->queue == EDJE_QUEUE_APP)
665 {
666 if (em->edje->message.func)
667 em->edje->message.func(em->edje->message.data, em->edje->obj,
668 em->type, em->id, em->msg);
669 return;
670 }
671 /* now this message is destined for the script message handler fn */
672 if (!(em->edje->collection)) return;
673 if ((em->edje->collection->script) && _edje_script_only (em->edje))
674 {
675 _edje_script_only_message(em->edje, em);
676 return;
677 }
678 if (em->edje->L)
679 {
680 _edje_lua_script_only_message(em->edje, em);
681 return;
682 }
683 fn = embryo_program_function_find(em->edje->collection->script, "message");
684 if (fn == EMBRYO_FUNCTION_NONE) return;
685 /* reset the engine */
686 _edje_embryo_script_reset(em->edje);
687
688 _edje_message_parameters_push(em);
689
690 embryo_program_vm_push(em->edje->collection->script);
691 _edje_embryo_globals_init(em->edje);
692 pdata = embryo_program_data_get(em->edje->collection->script);
693 embryo_program_data_set(em->edje->collection->script, em->edje);
694 embryo_program_max_cycle_run_set(em->edje->collection->script, 5000000);
695 ret = embryo_program_run(em->edje->collection->script, fn);
696 if (ret == EMBRYO_PROGRAM_FAIL)
697 {
698 ERR("ERROR with embryo script. "
699 "OBJECT NAME: '%s', "
700 "OBJECT FILE: '%s', "
701 "ENTRY POINT: '%s', "
702 "ERROR: '%s'",
703 em->edje->collection->part,
704 em->edje->file->path,
705 "message",
706 embryo_error_string_get(embryo_program_error_get(em->edje->collection->script)));
707 }
708 else if (ret == EMBRYO_PROGRAM_TOOLONG)
709 {
710 ERR("ERROR with embryo script. "
711 "OBJECT NAME: '%s', "
712 "OBJECT FILE: '%s', "
713 "ENTRY POINT: '%s', "
714 "ERROR: 'Script exceeded maximum allowed cycle count of %i'",
715 em->edje->collection->part,
716 em->edje->file->path,
717 "message",
718 embryo_program_max_cycle_run_get(em->edje->collection->script));
719 }
720
721 embryo_program_data_set(em->edje->collection->script, pdata);
722 embryo_program_vm_pop(em->edje->collection->script);
723}
724
725void
726_edje_message_queue_process(void)
727{
728 int i;
729
730 if (!msgq) return;
731
732 /* allow the message queue to feed itself up to 8 times before forcing */
733 /* us to go back to normal processing and let a 0 timeout deal with it */
734 for (i = 0; (i < 8) && (msgq); i++)
735 {
736 /* a temporary message queue */
737 if (tmp_msgq)
738 {
739 while (msgq)
740 {
741 tmp_msgq = eina_list_append(tmp_msgq, msgq->data);
742 msgq = eina_list_remove_list(msgq, msgq);
743 }
744 }
745 else
746 {
747 tmp_msgq = msgq;
748 msgq = NULL;
749 }
750
751 tmp_msgq_processing++;
752 while (tmp_msgq)
753 {
754 Edje_Message *em;
755 Edje *ed;
756
757 em = tmp_msgq->data;
758 ed = em->edje;
759 tmp_msgq = eina_list_remove_list(tmp_msgq, tmp_msgq);
760 em->edje->message.num--;
761 if (!ed->delete_me)
762 {
763 ed->processing_messages++;
764 _edje_message_process(em);
765 _edje_message_free(em);
766 ed->processing_messages--;
767 }
768 else
769 _edje_message_free(em);
770 if (ed->processing_messages == 0)
771 {
772 if (ed->delete_me) _edje_del(ed);
773 }
774 }
775 tmp_msgq_processing--;
776 if (tmp_msgq_processing == 0)
777 tmp_msgq_restart = 0;
778 else
779 tmp_msgq_restart = 1;
780 }
781
782 /* if the message queue filled again set a timer to expire in 0.0 sec */
783 /* to get the idle enterer to be run again */
784 if (msgq)
785 {
786 static int self_feed_debug = -1;
787
788 if (self_feed_debug == -1)
789 {
790 const char *s = getenv("EDJE_SELF_FEED_DEBUG");
791 if (s) self_feed_debug = atoi(s);
792 else self_feed_debug = 0;
793 }
794 if (self_feed_debug)
795 {
796 WRN("Edje is in a self-feeding message loop (> 8 loops needed)");
797 }
798 ecore_timer_add(0.0, _edje_dummy_timer, NULL);
799 }
800}
801
802void
803_edje_message_queue_clear(void)
804{
805 while (msgq)
806 {
807 Edje_Message *em;
808
809 em = msgq->data;
810 msgq = eina_list_remove_list(msgq, msgq);
811 em->edje->message.num--;
812 _edje_message_free(em);
813 }
814 while (tmp_msgq)
815 {
816 Edje_Message *em;
817
818 em = tmp_msgq->data;
819 tmp_msgq = eina_list_remove_list(tmp_msgq, tmp_msgq);
820 em->edje->message.num--;
821 _edje_message_free(em);
822 }
823}
824
825void
826_edje_message_del(Edje *ed)
827{
828 Eina_List *l;
829
830 if (ed->message.num <= 0) return;
831 /* delete any messages on the main queue for this edje object */
832 for (l = msgq; l; )
833 {
834 Edje_Message *em;
835 Eina_List *lp;
836
837 em = eina_list_data_get(l);
838 lp = l;
839 l = eina_list_next(l);
840 if (em->edje == ed)
841 {
842 msgq = eina_list_remove_list(msgq, lp);
843 em->edje->message.num--;
844 _edje_message_free(em);
845 }
846 if (ed->message.num <= 0) return;
847 }
848 /* delete any on the processing queue */
849 for (l = tmp_msgq; l; )
850 {
851 Edje_Message *em;
852 Eina_List *lp;
853
854 em = eina_list_data_get(l);
855 lp = l;
856 l = eina_list_next(l);
857 if (em->edje == ed)
858 {
859 tmp_msgq = eina_list_remove_list(tmp_msgq, lp);
860 em->edje->message.num--;
861 _edje_message_free(em);
862 }
863 if (ed->message.num <= 0) return;
864 }
865}
diff --git a/libraries/edje/src/lib/edje_misc.c b/libraries/edje/src/lib/edje_misc.c
new file mode 100644
index 0000000..32a4dd1
--- /dev/null
+++ b/libraries/edje/src/lib/edje_misc.c
@@ -0,0 +1 @@
#include "edje_private.h"
diff --git a/libraries/edje/src/lib/edje_module.c b/libraries/edje/src/lib/edje_module.c
new file mode 100644
index 0000000..effcee1
--- /dev/null
+++ b/libraries/edje/src/lib/edje_module.c
@@ -0,0 +1,154 @@
1#include "edje_private.h"
2
3Eina_Hash *_registered_modules = NULL;
4Eina_List *_modules_paths = NULL;
5
6Eina_List *_modules_found = NULL;
7
8#if defined(__CEGCC__) || defined(__MINGW32CE__)
9# define EDJE_MODULE_NAME "edje_%s.dll"
10# define EDJE_EXTRA_MODULE_NAME 1
11#elif _WIN32
12# define EDJE_MODULE_NAME "module.dll"
13#else
14# define EDJE_MODULE_NAME "module.so"
15#endif
16
17EAPI Eina_Bool
18edje_module_load(const char *module)
19{
20 if (_edje_module_handle_load(module)) return EINA_TRUE;
21 return EINA_FALSE;
22}
23
24Eina_Module *
25_edje_module_handle_load(const char *module)
26{
27 const char *path;
28 Eina_List *l;
29 Eina_Module *em = NULL;
30
31 EINA_SAFETY_ON_NULL_RETURN_VAL(module, NULL);
32
33 em = (Eina_Module *)eina_hash_find(_registered_modules, module);
34 if (em) return em;
35
36 EINA_LIST_FOREACH(_modules_paths, l, path)
37 {
38 char tmp[PATH_MAX];
39
40 snprintf(tmp, sizeof (tmp), "%s/%s/%s/" EDJE_MODULE_NAME, path, module, MODULE_ARCH
41#ifdef EDJE_EXTRA_MODULE_NAME
42 , module
43#endif
44 );
45 em = eina_module_new(tmp);
46 if (!em) continue;
47
48 if (!eina_module_load(em))
49 {
50 eina_module_free(em);
51 continue;
52 }
53 if (eina_hash_add(_registered_modules, module, em))
54 return em;
55 }
56
57 return NULL;
58}
59
60void
61_edje_module_init(void)
62{
63 char *paths[4] = { NULL, NULL, NULL, NULL };
64 unsigned int i;
65 unsigned int j;
66
67 _registered_modules = eina_hash_string_small_new(EINA_FREE_CB(eina_module_free));
68
69 /* 1. ~/.edje/modules/ */
70 paths[0] = eina_module_environment_path_get("HOME", "/.edje/modules");
71 /* 2. $(EDJE_MODULE_DIR)/edje/modules/ */
72 paths[1] = eina_module_environment_path_get("EDJE_MODULES_DIR", "/edje/modules");
73 /* 3. libedje.so/../edje/modules/ */
74 paths[2] = eina_module_symbol_path_get(_edje_module_init, "/edje/modules");
75 /* 4. PREFIX/edje/modules/ */
76#ifndef _MSC_VER
77 paths[3] = strdup(PACKAGE_LIB_DIR "/edje/modules");
78#endif
79
80 for (j = 0; j < ((sizeof (paths) / sizeof (char*)) - 1); ++j)
81 for (i = j + 1; i < sizeof (paths) / sizeof (char*); ++i)
82 if (paths[i] && paths[j] && !strcmp(paths[i], paths[j]))
83 {
84 free(paths[i]);
85 paths[i] = NULL;
86 }
87
88 for (i = 0; i < sizeof (paths) / sizeof (char*); ++i)
89 if (paths[i])
90 _modules_paths = eina_list_append(_modules_paths, paths[i]);
91}
92
93void
94_edje_module_shutdown(void)
95{
96 char *path;
97
98 if (_registered_modules)
99 {
100 eina_hash_free(_registered_modules);
101 _registered_modules = NULL;
102 }
103
104 EINA_LIST_FREE(_modules_paths, path)
105 free(path);
106
107 EINA_LIST_FREE(_modules_found, path)
108 eina_stringshare_del(path);
109}
110
111EAPI const Eina_List *
112edje_available_modules_get(void)
113{
114 Eina_File_Direct_Info *info;
115 Eina_Iterator *it;
116 Eina_List *l;
117 const char *path;
118 Eina_List *result = NULL;
119
120 /* FIXME: Stat each possible dir and check if they did change, before starting a huge round of readdir/stat */
121 if (_modules_found)
122 {
123 EINA_LIST_FREE(_modules_found, path)
124 eina_stringshare_del(path);
125 }
126
127 EINA_LIST_FOREACH(_modules_paths, l, path)
128 {
129 it = eina_file_direct_ls(path);
130
131 if (it)
132 {
133 EINA_ITERATOR_FOREACH(it, info)
134 {
135 char tmp[PATH_MAX];
136
137 snprintf(tmp, sizeof (tmp), "%s/%s/" EDJE_MODULE_NAME, info->path, MODULE_ARCH
138#ifdef EDJE_EXTRA_MODULE_NAME
139 , ecore_file_file_get(info->path)
140#endif
141 );
142
143 if (ecore_file_exists(tmp))
144 result = eina_list_append(result, eina_stringshare_add(ecore_file_file_get(info->path)));
145 }
146
147 eina_iterator_free(it);
148 }
149 }
150
151 _modules_found = result;
152
153 return result;
154}
diff --git a/libraries/edje/src/lib/edje_multisense.c b/libraries/edje/src/lib/edje_multisense.c
new file mode 100644
index 0000000..f9c7f91
--- /dev/null
+++ b/libraries/edje/src/lib/edje_multisense.c
@@ -0,0 +1,408 @@
1#include "config.h"
2#include <string.h>
3#include <fcntl.h>
4#include <Eina.h>
5#include <Edje.h>
6#include "edje_private.h"
7
8typedef struct _Multisense_Data
9{
10 Edje_Multisense_Env *msenv;
11#ifdef HAVE_LIBREMIX
12 RemixDeck *deck;
13 RemixTrack *track;
14 RemixLayer *snd_layer, *player_layer;
15 RemixBase *player;
16 RemixBase *player_snd;
17 int remaining;
18 int offset;
19 Eina_List *snd_src_list;
20
21 MULTISENSE_SOUND_PLAYER_GET_FUNC multisense_sound_player_get;
22#endif
23}Multisense_Data;
24
25#define BUF_LEN 64
26#define SND_PROCESS_LENGTH 2048
27
28#ifdef HAVE_LIBREMIX
29static Ecore_Thread *player_thread = NULL;
30static int command_pipe[2];
31static Eina_Bool pipe_initialized = EINA_FALSE;
32#endif
33
34typedef enum _Edje_Sound_Action_Type
35{
36 EDJE_PLAY_SAMPLE = 0,
37 EDJE_PLAY_TONE,
38 /*
39 EDJE_PLAY_PATTERN,
40 EDJE_PLAY_INSTRUMENT,
41 EDJE_PLAY_SONG,
42 */
43 EDJE_SOUND_LAST
44} Edje_Sound_Action_Type;
45
46typedef struct _Edje_Sample_Action Edje_Sample_Action;
47typedef struct _Edje_Tone_Action Edje_Tone_Action;
48typedef struct _Edje_Multisense_Sound_Action Edje_Multisense_Sound_Action;
49
50struct _Edje_Sample_Action
51{
52 char sample_name[BUF_LEN];
53 double speed;
54};
55
56struct _Edje_Tone_Action
57{
58 char tone_name[BUF_LEN];
59 double duration;
60};
61
62struct _Edje_Multisense_Sound_Action
63{
64 Edje *ed;
65 Edje_Sound_Action_Type action;
66 union {
67 Edje_Sample_Action sample;
68 Edje_Tone_Action tone;
69 } type;
70};
71
72#ifdef HAVE_LIBREMIX
73static Multisense_Data *
74init_multisense_environment(void)
75{
76 Multisense_Data *msdata;
77 char ms_factory[BUF_LEN];
78 char *ms_factory_env;
79 Eina_Module *m = NULL;
80 MULTISENSE_FACTORY_INIT_FUNC multisense_factory_init;
81
82 msdata = calloc(1, sizeof(Multisense_Data));
83 if (!msdata) goto err;
84
85 msdata->msenv = calloc(1, sizeof(Edje_Multisense_Env));
86 if (!msdata->msenv) goto err;
87
88 ms_factory_env = getenv("MULTISENSE_FACTORY");
89 if (ms_factory_env)
90 strncpy(ms_factory, ms_factory_env, BUF_LEN);
91 else
92 strcpy(ms_factory, "multisense_factory");
93
94 m = _edje_module_handle_load(ms_factory);
95 if (!m) goto err;
96
97 msdata->msenv->remixenv = remix_init();
98
99 multisense_factory_init =
100 eina_module_symbol_get(m, "multisense_factory_init");
101 if (multisense_factory_init) multisense_factory_init(msdata->msenv);
102
103 msdata->multisense_sound_player_get =
104 eina_module_symbol_get(m, "multisense_sound_player_get");
105 if (!msdata->multisense_sound_player_get) goto err;
106
107 msdata->deck = remix_deck_new(msdata->msenv->remixenv);
108 msdata->track = remix_track_new(msdata->msenv->remixenv, msdata->deck);
109 msdata->snd_layer = remix_layer_new_ontop(msdata->msenv->remixenv,
110 msdata->track,
111 REMIX_TIME_SAMPLES);
112 msdata->player_layer = remix_layer_new_ontop(msdata->msenv->remixenv,
113 msdata->track,
114 REMIX_TIME_SAMPLES);
115 msdata->player = msdata->multisense_sound_player_get(msdata->msenv);
116 if (!msdata->player) goto err;
117 msdata->player_snd = remix_sound_new(msdata->msenv->remixenv,
118 msdata->player, msdata->player_layer,
119 REMIX_SAMPLES(0),
120 REMIX_SAMPLES(REMIX_COUNT_INFINITE));
121 return msdata;
122
123err:
124 if (msdata)
125 {
126 if (msdata->deck) remix_destroy(msdata->msenv->remixenv, msdata->deck);
127 if (msdata->msenv->remixenv) remix_purge(msdata->msenv->remixenv);
128 if (msdata->msenv) free(msdata->msenv);
129 free(msdata);
130 }
131 return NULL;
132}
133#endif
134
135#ifdef HAVE_LIBREMIX
136static RemixBase *
137eet_sound_reader_get(Edje_Multisense_Env *msenv, const char *path, const char *sound_id, const double speed)
138{
139 RemixPlugin *sf_plugin = NULL;
140 RemixBase * eet_snd_reader = NULL;
141 int sf_path_key = 0;
142 int sf_sound_id_key = 0;
143 int sf_speed_key = 0;
144 CDSet *sf_parms = NULL;
145 RemixEnv *env = msenv->remixenv;
146
147 if (sf_plugin == NULL)
148 {
149 sf_plugin = remix_find_plugin(env, "eet_sndfile_reader");
150 if (sf_plugin == NULL)
151 {
152 ERR ("Multisense EET Sound reader plugin NULL\n");
153 return NULL;
154 }
155
156 sf_path_key = remix_get_init_parameter_key(env, sf_plugin, "path");
157 sf_sound_id_key = remix_get_init_parameter_key(env, sf_plugin, "sound_id");
158 sf_speed_key = remix_get_init_parameter_key(env, sf_plugin, "speed");
159 }
160 sf_parms = cd_set_replace(env, sf_parms, sf_path_key, CD_STRING(path));
161 sf_parms = cd_set_replace(env, sf_parms, sf_sound_id_key, CD_STRING(sound_id));
162 sf_parms = cd_set_replace(env, sf_parms, sf_speed_key, CD_DOUBLE(speed));
163 eet_snd_reader = remix_new(env, sf_plugin, sf_parms);
164
165 return eet_snd_reader;
166}
167
168
169static RemixBase *
170edje_remix_sample_create(Multisense_Data *msdata, Edje*ed, Edje_Sample_Action *action)
171{
172 RemixBase *remix_snd = NULL;
173 Edje_Sound_Sample *sample;
174 int i;
175 char snd_id_str[16];
176
177 if ((!ed) || (!ed->file) || (!ed->file->sound_dir))
178 return NULL;
179
180 for (i = 0; i < (int)ed->file->sound_dir->samples_count; i++)
181 {
182 sample = &ed->file->sound_dir->samples[i];
183 if (!strcmp(sample->name, action->sample_name))
184 {
185 snprintf(snd_id_str, sizeof(snd_id_str), "edje/sounds/%i", sample->id);
186 remix_snd = eet_sound_reader_get(msdata->msenv, ed->file->path,
187 snd_id_str, action->speed);
188 break;
189 }
190 }
191 return remix_snd;
192}
193
194static RemixBase *
195edje_remix_tone_create(Multisense_Data *msdata, Edje*ed, Edje_Tone_Action *action)
196{
197 Edje_Sound_Tone *tone;
198 RemixSquareTone *square = NULL;
199 unsigned int i;
200
201 if ((!ed) || (!ed->file) || (!ed->file->sound_dir))
202 return NULL;
203
204 for (i = 0; i < ed->file->sound_dir->tones_count; i++)
205 {
206 tone = &ed->file->sound_dir->tones[i];
207 if (!strcmp(tone->name, action->tone_name))
208 {
209 square = remix_squaretone_new (msdata->msenv->remixenv, tone->value);
210 break;
211 }
212 }
213 return square;
214}
215
216static void
217sound_command_handler(Multisense_Data *msdata)
218{
219 RemixCount length;
220 Edje_Multisense_Sound_Action command;
221 RemixBase *base = NULL;
222 RemixBase *sound;
223
224 if (read(command_pipe[0], &command, sizeof(command)) <= 0) return;
225 switch (command.action)
226 {
227 case EDJE_PLAY_SAMPLE:
228 base = edje_remix_sample_create(msdata, command.ed,
229 &command.type.sample);
230 length = remix_length(msdata->msenv->remixenv, base);
231 break;
232 case EDJE_PLAY_TONE:
233 base = edje_remix_tone_create(msdata, command.ed, &command.type.tone);
234 length = (command.type.tone.duration *
235 remix_get_samplerate(msdata->msenv->remixenv));
236 break;
237 default:
238 ERR("Invalid Sound Play Command\n");
239 break;
240 }
241 if (base)
242 {
243 sound = remix_sound_new(msdata->msenv->remixenv, base, msdata->snd_layer,
244 REMIX_SAMPLES(msdata->offset),
245 REMIX_SAMPLES(length));
246 if (msdata->remaining < length) msdata->remaining = length;
247 msdata->snd_src_list = eina_list_append(msdata->snd_src_list, sound);
248 msdata->snd_src_list = eina_list_append(msdata->snd_src_list, base);
249 }
250}
251#endif
252
253#ifdef HAVE_LIBREMIX
254// msdata outside of thread due to thread issues in dlsym etc.
255static Multisense_Data *msdata = NULL;
256
257static void
258_msdata_free(void)
259{
260 // cleanup msdata outside of thread due to thread issues in dlsym etc.
261 if (!msdata) return;
262 //cleanup Remix stuffs
263 remix_destroy(msdata->msenv->remixenv, msdata->player);
264 remix_destroy(msdata->msenv->remixenv, msdata->deck);
265 remix_purge(msdata->msenv->remixenv);
266
267 free(msdata->msenv);
268 free(msdata);
269 msdata = NULL;
270}
271
272static void
273_player_job(void *data __UNUSED__, Ecore_Thread *th)
274{
275 fd_set wait_fds;
276 RemixBase *sound;
277 RemixCount process_len;
278// disable and move outside of thread due to dlsym etc. thread issues
279// Multisense_Data * msdata = init_multisense_environment();
280
281 if (!msdata) return;
282
283 fcntl(command_pipe[0], F_SETFL, O_NONBLOCK);
284 FD_ZERO(&wait_fds);
285 FD_SET(command_pipe[0], &wait_fds);
286
287 while (!ecore_thread_check(th))
288 {
289 if (!msdata->remaining)
290 {
291 //Cleanup already played sound sources
292 EINA_LIST_FREE(msdata->snd_src_list, sound)
293 {
294 remix_destroy(msdata->msenv->remixenv, sound);
295 }
296 //wait for new sound
297 select(command_pipe[0] + 1, &wait_fds, NULL, NULL, 0);
298 }
299 //read sound command , if any
300 sound_command_handler(msdata);
301 process_len = MIN(msdata->remaining, SND_PROCESS_LENGTH);
302 remix_process(msdata->msenv->remixenv, msdata->deck, process_len,
303 RemixNone, RemixNone);
304 msdata->offset += process_len;
305 msdata->remaining -= process_len;
306 }
307
308 //Cleanup last played sound sources
309 EINA_LIST_FREE(msdata->snd_src_list, sound)
310 {
311 remix_destroy(msdata->msenv->remixenv, sound);
312 }
313
314 close(command_pipe[0]);
315 close(command_pipe[1]);
316}
317#endif
318
319#ifdef HAVE_LIBREMIX
320static void
321_player_cancel(void *data __UNUSED__, Ecore_Thread *th __UNUSED__)
322{
323 // cleanup msdata outside of thread due to thread issues in dlsym etc.
324 _msdata_free();
325 player_thread = NULL;
326}
327#endif
328
329#ifdef HAVE_LIBREMIX
330static void
331_player_end(void *data __UNUSED__, Ecore_Thread *th __UNUSED__)
332{
333 // cleanup msdata outside of thread due to thread issues in dlsym etc.
334 _msdata_free();
335 player_thread = NULL;
336}
337#endif
338
339Eina_Bool
340_edje_multisense_internal_sound_sample_play(Edje *ed, const char *sample_name, const double speed)
341{
342 ssize_t size = 0;
343#ifdef ENABLE_MULTISENSE
344 Edje_Multisense_Sound_Action command;
345
346 if ((!pipe_initialized) && (!player_thread)) return EINA_FALSE;
347
348 command.action = EDJE_PLAY_SAMPLE;
349 command.ed = ed;
350 strncpy(command.type.sample.sample_name, sample_name, BUF_LEN);
351 command.type.sample.speed = speed;
352 size = write(command_pipe[1], &command, sizeof(command));
353#else
354 ed = NULL; // warning shh
355 if (speed > 0) sample_name = NULL; // warning shh
356#endif
357 return (size == sizeof(Edje_Multisense_Sound_Action));
358}
359
360Eina_Bool
361_edje_multisense_internal_sound_tone_play(Edje *ed, const char *tone_name, const double duration)
362{
363 ssize_t size = 0;
364#ifdef ENABLE_MULTISENSE
365 Edje_Multisense_Sound_Action command;
366
367 if ((!pipe_initialized) && (!player_thread)) return EINA_FALSE;
368 command.action = EDJE_PLAY_TONE;
369 command.ed = ed;
370 strncpy(command.type.tone.tone_name, tone_name, BUF_LEN);
371 command.type.tone.duration = duration;
372 size = write(command_pipe[1], &command, sizeof(command));
373#else
374 ed = NULL; // warning shh
375 if (duration > 0) tone_name = NULL; // warning shh
376#endif
377 return (size == sizeof(Edje_Multisense_Sound_Action));
378
379}
380
381/* Initialize the modules in main thread. to avoid dlopen issue in the Threads */
382void
383_edje_multisense_init(void)
384{
385#ifdef ENABLE_MULTISENSE
386 if (!pipe_initialized && (pipe(command_pipe) != -1))
387 pipe_initialized = EINA_TRUE;
388
389 // init msdata outside of thread due to thread issues in dlsym etc.
390 if (!msdata) msdata = init_multisense_environment();
391
392 if (!player_thread)
393 player_thread = ecore_thread_run(_player_job, _player_end, _player_cancel, NULL);
394#endif
395}
396
397void
398_edje_multisense_shutdown(void)
399{
400#ifdef ENABLE_MULTISENSE
401 if (pipe_initialized)
402 {
403 close(command_pipe[1]);
404 close(command_pipe[0]);
405 }
406 if (player_thread) ecore_thread_cancel(player_thread);
407#endif
408}
diff --git a/libraries/edje/src/lib/edje_private.h b/libraries/edje/src/lib/edje_private.h
new file mode 100644
index 0000000..cbb3e03
--- /dev/null
+++ b/libraries/edje/src/lib/edje_private.h
@@ -0,0 +1,2028 @@
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 HAVE_ALLOCA_H
13# include <alloca.h>
14#elif defined __GNUC__
15# define alloca __builtin_alloca
16#elif defined _AIX
17# define alloca __alloca
18#elif defined _MSC_VER
19# include <malloc.h>
20# define alloca _alloca
21#else
22# include <stddef.h>
23void *alloca (size_t);
24#endif
25
26#include <string.h>
27#include <limits.h>
28#include <sys/stat.h>
29#include <time.h>
30#include <sys/time.h>
31#include <errno.h>
32
33#ifndef _MSC_VER
34# include <libgen.h>
35# include <unistd.h>
36#endif
37
38#include <lua.h>
39#include <lualib.h>
40#include <lauxlib.h>
41#include <setjmp.h>
42
43#ifdef HAVE_LOCALE_H
44# include <locale.h>
45#endif
46
47#ifdef HAVE_EVIL
48# include <Evil.h>
49#endif
50
51#include <Eina.h>
52#include <Eet.h>
53#include <Evas.h>
54#include <Ecore.h>
55#include <Ecore_Evas.h>
56#include <Ecore_File.h>
57#ifdef HAVE_ECORE_IMF
58# include <Ecore_IMF.h>
59# include <Ecore_IMF_Evas.h>
60#endif
61#include <Embryo.h>
62
63#include "Edje.h"
64
65EAPI extern int _edje_default_log_dom ;
66
67#ifdef EDJE_DEFAULT_LOG_COLOR
68# undef EDJE_DEFAULT_LOG_COLOR
69#endif
70#define EDJE_DEFAULT_LOG_COLOR EINA_COLOR_CYAN
71#ifdef ERR
72# undef ERR
73#endif
74#define ERR(...) EINA_LOG_DOM_ERR(_edje_default_log_dom, __VA_ARGS__)
75#ifdef INF
76# undef INF
77#endif
78#define INF(...) EINA_LOG_DOM_INFO(_edje_default_log_dom, __VA_ARGS__)
79#ifdef WRN
80# undef WRN
81#endif
82#define WRN(...) EINA_LOG_DOM_WARN(_edje_default_log_dom, __VA_ARGS__)
83#ifdef CRIT
84# undef CRIT
85#endif
86#define CRIT(...) EINA_LOG_DOM_CRIT(_edje_default_log_dom, __VA_ARGS__)
87#ifdef __GNUC__
88# if __GNUC__ >= 4
89// BROKEN in gcc 4 on amd64
90//# pragma GCC visibility push(hidden)
91# endif
92#endif
93
94#ifndef ABS
95#define ABS(x) ((x) < 0 ? -(x) : (x))
96#endif
97
98#ifndef CLAMP
99#define CLAMP(x, min, max) (((x) > (max)) ? (max) : (((x) < (min)) ? (min) : (x)))
100#endif
101
102#ifndef MIN
103#define MIN(a, b) (((a) < (b)) ? (a) : (b))
104#endif
105
106
107#ifdef BUILD_EDJE_FP
108
109#define FLOAT_T Eina_F32p32
110#define EDJE_T_FLOAT EET_T_F32P32
111#define MUL(a, b) eina_f32p32_mul(a, b)
112#define SCALE(a, b) eina_f32p32_scale(a, b)
113#define DIV(a, b) eina_f32p32_div(a, b)
114#define DIV2(a) ((a) >> 1)
115#define ADD(a, b) eina_f32p32_add(a, b)
116#define SUB(a, b) eina_f32p32_sub(a, b)
117#define SQRT(a) eina_f32p32_sqrt(a)
118#define TO_DOUBLE(a) eina_f32p32_double_to(a)
119#define FROM_DOUBLE(a) eina_f32p32_double_from(a)
120#define FROM_INT(a) eina_f32p32_int_from(a)
121#define TO_INT(a) eina_f32p32_int_to(a)
122#define ZERO 0
123#define COS(a) eina_f32p32_cos(a)
124#define SIN(a) eina_f32p32_sin(a)
125#define PI EINA_F32P32_PI
126
127#else
128
129#define FLOAT_T double
130#define EDJE_T_FLOAT EET_T_DOUBLE
131#define MUL(a, b) ((a) * (b))
132#define SCALE(a, b) ((a) * (double)(b))
133#define DIV(a, b) ((a) / (b))
134#define DIV2(a) ((a) / 2.0)
135#define ADD(a, b) ((a) + (b))
136#define SUB(a, b) ((a) - (b))
137#define SQRT(a) sqrt(a)
138#define TO_DOUBLE(a) (double)(a)
139#define FROM_DOUBLE(a) (a)
140#define FROM_INT(a) (double)(a)
141#define TO_INT(a) (int)(a)
142#define ZERO 0.0
143#define COS(a) cos(a)
144#define SIN(a) sin(a)
145#define PI 3.14159265358979323846
146
147#endif
148
149/* Inheritable Edje Smart API. For now private so only Edje Edit makes
150 * use of this, but who knows what will be possible in the future */
151#define EDJE_SMART_API_VERSION 1
152
153typedef struct _Edje_Smart_Api Edje_Smart_Api;
154
155struct _Edje_Smart_Api
156{
157 Evas_Smart_Class base;
158 int version;
159 Eina_Bool (*file_set)(Evas_Object *obj, const char *file, const char *group);
160};
161
162/* Basic macro to init the Edje Smart API */
163#define EDJE_SMART_API_INIT(smart_class_init) {smart_class_init, EDJE_SMART_API_VERSION, NULL}
164
165#define EDJE_SMART_API_INIT_NULL EDJE_SMART_API_INIT(EVAS_SMART_CLASS_INIT_NULL)
166#define EDJE_SMART_API_INIT_VERSION EDJE_SMART_API_INIT(EVAS_SMART_CLASS_INIT_VERSION)
167#define EDJE_SMART_API_INIT_NAME_VERSION(name) EDJE_SMART_API_INIT(EVAS_SMART_CLASS_INIT_NAME_VERSION(name))
168
169/* increment this when the EET data descriptors have changed and old
170 * EETs cannot be loaded/used correctly anymore.
171 */
172#define EDJE_FILE_VERSION 3
173/* increment this when you add new feature to edje file format without
174 * breaking backward compatibility.
175 */
176#define EDJE_FILE_MINOR 2
177
178/* FIXME:
179 *
180 * More example Edje files
181 *
182 * ? programs can do multiple actions from one signal
183 * ? add containering (hbox, vbox, table, wrapping multi-line hbox & vbox)
184 * ? text entry widget (single line only)
185 *
186 * ? recursions, unsafe callbacks outside Edje etc. with freeze, ref/unref and block/unblock and break_programs needs to be redesigned & fixed
187 * ? all unsafe calls that may result in callbacks must be marked and dealt with
188 */
189
190typedef enum
191{
192 EDJE_ASPECT_PREFER_NONE,
193 EDJE_ASPECT_PREFER_VERTICAL,
194 EDJE_ASPECT_PREFER_HORIZONTAL,
195 EDJE_ASPECT_PREFER_BOTH
196} Edje_Internal_Aspect;
197
198struct _Edje_Perspective
199{
200 Evas_Object *obj;
201 Evas *e;
202 Evas_Coord px, py, z0, foc;
203 Eina_List *users;
204 Eina_Bool global : 1;
205};
206
207struct _Edje_Position_Scale
208{
209 FLOAT_T x, y;
210};
211
212struct _Edje_Position
213{
214 int x, y;
215};
216
217struct _Edje_Size
218{
219 int w, h;
220};
221
222struct _Edje_Rectangle
223{
224 int x, y, w, h;
225};
226
227struct _Edje_Color
228{
229 unsigned char r, g, b, a;
230};
231
232struct _Edje_Aspect_Prefer
233{
234 FLOAT_T min, max;
235 Edje_Internal_Aspect prefer;
236};
237
238struct _Edje_Aspect
239{
240 int w, h;
241 Edje_Aspect_Control mode;
242};
243
244struct _Edje_String
245{
246 const char *str;
247 unsigned int id;
248};
249
250typedef struct _Edje_Position_Scale Edje_Alignment;
251typedef struct _Edje_Position_Scale Edje_Position_Scale;
252typedef struct _Edje_Position Edje_Position;
253typedef struct _Edje_Size Edje_Size;
254typedef struct _Edje_Rectangle Edje_Rectangle;
255typedef struct _Edje_Color Edje_Color;
256typedef struct _Edje_Aspect_Prefer Edje_Aspect_Prefer;
257typedef struct _Edje_Aspect Edje_Aspect;
258typedef struct _Edje_String Edje_String;
259
260typedef struct _Edje_File Edje_File;
261typedef struct _Edje_Style Edje_Style;
262typedef struct _Edje_Style_Tag Edje_Style_Tag;
263typedef struct _Edje_External_Directory Edje_External_Directory;
264typedef struct _Edje_External_Directory_Entry Edje_External_Directory_Entry;
265typedef struct _Edje_Font_Directory_Entry Edje_Font_Directory_Entry;
266typedef struct _Edje_Image_Directory Edje_Image_Directory;
267typedef struct _Edje_Image_Directory_Entry Edje_Image_Directory_Entry;
268typedef struct _Edje_Image_Directory_Set Edje_Image_Directory_Set;
269typedef struct _Edje_Image_Directory_Set_Entry Edje_Image_Directory_Set_Entry;
270typedef struct _Edje_Limit Edje_Limit;
271typedef struct _Edje_Sound_Sample Edje_Sound_Sample;
272typedef struct _Edje_Sound_Tone Edje_Sound_Tone;
273typedef struct _Edje_Sound_Directory Edje_Sound_Directory;
274typedef struct _Edje_Program Edje_Program;
275typedef struct _Edje_Program_Target Edje_Program_Target;
276typedef struct _Edje_Program_After Edje_Program_After;
277typedef struct _Edje_Part_Collection_Directory_Entry Edje_Part_Collection_Directory_Entry;
278typedef struct _Edje_Pack_Element Edje_Pack_Element;
279typedef struct _Edje_Part_Collection Edje_Part_Collection;
280typedef struct _Edje_Part Edje_Part;
281typedef struct _Edje_Part_Api Edje_Part_Api;
282typedef struct _Edje_Part_Dragable Edje_Part_Dragable;
283typedef struct _Edje_Part_Image_Id Edje_Part_Image_Id;
284typedef struct _Edje_Part_Description_Image Edje_Part_Description_Image;
285typedef struct _Edje_Part_Description_Proxy Edje_Part_Description_Proxy;
286typedef struct _Edje_Part_Description_Text Edje_Part_Description_Text;
287typedef struct _Edje_Part_Description_Box Edje_Part_Description_Box;
288typedef struct _Edje_Part_Description_Table Edje_Part_Description_Table;
289typedef struct _Edje_Part_Description_External Edje_Part_Description_External;
290typedef struct _Edje_Part_Description_Common Edje_Part_Description_Common;
291typedef struct _Edje_Part_Description_Spec_Fill Edje_Part_Description_Spec_Fill;
292typedef struct _Edje_Part_Description_Spec_Border Edje_Part_Description_Spec_Border;
293typedef struct _Edje_Part_Description_Spec_Image Edje_Part_Description_Spec_Image;
294typedef struct _Edje_Part_Description_Spec_Proxy Edje_Part_Description_Spec_Proxy;
295typedef struct _Edje_Part_Description_Spec_Text Edje_Part_Description_Spec_Text;
296typedef struct _Edje_Part_Description_Spec_Box Edje_Part_Description_Spec_Box;
297typedef struct _Edje_Part_Description_Spec_Table Edje_Part_Description_Spec_Table;
298typedef struct _Edje_Patterns Edje_Patterns;
299typedef struct _Edje_Part_Box_Animation Edje_Part_Box_Animation;
300
301typedef struct _Edje Edje;
302typedef struct _Edje_Real_Part_State Edje_Real_Part_State;
303typedef struct _Edje_Real_Part_Drag Edje_Real_Part_Drag;
304typedef struct _Edje_Real_Part_Set Edje_Real_Part_Set;
305typedef struct _Edje_Real_Part Edje_Real_Part;
306typedef struct _Edje_Running_Program Edje_Running_Program;
307typedef struct _Edje_Signal_Callback Edje_Signal_Callback;
308typedef struct _Edje_Calc_Params Edje_Calc_Params;
309typedef struct _Edje_Pending_Program Edje_Pending_Program;
310typedef struct _Edje_Text_Style Edje_Text_Style;
311typedef struct _Edje_Color_Class Edje_Color_Class;
312typedef struct _Edje_Text_Class Edje_Text_Class;
313typedef struct _Edje_Var Edje_Var;
314typedef struct _Edje_Var_Int Edje_Var_Int;
315typedef struct _Edje_Var_Float Edje_Var_Float;
316typedef struct _Edje_Var_String Edje_Var_String;
317typedef struct _Edje_Var_List Edje_Var_List;
318typedef struct _Edje_Var_Hash Edje_Var_Hash;
319typedef struct _Edje_Var_Animator Edje_Var_Animator;
320typedef struct _Edje_Var_Timer Edje_Var_Timer;
321typedef struct _Edje_Var_Pool Edje_Var_Pool;
322typedef struct _Edje_Signal_Source_Char Edje_Signal_Source_Char;
323typedef struct _Edje_Text_Insert_Filter_Callback Edje_Text_Insert_Filter_Callback;
324
325#define EDJE_INF_MAX_W 100000
326#define EDJE_INF_MAX_H 100000
327
328#define EDJE_IMAGE_SOURCE_TYPE_NONE 0
329#define EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT 1
330#define EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY 2
331#define EDJE_IMAGE_SOURCE_TYPE_EXTERNAL 3
332#define EDJE_IMAGE_SOURCE_TYPE_LAST 4
333
334#define EDJE_SOUND_SOURCE_TYPE_NONE 0
335#define EDJE_SOUND_SOURCE_TYPE_INLINE_RAW 1
336#define EDJE_SOUND_SOURCE_TYPE_INLINE_COMP 2
337#define EDJE_SOUND_SOURCE_TYPE_INLINE_LOSSY 3
338#define EDJE_SOUND_SOURCE_TYPE_INLINE_AS_IS 4
339
340#define EDJE_VAR_NONE 0
341#define EDJE_VAR_INT 1
342#define EDJE_VAR_FLOAT 2
343#define EDJE_VAR_STRING 3
344#define EDJE_VAR_LIST 4
345#define EDJE_VAR_HASH 5
346
347#define EDJE_VAR_MAGIC_BASE 0x12fe84ba
348
349#define EDJE_STATE_PARAM_NONE 0
350#define EDJE_STATE_PARAM_ALIGNMENT 1
351#define EDJE_STATE_PARAM_MIN 2
352#define EDJE_STATE_PARAM_MAX 3
353#define EDJE_STATE_PARAM_STEP 4
354#define EDJE_STATE_PARAM_ASPECT 5
355#define EDJE_STATE_PARAM_ASPECT_PREF 6
356#define EDJE_STATE_PARAM_COLOR 7
357#define EDJE_STATE_PARAM_COLOR2 8
358#define EDJE_STATE_PARAM_COLOR3 9
359#define EDJE_STATE_PARAM_COLOR_CLASS 10
360#define EDJE_STATE_PARAM_REL1 11
361#define EDJE_STATE_PARAM_REL1_TO 12
362#define EDJE_STATE_PARAM_REL1_OFFSET 13
363#define EDJE_STATE_PARAM_REL2 14
364#define EDJE_STATE_PARAM_REL2_TO 15
365#define EDJE_STATE_PARAM_REL2_OFFSET 16
366#define EDJE_STATE_PARAM_IMAGE 17
367#define EDJE_STATE_PARAM_BORDER 18
368#define EDJE_STATE_PARAM_FILL_SMOOTH 19
369#define EDJE_STATE_PARAM_FILL_POS 20
370#define EDJE_STATE_PARAM_FILL_SIZE 21
371#define EDJE_STATE_PARAM_TEXT 22
372#define EDJE_STATE_PARAM_TEXT_CLASS 23
373#define EDJE_STATE_PARAM_TEXT_FONT 24
374#define EDJE_STATE_PARAM_TEXT_STYLE 25
375#define EDJE_STATE_PARAM_TEXT_SIZE 26
376#define EDJE_STATE_PARAM_TEXT_FIT 27
377#define EDJE_STATE_PARAM_TEXT_MIN 28
378#define EDJE_STATE_PARAM_TEXT_MAX 29
379#define EDJE_STATE_PARAM_TEXT_ALIGN 30
380#define EDJE_STATE_PARAM_VISIBLE 31
381#define EDJE_STATE_PARAM_MAP_OM 32
382#define EDJE_STATE_PARAM_MAP_PERSP 33
383#define EDJE_STATE_PARAM_MAP_LIGNT 34
384#define EDJE_STATE_PARAM_MAP_ROT_CENTER 35
385#define EDJE_STATE_PARAM_MAP_ROT_X 36
386#define EDJE_STATE_PARAM_MAP_ROT_Y 37
387#define EDJE_STATE_PARAM_MAP_ROT_Z 38
388#define EDJE_STATE_PARAM_MAP_BACK_CULL 39
389#define EDJE_STATE_PARAM_MAP_PERSP_ON 40
390#define EDJE_STATE_PARAM_PERSP_ZPLANE 41
391#define EDJE_STATE_PARAM_PERSP_FOCAL 42
392#define EDJE_STATE_PARAM_LAST 43
393
394#define EDJE_ENTRY_EDIT_MODE_NONE 0
395#define EDJE_ENTRY_EDIT_MODE_SELECTABLE 1
396#define EDJE_ENTRY_EDIT_MODE_EDITABLE 2
397#define EDJE_ENTRY_EDIT_MODE_PASSWORD 3
398
399#define EDJE_ENTRY_SELECTION_MODE_DEFAULT 0
400#define EDJE_ENTRY_SELECTION_MODE_EXPLICIT 1
401
402#define EDJE_ENTRY_CURSOR_MODE_UNDER 0
403#define EDJE_ENTRY_CURSOR_MODE_BEFORE 1
404
405#define EDJE_ORIENTATION_AUTO 0
406#define EDJE_ORIENTATION_LTR 1
407#define EDJE_ORIENTATION_RTL 2
408
409#define EDJE_PART_PATH_SEPARATOR ':'
410#define EDJE_PART_PATH_SEPARATOR_STRING ":"
411#define EDJE_PART_PATH_SEPARATOR_INDEXL '['
412#define EDJE_PART_PATH_SEPARATOR_INDEXR ']'
413
414#define FLAG_NONE 0
415#define FLAG_X 0x01
416#define FLAG_Y 0x02
417#define FLAG_XY (FLAG_X | FLAG_Y)
418
419/*----------*/
420
421struct _Edje_File
422{
423 const char *path;
424 time_t mtime;
425
426 Edje_External_Directory *external_dir;
427 Edje_Image_Directory *image_dir;
428 Edje_Sound_Directory *sound_dir;
429 Eina_List *styles;
430 Eina_List *color_classes;
431
432 int references;
433 const char *compiler;
434 int version;
435 int minor;
436 int feature_ver;
437
438 Eina_Hash *data;
439 Eina_Hash *fonts;
440
441 Eina_Hash *collection;
442 Eina_List *collection_cache;
443
444 Edje_Patterns *collection_patterns;
445
446 Eet_File *ef;
447
448 unsigned char free_strings : 1;
449 unsigned char dangling : 1;
450 unsigned char warning : 1;
451};
452
453struct _Edje_Style
454{
455 char *name;
456 Eina_List *tags;
457 Evas_Textblock_Style *style;
458};
459
460struct _Edje_Style_Tag
461{
462 const char *key;
463 const char *value;
464 const char *font;
465 double font_size;
466 const char *text_class;
467};
468
469/*----------*/
470
471
472struct _Edje_Font_Directory_Entry
473{
474 const char *entry; /* the name of the font */
475 const char *file; /* the name of the file */
476};
477
478/*----------*/
479
480struct _Edje_External_Directory
481{
482 Edje_External_Directory_Entry *entries; /* a list of Edje_External_Directory_Entry */
483 unsigned int entries_count;
484};
485
486struct _Edje_External_Directory_Entry
487{
488 const char *entry; /* the name of the external */
489};
490
491
492/*----------*/
493
494
495
496/*----------*/
497
498struct _Edje_Image_Directory
499{
500 Edje_Image_Directory_Entry *entries; /* an array of Edje_Image_Directory_Entry */
501 unsigned int entries_count;
502
503 Edje_Image_Directory_Set *sets;
504 unsigned int sets_count; /* an array of Edje_Image_Directory_Set */
505};
506
507struct _Edje_Image_Directory_Entry
508{
509 const char *entry; /* the nominal name of the image - if any */
510 int source_type; /* alternate source mode. 0 = none */
511 int source_param; /* extra params on encoding */
512 int id; /* the id no. of the image */
513};
514
515struct _Edje_Image_Directory_Set
516{
517 char *name;
518 Eina_List *entries;
519
520 int id;
521};
522
523struct _Edje_Image_Directory_Set_Entry
524{
525 const char *name;
526 int id;
527
528 struct {
529 struct {
530 int w;
531 int h;
532 } min, max;
533 } size;
534};
535
536struct _Edje_Sound_Sample /*Sound Sample*/
537{
538 const char *name; /* the nominal name of the sound */
539 const char *snd_src; /* Sound source Wav file */
540 int compression; /* Compression - RAW, LOSSLESS COMP , LOSSY ) */
541 int mode; /* alternate source mode. 0 = none */
542 double quality;
543 int id; /* the id no. of the sound */
544};
545
546struct _Edje_Sound_Tone /*Sound Sample*/
547{
548 const char *name; /* the nominal name of the sound - if any */
549 int value; /* alternate source mode. 0 = none */
550 int id; /* the id no. of the sound */
551};
552
553struct _Edje_Sound_Directory
554{
555
556 Edje_Sound_Sample *samples; /* an array of Edje_Sound_Sample entries */
557 unsigned int samples_count;
558
559 Edje_Sound_Tone *tones; /* an array of Edje_Sound_Tone entries */
560 unsigned int tones_count;
561};
562
563/*----------*/
564
565struct _Edje_Program /* a conditional program to be run */
566{
567 int id; /* id of program */
568 const char *name; /* name of the action */
569
570 const char *signal; /* if signal emission name matches the glob here... */
571 const char *source; /* if part that emitted this (name) matches this glob */
572 const char *sample_name;
573 const char *tone_name;
574 double duration;
575 double speed;
576
577 struct {
578 const char *part;
579 const char *state; /* if state is not set, we will try with source */
580 } filter; /* the part filter.part should be in state filter.state for signal to be accepted */
581
582 struct {
583 double from;
584 double range;
585 } in;
586
587 int action; /* type - set state, stop action, set drag pos etc. */
588 const char *state; /* what state of alternates to apply, NULL = default */
589 const char *state2; /* what other state to use - for signal emit action */
590 double value; /* value of state to apply (if multiple names match) */
591 double value2; /* other value for drag actions */
592
593 struct {
594 int mode; /* how to tween - linear, sinusoidal etc. */
595 FLOAT_T time; /* time to graduate between current and new state */
596 FLOAT_T v1; /* other value for drag actions */
597 FLOAT_T v2; /* other value for drag actions */
598 } tween;
599
600 Eina_List *targets; /* list of target parts to apply the state to */
601
602 Eina_List *after; /* list of actions to run at the end of this, for looping */
603
604 struct {
605 const char *name;
606 const char *description;
607 } api;
608
609 /* used for PARAM_COPY (param names in state and state2 above!) */
610 struct {
611 int src; /* part where parameter is being retrieved */
612 int dst; /* part where parameter is being stored */
613 } param;
614};
615
616struct _Edje_Program_Target /* the target of an action */
617{
618 int id; /* just the part id no, or action id no */
619};
620
621struct _Edje_Program_After /* the action to run after another action */
622{
623 int id;
624};
625
626/*----------*/
627struct _Edje_Limit
628{
629 const char *name;
630 int value;
631};
632
633/*----------*/
634#define PART_TYPE_FIELDS(TYPE) \
635 TYPE RECTANGLE; \
636 TYPE TEXT; \
637 TYPE IMAGE; \
638 TYPE PROXY; \
639 TYPE SWALLOW; \
640 TYPE TEXTBLOCK; \
641 TYPE GROUP; \
642 TYPE BOX; \
643 TYPE TABLE; \
644 TYPE EXTERNAL;
645
646struct _Edje_Part_Collection_Directory_Entry
647{
648 const char *entry; /* the nominal name of the part collection */
649 int id; /* the id of this named part collection */
650
651 struct
652 {
653 PART_TYPE_FIELDS(int)
654 int part;
655 } count;
656
657 struct
658 {
659 PART_TYPE_FIELDS(Eina_Mempool *)
660 Eina_Mempool *part;
661 } mp;
662
663 struct
664 {
665 PART_TYPE_FIELDS(Eina_Mempool *)
666 } mp_rtl; /* For Right To Left interface */
667
668 Edje_Part_Collection *ref;
669};
670
671/*----------*/
672
673/*----------*/
674
675struct _Edje_Pack_Element
676{
677 unsigned char type; /* only GROUP supported for now */
678 Edje_Real_Part *parent; /* pointer to the table/box that hold it, set at runtime */
679 const char *name; /* if != NULL, will be set with evas_object_name_set */
680 const char *source; /* group name to use as source for this element */
681 Edje_Size min, prefer, max;
682 struct {
683 int l, r, t, b;
684 } padding;
685 Edje_Alignment align;
686 Edje_Alignment weight;
687 Edje_Aspect aspect;
688 const char *options; /* extra options for custom objects */
689 /* table specific follows */
690 int col, row;
691 unsigned short colspan, rowspan;
692};
693
694/*----------*/
695
696struct _Edje_Part_Collection
697{
698 struct { /* list of Edje_Program */
699 Edje_Program **fnmatch; /* complex match with "*?[\" */
700 unsigned int fnmatch_count;
701
702 Edje_Program **strcmp; /* No special caractere, plain strcmp does the work */
703 unsigned int strcmp_count;
704
705 Edje_Program **strncmp; /* Finish by * or ?, plain strncmp does the work */
706 unsigned int strncmp_count;
707
708 Edje_Program **strrncmp; /* Start with * or ?, reverse strncmp will do the job */
709 unsigned int strrncmp_count;
710
711 Edje_Program **nocmp; /* Empty signal/source that will never match */
712 unsigned int nocmp_count;
713 } programs;
714
715 struct { /* list of limit that need to be monitored */
716 Edje_Limit **vertical;
717 unsigned int vertical_count;
718
719 Edje_Limit **horizontal;
720 unsigned int horizontal_count;
721 } limits;
722
723 Edje_Part **parts; /* an array of Edje_Part */
724 unsigned int parts_count;
725
726 Eina_Hash *data;
727
728 int id; /* the collection id */
729
730 Eina_Hash *alias; /* aliasing part */
731 Eina_Hash *aliased; /* invert match of alias */
732
733 struct {
734 Edje_Size min, max;
735 unsigned char orientation;
736 } prop;
737
738 int references;
739
740#ifdef EDJE_PROGRAM_CACHE
741 struct {
742 Eina_Hash *no_matches;
743 Eina_Hash *matches;
744 } prog_cache;
745#endif
746
747 Embryo_Program *script; /* all the embryo script code for this group */
748 const char *part;
749
750 unsigned char script_only;
751
752 unsigned char lua_script_only;
753
754 unsigned char checked : 1;
755};
756
757struct _Edje_Part_Dragable
758{
759 int step_x; /* drag jumps n pixels (0 = no limit) */
760 int step_y; /* drag jumps n pixels (0 = no limit) */
761
762 int count_x; /* drag area divided by n (0 = no limit) */
763 int count_y; /* drag area divided by n (0 = no limit) */
764
765 int confine_id; /* dragging within this bit, -1 = no */
766
767 /* davinchi */
768 int event_id; /* If it is used as scrollbar */
769
770 signed char x; /* can u click & drag this bit in x dir */
771 signed char y; /* can u click & drag this bit in y dir */
772};
773
774struct _Edje_Part_Api
775{
776 const char *name;
777 const char *description;
778};
779
780typedef struct _Edje_Part_Description_List Edje_Part_Description_List;
781struct _Edje_Part_Description_List
782{
783 Edje_Part_Description_Common **desc;
784 Edje_Part_Description_Common **desc_rtl; /* desc for Right To Left interface */
785 unsigned int desc_count;
786};
787
788struct _Edje_Part
789{
790 const char *name; /* the name if any of the part */
791 Edje_Part_Description_Common *default_desc; /* the part descriptor for default */
792 Edje_Part_Description_Common *default_desc_rtl; /* default desc for Right To Left interface */
793
794 Edje_Part_Description_List other; /* other possible descriptors */
795
796 const char *source, *source2, *source3, *source4, *source5, *source6;
797 int id; /* its id number */
798 int clip_to_id; /* the part id to clip this one to */
799 Edje_Part_Dragable dragable;
800 Edje_Pack_Element **items; /* packed items for box and table */
801 unsigned int items_count;
802 unsigned char type; /* what type (image, rect, text) */
803 unsigned char effect; /* 0 = plain... */
804 unsigned char mouse_events; /* it will affect/respond to mouse events */
805 unsigned char repeat_events; /* it will repeat events to objects below */
806 Evas_Event_Flags ignore_flags;
807 unsigned char scale; /* should certain properties scale with edje scale factor? */
808 unsigned char precise_is_inside;
809 unsigned char use_alternate_font_metrics;
810 unsigned char pointer_mode;
811 unsigned char entry_mode;
812 unsigned char select_mode;
813 unsigned char cursor_mode;
814 unsigned char multiline;
815 Edje_Part_Api api;
816};
817
818struct _Edje_Part_Image_Id
819{
820 int id;
821 Eina_Bool set;
822};
823
824struct _Edje_Part_Description_Common
825{
826 struct {
827 double value; /* the value of the state (for ranges) */
828 const char *name; /* the named state if any */
829 } state;
830
831 Edje_Alignment align; /* 0 <-> 1.0 alignment within allocated space */
832
833 struct {
834 unsigned char w, h; /* width or height is fixed in side (cannot expand with Edje object size) */
835 } fixed;
836
837 Edje_Size min, max;
838 Edje_Position step; /* size stepping by n pixels, 0 = none */
839 Edje_Aspect_Prefer aspect;
840
841 char *color_class; /* how to modify the color */
842 Edje_Color color;
843 Edje_Color color2;
844
845 struct {
846 FLOAT_T relative_x;
847 FLOAT_T relative_y;
848 int offset_x;
849 int offset_y;
850 int id_x; /* -1 = whole part collection, or part ID */
851 int id_y; /* -1 = whole part collection, or part ID */
852 } rel1, rel2;
853
854 struct {
855 int id_persp;
856 int id_light;
857 struct {
858 int id_center;
859 FLOAT_T x, y, z;
860 } rot;
861 unsigned char backcull;
862 unsigned char on;
863 unsigned char persp_on;
864 unsigned char smooth;
865 unsigned char alpha;
866 } map;
867
868 struct {
869 int zplane;
870 int focal;
871 } persp;
872
873 unsigned char visible; /* is it shown */
874};
875
876struct _Edje_Part_Description_Spec_Fill
877{
878 FLOAT_T pos_rel_x; /* fill offset x relative to area */
879 FLOAT_T rel_x; /* relative size compared to area */
880 FLOAT_T pos_rel_y; /* fill offset y relative to area */
881 FLOAT_T rel_y; /* relative size compared to area */
882 int pos_abs_x; /* fill offset x added to fill offset */
883 int abs_x; /* size of fill added to relative fill */
884 int pos_abs_y; /* fill offset y added to fill offset */
885 int abs_y; /* size of fill added to relative fill */
886 int angle; /* angle of fill -- currently only used by grads */
887 int spread; /* spread of fill -- currently only used by grads */
888 char smooth; /* fill with smooth scaling or not */
889 unsigned char type; /* fill coordinate from container (SCALE) or from source image (TILE) */
890};
891
892struct _Edje_Part_Description_Spec_Border
893{
894 int l, r, t, b; /* border scaling on image fill */
895 unsigned char no_fill; /* do we fill the center of the image if bordered? 1 == NO!!!! */
896 unsigned char scale; /* scale image border by same as scale factor */
897 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" */
898};
899
900struct _Edje_Part_Description_Spec_Image
901{
902 Edje_Part_Description_Spec_Fill fill;
903
904 Edje_Part_Image_Id **tweens; /* list of Edje_Part_Image_Id */
905 unsigned int tweens_count; /* number of tweens */
906
907 int id; /* the image id to use */
908 int scale_hint; /* evas scale hint */
909 Eina_Bool set; /* if image condition it's content */
910
911 Edje_Part_Description_Spec_Border border;
912};
913
914struct _Edje_Part_Description_Spec_Proxy
915{
916 Edje_Part_Description_Spec_Fill fill;
917
918 int id; /* the part id to use as a source for this state */
919};
920
921struct _Edje_Part_Description_Spec_Text
922{
923 Edje_String text; /* if "" or NULL, then leave text unchanged */
924 char *text_class; /* how to apply/modify the font */
925 Edje_String style; /* the text style if a textblock */
926 Edje_String font; /* if a specific font is asked for */
927 Edje_String repch; /* replacement char for password mode entry */
928
929 Edje_Alignment align; /* text alignment within bounds */
930 Edje_Color color3;
931
932 double elipsis; /* 0.0 - 1.0 defining where the elipsis align */
933 int size; /* 0 = use user set size */
934 int id_source; /* -1 if none */
935 int id_text_source; /* -1 if none */
936
937 unsigned char fit_x; /* resize font size down to fit in x dir */
938 unsigned char fit_y; /* resize font size down to fit in y dir */
939 unsigned char min_x; /* if text size should be part min size */
940 unsigned char min_y; /* if text size should be part min size */
941 unsigned char max_x; /* if text size should be part max size */
942 unsigned char max_y; /* if text size should be part max size */
943 int size_range_min;
944 int size_range_max; /* -1 means, no bound. */
945};
946
947struct _Edje_Part_Description_Spec_Box
948{
949 char *layout, *alt_layout;
950 Edje_Alignment align;
951 struct {
952 int x, y;
953 } padding;
954 struct {
955 unsigned char h, v;
956 } min;
957};
958
959struct _Edje_Part_Description_Spec_Table
960{
961 unsigned char homogeneous;
962 Edje_Alignment align;
963 struct {
964 int x, y;
965 } padding;
966 struct {
967 unsigned char h, v;
968 } min;
969};
970
971struct _Edje_Part_Description_Image
972{
973 Edje_Part_Description_Common common;
974 Edje_Part_Description_Spec_Image image;
975};
976
977struct _Edje_Part_Description_Proxy
978{
979 Edje_Part_Description_Common common;
980 Edje_Part_Description_Spec_Proxy proxy;
981};
982
983struct _Edje_Part_Description_Text
984{
985 Edje_Part_Description_Common common;
986 Edje_Part_Description_Spec_Text text;
987};
988
989struct _Edje_Part_Description_Box
990{
991 Edje_Part_Description_Common common;
992 Edje_Part_Description_Spec_Box box;
993};
994
995struct _Edje_Part_Description_Table
996{
997 Edje_Part_Description_Common common;
998 Edje_Part_Description_Spec_Table table;
999};
1000
1001struct _Edje_Part_Description_External
1002{
1003 Edje_Part_Description_Common common;
1004 Eina_List *external_params; /* parameters for external objects */
1005};
1006
1007/*----------*/
1008
1009struct _Edje_Signal_Source_Char
1010{
1011 EINA_RBTREE;
1012
1013 const char *signal;
1014 const char *source;
1015
1016 Eina_List *list;
1017};
1018
1019struct _Edje_Signals_Sources_Patterns
1020
1021{
1022 Edje_Patterns *signals_patterns;
1023 Edje_Patterns *sources_patterns;
1024
1025 Eina_Rbtree *exact_match;
1026
1027 union {
1028 struct {
1029 Edje_Program **globing;
1030 unsigned int count;
1031 } programs;
1032 struct {
1033 Eina_List *globing;
1034 } callbacks;
1035 } u;
1036};
1037
1038typedef struct _Edje_Signals_Sources_Patterns Edje_Signals_Sources_Patterns;
1039
1040struct _Edje
1041{
1042 Evas_Object_Smart_Clipped_Data base;
1043 /* This contains (or should):
1044 Evas_Object *clipper; // a big rect to clip this Edje to
1045 Evas *evas; // the Evas this Edje belongs to
1046 */
1047 const Edje_Smart_Api *api;
1048 const char *path;
1049 const char *group;
1050 const char *parent;
1051
1052 Evas_Coord x, y, w, h;
1053 Edje_Size min;
1054 double paused_at;
1055 Evas_Object *obj; /* the smart object */
1056 Edje_File *file; /* the file the data comes form */
1057 Edje_Part_Collection *collection; /* the description being used */
1058 Eina_List *actions; /* currently running actions */
1059 Eina_List *callbacks;
1060 Eina_List *pending_actions;
1061 Eina_List *color_classes;
1062 Eina_List *text_classes;
1063 /* variable pool for Edje Embryo scripts */
1064 Edje_Var_Pool *var_pool;
1065 /* for faster lookups to avoid nth list walks */
1066 Edje_Real_Part **table_parts;
1067 Edje_Program **table_programs;
1068 Edje_Real_Part *focused_part;
1069 Eina_List *subobjs;
1070 Eina_List *text_insert_filter_callbacks;
1071 void *script_only_data;
1072
1073 int table_programs_size;
1074 unsigned int table_parts_size;
1075
1076 struct {
1077 Eina_Hash *text_class;
1078 Eina_Hash *color_class;
1079 } members;
1080
1081 Edje_Perspective *persp;
1082
1083 struct {
1084 Edje_Signals_Sources_Patterns callbacks;
1085 Edje_Signals_Sources_Patterns programs;
1086 } patterns;
1087
1088 int references;
1089 int block;
1090 int load_error;
1091 int freeze;
1092 FLOAT_T scale;
1093 Eina_Bool is_rtl : 1;
1094
1095 struct {
1096 Edje_Text_Change_Cb func;
1097 void *data;
1098 } text_change;
1099
1100 struct {
1101 Edje_Message_Handler_Cb func;
1102 void *data;
1103 int num;
1104 } message;
1105 int processing_messages;
1106
1107 int state;
1108
1109 int preload_count;
1110
1111 lua_State *L;
1112 Eina_Inlist *lua_objs;
1113 int lua_ref;
1114
1115 struct {
1116 Edje_Item_Provider_Cb func;
1117 void *data;
1118 } item_provider;
1119
1120 unsigned int dirty : 1;
1121 unsigned int recalc : 1;
1122 unsigned int walking_callbacks : 1;
1123 unsigned int delete_callbacks : 1;
1124 unsigned int just_added_callbacks : 1;
1125 unsigned int have_objects : 1;
1126 unsigned int paused : 1;
1127 unsigned int no_anim : 1;
1128 unsigned int calc_only : 1;
1129 unsigned int walking_actions : 1;
1130 unsigned int block_break : 1;
1131 unsigned int delete_me : 1;
1132 unsigned int postponed : 1;
1133 unsigned int freeze_calc : 1;
1134 unsigned int has_entries : 1;
1135 unsigned int entries_inited : 1;
1136#ifdef EDJE_CALC_CACHE
1137 unsigned int text_part_change : 1;
1138 unsigned int all_part_change : 1;
1139#endif
1140 unsigned int have_mapped_part : 1;
1141};
1142
1143struct _Edje_Calc_Params
1144{
1145 int x, y, w, h; // 16
1146 Edje_Rectangle req; // 16
1147 Edje_Rectangle req_drag; // 16
1148 Edje_Color color; // 4
1149 union {
1150 struct {
1151 struct {
1152 int x, y, w, h; // 16
1153 int angle; // 4
1154 int spread; // 4
1155 } fill; // 24
1156
1157 union {
1158 struct {
1159 int l, r, t, b; // 16
1160 } image; // 16
1161 } spec; // 16
1162 } common; // 40
1163 struct {
1164 Edje_Alignment align; /* text alignment within bounds */ // 16
1165 double elipsis; // 8
1166 int size; // 4
1167 Edje_Color color2, color3; // 8
1168 } text; // 36
1169 } type; // 40
1170 struct {
1171 struct {
1172 int x, y, z;
1173 } center; // 12
1174 struct {
1175 double x, y, z;
1176 } rotation; // 24
1177 struct {
1178 int x, y, z;
1179 int r, g, b;
1180 int ar, ag, ab;
1181 } light; // 36
1182 struct {
1183 int x, y, z;
1184 int focal;
1185 } persp;
1186 } map;
1187 unsigned char persp_on : 1;
1188 unsigned char lighted : 1;
1189 unsigned char mapped : 1;
1190 unsigned char visible : 1;
1191 unsigned char smooth : 1; // 1
1192}; // 96
1193
1194struct _Edje_Real_Part_Set
1195{
1196 Edje_Image_Directory_Set_Entry *entry; // 4
1197 Edje_Image_Directory_Set *set; // 4
1198
1199 int id; // 4
1200};
1201
1202struct _Edje_Real_Part_State
1203{
1204 Edje_Part_Description_Common *description; // 4
1205 Edje_Part_Description_Common *description_rtl; // 4
1206 Edje_Real_Part *rel1_to_x; // 4
1207 Edje_Real_Part *rel1_to_y; // 4
1208 Edje_Real_Part *rel2_to_x; // 4
1209 Edje_Real_Part *rel2_to_y; // 4
1210#ifdef EDJE_CALC_CACHE
1211 int state; // 4
1212 Edje_Calc_Params p; // 96
1213#endif
1214 void *external_params; // 4
1215 Edje_Real_Part_Set *set; // 4
1216}; // 32
1217// WITH EDJE_CALC_CACHE 132
1218
1219struct _Edje_Real_Part_Drag
1220{
1221 FLOAT_T x, y; // 16
1222 Edje_Position_Scale val, size, step, page; // 64
1223 struct {
1224 unsigned int count; // 4
1225 int x, y; // 8
1226 } down;
1227 struct {
1228 int x, y; // 8
1229 } tmp;
1230 unsigned char need_reset : 1; // 4
1231 Edje_Real_Part *confine_to; // 4
1232}; // 104
1233
1234struct _Edje_Real_Part
1235{
1236 Edje *edje; // 4
1237 Edje_Part *part; // 4
1238 Evas_Object *object; // 4
1239 int x, y, w, h; // 16
1240 Edje_Rectangle req; // 16
1241
1242 Eina_List *items; // 4 //FIXME: only if table/box
1243 Edje_Part_Box_Animation *anim; // 4 //FIXME: Used only if box
1244 void *entry_data; // 4 // FIXME: move to entry section
1245
1246 Evas_Object *swallowed_object; // 4 // FIXME: move with swallow_params data
1247 struct {
1248 Edje_Size min, max; // 16
1249 Edje_Aspect aspect; // 12
1250 } swallow_params; // 28 // FIXME: only if type SWALLOW
1251
1252 Edje_Real_Part_Drag *drag; // 4
1253 Edje_Real_Part *events_to; // 4
1254
1255 struct {
1256 Edje_Real_Part *source; // 4
1257 Edje_Real_Part *text_source; // 4
1258 const char *text; // 4
1259 Edje_Position offset; // 8 text only
1260 const char *font; // 4 text only
1261 const char *style; // 4 text only
1262 int size; // 4 text only
1263 struct {
1264 double in_w, in_h; // 16 text only
1265 int in_size; // 4 text only
1266 const char *in_str; // 4 text only
1267 const char *out_str; // 4 text only
1268 int out_size; // 4 text only
1269 FLOAT_T align_x, align_y; // 16 text only
1270 double elipsis; // 8 text only
1271 int fit_x, fit_y; // 8 text only
1272 } cache; // 64
1273 } text; // 86 // FIXME make text a potiner to struct and alloc at end
1274 // if part type is TEXT move common members textblock +
1275 // text to front and have smaller struct for textblock
1276
1277 FLOAT_T description_pos; // 8
1278 Edje_Part_Description_Common *chosen_description; // 4
1279 Edje_Real_Part_State param1; // 20
1280 // WITH EDJE_CALC_CACHE: 140
1281 Edje_Real_Part_State *param2, *custom; // 8
1282 Edje_Calc_Params *current; // 4
1283
1284#ifdef EDJE_CALC_CACHE
1285 int state; // 4
1286#endif
1287
1288 Edje_Real_Part *clip_to; // 4
1289
1290 Edje_Running_Program *program; // 4
1291
1292 int clicked_button; // 4
1293
1294 unsigned char calculated; // 1
1295 unsigned char calculating; // 1
1296
1297 unsigned char still_in : 1; // 1
1298#ifdef EDJE_CALC_CACHE
1299 unsigned char invalidate : 1; // 0
1300#endif
1301}; // 264
1302// WITH EDJE_CALC_CACHE: 404
1303
1304struct _Edje_Running_Program
1305{
1306 Edje *edje;
1307 Edje_Program *program;
1308 double start_time;
1309 char delete_me : 1;
1310};
1311
1312struct _Edje_Signal_Callback
1313{
1314 const char *signal;
1315 const char *source;
1316 Edje_Signal_Cb func;
1317 void *data;
1318 unsigned char just_added : 1;
1319 unsigned char delete_me : 1;
1320 unsigned char propagate : 1;
1321};
1322
1323struct _Edje_Text_Insert_Filter_Callback
1324{
1325 const char *part;
1326 Edje_Text_Filter_Cb func;
1327 void *data;
1328};
1329
1330struct _Edje_Pending_Program
1331{
1332 Edje *edje;
1333 Edje_Program *program;
1334 Ecore_Timer *timer;
1335};
1336
1337struct _Edje_Text_Style
1338{
1339 struct {
1340 unsigned char x, y;
1341 } offset;
1342 struct {
1343 unsigned char l, r, t, b;
1344 } pad;
1345 int num;
1346 struct {
1347 unsigned char color; /* 0 = color, 1, 2 = color2, color3 */
1348 signed char x, y; /* offset */
1349 unsigned char alpha;
1350 } members[32];
1351};
1352
1353struct _Edje_Color_Class
1354{
1355 const char *name;
1356 unsigned char r, g, b, a;
1357 unsigned char r2, g2, b2, a2;
1358 unsigned char r3, g3, b3, a3;
1359};
1360
1361struct _Edje_Text_Class
1362{
1363 const char *name;
1364 const char *font;
1365 Evas_Font_Size size;
1366};
1367
1368struct _Edje_Var_Int
1369{
1370 int v;
1371};
1372
1373struct _Edje_Var_Float
1374{
1375 double v;
1376};
1377
1378struct _Edje_Var_String
1379{
1380 char *v;
1381};
1382
1383struct _Edje_Var_List
1384{
1385 Eina_List *v;
1386};
1387
1388struct _Edje_Var_Hash
1389{
1390 Eina_Hash *v;
1391};
1392
1393struct _Edje_Var_Timer
1394{
1395 Edje *edje;
1396 int id;
1397 Embryo_Function func;
1398 int val;
1399 Ecore_Timer *timer;
1400};
1401
1402struct _Edje_Var_Animator
1403{
1404 Edje *edje;
1405 int id;
1406 Embryo_Function func;
1407 int val;
1408 double start, len;
1409 char delete_me;
1410};
1411
1412struct _Edje_Var_Pool
1413{
1414 int id_count;
1415 Eina_List *timers;
1416 Eina_List *animators;
1417 int size;
1418 Edje_Var *vars;
1419 int walking_list;
1420};
1421
1422struct _Edje_Var
1423{
1424 union {
1425 Edje_Var_Int i;
1426 Edje_Var_Float f;
1427 Edje_Var_String s;
1428 Edje_Var_List l;
1429 Edje_Var_Hash h;
1430 } data;
1431 unsigned char type;
1432};
1433
1434typedef enum _Edje_Queue
1435{
1436 EDJE_QUEUE_APP,
1437 EDJE_QUEUE_SCRIPT
1438} Edje_Queue;
1439
1440typedef struct _Edje_Message_Signal Edje_Message_Signal;
1441typedef struct _Edje_Message Edje_Message;
1442
1443typedef struct _Edje_Message_Signal_Data Edje_Message_Signal_Data;
1444struct _Edje_Message_Signal_Data
1445{
1446 int ref;
1447 void *data;
1448 void (*free_func)(void *);
1449};
1450
1451struct _Edje_Message_Signal
1452{
1453 const char *sig;
1454 const char *src;
1455 Edje_Message_Signal_Data *data;
1456};
1457
1458struct _Edje_Message
1459{
1460 Edje *edje;
1461 Edje_Queue queue;
1462 Edje_Message_Type type;
1463 int id;
1464 unsigned char *msg;
1465 Eina_Bool propagated : 1;
1466};
1467
1468typedef enum _Edje_Fill
1469{
1470 EDJE_FILL_TYPE_SCALE = 0,
1471 EDJE_FILL_TYPE_TILE
1472} Edje_Fill;
1473
1474typedef enum _Edje_Match_Error
1475{
1476 EDJE_MATCH_OK,
1477 EDJE_MATCH_ALLOC_ERROR,
1478 EDJE_MATCH_SYNTAX_ERROR
1479
1480} Edje_Match_Error;
1481
1482typedef struct _Edje_States Edje_States;
1483struct _Edje_Patterns
1484{
1485 const char **patterns;
1486
1487 Edje_States *states;
1488
1489 int ref;
1490 Eina_Bool delete_me : 1;
1491
1492 size_t patterns_size;
1493 size_t max_length;
1494 size_t finals[];
1495};
1496
1497Edje_Patterns *edje_match_collection_dir_init(const Eina_List *lst);
1498Edje_Patterns *edje_match_programs_signal_init(Edje_Program * const *array,
1499 unsigned int count);
1500Edje_Patterns *edje_match_programs_source_init(Edje_Program * const *array,
1501 unsigned int count);
1502Edje_Patterns *edje_match_callback_signal_init(const Eina_List *lst);
1503Edje_Patterns *edje_match_callback_source_init(const Eina_List *lst);
1504
1505Eina_Bool edje_match_collection_dir_exec(const Edje_Patterns *ppat,
1506 const char *string);
1507Eina_Bool edje_match_programs_exec(const Edje_Patterns *ppat_signal,
1508 const Edje_Patterns *ppat_source,
1509 const char *signal,
1510 const char *source,
1511 Edje_Program **programs,
1512 Eina_Bool (*func)(Edje_Program *pr, void *data),
1513 void *data,
1514 Eina_Bool prop);
1515int edje_match_callback_exec(Edje_Patterns *ppat_signal,
1516 Edje_Patterns *ppat_source,
1517 const char *signal,
1518 const char *source,
1519 Eina_List *callbacks,
1520 Edje *ed,
1521 Eina_Bool prop);
1522
1523void edje_match_patterns_free(Edje_Patterns *ppat);
1524
1525Eina_List *edje_match_program_hash_build(Edje_Program * const * programs,
1526 unsigned int count,
1527 Eina_Rbtree **tree);
1528Eina_List *edje_match_callback_hash_build(const Eina_List *callbacks,
1529 Eina_Rbtree **tree);
1530const Eina_List *edje_match_signal_source_hash_get(const char *signal,
1531 const char *source,
1532 const Eina_Rbtree *tree);
1533void edje_match_signal_source_free(Edje_Signal_Source_Char *key, void *data);
1534
1535// FIXME remove below 2 eapi decls when edje_convert goes
1536EAPI void _edje_edd_init(void);
1537EAPI void _edje_edd_shutdown(void);
1538
1539EAPI extern Eet_Data_Descriptor *_edje_edd_edje_file;
1540EAPI extern Eet_Data_Descriptor *_edje_edd_edje_part_collection;
1541
1542extern int _edje_anim_count;
1543extern Ecore_Animator *_edje_timer;
1544extern Eina_List *_edje_animators;
1545extern Eina_List *_edje_edjes;
1546
1547extern char *_edje_fontset_append;
1548extern FLOAT_T _edje_scale;
1549extern int _edje_freeze_val;
1550extern int _edje_freeze_calc_count;
1551extern Eina_List *_edje_freeze_calc_list;
1552
1553extern Eina_Bool _edje_password_show_last;
1554extern FLOAT_T _edje_password_show_last_timeout;
1555
1556extern Eina_Mempool *_edje_real_part_mp;
1557extern Eina_Mempool *_edje_real_part_state_mp;
1558
1559extern Eina_Mempool *_emp_RECTANGLE;
1560extern Eina_Mempool *_emp_TEXT;
1561extern Eina_Mempool *_emp_IMAGE;
1562extern Eina_Mempool *_emp_PROXY;
1563extern Eina_Mempool *_emp_SWALLOW;
1564extern Eina_Mempool *_emp_TEXTBLOCK;
1565extern Eina_Mempool *_emp_GROUP;
1566extern Eina_Mempool *_emp_BOX;
1567extern Eina_Mempool *_emp_TABLE;
1568extern Eina_Mempool *_emp_EXTERNAL;
1569extern Eina_Mempool *_emp_part;
1570
1571void _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, FLOAT_T pos, FLOAT_T v1, FLOAT_T v2);
1572Edje_Part_Description_Common *_edje_part_description_find(Edje *ed,
1573 Edje_Real_Part *rp,
1574 const char *name, double val);
1575void _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, double v1, const char *d2, double v2);
1576void _edje_recalc(Edje *ed);
1577void _edje_recalc_do(Edje *ed);
1578void _edje_part_recalc_1(Edje *ed, Edje_Real_Part *ep);
1579int _edje_part_dragable_calc(Edje *ed, Edje_Real_Part *ep, FLOAT_T *x, FLOAT_T *y);
1580void _edje_dragable_pos_set(Edje *ed, Edje_Real_Part *ep, FLOAT_T x, FLOAT_T y);
1581
1582Eina_Bool _edje_timer_cb(void *data);
1583Eina_Bool _edje_pending_timer_cb(void *data);
1584void _edje_callbacks_add(Evas_Object *obj, Edje *ed, Edje_Real_Part *rp);
1585void _edje_callbacks_focus_add(Evas_Object *obj, Edje *ed, Edje_Real_Part *rp);
1586void _edje_callbacks_del(Evas_Object *obj, Edje *ed);
1587void _edje_callbacks_focus_del(Evas_Object *obj, Edje *ed);
1588
1589void _edje_edd_init(void);
1590void _edje_edd_shutdown(void);
1591
1592int _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *group, const char *parent, Eina_List *group_path);
1593
1594void _edje_file_add(Edje *ed);
1595void _edje_file_del(Edje *ed);
1596void _edje_file_free(Edje_File *edf);
1597void _edje_file_cache_shutdown(void);
1598void _edje_collection_free(Edje_File *edf,
1599 Edje_Part_Collection *ec,
1600 Edje_Part_Collection_Directory_Entry *ce);
1601void _edje_collection_free_part_description_clean(int type,
1602 Edje_Part_Description_Common *desc,
1603 Eina_Bool free_strings);
1604void _edje_collection_free_part_description_free(int type,
1605 Edje_Part_Description_Common *desc,
1606 Edje_Part_Collection_Directory_Entry *ce,
1607 Eina_Bool free_strings);
1608
1609void _edje_object_smart_set(Edje_Smart_Api *sc);
1610const Edje_Smart_Api * _edje_object_smart_class_get(void);
1611
1612void _edje_del(Edje *ed);
1613void _edje_ref(Edje *ed);
1614void _edje_unref(Edje *ed);
1615void _edje_clean_objects(Edje *ed);
1616void _edje_ref(Edje *ed);
1617void _edje_unref(Edje *ed);
1618
1619Eina_Bool _edje_program_run_iterate(Edje_Running_Program *runp, double tim);
1620void _edje_program_end(Edje *ed, Edje_Running_Program *runp);
1621void _edje_program_run(Edje *ed, Edje_Program *pr, Eina_Bool force, const char *ssig, const char *ssrc);
1622void _edje_programs_patterns_clean(Edje *ed);
1623void _edje_programs_patterns_init(Edje *ed);
1624void _edje_emit(Edje *ed, const char *sig, const char *src);
1625void _edje_emit_full(Edje *ed, const char *sig, const char *src, void *data, void (*free_func)(void *));
1626void _edje_emit_handle(Edje *ed, const char *sig, const char *src, Edje_Message_Signal_Data *data, Eina_Bool prop);
1627void _edje_signals_sources_patterns_clean(Edje_Signals_Sources_Patterns *ssp);
1628void _edje_callbacks_patterns_clean(Edje *ed);
1629
1630void _edje_text_init(void);
1631void _edje_text_part_on_add(Edje *ed, Edje_Real_Part *ep);
1632void _edje_text_part_on_del(Edje *ed, Edje_Part *ep);
1633void _edje_text_recalc_apply(Edje *ed,
1634 Edje_Real_Part *ep,
1635 Edje_Calc_Params *params,
1636 Edje_Part_Description_Text *chosen_desc);
1637Evas_Font_Size _edje_text_size_calc(Evas_Font_Size size, Edje_Text_Class *tc);
1638const char * _edje_text_class_font_get(Edje *ed,
1639 Edje_Part_Description_Text *chosen_desc,
1640 int *size, char **free_later);
1641
1642
1643Edje_Real_Part *_edje_real_part_get(const Edje *ed, const char *part);
1644Edje_Real_Part *_edje_real_part_recursive_get(const Edje *ed, const char *part);
1645Edje_Color_Class *_edje_color_class_find(Edje *ed, const char *color_class);
1646void _edje_color_class_member_direct_del(const char *color_class, void *lookup);
1647void _edje_color_class_member_add(Edje *ed, const char *color_class);
1648void _edje_color_class_member_del(Edje *ed, const char *color_class);
1649void _edje_color_class_on_del(Edje *ed, Edje_Part *ep);
1650void _edje_color_class_members_free(void);
1651void _edje_color_class_hash_free(void);
1652
1653Edje_Text_Class *_edje_text_class_find(Edje *ed, const char *text_class);
1654void _edje_text_class_member_add(Edje *ed, const char *text_class);
1655void _edje_text_class_member_del(Edje *ed, const char *text_class);
1656void _edje_text_class_member_direct_del(const char *text_class, void *lookup);
1657void _edje_text_class_members_free(void);
1658void _edje_text_class_hash_free(void);
1659
1660Edje *_edje_fetch(const Evas_Object *obj) EINA_PURE;
1661int _edje_freeze(Edje *ed);
1662int _edje_thaw(Edje *ed);
1663int _edje_block(Edje *ed);
1664int _edje_unblock(Edje *ed);
1665int _edje_block_break(Edje *ed);
1666void _edje_block_violate(Edje *ed);
1667void _edje_object_part_swallow_free_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
1668void _edje_object_part_swallow_changed_hints_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
1669void _edje_real_part_swallow(Edje_Real_Part *rp, Evas_Object *obj_swallow, Eina_Bool hints_update);
1670void _edje_real_part_swallow_clear(Edje_Real_Part *rp);
1671void _edje_box_init(void);
1672void _edje_box_shutdown(void);
1673Eina_Bool _edje_box_layout_find(const char *name, Evas_Object_Box_Layout *cb, void **data, void (**free_data)(void *data));
1674void _edje_box_recalc_apply(Edje *ed __UNUSED__, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edje_Part_Description_Box *chosen_desc);
1675Eina_Bool _edje_box_layout_add_child(Edje_Real_Part *rp, Evas_Object *child_obj);
1676void _edje_box_layout_remove_child(Edje_Real_Part *rp, Evas_Object *child_obj);
1677Edje_Part_Box_Animation * _edje_box_layout_anim_new(Evas_Object *box);
1678void _edje_box_layout_free_data(void *data);
1679
1680Eina_Bool _edje_real_part_box_append(Edje_Real_Part *rp, Evas_Object *child_obj);
1681Eina_Bool _edje_real_part_box_prepend(Edje_Real_Part *rp, Evas_Object *child_obj);
1682Eina_Bool _edje_real_part_box_insert_before(Edje_Real_Part *rp, Evas_Object *child_obj, const Evas_Object *ref);
1683Eina_Bool _edje_real_part_box_insert_at(Edje_Real_Part *rp, Evas_Object *child_obj, unsigned int pos);
1684Evas_Object *_edje_real_part_box_remove(Edje_Real_Part *rp, Evas_Object *child_obj);
1685Evas_Object *_edje_real_part_box_remove_at(Edje_Real_Part *rp, unsigned int pos);
1686Eina_Bool _edje_real_part_box_remove_all(Edje_Real_Part *rp, Eina_Bool clear);
1687Eina_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);
1688Eina_Bool _edje_real_part_table_unpack(Edje_Real_Part *rp, Evas_Object *child_obj);
1689void _edje_real_part_table_clear(Edje_Real_Part *rp, Eina_Bool clear);
1690Evas_Object *_edje_children_get(Edje_Real_Part *rp, const char *partid);
1691
1692Eina_Bool _edje_object_part_text_raw_set(Evas_Object *obj, Edje_Real_Part *rp, const char *part, const char *text);
1693char *_edje_text_escape(const char *text);
1694char *_edje_text_unescape(const char *text);
1695
1696void _edje_embryo_script_init (Edje_Part_Collection *edc);
1697void _edje_embryo_script_shutdown (Edje_Part_Collection *edc);
1698void _edje_embryo_script_reset (Edje *ed);
1699void _edje_embryo_test_run (Edje *ed, const char *fname, const char *sig, const char *src);
1700Edje_Var *_edje_var_new (void);
1701void _edje_var_free (Edje_Var *var);
1702void _edje_var_init (Edje *ed);
1703void _edje_var_shutdown (Edje *ed);
1704int _edje_var_string_id_get (Edje *ed, const char *string);
1705int _edje_var_var_int_get (Edje *ed, Edje_Var *var);
1706void _edje_var_var_int_set (Edje *ed, Edje_Var *var, int v);
1707double _edje_var_var_float_get (Edje *ed, Edje_Var *var);
1708void _edje_var_var_float_set (Edje *ed, Edje_Var *var, double v);
1709const char *_edje_var_var_str_get (Edje *ed, Edje_Var *var);
1710void _edje_var_var_str_set (Edje *ed, Edje_Var *var, const char *str);
1711int _edje_var_int_get (Edje *ed, int id);
1712void _edje_var_int_set (Edje *ed, int id, int v);
1713double _edje_var_float_get (Edje *ed, int id);
1714void _edje_var_float_set (Edje *ed, int id, double v);
1715const char *_edje_var_str_get (Edje *ed, int id);
1716void _edje_var_str_set (Edje *ed, int id, const char *str);
1717
1718void _edje_var_list_var_append(Edje *ed, int id, Edje_Var *var);
1719void _edje_var_list_var_prepend(Edje *ed, int id, Edje_Var *var);
1720void _edje_var_list_var_append_relative(Edje *ed, int id, Edje_Var *var, Edje_Var *relative);
1721void _edje_var_list_var_prepend_relative(Edje *ed, int id, Edje_Var *var, Edje_Var *relative);
1722Edje_Var *_edje_var_list_nth(Edje *ed, int id, int n);
1723
1724int _edje_var_list_count_get(Edje *ed, int id);
1725void _edje_var_list_remove_nth(Edje *ed, int id, int n);
1726
1727int _edje_var_list_nth_int_get(Edje *ed, int id, int n);
1728void _edje_var_list_nth_int_set(Edje *ed, int id, int n, int v);
1729void _edje_var_list_int_append(Edje *ed, int id, int v);
1730void _edje_var_list_int_prepend(Edje *ed, int id, int v);
1731void _edje_var_list_int_insert(Edje *ed, int id, int n, int v);
1732
1733double _edje_var_list_nth_float_get(Edje *ed, int id, int n);
1734void _edje_var_list_nth_float_set(Edje *ed, int id, int n, double v);
1735void _edje_var_list_float_append(Edje *ed, int id, double v);
1736void _edje_var_list_float_prepend(Edje *ed, int id, double v);
1737void _edje_var_list_float_insert(Edje *ed, int id, int n, double v);
1738
1739const char *_edje_var_list_nth_str_get(Edje *ed, int id, int n);
1740void _edje_var_list_nth_str_set(Edje *ed, int id, int n, const char *v);
1741void _edje_var_list_str_append(Edje *ed, int id, const char *v);
1742void _edje_var_list_str_prepend(Edje *ed, int id, const char *v);
1743void _edje_var_list_str_insert(Edje *ed, int id, int n, const char *v);
1744
1745int _edje_var_timer_add (Edje *ed, double in, const char *fname, int val);
1746void _edje_var_timer_del (Edje *ed, int id);
1747
1748int _edje_var_anim_add (Edje *ed, double len, const char *fname, int val);
1749void _edje_var_anim_del (Edje *ed, int id);
1750
1751void _edje_message_init (void);
1752void _edje_message_shutdown (void);
1753void _edje_message_cb_set (Edje *ed, void (*func) (void *data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg), void *data);
1754Edje_Message *_edje_message_new (Edje *ed, Edje_Queue queue, Edje_Message_Type type, int id);
1755void _edje_message_free (Edje_Message *em);
1756void _edje_message_propornot_send (Edje *ed, Edje_Queue queue, Edje_Message_Type type, int id, void *emsg, Eina_Bool prop);
1757void _edje_message_send (Edje *ed, Edje_Queue queue, Edje_Message_Type type, int id, void *emsg);
1758void _edje_message_parameters_push (Edje_Message *em);
1759void _edje_message_process (Edje_Message *em);
1760void _edje_message_queue_process (void);
1761void _edje_message_queue_clear (void);
1762void _edje_message_del (Edje *ed);
1763
1764void _edje_textblock_styles_add(Edje *ed);
1765void _edje_textblock_styles_del(Edje *ed);
1766void _edje_textblock_style_all_update(Edje *ed);
1767void _edje_textblock_style_parse_and_fix(Edje_File *edf);
1768void _edje_textblock_style_cleanup(Edje_File *edf);
1769Edje_File *_edje_cache_file_coll_open(const char *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret);
1770void _edje_cache_coll_clean(Edje_File *edf);
1771void _edje_cache_coll_flush(Edje_File *edf);
1772void _edje_cache_coll_unref(Edje_File *edf, Edje_Part_Collection *edc);
1773void _edje_cache_file_unref(Edje_File *edf);
1774
1775void _edje_embryo_globals_init(Edje *ed);
1776
1777#define CHKPARAM(n) if (params[0] != (sizeof(Embryo_Cell) * (n))) return -1;
1778#define GETSTR(str, par) { \
1779 Embryo_Cell *___cptr; \
1780 int ___l; \
1781 str = NULL; \
1782 if ((___cptr = embryo_data_address_get(ep, (par)))) { \
1783 ___l = embryo_data_string_length_get(ep, ___cptr); \
1784 if (((str) = alloca(___l + 1))) \
1785 embryo_data_string_get(ep, ___cptr, (str)); } }
1786#define GETSTREVAS(str, par) { \
1787 if ((str)) { \
1788 if ((par) && (!strcmp((par), (str)))) return 0; \
1789 if ((par)) eina_stringshare_del((par)); \
1790 (par) = (char *)eina_stringshare_add((str)); } \
1791 else (par) = NULL; }
1792#define GETFLOAT(val, par) { \
1793 float *___cptr; \
1794 if ((___cptr = (float *)embryo_data_address_get(ep, (par)))) { \
1795 val = *___cptr; } }
1796
1797#define GETFLOAT_T(val, par) \
1798 { \
1799 float *___cptr; \
1800 if ((___cptr = (float *)embryo_data_address_get(ep, (par)))) \
1801 { \
1802 val = FROM_DOUBLE(*___cptr); \
1803 } \
1804 }
1805
1806#define GETINT(val, par) { \
1807 int *___cptr; \
1808 if ((___cptr = (int *)embryo_data_address_get(ep, (par)))) { \
1809 val = *___cptr; } }
1810#define SETSTR(str, par) { \
1811 Embryo_Cell *___cptr; \
1812 if ((___cptr = embryo_data_address_get(ep, (par)))) { \
1813 embryo_data_string_set(ep, str, ___cptr); } }
1814#define SETSTRALLOCATE(s) \
1815 { \
1816 if (s) { \
1817 if ((int) strlen((s)) < params[4]) { \
1818 SETSTR((s), params[3]); } \
1819 else { \
1820 char *ss; \
1821 ss = alloca(strlen((s)) + 1); \
1822 strcpy(ss, (s)); \
1823 ss[params[4] - 2] = 0; \
1824 SETSTR(ss, params[3]); } } \
1825 else \
1826 SETSTR("", params[3]); \
1827 }
1828#define SETFLOAT(val, par) { \
1829 float *___cptr; \
1830 if ((___cptr = (float *)embryo_data_address_get(ep, (par)))) { \
1831 *___cptr = (float)val; } }
1832#define SETFLOAT_T(val, par) \
1833 { \
1834 float *___cptr; \
1835 if ((___cptr = (float *)embryo_data_address_get(ep, (par)))) \
1836 { \
1837 *___cptr = (float) TO_DOUBLE(val); \
1838 } \
1839 }
1840#define SETINT(val, par) { \
1841 int *___cptr; \
1842 if ((___cptr = (int *)embryo_data_address_get(ep, (par)))) { \
1843 *___cptr = (int)val; } }
1844
1845Eina_Bool _edje_script_only(Edje *ed);
1846void _edje_script_only_init(Edje *ed);
1847void _edje_script_only_shutdown(Edje *ed);
1848void _edje_script_only_show(Edje *ed);
1849void _edje_script_only_hide(Edje *ed);
1850void _edje_script_only_move(Edje *ed);
1851void _edje_script_only_resize(Edje *ed);
1852void _edje_script_only_message(Edje *ed, Edje_Message *em);
1853
1854extern jmp_buf _edje_lua_panic_jmp;
1855#define _edje_lua_panic_here() setjmp(_edje_lua_panic_jmp)
1856
1857lua_State *_edje_lua_state_get();
1858lua_State *_edje_lua_new_thread(Edje *ed, lua_State *L);
1859void _edje_lua_free_thread(Edje *ed, lua_State *L);
1860void _edje_lua_new_reg(lua_State *L, int index, void *ptr);
1861void _edje_lua_get_reg(lua_State *L, void *ptr);
1862void _edje_lua_free_reg(lua_State *L, void *ptr);
1863void _edje_lua_script_fn_new(Edje *ed);
1864void _edje_lua_group_fn_new(Edje *ed);
1865void _edje_lua_init();
1866void _edje_lua_shutdown();
1867
1868void __edje_lua_error(const char *file, const char *fnc, int line, lua_State *L, int err_code);
1869#define _edje_lua_error(L, err_code) \
1870 __edje_lua_error(__FILE__, __FUNCTION__, __LINE__, L, err_code)
1871
1872Eina_Bool _edje_lua_script_only(Edje *ed);
1873void _edje_lua_script_only_init(Edje *ed);
1874void _edje_lua_script_only_shutdown(Edje *ed);
1875void _edje_lua_script_only_show(Edje *ed);
1876void _edje_lua_script_only_hide(Edje *ed);
1877void _edje_lua_script_only_move(Edje *ed);
1878void _edje_lua_script_only_resize(Edje *ed);
1879void _edje_lua_script_only_message(Edje *ed, Edje_Message *em);
1880
1881void _edje_entry_init(Edje *ed);
1882void _edje_entry_shutdown(Edje *ed);
1883void _edje_entry_real_part_init(Edje_Real_Part *rp);
1884void _edje_entry_real_part_shutdown(Edje_Real_Part *rp);
1885void _edje_entry_real_part_configure(Edje_Real_Part *rp);
1886const char *_edje_entry_selection_get(Edje_Real_Part *rp);
1887const char *_edje_entry_text_get(Edje_Real_Part *rp);
1888void _edje_entry_text_markup_set(Edje_Real_Part *rp, const char *text);
1889void _edje_entry_text_markup_insert(Edje_Real_Part *rp, const char *text);
1890void _edje_entry_text_markup_append(Edje_Real_Part *rp, const char *text);
1891void _edje_entry_set_cursor_start(Edje_Real_Part *rp);
1892void _edje_entry_set_cursor_end(Edje_Real_Part *rp);
1893void _edje_entry_cursor_copy(Edje_Real_Part *rp, Edje_Cursor cur, Edje_Cursor dst);
1894void _edje_entry_select_none(Edje_Real_Part *rp);
1895void _edje_entry_select_all(Edje_Real_Part *rp);
1896void _edje_entry_select_begin(Edje_Real_Part *rp);
1897void _edje_entry_select_extend(Edje_Real_Part *rp);
1898const Eina_List *_edje_entry_anchor_geometry_get(Edje_Real_Part *rp, const char *anchor);
1899const Eina_List *_edje_entry_anchors_list(Edje_Real_Part *rp);
1900Eina_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);
1901const Eina_List *_edje_entry_items_list(Edje_Real_Part *rp);
1902void _edje_entry_cursor_geometry_get(Edje_Real_Part *rp, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch);
1903void _edje_entry_select_allow_set(Edje_Real_Part *rp, Eina_Bool allow);
1904Eina_Bool _edje_entry_select_allow_get(const Edje_Real_Part *rp);
1905void _edje_entry_select_abort(Edje_Real_Part *rp);
1906
1907Eina_Bool _edje_entry_cursor_next(Edje_Real_Part *rp, Edje_Cursor cur);
1908Eina_Bool _edje_entry_cursor_prev(Edje_Real_Part *rp, Edje_Cursor cur);
1909Eina_Bool _edje_entry_cursor_up(Edje_Real_Part *rp, Edje_Cursor cur);
1910Eina_Bool _edje_entry_cursor_down(Edje_Real_Part *rp, Edje_Cursor cur);
1911void _edje_entry_cursor_begin(Edje_Real_Part *rp, Edje_Cursor cur);
1912void _edje_entry_cursor_end(Edje_Real_Part *rp, Edje_Cursor cur);
1913void _edje_entry_cursor_line_begin(Edje_Real_Part *rp, Edje_Cursor cur);
1914void _edje_entry_cursor_line_end(Edje_Real_Part *rp, Edje_Cursor cur);
1915Eina_Bool _edje_entry_cursor_coord_set(Edje_Real_Part *rp, Edje_Cursor cur, int x, int y);
1916Eina_Bool _edje_entry_cursor_is_format_get(Edje_Real_Part *rp, Edje_Cursor cur);
1917Eina_Bool _edje_entry_cursor_is_visible_format_get(Edje_Real_Part *rp, Edje_Cursor cur);
1918const char *_edje_entry_cursor_content_get(Edje_Real_Part *rp, Edje_Cursor cur);
1919void _edje_entry_cursor_pos_set(Edje_Real_Part *rp, Edje_Cursor cur, int pos);
1920int _edje_entry_cursor_pos_get(Edje_Real_Part *rp, Edje_Cursor cur);
1921void _edje_entry_input_panel_layout_set(Edje_Real_Part *rp, Edje_Input_Panel_Layout layout);
1922Edje_Input_Panel_Layout _edje_entry_input_panel_layout_get(Edje_Real_Part *rp);
1923void _edje_entry_autocapital_type_set(Edje_Real_Part *rp, Edje_Text_Autocapital_Type autocapital_type);
1924Edje_Text_Autocapital_Type _edje_entry_autocapital_type_get(Edje_Real_Part *rp);
1925void _edje_entry_input_panel_enabled_set(Edje_Real_Part *rp, Eina_Bool enabled);
1926Eina_Bool _edje_entry_input_panel_enabled_get(Edje_Real_Part *rp);
1927
1928void _edje_external_init();
1929void _edje_external_shutdown();
1930Evas_Object *_edje_external_type_add(const char *type_name, Evas *evas, Evas_Object *parent, const Eina_List *params, const char *part_name);
1931void _edje_external_signal_emit(Evas_Object *obj, const char *emission, const char *source);
1932Eina_Bool _edje_external_param_set(Evas_Object *obj, Edje_Real_Part *rp, const Edje_External_Param *param) EINA_ARG_NONNULL(2);
1933Eina_Bool _edje_external_param_get(const Evas_Object *obj, Edje_Real_Part *rp, Edje_External_Param *param) EINA_ARG_NONNULL(2);
1934Evas_Object *_edje_external_content_get(const Evas_Object *obj, const char *content) EINA_ARG_NONNULL(1, 2);
1935void _edje_external_params_free(Eina_List *params, Eina_Bool free_strings);
1936void _edje_external_recalc_apply(Edje *ed, Edje_Real_Part *ep,
1937 Edje_Calc_Params *params,
1938 Edje_Part_Description_Common *chosen_desc);
1939void *_edje_external_params_parse(Evas_Object *obj, const Eina_List *params);
1940void _edje_external_parsed_params_free(Evas_Object *obj, void *params);
1941
1942Eina_Module *_edje_module_handle_load(const char *module);
1943void _edje_module_init();
1944void _edje_module_shutdown();
1945
1946static inline Eina_Bool
1947edje_program_is_strncmp(const char *str)
1948{
1949 size_t length;
1950
1951 length = strlen(str);
1952
1953 if (strpbrk(str, "*?[\\") != str + length)
1954 return EINA_FALSE;
1955 if (str[length] == '['
1956 || str[length] == '\\')
1957 return EINA_FALSE;
1958 return EINA_TRUE;
1959}
1960
1961static inline Eina_Bool
1962edje_program_is_strrncmp(const char *str)
1963{
1964 if (*str != '*' && *str != '?')
1965 return EINA_FALSE;
1966 if (strpbrk(str + 1, "*?[\\"))
1967 return EINA_FALSE;
1968 return EINA_TRUE;
1969}
1970void edje_object_propagate_callback_add(Evas_Object *obj, void (*func) (void *data, Evas_Object *o, const char *emission, const char *source), void *data);
1971
1972
1973/* used by edje_cc - private still */
1974EAPI void _edje_program_insert(Edje_Part_Collection *ed, Edje_Program *p);
1975EAPI void _edje_program_remove(Edje_Part_Collection *ed, Edje_Program *p);
1976
1977void _edje_lua2_error_full(const char *file, const char *fnc, int line, lua_State *L, int err_code);
1978#define _edje_lua2_error(L, err_code) _edje_lua2_error_full(__FILE__, __FUNCTION__, __LINE__, L, err_code)
1979void _edje_lua2_script_init(Edje *ed);
1980void _edje_lua2_script_shutdown(Edje *ed);
1981void _edje_lua2_script_load(Edje_Part_Collection *edc, void *data, int size);
1982void _edje_lua2_script_unload(Edje_Part_Collection *edc);
1983
1984void _edje_lua2_script_func_shutdown(Edje *ed);
1985void _edje_lua2_script_func_show(Edje *ed);
1986void _edje_lua2_script_func_hide(Edje *ed);
1987void _edje_lua2_script_func_move(Edje *ed);
1988void _edje_lua2_script_func_resize(Edje *ed);
1989void _edje_lua2_script_func_message(Edje *ed, Edje_Message *em);
1990void _edje_lua2_script_func_signal(Edje *ed, const char *sig, const char *src);
1991
1992const char *edje_string_get(const Edje_String *es);
1993const char *edje_string_id_get(const Edje_String *es);
1994
1995void _edje_object_orientation_inform(Evas_Object *obj);
1996
1997void _edje_lib_ref(void);
1998void _edje_lib_unref(void);
1999
2000void _edje_subobj_register(Edje *ed, Evas_Object *ob);
2001
2002void _edje_multisense_init(void);
2003void _edje_multisense_shutdown(void);
2004Eina_Bool _edje_multisense_internal_sound_sample_play(Edje *ed, const char *sample_name, const double speed);
2005Eina_Bool _edje_multisense_internal_sound_tone_play(Edje *ed, const char *tone_name, const double duration);
2006
2007void _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *state);
2008
2009#ifdef HAVE_LIBREMIX
2010#include <remix/remix.h>
2011#endif
2012#include <Eina.h>
2013
2014typedef struct _Edje_Multisense_Env Edje_Multisense_Env;
2015
2016struct _Edje_Multisense_Env
2017{
2018#ifdef HAVE_LIBREMIX
2019 RemixEnv *remixenv;
2020#endif
2021};
2022
2023typedef Eina_Bool (*MULTISENSE_FACTORY_INIT_FUNC) (Edje_Multisense_Env *);
2024#ifdef HAVE_LIBREMIX
2025typedef RemixBase* (*MULTISENSE_SOUND_PLAYER_GET_FUNC) (Edje_Multisense_Env *);
2026#endif
2027
2028#endif
diff --git a/libraries/edje/src/lib/edje_program.c b/libraries/edje/src/lib/edje_program.c
new file mode 100644
index 0000000..505b6a2
--- /dev/null
+++ b/libraries/edje/src/lib/edje_program.c
@@ -0,0 +1,2090 @@
1#include "edje_private.h"
2
3static void _edje_emit_cb(Edje *ed, const char *sig, const char *src, Edje_Message_Signal_Data *data, Eina_Bool prop);
4static void _edje_param_copy(Edje_Real_Part *src_part, const char *src_param, Edje_Real_Part *dst_part, const char *dst_param);
5static void _edje_param_set(Edje_Real_Part *part, const char *param, const char *value);
6
7int _edje_anim_count = 0;
8Ecore_Animator *_edje_timer = NULL;
9Eina_List *_edje_animators = NULL;
10
11
12/*============================================================================*
13 * API *
14 *============================================================================*/
15
16EAPI void
17edje_frametime_set(double t)
18{
19 ecore_animator_frametime_set(t);
20}
21
22EAPI double
23edje_frametime_get(void)
24{
25 return ecore_animator_frametime_get();
26}
27
28void
29edje_object_propagate_callback_add(Evas_Object *obj, void (*func) (void *data, Evas_Object *o, const char *emission, const char *source), void *data)
30{
31 Edje *ed;
32 Edje_Signal_Callback *escb;
33
34 ed = _edje_fetch(obj);
35 if (!ed) return;
36 if (ed->delete_me) return;
37 escb = calloc(1, sizeof(Edje_Signal_Callback));
38 escb->propagate = EINA_TRUE;
39 escb->signal = eina_stringshare_add("*");
40 escb->source = eina_stringshare_add("*");
41 escb->func = func;
42 escb->data = data;
43 ed->callbacks = eina_list_append(ed->callbacks, escb);
44 if (ed->walking_callbacks)
45 {
46 escb->just_added = 1;
47 ed->just_added_callbacks = 1;
48 }
49 else
50 _edje_callbacks_patterns_clean(ed);
51}
52
53EAPI void
54edje_object_signal_callback_add(Evas_Object *obj, const char *emission, const char *source, void (*func) (void *data, Evas_Object *o, const char *emission, const char *source), void *data)
55{
56 Edje *ed;
57 Edje_Signal_Callback *escb;
58
59 if ((!emission) || (!source) || (!func)) return;
60 ed = _edje_fetch(obj);
61 if (!ed) return;
62 if (ed->delete_me) return;
63 escb = calloc(1, sizeof(Edje_Signal_Callback));
64 if (emission[0])
65 escb->signal = eina_stringshare_add(emission);
66 if (source[0])
67 escb->source = eina_stringshare_add(source);
68 escb->func = func;
69 escb->data = data;
70 ed->callbacks = eina_list_append(ed->callbacks, escb);
71 if (ed->walking_callbacks)
72 {
73 escb->just_added = 1;
74 ed->just_added_callbacks = 1;
75 }
76 else
77 _edje_callbacks_patterns_clean(ed);
78}
79
80EAPI void *
81edje_object_signal_callback_del(Evas_Object *obj, const char *emission, const char *source, void (*func) (void *data, Evas_Object *o, const char *emission, const char *source))
82{
83 Edje *ed;
84 Eina_List *l;
85 Edje_Signal_Callback *escb;
86
87 if ((!emission) || (!source) || (!func)) return NULL;
88 ed = _edje_fetch(obj);
89 if (!ed) return NULL;
90 if (ed->delete_me) return NULL;
91 EINA_LIST_FOREACH(ed->callbacks, l, escb)
92 {
93 if ((escb->func == func) &&
94 ((!escb->signal && !emission[0]) ||
95 (escb->signal && !strcmp(escb->signal, emission))) &&
96 ((!escb->source && !source[0]) ||
97 (escb->source && !strcmp(escb->source, source))))
98 {
99 void *data;
100
101 data = escb->data;
102 if (ed->walking_callbacks)
103 {
104 escb->delete_me = 1;
105 ed->delete_callbacks = 1;
106 }
107 else
108 {
109 _edje_callbacks_patterns_clean(ed);
110
111 ed->callbacks = eina_list_remove_list(ed->callbacks, l);
112 if (escb->signal) eina_stringshare_del(escb->signal);
113 if (escb->source) eina_stringshare_del(escb->source);
114 free(escb);
115 }
116 return data;
117 }
118 }
119 return NULL;
120}
121
122EAPI void *
123edje_object_signal_callback_del_full(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data)
124{
125 Edje *ed;
126 Eina_List *l;
127 Edje_Signal_Callback *escb;
128
129 if ((!emission) || (!source) || (!func)) return NULL;
130 ed = _edje_fetch(obj);
131 if (!ed) return NULL;
132 if (ed->delete_me) return NULL;
133 EINA_LIST_FOREACH(ed->callbacks, l, escb)
134 {
135 if ((escb->func == func) && (escb->data == data) &&
136 ((!escb->signal && !emission[0]) ||
137 (escb->signal && !strcmp(escb->signal, emission))) &&
138 ((!escb->source && !source[0]) ||
139 (escb->source && !strcmp(escb->source, source))))
140 {
141 void *data2;
142
143 data2 = escb->data;
144 if (ed->walking_callbacks)
145 {
146 escb->delete_me = 1;
147 ed->delete_callbacks = 1;
148 }
149 else
150 {
151 _edje_callbacks_patterns_clean(ed);
152
153 ed->callbacks = eina_list_remove_list(ed->callbacks, l);
154 if (escb->signal) eina_stringshare_del(escb->signal);
155 if (escb->source) eina_stringshare_del(escb->source);
156 free(escb);
157 }
158 return data2;
159 }
160 }
161 return NULL;
162}
163
164EAPI void
165edje_object_signal_emit(Evas_Object *obj, const char *emission, const char *source)
166{
167 Edje *ed;
168
169 if ((!emission) || (!source)) return;
170 ed = _edje_fetch(obj);
171 if (!ed) return;
172 if (ed->delete_me) return;
173 _edje_emit(ed, (char *)emission, (char *)source);
174}
175
176/* FIXDOC: Verify/Expand */
177EAPI void
178edje_object_play_set(Evas_Object *obj, Eina_Bool play)
179{
180 Edje *ed;
181 double t;
182 Eina_List *l;
183 Edje_Running_Program *runp;
184 unsigned int i;
185
186 ed = _edje_fetch(obj);
187 if (!ed) return;
188 if (ed->delete_me) return;
189 if (play)
190 {
191 if (!ed->paused) return;
192 ed->paused = 0;
193 t = ecore_time_get() - ed->paused_at;
194 EINA_LIST_FOREACH(ed->actions, l, runp)
195 runp->start_time += t;
196 }
197 else
198 {
199 if (ed->paused) return;
200 ed->paused = EINA_TRUE;
201 ed->paused_at = ecore_time_get();
202 }
203
204 for (i = 0; i < ed->table_parts_size; i++)
205 {
206 Edje_Real_Part *rp;
207 rp = ed->table_parts[i];
208 if (rp->part->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object)
209 edje_object_play_set(rp->swallowed_object, play);
210 }
211}
212
213EAPI Eina_Bool
214edje_object_play_get(const Evas_Object *obj)
215{
216 Edje *ed;
217
218 ed = _edje_fetch(obj);
219 if (!ed) return EINA_FALSE;
220 if (ed->delete_me) return EINA_FALSE;
221 if (ed->paused) return EINA_FALSE;
222 return EINA_TRUE;
223}
224
225/* FIXDOC: Verify/Expand */
226EAPI void
227edje_object_animation_set(Evas_Object *obj, Eina_Bool on)
228{
229 Edje *ed;
230 Eina_List *l;
231 unsigned int i;
232
233 ed = _edje_fetch(obj);
234 if (!ed) return;
235 if (ed->delete_me) return;
236 _edje_block(ed);
237 ed->no_anim = !on;
238 _edje_freeze(ed);
239 if (!on)
240 {
241 Eina_List *newl = NULL;
242 const void *data;
243
244 EINA_LIST_FOREACH(ed->actions, l, data)
245 newl = eina_list_append(newl, data);
246 while (newl)
247 {
248 Edje_Running_Program *runp;
249
250 runp = eina_list_data_get(newl);
251 newl = eina_list_remove(newl, eina_list_data_get(newl));
252 _edje_program_run_iterate(runp, runp->start_time + TO_DOUBLE(runp->program->tween.time));
253 if (_edje_block_break(ed))
254 {
255 eina_list_free(newl);
256 goto break_prog;
257 }
258 }
259 }
260 else
261 {
262 _edje_emit(ed, "load", NULL);
263 if (evas_object_visible_get(obj))
264 {
265 evas_object_hide(obj);
266 evas_object_show(obj);
267 }
268 }
269 break_prog:
270
271 for (i = 0; i < ed->table_parts_size; i++)
272 {
273 Edje_Real_Part *rp;
274 rp = ed->table_parts[i];
275 if (rp->part->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object)
276 edje_object_animation_set(rp->swallowed_object, on);
277 }
278
279 _edje_thaw(ed);
280 _edje_unblock(ed);
281}
282
283
284EAPI Eina_Bool
285edje_object_animation_get(const Evas_Object *obj)
286{
287 Edje *ed;
288
289 ed = _edje_fetch(obj);
290 if (!ed) return EINA_FALSE;
291 if (ed->delete_me) return EINA_FALSE;
292 if (ed->no_anim) return EINA_FALSE;
293 return EINA_TRUE;
294}
295
296/* Private Routines */
297
298Eina_Bool
299_edje_program_run_iterate(Edje_Running_Program *runp, double tim)
300{
301 FLOAT_T t, total;
302 Eina_List *l;
303 Edje *ed;
304 Edje_Program_Target *pt;
305 Edje_Real_Part *rp;
306
307 ed = runp->edje;
308 if (ed->delete_me) return EINA_FALSE;
309 _edje_block(ed);
310 _edje_ref(ed);
311 _edje_freeze(ed);
312 t = FROM_DOUBLE(tim - runp->start_time);
313 total = runp->program->tween.time;
314 t = DIV(t, total);
315 if (t > FROM_INT(1)) t = FROM_INT(1);
316 EINA_LIST_FOREACH(runp->program->targets, l, pt)
317 {
318 if (pt->id >= 0)
319 {
320 rp = ed->table_parts[pt->id % ed->table_parts_size];
321 if (rp) _edje_part_pos_set(ed, rp,
322 runp->program->tween.mode, t,
323 runp->program->tween.v1,
324 runp->program->tween.v2);
325 }
326 }
327 if (t >= FROM_INT(1))
328 {
329 Edje_Program_After *pa;
330
331 EINA_LIST_FOREACH(runp->program->targets, l, pt)
332 {
333 if (pt->id >= 0)
334 {
335 rp = ed->table_parts[pt->id % ed->table_parts_size];
336 if (rp)
337 {
338 _edje_part_description_apply(ed, rp,
339 runp->program->state,
340 runp->program->value,
341 NULL,
342 0.0);
343 _edje_part_pos_set(ed, rp,
344 runp->program->tween.mode, ZERO,
345 runp->program->tween.v1,
346 runp->program->tween.v2);
347 rp->program = NULL;
348 }
349 }
350 }
351 _edje_recalc(ed);
352 runp->delete_me = 1;
353 if (!ed->walking_actions)
354 {
355 _edje_anim_count--;
356 ed->actions = eina_list_remove(ed->actions, runp);
357 if (!ed->actions)
358 _edje_animators = eina_list_remove(_edje_animators, ed);
359 }
360// _edje_emit(ed, "program,stop", runp->program->name);
361 if (_edje_block_break(ed))
362 {
363 if (!ed->walking_actions) free(runp);
364 goto break_prog;
365 }
366 EINA_LIST_FOREACH(runp->program->after, l, pa)
367 {
368 Edje_Program *pr;
369
370 if (pa->id >= 0)
371 {
372 pr = ed->table_programs[pa->id % ed->table_programs_size];
373 if (pr) _edje_program_run(ed, pr, 0, "", "");
374 if (_edje_block_break(ed))
375 {
376 if (!ed->walking_actions) free(runp);
377 goto break_prog;
378 }
379 }
380 }
381 _edje_thaw(ed);
382 _edje_unref(ed);
383 if (!ed->walking_actions) free(runp);
384 _edje_unblock(ed);
385 return EINA_FALSE;
386 }
387 break_prog:
388 _edje_recalc(ed);
389 _edje_thaw(ed);
390 _edje_unref(ed);
391 _edje_unblock(ed);
392 return EINA_TRUE;
393}
394
395void
396_edje_program_end(Edje *ed, Edje_Running_Program *runp)
397{
398 Eina_List *l;
399 Edje_Program_Target *pt;
400// const char *pname = NULL;
401 int free_runp = 0;
402
403 if (ed->delete_me) return;
404 _edje_ref(ed);
405 _edje_freeze(ed);
406 EINA_LIST_FOREACH(runp->program->targets, l, pt)
407 {
408 Edje_Real_Part *rp;
409
410 if (pt->id >= 0)
411 {
412 rp = ed->table_parts[pt->id % ed->table_parts_size];
413 if (rp)
414 {
415 _edje_part_description_apply(ed, rp,
416 runp->program->state,
417 runp->program->value,
418 NULL,
419 0.0);
420 _edje_part_pos_set(ed, rp,
421 runp->program->tween.mode, ZERO,
422 runp->program->tween.v1,
423 runp->program->tween.v2);
424 rp->program = NULL;
425 }
426 }
427 }
428 _edje_recalc(ed);
429 runp->delete_me = 1;
430// pname = runp->program->name;
431 if (!ed->walking_actions)
432 {
433 _edje_anim_count--;
434 ed->actions = eina_list_remove(ed->actions, runp);
435 free_runp = 1;
436 if (!ed->actions)
437 {
438 _edje_animators = eina_list_remove(_edje_animators, ed);
439 }
440 }
441// _edje_emit(ed, "program,stop", pname);
442 _edje_thaw(ed);
443 _edje_unref(ed);
444 if (free_runp) free(runp);
445}
446
447void
448_edje_program_run(Edje *ed, Edje_Program *pr, Eina_Bool force, const char *ssig, const char *ssrc)
449{
450 Eina_List *l;
451 Edje_Real_Part *rp;
452 Edje_Program_Target *pt;
453 Edje_Program *pr2;
454 Edje_Program_After *pa;
455 /* limit self-feeding loops in programs to 64 levels */
456 static int recursions = 0;
457 static int recursion_limit = 0;
458
459 if (ed->delete_me) return;
460 if ((pr->in.from > 0.0) && (pr->in.range >= 0.0) && (!force))
461 {
462 Edje_Pending_Program *pp;
463 double r = 0.0;
464
465 pp = calloc(1, sizeof(Edje_Pending_Program));
466 if (!pp) return;
467 if (pr->in.range > 0.0) r = ((double)rand() / RAND_MAX);
468 pp->timer = ecore_timer_add(pr->in.from + (pr->in.range * r),
469 _edje_pending_timer_cb, pp);
470 if (!pp->timer)
471 {
472 free(pp);
473 return;
474 }
475 pp->edje = ed;
476 pp->program = pr;
477 ed->pending_actions = eina_list_append(ed->pending_actions, pp);
478 return;
479 }
480 if ((recursions >= 64) || (recursion_limit))
481 {
482 ERR("Programs recursing up to recursion limit of %i. Disabled.",
483 64);
484 recursion_limit = 1;
485 return;
486 }
487 recursions++;
488 _edje_block(ed);
489 _edje_ref(ed);
490 _edje_freeze(ed);
491 switch (pr->action)
492 {
493 case EDJE_ACTION_TYPE_STATE_SET:
494 if ((pr->tween.time > ZERO) && (!ed->no_anim))
495 {
496 Edje_Running_Program *runp;
497
498 runp = calloc(1, sizeof(Edje_Running_Program));
499 EINA_LIST_FOREACH(pr->targets, l, pt)
500 {
501 if (pt->id >= 0)
502 {
503 rp = ed->table_parts[pt->id % ed->table_parts_size];
504 if (rp)
505 {
506 if ((rp->object) && (pr->tween.mode & EDJE_TWEEN_MODE_OPT_FROM_CURRENT))
507 {
508 Edje_Calc_Params *tmp;
509
510 tmp = calloc(1, sizeof(Edje_Calc_Params));
511 if (!tmp) goto low_mem_current;
512 _edje_part_recalc(ed, rp, FLAG_XY, tmp);
513
514 if (rp->current) free(rp->current);
515 rp->current = tmp;
516
517 rp->current->x -= ed->x;
518 rp->current->y -= ed->y;
519 rp->current->map.center.x -= ed->x;
520 rp->current->map.center.y -= ed->y;
521 rp->current->map.light.x -= ed->x;
522 rp->current->map.light.y -= ed->y;
523 rp->current->map.persp.x -= ed->x;
524 rp->current->map.persp.y -= ed->y;
525 }
526 else
527 {
528 low_mem_current:
529 if (rp->current) free(rp->current);
530 rp->current = NULL;
531 }
532
533 if (rp->program)
534 _edje_program_end(ed, rp->program);
535 _edje_part_description_apply(ed, rp,
536 rp->param1.description->state.name,
537 rp->param1.description->state.value,
538 pr->state,
539 pr->value);
540 _edje_part_pos_set(ed, rp, pr->tween.mode, ZERO,
541 pr->tween.v1,
542 pr->tween.v2);
543 rp->program = runp;
544 }
545 }
546 }
547 // _edje_emit(ed, "program,start", pr->name);
548 if (_edje_block_break(ed))
549 {
550 ed->actions = eina_list_append(ed->actions, runp);
551 goto break_prog;
552 }
553 if (!ed->actions)
554 _edje_animators = eina_list_append(_edje_animators, ed);
555 ed->actions = eina_list_append(ed->actions, runp);
556 runp->start_time = ecore_loop_time_get();
557 runp->edje = ed;
558 runp->program = pr;
559 if (!_edje_timer)
560 _edje_timer = ecore_animator_add(_edje_timer_cb, NULL);
561 _edje_anim_count++;
562 }
563 else
564 {
565 EINA_LIST_FOREACH(pr->targets, l, pt)
566 {
567 if (pt->id >= 0)
568 {
569 rp = ed->table_parts[pt->id % ed->table_parts_size];
570 if (rp)
571 {
572 if (rp->program)
573 _edje_program_end(ed, rp->program);
574 _edje_part_description_apply(ed, rp,
575 pr->state,
576 pr->value,
577 NULL,
578 0.0);
579 _edje_part_pos_set(ed, rp, pr->tween.mode, ZERO,
580 pr->tween.v1,
581 pr->tween.v2);
582 }
583 }
584 }
585 // _edje_emit(ed, "program,start", pr->name);
586 if (_edje_block_break(ed)) goto break_prog;
587 // _edje_emit(ed, "program,stop", pr->name);
588 if (_edje_block_break(ed)) goto break_prog;
589
590 EINA_LIST_FOREACH(pr->after, l, pa)
591 {
592 if (pa->id >= 0)
593 {
594 pr2 = ed->table_programs[pa->id % ed->table_programs_size];
595 if (pr2) _edje_program_run(ed, pr2, 0, "", "");
596 if (_edje_block_break(ed)) goto break_prog;
597 }
598 }
599 _edje_recalc(ed);
600 }
601 break;
602 case EDJE_ACTION_TYPE_ACTION_STOP:
603 // _edje_emit(ed, "program,start", pr->name);
604 EINA_LIST_FOREACH(pr->targets, l, pt)
605 {
606 Eina_List *ll;
607 Edje_Running_Program *runp;
608 Edje_Pending_Program *pp;
609
610 for (ll = ed->actions; ll; )
611 {
612 runp = ll->data;
613 ll = ll->next;
614 if (pt->id == runp->program->id)
615 {
616 _edje_program_end(ed, runp);
617// goto done;
618 }
619 }
620 for (ll = ed->pending_actions; ll; )
621 {
622 pp = ll->data;
623 ll = ll->next;
624 if (pt->id == pp->program->id)
625 {
626 ed->pending_actions = eina_list_remove(ed->pending_actions, pp);
627 ecore_timer_del(pp->timer);
628 free(pp);
629// goto done;
630 }
631 }
632// done:
633// continue;
634 }
635 // _edje_emit(ed, "program,stop", pr->name);
636 if (_edje_block_break(ed)) goto break_prog;
637 break;
638 case EDJE_ACTION_TYPE_SIGNAL_EMIT:
639 // _edje_emit(ed, "program,start", pr->name);
640 if (_edje_block_break(ed)) goto break_prog;
641 _edje_emit(ed, pr->state, pr->state2);
642 if (_edje_block_break(ed)) goto break_prog;
643 // _edje_emit(ed, "program,stop", pr->name);
644 if (_edje_block_break(ed)) goto break_prog;
645 break;
646 case EDJE_ACTION_TYPE_DRAG_VAL_SET:
647 // _edje_emit(ed, "program,start", pr->name);
648 if (_edje_block_break(ed)) goto break_prog;
649 EINA_LIST_FOREACH(pr->targets, l, pt)
650 {
651 if (pt->id >= 0)
652 {
653 rp = ed->table_parts[pt->id % ed->table_parts_size];
654 if ((rp) && (rp->drag) && (rp->drag->down.count == 0))
655 {
656 rp->drag->val.x = pr->value;
657 rp->drag->val.y = pr->value2;
658 if (rp->drag->val.x < 0.0) rp->drag->val.x = 0.0;
659 else if (rp->drag->val.x > 1.0) rp->drag->val.x = 1.0;
660 if (rp->drag->val.y < 0.0) rp->drag->val.y = 0.0;
661 else if (rp->drag->val.y > 1.0) rp->drag->val.y = 1.0;
662 _edje_dragable_pos_set(ed, rp, rp->drag->val.x, rp->drag->val.y);
663 _edje_emit(ed, "drag,set", rp->part->name);
664 if (_edje_block_break(ed)) goto break_prog;
665 }
666 }
667 }
668 // _edje_emit(ed, "program,stop", pr->name);
669 if (_edje_block_break(ed)) goto break_prog;
670 break;
671 case EDJE_ACTION_TYPE_DRAG_VAL_STEP:
672 // _edje_emit(ed, "program,start", pr->name);
673 if (_edje_block_break(ed)) goto break_prog;
674 EINA_LIST_FOREACH(pr->targets, l, pt)
675 {
676 if (pt->id >= 0)
677 {
678 rp = ed->table_parts[pt->id % ed->table_parts_size];
679 if ((rp) && (rp->drag) && (rp->drag->down.count == 0))
680 {
681 rp->drag->val.x += pr->value * rp->drag->step.x * rp->part->dragable.x;
682 rp->drag->val.y += pr->value2 * rp->drag->step.y * rp->part->dragable.y;
683 if (rp->drag->val.x < 0.0) rp->drag->val.x = 0.0;
684 else if (rp->drag->val.x > 1.0) rp->drag->val.x = 1.0;
685 if (rp->drag->val.y < 0.0) rp->drag->val.y = 0.0;
686 else if (rp->drag->val.y > 1.0) rp->drag->val.y = 1.0;
687 _edje_dragable_pos_set(ed, rp, rp->drag->val.x, rp->drag->val.y);
688 _edje_emit(ed, "drag,step", rp->part->name);
689 if (_edje_block_break(ed)) goto break_prog;
690 }
691 }
692 }
693 // _edje_emit(ed, "program,stop", pr->name);
694 if (_edje_block_break(ed)) goto break_prog;
695 break;
696 case EDJE_ACTION_TYPE_DRAG_VAL_PAGE:
697 // _edje_emit(ed, "program,start", pr->name);
698 if (_edje_block_break(ed)) goto break_prog;
699 EINA_LIST_FOREACH(pr->targets, l, pt)
700 {
701 if (pt->id >= 0)
702 {
703 rp = ed->table_parts[pt->id % ed->table_parts_size];
704 if ((rp) && (rp->drag) && (rp->drag->down.count == 0))
705 {
706 rp->drag->val.x += pr->value * rp->drag->page.x * rp->part->dragable.x;
707 rp->drag->val.y += pr->value2 * rp->drag->page.y * rp->part->dragable.y;
708 if (rp->drag->val.x < 0.0) rp->drag->val.x = 0.0;
709 else if (rp->drag->val.x > 1.0) rp->drag->val.x = 1.0;
710 if (rp->drag->val.y < 0.0) rp->drag->val.y = 0.0;
711 else if (rp->drag->val.y > 1.0) rp->drag->val.y = 1.0;
712 _edje_dragable_pos_set(ed, rp, rp->drag->val.x, rp->drag->val.y);
713 _edje_emit(ed, "drag,page", rp->part->name);
714 if (_edje_block_break(ed)) goto break_prog;
715 }
716 }
717 }
718 // _edje_emit(ed, "program,stop", pr->name);
719 if (_edje_block_break(ed)) goto break_prog;
720 break;
721 case EDJE_ACTION_TYPE_SCRIPT:
722 {
723 char fname[128];
724
725 // _edje_emit(ed, "program,start", pr->name);
726 if (_edje_block_break(ed)) goto break_prog;
727 snprintf(fname, sizeof(fname), "_p%i", pr->id);
728 _edje_embryo_test_run(ed, fname, ssig, ssrc);
729 // _edje_emit(ed, "program,stop", pr->name);
730 if (_edje_block_break(ed)) goto break_prog;
731 _edje_recalc_do(ed);
732 }
733 break;
734 case EDJE_ACTION_TYPE_FOCUS_SET:
735 if (!pr->targets)
736 ed->focused_part = NULL;
737 else
738 {
739 EINA_LIST_FOREACH(pr->targets, l, pt)
740 {
741 if (pt->id >= 0)
742 {
743 rp = ed->table_parts[pt->id % ed->table_parts_size];
744 if (rp)
745 {
746 if (ed->focused_part != rp)
747 {
748 if (ed->focused_part)
749 _edje_emit(ed, "focus,part,out",
750 ed->focused_part->part->name);
751 ed->focused_part = rp;
752 _edje_emit(ed, "focus,part,in",
753 ed->focused_part->part->name);
754 }
755 }
756 }
757 }
758 }
759 break;
760 case EDJE_ACTION_TYPE_FOCUS_OBJECT:
761 if (!pr->targets)
762 {
763 Evas_Object *focused;
764
765 focused = evas_focus_get(evas_object_evas_get(ed->obj));
766 if (focused)
767 {
768 unsigned int i;
769
770 /* Check if the current swallowed object is one of my child. */
771 for (i = 0; i < ed->table_parts_size; ++i)
772 {
773 rp = ed->table_parts[i];
774 if (rp && rp->swallowed_object == focused)
775 {
776 evas_object_focus_set(focused, EINA_FALSE);
777 break;
778 }
779 }
780 }
781 }
782 else
783 {
784 EINA_LIST_FOREACH(pr->targets, l, pt)
785 {
786 if (pt->id >= 0)
787 {
788 rp = ed->table_parts[pt->id % ed->table_parts_size];
789 if (rp && rp->swallowed_object)
790 evas_object_focus_set(rp->swallowed_object, EINA_TRUE);
791 }
792 }
793 }
794 break;
795 case EDJE_ACTION_TYPE_SOUND_SAMPLE:
796 if (_edje_block_break(ed))
797 goto break_prog;
798 _edje_multisense_internal_sound_sample_play(ed, pr->sample_name, pr->speed);
799 break;
800 case EDJE_ACTION_TYPE_SOUND_TONE:
801 if (_edje_block_break(ed))
802 goto break_prog;
803 _edje_multisense_internal_sound_tone_play(ed, pr->tone_name, pr->duration);
804 break;
805 case EDJE_ACTION_TYPE_PARAM_COPY:
806 {
807 Edje_Real_Part *src_part, *dst_part;
808
809 // _edje_emit(ed, "program,start", pr->name);
810 if (_edje_block_break(ed)) goto break_prog;
811
812 src_part = ed->table_parts[pr->param.src % ed->table_parts_size];
813 dst_part = ed->table_parts[pr->param.dst % ed->table_parts_size];
814 _edje_param_copy(src_part, pr->state, dst_part, pr->state2);
815
816 if (_edje_block_break(ed)) goto break_prog;
817 // _edje_emit(ed, "program,stop", pr->name);
818 if (_edje_block_break(ed)) goto break_prog;
819 }
820 break;
821 case EDJE_ACTION_TYPE_PARAM_SET:
822 {
823 Edje_Real_Part *part;
824
825 // _edje_emit(ed, "program,start", pr->name);
826 if (_edje_block_break(ed)) goto break_prog;
827
828 part = ed->table_parts[pr->param.dst % ed->table_parts_size];
829 _edje_param_set(part, pr->state, pr->state2);
830
831 if (_edje_block_break(ed)) goto break_prog;
832 // _edje_emit(ed, "program,stop", pr->name);
833 if (_edje_block_break(ed)) goto break_prog;
834 }
835 break;
836 default:
837 // _edje_emit(ed, "program,start", pr->name);
838 // _edje_emit(ed, "program,stop", pr->name);
839 break;
840 }
841 if (!((pr->action == EDJE_ACTION_TYPE_STATE_SET)
842 /* hmm this fucks somethgin up. must look into it later */
843 /* && (pr->tween.time > ZERO) && (!ed->no_anim))) */
844 ))
845 {
846 EINA_LIST_FOREACH(pr->after, l, pa)
847 {
848 if (pa->id >= 0)
849 {
850 pr2 = ed->table_programs[pa->id % ed->table_programs_size];
851 if (pr2) _edje_program_run(ed, pr2, 0, "", "");
852 if (_edje_block_break(ed)) goto break_prog;
853 }
854 }
855 }
856 break_prog:
857 _edje_thaw(ed);
858 _edje_unref(ed);
859 recursions--;
860 if (recursions == 0) recursion_limit = 0;
861 _edje_unblock(ed);
862}
863
864void
865_edje_emit(Edje *ed, const char *sig, const char *src)
866{
867 _edje_emit_full(ed, sig, src, NULL, NULL);
868}
869
870/* data should either be NULL or a malloc allocated data */
871void
872_edje_emit_full(Edje *ed, const char *sig, const char *src, void *data, void (*free_func)(void *))
873{
874 Edje_Message_Signal emsg;
875 const char *sep;
876
877 if (ed->delete_me) return;
878
879 sep = strchr(sig, EDJE_PART_PATH_SEPARATOR);
880
881 /* If we are not sending the signal to a part of the child, the
882 * signal if for ourself
883 */
884 if (sep)
885 {
886 Edje_Real_Part *rp = NULL;
887 const char *newsig;
888 Edje *ed2;
889 char *part;
890 char *idx;
891 size_t length;
892
893 /* the signal contains a colon, split the signal into "parts:signal" */
894 length = sep - sig + 1;
895 part = alloca(length);
896 memcpy(part, sig, length - 1);
897 part[length - 1] = '\0';
898
899 newsig = sep + 1;
900
901 /* lookup for alias */
902 if (ed->collection && ed->collection->alias)
903 {
904 char *alias;
905
906 alias = eina_hash_find(ed->collection->alias, part);
907 if (alias) {
908 char *aliased;
909 int alien;
910 int nslen;
911
912 alien = strlen(alias);
913 nslen = strlen(newsig);
914 length = alien + nslen + 2;
915
916 aliased = alloca(length);
917 memcpy(aliased, alias, alien);
918 aliased[alien] = EDJE_PART_PATH_SEPARATOR;
919 memcpy(aliased + alien + 1, newsig, nslen + 1);
920
921 _edje_emit(ed, aliased, src);
922 return;
923 }
924 }
925
926 /* search for the index if present and remove it from the part */
927 idx = strchr(part, EDJE_PART_PATH_SEPARATOR_INDEXL);
928 if (idx)
929 {
930 char *end;
931
932 end = strchr(idx + 1, EDJE_PART_PATH_SEPARATOR_INDEXR);
933 if (end && end != idx + 1)
934 {
935 char *tmp;
936
937 tmp = alloca(end - idx - 1);
938 memcpy(tmp, idx + 1, end - idx - 1);
939 tmp[end - idx - 1] = '\0';
940 *idx = '\0';
941 idx = tmp;
942 }
943 else
944 {
945 idx = NULL;
946 }
947 }
948
949 /* search for the right part now */
950 rp = _edje_real_part_get(ed, part);
951 if (!rp) goto end;
952
953 switch (rp->part->type)
954 {
955 case EDJE_PART_TYPE_GROUP:
956 if (!rp->swallowed_object) goto end;
957 ed2 = _edje_fetch(rp->swallowed_object);
958 if (!ed2) goto end;
959
960 _edje_emit(ed2, newsig, src);
961 break;
962
963 case EDJE_PART_TYPE_EXTERNAL:
964 if (!rp->swallowed_object) break ;
965
966 if (!idx)
967 {
968 _edje_external_signal_emit(rp->swallowed_object, newsig, src);
969 }
970 else
971 {
972 Evas_Object *child;
973
974 child = _edje_children_get(rp, idx);
975 ed2 = _edje_fetch(child);
976 if (!ed2) goto end;
977 _edje_emit(ed2, newsig, src);
978 }
979 break ;
980
981 case EDJE_PART_TYPE_BOX:
982 case EDJE_PART_TYPE_TABLE:
983 if (idx)
984 {
985 Evas_Object *child;
986
987 child = _edje_children_get(rp, idx);
988 ed2 = _edje_fetch(child);
989 if (!ed2) goto end;
990 _edje_emit(ed2, newsig, src);
991 }
992 break ;
993
994 default:
995 fprintf(stderr, "SPANK SPANK SPANK !!!\nYou should never be here !\n");
996 break;
997 }
998 }
999
1000 end:
1001 emsg.sig = sig;
1002 emsg.src = src;
1003 if (data)
1004 {
1005 emsg.data = calloc(1, sizeof(*(emsg.data)));
1006 emsg.data->ref = 1;
1007 emsg.data->data = data;
1008 emsg.data->free_func = free_func;
1009 }
1010 else
1011 {
1012 emsg.data = NULL;
1013 }
1014/* new sends code */
1015 edje_object_message_send(ed->obj, EDJE_MESSAGE_SIGNAL, 0, &emsg);
1016/* old send code - use api now
1017 _edje_message_send(ed, EDJE_QUEUE_SCRIPT, EDJE_MESSAGE_SIGNAL, 0, &emsg);
1018 EINA_LIST_FOREACH(ed->subobjs, l, obj)
1019 {
1020 Edje *ed2;
1021
1022 ed2 = _edje_fetch(obj);
1023 if (!ed2) continue;
1024 if (ed2->delete_me) continue;
1025 _edje_message_send(ed2, EDJE_QUEUE_SCRIPT, EDJE_MESSAGE_SIGNAL, 0, &emsg);
1026 }
1027 */
1028 if (emsg.data && (--(emsg.data->ref) == 0))
1029 {
1030 if (emsg.data->free_func)
1031 {
1032 emsg.data->free_func(emsg.data->data);
1033 }
1034 free(emsg.data);
1035 }
1036}
1037
1038struct _Edje_Program_Data
1039{
1040#ifdef EDJE_PROGRAM_CACHE
1041 Eina_List *matches;
1042 int matched;
1043#endif
1044 Edje *ed;
1045 const char *signal;
1046 const char *source;
1047};
1048
1049static Eina_Bool _edje_glob_callback(Edje_Program *pr, void *dt)
1050{
1051 struct _Edje_Program_Data *data = dt;
1052 Edje_Real_Part *rp = NULL;
1053 Eina_Bool exec = EINA_TRUE;
1054
1055 if (pr->filter.state)
1056 {
1057 rp = _edje_real_part_get(data->ed, pr->filter.part ? pr->filter.part : data->source);
1058 if (rp)
1059 exec = (rp->chosen_description->state.name == pr->filter.state);
1060 }
1061
1062#ifdef EDJE_PROGRAM_CACHE
1063 data->matched++;
1064#endif
1065
1066 if (exec)
1067 _edje_program_run(data->ed, pr, 0, data->signal, data->source);
1068
1069 if (_edje_block_break(data->ed))
1070 {
1071#ifdef EDJE_PROGRAM_CACHE
1072 eina_list_free(data->matches);
1073 data->matches = NULL;
1074#endif
1075 return EINA_TRUE;
1076 }
1077
1078#ifdef EDJE_PROGRAM_CACHE
1079 data->matches = eina_list_append(data->matches, pr);
1080#endif
1081
1082 return EINA_FALSE;
1083}
1084
1085
1086void
1087_edje_callbacks_patterns_clean(Edje *ed)
1088{
1089 _edje_signals_sources_patterns_clean(&ed->patterns.callbacks);
1090
1091 eina_rbtree_delete(ed->patterns.callbacks.exact_match,
1092 EINA_RBTREE_FREE_CB(edje_match_signal_source_free),
1093 NULL);
1094 ed->patterns.callbacks.exact_match = NULL;
1095
1096 ed->patterns.callbacks.u.callbacks.globing = eina_list_free(ed->patterns.callbacks.u.callbacks.globing);
1097}
1098
1099static void
1100_edje_callbacks_patterns_init(Edje *ed)
1101{
1102 Edje_Signals_Sources_Patterns *ssp = &ed->patterns.callbacks;
1103
1104 if ((ssp->signals_patterns) || (ssp->sources_patterns) ||
1105 (ssp->u.callbacks.globing) || (ssp->exact_match))
1106 return;
1107
1108 ssp->u.callbacks.globing = edje_match_callback_hash_build(ed->callbacks,
1109 &ssp->exact_match);
1110
1111 ssp->signals_patterns = edje_match_callback_signal_init(ssp->u.callbacks.globing);
1112 ssp->sources_patterns = edje_match_callback_source_init(ssp->u.callbacks.globing);
1113}
1114
1115/* FIXME: what if we delete the evas object??? */
1116void
1117_edje_emit_handle(Edje *ed, const char *sig, const char *src,
1118 Edje_Message_Signal_Data *sdata, Eina_Bool prop)
1119{
1120 if (ed->delete_me) return;
1121 if (!sig) sig = "";
1122 if (!src) src = "";
1123// printf("EDJE EMIT: (%p) signal: \"%s\" source: \"%s\"\n", ed, sig, src);
1124 _edje_block(ed);
1125 _edje_ref(ed);
1126 _edje_freeze(ed);
1127
1128 if (ed->collection && ed->L)
1129 _edje_lua2_script_func_signal(ed, sig, src);
1130
1131 if (ed->collection)
1132 {
1133#ifdef EDJE_PROGRAM_CACHE
1134 Edje_Part_Collection *ec;
1135 char *tmps;
1136 int l1, l2;
1137#endif
1138 int done;
1139
1140#ifdef EDJE_PROGRAM_CACHE
1141 ec = ed->collection;
1142 l1 = strlen(sig);
1143 l2 = strlen(src);
1144 tmps = alloca(l1 + l2 + 3); /* \0, \337, \0 */
1145 strcpy(tmps, sig);
1146 tmps[l1] = '\377';
1147 strcpy(&(tmps[l1 + 1]), src);
1148#endif
1149 done = 0;
1150
1151#ifdef EDJE_PROGRAM_CACHE
1152 {
1153 Eina_List *matches;
1154 Eina_List *l;
1155 Edje_Program *pr;
1156
1157 if (eina_hash_find(ec->prog_cache.no_matches, tmps))
1158 {
1159 done = 1;
1160 }
1161 else if ((matches = eina_hash_find(ec->prog_cache.matches, tmps)))
1162 {
1163 EINA_LIST_FOREACH(matches, l, pr)
1164 {
1165 Eina_Bool exec = EINA_TRUE;
1166
1167 if (pr->filter.state)
1168 {
1169 Edje_Real_Part *rp;
1170
1171 rp = _edje_real_part_get(ed, pr->filter.part ? pr->filter.part : src);
1172 if (rp)
1173 exec = (rp->chosen_description->state.name == pr->filter.state);
1174 }
1175
1176 if (exec)
1177 {
1178 _edje_program_run(ed, pr, 0, sig, src);
1179 if (_edje_block_break(ed))
1180 {
1181 goto break_prog;
1182 }
1183 }
1184 }
1185 done = 1;
1186 }
1187 }
1188#endif
1189 if (!done)
1190 {
1191 struct _Edje_Program_Data data;
1192
1193 data.ed = ed;
1194 data.source = src;
1195 data.signal = sig;
1196#ifdef EDJE_PROGRAM_CACHE
1197 data.matched = 0;
1198 data.matches = NULL;
1199#endif
1200 if (ed->table_programs_size > 0)
1201 {
1202 const Eina_List *match;
1203 const Eina_List *l;
1204 Edje_Program *pr;
1205
1206 if (ed->patterns.programs.u.programs.globing)
1207 if (edje_match_programs_exec(ed->patterns.programs.signals_patterns,
1208 ed->patterns.programs.sources_patterns,
1209 sig,
1210 src,
1211 ed->patterns.programs.u.programs.globing,
1212 _edje_glob_callback,
1213 &data,
1214 prop) == 0)
1215 goto break_prog;
1216
1217 match = edje_match_signal_source_hash_get(sig, src,
1218 ed->patterns.programs.exact_match);
1219 EINA_LIST_FOREACH(match, l, pr)
1220 _edje_glob_callback(pr, &data);
1221 }
1222
1223#ifdef EDJE_PROGRAM_CACHE
1224 if (tmps)
1225 {
1226 if (data.matched == 0)
1227 {
1228 if (!ec->prog_cache.no_matches)
1229 ec->prog_cache.no_matches = eina_hash_string_superfast_new(NULL);
1230 eina_hash_add(ec->prog_cache.no_matches, tmps, ed);
1231 }
1232 else
1233 {
1234 if (!ec->prog_cache.matches)
1235 ec->prog_cache.matches = eina_hash_string_superfast_new(NULL);
1236 eina_hash_add(ec->prog_cache.matches, tmps, data.matches);
1237 }
1238 }
1239#endif
1240 }
1241 _edje_emit_cb(ed, sig, src, sdata, prop);
1242 if (_edje_block_break(ed))
1243 {
1244 goto break_prog;
1245 }
1246 }
1247 break_prog:
1248 _edje_thaw(ed);
1249 _edje_unref(ed);
1250 _edje_unblock(ed);
1251}
1252
1253/* Extra data for callbacks */
1254static void *callback_extra_data = NULL;
1255
1256EAPI void *
1257edje_object_signal_callback_extra_data_get(void)
1258{
1259 return callback_extra_data;
1260}
1261
1262/* FIXME: what if we delete the evas object??? */
1263static void
1264_edje_emit_cb(Edje *ed, const char *sig, const char *src, Edje_Message_Signal_Data *data, Eina_Bool prop)
1265{
1266 Eina_List *l;
1267
1268 if (ed->delete_me) return;
1269 _edje_ref(ed);
1270 _edje_freeze(ed);
1271 _edje_block(ed);
1272
1273 if (ed->just_added_callbacks)
1274 _edje_callbacks_patterns_clean(ed);
1275
1276 ed->walking_callbacks = 1;
1277
1278 if (ed->callbacks)
1279 {
1280 Edje_Signal_Callback *escb;
1281 const Eina_List *match;
1282 const Eina_List *l2;
1283 int r = 1;
1284 callback_extra_data = (data) ? data->data : NULL;
1285
1286 _edje_callbacks_patterns_init(ed);
1287 if (ed->patterns.callbacks.u.callbacks.globing)
1288 r = edje_match_callback_exec(ed->patterns.callbacks.signals_patterns,
1289 ed->patterns.callbacks.sources_patterns,
1290 sig,
1291 src,
1292 ed->patterns.callbacks.u.callbacks.globing,
1293 ed,
1294 prop);
1295
1296 if (!r)
1297 goto break_prog;
1298
1299 match = edje_match_signal_source_hash_get(sig, src,
1300 ed->patterns.callbacks.exact_match);
1301 EINA_LIST_FOREACH(match, l2, escb)
1302 {
1303 if ((prop) && (escb->propagate)) continue;
1304 if ((!escb->just_added) && (!escb->delete_me))
1305 {
1306 escb->func(escb->data, ed->obj, sig, src);
1307 if (_edje_block_break(ed))
1308 goto break_prog;
1309 }
1310 }
1311 }
1312 break_prog:
1313
1314 ed->walking_callbacks = 0;
1315 if ((ed->delete_callbacks) || (ed->just_added_callbacks))
1316 {
1317 ed->delete_callbacks = 0;
1318 ed->just_added_callbacks = 0;
1319 l = ed->callbacks;
1320 while (l)
1321 {
1322 Edje_Signal_Callback *escb = l->data;
1323 Eina_List *next_l = l->next;
1324
1325 if (escb->just_added)
1326 escb->just_added = 0;
1327 if (escb->delete_me)
1328 {
1329 ed->callbacks = eina_list_remove_list(ed->callbacks, l);
1330 if (escb->signal) eina_stringshare_del(escb->signal);
1331 if (escb->source) eina_stringshare_del(escb->source);
1332 free(escb);
1333 }
1334 l = next_l;
1335 }
1336
1337 _edje_callbacks_patterns_clean(ed);
1338 }
1339 _edje_unblock(ed);
1340 _edje_thaw(ed);
1341 _edje_unref(ed);
1342}
1343
1344static const Edje_External_Param_Info *
1345_edje_external_param_info_get(const Evas_Object *obj, const char *name)
1346{
1347 const Edje_External_Type *type;
1348 const Edje_External_Param_Info *info;
1349
1350 type = evas_object_data_get(obj, "Edje_External_Type");
1351 if (!type) return NULL;
1352 for (info = type->parameters_info; info->name; info++)
1353 if (!strcmp(info->name, name)) return info;
1354
1355 return NULL;
1356}
1357
1358static Edje_External_Param *
1359_edje_param_external_get(Edje_Real_Part *rp, const char *name, Edje_External_Param *param)
1360{
1361 Evas_Object *swallowed_object = rp->swallowed_object;
1362 const Edje_External_Param_Info *info;
1363
1364 info = _edje_external_param_info_get(swallowed_object, name);
1365 if (!info) return NULL;
1366
1367 memset(param, 0, sizeof(*param));
1368 param->name = info->name;
1369 param->type = info->type;
1370 if (!_edje_external_param_get(NULL, rp, param)) return NULL;
1371 return param;
1372}
1373
1374/* simulate external properties for native objects */
1375static Edje_External_Param *
1376_edje_param_native_get(Edje_Real_Part *rp, const char *name, Edje_External_Param *param, void **free_ptr)
1377{
1378 *free_ptr = NULL;
1379 if ((rp->part->type == EDJE_PART_TYPE_TEXT) ||
1380 (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK))
1381 {
1382 if (!strcmp(name, "text"))
1383 {
1384 param->name = name;
1385 param->type = EDJE_EXTERNAL_PARAM_TYPE_STRING;
1386
1387 _edje_recalc_do(rp->edje);
1388 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1389 param->s = _edje_entry_text_get(rp);
1390 else if (rp->part->type == EDJE_PART_TYPE_TEXT)
1391 param->s = rp->text.text;
1392 else
1393 param->s = evas_object_textblock_text_markup_get(rp->object);
1394 return param;
1395 }
1396 if (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
1397 {
1398 if (!strcmp(name, "text_unescaped"))
1399 {
1400 param->name = name;
1401 param->type = EDJE_EXTERNAL_PARAM_TYPE_STRING;
1402
1403 _edje_recalc_do(rp->edje);
1404 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1405 {
1406 const char *tmp = _edje_entry_text_get(rp);
1407 char *unescaped = _edje_text_unescape(tmp);
1408 *free_ptr = unescaped;
1409 param->s = unescaped;
1410 }
1411 else if (rp->part->type == EDJE_PART_TYPE_TEXT)
1412 param->s = rp->text.text;
1413 else
1414 {
1415 const char *tmp;
1416 char *unescaped;
1417
1418 tmp = evas_object_textblock_text_markup_get(rp->object);
1419 unescaped = _edje_text_unescape(tmp);
1420 *free_ptr = unescaped;
1421 param->s = unescaped;
1422 }
1423
1424 return param;
1425 }
1426
1427 if ((rp->entry_data) &&
1428 (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) &&
1429 (!strcmp(name, "select_allow")))
1430 {
1431 param->name = name;
1432 param->type = EDJE_EXTERNAL_PARAM_TYPE_BOOL;
1433 param->i = _edje_entry_select_allow_get(rp);
1434 return param;
1435 }
1436 }
1437 }
1438
1439 if ((rp->drag) && (rp->drag->down.count == 0))
1440 {
1441 if (!strncmp(name, "drag_", sizeof("drag_") - 1))
1442 {
1443 const char *sub_name = name + sizeof("drag_") - 1;
1444 if (!strcmp(sub_name, "value_x"))
1445 {
1446 double d;
1447
1448 _edje_recalc_do(rp->edje);
1449 d = TO_DOUBLE(rp->drag->val.x);
1450 if (rp->part->dragable.x < 0) d = 1.0 - d;
1451 param->name = name;
1452 param->type = EDJE_EXTERNAL_PARAM_TYPE_DOUBLE;
1453 param->d = d;
1454 return param;
1455 }
1456 if (!strcmp(sub_name, "value_y"))
1457 {
1458 double d;
1459
1460 _edje_recalc_do(rp->edje);
1461 d = TO_DOUBLE(rp->drag->val.y);
1462 if (rp->part->dragable.y < 0) d = 1.0 - d;
1463 param->name = name;
1464 param->type = EDJE_EXTERNAL_PARAM_TYPE_DOUBLE;
1465 param->d = d;
1466 return param;
1467 }
1468
1469 if (!strcmp(sub_name, "size_w"))
1470 {
1471 _edje_recalc_do(rp->edje);
1472 param->name = name;
1473 param->type = EDJE_EXTERNAL_PARAM_TYPE_DOUBLE;
1474 param->d = TO_DOUBLE(rp->drag->size.x);
1475 return param;
1476 }
1477 if (!strcmp(sub_name, "size_h"))
1478 {
1479 _edje_recalc_do(rp->edje);
1480 param->name = name;
1481 param->type = EDJE_EXTERNAL_PARAM_TYPE_DOUBLE;
1482 param->d = TO_DOUBLE(rp->drag->size.y);
1483 return param;
1484 }
1485
1486 if (!strcmp(sub_name, "step_x"))
1487 {
1488 _edje_recalc_do(rp->edje);
1489 param->name = name;
1490 param->type = EDJE_EXTERNAL_PARAM_TYPE_DOUBLE;
1491 param->d = TO_DOUBLE(rp->drag->step.x);
1492 return param;
1493 }
1494 if (!strcmp(sub_name, "step_y"))
1495 {
1496 _edje_recalc_do(rp->edje);
1497 param->name = name;
1498 param->type = EDJE_EXTERNAL_PARAM_TYPE_DOUBLE;
1499 param->d = TO_DOUBLE(rp->drag->step.y);
1500 return param;
1501 }
1502
1503 if (!strcmp(sub_name, "page_x"))
1504 {
1505 _edje_recalc_do(rp->edje);
1506 param->name = name;
1507 param->type = EDJE_EXTERNAL_PARAM_TYPE_DOUBLE;
1508 param->d = TO_DOUBLE(rp->drag->page.x);
1509 return param;
1510 }
1511 if (!strcmp(sub_name, "page_y"))
1512 {
1513 _edje_recalc_do(rp->edje);
1514 param->name = name;
1515 param->type = EDJE_EXTERNAL_PARAM_TYPE_DOUBLE;
1516 param->d = TO_DOUBLE(rp->drag->page.y);
1517 return param;
1518 }
1519
1520 return NULL;
1521 }
1522 }
1523
1524 return NULL;
1525}
1526
1527static Eina_Bool
1528_edje_param_native_set(Edje_Real_Part *rp, const char *name, const Edje_External_Param *param)
1529{
1530 if ((rp->part->type == EDJE_PART_TYPE_TEXT) ||
1531 (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK))
1532 {
1533 if (!strcmp(name, "text"))
1534 {
1535 if (param->type != EDJE_EXTERNAL_PARAM_TYPE_STRING)
1536 return EINA_FALSE;
1537
1538 _edje_object_part_text_raw_set
1539 (rp->edje->obj, rp, rp->part->name, param->s);
1540 return EINA_TRUE;
1541 }
1542 if (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
1543 {
1544 if (!strcmp(name, "text_unescaped"))
1545 {
1546 if (param->type != EDJE_EXTERNAL_PARAM_TYPE_STRING)
1547 return EINA_FALSE;
1548
1549 if (rp->part->type == EDJE_PART_TYPE_TEXT)
1550 _edje_object_part_text_raw_set
1551 (rp->edje->obj, rp, rp->part->name, param->s);
1552 else
1553 {
1554 char *escaped = _edje_text_escape(param->s);
1555 _edje_object_part_text_raw_set
1556 (rp->edje->obj, rp, rp->part->name, escaped);
1557 free(escaped);
1558 }
1559
1560 return EINA_TRUE;
1561 }
1562
1563 if ((rp->entry_data) &&
1564 (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) &&
1565 (!strcmp(name, "select_allow")))
1566 {
1567 if (param->type != EDJE_EXTERNAL_PARAM_TYPE_BOOL)
1568 return EINA_FALSE;
1569 _edje_entry_select_allow_set(rp, param->i);
1570 return EINA_TRUE;
1571 }
1572 }
1573 }
1574
1575 if ((rp->drag) && (rp->drag->down.count == 0))
1576 {
1577 if (!strncmp(name, "drag_", sizeof("drag_") - 1))
1578 {
1579 const char *sub_name = name + sizeof("drag_") - 1;
1580 if (!strcmp(sub_name, "value_x"))
1581 {
1582 double d;
1583 if (param->type != EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
1584 return EINA_FALSE;
1585 d = param->d;
1586 if (rp->part->dragable.confine_id != -1)
1587 d = CLAMP(d, 0.0, 1.0);
1588 if (rp->part->dragable.x < 0) d = 1.0 - d;
1589 if (rp->drag->val.x == FROM_DOUBLE(d)) return EINA_TRUE;
1590 rp->drag->val.x = FROM_DOUBLE(d);
1591#ifdef EDJE_CALC_CACHE
1592 rp->invalidate = 1;
1593#endif
1594 _edje_dragable_pos_set
1595 (rp->edje, rp, rp->drag->val.x, rp->drag->val.y);
1596 _edje_emit(rp->edje, "drag,set", rp->part->name);
1597 return EINA_TRUE;
1598 }
1599 if (!strcmp(sub_name, "value_y"))
1600 {
1601 double d;
1602 if (param->type != EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
1603 return EINA_FALSE;
1604 d = param->d;
1605 if (rp->part->dragable.confine_id != -1)
1606 d = CLAMP(d, 0.0, 1.0);
1607 if (rp->part->dragable.y < 0) d = 1.0 - d;
1608 if (rp->drag->val.y == FROM_DOUBLE(d)) return EINA_TRUE;
1609 rp->drag->val.y = FROM_DOUBLE(d);
1610#ifdef EDJE_CALC_CACHE
1611 rp->invalidate = 1;
1612#endif
1613 _edje_dragable_pos_set
1614 (rp->edje, rp, rp->drag->val.x, rp->drag->val.y);
1615 _edje_emit(rp->edje, "drag,set", rp->part->name);
1616 return EINA_TRUE;
1617 }
1618
1619 if (!strcmp(sub_name, "size_w"))
1620 {
1621 if (param->type != EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
1622 return EINA_FALSE;
1623 rp->drag->size.x = FROM_DOUBLE(CLAMP(param->d, 0.0, 1.0));
1624 rp->edje->dirty = 1;
1625#ifdef EDJE_CALC_CACHE
1626 rp->invalidate = 1;
1627#endif
1628 _edje_recalc(rp->edje);
1629 return EINA_TRUE;
1630 }
1631 if (!strcmp(sub_name, "size_h"))
1632 {
1633 if (param->type != EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
1634 return EINA_FALSE;
1635 rp->drag->size.y = FROM_DOUBLE(CLAMP(param->d, 0.0, 1.0));
1636 rp->edje->dirty = 1;
1637#ifdef EDJE_CALC_CACHE
1638 rp->invalidate = 1;
1639#endif
1640 _edje_recalc(rp->edje);
1641 return EINA_TRUE;
1642 }
1643
1644 if (!strcmp(sub_name, "step_x"))
1645 {
1646 if (param->type != EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
1647 return EINA_FALSE;
1648 rp->drag->step.x = FROM_DOUBLE(CLAMP(param->d, 0.0, 1.0));
1649#ifdef EDJE_CALC_CACHE
1650 rp->invalidate = 1;
1651#endif
1652 return EINA_TRUE;
1653 }
1654 if (!strcmp(sub_name, "step_y"))
1655 {
1656 if (param->type != EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
1657 return EINA_FALSE;
1658 rp->drag->step.y = FROM_DOUBLE(CLAMP(param->d, 0.0, 1.0));
1659#ifdef EDJE_CALC_CACHE
1660 rp->invalidate = 1;
1661#endif
1662 return EINA_TRUE;
1663 }
1664
1665 if (!strcmp(sub_name, "page_x"))
1666 {
1667 if (param->type != EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
1668 return EINA_FALSE;
1669 rp->drag->page.x = FROM_DOUBLE(CLAMP(param->d, 0.0, 1.0));
1670#ifdef EDJE_CALC_CACHE
1671 rp->invalidate = 1;
1672#endif
1673 return EINA_TRUE;
1674 }
1675 if (!strcmp(sub_name, "page_y"))
1676 {
1677 if (param->type != EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
1678 return EINA_FALSE;
1679 rp->drag->page.y = FROM_DOUBLE(CLAMP(param->d, 0.0, 1.0));
1680#ifdef EDJE_CALC_CACHE
1681 rp->invalidate = 1;
1682#endif
1683 return EINA_TRUE;
1684 }
1685
1686 return EINA_FALSE;
1687 }
1688 }
1689
1690 return EINA_FALSE;
1691}
1692
1693static const Edje_External_Param_Info *
1694_edje_native_param_info_get(const Edje_Real_Part *rp, const char *name)
1695{
1696 if ((rp->part->type == EDJE_PART_TYPE_TEXT) ||
1697 (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK))
1698 {
1699 if (!strcmp(name, "text"))
1700 {
1701 static const Edje_External_Param_Info pi =
1702 EDJE_EXTERNAL_PARAM_INFO_STRING("text");
1703 return &pi;
1704 }
1705 if (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
1706 {
1707 if (!strcmp(name, "text_unescaped"))
1708 {
1709 static const Edje_External_Param_Info pi =
1710 EDJE_EXTERNAL_PARAM_INFO_STRING("text_unescaped");
1711 return &pi;
1712 }
1713 if (!strcmp(name, "select_allow"))
1714 {
1715 static const Edje_External_Param_Info pi =
1716 EDJE_EXTERNAL_PARAM_INFO_BOOL("text_unescaped");
1717 return &pi;
1718 }
1719 }
1720 }
1721
1722 if ((rp->drag) && (rp->drag->down.count == 0))
1723 {
1724 if (!strncmp(name, "drag_", sizeof("drag_") - 1))
1725 {
1726 name += sizeof("drag_") - 1;
1727 if (!strcmp(name, "value_x"))
1728 {
1729 static const Edje_External_Param_Info pi =
1730 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_value_x");
1731 return &pi;
1732 }
1733 if (!strcmp(name, "value_y"))
1734 {
1735 static const Edje_External_Param_Info pi =
1736 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_value_y");
1737 return &pi;
1738 }
1739 if (!strcmp(name, "size_w"))
1740 {
1741 static const Edje_External_Param_Info pi =
1742 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_size_w");
1743 return &pi;
1744 }
1745 if (!strcmp(name, "size_h"))
1746 {
1747 static const Edje_External_Param_Info pi =
1748 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_size_h");
1749 return &pi;
1750 }
1751 if (!strcmp(name, "step_x"))
1752 {
1753 static const Edje_External_Param_Info pi =
1754 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_step_x");
1755 return &pi;
1756 }
1757 if (!strcmp(name, "step_y"))
1758 {
1759 static const Edje_External_Param_Info pi =
1760 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_step_y");
1761 return &pi;
1762 }
1763 if (!strcmp(name, "page_x"))
1764 {
1765 static const Edje_External_Param_Info pi =
1766 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_page_x");
1767 return &pi;
1768 }
1769 if (!strcmp(name, "page_y"))
1770 {
1771 static const Edje_External_Param_Info pi =
1772 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_page_y");
1773 return &pi;
1774 }
1775
1776 return NULL;
1777 }
1778 }
1779
1780 return NULL;
1781}
1782
1783static Edje_External_Param *
1784_edje_param_convert(Edje_External_Param *param, const Edje_External_Param_Info *dst_info)
1785{
1786 if (param->type == dst_info->type) return param;
1787
1788 switch (dst_info->type)
1789 {
1790 case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
1791 case EDJE_EXTERNAL_PARAM_TYPE_INT:
1792 {
1793 int i;
1794 switch (param->type)
1795 {
1796 case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
1797 i = (int)param->d;
1798 break;
1799 case EDJE_EXTERNAL_PARAM_TYPE_STRING:
1800 case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
1801 i = (param->s) ? atoi(param->s) : 0;
1802 break;
1803 case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
1804 case EDJE_EXTERNAL_PARAM_TYPE_INT:
1805 i = param->i;
1806 break;
1807 default:
1808 return NULL;
1809 }
1810 if (dst_info->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
1811 i = !!i;
1812 param->type = dst_info->type;
1813 param->i = i;
1814 return param;
1815 }
1816
1817 case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
1818 {
1819 double d;
1820 switch (param->type)
1821 {
1822 case EDJE_EXTERNAL_PARAM_TYPE_INT:
1823 d = (double)param->i;
1824 break;
1825 case EDJE_EXTERNAL_PARAM_TYPE_STRING:
1826 case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
1827 d = (param->s) ? atof(param->s) : 0.0;
1828 break;
1829 case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
1830 d = (double)param->i;
1831 break;
1832 default:
1833 return NULL;
1834 }
1835 param->type = dst_info->type;
1836 param->d = d;
1837 return param;
1838 }
1839
1840 case EDJE_EXTERNAL_PARAM_TYPE_STRING:
1841 {
1842 static char s[64];
1843 switch (param->type)
1844 {
1845 case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
1846 case EDJE_EXTERNAL_PARAM_TYPE_INT:
1847 if (!snprintf(s, sizeof(s), "%i", param->i)) return NULL;
1848 break;
1849 case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
1850 if (!snprintf(s, sizeof(s), "%f", param->d)) return NULL;
1851 break;
1852 case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
1853 param->type = dst_info->type;
1854 return param;
1855 default:
1856 return NULL;
1857 }
1858 param->type = dst_info->type;
1859 param->s = s;
1860 return param;
1861 }
1862
1863 case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
1864 {
1865 static char s[64];
1866 const char *val;
1867 switch (param->type)
1868 {
1869 case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
1870 case EDJE_EXTERNAL_PARAM_TYPE_INT:
1871 if (!snprintf(s, sizeof(s), "%i", param->i)) return NULL;
1872 val = s;
1873 break;
1874 case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
1875 if (!snprintf(s, sizeof(s), "%f", param->d)) return NULL;
1876 val = s;
1877 break;
1878 case EDJE_EXTERNAL_PARAM_TYPE_STRING:
1879 val = param->s;
1880 break;
1881 default:
1882 return NULL;
1883 }
1884
1885 param->type = dst_info->type;
1886 if (param->s != val) param->s = val;
1887 return param;
1888 }
1889
1890 default: return NULL;
1891 }
1892}
1893
1894static Eina_Bool
1895_edje_param_validate(const Edje_External_Param *param, const Edje_External_Param_Info *info)
1896{
1897 switch (info->type)
1898 {
1899 case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
1900 return ((param->i == 0) || (param->i == 1));
1901
1902 case EDJE_EXTERNAL_PARAM_TYPE_INT:
1903 if ((info->info.i.min != EDJE_EXTERNAL_INT_UNSET) &&
1904 (info->info.i.min > param->i))
1905 return EINA_FALSE;
1906
1907 if ((info->info.i.max != EDJE_EXTERNAL_INT_UNSET) &&
1908 (info->info.i.max < param->i))
1909 return EINA_FALSE;
1910
1911 return EINA_TRUE;
1912
1913 case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
1914 if ((info->info.d.min != EDJE_EXTERNAL_DOUBLE_UNSET) &&
1915 (info->info.d.min > param->d))
1916 return EINA_FALSE;
1917
1918 if ((info->info.d.max != EDJE_EXTERNAL_DOUBLE_UNSET) &&
1919 (info->info.d.max < param->d))
1920 return EINA_FALSE;
1921
1922 return EINA_TRUE;
1923
1924 case EDJE_EXTERNAL_PARAM_TYPE_STRING:
1925 if (!param->s) return EINA_FALSE;
1926 if (info->info.s.accept_fmt)
1927 INF("string 'accept_fmt' validation not implemented.");
1928 if (info->info.s.deny_fmt)
1929 INF("string 'deny_fmt' validation not implemented.");
1930 return EINA_TRUE;
1931
1932 case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
1933 {
1934 const char **itr = info->info.c.choices;
1935 if (!itr) return EINA_FALSE;
1936 for (; *itr; itr++)
1937 if (!strcmp(*itr, param->s))
1938 return EINA_TRUE;
1939 return EINA_FALSE;
1940 }
1941
1942 default: return EINA_FALSE;
1943 }
1944}
1945
1946static void
1947_edje_param_copy(Edje_Real_Part *src_part, const char *src_param, Edje_Real_Part *dst_part, const char *dst_param)
1948{
1949 Edje_External_Param val;
1950 const Edje_External_Param_Info *dst_info;
1951 void *free_ptr = NULL;
1952
1953 if ((!src_part) || (!src_param) || (!dst_part) || (!dst_param))
1954 return;
1955
1956 if (dst_part->part->type == EDJE_PART_TYPE_EXTERNAL)
1957 dst_info = _edje_external_param_info_get
1958 (dst_part->swallowed_object, dst_param);
1959 else
1960 dst_info = _edje_native_param_info_get(dst_part, dst_param);
1961
1962 if (!dst_info)
1963 {
1964 ERR("cannot copy, invalid destination parameter '%s' of part '%s'",
1965 dst_param, dst_part->part->name);
1966 return;
1967 }
1968
1969 if (src_part->part->type == EDJE_PART_TYPE_EXTERNAL)
1970 {
1971 if (!_edje_param_external_get
1972 (src_part, src_param, &val))
1973 {
1974 ERR("cannot get parameter '%s' of part '%s'",
1975 src_param, src_part->part->name);
1976 return;
1977 }
1978 }
1979 else
1980 {
1981 if (!_edje_param_native_get(src_part, src_param, &val, &free_ptr))
1982 {
1983 ERR("cannot get parameter '%s' of part '%s'",
1984 src_param, src_part->part->name);
1985 return;
1986 }
1987 }
1988
1989 if (!_edje_param_convert(&val, dst_info))
1990 {
1991 ERR("cannot convert parameter type %s to requested type %s",
1992 edje_external_param_type_str(val.type),
1993 edje_external_param_type_str(dst_info->type));
1994 goto end;
1995 }
1996
1997 if (!_edje_param_validate(&val, dst_info))
1998 {
1999 ERR("incorrect parameter value failed validation for type %s",
2000 edje_external_param_type_str(dst_info->type));
2001 goto end;
2002 }
2003
2004 if (dst_part->part->type == EDJE_PART_TYPE_EXTERNAL)
2005 {
2006 val.name = dst_param;
2007 if (!_edje_external_param_set(NULL, dst_part, &val))
2008 {
2009 ERR("failed to set parameter '%s' (%s) of part '%s'",
2010 dst_param, edje_external_param_type_str(dst_info->type),
2011 dst_part->part->name);
2012 goto end;
2013 }
2014 }
2015 else
2016 {
2017 if (!_edje_param_native_set(dst_part, dst_param, &val))
2018 {
2019 ERR("failed to set parameter '%s' (%s) of part '%s'",
2020 dst_param, edje_external_param_type_str(dst_info->type),
2021 dst_part->part->name);
2022 goto end;
2023 }
2024 }
2025
2026 end:
2027 free(free_ptr);
2028}
2029
2030static void
2031_edje_param_set(Edje_Real_Part *part, const char *param, const char *value)
2032{
2033 Edje_External_Param val;
2034 const Edje_External_Param_Info *info;
2035
2036 if ((!part) || (!param) || (!value))
2037 return;
2038
2039 if (part->part->type == EDJE_PART_TYPE_EXTERNAL)
2040 info = _edje_external_param_info_get(part->swallowed_object, param);
2041 else
2042 info = _edje_native_param_info_get(part, param);
2043
2044 if (!info)
2045 {
2046 ERR("cannot copy, invalid destination parameter '%s' of part '%s'",
2047 param, part->part->name);
2048 return;
2049 }
2050
2051 val.name = "(temp)";
2052 val.type = EDJE_EXTERNAL_PARAM_TYPE_STRING;
2053 val.s = value;
2054
2055 if (!_edje_param_convert(&val, info))
2056 {
2057 ERR("cannot convert parameter type STRING to requested type %s",
2058 edje_external_param_type_str(info->type));
2059 return;
2060 }
2061
2062 if (!_edje_param_validate(&val, info))
2063 {
2064 ERR("incorrect parameter value failed validation for type %s",
2065 edje_external_param_type_str(info->type));
2066 return;
2067 }
2068
2069 if (part->part->type == EDJE_PART_TYPE_EXTERNAL)
2070 {
2071 val.name = param;
2072 if (!_edje_external_param_set(NULL, part, &val))
2073 {
2074 ERR("failed to set parameter '%s' (%s) of part '%s'",
2075 param, edje_external_param_type_str(info->type),
2076 part->part->name);
2077 return;
2078 }
2079 }
2080 else
2081 {
2082 if (!_edje_param_native_set(part, param, &val))
2083 {
2084 ERR("failed to set parameter '%s' (%s) of part '%s'",
2085 param, edje_external_param_type_str(info->type),
2086 part->part->name);
2087 return;
2088 }
2089 }
2090}
diff --git a/libraries/edje/src/lib/edje_script_only.c b/libraries/edje/src/lib/edje_script_only.c
new file mode 100644
index 0000000..e7a7347
--- /dev/null
+++ b/libraries/edje/src/lib/edje_script_only.c
@@ -0,0 +1,643 @@
1#include "edje_private.h"
2
3/*
4 * ALREADY EXPORTED BY EMBRYO:
5 *
6 * enum Float_Round_Method {
7 * ROUND, FLOOR, CEIL, TOZERO
8 * };
9 * enum Float_Angle_Mode {
10 * RADIAN, DEGREES, GRADES
11 * };
12 *
13 * numargs();
14 * getarg(arg, index=0);
15 * setarg(arg, index=0, value);
16 *
17 * Float:atof(string[]);
18 * Float:fract(Float:value);
19 * round(Float:value, Float_Round_Method:method=ROUND);
20 * Float:sqrt(Float:value);
21 * Float:pow(Float:value, Float:exponent);
22 * Float:log(Float:value, Float:base=10.0);
23 * Float:sin(Float:value, Float_Angle_Mode:mode=RADIAN);
24 * Float:cos(Float:value, Float_Angle_Mode:mode=RADIAN);
25 * Float:tan(Float:value, Float_Angle_Mode:mode=RADIAN);
26 * Float:abs(Float:value);
27 * atoi(str[]);
28 * fnmatch(glob[], str[]);
29 * strcmp(str1[], str2[]);
30 * strncmp(str1[], str2[]);
31 * strcpy(dst[], src[]);
32 * strncpy(dst[], src[], n);
33 * strlen(str[]);
34 * strcat(dst[], src[]);
35 * strncat(dst[], src[], n);
36 * strprep(dst[], src[]);
37 * strnprep(dst[], src[], n);
38 * strcut(dst[], str[], n, n2);
39 * snprintf(dst[], dstn, fmt[], ...);
40 * strstr(str[], ndl[]);
41 * strchr(str[], ch[]);
42 * strrchr(str[], ch[]);
43 * rand();
44 * Float:randf();
45 * Float:seconds();
46 * date(&year, &month, &day, &yearday, &weekday, &hr, &min, &Float:sec);
47 *
48 */
49
50typedef struct _Sinfo Sinfo;
51
52struct _Sinfo
53{
54 struct
55 {
56 Embryo_Function
57 obj_init, obj_shutdown, obj_show, obj_show_immediate,
58 obj_hide, obj_hide_immediate, obj_move, obj_move_immediate,
59 obj_resize, obj_resize_immediate, obj_message;
60 } fn;
61 struct
62 {
63 Ecore_Job * show, *hide, *move, *resize;
64 } job;
65 struct
66 {
67 int id;
68 Eina_Hash *hash; // FIXME: hash -> bad. too big. one-way lookup etc.
69 } oid;
70};
71
72static void _call_fn(Edje * ed, const char *fname, Embryo_Function fn);
73
74/* frankly - these make the code shorter to type and read - just sanity for
75 * development */
76#define IFFN(func) if (si->fn.func != EMBRYO_FUNCTION_NONE)
77#define IFNO(func) if (si->fn.func == EMBRYO_FUNCTION_NONE)
78#define CLFN(func) IFFN(func) {_call_fn(ed, #func, si->fn.func);}
79#define SI Sinfo *si; si = ed->script_only_data; if (!si) return
80#define SI_RETURN(ret) Sinfo *si; si = ed->script_only_data; if (!si) return (ret)
81#define PINT(val) embryo_parameter_cell_push(ed->collection->script, (Embryo_Cell)(val))
82#define PSTR(val) embryo_parameter_string_push(ed->collection->script, val)
83#define GTFN(func) si->fn.func = embryo_program_function_find(ed->collection->script, #func)
84#define DELJ(type) if (si->job.type) ecore_job_del(si->job.type);
85#define ADDJ(type, func) si->job.type = ecore_job_add(func, ed);
86#define ZERJ(type) si->job.type = NULL;
87#define IFNJ(type) if (!si->job.type)
88#define EXPF(func) embryo_program_native_call_add(ed->collection->script, #func, _exp_##func)
89
90typedef struct _Oid Oid;
91
92struct _Oid
93{
94 Edje *ed;
95 Evas_Object *obj;
96 Evas_Coord x, y, w, h;
97 int oid;
98};
99
100/* FIXME: using eina_hash and strings is just nasty! make a custom int hash */
101static int
102_oid_alloc(Edje * ed)
103{
104 SI_RETURN(0);
105
106 si->oid.id++;
107 return si->oid.id;
108}
109
110static Oid *
111_oid_track(Edje * ed, Evas_Object * o)
112{
113 Oid *oi;
114
115 char buf[64];
116
117 SI_RETURN(NULL);
118
119 oi = calloc(1, sizeof(Oid));
120 if (!oi)
121 return NULL;
122 oi->oid = _oid_alloc(ed);
123 if (!oi->oid)
124 {
125 free(oi);
126 return NULL;
127 }
128 oi->ed = ed;
129 oi->obj = o;
130 evas_object_smart_member_add(oi->obj, oi->ed->obj);
131 evas_object_clip_set(oi->obj, oi->ed->base.clipper);
132 evas_object_geometry_get(oi->obj, &(oi->x), &(oi->y), &(oi->w), &(oi->h));
133 snprintf(buf, sizeof(buf), "%i", oi->oid);
134 if (!si->oid.hash)
135 si->oid.hash = eina_hash_string_superfast_new(NULL);
136 eina_hash_add(si->oid.hash, buf, oi);
137 return oi;
138}
139
140static Oid *
141_oid_find(Edje * ed, int oid)
142{
143 char buf[64];
144
145 SI_RETURN(NULL);
146
147 snprintf(buf, sizeof(buf), "%i", oid);
148 return eina_hash_find(si->oid.hash, buf);
149}
150
151static void
152_oid_del(Edje * ed, int oid)
153{
154 char buf[64];
155
156 SI;
157
158 snprintf(buf, sizeof(buf), "%i", oid);
159 eina_hash_del(si->oid.hash, buf, NULL);
160}
161
162static void
163_oid_free(Oid * oid)
164{
165 free(oid);
166}
167
168static Eina_Bool
169_oid_freeall_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__)
170{
171 Oid *oid = data;
172
173 evas_object_del(oid->obj);
174 free(oid);
175 return EINA_TRUE;
176}
177
178static void
179_oid_freeall(Edje * ed)
180{
181 SI;
182 if (!si->oid.hash)
183 return;
184 eina_hash_foreach(si->oid.hash, _oid_freeall_cb, ed);
185 eina_hash_free(si->oid.hash);
186 si->oid.hash = NULL;
187}
188
189static Eina_Bool
190_oid_moveall_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__)
191{
192 Oid *oid = data;
193
194 evas_object_move(oid->obj, oid->ed->x + oid->x, oid->ed->y + oid->y);
195 return EINA_TRUE;
196}
197
198static void
199_oid_moveall(Edje * ed)
200{
201 SI;
202 if (!si->oid.hash)
203 return;
204 eina_hash_foreach(si->oid.hash, _oid_moveall_cb, ed);
205}
206
207/**********/
208
209static Embryo_Cell
210_exp_e_obj_del(Embryo_Program * ep, Embryo_Cell * params)
211{
212 Edje *ed = embryo_program_data_get(ep);
213
214 Oid *oid;
215
216 SI_RETURN(-1);
217
218 CHKPARAM(1);
219 if (!(oid = _oid_find(ed, params[1])))
220 return -1;
221 evas_object_del(oid->obj);
222 _oid_del(ed, oid->oid);
223 _oid_free(oid);
224 return 0;
225}
226
227static Embryo_Cell
228_exp_e_obj_rect_add(Embryo_Program * ep, Embryo_Cell * params __UNUSED__)
229{
230 Edje *ed = embryo_program_data_get(ep);
231
232 Evas_Object *o;
233
234 Oid *oid;
235
236 SI_RETURN(-1);
237
238 o = evas_object_rectangle_add(evas_object_evas_get(ed->obj));
239 if (!o)
240 return 0;
241 oid = _oid_track(ed, o);
242 if (oid)
243 return oid->oid;
244 return 0;
245}
246
247static Embryo_Cell
248_exp_e_obj_show(Embryo_Program * ep, Embryo_Cell * params)
249{
250 Edje *ed = embryo_program_data_get(ep);
251
252 Oid *oid;
253
254 SI_RETURN(-1);
255
256 CHKPARAM(1);
257 if (!(oid = _oid_find(ed, params[1])))
258 return -1;
259 evas_object_show(oid->obj);
260 return 0;
261}
262
263static Embryo_Cell
264_exp_e_obj_hide(Embryo_Program * ep, Embryo_Cell * params)
265{
266 Edje *ed = embryo_program_data_get(ep);
267
268 Oid *oid;
269
270 SI_RETURN(-1);
271
272 CHKPARAM(1);
273 if (!(oid = _oid_find(ed, params[1])))
274 return -1;
275 evas_object_hide(oid->obj);
276 return 0;
277}
278
279static Embryo_Cell
280_exp_e_obj_move(Embryo_Program * ep, Embryo_Cell * params)
281{
282 Edje *ed = embryo_program_data_get(ep);
283
284 Oid *oid;
285
286 SI_RETURN(-1);
287
288 CHKPARAM(3);
289 if (!(oid = _oid_find(ed, params[1])))
290 return -1;
291 if ((oid->x == params[2]) && (oid->y == params[3]))
292 return -1;
293 oid->x = params[2];
294 oid->y = params[3];
295 evas_object_move(oid->obj, ed->x + oid->x, ed->y + oid->y);
296 return 0;
297}
298
299static Embryo_Cell
300_exp_e_obj_resize(Embryo_Program * ep, Embryo_Cell * params)
301{
302 Edje *ed = embryo_program_data_get(ep);
303
304 Oid *oid;
305
306 SI_RETURN(-1);
307
308 CHKPARAM(3);
309 if (!(oid = _oid_find(ed, params[1])))
310 return -1;
311 if ((oid->w == params[2]) && (oid->h == params[3]))
312 return -1;
313 oid->w = params[2];
314 oid->h = params[3];
315 evas_object_resize(oid->obj, oid->w, oid->h);
316 return 0;
317}
318
319static Embryo_Cell
320_exp_e_obj_geometry_set(Embryo_Program * ep, Embryo_Cell * params)
321{
322 Edje *ed = embryo_program_data_get(ep);
323
324 Oid *oid;
325
326 SI_RETURN(-1);
327
328 CHKPARAM(5);
329 if (!(oid = _oid_find(ed, params[1])))
330 return -1;
331 if ((oid->x == params[2]) && (oid->y == params[3]) &&
332 (oid->w == params[4]) && (oid->h == params[5]))
333 return -1;
334 oid->x = params[2];
335 oid->y = params[3];
336 oid->w = params[4];
337 oid->h = params[5];
338 evas_object_move(oid->obj, ed->x + oid->x, ed->y + oid->y);
339 evas_object_resize(oid->obj, oid->w, oid->h);
340 return 0;
341}
342
343static Embryo_Cell
344_exp_e_obj_geometry_get(Embryo_Program * ep, Embryo_Cell * params)
345{
346 Edje *ed = embryo_program_data_get(ep);
347
348 Oid *oid;
349
350 SI_RETURN(-1);
351
352 CHKPARAM(5);
353 if (!(oid = _oid_find(ed, params[1])))
354 return -1;
355 SETINT(oid->x, params[2]);
356 SETINT(oid->y, params[3]);
357 SETINT(oid->w, params[4]);
358 SETINT(oid->h, params[5]);
359 return 0;
360}
361
362static Embryo_Cell
363_exp_e_obj_color_set(Embryo_Program * ep, Embryo_Cell * params)
364{
365 Edje *ed = embryo_program_data_get(ep);
366
367 Oid *oid;
368
369 SI_RETURN(-1);
370
371 CHKPARAM(5);
372 if (!(oid = _oid_find(ed, params[1])))
373 return -1;
374 evas_object_color_set(oid->obj, params[2], params[3], params[4], params[5]);
375 return 0;
376}
377
378static Embryo_Cell
379_exp_e_obj_color_get(Embryo_Program * ep, Embryo_Cell * params)
380{
381 Edje *ed = embryo_program_data_get(ep);
382
383 Oid *oid;
384
385 int r, g, b, a;
386
387 SI_RETURN(-1);
388
389 CHKPARAM(5);
390 if (!(oid = _oid_find(ed, params[1])))
391 return -1;
392 evas_object_color_get(oid->obj, &r, &g, &b, &a);
393 SETINT(r, params[2]);
394 SETINT(g, params[3]);
395 SETINT(b, params[4]);
396 SETINT(a, params[5]);
397 return 0;
398}
399
400static Embryo_Cell
401_exp_e_signal_emit(Embryo_Program * ep, Embryo_Cell * params)
402{
403 Edje *ed = embryo_program_data_get(ep);
404
405 char *sig = NULL, *src = NULL;
406
407 SI_RETURN(-1);
408
409 CHKPARAM(2);
410 GETSTR(sig, params[1]);
411 GETSTR(src, params[2]);
412 if ((!sig) || (!src))
413 return -1;
414 _edje_emit(ed, sig, src);
415 return 0;
416}
417
418/**********/
419
420Eina_Bool
421_edje_script_only(Edje * ed)
422{
423 if ((ed->collection) && (ed->collection->script) &&
424 (ed->collection->script_only))
425 return EINA_TRUE;
426 return EINA_FALSE;
427}
428
429void
430_edje_script_only_init(Edje * ed)
431{
432 Sinfo *si;
433
434 si = calloc(1, sizeof(Sinfo));
435 if (!si)
436 return;
437 ed->script_only_data = si;
438
439 embryo_program_data_set(ed->collection->script, ed);
440
441 EXPF(e_obj_del);
442 EXPF(e_obj_rect_add);
443 EXPF(e_obj_show);
444 EXPF(e_obj_hide);
445 EXPF(e_obj_move);
446 EXPF(e_obj_resize);
447 EXPF(e_obj_geometry_set);
448 EXPF(e_obj_geometry_get);
449 EXPF(e_obj_color_set);
450 EXPF(e_obj_color_get);
451 EXPF(e_signal_emit);
452
453 embryo_program_vm_push(ed->collection->script);
454 embryo_program_max_cycle_run_set(ed->collection->script, 5000000);
455
456 GTFN(obj_init);
457 GTFN(obj_shutdown);
458 GTFN(obj_show);
459 GTFN(obj_show_immediate);
460 GTFN(obj_hide);
461 GTFN(obj_hide_immediate);
462 GTFN(obj_move);
463 GTFN(obj_move_immediate);
464 GTFN(obj_resize);
465 GTFN(obj_resize_immediate);
466 GTFN(obj_message);
467
468 CLFN(obj_init);
469 _edje_script_only_move(ed);
470}
471
472void
473_edje_script_only_shutdown(Edje * ed)
474{
475 SI;
476
477 CLFN(obj_shutdown);
478 DELJ(show);
479 DELJ(hide);
480 DELJ(move);
481 DELJ(resize);
482 _oid_freeall(ed);
483}
484
485static void
486_show_job(void *data)
487{
488 Edje *ed = data;
489
490 SI;
491
492 ZERJ(show);
493 CLFN(obj_show);
494}
495void
496_edje_script_only_show(Edje * ed)
497{
498 SI;
499
500 IFFN(obj_show)
501 {
502 IFNJ(hide)
503 {
504 DELJ(show);
505 ADDJ(show, _show_job);
506 }
507 else
508 {
509 DELJ(hide);
510 }
511 }
512 IFNO(obj_show_immediate) return;
513 CLFN(obj_show_immediate);
514}
515
516static void
517_hide_job(void *data)
518{
519 Edje *ed = data;
520
521 SI;
522
523 ZERJ(hide);
524 CLFN(obj_hide);
525}
526void
527_edje_script_only_hide(Edje * ed)
528{
529 SI;
530
531 IFFN(obj_hide)
532 {
533 IFNJ(show)
534 {
535 DELJ(hide);
536 ADDJ(hide, _hide_job);
537 }
538 else
539 {
540 DELJ(show);
541 }
542 }
543 IFNO(obj_hide_immediate) return;
544 CLFN(obj_hide_immediate);
545}
546
547static void
548_move_job(void *data)
549{
550 Edje *ed = data;
551
552 SI;
553
554 _oid_moveall(ed);
555 ZERJ(move);
556 IFNO(obj_move) return;
557 PINT(ed->x);
558 PINT(ed->y);
559 CLFN(obj_move);
560}
561void
562_edje_script_only_move(Edje * ed)
563{
564 SI;
565
566 DELJ(move);
567 ADDJ(move, _move_job);
568 IFNO(obj_move_immediate) return;
569 PINT(ed->x);
570 PINT(ed->y);
571 CLFN(obj_move_immediate);
572}
573
574static void
575_resize_job(void *data)
576{
577 Edje *ed = data;
578
579 SI;
580
581 ZERJ(resize);
582 PINT(ed->w);
583 PINT(ed->h);
584 CLFN(obj_resize);
585}
586void
587_edje_script_only_resize(Edje * ed)
588{
589 SI;
590
591 IFFN(obj_resize)
592 {
593 DELJ(resize);
594 ADDJ(resize, _resize_job);
595 }
596 PINT(ed->w);
597 PINT(ed->h);
598 CLFN(obj_resize_immediate);
599}
600
601void
602_edje_script_only_message(Edje * ed, Edje_Message * em)
603{
604 SI;
605
606 IFNO(obj_message) return;
607 _edje_message_parameters_push(em);
608 CLFN(obj_message);
609}
610
611/**************************************************/
612
613static void
614_call_fn(Edje * ed, const char *fname, Embryo_Function fn)
615{
616 int ret;
617
618 ret = embryo_program_run(ed->collection->script, fn);
619 if (ret == EMBRYO_PROGRAM_FAIL)
620 {
621 ERR("ERROR with embryo script. "
622 "OBJECT NAME: '%s', "
623 "OBJECT FILE: '%s', "
624 "ENTRY POINT: '%s', "
625 "ERROR: '%s'",
626 ed->collection->part,
627 ed->file->path,
628 fname,
629 embryo_error_string_get(embryo_program_error_get(ed->collection->script)));
630 }
631 else if (ret == EMBRYO_PROGRAM_TOOLONG)
632 {
633 ERR("ERROR with embryo script. "
634 "OBJECT NAME: '%s', "
635 "OBJECT FILE: '%s', "
636 "ENTRY POINT: '%s', "
637 "ERROR: 'Script exceeded maximum allowed cycle count of %i'",
638 ed->collection->part,
639 ed->file->path,
640 fname,
641 embryo_program_max_cycle_run_get(ed->collection->script));
642 }
643}
diff --git a/libraries/edje/src/lib/edje_smart.c b/libraries/edje/src/lib/edje_smart.c
new file mode 100644
index 0000000..59ccc46
--- /dev/null
+++ b/libraries/edje/src/lib/edje_smart.c
@@ -0,0 +1,336 @@
1#include "edje_private.h"
2
3static void _edje_smart_add(Evas_Object * obj);
4static void _edje_smart_del(Evas_Object * obj);
5static void _edje_smart_move(Evas_Object * obj, Evas_Coord x, Evas_Coord y);
6static void _edje_smart_resize(Evas_Object * obj, Evas_Coord w, Evas_Coord h);
7static void _edje_smart_show(Evas_Object * obj);
8static void _edje_smart_hide(Evas_Object * obj);
9static void _edje_smart_calculate(Evas_Object * obj);
10
11static Eina_Bool _edje_smart_file_set(Evas_Object *obj, const char *file, const char *group);
12
13static Edje_Smart_Api _edje_smart_class = EDJE_SMART_API_INIT_NAME_VERSION("edje");
14static Evas_Smart_Class _edje_smart_parent;
15static Evas_Smart *_edje_smart = NULL;
16
17Eina_List *_edje_edjes = NULL;
18
19/************************** API Routines **************************/
20
21EAPI Evas_Object *
22edje_object_add(Evas *evas)
23{
24 Evas_Object *e;
25
26 _edje_lib_ref();
27
28 if (!_edje_smart)
29 {
30 memset(&_edje_smart_parent, 0, sizeof(_edje_smart_parent));
31 _edje_object_smart_set(&_edje_smart_class);
32 _edje_smart =
33 evas_smart_class_new((Evas_Smart_Class *)&_edje_smart_class);
34 }
35
36 e = evas_object_smart_add(evas, _edje_smart);
37
38 return e;
39}
40
41void
42_edje_object_smart_set(Edje_Smart_Api *sc)
43{
44 if (!sc)
45 return;
46
47 evas_object_smart_clipped_smart_set(&sc->base);
48
49 _edje_smart_parent.add = sc->base.add; /* Save parent class */
50 sc->base.add = _edje_smart_add;
51 _edje_smart_parent.del = sc->base.del; /* Save parent class */
52 sc->base.del = _edje_smart_del;
53 /* we'll handle move thank you */
54 sc->base.move = _edje_smart_move;
55 sc->base.resize = _edje_smart_resize;
56 _edje_smart_parent.show = sc->base.show; /* Save parent class */
57 sc->base.show = _edje_smart_show;
58 _edje_smart_parent.hide = sc->base.hide; /* Save parent class */
59 sc->base.hide = _edje_smart_hide;
60 sc->base.calculate = _edje_smart_calculate;
61 //sc->base.member_add = NULL;
62 //sc->base.member_del = NULL;
63 sc->file_set = _edje_smart_file_set;
64}
65
66const Edje_Smart_Api *
67_edje_object_smart_class_get(void)
68{
69 static const Edje_Smart_Api *class = NULL;
70
71 if (class)
72 return class;
73
74 _edje_object_smart_set(&_edje_smart_class);
75 class = &_edje_smart_class;
76
77 return class;
78}
79
80/* Private Routines */
81static void
82_edje_smart_add(Evas_Object *obj)
83{
84 Edje *ed;
85 Evas *tev = evas_object_evas_get(obj);
86
87 evas_event_freeze(tev);
88 ed = evas_object_smart_data_get(obj);
89 if (!ed)
90 {
91 const Evas_Smart *smart;
92 const Evas_Smart_Class *sc;
93
94 ed = calloc(1, sizeof(Edje));
95 if (!ed) goto end_smart_add;
96
97 smart = evas_object_smart_smart_get(obj);
98 sc = evas_smart_class_get(smart);
99 ed->api = (const Edje_Smart_Api *)sc;
100
101 evas_object_smart_data_set(obj, ed);
102 }
103
104 ed->base.evas = evas_object_evas_get(obj);
105 ed->base.clipper = evas_object_rectangle_add(ed->base.evas);
106 evas_object_static_clip_set(ed->base.clipper, 1);
107 evas_object_smart_member_add(ed->base.clipper, obj);
108 evas_object_color_set(ed->base.clipper, 255, 255, 255, 255);
109 evas_object_move(ed->base.clipper, -10000, -10000);
110 evas_object_resize(ed->base.clipper, 20000, 20000);
111 evas_object_pass_events_set(ed->base.clipper, 1);
112 ed->is_rtl = EINA_FALSE;
113 ed->have_objects = 1;
114 ed->references = 1;
115
116 evas_object_geometry_get(obj, &(ed->x), &(ed->y), &(ed->w), &(ed->h));
117 ed->obj = obj;
118 _edje_edjes = eina_list_append(_edje_edjes, obj);
119 /*
120 {
121 Eina_List *l;
122 const void *data;
123
124 printf("--- EDJE DUMP [%i]\n", eina_list_count(_edje_edjes));
125 EINA_LIST_FOREACH(_edge_edges, l, data)
126 {
127 ed = _edje_fetch(data);
128 printf("EDJE: %80s | %80s\n", ed->path, ed->part);
129 }
130 printf("--- EDJE DUMP [%i]\n", eina_list_count(_edje_edjes));
131 }
132 */
133end_smart_add:
134 evas_event_thaw(tev);
135 evas_event_thaw_eval(tev);
136}
137
138static void
139_edje_smart_del(Evas_Object * obj)
140{
141 Edje *ed;
142
143 ed = evas_object_smart_data_get(obj);
144 if (!ed) return;
145 _edje_block_violate(ed);
146 ed->delete_me = 1;
147 _edje_edjes = eina_list_remove(_edje_edjes, obj);
148 evas_object_smart_data_set(obj, NULL);
149 if (_edje_script_only(ed)) _edje_script_only_shutdown(ed);
150 if (_edje_lua_script_only(ed)) _edje_lua_script_only_shutdown(ed);
151 if (ed->persp) edje_object_perspective_set(obj, NULL);
152 _edje_file_del(ed);
153 _edje_clean_objects(ed);
154 _edje_unref(ed);
155 _edje_lib_unref();
156}
157
158static void
159_edje_smart_move(Evas_Object * obj, Evas_Coord x, Evas_Coord y)
160{
161 Edje *ed;
162
163 ed = evas_object_smart_data_get(obj);
164 if (!ed) return;
165 if ((ed->x == x) && (ed->y == y)) return;
166 ed->x = x;
167 ed->y = y;
168// evas_object_move(ed->clipper, ed->x, ed->y);
169
170 if (_edje_script_only(ed))
171 {
172 _edje_script_only_move(ed);
173 return;
174 }
175 if (_edje_lua_script_only(ed))
176 {
177 _edje_lua_script_only_move(ed);
178 return;
179 }
180
181 if (ed->have_mapped_part)
182 {
183 ed->dirty = 1;
184 _edje_recalc_do(ed);
185 }
186 else
187 {
188 unsigned int i;
189
190 for (i = 0; i < ed->table_parts_size; i++)
191 {
192 Edje_Real_Part *ep;
193 Evas_Coord ox, oy;
194
195 ep = ed->table_parts[i];
196 evas_object_geometry_get(ep->object, &ox, &oy, NULL, NULL);
197 evas_object_move(ep->object, ed->x + ep->x + ep->text.offset.x, ed->y + ep->y + ep->text.offset.y);
198 if (ep->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
199 _edje_entry_real_part_configure(ep);
200 if (ep->swallowed_object)
201 {
202 evas_object_geometry_get(ep->swallowed_object, &ox, &oy, NULL, NULL);
203 evas_object_move(ep->swallowed_object, ed->x + ep->x + ep->text.offset.x, ed->y + ep->y + ep->text.offset.y);
204 }
205 }
206 }
207// _edje_emit(ed, "move", NULL);
208}
209
210static void
211_edje_limit_emit(Edje *ed, const char *limit_name, Eina_Bool over)
212{
213 char *buffer;
214 unsigned int length;
215
216 if (!limit_name) return ;
217
218 length = strlen(limit_name) + 13;
219 buffer = alloca(length);
220 snprintf(buffer, length, "limit,%s,%s", limit_name, over ? "over" : "below");
221 _edje_emit(ed, buffer, NULL);
222}
223
224static void
225_edje_limit_get(Edje *ed, Edje_Limit **limits, unsigned int length, Evas_Coord size_current, Evas_Coord size_next)
226{
227 unsigned int i;
228
229 if (size_next == size_current) return ;
230
231 for (i = 0; i < length; ++i)
232 {
233 if ((size_current <= limits[i]->value) && (limits[i]->value < size_next))
234 {
235 _edje_limit_emit(ed, limits[i]->name, EINA_TRUE);
236 }
237 else if ((size_next <= limits[i]->value) && (limits[i]->value < size_current))
238 {
239 _edje_limit_emit(ed, limits[i]->name, EINA_FALSE);
240 }
241 }
242}
243
244static void
245_edje_smart_resize(Evas_Object * obj, Evas_Coord w, Evas_Coord h)
246{
247 Edje *ed;
248
249 ed = evas_object_smart_data_get(obj);
250 if (!ed) return;
251 if ((w == ed->w) && (h == ed->h)) return;
252 if (ed->collection)
253 {
254 _edje_limit_get(ed, ed->collection->limits.horizontal, ed->collection->limits.horizontal_count, ed->w, w);
255 _edje_limit_get(ed, ed->collection->limits.vertical, ed->collection->limits.vertical_count, ed->h, h);
256 }
257 ed->w = w;
258 ed->h = h;
259#ifdef EDJE_CALC_CACHE
260 ed->all_part_change = 1;
261#endif
262 if (_edje_script_only(ed))
263 {
264 _edje_script_only_resize(ed);
265 return;
266 }
267 if (_edje_lua_script_only(ed))
268 {
269 _edje_lua_script_only_resize(ed);
270 return;
271 }
272// evas_object_resize(ed->clipper, ed->w, ed->h);
273 ed->dirty = 1;
274 _edje_recalc_do(ed);
275 _edje_emit(ed, "resize", NULL);
276}
277
278static void
279_edje_smart_show(Evas_Object * obj)
280{
281 Edje *ed;
282
283 _edje_smart_parent.show(obj);
284 ed = evas_object_smart_data_get(obj);
285 if (!ed) return;
286 if (evas_object_visible_get(obj)) return;
287 if (_edje_script_only(ed))
288 {
289 _edje_script_only_show(ed);
290 return;
291 }
292 if (_edje_lua_script_only(ed))
293 {
294 _edje_lua_script_only_show(ed);
295 return;
296 }
297 _edje_emit(ed, "show", NULL);
298}
299
300static void
301_edje_smart_hide(Evas_Object * obj)
302{
303 Edje *ed;
304
305 _edje_smart_parent.hide(obj);
306 ed = evas_object_smart_data_get(obj);
307 if (!ed) return;
308 if (!evas_object_visible_get(obj)) return;
309 if (_edje_script_only(ed))
310 {
311 _edje_script_only_hide(ed);
312 return;
313 }
314 if (_edje_lua_script_only(ed))
315 {
316 _edje_lua_script_only_hide(ed);
317 return;
318 }
319 _edje_emit(ed, "hide", NULL);
320}
321
322static void
323_edje_smart_calculate(Evas_Object *obj)
324{
325 Edje *ed;
326
327 ed = evas_object_smart_data_get(obj);
328 if (!ed) return;
329 _edje_recalc_do(ed);
330}
331
332static Eina_Bool
333_edje_smart_file_set(Evas_Object *obj, const char *file, const char *group)
334{
335 return _edje_object_file_set_internal(obj, file, group, NULL, NULL);
336}
diff --git a/libraries/edje/src/lib/edje_text.c b/libraries/edje/src/lib/edje_text.c
new file mode 100644
index 0000000..01faf99
--- /dev/null
+++ b/libraries/edje/src/lib/edje_text.c
@@ -0,0 +1,790 @@
1#include "edje_private.h"
2#define _ELLIP_STR "\xE2\x80\xA6"
3
4/* returns with and height for this part.
5 *
6 * depending on the value of the use_alternate_font_metrics flag, it will
7 * either use evas_object_geometry_get() or the _advance_get() functions.
8 *
9 * The latter is useful if you want to make sure that width and height
10 * are the same value for the same number of characters in the text.
11 * This usually only makes sense for monospaced fonts.
12 *
13 * In future changes to this file, you probably should use this wrapper
14 * function everywhere instead of calling evas_object_geometry_get()
15 * directly.
16 */
17static inline void
18part_get_geometry(Edje_Real_Part *rp, Evas_Coord *w, Evas_Coord *h)
19{
20 if (!rp->part->use_alternate_font_metrics)
21 evas_object_geometry_get(rp->object, NULL, NULL, w, h);
22 else
23 {
24 if (w) *w = evas_object_text_horiz_advance_get(rp->object);
25 if (h) *h = evas_object_text_vert_advance_get(rp->object);
26 }
27}
28
29void
30_edje_text_init(void)
31{
32}
33
34void
35_edje_text_part_on_add(Edje *ed, Edje_Real_Part *ep)
36{
37 Edje_Part *pt = ep->part;
38 Edje_Part_Description_Text *desc;
39 unsigned int i;
40
41 if (ep->part->type != EDJE_PART_TYPE_TEXT) return;
42
43 /* if text class exists for this part, add the edje to the tc member list */
44 desc = (Edje_Part_Description_Text *) pt->default_desc;
45 if ((pt->default_desc) && (desc->text.text_class))
46 _edje_text_class_member_add(ed, desc->text.text_class);
47
48 /* If any other classes exist add them */
49 for (i = 0; i < pt->other.desc_count; ++i)
50 {
51 desc = (Edje_Part_Description_Text *) pt->other.desc[i];
52 if ((desc) && (desc->text.text_class))
53 _edje_text_class_member_add(ed, desc->text.text_class);
54 }
55}
56
57void
58_edje_text_part_on_del(Edje *ed, Edje_Part *pt)
59{
60 Edje_Part_Description_Text *desc;
61 unsigned int i;
62
63 if (!pt) return;
64 if (pt->type != EDJE_PART_TYPE_TEXT
65 && pt->type != EDJE_PART_TYPE_TEXTBLOCK)
66 return ;
67
68 desc = (Edje_Part_Description_Text *) pt->default_desc;
69 if ((pt->default_desc) && (desc->text.text_class))
70 _edje_text_class_member_del(ed, desc->text.text_class);
71
72 for (i = 0; i < pt->other.desc_count; ++i)
73 {
74 desc = (Edje_Part_Description_Text *) pt->other.desc[i];
75 if (desc->text.text_class)
76 _edje_text_class_member_del(ed, desc->text.text_class);
77 }
78}
79
80static void
81_edje_text_fit_set(char *buf, const char *text, int c1, int c2)
82{
83 /* helper function called from _edje_text_fit_x().
84 * note that we can use strcpy()/strcat() safely, the buffer lengths
85 * are checked in the caller.
86 */
87
88 if (c1 >= 0)
89 {
90 strcpy(buf, _ELLIP_STR);
91
92 if (c2 >= 0)
93 {
94 strncat(buf, text + c1, c2 - c1);
95 strcat(buf, _ELLIP_STR);
96 }
97 else
98 strcat(buf, text + c1);
99 }
100 else
101 {
102 if (c2 >= 0)
103 {
104 strncpy(buf, text, c2);
105 buf[c2] = 0;
106 strcat(buf, _ELLIP_STR);
107 }
108 else
109 strcpy(buf, text);
110 }
111}
112
113static const char *
114_edje_text_fit_x(Edje *ed, Edje_Real_Part *ep,
115 Edje_Calc_Params *params,
116 const char *text, const char *font, int size,
117 Evas_Coord sw, int *free_text)
118{
119 Evas_Coord tw = 0, th = 0, p;
120 int l, r;
121 int i;
122 char *buf;
123 int uc1 = -1, uc2 = -1, c1 = -1, c2 = -1;
124 int loop = 0, extra;
125 size_t orig_len;
126 FLOAT_T sc;
127
128 sc = ed->scale;
129 if (sc == ZERO) sc = _edje_scale;
130
131 *free_text = 0;
132 if (sw <= 1) return "";
133
134 if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc));
135 evas_object_text_font_set(ep->object, font, size);
136 evas_object_text_text_set(ep->object, text);
137
138 part_get_geometry(ep, &tw, &th);
139 evas_object_text_style_pad_get(ep->object, &l, &r, NULL, NULL);
140
141 p = ((sw - tw) * params->type.text.elipsis);
142
143 /* chop chop */
144 if (tw > sw)
145 {
146 if (params->type.text.elipsis != 0.0)
147 /* should be the last in text! not the rightmost */
148 uc1 = evas_object_text_last_up_to_pos(ep->object,
149 -p + l, th / 2);
150 if (params->type.text.elipsis != 1.0)
151 {
152 /* should be the last in text! not the rightmost */
153 if ((-p + sw -r) < 0)
154 uc2 = evas_object_text_last_up_to_pos(ep->object, 0, th / 2);
155 else
156 uc2 = evas_object_text_last_up_to_pos(ep->object,
157 -p + sw - r, th / 2);
158 }
159 if ((uc1 < 0) && (uc2 < 0))
160 {
161 uc1 = 0;
162 uc2 = 0;
163 }
164 }
165
166 if (!(((uc1 >= 0) || (uc2 >= 0)) && (tw > sw)))
167 return text;
168
169 if ((uc1 == 0) && (uc2 == 0))
170 return text;
171
172 orig_len = strlen(text);
173
174 /* don't overflow orig_len by adding extra
175 * FIXME: we might want to set a max string length somewhere...
176 */
177 extra = 1 + 3 + 3; /* terminator, leading and trailing ellipsis */
178 orig_len = MIN(orig_len, ((size_t) 8192 - extra));
179
180 if (!(buf = malloc(orig_len + extra)))
181 return text;
182
183 /* Convert uc1, uc2 -> c1, c2 */
184 i = 0;
185 if (uc1 >= 0)
186 {
187 c1 = 0;
188 for ( ; i < uc1 ; i++)
189 {
190 c1 = evas_string_char_next_get(text, c1, NULL);
191 }
192 }
193 if (uc2 >= 0)
194 {
195 if (c1 >= 0)
196 {
197 c2 = c1;
198 }
199 else
200 {
201 c2 = 0;
202 }
203 for ( ; i < uc2 ; i++)
204 {
205 c2 = evas_string_char_next_get(text, c2, NULL);
206 }
207 }
208
209 buf[0] = '\0';
210
211 while (((c1 >= 0) || (c2 >= 0)) && (tw > sw))
212 {
213 loop++;
214 if (sw <= 0.0)
215 {
216 buf[0] = 0;
217 break;
218 }
219 if ((c1 >= 0) && (c2 >= 0))
220 {
221 if ((loop & 0x1))
222 {
223 if (c1 >= 0)
224 c1 = evas_string_char_next_get(text, c1, NULL);
225 }
226 else
227 {
228 if (c2 >= 0)
229 {
230 c2 = evas_string_char_prev_get(text, c2, NULL);
231 if (c2 < 0)
232 {
233 buf[0] = 0;
234 break;
235 }
236 }
237 }
238 }
239 else
240 {
241 if (c1 >= 0)
242 c1 = evas_string_char_next_get(text, c1, NULL);
243 else if (c2 >= 0)
244 {
245 c2 = evas_string_char_prev_get(text, c2, NULL);
246 if (c2 < 0)
247 {
248 buf[0] = 0;
249 break;
250 }
251 }
252 }
253 if ((c1 >= 0) && (c2 >= 0))
254 {
255 if (c1 >= c2)
256 {
257 buf[0] = 0;
258 break;
259 }
260 }
261 else if ((c1 > 0 && (size_t) c1 >= orig_len) || c2 == 0)
262 {
263 buf[0] = 0;
264 break;
265 }
266
267 buf[0] = 0;
268
269 _edje_text_fit_set(buf, text, c1, c2);
270
271 evas_object_text_text_set(ep->object, buf);
272 part_get_geometry(ep, &tw, &th);
273 }
274
275 *free_text = 1;
276
277 return buf;
278}
279
280static const char *
281_edje_text_font_get(const char *base, const char *new, char **free_later)
282{
283 const char *base_style, *new_style, *aux;
284 size_t font_len, style_len;
285
286 if (base && (!new))
287 return base;
288 else if (!base)
289 return new;
290
291 base_style = strstr(base, ":style=");
292 if (!base_style)
293 return new;
294
295 new_style = strstr(new, ":style=");
296 if (new_style)
297 return new;
298
299 font_len = strlen(new);
300 aux = strchr(base_style, ',');
301 style_len = (aux) ? (size_t)(aux - base_style) : strlen(base_style);
302
303 *free_later = malloc(font_len + style_len + 1);
304 memcpy(*free_later, new, font_len);
305 memcpy(*free_later + font_len, base_style, style_len);
306 (*free_later)[font_len + style_len] = '\0';
307
308 return *free_later;
309}
310
311const char *
312_edje_text_class_font_get(Edje *ed, Edje_Part_Description_Text *chosen_desc, int *size, char **free_later)
313{
314 Edje_Text_Class *tc;
315 const char *text_class_name, *font;
316
317 font = edje_string_get(&chosen_desc->text.font);
318 *size = chosen_desc->text.size;
319
320 text_class_name = chosen_desc->text.text_class;
321 if ((!text_class_name) || (!text_class_name[0]))
322 return font;
323
324 tc = _edje_text_class_find(ed, text_class_name);
325 if (!tc)
326 return font;
327
328 font = _edje_text_font_get(edje_string_get(&chosen_desc->text.font), tc->font, free_later);
329 *size = _edje_text_size_calc(*size, tc);
330
331 return font;
332}
333
334void
335_edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
336 Edje_Calc_Params *params,
337 Edje_Part_Description_Text *chosen_desc)
338{
339 const char *text = NULL;
340 const char *font;
341 char *font2 = NULL;
342 char *sfont = NULL;
343 int size;
344 Evas_Coord tw, th;
345 Evas_Coord sw, sh;
346 int inlined_font = 0, free_text = 0;
347 Eina_Bool same_text = EINA_FALSE;
348 FLOAT_T sc;
349
350 sc = ed->scale;
351 if (sc == 0.0) sc = _edje_scale;
352 text = edje_string_get(&chosen_desc->text.text);
353 font = _edje_text_class_font_get(ed, chosen_desc, &size, &sfont);
354
355 if (ep->text.text) text = ep->text.text;
356 if (ep->text.font) font = ep->text.font;
357 if (ep->text.size > 0) size = ep->text.size;
358
359 if (ep->text.text_source)
360 {
361 text = edje_string_get(&(((Edje_Part_Description_Text *)ep->text.text_source->chosen_description)->text.text));
362 if (ep->text.text_source->text.text) text = ep->text.text_source->text.text;
363 }
364 if (ep->text.source)
365 {
366 font = edje_string_get(&(((Edje_Part_Description_Text *)ep->text.source->chosen_description)->text.font));
367 size = ((Edje_Part_Description_Text *)ep->text.source->chosen_description)->text.size;
368 if (ep->text.source->text.font) font = ep->text.source->text.font;
369 if (ep->text.source->text.size > 0) size = ep->text.source->text.size;
370 }
371
372 if (!text) text = "";
373 if (!font) font = "";
374
375 /* check if the font is embedded in the .eet */
376 if (ed->file->fonts)
377 {
378 Edje_Font_Directory_Entry *fnt = eina_hash_find(ed->file->fonts, font);
379
380 if (fnt)
381 {
382 size_t len = strlen(font) + sizeof("edje/fonts/") + 1;
383 font2 = alloca(len);
384 sprintf(font2, "edje/fonts/%s", font);
385 font = font2;
386 inlined_font = 1;
387 font2 = NULL;
388 }
389 }
390
391 if ((_edje_fontset_append) && (font))
392 {
393 font2 = malloc(strlen(font) + 1 + strlen(_edje_fontset_append) + 1);
394 if (font2)
395 {
396 strcpy(font2, font);
397 strcat(font2, ",");
398 strcat(font2, _edje_fontset_append);
399 font = font2;
400 }
401 }
402 {
403 int l, r, t, b;
404
405 evas_object_text_style_pad_get(ep->object, &l, &r, &t, &b);
406 sw = params->w;
407 sh = params->h;
408 }
409
410 size = params->type.text.size;
411 if (!text) text = "";
412
413 if ((text == ep->text.cache.in_str)
414 || (text && ep->text.cache.in_str && !strcmp(ep->text.cache.in_str, text)))
415 {
416 text = ep->text.cache.in_str;
417 same_text = EINA_TRUE;
418 }
419
420 if ((ep->text.cache.in_size == size) &&
421 (ep->text.cache.in_w == sw) &&
422 (ep->text.cache.in_h == sh) &&
423 (ep->text.cache.in_str) &&
424 same_text &&
425 (ep->text.cache.align_x == params->type.text.align.x) &&
426 (ep->text.cache.align_y == params->type.text.align.y) &&
427 (ep->text.cache.elipsis == params->type.text.elipsis) &&
428 (ep->text.cache.fit_x == chosen_desc->text.fit_x) &&
429 (ep->text.cache.fit_y == chosen_desc->text.fit_y))
430 {
431 text = ep->text.cache.out_str;
432 size = ep->text.cache.out_size;
433
434 goto arrange_text;
435 }
436 if (!same_text)
437 {
438 eina_stringshare_replace(&ep->text.cache.in_str, text);
439 }
440 ep->text.cache.in_size = size;
441 if (chosen_desc->text.fit_x && (ep->text.cache.in_str && eina_stringshare_strlen(ep->text.cache.in_str) > 0))
442 {
443 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
444 else evas_object_text_font_source_set(ep->object, NULL);
445
446 if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc));
447 evas_object_text_font_set(ep->object, font, size);
448 evas_object_text_text_set(ep->object, text);
449 part_get_geometry(ep, &tw, &th);
450 /* Find the wanted font size */
451 if ((tw != sw) && (size > 0) && (tw != 0))
452 {
453 size = (size * sw) / tw;
454
455 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
456 else evas_object_text_font_source_set(ep->object, NULL);
457
458 if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc));
459 evas_object_text_font_set(ep->object, font, size);
460 part_get_geometry(ep, &tw, &th);
461 }
462
463 /* FIXME: This should possibly be replaced by more proper handling,
464 * but it's still way better than what was here before. */
465 if (tw > sw) size--;
466 }
467 if (chosen_desc->text.fit_y && (ep->text.cache.in_str && eina_stringshare_strlen(ep->text.cache.in_str) > 0))
468 {
469 /* if we fit in the x axis, too, size already has a somewhat
470 * meaningful value, so don't overwrite it with the starting
471 * value in that case
472 */
473 if (!chosen_desc->text.fit_x) size = sh;
474
475 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
476 else evas_object_text_font_source_set(ep->object, NULL);
477
478 if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc));
479 evas_object_text_font_set(ep->object, font, size);
480 evas_object_text_text_set(ep->object, text);
481 part_get_geometry(ep, &tw, &th);
482
483 /* only grow the font size if we didn't already reach the max size
484 * for the x axis
485 */
486 if (!chosen_desc->text.fit_x && th < sh)
487 {
488 int dif;
489
490 dif = (th - sh) / 4;
491 if (dif < 1) dif = 1;
492 while ((th < sh) && (sw > 0))
493 {
494 size += dif;
495 if (size <= 0) break;
496 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
497 else evas_object_text_font_source_set(ep->object, NULL);
498
499 if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc));
500 evas_object_text_font_set(ep->object, font, size);
501 part_get_geometry(ep, &tw, &th);
502 if ((size > 0) && (th == 0)) break;
503 }
504 size -= dif;
505 }
506 else if (th > sh)
507 {
508 int current;
509
510 if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc));
511 evas_object_text_font_set(ep->object, font, 10);
512 part_get_geometry(ep, &tw, &th);
513
514 if (th == sh)
515 current = 10;
516 else
517 {
518 int bottom, top;
519
520 if (th < sh) bottom = 10;
521 else if (th > sh) bottom = 1;
522 else bottom = 0; /* XXX shut up GCC, th == sh is handled before! */
523
524 top = size;
525 /* search one that fits (binary search) */
526 do
527 {
528 current = (top + bottom) / 2;
529
530 if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc));
531 evas_object_text_font_set(ep->object, font, current);
532 part_get_geometry(ep, &tw, &th);
533
534 if (th < sh) bottom = current + 1;
535 else if (th > sh) top = current - 1;
536 } while ((bottom < top) && (th != sh));
537 }
538
539 /* search the larger one that fits (linear search) */
540 do
541 {
542 current++;
543
544 if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc));
545 evas_object_text_font_set(ep->object, font, current);
546 part_get_geometry(ep, &tw, &th);
547 } while (th <= sh);
548 size = current - 1;
549 }
550 }
551
552 /* Make sure the size is in range */
553 if (size < 1)
554 size = 1;
555 else if ((size > chosen_desc->text.size_range_max) &&
556 (chosen_desc->text.size_range_max > 0))
557 size = chosen_desc->text.size_range_max;
558 else if (size < chosen_desc->text.size_range_min)
559 size = chosen_desc->text.size_range_min;
560
561 /* Handle ellipsis */
562 if (!chosen_desc->text.min_x)
563 {
564 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
565 else evas_object_text_font_source_set(ep->object, NULL);
566
567 text = _edje_text_fit_x(ed, ep, params, text, font, size, sw, &free_text);
568 }
569
570 eina_stringshare_replace(&ep->text.cache.out_str, text);
571 ep->text.cache.in_w = sw;
572 ep->text.cache.in_h = sh;
573 ep->text.cache.out_size = size;
574 ep->text.cache.align_x = params->type.text.align.x;
575 ep->text.cache.align_y = params->type.text.align.y;
576 ep->text.cache.elipsis = params->type.text.elipsis;
577 ep->text.cache.fit_x = chosen_desc->text.fit_x;
578 ep->text.cache.fit_y = chosen_desc->text.fit_y;
579 arrange_text:
580
581 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
582 else evas_object_text_font_source_set(ep->object, NULL);
583
584 if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc));
585 evas_object_text_font_set(ep->object, font, size);
586 evas_object_text_text_set(ep->object, text);
587 part_get_geometry(ep, &tw, &th);
588 /* Handle alignment */
589 {
590 double align_x;
591 if (params->type.text.align.x < 0.0)
592 {
593 if (evas_object_text_direction_get(ep->object) ==
594 EVAS_BIDI_DIRECTION_RTL)
595 {
596 align_x = 1.0;
597 }
598 else
599 {
600 align_x = 0.0;
601 }
602 }
603 else
604 {
605 align_x = params->type.text.align.x;
606 }
607 ep->text.offset.x = TO_INT(SCALE(align_x, (sw - tw)));
608 ep->text.offset.y = TO_INT(SCALE(params->type.text.align.y, (sh - th)));
609 }
610
611 evas_object_move(ep->object,
612 ed->x + params->x + ep->text.offset.x,
613 ed->y + params->y + ep->text.offset.y);
614
615 if (params->visible) evas_object_show(ep->object);
616 else evas_object_hide(ep->object);
617 {
618 Evas_Text_Style_Type style;
619 Edje_Text_Effect effect;
620
621 style = EVAS_TEXT_STYLE_PLAIN;
622
623 evas_object_color_set(ep->object,
624 (params->color.r * params->color.a) / 255,
625 (params->color.g * params->color.a) / 255,
626 (params->color.b * params->color.a) / 255,
627 params->color.a);
628 effect = ep->part->effect;
629 switch (effect & EDJE_TEXT_EFFECT_MASK_BASIC)
630 {
631 case EDJE_TEXT_EFFECT_NONE:
632 case EDJE_TEXT_EFFECT_PLAIN:
633 style = EVAS_TEXT_STYLE_PLAIN;
634 break;
635 case EDJE_TEXT_EFFECT_OUTLINE:
636 style = EVAS_TEXT_STYLE_OUTLINE;
637 evas_object_text_outline_color_set(ep->object,
638 (params->type.text.color2.r * params->type.text.color2.a) / 255,
639 (params->type.text.color2.g * params->type.text.color2.a) / 255,
640 (params->type.text.color2.b * params->type.text.color2.a) / 255,
641 params->type.text.color2.a);
642 break;
643 case EDJE_TEXT_EFFECT_SOFT_OUTLINE:
644 style = EVAS_TEXT_STYLE_SOFT_OUTLINE;
645 evas_object_text_outline_color_set(ep->object,
646 (params->type.text.color2.r * params->type.text.color2.a) / 255,
647 (params->type.text.color2.g * params->type.text.color2.a) / 255,
648 (params->type.text.color2.b * params->type.text.color2.a) / 255,
649 params->type.text.color2.a);
650 break;
651 case EDJE_TEXT_EFFECT_SHADOW:
652 style = EVAS_TEXT_STYLE_SHADOW;
653 evas_object_text_shadow_color_set(ep->object,
654 (params->type.text.color3.r * params->type.text.color3.a) / 255,
655 (params->type.text.color3.g * params->type.text.color3.a) / 255,
656 (params->type.text.color3.b * params->type.text.color3.a) / 255,
657 params->type.text.color3.a);
658 break;
659 case EDJE_TEXT_EFFECT_SOFT_SHADOW:
660 style = EVAS_TEXT_STYLE_SOFT_SHADOW;
661 evas_object_text_shadow_color_set(ep->object,
662 (params->type.text.color3.r * params->type.text.color3.a) / 255,
663 (params->type.text.color3.g * params->type.text.color3.a) / 255,
664 (params->type.text.color3.b * params->type.text.color3.a) / 255,
665 params->type.text.color3.a);
666 break;
667 case EDJE_TEXT_EFFECT_OUTLINE_SHADOW:
668 style = EVAS_TEXT_STYLE_OUTLINE_SHADOW;
669 evas_object_text_outline_color_set(ep->object,
670 (params->type.text.color2.r * params->type.text.color2.a) / 255,
671 (params->type.text.color2.g * params->type.text.color2.a) / 255,
672 (params->type.text.color2.b * params->type.text.color2.a) / 255,
673 params->type.text.color2.a);
674 evas_object_text_shadow_color_set(ep->object,
675 (params->type.text.color3.r * params->type.text.color3.a) / 255,
676 (params->type.text.color3.g * params->type.text.color3.a) / 255,
677 (params->type.text.color3.b * params->type.text.color3.a) / 255,
678 params->type.text.color3.a);
679 break;
680 case EDJE_TEXT_EFFECT_OUTLINE_SOFT_SHADOW:
681 style = EVAS_TEXT_STYLE_OUTLINE_SOFT_SHADOW;
682 evas_object_text_outline_color_set(ep->object,
683 (params->type.text.color2.r * params->type.text.color2.a) / 255,
684 (params->type.text.color2.g * params->type.text.color2.a) / 255,
685 (params->type.text.color2.b * params->type.text.color2.a) / 255,
686 params->type.text.color2.a);
687 evas_object_text_shadow_color_set(ep->object,
688 (params->type.text.color3.r * params->type.text.color3.a) / 255,
689 (params->type.text.color3.g * params->type.text.color3.a) / 255,
690 (params->type.text.color3.b * params->type.text.color3.a) / 255,
691 params->type.text.color3.a);
692 break;
693 case EDJE_TEXT_EFFECT_FAR_SHADOW:
694 style = EVAS_TEXT_STYLE_FAR_SHADOW;
695 evas_object_text_shadow_color_set(ep->object,
696 (params->type.text.color3.r * params->type.text.color3.a) / 255,
697 (params->type.text.color3.g * params->type.text.color3.a) / 255,
698 (params->type.text.color3.b * params->type.text.color3.a) / 255,
699 params->type.text.color3.a);
700 break;
701 case EDJE_TEXT_EFFECT_FAR_SOFT_SHADOW:
702 style = EVAS_TEXT_STYLE_FAR_SOFT_SHADOW;
703 evas_object_text_shadow_color_set(ep->object,
704 (params->type.text.color3.r * params->type.text.color3.a) / 255,
705 (params->type.text.color3.g * params->type.text.color3.a) / 255,
706 (params->type.text.color3.b * params->type.text.color3.a) / 255,
707 params->type.text.color3.a);
708 break;
709 case EDJE_TEXT_EFFECT_GLOW:
710 style = EVAS_TEXT_STYLE_GLOW;
711 evas_object_text_glow_color_set(ep->object,
712 (params->type.text.color2.r * params->type.text.color2.a) / 255,
713 (params->type.text.color2.g * params->type.text.color2.a) / 255,
714 (params->type.text.color2.b * params->type.text.color2.a) / 255,
715 params->type.text.color2.a);
716 evas_object_text_glow2_color_set(ep->object,
717 (params->type.text.color3.r * params->type.text.color3.a) / 255,
718 (params->type.text.color3.g * params->type.text.color3.a) / 255,
719 (params->type.text.color3.b * params->type.text.color3.a) / 255,
720 params->type.text.color3.a);
721 break;
722 default:
723 style = EVAS_TEXT_STYLE_PLAIN;
724 break;
725 }
726
727 switch (effect & EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION)
728 {
729 case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_RIGHT:
730 EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET
731 (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT);
732 break;
733 case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM:
734 EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET
735 (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM);
736 break;
737 case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_LEFT:
738 EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET
739 (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_LEFT);
740 break;
741 case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_LEFT:
742 EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET
743 (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_LEFT);
744 break;
745 case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP_LEFT:
746 EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET
747 (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_LEFT);
748 break;
749 case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP:
750 EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET
751 (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP);
752 break;
753 case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP_RIGHT:
754 EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET
755 (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT);
756 break;
757 case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_RIGHT:
758 EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET
759 (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_RIGHT);
760 break;
761 default:
762 break;
763 }
764 evas_object_text_style_set(ep->object, style);
765 }
766
767 if (free_text) free((char *)text);
768 if (font2) free(font2);
769 if (sfont) free(sfont);
770}
771
772Evas_Font_Size
773_edje_text_size_calc(Evas_Font_Size size, Edje_Text_Class *tc)
774{
775 int val;
776
777 if (tc->size == 0)
778 {
779 val = size;
780 }
781 else if (tc->size > 0.0)
782 {
783 val = tc->size;
784 }
785 else
786 {
787 val = (size * -tc->size) / 100;
788 }
789 return val;
790}
diff --git a/libraries/edje/src/lib/edje_textblock_styles.c b/libraries/edje/src/lib/edje_textblock_styles.c
new file mode 100644
index 0000000..13a68ad
--- /dev/null
+++ b/libraries/edje/src/lib/edje_textblock_styles.c
@@ -0,0 +1,424 @@
1#include "edje_private.h"
2
3static int
4_edje_font_is_embedded(Edje_File *edf, char *font)
5{
6 if (!eina_hash_find(edf->fonts, font)) return 0;
7 return 1;
8}
9
10static void
11_edje_format_param_parse(char *item, char **key, char **val)
12{
13 char *p, *k, *v;
14
15 p = strchr(item, '=');
16 k = malloc(p - item + 1);
17 strncpy(k, item, p - item);
18 k[p - item] = 0;
19 *key = k;
20 p++;
21 v = strdup(p);
22 *val = v;
23}
24
25static char *
26_edje_format_parse(const char **s)
27{
28 char *item, *ds;
29 const char *p, *ss;
30 const char *s1 = NULL;
31 const char *s2 = NULL;
32
33 p = *s;
34 if ((!p) || (*p == 0)) return NULL;
35 for (;;)
36 {
37 if (!s1)
38 {
39 if (*p != ' ') s1 = p;
40 if (*p == 0) break;
41 }
42 else if (!s2)
43 {
44 if ((p > *s) && (p[-1] != '\\'))
45 {
46 if (*p == ' ') s2 = p;
47 }
48 if (*p == 0) s2 = p;
49 }
50 p++;
51 if (s1 && s2)
52 {
53 item = malloc(s2 - s1 + 1);
54 if (item)
55 {
56 for (ds = item, ss = s1; ss < s2; ss++, ds++)
57 {
58 if ((*ss == '\\') && (ss < (s2 - 1))) ss++;
59 *ds = *ss;
60 }
61 *ds = 0;
62 }
63 *s = s2;
64 return item;
65 }
66 }
67 *s = p;
68 return NULL;
69}
70
71static int
72_edje_format_is_param(char *item)
73{
74 if (strchr(item, '=')) return 1;
75 return 0;
76}
77
78static char *
79_edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag **tag_ret)
80{
81 Eina_Strbuf *txt, *tmp = NULL;
82 char *s2, *item, *ret;
83 const char *s;
84
85 txt = eina_strbuf_new();
86 s = str;
87 while ((item = _edje_format_parse(&s)))
88 {
89 if (_edje_format_is_param(item))
90 {
91 char *key = NULL, *val = NULL;
92
93 _edje_format_param_parse(item, &key, &val);
94 if (!strcmp(key, "font_source"))
95 {
96 /* dont allow font sources */
97 }
98 else if (!strcmp(key, "text_class"))
99 {
100 if (tag_ret)
101 (*tag_ret)->text_class = eina_stringshare_add(val);
102 }
103 else if (!strcmp(key, "font_size"))
104 {
105 if (tag_ret)
106 (*tag_ret)->font_size = atof(val);
107 }
108 else if (!strcmp(key, "font")) /* Fix fonts */
109 {
110 if (tag_ret)
111 {
112 if (_edje_font_is_embedded(edf, val))
113 {
114 if (!tmp)
115 tmp = eina_strbuf_new();
116 eina_strbuf_append(tmp, "edje/fonts/");
117 eina_strbuf_append(tmp, val);
118 (*tag_ret)->font = eina_stringshare_add(eina_strbuf_string_get(tmp));
119 eina_strbuf_reset(tmp);
120 }
121 else
122 {
123 (*tag_ret)->font = eina_stringshare_add(val);
124 }
125 }
126 }
127 else /* Otherwise add to tag buffer */
128 {
129 s2 = eina_str_escape(item);
130 if (s2)
131 {
132 if (eina_strbuf_length_get(txt)) eina_strbuf_append(txt, " ");
133 eina_strbuf_append(txt, s2);
134 free(s2);
135 }
136 }
137 free(key);
138 free(val);
139 }
140 else
141 {
142 if (eina_strbuf_length_get(txt)) eina_strbuf_append(txt, " ");
143 eina_strbuf_append(txt, item);
144 }
145 free(item);
146 }
147 if (tmp)
148 eina_strbuf_free(tmp);
149 ret = eina_strbuf_string_steal(txt);
150 eina_strbuf_free(txt);
151 return ret;
152}
153
154/* Update all evas_styles which are in an edje
155 *
156 * @param ed The edje containing styles which need to be updated
157 */
158void
159_edje_textblock_style_all_update(Edje *ed)
160{
161 Eina_List *l, *ll;
162 Edje_Style *stl;
163 Eina_Strbuf *txt = NULL;
164
165 if (!ed->file) return;
166
167 EINA_LIST_FOREACH(ed->file->styles, l, stl)
168 {
169 Edje_Style_Tag *tag;
170 Edje_Text_Class *tc;
171 int found = 0;
172 char *fontset = NULL, *fontsource = NULL;
173
174 /* Make sure the style is already defined */
175 if (!stl->style) break;
176
177 /* Make sure the style contains a text_class */
178 EINA_LIST_FOREACH(stl->tags, ll, tag)
179 if (tag->text_class) found = 1;
180
181 /* No text classes , goto next style */
182 if (!found) continue;
183 found = 0;
184 if (!txt)
185 txt = eina_strbuf_new();
186
187 if (_edje_fontset_append)
188 fontset = eina_str_escape(_edje_fontset_append);
189 fontsource = eina_str_escape(ed->file->path);
190
191 /* Build the style from each tag */
192 EINA_LIST_FOREACH(stl->tags, ll, tag)
193 {
194 if (!tag->key) continue;
195
196 /* Add Tag Key */
197 eina_strbuf_append(txt, tag->key);
198 eina_strbuf_append(txt, "='");
199
200 /* Configure fonts from text class if it exists */
201 if ((tc = _edje_text_class_find(ed, tag->text_class)))
202 {
203 /* Only update if not clearing, If clear leave it at zero */
204 if (tc->font) found = 1;
205 }
206
207 /* Add and Ha`ndle tag parsed data */
208 eina_strbuf_append(txt, tag->value);
209
210 if (!strcmp(tag->key, "DEFAULT"))
211 {
212 if (fontset)
213 {
214 eina_strbuf_append(txt, " ");
215 eina_strbuf_append(txt, "font_fallbacks=");
216 eina_strbuf_append(txt, fontset);
217 }
218 eina_strbuf_append(txt, " ");
219 eina_strbuf_append(txt, "font_source=");
220 eina_strbuf_append(txt, fontsource);
221 }
222 if (tag->font_size != 0)
223 {
224 char font_size[32];
225
226 if (found)
227 snprintf(font_size, sizeof(font_size), "%f", (double) _edje_text_size_calc(tag->font_size, tc));
228 else
229 snprintf(font_size, sizeof(font_size), "%f", tag->font_size);
230
231 eina_strbuf_append(txt, " ");
232 eina_strbuf_append(txt, "font_size=");
233 eina_strbuf_append(txt, font_size);
234 }
235 /* Add font name last to save evas from multiple loads */
236 if (tag->font)
237 {
238 const char *f;
239
240 eina_strbuf_append(txt, " ");
241 eina_strbuf_append(txt, "font=");
242
243 f = (found) ? tc->font : tag->font;
244 eina_strbuf_append_escaped(txt, f);
245 }
246 found = 0;
247
248 eina_strbuf_append(txt, "'");
249 }
250 if (fontset) free(fontset);
251 if (fontsource) free(fontsource);
252
253 /* Configure the style */
254 evas_textblock_style_set(stl->style, eina_strbuf_string_get(txt));
255 eina_strbuf_reset(txt);
256 }
257 if (txt)
258 eina_strbuf_free(txt);
259}
260
261void
262_edje_textblock_styles_add(Edje *ed)
263{
264 Eina_List *l, *ll;
265 Edje_Style *stl;
266
267 if (!ed->file) return;
268
269 EINA_LIST_FOREACH(ed->file->styles, l, stl)
270 {
271 Edje_Style_Tag *tag;
272
273 /* Make sure the style contains the text_class */
274 EINA_LIST_FOREACH(stl->tags, ll, tag)
275 {
276 if (!tag->text_class) continue;
277 _edje_text_class_member_add(ed, tag->text_class);
278 }
279 }
280}
281
282void
283_edje_textblock_styles_del(Edje *ed)
284{
285 Eina_List *l, *ll;
286 Edje_Style *stl;
287
288 if (!ed->file) return;
289
290 EINA_LIST_FOREACH(ed->file->styles, l, stl)
291 {
292 Edje_Style_Tag *tag;
293
294 /* Make sure the style contains the text_class */
295 EINA_LIST_FOREACH(stl->tags, ll, tag)
296 {
297 if (!tag->text_class) continue;
298 _edje_text_class_member_del(ed, tag->text_class);
299 }
300 }
301}
302
303/* When we get to here the edje file had been read into memory
304 * the name of the style is established as well as the name and
305 * data for the tags. This function will create the Evas_Style
306 * object for each style. The style is composed of a base style
307 * followed by a list of tags.
308 */
309void
310_edje_textblock_style_parse_and_fix(Edje_File *edf)
311{
312 Eina_Strbuf *txt = NULL;
313 Eina_List *l, *ll;
314 Edje_Style *stl;
315
316 EINA_LIST_FOREACH(edf->styles, l, stl)
317 {
318 Edje_Style_Tag *tag;
319 char *fontset = NULL, *fontsource = NULL, *ts;
320
321 if (stl->style) break;
322
323 if (!txt)
324 txt = eina_strbuf_new();
325
326 stl->style = evas_textblock_style_new();
327 evas_textblock_style_set(stl->style, NULL);
328
329 if (_edje_fontset_append)
330 fontset = eina_str_escape(_edje_fontset_append);
331 fontsource = eina_str_escape(edf->path);
332
333 /* Build the style from each tag */
334 EINA_LIST_FOREACH(stl->tags, ll, tag)
335 {
336 if (!tag->key) continue;
337
338 /* Add Tag Key */
339 eina_strbuf_append(txt, tag->key);
340 eina_strbuf_append(txt, "='");
341
342 ts = _edje_format_reparse(edf, tag->value, &(tag));
343
344 /* Add and Handle tag parsed data */
345 if (ts)
346 {
347 if (eet_dictionary_string_check(eet_dictionary_get(edf->ef), tag->value) == 0)
348 eina_stringshare_del(tag->value);
349 tag->value = eina_stringshare_add(ts);
350 eina_strbuf_append(txt, tag->value);
351 free(ts);
352 }
353
354 if (!strcmp(tag->key, "DEFAULT"))
355 {
356 if (fontset)
357 {
358 eina_strbuf_append(txt, " ");
359 eina_strbuf_append(txt, "font_fallbacks=");
360 eina_strbuf_append(txt, fontset);
361 }
362 eina_strbuf_append(txt, " ");
363 eina_strbuf_append(txt, "font_source=");
364 eina_strbuf_append(txt, fontsource);
365 }
366 if (tag->font_size > 0)
367 {
368 char font_size[32];
369
370 snprintf(font_size, sizeof(font_size), "%f", tag->font_size);
371 eina_strbuf_append(txt, " ");
372 eina_strbuf_append(txt, "font_size=");
373 eina_strbuf_append(txt, font_size);
374 }
375 /* Add font name last to save evas from multiple loads */
376 if (tag->font)
377 {
378 eina_strbuf_append(txt, " ");
379 eina_strbuf_append(txt, "font=");
380 eina_strbuf_append_escaped(txt, tag->font);
381 }
382 eina_strbuf_append(txt, "'");
383 }
384 if (fontset) free(fontset);
385 if (fontsource) free(fontsource);
386
387 /* Configure the style */
388 evas_textblock_style_set(stl->style, eina_strbuf_string_get(txt));
389 eina_strbuf_reset(txt);
390 }
391 if (txt)
392 eina_strbuf_free(txt);
393}
394
395void
396_edje_textblock_style_cleanup(Edje_File *edf)
397{
398 while (edf->styles)
399 {
400 Edje_Style *stl;
401
402 stl = edf->styles->data;
403 edf->styles = eina_list_remove_list(edf->styles, edf->styles);
404 while (stl->tags)
405 {
406 Edje_Style_Tag *tag;
407
408 tag = stl->tags->data;
409 stl->tags = eina_list_remove_list(stl->tags, stl->tags);
410 if (edf->free_strings)
411 {
412 if (tag->key) eina_stringshare_del(tag->key);
413/* FIXME: Find a proper way to handle it. */
414 if (tag->value) eina_stringshare_del(tag->value);
415 if (tag->text_class) eina_stringshare_del(tag->text_class);
416 if (tag->font) eina_stringshare_del(tag->font);
417 }
418 free(tag);
419 }
420 if (edf->free_strings && stl->name) eina_stringshare_del(stl->name);
421 if (stl->style) evas_textblock_style_free(stl->style);
422 free(stl);
423 }
424}
diff --git a/libraries/edje/src/lib/edje_util.c b/libraries/edje/src/lib/edje_util.c
new file mode 100644
index 0000000..dbb37a7
--- /dev/null
+++ b/libraries/edje/src/lib/edje_util.c
@@ -0,0 +1,4317 @@
1#include "edje_private.h"
2
3typedef struct _Edje_Box_Layout Edje_Box_Layout;
4struct _Edje_Box_Layout
5{
6 EINA_RBTREE;
7 Evas_Object_Box_Layout func;
8 void *(*layout_data_get)(void *);
9 void (*layout_data_free)(void *);
10 void *data;
11 void (*free_data)(void *);
12 char name[];
13};
14
15static Eina_Hash *_edje_color_class_hash = NULL;
16static Eina_Hash *_edje_color_class_member_hash = NULL;
17
18static Eina_Hash *_edje_text_class_hash = NULL;
19static Eina_Hash *_edje_text_class_member_hash = NULL;
20
21static Eina_Rbtree *_edje_box_layout_registry = NULL;
22
23char *_edje_fontset_append = NULL;
24FLOAT_T _edje_scale = ZERO;
25Eina_Bool _edje_password_show_last = EINA_FALSE;
26FLOAT_T _edje_password_show_last_timeout = ZERO;
27int _edje_freeze_val = 0;
28int _edje_freeze_calc_count = 0;
29Eina_List *_edje_freeze_calc_list = NULL;
30
31typedef struct _Edje_List_Foreach_Data Edje_List_Foreach_Data;
32struct _Edje_List_Foreach_Data
33{
34 Eina_List *list;
35};
36
37typedef struct _Edje_List_Refcount Edje_List_Refcount;
38struct _Edje_List_Refcount
39{
40 EINA_REFCOUNT;
41
42 Eina_List *lookup;
43};
44
45static Eina_Bool _edje_color_class_list_foreach(const Eina_Hash *hash, const void *key, void *data, void *fdata);
46static Eina_Bool _edje_text_class_list_foreach(const Eina_Hash *hash, const void *key, void *data, void *fdata);
47static void _edje_object_image_preload_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
48static void _edje_object_signal_preload_cb(void *data, Evas_Object *obj, const char *emission, const char *source);
49
50Edje_Real_Part *_edje_real_part_recursive_get_helper(const Edje *ed, char **path);
51
52
53static void
54_edje_class_member_direct_del(const char *class, Edje_List_Refcount *lookup, Eina_Hash *hash)
55{
56 Eina_List *members;
57
58 members = eina_hash_find(hash, class);
59 members = eina_list_remove_list(members, lookup->lookup);
60 eina_hash_set(hash, class, members);
61 free(lookup);
62}
63
64static void
65_edje_class_member_add(Edje *ed, Eina_Hash **ehash, Eina_Hash **ghash, const char *class)
66{
67 Edje_List_Refcount *lookup;
68 Eina_List *members;
69
70 if ((!ed) || (!ehash) || (!ghash) || (!class)) return;
71
72 lookup = eina_hash_find(*ehash, class);
73 if (lookup)
74 {
75 EINA_REFCOUNT_REF(lookup);
76 return;
77 }
78
79 lookup = malloc(sizeof (Edje_List_Refcount));
80 if (!lookup) return ;
81 EINA_REFCOUNT_INIT(lookup);
82
83 /* Get members list */
84 members = eina_hash_find(*ghash, class);
85
86 /* Update the member list */
87 lookup->lookup = members = eina_list_prepend(members, ed);
88
89 /* Don't loose track of members list */
90 if (!*ehash)
91 *ehash = eina_hash_string_small_new(NULL);
92 eina_hash_add(*ehash, class, lookup);
93
94 /* Reset the member list to the right pointer */
95 if (!*ghash)
96 *ghash = eina_hash_string_superfast_new(NULL);
97 eina_hash_set(*ghash, class, members);
98}
99
100static void
101_edje_class_member_del(Eina_Hash **ehash, Eina_Hash **ghash, const char *class)
102{
103 Edje_List_Refcount *lookup;
104 Eina_List *members;
105
106 if ((!ehash) || (!ghash) || (!class)) return;
107 members = eina_hash_find(*ghash, class);
108 if (!members) return;
109
110 lookup = eina_hash_find(*ehash, class);
111 if (!lookup) return ;
112
113 EINA_REFCOUNT_UNREF(lookup)
114 {
115 members = eina_list_remove_list(members, lookup->lookup);
116 eina_hash_set(*ghash, class, members);
117
118 eina_hash_del(*ehash, class, lookup);
119 free(lookup);
120 }
121}
122
123static Eina_Bool
124member_list_free(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__)
125{
126 eina_list_free(data);
127 return EINA_TRUE;
128}
129
130static void
131_edje_class_members_free(Eina_Hash **ghash)
132{
133 if (!ghash || !*ghash) return;
134 eina_hash_foreach(*ghash, member_list_free, NULL);
135 eina_hash_free(*ghash);
136 *ghash = NULL;
137}
138
139/************************** API Routines **************************/
140
141#define FASTFREEZE 1
142
143EAPI void
144edje_freeze(void)
145{
146#ifdef FASTFREEZE
147 _edje_freeze_val++;
148 INF("fr ++ ->%i", _edje_freeze_val);
149#else
150// FIXME: could just have a global freeze instead of per object
151// above i tried.. but this broke some things. notable e17's menus. why?
152 Eina_List *l;
153 Evas_Object *data;
154
155 EINA_LIST_FOREACH(_edje_edjes, l, data)
156 edje_object_freeze(data);
157#endif
158}
159
160#ifdef FASTFREEZE
161static void
162_edje_thaw_edje(Edje *ed)
163{
164 unsigned int i;
165
166 for (i = 0; i < ed->table_parts_size; i++)
167 {
168 Edje_Real_Part *rp;
169
170 rp = ed->table_parts[i];
171 if (rp->part->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object)
172 {
173 Edje *ed2;
174
175 ed2 = _edje_fetch(rp->swallowed_object);
176 if (ed2) _edje_thaw_edje(ed2);
177 }
178 }
179 if ((ed->recalc) && (ed->freeze <= 0)) _edje_recalc_do(ed);
180}
181#endif
182
183EAPI void
184edje_thaw(void)
185{
186#ifdef FASTFREEZE
187 _edje_freeze_val--;
188 INF("fr -- ->%i", _edje_freeze_val);
189 if ((_edje_freeze_val <= 0) && (_edje_freeze_calc_count > 0))
190 {
191 Edje *ed;
192
193 _edje_freeze_calc_count = 0;
194 EINA_LIST_FREE(_edje_freeze_calc_list, ed)
195 {
196 _edje_thaw_edje(ed);
197 ed->freeze_calc = 0;
198 }
199 }
200#else
201 Evas_Object *data;
202
203// FIXME: could just have a global freeze instead of per object
204// comment as above.. why?
205 Eina_List *l;
206
207 EINA_LIST_FOREACH(_edje_edjes, l, data)
208 edje_object_thaw(data);
209#endif
210}
211
212EAPI void
213edje_fontset_append_set(const char *fonts)
214{
215 if (_edje_fontset_append)
216 free(_edje_fontset_append);
217 _edje_fontset_append = fonts ? strdup(fonts) : NULL;
218}
219
220EAPI const char *
221edje_fontset_append_get(void)
222{
223 return _edje_fontset_append;
224}
225
226EAPI void
227edje_scale_set(double scale)
228{
229 Eina_List *l;
230 Evas_Object *data;
231
232 if (_edje_scale == FROM_DOUBLE(scale)) return;
233 _edje_scale = FROM_DOUBLE(scale);
234 EINA_LIST_FOREACH(_edje_edjes, l, data)
235 edje_object_calc_force(data);
236}
237
238EAPI double
239edje_scale_get(void)
240{
241 return TO_DOUBLE(_edje_scale);
242}
243
244EAPI void
245edje_password_show_last_set(Eina_Bool password_show_last)
246{
247 if (_edje_password_show_last == password_show_last) return;
248 _edje_password_show_last = password_show_last;
249}
250
251EAPI void
252edje_password_show_last_timeout_set(double password_show_last_timeout)
253{
254 if (_edje_password_show_last_timeout == FROM_DOUBLE(password_show_last_timeout)) return;
255 _edje_password_show_last_timeout = FROM_DOUBLE(password_show_last_timeout);
256}
257
258EAPI Eina_Bool
259edje_object_scale_set(Evas_Object *obj, double scale)
260{
261 Edje *ed;
262
263 ed = _edje_fetch(obj);
264 if (!ed) return EINA_FALSE;
265 if (ed->scale == scale) return EINA_TRUE;
266 ed->scale = FROM_DOUBLE(scale);
267 edje_object_calc_force(obj);
268 return EINA_TRUE;
269}
270
271EAPI double
272edje_object_scale_get(const Evas_Object *obj)
273{
274 Edje *ed;
275
276 ed = _edje_fetch(obj);
277 if (!ed) return 0.0;
278 return TO_DOUBLE(ed->scale);
279}
280
281EAPI Eina_Bool
282edje_object_mirrored_get(const Evas_Object *obj)
283{
284 Edje *ed;
285
286 ed = _edje_fetch(obj);
287 if (!ed) return EINA_FALSE;
288
289 return ed->is_rtl;
290}
291
292void
293_edje_object_orientation_inform(Evas_Object *obj)
294{
295 if (edje_object_mirrored_get(obj))
296 edje_object_signal_emit(obj, "edje,state,rtl", "edje");
297 else
298 edje_object_signal_emit(obj, "edje,state,ltr", "edje");
299}
300
301EAPI void
302edje_object_mirrored_set(Evas_Object *obj, Eina_Bool rtl)
303{
304 Edje *ed;
305 unsigned int i;
306
307 ed = _edje_fetch(obj);
308 if (!ed) return;
309 if (ed->is_rtl == rtl) return;
310
311 ed->is_rtl = rtl;
312
313 for (i = 0 ; i < ed->table_parts_size ; i++)
314 {
315 Edje_Real_Part *ep;
316 const char *s;
317 double v;
318
319 ep = ed->table_parts[i];
320 s = ep->param1.description->state.name,
321 v = ep->param1.description->state.value;
322 _edje_part_description_apply(ed, ep, s, v , NULL, 0.0);
323 ep->chosen_description = ep->param1.description;
324 }
325 _edje_recalc_do(ed);
326
327 _edje_object_orientation_inform(obj);
328
329 return;
330}
331
332EAPI const char *
333edje_object_data_get(const Evas_Object *obj, const char *key)
334{
335 Edje *ed;
336
337 ed = _edje_fetch(obj);
338 if ((!ed) || (!key))
339 return NULL;
340 if (!ed->collection) return NULL;
341 if (!ed->collection->data) return NULL;
342 return edje_string_get(eina_hash_find(ed->collection->data, key));
343}
344
345EAPI int
346edje_object_freeze(Evas_Object *obj)
347{
348 Edje *ed;
349 unsigned int i;
350
351 ed = _edje_fetch(obj);
352 if (!ed) return 0;
353 for (i = 0; i < ed->table_parts_size; i++)
354 {
355 Edje_Real_Part *rp;
356 rp = ed->table_parts[i];
357 if (rp->part->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object)
358 edje_object_freeze(rp->swallowed_object);
359 }
360 return _edje_freeze(ed);
361}
362
363EAPI int
364edje_object_thaw(Evas_Object *obj)
365{
366 Edje *ed;
367 unsigned int i;
368
369 ed = _edje_fetch(obj);
370 if (!ed) return 0;
371 for (i = 0; i < ed->table_parts_size; i++)
372 {
373 Edje_Real_Part *rp;
374
375 rp = ed->table_parts[i];
376 if (rp->part->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object)
377 edje_object_thaw(rp->swallowed_object);
378 }
379 return _edje_thaw(ed);
380}
381
382EAPI Eina_Bool
383edje_color_class_set(const char *color_class, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3)
384{
385 Eina_List *members;
386 Edje_Color_Class *cc;
387
388 if (!color_class) return EINA_FALSE;
389
390 cc = eina_hash_find(_edje_color_class_hash, color_class);
391 if (!cc)
392 {
393 cc = calloc(1, sizeof(Edje_Color_Class));
394 if (!cc) return EINA_FALSE;
395 cc->name = eina_stringshare_add(color_class);
396 if (!cc->name)
397 {
398 free(cc);
399 return EINA_FALSE;
400 }
401 if (!_edje_color_class_hash)
402 _edje_color_class_hash = eina_hash_string_superfast_new(NULL);
403 eina_hash_add(_edje_color_class_hash, color_class, cc);
404 }
405
406 if (r < 0) r = 0;
407 else if (r > 255) r = 255;
408 if (g < 0) g = 0;
409 else if (g > 255) g = 255;
410 if (b < 0) b = 0;
411 else if (b > 255) b = 255;
412 if (a < 0) a = 0;
413 else if (a > 255) a = 255;
414 if ((cc->r == r) && (cc->g == g) &&
415 (cc->b == b) && (cc->a == a) &&
416 (cc->r2 == r2) && (cc->g2 == g2) &&
417 (cc->b2 == b2) && (cc->a2 == a2) &&
418 (cc->r3 == r3) && (cc->g3 == g3) &&
419 (cc->b3 == b3) && (cc->a3 == a3))
420 return EINA_TRUE;
421 cc->r = r;
422 cc->g = g;
423 cc->b = b;
424 cc->a = a;
425 cc->r2 = r2;
426 cc->g2 = g2;
427 cc->b2 = b2;
428 cc->a2 = a2;
429 cc->r3 = r3;
430 cc->g3 = g3;
431 cc->b3 = b3;
432 cc->a3 = a3;
433
434 members = eina_hash_find(_edje_color_class_member_hash, color_class);
435 while (members)
436 {
437 Edje *ed;
438
439 ed = eina_list_data_get(members);
440 ed->dirty = 1;
441#ifdef EDJE_CALC_CACHE
442 ed->all_part_change = 1;
443#endif
444 _edje_recalc(ed);
445 _edje_emit(ed, "color_class,set", color_class);
446 members = eina_list_next(members);
447 }
448 return EINA_TRUE;
449}
450
451EAPI Eina_Bool
452edje_color_class_get(const char *color_class, int *r, int *g, int *b, int *a, int *r2, int *g2, int *b2, int *a2, int *r3, int *g3, int *b3, int *a3)
453{
454 Edje_Color_Class *cc;
455
456 if (!color_class)
457 cc = NULL;
458 else
459 cc = eina_hash_find(_edje_color_class_hash, color_class);
460
461 if (cc)
462 {
463#define X(C) if (C) *C = cc->C
464#define S(_r, _g, _b, _a) X(_r); X(_g); X(_b); X(_a)
465 S(r, g, b, a);
466 S(r2, g2, b2, a2);
467 S(r3, g3, b3, a3);
468#undef S
469#undef X
470 return EINA_TRUE;
471 }
472 else
473 {
474#define X(C) if (C) *C = 0
475#define S(_r, _g, _b, _a) X(_r); X(_g); X(_b); X(_a)
476 S(r, g, b, a);
477 S(r2, g2, b2, a2);
478 S(r3, g3, b3, a3);
479#undef S
480#undef X
481 return EINA_FALSE;
482 }
483}
484
485void
486edje_color_class_del(const char *color_class)
487{
488 Edje_Color_Class *cc;
489 Eina_List *members;
490
491 if (!color_class) return;
492
493 cc = eina_hash_find(_edje_color_class_hash, color_class);
494 if (!cc) return;
495
496 eina_hash_del(_edje_color_class_hash, color_class, cc);
497 eina_stringshare_del(cc->name);
498 free(cc);
499
500 members = eina_hash_find(_edje_color_class_member_hash, color_class);
501 while (members)
502 {
503 Edje *ed;
504
505 ed = eina_list_data_get(members);
506 ed->dirty = 1;
507#ifdef EDJE_CALC_CACHE
508 ed->all_part_change = 1;
509#endif
510 _edje_recalc(ed);
511 _edje_emit(ed, "color_class,del", color_class);
512 members = eina_list_next(members);
513 }
514}
515
516Eina_List *
517edje_color_class_list(void)
518{
519 Edje_List_Foreach_Data fdata;
520
521 if (!_edje_color_class_member_hash) return NULL;
522
523 memset(&fdata, 0, sizeof(Edje_List_Foreach_Data));
524 eina_hash_foreach(_edje_color_class_member_hash,
525 _edje_color_class_list_foreach, &fdata);
526
527 return fdata.list;
528}
529
530static Eina_Bool
531_edje_color_class_list_foreach(const Eina_Hash *hash __UNUSED__, const void *key, void *data __UNUSED__, void *fdata)
532{
533 Edje_List_Foreach_Data *fd;
534
535 fd = fdata;
536 fd->list = eina_list_append(fd->list, strdup(key));
537 return EINA_TRUE;
538}
539
540EAPI Eina_Bool
541edje_object_color_class_set(Evas_Object *obj, const char *color_class, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3)
542{
543 Edje *ed;
544 Eina_List *l;
545 Edje_Color_Class *cc;
546 unsigned int i;
547
548 ed = _edje_fetch(obj);
549 if ((!ed) || (!color_class)) return EINA_FALSE;
550 if (r < 0) r = 0;
551 else if (r > 255) r = 255;
552 if (g < 0) g = 0;
553 else if (g > 255) g = 255;
554 if (b < 0) b = 0;
555 else if (b > 255) b = 255;
556 if (a < 0) a = 0;
557 else if (a > 255) a = 255;
558 color_class = eina_stringshare_add(color_class);
559 if (!color_class) return EINA_FALSE;
560 EINA_LIST_FOREACH(ed->color_classes, l, cc)
561 {
562 if (cc->name == color_class)
563 {
564 eina_stringshare_del(color_class);
565
566 if ((cc->r == r) && (cc->g == g) &&
567 (cc->b == b) && (cc->a == a) &&
568 (cc->r2 == r2) && (cc->g2 == g2) &&
569 (cc->b2 == b2) && (cc->a2 == a2) &&
570 (cc->r3 == r3) && (cc->g3 == g3) &&
571 (cc->b3 == b3) && (cc->a3 == a3))
572 return EINA_TRUE;
573 cc->r = r;
574 cc->g = g;
575 cc->b = b;
576 cc->a = a;
577 cc->r2 = r2;
578 cc->g2 = g2;
579 cc->b2 = b2;
580 cc->a2 = a2;
581 cc->r3 = r3;
582 cc->g3 = g3;
583 cc->b3 = b3;
584 cc->a3 = a3;
585 ed->dirty = 1;
586#ifdef EDJE_CALC_CACHE
587 ed->all_part_change = 1;
588#endif
589 _edje_recalc(ed);
590 return EINA_TRUE;
591 }
592 }
593 cc = malloc(sizeof(Edje_Color_Class));
594 if (!cc)
595 {
596 eina_stringshare_del(color_class);
597 return EINA_FALSE;
598 }
599 cc->name = color_class;
600 cc->r = r;
601 cc->g = g;
602 cc->b = b;
603 cc->a = a;
604 cc->r2 = r2;
605 cc->g2 = g2;
606 cc->b2 = b2;
607 cc->a2 = a2;
608 cc->r3 = r3;
609 cc->g3 = g3;
610 cc->b3 = b3;
611 cc->a3 = a3;
612 ed->color_classes = eina_list_append(ed->color_classes, cc);
613 ed->dirty = 1;
614#ifdef EDJE_CALC_CACHE
615 ed->all_part_change = 1;
616#endif
617
618 for (i = 0; i < ed->table_parts_size; i++)
619 {
620 Edje_Real_Part *rp;
621
622 rp = ed->table_parts[i];
623 if (rp->part->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object)
624 edje_object_color_class_set(rp->swallowed_object, color_class,
625 r, g, b, a, r2, g2, b2, a2, r3, g3, b3,
626 a3);
627 }
628
629 _edje_recalc(ed);
630 _edje_emit(ed, "color_class,set", color_class);
631 return EINA_TRUE;
632}
633
634EAPI Eina_Bool
635edje_object_color_class_get(const Evas_Object *obj, const char *color_class, int *r, int *g, int *b, int *a, int *r2, int *g2, int *b2, int *a2, int *r3, int *g3, int *b3, int *a3)
636{
637 Edje *ed = _edje_fetch(obj);
638 Edje_Color_Class *cc = _edje_color_class_find(ed, color_class);
639
640 if (cc)
641 {
642#define X(C) if (C) *C = cc->C
643#define S(_r, _g, _b, _a) X(_r); X(_g); X(_b); X(_a)
644 S(r, g, b, a);
645 S(r2, g2, b2, a2);
646 S(r3, g3, b3, a3);
647#undef S
648#undef X
649 return EINA_TRUE;
650 }
651 else
652 {
653#define X(C) if (C) *C = 0
654#define S(_r, _g, _b, _a) X(_r); X(_g); X(_b); X(_a)
655 S(r, g, b, a);
656 S(r2, g2, b2, a2);
657 S(r3, g3, b3, a3);
658#undef S
659#undef X
660 return EINA_FALSE;
661 }
662}
663
664void
665edje_object_color_class_del(Evas_Object *obj, const char *color_class)
666{
667 Edje *ed;
668 Eina_List *l;
669 Edje_Color_Class *cc = NULL;
670 unsigned int i;
671
672 if (!color_class) return;
673
674 ed = _edje_fetch(obj);
675 EINA_LIST_FOREACH(ed->color_classes, l, cc)
676 {
677 if (!strcmp(cc->name, color_class))
678 {
679 ed->color_classes = eina_list_remove(ed->color_classes, cc);
680 eina_stringshare_del(cc->name);
681 free(cc);
682 break;
683 }
684 }
685
686 for (i = 0; i < ed->table_parts_size; i++)
687 {
688 Edje_Real_Part *rp;
689
690 rp = ed->table_parts[i];
691 if (rp->part->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object)
692 edje_object_color_class_del(rp->swallowed_object, color_class);
693 }
694
695 ed->dirty = 1;
696#ifdef EDJE_CALC_CACHE
697 ed->all_part_change = 1;
698#endif
699 _edje_recalc(ed);
700 _edje_emit(ed, "color_class,del", color_class);
701}
702
703EAPI Eina_Bool
704edje_text_class_set(const char *text_class, const char *font, Evas_Font_Size size)
705{
706 Eina_List *members;
707 Edje_Text_Class *tc;
708
709 if (!text_class) return EINA_FALSE;
710 if (!font) font = "";
711
712 tc = eina_hash_find(_edje_text_class_hash, text_class);
713 /* Create new text class */
714 if (!tc)
715 {
716 tc = calloc(1, sizeof(Edje_Text_Class));
717 if (!tc) return EINA_FALSE;
718 tc->name = eina_stringshare_add(text_class);
719 if (!tc->name)
720 {
721 free(tc);
722 return EINA_FALSE;
723 }
724 if (!_edje_text_class_hash) _edje_text_class_hash = eina_hash_string_superfast_new(NULL);
725 eina_hash_add(_edje_text_class_hash, text_class, tc);
726
727 tc->font = eina_stringshare_add(font);
728 tc->size = size;
729 return EINA_FALSE;
730 }
731
732 /* If the class found is the same just return */
733 if ((tc->size == size) && (tc->font) && (!strcmp(tc->font, font)))
734 return EINA_TRUE;
735
736 /* Update the class found */
737 eina_stringshare_del(tc->font);
738 tc->font = eina_stringshare_add(font);
739 if (!tc->font)
740 {
741 eina_hash_del(_edje_text_class_hash, text_class, tc);
742 free(tc);
743 return EINA_FALSE;
744 }
745 tc->size = size;
746
747 /* Tell all members of the text class to recalc */
748 members = eina_hash_find(_edje_text_class_member_hash, text_class);
749 while (members)
750 {
751 Edje *ed;
752
753 ed = eina_list_data_get(members);
754 ed->dirty = 1;
755 _edje_textblock_style_all_update(ed);
756#ifdef EDJE_CALC_CACHE
757 ed->text_part_change = 1;
758#endif
759 _edje_recalc(ed);
760 members = eina_list_next(members);
761 }
762 return EINA_TRUE;
763}
764
765void
766edje_text_class_del(const char *text_class)
767{
768 Edje_Text_Class *tc;
769 Eina_List *members;
770
771 if (!text_class) return;
772
773 tc = eina_hash_find(_edje_text_class_hash, text_class);
774 if (!tc) return;
775
776 eina_hash_del(_edje_text_class_hash, text_class, tc);
777 eina_stringshare_del(tc->name);
778 eina_stringshare_del(tc->font);
779 free(tc);
780
781 members = eina_hash_find(_edje_text_class_member_hash, text_class);
782 while (members)
783 {
784 Edje *ed;
785
786 ed = eina_list_data_get(members);
787 ed->dirty = 1;
788 _edje_textblock_style_all_update(ed);
789#ifdef EDJE_CALC_CACHE
790 ed->text_part_change = 1;
791#endif
792 _edje_recalc(ed);
793 members = eina_list_next(members);
794 }
795}
796
797Eina_List *
798edje_text_class_list(void)
799{
800 Edje_List_Foreach_Data fdata;
801
802 memset(&fdata, 0, sizeof(Edje_List_Foreach_Data));
803 eina_hash_foreach(_edje_text_class_member_hash,
804 _edje_text_class_list_foreach, &fdata);
805 return fdata.list;
806}
807
808static Eina_Bool
809_edje_text_class_list_foreach(const Eina_Hash *hash __UNUSED__, const void *key, void *data __UNUSED__, void *fdata)
810{
811 Edje_List_Foreach_Data *fd;
812
813 fd = fdata;
814 fd->list = eina_list_append(fd->list, eina_stringshare_add(key));
815 return EINA_TRUE;
816}
817
818EAPI Eina_Bool
819edje_object_text_class_set(Evas_Object *obj, const char *text_class, const char *font, Evas_Font_Size size)
820{
821 Edje *ed;
822 Eina_List *l;
823 Edje_Text_Class *tc;
824 unsigned int i;
825
826 ed = _edje_fetch(obj);
827 if ((!ed) || (!text_class)) return EINA_FALSE;
828
829 /* for each text_class in the edje */
830 EINA_LIST_FOREACH(ed->text_classes, l, tc)
831 {
832 if ((tc->name) && (!strcmp(tc->name, text_class)))
833 {
834 /* Match and the same, return */
835 if ((tc->font) && (font) && (!strcmp(tc->font, font)) &&
836 (tc->size == size))
837 return EINA_TRUE;
838
839 /* No font but size is the same, return */
840 if ((!tc->font) && (!font) && (tc->size == size)) return EINA_TRUE;
841
842 /* Update new text class properties */
843 if (tc->font) eina_stringshare_del(tc->font);
844 if (font) tc->font = eina_stringshare_add(font);
845 else tc->font = NULL;
846 tc->size = size;
847
848 /* Update edje */
849 ed->dirty = 1;
850#ifdef EDJE_CALC_CACHE
851 ed->text_part_change = 1;
852#endif
853 _edje_recalc(ed);
854 return EINA_TRUE;
855 }
856 }
857
858 /* No matches, create a new text class */
859 tc = calloc(1, sizeof(Edje_Text_Class));
860 if (!tc) return EINA_FALSE;
861 tc->name = eina_stringshare_add(text_class);
862 if (!tc->name)
863 {
864 free(tc);
865 return EINA_FALSE;
866 }
867 if (font) tc->font = eina_stringshare_add(font);
868 else tc->font = NULL;
869 tc->size = size;
870
871 for (i = 0; i < ed->table_parts_size; i++)
872 {
873 Edje_Real_Part *rp;
874
875 rp = ed->table_parts[i];
876 if (rp->part->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object)
877 edje_object_text_class_set(rp->swallowed_object, text_class,
878 font, size);
879 }
880
881 /* Add to edje's text class list */
882 ed->text_classes = eina_list_append(ed->text_classes, tc);
883 ed->dirty = 1;
884#ifdef EDJE_CALC_CACHE
885 ed->text_part_change = 1;
886#endif
887 _edje_textblock_style_all_update(ed);
888 _edje_recalc(ed);
889 return EINA_TRUE;
890}
891
892EAPI Eina_Bool
893edje_object_part_exists(const Evas_Object *obj, const char *part)
894{
895 Edje *ed;
896 Edje_Real_Part *rp;
897
898 ed = _edje_fetch(obj);
899 if ((!ed) || (!part)) return EINA_FALSE;
900 rp = _edje_real_part_recursive_get(ed, (char *)part);
901 if (!rp) return EINA_FALSE;
902 return EINA_TRUE;
903}
904
905EAPI const Evas_Object *
906edje_object_part_object_get(const Evas_Object *obj, const char *part)
907{
908 Edje *ed;
909 Edje_Real_Part *rp;
910
911 ed = _edje_fetch(obj);
912 if ((!ed) || (!part)) return NULL;
913
914 /* Need to recalc before providing the object. */
915 _edje_recalc_do(ed);
916
917 rp = _edje_real_part_recursive_get(ed, (char *)part);
918 if (!rp) return NULL;
919 return rp->object;
920}
921
922EAPI Eina_Bool
923edje_object_part_geometry_get(const Evas_Object *obj, const char *part, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h )
924{
925 Edje *ed;
926 Edje_Real_Part *rp;
927
928 ed = _edje_fetch(obj);
929 if ((!ed) || (!part))
930 {
931 if (x) *x = 0;
932 if (y) *y = 0;
933 if (w) *w = 0;
934 if (h) *h = 0;
935 return EINA_FALSE;
936 }
937
938 /* Need to recalc before providing the object. */
939 _edje_recalc_do(ed);
940
941 rp = _edje_real_part_recursive_get(ed, (char *)part);
942 if (!rp)
943 {
944 if (x) *x = 0;
945 if (y) *y = 0;
946 if (w) *w = 0;
947 if (h) *h = 0;
948 return EINA_FALSE;
949 }
950 if (x) *x = rp->x;
951 if (y) *y = rp->y;
952 if (w) *w = rp->w;
953 if (h) *h = rp->h;
954 return EINA_TRUE;
955}
956
957EAPI void
958edje_object_item_provider_set(Evas_Object *obj, Edje_Item_Provider_Cb func, void *data)
959{
960 Edje *ed;
961
962 ed = _edje_fetch(obj);
963 if (!ed) return;
964 ed->item_provider.func = func;
965 ed->item_provider.data = data;
966}
967
968/* FIXDOC: New Function */
969EAPI void
970edje_object_text_change_cb_set(Evas_Object *obj, Edje_Text_Change_Cb func, void *data)
971{
972 Edje *ed;
973 unsigned int i;
974
975 ed = _edje_fetch(obj);
976 if (!ed) return;
977 ed->text_change.func = func;
978 ed->text_change.data = data;
979
980 for (i = 0; i < ed->table_parts_size; i++)
981 {
982 Edje_Real_Part *rp;
983
984 rp = ed->table_parts[i];
985 if ((rp->part->type == EDJE_PART_TYPE_GROUP) && (rp->swallowed_object))
986 edje_object_text_change_cb_set(rp->swallowed_object, func, data);
987 }
988}
989
990Eina_Bool
991_edje_object_part_text_raw_set(Evas_Object *obj, Edje_Real_Part *rp, const char *part, const char *text)
992{
993 if ((!rp->text.text) && (!text))
994 return EINA_FALSE;
995 if ((rp->text.text) && (text) &&
996 (!strcmp(rp->text.text, text)))
997 return EINA_FALSE;
998 if (rp->text.text)
999 {
1000 eina_stringshare_del(rp->text.text);
1001 rp->text.text = NULL;
1002 }
1003 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1004 _edje_entry_text_markup_set(rp, text);
1005 else
1006 if (text) rp->text.text = eina_stringshare_add(text);
1007 rp->edje->dirty = 1;
1008#ifdef EDJE_CALC_CACHE
1009 rp->invalidate = 1;
1010#endif
1011 _edje_recalc(rp->edje);
1012 if (rp->edje->text_change.func)
1013 rp->edje->text_change.func(rp->edje->text_change.data, obj, part);
1014 return EINA_TRUE;
1015}
1016
1017Eina_Bool
1018_edje_object_part_text_raw_append(Evas_Object *obj, Edje_Real_Part *rp, const char *part, const char *text)
1019{
1020 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1021 _edje_entry_text_markup_append(rp, text);
1022 else if (text)
1023 {
1024 if (rp->text.text)
1025 {
1026 char *new = NULL;
1027 int len_added = strlen(text);
1028 int len_old = strlen(rp->text.text);
1029 new = malloc(len_old + len_added + 1);
1030 memcpy(new, rp->text.text, len_old);
1031 memcpy(new + len_old, text, len_added);
1032 new[len_old + len_added] = '\0';
1033 eina_stringshare_replace(&rp->text.text, new);
1034 free(new);
1035 }
1036 else
1037 {
1038 eina_stringshare_replace(&rp->text.text, text);
1039 }
1040 }
1041 rp->edje->dirty = 1;
1042#ifdef EDJE_CALC_CACHE
1043 rp->invalidate = 1;
1044#endif
1045 _edje_recalc(rp->edje);
1046 if (rp->edje->text_change.func)
1047 rp->edje->text_change.func(rp->edje->text_change.data, obj, part);
1048 return EINA_TRUE;
1049}
1050
1051EAPI Eina_Bool
1052edje_object_part_text_set(Evas_Object *obj, const char *part, const char *text)
1053{
1054 Edje *ed;
1055 Edje_Real_Part *rp;
1056
1057 ed = _edje_fetch(obj);
1058 if ((!ed) || (!part)) return EINA_FALSE;
1059 rp = _edje_real_part_recursive_get(ed, (char *)part);
1060 if (!rp) return EINA_FALSE;
1061 if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
1062 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return EINA_FALSE;
1063 return _edje_object_part_text_raw_set(obj, rp, part, text);
1064}
1065
1066EAPI const char *
1067edje_object_part_text_get(const Evas_Object *obj, const char *part)
1068{
1069 Edje *ed;
1070 Edje_Real_Part *rp;
1071
1072 ed = _edje_fetch(obj);
1073 if ((!ed) || (!part)) return NULL;
1074
1075 /* Need to recalc before providing the object. */
1076 _edje_recalc_do(ed);
1077
1078 rp = _edje_real_part_recursive_get(ed, (char *)part);
1079 if (!rp) return NULL;
1080 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1081 return _edje_entry_text_get(rp);
1082 else
1083 {
1084 if (rp->part->type == EDJE_PART_TYPE_TEXT) return rp->text.text;
1085 if (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
1086 return evas_object_textblock_text_markup_get(rp->object);
1087 }
1088 return NULL;
1089}
1090
1091char *
1092_edje_text_escape(const char *text)
1093{
1094 Eina_Strbuf *txt;
1095 char *ret;
1096 const char *text_end;
1097 size_t text_len;
1098
1099 if (!text) return NULL;
1100
1101 txt = eina_strbuf_new();
1102 text_len = strlen(text);
1103
1104 text_end = text + text_len;
1105 while (text < text_end)
1106 {
1107 int advance;
1108 const char *escaped = evas_textblock_string_escape_get(text, &advance);
1109 if (!escaped)
1110 {
1111 eina_strbuf_append_char(txt, text[0]);
1112 advance = 1;
1113 }
1114 else
1115 eina_strbuf_append(txt, escaped);
1116
1117 text += advance;
1118 }
1119
1120 ret = eina_strbuf_string_steal(txt);
1121 eina_strbuf_free(txt);
1122 return ret;
1123}
1124
1125char *
1126_edje_text_unescape(const char *text)
1127{
1128 Eina_Strbuf *txt;
1129 char *ret;
1130 const char *text_end, *last, *escape_start;
1131 size_t text_len;
1132
1133 if (!text) return NULL;
1134
1135 txt = eina_strbuf_new();
1136 text_len = strlen(text);
1137
1138 text_end = text + text_len;
1139 last = text;
1140 escape_start = NULL;
1141 for (; text < text_end; text++)
1142 {
1143 if (*text == '&')
1144 {
1145 size_t len;
1146 const char *str;
1147
1148 if (last)
1149 {
1150 len = text - last;
1151 str = last;
1152 }
1153 else
1154 {
1155 len = text - escape_start;
1156 str = escape_start;
1157 }
1158
1159 if (len > 0)
1160 eina_strbuf_append_n(txt, str, len);
1161
1162 escape_start = text;
1163 last = NULL;
1164 }
1165 else if ((*text == ';') && (escape_start))
1166 {
1167 size_t len;
1168 const char *str = evas_textblock_escape_string_range_get(escape_start, text);
1169
1170 if (str)
1171 len = strlen(str);
1172 else
1173 {
1174 str = escape_start;
1175 len = text + 1 - escape_start;
1176 }
1177
1178 eina_strbuf_append_n(txt, str, len);
1179
1180 escape_start = NULL;
1181 last = text + 1;
1182 }
1183 }
1184
1185 if (!last && escape_start)
1186 last = escape_start;
1187
1188 if (last && (text > last))
1189 {
1190 size_t len = text - last;
1191 eina_strbuf_append_n(txt, last, len);
1192 }
1193
1194 ret = eina_strbuf_string_steal(txt);
1195 eina_strbuf_free(txt);
1196 return ret;
1197}
1198
1199EAPI Eina_Bool
1200edje_object_part_text_unescaped_set(Evas_Object *obj, const char *part, const char *text_to_escape)
1201{
1202 Edje *ed;
1203 Edje_Real_Part *rp;
1204 Eina_Bool ret = EINA_FALSE;
1205
1206 ed = _edje_fetch(obj);
1207 if ((!ed) || (!part)) return ret;
1208 rp = _edje_real_part_recursive_get(ed, part);
1209 if (!rp) return ret;
1210 if (rp->part->type == EDJE_PART_TYPE_TEXT)
1211 ret = _edje_object_part_text_raw_set(obj, rp, part, text_to_escape);
1212 else if (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
1213 {
1214 char *text = _edje_text_escape(text_to_escape);
1215
1216 ret = _edje_object_part_text_raw_set(obj, rp, part, text);
1217 free(text);
1218 }
1219 return ret;
1220}
1221
1222EAPI char *
1223edje_object_part_text_unescaped_get(const Evas_Object *obj, const char *part)
1224{
1225 Edje *ed;
1226 Edje_Real_Part *rp;
1227
1228 ed = _edje_fetch(obj);
1229 if ((!ed) || (!part)) return NULL;
1230
1231 /* Need to recalc before providing the object. */
1232 _edje_recalc_do(ed);
1233
1234 rp = _edje_real_part_recursive_get(ed, (char *)part);
1235 if (!rp) return NULL;
1236 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1237 {
1238 const char *t = _edje_entry_text_get(rp);
1239 return _edje_text_unescape(t);
1240 }
1241 else
1242 {
1243 if (rp->part->type == EDJE_PART_TYPE_TEXT) return strdup(rp->text.text);
1244 if (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
1245 {
1246 const char *t = evas_object_textblock_text_markup_get(rp->object);
1247 return _edje_text_unescape(t);
1248 }
1249 }
1250 return NULL;
1251}
1252
1253EAPI const char *
1254edje_object_part_text_selection_get(const Evas_Object *obj, const char *part)
1255{
1256 Edje *ed;
1257 Edje_Real_Part *rp;
1258
1259 ed = _edje_fetch(obj);
1260 if ((!ed) || (!part)) return NULL;
1261 rp = _edje_real_part_recursive_get(ed, (char *)part);
1262 if (!rp) return NULL;
1263 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1264 return _edje_entry_selection_get(rp);
1265 return NULL;
1266}
1267
1268EAPI void
1269edje_object_part_text_select_none(const Evas_Object *obj, const char *part)
1270{
1271 Edje *ed;
1272 Edje_Real_Part *rp;
1273
1274 ed = _edje_fetch(obj);
1275 if ((!ed) || (!part)) return;
1276 rp = _edje_real_part_recursive_get(ed, (char *)part);
1277 if (!rp) return;
1278 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1279 _edje_entry_select_none(rp);
1280}
1281
1282EAPI void
1283edje_object_part_text_select_all(const Evas_Object *obj, const char *part)
1284{
1285 Edje *ed;
1286 Edje_Real_Part *rp;
1287
1288 ed = _edje_fetch(obj);
1289 if ((!ed) || (!part)) return;
1290 rp = _edje_real_part_recursive_get(ed, (char *)part);
1291 if (!rp) return;
1292 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1293 _edje_entry_select_all(rp);
1294}
1295
1296EAPI void
1297edje_object_part_text_insert(Evas_Object *obj, const char *part, const char *text)
1298{
1299 Edje *ed;
1300 Edje_Real_Part *rp;
1301
1302 ed = _edje_fetch(obj);
1303 if ((!ed) || (!part)) return;
1304 rp = _edje_real_part_recursive_get(ed, (char *)part);
1305 if (!rp) return;
1306 if ((rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return;
1307 if (rp->part->entry_mode <= EDJE_ENTRY_EDIT_MODE_NONE) return;
1308 _edje_entry_text_markup_insert(rp, text);
1309 rp->edje->dirty = 1;
1310#ifdef EDJE_CALC_CACHE
1311 rp->invalidate = 1;
1312#endif
1313 _edje_recalc(rp->edje);
1314 if (rp->edje->text_change.func)
1315 rp->edje->text_change.func(rp->edje->text_change.data, obj, part);
1316}
1317
1318EAPI void
1319edje_object_part_text_append(Evas_Object *obj, const char *part, const char *text)
1320{
1321 Edje *ed;
1322 Edje_Real_Part *rp;
1323
1324 ed = _edje_fetch(obj);
1325 if ((!ed) || (!part)) return;
1326 rp = _edje_real_part_recursive_get(ed, (char *)part);
1327 if (!rp) return;
1328 if ((rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return;
1329 _edje_object_part_text_raw_append(obj, rp, part, text);
1330 rp->edje->dirty = 1;
1331#ifdef EDJE_CALC_CACHE
1332 rp->invalidate = 1;
1333#endif
1334 _edje_recalc(rp->edje);
1335 if (rp->edje->text_change.func)
1336 rp->edje->text_change.func(rp->edje->text_change.data, obj, part);
1337}
1338
1339EAPI const Eina_List *
1340edje_object_part_text_anchor_list_get(const Evas_Object *obj, const char *part)
1341{
1342 Edje *ed;
1343 Edje_Real_Part *rp;
1344
1345 ed = _edje_fetch(obj);
1346 if ((!ed) || (!part)) return NULL;
1347 rp = _edje_real_part_recursive_get(ed, (char *)part);
1348 if (!rp) return NULL;
1349 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1350 return _edje_entry_anchors_list(rp);
1351 return NULL;
1352}
1353
1354EAPI const Eina_List *
1355edje_object_part_text_anchor_geometry_get(const Evas_Object *obj, const char *part, const char *anchor)
1356{
1357 Edje *ed;
1358 Edje_Real_Part *rp;
1359
1360 ed = _edje_fetch(obj);
1361 if ((!ed) || (!part)) return NULL;
1362 rp = _edje_real_part_recursive_get(ed, (char *)part);
1363 if (!rp) return NULL;
1364 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1365 return _edje_entry_anchor_geometry_get(rp, anchor);
1366 return NULL;
1367}
1368
1369EAPI const Eina_List *
1370edje_object_part_text_item_list_get(const Evas_Object *obj, const char *part)
1371{
1372 Edje *ed;
1373 Edje_Real_Part *rp;
1374
1375 ed = _edje_fetch(obj);
1376 if ((!ed) || (!part)) return NULL;
1377 rp = _edje_real_part_recursive_get(ed, (char *)part);
1378 if (!rp) return NULL;
1379 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1380 return _edje_entry_items_list(rp);
1381 return NULL;
1382}
1383
1384EAPI Eina_Bool
1385edje_object_part_text_item_geometry_get(const Evas_Object *obj, const char *part, const char *item, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
1386{
1387 Edje *ed;
1388 Edje_Real_Part *rp;
1389
1390 ed = _edje_fetch(obj);
1391 if ((!ed) || (!part)) return EINA_FALSE;
1392 rp = _edje_real_part_recursive_get(ed, (char *)part);
1393 if (!rp) return EINA_FALSE;
1394 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1395 return _edje_entry_item_geometry_get(rp, item, cx, cy, cw, ch);
1396 return EINA_FALSE;
1397}
1398
1399EAPI void
1400edje_object_part_text_cursor_geometry_get(const Evas_Object *obj, const char *part, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
1401{
1402 Edje *ed;
1403 Edje_Real_Part *rp;
1404
1405 ed = _edje_fetch(obj);
1406 if (x) *x = 0;
1407 if (y) *y = 0;
1408 if (w) *w = 0;
1409 if (h) *h = 0;
1410 if ((!ed) || (!part)) return;
1411 rp = _edje_real_part_recursive_get(ed, (char *)part);
1412 if (!rp) return;
1413 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1414 {
1415 _edje_entry_cursor_geometry_get(rp, x, y, w, h);
1416 if (x) *x -= rp->edje->x;
1417 if (y) *y -= rp->edje->y;
1418 }
1419 return;
1420}
1421
1422EAPI void
1423edje_object_part_text_select_allow_set(const Evas_Object *obj, const char *part, Eina_Bool allow)
1424{
1425 Edje *ed;
1426 Edje_Real_Part *rp;
1427
1428 ed = _edje_fetch(obj);
1429 if ((!ed) || (!part)) return;
1430 rp = _edje_real_part_recursive_get(ed, (char *)part);
1431 if (!rp) return;
1432 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1433 _edje_entry_select_allow_set(rp, allow);
1434}
1435
1436EAPI void
1437edje_object_part_text_select_abort(const Evas_Object *obj, const char *part)
1438{
1439 Edje *ed;
1440 Edje_Real_Part *rp;
1441
1442 ed = _edje_fetch(obj);
1443 if ((!ed) || (!part)) return;
1444 rp = _edje_real_part_recursive_get(ed, (char *)part);
1445 if (!rp) return;
1446 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1447 _edje_entry_select_abort(rp);
1448}
1449
1450EAPI void
1451edje_object_part_text_select_begin(const Evas_Object *obj, const char *part)
1452{
1453 Edje *ed;
1454 Edje_Real_Part *rp;
1455
1456 ed = _edje_fetch(obj);
1457 if ((!ed) || (!part)) return;
1458 rp = _edje_real_part_recursive_get(ed, (char *)part);
1459 if (!rp) return;
1460 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1461 _edje_entry_select_begin(rp);
1462}
1463
1464EAPI void
1465edje_object_part_text_select_extend(const Evas_Object *obj, const char *part)
1466{
1467 Edje *ed;
1468 Edje_Real_Part *rp;
1469
1470 ed = _edje_fetch(obj);
1471 if ((!ed) || (!part)) return;
1472 rp = _edje_real_part_recursive_get(ed, (char *)part);
1473 if (!rp) return;
1474 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1475 _edje_entry_select_extend(rp);
1476}
1477
1478EAPI Eina_Bool
1479edje_object_part_text_cursor_next(Evas_Object *obj, const char *part, Edje_Cursor cur)
1480{
1481 Edje *ed;
1482 Edje_Real_Part *rp;
1483
1484 ed = _edje_fetch(obj);
1485 if ((!ed) || (!part)) return EINA_FALSE;
1486 rp = _edje_real_part_recursive_get(ed, (char *)part);
1487 if (!rp) return EINA_FALSE;
1488 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1489 {
1490 return _edje_entry_cursor_next(rp, cur);
1491 }
1492 return EINA_FALSE;
1493}
1494
1495EAPI Eina_Bool
1496edje_object_part_text_cursor_prev(Evas_Object *obj, const char *part, Edje_Cursor cur)
1497{
1498 Edje *ed;
1499 Edje_Real_Part *rp;
1500
1501 ed = _edje_fetch(obj);
1502 if ((!ed) || (!part)) return EINA_FALSE;
1503 rp = _edje_real_part_recursive_get(ed, (char *)part);
1504 if (!rp) return EINA_FALSE;
1505 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1506 {
1507 return _edje_entry_cursor_prev(rp, cur);
1508 }
1509 return EINA_FALSE;
1510}
1511
1512EAPI Eina_Bool
1513edje_object_part_text_cursor_up(Evas_Object *obj, const char *part, Edje_Cursor cur)
1514{
1515 Edje *ed;
1516 Edje_Real_Part *rp;
1517
1518 ed = _edje_fetch(obj);
1519 if ((!ed) || (!part)) return EINA_FALSE;
1520 rp = _edje_real_part_recursive_get(ed, (char *)part);
1521 if (!rp) return EINA_FALSE;
1522 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1523 {
1524 return _edje_entry_cursor_up(rp, cur);
1525 }
1526 return EINA_FALSE;
1527}
1528
1529EAPI Eina_Bool
1530edje_object_part_text_cursor_down(Evas_Object *obj, const char *part, Edje_Cursor cur)
1531{
1532 Edje *ed;
1533 Edje_Real_Part *rp;
1534
1535 ed = _edje_fetch(obj);
1536 if ((!ed) || (!part)) return EINA_FALSE;
1537 rp = _edje_real_part_recursive_get(ed, (char *)part);
1538 if (!rp) return EINA_FALSE;
1539 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1540 {
1541 return _edje_entry_cursor_down(rp, cur);
1542 }
1543 return EINA_FALSE;
1544}
1545
1546EAPI void
1547edje_object_part_text_cursor_begin_set(Evas_Object *obj, const char *part, Edje_Cursor cur)
1548{
1549 Edje *ed;
1550 Edje_Real_Part *rp;
1551
1552 ed = _edje_fetch(obj);
1553 if ((!ed) || (!part)) return;
1554 rp = _edje_real_part_recursive_get(ed, (char *)part);
1555 if (!rp) return;
1556 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1557 {
1558 _edje_entry_cursor_begin(rp, cur);
1559 }
1560}
1561
1562EAPI void
1563edje_object_part_text_cursor_end_set(Evas_Object *obj, const char *part, Edje_Cursor cur)
1564{
1565 Edje *ed;
1566 Edje_Real_Part *rp;
1567
1568 ed = _edje_fetch(obj);
1569 if ((!ed) || (!part)) return;
1570 rp = _edje_real_part_recursive_get(ed, (char *)part);
1571 if (!rp) return;
1572 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1573 {
1574 _edje_entry_cursor_end(rp, cur);
1575 }
1576}
1577
1578EAPI void
1579edje_object_part_text_cursor_copy(Evas_Object *obj, const char *part, Edje_Cursor src, Edje_Cursor dst)
1580{
1581 Edje *ed;
1582 Edje_Real_Part *rp;
1583
1584 ed = _edje_fetch(obj);
1585 if ((!ed) || (!part)) return;
1586 rp = _edje_real_part_recursive_get(ed, (char *)part);
1587 if (!rp) return;
1588 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1589 {
1590 _edje_entry_cursor_copy(rp, src, dst);
1591 }
1592}
1593
1594EAPI void
1595edje_object_part_text_cursor_line_begin_set(Evas_Object *obj, const char *part, Edje_Cursor cur)
1596{
1597 Edje *ed;
1598 Edje_Real_Part *rp;
1599
1600 ed = _edje_fetch(obj);
1601 if ((!ed) || (!part)) return;
1602 rp = _edje_real_part_recursive_get(ed, (char *)part);
1603 if (!rp) return;
1604 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1605 {
1606 _edje_entry_cursor_line_begin(rp, cur);
1607 }
1608}
1609
1610EAPI void
1611edje_object_part_text_cursor_line_end_set(Evas_Object *obj, const char *part, Edje_Cursor cur)
1612{
1613 Edje *ed;
1614 Edje_Real_Part *rp;
1615
1616 ed = _edje_fetch(obj);
1617 if ((!ed) || (!part)) return;
1618 rp = _edje_real_part_recursive_get(ed, (char *)part);
1619 if (!rp) return;
1620 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1621 {
1622 _edje_entry_cursor_line_end(rp, cur);
1623 }
1624}
1625
1626EAPI Eina_Bool
1627edje_object_part_text_cursor_coord_set(Evas_Object *obj, const char *part,
1628 Edje_Cursor cur, Evas_Coord x, Evas_Coord y)
1629{
1630 Edje *ed;
1631 Edje_Real_Part *rp;
1632
1633 ed = _edje_fetch(obj);
1634 if ((!ed) || (!part)) return EINA_FALSE;
1635 rp = _edje_real_part_recursive_get(ed, (char *)part);
1636 if (!rp) return EINA_FALSE;
1637 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1638 {
1639 return _edje_entry_cursor_coord_set(rp, cur, x, y);
1640 }
1641 return EINA_FALSE;
1642}
1643
1644EAPI Eina_Bool
1645edje_object_part_text_cursor_is_format_get(const Evas_Object *obj, const char *part, Edje_Cursor cur)
1646{
1647 Edje *ed;
1648 Edje_Real_Part *rp;
1649
1650 ed = _edje_fetch(obj);
1651 if ((!ed) || (!part)) return EINA_FALSE;
1652 rp = _edje_real_part_recursive_get(ed, (char *)part);
1653 if (!rp) return EINA_FALSE;
1654 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1655 {
1656 return _edje_entry_cursor_is_format_get(rp, cur);
1657 }
1658 return EINA_FALSE;
1659}
1660
1661EAPI Eina_Bool
1662edje_object_part_text_cursor_is_visible_format_get(const Evas_Object *obj, const char *part, Edje_Cursor cur)
1663{
1664 Edje *ed;
1665 Edje_Real_Part *rp;
1666
1667 ed = _edje_fetch(obj);
1668 if ((!ed) || (!part)) return 0;
1669 rp = _edje_real_part_recursive_get(ed, (char *)part);
1670 if (!rp) return 0;
1671 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1672 {
1673 return _edje_entry_cursor_is_visible_format_get(rp, cur);
1674 }
1675 return 0;
1676}
1677
1678EAPI const char *
1679edje_object_part_text_cursor_content_get(const Evas_Object *obj, const char *part, Edje_Cursor cur)
1680{
1681 Edje *ed;
1682 Edje_Real_Part *rp;
1683
1684 ed = _edje_fetch(obj);
1685 if ((!ed) || (!part)) return NULL;
1686 rp = _edje_real_part_recursive_get(ed, part);
1687 if (!rp) return NULL;
1688 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1689 {
1690 return _edje_entry_cursor_content_get(rp, cur);
1691 }
1692 return NULL;
1693}
1694
1695EAPI void
1696edje_object_part_text_cursor_pos_set(Evas_Object *obj, const char *part, Edje_Cursor cur, int pos)
1697{
1698 Edje *ed;
1699 Edje_Real_Part *rp;
1700
1701 ed = _edje_fetch(obj);
1702 if ((!ed) || (!part)) return;
1703 rp = _edje_real_part_recursive_get(ed, part);
1704 if (!rp) return;
1705 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1706 {
1707 _edje_entry_cursor_pos_set(rp, cur, pos);
1708 }
1709}
1710
1711EAPI int
1712edje_object_part_text_cursor_pos_get(const Evas_Object *obj, const char *part, Edje_Cursor cur)
1713{
1714 Edje *ed;
1715 Edje_Real_Part *rp;
1716
1717 ed = _edje_fetch(obj);
1718 if ((!ed) || (!part)) return 0;
1719 rp = _edje_real_part_recursive_get(ed, part);
1720 if (!rp) return 0;
1721 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1722 {
1723 return _edje_entry_cursor_pos_get(rp, cur);
1724 }
1725 return 0;
1726}
1727
1728EAPI void
1729edje_object_part_text_input_panel_layout_set(const Evas_Object *obj, const char *part, Edje_Input_Panel_Layout layout)
1730{
1731 Edje *ed;
1732 Edje_Real_Part *rp;
1733
1734 ed = _edje_fetch(obj);
1735 if ((!ed) || (!part)) return;
1736 rp = _edje_real_part_recursive_get(ed, part);
1737 if (!rp) return;
1738 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1739 {
1740 return _edje_entry_input_panel_layout_set(rp, layout);
1741 }
1742}
1743
1744EAPI Edje_Input_Panel_Layout
1745edje_object_part_text_input_panel_layout_get(const Evas_Object *obj, const char *part)
1746{
1747 Edje *ed;
1748 Edje_Real_Part *rp;
1749
1750 ed = _edje_fetch(obj);
1751 if ((!ed) || (!part)) return EDJE_INPUT_PANEL_LAYOUT_INVALID;
1752 rp = _edje_real_part_recursive_get(ed, part);
1753 if (!rp) return EINA_FALSE;
1754 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1755 {
1756 return _edje_entry_input_panel_layout_get(rp);
1757 }
1758 return EDJE_INPUT_PANEL_LAYOUT_INVALID;
1759}
1760
1761EAPI void
1762edje_object_part_text_autocapital_type_set(const Evas_Object *obj, const char *part, Edje_Text_Autocapital_Type autocapital_type)
1763{
1764 Edje *ed;
1765 Edje_Real_Part *rp;
1766
1767 ed = _edje_fetch(obj);
1768 if ((!ed) || (!part)) return;
1769 rp = _edje_real_part_recursive_get(ed, (char *)part);
1770 if (!rp) return;
1771 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1772 {
1773 _edje_entry_autocapital_type_set(rp, autocapital_type);
1774 }
1775}
1776
1777EAPI Edje_Text_Autocapital_Type
1778edje_object_part_text_autocapital_type_get(const Evas_Object *obj, const char *part)
1779{
1780 Edje *ed;
1781 Edje_Real_Part *rp;
1782
1783 ed = _edje_fetch(obj);
1784 if ((!ed) || (!part)) return EDJE_TEXT_AUTOCAPITAL_TYPE_NONE;
1785 rp = _edje_real_part_recursive_get(ed, (char *)part);
1786 if (!rp) return EDJE_TEXT_AUTOCAPITAL_TYPE_NONE;
1787 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1788 {
1789 return _edje_entry_autocapital_type_get(rp);
1790 }
1791 return EDJE_TEXT_AUTOCAPITAL_TYPE_NONE;
1792}
1793
1794EAPI void
1795edje_object_part_text_input_panel_enabled_set(const Evas_Object *obj, const char *part, Eina_Bool enabled)
1796{
1797 Edje *ed;
1798 Edje_Real_Part *rp;
1799
1800 ed = _edje_fetch(obj);
1801 if ((!ed) || (!part)) return;
1802 rp = _edje_real_part_recursive_get(ed, part);
1803 if (!rp) return;
1804 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1805 {
1806 return _edje_entry_input_panel_enabled_set(rp, enabled);
1807 }
1808}
1809
1810EAPI Eina_Bool
1811edje_object_part_text_input_panel_enabled_get(const Evas_Object *obj, const char *part)
1812{
1813 Edje *ed;
1814 Edje_Real_Part *rp;
1815
1816 ed = _edje_fetch(obj);
1817 if ((!ed) || (!part)) return EINA_FALSE;
1818 rp = _edje_real_part_recursive_get(ed, part);
1819 if (!rp) return EINA_FALSE;
1820 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1821 {
1822 return _edje_entry_input_panel_enabled_get(rp);
1823 }
1824 return EINA_FALSE;
1825}
1826
1827EAPI void
1828edje_object_text_insert_filter_callback_add(Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func, void *data)
1829{
1830 Edje *ed;
1831 Edje_Text_Insert_Filter_Callback *cb;
1832
1833 ed = _edje_fetch(obj);
1834 if ((!ed) || (!part)) return;
1835 cb = calloc(1, sizeof(Edje_Text_Insert_Filter_Callback));
1836 cb->part = eina_stringshare_add(part);
1837 cb->func = func;
1838 cb->data = (void *)data;
1839 ed->text_insert_filter_callbacks =
1840 eina_list_append(ed->text_insert_filter_callbacks, cb);
1841}
1842
1843EAPI void *
1844edje_object_text_insert_filter_callback_del(Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func)
1845{
1846 Edje *ed;
1847 Edje_Text_Insert_Filter_Callback *cb;
1848 Eina_List *l;
1849
1850 ed = _edje_fetch(obj);
1851 if ((!ed) || (!part)) return NULL;
1852 EINA_LIST_FOREACH(ed->text_insert_filter_callbacks, l, cb)
1853 {
1854 if ((!strcmp(cb->part, part)) && (cb->func == func))
1855 {
1856 void *data = cb->data;
1857 ed->text_insert_filter_callbacks =
1858 eina_list_remove_list(ed->text_insert_filter_callbacks, l);
1859 eina_stringshare_del(cb->part);
1860 free(cb);
1861 return data;
1862 }
1863 }
1864 return NULL;
1865}
1866
1867EAPI void *
1868edje_object_text_insert_filter_callback_del_full(Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func, void *data)
1869{
1870 Edje *ed;
1871 Edje_Text_Insert_Filter_Callback *cb;
1872 Eina_List *l;
1873
1874 ed = _edje_fetch(obj);
1875 if ((!ed) || (!part)) return NULL;
1876 EINA_LIST_FOREACH(ed->text_insert_filter_callbacks, l, cb)
1877 {
1878 if ((!strcmp(cb->part, part)) && (cb->func == func) &&
1879 (cb->data == data))
1880 {
1881 void *tmp = cb->data;
1882 ed->text_insert_filter_callbacks =
1883 eina_list_remove_list(ed->text_insert_filter_callbacks, l);
1884 eina_stringshare_del(cb->part);
1885 free(cb);
1886 return tmp;
1887 }
1888 }
1889 return NULL;
1890}
1891
1892EAPI Eina_Bool
1893edje_object_part_swallow(Evas_Object *obj, const char *part, Evas_Object *obj_swallow)
1894{
1895 Edje *ed;
1896 Edje_Real_Part *rp;
1897
1898 ed = _edje_fetch(obj);
1899 if ((!ed) || (!part)) return EINA_FALSE;
1900
1901 /* Need to recalc before providing the object. */
1902 // XXX: I guess this is not required, removing for testing purposes
1903 // XXX: uncomment if you see glitches in e17 or others.
1904 // XXX: by Gustavo, January 21th 2009.
1905 // XXX: I got a backtrace with over 30000 calls without this,
1906 // XXX: only with 32px shelves. The problem is probably somewhere else,
1907 // XXX: but until it's found, leave this here.
1908 // XXX: by Sachiel, January 21th 2009, 19:30 UTC
1909 _edje_recalc_do(ed);
1910
1911 rp = _edje_real_part_recursive_get(ed, (char *)part);
1912 if (!rp) return EINA_FALSE;
1913 if (rp->part->type != EDJE_PART_TYPE_SWALLOW)
1914 {
1915 ERR("cannot swallow part %s: not swallow type!", rp->part->name);
1916 return EINA_FALSE;
1917 }
1918 _edje_real_part_swallow(rp, obj_swallow, EINA_TRUE);
1919 return EINA_TRUE;
1920}
1921
1922static void
1923_recalc_extern_parent(Evas_Object *obj)
1924{
1925 Evas_Object *parent;
1926 Edje *ed;
1927
1928 parent = evas_object_smart_parent_get(obj);
1929 ed = _edje_fetch(parent);
1930
1931 ed->dirty = 1;
1932 _edje_recalc(ed);
1933}
1934
1935EAPI void
1936edje_extern_object_min_size_set(Evas_Object *obj, Evas_Coord minw, Evas_Coord minh)
1937{
1938 Edje_Real_Part *rp;
1939
1940 evas_object_size_hint_min_set(obj, minw, minh);
1941 rp = evas_object_data_get(obj, "\377 edje.swallowing_part");
1942 if (rp)
1943 {
1944 rp->swallow_params.min.w = minw;
1945 rp->swallow_params.min.h = minh;
1946
1947 _recalc_extern_parent(obj);
1948 }
1949}
1950
1951EAPI void
1952edje_extern_object_max_size_set(Evas_Object *obj, Evas_Coord maxw, Evas_Coord maxh)
1953{
1954 Edje_Real_Part *rp;
1955
1956 evas_object_size_hint_max_set(obj, maxw, maxh);
1957 rp = evas_object_data_get(obj, "\377 edje.swallowing_part");
1958 if (rp)
1959 {
1960 rp->swallow_params.max.w = maxw;
1961 rp->swallow_params.max.h = maxh;
1962
1963 _recalc_extern_parent(obj);
1964 }
1965}
1966
1967EAPI void
1968edje_extern_object_aspect_set(Evas_Object *obj, Edje_Aspect_Control aspect, Evas_Coord aw, Evas_Coord ah)
1969{
1970 Edje_Real_Part *rp;
1971 Evas_Aspect_Control asp;
1972
1973 asp = EVAS_ASPECT_CONTROL_NONE;
1974 switch (aspect)
1975 {
1976 case EDJE_ASPECT_CONTROL_NONE: asp = EVAS_ASPECT_CONTROL_NONE; break;
1977 case EDJE_ASPECT_CONTROL_NEITHER: asp = EVAS_ASPECT_CONTROL_NEITHER; break;
1978 case EDJE_ASPECT_CONTROL_HORIZONTAL: asp = EVAS_ASPECT_CONTROL_HORIZONTAL; break;
1979 case EDJE_ASPECT_CONTROL_VERTICAL: asp = EVAS_ASPECT_CONTROL_VERTICAL; break;
1980 case EDJE_ASPECT_CONTROL_BOTH: asp = EVAS_ASPECT_CONTROL_BOTH; break;
1981 default: break;
1982 }
1983 if (aw < 1) aw = 1;
1984 if (ah < 1) ah = 1;
1985 evas_object_size_hint_aspect_set(obj, asp, aw, ah);
1986 rp = evas_object_data_get(obj, "\377 edje.swallowing_part");
1987 if (rp)
1988 {
1989 rp->swallow_params.aspect.mode = aspect;
1990 rp->swallow_params.aspect.w = aw;
1991 rp->swallow_params.aspect.h = ah;
1992 _recalc_extern_parent(obj);
1993 }
1994}
1995
1996struct edje_box_layout_builtin {
1997 const char *name;
1998 Evas_Object_Box_Layout cb;
1999};
2000
2001static Evas_Object_Box_Layout
2002_edje_box_layout_builtin_find(const char *name)
2003{
2004 const struct edje_box_layout_builtin _edje_box_layout_builtin[] = {
2005 {"horizontal", evas_object_box_layout_horizontal},
2006 {"horizontal_flow", evas_object_box_layout_flow_horizontal},
2007 {"horizontal_homogeneous", evas_object_box_layout_homogeneous_horizontal},
2008 {"horizontal_max", evas_object_box_layout_homogeneous_max_size_horizontal},
2009 {"stack", evas_object_box_layout_stack},
2010 {"vertical", evas_object_box_layout_vertical},
2011 {"vertical_flow", evas_object_box_layout_flow_vertical},
2012 {"vertical_homogeneous", evas_object_box_layout_homogeneous_vertical},
2013 {"vertical_max", evas_object_box_layout_homogeneous_max_size_vertical},
2014 {NULL, NULL}
2015 };
2016 const struct edje_box_layout_builtin *base;
2017
2018 switch (name[0])
2019 {
2020 case 'h':
2021 base = _edje_box_layout_builtin + 0;
2022 break;
2023 case 's':
2024 base = _edje_box_layout_builtin + 4;
2025 break;
2026 case 'v':
2027 base = _edje_box_layout_builtin + 5;
2028 break;
2029 default:
2030 return NULL;
2031 }
2032
2033 for (; (base->name) && (base->name[0] == name[0]); base++)
2034 if (strcmp(base->name, name) == 0)
2035 return base->cb;
2036
2037 return NULL;
2038}
2039
2040static Eina_Rbtree_Direction
2041_edje_box_layout_external_node_cmp(const Eina_Rbtree *left, const Eina_Rbtree *right, __UNUSED__ void *data)
2042{
2043 Edje_Box_Layout *l = (Edje_Box_Layout *)left;
2044 Edje_Box_Layout *r = (Edje_Box_Layout *)right;
2045
2046 if (strcmp(l->name, r->name) < 0)
2047 return EINA_RBTREE_RIGHT;
2048 else
2049 return EINA_RBTREE_LEFT;
2050}
2051
2052static int
2053_edje_box_layout_external_find_cmp(const Eina_Rbtree *node, const void *key, __UNUSED__ int length, __UNUSED__ void *data)
2054{
2055 Edje_Box_Layout *l = (Edje_Box_Layout *)node;
2056 return strcmp(key, l->name);
2057}
2058
2059static Edje_Box_Layout *
2060_edje_box_layout_external_find(const char *name)
2061{
2062 return (Edje_Box_Layout *)eina_rbtree_inline_lookup
2063 (_edje_box_layout_registry, name, 0, _edje_box_layout_external_find_cmp,
2064 NULL);
2065}
2066
2067Eina_Bool
2068_edje_box_layout_find(const char *name, Evas_Object_Box_Layout *cb, void **data, void (**free_data)(void *data))
2069{
2070 const Edje_Box_Layout *l;
2071
2072 if (!name) return EINA_FALSE;
2073
2074 *cb = _edje_box_layout_builtin_find(name);
2075 if (*cb)
2076 {
2077 *free_data = NULL;
2078 *data = NULL;
2079 return EINA_TRUE;
2080 }
2081
2082 l = _edje_box_layout_external_find(name);
2083 if (!l) return EINA_FALSE;
2084
2085 *cb = l->func;
2086 *free_data = l->layout_data_free;
2087 if (l->layout_data_get)
2088 *data = l->layout_data_get(l->data);
2089 else
2090 *data = NULL;
2091
2092 return EINA_TRUE;
2093}
2094
2095static void
2096_edje_box_layout_external_free(Eina_Rbtree *node, __UNUSED__ void *data)
2097{
2098 Edje_Box_Layout *l = (Edje_Box_Layout *)node;
2099
2100 if (l->data && l->free_data)
2101 l->free_data(l->data);
2102 free(l);
2103}
2104
2105static Edje_Box_Layout *
2106_edje_box_layout_external_new(const char *name, Evas_Object_Box_Layout func, void *(*layout_data_get)(void *), void (*layout_data_free)(void *), void (*free_data)(void *), void *data)
2107{
2108 Edje_Box_Layout *l;
2109 size_t name_len;
2110
2111 name_len = strlen(name) + 1;
2112 l = malloc(sizeof(Edje_Box_Layout) + name_len);
2113 if (!l)
2114 {
2115 perror("malloc");
2116 return NULL;
2117 }
2118
2119 l->func = func;
2120 l->layout_data_get = layout_data_get;
2121 l->layout_data_free = layout_data_free;
2122 l->free_data = free_data;
2123 l->data = data;
2124
2125 memcpy(l->name, name, name_len);
2126
2127 return l;
2128}
2129
2130EAPI void
2131edje_box_layout_register(const char *name, Evas_Object_Box_Layout func, void *(*layout_data_get)(void *), void (*layout_data_free)(void *), void (*free_data)(void *), void *data)
2132{
2133 Edje_Box_Layout *l;
2134
2135 if (!name) return;
2136
2137 if (_edje_box_layout_builtin_find(name))
2138 {
2139 ERR("Cannot register layout '%s': would override builtin!",
2140 name);
2141
2142 if (data && free_data) free_data(data);
2143 return;
2144 }
2145
2146 l = _edje_box_layout_external_find(name);
2147 if (!l)
2148 {
2149 if (!func)
2150 {
2151 if (data && free_data) free_data(data);
2152 return;
2153 }
2154
2155 l = _edje_box_layout_external_new
2156 (name, func, layout_data_get, layout_data_free, free_data, data);
2157 if (!l)
2158 return;
2159
2160 _edje_box_layout_registry = eina_rbtree_inline_insert
2161 (_edje_box_layout_registry, (Eina_Rbtree *)l,
2162 _edje_box_layout_external_node_cmp, NULL);
2163 }
2164 else
2165 {
2166 if (func)
2167 {
2168 if (l->data && l->free_data) l->free_data(l->data);
2169
2170 l->func = func;
2171 l->layout_data_get = layout_data_get;
2172 l->layout_data_free = layout_data_free;
2173 l->free_data = free_data;
2174 l->data = data;
2175 }
2176 else
2177 {
2178 if (data && free_data) free_data(data);
2179
2180 _edje_box_layout_registry = eina_rbtree_inline_remove
2181 (_edje_box_layout_registry, (Eina_Rbtree *)l,
2182 _edje_box_layout_external_node_cmp, NULL);
2183 _edje_box_layout_external_free((Eina_Rbtree *)l, NULL);
2184 }
2185 }
2186}
2187
2188EAPI void
2189edje_object_part_unswallow(Evas_Object *obj __UNUSED__, Evas_Object *obj_swallow)
2190{
2191 Edje_Real_Part *rp;
2192
2193 if (!obj_swallow) return;
2194
2195 rp = (Edje_Real_Part *)evas_object_data_get(obj_swallow, "\377 edje.swallowing_part");
2196 if (!rp)
2197 return;
2198 if (rp->part->type != EDJE_PART_TYPE_SWALLOW)
2199 {
2200 ERR("cannot unswallow part %s: not swallow type!", rp->part->name);
2201 return;
2202 }
2203 if (rp->swallowed_object == obj_swallow)
2204 {
2205 evas_object_smart_member_del(rp->swallowed_object);
2206 evas_object_event_callback_del_full(rp->swallowed_object,
2207 EVAS_CALLBACK_FREE,
2208 _edje_object_part_swallow_free_cb,
2209 rp->edje->obj);
2210 evas_object_event_callback_del_full(rp->swallowed_object,
2211 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2212 _edje_object_part_swallow_changed_hints_cb,
2213 rp);
2214 evas_object_clip_unset(rp->swallowed_object);
2215 evas_object_data_del(rp->swallowed_object, "\377 edje.swallowing_part");
2216
2217 if (rp->part->mouse_events)
2218 _edje_callbacks_del(rp->swallowed_object, rp->edje);
2219 _edje_callbacks_focus_del(rp->swallowed_object, rp->edje);
2220
2221 rp->swallowed_object = NULL;
2222 rp->swallow_params.min.w = 0;
2223 rp->swallow_params.min.h = 0;
2224 rp->swallow_params.max.w = 0;
2225 rp->swallow_params.max.h = 0;
2226 rp->edje->dirty = 1;
2227#ifdef EDJE_CALC_CACHE
2228 rp->invalidate = 1;
2229#endif
2230 _edje_recalc_do(rp->edje);
2231 return;
2232 }
2233}
2234
2235EAPI Evas_Object *
2236edje_object_part_swallow_get(const Evas_Object *obj, const char *part)
2237{
2238 Edje *ed;
2239 Edje_Real_Part *rp;
2240
2241 ed = _edje_fetch(obj);
2242 if ((!ed) || (!part)) return NULL;
2243
2244 /* Need to recalc before providing the object. */
2245 _edje_recalc_do(ed);
2246
2247 rp = _edje_real_part_recursive_get(ed, (char *)part);
2248 if (!rp) return NULL;
2249 return rp->swallowed_object;
2250}
2251
2252EAPI void
2253edje_object_size_min_get(const Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh)
2254{
2255 Edje *ed;
2256
2257 ed = _edje_fetch(obj);
2258 if ((!ed) || (!ed->collection))
2259 {
2260 if (minw) *minw = 0;
2261 if (minh) *minh = 0;
2262 return;
2263 }
2264 if (minw) *minw = ed->collection->prop.min.w;
2265 if (minh) *minh = ed->collection->prop.min.h;
2266}
2267
2268EAPI void
2269edje_object_size_max_get(const Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh)
2270{
2271 Edje *ed;
2272
2273 ed = _edje_fetch(obj);
2274 if ((!ed) || (!ed->collection))
2275 {
2276 if (maxw) *maxw = 0;
2277 if (maxh) *maxh = 0;
2278 return;
2279 }
2280
2281 /* Need to recalc before providing the object. */
2282 _edje_recalc_do(ed);
2283
2284 if (ed->collection->prop.max.w == 0)
2285 {
2286 /* XXX TODO: convert maxw to 0, fix things that break. */
2287 if (maxw) *maxw = EDJE_INF_MAX_W;
2288 }
2289 else
2290 {
2291 if (maxw) *maxw = ed->collection->prop.max.w;
2292 }
2293 if (ed->collection->prop.max.h == 0)
2294 {
2295 /* XXX TODO: convert maxh to 0, fix things that break. */
2296 if (maxh) *maxh = EDJE_INF_MAX_H;
2297 }
2298 else
2299 {
2300 if (maxh) *maxh = ed->collection->prop.max.h;
2301 }
2302}
2303
2304EAPI void
2305edje_object_calc_force(Evas_Object *obj)
2306{
2307 Edje *ed;
2308 int pf, pf2;
2309
2310 ed = _edje_fetch(obj);
2311 if (!ed) return;
2312 ed->dirty = 1;
2313#ifdef EDJE_CALC_CACHE
2314 ed->all_part_change = 1;
2315#endif
2316
2317 pf2 = _edje_freeze_val;
2318 pf = ed->freeze;
2319
2320 _edje_freeze_val = 0;
2321 ed->freeze = 0;
2322
2323 _edje_recalc_do(ed);
2324
2325 ed->freeze = pf;
2326 _edje_freeze_val = pf2;
2327}
2328
2329EAPI void
2330edje_object_size_min_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh)
2331{
2332 edje_object_size_min_restricted_calc(obj, minw, minh, 0, 0);
2333}
2334
2335EAPI Eina_Bool
2336edje_object_parts_extends_calc(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
2337{
2338 Edje *ed;
2339 Evas_Coord x1 = INT_MAX, y1 = INT_MAX;
2340 Evas_Coord x2 = 0, y2 = 0;
2341 unsigned int i;
2342
2343 ed = _edje_fetch(obj);
2344 if (!ed)
2345 {
2346 if (x) *x = 0;
2347 if (y) *y = 0;
2348 if (w) *w = 0;
2349 if (h) *h = 0;
2350 return EINA_FALSE;
2351 }
2352
2353 ed->calc_only = 1;
2354
2355 /* Need to recalc before providing the object. */
2356 ed->dirty = 1;
2357 _edje_recalc_do(ed);
2358
2359 for (i = 0; i < ed->table_parts_size; i++)
2360 {
2361 Edje_Real_Part *rp;
2362 Evas_Coord rpx1, rpy1;
2363 Evas_Coord rpx2, rpy2;
2364
2365 rp = ed->table_parts[i];
2366
2367 rpx1 = rp->x;
2368 rpy1 = rp->y;
2369 rpx2 = rpx1 + rp->w;
2370 rpy2 = rpy1 + rp->h;
2371
2372 if (x1 > rpx1) x1 = rpx1;
2373 if (y1 > rpy1) y1 = rpy1;
2374 if (x2 < rpx2) x2 = rpx2;
2375 if (y2 < rpy2) y2 = rpy2;
2376 }
2377
2378 ed->calc_only = 0;
2379
2380 if (x) *x = x1;
2381 if (y) *y = y1;
2382 if (w) *w = x2 - x1;
2383 if (h) *h = y2 - y1;
2384
2385 return EINA_TRUE;
2386}
2387
2388EAPI void
2389edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh, Evas_Coord restrictedw, Evas_Coord restrictedh)
2390{
2391 Edje *ed;
2392 Evas_Coord pw, ph;
2393 int maxw, maxh;
2394 int okw, okh;
2395 int reset_maxwh;
2396 Edje_Real_Part *pep = NULL;
2397 Eina_Bool has_non_fixed_tb = EINA_FALSE;
2398
2399 ed = _edje_fetch(obj);
2400 if ((!ed) || (!ed->collection))
2401 {
2402 if (minw) *minw = restrictedw;
2403 if (minh) *minh = restrictedh;
2404 return;
2405 }
2406 reset_maxwh = 1;
2407 ed->calc_only = 1;
2408 pw = ed->w;
2409 ph = ed->h;
2410
2411 again:
2412 ed->w = restrictedw;
2413 ed->h = restrictedh;
2414
2415 maxw = 0;
2416 maxh = 0;
2417
2418 do
2419 {
2420 unsigned int i;
2421
2422 okw = okh = 0;
2423 ed->dirty = 1;
2424#ifdef EDJE_CALC_CACHE
2425 ed->all_part_change = 1;
2426#endif
2427 _edje_recalc_do(ed);
2428 if (reset_maxwh)
2429 {
2430 maxw = 0;
2431 maxh = 0;
2432 }
2433 pep = NULL;
2434 for (i = 0; i < ed->table_parts_size; i++)
2435 {
2436 Edje_Real_Part *ep;
2437 int w, h;
2438 int didw;
2439
2440 ep = ed->table_parts[i];
2441 w = ep->w - ep->req.w;
2442 h = ep->h - ep->req.h;
2443 didw = 0;
2444 if (ep->chosen_description)
2445 {
2446 if (!ep->chosen_description->fixed.w)
2447 {
2448 if ((ep->part->type == EDJE_PART_TYPE_TEXTBLOCK))
2449 {
2450 Evas_Coord tb_mw;
2451 evas_object_textblock_size_formatted_get(ep->object,
2452 &tb_mw, NULL);
2453 tb_mw -= ep->req.w;
2454 if (tb_mw > w)
2455 {
2456 w = tb_mw;
2457 }
2458 has_non_fixed_tb = EINA_TRUE;
2459 }
2460 if (w > maxw)
2461 {
2462 maxw = w;
2463 okw = 1;
2464 pep = ep;
2465 didw = 1;
2466 }
2467 }
2468 if (!ep->chosen_description->fixed.h)
2469 {
2470 if (!((ep->part->type == EDJE_PART_TYPE_TEXTBLOCK) &&
2471 (!((Edje_Part_Description_Text *)ep->chosen_description)->text.min_x) &&
2472 (didw)))
2473 {
2474 if (h > maxh)
2475 {
2476 maxh = h;
2477 okh = 1;
2478 pep = ep;
2479 }
2480 }
2481
2482 if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK)
2483 {
2484 has_non_fixed_tb = EINA_TRUE;
2485 }
2486 }
2487 }
2488 }
2489 if (okw)
2490 {
2491 ed->w += maxw;
2492 if (ed->w < restrictedw) ed->w = restrictedw;
2493 }
2494 if (okh)
2495 {
2496 ed->h += maxh;
2497 if (ed->h < restrictedh) ed->h = restrictedh;
2498 }
2499 if ((ed->w > 4000) || (ed->h > 4000))
2500 {
2501 /* Only print it if we have a non-fixed textblock.
2502 * We should possibly avoid all of this if in this case, but in
2503 * the meanwhile, just doing this. */
2504 if (!has_non_fixed_tb)
2505 {
2506 if (pep)
2507 ERR("file %s, group %s has a non-fixed part '%s'. Adding 'fixed: 1 1;' to source EDC may help. Continuing discarding faulty part.",
2508 ed->path, ed->group, pep->part->name);
2509 else
2510 ERR("file %s, group %s overflowed 4000x4000 with minimum size of %dx%d. Continuing discarding faulty parts.",
2511 ed->path, ed->group, ed->w, ed->h);
2512 }
2513
2514 if (reset_maxwh)
2515 {
2516 reset_maxwh = 0;
2517 goto again;
2518 }
2519 }
2520 }
2521 while (okw || okh);
2522 ed->min.w = ed->w;
2523 ed->min.h = ed->h;
2524
2525 if (minw) *minw = ed->min.w;
2526 if (minh) *minh = ed->min.h;
2527
2528 ed->w = pw;
2529 ed->h = ph;
2530 ed->dirty = 1;
2531#ifdef EDJE_CALC_CACHE
2532 ed->all_part_change = 1;
2533#endif
2534 _edje_recalc(ed);
2535 ed->calc_only = 0;
2536}
2537
2538/* FIXME: Correctly return other states */
2539EAPI const char *
2540edje_object_part_state_get(const Evas_Object *obj, const char *part, double *val_ret)
2541{
2542 Edje *ed;
2543 Edje_Real_Part *rp;
2544
2545 ed = _edje_fetch(obj);
2546 if ((!ed) || (!part))
2547 {
2548 if (val_ret) *val_ret = 0;
2549 return "";
2550 }
2551
2552 /* Need to recalc before providing the object. */
2553 _edje_recalc_do(ed);
2554
2555 rp = _edje_real_part_recursive_get(ed, (char *)part);
2556 if (!rp)
2557 {
2558 if (val_ret) *val_ret = 0;
2559 INF("part not found");
2560 return "";
2561 }
2562 if (rp->chosen_description)
2563 {
2564 if (val_ret) *val_ret = rp->chosen_description->state.value;
2565 if (rp->chosen_description->state.name)
2566 return rp->chosen_description->state.name;
2567 return "default";
2568 }
2569 else
2570 {
2571 if (rp->param1.description)
2572 {
2573 if (val_ret) *val_ret = rp->param1.description->state.value;
2574 if (rp->param1.description->state.name)
2575 return rp->param1.description->state.name;
2576 return "default";
2577 }
2578 }
2579 if (val_ret) *val_ret = 0;
2580 return "";
2581}
2582
2583EAPI Edje_Drag_Dir
2584edje_object_part_drag_dir_get(const Evas_Object *obj, const char *part)
2585{
2586 Edje *ed;
2587 Edje_Real_Part *rp;
2588
2589 ed = _edje_fetch(obj);
2590 if ((!ed) || (!part)) return EDJE_DRAG_DIR_NONE;
2591
2592 /* Need to recalc before providing the object. */
2593 _edje_recalc_do(ed);
2594
2595 rp = _edje_real_part_recursive_get(ed, (char *)part);
2596 if (!rp) return EDJE_DRAG_DIR_NONE;
2597 if ((rp->part->dragable.x) && (rp->part->dragable.y)) return EDJE_DRAG_DIR_XY;
2598 else if (rp->part->dragable.x) return EDJE_DRAG_DIR_X;
2599 else if (rp->part->dragable.y) return EDJE_DRAG_DIR_Y;
2600 return EDJE_DRAG_DIR_NONE;
2601}
2602
2603EAPI Eina_Bool
2604edje_object_part_drag_value_set(Evas_Object *obj, const char *part, double dx, double dy)
2605{
2606 Edje *ed;
2607 Edje_Real_Part *rp;
2608
2609 ed = _edje_fetch(obj);
2610 if ((!ed) || (!part)) return EINA_FALSE;
2611 rp = _edje_real_part_recursive_get(ed, (char *)part);
2612 if (!rp) return EINA_FALSE;
2613 if (!rp->drag) return EINA_FALSE;
2614 if (rp->drag->down.count > 0) return EINA_FALSE;
2615 if (rp->part->dragable.confine_id != -1)
2616 {
2617 dx = CLAMP(dx, 0.0, 1.0);
2618 dy = CLAMP(dy, 0.0, 1.0);
2619 }
2620 if (rp->part->dragable.x < 0) dx = 1.0 - dx;
2621 if (rp->part->dragable.y < 0) dy = 1.0 - dy;
2622 if ((rp->drag->val.x == FROM_DOUBLE(dx)) && (rp->drag->val.y == FROM_DOUBLE(dy))) return EINA_TRUE;
2623 rp->drag->val.x = FROM_DOUBLE(dx);
2624 rp->drag->val.y = FROM_DOUBLE(dy);
2625#ifdef EDJE_CALC_CACHE
2626 rp->invalidate = 1;
2627#endif
2628 _edje_dragable_pos_set(rp->edje, rp, rp->drag->val.x, rp->drag->val.y);
2629 _edje_emit(rp->edje, "drag,set", rp->part->name);
2630 return EINA_TRUE;
2631}
2632
2633/* FIXME: Should this be x and y instead of dx/dy? */
2634EAPI Eina_Bool
2635edje_object_part_drag_value_get(const Evas_Object *obj, const char *part, double *dx, double *dy)
2636{
2637 Edje *ed;
2638 Edje_Real_Part *rp;
2639 double ddx, ddy;
2640
2641 ed = _edje_fetch(obj);
2642 if ((!ed) || (!part))
2643 {
2644 if (dx) *dx = 0;
2645 if (dy) *dy = 0;
2646 return EINA_FALSE;
2647 }
2648
2649 /* Need to recalc before providing the object. */
2650 _edje_recalc_do(ed);
2651
2652 rp = _edje_real_part_recursive_get(ed, (char *)part);
2653 if (!rp || !rp->drag)
2654 {
2655 if (dx) *dx = 0;
2656 if (dy) *dy = 0;
2657 return EINA_FALSE;
2658 }
2659 ddx = TO_DOUBLE(rp->drag->val.x);
2660 ddy = TO_DOUBLE(rp->drag->val.y);
2661 if (rp->part->dragable.x < 0) ddx = 1.0 - ddx;
2662 if (rp->part->dragable.y < 0) ddy = 1.0 - ddy;
2663 if (dx) *dx = ddx;
2664 if (dy) *dy = ddy;
2665 return EINA_TRUE;
2666}
2667
2668EAPI Eina_Bool
2669edje_object_part_drag_size_set(Evas_Object *obj, const char *part, double dw, double dh)
2670{
2671 Edje *ed;
2672 Edje_Real_Part *rp;
2673
2674 ed = _edje_fetch(obj);
2675 if ((!ed) || (!part)) return EINA_FALSE;
2676 rp = _edje_real_part_recursive_get(ed, (char *)part);
2677 if (!rp) return EINA_FALSE;
2678 if (!rp->drag) return EINA_FALSE;
2679 if (dw < 0.0) dw = 0.0;
2680 else if (dw > 1.0) dw = 1.0;
2681 if (dh < 0.0) dh = 0.0;
2682 else if (dh > 1.0) dh = 1.0;
2683 if ((rp->drag->size.x == FROM_DOUBLE(dw)) && (rp->drag->size.y == FROM_DOUBLE(dh))) return EINA_TRUE;
2684 rp->drag->size.x = FROM_DOUBLE(dw);
2685 rp->drag->size.y = FROM_DOUBLE(dh);
2686 rp->edje->dirty = 1;
2687#ifdef EDJE_CALC_CACHE
2688 rp->invalidate = 1;
2689#endif
2690 _edje_recalc(rp->edje);
2691 return EINA_TRUE;
2692}
2693
2694EAPI Eina_Bool
2695edje_object_part_drag_size_get(const Evas_Object *obj, const char *part, double *dw, double *dh)
2696{
2697 Edje *ed;
2698 Edje_Real_Part *rp;
2699
2700 ed = _edje_fetch(obj);
2701 if ((!ed) || (!part))
2702 {
2703 if (dw) *dw = 0;
2704 if (dh) *dh = 0;
2705 return EINA_FALSE;
2706 }
2707
2708 /* Need to recalc before providing the object. */
2709 _edje_recalc_do(ed);
2710
2711 rp = _edje_real_part_recursive_get(ed, (char *)part);
2712 if (!rp || !rp->drag)
2713 {
2714 if (dw) *dw = 0;
2715 if (dh) *dh = 0;
2716 return EINA_FALSE;
2717 }
2718 if (dw) *dw = TO_DOUBLE(rp->drag->size.x);
2719 if (dh) *dh = TO_DOUBLE(rp->drag->size.y);
2720 return EINA_TRUE;
2721}
2722
2723EAPI Eina_Bool
2724edje_object_part_drag_step_set(Evas_Object *obj, const char *part, double dx, double dy)
2725{
2726 Edje *ed;
2727 Edje_Real_Part *rp;
2728
2729 ed = _edje_fetch(obj);
2730 if ((!ed) || (!part)) return EINA_FALSE;
2731 rp = _edje_real_part_recursive_get(ed, (char *)part);
2732 if (!rp) return EINA_FALSE;
2733 if (!rp->drag) return EINA_FALSE;
2734 if (dx < 0.0) dx = 0.0;
2735 else if (dx > 1.0) dx = 1.0;
2736 if (dy < 0.0) dy = 0.0;
2737 else if (dy > 1.0) dy = 1.0;
2738 rp->drag->step.x = FROM_DOUBLE(dx);
2739 rp->drag->step.y = FROM_DOUBLE(dy);
2740#ifdef EDJE_CALC_CACHE
2741 rp->invalidate = 1;
2742#endif
2743 return EINA_TRUE;
2744}
2745
2746EAPI Eina_Bool
2747edje_object_part_drag_step_get(const Evas_Object *obj, const char *part, double *dx, double *dy)
2748{
2749 Edje *ed;
2750 Edje_Real_Part *rp;
2751
2752 ed = _edje_fetch(obj);
2753 if ((!ed) || (!part))
2754 {
2755 if (dx) *dx = 0;
2756 if (dy) *dy = 0;
2757 return EINA_FALSE;
2758 }
2759
2760 /* Need to recalc before providing the object. */
2761 _edje_recalc_do(ed);
2762
2763 rp = _edje_real_part_recursive_get(ed, (char *)part);
2764 if (!rp || !rp->drag)
2765 {
2766 if (dx) *dx = 0;
2767 if (dy) *dy = 0;
2768 return EINA_FALSE;
2769 }
2770 if (dx) *dx = TO_DOUBLE(rp->drag->step.x);
2771 if (dy) *dy = TO_DOUBLE(rp->drag->step.y);
2772 return EINA_TRUE;
2773}
2774
2775EAPI Eina_Bool
2776edje_object_part_drag_page_set(Evas_Object *obj, const char *part, double dx, double dy)
2777{
2778 Edje *ed;
2779 Edje_Real_Part *rp;
2780
2781 ed = _edje_fetch(obj);
2782 if ((!ed) || (!part)) return EINA_FALSE;
2783 rp = _edje_real_part_recursive_get(ed, (char *)part);
2784 if (!rp) return EINA_FALSE;
2785 if (!rp->drag) return EINA_FALSE;
2786 if (dx < 0.0) dx = 0.0;
2787 else if (dx > 1.0) dx = 1.0;
2788 if (dy < 0.0) dy = 0.0;
2789 else if (dy > 1.0) dy = 1.0;
2790 rp->drag->page.x = FROM_DOUBLE(dx);
2791 rp->drag->page.y = FROM_DOUBLE(dy);
2792#ifdef EDJE_CALC_CACHE
2793 rp->invalidate = 1;
2794#endif
2795 return EINA_TRUE;
2796}
2797
2798EAPI Eina_Bool
2799edje_object_part_drag_page_get(const Evas_Object *obj, const char *part, double *dx, double *dy)
2800{
2801 Edje *ed;
2802 Edje_Real_Part *rp;
2803
2804 ed = _edje_fetch(obj);
2805 if ((!ed) || (!part))
2806 {
2807 if (dx) *dx = 0;
2808 if (dy) *dy = 0;
2809 return EINA_FALSE;
2810 }
2811
2812 /* Need to recalc before providing the object. */
2813 _edje_recalc_do(ed);
2814
2815 rp = _edje_real_part_recursive_get(ed, (char *)part);
2816 if (!rp || !rp->drag)
2817 {
2818 if (dx) *dx = 0;
2819 if (dy) *dy = 0;
2820 return EINA_FALSE;
2821 }
2822 if (dx) *dx = TO_DOUBLE(rp->drag->page.x);
2823 if (dy) *dy = TO_DOUBLE(rp->drag->page.y);
2824 return EINA_TRUE;
2825}
2826
2827EAPI Eina_Bool
2828edje_object_part_drag_step(Evas_Object *obj, const char *part, double dx, double dy)
2829{
2830 Edje *ed;
2831 Edje_Real_Part *rp;
2832 FLOAT_T px, py;
2833
2834 ed = _edje_fetch(obj);
2835 if ((!ed) || (!part)) return EINA_FALSE;
2836 rp = _edje_real_part_recursive_get(ed, (char *)part);
2837 if (!rp) return EINA_FALSE;
2838 if (!rp->drag) return EINA_FALSE;
2839 if (rp->drag->down.count > 0) return EINA_FALSE;
2840 px = rp->drag->val.x;
2841 py = rp->drag->val.y;
2842 rp->drag->val.x = ADD(px, MUL(FROM_DOUBLE(dx),
2843 MUL(rp->drag->step.x, rp->part->dragable.x)));
2844 rp->drag->val.y = ADD(py, MUL(FROM_DOUBLE(dy),
2845 MUL(rp->drag->step.y, rp->part->dragable.y)));
2846 rp->drag->val.x = CLAMP (rp->drag->val.x, ZERO, FROM_DOUBLE(1.0));
2847 rp->drag->val.y = CLAMP (rp->drag->val.y, ZERO, FROM_DOUBLE(1.0));
2848 if ((px == rp->drag->val.x) && (py == rp->drag->val.y)) return EINA_TRUE;
2849#ifdef EDJE_CALC_CACHE
2850 rp->invalidate = 1;
2851#endif
2852 _edje_dragable_pos_set(rp->edje, rp, rp->drag->val.x, rp->drag->val.y);
2853 _edje_emit(rp->edje, "drag,step", rp->part->name);
2854 return EINA_TRUE;
2855}
2856
2857EAPI Eina_Bool
2858edje_object_part_drag_page(Evas_Object *obj, const char *part, double dx, double dy)
2859{
2860 Edje *ed;
2861 Edje_Real_Part *rp;
2862 FLOAT_T px, py;
2863
2864 ed = _edje_fetch(obj);
2865 if ((!ed) || (!part)) return EINA_FALSE;
2866 rp = _edje_real_part_recursive_get(ed, (char *)part);
2867 if (!rp) return EINA_FALSE;
2868 if (!rp->drag) return EINA_FALSE;
2869 if (rp->drag->down.count > 0) return EINA_FALSE;
2870 px = rp->drag->val.x;
2871 py = rp->drag->val.y;
2872 rp->drag->val.x = ADD(px, MUL(FROM_DOUBLE(dx), MUL(rp->drag->page.x, rp->part->dragable.x)));
2873 rp->drag->val.y = ADD(py, MUL(FROM_DOUBLE(dy), MUL(rp->drag->page.y, rp->part->dragable.y)));
2874 rp->drag->val.x = CLAMP (rp->drag->val.x, ZERO, FROM_DOUBLE(1.0));
2875 rp->drag->val.y = CLAMP (rp->drag->val.y, ZERO, FROM_DOUBLE(1.0));
2876 if ((px == rp->drag->val.x) && (py == rp->drag->val.y)) return EINA_TRUE;
2877#ifdef EDJE_CALC_CACHE
2878 rp->invalidate = 1;
2879#endif
2880 _edje_dragable_pos_set(rp->edje, rp, rp->drag->val.x, rp->drag->val.y);
2881 _edje_emit(rp->edje, "drag,page", rp->part->name);
2882 return EINA_TRUE;
2883}
2884
2885void
2886_edje_box_init(void)
2887{
2888
2889}
2890
2891void
2892_edje_box_shutdown(void)
2893{
2894 if (!_edje_box_layout_registry)
2895 return;
2896
2897 eina_rbtree_delete
2898 (_edje_box_layout_registry, _edje_box_layout_external_free, NULL);
2899 _edje_box_layout_registry = NULL;
2900}
2901
2902EAPI Eina_Bool
2903edje_object_part_box_append(Evas_Object *obj, const char *part, Evas_Object *child)
2904{
2905 Edje *ed;
2906 Edje_Real_Part *rp;
2907
2908 ed = _edje_fetch(obj);
2909 if ((!ed) || (!part) || (!child)) return EINA_FALSE;
2910
2911 rp = _edje_real_part_recursive_get(ed, part);
2912 if (!rp) return EINA_FALSE;
2913 if (rp->part->type != EDJE_PART_TYPE_BOX) return EINA_FALSE;
2914
2915 return _edje_real_part_box_append(rp, child);
2916}
2917
2918EAPI Eina_Bool
2919edje_object_part_box_prepend(Evas_Object *obj, const char *part, Evas_Object *child)
2920{
2921 Edje *ed;
2922 Edje_Real_Part *rp;
2923
2924 ed = _edje_fetch(obj);
2925 if ((!ed) || (!part)) return EINA_FALSE;
2926
2927 rp = _edje_real_part_recursive_get(ed, part);
2928 if (!rp) return EINA_FALSE;
2929 if (rp->part->type != EDJE_PART_TYPE_BOX) return EINA_FALSE;
2930
2931 return _edje_real_part_box_prepend(rp, child);
2932}
2933
2934EAPI Eina_Bool
2935edje_object_part_box_insert_before(Evas_Object *obj, const char *part, Evas_Object *child, const Evas_Object *reference)
2936{
2937 Edje *ed;
2938 Edje_Real_Part *rp;
2939
2940 ed = _edje_fetch(obj);
2941 if ((!ed) || (!part)) return EINA_FALSE;
2942
2943 rp = _edje_real_part_recursive_get(ed, part);
2944 if (!rp) return EINA_FALSE;
2945 if (rp->part->type != EDJE_PART_TYPE_BOX) return EINA_FALSE;
2946
2947 return _edje_real_part_box_insert_before(rp, child, reference);
2948}
2949
2950EAPI Eina_Bool
2951edje_object_part_box_insert_at(Evas_Object *obj, const char *part, Evas_Object *child, unsigned int pos)
2952{
2953 Edje *ed;
2954 Edje_Real_Part *rp;
2955
2956 ed = _edje_fetch(obj);
2957 if ((!ed) || (!part)) return EINA_FALSE;
2958
2959 rp = _edje_real_part_recursive_get(ed, part);
2960 if (!rp) return EINA_FALSE;
2961 if (rp->part->type != EDJE_PART_TYPE_BOX) return EINA_FALSE;
2962
2963 return _edje_real_part_box_insert_at(rp, child, pos);
2964}
2965
2966EAPI Evas_Object *
2967edje_object_part_box_remove(Evas_Object *obj, const char *part, Evas_Object *child)
2968{
2969 Edje *ed;
2970 Edje_Real_Part *rp;
2971
2972 ed = _edje_fetch(obj);
2973 if ((!ed) || (!part)) return NULL;
2974
2975 rp = _edje_real_part_recursive_get(ed, part);
2976 if (!rp) return NULL;
2977 if (rp->part->type != EDJE_PART_TYPE_BOX) return NULL;
2978
2979 return _edje_real_part_box_remove(rp, child);
2980}
2981
2982EAPI Evas_Object *
2983edje_object_part_box_remove_at(Evas_Object *obj, const char *part, unsigned int pos)
2984{
2985 Edje *ed;
2986 Edje_Real_Part *rp;
2987
2988 ed = _edje_fetch(obj);
2989 if ((!ed) || (!part)) return NULL;
2990
2991 rp = _edje_real_part_recursive_get(ed, part);
2992 if (!rp) return NULL;
2993 if (rp->part->type != EDJE_PART_TYPE_BOX) return NULL;
2994
2995 return _edje_real_part_box_remove_at(rp, pos);
2996}
2997
2998EAPI Eina_Bool
2999edje_object_part_box_remove_all(Evas_Object *obj, const char *part, Eina_Bool clear)
3000{
3001 Edje *ed;
3002 Edje_Real_Part *rp;
3003
3004 ed = _edje_fetch(obj);
3005 if ((!ed) || (!part)) return EINA_FALSE;
3006
3007 rp = _edje_real_part_recursive_get(ed, part);
3008 if (!rp) return EINA_FALSE;
3009 if (rp->part->type != EDJE_PART_TYPE_BOX) return EINA_FALSE;
3010
3011 return _edje_real_part_box_remove_all(rp, clear);
3012
3013}
3014
3015static void
3016_edje_box_child_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *child __UNUSED__, void *einfo __UNUSED__)
3017{
3018 Edje_Real_Part *rp = data;
3019
3020 rp->edje->dirty = 1;
3021#ifdef EDJE_CALC_CACHE
3022 rp->invalidate = 1;
3023#endif
3024 _edje_recalc(rp->edje);
3025}
3026
3027static void
3028_edje_box_child_add(Edje_Real_Part *rp, Evas_Object *child)
3029{
3030 evas_object_event_callback_add
3031 (child, EVAS_CALLBACK_DEL, _edje_box_child_del_cb, rp);
3032
3033 rp->edje->dirty = 1;
3034#ifdef EDJE_CALC_CACHE
3035 rp->invalidate = 1;
3036#endif
3037 _edje_recalc(rp->edje);
3038}
3039
3040static void
3041_edje_box_child_remove(Edje_Real_Part *rp, Evas_Object *child)
3042{
3043 evas_object_event_callback_del_full
3044 (child, EVAS_CALLBACK_DEL, _edje_box_child_del_cb, rp);
3045
3046 rp->edje->dirty = 1;
3047#ifdef EDJE_CALC_CACHE
3048 rp->invalidate = 1;
3049#endif
3050 _edje_recalc(rp->edje);
3051}
3052
3053Eina_Bool
3054_edje_real_part_box_append(Edje_Real_Part *rp, Evas_Object *child_obj)
3055{
3056 Evas_Object_Box_Option *opt;
3057
3058 opt = evas_object_box_append(rp->object, child_obj);
3059 if (!opt) return EINA_FALSE;
3060
3061 if (!_edje_box_layout_add_child(rp, child_obj))
3062 {
3063 evas_object_box_remove(rp->object, child_obj);
3064 return EINA_FALSE;
3065 }
3066
3067 _edje_box_child_add(rp, child_obj);
3068
3069 return EINA_TRUE;
3070}
3071
3072Eina_Bool
3073_edje_real_part_box_prepend(Edje_Real_Part *rp, Evas_Object *child_obj)
3074{
3075 Evas_Object_Box_Option *opt;
3076
3077 opt = evas_object_box_prepend(rp->object, child_obj);
3078 if (!opt) return EINA_FALSE;
3079
3080 if (!_edje_box_layout_add_child(rp, child_obj))
3081 {
3082 evas_object_box_remove(rp->object, child_obj);
3083 return EINA_FALSE;
3084 }
3085
3086 _edje_box_child_add(rp, child_obj);
3087
3088 return EINA_TRUE;
3089}
3090
3091Eina_Bool
3092_edje_real_part_box_insert_before(Edje_Real_Part *rp, Evas_Object *child_obj, const Evas_Object *ref)
3093{
3094 Evas_Object_Box_Option *opt;
3095
3096 opt = evas_object_box_insert_before(rp->object, child_obj, ref);
3097 if (!opt) return EINA_FALSE;
3098
3099 if (!_edje_box_layout_add_child(rp, child_obj))
3100 {
3101 evas_object_box_remove(rp->object, child_obj);
3102 return EINA_FALSE;
3103 }
3104
3105 _edje_box_child_add(rp, child_obj);
3106
3107 return EINA_TRUE;
3108}
3109
3110Eina_Bool
3111_edje_real_part_box_insert_at(Edje_Real_Part *rp, Evas_Object *child_obj, unsigned int pos)
3112{
3113 Evas_Object_Box_Option *opt;
3114
3115 opt = evas_object_box_insert_at(rp->object, child_obj, pos);
3116 if (!opt) return EINA_FALSE;
3117
3118 if (!_edje_box_layout_add_child(rp, child_obj))
3119 {
3120 evas_object_box_remove(rp->object, child_obj);
3121 return EINA_FALSE;
3122 }
3123
3124 _edje_box_child_add(rp, child_obj);
3125
3126 return EINA_TRUE;
3127}
3128
3129Evas_Object *
3130_edje_real_part_box_remove(Edje_Real_Part *rp, Evas_Object *child_obj)
3131{
3132 if (evas_object_data_get(child_obj, "\377 edje.box_item")) return NULL;
3133 if (!evas_object_box_remove(rp->object, child_obj)) return NULL;
3134 _edje_box_layout_remove_child(rp, child_obj);
3135 _edje_box_child_remove(rp, child_obj);
3136 return child_obj;
3137}
3138
3139Evas_Object *
3140_edje_real_part_box_remove_at(Edje_Real_Part *rp, unsigned int pos)
3141{
3142 Evas_Object_Box_Option *opt;
3143 Evas_Object_Box_Data *priv;
3144 Evas_Object *child_obj;
3145
3146 priv = evas_object_smart_data_get(rp->object);
3147 opt = eina_list_nth(priv->children, pos);
3148 if (!opt) return NULL;
3149 child_obj = opt->obj;
3150 if (evas_object_data_get(child_obj, "\377 edje.box_item")) return NULL;
3151 if (!evas_object_box_remove_at(rp->object, pos)) return NULL;
3152 _edje_box_layout_remove_child(rp, child_obj);
3153 _edje_box_child_remove(rp, child_obj);
3154 return child_obj;
3155}
3156
3157Eina_Bool
3158_edje_real_part_box_remove_all(Edje_Real_Part *rp, Eina_Bool clear)
3159{
3160 Eina_List *children;
3161 int i = 0;
3162
3163 children = evas_object_box_children_get(rp->object);
3164 while (children)
3165 {
3166 Evas_Object *child_obj = children->data;
3167 if (evas_object_data_get(child_obj, "\377 edje.box_item"))
3168 i++;
3169 else
3170 {
3171 _edje_box_layout_remove_child(rp, child_obj);
3172 _edje_box_child_remove(rp, child_obj);
3173 if (!evas_object_box_remove_at(rp->object, i))
3174 return EINA_FALSE;
3175 if (clear)
3176 evas_object_del(child_obj);
3177 }
3178 children = eina_list_remove_list(children, children);
3179 }
3180 return EINA_TRUE;
3181}
3182
3183static void
3184_edje_table_child_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *child __UNUSED__, void *einfo __UNUSED__)
3185{
3186 Edje_Real_Part *rp = data;
3187
3188 rp->edje->dirty = 1;
3189#ifdef EDJE_CALC_CACHE
3190 rp->invalidate = 1;
3191#endif
3192 _edje_recalc(rp->edje);
3193}
3194
3195static void
3196_edje_table_child_add(Edje_Real_Part *rp, Evas_Object *child)
3197{
3198 evas_object_event_callback_add
3199 (child, EVAS_CALLBACK_DEL, _edje_table_child_del_cb, rp);
3200
3201 rp->edje->dirty = 1;
3202#ifdef EDJE_CALC_CACHE
3203 rp->invalidate = 1;
3204#endif
3205 _edje_recalc(rp->edje);
3206}
3207
3208static void
3209_edje_table_child_remove(Edje_Real_Part *rp, Evas_Object *child)
3210{
3211 evas_object_event_callback_del_full
3212 (child, EVAS_CALLBACK_DEL, _edje_table_child_del_cb, rp);
3213
3214 rp->edje->dirty = 1;
3215#ifdef EDJE_CALC_CACHE
3216 rp->invalidate = 1;
3217#endif
3218 _edje_recalc(rp->edje);
3219}
3220
3221EAPI Evas_Object *
3222edje_object_part_table_child_get(Evas_Object *obj, const char *part, unsigned int col, unsigned int row)
3223{
3224 Edje *ed;
3225 Edje_Real_Part *rp;
3226
3227 ed = _edje_fetch(obj);
3228 if ((!ed) || (!part)) return NULL;
3229
3230 rp = _edje_real_part_recursive_get(ed, part);
3231 if (!rp) return NULL;
3232 if (rp->part->type != EDJE_PART_TYPE_TABLE) return NULL;
3233
3234 return evas_object_table_child_get(rp->object, col, row);
3235}
3236
3237EAPI Eina_Bool
3238edje_object_part_table_pack(Evas_Object *obj, const char *part, Evas_Object *child_obj, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan)
3239{
3240 Edje *ed;
3241 Edje_Real_Part *rp;
3242
3243 ed = _edje_fetch(obj);
3244 if ((!ed) || (!part)) return EINA_FALSE;
3245
3246 rp = _edje_real_part_recursive_get(ed, part);
3247 if (!rp) return EINA_FALSE;
3248 if (rp->part->type != EDJE_PART_TYPE_TABLE) return EINA_FALSE;
3249
3250 return _edje_real_part_table_pack(rp, child_obj, col, row, colspan, rowspan);
3251}
3252
3253EAPI Eina_Bool
3254edje_object_part_table_unpack(Evas_Object *obj, const char *part, Evas_Object *child_obj)
3255{
3256 Edje *ed;
3257 Edje_Real_Part *rp;
3258
3259 ed = _edje_fetch(obj);
3260 if ((!ed) || (!part)) return EINA_FALSE;
3261
3262 rp = _edje_real_part_recursive_get(ed, part);
3263 if (!rp) return EINA_FALSE;
3264 if (rp->part->type != EDJE_PART_TYPE_TABLE) return EINA_FALSE;
3265
3266 return _edje_real_part_table_unpack(rp, child_obj);
3267}
3268
3269EAPI Eina_Bool
3270edje_object_part_table_col_row_size_get(const Evas_Object *obj, const char *part, int *cols, int *rows)
3271{
3272 Edje *ed;
3273 Edje_Real_Part *rp;
3274
3275 ed = _edje_fetch(obj);
3276 if ((!ed) || (!part)) return EINA_FALSE;
3277
3278 rp = _edje_real_part_recursive_get(ed, part);
3279 if (!rp) return EINA_FALSE;
3280 if (rp->part->type != EDJE_PART_TYPE_TABLE) return EINA_FALSE;
3281
3282 evas_object_table_col_row_size_get(rp->object, cols, rows);
3283 return EINA_TRUE;
3284}
3285
3286EAPI Eina_Bool
3287edje_object_part_table_clear(Evas_Object *obj, const char *part, Eina_Bool clear)
3288{
3289 Edje *ed;
3290 Edje_Real_Part *rp;
3291
3292 ed = _edje_fetch(obj);
3293 if ((!ed) || (!part)) return EINA_FALSE;
3294
3295 rp = _edje_real_part_recursive_get(ed, part);
3296 if (!rp) return EINA_FALSE;
3297 if (rp->part->type != EDJE_PART_TYPE_TABLE) return EINA_FALSE;
3298
3299 _edje_real_part_table_clear(rp, clear);
3300 return EINA_TRUE;
3301}
3302
3303static void
3304_edje_perspective_obj_del(void *data, __UNUSED__ Evas *e, __UNUSED__ Evas_Object *obj, __UNUSED__ void *event_info)
3305{
3306 Edje_Perspective *ps = data;
3307 Evas_Object *o;
3308
3309 EINA_LIST_FREE(ps->users, o)
3310 {
3311 Edje *ed;
3312
3313 ed = evas_object_smart_data_get(o);
3314 if (!ed) continue;
3315 ed->persp = NULL;
3316 ed->dirty = 1;
3317 _edje_recalc_do(ed);
3318 }
3319 free(ps);
3320}
3321
3322EAPI Edje_Perspective *
3323edje_perspective_new(Evas *e)
3324{
3325 Edje_Perspective *ps;
3326 Evas_Coord vx, vy, vw, vh;
3327
3328 if (!e) return NULL;
3329 ps = calloc(1, sizeof(Edje_Perspective));
3330 ps->obj = evas_object_rectangle_add(e);
3331 evas_object_data_set(ps->obj, "_edje_perspective", ps);
3332 evas_object_event_callback_add(ps->obj, EVAS_CALLBACK_DEL, _edje_perspective_obj_del, ps);
3333 evas_output_viewport_get(e, &vx, &vy, &vw, &vh);
3334 ps->e = e;
3335 ps->px = vx + (vw / 2);
3336 ps->py = vy + (vh / 2);
3337 ps->z0 = 0;
3338 ps->foc = 1000;
3339 return ps;
3340}
3341
3342EAPI void
3343edje_perspective_free(Edje_Perspective *ps)
3344{
3345 if (!ps) return;
3346 evas_object_del(ps->obj);
3347}
3348
3349EAPI void
3350edje_perspective_set(Edje_Perspective *ps, Evas_Coord px, Evas_Coord py, Evas_Coord z0, Evas_Coord foc)
3351{
3352 Eina_List *l;
3353 Evas_Object *o;
3354
3355 if (!ps) return;
3356 if ((ps->px == px) && (ps->py == py) && (ps->z0 == z0) && (ps->foc == foc)) return;
3357 ps->px = px;
3358 ps->py = py;
3359 ps->z0 = z0;
3360 ps->foc = foc;
3361 EINA_LIST_FOREACH(ps->users, l, o)
3362 {
3363 Edje *ed;
3364
3365 ed = evas_object_smart_data_get(o);
3366 if (!ed) continue;
3367 if (!ed->persp)
3368 {
3369 ed->dirty = 1;
3370 _edje_recalc_do(ed);
3371 }
3372 }
3373 if (ps->global)
3374 {
3375 EINA_LIST_FOREACH(_edje_edjes, l, o)
3376 {
3377 Edje *ed;
3378
3379 ed = evas_object_smart_data_get(o);
3380 if (!ed) continue;
3381 if (!ed->persp)
3382 {
3383 ed->dirty = 1;
3384 _edje_recalc_do(ed);
3385 }
3386 }
3387 }
3388}
3389
3390EAPI void
3391edje_perspective_global_set(Edje_Perspective *ps, Eina_Bool global)
3392{
3393 Evas_Object *o;
3394 Eina_List *l;
3395
3396 if (!ps) return;
3397 if (ps->global == global) return;
3398 if (global)
3399 {
3400 o = evas_object_name_find(evas_object_evas_get(ps->obj),
3401 "_edje_perspective");
3402 if (o) evas_object_name_set(o, NULL);
3403 evas_object_name_set(ps->obj, "_edje_perspective");
3404 }
3405 else
3406 evas_object_name_set(ps->obj, NULL);
3407 ps->global = global;
3408 EINA_LIST_FOREACH(_edje_edjes, l, o)
3409 {
3410 Edje *ed;
3411
3412 ed = evas_object_smart_data_get(o);
3413 if (!ed) continue;
3414 if (!ed->persp)
3415 {
3416 ed->dirty = 1;
3417 _edje_recalc_do(ed);
3418 }
3419 }
3420}
3421
3422EAPI Eina_Bool
3423edje_perspective_global_get(const Edje_Perspective *ps)
3424{
3425 if (!ps) return EINA_FALSE;
3426 return ps->global;
3427}
3428
3429EAPI const Edje_Perspective *
3430edje_evas_global_perspective_get(const Evas *e)
3431{
3432 Evas_Object *obj;
3433
3434 if (!e) return NULL;
3435 obj = evas_object_name_find(e, "_edje_perspective");
3436 if (!obj) return NULL;
3437 return evas_object_data_get(obj, "_edje_perspective");
3438}
3439
3440EAPI void
3441edje_object_perspective_set(Evas_Object *obj, Edje_Perspective *ps)
3442{
3443 Edje *ed;
3444
3445 ed = evas_object_smart_data_get(obj);
3446 if (!ed) return;
3447 if (ed->persp == ps) return;
3448 if (ed->persp != ps)
3449 {
3450 if (ed->persp)
3451 ed->persp->users = eina_list_remove(ed->persp->users, obj);
3452 }
3453 ed->persp = ps;
3454 if (ps) ps->users = eina_list_append(ps->users, obj);
3455 ed->dirty = 1;
3456 _edje_recalc_do(ed);
3457}
3458
3459EAPI const Edje_Perspective *
3460edje_object_perspective_get(const Evas_Object *obj)
3461{
3462 Edje *ed;
3463
3464 ed = evas_object_smart_data_get(obj);
3465 if (!ed) return NULL;
3466 return ed->persp;
3467}
3468
3469#define EDJE_PRELOAD_EMISSION "preload,done"
3470#define EDJE_PRELOAD_SOURCE NULL
3471
3472EAPI Eina_Bool
3473edje_object_preload(Evas_Object *obj, Eina_Bool cancel)
3474{
3475 Edje *ed;
3476 int count;
3477 unsigned int i;
3478
3479 ed = _edje_fetch(obj);
3480 if (!ed) return EINA_FALSE;
3481
3482 _edje_recalc_do(ed);
3483
3484 for (i = 0, count = 0; i < ed->table_parts_size; i++)
3485 {
3486 Edje_Real_Part *rp;
3487 Edje_Part *ep;
3488
3489 rp = ed->table_parts[i];
3490 ep = rp->part;
3491
3492 if (ep->type == EDJE_PART_TYPE_IMAGE ||
3493 (ep->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object))
3494 count++;
3495 }
3496
3497 ed->preload_count = count;
3498
3499 if (count > 0)
3500 {
3501 for (i = 0; i < ed->table_parts_size; i++)
3502 {
3503 Edje_Real_Part *rp;
3504 Edje_Part *ep;
3505
3506 rp = ed->table_parts[i];
3507 ep = rp->part;
3508
3509 if (ep->type == EDJE_PART_TYPE_IMAGE)
3510 {
3511 const char *file = NULL;
3512 const char *key = NULL;
3513
3514 evas_object_event_callback_del_full(rp->object, EVAS_CALLBACK_IMAGE_PRELOADED, _edje_object_image_preload_cb, ed);
3515
3516 evas_object_image_file_get(rp->object, &file, &key);
3517 if (!file && !key)
3518 {
3519 ed->preload_count--;
3520 }
3521 else
3522 {
3523 evas_object_event_callback_add(rp->object, EVAS_CALLBACK_IMAGE_PRELOADED, _edje_object_image_preload_cb, ed);
3524 evas_object_image_preload(rp->object, cancel);
3525 }
3526 count--;
3527 }
3528 else if (ep->type == EDJE_PART_TYPE_GROUP)
3529 {
3530 if (rp->swallowed_object) {
3531 edje_object_signal_callback_del(rp->swallowed_object, EDJE_PRELOAD_EMISSION, EDJE_PRELOAD_SOURCE, _edje_object_signal_preload_cb);
3532 edje_object_signal_callback_add(rp->swallowed_object, EDJE_PRELOAD_EMISSION, EDJE_PRELOAD_SOURCE, _edje_object_signal_preload_cb, ed);
3533 edje_object_preload(rp->swallowed_object, cancel);
3534
3535 count--;
3536 }
3537 }
3538 }
3539 }
3540 else
3541 {
3542 _edje_emit(ed, EDJE_PRELOAD_EMISSION, EDJE_PRELOAD_SOURCE);
3543 }
3544
3545 return EINA_TRUE;
3546}
3547
3548Eina_Bool
3549_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)
3550{
3551 Eina_Bool ret =
3552 evas_object_table_pack(rp->object, child_obj, col, row, colspan, rowspan);
3553
3554 _edje_table_child_add(rp, child_obj);
3555
3556 return ret;
3557}
3558
3559Eina_Bool
3560_edje_real_part_table_unpack(Edje_Real_Part *rp, Evas_Object *child_obj)
3561{
3562 Eina_Bool ret = evas_object_table_unpack(rp->object, child_obj);
3563
3564 if (ret)
3565 _edje_table_child_remove(rp, child_obj);
3566
3567 return ret;
3568}
3569
3570void
3571_edje_real_part_table_clear(Edje_Real_Part *rp, Eina_Bool clear)
3572{
3573 Eina_List *children;
3574
3575 children = evas_object_table_children_get(rp->object);
3576 while (children)
3577 {
3578 Evas_Object *child_obj = children->data;
3579
3580 _edje_table_child_remove(rp, child_obj);
3581 if (!evas_object_data_get(child_obj, "\377 edje.table_item"))
3582 {
3583 evas_object_table_unpack(rp->object, child_obj);
3584 if (clear)
3585 evas_object_del(child_obj);
3586 }
3587 children = eina_list_remove_list(children, children);
3588 }
3589}
3590
3591Edje_Real_Part *
3592_edje_real_part_recursive_get(const Edje *ed, const char *part)
3593{
3594 Edje_Real_Part *rp;
3595 char **path;
3596
3597 path = eina_str_split(part, EDJE_PART_PATH_SEPARATOR_STRING, 0);
3598 if (!path) return NULL;
3599
3600 rp = _edje_real_part_recursive_get_helper(ed, path);
3601
3602 free(*path);
3603 free(path);
3604 return rp;
3605}
3606
3607Evas_Object *
3608_edje_children_get(Edje_Real_Part *rp, const char *partid)
3609{
3610 Evas_Object *child;
3611 Eina_List *l;
3612 long int v;
3613 char *p;
3614
3615 if (!partid) return NULL;
3616
3617 switch (rp->part->type)
3618 {
3619 case EDJE_PART_TYPE_EXTERNAL:
3620 return _edje_external_content_get(rp->swallowed_object, partid);
3621 case EDJE_PART_TYPE_BOX:
3622 l = evas_object_box_children_get(rp->object);
3623 break;
3624 case EDJE_PART_TYPE_TABLE:
3625 l = evas_object_table_children_get(rp->object);
3626 break;
3627 default:
3628 return NULL;
3629 }
3630
3631 v = strtol(partid, &p, 10);
3632 if ((*p == '\0') && (v >= 0))
3633 {
3634 child = eina_list_nth(l, v);
3635 }
3636 else
3637 {
3638 Evas_Object *cur;
3639 child = NULL;
3640 EINA_LIST_FREE(l, cur)
3641 {
3642 const char *name = evas_object_name_get(cur);
3643 if ((name) && (!strcmp(name, partid)))
3644 {
3645 child = cur;
3646 break;
3647 }
3648 }
3649 }
3650 eina_list_free(l);
3651
3652 return child;
3653}
3654
3655/* rebuild alternative path */
3656char *
3657_edje_merge_path(const char *alias, char * const *path)
3658{
3659 char *tmp;
3660 unsigned int length = 1;
3661 unsigned int alias_length;
3662 unsigned int i;
3663
3664 if (!alias) return NULL;
3665
3666 alias_length = strlen(alias);
3667
3668 for (i = 0; path[i]; i++)
3669 length += strlen(path[i]) + 1;
3670
3671 tmp = malloc(sizeof (char) * (length + alias_length + 2));
3672 memcpy(tmp, alias, alias_length);
3673 tmp[alias_length] = '\0';
3674
3675 for (i = 0; path[i]; i++)
3676 {
3677 strcat(tmp, EDJE_PART_PATH_SEPARATOR_STRING);
3678 strcat(tmp, path[i]);
3679 }
3680
3681 return tmp;
3682}
3683
3684
3685Edje_Real_Part *
3686_edje_real_part_recursive_get_helper(const Edje *ed, char **path)
3687{
3688 Edje_Real_Part *rp;
3689 Evas_Object *child;
3690 char *idx = NULL;
3691
3692 if (!path[0])
3693 return NULL;
3694
3695 if (ed->collection && ed->collection->alias)
3696 {
3697 char *alias;
3698
3699 alias = _edje_merge_path(eina_hash_find(ed->collection->alias, path[0]), path + 1);
3700 if (alias) {
3701 rp = _edje_real_part_recursive_get(ed, alias);
3702 free(alias);
3703 return rp;
3704 }
3705 }
3706
3707 //printf(" lookup: %s on %s\n", path[0], ed->parent ? ed->parent : "-");
3708 idx = strchr(path[0], EDJE_PART_PATH_SEPARATOR_INDEXL);
3709 if (idx)
3710 {
3711 char *end;
3712
3713 end = strchr(idx + 1, EDJE_PART_PATH_SEPARATOR_INDEXR);
3714 if (end)
3715 {
3716 *end = '\0';
3717 *idx = '\0';
3718 idx++;
3719 }
3720 }
3721
3722 rp = _edje_real_part_get(ed, path[0]);
3723 if (!path[1] && !idx) return rp;
3724 if (!rp) return NULL;
3725
3726 switch (rp->part->type)
3727 {
3728 case EDJE_PART_TYPE_GROUP:
3729 if (!rp->swallowed_object) return NULL;
3730 ed = _edje_fetch(rp->swallowed_object);
3731 if (!ed) return NULL;
3732 path++;
3733 return _edje_real_part_recursive_get_helper(ed, path);
3734 case EDJE_PART_TYPE_BOX:
3735 case EDJE_PART_TYPE_TABLE:
3736 case EDJE_PART_TYPE_EXTERNAL:
3737 if (!idx) return rp;
3738 path++;
3739
3740 child = _edje_children_get(rp, idx);
3741
3742 ed = _edje_fetch(child);
3743
3744 if (!ed) return NULL;
3745 return _edje_real_part_recursive_get_helper(ed, path);
3746 default:
3747 return NULL;
3748 }
3749}
3750
3751/* Private Routines */
3752Edje_Real_Part *
3753_edje_real_part_get(const Edje *ed, const char *part)
3754{
3755 unsigned int i;
3756
3757 if (!part) return NULL;
3758
3759 for (i = 0; i < ed->table_parts_size; i++)
3760 {
3761 Edje_Real_Part *rp;
3762
3763 rp = ed->table_parts[i];
3764 if ((rp->part->name) && (!strcmp(rp->part->name, part))) return rp;
3765 }
3766 return NULL;
3767}
3768
3769Edje_Color_Class *
3770_edje_color_class_find(Edje *ed, const char *color_class)
3771{
3772 Eina_List *l;
3773 Edje_Color_Class *cc = NULL;
3774
3775 if ((!ed) || (!color_class)) return NULL;
3776
3777 /* first look through the object scope */
3778 EINA_LIST_FOREACH(ed->color_classes, l, cc)
3779 if ((cc->name) && (!strcmp(color_class, cc->name))) return cc;
3780
3781 /* next look through the global scope */
3782 cc = eina_hash_find(_edje_color_class_hash, color_class);
3783 if (cc) return cc;
3784
3785 /* finally, look through the file scope */
3786 EINA_LIST_FOREACH(ed->file->color_classes, l, cc)
3787 if ((cc->name) && (!strcmp(color_class, cc->name))) return cc;
3788
3789 return NULL;
3790}
3791
3792void
3793_edje_color_class_member_add(Edje *ed, const char *color_class)
3794{
3795 _edje_class_member_add(ed, &ed->members.color_class, &_edje_color_class_member_hash, color_class);
3796}
3797
3798void
3799_edje_color_class_member_direct_del(const char *color_class, void *l)
3800{
3801 _edje_class_member_direct_del(color_class, l, _edje_color_class_member_hash);
3802}
3803
3804void
3805_edje_color_class_member_del(Edje *ed, const char *color_class)
3806{
3807 if ((!ed) || (!color_class)) return;
3808
3809 _edje_class_member_del(&ed->members.color_class, &_edje_color_class_member_hash, color_class);
3810}
3811
3812void
3813_edje_color_class_members_free(void)
3814{
3815 if (!_edje_color_class_member_hash) return;
3816 eina_hash_foreach(_edje_color_class_member_hash, member_list_free, NULL);
3817 eina_hash_free(_edje_color_class_member_hash);
3818 _edje_color_class_member_hash = NULL;
3819}
3820
3821static Eina_Bool
3822color_class_hash_list_free(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__)
3823{
3824 Edje_Color_Class *cc;
3825
3826 cc = data;
3827 if (cc->name) eina_stringshare_del(cc->name);
3828 free(cc);
3829 return EINA_TRUE;
3830}
3831
3832void
3833_edje_color_class_hash_free(void)
3834{
3835 if (!_edje_color_class_hash) return;
3836 eina_hash_foreach(_edje_color_class_hash, color_class_hash_list_free, NULL);
3837 eina_hash_free(_edje_color_class_hash);
3838 _edje_color_class_hash = NULL;
3839}
3840
3841void
3842_edje_color_class_on_del(Edje *ed, Edje_Part *ep)
3843{
3844 unsigned int i;
3845
3846 if ((ep->default_desc) && (ep->default_desc->color_class))
3847 _edje_color_class_member_del(ed, ep->default_desc->color_class);
3848
3849 for (i = 0; i < ep->other.desc_count; ++i)
3850 if (ep->other.desc[i]->color_class)
3851 _edje_color_class_member_del(ed, ep->other.desc[i]->color_class);
3852}
3853
3854Edje_Text_Class *
3855_edje_text_class_find(Edje *ed, const char *text_class)
3856{
3857 Eina_List *l;
3858 Edje_Text_Class *tc;
3859
3860 if ((!ed) || (!text_class)) return NULL;
3861 EINA_LIST_FOREACH(ed->text_classes, l, tc)
3862 if ((tc->name) && (!strcmp(text_class, tc->name))) return tc;
3863 return eina_hash_find(_edje_text_class_hash, text_class);
3864}
3865
3866void
3867_edje_text_class_member_direct_del(const char *text_class,
3868 void *l)
3869{
3870 _edje_class_member_direct_del(text_class, l, _edje_text_class_member_hash);
3871}
3872
3873void
3874_edje_text_class_member_add(Edje *ed, const char *text_class)
3875{
3876 _edje_class_member_add(ed, &ed->members.text_class, &_edje_text_class_member_hash, text_class);
3877}
3878
3879void
3880_edje_text_class_member_del(Edje *ed, const char *text_class)
3881{
3882 if ((!ed) || (!text_class)) return;
3883
3884 _edje_class_member_del(&ed->members.text_class, &_edje_text_class_member_hash, text_class);
3885}
3886
3887void
3888_edje_text_class_members_free(void)
3889{
3890 _edje_class_members_free(&_edje_text_class_member_hash);
3891}
3892
3893static Eina_Bool
3894text_class_hash_list_free(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__)
3895{
3896 Edje_Text_Class *tc;
3897
3898 tc = data;
3899 if (tc->name) eina_stringshare_del(tc->name);
3900 if (tc->font) eina_stringshare_del(tc->font);
3901 free(tc);
3902 return EINA_TRUE;
3903}
3904
3905void
3906_edje_text_class_hash_free(void)
3907{
3908 if (!_edje_text_class_hash) return;
3909 eina_hash_foreach(_edje_text_class_hash, text_class_hash_list_free, NULL);
3910 eina_hash_free(_edje_text_class_hash);
3911 _edje_text_class_hash = NULL;
3912}
3913
3914Edje *
3915_edje_fetch(const Evas_Object *obj)
3916{
3917 Edje *ed;
3918
3919 if (!evas_object_smart_type_check(obj, "edje"))
3920 return NULL;
3921 ed = evas_object_smart_data_get(obj);
3922 if ((ed) && (ed->delete_me)) return NULL;
3923 return ed;
3924}
3925
3926int
3927_edje_freeze(Edje *ed)
3928{
3929 ed->freeze++;
3930// printf("FREEZE %i\n", ed->freeze);
3931 return ed->freeze;
3932}
3933
3934int
3935_edje_thaw(Edje *ed)
3936{
3937 ed->freeze--;
3938 if (ed->freeze < 0)
3939 {
3940// printf("-------------########### OVER THAW\n");
3941 ed->freeze = 0;
3942 }
3943 if ((ed->freeze == 0) && (ed->recalc))
3944 {
3945// printf("thaw recalc\n");
3946 _edje_recalc(ed);
3947 }
3948 return ed->freeze;
3949}
3950
3951int
3952_edje_block(Edje *ed)
3953{
3954 _edje_ref(ed);
3955 ed->block++;
3956 return ed->block;
3957}
3958
3959int
3960_edje_unblock(Edje *ed)
3961{
3962 int ret = 0;
3963
3964 if (!ed) return ret;
3965
3966 ed->block--;
3967 if (ed->block == 0) ed->block_break = 0;
3968 ret = ed->block;
3969 _edje_unref(ed);
3970 return ret;
3971}
3972
3973int
3974_edje_block_break(Edje *ed)
3975{
3976 if (ed->block_break) return 1;
3977 return 0;
3978}
3979
3980void
3981_edje_block_violate(Edje *ed)
3982{
3983 if (ed->block > 0) ed->block_break = 1;
3984}
3985
3986void
3987_edje_object_part_swallow_free_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
3988{
3989 Evas_Object *edje_obj;
3990
3991 edje_obj = data;
3992 edje_object_part_unswallow(edje_obj, obj);
3993 return;
3994}
3995
3996static void
3997_edje_real_part_swallow_hints_update(Edje_Real_Part *rp)
3998{
3999 const char *type;
4000
4001 type = evas_object_type_get(rp->swallowed_object);
4002
4003 rp->swallow_params.min.w = 0;
4004 rp->swallow_params.min.h = 0;
4005 rp->swallow_params.max.w = -1;
4006 rp->swallow_params.max.h = -1;
4007 if ((type) && (!strcmp(type, "edje")))
4008 {
4009 Evas_Coord w, h;
4010
4011 edje_object_size_min_get(rp->swallowed_object, &w, &h);
4012 rp->swallow_params.min.w = w;
4013 rp->swallow_params.min.h = h;
4014 edje_object_size_max_get(rp->swallowed_object, &w, &h);
4015 rp->swallow_params.max.w = w;
4016 rp->swallow_params.max.h = h;
4017 }
4018 else if ((type) && ((!strcmp(type, "text")) || (!strcmp(type, "polygon")) ||
4019 (!strcmp(type, "line"))))
4020 {
4021 Evas_Coord w, h;
4022
4023 evas_object_geometry_get(rp->swallowed_object, NULL, NULL, &w, &h);
4024 rp->swallow_params.min.w = w;
4025 rp->swallow_params.min.h = h;
4026 rp->swallow_params.max.w = w;
4027 rp->swallow_params.max.h = h;
4028 }
4029 {
4030 Evas_Coord w1, h1, w2, h2, aw, ah;
4031 Evas_Aspect_Control am;
4032
4033 evas_object_size_hint_min_get(rp->swallowed_object, &w1, &h1);
4034 evas_object_size_hint_max_get(rp->swallowed_object, &w2, &h2);
4035 evas_object_size_hint_aspect_get(rp->swallowed_object, &am, &aw, &ah);
4036 rp->swallow_params.min.w = w1;
4037 rp->swallow_params.min.h = h1;
4038 if (w2 > 0) rp->swallow_params.max.w = w2;
4039 if (h2 > 0) rp->swallow_params.max.h = h2;
4040 switch (am)
4041 {
4042 case EVAS_ASPECT_CONTROL_NONE:
4043 rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_NONE;
4044 break;
4045 case EVAS_ASPECT_CONTROL_NEITHER:
4046 rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_NEITHER;
4047 break;
4048 case EVAS_ASPECT_CONTROL_HORIZONTAL:
4049 rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_HORIZONTAL;
4050 break;
4051 case EVAS_ASPECT_CONTROL_VERTICAL:
4052 rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_VERTICAL;
4053 break;
4054 case EVAS_ASPECT_CONTROL_BOTH:
4055 rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_BOTH;
4056 break;
4057 default:
4058 break;
4059 }
4060 rp->swallow_params.aspect.w = aw;
4061 rp->swallow_params.aspect.h = ah;
4062 evas_object_data_set(rp->swallowed_object, "\377 edje.swallowing_part", rp);
4063 }
4064
4065#ifdef EDJE_CALC_CACHE
4066 rp->invalidate = 1;
4067#endif
4068}
4069
4070void
4071_edje_object_part_swallow_changed_hints_cb(void *data, __UNUSED__ Evas *e, __UNUSED__ Evas_Object *obj, __UNUSED__ void *event_info)
4072{
4073 Edje_Real_Part *rp;
4074
4075 rp = data;
4076 _edje_real_part_swallow_hints_update(rp);
4077 rp->edje->dirty = 1;
4078 _edje_recalc(rp->edje);
4079 return;
4080}
4081
4082void
4083_edje_real_part_swallow(Edje_Real_Part *rp,
4084 Evas_Object *obj_swallow,
4085 Eina_Bool hints_update)
4086{
4087 if (rp->swallowed_object)
4088 {
4089 if (rp->swallowed_object != obj_swallow)
4090 {
4091 _edje_real_part_swallow_clear(rp);
4092 rp->swallowed_object = NULL;
4093 }
4094 else
4095 {
4096 if (hints_update)
4097 _edje_real_part_swallow_hints_update(rp);
4098 rp->edje->dirty = 1;
4099 _edje_recalc(rp->edje);
4100 return;
4101 }
4102 }
4103#ifdef EDJE_CALC_CACHE
4104 rp->invalidate = 1;
4105#endif
4106 if (!obj_swallow) return;
4107 rp->swallowed_object = obj_swallow;
4108 evas_object_smart_member_add(rp->swallowed_object, rp->edje->obj);
4109 if (rp->clip_to)
4110 evas_object_clip_set(rp->swallowed_object, rp->clip_to->object);
4111 else evas_object_clip_set(rp->swallowed_object, rp->edje->base.clipper);
4112 evas_object_stack_above(rp->swallowed_object, rp->object);
4113 evas_object_event_callback_add(rp->swallowed_object,
4114 EVAS_CALLBACK_DEL,
4115 _edje_object_part_swallow_free_cb,
4116 rp->edje->obj);
4117 evas_object_event_callback_add(rp->swallowed_object,
4118 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
4119 _edje_object_part_swallow_changed_hints_cb,
4120 rp);
4121
4122 if (hints_update)
4123 _edje_real_part_swallow_hints_update(rp);
4124
4125 if (rp->part->mouse_events)
4126 {
4127 _edje_callbacks_add(obj_swallow, rp->edje, rp);
4128 if (rp->part->repeat_events)
4129 evas_object_repeat_events_set(obj_swallow, 1);
4130 if (rp->part->pointer_mode != EVAS_OBJECT_POINTER_MODE_AUTOGRAB)
4131 evas_object_pointer_mode_set(obj_swallow, rp->part->pointer_mode);
4132 evas_object_pass_events_set(obj_swallow, 0);
4133 }
4134 else
4135 evas_object_pass_events_set(obj_swallow, 1);
4136 _edje_callbacks_focus_add(rp->swallowed_object, rp->edje, rp);
4137
4138 if (rp->part->precise_is_inside)
4139 evas_object_precise_is_inside_set(obj_swallow, 1);
4140
4141 rp->edje->dirty = 1;
4142 _edje_recalc(rp->edje);
4143}
4144
4145void
4146_edje_real_part_swallow_clear(Edje_Real_Part *rp)
4147{
4148 evas_object_smart_member_del(rp->swallowed_object);
4149 evas_object_event_callback_del_full(rp->swallowed_object,
4150 EVAS_CALLBACK_FREE,
4151 _edje_object_part_swallow_free_cb,
4152 rp->edje->obj);
4153 evas_object_event_callback_del_full(rp->swallowed_object,
4154 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
4155 _edje_object_part_swallow_changed_hints_cb,
4156 rp);
4157 evas_object_clip_unset(rp->swallowed_object);
4158 evas_object_data_del(rp->swallowed_object, "\377 edje.swallowing_part");
4159 if (rp->part->mouse_events)
4160 _edje_callbacks_del(rp->swallowed_object, rp->edje);
4161 _edje_callbacks_focus_del(rp->swallowed_object, rp->edje);
4162}
4163
4164static void
4165_edje_object_preload(Edje *ed)
4166{
4167 ed->preload_count--;
4168 if (!ed->preload_count)
4169 _edje_emit(ed, EDJE_PRELOAD_EMISSION, EDJE_PRELOAD_SOURCE);
4170}
4171
4172static void
4173_edje_object_image_preload_cb(void *data, __UNUSED__ Evas *e, Evas_Object *obj, __UNUSED__ void *event_info)
4174{
4175 Edje *ed = data;
4176
4177 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_IMAGE_PRELOADED, _edje_object_image_preload_cb, ed);
4178 _edje_object_preload(ed);
4179}
4180
4181static void
4182_edje_object_signal_preload_cb(void *data, Evas_Object *obj, __UNUSED__ const char *emission, __UNUSED__ const char *source)
4183{
4184 Edje *ed = data;
4185
4186 edje_object_signal_callback_del(obj, EDJE_PRELOAD_EMISSION, EDJE_PRELOAD_SOURCE, _edje_object_signal_preload_cb);
4187 _edje_object_preload(ed);
4188}
4189
4190/**
4191 * @internal
4192 *
4193 * for edje_cc
4194 */
4195EAPI void
4196_edje_program_remove(Edje_Part_Collection *edc, Edje_Program *p)
4197{
4198 Edje_Program ***array;
4199 unsigned int *count;
4200 unsigned int i;
4201
4202 if (!p->signal && !p->source)
4203 {
4204 array = &edc->programs.nocmp;
4205 count = &edc->programs.nocmp_count;
4206 }
4207 else if (p->signal && !strpbrk(p->signal, "*?[\\")
4208 && p->source && !strpbrk(p->source, "*?[\\"))
4209 {
4210 array = &edc->programs.strcmp;
4211 count = &edc->programs.strcmp_count;
4212 }
4213 else if (p->signal && edje_program_is_strncmp(p->signal)
4214 && p->source && edje_program_is_strncmp(p->source))
4215 {
4216 array = &edc->programs.strncmp;
4217 count = &edc->programs.strncmp_count;
4218 }
4219 else if (p->signal && edje_program_is_strrncmp(p->signal)
4220 && p->source && edje_program_is_strrncmp(p->source))
4221 {
4222 array = &edc->programs.strrncmp;
4223 count = &edc->programs.strrncmp_count;
4224 }
4225 else
4226 {
4227 array = &edc->programs.fnmatch;
4228 count = &edc->programs.fnmatch_count;
4229 }
4230
4231 for (i = 0; i < *count; ++i)
4232 if ((*array)[i] == p)
4233 {
4234 memmove(*array + i, *array + i + 1, sizeof (Edje_Program *) * (*count - i -1));
4235 (*count)--;
4236 break;
4237 }
4238}
4239
4240/**
4241 * @internal
4242 *
4243 * for edje_cc
4244 */
4245EAPI void
4246_edje_program_insert(Edje_Part_Collection *edc, Edje_Program *p)
4247{
4248 Edje_Program ***array;
4249 unsigned int *count;
4250
4251 if (!p->signal && !p->source)
4252 {
4253 array = &edc->programs.nocmp;
4254 count = &edc->programs.nocmp_count;
4255 }
4256 else if (p->signal && !strpbrk(p->signal, "*?[\\")
4257 && p->source && !strpbrk(p->source, "*?[\\"))
4258 {
4259 array = &edc->programs.strcmp;
4260 count = &edc->programs.strcmp_count;
4261 }
4262 else if (p->signal && edje_program_is_strncmp(p->signal)
4263 && p->source && edje_program_is_strncmp(p->source))
4264 {
4265 array = &edc->programs.strncmp;
4266 count = &edc->programs.strncmp_count;
4267 }
4268 else if (p->signal && edje_program_is_strrncmp(p->signal)
4269 && p->source && edje_program_is_strrncmp(p->source))
4270 {
4271 array = &edc->programs.strrncmp;
4272 count = &edc->programs.strrncmp_count;
4273 }
4274 else
4275 {
4276 array = &edc->programs.fnmatch;
4277 count = &edc->programs.fnmatch_count;
4278 }
4279
4280 *array = realloc(*array, sizeof (Edje_Program *) * (*count + 1));
4281 (*array)[(*count)++] = p;
4282}
4283
4284const char *
4285edje_string_get(const Edje_String *es)
4286{
4287 /* FIXME: Handle localization here */
4288 if (!es) return NULL;
4289 return es->str;
4290}
4291
4292const char *
4293edje_string_id_get(const Edje_String *es)
4294{
4295 /* FIXME: Handle localization here */
4296 if (!es) return NULL;
4297 return es->str;
4298}
4299
4300static void
4301_cb_subobj_del(void *data, __UNUSED__ Evas *e, Evas_Object *obj, __UNUSED__ void *event_info)
4302{
4303 Edje *ed = data;
4304 ed->subobjs = eina_list_remove(ed->subobjs, obj);
4305 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
4306 _cb_subobj_del, ed);
4307}
4308
4309void
4310_edje_subobj_register(Edje *ed, Evas_Object *ob)
4311{
4312 ed->subobjs = eina_list_append(ed->subobjs, ob);
4313 evas_object_event_callback_add(ob, EVAS_CALLBACK_DEL,
4314 _cb_subobj_del, ed);
4315}
4316
4317/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
diff --git a/libraries/edje/src/lib/edje_var.c b/libraries/edje/src/lib/edje_var.c
new file mode 100644
index 0000000..c6c83b1
--- /dev/null
+++ b/libraries/edje/src/lib/edje_var.c
@@ -0,0 +1,1093 @@
1#include "edje_private.h"
2
3static Eina_Bool _edje_var_timer_cb(void *data);
4static Eina_Bool _edje_var_anim_cb(void *data);
5
6static Ecore_Animator *_edje_animator = NULL;
7static Eina_List *_edje_anim_list = NULL;
8
9static Eina_Bool
10_edje_var_timer_cb(void *data)
11{
12 Edje_Var_Timer *et;
13 Edje *ed;
14 Embryo_Function fn;
15
16 et = data;
17 if (!et) return ECORE_CALLBACK_CANCEL;
18 ed = et->edje;
19// _edje_embryo_script_reset(ed);
20 embryo_program_vm_push(ed->collection->script);
21 _edje_embryo_globals_init(ed);
22 embryo_parameter_cell_push(ed->collection->script, (Embryo_Cell)et->val);
23 ed->var_pool->timers = eina_list_remove(ed->var_pool->timers, et);
24 fn = et->func;
25 free(et);
26 {
27 void *pdata;
28 int ret;
29
30 pdata = embryo_program_data_get(ed->collection->script);
31 embryo_program_data_set(ed->collection->script, ed);
32 embryo_program_max_cycle_run_set(ed->collection->script, 5000000);
33 ret = embryo_program_run(ed->collection->script, fn);
34 if (ret == EMBRYO_PROGRAM_FAIL)
35 {
36 ERR("ERROR with embryo script (timer callback). "
37 "OBJECT NAME: '%s', "
38 "OBJECT FILE: '%s', "
39 "ERROR: '%s'",
40 ed->collection->part,
41 ed->file->path,
42 embryo_error_string_get(embryo_program_error_get(ed->collection->script)));
43 }
44 else if (ret == EMBRYO_PROGRAM_TOOLONG)
45 {
46 ERR("ERROR with embryo script (timer callback). "
47 "OBJECT NAME: '%s', "
48 "OBJECT FILE: '%s', "
49 "ERROR: 'Script exceeded maximum allowed cycle count of %i'",
50 ed->collection->part,
51 ed->file->path,
52 embryo_program_max_cycle_run_get(ed->collection->script));
53 }
54 embryo_program_data_set(ed->collection->script, pdata);
55 embryo_program_vm_pop(ed->collection->script);
56 _edje_recalc(ed);
57 }
58 return ECORE_CALLBACK_CANCEL;
59}
60
61static Eina_Bool
62_edje_var_anim_cb(void *data __UNUSED__)
63{
64 Eina_List *l, *tl = NULL;
65 double t;
66 const void *tmp;
67
68 t = ecore_loop_time_get();
69 EINA_LIST_FOREACH(_edje_anim_list, l, tmp)
70 tl = eina_list_append(tl, tmp);
71 while (tl)
72 {
73 Edje *ed;
74 Eina_List *tl2;
75 Edje_Var_Animator *ea;
76
77 ed = eina_list_data_get(tl);
78 _edje_ref(ed);
79 _edje_block(ed);
80 _edje_freeze(ed);
81 tl = eina_list_remove(tl, ed);
82 if (!ed->var_pool) continue;
83 tl2 = NULL;
84 EINA_LIST_FOREACH(ed->var_pool->animators, l, tmp)
85 tl2 = eina_list_append(tl2, tmp);
86 ed->var_pool->walking_list++;
87 while (tl2)
88 {
89 ea = eina_list_data_get(tl2);
90 if ((ed->var_pool) && (!ea->delete_me))
91 {
92 if ((!ed->paused) && (!ed->delete_me))
93 {
94 Embryo_Function fn;
95 float v;
96 int ret;
97
98 v = (t - ea->start) / ea->len;
99 if (v > 1.0) v= 1.0;
100// _edje_embryo_script_reset(ed);
101 embryo_program_vm_push(ed->collection->script);
102 _edje_embryo_globals_init(ed);
103 embryo_parameter_cell_push(ed->collection->script, (Embryo_Cell)ea->val);
104 embryo_parameter_cell_push(ed->collection->script, EMBRYO_FLOAT_TO_CELL(v));
105 fn = ea->func;
106 {
107 void *pdata;
108
109 pdata = embryo_program_data_get(ed->collection->script);
110 embryo_program_data_set(ed->collection->script, ed);
111 embryo_program_max_cycle_run_set(ed->collection->script, 5000000);
112 ret = embryo_program_run(ed->collection->script, fn);
113 if (ret == EMBRYO_PROGRAM_FAIL)
114 {
115 ERR("ERROR with embryo script (anim callback). "
116 "OBJECT NAME: '%s', "
117 "OBJECT FILE: '%s', "
118 "ERROR: '%s'",
119 ed->collection->part,
120 ed->file->path,
121 embryo_error_string_get(embryo_program_error_get(ed->collection->script)));
122 }
123 else if (ret == EMBRYO_PROGRAM_TOOLONG)
124 {
125 ERR("ERROR with embryo script (anim callback). "
126 "OBJECT NAME: '%s', "
127 "OBJECT FILE: '%s', "
128 "ERROR: 'Script exceeded maximum allowed cycle count of %i'",
129 ed->collection->part,
130 ed->file->path,
131 embryo_program_max_cycle_run_get(ed->collection->script));
132 }
133 embryo_program_data_set(ed->collection->script, pdata);
134 embryo_program_vm_pop(ed->collection->script);
135 _edje_recalc(ed);
136 }
137 if (v == 1.0) ea->delete_me = 1;
138 }
139 }
140 tl2 = eina_list_remove(tl2, ea);
141 if (ed->block_break)
142 {
143 eina_list_free(tl2);
144 break;
145 }
146 }
147 ed->var_pool->walking_list--;
148 EINA_LIST_FOREACH(ed->var_pool->animators, l, ea)
149 {
150 if (ea->delete_me)
151 {
152 l = eina_list_next(l);
153 ed->var_pool->animators = eina_list_remove(ed->var_pool->animators, ea);
154 free(ea);
155 }
156 else
157 l = eina_list_next(l);
158 }
159 if (!ed->var_pool->animators)
160 _edje_anim_list = eina_list_remove(_edje_anim_list, ed);
161 _edje_unblock(ed);
162 _edje_thaw(ed);
163 _edje_unref(ed);
164 }
165 if (!_edje_anim_list)
166 {
167 if (_edje_animator)
168 {
169 ecore_animator_del(_edje_animator);
170 _edje_animator = NULL;
171 }
172 }
173 return !!_edje_animator;
174}
175
176Edje_Var *
177_edje_var_new(void)
178{
179 return calloc(1, sizeof(Edje_Var));
180}
181
182void
183_edje_var_free(Edje_Var *var)
184{
185 if (var->type == EDJE_VAR_STRING)
186 {
187 if (var->data.s.v)
188 {
189 free(var->data.s.v);
190 }
191 }
192 free(var);
193}
194
195void
196_edje_var_init(Edje *ed)
197{
198 if (!ed) return;
199 if (!ed->collection) return;
200 if (!ed->collection->script) return;
201 if (ed->var_pool) return;
202 ed->var_pool = calloc(1, sizeof(Edje_Var_Pool));
203 if (!ed->var_pool) return;
204 embryo_program_vm_push(ed->collection->script);
205 ed->var_pool->size = embryo_program_variable_count_get(ed->collection->script);
206 embryo_program_vm_pop(ed->collection->script);
207 if (ed->var_pool->size > 0)
208 ed->var_pool->vars = calloc(1, sizeof(Edje_Var) * ed->var_pool->size);
209}
210
211void
212_edje_var_shutdown(Edje *ed)
213{
214 if (!ed->var_pool) return;
215 if (ed->var_pool->vars)
216 {
217 int i;
218
219 for (i = 0; i < ed->var_pool->size; i++)
220 {
221 if (ed->var_pool->vars[i].type == EDJE_VAR_STRING)
222 {
223 if (ed->var_pool->vars[i].data.s.v)
224 {
225 free(ed->var_pool->vars[i].data.s.v);
226 ed->var_pool->vars[i].data.s.v = NULL;
227 }
228 }
229 else if (ed->var_pool->vars[i].type == EDJE_VAR_LIST)
230 {
231 while (ed->var_pool->vars[i].data.l.v)
232 {
233 _edje_var_free(eina_list_data_get(ed->var_pool->vars[i].data.l.v));
234 ed->var_pool->vars[i].data.l.v = eina_list_remove_list(ed->var_pool->vars[i].data.l.v, ed->var_pool->vars[i].data.l.v);
235 }
236 }
237 }
238 free(ed->var_pool->vars);
239 }
240 while (ed->var_pool->timers)
241 {
242 Edje_Var_Timer *et;
243
244 et = eina_list_data_get(ed->var_pool->timers);
245 ecore_timer_del(et->timer);
246 free(et);
247 ed->var_pool->timers = eina_list_remove(ed->var_pool->timers, et);
248 }
249 if (ed->var_pool->animators)
250 {
251 _edje_anim_list = eina_list_remove(_edje_anim_list, ed);
252 if (!_edje_anim_list)
253 {
254 if (_edje_animator)
255 {
256 ecore_animator_del(_edje_animator);
257 _edje_animator = NULL;
258 }
259 }
260 }
261 while (ed->var_pool->animators)
262 {
263 Edje_Var_Animator *ea;
264
265 ea = eina_list_data_get(ed->var_pool->animators);
266 free(ea);
267 ed->var_pool->animators = eina_list_remove(ed->var_pool->animators, ea);
268 }
269 free(ed->var_pool);
270 ed->var_pool = NULL;
271}
272
273int
274_edje_var_string_id_get(Edje *ed, const char *string)
275{
276 Embryo_Cell cell, *cptr;
277
278 if (!ed) return 0;
279 if (!ed->collection) return 0;
280 if (!ed->collection->script) return 0;
281 if (!string) return 0;
282 cell = embryo_program_variable_find(ed->collection->script, (char *)string);
283 if (cell == EMBRYO_CELL_NONE) return 0;
284 cptr = embryo_data_address_get(ed->collection->script, cell);
285 if (!cptr) return 0;
286 return (int)(*cptr);
287}
288
289int
290_edje_var_var_int_get(Edje *ed __UNUSED__, Edje_Var *var)
291{
292 /* auto-cast */
293 if (var->type == EDJE_VAR_STRING)
294 {
295 if (var->data.s.v)
296 {
297 double f;
298
299 f = atof(var->data.s.v);
300 free(var->data.s.v);
301 var->data.s.v = NULL;
302 var->data.i.v = (int)f;
303 }
304 var->type = EDJE_VAR_INT;
305 }
306 else if (var->type == EDJE_VAR_FLOAT)
307 {
308 var->data.i.v = (int)(var->data.f.v);
309 var->type = EDJE_VAR_INT;
310 }
311 else if (var->type == EDJE_VAR_NONE)
312 {
313 var->type = EDJE_VAR_INT;
314 }
315 else if (var->type == EDJE_VAR_LIST)
316 {
317 return 0;
318 }
319 else if (var->type == EDJE_VAR_HASH)
320 {
321 return 0;
322 }
323 return var->data.i.v;
324}
325
326void
327_edje_var_var_int_set(Edje *ed __UNUSED__, Edje_Var *var, int v)
328{
329 /* auto-cast */
330 if (var->type == EDJE_VAR_STRING)
331 {
332 if (var->data.s.v)
333 {
334 free(var->data.s.v);
335 var->data.s.v = NULL;
336 }
337 var->type = EDJE_VAR_INT;
338 }
339 else if (var->type == EDJE_VAR_FLOAT)
340 {
341 var->type = EDJE_VAR_INT;
342 }
343 else if (var->type == EDJE_VAR_NONE)
344 {
345 var->type = EDJE_VAR_INT;
346 }
347 else if (var->type == EDJE_VAR_LIST)
348 {
349 return;
350 }
351 else if (var->type == EDJE_VAR_HASH)
352 {
353 return;
354 }
355 var->data.i.v = v;
356}
357
358double
359_edje_var_var_float_get(Edje *ed __UNUSED__, Edje_Var *var)
360{
361 /* auto-cast */
362 if (var->type == EDJE_VAR_STRING)
363 {
364 if (var->data.s.v)
365 {
366 double f;
367
368 f = atof(var->data.s.v);
369 free(var->data.s.v);
370 var->data.s.v = NULL;
371 var->data.f.v = f;
372 }
373 var->type = EDJE_VAR_FLOAT;
374 }
375 else if (var->type == EDJE_VAR_INT)
376 {
377 var->data.f.v = (double)(var->data.i.v);
378 var->type = EDJE_VAR_FLOAT;
379 }
380 else if (var->type == EDJE_VAR_NONE)
381 {
382 var->type = EDJE_VAR_FLOAT;
383 }
384 else if (var->type == EDJE_VAR_LIST)
385 {
386 return 0.0;
387 }
388 else if (var->type == EDJE_VAR_HASH)
389 {
390 return 0.0;
391 }
392 return var->data.f.v;
393}
394
395void
396_edje_var_var_float_set(Edje *ed __UNUSED__, Edje_Var *var, double v)
397{
398 /* auto-cast */
399 if (var->type == EDJE_VAR_STRING)
400 {
401 if (var->data.s.v)
402 {
403 free(var->data.s.v);
404 var->data.s.v = NULL;
405 }
406 var->type = EDJE_VAR_FLOAT;
407 }
408 else if (var->type == EDJE_VAR_INT)
409 {
410 var->data.f.v = 0;
411 var->type = EDJE_VAR_FLOAT;
412 }
413 else if (var->type == EDJE_VAR_NONE)
414 {
415 var->type = EDJE_VAR_FLOAT;
416 }
417 else if (var->type == EDJE_VAR_LIST)
418 {
419 return;
420 }
421 else if (var->type == EDJE_VAR_HASH)
422 {
423 return;
424 }
425 var->data.f.v = v;
426}
427
428const char *
429_edje_var_var_str_get(Edje *ed __UNUSED__, Edje_Var *var)
430{
431 /* auto-cast */
432 if (var->type == EDJE_VAR_INT)
433 {
434 char buf[64];
435
436 snprintf(buf, sizeof(buf), "%i", var->data.i.v);
437 var->data.s.v = strdup(buf);
438 var->type = EDJE_VAR_STRING;
439 }
440 else if (var->type == EDJE_VAR_FLOAT)
441 {
442 char buf[64];
443
444 snprintf(buf, sizeof(buf), "%f", var->data.f.v);
445 var->data.s.v = strdup(buf);
446 var->type = EDJE_VAR_STRING;
447 }
448 else if (var->type == EDJE_VAR_NONE)
449 {
450 var->data.s.v = strdup("");
451 var->type = EDJE_VAR_STRING;
452 }
453 else if (var->type == EDJE_VAR_LIST)
454 {
455 return NULL;
456 }
457 else if (var->type == EDJE_VAR_HASH)
458 {
459 return NULL;
460 }
461 return var->data.s.v;
462}
463
464void
465_edje_var_var_str_set(Edje *ed __UNUSED__, Edje_Var *var, const char *str)
466{
467 /* auto-cast */
468 if (var->type == EDJE_VAR_STRING)
469 {
470 if (var->data.s.v)
471 {
472 free(var->data.s.v);
473 var->data.s.v = NULL;
474 }
475 }
476 else if (var->type == EDJE_VAR_INT)
477 {
478 var->type = EDJE_VAR_STRING;
479 }
480 else if (var->type == EDJE_VAR_FLOAT)
481 {
482 var->type = EDJE_VAR_STRING;
483 }
484 else if (var->type == EDJE_VAR_NONE)
485 {
486 var->type = EDJE_VAR_STRING;
487 }
488 else if (var->type == EDJE_VAR_LIST)
489 {
490 return;
491 }
492 else if (var->type == EDJE_VAR_HASH)
493 {
494 return;
495 }
496 var->data.s.v = strdup(str);
497}
498
499int
500_edje_var_int_get(Edje *ed, int id)
501{
502 if (!ed) return 0;
503 if (!ed->var_pool) return 0;
504 id -= EDJE_VAR_MAGIC_BASE;
505 if ((id < 0) || (id >= ed->var_pool->size)) return 0;
506 return _edje_var_var_int_get(ed, &(ed->var_pool->vars[id]));
507}
508
509void
510_edje_var_int_set(Edje *ed, int id, int v)
511{
512 if (!ed) return;
513 if (!ed->var_pool) return;
514 id -= EDJE_VAR_MAGIC_BASE;
515 if ((id < 0) || (id >= ed->var_pool->size)) return;
516 _edje_var_var_int_set(ed, &(ed->var_pool->vars[id]), v);
517}
518
519double
520_edje_var_float_get(Edje *ed, int id)
521{
522 if (!ed) return 0;
523 if (!ed->var_pool) return 0;
524 id -= EDJE_VAR_MAGIC_BASE;
525 if ((id < 0) || (id >= ed->var_pool->size)) return 0;
526 return _edje_var_var_float_get(ed, &(ed->var_pool->vars[id]));
527}
528
529void
530_edje_var_float_set(Edje *ed, int id, double v)
531{
532 if (!ed) return;
533 if (!ed->var_pool) return;
534 id -= EDJE_VAR_MAGIC_BASE;
535 if ((id < 0) || (id >= ed->var_pool->size)) return;
536 _edje_var_var_float_set(ed, &(ed->var_pool->vars[id]), v);
537}
538
539const char *
540_edje_var_str_get(Edje *ed, int id)
541{
542 if (!ed) return NULL;
543 if (!ed->var_pool) return NULL;
544 id -= EDJE_VAR_MAGIC_BASE;
545 if ((id < 0) || (id >= ed->var_pool->size)) return NULL;
546 return _edje_var_var_str_get(ed, &(ed->var_pool->vars[id]));
547}
548
549void
550_edje_var_str_set(Edje *ed, int id, const char *str)
551{
552 if (!ed) return;
553 if (!ed->var_pool) return;
554 if (!str) return;
555 id -= EDJE_VAR_MAGIC_BASE;
556 if ((id < 0) || (id >= ed->var_pool->size)) return;
557 _edje_var_var_str_set(ed, &(ed->var_pool->vars[id]), str);
558}
559
560/* list stuff */
561
562void
563_edje_var_list_var_append(Edje *ed, int id, Edje_Var *var)
564{
565 if (!ed) return;
566 if (!ed->var_pool) return;
567 id -= EDJE_VAR_MAGIC_BASE;
568 if ((id < 0) || (id >= ed->var_pool->size)) return;
569 if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return;
570 ed->var_pool->vars[id].data.l.v = eina_list_append(ed->var_pool->vars[id].data.l.v, var);
571}
572
573void
574_edje_var_list_var_prepend(Edje *ed, int id, Edje_Var *var)
575{
576 if (!ed) return;
577 if (!ed->var_pool) return;
578 id -= EDJE_VAR_MAGIC_BASE;
579 if ((id < 0) || (id >= ed->var_pool->size)) return;
580 if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return;
581 ed->var_pool->vars[id].data.l.v = eina_list_prepend(ed->var_pool->vars[id].data.l.v, var);
582}
583
584void
585_edje_var_list_var_append_relative(Edje *ed, int id, Edje_Var *var, Edje_Var *relative)
586{
587 if (!ed) return;
588 if (!ed->var_pool) return;
589 id -= EDJE_VAR_MAGIC_BASE;
590 if ((id < 0) || (id >= ed->var_pool->size)) return;
591 if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return;
592 ed->var_pool->vars[id].data.l.v = eina_list_append_relative(ed->var_pool->vars[id].data.l.v, var, relative);
593}
594
595void
596_edje_var_list_var_prepend_relative(Edje *ed, int id, Edje_Var *var, Edje_Var *relative)
597{
598 if (!ed) return;
599 if (!ed->var_pool) return;
600 id -= EDJE_VAR_MAGIC_BASE;
601 if ((id < 0) || (id >= ed->var_pool->size)) return;
602 if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return;
603 ed->var_pool->vars[id].data.l.v = eina_list_prepend_relative(ed->var_pool->vars[id].data.l.v, var, relative);
604}
605
606Edje_Var *
607_edje_var_list_nth(Edje *ed, int id, int n)
608{
609 if (!ed) return NULL;
610 if (!ed->var_pool) return NULL;
611 id -= EDJE_VAR_MAGIC_BASE;
612 if ((id < 0) || (id >= ed->var_pool->size)) return NULL;
613 if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return NULL;
614 return eina_list_nth(ed->var_pool->vars[id].data.l.v, n);
615}
616
617int
618_edje_var_list_count_get(Edje *ed, int id)
619{
620 if (!ed) return 0;
621 if (!ed->var_pool) return 0;
622 id -= EDJE_VAR_MAGIC_BASE;
623 if ((id < 0) || (id >= ed->var_pool->size)) return 0;
624 if (ed->var_pool->vars[id].type == EDJE_VAR_NONE)
625 ed->var_pool->vars[id].type = EDJE_VAR_LIST;
626 else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return 0;
627 return eina_list_count(ed->var_pool->vars[id].data.l.v);
628}
629
630void
631_edje_var_list_remove_nth(Edje *ed, int id, int n)
632{
633 if (!ed) return;
634 if (!ed->var_pool) return;
635 id -= EDJE_VAR_MAGIC_BASE;
636 if ((id < 0) || (id >= ed->var_pool->size)) return;
637 if (ed->var_pool->vars[id].type == EDJE_VAR_NONE)
638 ed->var_pool->vars[id].type = EDJE_VAR_LIST;
639 else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return;
640 {
641 Eina_List *nth;
642
643 nth = eina_list_nth_list(ed->var_pool->vars[id].data.l.v, n);
644 if (nth)
645 {
646 _edje_var_free(eina_list_data_get(nth));
647 ed->var_pool->vars[id].data.l.v = eina_list_remove_list(ed->var_pool->vars[id].data.l.v, nth);
648 }
649 }
650}
651
652int
653_edje_var_list_nth_int_get(Edje *ed, int id, int n)
654{
655 if (!ed) return 0;
656 if (!ed->var_pool) return 0;
657 id -= EDJE_VAR_MAGIC_BASE;
658 if ((id < 0) || (id >= ed->var_pool->size)) return 0;
659 if (ed->var_pool->vars[id].type == EDJE_VAR_NONE)
660 ed->var_pool->vars[id].type = EDJE_VAR_LIST;
661 else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return 0;
662 {
663 Edje_Var *var;
664
665 id += EDJE_VAR_MAGIC_BASE;
666 var = _edje_var_list_nth(ed, id, n);
667 if (!var) return 0;
668 return _edje_var_var_int_get(ed, var);
669 }
670}
671
672void
673_edje_var_list_nth_int_set(Edje *ed, int id, int n, int v)
674{
675 if (!ed) return;
676 if (!ed->var_pool) return;
677 id -= EDJE_VAR_MAGIC_BASE;
678 if ((id < 0) || (id >= ed->var_pool->size)) return;
679 if (ed->var_pool->vars[id].type == EDJE_VAR_NONE)
680 ed->var_pool->vars[id].type = EDJE_VAR_LIST;
681 else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return;
682 {
683 Edje_Var *var;
684
685 id += EDJE_VAR_MAGIC_BASE;
686 var = _edje_var_list_nth(ed, id, n);
687 if (!var) return;
688 _edje_var_var_int_set(ed, var, v);
689 }
690}
691
692void
693_edje_var_list_int_append(Edje *ed, int id, int v)
694{
695 if (!ed) return;
696 if (!ed->var_pool) return;
697 id -= EDJE_VAR_MAGIC_BASE;
698 if ((id < 0) || (id >= ed->var_pool->size)) return;
699 if (ed->var_pool->vars[id].type == EDJE_VAR_NONE)
700 ed->var_pool->vars[id].type = EDJE_VAR_LIST;
701 else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return;
702 {
703 Edje_Var *var;
704
705 var = _edje_var_new();
706 if (!var) return;
707 id += EDJE_VAR_MAGIC_BASE;
708 _edje_var_var_int_set(ed, var, v);
709 _edje_var_list_var_append(ed, id, var);
710 }
711}
712
713void
714_edje_var_list_int_prepend(Edje *ed, int id, int v)
715{
716 if (!ed) return;
717 if (!ed->var_pool) return;
718 id -= EDJE_VAR_MAGIC_BASE;
719 if ((id < 0) || (id >= ed->var_pool->size)) return;
720 if (ed->var_pool->vars[id].type == EDJE_VAR_NONE)
721 ed->var_pool->vars[id].type = EDJE_VAR_LIST;
722 else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return;
723 {
724 Edje_Var *var;
725
726 var = _edje_var_new();
727 if (!var) return;
728 id += EDJE_VAR_MAGIC_BASE;
729 _edje_var_var_int_set(ed, var, v);
730 _edje_var_list_var_prepend(ed, id, var);
731 }
732}
733
734void
735_edje_var_list_int_insert(Edje *ed, int id, int n, int v)
736{
737 if (!ed) return;
738 if (!ed->var_pool) return;
739 id -= EDJE_VAR_MAGIC_BASE;
740 if ((id < 0) || (id >= ed->var_pool->size)) return;
741 if (ed->var_pool->vars[id].type == EDJE_VAR_NONE)
742 ed->var_pool->vars[id].type = EDJE_VAR_LIST;
743 else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return;
744 {
745 Edje_Var *var, *var_rel;
746
747 var = _edje_var_new();
748 if (!var) return;
749 id += EDJE_VAR_MAGIC_BASE;
750 _edje_var_var_int_set(ed, var, v);
751 var_rel = _edje_var_list_nth(ed, id, n);
752 if (!var_rel)
753 _edje_var_list_var_append(ed, id, var);
754 else
755 _edje_var_list_var_prepend_relative(ed, id, var, var_rel);
756 }
757}
758
759double
760_edje_var_list_nth_float_get(Edje *ed, int id, int n)
761{
762 if (!ed) return 0;
763 if (!ed->var_pool) return 0;
764 id -= EDJE_VAR_MAGIC_BASE;
765 if ((id < 0) || (id >= ed->var_pool->size)) return 0;
766 if (ed->var_pool->vars[id].type == EDJE_VAR_NONE)
767 ed->var_pool->vars[id].type = EDJE_VAR_LIST;
768 else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return 0;
769 {
770 Edje_Var *var;
771
772 id += EDJE_VAR_MAGIC_BASE;
773 var = _edje_var_list_nth(ed, id, n);
774 if (!var) return 0;
775 return _edje_var_var_float_get(ed, var);
776 }
777}
778
779void
780_edje_var_list_nth_float_set(Edje *ed, int id, int n, double v)
781{
782 if (!ed) return;
783 if (!ed->var_pool) return;
784 id -= EDJE_VAR_MAGIC_BASE;
785 if ((id < 0) || (id >= ed->var_pool->size)) return;
786 if (ed->var_pool->vars[id].type == EDJE_VAR_NONE)
787 ed->var_pool->vars[id].type = EDJE_VAR_LIST;
788 else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return;
789 {
790 Edje_Var *var;
791
792 id += EDJE_VAR_MAGIC_BASE;
793 var = _edje_var_list_nth(ed, id, n);
794 if (!var) return;
795 _edje_var_var_float_set(ed, var, v);
796 }
797}
798
799void
800_edje_var_list_float_append(Edje *ed, int id, double v)
801{
802 if (!ed) return;
803 if (!ed->var_pool) return;
804 id -= EDJE_VAR_MAGIC_BASE;
805 if ((id < 0) || (id >= ed->var_pool->size)) return;
806 if (ed->var_pool->vars[id].type == EDJE_VAR_NONE)
807 ed->var_pool->vars[id].type = EDJE_VAR_LIST;
808 else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return;
809 {
810 Edje_Var *var;
811
812 var = _edje_var_new();
813 if (!var) return;
814 id += EDJE_VAR_MAGIC_BASE;
815 _edje_var_var_float_set(ed, var, v);
816 _edje_var_list_var_append(ed, id, var);
817 }
818}
819
820void
821_edje_var_list_float_prepend(Edje *ed, int id, double v)
822{
823 if (!ed) return;
824 if (!ed->var_pool) return;
825 id -= EDJE_VAR_MAGIC_BASE;
826 if ((id < 0) || (id >= ed->var_pool->size)) return;
827 if (ed->var_pool->vars[id].type == EDJE_VAR_NONE)
828 ed->var_pool->vars[id].type = EDJE_VAR_LIST;
829 else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return;
830 {
831 Edje_Var *var;
832
833 var = _edje_var_new();
834 if (!var) return;
835 id += EDJE_VAR_MAGIC_BASE;
836 _edje_var_var_float_set(ed, var, v);
837 _edje_var_list_var_prepend(ed, id, var);
838 }
839}
840
841void
842_edje_var_list_float_insert(Edje *ed, int id, int n, double v)
843{
844 if (!ed) return;
845 if (!ed->var_pool) return;
846 id -= EDJE_VAR_MAGIC_BASE;
847 if ((id < 0) || (id >= ed->var_pool->size)) return;
848 if (ed->var_pool->vars[id].type == EDJE_VAR_NONE)
849 ed->var_pool->vars[id].type = EDJE_VAR_LIST;
850 else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return;
851 {
852 Edje_Var *var, *var_rel;
853
854 var = _edje_var_new();
855 if (!var) return;
856 id += EDJE_VAR_MAGIC_BASE;
857 _edje_var_var_float_set(ed, var, v);
858 var_rel = _edje_var_list_nth(ed, id, n);
859 if (!var_rel)
860 _edje_var_list_var_append(ed, id, var);
861 else
862 _edje_var_list_var_prepend_relative(ed, id, var, var_rel);
863 }
864}
865
866const char *
867_edje_var_list_nth_str_get(Edje *ed, int id, int n)
868{
869 if (!ed) return NULL;
870 if (!ed->var_pool) return NULL;
871 id -= EDJE_VAR_MAGIC_BASE;
872 if ((id < 0) || (id >= ed->var_pool->size)) return NULL;
873 if (ed->var_pool->vars[id].type == EDJE_VAR_NONE)
874 ed->var_pool->vars[id].type = EDJE_VAR_LIST;
875 else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return NULL;
876 {
877 Edje_Var *var;
878
879 id += EDJE_VAR_MAGIC_BASE;
880 var = _edje_var_list_nth(ed, id, n);
881 if (!var) return NULL;
882 return _edje_var_var_str_get(ed, var);
883 }
884}
885
886void
887_edje_var_list_nth_str_set(Edje *ed, int id, int n, const char *v)
888{
889 if (!ed) return;
890 if (!ed->var_pool) return;
891 id -= EDJE_VAR_MAGIC_BASE;
892 if ((id < 0) || (id >= ed->var_pool->size)) return;
893 if (ed->var_pool->vars[id].type == EDJE_VAR_NONE)
894 ed->var_pool->vars[id].type = EDJE_VAR_LIST;
895 else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return;
896 {
897 Edje_Var *var;
898
899 id += EDJE_VAR_MAGIC_BASE;
900 var = _edje_var_list_nth(ed, id, n);
901 if (!var) return;
902 _edje_var_var_str_set(ed, var, v);
903 }
904}
905
906void
907_edje_var_list_str_append(Edje *ed, int id, const char *v)
908{
909 if (!ed) return;
910 if (!ed->var_pool) return;
911 id -= EDJE_VAR_MAGIC_BASE;
912 if ((id < 0) || (id >= ed->var_pool->size)) return;
913 if (ed->var_pool->vars[id].type == EDJE_VAR_NONE)
914 ed->var_pool->vars[id].type = EDJE_VAR_LIST;
915 else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return;
916 {
917 Edje_Var *var;
918
919 var = _edje_var_new();
920 if (!var) return;
921 id += EDJE_VAR_MAGIC_BASE;
922 _edje_var_var_str_set(ed, var, v);
923 _edje_var_list_var_append(ed, id, var);
924 }
925}
926
927void
928_edje_var_list_str_prepend(Edje *ed, int id, const char *v)
929{
930 if (!ed) return;
931 if (!ed->var_pool) return;
932 id -= EDJE_VAR_MAGIC_BASE;
933 if ((id < 0) || (id >= ed->var_pool->size)) return;
934 if (ed->var_pool->vars[id].type == EDJE_VAR_NONE)
935 ed->var_pool->vars[id].type = EDJE_VAR_LIST;
936 else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return;
937 {
938 Edje_Var *var;
939
940 var = _edje_var_new();
941 if (!var) return;
942 id += EDJE_VAR_MAGIC_BASE;
943 _edje_var_var_str_set(ed, var, v);
944 _edje_var_list_var_prepend(ed, id, var);
945 }
946}
947
948void
949_edje_var_list_str_insert(Edje *ed, int id, int n, const char *v)
950{
951 if (!ed) return;
952 if (!ed->var_pool) return;
953 id -= EDJE_VAR_MAGIC_BASE;
954 if ((id < 0) || (id >= ed->var_pool->size)) return;
955 if (ed->var_pool->vars[id].type == EDJE_VAR_NONE)
956 ed->var_pool->vars[id].type = EDJE_VAR_LIST;
957 else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return;
958 {
959 Edje_Var *var, *var_rel;
960
961 var = _edje_var_new();
962 if (!var) return;
963 id += EDJE_VAR_MAGIC_BASE;
964 _edje_var_var_str_set(ed, var, v);
965 var_rel = _edje_var_list_nth(ed, id, n);
966 if (!var_rel)
967 _edje_var_list_var_append(ed, id, var);
968 else
969 _edje_var_list_var_prepend_relative(ed, id, var, var_rel);
970 }
971}
972
973int
974_edje_var_timer_add(Edje *ed, double in, const char *fname, int val)
975{
976 Edje_Var_Timer *et;
977 Embryo_Function fn;
978
979 if (!ed->var_pool) return 0;
980 fn = embryo_program_function_find(ed->collection->script, (char *)fname);
981 if (fn == EMBRYO_FUNCTION_NONE) return 0;
982 et = calloc(1, sizeof(Edje_Var_Timer));
983 if (!et) return 0;
984 et->id = ++ed->var_pool->id_count;
985 et->edje = ed;
986 et->func = fn;
987 et->val = val;
988 et->timer = ecore_timer_add(in, _edje_var_timer_cb, et);
989 if (!et->timer)
990 {
991 free(et);
992 return 0;
993 }
994 ed->var_pool->timers = eina_list_prepend(ed->var_pool->timers, et);
995 return et->id;
996}
997
998static Edje_Var_Timer *
999_edje_var_timer_find(Edje *ed, int id)
1000{
1001 Eina_List *l;
1002 Edje_Var_Timer *et;
1003
1004 if (!ed->var_pool) return NULL;
1005
1006 EINA_LIST_FOREACH(ed->var_pool->timers, l, et)
1007 if (et->id == id) return et;
1008
1009 return NULL;
1010}
1011
1012void
1013_edje_var_timer_del(Edje *ed, int id)
1014{
1015 Edje_Var_Timer *et;
1016
1017 et = _edje_var_timer_find(ed, id);
1018 if (!et) return;
1019
1020 ed->var_pool->timers = eina_list_remove(ed->var_pool->timers, et);
1021 ecore_timer_del(et->timer);
1022 free(et);
1023}
1024
1025int
1026_edje_var_anim_add(Edje *ed, double len, const char *fname, int val)
1027{
1028 Edje_Var_Animator *ea;
1029 Embryo_Function fn;
1030
1031 if (!ed->var_pool) return 0;
1032 if (len <= 0.0) return 0;
1033 fn = embryo_program_function_find(ed->collection->script, (char *)fname);
1034 if (fn == EMBRYO_FUNCTION_NONE) return 0;
1035 ea = calloc(1, sizeof(Edje_Var_Animator));
1036 if (!ea) return 0;
1037 ea->start = ecore_loop_time_get();
1038 ea->len = len;
1039 ea->id = ++ed->var_pool->id_count;
1040 ea->edje = ed;
1041 ea->func = fn;
1042 ea->val = val;
1043 if (!ed->var_pool->animators)
1044 _edje_anim_list = eina_list_append(_edje_anim_list, ed);
1045 ed->var_pool->animators = eina_list_prepend(ed->var_pool->animators, ea);
1046 if (!_edje_animator)
1047 _edje_animator = ecore_animator_add(_edje_var_anim_cb, NULL);
1048 return ea->id;
1049}
1050
1051static Edje_Var_Animator *
1052_edje_var_anim_find(Edje *ed, int id)
1053{
1054 Eina_List *l;
1055 Edje_Var_Animator *ea;
1056
1057 if (!ed->var_pool) return NULL;
1058
1059 EINA_LIST_FOREACH(ed->var_pool->animators, l, ea)
1060 if (ea->id == id) return ea;
1061
1062 return NULL;
1063}
1064
1065void
1066_edje_var_anim_del(Edje *ed, int id)
1067{
1068 Edje_Var_Animator *ea;
1069
1070 ea = _edje_var_anim_find(ed, id);
1071 if (!ea) return;
1072
1073 if (ed->var_pool->walking_list)
1074 {
1075 ea->delete_me = 1;
1076 return;
1077 }
1078
1079 ed->var_pool->animators = eina_list_remove(ed->var_pool->animators, ea);
1080 free(ea);
1081
1082 if (ed->var_pool->animators) return;
1083
1084 _edje_anim_list = eina_list_remove(_edje_anim_list, ed);
1085 if (!_edje_anim_list)
1086 {
1087 if (_edje_animator)
1088 {
1089 ecore_animator_del(_edje_animator);
1090 _edje_animator = NULL;
1091 }
1092 }
1093}
diff --git a/libraries/edje/src/modules/Makefile.am b/libraries/edje/src/modules/Makefile.am
new file mode 100644
index 0000000..937a690
--- /dev/null
+++ b/libraries/edje/src/modules/Makefile.am
@@ -0,0 +1,10 @@
1if ENABLE_MULTISENSE
2FACTORY_MODULE = multisense_factory
3if HAVE_LIBREMIX
4SND_READER_MODULE = eet_snd_reader
5if HAVE_LIBALSA
6ALSA_MODULE = alsa_snd_player
7endif
8endif
9endif
10SUBDIRS = $(FACTORY_MODULE) $(SND_READER_MODULE) $(ALSA_MODULE)
diff --git a/libraries/edje/src/modules/Makefile.in b/libraries/edje/src/modules/Makefile.in
new file mode 100644
index 0000000..55c47d6
--- /dev/null
+++ b/libraries/edje/src/modules/Makefile.in
@@ -0,0 +1,637 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17VPATH = @srcdir@
18pkgdatadir = $(datadir)/@PACKAGE@
19pkgincludedir = $(includedir)/@PACKAGE@
20pkglibdir = $(libdir)/@PACKAGE@
21pkglibexecdir = $(libexecdir)/@PACKAGE@
22am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
23install_sh_DATA = $(install_sh) -c -m 644
24install_sh_PROGRAM = $(install_sh) -c
25install_sh_SCRIPT = $(install_sh) -c
26INSTALL_HEADER = $(INSTALL_DATA)
27transform = $(program_transform_name)
28NORMAL_INSTALL = :
29PRE_INSTALL = :
30POST_INSTALL = :
31NORMAL_UNINSTALL = :
32PRE_UNINSTALL = :
33POST_UNINSTALL = :
34build_triplet = @build@
35host_triplet = @host@
36subdir = src/modules
37DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
38ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
39am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
40 $(top_srcdir)/m4/efl_binary.m4 \
41 $(top_srcdir)/m4/efl_coverage.m4 \
42 $(top_srcdir)/m4/efl_doxygen.m4 \
43 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
44 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
45 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
46 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
47am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
48 $(ACLOCAL_M4)
49mkinstalldirs = $(install_sh) -d
50CONFIG_HEADER = $(top_builddir)/config.h
51CONFIG_CLEAN_FILES =
52CONFIG_CLEAN_VPATH_FILES =
53AM_V_GEN = $(am__v_GEN_$(V))
54am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
55am__v_GEN_0 = @echo " GEN " $@;
56AM_V_at = $(am__v_at_$(V))
57am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
58am__v_at_0 = @
59SOURCES =
60DIST_SOURCES =
61RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
62 html-recursive info-recursive install-data-recursive \
63 install-dvi-recursive install-exec-recursive \
64 install-html-recursive install-info-recursive \
65 install-pdf-recursive install-ps-recursive install-recursive \
66 installcheck-recursive installdirs-recursive pdf-recursive \
67 ps-recursive uninstall-recursive
68RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
69 distclean-recursive maintainer-clean-recursive
70AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
71 $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
72 distdir
73ETAGS = etags
74CTAGS = ctags
75DIST_SUBDIRS = multisense_factory eet_snd_reader alsa_snd_player
76DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
77am__relativize = \
78 dir0=`pwd`; \
79 sed_first='s,^\([^/]*\)/.*$$,\1,'; \
80 sed_rest='s,^[^/]*/*,,'; \
81 sed_last='s,^.*/\([^/]*\)$$,\1,'; \
82 sed_butlast='s,/*[^/]*$$,,'; \
83 while test -n "$$dir1"; do \
84 first=`echo "$$dir1" | sed -e "$$sed_first"`; \
85 if test "$$first" != "."; then \
86 if test "$$first" = ".."; then \
87 dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
88 dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
89 else \
90 first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
91 if test "$$first2" = "$$first"; then \
92 dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
93 else \
94 dir2="../$$dir2"; \
95 fi; \
96 dir0="$$dir0"/"$$first"; \
97 fi; \
98 fi; \
99 dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
100 done; \
101 reldir="$$dir2"
102ACLOCAL = @ACLOCAL@
103ALLOCA = @ALLOCA@
104ALSA_CFLAGS = @ALSA_CFLAGS@
105ALSA_LIBS = @ALSA_LIBS@
106AMTAR = @AMTAR@
107AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
108AR = @AR@
109AS = @AS@
110AUTOCONF = @AUTOCONF@
111AUTOHEADER = @AUTOHEADER@
112AUTOMAKE = @AUTOMAKE@
113AWK = @AWK@
114CC = @CC@
115CCDEPMODE = @CCDEPMODE@
116CFLAGS = @CFLAGS@
117CHECK_CFLAGS = @CHECK_CFLAGS@
118CHECK_LIBS = @CHECK_LIBS@
119CPP = @CPP@
120CPPFLAGS = @CPPFLAGS@
121CYGPATH_W = @CYGPATH_W@
122DEFS = @DEFS@
123DEPDIR = @DEPDIR@
124DLLTOOL = @DLLTOOL@
125DSYMUTIL = @DSYMUTIL@
126DUMPBIN = @DUMPBIN@
127ECHO_C = @ECHO_C@
128ECHO_N = @ECHO_N@
129ECHO_T = @ECHO_T@
130ECORE_IMF_CFLAGS = @ECORE_IMF_CFLAGS@
131ECORE_IMF_LIBS = @ECORE_IMF_LIBS@
132EDJE_CC_CFLAGS = @EDJE_CC_CFLAGS@
133EDJE_CC_LIBS = @EDJE_CC_LIBS@
134EDJE_CC_PRG = @EDJE_CC_PRG@
135EDJE_CFLAGS = @EDJE_CFLAGS@
136EDJE_DECC_CFLAGS = @EDJE_DECC_CFLAGS@
137EDJE_DECC_LIBS = @EDJE_DECC_LIBS@
138EDJE_DECC_PRG = @EDJE_DECC_PRG@
139EDJE_EXTERNAL_INSPECTOR_CFLAGS = @EDJE_EXTERNAL_INSPECTOR_CFLAGS@
140EDJE_EXTERNAL_INSPECTOR_LIBS = @EDJE_EXTERNAL_INSPECTOR_LIBS@
141EDJE_EXTERNAL_INSPECTOR_PRG = @EDJE_EXTERNAL_INSPECTOR_PRG@
142EDJE_INSPECTOR_CFLAGS = @EDJE_INSPECTOR_CFLAGS@
143EDJE_INSPECTOR_LIBS = @EDJE_INSPECTOR_LIBS@
144EDJE_INSPECTOR_PRG = @EDJE_INSPECTOR_PRG@
145EDJE_LIBS = @EDJE_LIBS@
146EDJE_PLAYER_CFLAGS = @EDJE_PLAYER_CFLAGS@
147EDJE_PLAYER_LIBS = @EDJE_PLAYER_LIBS@
148EDJE_PLAYER_PRG = @EDJE_PLAYER_PRG@
149EDJE_RECC_PRG = @EDJE_RECC_PRG@
150EFL_COVERAGE_CFLAGS = @EFL_COVERAGE_CFLAGS@
151EFL_COVERAGE_LIBS = @EFL_COVERAGE_LIBS@
152EFL_EDJE_BUILD = @EFL_EDJE_BUILD@
153EGREP = @EGREP@
154EVIL_CFLAGS = @EVIL_CFLAGS@
155EVIL_LIBS = @EVIL_LIBS@
156EXEEXT = @EXEEXT@
157FGREP = @FGREP@
158FLAC_CFLAGS = @FLAC_CFLAGS@
159FLAC_LIBS = @FLAC_LIBS@
160GREP = @GREP@
161INSTALL = @INSTALL@
162INSTALL_DATA = @INSTALL_DATA@
163INSTALL_PROGRAM = @INSTALL_PROGRAM@
164INSTALL_SCRIPT = @INSTALL_SCRIPT@
165INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
166LD = @LD@
167LDFLAGS = @LDFLAGS@
168LIBOBJS = @LIBOBJS@
169LIBS = @LIBS@
170LIBTOOL = @LIBTOOL@
171LIPO = @LIPO@
172LN_S = @LN_S@
173LTLIBOBJS = @LTLIBOBJS@
174LUA_CFLAGS = @LUA_CFLAGS@
175LUA_LIBS = @LUA_LIBS@
176MAKEINFO = @MAKEINFO@
177MINIMAL_CFLAGS = @MINIMAL_CFLAGS@
178MINIMAL_LIBS = @MINIMAL_LIBS@
179MKDIR_P = @MKDIR_P@
180MODULE_ARCH = @MODULE_ARCH@
181NM = @NM@
182NMEDIT = @NMEDIT@
183OBJDUMP = @OBJDUMP@
184OBJEXT = @OBJEXT@
185OTOOL = @OTOOL@
186OTOOL64 = @OTOOL64@
187PACKAGE = @PACKAGE@
188PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
189PACKAGE_NAME = @PACKAGE_NAME@
190PACKAGE_STRING = @PACKAGE_STRING@
191PACKAGE_TARNAME = @PACKAGE_TARNAME@
192PACKAGE_URL = @PACKAGE_URL@
193PACKAGE_VERSION = @PACKAGE_VERSION@
194PATH_SEPARATOR = @PATH_SEPARATOR@
195PKG_CONFIG = @PKG_CONFIG@
196PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
197PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
198PYTHON = @PYTHON@
199PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
200PYTHON_PLATFORM = @PYTHON_PLATFORM@
201PYTHON_PREFIX = @PYTHON_PREFIX@
202PYTHON_VERSION = @PYTHON_VERSION@
203RANLIB = @RANLIB@
204REMIX_CFLAGS = @REMIX_CFLAGS@
205REMIX_LIBS = @REMIX_LIBS@
206REMIX_PLUGIN_DIR = @REMIX_PLUGIN_DIR@
207SED = @SED@
208SET_MAKE = @SET_MAKE@
209SHELL = @SHELL@
210SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
211SNDFILE_LIBS = @SNDFILE_LIBS@
212STRIP = @STRIP@
213VERSION = @VERSION@
214VMAJ = @VMAJ@
215VORBISENC_CFLAGS = @VORBISENC_CFLAGS@
216VORBISENC_LIBS = @VORBISENC_LIBS@
217abs_builddir = @abs_builddir@
218abs_srcdir = @abs_srcdir@
219abs_top_builddir = @abs_top_builddir@
220abs_top_srcdir = @abs_top_srcdir@
221ac_ct_CC = @ac_ct_CC@
222ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
223am__include = @am__include@
224am__leading_dot = @am__leading_dot@
225am__quote = @am__quote@
226am__tar = @am__tar@
227am__untar = @am__untar@
228bindir = @bindir@
229build = @build@
230build_alias = @build_alias@
231build_cpu = @build_cpu@
232build_os = @build_os@
233build_vendor = @build_vendor@
234builddir = @builddir@
235datadir = @datadir@
236datarootdir = @datarootdir@
237docdir = @docdir@
238dvidir = @dvidir@
239edje_cc = @edje_cc@
240efl_doxygen = @efl_doxygen@
241efl_have_doxygen = @efl_have_doxygen@
242exec_prefix = @exec_prefix@
243have_lcov = @have_lcov@
244host = @host@
245host_alias = @host_alias@
246host_cpu = @host_cpu@
247host_os = @host_os@
248host_vendor = @host_vendor@
249htmldir = @htmldir@
250includedir = @includedir@
251infodir = @infodir@
252install_sh = @install_sh@
253libdir = @libdir@
254libexecdir = @libexecdir@
255localedir = @localedir@
256localstatedir = @localstatedir@
257lt_ECHO = @lt_ECHO@
258lt_enable_auto_import = @lt_enable_auto_import@
259lua_libs = @lua_libs@
260mandir = @mandir@
261mkdir_p = @mkdir_p@
262oldincludedir = @oldincludedir@
263pdfdir = @pdfdir@
264pkgconfig_requires_private = @pkgconfig_requires_private@
265pkgpyexecdir = @pkgpyexecdir@
266pkgpythondir = @pkgpythondir@
267prefix = @prefix@
268program_transform_name = @program_transform_name@
269psdir = @psdir@
270pyexecdir = @pyexecdir@
271pythondir = @pythondir@
272release_info = @release_info@
273requirement_edje = @requirement_edje@
274sbindir = @sbindir@
275sharedstatedir = @sharedstatedir@
276srcdir = @srcdir@
277sysconfdir = @sysconfdir@
278target_alias = @target_alias@
279top_build_prefix = @top_build_prefix@
280top_builddir = @top_builddir@
281top_srcdir = @top_srcdir@
282version_info = @version_info@
283vimdir = @vimdir@
284@ENABLE_MULTISENSE_TRUE@FACTORY_MODULE = multisense_factory
285@ENABLE_MULTISENSE_TRUE@@HAVE_LIBREMIX_TRUE@SND_READER_MODULE = eet_snd_reader
286@ENABLE_MULTISENSE_TRUE@@HAVE_LIBALSA_TRUE@@HAVE_LIBREMIX_TRUE@ALSA_MODULE = alsa_snd_player
287SUBDIRS = $(FACTORY_MODULE) $(SND_READER_MODULE) $(ALSA_MODULE)
288all: all-recursive
289
290.SUFFIXES:
291$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
292 @for dep in $?; do \
293 case '$(am__configure_deps)' in \
294 *$$dep*) \
295 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
296 && { if test -f $@; then exit 0; else break; fi; }; \
297 exit 1;; \
298 esac; \
299 done; \
300 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/modules/Makefile'; \
301 $(am__cd) $(top_srcdir) && \
302 $(AUTOMAKE) --gnu src/modules/Makefile
303.PRECIOUS: Makefile
304Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
305 @case '$?' in \
306 *config.status*) \
307 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
308 *) \
309 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
310 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
311 esac;
312
313$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
314 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
315
316$(top_srcdir)/configure: $(am__configure_deps)
317 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
318$(ACLOCAL_M4): $(am__aclocal_m4_deps)
319 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
320$(am__aclocal_m4_deps):
321
322mostlyclean-libtool:
323 -rm -f *.lo
324
325clean-libtool:
326 -rm -rf .libs _libs
327
328# This directory's subdirectories are mostly independent; you can cd
329# into them and run `make' without going through this Makefile.
330# To change the values of `make' variables: instead of editing Makefiles,
331# (1) if the variable is set in `config.status', edit `config.status'
332# (which will cause the Makefiles to be regenerated when you run `make');
333# (2) otherwise, pass the desired values on the `make' command line.
334$(RECURSIVE_TARGETS):
335 @fail= failcom='exit 1'; \
336 for f in x $$MAKEFLAGS; do \
337 case $$f in \
338 *=* | --[!k]*);; \
339 *k*) failcom='fail=yes';; \
340 esac; \
341 done; \
342 dot_seen=no; \
343 target=`echo $@ | sed s/-recursive//`; \
344 list='$(SUBDIRS)'; for subdir in $$list; do \
345 echo "Making $$target in $$subdir"; \
346 if test "$$subdir" = "."; then \
347 dot_seen=yes; \
348 local_target="$$target-am"; \
349 else \
350 local_target="$$target"; \
351 fi; \
352 ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
353 || eval $$failcom; \
354 done; \
355 if test "$$dot_seen" = "no"; then \
356 $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
357 fi; test -z "$$fail"
358
359$(RECURSIVE_CLEAN_TARGETS):
360 @fail= failcom='exit 1'; \
361 for f in x $$MAKEFLAGS; do \
362 case $$f in \
363 *=* | --[!k]*);; \
364 *k*) failcom='fail=yes';; \
365 esac; \
366 done; \
367 dot_seen=no; \
368 case "$@" in \
369 distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
370 *) list='$(SUBDIRS)' ;; \
371 esac; \
372 rev=''; for subdir in $$list; do \
373 if test "$$subdir" = "."; then :; else \
374 rev="$$subdir $$rev"; \
375 fi; \
376 done; \
377 rev="$$rev ."; \
378 target=`echo $@ | sed s/-recursive//`; \
379 for subdir in $$rev; do \
380 echo "Making $$target in $$subdir"; \
381 if test "$$subdir" = "."; then \
382 local_target="$$target-am"; \
383 else \
384 local_target="$$target"; \
385 fi; \
386 ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
387 || eval $$failcom; \
388 done && test -z "$$fail"
389tags-recursive:
390 list='$(SUBDIRS)'; for subdir in $$list; do \
391 test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
392 done
393ctags-recursive:
394 list='$(SUBDIRS)'; for subdir in $$list; do \
395 test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
396 done
397
398ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
399 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
400 unique=`for i in $$list; do \
401 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
402 done | \
403 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
404 END { if (nonempty) { for (i in files) print i; }; }'`; \
405 mkid -fID $$unique
406tags: TAGS
407
408TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
409 $(TAGS_FILES) $(LISP)
410 set x; \
411 here=`pwd`; \
412 if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
413 include_option=--etags-include; \
414 empty_fix=.; \
415 else \
416 include_option=--include; \
417 empty_fix=; \
418 fi; \
419 list='$(SUBDIRS)'; for subdir in $$list; do \
420 if test "$$subdir" = .; then :; else \
421 test ! -f $$subdir/TAGS || \
422 set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
423 fi; \
424 done; \
425 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
426 unique=`for i in $$list; do \
427 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
428 done | \
429 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
430 END { if (nonempty) { for (i in files) print i; }; }'`; \
431 shift; \
432 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
433 test -n "$$unique" || unique=$$empty_fix; \
434 if test $$# -gt 0; then \
435 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
436 "$$@" $$unique; \
437 else \
438 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
439 $$unique; \
440 fi; \
441 fi
442ctags: CTAGS
443CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
444 $(TAGS_FILES) $(LISP)
445 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
446 unique=`for i in $$list; do \
447 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
448 done | \
449 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
450 END { if (nonempty) { for (i in files) print i; }; }'`; \
451 test -z "$(CTAGS_ARGS)$$unique" \
452 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
453 $$unique
454
455GTAGS:
456 here=`$(am__cd) $(top_builddir) && pwd` \
457 && $(am__cd) $(top_srcdir) \
458 && gtags -i $(GTAGS_ARGS) "$$here"
459
460distclean-tags:
461 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
462
463distdir: $(DISTFILES)
464 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
465 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
466 list='$(DISTFILES)'; \
467 dist_files=`for file in $$list; do echo $$file; done | \
468 sed -e "s|^$$srcdirstrip/||;t" \
469 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
470 case $$dist_files in \
471 */*) $(MKDIR_P) `echo "$$dist_files" | \
472 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
473 sort -u` ;; \
474 esac; \
475 for file in $$dist_files; do \
476 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
477 if test -d $$d/$$file; then \
478 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
479 if test -d "$(distdir)/$$file"; then \
480 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
481 fi; \
482 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
483 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
484 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
485 fi; \
486 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
487 else \
488 test -f "$(distdir)/$$file" \
489 || cp -p $$d/$$file "$(distdir)/$$file" \
490 || exit 1; \
491 fi; \
492 done
493 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
494 if test "$$subdir" = .; then :; else \
495 test -d "$(distdir)/$$subdir" \
496 || $(MKDIR_P) "$(distdir)/$$subdir" \
497 || exit 1; \
498 fi; \
499 done
500 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
501 if test "$$subdir" = .; then :; else \
502 dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
503 $(am__relativize); \
504 new_distdir=$$reldir; \
505 dir1=$$subdir; dir2="$(top_distdir)"; \
506 $(am__relativize); \
507 new_top_distdir=$$reldir; \
508 echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
509 echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
510 ($(am__cd) $$subdir && \
511 $(MAKE) $(AM_MAKEFLAGS) \
512 top_distdir="$$new_top_distdir" \
513 distdir="$$new_distdir" \
514 am__remove_distdir=: \
515 am__skip_length_check=: \
516 am__skip_mode_fix=: \
517 distdir) \
518 || exit 1; \
519 fi; \
520 done
521check-am: all-am
522check: check-recursive
523all-am: Makefile
524installdirs: installdirs-recursive
525installdirs-am:
526install: install-recursive
527install-exec: install-exec-recursive
528install-data: install-data-recursive
529uninstall: uninstall-recursive
530
531install-am: all-am
532 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
533
534installcheck: installcheck-recursive
535install-strip:
536 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
537 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
538 `test -z '$(STRIP)' || \
539 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
540mostlyclean-generic:
541
542clean-generic:
543
544distclean-generic:
545 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
546 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
547
548maintainer-clean-generic:
549 @echo "This command is intended for maintainers to use"
550 @echo "it deletes files that may require special tools to rebuild."
551clean: clean-recursive
552
553clean-am: clean-generic clean-libtool mostlyclean-am
554
555distclean: distclean-recursive
556 -rm -f Makefile
557distclean-am: clean-am distclean-generic distclean-tags
558
559dvi: dvi-recursive
560
561dvi-am:
562
563html: html-recursive
564
565html-am:
566
567info: info-recursive
568
569info-am:
570
571install-data-am:
572
573install-dvi: install-dvi-recursive
574
575install-dvi-am:
576
577install-exec-am:
578
579install-html: install-html-recursive
580
581install-html-am:
582
583install-info: install-info-recursive
584
585install-info-am:
586
587install-man:
588
589install-pdf: install-pdf-recursive
590
591install-pdf-am:
592
593install-ps: install-ps-recursive
594
595install-ps-am:
596
597installcheck-am:
598
599maintainer-clean: maintainer-clean-recursive
600 -rm -f Makefile
601maintainer-clean-am: distclean-am maintainer-clean-generic
602
603mostlyclean: mostlyclean-recursive
604
605mostlyclean-am: mostlyclean-generic mostlyclean-libtool
606
607pdf: pdf-recursive
608
609pdf-am:
610
611ps: ps-recursive
612
613ps-am:
614
615uninstall-am:
616
617.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
618 install-am install-strip tags-recursive
619
620.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
621 all all-am check check-am clean clean-generic clean-libtool \
622 ctags ctags-recursive distclean distclean-generic \
623 distclean-libtool distclean-tags distdir dvi dvi-am html \
624 html-am info info-am install install-am install-data \
625 install-data-am install-dvi install-dvi-am install-exec \
626 install-exec-am install-html install-html-am install-info \
627 install-info-am install-man install-pdf install-pdf-am \
628 install-ps install-ps-am install-strip installcheck \
629 installcheck-am installdirs installdirs-am maintainer-clean \
630 maintainer-clean-generic mostlyclean mostlyclean-generic \
631 mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
632 uninstall uninstall-am
633
634
635# Tell versions [3.59,3.63) of GNU make to not export all variables.
636# Otherwise a system limit (for SysV at least) may be exceeded.
637.NOEXPORT:
diff --git a/libraries/edje/src/modules/alsa_snd_player/Makefile.am b/libraries/edje/src/modules/alsa_snd_player/Makefile.am
new file mode 100644
index 0000000..de015f8
--- /dev/null
+++ b/libraries/edje/src/modules/alsa_snd_player/Makefile.am
@@ -0,0 +1,20 @@
1## Process this file with automake to produce Makefile.in
2
3MAINTAINERCLEANFILES = Makefile.in
4
5pkglibdir = $(REMIX_PLUGIN_DIR)
6
7AM_CPPFLAGS = \
8-I. \
9-DPACKAGE_LIB_DIR=\"$(libdir)/remix\" \
10-DPACKAGE_DATA_DIR=\"$(datadir)/remix\" \
11@EDJE_CFLAGS@ \
12@REMIX_CFLAGS@ \
13@ALSA_CFLAGS@
14
15pkgdir = $(REMIX_PLUGIN_DIR)
16pkg_LTLIBRARIES = libalsa_snd_player.la
17
18libalsa_snd_player_la_SOURCES = alsa_snd_player.c
19libalsa_snd_player_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version @EDJE_LIBS@ @REMIX_LIBS@ @ALSA_LIBS@
20libalsa_snd_player_la_LIBTOOLFLAGS = --tag=disable-static
diff --git a/libraries/edje/src/modules/alsa_snd_player/Makefile.in b/libraries/edje/src/modules/alsa_snd_player/Makefile.in
new file mode 100644
index 0000000..ce68f41
--- /dev/null
+++ b/libraries/edje/src/modules/alsa_snd_player/Makefile.in
@@ -0,0 +1,634 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18VPATH = @srcdir@
19pkgdatadir = $(datadir)/@PACKAGE@
20pkgincludedir = $(includedir)/@PACKAGE@
21pkglibexecdir = $(libexecdir)/@PACKAGE@
22am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
23install_sh_DATA = $(install_sh) -c -m 644
24install_sh_PROGRAM = $(install_sh) -c
25install_sh_SCRIPT = $(install_sh) -c
26INSTALL_HEADER = $(INSTALL_DATA)
27transform = $(program_transform_name)
28NORMAL_INSTALL = :
29PRE_INSTALL = :
30POST_INSTALL = :
31NORMAL_UNINSTALL = :
32PRE_UNINSTALL = :
33POST_UNINSTALL = :
34build_triplet = @build@
35host_triplet = @host@
36subdir = src/modules/alsa_snd_player
37DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
38ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
39am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
40 $(top_srcdir)/m4/efl_binary.m4 \
41 $(top_srcdir)/m4/efl_coverage.m4 \
42 $(top_srcdir)/m4/efl_doxygen.m4 \
43 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
44 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
45 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
46 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
47am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
48 $(ACLOCAL_M4)
49mkinstalldirs = $(install_sh) -d
50CONFIG_HEADER = $(top_builddir)/config.h
51CONFIG_CLEAN_FILES =
52CONFIG_CLEAN_VPATH_FILES =
53am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
54am__vpath_adj = case $$p in \
55 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
56 *) f=$$p;; \
57 esac;
58am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
59am__install_max = 40
60am__nobase_strip_setup = \
61 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
62am__nobase_strip = \
63 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
64am__nobase_list = $(am__nobase_strip_setup); \
65 for p in $$list; do echo "$$p $$p"; done | \
66 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
67 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
68 if (++n[$$2] == $(am__install_max)) \
69 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
70 END { for (dir in files) print dir, files[dir] }'
71am__base_list = \
72 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
73 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
74am__installdirs = "$(DESTDIR)$(pkgdir)"
75LTLIBRARIES = $(pkg_LTLIBRARIES)
76libalsa_snd_player_la_LIBADD =
77am_libalsa_snd_player_la_OBJECTS = \
78 libalsa_snd_player_la-alsa_snd_player.lo
79libalsa_snd_player_la_OBJECTS = $(am_libalsa_snd_player_la_OBJECTS)
80AM_V_lt = $(am__v_lt_$(V))
81am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
82am__v_lt_0 = --silent
83libalsa_snd_player_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
84 $(libalsa_snd_player_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
85 --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
86 $(libalsa_snd_player_la_LDFLAGS) $(LDFLAGS) -o $@
87DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
88depcomp = $(SHELL) $(top_srcdir)/depcomp
89am__depfiles_maybe = depfiles
90am__mv = mv -f
91COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
92 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
93LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
94 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
95 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
96 $(AM_CFLAGS) $(CFLAGS)
97AM_V_CC = $(am__v_CC_$(V))
98am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
99am__v_CC_0 = @echo " CC " $@;
100AM_V_at = $(am__v_at_$(V))
101am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
102am__v_at_0 = @
103CCLD = $(CC)
104LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
105 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
106 $(AM_LDFLAGS) $(LDFLAGS) -o $@
107AM_V_CCLD = $(am__v_CCLD_$(V))
108am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
109am__v_CCLD_0 = @echo " CCLD " $@;
110AM_V_GEN = $(am__v_GEN_$(V))
111am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
112am__v_GEN_0 = @echo " GEN " $@;
113SOURCES = $(libalsa_snd_player_la_SOURCES)
114DIST_SOURCES = $(libalsa_snd_player_la_SOURCES)
115ETAGS = etags
116CTAGS = ctags
117DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
118pkglibdir = $(REMIX_PLUGIN_DIR)
119ACLOCAL = @ACLOCAL@
120ALLOCA = @ALLOCA@
121ALSA_CFLAGS = @ALSA_CFLAGS@
122ALSA_LIBS = @ALSA_LIBS@
123AMTAR = @AMTAR@
124AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
125AR = @AR@
126AS = @AS@
127AUTOCONF = @AUTOCONF@
128AUTOHEADER = @AUTOHEADER@
129AUTOMAKE = @AUTOMAKE@
130AWK = @AWK@
131CC = @CC@
132CCDEPMODE = @CCDEPMODE@
133CFLAGS = @CFLAGS@
134CHECK_CFLAGS = @CHECK_CFLAGS@
135CHECK_LIBS = @CHECK_LIBS@
136CPP = @CPP@
137CPPFLAGS = @CPPFLAGS@
138CYGPATH_W = @CYGPATH_W@
139DEFS = @DEFS@
140DEPDIR = @DEPDIR@
141DLLTOOL = @DLLTOOL@
142DSYMUTIL = @DSYMUTIL@
143DUMPBIN = @DUMPBIN@
144ECHO_C = @ECHO_C@
145ECHO_N = @ECHO_N@
146ECHO_T = @ECHO_T@
147ECORE_IMF_CFLAGS = @ECORE_IMF_CFLAGS@
148ECORE_IMF_LIBS = @ECORE_IMF_LIBS@
149EDJE_CC_CFLAGS = @EDJE_CC_CFLAGS@
150EDJE_CC_LIBS = @EDJE_CC_LIBS@
151EDJE_CC_PRG = @EDJE_CC_PRG@
152EDJE_CFLAGS = @EDJE_CFLAGS@
153EDJE_DECC_CFLAGS = @EDJE_DECC_CFLAGS@
154EDJE_DECC_LIBS = @EDJE_DECC_LIBS@
155EDJE_DECC_PRG = @EDJE_DECC_PRG@
156EDJE_EXTERNAL_INSPECTOR_CFLAGS = @EDJE_EXTERNAL_INSPECTOR_CFLAGS@
157EDJE_EXTERNAL_INSPECTOR_LIBS = @EDJE_EXTERNAL_INSPECTOR_LIBS@
158EDJE_EXTERNAL_INSPECTOR_PRG = @EDJE_EXTERNAL_INSPECTOR_PRG@
159EDJE_INSPECTOR_CFLAGS = @EDJE_INSPECTOR_CFLAGS@
160EDJE_INSPECTOR_LIBS = @EDJE_INSPECTOR_LIBS@
161EDJE_INSPECTOR_PRG = @EDJE_INSPECTOR_PRG@
162EDJE_LIBS = @EDJE_LIBS@
163EDJE_PLAYER_CFLAGS = @EDJE_PLAYER_CFLAGS@
164EDJE_PLAYER_LIBS = @EDJE_PLAYER_LIBS@
165EDJE_PLAYER_PRG = @EDJE_PLAYER_PRG@
166EDJE_RECC_PRG = @EDJE_RECC_PRG@
167EFL_COVERAGE_CFLAGS = @EFL_COVERAGE_CFLAGS@
168EFL_COVERAGE_LIBS = @EFL_COVERAGE_LIBS@
169EFL_EDJE_BUILD = @EFL_EDJE_BUILD@
170EGREP = @EGREP@
171EVIL_CFLAGS = @EVIL_CFLAGS@
172EVIL_LIBS = @EVIL_LIBS@
173EXEEXT = @EXEEXT@
174FGREP = @FGREP@
175FLAC_CFLAGS = @FLAC_CFLAGS@
176FLAC_LIBS = @FLAC_LIBS@
177GREP = @GREP@
178INSTALL = @INSTALL@
179INSTALL_DATA = @INSTALL_DATA@
180INSTALL_PROGRAM = @INSTALL_PROGRAM@
181INSTALL_SCRIPT = @INSTALL_SCRIPT@
182INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
183LD = @LD@
184LDFLAGS = @LDFLAGS@
185LIBOBJS = @LIBOBJS@
186LIBS = @LIBS@
187LIBTOOL = @LIBTOOL@
188LIPO = @LIPO@
189LN_S = @LN_S@
190LTLIBOBJS = @LTLIBOBJS@
191LUA_CFLAGS = @LUA_CFLAGS@
192LUA_LIBS = @LUA_LIBS@
193MAKEINFO = @MAKEINFO@
194MINIMAL_CFLAGS = @MINIMAL_CFLAGS@
195MINIMAL_LIBS = @MINIMAL_LIBS@
196MKDIR_P = @MKDIR_P@
197MODULE_ARCH = @MODULE_ARCH@
198NM = @NM@
199NMEDIT = @NMEDIT@
200OBJDUMP = @OBJDUMP@
201OBJEXT = @OBJEXT@
202OTOOL = @OTOOL@
203OTOOL64 = @OTOOL64@
204PACKAGE = @PACKAGE@
205PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
206PACKAGE_NAME = @PACKAGE_NAME@
207PACKAGE_STRING = @PACKAGE_STRING@
208PACKAGE_TARNAME = @PACKAGE_TARNAME@
209PACKAGE_URL = @PACKAGE_URL@
210PACKAGE_VERSION = @PACKAGE_VERSION@
211PATH_SEPARATOR = @PATH_SEPARATOR@
212PKG_CONFIG = @PKG_CONFIG@
213PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
214PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
215PYTHON = @PYTHON@
216PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
217PYTHON_PLATFORM = @PYTHON_PLATFORM@
218PYTHON_PREFIX = @PYTHON_PREFIX@
219PYTHON_VERSION = @PYTHON_VERSION@
220RANLIB = @RANLIB@
221REMIX_CFLAGS = @REMIX_CFLAGS@
222REMIX_LIBS = @REMIX_LIBS@
223REMIX_PLUGIN_DIR = @REMIX_PLUGIN_DIR@
224SED = @SED@
225SET_MAKE = @SET_MAKE@
226SHELL = @SHELL@
227SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
228SNDFILE_LIBS = @SNDFILE_LIBS@
229STRIP = @STRIP@
230VERSION = @VERSION@
231VMAJ = @VMAJ@
232VORBISENC_CFLAGS = @VORBISENC_CFLAGS@
233VORBISENC_LIBS = @VORBISENC_LIBS@
234abs_builddir = @abs_builddir@
235abs_srcdir = @abs_srcdir@
236abs_top_builddir = @abs_top_builddir@
237abs_top_srcdir = @abs_top_srcdir@
238ac_ct_CC = @ac_ct_CC@
239ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
240am__include = @am__include@
241am__leading_dot = @am__leading_dot@
242am__quote = @am__quote@
243am__tar = @am__tar@
244am__untar = @am__untar@
245bindir = @bindir@
246build = @build@
247build_alias = @build_alias@
248build_cpu = @build_cpu@
249build_os = @build_os@
250build_vendor = @build_vendor@
251builddir = @builddir@
252datadir = @datadir@
253datarootdir = @datarootdir@
254docdir = @docdir@
255dvidir = @dvidir@
256edje_cc = @edje_cc@
257efl_doxygen = @efl_doxygen@
258efl_have_doxygen = @efl_have_doxygen@
259exec_prefix = @exec_prefix@
260have_lcov = @have_lcov@
261host = @host@
262host_alias = @host_alias@
263host_cpu = @host_cpu@
264host_os = @host_os@
265host_vendor = @host_vendor@
266htmldir = @htmldir@
267includedir = @includedir@
268infodir = @infodir@
269install_sh = @install_sh@
270libdir = @libdir@
271libexecdir = @libexecdir@
272localedir = @localedir@
273localstatedir = @localstatedir@
274lt_ECHO = @lt_ECHO@
275lt_enable_auto_import = @lt_enable_auto_import@
276lua_libs = @lua_libs@
277mandir = @mandir@
278mkdir_p = @mkdir_p@
279oldincludedir = @oldincludedir@
280pdfdir = @pdfdir@
281pkgconfig_requires_private = @pkgconfig_requires_private@
282pkgpyexecdir = @pkgpyexecdir@
283pkgpythondir = @pkgpythondir@
284prefix = @prefix@
285program_transform_name = @program_transform_name@
286psdir = @psdir@
287pyexecdir = @pyexecdir@
288pythondir = @pythondir@
289release_info = @release_info@
290requirement_edje = @requirement_edje@
291sbindir = @sbindir@
292sharedstatedir = @sharedstatedir@
293srcdir = @srcdir@
294sysconfdir = @sysconfdir@
295target_alias = @target_alias@
296top_build_prefix = @top_build_prefix@
297top_builddir = @top_builddir@
298top_srcdir = @top_srcdir@
299version_info = @version_info@
300vimdir = @vimdir@
301MAINTAINERCLEANFILES = Makefile.in
302AM_CPPFLAGS = \
303-I. \
304-DPACKAGE_LIB_DIR=\"$(libdir)/remix\" \
305-DPACKAGE_DATA_DIR=\"$(datadir)/remix\" \
306@EDJE_CFLAGS@ \
307@REMIX_CFLAGS@ \
308@ALSA_CFLAGS@
309
310pkgdir = $(REMIX_PLUGIN_DIR)
311pkg_LTLIBRARIES = libalsa_snd_player.la
312libalsa_snd_player_la_SOURCES = alsa_snd_player.c
313libalsa_snd_player_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version @EDJE_LIBS@ @REMIX_LIBS@ @ALSA_LIBS@
314libalsa_snd_player_la_LIBTOOLFLAGS = --tag=disable-static
315all: all-am
316
317.SUFFIXES:
318.SUFFIXES: .c .lo .o .obj
319$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
320 @for dep in $?; do \
321 case '$(am__configure_deps)' in \
322 *$$dep*) \
323 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
324 && { if test -f $@; then exit 0; else break; fi; }; \
325 exit 1;; \
326 esac; \
327 done; \
328 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/modules/alsa_snd_player/Makefile'; \
329 $(am__cd) $(top_srcdir) && \
330 $(AUTOMAKE) --gnu src/modules/alsa_snd_player/Makefile
331.PRECIOUS: Makefile
332Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
333 @case '$?' in \
334 *config.status*) \
335 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
336 *) \
337 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
338 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
339 esac;
340
341$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
342 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
343
344$(top_srcdir)/configure: $(am__configure_deps)
345 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
346$(ACLOCAL_M4): $(am__aclocal_m4_deps)
347 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
348$(am__aclocal_m4_deps):
349install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES)
350 @$(NORMAL_INSTALL)
351 test -z "$(pkgdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdir)"
352 @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \
353 list2=; for p in $$list; do \
354 if test -f $$p; then \
355 list2="$$list2 $$p"; \
356 else :; fi; \
357 done; \
358 test -z "$$list2" || { \
359 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkgdir)'"; \
360 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkgdir)"; \
361 }
362
363uninstall-pkgLTLIBRARIES:
364 @$(NORMAL_UNINSTALL)
365 @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \
366 for p in $$list; do \
367 $(am__strip_dir) \
368 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$f'"; \
369 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$f"; \
370 done
371
372clean-pkgLTLIBRARIES:
373 -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES)
374 @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \
375 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
376 test "$$dir" != "$$p" || dir=.; \
377 echo "rm -f \"$${dir}/so_locations\""; \
378 rm -f "$${dir}/so_locations"; \
379 done
380libalsa_snd_player.la: $(libalsa_snd_player_la_OBJECTS) $(libalsa_snd_player_la_DEPENDENCIES)
381 $(AM_V_CCLD)$(libalsa_snd_player_la_LINK) -rpath $(pkgdir) $(libalsa_snd_player_la_OBJECTS) $(libalsa_snd_player_la_LIBADD) $(LIBS)
382
383mostlyclean-compile:
384 -rm -f *.$(OBJEXT)
385
386distclean-compile:
387 -rm -f *.tab.c
388
389@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libalsa_snd_player_la-alsa_snd_player.Plo@am__quote@
390
391.c.o:
392@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
393@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
394@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
395@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
396@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
397@am__fastdepCC_FALSE@ $(COMPILE) -c $<
398
399.c.obj:
400@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
401@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
402@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
403@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
404@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
405@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
406
407.c.lo:
408@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
409@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
410@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
411@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
412@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
413@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
414
415libalsa_snd_player_la-alsa_snd_player.lo: alsa_snd_player.c
416@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libalsa_snd_player_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libalsa_snd_player_la-alsa_snd_player.lo -MD -MP -MF $(DEPDIR)/libalsa_snd_player_la-alsa_snd_player.Tpo -c -o libalsa_snd_player_la-alsa_snd_player.lo `test -f 'alsa_snd_player.c' || echo '$(srcdir)/'`alsa_snd_player.c
417@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libalsa_snd_player_la-alsa_snd_player.Tpo $(DEPDIR)/libalsa_snd_player_la-alsa_snd_player.Plo
418@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
419@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='alsa_snd_player.c' object='libalsa_snd_player_la-alsa_snd_player.lo' libtool=yes @AMDEPBACKSLASH@
420@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
421@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(libalsa_snd_player_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libalsa_snd_player_la-alsa_snd_player.lo `test -f 'alsa_snd_player.c' || echo '$(srcdir)/'`alsa_snd_player.c
422
423mostlyclean-libtool:
424 -rm -f *.lo
425
426clean-libtool:
427 -rm -rf .libs _libs
428
429ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
430 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
431 unique=`for i in $$list; do \
432 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
433 done | \
434 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
435 END { if (nonempty) { for (i in files) print i; }; }'`; \
436 mkid -fID $$unique
437tags: TAGS
438
439TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
440 $(TAGS_FILES) $(LISP)
441 set x; \
442 here=`pwd`; \
443 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
444 unique=`for i in $$list; do \
445 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
446 done | \
447 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
448 END { if (nonempty) { for (i in files) print i; }; }'`; \
449 shift; \
450 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
451 test -n "$$unique" || unique=$$empty_fix; \
452 if test $$# -gt 0; then \
453 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
454 "$$@" $$unique; \
455 else \
456 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
457 $$unique; \
458 fi; \
459 fi
460ctags: CTAGS
461CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
462 $(TAGS_FILES) $(LISP)
463 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
464 unique=`for i in $$list; do \
465 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
466 done | \
467 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
468 END { if (nonempty) { for (i in files) print i; }; }'`; \
469 test -z "$(CTAGS_ARGS)$$unique" \
470 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
471 $$unique
472
473GTAGS:
474 here=`$(am__cd) $(top_builddir) && pwd` \
475 && $(am__cd) $(top_srcdir) \
476 && gtags -i $(GTAGS_ARGS) "$$here"
477
478distclean-tags:
479 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
480
481distdir: $(DISTFILES)
482 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
483 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
484 list='$(DISTFILES)'; \
485 dist_files=`for file in $$list; do echo $$file; done | \
486 sed -e "s|^$$srcdirstrip/||;t" \
487 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
488 case $$dist_files in \
489 */*) $(MKDIR_P) `echo "$$dist_files" | \
490 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
491 sort -u` ;; \
492 esac; \
493 for file in $$dist_files; do \
494 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
495 if test -d $$d/$$file; then \
496 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
497 if test -d "$(distdir)/$$file"; then \
498 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
499 fi; \
500 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
501 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
502 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
503 fi; \
504 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
505 else \
506 test -f "$(distdir)/$$file" \
507 || cp -p $$d/$$file "$(distdir)/$$file" \
508 || exit 1; \
509 fi; \
510 done
511check-am: all-am
512check: check-am
513all-am: Makefile $(LTLIBRARIES)
514installdirs:
515 for dir in "$(DESTDIR)$(pkgdir)"; do \
516 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
517 done
518install: install-am
519install-exec: install-exec-am
520install-data: install-data-am
521uninstall: uninstall-am
522
523install-am: all-am
524 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
525
526installcheck: installcheck-am
527install-strip:
528 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
529 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
530 `test -z '$(STRIP)' || \
531 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
532mostlyclean-generic:
533
534clean-generic:
535
536distclean-generic:
537 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
538 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
539
540maintainer-clean-generic:
541 @echo "This command is intended for maintainers to use"
542 @echo "it deletes files that may require special tools to rebuild."
543 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
544clean: clean-am
545
546clean-am: clean-generic clean-libtool clean-pkgLTLIBRARIES \
547 mostlyclean-am
548
549distclean: distclean-am
550 -rm -rf ./$(DEPDIR)
551 -rm -f Makefile
552distclean-am: clean-am distclean-compile distclean-generic \
553 distclean-tags
554
555dvi: dvi-am
556
557dvi-am:
558
559html: html-am
560
561html-am:
562
563info: info-am
564
565info-am:
566
567install-data-am: install-pkgLTLIBRARIES
568
569install-dvi: install-dvi-am
570
571install-dvi-am:
572
573install-exec-am:
574
575install-html: install-html-am
576
577install-html-am:
578
579install-info: install-info-am
580
581install-info-am:
582
583install-man:
584
585install-pdf: install-pdf-am
586
587install-pdf-am:
588
589install-ps: install-ps-am
590
591install-ps-am:
592
593installcheck-am:
594
595maintainer-clean: maintainer-clean-am
596 -rm -rf ./$(DEPDIR)
597 -rm -f Makefile
598maintainer-clean-am: distclean-am maintainer-clean-generic
599
600mostlyclean: mostlyclean-am
601
602mostlyclean-am: mostlyclean-compile mostlyclean-generic \
603 mostlyclean-libtool
604
605pdf: pdf-am
606
607pdf-am:
608
609ps: ps-am
610
611ps-am:
612
613uninstall-am: uninstall-pkgLTLIBRARIES
614
615.MAKE: install-am install-strip
616
617.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
618 clean-libtool clean-pkgLTLIBRARIES ctags distclean \
619 distclean-compile distclean-generic distclean-libtool \
620 distclean-tags distdir dvi dvi-am html html-am info info-am \
621 install install-am install-data install-data-am install-dvi \
622 install-dvi-am install-exec install-exec-am install-html \
623 install-html-am install-info install-info-am install-man \
624 install-pdf install-pdf-am install-pkgLTLIBRARIES install-ps \
625 install-ps-am install-strip installcheck installcheck-am \
626 installdirs maintainer-clean maintainer-clean-generic \
627 mostlyclean mostlyclean-compile mostlyclean-generic \
628 mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
629 uninstall-am uninstall-pkgLTLIBRARIES
630
631
632# Tell versions [3.59,3.63) of GNU make to not export all variables.
633# Otherwise a system limit (for SysV at least) may be exceeded.
634.NOEXPORT:
diff --git a/libraries/edje/src/modules/alsa_snd_player/alsa_snd_player.c b/libraries/edje/src/modules/alsa_snd_player/alsa_snd_player.c
new file mode 100644
index 0000000..f397255
--- /dev/null
+++ b/libraries/edje/src/modules/alsa_snd_player/alsa_snd_player.c
@@ -0,0 +1,405 @@
1/*
2 * Remix ALSA Player: ALSA audio output
3 *
4 * Govindaraju SM <govi.sm@samsung.com>, October 2011
5 * Prince Kumar Dubey <prince.dubey@samsung.com>, October 2011
6 */
7
8#include "config.h"
9#include <stdio.h>
10#include <remix/remix.h>
11#include <alsa/asoundlib.h>
12#include <Eina.h>
13#ifdef HAVE_LIBSNDFILE
14#include <sndfile.h>
15#endif
16
17#define ALSA_PLAYER_BUFFERLEN 2048
18
19typedef struct _Alsa_Player_Data Alsa_Player_Data;
20typedef short PLAYER_PCM;
21
22struct _Alsa_Player_Data
23{
24 RemixPCM databuffer[ALSA_PLAYER_BUFFERLEN];
25 snd_pcm_t *alsa_dev;
26 unsigned int stereo;
27 unsigned channels;
28 unsigned int frequency;
29};
30
31static int _log_dom = -1;
32static int init_count = 0;
33
34#ifdef WRN
35# undef WRN
36#endif
37#define WRN(...) EINA_LOG_DOM_WARN(_log_dom, __VA_ARGS__)
38
39//#define MIXDBG 1
40
41/* Optimisation dependencies: none */
42static RemixBase *alsa_player_optimise(RemixEnv *env, RemixBase *base);
43
44static snd_pcm_t *
45alsa_open(int channels, unsigned int samplerate, unsigned int *real_samplerate)
46{
47 const char *device = "default";
48 snd_pcm_t *alsa_dev = NULL;
49 snd_pcm_hw_params_t *hw_params;
50 snd_pcm_uframes_t alsa_buffer_frames;
51 snd_pcm_uframes_t alsa_period_size;
52 unsigned int samplerate_ret = 0;
53 int err;
54
55 alsa_buffer_frames = ALSA_PLAYER_BUFFERLEN;
56 alsa_period_size = ALSA_PLAYER_BUFFERLEN / 4;
57
58 if ((err = snd_pcm_open(&alsa_dev, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0)
59 {
60 WRN("cannot open alsa playback stream (%s)", snd_strerror(err));
61 goto catch_error;
62 }
63 snd_pcm_hw_params_alloca(&hw_params);
64 if ((err = snd_pcm_hw_params_any(alsa_dev, hw_params)) < 0)
65 {
66 WRN("cannot initialize snd hw params (%s)", snd_strerror(err));
67 goto catch_error;
68 }
69 if ((err = snd_pcm_hw_params_set_access(alsa_dev, hw_params,
70 SND_PCM_ACCESS_RW_INTERLEAVED)) < 0)
71 {
72 WRN("cannot set interleaved access (%s)", snd_strerror(err));
73 goto catch_error;
74 }
75 if ((err = snd_pcm_hw_params_set_format(alsa_dev, hw_params,
76 SND_PCM_FORMAT_FLOAT)) < 0)
77 {
78 WRN("cannot set float sample format (%s)", snd_strerror(err));
79 goto catch_error;
80 }
81#ifdef MIXDBG // testing/debugging by making output samplerate be 48khz
82 samplerate_ret = 48000;
83 if ((err = snd_pcm_hw_params_set_rate_near(alsa_dev, hw_params,
84 &samplerate_ret, 0)) < 0)
85 {
86 WRN("cannot set sample rate (%s)", snd_strerror(err));
87 goto catch_error;
88 }
89#else
90 if ((err = snd_pcm_hw_params_set_rate_near(alsa_dev, hw_params,
91 &samplerate, 0)) < 0)
92 {
93 WRN("cannot set sample rate (%s)", snd_strerror(err));
94 goto catch_error;
95 }
96#endif
97 if ((err = snd_pcm_hw_params_set_channels(alsa_dev, hw_params, channels)) < 0)
98 {
99 WRN("cannot set channel count (%s)", snd_strerror(err));
100 goto catch_error;
101 }
102 if ((err = snd_pcm_hw_params_set_buffer_size_near(alsa_dev, hw_params,
103 &alsa_buffer_frames)) < 0)
104 {
105 WRN("cannot set buffer size (%s)", snd_strerror(err));
106 goto catch_error;
107 }
108 if ((err = snd_pcm_hw_params_set_period_size_near(alsa_dev, hw_params,
109 &alsa_period_size, 0)) < 0)
110 {
111 WRN("cannot set period size (%s)", snd_strerror(err));
112 goto catch_error;
113 }
114 if ((err = snd_pcm_hw_params(alsa_dev, hw_params)) < 0)
115 {
116 WRN("cannot set parameters (%s)", snd_strerror(err));
117 goto catch_error;
118 }
119 if ((err = snd_pcm_hw_params_get_rate(hw_params, &samplerate_ret, 0)) < 0)
120 {
121 WRN("cannot get samplerate (%s)", snd_strerror(err));
122 goto catch_error;
123 }
124 if ((err = snd_pcm_prepare(alsa_dev)) < 0)
125 {
126 WRN("cannot prepare audio for use (%s)", snd_strerror(err));
127 goto catch_error;
128 }
129 if (real_samplerate) *real_samplerate = samplerate_ret;
130
131catch_error:
132 if ((err < 0) && (alsa_dev != NULL))
133 {
134 snd_pcm_close(alsa_dev);
135 return NULL;
136 }
137 return alsa_dev;
138}
139
140static RemixBase *
141alsa_player_reset_device(RemixEnv *env, RemixBase *base)
142{
143 Alsa_Player_Data *player_data = remix_base_get_instance_data(env, base);
144 unsigned int real_samplerate = 0;
145
146 if (player_data->alsa_dev)
147 {
148 snd_pcm_drain(player_data->alsa_dev);
149 snd_pcm_close(player_data->alsa_dev);
150 }
151 player_data->alsa_dev = alsa_open(player_data->channels,
152 player_data->frequency,
153 &real_samplerate);
154 if (!player_data->alsa_dev)
155 {
156 remix_set_error(env, REMIX_ERROR_SYSTEM);
157 return RemixNone;
158 }
159// printf("%i != %i\n", real_samplerate, player_data->frequency);
160 if (real_samplerate != player_data->frequency)
161 {
162 player_data->frequency = real_samplerate;
163 remix_set_samplerate(env, player_data->frequency);
164 }
165 return base;
166}
167
168static RemixBase *
169alsa_player_init(RemixEnv *env, RemixBase *base, CDSet *parameters __UNUSED__)
170{
171 CDSet *channels;
172 Alsa_Player_Data *player_data = calloc(1, sizeof(Alsa_Player_Data));
173
174 if (!player_data)
175 {
176 remix_set_error(env, REMIX_ERROR_SYSTEM);
177 return RemixNone;
178 }
179
180 init_count++;
181 if (init_count == 1)
182 {
183 eina_init();
184 _log_dom = eina_log_domain_register("remix-alsa", EINA_COLOR_CYAN);
185 }
186
187 remix_base_set_instance_data(env, base, player_data);
188 channels = remix_get_channels(env);
189
190 player_data->channels = cd_set_size(env, channels);
191 if (player_data->channels == 1) player_data->stereo = 0;
192 else if (player_data->channels == 2) player_data->stereo = 1;
193
194 player_data->frequency = remix_get_samplerate(env);
195 alsa_player_reset_device(env, base);
196 base = alsa_player_optimise(env, base);
197 return base;
198}
199
200static RemixBase *
201alsa_player_clone(RemixEnv *env, RemixBase *base __UNUSED__)
202{
203 RemixBase *new_player = remix_base_new(env);
204 alsa_player_init(env, new_player, NULL);
205 return new_player;
206}
207
208static int
209alsa_player_destroy(RemixEnv *env, RemixBase *base)
210{
211 Alsa_Player_Data *player_data = remix_base_get_instance_data(env, base);
212
213 if (player_data->alsa_dev)
214 {
215 snd_pcm_drain(player_data->alsa_dev);
216 snd_pcm_close(player_data->alsa_dev);
217 }
218 free(player_data);
219 init_count--;
220 if (init_count == 0)
221 {
222 eina_log_domain_unregister(_log_dom);
223 _log_dom = -1;
224 eina_shutdown();
225 }
226 return 0;
227}
228
229static int
230alsa_player_ready(RemixEnv *env, RemixBase *base)
231{
232 Alsa_Player_Data *player_data = remix_base_get_instance_data(env, base);
233 RemixCount nr_channels;
234 CDSet *channels;
235 int samplerate;
236
237 channels = remix_get_channels(env);
238 samplerate = (int)remix_get_samplerate(env);
239 nr_channels = cd_set_size(env, channels);
240 return ((samplerate == (int)player_data->frequency) &&
241 (((nr_channels == 1) && (player_data->stereo == 0)) ||
242 ((nr_channels > 1) && (player_data->stereo == 1))));
243}
244
245static RemixBase *
246alsa_player_prepare(RemixEnv *env, RemixBase *base)
247{
248 alsa_player_reset_device(env, base);
249 return base;
250}
251
252static RemixCount
253alsa_player_playbuffer(RemixEnv *env __UNUSED__, Alsa_Player_Data *player, RemixPCM *data, RemixCount count)
254{
255#ifdef MIXDBG
256 {
257 static int total = 0;
258 static SNDFILE *sfile = NULL;
259 static SF_INFO sfinfo;
260
261 if (total == 0)
262 {
263 sfinfo.frames = 0;
264 sfinfo.samplerate = player->frequency;
265 sfinfo.channels = 2;
266 sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16 | SF_ENDIAN_LITTLE;
267 sfinfo.sections = 0;
268 sfinfo.seekable = 0;
269 sfile = sf_open("out.wav", SFM_WRITE, &sfinfo);
270 }
271
272 if (sfile)
273 {
274 sf_writef_float(sfile, data, count);
275 total += count;
276 }
277 }
278#endif
279 return snd_pcm_writei(player->alsa_dev, data, count);
280}
281
282static RemixCount
283alsa_player_chunk(RemixEnv *env, RemixChunk *chunk, RemixCount offset, RemixCount count, int channelname __UNUSED__, void *data)
284{
285 Alsa_Player_Data *player = data;
286 RemixCount remaining = count, written = 0, n, playcount;
287 RemixPCM *d;
288
289 while (remaining > 0)
290 {
291 playcount = MIN(remaining, ALSA_PLAYER_BUFFERLEN);
292
293 d = &chunk->data[offset];
294 n = alsa_player_playbuffer(env, player, d, playcount);
295
296 if (n == -1) return -1;
297 else n /= sizeof(PLAYER_PCM);
298
299 offset += n;
300 written += n;
301 remaining -= n;
302 }
303 return written;
304}
305
306static RemixCount
307alsa_player_process(RemixEnv *env, RemixBase *base, RemixCount count, RemixStream *input, RemixStream *output __UNUSED__)
308{
309 Alsa_Player_Data *player_data = remix_base_get_instance_data(env, base);
310 RemixCount nr_channels = remix_stream_nr_channels(env, input);
311 RemixCount remaining = count, processed = 0, n, nn;
312
313 if ((nr_channels == 1) && (player_data->stereo == 0))
314 { /*MONO*/
315 return remix_stream_chunkfuncify(env, input, count,
316 alsa_player_chunk, player_data);
317 }
318 else if ((nr_channels == 2) && (player_data->stereo == 1))
319 { /*STEREO*/
320 while (remaining > 0)
321 {
322 n = MIN(remaining, ALSA_PLAYER_BUFFERLEN / 2);
323 n = remix_stream_interleave_2(env, input,
324 REMIX_CHANNEL_LEFT,
325 REMIX_CHANNEL_RIGHT,
326 player_data->databuffer, n);
327 nn = alsa_player_playbuffer(env, player_data,
328 player_data->databuffer, n);
329 processed += n;
330 remaining -= n;
331 }
332 return processed;
333 }
334 WRN("[alsa_player_process] unsupported stream/output channel "
335 "combination %ld / %d", nr_channels, player_data->stereo ? 2 : 1);
336 return -1;
337}
338
339static RemixCount
340alsa_player_length(RemixEnv *env __UNUSED__, RemixBase *base __UNUSED__)
341{
342 return REMIX_COUNT_INFINITE;
343}
344
345static RemixCount
346alsa_player_seek(RemixEnv *env __UNUSED__, RemixBase *base __UNUSED__, RemixCount count __UNUSED__)
347{
348 return count;
349}
350
351static int
352alsa_player_flush(RemixEnv *env, RemixBase *base)
353{
354 alsa_player_reset_device(env, base);
355 return 0;
356}
357
358static struct _RemixMethods _alsa_player_methods =
359{
360 alsa_player_clone,
361 alsa_player_destroy,
362 alsa_player_ready,
363 alsa_player_prepare,
364 alsa_player_process,
365 alsa_player_length,
366 alsa_player_seek,
367 alsa_player_flush,
368};
369
370static RemixBase *
371alsa_player_optimise(RemixEnv *env, RemixBase *base)
372{
373 remix_base_set_methods(env, base, &_alsa_player_methods);
374 return base;
375}
376
377static struct _RemixMetaText alsa_player_metatext =
378{
379 "alsa_snd_player",
380 "ALSA sound player for Remix",
381 "Output the audio stream into ALSA Driver",
382 "Copyright (C) 2011, Samsung Electronics Co., Ltd.",
383 "http://www.samsung.com",
384 REMIX_ONE_AUTHOR("Govindaraju SM", "prince.dubey@samsung.com"),
385};
386
387static struct _RemixPlugin alsa_player_plugin =
388{
389 &alsa_player_metatext,
390 REMIX_FLAGS_NONE,
391 CD_EMPTY_SET, /* init scheme */
392 alsa_player_init,
393 CD_EMPTY_SET, /* process scheme */
394 NULL, /* suggests */
395 NULL, /* plugin data */
396 NULL /* destroy */
397};
398
399EAPI CDList *
400remix_load(RemixEnv *env)
401{
402 CDList *plugins = cd_list_new(env);
403 plugins = cd_list_prepend(env, plugins, CD_POINTER(&alsa_player_plugin));
404 return plugins;
405}
diff --git a/libraries/edje/src/modules/eet_snd_reader/Makefile.am b/libraries/edje/src/modules/eet_snd_reader/Makefile.am
new file mode 100644
index 0000000..c154dc2
--- /dev/null
+++ b/libraries/edje/src/modules/eet_snd_reader/Makefile.am
@@ -0,0 +1,17 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3pkglibdir = $(REMIX_PLUGIN_DIR)
4
5AM_CPPFLAGS = \
6-I. \
7-DPACKAGE_LIB_DIR=\"$(libdir)/remix\" \
8-DPACKAGE_DATA_DIR=\"$(datadir)/remix\" \
9@EDJE_CFLAGS@ \
10@REMIX_CFLAGS@
11
12pkgdir = $(REMIX_PLUGIN_DIR)
13pkg_LTLIBRARIES = libeet_sndfile_reader.la
14
15libeet_sndfile_reader_la_SOURCES = eet_snd_reader.c
16libeet_sndfile_reader_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version @EDJE_LIBS@ @REMIX_LIBS@
17libeet_sndfile_reader_la_LIBTOOLFLAGS = --tag=disable-static
diff --git a/libraries/edje/src/modules/eet_snd_reader/Makefile.in b/libraries/edje/src/modules/eet_snd_reader/Makefile.in
new file mode 100644
index 0000000..f4d99bb
--- /dev/null
+++ b/libraries/edje/src/modules/eet_snd_reader/Makefile.in
@@ -0,0 +1,634 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18VPATH = @srcdir@
19pkgdatadir = $(datadir)/@PACKAGE@
20pkgincludedir = $(includedir)/@PACKAGE@
21pkglibexecdir = $(libexecdir)/@PACKAGE@
22am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
23install_sh_DATA = $(install_sh) -c -m 644
24install_sh_PROGRAM = $(install_sh) -c
25install_sh_SCRIPT = $(install_sh) -c
26INSTALL_HEADER = $(INSTALL_DATA)
27transform = $(program_transform_name)
28NORMAL_INSTALL = :
29PRE_INSTALL = :
30POST_INSTALL = :
31NORMAL_UNINSTALL = :
32PRE_UNINSTALL = :
33POST_UNINSTALL = :
34build_triplet = @build@
35host_triplet = @host@
36subdir = src/modules/eet_snd_reader
37DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
38ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
39am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
40 $(top_srcdir)/m4/efl_binary.m4 \
41 $(top_srcdir)/m4/efl_coverage.m4 \
42 $(top_srcdir)/m4/efl_doxygen.m4 \
43 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
44 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
45 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
46 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
47am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
48 $(ACLOCAL_M4)
49mkinstalldirs = $(install_sh) -d
50CONFIG_HEADER = $(top_builddir)/config.h
51CONFIG_CLEAN_FILES =
52CONFIG_CLEAN_VPATH_FILES =
53am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
54am__vpath_adj = case $$p in \
55 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
56 *) f=$$p;; \
57 esac;
58am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
59am__install_max = 40
60am__nobase_strip_setup = \
61 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
62am__nobase_strip = \
63 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
64am__nobase_list = $(am__nobase_strip_setup); \
65 for p in $$list; do echo "$$p $$p"; done | \
66 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
67 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
68 if (++n[$$2] == $(am__install_max)) \
69 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
70 END { for (dir in files) print dir, files[dir] }'
71am__base_list = \
72 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
73 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
74am__installdirs = "$(DESTDIR)$(pkgdir)"
75LTLIBRARIES = $(pkg_LTLIBRARIES)
76libeet_sndfile_reader_la_LIBADD =
77am_libeet_sndfile_reader_la_OBJECTS = \
78 libeet_sndfile_reader_la-eet_snd_reader.lo
79libeet_sndfile_reader_la_OBJECTS = \
80 $(am_libeet_sndfile_reader_la_OBJECTS)
81AM_V_lt = $(am__v_lt_$(V))
82am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
83am__v_lt_0 = --silent
84libeet_sndfile_reader_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
85 $(libeet_sndfile_reader_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
86 --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
87 $(libeet_sndfile_reader_la_LDFLAGS) $(LDFLAGS) -o $@
88DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
89depcomp = $(SHELL) $(top_srcdir)/depcomp
90am__depfiles_maybe = depfiles
91am__mv = mv -f
92COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
93 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
94LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
95 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
96 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
97 $(AM_CFLAGS) $(CFLAGS)
98AM_V_CC = $(am__v_CC_$(V))
99am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
100am__v_CC_0 = @echo " CC " $@;
101AM_V_at = $(am__v_at_$(V))
102am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
103am__v_at_0 = @
104CCLD = $(CC)
105LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
106 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
107 $(AM_LDFLAGS) $(LDFLAGS) -o $@
108AM_V_CCLD = $(am__v_CCLD_$(V))
109am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
110am__v_CCLD_0 = @echo " CCLD " $@;
111AM_V_GEN = $(am__v_GEN_$(V))
112am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
113am__v_GEN_0 = @echo " GEN " $@;
114SOURCES = $(libeet_sndfile_reader_la_SOURCES)
115DIST_SOURCES = $(libeet_sndfile_reader_la_SOURCES)
116ETAGS = etags
117CTAGS = ctags
118DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
119pkglibdir = $(REMIX_PLUGIN_DIR)
120ACLOCAL = @ACLOCAL@
121ALLOCA = @ALLOCA@
122ALSA_CFLAGS = @ALSA_CFLAGS@
123ALSA_LIBS = @ALSA_LIBS@
124AMTAR = @AMTAR@
125AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
126AR = @AR@
127AS = @AS@
128AUTOCONF = @AUTOCONF@
129AUTOHEADER = @AUTOHEADER@
130AUTOMAKE = @AUTOMAKE@
131AWK = @AWK@
132CC = @CC@
133CCDEPMODE = @CCDEPMODE@
134CFLAGS = @CFLAGS@
135CHECK_CFLAGS = @CHECK_CFLAGS@
136CHECK_LIBS = @CHECK_LIBS@
137CPP = @CPP@
138CPPFLAGS = @CPPFLAGS@
139CYGPATH_W = @CYGPATH_W@
140DEFS = @DEFS@
141DEPDIR = @DEPDIR@
142DLLTOOL = @DLLTOOL@
143DSYMUTIL = @DSYMUTIL@
144DUMPBIN = @DUMPBIN@
145ECHO_C = @ECHO_C@
146ECHO_N = @ECHO_N@
147ECHO_T = @ECHO_T@
148ECORE_IMF_CFLAGS = @ECORE_IMF_CFLAGS@
149ECORE_IMF_LIBS = @ECORE_IMF_LIBS@
150EDJE_CC_CFLAGS = @EDJE_CC_CFLAGS@
151EDJE_CC_LIBS = @EDJE_CC_LIBS@
152EDJE_CC_PRG = @EDJE_CC_PRG@
153EDJE_CFLAGS = @EDJE_CFLAGS@
154EDJE_DECC_CFLAGS = @EDJE_DECC_CFLAGS@
155EDJE_DECC_LIBS = @EDJE_DECC_LIBS@
156EDJE_DECC_PRG = @EDJE_DECC_PRG@
157EDJE_EXTERNAL_INSPECTOR_CFLAGS = @EDJE_EXTERNAL_INSPECTOR_CFLAGS@
158EDJE_EXTERNAL_INSPECTOR_LIBS = @EDJE_EXTERNAL_INSPECTOR_LIBS@
159EDJE_EXTERNAL_INSPECTOR_PRG = @EDJE_EXTERNAL_INSPECTOR_PRG@
160EDJE_INSPECTOR_CFLAGS = @EDJE_INSPECTOR_CFLAGS@
161EDJE_INSPECTOR_LIBS = @EDJE_INSPECTOR_LIBS@
162EDJE_INSPECTOR_PRG = @EDJE_INSPECTOR_PRG@
163EDJE_LIBS = @EDJE_LIBS@
164EDJE_PLAYER_CFLAGS = @EDJE_PLAYER_CFLAGS@
165EDJE_PLAYER_LIBS = @EDJE_PLAYER_LIBS@
166EDJE_PLAYER_PRG = @EDJE_PLAYER_PRG@
167EDJE_RECC_PRG = @EDJE_RECC_PRG@
168EFL_COVERAGE_CFLAGS = @EFL_COVERAGE_CFLAGS@
169EFL_COVERAGE_LIBS = @EFL_COVERAGE_LIBS@
170EFL_EDJE_BUILD = @EFL_EDJE_BUILD@
171EGREP = @EGREP@
172EVIL_CFLAGS = @EVIL_CFLAGS@
173EVIL_LIBS = @EVIL_LIBS@
174EXEEXT = @EXEEXT@
175FGREP = @FGREP@
176FLAC_CFLAGS = @FLAC_CFLAGS@
177FLAC_LIBS = @FLAC_LIBS@
178GREP = @GREP@
179INSTALL = @INSTALL@
180INSTALL_DATA = @INSTALL_DATA@
181INSTALL_PROGRAM = @INSTALL_PROGRAM@
182INSTALL_SCRIPT = @INSTALL_SCRIPT@
183INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
184LD = @LD@
185LDFLAGS = @LDFLAGS@
186LIBOBJS = @LIBOBJS@
187LIBS = @LIBS@
188LIBTOOL = @LIBTOOL@
189LIPO = @LIPO@
190LN_S = @LN_S@
191LTLIBOBJS = @LTLIBOBJS@
192LUA_CFLAGS = @LUA_CFLAGS@
193LUA_LIBS = @LUA_LIBS@
194MAKEINFO = @MAKEINFO@
195MINIMAL_CFLAGS = @MINIMAL_CFLAGS@
196MINIMAL_LIBS = @MINIMAL_LIBS@
197MKDIR_P = @MKDIR_P@
198MODULE_ARCH = @MODULE_ARCH@
199NM = @NM@
200NMEDIT = @NMEDIT@
201OBJDUMP = @OBJDUMP@
202OBJEXT = @OBJEXT@
203OTOOL = @OTOOL@
204OTOOL64 = @OTOOL64@
205PACKAGE = @PACKAGE@
206PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
207PACKAGE_NAME = @PACKAGE_NAME@
208PACKAGE_STRING = @PACKAGE_STRING@
209PACKAGE_TARNAME = @PACKAGE_TARNAME@
210PACKAGE_URL = @PACKAGE_URL@
211PACKAGE_VERSION = @PACKAGE_VERSION@
212PATH_SEPARATOR = @PATH_SEPARATOR@
213PKG_CONFIG = @PKG_CONFIG@
214PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
215PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
216PYTHON = @PYTHON@
217PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
218PYTHON_PLATFORM = @PYTHON_PLATFORM@
219PYTHON_PREFIX = @PYTHON_PREFIX@
220PYTHON_VERSION = @PYTHON_VERSION@
221RANLIB = @RANLIB@
222REMIX_CFLAGS = @REMIX_CFLAGS@
223REMIX_LIBS = @REMIX_LIBS@
224REMIX_PLUGIN_DIR = @REMIX_PLUGIN_DIR@
225SED = @SED@
226SET_MAKE = @SET_MAKE@
227SHELL = @SHELL@
228SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
229SNDFILE_LIBS = @SNDFILE_LIBS@
230STRIP = @STRIP@
231VERSION = @VERSION@
232VMAJ = @VMAJ@
233VORBISENC_CFLAGS = @VORBISENC_CFLAGS@
234VORBISENC_LIBS = @VORBISENC_LIBS@
235abs_builddir = @abs_builddir@
236abs_srcdir = @abs_srcdir@
237abs_top_builddir = @abs_top_builddir@
238abs_top_srcdir = @abs_top_srcdir@
239ac_ct_CC = @ac_ct_CC@
240ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
241am__include = @am__include@
242am__leading_dot = @am__leading_dot@
243am__quote = @am__quote@
244am__tar = @am__tar@
245am__untar = @am__untar@
246bindir = @bindir@
247build = @build@
248build_alias = @build_alias@
249build_cpu = @build_cpu@
250build_os = @build_os@
251build_vendor = @build_vendor@
252builddir = @builddir@
253datadir = @datadir@
254datarootdir = @datarootdir@
255docdir = @docdir@
256dvidir = @dvidir@
257edje_cc = @edje_cc@
258efl_doxygen = @efl_doxygen@
259efl_have_doxygen = @efl_have_doxygen@
260exec_prefix = @exec_prefix@
261have_lcov = @have_lcov@
262host = @host@
263host_alias = @host_alias@
264host_cpu = @host_cpu@
265host_os = @host_os@
266host_vendor = @host_vendor@
267htmldir = @htmldir@
268includedir = @includedir@
269infodir = @infodir@
270install_sh = @install_sh@
271libdir = @libdir@
272libexecdir = @libexecdir@
273localedir = @localedir@
274localstatedir = @localstatedir@
275lt_ECHO = @lt_ECHO@
276lt_enable_auto_import = @lt_enable_auto_import@
277lua_libs = @lua_libs@
278mandir = @mandir@
279mkdir_p = @mkdir_p@
280oldincludedir = @oldincludedir@
281pdfdir = @pdfdir@
282pkgconfig_requires_private = @pkgconfig_requires_private@
283pkgpyexecdir = @pkgpyexecdir@
284pkgpythondir = @pkgpythondir@
285prefix = @prefix@
286program_transform_name = @program_transform_name@
287psdir = @psdir@
288pyexecdir = @pyexecdir@
289pythondir = @pythondir@
290release_info = @release_info@
291requirement_edje = @requirement_edje@
292sbindir = @sbindir@
293sharedstatedir = @sharedstatedir@
294srcdir = @srcdir@
295sysconfdir = @sysconfdir@
296target_alias = @target_alias@
297top_build_prefix = @top_build_prefix@
298top_builddir = @top_builddir@
299top_srcdir = @top_srcdir@
300version_info = @version_info@
301vimdir = @vimdir@
302MAINTAINERCLEANFILES = Makefile.in
303AM_CPPFLAGS = \
304-I. \
305-DPACKAGE_LIB_DIR=\"$(libdir)/remix\" \
306-DPACKAGE_DATA_DIR=\"$(datadir)/remix\" \
307@EDJE_CFLAGS@ \
308@REMIX_CFLAGS@
309
310pkgdir = $(REMIX_PLUGIN_DIR)
311pkg_LTLIBRARIES = libeet_sndfile_reader.la
312libeet_sndfile_reader_la_SOURCES = eet_snd_reader.c
313libeet_sndfile_reader_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version @EDJE_LIBS@ @REMIX_LIBS@
314libeet_sndfile_reader_la_LIBTOOLFLAGS = --tag=disable-static
315all: all-am
316
317.SUFFIXES:
318.SUFFIXES: .c .lo .o .obj
319$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
320 @for dep in $?; do \
321 case '$(am__configure_deps)' in \
322 *$$dep*) \
323 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
324 && { if test -f $@; then exit 0; else break; fi; }; \
325 exit 1;; \
326 esac; \
327 done; \
328 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/modules/eet_snd_reader/Makefile'; \
329 $(am__cd) $(top_srcdir) && \
330 $(AUTOMAKE) --gnu src/modules/eet_snd_reader/Makefile
331.PRECIOUS: Makefile
332Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
333 @case '$?' in \
334 *config.status*) \
335 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
336 *) \
337 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
338 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
339 esac;
340
341$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
342 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
343
344$(top_srcdir)/configure: $(am__configure_deps)
345 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
346$(ACLOCAL_M4): $(am__aclocal_m4_deps)
347 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
348$(am__aclocal_m4_deps):
349install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES)
350 @$(NORMAL_INSTALL)
351 test -z "$(pkgdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdir)"
352 @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \
353 list2=; for p in $$list; do \
354 if test -f $$p; then \
355 list2="$$list2 $$p"; \
356 else :; fi; \
357 done; \
358 test -z "$$list2" || { \
359 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkgdir)'"; \
360 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkgdir)"; \
361 }
362
363uninstall-pkgLTLIBRARIES:
364 @$(NORMAL_UNINSTALL)
365 @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \
366 for p in $$list; do \
367 $(am__strip_dir) \
368 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$f'"; \
369 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$f"; \
370 done
371
372clean-pkgLTLIBRARIES:
373 -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES)
374 @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \
375 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
376 test "$$dir" != "$$p" || dir=.; \
377 echo "rm -f \"$${dir}/so_locations\""; \
378 rm -f "$${dir}/so_locations"; \
379 done
380libeet_sndfile_reader.la: $(libeet_sndfile_reader_la_OBJECTS) $(libeet_sndfile_reader_la_DEPENDENCIES)
381 $(AM_V_CCLD)$(libeet_sndfile_reader_la_LINK) -rpath $(pkgdir) $(libeet_sndfile_reader_la_OBJECTS) $(libeet_sndfile_reader_la_LIBADD) $(LIBS)
382
383mostlyclean-compile:
384 -rm -f *.$(OBJEXT)
385
386distclean-compile:
387 -rm -f *.tab.c
388
389@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libeet_sndfile_reader_la-eet_snd_reader.Plo@am__quote@
390
391.c.o:
392@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
393@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
394@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
395@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
396@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
397@am__fastdepCC_FALSE@ $(COMPILE) -c $<
398
399.c.obj:
400@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
401@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
402@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
403@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
404@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
405@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
406
407.c.lo:
408@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
409@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
410@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
411@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
412@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
413@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
414
415libeet_sndfile_reader_la-eet_snd_reader.lo: eet_snd_reader.c
416@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libeet_sndfile_reader_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libeet_sndfile_reader_la-eet_snd_reader.lo -MD -MP -MF $(DEPDIR)/libeet_sndfile_reader_la-eet_snd_reader.Tpo -c -o libeet_sndfile_reader_la-eet_snd_reader.lo `test -f 'eet_snd_reader.c' || echo '$(srcdir)/'`eet_snd_reader.c
417@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libeet_sndfile_reader_la-eet_snd_reader.Tpo $(DEPDIR)/libeet_sndfile_reader_la-eet_snd_reader.Plo
418@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
419@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='eet_snd_reader.c' object='libeet_sndfile_reader_la-eet_snd_reader.lo' libtool=yes @AMDEPBACKSLASH@
420@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
421@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(libeet_sndfile_reader_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libeet_sndfile_reader_la-eet_snd_reader.lo `test -f 'eet_snd_reader.c' || echo '$(srcdir)/'`eet_snd_reader.c
422
423mostlyclean-libtool:
424 -rm -f *.lo
425
426clean-libtool:
427 -rm -rf .libs _libs
428
429ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
430 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
431 unique=`for i in $$list; do \
432 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
433 done | \
434 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
435 END { if (nonempty) { for (i in files) print i; }; }'`; \
436 mkid -fID $$unique
437tags: TAGS
438
439TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
440 $(TAGS_FILES) $(LISP)
441 set x; \
442 here=`pwd`; \
443 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
444 unique=`for i in $$list; do \
445 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
446 done | \
447 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
448 END { if (nonempty) { for (i in files) print i; }; }'`; \
449 shift; \
450 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
451 test -n "$$unique" || unique=$$empty_fix; \
452 if test $$# -gt 0; then \
453 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
454 "$$@" $$unique; \
455 else \
456 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
457 $$unique; \
458 fi; \
459 fi
460ctags: CTAGS
461CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
462 $(TAGS_FILES) $(LISP)
463 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
464 unique=`for i in $$list; do \
465 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
466 done | \
467 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
468 END { if (nonempty) { for (i in files) print i; }; }'`; \
469 test -z "$(CTAGS_ARGS)$$unique" \
470 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
471 $$unique
472
473GTAGS:
474 here=`$(am__cd) $(top_builddir) && pwd` \
475 && $(am__cd) $(top_srcdir) \
476 && gtags -i $(GTAGS_ARGS) "$$here"
477
478distclean-tags:
479 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
480
481distdir: $(DISTFILES)
482 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
483 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
484 list='$(DISTFILES)'; \
485 dist_files=`for file in $$list; do echo $$file; done | \
486 sed -e "s|^$$srcdirstrip/||;t" \
487 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
488 case $$dist_files in \
489 */*) $(MKDIR_P) `echo "$$dist_files" | \
490 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
491 sort -u` ;; \
492 esac; \
493 for file in $$dist_files; do \
494 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
495 if test -d $$d/$$file; then \
496 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
497 if test -d "$(distdir)/$$file"; then \
498 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
499 fi; \
500 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
501 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
502 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
503 fi; \
504 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
505 else \
506 test -f "$(distdir)/$$file" \
507 || cp -p $$d/$$file "$(distdir)/$$file" \
508 || exit 1; \
509 fi; \
510 done
511check-am: all-am
512check: check-am
513all-am: Makefile $(LTLIBRARIES)
514installdirs:
515 for dir in "$(DESTDIR)$(pkgdir)"; do \
516 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
517 done
518install: install-am
519install-exec: install-exec-am
520install-data: install-data-am
521uninstall: uninstall-am
522
523install-am: all-am
524 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
525
526installcheck: installcheck-am
527install-strip:
528 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
529 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
530 `test -z '$(STRIP)' || \
531 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
532mostlyclean-generic:
533
534clean-generic:
535
536distclean-generic:
537 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
538 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
539
540maintainer-clean-generic:
541 @echo "This command is intended for maintainers to use"
542 @echo "it deletes files that may require special tools to rebuild."
543 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
544clean: clean-am
545
546clean-am: clean-generic clean-libtool clean-pkgLTLIBRARIES \
547 mostlyclean-am
548
549distclean: distclean-am
550 -rm -rf ./$(DEPDIR)
551 -rm -f Makefile
552distclean-am: clean-am distclean-compile distclean-generic \
553 distclean-tags
554
555dvi: dvi-am
556
557dvi-am:
558
559html: html-am
560
561html-am:
562
563info: info-am
564
565info-am:
566
567install-data-am: install-pkgLTLIBRARIES
568
569install-dvi: install-dvi-am
570
571install-dvi-am:
572
573install-exec-am:
574
575install-html: install-html-am
576
577install-html-am:
578
579install-info: install-info-am
580
581install-info-am:
582
583install-man:
584
585install-pdf: install-pdf-am
586
587install-pdf-am:
588
589install-ps: install-ps-am
590
591install-ps-am:
592
593installcheck-am:
594
595maintainer-clean: maintainer-clean-am
596 -rm -rf ./$(DEPDIR)
597 -rm -f Makefile
598maintainer-clean-am: distclean-am maintainer-clean-generic
599
600mostlyclean: mostlyclean-am
601
602mostlyclean-am: mostlyclean-compile mostlyclean-generic \
603 mostlyclean-libtool
604
605pdf: pdf-am
606
607pdf-am:
608
609ps: ps-am
610
611ps-am:
612
613uninstall-am: uninstall-pkgLTLIBRARIES
614
615.MAKE: install-am install-strip
616
617.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
618 clean-libtool clean-pkgLTLIBRARIES ctags distclean \
619 distclean-compile distclean-generic distclean-libtool \
620 distclean-tags distdir dvi dvi-am html html-am info info-am \
621 install install-am install-data install-data-am install-dvi \
622 install-dvi-am install-exec install-exec-am install-html \
623 install-html-am install-info install-info-am install-man \
624 install-pdf install-pdf-am install-pkgLTLIBRARIES install-ps \
625 install-ps-am install-strip installcheck installcheck-am \
626 installdirs maintainer-clean maintainer-clean-generic \
627 mostlyclean mostlyclean-compile mostlyclean-generic \
628 mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
629 uninstall-am uninstall-pkgLTLIBRARIES
630
631
632# Tell versions [3.59,3.63) of GNU make to not export all variables.
633# Otherwise a system limit (for SysV at least) may be exceeded.
634.NOEXPORT:
diff --git a/libraries/edje/src/modules/eet_snd_reader/eet_snd_reader.c b/libraries/edje/src/modules/eet_snd_reader/eet_snd_reader.c
new file mode 100644
index 0000000..4e2dec9
--- /dev/null
+++ b/libraries/edje/src/modules/eet_snd_reader/eet_snd_reader.c
@@ -0,0 +1,498 @@
1/*
2 * RemixSnd_eetfile: a libsnd EET Virtual file handler
3 *
4 * Govindaraju SM <govi.sm@samsung.com>, August 2011
5 * Prince Kumar Dubey <prince.dubey@samsung.com>, August 2011
6 */
7
8#include "config.h"
9#include <math.h>
10#include <sndfile.h>
11#include <remix/remix.h>
12#include <Eet.h>
13
14#define PATH_KEY 1
15#define SOUND_ID_KEY 2
16#define SPEED_KEY 3
17#define BLOCK_FRAMES 8192
18
19static RemixBase *remix_eet_sndfile_optimise(RemixEnv *env, RemixBase *sndfile);
20
21typedef struct _VIO_DATA VIO_DATA;
22typedef struct _SndInstanceData SndInstanceData;
23
24struct _VIO_DATA
25{
26 sf_count_t offset, length;
27 const char *data;
28};
29
30struct _SndInstanceData
31{
32 /* plugin parameters */
33 char *path;
34 char *sound_id;
35 double speed;
36
37 /* Edj & Sndfile Reader */
38 Eet_File *efp;
39 SNDFILE *pcm_fp;
40 SF_INFO *snd_info;
41 VIO_DATA *vio_data;
42
43 /* PCM buffers */
44 RemixPCM *readbuf;
45 RemixPCM *inbuf;
46 RemixPCM *outbuf;
47
48 /* Resample stuffs */
49 RemixPCM prevreadbuf[2];
50 int enable_resample;
51 double rs_ratio;
52 RemixCount resample_len;
53 RemixCount in_avail;
54 RemixCount out_generated;
55 RemixCount required_resamples;
56};
57
58static sf_count_t
59eet_snd_file_get_length(void *user_data)
60{
61 VIO_DATA *vf = user_data;
62 return vf->length;
63}
64
65static sf_count_t
66eet_snd_file_seek(sf_count_t offset, int whence, void *user_data)
67{
68 VIO_DATA *vf = user_data;
69
70 switch (whence)
71 {
72 case SEEK_SET:
73 vf->offset = offset;
74 break;
75 case SEEK_CUR:
76 vf->offset += offset;
77 break;
78 case SEEK_END:
79 vf->offset = vf->length + offset;
80 break;
81 default:
82 break;
83 }
84 return vf->offset;
85}
86
87static sf_count_t
88eet_snd_file_read(void *ptr, sf_count_t count, void *user_data)
89{
90 VIO_DATA *vf = user_data;
91
92 if ((vf->offset + count) > vf->length)
93 count = vf->length - vf->offset;
94 memcpy(ptr, vf->data + vf->offset, count);
95 vf->offset += count;
96 return count;
97}
98
99static sf_count_t
100eet_snd_file_tell(void *user_data)
101{
102 VIO_DATA *vf = user_data;
103 return vf->offset;
104}
105
106static int
107remix_init_resampler_data(RemixEnv *env, RemixBase *base)
108{
109 SndInstanceData *si = remix_base_get_instance_data(env, base);
110
111 si->rs_ratio = remix_get_samplerate(env) / si->snd_info->samplerate;
112 si->rs_ratio /= si->speed;
113 si->resample_len = (si->snd_info->frames * si->rs_ratio);
114
115 si->outbuf = malloc(sizeof(RemixPCM) * BLOCK_FRAMES * 2);
116 if (!si->outbuf) return 0;
117 if ((si->rs_ratio == 1.0)/* && (si->snd_info->channels == 2)*/)
118 {
119 si->enable_resample = 0;
120 return 1;
121 }
122 else
123 si->enable_resample = 1;
124
125 si->in_avail = 0;
126 si->out_generated = 0;
127 si->inbuf = malloc(sizeof(RemixPCM) * BLOCK_FRAMES *
128 si->snd_info->channels);
129 if (!si->inbuf) return 0;
130 return 1;
131}
132
133static RemixBase *
134remix_eet_sndfile_create(RemixEnv *env, RemixBase *sndfile, const char *path, const char *sound_id, const double speed)
135{
136 SF_VIRTUAL_IO *eet_vio = NULL;
137 SndInstanceData *si;
138 const void *sound_data;
139 int sound_size;
140
141 if ((!path) || (!sound_id)) return NULL;
142
143 si = calloc(1, sizeof(SndInstanceData));
144 if (!si) goto err;
145 remix_base_set_instance_data(env, sndfile, si);
146
147 si->path = strdup(path);
148 si->sound_id = strdup(sound_id);
149 si->speed = speed;
150
151 si->efp = eet_open(path, EET_FILE_MODE_READ);
152 if (!si->efp) goto err;
153
154 // xxx: eet_read_direct does not work on Threads, using eet_read.
155 sound_data = eet_read(si->efp, sound_id, &(sound_size));
156 eet_close(si->efp);
157 si->efp = NULL;
158 if (sound_data == NULL) goto err;
159
160 eet_vio = calloc(1, sizeof(SF_VIRTUAL_IO));
161 if (!eet_vio) goto err;
162
163 /* Set up func pointers to read snd file directly from EET. */
164 eet_vio->get_filelen = eet_snd_file_get_length;
165 eet_vio->seek = eet_snd_file_seek;
166 eet_vio->read = eet_snd_file_read;
167 eet_vio->tell = eet_snd_file_tell;
168
169 si->vio_data = calloc(1, sizeof(VIO_DATA));
170 if (!si->vio_data) goto err;
171 si->vio_data->offset = 0;
172 si->vio_data->length = sound_size;
173 si->vio_data->data = sound_data;
174
175 si->snd_info = calloc(1, sizeof(SF_INFO));
176 if (!si->snd_info) goto err;
177
178 si->pcm_fp = sf_open_virtual(eet_vio, SFM_READ, si->snd_info, si->vio_data);
179 if (!si->pcm_fp) goto err;
180 free(eet_vio);
181 eet_vio = NULL;
182
183 if (!remix_init_resampler_data(env, sndfile)) goto err;
184 si->out_generated = 0;
185
186 return sndfile;
187
188err:
189 if (eet_vio) free(eet_vio);
190 remix_set_error(env, REMIX_ERROR_SYSTEM);
191 remix_destroy(env, (RemixBase *)sndfile);
192 return RemixNone;
193}
194
195static RemixBase *
196remix_eet_sndfile_reader_init(RemixEnv *env, RemixBase *base, CDSet *parameters)
197{
198 char *file_path, *sound_id;
199 double speed;
200
201 file_path = (cd_set_find(env, parameters, PATH_KEY)).s_string;
202 sound_id = (cd_set_find(env, parameters, SOUND_ID_KEY)).s_string;
203 speed = (cd_set_find(env, parameters, SPEED_KEY)).s_double;
204
205 if (!remix_eet_sndfile_create(env, base, file_path, sound_id, speed))
206 return RemixNone;
207 remix_eet_sndfile_optimise (env, base);
208 return base;
209}
210
211static RemixBase *
212remix_eet_sndfile_clone(RemixEnv *env, RemixBase *base)
213{
214 SndInstanceData *si = remix_base_get_instance_data(env, base);
215 RemixBase *new_sndfile = remix_base_new(env);
216
217 remix_eet_sndfile_create(env, new_sndfile, si->path, si->sound_id, si->speed);
218 remix_eet_sndfile_optimise(env, new_sndfile);
219 return new_sndfile;
220}
221
222static int
223remix_eet_sndfile_destroy(RemixEnv *env, RemixBase *base)
224{
225 SndInstanceData *si = remix_base_get_instance_data(env, base);
226 if (si)
227 {
228 sf_close (si->pcm_fp);
229 eet_close(si->efp);
230 if (si->path) free(si->path);
231 if (si->sound_id) free(si->sound_id);
232 if (si->snd_info) free(si->snd_info);
233 if (si->efp) eet_close(si->efp);
234 if (si->inbuf) free(si->inbuf);
235 if (si->outbuf) free(si->outbuf);
236 if (si->vio_data) free(si->vio_data);
237 free(si);
238 }
239 if (base) free (base);
240 return 0;
241}
242
243static int
244remix_pcm_resample(SndInstanceData *si)
245{
246 RemixPCM *src, *dst, *srcbase;
247 int i = 0, in_samples, pos, total, chnum, reqsamp, avail;
248 int interp = 1;
249
250 dst = si->outbuf + (si->out_generated * 2);
251 in_samples = (double)si->required_resamples / si->rs_ratio;
252 chnum = si->snd_info->channels;
253 reqsamp = si->required_resamples;
254 avail = si->in_avail;
255 srcbase = si->readbuf;
256 if ((interp) && (si->rs_ratio >= 1.0))
257 {
258 // linear interpolation of resampling for lower quality samples
259 // so they don't get high requency aliasing effects
260 for (i = 0; i < reqsamp; i++)
261 {
262 float fpos, fpos1;
263 RemixPCM psam[2];
264
265 fpos = (float)(i * in_samples) / (float)reqsamp;
266 pos = fpos;
267 if (pos >= avail) break;
268 fpos -= pos;
269 fpos1 = 1.0 - fpos;
270 src = srcbase + (pos * chnum);
271 if (chnum == 2)
272 {
273 if (pos == 0)
274 {
275 psam[0] = si->prevreadbuf[0];
276 psam[1] = si->prevreadbuf[1];
277 }
278 else
279 {
280 psam[0] = src[0 - 2];
281 psam[1] = src[1 - 2];
282 }
283 *dst++ = (src[0] * fpos) + (psam[0] * fpos1);
284 *dst++ = (src[1] * fpos) + (psam[1] * fpos1);
285 }
286 else
287 {
288 if (pos == 0)
289 psam[0] = si->prevreadbuf[0];
290 else
291 psam[0] = src[0 - 1];
292 *dst++ = (src[0] * fpos) + (psam[0] * fpos1);
293 }
294 }
295 }
296 else
297 {
298 // simple sample-picking/nearest. faster and simpler
299 for (i = 0; i < reqsamp; i++)
300 {
301 pos = (i * in_samples) / reqsamp;
302 if (pos >= avail) break;
303 src = srcbase + (pos * chnum);
304 if (chnum == 2)
305 {
306 *dst++ = src[0];
307 *dst++ = src[1];
308 }
309 else
310 *dst++ = src[0];
311 }
312 }
313 si->out_generated += i;
314 total = (i * in_samples) / reqsamp;
315 si->readbuf += total * chnum;
316 si->in_avail -= total;
317 return total;
318}
319
320/* An RemixChunkFunc for creating sndfile */
321static RemixCount
322remix_eet_sndfile_read_update(RemixEnv *env, RemixBase *sndfile, RemixCount count)
323{
324 SndInstanceData *si = remix_base_get_instance_data(env, sndfile);
325
326 si->out_generated = 0;
327 if (si->enable_resample)
328 {
329 RemixCount gen = 0;
330
331 while (gen < count)
332 {
333 if (si->in_avail <= 0)
334 {
335 si->in_avail = sf_readf_float(si->pcm_fp, si->inbuf, BLOCK_FRAMES);
336 si->readbuf = si->inbuf;
337 }
338 si->required_resamples = (count - gen);
339 remix_pcm_resample(si);
340 if (si->snd_info->channels == 2)
341 {
342 si->prevreadbuf[0] = si->readbuf[-2];
343 si->prevreadbuf[1] = si->readbuf[-1];
344 }
345 else
346 {
347 si->prevreadbuf[0] = si->readbuf[-1];
348 }
349 gen += si->out_generated;
350 }
351 si->out_generated = gen;
352 }
353 else
354 {
355 si->out_generated = sf_readf_float(si->pcm_fp, si->outbuf, count);
356 }
357 return si->out_generated;
358}
359
360static RemixCount
361remix_eet_sndfile_read_into_chunk(RemixEnv *env, RemixChunk *chunk, RemixCount offset, RemixCount count, int channelname, void *data)
362{
363 RemixBase *sndfile = data;
364 SndInstanceData *si = remix_base_get_instance_data(env, sndfile);
365 RemixPCM *d, *p;
366 RemixCount remaining = count, written = 0, n, i;
367
368 d = &chunk->data[offset];
369 n = MIN(remaining, BLOCK_FRAMES);
370 // Need parameter support to advance the data reading
371 if (channelname == 0)
372 remix_eet_sndfile_read_update(env, sndfile, n);
373 n = MIN(si->out_generated, remaining);
374 p = si->outbuf;
375 if (si->snd_info->channels > 1) p += channelname;
376 for (i = 0; i < n; i++)
377 {
378 *d++ = *p;
379 p += si->snd_info->channels;
380 }
381 if (n == 0) n = _remix_pcm_set(d, 0.0, remaining);
382 remaining -= n;
383 written += n;
384 return written;
385}
386
387static RemixCount
388remix_eet_sndfile_reader_process(RemixEnv *env, RemixBase *base, RemixCount count, RemixStream *input __UNUSED__, RemixStream *output)
389{
390 return remix_stream_chunkfuncify(env, output, count,
391 remix_eet_sndfile_read_into_chunk,
392 base);
393}
394
395static RemixCount
396remix_eet_sndfile_length(RemixEnv *env, RemixBase *base)
397{
398 SndInstanceData *si = remix_base_get_instance_data(env, base);
399 return si->resample_len;
400}
401
402static RemixCount
403remix_eet_sndfile_seek(RemixEnv *env, RemixBase *base, RemixCount offset)
404{
405 SndInstanceData *si = remix_base_get_instance_data(env, base);
406 return sf_seek(si->pcm_fp, offset, SEEK_SET);
407}
408
409static struct _RemixMethods _remix_eet_sndfile_reader_methods =
410{
411 remix_eet_sndfile_clone,
412 remix_eet_sndfile_destroy,
413 NULL, /* ready */
414 NULL, /* prepare */
415 remix_eet_sndfile_reader_process,
416 remix_eet_sndfile_length,
417 remix_eet_sndfile_seek,
418 NULL, /* flush */
419};
420
421static RemixBase *
422remix_eet_sndfile_optimise(RemixEnv *env, RemixBase *sndfile)
423{
424 remix_base_set_methods(env, sndfile, &_remix_eet_sndfile_reader_methods);
425 return sndfile;
426}
427
428static struct _RemixParameterScheme path_scheme =
429{
430 "path",
431 "Path to sound file",
432 REMIX_TYPE_STRING,
433 REMIX_CONSTRAINT_TYPE_NONE,
434 {NULL},
435 REMIX_HINT_FILENAME,
436};
437
438static struct _RemixParameterScheme sound_id_scheme =
439{
440 "sound_id",
441 "Sound Id (Key) inside EET",
442 REMIX_TYPE_STRING,
443 REMIX_CONSTRAINT_TYPE_NONE,
444 {NULL},
445 REMIX_HINT_DEFAULT,
446};
447
448static struct _RemixParameterScheme speed_scheme =
449{
450 "speed",
451 "Sound Play Speed",
452 REMIX_TYPE_FLOAT,
453 REMIX_CONSTRAINT_TYPE_NONE,
454 {NULL},
455 REMIX_HINT_DEFAULT,
456};
457
458static struct _RemixMetaText eet_sndfile_reader_metatext =
459{
460 "eet_sndfile_reader",
461 "File:: Sound file Reader from EET",
462 "Reads PCM audio files from EET bundle using libsndfile",
463 "Copyright (C) 2011, Samsung Electronics Co., Ltd.",
464 "http://www.samsung.com",
465 REMIX_ONE_AUTHOR ("govi.sm@samsung.com", "prince.dubey@samsung.com"),
466};
467
468static struct _RemixPlugin eet_sndfile_reader_plugin =
469{
470 &eet_sndfile_reader_metatext,
471 REMIX_FLAGS_NONE,
472 CD_EMPTY_SET, /* init scheme */
473 remix_eet_sndfile_reader_init,
474 CD_EMPTY_SET, /* process scheme */
475 NULL, /* suggests */
476 NULL, /* plugin data */
477 NULL /* destroy */
478};
479
480EAPI CDList *
481remix_load(RemixEnv *env)
482{
483 CDList *plugins = cd_list_new(env);
484
485 eet_sndfile_reader_plugin.init_scheme =
486 cd_set_insert(env, eet_sndfile_reader_plugin.init_scheme, PATH_KEY,
487 CD_POINTER(&path_scheme));
488 eet_sndfile_reader_plugin.init_scheme =
489 cd_set_insert(env, eet_sndfile_reader_plugin.init_scheme, SOUND_ID_KEY,
490 CD_POINTER(&sound_id_scheme));
491 eet_sndfile_reader_plugin.init_scheme =
492 cd_set_insert(env, eet_sndfile_reader_plugin.init_scheme, SPEED_KEY,
493 CD_POINTER(&speed_scheme));
494
495 plugins = cd_list_prepend(env, plugins,
496 CD_POINTER(&eet_sndfile_reader_plugin));
497 return plugins;
498}
diff --git a/libraries/edje/src/modules/multisense_factory/Makefile.am b/libraries/edje/src/modules/multisense_factory/Makefile.am
new file mode 100644
index 0000000..768c8ce
--- /dev/null
+++ b/libraries/edje/src/modules/multisense_factory/Makefile.am
@@ -0,0 +1,21 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3pkglibdir = $(datadir)/$(PACKAGE)/modules/multisense_factory
4
5AM_CPPFLAGS = \
6-I. \
7-I$(top_srcdir)/src/lib \
8-I$(top_srcdir)/src/lib/include \
9-DPACKAGE_BIN_DIR=\"$(bindir)\" \
10-DPACKAGE_LIB_DIR=\"$(libdir)\" \
11-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
12-DPACKAGE_EXAMPLES_DIR=\"$(datadir)/$(PACKAGE)/multisense_factory\" \
13@EDJE_CFLAGS@ \
14@REMIX_CFLAGS@
15
16pkgdir = $(libdir)/edje/modules/multisense_factory/$(MODULE_ARCH)
17pkg_LTLIBRARIES = module.la
18
19module_la_SOURCES = multisense_factory.c
20module_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version $(top_builddir)/src/lib/libedje.la @EDJE_LIBS@ @REMIX_LIBS@
21module_la_LIBTOOLFLAGS = --tag=disable-static
diff --git a/libraries/edje/src/modules/multisense_factory/Makefile.in b/libraries/edje/src/modules/multisense_factory/Makefile.in
new file mode 100644
index 0000000..ed0c3e4
--- /dev/null
+++ b/libraries/edje/src/modules/multisense_factory/Makefile.in
@@ -0,0 +1,635 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18VPATH = @srcdir@
19pkgdatadir = $(datadir)/@PACKAGE@
20pkgincludedir = $(includedir)/@PACKAGE@
21pkglibexecdir = $(libexecdir)/@PACKAGE@
22am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
23install_sh_DATA = $(install_sh) -c -m 644
24install_sh_PROGRAM = $(install_sh) -c
25install_sh_SCRIPT = $(install_sh) -c
26INSTALL_HEADER = $(INSTALL_DATA)
27transform = $(program_transform_name)
28NORMAL_INSTALL = :
29PRE_INSTALL = :
30POST_INSTALL = :
31NORMAL_UNINSTALL = :
32PRE_UNINSTALL = :
33POST_UNINSTALL = :
34build_triplet = @build@
35host_triplet = @host@
36subdir = src/modules/multisense_factory
37DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
38ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
39am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
40 $(top_srcdir)/m4/efl_binary.m4 \
41 $(top_srcdir)/m4/efl_coverage.m4 \
42 $(top_srcdir)/m4/efl_doxygen.m4 \
43 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
44 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
45 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
46 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
47am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
48 $(ACLOCAL_M4)
49mkinstalldirs = $(install_sh) -d
50CONFIG_HEADER = $(top_builddir)/config.h
51CONFIG_CLEAN_FILES =
52CONFIG_CLEAN_VPATH_FILES =
53am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
54am__vpath_adj = case $$p in \
55 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
56 *) f=$$p;; \
57 esac;
58am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
59am__install_max = 40
60am__nobase_strip_setup = \
61 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
62am__nobase_strip = \
63 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
64am__nobase_list = $(am__nobase_strip_setup); \
65 for p in $$list; do echo "$$p $$p"; done | \
66 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
67 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
68 if (++n[$$2] == $(am__install_max)) \
69 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
70 END { for (dir in files) print dir, files[dir] }'
71am__base_list = \
72 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
73 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
74am__installdirs = "$(DESTDIR)$(pkgdir)"
75LTLIBRARIES = $(pkg_LTLIBRARIES)
76module_la_LIBADD =
77am_module_la_OBJECTS = module_la-multisense_factory.lo
78module_la_OBJECTS = $(am_module_la_OBJECTS)
79AM_V_lt = $(am__v_lt_$(V))
80am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
81am__v_lt_0 = --silent
82module_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
83 $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
84 $(AM_CFLAGS) $(CFLAGS) $(module_la_LDFLAGS) $(LDFLAGS) -o $@
85DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
86depcomp = $(SHELL) $(top_srcdir)/depcomp
87am__depfiles_maybe = depfiles
88am__mv = mv -f
89COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
90 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
91LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
92 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
93 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
94 $(AM_CFLAGS) $(CFLAGS)
95AM_V_CC = $(am__v_CC_$(V))
96am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
97am__v_CC_0 = @echo " CC " $@;
98AM_V_at = $(am__v_at_$(V))
99am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
100am__v_at_0 = @
101CCLD = $(CC)
102LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
103 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
104 $(AM_LDFLAGS) $(LDFLAGS) -o $@
105AM_V_CCLD = $(am__v_CCLD_$(V))
106am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
107am__v_CCLD_0 = @echo " CCLD " $@;
108AM_V_GEN = $(am__v_GEN_$(V))
109am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
110am__v_GEN_0 = @echo " GEN " $@;
111SOURCES = $(module_la_SOURCES)
112DIST_SOURCES = $(module_la_SOURCES)
113ETAGS = etags
114CTAGS = ctags
115DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
116pkglibdir = $(datadir)/$(PACKAGE)/modules/multisense_factory
117ACLOCAL = @ACLOCAL@
118ALLOCA = @ALLOCA@
119ALSA_CFLAGS = @ALSA_CFLAGS@
120ALSA_LIBS = @ALSA_LIBS@
121AMTAR = @AMTAR@
122AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
123AR = @AR@
124AS = @AS@
125AUTOCONF = @AUTOCONF@
126AUTOHEADER = @AUTOHEADER@
127AUTOMAKE = @AUTOMAKE@
128AWK = @AWK@
129CC = @CC@
130CCDEPMODE = @CCDEPMODE@
131CFLAGS = @CFLAGS@
132CHECK_CFLAGS = @CHECK_CFLAGS@
133CHECK_LIBS = @CHECK_LIBS@
134CPP = @CPP@
135CPPFLAGS = @CPPFLAGS@
136CYGPATH_W = @CYGPATH_W@
137DEFS = @DEFS@
138DEPDIR = @DEPDIR@
139DLLTOOL = @DLLTOOL@
140DSYMUTIL = @DSYMUTIL@
141DUMPBIN = @DUMPBIN@
142ECHO_C = @ECHO_C@
143ECHO_N = @ECHO_N@
144ECHO_T = @ECHO_T@
145ECORE_IMF_CFLAGS = @ECORE_IMF_CFLAGS@
146ECORE_IMF_LIBS = @ECORE_IMF_LIBS@
147EDJE_CC_CFLAGS = @EDJE_CC_CFLAGS@
148EDJE_CC_LIBS = @EDJE_CC_LIBS@
149EDJE_CC_PRG = @EDJE_CC_PRG@
150EDJE_CFLAGS = @EDJE_CFLAGS@
151EDJE_DECC_CFLAGS = @EDJE_DECC_CFLAGS@
152EDJE_DECC_LIBS = @EDJE_DECC_LIBS@
153EDJE_DECC_PRG = @EDJE_DECC_PRG@
154EDJE_EXTERNAL_INSPECTOR_CFLAGS = @EDJE_EXTERNAL_INSPECTOR_CFLAGS@
155EDJE_EXTERNAL_INSPECTOR_LIBS = @EDJE_EXTERNAL_INSPECTOR_LIBS@
156EDJE_EXTERNAL_INSPECTOR_PRG = @EDJE_EXTERNAL_INSPECTOR_PRG@
157EDJE_INSPECTOR_CFLAGS = @EDJE_INSPECTOR_CFLAGS@
158EDJE_INSPECTOR_LIBS = @EDJE_INSPECTOR_LIBS@
159EDJE_INSPECTOR_PRG = @EDJE_INSPECTOR_PRG@
160EDJE_LIBS = @EDJE_LIBS@
161EDJE_PLAYER_CFLAGS = @EDJE_PLAYER_CFLAGS@
162EDJE_PLAYER_LIBS = @EDJE_PLAYER_LIBS@
163EDJE_PLAYER_PRG = @EDJE_PLAYER_PRG@
164EDJE_RECC_PRG = @EDJE_RECC_PRG@
165EFL_COVERAGE_CFLAGS = @EFL_COVERAGE_CFLAGS@
166EFL_COVERAGE_LIBS = @EFL_COVERAGE_LIBS@
167EFL_EDJE_BUILD = @EFL_EDJE_BUILD@
168EGREP = @EGREP@
169EVIL_CFLAGS = @EVIL_CFLAGS@
170EVIL_LIBS = @EVIL_LIBS@
171EXEEXT = @EXEEXT@
172FGREP = @FGREP@
173FLAC_CFLAGS = @FLAC_CFLAGS@
174FLAC_LIBS = @FLAC_LIBS@
175GREP = @GREP@
176INSTALL = @INSTALL@
177INSTALL_DATA = @INSTALL_DATA@
178INSTALL_PROGRAM = @INSTALL_PROGRAM@
179INSTALL_SCRIPT = @INSTALL_SCRIPT@
180INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
181LD = @LD@
182LDFLAGS = @LDFLAGS@
183LIBOBJS = @LIBOBJS@
184LIBS = @LIBS@
185LIBTOOL = @LIBTOOL@
186LIPO = @LIPO@
187LN_S = @LN_S@
188LTLIBOBJS = @LTLIBOBJS@
189LUA_CFLAGS = @LUA_CFLAGS@
190LUA_LIBS = @LUA_LIBS@
191MAKEINFO = @MAKEINFO@
192MINIMAL_CFLAGS = @MINIMAL_CFLAGS@
193MINIMAL_LIBS = @MINIMAL_LIBS@
194MKDIR_P = @MKDIR_P@
195MODULE_ARCH = @MODULE_ARCH@
196NM = @NM@
197NMEDIT = @NMEDIT@
198OBJDUMP = @OBJDUMP@
199OBJEXT = @OBJEXT@
200OTOOL = @OTOOL@
201OTOOL64 = @OTOOL64@
202PACKAGE = @PACKAGE@
203PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
204PACKAGE_NAME = @PACKAGE_NAME@
205PACKAGE_STRING = @PACKAGE_STRING@
206PACKAGE_TARNAME = @PACKAGE_TARNAME@
207PACKAGE_URL = @PACKAGE_URL@
208PACKAGE_VERSION = @PACKAGE_VERSION@
209PATH_SEPARATOR = @PATH_SEPARATOR@
210PKG_CONFIG = @PKG_CONFIG@
211PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
212PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
213PYTHON = @PYTHON@
214PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
215PYTHON_PLATFORM = @PYTHON_PLATFORM@
216PYTHON_PREFIX = @PYTHON_PREFIX@
217PYTHON_VERSION = @PYTHON_VERSION@
218RANLIB = @RANLIB@
219REMIX_CFLAGS = @REMIX_CFLAGS@
220REMIX_LIBS = @REMIX_LIBS@
221REMIX_PLUGIN_DIR = @REMIX_PLUGIN_DIR@
222SED = @SED@
223SET_MAKE = @SET_MAKE@
224SHELL = @SHELL@
225SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
226SNDFILE_LIBS = @SNDFILE_LIBS@
227STRIP = @STRIP@
228VERSION = @VERSION@
229VMAJ = @VMAJ@
230VORBISENC_CFLAGS = @VORBISENC_CFLAGS@
231VORBISENC_LIBS = @VORBISENC_LIBS@
232abs_builddir = @abs_builddir@
233abs_srcdir = @abs_srcdir@
234abs_top_builddir = @abs_top_builddir@
235abs_top_srcdir = @abs_top_srcdir@
236ac_ct_CC = @ac_ct_CC@
237ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
238am__include = @am__include@
239am__leading_dot = @am__leading_dot@
240am__quote = @am__quote@
241am__tar = @am__tar@
242am__untar = @am__untar@
243bindir = @bindir@
244build = @build@
245build_alias = @build_alias@
246build_cpu = @build_cpu@
247build_os = @build_os@
248build_vendor = @build_vendor@
249builddir = @builddir@
250datadir = @datadir@
251datarootdir = @datarootdir@
252docdir = @docdir@
253dvidir = @dvidir@
254edje_cc = @edje_cc@
255efl_doxygen = @efl_doxygen@
256efl_have_doxygen = @efl_have_doxygen@
257exec_prefix = @exec_prefix@
258have_lcov = @have_lcov@
259host = @host@
260host_alias = @host_alias@
261host_cpu = @host_cpu@
262host_os = @host_os@
263host_vendor = @host_vendor@
264htmldir = @htmldir@
265includedir = @includedir@
266infodir = @infodir@
267install_sh = @install_sh@
268libdir = @libdir@
269libexecdir = @libexecdir@
270localedir = @localedir@
271localstatedir = @localstatedir@
272lt_ECHO = @lt_ECHO@
273lt_enable_auto_import = @lt_enable_auto_import@
274lua_libs = @lua_libs@
275mandir = @mandir@
276mkdir_p = @mkdir_p@
277oldincludedir = @oldincludedir@
278pdfdir = @pdfdir@
279pkgconfig_requires_private = @pkgconfig_requires_private@
280pkgpyexecdir = @pkgpyexecdir@
281pkgpythondir = @pkgpythondir@
282prefix = @prefix@
283program_transform_name = @program_transform_name@
284psdir = @psdir@
285pyexecdir = @pyexecdir@
286pythondir = @pythondir@
287release_info = @release_info@
288requirement_edje = @requirement_edje@
289sbindir = @sbindir@
290sharedstatedir = @sharedstatedir@
291srcdir = @srcdir@
292sysconfdir = @sysconfdir@
293target_alias = @target_alias@
294top_build_prefix = @top_build_prefix@
295top_builddir = @top_builddir@
296top_srcdir = @top_srcdir@
297version_info = @version_info@
298vimdir = @vimdir@
299MAINTAINERCLEANFILES = Makefile.in
300AM_CPPFLAGS = \
301-I. \
302-I$(top_srcdir)/src/lib \
303-I$(top_srcdir)/src/lib/include \
304-DPACKAGE_BIN_DIR=\"$(bindir)\" \
305-DPACKAGE_LIB_DIR=\"$(libdir)\" \
306-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
307-DPACKAGE_EXAMPLES_DIR=\"$(datadir)/$(PACKAGE)/multisense_factory\" \
308@EDJE_CFLAGS@ \
309@REMIX_CFLAGS@
310
311pkgdir = $(libdir)/edje/modules/multisense_factory/$(MODULE_ARCH)
312pkg_LTLIBRARIES = module.la
313module_la_SOURCES = multisense_factory.c
314module_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version $(top_builddir)/src/lib/libedje.la @EDJE_LIBS@ @REMIX_LIBS@
315module_la_LIBTOOLFLAGS = --tag=disable-static
316all: all-am
317
318.SUFFIXES:
319.SUFFIXES: .c .lo .o .obj
320$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
321 @for dep in $?; do \
322 case '$(am__configure_deps)' in \
323 *$$dep*) \
324 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
325 && { if test -f $@; then exit 0; else break; fi; }; \
326 exit 1;; \
327 esac; \
328 done; \
329 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/modules/multisense_factory/Makefile'; \
330 $(am__cd) $(top_srcdir) && \
331 $(AUTOMAKE) --gnu src/modules/multisense_factory/Makefile
332.PRECIOUS: Makefile
333Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
334 @case '$?' in \
335 *config.status*) \
336 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
337 *) \
338 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
339 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
340 esac;
341
342$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
343 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
344
345$(top_srcdir)/configure: $(am__configure_deps)
346 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
347$(ACLOCAL_M4): $(am__aclocal_m4_deps)
348 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
349$(am__aclocal_m4_deps):
350install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES)
351 @$(NORMAL_INSTALL)
352 test -z "$(pkgdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdir)"
353 @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \
354 list2=; for p in $$list; do \
355 if test -f $$p; then \
356 list2="$$list2 $$p"; \
357 else :; fi; \
358 done; \
359 test -z "$$list2" || { \
360 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkgdir)'"; \
361 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkgdir)"; \
362 }
363
364uninstall-pkgLTLIBRARIES:
365 @$(NORMAL_UNINSTALL)
366 @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \
367 for p in $$list; do \
368 $(am__strip_dir) \
369 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$f'"; \
370 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$f"; \
371 done
372
373clean-pkgLTLIBRARIES:
374 -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES)
375 @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \
376 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
377 test "$$dir" != "$$p" || dir=.; \
378 echo "rm -f \"$${dir}/so_locations\""; \
379 rm -f "$${dir}/so_locations"; \
380 done
381module.la: $(module_la_OBJECTS) $(module_la_DEPENDENCIES)
382 $(AM_V_CCLD)$(module_la_LINK) -rpath $(pkgdir) $(module_la_OBJECTS) $(module_la_LIBADD) $(LIBS)
383
384mostlyclean-compile:
385 -rm -f *.$(OBJEXT)
386
387distclean-compile:
388 -rm -f *.tab.c
389
390@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/module_la-multisense_factory.Plo@am__quote@
391
392.c.o:
393@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
394@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
395@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
396@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
397@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
398@am__fastdepCC_FALSE@ $(COMPILE) -c $<
399
400.c.obj:
401@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
402@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
403@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
404@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
405@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
406@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
407
408.c.lo:
409@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
410@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
411@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
412@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
413@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
414@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
415
416module_la-multisense_factory.lo: multisense_factory.c
417@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT module_la-multisense_factory.lo -MD -MP -MF $(DEPDIR)/module_la-multisense_factory.Tpo -c -o module_la-multisense_factory.lo `test -f 'multisense_factory.c' || echo '$(srcdir)/'`multisense_factory.c
418@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/module_la-multisense_factory.Tpo $(DEPDIR)/module_la-multisense_factory.Plo
419@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
420@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='multisense_factory.c' object='module_la-multisense_factory.lo' libtool=yes @AMDEPBACKSLASH@
421@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
422@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o module_la-multisense_factory.lo `test -f 'multisense_factory.c' || echo '$(srcdir)/'`multisense_factory.c
423
424mostlyclean-libtool:
425 -rm -f *.lo
426
427clean-libtool:
428 -rm -rf .libs _libs
429
430ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
431 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
432 unique=`for i in $$list; do \
433 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
434 done | \
435 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
436 END { if (nonempty) { for (i in files) print i; }; }'`; \
437 mkid -fID $$unique
438tags: TAGS
439
440TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
441 $(TAGS_FILES) $(LISP)
442 set x; \
443 here=`pwd`; \
444 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
445 unique=`for i in $$list; do \
446 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
447 done | \
448 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
449 END { if (nonempty) { for (i in files) print i; }; }'`; \
450 shift; \
451 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
452 test -n "$$unique" || unique=$$empty_fix; \
453 if test $$# -gt 0; then \
454 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
455 "$$@" $$unique; \
456 else \
457 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
458 $$unique; \
459 fi; \
460 fi
461ctags: CTAGS
462CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
463 $(TAGS_FILES) $(LISP)
464 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
465 unique=`for i in $$list; do \
466 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
467 done | \
468 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
469 END { if (nonempty) { for (i in files) print i; }; }'`; \
470 test -z "$(CTAGS_ARGS)$$unique" \
471 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
472 $$unique
473
474GTAGS:
475 here=`$(am__cd) $(top_builddir) && pwd` \
476 && $(am__cd) $(top_srcdir) \
477 && gtags -i $(GTAGS_ARGS) "$$here"
478
479distclean-tags:
480 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
481
482distdir: $(DISTFILES)
483 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
484 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
485 list='$(DISTFILES)'; \
486 dist_files=`for file in $$list; do echo $$file; done | \
487 sed -e "s|^$$srcdirstrip/||;t" \
488 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
489 case $$dist_files in \
490 */*) $(MKDIR_P) `echo "$$dist_files" | \
491 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
492 sort -u` ;; \
493 esac; \
494 for file in $$dist_files; do \
495 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
496 if test -d $$d/$$file; then \
497 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
498 if test -d "$(distdir)/$$file"; then \
499 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
500 fi; \
501 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
502 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
503 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
504 fi; \
505 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
506 else \
507 test -f "$(distdir)/$$file" \
508 || cp -p $$d/$$file "$(distdir)/$$file" \
509 || exit 1; \
510 fi; \
511 done
512check-am: all-am
513check: check-am
514all-am: Makefile $(LTLIBRARIES)
515installdirs:
516 for dir in "$(DESTDIR)$(pkgdir)"; do \
517 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
518 done
519install: install-am
520install-exec: install-exec-am
521install-data: install-data-am
522uninstall: uninstall-am
523
524install-am: all-am
525 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
526
527installcheck: installcheck-am
528install-strip:
529 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
530 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
531 `test -z '$(STRIP)' || \
532 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
533mostlyclean-generic:
534
535clean-generic:
536
537distclean-generic:
538 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
539 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
540
541maintainer-clean-generic:
542 @echo "This command is intended for maintainers to use"
543 @echo "it deletes files that may require special tools to rebuild."
544 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
545clean: clean-am
546
547clean-am: clean-generic clean-libtool clean-pkgLTLIBRARIES \
548 mostlyclean-am
549
550distclean: distclean-am
551 -rm -rf ./$(DEPDIR)
552 -rm -f Makefile
553distclean-am: clean-am distclean-compile distclean-generic \
554 distclean-tags
555
556dvi: dvi-am
557
558dvi-am:
559
560html: html-am
561
562html-am:
563
564info: info-am
565
566info-am:
567
568install-data-am: install-pkgLTLIBRARIES
569
570install-dvi: install-dvi-am
571
572install-dvi-am:
573
574install-exec-am:
575
576install-html: install-html-am
577
578install-html-am:
579
580install-info: install-info-am
581
582install-info-am:
583
584install-man:
585
586install-pdf: install-pdf-am
587
588install-pdf-am:
589
590install-ps: install-ps-am
591
592install-ps-am:
593
594installcheck-am:
595
596maintainer-clean: maintainer-clean-am
597 -rm -rf ./$(DEPDIR)
598 -rm -f Makefile
599maintainer-clean-am: distclean-am maintainer-clean-generic
600
601mostlyclean: mostlyclean-am
602
603mostlyclean-am: mostlyclean-compile mostlyclean-generic \
604 mostlyclean-libtool
605
606pdf: pdf-am
607
608pdf-am:
609
610ps: ps-am
611
612ps-am:
613
614uninstall-am: uninstall-pkgLTLIBRARIES
615
616.MAKE: install-am install-strip
617
618.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
619 clean-libtool clean-pkgLTLIBRARIES ctags distclean \
620 distclean-compile distclean-generic distclean-libtool \
621 distclean-tags distdir dvi dvi-am html html-am info info-am \
622 install install-am install-data install-data-am install-dvi \
623 install-dvi-am install-exec install-exec-am install-html \
624 install-html-am install-info install-info-am install-man \
625 install-pdf install-pdf-am install-pkgLTLIBRARIES install-ps \
626 install-ps-am install-strip installcheck installcheck-am \
627 installdirs maintainer-clean maintainer-clean-generic \
628 mostlyclean mostlyclean-compile mostlyclean-generic \
629 mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
630 uninstall-am uninstall-pkgLTLIBRARIES
631
632
633# Tell versions [3.59,3.63) of GNU make to not export all variables.
634# Otherwise a system limit (for SysV at least) may be exceeded.
635.NOEXPORT:
diff --git a/libraries/edje/src/modules/multisense_factory/multisense_factory.c b/libraries/edje/src/modules/multisense_factory/multisense_factory.c
new file mode 100644
index 0000000..f89ae9b
--- /dev/null
+++ b/libraries/edje/src/modules/multisense_factory/multisense_factory.c
@@ -0,0 +1,33 @@
1#include "config.h"
2#include "edje_private.h"
3
4#define DEFAULT_SAMPLERATE 44100
5
6#ifdef HAVE_LIBREMIX
7EAPI RemixBase *
8multisense_sound_player_get(Edje_Multisense_Env *msenv)
9{
10 RemixEnv *env = msenv->remixenv;
11 RemixPlugin *player_plugin;
12 RemixBase *player;
13
14 player_plugin = remix_find_plugin(env, "alsa_snd_player");
15 if (!player_plugin)
16 {
17 WRN("ALSA player_plugin init fail\n");
18 return remix_monitor_new(env);
19 }
20 player = remix_new(env, player_plugin, NULL);
21 return player;
22}
23#endif
24
25EAPI Eina_Bool
26multisense_factory_init(Edje_Multisense_Env *env)
27{
28#ifdef HAVE_LIBREMIX
29 remix_set_samplerate(env->remixenv, DEFAULT_SAMPLERATE);
30 remix_set_channels(env->remixenv, REMIX_STEREO);
31#endif
32 return EINA_TRUE;
33}
diff --git a/libraries/edje/src/tests/Makefile.am b/libraries/edje/src/tests/Makefile.am
new file mode 100644
index 0000000..4981ad3
--- /dev/null
+++ b/libraries/edje/src/tests/Makefile.am
@@ -0,0 +1,27 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3AM_CPPFLAGS = \
4-I$(top_srcdir)/src/lib \
5@EDJE_CFLAGS@ \
6@CHECK_CFLAGS@
7
8if EFL_ENABLE_TESTS
9
10noinst_PROGRAMS = edje_suite
11
12check_PROGRAMS = edje_suite
13
14edje_suite_SOURCES = \
15edje_suite.c \
16edje_test_edje.c \
17edje_suite.h
18
19edje_suite_LDADD = \
20@EDJE_LIBS@ \
21@CHECK_LIBS@ \
22$(top_builddir)/src/lib/libedje.la
23
24endif
25
26clean-local:
27 rm -rf *.gcno *.gcda
diff --git a/libraries/edje/src/tests/Makefile.in b/libraries/edje/src/tests/Makefile.in
new file mode 100644
index 0000000..f610548
--- /dev/null
+++ b/libraries/edje/src/tests/Makefile.in
@@ -0,0 +1,597 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18VPATH = @srcdir@
19pkgdatadir = $(datadir)/@PACKAGE@
20pkgincludedir = $(includedir)/@PACKAGE@
21pkglibdir = $(libdir)/@PACKAGE@
22pkglibexecdir = $(libexecdir)/@PACKAGE@
23am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
24install_sh_DATA = $(install_sh) -c -m 644
25install_sh_PROGRAM = $(install_sh) -c
26install_sh_SCRIPT = $(install_sh) -c
27INSTALL_HEADER = $(INSTALL_DATA)
28transform = $(program_transform_name)
29NORMAL_INSTALL = :
30PRE_INSTALL = :
31POST_INSTALL = :
32NORMAL_UNINSTALL = :
33PRE_UNINSTALL = :
34POST_UNINSTALL = :
35build_triplet = @build@
36host_triplet = @host@
37@EFL_ENABLE_TESTS_TRUE@noinst_PROGRAMS = edje_suite$(EXEEXT)
38@EFL_ENABLE_TESTS_TRUE@check_PROGRAMS = edje_suite$(EXEEXT)
39subdir = src/tests
40DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
41ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
42am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
43 $(top_srcdir)/m4/efl_binary.m4 \
44 $(top_srcdir)/m4/efl_coverage.m4 \
45 $(top_srcdir)/m4/efl_doxygen.m4 \
46 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
47 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
48 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
49 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
50am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
51 $(ACLOCAL_M4)
52mkinstalldirs = $(install_sh) -d
53CONFIG_HEADER = $(top_builddir)/config.h
54CONFIG_CLEAN_FILES =
55CONFIG_CLEAN_VPATH_FILES =
56PROGRAMS = $(noinst_PROGRAMS)
57am__edje_suite_SOURCES_DIST = edje_suite.c edje_test_edje.c \
58 edje_suite.h
59@EFL_ENABLE_TESTS_TRUE@am_edje_suite_OBJECTS = edje_suite.$(OBJEXT) \
60@EFL_ENABLE_TESTS_TRUE@ edje_test_edje.$(OBJEXT)
61edje_suite_OBJECTS = $(am_edje_suite_OBJECTS)
62@EFL_ENABLE_TESTS_TRUE@edje_suite_DEPENDENCIES = \
63@EFL_ENABLE_TESTS_TRUE@ $(top_builddir)/src/lib/libedje.la
64AM_V_lt = $(am__v_lt_$(V))
65am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
66am__v_lt_0 = --silent
67DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
68depcomp = $(SHELL) $(top_srcdir)/depcomp
69am__depfiles_maybe = depfiles
70am__mv = mv -f
71COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
72 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
73LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
74 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
75 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
76 $(AM_CFLAGS) $(CFLAGS)
77AM_V_CC = $(am__v_CC_$(V))
78am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
79am__v_CC_0 = @echo " CC " $@;
80AM_V_at = $(am__v_at_$(V))
81am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
82am__v_at_0 = @
83CCLD = $(CC)
84LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
85 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
86 $(AM_LDFLAGS) $(LDFLAGS) -o $@
87AM_V_CCLD = $(am__v_CCLD_$(V))
88am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
89am__v_CCLD_0 = @echo " CCLD " $@;
90AM_V_GEN = $(am__v_GEN_$(V))
91am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
92am__v_GEN_0 = @echo " GEN " $@;
93SOURCES = $(edje_suite_SOURCES)
94DIST_SOURCES = $(am__edje_suite_SOURCES_DIST)
95ETAGS = etags
96CTAGS = ctags
97DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
98ACLOCAL = @ACLOCAL@
99ALLOCA = @ALLOCA@
100ALSA_CFLAGS = @ALSA_CFLAGS@
101ALSA_LIBS = @ALSA_LIBS@
102AMTAR = @AMTAR@
103AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
104AR = @AR@
105AS = @AS@
106AUTOCONF = @AUTOCONF@
107AUTOHEADER = @AUTOHEADER@
108AUTOMAKE = @AUTOMAKE@
109AWK = @AWK@
110CC = @CC@
111CCDEPMODE = @CCDEPMODE@
112CFLAGS = @CFLAGS@
113CHECK_CFLAGS = @CHECK_CFLAGS@
114CHECK_LIBS = @CHECK_LIBS@
115CPP = @CPP@
116CPPFLAGS = @CPPFLAGS@
117CYGPATH_W = @CYGPATH_W@
118DEFS = @DEFS@
119DEPDIR = @DEPDIR@
120DLLTOOL = @DLLTOOL@
121DSYMUTIL = @DSYMUTIL@
122DUMPBIN = @DUMPBIN@
123ECHO_C = @ECHO_C@
124ECHO_N = @ECHO_N@
125ECHO_T = @ECHO_T@
126ECORE_IMF_CFLAGS = @ECORE_IMF_CFLAGS@
127ECORE_IMF_LIBS = @ECORE_IMF_LIBS@
128EDJE_CC_CFLAGS = @EDJE_CC_CFLAGS@
129EDJE_CC_LIBS = @EDJE_CC_LIBS@
130EDJE_CC_PRG = @EDJE_CC_PRG@
131EDJE_CFLAGS = @EDJE_CFLAGS@
132EDJE_DECC_CFLAGS = @EDJE_DECC_CFLAGS@
133EDJE_DECC_LIBS = @EDJE_DECC_LIBS@
134EDJE_DECC_PRG = @EDJE_DECC_PRG@
135EDJE_EXTERNAL_INSPECTOR_CFLAGS = @EDJE_EXTERNAL_INSPECTOR_CFLAGS@
136EDJE_EXTERNAL_INSPECTOR_LIBS = @EDJE_EXTERNAL_INSPECTOR_LIBS@
137EDJE_EXTERNAL_INSPECTOR_PRG = @EDJE_EXTERNAL_INSPECTOR_PRG@
138EDJE_INSPECTOR_CFLAGS = @EDJE_INSPECTOR_CFLAGS@
139EDJE_INSPECTOR_LIBS = @EDJE_INSPECTOR_LIBS@
140EDJE_INSPECTOR_PRG = @EDJE_INSPECTOR_PRG@
141EDJE_LIBS = @EDJE_LIBS@
142EDJE_PLAYER_CFLAGS = @EDJE_PLAYER_CFLAGS@
143EDJE_PLAYER_LIBS = @EDJE_PLAYER_LIBS@
144EDJE_PLAYER_PRG = @EDJE_PLAYER_PRG@
145EDJE_RECC_PRG = @EDJE_RECC_PRG@
146EFL_COVERAGE_CFLAGS = @EFL_COVERAGE_CFLAGS@
147EFL_COVERAGE_LIBS = @EFL_COVERAGE_LIBS@
148EFL_EDJE_BUILD = @EFL_EDJE_BUILD@
149EGREP = @EGREP@
150EVIL_CFLAGS = @EVIL_CFLAGS@
151EVIL_LIBS = @EVIL_LIBS@
152EXEEXT = @EXEEXT@
153FGREP = @FGREP@
154FLAC_CFLAGS = @FLAC_CFLAGS@
155FLAC_LIBS = @FLAC_LIBS@
156GREP = @GREP@
157INSTALL = @INSTALL@
158INSTALL_DATA = @INSTALL_DATA@
159INSTALL_PROGRAM = @INSTALL_PROGRAM@
160INSTALL_SCRIPT = @INSTALL_SCRIPT@
161INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
162LD = @LD@
163LDFLAGS = @LDFLAGS@
164LIBOBJS = @LIBOBJS@
165LIBS = @LIBS@
166LIBTOOL = @LIBTOOL@
167LIPO = @LIPO@
168LN_S = @LN_S@
169LTLIBOBJS = @LTLIBOBJS@
170LUA_CFLAGS = @LUA_CFLAGS@
171LUA_LIBS = @LUA_LIBS@
172MAKEINFO = @MAKEINFO@
173MINIMAL_CFLAGS = @MINIMAL_CFLAGS@
174MINIMAL_LIBS = @MINIMAL_LIBS@
175MKDIR_P = @MKDIR_P@
176MODULE_ARCH = @MODULE_ARCH@
177NM = @NM@
178NMEDIT = @NMEDIT@
179OBJDUMP = @OBJDUMP@
180OBJEXT = @OBJEXT@
181OTOOL = @OTOOL@
182OTOOL64 = @OTOOL64@
183PACKAGE = @PACKAGE@
184PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
185PACKAGE_NAME = @PACKAGE_NAME@
186PACKAGE_STRING = @PACKAGE_STRING@
187PACKAGE_TARNAME = @PACKAGE_TARNAME@
188PACKAGE_URL = @PACKAGE_URL@
189PACKAGE_VERSION = @PACKAGE_VERSION@
190PATH_SEPARATOR = @PATH_SEPARATOR@
191PKG_CONFIG = @PKG_CONFIG@
192PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
193PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
194PYTHON = @PYTHON@
195PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
196PYTHON_PLATFORM = @PYTHON_PLATFORM@
197PYTHON_PREFIX = @PYTHON_PREFIX@
198PYTHON_VERSION = @PYTHON_VERSION@
199RANLIB = @RANLIB@
200REMIX_CFLAGS = @REMIX_CFLAGS@
201REMIX_LIBS = @REMIX_LIBS@
202REMIX_PLUGIN_DIR = @REMIX_PLUGIN_DIR@
203SED = @SED@
204SET_MAKE = @SET_MAKE@
205SHELL = @SHELL@
206SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
207SNDFILE_LIBS = @SNDFILE_LIBS@
208STRIP = @STRIP@
209VERSION = @VERSION@
210VMAJ = @VMAJ@
211VORBISENC_CFLAGS = @VORBISENC_CFLAGS@
212VORBISENC_LIBS = @VORBISENC_LIBS@
213abs_builddir = @abs_builddir@
214abs_srcdir = @abs_srcdir@
215abs_top_builddir = @abs_top_builddir@
216abs_top_srcdir = @abs_top_srcdir@
217ac_ct_CC = @ac_ct_CC@
218ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
219am__include = @am__include@
220am__leading_dot = @am__leading_dot@
221am__quote = @am__quote@
222am__tar = @am__tar@
223am__untar = @am__untar@
224bindir = @bindir@
225build = @build@
226build_alias = @build_alias@
227build_cpu = @build_cpu@
228build_os = @build_os@
229build_vendor = @build_vendor@
230builddir = @builddir@
231datadir = @datadir@
232datarootdir = @datarootdir@
233docdir = @docdir@
234dvidir = @dvidir@
235edje_cc = @edje_cc@
236efl_doxygen = @efl_doxygen@
237efl_have_doxygen = @efl_have_doxygen@
238exec_prefix = @exec_prefix@
239have_lcov = @have_lcov@
240host = @host@
241host_alias = @host_alias@
242host_cpu = @host_cpu@
243host_os = @host_os@
244host_vendor = @host_vendor@
245htmldir = @htmldir@
246includedir = @includedir@
247infodir = @infodir@
248install_sh = @install_sh@
249libdir = @libdir@
250libexecdir = @libexecdir@
251localedir = @localedir@
252localstatedir = @localstatedir@
253lt_ECHO = @lt_ECHO@
254lt_enable_auto_import = @lt_enable_auto_import@
255lua_libs = @lua_libs@
256mandir = @mandir@
257mkdir_p = @mkdir_p@
258oldincludedir = @oldincludedir@
259pdfdir = @pdfdir@
260pkgconfig_requires_private = @pkgconfig_requires_private@
261pkgpyexecdir = @pkgpyexecdir@
262pkgpythondir = @pkgpythondir@
263prefix = @prefix@
264program_transform_name = @program_transform_name@
265psdir = @psdir@
266pyexecdir = @pyexecdir@
267pythondir = @pythondir@
268release_info = @release_info@
269requirement_edje = @requirement_edje@
270sbindir = @sbindir@
271sharedstatedir = @sharedstatedir@
272srcdir = @srcdir@
273sysconfdir = @sysconfdir@
274target_alias = @target_alias@
275top_build_prefix = @top_build_prefix@
276top_builddir = @top_builddir@
277top_srcdir = @top_srcdir@
278version_info = @version_info@
279vimdir = @vimdir@
280MAINTAINERCLEANFILES = Makefile.in
281AM_CPPFLAGS = \
282-I$(top_srcdir)/src/lib \
283@EDJE_CFLAGS@ \
284@CHECK_CFLAGS@
285
286@EFL_ENABLE_TESTS_TRUE@edje_suite_SOURCES = \
287@EFL_ENABLE_TESTS_TRUE@edje_suite.c \
288@EFL_ENABLE_TESTS_TRUE@edje_test_edje.c \
289@EFL_ENABLE_TESTS_TRUE@edje_suite.h
290
291@EFL_ENABLE_TESTS_TRUE@edje_suite_LDADD = \
292@EFL_ENABLE_TESTS_TRUE@@EDJE_LIBS@ \
293@EFL_ENABLE_TESTS_TRUE@@CHECK_LIBS@ \
294@EFL_ENABLE_TESTS_TRUE@$(top_builddir)/src/lib/libedje.la
295
296all: all-am
297
298.SUFFIXES:
299.SUFFIXES: .c .lo .o .obj
300$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
301 @for dep in $?; do \
302 case '$(am__configure_deps)' in \
303 *$$dep*) \
304 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
305 && { if test -f $@; then exit 0; else break; fi; }; \
306 exit 1;; \
307 esac; \
308 done; \
309 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/tests/Makefile'; \
310 $(am__cd) $(top_srcdir) && \
311 $(AUTOMAKE) --gnu src/tests/Makefile
312.PRECIOUS: Makefile
313Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
314 @case '$?' in \
315 *config.status*) \
316 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
317 *) \
318 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
319 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
320 esac;
321
322$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
323 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
324
325$(top_srcdir)/configure: $(am__configure_deps)
326 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
327$(ACLOCAL_M4): $(am__aclocal_m4_deps)
328 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
329$(am__aclocal_m4_deps):
330
331clean-checkPROGRAMS:
332 @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
333 echo " rm -f" $$list; \
334 rm -f $$list || exit $$?; \
335 test -n "$(EXEEXT)" || exit 0; \
336 list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
337 echo " rm -f" $$list; \
338 rm -f $$list
339
340clean-noinstPROGRAMS:
341 @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
342 echo " rm -f" $$list; \
343 rm -f $$list || exit $$?; \
344 test -n "$(EXEEXT)" || exit 0; \
345 list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
346 echo " rm -f" $$list; \
347 rm -f $$list
348edje_suite$(EXEEXT): $(edje_suite_OBJECTS) $(edje_suite_DEPENDENCIES)
349 @rm -f edje_suite$(EXEEXT)
350 $(AM_V_CCLD)$(LINK) $(edje_suite_OBJECTS) $(edje_suite_LDADD) $(LIBS)
351
352mostlyclean-compile:
353 -rm -f *.$(OBJEXT)
354
355distclean-compile:
356 -rm -f *.tab.c
357
358@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_suite.Po@am__quote@
359@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_test_edje.Po@am__quote@
360
361.c.o:
362@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
363@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
364@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
365@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
366@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
367@am__fastdepCC_FALSE@ $(COMPILE) -c $<
368
369.c.obj:
370@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
371@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
372@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
373@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
374@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
375@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
376
377.c.lo:
378@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
379@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
380@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
381@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
382@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
383@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
384
385mostlyclean-libtool:
386 -rm -f *.lo
387
388clean-libtool:
389 -rm -rf .libs _libs
390
391ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
392 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
393 unique=`for i in $$list; do \
394 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
395 done | \
396 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
397 END { if (nonempty) { for (i in files) print i; }; }'`; \
398 mkid -fID $$unique
399tags: TAGS
400
401TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
402 $(TAGS_FILES) $(LISP)
403 set x; \
404 here=`pwd`; \
405 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
406 unique=`for i in $$list; do \
407 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
408 done | \
409 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
410 END { if (nonempty) { for (i in files) print i; }; }'`; \
411 shift; \
412 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
413 test -n "$$unique" || unique=$$empty_fix; \
414 if test $$# -gt 0; then \
415 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
416 "$$@" $$unique; \
417 else \
418 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
419 $$unique; \
420 fi; \
421 fi
422ctags: CTAGS
423CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
424 $(TAGS_FILES) $(LISP)
425 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
426 unique=`for i in $$list; do \
427 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
428 done | \
429 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
430 END { if (nonempty) { for (i in files) print i; }; }'`; \
431 test -z "$(CTAGS_ARGS)$$unique" \
432 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
433 $$unique
434
435GTAGS:
436 here=`$(am__cd) $(top_builddir) && pwd` \
437 && $(am__cd) $(top_srcdir) \
438 && gtags -i $(GTAGS_ARGS) "$$here"
439
440distclean-tags:
441 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
442
443distdir: $(DISTFILES)
444 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
445 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
446 list='$(DISTFILES)'; \
447 dist_files=`for file in $$list; do echo $$file; done | \
448 sed -e "s|^$$srcdirstrip/||;t" \
449 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
450 case $$dist_files in \
451 */*) $(MKDIR_P) `echo "$$dist_files" | \
452 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
453 sort -u` ;; \
454 esac; \
455 for file in $$dist_files; do \
456 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
457 if test -d $$d/$$file; then \
458 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
459 if test -d "$(distdir)/$$file"; then \
460 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
461 fi; \
462 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
463 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
464 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
465 fi; \
466 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
467 else \
468 test -f "$(distdir)/$$file" \
469 || cp -p $$d/$$file "$(distdir)/$$file" \
470 || exit 1; \
471 fi; \
472 done
473check-am: all-am
474 $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
475check: check-am
476all-am: Makefile $(PROGRAMS)
477installdirs:
478install: install-am
479install-exec: install-exec-am
480install-data: install-data-am
481uninstall: uninstall-am
482
483install-am: all-am
484 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
485
486installcheck: installcheck-am
487install-strip:
488 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
489 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
490 `test -z '$(STRIP)' || \
491 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
492mostlyclean-generic:
493
494clean-generic:
495
496distclean-generic:
497 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
498 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
499
500maintainer-clean-generic:
501 @echo "This command is intended for maintainers to use"
502 @echo "it deletes files that may require special tools to rebuild."
503 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
504clean: clean-am
505
506clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \
507 clean-noinstPROGRAMS mostlyclean-am
508
509distclean: distclean-am
510 -rm -rf ./$(DEPDIR)
511 -rm -f Makefile
512distclean-am: clean-am distclean-compile distclean-generic \
513 distclean-tags
514
515dvi: dvi-am
516
517dvi-am:
518
519html: html-am
520
521html-am:
522
523info: info-am
524
525info-am:
526
527install-data-am:
528
529install-dvi: install-dvi-am
530
531install-dvi-am:
532
533install-exec-am:
534
535install-html: install-html-am
536
537install-html-am:
538
539install-info: install-info-am
540
541install-info-am:
542
543install-man:
544
545install-pdf: install-pdf-am
546
547install-pdf-am:
548
549install-ps: install-ps-am
550
551install-ps-am:
552
553installcheck-am:
554
555maintainer-clean: maintainer-clean-am
556 -rm -rf ./$(DEPDIR)
557 -rm -f Makefile
558maintainer-clean-am: distclean-am maintainer-clean-generic
559
560mostlyclean: mostlyclean-am
561
562mostlyclean-am: mostlyclean-compile mostlyclean-generic \
563 mostlyclean-libtool
564
565pdf: pdf-am
566
567pdf-am:
568
569ps: ps-am
570
571ps-am:
572
573uninstall-am:
574
575.MAKE: check-am install-am install-strip
576
577.PHONY: CTAGS GTAGS all all-am check check-am clean \
578 clean-checkPROGRAMS clean-generic clean-libtool clean-local \
579 clean-noinstPROGRAMS ctags distclean distclean-compile \
580 distclean-generic distclean-libtool distclean-tags distdir dvi \
581 dvi-am html html-am info info-am install install-am \
582 install-data install-data-am install-dvi install-dvi-am \
583 install-exec install-exec-am install-html install-html-am \
584 install-info install-info-am install-man install-pdf \
585 install-pdf-am install-ps install-ps-am install-strip \
586 installcheck installcheck-am installdirs maintainer-clean \
587 maintainer-clean-generic mostlyclean mostlyclean-compile \
588 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
589 tags uninstall uninstall-am
590
591
592clean-local:
593 rm -rf *.gcno *.gcda
594
595# Tell versions [3.59,3.63) of GNU make to not export all variables.
596# Otherwise a system limit (for SysV at least) may be exceeded.
597.NOEXPORT:
diff --git a/libraries/edje/src/tests/edje_suite.c b/libraries/edje/src/tests/edje_suite.c
new file mode 100644
index 0000000..ad789b6
--- /dev/null
+++ b/libraries/edje/src/tests/edje_suite.c
@@ -0,0 +1,101 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <stdio.h>
7
8#include <Edje.h>
9
10#include "edje_suite.h"
11
12typedef struct _Edje_Test_Case Edje_Test_Case;
13
14struct _Edje_Test_Case
15{
16 const char *test_case;
17 void (*build)(TCase *tc);
18};
19
20static const Edje_Test_Case etc[] = {
21 { "Edje", edje_test_edje },
22 { NULL, NULL }
23};
24
25static void
26_list_tests(void)
27{
28 const Edje_Test_Case *itr;
29
30 itr = etc;
31 fputs("Available Test Cases:\n", stderr);
32 for (; itr->test_case; itr++)
33 fprintf(stderr, "\t%s\n", itr->test_case);
34}
35static Eina_Bool
36_use_test(int argc, const char **argv, const char *test_case)
37{
38 if (argc < 1)
39 return 1;
40
41 for (; argc > 0; argc--, argv++)
42 if (strcmp(test_case, *argv) == 0)
43 return 1;
44 return 0;
45}
46
47static Suite *
48edje_suite_build(int argc, const char **argv)
49{
50 TCase *tc;
51 Suite *s;
52 int i;
53
54 s = suite_create("Edje");
55
56 for (i = 0; etc[i].test_case; ++i)
57 {
58 if (!_use_test(argc, argv, etc[i].test_case)) continue;
59 tc = tcase_create(etc[i].test_case);
60
61 etc[i].build(tc);
62
63 suite_add_tcase(s, tc);
64 tcase_set_timeout(tc, 0);
65 }
66
67 return s;
68}
69
70int
71main(int argc, char **argv)
72{
73 Suite *s;
74 SRunner *sr;
75 int i, failed_count;
76
77 for (i = 1; i < argc; i++)
78 if ((strcmp(argv[i], "-h") == 0) ||
79 (strcmp(argv[i], "--help") == 0))
80 {
81 fprintf(stderr, "Usage:\n\t%s [test_case1 .. [test_caseN]]\n",
82 argv[0]);
83 _list_tests();
84 return 0;
85 }
86 else if ((strcmp(argv[i], "-l") == 0) ||
87 (strcmp(argv[i], "--list") == 0))
88 {
89 _list_tests();
90 return 0;
91 }
92
93 s = edje_suite_build(argc - 1, (const char **)argv + 1);
94 sr = srunner_create(s);
95
96 srunner_run_all(sr, CK_ENV);
97 failed_count = srunner_ntests_failed(sr);
98 srunner_free(sr);
99
100 return (failed_count == 0) ? 0 : 255;
101}
diff --git a/libraries/edje/src/tests/edje_suite.h b/libraries/edje/src/tests/edje_suite.h
new file mode 100644
index 0000000..35ab20d
--- /dev/null
+++ b/libraries/edje/src/tests/edje_suite.h
@@ -0,0 +1,9 @@
1#ifndef _EDJE_SUITE_H
2#define _EDJE_SUITE_H
3
4#include <check.h>
5
6void edje_test_edje(TCase *tc);
7
8
9#endif /* _EDJE_SUITE_H */
diff --git a/libraries/edje/src/tests/edje_test_edje.c b/libraries/edje/src/tests/edje_test_edje.c
new file mode 100644
index 0000000..ad92c63
--- /dev/null
+++ b/libraries/edje/src/tests/edje_test_edje.c
@@ -0,0 +1,28 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <unistd.h>
6#include <stdio.h>
7
8#include <Eina.h>
9#include <Edje.h>
10
11#include "edje_suite.h"
12
13START_TEST(edje_test_edje_init)
14{
15 int ret;
16
17 ret = edje_init();
18 fail_if(ret != 1);
19
20 ret = edje_shutdown();
21 fail_if(ret != 0);
22}
23END_TEST
24
25void edje_test_edje(TCase *tc)
26{
27 tcase_add_test(tc, edje_test_edje_init);
28}