From: <no-...@en...> - 2008-09-14 22:30:16
|
Author: davemds Date: 2008-09-14 15:30:15 -0700 (Sun, 14 Sep 2008) New Revision: 35987 Modified: trunk/edje/src/lib/Edje_Edit.h trunk/edje/src/lib/edje_cache.c trunk/edje/src/lib/edje_edit.c Log: * Add top level data editing functions * Also change edje_cache.c to don\'t free the data list when creating the data_cache Modified: trunk/edje/src/lib/Edje_Edit.h =================================================================== --- trunk/edje/src/lib/Edje_Edit.h 2008-09-14 20:31:03 UTC (rev 35986) +++ trunk/edje/src/lib/Edje_Edit.h 2008-09-14 22:30:15 UTC (rev 35987) @@ -218,6 +218,53 @@ //@} /******************************************************************************/ +/************************** DATA API **************************************/ +/******************************************************************************/ +/** @name Data API + * Functions to deal with data embedded in the edje (see @ref edcref). + */ //@{ + +/** Retrieves a list with the item names inside the data block **/ +EAPI Evas_List * ///@return An Evas_List* of string (char *)containing all the data names. +edje_edit_data_list_get( + Evas_Object *obj ///< The edje object +); + +/**Create a new data object in the given edje + * If another data with the same name exists nothing is created and FALSE is returned. + */ +EAPI unsigned char ///@return TRUE on success +edje_edit_data_add( + Evas_Object *obj, ///< The edje object + const char *itemname, ///< The name for the new data + const char *value ///< The value for the new data +); + +/**Delete the given data object from edje */ +EAPI unsigned char ///@return TRUE on success +edje_edit_data_del( + Evas_Object *obj, ///< The edje object + const char *itemname ///< The name of the data to remove +); + +/** Get the data associated with the given itemname **/ +EAPI const char * ///@return The data value +edje_edit_data_value_get( + Evas_Object * obj, ///< The edje object + char *itemname ///< The name of the data item +); + +/** Set the data associated with the given itemname **/ +EAPI unsigned char ///@return TRUE on success +edje_edit_data_value_set( + Evas_Object * obj, ///< The edje object + const char *itemname, ///< The name of the data item + const char *value ///< The new value to set +); + + +//@} +/******************************************************************************/ /************************** PARTS API *************************************/ /******************************************************************************/ /** @name Parts API Modified: trunk/edje/src/lib/edje_cache.c =================================================================== --- trunk/edje/src/lib/edje_cache.c 2008-09-14 20:31:03 UTC (rev 35986) +++ trunk/edje/src/lib/edje_cache.c 2008-09-14 22:30:15 UTC (rev 35987) @@ -133,13 +133,11 @@ _edje_textblock_style_parse_and_fix(edf); - for (l = edf->data; l; l = evas_list_remove(l, l->data)) + for (l = edf->data; l; l = l->next) { Edje_Data *di = l->data; edf->data_cache = evas_hash_add(edf->data_cache, evas_stringshare_add(di->key), di->value); - free(di); } - edf->data = NULL; if (coll) { Modified: trunk/edje/src/lib/edje_edit.c =================================================================== --- trunk/edje/src/lib/edje_edit.c 2008-09-14 20:31:03 UTC (rev 35986) +++ trunk/edje/src/lib/edje_edit.c 2008-09-14 22:30:15 UTC (rev 35987) @@ -896,6 +896,130 @@ } /***************/ +/* DATA API */ +/***************/ + +EAPI Evas_List * +edje_edit_data_list_get(Evas_Object * obj) +{ + Evas_List *datas, *l; + + GET_ED_OR_RETURN(NULL); + + if (!ed->file || !ed->file->data) + return NULL; + + datas = NULL; + for (l = ed->file->data; l; l = l->next) + { + Edje_Data *d = l->data; + datas = evas_list_append(datas, evas_stringshare_add(d->key)); + } + + return datas; +} + +EAPI unsigned char +edje_edit_data_add(Evas_Object *obj, const char *itemname, const char *value) +{ + Evas_List *l; + Edje_Data *d; + + GET_ED_OR_RETURN(0); + + if (!itemname || !ed->file) + return 0; + + for (l = ed->file->data; l; l = l->next) + { + Edje_Data *dd = l->data; + if (strcmp(dd->key, itemname) == 0) + return 0; + } + + d = mem_alloc(sizeof(Edje_Data)); + if (!d) return 0; + + d->key = (char*)evas_stringshare_add(itemname); + if (value) d->value = (char*)evas_stringshare_add(value); + else d->value = NULL; + + ed->file->data = evas_list_append(ed->file->data, d); + + return 1; +} + +EAPI unsigned char +edje_edit_data_del(Evas_Object *obj, const char *itemname) +{ + Evas_List *l; + + GET_ED_OR_RETURN(0); + + if (!itemname || !ed->file || !ed->file->data) + return 0; + + for (l = ed->file->data; l; l = l->next) + { + Edje_Data *d = l->data; + if (strcmp(d->key, itemname) == 0) + { + _edje_if_string_free(ed, d->key); + _edje_if_string_free(ed, d->value); + ed->file->data = evas_list_remove(ed->file->data, d); + free(d); + return 1; + } + } + return 0; +} + +EAPI const char * +edje_edit_data_value_get(Evas_Object * obj, char *itemname) +{ + Evas_List *l; + + GET_ED_OR_RETURN(NULL); + + if (!itemname || !ed->file || !ed->file->data) + return NULL; + + for (l = ed->file->data; l; l = l->next) + { + Edje_Data *d = l->data; + if (strcmp(d->key, itemname) == 0) + return evas_stringshare_add(d->value); + } + + return NULL; +} + +EAPI unsigned char +edje_edit_data_value_set( Evas_Object * obj, const char *itemname, const char *value) +{ + Evas_List *l; + + GET_ED_OR_RETURN(0); + + if (!itemname || !value || !ed->file || !ed->file->data) + return 0; + + for (l = ed->file->data; l; l = l->next) + { + Edje_Data *d = l->data; + if (strcmp(d->key, itemname) == 0) + { + _edje_if_string_free(ed, d->value); + d->value = (char*)evas_stringshare_add(value); + return 1; + } + } + + return 0; +} + + +/***************/ /* PARTS API */ /***************/ |
From: Enlightenment S. <no-...@en...> - 2008-09-16 12:01:39
|
Author: davemds Date: 2008-09-16 12:01:37 -0700 (Tue, 16 Sep 2008) New Revision: 36023 Modified: trunk/edje/src/lib/Edje_Edit.h trunk/edje/src/lib/edje_edit.c Log: * Expose state visible flag Modified: trunk/edje/src/lib/Edje_Edit.h =================================================================== --- trunk/edje/src/lib/Edje_Edit.h 2008-09-16 18:39:09 UTC (rev 36022) +++ trunk/edje/src/lib/Edje_Edit.h 2008-09-16 19:01:37 UTC (rev 36023) @@ -1042,6 +1042,24 @@ double y ///< The new value to set ); +/**Get the visibility of a part state.*/ +EAPI unsigned char ///@return TRUE if the state is visible +edje_edit_state_visible_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 visibility of a part state.*/ +EAPI void +edje_edit_state_visible_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") + unsigned char visible ///< TRUE to set the state visible +); + + //@} /******************************************************************************/ /************************** TEXT API ************************************/ Modified: trunk/edje/src/lib/edje_edit.c =================================================================== --- trunk/edje/src/lib/edje_edit.c 2008-09-16 18:39:09 UTC (rev 36022) +++ trunk/edje/src/lib/edje_edit.c 2008-09-16 19:01:37 UTC (rev 36023) @@ -2438,7 +2438,24 @@ edje_object_calc_force(obj); } +EAPI unsigned char +edje_edit_state_visible_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(0); + //printf("Get state visible flag of part: %s state: %s\n", part, state); + return pd->visible; +} +EAPI void +edje_edit_state_visible_set(Evas_Object *obj, const char *part, const char *state, unsigned char visible) +{ + GET_PD_OR_RETURN(); + printf("Set state visible flag of part: %s state: %s to: %d\n", part, state, visible); + if (visible) pd->visible = 1; + else pd->visible = 0; + edje_object_calc_force(obj); +} + /**************/ /* TEXT API */ /**************/ |
From: Enlightenment S. <no-...@en...> - 2008-09-23 17:47:37
|
Log: * more work on edc export (thanks dieb) Author: davemds Date: 2008-09-23 10:47:31 -0700 (Tue, 23 Sep 2008) New Revision: 36189 Modified: trunk/edje/src/lib/edje_edit.c Modified: trunk/edje/src/lib/edje_edit.c =================================================================== --- trunk/edje/src/lib/edje_edit.c 2008-09-23 16:07:48 UTC (rev 36188) +++ trunk/edje/src/lib/edje_edit.c 2008-09-23 17:47:31 UTC (rev 36189) @@ -4144,7 +4144,138 @@ #define I6 " " static char *types[] = {"NONE", "RECT", "TEXT", "IMAGE", "SWALLOW", "TEXTBLOCK", "GRADIENT", "GROUP"}; +static void +_edje_generate_source_of_spectra(Edje * ed, const char *name, FILE * f) +{ + Edje_Spectrum_Directory_Entry *d; + Edje_Spectrum_Color *color = NULL; + Evas_List *l; + if (!ed || !name || !f) return; + + if (d = _edje_edit_spectrum_entry_get(ed, name)) + { + fprintf(f, I1 "spectrum {\n"); + fprintf(f, I2 "name: \"%s\";\n", d->entry); + + for (l = d->color_list; l; l = l->next) + { + color = l->data; + if (color) + fprintf(f, I2 "color: %d %d %d %d %d;\n", color->r, color->g, + color->b, color->a, color->d); + } + + fprintf(f, I1 "}\n\n"); + } +} + +_edje_generate_source_of_program(Evas_Object *obj, const char *program, FILE *f) +{ + Evas_List *l, *ll; + const char *s, *s2; + double db, db2; + + GET_ED_OR_RETURN(); + + fprintf(f, I3"program {\n"); + fprintf(f, I4"name: \"%s\";\n", program); + + /* Signal */ + if (s = edje_edit_program_signal_get(obj, program)) + { + fprintf(f, I4"signal: \"%s\";\n", s); + edje_edit_string_free(s); + } + + /* Source */ + if (s = edje_edit_program_source_get(obj, program)) + { + fprintf(f, I4"source: \"%s\";\n", s); + edje_edit_string_free(s); + } + + /* Action */ + switch (edje_edit_program_action_get(obj, program)) + { + case EDJE_ACTION_TYPE_ACTION_STOP: + fprintf(f, I4"action: ACTION_STOP;\n"); + break; + case EDJE_ACTION_TYPE_STATE_SET: + if (s = edje_edit_program_state_get(obj, program)) + { + fprintf(f, I4"action: STATE_SET \"%s\" %.2f;\n", s, + edje_edit_program_value_get(obj, program)); + edje_edit_string_free(s); + } + break; + case EDJE_ACTION_TYPE_SIGNAL_EMIT: + s = edje_edit_program_state_get(obj, program); + s2 = edje_edit_program_state2_get(obj, program); + if (s && s2) + { + fprintf(f, I4"action: SIGNAL_EMIT \"%s\" \"%s\";\n", s, s2); + edje_edit_string_free(s); + edje_edit_string_free(s2); + } + break; + //TODO Drag + //~ case EDJE_ACTION_TYPE_DRAG_VAL_SET: + //~ fprintf(f, I4"action: DRAG_VAL_SET TODO;\n"); + //~ break; + //~ case EDJE_ACTION_TYPE_DRAG_VAL_STEP: + //~ fprintf(f, I4"action: DRAG_VAL_STEP TODO;\n"); + //~ break; + //~ case EDJE_ACTION_TYPE_DRAG_VAL_PAGE: + //~ fprintf(f, I4"action: DRAG_VAL_PAGE TODO;\n"); + //~ break; + } + + /* Transition */ + db = edje_edit_program_transition_time_get(obj, program); + switch (edje_edit_program_transition_get(obj, program)) + { + case EDJE_TWEEN_MODE_LINEAR: + fprintf(f, I4"transition: LINEAR %.5f;\n", db); + break; + case EDJE_TWEEN_MODE_ACCELERATE: + fprintf(f, I4"transition: ACCELERATE %.5f;\n", db); + break; + case EDJE_TWEEN_MODE_DECELERATE: + fprintf(f, I4"transition: DECELERATE %.5f;\n", db); + break; + case EDJE_TWEEN_MODE_SINUSOIDAL: + fprintf(f, I4"transition: SINUSOIDAL %.5f;\n", db); + break; + } + + /* In */ + db = edje_edit_program_in_from_get(obj, program); + db2 = edje_edit_program_in_range_get(obj, program); + if (db || db2) + fprintf(f, I4"in: %.5f %.5f;\n", db, db2); + + /* Targets */ + if (ll = edje_edit_program_targets_get(obj, program)) + { + for (l = ll; l; l = l->next) + fprintf(f, I4"target: \"%s\";\n", (char *)l->data); + edje_edit_string_list_free(ll); + } + + /* Afters */ + if (ll = edje_edit_program_afters_get(obj, program)) + { + for (l = ll; l; l = l->next) + fprintf(f, I4"after: \"%s\";\n", (char *)l->data); + edje_edit_string_list_free(ll); + } + + // TODO script {} + + fprintf(f, I3 "}\n"); +} + static void _edje_generate_source_of_part(Evas_Object *obj, const char *part, FILE *f) { @@ -4180,6 +4311,8 @@ fprintf(f, I2"max: %d %d;\n", w, h); //TODO Support data //TODO Support script + + /* Parts */ fprintf(f, I2"parts {\n"); ll = edje_edit_parts_list_get(obj); for (l = ll; l; l = l->next) @@ -4188,8 +4321,18 @@ } edje_edit_string_list_free(ll); fprintf(f, I2"}\n");//parts - //TODO programs like parts + + /* Programs */ + if (ll = edje_edit_programs_list_get(obj)) + { + fprintf(f, I2 "programs {\n"); + for (l = ll; l; l = l->next) + _edje_generate_source_of_program(obj, (char *)l->data, f); + fprintf(f, I2 "}\n"); + edje_edit_string_list_free(ll); + } + fprintf(f, " }\n");//group @@ -4242,7 +4385,7 @@ else fprintf(f, "COMP;\n"); } fprintf(f, I0"}\n\n"); - evas_list_free(ll); + edje_edit_string_list_free(ll); } /* Fonts */ @@ -4257,17 +4400,38 @@ fprintf(f, I1"font: \"FIXME\" \"%s\";\n", entry); } fprintf(f, I0"}\n\n"); - evas_list_free(ll); + edje_edit_string_list_free(ll); } /* Data */ - //TODO Support data - + if (ll = edje_edit_data_list_get(obj)) + { + fprintf(f, I0 "data {\n"); + + for (l = ll; l; l = l->next) + { + fprintf(f, I1 "item: \"%s\" \"%s\";\n", (char *)l->data, + edje_edit_data_value_get(obj, (char *)l->data)); + } + + fprintf(f, I0 "}\n\n"); + edje_edit_string_list_free(ll); + } + /* Color Classes */ //TODO Support color classes - /* Spectra */ - //TODO Support spectra + /* Spectrum */ + if (ll = edje_edit_spectrum_list_get(obj)) + { + fprintf(f, I0 "spectra {\n"); + + for (l = ll; l; l = l->next) + _edje_generate_source_of_spectra(ed, (char *)l->data, f); + + fprintf(f, I0 "}\n\n"); + edje_edit_string_list_free(ll); + } /* Styles */ //TODO Support styles |
From: Enlightenment S. <no-...@en...> - 2008-09-27 21:30:05
|
Log: * add the ability to rename a \'data\' object * initial color_class support Author: davemds Date: 2008-09-27 14:29:55 -0700 (Sat, 27 Sep 2008) New Revision: 36281 Modified: trunk/edje/src/lib/Edje_Edit.h trunk/edje/src/lib/edje_edit.c Modified: trunk/edje/src/lib/Edje_Edit.h =================================================================== --- trunk/edje/src/lib/Edje_Edit.h 2008-09-27 21:07:53 UTC (rev 36280) +++ trunk/edje/src/lib/Edje_Edit.h 2008-09-27 21:29:55 UTC (rev 36281) @@ -258,13 +258,36 @@ EAPI unsigned char ///@return TRUE on success edje_edit_data_value_set( Evas_Object * obj, ///< The edje object - const char *itemname, ///< The name of the data item - const char *value ///< The new value to set + const char *itemname, ///< The name of the data item + const char *value ///< The new value to set ); +EAPI unsigned char ///@return TRUE on success +edje_edit_data_name_set( + Evas_Object *obj, ///< The edje object + const char *itemname, ///< The name of the data item + const char *newname ///< The new name to set +); //@} /******************************************************************************/ +/*********************** COLOR CLASSES API ********************************/ +/******************************************************************************/ +/** @name Color Classes API + * Functions to deal with Color Classes (see @ref edcref). + */ //@{ + +/**Get the list of all the Color Classes 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 classes names. +edje_edit_color_classes_list_get( + Evas_Object * obj ///< The edje object +); + + +//@} +/******************************************************************************/ /************************** PARTS API *************************************/ /******************************************************************************/ /** @name Parts API Modified: trunk/edje/src/lib/edje_edit.c =================================================================== --- trunk/edje/src/lib/edje_edit.c 2008-09-27 21:07:53 UTC (rev 36280) +++ trunk/edje/src/lib/edje_edit.c 2008-09-27 21:29:55 UTC (rev 36281) @@ -995,7 +995,7 @@ } EAPI unsigned char -edje_edit_data_value_set( Evas_Object * obj, const char *itemname, const char *value) +edje_edit_data_value_set(Evas_Object *obj, const char *itemname, const char *value) { Evas_List *l; @@ -1018,7 +1018,56 @@ return 0; } +EAPI unsigned char +edje_edit_data_name_set(Evas_Object *obj, const char *itemname, const char *newname) +{ + Evas_List *l; + GET_ED_OR_RETURN(0); + + if (!itemname || !newname || !ed->file || !ed->file->data) + return 0; + + for (l = ed->file->data; l; l = l->next) + { + Edje_Data *d = l->data; + if (strcmp(d->key, itemname) == 0) + { + _edje_if_string_free(ed, d->key); + d->key = (char*)evas_stringshare_add(newname); + return 1; + } + } + + return 0; +} + +/***********************/ +/* COLOR CLASSES API */ +/***********************/ + +EAPI Evas_List * +edje_edit_color_classes_list_get(Evas_Object * obj) +{ + Edje_Color_Class *cc; + Evas_List *classes = NULL; + Evas_List *l; + + GET_ED_OR_RETURN(NULL); +printf("GET CLASSES LIST\n"); + if (!ed->file || !!ed->color_classes) + return NULL; +printf("GET CLASSES LIST %d\n", evas_list_count(ed->color_classes)); + for (l = ed->file->color_classes; l; l = l->next) + { + cc = l->data; + classes = evas_list_append(classes, evas_stringshare_add(cc->name)); + } + + return classes; +} + + /***************/ /* PARTS API */ /***************/ |
From: Enlightenment S. <no-...@en...> - 2008-09-28 18:44:27
|
Log: * make color classes editable Author: davemds Date: 2008-09-28 11:44:19 -0700 (Sun, 28 Sep 2008) New Revision: 36295 Modified: trunk/edje/src/lib/Edje_Edit.h trunk/edje/src/lib/edje_edit.c Modified: trunk/edje/src/lib/Edje_Edit.h =================================================================== --- trunk/edje/src/lib/Edje_Edit.h 2008-09-28 13:32:49 UTC (rev 36294) +++ trunk/edje/src/lib/Edje_Edit.h 2008-09-28 18:44:19 UTC (rev 36295) @@ -262,6 +262,7 @@ const char *value ///< The new value to set ); +/** Change the name of the given data object */ EAPI unsigned char ///@return TRUE on success edje_edit_data_name_set( Evas_Object *obj, ///< The edje object @@ -277,15 +278,81 @@ * Functions to deal with Color Classes (see @ref edcref). */ //@{ -/**Get the list of all the Color Classes in the given edje object. - * Use edje_edit_string_list_free() when you don't need it anymore. +/** Get the list of all the Color Classes 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 classes names. edje_edit_color_classes_list_get( Evas_Object * obj ///< The edje object ); +/** Create a new color class object in the given edje + * If another class with the same name exists nothing is created and FALSE is returned. + */ +EAPI unsigned char ///@return TRUE on success +edje_edit_color_class_add( + Evas_Object *obj, ///< The edje object + const char *name ///< The name of the new color class +); +/** Delete the given class object from edje */ +EAPI unsigned char ///@return TRUE on success +edje_edit_color_class_del( + Evas_Object *obj, ///< The edje object + const char *name ///< The name of the color class to delete +); + +/** Get all the colors that compose the class. + * You can pass NULL to colors you are not intrested in + */ +EAPI unsigned char ///@return TRUE on success +edje_edit_color_class_colors_get( + Evas_Object *obj, ///< The edje object + const char *class_name, ///< The name of the color class + int *r, ///< Where to store the red component of the standard color + int *g, ///< Where to store the green component of the standard color + int *b, ///< Where to store the blue component of the standard color + int *a, ///< Where to store the alpha component of the standard color + int *r2, ///< Where to store the red component of the second color + int *g2, ///< Where to store the green component of the second color + int *b2, ///< Where to store the green component of the second color + int *a2, ///< Where to store the green component of the second color + int *r3, ///< Where to store the red component of the third color + int *g3, ///< Where to store the green component of the third color + int *b3, ///< Where to store the blue component of the third color + int *a3 ///< Where to store the alpha component of the third color +); + +/** Set the colors for the given color class. + * If you set a color to -1 it will not be touched + */ +EAPI unsigned char ///@return TRUE on success +edje_edit_color_class_colors_set( + Evas_Object *obj, ///< The edje object + const char *class_name, ///< The name of the color class + int r, ///< The red component of the standard color + int g, ///< The green component of the standard color + int b, ///< The blue component of the standard color + int a, ///< The alpha component of the standard color + int r2, ///< The red component of the second color + int g2, ///< The green component of the second color + int b2, ///< The blue component of the second color + int a2, ///< The alpha component of the second color + int r3, ///< The red component of the third color + int g3, ///< The green component of the third color + int b3, ///< The blue component of the third color + int a3 ///< The alpha component of the third color +); + +/** Change the name of a color class */ +EAPI unsigned char ///@return TRUE on success +edje_edit_color_class_name_set( + Evas_Object *obj, ///< The edje object + const char *name, ///< The name of the color class + const char *newname ///< The new name to assign +); + + //@} /******************************************************************************/ /************************** PARTS API *************************************/ Modified: trunk/edje/src/lib/edje_edit.c =================================================================== --- trunk/edje/src/lib/edje_edit.c 2008-09-28 13:32:49 UTC (rev 36294) +++ trunk/edje/src/lib/edje_edit.c 2008-09-28 18:44:19 UTC (rev 36295) @@ -1049,17 +1049,18 @@ EAPI Evas_List * edje_edit_color_classes_list_get(Evas_Object * obj) { - Edje_Color_Class *cc; Evas_List *classes = NULL; Evas_List *l; GET_ED_OR_RETURN(NULL); -printf("GET CLASSES LIST\n"); - if (!ed->file || !!ed->color_classes) + + if (!ed->file || !ed->file->color_classes) return NULL; -printf("GET CLASSES LIST %d\n", evas_list_count(ed->color_classes)); +printf("GET CLASSES LIST %d %d\n", evas_list_count(ed->color_classes), evas_list_count(ed->file->color_classes)); for (l = ed->file->color_classes; l; l = l->next) { + Edje_Color_Class *cc; + cc = l->data; classes = evas_list_append(classes, evas_stringshare_add(cc->name)); } @@ -1067,7 +1068,162 @@ return classes; } +EAPI unsigned char +edje_edit_color_class_colors_get(Evas_Object *obj, const char *class_name, int *r, int *g, int *b, int *a, int *r2, int *g2, int *b2, int *a2, int *r3, int *g3, int *b3, int *a3) +{ + Evas_List *l; + GET_ED_OR_RETURN(0); + if (!ed->file || !ed->file->color_classes) + return 0; + + for (l = ed->file->color_classes; l; l = l->next) + { + Edje_Color_Class *cc; + + cc = l->data; + if (!strcmp(cc->name, class_name)) + { + if (r) *r = cc->r; + if (g) *g = cc->g; + if (b) *b = cc->b; + if (a) *a = cc->a; + + if (r2) *r2 = cc->r2; + if (g2) *g2 = cc->g2; + if (b2) *b2 = cc->b2; + if (a2) *a2 = cc->a2; + + if (r3) *r3 = cc->r3; + if (g3) *g3 = cc->g3; + if (b3) *b3 = cc->b3; + if (a3) *a3 = cc->a3; + + return 1; + } + } + return 0; +} + +EAPI unsigned char +edje_edit_color_class_colors_set(Evas_Object *obj, const char *class_name, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3) +{ + Evas_List *l; + GET_ED_OR_RETURN(0); + + if (!ed->file || !ed->file->color_classes) + return 0; + + for (l = ed->file->color_classes; l; l = l->next) + { + Edje_Color_Class *cc; + + cc = l->data; + if (!strcmp(cc->name, class_name)) + { + if (r > -1) cc->r = r; + if (g > -1) cc->g = g; + if (b > -1) cc->b = b; + if (a > -1) cc->a = a; + + if (r2 > -1) cc->r2 = r2; + if (g2 > -1) cc->g2 = g2; + if (b2 > -1) cc->b2 = b2; + if (a2 > -1) cc->a2 = a2; + + if (r3 > -1) cc->r3 = r3; + if (g3 > -1) cc->g3 = g3; + if (b3 > -1) cc->b3 = b3; + if (a3 > -1) cc->a3 = a3; + + return 1; + } + } + return 0; +} + +EAPI unsigned char +edje_edit_color_class_add(Evas_Object *obj, const char *name) +{ + Evas_List *l; + Edje_Color_Class *c; + + GET_ED_OR_RETURN(0); + + if (!name || !ed->file) + return 0; + + for (l = ed->file->color_classes; l; l = l->next) + { + Edje_Color_Class *cc = l->data; + if (strcmp(cc->name, name) == 0) + return 0; + } + + c = mem_alloc(sizeof(Edje_Color_Class)); + if (!c) return 0; + + c->name = (char*)evas_stringshare_add(name); + c->r = c->g = c->b = c->a = 255; + c->r2 = c->g2 = c->b2 = c->a2 = 255; + c->r3 = c->g3 = c->b3 = c->a3 = 255; + + ed->file->color_classes = evas_list_append(ed->file->color_classes, c); + + return 1; +} + +EAPI unsigned char +edje_edit_color_class_del(Evas_Object *obj, const char *name) +{ + Evas_List *l; + + GET_ED_OR_RETURN(0); + + if (!name || !ed->file || !ed->file->color_classes) + return 0; + + for (l = ed->file->color_classes; l; l = l->next) + { + Edje_Color_Class *cc = l->data; + if (strcmp(cc->name, name) == 0) + { + _edje_if_string_free(ed, cc->name); + ed->file->color_classes = evas_list_remove(ed->file->color_classes, cc); + free(cc); + return 1; + } + } + return 0; +} + +EAPI unsigned char +edje_edit_color_class_name_set(Evas_Object *obj, const char *name, const char *newname) +{ + Evas_List *l; + + GET_ED_OR_RETURN(0); + + if (!ed->file || !ed->file->color_classes) + return 0; + + for (l = ed->file->color_classes; l; l = l->next) + { + Edje_Color_Class *cc; + + cc = l->data; + if (!strcmp(cc->name, name)) + { + _edje_if_string_free(ed, cc->name); + cc->name = (char*)evas_stringshare_add(newname); + return 1; + } + } + + return 0; +} + + /***************/ /* PARTS API */ /***************/ |
From: Enlightenment S. <no-...@en...> - 2008-09-28 22:45:54
|
Log: * And also export color_classes when saving edc Author: davemds Date: 2008-09-28 15:45:47 -0700 (Sun, 28 Sep 2008) New Revision: 36300 Modified: trunk/edje/src/lib/edje_edit.c Modified: trunk/edje/src/lib/edje_edit.c =================================================================== --- trunk/edje/src/lib/edje_edit.c 2008-09-28 22:24:32 UTC (rev 36299) +++ trunk/edje/src/lib/edje_edit.c 2008-09-28 22:45:47 UTC (rev 36300) @@ -4388,10 +4388,32 @@ color->b, color->a, color->d); } - fprintf(f, I1 "}\n\n"); + fprintf(f, I1 "}\n"); } } + static void +_edje_generate_source_of_colorclass(Edje * ed, const char *name, FILE * f) +{ + Evas_List *l; + Edje_Color_Class *cc; + + for (l = ed->file->color_classes; l; l = l->next) + { + cc = l->data; + if (!strcmp(cc->name, name)) + { + fprintf(f, I1 "color_class {\n"); + fprintf(f, I2 "name: \"%s\";\n", cc->name); + fprintf(f, I2 "color: %d %d %d %d;\n", cc->r, cc->g, cc->b, cc->a); + fprintf(f, I2 "color2: %d %d %d %d;\n", cc->r2, cc->g2, cc->b2, cc->a2); + fprintf(f, I2 "color3: %d %d %d %d;\n", cc->r3, cc->g3, cc->b3, cc->a3); + fprintf(f, I1 "}\n"); + } + } +} + +static void _edje_generate_source_of_program(Evas_Object *obj, const char *program, FILE *f) { Evas_List *l, *ll; @@ -4549,7 +4571,7 @@ { fprintf(f, I2 "programs {\n"); for (l = ll; l; l = l->next) - _edje_generate_source_of_program(obj, (char *)l->data, f); + _edje_generate_source_of_program(obj, (char *)l->data, f); fprintf(f, I2 "}\n"); edje_edit_string_list_free(ll); } @@ -4641,7 +4663,14 @@ } /* Color Classes */ - //TODO Support color classes + if (ll = edje_edit_color_classes_list_get(obj)) + { + fprintf(f, I0 "color_classes {\n"); + for (l = ll; l; l = l->next) + _edje_generate_source_of_colorclass(ed, (char *)l->data, f); + fprintf(f, I0 "}\n\n"); + edje_edit_string_list_free(ll); + } /* Spectrum */ if (ll = edje_edit_spectrum_list_get(obj)) |
From: Enlightenment S. <no-...@en...> - 2008-10-03 00:20:28
|
Log: * more work on edc export Author: davemds Date: 2008-10-02 17:20:19 -0700 (Thu, 02 Oct 2008) New Revision: 36412 Modified: trunk/edje/src/lib/edje_edit.c Modified: trunk/edje/src/lib/edje_edit.c =================================================================== --- trunk/edje/src/lib/edje_edit.c 2008-10-03 00:11:08 UTC (rev 36411) +++ trunk/edje/src/lib/edje_edit.c 2008-10-03 00:20:19 UTC (rev 36412) @@ -4366,6 +4366,8 @@ #define I6 " " static char *types[] = {"NONE", "RECT", "TEXT", "IMAGE", "SWALLOW", "TEXTBLOCK", "GRADIENT", "GROUP"}; +static char *effects[] = {"NONE", "PLAIN", "OUTLINE", "SOFT_OUTLINE", "SHADOW", "SOFT_SHADOW", "OUTLINE_SHADOW", "OUTLINE_SOFT_SHADOW ", "FAR_SHADOW ", "FAR_SOFT_SHADOW", "GLOW"}; +static char *prefers[] = {"NONE", "VERTICAL", "HORIZONTAL", "BOTH"}; static void _edje_generate_source_of_spectra(Edje * ed, const char *name, FILE * f) { @@ -4520,9 +4522,121 @@ fprintf(f, I3 "}\n"); } + static void +_edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *state, FILE *f) +{ + Evas_List *l, *ll; + Edje_Real_Part *rp; + + GET_PD_OR_RETURN(); + + rp = _edje_real_part_get(ed, part); + if (!rp) return; + + fprintf(f, I4"description {\n"); + //TODO Support inherit + fprintf(f, I5"state: \"%s\" %g;\n", pd->state.name, pd->state.value); + + if (!pd->visible) + fprintf(f, I5"visible: 0;\n"); + + if (pd->align.x != 0.5 || pd->align.y != 0.5) + fprintf(f, I5"align: %g %g;\n", pd->align.x, pd->align.y); + + //TODO Support fixed + + if (pd->min.w || pd->min.h) + fprintf(f, I5"min: %d %d;\n", pd->min.w, pd->min.h); + if (pd->max.w != -1 || pd->max.h != -1) + fprintf(f, I5"max: %d %d;\n", pd->max.w, pd->max.h); + + //TODO Support step + + if (pd->aspect.min || pd->aspect.max) + fprintf(f, I5"aspect: %g %g;\n", pd->aspect.min, pd->aspect.max); + if (pd->aspect.prefer) + fprintf(f, I5"aspect_preference: %s;\n", prefers[pd->aspect.prefer]); + + if (pd->color_class) + fprintf(f, I5"color_class: \"%s\";\n", pd->color_class); + + if (pd->color.r != 255 || pd->color.g != 255 || + pd->color.b != 255 || pd->color.a != 255) + fprintf(f, I5"color: %d %d %d %d;\n", + pd->color.r, pd->color.g, pd->color.b, pd->color.a); + if (pd->color2.r != 0 || pd->color2.g != 0 || + pd->color2.b != 0 || pd->color2.a != 255) + fprintf(f, I5"color2: %d %d %d %d;\n", + pd->color2.r, pd->color2.g, pd->color2.b, pd->color2.a); + if (pd->color3.r != 0 || pd->color3.g != 0 || + pd->color3.b != 0 || pd->color3.a != 128) + fprintf(f, I5"color3: %d %d %d %d;\n", + pd->color3.r, pd->color3.g, pd->color3.b, pd->color3.a); + + //Rel1 + fprintf(f, I5"rel1 {\n"); + if (pd->rel1.relative_x || pd->rel1.relative_y) + fprintf(f, I6"relative: %g %g;\n", pd->rel1.relative_x, pd->rel1.relative_y); + if (pd->rel1.offset_x || pd->rel1.offset_y) + fprintf(f, I6"offset: %d %d;\n", pd->rel1.offset_x, pd->rel1.offset_y); + if (pd->rel1.id_x != -1 && pd->rel1.id_x == pd->rel1.id_y) + fprintf(f, I6"to: \"%s\";\n", ed->table_parts[pd->rel1.id_x]->part->name); + else + { + if (pd->rel1.id_x != -1) + fprintf(f, I6"to_x: \"%s\";\n", ed->table_parts[pd->rel1.id_x]->part->name); + if (pd->rel1.id_y != -1) + fprintf(f, I6"to_y: \"%s\";\n", ed->table_parts[pd->rel1.id_y]->part->name); + } + fprintf(f, I5"}\n");//rel1 + + //Rel2 + fprintf(f, I5"rel2 {\n"); + if (pd->rel2.relative_x != 1.0 || pd->rel2.relative_y != 1.0) + fprintf(f, I6"relative: %g %g;\n", pd->rel2.relative_x, pd->rel2.relative_y); + if (pd->rel2.offset_x != -1 || pd->rel2.offset_y != -1) + fprintf(f, I6"offset: %d %d;\n", pd->rel2.offset_x, pd->rel2.offset_y); + if (pd->rel2.id_x != -1 && pd->rel2.id_x == pd->rel2.id_y) + fprintf(f, I6"to: \"%s\";\n", ed->table_parts[pd->rel2.id_x]->part->name); + else + { + if (pd->rel2.id_x != -1) + fprintf(f, I6"to_x: \"%s\";\n", ed->table_parts[pd->rel2.id_x]->part->name); + if (pd->rel2.id_y != -1) + fprintf(f, I6"to_y: \"%s\";\n", ed->table_parts[pd->rel2.id_y]->part->name); + } + fprintf(f, I5"}\n");//rel2 + + //Image + if (rp->part->type == EDJE_PART_TYPE_IMAGE) + { + fprintf(f, I5"image {\n"); + fprintf(f, I6"normal: \"%s\";\n", _edje_image_name_find(obj, pd->image.id)); + + ll = edje_edit_state_tweens_list_get(obj, part, state); + for (l = ll; l; l = l->next) + fprintf(f, I6"tween: \"%s\";\n", (char *)l->data); + edje_edit_string_list_free(ll); + + if (pd->border.l || pd->border.r || pd->border.t || pd->border.b) + fprintf(f, I6"border: %d %d %d %d;\n", pd->border.l, pd->border.r, pd->border.t, pd->border.b); + //TODO Support middle + fprintf(f, I5"}\n");//image + } + + //...and so on... + + + fprintf(f, I4"}\n");//description +} + +static void _edje_generate_source_of_part(Evas_Object *obj, const char *part, FILE *f) { + const char *str; + Evas_List *l, *ll; + fprintf(f, I3"part {\n"); fprintf(f, I4"name: \"%s\";\n", part); fprintf(f, I4"type: %s;\n", types[edje_edit_part_type_get(obj, part)]); @@ -4530,9 +4644,31 @@ fprintf(f, I4"mouse_events: 0;\n"); if (edje_edit_part_repeat_events_get(obj, part)) fprintf(f, I4"repeat_events: 1;\n"); + //TODO Support ignore_flags + //TODO Support scale + //TODO Support pointer_mode + //TODO Support precise_is_inside + //TODO Support use_alternate_font_metrics + if ((str = edje_edit_part_clip_to_get(obj, part))) + { + fprintf(f, I4"clip_to: \"%s\";\n", str); + edje_edit_string_free(str); + } + if ((str = edje_edit_part_source_get(obj, part))) + { + fprintf(f, I4"source: \"%s\";\n", str); + edje_edit_string_free(str); + } + if (edje_edit_part_effect_get(obj, part)) + fprintf(f, I4"effect: %s;\n", effects[edje_edit_part_effect_get(obj, part)]); + //TODO Support dragable + + //Descriptions + ll = edje_edit_part_states_list_get(obj, part); + for (l = ll; l; l = l->next) + _edje_generate_source_of_state(obj, part, (char*)l->data, f); + edje_edit_string_list_free(ll); - //...and so on... - fprintf(f, I3"}\n");//part } |
From: Enlightenment S. <no-...@en...> - 2008-09-28 22:23:53
|
Log: * implement edje_edit_state_color_class_get/set Author: davemds Date: 2008-09-28 15:23:43 -0700 (Sun, 28 Sep 2008) New Revision: 36298 Modified: trunk/edje/src/lib/Edje_Edit.h trunk/edje/src/lib/edje_edit.c Modified: trunk/edje/src/lib/Edje_Edit.h =================================================================== --- trunk/edje/src/lib/Edje_Edit.h 2008-09-28 19:36:24 UTC (rev 36297) +++ trunk/edje/src/lib/Edje_Edit.h 2008-09-28 22:23:43 UTC (rev 36298) @@ -1149,7 +1149,24 @@ unsigned char visible ///< TRUE to set the state visible ); +/**Get the color class of the given part state. Remember to free the string with edje_edit_string_free()*/ +EAPI const char* ///@return The current color_class of the part state +edje_edit_state_color_class_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 color class for the given part state.*/ +EAPI void +edje_edit_state_color_class_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 *color_class ///< The new color_class to assign +); + + //@} /******************************************************************************/ /************************** TEXT API ************************************/ Modified: trunk/edje/src/lib/edje_edit.c =================================================================== --- trunk/edje/src/lib/edje_edit.c 2008-09-28 19:36:24 UTC (rev 36297) +++ trunk/edje/src/lib/edje_edit.c 2008-09-28 22:23:43 UTC (rev 36298) @@ -2661,6 +2661,23 @@ edje_object_calc_force(obj); } +EAPI const char* +edje_edit_state_color_class_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(NULL); + printf("Get ColorClass of part: %s state: %s\n", part, state); + return evas_stringshare_add(pd->color_class); +} + +EAPI void +edje_edit_state_color_class_set(Evas_Object *obj, const char *part, const char *state, const char *color_class) +{ + GET_PD_OR_RETURN(); + printf("Set ColorClass of part: %s state: %s [to: %s]\n", part, state, color_class); + _edje_if_string_free(ed, pd->color_class); + pd->color_class = (char*)evas_stringshare_add(color_class); +} + /**************/ /* TEXT API */ /**************/ |
From: Enlightenment S. <no-...@en...> - 2008-10-07 16:02:03
|
Log: * Add support for text Ellipsis and Fit Author: davemds Date: 2008-10-07 09:01:56 -0700 (Tue, 07 Oct 2008) New Revision: 36502 Modified: trunk/edje/src/lib/Edje_Edit.h trunk/edje/src/lib/edje_edit.c Modified: trunk/edje/src/lib/Edje_Edit.h =================================================================== --- trunk/edje/src/lib/Edje_Edit.h 2008-10-07 14:12:50 UTC (rev 36501) +++ trunk/edje/src/lib/Edje_Edit.h 2008-10-07 16:01:56 UTC (rev 36502) @@ -1243,6 +1243,57 @@ double align ///< The new text align Y value ); +/**Get the text elipsis of a part state. The value range is from 0.0(right) to 1.0(left)*/ +EAPI double ///@return The text elipsis value +edje_edit_state_text_elipsis_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 text vertical align of a part state. The value range is from 0.0(right) to 1.0(left)*/ +EAPI void +edje_edit_state_text_elipsis_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 balance ///< The position where to cut the string +); + +/**Get if the text part fit it's container horizontally */ +EAPI unsigned char ///@return 1 If the part fit it's container horizontally +edje_edit_state_text_fit_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") +); + +/**Set if the text part should fit it's container horizontally */ +EAPI void +edje_edit_state_text_fit_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") + unsigned char fit ///< 1 to make the text fit it's container +); + +/**Get if the text part fit it's container vertically */ +EAPI unsigned char ///@return 1 If the part fit it's container vertically +edje_edit_state_text_fit_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 if the text part should fit it's container vertically */ +EAPI void +edje_edit_state_text_fit_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") + unsigned char fit ///< 1 to make the text fit it's container +); + /**Get the list of all the fonts in the given edje. * Use edje_edit_string_list_free() when you don't need the list anymore. */ Modified: trunk/edje/src/lib/edje_edit.c =================================================================== --- trunk/edje/src/lib/edje_edit.c 2008-10-07 14:12:50 UTC (rev 36501) +++ trunk/edje/src/lib/edje_edit.c 2008-10-07 16:01:56 UTC (rev 36502) @@ -2773,6 +2773,64 @@ edje_object_calc_force(obj); } +EAPI double +edje_edit_state_text_elipsis_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(0.0); + + //printf("GET TEXT_ELIPSIS of state: %s [%f]\n", state, pd->text.elipsis); + return pd->text.elipsis; +} + +EAPI void +edje_edit_state_text_elipsis_set(Evas_Object *obj, const char *part, const char *state, double balance) +{ + GET_PD_OR_RETURN(); + + //printf("SET TEXT_ELIPSIS of state: %s [%f]\n", state, balance); + + pd->text.elipsis = balance; + edje_object_calc_force(obj); +} + +EAPI unsigned char +edje_edit_state_text_fit_x_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(); + //printf("GET TEXT_FIT_VERT of state: %s \n", state); + return pd->text.fit_x; +} + +EAPI void +edje_edit_state_text_fit_x_set(Evas_Object *obj, const char *part, const char *state, unsigned char fit) +{ + GET_PD_OR_RETURN(); + + //printf("SET TEXT_FIT_VERT of state: %s\n", state); + + pd->text.fit_x = fit ? 1 : 0; + edje_object_calc_force(obj); +} + +EAPI unsigned char +edje_edit_state_text_fit_y_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(); + //printf("GET TEXT_FIT_VERT of state: %s \n", state); + return pd->text.fit_y; +} + +EAPI void +edje_edit_state_text_fit_y_set(Evas_Object *obj, const char *part, const char *state, unsigned char fit) +{ + GET_PD_OR_RETURN(); + + //printf("SET TEXT_FIT_VERT of state: %s\n", state); + + pd->text.fit_y = fit ? 1 : 0; + edje_object_calc_force(obj); +} + EAPI Evas_List * edje_edit_fonts_list_get(Evas_Object *obj) { @@ -4656,10 +4714,11 @@ rp->part->type == EDJE_PART_TYPE_GRADIENT) { fprintf(f, I5"fill {\n"); - if (!pd->fill.smooth) + if (rp->part->type == EDJE_PART_TYPE_IMAGE && !pd->fill.smooth) fprintf(f, I6"smooth: 0;\n"); //TODO Support spread - //TODO Support angle + if (rp->part->type == EDJE_PART_TYPE_GRADIENT && pd->fill.angle) + fprintf(f, I6"angle: %d;\n", pd->fill.angle); //TODO Support type if (pd->fill.pos_rel_x || pd->fill.pos_rel_y || @@ -4697,13 +4756,15 @@ fprintf(f, I6"size: %d;\n", pd->text.size); if (pd->text.text_class) fprintf(f, I6"text_class: \"%s\";\n", pd->text.text_class); - //TODO Support fit + if (pd->text.fit_x || pd->text.fit_y) + fprintf(f, I6"fit: %d %d;\n", pd->text.fit_x, pd->text.fit_y); //TODO Support min & max - if (pd->text.align.x != 0.5 || pd->text.align.y != 0.5) + if (pd->text.align.x != 0.5 || pd->text.align.y != 0.5) fprintf(f, I6"align: %g %g;\n", pd->text.align.x, pd->text.align.y); //TODO Support source //TODO Support text_source - //TODO Support elipsis + if (pd->text.elipsis) + fprintf(f, I6"elipsis: %g;\n", pd->text.elipsis); fprintf(f, I5"}\n"); } @@ -4722,9 +4783,6 @@ fprintf(f, I5"}\n"); } - //...and so on... - - fprintf(f, I4"}\n");//description } |
From: Enlightenment S. <no-...@en...> - 2008-10-07 21:13:34
|
Log: * Support image_border_middle Author: davemds Date: 2008-10-07 14:13:27 -0700 (Tue, 07 Oct 2008) New Revision: 36506 Modified: trunk/edje/src/lib/Edje_Edit.h trunk/edje/src/lib/edje_edit.c Modified: trunk/edje/src/lib/Edje_Edit.h =================================================================== --- trunk/edje/src/lib/Edje_Edit.h 2008-10-07 19:41:57 UTC (rev 36505) +++ trunk/edje/src/lib/Edje_Edit.h 2008-10-07 21:13:27 UTC (rev 36506) @@ -1424,6 +1424,23 @@ int b ///< The new bottom border (or -1) ); +/**Get if the image center should be draw. 1 means to draw the center, 0 to don't draw it.*/ +EAPI unsigned char ///@return 1 if the center of the bordered image is draw +edje_edit_state_image_border_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") +); + +/**Set if the image center should be draw. 1 means to draw the center, 0 to don't draw it.*/ +EAPI void +edje_edit_state_image_border_fill_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") + unsigned char fill ///< If set to 0 the image center isn't draw +); + /**Get the list of all the tweens images in the given part state. * Use edje_edit_string_list_free() when you don't need it anymore. */ Modified: trunk/edje/src/lib/edje_edit.c =================================================================== --- trunk/edje/src/lib/edje_edit.c 2008-10-07 19:41:57 UTC (rev 36505) +++ trunk/edje/src/lib/edje_edit.c 2008-10-07 21:13:27 UTC (rev 36506) @@ -3297,6 +3297,22 @@ edje_object_calc_force(obj); } +EAPI unsigned char +edje_edit_state_image_border_fill_get(Evas_Object *obj, const char *part, const char *state) +{ + GET_PD_OR_RETURN(); + return pd->border.no_fill ? 0 : 1; +} + +EAPI void +edje_edit_state_image_border_fill_set(Evas_Object *obj, const char *part, const char *state, unsigned char fill) +{ + GET_PD_OR_RETURN(); + pd->border.no_fill = fill ? 0 : 1; + + edje_object_calc_force(obj); +} + /******************/ /* SPECTRUM API */ /******************/ @@ -4479,12 +4495,12 @@ cc = l->data; if (!strcmp(cc->name, name)) { - fprintf(f, I1 "color_class {\n"); - fprintf(f, I2 "name: \"%s\";\n", cc->name); - fprintf(f, I2 "color: %d %d %d %d;\n", cc->r, cc->g, cc->b, cc->a); - fprintf(f, I2 "color2: %d %d %d %d;\n", cc->r2, cc->g2, cc->b2, cc->a2); - fprintf(f, I2 "color3: %d %d %d %d;\n", cc->r3, cc->g3, cc->b3, cc->a3); - fprintf(f, I1 "}\n"); + fprintf(f, I1 "color_class {\n"); + fprintf(f, I2 "name: \"%s\";\n", cc->name); + fprintf(f, I2 "color: %d %d %d %d;\n", cc->r, cc->g, cc->b, cc->a); + fprintf(f, I2 "color2: %d %d %d %d;\n", cc->r2, cc->g2, cc->b2, cc->a2); + fprintf(f, I2 "color3: %d %d %d %d;\n", cc->r3, cc->g3, cc->b3, cc->a3); + fprintf(f, I1 "}\n"); } } } @@ -4539,7 +4555,7 @@ edje_edit_string_free(s2); } break; - //TODO Drag + //TODO Support Drag //~ case EDJE_ACTION_TYPE_DRAG_VAL_SET: //~ fprintf(f, I4"action: DRAG_VAL_SET TODO;\n"); //~ break; @@ -4591,7 +4607,7 @@ edje_edit_string_list_free(ll); } - // TODO script {} + // TODO Support script {} fprintf(f, I3 "}\n"); } @@ -4705,7 +4721,9 @@ if (pd->border.l || pd->border.r || pd->border.t || pd->border.b) fprintf(f, I6"border: %d %d %d %d;\n", pd->border.l, pd->border.r, pd->border.t, pd->border.b); - //TODO Support middle + if (pd->border.no_fill) + fprintf(f, I6"middle: 0;\n"); + fprintf(f, I5"}\n");//image } @@ -4931,8 +4949,8 @@ for (l = ll; l; l = l->next) { char *entry = l->data; - // TODO Finish me - fprintf(f, I1"font: \"FIXME\" \"%s\";\n", entry); + // TODO Fixme the filename is wrong + fprintf(f, I1"font: \"%s.ttf\" \"%s\";\n", entry, entry); } fprintf(f, I0"}\n\n"); edje_edit_string_list_free(ll); @@ -4974,22 +4992,18 @@ fprintf(f, I0 "}\n\n"); edje_edit_string_list_free(ll); } - + /* Styles */ //TODO Support styles - + /* Collections */ - fprintf(f, "collections {\n"); ll = edje_file_collection_list(ed->file->path); for (l = ll; l; l = l->next) - { - _edje_generate_source_of_group(ed, (char*)l->data, f); - - } + _edje_generate_source_of_group(ed, (char*)l->data, f); fprintf(f, "}\n\n"); edje_file_collection_list_free(ll); - + fclose(f); sfl = mem_alloc(SZ(SrcFile_List)); |
From: Enlightenment S. <no-...@en...> - 2008-10-09 00:04:25
|
Log: * ... and finally save the generated EDC back to the edje file This means that file created with the editor can now be decompiled!! But make attention because not every feature of edje is supported. This means that (if you modify an existing file) you will lost some feature while saving; like MACRO, inherit values, comments in the EDC code and some other smallies. But if you have created the file with the editor all will be edje_decc well. Author: davemds Date: 2008-10-08 17:04:18 -0700 (Wed, 08 Oct 2008) New Revision: 36537 Modified: trunk/edje/src/lib/Edje_Edit.h trunk/edje/src/lib/edje_edit.c Modified: trunk/edje/src/lib/Edje_Edit.h =================================================================== --- trunk/edje/src/lib/Edje_Edit.h 2008-10-08 22:39:22 UTC (rev 36536) +++ trunk/edje/src/lib/Edje_Edit.h 2008-10-09 00:04:18 UTC (rev 36537) @@ -105,6 +105,14 @@ const char *str ///< The string to free. ); +/** Get the name of the program that compiled the edje file.@n + * Can be 'edje_cc' or 'edje_edit' + */ +EAPI const char* ///@return The compiler name. Don't forget to free the string with edje_edit_string_free() +edje_edit_compiler_get( + Evas_Object *obj ///< The edje object +); + /**Save the modified edje object back to his file. * Use this function when you are done with your editing, all the change made * to the current loaded group will be saved back to the original file. Modified: trunk/edje/src/lib/edje_edit.c =================================================================== --- trunk/edje/src/lib/edje_edit.c 2008-10-08 22:39:22 UTC (rev 36536) +++ trunk/edje/src/lib/edje_edit.c 2008-10-09 00:04:18 UTC (rev 36537) @@ -613,6 +613,13 @@ if (str) evas_stringshare_del(str); } +EAPI const char* +edje_edit_compiler_get(Evas_Object *obj) +{ + GET_ED_OR_RETURN(0); + return evas_stringshare_add(ed->file->compiler); +} + /****************/ /* GROUPS API */ /****************/ @@ -4428,7 +4435,6 @@ /*************************/ /* EMBRYO SCRIPTS API */ /*************************/ - EAPI const char * edje_edit_script_get(Evas_Object *obj) { @@ -4446,6 +4452,10 @@ return "Not yet complete..."; } + +/***************************/ +/* EDC SOURCE GENERATION */ +/***************************/ #define I0 "" #define I1 " " #define I2 " " @@ -4892,16 +4902,15 @@ //TODO Free the Evas_Object *obj } -static void +static const char* //return the name of the temp file containing the edc _edje_generate_source(Evas_Object *obj) { printf("\n****** GENERATE EDC SOURCE *********\n"); char tmpn[PATH_MAX]; int fd; FILE *f; - long sz; - SrcFile *sf; - SrcFile_List *sfl; + + Evas_List *l, *ll; GET_ED_OR_RETURN(); @@ -4909,9 +4918,9 @@ /* Open a temp file */ //TODO this will not work on windows strcpy(tmpn, "/tmp/edje_edit.edc-tmp-XXXXXX"); - if (!(fd = mkstemp(tmpn))) return; + if (!(fd = mkstemp(tmpn))) return NULL; printf("*** tmp file: %s\n", tmpn); - if (!(f = fopen(tmpn, "w"))) return; + if (!(f = fopen(tmpn, "w"))) return NULL; /* Write edc into file */ //TODO Probably we need to save the file before generation @@ -5006,47 +5015,62 @@ fclose(f); - sfl = mem_alloc(SZ(SrcFile_List)); - sfl->list = NULL; + return evas_stringshare_add(tmpn); +} - /* reopen the temp file and get the contents */ - f = fopen(tmpn, "rb"); - if (!f) return; - fseek(f, 0, SEEK_END); - sz = ftell(f); - fseek(f, 0, SEEK_SET); - sf = mem_alloc(SZ(SrcFile)); - sf->name = mem_strdup("edje_source.edc"); - sf->file = mem_alloc(sz + 1); - fread(sf->file, sz, 1, f); - sf->file[sz] = '\0'; - fseek(f, 0, SEEK_SET); - fclose(f); - printf("\n\n================= EDC START HERE =========================\n%s\n" - "================= EDC END HERE ===========================\n" - "generated file: %s\n" - "==========================================================\n", - sf->file, tmpn); - - sfl->list = evas_list_append(sfl->list, sf); +/*********************/ +/* SAVING ROUTINES */ +/*********************/ +//////////////////////////////////////// +static char * +_edje_edit_str_direct_alloc(const char *str) +{ + return (char *)str; +} - /* Write the source to the edje file */ - //~ eetf = eet_open(ed->file->path, EET_FILE_MODE_READ_WRITE); - //~ if (!eetf) return; - //~ if (!_srcfile_list_edd) - //~ source_edd(); +static void +_edje_edit_str_direct_free(const char *str) +{ +} - //~ eet_data_write(eetf, _srcfile_list_edd, "edje_sources", &sfl, 1); +static Eet_Data_Descriptor *_srcfile_edd = NULL; +static Eet_Data_Descriptor *_srcfile_list_edd = NULL; - //~ eet_close(eetf); +void +source_edd(void) +{ + Eet_Data_Descriptor_Class eddc; + + eddc.version = EET_DATA_DESCRIPTOR_CLASS_VERSION; + eddc.func.mem_alloc = NULL; + eddc.func.mem_free = NULL; + eddc.func.str_alloc = evas_stringshare_add; + eddc.func.str_free = evas_stringshare_del; + eddc.func.list_next = evas_list_next; + eddc.func.list_append = evas_list_append; + eddc.func.list_data = evas_list_data; + eddc.func.list_free = evas_list_free; + eddc.func.hash_foreach = evas_hash_foreach; + eddc.func.hash_add = evas_hash_add; + eddc.func.hash_free = evas_hash_free; + eddc.func.str_direct_alloc = _edje_edit_str_direct_alloc; + eddc.func.str_direct_free = _edje_edit_str_direct_free; + + eddc.name = "srcfile"; + eddc.size = sizeof(SrcFile); + _srcfile_edd = eet_data_descriptor3_new(&eddc); + EET_DATA_DESCRIPTOR_ADD_BASIC(_srcfile_edd, SrcFile, "name", name, EET_T_INLINED_STRING); + EET_DATA_DESCRIPTOR_ADD_BASIC(_srcfile_edd, SrcFile, "file", file, EET_T_INLINED_STRING); + + eddc.name = "srcfile_list"; + eddc.size = sizeof(SrcFile_List); + _srcfile_list_edd = eet_data_descriptor3_new(&eddc); + EET_DATA_DESCRIPTOR_ADD_LIST(_srcfile_list_edd, SrcFile_List, "list", list, _srcfile_edd); } +///////////////////////////////////////// -#define ABORT_WRITE2(eet_file) \ - eet_close(eet_file); \ - return 0; - EAPI int edje_edit_save(Evas_Object *obj) { @@ -5054,7 +5078,6 @@ Edje_File *ef; Eet_File *eetf; int bytes; - char *progname = "Edje_Edit"; GET_ED_OR_RETURN(0); @@ -5063,24 +5086,35 @@ printf("*********** Saving file ******************\n"); printf("** path: %s\n", ef->path); + + /* Set compiler name */ + if (strcmp(ef->compiler, "edje_edit")) + { + _edje_if_string_free(ed, ef->compiler); + ef->compiler = strdup("edje_edit"); + } + /* Open the eet file */ eetf = eet_open(ef->path, EET_FILE_MODE_READ_WRITE); if (!eetf) { - fprintf(stderr, "%s: Error. unable to open \"%s\" for writing output\n", - progname, ef->path); + fprintf(stderr, "Error. unable to open \"%s\" for writing output\n", + ef->path); return 0; } + /* Write Edje_File structure */ printf("** Writing Edje_File* ed->file\n"); bytes = eet_data_write(eetf, _edje_edd_edje_file, "edje_file", ef, 1); if (bytes <= 0) { - fprintf(stderr, "%s: Error. unable to write \"edje_file\" " - "entry to \"%s\" \n", progname, ef->path); - ABORT_WRITE2(eetf); + fprintf(stderr, "Error. unable to write \"edje_file\" " + "entry to \"%s\" \n", ef->path); + eet_close(eetf); + return 0; } + /* Write all the collections */ if (ed->collection) { printf("** Writing Edje_Part_Collection* ed->collection " @@ -5092,12 +5126,70 @@ buf, ed->collection, 1); if (bytes <= 0) { - fprintf(stderr, "%s: Error. unable to write \"%s\" part entry to %s \n", - progname, buf, ef->path); - ABORT_WRITE2(eetf); + fprintf(stderr, "Error. unable to write \"%s\" part entry to %s \n", + buf, ef->path); + eet_close(eetf); + return 0; } } + /* Write the new edc source */ + SrcFile *sf; + SrcFile_List *sfl; + const char *source_file; + FILE *f; + long sz; + + source_file = _edje_generate_source(obj); + if (!source_file) + { + fprintf(stderr, "Error: can't create edc source\n"); + eet_close(eetf); + return 0; + } + printf("** Writing EDC Source [from: %s]\n", source_file); + + //open the temp file and put the contents in SrcFile + sf = mem_alloc(SZ(SrcFile)); + sf->name = mem_strdup("generated_source.edc"); + + f = fopen(source_file, "rb"); + if (!f) + { + fprintf(stderr, "Error. unable to read the created edc source [%s]\n", + source_file); + eet_close(eetf); + return 0; + } + + fseek(f, 0, SEEK_END); + sz = ftell(f); + fseek(f, 0, SEEK_SET); + + sf->file = mem_alloc(sz + 1); + fread(sf->file, sz, 1, f); + sf->file[sz] = '\0'; + fseek(f, 0, SEEK_SET); + fclose(f); + + //create the needed list of source files (only one) + sfl = mem_alloc(SZ(SrcFile_List)); + sfl->list = NULL; + sfl->list = evas_list_append(sfl->list, sf); + + // write the sources list to the eet file + source_edd(); + bytes = eet_data_write(eetf, _srcfile_list_edd, "edje_sources", sfl, 1); + if (bytes <= 0) + { + fprintf(stderr, "Error. unable to write edc source\n"); + eet_close(eetf); + return 0; + } + + /* Clear stuff */ + unlink(source_file); + evas_stringshare_del(source_file); eet_close(eetf); printf("*********** Saving DONE ******************\n"); return 1; |
From: Enlightenment S. <no-...@en...> - 2008-10-09 00:05:57
|
Log: * update TODO Author: davemds Date: 2008-10-08 17:05:54 -0700 (Wed, 08 Oct 2008) New Revision: 36539 Modified: trunk/edje/src/lib/edje_edit.c Modified: trunk/edje/src/lib/edje_edit.c =================================================================== --- trunk/edje/src/lib/edje_edit.c 2008-10-09 00:05:18 UTC (rev 36538) +++ trunk/edje/src/lib/edje_edit.c 2008-10-09 00:05:54 UTC (rev 36539) @@ -6,7 +6,6 @@ * TODO * ----------------------------------------------------------------- * Modify edje so that also ebryo source is included in the eet file - * Write decompile info (print source) back to edje file * Remove images/fonts * Draggies * |
From: Enlightenment S. <no-...@en...> - 2008-10-09 14:38:29
|
Log: * Support dragable parts Author: davemds Date: 2008-10-09 07:38:22 -0700 (Thu, 09 Oct 2008) New Revision: 36550 Modified: trunk/edje/src/lib/Edje_Edit.h trunk/edje/src/lib/edje_edit.c Modified: trunk/edje/src/lib/Edje_Edit.h =================================================================== --- trunk/edje/src/lib/Edje_Edit.h 2008-10-09 13:33:16 UTC (rev 36549) +++ trunk/edje/src/lib/Edje_Edit.h 2008-10-09 14:38:22 UTC (rev 36550) @@ -556,7 +556,126 @@ Evas_Event_Flags ignore_flags ///< event flags to be ignored ); +/**Get horizontal dragable state for part.(1, -1 or 0) */ +EAPI int ///@return 1 (or -1) if the part can be dragged horizontally +edje_edit_part_drag_x_get( + Evas_Object *obj, ///< The edje object + const char *part ///< The name of the part +); +/**Set horizontal dragable state for part.(1, -1 or 0) */ +EAPI void +edje_edit_part_drag_x_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + int drag ///< Set to 1 (or -1) if the part should be dragged horizontally +); + +/**Get vertical dragable state for part.(1, -1 or 0) */ +EAPI int ///@return 1 (or -1) if the part can be dragged vertically +edje_edit_part_drag_y_get( + Evas_Object *obj, ///< The edje object + const char *part ///< The name of the part +); + +/**Set vertical dragable state for part.(1, -1 or 0) */ +EAPI void +edje_edit_part_drag_y_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + int drag ///< Set to 1 (or -1) if the part should be dragged vertically +); + +/**Get horizontal dragable step for part.*/ +EAPI int ///@return The drag horizontal step value +edje_edit_part_drag_step_x_get( + Evas_Object *obj, ///< The edje object + const char *part ///< The name of the part +); + +/**Set horizontal dragable state for part.*/ +EAPI void +edje_edit_part_drag_step_x_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + int step ///< The step value +); + +/**Get vertical dragable step for part.*/ +EAPI int ///@return The drag vertical step value +edje_edit_part_drag_step_y_get( + Evas_Object *obj, ///< The edje object + const char *part ///< The name of the part +); + +/**Set vertical dragable state for part.*/ +EAPI void +edje_edit_part_drag_step_y_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + int step ///< The step value +); + +/**Get horizontal dragable count for part.*/ +EAPI int ///@return The drag horizontal count value +edje_edit_part_drag_count_x_get( + Evas_Object *obj, ///< The edje object + const char *part ///< The name of the part +); + +/**Set horizontal dragable count for part.*/ +EAPI void +edje_edit_part_drag_count_x_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + int count ///< The count value +); + +/**Get vertical dragable count for part.*/ +EAPI int ///@return The drag vertical count value +edje_edit_part_drag_count_y_get( + Evas_Object *obj, ///< The edje object + const char *part ///< The name of the part +); + +/**Set vertical dragable count for part.*/ +EAPI void +edje_edit_part_drag_count_y_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + int count ///< The count value +); + +/**Get the name of the part that is used as 'confine' for the given draggies.*/ +EAPI const char* +edje_edit_part_drag_confine_get( + Evas_Object *obj, ///< The edje object + const char *part ///< The name of the drag part +); + +/**Set the name of the part that is used as 'confine' for the given draggies.*/ +EAPI void +edje_edit_part_drag_confine_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the drag part + const char *confine ///< The name of the confine part, or NULL to unset confine +); + +/**Get the name of the part that is used as the receiver of the drag event.*/ +EAPI const char* +edje_edit_part_drag_event_get( + Evas_Object *obj, ///< The edje object + const char *part ///< The name of the drag part +); + +/**Set the name of the part that will recive events from the given draggies.*/ +EAPI void +edje_edit_part_drag_event_set( + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the drag part + const char *event ///< The name of the part that will receive events, or NULL to unset. +); + //@} /******************************************************************************/ /************************** STATES API ************************************/ Modified: trunk/edje/src/lib/edje_edit.c =================================================================== --- trunk/edje/src/lib/edje_edit.c 2008-10-09 13:33:16 UTC (rev 36549) +++ trunk/edje/src/lib/edje_edit.c 2008-10-09 14:38:22 UTC (rev 36550) @@ -7,7 +7,6 @@ * ----------------------------------------------------------------- * Modify edje so that also ebryo source is included in the eet file * Remove images/fonts - * Draggies * */ @@ -1748,6 +1747,163 @@ return 1; } +EAPI int +edje_edit_part_drag_x_get(Evas_Object *obj, const char *part) +{ + GET_RP_OR_RETURN(0); + //printf("Get dragX for part: %s\n", part); + return rp->part->dragable.x; +} + +EAPI void +edje_edit_part_drag_x_set(Evas_Object *obj, const char *part, int drag) +{ + GET_RP_OR_RETURN(); + printf("Set dragX for part: %s\n", part); + rp->part->dragable.x = drag; +} + +EAPI int +edje_edit_part_drag_y_get(Evas_Object *obj, const char *part) +{ + GET_RP_OR_RETURN(0); + //printf("Get dragY for part: %s\n", part); + return rp->part->dragable.y; +} + +EAPI void +edje_edit_part_drag_y_set(Evas_Object *obj, const char *part, int drag) +{ + GET_RP_OR_RETURN(); + printf("Set dragY for part: %s\n", part); + rp->part->dragable.y = drag; +} + +EAPI int +edje_edit_part_drag_step_x_get(Evas_Object *obj, const char *part) +{ + GET_RP_OR_RETURN(0); + //printf("Get dragX_STEP for part: %s\n", part); + return rp->part->dragable.step_x; +} + +EAPI void +edje_edit_part_drag_step_x_set(Evas_Object *obj, const char *part, int step) +{ + GET_RP_OR_RETURN(); + printf("Set dragX_STEP for part: %s\n", part); + rp->part->dragable.step_x = step; +} + +EAPI int +edje_edit_part_drag_step_y_get(Evas_Object *obj, const char *part) +{ + GET_RP_OR_RETURN(0); + //printf("Get dragY_STEP for part: %s\n", part); + return rp->part->dragable.step_y; +} + +EAPI void +edje_edit_part_drag_step_y_set(Evas_Object *obj, const char *part, int step) +{ + GET_RP_OR_RETURN(); + printf("Set dragY_STEP for part: %s\n", part); + rp->part->dragable.step_y = step; +} + +EAPI int +edje_edit_part_drag_count_x_get(Evas_Object *obj, const char *part) +{ + GET_RP_OR_RETURN(0); + //printf("Get dragX_COUNT for part: %s\n", part); + return rp->part->dragable.count_x; +} + +EAPI void +edje_edit_part_drag_count_x_set(Evas_Object *obj, const char *part, int count) +{ + GET_RP_OR_RETURN(); + printf("Set dragX_COUNT for part: %s\n", part); + rp->part->dragable.count_x = count; +} + +EAPI int +edje_edit_part_drag_count_y_get(Evas_Object *obj, const char *part) +{ + GET_RP_OR_RETURN(0); + //printf("Get dragY_COUNT for part: %s\n", part); + return rp->part->dragable.count_y; +} + +EAPI void +edje_edit_part_drag_count_y_set(Evas_Object *obj, const char *part, int count) +{ + GET_RP_OR_RETURN(); + printf("Set dragY_COUNT for part: %s\n", part); + rp->part->dragable.count_y = count; +} + +EAPI const char* +edje_edit_part_drag_confine_get(Evas_Object *obj, const char *part) +{ + Edje_Real_Part *confine; + //printf("******Get drag confine\n"); + GET_RP_OR_RETURN(NULL); + + if (rp->part->dragable.confine_id < 0) + return NULL; + + confine = ed->table_parts[rp->part->dragable.confine_id]; + return evas_stringshare_add(confine->part->name); +} + +EAPI void +edje_edit_part_drag_confine_set(Evas_Object *obj, const char *part, const char *confine) +{ + Edje_Real_Part *confine_part; + printf("******Set drag confine to: %s\n", confine); + GET_RP_OR_RETURN(); + + if (!confine) + { + rp->part->dragable.confine_id = -1; + return; + } + + confine_part = _edje_real_part_get(ed, confine); + rp->part->dragable.confine_id = confine_part->part->id; +} + +EAPI const char* +edje_edit_part_drag_event_get(Evas_Object *obj, const char *part) +{ + Edje_Real_Part *events; + //printf("******Get drag event part\n"); + GET_RP_OR_RETURN(NULL); + + if (rp->part->dragable.events_id < 0) + return NULL; + + events = ed->table_parts[rp->part->dragable.events_id]; + return evas_stringshare_add(events->part->name); +} + +EAPI void +edje_edit_part_drag_event_set(Evas_Object *obj, const char *part, const char *event) +{ + Edje_Real_Part *event_part; + printf("******Set drag event to: %s\n", event); + GET_RP_OR_RETURN(); + + if (!event) + { + rp->part->dragable.events_id = -1; + return; + } + + event_part = _edje_real_part_get(ed, event); + rp->part->dragable.events_id = event_part->part->id; +} /*********************/ /* PART STATES API */ /*********************/ @@ -4843,8 +4999,31 @@ } if (edje_edit_part_effect_get(obj, part)) fprintf(f, I4"effect: %s;\n", effects[edje_edit_part_effect_get(obj, part)]); - //TODO Support dragable - + + //Dragable + if (edje_edit_part_drag_x_get(obj, part) || + edje_edit_part_drag_x_get(obj, part)) + { + fprintf(f, I4"dragable {\n"); + fprintf(f, I5"x: %d %d %d;\n", edje_edit_part_drag_x_get(obj, part), + edje_edit_part_drag_step_x_get(obj, part), + edje_edit_part_drag_count_x_get(obj, part)); + fprintf(f, I5"y: %d %d %d;\n", edje_edit_part_drag_y_get(obj, part), + edje_edit_part_drag_step_y_get(obj, part), + edje_edit_part_drag_count_y_get(obj, part)); + if (str = edje_edit_part_drag_confine_get(obj, part)) + { + fprintf(f, I5"confine: \"%s\";\n", str); + edje_edit_string_free(str); + } + if (str = edje_edit_part_drag_event_get(obj, part)) + { + fprintf(f, I5"events: \"%s\";\n", str); + edje_edit_string_free(str); + } + fprintf(f, I4"}\n"); + } + //Descriptions ll = edje_edit_part_states_list_get(obj, part); for (l = ll; l; l = l->next) |
From: Enlightenment S. <no-...@en...> - 2008-10-27 04:10:37
|
Log: remove some warnings Author: davemds Date: 2008-10-26 21:10:31 -0700 (Sun, 26 Oct 2008) New Revision: 37192 Modified: trunk/edje/src/lib/edje_edit.c Modified: trunk/edje/src/lib/edje_edit.c =================================================================== --- trunk/edje/src/lib/edje_edit.c 2008-10-27 03:12:59 UTC (rev 37191) +++ trunk/edje/src/lib/edje_edit.c 2008-10-27 04:10:31 UTC (rev 37192) @@ -2908,7 +2908,7 @@ EAPI unsigned char edje_edit_state_text_fit_x_get(Evas_Object *obj, const char *part, const char *state) { - GET_PD_OR_RETURN(); + GET_PD_OR_RETURN(0); //printf("GET TEXT_FIT_VERT of state: %s \n", state); return pd->text.fit_x; } @@ -2927,7 +2927,7 @@ EAPI unsigned char edje_edit_state_text_fit_y_get(Evas_Object *obj, const char *part, const char *state) { - GET_PD_OR_RETURN(); + GET_PD_OR_RETURN(0); //printf("GET TEXT_FIT_VERT of state: %s \n", state); return pd->text.fit_y; } @@ -3401,7 +3401,7 @@ EAPI unsigned char edje_edit_state_image_border_fill_get(Evas_Object *obj, const char *part, const char *state) { - GET_PD_OR_RETURN(); + GET_PD_OR_RETURN(0); return pd->border.no_fill ? 0 : 1; } @@ -3445,13 +3445,11 @@ 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; - Eina_List *l; if (!ed->file) return 0; @@ -4564,7 +4562,7 @@ if (!ed || !name || !f) return; - if (d = _edje_edit_spectrum_entry_get(ed, name)) + if ((d = _edje_edit_spectrum_entry_get(ed, name))) { fprintf(f, I1 "spectrum {\n"); fprintf(f, I2 "name: \"%s\";\n", d->entry); @@ -4610,14 +4608,14 @@ fprintf(f, I4"name: \"%s\";\n", program); /* Signal */ - if (s = edje_edit_program_signal_get(obj, program)) + if ((s = edje_edit_program_signal_get(obj, program))) { fprintf(f, I4"signal: \"%s\";\n", s); edje_edit_string_free(s); } /* Source */ - if (s = edje_edit_program_source_get(obj, program)) + if ((s = edje_edit_program_source_get(obj, program))) { fprintf(f, I4"source: \"%s\";\n", s); edje_edit_string_free(s); @@ -4630,7 +4628,7 @@ fprintf(f, I4"action: ACTION_STOP;\n"); break; case EDJE_ACTION_TYPE_STATE_SET: - if (s = edje_edit_program_state_get(obj, program)) + if ((s = edje_edit_program_state_get(obj, program))) { fprintf(f, I4"action: STATE_SET \"%s\" %.2f;\n", s, edje_edit_program_value_get(obj, program)); @@ -4684,7 +4682,7 @@ fprintf(f, I4"in: %.5f %.5f;\n", db, db2); /* Targets */ - if (ll = edje_edit_program_targets_get(obj, program)) + if ((ll = edje_edit_program_targets_get(obj, program))) { EINA_LIST_FOREACH(ll, l, data) fprintf(f, I4"target: \"%s\";\n", data); @@ -4692,7 +4690,7 @@ } /* Afters */ - if (ll = edje_edit_program_afters_get(obj, program)) + if ((ll = edje_edit_program_afters_get(obj, program))) { EINA_LIST_FOREACH(ll, l, data) fprintf(f, I4"after: \"%s\";\n", data); @@ -4941,12 +4939,12 @@ fprintf(f, I5"y: %d %d %d;\n", edje_edit_part_drag_y_get(obj, part), edje_edit_part_drag_step_y_get(obj, part), edje_edit_part_drag_count_y_get(obj, part)); - if (str = edje_edit_part_drag_confine_get(obj, part)) + if ((str = edje_edit_part_drag_confine_get(obj, part))) { fprintf(f, I5"confine: \"%s\";\n", str); edje_edit_string_free(str); } - if (str = edje_edit_part_drag_event_get(obj, part)) + if ((str = edje_edit_part_drag_event_get(obj, part))) { fprintf(f, I5"events: \"%s\";\n", str); edje_edit_string_free(str); @@ -4993,7 +4991,7 @@ fprintf(f, I2"}\n");//parts /* Programs */ - if (ll = edje_edit_programs_list_get(obj)) + if ((ll = edje_edit_programs_list_get(obj))) { fprintf(f, I2 "programs {\n"); EINA_LIST_FOREACH(ll, l, data) @@ -5020,7 +5018,7 @@ Eina_List *l, *ll; char *entry; - GET_ED_OR_RETURN(); + GET_ED_OR_RETURN(NULL); /* Open a temp file */ //TODO this will not work on windows @@ -5033,7 +5031,7 @@ //TODO Probably we need to save the file before generation /* Images */ - if (ll = edje_edit_images_list_get(obj)) + if ((ll = edje_edit_images_list_get(obj))) { fprintf(f, I0"images {\n"); @@ -5058,7 +5056,7 @@ } /* Fonts */ - if (ll = edje_edit_fonts_list_get(obj)) + if ((ll = edje_edit_fonts_list_get(obj))) { fprintf(f, I0"fonts {\n"); @@ -5072,7 +5070,7 @@ } /* Data */ - if (ll = edje_edit_data_list_get(obj)) + if ((ll = edje_edit_data_list_get(obj))) { fprintf(f, I0 "data {\n"); @@ -5087,7 +5085,7 @@ } /* Color Classes */ - if (ll = edje_edit_color_classes_list_get(obj)) + if ((ll = edje_edit_color_classes_list_get(obj))) { fprintf(f, I0 "color_classes {\n"); EINA_LIST_FOREACH(ll, l, entry) @@ -5097,7 +5095,7 @@ } /* Spectrum */ - if (ll = edje_edit_spectrum_list_get(obj)) + if ((ll = edje_edit_spectrum_list_get(obj))) { fprintf(f, I0 "spectra {\n"); |
From: Enlightenment S. <no-...@en...> - 2008-11-02 14:10:16
|
Log: * Support text styles in edje_edit Author: davemds Date: 2008-11-02 06:10:11 -0800 (Sun, 02 Nov 2008) New Revision: 37415 Modified: trunk/edje/src/lib/Edje_Edit.h trunk/edje/src/lib/edje_edit.c Modified: trunk/edje/src/lib/Edje_Edit.h =================================================================== --- trunk/edje/src/lib/Edje_Edit.h 2008-11-02 12:40:10 UTC (rev 37414) +++ trunk/edje/src/lib/Edje_Edit.h 2008-11-02 14:10:11 UTC (rev 37415) @@ -360,7 +360,93 @@ const char *newname ///< The new name to assign ); +//@} +/******************************************************************************/ +/************************** TEXT STYLES *************************************/ +/******************************************************************************/ +/** @name Text styles API + * Functions to deal with text styles (see @ref edcref). + */ //@{ +/** Get the list of all the text styles in the given edje object. + * Use edje_edit_string_list_free() when you don't need it anymore. + */ +EAPI Eina_List * ///@return An Eina_List* of string (char *)containing all the styles name. +edje_edit_styles_list_get( + Evas_Object *obj ///< The edje object +); + +/** Create a new text style object in the given edje + * If another style with the same name exists nothing is created and FALSE is returned. + */ +EAPI unsigned char ///@return TRUE on success, FALSE if the tag can't be created +edje_edit_style_add( + Evas_Object *obj, ///< The edje object + const char *style ///< The new name for the style +); + +/** Delete the given text style and all the child tags. */ +EAPI void +edje_edit_style_del( + Evas_Object *obj, ///< The edje object + const char *style ///< The name for the style to delete +); + +/** Get the list of all the tags name in the given text style. + * Use edje_edit_string_list_free() when you don't need it anymore. + */ +EAPI Eina_List * ///@return An Eina_List* of string (char *)containing all the tags name. +edje_edit_style_tags_list_get( + Evas_Object *obj, ///< The edje object + const char *style ///< The name of the style to inspect +); + +/** Get the value of the given tag. + * Use edje_edit_string_free() when you don't need it anymore. + */ +EAPI const char* ///@return The value of the tag. +edje_edit_style_tag_value_get( + Evas_Object *obj, ///< The edje object + const char *style, ///< The name of the style to inspect + const char *tag ///< The name of the tag +); + +/** Set the value of the given tag. */ +EAPI void +edje_edit_style_tag_value_set( + Evas_Object *obj, ///< The edje object + const char *style, ///< The name of the style to inspect + const char *tag ///< The name of the tag + const char *new_value ///< The new tag value +); + +/** Set the name of the given tag. */ +EAPI void +edje_edit_style_tag_name_set( + Evas_Object *obj, ///< The edje object + const char *style, ///< The name of the style + const char *tag ///< The name of the tag + const char *new_name ///< The new name for tag +); + +/** Add a new tag to the given text style. + * If another tag with the same name exists nothing is created and FALSE is returned. + */ +EAPI unsigned char ///@return TRUE on success, FALSE if the tag can't be created +edje_edit_style_tag_add( + Evas_Object *obj, ///< The edje object + const char *style, ///< The name of the style + const char* tag_name ///< The name of the new tag +); + +/** Delete the given tag. */ +EAPI void +edje_edit_style_tag_del( + Evas_Object *obj, ///< The edje object + const char *style, ///< The name of the style + const char* tag ///< The name of the tag to remove +); + //@} /******************************************************************************/ /************************** PARTS API *************************************/ Modified: trunk/edje/src/lib/edje_edit.c =================================================================== --- trunk/edje/src/lib/edje_edit.c 2008-11-02 12:40:10 UTC (rev 37414) +++ trunk/edje/src/lib/edje_edit.c 2008-11-02 14:10:11 UTC (rev 37415) @@ -577,6 +577,41 @@ return NULL; } +static Edje_Style * +_edje_edit_style_get(Edje *ed, const char *name) +{ + Eina_List *l; + Edje_Style *s; + + if (!ed || !ed->file || !ed->file->styles || !name) + return NULL; + + EINA_LIST_FOREACH(ed->file->styles, l, s) + if (s->name && !strcmp(s->name, name)) + return s; + + return NULL; +} + +static Edje_Style_Tag * +_edje_edit_style_tag_get(Edje *ed, const char *style, const char *name) +{ + Eina_List *l; + Edje_Style *s; + Edje_Style_Tag *t; + + if (!ed || !ed->file || !ed->file->styles || !name) + return NULL; + + s = _edje_edit_style_get(ed, style); + + EINA_LIST_FOREACH(s->tags, l, t) + if (t->key && !strcmp(t->key, name)) + return t; + + return NULL; +} + /*****************/ /* GENERAL API */ /*****************/ @@ -1178,6 +1213,203 @@ } + +/*********************/ +/* TEXT STYLES API */ +/*********************/ + +EAPI Eina_List * +edje_edit_styles_list_get(Evas_Object * obj) +{ + Eina_List *styles = NULL; + Eina_List *l; + Edje_Style *s; + + GET_ED_OR_RETURN(NULL); + + if (!ed->file || !ed->file->styles) + return NULL; + printf("GET STYLES LIST %d\n", eina_list_count(ed->file->styles)); + EINA_LIST_FOREACH(ed->file->styles, l, s) + styles = eina_list_append(styles, eina_stringshare_add(s->name)); + + return styles; +} + +EAPI unsigned char +edje_edit_style_add(Evas_Object * obj, const char* style) +{ + Edje_Style *s; + GET_ED_OR_RETURN(0); + printf("ADD STYLE '%s'\n", style); + + s = _edje_edit_style_get(ed, style); + if (s) return 0; + + s = mem_alloc(sizeof(Edje_Style)); + if (!s) return 0; + s->name = (char*)eina_stringshare_add(style); + s->tags = NULL; + s->style = NULL; + + ed->file->styles = eina_list_append(ed->file->styles, s); + return 1; +} + +EAPI void +edje_edit_style_del(Evas_Object * obj, const char* style) +{ + Edje_Style *s; + + GET_ED_OR_RETURN(); + printf("DEL STYLE '%s'\n", style); + + s = _edje_edit_style_get(ed, style); + if (!s) return; + + ed->file->styles = eina_list_remove(ed->file->styles, s); + + _edje_if_string_free(ed, s->name); + //~ //s->style HOWTO FREE ??? + while (s->tags) + { + Edje_Style_Tag *t; + + t = s->tags->data; + + s->tags = eina_list_remove(s->tags, t); + _edje_if_string_free(ed, t->key); + _edje_if_string_free(ed, t->value); + _edje_if_string_free(ed, t->font); + _edje_if_string_free(ed, t->text_class); + free(t); + t = NULL; + } + free(s); + s = NULL; + s = NULL; +} + + +EAPI Eina_List * +edje_edit_style_tags_list_get(Evas_Object * obj, const char* style) +{ + Eina_List *tags = NULL; + Eina_List *l, *ll; + Edje_Style *s; + Edje_Style_Tag *t; + + GET_ED_OR_RETURN(NULL); + if (!ed->file || !ed->file->styles || !style) + return NULL; + + s = _edje_edit_style_get(ed, style); + + printf("GET STYLE TAG LIST %d\n", eina_list_count(s->tags)); + EINA_LIST_FOREACH(s->tags, ll, t) + tags = eina_list_append(tags, eina_stringshare_add(t->key)); + + return tags; +} + +EAPI void +edje_edit_style_tag_name_set(Evas_Object * obj, const char* style, const char* tag, const char*new_name) +{ + Edje_Style_Tag *t; + + GET_ED_OR_RETURN(); + printf("SET TAG NAME for '%s' FOR STYLE '%s'\n", tag, style); + + if (!ed->file || !ed->file->styles || !style || !tag) + return; + + t = _edje_edit_style_tag_get(ed, style, tag); + if (!t) return; + _edje_if_string_free(ed, t->key); + t->key = eina_stringshare_add(new_name); +} + +EAPI const char* +edje_edit_style_tag_value_get(Evas_Object * obj, const char* style, const char* tag) +{ + Edje_Style_Tag *t; + + GET_ED_OR_RETURN(NULL); + printf("GET TAG '%s' FOR STYLE '%s'\n", tag, style); + + if (!ed->file || !ed->file->styles || !style || !tag) + return NULL; + + t = _edje_edit_style_tag_get(ed, style, tag); + if (t && t->value) + return eina_stringshare_add(t->value); + + return NULL; +} + +EAPI void +edje_edit_style_tag_value_set(Evas_Object * obj, const char* style, const char* tag, const char*new_value) +{ + Edje_Style_Tag *t; + + GET_ED_OR_RETURN(); + printf("SET TAG VALUE for '%s' FOR STYLE '%s'\n", tag, style); + + if (!ed->file || !ed->file->styles || !style || !tag) + return; + + t = _edje_edit_style_tag_get(ed, style, tag); + if (!t) return; + _edje_if_string_free(ed, t->value); + t->value = eina_stringshare_add(new_value); +} + +EAPI unsigned char +edje_edit_style_tag_add(Evas_Object * obj, const char* style, const char* tag_name) +{ + Edje_Style *s; + Edje_Style_Tag *t; + + GET_ED_OR_RETURN(0); + printf("ADD TAG '%s' IN STYLE '%s'\n", tag_name, style); + + t = _edje_edit_style_tag_get(ed, style, tag_name); + if (t) return 0; + s = _edje_edit_style_get(ed, style); + if (!s) return 0; + + t = mem_alloc(sizeof(Edje_Style_Tag)); + if (!t) return 0; + t->key = eina_stringshare_add(tag_name); + t->value = NULL; + t->font = NULL; + t->text_class = NULL; + + s->tags = eina_list_append(s->tags, t); + return 1; +} + +EAPI void +edje_edit_style_tag_del(Evas_Object * obj, const char* style, const char* tag) +{ + Edje_Style *s; + Edje_Style_Tag *t; + + GET_ED_OR_RETURN(); + printf("DEL TAG '%s' IN STYLE '%s'\n", tag, style); + + s = _edje_edit_style_get(ed, style); + t = _edje_edit_style_tag_get(ed, style, tag); + + s->tags = eina_list_remove(s->tags, t); + _edje_if_string_free(ed, t->key); + _edje_if_string_free(ed, t->value); + _edje_if_string_free(ed, t->font); + _edje_if_string_free(ed, t->text_class); + free(t); + t = NULL; +} + /***************/ /* PARTS API */ /***************/ @@ -4564,8 +4796,7 @@ if ((d = _edje_edit_spectrum_entry_get(ed, name))) { - fprintf(f, I1 "spectrum {\n"); - fprintf(f, I2 "name: \"%s\";\n", d->entry); + fprintf(f, I1 "spectrum { name: \"%s\";\n", d->entry); EINA_LIST_FOREACH(d->color_list, l, color) if (color) @@ -4585,8 +4816,7 @@ EINA_LIST_FOREACH(ed->file->color_classes, l, cc) if (!strcmp(cc->name, name)) { - fprintf(f, I1 "color_class {\n"); - fprintf(f, I2 "name: \"%s\";\n", cc->name); + fprintf(f, I1 "color_class { name: \"%s\";\n", cc->name); fprintf(f, I2 "color: %d %d %d %d;\n", cc->r, cc->g, cc->b, cc->a); fprintf(f, I2 "color2: %d %d %d %d;\n", cc->r2, cc->g2, cc->b2, cc->a2); fprintf(f, I2 "color3: %d %d %d %d;\n", cc->r3, cc->g3, cc->b3, cc->a3); @@ -4594,6 +4824,27 @@ } } + static void +_edje_generate_source_of_style(Edje * ed, const char *name, FILE * f) +{ + Eina_List *l, *ll; + Edje_Style *s; + Edje_Style_Tag *t; + + EINA_LIST_FOREACH(ed->file->styles, l, s) + if (!strcmp(s->name, name)) + { + t = s->tags ? s->tags->data : NULL; + fprintf(f, I1 "style { name:\"%s\";\n", s->name); + if (t && t->value) fprintf(f, I2 "base: \"%s\";\n", t->value); + EINA_LIST_FOREACH(s->tags, ll, t) + if (ll->prev && t && t->value) + fprintf(f, I2 "tag: \"%s\" \"%s\";\n", t->key, t->value); //TODO need some sort of escaping (at least for '\n') + fprintf(f, I1 "}\n"); + return; + } +} + static void _edje_generate_source_of_program(Evas_Object *obj, const char *program, FILE *f) { @@ -4604,8 +4855,7 @@ GET_ED_OR_RETURN(); - fprintf(f, I3"program {\n"); - fprintf(f, I4"name: \"%s\";\n", program); + fprintf(f, I3"program { name: \"%s\";\n", program); /* Signal */ if ((s = edje_edit_program_signal_get(obj, program))) @@ -4715,9 +4965,8 @@ rp = _edje_real_part_get(ed, part); if (!rp) return; - fprintf(f, I4"description {\n"); + fprintf(f, I4"description { state: \"%s\" %g;\n", pd->state.name, pd->state.value); //TODO Support inherit - fprintf(f, I5"state: \"%s\" %g;\n", pd->state.name, pd->state.value); if (!pd->visible) fprintf(f, I5"visible: 0;\n"); @@ -4903,8 +5152,7 @@ Eina_List *l, *ll; char *data; - fprintf(f, I3"part {\n"); - fprintf(f, I4"name: \"%s\";\n", part); + fprintf(f, I3"part { name: \"%s\";\n", part); fprintf(f, I4"type: %s;\n", types[edje_edit_part_type_get(obj, part)]); if (!edje_edit_part_mouse_events_get(obj, part)) fprintf(f, I4"mouse_events: 0;\n"); @@ -4972,8 +5220,7 @@ obj = edje_object_add(ed->evas); if (!edje_object_file_set(obj, ed->file->path, group)) return; - fprintf(f, I1"group {\n"); - fprintf(f, I2"name: \"%s\";\n", group); + fprintf(f, I1"group { name: \"%s\";\n", group); //TODO Support alias: if ((w = edje_edit_group_min_w_get(obj)) || (h = edje_edit_group_min_h_get(obj))) fprintf(f, I2"min: %d %d;\n", w, h); @@ -5107,7 +5354,14 @@ } /* Styles */ - //TODO Support styles + if ((ll = edje_edit_styles_list_get(obj))) + { + fprintf(f, I0 "styles {\n"); + EINA_LIST_FOREACH(ll, l, entry) + _edje_generate_source_of_style(ed, entry, f); + fprintf(f, I0 "}\n\n"); + edje_edit_string_list_free(ll); + } /* Collections */ fprintf(f, "collections {\n"); |
From: Enlightenment S. <no-...@en...> - 2008-11-02 15:02:44
|
Log: * Arghh! Fix compilation... sorry Author: davemds Date: 2008-11-02 07:02:40 -0800 (Sun, 02 Nov 2008) New Revision: 37417 Modified: trunk/edje/src/lib/Edje_Edit.h Modified: trunk/edje/src/lib/Edje_Edit.h =================================================================== --- trunk/edje/src/lib/Edje_Edit.h 2008-11-02 14:22:17 UTC (rev 37416) +++ trunk/edje/src/lib/Edje_Edit.h 2008-11-02 15:02:40 UTC (rev 37417) @@ -416,7 +416,7 @@ edje_edit_style_tag_value_set( Evas_Object *obj, ///< The edje object const char *style, ///< The name of the style to inspect - const char *tag ///< The name of the tag + const char *tag, ///< The name of the tag const char *new_value ///< The new tag value ); @@ -425,7 +425,7 @@ edje_edit_style_tag_name_set( Evas_Object *obj, ///< The edje object const char *style, ///< The name of the style - const char *tag ///< The name of the tag + const char *tag, ///< The name of the tag const char *new_name ///< The new name for tag ); |
From: Enlightenment S. <no-...@en...> - 2008-11-27 09:43:02
|
Log: * typo Author: davemds Date: 2008-11-27 01:43:00 -0800 (Thu, 27 Nov 2008) New Revision: 37822 Modified: trunk/edje/src/lib/edje_embryo.c Modified: trunk/edje/src/lib/edje_embryo.c =================================================================== --- trunk/edje/src/lib/edje_embryo.c 2008-11-27 06:20:50 UTC (rev 37821) +++ trunk/edje/src/lib/edje_embryo.c 2008-11-27 09:43:00 UTC (rev 37822) @@ -1290,7 +1290,7 @@ return(0); } -/* send_message(id, Msg_Type:type, ...); */ +/* send_message(Msg_Type:type, id,...); */ static Embryo_Cell _edje_embryo_fn_send_message(Embryo_Program *ep, Embryo_Cell *params) { |
From: Enlightenment S. <no-...@en...> - 2009-08-17 13:54:32
|
Log: * rename mem_strdup() to not clash (in the case of a static build) with the one defined in bin/ Author: davemds Date: 2009-08-17 06:54:17 -0700 (Mon, 17 Aug 2009) New Revision: 41839 Modified: trunk/edje/src/lib/edje_edit.c Modified: trunk/edje/src/lib/edje_edit.c =================================================================== --- trunk/edje/src/lib/edje_edit.c 2009-08-17 11:32:56 UTC (rev 41838) +++ trunk/edje/src/lib/edje_edit.c 2009-08-17 13:54:17 UTC (rev 41839) @@ -56,29 +56,27 @@ epr = _edje_program_get_byname(obj, prog); \ if (!epr) return RET; -void * -mem_alloc(size_t size) +static void * +_alloc(size_t size) { void *mem; mem = calloc(1, size); if (mem) return mem; fprintf(stderr, "Edje_Edit: Error. memory allocation of %i bytes failed. %s\n", - size, strerror(errno)); - exit(-1); + (int)size, strerror(errno)); return NULL; } -char * -mem_strdup(const char *s) +static char * +_strdup(const char *s) { void *str; str = strdup(s); if (str) return str; fprintf(stderr, "Edje_Edit: Error. memory allocation of %i bytes failed. %s." - "string being duplicated: \"%s\"\n", strlen(s) + 1, strerror(errno), s); - exit(-1); + "string being duplicated: \"%s\"\n", (int)strlen(s) + 1, strerror(errno), s); return NULL; } @@ -661,10 +659,10 @@ return 0; /* Create structs */ - de = mem_alloc(SZ(Edje_Part_Collection_Directory_Entry)); + de = _alloc(SZ(Edje_Part_Collection_Directory_Entry)); if (!de) return 0; - pc = mem_alloc(SZ(Edje_Part_Collection)); + pc = _alloc(SZ(Edje_Part_Collection)); if (!pc) { free(de); @@ -696,7 +694,7 @@ /* Init Edje_Part_Collection_Directory_Entry */ printf(" new id: %d\n", id); de->id = id; - de->entry = mem_strdup(name); + de->entry = _strdup(name); ed->file->collection_dir->entries = eina_list_append(ed->file->collection_dir->entries, de); /* Init Edje_Part_Collection */ @@ -708,7 +706,7 @@ pc->script = NULL; pc->part = eina_stringshare_add(name); - //cd = mem_alloc(SZ(Code)); + //cd = _alloc(SZ(Code)); //codes = eina_list_append(codes, cd); if (!ed->file->collection_hash) @@ -949,7 +947,7 @@ if (strcmp(dd->key, itemname) == 0) return 0; - d = mem_alloc(sizeof(Edje_Data)); + d = _alloc(sizeof(Edje_Data)); if (!d) return 0; d->key = (char*)eina_stringshare_add(itemname); @@ -1154,7 +1152,7 @@ if (strcmp(cc->name, name) == 0) return 0; - c = mem_alloc(sizeof(Edje_Color_Class)); + c = _alloc(sizeof(Edje_Color_Class)); if (!c) return 0; c->name = (char*)eina_stringshare_add(name); @@ -1245,7 +1243,7 @@ s = _edje_edit_style_get(ed, style); if (s) return 0; - s = mem_alloc(sizeof(Edje_Style)); + s = _alloc(sizeof(Edje_Style)); if (!s) return 0; s->name = (char*)eina_stringshare_add(style); s->tags = NULL; @@ -1377,7 +1375,7 @@ s = _edje_edit_style_get(ed, style); if (!s) return 0; - t = mem_alloc(sizeof(Edje_Style_Tag)); + t = _alloc(sizeof(Edje_Style_Tag)); if (!t) return 0; t->key = eina_stringshare_add(tag_name); t->value = NULL; @@ -1467,11 +1465,11 @@ return FALSE; /* Alloc Edje_Part or return */ - ep = mem_alloc(sizeof(Edje_Part)); + ep = _alloc(sizeof(Edje_Part)); if (!ep) return FALSE; /* Alloc Edje_Real_Part or return */ - rp = mem_alloc(sizeof(Edje_Real_Part)); + rp = _alloc(sizeof(Edje_Real_Part)); if (!rp) { free(ep); @@ -1956,7 +1954,7 @@ if (rp->drag) return; - rp->drag = mem_alloc(sizeof (Edje_Real_Part_Drag)); + rp->drag = _alloc(sizeof (Edje_Real_Part_Drag)); if (!rp->drag) return; rp->drag->step.x = rp->part->dragable.step_x; @@ -1987,7 +1985,7 @@ if (rp->drag) return; - rp->drag = mem_alloc(sizeof (Edje_Real_Part_Drag)); + rp->drag = _alloc(sizeof (Edje_Real_Part_Drag)); if (!rp->drag) return; rp->drag->step.x = rp->part->dragable.step_x; @@ -2238,7 +2236,8 @@ printf("ADD STATE: %s TO PART: %s\n", name , part); - pd = mem_alloc(sizeof(Edje_Part_Description)); + pd = _alloc(sizeof(Edje_Part_Description)); + if (!pd) return; if (!rp->part->default_desc) rp->part->default_desc = pd; @@ -3257,17 +3256,20 @@ /* Create Font_Directory if not exist */ if (!ed->file->font_dir) - ed->file->font_dir = mem_alloc(sizeof(Edje_Font_Directory)); + { + ed->file->font_dir = _alloc(sizeof(Edje_Font_Directory)); + if (!ed->file->font_dir) return 0; + } /* Create Font */ - fn = mem_alloc(sizeof(Font)); + fn = _alloc(sizeof(Font)); if (!fn) return 0; if ((name = strrchr(path, '/'))) name ++; else name = (char *)path; - fn->file = mem_strdup(name); - fn->name = mem_strdup(name); + fn->file = _strdup(name); + fn->name = _strdup(name); /*{ Eina_List *l; @@ -3339,9 +3341,10 @@ /* Create Edje_Font_Directory_Entry */ if (ed->file->font_dir) { - fnt = mem_alloc(sizeof(Edje_Font_Directory_Entry)); - fnt->entry = mem_strdup(fn->name); - fnt->path = mem_strdup(buf); + fnt = _alloc(sizeof(Edje_Font_Directory_Entry)); + if (!fnt) return 0; + fnt->entry = _strdup(fn->name); + fnt->path = _strdup(buf); ed->file->font_dir->entries = eina_list_append(ed->file->font_dir->entries, fnt); if (!ed->file->font_hash) @@ -3440,7 +3443,10 @@ /* Create Image_Directory if not exist */ if (!ed->file->image_dir) - ed->file->image_dir = mem_alloc(sizeof(Edje_Image_Directory)); + { + ed->file->image_dir = _alloc(sizeof(Edje_Image_Directory)); + if (!ed->file->image_dir) return 0; + } /* Loop trough image directory to find if image exist */ printf("Add Image '%s' (total %d)\n", path, @@ -3458,10 +3464,11 @@ return 0; /* Create Image Entry */ - de = mem_alloc(sizeof(Edje_Image_Directory_Entry)); + de = _alloc(sizeof(Edje_Image_Directory_Entry)); + if (!de) return 0; if ((name = strrchr(path, '/'))) name++; else name = (char *)path; - de->entry = mem_strdup(name); + de->entry = _strdup(name); de->id = free_id; de->source_type = 1; de->source_param = 1; @@ -3489,7 +3496,10 @@ /* Create Image_Directory if not exist */ if (!ed->file->image_dir) - ed->file->image_dir = mem_alloc(sizeof(Edje_Image_Directory)); + { + ed->file->image_dir = _alloc(sizeof(Edje_Image_Directory)); + if (!ed->file->image_dir) return 0; + } /* Loop trough image directory to find if image exist */ t = NULL; @@ -3501,13 +3511,16 @@ /* Create Image Entry */ if (!t) - de = mem_alloc(sizeof(Edje_Image_Directory_Entry)); + { + de = _alloc(sizeof(Edje_Image_Directory_Entry)); + if (!de) return 0; + } else { de = t; free(de->entry); } - de->entry = mem_strdup(name); + de->entry = _strdup(name); de->id = id; de->source_type = 1; de->source_param = 1; @@ -3650,7 +3663,7 @@ if (id < 0) return 0; /* alloc Edje_Part_Image_Id */ - i = mem_alloc(SZ(Edje_Part_Image_Id)); + i = _alloc(SZ(Edje_Part_Image_Id)); if (!i) return 0; i->id = id; @@ -3776,9 +3789,13 @@ 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)); + { + ed->file->spectrum_dir = _alloc(SZ(Edje_Spectrum_Directory)); + if (!ed->file->spectrum_dir) return 0; + } - s = mem_alloc(SZ(Edje_Spectrum_Directory_Entry)); + s = _alloc(SZ(Edje_Spectrum_Directory_Entry)); + if (!s) return 0; ed->file->spectrum_dir->entries = eina_list_append(ed->file->spectrum_dir->entries, s); s->id = eina_list_count(ed->file->spectrum_dir->entries) - 1; //TODO Search for id holes s->entry = (char*)eina_stringshare_add(name); @@ -3873,7 +3890,8 @@ //... and recreate (TODO we should optimize this function) while (num) { - color = mem_alloc(SZ(Edje_Spectrum_Color)); + color = _alloc(SZ(Edje_Spectrum_Color)); + if (!color) return 0; s->color_list = eina_list_append(s->color_list, color); color->r = 255; color->g = 255; @@ -4239,7 +4257,7 @@ return 0; //Alloc Edje_Program or return - epr = mem_alloc(SZ(Edje_Program)); + epr = _alloc(SZ(Edje_Program)); if (!epr) return 0; //Add program to group @@ -4766,7 +4784,7 @@ else return 0; - t = mem_alloc(SZ(Edje_Program_Target)); + t = _alloc(SZ(Edje_Program_Target)); if (!t) return 0; t->id = id; @@ -4827,7 +4845,7 @@ af = _edje_program_get_byname(obj, after); if (!af) return 0; - a = mem_alloc(SZ(Edje_Program_After)); + a = _alloc(SZ(Edje_Program_After)); if (!a) return 0; a->id = af->id; @@ -5576,8 +5594,9 @@ printf("** Writing EDC Source [from: %s]\n", source_file); //open the temp file and put the contents in SrcFile - sf = mem_alloc(SZ(SrcFile)); - sf->name = mem_strdup("generated_source.edc"); + sf = _alloc(SZ(SrcFile)); + if (!sf) return 0; + sf->name = _strdup("generated_source.edc"); f = fopen(source_file, "rb"); if (!f) @@ -5592,14 +5611,14 @@ sz = ftell(f); fseek(f, 0, SEEK_SET); - sf->file = mem_alloc(sz + 1); + sf->file = _alloc(sz + 1); //TODO check result and return nicely fread(sf->file, sz, 1, f); sf->file[sz] = '\0'; fseek(f, 0, SEEK_SET); fclose(f); //create the needed list of source files (only one) - sfl = mem_alloc(SZ(SrcFile_List)); + sfl = _alloc(SZ(SrcFile_List)); //TODO check result and return nicely sfl->list = NULL; sfl->list = eina_list_append(sfl->list, sf); |
From: Enlightenment S. <no-...@en...> - 2009-08-17 14:13:38
|
Log: * Do not use SZ() macro from edje_cc.h Author: davemds Date: 2009-08-17 07:13:26 -0700 (Mon, 17 Aug 2009) New Revision: 41841 Modified: trunk/edje/src/lib/edje_edit.c Modified: trunk/edje/src/lib/edje_edit.c =================================================================== --- trunk/edje/src/lib/edje_edit.c 2009-08-17 14:00:44 UTC (rev 41840) +++ trunk/edje/src/lib/edje_edit.c 2009-08-17 14:13:26 UTC (rev 41841) @@ -518,7 +518,7 @@ count = eina_list_count(ed->collection->parts); if (count != ed->table_parts_size) { - ed->table_parts = realloc(ed->table_parts, SZ(Edje_Real_Part *) * count); + ed->table_parts = realloc(ed->table_parts, sizeof(Edje_Real_Part *) * count); ed->table_parts_size = count; } @@ -659,10 +659,10 @@ return 0; /* Create structs */ - de = _alloc(SZ(Edje_Part_Collection_Directory_Entry)); + de = _alloc(sizeof(Edje_Part_Collection_Directory_Entry)); if (!de) return 0; - pc = _alloc(SZ(Edje_Part_Collection)); + pc = _alloc(sizeof(Edje_Part_Collection)); if (!pc) { free(de); @@ -706,7 +706,7 @@ pc->script = NULL; pc->part = eina_stringshare_add(name); - //cd = _alloc(SZ(Code)); + //cd = _alloc(sizeof(Code)); //codes = eina_list_append(codes, cd); if (!ed->file->collection_hash) @@ -744,7 +744,7 @@ "for writing output\n", ed->file->path); return 0; } - snprintf(buf, SZ(buf), "collections/%d", g->id); + snprintf(buf, sizeof(buf), "collections/%d", g->id); eet_delete(eetf, buf); eet_close(eetf); @@ -3663,7 +3663,7 @@ if (id < 0) return 0; /* alloc Edje_Part_Image_Id */ - i = _alloc(SZ(Edje_Part_Image_Id)); + i = _alloc(sizeof(Edje_Part_Image_Id)); if (!i) return 0; i->id = id; @@ -3790,11 +3790,11 @@ if (!ed->file->spectrum_dir) { - ed->file->spectrum_dir = _alloc(SZ(Edje_Spectrum_Directory)); + ed->file->spectrum_dir = _alloc(sizeof(Edje_Spectrum_Directory)); if (!ed->file->spectrum_dir) return 0; } - s = _alloc(SZ(Edje_Spectrum_Directory_Entry)); + s = _alloc(sizeof(Edje_Spectrum_Directory_Entry)); if (!s) return 0; ed->file->spectrum_dir->entries = eina_list_append(ed->file->spectrum_dir->entries, s); s->id = eina_list_count(ed->file->spectrum_dir->entries) - 1; //TODO Search for id holes @@ -3890,7 +3890,7 @@ //... and recreate (TODO we should optimize this function) while (num) { - color = _alloc(SZ(Edje_Spectrum_Color)); + color = _alloc(sizeof(Edje_Spectrum_Color)); if (!color) return 0; s->color_list = eina_list_append(s->color_list, color); color->r = 255; @@ -4257,7 +4257,7 @@ return 0; //Alloc Edje_Program or return - epr = _alloc(SZ(Edje_Program)); + epr = _alloc(sizeof(Edje_Program)); if (!epr) return 0; //Add program to group @@ -4784,7 +4784,7 @@ else return 0; - t = _alloc(SZ(Edje_Program_Target)); + t = _alloc(sizeof(Edje_Program_Target)); if (!t) return 0; t->id = id; @@ -4845,7 +4845,7 @@ af = _edje_program_get_byname(obj, after); if (!af) return 0; - a = _alloc(SZ(Edje_Program_After)); + a = _alloc(sizeof(Edje_Program_After)); if (!a) return 0; a->id = af->id; @@ -5594,7 +5594,7 @@ printf("** Writing EDC Source [from: %s]\n", source_file); //open the temp file and put the contents in SrcFile - sf = _alloc(SZ(SrcFile)); + sf = _alloc(sizeof(SrcFile)); if (!sf) return 0; sf->name = _strdup("generated_source.edc"); @@ -5618,7 +5618,7 @@ fclose(f); //create the needed list of source files (only one) - sfl = _alloc(SZ(SrcFile_List)); //TODO check result and return nicely + sfl = _alloc(sizeof(SrcFile_List)); //TODO check result and return nicely sfl->list = NULL; sfl->list = eina_list_append(sfl->list, sf); |
From: Enlightenment S. <no-...@en...> - 2009-08-17 14:26:43
|
Log: * Do not use the 'Font' struct from edje_cc.h Author: davemds Date: 2009-08-17 07:26:31 -0700 (Mon, 17 Aug 2009) New Revision: 41842 Modified: trunk/edje/src/lib/edje_edit.c Modified: trunk/edje/src/lib/edje_edit.c =================================================================== --- trunk/edje/src/lib/edje_edit.c 2009-08-17 14:13:26 UTC (rev 41841) +++ trunk/edje/src/lib/edje_edit.c 2009-08-17 14:26:31 UTC (rev 41842) @@ -3235,7 +3235,6 @@ edje_edit_font_add(Evas_Object *obj, const char* path) { char buf[PATH_MAX]; - Font *fn; Edje_Font_Directory_Entry *fnt; Eet_File *eetf; struct stat st; @@ -3261,33 +3260,9 @@ if (!ed->file->font_dir) return 0; } - /* Create Font */ - fn = _alloc(sizeof(Font)); - if (!fn) return 0; - if ((name = strrchr(path, '/'))) name ++; else name = (char *)path; - fn->file = _strdup(name); - fn->name = _strdup(name); - - /*{ - Eina_List *l; - Font *lfn; - - EINA_LIST_FOREACH(fonts, l, lfn) - { - if (!strcmp(lfn->name, fn->name)) - { - free(fn->file); - free(fn->name); - free(fn); - return; - } - } - } - */ - /* Read font data from file */ f = fopen(path, "rb"); if (f) @@ -3311,7 +3286,7 @@ fclose(f); } /* Write font to edje file */ - snprintf(buf, sizeof(buf), "fonts/%s", fn->name); + snprintf(buf, sizeof(buf), "fonts/%s", name); if (fdata) { @@ -3343,7 +3318,7 @@ { fnt = _alloc(sizeof(Edje_Font_Directory_Entry)); if (!fnt) return 0; - fnt->entry = _strdup(fn->name); + fnt->entry = _strdup(name); fnt->path = _strdup(buf); ed->file->font_dir->entries = eina_list_append(ed->file->font_dir->entries, fnt); |
From: Enlightenment S. <no-...@en...> - 2009-08-17 14:49:39
|
Log: * Do not include edje_cc.h anymore :) Author: davemds Date: 2009-08-17 07:49:26 -0700 (Mon, 17 Aug 2009) New Revision: 41843 Modified: trunk/edje/src/lib/edje_edit.c Modified: trunk/edje/src/lib/edje_edit.c =================================================================== --- trunk/edje/src/lib/edje_edit.c 2009-08-17 14:26:31 UTC (rev 41842) +++ trunk/edje/src/lib/edje_edit.c 2009-08-17 14:49:26 UTC (rev 41843) @@ -5,8 +5,9 @@ /* * TODO * ----------------------------------------------------------------- - * Modify edje so that also ebryo source is included in the eet file + * Add LUA Support :) * Remove images/fonts + * Clean the saving routines * */ @@ -19,13 +20,14 @@ #include <unistd.h> #include <sys/stat.h> #include <errno.h> + #ifdef HAVE_LOCALE_H # include <locale.h> #endif #include "edje_private.h" -#include "edje_cc.h" + /* Get ed(Edje*) from obj(Evas_Object*) */ #define GET_ED_OR_RETURN(RET) \ Edje *ed; \ @@ -538,7 +540,7 @@ str = NULL; } -Edje_Spectrum_Directory_Entry * +static Edje_Spectrum_Directory_Entry * _edje_edit_spectrum_entry_get(Edje *ed, const char* spectra) { Edje_Spectrum_Directory_Entry *s; @@ -554,7 +556,7 @@ return NULL; } -Edje_Spectrum_Directory_Entry * +static Edje_Spectrum_Directory_Entry * _edje_edit_spectrum_entry_get_by_id(Edje *ed, int spectra_id) { Edje_Spectrum_Directory_Entry *s; @@ -3749,7 +3751,6 @@ return spectrum; } - EAPI unsigned char edje_edit_spectra_add(Evas_Object *obj, const char* name) { @@ -5033,7 +5034,6 @@ fprintf(f, I3 "}\n"); } - static void _edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *state, FILE *f) { @@ -5471,6 +5471,20 @@ /* SAVING ROUTINES */ /*********************/ //////////////////////////////////////// +typedef struct _SrcFile SrcFile; +typedef struct _SrcFile_List SrcFile_List; + +struct _SrcFile +{ + char *name; + char *file; +}; + +struct _SrcFile_List +{ + Eina_List *list; +}; + static Eet_Data_Descriptor *_srcfile_edd = NULL; static Eet_Data_Descriptor *_srcfile_list_edd = NULL; |
From: Enlightenment S. <no-...@en...> - 2009-08-17 21:28:53
|
Log: * Remove _strdup(). Useless unless we don't check the return value Author: davemds Date: 2009-08-17 14:28:40 -0700 (Mon, 17 Aug 2009) New Revision: 41850 Modified: trunk/edje/src/lib/edje_edit.c Modified: trunk/edje/src/lib/edje_edit.c =================================================================== --- trunk/edje/src/lib/edje_edit.c 2009-08-17 18:35:56 UTC (rev 41849) +++ trunk/edje/src/lib/edje_edit.c 2009-08-17 21:28:40 UTC (rev 41850) @@ -70,19 +70,6 @@ return NULL; } -static char * -_strdup(const char *s) -{ - void *str; - - str = strdup(s); - if (str) return str; - fprintf(stderr, "Edje_Edit: Error. memory allocation of %i bytes failed. %s." - "string being duplicated: \"%s\"\n", (int)strlen(s) + 1, strerror(errno), s); - return NULL; -} - - /*************/ /* INTERNALS */ /*************/ @@ -696,7 +683,7 @@ /* Init Edje_Part_Collection_Directory_Entry */ printf(" new id: %d\n", id); de->id = id; - de->entry = _strdup(name); + de->entry = strdup(name); ed->file->collection_dir->entries = eina_list_append(ed->file->collection_dir->entries, de); /* Init Edje_Part_Collection */ @@ -3320,8 +3307,8 @@ { fnt = _alloc(sizeof(Edje_Font_Directory_Entry)); if (!fnt) return 0; - fnt->entry = _strdup(name); - fnt->path = _strdup(buf); + fnt->entry = strdup(name); + fnt->path = strdup(buf); ed->file->font_dir->entries = eina_list_append(ed->file->font_dir->entries, fnt); if (!ed->file->font_hash) @@ -3445,7 +3432,7 @@ if (!de) return 0; if ((name = strrchr(path, '/'))) name++; else name = (char *)path; - de->entry = _strdup(name); + de->entry = strdup(name); de->id = free_id; de->source_type = 1; de->source_param = 1; @@ -3497,7 +3484,7 @@ de = t; free(de->entry); } - de->entry = _strdup(name); + de->entry = strdup(name); de->id = id; de->source_type = 1; de->source_param = 1; @@ -5585,7 +5572,7 @@ //open the temp file and put the contents in SrcFile sf = _alloc(sizeof(SrcFile)); if (!sf) return 0; - sf->name = _strdup("generated_source.edc"); + sf->name = strdup("generated_source.edc"); f = fopen(source_file, "rb"); if (!f) |
From: Enlightenment S. <no-...@en...> - 2010-03-07 23:10:36
|
Log: Put examples in dist package Author: davemds Date: 2010-03-07 15:10:21 -0800 (Sun, 07 Mar 2010) New Revision: 46970 Modified: trunk/edje/src/lib/edje_lua.c Modified: trunk/edje/src/lib/edje_lua.c =================================================================== --- trunk/edje/src/lib/edje_lua.c 2010-03-07 22:53:07 UTC (rev 46969) +++ trunk/edje/src/lib/edje_lua.c 2010-03-07 23:10:21 UTC (rev 46970) @@ -54,6 +54,7 @@ References: @li For general LUA documentations look at the official LUA manual (http://www.lua.org/manual/5.1/) +@li The lua-users wiki is also full of lua info (http://lua-users.org/wiki/) @li Examples of edc files that use LUA can be found in the doc/examples folder in the edje sources. @@ -1324,12 +1325,9 @@ {NULL, NULL} // sentinel }; -/* - * Lua Evas Object bindings - */ /** @page luaref -@luaclass{Object,Generic Object Class} +@luaclass{Object,General Object Class} Within the lua_script scope, Edje objects (groups, parts, etc) have the following basic attributes and methods: |
From: Enlightenment S. <no-...@en...> - 2010-10-18 00:09:16
|
Log: fix "doc", also get_state() exists Author: davemds Date: 2010-10-17 17:09:07 -0700 (Sun, 17 Oct 2010) New Revision: 53549 Modified: trunk/edje/src/lib/edje_embryo.c Modified: trunk/edje/src/lib/edje_embryo.c =================================================================== --- trunk/edje/src/lib/edje_embryo.c 2010-10-17 20:29:37 UTC (rev 53548) +++ trunk/edje/src/lib/edje_embryo.c 2010-10-18 00:09:07 UTC (rev 53549) @@ -70,6 +70,7 @@ * cancel_anim(id) * emit(sig[], src[]) * set_state(part_id, state[], Float:state_val) + * get_state(part_id, dst[], maxlen, &Float:val) * set_tween_state(part_id, Float:tween, state1[], Float:state1_val, state2[], Float:state2_val) * run_program(program_id) * Direction:get_drag_dir(part_id) |