diff options
author | tegzed <tegzed@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2011-09-07 20:00:13 +0000 |
---|---|---|
committer | tegzed <tegzed@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2011-09-07 20:00:13 +0000 |
commit | 6fbe0cf713ce19309a3f408e816236340eb95911 (patch) | |
tree | d165bde2114eaf1fbd5f7e8b40b628da17addcf4 /navit/command.c | |
parent | 1621540dc487a5f0f670750d72ee919380b989f9 (diff) | |
download | navit-svn-6fbe0cf713ce19309a3f408e816236340eb95911.tar.gz |
add:core: -added possibility to select objects in the command system by filter expressions (Eg: osd[@attr1==1 && (@attr2 != 2 || @attr3 != "strval") ][0]) and optionally indexing the result of filtering
- enabled setting common attributes (x,y,w,h) for OSDs in one place
- removed osd_set_attr() command system function in favour of the new object selection mechanism
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@4768 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/command.c')
-rw-r--r-- | navit/command.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/navit/command.c b/navit/command.c index 228fcbca..1caca790 100644 --- a/navit/command.c +++ b/navit/command.c @@ -15,6 +15,7 @@ #include "command.h" #include "event.h" #include "navit_nls.h" +#include "obj_filter.h" /* gui.fullscreen=!gui.fullscreen @@ -267,6 +268,18 @@ eval_value(struct context *ctx, struct result *res) { op++; } + struct obj_filter_t out; + int parsed_chars = parse_obj_filter(op, &out); + if (parsed_chars) { + struct attr* res_attr = filter_object(ctx->attr, out.iterator_type, out.filter_expr, out.idx); + if (res_attr) { + res->attr = *res_attr; + g_free(res_attr); + ctx->expr = op+parsed_chars; + return; + } + } + if ((op[0] >= 'a' && op[0] <= 'z') || op[0] == '_') { res->attr.type=attr_none; res->var=op; |