From 59f1cdae358b53eb7f9585201497d3924252cf62 Mon Sep 17 00:00:00 2001 From: Jaehwan Kim Date: Thu, 23 Jun 2011 19:35:34 +0900 Subject: [PATCH] svn update: 60299 (latest:60299) --- AUTHORS | 1 - ChangeLog | 48 + autogen.sh | 23 + configure.ac | 1 + data/.cvsignore | 2 - data/edc.vim | 6 +- data/include/.cvsignore | 2 - doc/.cvsignore | 3 - doc/{Doxyfile => Doxyfile.in} | 12 +- doc/Makefile.am | 6 +- doc/edje.dox.in | 519 ------- edje.pc.in | 2 + src/.cvsignore | 2 - src/bin/.cvsignore | 10 - src/bin/Makefile.am | 5 +- src/bin/edje_cc.c | 17 +- src/bin/edje_cc.h | 3 + src/bin/edje_cc_handlers.c | 158 ++- src/bin/edje_cc_mem.c | 10 +- src/bin/edje_cc_out.c | 20 +- src/bin/edje_cc_parse.c | 141 +- src/bin/edje_convert.c | 1 - src/bin/edje_convert_main.c | 1 - src/bin/edje_inspector.c | 10 +- src/bin/edje_player.c | 8 +- src/bin/edje_prefix.c | 448 ------- src/bin/edje_prefix.h | 7 - src/bin/epp/cpplib.c | 453 +++---- src/bin/epp/cppmain.c | 1 - src/lib/.cvsignore | 6 - src/lib/Edje.h | 2980 +++++++++++++++++++++++++++++++++++++---- src/lib/Edje_Edit.h | 45 + src/lib/edje_cache.c | 113 +- src/lib/edje_calc.c | 209 ++- src/lib/edje_data.c | 4 + src/lib/edje_edit.c | 46 +- src/lib/edje_embryo.c | 4 +- src/lib/edje_entry.c | 675 +++++----- src/lib/edje_external.c | 220 +-- src/lib/edje_load.c | 95 +- src/lib/edje_lua.c | 4 +- src/lib/edje_lua2.c | 26 +- src/lib/edje_main.c | 104 +- src/lib/edje_match.c | 21 +- src/lib/edje_message_queue.c | 62 - src/lib/edje_module.c | 6 +- src/lib/edje_private.h | 16 +- src/lib/edje_program.c | 227 +--- src/lib/edje_smart.c | 81 +- src/lib/edje_text.c | 142 +- src/lib/edje_util.c | 1339 ++---------------- 51 files changed, 4275 insertions(+), 4070 deletions(-) delete mode 100644 data/.cvsignore delete mode 100644 data/include/.cvsignore delete mode 100644 doc/.cvsignore rename doc/{Doxyfile => Doxyfile.in} (99%) delete mode 100644 src/.cvsignore delete mode 100644 src/bin/.cvsignore delete mode 100644 src/bin/edje_prefix.c delete mode 100644 src/bin/edje_prefix.h delete mode 100644 src/lib/.cvsignore diff --git a/AUTHORS b/AUTHORS index 074162a..9a636b3 100644 --- a/AUTHORS +++ b/AUTHORS @@ -14,4 +14,3 @@ Davide Andreoli Sebastian Dransfeld Tom Hacohen Aharon Hillel -Mike Blumenkrantz diff --git a/ChangeLog b/ChangeLog index 672af80..671c09f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -75,3 +75,51 @@ * text.align (only the vertical part) now works for textblock. +2011-04-1 Carsten Haitzler (The Rasterman) + + * Add Feature: Support explicit shadow direction with extra effect + param (optional). Default as before. + +2011-04-28 Tom Hacohen (TAsn) + + * size_min_restricted_calc: Fixed textblock handling. + +2011-05-15 Tom Hacohen (TAsn) + + * Entry - New API: added edje_object_part_text_append which appends + text to the end of the textblock part. This lets us do cool thing + like population of textblock using idler. + +2011-05-16 Carsten Haitzler (The Rasterman) + + * Add new interpolation modes for programs to make animation + much easier. Added: ACCEL_FAC, DECEL_FAC, SIN_FAC, DIVIS, + BOUNCE, SPRING (also made short name versions of the long ones + possible too). + +2011-05-19 Tom Hacohen (TAsn) + + * Entry: Don't emit "cursor,changed" when setting the text, because + the cursor really didn't change, it's more like a new cursor. + Also, when setting position, don't do anything if position is as it + was. + +2011-05-27 Carsten Haitzler (The Rasterman) + + * Improve performance on create/delete of edje objects by using + evas freeze and thaw calls. May help in certain pathological + situations. + +2011-05-27 Cedric Bail + + * Improve performance by avoiding walking eina_list for nothing + when deleting member_class. + +2011-06-09 Cedric Bail + + * Fix external usage in sub group to have the proper parents. + +2011-06-11 Tom Hacohen (TAsn) + + * Fix an issue with ellipsis not working properly with small + text parts. diff --git a/autogen.sh b/autogen.sh index 6499736..b7397d4 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,6 +1,7 @@ #!/bin/sh touch README +touch ABOUT-NLS echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS -I m4 || exit 1 echo "Running autoheader..." ; autoheader || exit 1 @@ -8,6 +9,28 @@ echo "Running autoconf..." ; autoconf || exit 1 echo "Running libtoolize..." ; (libtoolize --copy --automake || glibtoolize --automake) || exit 1 echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1 +W=0 + +rm -f config.cache-env.tmp +echo "OLD_PARM=\"$@\"" >> config.cache-env.tmp +echo "OLD_CFLAGS=\"$CFLAGS\"" >> config.cache-env.tmp +echo "OLD_PATH=\"$PATH\"" >> config.cache-env.tmp +echo "OLD_PKG_CONFIG_PATH=\"$PKG_CONFIG_PATH\"" >> config.cache-env.tmp +echo "OLD_LDFLAGS=\"$LDFLAGS\"" >> config.cache-env.tmp + +cmp config.cache-env.tmp config.cache-env >> /dev/null +if [ $? -ne 0 ]; then + W=1; +fi + +if [ $W -ne 0 ]; then + echo "Cleaning configure cache..."; + rm -f config.cache config.cache-env + mv config.cache-env.tmp config.cache-env +else + rm -f config.cache-env.tmp +fi + if [ -z "$NOCONFIGURE" ]; then ./configure -C "$@" fi diff --git a/configure.ac b/configure.ac index c8e57c7..e897f07 100644 --- a/configure.ac +++ b/configure.ac @@ -380,6 +380,7 @@ Makefile data/Makefile data/include/Makefile doc/Makefile +doc/Doxyfile doc/edje.dox src/Makefile src/lib/Makefile diff --git a/data/.cvsignore b/data/.cvsignore deleted file mode 100644 index 282522d..0000000 --- a/data/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/data/edc.vim b/data/edc.vim index 1d9be9c..55e1f0b 100644 --- a/data/edc.vim +++ b/data/edc.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: EDC " Maintainer: billiob -" Last Change: 04/21/2010 +" Last Change: 05/08/2011 " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded @@ -31,10 +31,10 @@ syn keyword cLabel alias events entry_mode select_mode multiline syn keyword cLabel source1 source2 source3 source4 source5 source6 syn keyword cLabel text_source transitions layout padding syn keyword cLabel size_w size_h size_max_w size_max_h size_min_w size_min_w -syn keyword cLabel spread scale_hint elipsis pointer_mode prefer +syn keyword cLabel spread scale_hint elipsis ellipsis pointer_mode prefer syn keyword cLabel precise_is_inside use_alternate_font_metrics options syn keyword cLabel aspect_mode position span angle repch api -syn keyword cLabel external +syn keyword cLabel external params size_range border_scale syn keyword cConditional if else switch syn keyword cRepeat while for do diff --git a/data/include/.cvsignore b/data/include/.cvsignore deleted file mode 100644 index 282522d..0000000 --- a/data/include/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/doc/.cvsignore b/doc/.cvsignore deleted file mode 100644 index cc370ed..0000000 --- a/doc/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -html -latex -man diff --git a/doc/Doxyfile b/doc/Doxyfile.in similarity index 99% rename from doc/Doxyfile rename to doc/Doxyfile.in index 29432d5..cb04f48 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile.in @@ -114,7 +114,7 @@ FULL_PATH_NAMES = YES # If left blank the directory from which doxygen is run is used as the # path to strip. -STRIP_FROM_PATH = ../ src/ +STRIP_FROM_PATH = @top_srcdir@/ src/ # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells @@ -586,7 +586,7 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = edje.dox ../src/bin/edje_cc_handlers.c ../src/lib +INPUT = @srcdir@/edje.dox @top_srcdir@/src/bin/edje_cc_handlers.c @top_srcdir@/src/lib # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is @@ -643,7 +643,7 @@ EXCLUDE_SYMBOLS = # directories that contain example code fragments that are included (see # the \include command). -EXAMPLE_PATH = examples/ +EXAMPLE_PATH = @top_srcdir@/src/examples/ # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp @@ -797,13 +797,13 @@ HTML_FILE_EXTENSION = .html # each generated HTML page. If it is left blank doxygen will generate a # standard header. -HTML_HEADER = head.html +HTML_HEADER = @srcdir@/head.html # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. -HTML_FOOTER = foot.html +HTML_FOOTER = @srcdir@/foot.html # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to @@ -812,7 +812,7 @@ HTML_FOOTER = foot.html # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! -HTML_STYLESHEET = e.css +HTML_STYLESHEET = @srcdir@/e.css # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to diff --git a/doc/Makefile.am b/doc/Makefile.am index 45d97a8..f5baff0 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -8,18 +8,18 @@ PACKAGE_DOCNAME = $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)-doc if EFL_BUILD_DOC doc-clean: - rm -rf html/ latex/ man/ xml/ $(PACKAGE_DOCNAME).tar* + rm -rf html/ latex/ man/ xml/ $(top_builddir)/$(PACKAGE_DOCNAME).tar* doc: all doc-clean $(efl_doxygen) - cp img/* html/ + cp $(srcdir)/img/* html/ rm -rf $(PACKAGE_DOCNAME).tar* mkdir -p $(PACKAGE_DOCNAME)/doc cp -R html/ latex/ man/ $(PACKAGE_DOCNAME)/doc tar cf $(PACKAGE_DOCNAME).tar $(PACKAGE_DOCNAME)/ bzip2 -9 $(PACKAGE_DOCNAME).tar rm -rf $(PACKAGE_DOCNAME)/ - mv $(PACKAGE_DOCNAME).tar.bz2 $(top_srcdir) + mv $(PACKAGE_DOCNAME).tar.bz2 $(top_builddir) clean-local: doc-clean diff --git a/doc/edje.dox.in b/doc/edje.dox.in index 739a513..e69de29 100644 --- a/doc/edje.dox.in +++ b/doc/edje.dox.in @@ -1,519 +0,0 @@ -/** -@file edje.dox -@brief Edje Graphical Design Library - -These routines are used for Edje. -*/ - -/** - -@mainpage Edje Library Documentation -@image html e.png -@version @PACKAGE_VERSION@ -@author Carsten Haitzler -@author Tilman Sauerbeck (tilman at code-monkey de) -@author ZigsMcKenzie -@author Cedric BAIL -@author Brian Mattern -@author Mathieu Taillefumier -@author Tristan -@author Gustavo Lima Chaves -@author Bruno Dilly -@author Fabiano Fidêncio -@author Jihoon Kim -@author Tiago Falcão -@author Davide Andreoli -@author Sebastian Dransfeld -@author Tom Hacohen -@author Aharon Hillel -@date 2003-2011 - - - - - - - - - - -@section intro What is Edje? - -Edje is a complex graphical design & layout library. - -It doesn't pretend to do containing and regular layout like a widget -set, but it is the base for such components. Based on the requirements -of Enlightenment 0.17, Edje should serve all the purposes of creating -visual elements (borders of windows, buttons, scrollbars, etc.) and -allow the designer the ability to animate, layout and control the look -and feel of any program using Edje as its basic GUI constructor. This -library allows for multiple collections of Layouts in one file, -sharing the same image and font database and thus allowing a whole -theme to be conveniently packaged into 1 file and shipped around. - -Edje separates the layout and behavior logic. Edje files ship with an -image and font database, used by all the parts in all the collections -to source graphical data. It has a directory of logical part names -pointing to the part collection entry ID in the file (thus allowing -for multiple logical names to point to the same part collection, -allowing for the sharing of data between display elements). Each part -collection consists of a list of visual parts, as well as a list of -programs. A program is a conditionally run program that if a -particular event occurs (a button is pressed, a mouse enters or leaves -a part) will trigger an action that may affect other parts. In this -way a part collection can be "programmed" via its file as to hilight -buttons when the mouse passes over them or show hidden parts when a -button is clicked somewhere etc. The actions performed in changing -from one state to another are also allowed to transition over a period -of time, allowing animation. Programs and animations can be run in -"parallel". - -This separation and simplistic event driven style of programming can produce -almost any look and feel one could want for basic visual elements. Anything -more complex is likely the domain of an application or widget set that may -use Edje as a convenient way of being able to configure parts of the display. - -For details of Edje's history, see the \ref history section. - - - - - - - - -@section requirements What does Edje require? - -Edje requires fairly little on your system. to use the Edje runtime library -you need: - - - Evas (library) - - Ecore (library) - - Eet (library) - - Embryo (library) - - Eina (library) - -Evas needs to be build with the JPEG, PNG and EET image loaders enabled at a -minimum. Edje uses X for the test program, so you will need the SOFTWARE_X11 -engine built into Evas as well. A suggested configure list is below in the -"cheat sheet" for Evas. - -Ecore needs the ECORE, ECORE_EVAS and ECORE_X modules built at a minimum. -It's suggested to build all the Ecore modules, but the ECORE_FB modules is -definitely optional. - -Eina, Eet and Embryo have no interesting options so just build and -install them. - -It is suggested right now that you get the latest SVN versions of the -required libraries. You also need to build them in the right order and make -sure the right options are enabled in the required libraries. Here is a -quick "cheat sheet" on how to get started. - -@verbatim -1. You need Eina from the trunk svn branch. - - svn co http://svn.enlightenment.org/svn/e/trunk/eina/ - cd eina - ./autogen.sh - ./configure - make - sudo make install - cd - -2. You need Eet from the trunk svn branch. - - svn co http://svn.enlightenment.org/svn/e/trunk/eet/ - cd eet - ./autogen.sh - ./configure - make - sudo make install - cd - -3. You need Evas from the trunk svn branch built with eet, png and jpeg loader support. - - svn co http://svn.enlightenment.org/svn/e/trunk/evas/ - cd evas - ./autogen.sh - ./configure --enable-image-loader-eet --enable-font-loader-eet --enable-image-loader-jpeg --enable-image-loader-png --enable-buffer - make - sudo make install - cd - -4. You need Ecore from the trunk svn branch built with ecore-x and ecore-evas. - - svn co http://svn.enlightenment.org/svn/e/trunk/ecore/ - cd ecore - ./autogen.sh - ./configure --enable-ecore-x --enable-ecore-evas --enable-ecore-evas-software-buffer --enable-ecore-evas-software-x11 --enable-ecore-evas-software-buffer - make - sudo make install - cd - -5. You need embryo from the trunk svn branch - - svn co http://svn.enlightenment.org/svn/e/trunk/embryo/ - cd embryo - ./autogen.sh - ./configure - make - sudo make install - cd - -@endverbatim - - - - - - - - - -@section compiling How to compile and test Edje - -Now you need to compile and install Edje. - -@verbatim - ./configure - make - sudo make install -@endverbatim - -You now have it installed and ready to go, but you need input -data. There are lots of examples in SVN, the best one is -Enlightenment's own theme file. - -You may use different tools to edit and view the generated ".edj" -files, for instance: - - - editje (http://trac.enlightenment.org/e/wiki/Editje) - - edje_viewer (http://trac.enlightenment.org/e/wiki/Edje_Viewer) - - - - - - - - - - -@section details So how does this all work? - -Edje internally holds a geometry state machine and state graph of what is -visible, not, where, at what size, with what colors etc. This is described -to Edje from an Edje .edj file containing this information. These files can -be produced by using edje_cc to take a text file (a .edc file) and "compile" -an output .edj file that contains this information, images and any other -data needed. - -The application using Edje will then create an object in its Evas -canvas and set the bundle file to use, specifying the @b group name to -use. Edje will load such information and create all the required -children objects with the specified properties as defined in each @b -part of the given group. See the following annotated example: - -@code -/* - * edje_example.c: - * - * Creates a window using Ecore_Evas and inside it an object with - * the edje group "my_group" from file "edje_example.edj". - * - * Requires edje_example.edj in the current folder. - * - * Compile: - * gcc -o edje_example edje_example.c `pkg-config --cflags --libs eina evas ecore ecore-evas edje` - */ - -#include -#include -#include -#include -#include - -#define WIDTH 320 -#define HEIGHT 240 - -static Evas_Object *create_my_group(Evas *canvas, const char *text) -{ - Evas_Object *edje; - - /* create the edje object where we'll load our file */ - edje = edje_object_add(canvas); - if (!edje) - { - EINA_LOG_CRIT("could not create edje object!"); - return NULL; - } - - /* load our desired file */ - if (!edje_object_file_set(edje, "edje_example.edj", "my_group")) - { - int err = edje_object_load_error_get(edje); - const char *errmsg = edje_load_error_str(err); - EINA_LOG_ERR("could not load 'my_group' from edje_example.edj: %s", - errmsg); - - evas_object_del(edje); - return NULL; - } - - if (text) - { - /* this is will replace the string used by "text" part in "my_group" */ - if (!edje_object_part_text_set(edje, "text", text)) - { - EINA_LOG_WARN("could not set the text. " - "Maybe part 'text' does not exist?"); - } - } - - /* operate on edje as any other object */ - evas_object_move(edje, 0, 0); - evas_object_resize(edje, WIDTH, HEIGHT); - evas_object_show(edje); - return edje; -} - -int main(int argc, char *argv[]) -{ - Ecore_Evas *window; - Evas *canvas; - Evas_Object *edje; - const char *text; - - eina_init(); - evas_init(); - ecore_init(); - ecore_evas_init(); - edje_init(); - - window = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); - if (!window) - { - EINA_LOG_CRIT("could not create window."); - return -1; - } - canvas = ecore_evas_get(window); - - text = (argc > 1) ? argv[1] : NULL; - - edje = create_my_group(canvas, text); - if (!edje) - return -2; - - ecore_evas_show(window); - ecore_main_loop_begin(); - - evas_object_del(edje); - ecore_evas_free(window); - - return 0; -} -@endcode - -It requires the following source Edje file: -@code -// compile: edje_cc edje_example.edc -collections { - group { - name: "my_group"; // must be the same as in edje_example.c - - parts { - part { - name: "background"; - type: RECT; // plain boring rectangle - mouse_events: 0; // we don't need any mouse event on the background - - // just one state "default" - description { - state: "default" 0.0; // must always exist - color: 255 255 255 255; // white - - // define part coordinates: - - rel1 { // top-left point at (0, 0) [WIDTH * 0 + 0, HEIGHT * 0 + 0] - relative: 0.0 0.0; - offset: 0 0; - } - rel2 { // bottom-right point at (WIDTH * 1.0 - 1, HEIGHT * 1.0 - 1) - relative: 1.0 1.0; - offset: -1 -1; - } - } - } - - part { - name: "text"; - type: TEXT; - mouse_events: 1; // we want to change the color on mouse-over - - // 2 states, one "default" and another "over" to be used - // on mouse over effect - - description { - state: "default" 0.0; - color: 255 0 0 255; // red - - // define part coordinates: - - rel1 { // top-left at (WIDTH * 0.1 + 5, HEIGHT * 0.2 + 10) - relative: 0.1 0.2; - offset: 5 10; - } - rel2 { // bottom-right at (WIDTH * 0.9 - 6, HEIGHT * 0.8 - 11) - relative: 0.9 0.8; - offset: -6 -11; - } - - // define text specific state details - text { - font: "Sans"; /* using fontconfig name! */ - size: 10; - text: "hello world"; - } - } - - description { - state: "over" 0.0; - inherit: "default" 0.0; // copy everything from "default" at this point - - color: 0 255 0 255; // override color, now it is green - } - } - - // do programs to change color on text mouse in/out (over) - programs { - program { - // what triggers this program: - signal: "mouse,in"; - source: "text"; - - // what this program does: - action: STATE_SET "over" 0.0; - target: "text"; - - // do the state-set in a nice interpolation animation - // using linear time in 0.1 second - transition: LINEAR 0.1; - } - - program { - // what triggers this program: - signal: "mouse,out"; - source: "text"; - - // what this program does: - action: STATE_SET "default" 0.0; - target: "text"; - - // do the state-set in a nice interpolation animation - // using linear time in 0.1 second - transition: LINEAR 0.1; - } - } - } - } -} -@endcode - - -One should save these files as edje_example.c and edje_example.edc then: -@verbatim -gcc -o edje_example edje_example.c `pkg-config --cflags --libs eina evas ecore ecore-evas edje` -edje_cc edje_example.edc - -./edje_example "some text" -@endverbatim - -Although simple, this example illustrates that animations and state -changes can be done from the Edje file itself without any requirement -in the C application. - -Before digging into changing or creating your own Edje source (edc) -files, read the \ref edcref. - - - -@section history Edje History - -It's a sequel to "Ebits" which has serviced the needs of Enlightenment -development for early version 0.17. The original design parameters under -which Ebits came about were a lot more restricted than the resulting -use of them, thus Edje was born. - -Edje is a more complex layout engine compared to Ebits. It doesn't -pretend to do containing and regular layout like a widget set. It -still inherits the more simplistic layout ideas behind Ebits, but it -now does them a lot more cleanly, allowing for easy expansion, and the -ability to cover much more ground than Ebits ever could. For the -purposes of Enlightenment 0.17, Edje was conceived to serve all the -purposes of creating visual elements (borders of windows, buttons, -scrollbars, etc.) and allow the designer the ability to animate, -layout and control the look and feel of any program using Edje as its -basic GUI constructor. - -Unlike Ebits, Edje separates the layout and behavior logic. - - - - - - - - - -@todo Complete documentation of API -@todo Bytecode language for extending programs... but what/how? - -*/ - - -/** - -@example embryo_custom_state.edc -This example show how to create a custom state from embryo. Clicking on the -3 labels will rotate the object in the given direction. - -@example embryo_pong.edc -Super-simple Pong implementation in pure embryo. - -@example embryo_run_program.edc -This example show how to run an edje program from embryo code. - -@example embryo_set_state.edc -This example show how to change the state of a part from embryo code. - -@example embryo_set_text.edc -This example show how to set the text in TEXT part from embryo code. - -@example embryo_timer.edc -This example show the usage of timers in embryo. - -@example external_elm_anchorblock.edc -This example use an elementary anchorblock and a button to animate the text. - -@example external_elm_button.edc -This example create some elementary buttons and do some actions on user click. - -@example external_elm_check.edc -This example show EXTERNAL checkbox in action. - -@example external_elm_panes.edc -This example show EXTERNAL elementary panes in action. - -@example external_emotion_elm.edc -Super-concise video player example using Edje/Emotion/Elementary. - -@example lua_script.edc -This example show the usage of lua scripting to create and animate some -objects in the canvas. - -@example toggle_using_filter.edc -This example show how to toggle the state of a part using the 'filter' -param in edje programs - -*/ diff --git a/edje.pc.in b/edje.pc.in index 815730f..1f2befe 100644 --- a/edje.pc.in +++ b/edje.pc.in @@ -1,9 +1,11 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ +modules=@libdir@/@PACKAGE@/modules includedir=@includedir@ datarootdir=@datarootdir@ datadir=@datadir@/edje +vmaj=@VMAJ@ Name: edje Description: Enlightened graphical design and layout engine. diff --git a/src/.cvsignore b/src/.cvsignore deleted file mode 100644 index 282522d..0000000 --- a/src/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/src/bin/.cvsignore b/src/bin/.cvsignore deleted file mode 100644 index 93f5fa1..0000000 --- a/src/bin/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -edje -edje_ls -edje_cc -edje_decc -edje_test -edje_thumb diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index e559f7f..cce746c 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -16,8 +16,7 @@ edje_cc_out.c \ edje_cc_parse.c \ edje_cc_mem.c \ edje_cc_handlers.c \ -edje_cc_sources.c \ -edje_prefix.c +edje_cc_sources.c edje_cc_CPPFLAGS = \ -I$(top_srcdir)/src/bin \ @@ -69,5 +68,5 @@ edje_external_inspector_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_EXTERNA edje_external_inspector_LDFLAGS = @lt_enable_auto_import@ -EXTRA_DIST = @EDJE_RECC_PRG@ edje_prefix.h edje_cc.h edje_convert.h edje_convert.c edje_convert_main.c edje_data_convert.c +EXTRA_DIST = @EDJE_RECC_PRG@ edje_cc.h edje_convert.h edje_convert.c edje_convert_main.c edje_data_convert.c EXTRA_SCRIPTS = edje_recc diff --git a/src/bin/edje_cc.c b/src/bin/edje_cc.c index 2643ae7..8a8f2f2 100644 --- a/src/bin/edje_cc.c +++ b/src/bin/edje_cc.c @@ -8,10 +8,11 @@ #include #include "edje_cc.h" -#include "edje_prefix.h" int _edje_cc_log_dom = -1; static void main_help(void); +Eina_Prefix *pfx = NULL; + Eina_List *img_dirs = NULL; Eina_List *fnt_dirs = NULL; Eina_List *defines = NULL; @@ -147,7 +148,16 @@ main(int argc, char **argv) exit(-1); } - e_prefix_determine(argv[0]); + pfx = eina_prefix_new(argv[0], /* argv[0] value (optional) */ + main, /* an optional symbol to check path of */ + "EDJE", /* env var prefix to use (XXX_PREFIX, XXX_BIN_DIR etc. */ + "edje", /* dir to add after "share" (PREFIX/share/DIRNAME) */ + "include/edje.inc", /* a magic file to check for in PREFIX/share/DIRNAME for success */ + PACKAGE_BIN_DIR, /* package bin dir @ compile time */ + PACKAGE_LIB_DIR, /* package lib dir @ compile time */ + PACKAGE_DATA_DIR, /* package data dir @ compile time */ + PACKAGE_DATA_DIR /* if locale needed use LOCALE_DIR */ + ); /* check whether file_in exists */ #ifdef HAVE_REALPATH @@ -216,6 +226,9 @@ main(int argc, char **argv) data_process_script_lookups(); data_write(); + eina_prefix_free(pfx); + pfx = NULL; + edje_shutdown(); eina_log_domain_unregister(_edje_cc_log_dom); eina_shutdown(); diff --git a/src/bin/edje_cc.h b/src/bin/edje_cc.h index c767958..181166a 100644 --- a/src/bin/edje_cc.h +++ b/src/bin/edje_cc.h @@ -3,6 +3,8 @@ #include +extern Eina_Prefix *pfx; + /* * On Windows, if the file is not opened in binary mode, * read does not return the correct size, because of @@ -133,6 +135,7 @@ int parse_int_range(int n, int f, int t); int parse_bool(int n); double parse_float(int n); double parse_float_range(int n, double f, double t); +int get_arg_count(void); void check_arg_count(int n); void check_min_arg_count(int n); diff --git a/src/bin/edje_cc_handlers.c b/src/bin/edje_cc_handlers.c index 242d3b1..ca204ae 100644 --- a/src/bin/edje_cc_handlers.c +++ b/src/bin/edje_cc_handlers.c @@ -214,6 +214,7 @@ static void st_collections_group_parts_part_description_box_min(void); static void st_collections_group_parts_part_description_table_homogeneous(void); static void st_collections_group_parts_part_description_table_align(void); static void st_collections_group_parts_part_description_table_padding(void); +static void st_collections_group_parts_part_description_table_min(void); static void st_collections_group_parts_part_description_map_perspective(void); static void st_collections_group_parts_part_description_map_light(void); static void st_collections_group_parts_part_description_map_rotation_center(void); @@ -470,6 +471,7 @@ New_Statement_Handler statement_handlers[] = {"collections.group.parts.part.description.table.homogeneous", st_collections_group_parts_part_description_table_homogeneous}, {"collections.group.parts.part.description.table.align", st_collections_group_parts_part_description_table_align}, {"collections.group.parts.part.description.table.padding", st_collections_group_parts_part_description_table_padding}, + {"collections.group.parts.part.description.table.min", st_collections_group_parts_part_description_table_min}, {"collections.group.parts.part.description.map.perspective", st_collections_group_parts_part_description_map_perspective}, {"collections.group.parts.part.description.map.light", st_collections_group_parts_part_description_map_light}, {"collections.group.parts.part.description.map.rotation.center", st_collections_group_parts_part_description_map_rotation_center}, @@ -2638,6 +2640,7 @@ st_collections_group_parts_part_source6(void) effect @parameters [EFFECT] + (optional) [SHADOW DIRECTION] @effect Causes Edje to draw the selected effect among: @li PLAIN @@ -2650,6 +2653,16 @@ st_collections_group_parts_part_source6(void) @li FAR_SHADOW @li FAR_SOFT_SHADOW @li GLOW + + Shadow directions (default if not given is BOTTOM_RIGHT): + @li BOTTOM_RIGHT + @li BOTTOM + @li BOTTOM_LEFT + @li LEFT + @li TOP_LEFT + @li TOP + @li TOP_RIGHT + @li RIGHT @endproperty */ static void @@ -2658,7 +2671,7 @@ st_collections_group_parts_part_effect(void) Edje_Part_Collection *pc; Edje_Part *ep; - check_arg_count(1); + check_min_arg_count(1); pc = eina_list_data_get(eina_list_last(edje_collections)); ep = pc->parts[pc->parts_count - 1]; @@ -2675,6 +2688,22 @@ st_collections_group_parts_part_effect(void) "FAR_SOFT_SHADOW", EDJE_TEXT_EFFECT_FAR_SOFT_SHADOW, "GLOW", EDJE_TEXT_EFFECT_GLOW, NULL); + if (get_arg_count() >= 2) + { + unsigned char shadow; + + shadow = parse_enum(1, + "BOTTOM_RIGHT", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_RIGHT, + "BOTTOM", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM, + "BOTTOM_LEFT", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_LEFT, + "LEFT", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_LEFT, + "TOP_LEFT", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP_LEFT, + "TOP", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP, + "TOP_RIGHT", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP_RIGHT, + "RIGHT", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_RIGHT, + NULL); + EDJE_TEXT_EFFECT_SHADOW_DIRECTION_SET(ep->effect, shadow); + } } /** @@ -6081,6 +6110,7 @@ st_collections_group_parts_part_description_box_min(void) homogeneous: TABLE; padding: 0 2; align: 0.5 0.5; + min: 0 0; } .. } @@ -6118,6 +6148,16 @@ st_collections_group_parts_part_description_box_min(void) @effect Sets the space between cells in pixels. Defaults to 0 0. @endproperty + + @property + min + @parameters + [horizontal] [vertical] + @effect + When any of the parameters is enabled (1) it forces the minimum size of + the table to be equal to the minimum size of the items. The default + value is "0 0". + @endproperty */ static void st_collections_group_parts_part_description_table_homogeneous(void) { @@ -6200,6 +6240,32 @@ static void st_collections_group_parts_part_description_table_padding(void) ed->table.padding.y = parse_int_range(1, 0, 0x7fffffff); } +static void +st_collections_group_parts_part_description_table_min(void) +{ + Edje_Part_Collection *pc; + Edje_Part *ep; + Edje_Part_Description_Table *ed; + + check_arg_count(2); + + pc = eina_list_data_get(eina_list_last(edje_collections)); + ep = pc->parts[pc->parts_count - 1]; + + if (ep->type != EDJE_PART_TYPE_TABLE) + { + ERR("%s: Error. parse error %s:%i. " + "box attributes in non-TABLE part.", + progname, file_in, line - 1); + exit(-1); + } + + ed = (Edje_Part_Description_Table*) ep->default_desc; + if (ep->other.desc_count) ed = (Edje_Part_Description_Table*) ep->other.desc[ep->other.desc_count - 1]; + + ed->table.min.h = parse_bool(0); + ed->table.min.v = parse_bool(1); +} /** @edcsection{description_map,Map state description sub blocks} @@ -7164,26 +7230,110 @@ st_collections_group_programs_program_action(void) @property transition @parameters - [type] [length] + [type] [length] [[interp val 1]] [[interp val 2]] @effect Defines how transitions occur using STATE_SET action.\n Where 'type' is the style of the transition and 'length' is a double specifying the number of seconds in which to preform the transition.\n - Valid types are: LINEAR, SINUSOIDAL, ACCELERATE, and DECELERATE. + Valid types are: LIN or LINEAR, SIN or SINUSOIDAL, + ACCEL or ACCELERATE, DECEL or DECELERATE, + ACCEL_FAC or ACCELERATE_FACTOR, DECEL_FAC or DECELERATE_FACTOR, + SIN_FAC or SINUSOIDAL_FACTOR, DIVIS or DIVISOR_INTERP, + BOUNCE, SPRING. + + ACCEL_FAC, DECEL_FAC and SIN_FAC need the extra optional + "interp val 1" to determine the "factor" of curviness. 1.0 is the same + as their non-factor counterparts, where 0.0 is equal to linear. + numbers higher than one make the curve angles steeper with a more + prnounced curve point. + + DIVIS, BOUNCE and SPRING also require "interp val 2" in addition + to "interp val 1". + + DIVIS uses val 1 as the initial graident start + (0.0 is horizontal, 1.0 is diagonal (linear), 2.0 is twice the + gradient of linear etc.). val 2 is interpreted as an integer factor + defining how much the value swings "outside" the gradient only to come + back to the final resting spot at the end. 0.0 for val 2 is equivalent + to linear interpolation. Note that DIVIS can exceed 1.0 + + BOUNCE uses val 2 as the number of bounces (so its rounded down to + the nearest integer value), with val 2 determining how much the + bounce decays, with 0.0 giving linear decay per bounce, and higher + values giving much more decay. + + SPRING is similar to bounce, where val 2 specifies the number of + spring "swings" and val 1 specifies the decay, but it can exceed 1.0 + on the outer swings. + @endproperty */ static void st_collections_group_programs_program_transition(void) { - check_arg_count(2); + check_min_arg_count(2); current_program->tween.mode = parse_enum(0, + // short names + "LIN", EDJE_TWEEN_MODE_LINEAR, + "SIN", EDJE_TWEEN_MODE_SINUSOIDAL, + "ACCEL", EDJE_TWEEN_MODE_ACCELERATE, + "DECEL", EDJE_TWEEN_MODE_DECELERATE, + "ACCEL_FAC", EDJE_TWEEN_MODE_ACCELERATE_FACTOR, + "DECEL_FAC", EDJE_TWEEN_MODE_DECELERATE_FACTOR, + "SIN_FAC", EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR, + "DIVIS", EDJE_TWEEN_MODE_DIVISOR_INTERP, + + // long/full names "LINEAR", EDJE_TWEEN_MODE_LINEAR, "SINUSOIDAL", EDJE_TWEEN_MODE_SINUSOIDAL, "ACCELERATE", EDJE_TWEEN_MODE_ACCELERATE, "DECELERATE", EDJE_TWEEN_MODE_DECELERATE, + "ACCELERATE_FACTOR", EDJE_TWEEN_MODE_ACCELERATE_FACTOR, + "DECELERATE_FACTOR", EDJE_TWEEN_MODE_DECELERATE_FACTOR, + "SINUSOIDAL_FACTOR", EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR, + "DIVISOR_INTERP", EDJE_TWEEN_MODE_DIVISOR_INTERP, + + // long/full is short enough + "BOUNCE", EDJE_TWEEN_MODE_BOUNCE, + "SPRING", EDJE_TWEEN_MODE_SPRING, NULL); current_program->tween.time = FROM_DOUBLE(parse_float_range(1, 0.0, 999999999.0)); + // the following need v1 + // EDJE_TWEEN_MODE_ACCELERATE_FACTOR + // EDJE_TWEEN_MODE_DECELERATE_FACTOR + // EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR + // current_program->tween.v1 + if ((current_program->tween.mode >= EDJE_TWEEN_MODE_ACCELERATE_FACTOR) && + (current_program->tween.mode <= EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR)) + { + if (get_arg_count() != 3) + { + ERR("%s: Error. parse error %s:%i. " + "Need 3rd parameter to set factor", + progname, file_in, line - 1); + exit(-1); + } + current_program->tween.v1 = FROM_DOUBLE(parse_float_range(2, 0.0, 999999999.0)); + } + // the followjng also need v2 + // EDJE_TWEEN_MODE_DIVISOR_INTERP + // EDJE_TWEEN_MODE_BOUNCE + // EDJE_TWEEN_MODE_SPRING + // current_program->tween.v2 + else if ((current_program->tween.mode >= EDJE_TWEEN_MODE_DIVISOR_INTERP) && + (current_program->tween.mode <= EDJE_TWEEN_MODE_SPRING)) + { + if (get_arg_count() != 4) + { + ERR("%s: Error. parse error %s:%i. " + "Need 3rd and 4th parameters to set factor and counts", + progname, file_in, line - 1); + exit(-1); + } + current_program->tween.v1 = FROM_DOUBLE(parse_float_range(2, 0.0, 999999999.0)); + current_program->tween.v2 = FROM_DOUBLE(parse_float_range(3, 0.0, 999999999.0)); + } } /** diff --git a/src/bin/edje_cc_mem.c b/src/bin/edje_cc_mem.c index d01d12c..7c1a5c9 100644 --- a/src/bin/edje_cc_mem.c +++ b/src/bin/edje_cc_mem.c @@ -7,6 +7,12 @@ #include "edje_cc.h" +#ifdef _WIN32 +# define FMT_SIZE_T "%Iu" +#else +# define FMT_SIZE_T "%zu" +#endif + void * mem_alloc(size_t size) { @@ -14,7 +20,7 @@ mem_alloc(size_t size) mem = calloc(1, size); if (mem) return mem; - ERR("%s: Error. %s:%i memory allocation of %zi bytes failed. %s", + ERR("%s: Error. %s:%i memory allocation of " FMT_SIZE_T " bytes failed. %s", progname, file_in, line, size, strerror(errno)); exit(-1); return NULL; @@ -27,7 +33,7 @@ mem_strdup(const char *s) str = strdup(s); if (str) return str; - ERR("%s: Error. %s:%i memory allocation of %zi bytes failed. %s. string being duplicated: \"%s\"", + ERR("%s: Error. %s:%i memory allocation of " FMT_SIZE_T " bytes failed. %s. string being duplicated: \"%s\"", progname, file_in, line, strlen(s) + 1, strerror(errno), s); exit(-1); return NULL; diff --git a/src/bin/edje_cc_out.c b/src/bin/edje_cc_out.c index ecaaa40..4f5f3bc 100644 --- a/src/bin/edje_cc_out.c +++ b/src/bin/edje_cc_out.c @@ -27,7 +27,6 @@ void *alloca (size_t); #include #include "edje_cc.h" -#include "edje_prefix.h" #include "edje_convert.h" #include @@ -709,9 +708,9 @@ data_write_groups(Eet_File *ef, int *collection_num) } static void -create_script_file(Eet_File *ef, const char *filename, const Code *cd) +create_script_file(Eet_File *ef, const char *filename, const Code *cd, int fd) { - FILE *f = fopen(filename, "wb"); + FILE *f = fdopen(fd, "wb"); if (!f) error_and_abort(ef, "Unable to open temp file \"%s\" for script " "compilation.\n", filename); @@ -778,7 +777,7 @@ create_script_file(Eet_File *ef, const char *filename, const Code *cd) else if (sp[0] == '\n') hash = 0; } } - fprintf(f, "}"); + fprintf(f, "}\n"); ln += cp->l2 - cp->l1 + 1; } } @@ -788,7 +787,7 @@ create_script_file(Eet_File *ef, const char *filename, const Code *cd) static void compile_script_file(Eet_File *ef, const char *source, const char *output, - int script_num) + int script_num, int fd) { FILE *f; char buf[4096]; @@ -796,14 +795,14 @@ compile_script_file(Eet_File *ef, const char *source, const char *output, snprintf(buf, sizeof(buf), "embryo_cc -i %s/include -o %s %s", - e_prefix_data_get(), output, source); + eina_prefix_data_get(pfx), output, source); ret = system(buf); /* accept warnings in the embryo code */ if (ret < 0 || ret > 1) error_and_abort(ef, "Compiling script code not clean.\n"); - f = fopen(output, "rb"); + f = fdopen(fd, "rb"); if (!f) error_and_abort(ef, "Unable to open script object \"%s\" for reading.\n", output); @@ -862,8 +861,7 @@ data_write_scripts(Eet_File *ef) error_and_abort(ef, "Unable to open temp file \"%s\" for script " "compilation.\n", tmpn); - create_script_file(ef, tmpn, cd); - close(fd); + create_script_file(ef, tmpn, cd, fd); snprintf(tmpo, PATH_MAX, "%s/edje_cc.amx-tmp-XXXXXX", tmp_dir); fd = mkstemp(tmpo); @@ -873,9 +871,7 @@ data_write_scripts(Eet_File *ef) error_and_abort(ef, "Unable to open temp file \"%s\" for script " "compilation.\n", tmpn); } - - compile_script_file(ef, tmpn, tmpo, i); - close(fd); + compile_script_file(ef, tmpn, tmpo, i, fd); unlink(tmpn); unlink(tmpo); diff --git a/src/bin/edje_cc_parse.c b/src/bin/edje_cc_parse.c index 19adf0a..3a12744 100644 --- a/src/bin/edje_cc_parse.c +++ b/src/bin/edje_cc_parse.c @@ -30,7 +30,6 @@ void *alloca (size_t); #include #include "edje_cc.h" -#include "edje_prefix.h" #include #include @@ -85,6 +84,42 @@ static int verbatim_line2 = 0; static char *verbatim_str = NULL; static void +err_show_stack(void) +{ + char *s; + + s = stack_id(); + if (s) + { + printf("PARSE STACK:\n%s\n", s); + free(s); + } + else + printf("NO PARSE STACK\n"); +} + +static void +err_show_params(void) +{ + Eina_List *l; + char *p; + + printf("PARAMS:"); + EINA_LIST_FOREACH(params, l, p) + { + printf(" %s", p); + } + printf("\n"); +} + +static void +err_show(void) +{ + err_show_stack(); + err_show_params(); +} + +static void new_object(void) { char *id; @@ -120,6 +155,7 @@ new_object(void) ERR("%s: Error. %s:%i unhandled keyword %s", progname, file_in, line - 1, (char *)eina_list_data_get(eina_list_last(stack))); + err_show(); exit(-1); } free(id); @@ -150,6 +186,7 @@ new_statement(void) ERR("%s: Error. %s:%i unhandled keyword %s", progname, file_in, line - 1, (char *)eina_list_data_get(eina_list_last(stack))); + err_show(); exit(-1); } free(id); @@ -433,6 +470,7 @@ stack_chop_top(void) { ERR("%s: Error. parse error %s:%i. } marker without matching { marker", progname, file_in, line - 1); + err_show(); exit(-1); } } @@ -461,6 +499,7 @@ parse(char *data, off_t size) { ERR("%s: Error. parse error %s:%i. %c marker before ; marker", progname, file_in, line - 1, *token); + err_show(); exit(-1); } else if (delim) @@ -472,6 +511,7 @@ parse(char *data, off_t size) { ERR("%s: Error. parse error %s:%i. } marker before ; marker", progname, file_in, line - 1); + err_show(); exit(-1); } else @@ -499,6 +539,7 @@ parse(char *data, off_t size) { ERR("%s: Error. parse error %s:%i. { marker before ; marker", progname, file_in, line - 1); + err_show(); exit(-1); } } @@ -582,6 +623,7 @@ parse(char *data, off_t size) { ERR("%s: Error. parse error %s:%i. { marker does not have matching } marker", progname, file_in, line - 1); + err_show(); exit(-1); } new_object(); @@ -666,7 +708,7 @@ compile(void) p = strrchr(inc, '/'); if (!p) strcpy(inc, "./"); else *p = 0; - snprintf (tmpn, PATH_MAX, "%s/edje_cc.edc-tmp-XXXXXX", tmp_dir); + snprintf(tmpn, PATH_MAX, "%s/edje_cc.edc-tmp-XXXXXX", tmp_dir); fd = mkstemp(tmpn); if (fd >= 0) { @@ -700,60 +742,26 @@ compile(void) * Run the input through the C pre-processor. */ ret = -1; - snprintf(buf2, sizeof(buf2), "%s/edje/utils/epp"EPP_EXT, e_prefix_lib_get()); + snprintf(buf2, sizeof(buf2), "%s/edje/utils/epp" EPP_EXT, + eina_prefix_lib_get(pfx)); if (ecore_file_exists(buf2)) { snprintf(buf, sizeof(buf), "%s %s -I%s %s -o %s", buf2, file_in, inc, def, tmpn); ret = system(buf); } - /* - * On OpenSolaris, the default cpp is located in different places. - * Alan Coppersmith told me to do what xorg does: using /usr/ccs/lib/cpp - * - * Also, that preprocessor is not managing C++ comments, so pass the - * sun cc preprocessor just after. - */ - else if (ecore_file_exists("/usr/ccs/lib/cpp")) + else { - snprintf(buf, sizeof(buf), "/usr/ccs/lib/cpp -I%s %s %s %s", - inc, def, file_in, tmpn); - ret = system(buf); - if (ret == 0) - { - static char tmpn2[4096]; - - snprintf (tmpn2, PATH_MAX, "%s/edje_cc.edc-tmp-XXXXXX", tmp_dir); - fd = mkstemp(tmpn2); - if (fd >= 0) - { - close(fd); - snprintf (buf, 4096, "cc -E -I%s %s -o %s %s", - inc, def, tmpn2, tmpn); - ret = system(buf); - snprintf(tmpn, 4096, "%s", tmpn2); - } - } + ERR("Error. Cannot run epp: %s", buf2); + exit(-1); } - - /* Trying gcc and other syntax */ - if (ret != 0) - { - snprintf(buf, sizeof(buf), "%s -I%s %s -E -o %s -std=c99 - < %s", - getenv("CC") ? getenv("CC") : "cc", - inc, def, tmpn, file_in); - ret = system(buf); - } - /* Trying suncc syntax */ - if (ret != 0) - { - snprintf(buf, sizeof(buf), "%s -I%s %s -E -o %s -xc99 - < %s", - getenv("CC") ? getenv("CC") : "cc", - inc, def, tmpn, file_in); - ret = system(buf); - } if (ret == EXIT_SUCCESS) file_in = tmpn; + else + { + ERR("Error. Exit code of epp not clean: %i", ret); + exit(-1); + } free(def); } fd = open(file_in, O_RDONLY | O_BINARY, S_IRUSR | S_IWUSR); @@ -765,15 +773,14 @@ compile(void) } if (verbose) { - INF("%s: Opening \"%s\" for input", - progname, file_in); + INF("%s: Opening \"%s\" for input", progname, file_in); } size = lseek(fd, 0, SEEK_END); lseek(fd, 0, SEEK_SET); data = malloc(size); if (data && (read(fd, data, size) == size)) - parse(data, size); + parse(data, size); else { ERR("%s: Error. cannot read file \"%s\". %s", @@ -784,11 +791,13 @@ compile(void) close(fd); EINA_LIST_FOREACH(edje_file->styles, l, stl) - if (!stl->name) - { - ERR("%s: Error. style must have a name.", progname); - exit(-1); - } + { + if (!stl->name) + { + ERR("%s: Error. style must have a name.", progname); + exit(-1); + } + } } int @@ -813,6 +822,7 @@ is_num(int n) { ERR("%s: Error. %s:%i no parameter supplied as argument %i", progname, file_in, line - 1, n + 1); + err_show(); exit(-1); } if (str[0] == 0) return 0; @@ -837,6 +847,7 @@ parse_str(int n) { ERR("%s: Error. %s:%i no parameter supplied as argument %i", progname, file_in, line - 1, n + 1); + err_show(); exit(-1); } s = mem_strdup(str); @@ -872,6 +883,7 @@ _parse_enum(char *str, va_list va) fprintf(stderr, "\n"); va_end(va2); va_end(va); + err_show(); exit(-1); } @@ -900,6 +912,7 @@ parse_enum(int n, ...) { ERR("%s: Error. %s:%i no parameter supplied as argument %i", progname, file_in, line - 1, n + 1); + err_show(); exit(-1); } @@ -937,6 +950,7 @@ parse_int(int n) { ERR("%s: Error. %s:%i no parameter supplied as argument %i", progname, file_in, line - 1, n + 1); + err_show(); exit(-1); } i = my_atoi(str); @@ -954,6 +968,7 @@ parse_int_range(int n, int f, int t) { ERR("%s: Error. %s:%i no parameter supplied as argument %i", progname, file_in, line - 1, n + 1); + err_show(); exit(-1); } i = my_atoi(str); @@ -961,6 +976,7 @@ parse_int_range(int n, int f, int t) { ERR("%s: Error. %s:%i integer %i out of range of %i to %i inclusive", progname, file_in, line - 1, i, f, t); + err_show(); exit(-1); } return i; @@ -977,6 +993,7 @@ parse_bool(int n) { ERR("%s: Error. %s:%i no parameter supplied as argument %i", progname, file_in, line - 1, n + 1); + err_show(); exit(-1); } @@ -997,6 +1014,7 @@ parse_bool(int n) { ERR("%s: Error. %s:%i integer %i out of range of 0 to 1 inclusive", progname, file_in, line - 1, i); + err_show(); exit(-1); } return i; @@ -1013,6 +1031,7 @@ parse_float(int n) { ERR("%s: Error. %s:%i no parameter supplied as argument %i", progname, file_in, line - 1, n + 1); + err_show(); exit(-1); } i = my_atof(str); @@ -1030,6 +1049,7 @@ parse_float_range(int n, double f, double t) { ERR("%s: Error. %s:%i no parameter supplied as argument %i", progname, file_in, line - 1, n + 1); + err_show(); exit(-1); } i = my_atof(str); @@ -1037,11 +1057,18 @@ parse_float_range(int n, double f, double t) { ERR("%s: Error. %s:%i float %3.3f out of range of %3.3f to %3.3f inclusive", progname, file_in, line - 1, i, f, t); + err_show(); exit(-1); } return i; } +int +get_arg_count(void) +{ + return eina_list_count (params); +} + void check_arg_count(int required_args) { @@ -1049,8 +1076,9 @@ check_arg_count(int required_args) if (num_args != required_args) { - ERR("%s: Error. %s:%i got %i arguments, but expected %i", - progname, file_in, line - 1, num_args, required_args); + ERR("%s: Error. %s:%i got %i arguments, but expected %i", + progname, file_in, line - 1, num_args, required_args); + err_show(); exit(-1); } } @@ -1065,6 +1093,7 @@ check_min_arg_count(int min_required_args) ERR("%s: Error. %s:%i got %i arguments, " "but expected at least %i", progname, file_in, line - 1, num_args, min_required_args); + err_show(); exit(-1); } } diff --git a/src/bin/edje_convert.c b/src/bin/edje_convert.c index 5b05da9..63d11ba 100644 --- a/src/bin/edje_convert.c +++ b/src/bin/edje_convert.c @@ -1,7 +1,6 @@ #include "edje_private.h" #include "edje_cc.h" -#include "edje_prefix.h" #include "edje_convert.h" static const Edje_File *_current_edje_file = NULL; diff --git a/src/bin/edje_convert_main.c b/src/bin/edje_convert_main.c index 0d12976..bc3484d 100644 --- a/src/bin/edje_convert_main.c +++ b/src/bin/edje_convert_main.c @@ -8,7 +8,6 @@ #include #include "edje_cc.h" -#include "edje_prefix.h" #include "edje_convert.h" extern Eet_Data_Descriptor *_edje_edd_old_edje_file; diff --git a/src/bin/edje_inspector.c b/src/bin/edje_inspector.c index 1ab8fd9..f422eba 100644 --- a/src/bin/edje_inspector.c +++ b/src/bin/edje_inspector.c @@ -30,6 +30,12 @@ static int _log_dom; #define FLOAT_PRECISION 0.0001 #define FDIFF(a, b) (fabs((a) - (b)) > FLOAT_PRECISION) +#ifdef _WIN32 +# define FMT_UCHAR "%c" +#else +# define FMT_UCHAR "%hhu" +#endif + /* context */ static Eina_List *groups; static Ecore_Evas *ee; @@ -1572,8 +1578,8 @@ main(int argc, char **argv) file = argv[arg_index]; - DBG("mode=%s, detail=%d(%s), group=%s, part=%s, program=%s, api-only=%hhu, " - "api-fix=%hhu, machine=%hhu, file=%s", + DBG("mode=%s, detail=%d(%s), group=%s, part=%s, program=%s, api-only=" FMT_UCHAR + ", api-fix=" FMT_UCHAR ", machine=" FMT_UCHAR ", file=%s", mode, detail, detail_name, group ? group : "", part ? part : "", diff --git a/src/bin/edje_player.c b/src/bin/edje_player.c index f436ad8..1e861cc 100644 --- a/src/bin/edje_player.c +++ b/src/bin/edje_player.c @@ -20,6 +20,12 @@ #include #include +#ifdef _WIN32 +# define FMT_UCHAR "%c" +#else +# define FMT_UCHAR "%hhu" +#endif + struct opts { char *file; char *group; @@ -548,7 +554,7 @@ static unsigned char _parse_color(__UNUSED__ const Ecore_Getopt *parser, __UNUSE { unsigned char *color = (unsigned char *)storage->ptrp; - if (sscanf(str, "%hhu,%hhu,%hhu", color, color + 1, color + 2) != 3) + if (sscanf(str, FMT_UCHAR "," FMT_UCHAR "," FMT_UCHAR, color, color + 1, color + 2) != 3) { fprintf(stderr, "ERROR: incorrect color value '%s'\n", str); return 0; diff --git a/src/bin/edje_prefix.c b/src/bin/edje_prefix.c deleted file mode 100644 index 9c27e90..0000000 --- a/src/bin/edje_prefix.c +++ /dev/null @@ -1,448 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef HAVE_EVIL -# include -#endif - -#include "edje_prefix.h" -#include "edje_cc.h" -#ifdef _WIN32 -# define EDJE_DIR_SEPARATOR '\\' -# define EDJE_DIR_SEPARATOR_S "\\" -#else -# define EDJE_DIR_SEPARATOR '/' -# define EDJE_DIR_SEPARATOR_S "/" -#endif /* _WIN32 */ - -/* local subsystem functions */ -static int _e_prefix_share_hunt(void); -static int _e_prefix_fallbacks(void); -static int _e_prefix_try_proc(void); -static int _e_prefix_try_argv(char *argv0); - -/* local subsystem globals */ -static char *_exe_path = NULL; -static char *_prefix_path = NULL; -static char *_prefix_path_bin = NULL; -static char *_prefix_path_data = NULL; -static char *_prefix_path_lib = NULL; - -#define E_FREE(p) { if (p) {free(p); p = NULL;} } - -/*#define PREFIX_CACHE_FILE 1*/ -#define SHARE_D "share/edje" -#define MAGIC_FILE "include/edje.inc" -#define MAGIC_DAT SHARE_D"/"MAGIC_FILE - -/* externally accessible functions */ -int -e_prefix_determine(char *argv0) -{ - char *p, buf[4096]; - struct stat st; - - e_prefix_shutdown(); - - /* if user provides E_PREFIX - then use that or also more specific sub - * dirs for bin, lib, data and locale */ - if (getenv("EDJE_PREFIX")) - { - _prefix_path = strdup(getenv("EDJE_PREFIX")); - if (getenv("EDJE_BIN_DIR")) - snprintf(buf, sizeof(buf), "%s" EDJE_DIR_SEPARATOR_S "bin", getenv("EDJE_BIN_DIR")); - else - snprintf(buf, sizeof(buf), "%s" EDJE_DIR_SEPARATOR_S "bin", _prefix_path); - _prefix_path_bin = strdup(buf); - - if (getenv("EDJE_LIB_DIR")) - snprintf(buf, sizeof(buf), "%s" EDJE_DIR_SEPARATOR_S "lib", getenv("EDJE_LIB_DIR")); - else - snprintf(buf, sizeof(buf), "%s" EDJE_DIR_SEPARATOR_S "lib", _prefix_path); - _prefix_path_lib = strdup(buf); - - if (getenv("EDJE_DATA_DIR")) - snprintf(buf, sizeof(buf), "%s" EDJE_DIR_SEPARATOR_S SHARE_D, getenv("EDJE_DATA_DIR")); - else - snprintf(buf, sizeof(buf), "%s" EDJE_DIR_SEPARATOR_S SHARE_D, _prefix_path); - _prefix_path_data = strdup(buf); - return 1; - } - /* no env var - examine process and possible argv0 */ - if (!_e_prefix_try_proc()) - { - if (!_e_prefix_try_argv(argv0)) - { - _e_prefix_fallbacks(); - return 0; - } - } - /* _exe_path is now a full absolute path TO this exe - figure out rest */ - /* if - * exe = /blah/whatever/bin/exe - * then - * prefix = /blah/whatever - * bin_dir = /blah/whatever/bin - * data_dir = /blah/whatever/share/enlightenment - * lib_dir = /blah/whatever/lib - */ - p = strrchr(_exe_path, EDJE_DIR_SEPARATOR); - if (p) - { - p--; - while (p >= _exe_path) - { - if (*p == EDJE_DIR_SEPARATOR) - { - _prefix_path = malloc(p - _exe_path + 1); - if (_prefix_path) - { - strncpy(_prefix_path, _exe_path, p - _exe_path); - _prefix_path[p - _exe_path] = 0; - - /* bin and lib always together */ - snprintf(buf, sizeof(buf), "%s" EDJE_DIR_SEPARATOR_S "bin", _prefix_path); - _prefix_path_bin = strdup(buf); - snprintf(buf, sizeof(buf), "%s" EDJE_DIR_SEPARATOR_S "lib", _prefix_path); - _prefix_path_lib = strdup(buf); - - /* check if AUTHORS file is there - then our guess is right */ - snprintf(buf, sizeof(buf), "%s" EDJE_DIR_SEPARATOR_S MAGIC_DAT, _prefix_path); - if (stat(buf, &st) == 0) - { - snprintf(buf, sizeof(buf), "%s" EDJE_DIR_SEPARATOR_S SHARE_D, _prefix_path); - _prefix_path_data = strdup(buf); - } - /* AUTHORS file not there. time to start hunting! */ - else - { - if (_e_prefix_share_hunt()) - { - return 1; - } - else - { - e_prefix_fallback(); - return 0; - } - } - return 1; - } - else - { - e_prefix_fallback(); - return 0; - } - } - p--; - } - } - e_prefix_fallback(); - return 0; -} - -void -e_prefix_shutdown(void) -{ - E_FREE(_exe_path); - E_FREE(_prefix_path); - E_FREE(_prefix_path_bin); - E_FREE(_prefix_path_data); - E_FREE(_prefix_path_lib); -} - -void -e_prefix_fallback(void) -{ - e_prefix_shutdown(); - _e_prefix_fallbacks(); -} - -const char * -e_prefix_get(void) -{ - return _prefix_path; -} - -const char * -e_prefix_bin_get(void) -{ - return _prefix_path_bin; -} - -const char * -e_prefix_data_get(void) -{ - return _prefix_path_data; -} - -const char * -e_prefix_lib_get(void) -{ - return _prefix_path_lib; -} - -/* local subsystem functions */ -static int -_e_prefix_share_hunt(void) -{ - char buf[4096], buf2[4096], *p; - struct stat st; - - /* sometimes this isn't the case - so we need to do a more exhaustive search - * through more parent and subdirs. hre is an example i have seen: - * - * /blah/whatever/exec/bin/exe - * -> - * /blah/whatever/exec/bin - * /blah/whatever/common/share/enlightenment - * /blah/whatever/exec/lib - */ - - /* this is pure black magic to try and find data shares */ - /* 2. cache file doesn't exist or is invalid - we need to search - this is - * where the real black magic begins */ - - /* BLACK MAGIC 1: - * /blah/whatever/dir1/bin - * /blah/whatever/dir2/share/enlightenment - */ - if (!_prefix_path_data) - { - DIR *dirp; - struct dirent *dp; - - snprintf(buf, sizeof(buf), "%s", _prefix_path); - p = strrchr(buf, '/'); - if (p) *p = 0; - dirp = opendir(buf); - if (dirp) - { - char *file; - - while ((dp = readdir(dirp))) - { - if ((strcmp(dp->d_name, ".")) && (strcmp(dp->d_name, ".."))) - { - file = dp->d_name; - snprintf(buf2, sizeof(buf2), "%s/%s/"MAGIC_DAT, buf, file); - if (stat(buf2, &st) == 0) - { - snprintf(buf2, sizeof(buf2), "%s/%s/"SHARE_D, buf, file); - _prefix_path_data = strdup(buf2); - break; - } - } - } - closedir(dirp); - } - } - - /* BLACK MAGIC 2: - * /blah/whatever/dir1/bin - * /blah/whatever/share/enlightenment - */ - if (!_prefix_path_data) - { - snprintf(buf, sizeof(buf), "%s", _prefix_path); - p = strrchr(buf, '/'); - if (p) *p = 0; - snprintf(buf2, sizeof(buf2), "%s/"MAGIC_DAT, buf); - if (stat(buf, &st) == 0) - { - snprintf(buf2, sizeof(buf2), "%s/"SHARE_D, buf); - _prefix_path_data = strdup(buf2); - } - } - - /* add more black magic as required as we discover weridnesss - remember - * this is to save users having to set environment variables to tell - * e where it lives, so e auto-adapts. so these code snippets are just - * logic to figure that out for the user - */ - - /* done. we found it - write cache file */ - if (_prefix_path_data) - { - return 1; - } - /* fail. everything failed */ - return 0; -} - -static int -_e_prefix_fallbacks(void) -{ - char *p; - - _prefix_path = strdup(PACKAGE_BIN_DIR); - p = strrchr(_prefix_path, '/'); - if (p) *p = 0; - _prefix_path_bin = strdup(PACKAGE_BIN_DIR); - _prefix_path_data = strdup(PACKAGE_DATA_DIR); - _prefix_path_lib = strdup(PACKAGE_LIB_DIR); - WRN("WARNING: Edje could not determine its installed prefix\n" - " and is falling back on the compiled in default:\n" - " %s\n" - " You might like to try setting the following environment variables:\n" - " EDJE_PREFIX - points to the base prefix of install\n" - " EDJE_BIN_DIR - optional in addition to E_PREFIX to provide\n" - " a more specific binary directory\n" - " EDJE_LIB_DIR - optional in addition to E_PREFIX to provide\n" - " a more specific library dir\n" - " EDJE_DATA_DIR- optional in addition to E_PREFIX to provide\n" - " a more specific location for shared data", - _prefix_path); - return 1; -} - -static int -_e_prefix_try_proc(void) -{ - FILE *f; - char buf[4096]; - void *func = NULL; - - func = (void *)_e_prefix_try_proc; - f = fopen("/proc/self/maps", "rb"); - if (!f) return 0; - while (fgets(buf, sizeof(buf), f)) - { - int len; - char *p, mode[5] = ""; - unsigned long ptr1 = 0, ptr2 = 0; - - len = strlen(buf); - if (buf[len - 1] == '\n') - { - buf[len - 1] = 0; - len--; - } - if (sscanf(buf, "%lx-%lx %4s", &ptr1, &ptr2, mode) == 3) - { - if (!strcmp(mode, "r-xp")) - { - if (((void *)ptr1 <= func) && (func < (void *)ptr2)) - { - p = strchr(buf, '/'); - if (p) - { - if (len > 10) - { - if (!strcmp(buf + len - 10, " (deleted)")) - buf[len - 10] = 0; - } - _exe_path = strdup(p); - fclose(f); - return 1; - } - else - break; - } - } - } - } - fclose(f); - return 0; -} - -static int -_e_prefix_try_argv(char *argv0) -{ - char *path, *p, *cp, *s; - int len, lenexe; - char buf[4096], buf2[4096], buf3[4096]; - - /* 1. is argv0 abs path? */ -#ifdef _WIN32 - if (argv0[1] == ':') -#else - if (argv0[0] == '/') -#endif - { - _exe_path = strdup(argv0); - if (access(_exe_path, X_OK) == 0) return 1; - free(_exe_path); - _exe_path = NULL; - return 0; - } - /* 2. relative path */ - if (strchr(argv0, '/')) - { - if (getcwd(buf3, sizeof(buf3))) - { - snprintf(buf2, sizeof(buf2), "%s/%s", buf3, argv0); - if (realpath(buf2, buf)) - { - _exe_path = strdup(buf); - if (access(_exe_path, X_OK) == 0) return 1; - free(_exe_path); - _exe_path = NULL; - } - } - } - /* 3. argv0 no path - look in PATH */ - path = getenv("PATH"); - if (!path) return 0; - p = path; - cp = p; - lenexe = strlen(argv0); - while ((p = strchr(cp, ':'))) - { - len = p - cp; - s = malloc(len + 1 + lenexe + 1); - if (s) - { - strncpy(s, cp, len); - s[len] = '/'; - strcpy(s + len + 1, argv0); - if (realpath(s, buf)) - { - if (access(buf, X_OK) == 0) - { - _exe_path = strdup(buf); - free(s); - return 1; - } - } - free(s); - } - cp = p + 1; - } - len = strlen(cp); - s = malloc(len + 1 + lenexe + 1); - if (s) - { - strncpy(s, cp, len); - s[len] = '/'; - strcpy(s + len + 1, argv0); - if (realpath(s, buf)) - { - if (access(buf, X_OK) == 0) - { - _exe_path = strdup(buf); - free(s); - return 1; - } - } - free(s); - } - /* 4. big problems. arg[0] != executable - weird execution */ - return 0; -} diff --git a/src/bin/edje_prefix.h b/src/bin/edje_prefix.h deleted file mode 100644 index c452f6c..0000000 --- a/src/bin/edje_prefix.h +++ /dev/null @@ -1,7 +0,0 @@ -int e_prefix_determine(char *argv0); -void e_prefix_shutdown(void); -void e_prefix_fallback(void); -const char *e_prefix_get(void); -const char *e_prefix_bin_get(void); -const char *e_prefix_data_get(void); -const char *e_prefix_lib_get(void); diff --git a/src/bin/epp/cpplib.c b/src/bin/epp/cpplib.c index ae458bc..c134cba 100644 --- a/src/bin/epp/cpplib.c +++ b/src/bin/epp/cpplib.c @@ -983,7 +983,9 @@ cpp_skip_hspace(cpp_reader * pfile) } else if (c == '@' && CPP_BUFFER(pfile)->has_escapes && is_hor_space[PEEKN(1)]) - FORWARD(1); + { + FORWARD(1); + } else return; } @@ -1102,8 +1104,7 @@ handle_directive(cpp_reader * pfile) { /* Nonzero means do not delete comments within the directive. * #define needs this when -traditional. */ - int comments = CPP_TRADITIONAL(pfile) - && kt->traditional_comments; + int comments = 0; int save_put_out_comments = CPP_OPTIONS(pfile)->put_out_comments; @@ -1267,116 +1268,68 @@ collect_expansion(cpp_reader * pfile, unsigned char *buf, unsigned char *limit, *exp_p++ = c; - if (!CPP_TRADITIONAL(pfile)) - { - switch (c) - { - case '\'': - case '\"': - if (expected_delimiter != '\0') - { - if (c == expected_delimiter) - expected_delimiter = '\0'; - } - else - expected_delimiter = c; - break; - - case '\\': - if (p < limit && expected_delimiter) - { - /* In a string, backslash goes through - * and makes next char ordinary. */ - *exp_p++ = *p++; - } - break; - - case '@': - /* An '@' in a string or character constant stands for itself, - * and does not need to be escaped. */ - if (!expected_delimiter) - *exp_p++ = c; - break; - - case '#': - /* # is ordinary inside a string. */ - if (expected_delimiter) - break; - if (p < limit && *p == '#') - { - /* ##: concatenate preceding and following tokens. */ - /* Take out the first #, discard preceding whitespace. */ - exp_p--; - while (exp_p > lastp && is_hor_space[exp_p[-1]]) - --exp_p; - /* Skip the second #. */ - p++; - /* Discard following whitespace. */ - SKIP_WHITE_SPACE(p); - concat = p; - if (p == limit) - cpp_error(pfile, "`##' at end of macro definition"); - } - else if (nargs >= 0) - { - /* Single #: stringify following argument ref. - * Don't leave the # in the expansion. */ - exp_p--; - SKIP_WHITE_SPACE(p); - if (p == limit || !is_idstart[*p]) - cpp_error(pfile, - "`#' operator is not followed by a macro argument name"); - else - stringify = p; - } - break; - } - } - else - { - /* In -traditional mode, recognize arguments inside strings and - * and character constants, and ignore special properties of #. - * Arguments inside strings are considered "stringified", but no - * extra quote marks are supplied. */ - switch (c) - { - case '\'': - case '\"': - if (expected_delimiter != '\0') - { - if (c == expected_delimiter) - expected_delimiter = '\0'; - } - else - expected_delimiter = c; - break; - - case '\\': - /* Backslash quotes delimiters and itself, but not macro args. */ - if (expected_delimiter != 0 && p < limit - && (*p == expected_delimiter || *p == '\\')) - { - *exp_p++ = *p++; - continue; - } - break; - - case '/': - if (expected_delimiter != '\0') /* No comments inside strings. */ - break; - if (*p == '*') - { - /* If we find a comment that wasn't removed by handle_directive, - * this must be -traditional. So replace the comment with - * nothing at all. */ - exp_p--; - p += 1; - while (p < limit && !(p[-2] == '*' && p[-1] == '/')) - p++; - } - break; - } - } + switch (c) + { + case '\'': + case '\"': + if (expected_delimiter != '\0') + { + if (c == expected_delimiter) + expected_delimiter = '\0'; + } + else + expected_delimiter = c; + break; + + case '\\': + if (p < limit && expected_delimiter) + { + /* In a string, backslash goes through + * and makes next char ordinary. */ + *exp_p++ = *p++; + } + break; + + case '@': + /* An '@' in a string or character constant stands for itself, + * and does not need to be escaped. */ + if (!expected_delimiter) + *exp_p++ = c; + break; + + case '#': + /* # is ordinary inside a string. */ + if (expected_delimiter) + break; + if (p < limit && *p == '#') + { + /* ##: concatenate preceding and following tokens. */ + /* Take out the first #, discard preceding whitespace. */ + exp_p--; + while (exp_p > lastp && is_hor_space[exp_p[-1]]) + --exp_p; + /* Skip the second #. */ + p++; + /* Discard following whitespace. */ + SKIP_WHITE_SPACE(p); + concat = p; + if (p == limit) + cpp_error(pfile, "`##' at end of macro definition"); + } + else if (nargs >= 0) + { + /* Single #: stringify following argument ref. + * Don't leave the # in the expansion. */ + exp_p--; + SKIP_WHITE_SPACE(p); + if (p == limit || !is_idstart[*p]) + cpp_error(pfile, + "`#' operator is not followed by a macro argument name"); + else + stringify = p; + } + break; + } /* Handle the start of a symbol. */ if (is_idchar[c] && nargs > 0) @@ -1405,21 +1358,12 @@ collect_expansion(cpp_reader * pfile, unsigned char *buf, unsigned char *limit, if (expected_delimiter && CPP_OPTIONS(pfile)->warn_stringify) { - if (CPP_TRADITIONAL(pfile)) - { - cpp_warning(pfile, - "macro argument `%.*s' is stringified.", - id_len, arg->name); - } - else - { - cpp_warning(pfile, - "macro arg `%.*s' would be stringified with -traditional.", - id_len, arg->name); - } + cpp_warning(pfile, + "macro arg `%.*s' would be stringified with -traditional.", + id_len, arg->name); } /* If ANSI, don't actually substitute inside a string. */ - if (!CPP_TRADITIONAL(pfile) && expected_delimiter) + if (expected_delimiter) break; /* make a pat node for this arg and append it to the end of * the pat list */ @@ -1429,9 +1373,7 @@ collect_expansion(cpp_reader * pfile, unsigned char *buf, unsigned char *limit, tpat->raw_before = concat == id_beg; tpat->raw_after = 0; tpat->rest_args = arg->rest_args; - tpat->stringify = (CPP_TRADITIONAL(pfile) - ? expected_delimiter != '\0' - : stringify == id_beg); + tpat->stringify = (stringify == id_beg); if (!endpat) defn->pattern = tpat; @@ -1470,7 +1412,7 @@ collect_expansion(cpp_reader * pfile, unsigned char *buf, unsigned char *limit, } } - if (!CPP_TRADITIONAL(pfile) && expected_delimiter == 0) + if (expected_delimiter == 0) { /* If ANSI, put in a "@ " marker to prevent token pasting. * But not if "inside a string" (which in ANSI mode @@ -2030,11 +1972,35 @@ cpp_expand_to_buffer(cpp_reader * pfile, unsigned char *buf, int length) { unsigned char *p1 = buf; unsigned char *p2 = buf1; - + int in_string = 0; + +#if 0 /* old behavior */ + while (p1 != limit) *p2++ = *p1++; +#else /* new one - handle \ escapes if not in string */ while (p1 != limit) - *p2++ = *p1++; + { + if (!in_string) + { + if (*p1 == '"') in_string = 1; + if (*p1 == '\\') + { + p1++; + if (p1 != limit) *p2++ = *p1++; + } + else + *p2++ = *p1++; + } + else + { + if ((*p1 == '"') && (p1 > buf) && (p1[-1] != '\\')) + in_string = 0; + *p2++ = *p1++; + } + } +#endif + *p2 = 0; + length = p2 - buf1; } - buf1[length] = 0; ip = cpp_push_buffer(pfile, buf1, length); ip->has_escapes = 1; @@ -2518,8 +2484,7 @@ initialize_builtins(cpp_reader * pfile) install("__USER_LABEL_PREFIX__", -1, T_USER_LABEL_PREFIX_TYPE, 0, 0, -1); install("__REGISTER_PREFIX__", -1, T_REGISTER_PREFIX_TYPE, 0, 0, -1); install("__TIME__", -1, T_TIME, 0, 0, -1); - if (!CPP_TRADITIONAL(pfile)) - install("__STDC__", -1, T_CONST, STDC_VALUE, 0, -1); + install("__STDC__", -1, T_CONST, STDC_VALUE, 0, -1); if (CPP_OPTIONS(pfile)->objc) install("__OBJC__", -1, T_CONST, 1, 0, -1); /* This is supplied using a -D by the compiler driver @@ -2577,20 +2542,10 @@ initialize_builtins(cpp_reader * pfile) pass_thru_directive(directive, &directive[strlen(directive)], pfile, dp); - if (!CPP_TRADITIONAL(pfile)) - { - sprintf(directive, " __STDC__ 1"); - output_line_command(pfile, 0, same_file); - pass_thru_directive(directive, &directive[strlen(directive)], - pfile, dp); - } - if (CPP_OPTIONS(pfile)->objc) - { - sprintf(directive, " __OBJC__ 1"); - output_line_command(pfile, 0, same_file); - pass_thru_directive(directive, &directive[strlen(directive)], - pfile, dp); - } + sprintf(directive, " __STDC__ 1"); + output_line_command(pfile, 0, same_file); + pass_thru_directive(directive, &directive[strlen(directive)], + pfile, dp); } } @@ -2600,14 +2555,14 @@ initialize_builtins(cpp_reader * pfile) static int unsafe_chars(int c1, int c2) { +// printf("unsafe %c %c ...", c1, c2); switch (c1) { case '+': case '-': - if (c2 == c1 || c2 == '=') - return 1; - goto letter; case '.': +// printf(" no0\n"); + return 0; case '0': case '1': case '2': @@ -2621,11 +2576,17 @@ unsafe_chars(int c1, int c2) case 'e': case 'E': if (c2 == '-' || c2 == '+') - return 1; /* could extend a pre-processing number */ + { +// printf(" yes2\n"); + return 1; /* could extend a pre-processing number */ + } goto letter; case 'L': if (c2 == '\'' || c2 == '\"') - return 1; /* Could turn into L"xxx" or L'xxx'. */ + { +// printf(" yes3\n"); + return 1; /* Could turn into L"xxx" or L'xxx'. */ + } goto letter; letter: case '_': @@ -2679,7 +2640,16 @@ unsafe_chars(int c1, int c2) case 'Y': case 'Z': /* We're in the middle of either a name or a pre-processing number. */ - return (is_idchar[c2] || c2 == '.'); + if (is_idchar[c2] || c2 == '.') + { +// printf(" yes4 %i %i\n", is_idchar[c2], c2 == '.'); + return 1; + } + else + { +// printf(" no5\n"); + return 0; + } case '<': case '>': case '!': @@ -2692,8 +2662,18 @@ unsafe_chars(int c1, int c2) case '*': case '/': case '=': - return (c2 == c1 || c2 == '='); - } + if (c2 == c1 || c2 == '=') + { +// printf(" yes6\n"); + return 1; + } + else + { +// printf(" no7\n"); + return 0; + } + } +// printf(" no8\n"); return 0; } @@ -2814,10 +2794,7 @@ macroexpand(cpp_reader * pfile, HASHNODE * hp) } else if (i < nargs) { - /* traditional C allows foo() if foo wants one argument. */ - if (nargs == 1 && i == 0 && CPP_TRADITIONAL(pfile)); - /* the rest args token is allowed to absorb 0 tokens */ - else if (i == nargs - 1 && defn->rest_args) + if (i == nargs - 1 && defn->rest_args) rest_zero = 1; else if (i == 0) cpp_error(pfile, "macro `%s' used without args", hp->name); @@ -2874,8 +2851,7 @@ macroexpand(cpp_reader * pfile, HASHNODE * hp) i = 0; arg->stringified = CPP_WRITTEN(pfile); - if (!CPP_TRADITIONAL(pfile)) - CPP_PUTC(pfile, '\"'); /* insert beginning quote */ + CPP_PUTC(pfile, '\"'); /* insert beginning quote */ for (; i < arglen; i++) { c = (ARG_BASE + arg->raw)[i]; @@ -2929,17 +2905,18 @@ macroexpand(cpp_reader * pfile, HASHNODE * hp) CPP_ADJUST_WRITTEN(pfile, 4); } } - if (!CPP_TRADITIONAL(pfile)) - CPP_PUTC(pfile, '\"'); /* insert ending quote */ + CPP_PUTC(pfile, '\"'); /* insert ending quote */ arg->stringified_length = CPP_WRITTEN(pfile) - arg->stringified; } xbuf_len += args[ap->argno].stringified_length; } - else if (ap->raw_before || ap->raw_after || CPP_TRADITIONAL(pfile)) - /* Add 4 for two newline-space markers to prevent - * token concatenation. */ - xbuf_len += args[ap->argno].raw_length + 4; + else if (ap->raw_before || ap->raw_after) + { + /* Add 4 for two newline-space markers to prevent + * token concatenation. */ + xbuf_len += args[ap->argno].raw_length + 4; + } else { /* We have an ordinary (expanded) occurrence of the arg. @@ -3000,7 +2977,7 @@ macroexpand(cpp_reader * pfile, HASHNODE * hp) arg->stringified_length); totlen += arg->stringified_length; } - else if (ap->raw_before || ap->raw_after || CPP_TRADITIONAL(pfile)) + else if (ap->raw_before || ap->raw_after) { unsigned char *p1 = ARG_BASE + arg->raw; unsigned char *l1 = p1 + arg->raw_length; @@ -3047,7 +3024,6 @@ macroexpand(cpp_reader * pfile, HASHNODE * hp) unsigned char *expanded = ARG_BASE + arg->expanded; if (!ap->raw_before && totlen > 0 && arg->expand_length - && !CPP_TRADITIONAL(pfile) && unsafe_chars(xbuf[totlen - 1], expanded[0])) { xbuf[totlen++] = '@'; @@ -3057,7 +3033,6 @@ macroexpand(cpp_reader * pfile, HASHNODE * hp) totlen += arg->expand_length; if (!ap->raw_after && totlen > 0 && offset < defn->length - && !CPP_TRADITIONAL(pfile) && unsafe_chars(xbuf[totlen - 1], exp[offset])) { xbuf[totlen++] = '@'; @@ -3111,8 +3086,7 @@ macroexpand(cpp_reader * pfile, HASHNODE * hp) * #define foo(x,y) bar (x (y,0), y) * foo (foo, baz) */ - if (!CPP_TRADITIONAL(pfile)) - hp->type = T_DISABLED; + hp->type = T_DISABLED; } static void @@ -4151,6 +4125,7 @@ do_xifdef(cpp_reader * pfile, struct directive *keyword, int start_of_file = 0; unsigned char *control_macro = 0; int old_written = CPP_WRITTEN(pfile); + int c; /* Detect a #ifndef at start of file (not counting comments). */ if (ip->fname != 0 && keyword->type == T_IFNDEF) @@ -4167,8 +4142,7 @@ do_xifdef(cpp_reader * pfile, struct directive *keyword, if (token == CPP_VSPACE || token == CPP_POP || token == CPP_EOF) { skip = (keyword->type == T_IFDEF); - if (!CPP_TRADITIONAL(pfile)) - cpp_pedwarn(pfile, "`#%s' with no argument", keyword->name); + cpp_pedwarn(pfile, "`#%s' with no argument", keyword->name); } else if (token == CPP_NAME) { @@ -4184,20 +4158,14 @@ do_xifdef(cpp_reader * pfile, struct directive *keyword, else { skip = (keyword->type == T_IFDEF); - if (!CPP_TRADITIONAL(pfile)) - cpp_error(pfile, "`#%s' with invalid argument", keyword->name); + cpp_error(pfile, "`#%s' with invalid argument", keyword->name); } - if (!CPP_TRADITIONAL(pfile)) - { - int c; - - cpp_skip_hspace(pfile); - c = PEEKC(); - if (c != EOF && c != '\n') - cpp_pedwarn(pfile, "garbage at end of `#%s' argument", - keyword->name); - } + cpp_skip_hspace(pfile); + c = PEEKC(); + if (c != EOF && c != '\n') + cpp_pedwarn(pfile, "garbage at end of `#%s' argument", + keyword->name); skip_rest_of_line(pfile); conditional_skip(pfile, skip, T_IF, control_macro); @@ -4271,8 +4239,7 @@ skip_if_group(cpp_reader * pfile, int any) CPP_PUTS(pfile, start_line, pbuf->cur - start_line); } parse_move_mark(&line_start_mark, pfile); - if (!CPP_TRADITIONAL(pfile)) - cpp_skip_hspace(pfile); + cpp_skip_hspace(pfile); c = GETC(); if (c == '#') { @@ -4537,7 +4504,7 @@ cpp_get_token(cpp_reader * pfile) { int c, c2, c3; long old_written = 0; - long start_line, start_column; + long start_line = 0, start_column = 0; enum cpp_token token; struct cpp_options *opts = CPP_OPTIONS(pfile); @@ -4617,18 +4584,6 @@ cpp_get_token(cpp_reader * pfile) parse_clear_mark(&start_mark); return CPP_COMMENT; } - else if (CPP_TRADITIONAL(pfile)) - { - if (newlines > 0) - { - output_line_command(pfile, 0, same_file); - return CPP_VSPACE; - } - else - { - return CPP_COMMENT; - } - } else if (newlines > 0) { output_line_command(pfile, 0, same_file); @@ -4680,18 +4635,15 @@ cpp_get_token(cpp_reader * pfile) CPP_BUFFER(pfile) = next_buf; continue; } - if (!CPP_TRADITIONAL(pfile)) - { - cpp_error_with_line(pfile, start_line, start_column, - "unterminated string or character constant"); - if (pfile->multiline_string_line != start_line - && pfile->multiline_string_line != 0) - cpp_error_with_line(pfile, - pfile->multiline_string_line, - -1, - "possible real start of unterminated constant"); - pfile->multiline_string_line = 0; - } + cpp_error_with_line(pfile, start_line, start_column, + "unterminated string or character constant"); + if (pfile->multiline_string_line != start_line + && pfile->multiline_string_line != 0) + cpp_error_with_line(pfile, + pfile->multiline_string_line, + -1, + "possible real start of unterminated constant"); + pfile->multiline_string_line = 0; break; } CPP_PUTC(pfile, cc); @@ -4700,8 +4652,6 @@ cpp_get_token(cpp_reader * pfile) case '\n': /* Traditionally, end of line ends a string constant with * no error. So exit the loop and record the new line. */ - if (CPP_TRADITIONAL(pfile)) - goto while2end; if (c == '\'') { cpp_error_with_line(pfile, start_line, start_column, @@ -4850,17 +4800,23 @@ cpp_get_token(cpp_reader * pfile) if (CPP_BUFFER(pfile)->has_escapes) { c = GETC(); - if (c == '-') + // fix macro expansions starting with - losing the - + if (c == '-') { -#if 1 // fix macro expansions starting with - losing the - CPP_PUTS(pfile, "-", 1); return CPP_OTHER; -#else - if (pfile->output_escapes) - CPP_PUTS(pfile, "@-", 2); - parse_name(pfile, GETC()); - return CPP_NAME; -#endif + } + // fix macro expansions starting with - losing the + + else if (c == '+') + { + CPP_PUTS(pfile, "+", 1); + return CPP_OTHER; + } + // fix macro expansions starting with - losing the . + else if (c == '.') + { + CPP_PUTS(pfile, ".", 1); + return CPP_OTHER; } else if (is_space[c]) { @@ -4914,7 +4870,7 @@ cpp_get_token(cpp_reader * pfile) case 'L': NEWLINE_FIX; c2 = PEEKC(); - if ((c2 == '\'' || c2 == '\"') && !CPP_TRADITIONAL(pfile)) + if ((c2 == '\'' || c2 == '\"')) { CPP_PUTC(pfile, c); c = GETC(); @@ -5564,6 +5520,32 @@ open_include_file(cpp_reader * pfile __UNUSED__, char *filename, #endif /* USE_FILE_NAME_MAPS */ +static int +dos2unix(cpp_buffer *fp, int length) +{ + unsigned char *tbuf; + int nlen = 0, i; + + tbuf = xmalloc(length + 4); + if (!tbuf) return length; + for (i = 0; i < length; i++) + { + if ((fp->buf[i] == '\r') && + (fp->buf[i + 1] == '\n')) + { + // skip \r in \r\n + continue; + } + tbuf[nlen] = fp->buf[i]; + nlen++; + } + tbuf[nlen] = 0; + + free(fp->buf); + fp->buf = tbuf; + return nlen; +} + /* Process the contents of include file FNAME, already open on descriptor F, * with output to OP. * SYSTEM_HEADER_P is 1 if this file resides in any one of the known @@ -5603,12 +5585,13 @@ finclude(cpp_reader * pfile, int f, const char *fname, int system_header_p, if (S_ISREG(st_mode)) { fp->buf = (unsigned char *)xmalloc(st_size + 2); - fp->alimit = fp->buf + st_size + 2; - fp->cur = fp->buf; - /* Read the file contents, knowing that st_size is an upper bound * on the number of bytes we can read. */ length = safe_read(f, (char *)fp->buf, st_size); + length = dos2unix(fp, length); + + fp->alimit = fp->buf + st_size + 2; + fp->cur = fp->buf; fp->rlimit = fp->buf + length; if (length < 0) goto nope; @@ -5642,7 +5625,8 @@ finclude(cpp_reader * pfile, int f, const char *fname, int system_header_p, fp->buf = (unsigned char *)xrealloc(fp->buf, bsize + 2); } length = st_size; - } + length = dos2unix(fp, length); + } if ((length > 0 && fp->buf[length - 1] != '\n') /* Backslash-newline at end is not good enough. */ @@ -5651,6 +5635,7 @@ finclude(cpp_reader * pfile, int f, const char *fname, int system_header_p, fp->buf[length++] = '\n'; } fp->buf[length] = '\0'; + fp->rlimit = fp->buf + length; /* Close descriptor now, so nesting does not use lots of descriptors. */ @@ -6406,13 +6391,7 @@ cpp_handle_options(cpp_reader * pfile, int argc, char **argv) break; case 't': - if (!strcmp(argv[i], "-traditional")) - { - opts->traditional = 1; - if (opts->dollars_in_ident > 0) - opts->dollars_in_ident = 1; - } - else if (!strcmp(argv[i], "-trigraphs")) + if (!strcmp(argv[i], "-trigraphs")) { if (!opts->chill) opts->no_trigraphs = 0; diff --git a/src/bin/epp/cppmain.c b/src/bin/epp/cppmain.c index 4f695a0..45b67b5 100644 --- a/src/bin/epp/cppmain.c +++ b/src/bin/epp/cppmain.c @@ -129,7 +129,6 @@ main(int argc, char **argv) if (fwrite(parse_in.token_buffer, 1, n, stdout) != n) exit(FATAL_EXIT_CODE); } - next: parse_in.limit = parse_in.token_buffer; got_text = 0; } diff --git a/src/lib/.cvsignore b/src/lib/.cvsignore deleted file mode 100644 index 09980ae..0000000 --- a/src/lib/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la diff --git a/src/lib/Edje.h b/src/lib/Edje.h index e41dd88..f65e904 100644 --- a/src/lib/Edje.h +++ b/src/lib/Edje.h @@ -1,3 +1,520 @@ +/** +@brief Edje Graphical Design Library + +These routines are used for Edje. + +@mainpage Edje Library Documentation +@image html e.png +@version 1.0.0 +@author Carsten Haitzler +@author Tilman Sauerbeck (tilman at code-monkey de) +@author ZigsMcKenzie +@author Cedric BAIL +@author Brian Mattern +@author Mathieu Taillefumier +@author Tristan +@author Gustavo Lima Chaves +@author Bruno Dilly +@author Fabiano Fidêncio +@author Jihoon Kim +@author Tiago Falcão +@author Davide Andreoli +@author Sebastian Dransfeld +@author Tom Hacohen +@author Aharon Hillel +@date 2003-2011 + + + + + + + + + + +@section intro What is Edje? + +Edje is a complex graphical design & layout library. + +It doesn't pretend to do containing and regular layout like a widget +set, but it is the base for such components. Based on the requirements +of Enlightenment 0.17, Edje should serve all the purposes of creating +visual elements (borders of windows, buttons, scrollbars, etc.) and +allow the designer the ability to animate, layout and control the look +and feel of any program using Edje as its basic GUI constructor. This +library allows for multiple collections of Layouts in one file, +sharing the same image and font database and thus allowing a whole +theme to be conveniently packaged into 1 file and shipped around. + +Edje separates the layout and behavior logic. Edje files ship with an +image and font database, used by all the parts in all the collections +to source graphical data. It has a directory of logical part names +pointing to the part collection entry ID in the file (thus allowing +for multiple logical names to point to the same part collection, +allowing for the sharing of data between display elements). Each part +collection consists of a list of visual parts, as well as a list of +programs. A program is a conditionally run program that if a +particular event occurs (a button is pressed, a mouse enters or leaves +a part) will trigger an action that may affect other parts. In this +way a part collection can be "programmed" via its file as to hilight +buttons when the mouse passes over them or show hidden parts when a +button is clicked somewhere etc. The actions performed in changing +from one state to another are also allowed to transition over a period +of time, allowing animation. Programs and animations can be run in +"parallel". + +This separation and simplistic event driven style of programming can produce +almost any look and feel one could want for basic visual elements. Anything +more complex is likely the domain of an application or widget set that may +use Edje as a convenient way of being able to configure parts of the display. + +For details of Edje's history, see the \ref history section. + + + + + + + + +@section requirements What does Edje require? + +Edje requires fairly little on your system. to use the Edje runtime library +you need: + + - Evas (library) + - Ecore (library) + - Eet (library) + - Embryo (library) + - Eina (library) + +Evas needs to be build with the JPEG, PNG and EET image loaders enabled at a +minimum. Edje uses X for the test program, so you will need the SOFTWARE_X11 +engine built into Evas as well. A suggested configure list is below in the +"cheat sheet" for Evas. + +Ecore needs the ECORE, ECORE_EVAS and ECORE_X modules built at a minimum. +It's suggested to build all the Ecore modules, but the ECORE_FB modules is +definitely optional. + +Eina, Eet and Embryo have no interesting options so just build and +install them. + +It is suggested right now that you get the latest SVN versions of the +required libraries. You also need to build them in the right order and make +sure the right options are enabled in the required libraries. Here is a +quick "cheat sheet" on how to get started. + +@verbatim +1. You need Eina from the trunk svn branch. + + svn co http://svn.enlightenment.org/svn/e/trunk/eina/ + cd eina + ./autogen.sh + ./configure + make + sudo make install + cd + +2. You need Eet from the trunk svn branch. + + svn co http://svn.enlightenment.org/svn/e/trunk/eet/ + cd eet + ./autogen.sh + ./configure + make + sudo make install + cd + +3. You need Evas from the trunk svn branch built with eet, png and jpeg loader support. + + svn co http://svn.enlightenment.org/svn/e/trunk/evas/ + cd evas + ./autogen.sh + ./configure --enable-image-loader-eet --enable-font-loader-eet --enable-image-loader-jpeg --enable-image-loader-png --enable-buffer + make + sudo make install + cd + +4. You need Ecore from the trunk svn branch built with ecore-x and ecore-evas. + + svn co http://svn.enlightenment.org/svn/e/trunk/ecore/ + cd ecore + ./autogen.sh + ./configure --enable-ecore-x --enable-ecore-evas --enable-ecore-evas-software-buffer --enable-ecore-evas-software-x11 --enable-ecore-evas-software-buffer + make + sudo make install + cd + +5. You need embryo from the trunk svn branch + + svn co http://svn.enlightenment.org/svn/e/trunk/embryo/ + cd embryo + ./autogen.sh + ./configure + make + sudo make install + cd + +@endverbatim + + + + + + + + + +@section compiling How to compile and test Edje + +Now you need to compile and install Edje. + +@verbatim + ./configure + make + sudo make install +@endverbatim + +You now have it installed and ready to go, but you need input +data. There are lots of examples in SVN, the best one is +Enlightenment's own theme file. + +You may use different tools to edit and view the generated ".edj" +files, for instance: + + - editje (http://trac.enlightenment.org/e/wiki/Editje) + - edje_viewer (http://trac.enlightenment.org/e/wiki/Edje_Viewer) + + + + + + + + + + +@section details So how does this all work? + +Edje internally holds a geometry state machine and state graph of what is +visible, not, where, at what size, with what colors etc. This is described +to Edje from an Edje .edj file containing this information. These files can +be produced by using edje_cc to take a text file (a .edc file) and "compile" +an output .edj file that contains this information, images and any other +data needed. + +The application using Edje will then create an object in its Evas +canvas and set the bundle file to use, specifying the @b group name to +use. Edje will load such information and create all the required +children objects with the specified properties as defined in each @b +part of the given group. See the following annotated example: + +@code + +#include +#include +#include +#include +#include + +#define WIDTH 320 +#define HEIGHT 240 + +static Evas_Object *create_my_group(Evas *canvas, const char *text) +{ + Evas_Object *edje; + + edje = edje_object_add(canvas); + if (!edje) + { + EINA_LOG_CRIT("could not create edje object!"); + return NULL; + } + + if (!edje_object_file_set(edje, "edje_example.edj", "my_group")) + { + int err = edje_object_load_error_get(edje); + const char *errmsg = edje_load_error_str(err); + EINA_LOG_ERR("could not load 'my_group' from edje_example.edj: %s", + errmsg); + + evas_object_del(edje); + return NULL; + } + + if (text) + { + if (!edje_object_part_text_set(edje, "text", text)) + { + EINA_LOG_WARN("could not set the text. " + "Maybe part 'text' does not exist?"); + } + } + + evas_object_move(edje, 0, 0); + evas_object_resize(edje, WIDTH, HEIGHT); + evas_object_show(edje); + return edje; +} + +int main(int argc, char *argv[]) +{ + Ecore_Evas *window; + Evas *canvas; + Evas_Object *edje; + const char *text; + + eina_init(); + evas_init(); + ecore_init(); + ecore_evas_init(); + edje_init(); + + window = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); + if (!window) + { + EINA_LOG_CRIT("could not create window."); + return -1; + } + canvas = ecore_evas_get(window); + + text = (argc > 1) ? argv[1] : NULL; + + edje = create_my_group(canvas, text); + if (!edje) + return -2; + + ecore_evas_show(window); + ecore_main_loop_begin(); + + evas_object_del(edje); + ecore_evas_free(window); + + return 0; +} +@endcode + +It requires the following source Edje file: +@code +// compile: edje_cc edje_example.edc +collections { + group { + name: "my_group"; // must be the same as in edje_example.c + + parts { + part { + name: "background"; + type: RECT; // plain boring rectangle + mouse_events: 0; // we don't need any mouse event on the background + + // just one state "default" + description { + state: "default" 0.0; // must always exist + color: 255 255 255 255; // white + + // define part coordinates: + + rel1 { // top-left point at (0, 0) [WIDTH * 0 + 0, HEIGHT * 0 + 0] + relative: 0.0 0.0; + offset: 0 0; + } + rel2 { // bottom-right point at (WIDTH * 1.0 - 1, HEIGHT * 1.0 - 1) + relative: 1.0 1.0; + offset: -1 -1; + } + } + } + + part { + name: "text"; + type: TEXT; + mouse_events: 1; // we want to change the color on mouse-over + + // 2 states, one "default" and another "over" to be used + // on mouse over effect + + description { + state: "default" 0.0; + color: 255 0 0 255; // red + + // define part coordinates: + + rel1 { // top-left at (WIDTH * 0.1 + 5, HEIGHT * 0.2 + 10) + relative: 0.1 0.2; + offset: 5 10; + } + rel2 { // bottom-right at (WIDTH * 0.9 - 6, HEIGHT * 0.8 - 11) + relative: 0.9 0.8; + offset: -6 -11; + } + + // define text specific state details + text { + font: "Sans"; // using fontconfig name! + size: 10; + text: "hello world"; + } + } + + description { + state: "over" 0.0; + inherit: "default" 0.0; // copy everything from "default" at this point + + color: 0 255 0 255; // override color, now it is green + } + } + + // do programs to change color on text mouse in/out (over) + programs { + program { + // what triggers this program: + signal: "mouse,in"; + source: "text"; + + // what this program does: + action: STATE_SET "over" 0.0; + target: "text"; + + // do the state-set in a nice interpolation animation + // using linear time in 0.1 second + transition: LINEAR 0.1; + } + + program { + // what triggers this program: + signal: "mouse,out"; + source: "text"; + + // what this program does: + action: STATE_SET "default" 0.0; + target: "text"; + + // do the state-set in a nice interpolation animation + // using linear time in 0.1 second + transition: LINEAR 0.1; + } + } + } + } +} +@endcode + + +One should save these files as edje_example.c and edje_example.edc then: +@verbatim +gcc -o edje_example edje_example.c `pkg-config --cflags --libs eina evas ecore ecore-evas edje` +edje_cc edje_example.edc + +./edje_example "some text" +@endverbatim + +Although simple, this example illustrates that animations and state +changes can be done from the Edje file itself without any requirement +in the C application. + +Before digging into changing or creating your own Edje source (edc) +files, read the \ref edcref. + + + +@section history Edje History + +It's a sequel to "Ebits" which has serviced the needs of Enlightenment +development for early version 0.17. The original design parameters under +which Ebits came about were a lot more restricted than the resulting +use of them, thus Edje was born. + +Edje is a more complex layout engine compared to Ebits. It doesn't +pretend to do containing and regular layout like a widget set. It +still inherits the more simplistic layout ideas behind Ebits, but it +now does them a lot more cleanly, allowing for easy expansion, and the +ability to cover much more ground than Ebits ever could. For the +purposes of Enlightenment 0.17, Edje was conceived to serve all the +purposes of creating visual elements (borders of windows, buttons, +scrollbars, etc.) and allow the designer the ability to animate, +layout and control the look and feel of any program using Edje as its +basic GUI constructor. + +Unlike Ebits, Edje separates the layout and behavior logic. + + + + + + + + + +@todo Complete documentation of API +@todo Bytecode language for extending programs... but what/how? + +*/ + + +/** + +@example embryo_custom_state.edc +This example show how to create a custom state from embryo. Clicking on the +3 labels will rotate the object in the given direction. + +@example embryo_pong.edc +Super-simple Pong implementation in pure embryo. + +@example embryo_run_program.edc +This example show how to run an edje program from embryo code. + +@example embryo_set_state.edc +This example show how to change the state of a part from embryo code. + +@example embryo_set_text.edc +This example show how to set the text in TEXT part from embryo code. + +@example embryo_timer.edc +This example show the usage of timers in embryo. + +@example external_elm_anchorblock.edc +This example use an elementary anchorblock and a button to animate the text. + +@example external_elm_button.edc +This example create some elementary buttons and do some actions on user click. + +@example external_elm_check.edc +This example show EXTERNAL checkbox in action. + +@example external_elm_panes.edc +This example show EXTERNAL elementary panes in action. + +@example external_emotion_elm.edc +Super-concise video player example using Edje/Emotion/Elementary. + +@example lua_script.edc +This example show the usage of lua scripting to create and animate some +objects in the canvas. + +@example toggle_using_filter.edc +This example show how to toggle the state of a part using the 'filter' +param in edje programs + +*/ + +/** + * @page luaref Edje Lua scripting + * + * @section intro Introduction + * + * Lua is intended for script-only objects at this point (with embryo left + * for augmenting standard programs). Since script-only objects effectively + * define objects entirely via Lua script (resize handling, event handling + * etc. etc.) this places many more demands on them, and thus a more powerful + * language is in order. Lua is that language. + * + * To get you started, here's an example: + * @include lua_script.edc + * + */ + #ifndef _EDJE_H #define _EDJE_H @@ -43,10 +560,10 @@ #ifdef __cplusplus extern "C" { #endif - + #define EDJE_VERSION_MAJOR 1 #define EDJE_VERSION_MINOR 0 - + typedef struct _Edje_Version { int major; @@ -54,9 +571,9 @@ extern "C" { int micro; int revision; } Edje_Version; - + EAPI extern Edje_Version *edje_version; - + /** * @file Edje.h * @brief Edje Graphical Design Library @@ -120,6 +637,9 @@ typedef enum _Edje_Part_Type typedef enum _Edje_Text_Effect { +#define EDJE_TEXT_EFFECT_MASK_BASIC 0xf +#define EDJE_TEXT_EFFECT_BASIC_SET(x, s) \ + do { x = ((x) & ~EDJE_TEXT_EFFECT_MASK_BASIC) | (s); } while (0) EDJE_TEXT_EFFECT_NONE = 0, EDJE_TEXT_EFFECT_PLAIN = 1, EDJE_TEXT_EFFECT_OUTLINE = 2, @@ -131,7 +651,20 @@ typedef enum _Edje_Text_Effect EDJE_TEXT_EFFECT_FAR_SHADOW = 8, EDJE_TEXT_EFFECT_FAR_SOFT_SHADOW = 9, EDJE_TEXT_EFFECT_GLOW = 10, - EDJE_TEXT_EFFECT_LAST = 11 + + EDJE_TEXT_EFFECT_LAST = 11, + +#define EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION (0x7 << 4) +#define EDJE_TEXT_EFFECT_SHADOW_DIRECTION_SET(x, s) \ + do { x = ((x) & ~EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION) | (s); } while (0) + EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_RIGHT = (0x0 << 4), + EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM = (0x1 << 4), + EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_LEFT = (0x2 << 4), + EDJE_TEXT_EFFECT_SHADOW_DIRECTION_LEFT = (0x3 << 4), + EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP_LEFT = (0x4 << 4), + EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP = (0x5 << 4), + EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP_RIGHT = (0x6 << 4), + EDJE_TEXT_EFFECT_SHADOW_DIRECTION_RIGHT = (0x7 << 4) } Edje_Text_Effect; typedef enum _Edje_Action_Type @@ -155,12 +688,18 @@ typedef enum _Edje_Action_Type typedef enum _Edje_Tween_Mode { - EDJE_TWEEN_MODE_NONE = 0, - EDJE_TWEEN_MODE_LINEAR = 1, - EDJE_TWEEN_MODE_SINUSOIDAL = 2, - EDJE_TWEEN_MODE_ACCELERATE = 3, - EDJE_TWEEN_MODE_DECELERATE = 4, - EDJE_TWEEN_MODE_LAST = 5 + EDJE_TWEEN_MODE_NONE = 0, + EDJE_TWEEN_MODE_LINEAR = 1, + EDJE_TWEEN_MODE_SINUSOIDAL = 2, + EDJE_TWEEN_MODE_ACCELERATE = 3, + EDJE_TWEEN_MODE_DECELERATE = 4, + EDJE_TWEEN_MODE_ACCELERATE_FACTOR = 5, + EDJE_TWEEN_MODE_DECELERATE_FACTOR = 6, + EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR = 7, + EDJE_TWEEN_MODE_DIVISOR_INTERP = 8, + EDJE_TWEEN_MODE_BOUNCE = 9, + EDJE_TWEEN_MODE_SPRING = 10, + EDJE_TWEEN_MODE_LAST = 11 } Edje_Tween_Mode; typedef enum _Edje_Cursor @@ -273,15 +812,15 @@ typedef enum _Edje_Text_Filter_Type EDJE_TEXT_FILTER_FORMAT = 1, EDJE_TEXT_FILTER_MARKUP = 2 } Edje_Text_Filter_Type; - + typedef enum _Edje_External_Param_Type { - EDJE_EXTERNAL_PARAM_TYPE_INT, - EDJE_EXTERNAL_PARAM_TYPE_DOUBLE, - EDJE_EXTERNAL_PARAM_TYPE_STRING, - EDJE_EXTERNAL_PARAM_TYPE_BOOL, - EDJE_EXTERNAL_PARAM_TYPE_CHOICE, - EDJE_EXTERNAL_PARAM_TYPE_MAX + EDJE_EXTERNAL_PARAM_TYPE_INT, + EDJE_EXTERNAL_PARAM_TYPE_DOUBLE, + EDJE_EXTERNAL_PARAM_TYPE_STRING, + EDJE_EXTERNAL_PARAM_TYPE_BOOL, + EDJE_EXTERNAL_PARAM_TYPE_CHOICE, + EDJE_EXTERNAL_PARAM_TYPE_MAX } Edje_External_Param_Type; /** @@ -307,16 +846,25 @@ typedef enum _Edje_External_Param_Type */ typedef enum _Edje_External_Param_Flags { - EDJE_EXTERNAL_PARAM_FLAGS_NONE = 0, - EDJE_EXTERNAL_PARAM_FLAGS_GET = (1 << 0), - EDJE_EXTERNAL_PARAM_FLAGS_SET = (1 << 1), - EDJE_EXTERNAL_PARAM_FLAGS_STATE = (1 << 2), - EDJE_EXTERNAL_PARAM_FLAGS_CONSTRUCTOR = (1 << 3), - EDJE_EXTERNAL_PARAM_FLAGS_REGULAR = (EDJE_EXTERNAL_PARAM_FLAGS_GET | - EDJE_EXTERNAL_PARAM_FLAGS_SET | - EDJE_EXTERNAL_PARAM_FLAGS_STATE) + EDJE_EXTERNAL_PARAM_FLAGS_NONE = 0, + EDJE_EXTERNAL_PARAM_FLAGS_GET = (1 << 0), + EDJE_EXTERNAL_PARAM_FLAGS_SET = (1 << 1), + EDJE_EXTERNAL_PARAM_FLAGS_STATE = (1 << 2), + EDJE_EXTERNAL_PARAM_FLAGS_CONSTRUCTOR = (1 << 3), + EDJE_EXTERNAL_PARAM_FLAGS_REGULAR = (EDJE_EXTERNAL_PARAM_FLAGS_GET | + EDJE_EXTERNAL_PARAM_FLAGS_SET | + EDJE_EXTERNAL_PARAM_FLAGS_STATE) } Edje_External_Param_Flags; + +/** + * @brief Converts type identifier to string nicer representation. + * + * This may be used to debug or other informational purposes. + * + * @param type the identifier to convert. + * @return the string with the string representation, or @c "(unknown)". + */ EAPI const char *edje_external_param_type_str(Edje_External_Param_Type type) EINA_PURE; struct _Edje_External_Param @@ -491,232 +1039,2164 @@ typedef void (*Edje_Message_Handler_Cb) (void *data, Evas_Object *obj, E typedef void (*Edje_Text_Filter_Cb) (void *data, Evas_Object *obj, const char *part, Edje_Text_Filter_Type type, char **text); typedef Evas_Object *(*Edje_Item_Provider_Cb) (void *data, Evas_Object *obj, const char *part, const char *item); - /* edje_main.c */ - EAPI int edje_init (void); - EAPI int edje_shutdown (void); - - /* edje_program.c */ - EAPI void edje_frametime_set (double t); - EAPI double edje_frametime_get (void); - - /* edje_util.c */ - EAPI void edje_freeze (void); - EAPI void edje_thaw (void); - EAPI void edje_fontset_append_set (const char *fonts); - EAPI const char *edje_fontset_append_get (void); - EAPI void edje_scale_set (double scale); - EAPI double edje_scale_get (void); - EAPI Eina_Bool edje_object_scale_set (Evas_Object *obj, double scale); - EAPI double edje_object_scale_get (const Evas_Object *obj); - EAPI void edje_object_mirrored_set (Evas_Object *obj, Eina_Bool rtl); - EAPI Eina_Bool edje_object_mirrored_get (const Evas_Object *obj); - - EAPI void edje_input_panel_enabled_set (Eina_Bool enabled); - EAPI void edje_input_panel_allow_set (Eina_Bool enabled); - EAPI Eina_Bool edje_input_panel_allow_get (void); - - EAPI void edje_autocapitalization_allow_set (Eina_Bool autocap); - EAPI Eina_Bool edje_autocapitalization_allow_get (void); - EAPI void edje_autoperiod_allow_set (Eina_Bool autoperiod); - EAPI Eina_Bool edje_autoperiod_allow_get (void); - - /* edje_load.c */ - EAPI Eina_List *edje_file_collection_list (const char *file); - EAPI void edje_file_collection_list_free (Eina_List *lst); - EAPI Eina_Bool edje_file_group_exists (const char *file, const char *glob); - EAPI char *edje_file_data_get (const char *file, const char *key); - EAPI void edje_file_cache_set (int count); - EAPI int edje_file_cache_get (void); - EAPI void edje_file_cache_flush (void); - EAPI void edje_collection_cache_set (int count); - EAPI int edje_collection_cache_get (void); - EAPI void edje_collection_cache_flush (void); - - /* edje_util.c */ - EAPI 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); - EAPI 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); - EAPI void edje_color_class_del (const char *color_class); - EAPI Eina_List *edje_color_class_list (void); - EAPI Eina_Bool edje_text_class_set (const char *text_class, const char *font, Evas_Font_Size size); - EAPI void edje_text_class_del (const char *text_class); - EAPI Eina_List *edje_text_class_list (void); - EAPI void edje_extern_object_min_size_set (Evas_Object *obj, Evas_Coord minw, Evas_Coord minh); - EAPI void edje_extern_object_max_size_set (Evas_Object *obj, Evas_Coord maxw, Evas_Coord maxh); - EAPI void edje_extern_object_aspect_set (Evas_Object *obj, Edje_Aspect_Control aspect, Evas_Coord aw, Evas_Coord ah); - EAPI 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); - - /* edje_smart.c */ - EAPI Evas_Object *edje_object_add (Evas *evas); - - /* edje_util.c */ - EAPI const char *edje_object_data_get (const Evas_Object *obj, const char *key); - - /* edje_load.c */ - EAPI Eina_Bool edje_object_file_set (Evas_Object *obj, const char *file, const char *group); - EAPI void edje_object_file_get (const Evas_Object *obj, const char **file, const char **group); - EAPI Edje_Load_Error edje_object_load_error_get (const Evas_Object *obj); - EAPI const char *edje_load_error_str (Edje_Load_Error error); - - /* edje_util.c */ - EAPI Eina_Bool edje_object_preload (Evas_Object *obj, Eina_Bool cancel); - - /* edje_program.c */ - EAPI void edje_object_signal_callback_add (Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data); - EAPI void *edje_object_signal_callback_del (Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func); - EAPI void *edje_object_signal_callback_del_full(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data); - EAPI void edje_object_signal_emit (Evas_Object *obj, const char *emission, const char *source); - EAPI void edje_object_play_set (Evas_Object *obj, Eina_Bool play); - EAPI Eina_Bool edje_object_play_get (const Evas_Object *obj); - EAPI void edje_object_animation_set (Evas_Object *obj, Eina_Bool on); - EAPI Eina_Bool edje_object_animation_get (const Evas_Object *obj); - - /* edje_util.c */ - EAPI int edje_object_freeze (Evas_Object *obj); - EAPI int edje_object_thaw (Evas_Object *obj); - EAPI 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); - EAPI 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); - EAPI void edje_object_color_class_del (Evas_Object *obj, const char *color_class); - EAPI Eina_Bool edje_object_text_class_set (Evas_Object *obj, const char *text_class, const char *font, Evas_Font_Size size); - EAPI void edje_object_size_min_get (const Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh); - EAPI void edje_object_size_max_get (const Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh); - EAPI void edje_object_calc_force (Evas_Object *obj); - EAPI void edje_object_size_min_calc (Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh); - EAPI Eina_Bool edje_object_parts_extends_calc (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); - EAPI void edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh, Evas_Coord restrictedw, Evas_Coord restrictedh); - EAPI Eina_Bool edje_object_part_exists (const Evas_Object *obj, const char *part); - EAPI const Evas_Object *edje_object_part_object_get (const Evas_Object *obj, const char *part); - EAPI 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); - - EAPI void edje_object_item_provider_set (Evas_Object *obj, Edje_Item_Provider_Cb func, void *data); - - EAPI void edje_object_text_change_cb_set (Evas_Object *obj, Edje_Text_Change_Cb func, void *data); - - EAPI Eina_Bool edje_object_part_text_set (Evas_Object *obj, const char *part, const char *text); - EAPI const char *edje_object_part_text_get (const Evas_Object *obj, const char *part); - EAPI Eina_Bool edje_object_part_text_unescaped_set (Evas_Object *obj, const char *part, const char *text_to_escape); - EAPI char *edje_object_part_text_unescaped_get (const Evas_Object *obj, const char *part); - - EAPI const char *edje_object_part_text_selection_get (const Evas_Object *obj, const char *part); - EAPI void edje_object_part_text_select_none (const Evas_Object *obj, const char *part); - EAPI void edje_object_part_text_select_all (const Evas_Object *obj, const char *part); - EAPI void edje_object_part_text_insert (Evas_Object *obj, const char *part, const char *text); - EAPI const Eina_List *edje_object_part_text_anchor_list_get (const Evas_Object *obj, const char *part); - EAPI const Eina_List *edje_object_part_text_anchor_geometry_get (const Evas_Object *obj, const char *part, const char *anchor); - EAPI const Eina_List *edje_object_part_text_item_list_get (const Evas_Object *obj, const char *part); - EAPI 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); - EAPI 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); - EAPI void edje_object_part_text_select_allow_set (const Evas_Object *obj, const char *part, Eina_Bool allow); - EAPI void edje_object_part_text_select_abort (const Evas_Object *obj, const char *part); - EAPI void edje_object_part_text_select_begin (const Evas_Object *obj, const char *part); - EAPI void edje_object_part_text_select_extend (const Evas_Object *obj, const char *part); - - EAPI Eina_Bool edje_object_part_text_cursor_next (Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI Eina_Bool edje_object_part_text_cursor_prev (Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI Eina_Bool edje_object_part_text_cursor_up (Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI Eina_Bool edje_object_part_text_cursor_down (Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI void edje_object_part_text_cursor_begin_set (Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI void edje_object_part_text_cursor_end_set (Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI void edje_object_part_text_cursor_copy (Evas_Object *obj, const char *part, Edje_Cursor src, Edje_Cursor dst); - EAPI void edje_object_part_text_cursor_line_begin_set (Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI void edje_object_part_text_cursor_line_end_set (Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI Eina_Bool edje_object_part_text_cursor_coord_set (Evas_Object *obj, const char *part, Edje_Cursor cur, Evas_Coord x, Evas_Coord y); - EAPI Eina_Bool edje_object_part_text_cursor_is_format_get (const Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI Eina_Bool edje_object_part_text_cursor_is_visible_format_get(const Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI const char *edje_object_part_text_cursor_content_get (const Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI void edje_object_part_text_cursor_pos_set (Evas_Object *obj, const char *part, Edje_Cursor cur, int pos); - EAPI int edje_object_part_text_cursor_pos_get (const Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI void edje_object_part_text_autocapitalization_set (const Evas_Object *obj, const char *part, Eina_Bool autocap); - EAPI void edje_object_part_text_autoperiod_set (const Evas_Object *obj, const char *part, Eina_Bool autoperiod); -#ifdef HAVE_ECORE_IMF - EAPI Ecore_IMF_Context *edje_object_part_text_imf_context_get(const Evas_Object *obj, const char *part); -#else - EAPI void *edje_object_part_text_imf_context_get(const Evas_Object *obj, const char *part); -#endif - EAPI void edje_object_part_text_input_panel_enabled_set(const Evas_Object *obj, const char *part, Eina_Bool disabled); - EAPI Eina_Bool edje_object_part_text_input_panel_enabled_get(const Evas_Object *obj, const char *part); - - EAPI void edje_object_text_insert_filter_callback_add (Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func, void *data); - EAPI void *edje_object_text_insert_filter_callback_del (Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func); - EAPI void *edje_object_text_insert_filter_callback_del_full (Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func, void *data); - - EAPI Eina_Bool edje_object_part_swallow (Evas_Object *obj, const char *part, Evas_Object *obj_swallow); - EAPI void edje_object_part_unswallow (Evas_Object *obj, Evas_Object *obj_swallow); - EAPI Evas_Object *edje_object_part_swallow_get (const Evas_Object *obj, const char *part); - EAPI const char *edje_object_part_state_get (const Evas_Object *obj, const char *part, double *val_ret); - EAPI Edje_Drag_Dir edje_object_part_drag_dir_get (const Evas_Object *obj, const char *part); - EAPI Eina_Bool edje_object_part_drag_value_set (Evas_Object *obj, const char *part, double dx, double dy); - EAPI Eina_Bool edje_object_part_drag_value_get (const Evas_Object *obj, const char *part, double *dx, double *dy); - EAPI Eina_Bool edje_object_part_drag_size_set (Evas_Object *obj, const char *part, double dw, double dh); - EAPI Eina_Bool edje_object_part_drag_size_get (const Evas_Object *obj, const char *part, double *dw, double *dh); - EAPI Eina_Bool edje_object_part_drag_step_set (Evas_Object *obj, const char *part, double dx, double dy); - EAPI Eina_Bool edje_object_part_drag_step_get (const Evas_Object *obj, const char *part, double *dx, double *dy); - EAPI Eina_Bool edje_object_part_drag_page_set (Evas_Object *obj, const char *part, double dx, double dy); - EAPI Eina_Bool edje_object_part_drag_page_get (const Evas_Object *obj, const char *part, double *dx, double *dy); - EAPI Eina_Bool edje_object_part_drag_step (Evas_Object *obj, const char *part, double dx, double dy); - EAPI Eina_Bool edje_object_part_drag_page (Evas_Object *obj, const char *part, double dx, double dy); - - EAPI Evas_Object *edje_object_part_external_object_get (const Evas_Object *obj, const char *part); - EAPI Eina_Bool edje_object_part_external_param_set (Evas_Object *obj, const char *part, const Edje_External_Param *param); - EAPI Eina_Bool edje_object_part_external_param_get (const Evas_Object *obj, const char *part, Edje_External_Param *param); - EAPI Evas_Object *edje_object_part_external_content_get (const Evas_Object *obj, const char *part, const char *content); - EAPI Edje_External_Param_Type edje_object_part_external_param_type_get (const Evas_Object *obj, const char *part, const char *param); - - EAPI Eina_Bool edje_object_part_box_append (Evas_Object *obj, const char *part, Evas_Object *child); - EAPI Eina_Bool edje_object_part_box_prepend (Evas_Object *obj, const char *part, Evas_Object *child); - EAPI Eina_Bool edje_object_part_box_insert_before (Evas_Object *obj, const char *part, Evas_Object *child, const Evas_Object *reference); - EAPI Eina_Bool edje_object_part_box_insert_at (Evas_Object *obj, const char *part, Evas_Object *child, unsigned int pos); - EAPI Evas_Object *edje_object_part_box_remove (Evas_Object *obj, const char *part, Evas_Object *child); - EAPI Evas_Object *edje_object_part_box_remove_at (Evas_Object *obj, const char *part, unsigned int pos); - EAPI Eina_Bool edje_object_part_box_remove_all (Evas_Object *obj, const char *part, Eina_Bool clear); - EAPI Evas_Object *edje_object_part_table_child_get (Evas_Object *obj, const char *part, unsigned int col, unsigned int row); - EAPI 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); - EAPI Eina_Bool edje_object_part_table_unpack (Evas_Object *obj, const char *part, Evas_Object *child_obj); - EAPI Eina_Bool edje_object_part_table_col_row_size_get (const Evas_Object *obj, const char *part, int *cols, int *rows); - EAPI Eina_Bool edje_object_part_table_clear (Evas_Object *obj, const char *part, Eina_Bool clear); - - /* edje_message_queue.c */ - EAPI void edje_object_message_send (Evas_Object *obj, Edje_Message_Type type, int id, void *msg); - EAPI void edje_object_message_handler_set (Evas_Object *obj, Edje_Message_Handler_Cb func, void *data); - EAPI void edje_object_message_signal_process (Evas_Object *obj); - - EAPI void edje_message_signal_process (void); - - /* edje_external.c */ - EAPI Eina_Bool edje_external_type_register (const char *type_name, const Edje_External_Type *type_info); - EAPI Eina_Bool edje_external_type_unregister (const char *type_name); - - EAPI void edje_external_type_array_register (const Edje_External_Type_Info *array); - EAPI void edje_external_type_array_unregister (const Edje_External_Type_Info *array); - - EAPI unsigned int edje_external_type_abi_version_get (void) EINA_CONST; - - - EAPI Eina_Iterator *edje_external_iterator_get (void); - EAPI Edje_External_Param *edje_external_param_find (const Eina_List *params, const char *key); - EAPI Eina_Bool edje_external_param_int_get (const Eina_List *params, const char *key, int *ret); - EAPI Eina_Bool edje_external_param_double_get (const Eina_List *params, const char *key, double *ret); - EAPI Eina_Bool edje_external_param_string_get (const Eina_List *params, const char *key, const char **ret); - EAPI Eina_Bool edje_external_param_bool_get (const Eina_List *params, const char *key, Eina_Bool *ret); - EAPI Eina_Bool edje_external_param_choice_get (const Eina_List *params, const char *key, const char **ret); - EAPI const Edje_External_Param_Info *edje_external_param_info_get (const char *type_name); - EAPI const Edje_External_Type *edje_external_type_get (const char *type_name); +/** + * @brief Initialize the edje library. + * + * @return The new init count. The initial value is zero. + * + * This function initializes the ejde library, making the propers + * calls to initialization functions. It makes calls to functions + * eina_init(), ecore_init(), embryo_init() and eet_init() so + * there is no need to call those functions again in your code. To + * shutdown edje there is a function edje_shutdown(). + * + * @see edje_shutdown() + * @see eina_init() + * @see ecore_init() + * @see embryo_init() + * @see eet_init() + * + */ +EAPI int edje_init (void); - /* edje_module.c */ - EAPI Eina_Bool edje_module_load (const char *module); - EAPI const Eina_List *edje_available_modules_get (void); +/** + * @brief Shutdown the edje library. + * + * @return The number of times the library has been initialised without being + * shutdown. + * + * This function shuts down the edje library. It calls the functions + * eina_shutdown(), ecore_shutdown(), embryo_shutdown() and + * eet_shutdown(), so there is no need to call these functions again + * in your code. + * + * @see edje_init() + * @see eina_shutdown() + * @see ecore_shutdown() + * @see embryo_shutdown() + * @see eet_shutdown() + * + */ +EAPI int edje_shutdown (void); + +/** + * @brief Set edje trasitions' frame time. + * + * @param t The frame time, in seconds. Default value is 1/30. + * + * This function sets the edje built-in animations' frame time (thus, + * affecting their resolution) by calling + * ecore_animator_frametime_set(). This frame time can be retrieved + * with edje_frametime_get(). + * + * @see edje_frametime_get() + * + */ +EAPI void edje_frametime_set (double t); + +/** + * @brief Get edje trasitions' frame time. + * + * @return The frame time, in seconds. + * + * This function returns the edje frame time set by + * edje_frametime_set(). + * + * @see edje_frametime_set() + * + */ +EAPI double edje_frametime_get (void); + +/** + * @brief Freeze Edje objects. + * + * This function freezes every edje objects in the current process. + * + * See edje_object_freeze(). + * + */ +EAPI void edje_freeze (void); + +/** + * @brief Thaw edje objects. + * + * This function thaw all edje object in the current process. + * + * See edje_object_thaw(). + * + */ +EAPI void edje_thaw (void); + +/** + * @brief Set the edje append fontset. + * + * @param fonts The fontset to append. + * + * This function sets the edje append fontset. + * + */ +EAPI void edje_fontset_append_set (const char *fonts); + +/** + * @brief Get the edje append fontset. + * + * @return The edje append fontset. + * + * This function returns the edje append fontset set by + * edje_fontset_append_set() function. + * + * @see edje_fontset_append_set(). + * + */ +EAPI const char *edje_fontset_append_get (void); + +/** + * @brief Set edje's global scaling factor. + * + * @param scale The edje (global) scale factor. The defaul is 1.0. + * + * Edje allows one to build scalable interfaces. Scale factors, which + * are set to neutral values by default (no scaling, actual sizes), + * are of two types: global and individual. Edje's global scaling + * factor will affect all its objects which hadn't their individual + * scaling factors altered from the default value. If they had it set + * differently, that factor will override the global one. + * + * Scaling affects the values of min/max object sizes, which are + * multiplied by it. Font sizes are scaled, too. + * + * This property can be retrieved with edje_scale_get(). + * + * @see edje_scale_get(). + * + */ +EAPI void edje_scale_set (double scale); + +/** + * @brief Get edje's global scaling factor. + * + * @return The edje (global) scale factor. The defaul is 1.0. + * + * This function returns edje's global scale factor, which can be set + * by edje_scale_set(). + * + * @see edje_scale_set(). + * + */ +EAPI double edje_scale_get (void); + +/** + * @brief Set the edje object's scaling factor. + * + * @param obj The edje object's reference. + * @param scale The edje object scale factor. The defaul is 1.0. + * + * This function sets the individual scale factor of the @a obj edje + * object. This property (or edje's global scale factor, when + * applicable), will affect this object's parts. However, only parts + * which, at the EDC language level, were declared which the "scale" + * attribute set to 1 (default is zero) will be affected. + * + * This scale factor can be retrieved with edje_object_scale_get(). + * @see edje_object_scale_get(). + * + */ +EAPI Eina_Bool edje_object_scale_set (Evas_Object *obj, double scale); + +/** + * @brief Get the edje object's scaling factor. + * + * @param obj The edje object's reference. + * + * This function returns the individual scale factor of the @a obj + * edje object, which can be set by edje_object_scale_set(). + * + * @see edje_object_scale_set(). + * + */ +EAPI double edje_object_scale_get (const Evas_Object *obj); + +/** + * Set the RTL orientation for this object. + * + * @param obj the smart object + * @rtl new value of flag EINA_TRUE/EINA_FALSE + * @since 1.1.0 + */ +EAPI void edje_object_mirrored_set (Evas_Object *obj, Eina_Bool rtl); + +/** + * Get the RTL orientation for this object. + * + * You can RTL orientation explicitly with edje_object_mirrored_set. + * + * @param obj the smart object + * @return if flag is set or not. + * @since 1.1.0 + */ +EAPI Eina_Bool edje_object_mirrored_get (const Evas_Object *obj); + +/** + * Get a list of groups in an edje file + * @param file The path to the edje file + * + * @return The Eina_List of group names (char *) + * + * Note: the list must be freed using edje_file_collection_list_free() + * when you are done with it. + */ +EAPI Eina_List *edje_file_collection_list (const char *file); + +/** + * Free file collection list + * @param lst The Eina_List of groups + * + * Frees the list returned by edje_file_collection_list(). + */ +EAPI void edje_file_collection_list_free (Eina_List *lst); + +/** + * Determine whether a group matching glob exists in an edje file. + * @param file The file path + * @param glob A glob to match on + * + * @return 1 if a match is found, 0 otherwise + */ +EAPI Eina_Bool edje_file_group_exists (const char *file, const char *glob); + +/** + * Get data from the file level data block of an edje file + * @param file The path to the .edj file + * @param key The data key + * @return The string value of the data + * + * If an edje file is built from the following edc: + * + * data { + * item: "key1" "value1"; + * item: "key2" "value2"; + * } + * collections { ... } + * + * Then, edje_file_data_get("key1") will return "value1" + */ +EAPI char *edje_file_data_get (const char *file, const char *key); + +/** + * @brief Set the file cache size. + * + * @param count The file cache size in edje file units. Default is 16. + * + * This function sets the file cache size. Edje keeps this cache in + * order to prevent duplicates of edje file entries in memory. The + * file cache size can be retrieved with edje_file_cache_get(). + * + * @see edje_file_cache_get() + * @see edje_file_cache_flush() + * + */ +EAPI void edje_file_cache_set (int count); + +/** + * @brief Return the file cache size. + * + * @return The file cache size in edje file units. Default is 16. + * + * This function returns the file cache size set by + * edje_file_cache_set(). + * + * @see edje_file_cache_set() + * @see edje_file_cache_flush() + * + */ +EAPI int edje_file_cache_get (void); + +/** + * @brief Clean the file cache. + * + * This function cleans the file cache entries, but keeps this cache's + * size to the last value set. + * + * @see edje_file_cache_set() + * @see edje_file_cache_get() + * + */ +EAPI void edje_file_cache_flush (void); + +/** + * @brief Set the collection cache size. + * + * @param count The collection cache size, in edje object units. Default is 16. + * + * This function sets the collection cache size. Edje keeps this cache + * in order to prevent duplicates of edje {collection,group,part} + * entries in memory. The collection cache size can be retrieved with + * edje_collection_cache_get(). + * + * @see edje_collection_cache_get() + * @see edje_collection_cache_flush() + * + */ +EAPI void edje_collection_cache_set (int count); + +/** + * @brief Return the collection cache size. + * + * @return The collection cache size, in edje object units. Default is 16. + * + * This function returns the collection cache size set by + * edje_collection_cache_set(). + * + * @see edje_collection_cache_set() + * @see edje_collection_cache_flush() + * + */ +EAPI int edje_collection_cache_get (void); + +/** + * @brief Clean the collection cache. + * + * This function cleans the collection cache, but keeps this cache's + * size to the last value set. + * + * @see edje_collection_cache_set() + * @see edje_collection_cache_get() + * + */ +EAPI void edje_collection_cache_flush (void); + +/** + * @brief Set Edje color class. + * + * @param color_class + * @param r Object Red value + * @param g Object Green value + * @param b Object Blue value + * @param a Object Alpha value + * @param r2 Outline Red value + * @param g2 Outline Green value + * @param b2 Outline Blue value + * @param a2 Outline Alpha value + * @param r3 Shadow Red value + * @param g3 Shadow Green value + * @param b3 Shadow Blue value + * @param a3 Shadow Alpha value + * + * This function sets the color values for a process level color + * class. This will cause all edje parts in the current process that + * have the specified color class to have their colors multiplied by + * these values. (Object level color classes set by + * edje_object_color_class_set() will override the values set by this + * function). + * + * The first color is the object, the second is the text outline, and + * the third is the text shadow. (Note that the second two only apply + * to text parts). + * + * Setting color emits a signal "color_class,set" with source being + * the given color class in all objects. + * + * @see edje_color_class_set(). + * + * @note unlike Evas, Edje colors are @b not pre-multiplied. That is, + * half-transparent white is 255 255 255 128. + */ +EAPI 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); + +/** + * @brief Get Edje color class. + * + * @param color_class + * @param r Object Red value + * @param g Object Green value + * @param b Object Blue value + * @param a Object Alpha value + * @param r2 Outline Red value + * @param g2 Outline Green value + * @param b2 Outline Blue value + * @param a2 Outline Alpha value + * @param r3 Shadow Red value + * @param g3 Shadow Green value + * @param b3 Shadow Blue value + * @param a3 Shadow Alpha value + * + * @return EINA_TRUE if found or EINA_FALSE if not found and all + * values are zeroed. + * + * This function gets the color values for a process level color + * class. This value is the globally set and not per-object, that is, + * the value that would be used by objects if they did not override with + * edje_object_color_class_set(). + * + * The first color is the object, the second is the text outline, and + * the third is the text shadow. (Note that the second two only apply + * to text parts). + * + * @see edje_color_class_set(). + * + * @note unlike Evas, Edje colors are @b not pre-multiplied. That is, + * half-transparent white is 255 255 255 128. + */ +EAPI 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); + EAPI void edje_color_class_del (const char *color_class); + EAPI Eina_List *edje_color_class_list (void); + +/** + * @brief Set the Edje text class. + * + * @param text_class The text class name + * @param font The font name + * @param size The font size + * + * This function sets updates all edje members which belong to this + * text class with the new font attributes. + * + * @see edje_text_class_get(). + * + */ + +/** + * @brief Delete the object color class. + * + * @param obj The edje object's reference. + * @param color_class The color class to be deleted. + * + * This function deletes any values at the object level for the + * specified object and color class. + * + * Deleting color emits a signal "color_class,del" with source being + * the given color. + */ +EAPI Eina_Bool edje_text_class_set (const char *text_class, const char *font, Evas_Font_Size size); + EAPI void edje_text_class_del (const char *text_class); + EAPI Eina_List *edje_text_class_list (void); + +/** + * @brief Set the object minimum size. + * + * @param obj A valid Evas_Object handle + * @param minw The minimum width + * @param minh The minimum height + * + * This sets the minimum size restriction for the object. + */ +EAPI void edje_extern_object_min_size_set (Evas_Object *obj, Evas_Coord minw, Evas_Coord minh); + +/** + * @brief Set the object maximum size. + * + * @param obj A valid Evas_Object handle + * @param maxw The maximum width + * @param maxh The maximum height + * + * This sets the maximum size restriction for the object. + */ +EAPI void edje_extern_object_max_size_set (Evas_Object *obj, Evas_Coord maxw, Evas_Coord maxh); + +/** + * @brief Set the object aspect size. + * + * @param obj A valid Evas_Object handle + * @param aspect The aspect control axes + * @param aw The aspect radio width + * @param ah The aspect ratio height + * + * This sets the desired aspect ratio to keep an object that will be + * swallowed by Edje. The width and height define a preferred size + * ASPECT and the object may be scaled to be larger or smaller, but + * retaining the relative scale of both aspect width and height. + */ +EAPI void edje_extern_object_aspect_set (Evas_Object *obj, Edje_Aspect_Control aspect, Evas_Coord aw, Evas_Coord ah); + +/** + * @brief Registers a custom layout to be used in edje boxes. + * + * @param name The name of the layout + * @param func The function defining the layout + * @param layout_data_get This function gets the custom data pointer + * for func + * @param layout_data_free Passed to func to free its private data + * when needed + * @param free_data Frees data + * @param data Private pointer passed to layout_data_get + * + * This function registers custom layouts that can be referred from + * themes by the registered name. The Evas_Object_Box_Layout + * functions receive two pointers for internal use, one being private + * data, and the other the function to free that data when it's not + * longer needed. From Edje, this private data will be retrieved by + * calling layout_data_get, and layout_data_free will be the free + * function passed to func. layout_data_get will be called with data + * as its parameter, and this one will be freed by free_data whenever + * the layout is unregistered from Edje. + */ +EAPI 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); + +/** + * Constructs the Edje object + * @param evas A valid Evas handle + * @return The Evas_Object pointer. + * + * Creates the Edje smart object, returning the Evas_Object handle. + */ +EAPI Evas_Object *edje_object_add (Evas *evas); + +/** + * @brief Get Edje object data. + * + * @param obj A valid Evas_Object handle + * @param key The data key + * @return The data string + * + * This function fetches data specified at the object level. + * + * In EDC this comes from a data block within the group block that @a + * obj was loaded from. E.g. + * + * @code + * collections { + * group { + * name: "a_group"; + * data { + * item: "key1" "value1"; + * item: "key2" "value2"; + * } + * } + * } + * @endcode + */ +EAPI const char *edje_object_data_get (const Evas_Object *obj, const char *key); + +/** + * Sets the EET file and group to load @a obj from + * @param obj A valid Evas_Object handle + * @param file The path to the EET file + * @param group The group name in the Edje + * @return 0 on Error\n + * 1 on Success and sets EDJE_LOAD_ERROR_NONE + * + * Edje uses EET files, conventionally ending in .edj, to store object + * descriptions. A single file contains multiple named groups. This function + * specifies the file and group name to load @a obj from. + */ +EAPI Eina_Bool edje_object_file_set (Evas_Object *obj, const char *file, const char *group); + +/** + * Get the file and group name that @a obj was loaded from + * @param obj A valid Evas_Object handle + * @param file A pointer to store a pointer to the filename in + * @param group A pointer to store a pointer to the group name in + * + * This gets the EET file location and group for the given Evas_Object. + * If @a obj is either not an edje file, or has not had its file/group set + * using edje_object_file_set(), then both @a file and @a group will be set + * to NULL. + * + * It is valid to pass in NULL for either @a file or @a group if you are not + * interested in one of the values. + */ +EAPI void edje_object_file_get (const Evas_Object *obj, const char **file, const char **group); + +/** + * Gets the Edje load error + * @param obj A valid Evas_Object handle + * + * @return The Edje load error:\n + * EDJE_LOAD_ERROR_NONE: No Error\n + * EDJE_LOAD_ERROR_GENERIC: Generic Error\n + * EDJE_LOAD_ERROR_DOES_NOT_EXIST: Does not Exist\n + * EDJE_LOAD_ERROR_PERMISSION_DENIED: Permission Denied\n + * EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED: Resource Allocation Failed\n + * EDJE_LOAD_ERROR_CORRUPT_FILE: Corrupt File\n + * EDJE_LOAD_ERROR_UNKNOWN_FORMAT: Unknown Format\n + * EDJE_LOAD_ERROR_INCOMPATIBLE_FILE: Incompatible File\n + * EDJE_LOAD_ERROR_UNKNOWN_COLLECTION: Unknown Collection\n + * EDJE_LOAD_ERROR_RECURSIVE_REFERENCE: Recursive Reference\n + */ +EAPI Edje_Load_Error edje_object_load_error_get (const Evas_Object *obj); + +EAPI const char *edje_load_error_str (Edje_Load_Error error); +EAPI Eina_Bool edje_object_preload (Evas_Object *obj, Eina_Bool cancel); + +/** + * @brief Add a callback for a signal emitted by @a obj. + * + * @param obj A valid Evas_Object handle. + * @param emission The signal's name. + * @param source The signal's source. + * @param func The callback function to be executed when the signal is + * emitted. + * @param data A pointer to data to pass in to the callback function. + * + * Connects a callback function to a signal emitted by @a obj. + * In EDC, a program can emit a signal as follows: + * + * @code + * program { + * name: "emit_example"; + * action: SIGNAL_EMIT "a_signal" "a_source"; + * } + * @endcode + * + * Assuming a function with the following declaration is definded: + * + * @code + * void cb_signal(void *data, Evas_Object *o, const char *emission, const char *source); + * @endcode + * + * a callback is attached using: + * + * @code + * edje_object_signal_callback_add(obj, "a_signal", "a_source", cb_signal, data); + * @endcode + * + * Here, @a data is an arbitrary pointer to be used as desired. Note + * that @a emission and @a source correspond respectively to the first + * and the second parameters at the SIGNAL_EMIT action. + * + * Internal edje signals can also be attached to, and globs can occur + * in either the emission or source name, e.g. + * + * @code + * edje_object_signal_callback_add(obj, "mouse,down,*", "button.*", NULL); + * @endcode + * + * Here, any mouse down events on an edje part whose name begins with + * "button." will trigger the callback. The actual signal and source + * names will be passed in to the @a emission and @a source parameters + * of the callback function (e.g. "mouse,down,2" and "button.close"). + */ +EAPI void edje_object_signal_callback_add (Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data); + +/** + * @brief Remove a signal-triggered callback from an object. + * + * @param obj A valid Evas_Object handle. + * @param emission The emission string. + * @param source The source string. + * @param func The callback function. + * @return The data pointer + * + * This function removes a callback, previously attached to the + * emittion of a signal, from the object @a obj. The parameters @a + * emission, @a source and @a func must match exactly those passed to + * a previous call to edje_object_signal_callback_add(). The data + * pointer that was passed to this call will be returned. + * + * @see edje_object_signal_callback_add(). + * @see edje_object_signal_callback_del_full(). + * + */ +EAPI void *edje_object_signal_callback_del (Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func); + +/** + * @brief Remove a signal-triggered callback from an object. + * + * @param obj A valid Evas_Object handle. + * @param emission The emission string. + * @param source The source string. + * @param func The callback function. + * @param data The user data passed to the callback. + * @return The data pointer + * + * This function removes a callback, previously attached to the + * emittion of a signal, from the object @a obj. The parameters @a + * emission, @a sourcei, @a func and @a data must match exactly those + * passed to a previous call to edje_object_signal_callback_add(). The data + * pointer that was passed to this call will be returned. + * + * @see edje_object_signal_callback_add(). + * @see edje_object_signal_callback_del(). + * + */ +EAPI void *edje_object_signal_callback_del_full(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data); + +/** + * @brief Send a signal to an edje object. + * + * @param obj A valid Evas_Object handle. + * @param emission The signal's name. + * @param source The signal's source. + * + * This function sends a signal to the object @a obj. An edje program + * can respond to a signal by specifying matching 'signal' and + * 'source' fields. + * + * @code + * edje_object_signal_emit(obj, "a_signal", ""); + * @endcode + * + * will trigger a program whose EDC block is: + * + * @code + * program { + * name: "a_program"; + * signal: "a_signal"; + * source: ""; + * action: ... + * } + * @endcode + * + * FIXME: should this signal be sent to children also? + */ +EAPI void edje_object_signal_emit (Evas_Object *obj, const char *emission, const char *source); + +/** + * @brief Set the edje object to playing or paused states. + * + * @param obj A valid Evas_Object handle. + * @param play Object state (1 to playing, 0 to pauseed). + * + * This function sets the edje object @a obj to playing or paused + * states, depending on the parameter @a play. This has no effect if + * the object was already at that state. + * + * @see edje_object_play_get(). + * + */ +EAPI void edje_object_play_set (Evas_Object *obj, Eina_Bool play); + +/** + * @brief Get the edje object's play/pause state. + * + * @param obj A valid Evas_Object handle. + * @return @c EINA_FALSE if the object is not connected, its @c delete_me flag + * is set, or it is at paused state; @c EINA_TRUE if the object is at playing + * state. + * + * This function tells if an edje object is playing or not. This state + * is set by edje_object_play_set(). + * + * @see edje_object_play_set(). + * + */ +EAPI Eina_Bool edje_object_play_get (const Evas_Object *obj); + +/** + * @brief Set the object's animation state. + * + * @param obj A valid Evas_Object handle. + * @param on Animation State. + * + * This function starts or stops an edje object's animation. The + * information if it's runnig can be retrieved by + * edje_object_animation_get(). + * + * @see edje_object_animation_get() + * + */ +EAPI void edje_object_animation_set (Evas_Object *obj, Eina_Bool on); + +/** + * @brief Get the edje object's animation state. + * + * @param obj A valid Evas_Object handle. + * @return @c EINA_FALSE on error or if object is not animated; + * @c EINA_TRUE if animated. + * + * This function returns if the animation is playing or not. The + * animation state is set by edje_object_play_set(). + * + * @see edje_object_animation_set(). + * + */ +EAPI Eina_Bool edje_object_animation_get (const Evas_Object *obj); + +/** + * @brief Freeze object. + * + * @param obj A valid Evas_Object handle + * @return The frozen state or 0 on Error + * + * This function puts all changes on hold. Successive freezes will + * nest, requiring an equal number of thaws. + * + */ +EAPI int edje_object_freeze (Evas_Object *obj); + +/** + * @brief Thaw object. + * + * @param obj A valid Evas_Object handle + * @return The frozen state or 0 on Error + * + * This allows frozen changes to occur. + * + */ +EAPI int edje_object_thaw (Evas_Object *obj); + +/** + * @brief Sets the object color class. + * + * @param obj A valid Evas_Object handle + * @param color_class + * @param r Object Red value + * @param g Object Green value + * @param b Object Blue value + * @param a Object Alpha value + * @param r2 Outline Red value + * @param g2 Outline Green value + * @param b2 Outline Blue value + * @param a2 Outline Alpha value + * @param r3 Shadow Red value + * @param g3 Shadow Green value + * @param b3 Shadow Blue value + * @param a3 Shadow Alpha value + * + * This function sets the color values for an object level color + * class. This will cause all edje parts in the specified object that + * have the specified color class to have their colors multiplied by + * these values. + * + * The first color is the object, the second is the text outline, and + * the third is the text shadow. (Note that the second two only apply + * to text parts). + * + * Setting color emits a signal "color_class,set" with source being + * the given color. + * + * @note unlike Evas, Edje colors are @b not pre-multiplied. That is, + * half-transparent white is 255 255 255 128. + */ + +/** + * @brief Lists color classes. + * + * @return A list of color class names (strings). These strings and + * the list must be free()'d by the caller. + * + * This function lists all color classes known about by the current + * process. + * + */ + +/** + * @brief Delete edje color class. + * + * @param color_class + * + * This function deletes any values at the process level for the + * specified color class. + * + * Deleting color emits a signal "color_class,del" with source being + * the given color class in all objects. + */ +EAPI 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); + +/** + * @brief Gets the object color class. + * + * @param obj A valid Evas_Object handle + * @param color_class + * @param r Object Red value + * @param g Object Green value + * @param b Object Blue value + * @param a Object Alpha value + * @param r2 Outline Red value + * @param g2 Outline Green value + * @param b2 Outline Blue value + * @param a2 Outline Alpha value + * @param r3 Shadow Red value + * @param g3 Shadow Green value + * @param b3 Shadow Blue value + * @param a3 Shadow Alpha value + * + * @return EINA_TRUE if found or EINA_FALSE if not found and all + * values are zeroed. + * + * This function gets the color values for an object level color + * class. If no explicit object color is set, then global values will + * be used. + * + * The first color is the object, the second is the text outline, and + * the third is the text shadow. (Note that the second two only apply + * to text parts). + * + * @note unlike Evas, Edje colors are @b not pre-multiplied. That is, + * half-transparent white is 255 255 255 128. + */ +EAPI 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); + EAPI void edje_object_color_class_del (Evas_Object *obj, const char *color_class); + +/** + * @brief Sets Edje text class. + * + * @param obj A valid Evas_Object handle + * @param text_class The text class name + * @param font Font name + * @param size Font Size + * + * This function sets the text class for the Edje. + * + */ + +/** + * @brief List text classes. + * + * @return A list of text class names (strings). These strings are + * stringshares and the list must be free()'d by the caller. + * + * This function lists all text classes known about by the current + * process. + * + */ + +/** + * @brief Delete the text class. + * + * @param text_class The text class name string + * + * This function deletes any values at the process level for the + * specified text class. + * + */ +EAPI Eina_Bool edje_object_text_class_set (Evas_Object *obj, const char *text_class, const char *font, Evas_Font_Size size); + +/** + * @brief Get the minimum size for an object. + * + * @param obj A valid Evas_Object handle + * @param minw Minimum width pointer + * @param minh Minimum height pointer + * + * Gets the object's minimum size values from the Edje. These are set + * to zero if no Edje is connected to the Evas Object. + */ +EAPI void edje_object_size_min_get (const Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh); + +/** + * @brief Get the maximum size for an object. + * + * @param obj A valid Evas_Object handle + * @param maxw Maximum width pointer + * @param maxh Maximum height pointer + * + * Gets the object's maximum size values from the Edje. These are set + * to zero if no Edje is connected to the Evas Object. + */ +EAPI void edje_object_size_max_get (const Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh); + +/** + * @brief Force a Size/Geometry calculation. + * + * @param obj A valid Evas_Object handle + * + * Forces the object @p obj to recalculation layout regardless of + * freeze/thaw. + */ +EAPI void edje_object_calc_force (Evas_Object *obj); + +/** + * @brief Calculate minimum size. + * + * @param obj A valid Evas_Object handle + * @param minw Minimum width pointer + * @param minh Minimum height pointer + * + * Calculates the object's minimum size ?! + */ +EAPI void edje_object_size_min_calc (Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh); + EAPI Eina_Bool edje_object_parts_extends_calc (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); + EAPI void edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh, Evas_Coord restrictedw, Evas_Coord restrictedh); + +/** + * @brief Check if Edje part exists. + * + * @param obj A valid Evas_Object handle + * @param part The part name to check + * + * @return 0 on Error, 1 if Edje part exists. + * + * This function returns if a part exists in the edje. + * + */ +EAPI Eina_Bool edje_object_part_exists (const Evas_Object *obj, const char *part); + +/** + * @brief Gets the evas object from a part. + * + * @param obj A valid Evas_Object handle + * @param part The Edje part + * @return Returns the Evas_Object corresponding to the given part, or + * NULL on failure (if the part doesn't exist) + * + * This functio gets the Evas_Object corresponding to a given part. + * + * You should never modify the state of the returned object (with + * evas_object_move() or evas_object_hide() for example), but you can + * safely query info about its current state (with + * evas_object_visible_get() or evas_object_color_get() for example) + * + **/ +EAPI const Evas_Object *edje_object_part_object_get (const Evas_Object *obj, const char *part); + +/** + * @brief Get the geometry of an Edje part. + * + * @param obj A valid Evas_Object handle + * @param part The Edje part + * @param x The x coordinate pointer + * @param y The y coordinate pointer + * @param w The width pointer + * @param h The height pointer + * + * This function gets the geometry of an Edje part. + * + * It is valid to pass NULL as any of @a x, @a y, @a w or @a h, whose + * values you are uninterested in. + */ +EAPI 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); + + +/** + * @brief Set the function that provides item objects for named items in an edje entry text + * + * @param obj A valid Evas Object handle + * @param func The function to call (or NULL to disable) to get item objects + * @param data The data pointer to pass to the @p func callback + * + * Item objects may be deleted any time by Edje, and will be deleted when the + * Edje object is deleted (or file is set to a new file). + */ +EAPI void edje_object_item_provider_set (Evas_Object *obj, Edje_Item_Provider_Cb func, void *data); + + +/** + * @brief Set the object text callback. + * + * @param obj A valid Evas_Object handle + * @param func The callback function to handle the text change + * @param data The data associated to the callback function. + * + * This function gets the geometry of an Edje part + * + * It is valid to pass NULL as any of @a x, @a y, @a w or @a h, whose + * values you are uninterested in. + * + */ +EAPI void edje_object_text_change_cb_set (Evas_Object *obj, Edje_Text_Change_Cb func, void *data); + +/** + * Sets the text for an object part + * @param obj A valid Evas Object handle + * @param part The part name + * @param text The text string + */ +EAPI Eina_Bool edje_object_part_text_set (Evas_Object *obj, const char *part, const char *text); + +/** + * @brief Return the text of the object part. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * + * @return The text string + * + * This function returns the text associated to the object part. + * + */ +EAPI const char *edje_object_part_text_get (const Evas_Object *obj, const char *part); + +/** + * @brief Sets the raw (non escaped) text for an object part. + * + * @param obj A valid Evas Object handle + * @param part The part name + * @param text_to_escape The text string + * + * This funciton will do escape for you if it is a TEXTBLOCK part, + * that is, if text contain tags, these tags will not be + * interpreted/parsed by TEXTBLOCK. + * + * @see edje_object_part_text_unescaped_get(). + * + */ +EAPI Eina_Bool edje_object_part_text_unescaped_set (Evas_Object *obj, const char *part, const char *text_to_escape); + +/** + * @brief Returns the text of the object part, without escaping. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @return The @b allocated text string without escaping, or NULL on + * problems. + * + * This function is the counterpart of + * edje_object_part_text_unescaped_set(). Please notice that the + * result is newly allocated memory and should be released with free() + * when done. + * + * @see edje_object_part_text_unescaped_set(). + * + */ +EAPI char *edje_object_part_text_unescaped_get (const Evas_Object *obj, const char *part); + +/** + * @brief Return the selection text of the object part. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @return The text string + * + * This function returns selection text of the object part. + * + */ +EAPI const char *edje_object_part_text_selection_get (const Evas_Object *obj, const char *part); + +/** + * @brief Set the selection to be none. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * + * This function sets the selection text to be none. + * + */ +EAPI void edje_object_part_text_select_none (const Evas_Object *obj, const char *part); + +/** + * @brief Set the selection to be everything. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * + * This function selects all text of the object of the part. + * + */ +EAPI void edje_object_part_text_select_all (const Evas_Object *obj, const char *part); + +/** + * @brief Insert text for an object part. + * + * @param obj A valid Evas Object handle + * @param part The part name + * @param text The text string + * + * This function inserts the text for an object part just before the + * cursor position. + * + */ +EAPI void edje_object_part_text_insert (Evas_Object *obj, const char *part, const char *text); + +/** + * @brief Insert text for an object part. + * + * @param obj A valid Evas Object handle + * @param part The part name + * @param text The text string + * + * This function inserts the text for an object part at the end; It does not + * move the cursor. + * + * @since 1.1 + */ +EAPI void edje_object_part_text_append(Evas_Object *obj, const char *part, const char *text); + +/** + * @brief Return a list of char anchor names. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * + * @return The list of anchors (const char *), do not modify! + * + * This function returns a list of char anchor names. + * + */ +EAPI const Eina_List *edje_object_part_text_anchor_list_get (const Evas_Object *obj, const char *part); + +/** + * @brief Return a list of Evas_Textblock_Rectangle anchor rectangles. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param anchor The anchor name + * + * @return The list of anchor rects (const Evas_Textblock_Rectangle + * *), do not modify! Geometry is relative to entry part. + * + * This function return a list of Evas_Textblock_Rectangle anchor + * rectangles. + * + */ +EAPI const Eina_List *edje_object_part_text_anchor_geometry_get (const Evas_Object *obj, const char *part, const char *anchor); + +/** + * @brief Return a list of char item names. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * + * @return The list of items (const char *), do not modify! + * + * This function returns a list of char item names. + * + */ +EAPI const Eina_List *edje_object_part_text_item_list_get (const Evas_Object *obj, const char *part); + +/** + * @brief Return item geometry. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param item The item name + * @param cx Item x return (relative to entry part) + * @param cy Item y return (relative to entry part) + * @param cw Item width return + * @param ch Item height return + * + * @return 1 if item exists, 0 if not + * + * This function return a list of Evas_Textblock_Rectangle item + * rectangles. + * + */ +EAPI 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); + +/** + * @brief Returns the cursor geometry of the part relative to the edje + * object. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param x Cursor X position + * @param y Cursor Y position + * @param w Cursor width + * @param h Cursor height + * + */ +EAPI 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); + +/** + * @brief Enables selection if the entry is an EXPLICIT selection mode + * type. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param allow EINA_TRUE to enable, EINA_FALSE otherwise + */ +EAPI void edje_object_part_text_select_allow_set (const Evas_Object *obj, const char *part, Eina_Bool allow); + +/** + * @brief Aborts any selection action on a part. + * + * @param obj A valid Evas_Object handle + * @param part The part name + */ +EAPI void edje_object_part_text_select_abort (const Evas_Object *obj, const char *part); + +/** + * @brief Starts selecting at current cursor position + * + * @param obj A valid Evas_Object handle + * @param part The part name + */ +EAPI void edje_object_part_text_select_begin (const Evas_Object *obj, const char *part); + +/** + * @brief Extends the current selection to the current cursor position + * + * @param obj A valid Evas_Object handle + * @param part The part name + */ +EAPI void edje_object_part_text_select_extend (const Evas_Object *obj, const char *part); + + +/** + * @brief Advances the cursor to the next cursor position. + * @see evas_textblock_cursor_char_next + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param cur The edje cursor to advance + */ +EAPI Eina_Bool edje_object_part_text_cursor_next (Evas_Object *obj, const char *part, Edje_Cursor cur); + +/** + * @brief Moves the cursor to the previous char + * @see evas_textblock_cursor_char_prev + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param cur the edje cursor to work on + */ +EAPI Eina_Bool edje_object_part_text_cursor_prev (Evas_Object *obj, const char *part, Edje_Cursor cur); + +/** + * @brief Move the cursor to the char above the current cursor position. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param cur the edje cursor to work on + */ +EAPI Eina_Bool edje_object_part_text_cursor_up (Evas_Object *obj, const char *part, Edje_Cursor cur); + +/** + * @brief Moves the cursor to the char below the current cursor position. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param cur the edje cursor to work on + */ +EAPI Eina_Bool edje_object_part_text_cursor_down (Evas_Object *obj, const char *part, Edje_Cursor cur); + +/** + * @brief Moves the cursor to the beginning of the text part + * @see evas_textblock_cursor_paragraph_first + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param cur the edje cursor to work on + */ +EAPI void edje_object_part_text_cursor_begin_set (Evas_Object *obj, const char *part, Edje_Cursor cur); + +/** + * @brief Moves the cursor to the end of the text part. + * @see evas_textblock_cursor_paragraph_last + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param cur the edje cursor to work on + */ +EAPI void edje_object_part_text_cursor_end_set (Evas_Object *obj, const char *part, Edje_Cursor cur); + +/** + * @brief Copy the cursor to another cursor. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param sry the cursor to copy from + * @param dst the cursor to copy to + */ +EAPI void edje_object_part_text_cursor_copy (Evas_Object *obj, const char *part, Edje_Cursor src, Edje_Cursor dst); + +/** + * @brief Move the cursor to the beginning of the line. + * @see evas_textblock_cursor_line_char_first + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param cur the edje cursor to work on + */ +EAPI void edje_object_part_text_cursor_line_begin_set (Evas_Object *obj, const char *part, Edje_Cursor cur); + +/** + * @brief Move the cursor to the end of the line. + * @see evas_textblock_cursor_line_char_last + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param cur the edje cursor to work on + */ +EAPI void edje_object_part_text_cursor_line_end_set (Evas_Object *obj, const char *part, Edje_Cursor cur); + +/** + * Position the given cursor to a X,Y position. + * + * This is frequently used with the user cursor. + * + * @param obj An Edje object. + * @param part The part containing the object. + * @param cur The cursor to adjust. + * @param x X Coordinate. + * @param y Y Coordinate. + * @return True on success, false on error. + */ +EAPI Eina_Bool edje_object_part_text_cursor_coord_set (Evas_Object *obj, const char *part, Edje_Cursor cur, Evas_Coord x, Evas_Coord y); + +/** + * @brief Returns whether the cursor points to a format. + * @see evas_textblock_cursor_is_format + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param cur The cursor to adjust. + * @return EINA_TRUE if it's true, EINA_FALSE otherwise. + */ +EAPI Eina_Bool edje_object_part_text_cursor_is_format_get (const Evas_Object *obj, const char *part, Edje_Cursor cur); + +/** + * @brief Return true if the cursor points to a visible format + * For example \t, \n, item and etc. + * @see evas_textblock_cursor_format_is_visible_get + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param cur The cursor to adjust. + */ +EAPI Eina_Bool edje_object_part_text_cursor_is_visible_format_get(const Evas_Object *obj, const char *part, Edje_Cursor cur); + +/** + * @brief Returns the content (char) at the cursor position. + * @see evas_textblock_cursor_content_get + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param cur The cursor to use + */ +EAPI const char *edje_object_part_text_cursor_content_get (const Evas_Object *obj, const char *part, Edje_Cursor cur); + +/** + * @brief Sets the cursor position to the given value + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param cur The cursor to move + * @param pos the position of the cursor + * @since 1.1.0 + */ +EAPI void edje_object_part_text_cursor_pos_set (Evas_Object *obj, const char *part, Edje_Cursor cur, int pos); + +/** + * @brief Retrieves the current position of the cursor + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param cur The cursor to get the position + * @return The cursor position + * @since 1.1.0 + */ +EAPI int edje_object_part_text_cursor_pos_get (const Evas_Object *obj, const char *part, Edje_Cursor cur); + +/** + * Add a filter function for newly inserted text. + * + * Whenever text is inserted (not the same as set) into the given @p part, + * the list of filter functions will be called to decide if and how the new + * text will be accepted. + * There are three types of filters, EDJE_TEXT_FILTER_TEXT, + * EDJE_TEXT_FILTER_FORMAT and EDJE_TEXT_FILTER_MARKUP. + * The text parameter in the @p func filter can be modified by the user and + * it's up to him to free the one passed if he's to change the pointer. If + * doing so, the newly set text should be malloc'ed, as once all the filters + * are called Edje will free it. + * If the text is to be rejected, freeing it and setting the pointer to NULL + * will make Edje break out of the filter cycle and reject the inserted + * text. + * + * @see edje_object_text_insert_filter_callback_del + * @see edje_object_text_insert_filter_callback_del_full + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param func The callback function that will act as filter + * @param data User provided data to pass to the filter function + */ +EAPI void edje_object_text_insert_filter_callback_add (Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func, void *data); + +/** + * Delete a function from the filter list. + * + * Delete the given @p func filter from the list in @p part. Returns + * the user data pointer given when added. + * + * @see edje_object_text_insert_filter_callback_add + * @see edje_object_text_insert_filter_callback_del_full + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param func The function callback to remove + * + * @return The user data pointer if succesful, or NULL otherwise + */ +EAPI void *edje_object_text_insert_filter_callback_del (Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func); + +/** + * Delete a function and matching user data from the filter list. + * + * Delete the given @p func filter and @p data user data from the list + * in @p part. + * Returns the user data pointer given when added. + * + * @see edje_object_text_insert_filter_callback_add + * @see edje_object_text_insert_filter_callback_del + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param func The function callback to remove + * @param data The data passed to the callback function + * + * @return The same data pointer if succesful, or NULL otherwise + */ +EAPI void *edje_object_text_insert_filter_callback_del_full (Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func, void *data); + + +/** + * @brief Swallows an object into the edje. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param obj_swallow The object to swallow + * + * Swallows the object into the edje part so that all geometry changes + * for the part affect the swallowed object. (e.g. resize, move, show, + * raise/lower, etc.). + * + * If an object has already been swallowed into this part, then it + * will first be unswallowed before the new object is swallowed. + */ +EAPI Eina_Bool edje_object_part_swallow (Evas_Object *obj, const char *part, Evas_Object *obj_swallow); + +/** + * @brief Unswallow an object. + * + * @param obj A valid Evas_Object handle + * @param obj_swallow The swallowed object + * + * Causes the edje to regurgitate a previously swallowed object. :) + */ +EAPI void edje_object_part_unswallow (Evas_Object *obj, Evas_Object *obj_swallow); + +/** + * @brief Get the object currently swallowed by a part. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @return The swallowed object, or NULL if there is none. + */ +EAPI Evas_Object *edje_object_part_swallow_get (const Evas_Object *obj, const char *part); + +/** + * @brief Returns the state of the Edje part. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param val_ret + * + * @return The part state:\n + * "default" for the default state\n + * "" for other states + */ +EAPI const char *edje_object_part_state_get (const Evas_Object *obj, const char *part, double *val_ret); + +/** + * @brief Determine dragable directions. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * + * @return 0: Not dragable\n + * 1: Dragable in X direction\n + * 2: Dragable in Y direction\n + * 3: Dragable in X & Y directions + */ +EAPI Edje_Drag_Dir edje_object_part_drag_dir_get (const Evas_Object *obj, const char *part); + +/** + * @brief Set the dragable object location. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param dx The x value + * @param dy The y value + * + * Places the dragable object at the given location. + */ +EAPI Eina_Bool edje_object_part_drag_value_set (Evas_Object *obj, const char *part, double dx, double dy); + +/** + * @brief Get the dragable object location. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param dx The X value pointer + * @param dy The Y value pointer + * + * Gets the drag location values. + */ +EAPI Eina_Bool edje_object_part_drag_value_get (const Evas_Object *obj, const char *part, double *dx, double *dy); + +/** + * @brief Set the dragable object size. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param dw The drag width + * @param dh The drag height + * + * Sets the size of the dragable object. + */ +EAPI Eina_Bool edje_object_part_drag_size_set (Evas_Object *obj, const char *part, double dw, double dh); + +/** + * @brief Get the dragable object size. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param dw The drag width pointer + * @param dh The drag height pointer + * + * Gets the dragable object size. + */ +EAPI Eina_Bool edje_object_part_drag_size_get (const Evas_Object *obj, const char *part, double *dw, double *dh); + +/** + * @brief Sets the drag step increment. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param dx The x step amount + * @param dy The y step amount + * + * Sets the x,y step increments for a dragable object. + */ +EAPI Eina_Bool edje_object_part_drag_step_set (Evas_Object *obj, const char *part, double dx, double dy); + +/** + * @brief Gets the drag step increment values. + * + * @param obj A valid Evas_Object handle + * @param part The part + * @param dx The x step increment pointer + * @param dy The y step increment pointer + * + * Gets the x and y step increments for the dragable object. + */ +EAPI Eina_Bool edje_object_part_drag_step_get (const Evas_Object *obj, const char *part, double *dx, double *dy); + +/** + * @brief Sets the page step increments. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param dx The x page step increment + * @param dy The y page step increment + * + * Sets the x,y page step increment values. + */ +EAPI Eina_Bool edje_object_part_drag_page_set (Evas_Object *obj, const char *part, double dx, double dy); + +/** + * @brief Gets the page step increments. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param dx The dx page increment pointer + * @param dy The dy page increment pointer + * + * Gets the x,y page step increments for the dragable object. + */ +EAPI Eina_Bool edje_object_part_drag_page_get (const Evas_Object *obj, const char *part, double *dx, double *dy); + +/** + * @brief Steps the dragable x,y steps. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param dx The x step + * @param dy The y step + * + * Steps x,y where the step increment is the amount set by + * edje_object_part_drag_step_set. + */ +EAPI Eina_Bool edje_object_part_drag_step (Evas_Object *obj, const char *part, double dx, double dy); + +/** + * @brief Pages x,y steps. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param dx The x step + * @param dy The y step + * + * Pages x,y where the increment is defined by + * edje_object_part_drag_page_set.\n WARNING: Paging is bugged! + */ +EAPI Eina_Bool edje_object_part_drag_page (Evas_Object *obj, const char *part, double dx, double dy); + + +/** + * @brief Get the object created by this external part. + * + * Parts of type external creates the part object using information + * provided by external plugins. It's somehow like "swallow" + * (edje_object_part_swallow()), but it's all set automatically. + * + * This function returns the part created by such external plugins and + * being currently managed by this Edje. + * + * @note Almost all swallow rules apply: you should not move, resize, + * hide, show, set the color or clipper of such part. It's a bit + * more restrictive as one must @b never delete this object! + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @return The externally created object, or NULL if there is none or + * part is not an external. + */ +EAPI Evas_Object *edje_object_part_external_object_get (const Evas_Object *obj, const char *part); + +/** + * @brief Set the parameter for the external part. + * + * Parts of type external may carry extra properties that have + * meanings defined by the external plugin. For instance, it may be a + * string that defines a button label and setting this property will + * change that label on the fly. + * + * @note external parts have parameters set when they change + * states. Those parameters will never be changed by this + * function. The interpretation of how state_set parameters and + * param_set will interact is up to the external plugin. + * + * @note this function will not check if parameter value is valid + * using #Edje_External_Param_Info minimum, maximum, valid + * choices and others. However these should be checked by the + * underlying implementation provided by the external + * plugin. This is done for performance reasons. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param param the parameter details, including its name, type and + * actual value. This pointer should be valid, and the + * parameter must exist in + * #Edje_External_Type::parameters_info, with the exact type, + * otherwise the operation will fail and @c EINA_FALSE will be + * returned. + * + * @return @c EINA_TRUE if everything went fine, @c EINA_FALSE on errors. + */ +EAPI Eina_Bool edje_object_part_external_param_set (Evas_Object *obj, const char *part, const Edje_External_Param *param); + +/** + * @brief Get the parameter for the external part. + * + * Parts of type external may carry extra properties that have + * meanings defined by the external plugin. For instance, it may be a + * string that defines a button label. This property can be modifed by + * state parameters, by explicit calls to + * edje_object_part_external_param_set() or getting the actual object + * with edje_object_part_external_object_get() and calling native + * functions. + * + * This function asks the external plugin what is the current value, + * independent on how it was set. + * + * @param obj A valid Evas_Object handle + * @param part The part name + + * @param param the parameter details. It is used as both input and + * output variable. This pointer should be valid, and the + * parameter must exist in + * #Edje_External_Type::parameters_info, with the exact type, + * otherwise the operation will fail and @c EINA_FALSE will be + * returned. + * + * @return @c EINA_TRUE if everything went fine and @p param members + * are filled with information, @c EINA_FALSE on errors and @p + * param member values are not set or valid. + */ +EAPI Eina_Bool edje_object_part_external_param_get (const Evas_Object *obj, const char *part, Edje_External_Param *param); + +EAPI Evas_Object *edje_object_part_external_content_get (const Evas_Object *obj, const char *part, const char *content); + +/** + * Facility to query the type of the given parameter of the given part. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param param the parameter name to use. + * + * @return @c EDJE_EXTERNAL_PARAM_TYPE_MAX on errors, or another value + * from #Edje_External_Param_Type on success. + */ +EAPI Edje_External_Param_Type edje_object_part_external_param_type_get (const Evas_Object *obj, const char *part, const char *param); + + +/** + * @brief Appends an object to the box. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param child The object to append + * + * @return 1: Successfully added.\n + * 0: An error occurred. + * + * Appends child to the box indicated by part. + */ +EAPI Eina_Bool edje_object_part_box_append (Evas_Object *obj, const char *part, Evas_Object *child); + +/** + * @brief Prepends an object to the box. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param child The object to prepend + * + * @return 1: Successfully added.\n + * 0: An error occurred. + * + * Prepends child to the box indicated by part. + */ +EAPI Eina_Bool edje_object_part_box_prepend (Evas_Object *obj, const char *part, Evas_Object *child); + +/** + * @brief Adds an object to the box. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param child The object to insert + * @param reference The object to be used as reference + * + * @return 1: Successfully added.\n + * 0: An error occurred. + * + * Inserts child in the box given by part, in the position marked by + * reference. + */ +EAPI Eina_Bool edje_object_part_box_insert_before (Evas_Object *obj, const char *part, Evas_Object *child, const Evas_Object *reference); + +/** + * @brief Inserts an object to the box. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param child The object to insert + * @param pos The position where to insert child + * + * @return 1: Successfully added.\n + * 0: An error occurred. + * + * Adds child to the box indicated by part, in the position given by + * pos. + */ +EAPI Eina_Bool edje_object_part_box_insert_at (Evas_Object *obj, const char *part, Evas_Object *child, unsigned int pos); + +/** + * @brief Removes an object from the box. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param child The object to remove + * + * @return Pointer to the object removed, or NULL. + * + * Removes child from the box indicated by part. + */ +EAPI Evas_Object *edje_object_part_box_remove (Evas_Object *obj, const char *part, Evas_Object *child); + +/** + * @brief Removes an object from the box. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param pos + * + * @return Pointer to the object removed, or NULL. + * + * Removes from the box indicated by part, the object in the position + * pos. + */ +EAPI Evas_Object *edje_object_part_box_remove_at (Evas_Object *obj, const char *part, unsigned int pos); + +/** + * @brief Removes all elements from the box. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param clear Delete objects on removal + * + * @return 1: Successfully cleared.\n + * 0: An error occurred. + * + * Removes all the external objects from the box indicated by part. + * Elements created from the theme will not be removed. + */ +EAPI Eina_Bool edje_object_part_box_remove_all (Evas_Object *obj, const char *part, Eina_Bool clear); + +/** + * @brief Retrieve a child from a table + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param col The column of the child to get + * @param row The row of the child to get + * @return The child Evas_Object + */ +EAPI Evas_Object *edje_object_part_table_child_get (Evas_Object *obj, const char *part, unsigned int col, unsigned int row); + +/** + * @brief Packs an object into the table. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param child_obj The object to pack in + * @param col The column to place it in + * @param row The row to place it in + * @param colspan Columns the child will take + * @param rowspan Rows the child will take + * + * @return 1: Successfully added.\n + * 0: An error occurred. + * + * Packs an object into the table indicated by part. + */ +EAPI 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); + +/** + * @brief Removes an object from the table. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param child_obj The object to pack in + * + * @return 1: Successfully removed.\n + * 0: An error occurred. + * + * Removes an object from the table indicated by part. + */ +EAPI Eina_Bool edje_object_part_table_unpack (Evas_Object *obj, const char *part, Evas_Object *child_obj); + +/** + * @brief Gets the number of columns and rows the table has. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param cols Pointer where to store number of columns (can be NULL) + * @param rows Pointer where to store number of rows (can be NULL) + * + * @return 1: Successfully get some data.\n + * 0: An error occurred. + * + * Retrieves the size of the table in number of columns and rows. + */ +EAPI Eina_Bool edje_object_part_table_col_row_size_get (const Evas_Object *obj, const char *part, int *cols, int *rows); + +/** + * @brief Removes all object from the table. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param clear If set, will delete subobjs on remove + * + * @return 1: Successfully clear table.\n + * 0: An error occurred. + * + * Removes all object from the table indicated by part, except the + * internal ones set from the theme. + */ +EAPI Eina_Bool edje_object_part_table_clear (Evas_Object *obj, const char *part, Eina_Bool clear); + +/** + * @brief Send message to object. + * + * @param obj The edje object reference. + * @param type The type of message to send. + * @param id A identification number for the message. + * @param msg The message to be send. + * + * + * This function sends messages to this object and to all of its child + * objects, if applicable. The function that handles messages arriving + * at this edje object is is set with + * edje_object_message_handler_set(). + * + * @see edje_object_message_handler_set() + * + */ +EAPI void edje_object_message_send (Evas_Object *obj, Edje_Message_Type type, int id, void *msg); + +/** + * @brief Set the message handler function for this an object. + * + * @param obj The edje object reference. + * @param func The function to handle messages. + * @param data The data to be associated to the message handler. + * + * + * This function associates a message handler function and data to the + * edje object. + * + */ +EAPI void edje_object_message_handler_set (Evas_Object *obj, Edje_Message_Handler_Cb func, void *data); + +/** + * @brief Process an object's message queue. + * + * @param obj The edje object reference. + * + * This function goes through the object message queue processing the + * pending messages for *this* specific edje object. Normally they'd + * be processed only at idle time. + * + */ +EAPI void edje_object_message_signal_process (Evas_Object *obj); + + +/** + * @brief Process all queued up edje messages. + * + * This function triggers the processing of messages addressed to any + * (alive) edje objects. + * + */ +EAPI void edje_message_signal_process (void); + +/** + * Register given type name to return the given information. + * + * @param type_name name to register and be known by edje's "source:" + * parameter of "type: EXTERNAL" parts. + * @param type_info meta-information describing how to interact with it. + * + * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (like + * type already registered). + * + * @see edje_external_type_array_register() + */ +EAPI Eina_Bool edje_external_type_register (const char *type_name, const Edje_External_Type *type_info); + +/** + * Unregister given type name previously registered. + * + * @param type_name name to unregister. It should be registered with + * edje_external_type_register() before. + * + * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (like + * type_name did not exist). + * + * @see edje_external_type_array_unregister() + */ +EAPI Eina_Bool edje_external_type_unregister (const char *type_name); + +/** + * Register a batch of types and their information. + * + * This is the recommended function to add information as it's faster + * than the single version edje_external_type_register(). + * + * @note the given array is not modified, but the type name strings + * are @b not duplicated! That is, all type names must be @b + * live until they are unregistered! This was chosen to save + * some memory and most people will just define the array as a + * global static const type anyway. + * + * @param array @c NULL terminated array with type name and + * information. Note that type name or information are not + * modified by are @b referenced, so they must keep alive after + * this function returns! + * + * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (like + * type already registered). + * + * @see edje_external_type_register() + */ +EAPI void edje_external_type_array_register (const Edje_External_Type_Info *array); + +/** + * Unregister a batch of given external type previously registered. + * + * @param array @c NULL terminated array, should be the same as the + * one used to register with edje_external_type_array_register() + * + * @see edje_external_type_unregister() + */ +EAPI void edje_external_type_array_unregister (const Edje_External_Type_Info *array); + + +/** + * Return the current ABI version for Edje_External_Type structure. + * + * Always check this number before accessing Edje_External_Type in + * your own software. If the number is not the same, your software may + * access invalid memory and crash, or just get garbage values. + * + * @warning @b NEVER, EVER define your own Edje_External_Type using the + * return of this function as it will change as Edje library + * (libedje.so) changes, but your type definition will + * not. Instead, use #EDJE_EXTERNAL_TYPE_ABI_VERSION. + * + * Summary: + * - use edje_external_type_abi_version_get() to check. + * - use #EDJE_EXTERNAL_TYPE_ABI_VERSION to define/declare. + * + * @return version this edje library was compiled. + */ +EAPI unsigned int edje_external_type_abi_version_get (void) EINA_CONST; + + + +/** + * Returns an iterator that emits Eina_Hash_Tuple pointers with key + * being the name and data being the Edje_External_Type pointer. + * + * @code + * const Eina_Hash_Tuple *tuple; + * Eina_Iterator *itr; + * const Eina_List *l, *modules; + * const char *s; + * + * modules = edje_available_modules_get(); + * EINA_LIST_FOREACH(modules, l, s) + * { + * if (!edje_module_load(s)) + * printf("Error loading edje module: %s\n", s); + * } + * + * itr = edje_external_iterator_get(); + * EINA_ITERATOR_FOREACH(itr, tuple) + * { + * const char *name = tuple->key; + * const Edje_External_Type *type = tuple->data; + * + * if ((!type) || + * (type->abi_version != edje_external_type_abi_version_get())) + * { + * printf("Error: invalid type %p (abi: %d, expected: %d)\n", + * type, type ? type->abi_version : 0, + * edje_external_type_abi_version_get()); + * continue; + * } + * + * printf("%s: %s (%s) label='%s' desc='%s'\n", + * name, type->module, type->module_name, + * type->label_get ? type->label_get(type->data) : "", + * type->description_get ? type->description_get(type->data) : ""); + * } + * + * @endcode + */ +EAPI Eina_Iterator *edje_external_iterator_get (void); + + EAPI Edje_External_Param *edje_external_param_find (const Eina_List *params, const char *key); + EAPI Eina_Bool edje_external_param_int_get (const Eina_List *params, const char *key, int *ret); + EAPI Eina_Bool edje_external_param_double_get (const Eina_List *params, const char *key, double *ret); + EAPI Eina_Bool edje_external_param_string_get (const Eina_List *params, const char *key, const char **ret); + EAPI Eina_Bool edje_external_param_bool_get (const Eina_List *params, const char *key, Eina_Bool *ret); + EAPI Eina_Bool edje_external_param_choice_get (const Eina_List *params, const char *key, const char **ret); + +/** + * Get the array of parameters information about a type given its name. + * + * @note the type names and other strings are static, that means they + * @b NOT translated. One must use + * Edje_External_Type::translate() to translate those. + * + * @return the NULL terminated array, or @c NULL if type is unknown or + * it does not have any parameter information. + * + * @see edje_external_type_get() + */ +EAPI const Edje_External_Param_Info *edje_external_param_info_get (const char *type_name); + + EAPI const Edje_External_Type *edje_external_type_get (const char *type_name); + + EAPI Eina_Bool edje_module_load (const char *module); + EAPI const Eina_List *edje_available_modules_get (void); + + /* perspective info for maps inside edje objects */ + typedef struct _Edje_Perspective Edje_Perspective; + + EAPI Edje_Perspective *edje_perspective_new (Evas *e); + EAPI void edje_perspective_free (Edje_Perspective *ps); + EAPI void edje_perspective_set (Edje_Perspective *ps, Evas_Coord px, Evas_Coord py, Evas_Coord z0, Evas_Coord foc); + EAPI void edje_perspective_global_set (Edje_Perspective *ps, Eina_Bool global); + EAPI Eina_Bool edje_perspective_global_get (const Edje_Perspective *ps); + EAPI const Edje_Perspective *edje_evas_global_perspective_get(const Evas *e); + EAPI void edje_object_perspective_set (Evas_Object *obj, Edje_Perspective *ps); + EAPI const Edje_Perspective *edje_object_perspective_get (const Evas_Object *obj); - /* perspective info for maps inside edje objects */ - typedef struct _Edje_Perspective Edje_Perspective; - - EAPI Edje_Perspective *edje_perspective_new (Evas *e); - EAPI void edje_perspective_free (Edje_Perspective *ps); - EAPI void edje_perspective_set (Edje_Perspective *ps, Evas_Coord px, Evas_Coord py, Evas_Coord z0, Evas_Coord foc); - EAPI void edje_perspective_global_set (Edje_Perspective *ps, Eina_Bool global); - EAPI Eina_Bool edje_perspective_global_get (const Edje_Perspective *ps); - EAPI const Edje_Perspective *edje_evas_global_perspective_get(const Evas *e); - EAPI void edje_object_perspective_set (Evas_Object *obj, Edje_Perspective *ps); - EAPI const Edje_Perspective *edje_object_perspective_get (const Evas_Object *obj); - #ifdef __cplusplus } #endif diff --git a/src/lib/Edje_Edit.h b/src/lib/Edje_Edit.h index 35c2ec6..935d661 100644 --- a/src/lib/Edje_Edit.h +++ b/src/lib/Edje_Edit.h @@ -191,6 +191,24 @@ EAPI void edje_edit_print_internal_status(Evas_Object *obj); * @return EINA_TRUE if successfully added the group, EINA_FALSE if an error * occurred or if a group with the same name exists. */ + +/** + * @brief Add an edje (empty) group to an edje object's group set. + * + * @param obj The pointer to edje object. + * @param name The name of the group. + * + * @return 1 If it could allocate memory to the part group added + * or zero if not. + * + * This function adds, at run time, one more group, which will reside + * in memory, to the group set found in the .edj file which @a obj was + * loaded with. This group can be manipulated by other API functions, + * like @c edje_edit_part_add(), for example. If desired, the new + * group can be actually committed the respective .edj by use of @c + * edje_edit_save(). + * + */ EAPI Eina_Bool edje_edit_group_add(Evas_Object *obj, const char *name); /** Delete the specified group from the given edje. @@ -204,6 +222,21 @@ EAPI Eina_Bool edje_edit_group_add(Evas_Object *obj, const char *name); * * @return EINA_TRUE if successful, EINA_FALSE otherwise. */ + +/** + * @brief Delete the specified group from the edje file. + * + * @param obj The pointer to the edje object. + * @param group_name Group to delete. + * + * @return @c EINA_TRUE on success, @c EINA_FALSE on failure. + * + * This function deletes the given group from the file @a obj is set to. This + * operation can't be undone as all references to the group are removed from + * the file. + * This function may fail if the group to be deleted is currently in use. + * + */ EAPI Eina_Bool edje_edit_group_del(Evas_Object *obj, const char *group_name); /** Check if a group with the given name exist in the edje. @@ -2027,6 +2060,18 @@ EAPI Eina_Bool edje_edit_state_external_param_choice_get(Evas_Object *obj, const * * @return EINA_TRUE if it was set, EINA_FALSE otherwise. */ + +/** + * Arguments should have proper sized values matching their types: + * - EDJE_EXTERNAL_PARAM_TYPE_INT: int + * - EDJE_EXTERNAL_PARAM_TYPE_BOOL: int + * - EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: double + * - EDJE_EXTERNAL_PARAM_TYPE_STRING: char* + * - EDJE_EXTERNAL_PARAM_TYPE_CHOICE: char* + * + * @note: The validation of the parameter will occur only if the part + * is in the same state as the one being modified. + */ EAPI 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, ...); /** Set external parameter of type INT. diff --git a/src/lib/edje_cache.c b/src/lib/edje_cache.c index b463a8a..a8b355f 100644 --- a/src/lib/edje_cache.c +++ b/src/lib/edje_cache.c @@ -76,6 +76,33 @@ _edje_file_coll_open(Edje_File *edf, const char *coll) edc->references = 1; edc->part = ce->entry; + /* For Edje file build with Edje 1.0, people expect text.align to be 0.0 0.0 */ + if (edf->version <= 3 && edf->minor <= 1) + { + /* This will preserve previous rendering */ + unsigned int i; + + for (i = 0; i < edc->parts_count; ++i) + { + if (edc->parts[i]->type == EDJE_PART_TYPE_TEXTBLOCK) + { + Edje_Part_Description_Text *text; + unsigned int j; + + text = (Edje_Part_Description_Text*) edc->parts[i]->default_desc; + text->text.align.x = TO_DOUBLE(0.0); + text->text.align.y = TO_DOUBLE(0.0); + + for (j = 0; j < edc->parts[i]->other.desc_count; ++j) + { + text = (Edje_Part_Description_Text*) edc->parts[i]->other.desc[j]; + text->text.align.x = TO_DOUBLE(0.0); + text->text.align.y = TO_DOUBLE(0.0); + } + } + } + } + snprintf(buf, sizeof(buf), "edje/scripts/embryo/compiled/%i", id); data = eet_read(edf->ef, buf, &size); @@ -477,29 +504,6 @@ _edje_file_cache_shutdown(void) * API * *============================================================================*/ -/** - * @addtogroup Edje_cache_Group Cache - * - * @brief These functions provide an abstraction layer between the - * application code and the interface, while allowing extremely - * flexible dynamic layouts and animations. - * - * @{ - */ - -/** - * @brief Set the file cache size. - * - * @param count The file cache size in edje file units. Default is 16. - * - * This function sets the file cache size. Edje keeps this cache in - * order to prevent duplicates of edje file entries in memory. The - * file cache size can be retrieved with edje_file_cache_get(). - * - * @see edje_file_cache_get() - * @see edje_file_cache_flush() - * - */ EAPI void edje_file_cache_set(int count) @@ -509,18 +513,6 @@ edje_file_cache_set(int count) _edje_cache_file_clean(); } -/** - * @brief Return the file cache size. - * - * @return The file cache size in edje file units. Default is 16. - * - * This function returns the file cache size set by - * edje_file_cache_set(). - * - * @see edje_file_cache_set() - * @see edje_file_cache_flush() - * - */ EAPI int edje_file_cache_get(void) @@ -528,16 +520,6 @@ edje_file_cache_get(void) return _edje_file_cache_size; } -/** - * @brief Clean the file cache. - * - * This function cleans the file cache entries, but keeps this cache's - * size to the last value set. - * - * @see edje_file_cache_set() - * @see edje_file_cache_get() - * - */ EAPI void edje_file_cache_flush(void) @@ -550,20 +532,6 @@ edje_file_cache_flush(void) _edje_file_cache_size = ps; } -/** - * @brief Set the collection cache size. - * - * @param count The collection cache size, in edje object units. Default is 16. - * - * This function sets the collection cache size. Edje keeps this cache - * in order to prevent duplicates of edje {collection,group,part} - * entries in memory. The collection cache size can be retrieved with - * edje_collection_cache_get(). - * - * @see edje_collection_cache_get() - * @see edje_collection_cache_flush() - * - */ EAPI void edje_collection_cache_set(int count) @@ -578,18 +546,6 @@ edje_collection_cache_set(int count) /* FIXME: freach in file hash too! */ } -/** - * @brief Return the collection cache size. - * - * @return The collection cache size, in edje object units. Default is 16. - * - * This function returns the collection cache size set by - * edje_collection_cache_set(). - * - * @see edje_collection_cache_set() - * @see edje_collection_cache_flush() - * - */ EAPI int edje_collection_cache_get(void) @@ -597,16 +553,6 @@ edje_collection_cache_get(void) return _edje_collection_cache_size; } -/** - * @brief Clean the collection cache. - * - * This function cleans the collection cache, but keeps this cache's - * size to the last value set. - * - * @see edje_collection_cache_set() - * @see edje_collection_cache_get() - * - */ EAPI void edje_collection_cache_flush(void) @@ -622,8 +568,3 @@ edje_collection_cache_flush(void) /* FIXME: freach in file hash too! */ _edje_collection_cache_size = ps; } - -/** - * - * @} - */ diff --git a/src/lib/edje_calc.c b/src/lib/edje_calc.c index b9704d0..0c6db79 100644 --- a/src/lib/edje_calc.c +++ b/src/lib/edje_calc.c @@ -16,7 +16,7 @@ static void _edje_part_recalc_single(Edje *ed, Edje_Real_Part *ep, static void _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags); void -_edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, FLOAT_T pos) +_edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, FLOAT_T pos, FLOAT_T v1, FLOAT_T v2) { FLOAT_T fp_pos; FLOAT_T npos; @@ -26,6 +26,7 @@ _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, FLOAT_T pos) fp_pos = pos; npos = ZERO; +#if 0 // old code - easy to enable for comparing float vs fixed point /* take linear pos along timescale and use interpolation method */ switch (mode) { @@ -51,8 +52,69 @@ _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, FLOAT_T pos) npos = fp_pos; break; default: - break; + npos = fp_pos; + break; } +#else + switch (mode) + { + case EDJE_TWEEN_MODE_SINUSOIDAL: + npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), + ECORE_POS_MAP_SINUSOIDAL, + 0.0, 0.0)); + break; + case EDJE_TWEEN_MODE_ACCELERATE: + npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), + ECORE_POS_MAP_ACCELERATE, + 0.0, 0.0)); + break; + case EDJE_TWEEN_MODE_DECELERATE: + npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), + ECORE_POS_MAP_DECELERATE, + 0.0, 0.0)); + break; + case EDJE_TWEEN_MODE_LINEAR: + npos = fp_pos; +/* npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), + ECORE_POS_MAP_LINEAR, + 0.0, 0.0)); + */ + break; + case EDJE_TWEEN_MODE_ACCELERATE_FACTOR: + npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), + ECORE_POS_MAP_ACCELERATE_FACTOR, + TO_DOUBLE(v1), 0.0)); + break; + case EDJE_TWEEN_MODE_DECELERATE_FACTOR: + npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), + ECORE_POS_MAP_DECELERATE_FACTOR, + TO_DOUBLE(v1), 0.0)); + break; + case EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR: + npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), + ECORE_POS_MAP_SINUSOIDAL_FACTOR, + TO_DOUBLE(v1), 0.0)); + break; + case EDJE_TWEEN_MODE_DIVISOR_INTERP: + npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), + ECORE_POS_MAP_DIVISOR_INTERP, + TO_DOUBLE(v1), TO_DOUBLE(v2))); + break; + case EDJE_TWEEN_MODE_BOUNCE: + npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), + ECORE_POS_MAP_BOUNCE, + TO_DOUBLE(v1), TO_DOUBLE(v2))); + break; + case EDJE_TWEEN_MODE_SPRING: + npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), + ECORE_POS_MAP_SPRING, + TO_DOUBLE(v1), TO_DOUBLE(v2))); + break; + default: + npos = fp_pos; + break; + } +#endif if (npos == ep->description_pos) return; ep->description_pos = npos; @@ -1033,7 +1095,9 @@ _edje_part_recalc_single_text(FLOAT_T sc, (chosen_desc->text.max_x) || (chosen_desc->text.max_y)) { int mw, mh; - Evas_Text_Style_Type style; + Evas_Text_Style_Type + style = EVAS_TEXT_STYLE_PLAIN, + shadow = EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT; const Evas_Text_Style_Type styles[] = { EVAS_TEXT_STYLE_PLAIN, EVAS_TEXT_STYLE_PLAIN, @@ -1047,12 +1111,24 @@ _edje_part_recalc_single_text(FLOAT_T sc, EVAS_TEXT_STYLE_FAR_SOFT_SHADOW, EVAS_TEXT_STYLE_GLOW }; - - if (ep->part->effect < EDJE_TEXT_EFFECT_LAST) + const Evas_Text_Style_Type shadows[] = { + EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT, + EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM, + EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_LEFT, + EVAS_TEXT_STYLE_SHADOW_DIRECTION_LEFT, + EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_LEFT, + EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP, + EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT, + EVAS_TEXT_STYLE_SHADOW_DIRECTION_RIGHT + }; + + if ((ep->part->effect & EVAS_TEXT_STYLE_MASK_BASIC) + < EDJE_TEXT_EFFECT_LAST) style = styles[ep->part->effect]; - else - style = EVAS_TEXT_STYLE_PLAIN; - + shadow = shadows + [(ep->part->effect & EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION) >> 4]; + EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(style, shadow); + evas_object_text_style_set(ep->object, style); evas_object_text_text_set(ep->object, text); evas_object_geometry_get(ep->object, NULL, NULL, &tw, &th); @@ -1470,6 +1546,43 @@ _edje_part_recalc_single(Edje *ed, _edje_part_recalc_single_textblock(sc, ed, ep, (Edje_Part_Description_Text*) chosen_desc, params, &minw, &minh, &maxw, &maxh); else if (ep->part->type == EDJE_PART_TYPE_TEXT) _edje_part_recalc_single_text(sc, ed, ep, (Edje_Part_Description_Text*) desc, (Edje_Part_Description_Text*) chosen_desc, params, &minw, &minh, &maxw, &maxh); + + if ((ep->part->type == EDJE_PART_TYPE_TABLE) && + (((((Edje_Part_Description_Table *)chosen_desc)->table.min.h) || + (((Edje_Part_Description_Table *)chosen_desc)->table.min.v)))) + { + Evas_Coord lminw = 0, lminh = 0; + + evas_object_smart_need_recalculate_set(ep->object, 1); + evas_object_smart_calculate(ep->object); + evas_object_size_hint_min_get(ep->object, &lminw, &lminh); + if (((Edje_Part_Description_Table *)chosen_desc)->table.min.h) + { + if (lminw > minw) minw = lminw; + } + if (((Edje_Part_Description_Table *)chosen_desc)->table.min.v) + { + if (lminh > minh) minh = lminh; + } + } + else if ((ep->part->type == EDJE_PART_TYPE_BOX) && + ((((Edje_Part_Description_Box *)chosen_desc)->box.min.h) || + (((Edje_Part_Description_Box *)chosen_desc)->box.min.v))) + { + Evas_Coord lminw = 0, lminh = 0; + + evas_object_smart_need_recalculate_set(ep->object, 1); + evas_object_smart_calculate(ep->object); + evas_object_size_hint_min_get(ep->object, &lminw, &lminh); + if (((Edje_Part_Description_Box *)chosen_desc)->box.min.h) + { + if (lminw > minw) minw = lminw; + } + if (((Edje_Part_Description_Box *)chosen_desc)->box.min.v) + { + if (lminh > minh) minh = lminh; + } + } /* remember what our size is BEFORE we go limit it */ params->req.x = params->x; @@ -1848,7 +1961,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) Edje_Calc_Params *p1, *pf; Edje_Part_Description_Common *chosen_desc; Edje_Real_Part *confine_to = NULL; - FLOAT_T pos = ZERO; + FLOAT_T pos = ZERO, pos2; Edje_Calc_Params lp3; /* GRADIENT ARE GONE, WE MUST IGNORE IT FROM OLD FILE. */ @@ -2047,6 +2160,9 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) } pos = ep->description_pos; + pos2 = pos; + if (pos2 < ZERO) pos2 = ZERO; + else if (pos2 > FROM_INT(1)) pos2 = FROM_INT(1); beginning_pos = (pos < FROM_DOUBLE(0.5)); part_type = ep->part->type; @@ -2095,10 +2211,10 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) p3->req_drag.h = INTP(p1->req_drag.h, p2->req_drag.h, pos); } - p3->color.r = INTP(p1->color.r, p2->color.r, pos); - p3->color.g = INTP(p1->color.g, p2->color.g, pos); - p3->color.b = INTP(p1->color.b, p2->color.b, pos); - p3->color.a = INTP(p1->color.a, p2->color.a, pos); + p3->color.r = INTP(p1->color.r, p2->color.r, pos2); + p3->color.g = INTP(p1->color.g, p2->color.g, pos2); + p3->color.b = INTP(p1->color.b, p2->color.b, pos2); + p3->color.a = INTP(p1->color.a, p2->color.a, pos2); switch (part_type) { @@ -2116,19 +2232,19 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) case EDJE_PART_TYPE_TEXT: p3->type.text.size = INTP(p1->type.text.size, p2->type.text.size, pos); case EDJE_PART_TYPE_TEXTBLOCK: - p3->type.text.color2.r = INTP(p1->type.text.color2.r, p2->type.text.color2.r, pos); - p3->type.text.color2.g = INTP(p1->type.text.color2.g, p2->type.text.color2.g, pos); - p3->type.text.color2.b = INTP(p1->type.text.color2.b, p2->type.text.color2.b, pos); - p3->type.text.color2.a = INTP(p1->type.text.color2.a, p2->type.text.color2.a, pos); + p3->type.text.color2.r = INTP(p1->type.text.color2.r, p2->type.text.color2.r, pos2); + p3->type.text.color2.g = INTP(p1->type.text.color2.g, p2->type.text.color2.g, pos2); + p3->type.text.color2.b = INTP(p1->type.text.color2.b, p2->type.text.color2.b, pos2); + p3->type.text.color2.a = INTP(p1->type.text.color2.a, p2->type.text.color2.a, pos2); - p3->type.text.color3.r = INTP(p1->type.text.color3.r, p2->type.text.color3.r, pos); - p3->type.text.color3.g = INTP(p1->type.text.color3.g, p2->type.text.color3.g, pos); - p3->type.text.color3.b = INTP(p1->type.text.color3.b, p2->type.text.color3.b, pos); - p3->type.text.color3.a = INTP(p1->type.text.color3.a, p2->type.text.color3.a, pos); + p3->type.text.color3.r = INTP(p1->type.text.color3.r, p2->type.text.color3.r, pos2); + p3->type.text.color3.g = INTP(p1->type.text.color3.g, p2->type.text.color3.g, pos2); + p3->type.text.color3.b = INTP(p1->type.text.color3.b, p2->type.text.color3.b, pos2); + p3->type.text.color3.a = INTP(p1->type.text.color3.a, p2->type.text.color3.a, pos2); p3->type.text.align.x = FFP(p1->type.text.align.x, p2->type.text.align.x, pos); p3->type.text.align.y = FFP(p1->type.text.align.y, p2->type.text.align.y, pos); - p3->type.text.elipsis = TO_DOUBLE(FINTP(p1->type.text.elipsis, p2->type.text.elipsis, pos)); + p3->type.text.elipsis = TO_DOUBLE(FINTP(p1->type.text.elipsis, p2->type.text.elipsis, pos2)); break; } @@ -2266,6 +2382,9 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) desc2 = NULL; if (ep->param2) desc2 = ep->param2->description; pos = ep->description_pos; + pos2 = pos; + if (pos2 < ZERO) pos2 = ZERO; + else if (pos2 > FROM_INT(1)) pos2 = FROM_INT(1); ed->have_mapped_part = 1; // create map and populate with part geometry @@ -2376,7 +2495,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) if (ep2) { Edje_Part_Description_Common *ep2desc1, *ep2desc2; - FLOAT_T ep2pos; + FLOAT_T ep2pos, ep2pos2; do1 = 1; if (!ep2->calculated) @@ -2385,6 +2504,9 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) ep2desc2 = NULL; if (ep2->param2) ep2desc2 = ep2->param2->description; ep2pos = ep2->description_pos; + ep2pos2 = ep2pos; + if (ep2pos2 < ZERO) ep2pos2 = ZERO; + else if (ep2pos2 > FROM_INT(1)) ep2pos2 = FROM_INT(1); // light x and y are already interpolated in part geom lx1 = ed->x + ep2->x + (ep2->w / 2); @@ -2396,22 +2518,22 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) TO_INT(SCALE(ep2pos, ep2desc2->persp.zplane - ep2desc1->persp.zplane)); lr1 = ep2desc1->color.r + - TO_INT(SCALE(ep2pos, ep2desc2->color.r - + TO_INT(SCALE(ep2pos2, ep2desc2->color.r - ep2desc1->color.r)); lg1 = ep2desc1->color.g + - TO_INT(SCALE(ep2pos, ep2desc2->color.g - + TO_INT(SCALE(ep2pos2, ep2desc2->color.g - ep2desc1->color.b)); lb1 = ep2desc1->color.b + - TO_INT(SCALE(ep2pos, ep2desc2->color.g - + TO_INT(SCALE(ep2pos2, ep2desc2->color.g - ep2desc1->color.b)); lar1 = ep2desc1->color2.r + - TO_INT(SCALE(ep2pos, ep2desc2->color2.r - + TO_INT(SCALE(ep2pos2, ep2desc2->color2.r - ep2desc1->color2.r)); lag1 = ep2desc1->color2.g + - TO_INT(SCALE(ep2pos, ep2desc2->color2.g - + TO_INT(SCALE(ep2pos2, ep2desc2->color2.g - ep2desc1->color2.b)); lab1 = ep2desc1->color2.b + - TO_INT(SCALE(ep2pos, ep2desc2->color2.g - + TO_INT(SCALE(ep2pos2, ep2desc2->color2.g - ep2desc1->color2.b)); } else @@ -2437,7 +2559,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) if (ep2) { Edje_Part_Description_Common *ep2desc1, *ep2desc2; - FLOAT_T ep2pos; + FLOAT_T ep2pos, ep2pos2; do2 = 1; if (!ep2->calculated) @@ -2446,6 +2568,9 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) ep2desc2 = NULL; if (ep2->param2) ep2desc2 = ep2->param2->description; ep2pos = ep2->description_pos; + ep2pos2 = ep2pos; + if (ep2pos2 < ZERO) ep2pos2 = ZERO; + else if (ep2pos2 > FROM_INT(1)) ep2pos2 = FROM_INT(1); // light x and y are already interpolated in part geom lx2 = ed->x + ep2->x + (ep2->w / 2); @@ -2457,22 +2582,22 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) TO_INT(SCALE(ep2pos, ep2desc2->persp.zplane - ep2desc1->persp.zplane)); lr2 = ep2desc1->color.r + - TO_INT(SCALE(ep2pos, ep2desc2->color.r - + TO_INT(SCALE(ep2pos2, ep2desc2->color.r - ep2desc1->color.r)); lg2 = ep2desc1->color.g + - TO_INT(SCALE(ep2pos, ep2desc2->color.g - + TO_INT(SCALE(ep2pos2, ep2desc2->color.g - ep2desc1->color.b)); lb2 = ep2desc1->color.b + - TO_INT(SCALE(ep2pos, ep2desc2->color.g - + TO_INT(SCALE(ep2pos2, ep2desc2->color.g - ep2desc1->color.b)); lar2 = ep2desc1->color2.r + - TO_INT(SCALE(ep2pos, ep2desc2->color2.r - + TO_INT(SCALE(ep2pos2, ep2desc2->color2.r - ep2desc1->color2.r)); lag2 = ep2desc1->color2.g + - TO_INT(SCALE(ep2pos, ep2desc2->color2.g - + TO_INT(SCALE(ep2pos2, ep2desc2->color2.g - ep2desc1->color2.b)); lab2 = ep2desc1->color2.b + - TO_INT(SCALE(ep2pos, ep2desc2->color2.g - + TO_INT(SCALE(ep2pos2, ep2desc2->color2.g - ep2desc1->color2.b)); } else @@ -2492,12 +2617,12 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) lx = lx1 + TO_INT(SCALE(pos, lx2 - lx1)); ly = ly1 + TO_INT(SCALE(pos, ly2 - ly1)); lz = lz1 + TO_INT(SCALE(pos, lz2 - lz1)); - lr = lr1 + TO_INT(SCALE(pos, lr2 - lr1)); - lg = lg1 + TO_INT(SCALE(pos, lg2 - lg1)); - lb = lb1 + TO_INT(SCALE(pos, lb2 - lb1)); - lar = lar1 + TO_INT(SCALE(pos, lar2 - lar1)); - lag = lag1 + TO_INT(SCALE(pos, lag2 - lag1)); - lab = lab1 + TO_INT(SCALE(pos, lab2 - lab1)); + lr = lr1 + TO_INT(SCALE(pos2, lr2 - lr1)); + lg = lg1 + TO_INT(SCALE(pos2, lg2 - lg1)); + lb = lb1 + TO_INT(SCALE(pos2, lb2 - lb1)); + lar = lar1 + TO_INT(SCALE(pos2, lar2 - lar1)); + lag = lag1 + TO_INT(SCALE(pos2, lag2 - lag1)); + lab = lab1 + TO_INT(SCALE(pos2, lab2 - lab1)); } else if (do1) { diff --git a/src/lib/edje_data.c b/src/lib/edje_data.c index ea4bb24..48559ba 100644 --- a/src/lib/edje_data.c +++ b/src/lib/edje_data.c @@ -373,6 +373,8 @@ _edje_edd_init(void) EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "value2", value2, EET_T_DOUBLE); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "tween.mode", tween.mode, EET_T_INT); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "tween.time", tween.time, EDJE_T_FLOAT); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "v1", tween.v1, EDJE_T_FLOAT); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "v2", tween.v2, EDJE_T_FLOAT); EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_program, Edje_Program, "targets", targets, _edje_edd_edje_program_target); EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_program, Edje_Program, "after", after, _edje_edd_edje_program_after); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "api.name", api.name, EET_T_STRING); @@ -663,6 +665,8 @@ _edje_edd_init(void) EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, "table.align.y", table.align.y, EDJE_T_FLOAT); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, "table.padding.x", table.padding.x, EET_T_INT); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, "table.padding.y", table.padding.y, EET_T_INT); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, "table.min.h", table.min.h, EET_T_UCHAR); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, "table.min.v", table.min.v, EET_T_UCHAR); EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_External); eddc.func.mem_free = mem_free_external; diff --git a/src/lib/edje_edit.c b/src/lib/edje_edit.c index a4be7d2..ef0ffa4 100644 --- a/src/lib/edje_edit.c +++ b/src/lib/edje_edit.c @@ -955,23 +955,6 @@ edje_edit_compiler_get(Evas_Object *obj) /* GROUPS API */ /****************/ -/** - * @brief Add an edje (empty) group to an edje object's group set. - * - * @param obj The pointer to edje object. - * @param name The name of the group. - * - * @return 1 If it could allocate memory to the part group added - * or zero if not. - * - * This function adds, at run time, one more group, which will reside - * in memory, to the group set found in the .edj file which @a obj was - * loaded with. This group can be manipulated by other API functions, - * like @c edje_edit_part_add(), for example. If desired, the new - * group can be actually committed the respective .edj by use of @c - * edje_edit_save(). - * - */ EAPI Eina_Bool edje_edit_group_add(Evas_Object *obj, const char *name) { @@ -1066,20 +1049,6 @@ edje_edit_group_add(Evas_Object *obj, const char *name) return EINA_TRUE; } -/** - * @brief Delete the specified group from the edje file. - * - * @param obj The pointer to the edje object. - * @param group_name Group to delete. - * - * @return @c EINA_TRUE on success, @c EINA_FALSE on failure. - * - * This function deletes the given group from the file @a obj is set to. This - * operation can't be undone as all references to the group are removed from - * the file. - * This function may fail if the group to be deleted is currently in use. - * - */ EAPI Eina_Bool edje_edit_group_del(Evas_Object *obj, const char *group_name) { @@ -2190,7 +2159,7 @@ _edje_edit_real_part_add(Evas_Object *obj, const char *name, Edje_Part_Type type Evas_Object *child; child = _edje_external_type_add(source, evas_object_evas_get(ed->obj), ed->obj, NULL, name); if (child) - _edje_real_part_swallow(rp, child); + _edje_real_part_swallow(rp, child, EINA_TRUE); } evas_object_clip_set(rp->object, ed->base.clipper); evas_object_show(ed->base.clipper); @@ -2731,7 +2700,7 @@ edje_edit_part_source_set(Evas_Object *obj, const char *part, const char *source rp->part->source = eina_stringshare_add(source); child_obj = edje_object_add(ed->base.evas); edje_object_file_set(child_obj, ed->file->path, source); - _edje_real_part_swallow(rp, child_obj); + _edje_real_part_swallow(rp, child_obj, EINA_TRUE); } else rp->part->source = NULL; @@ -4067,17 +4036,6 @@ edje_edit_state_external_param_choice_get(Evas_Object *obj, const char *part, co return EINA_FALSE; } -/** - * Arguments should have proper sized values matching their types: - * - EDJE_EXTERNAL_PARAM_TYPE_INT: int - * - EDJE_EXTERNAL_PARAM_TYPE_BOOL: int - * - EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: double - * - EDJE_EXTERNAL_PARAM_TYPE_STRING: char* - * - EDJE_EXTERNAL_PARAM_TYPE_CHOICE: char* - * - * @note: The validation of the parameter will occur only if the part - * is in the same state as the one being modified. - */ EAPI 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, ...) { diff --git a/src/lib/edje_embryo.c b/src/lib/edje_embryo.c index c3c49ab..e0c5f7d 100644 --- a/src/lib/edje_embryo.c +++ b/src/lib/edje_embryo.c @@ -846,7 +846,7 @@ _edje_embryo_fn_set_state(Embryo_Program *ep, Embryo_Cell *params) { if (rp->program) _edje_program_end(ed, rp->program); _edje_part_description_apply(ed, rp, state, value, NULL, 0.0); - _edje_part_pos_set(ed, rp, EDJE_TWEEN_MODE_LINEAR, ZERO); + _edje_part_pos_set(ed, rp, EDJE_TWEEN_MODE_LINEAR, ZERO, ZERO, ZERO); _edje_recalc(ed); } return 0; @@ -928,7 +928,7 @@ _edje_embryo_fn_set_tween_state(Embryo_Program *ep, Embryo_Cell *params) { if (rp->program) _edje_program_end(ed, rp->program); _edje_part_description_apply(ed, rp, state1, value1, state2, value2); - _edje_part_pos_set(ed, rp, EDJE_TWEEN_MODE_LINEAR, FROM_DOUBLE(tween)); + _edje_part_pos_set(ed, rp, EDJE_TWEEN_MODE_LINEAR, FROM_DOUBLE(tween), ZERO, ZERO); _edje_recalc(ed); } return 0; diff --git a/src/lib/edje_entry.c b/src/lib/edje_entry.c index 093985f..ff29721 100644 --- a/src/lib/edje_entry.c +++ b/src/lib/edje_entry.c @@ -35,7 +35,6 @@ typedef enum _Entry_Char_Type struct _Entry { Edje_Real_Part *rp; - Evas_Coord cx, cy; Evas_Coord ox, oy; Evas_Coord sx, sy; Evas_Coord rx, ry; @@ -317,7 +316,7 @@ _edje_focus_in_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v en = rp->entry_data; if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) || - (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE)) + (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE)) return; if (!en->imf_context) return; @@ -346,7 +345,7 @@ _edje_focus_out_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, if (!rp) return; en = rp->entry_data; if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) || - (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE)) + (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE)) return; if (!en->imf_context) return; @@ -434,9 +433,9 @@ _text_filter_markup_prepend(Entry *en, Evas_Textblock_Cursor *c, const char *tex } static void -_curs_update_from_curs(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__, Entry *en) +_curs_update_from_curs(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__, Entry *en, Evas_Coord *cx, Evas_Coord *cy) { - Evas_Coord cx, cy, cw, ch; + Evas_Coord cw, ch; Evas_Textblock_Cursor_Type cur_type; if (c != en->cursor) return; switch (en->rp->part->cursor_mode) @@ -449,23 +448,23 @@ _curs_update_from_curs(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__, Entr default: cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER; } - evas_textblock_cursor_geometry_get(c, &cx, &cy, &cw, &ch, NULL, cur_type); - en->cx = cx + (cw / 2); - en->cy = cy + (ch / 2); + evas_textblock_cursor_geometry_get(c, cx, cy, &cw, &ch, NULL, cur_type); + *cx += (cw / 2); + *cy += (ch / 2); } static void -_curs_back(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en) +_curs_back(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__, + Entry *en __UNUSED__) { evas_textblock_cursor_char_prev(c); - _curs_update_from_curs(c, o, en); } static void -_curs_next(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en) +_curs_next(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__, + Entry *en __UNUSED__) { evas_textblock_cursor_char_next(c); - _curs_update_from_curs(c, o, en); } static int @@ -482,24 +481,24 @@ _curs_line_last_get(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry * } static void -_curs_lin_start(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en) +_curs_lin_start(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__, + Entry *en __UNUSED__) { evas_textblock_cursor_line_char_first(c); - _curs_update_from_curs(c, o, en); } static void -_curs_lin_end(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en) +_curs_lin_end(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__, + Entry *en __UNUSED__) { evas_textblock_cursor_line_char_last(c); - _curs_update_from_curs(c, o, en); } static void -_curs_start(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en) +_curs_start(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__, + Entry *en __UNUSED__) { evas_textblock_cursor_paragraph_first(c); - _curs_update_from_curs(c, o, en); } static void @@ -507,26 +506,29 @@ _curs_end(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en) { evas_textblock_cursor_paragraph_last(c); _curs_lin_end(c, o, en); - _curs_update_from_curs(c, o, en); } static void _curs_jump_line(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en, int ln) { + Evas_Coord cx, cy; Evas_Coord lx, ly, lw, lh; int last = _curs_line_last_get(c, o, en); if (ln < 0) ln = 0; else { - if (ln > last) ln = last; + if (ln > last) ln = last; } + + _curs_update_from_curs(c, o, en, &cx, &cy); + if (!evas_object_textblock_line_number_geometry_get(o, ln, &lx, &ly, &lw, &lh)) return; - if (evas_textblock_cursor_char_coord_set(c, en->cx, ly + (lh / 2))) + if (evas_textblock_cursor_char_coord_set(c, cx, ly + (lh / 2))) return; evas_textblock_cursor_line_set(c, ln); - if (en->cx < (lx + (lw / 2))) + if (cx < (lx + (lw / 2))) { if (ln == last) _curs_end(c, o, en); // evas_textblock_cursor_line_char_last(c); @@ -714,7 +716,7 @@ _sel_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en) if (!range) return; } else - return; + return; if (eina_list_count(range) != eina_list_count(en->sel)) { while (en->sel) @@ -833,7 +835,7 @@ _edje_anchor_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UN if (((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) || (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE))&& (en->select_allow)) - return; + return; ignored = rp->part->ignore_flags & ev->event_flags; if ((!ev->event_flags) || (!ignored)) { @@ -842,11 +844,11 @@ _edje_anchor_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UN len = 200 + strlen(n); buf = alloca(len); if (ev->flags & EVAS_BUTTON_TRIPLE_CLICK) - snprintf(buf, len, "anchor,mouse,down,%i,%s,triple", ev->button, n); + snprintf(buf, len, "anchor,mouse,down,%i,%s,triple", ev->button, n); else if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) - snprintf(buf, len, "anchor,mouse,down,%i,%s,double", ev->button, n); + snprintf(buf, len, "anchor,mouse,down,%i,%s,double", ev->button, n); else - snprintf(buf, len, "anchor,mouse,down,%i,%s", ev->button, n); + snprintf(buf, len, "anchor,mouse,down,%i,%s", ev->button, n); _edje_emit(rp->edje, buf, rp->part->name); } } @@ -867,7 +869,7 @@ _edje_anchor_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS if (((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) || (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)) && (en->select_allow)) - return; + return; n = an->name; if (!n) n = ""; len = 200 + strlen(n); @@ -899,7 +901,7 @@ _edje_anchor_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UN if (((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) || (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)) && (en->select_allow)) - return; + return; ignored = rp->part->ignore_flags & ev->event_flags; if ((!ev->event_flags) || (!ignored)) { @@ -959,7 +961,7 @@ _edje_anchor_mouse_out_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNU static void _anchors_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en) { - Eina_List *l, *ll, *range; + Eina_List *l, *ll, *range = NULL; Evas_Coord x, y, w, h; Evas_Object *smart, *clip; Sel *sel; @@ -981,8 +983,10 @@ _anchors_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en) while (an->sel) { sel = an->sel->data; - en->rp->edje->subobjs = eina_list_remove(en->rp->edje->subobjs, sel->obj_bg); - en->rp->edje->subobjs = eina_list_remove(en->rp->edje->subobjs, sel->obj_fg); + en->rp->edje->subobjs = + eina_list_remove(en->rp->edje->subobjs, sel->obj_bg); + en->rp->edje->subobjs = + eina_list_remove(en->rp->edje->subobjs, sel->obj_fg); if (sel->obj_bg) evas_object_del(sel->obj_bg); if (sel->obj_fg) evas_object_del(sel->obj_fg); if (sel->obj) evas_object_del(sel->obj); @@ -996,8 +1000,8 @@ _anchors_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en) if (en->rp->edje->item_provider.func) { ob = en->rp->edje->item_provider.func - (en->rp->edje->item_provider.data, smart, - en->rp->part->name, an->name); + (en->rp->edje->item_provider.data, smart, + en->rp->part->name, an->name); evas_object_smart_member_add(ob, smart); evas_object_stack_above(ob, o); evas_object_clip_set(ob, clip); @@ -1010,7 +1014,8 @@ _anchors_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en) // for link anchors else { - range = evas_textblock_cursor_range_geometry_get(an->start, an->end); + range = + evas_textblock_cursor_range_geometry_get(an->start, an->end); if (eina_list_count(range) != eina_list_count(an->sel)) { while (an->sel) @@ -1039,7 +1044,7 @@ _anchors_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en) evas_object_show(ob); sel->obj_bg = ob; en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, sel->obj_bg); - + ob = edje_object_add(en->rp->edje->base.evas); edje_object_file_set(ob, en->rp->edje->path, en->rp->part->source6); evas_object_smart_member_add(ob, smart); @@ -1049,7 +1054,7 @@ _anchors_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en) evas_object_show(ob); sel->obj_fg = ob; en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, sel->obj_fg); - + ob = evas_object_rectangle_add(en->rp->edje->base.evas); evas_object_color_set(ob, 0, 0, 0, 0); evas_object_smart_member_add(ob, smart); @@ -1074,7 +1079,7 @@ _anchors_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en) if (!evas_textblock_cursor_format_item_geometry_get (an->start, &cx, &cy, &cw, &ch)) - continue; + continue; evas_object_move(sel->obj, x + cx, y + cy); evas_object_resize(sel->obj, cw, ch); } @@ -1145,99 +1150,91 @@ _anchors_clear(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, E static void _anchors_get(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en) { - Evas_Textblock_Cursor *c1; - const Evas_Object_Textblock_Node_Format *node; + const Eina_List *anchors_a, *anchors_item; Anchor *an = NULL; - _anchors_clear(c, o, en); - c1 = evas_object_textblock_cursor_new(o); - node = evas_textblock_node_format_first_get(o); - for (; node ; node = evas_textblock_node_format_next_get(node)) - { - const char *s; - evas_textblock_cursor_at_format_set(c1, node); - s = evas_textblock_node_format_text_get(node); - if (s) + anchors_a = evas_textblock_node_format_list_get(o, "a"); + anchors_item = evas_textblock_node_format_list_get(o, "item"); + + if (anchors_a) + { + const Evas_Object_Textblock_Node_Format *node; + const Eina_List *itr; + EINA_LIST_FOREACH(anchors_a, itr, node) { - if ((!strncmp(s, "+ a ", 4)) || (!strncmp(s, "+a ", 3))) - { - an = calloc(1, sizeof(Anchor)); - if (an) - { - char *p; + const char *s = evas_textblock_node_format_text_get(node); + char *p; + an = calloc(1, sizeof(Anchor)); + if (!an) + break; - an->en = en; - p = strstr(s, "href="); - if (p) - { - an->name = strdup(p + 5); - } - en->anchors = eina_list_append(en->anchors, an); - an->start = evas_object_textblock_cursor_new(o); - an->end = evas_object_textblock_cursor_new(o); - evas_textblock_cursor_copy(c1, an->start); - evas_textblock_cursor_copy(c1, an->end); - } - } - else if ((!strcmp(s, "- a")) || (!strcmp(s, "-a"))) + an->en = en; + p = strstr(s, "href="); + if (p) { - /* Close the anchor, if the anchor was without text, free it as well */ - if (an) - { - evas_textblock_cursor_at_format_set(an->end, node); - if (!evas_textblock_cursor_compare(an->start, an->end)) - { - if (an->name) free(an->name); - evas_textblock_cursor_free(an->start); - evas_textblock_cursor_free(an->end); - en->anchors = eina_list_remove(en->anchors, an); - free(an); - } - an = NULL; - } + an->name = strdup(p + 5); } - else if (!strncmp(s, "+ item ", 7)) + en->anchors = eina_list_append(en->anchors, an); + an->start = evas_object_textblock_cursor_new(o); + an->end = evas_object_textblock_cursor_new(o); + evas_textblock_cursor_at_format_set(an->start, node); + evas_textblock_cursor_copy(an->start, an->end); + + /* Close the anchor, if the anchor was without text, + * free it as well */ + node = evas_textblock_node_format_next_get(node); + for (; node; node = evas_textblock_node_format_next_get(node)) { - an = calloc(1, sizeof(Anchor)); - if (an) - { - char *p; + s = evas_textblock_node_format_text_get(node); + if ((!strcmp(s, "- a")) || (!strcmp(s, "-a"))) + break; + } - an->en = en; - an->item = 1; - p = strstr(s, "href="); - if (p) - { - an->name = strdup(p + 5); - } - en->anchors = eina_list_append(en->anchors, an); - an->start = evas_object_textblock_cursor_new(o); - an->end = evas_object_textblock_cursor_new(o); - evas_textblock_cursor_copy(c1, an->start); - evas_textblock_cursor_copy(c1, an->end); - } + if (node) + { + evas_textblock_cursor_at_format_set(an->end, node); } - else if ((!strcmp(s, "- item")) || (!strcmp(s, "-item"))) + else if (!evas_textblock_cursor_compare(an->start, an->end)) { - if (an) - { - /* - if (!firsttext) - { - if (an->name) free(an->name); - evas_textblock_cursor_free(an->start); - evas_textblock_cursor_free(an->end); - en->anchors = eina_list_remove(en->anchors, an); - free(an); - } - */ - an = NULL; - } + if (an->name) free(an->name); + evas_textblock_cursor_free(an->start); + evas_textblock_cursor_free(an->end); + en->anchors = eina_list_remove(en->anchors, an); + free(an); } + an = NULL; + } + } + + if (anchors_item) + { + const Evas_Object_Textblock_Node_Format *node; + const Eina_List *itr; + EINA_LIST_FOREACH(anchors_item, itr, node) + { + const char *s = evas_textblock_node_format_text_get(node); + char *p; + an = calloc(1, sizeof(Anchor)); + if (!an) + break; + + an->en = en; + an->item = 1; + p = strstr(s, "href="); + if (p) + { + an->name = strdup(p + 5); + } + en->anchors = eina_list_append(en->anchors, an); + an->start = evas_object_textblock_cursor_new(o); + an->end = evas_object_textblock_cursor_new(o); + evas_textblock_cursor_at_format_set(an->start, node); + evas_textblock_cursor_copy(an->start, an->end); + /* Although needed in textblock, don't bother with finding the end + * here cause it doesn't really matter. */ } } - evas_textblock_cursor_free(c1); } @@ -1251,7 +1248,7 @@ static void _backspace(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__, Entry *en __UNUSED__) { if (evas_textblock_cursor_char_prev(c)) - evas_textblock_cursor_char_delete(c); + evas_textblock_cursor_char_delete(c); } static void @@ -1340,7 +1337,7 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v en = rp->entry_data; if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) || (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE)) - return; + return; if (!ev->key) return; #ifdef HAVE_ECORE_IMF @@ -1351,7 +1348,7 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v if (ecore_imf_context_filter_event(en->imf_context, ECORE_IMF_EVENT_KEY_DOWN, (Ecore_IMF_Event *)&ecore_ev)) - return; + return; } #endif @@ -1451,14 +1448,11 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v else { if (en->have_selection) - _range_del(en->cursor, rp->object, en); + _range_del(en->cursor, rp->object, en); else - { - _backspace(en->cursor, rp->object, en); - } + _backspace(en->cursor, rp->object, en); } _sel_clear(en->cursor, rp->object, en); - _curs_update_from_curs(en->cursor, rp->object, en); _anchors_get(en->cursor, rp->object, en); _edje_emit(ed, "entry,changed", rp->part->name); _edje_emit(ed, "entry,key,backspace", rp->part->name); @@ -1478,14 +1472,11 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v else { if (en->have_selection) - _range_del(en->cursor, rp->object, en); + _range_del(en->cursor, rp->object, en); else - { - _delete(en->cursor, rp->object, en); - } + _delete(en->cursor, rp->object, en); } _sel_clear(en->cursor, rp->object, en); - _curs_update_from_curs(en->cursor, rp->object, en); _anchors_get(en->cursor, rp->object, en); _edje_emit(ed, "entry,changed", rp->part->name); _edje_emit(ed, "entry,key,delete", rp->part->name); @@ -1500,9 +1491,9 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v else _sel_clear(en->cursor, rp->object, en); } if ((control) && (multiline)) - _curs_start(en->cursor, rp->object, en); + _curs_start(en->cursor, rp->object, en); else - _curs_lin_start(en->cursor, rp->object, en); + _curs_lin_start(en->cursor, rp->object, en); if (en->select_allow) { if (shift) _sel_extend(en->cursor, rp->object, en); @@ -1519,9 +1510,9 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v else _sel_clear(en->cursor, rp->object, en); } if ((control) && (multiline)) - _curs_end(en->cursor, rp->object, en); + _curs_end(en->cursor, rp->object, en); else - _curs_lin_end(en->cursor, rp->object, en); + _curs_lin_end(en->cursor, rp->object, en); if (en->select_allow) { if (shift) _sel_extend(en->cursor, rp->object, en); @@ -1548,7 +1539,6 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v else if ((control) && ((!strcmp(ev->key, "x") || (!strcmp(ev->key, "m"))))) { // FIXME: cut - save selection, delete seletion - _curs_update_from_curs(en->cursor, rp->object, en); _edje_emit(ed, "entry,cut,notify", rp->part->name); ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; } @@ -1588,7 +1578,6 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v //yy // evas_textblock_cursor_format_prepend(en->cursor, "\t"); _text_filter_format_prepend(en, en->cursor, "\t"); - _curs_update_from_curs(en->cursor, rp->object, en); _anchors_get(en->cursor, rp->object, en); _edje_emit(ed, "entry,changed", rp->part->name); } @@ -1639,7 +1628,7 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v if (multiline) { if (en->have_selection) - _range_del(en->cursor, rp->object, en); + _range_del(en->cursor, rp->object, en); _sel_clear(en->cursor, rp->object, en); if (shift) { @@ -1653,7 +1642,6 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v // evas_textblock_cursor_format_prepend(en->cursor, "ps"); _text_filter_format_prepend(en, en->cursor, "ps"); } - _curs_update_from_curs(en->cursor, rp->object, en); _anchors_get(en->cursor, rp->object, en); _edje_emit(ed, "entry,changed", rp->part->name); _edje_emit(ed, "cursor,changed", rp->part->name); @@ -1668,7 +1656,7 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v if (ev->string) { if (en->have_selection) - _range_del(en->cursor, rp->object, en); + _range_del(en->cursor, rp->object, en); _sel_clear(en->cursor, rp->object, en); if (!strcmp(ev->key, "space")) _autoperiod_insert(en, en->cursor); @@ -1685,24 +1673,17 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v { //evas_textblock_cursor_text_prepend(en->cursor, ev->string); _text_filter_text_prepend(en, en->cursor, ev->string); - -#if 0 -// evas_textblock_cursor_text_prepend(en->cursor, ev->string); - _text_filter_text_prepend(en, en->cursor, ev->string); -#endif } - _curs_update_from_curs(en->cursor, rp->object, en); _anchors_get(en->cursor, rp->object, en); _edje_emit(ed, "entry,changed", rp->part->name); _edje_emit(ed, "cursor,changed", rp->part->name); - cursor_changed = EINA_TRUE; ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; _caps_mode_check(en); } } if ((old_cur_pos != evas_textblock_cursor_pos_get(en->cursor)) && (!cursor_changed)) - _edje_emit(ed, "cursor,changed", rp->part->name); + _edje_emit(ed, "cursor,changed", rp->part->name); #ifdef HAVE_ECORE_IMF if (en->imf_context) @@ -1727,7 +1708,7 @@ _edje_key_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, voi en = rp->entry_data; if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) || (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE)) - return; + return; #ifdef HAVE_ECORE_IMF if (en->imf_context) @@ -1737,7 +1718,7 @@ _edje_key_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, voi if (ecore_imf_context_filter_event(en->imf_context, ECORE_IMF_EVENT_KEY_UP, (Ecore_IMF_Event *)&ecore_ev)) - return; + return; } #endif @@ -1859,6 +1840,7 @@ _long_press(void *data) static void _edje_part_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) { + Evas_Coord cx, cy; Edje_Real_Part *rp = data; Evas_Event_Mouse_Down *ev = event_info; Entry *en; @@ -1874,7 +1856,7 @@ _edje_part_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) || (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE)) - return; + return; if (ev->button == 2) { _edje_emit(rp->edje, "entry,paste,request", rp->part->name); @@ -1890,7 +1872,7 @@ _edje_part_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS if (ecore_imf_context_filter_event(en->imf_context, ECORE_IMF_EVENT_MOUSE_DOWN, (Ecore_IMF_Event *)&ecore_ev)) - return; + return; } #endif @@ -1912,100 +1894,104 @@ _edje_part_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS evas_textblock_cursor_copy(en->cursor, tc); // multiline = rp->part->multiline; evas_object_geometry_get(rp->object, &x, &y, &w, &h); - en->cx = ev->canvas.x - x; - en->cy = ev->canvas.y - y; - + cx = ev->canvas.x - x; + cy = ev->canvas.y - y; if (en->rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE) { - evas_textblock_cursor_char_coord_set(en->cursor, en->cx, en->cy); + evas_textblock_cursor_char_coord_set(en->cursor, cx, cy); } else { - if (!evas_textblock_cursor_char_coord_set(en->cursor, en->cx, en->cy)) - { - Evas_Coord lx, ly, lw, lh; - int line; + if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, cy)) + { + Evas_Coord lx, ly, lw, lh; + int line; - line = evas_textblock_cursor_line_coord_set(en->cursor, en->cy); - if (line == -1) - _curs_end(en->cursor, rp->object, en); - else - { - int lnum; + line = evas_textblock_cursor_line_coord_set(en->cursor, cy); + if (line == -1) + { + if (rp->part->multiline) + _curs_end(en->cursor, rp->object, en); + else + { + evas_textblock_cursor_paragraph_first(en->cursor); + evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh); + if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, ly + (lh / 2))) + _curs_end(en->cursor, rp->object, en); + } + } + else + { + int lnum; - lnum = evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh); - if (lnum < 0) - { - _curs_lin_start(en->cursor, rp->object, en); - } - else - { - if (en->cx <= lx) - _curs_lin_start(en->cursor, rp->object, en); - else - _curs_lin_end(en->cursor, rp->object, en); - } - } - line = evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh); - } - if (dosel) - { - if ((en->have_selection) && - ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT))) - { - Eina_List *first, *last; - FLOAT_T sc; + lnum = evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh); + if (lnum < 0) + { + _curs_lin_start(en->cursor, rp->object, en); + } + else + { + if (cx <= lx) + _curs_lin_start(en->cursor, rp->object, en); + else + _curs_lin_end(en->cursor, rp->object, en); + } + } + if ((en->have_selection) && + (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT)) + { + Eina_List *first, *last; + FLOAT_T sc; - first = en->sel; - last = eina_list_last(en->sel); - if (first && last) - { - Evas_Textblock_Rectangle *r1, *r2; - Evas_Coord d, d1, d2; - - r1 = first->data; - r2 = last->data; - d = r1->x - en->cx; - d1 = d * d; - d = (r1->y + (r1->h / 2)) - en->cy; - d1 += d * d; - d = r2->x + r2->w - 1 - en->cx; - d2 = d * d; - d = (r2->y + (r2->h / 2)) - en->cy; - d2 += d * d; - sc = rp->edje->scale; - if (sc == ZERO) sc = _edje_scale; - d = (Evas_Coord)MUL(FROM_INT(20), sc); // FIXME: maxing number! - d = d * d; - - if (d1 < d2) - { - if (d1 <= d) + first = en->sel; + last = eina_list_last(en->sel); + if (first && last) + { + Evas_Textblock_Rectangle *r1, *r2; + Evas_Coord d, d1, d2; + + r1 = first->data; + r2 = last->data; + d = r1->x - cx; + d1 = d * d; + d = (r1->y + (r1->h / 2)) - cy; + d1 += d * d; + d = r2->x + r2->w - 1 - cx; + d2 = d * d; + d = (r2->y + (r2->h / 2)) - cy; + d2 += d * d; + sc = rp->edje->scale; + if (sc == ZERO) sc = _edje_scale; + d = (Evas_Coord)MUL(FROM_INT(20), sc); // FIXME: maxing number! + d = d * d; + if (d1 < d2) { - en->select_mod_start = EINA_TRUE; - en->selecting = EINA_TRUE; + if (d1 <= d) + { + en->select_mod_start = EINA_TRUE; + en->selecting = EINA_TRUE; + } } - } - else - { - if (d2 <= d) + else { - en->select_mod_end = EINA_TRUE; - en->selecting = EINA_TRUE; + if (d2 <= d) + { + en->select_mod_end = EINA_TRUE; + en->selecting = EINA_TRUE; + } } - } - } - } - else - { - en->selecting = EINA_TRUE; - _sel_clear(en->cursor, rp->object, en); - if (en->select_allow) - { - _sel_start(en->cursor, rp->object, en); - } - } - } + } + } + else + { + en->selecting = EINA_TRUE; + _sel_clear(en->cursor, rp->object, en); + if (en->select_allow) + { + _sel_start(en->cursor, rp->object, en); + } + } + } } if (evas_textblock_cursor_compare(tc, en->cursor)) _edje_emit(rp->edje, "cursor,changed", rp->part->name); @@ -2032,6 +2018,7 @@ _edje_part_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS static void _edje_part_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) { + Evas_Coord cx, cy; Edje_Real_Part *rp = data; Evas_Event_Mouse_Up *ev = event_info; Entry *en; @@ -2043,7 +2030,7 @@ _edje_part_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED en = rp->entry_data; if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) || (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE)) - return; + return; if (en->longpress_timer) { @@ -2066,23 +2053,33 @@ _edje_part_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED if (ecore_imf_context_filter_event(en->imf_context, ECORE_IMF_EVENT_MOUSE_UP, (Ecore_IMF_Event *)&ecore_ev)) - return; + return; } #endif tc = evas_object_textblock_cursor_new(rp->object); evas_textblock_cursor_copy(en->cursor, tc); evas_object_geometry_get(rp->object, &x, &y, &w, &h); - en->cx = ev->canvas.x - x; - en->cy = ev->canvas.y - y; - if (!evas_textblock_cursor_char_coord_set(en->cursor, en->cx, en->cy)) + cx = ev->canvas.x - x; + cy = ev->canvas.y - y; + if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, cy)) { Evas_Coord lx, ly, lw, lh; int line; - line = evas_textblock_cursor_line_coord_set(en->cursor, en->cy); + line = evas_textblock_cursor_line_coord_set(en->cursor, cy); if (line == -1) - _curs_end(en->cursor, rp->object, en); + { + if (rp->part->multiline) + _curs_end(en->cursor, rp->object, en); + else + { + evas_textblock_cursor_paragraph_first(en->cursor); + evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh); + if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, ly + (lh / 2))) + _curs_end(en->cursor, rp->object, en); + } + } else { int lnum; @@ -2094,10 +2091,10 @@ _edje_part_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED } else { - if (en->cx <= lx) - _curs_lin_start(en->cursor, rp->object, en); + if (cx <= lx) + _curs_lin_start(en->cursor, rp->object, en); else - _curs_lin_end(en->cursor, rp->object, en); + _curs_lin_end(en->cursor, rp->object, en); } } } @@ -2131,7 +2128,7 @@ _edje_part_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED } if (evas_textblock_cursor_compare(tc, en->cursor)) - _edje_emit(rp->edje, "cursor,changed", rp->part->name); + _edje_emit(rp->edje, "cursor,changed", rp->part->name); evas_textblock_cursor_free(tc); #ifdef HAVE_ECORE_IMF @@ -2153,6 +2150,7 @@ _edje_part_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED static void _edje_part_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) { + Evas_Coord cx, cy; Edje_Real_Part *rp = data; Evas_Event_Mouse_Move *ev = event_info; Entry *en; @@ -2162,7 +2160,7 @@ _edje_part_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS en = rp->entry_data; if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) || (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE)) - return; + return; #ifdef HAVE_ECORE_IMF if (en->imf_context) @@ -2172,7 +2170,7 @@ _edje_part_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS if (ecore_imf_context_filter_event(en->imf_context, ECORE_IMF_EVENT_MOUSE_MOVE, (Ecore_IMF_Event *)&ecore_ev)) - return; + return; } #endif @@ -2185,9 +2183,9 @@ _edje_part_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS evas_textblock_cursor_copy(en->cursor, tc); evas_object_geometry_get(rp->object, &x, &y, &w, &h); - en->cx = ev->cur.canvas.x - x; - en->cy = ev->cur.canvas.y - y; - evas_textblock_cursor_char_coord_set(en->cursor, en->cx, en->cy); + cx = ev->cur.canvas.x - x; + cy = ev->cur.canvas.y - y; + evas_textblock_cursor_char_coord_set(en->cursor, cx, cy); if (evas_textblock_cursor_compare(tc, en->cursor)) _edje_emit(rp->edje, "cursor,changed", rp->part->name); @@ -2203,19 +2201,32 @@ _edje_part_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS tc = evas_object_textblock_cursor_new(rp->object); evas_textblock_cursor_copy(en->cursor, tc); evas_object_geometry_get(rp->object, &x, &y, &w, &h); - en->cx = ev->cur.canvas.x - x; - en->cy = ev->cur.canvas.y - y; - - if (!evas_textblock_cursor_char_coord_set(en->cursor, en->cx, en->cy)) + cx = ev->cur.canvas.x - x; + cy = ev->cur.canvas.y - y; + if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, cy)) { Evas_Coord lx, ly, lw, lh; - evas_textblock_cursor_line_coord_set(en->cursor, en->cy); - evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh); - if (en->cx <= lx) - _curs_lin_start(en->cursor, rp->object, en); + if (evas_textblock_cursor_line_coord_set(en->cursor, cy) < 0) + { + if (rp->part->multiline) + _curs_end(en->cursor, rp->object, en); + else + { + evas_textblock_cursor_paragraph_first(en->cursor); + evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh); + if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, ly + (lh / 2))) + _curs_end(en->cursor, rp->object, en); + } + } else - _curs_lin_end(en->cursor, rp->object, en); + { + evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh); + if (cx <= lx) + _curs_lin_start(en->cursor, rp->object, en); + else + _curs_lin_end(en->cursor, rp->object, en); + } } if ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) || @@ -2226,12 +2237,12 @@ _edje_part_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS if (en->had_sel) { if (en->select_mod_end) - _sel_extend(en->cursor, rp->object, en); + _sel_extend(en->cursor, rp->object, en); else if (en->select_mod_start) - _sel_preextend(en->cursor, rp->object, en); + _sel_preextend(en->cursor, rp->object, en); } else - _sel_extend(en->cursor, rp->object, en); + _sel_extend(en->cursor, rp->object, en); } } else @@ -2242,13 +2253,13 @@ _edje_part_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS if (en->select_allow) { if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) != 0) - _sel_enable(en->cursor, rp->object, en); + _sel_enable(en->cursor, rp->object, en); if (en->have_selection) - _sel_update(en->cursor, rp->object, en); + _sel_update(en->cursor, rp->object, en); } if (evas_textblock_cursor_compare(tc, en->cursor)) - _edje_emit(rp->edje, "cursor,changed", rp->part->name); + _edje_emit(rp->edje, "cursor,changed", rp->part->name); evas_textblock_cursor_free(tc); #ifdef HAVE_ECORE_IMF @@ -2308,6 +2319,7 @@ _edje_entry_top_handler_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Objec Edje_Real_Part *rp = data; Entry *en = rp->entry_data; Evas_Coord x, y, tx, ty; + Evas_Coord cx, cy; if (ev->buttons != 1) return; @@ -2321,16 +2333,16 @@ _edje_entry_top_handler_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Objec evas_object_geometry_get(rp->object, &tx, &ty, NULL, NULL); - en->cx = en->rx + en->ox - tx; - en->cy = en->ry + en->oy - ty; + cx = en->rx + en->ox - tx; + cy = en->ry + en->oy - ty; - if (en->cy < 0) en->cy = 0; - if (en->cx < 0) en->cx = 0; + if (cx < 0) cx = 0; + if (cy < 0) cy = 0; - if (!evas_textblock_cursor_char_coord_set(en->cursor, en->cx, en->cy)) + if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, cy)) { int line; - line = evas_textblock_cursor_line_coord_set(en->cursor, en->cy); + line = evas_textblock_cursor_line_coord_set(en->cursor, cy); if (line == -1) { @@ -2401,6 +2413,7 @@ _edje_entry_bottom_handler_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Ob Edje_Real_Part *rp = data; Entry *en = rp->entry_data; Evas_Coord x, y, tx, ty, tw, th; + Evas_Coord cx, cy; if (ev->buttons != 1) return; @@ -2414,17 +2427,17 @@ _edje_entry_bottom_handler_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Ob evas_object_geometry_get(rp->object, &tx, &ty, &tw, &th); - en->cx = en->rx + en->ox - tx; - en->cy = en->ry + en->oy - ty; + cx = en->rx + en->ox - tx; + cy = en->ry + en->oy - ty; - if (en->cx < 0) en->cx = 0; - if (en->cy < 0) en->cy = 0; - if (en->cy > th) en->cy = th - 1; + if (cx < 0) cx = 0; + if (cy < 0) cy = 0; + if (cy > th) cy = th - 1; - if (!evas_textblock_cursor_char_coord_set(en->cursor, en->cx, en->cy)) + if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, cy)) { int line; - line = evas_textblock_cursor_line_coord_set(en->cursor, en->cy); + line = evas_textblock_cursor_line_coord_set(en->cursor, cy); if (line == -1) { @@ -2479,9 +2492,9 @@ void _edje_entry_init(Edje *ed) { if (!ed->has_entries) - return; + return; if (ed->entries_inited) - return; + return; ed->entries_inited = EINA_TRUE; evas_object_event_callback_add(ed->obj, EVAS_CALLBACK_FOCUS_IN, _edje_focus_in_cb, ed); @@ -2496,9 +2509,9 @@ void _edje_entry_shutdown(Edje *ed) { if (!ed->has_entries) - return; + return; if (!ed->entries_inited) - return; + return; ed->entries_inited = EINA_FALSE; evas_object_event_callback_del(ed->obj, EVAS_CALLBACK_FOCUS_IN, _edje_focus_in_cb); @@ -2506,9 +2519,9 @@ _edje_entry_shutdown(Edje *ed) evas_object_event_callback_del(ed->obj, EVAS_CALLBACK_KEY_DOWN, _edje_key_down_cb); evas_object_event_callback_del(ed->obj, EVAS_CALLBACK_KEY_UP, _edje_key_up_cb); if (evas_event_callback_del_full(ed->base.evas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _evas_focus_in_cb, ed) != ed) - ERR("could not unregister EVAS_CALLBACK_FOCUS_IN"); + ERR("could not unregister EVAS_CALLBACK_FOCUS_IN"); if (evas_event_callback_del_full(ed->base.evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, _evas_focus_out_cb, ed) != ed) - ERR("could not unregister EVAS_CALLBACK_FOCUS_OUT"); + ERR("could not unregister EVAS_CALLBACK_FOCUS_OUT"); } void @@ -2535,19 +2548,19 @@ _edje_entry_real_part_init(Edje_Real_Part *rp) evas_object_event_callback_add(rp->object, EVAS_CALLBACK_MOUSE_MOVE, _edje_part_mouse_move_cb, rp); if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_DEFAULT) - en->select_allow = EINA_TRUE; + en->select_allow = EINA_TRUE; if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) || (rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD_SHOW_LAST_CHARACTER)) { Edje_Part_Description_Text *txt; - txt = (Edje_Part_Description_Text *) rp->chosen_description; + txt = (Edje_Part_Description_Text *)rp->chosen_description; en->select_allow = EINA_FALSE; if (txt && edje_string_get(&txt->text.repch)) - evas_object_textblock_replace_char_set(rp->object, edje_string_get(&txt->text.repch)); + evas_object_textblock_replace_char_set(rp->object, edje_string_get(&txt->text.repch)); else - evas_object_textblock_replace_char_set(rp->object, "*"); + evas_object_textblock_replace_char_set(rp->object, "*"); } en->cursor_bg = edje_object_add(rp->edje->base.evas); @@ -2788,8 +2801,8 @@ _edje_entry_selection_get(Edje_Real_Part *rp) if (!en) return NULL; // get selection - convert to markup if ((!en->selection) && (en->have_selection)) - en->selection = evas_textblock_cursor_range_text_get - (en->sel_start, en->sel_end, EVAS_TEXTBLOCK_TEXT_MARKUP); + en->selection = evas_textblock_cursor_range_text_get + (en->sel_start, en->sel_end, EVAS_TEXTBLOCK_TEXT_MARKUP); return en->selection; } @@ -2817,31 +2830,54 @@ _edje_entry_text_markup_set(Edje_Real_Part *rp, const char *text) // set text as markup _sel_clear(en->cursor, rp->object, en); evas_object_textblock_text_markup_set(rp->object, text); + _edje_entry_set_cursor_start(rp); _anchors_get(en->cursor, rp->object, en); _edje_emit(rp->edje, "entry,changed", rp->part->name); _edje_entry_set_cursor_start(rp); #ifdef HAVE_ECORE_IMF if (en->imf_context) - ecore_imf_context_cursor_position_set(en->imf_context, - evas_textblock_cursor_pos_get(en->cursor)); + ecore_imf_context_cursor_position_set(en->imf_context, + evas_textblock_cursor_pos_get(en->cursor)); +#endif +#if 0 + /* Don't emit cursor changed cause it didn't. It's just init to 0. */ + _edje_emit(rp->edje, "cursor,changed", rp->part->name); #endif } void -_edje_entry_text_markup_insert(Edje_Real_Part *rp, const char *text) +_edje_entry_text_markup_append(Edje_Real_Part *rp, const char *text) { Entry *en = rp->entry_data; + Evas_Textblock_Cursor *end_cur; if (!en) return; + end_cur = evas_object_textblock_cursor_new(rp->object); + evas_textblock_cursor_paragraph_last(end_cur); + evas_textblock_cursor_char_next(end_cur); + _text_filter_markup_prepend(en, end_cur, text); + evas_textblock_cursor_free(end_cur); + + /* We are updating according to the real cursor on purpose */ + _anchors_get(en->cursor, rp->object, en); + _edje_emit(rp->edje, "entry,changed", rp->part->name); + + _edje_entry_real_part_configure(rp); +} + +void +_edje_entry_text_markup_insert(Edje_Real_Part *rp, const char *text) +{ + Entry *en = rp->entry_data; + if (!en) return; // prepend markup @ cursor pos if (en->have_selection) - _range_del(en->cursor, rp->object, en); + _range_del(en->cursor, rp->object, en); _sel_clear(en->cursor, rp->object, en); //xx // evas_object_textblock_text_markup_prepend(en->cursor, text); _text_filter_markup_prepend(en, en->cursor, text); - _curs_update_from_curs(en->cursor, rp->object, en); _anchors_get(en->cursor, rp->object, en); _edje_emit(rp->edje, "entry,changed", rp->part->name); _edje_emit(rp->edje, "cursor,changed", rp->part->name); @@ -2863,6 +2899,11 @@ _edje_entry_set_cursor_start(Edje_Real_Part *rp) Entry *en = rp->entry_data; if (!en) return; _curs_start(en->cursor, rp->object, en); + +#ifdef HAVE_ECORE_IMF + if (en->imf_context) + ecore_imf_context_cursor_position_set(en->imf_context, 0); +#endif } void @@ -2871,6 +2912,12 @@ _edje_entry_set_cursor_end(Edje_Real_Part *rp) Entry *en = rp->entry_data; if (!en) return; _curs_end(en->cursor, rp->object, en); + +#ifdef HAVE_ECORE_IMF + if (en->imf_context) + ecore_imf_context_cursor_position_set(en->imf_context, + evas_textblock_cursor_pos_get(en->cursor)); +#endif } void @@ -2963,7 +3010,7 @@ _edje_entry_anchor_geometry_get(Edje_Real_Part *rp, const char *anchor) { if (an->item) continue; if (!strcmp(anchor, an->name)) - return an->sel; + return an->sel; } return NULL; } @@ -3209,7 +3256,6 @@ _edje_entry_cursor_next(Edje_Real_Part *rp, Edje_Cursor cur) { return EINA_FALSE; } - _curs_update_from_curs(c, rp->object, rp->entry_data); _sel_update(c, rp->object, rp->entry_data); #ifdef HAVE_ECORE_IMF @@ -3238,7 +3284,6 @@ _edje_entry_cursor_prev(Edje_Real_Part *rp, Edje_Cursor cur) else return EINA_FALSE; } ok: - _curs_update_from_curs(c, rp->object, rp->entry_data); _sel_update(c, rp->object, rp->entry_data); #ifdef HAVE_ECORE_IMF @@ -3266,18 +3311,17 @@ _edje_entry_cursor_up(Edje_Real_Part *rp, Edje_Cursor cur) ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL); ln--; if (ln < 0) return EINA_FALSE; - if (!evas_object_textblock_line_number_geometry_get(rp->object, ln, + if (!evas_object_textblock_line_number_geometry_get(rp->object, ln, &lx, &ly, &lw, &lh)) - return EINA_FALSE; + return EINA_FALSE; evas_textblock_cursor_char_geometry_get(c, &cx, &cy, &cw, &ch); if (!evas_textblock_cursor_char_coord_set(c, cx, ly + (lh / 2))) { - if (cx < (lx +(lw / 2))) - evas_textblock_cursor_line_char_last(c); + if (cx < (lx + (lw / 2))) + evas_textblock_cursor_line_char_last(c); else - evas_textblock_cursor_line_char_last(c); + evas_textblock_cursor_line_char_last(c); } - _curs_update_from_curs(c, rp->object, rp->entry_data); _sel_update(c, rp->object, rp->entry_data); #ifdef HAVE_ECORE_IMF @@ -3304,18 +3348,17 @@ _edje_entry_cursor_down(Edje_Real_Part *rp, Edje_Cursor cur) if (!c) return EINA_FALSE; ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL); ln++; - if (!evas_object_textblock_line_number_geometry_get(rp->object, ln, + if (!evas_object_textblock_line_number_geometry_get(rp->object, ln, &lx, &ly, &lw, &lh)) - return EINA_FALSE; + return EINA_FALSE; evas_textblock_cursor_char_geometry_get(c, &cx, &cy, &cw, &ch); if (!evas_textblock_cursor_char_coord_set(c, cx, ly + (lh / 2))) { - if (cx < (lx +(lw / 2))) - evas_textblock_cursor_line_char_last(c); + if (cx < (lx + (lw / 2))) + evas_textblock_cursor_line_char_last(c); else - evas_textblock_cursor_line_char_last(c); + evas_textblock_cursor_line_char_last(c); } - _curs_update_from_curs(c, rp->object, rp->entry_data); _sel_update(c, rp->object, rp->entry_data); #ifdef HAVE_ECORE_IMF @@ -3339,7 +3382,6 @@ _edje_entry_cursor_begin(Edje_Real_Part *rp, Edje_Cursor cur) Evas_Textblock_Cursor *c = _cursor_get(rp, cur); if (!c) return; evas_textblock_cursor_paragraph_first(c); - _curs_update_from_curs(c, rp->object, rp->entry_data); _sel_update(c, rp->object, rp->entry_data); #ifdef HAVE_ECORE_IMF @@ -3389,7 +3431,6 @@ _edje_entry_cursor_copy(Edje_Real_Part *rp, Edje_Cursor cur, Edje_Cursor dst) d = _cursor_get(rp, dst); if (!d) return; evas_textblock_cursor_copy(c, d); - _curs_update_from_curs(c, rp->object, rp->entry_data); _sel_update(c, rp->object, rp->entry_data); #ifdef HAVE_ECORE_IMF @@ -3412,7 +3453,6 @@ _edje_entry_cursor_line_begin(Edje_Real_Part *rp, Edje_Cursor cur) Evas_Textblock_Cursor *c = _cursor_get(rp, cur); if (!c) return; evas_textblock_cursor_line_char_first(c); - _curs_update_from_curs(c, rp->object, rp->entry_data); _sel_update(c, rp->object, rp->entry_data); #ifdef HAVE_ECORE_IMF @@ -3435,7 +3475,6 @@ _edje_entry_cursor_line_end(Edje_Real_Part *rp, Edje_Cursor cur) Evas_Textblock_Cursor *c = _cursor_get(rp, cur); if (!c) return; evas_textblock_cursor_line_char_last(c); - _curs_update_from_curs(c, rp->object, rp->entry_data); _sel_update(c, rp->object, rp->entry_data); #ifdef HAVE_ECORE_IMF @@ -3451,7 +3490,6 @@ _edje_entry_cursor_line_end(Edje_Real_Part *rp, Edje_Cursor cur) _edje_entry_real_part_configure(rp); } - Eina_Bool _edje_entry_cursor_coord_set(Edje_Real_Part *rp, Edje_Cursor cur, Evas_Coord x, Evas_Coord y) @@ -3506,7 +3544,6 @@ _edje_entry_cursor_pos_set(Edje_Real_Part *rp, Edje_Cursor cur, int pos) return; evas_textblock_cursor_pos_set(c, pos); - _curs_update_from_curs(c, rp->object, rp->entry_data); _sel_update(c, rp->object, rp->entry_data); #ifdef HAVE_ECORE_IMF @@ -3534,7 +3571,7 @@ _edje_entry_cursor_pos_get(Edje_Real_Part *rp, Edje_Cursor cur) static Eina_Bool _edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx __UNUSED__, char **text, int *cursor_pos) { - Edje* ed = data; + Edje *ed = data; Edje_Real_Part *rp = ed->focused_part; Entry *en; const char *str; @@ -3560,7 +3597,7 @@ _edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx __UNU static Eina_Bool _edje_entry_imf_event_commit_cb(void *data, int type __UNUSED__, void *event) { - Edje* ed = data; + Edje *ed = data; Edje_Real_Part *rp = ed->focused_part; Entry *en; Ecore_IMF_Event_Commit *ev = event; @@ -3631,7 +3668,6 @@ _edje_entry_imf_event_commit_cb(void *data, int type __UNUSED__, void *event) _preedit_clear(en); #endif - _curs_update_from_curs(en->cursor, rp->object, en); _anchors_get(en->cursor, rp->object, en); _edje_emit(rp->edje, "entry,changed", rp->part->name); _edje_emit(ed, "cursor,changed", rp->part->name); @@ -3644,7 +3680,7 @@ _edje_entry_imf_event_commit_cb(void *data, int type __UNUSED__, void *event) static Eina_Bool _edje_entry_imf_event_preedit_changed_cb(void *data, int type __UNUSED__, void *event) { - Edje* ed = data; + Edje *ed = data; Edje_Real_Part *rp = ed->focused_part; Entry *en; Ecore_IMF_Event_Preedit_Changed *ev = event; @@ -3753,7 +3789,6 @@ _edje_entry_imf_event_preedit_changed_cb(void *data, int type __UNUSED__, void * evas_textblock_cursor_pos_set(en->cursor, preedit_start_pos + cursor_pos); } - _curs_update_from_curs(en->cursor, rp->object, en); _anchors_get(en->cursor, rp->object, en); _edje_emit(rp->edje, "entry,changed", rp->part->name); _edje_emit(ed, "cursor,changed", rp->part->name); diff --git a/src/lib/edje_external.c b/src/lib/edje_external.c index 2ad2867..8bf6256 100644 --- a/src/lib/edje_external.c +++ b/src/lib/edje_external.c @@ -3,14 +3,6 @@ static Eina_Hash *type_registry = NULL; static int init_count = 0; -/** - * @brief Converts type identifier to string nicer representation. - * - * This may be used to debug or other informational purposes. - * - * @param type the identifier to convert. - * @return the string with the string representation, or @c "(unknown)". - */ EAPI const char * edje_external_param_type_str(Edje_External_Param_Type type) { @@ -31,25 +23,6 @@ edje_external_param_type_str(Edje_External_Param_Type type) } } -/** - * @brief Get the object created by this external part. - * - * Parts of type external creates the part object using information - * provided by external plugins. It's somehow like "swallow" - * (edje_object_part_swallow()), but it's all set automatically. - * - * This function returns the part created by such external plugins and - * being currently managed by this Edje. - * - * @note Almost all swallow rules apply: you should not move, resize, - * hide, show, set the color or clipper of such part. It's a bit - * more restrictive as one must @b never delete this object! - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @return The externally created object, or NULL if there is none or - * part is not an external. - */ EAPI Evas_Object * edje_object_part_external_object_get(const Evas_Object *obj, const char *part) { @@ -77,36 +50,6 @@ edje_object_part_external_object_get(const Evas_Object *obj, const char *part) return rp->swallowed_object; } -/** - * @brief Set the parameter for the external part. - * - * Parts of type external may carry extra properties that have - * meanings defined by the external plugin. For instance, it may be a - * string that defines a button label and setting this property will - * change that label on the fly. - * - * @note external parts have parameters set when they change - * states. Those parameters will never be changed by this - * function. The interpretation of how state_set parameters and - * param_set will interact is up to the external plugin. - * - * @note this function will not check if parameter value is valid - * using #Edje_External_Param_Info minimum, maximum, valid - * choices and others. However these should be checked by the - * underlying implementation provided by the external - * plugin. This is done for performance reasons. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param param the parameter details, including its name, type and - * actual value. This pointer should be valid, and the - * parameter must exist in - * #Edje_External_Type::parameters_info, with the exact type, - * otherwise the operation will fail and @c EINA_FALSE will be - * returned. - * - * @return @c EINA_TRUE if everything went fine, @c EINA_FALSE on errors. - */ EAPI Eina_Bool edje_object_part_external_param_set(Evas_Object *obj, const char *part, const Edje_External_Param *param) { @@ -128,34 +71,6 @@ edje_object_part_external_param_set(Evas_Object *obj, const char *part, const Ed return _edje_external_param_set(obj, rp, param); } -/** - * @brief Get the parameter for the external part. - * - * Parts of type external may carry extra properties that have - * meanings defined by the external plugin. For instance, it may be a - * string that defines a button label. This property can be modifed by - * state parameters, by explicit calls to - * edje_object_part_external_param_set() or getting the actual object - * with edje_object_part_external_object_get() and calling native - * functions. - * - * This function asks the external plugin what is the current value, - * independent on how it was set. - * - * @param obj A valid Evas_Object handle - * @param part The part name - - * @param param the parameter details. It is used as both input and - * output variable. This pointer should be valid, and the - * parameter must exist in - * #Edje_External_Type::parameters_info, with the exact type, - * otherwise the operation will fail and @c EINA_FALSE will be - * returned. - * - * @return @c EINA_TRUE if everything went fine and @p param members - * are filled with information, @c EINA_FALSE on errors and @p - * param member values are not set or valid. - */ EAPI Eina_Bool edje_object_part_external_param_get(const Evas_Object *obj, const char *part, Edje_External_Param *param) { @@ -179,7 +94,7 @@ edje_object_part_external_param_get(const Evas_Object *obj, const char *part, Ed -EAPI Evas_Object* +EAPI Evas_Object * edje_object_part_external_content_get(const Evas_Object *obj, const char *part, const char *content) { Edje *ed; @@ -200,16 +115,6 @@ edje_object_part_external_content_get(const Evas_Object *obj, const char *part, return _edje_external_content_get(rp->swallowed_object, content); } -/** - * Facility to query the type of the given parameter of the given part. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param param the parameter name to use. - * - * @return @c EDJE_EXTERNAL_PARAM_TYPE_MAX on errors, or another value - * from #Edje_External_Param_Type on success. - */ EAPI Edje_External_Param_Type edje_object_part_external_param_type_get(const Evas_Object *obj, const char *part, const char *param) { @@ -248,18 +153,6 @@ edje_object_part_external_param_type_get(const Evas_Object *obj, const char *par } -/** - * Register given type name to return the given information. - * - * @param type_name name to register and be known by edje's "source:" - * parameter of "type: EXTERNAL" parts. - * @param type_info meta-information describing how to interact with it. - * - * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (like - * type already registered). - * - * @see edje_external_type_array_register() - */ EAPI Eina_Bool edje_external_type_register(const char *type_name, const Edje_External_Type *type_info) { @@ -285,17 +178,6 @@ edje_external_type_register(const char *type_name, const Edje_External_Type *typ return eina_hash_add(type_registry, type_name, type_info); } -/** - * Unregister given type name previously registered. - * - * @param type_name name to unregister. It should be registered with - * edje_external_type_register() before. - * - * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (like - * type_name did not exist). - * - * @see edje_external_type_array_unregister() - */ EAPI Eina_Bool edje_external_type_unregister(const char *type_name) { @@ -304,28 +186,6 @@ edje_external_type_unregister(const char *type_name) return eina_hash_del_by_key(type_registry, type_name); } -/** - * Register a batch of types and their information. - * - * This is the recommended function to add information as it's faster - * than the single version edje_external_type_register(). - * - * @note the given array is not modified, but the type name strings - * are @b not duplicated! That is, all type names must be @b - * live until they are unregistered! This was chosen to save - * some memory and most people will just define the array as a - * global static const type anyway. - * - * @param array @c NULL terminated array with type name and - * information. Note that type name or information are not - * modified by are @b referenced, so they must keep alive after - * this function returns! - * - * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (like - * type already registered). - * - * @see edje_external_type_register() - */ EAPI void edje_external_type_array_register(const Edje_External_Type_Info *array) { @@ -349,14 +209,6 @@ edje_external_type_array_register(const Edje_External_Type_Info *array) } } -/** - * Unregister a batch of given external type previously registered. - * - * @param array @c NULL terminated array, should be the same as the - * one used to register with edje_external_type_array_register() - * - * @see edje_external_type_unregister() - */ EAPI void edje_external_type_array_unregister(const Edje_External_Type_Info *array) { @@ -369,70 +221,12 @@ edje_external_type_array_unregister(const Edje_External_Type_Info *array) eina_hash_del(type_registry, itr->name, itr->info); } -/** - * Return the current ABI version for Edje_External_Type structure. - * - * Always check this number before accessing Edje_External_Type in - * your own software. If the number is not the same, your software may - * access invalid memory and crash, or just get garbage values. - * - * @warning @b NEVER, EVER define your own Edje_External_Type using the - * return of this function as it will change as Edje library - * (libedje.so) changes, but your type definition will - * not. Instead, use #EDJE_EXTERNAL_TYPE_ABI_VERSION. - * - * Summary: - * - use edje_external_type_abi_version_get() to check. - * - use #EDJE_EXTERNAL_TYPE_ABI_VERSION to define/declare. - * - * @return version this edje library was compiled. - */ EAPI unsigned int edje_external_type_abi_version_get(void) { return EDJE_EXTERNAL_TYPE_ABI_VERSION; } -/** - * Returns an iterator that emits Eina_Hash_Tuple pointers with key - * being the name and data being the Edje_External_Type pointer. - * - * @code - * const Eina_Hash_Tuple *tuple; - * Eina_Iterator *itr; - * const Eina_List *l, *modules; - * const char *s; - * - * modules = edje_available_modules_get(); - * EINA_LIST_FOREACH(modules, l, s) - * { - * if (!edje_module_load(s)) - * printf("Error loading edje module: %s\n", s); - * } - * - * itr = edje_external_iterator_get(); - * EINA_ITERATOR_FOREACH(itr, tuple) - * { - * const char *name = tuple->key; - * const Edje_External_Type *type = tuple->data; - * - * if ((!type) || - * (type->abi_version != edje_external_type_abi_version_get())) - * { - * printf("Error: invalid type %p (abi: %d, expected: %d)\n", - * type, type ? type->abi_version : 0, - * edje_external_type_abi_version_get()); - * continue; - * } - * - * printf("%s: %s (%s) label='%s' desc='%s'\n", - * name, type->module, type->module_name, - * type->label_get ? type->label_get(type->data) : "", - * type->description_get ? type->description_get(type->data) : ""); - * } - * - * @endcode - */ EAPI Eina_Iterator * edje_external_iterator_get(void) { @@ -536,18 +330,6 @@ edje_external_param_choice_get(const Eina_List *params, const char *key, const c return EINA_FALSE; } -/** - * Get the array of parameters information about a type given its name. - * - * @note the type names and other strings are static, that means they - * @b NOT translated. One must use - * Edje_External_Type::translate() to translate those. - * - * @return the NULL terminated array, or @c NULL if type is unknown or - * it does not have any parameter information. - * - * @see edje_external_type_get() - */ EAPI const Edje_External_Param_Info * edje_external_param_info_get(const char *type_name) { diff --git a/src/lib/edje_load.c b/src/lib/edje_load.c index a3e462e..82d7c06 100644 --- a/src/lib/edje_load.c +++ b/src/lib/edje_load.c @@ -10,18 +10,6 @@ static Eina_List *_edje_swallows_collect(Edje *ed); /************************** API Routines **************************/ -/* FIXDOC: Verify/expand doc */ -/** Sets the EET file and group to load @a obj from - * @param obj A valid Evas_Object handle - * @param file The path to the EET file - * @param group The group name in the Edje - * @return 0 on Error\n - * 1 on Success and sets EDJE_LOAD_ERROR_NONE - * - * Edje uses EET files, conventionally ending in .edj, to store object - * descriptions. A single file contains multiple named groups. This function - * specifies the file and group name to load @a obj from. - */ EAPI Eina_Bool edje_object_file_set(Evas_Object *obj, const char *file, const char *group) { @@ -36,20 +24,6 @@ edje_object_file_set(Evas_Object *obj, const char *file, const char *group) return ret; } -/* FIXDOC: Verify/expand doc. */ -/** Get the file and group name that @a obj was loaded from - * @param obj A valid Evas_Object handle - * @param file A pointer to store a pointer to the filename in - * @param group A pointer to store a pointer to the group name in - * - * This gets the EET file location and group for the given Evas_Object. - * If @a obj is either not an edje file, or has not had its file/group set - * using edje_object_file_set(), then both @a file and @a group will be set - * to NULL. - * - * It is valid to pass in NULL for either @a file or @a group if you are not - * interested in one of the values. - */ EAPI void edje_object_file_get(const Evas_Object *obj, const char **file, const char **group) { @@ -66,22 +40,6 @@ edje_object_file_get(const Evas_Object *obj, const char **file, const char **gro if (group) *group = ed->group; } -/* FIXDOC: Verify. return error? */ -/** Gets the Edje load error - * @param obj A valid Evas_Object handle - * - * @return The Edje load error:\n - * EDJE_LOAD_ERROR_NONE: No Error\n - * EDJE_LOAD_ERROR_GENERIC: Generic Error\n - * EDJE_LOAD_ERROR_DOES_NOT_EXIST: Does not Exist\n - * EDJE_LOAD_ERROR_PERMISSION_DENIED: Permission Denied\n - * EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED: Resource Allocation Failed\n - * EDJE_LOAD_ERROR_CORRUPT_FILE: Corrupt File\n - * EDJE_LOAD_ERROR_UNKNOWN_FORMAT: Unknown Format\n - * EDJE_LOAD_ERROR_INCOMPATIBLE_FILE: Incompatible File\n - * EDJE_LOAD_ERROR_UNKNOWN_COLLECTION: Unknown Collection\n - * EDJE_LOAD_ERROR_RECURSIVE_REFERENCE: Recursive Reference\n - */ EAPI Edje_Load_Error edje_object_load_error_get(const Evas_Object *obj) { @@ -123,14 +81,6 @@ edje_load_error_str(Edje_Load_Error error) } -/** Get a list of groups in an edje file - * @param file The path to the edje file - * - * @return The Eina_List of group names (char *) - * - * Note: the list must be freed using edje_file_collection_list_free() - * when you are done with it. - */ EAPI Eina_List * edje_file_collection_list(const char *file) { @@ -157,11 +107,6 @@ edje_file_collection_list(const char *file) return lst; } -/** Free file collection list - * @param lst The Eina_List of groups - * - * Frees the list returned by edje_file_collection_list(). - */ EAPI void edje_file_collection_list_free(Eina_List *lst) { @@ -172,12 +117,6 @@ edje_file_collection_list_free(Eina_List *lst) } } -/** Determine whether a group matching glob exists in an edje file. - * @param file The file path - * @param glob A glob to match on - * - * @return 1 if a match is found, 0 otherwise - */ EAPI Eina_Bool edje_file_group_exists(const char *file, const char *glob) { @@ -238,21 +177,6 @@ edje_file_group_exists(const char *file, const char *glob) } -/** Get data from the file level data block of an edje file - * @param file The path to the .edj file - * @param key The data key - * @return The string value of the data - * - * If an edje file is built from the following edc: - * - * data { - * item: "key1" "value1"; - * item: "key2" "value2"; - * } - * collections { ... } - * - * Then, edje_file_data_get("key1") will return "value1" - */ EAPI char * edje_file_data_get(const char *file, const char *key) { @@ -331,7 +255,7 @@ _edje_programs_patterns_init(Edje *ed) } int -_edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *group, Eina_List *group_path) +_edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *group, const char *parent, Eina_List *group_path) { Edje *ed; unsigned int n; @@ -359,6 +283,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g if (ed->group) eina_stringshare_del(ed->group); ed->path = eina_stringshare_add(file); ed->group = eina_stringshare_add(group); + ed->parent = eina_stringshare_add(parent); ed->load_error = EDJE_LOAD_ERROR_NONE; _edje_file_add(ed); @@ -449,7 +374,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g evas_event_thaw(tev); evas_event_thaw_eval(tev); return 0; - } + } rp->drag->step.x = FROM_INT(ep->dragable.step_x); rp->drag->step.y = FROM_INT(ep->dragable.step_y); @@ -727,7 +652,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g external->external_params, rp->part->name); if (child_obj) { - _edje_real_part_swallow(rp, child_obj); + _edje_real_part_swallow(rp, child_obj, EINA_TRUE); rp->param1.external_params = _edje_external_params_parse(child_obj, external->external_params); _edje_external_recalc_apply(ed, rp, NULL, rp->chosen_description); @@ -742,7 +667,6 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g { Eina_List *l; Evas_Object *child_obj; - Edje *child_ed; const char *group_path_entry = eina_stringshare_add(source); const char *data; @@ -775,7 +699,12 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g child_obj = edje_object_add(ed->base.evas); group_path = eina_list_append(group_path, group_path_entry); - if (!_edje_object_file_set_internal(child_obj, file, source, group_path)) + if (rp->part->type == EDJE_PART_TYPE_GROUP) + { + _edje_real_part_swallow(rp, child_obj, EINA_FALSE); + } + + if (!_edje_object_file_set_internal(child_obj, file, source, rp->part->name, group_path)) { _edje_thaw(ed); _edje_unblock(ed); @@ -795,8 +724,6 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g evas_event_thaw_eval(tev); return 0; } - child_ed = _edje_fetch(child_obj); - child_ed->parent = eina_stringshare_add(rp->part->name); group_path = eina_list_remove(group_path, group_path_entry); eina_stringshare_del(group_path_entry); @@ -804,7 +731,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g edje_object_signal_callback_add(child_obj, "*", "*", _cb_signal_repeat, obj); if (rp->part->type == EDJE_PART_TYPE_GROUP) { - _edje_real_part_swallow(rp, child_obj); + _edje_real_part_swallow(rp, child_obj, EINA_TRUE); source = NULL; } else diff --git a/src/lib/edje_lua.c b/src/lib/edje_lua.c index 3776fbc..d431d75 100644 --- a/src/lib/edje_lua.c +++ b/src/lib/edje_lua.c @@ -3761,7 +3761,7 @@ _edje_lua_part_set_state(lua_State *L) _edje_part_description_apply(obj->ed, obj->rp, luaL_checkstring(L, -2), luaL_checknumber(L, -1), NULL, 0.0); - _edje_part_pos_set(obj->ed, obj->rp, EDJE_TWEEN_MODE_LINEAR, ZERO); + _edje_part_pos_set(obj->ed, obj->rp, EDJE_TWEEN_MODE_LINEAR, ZERO, ZERO, ZERO); _edje_recalc(obj->ed); return 0; } @@ -3780,7 +3780,7 @@ _edje_lua_part_set_tween_state(lua_State *L) luaL_checkstring(L, -4), luaL_checknumber(L, -3), luaL_checkstring(L, -2), luaL_checknumber(L, -1)); _edje_part_pos_set(obj->ed, obj->rp, EDJE_TWEEN_MODE_LINEAR, - FROM_DOUBLE(luaL_checknumber(L, -5))); + FROM_DOUBLE(luaL_checknumber(L, -5)), ZERO, ZERO); _edje_recalc(obj->ed); return 0; } diff --git a/src/lib/edje_lua2.c b/src/lib/edje_lua2.c index e8ca549..f82ec79 100644 --- a/src/lib/edje_lua2.c +++ b/src/lib/edje_lua2.c @@ -1,24 +1,14 @@ -/** - * @page luaref Edje Lua scripting - * - * @section intro Introduction - * - * Lua is intended for script-only objects at this point (with embryo left - * for augmenting standard programs). Since script-only objects effectively - * define objects entirely via Lua script (resize handling, event handling - * etc. etc.) this places many more demands on them, and thus a more powerful - * language is in order. Lua is that language. - * - * To get you started, here's an example: - * @include lua_script.edc - * - */ - #include "edje_private.h" //--------------------------------------------------------------------------// #define MAX_LUA_MEM (4 * (1024 * 1024)) +#ifdef _WIN32 +# define FMT_SIZE_T "%Iu" +#else +# define FMT_SIZE_T "%zu" +#endif + //--------------------------------------------------------------------------// typedef struct _Edje_Lua_Alloc Edje_Lua_Alloc; @@ -266,7 +256,7 @@ _elua_alloc(void *ud, void *ptr, size_t osize, size_t nsize) ela->cur += nsize - osize; if (ela->cur > ela->max) { - ERR("Edje Lua memory limit of %zu bytes reached (%zu allocated)", + ERR("Edje Lua memory limit of " FMT_SIZE_T " bytes reached (" FMT_SIZE_T " allocated)", ela->max, ela->cur); return NULL; } @@ -278,7 +268,7 @@ _elua_alloc(void *ud, void *ptr, size_t osize, size_t nsize) ptr2 = realloc(ptr, nsize); if (ptr2) return ptr2; - ERR("Edje Lua cannot re-allocate %zu bytes", nsize); + ERR("Edje Lua cannot re-allocate " FMT_SIZE_T " bytes", nsize); return ptr2; } diff --git a/src/lib/edje_main.c b/src/lib/edje_main.c index f8413dc..0b98c1a 100644 --- a/src/lib/edje_main.c +++ b/src/lib/edje_main.c @@ -12,34 +12,6 @@ Eina_Mempool *_edje_real_part_state_mp = NULL; * API * *============================================================================*/ -/** - * @addtogroup Edje_main_Group Main - * - * @brief These functions provide an abstraction layer between the - * application code and the interface, while allowing extremely - * flexible dynamic layouts and animations. - * - * @{ - */ - -/** - * @brief Initialize the edje library. - * - * @return The new init count. The initial value is zero. - * - * This function initializes the ejde library, making the propers - * calls to initialization functions. It makes calls to functions - * eina_init(), ecore_init(), embryo_init() and eet_init() so - * there is no need to call those functions again in your code. To - * shutdown edje there is a function edje_shutdown(). - * - * @see edje_shutdown() - * @see eina_init() - * @see ecore_init() - * @see embryo_init() - * @see eet_init() - * - */ EAPI int edje_init(void) @@ -135,24 +107,6 @@ edje_init(void) return --_edje_init_count; } -/** - * @brief Shutdown the edje library. - * - * @return The number of times the library has been initialised without being - * shutdown. - * - * This function shuts down the edje library. It calls the functions - * eina_shutdown(), ecore_shutdown(), embryo_shutdown() and - * eet_shutdown(), so there is no need to call these functions again - * in your code. - * - * @see edje_init() - * @see eina_shutdown() - * @see ecore_shutdown() - * @see embryo_shutdown() - * @see eet_shutdown() - * - */ EAPI int edje_shutdown(void) @@ -196,6 +150,13 @@ edje_shutdown(void) void _edje_del(Edje *ed) { + Edje_Running_Program *runp; + Edje_Pending_Program *pp; + Edje_Signal_Callback *escb; + Edje_Color_Class *cc; + Edje_Text_Class *tc; + Edje_Text_Insert_Filter_Callback *cb; + if (ed->processing_messages) { ed->delete_me = 1; @@ -213,60 +174,34 @@ _edje_del(Edje *ed) { _edje_animators = eina_list_remove(_edje_animators, ed); } - while (ed->actions) - { - Edje_Running_Program *runp; - - runp = eina_list_data_get(ed->actions); - ed->actions = eina_list_remove(ed->actions, runp); - free(runp); - } - while (ed->pending_actions) - { - Edje_Pending_Program *pp; - - pp = eina_list_data_get(ed->pending_actions); - ed->pending_actions = eina_list_remove(ed->pending_actions, pp); - free(pp); - } - while (ed->callbacks) + EINA_LIST_FREE(ed->actions, runp) + free(runp); + EINA_LIST_FREE(ed->pending_actions, pp) + free(pp); + EINA_LIST_FREE(ed->callbacks, escb) { - Edje_Signal_Callback *escb; - - escb = eina_list_data_get(ed->callbacks); - ed->callbacks = eina_list_remove(ed->callbacks, escb); if (escb->signal) eina_stringshare_del(escb->signal); if (escb->source) eina_stringshare_del(escb->source); free(escb); } - while (ed->color_classes) + EINA_LIST_FREE(ed->color_classes, cc) { - Edje_Color_Class *cc; - - cc = eina_list_data_get(ed->color_classes); - ed->color_classes = eina_list_remove(ed->color_classes, cc); if (cc->name) eina_stringshare_del(cc->name); free(cc); } - while (ed->text_classes) + EINA_LIST_FREE(ed->text_classes, tc) { - Edje_Text_Class *tc; - - tc = eina_list_data_get(ed->text_classes); - ed->text_classes = eina_list_remove(ed->text_classes, tc); if (tc->name) eina_stringshare_del(tc->name); if (tc->font) eina_stringshare_del(tc->font); free(tc); } - while (ed->text_insert_filter_callbacks) + EINA_LIST_FREE(ed->text_insert_filter_callbacks, cb) { - Edje_Text_Insert_Filter_Callback *cb; - - cb = eina_list_data_get(ed->text_insert_filter_callbacks); - ed->text_insert_filter_callbacks = eina_list_remove(ed->text_insert_filter_callbacks, cb); eina_stringshare_del(cb->part); free(cb); } + + if (ed->members) eina_hash_free(ed->members); free(ed); } @@ -292,8 +227,3 @@ _edje_unref(Edje *ed) ed->references--; if (ed->references == 0) _edje_del(ed); } - -/** - * - * @} - */ diff --git a/src/lib/edje_match.c b/src/lib/edje_match.c index 6f134c0..bf728ca 100644 --- a/src/lib/edje_match.c +++ b/src/lib/edje_match.c @@ -35,7 +35,7 @@ static int _edje_match_states_alloc(Edje_Patterns *ppat, int n) { Edje_States *l; - + const size_t patterns_size = ppat->patterns_size; const size_t patterns_max_length = ppat->max_length; @@ -76,6 +76,7 @@ _edje_match_states_alloc(Edje_Patterns *ppat, int n) { l[i].states = (Edje_State *) states; l[i].has = (Eina_Bool *) has; + l[i].size = 0; memset(l[i].has, 0, has_size); @@ -273,6 +274,7 @@ _edje_match_patterns_exec_init_states(Edje_States *states, const char *str; \ Type *data; \ size_t j; \ + int special = 0; \ \ data = eina_list_data_get(lst); \ if (!data) \ @@ -291,14 +293,18 @@ _edje_match_patterns_exec_init_states(Edje_States *states, r->finals[i] = 0; \ for (j = 0; str[j]; ++j) \ if (str[j] != '*') \ - r->finals[i] = j + 1; \ + { \ + r->finals[i] = j + 1; \ + special++; \ + } \ + j += special ? special + 1 : 0; \ \ if (j > r->max_length) \ r->max_length = j; \ - \ + \ lst = eina_list_next(lst); \ } \ - \ + \ if (!_edje_match_states_alloc(r, 2)) \ { \ free(r); \ @@ -334,6 +340,7 @@ _edje_match_patterns_exec_init_states(Edje_States *states, { \ const char *str; \ size_t j; \ + int special = 0; \ \ if (!lst[i]) \ { \ @@ -351,7 +358,11 @@ _edje_match_patterns_exec_init_states(Edje_States *states, r->finals[i] = 0; \ for (j = 0; str[j]; ++j) \ if (str[j] != '*') \ - r->finals[i] = j + 1; \ + { \ + r->finals[i] = j + 1; \ + special++; \ + } \ + j += special ? special + 1 : 0; \ \ if (j > r->max_length) \ r->max_length = j; \ diff --git a/src/lib/edje_message_queue.c b/src/lib/edje_message_queue.c index 13387f7..07fd75f 100644 --- a/src/lib/edje_message_queue.c +++ b/src/lib/edje_message_queue.c @@ -13,34 +13,6 @@ static int tmp_msgq_restart = 0; * API * *============================================================================*/ -/** - * @addtogroup Edje_message_queue_Group Message_Queue - * - * @brief These functions provide an abstraction layer between the - * application code and the interface, while allowing extremely - * flexible dynamic layouts and animations. - * - * @{ - */ - -/** - * @brief Send message to object. - * - * @param obj The edje object reference. - * @param type The type of message to send. - * @param id A identification number for the message. - * @param msg The message to be send. - * - * - * This function sends messages to this object and to all of its child - * objects, if applicable. The function that handles messages arriving - * at this edje object is is set with - * edje_object_message_handler_set(). - * - * @see edje_object_message_handler_set() - * - */ - EAPI void edje_object_message_send(Evas_Object *obj, Edje_Message_Type type, int id, void *msg) { @@ -59,18 +31,6 @@ edje_object_message_send(Evas_Object *obj, Edje_Message_Type type, int id, void } } -/** - * @brief Set the message handler function for this an object. - * - * @param obj The edje object reference. - * @param func The function to handle messages. - * @param data The data to be associated to the message handler. - * - * - * This function associates a message handler function and data to the - * edje object. - * - */ EAPI void edje_object_message_handler_set(Evas_Object *obj, Edje_Message_Handler_Cb func, void *data) @@ -82,16 +42,6 @@ edje_object_message_handler_set(Evas_Object *obj, Edje_Message_Handler_Cb func, _edje_message_cb_set(ed, func, data); } -/** - * @brief Process an object's message queue. - * - * @param obj The edje object reference. - * - * This function goes through the object message queue processing the - * pending messages for *this* specific edje object. Normally they'd - * be processed only at idle time. - * - */ EAPI void edje_object_message_signal_process(Evas_Object *obj) @@ -196,13 +146,6 @@ end: #endif } -/** - * @brief Process all queued up edje messages. - * - * This function triggers the processing of messages addressed to any - * (alive) edje objects. - * - */ EAPI void edje_message_signal_process(void) @@ -912,8 +855,3 @@ _edje_message_del(Edje *ed) if (ed->message.num <= 0) return; } } - -/** - * - * @} - */ diff --git a/src/lib/edje_module.c b/src/lib/edje_module.c index 6499290..0d29b36 100644 --- a/src/lib/edje_module.c +++ b/src/lib/edje_module.c @@ -31,9 +31,9 @@ edje_module_load(const char *module) char tmp[PATH_MAX]; snprintf(tmp, sizeof (tmp), "%s/%s/%s/" EDJE_MODULE_NAME, path, module, MODULE_ARCH -#ifdef EDJE_EXTRA_MODULE_NAME +#ifdef EDJE_EXTRA_MODULE_NAME , module -#endif +#endif ); em = eina_module_new(tmp); if (!em) continue ; @@ -129,7 +129,7 @@ edje_available_modules_get(void) char tmp[PATH_MAX]; snprintf(tmp, sizeof (tmp), "%s/%s/" EDJE_MODULE_NAME, info->path, MODULE_ARCH -#ifdef EDJE_EXTRA_MODULE_NAME +#ifdef EDJE_EXTRA_MODULE_NAME , ecore_file_file_get(info->path) #endif ); diff --git a/src/lib/edje_private.h b/src/lib/edje_private.h index d86cfd2..a374fd6 100644 --- a/src/lib/edje_private.h +++ b/src/lib/edje_private.h @@ -548,6 +548,8 @@ struct _Edje_Program /* a conditional program to be run */ struct { int mode; /* how to tween - linear, sinusoidal etc. */ FLOAT_T time; /* time to graduate between current and new state */ + FLOAT_T v1; /* other value for drag actions */ + FLOAT_T v2; /* other value for drag actions */ } tween; Eina_List *targets; /* list of target parts to apply the state to */ @@ -889,7 +891,7 @@ struct _Edje_Part_Description_Spec_Box int x, y; } padding; struct { - Eina_Bool h, v; + unsigned char h, v; } min; }; @@ -900,6 +902,9 @@ struct _Edje_Part_Description_Spec_Table struct { int x, y; } padding; + struct { + unsigned char h, v; + } min; }; struct _Edje_Part_Description_Image @@ -1005,6 +1010,8 @@ struct _Edje int table_programs_size; unsigned int table_parts_size; + Eina_Hash *members; + Edje_Perspective *persp; struct { @@ -1459,7 +1466,7 @@ extern Eina_Mempool *_emp_TABLE; extern Eina_Mempool *_emp_EXTERNAL; extern Eina_Mempool *_emp_part; -void _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, FLOAT_T pos); +void _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, FLOAT_T pos, FLOAT_T v1, FLOAT_T v2); Edje_Part_Description_Common *_edje_part_description_find(Edje *ed, Edje_Real_Part *rp, const char *name, double val); @@ -1480,7 +1487,7 @@ void _edje_callbacks_focus_del(Evas_Object *obj, Edje *ed); void _edje_edd_init(void); void _edje_edd_shutdown(void); -int _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *group, Eina_List *group_path); +int _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *group, const char *parent, Eina_List *group_path); void _edje_file_add(Edje *ed); void _edje_file_del(Edje *ed); @@ -1554,7 +1561,7 @@ int _edje_block_break(Edje *ed); void _edje_block_violate(Edje *ed); void _edje_object_part_swallow_free_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); void _edje_object_part_swallow_changed_hints_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); -void _edje_real_part_swallow(Edje_Real_Part *rp, Evas_Object *obj_swallow); +void _edje_real_part_swallow(Edje_Real_Part *rp, Evas_Object *obj_swallow, Eina_Bool hints_update); void _edje_real_part_swallow_clear(Edje_Real_Part *rp); void _edje_box_init(void); void _edje_box_shutdown(void); @@ -1775,6 +1782,7 @@ const char *_edje_entry_selection_get(Edje_Real_Part *rp); const char *_edje_entry_text_get(Edje_Real_Part *rp); void _edje_entry_text_markup_set(Edje_Real_Part *rp, const char *text); void _edje_entry_text_markup_insert(Edje_Real_Part *rp, const char *text); +void _edje_entry_text_markup_append(Edje_Real_Part *rp, const char *text); void _edje_entry_set_cursor_start(Edje_Real_Part *rp); void _edje_entry_set_cursor_end(Edje_Real_Part *rp); void _edje_entry_cursor_copy(Edje_Real_Part *rp, Edje_Cursor cur, Edje_Cursor dst); diff --git a/src/lib/edje_program.c b/src/lib/edje_program.c index ec87a43..e54be85 100644 --- a/src/lib/edje_program.c +++ b/src/lib/edje_program.c @@ -13,100 +13,18 @@ Eina_List *_edje_animators = NULL; * API * *============================================================================*/ -/** - * @addtogroup Edje_program_Group Program - * - * @brief These functions provide an abstraction layer between the - * application code and the interface, while allowing extremely - * flexible dynamic layouts and animations. - * - * @{ - */ - -/** - * @brief Set edje trasitions' frame time. - * - * @param t The frame time, in seconds. Default value is 1/30. - * - * This function sets the edje built-in animations' frame time (thus, - * affecting their resolution) by calling - * ecore_animator_frametime_set(). This frame time can be retrieved - * with edje_frametime_get(). - * - * @see edje_frametime_get() - * - */ EAPI void edje_frametime_set(double t) { ecore_animator_frametime_set(t); } -/** - * @brief Get edje trasitions' frame time. - * - * @return The frame time, in seconds. - * - * This function returns the edje frame time set by - * edje_frametime_set(). - * - * @see edje_frametime_set() - * - */ EAPI double edje_frametime_get(void) { return ecore_animator_frametime_get(); } -/** - * @brief Add a callback for a signal emitted by @a obj. - * - * @param obj A valid Evas_Object handle. - * @param emission The signal's name. - * @param source The signal's source. - * @param func The callback function to be executed when the signal is - * emitted. - * @param data A pointer to data to pass in to the callback function. - * - * Connects a callback function to a signal emitted by @a obj. - * In EDC, a program can emit a signal as follows: - * - * @code - * program { - * name: "emit_example"; - * action: SIGNAL_EMIT "a_signal" "a_source"; - * } - * @endcode - * - * Assuming a function with the following declaration is definded: - * - * @code - * void cb_signal(void *data, Evas_Object *o, const char *emission, const char *source); - * @endcode - * - * a callback is attached using: - * - * @code - * edje_object_signal_callback_add(obj, "a_signal", "a_source", cb_signal, data); - * @endcode - * - * Here, @a data is an arbitrary pointer to be used as desired. Note - * that @a emission and @a source correspond respectively to the first - * and the second parameters at the SIGNAL_EMIT action. - * - * Internal edje signals can also be attached to, and globs can occur - * in either the emission or source name, e.g. - * - * @code - * edje_object_signal_callback_add(obj, "mouse,down,*", "button.*", NULL); - * @endcode - * - * Here, any mouse down events on an edje part whose name begins with - * "button." will trigger the callback. The actual signal and source - * names will be passed in to the @a emission and @a source parameters - * of the callback function (e.g. "mouse,down,2" and "button.close"). - */ EAPI void edje_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) { @@ -134,25 +52,6 @@ edje_object_signal_callback_add(Evas_Object *obj, const char *emission, const ch _edje_callbacks_patterns_clean(ed); } -/** - * @brief Remove a signal-triggered callback from an object. - * - * @param obj A valid Evas_Object handle. - * @param emission The emission string. - * @param source The source string. - * @param func The callback function. - * @return The data pointer - * - * This function removes a callback, previously attached to the - * emittion of a signal, from the object @a obj. The parameters @a - * emission, @a source and @a func must match exactly those passed to - * a previous call to edje_object_signal_callback_add(). The data - * pointer that was passed to this call will be returned. - * - * @see edje_object_signal_callback_add(). - * @see edje_object_signal_callback_del_full(). - * - */ EAPI void * edje_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)) { @@ -195,26 +94,6 @@ edje_object_signal_callback_del(Evas_Object *obj, const char *emission, const ch return NULL; } -/** - * @brief Remove a signal-triggered callback from an object. - * - * @param obj A valid Evas_Object handle. - * @param emission The emission string. - * @param source The source string. - * @param func The callback function. - * @param data The user data passed to the callback. - * @return The data pointer - * - * This function removes a callback, previously attached to the - * emittion of a signal, from the object @a obj. The parameters @a - * emission, @a sourcei, @a func and @a data must match exactly those - * passed to a previous call to edje_object_signal_callback_add(). The data - * pointer that was passed to this call will be returned. - * - * @see edje_object_signal_callback_add(). - * @see edje_object_signal_callback_del(). - * - */ EAPI void * edje_object_signal_callback_del_full(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data) { @@ -257,34 +136,6 @@ edje_object_signal_callback_del_full(Evas_Object *obj, const char *emission, con return NULL; } -/** - * @brief Send a signal to an edje object. - * - * @param obj A valid Evas_Object handle. - * @param emission The signal's name. - * @param source The signal's source. - * - * This function sends a signal to the object @a obj. An edje program - * can respond to a signal by specifying matching 'signal' and - * 'source' fields. - * - * @code - * edje_object_signal_emit(obj, "a_signal", ""); - * @endcode - * - * will trigger a program whose EDC block is: - * - * @code - * program { - * name: "a_program"; - * signal: "a_signal"; - * source: ""; - * action: ... - * } - * @endcode - * - * FIXME: should this signal be sent to children also? - */ EAPI void edje_object_signal_emit(Evas_Object *obj, const char *emission, const char *source) { @@ -298,19 +149,6 @@ edje_object_signal_emit(Evas_Object *obj, const char *emission, const char *sour } /* FIXDOC: Verify/Expand */ -/** - * @brief Set the edje object to playing or paused states. - * - * @param obj A valid Evas_Object handle. - * @param play Object state (1 to playing, 0 to pauseed). - * - * This function sets the edje object @a obj to playing or paused - * states, depending on the parameter @a play. This has no effect if - * the object was already at that state. - * - * @see edje_object_play_get(). - * - */ EAPI void edje_object_play_set(Evas_Object *obj, Eina_Bool play) { @@ -347,20 +185,6 @@ edje_object_play_set(Evas_Object *obj, Eina_Bool play) } } -/** - * @brief Get the edje object's play/pause state. - * - * @param obj A valid Evas_Object handle. - * @return @c EINA_FALSE if the object is not connected, its @c delete_me flag - * is set, or it is at paused state; @c EINA_TRUE if the object is at playing - * state. - * - * This function tells if an edje object is playing or not. This state - * is set by edje_object_play_set(). - * - * @see edje_object_play_set(). - * - */ EAPI Eina_Bool edje_object_play_get(const Evas_Object *obj) { @@ -374,19 +198,6 @@ edje_object_play_get(const Evas_Object *obj) } /* FIXDOC: Verify/Expand */ -/** - * @brief Set the object's animation state. - * - * @param obj A valid Evas_Object handle. - * @param on Animation State. - * - * This function starts or stops an edje object's animation. The - * information if it's runnig can be retrieved by - * edje_object_animation_get(). - * - * @see edje_object_animation_get() - * - */ EAPI void edje_object_animation_set(Evas_Object *obj, Eina_Bool on) { @@ -444,19 +255,6 @@ edje_object_animation_set(Evas_Object *obj, Eina_Bool on) _edje_unblock(ed); } -/** - * @brief Get the edje object's animation state. - * - * @param obj A valid Evas_Object handle. - * @return @c EINA_FALSE on error or if object is not animated; - * @c EINA_TRUE if animated. - * - * This function returns if the animation is playing or not. The - * animation state is set by edje_object_play_set(). - * - * @see edje_object_animation_set(). - * - */ EAPI Eina_Bool edje_object_animation_get(const Evas_Object *obj) @@ -496,7 +294,9 @@ _edje_program_run_iterate(Edje_Running_Program *runp, double tim) { rp = ed->table_parts[pt->id % ed->table_parts_size]; if (rp) _edje_part_pos_set(ed, rp, - runp->program->tween.mode, t); + runp->program->tween.mode, t, + runp->program->tween.v1, + runp->program->tween.v2); } } if (t >= FROM_INT(1)) @@ -516,7 +316,9 @@ _edje_program_run_iterate(Edje_Running_Program *runp, double tim) NULL, 0.0); _edje_part_pos_set(ed, rp, - runp->program->tween.mode, ZERO); + runp->program->tween.mode, ZERO, + runp->program->tween.v1, + runp->program->tween.v2); rp->program = NULL; } } @@ -591,7 +393,9 @@ _edje_program_end(Edje *ed, Edje_Running_Program *runp) NULL, 0.0); _edje_part_pos_set(ed, rp, - runp->program->tween.mode, ZERO); + runp->program->tween.mode, ZERO, + runp->program->tween.v1, + runp->program->tween.v2); rp->program = NULL; } } @@ -681,7 +485,9 @@ _edje_program_run(Edje *ed, Edje_Program *pr, Eina_Bool force, const char *ssig, rp->param1.description->state.value, pr->state, pr->value); - _edje_part_pos_set(ed, rp, pr->tween.mode, ZERO); + _edje_part_pos_set(ed, rp, pr->tween.mode, ZERO, + pr->tween.v1, + pr->tween.v2); rp->program = runp; } } @@ -718,7 +524,9 @@ _edje_program_run(Edje *ed, Edje_Program *pr, Eina_Bool force, const char *ssig, pr->value, NULL, 0.0); - _edje_part_pos_set(ed, rp, pr->tween.mode, ZERO); + _edje_part_pos_set(ed, rp, pr->tween.mode, ZERO, + pr->tween.v1, + pr->tween.v2); } } } @@ -2167,8 +1975,3 @@ _edje_param_set(Edje_Real_Part *part, const char *param, const char *value) } } } - -/** - * - * @} - */ diff --git a/src/lib/edje_smart.c b/src/lib/edje_smart.c index 2e58cf9..2b847e2 100644 --- a/src/lib/edje_smart.c +++ b/src/lib/edje_smart.c @@ -18,13 +18,6 @@ Eina_List *_edje_edjes = NULL; /************************** API Routines **************************/ -/* FIXDOC: Verify/Expand */ -/** Constructs the Edje object - * @param evas A valid Evas handle - * @return The Evas_Object pointer. - * - * Creates the Edje smart object, returning the Evas_Object handle. - */ EAPI Evas_Object * edje_object_add(Evas *evas) { @@ -32,10 +25,10 @@ edje_object_add(Evas *evas) if (!_edje_smart) { - memset(&_edje_smart_parent, 0, sizeof(_edje_smart_parent)); - _edje_object_smart_set(&_edje_smart_class); - _edje_smart = - evas_smart_class_new((Evas_Smart_Class *)&_edje_smart_class); + memset(&_edje_smart_parent, 0, sizeof(_edje_smart_parent)); + _edje_object_smart_set(&_edje_smart_class); + _edje_smart = + evas_smart_class_new((Evas_Smart_Class *)&_edje_smart_class); } e = evas_object_smart_add(evas, _edje_smart); @@ -93,17 +86,17 @@ _edje_smart_add(Evas_Object *obj) ed = evas_object_smart_data_get(obj); if (!ed) { - const Evas_Smart *smart; - const Evas_Smart_Class *sc; + const Evas_Smart *smart; + const Evas_Smart_Class *sc; - ed = calloc(1, sizeof(Edje)); + ed = calloc(1, sizeof(Edje)); if (!ed) goto end_smart_add; - smart = evas_object_smart_smart_get(obj); - sc = evas_smart_class_get(smart); - ed->api = (const Edje_Smart_Api *)sc; + smart = evas_object_smart_smart_get(obj); + sc = evas_smart_class_get(smart); + ed->api = (const Edje_Smart_Api *)sc; - evas_object_smart_data_set(obj, ed); + evas_object_smart_data_set(obj, ed); } ed->base.evas = evas_object_evas_get(obj); @@ -121,18 +114,18 @@ _edje_smart_add(Evas_Object *obj) evas_object_geometry_get(obj, &(ed->x), &(ed->y), &(ed->w), &(ed->h)); ed->obj = obj; _edje_edjes = eina_list_append(_edje_edjes, obj); -/* + /* { - Eina_List *l; - const void *data; - - printf("--- EDJE DUMP [%i]\n", eina_list_count(_edje_edjes)); - EINA_LIST_FOREACH(_edge_edges, l, data) - { - ed = _edje_fetch(data); - printf("EDJE: %80s | %80s\n", ed->path, ed->part); - } - printf("--- EDJE DUMP [%i]\n", eina_list_count(_edje_edjes)); + Eina_List *l; + const void *data; + + printf("--- EDJE DUMP [%i]\n", eina_list_count(_edje_edjes)); + EINA_LIST_FOREACH(_edge_edges, l, data) + { + ed = _edje_fetch(data); + printf("EDJE: %80s | %80s\n", ed->path, ed->part); + } + printf("--- EDJE DUMP [%i]\n", eina_list_count(_edje_edjes)); } */ end_smart_add: @@ -173,8 +166,8 @@ _edje_smart_move(Evas_Object * obj, Evas_Coord x, Evas_Coord y) if (_edje_script_only(ed)) { - _edje_script_only_move(ed); - return; + _edje_script_only_move(ed); + return; } if (_edje_lua_script_only(ed)) { @@ -189,13 +182,13 @@ _edje_smart_move(Evas_Object * obj, Evas_Coord x, Evas_Coord y) } else { - unsigned int i; + unsigned int i; for (i = 0; i < ed->table_parts_size; i++) { Edje_Real_Part *ep; Evas_Coord ox, oy; - + ep = ed->table_parts[i]; evas_object_geometry_get(ep->object, &ox, &oy, NULL, NULL); evas_object_move(ep->object, ed->x + ep->x + ep->text.offset.x, ed->y + ep->y + ep->text.offset.y); @@ -226,13 +219,13 @@ _edje_smart_resize(Evas_Object * obj, Evas_Coord w, Evas_Coord h) #endif if (_edje_script_only(ed)) { - _edje_script_only_resize(ed); - return; + _edje_script_only_resize(ed); + return; } if (_edje_lua_script_only(ed)) { - _edje_lua_script_only_resize(ed); - return; + _edje_lua_script_only_resize(ed); + return; } // evas_object_resize(ed->clipper, ed->w, ed->h); ed->dirty = 1; @@ -250,9 +243,9 @@ _edje_smart_show(Evas_Object * obj) if (!ed) return; if (evas_object_visible_get(obj)) return; if (_edje_script_only(ed)) - { - _edje_script_only_show(ed); - return; + { + _edje_script_only_show(ed); + return; } if (_edje_lua_script_only(ed)) { @@ -272,9 +265,9 @@ _edje_smart_hide(Evas_Object * obj) if (!ed) return; if (!evas_object_visible_get(obj)) return; if (_edje_script_only(ed)) - { - _edje_script_only_hide(ed); - return; + { + _edje_script_only_hide(ed); + return; } if (_edje_lua_script_only(ed)) { @@ -297,5 +290,5 @@ _edje_smart_calculate(Evas_Object *obj) static Eina_Bool _edje_smart_file_set(Evas_Object *obj, const char *file, const char *group) { - return _edje_object_file_set_internal(obj, file, group, NULL); + return _edje_object_file_set_internal(obj, file, group, NULL, NULL); } diff --git a/src/lib/edje_text.c b/src/lib/edje_text.c index ba9ecb8..a2038d0 100644 --- a/src/lib/edje_text.c +++ b/src/lib/edje_text.c @@ -60,6 +60,7 @@ _edje_text_part_on_del(Edje *ed, Edje_Part *pt) Edje_Part_Description_Text *desc; unsigned int i; + if (!pt) return; if (pt->type != EDJE_PART_TYPE_TEXT && pt->type != EDJE_PART_TYPE_TEXTBLOCK) return ; @@ -147,9 +148,14 @@ _edje_text_fit_x(Edje *ed, Edje_Real_Part *ep, uc1 = evas_object_text_last_up_to_pos(ep->object, -p + l, th / 2); if (params->type.text.elipsis != 1.0) - /* should be the last in text! not the rightmost */ - uc2 = evas_object_text_last_up_to_pos(ep->object, - -p + sw - r, th / 2); + { + /* should be the last in text! not the rightmost */ + if ((-p + sw -r) < 0) + uc2 = evas_object_text_last_up_to_pos(ep->object, 0, th / 2); + else + uc2 = evas_object_text_last_up_to_pos(ep->object, + -p + sw - r, th / 2); + } if ((uc1 < 0) && (uc2 < 0)) { uc1 = 0; @@ -176,7 +182,7 @@ _edje_text_fit_x(Edje *ed, Edje_Real_Part *ep, /* Convert uc1, uc2 -> c1, c2 */ i = 0; - if (uc1 > 0) + if (uc1 >= 0) { c1 = 0; for ( ; i < uc1 ; i++) @@ -184,7 +190,7 @@ _edje_text_fit_x(Edje *ed, Edje_Real_Part *ep, c1 = evas_string_char_next_get(text, c1, NULL); } } - if (uc2 > 0) + if (uc2 >= 0) { c2 = c1; for ( ; i < uc2 ; i++) @@ -608,6 +614,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep, else evas_object_hide(ep->object); { Evas_Text_Style_Type style; + Edje_Text_Effect effect; style = EVAS_TEXT_STYLE_PLAIN; @@ -616,50 +623,46 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep, (params->color.g * params->color.a) / 255, (params->color.b * params->color.a) / 255, params->color.a); - - if ((ep->part->effect == EDJE_TEXT_EFFECT_NONE) || - (ep->part->effect == EDJE_TEXT_EFFECT_PLAIN)) - { + effect = ep->part->effect; + switch (effect & EDJE_TEXT_EFFECT_MASK_BASIC) + { + case EDJE_TEXT_EFFECT_NONE: + case EDJE_TEXT_EFFECT_PLAIN: style = EVAS_TEXT_STYLE_PLAIN; - } - else if (ep->part->effect == EDJE_TEXT_EFFECT_OUTLINE) - { + break; + case EDJE_TEXT_EFFECT_OUTLINE: style = EVAS_TEXT_STYLE_OUTLINE; evas_object_text_outline_color_set(ep->object, (params->type.text.color2.r * params->type.text.color2.a) / 255, (params->type.text.color2.g * params->type.text.color2.a) / 255, (params->type.text.color2.b * params->type.text.color2.a) / 255, params->type.text.color2.a); - } - else if (ep->part->effect == EDJE_TEXT_EFFECT_SOFT_OUTLINE) - { + break; + case EDJE_TEXT_EFFECT_SOFT_OUTLINE: style = EVAS_TEXT_STYLE_SOFT_OUTLINE; evas_object_text_outline_color_set(ep->object, (params->type.text.color2.r * params->type.text.color2.a) / 255, (params->type.text.color2.g * params->type.text.color2.a) / 255, (params->type.text.color2.b * params->type.text.color2.a) / 255, params->type.text.color2.a); - } - else if (ep->part->effect == EDJE_TEXT_EFFECT_SHADOW) - { + break; + case EDJE_TEXT_EFFECT_SHADOW: style = EVAS_TEXT_STYLE_SHADOW; evas_object_text_shadow_color_set(ep->object, (params->type.text.color3.r * params->type.text.color3.a) / 255, (params->type.text.color3.g * params->type.text.color3.a) / 255, (params->type.text.color3.b * params->type.text.color3.a) / 255, params->type.text.color3.a); - } - else if (ep->part->effect == EDJE_TEXT_EFFECT_SOFT_SHADOW) - { + break; + case EDJE_TEXT_EFFECT_SOFT_SHADOW: style = EVAS_TEXT_STYLE_SOFT_SHADOW; evas_object_text_shadow_color_set(ep->object, (params->type.text.color3.r * params->type.text.color3.a) / 255, (params->type.text.color3.g * params->type.text.color3.a) / 255, (params->type.text.color3.b * params->type.text.color3.a) / 255, params->type.text.color3.a); - } - else if (ep->part->effect == EDJE_TEXT_EFFECT_OUTLINE_SHADOW) - { + break; + case EDJE_TEXT_EFFECT_OUTLINE_SHADOW: style = EVAS_TEXT_STYLE_OUTLINE_SHADOW; evas_object_text_outline_color_set(ep->object, (params->type.text.color2.r * params->type.text.color2.a) / 255, @@ -671,9 +674,8 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep, (params->type.text.color3.g * params->type.text.color3.a) / 255, (params->type.text.color3.b * params->type.text.color3.a) / 255, params->type.text.color3.a); - } - else if (ep->part->effect == EDJE_TEXT_EFFECT_OUTLINE_SOFT_SHADOW) - { + break; + case EDJE_TEXT_EFFECT_OUTLINE_SOFT_SHADOW: style = EVAS_TEXT_STYLE_OUTLINE_SOFT_SHADOW; evas_object_text_outline_color_set(ep->object, (params->type.text.color2.r * params->type.text.color2.a) / 255, @@ -685,48 +687,84 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep, (params->type.text.color3.g * params->type.text.color3.a) / 255, (params->type.text.color3.b * params->type.text.color3.a) / 255, params->type.text.color3.a); - } - else if (ep->part->effect == EDJE_TEXT_EFFECT_FAR_SHADOW) - { + break; + case EDJE_TEXT_EFFECT_FAR_SHADOW: style = EVAS_TEXT_STYLE_FAR_SHADOW; evas_object_text_shadow_color_set(ep->object, (params->type.text.color3.r * params->type.text.color3.a) / 255, (params->type.text.color3.g * params->type.text.color3.a) / 255, (params->type.text.color3.b * params->type.text.color3.a) / 255, params->type.text.color3.a); - } - else if (ep->part->effect == EDJE_TEXT_EFFECT_FAR_SOFT_SHADOW) - { + break; + case EDJE_TEXT_EFFECT_FAR_SOFT_SHADOW: style = EVAS_TEXT_STYLE_FAR_SOFT_SHADOW; evas_object_text_shadow_color_set(ep->object, (params->type.text.color3.r * params->type.text.color3.a) / 255, (params->type.text.color3.g * params->type.text.color3.a) / 255, (params->type.text.color3.b * params->type.text.color3.a) / 255, params->type.text.color3.a); - } - else if (ep->part->effect == EDJE_TEXT_EFFECT_GLOW) - { + break; + case EDJE_TEXT_EFFECT_GLOW: style = EVAS_TEXT_STYLE_GLOW; evas_object_text_glow_color_set(ep->object, - (params->type.text.color2.r * params->type.text.color2.a) / 255, - (params->type.text.color2.g * params->type.text.color2.a) / 255, - (params->type.text.color2.b * params->type.text.color2.a) / 255, - params->type.text.color2.a); + (params->type.text.color2.r * params->type.text.color2.a) / 255, + (params->type.text.color2.g * params->type.text.color2.a) / 255, + (params->type.text.color2.b * params->type.text.color2.a) / 255, + params->type.text.color2.a); evas_object_text_glow2_color_set(ep->object, - (params->type.text.color3.r * params->type.text.color3.a) / 255, - (params->type.text.color3.g * params->type.text.color3.a) / 255, - (params->type.text.color3.b * params->type.text.color3.a) / 255, - params->type.text.color3.a); - } + (params->type.text.color3.r * params->type.text.color3.a) / 255, + (params->type.text.color3.g * params->type.text.color3.a) / 255, + (params->type.text.color3.b * params->type.text.color3.a) / 255, + params->type.text.color3.a); + break; + default: + style = EVAS_TEXT_STYLE_PLAIN; + break; + } + + switch (effect & EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION) + { + case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_RIGHT: + EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET + (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT); + break; + case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM: + EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET + (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM); + break; + case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_LEFT: + EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET + (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_LEFT); + break; + case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_LEFT: + EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET + (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_LEFT); + break; + case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP_LEFT: + EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET + (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_LEFT); + break; + case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP: + EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET + (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP); + break; + case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP_RIGHT: + EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET + (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT); + break; + case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_RIGHT: + EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET + (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_RIGHT); + break; + default: + break; + } evas_object_text_style_set(ep->object, style); } - - if (free_text) - free((char *)text); - if (font2) - free(font2); - if (sfont) - free(sfont); + + if (free_text) free((char *)text); + if (font2) free(font2); + if (sfont) free(sfont); } Evas_Font_Size diff --git a/src/lib/edje_util.c b/src/lib/edje_util.c index 124032f..16b1371 100644 --- a/src/lib/edje_util.c +++ b/src/lib/edje_util.c @@ -47,14 +47,6 @@ Edje_Real_Part *_edje_real_part_recursive_get_helper(const Edje *ed, char **path #define FASTFREEZE 1 -/** - * @brief Freeze Edje objects. - * - * This function freezes every edje objects in the current process. - * - * See edje_object_freeze(). - * - */ EAPI void edje_freeze(void) { @@ -95,14 +87,6 @@ _edje_thaw_edje(Edje *ed) } #endif -/** - * @brief Thaw edje objects. - * - * This function thaw all edje object in the current process. - * - * See edje_object_thaw(). - * - */ EAPI void edje_thaw(void) { @@ -132,14 +116,6 @@ edje_thaw(void) #endif } -/** - * @brief Set the edje append fontset. - * - * @param fonts The fontset to append. - * - * This function sets the edje append fontset. - * - */ EAPI void edje_fontset_append_set(const char *fonts) { @@ -148,43 +124,12 @@ edje_fontset_append_set(const char *fonts) _edje_fontset_append = fonts ? strdup(fonts) : NULL; } -/** - * @brief Get the edje append fontset. - * - * @return The edje append fontset. - * - * This function returns the edje append fontset set by - * edje_fontset_append_set() function. - * - * @see edje_fontset_append_set(). - * - */ EAPI const char * edje_fontset_append_get(void) { return _edje_fontset_append; } -/** - * @brief Set edje's global scaling factor. - * - * @param scale The edje (global) scale factor. The defaul is 1.0. - * - * Edje allows one to build scalable interfaces. Scale factors, which - * are set to neutral values by default (no scaling, actual sizes), - * are of two types: global and individual. Edje's global scaling - * factor will affect all its objects which hadn't their individual - * scaling factors altered from the default value. If they had it set - * differently, that factor will override the global one. - * - * Scaling affects the values of min/max object sizes, which are - * multiplied by it. Font sizes are scaled, too. - * - * This property can be retrieved with edje_scale_get(). - * - * @see edje_scale_get(). - * - */ EAPI void edje_scale_set(double scale) { @@ -197,39 +142,12 @@ edje_scale_set(double scale) edje_object_calc_force(data); } -/** - * @brief Get edje's global scaling factor. - * - * @return The edje (global) scale factor. The defaul is 1.0. - * - * This function returns edje's global scale factor, which can be set - * by edje_scale_set(). - * - * @see edje_scale_set(). - * - */ EAPI double edje_scale_get(void) { return TO_DOUBLE(_edje_scale); } -/** - * @brief Set the edje object's scaling factor. - * - * @param obj The edje object's reference. - * @param scale The edje object scale factor. The defaul is 1.0. - * - * This function sets the individual scale factor of the @a obj edje - * object. This property (or edje's global scale factor, when - * applicable), will affect this object's parts. However, only parts - * which, at the EDC language level, were declared which the "scale" - * attribute set to 1 (default is zero) will be affected. - * - * This scale factor can be retrieved with edje_object_scale_get(). - * @see edje_object_scale_get(). - * - */ EAPI Eina_Bool edje_object_scale_set(Evas_Object *obj, double scale) { @@ -243,17 +161,6 @@ edje_object_scale_set(Evas_Object *obj, double scale) return EINA_TRUE; } -/** - * @brief Get the edje object's scaling factor. - * - * @param obj The edje object's reference. - * - * This function returns the individual scale factor of the @a obj - * edje object, which can be set by edje_object_scale_set(). - * - * @see edje_object_scale_set(). - * - */ EAPI double edje_object_scale_get(const Evas_Object *obj) { @@ -264,15 +171,6 @@ edje_object_scale_get(const Evas_Object *obj) return TO_DOUBLE(ed->scale); } -/** - * Get the RTL orientation for this object. - * - * You can RTL orientation explicitly with edje_object_mirrored_set. - * - * @param obj the smart object - * @return if flag is set or not. - * @since 1.1.0 - */ EAPI Eina_Bool edje_object_mirrored_get(const Evas_Object *obj) { @@ -293,13 +191,6 @@ _edje_object_orientation_inform(Evas_Object *obj) edje_object_signal_emit(obj, "edje,state,ltr", "edje"); } -/** - * Set the RTL orientation for this object. - * - * @param obj the smart object - * @rtl new value of flag EINA_TRUE/EINA_FALSE - * @since 1.1.0 - */ EAPI void edje_object_mirrored_set(Evas_Object *obj, Eina_Bool rtl) { @@ -404,30 +295,6 @@ edje_autoperiod_allow_get(void) return _edje_autoperiod_allow; } -/** - * @brief Get Edje object data. - * - * @param obj A valid Evas_Object handle - * @param key The data key - * @return The data string - * - * This function fetches data specified at the object level. - * - * In EDC this comes from a data block within the group block that @a - * obj was loaded from. E.g. - * - * @code - * collections { - * group { - * name: "a_group"; - * data { - * item: "key1" "value1"; - * item: "key2" "value2"; - * } - * } - * } - * @endcode - */ EAPI const char * edje_object_data_get(const Evas_Object *obj, const char *key) { @@ -441,16 +308,6 @@ edje_object_data_get(const Evas_Object *obj, const char *key) return edje_string_get(eina_hash_find(ed->collection->data, key)); } -/** - * @brief Freeze object. - * - * @param obj A valid Evas_Object handle - * @return The frozen state or 0 on Error - * - * This function puts all changes on hold. Successive freezes will - * nest, requiring an equal number of thaws. - * - */ EAPI int edje_object_freeze(Evas_Object *obj) { @@ -469,15 +326,6 @@ edje_object_freeze(Evas_Object *obj) return _edje_freeze(ed); } -/** - * @brief Thaw object. - * - * @param obj A valid Evas_Object handle - * @return The frozen state or 0 on Error - * - * This allows frozen changes to occur. - * - */ EAPI int edje_object_thaw(Evas_Object *obj) { @@ -497,42 +345,6 @@ edje_object_thaw(Evas_Object *obj) return _edje_thaw(ed); } -/** - * @brief Set Edje color class. - * - * @param color_class - * @param r Object Red value - * @param g Object Green value - * @param b Object Blue value - * @param a Object Alpha value - * @param r2 Outline Red value - * @param g2 Outline Green value - * @param b2 Outline Blue value - * @param a2 Outline Alpha value - * @param r3 Shadow Red value - * @param g3 Shadow Green value - * @param b3 Shadow Blue value - * @param a3 Shadow Alpha value - * - * This function sets the color values for a process level color - * class. This will cause all edje parts in the current process that - * have the specified color class to have their colors multiplied by - * these values. (Object level color classes set by - * edje_object_color_class_set() will override the values set by this - * function). - * - * The first color is the object, the second is the text outline, and - * the third is the text shadow. (Note that the second two only apply - * to text parts). - * - * Setting color emits a signal "color_class,set" with source being - * the given color class in all objects. - * - * @see edje_color_class_set(). - * - * @note unlike Evas, Edje colors are @b not pre-multiplied. That is, - * half-transparent white is 255 255 255 128. - */ EAPI 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) { @@ -602,40 +414,6 @@ edje_color_class_set(const char *color_class, int r, int g, int b, int a, int r2 return EINA_TRUE; } -/** - * @brief Get Edje color class. - * - * @param color_class - * @param r Object Red value - * @param g Object Green value - * @param b Object Blue value - * @param a Object Alpha value - * @param r2 Outline Red value - * @param g2 Outline Green value - * @param b2 Outline Blue value - * @param a2 Outline Alpha value - * @param r3 Shadow Red value - * @param g3 Shadow Green value - * @param b3 Shadow Blue value - * @param a3 Shadow Alpha value - * - * @return EINA_TRUE if found or EINA_FALSE if not found and all - * values are zeroed. - * - * This function gets the color values for a process level color - * class. This value is the globally set and not per-object, that is, - * the value that would be used by objects if they did not override with - * edje_object_color_class_set(). - * - * The first color is the object, the second is the text outline, and - * the third is the text shadow. (Note that the second two only apply - * to text parts). - * - * @see edje_color_class_set(). - * - * @note unlike Evas, Edje colors are @b not pre-multiplied. That is, - * half-transparent white is 255 255 255 128. - */ EAPI 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) { @@ -670,17 +448,6 @@ edje_color_class_get(const char *color_class, int *r, int *g, int *b, int *a, in } } -/** - * @brief Delete edje color class. - * - * @param color_class - * - * This function deletes any values at the process level for the - * specified color class. - * - * Deleting color emits a signal "color_class,del" with source being - * the given color class in all objects. - */ void edje_color_class_del(const char *color_class) { @@ -712,16 +479,6 @@ edje_color_class_del(const char *color_class) } } -/** - * @brief Lists color classes. - * - * @return A list of color class names (strings). These strings and - * the list must be free()'d by the caller. - * - * This function lists all color classes known about by the current - * process. - * - */ Eina_List * edje_color_class_list(void) { @@ -744,39 +501,6 @@ _edje_color_class_list_foreach(const Eina_Hash *hash __UNUSED__, const void *key return EINA_TRUE; } -/** - * @brief Sets the object color class. - * - * @param obj A valid Evas_Object handle - * @param color_class - * @param r Object Red value - * @param g Object Green value - * @param b Object Blue value - * @param a Object Alpha value - * @param r2 Outline Red value - * @param g2 Outline Green value - * @param b2 Outline Blue value - * @param a2 Outline Alpha value - * @param r3 Shadow Red value - * @param g3 Shadow Green value - * @param b3 Shadow Blue value - * @param a3 Shadow Alpha value - * - * This function sets the color values for an object level color - * class. This will cause all edje parts in the specified object that - * have the specified color class to have their colors multiplied by - * these values. - * - * The first color is the object, the second is the text outline, and - * the third is the text shadow. (Note that the second two only apply - * to text parts). - * - * Setting color emits a signal "color_class,set" with source being - * the given color. - * - * @note unlike Evas, Edje colors are @b not pre-multiplied. That is, - * half-transparent white is 255 255 255 128. - */ EAPI 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) { @@ -871,38 +595,6 @@ edje_object_color_class_set(Evas_Object *obj, const char *color_class, int r, in return EINA_TRUE; } -/** - * @brief Gets the object color class. - * - * @param obj A valid Evas_Object handle - * @param color_class - * @param r Object Red value - * @param g Object Green value - * @param b Object Blue value - * @param a Object Alpha value - * @param r2 Outline Red value - * @param g2 Outline Green value - * @param b2 Outline Blue value - * @param a2 Outline Alpha value - * @param r3 Shadow Red value - * @param g3 Shadow Green value - * @param b3 Shadow Blue value - * @param a3 Shadow Alpha value - * - * @return EINA_TRUE if found or EINA_FALSE if not found and all - * values are zeroed. - * - * This function gets the color values for an object level color - * class. If no explicit object color is set, then global values will - * be used. - * - * The first color is the object, the second is the text outline, and - * the third is the text shadow. (Note that the second two only apply - * to text parts). - * - * @note unlike Evas, Edje colors are @b not pre-multiplied. That is, - * half-transparent white is 255 255 255 128. - */ EAPI Eina_Bool edje_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) { @@ -933,18 +625,6 @@ edje_object_color_class_get(const Evas_Object *obj, const char *color_class, int } } -/** - * @brief Delete the object color class. - * - * @param obj The edje object's reference. - * @param color_class The color class to be deleted. - * - * This function deletes any values at the object level for the - * specified object and color class. - * - * Deleting color emits a signal "color_class,del" with source being - * the given color. - */ void edje_object_color_class_del(Evas_Object *obj, const char *color_class) { @@ -984,19 +664,6 @@ edje_object_color_class_del(Evas_Object *obj, const char *color_class) _edje_emit(ed, "color_class,del", color_class); } -/** - * @brief Set the Edje text class. - * - * @param text_class The text class name - * @param font The font name - * @param size The font size - * - * This function sets updates all edje members which belong to this - * text class with the new font attributes. - * - * @see edje_text_class_get(). - * - */ EAPI Eina_Bool edje_text_class_set(const char *text_class, const char *font, Evas_Font_Size size) { @@ -1059,15 +726,6 @@ edje_text_class_set(const char *text_class, const char *font, Evas_Font_Size siz return EINA_TRUE; } -/** - * @brief Delete the text class. - * - * @param text_class The text class name string - * - * This function deletes any values at the process level for the - * specified text class. - * - */ void edje_text_class_del(const char *text_class) { @@ -1100,16 +758,6 @@ edje_text_class_del(const char *text_class) } } -/** - * @brief List text classes. - * - * @return A list of text class names (strings). These strings are - * stringshares and the list must be free()'d by the caller. - * - * This function lists all text classes known about by the current - * process. - * - */ Eina_List * edje_text_class_list(void) { @@ -1131,17 +779,6 @@ _edje_text_class_list_foreach(const Eina_Hash *hash __UNUSED__, const void *key, return EINA_TRUE; } -/** - * @brief Sets Edje text class. - * - * @param obj A valid Evas_Object handle - * @param text_class The text class name - * @param font Font name - * @param size Font Size - * - * This function sets the text class for the Edje. - * - */ EAPI Eina_Bool edje_object_text_class_set(Evas_Object *obj, const char *text_class, const char *font, Evas_Font_Size size) { @@ -1216,17 +853,6 @@ edje_object_text_class_set(Evas_Object *obj, const char *text_class, const char return EINA_TRUE; } -/** - * @brief Check if Edje part exists. - * - * @param obj A valid Evas_Object handle - * @param part The part name to check - * - * @return 0 on Error, 1 if Edje part exists. - * - * This function returns if a part exists in the edje. - * - */ EAPI Eina_Bool edje_object_part_exists(const Evas_Object *obj, const char *part) { @@ -1240,22 +866,6 @@ edje_object_part_exists(const Evas_Object *obj, const char *part) return EINA_TRUE; } -/** - * @brief Gets the evas object from a part. - * - * @param obj A valid Evas_Object handle - * @param part The Edje part - * @return Returns the Evas_Object corresponding to the given part, or - * NULL on failure (if the part doesn't exist) - * - * This functio gets the Evas_Object corresponding to a given part. - * - * You should never modify the state of the returned object (with - * evas_object_move() or evas_object_hide() for example), but you can - * safely query info about its current state (with - * evas_object_visible_get() or evas_object_color_get() for example) - * - **/ EAPI const Evas_Object * edje_object_part_object_get(const Evas_Object *obj, const char *part) { @@ -1273,21 +883,6 @@ edje_object_part_object_get(const Evas_Object *obj, const char *part) return rp->object; } -/** - * @brief Get the geometry of an Edje part. - * - * @param obj A valid Evas_Object handle - * @param part The Edje part - * @param x The x coordinate pointer - * @param y The y coordinate pointer - * @param w The width pointer - * @param h The height pointer - * - * This function gets the geometry of an Edje part. - * - * It is valid to pass NULL as any of @a x, @a y, @a w or @a h, whose - * values you are uninterested in. - */ EAPI 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 ) { @@ -1323,16 +918,6 @@ edje_object_part_geometry_get(const Evas_Object *obj, const char *part, Evas_Coo return EINA_TRUE; } -/** - * @brief Set the function that provides item objects for named items in an edje entry text - * - * @param obj A valid Evas Object handle - * @param func The function to call (or NULL to disable) to get item objects - * @param data The data pointer to pass to the @p func callback - * - * Item objects may be deleted any time by Edje, and will be deleted when the - * Edje object is deleted (or file is set to a new file). - */ EAPI void edje_object_item_provider_set(Evas_Object *obj, Edje_Item_Provider_Cb func, void *data) { @@ -1345,19 +930,6 @@ edje_object_item_provider_set(Evas_Object *obj, Edje_Item_Provider_Cb func, void } /* FIXDOC: New Function */ -/** - * @brief Set the object text callback. - * - * @param obj A valid Evas_Object handle - * @param func The callback function to handle the text change - * @param data The data associated to the callback function. - * - * This function gets the geometry of an Edje part - * - * It is valid to pass NULL as any of @a x, @a y, @a w or @a h, whose - * values you are uninterested in. - * - */ EAPI void edje_object_text_change_cb_set(Evas_Object *obj, Edje_Text_Change_Cb func, void *data) { @@ -1406,6 +978,40 @@ _edje_object_part_text_raw_set(Evas_Object *obj, Edje_Real_Part *rp, const char return EINA_TRUE; } +Eina_Bool +_edje_object_part_text_raw_append(Evas_Object *obj, Edje_Real_Part *rp, const char *part, const char *text) +{ + if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) + _edje_entry_text_markup_append(rp, text); + else if (text) + { + if (rp->text.text) + { + char *new = NULL; + int len_added = strlen(text); + int len_old = strlen(rp->text.text); + new = malloc(len_old + len_added + 1); + memcpy(new, rp->text.text, len_old); + memcpy(new + len_old, text, len_added); + new[len_old + len_added] = '\0'; + eina_stringshare_replace(&rp->text.text, new); + free(new); + } + else + { + eina_stringshare_replace(&rp->text.text, text); + } + } + rp->edje->dirty = 1; +#ifdef EDJE_CALC_CACHE + rp->invalidate = 1; +#endif + _edje_recalc(rp->edje); + if (rp->edje->text_change.func) + rp->edje->text_change.func(rp->edje->text_change.data, obj, part); + return EINA_TRUE; +} + /** Sets the text for an object part * @param obj A valid Evas Object handle * @param part The part name @@ -1570,20 +1176,6 @@ _edje_text_unescape(const char *text) return ret; } -/** - * @brief Sets the raw (non escaped) text for an object part. - * - * @param obj A valid Evas Object handle - * @param part The part name - * @param text_to_escape The text string - * - * This funciton will do escape for you if it is a TEXTBLOCK part, - * that is, if text contain tags, these tags will not be - * interpreted/parsed by TEXTBLOCK. - * - * @see edje_object_part_text_unescaped_get(). - * - */ EAPI Eina_Bool edje_object_part_text_unescaped_set(Evas_Object *obj, const char *part, const char *text_to_escape) { @@ -1607,22 +1199,6 @@ edje_object_part_text_unescaped_set(Evas_Object *obj, const char *part, const ch return ret; } -/** - * @brief Returns the text of the object part, without escaping. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @return The @b allocated text string without escaping, or NULL on - * problems. - * - * This function is the counterpart of - * edje_object_part_text_unescaped_set(). Please notice that the - * result is newly allocated memory and should be released with free() - * when done. - * - * @see edje_object_part_text_unescaped_set(). - * - */ EAPI char * edje_object_part_text_unescaped_get(const Evas_Object *obj, const char *part) { @@ -1654,16 +1230,6 @@ edje_object_part_text_unescaped_get(const Evas_Object *obj, const char *part) return NULL; } -/** - * @brief Return the selection text of the object part. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @return The text string - * - * This function returns selection text of the object part. - * - */ EAPI const char * edje_object_part_text_selection_get(const Evas_Object *obj, const char *part) { @@ -1679,15 +1245,6 @@ edje_object_part_text_selection_get(const Evas_Object *obj, const char *part) return NULL; } -/** - * @brief Set the selection to be none. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * - * This function sets the selection text to be none. - * - */ EAPI void edje_object_part_text_select_none(const Evas_Object *obj, const char *part) { @@ -1702,15 +1259,6 @@ edje_object_part_text_select_none(const Evas_Object *obj, const char *part) _edje_entry_select_none(rp); } -/** - * @brief Set the selection to be everything. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * - * This function selects all text of the object of the part. - * - */ EAPI void edje_object_part_text_select_all(const Evas_Object *obj, const char *part) { @@ -1725,17 +1273,6 @@ edje_object_part_text_select_all(const Evas_Object *obj, const char *part) _edje_entry_select_all(rp); } -/** - * @brief Insert text for an object part. - * - * @param obj A valid Evas Object handle - * @param part The part name - * @param text The text string - * - * This function inserts the text for an object part just before the - * cursor position. - * - */ EAPI void edje_object_part_text_insert(Evas_Object *obj, const char *part, const char *text) { @@ -1758,17 +1295,27 @@ edje_object_part_text_insert(Evas_Object *obj, const char *part, const char *tex rp->edje->text_change.func(rp->edje->text_change.data, obj, part); } -/** - * @brief Return a list of char anchor names. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * - * @return The list of anchors (const char *), do not modify! - * - * This function returns a list of char anchor names. - * - */ +EAPI void +edje_object_part_text_append(Evas_Object *obj, const char *part, const char *text) +{ + Edje *ed; + Edje_Real_Part *rp; + + ed = _edje_fetch(obj); + if ((!ed) || (!part)) return; + rp = _edje_real_part_recursive_get(ed, (char *)part); + if (!rp) return; + if ((rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return; + _edje_object_part_text_raw_append(obj, rp, part, text); + rp->edje->dirty = 1; +#ifdef EDJE_CALC_CACHE + rp->invalidate = 1; +#endif + _edje_recalc(rp->edje); + if (rp->edje->text_change.func) + rp->edje->text_change.func(rp->edje->text_change.data, obj, part); +} + EAPI const Eina_List * edje_object_part_text_anchor_list_get(const Evas_Object *obj, const char *part) { @@ -1784,20 +1331,6 @@ edje_object_part_text_anchor_list_get(const Evas_Object *obj, const char *part) return NULL; } -/** - * @brief Return a list of Evas_Textblock_Rectangle anchor rectangles. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param anchor The anchor name - * - * @return The list of anchor rects (const Evas_Textblock_Rectangle - * *), do not modify! Geometry is relative to entry part. - * - * This function return a list of Evas_Textblock_Rectangle anchor - * rectangles. - * - */ EAPI const Eina_List * edje_object_part_text_anchor_geometry_get(const Evas_Object *obj, const char *part, const char *anchor) { @@ -1813,17 +1346,6 @@ edje_object_part_text_anchor_geometry_get(const Evas_Object *obj, const char *pa return NULL; } -/** - * @brief Return a list of char item names. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * - * @return The list of items (const char *), do not modify! - * - * This function returns a list of char item names. - * - */ EAPI const Eina_List * edje_object_part_text_item_list_get(const Evas_Object *obj, const char *part) { @@ -1839,23 +1361,6 @@ edje_object_part_text_item_list_get(const Evas_Object *obj, const char *part) return NULL; } -/** - * @brief Return item geometry. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param item The item name - * @param cx Item x return (relative to entry part) - * @param cy Item y return (relative to entry part) - * @param cw Item width return - * @param ch Item height return - * - * @return 1 if item exists, 0 if not - * - * This function return a list of Evas_Textblock_Rectangle item - * rectangles. - * - */ EAPI 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) { @@ -1871,18 +1376,6 @@ edje_object_part_text_item_geometry_get(const Evas_Object *obj, const char *part return EINA_FALSE; } -/** - * @brief Returns the cursor geometry of the part relative to the edje - * object. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param x Cursor X position - * @param y Cursor Y position - * @param w Cursor width - * @param h Cursor height - * - */ EAPI 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) { @@ -1906,14 +1399,6 @@ edje_object_part_text_cursor_geometry_get(const Evas_Object *obj, const char *pa return; } -/** - * @brief Enables selection if the entry is an EXPLICIT selection mode - * type. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param allow EINA_TRUE to enable, EINA_FALSE otherwise - */ EAPI void edje_object_part_text_select_allow_set(const Evas_Object *obj, const char *part, Eina_Bool allow) { @@ -1928,12 +1413,6 @@ edje_object_part_text_select_allow_set(const Evas_Object *obj, const char *part, _edje_entry_select_allow_set(rp, allow); } -/** - * @brief Aborts any selection action on a part. - * - * @param obj A valid Evas_Object handle - * @param part The part name - */ EAPI void edje_object_part_text_select_abort(const Evas_Object *obj, const char *part) { @@ -1948,12 +1427,6 @@ edje_object_part_text_select_abort(const Evas_Object *obj, const char *part) _edje_entry_select_abort(rp); } -/** - * @brief Starts selecting at current cursor position - * - * @param obj A valid Evas_Object handle - * @param part The part name - */ EAPI void edje_object_part_text_select_begin(const Evas_Object *obj, const char *part) { @@ -1968,12 +1441,6 @@ edje_object_part_text_select_begin(const Evas_Object *obj, const char *part) _edje_entry_select_begin(rp); } -/** - * @brief Extends the current selection to the current cursor position - * - * @param obj A valid Evas_Object handle - * @param part The part name - */ EAPI void edje_object_part_text_select_extend(const Evas_Object *obj, const char *part) { @@ -2137,14 +1604,6 @@ edje_object_part_text_cursor_next(Evas_Object *obj, const char *part, Edje_Curso return EINA_FALSE; } -/** - * @brief Moves the cursor to the previous char - * @see evas_textblock_cursor_char_prev - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param cur the edje cursor to work on - */ EAPI Eina_Bool edje_object_part_text_cursor_prev(Evas_Object *obj, const char *part, Edje_Cursor cur) { @@ -2162,13 +1621,6 @@ edje_object_part_text_cursor_prev(Evas_Object *obj, const char *part, Edje_Curso return EINA_FALSE; } -/** - * @brief Move the cursor to the char above the current cursor position. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param cur the edje cursor to work on - */ EAPI Eina_Bool edje_object_part_text_cursor_up(Evas_Object *obj, const char *part, Edje_Cursor cur) { @@ -2186,13 +1638,6 @@ edje_object_part_text_cursor_up(Evas_Object *obj, const char *part, Edje_Cursor return EINA_FALSE; } -/** - * @brief Moves the cursor to the char below the current cursor position. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param cur the edje cursor to work on - */ EAPI Eina_Bool edje_object_part_text_cursor_down(Evas_Object *obj, const char *part, Edje_Cursor cur) { @@ -2210,14 +1655,6 @@ edje_object_part_text_cursor_down(Evas_Object *obj, const char *part, Edje_Curso return EINA_FALSE; } -/** - * @brief Moves the cursor to the beginning of the text part - * @see evas_textblock_cursor_paragraph_first - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param cur the edje cursor to work on - */ EAPI void edje_object_part_text_cursor_begin_set(Evas_Object *obj, const char *part, Edje_Cursor cur) { @@ -2234,14 +1671,6 @@ edje_object_part_text_cursor_begin_set(Evas_Object *obj, const char *part, Edje_ } } -/** - * @brief Moves the cursor to the end of the text part. - * @see evas_textblock_cursor_paragraph_last - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param cur the edje cursor to work on - */ EAPI void edje_object_part_text_cursor_end_set(Evas_Object *obj, const char *part, Edje_Cursor cur) { @@ -2258,14 +1687,6 @@ edje_object_part_text_cursor_end_set(Evas_Object *obj, const char *part, Edje_Cu } } -/** - * @brief Copy the cursor to another cursor. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param sry the cursor to copy from - * @param dst the cursor to copy to - */ EAPI void edje_object_part_text_cursor_copy(Evas_Object *obj, const char *part, Edje_Cursor src, Edje_Cursor dst) { @@ -2282,14 +1703,6 @@ edje_object_part_text_cursor_copy(Evas_Object *obj, const char *part, Edje_Curso } } -/** - * @brief Move the cursor to the beginning of the line. - * @see evas_textblock_cursor_line_char_first - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param cur the edje cursor to work on - */ EAPI void edje_object_part_text_cursor_line_begin_set(Evas_Object *obj, const char *part, Edje_Cursor cur) { @@ -2306,14 +1719,6 @@ edje_object_part_text_cursor_line_begin_set(Evas_Object *obj, const char *part, } } -/** - * @brief Move the cursor to the end of the line. - * @see evas_textblock_cursor_line_char_last - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param cur the edje cursor to work on - */ EAPI void edje_object_part_text_cursor_line_end_set(Evas_Object *obj, const char *part, Edje_Cursor cur) { @@ -2330,18 +1735,6 @@ edje_object_part_text_cursor_line_end_set(Evas_Object *obj, const char *part, Ed } } -/** - * Position the given cursor to a X,Y position. - * - * This is frequently used with the user cursor. - * - * @param obj An Edje object. - * @param part The part containing the object. - * @param cur The cursor to adjust. - * @param x X Coordinate. - * @param y Y Coordinate. - * @return True on success, false on error. - */ EAPI Eina_Bool edje_object_part_text_cursor_coord_set(Evas_Object *obj, const char *part, Edje_Cursor cur, Evas_Coord x, Evas_Coord y) @@ -2360,15 +1753,6 @@ edje_object_part_text_cursor_coord_set(Evas_Object *obj, const char *part, return EINA_FALSE; } -/** - * @brief Returns whether the cursor points to a format. - * @see evas_textblock_cursor_is_format - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param cur The cursor to adjust. - * @return EINA_TRUE if it's true, EINA_FALSE otherwise. - */ EAPI Eina_Bool edje_object_part_text_cursor_is_format_get(const Evas_Object *obj, const char *part, Edje_Cursor cur) { @@ -2386,15 +1770,6 @@ edje_object_part_text_cursor_is_format_get(const Evas_Object *obj, const char *p return EINA_FALSE; } -/** - * @brief Return true if the cursor points to a visible format - * For example \t, \n, item and etc. - * @see evas_textblock_cursor_format_is_visible_get - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param cur The cursor to adjust. - */ EAPI Eina_Bool edje_object_part_text_cursor_is_visible_format_get(const Evas_Object *obj, const char *part, Edje_Cursor cur) { @@ -2412,14 +1787,6 @@ edje_object_part_text_cursor_is_visible_format_get(const Evas_Object *obj, const return 0; } -/** - * @brief Returns the content (char) at the cursor position. - * @see evas_textblock_cursor_content_get - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param cur The cursor to use - */ EAPI const char * edje_object_part_text_cursor_content_get(const Evas_Object *obj, const char *part, Edje_Cursor cur) { @@ -2437,15 +1804,6 @@ edje_object_part_text_cursor_content_get(const Evas_Object *obj, const char *par return NULL; } -/** - * @brief Sets the cursor position to the given value - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param cur The cursor to move - * @param pos the position of the cursor - * @since 1.1.0 - */ EAPI void edje_object_part_text_cursor_pos_set(Evas_Object *obj, const char *part, Edje_Cursor cur, int pos) { @@ -2462,15 +1820,6 @@ edje_object_part_text_cursor_pos_set(Evas_Object *obj, const char *part, Edje_Cu } } -/** - * @brief Retrieves the current position of the cursor - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param cur The cursor to get the position - * @return The cursor position - * @since 1.1.0 - */ EAPI int edje_object_part_text_cursor_pos_get(const Evas_Object *obj, const char *part, Edje_Cursor cur) { @@ -2488,30 +1837,6 @@ edje_object_part_text_cursor_pos_get(const Evas_Object *obj, const char *part, E return 0; } -/** - * Add a filter function for newly inserted text. - * - * Whenever text is inserted (not the same as set) into the given @p part, - * the list of filter functions will be called to decide if and how the new - * text will be accepted. - * There are three types of filters, EDJE_TEXT_FILTER_TEXT, - * EDJE_TEXT_FILTER_FORMAT and EDJE_TEXT_FILTER_MARKUP. - * The text parameter in the @p func filter can be modified by the user and - * it's up to him to free the one passed if he's to change the pointer. If - * doing so, the newly set text should be malloc'ed, as once all the filters - * are called Edje will free it. - * If the text is to be rejected, freeing it and setting the pointer to NULL - * will make Edje break out of the filter cycle and reject the inserted - * text. - * - * @see edje_object_text_insert_filter_callback_del - * @see edje_object_text_insert_filter_callback_del_full - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param func The callback function that will act as filter - * @param data User provided data to pass to the filter function - */ EAPI void edje_object_text_insert_filter_callback_add(Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func, void *data) { @@ -2528,21 +1853,6 @@ edje_object_text_insert_filter_callback_add(Evas_Object *obj, const char *part, eina_list_append(ed->text_insert_filter_callbacks, cb); } -/** - * Delete a function from the filter list. - * - * Delete the given @p func filter from the list in @p part. Returns - * the user data pointer given when added. - * - * @see edje_object_text_insert_filter_callback_add - * @see edje_object_text_insert_filter_callback_del_full - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param func The function callback to remove - * - * @return The user data pointer if succesful, or NULL otherwise - */ EAPI void * edje_object_text_insert_filter_callback_del(Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func) { @@ -2567,23 +1877,6 @@ edje_object_text_insert_filter_callback_del(Evas_Object *obj, const char *part, return NULL; } -/** - * Delete a function and matching user data from the filter list. - * - * Delete the given @p func filter and @p data user data from the list - * in @p part. - * Returns the user data pointer given when added. - * - * @see edje_object_text_insert_filter_callback_add - * @see edje_object_text_insert_filter_callback_del - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param func The function callback to remove - * @param data The data passed to the callback function - * - * @return The same data pointer if succesful, or NULL otherwise - */ EAPI void * edje_object_text_insert_filter_callback_del_full(Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func, void *data) { @@ -2609,20 +1902,6 @@ edje_object_text_insert_filter_callback_del_full(Evas_Object *obj, const char *p return NULL; } -/** - * @brief Swallows an object into the edje. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param obj_swallow The object to swallow - * - * Swallows the object into the edje part so that all geometry changes - * for the part affect the swallowed object. (e.g. resize, move, show, - * raise/lower, etc.). - * - * If an object has already been swallowed into this part, then it - * will first be unswallowed before the new object is swallowed. - */ EAPI Eina_Bool edje_object_part_swallow(Evas_Object *obj, const char *part, Evas_Object *obj_swallow) { @@ -2649,7 +1928,7 @@ edje_object_part_swallow(Evas_Object *obj, const char *part, Evas_Object *obj_sw ERR("cannot unswallow part %s: not swallow type!", rp->part->name); return EINA_FALSE; } - _edje_real_part_swallow(rp, obj_swallow); + _edje_real_part_swallow(rp, obj_swallow, EINA_TRUE); return EINA_TRUE; } @@ -2666,15 +1945,6 @@ _recalc_extern_parent(Evas_Object *obj) _edje_recalc(ed); } -/** - * @brief Set the object minimum size. - * - * @param obj A valid Evas_Object handle - * @param minw The minimum width - * @param minh The minimum height - * - * This sets the minimum size restriction for the object. - */ EAPI void edje_extern_object_min_size_set(Evas_Object *obj, Evas_Coord minw, Evas_Coord minh) { @@ -2691,15 +1961,6 @@ edje_extern_object_min_size_set(Evas_Object *obj, Evas_Coord minw, Evas_Coord mi } } -/** - * @brief Set the object maximum size. - * - * @param obj A valid Evas_Object handle - * @param maxw The maximum width - * @param maxh The maximum height - * - * This sets the maximum size restriction for the object. - */ EAPI void edje_extern_object_max_size_set(Evas_Object *obj, Evas_Coord maxw, Evas_Coord maxh) { @@ -2716,19 +1977,6 @@ edje_extern_object_max_size_set(Evas_Object *obj, Evas_Coord maxw, Evas_Coord ma } } -/** - * @brief Set the object aspect size. - * - * @param obj A valid Evas_Object handle - * @param aspect The aspect control axes - * @param aw The aspect radio width - * @param ah The aspect ratio height - * - * This sets the desired aspect ratio to keep an object that will be - * swallowed by Edje. The width and height define a preferred size - * ASPECT and the object may be scaled to be larger or smaller, but - * retaining the relative scale of both aspect width and height. - */ EAPI void edje_extern_object_aspect_set(Evas_Object *obj, Edje_Aspect_Control aspect, Evas_Coord aw, Evas_Coord ah) { @@ -2892,28 +2140,6 @@ _edje_box_layout_external_new(const char *name, Evas_Object_Box_Layout func, voi return l; } -/** - * @brief Registers a custom layout to be used in edje boxes. - * - * @param name The name of the layout - * @param func The function defining the layout - * @param layout_data_get This function gets the custom data pointer - * for func - * @param layout_data_free Passed to func to free its private data - * when needed - * @param free_data Frees data - * @param data Private pointer passed to layout_data_get - * - * This function registers custom layouts that can be referred from - * themes by the registered name. The Evas_Object_Box_Layout - * functions receive two pointers for internal use, one being private - * data, and the other the function to free that data when it's not - * longer needed. From Edje, this private data will be retrieved by - * calling layout_data_get, and layout_data_free will be the free - * function passed to func. layout_data_get will be called with data - * as its parameter, and this one will be freed by free_data whenever - * the layout is unregistered from Edje. - */ EAPI 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) { @@ -2972,14 +2198,6 @@ edje_box_layout_register(const char *name, Evas_Object_Box_Layout func, void *(* } } -/** - * @brief Unswallow an object. - * - * @param obj A valid Evas_Object handle - * @param obj_swallow The swallowed object - * - * Causes the edje to regurgitate a previously swallowed object. :) - */ EAPI void edje_object_part_unswallow(Evas_Object *obj __UNUSED__, Evas_Object *obj_swallow) { @@ -3027,13 +2245,6 @@ edje_object_part_unswallow(Evas_Object *obj __UNUSED__, Evas_Object *obj_swallow } } -/** - * @brief Get the object currently swallowed by a part. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @return The swallowed object, or NULL if there is none. - */ EAPI Evas_Object * edje_object_part_swallow_get(const Evas_Object *obj, const char *part) { @@ -3051,16 +2262,6 @@ edje_object_part_swallow_get(const Evas_Object *obj, const char *part) return rp->swallowed_object; } -/** - * @brief Get the minimum size for an object. - * - * @param obj A valid Evas_Object handle - * @param minw Minimum width pointer - * @param minh Minimum height pointer - * - * Gets the object's minimum size values from the Edje. These are set - * to zero if no Edje is connected to the Evas Object. - */ EAPI void edje_object_size_min_get(const Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh) { @@ -3077,16 +2278,6 @@ edje_object_size_min_get(const Evas_Object *obj, Evas_Coord *minw, Evas_Coord *m if (minh) *minh = ed->collection->prop.min.h; } -/** - * @brief Get the maximum size for an object. - * - * @param obj A valid Evas_Object handle - * @param maxw Maximum width pointer - * @param maxh Maximum height pointer - * - * Gets the object's maximum size values from the Edje. These are set - * to zero if no Edje is connected to the Evas Object. - */ EAPI void edje_object_size_max_get(const Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh) { @@ -3123,14 +2314,6 @@ edje_object_size_max_get(const Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *m } } -/** - * @brief Force a Size/Geometry calculation. - * - * @param obj A valid Evas_Object handle - * - * Forces the object @p obj to recalculation layout regardless of - * freeze/thaw. - */ EAPI void edje_object_calc_force(Evas_Object *obj) { @@ -3156,15 +2339,6 @@ edje_object_calc_force(Evas_Object *obj) _edje_freeze_val = pf2; } -/** - * @brief Calculate minimum size. - * - * @param obj A valid Evas_Object handle - * @param minw Minimum width pointer - * @param minh Minimum height pointer - * - * Calculates the object's minimum size ?! - */ EAPI void edje_object_size_min_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh) { @@ -3240,9 +2414,9 @@ edje_object_parts_extends_calc(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, E * @param restrictedw Do not allow object min width calc to be less than this * @param restrictedh Do not allow object min height calc to be less than this * - * Calculates the object's minimum size ?! Be careful the behaviour of this - * fonction is not really defined when a TEXTBLOCK part is present in the - * Edje_Object. This may change in futur implementation. + * Calculates the object's minimum size. Be advised that invisible parts *ARE* + * taken into account in this calculation, if you don't want that to happen, + * resize them to 0. */ EAPI void edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh, Evas_Coord restrictedw, Evas_Coord restrictedh) @@ -3250,9 +2424,10 @@ edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Co Edje *ed; Evas_Coord pw, ph; int maxw, maxh; - int ok; + int okw, okh; int reset_maxwh; Edje_Real_Part *pep = NULL; + Eina_Bool has_non_fixed_tb = EINA_FALSE; ed = _edje_fetch(obj); if ((!ed) || (!ed->collection)) @@ -3273,12 +2448,11 @@ edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Co maxw = 0; maxh = 0; - ok = 1; - while (ok) + do { unsigned int i; - ok = 0; + okw = okh = 0; ed->dirty = 1; #ifdef EDJE_CALC_CACHE ed->all_part_change = 1; @@ -3304,17 +2478,25 @@ edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Co { if (!ep->chosen_description->fixed.w) { + if ((ep->part->type == EDJE_PART_TYPE_TEXTBLOCK)) + { + Evas_Coord tb_mw; + evas_object_textblock_size_formatted_get(ep->object, + &tb_mw, NULL); + tb_mw -= ep->req.w; + if (tb_mw > w) + { + w = tb_mw; + } + has_non_fixed_tb = EINA_TRUE; + } if (w > maxw) { maxw = w; - ok = 1; + okw = 1; pep = ep; didw = 1; } - if ((ep->part->type == EDJE_PART_TYPE_TEXTBLOCK)) - { - /* FIXME: do something */ - } } if (!ep->chosen_description->fixed.h) { @@ -3325,28 +2507,42 @@ edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Co if (h > maxh) { maxh = h; - ok = 1; + okh = 1; pep = ep; } } + + if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK) + { + has_non_fixed_tb = EINA_TRUE; + } } } } - if (ok) + if (okw) { ed->w += maxw; - ed->h += maxh; if (ed->w < restrictedw) ed->w = restrictedw; + } + if (okh) + { + ed->h += maxh; if (ed->h < restrictedh) ed->h = restrictedh; } if ((ed->w > 4000) || (ed->h > 4000)) { - if (pep) - ERR("file %s, group %s has a non-fixed part '%s'. Adding 'fixed: 1 1;' to source EDC may help. Continuing discarding faulty part.", - ed->path, ed->group, pep->part->name); - else - ERR("file %s, group %s overflowed 4000x4000 with minimum size of %dx%d. Continuing discarding faulty parts.", - ed->path, ed->group, ed->w, ed->h); + /* Only print it if we have a non-fixed textblock. + * We should possibly avoid all of this if in this case, but in + * the meanwhile, just doing this. */ + if (!has_non_fixed_tb) + { + if (pep) + ERR("file %s, group %s has a non-fixed part '%s'. Adding 'fixed: 1 1;' to source EDC may help. Continuing discarding faulty part.", + ed->path, ed->group, pep->part->name); + else + ERR("file %s, group %s overflowed 4000x4000 with minimum size of %dx%d. Continuing discarding faulty parts.", + ed->path, ed->group, ed->w, ed->h); + } if (reset_maxwh) { @@ -3355,6 +2551,7 @@ edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Co } } } + while (okw || okh); ed->min.w = ed->w; ed->min.h = ed->h; @@ -3371,17 +2568,6 @@ edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Co ed->calc_only = 0; } -/** - * @brief Returns the state of the Edje part. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param val_ret - * - * @return The part state:\n - * "default" for the default state\n - * "" for other states - */ /* FIXME: Correctly return other states */ EAPI const char * edje_object_part_state_get(const Evas_Object *obj, const char *part, double *val_ret) @@ -3427,17 +2613,6 @@ edje_object_part_state_get(const Evas_Object *obj, const char *part, double *val return ""; } -/** - * @brief Determine dragable directions. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * - * @return 0: Not dragable\n - * 1: Dragable in X direction\n - * 2: Dragable in Y direction\n - * 3: Dragable in X & Y directions - */ EAPI Edje_Drag_Dir edje_object_part_drag_dir_get(const Evas_Object *obj, const char *part) { @@ -3458,16 +2633,6 @@ edje_object_part_drag_dir_get(const Evas_Object *obj, const char *part) return EDJE_DRAG_DIR_NONE; } -/** - * @brief Set the dragable object location. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param dx The x value - * @param dy The y value - * - * Places the dragable object at the given location. - */ EAPI Eina_Bool edje_object_part_drag_value_set(Evas_Object *obj, const char *part, double dx, double dy) { @@ -3498,16 +2663,6 @@ edje_object_part_drag_value_set(Evas_Object *obj, const char *part, double dx, d return EINA_TRUE; } -/** - * @brief Get the dragable object location. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param dx The X value pointer - * @param dy The Y value pointer - * - * Gets the drag location values. - */ /* FIXME: Should this be x and y instead of dx/dy? */ EAPI Eina_Bool edje_object_part_drag_value_get(const Evas_Object *obj, const char *part, double *dx, double *dy) @@ -3543,16 +2698,6 @@ edje_object_part_drag_value_get(const Evas_Object *obj, const char *part, double return EINA_TRUE; } -/** - * @brief Set the dragable object size. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param dw The drag width - * @param dh The drag height - * - * Sets the size of the dragable object. - */ EAPI Eina_Bool edje_object_part_drag_size_set(Evas_Object *obj, const char *part, double dw, double dh) { @@ -3579,16 +2724,6 @@ edje_object_part_drag_size_set(Evas_Object *obj, const char *part, double dw, do return EINA_TRUE; } -/** - * @brief Get the dragable object size. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param dw The drag width pointer - * @param dh The drag height pointer - * - * Gets the dragable object size. - */ EAPI Eina_Bool edje_object_part_drag_size_get(const Evas_Object *obj, const char *part, double *dw, double *dh) { @@ -3618,16 +2753,6 @@ edje_object_part_drag_size_get(const Evas_Object *obj, const char *part, double return EINA_TRUE; } -/** - * @brief Sets the drag step increment. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param dx The x step amount - * @param dy The y step amount - * - * Sets the x,y step increments for a dragable object. - */ EAPI Eina_Bool edje_object_part_drag_step_set(Evas_Object *obj, const char *part, double dx, double dy) { @@ -3651,16 +2776,6 @@ edje_object_part_drag_step_set(Evas_Object *obj, const char *part, double dx, do return EINA_TRUE; } -/** - * @brief Gets the drag step increment values. - * - * @param obj A valid Evas_Object handle - * @param part The part - * @param dx The x step increment pointer - * @param dy The y step increment pointer - * - * Gets the x and y step increments for the dragable object. - */ EAPI Eina_Bool edje_object_part_drag_step_get(const Evas_Object *obj, const char *part, double *dx, double *dy) { @@ -3690,16 +2805,6 @@ edje_object_part_drag_step_get(const Evas_Object *obj, const char *part, double return EINA_TRUE; } -/** - * @brief Sets the page step increments. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param dx The x page step increment - * @param dy The y page step increment - * - * Sets the x,y page step increment values. - */ EAPI Eina_Bool edje_object_part_drag_page_set(Evas_Object *obj, const char *part, double dx, double dy) { @@ -3723,16 +2828,6 @@ edje_object_part_drag_page_set(Evas_Object *obj, const char *part, double dx, do return EINA_TRUE; } -/** - * @brief Gets the page step increments. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param dx The dx page increment pointer - * @param dy The dy page increment pointer - * - * Gets the x,y page step increments for the dragable object. - */ EAPI Eina_Bool edje_object_part_drag_page_get(const Evas_Object *obj, const char *part, double *dx, double *dy) { @@ -3762,17 +2857,6 @@ edje_object_part_drag_page_get(const Evas_Object *obj, const char *part, double return EINA_TRUE; } -/** - * @brief Steps the dragable x,y steps. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param dx The x step - * @param dy The y step - * - * Steps x,y where the step increment is the amount set by - * edje_object_part_drag_step_set. - */ EAPI Eina_Bool edje_object_part_drag_step(Evas_Object *obj, const char *part, double dx, double dy) { @@ -3803,17 +2887,6 @@ edje_object_part_drag_step(Evas_Object *obj, const char *part, double dx, double return EINA_TRUE; } -/** - * @brief Pages x,y steps. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param dx The x step - * @param dy The y step - * - * Pages x,y where the increment is defined by - * edje_object_part_drag_page_set.\n WARNING: Paging is bugged! - */ EAPI Eina_Bool edje_object_part_drag_page(Evas_Object *obj, const char *part, double dx, double dy) { @@ -3859,18 +2932,6 @@ _edje_box_shutdown(void) _edje_box_layout_registry = NULL; } -/** - * @brief Appends an object to the box. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param child The object to append - * - * @return 1: Successfully added.\n - * 0: An error occurred. - * - * Appends child to the box indicated by part. - */ EAPI Eina_Bool edje_object_part_box_append(Evas_Object *obj, const char *part, Evas_Object *child) { @@ -3887,18 +2948,6 @@ edje_object_part_box_append(Evas_Object *obj, const char *part, Evas_Object *chi return _edje_real_part_box_append(rp, child); } -/** - * @brief Prepends an object to the box. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param child The object to prepend - * - * @return 1: Successfully added.\n - * 0: An error occurred. - * - * Prepends child to the box indicated by part. - */ EAPI Eina_Bool edje_object_part_box_prepend(Evas_Object *obj, const char *part, Evas_Object *child) { @@ -3915,20 +2964,6 @@ edje_object_part_box_prepend(Evas_Object *obj, const char *part, Evas_Object *ch return _edje_real_part_box_prepend(rp, child); } -/** - * @brief Adds an object to the box. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param child The object to insert - * @param reference The object to be used as reference - * - * @return 1: Successfully added.\n - * 0: An error occurred. - * - * Inserts child in the box given by part, in the position marked by - * reference. - */ EAPI Eina_Bool edje_object_part_box_insert_before(Evas_Object *obj, const char *part, Evas_Object *child, const Evas_Object *reference) { @@ -3945,20 +2980,6 @@ edje_object_part_box_insert_before(Evas_Object *obj, const char *part, Evas_Obje return _edje_real_part_box_insert_before(rp, child, reference); } -/** - * @brief Inserts an object to the box. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param child The object to insert - * @param pos The position where to insert child - * - * @return 1: Successfully added.\n - * 0: An error occurred. - * - * Adds child to the box indicated by part, in the position given by - * pos. - */ EAPI Eina_Bool edje_object_part_box_insert_at(Evas_Object *obj, const char *part, Evas_Object *child, unsigned int pos) { @@ -3975,17 +2996,6 @@ edje_object_part_box_insert_at(Evas_Object *obj, const char *part, Evas_Object * return _edje_real_part_box_insert_at(rp, child, pos); } -/** - * @brief Removes an object from the box. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param child The object to remove - * - * @return Pointer to the object removed, or NULL. - * - * Removes child from the box indicated by part. - */ EAPI Evas_Object * edje_object_part_box_remove(Evas_Object *obj, const char *part, Evas_Object *child) { @@ -4002,18 +3012,6 @@ edje_object_part_box_remove(Evas_Object *obj, const char *part, Evas_Object *chi return _edje_real_part_box_remove(rp, child); } -/** - * @brief Removes an object from the box. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param pos - * - * @return Pointer to the object removed, or NULL. - * - * Removes from the box indicated by part, the object in the position - * pos. - */ EAPI Evas_Object * edje_object_part_box_remove_at(Evas_Object *obj, const char *part, unsigned int pos) { @@ -4030,19 +3028,6 @@ edje_object_part_box_remove_at(Evas_Object *obj, const char *part, unsigned int return _edje_real_part_box_remove_at(rp, pos); } -/** - * @brief Removes all elements from the box. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param clear Delete objects on removal - * - * @return 1: Successfully cleared.\n - * 0: An error occurred. - * - * Removes all the external objects from the box indicated by part. - * Elements created from the theme will not be removed. - */ EAPI Eina_Bool edje_object_part_box_remove_all(Evas_Object *obj, const char *part, Eina_Bool clear) { @@ -4266,15 +3251,6 @@ _edje_table_child_remove(Edje_Real_Part *rp, Evas_Object *child) _edje_recalc(rp->edje); } -/** - * @brief Retrieve a child from a table - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param col The column of the child to get - * @param row The row of the child to get - * @return The child Evas_Object - */ EAPI Evas_Object * edje_object_part_table_child_get(Evas_Object *obj, const char *part, unsigned int col, unsigned int row) { @@ -4291,22 +3267,6 @@ edje_object_part_table_child_get(Evas_Object *obj, const char *part, unsigned in return evas_object_table_child_get(rp->object, col, row); } -/** - * @brief Packs an object into the table. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param child_obj The object to pack in - * @param col The column to place it in - * @param row The row to place it in - * @param colspan Columns the child will take - * @param rowspan Rows the child will take - * - * @return 1: Successfully added.\n - * 0: An error occurred. - * - * Packs an object into the table indicated by part. - */ EAPI 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) { @@ -4323,18 +3283,6 @@ edje_object_part_table_pack(Evas_Object *obj, const char *part, Evas_Object *chi return _edje_real_part_table_pack(rp, child_obj, col, row, colspan, rowspan); } -/** - * @brief Removes an object from the table. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param child_obj The object to pack in - * - * @return 1: Successfully removed.\n - * 0: An error occurred. - * - * Removes an object from the table indicated by part. - */ EAPI Eina_Bool edje_object_part_table_unpack(Evas_Object *obj, const char *part, Evas_Object *child_obj) { @@ -4351,19 +3299,6 @@ edje_object_part_table_unpack(Evas_Object *obj, const char *part, Evas_Object *c return _edje_real_part_table_unpack(rp, child_obj); } -/** - * @brief Gets the number of columns and rows the table has. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param cols Pointer where to store number of columns (can be NULL) - * @param rows Pointer where to store number of rows (can be NULL) - * - * @return 1: Successfully get some data.\n - * 0: An error occurred. - * - * Retrieves the size of the table in number of columns and rows. - */ EAPI Eina_Bool edje_object_part_table_col_row_size_get(const Evas_Object *obj, const char *part, int *cols, int *rows) { @@ -4381,19 +3316,6 @@ edje_object_part_table_col_row_size_get(const Evas_Object *obj, const char *part return EINA_TRUE; } -/** - * @brief Removes all object from the table. - * - * @param obj A valid Evas_Object handle - * @param part The part name - * @param clear If set, will delete subobjs on remove - * - * @return 1: Successfully clear table.\n - * 0: An error occurred. - * - * Removes all object from the table indicated by part, except the - * internal ones set from the theme. - */ EAPI Eina_Bool edje_object_part_table_clear(Evas_Object *obj, const char *part, Eina_Bool clear) { @@ -4906,13 +3828,11 @@ _edje_color_class_member_add(Edje *ed, const char *color_class) Eina_List *members; if ((!ed) || (!color_class)) return; + if (!_edje_color_class_member_hash) _edje_color_class_member_hash = eina_hash_string_superfast_new(NULL); members = eina_hash_find(_edje_color_class_member_hash, color_class); - if (members) - eina_hash_del(_edje_color_class_member_hash, color_class, members); members = eina_list_prepend(members, ed); - if (!_edje_color_class_member_hash) _edje_color_class_member_hash = eina_hash_string_superfast_new(NULL); - eina_hash_add(_edje_color_class_member_hash, color_class, members); + eina_hash_set(_edje_color_class_member_hash, color_class, members); } void @@ -4921,13 +3841,13 @@ _edje_color_class_member_del(Edje *ed, const char *color_class) Eina_List *members; if ((!ed) || (!color_class)) return; + if (!_edje_color_class_member_hash) return; + members = eina_hash_find(_edje_color_class_member_hash, color_class); if (!members) return; - eina_hash_del(_edje_color_class_member_hash, color_class, members); members = eina_list_remove(members, ed); - if (members) - eina_hash_add(_edje_color_class_member_hash, color_class, members); + eina_hash_set(_edje_color_class_member_hash, color_class, members); } /** @@ -5005,33 +3925,38 @@ _edje_text_class_member_add(Edje *ed, const char *text_class) /* Get members list */ members = eina_hash_find(_edje_text_class_member_hash, text_class); - /* Remove members list */ - if (members) - eina_hash_del(_edje_text_class_member_hash, text_class, members); - /* Update the member list */ members = eina_list_prepend(members, ed); - /* Add the member list back */ + /* Don't loose track of members list */ + if (!ed->members) + ed->members = eina_hash_string_small_new(NULL); + eina_hash_set(ed->members, text_class, members); + + /* Reset the member list to the right pointer */ if (!_edje_text_class_member_hash) _edje_text_class_member_hash = eina_hash_string_superfast_new(NULL); - eina_hash_add(_edje_text_class_member_hash, text_class, members); + eina_hash_set(_edje_text_class_member_hash, text_class, members); } void _edje_text_class_member_del(Edje *ed, const char *text_class) { Eina_List *members; + Eina_List *lookup; if ((!ed) || (!text_class)) return; members = eina_hash_find(_edje_text_class_member_hash, text_class); if (!members) return; - eina_hash_del(_edje_text_class_member_hash, text_class, members); + lookup = eina_hash_find(ed->members, text_class); - members = eina_list_remove(members, ed); - if (members) - eina_hash_add(_edje_text_class_member_hash, text_class, members); + if (!lookup) return ; + + eina_hash_del(ed->members, text_class, lookup); + members = eina_list_remove_list(members, lookup); + + eina_hash_set(_edje_text_class_member_hash, text_class, members); } void @@ -5149,9 +4074,9 @@ _edje_object_part_swallow_free_cb(void *data, Evas *e __UNUSED__, Evas_Object *o static void _edje_real_part_swallow_hints_update(Edje_Real_Part *rp) { - char *type; + const char *type; - type = (char *)evas_object_type_get(rp->swallowed_object); + type = evas_object_type_get(rp->swallowed_object); rp->swallow_params.min.w = 0; rp->swallow_params.min.h = 0; @@ -5233,7 +4158,9 @@ _edje_object_part_swallow_changed_hints_cb(void *data, __UNUSED__ Evas *e, __UNU } void -_edje_real_part_swallow(Edje_Real_Part *rp, Evas_Object *obj_swallow) +_edje_real_part_swallow(Edje_Real_Part *rp, + Evas_Object *obj_swallow, + Eina_Bool hints_update) { if (rp->swallowed_object) { @@ -5244,7 +4171,8 @@ _edje_real_part_swallow(Edje_Real_Part *rp, Evas_Object *obj_swallow) } else { - _edje_real_part_swallow_hints_update(rp); + if (hints_update) + _edje_real_part_swallow_hints_update(rp); rp->edje->dirty = 1; _edje_recalc(rp->edje); return; @@ -5269,7 +4197,8 @@ _edje_real_part_swallow(Edje_Real_Part *rp, Evas_Object *obj_swallow) _edje_object_part_swallow_changed_hints_cb, rp); - _edje_real_part_swallow_hints_update(rp); + if (hints_update) + _edje_real_part_swallow_hints_update(rp); if (rp->part->mouse_events) { @@ -5336,6 +4265,11 @@ _edje_object_signal_preload_cb(void *data, Evas_Object *obj, __UNUSED__ const ch _edje_object_preload(ed); } +/** + * @internal + * + * for edje_cc + */ EAPI void _edje_program_remove(Edje_Part_Collection *edc, Edje_Program *p) { @@ -5381,6 +4315,11 @@ _edje_program_remove(Edje_Part_Collection *edc, Edje_Program *p) } } +/** + * @internal + * + * for edje_cc + */ EAPI void _edje_program_insert(Edje_Part_Collection *edc, Edje_Program *p) { -- 2.7.4