From a8a954e525ecf9a280933e6fdbcec85e24d7922e Mon Sep 17 00:00:00 2001 From: Davide Andreoli Date: Sat, 12 Jul 2008 12:48:35 +0000 Subject: [PATCH] * Added spectra API * Added gradient API * Added fill API * Some small doxy fix SVN revision: 35075 --- legacy/edje/src/lib/Edje_Edit.h | 434 +++++++++++++++++++++- legacy/edje/src/lib/edje_edit.c | 620 +++++++++++++++++++++++++++++++- 2 files changed, 1039 insertions(+), 15 deletions(-) diff --git a/legacy/edje/src/lib/Edje_Edit.h b/legacy/edje/src/lib/Edje_Edit.h index f1634bdc6b..1a024b57b9 100644 --- a/legacy/edje/src/lib/Edje_Edit.h +++ b/legacy/edje/src/lib/Edje_Edit.h @@ -409,7 +409,7 @@ edje_edit_part_ignore_flags_set( /************************** STATES API ************************************/ /******************************************************************************/ /** @name States API - * Description of gen api 2. + * Functions to deal with part states (see @ref edcref). */ //@{ /**Get the list of all the states in the given part.*/ @@ -851,13 +851,148 @@ edje_edit_state_aspect_pref_set( unsigned char pref ///< The new aspect preference to set (0=none, 1=vertical, 2=horizontal, 3=both) ); +/**Get the fill origin relative x value of a part state.*/ +EAPI double ///@return The fill offset x relative to area +edje_edit_state_fill_origin_relative_x_get( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state ///< The name of the 'part state' (ex. "default 0.00") +); + +/**Get the fill origin relative y value of a part state.*/ +EAPI double ///@return The fill origin y relative to area +edje_edit_state_fill_origin_relative_y_get( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state ///< The name of the 'part state' (ex. "default 0.00") +); + +/**Get the fill origin offset x value of a part state.*/ +EAPI int ///@return The fill origin offset x relative to area +edje_edit_state_fill_origin_offset_x_get( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state ///< The name of the 'part state' (ex. "default 0.00") +); + +/**Get the fill origin offset y value of a part state.*/ +EAPI int ///@return The fill origin offset y relative to area +edje_edit_state_fill_origin_offset_y_get( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state ///< The name of the 'part state' (ex. "default 0.00") +); + +/**Set the fill origin relative x value of a part state.*/ +EAPI void +edje_edit_state_fill_origin_relative_x_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state, ///< The name of the 'part state' (ex. "default 0.00") + double x ///< The new value to set +); + +/**Set the fill origin relative y value of a part state.*/ +EAPI void +edje_edit_state_fill_origin_relative_y_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state, ///< The name of the 'part state' (ex. "default 0.00") + double x ///< The new value to set +); + +/**Set the fill origin offset x value of a part state.*/ +EAPI void +edje_edit_state_fill_origin_offset_x_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state, ///< The name of the 'part state' (ex. "default 0.00") + double x ///< The new value to set +); + +/**Set the fill origin offset x value of a part state.*/ +EAPI void +edje_edit_state_fill_origin_offset_y_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state, ///< The name of the 'part state' (ex. "default 0.00") + double y ///< The new value to set +); + +/**Get the fill size relative x value of a part state.*/ +EAPI double ///@return The fill size offset x relative to area +edje_edit_state_fill_size_relative_x_get( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state ///< The name of the 'part state' (ex. "default 0.00") +); + +/**Get the fill size relative y value of a part state.*/ +EAPI double ///@return The fill size y relative to area +edje_edit_state_fill_size_relative_y_get( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state ///< The name of the 'part state' (ex. "default 0.00") +); + +/**Get the fill size offset x value of a part state.*/ +EAPI int ///@return The fill size offset x relative to area +edje_edit_state_fill_size_offset_x_get( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state ///< The name of the 'part state' (ex. "default 0.00") +); + +/**Get the fill size offset y value of a part state.*/ +EAPI int ///@return The fill size offset y relative to area +edje_edit_state_fill_size_offset_y_get( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state ///< The name of the 'part state' (ex. "default 0.00") +); + +/**Set the fill size relative x value of a part state.*/ +EAPI void +edje_edit_state_fill_size_relative_x_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state, ///< The name of the 'part state' (ex. "default 0.00") + double x ///< The new value to set +); + +/**Set the fill size relative y value of a part state.*/ +EAPI void +edje_edit_state_fill_size_relative_y_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state, ///< The name of the 'part state' (ex. "default 0.00") + double x ///< The new value to set +); + +/**Set the fill size offset x value of a part state.*/ +EAPI void +edje_edit_state_fill_size_offset_x_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state, ///< The name of the 'part state' (ex. "default 0.00") + double x ///< The new value to set +); + +/**Set the fill size offset x value of a part state.*/ +EAPI void +edje_edit_state_fill_size_offset_y_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state, ///< The name of the 'part state' (ex. "default 0.00") + double y ///< The new value to set +); //@} /******************************************************************************/ /************************** TEXT API ************************************/ /******************************************************************************/ /** @name Text API - * Description of gen api 2. + * Functions to deal with text objects (see @ref edcref). */ //@{ /**Get the text of a part state. Remember to free the returned string with edje_edit_string_free(). */ @@ -929,11 +1064,9 @@ edje_edit_state_text_align_y_set( ); /**Get the list of all the fonts in the given edje. - * @return An Evas_List* of string (char *)containing all the fonts names found - * in the edje file. - * Use edje_edit_string_list_free() when you don't need it anymore. + * Use edje_edit_string_list_free() when you don't need the list anymore. */ -EAPI Evas_List * ///@return A string list of all the fonts found in the edje file +EAPI Evas_List * ///@return An Evas_List* of string (char *)containing all the fonts names found in the edje file. edje_edit_fonts_list_get( Evas_Object *obj ///< The edje object ); @@ -970,15 +1103,13 @@ edje_edit_state_font_set( /************************** IMAGES API ************************************/ /******************************************************************************/ /** @name Images API - * Description of gen api 2. + * Functions to deal with image objects (see @ref edcref). */ //@{ /**Get the list of all the images in the given edje. - * @return An Evas_List* of string (char *)containing all the images names found - * in the edje file. - * Use edje_edit_string_list_free() when you don't need it anymore. + * Use edje_edit_string_list_free() when you don't need the list anymore. */ -EAPI Evas_List * ///@return A string list containing all the images found in the edje file +EAPI Evas_List * ///@return An Evas_List* of string (char *)containing all the images names found in the edje file. edje_edit_images_list_get( Evas_Object *obj ///< The edje object ); @@ -1081,12 +1212,289 @@ edje_edit_state_tween_del( const char *tween ///< The name of the image to remove from the tween list. ); +//@} +/******************************************************************************/ +/************************* SPECTRUM API ***********************************/ +/******************************************************************************/ +/** @name Spectrum API + * Functions to manage spectrum (see @ref edcref). + */ //@{ + +/**Get the list of all the spectrum in the given edje object. + * Use edje_edit_string_list_free() when you don't need it anymore. + */ +EAPI Evas_List * ///@return An Evas_List* of string(char *) containing all the spectra names. +edje_edit_spectrum_list_get( + Evas_Object *obj ///< The edje object +); + +/**Add a new spectra in the given edje object.*/ +EAPI unsigned char ///@return 1 on success, 0 otherwise +edje_edit_spectra_add( + Evas_Object *obj, ///< The edje object + const char* name ///< The name of the new spectra +); + +/**Delete the given spectra from the edje object.*/ +EAPI unsigned char ///@return 1 on success, 0 otherwise +edje_edit_spectra_del( + Evas_Object *obj, ///< The edje object + const char* spectra ///< The name of the spectra to delete +); + +/**Change the name of the given spectra.*/ +EAPI unsigned char ///@return 1 on success, 0 otherwise +edje_edit_spectra_name_set( + Evas_Object *obj, ///< The edje object + const char* spectra, ///< The current name of the spectra + const char* name ///< The new name to assign +); + +/**Get the number of stops in the given spectra.*/ +EAPI int ///@return The number of stops +edje_edit_spectra_stop_num_get( + Evas_Object *obj, ///< The edje object + const char* spectra ///< The name of the spectra +); + +/**Set the number of stops in the given spectra.*/ +EAPI unsigned char ///@return 1 on success, 0 otherwise +edje_edit_spectra_stop_num_set( + Evas_Object *obj, ///< The edje object + const char* spectra, ///< The name of the spectra + int num ///< The number of stops you want +); + +/**Get the colors of the given stop.*/ +EAPI unsigned char ///@return 1 on success, 0 otherwise +edje_edit_spectra_stop_color_get( + Evas_Object *obj, ///< The edje object + const char* spectra, ///< The name of the spectra + int stop_number, ///< The number of the stop + int *r, ///< Where to store the red color value + int *g, ///< Where to store the green color value + int *b, ///< Where to store the blue color value + int *a, ///< Where to store the alpha color value + int *d ///< Where to store the delta stop value +); + +/**Set the colors of the given stop.*/ +EAPI unsigned char ///@return 1 on success, 0 otherwise +edje_edit_spectra_stop_color_set( + Evas_Object *obj, ///< The edje object + const char* spectra, ///< The name of the spectra + int stop_number, ///< The number of the stop + int r, ///< The red color value to set + int g, ///< The green color value to set + int b, ///< The blue color value to set + int a, ///< The alpha color value to set + int d ///< The delta stop value to set +); + + +//@} +/******************************************************************************/ +/************************* GRADIENT API ***********************************/ +/******************************************************************************/ +/** @name Gradient API + * Functions to deal with gradient objects (see @ref edcref). + */ //@{ + +/**Get the type of gradient. Remember to free the string with edje_edit_string_free().*/ +EAPI const char * ///@return The type of gradient used in state +edje_edit_state_gradient_type_get( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state ///< The name of the 'part state' (ex. "default 0.00") +); + +/**Set the type of gradient. + * Gradient type can be on of the following: linear, linear.diag, linear.codiag, radial, rectangular, angular, sinusoidal + */ +EAPI unsigned char ///@return 1 on success, 0 otherwise +edje_edit_state_gradient_type_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state, ///< The name of the 'part state' (ex. "default 0.00") + const char *type ///< The type of gradient to use +); + +/**Get if the current gradient use the fill properties or the gradient_rel as params.*/ +EAPI unsigned char ///@return 1 if use fill, 0 if use gradient_rel +edje_edit_state_gradient_use_fill_get( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state ///< The name of the 'part state' (ex. "default 0.00") +); + +/**Get the spectra id used by part state.*/ +EAPI int ///@return The spectra id +edje_edit_state_gradient_spectra_id_get( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state ///< The name of the 'part state' (ex. "default 0.00") +); + +//~ /**Set the spectra id used by part state.*/ +//~ EAPI unsigned char ///@return 1 on success, 0 otherwise +//~ edje_edit_state_gradient_spectra_id_set( + //~ Evas_Object *obj, ///< The edje object + //~ const char *part, ///< The name of the part + //~ const char *state, ///< The name of the 'part state' (ex. "default 0.00") + //~ int spectra_i +//~ ); + +/**Set the spectra used by part state.*/ +EAPI unsigned char ///@return 1 on success, 0 otherwise +edje_edit_state_gradient_spectra_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state, ///< The name of the 'part state' (ex. "default 0.00") + const char* spectra ///< The spectra name to assign +); + +/**Get the gradien rel1 relative x value */ +EAPI double ///@return The gradien rel1 relative x value +edje_edit_state_gradient_rel1_relative_x_get( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state ///< The name of the 'part state' (ex. "default 0.00") +); + +/**Get the gradien rel1 relative y value */ +EAPI double ///@return The gradien rel1 relative y value +edje_edit_state_gradient_rel1_relative_y_get( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state ///< The name of the 'part state' (ex. "default 0.00") +); + +/**Get the gradien rel2 relative x value */ +EAPI double ///@return The gradien rel2 relative x value +edje_edit_state_gradient_rel2_relative_x_get( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state ///< The name of the 'part state' (ex. "default 0.00") +); + +/**Get the gradien rel2 relative y value */ +EAPI double ///@return The gradien rel2 relative y value +edje_edit_state_gradient_rel2_relative_y_get( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state ///< The name of the 'part state' (ex. "default 0.00") +); + +/**Set the gradien rel1 relative x value */ +EAPI unsigned char ///@return 1 on success, 0 otherwise +edje_edit_state_gradient_rel1_relative_x_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state, ///< The name of the 'part state' (ex. "default 0.00") + double val +); + +/**Set the gradien rel1 relative y value */ +EAPI unsigned char ///@return 1 on success, 0 otherwise +edje_edit_state_gradient_rel1_relative_y_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state, ///< The name of the 'part state' (ex. "default 0.00") + double val +); + +/**Set the gradien rel2 relative x value */ +EAPI unsigned char ///@return 1 on success, 0 otherwise +edje_edit_state_gradient_rel2_relative_x_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state, ///< The name of the 'part state' (ex. "default 0.00") + double val +); + +/**Set the gradien rel2 relative y value */ +EAPI unsigned char ///@return 1 on success, 0 otherwise +edje_edit_state_gradient_rel2_relative_y_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state, ///< The name of the 'part state' (ex. "default 0.00") + double val +); + +/**Get the gradien rel1 offset x value */ +EAPI int ///@return The gradient rel1 offset x value +edje_edit_state_gradient_rel1_offset_x_get( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state ///< The name of the 'part state' (ex. "default 0.00") +); + +/**Get the gradien rel1 offset y value */ +EAPI int ///@return The gradient rel1 offset y value +edje_edit_state_gradient_rel1_offset_y_get( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state ///< The name of the 'part state' (ex. "default 0.00") +); + +/**Get the gradien rel2 offset x value */ +EAPI int ///@return The gradient rel2 offset x value +edje_edit_state_gradient_rel2_offset_x_get( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state ///< The name of the 'part state' (ex. "default 0.00") +); + +/**Get the gradien rel2 offset y value */ +EAPI int ///@return The gradient rel2 offset y value +edje_edit_state_gradient_rel2_offset_y_get( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state ///< The name of the 'part state' (ex. "default 0.00") +); + +/**Set the gradien rel1 offset x value */ +EAPI unsigned char ///@return 1 on success, 0 otherwise +edje_edit_state_gradient_rel1_offset_x_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state, ///< The name of the 'part state' (ex. "default 0.00") + int val +); + +/**Set the gradien rel1 offset y value */ +EAPI unsigned char ///@return 1 on success, 0 otherwise +edje_edit_state_gradient_rel1_offset_y_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state, ///< The name of the 'part state' (ex. "default 0.00") + int val +); + +/**Set the gradien rel2 offset x value */ +EAPI unsigned char ///@return 1 on success, 0 otherwise +edje_edit_state_gradient_rel2_offset_x_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state, ///< The name of the 'part state' (ex. "default 0.00") + int val +); + +/**Set the gradien rel2 offset y value */ +EAPI unsigned char ///@return 1 on success, 0 otherwise +edje_edit_state_gradient_rel2_offset_y_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state, ///< The name of the 'part state' (ex. "default 0.00") + int val +); + //@} /******************************************************************************/ /************************* PROGRAMS API ***********************************/ /******************************************************************************/ /** @name Programs API - * Description of gen api 2. + * Functions to deal with programs (see @ref edcref). */ //@{ /**Get the list of all the programs in the given edje object. @@ -1394,7 +1802,7 @@ edje_edit_program_transition_time_set( /************************** SCRIPTS API ***********************************/ /******************************************************************************/ /** @name Scripts API - * Description of gen api 2. + * Functions to deal with embryo scripts (see @ref edcref). */ //@{ EAPI const char* edje_edit_script_get(Evas_Object *obj); diff --git a/legacy/edje/src/lib/edje_edit.c b/legacy/edje/src/lib/edje_edit.c index b2f97b3a34..e3a1bb749a 100644 --- a/legacy/edje/src/lib/edje_edit.c +++ b/legacy/edje/src/lib/edje_edit.c @@ -550,6 +550,24 @@ _edje_if_string_free(Edje *ed, const char *str) evas_stringshare_del(str); str = NULL; } +Edje_Spectrum_Directory_Entry * +_edje_edit_spectrum_entry_get(Edje *ed, const char* spectra) +{ + Edje_Spectrum_Directory_Entry *s; + Evas_List *l; + + if (!ed->file || !spectra || !ed->file->spectrum_dir) + return NULL; + + for (l = ed->file->spectrum_dir->entries; l; l = l->next) + { + s = l->data; + if (!strcmp(s->entry, spectra)) + return s; + } + + return NULL; +} /*****************/ /* GENERAL API */ /*****************/ @@ -2133,6 +2151,146 @@ edje_edit_state_aspect_pref_set(Evas_Object *obj, const char *part, const char * printf("SET ASPECT_PREF of state '%s' [to: %d]\n", state, pref); pd->aspect.prefer = pref; } + +//fill +EAPI double +edje_edit_state_fill_origin_relative_x_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(0); + //printf("Get state fill origin of part: %s state: %s\n", part, state); + return pd->fill.pos_rel_x; +} + +EAPI double +edje_edit_state_fill_origin_relative_y_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(0); + //printf("Get state fill origin of part: %s state: %s\n", part, state); + return pd->fill.pos_rel_y; +} + +EAPI int +edje_edit_state_fill_origin_offset_x_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(0); + //printf("Get state fill origin offset of part: %s state: %s\n", part, state); + return pd->fill.pos_abs_x; +} + +EAPI int +edje_edit_state_fill_origin_offset_y_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(0); + //printf("Get state fill origin offset of part: %s state: %s\n", part, state); + return pd->fill.pos_abs_y; +} + + +EAPI void +edje_edit_state_fill_origin_relative_x_set(Evas_Object *obj, const char *part, const char *state, double x) +{ + GET_PD_OR_RETURN(); + printf("Set state fill origin of part: %s state: %s to: %f\n", part, state, x); + pd->fill.pos_rel_x = x; + edje_object_calc_force(obj); +} + +EAPI void +edje_edit_state_fill_origin_relative_y_set(Evas_Object *obj, const char *part, const char *state, double y) +{ + GET_PD_OR_RETURN(); + printf("Set state fill origin of part: %s state: %s to: %f\n", part, state, y); + pd->fill.pos_rel_y = y; + edje_object_calc_force(obj); +} + +EAPI void +edje_edit_state_fill_origin_offset_x_set(Evas_Object *obj, const char *part, const char *state, double x) +{ + GET_PD_OR_RETURN(); + printf("Set state fill origin offset x of part: %s state: %s to: %f\n", part, state, x); + pd->fill.pos_abs_x = x; + edje_object_calc_force(obj); +} + +EAPI void +edje_edit_state_fill_origin_offset_y_set(Evas_Object *obj, const char *part, const char *state, double y) +{ + GET_PD_OR_RETURN(); + printf("Set state fill origin offset y of part: %s state: %s to: %f\n", part, state, y); + pd->fill.pos_abs_y = y; + edje_object_calc_force(obj); +} + +EAPI double +edje_edit_state_fill_size_relative_x_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(0.0); + //printf("Get state fill size of part: %s state: %s\n", part, state); + return pd->fill.rel_x; +} + +EAPI double +edje_edit_state_fill_size_relative_y_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(0.0); + //printf("Get state fill size of part: %s state: %s\n", part, state); + return pd->fill.rel_y; +} + +EAPI int +edje_edit_state_fill_size_offset_x_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(0); + //printf("Get state fill size offset of part: %s state: %s\n", part, state); + return pd->fill.abs_x; +} + +EAPI int +edje_edit_state_fill_size_offset_y_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(0); + //printf("Get state fill size offset of part: %s state: %s\n", part, state); + return pd->fill.abs_y; +} + +EAPI void +edje_edit_state_fill_size_relative_x_set(Evas_Object *obj, const char *part, const char *state, double x) +{ + GET_PD_OR_RETURN(); + printf("Set state fill size of part: %s state: %s to: %f\n", part, state, x); + pd->fill.rel_x = x; + edje_object_calc_force(obj); +} + +EAPI void +edje_edit_state_fill_size_relative_y_set(Evas_Object *obj, const char *part, const char *state, double y) +{ + GET_PD_OR_RETURN(); + printf("Set state fill size of part: %s state: %s to: %f\n", part, state, y); + pd->fill.rel_y = y; + edje_object_calc_force(obj); +} + +EAPI void +edje_edit_state_fill_size_offset_x_set(Evas_Object *obj, const char *part, const char *state, double x) +{ + GET_PD_OR_RETURN(); + printf("Set state fill size offset x of part: %s state: %s to: %f\n", part, state, x); + pd->fill.abs_x = x; + edje_object_calc_force(obj); +} + +EAPI void +edje_edit_state_fill_size_offset_y_set(Evas_Object *obj, const char *part, const char *state, double y) +{ + GET_PD_OR_RETURN(); + printf("Set state fill size offset y of part: %s state: %s to: %f\n", part, state, y); + pd->fill.abs_y = y; + edje_object_calc_force(obj); +} + + /**************/ /* TEXT API */ /**************/ @@ -2437,8 +2595,8 @@ edje_edit_images_list_get(Evas_Object *obj) { i = l->data; images = evas_list_append(images, evas_stringshare_add(i->entry)); - printf(" Image: %s (type: %d param: %d id: %d) \n", - i->entry, i->source_type, i->source_param, i->id); + //printf(" Image: %s (type: %d param: %d id: %d) \n", + // i->entry, i->source_type, i->source_param, i->id); } return images; @@ -2632,6 +2790,464 @@ edje_edit_state_image_border_set(Evas_Object *obj, const char *part, const char edje_object_calc_force(obj); } +/******************/ +/* SPECTRUM API */ +/******************/ + +EAPI Evas_List * +edje_edit_spectrum_list_get(Evas_Object *obj) +{ + Edje_Spectrum_Directory_Entry *s; + Evas_List *spectrums = NULL; + Evas_List *l; + + GET_ED_OR_RETURN(NULL); + + if (!ed->file) return NULL; + if (!ed->file->spectrum_dir) return NULL; + + printf("GET SPECTRUM LIST for %s\n", ed->file->path); + + for (l = ed->file->spectrum_dir->entries; l; l = l->next) + { + s = l->data; + printf("SPECTRUM: %s\n", s->entry); + spectrums = evas_list_append(spectrums, evas_stringshare_add(s->entry)); + } + + return spectrums; + return NULL; +} + + +EAPI unsigned char +edje_edit_spectra_add(Evas_Object *obj, const char* name) +{ + int id; + GET_ED_OR_RETURN(0); + + printf("SPECTRA ADD [new name:%s]\n", name); + + Edje_Spectrum_Directory_Entry *s; + Evas_List *l; + + if (!ed->file) return 0; + + if (_edje_edit_spectrum_entry_get(ed, name)) return 0; + + if (!ed->file->spectrum_dir) + ed->file->spectrum_dir = mem_alloc(SZ(Edje_Spectrum_Directory)); + + s = mem_alloc(SZ(Edje_Spectrum_Directory_Entry)); + ed->file->spectrum_dir->entries = evas_list_append(ed->file->spectrum_dir->entries, s); + s->id = evas_list_count(ed->file->spectrum_dir->entries) - 1; + s->entry = (char*)evas_stringshare_add(name); + s->filename = NULL; + s->color_list = NULL; + + return 1; +} + +EAPI unsigned char +edje_edit_spectra_del(Evas_Object *obj, const char* spectra) +{ + Edje_Spectrum_Directory_Entry *s; + + GET_ED_OR_RETURN(0); + + s = _edje_edit_spectrum_entry_get(ed, spectra); + if (!s) return 0; + + printf("SPECTRA DEL %s\n", spectra); + + ed->file->spectrum_dir->entries = evas_list_remove(ed->file->spectrum_dir->entries, s); + _edje_if_string_free(ed, s->entry); + _edje_if_string_free(ed, s->filename); + while (s->color_list) + { + Edje_Spectrum_Color *color; + color = s->color_list->data; + free(color); + s->color_list = evas_list_remove_list(s->color_list, s->color_list); + } + free(s); + + return 1; +} + +EAPI unsigned char +edje_edit_spectra_name_set(Evas_Object *obj, const char* spectra, const char* name) +{ + Edje_Spectrum_Directory_Entry *s; + + GET_ED_OR_RETURN(0); + + printf("SET SPECTRA NAME for spectra: %s [new name:%s]\n", spectra, name); + + s = _edje_edit_spectrum_entry_get(ed, spectra); + if (!s) return 0; + + _edje_if_string_free(ed, s->entry); + s->entry = (char*)evas_stringshare_add(name); + + return 1; +} + +EAPI int +edje_edit_spectra_stop_num_get(Evas_Object *obj, const char* spectra) +{ + Edje_Spectrum_Directory_Entry *s; + + GET_ED_OR_RETURN(-1); + + printf("GET SPECTRA STOP NUM for spectra: %s\n", spectra); + + s = _edje_edit_spectrum_entry_get(ed, spectra); + if (!s) return -1; + + return evas_list_count(s->color_list); +} + +EAPI unsigned char +edje_edit_spectra_stop_num_set(Evas_Object *obj, const char* spectra, int num) +{ + Edje_Spectrum_Directory_Entry *s; + Edje_Spectrum_Color *color; + GET_ED_OR_RETURN(0); + + printf("SET SPECTRA STOP NUM for spectra: %s\n", spectra); + + s = _edje_edit_spectrum_entry_get(ed, spectra); + if (!s) return 0; + + if (num == evas_list_count(s->color_list)) return 1; + + //destroy all colors + while (s->color_list) + { + color = s->color_list->data; + free(color); + s->color_list = evas_list_remove_list(s->color_list, s->color_list); + } + + //... and recreate + while (num) + { + color = mem_alloc(SZ(Edje_Spectrum_Color)); + s->color_list = evas_list_append(s->color_list, color); + color->r = 255; + color->g = 255; + color->b = 255; + color->a = 255; + color->d = 10; + num--; + } + + return 1; +} + +EAPI unsigned char +edje_edit_spectra_stop_color_get(Evas_Object *obj, const char* spectra, int stop_number, int *r, int *g, int *b, int *a, int *d) +{ + Edje_Spectrum_Directory_Entry *s; + Edje_Spectrum_Color *color; + GET_ED_OR_RETURN(0); + + s = _edje_edit_spectrum_entry_get(ed, spectra); + if (!s) return 0; + printf("GET SPECTRA STOP COLOR for spectra: %s stopn: %d\n", spectra, stop_number); + + color = evas_list_nth(s->color_list, stop_number); + if (!color) return 0; + if (r) *r = color->r; + if (g) *g = color->g; + if (b) *b = color->b; + if (a) *a = color->a; + if (d) *d = color->d; + + return 1; +} + +EAPI unsigned char +edje_edit_spectra_stop_color_set(Evas_Object *obj, const char* spectra, int stop_number, int r, int g, int b, int a, int d) +{ + Edje_Spectrum_Directory_Entry *s; + Edje_Spectrum_Color *color; + GET_ED_OR_RETURN(0); + + s = _edje_edit_spectrum_entry_get(ed, spectra); + if (!s) return 0; + printf("SET SPECTRA STOP COLOR for spectra: %s stopn: %d\n", spectra, stop_number); + + color = evas_list_nth(s->color_list, stop_number); + if (!color) return 0; + color->r = r; + color->g = g; + color->b = b; + color->a = a; + color->d = d; + + edje_object_calc_force(obj); + + return 1; +} + + + +/******************/ +/* GRADIENT API */ +/******************/ + +EAPI const char * +edje_edit_state_gradient_type_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(NULL); + + if (!pd->gradient.type) + return NULL; + +// printf("GET GRADIENT TYPE for part: %s state: %s [%s]\n", part, state, pd->gradient.type); + + return evas_stringshare_add(pd->gradient.type); +} + +EAPI unsigned char +edje_edit_state_gradient_type_set(Evas_Object *obj, const char *part, const char *state, const char *type) +{ + GET_PD_OR_RETURN(0); + + if (!type) return 0; + +// printf("SET GRADIENT TYPE for part: %s state: %s TO: %s\n", part, state, type); + + _edje_if_string_free(ed, pd->gradient.type); + pd->gradient.type = (char *)evas_stringshare_add(type); + + edje_object_calc_force(obj); + + return 1; +} + + +EAPI unsigned char +edje_edit_state_gradient_use_fill_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(-1); + + if (!pd->gradient.type) + return -1; + + if (!strcmp(pd->gradient.type, "linear")) + return 0; + return 1; +} + +EAPI int +edje_edit_state_gradient_spectra_id_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(-1); + + //if (!pd->gradient.type) + // return NULL; + + printf("GET GRADIENT SPECTRA ID for part: %s state: %s [%d]\n", part, state, pd->gradient.id); + + return pd->gradient.id; +} + +//~ EAPI unsigned char +//~ edje_edit_state_gradient_spectra_id_set(Evas_Object *obj, const char *part, const char *state, int spectra_id) +//~ { + //~ GET_PD_OR_RETURN(0); + + //~ printf("SET GRADIENT SPECTRA_ID for part: %s state: %s [%d]\n", part, state, spectra_id); + + //~ pd->gradient.id = spectra_id; + + //~ edje_object_calc_force(obj); + + //~ return 1; +//~ } + +EAPI unsigned char +edje_edit_state_gradient_spectra_set(Evas_Object *obj, const char *part, const char *state, const char* spectra) +{ + Edje_Spectrum_Directory_Entry *s; + + GET_PD_OR_RETURN(0); + + printf("SET GRADIENT SPECTRA for part: %s state: %s [%s]\n", part, state, spectra); + + s = _edje_edit_spectrum_entry_get(ed, spectra); + if (!s) return 0; + + pd->gradient.id = s->id; + + edje_object_calc_force(obj); + + return 1; +} + +EAPI double +edje_edit_state_gradient_rel1_relative_x_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(0); + //printf("GET GRADIENT REL1 RELX for part: %s state: %s [%f]\n", part, state, pd->gradient.rel1.relative_x); + + return pd->gradient.rel1.relative_x; +} + +EAPI double +edje_edit_state_gradient_rel1_relative_y_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(0); + //printf("GET GRADIENT REL1 RELY for part: %s state: %s [%f]\n", part, state, pd->gradient.rel1.relative_y); + + return pd->gradient.rel1.relative_y; +} + +EAPI double +edje_edit_state_gradient_rel2_relative_x_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(0); + //printf("GET GRADIENT REL2 RELX for part: %s state: %s [%f]\n", part, state, pd->gradient.rel2.relative_x); + + return pd->gradient.rel2.relative_x; +} + +EAPI double +edje_edit_state_gradient_rel2_relative_y_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(0); + //printf("GET GRADIENT REL2 RELY for part: %s state: %s [%f]\n", part, state, pd->gradient.rel2.relative_y); + + return pd->gradient.rel2.relative_y; +} + +EAPI unsigned char +edje_edit_state_gradient_rel1_relative_x_set(Evas_Object *obj, const char *part, const char *state, double val) +{ + GET_PD_OR_RETURN(0); + printf("SET GRADIENT REL1 RELX for part: %s state: %s [TO %f]\n", part, state, val); + + pd->gradient.rel1.relative_x = val; + edje_object_calc_force(obj); + return 1; +} + +EAPI unsigned char +edje_edit_state_gradient_rel1_relative_y_set(Evas_Object *obj, const char *part, const char *state, double val) +{ + GET_PD_OR_RETURN(0); + printf("SET GRADIENT REL1 RELY for part: %s state: %s [TO %f]\n", part, state, val); + + pd->gradient.rel1.relative_y = val; + edje_object_calc_force(obj); + return 1; +} + +EAPI unsigned char +edje_edit_state_gradient_rel2_relative_x_set(Evas_Object *obj, const char *part, const char *state, double val) +{ + GET_PD_OR_RETURN(0); + printf("SET GRADIENT REL2 RELX for part: %s state: %s [TO %f]\n", part, state, val); + + pd->gradient.rel2.relative_x = val; + edje_object_calc_force(obj); + return 1; +} + +EAPI unsigned char +edje_edit_state_gradient_rel2_relative_y_set(Evas_Object *obj, const char *part, const char *state, double val) +{ + GET_PD_OR_RETURN(0); + printf("SET GRADIENT REL2 RELY for part: %s state: %s [TO %f]\n", part, state, val); + + pd->gradient.rel2.relative_y = val; + edje_object_calc_force(obj); + return 1; +} + +EAPI int +edje_edit_state_gradient_rel1_offset_x_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(0); + //printf("GET GRADIENT REL1 OFFSETX for part: %s state: %s [%f]\n", part, state, pd->gradient.rel1.offset_x); + + return pd->gradient.rel1.offset_x; +} + +EAPI int +edje_edit_state_gradient_rel1_offset_y_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(0); + //printf("GET GRADIENT REL1 OFFSETY for part: %s state: %s [%f]\n", part, state, pd->gradient.rel1.offset_y); + + return pd->gradient.rel1.offset_y; +} + +EAPI int +edje_edit_state_gradient_rel2_offset_x_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(0); + //printf("GET GRADIENT REL2 OFFSETX for part: %s state: %s [%f]\n", part, state, pd->gradient.rel2.offset_x); + + return pd->gradient.rel2.offset_x; +} + +EAPI int +edje_edit_state_gradient_rel2_offset_y_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(0); + //printf("GET GRADIENT REL2 OFFSETY for part: %s state: %s [%f]\n", part, state, pd->gradient.rel2.offset_y); + + return pd->gradient.rel2.offset_y; +} + +EAPI unsigned char +edje_edit_state_gradient_rel1_offset_x_set(Evas_Object *obj, const char *part, const char *state, int val) +{ + GET_PD_OR_RETURN(0); + printf("SET GRADIENT REL1 OFFSETX for part: %s state: %s [TO %d]\n", part, state, val); + + pd->gradient.rel1.offset_x = val; + edje_object_calc_force(obj); + return 1; +} + +EAPI unsigned char +edje_edit_state_gradient_rel1_offset_y_set(Evas_Object *obj, const char *part, const char *state, int val) +{ + GET_PD_OR_RETURN(0); + printf("SET GRADIENT REL1 OFFSETY for part: %s state: %s [TO %d]\n", part, state, val); + + pd->gradient.rel1.offset_y = val; + edje_object_calc_force(obj); + return 1; +} + +EAPI unsigned char +edje_edit_state_gradient_rel2_offset_x_set(Evas_Object *obj, const char *part, const char *state, int val) +{ + GET_PD_OR_RETURN(0); + printf("SET GRADIENT REL2 OFFSETX for part: %s state: %s [TO %d]\n", part, state, val); + + pd->gradient.rel2.offset_x = val; + edje_object_calc_force(obj); + return 1; +} + +EAPI unsigned char +edje_edit_state_gradient_rel2_offset_y_set(Evas_Object *obj, const char *part, const char *state, int val) +{ + GET_PD_OR_RETURN(0); + printf("SET GRADIENT REL2 OFFSETY for part: %s state: %s [TO %d]\n", part, state, val); + + pd->gradient.rel2.offset_y = val; + edje_object_calc_force(obj); + return 1; +} + /******************/ /* PROGRAMS API */ /******************/