Enlightenment CVS committal

Author  : davemds
Project : e17
Module  : libs/edje

Dir     : e17/libs/edje/src/lib


Modified Files:
        Edje_Edit.h edje_edit.c 


Log Message:
 * remove spectra_id functions in favor of standard 'get/set-by-name' functions

===================================================================
RCS file: /cvs/e/e17/libs/edje/src/lib/Edje_Edit.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- Edje_Edit.h 12 Jul 2008 12:48:35 -0000      1.26
+++ Edje_Edit.h 13 Jul 2008 14:18:17 -0000      1.27
@@ -1327,22 +1327,13 @@
    const char *state       ///< The name of the 'part state' (ex. "default 
0.00")
 );
 
-/**Get the spectra id used by part state.*/
-EAPI int                   ///@return The spectra id
-edje_edit_state_gradient_spectra_id_get(
+/**Get the spectra used by part state. Remember to free the string with 
edje_edit_string_free()*/
+EAPI const char *          ///@return The spectra name used in state
+edje_edit_state_gradient_spectra_get(
    Evas_Object *obj,       ///< The edje object
    const char *part,       ///< The name of the part
    const char *state       ///< The name of the 'part state' (ex. "default 
0.00")
 );
-
-//~ /**Set the spectra id used by part state.*/
-//~ EAPI unsigned char         ///@return 1 on success, 0 otherwise
-//~ edje_edit_state_gradient_spectra_id_set(
-   //~ Evas_Object *obj,       ///< The edje object
-   //~ const char *part,       ///< The name of the part
-   //~ const char *state,      ///< The name of the 'part state' (ex. "default 
0.00")
-   //~ int spectra_i
-//~ );
 
 /**Set the spectra used by part state.*/
 EAPI unsigned char         ///@return 1 on success, 0 otherwise
===================================================================
RCS file: /cvs/e/e17/libs/edje/src/lib/edje_edit.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- edje_edit.c 12 Jul 2008 12:48:35 -0000      1.19
+++ edje_edit.c 13 Jul 2008 14:18:17 -0000      1.20
@@ -555,19 +555,42 @@
 {
    Edje_Spectrum_Directory_Entry *s;
    Evas_List *l;
-   
+
    if (!ed->file || !spectra || !ed->file->spectrum_dir)
       return NULL;
-   
+
    for (l = ed->file->spectrum_dir->entries; l; l = l->next)
      {
+       Edje_Spectrum_Directory_Entry *s;
+
        s = l->data;
        if (!strcmp(s->entry, spectra))
           return s;
      }
-   
+
    return NULL;
 }
+
+Edje_Spectrum_Directory_Entry *
+_edje_edit_spectrum_entry_get_by_id(Edje *ed, int spectra_id)
+{
+   Evas_List *l;
+
+   if (!ed->file || !ed->file->spectrum_dir)
+      return NULL;
+
+   for (l = ed->file->spectrum_dir->entries; l; l = l->next)
+     {
+       Edje_Spectrum_Directory_Entry *s;
+
+       s = l->data;
+       if (s->id == spectra_id)
+          return s;
+     }
+
+   return NULL;
+}
+
 /*****************/
 /*  GENERAL API  */
 /*****************/
@@ -2811,7 +2834,7 @@
    for (l = ed->file->spectrum_dir->entries; l; l = l->next)
      {
        s = l->data;
-       printf("SPECTRUM: %s\n", s->entry);
+        printf("SPECTRUM: %s [id: %d]\n", s->entry, s->id);
        spectrums = evas_list_append(spectrums, evas_stringshare_add(s->entry));
      }
 
@@ -3042,32 +3065,19 @@
    return 1;
 }
 
-EAPI int
-edje_edit_state_gradient_spectra_id_get(Evas_Object *obj, const char *part, 
const char *state)
+EAPI const char *
+edje_edit_state_gradient_spectra_get(Evas_Object *obj, const char *part, const 
char *state)
 {
-   GET_PD_OR_RETURN(-1);
-
-   //if (!pd->gradient.type)
-   //   return NULL;
-
-   printf("GET GRADIENT SPECTRA ID for part: %s state: %s [%d]\n", part, 
state, pd->gradient.id);
-
-   return pd->gradient.id;
-}
-
-//~ EAPI unsigned char
-//~ edje_edit_state_gradient_spectra_id_set(Evas_Object *obj, const char 
*part, const char *state, int spectra_id)
-//~ {
-   //~ GET_PD_OR_RETURN(0);
-
-   //~ printf("SET GRADIENT SPECTRA_ID for part: %s state: %s [%d]\n", part, 
state, spectra_id);
-
-   //~ pd->gradient.id = spectra_id;
+   Edje_Spectrum_Directory_Entry *s;
    
-   //~ edje_object_calc_force(obj);
+   GET_PD_OR_RETURN(0);
+
+   //printf("GET GRADIENT SPECTRA for part: %s state: %s\n", part, state);
+   s = _edje_edit_spectrum_entry_get_by_id(ed, pd->gradient.id);
+   if (!s) return 0;
    
-   //~ return 1;
-//~ }
+   return evas_stringshare_add(s->entry);
+}
 
 EAPI unsigned char
 edje_edit_state_gradient_spectra_set(Evas_Object *obj, const char *part, const 
char *state, const char* spectra)
@@ -3080,9 +3090,8 @@
    
    s = _edje_edit_spectrum_entry_get(ed, spectra);
    if (!s) return 0;
-   
+
    pd->gradient.id = s->id;
-   
    edje_object_calc_force(obj);
    
    return 1;



-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to