You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(4) |
Aug
(59) |
Sep
(43) |
Oct
(95) |
Nov
(135) |
Dec
(108) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(229) |
Feb
(141) |
Mar
(59) |
Apr
(70) |
May
(64) |
Jun
(87) |
Jul
(57) |
Aug
(108) |
Sep
(74) |
Oct
(203) |
Nov
(141) |
Dec
(108) |
| 2009 |
Jan
(114) |
Feb
(91) |
Mar
(101) |
Apr
(69) |
May
(54) |
Jun
(82) |
Jul
(49) |
Aug
(109) |
Sep
(81) |
Oct
(93) |
Nov
(100) |
Dec
(79) |
| 2010 |
Jan
(46) |
Feb
(36) |
Mar
(135) |
Apr
(103) |
May
(116) |
Jun
(130) |
Jul
(52) |
Aug
(31) |
Sep
(46) |
Oct
(48) |
Nov
(98) |
Dec
(110) |
| 2011 |
Jan
(234) |
Feb
(184) |
Mar
(150) |
Apr
(43) |
May
(53) |
Jun
(52) |
Jul
(112) |
Aug
(72) |
Sep
(79) |
Oct
(23) |
Nov
(6) |
Dec
(30) |
| 2012 |
Jan
(39) |
Feb
(37) |
Mar
(49) |
Apr
(60) |
May
(63) |
Jun
(38) |
Jul
(33) |
Aug
(24) |
Sep
(20) |
Oct
(14) |
Nov
(23) |
Dec
(50) |
| 2013 |
Jan
(30) |
Feb
(32) |
Mar
(27) |
Apr
(41) |
May
(59) |
Jun
(21) |
Jul
(10) |
Aug
(73) |
Sep
(23) |
Oct
(60) |
Nov
(14) |
Dec
(15) |
| 2014 |
Jan
(4) |
Feb
(8) |
Mar
(11) |
Apr
(6) |
May
(27) |
Jun
(4) |
Jul
(29) |
Aug
(62) |
Sep
(11) |
Oct
(17) |
Nov
(58) |
Dec
(9) |
| 2015 |
Jan
(23) |
Feb
(3) |
Mar
(26) |
Apr
(47) |
May
(8) |
Jun
(28) |
Jul
(10) |
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <md...@us...> - 2012-12-26 16:05:06
|
Revision: 5330
http://navit.svn.sourceforge.net/navit/?rev=5330&view=rev
Author: mdankov
Date: 2012-12-26 16:04:59 +0000 (Wed, 26 Dec 2012)
Log Message:
-----------
Fix:core:Don't crash on Android when search hits non-latin-1 symbols. Fixes #1086 and its duplicate #1088.
Modified Paths:
--------------
trunk/navit/navit/linguistics.c
trunk/navit/navit/start_real.c
Modified: trunk/navit/navit/linguistics.c
===================================================================
--- trunk/navit/navit/linguistics.c 2012-12-25 21:10:01 UTC (rev 5329)
+++ trunk/navit/navit/linguistics.c 2012-12-26 16:04:59 UTC (rev 5330)
@@ -456,5 +456,6 @@
linguistics_free(void)
{
g_hash_table_destroy(casefold_hash);
+ casefold_hash=NULL;
}
Modified: trunk/navit/navit/start_real.c
===================================================================
--- trunk/navit/navit/start_real.c 2012-12-25 21:10:01 UTC (rev 5329)
+++ trunk/navit/navit/start_real.c 2012-12-26 16:04:59 UTC (rev 5330)
@@ -226,9 +226,11 @@
}
event_main_loop_run();
+ /* TODO: Android actually has no event loop, so we can't free all allocated resources here. Have to find better place to
+ * free all allocations on program exit. And don't forget to free all the stuff allocated in the code above.
+ */
+#ifndef HAVE_API_ANDROID
linguistics_free();
-
-#ifndef HAVE_API_ANDROID
debug_finished();
#endif
return 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2012-12-25 21:10:12
|
Revision: 5329
http://navit.svn.sourceforge.net/navit/?rev=5329&view=rev
Author: mdankov
Date: 2012-12-25 21:10:01 +0000 (Tue, 25 Dec 2012)
Log Message:
-----------
Fix:gui_internal:Do not hang when scrolling with gestures
Modified Paths:
--------------
trunk/navit/navit/gui/internal/gui_internal_gesture.c
Modified: trunk/navit/navit/gui/internal/gui_internal_gesture.c
===================================================================
--- trunk/navit/navit/gui/internal/gui_internal_gesture.c 2012-12-25 17:26:18 UTC (rev 5328)
+++ trunk/navit/navit/gui/internal/gui_internal_gesture.c 2012-12-25 21:10:01 UTC (rev 5329)
@@ -35,7 +35,7 @@
static struct gesture_elem *
gui_internal_gesture_ring_get(struct gui_priv *this, int i)
{
- int n=(this->gesture_ring_last-i)%GESTURE_RINGSIZE;
+ int n=(this->gesture_ring_last-i+GESTURE_RINGSIZE)%GESTURE_RINGSIZE;
if(n==this->gesture_ring_first)
return NULL;
return this->gesture_ring+n;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2012-12-25 17:26:27
|
Revision: 5328
http://navit.svn.sourceforge.net/navit/?rev=5328&view=rev
Author: martin-s
Date: 2012-12-25 17:26:18 +0000 (Tue, 25 Dec 2012)
Log Message:
-----------
Fix:gui_internal:Moved vehicle config to xml
Modified Paths:
--------------
trunk/navit/navit/gui/internal/gui_internal_command.c
trunk/navit/navit/navit_shipped.xml
Modified: trunk/navit/navit/gui/internal/gui_internal_command.c
===================================================================
--- trunk/navit/navit/gui/internal/gui_internal_command.c 2012-12-25 17:23:10 UTC (rev 5327)
+++ trunk/navit/navit/gui/internal/gui_internal_command.c 2012-12-25 17:26:18 UTC (rev 5328)
@@ -241,72 +241,6 @@
}
static void
-gui_internal_cmd_vehicles_page(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- struct attr vehicle,cvehicle;
- struct attr_iter *iter;
- char *document=g_strdup("<html>");
-
- navit_get_attr(this->nav, attr_vehicle, &cvehicle, NULL);
- iter=navit_attr_iter_new();
- while(navit_get_attr(this->nav, attr_vehicle, &vehicle, iter)) {
- struct attr name;
- if (!vehicle_get_attr(vehicle.u.vehicle, attr_name, &name, NULL))
- name.u.str="Unknown";
- document=g_strconcat_printf(document, "<img class='centry' src='%s' onclick='name=\"%s\";menu(\"#Settings Vehicle\")'>%s</img>",vehicle.u.vehicle == cvehicle.u.vehicle ? "gui_active":"gui_inactive",name.u.str,name.u.str);
- }
- navit_attr_iter_destroy(iter);
- document=g_strconcat_printf(document, "</html>");
- gui_internal_html_parse_text(this, document);
- g_free(document);
-}
-
-static void
-gui_internal_cmd_vehicle_page(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- struct attr vehicle,cvehicle;
- struct attr_iter *iter;
- if (!in || !in[0] || !ATTR_IS_STRING(in[0]->type) || !in[0]->u.str) {
- dbg(0,"first parameter missing or wrong type\n");
- return;
- }
- navit_get_attr(this->nav, attr_vehicle, &cvehicle, NULL);
- iter=navit_attr_iter_new();
- while(navit_get_attr(this->nav, attr_vehicle, &vehicle, iter)) {
- struct attr name;
- if (!vehicle_get_attr(vehicle.u.vehicle, attr_name, &name, NULL))
- name.u.str="Unknown";
- if (!strcmp(name.u.str,in[0]->u.str)) {
- char *document=g_strdup("<html>");
- struct attr attr,vehicleprofile,profilename,name2;
- struct attr_iter *iter2=navit_attr_iter_new();
- if (!vehicle_get_attr(vehicle.u.vehicle, attr_profilename, &profilename, NULL))
- profilename.u.str="Unknown";
- if (cvehicle.u.vehicle != vehicle.u.vehicle) {
- document=g_strconcat_printf(document, "<img class='centry' src='gui_active' onclick='set(\"navit.vehicle=navit.vehicle[@name=*]\",E(\"%s\"));refresh()'>%s</img>",name.u.str,_("Set as active"));
- }
- while (navit_get_attr(this->nav, attr_vehicleprofile, &vehicleprofile, iter2)) {
- if (vehicleprofile_get_attr(vehicleprofile.u.vehicleprofile, attr_name, &name2, NULL)) {
- document=g_strconcat_printf(document, "<img class='centry' src='%s' onclick='set(\"navit.vehicle[@name==\\\"%s\\\"].profilename=*\",E(\"%s\"));refresh()'>%s</img>",!strcmp(profilename.u.str,name2.u.str) ? "gui_active":"gui_inactive",name.u.str,name2.u.str,name2.u.str);
- }
- }
- if (vehicle_get_attr(vehicle.u.vehicle, attr_position_sat_item, &attr, NULL)) {
- document=g_strconcat_printf(document, "<a href='#Satellite Status'><img class='centry' src='gui_active'>%s</img></a>",_("Show Satellite status"));
- }
- if (vehicle_get_attr(vehicle.u.vehicle, attr_position_nmea, &attr, NULL)) {
- document=g_strconcat_printf(document, "<a href='#NMEA Data'><img class='centry' src='gui_active'>%s</img></a>",_("Show NMEA data"));
- }
- navit_attr_iter_destroy(iter2);
- document=g_strconcat_printf(document, "</html>");
- gui_internal_html_parse_text(this, document);
- g_free(document);
- break;
- }
- }
- navit_attr_iter_destroy(iter);
-}
-
-static void
gui_internal_cmd2_setting_vehicle(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
{
struct attr attr,attr2,vattr;
@@ -1079,8 +1013,6 @@
{"town",command_cast(gui_internal_cmd2)},
{"enter_coord",command_cast(gui_internal_cmd2)},
{"quit",command_cast(gui_internal_cmd2_quit)},
- {"vehicles_page",command_cast(gui_internal_cmd_vehicles_page)},
- {"vehicle_page",command_cast(gui_internal_cmd_vehicle_page)},
{"waypoints",command_cast(gui_internal_cmd2)},
{"write",command_cast(gui_internal_cmd_write)},
{"about",command_cast(gui_internal_cmd2)},
Modified: trunk/navit/navit/navit_shipped.xml
===================================================================
--- trunk/navit/navit/navit_shipped.xml 2012-12-25 17:23:10 UTC (rev 5327)
+++ trunk/navit/navit/navit_shipped.xml 2012-12-25 17:26:18 UTC (rev 5328)
@@ -135,10 +135,39 @@
</script>
</a>
<a name='Settings Vehicles' class='clist'><text>Vehicle</text>
- <script>vehicles_page()</script>
+ <script>
+ foreach(vehicle;navit.vehicle)
+ write("<img class='centry'",
+ " src='", navit.vehicle==vehicle?"gui_active":"gui_inactive", "'",
+ " onclick='name=", E(vehicle.name), ";menu(", E("#Settings Vehicle"), ")'",
+ ">",
+ vehicle.name,
+ "</img>"
+ );
+ </script>
</a>
<a name='Settings Vehicle' class='clist'><script>write(name)</script>
- <script>vehicle_page(name)</script>
+ <script>
+ foreach(vehicle;navit.vehicle)
+ if (vehicle.name == name) {
+ if (vehicle!=navit.vehicle)
+ write("<img class='centry'",
+ " src='gui_active' ",
+ " onclick='set(", E("navit.vehicle=navit.vehicle[@name==*]"), ",E(", E(name), "));refresh()'",
+ ">",
+ "Set as active",
+ "</img>"
+ );
+ foreach(vehicleprofile;navit.vehicleprofile)
+ write("<img class='centry'",
+ " src='", vehicle.profilename==vehicleprofile.name?"gui_active":"gui_inactive", "'",
+ " onclick='set(", E("navit.vehicle[@name=="+E(name)+"].profilename=*"), ",E(", E(vehicleprofile.name), "));refresh()'",
+ ">",
+ vehicleprofile.name,
+ "</img>"
+ );
+ }
+ </script>
</a>
<a name='Satellite Status' class='clist'><text>Satellite Status</text>
<script>satellite_status_page()</script>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2012-12-25 17:23:16
|
Revision: 5327
http://navit.svn.sourceforge.net/navit/?rev=5327&view=rev
Author: martin-s
Date: 2012-12-25 17:23:10 +0000 (Tue, 25 Dec 2012)
Log Message:
-----------
Fix:Core:Correct handling of braces and != tests in commands
Modified Paths:
--------------
trunk/navit/navit/command.c
Modified: trunk/navit/navit/command.c
===================================================================
--- trunk/navit/navit/command.c 2012-12-25 17:22:19 UTC (rev 5326)
+++ trunk/navit/navit/command.c 2012-12-25 17:23:10 UTC (rev 5327)
@@ -72,7 +72,7 @@
};
enum error {
- no_error=0, missing_double_quote, missing_opening_parenthesis, missing_closing_parenthesis, missing_closing_brace, missing_colon, missing_semicolon, wrong_type, illegal_number_format, illegal_character, missing_closing_bracket, invalid_type, not_ready, internal
+ no_error=0, missing_double_quote, missing_opening_parenthesis, missing_closing_parenthesis, missing_closing_brace, missing_colon, missing_semicolon, wrong_type, illegal_number_format, illegal_character, missing_closing_bracket, invalid_type, not_ready, internal, eof_reached
};
enum op_type {
@@ -379,8 +379,9 @@
set_int(ctx, inout, (!!strcmp(s1,s2)));
g_free(s1);
g_free(s2);
- }
- else
+ } else if (ATTR_IS_OBJECT(inout->attr.type) && ATTR_IS_OBJECT(in->attr.type)) {
+ set_int(ctx, inout, inout->attr.u.data != in->attr.u.data);
+ } else
set_int(ctx, inout, (get_int(ctx, inout) != get_int(ctx, in)));
return;
case ('<' << 8):
@@ -553,7 +554,12 @@
ctx->expr=op;
return;
}
- ctx->error=illegal_character;
+ if (!*op)
+ ctx->error=eof_reached;
+ else {
+ dbg(0,"illegal character 0x%x\n",*op);
+ ctx->error=illegal_character;
+ }
}
static int
@@ -1271,10 +1277,9 @@
}
return 1;
case '{':
- while (command_evaluate_single(ctx));
- if (!get_op(ctx,0,"}",NULL)) {
- ctx->error=missing_closing_brace;
- return 0;
+ while (!get_op(ctx,0,"}",NULL)) {
+ if (!command_evaluate_single(ctx))
+ return 0;
}
return 1;
default:
@@ -1298,8 +1303,12 @@
if (!command_evaluate_single(&ctx))
break;
}
- if (ctx.error)
- dbg(0,"error %d\n",ctx.error);
+ if (ctx.error && ctx.error != eof_reached) {
+ char expr[32];
+ strncpy(expr, ctx.expr, 32);
+ expr[31]='\0';
+ dbg(0,"error %d starting at %s\n",ctx.error,expr);
+ }
g_free(expr_dup);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2012-12-25 17:22:26
|
Revision: 5326
http://navit.svn.sourceforge.net/navit/?rev=5326&view=rev
Author: martin-s
Date: 2012-12-25 17:22:19 +0000 (Tue, 25 Dec 2012)
Log Message:
-----------
Fix:Core:Handle null attribute correctly
Modified Paths:
--------------
trunk/navit/navit/attr.c
Modified: trunk/navit/navit/attr.c
===================================================================
--- trunk/navit/navit/attr.c 2012-12-25 14:29:13 UTC (rev 5325)
+++ trunk/navit/navit/attr.c 2012-12-25 17:22:19 UTC (rev 5326)
@@ -522,6 +522,8 @@
int
attr_data_size(struct attr *attr)
{
+ if (attr->type == attr_none)
+ return 0;
if (attr->type >= attr_type_string_begin && attr->type <= attr_type_string_end)
return strlen(attr->u.str)+1;
if (attr->type >= attr_type_int_begin && attr->type <= attr_type_int_end)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2012-12-25 14:29:19
|
Revision: 5325
http://navit.svn.sourceforge.net/navit/?rev=5325&view=rev
Author: martin-s
Date: 2012-12-25 14:29:13 +0000 (Tue, 25 Dec 2012)
Log Message:
-----------
Fix:gui_internal:Removed obsolete maps config page
Modified Paths:
--------------
trunk/navit/navit/gui/internal/gui_internal_command.c
Modified: trunk/navit/navit/gui/internal/gui_internal_command.c
===================================================================
--- trunk/navit/navit/gui/internal/gui_internal_command.c 2012-12-25 14:28:18 UTC (rev 5324)
+++ trunk/navit/navit/gui/internal/gui_internal_command.c 2012-12-25 14:29:13 UTC (rev 5325)
@@ -379,41 +379,6 @@
}
static void
-gui_internal_cmd_maps_page(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- struct attr mapset,map;
- struct attr_iter *iter;
- char *document=g_strdup("<html>");
-
- navit_get_attr(this->nav, attr_mapset, &mapset, NULL);
- iter=mapset_attr_iter_new();
- while(mapset_get_attr(mapset.u.mapset, attr_map, &map, iter)) {
- struct attr description,type,data,active;
- char *attr,*val,*label;
- if (map_get_attr(map.u.map, attr_description, &description, NULL)) {
- label=g_strdup(description.u.str);
- val=description.u.str;
- attr="description";
- } else {
- if (!map_get_attr(map.u.map, attr_type, &type, NULL))
- type.u.str="";
- if (!map_get_attr(map.u.map, attr_data, &data, NULL))
- data.u.str="";
- val=data.u.str;
- attr="data";
- label=g_strdup_printf("%s:%s",type.u.str,data.u.str);
- }
- if (!map_get_attr(map.u.map, attr_active, &active, NULL))
- active.u.num=1;
- document=g_strconcat_printf(document, "<img class='centry' src='%s' onclick='set(\"navit.mapset.map[@%s==\\\"%s\\\"].active=*\",%d);redraw_map();refresh()'>%s</img>",active.u.num ? "gui_active":"gui_inactive",attr,val,!active.u.num,label);
- }
- mapset_attr_iter_destroy(iter);
- document=g_strconcat_printf(document, "</html>");
- gui_internal_html_parse_text(this, document);
- g_free(document);
-}
-
-static void
gui_internal_cmd2_setting_maps(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
{
struct attr attr, on, off, description, type, data, url, active;
@@ -1099,7 +1064,6 @@
{"get_data",command_cast(gui_internal_get_data)},
{"locale",command_cast(gui_internal_cmd2)},
{"log",command_cast(gui_internal_cmd_log)},
- {"maps_page",command_cast(gui_internal_cmd_maps_page)},
{"menu",command_cast(gui_internal_cmd_menu2)},
{"position",command_cast(gui_internal_cmd2_position)},
{"pois",command_cast(gui_internal_cmd2)},
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2012-12-25 14:28:25
|
Revision: 5324
http://navit.svn.sourceforge.net/navit/?rev=5324&view=rev
Author: martin-s
Date: 2012-12-25 14:28:18 +0000 (Tue, 25 Dec 2012)
Log Message:
-----------
Add:XML:Made maps page scripted
Modified Paths:
--------------
trunk/navit/navit/navit_shipped.xml
Modified: trunk/navit/navit/navit_shipped.xml
===================================================================
--- trunk/navit/navit/navit_shipped.xml 2012-12-25 14:24:51 UTC (rev 5323)
+++ trunk/navit/navit/navit_shipped.xml 2012-12-25 14:28:18 UTC (rev 5324)
@@ -112,7 +112,27 @@
</script>
</a>
<a name='Settings Maps' class='clist'><text>Maps</text>
- <script>maps_page()</script>
+ <script>
+ foreach(map;navit.mapset.map)
+ if (map.description)
+ write("<img class='centry'",
+ " src='", map.active?"gui_active":"gui_inactive", "'",
+ " onclick='set(", E("navit.mapset.map[@description=="+E(map.description)+"].active=*"), ",", !map.active, ");redraw_map();refresh()'",
+ ">",
+ map.description,
+ "</img>"
+ );
+ else
+ write("<img class='centry'",
+ " src='", map.active?"gui_active":"gui_inactive", "'",
+ " onclick='set(", E("navit.mapset.map[@data=="+E(map.data)+"].active=*"), ",", !map.active, ");redraw_map();refresh()'",
+ ">",
+ map.type,":",map.data,
+ "</img>"
+ );
+
+
+ </script>
</a>
<a name='Settings Vehicles' class='clist'><text>Vehicle</text>
<script>vehicles_page()</script>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2012-12-25 14:24:58
|
Revision: 5323
http://navit.svn.sourceforge.net/navit/?rev=5323&view=rev
Author: martin-s
Date: 2012-12-25 14:24:51 +0000 (Tue, 25 Dec 2012)
Log Message:
-----------
Fix:Core:Fixed boolean command operations, allow concatenuation of strings
Modified Paths:
--------------
trunk/navit/navit/command.c
Modified: trunk/navit/navit/command.c
===================================================================
--- trunk/navit/navit/command.c 2012-12-25 14:23:51 UTC (rev 5322)
+++ trunk/navit/navit/command.c 2012-12-25 14:24:51 UTC (rev 5323)
@@ -118,7 +118,7 @@
va_start(ap, test);
while ((op = va_arg(ap, char *))) {
if (!strncmp(ctx->expr, op, strlen(op))) {
- ret=ctx->expr;
+ ret=op;
if (! test)
ctx->expr+=strlen(op);
break;
@@ -281,7 +281,7 @@
static int
-get_int(struct context *ctx, struct result *res)
+get_int_bool(struct context *ctx, int is_bool, struct result *res)
{
resolve(ctx, res, NULL);
if (res->attr.type == attr_none)
@@ -292,14 +292,25 @@
if (res->attr.type >= attr_type_double_begin && res->attr.type <= attr_type_double_end) {
return (int) (*res->attr.u.numd);
}
+ if (is_bool && ATTR_IS_OBJECT(res->attr.type))
+ return res->attr.u.data != NULL;
+ if (is_bool && ATTR_IS_STRING(res->attr.type))
+ return res->attr.u.data != NULL;
+ dbg(0,"bool %d %s\n",is_bool,attr_to_name(res->attr.type));
ctx->error=wrong_type;
return 0;
}
static int
+get_int(struct context *ctx, struct result *res)
+{
+ return get_int_bool(ctx, 0, res);
+}
+
+static int
get_bool(struct context *ctx, struct result *res)
{
- return !!get_int(ctx, res);
+ return !!get_int_bool(ctx, 1, res);
}
@@ -334,24 +345,15 @@
return;
switch (op_type) {
case op_type_prefix:
- switch ((op[0] << 8) || op[1]) {
+ switch ((op[0] << 8) | op[1]) {
case ('!' << 8):
- resolve(ctx, inout, NULL);
- switch (op[1]) {
- case '\0':
- set_int(ctx, inout, !get_int(ctx, inout));
- return;
- }
- break;
+ set_int(ctx, inout, !get_bool(ctx, inout));
+ return;
case ('~' << 8):
- resolve(ctx, inout, NULL);
- switch (op[1]) {
- case '\0':
- set_int(ctx, inout, ~get_int(ctx, inout));
- return;
- }
- break;
+ set_int(ctx, inout, ~get_int(ctx, inout));
+ return;
}
+ break;
case op_type_binary:
resolve(ctx, inout, NULL);
resolve(ctx, in, NULL);
@@ -411,7 +413,13 @@
case ('+' << 8):
if (is_double(inout) || is_double(in))
set_double(ctx, inout, get_double(ctx, inout) + get_double(ctx, in));
- else
+ else if (ATTR_IS_STRING(inout->attr.type) && ATTR_IS_STRING(in->attr.type)) {
+ char *str=g_strdup_printf("%s%s",inout->attr.u.str,in->attr.u.str);
+ result_free(inout);
+ inout->attr.type=attr_type_string_begin;
+ inout->attr.u.str=str;
+ inout->allocated=1;
+ } else
set_int(ctx, inout, get_int(ctx, inout) + get_int(ctx, in));
return;
case ('-' << 8):
@@ -1290,6 +1298,8 @@
if (!command_evaluate_single(&ctx))
break;
}
+ if (ctx.error)
+ dbg(0,"error %d\n",ctx.error);
g_free(expr_dup);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2012-12-25 14:23:57
|
Revision: 5322
http://navit.svn.sourceforge.net/navit/?rev=5322&view=rev
Author: martin-s
Date: 2012-12-25 14:23:51 +0000 (Tue, 25 Dec 2012)
Log Message:
-----------
Fix:Core:Provide reasonable active default value
Modified Paths:
--------------
trunk/navit/navit/map.c
Modified: trunk/navit/navit/map.c
===================================================================
--- trunk/navit/navit/map.c 2012-12-25 14:23:09 UTC (rev 5321)
+++ trunk/navit/navit/map.c 2012-12-25 14:23:51 UTC (rev 5322)
@@ -145,6 +145,11 @@
ret=this_->meth.map_get_attr(this_->priv, type, attr);
if (!ret)
ret=attr_generic_get_attr(this_->attrs, NULL, type, attr, iter);
+ if (!ret && type == attr_active) {
+ attr->type=type;
+ attr->u.num=1;
+ return 1;
+ }
return ret;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2012-12-25 14:23:16
|
Revision: 5321
http://navit.svn.sourceforge.net/navit/?rev=5321&view=rev
Author: martin-s
Date: 2012-12-25 14:23:09 +0000 (Tue, 25 Dec 2012)
Log Message:
-----------
Fix:gui_internal:Improved escape and write functions
Modified Paths:
--------------
trunk/navit/navit/gui/internal/gui_internal_command.c
Modified: trunk/navit/navit/gui/internal/gui_internal_command.c
===================================================================
--- trunk/navit/navit/gui/internal/gui_internal_command.c 2012-12-25 10:46:19 UTC (rev 5320)
+++ trunk/navit/navit/gui/internal/gui_internal_command.c 2012-12-25 14:23:09 UTC (rev 5321)
@@ -79,6 +79,8 @@
gui_internal_cmd_escape(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
{
struct attr escaped;
+ int len;
+ char *src,*dst;
if (!in || !in[0] || !ATTR_IS_STRING(in[0]->type)) {
dbg(0,"first parameter missing or wrong type\n");
return;
@@ -87,8 +89,26 @@
dbg(0,"output missing\n");
return;
}
+ src=in[0]->u.str;
+ len=3;
+ while (*src) {
+ if (*src == '"' || *src == '\\')
+ len++;
+ len++;
+ src++;
+ }
escaped.type=in[0]->type;
- escaped.u.str=g_strdup_printf("\"%s\"",in[0]->u.str);
+ src=in[0]->u.str;
+ dst=g_malloc(len);
+ escaped.u.str=dst;
+ *dst++='"';
+ while (*src) {
+ if (*src == '"' || *src == '\\')
+ *dst++='\\';
+ *dst++=*src++;
+ }
+ *dst++='"';
+ *dst++='\0';
dbg(1,"in %s result %s\n",in[0]->u.str,escaped.u.str);
*out=attr_generic_add_attr(*out, attr_dup(&escaped));
g_free(escaped.u.str);
@@ -985,6 +1005,9 @@
str=g_strconcat_printf(str,"%s",str2);
g_free(str2);
}
+ if (ATTR_IS_INT((*in)->type)) {
+ str=g_strconcat_printf(str,"%d",(*in)->u.num);
+ }
in++;
}
if (str) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2012-12-25 10:46:26
|
Revision: 5320
http://navit.svn.sourceforge.net/navit/?rev=5320&view=rev
Author: martin-s
Date: 2012-12-25 10:46:19 +0000 (Tue, 25 Dec 2012)
Log Message:
-----------
Fix:gui_internal:Removed obsolete layouts setting page
Modified Paths:
--------------
trunk/navit/navit/gui/internal/gui_internal_command.c
Modified: trunk/navit/navit/gui/internal/gui_internal_command.c
===================================================================
--- trunk/navit/navit/gui/internal/gui_internal_command.c 2012-12-25 10:45:17 UTC (rev 5319)
+++ trunk/navit/navit/gui/internal/gui_internal_command.c 2012-12-25 10:46:19 UTC (rev 5320)
@@ -440,27 +440,6 @@
}
static void
-gui_internal_cmd_layouts_page(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- struct attr layout,clayout;
- struct attr_iter *iter;
- char *document=g_strdup("<html>");
-
- navit_get_attr(this->nav, attr_layout, &clayout, NULL);
- iter=navit_attr_iter_new();
- while(navit_get_attr(this->nav, attr_layout, &layout, iter)) {
- struct attr name;
- if (!layout_get_attr(layout.u.layout, attr_name, &name, NULL))
- name.u.str="Unknown";
- document=g_strconcat_printf(document, "<img class='centry' src='%s' onclick='set(\"navit.layout=navit.layout[@name==*]\",E(\"%s\"))'>%s</img>",layout.u.layout == clayout.u.layout ? "gui_active":"gui_inactive",name.u.str,name.u.str);
- }
- navit_attr_iter_destroy(iter);
- document=g_strconcat_printf(document, "</html>");
- gui_internal_html_parse_text(this, document);
- g_free(document);
-}
-
-static void
gui_internal_cmd2_setting_layout(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
{
struct attr attr;
@@ -1095,7 +1074,6 @@
{"debug",command_cast(gui_internal_cmd_debug)},
{"formerdests",command_cast(gui_internal_cmd2)},
{"get_data",command_cast(gui_internal_get_data)},
- {"layouts_page",command_cast(gui_internal_cmd_layouts_page)},
{"locale",command_cast(gui_internal_cmd2)},
{"log",command_cast(gui_internal_cmd_log)},
{"maps_page",command_cast(gui_internal_cmd_maps_page)},
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2012-12-25 10:45:27
|
Revision: 5319
http://navit.svn.sourceforge.net/navit/?rev=5319&view=rev
Author: martin-s
Date: 2012-12-25 10:45:17 +0000 (Tue, 25 Dec 2012)
Log Message:
-----------
Add:XML:Scripted layout setting page
Modified Paths:
--------------
trunk/navit/navit/navit_shipped.xml
Modified: trunk/navit/navit/navit_shipped.xml
===================================================================
--- trunk/navit/navit/navit_shipped.xml 2012-12-25 10:40:40 UTC (rev 5318)
+++ trunk/navit/navit/navit_shipped.xml 2012-12-25 10:45:17 UTC (rev 5319)
@@ -100,7 +100,16 @@
<script>position(click_coord_geo,_("Map Point"),8|16|32|64|256)</script>
</a>
<a name='Settings Layouts' class='clist' refresh_cond='navit.layout'><text>Layout</text>
- <script>layouts_page()</script>
+ <script>
+ foreach(layout;navit.layout)
+ write("<img class='centry'",
+ " src='", navit.layout==layout?"gui_active":"gui_inactive", "'",
+ " onclick='set(", E("navit.layout=navit.layout[@name==*]"), ",E(",E(layout.name), "))'",
+ ">",
+ layout.name,
+ "</img>"
+ );
+ </script>
</a>
<a name='Settings Maps' class='clist'><text>Maps</text>
<script>maps_page()</script>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2012-12-25 10:40:46
|
Revision: 5318
http://navit.svn.sourceforge.net/navit/?rev=5318&view=rev
Author: martin-s
Date: 2012-12-25 10:40:40 +0000 (Tue, 25 Dec 2012)
Log Message:
-----------
Add:Core:Added foreach and if/then/else command to script interpreter
Modified Paths:
--------------
trunk/navit/navit/command.c
Modified: trunk/navit/navit/command.c
===================================================================
--- trunk/navit/navit/command.c 2012-12-25 10:39:34 UTC (rev 5317)
+++ trunk/navit/navit/command.c 2012-12-25 10:40:40 UTC (rev 5318)
@@ -72,7 +72,7 @@
};
enum error {
- no_error=0, missing_double_quote, missing_opening_parenthesis, missing_closing_parenthesis, missing_closing_brace, missing_colon, wrong_type, illegal_number_format, illegal_character, missing_closing_bracket, invalid_type, not_ready, internal
+ no_error=0, missing_double_quote, missing_opening_parenthesis, missing_closing_parenthesis, missing_closing_brace, missing_colon, missing_semicolon, wrong_type, illegal_number_format, illegal_character, missing_closing_bracket, invalid_type, not_ready, internal
};
enum op_type {
@@ -364,8 +364,9 @@
set_int(ctx, inout, (!strcmp(s1,s2)));
g_free(s1);
g_free(s2);
- }
- else
+ } else if (ATTR_IS_OBJECT(inout->attr.type) && ATTR_IS_OBJECT(in->attr.type)) {
+ set_int(ctx, inout, inout->attr.u.data == in->attr.u.data);
+ } else
set_int(ctx, inout, (get_int(ctx, inout) == get_int(ctx, in)));
return;
case ('!' << 8)|'=':
@@ -1144,11 +1145,16 @@
int
command_evaluate_single(struct context *ctx)
{
- struct result res={{0,},};
- const char *op;
+ struct result res={{0,},},tmp={{0,},};
+ const char *op,*a1,*a2,*a3,*f,*end;
+ enum attr_type attr_type;
+ void *obj;
+ struct object_func *obj_func;
+ struct attr_iter *iter;
+ struct attr attr;
int cond=0;
int skip=ctx->skip;
- if (!(op=get_op(ctx,0,"if","{",NULL))) {
+ if (!(op=get_op(ctx,0,"foreach","if","{",NULL))) {
eval_comma(ctx,&res);
if (ctx->error)
return 0;
@@ -1159,6 +1165,75 @@
return get_op(ctx,0,";",NULL) != NULL;
}
switch (op[0]) {
+ case 'f':
+ if (!get_op(ctx,0,"(",NULL)) {
+ ctx->error=missing_opening_parenthesis;
+ return 0;
+ }
+ ctx->skip=1;
+ a1=ctx->expr;
+ eval_conditional(ctx, &res);
+ resolve_object(ctx, &res);
+ ctx->skip=skip;
+ if (!get_op(ctx,0,";",NULL)) {
+ ctx->error=missing_semicolon;
+ return 0;
+ }
+ a2=ctx->expr;
+ eval_comma(ctx,&res);
+ attr_type=command_attr_type(&res);
+ obj=res.attr.u.data;
+ obj_func=object_func_lookup(res.attr.type);
+ if (!get_op(ctx,0,")",NULL)) {
+ ctx->error=missing_closing_parenthesis;
+ return 0;
+ }
+ f=ctx->expr;
+ ctx->skip=1;
+ if (!command_evaluate_single(ctx)) {
+ ctx->skip=skip;
+ return 0;
+ }
+ ctx->skip=skip;
+ if (ctx->skip) {
+ result_free(&res);
+ return 1;
+ }
+ end=ctx->expr;
+ if (!obj) {
+ dbg(0,"no object\n");
+ return 0;
+ }
+ if (!obj_func) {
+ dbg(0,"no object func\n");
+ return 0;
+ }
+ if (!obj_func->iter_new || !obj_func->iter_destroy) {
+ dbg(0,"no iter func\n");
+ return 0;
+ }
+ iter = obj_func->iter_new(NULL);
+ while (obj_func->get_attr(obj, attr_type, &attr, iter)) {
+ ctx->expr=a1;
+ eval_conditional(ctx, &res);
+ resolve_object(ctx, &res);
+ tmp.attr=attr;
+ resolve(ctx, &tmp, NULL);
+ if (ctx->error) {
+ result_free(&tmp);
+ return 0;
+ }
+ command_set_attr(ctx, &res, &tmp);
+ result_free(&tmp);
+ ctx->expr=f;
+ if (!command_evaluate_single(ctx)) {
+ obj_func->iter_destroy(iter);
+ return 0;
+ }
+ }
+ obj_func->iter_destroy(iter);
+ ctx->expr=end;
+ return 1;
case 'i':
if (!get_op(ctx,0,"(",NULL)) {
ctx->error=missing_opening_parenthesis;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2012-12-25 10:39:41
|
Revision: 5317
http://navit.svn.sourceforge.net/navit/?rev=5317&view=rev
Author: martin-s
Date: 2012-12-25 10:39:34 +0000 (Tue, 25 Dec 2012)
Log Message:
-----------
Add:gui_internal:Added debug command and let write command accept multiple arguments
Modified Paths:
--------------
trunk/navit/navit/gui/internal/gui_internal_command.c
Modified: trunk/navit/navit/gui/internal/gui_internal_command.c
===================================================================
--- trunk/navit/navit/gui/internal/gui_internal_command.c 2012-12-24 21:36:24 UTC (rev 5316)
+++ trunk/navit/navit/gui/internal/gui_internal_command.c 2012-12-25 10:39:34 UTC (rev 5317)
@@ -992,26 +992,49 @@
static void
gui_internal_cmd_write(struct gui_priv * this, char *function, struct attr **in, struct attr ***out, int *valid)
{
- char *str=NULL,*str2=NULL;
+ char *str=NULL;
dbg(1,"enter %s %p %p %p\n",function,in,out,valid);
- if (!in || !in[0])
+ if (!in)
return;
- dbg(1,"%s\n",attr_to_name(in[0]->type));
- if (ATTR_IS_STRING(in[0]->type)) {
- str=in[0]->u.str;
+ while (*in) {
+ dbg(1,"%s\n",attr_to_name((*in)->type));
+ if (ATTR_IS_STRING((*in)->type)) {
+ str=g_strconcat_printf(str,"%s",(*in)->u.str);
+ }
+ if (ATTR_IS_COORD_GEO((*in)->type)) {
+ char *str2=coordinates_geo((*in)->u.coord_geo, '\n');
+ str=g_strconcat_printf(str,"%s",str2);
+ g_free(str2);
+ }
+ in++;
}
- if (ATTR_IS_COORD_GEO(in[0]->type)) {
- str=str2=coordinates_geo(in[0]->u.coord_geo, '\n');
- }
if (str) {
str=g_strdup_printf("<html>%s</html>\n",str);
+#if 0
+ dbg(0,"%s\n",str);
+#endif
gui_internal_html_parse_text(this, str);
}
g_free(str);
- g_free(str2);
}
static void
+gui_internal_cmd_debug(struct gui_priv * this, char *function, struct attr **in, struct attr ***out, int *valid)
+{
+ char *str;
+ dbg(0,"begin\n");
+ if (in) {
+ while (*in) {
+ str=attr_to_text(*in, NULL, 0);
+ dbg(0,"%s:%s\n",attr_to_name((*in)->type),str);
+ in++;
+ g_free(str);
+ }
+ }
+ dbg(0,"done\n");
+}
+
+static void
gui_internal_cmd2(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
{
int entering=0;
@@ -1069,6 +1092,7 @@
{"back",command_cast(gui_internal_cmd2_back)},
{"back_to_map",command_cast(gui_internal_cmd2_back_to_map)},
{"bookmarks",command_cast(gui_internal_cmd2)},
+ {"debug",command_cast(gui_internal_cmd_debug)},
{"formerdests",command_cast(gui_internal_cmd2)},
{"get_data",command_cast(gui_internal_get_data)},
{"layouts_page",command_cast(gui_internal_cmd_layouts_page)},
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2012-12-24 21:36:32
|
Revision: 5316
http://navit.svn.sourceforge.net/navit/?rev=5316&view=rev
Author: martin-s
Date: 2012-12-24 21:36:24 +0000 (Mon, 24 Dec 2012)
Log Message:
-----------
Add:Core:Beginning of splitting up command.c into parsing/logic and execution part
Modified Paths:
--------------
trunk/navit/navit/command.c
Modified: trunk/navit/navit/command.c
===================================================================
--- trunk/navit/navit/command.c 2012-12-23 21:15:53 UTC (rev 5315)
+++ trunk/navit/navit/command.c 2012-12-24 21:36:24 UTC (rev 5316)
@@ -24,8 +24,7 @@
zoom_out()
speech.active=!speech.active
osd_configuration=1
-Not yet:
-osd[type=="xxx"].active=0;osd[type=="yyy"].active=0
+osd[@type=="xxx"].active=0;osd[@type=="yyy"].active=0
*/
@@ -39,9 +38,14 @@
int allocated;
};
+struct result_list {
+ struct attr **attrs;
+};
+
struct context {
struct attr *attr;
int error;
+ int skip;
const char *expr;
struct result res;
};
@@ -68,9 +72,19 @@
};
enum error {
- no_error=0,missing_closing_brace, missing_colon, wrong_type, illegal_number_format, illegal_character, missing_closing_bracket, invalid_type, not_ready
+ no_error=0, missing_double_quote, missing_opening_parenthesis, missing_closing_parenthesis, missing_closing_brace, missing_colon, wrong_type, illegal_number_format, illegal_character, missing_closing_bracket, invalid_type, not_ready, internal
};
+enum op_type {
+ op_type_binary, op_type_prefix, op_type_suffix
+};
+
+enum set_type {
+ set_type_symbol, set_type_string, set_type_integer, set_type_float
+};
+
+
+
static void eval_comma(struct context *ctx, struct result *res);
static struct attr ** eval_list(struct context *ctx);
@@ -86,6 +100,8 @@
}
}
+
+
static int command_register_callbacks(struct command_saved *cs);
static const char *
@@ -190,6 +206,8 @@
int result;
struct result tmp={{0,},};
enum attr_type attr_type=command_attr_type(res);
+ if (ctx->skip)
+ return;
result=command_object_get_attr(ctx, &res->attr, attr_type, &tmp.attr);
result_free(res);
*res=tmp;
@@ -213,6 +231,8 @@
{
enum attr_type attr_type=command_attr_type(res);
struct object_func *func=object_func_lookup(res->attr.type);
+ if (ctx->skip)
+ return;
if (!res->attr.u.data || !func || !func->set_attr)
return;
if (attr_type == attr_attr_types) {
@@ -276,7 +296,13 @@
return 0;
}
+static int
+get_bool(struct context *ctx, struct result *res)
+{
+ return !!get_int(ctx, res);
+}
+
static char *
get_string(struct context *ctx, struct result *res)
{
@@ -301,11 +327,164 @@
res->attr.u.num=val;
}
+static void
+result_op(struct context *ctx, enum op_type op_type, const char *op, struct result *inout, struct result *in)
+{
+ if (ctx->skip)
+ return;
+ switch (op_type) {
+ case op_type_prefix:
+ switch ((op[0] << 8) || op[1]) {
+ case ('!' << 8):
+ resolve(ctx, inout, NULL);
+ switch (op[1]) {
+ case '\0':
+ set_int(ctx, inout, !get_int(ctx, inout));
+ return;
+ }
+ break;
+ case ('~' << 8):
+ resolve(ctx, inout, NULL);
+ switch (op[1]) {
+ case '\0':
+ set_int(ctx, inout, ~get_int(ctx, inout));
+ return;
+ }
+ break;
+ }
+ case op_type_binary:
+ resolve(ctx, inout, NULL);
+ resolve(ctx, in, NULL);
+ switch ((op[0] << 8) | op[1]) {
+ case ('=' << 8)|'=':
+ if (inout->attr.type == attr_none || in->attr.type == attr_none) {
+ set_int(ctx, inout, 0);
+ } else if (ATTR_IS_STRING(inout->attr.type) && ATTR_IS_STRING(in->attr.type)) {
+ char *s1=get_string(ctx, inout),*s2=get_string(ctx, in);
+ set_int(ctx, inout, (!strcmp(s1,s2)));
+ g_free(s1);
+ g_free(s2);
+ }
+ else
+ set_int(ctx, inout, (get_int(ctx, inout) == get_int(ctx, in)));
+ return;
+ case ('!' << 8)|'=':
+ if (inout->attr.type == attr_none || in->attr.type == attr_none) {
+ set_int(ctx, inout, 1);
+ } else if (ATTR_IS_STRING(inout->attr.type) && ATTR_IS_STRING(in->attr.type)) {
+ char *s1=get_string(ctx, inout),*s2=get_string(ctx, in);
+ set_int(ctx, inout, (!!strcmp(s1,s2)));
+ g_free(s1);
+ g_free(s2);
+ }
+ else
+ set_int(ctx, inout, (get_int(ctx, inout) != get_int(ctx, in)));
+ return;
+ case ('<' << 8):
+ set_int(ctx, inout, (get_int(ctx, inout) < get_int(ctx, in)));
+ return;
+ case ('<' << 8)|'=':
+ set_int(ctx, inout, (get_int(ctx, inout) <= get_int(ctx, in)));
+ return;
+ case ('>' << 8):
+ set_int(ctx, inout, (get_int(ctx, inout) > get_int(ctx, in)));
+ return;
+ case ('>' << 8)|'=':
+ set_int(ctx, inout, (get_int(ctx, inout) >= get_int(ctx, in)));
+ return;
+ case ('*' << 8):
+ if (is_double(inout) || is_double(in))
+ set_double(ctx, inout, get_double(ctx, inout) * get_double(ctx, in));
+ else
+ set_int(ctx, inout, get_int(ctx, inout) * get_int(ctx, in));
+ return;
+ case ('/' << 8):
+ if (is_double(inout) || is_double(in))
+ set_double(ctx, inout, get_double(ctx, inout) * get_double(ctx, in));
+ else
+ set_int(ctx, inout, get_int(ctx, inout) * get_int(ctx, in));
+ return;
+ case ('%' << 8):
+ set_int(ctx, inout, get_int(ctx, inout) % get_int(ctx, in));
+ return;
+ case ('+' << 8):
+ if (is_double(inout) || is_double(in))
+ set_double(ctx, inout, get_double(ctx, inout) + get_double(ctx, in));
+ else
+ set_int(ctx, inout, get_int(ctx, inout) + get_int(ctx, in));
+ return;
+ case ('-' << 8):
+ if (is_double(inout) || is_double(in))
+ set_int(ctx, inout, get_int(ctx, inout) - get_int(ctx, in));
+ else
+ set_double(ctx, inout, get_double(ctx, inout) - get_double(ctx, in));
+ return;
+ case ('&' << 8):
+ set_int(ctx, inout, get_int(ctx, inout) & get_int(ctx, in));
+ return;
+ case ('^' << 8):
+ set_int(ctx, inout, get_int(ctx, inout) ^ get_int(ctx, in));
+ return;
+ case ('|' << 8):
+ set_int(ctx, inout, get_int(ctx, inout) | get_int(ctx, in));
+ return;
+ case (('&' << 8) | '&'):
+ set_int(ctx, inout, get_int(ctx, inout) && get_int(ctx, in));
+ return;
+ case (('|' << 8) | '|'):
+ set_int(ctx, inout, get_int(ctx, inout) || get_int(ctx, in));
+ return;
+ default:
+ break;
+ }
+ default:
+ break;
+ }
+ dbg(0,"Unkown op %d %s\n",op_type,op);
+ ctx->error=internal;
+}
static void
+result_set(struct context *ctx, enum set_type set_type, const char *op, int len, struct result *out)
+{
+ if (ctx->skip)
+ return;
+ switch (set_type) {
+ case set_type_symbol:
+ out->attr.type=attr_none;
+ out->var=op;
+ out->varlen=len;
+ return;
+ case set_type_integer:
+ out->attr.type=attr_type_int_begin;
+ out->attr.u.num=atoi(ctx->expr);
+ return;
+ case set_type_float:
+ out->val = strtod(ctx->expr, NULL);
+ out->attr.type=attr_type_double_begin;
+ out->attr.u.numd=&out->val;
+ return;
+ case set_type_string:
+ if (len >= 2) {
+ out->attr.type=attr_type_string_begin;
+ out->attr.u.str=g_malloc(len-1);
+ strncpy(out->attr.u.str, op+1, len-2);
+ out->attr.u.str[len-2]='\0';
+ out->allocated=1;
+ return;
+ }
+ break;
+ default:
+ break;
+ }
+ dbg(0,"unknown set type %d %s\n",set_type,op);
+ ctx->error=internal;
+}
+
+static void
eval_value(struct context *ctx, struct result *res) {
const char *op;
- int len,dots=0;
+ int dots=0;
op=ctx->expr;
@@ -320,19 +499,16 @@
op++;
}
if ((op[0] >= 'a' && op[0] <= 'z') || (op[0] >= 'A' && op[0] <= 'Z') || op[0] == '_') {
- res->attr.type=attr_none;
- res->var=op;
for (;;) {
while ((op[0] >= 'a' && op[0] <= 'z') || (op[0] >= 'A' && op[0] <= 'Z') || (op[0] >= '0' && op[0] <= '9') || op[0] == '_') {
- res->varlen++;
op++;
}
if (res->varlen == 3 && !strncmp(res->var,"new",3) && op[0] == ' ') {
- res->varlen++;
op++;
} else
break;
}
+ result_set(ctx, set_type_symbol, ctx->expr, op-ctx->expr, res);
ctx->expr=op;
return;
}
@@ -347,17 +523,9 @@
ctx->error=illegal_number_format;
return;
}
- res->varlen++;
op++;
}
- if (dots) {
- res->val = strtod(ctx->expr, NULL);
- res->attr.type=attr_type_double_begin;
- res->attr.u.numd=&res->val;
- } else {
- res->attr.type=attr_type_int_begin;
- res->attr.u.num=atoi(ctx->expr);
- }
+ result_set(ctx, dots?set_type_float:set_type_integer, ctx->expr, op-ctx->expr, res);
ctx->expr=op;
return;
}
@@ -367,14 +535,12 @@
op++;
op++;
} while (op[0] && op[0] != '"');
- res->attr.type=attr_type_string_begin;
- len=op-ctx->expr-1;
- res->attr.u.str=g_malloc(len+1);
- strncpy(res->attr.u.str, ctx->expr+1, len);
- res->attr.u.str[len]='\0';
- res->allocated=1;
- if(*op)
- op++;
+ if(!*op) {
+ ctx->error=missing_double_quote;
+ return;
+ }
+ op++;
+ result_set(ctx, set_type_string, ctx->expr, op-ctx->expr, res);
ctx->expr=op;
return;
}
@@ -414,7 +580,7 @@
eval_comma(ctx, res);
if (ctx->error) return;
if (!get_op(ctx,0,")",NULL))
- ctx->error=missing_closing_brace;
+ ctx->error=missing_closing_parenthesis;
return;
}
eval_value(ctx, res);
@@ -438,53 +604,53 @@
}
if (!get_op(ctx,0,")",NULL)) {
attr_list_free(list);
- ctx->error=missing_closing_brace;
+ ctx->error=missing_closing_parenthesis;
return;
}
-
-
- if (!strcmp(function,"_") && list && list[0] && list[0]->type >= attr_type_string_begin && list[0]->type <= attr_type_string_end) {
- result_free(res);
- res->attr.type=list[0]->type;
- res->attr.u.str=g_strdup(gettext(list[0]->u.str));
- res->allocated=1;
-
- } else if (!strncmp(function,"new ",4)) {
- enum attr_type attr_type=attr_from_name(function+4);
- result_free(res);
- if (attr_type != attr_none) {
- struct object_func *func=object_func_lookup(attr_type);
- if (func && func->create) {
- res->attr.type=attr_type;
- res->attr.u.data=func->create(list[0], list+1);
- /* Setting allocated to 1 here will make object to be destroyed when last reference is destroyed.
- So created persistent objects should be stored with set_attr_var command. */
- res->allocated=1;
+ if (!ctx->skip) {
+ if (!strcmp(function,"_") && list && list[0] && list[0]->type >= attr_type_string_begin && list[0]->type <= attr_type_string_end) {
+ result_free(res);
+ res->attr.type=list[0]->type;
+ res->attr.u.str=g_strdup(gettext(list[0]->u.str));
+ res->allocated=1;
+
+ } else if (!strncmp(function,"new ",4)) {
+ enum attr_type attr_type=attr_from_name(function+4);
+ result_free(res);
+ if (attr_type != attr_none) {
+ struct object_func *func=object_func_lookup(attr_type);
+ if (func && func->create) {
+ res->attr.type=attr_type;
+ res->attr.u.data=func->create(list[0], list+1);
+ /* Setting allocated to 1 here will make object to be destroyed when last reference is destroyed.
+ So created persistent objects should be stored with set_attr_var command. */
+ res->allocated=1;
+ }
}
- }
- } else if (!strcmp(function,"add_attr")) {
- command_object_add_attr(ctx, &res->attr, list[0]);
- } else if (!strcmp(function,"remove_attr")) {
- command_object_remove_attr(ctx, &res->attr, list[0]);
- } else {
- if (command_object_get_attr(ctx, &res->attr, attr_callback_list, &cbl)) {
- int valid =0;
- struct attr **out=NULL;
- dbg(1,"function call %s from %s\n",function, attr_to_name(res->attr.type));
- callback_list_call_attr_4(cbl.u.callback_list, attr_command, function, list, &out, &valid);
- if (valid!=1){
- dbg(0, "invalid command ignored: \"%s\"; see http://wiki.navit-project.org/index.php/"
- "The_Navit_Command_Interface for valid commands.\n", function);
- }
- if (out && out[0]) {
- result_free(res);
- attr_dup_content(out[0], &res->attr);
- res->allocated=1;
- attr_list_free(out);
+ } else if (!strcmp(function,"add_attr")) {
+ command_object_add_attr(ctx, &res->attr, list[0]);
+ } else if (!strcmp(function,"remove_attr")) {
+ command_object_remove_attr(ctx, &res->attr, list[0]);
+ } else {
+ if (command_object_get_attr(ctx, &res->attr, attr_callback_list, &cbl)) {
+ int valid =0;
+ struct attr **out=NULL;
+ dbg(1,"function call %s from %s\n",function, attr_to_name(res->attr.type));
+ callback_list_call_attr_4(cbl.u.callback_list, attr_command, function, list, &out, &valid);
+ if (valid!=1){
+ dbg(0, "invalid command ignored: \"%s\"; see http://wiki.navit-project.org/index.php/"
+ "The_Navit_Command_Interface for valid commands.\n", function);
+ }
+ if (out && out[0]) {
+ result_free(res);
+ attr_dup_content(out[0], &res->attr);
+ res->allocated=1;
+ attr_list_free(out);
+ } else
+ result_free(res);
} else
result_free(res);
- } else
- result_free(res);
+ }
}
attr_list_free(list);
res->var=NULL;
@@ -516,34 +682,36 @@
resolve_object(ctx, res);
if (ctx->error) return;
if (get_op(ctx,0,"@",NULL)) {
- struct object_func *obj_func=object_func_lookup(res->attr.type);
- struct attr_iter *iter;
- struct attr attr;
- enum attr_type attr_type=command_attr_type(res);
- void *obj=res->attr.u.data;
- if (!obj) {
- dbg(0,"no object\n");
- return;
- }
- if (!obj_func) {
- dbg(0,"no object func\n");
- return;
- }
- if (!obj_func->iter_new || !obj_func->iter_destroy) {
- dbg(0,"no iter func\n");
- return;
- }
- iter = obj_func->iter_new(NULL);
- result_free(res);
- res->varlen=0;
- res->attrn=NULL;
- while (obj_func->get_attr(obj, attr_type, &attr, iter)) {
- if (command_evaluate_to_boolean(&attr, ctx->expr, &ctx->error)) {
- result_free(res);
- res->attr=attr;
+ if (!ctx->skip) {
+ struct object_func *obj_func=object_func_lookup(res->attr.type);
+ struct attr_iter *iter;
+ struct attr attr;
+ enum attr_type attr_type=command_attr_type(res);
+ void *obj=res->attr.u.data;
+ if (!obj) {
+ dbg(0,"no object\n");
+ return;
}
+ if (!obj_func) {
+ dbg(0,"no object func\n");
+ return;
+ }
+ if (!obj_func->iter_new || !obj_func->iter_destroy) {
+ dbg(0,"no iter func\n");
+ return;
+ }
+ iter = obj_func->iter_new(NULL);
+ result_free(res);
+ res->varlen=0;
+ res->attrn=NULL;
+ while (obj_func->get_attr(obj, attr_type, &attr, iter)) {
+ if (command_evaluate_to_boolean(&attr, ctx->expr, &ctx->error)) {
+ result_free(res);
+ res->attr=attr;
+ }
+ }
+ obj_func->iter_destroy(iter);
}
- obj_func->iter_destroy(iter);
if (ctx->error) return;
ctx->expr+=command_evaluate_to_length(ctx->expr, &ctx->error);
}
@@ -567,10 +735,7 @@
if (op) {
eval_unary(ctx, res);
if (ctx->error) return;
- if (op[0] == '~')
- set_int(ctx, res, ~get_int(ctx, res));
- else
- set_int(ctx, res, !get_int(ctx, res));
+ result_op(ctx, op_type_prefix, op, res, NULL);
} else
eval_postfix(ctx, res);
}
@@ -586,31 +751,10 @@
for (;;) {
if (!(op=get_op(ctx,0,"*","/","%",NULL))) return;
eval_unary(ctx, &tmp);
- if (ctx->error) {
- result_free(&tmp);
- return;
- }
- if (is_double(res) || is_double(&tmp)) {
- if (op[0] == '*')
- set_double(ctx, res, get_double(ctx, res) * get_double(ctx, &tmp));
- else if (op[0] == '/')
- set_double(ctx, res, get_double(ctx, res) / get_double(ctx, &tmp));
- else {
- ctx->error=invalid_type;
- result_free(&tmp);
- return;
- }
- } else {
- if (op[0] == '*')
- set_int(ctx, res, get_int(ctx, res) * get_int(ctx, &tmp));
- else if (op[0] == '/')
- set_int(ctx, res, get_int(ctx, res) / get_int(ctx, &tmp));
- else
- set_int(ctx, res, get_int(ctx, res) % get_int(ctx, &tmp));
- }
+ if (!ctx->error)
+ result_op(ctx, op_type_binary, op, res, &tmp);
result_free(&tmp);
- if (ctx->error)
- return;
+ if (ctx->error) return;
}
}
@@ -625,21 +769,8 @@
for (;;) {
if (!(op=get_op(ctx,0,"-","+",NULL))) return;
eval_multiplicative(ctx, &tmp);
- if (ctx->error) {
- result_free(&tmp);
- return;
- }
- if (is_double(res) || is_double(&tmp)) {
- if (op[0] == '+')
- set_double(ctx, res, get_double(ctx, res) + get_double(ctx, &tmp));
- else
- set_double(ctx, res, get_double(ctx, res) - get_double(ctx, &tmp));
- } else {
- if (op[0] == '+')
- set_int(ctx, res, get_int(ctx, res) + get_int(ctx, &tmp));
- else
- set_int(ctx, res, get_int(ctx, res) - get_int(ctx, &tmp));
- }
+ if (!ctx->error)
+ result_op(ctx, op_type_binary, op, res, &tmp);
result_free(&tmp);
if (ctx->error) return;
}
@@ -656,56 +787,10 @@
for (;;) {
if (!(op=get_op(ctx,0,"==","!=","<=",">=","<",">",NULL))) return;
eval_additive(ctx, &tmp);
- if (ctx->error) {
- result_free(&tmp);
- return;
- }
-
- resolve(ctx, res, NULL);
- resolve(ctx, &tmp, NULL);
- switch (op[0]) {
- case '=':
- if (res->attr.type == attr_none || tmp.attr.type == attr_none) {
- set_int(ctx, res, 0);
- } else if (ATTR_IS_STRING(res->attr.type) && ATTR_IS_STRING(tmp.attr.type)) {
- char *s1=get_string(ctx, res),*s2=get_string(ctx, &tmp);
- set_int(ctx, res, (!strcmp(s1,s2)));
- g_free(s1);
- g_free(s2);
- }
- else
- set_int(ctx, res, (get_int(ctx, res) == get_int(ctx, &tmp)));
- break;
- case '!':
- if (res->attr.type == attr_none || tmp.attr.type == attr_none) {
- set_int(ctx, res, 1);
- } else if (ATTR_IS_STRING(res->attr.type) && ATTR_IS_STRING(tmp.attr.type)) {
- char *s1=get_string(ctx, res),*s2=get_string(ctx, &tmp);
- set_int(ctx, res, (!!strcmp(s1,s2)));
- g_free(s1);
- g_free(s2);
- }
- else
- set_int(ctx, res, (get_int(ctx, res) != get_int(ctx, &tmp)));
- break;
- case '<':
- if (op[1] == '=') {
- set_int(ctx, res, (get_int(ctx, res) <= get_int(ctx, &tmp)));
- } else {
- set_int(ctx, res, (get_int(ctx, res) < get_int(ctx, &tmp)));
- }
- break;
- case '>':
- if (op[1] == '=') {
- set_int(ctx, res, (get_int(ctx, res) >= get_int(ctx, &tmp)));
- } else {
- set_int(ctx, res, (get_int(ctx, res) > get_int(ctx, &tmp)));
- }
- break;
- default:
- break;
- }
+ if (!ctx->error)
+ result_op(ctx, op_type_binary, op, res, &tmp);
result_free(&tmp);
+ if (ctx->error) return;
}
}
@@ -721,11 +806,8 @@
if (get_op(ctx,1,"&&",NULL)) return;
if (!get_op(ctx,0,"&",NULL)) return;
eval_equality(ctx, &tmp);
- if (ctx->error) {
- result_free(&tmp);
- return;
- }
- set_int(ctx, res, get_int(ctx, res) & get_int(ctx, &tmp));
+ if (!ctx->error)
+ result_op(ctx, op_type_binary, "&", res, &tmp);
result_free(&tmp);
if (ctx->error) return;
}
@@ -741,11 +823,8 @@
for (;;) {
if (!get_op(ctx,0,"^",NULL)) return;
eval_bitwise_and(ctx, &tmp);
- if (ctx->error) {
- result_free(&tmp);
- return;
- }
- set_int(ctx, res, get_int(ctx, res) ^ get_int(ctx, &tmp));
+ if (!ctx->error)
+ result_op(ctx, op_type_binary, "^", res, &tmp);
result_free(&tmp);
if (ctx->error) return;
}
@@ -762,11 +841,8 @@
if (get_op(ctx,1,"||",NULL)) return;
if (!get_op(ctx,0,"|",NULL)) return;
eval_bitwise_xor(ctx, &tmp);
- if (ctx->error) {
- result_free(&tmp);
- return;
- }
- set_int(ctx, res, get_int(ctx, res) | get_int(ctx, &tmp));
+ if (!ctx->error)
+ result_op(ctx, op_type_binary, "|", res, &tmp);
result_free(&tmp);
if (ctx->error) return;
}
@@ -782,11 +858,8 @@
for (;;) {
if (!get_op(ctx,0,"&&",NULL)) return;
eval_bitwise_or(ctx, &tmp);
- if (ctx->error) {
- result_free(&tmp);
- return;
- }
- set_int(ctx, res, get_int(ctx, res) && get_int(ctx, &tmp));
+ if (!ctx->error)
+ result_op(ctx, op_type_binary, "&&", res, &tmp);
result_free(&tmp);
if (ctx->error) return;
}
@@ -802,11 +875,8 @@
for (;;) {
if (!get_op(ctx,0,"||",NULL)) return;
eval_logical_and(ctx, &tmp);
- if (ctx->error) {
- result_free(&tmp);
- return;
- }
- set_int(ctx, res, get_int(ctx, res) || get_int(ctx, &tmp));
+ if (!ctx->error)
+ result_op(ctx, op_type_binary, "||", res, &tmp);
result_free(&tmp);
if (ctx->error) return;
}
@@ -816,15 +886,19 @@
eval_conditional(struct context *ctx, struct result *res)
{
struct result tmp={{0,},};
- int cond;
+ int cond=0;
+ int skip;
eval_logical_or(ctx, res);
if (ctx->error) return;
if (!get_op(ctx,0,"?",NULL)) return;
- cond=!!get_int(ctx, res);
+ skip=ctx->skip;
+ cond=get_bool(ctx, res);
result_free(res);
if (ctx->error) return;
+ ctx->skip=!cond || skip;
eval_logical_or(ctx, &tmp);
+ ctx->skip=skip;
if (ctx->error) {
result_free(&tmp);
return;
@@ -838,7 +912,9 @@
ctx->error=missing_colon;
return;
}
+ ctx->skip=cond || skip;
eval_logical_or(ctx, &tmp);
+ ctx->skip=skip;
if (ctx->error) {
result_free(&tmp);
return;
@@ -1065,6 +1141,64 @@
return 0;
}
+int
+command_evaluate_single(struct context *ctx)
+{
+ struct result res={{0,},};
+ const char *op;
+ int cond=0;
+ int skip=ctx->skip;
+ if (!(op=get_op(ctx,0,"if","{",NULL))) {
+ eval_comma(ctx,&res);
+ if (ctx->error)
+ return 0;
+ resolve(ctx, &res, NULL);
+ result_free(&res);
+ if (ctx->error)
+ return 0;
+ return get_op(ctx,0,";",NULL) != NULL;
+ }
+ switch (op[0]) {
+ case 'i':
+ if (!get_op(ctx,0,"(",NULL)) {
+ ctx->error=missing_opening_parenthesis;
+ return 0;
+ }
+ eval_comma(ctx,&res);
+ if (!skip && !ctx->error)
+ cond=get_bool(ctx, &res);
+ result_free(&res);
+ if (ctx->error)
+ return 0;
+ if (!get_op(ctx,0,")",NULL)) {
+ ctx->error=missing_closing_parenthesis;
+ return 0;
+ }
+ ctx->skip=!cond || skip;
+ command_evaluate_single(ctx);
+ ctx->skip=skip;
+ if (ctx->error)
+ return 0;
+ if (get_op(ctx,0,"else",NULL)) {
+ ctx->skip=cond || skip;
+ command_evaluate_single(ctx);
+ ctx->skip=skip;
+ if (ctx->error)
+ return 0;
+ }
+ return 1;
+ case '{':
+ while (command_evaluate_single(ctx));
+ if (!get_op(ctx,0,"}",NULL)) {
+ ctx->error=missing_closing_brace;
+ return 0;
+ }
+ return 1;
+ default:
+ return 0;
+ }
+}
+
void
command_evaluate(struct attr *attr, const char *expr)
{
@@ -1073,23 +1207,13 @@
* subsequent command call. Hence the g_strdup. */
char *expr_dup;
- struct result res={{0,},};
struct context ctx={0,};
ctx.attr=attr;
ctx.error=0;
ctx.expr=expr_dup=g_strdup(expr);
for (;;) {
- eval_comma(&ctx,&res);
- if (ctx.error)
+ if (!command_evaluate_single(&ctx))
break;
- resolve(&ctx, &res, NULL);
-
- result_free(&res);
-
- if (ctx.error)
- break;
- if (!get_op(&ctx,0,";",NULL))
- break;
}
g_free(expr_dup);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2012-12-23 21:16:02
|
Revision: 5315
http://navit.svn.sourceforge.net/navit/?rev=5315&view=rev
Author: martin-s
Date: 2012-12-23 21:15:53 +0000 (Sun, 23 Dec 2012)
Log Message:
-----------
Add:gui_internal:More functionality for vehicle config page
Modified Paths:
--------------
trunk/navit/navit/gui/internal/gui_internal_command.c
trunk/navit/navit/navit_shipped.xml
Modified: trunk/navit/navit/gui/internal/gui_internal_command.c
===================================================================
--- trunk/navit/navit/gui/internal/gui_internal_command.c 2012-12-23 20:44:25 UTC (rev 5314)
+++ trunk/navit/navit/gui/internal/gui_internal_command.c 2012-12-23 21:15:53 UTC (rev 5315)
@@ -263,21 +263,21 @@
if (!vehicle_get_attr(vehicle.u.vehicle, attr_profilename, &profilename, NULL))
profilename.u.str="Unknown";
if (cvehicle.u.vehicle != vehicle.u.vehicle) {
+ document=g_strconcat_printf(document, "<img class='centry' src='gui_active' onclick='set(\"navit.vehicle=navit.vehicle[@name=*]\",E(\"%s\"));refresh()'>%s</img>",name.u.str,_("Set as active"));
}
while (navit_get_attr(this->nav, attr_vehicleprofile, &vehicleprofile, iter2)) {
if (vehicleprofile_get_attr(vehicleprofile.u.vehicleprofile, attr_name, &name2, NULL)) {
- document=g_strconcat_printf(document, "<img class='centry' src='%s' onclick='set(\"navit.vehicle[@name==\\\"%s\\\"].profilename=*\",E(\"%s\"))'>%s</img>",!strcmp(profilename.u.str,name2.u.str) ? "gui_active":"gui_inactive",name.u.str,name2.u.str,name2.u.str);
+ document=g_strconcat_printf(document, "<img class='centry' src='%s' onclick='set(\"navit.vehicle[@name==\\\"%s\\\"].profilename=*\",E(\"%s\"));refresh()'>%s</img>",!strcmp(profilename.u.str,name2.u.str) ? "gui_active":"gui_inactive",name.u.str,name2.u.str,name2.u.str);
}
}
if (vehicle_get_attr(vehicle.u.vehicle, attr_position_sat_item, &attr, NULL)) {
- dbg(0,"sat status\n");
+ document=g_strconcat_printf(document, "<a href='#Satellite Status'><img class='centry' src='gui_active'>%s</img></a>",_("Show Satellite status"));
}
if (vehicle_get_attr(vehicle.u.vehicle, attr_position_nmea, &attr, NULL)) {
- dbg(0,"nmea\n");
+ document=g_strconcat_printf(document, "<a href='#NMEA Data'><img class='centry' src='gui_active'>%s</img></a>",_("Show NMEA data"));
}
navit_attr_iter_destroy(iter2);
document=g_strconcat_printf(document, "</html>");
- dbg(0,"%s\n",document);
gui_internal_html_parse_text(this, document);
g_free(document);
break;
Modified: trunk/navit/navit/navit_shipped.xml
===================================================================
--- trunk/navit/navit/navit_shipped.xml 2012-12-23 20:44:25 UTC (rev 5314)
+++ trunk/navit/navit/navit_shipped.xml 2012-12-23 21:15:53 UTC (rev 5315)
@@ -111,6 +111,12 @@
<a name='Settings Vehicle' class='clist'><script>write(name)</script>
<script>vehicle_page(name)</script>
</a>
+ <a name='Satellite Status' class='clist'><text>Satellite Status</text>
+ <script>satellite_status_page()</script>
+ </a>
+ <a name='NMEA Data' class='clist'><text>NMEA Data</text>
+ <script>nmea_data_page()</script>
+ </a>
</html>
]]></gui>
<!-- for a debug log -->
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2012-12-23 20:44:32
|
Revision: 5314
http://navit.svn.sourceforge.net/navit/?rev=5314&view=rev
Author: martin-s
Date: 2012-12-23 20:44:25 +0000 (Sun, 23 Dec 2012)
Log Message:
-----------
Add:gui_internal:New config pages for vehicle
Modified Paths:
--------------
trunk/navit/navit/gui/internal/gui_internal_command.c
trunk/navit/navit/navit_shipped.xml
Modified: trunk/navit/navit/gui/internal/gui_internal_command.c
===================================================================
--- trunk/navit/navit/gui/internal/gui_internal_command.c 2012-12-23 14:18:59 UTC (rev 5313)
+++ trunk/navit/navit/gui/internal/gui_internal_command.c 2012-12-23 20:44:25 UTC (rev 5314)
@@ -23,6 +23,7 @@
#include "search.h"
#include "route.h"
#include "vehicle.h"
+#include "vehicleprofile.h"
#include "layout.h"
#include "util.h"
#include "gui_internal.h"
@@ -77,15 +78,22 @@
static void
gui_internal_cmd_escape(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
{
- if (in && in[0] && ATTR_IS_STRING(in[0]->type) && out) {
- struct attr escaped;
- escaped.type=in[0]->type;
- escaped.u.str=g_strdup_printf("\"%s\"",in[0]->u.str);
- dbg(1,"result %s\n",escaped.u.str);
- *out=attr_generic_add_attr(*out, attr_dup(&escaped));
- g_free(escaped.u.str);
+ struct attr escaped;
+ if (!in || !in[0] || !ATTR_IS_STRING(in[0]->type)) {
+ dbg(0,"first parameter missing or wrong type\n");
+ return;
}
+ if (!out) {
+ dbg(0,"output missing\n");
+ return;
+ }
+ escaped.type=in[0]->type;
+ escaped.u.str=g_strdup_printf("\"%s\"",in[0]->u.str);
+ dbg(1,"in %s result %s\n",in[0]->u.str,escaped.u.str);
+ *out=attr_generic_add_attr(*out, attr_dup(&escaped));
+ g_free(escaped.u.str);
}
+
static void
gui_internal_cmd2_about(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
{
@@ -213,6 +221,72 @@
}
static void
+gui_internal_cmd_vehicles_page(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
+{
+ struct attr vehicle,cvehicle;
+ struct attr_iter *iter;
+ char *document=g_strdup("<html>");
+
+ navit_get_attr(this->nav, attr_vehicle, &cvehicle, NULL);
+ iter=navit_attr_iter_new();
+ while(navit_get_attr(this->nav, attr_vehicle, &vehicle, iter)) {
+ struct attr name;
+ if (!vehicle_get_attr(vehicle.u.vehicle, attr_name, &name, NULL))
+ name.u.str="Unknown";
+ document=g_strconcat_printf(document, "<img class='centry' src='%s' onclick='name=\"%s\";menu(\"#Settings Vehicle\")'>%s</img>",vehicle.u.vehicle == cvehicle.u.vehicle ? "gui_active":"gui_inactive",name.u.str,name.u.str);
+ }
+ navit_attr_iter_destroy(iter);
+ document=g_strconcat_printf(document, "</html>");
+ gui_internal_html_parse_text(this, document);
+ g_free(document);
+}
+
+static void
+gui_internal_cmd_vehicle_page(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
+{
+ struct attr vehicle,cvehicle;
+ struct attr_iter *iter;
+ if (!in || !in[0] || !ATTR_IS_STRING(in[0]->type) || !in[0]->u.str) {
+ dbg(0,"first parameter missing or wrong type\n");
+ return;
+ }
+ navit_get_attr(this->nav, attr_vehicle, &cvehicle, NULL);
+ iter=navit_attr_iter_new();
+ while(navit_get_attr(this->nav, attr_vehicle, &vehicle, iter)) {
+ struct attr name;
+ if (!vehicle_get_attr(vehicle.u.vehicle, attr_name, &name, NULL))
+ name.u.str="Unknown";
+ if (!strcmp(name.u.str,in[0]->u.str)) {
+ char *document=g_strdup("<html>");
+ struct attr attr,vehicleprofile,profilename,name2;
+ struct attr_iter *iter2=navit_attr_iter_new();
+ if (!vehicle_get_attr(vehicle.u.vehicle, attr_profilename, &profilename, NULL))
+ profilename.u.str="Unknown";
+ if (cvehicle.u.vehicle != vehicle.u.vehicle) {
+ }
+ while (navit_get_attr(this->nav, attr_vehicleprofile, &vehicleprofile, iter2)) {
+ if (vehicleprofile_get_attr(vehicleprofile.u.vehicleprofile, attr_name, &name2, NULL)) {
+ document=g_strconcat_printf(document, "<img class='centry' src='%s' onclick='set(\"navit.vehicle[@name==\\\"%s\\\"].profilename=*\",E(\"%s\"))'>%s</img>",!strcmp(profilename.u.str,name2.u.str) ? "gui_active":"gui_inactive",name.u.str,name2.u.str,name2.u.str);
+ }
+ }
+ if (vehicle_get_attr(vehicle.u.vehicle, attr_position_sat_item, &attr, NULL)) {
+ dbg(0,"sat status\n");
+ }
+ if (vehicle_get_attr(vehicle.u.vehicle, attr_position_nmea, &attr, NULL)) {
+ dbg(0,"nmea\n");
+ }
+ navit_attr_iter_destroy(iter2);
+ document=g_strconcat_printf(document, "</html>");
+ dbg(0,"%s\n",document);
+ gui_internal_html_parse_text(this, document);
+ g_free(document);
+ break;
+ }
+ }
+ navit_attr_iter_destroy(iter);
+}
+
+static void
gui_internal_cmd2_setting_vehicle(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
{
struct attr attr,attr2,vattr;
@@ -366,7 +440,7 @@
}
static void
-gui_internal_cmd_layout_page(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
+gui_internal_cmd_layouts_page(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
{
struct attr layout,clayout;
struct attr_iter *iter;
@@ -997,7 +1071,7 @@
{"bookmarks",command_cast(gui_internal_cmd2)},
{"formerdests",command_cast(gui_internal_cmd2)},
{"get_data",command_cast(gui_internal_get_data)},
- {"layout_page",command_cast(gui_internal_cmd_layout_page)},
+ {"layouts_page",command_cast(gui_internal_cmd_layouts_page)},
{"locale",command_cast(gui_internal_cmd2)},
{"log",command_cast(gui_internal_cmd_log)},
{"maps_page",command_cast(gui_internal_cmd_maps_page)},
@@ -1016,6 +1090,8 @@
{"town",command_cast(gui_internal_cmd2)},
{"enter_coord",command_cast(gui_internal_cmd2)},
{"quit",command_cast(gui_internal_cmd2_quit)},
+ {"vehicles_page",command_cast(gui_internal_cmd_vehicles_page)},
+ {"vehicle_page",command_cast(gui_internal_cmd_vehicle_page)},
{"waypoints",command_cast(gui_internal_cmd2)},
{"write",command_cast(gui_internal_cmd_write)},
{"about",command_cast(gui_internal_cmd2)},
Modified: trunk/navit/navit/navit_shipped.xml
===================================================================
--- trunk/navit/navit/navit_shipped.xml 2012-12-23 14:18:59 UTC (rev 5313)
+++ trunk/navit/navit/navit_shipped.xml 2012-12-23 20:44:25 UTC (rev 5314)
@@ -73,11 +73,12 @@
<img src='gui_maps' onclick='setting_maps()'><text>Maps</text></img>
<!-- <a href='#Settings Maps'><img src='gui_maps'><text>Maps</text></img></a> -->
<img src='gui_vehicle' onclick='setting_vehicle()'><text>Vehicle</text></img>
+ <!-- <a href='#Settings Vehicles'><img src='gui_vehicle'><text>Vehicle</text></img></a> -->
<img src='gui_rules' onclick='setting_rules()'><text>Rules</text></img>
</a>
<a name='Settings Display'><text>Display</text>
<img src='gui_display' onclick='setting_layout()'><text>Layout</text></img>
- <!-- <a href='#Settings Layout'><img src='gui_display'><text>Layout</text></img></a> -->
+ <!-- <a href='#Settings Layouts'><img src='gui_display'><text>Layout</text></img></a> -->
<img cond='fullscreen==0' src='gui_fullscreen' onclick='fullscreen=1'><text>Fullscreen</text></img>
<img cond='fullscreen==1' src='gui_leave_fullscreen' onclick='fullscreen=0'><text>Window Mode</text></img>
<img cond='navit.pitch==0' src='gui_map' onclick='navit.pitch=pitch;redraw_map();back_to_map()'><text>3D</text></img>
@@ -98,12 +99,18 @@
<a name='Map Point'><text>Map Point</text>
<script>position(click_coord_geo,_("Map Point"),8|16|32|64|256)</script>
</a>
- <a name='Settings Layout' class='clist' refresh_cond='navit.layout'><text>Layout</text>
- <script>layout_page()</script>
+ <a name='Settings Layouts' class='clist' refresh_cond='navit.layout'><text>Layout</text>
+ <script>layouts_page()</script>
</a>
<a name='Settings Maps' class='clist'><text>Maps</text>
<script>maps_page()</script>
</a>
+ <a name='Settings Vehicles' class='clist'><text>Vehicle</text>
+ <script>vehicles_page()</script>
+ </a>
+ <a name='Settings Vehicle' class='clist'><script>write(name)</script>
+ <script>vehicle_page(name)</script>
+ </a>
</html>
]]></gui>
<!-- for a debug log -->
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2012-12-22 22:04:52
|
Revision: 5308
http://navit.svn.sourceforge.net/navit/?rev=5308&view=rev
Author: martin-s
Date: 2012-12-22 22:04:40 +0000 (Sat, 22 Dec 2012)
Log Message:
-----------
Add:XML:Include (still disabled) map config page
Modified Paths:
--------------
trunk/navit/navit/navit_shipped.xml
Modified: trunk/navit/navit/navit_shipped.xml
===================================================================
--- trunk/navit/navit/navit_shipped.xml 2012-12-22 22:00:20 UTC (rev 5307)
+++ trunk/navit/navit/navit_shipped.xml 2012-12-22 22:04:40 UTC (rev 5308)
@@ -71,12 +71,13 @@
<a name='Settings'><text>Settings</text>
<a href='#Settings Display'><img src='gui_display'><text>Display</text></img></a>
<img src='gui_maps' onclick='setting_maps()'><text>Maps</text></img>
+ <!-- <a href='#Settings Maps'><img src='gui_maps'><text>Maps</text></img></a> -->
<img src='gui_vehicle' onclick='setting_vehicle()'><text>Vehicle</text></img>
<img src='gui_rules' onclick='setting_rules()'><text>Rules</text></img>
</a>
<a name='Settings Display'><text>Display</text>
<img src='gui_display' onclick='setting_layout()'><text>Layout</text></img>
- <!-- <a href='#Layout'><img src='gui_display'><text>Layout</text></img></a> -->
+ <!-- <a href='#Settings Layout'><img src='gui_display'><text>Layout</text></img></a> -->
<img cond='fullscreen==0' src='gui_fullscreen' onclick='fullscreen=1'><text>Fullscreen</text></img>
<img cond='fullscreen==1' src='gui_leave_fullscreen' onclick='fullscreen=0'><text>Window Mode</text></img>
<img cond='navit.pitch==0' src='gui_map' onclick='navit.pitch=pitch;redraw_map();back_to_map()'><text>3D</text></img>
@@ -97,9 +98,12 @@
<a name='Map Point'><text>Map Point</text>
<script>position(click_coord_geo,_("Map Point"),8|16|32|64|256)</script>
</a>
- <a name='Layout' class='clist' refresh_cond='navit.layout'><text>Layout</text>
+ <a name='Settings Layout' class='clist' refresh_cond='navit.layout'><text>Layout</text>
<script>layout_page()</script>
</a>
+ <a name='Settings Maps' class='clist'><text>Maps</text>
+ <script>maps_page()</script>
+ </a>
</html>
]]></gui>
<!-- for a debug log -->
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2012-12-22 22:00:31
|
Revision: 5307
http://navit.svn.sourceforge.net/navit/?rev=5307&view=rev
Author: martin-s
Date: 2012-12-22 22:00:20 +0000 (Sat, 22 Dec 2012)
Log Message:
-----------
Add:gui_internal:New map configuration page
Modified Paths:
--------------
trunk/navit/navit/gui/internal/gui_internal_command.c
Modified: trunk/navit/navit/gui/internal/gui_internal_command.c
===================================================================
--- trunk/navit/navit/gui/internal/gui_internal_command.c 2012-12-22 21:59:01 UTC (rev 5306)
+++ trunk/navit/navit/gui/internal/gui_internal_command.c 2012-12-22 22:00:20 UTC (rev 5307)
@@ -285,6 +285,41 @@
}
static void
+gui_internal_cmd_maps_page(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
+{
+ struct attr mapset,map;
+ struct attr_iter *iter;
+ char *document=g_strdup("<html>");
+
+ navit_get_attr(this->nav, attr_mapset, &mapset, NULL);
+ iter=mapset_attr_iter_new();
+ while(mapset_get_attr(mapset.u.mapset, attr_map, &map, iter)) {
+ struct attr description,type,data,active;
+ char *attr,*val,*label;
+ if (map_get_attr(map.u.map, attr_description, &description, NULL)) {
+ label=g_strdup(description.u.str);
+ val=description.u.str;
+ attr="description";
+ } else {
+ if (!map_get_attr(map.u.map, attr_type, &type, NULL))
+ type.u.str="";
+ if (!map_get_attr(map.u.map, attr_data, &data, NULL))
+ data.u.str="";
+ val=data.u.str;
+ attr="data";
+ label=g_strdup_printf("%s:%s",type.u.str,data.u.str);
+ }
+ if (!map_get_attr(map.u.map, attr_active, &active, NULL))
+ active.u.num=1;
+ document=g_strconcat_printf(document, "<img class='centry' src='%s' onclick='set(\"navit.mapset.map[@%s==\\\"%s\\\"].active=*\",%d);redraw_map();refresh()'>%s</img>",active.u.num ? "gui_active":"gui_inactive",attr,val,!active.u.num,label);
+ }
+ mapset_attr_iter_destroy(iter);
+ document=g_strconcat_printf(document, "</html>");
+ gui_internal_html_parse_text(this, document);
+ g_free(document);
+}
+
+static void
gui_internal_cmd2_setting_maps(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
{
struct attr attr, on, off, description, type, data, url, active;
@@ -836,6 +871,12 @@
}
static void
+gui_internal_cmd_redraw_map(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
+{
+ this->redraw=1;
+}
+
+static void
gui_internal_cmd2_refresh(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
{
char *href=g_strdup(this->href);
@@ -959,9 +1000,11 @@
{"layout_page",command_cast(gui_internal_cmd_layout_page)},
{"locale",command_cast(gui_internal_cmd2)},
{"log",command_cast(gui_internal_cmd_log)},
+ {"maps_page",command_cast(gui_internal_cmd_maps_page)},
{"menu",command_cast(gui_internal_cmd_menu2)},
{"position",command_cast(gui_internal_cmd2_position)},
{"pois",command_cast(gui_internal_cmd2)},
+ {"redraw_map",command_cast(gui_internal_cmd_redraw_map)},
{"refresh",command_cast(gui_internal_cmd2_refresh)},
{"route_description",command_cast(gui_internal_cmd2)},
{"route_height_profile",command_cast(gui_internal_cmd2)},
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2012-12-22 21:59:12
|
Revision: 5306
http://navit.svn.sourceforge.net/navit/?rev=5306&view=rev
Author: martin-s
Date: 2012-12-22 21:59:01 +0000 (Sat, 22 Dec 2012)
Log Message:
-----------
Fix:Core:Allow escaped quotes in strings
Modified Paths:
--------------
trunk/navit/navit/command.c
Modified: trunk/navit/navit/command.c
===================================================================
--- trunk/navit/navit/command.c 2012-12-22 21:04:31 UTC (rev 5305)
+++ trunk/navit/navit/command.c 2012-12-22 21:59:01 UTC (rev 5306)
@@ -363,6 +363,8 @@
}
if (op[0] == '"') {
do {
+ if (op[0] == '\\' && op[1] == '"')
+ op++;
op++;
} while (op[0] && op[0] != '"');
res->attr.type=attr_type_string_begin;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2012-12-22 21:04:43
|
Revision: 5305
http://navit.svn.sourceforge.net/navit/?rev=5305&view=rev
Author: martin-s
Date: 2012-12-22 21:04:31 +0000 (Sat, 22 Dec 2012)
Log Message:
-----------
Fix:gui_internal:Improved new layout page
Modified Paths:
--------------
trunk/navit/navit/gui/internal/gui_internal_command.c
Modified: trunk/navit/navit/gui/internal/gui_internal_command.c
===================================================================
--- trunk/navit/navit/gui/internal/gui_internal_command.c 2012-12-22 19:05:03 UTC (rev 5304)
+++ trunk/navit/navit/gui/internal/gui_internal_command.c 2012-12-22 21:04:31 UTC (rev 5305)
@@ -331,23 +331,23 @@
}
static void
-gui_internal_cmd2_setting_layout_new(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
+gui_internal_cmd_layout_page(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
{
struct attr layout,clayout;
struct attr_iter *iter;
+ char *document=g_strdup("<html>");
- char *document=g_strdup("<html><a name='Layout' class='clist'><text>Layout</text>\n");
navit_get_attr(this->nav, attr_layout, &clayout, NULL);
iter=navit_attr_iter_new();
while(navit_get_attr(this->nav, attr_layout, &layout, iter)) {
struct attr name;
if (!layout_get_attr(layout.u.layout, attr_name, &name, NULL))
name.u.str="Unknown";
- document=g_strconcat_printf(document, "<img class='centry' src='%s' onclick='set(\"navit.layout=navit.layout[@name==*]\",E(\"%s\"))'>%s</img>\n",layout.u.layout == clayout.u.layout ? "gui_active":"gui_inactive",name.u.str,name.u.str);
+ document=g_strconcat_printf(document, "<img class='centry' src='%s' onclick='set(\"navit.layout=navit.layout[@name==*]\",E(\"%s\"))'>%s</img>",layout.u.layout == clayout.u.layout ? "gui_active":"gui_inactive",name.u.str,name.u.str);
}
navit_attr_iter_destroy(iter);
- document=g_strconcat_printf(document, "</a></html>\n");
- gui_internal_html_menu(this, document, "Layout");
+ document=g_strconcat_printf(document, "</html>");
+ gui_internal_html_parse_text(this, document);
g_free(document);
}
@@ -956,6 +956,7 @@
{"bookmarks",command_cast(gui_internal_cmd2)},
{"formerdests",command_cast(gui_internal_cmd2)},
{"get_data",command_cast(gui_internal_get_data)},
+ {"layout_page",command_cast(gui_internal_cmd_layout_page)},
{"locale",command_cast(gui_internal_cmd2)},
{"log",command_cast(gui_internal_cmd_log)},
{"menu",command_cast(gui_internal_cmd_menu2)},
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2012-12-22 19:05:18
|
Revision: 5304
http://navit.svn.sourceforge.net/navit/?rev=5304&view=rev
Author: martin-s
Date: 2012-12-22 19:05:03 +0000 (Sat, 22 Dec 2012)
Log Message:
-----------
Fix:gui_internal:Improved new layout page
Modified Paths:
--------------
trunk/navit/navit/navit_shipped.xml
Modified: trunk/navit/navit/navit_shipped.xml
===================================================================
--- trunk/navit/navit/navit_shipped.xml 2012-12-22 18:40:42 UTC (rev 5303)
+++ trunk/navit/navit/navit_shipped.xml 2012-12-22 19:05:03 UTC (rev 5304)
@@ -76,6 +76,7 @@
</a>
<a name='Settings Display'><text>Display</text>
<img src='gui_display' onclick='setting_layout()'><text>Layout</text></img>
+ <!-- <a href='#Layout'><img src='gui_display'><text>Layout</text></img></a> -->
<img cond='fullscreen==0' src='gui_fullscreen' onclick='fullscreen=1'><text>Fullscreen</text></img>
<img cond='fullscreen==1' src='gui_leave_fullscreen' onclick='fullscreen=0'><text>Window Mode</text></img>
<img cond='navit.pitch==0' src='gui_map' onclick='navit.pitch=pitch;redraw_map();back_to_map()'><text>3D</text></img>
@@ -96,6 +97,9 @@
<a name='Map Point'><text>Map Point</text>
<script>position(click_coord_geo,_("Map Point"),8|16|32|64|256)</script>
</a>
+ <a name='Layout' class='clist' refresh_cond='navit.layout'><text>Layout</text>
+ <script>layout_page()</script>
+ </a>
</html>
]]></gui>
<!-- for a debug log -->
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2012-12-22 18:40:53
|
Revision: 5303
http://navit.svn.sourceforge.net/navit/?rev=5303&view=rev
Author: martin-s
Date: 2012-12-22 18:40:42 +0000 (Sat, 22 Dec 2012)
Log Message:
-----------
Add:gui_internal:Experimental new layout setting screen
Modified Paths:
--------------
trunk/navit/navit/gui/internal/gui_internal_command.c
Modified: trunk/navit/navit/gui/internal/gui_internal_command.c
===================================================================
--- trunk/navit/navit/gui/internal/gui_internal_command.c 2012-12-22 18:37:52 UTC (rev 5302)
+++ trunk/navit/navit/gui/internal/gui_internal_command.c 2012-12-22 18:40:42 UTC (rev 5303)
@@ -24,6 +24,7 @@
#include "route.h"
#include "vehicle.h"
#include "layout.h"
+#include "util.h"
#include "gui_internal.h"
#include "gui_internal_widget.h"
#include "gui_internal_priv.h"
@@ -330,6 +331,27 @@
}
static void
+gui_internal_cmd2_setting_layout_new(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
+{
+ struct attr layout,clayout;
+ struct attr_iter *iter;
+
+ char *document=g_strdup("<html><a name='Layout' class='clist'><text>Layout</text>\n");
+ navit_get_attr(this->nav, attr_layout, &clayout, NULL);
+ iter=navit_attr_iter_new();
+ while(navit_get_attr(this->nav, attr_layout, &layout, iter)) {
+ struct attr name;
+ if (!layout_get_attr(layout.u.layout, attr_name, &name, NULL))
+ name.u.str="Unknown";
+ document=g_strconcat_printf(document, "<img class='centry' src='%s' onclick='set(\"navit.layout=navit.layout[@name==*]\",E(\"%s\"))'>%s</img>\n",layout.u.layout == clayout.u.layout ? "gui_active":"gui_inactive",name.u.str,name.u.str);
+ }
+ navit_attr_iter_destroy(iter);
+ document=g_strconcat_printf(document, "</a></html>\n");
+ gui_internal_html_menu(this, document, "Layout");
+ g_free(document);
+}
+
+static void
gui_internal_cmd2_setting_layout(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
{
struct attr attr;
@@ -350,7 +372,6 @@
navit_attr_iter_destroy(iter);
gui_internal_menu_render(this);
}
-
static void
gui_internal_cmd2_route_height_profile(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2012-12-22 18:38:04
|
Revision: 5302
http://navit.svn.sourceforge.net/navit/?rev=5302&view=rev
Author: martin-s
Date: 2012-12-22 18:37:52 +0000 (Sat, 22 Dec 2012)
Log Message:
-----------
Add:gui_internal:Escape function
Modified Paths:
--------------
trunk/navit/navit/gui/internal/gui_internal_command.c
Modified: trunk/navit/navit/gui/internal/gui_internal_command.c
===================================================================
--- trunk/navit/navit/gui/internal/gui_internal_command.c 2012-12-22 18:34:20 UTC (rev 5301)
+++ trunk/navit/navit/gui/internal/gui_internal_command.c 2012-12-22 18:37:52 UTC (rev 5302)
@@ -74,6 +74,18 @@
}
static void
+gui_internal_cmd_escape(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
+{
+ if (in && in[0] && ATTR_IS_STRING(in[0]->type) && out) {
+ struct attr escaped;
+ escaped.type=in[0]->type;
+ escaped.u.str=g_strdup_printf("\"%s\"",in[0]->u.str);
+ dbg(1,"result %s\n",escaped.u.str);
+ *out=attr_generic_add_attr(*out, attr_dup(&escaped));
+ g_free(escaped.u.str);
+ }
+}
+static void
gui_internal_cmd2_about(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
{
struct widget *menu,*wb,*w;
@@ -916,6 +928,7 @@
}
static struct command_table commands[] = {
+ {"E",command_cast(gui_internal_cmd_escape)},
{"abort_navigation",command_cast(gui_internal_cmd2_abort_navigation)},
{"back",command_cast(gui_internal_cmd2_back)},
{"back_to_map",command_cast(gui_internal_cmd2_back_to_map)},
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2012-12-22 18:34:30
|
Revision: 5301
http://navit.svn.sourceforge.net/navit/?rev=5301&view=rev
Author: martin-s
Date: 2012-12-22 18:34:20 +0000 (Sat, 22 Dec 2012)
Log Message:
-----------
Add:gui_internal:Allow class specification in html tags
Modified Paths:
--------------
trunk/navit/navit/gui/internal/gui_internal_html.c
trunk/navit/navit/gui/internal/gui_internal_priv.h
Modified: trunk/navit/navit/gui/internal/gui_internal_html.c
===================================================================
--- trunk/navit/navit/gui/internal/gui_internal_html.c 2012-12-22 18:33:00 UTC (rev 5300)
+++ trunk/navit/navit/gui/internal/gui_internal_html.c 2012-12-22 18:34:20 UTC (rev 5301)
@@ -190,8 +190,13 @@
if (!src)
return NULL;
size=find_attr(names, values, "size");
- if (!size)
- size="l";
+ if (!size) {
+ const char *class=find_attr(names, values, "class");
+ if (class && !strcasecmp(class,"centry"))
+ size="xs";
+ else
+ size="l";
+ }
if (!strcmp(size,"l"))
img=image_new_l(this, src);
else if (!strcmp(size,"s"))
@@ -236,6 +241,7 @@
}
}
html->tag=tag;
+ html->class=find_attr_dup(names, values, "class");
if (!this->html_skip && !html->skip) {
switch (tag) {
case html_tag_a:
@@ -352,6 +358,7 @@
g_free(html->command);
g_free(html->name);
g_free(html->href);
+ g_free(html->class);
g_free(html->refresh_cond);
}
@@ -413,11 +420,10 @@
switch (html->tag) {
case html_tag_a:
if (html->name && len) {
-#if 0
- this->html_container=gui_internal_box_new(this, gravity_left_top|orientation_vertical|flags_expand|flags_fill);
-#else
- this->html_container=gui_internal_box_new(this, gravity_center|orientation_horizontal_vertical|flags_expand|flags_fill);
-#endif
+ if (html->class && !strcasecmp(html->class,"clist"))
+ this->html_container=gui_internal_box_new(this, gravity_left_top|orientation_vertical|flags_expand|flags_fill);
+ else
+ this->html_container=gui_internal_box_new(this, gravity_center|orientation_horizontal_vertical|flags_expand|flags_fill);
gui_internal_widget_append(gui_internal_menu(this, _(text_stripped)), this->html_container);
gui_internal_menu_data(this)->href=g_strdup(this->href);
gui_internal_set_refresh_callback(this, html->refresh_cond);
@@ -433,11 +439,10 @@
break;
case html_tag_img:
if (len) {
-#if 0
- w=gui_internal_box_new(this, gravity_left_top|orientation_horizontal|flags_fill);
-#else
- w=gui_internal_box_new(this, gravity_center|orientation_vertical);
-#endif
+ if (html->class && !strcasecmp(html->class, "centry"))
+ w=gui_internal_box_new(this, gravity_left_top|orientation_horizontal|flags_fill);
+ else
+ w=gui_internal_box_new(this, gravity_center|orientation_vertical);
gui_internal_widget_append(w, html->w);
gui_internal_widget_append(w, gui_internal_text_new(this, _(text_stripped), gravity_left_top|orientation_vertical|flags_fill));
html->w=w;
Modified: trunk/navit/navit/gui/internal/gui_internal_priv.h
===================================================================
--- trunk/navit/navit/gui/internal/gui_internal_priv.h 2012-12-22 18:33:00 UTC (rev 5300)
+++ trunk/navit/navit/gui/internal/gui_internal_priv.h 2012-12-22 18:34:20 UTC (rev 5301)
@@ -138,6 +138,7 @@
char *name;
char *href;
char *refresh_cond;
+ char *class;
int font_size;
struct widget *w;
struct widget *container;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|