* edje: Add filter_state to program.

Patch from "Tristan <blunderer@gmail.com>".


SVN revision: 46048
devs/devilhorns/wayland_egl
Cedric BAIL 14 years ago
parent fb352ec80f
commit 397b718cf1
  1. 1
      legacy/edje/AUTHORS
  2. 35
      legacy/edje/src/bin/edje_cc_handlers.c
  3. 1
      legacy/edje/src/lib/edje_data.c
  4. 28
      legacy/edje/src/lib/edje_edit.c
  5. 1
      legacy/edje/src/lib/edje_load.c
  6. 1
      legacy/edje/src/lib/edje_private.h
  7. 15
      legacy/edje/src/lib/edje_program.c

@ -4,3 +4,4 @@ ZigsMcKenzie <zigsmckenzie@gmail.com>
Cedric BAIL <cedric.bail@free.fr>
Brian Mattern <rephorm@rephorm.com>
Mathieu Taillefumier <mathieu.taillefumier@free.fr>
Tristan <blunderer@gmail.com>

@ -211,7 +211,8 @@ static void st_collections_group_parts_part_description_params_double(void);
static void st_collections_group_programs_program_name(void);
static void st_collections_group_parts_part_description_params_string(void);
static void st_collections_group_programs_program_signal(void);
static void st_collections_group_programs_program_source(void);
static void st_collections_group_programs_program_source(void);
static void st_collections_group_programs_program_filter_state(void);
static void st_collections_group_programs_program_in(void);
static void st_collections_group_programs_program_action(void);
static void st_collections_group_programs_program_transition(void);
@ -485,6 +486,7 @@ New_Statement_Handler statement_handlers[] =
{"collections.group.parts.program.name", st_collections_group_programs_program_name}, /* dup */
{"collections.group.parts.program.signal", st_collections_group_programs_program_signal}, /* dup */
{"collections.group.parts.program.source", st_collections_group_programs_program_source}, /* dup */
{"collections.group.parts.program.filter_state", st_collections_group_programs_program_filter_state}, /* dup */
{"collections.group.parts.program.in", st_collections_group_programs_program_in}, /* dup */
{"collections.group.parts.program.action", st_collections_group_programs_program_action}, /* dup */
{"collections.group.parts.program.transition", st_collections_group_programs_program_transition}, /* dup */
@ -494,6 +496,7 @@ New_Statement_Handler statement_handlers[] =
{"collections.group.program.name", st_collections_group_programs_program_name}, /* dup */
{"collections.group.program.signal", st_collections_group_programs_program_signal}, /* dup */
{"collections.group.program.source", st_collections_group_programs_program_source}, /* dup */
{"collections.group.program.filter_state", st_collections_group_programs_program_filter_state}, /* dup */
{"collections.group.program.in", st_collections_group_programs_program_in}, /* dup */
{"collections.group.program.action", st_collections_group_programs_program_action}, /* dup */
{"collections.group.program.transition", st_collections_group_programs_program_transition}, /* dup */
@ -503,6 +506,7 @@ New_Statement_Handler statement_handlers[] =
{"collections.group.programs.program.name", st_collections_group_programs_program_name},
{"collections.group.programs.program.signal", st_collections_group_programs_program_signal},
{"collections.group.programs.program.source", st_collections_group_programs_program_source},
{"collections.group.programs.program.filter_state", st_collections_group_programs_program_filter_state}, /* dup */
{"collections.group.programs.program.in", st_collections_group_programs_program_in},
{"collections.group.programs.program.action", st_collections_group_programs_program_action},
{"collections.group.programs.program.transition", st_collections_group_programs_program_transition},
@ -5710,6 +5714,7 @@ st_collections_group_parts_part_description_params_string(void)
name: "programname";
signal: "signalname";
source: "partname";
filter_state: "statename";
in: 0.3 0.0;
action: STATE_SET "statename" state_value;
transition: LINEAR 0.5;
@ -5814,7 +5819,7 @@ st_collections_group_programs_program_signal(void)
@effect
Source of accepted signal. Sources may be globbed, but only one source
keyword per program may be used. ex:source: "button-*"; (Signals from
any part or program named "button-*" are accepted)
any part or program named "button-*" are accepted).
@endproperty
*/
static void
@ -5830,6 +5835,32 @@ st_collections_group_programs_program_source(void)
ep->source = parse_str(0);
}
/**
@page edcref
@property
filter_state
@parameters
[filter_state name]
@effect
State of the source part that should accept signal. Only one source state
keyword per program may be used. ex:state: "default"; (Signals from
a part currently in state named "default" are accepted).
@endproperty
*/
static void
st_collections_group_programs_program_filter_state(void)
{
Edje_Part_Collection *pc;
Edje_Program *ep;
check_arg_count(1);
pc = eina_list_data_get(eina_list_last(edje_collections));
ep = eina_list_data_get(eina_list_last(pc->programs));
ep->filter_state = parse_str(0);
}
/**
@page edcref
@property

@ -215,6 +215,7 @@ _edje_edd_init(void)
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "name", name, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "signal", signal, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "source", source, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "filter_state", filter_state, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "in.from", in.from, EET_T_DOUBLE);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "in.range", in.range, EET_T_DOUBLE);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "action", action, EET_T_INT);

@ -4937,6 +4937,7 @@ edje_edit_program_add(Evas_Object *obj, const char *name)
epr->name = eina_stringshare_add(name);
epr->signal = NULL;
epr->source = NULL;
epr->filter_state = NULL;
epr->in.from = 0.0;
epr->in.range = 0.0;
epr->action = 0;
@ -4985,6 +4986,7 @@ edje_edit_program_del(Evas_Object *obj, const char *prog)
_edje_if_string_free(ed, epr->name);
_edje_if_string_free(ed, epr->signal);
_edje_if_string_free(ed, epr->source);
_edje_if_string_free(ed, epr->filter_state);
_edje_if_string_free(ed, epr->state);
_edje_if_string_free(ed, epr->state2);
@ -5150,6 +5152,32 @@ edje_edit_program_source_set(Evas_Object *obj, const char *prog, const char *sou
return 1;
}
EAPI const char *
edje_edit_program_filter_state_get(Evas_Object *obj, const char *prog)
{
GET_EPR_OR_RETURN(NULL);
if (!epr->filter_state) return NULL;
//printf("GET SOURCE for program: %s [%s]\n", prog, epr->source_state);
return eina_stringshare_add(epr->filter_state);
}
EAPI Eina_Bool
edje_edit_program_filter_state_set(Evas_Object *obj, const char *prog, const char *filter_state)
{
GET_ED_OR_RETURN(0);
GET_EPR_OR_RETURN(0);
if (!filter_state) return 0;
//printf("SET SOURCE for program: %s [%s]\n", prog, source);
_edje_if_string_free(ed, epr->filter_state);
epr->filter_state = eina_stringshare_add(filter_state);
return 1;
}
EAPI const char *
edje_edit_program_signal_get(Evas_Object *obj, const char *prog)
{

@ -1096,6 +1096,7 @@ _edje_collection_free(Edje_File *edf, Edje_Part_Collection *ec)
if (pr->name) eina_stringshare_del(pr->name);
if (pr->signal) eina_stringshare_del(pr->signal);
if (pr->source) eina_stringshare_del(pr->source);
if (pr->filter_state) eina_stringshare_del(pr->filter_state);
if (pr->state) eina_stringshare_del(pr->state);
if (pr->state2) eina_stringshare_del(pr->state2);
}

@ -395,6 +395,7 @@ struct _Edje_Program /* a conditional program to be run */
const char *signal; /* if signal emission name matches the glob here... */
const char *source; /* if part that emitted this (name) matches this glob */
const char *filter_state; /* if part state that emitted this (name) matches this */
struct {
double from;

@ -1015,13 +1015,24 @@ struct _Edje_Program_Data
static int _edje_glob_callback(Edje_Program *pr, void *dt)
{
struct _Edje_Program_Data *data = dt;
struct _Edje_Program_Data *data = dt;
Edje_Real_Part *rp = NULL;
Eina_Bool exec = EINA_TRUE;
#ifdef EDJE_PROGRAM_CACHE
data->matched++;
#endif
_edje_program_run(data->ed, pr, 0, data->signal, data->source);
if (pr->filter_state)
{
rp = _edje_real_part_get(data->ed, data->source);
if (rp)
exec = (rp->chosen_description->state.name == pr->filter_state);
}
if (exec)
_edje_program_run(data->ed, pr, 0, data->signal, data->source);
if (_edje_block_break(data->ed))
{
#ifdef EDJE_PROGRAM_CACHE

Loading…
Cancel
Save