and edje started supporting.... TEXTBLOCK2!!!!!
see e_logo.edc for an example. :) SVN revision: 16698
This commit is contained in:
parent
65db7141f8
commit
3ac48d63ae
|
@ -1,6 +1,6 @@
|
|||
fonts {
|
||||
font: "Vera.ttf" "Vera";
|
||||
font: "VeraBd.ttf" "Vera Bold";
|
||||
font: "VeraBd.ttf" "Vera-Bold";
|
||||
}
|
||||
images {
|
||||
image: "bg.png" LOSSY 95;
|
||||
|
@ -134,6 +134,17 @@ data
|
|||
item: "The Key" "String data attached to the key";
|
||||
}
|
||||
|
||||
styles
|
||||
{
|
||||
style {
|
||||
name: "default";
|
||||
base: "font=Vera font_size=10 align=left color=#ffffff style=soft_shadow shadow_color=#00000020 wrap=word";
|
||||
|
||||
tag: "br" "\n";
|
||||
tag: "hilight" "+ font_size=12 font=Vera-Bold style=glow glow2_color=#fe87 glow_color=#fa14";
|
||||
}
|
||||
}
|
||||
|
||||
collections {
|
||||
group {
|
||||
name: "test";
|
||||
|
@ -223,6 +234,28 @@ collections {
|
|||
}
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "textblock";
|
||||
type: TEXTBLOCK;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
rel1 {
|
||||
relative: 0.0 0.0;
|
||||
offset: 10 10;
|
||||
}
|
||||
rel2 {
|
||||
relative: 1.0 1.0;
|
||||
offset: -11 -11;
|
||||
}
|
||||
text {
|
||||
style: "default";
|
||||
text:
|
||||
"This is a longer test string<br>"
|
||||
"after a newline some <hilight>HILIGHTED text can be styled</hilight> by the edje...<br>"
|
||||
"and more.";
|
||||
}
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "text";
|
||||
type: TEXT;
|
||||
|
@ -583,7 +616,7 @@ collections {
|
|||
get_text_class("plainjane", font, size);
|
||||
snprintf(buf, 256, "%s SIZE: %f", font, size);
|
||||
emit("DEBUG...", buf);
|
||||
set_text_class("plainjane", "Vera Bold", 10.0);
|
||||
set_text_class("plainjane", "Vera-Bold", 10.0);
|
||||
}
|
||||
}
|
||||
program {
|
||||
|
|
|
@ -10,6 +10,11 @@ static void st_fonts_font(void);
|
|||
|
||||
static void st_data_item(void);
|
||||
|
||||
static void ob_styles_style(void);
|
||||
static void st_styles_style_name(void);
|
||||
static void st_styles_style_base(void);
|
||||
static void st_styles_style_tag(void);
|
||||
|
||||
static void ob_collections(void);
|
||||
|
||||
static void ob_collections_group(void);
|
||||
|
@ -68,6 +73,7 @@ static void st_collections_group_parts_part_description_color3(void);
|
|||
static void st_collections_group_parts_part_description_text_text(void);
|
||||
static void st_collections_group_parts_part_description_text_text_class(void);
|
||||
static void st_collections_group_parts_part_description_text_font(void);
|
||||
static void st_collections_group_parts_part_description_text_style(void);
|
||||
static void st_collections_group_parts_part_description_text_size(void);
|
||||
static void st_collections_group_parts_part_description_text_fit(void);
|
||||
static void st_collections_group_parts_part_description_text_min(void);
|
||||
|
@ -94,10 +100,16 @@ New_Statement_Handler statement_handlers[] =
|
|||
{"images.image", st_images_image},
|
||||
{"fonts.font", st_fonts_font},
|
||||
{"data.item", st_data_item},
|
||||
{"styles.style.name", st_styles_style_name},
|
||||
{"styles.style.base", st_styles_style_base},
|
||||
{"styles.style.tag", st_styles_style_tag},
|
||||
{"collections.image", st_images_image}, /* dup */
|
||||
{"collections.images.image", st_images_image}, /* dup */
|
||||
{"collections.font", st_fonts_font}, /* dup */
|
||||
{"collections.fonts.font", st_fonts_font}, /* dup */
|
||||
{"collections.styles.style.name", st_styles_style_name}, /* dup */
|
||||
{"collections.styles.style.base", st_styles_style_base}, /* dup */
|
||||
{"collections.styles.style.tag", st_styles_style_tag}, /* dup */
|
||||
{"collections.group.name", st_collections_group_name},
|
||||
{"collections.group.min", st_collections_group_min},
|
||||
{"collections.group.max", st_collections_group_max},
|
||||
|
@ -106,10 +118,16 @@ New_Statement_Handler statement_handlers[] =
|
|||
{"collections.group.images.image", st_images_image}, /* dup */
|
||||
{"collections.group.font", st_fonts_font}, /* dup */
|
||||
{"collections.group.fonts.font", st_fonts_font}, /* dup */
|
||||
{"collections.group.styles.style.name", st_styles_style_name}, /* dup */
|
||||
{"collections.group.styles.style.base", st_styles_style_base}, /* dup */
|
||||
{"collections.group.styles.style.tag", st_styles_style_tag}, /* dup */
|
||||
{"collections.group.parts.image", st_images_image}, /* dup */
|
||||
{"collections.group.parts.images.image", st_images_image}, /* dup */
|
||||
{"collections.group.parts.font", st_fonts_font}, /* dup */
|
||||
{"collections.group.parts.fonts.font", st_fonts_font}, /* dup */
|
||||
{"collections.group.parts.styles.style.name", st_styles_style_name}, /* dup */
|
||||
{"collections.group.parts.styles.style.base", st_styles_style_base}, /* dup */
|
||||
{"collections.group.parts.styles.style.tag", st_styles_style_tag}, /* dup */
|
||||
{"collections.group.parts.part.name", st_collections_group_parts_part_name},
|
||||
{"collections.group.parts.part.type", st_collections_group_parts_part_type},
|
||||
{"collections.group.parts.part.effect", st_collections_group_parts_part_effect},
|
||||
|
@ -124,6 +142,9 @@ New_Statement_Handler statement_handlers[] =
|
|||
{"collections.group.parts.part.images.image", st_images_image}, /* dup */
|
||||
{"collections.group.parts.part.font", st_fonts_font}, /* dup */
|
||||
{"collections.group.parts.part.fonts.font", st_fonts_font}, /* dup */
|
||||
{"collections.group.parts.part.styles.style.name", st_styles_style_name}, /* dup */
|
||||
{"collections.group.parts.part.styles.style.base", st_styles_style_base}, /* dup */
|
||||
{"collections.group.parts.part.styles.style.tag", st_styles_style_tag}, /* dup */
|
||||
{"collections.group.parts.part.description.inherit", st_collections_group_parts_part_description_inherit},
|
||||
{"collections.group.parts.part.description.state", st_collections_group_parts_part_description_state},
|
||||
{"collections.group.parts.part.description.visible", st_collections_group_parts_part_description_visible},
|
||||
|
@ -161,6 +182,7 @@ New_Statement_Handler statement_handlers[] =
|
|||
{"collections.group.parts.part.description.text.text", st_collections_group_parts_part_description_text_text},
|
||||
{"collections.group.parts.part.description.text.text_class", st_collections_group_parts_part_description_text_text_class},
|
||||
{"collections.group.parts.part.description.text.font", st_collections_group_parts_part_description_text_font},
|
||||
{"collections.group.parts.part.description.text.style", st_collections_group_parts_part_description_text_style},
|
||||
{"collections.group.parts.part.description.text.size", st_collections_group_parts_part_description_text_size},
|
||||
{"collections.group.parts.part.description.text.fit", st_collections_group_parts_part_description_text_fit},
|
||||
{"collections.group.parts.part.description.text.min", st_collections_group_parts_part_description_text_min},
|
||||
|
@ -172,6 +194,9 @@ New_Statement_Handler statement_handlers[] =
|
|||
{"collections.group.parts.part.description.images.image", st_images_image}, /* dup */
|
||||
{"collections.group.parts.part.description.font", st_fonts_font}, /* dup */
|
||||
{"collections.group.parts.part.description.fonts.font", st_fonts_font}, /* dup */
|
||||
{"collections.group.parts.part.description.styles.style.name", st_styles_style_name}, /* dup */
|
||||
{"collections.group.parts.part.description.styles.style.base", st_styles_style_base}, /* dup */
|
||||
{"collections.group.parts.part.description.styles.style.tag", st_styles_style_tag}, /* dup */
|
||||
{"collections.group.parts.part.description.programs.image", st_images_image}, /* dup */
|
||||
{"collections.group.parts.part.description.programs.images.image", st_images_image}, /* dup */
|
||||
{"collections.group.parts.part.description.programs.font", st_fonts_font}, /* dup */
|
||||
|
@ -259,21 +284,31 @@ New_Object_Handler object_handlers[] =
|
|||
{"images", NULL},
|
||||
{"fonts", NULL},
|
||||
{"data", NULL},
|
||||
{"styles", NULL},
|
||||
{"styles.style", ob_styles_style},
|
||||
{"collections", ob_collections},
|
||||
{"collections.images", NULL}, /* dup */
|
||||
{"collections.fonts", NULL}, /* dup */
|
||||
{"collections.styles", NULL}, /* dup */
|
||||
{"collections.styles.style", ob_styles_style}, /* dup */
|
||||
{"collections.group", ob_collections_group},
|
||||
{"collections.group.data", NULL},
|
||||
{"collections.group.script", ob_collections_group_script},
|
||||
{"collections.group.images", NULL}, /* dup */
|
||||
{"collections.group.fonts", NULL}, /* dup */
|
||||
{"collections.group.styles", NULL}, /* dup */
|
||||
{"collections.group.styles.style", ob_styles_style}, /* dup */
|
||||
{"collections.group.parts", NULL},
|
||||
{"collections.group.parts.images", NULL}, /* dup */
|
||||
{"collections.group.parts.fonts", NULL}, /* dup */
|
||||
{"collections.group.parts.styles", NULL}, /* dup */
|
||||
{"collections.group.parts.styles.style", ob_styles_style}, /* dup */
|
||||
{"collections.group.parts.part", ob_collections_group_parts_part},
|
||||
{"collections.group.parts.part.dragable", NULL},
|
||||
{"collections.group.parts.part.images", NULL}, /* dup */
|
||||
{"collections.group.parts.part.fonts", NULL}, /* dup */
|
||||
{"collections.group.parts.part.styles", NULL}, /* dup */
|
||||
{"collections.group.parts.part.styles.style", ob_styles_style}, /* dup */
|
||||
{"collections.group.parts.part.description", ob_collections_group_parts_part_description},
|
||||
{"collections.group.parts.part.description.rel1", NULL},
|
||||
{"collections.group.parts.part.description.rel2", NULL},
|
||||
|
@ -286,6 +321,8 @@ New_Object_Handler object_handlers[] =
|
|||
{"collections.group.parts.part.description.text.fonts", NULL}, /* dup */
|
||||
{"collections.group.parts.part.description.images", NULL}, /* dup */
|
||||
{"collections.group.parts.part.description.fonts", NULL}, /* dup */
|
||||
{"collections.group.parts.part.description.styles", NULL}, /* dup */
|
||||
{"collections.group.parts.part.description.styles.style", ob_styles_style}, /* dup */
|
||||
{"collections.group.parts.part.description.program", ob_collections_group_programs_program}, /* dup */
|
||||
{"collections.group.parts.part.description.program.script", ob_collections_group_programs_program_script}, /* dup */
|
||||
{"collections.group.parts.part.description.programs", NULL}, /* dup */
|
||||
|
@ -453,6 +490,67 @@ st_data_item(void)
|
|||
edje_file->data = evas_list_append(edje_file->data, di);
|
||||
}
|
||||
|
||||
static void
|
||||
ob_styles_style(void)
|
||||
{
|
||||
Edje_Style *stl;
|
||||
|
||||
stl = mem_alloc(SZ(Edje_Style));
|
||||
edje_file->styles = evas_list_append(edje_file->styles, stl);
|
||||
}
|
||||
|
||||
static void
|
||||
st_styles_style_name(void)
|
||||
{
|
||||
Edje_Style *stl, *tstl;
|
||||
Evas_List *l;
|
||||
|
||||
stl = evas_list_data(evas_list_last(edje_file->styles));
|
||||
stl->name = parse_str(0);
|
||||
for (l = edje_file->styles; l; l = l->next)
|
||||
{
|
||||
tstl = l->data;
|
||||
if ((stl != tstl) && (!strcmp(stl->name, tstl->name)))
|
||||
{
|
||||
fprintf(stderr, "%s: Error. parse error %s:%i. There is already a style named \"%s\"\n",
|
||||
progname, file_in, line - 1, stl->name);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
st_styles_style_base(void)
|
||||
{
|
||||
Edje_Style *stl;
|
||||
Edje_Style_Tag *tag;
|
||||
|
||||
stl = evas_list_data(evas_list_last(edje_file->styles));
|
||||
if (stl->tags)
|
||||
{
|
||||
fprintf(stderr, "%s: Error. parse error %s:%i. There is already a basic format for the style\n",
|
||||
progname, file_in, line - 1);
|
||||
exit(-1);
|
||||
}
|
||||
tag = mem_alloc(SZ(Edje_Style_Tag));
|
||||
tag->key = mem_strdup("DEFAULT");
|
||||
tag->value = parse_str(0);
|
||||
stl->tags = evas_list_append(stl->tags, tag);
|
||||
}
|
||||
|
||||
static void
|
||||
st_styles_style_tag(void)
|
||||
{
|
||||
Edje_Style *stl;
|
||||
Edje_Style_Tag *tag;
|
||||
|
||||
stl = evas_list_data(evas_list_last(edje_file->styles));
|
||||
tag = mem_alloc(SZ(Edje_Style_Tag));
|
||||
tag->key = parse_str(0);
|
||||
tag->value = parse_str(1);
|
||||
stl->tags = evas_list_append(stl->tags, tag);
|
||||
}
|
||||
|
||||
static void
|
||||
ob_collections(void)
|
||||
{
|
||||
|
@ -624,6 +722,7 @@ st_collections_group_parts_part_type(void)
|
|||
"TEXT", EDJE_PART_TYPE_TEXT,
|
||||
"IMAGE", EDJE_PART_TYPE_IMAGE,
|
||||
"SWALLOW", EDJE_PART_TYPE_SWALLOW,
|
||||
"TEXTBLOCK", EDJE_PART_TYPE_TEXTBLOCK,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@ -1600,13 +1699,14 @@ st_collections_group_parts_part_description_text_text(void)
|
|||
Edje_Part_Collection *pc;
|
||||
Edje_Part *ep;
|
||||
Edje_Part_Description *ed;
|
||||
|
||||
check_arg_count(1);
|
||||
|
||||
char *str = NULL;
|
||||
int i;
|
||||
|
||||
pc = evas_list_data(evas_list_last(edje_collections));
|
||||
ep = evas_list_data(evas_list_last(pc->parts));
|
||||
|
||||
if (ep->type != EDJE_PART_TYPE_TEXT)
|
||||
if ((ep->type != EDJE_PART_TYPE_TEXT) &&
|
||||
(ep->type != EDJE_PART_TYPE_TEXTBLOCK))
|
||||
{
|
||||
fprintf(stderr, "%s: Error. parse error %s:%i. "
|
||||
"text attributes in non-TEXT part.\n",
|
||||
|
@ -1616,7 +1716,21 @@ st_collections_group_parts_part_description_text_text(void)
|
|||
|
||||
ed = ep->default_desc;
|
||||
if (ep->other_desc) ed = evas_list_data(evas_list_last(ep->other_desc));
|
||||
ed->text.text = parse_str(0);
|
||||
for (i = 0; ;i++)
|
||||
{
|
||||
char *s;
|
||||
|
||||
if (!is_param(i)) break;
|
||||
s = parse_str(i);
|
||||
if (!str) str = s;
|
||||
else
|
||||
{
|
||||
str = realloc(str, strlen(str) + strlen(s) + 1);
|
||||
strcat(str, s);
|
||||
free(s);
|
||||
}
|
||||
}
|
||||
ed->text.text = str;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1669,6 +1783,31 @@ st_collections_group_parts_part_description_text_font(void)
|
|||
ed->text.font = parse_str(0);
|
||||
}
|
||||
|
||||
static void
|
||||
st_collections_group_parts_part_description_text_style(void)
|
||||
{
|
||||
Edje_Part_Collection *pc;
|
||||
Edje_Part *ep;
|
||||
Edje_Part_Description *ed;
|
||||
|
||||
check_arg_count(1);
|
||||
|
||||
pc = evas_list_data(evas_list_last(edje_collections));
|
||||
ep = evas_list_data(evas_list_last(pc->parts));
|
||||
|
||||
if (ep->type != EDJE_PART_TYPE_TEXTBLOCK)
|
||||
{
|
||||
fprintf(stderr, "%s: Error. parse error %s:%i. "
|
||||
"text attributes in non-TEXTBLOCK part.\n",
|
||||
progname, file_in, line - 1);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
ed = ep->default_desc;
|
||||
if (ep->other_desc) ed = evas_list_data(evas_list_last(ep->other_desc));
|
||||
ed->text.style = parse_str(0);
|
||||
}
|
||||
|
||||
static void
|
||||
st_collections_group_parts_part_description_text_size(void)
|
||||
{
|
||||
|
|
|
@ -345,6 +345,16 @@ next_token(char *p, char *end, char **new_p, int *delim)
|
|||
memmove(p, p + 1, strlen(p));
|
||||
else if ((*p == '\\') && (*(p + 1) == '\\'))
|
||||
memmove(p, p + 1, strlen(p));
|
||||
else if ((*p == '\\') && (*(p + 1) == 'n'))
|
||||
{
|
||||
memmove(p, p + 1, strlen(p));
|
||||
*p = '\n';
|
||||
}
|
||||
else if ((*p == '\\') && (*(p + 1) == 't'))
|
||||
{
|
||||
memmove(p, p + 1, strlen(p));
|
||||
*p = '\t';
|
||||
}
|
||||
else
|
||||
p++;
|
||||
}
|
||||
|
|
|
@ -429,7 +429,76 @@ _edje_part_recalc_single(Edje *ed,
|
|||
if (ep->swallow_params.min.h > desc->min.h) minh = ep->swallow_params.min.h;
|
||||
}
|
||||
/* if we have text that wants to make the min size the text size... */
|
||||
if ((chosen_desc) && (ep->part->type == EDJE_PART_TYPE_TEXT))
|
||||
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 = "";
|
||||
Edje_Style *stl = NULL;
|
||||
Evas_List *l;
|
||||
|
||||
if (chosen_desc->text.id_source >= 0)
|
||||
{
|
||||
ep->text.source = ed->table_parts[chosen_desc->text.id_source % ed->table_parts_size];
|
||||
style = ep->text.source->chosen_description->text.style;
|
||||
}
|
||||
else
|
||||
{
|
||||
ep->text.source = NULL;
|
||||
style = chosen_desc->text.style;
|
||||
}
|
||||
|
||||
if (chosen_desc->text.id_text_source >= 0)
|
||||
{
|
||||
ep->text.text_source = ed->table_parts[chosen_desc->text.id_text_source % ed->table_parts_size];
|
||||
text = ep->text.text_source->chosen_description->text.text;
|
||||
if (ep->text.text_source->text.text) text = ep->text.text_source->text.text;
|
||||
}
|
||||
else
|
||||
{
|
||||
ep->text.text_source = NULL;
|
||||
text = chosen_desc->text.text;
|
||||
if (ep->text.text) text = ep->text.text;
|
||||
}
|
||||
|
||||
for (l = ed->file->styles; l; l = l->next)
|
||||
{
|
||||
stl = l->data;
|
||||
if (!strcmp(stl->name, style)) break;
|
||||
stl = NULL;
|
||||
}
|
||||
|
||||
if (stl)
|
||||
{
|
||||
char *ptxt;
|
||||
|
||||
if (evas_object_textblock2_style_get(ep->object) != stl->style)
|
||||
evas_object_textblock2_style_set(ep->object, stl->style);
|
||||
ptxt = evas_object_textblock2_text_markup_get(ep->object);
|
||||
if (((!ptxt) && (text)) ||
|
||||
((ptxt) && (text) && (strcmp(ptxt, text))) ||
|
||||
((ptxt) && (!text)))
|
||||
evas_object_textblock2_text_markup_set(ep->object, text);
|
||||
if ((chosen_desc->text.min_x) || (chosen_desc->text.min_y))
|
||||
{
|
||||
int mw = 0, mh = 0;
|
||||
|
||||
if (!chosen_desc->text.min_x)
|
||||
{
|
||||
evas_object_resize(ep->object, params->w, params->h);
|
||||
evas_object_textblock2_size_formatted_get(ep->object, &tw, &th);
|
||||
}
|
||||
else
|
||||
evas_object_textblock2_size_native_get(ep->object, &tw, &th);
|
||||
evas_object_textblock2_style_insets_get(ep->object, &ins_l, &ins_r, &ins_t, &ins_b);
|
||||
mw = ins_l + tw + ins_r;
|
||||
mh = ins_t + th + ins_b;
|
||||
if (mw > minw) minw = mw;
|
||||
if (mh > minh) minh = mh;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((chosen_desc) && (ep->part->type == EDJE_PART_TYPE_TEXT))
|
||||
{
|
||||
char *text;
|
||||
char *font;
|
||||
|
@ -1040,6 +1109,11 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
|
|||
evas_object_move(ep->object, ed->x + p3.x, ed->y + p3.y);
|
||||
evas_object_resize(ep->object, p3.w, p3.h);
|
||||
}
|
||||
else if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK)
|
||||
{
|
||||
evas_object_move(ep->object, ed->x + p3.x, ed->y + p3.y);
|
||||
evas_object_resize(ep->object, p3.w, p3.h);
|
||||
}
|
||||
|
||||
if (ep->swallowed_object)
|
||||
{
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#include "edje_private.h"
|
||||
|
||||
Eet_Data_Descriptor *_edje_edd_edje_file = NULL;
|
||||
Eet_Data_Descriptor *_edje_edd_edje_style = NULL;
|
||||
Eet_Data_Descriptor *_edje_edd_edje_style_tag = NULL;
|
||||
Eet_Data_Descriptor *_edje_edd_edje_data = NULL;
|
||||
Eet_Data_Descriptor *_edje_edd_edje_font_directory = NULL;
|
||||
Eet_Data_Descriptor *_edje_edd_edje_font_directory_entry = NULL;
|
||||
|
@ -38,6 +40,8 @@ void
|
|||
_edje_edd_free(void)
|
||||
{
|
||||
FREED(_edje_edd_edje_file);
|
||||
FREED(_edje_edd_edje_style);
|
||||
FREED(_edje_edd_edje_style_tag);
|
||||
FREED(_edje_edd_edje_data);
|
||||
FREED(_edje_edd_edje_font_directory);
|
||||
FREED(_edje_edd_edje_font_directory_entry);
|
||||
|
@ -101,6 +105,18 @@ _edje_edd_setup(void)
|
|||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_data, Edje_Data, "key", key, EET_T_STRING);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_data, Edje_Data, "value", value, EET_T_STRING);
|
||||
|
||||
_edje_edd_edje_style_tag =
|
||||
NEWD("Edje_Style_Tag",
|
||||
Edje_Style_Tag);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_style_tag, Edje_Style_Tag, "key", key, EET_T_STRING);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_style_tag, Edje_Style_Tag, "value", value, EET_T_STRING);
|
||||
|
||||
_edje_edd_edje_style =
|
||||
NEWD("Edje_Style",
|
||||
Edje_Style);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_style, Edje_Style, "name", name, EET_T_STRING);
|
||||
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_style, Edje_Style, "tags", tags, _edje_edd_edje_style_tag);
|
||||
|
||||
/* the main file directory */
|
||||
_edje_edd_edje_file =
|
||||
NEWD("Edje_File",
|
||||
|
@ -112,6 +128,7 @@ _edje_edd_setup(void)
|
|||
EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "image_dir", image_dir, _edje_edd_edje_image_directory);
|
||||
EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "collection_dir", collection_dir, _edje_edd_edje_part_collection_directory);
|
||||
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_file, Edje_File, "data", data, _edje_edd_edje_data);
|
||||
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_file, Edje_File, "styles", styles, _edje_edd_edje_style);
|
||||
|
||||
/* parts & programs - loaded induvidually */
|
||||
_edje_edd_edje_program_target =
|
||||
|
@ -208,6 +225,7 @@ _edje_edd_setup(void)
|
|||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color3.a", color3.a, EET_T_UCHAR);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "text.text", text.text, EET_T_STRING);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "text.text_class", text.text_class, EET_T_STRING);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "text.style", text.style, EET_T_STRING);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "text.font", text.font, EET_T_STRING);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "text.size", text.size, EET_T_INT);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "text.fit_x", text.fit_x, EET_T_UCHAR);
|
||||
|
|
|
@ -176,6 +176,8 @@ edje_object_file_set(Evas_Object *obj, const char *file, const char *part)
|
|||
evas_object_color_set(rp->object, 0, 0, 0, 0);
|
||||
evas_object_pass_events_set(rp->object, 1);
|
||||
}
|
||||
else if (ep->type == EDJE_PART_TYPE_TEXTBLOCK)
|
||||
rp->object = evas_object_textblock2_add(ed->evas);
|
||||
else
|
||||
{
|
||||
printf("EDJE ERROR: wrong part type %i!\n", ep->type);
|
||||
|
@ -719,7 +721,7 @@ void
|
|||
_edje_file_add(Edje *ed)
|
||||
{
|
||||
Eet_File *ef = NULL;
|
||||
Evas_List *l;
|
||||
Evas_List *l, *ll;
|
||||
int id = -1;
|
||||
|
||||
if (_edje_edd_edje_file == NULL)
|
||||
|
@ -733,7 +735,6 @@ _edje_file_add(Edje *ed)
|
|||
ed->file = _edje_file_cache_find(ed->path);
|
||||
if (!ed->file)
|
||||
{
|
||||
// printf("OPEN EDJE %s\n", ed->path);
|
||||
ef = eet_open(ed->path, EET_FILE_MODE_READ);
|
||||
if (!ef)
|
||||
{
|
||||
|
@ -769,6 +770,59 @@ _edje_file_add(Edje *ed)
|
|||
}
|
||||
}
|
||||
|
||||
for (l = ed->file->styles; l; l = l->next)
|
||||
{
|
||||
Edje_Style *stl;
|
||||
Edje_Style_Tag *tag;
|
||||
char *buf = NULL;
|
||||
int len = 0;
|
||||
int def_done;
|
||||
|
||||
stl = l->data;
|
||||
if (stl->style) break;
|
||||
stl->style = evas_textblock2_style_new();
|
||||
evas_textblock2_style_set(stl->style, (const char *)buf);
|
||||
for (ll = stl->tags; ll; ll = ll->next)
|
||||
{
|
||||
tag = ll->data;
|
||||
len += strlen(tag->key);
|
||||
len += 1;
|
||||
len += 1;
|
||||
len += strlen(tag->value);
|
||||
len += 1;
|
||||
}
|
||||
if (_edje_fontset_append)
|
||||
{
|
||||
len += 1 + strlen("font_fallbacks=") + strlen(_edje_fontset_append);
|
||||
}
|
||||
len += 1 + strlen("font_source=") + strlen(ed->path);
|
||||
buf = malloc(len + 1);
|
||||
buf[0] = 0;
|
||||
for (ll = stl->tags; ll; ll = ll->next)
|
||||
{
|
||||
tag = ll->data;
|
||||
strcat(buf, tag->key);
|
||||
strcat(buf, "='");
|
||||
strcat(buf, tag->value);
|
||||
if ((!def_done) && (!strcmp(tag->key, "DEFAULT")))
|
||||
{
|
||||
if (_edje_fontset_append)
|
||||
{
|
||||
strcat(buf, " ");
|
||||
strcat(buf, "font_fallbacks=");
|
||||
strcat(buf, _edje_fontset_append);
|
||||
}
|
||||
strcat(buf, " ");
|
||||
strcat(buf, "font_source=");
|
||||
strcat(buf, ed->path);
|
||||
def_done = 1;
|
||||
}
|
||||
strcat(buf, "'");
|
||||
}
|
||||
evas_textblock2_style_set(stl->style, buf);
|
||||
free(buf);
|
||||
}
|
||||
|
||||
ed->collection = _edje_collection_find(ed->file, ed->part);
|
||||
if (!ed->collection)
|
||||
{
|
||||
|
@ -1027,6 +1081,26 @@ _edje_file_free(Edje_File *edf)
|
|||
if (edf->compiler) free(edf->compiler);
|
||||
if (edf->collection_cache)
|
||||
_edje_collection_cleanup(edf);
|
||||
while (edf->styles)
|
||||
{
|
||||
Edje_Style *stl;
|
||||
|
||||
stl == edf->styles->data;
|
||||
edf->styles = evas_list_remove_list(edf->styles, edf->styles);
|
||||
while (stl->tags)
|
||||
{
|
||||
Edje_Style_Tag *tag;
|
||||
|
||||
tag = stl->tags->data;
|
||||
stl->tags = evas_list_remove_list(stl->tags, stl->tags);
|
||||
if (tag->key) free(tag->key);
|
||||
if (tag->value) free(tag->value);
|
||||
free(tag);
|
||||
}
|
||||
if (stl->name) free(stl->name);
|
||||
if (stl->style) evas_textblock2_style_free(stl->style);
|
||||
free(stl);
|
||||
}
|
||||
free(edf);
|
||||
}
|
||||
|
||||
|
|
|
@ -68,9 +68,11 @@
|
|||
*/
|
||||
|
||||
typedef struct _Edje_File Edje_File;
|
||||
typedef struct _Edje_Style Edje_Style;
|
||||
typedef struct _Edje_Style_Tag Edje_Style_Tag;
|
||||
typedef struct _Edje_Data Edje_Data;
|
||||
typedef struct _Edje_Font_Directory Edje_Font_Directory;
|
||||
typedef struct _Edje_Font_Directory_Entry Edje_Font_Directory_Entry;
|
||||
typedef struct _Edje_Font_Directory Edje_Font_Directory;
|
||||
typedef struct _Edje_Font_Directory_Entry Edje_Font_Directory_Entry;
|
||||
typedef struct _Edje_Image_Directory Edje_Image_Directory;
|
||||
typedef struct _Edje_Image_Directory_Entry Edje_Image_Directory_Entry;
|
||||
typedef struct _Edje_Program Edje_Program;
|
||||
|
@ -96,7 +98,8 @@ typedef struct _Edje_Part_Description Edje_Part_Description;
|
|||
#define EDJE_PART_TYPE_TEXT 2
|
||||
#define EDJE_PART_TYPE_IMAGE 3
|
||||
#define EDJE_PART_TYPE_SWALLOW 4
|
||||
#define EDJE_PART_TYPE_LAST 5
|
||||
#define EDJE_PART_TYPE_TEXTBLOCK 5
|
||||
#define EDJE_PART_TYPE_LAST 6
|
||||
|
||||
#define EDJE_TEXT_EFFECT_NONE 0
|
||||
#define EDJE_TEXT_EFFECT_PLAIN 1
|
||||
|
@ -160,6 +163,7 @@ struct _Edje_File
|
|||
Edje_Image_Directory *image_dir;
|
||||
Edje_Part_Collection_Directory *collection_dir;
|
||||
Evas_List *data;
|
||||
Evas_List *styles;
|
||||
|
||||
int references;
|
||||
char *compiler;
|
||||
|
@ -170,6 +174,19 @@ struct _Edje_File
|
|||
Evas_List *collection_cache;
|
||||
};
|
||||
|
||||
struct _Edje_Style
|
||||
{
|
||||
char *name;
|
||||
Evas_List *tags;
|
||||
Evas_Textblock_Style *style;
|
||||
};
|
||||
|
||||
struct _Edje_Style_Tag
|
||||
{
|
||||
char *key;
|
||||
char *value;
|
||||
};
|
||||
|
||||
/*----------*/
|
||||
|
||||
struct _Edje_Data
|
||||
|
@ -390,6 +407,7 @@ struct _Edje_Part_Description
|
|||
struct {
|
||||
char *text; /* if "" or NULL, then leave text unchanged */
|
||||
char *text_class; /* how to apply/modify the font */
|
||||
char *style; /* the text style if a tectblock */
|
||||
char *font; /* if a specific font is asked for */
|
||||
|
||||
int size; /* 0 = use user set size */
|
||||
|
@ -528,6 +546,7 @@ struct _Edje_Real_Part
|
|||
struct {
|
||||
char *text;
|
||||
char *font;
|
||||
char *style;
|
||||
int size;
|
||||
struct {
|
||||
double in_w, in_h;
|
||||
|
@ -732,6 +751,8 @@ struct _Edje_Message
|
|||
};
|
||||
|
||||
extern Eet_Data_Descriptor *_edje_edd_edje_file;
|
||||
extern Eet_Data_Descriptor *_edje_edd_edje_style;
|
||||
extern Eet_Data_Descriptor *_edje_edd_edje_style_tag;
|
||||
extern Eet_Data_Descriptor *_edje_edd_edje_data;
|
||||
extern Eet_Data_Descriptor *_edje_edd_edje_font_directory;
|
||||
extern Eet_Data_Descriptor *_edje_edd_edje_font_directory_entry;
|
||||
|
|
|
@ -501,7 +501,8 @@ edje_object_part_text_set(Evas_Object *obj, const char *part, const char *text)
|
|||
if ((!ed) || (!part)) return;
|
||||
rp = _edje_real_part_get(ed, (char *)part);
|
||||
if (!rp) return;
|
||||
if (rp->part->type != EDJE_PART_TYPE_TEXT) return;
|
||||
if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
|
||||
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return;
|
||||
if ((!rp->text.text) && (!text))
|
||||
return;
|
||||
if ((rp->text.text) && (text) &&
|
||||
|
|
Loading…
Reference in New Issue