Edje bug fixes:
* Add some comments * Fixup some const char */stringshare related compile warnings * Fix text classes SVN revision: 21392
This commit is contained in:
parent
9d26059150
commit
46a61a67b7
|
@ -12,7 +12,7 @@ static Evas_List *_edje_file_cache = NULL;
|
|||
static int _edje_collection_cache_size = 16;
|
||||
|
||||
static Edje_Part_Collection *
|
||||
_edje_file_coll_open(Edje_File *edf, Eet_File *ef, char *coll)
|
||||
_edje_file_coll_open(Edje_File *edf, Eet_File *ef, const char *coll)
|
||||
{
|
||||
Edje_Part_Collection *edc = NULL;
|
||||
Evas_List *l = NULL;
|
||||
|
@ -64,13 +64,13 @@ _edje_file_coll_open(Edje_File *edf, Eet_File *ef, char *coll)
|
|||
}
|
||||
|
||||
static Edje_File *
|
||||
_edje_file_open(char *file, char *coll, int *error_ret, Edje_Part_Collection **edc_ret)
|
||||
_edje_file_open(const char *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret)
|
||||
{
|
||||
Edje_File *edf;
|
||||
Edje_Part_Collection *edc;
|
||||
Eet_File *ef;
|
||||
|
||||
ef = eet_open((char *)file, EET_FILE_MODE_READ);
|
||||
ef = eet_open(file, EET_FILE_MODE_READ);
|
||||
if (!ef)
|
||||
{
|
||||
*error_ret = EDJE_LOAD_ERROR_UNKNOWN_FORMAT;
|
||||
|
@ -121,7 +121,7 @@ _edje_file_open(char *file, char *coll, int *error_ret, Edje_Part_Collection **e
|
|||
}
|
||||
|
||||
Edje_File *
|
||||
_edje_cache_file_coll_open(char *file, char *coll, int *error_ret, Edje_Part_Collection **edc_ret)
|
||||
_edje_cache_file_coll_open(const char *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret)
|
||||
{
|
||||
Edje_File *edf;
|
||||
Evas_List *l;
|
||||
|
|
|
@ -47,7 +47,7 @@ _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, double pos)
|
|||
}
|
||||
|
||||
Edje_Part_Description *
|
||||
_edje_part_description_find(Edje *ed, Edje_Real_Part *rp, char *name,
|
||||
_edje_part_description_find(Edje *ed, Edje_Real_Part *rp, const char *name,
|
||||
double val)
|
||||
{
|
||||
Edje_Part *ep = rp->part;
|
||||
|
@ -88,7 +88,7 @@ _edje_part_description_find(Edje *ed, Edje_Real_Part *rp, char *name,
|
|||
}
|
||||
|
||||
void
|
||||
_edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, char *d1, double v1, char *d2, double v2)
|
||||
_edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, double v1, const char *d2, double v2)
|
||||
{
|
||||
if (!d1) d1 = "default";
|
||||
if (!d2) d2 = "default";
|
||||
|
@ -432,8 +432,8 @@ _edje_part_recalc_single(Edje *ed,
|
|||
if ((chosen_desc) && (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK))
|
||||
{
|
||||
Evas_Coord tw, th, ins_l, ins_r, ins_t, ins_b;
|
||||
char *text = "";
|
||||
char *style = "";
|
||||
const char *text = "";
|
||||
const char *style = "";
|
||||
Edje_Style *stl = NULL;
|
||||
Evas_List *l;
|
||||
|
||||
|
@ -507,12 +507,12 @@ _edje_part_recalc_single(Edje *ed,
|
|||
}
|
||||
else if ((chosen_desc) && (ep->part->type == EDJE_PART_TYPE_TEXT))
|
||||
{
|
||||
char *text;
|
||||
char *font;
|
||||
int size;
|
||||
Evas_Coord tw, th;
|
||||
char buf[4096];
|
||||
int inlined_font = 0;
|
||||
const char *text;
|
||||
const char *font;
|
||||
int size;
|
||||
Evas_Coord tw, th;
|
||||
char buf[4096];
|
||||
int inlined_font = 0;
|
||||
|
||||
if (chosen_desc->text.id_source >= 0)
|
||||
ep->text.source = ed->table_parts[chosen_desc->text.id_source % ed->table_parts_size];
|
||||
|
|
|
@ -1138,7 +1138,7 @@ _edje_embryo_fn_get_text_class(Embryo_Program *ep, Embryo_Cell *params)
|
|||
if (!class) return 0;
|
||||
t_class = _edje_text_class_find(ed, class);
|
||||
if (t_class == NULL) return 0;
|
||||
SETSTR(t_class->font, params[2]);
|
||||
SETSTR((char *)t_class->font, params[2]);
|
||||
SETFLOAT(t_class->size, params[3]);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1832,7 +1832,7 @@ _edje_embryo_script_reset(Edje *ed)
|
|||
|
||||
/* this may change in future - thus "test_run" is its name */
|
||||
void
|
||||
_edje_embryo_test_run(Edje *ed, char *fname, char *sig, char *src)
|
||||
_edje_embryo_test_run(Edje *ed, const char *fname, const char *sig, const char *src)
|
||||
{
|
||||
Embryo_Function fn;
|
||||
|
||||
|
@ -1843,14 +1843,14 @@ _edje_embryo_test_run(Edje *ed, char *fname, char *sig, char *src)
|
|||
_edje_embryo_globals_init(ed);
|
||||
|
||||
// _edje_embryo_script_reset(ed);
|
||||
fn = embryo_program_function_find(ed->collection->script, fname);
|
||||
fn = embryo_program_function_find(ed->collection->script, (char *)fname);
|
||||
if (fn != EMBRYO_FUNCTION_NONE)
|
||||
{
|
||||
void *pdata;
|
||||
int ret;
|
||||
|
||||
embryo_parameter_string_push(ed->collection->script, sig);
|
||||
embryo_parameter_string_push(ed->collection->script, src);
|
||||
embryo_parameter_string_push(ed->collection->script, (char *)sig);
|
||||
embryo_parameter_string_push(ed->collection->script, (char *)src);
|
||||
pdata = embryo_program_data_get(ed->collection->script);
|
||||
embryo_program_data_set(ed->collection->script, ed);
|
||||
/* 5 million instructions is an arbitary number. on my p4-2.6 here */
|
||||
|
|
|
@ -391,7 +391,7 @@ edje_file_collection_list(const char *file)
|
|||
int error_ret = 0;
|
||||
|
||||
if ((!file) || (!*file)) return NULL;
|
||||
edf = _edje_cache_file_coll_open((char *)file, NULL, &error_ret, NULL);
|
||||
edf = _edje_cache_file_coll_open(file, NULL, &error_ret, NULL);
|
||||
if (edf != NULL)
|
||||
{
|
||||
if (edf->collection_dir)
|
||||
|
@ -441,7 +441,7 @@ edje_file_data_get(const char *file, const char *key)
|
|||
char *str = NULL;
|
||||
int error_ret = 0;
|
||||
|
||||
edf = _edje_cache_file_coll_open((char *)file, NULL, &error_ret, NULL);
|
||||
edf = _edje_cache_file_coll_open(file, NULL, &error_ret, NULL);
|
||||
if (edf != NULL)
|
||||
{
|
||||
for (l = edf->data; l; l = l->next)
|
||||
|
|
|
@ -186,7 +186,7 @@ typedef struct _Edje_Part_Description Edje_Part_Description;
|
|||
|
||||
struct _Edje_File
|
||||
{
|
||||
char *path;
|
||||
const char *path;
|
||||
|
||||
Edje_Font_Directory *font_dir;
|
||||
Edje_Image_Directory *image_dir;
|
||||
|
@ -335,7 +335,7 @@ struct _Edje_Part_Collection
|
|||
|
||||
Embryo_Program *script; /* all the embryo script code for this group */
|
||||
|
||||
char *part;
|
||||
const char *part;
|
||||
};
|
||||
|
||||
struct _Edje_Part
|
||||
|
@ -485,8 +485,8 @@ typedef struct _Edje_Var_Pool Edje_Var_Pool;
|
|||
|
||||
struct _Edje
|
||||
{
|
||||
char *path;
|
||||
char *part;
|
||||
const char *path;
|
||||
const char *part;
|
||||
|
||||
Evas_Coord x, y, w, h;
|
||||
struct {
|
||||
|
@ -578,15 +578,15 @@ struct _Edje_Real_Part
|
|||
} val, size, step, page;
|
||||
} drag;
|
||||
struct {
|
||||
char *text;
|
||||
char *font;
|
||||
char *style;
|
||||
const char *text;
|
||||
const char *font;
|
||||
const char *style;
|
||||
int size;
|
||||
struct {
|
||||
double in_w, in_h;
|
||||
int in_size;
|
||||
char *in_str;
|
||||
char *out_str;
|
||||
const char *in_str;
|
||||
const char *out_str;
|
||||
int out_size;
|
||||
double align_x, align_y;
|
||||
double elipsis;
|
||||
|
@ -621,8 +621,8 @@ struct _Edje_Running_Program
|
|||
|
||||
struct _Edje_Signal_Callback
|
||||
{
|
||||
char *signal;
|
||||
char *source;
|
||||
const char *signal;
|
||||
const char *source;
|
||||
void (*func) (void *data, Evas_Object *o, const char *emission, const char *source);
|
||||
void *data;
|
||||
unsigned char just_added : 1;
|
||||
|
@ -773,8 +773,8 @@ typedef struct _Edje_Message Edje_Message;
|
|||
|
||||
struct _Edje_Message_Signal
|
||||
{
|
||||
char *sig;
|
||||
char *src;
|
||||
const char *sig;
|
||||
const char *src;
|
||||
};
|
||||
|
||||
struct _Edje_Message
|
||||
|
@ -811,8 +811,8 @@ extern Evas_List *_edje_edjes;
|
|||
extern char *_edje_fontset_append;
|
||||
|
||||
void _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, double pos);
|
||||
Edje_Part_Description *_edje_part_description_find(Edje *ed, Edje_Real_Part *rp, char *name, double val);
|
||||
void _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, char *d1, double v1, char *d2, double v2);
|
||||
Edje_Part_Description *_edje_part_description_find(Edje *ed, Edje_Real_Part *rp, const char *name, double val);
|
||||
void _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, double v1, const char *d2, double v2);
|
||||
void _edje_recalc(Edje *ed);
|
||||
int _edje_part_dragable_calc(Edje *ed, Edje_Real_Part *ep, double *x, double *y);
|
||||
void _edje_dragable_pos_set(Edje *ed, Edje_Real_Part *ep, double x, double y);
|
||||
|
@ -845,9 +845,9 @@ void _edje_unref(Edje *ed);
|
|||
|
||||
int _edje_program_run_iterate(Edje_Running_Program *runp, double tim);
|
||||
void _edje_program_end(Edje *ed, Edje_Running_Program *runp);
|
||||
void _edje_program_run(Edje *ed, Edje_Program *pr, int force, char *ssig, char *ssrc);
|
||||
void _edje_emit(Edje *ed, char *sig, char *src);
|
||||
void _edje_emit_handle(Edje *ed, char *sig, char *src);
|
||||
void _edje_program_run(Edje *ed, Edje_Program *pr, int force, const char *ssig, const char *ssrc);
|
||||
void _edje_emit(Edje *ed, const char *sig, const char *src);
|
||||
void _edje_emit_handle(Edje *ed, const char *sig, const char *src);
|
||||
|
||||
void _edje_text_init(void);
|
||||
void _edje_text_part_on_add(Edje *ed, Edje_Real_Part *ep);
|
||||
|
@ -856,22 +856,22 @@ void _edje_text_part_on_del(Edje *ed, Edje_Part *ep);
|
|||
void _edje_text_real_part_on_del(Edje *ed, Edje_Real_Part *ep);
|
||||
void _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *params, Edje_Part_Description *chosen_desc);
|
||||
|
||||
Edje_Real_Part *_edje_real_part_get(Edje *ed, char *part);
|
||||
Edje_Color_Class *_edje_color_class_find(Edje *ed, char *color_class);
|
||||
void _edje_color_class_member_add(Edje *ed, char *color_class);
|
||||
void _edje_color_class_member_del(Edje *ed, char *color_class);
|
||||
Edje_Real_Part *_edje_real_part_get(Edje *ed, const char *part);
|
||||
Edje_Color_Class *_edje_color_class_find(Edje *ed, const char *color_class);
|
||||
void _edje_color_class_member_add(Edje *ed, const char *color_class);
|
||||
void _edje_color_class_member_del(Edje *ed, const char *color_class);
|
||||
void _edje_color_class_on_del(Edje *ed, Edje_Part *ep);
|
||||
void _edje_color_class_members_free(void);
|
||||
void _edje_color_class_hash_free(void);
|
||||
|
||||
Edje_Text_Class *_edje_text_class_find(Edje *ed, char *text_class);
|
||||
void _edje_text_class_member_add(Edje *ed, char *text_class);
|
||||
void _edje_text_class_member_del(Edje *ed, char *text_class);
|
||||
Edje_Text_Class *_edje_text_class_find(Edje *ed, const char *text_class);
|
||||
void _edje_text_class_member_add(Edje *ed, const char *text_class);
|
||||
void _edje_text_class_member_del(Edje *ed, const char *text_class);
|
||||
void _edje_text_class_members_free(void);
|
||||
void _edje_text_class_hash_free(void);
|
||||
|
||||
Edje *_edje_fetch(Evas_Object *obj);
|
||||
int _edje_glob_match(char *str, char *glob);
|
||||
int _edje_glob_match(const char *str, const char *glob);
|
||||
int _edje_freeze(Edje *ed);
|
||||
int _edje_thaw(Edje *ed);
|
||||
int _edje_block(Edje *ed);
|
||||
|
@ -883,24 +883,24 @@ void _edje_object_part_swallow_free_cb(void *data, Evas *e, Evas_Ob
|
|||
void _edje_embryo_script_init (Edje *ed);
|
||||
void _edje_embryo_script_shutdown (Edje *ed);
|
||||
void _edje_embryo_script_reset (Edje *ed);
|
||||
void _edje_embryo_test_run (Edje *ed, char *fname, char *sig, char *src);
|
||||
void _edje_embryo_test_run (Edje *ed, const char *fname, const char *sig, const char *src);
|
||||
Edje_Var *_edje_var_new (void);
|
||||
void _edje_var_free (Edje_Var *var);
|
||||
void _edje_var_init (Edje *ed);
|
||||
void _edje_var_shutdown (Edje *ed);
|
||||
int _edje_var_string_id_get (Edje *ed, char *string);
|
||||
int _edje_var_string_id_get (Edje *ed, const char *string);
|
||||
int _edje_var_var_int_get (Edje *ed, Edje_Var *var);
|
||||
void _edje_var_var_int_set (Edje *ed, Edje_Var *var, int v);
|
||||
double _edje_var_var_float_get (Edje *ed, Edje_Var *var);
|
||||
void _edje_var_var_float_set (Edje *ed, Edje_Var *var, double v);
|
||||
const char *_edje_var_var_str_get (Edje *ed, Edje_Var *var);
|
||||
void _edje_var_var_str_set (Edje *ed, Edje_Var *var, char *str);
|
||||
void _edje_var_var_str_set (Edje *ed, Edje_Var *var, const char *str);
|
||||
int _edje_var_int_get (Edje *ed, int id);
|
||||
void _edje_var_int_set (Edje *ed, int id, int v);
|
||||
double _edje_var_float_get (Edje *ed, int id);
|
||||
void _edje_var_float_set (Edje *ed, int id, double v);
|
||||
const char *_edje_var_str_get (Edje *ed, int id);
|
||||
void _edje_var_str_set (Edje *ed, int id, char *str);
|
||||
void _edje_var_str_set (Edje *ed, int id, const char *str);
|
||||
|
||||
void _edje_var_list_var_append(Edje *ed, int id, Edje_Var *var);
|
||||
void _edje_var_list_var_prepend(Edje *ed, int id, Edje_Var *var);
|
||||
|
@ -924,15 +924,15 @@ void _edje_var_list_float_prepend(Edje *ed, int id, double v);
|
|||
void _edje_var_list_float_insert(Edje *ed, int id, int n, double v);
|
||||
|
||||
const char *_edje_var_list_nth_str_get(Edje *ed, int id, int n);
|
||||
void _edje_var_list_nth_str_set(Edje *ed, int id, int n, char *v);
|
||||
void _edje_var_list_str_append(Edje *ed, int id, char *v);
|
||||
void _edje_var_list_str_prepend(Edje *ed, int id, char *v);
|
||||
void _edje_var_list_str_insert(Edje *ed, int id, int n, char *v);
|
||||
void _edje_var_list_nth_str_set(Edje *ed, int id, int n, const char *v);
|
||||
void _edje_var_list_str_append(Edje *ed, int id, const char *v);
|
||||
void _edje_var_list_str_prepend(Edje *ed, int id, const char *v);
|
||||
void _edje_var_list_str_insert(Edje *ed, int id, int n, const char *v);
|
||||
|
||||
int _edje_var_timer_add (Edje *ed, double in, char *fname, int val);
|
||||
int _edje_var_timer_add (Edje *ed, double in, const char *fname, int val);
|
||||
void _edje_var_timer_del (Edje *ed, int id);
|
||||
|
||||
int _edje_var_anim_add (Edje *ed, double len, char *fname, int val);
|
||||
int _edje_var_anim_add (Edje *ed, double len, const char *fname, int val);
|
||||
void _edje_var_anim_del (Edje *ed, int id);
|
||||
|
||||
void _edje_message_init (void);
|
||||
|
@ -948,7 +948,7 @@ void _edje_message_del (Edje *ed);
|
|||
|
||||
void _edje_textblock_style_parse_and_fix(Edje_File *edf);
|
||||
void _edje_textblock_style_cleanup(Edje_File *edf);
|
||||
Edje_File *_edje_cache_file_coll_open(char *file, char *coll, int *error_ret, Edje_Part_Collection **edc_ret);
|
||||
Edje_File *_edje_cache_file_coll_open(const char *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret);
|
||||
void _edje_cache_coll_clean(Edje_File *edf);
|
||||
void _edje_cache_coll_flush(Edje_File *edf);
|
||||
void _edje_cache_coll_unref(Edje_File *edf, Edje_Part_Collection *edc);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "Edje.h"
|
||||
#include "edje_private.h"
|
||||
|
||||
static void _edje_emit_cb(Edje *ed, char *sig, char *src);
|
||||
static void _edje_emit_cb(Edje *ed, const char *sig, const char *src);
|
||||
|
||||
int _edje_anim_count = 0;
|
||||
Ecore_Animator *_edje_timer = NULL;
|
||||
|
@ -418,7 +418,7 @@ _edje_program_end(Edje *ed, Edje_Running_Program *runp)
|
|||
}
|
||||
|
||||
void
|
||||
_edje_program_run(Edje *ed, Edje_Program *pr, int force, char *ssig, char *ssrc)
|
||||
_edje_program_run(Edje *ed, Edje_Program *pr, int force, const char *ssig, const char *ssrc)
|
||||
{
|
||||
Evas_List *l;
|
||||
/* limit self-feeding loops in programs to 64 levels */
|
||||
|
@ -729,7 +729,7 @@ _edje_program_run(Edje *ed, Edje_Program *pr, int force, char *ssig, char *ssrc)
|
|||
}
|
||||
|
||||
void
|
||||
_edje_emit(Edje *ed, char *sig, char *src)
|
||||
_edje_emit(Edje *ed, const char *sig, const char *src)
|
||||
{
|
||||
Edje_Message_Signal emsg;
|
||||
|
||||
|
@ -741,7 +741,7 @@ _edje_emit(Edje *ed, char *sig, char *src)
|
|||
|
||||
/* FIXME: what if we delete the evas object??? */
|
||||
void
|
||||
_edje_emit_handle(Edje *ed, char *sig, char *src)
|
||||
_edje_emit_handle(Edje *ed, const char *sig, const char *src)
|
||||
{
|
||||
Evas_List *l;
|
||||
|
||||
|
@ -854,7 +854,7 @@ _edje_emit_handle(Edje *ed, char *sig, char *src)
|
|||
|
||||
/* FIXME: what if we delete the evas object??? */
|
||||
static void
|
||||
_edje_emit_cb(Edje *ed, char *sig, char *src)
|
||||
_edje_emit_cb(Edje *ed, const char *sig, const char *src)
|
||||
{
|
||||
Evas_List *l;
|
||||
|
||||
|
|
|
@ -23,8 +23,11 @@ _edje_text_part_on_add(Edje *ed, Edje_Real_Part *ep)
|
|||
|
||||
if (ep->part->type != EDJE_PART_TYPE_TEXT) return;
|
||||
|
||||
/* if text class exists for this part, add the edje to the tc member list */
|
||||
if ((pt->default_desc) && (pt->default_desc->text.text_class))
|
||||
_edje_text_class_member_add(ed, pt->default_desc->text.text_class);
|
||||
|
||||
/* If any other classes exit add them */
|
||||
for (tmp = pt->other_desc; tmp; tmp = tmp->next)
|
||||
{
|
||||
Edje_Part_Description *desc;
|
||||
|
@ -62,11 +65,7 @@ _edje_text_part_on_del(Edje *ed, Edje_Part *pt)
|
|||
Evas_List *tmp;
|
||||
|
||||
if ((pt->default_desc) && (pt->default_desc->text.text_class))
|
||||
{
|
||||
_edje_text_class_member_del(ed, pt->default_desc->text.text_class);
|
||||
evas_stringshare_del(pt->default_desc->text.text_class);
|
||||
pt->default_desc->text.text_class = NULL;
|
||||
}
|
||||
_edje_text_class_member_del(ed, pt->default_desc->text.text_class);
|
||||
|
||||
for (tmp = pt->other_desc; tmp; tmp = tmp->next)
|
||||
{
|
||||
|
@ -74,11 +73,7 @@ _edje_text_part_on_del(Edje *ed, Edje_Part *pt)
|
|||
|
||||
desc = tmp->data;
|
||||
if (desc->text.text_class)
|
||||
{
|
||||
_edje_text_class_member_del(ed, desc->text.text_class);
|
||||
evas_stringshare_del(desc->text.text_class);
|
||||
desc->text.text_class = NULL;
|
||||
}
|
||||
_edje_text_class_member_del(ed, desc->text.text_class);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +91,7 @@ _edje_text_real_part_on_del(Edje *ed, Edje_Real_Part *ep)
|
|||
}
|
||||
|
||||
static void
|
||||
_edje_text_fit_set(char *buf, char *text, int c1, int c2)
|
||||
_edje_text_fit_set(char *buf, const char *text, int c1, int c2)
|
||||
{
|
||||
/* helper function called from _edje_text_fit_x().
|
||||
* note that we can use strcpy()/strcat() safely, the buffer lengths
|
||||
|
@ -128,10 +123,10 @@ _edje_text_fit_set(char *buf, char *text, int c1, int c2)
|
|||
}
|
||||
}
|
||||
|
||||
static char *
|
||||
static const char *
|
||||
_edje_text_fit_x(Edje *ed, Edje_Real_Part *ep,
|
||||
Edje_Calc_Params *params,
|
||||
char *text, char *font, int size,
|
||||
const char *text, const char *font, int size,
|
||||
Evas_Coord sw, int *free_text)
|
||||
{
|
||||
Evas_Coord tw = 0, th = 0, p;
|
||||
|
@ -254,13 +249,14 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
|
|||
Edje_Calc_Params *params,
|
||||
Edje_Part_Description *chosen_desc)
|
||||
{
|
||||
char *text;
|
||||
char *font, *font2 = NULL;
|
||||
int size;
|
||||
Evas_Coord tw, th;
|
||||
Evas_Coord sw, sh;
|
||||
char font_buf[4096];
|
||||
int inlined_font = 0, free_text = 0;
|
||||
const char *text;
|
||||
const char *font;
|
||||
char *font2 = NULL;
|
||||
int size;
|
||||
Evas_Coord tw, th;
|
||||
Evas_Coord sw, sh;
|
||||
char font_buf[4096];
|
||||
int inlined_font = 0, free_text = 0;
|
||||
|
||||
|
||||
text = chosen_desc->text.text;
|
||||
|
@ -279,7 +275,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
|
|||
}
|
||||
}
|
||||
|
||||
if (ep->text.text) text = ep->text.text;
|
||||
if (ep->text.text) text = (char *) ep->text.text;
|
||||
if (ep->text.font) font = ep->text.font;
|
||||
if (ep->text.size > 0) size = ep->text.size;
|
||||
|
||||
|
@ -336,7 +332,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
|
|||
(ep->text.cache.align_y == params->text.align.y) &&
|
||||
(ep->text.cache.elipsis == params->text.elipsis))
|
||||
{
|
||||
text = ep->text.cache.out_str;
|
||||
text = (char *) ep->text.cache.out_str;
|
||||
size = ep->text.cache.out_size;
|
||||
|
||||
if (!text) text = "";
|
||||
|
@ -454,8 +450,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
|
|||
if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
|
||||
else evas_object_text_font_source_set(ep->object, NULL);
|
||||
|
||||
text = _edje_text_fit_x(ed, ep, params, text, font, size, sw,
|
||||
&free_text);
|
||||
text = _edje_text_fit_x(ed, ep, params, text, font, size, sw, &free_text);
|
||||
}
|
||||
|
||||
if (ep->text.cache.out_str) evas_stringshare_del(ep->text.cache.out_str);
|
||||
|
@ -486,6 +481,8 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
|
|||
{
|
||||
Evas_Text_Style_Type style;
|
||||
|
||||
style = EVAS_TEXT_STYLE_PLAIN;
|
||||
|
||||
evas_object_color_set(ep->object,
|
||||
params->color.r,
|
||||
params->color.g,
|
||||
|
@ -565,7 +562,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
|
|||
}
|
||||
|
||||
if (free_text)
|
||||
free(text);
|
||||
free((char *)text);
|
||||
if (font2)
|
||||
free(font2);
|
||||
}
|
||||
|
|
|
@ -425,13 +425,13 @@ edje_text_class_set(const char *text_class, const char *font, Evas_Font_Size siz
|
|||
Evas_List *members;
|
||||
Edje_Text_Class *tc;
|
||||
|
||||
return; // this is broken right now - need to fix
|
||||
if (!text_class) return;
|
||||
|
||||
if (size < 0) size = 0;
|
||||
if (!font) font = "";
|
||||
|
||||
tc = evas_hash_find(_edje_text_class_hash, text_class);
|
||||
/* Create new text class */
|
||||
if (!tc)
|
||||
{
|
||||
tc = calloc(1, sizeof(Edje_Text_Class));
|
||||
|
@ -455,8 +455,11 @@ edje_text_class_set(const char *text_class, const char *font, Evas_Font_Size siz
|
|||
return;
|
||||
}
|
||||
|
||||
/* If the class found is the same just return */
|
||||
if ((tc->size == size) && (tc->font) && (!strcmp(tc->font, font)))
|
||||
return;
|
||||
|
||||
/* Update the class found */
|
||||
evas_stringshare_del(tc->font);
|
||||
tc->font = evas_stringshare_add(font);
|
||||
if (!tc->font)
|
||||
|
@ -467,6 +470,7 @@ edje_text_class_set(const char *text_class, const char *font, Evas_Font_Size siz
|
|||
}
|
||||
tc->size = size;
|
||||
|
||||
/* Tell all members of the text class to recalc */
|
||||
members = evas_hash_find(_edje_text_class_member_hash, text_class);
|
||||
while (members)
|
||||
{
|
||||
|
@ -494,33 +498,42 @@ edje_object_text_class_set(Evas_Object *obj, const char *text_class, const char
|
|||
Evas_List *l;
|
||||
Edje_Text_Class *tc;
|
||||
|
||||
return; // this is broken right now. need to fix
|
||||
// printf("------------ edje_object_text_class_set\n");
|
||||
ed = _edje_fetch(obj);
|
||||
if ((!ed) || (!text_class)) return;
|
||||
if (size < 0.0) size = 0.0;
|
||||
|
||||
/* for each text_class in the edje */
|
||||
for (l = ed->text_classes; l; l = l->next)
|
||||
{
|
||||
tc = l->data;
|
||||
if ((tc->name) && (!strcmp(tc->name, text_class)))
|
||||
{
|
||||
/* Match and the same, return */
|
||||
if ((tc->font) && (font) &&
|
||||
(!strcmp(tc->font, font)) &&
|
||||
(tc->size == size))
|
||||
return;
|
||||
|
||||
/* No font but size is the same, return */
|
||||
if ((!tc->font) && (!font) &&
|
||||
(tc->size == size))
|
||||
return;
|
||||
|
||||
/* Update new text class properties */
|
||||
if (tc->font) evas_stringshare_del(tc->font);
|
||||
if (font) tc->font = evas_stringshare_add(font);
|
||||
else tc->font = NULL;
|
||||
tc->size = size;
|
||||
|
||||
/* Update edje */
|
||||
ed->dirty = 1;
|
||||
_edje_recalc(ed);
|
||||
return;
|
||||
}
|
||||
}
|
||||
tc = malloc(sizeof(Edje_Text_Class));
|
||||
|
||||
/* No matches, create a new text class */
|
||||
tc = calloc(1, sizeof(Edje_Text_Class));
|
||||
if (!tc) return;
|
||||
tc->name = evas_stringshare_add(text_class);
|
||||
if (!tc->name)
|
||||
|
@ -531,6 +544,8 @@ edje_object_text_class_set(Evas_Object *obj, const char *text_class, const char
|
|||
if (font) tc->font = evas_stringshare_add(font);
|
||||
else tc->font = NULL;
|
||||
tc->size = size;
|
||||
|
||||
/* Add to edje's text class list */
|
||||
ed->text_classes = evas_list_append(ed->text_classes, tc);
|
||||
ed->dirty = 1;
|
||||
_edje_recalc(ed);
|
||||
|
@ -1487,7 +1502,7 @@ edje_object_part_drag_page(Evas_Object *obj, const char *part, double dx, double
|
|||
/* Private Routines */
|
||||
|
||||
Edje_Real_Part *
|
||||
_edje_real_part_get(Edje *ed, char *part)
|
||||
_edje_real_part_get(Edje *ed, const char *part)
|
||||
{
|
||||
Evas_List *l;
|
||||
|
||||
|
@ -1502,7 +1517,7 @@ _edje_real_part_get(Edje *ed, char *part)
|
|||
}
|
||||
|
||||
Edje_Color_Class *
|
||||
_edje_color_class_find(Edje *ed, char *color_class)
|
||||
_edje_color_class_find(Edje *ed, const char *color_class)
|
||||
{
|
||||
Evas_List *l;
|
||||
Edje_Color_Class *cc = NULL;
|
||||
|
@ -1531,7 +1546,7 @@ _edje_color_class_find(Edje *ed, char *color_class)
|
|||
}
|
||||
|
||||
void
|
||||
_edje_color_class_member_add(Edje *ed, char *color_class)
|
||||
_edje_color_class_member_add(Edje *ed, const char *color_class)
|
||||
{
|
||||
Evas_List *members;
|
||||
|
||||
|
@ -1544,7 +1559,7 @@ _edje_color_class_member_add(Edje *ed, char *color_class)
|
|||
}
|
||||
|
||||
void
|
||||
_edje_color_class_member_del(Edje *ed, char *color_class)
|
||||
_edje_color_class_member_del(Edje *ed, const char *color_class)
|
||||
{
|
||||
Evas_List *members;
|
||||
|
||||
|
@ -1609,7 +1624,9 @@ _edje_color_class_on_del(Edje *ed, Edje_Part *ep)
|
|||
{
|
||||
Evas_List *tmp;
|
||||
|
||||
if ((ep->default_desc) && (ep->default_desc->color_class)) _edje_color_class_member_del(ed, ep->default_desc->color_class);
|
||||
if ((ep->default_desc) && (ep->default_desc->color_class))
|
||||
_edje_color_class_member_del(ed, ep->default_desc->color_class);
|
||||
|
||||
for (tmp = ep->other_desc; tmp; tmp = tmp->next)
|
||||
{
|
||||
Edje_Part_Description *desc;
|
||||
|
@ -1623,7 +1640,7 @@ _edje_color_class_on_del(Edje *ed, Edje_Part *ep)
|
|||
}
|
||||
|
||||
Edje_Text_Class *
|
||||
_edje_text_class_find(Edje *ed, char *text_class)
|
||||
_edje_text_class_find(Edje *ed, const char *text_class)
|
||||
{
|
||||
Evas_List *l;
|
||||
|
||||
|
@ -1639,20 +1656,28 @@ _edje_text_class_find(Edje *ed, char *text_class)
|
|||
}
|
||||
|
||||
void
|
||||
_edje_text_class_member_add(Edje *ed, char *text_class)
|
||||
_edje_text_class_member_add(Edje *ed, const char *text_class)
|
||||
{
|
||||
Evas_List *members;
|
||||
|
||||
if ((!ed) || (!text_class)) return;
|
||||
members = evas_hash_find(_edje_text_class_member_hash, text_class);
|
||||
if (members) _edje_text_class_member_hash = evas_hash_del(_edje_text_class_member_hash, text_class, members);
|
||||
|
||||
/* Get members list */
|
||||
members = evas_hash_find(_edje_text_class_member_hash, text_class);
|
||||
|
||||
/* Remove members list */
|
||||
if (members)
|
||||
_edje_text_class_member_hash = evas_hash_del(_edje_text_class_member_hash, text_class, members);
|
||||
|
||||
/* Update the member list */
|
||||
members = evas_list_prepend(members, ed);
|
||||
|
||||
/* Add the member list back */
|
||||
_edje_text_class_member_hash = evas_hash_add(_edje_text_class_member_hash, text_class, members);
|
||||
}
|
||||
|
||||
void
|
||||
_edje_text_class_member_del(Edje *ed, char *text_class)
|
||||
_edje_text_class_member_del(Edje *ed, const char *text_class)
|
||||
{
|
||||
Evas_List *members;
|
||||
|
||||
|
@ -1661,6 +1686,7 @@ _edje_text_class_member_del(Edje *ed, char *text_class)
|
|||
if (!members) return;
|
||||
|
||||
_edje_text_class_member_hash = evas_hash_del(_edje_text_class_member_hash, text_class, members);
|
||||
|
||||
members = evas_list_remove(members, ed);
|
||||
if (members) _edje_text_class_member_hash = evas_hash_add(_edje_text_class_member_hash, text_class, members);
|
||||
}
|
||||
|
@ -1716,7 +1742,7 @@ _edje_fetch(Evas_Object *obj)
|
|||
}
|
||||
|
||||
int
|
||||
_edje_glob_match(char *str, char *glob)
|
||||
_edje_glob_match(const char *str, const char *glob)
|
||||
{
|
||||
if ((!glob) || (glob[0] == 0))
|
||||
{
|
||||
|
|
|
@ -236,7 +236,7 @@ _edje_var_shutdown(Edje *ed)
|
|||
}
|
||||
|
||||
int
|
||||
_edje_var_string_id_get(Edje *ed, char *string)
|
||||
_edje_var_string_id_get(Edje *ed, const char *string)
|
||||
{
|
||||
Embryo_Cell cell, *cptr;
|
||||
|
||||
|
@ -244,7 +244,7 @@ _edje_var_string_id_get(Edje *ed, char *string)
|
|||
if (!ed->collection) return 0;
|
||||
if (!ed->collection->script) return 0;
|
||||
if (!string) return 0;
|
||||
cell = embryo_program_variable_find(ed->collection->script, string);
|
||||
cell = embryo_program_variable_find(ed->collection->script, (char *)string);
|
||||
if (cell == EMBRYO_CELL_NONE) return 0;
|
||||
cptr = embryo_data_address_get(ed->collection->script, cell);
|
||||
if (!cptr) return 0;
|
||||
|
@ -427,7 +427,7 @@ _edje_var_var_str_get(Edje *ed, Edje_Var *var)
|
|||
}
|
||||
|
||||
void
|
||||
_edje_var_var_str_set(Edje *ed, Edje_Var *var, char *str)
|
||||
_edje_var_var_str_set(Edje *ed, Edje_Var *var, const char *str)
|
||||
{
|
||||
/* auto-cast */
|
||||
if (var->type == EDJE_VAR_STRING)
|
||||
|
@ -512,7 +512,7 @@ _edje_var_str_get(Edje *ed, int id)
|
|||
}
|
||||
|
||||
void
|
||||
_edje_var_str_set(Edje *ed, int id, char *str)
|
||||
_edje_var_str_set(Edje *ed, int id, const char *str)
|
||||
{
|
||||
if (!ed) return;
|
||||
if (!ed->var_pool) return;
|
||||
|
@ -849,7 +849,7 @@ _edje_var_list_nth_str_get(Edje *ed, int id, int n)
|
|||
}
|
||||
|
||||
void
|
||||
_edje_var_list_nth_str_set(Edje *ed, int id, int n, char *v)
|
||||
_edje_var_list_nth_str_set(Edje *ed, int id, int n, const char *v)
|
||||
{
|
||||
if (!ed) return;
|
||||
if (!ed->var_pool) return;
|
||||
|
@ -869,7 +869,7 @@ _edje_var_list_nth_str_set(Edje *ed, int id, int n, char *v)
|
|||
}
|
||||
|
||||
void
|
||||
_edje_var_list_str_append(Edje *ed, int id, char *v)
|
||||
_edje_var_list_str_append(Edje *ed, int id, const char *v)
|
||||
{
|
||||
if (!ed) return;
|
||||
if (!ed->var_pool) return;
|
||||
|
@ -890,7 +890,7 @@ _edje_var_list_str_append(Edje *ed, int id, char *v)
|
|||
}
|
||||
|
||||
void
|
||||
_edje_var_list_str_prepend(Edje *ed, int id, char *v)
|
||||
_edje_var_list_str_prepend(Edje *ed, int id, const char *v)
|
||||
{
|
||||
if (!ed) return;
|
||||
if (!ed->var_pool) return;
|
||||
|
@ -911,7 +911,7 @@ _edje_var_list_str_prepend(Edje *ed, int id, char *v)
|
|||
}
|
||||
|
||||
void
|
||||
_edje_var_list_str_insert(Edje *ed, int id, int n, char *v)
|
||||
_edje_var_list_str_insert(Edje *ed, int id, int n, const char *v)
|
||||
{
|
||||
if (!ed) return;
|
||||
if (!ed->var_pool) return;
|
||||
|
@ -936,13 +936,13 @@ _edje_var_list_str_insert(Edje *ed, int id, int n, char *v)
|
|||
}
|
||||
|
||||
int
|
||||
_edje_var_timer_add(Edje *ed, double in, char *fname, int val)
|
||||
_edje_var_timer_add(Edje *ed, double in, const char *fname, int val)
|
||||
{
|
||||
Edje_Var_Timer *et;
|
||||
Embryo_Function fn;
|
||||
|
||||
if (!ed->var_pool) return 0;
|
||||
fn = embryo_program_function_find(ed->collection->script, fname);
|
||||
fn = embryo_program_function_find(ed->collection->script, (char *)fname);
|
||||
if (fn == EMBRYO_FUNCTION_NONE) return 0;
|
||||
et = calloc(1, sizeof(Edje_Var_Timer));
|
||||
if (!et) return 0;
|
||||
|
@ -1001,14 +1001,14 @@ _edje_var_timer_del(Edje *ed, int id)
|
|||
}
|
||||
|
||||
int
|
||||
_edje_var_anim_add(Edje *ed, double len, char *fname, int val)
|
||||
_edje_var_anim_add(Edje *ed, double len, const char *fname, int val)
|
||||
{
|
||||
Edje_Var_Animator *ea;
|
||||
Embryo_Function fn;
|
||||
|
||||
if (!ed->var_pool) return 0;
|
||||
if (len <= 0.0) return 0;
|
||||
fn = embryo_program_function_find(ed->collection->script, fname);
|
||||
fn = embryo_program_function_find(ed->collection->script, (char *)fname);
|
||||
if (fn == EMBRYO_FUNCTION_NONE) return 0;
|
||||
ea = calloc(1, sizeof(Edje_Var_Animator));
|
||||
if (!ea) return 0;
|
||||
|
|
Loading…
Reference in New Issue