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: <mar...@us...> - 2013-06-01 21:58:00
|
Revision: 5530 http://navit.svn.sourceforge.net/navit/?rev=5530&view=rev Author: martin-s Date: 2013-06-01 21:57:54 +0000 (Sat, 01 Jun 2013) Log Message: ----------- Add:Build:Experimental script for recoloring svg images Added Paths: ----------- trunk/navit/cmake/recolor.cmake Added: trunk/navit/cmake/recolor.cmake =================================================================== --- trunk/navit/cmake/recolor.cmake (rev 0) +++ trunk/navit/cmake/recolor.cmake 2013-06-01 21:57:54 UTC (rev 5530) @@ -0,0 +1,5 @@ +file(READ "${SRC}" OUTPUT_LINES) +string(REGEX REPLACE "fill:#111111" "fill:${BGCOLOR}" OUTPUT_LINES "${OUTPUT_LINES}") +string(REGEX REPLACE "fill:#ffffff" "fill:${FGCOLOR}" OUTPUT_LINES "${OUTPUT_LINES}") +string(REGEX REPLACE "stroke:#ffffff" "stroke:${FGCOLOR}" OUTPUT_LINES "${OUTPUT_LINES}") +file(WRITE "${DST}" "${OUTPUT_LINES}") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2013-06-01 20:13:02
|
Revision: 5529 http://navit.svn.sourceforge.net/navit/?rev=5529&view=rev Author: martin-s Date: 2013-06-01 20:12:55 +0000 (Sat, 01 Jun 2013) Log Message: ----------- Add:Core:Activate code to make layout setting persistent Modified Paths: -------------- trunk/navit/navit/navit_shipped.xml Modified: trunk/navit/navit/navit_shipped.xml =================================================================== --- trunk/navit/navit/navit_shipped.xml 2013-06-01 20:06:22 UTC (rev 5528) +++ trunk/navit/navit/navit_shipped.xml 2013-06-01 20:12:55 UTC (rev 5529) @@ -77,8 +77,8 @@ <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 Layouts'><img src='gui_display'><text>Layout</text></img></a> --> + <!-- <img src='gui_display' onclick='setting_layout()'><text>Layout</text></img> --> + <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> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2013-06-01 20:06:30
|
Revision: 5528 http://navit.svn.sourceforge.net/navit/?rev=5528&view=rev Author: martin-s Date: 2013-06-01 20:06:22 +0000 (Sat, 01 Jun 2013) Log Message: ----------- Add:gui_internal:Further code in preparation of making the box widget scrollable Modified Paths: -------------- trunk/navit/navit/gui/internal/gui_internal.h trunk/navit/navit/gui/internal/gui_internal_html.c trunk/navit/navit/gui/internal/gui_internal_widget.c trunk/navit/navit/gui/internal/gui_internal_widget.h Modified: trunk/navit/navit/gui/internal/gui_internal.h =================================================================== --- trunk/navit/navit/gui/internal/gui_internal.h 2013-06-01 16:32:45 UTC (rev 5527) +++ trunk/navit/navit/gui/internal/gui_internal.h 2013-06-01 20:06:22 UTC (rev 5528) @@ -10,6 +10,7 @@ #define STATE_CLEAR 32 #define STATE_EDITABLE 64 #define STATE_SCROLLABLE 128 +#define STATE_OFFSCREEN 256 #define GESTURE_RINGSIZE 100 @@ -42,6 +43,8 @@ flags_expand=0x100, flags_fill=0x200, flags_swap=0x400, + flags_scrollx=0x800, + flags_scrolly=0x1000, orientation_horizontal=0x10000, orientation_vertical=0x20000, orientation_horizontal_vertical=0x40000, Modified: trunk/navit/navit/gui/internal/gui_internal_html.c =================================================================== --- trunk/navit/navit/gui/internal/gui_internal_html.c 2013-06-01 16:32:45 UTC (rev 5527) +++ trunk/navit/navit/gui/internal/gui_internal_html.c 2013-06-01 20:06:22 UTC (rev 5528) @@ -428,7 +428,7 @@ case html_tag_a: if (html->name && len) { if (html->class && !strcasecmp(html->class,"clist")) - this->html_container=gui_internal_box_new(this, gravity_left_top|orientation_vertical|flags_expand|flags_fill); + this->html_container=gui_internal_box_new(this, gravity_left_top|orientation_vertical|flags_expand|flags_fill /* |flags_scrolly */); 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); Modified: trunk/navit/navit/gui/internal/gui_internal_widget.c =================================================================== --- trunk/navit/navit/gui/internal/gui_internal_widget.c 2013-06-01 16:32:45 UTC (rev 5527) +++ trunk/navit/navit/gui/internal/gui_internal_widget.c 2013-06-01 20:06:22 UTC (rev 5528) @@ -11,6 +11,7 @@ #include "gui_internal_priv.h" #include "gui_internal_menu.h" +static void gui_internal_scroll_buttons_init(struct gui_priv *this, struct widget *widget, struct scroll_buttons *sb); static void gui_internal_background_render(struct gui_priv *this, struct widget *w) @@ -331,9 +332,12 @@ l=w->children; while (l) { wc=l->data; - gui_internal_widget_render(this, wc); + if (!(wc->state & STATE_OFFSCREEN)) + gui_internal_widget_render(this, wc); l=g_list_next(l); } + if (w->scroll_buttons) + gui_internal_widget_render(this, w->scroll_buttons->button_box); } @@ -346,6 +350,7 @@ { struct widget *wc; int x0,x=0,y=0,width=0,height=0,owidth=0,oheight=0,expand=0,expandd=1,count=0,rows=0,cols=w->cols ? w->cols : 0; + int hb=w->scroll_buttons?w->scroll_buttons->button_box->h:0; GList *l; int orientation=w->flags & 0xffff0000; @@ -425,8 +430,8 @@ } oheight=height; if (expand && w->h) { - expandd=w->h-height+expand; - oheight=w->h; + expandd=w->h-hb-height+expand; + oheight=w->h-hb; } else expandd=expand=1; break; @@ -474,7 +479,7 @@ } if (! w->w && ! w->h) { w->w=w->bl+w->br+width; - w->h=w->bt+w->bb+height; + w->h=w->bt+w->bb+height+hb; w->packed=1; } #if 0 @@ -498,9 +503,9 @@ if (w->flags & gravity_top) y=w->p.y+w->bt; if (w->flags & gravity_ycenter) - y=w->p.y+w->h/2-oheight/2; + y=w->p.y+(w->h-hb)/2-oheight/2; if (w->flags & gravity_bottom) - y=w->p.y+w->h-w->bb-oheight; + y=w->p.y+(w->h-hb)-w->bb-oheight; l=w->children; switch (orientation) { case orientation_horizontal: @@ -509,7 +514,7 @@ wc=l->data; wc->p.x=x; if (wc->flags & flags_fill) - wc->h=w->h; + wc->h=w->h-hb; if (wc->flags & flags_expand) { if (! wc->w) wc->w=1; @@ -543,6 +548,14 @@ wc->p.x=x-wc->w/2; if (w->flags & gravity_right) wc->p.x=x-wc->w; +#if 0 + if (w->flags & flags_scrolly) + dbg(0,"%d - %d vs %d - %d\n",y,y+wc->h,w->p.y,w->p.y+w->h-hb); + if (y+wc->h > w->p.y+w->h-hb || y+wc->h < w->p.y) + wc->state |= STATE_OFFSCREEN; + else + wc->state &= ~STATE_OFFSCREEN; +#endif y+=wc->h+w->spy; l=g_list_next(l); } @@ -585,6 +598,17 @@ default: break; } + if ((w->flags & flags_scrolly) && y > w->h+w->p.y && !w->scroll_buttons) { + w->scroll_buttons=g_new0(struct scroll_buttons, 1); + gui_internal_scroll_buttons_init(this, w, w->scroll_buttons); + w->scroll_buttons->button_box->w=w->w; + w->scroll_buttons->button_box->p.x=w->p.x; + w->scroll_buttons->button_box->p.y=w->p.y+w->h-w->scroll_buttons->button_box->h; + gui_internal_widget_pack(this, w->scroll_buttons->button_box); + dbg(0,"needs buttons %d vs %d\n",y,w->h); + gui_internal_box_pack(this, w); + return; + } /** * Call pack again on each child, * the child has now had its size and coordinates @@ -759,7 +783,6 @@ gravity_center|orientation_horizontal, gui_internal_table_button_prev, widget); sb->button_box=gui_internal_box_new(this, gravity_center|orientation_horizontal); - gui_internal_widget_append(widget, sb->button_box); gui_internal_widget_append(sb->button_box, sb->prev_button); gui_internal_widget_append(sb->button_box, sb->next_button); @@ -794,8 +817,10 @@ widget->background=this->background; data = (struct table_data*)widget->data; - if (buttons) + if (buttons) { gui_internal_scroll_buttons_init(this, widget, &data->scroll_buttons); + gui_internal_widget_append(widget, data->scroll_buttons.button_box); + } return widget; Modified: trunk/navit/navit/gui/internal/gui_internal_widget.h =================================================================== --- trunk/navit/navit/gui/internal/gui_internal_widget.h 2013-06-01 16:32:45 UTC (rev 5527) +++ trunk/navit/navit/gui/internal/gui_internal_widget.h 2013-06-01 20:06:22 UTC (rev 5528) @@ -74,6 +74,7 @@ struct form *form; GList *children; struct widget *parent; + struct scroll_buttons *scroll_buttons; }; struct scroll_buttons { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2013-06-01 16:32:52
|
Revision: 5527 http://navit.svn.sourceforge.net/navit/?rev=5527&view=rev Author: martin-s Date: 2013-06-01 16:32:45 +0000 (Sat, 01 Jun 2013) Log Message: ----------- Add:gui_internal:Made scroll buttons more abstract Modified Paths: -------------- trunk/navit/navit/gui/internal/gui_internal.c trunk/navit/navit/gui/internal/gui_internal_keyboard.c trunk/navit/navit/gui/internal/gui_internal_poi.c trunk/navit/navit/gui/internal/gui_internal_widget.c trunk/navit/navit/gui/internal/gui_internal_widget.h Modified: trunk/navit/navit/gui/internal/gui_internal.c =================================================================== --- trunk/navit/navit/gui/internal/gui_internal.c 2013-06-01 16:11:29 UTC (rev 5526) +++ trunk/navit/navit/gui/internal/gui_internal.c 2013-06-01 16:32:45 UTC (rev 5527) @@ -349,8 +349,8 @@ int y=wt->p.y+wt->h-wr->h; int n; - if(td->button_box && td->button_box->p.y!=0) - y=td->button_box->p.y - td->button_box->h; + if(td->scroll_buttons.button_box && td->scroll_buttons.button_box->p.y!=0) + y=td->scroll_buttons.button_box->p.y - td->scroll_buttons.button_box->h; if(y>this->current.y) y=this->current.y; Modified: trunk/navit/navit/gui/internal/gui_internal_keyboard.c =================================================================== --- trunk/navit/navit/gui/internal/gui_internal_keyboard.c 2013-06-01 16:11:29 UTC (rev 5526) +++ trunk/navit/navit/gui/internal/gui_internal_keyboard.c 2013-06-01 16:32:45 UTC (rev 5527) @@ -256,7 +256,7 @@ if(md->search_list && md->search_list->type==widget_table) { struct table_data *td=(struct table_data*)(md->search_list->data); - td->button_box_hide=mode<1024; + td->scroll_buttons.button_box_hide=mode<1024; } if (mode >= 56 && mode < 64) { /* special case for coordinates input screen (enter_coord) */ Modified: trunk/navit/navit/gui/internal/gui_internal_poi.c =================================================================== --- trunk/navit/navit/gui/internal/gui_internal_poi.c 2013-06-01 16:11:29 UTC (rev 5526) +++ trunk/navit/navit/gui/internal/gui_internal_poi.c 2013-06-01 16:32:45 UTC (rev 5527) @@ -784,11 +784,11 @@ } if(currow>=param->count) break; - if(!(td->next_button->state & STATE_SENSITIVE)) { + if(!(td->scroll_buttons.next_button->state & STATE_SENSITIVE)) { dbg(0,"Reached last page but item %i not found. Stop paging.\n",param->count); break; } - gui_internal_table_button_next(this, td->next_button, NULL); + gui_internal_table_button_next(this, td->scroll_buttons.next_button, NULL); } #endif } Modified: trunk/navit/navit/gui/internal/gui_internal_widget.c =================================================================== --- trunk/navit/navit/gui/internal/gui_internal_widget.c 2013-06-01 16:11:29 UTC (rev 5526) +++ trunk/navit/navit/gui/internal/gui_internal_widget.c 2013-06-01 16:32:45 UTC (rev 5527) @@ -750,6 +750,23 @@ return wlb; } +static void +gui_internal_scroll_buttons_init(struct gui_priv *this, struct widget *widget, struct scroll_buttons *sb) +{ + sb->next_button = gui_internal_button_new_with_callback(this, _("Next"), image_new_xs(this, "gui_arrow_right"), + gravity_center|orientation_horizontal|flags_swap, gui_internal_table_button_next, widget); + sb->prev_button = gui_internal_button_new_with_callback(this, _("Prev"), image_new_xs(this, "gui_arrow_left"), + gravity_center|orientation_horizontal, gui_internal_table_button_prev, widget); + + sb->button_box=gui_internal_box_new(this, gravity_center|orientation_horizontal); + gui_internal_widget_append(widget, sb->button_box); + gui_internal_widget_append(sb->button_box, sb->prev_button); + gui_internal_widget_append(sb->button_box, sb->next_button); + + sb->button_box->bl=this->spacing; + gui_internal_widget_pack(this,sb->button_box); +} + /** * @brief Creates a new table widget. * @@ -777,23 +794,9 @@ widget->background=this->background; data = (struct table_data*)widget->data; - if (buttons) { - data->next_button = gui_internal_button_new_with_callback(this, _("Next"), image_new_xs(this, "gui_arrow_right"), - gravity_center|orientation_horizontal|flags_swap, gui_internal_table_button_next, widget); - data->prev_button = gui_internal_button_new_with_callback(this, _("Prev"), image_new_xs(this, "gui_arrow_left"), - gravity_center|orientation_horizontal, gui_internal_table_button_prev, widget); + if (buttons) + gui_internal_scroll_buttons_init(this, widget, &data->scroll_buttons); - data->this=this; - - data->button_box=gui_internal_box_new(this, gravity_center|orientation_horizontal); - gui_internal_widget_append(widget, data->button_box); - gui_internal_widget_append(data->button_box, data->prev_button); - gui_internal_widget_append(data->button_box, data->next_button); - - data->button_box->bl=this->spacing; - gui_internal_widget_pack(this,data->button_box); - } - return widget; } @@ -810,7 +813,7 @@ iter = table->children; while(iter ) { - if(iter->data != table_data->button_box) { + if(iter->data != table_data->scroll_buttons.button_box) { struct widget * child = (struct widget*)iter->data; gui_internal_widget_destroy(this,child); if(table->children == iter) { @@ -964,7 +967,7 @@ { cur_row_widget = (struct widget*) cur_row->data; current_desc = column_desc; - if(cur_row_widget == table_data->button_box) + if(cur_row_widget == table_data->scroll_buttons.button_box) { continue; } @@ -1050,7 +1053,7 @@ for(current = column_data; current; current=g_list_next(current)) { - if(table_data->button_box == current->data ) + if(table_data->scroll_buttons.button_box == current->data ) { continue; } @@ -1066,7 +1069,7 @@ for(current=w->children; current; current=g_list_next(current)) { - if(current->data!= table_data->button_box) + if(current->data!= table_data->scroll_buttons.button_box) { count++; } @@ -1088,9 +1091,9 @@ w->h = this->root.h- w->c.y - height; } - if (table_data->button_box) + if (table_data->scroll_buttons.button_box) { - gui_internal_widget_pack(this,table_data->button_box); + gui_internal_widget_pack(this,table_data->scroll_buttons.button_box); } @@ -1158,7 +1161,7 @@ * Skip rows that are on previous pages. */ cur_row = w->children; - if(table_data->top_row && table_data->top_row != w->children && !table_data->button_box_hide) + if(table_data->top_row && table_data->top_row != w->children && !table_data->scroll_buttons.button_box_hide) { cur_row = table_data->top_row; is_first_page=0; @@ -1177,14 +1180,14 @@ current_desc = column_desc; cur_row_widget = (struct widget*)cur_row->data; x =w->p.x+this->spacing; - if(cur_row_widget == table_data->button_box ) + if(cur_row_widget == table_data->scroll_buttons.button_box ) { continue; } dim = (struct table_column_desc*)current_desc->data; - if (table_data->button_box && !table_data->button_box_hide) - bbox_height=table_data->button_box->h; + if (table_data->scroll_buttons.button_box && !table_data->scroll_buttons.button_box_hide) + bbox_height=table_data->scroll_buttons.button_box->h; if( y + dim->height + bbox_height + this->spacing >= w->p.y + w->h ) { @@ -1229,45 +1232,45 @@ table_data->bottom_row=cur_row; current_desc = g_list_next(current_desc); } - if(table_data->button_box && (is_skipped || !is_first_page) && !table_data->button_box_hide ) + if(table_data->scroll_buttons.button_box && (is_skipped || !is_first_page) && !table_data->scroll_buttons.button_box_hide ) { - table_data->button_box->p.y =w->p.y+w->h-table_data->button_box->h - + table_data->scroll_buttons.button_box->p.y =w->p.y+w->h-table_data->scroll_buttons.button_box->h - this->spacing; - if(table_data->button_box->p.y < y ) + if(table_data->scroll_buttons.button_box->p.y < y ) { - table_data->button_box->p.y=y; + table_data->scroll_buttons.button_box->p.y=y; } - table_data->button_box->p.x = w->p.x; - table_data->button_box->w = w->w; + table_data->scroll_buttons.button_box->p.x = w->p.x; + table_data->scroll_buttons.button_box->w = w->w; // table_data->button_box->h = w->h - y; // table_data->next_button->h=table_data->button_box->h; // table_data->prev_button->h=table_data->button_box->h; // table_data->next_button->c.y=table_data->button_box->c.y; // table_data->prev_button->c.y=table_data->button_box->c.y; - gui_internal_widget_pack(this,table_data->button_box); - if(table_data->next_button->p.y > w->p.y + w->h + table_data->next_button->h) + gui_internal_widget_pack(this,table_data->scroll_buttons.button_box); + if(table_data->scroll_buttons.next_button->p.y > w->p.y + w->h + table_data->scroll_buttons.next_button->h) { - table_data->button_box->p.y = w->p.y + w->h - - table_data->button_box->h; + table_data->scroll_buttons.button_box->p.y = w->p.y + w->h - + table_data->scroll_buttons.button_box->h; } if(is_skipped) { - table_data->next_button->state|= STATE_SENSITIVE; + table_data->scroll_buttons.next_button->state|= STATE_SENSITIVE; } else { - table_data->next_button->state&= ~STATE_SENSITIVE; + table_data->scroll_buttons.next_button->state&= ~STATE_SENSITIVE; } if(table_data->top_row != w->children) { - table_data->prev_button->state|= STATE_SENSITIVE; + table_data->scroll_buttons.prev_button->state|= STATE_SENSITIVE; } else { - table_data->prev_button->state&= ~STATE_SENSITIVE; + table_data->scroll_buttons.prev_button->state&= ~STATE_SENSITIVE; } - gui_internal_widget_render(this,table_data->button_box); + gui_internal_widget_render(this,table_data->scroll_buttons.button_box); } /** @@ -1343,8 +1346,8 @@ int n; GList *top=table_data->top_row; struct widget *w=(struct widget*)top->data; - if(table_data->button_box->p.y!=0) { - bottomy=table_data->button_box->p.y; + if(table_data->scroll_buttons.button_box->p.y!=0) { + bottomy=table_data->scroll_buttons.button_box->p.y; } n=(bottomy-w->p.y)/w->h; while(n-- > 0 && (top=g_list_previous(top))!=NULL); Modified: trunk/navit/navit/gui/internal/gui_internal_widget.h =================================================================== --- trunk/navit/navit/gui/internal/gui_internal_widget.h 2013-06-01 16:11:29 UTC (rev 5526) +++ trunk/navit/navit/gui/internal/gui_internal_widget.h 2013-06-01 16:32:45 UTC (rev 5527) @@ -76,6 +76,31 @@ struct widget *parent; }; +struct scroll_buttons { + /** + * Button box should not be displayed if button_box_hide is not zero. + */ + int button_box_hide; + /** + * A container box that is the child of the table widget that contains+groups + * the next and previous button. + */ + struct widget * button_box; + /** + * A button widget to handle 'next page' requests + */ + struct widget * next_button; + /** + * A button widget to handle 'previous page' requests. + */ + struct widget * prev_button; + /** + * a pointer to the gui context. + * This is needed by the free function to destory the buttons. + */ + struct gui_priv * this; +}; + /** * @brief A structure to store information about a table. * @@ -98,32 +123,8 @@ */ GList * bottom_row; - /** - * A container box that is the child of the table widget that contains+groups - * the next and previous button. - */ - struct widget * button_box; + struct scroll_buttons scroll_buttons; - /** - * Button box should not be displayed if button_box_hide is not zero. - */ - int button_box_hide; - - /** - * A button widget to handle 'next page' requests - */ - struct widget * next_button; - /** - * A button widget to handle 'previous page' requests. - */ - struct widget * prev_button; - - - /** - * a pointer to the gui context. - * This is needed by the free function to destory the buttons. - */ - struct gui_priv * this; }; /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2013-06-01 16:11:37
|
Revision: 5526 http://navit.svn.sourceforge.net/navit/?rev=5526&view=rev Author: martin-s Date: 2013-06-01 16:11:29 +0000 (Sat, 01 Jun 2013) Log Message: ----------- Fix:gui_internal:Cleaned up scroll buttons a bit Modified Paths: -------------- trunk/navit/navit/gui/internal/gui_internal.h trunk/navit/navit/gui/internal/gui_internal_widget.c Modified: trunk/navit/navit/gui/internal/gui_internal.h =================================================================== --- trunk/navit/navit/gui/internal/gui_internal.h 2013-06-01 15:29:10 UTC (rev 5525) +++ trunk/navit/navit/gui/internal/gui_internal.h 2013-06-01 16:11:29 UTC (rev 5526) @@ -41,6 +41,7 @@ gravity_right_bottom=gravity_right|gravity_bottom, flags_expand=0x100, flags_fill=0x200, + flags_swap=0x400, orientation_horizontal=0x10000, orientation_vertical=0x20000, orientation_horizontal_vertical=0x40000, Modified: trunk/navit/navit/gui/internal/gui_internal_widget.c =================================================================== --- trunk/navit/navit/gui/internal/gui_internal_widget.c 2013-06-01 15:29:10 UTC (rev 5525) +++ trunk/navit/navit/gui/internal/gui_internal_widget.c 2013-06-01 16:11:29 UTC (rev 5526) @@ -169,10 +169,12 @@ struct widget *ret=NULL; ret=gui_internal_box_new(this, flags); if (ret) { - if (image) + if (image && !(flags & flags_swap)) gui_internal_widget_append(ret, gui_internal_image_new(this, image)); if (text) gui_internal_widget_append(ret, gui_internal_text_font_new(this, text, font, gravity_center|orientation_vertical)); + if (image && (flags & flags_swap)) + gui_internal_widget_append(ret, gui_internal_image_new(this, image)); ret->func=func; ret->data=data; if (func) { @@ -776,25 +778,14 @@ data = (struct table_data*)widget->data; if (buttons) { - data->next_button=gui_internal_box_new(this, gravity_center|orientation_horizontal); - gui_internal_widget_append(data->next_button, gui_internal_text_new(this,_("Next"),gravity_center|orientation_horizontal)); - gui_internal_widget_append(data->next_button, gui_internal_image_new(this, image_new_xs(this, "gui_arrow_right"))); - data->next_button->func=gui_internal_table_button_next; - data->next_button->data=widget; + data->next_button = gui_internal_button_new_with_callback(this, _("Next"), image_new_xs(this, "gui_arrow_right"), + gravity_center|orientation_horizontal|flags_swap, gui_internal_table_button_next, widget); + data->prev_button = gui_internal_button_new_with_callback(this, _("Prev"), image_new_xs(this, "gui_arrow_left"), + gravity_center|orientation_horizontal, gui_internal_table_button_prev, widget); - - data->prev_button = gui_internal_button_new_with_callback - (this, _("Prev"), - image_new_xs(this, "gui_arrow_left"), - gravity_center |orientation_horizontal, - gui_internal_table_button_prev,NULL); - - data->prev_button->data=widget; - data->this=this; - data->button_box=gui_internal_box_new(this, - gravity_center|orientation_horizontal); + data->button_box=gui_internal_box_new(this, gravity_center|orientation_horizontal); gui_internal_widget_append(widget, data->button_box); gui_internal_widget_append(data->button_box, data->prev_button); gui_internal_widget_append(data->button_box, data->next_button); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2013-06-01 15:29:16
|
Revision: 5525 http://navit.svn.sourceforge.net/navit/?rev=5525&view=rev Author: martin-s Date: 2013-06-01 15:29:10 +0000 (Sat, 01 Jun 2013) Log Message: ----------- Add:Core:Begin of support for reading icons from zip file Modified Paths: -------------- trunk/navit/navit/graphics.c trunk/navit/navit/graphics.h Modified: trunk/navit/navit/graphics.c =================================================================== --- trunk/navit/navit/graphics.c 2013-06-01 07:56:28 UTC (rev 5524) +++ trunk/navit/navit/graphics.c 2013-06-01 15:29:10 UTC (rev 5525) @@ -605,6 +605,71 @@ return graphics_image_new_scaled_rotated(gra, path, w, h, 0); } +static void +image_new_helper(struct graphics *gra, struct graphics_image *this_, char *path, char *name, int width, int height, int rotate, int zip) +{ + int i; + for (i = 1 ; i <= 6 ; i++) { + char *new_name=NULL; + switch (i) { + case 1: + /* The best variant both for cpu usage and quality would be prescaled png of a needed size */ + if (width != -1 && height != -1) { + new_name=g_strdup_printf("%s_%d_%d.png", name, width, height); + } + break; + case 2: + /* Try to load image by the exact name given by user. For example, if she wants to + scale some prescaled png variant to a new size given as function params, or have + default png image to be displayed unscaled. */ + new_name=g_strdup(path); + break; + case 3: + /* Next, try uncompressed and compressed svgs as they should give best quality but + rendering might take more cpu resources when the image is displayed for the first time */ + new_name=g_strdup_printf("%s.svg", name); + break; + case 4: + new_name=g_strdup_printf("%s.svgz", name); + break; + case 5: + /* Scaling the default png to the needed size may give some quality loss */ + new_name=g_strdup_printf("%s.png", name); + break; + case 6: + /* xpm format is used as a last resort, because its not widely supported and we are moving to svg and png formats */ + new_name=g_strdup_printf("%s.xpm", name); + break; + } + if (! new_name) + continue; + + this_->width=width; + this_->height=height; + dbg(2,"Trying to load image '%s' for '%s' at %dx%d\n", new_name, path, width, height); + if (zip) { + unsigned char *start; + int len; + if (file_get_contents(new_name, &start, &len)) { + struct graphics_image_buffer buffer={"buffer:",graphics_image_type_unknown}; + buffer.start=start; + buffer.len=len; + this_->priv=gra->meth.image_new(gra->priv, &this_->meth, (char *)&buffer, &this_->width, &this_->height, &this_->hot, rotate); + g_free(start); + } + } else { + if (strcmp(new_name,"buffer:")) + this_->priv=gra->meth.image_new(gra->priv, &this_->meth, new_name, &this_->width, &this_->height, &this_->hot, rotate); + } + if (this_->priv) { + dbg(1,"Using image '%s' for '%s' at %dx%d\n", new_name, path, width, height); + g_free(new_name); + break; + } + g_free(new_name); + } +} + /** * Create a new image from file path scaled to w and h pixels and possibly rotated * @param gra the graphics instance @@ -632,7 +697,7 @@ if(!this_->priv) { char *ext; - char *s, *name, *new_name; + char *s, *name; int len=strlen(path); int i,k; int newwidth=-1, newheight=-1; @@ -688,53 +753,12 @@ newheight=h; name=g_strndup(path,s-path); - for (i = 1 ; i <= 6 ; i++) { - new_name=NULL; - switch (i) { - case 1: - /* The best variant both for cpu usage and quality would be prescaled png of a needed size */ - if (newwidth != -1 && newheight != -1) { - new_name=g_strdup_printf("%s_%d_%d.png", name, newwidth, newheight); - } - break; - case 2: - /* Try to load image by the exact name given by user. For example, if she wants to - scale some prescaled png variant to a new size given as function params, or have - default png image to be displayed unscaled. */ - new_name=g_strdup(path); - break; - case 3: - /* Next, try uncompressed and compressed svgs as they should give best quality but - rendering might take more cpu resources when the image is displayed for the first time */ - new_name=g_strdup_printf("%s.svg", name); - break; - case 4: - new_name=g_strdup_printf("%s.svgz", name); - break; - case 5: - /* Scaling the default png to the needed size may give some quality loss */ - new_name=g_strdup_printf("%s.png", name); - break; - case 6: - /* xpm format is used as a last resort, because its not widely supported and we are moving to svg and png formats */ - new_name=g_strdup_printf("%s.xpm", name); - break; - } - if (! new_name) - continue; - - this_->width=newwidth; - this_->height=newheight; - dbg(2,"Trying to load image '%s' for '%s' at %dx%d\n", new_name, path, newwidth, newheight); - if (strcmp(new_name,"buffer:")) - this_->priv=gra->meth.image_new(gra->priv, &this_->meth, new_name, &this_->width, &this_->height, &this_->hot, rotate); - if (this_->priv) { - dbg(1,"Using image '%s' for '%s' at %dx%d\n", new_name, path, newwidth, newheight); - g_free(new_name); - break; - } - g_free(new_name); - } +#if 0 + if (!strstr(name,"test.zip")) +#endif + image_new_helper(gra, this_, path, name, newwidth, newheight, rotate, 0); + if (!this_->priv && strstr(path, ".zip/")) + image_new_helper(gra, this_, path, name, newwidth, newheight, rotate, 1); g_free(name); } Modified: trunk/navit/navit/graphics.h =================================================================== --- trunk/navit/navit/graphics.h 2013-06-01 07:56:28 UTC (rev 5524) +++ trunk/navit/navit/graphics.h 2013-06-01 15:29:10 UTC (rev 5525) @@ -52,7 +52,7 @@ }; struct graphics_image_buffer { - char magic[8]; /* buffer:\n */ + char magic[8]; /* buffer:\0 */ enum graphics_image_type type; void *start; int len; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2013-06-01 07:56:45
|
Revision: 5524 http://navit.svn.sourceforge.net/navit/?rev=5524&view=rev Author: martin-s Date: 2013-06-01 07:56:28 +0000 (Sat, 01 Jun 2013) Log Message: ----------- Add:graphics_gtk_drawing_area:Avoid double caching, allow to read image from buffer Modified Paths: -------------- trunk/navit/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c Modified: trunk/navit/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c =================================================================== --- trunk/navit/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c 2013-06-01 05:48:15 UTC (rev 5523) +++ trunk/navit/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c 2013-06-01 07:56:28 UTC (rev 5524) @@ -111,18 +111,11 @@ #endif }; -static GHashTable *hImageData; /*hastable for uncompressed image data*/ -static int hImageDataCount; -static struct graphics_image_priv image_error; - static void graphics_destroy_image(gpointer data) { struct graphics_image_priv *priv = (struct graphics_image_priv*)data; - if (priv == &image_error) - return; - #ifdef HAVE_IMLIB2 if (priv->image) { imlib_context_set_image(priv->image); @@ -149,9 +142,6 @@ gtk_widget_destroy(gr->widget); g_free(gr->window_title); } - dbg(3,"hImageDataCount %d\n",hImageDataCount); - if (!--hImageDataCount) - g_hash_table_destroy(hImageData); g_free(gr); } @@ -237,97 +227,75 @@ image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h, struct point *hot, int rotation) { GdkPixbuf *pixbuf; + GInputStream *stream; struct graphics_image_priv *ret; const char *option; + + if (!strcmp(name,"buffer:")) { + struct graphics_image_buffer *buffer=(struct graphics_image_buffer *)name; + stream=g_memory_input_stream_new_from_data(buffer->start, buffer->len, NULL); + if (!stream) + return NULL; + if (*w == -1 && *h == -1) + pixbuf=gdk_pixbuf_new_from_stream(stream, NULL, NULL); + else + pixbuf=gdk_pixbuf_new_from_stream_at_scale(stream, *w, *h, TRUE, NULL, NULL); - char* hash_key = g_strdup_printf("%s_%d_%d_%d",name,*w,*h,rotation); - - //check if image already exists in hashmap - struct graphics_image_priv *curr_elem = g_hash_table_lookup(hImageData, hash_key); - if(curr_elem == &image_error) { - //found but couldn't be loaded - g_free(hash_key); - return NULL; - } - else if(curr_elem) { - //found and OK -> use hashtable entry - g_free(hash_key); - *w = curr_elem->w; - *h = curr_elem->h; - hot->x = curr_elem->w / 2 - 1; - hot->y = curr_elem->h / 2 - 1; - ret=g_new0(struct graphics_image_priv, 1); - *ret = *curr_elem; - g_object_ref(ret->pixbuf); - return ret; - } - else { + } else { if (*w == -1 && *h == -1) pixbuf=gdk_pixbuf_new_from_file(name, NULL); else pixbuf=gdk_pixbuf_new_from_file_at_size(name, *w, *h, NULL); + } - if (!pixbuf) { - g_hash_table_insert(hImageData, g_strdup(hash_key), &image_error); - g_free(hash_key); + if (!pixbuf) + return NULL; + + if (rotation) { + GdkPixbuf *tmp; + switch (rotation) { + case 90: + rotation=270; + break; + case 180: + break; + case 270: + rotation=90; + break; + default: return NULL; } - if (rotation) { - GdkPixbuf *tmp; - switch (rotation) { - case 90: - rotation=270; - break; - case 180: - break; - case 270: - rotation=90; - break; - default: - g_hash_table_insert(hImageData, g_strdup(hash_key), &image_error); - g_free(hash_key); - return NULL; - } + tmp=gdk_pixbuf_rotate_simple(pixbuf, rotation); - tmp=gdk_pixbuf_rotate_simple(pixbuf, rotation); - - if (!tmp) { - g_hash_table_insert(hImageData, g_strdup(hash_key), &image_error); - g_free(hash_key); - g_object_unref(pixbuf); - return NULL; - } - + if (!tmp) { g_object_unref(pixbuf); - pixbuf=tmp; + return NULL; } - ret=g_new0(struct graphics_image_priv, 1); - ret->pixbuf=pixbuf; - ret->w=gdk_pixbuf_get_width(pixbuf); - ret->h=gdk_pixbuf_get_height(pixbuf); - *w=ret->w; - *h=ret->h; - if (hot) { - option=gdk_pixbuf_get_option(pixbuf, "x_hot"); - if (option) - hot->x=atoi(option); - else - hot->x=ret->w/2-1; - option=gdk_pixbuf_get_option(pixbuf, "y_hot"); - if (option) - hot->y=atoi(option); - else - hot->y=ret->h/2-1; - } - struct graphics_image_priv *cached = g_new0(struct graphics_image_priv, 1); - *cached = *ret; - g_hash_table_insert(hImageData, g_strdup(hash_key), cached); - g_object_ref(pixbuf); - g_free(hash_key); - return ret; + g_object_unref(pixbuf); + pixbuf=tmp; } + + ret=g_new0(struct graphics_image_priv, 1); + ret->pixbuf=pixbuf; + ret->w=gdk_pixbuf_get_width(pixbuf); + ret->h=gdk_pixbuf_get_height(pixbuf); + *w=ret->w; + *h=ret->h; + if (hot) { + option=gdk_pixbuf_get_option(pixbuf, "x_hot"); + if (option) + hot->x=atoi(option); + else + hot->x=ret->w/2-1; + option=gdk_pixbuf_get_option(pixbuf, "y_hot"); + if (option) + hot->y=atoi(option); + else + hot->y=ret->h/2-1; + } + return ret; } static void @@ -1305,10 +1273,6 @@ this->button_release[i].tv_usec = 0; } - //create hash table for uncompressed image data - if (!hImageDataCount++) - hImageData = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, graphics_destroy_image); - return this; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <xen...@us...> - 2013-06-01 05:48:27
|
Revision: 5523 http://navit.svn.sourceforge.net/navit/?rev=5523&view=rev Author: xenos1984 Date: 2013-06-01 05:48:15 +0000 (Sat, 01 Jun 2013) Log Message: ----------- Fix:gui/internal:Load POI icon from icon_src field for custom POIs. Modified Paths: -------------- trunk/navit/navit/gui/internal/gui_internal_poi.c Modified: trunk/navit/navit/gui/internal/gui_internal_poi.c =================================================================== --- trunk/navit/navit/gui/internal/gui_internal_poi.c 2013-05-31 20:09:28 UTC (rev 5522) +++ trunk/navit/navit/gui/internal/gui_internal_poi.c 2013-06-01 05:48:15 UTC (rev 5523) @@ -84,9 +84,10 @@ */ static struct graphics_image * -gui_internal_poi_icon(struct gui_priv *this, enum item_type type) +gui_internal_poi_icon(struct gui_priv *this, struct item *item) { struct attr layout; + struct attr icon_src; GList *layer; navit_get_attr(this->nav, attr_layout, &layout, NULL); layer=layout.u.layout->layers; @@ -95,15 +96,32 @@ while(itemgra) { GList *types=((struct itemgra *)itemgra->data)->type; while(types) { - if((long)types->data==type) { + if((long)types->data==item->type) { GList *element=((struct itemgra *)itemgra->data)->elements; while(element) { struct element * el=element->data; if(el->type==element_icon) { + char *src; + char *icon; struct graphics_image *img; - char *icon=g_strdup(el->u.icon.src); + if(item_is_custom_poi(*item)) { + struct map_rect *mr=map_rect_new(item->map, NULL); + item=map_rect_get_item_byid(mr, item->id_hi, item->id_lo); + if(item_attr_get(item, attr_icon_src, &icon_src)) { + src=el->u.icon.src; + if(!src || !src[0]) + src="%s"; + icon=g_strdup_printf(src,icon_src.u.str); + } + else { + icon=g_strdup(el->u.icon.src); + } + } + else { + icon=g_strdup(el->u.icon.src); + } char *dot=g_strrstr(icon,"."); - dbg(2,"%s %s\n", item_to_name(type),icon); + dbg(2,"%s %s\n", item_to_name(item->type),icon); if(dot) *dot=0; img=image_new_xs(this,icon); @@ -310,7 +328,7 @@ type=item_to_name(item->type); - icon=gui_internal_poi_icon(this,item->type); + icon=gui_internal_poi_icon(this,item); if(!icon) { icon=image_new_xs(this,"gui_inactive"); text=g_strdup_printf("%s%s%s%s %s", distbuf, dirbuf, routedistbuf, type, name); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2013-05-31 20:09:35
|
Revision: 5522 http://navit.svn.sourceforge.net/navit/?rev=5522&view=rev Author: martin-s Date: 2013-05-31 20:09:28 +0000 (Fri, 31 May 2013) Log Message: ----------- Fix:Core:Actually use xpm icons Modified Paths: -------------- trunk/navit/navit/graphics.c Modified: trunk/navit/navit/graphics.c =================================================================== --- trunk/navit/navit/graphics.c 2013-05-31 20:08:43 UTC (rev 5521) +++ trunk/navit/navit/graphics.c 2013-05-31 20:09:28 UTC (rev 5522) @@ -688,7 +688,7 @@ newheight=h; name=g_strndup(path,s-path); - for (i = 1 ; i < 6 ; i++) { + for (i = 1 ; i <= 6 ; i++) { new_name=NULL; switch (i) { case 1: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2013-05-31 20:08:50
|
Revision: 5521 http://navit.svn.sourceforge.net/navit/?rev=5521&view=rev Author: martin-s Date: 2013-05-31 20:08:43 +0000 (Fri, 31 May 2013) Log Message: ----------- Add:Core:Disallow buffer: as icon name Modified Paths: -------------- trunk/navit/navit/graphics.c Modified: trunk/navit/navit/graphics.c =================================================================== --- trunk/navit/navit/graphics.c 2013-05-30 22:07:32 UTC (rev 5520) +++ trunk/navit/navit/graphics.c 2013-05-31 20:08:43 UTC (rev 5521) @@ -726,7 +726,8 @@ this_->width=newwidth; this_->height=newheight; dbg(2,"Trying to load image '%s' for '%s' at %dx%d\n", new_name, path, newwidth, newheight); - this_->priv=gra->meth.image_new(gra->priv, &this_->meth, new_name, &this_->width, &this_->height, &this_->hot, rotate); + if (strcmp(new_name,"buffer:")) + this_->priv=gra->meth.image_new(gra->priv, &this_->meth, new_name, &this_->width, &this_->height, &this_->hot, rotate); if (this_->priv) { dbg(1,"Using image '%s' for '%s' at %dx%d\n", new_name, path, newwidth, newheight); g_free(new_name); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2013-05-30 22:07:38
|
Revision: 5520 http://navit.svn.sourceforge.net/navit/?rev=5520&view=rev Author: martin-s Date: 2013-05-30 22:07:32 +0000 (Thu, 30 May 2013) Log Message: ----------- Fix:Build:Link graphics_sdl against freetype in case of missing SDL_ttf Modified Paths: -------------- trunk/navit/CMakeLists.txt Modified: trunk/navit/CMakeLists.txt =================================================================== --- trunk/navit/CMakeLists.txt 2013-05-27 13:21:58 UTC (rev 5519) +++ trunk/navit/CMakeLists.txt 2013-05-30 22:07:32 UTC (rev 5520) @@ -306,6 +306,8 @@ if(SDLTTF_FOUND) set(SDL_TTF 1) list(APPEND SDL_LIBRARY ${SDLTTF_LIBRARY}) + else(SDLTTF_FOUND) + list(APPEND SDL_LIBRARY ${FREETYPE_LIBRARY}) endif(SDLTTF_FOUND) set_with_reason(graphics/sdl "SDL/SDL_image libs found" TRUE ${SDL_LIBRARY} ${SDLIMAGE_LIBRARY}) endif(SDL_FOUND AND SDLIMAGE_FOUND AND FREETYPE_FOUND) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2013-05-27 13:22:08
|
Revision: 5519 http://navit.svn.sourceforge.net/navit/?rev=5519&view=rev Author: martin-s Date: 2013-05-27 13:21:58 +0000 (Mon, 27 May 2013) Log Message: ----------- Fix:Core:Compilation with non gcc Modified Paths: -------------- trunk/navit/navit/debug.h Modified: trunk/navit/navit/debug.h =================================================================== --- trunk/navit/navit/debug.h 2013-05-26 19:47:24 UTC (rev 5518) +++ trunk/navit/navit/debug.h 2013-05-27 13:21:58 UTC (rev 5519) @@ -74,7 +74,11 @@ struct debug *debug_new(struct attr *parent, struct attr **attrs); int debug_level_get(const char *name); void debug_vprintf(int level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, va_list ap); -void debug_printf(int level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, ...) __attribute__ ((format (printf, 7, 8))); +void debug_printf(int level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, ...) +#ifdef __GNUC__ + __attribute__ ((format (printf, 7, 8))) +#endif +; void debug_assert_fail(const char *module, const int mlen, const char *function, const int flen, const char *file, int line, const char *expr); void debug_destroy(void); void debug_set_logfile(const char *path); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2013-05-26 19:47:33
|
Revision: 5518 http://navit.svn.sourceforge.net/navit/?rev=5518&view=rev Author: martin-s Date: 2013-05-26 19:47:24 +0000 (Sun, 26 May 2013) Log Message: ----------- Add:Core:Optinally let navigation determine when destination has been reached Modified Paths: -------------- trunk/navit/navit/navigation.c Modified: trunk/navit/navit/navigation.c =================================================================== --- trunk/navit/navit/navigation.c 2013-05-26 13:28:58 UTC (rev 5517) +++ trunk/navit/navit/navigation.c 2013-05-26 19:47:24 UTC (rev 5518) @@ -85,6 +85,7 @@ int delay; int curr_delay; int turn_around_count; + int flags; }; int distances[]={1,2,3,4,5,10,25,50,75,100,150,200,250,300,400,500,750,-1}; @@ -227,7 +228,9 @@ if ((attr=attr_search(attrs, NULL, attr_delay))) { ret->delay = attr->u.num; } - + if ((attr=attr_search(attrs, NULL, attr_flags))) { + ret->flags = attr->u.num; + } return ret; } @@ -1706,6 +1709,9 @@ } else { ret=g_strdup(_("then you have reached your destination.")); } + if (type == attr_navigation_speech && (nav->flags & 1)) + route_set_destination(nav->route, NULL, 0); + } g_free(d); return ret; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2013-05-26 13:29:05
|
Revision: 5517 http://navit.svn.sourceforge.net/navit/?rev=5517&view=rev Author: martin-s Date: 2013-05-26 13:28:58 +0000 (Sun, 26 May 2013) Log Message: ----------- Fix:Core:Reduced verbosity Modified Paths: -------------- trunk/navit/navit/navigation.c Modified: trunk/navit/navit/navigation.c =================================================================== --- trunk/navit/navit/navigation.c 2013-05-26 13:24:33 UTC (rev 5516) +++ trunk/navit/navit/navigation.c 2013-05-26 13:28:58 UTC (rev 5517) @@ -142,7 +142,7 @@ { struct map_rect *mr; struct item *item; - dbg(0,"enter %s\n", attr_to_name(type)); + dbg(1,"enter %s\n", attr_to_name(type)); switch (type) { case attr_map: attr->u.map=this_->map; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2013-05-26 13:24:41
|
Revision: 5516 http://navit.svn.sourceforge.net/navit/?rev=5516&view=rev Author: martin-s Date: 2013-05-26 13:24:33 +0000 (Sun, 26 May 2013) Log Message: ----------- Add:Core:New attribute turn_around_count for navigation Modified Paths: -------------- trunk/navit/navit/attr_def.h trunk/navit/navit/navigation.c Modified: trunk/navit/navit/attr_def.h =================================================================== --- trunk/navit/navit/attr_def.h 2013-05-26 13:23:28 UTC (rev 5515) +++ trunk/navit/navit/attr_def.h 2013-05-26 13:24:33 UTC (rev 5516) @@ -182,6 +182,7 @@ ATTR(battery_charge) /* mAh */ ATTR(battery_resistance) /* mOhm */ ATTR(battery_temperature) /* mK */ +ATTR(turn_around_count) ATTR2(0x00027500,type_rel_abs_begin) /* These attributes are int that can either hold relative * * or absolute values. A relative value is indicated by * Modified: trunk/navit/navit/navigation.c =================================================================== --- trunk/navit/navit/navigation.c 2013-05-26 13:23:28 UTC (rev 5515) +++ trunk/navit/navit/navigation.c 2013-05-26 13:24:33 UTC (rev 5516) @@ -84,6 +84,7 @@ int tell_street_name; int delay; int curr_delay; + int turn_around_count; }; int distances[]={1,2,3,4,5,10,25,50,75,100,150,200,250,300,400,500,750,-1}; @@ -141,7 +142,7 @@ { struct map_rect *mr; struct item *item; - dbg(1,"enter %s\n", attr_to_name(type)); + dbg(0,"enter %s\n", attr_to_name(type)); switch (type) { case attr_map: attr->u.map=this_->map; @@ -165,6 +166,9 @@ if (!item) return 0; break; + case attr_turn_around_count: + attr->u.num=this_->turn_around_count; + break; default: return navit_object_get_attr((struct navit_object *)this_, type, attr, iter); } @@ -172,6 +176,16 @@ return 1; } +static void +navigation_set_turnaround(struct navigation *this_, int val) +{ + if (this_->turn_around_count != val) { + struct attr attr=ATTR_INT(turn_around_count, val); + this_->turn_around_count=val; + navit_object_callbacks((struct navit_object *)this_, &attr); + } +} + int navigation_set_attr(struct navigation *this_, struct attr *attr) { @@ -1571,8 +1585,11 @@ if (type != attr_navigation_long_exact) distance=round_distance(distance); if (type == attr_navigation_speech) { - if (nav->turn_around && nav->turn_around == nav->turn_around_limit) + if (nav->turn_around && nav->turn_around == nav->turn_around_limit) { + navigation_set_turnaround(nav, nav->turn_around_count+1); return g_strdup(_("When possible, please turn around")); + } + navigation_set_turnaround(nav, 0); if (!connect) { level=navigation_get_announce_level_cmd(nav, itm, cmd, distance-cmd->length); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2013-05-26 13:23:34
|
Revision: 5515 http://navit.svn.sourceforge.net/navit/?rev=5515&view=rev Author: martin-s Date: 2013-05-26 13:23:28 +0000 (Sun, 26 May 2013) Log Message: ----------- Add:Core:Split up navit_object_set_attr into two parts to allow to trigger callback indipendently Modified Paths: -------------- trunk/navit/navit/xmlconfig.c trunk/navit/navit/xmlconfig.h Modified: trunk/navit/navit/xmlconfig.c =================================================================== --- trunk/navit/navit/xmlconfig.c 2013-05-26 13:20:57 UTC (rev 5514) +++ trunk/navit/navit/xmlconfig.c 2013-05-26 13:23:28 UTC (rev 5515) @@ -1332,12 +1332,18 @@ return attr_generic_get_attr(obj->attrs, NULL, type, attr, iter); } +void +navit_object_callbacks(struct navit_object *obj, struct attr *attr) +{ + if (obj->attrs && obj->attrs[0] && obj->attrs[0]->type == attr_callback_list) + callback_list_call_attr_2(obj->attrs[0]->u.callback_list, attr->type, attr->u.data, 0); +} + int navit_object_set_attr(struct navit_object *obj, struct attr *attr) { obj->attrs=attr_generic_set_attr(obj->attrs, attr); - if (obj->attrs && obj->attrs[0] && obj->attrs[0]->type == attr_callback_list) - callback_list_call_attr_2(obj->attrs[0]->u.callback_list, attr->type, attr->u.data, 0); + navit_object_callbacks(obj, attr); return 1; } Modified: trunk/navit/navit/xmlconfig.h =================================================================== --- trunk/navit/navit/xmlconfig.h 2013-05-26 13:20:57 UTC (rev 5514) +++ trunk/navit/navit/xmlconfig.h 2013-05-26 13:23:28 UTC (rev 5515) @@ -70,6 +70,7 @@ struct attr_iter * navit_object_attr_iter_new(void); void navit_object_attr_iter_destroy(struct attr_iter *iter); int navit_object_get_attr(struct navit_object *obj, enum attr_type type, struct attr *attr, struct attr_iter *iter); +void navit_object_callbacks(struct navit_object *obj, struct attr *attr); int navit_object_set_attr(struct navit_object *obj, struct attr *attr); int navit_object_add_attr(struct navit_object *obj, struct attr *attr); int navit_object_remove_attr(struct navit_object *obj, struct attr *attr); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2013-05-26 13:21:04
|
Revision: 5514 http://navit.svn.sourceforge.net/navit/?rev=5514&view=rev Author: martin-s Date: 2013-05-26 13:20:57 +0000 (Sun, 26 May 2013) Log Message: ----------- Add:Core:Allow refresh_cond to specify when script should be run Modified Paths: -------------- trunk/navit/navit/attr_def.h trunk/navit/navit/script.c Modified: trunk/navit/navit/attr_def.h =================================================================== --- trunk/navit/navit/attr_def.h 2013-05-26 13:19:46 UTC (rev 5513) +++ trunk/navit/navit/attr_def.h 2013-05-26 13:20:57 UTC (rev 5514) @@ -371,6 +371,7 @@ ATTR(first_key) ATTR(last_key) ATTR(src_dir) +ATTR(refresh_cond) ATTR2(0x0003ffff,type_string_end) ATTR2(0x00040000,type_special_begin) ATTR(order) Modified: trunk/navit/navit/script.c =================================================================== --- trunk/navit/navit/script.c 2013-05-26 13:19:46 UTC (rev 5513) +++ trunk/navit/navit/script.c 2013-05-26 13:20:57 UTC (rev 5514) @@ -31,6 +31,7 @@ struct attr parent; struct callback *cb; struct event_timeout *timeout; + struct command_saved *cs; }; static void @@ -50,6 +51,12 @@ script_set_attr_int(struct script *scr, struct attr *attr) { switch (attr->type) { + case attr_refresh_cond: + dbg(0,"refresh_cond\n"); + if (scr->cs) + command_saved_destroy(scr->cs); + scr->cs=command_saved_attr_new(attr->u.str, &scr->parent, scr->cb, 0); + return 1; case attr_update_period: if (scr->timeout) event_remove_timeout(scr->timeout); @@ -82,6 +89,8 @@ dbg(0,"enter %p\n",scr); if (scr->timeout) event_remove_timeout(scr->timeout); + if (scr->cs) + command_saved_destroy(scr->cs); callback_destroy(scr->cb); attr_list_free(scr->attrs); g_free(scr); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2013-05-26 13:19:54
|
Revision: 5513 http://navit.svn.sourceforge.net/navit/?rev=5513&view=rev Author: martin-s Date: 2013-05-26 13:19:46 +0000 (Sun, 26 May 2013) Log Message: ----------- Add:Core:Allow arbitrary contexts for saved command Modified Paths: -------------- trunk/navit/navit/attr.h Modified: trunk/navit/navit/attr.h =================================================================== --- trunk/navit/navit/attr.h 2013-05-26 13:18:21 UTC (rev 5512) +++ trunk/navit/navit/attr.h 2013-05-26 13:19:46 UTC (rev 5513) @@ -107,6 +107,7 @@ #define ATTR_IS_GROUP(x) ((x) >= attr_type_group_begin && (x) <= attr_type_group_end) #define ATTR_INT(x,y) ((struct attr){attr_##x,{(char *)(y)}}) +#define ATTR_OBJECT(x,y) ((struct attr){attr_##x,{(char *)(y)}}) #define ATTR_DEF_STR(x,y) (&(struct attr){attr_##x,{y}}) #define ATTR_DEF_INT(x,y) (&(struct attr){attr_##x,{(char *)(y)}}) #define ATTR_DEF_ITEMS(x,...) (&(struct attr){attr_##x,{(char *)((enum item_type[]){__VA_ARGS__ , type_none})}}) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2013-05-26 13:18:30
|
Revision: 5512 http://navit.svn.sourceforge.net/navit/?rev=5512&view=rev Author: martin-s Date: 2013-05-26 13:18:21 +0000 (Sun, 26 May 2013) Log Message: ----------- Add:Core:Allow arbitrary contexts for saved command Modified Paths: -------------- trunk/navit/navit/command.c trunk/navit/navit/command.h Modified: trunk/navit/navit/command.c =================================================================== --- trunk/navit/navit/command.c 2013-05-26 13:17:27 UTC (rev 5511) +++ trunk/navit/navit/command.c 2013-05-26 13:18:21 UTC (rev 5512) @@ -63,7 +63,7 @@ struct callback *idle_cb; struct callback *register_cb; // Callback to register all the callbacks struct event_idle *register_ev; // Idle event to register all the callbacks - struct attr navit; + struct attr context_attr; int num_cbs; struct command_saved_cb *cbs; // List of callbacks for this saved command struct callback *cb; // Callback that should be called when we re-evaluate @@ -1420,7 +1420,7 @@ cs->idle_ev = NULL; } - command_evaluate_to(&cs->navit, cs->command, &cs->ctx, &cs->res); + command_evaluate_to(&cs->context_attr, cs->command, &cs->ctx, &cs->res); if (!cs->ctx.error) { cs->error = 0; @@ -1497,10 +1497,10 @@ struct object_func *func; struct callback *cb; - attr = cs->navit; + attr = cs->context_attr; cs->ctx.expr = cs->command; cs->ctx.attr = &attr; - prev = cs->navit; + prev = cs->context_attr; while ((status = get_next_object(&cs->ctx, &cs->res)) != 0) { resolve(&cs->ctx, &cs->res, NULL); @@ -1519,7 +1519,7 @@ attr = cs->res.attr; } else if (status == 1) { // This is the final attribute name cb = callback_new_attr_1(callback_cast(command_saved_evaluate), cs->res.attr.type, (void*)cs); - cs->ctx.attr = &cs->navit; + cs->ctx.attr = &cs->context_attr; } else { dbg(0, "Error: Strange status returned from get_next_object()\n"); } @@ -1542,7 +1542,7 @@ if (status == 2) { prev = cs->res.attr; } else { - prev = cs->navit; + prev = cs->context_attr; } } @@ -1552,14 +1552,13 @@ } struct command_saved * -command_saved_new(char *command, struct navit *navit, struct callback *cb, int async) +command_saved_attr_new(char *command, struct attr *attr, struct callback *cb, int async) { struct command_saved *ret; ret = g_new0(struct command_saved, 1); ret->command = g_strdup(command); - ret->navit.u.navit = navit; - ret->navit.type = attr_navit; + ret->context_attr = *attr; ret->cb = cb; ret->error = not_ready; ret->async = async; @@ -1573,6 +1572,13 @@ return ret; } +struct command_saved * +command_saved_new(char *command, struct navit *navit, struct callback *cb, int async) +{ + struct attr attr=ATTR_OBJECT(navit, navit); + return command_saved_attr_new(command, &attr, cb, async); +} + void command_saved_destroy(struct command_saved *cs) { Modified: trunk/navit/navit/command.h =================================================================== --- trunk/navit/navit/command.h 2013-05-26 13:17:27 UTC (rev 5511) +++ trunk/navit/navit/command.h 2013-05-26 13:18:21 UTC (rev 5512) @@ -51,6 +51,7 @@ void command_saved_set_cb(struct command_saved *cs, struct callback *cb); int command_saved_get_int(struct command_saved *cs); int command_saved_error(struct command_saved *cs); +struct command_saved *command_saved_attr_new(char *command, struct attr *context, struct callback *cb, int async); struct command_saved *command_saved_new(char *command, struct navit *navit, struct callback *cb, int async); void command_saved_destroy(struct command_saved *cs); /* end of prototypes */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2013-05-26 13:17:35
|
Revision: 5511 http://navit.svn.sourceforge.net/navit/?rev=5511&view=rev Author: martin-s Date: 2013-05-26 13:17:27 +0000 (Sun, 26 May 2013) Log Message: ----------- Add:Core:New struct to pass raw image data to graphics driver Modified Paths: -------------- trunk/navit/navit/graphics.h Modified: trunk/navit/navit/graphics.h =================================================================== --- trunk/navit/navit/graphics.h 2013-05-26 09:31:41 UTC (rev 5510) +++ trunk/navit/navit/graphics.h 2013-05-26 13:17:27 UTC (rev 5511) @@ -47,6 +47,17 @@ struct graphics_gc_methods; struct graphics_image_methods; +enum graphics_image_type { + graphics_image_type_unknown=0, +}; + +struct graphics_image_buffer { + char magic[8]; /* buffer:\n */ + enum graphics_image_type type; + void *start; + int len; +}; + struct graphics_methods { void (*graphics_destroy)(struct graphics_priv *gr); void (*draw_mode)(struct graphics_priv *gr, enum draw_mode_num mode); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2013-05-26 09:31:49
|
Revision: 5510 http://navit.svn.sourceforge.net/navit/?rev=5510&view=rev Author: martin-s Date: 2013-05-26 09:31:41 +0000 (Sun, 26 May 2013) Log Message: ----------- Fix:Core:Use correct get/set functions for navigation Modified Paths: -------------- trunk/navit/navit/navigation.c Modified: trunk/navit/navit/navigation.c =================================================================== --- trunk/navit/navit/navigation.c 2013-05-26 09:11:14 UTC (rev 5509) +++ trunk/navit/navit/navigation.c 2013-05-26 09:31:41 UTC (rev 5510) @@ -2396,10 +2396,10 @@ struct object_func navigation_func = { attr_navigation, (object_func_new)navigation_new, - (object_func_get_attr)navit_object_get_attr, + (object_func_get_attr)navigation_get_attr, (object_func_iter_new)navit_object_attr_iter_new, (object_func_iter_destroy)navit_object_attr_iter_destroy, - (object_func_set_attr)navit_object_set_attr, + (object_func_set_attr)navigation_set_attr, (object_func_add_attr)navit_object_add_attr, (object_func_remove_attr)navit_object_remove_attr, (object_func_init)NULL, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2013-05-26 09:11:21
|
Revision: 5509 http://navit.svn.sourceforge.net/navit/?rev=5509&view=rev Author: martin-s Date: 2013-05-26 09:11:14 +0000 (Sun, 26 May 2013) Log Message: ----------- Add:Core:Converted navigation to new scheme Modified Paths: -------------- trunk/navit/navit/navigation.c trunk/navit/navit/xmlconfig.c trunk/navit/navit/xmlconfig.h Modified: trunk/navit/navit/navigation.c =================================================================== --- trunk/navit/navit/navigation.c 2013-05-26 08:52:16 UTC (rev 5508) +++ trunk/navit/navit/navigation.c 2013-05-26 09:11:14 UTC (rev 5509) @@ -61,6 +61,7 @@ }; struct navigation { + NAVIT_OBJECT struct route *route; struct map *map; struct item_hash *hash; @@ -165,7 +166,7 @@ return 0; break; default: - return 0; + return navit_object_get_attr((struct navit_object *)this_, type, attr, iter); } attr->type=type; return 1; @@ -177,10 +178,11 @@ switch (attr->type) { case attr_speech: this_->speech=attr->u.speech; - return 1; + break; default: - return 0; + break; } + return navit_object_set_attr((struct navit_object *)this_, attr); } @@ -189,7 +191,7 @@ { int i,j; struct attr * attr; - struct navigation *ret=g_new0(struct navigation, 1); + struct navigation *ret=(struct navigation *)navit_object_new(attrs, &navigation_func, sizeof(struct navigation)); ret->hash=item_hash_new(); ret->callback=callback_list_new(); ret->callback_speech=callback_list_new(); @@ -2390,3 +2392,20 @@ { plugin_register_map_type("navigation", navigation_map_new); } + +struct object_func navigation_func = { + attr_navigation, + (object_func_new)navigation_new, + (object_func_get_attr)navit_object_get_attr, + (object_func_iter_new)navit_object_attr_iter_new, + (object_func_iter_destroy)navit_object_attr_iter_destroy, + (object_func_set_attr)navit_object_set_attr, + (object_func_add_attr)navit_object_add_attr, + (object_func_remove_attr)navit_object_remove_attr, + (object_func_init)NULL, + (object_func_destroy)navigation_destroy, + (object_func_dup)NULL, + (object_func_ref)navit_object_ref, + (object_func_unref)navit_object_unref, +}; + Modified: trunk/navit/navit/xmlconfig.c =================================================================== --- trunk/navit/navit/xmlconfig.c 2013-05-26 08:52:16 UTC (rev 5508) +++ trunk/navit/navit/xmlconfig.c 2013-05-26 09:11:14 UTC (rev 5509) @@ -267,7 +267,6 @@ { attr_icon, NEW(icon_new), NULL, NULL, NULL, NULL, ADD(element_add_attr)}, { attr_image, NEW(image_new)}, { attr_itemgra, NEW(itemgra_new), NULL, NULL, NULL, NULL, ADD(itemgra_add_attr)}, - { attr_navigation, NEW(navigation_new), GET(navigation_get_attr)}, { attr_plugins, NEW(plugins_new), NULL, NULL, NULL, NULL, NULL, NULL, INIT(plugins_init)}, { attr_plugin, NEW(plugin_new)}, { attr_polygon, NEW(polygon_new), NULL, NULL, NULL, NULL, ADD(element_add_attr)}, @@ -295,6 +294,8 @@ return &maps_func; case attr_mapset: return &mapset_func; + case attr_navigation: + return &navigation_func; case attr_navit: return &navit_func; case attr_profile_option: Modified: trunk/navit/navit/xmlconfig.h =================================================================== --- trunk/navit/navit/xmlconfig.h 2013-05-26 08:52:16 UTC (rev 5508) +++ trunk/navit/navit/xmlconfig.h 2013-05-26 09:11:14 UTC (rev 5509) @@ -54,9 +54,9 @@ void *(*unref)(void *); }; -extern struct object_func map_func, mapset_func, navit_func, osd_func, tracking_func, vehicle_func, maps_func, layout_func, roadprofile_func, vehicleprofile_func, layer_func, config_func, profile_option_func, script_func, log_func, speech_func; +extern struct object_func map_func, mapset_func, navit_func, osd_func, tracking_func, vehicle_func, maps_func, layout_func, roadprofile_func, vehicleprofile_func, layer_func, config_func, profile_option_func, script_func, log_func, speech_func, navigation_func; -#define HAS_OBJECT_FUNC(x) ((x) == attr_map || (x) == attr_mapset || (x) == attr_navit || (x) == attr_osd || (x) == attr_trackingo || (x) == attr_vehicle || (x) == attr_maps || (x) == attr_layout || (x) == attr_roadprofile || (x) == attr_vehicleprofile || (x) == attr_layer || (x) == attr_config || (x) == attr_profile_option || (x) == attr_script || (x) == attr_log || (x) == attr_speech) +#define HAS_OBJECT_FUNC(x) ((x) == attr_map || (x) == attr_mapset || (x) == attr_navit || (x) == attr_osd || (x) == attr_trackingo || (x) == attr_vehicle || (x) == attr_maps || (x) == attr_layout || (x) == attr_roadprofile || (x) == attr_vehicleprofile || (x) == attr_layer || (x) == attr_config || (x) == attr_profile_option || (x) == attr_script || (x) == attr_log || (x) == attr_speech || (x) == attr_navigation) #define NAVIT_OBJECT struct object_func *func; int refcount; struct attr **attrs; struct navit_object { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2013-05-26 08:52:25
|
Revision: 5508 http://navit.svn.sourceforge.net/navit/?rev=5508&view=rev Author: martin-s Date: 2013-05-26 08:52:16 +0000 (Sun, 26 May 2013) Log Message: ----------- Add:Core:Allow gcc to check dbg arguments Modified Paths: -------------- trunk/navit/navit/debug.h Modified: trunk/navit/navit/debug.h =================================================================== --- trunk/navit/navit/debug.h 2013-05-26 08:44:02 UTC (rev 5507) +++ trunk/navit/navit/debug.h 2013-05-26 08:52:16 UTC (rev 5508) @@ -74,7 +74,7 @@ struct debug *debug_new(struct attr *parent, struct attr **attrs); int debug_level_get(const char *name); void debug_vprintf(int level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, va_list ap); -void debug_printf(int level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, ...); +void debug_printf(int level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, ...) __attribute__ ((format (printf, 7, 8))); void debug_assert_fail(const char *module, const int mlen, const char *function, const int flen, const char *file, int line, const char *expr); void debug_destroy(void); void debug_set_logfile(const char *path); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2013-05-26 08:44:16
|
Revision: 5507 http://navit.svn.sourceforge.net/navit/?rev=5507&view=rev Author: martin-s Date: 2013-05-26 08:44:02 +0000 (Sun, 26 May 2013) Log Message: ----------- Fix:Core:Coding standard and converted speech to new scheme Modified Paths: -------------- trunk/navit/navit/attr.h trunk/navit/navit/speech.c trunk/navit/navit/xmlconfig.c trunk/navit/navit/xmlconfig.h Modified: trunk/navit/navit/attr.h =================================================================== --- trunk/navit/navit/attr.h 2013-05-24 20:45:46 UTC (rev 5506) +++ trunk/navit/navit/attr.h 2013-05-26 08:44:02 UTC (rev 5507) @@ -106,6 +106,7 @@ #define ATTR_IS_COORD(x) ((x) >= attr_type_coord_begin && (x) <= attr_type_coord_end) #define ATTR_IS_GROUP(x) ((x) >= attr_type_group_begin && (x) <= attr_type_group_end) +#define ATTR_INT(x,y) ((struct attr){attr_##x,{(char *)(y)}}) #define ATTR_DEF_STR(x,y) (&(struct attr){attr_##x,{y}}) #define ATTR_DEF_INT(x,y) (&(struct attr){attr_##x,{(char *)(y)}}) #define ATTR_DEF_ITEMS(x,...) (&(struct attr){attr_##x,{(char *)((enum item_type[]){__VA_ARGS__ , type_none})}}) Modified: trunk/navit/navit/speech.c =================================================================== --- trunk/navit/navit/speech.c 2013-05-24 20:45:46 UTC (rev 5506) +++ trunk/navit/navit/speech.c 2013-05-26 08:44:02 UTC (rev 5507) @@ -23,11 +23,12 @@ #include "item.h" #include "speech.h" #include "plugin.h" +#include "xmlconfig.h" struct speech { + NAVIT_OBJECT; struct speech_priv *priv; struct speech_methods meth; - struct attr **attrs; }; @@ -50,14 +51,12 @@ dbg(0,"wrong type '%s'\n", attr->u.str); return NULL; } - this_=g_new0(struct speech, 1); - this_->priv=speech_new(&this_->meth, attrs, parent); - this_->attrs=attr_list_dup(attrs); + this_=(struct speech *)navit_object_new(attrs, &speech_func, sizeof(struct speech)); + this_->priv=speech_new(&this_->meth, this_->attrs, parent); dbg(1, "say=%p\n", this_->meth.say); dbg(1,"priv=%p\n", this_->priv); if (! this_->priv) { - attr_list_free(this_->attrs); - g_free(this_); + speech_destroy(this_); return NULL; } dbg(1,"return %p\n", this_); @@ -68,9 +67,9 @@ void speech_destroy(struct speech *this_) { - this_->meth.destroy(this_->priv); - attr_list_free(this_->attrs); - g_free(this_); + if (this_->priv) + this_->meth.destroy(this_->priv); + navit_object_destroy((struct navit_object *)this_); } int @@ -80,8 +79,9 @@ return (this_->meth.say)(this_->priv, text); } +struct attr active=ATTR_INT(active, 1); struct attr *speech_default_attrs[]={ - ATTR_DEF_INT(active, 1), + &active, NULL, }; @@ -146,3 +146,20 @@ //callback_list_call_attr_2(this_->attr_cbl, attr->type, this_, attr); return 1; } + +struct object_func speech_func = { + attr_speech, + (object_func_new)speech_new, + (object_func_get_attr)speech_get_attr, + (object_func_iter_new)navit_object_attr_iter_new, + (object_func_iter_destroy)navit_object_attr_iter_destroy, + (object_func_set_attr)speech_set_attr, + (object_func_add_attr)navit_object_add_attr, + (object_func_remove_attr)navit_object_remove_attr, + (object_func_init)NULL, + (object_func_destroy)speech_destroy, + (object_func_dup)NULL, + (object_func_ref)navit_object_ref, + (object_func_unref)navit_object_unref, +}; + Modified: trunk/navit/navit/xmlconfig.c =================================================================== --- trunk/navit/navit/xmlconfig.c 2013-05-24 20:45:46 UTC (rev 5506) +++ trunk/navit/navit/xmlconfig.c 2013-05-26 08:44:02 UTC (rev 5507) @@ -273,7 +273,6 @@ { attr_polygon, NEW(polygon_new), NULL, NULL, NULL, NULL, ADD(element_add_attr)}, { attr_polyline, NEW(polyline_new), NULL, NULL, NULL, NULL, ADD(element_add_attr)}, { attr_route, NEW(route_new), GET(route_get_attr), NULL, NULL, SET(route_set_attr), ADD(route_add_attr), REMOVE(route_remove_attr)}, - { attr_speech, NEW(speech_new), GET(speech_get_attr), NULL, NULL, SET(speech_set_attr)}, { attr_text, NEW(text_new)}, }; @@ -308,6 +307,8 @@ return &osd_func; case attr_trackingo: return &tracking_func; + case attr_speech: + return &speech_func; case attr_vehicle: return &vehicle_func; case attr_vehicleprofile: @@ -1280,6 +1281,16 @@ } struct navit_object * +navit_object_new(struct attr **attrs, struct object_func *func, int size) +{ + struct navit_object *ret=g_malloc0(size); + ret->func=func; + ret->attrs=attr_list_dup(attrs); + navit_object_ref(ret); + return ret; +} + +struct navit_object * navit_object_ref(struct navit_object *obj) { obj->refcount++; Modified: trunk/navit/navit/xmlconfig.h =================================================================== --- trunk/navit/navit/xmlconfig.h 2013-05-24 20:45:46 UTC (rev 5506) +++ trunk/navit/navit/xmlconfig.h 2013-05-26 08:44:02 UTC (rev 5507) @@ -54,9 +54,9 @@ void *(*unref)(void *); }; -extern struct object_func map_func, mapset_func, navit_func, osd_func, tracking_func, vehicle_func, maps_func, layout_func, roadprofile_func, vehicleprofile_func, layer_func, config_func, profile_option_func, script_func, log_func; +extern struct object_func map_func, mapset_func, navit_func, osd_func, tracking_func, vehicle_func, maps_func, layout_func, roadprofile_func, vehicleprofile_func, layer_func, config_func, profile_option_func, script_func, log_func, speech_func; -#define HAS_OBJECT_FUNC(x) ((x) == attr_map || (x) == attr_mapset || (x) == attr_navit || (x) == attr_osd || (x) == attr_trackingo || (x) == attr_vehicle || (x) == attr_maps || (x) == attr_layout || (x) == attr_roadprofile || (x) == attr_vehicleprofile || (x) == attr_layer || (x) == attr_config || (x) == attr_profile_option || (x) == attr_script || (x) == attr_log) +#define HAS_OBJECT_FUNC(x) ((x) == attr_map || (x) == attr_mapset || (x) == attr_navit || (x) == attr_osd || (x) == attr_trackingo || (x) == attr_vehicle || (x) == attr_maps || (x) == attr_layout || (x) == attr_roadprofile || (x) == attr_vehicleprofile || (x) == attr_layer || (x) == attr_config || (x) == attr_profile_option || (x) == attr_script || (x) == attr_log || (x) == attr_speech) #define NAVIT_OBJECT struct object_func *func; int refcount; struct attr **attrs; struct navit_object { @@ -64,6 +64,7 @@ }; int navit_object_set_methods(void *in, int in_size, void *out, int out_size); +struct navit_object *navit_object_new(struct attr **attrs, struct object_func *func, int size); struct navit_object *navit_object_ref(struct navit_object *obj); void navit_object_unref(struct navit_object *obj); struct attr_iter * navit_object_attr_iter_new(void); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2013-05-24 20:45:53
|
Revision: 5506 http://navit.svn.sourceforge.net/navit/?rev=5506&view=rev Author: martin-s Date: 2013-05-24 20:45:46 +0000 (Fri, 24 May 2013) Log Message: ----------- Add:Core:Converted log object to new scheme Modified Paths: -------------- trunk/navit/navit/log.c trunk/navit/navit/vehicle.c trunk/navit/navit/xmlconfig.c trunk/navit/navit/xmlconfig.h Modified: trunk/navit/navit/log.c =================================================================== --- trunk/navit/navit/log.c 2013-05-24 20:01:56 UTC (rev 5505) +++ trunk/navit/navit/log.c 2013-05-24 20:45:46 UTC (rev 5506) @@ -36,6 +36,7 @@ #include "event.h" #include "callback.h" #include "debug.h" +#include "xmlconfig.h" #include "log.h" struct log_data { @@ -45,6 +46,7 @@ }; struct log { + NAVIT_OBJECT FILE *f; int overwrite; int empty; @@ -63,7 +65,6 @@ struct log_data header; struct log_data data; struct log_data trailer; - struct attr **attrs; }; static void @@ -240,6 +241,8 @@ char *filename, **wexp_data; dbg(1,"enter\n"); + ret->func=&log_func; + navit_object_ref((struct navit_object *)ret); data=attr_search(attrs, NULL, attr_data); if (! data) return NULL; @@ -347,6 +350,7 @@ void log_destroy(struct log *this_) { + dbg(0,"enter\n"); attr_list_free(this_->attrs); callback_destroy(this_->timer_callback); event_remove_timeout(this_->timer); @@ -354,3 +358,20 @@ log_close(this_); g_free(this_); } + +struct object_func log_func = { + attr_log, + (object_func_new)log_new, + (object_func_get_attr)navit_object_get_attr, + (object_func_iter_new)navit_object_attr_iter_new, + (object_func_iter_destroy)navit_object_attr_iter_destroy, + (object_func_set_attr)navit_object_set_attr, + (object_func_add_attr)navit_object_add_attr, + (object_func_remove_attr)navit_object_remove_attr, + (object_func_init)NULL, + (object_func_destroy)log_destroy, + (object_func_dup)NULL, + (object_func_ref)navit_object_ref, + (object_func_unref)navit_object_unref, +}; + Modified: trunk/navit/navit/vehicle.c =================================================================== --- trunk/navit/navit/vehicle.c 2013-05-24 20:01:56 UTC (rev 5505) +++ trunk/navit/navit/vehicle.c 2013-05-24 20:45:46 UTC (rev 5506) @@ -146,15 +146,7 @@ void vehicle_destroy(struct vehicle *this_) { - /* flush all logfiles on exit to avoid loss of yet unwritten data*/ - GList *ll, *l; - gpointer key; - for(ll=l=g_hash_to_list_keys(this_->log_to_cb);l;l=g_list_next(l)) { - key=l->data; - log_write(key,"",0,log_flag_force_flush); - } - g_list_free(ll); - + dbg(0,"enter\n"); if (this_->animate_callback) { callback_destroy(this_->animate_callback); event_remove_timeout(this_->animate_timer); @@ -707,10 +699,10 @@ } else if (!strcmp(type_attr.u.str, "binfile")) { cb=callback_new_attr_2(callback_cast(vehicle_log_binfile), attr_position_coord_geo, this_, log); } else - return 1; + return 0; g_hash_table_insert(this_->log_to_cb, log, cb); callback_list_add(this_->cbl, cb); - return 0; + return 1; } struct object_func vehicle_func = { Modified: trunk/navit/navit/xmlconfig.c =================================================================== --- trunk/navit/navit/xmlconfig.c 2013-05-24 20:01:56 UTC (rev 5505) +++ trunk/navit/navit/xmlconfig.c 2013-05-24 20:45:46 UTC (rev 5506) @@ -267,7 +267,6 @@ { attr_icon, NEW(icon_new), NULL, NULL, NULL, NULL, ADD(element_add_attr)}, { attr_image, NEW(image_new)}, { attr_itemgra, NEW(itemgra_new), NULL, NULL, NULL, NULL, ADD(itemgra_add_attr)}, - { attr_log, NEW(log_new)}, { attr_navigation, NEW(navigation_new), GET(navigation_get_attr)}, { attr_plugins, NEW(plugins_new), NULL, NULL, NULL, NULL, NULL, NULL, INIT(plugins_init)}, { attr_plugin, NEW(plugin_new)}, @@ -289,6 +288,8 @@ return &layer_func; case attr_layout: return &layout_func; + case attr_log: + return &log_func; case attr_map: return &map_func; case attr_maps: Modified: trunk/navit/navit/xmlconfig.h =================================================================== --- trunk/navit/navit/xmlconfig.h 2013-05-24 20:01:56 UTC (rev 5505) +++ trunk/navit/navit/xmlconfig.h 2013-05-24 20:45:46 UTC (rev 5506) @@ -54,9 +54,9 @@ void *(*unref)(void *); }; -extern struct object_func map_func, mapset_func, navit_func, osd_func, tracking_func, vehicle_func, maps_func, layout_func, roadprofile_func, vehicleprofile_func, layer_func, config_func, profile_option_func, script_func; +extern struct object_func map_func, mapset_func, navit_func, osd_func, tracking_func, vehicle_func, maps_func, layout_func, roadprofile_func, vehicleprofile_func, layer_func, config_func, profile_option_func, script_func, log_func; -#define HAS_OBJECT_FUNC(x) ((x) == attr_map || (x) == attr_mapset || (x) == attr_navit || (x) == attr_osd || (x) == attr_trackingo || (x) == attr_vehicle || (x) == attr_maps || (x) == attr_layout || (x) == attr_roadprofile || (x) == attr_vehicleprofile || (x) == attr_layer || (x) == attr_config || (x) == attr_profile_option || (x) == attr_script) +#define HAS_OBJECT_FUNC(x) ((x) == attr_map || (x) == attr_mapset || (x) == attr_navit || (x) == attr_osd || (x) == attr_trackingo || (x) == attr_vehicle || (x) == attr_maps || (x) == attr_layout || (x) == attr_roadprofile || (x) == attr_vehicleprofile || (x) == attr_layer || (x) == attr_config || (x) == attr_profile_option || (x) == attr_script || (x) == attr_log) #define NAVIT_OBJECT struct object_func *func; int refcount; struct attr **attrs; struct navit_object { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |