From f5c22b148b25ca77e4497e74ff0a230da5f6b1b9 Mon Sep 17 00:00:00 2001 From: rbdpngn Date: Wed, 29 Oct 2003 06:42:03 +0000 Subject: [PATCH] Slight re-organization of color classes, now can be set per-description rather than per-part. This will probably break old edje's. SVN revision: 7759 --- legacy/edje/data/src/e_logo.edc | 2 +- legacy/edje/src/bin/edje_cc_handlers.c | 32 +++++++++++++++----------- legacy/edje/src/lib/edje_calc.c | 4 ++-- legacy/edje/src/lib/edje_data.c | 2 +- legacy/edje/src/lib/edje_load.c | 2 +- legacy/edje/src/lib/edje_private.h | 7 +++--- 6 files changed, 27 insertions(+), 22 deletions(-) diff --git a/legacy/edje/data/src/e_logo.edc b/legacy/edje/data/src/e_logo.edc index c89ff894fc..de3222878f 100644 --- a/legacy/edje/data/src/e_logo.edc +++ b/legacy/edje/data/src/e_logo.edc @@ -143,10 +143,10 @@ collections { parts { part { name, "background"; - color_class, "bg"; mouse_events, 0; description { state, "default" 0.0; + color_class, "bg"; rel1 { relative, 0.0 0.0; offset, 0 0; diff --git a/legacy/edje/src/bin/edje_cc_handlers.c b/legacy/edje/src/bin/edje_cc_handlers.c index fc62922140..f4405306ea 100644 --- a/legacy/edje/src/bin/edje_cc_handlers.c +++ b/legacy/edje/src/bin/edje_cc_handlers.c @@ -22,7 +22,6 @@ static void st_collections_group_parts_part_effect(void); static void st_collections_group_parts_part_mouse_events(void); static void st_collections_group_parts_part_repeat_events(void); static void st_collections_group_parts_part_clip_to_id(void); -static void st_collections_group_parts_part_color_class(void); static void st_collections_group_parts_part_text_class(void); static void st_collections_group_parts_part_dragable_x(void); static void st_collections_group_parts_part_dragable_y(void); @@ -54,6 +53,7 @@ static void st_collections_group_parts_part_description_fill_origin_relative(voi static void st_collections_group_parts_part_description_fill_origin_offset(void); static void st_collections_group_parts_part_description_fill_size_relative(void); static void st_collections_group_parts_part_description_fill_size_offset(void); +static void st_collections_group_parts_part_description_color_class(void); static void st_collections_group_parts_part_description_color(void); static void st_collections_group_parts_part_description_color2(void); static void st_collections_group_parts_part_description_color3(void); @@ -92,7 +92,6 @@ New_Statement_Handler statement_handlers[] = {"collections.group.parts.part.mouse_events", st_collections_group_parts_part_mouse_events}, {"collections.group.parts.part.repeat_events", st_collections_group_parts_part_repeat_events}, {"collections.group.parts.part.clip_to", st_collections_group_parts_part_clip_to_id}, - {"collections.group.parts.part.color_class", st_collections_group_parts_part_color_class}, {"collections.group.parts.part.text_class", st_collections_group_parts_part_text_class}, {"collections.group.parts.part.dragable.x", st_collections_group_parts_part_dragable_x}, {"collections.group.parts.part.dragable.y", st_collections_group_parts_part_dragable_y}, @@ -122,6 +121,7 @@ New_Statement_Handler statement_handlers[] = {"collections.group.parts.part.description.fill.origin.offset", st_collections_group_parts_part_description_fill_origin_offset}, {"collections.group.parts.part.description.fill.size.relative", st_collections_group_parts_part_description_fill_size_relative}, {"collections.group.parts.part.description.fill.size.offset", st_collections_group_parts_part_description_fill_size_offset}, + {"collections.group.parts.part.description.color_class", st_collections_group_parts_part_description_color_class}, {"collections.group.parts.part.description.color", st_collections_group_parts_part_description_color}, {"collections.group.parts.part.description.color2", st_collections_group_parts_part_description_color2}, {"collections.group.parts.part.description.color3", st_collections_group_parts_part_description_color3}, @@ -162,7 +162,6 @@ New_Object_Handler object_handlers[] = {"collections.group.parts.part.mouse_events", NULL}, {"collections.group.parts.part.repeat_events", NULL}, {"collections.group.parts.part.clip_to", NULL}, - {"collections.group.parts.part.color_class", NULL}, {"collections.group.parts.part.text_class", NULL}, {"collections.group.parts.part.dragable", NULL}, {"collections.group.parts.part.dragable.x", NULL}, @@ -200,6 +199,7 @@ New_Object_Handler object_handlers[] = {"collections.group.parts.part.description.fill.size", NULL}, {"collections.group.parts.part.description.fill.size.relative", NULL}, {"collections.group.parts.part.description.fill.size.offset", NULL}, + {"collections.group.parts.part.description.color_class", NULL}, {"collections.group.parts.part.description.color", NULL}, {"collections.group.parts.part.description.color2", NULL}, {"collections.group.parts.part.description.color3", NULL}, @@ -451,17 +451,6 @@ st_collections_group_parts_part_clip_to_id(void) } } -static void -st_collections_group_parts_part_color_class(void) -{ - Edje_Part_Collection *pc; - Edje_Part *ep; - - pc = evas_list_data(evas_list_last(edje_collections)); - ep = evas_list_data(evas_list_last(pc->parts)); - ep->color_class = parse_str(0); -} - static void st_collections_group_parts_part_text_class(void) { @@ -559,6 +548,7 @@ ob_collections_group_parts_part_description(void) ed->fill.pos_abs_y = 0; ed->fill.rel_y = 1.0; ed->fill.abs_y = 0; + ed->color_class = NULL; ed->color.r = 255; ed->color.g = 255; ed->color.b = 255; @@ -995,6 +985,20 @@ st_collections_group_parts_part_description_fill_size_offset(void) ed->fill.abs_y = parse_int(1); } +static void +st_collections_group_parts_part_description_color_class(void) +{ + Edje_Part_Collection *pc; + Edje_Part *ep; + Edje_Part_Description *ed; + + pc = evas_list_data(evas_list_last(edje_collections)); + ep = evas_list_data(evas_list_last(pc->parts)); + ed = ep->default_desc; + if (ep->other_desc) ed = evas_list_data(evas_list_last(ep->other_desc)); + ed->color_class = parse_str(0); +} + static void st_collections_group_parts_part_description_color(void) { diff --git a/legacy/edje/src/lib/edje_calc.c b/legacy/edje/src/lib/edje_calc.c index e41fd070ba..af6394ff74 100644 --- a/legacy/edje/src/lib/edje_calc.c +++ b/legacy/edje/src/lib/edje_calc.c @@ -697,11 +697,11 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep) else p3 = p1; - if ((ep->part->color_class) && (strlen(ep->part->color_class) > 0)) + if ((chosen_desc->color_class) && (strlen(chosen_desc->color_class) > 0)) { Ejde_Color_Class *cc; - cc = _edje_color_class_find(ed, ep->part->color_class); + cc = _edje_color_class_find(ed, chosen_desc->color_class); if (cc) { p3.color.r = (((int)cc->r + 1) * p3.color.r) >> 8; diff --git a/legacy/edje/src/lib/edje_data.c b/legacy/edje/src/lib/edje_data.c index b1734124f4..34df407af4 100644 --- a/legacy/edje/src/lib/edje_data.c +++ b/legacy/edje/src/lib/edje_data.c @@ -141,6 +141,7 @@ _edje_edd_setup(void) EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.pos_abs_y", fill.pos_abs_y, EET_T_INT); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.rel_y", fill.rel_y, EET_T_DOUBLE); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.abs_y", fill.abs_y, EET_T_INT); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color_class", color_class, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color.r", color.r, EET_T_UCHAR); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color.g", color.g, EET_T_UCHAR); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color.b", color.b, EET_T_UCHAR); @@ -172,7 +173,6 @@ _edje_edd_setup(void) EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "effect", effect, EET_T_CHAR); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "mouse_events", mouse_events, EET_T_CHAR); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "clip_to_id", clip_to_id, EET_T_INT); - EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "color_class", color_class, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "text_class", text_class, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_part, Edje_Part, "default_desc", default_desc, _edje_edd_edje_part_description); EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_part, Edje_Part, "other_desc", other_desc, _edje_edd_edje_part_description); diff --git a/legacy/edje/src/lib/edje_load.c b/legacy/edje/src/lib/edje_load.c index d9ba16049e..cd318765fd 100644 --- a/legacy/edje/src/lib/edje_load.c +++ b/legacy/edje/src/lib/edje_load.c @@ -574,7 +574,6 @@ _edje_collection_free(Edje_Part_Collection *ec) ep = ec->parts->data; ec->parts = evas_list_remove(ec->parts, ep); if (ep->name) free(ep->name); - if (ep->color_class) free(ep->color_class); if (ep->text_class) free(ep->text_class); if (ep->default_desc) _edje_collection_free_part_description_free(ep->default_desc); while (ep->other_desc) @@ -612,6 +611,7 @@ _edje_collection_free_part_description_free(Edje_Part_Description *desc) } if (desc->text.text) free(desc->text.text); if (desc->text.font) free(desc->text.font); + if (desc->color_class) free(desc->color_class); free(desc); } diff --git a/legacy/edje/src/lib/edje_private.h b/legacy/edje/src/lib/edje_private.h index 3dabb89850..2f03729460 100644 --- a/legacy/edje/src/lib/edje_private.h +++ b/legacy/edje/src/lib/edje_private.h @@ -235,13 +235,12 @@ struct _Edje_Part unsigned char mouse_events; /* it will affect/respond to mouse events */ unsigned char repeat_events; /* it will repeat events to objects below */ int clip_to_id; /* the part id to clip this one to */ - char *color_class; /* how to modify the color */ char *text_class; /* how to apply/modify the font */ Edje_Part_Description *default_desc; /* the part descriptor for default */ Evas_List *other_desc; /* other possible descriptors */ struct { - char x; /* can u click & drag this bit in x dir */ - char y; /* can u click & drag this bit in y dir */ + signed char x; /* can u click & drag this bit in x dir */ + signed char y; /* can u click & drag this bit in y dir */ int step_x; /* drag jumps n pixels (0 = no limit) */ int step_y; /* drag jumps n pixels (0 = no limit) */ @@ -314,6 +313,8 @@ struct _Edje_Part_Description int abs_y; /* size of fill added to relative fill */ } fill; + char *color_class; /* how to modify the color */ + struct { unsigned char r, g, b, a; /* color for rect or text, shadow etc. */ } color, color2, color3;