Index: navit/xpm/cursor.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: navit/maptool/osm.c
===================================================================
--- navit/maptool/osm.c	(revision 4525)
+++ navit/maptool/osm.c	(working copy)
@@ -351,96 +351,100 @@
 	{ 999,"Unknown"},
 };
 
+// first char - item type
+//   =w - ways
+//   =? - used both for nodes and ways
+//   otherwise - nodes
 
 static char *attrmap={
 	"n	*=*			point_unkn\n"
 //	"n	Annehmlichkeit=Hochsitz	poi_hunting_stand\n"
-	"n	addr:housenumber=*	house_number\n"
-	"n	aeroway=aerodrome	poi_airport\n"
-	"n	aeroway=airport		poi_airport\n"
-	"n	aeroway=helipad		poi_heliport\n"
-	"n	aeroway=terminal	poi_airport\n"
-	"n	amenity=atm		poi_bank\n"
-	"n	amenity=bank		poi_bank\n"
-	"n	amenity=bar		poi_bar\n"
+	"?	addr:housenumber=*	house_number\n"
+	"?	aeroway=aerodrome	poi_airport\n"
+	"?	aeroway=airport		poi_airport\n"
+	"?	aeroway=helipad		poi_heliport\n"
+	"?	aeroway=terminal	poi_airport\n"
+	"?	amenity=atm		poi_bank\n"
+	"?	amenity=bank		poi_bank\n"
+	"?	amenity=bar		poi_bar\n"
 	"n	amenity=bench		poi_bench\n"
-	"n	amenity=biergarten	poi_biergarten\n"
-	"n	amenity=bus_station	poi_bus_station\n"
-	"n	amenity=cafe		poi_cafe\n"
-	"n	amenity=car_wash	poi_car_wash\n"
-	"n	amenity=cinema		poi_cinema\n"
-	"n	amenity=college		poi_school_college\n"
-	"n	amenity=courthouse	poi_justice\n"
-	"n	amenity=drinking_water	poi_potable_water\n"
-	"n	amenity=fast_food	poi_fastfood\n"
-	"n	amenity=fire_station	poi_firebrigade\n"
-	"n	amenity=fountain	poi_fountain\n"
-	"n	amenity=fuel		poi_fuel\n"
-	"n	amenity=grave_yard	poi_cemetery\n"
-	"n	amenity=hospital	poi_hospital\n"
-	"n	amenity=hunting_stand	poi_hunting_stand\n"
-	"n	amenity=kindergarten	poi_kindergarten\n"
-	"n	amenity=library		poi_library\n"
-	"n	amenity=nightclub	poi_nightclub\n"
-	"n	amenity=park_bench	poi_bench\n"
-	"n	amenity=parking		poi_car_parking\n"
-	"n	amenity=pharmacy	poi_pharmacy\n"
-	"n	amenity=place_of_worship,religion=christian	poi_church\n"
-	"n	amenity=place_of_worship			poi_worship\n"
-	"n	amenity=police		poi_police\n"
-	"n	amenity=post_box	poi_post_box\n"
-	"n	amenity=post_office	poi_post_office\n"
-	"n	amenity=prison		poi_prison\n"
-	"n	amenity=pub		poi_pub\n"
-	"n	amenity=public_building	poi_public_office\n"
-	"n	amenity=recycling	poi_recycling\n"
-	"n	amenity=restaurant,cuisine=fine_dining		poi_dining\n"
-	"n	amenity=restaurant				poi_restaurant\n"
-	"n	amenity=school		poi_school\n"
-	"n	amenity=shelter		poi_shelter\n"
-	"n	amenity=taxi		poi_taxi\n"
-	"n	amenity=tec_common	tec_common\n"
-	"n	amenity=telephone	poi_telephone\n"
-	"n	amenity=theatre		poi_theater\n"
-	"n	amenity=toilets		poi_restroom\n"
-	"n	amenity=townhall	poi_townhall\n"
-	"n	amenity=university	poi_school_university\n"
-	"n	amenity=vending_machine	poi_vending_machine\n"
+	"?	amenity=biergarten	poi_biergarten\n"
+	"?	amenity=bus_station	poi_bus_station\n"
+	"?	amenity=cafe		poi_cafe\n"
+	"?	amenity=car_wash	poi_car_wash\n"
+	"?	amenity=cinema		poi_cinema\n"
+	"?	amenity=college		poi_school_college\n"
+	"?	amenity=courthouse	poi_justice\n"
+	"?	amenity=drinking_water	poi_potable_water\n"
+	"?	amenity=fast_food	poi_fastfood\n"
+	"?	amenity=fire_station	poi_firebrigade\n"
+	"?	amenity=fountain	poi_fountain\n"
+	"?	amenity=fuel		poi_fuel\n"
+	"?	amenity=grave_yard	poi_cemetery\n"
+	"?	amenity=hospital	poi_hospital\n"
+	"?	amenity=hunting_stand	poi_hunting_stand\n"
+	"?	amenity=kindergarten	poi_kindergarten\n"
+	"?	amenity=library		poi_library\n"
+	"?	amenity=nightclub	poi_nightclub\n"
+	"?	amenity=park_bench	poi_bench\n"
+	"?	amenity=parking		poi_car_parking\n"
+	"?	amenity=pharmacy	poi_pharmacy\n"
+	"?	amenity=place_of_worship,religion=christian	poi_church\n"
+	"?	amenity=place_of_worship			poi_worship\n"
+	"?	amenity=police		poi_police\n"
+	"?	amenity=post_box	poi_post_box\n"
+	"?	amenity=post_office	poi_post_office\n"
+	"?	amenity=prison		poi_prison\n"
+	"?	amenity=pub		poi_pub\n"
+	"?	amenity=public_building	poi_public_office\n"
+	"?	amenity=recycling	poi_recycling\n"
+	"?	amenity=restaurant,cuisine=fine_dining		poi_dining\n"
+	"?	amenity=restaurant				poi_restaurant\n"
+	"?	amenity=school		poi_school\n"
+	"?	amenity=shelter		poi_shelter\n"
+	"?	amenity=taxi		poi_taxi\n"
+	"?	amenity=tec_common	tec_common\n"
+	"?	amenity=telephone	poi_telephone\n"
+	"?	amenity=theatre		poi_theater\n"
+	"?	amenity=toilets		poi_restroom\n"
+	"?	amenity=townhall	poi_townhall\n"
+	"?	amenity=university	poi_school_university\n"
+	"?	amenity=vending_machine	poi_vending_machine\n"
 	"n	barrier=bollard		barrier_bollard\n"
 	"n	barrier=cycle_barrier	barrier_cycle\n"
 	"n	barrier=lift_gate	barrier_lift_gate\n"
-	"n	car=car_rental		poi_car_rent\n"
-	"n	highway=bus_station	poi_bus_station\n"
-	"n	highway=bus_stop	poi_bus_stop\n"
+	"?	car=car_rental		poi_car_rent\n"
+	"?	highway=bus_station	poi_bus_station\n"
+	"?	highway=bus_stop	poi_bus_stop\n"
 	"n	highway=mini_roundabout	mini_roundabout\n"
 	"n	highway=motorway_junction	highway_exit\n"
 	"n	highway=stop		traffic_sign_stop\n"
 	"n	highway=toll_booth	poi_toll_booth\n"
 	"n	highway=traffic_signals	traffic_signals\n"
 	"n	highway=turning_circle	turning_circle\n"
-	"n	historic=boundary_stone	poi_boundary_stone\n"
-	"n	historic=castle		poi_castle\n"
-	"n	historic=memorial	poi_memorial\n"
-	"n	historic=monument	poi_monument\n"
-	"n	historic=ruins		poi_ruins\n"
-//	"n	historic=*		poi_ruins\n"
-	"n	landuse=cemetery	poi_cemetery\n"
-	"n	leisure=fishing		poi_fish\n"
-	"n	leisure=golf_course	poi_golf\n"
-	"n	leisure=marina		poi_marine\n"
-	"n	leisure=playground	poi_playground\n"
-	"n	leisure=slipway		poi_boat_ramp\n"
-	"n	leisure=sports_centre	poi_sport\n"
-	"n	leisure=stadium		poi_stadium\n"
-	"n	man_made=tower		poi_tower\n"
-	"n	military=airfield	poi_military\n"
-	"n	military=barracks	poi_military\n"
-	"n	military=bunker		poi_military\n"
-	"n	military=danger_area	poi_danger_area\n"
-	"n	military=range		poi_military\n"
-	"n	natural=bay		poi_bay\n"
-	"n	natural=peak,ele=*		poi_peak\n"     // show only major peaks with elevation
-	"n	natural=tree		poi_tree\n"
+	"?	historic=boundary_stone	poi_boundary_stone\n"
+	"?	historic=castle		poi_castle\n"
+	"?	historic=memorial	poi_memorial\n"
+	"?	historic=monument	poi_monument\n"
+	"?	historic=ruins		poi_ruins\n"
+//	"?	historic=*		poi_ruins\n"
+	"?	landuse=cemetery	poi_cemetery\n"
+	"?	leisure=fishing		poi_fish\n"
+	"?	leisure=golf_course	poi_golf\n"
+	"?	leisure=marina		poi_marine\n"
+	"?	leisure=playground	poi_playground\n"
+	"?	leisure=slipway		poi_boat_ramp\n"
+	"?	leisure=sports_centre	poi_sport\n"
+	"?	leisure=stadium		poi_stadium\n"
+	"?	man_made=tower		poi_tower\n"
+	"?	military=airfield	poi_military\n"
+	"?	military=barracks	poi_military\n"
+	"?	military=bunker		poi_military\n"
+	"?	military=danger_area	poi_danger_area\n"
+	"?	military=range		poi_military\n"
+	"?	natural=bay		poi_bay\n"
+	"?	natural=peak,ele=*		poi_peak\n"     // show only major peaks with elevation
+	"?	natural=tree		poi_tree\n"
 	"n	place=city		town_label_2e5\n"
 	"n	place=hamlet		town_label_2e2\n"
 	"n	place=locality		town_label_2e0\n"
@@ -451,54 +455,54 @@
 	"n	power=sub_station	power_substation\n"
 	"n	railway=halt		poi_rail_halt\n"
 	"n	railway=level_crossing	poi_level_crossing\n"
-	"n	railway=station		poi_rail_station\n"
-	"n	railway=tram_stop	poi_rail_tram_stop\n"
-	"n	shop=baker		poi_shop_baker\n"
-	"n	shop=bakery		poi_shop_baker\n"
-	"n	shop=beverages		poi_shop_beverages\n"
-	"n	shop=bicycle		poi_shop_bicycle\n"
-	"n	shop=butcher		poi_shop_butcher\n"
-	"n	shop=car		poi_car_dealer_parts\n"
-	"n	shop=car_repair		poi_repair_service\n"
-	"n	shop=clothes		poi_shop_apparel\n"
-	"n	shop=convenience	poi_shop_grocery\n"
-	"n	shop=drogist		poi_shop_drugstore\n"
-	"n	shop=florist		poi_shop_florist\n"
-	"n	shop=fruit		poi_shop_fruit\n"
-	"n	shop=furniture		poi_shop_furniture\n"
-	"n	shop=garden_centre	poi_shop_handg\n"
-	"n	shop=hardware		poi_shop_handg\n"
-	"n	shop=hairdresser	poi_hairdresser\n"
-	"n	shop=kiosk		poi_shop_kiosk\n"
-	"n	shop=optician		poi_shop_optician\n"
-	"n	shop=parfum		poi_shop_parfum\n"
-	"n	shop=photo		poi_shop_photo\n"
-	"n	shop=shoes		poi_shop_shoes\n"
-	"n	shop=supermarket	poi_shopping\n"
-	"n	sport=10pin		poi_bowling\n"
-	"n	sport=baseball		poi_baseball\n"
-	"n	sport=basketball	poi_basketball\n"
-	"n	sport=climbing		poi_climbing\n"
-	"n	sport=golf		poi_golf\n"
-	"n	sport=motor_sports	poi_motor_sport\n"
-	"n	sport=skiing		poi_skiing\n"
-	"n	sport=soccer		poi_soccer\n"
-	"n	sport=stadium		poi_stadium\n"
-	"n	sport=swimming		poi_swimming\n"
-	"n	sport=tennis		poi_tennis\n"
-	"n	tourism=attraction	poi_attraction\n"
-	"n	tourism=camp_site	poi_camp_rv\n"
-	"n	tourism=caravan_site	poi_camp_rv\n"
-	"n	tourism=guest_house	poi_guesthouse\n"
-	"n	tourism=hostel		poi_hostel\n"
-	"n	tourism=hotel		poi_hotel\n"
-	"n	tourism=information	poi_information\n"
-	"n	tourism=motel		poi_motel\n"
-	"n	tourism=museum		poi_museum_history\n"
-	"n	tourism=picnic_site	poi_picnic\n"
-	"n	tourism=theme_park	poi_resort\n"
-	"n	tourism=viewpoint	poi_viewpoint\n"
-	"n	tourism=zoo		poi_zoo\n"
+	"?	railway=station		poi_rail_station\n"
+	"?	railway=tram_stop	poi_rail_tram_stop\n"
+	"?	shop=baker		poi_shop_baker\n"
+	"?	shop=bakery		poi_shop_baker\n"
+	"?	shop=beverages		poi_shop_beverages\n"
+	"?	shop=bicycle		poi_shop_bicycle\n"
+	"?	shop=butcher		poi_shop_butcher\n"
+	"?	shop=car		poi_car_dealer_parts\n"
+	"?	shop=car_repair		poi_repair_service\n"
+	"?	shop=clothes		poi_shop_apparel\n"
+	"?	shop=convenience	poi_shop_grocery\n"
+	"?	shop=drogist		poi_shop_drugstore\n"
+	"?	shop=florist		poi_shop_florist\n"
+	"?	shop=fruit		poi_shop_fruit\n"
+	"?	shop=furniture		poi_shop_furniture\n"
+	"?	shop=garden_centre	poi_shop_handg\n"
+	"?	shop=hardware		poi_shop_handg\n"
+	"?	shop=hairdresser	poi_hairdresser\n"
+	"?	shop=kiosk		poi_shop_kiosk\n"
+	"?	shop=optician		poi_shop_optician\n"
+	"?	shop=parfum		poi_shop_parfum\n"
+	"?	shop=photo		poi_shop_photo\n"
+	"?	shop=shoes		poi_shop_shoes\n"
+	"?	shop=supermarket	poi_shopping\n"
+	"?	sport=10pin		poi_bowling\n"
+	"?	sport=baseball		poi_baseball\n"
+	"?	sport=basketball	poi_basketball\n"
+	"?	sport=climbing		poi_climbing\n"
+	"?	sport=golf		poi_golf\n"
+	"?	sport=motor_sports	poi_motor_sport\n"
+	"?	sport=skiing		poi_skiing\n"
+	"?	sport=soccer		poi_soccer\n"
+	"?	sport=stadium		poi_stadium\n"
+	"?	sport=swimming		poi_swimming\n"
+	"?	sport=tennis		poi_tennis\n"
+	"?	tourism=attraction	poi_attraction\n"
+	"?	tourism=camp_site	poi_camp_rv\n"
+	"?	tourism=caravan_site	poi_camp_rv\n"
+	"?	tourism=guest_house	poi_guesthouse\n"
+	"?	tourism=hostel		poi_hostel\n"
+	"?	tourism=hotel		poi_hotel\n"
+	"?	tourism=information	poi_information\n"
+	"?	tourism=motel		poi_motel\n"
+	"?	tourism=museum		poi_museum_history\n"
+	"?	tourism=picnic_site	poi_picnic\n"
+	"?	tourism=theme_park	poi_resort\n"
+	"?	tourism=viewpoint	poi_viewpoint\n"
+	"?	tourism=zoo		poi_zoo\n"
 	"n	traffic_sign=city_limit	traffic_sign_city_limit\n"
 	"n	highway=speed_camera	tec_common\n"
 	"w	*=*			street_unkn\n"
@@ -713,8 +717,8 @@
 build_attrmap_line(char *line)
 {
 	char *t=NULL,*kvl=NULL,*i=NULL,*p,*kv;
-	struct attr_mapping ***attr_mapping_curr,*attr_mapping=g_malloc0(sizeof(struct attr_mapping));
-	int idx,attr_mapping_count=0,*attr_mapping_curr_count;
+	struct attr_mapping /****attr_mapping_curr,*/*attr_mapping=g_malloc0(sizeof(struct attr_mapping));
+	int idx,attr_mapping_count=0/*,attr_mapping_curr_count*/;
 	t=line;
 	p=strchr(t,'\t');
 	if (p) {
@@ -731,13 +735,13 @@
 	if (t[0] == 'w') {
 		if (! i)
 			i="street_unkn";
-		attr_mapping_curr=&attr_mapping_way;
-		attr_mapping_curr_count=&attr_mapping_way_count;
+//		attr_mapping_curr=&attr_mapping_way;
+//		attr_mapping_curr_count=&attr_mapping_way_count;
 	} else {
 		if (! i)
 			i="point_unkn";
-		attr_mapping_curr=&attr_mapping_node;
-		attr_mapping_curr_count=&attr_mapping_node_count;
+//		attr_mapping_curr=&attr_mapping_node;
+//		attr_mapping_curr_count=&attr_mapping_node_count;
 	}
 	attr_mapping->type=item_from_name(i);
 	while ((kv=strtok(kvl, ","))) {
@@ -750,8 +754,15 @@
 		attr_mapping->attr_present_idx[attr_mapping_count++]=idx;
 		attr_mapping->attr_present_idx_count=attr_mapping_count;
 	}
-	*attr_mapping_curr=g_realloc(*attr_mapping_curr, sizeof(**attr_mapping_curr)*(*attr_mapping_curr_count+1));
-	(*attr_mapping_curr)[(*attr_mapping_curr_count)++]=attr_mapping;
+	if (t[0]== 'w' || t[0]== '?') {
+		attr_mapping_way=g_realloc(attr_mapping_way, sizeof(*attr_mapping_way)*(attr_mapping_way_count+1));
+		attr_mapping_way[attr_mapping_way_count++]=attr_mapping;
+	}
+	if (t[0]!= 'w') {
+		attr_mapping_node=g_realloc(attr_mapping_node, sizeof(*attr_mapping_node)*(attr_mapping_node_count+1));
+		attr_mapping_node[attr_mapping_node_count++]=attr_mapping;
+	}
+
 }
 
 static void
@@ -1552,6 +1563,13 @@
 		}
 		item_bin_add_attr_string(item_bin, def_flags ? attr_street_name : attr_label, attr_strings[attr_string_label]);
 		item_bin_add_attr_string(item_bin, attr_street_name_systematic, attr_strings[attr_string_street_name_systematic]);
+		item_bin_add_attr_string(item_bin, attr_house_number, attr_strings[attr_string_house_number]);
+		item_bin_add_attr_string(item_bin, attr_street_name, attr_strings[attr_string_street_name]);
+		item_bin_add_attr_string(item_bin, attr_phone, attr_strings[attr_string_phone]);
+		item_bin_add_attr_string(item_bin, attr_fax, attr_strings[attr_string_fax]);
+		item_bin_add_attr_string(item_bin, attr_email, attr_strings[attr_string_email]);
+		item_bin_add_attr_string(item_bin, attr_county_name, attr_strings[attr_string_county_name]); 
+		item_bin_add_attr_string(item_bin, attr_url, attr_strings[attr_string_url]);
 		item_bin_add_attr_longlong(item_bin, attr_osm_wayid, osmid_attr_value);
 		if (debug_attr_buffer[0])
 			item_bin_add_attr_string(item_bin, attr_debug, debug_attr_buffer);
Index: navit/gui/internal/gui_internal.c
===================================================================
--- navit/gui/internal/gui_internal.c	(revision 4525)
+++ navit/gui/internal/gui_internal.c	(working copy)
@@ -2245,15 +2245,70 @@
 		type_none}},
 };
 
-union poi_param {
-	guint i;
-	struct {
-		unsigned char sel, selnb, pagenb, dist;
-	} p;
+
+/*
+ *  Get a utf-8 string, return the same prepared for case insensetive search. Result shoud be g_free()d after use.
+ */
+
+static char *
+removecase(char *s) 
+{
+	char *r;
+	r=g_utf8_casefold(s,-1);
+	return r;
+}
+
+struct poi_param {
+		unsigned char sel, selnb, pagenb, dist, isAddressFilter;
+		char *filterstr; /* Filter string, casefold()ed and divided into substrings at the spaces, which are replaced by ASCII 0*/
+		GList *filter; /* list of pointers to individual substrings of filterstr */
+		
 };
 
+
+/**
+ * @brief Free poi_param structure.
+ *
+ * @param p reference to the object to be freed.
+ */
+static void
+gui_internal_poi_param_free(void *p) 
+{
+	if(((struct poi_param *)p)->filterstr)
+	   g_free(((struct poi_param *)p)->filterstr);
+	if(((struct poi_param *)p)->filter)
+	   g_list_free(((struct poi_param *)p)->filter);
+	g_free(p);
+};
+
+/**
+ * @brief Clone poi_param structure.
+ *
+ * @param p reference to the object to be cloned.
+ * @return  Cloned object reference.
+ */
+static struct poi_param *
+gui_internal_poi_param_clone(struct poi_param *p) 
+{
+	struct poi_param *r=g_new(struct poi_param,1);
+	GList *l=p->filter;
+	memcpy(r,p,sizeof(struct poi_param));
+	r->filter=NULL;
+	r->filterstr=NULL;
+	if(p->filterstr)
+		r->filterstr=g_strdup(p->filterstr);
+	while(l) {
+		r->filter=g_list_append(r->filter, r->filterstr + ((char*)(l->data) - p->filterstr) );
+		l=g_list_next(l);
+	}
+	return r;
+};
+
+
 static void gui_internal_cmd_pois(struct gui_priv *this, struct widget *wm, void *data);
+static void gui_internal_cmd_pois_filter(struct gui_priv *this, struct widget *wm, void *data);
 
+
 static struct widget *
 gui_internal_cmd_pois_selector(struct gui_priv *this, struct pcoord *c, int pagenb)
 {
@@ -2269,17 +2324,27 @@
 	nrows=nitems/wl->cols + (nitems%wl->cols>0);
 	wl->h=this->icon_l*nrows;
 	for (i = 0 ; i < nitems ; i++) {
-		union poi_param p;
-		p.p.sel = 1;
-		p.p.selnb = i;
-		p.p.pagenb = pagenb;
-		p.p.dist = 0;
+		struct poi_param *p=g_new(struct poi_param,1);
+		p->sel = 1;
+		p->selnb = i;
+		p->pagenb = pagenb;
+		p->dist = 0;
+		p->filter=NULL;
+		p->filterstr=NULL;
 		gui_internal_widget_append(wl, wb=gui_internal_button_new_with_callback(this, NULL,
 			image_new_s(this, selectors[i].icon), gravity_left_center|orientation_vertical,
-			gui_internal_cmd_pois, GUINT_TO_POINTER(p.i)));
+			gui_internal_cmd_pois, p));
 		wb->c=*c;
+		wb->data_free=gui_internal_poi_param_free;
 		wb->bt=10;
 	}
+
+	gui_internal_widget_append(wl, wb=gui_internal_button_new_with_callback(this, NULL,
+			image_new_s(this, "gui_about"), gravity_left_center|orientation_vertical,
+			gui_internal_cmd_pois_filter, NULL));
+	wb->c=*c;
+	wb->bt=10;
+	
 	gui_internal_widget_pack(this,wl);
 	return wl;
 }
@@ -2334,21 +2399,69 @@
 }
 
 static int
-gui_internal_cmd_pois_item_selected(struct selector *sel, enum item_type type)
+gui_internal_cmd_pois_item_selected(struct poi_param *param, struct item *item)
 {
 	enum item_type *types;
-	if (type >= type_line)
+	struct selector *sel = param->sel? &selectors[param->selnb]: NULL;
+	enum item_type type=item->type;
+	struct attr attr;
+	int match=0;
+	if (type >= type_line && param->filter==NULL)
 		return 0;
-	if (! sel || !sel->types)
-		return 1;
-	types=sel->types;
-	while (*types != type_none) {
-		if (type >= types[0] && type <= types[1]) {
-			return 1;
+	if (! sel || !sel->types) {
+		match=1;
+	} else {
+		types=sel->types;
+		while (*types != type_none) {
+			if (item->type >= types[0] && item->type <= types[1]) {
+				return 1;
+			}
+			types+=2;
 		}
-		types+=2;
 	}
-	return 0;
+	if (param->filter) {
+		char *long_name, *s;
+		GList *f;
+		if (param->isAddressFilter) {
+			s=g_strdup("");
+			if(item_attr_get(item, attr_house_number, &attr)) 
+				s=g_strjoin(" ",s,attr.u.str,NULL);
+			if(item_attr_get(item, attr_street_name, &attr)) 
+				s=g_strjoin(" ",s,attr.u.str,NULL);
+			if(item_attr_get(item, attr_street_name_systematic, &attr)) 
+				s=g_strjoin(" ",s,attr.u.str,NULL);
+			if(item_attr_get(item, attr_district_name, &attr)) 
+				s=g_strjoin(" ",s,attr.u.str,NULL);
+			if(item_attr_get(item, attr_town_name, &attr)) 
+				s=g_strjoin(" ",s,attr.u.str,NULL);
+			if(item_attr_get(item, attr_county_name, &attr)) 
+				s=g_strjoin(" ",s,attr.u.str,NULL);
+			if(item_attr_get(item, attr_country_name, &attr)) 
+				s=g_strjoin(" ",s,attr.u.str,NULL);
+			
+			if(item_attr_get(item, attr_address, &attr)) 
+				s=g_strjoin(" ",s,"|",attr.u.str,NULL);
+			
+		} else if (item_attr_get(item, attr_label, &attr)) {
+			s=g_strdup_printf("%s %s", item_to_name(item->type), attr.u.str);
+		} else {
+			s=g_strdup(item_to_name(item->type));
+		}
+		long_name=removecase(s);
+		g_free(s);
+                item_attr_rewind(item);
+                
+		for(s=long_name,f=param->filter;f && s;f=g_list_next(f)) {
+			s=strstr(s,f->data);
+			if(!s) 
+				break;
+			s=g_utf8_strchr(s,-1,' ');
+		}
+		if(f)
+			match=0;
+		g_free(long_name);
+	}
+	return match;
 }
 
 struct item_data {
@@ -2372,13 +2485,107 @@
 	w->data=wm->data;
 	w->c=wm->c;
 	w->w=wm->w;
+	wm->data_free=NULL;
 	gui_internal_back(this, NULL, NULL);
-	gui_internal_cmd_pois(this, w, NULL);
+	gui_internal_cmd_pois(this, w, w->data);
 	free(w);
 }
 
+/**
+ * @brief apply POIs text filter.
+ *
+ * @param this The graphics context.
+ * @param wm called widget.
+ * @param data event data (pointer to editor widget containg filter text).
+ */
+static void
+gui_internal_cmd_pois_filter_do(struct gui_priv *this, struct widget *wm, void *data) 
+{
+	struct widget *w=data;
+	struct poi_param *param;
+	char *s1, *s2;
+	
+	if(!w->text)
+		return;
+	
+	if(w->data) {
+		param=gui_internal_poi_param_clone(w->data);
+		param->pagenb=0;
+	} else {
+		param=g_new0(struct poi_param,1);
+	}
+	param->filterstr=removecase(w->text);
+	param->isAddressFilter=strcmp(wm->name,"AddressFilter")==0;
+	s1=param->filterstr;
+	do {
+		s2=g_utf8_strchr(s1,-1,' ');
+		if(s2)
+			*s2++=0;
+		param->filter=g_list_append(param->filter,s1);
+		if(s2) {
+			while(*s2==' ')
+				s2++;
+		}
+		s1=s2;
+	} while(s2 && *s2);
 
+	gui_internal_cmd_pois(this,w,param);
+	gui_internal_poi_param_free(param);
+}
+
+
+/**
+ * @brief POIs filter dialog.
+ *
+ * @param this The graphics context.
+ * @param wm called widget.
+ * @param data event data.
+ */
 static void
+gui_internal_cmd_pois_filter(struct gui_priv *this, struct widget *wm, void *data) 
+{
+	struct widget *wb, *w, *wr, *wk, *we;
+	int keyboard_mode=2;
+	wb=gui_internal_menu(this,"Filter");
+	w=gui_internal_box_new(this, gravity_center|orientation_vertical|flags_expand|flags_fill);
+	gui_internal_widget_append(wb, w);
+	wr=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
+        gui_internal_widget_append(w, wr);
+        we=gui_internal_box_new(this, gravity_left_center|orientation_horizontal|flags_fill);
+        gui_internal_widget_append(wr, we);
+
+	gui_internal_widget_append(we, wk=gui_internal_label_new(this, NULL));
+	wk->state |= STATE_EDIT|STATE_EDITABLE;
+	wk->background=this->background;
+	wk->flags |= flags_expand|flags_fill;
+	wk->name=g_strdup("POIsFilter");
+	wk->c=wm->c;
+	gui_internal_widget_append(we, wb=gui_internal_image_new(this, image_new_xs(this, "gui_active")));
+	wb->state |= STATE_SENSITIVE;
+	wb->func = gui_internal_cmd_pois_filter_do;
+	wb->name=g_strdup("NameFilter");
+	wb->data=wk;
+	gui_internal_widget_append(we, wb=gui_internal_image_new(this, image_new_xs(this, "post")));
+	wb->state |= STATE_SENSITIVE;
+	wb->name=g_strdup("AddressFilter");
+	wb->func = gui_internal_cmd_pois_filter_do;
+	wb->data=wk;
+	
+	if (this->keyboard)
+		gui_internal_widget_append(w, gui_internal_keyboard(this,keyboard_mode));
+	gui_internal_menu_render(this);
+
+
+}
+
+/**
+ * @brief Do POI search specified by poi_param and display POIs found
+ *
+ * @param this The graphics context.
+ * @param wm called widget.
+ * @param data event data, reference to poi_param or NULL.
+ */
+static void
 gui_internal_cmd_pois(struct gui_priv *this, struct widget *wm, void *data)
 {
 	struct map_selection *sel,*selm;
@@ -2389,25 +2596,43 @@
 	struct item *item;
 	struct widget *wi,*w,*w2,*wb, *wtable, *row;
 	enum projection pro=wm->c.pro;
-	union poi_param param = {.i = GPOINTER_TO_UINT(wm->data)};
-	int idist,dist=10000*(param.p.dist+1);
-	struct selector *isel = param.p.sel? &selectors[param.p.selnb]: NULL;
-	int pagenb = param.p.pagenb;
-	int prevdist=param.p.dist*10000;
+	struct poi_param *param;
+	int param_free=0;
+	int idist,dist;
+	struct selector *isel;
+	int pagenb;
+	int prevdist;
 	const int pagesize = 50; // Starting value and increment of count of items to be extracted
-	int maxitem = pagesize*(pagenb+1), it = 0, i;
-	struct item_data *items= g_new0( struct item_data, maxitem);
+	int maxitem, it = 0, i;
+	struct item_data *items;
 	struct fibheap* fh = fh_makekeyheap();
 	int cnt = 0;
 	struct table_data *td;
 	int width=wm->w;
-	dbg(2, "Params: sel = %i, selnb = %i, pagenb = %i, dist = %i\n",
-		param.p.sel, param.p.selnb, param.p.pagenb, param.p.dist);
+	
+	
+	if(data) {
+	  param = data;
+	} else {
+	  param = g_new0(struct poi_param,1);
+	  param_free=1;
+	}
+	
+	dist=10000*(param->dist+1);
+	isel = param->sel? &selectors[param->selnb]: NULL;
+	pagenb = param->pagenb;
+	prevdist=param->dist*10000;
+	maxitem = pagesize*(pagenb+1);
+	items= g_new0( struct item_data, maxitem);
+	
+	
+	dbg(0, "Params: sel = %i, selnb = %i, pagenb = %i, dist = %i, filterstr = %s, isAddressFilter= %d\n",
+		param->sel, param->selnb, param->pagenb, param->dist, param->filterstr, param->isAddressFilter);
 
 	wb=gui_internal_menu(this, isel ? isel->name : _("POIs"));
 	w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
 	gui_internal_widget_append(wb, w);
-	if (!isel)
+	if (!isel && !param->filter)
 		gui_internal_widget_append(w, gui_internal_cmd_pois_selector(this,&wm->c,pagenb));
 	w2=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
 	gui_internal_widget_append(w, w2);
@@ -2422,7 +2647,7 @@
 		dbg(2,"mr=%p\n", mr);
 		if (mr) {
 			while ((item=map_rect_get_item(mr))) {
-				if (gui_internal_cmd_pois_item_selected(isel, item->type) &&
+				if (gui_internal_cmd_pois_item_selected(param, item) &&
 				    item_coord_get_pro(item, &c, 1, pro) &&
 				    coord_rect_contains(&sel->u.c_rect, &c)  &&
 				    (idist=transform_distance(pro, &center, &c)) < dist) {
@@ -2504,18 +2729,21 @@
 	// Add an entry for more POI
 	struct widget *wl,*wt;
 	char buffer[32];
+	struct poi_param *paramnew;
+	paramnew=gui_internal_poi_param_clone(param);
 	wl=gui_internal_box_new(this, gravity_left_center|orientation_horizontal|flags_fill);
 	if (it == maxitem) {
-		param.p.pagenb++;
-		snprintf(buffer, sizeof(buffer), "Get more (up to %d items)...", (param.p.pagenb+1)*pagesize);
+		paramnew->pagenb++;
+		snprintf(buffer, sizeof(buffer), "Get more (up to %d items)...", (paramnew->pagenb+1)*pagesize);
 	} else {
-		param.p.dist++;
-		snprintf(buffer, sizeof(buffer), "Set search distance to %i km", 10*(param.p.dist+1));
+		paramnew->dist++;
+		snprintf(buffer, sizeof(buffer), "Set search distance to %i km", 10*(paramnew->dist+1));
 	}
 	wt=gui_internal_label_new(this, buffer);
 	gui_internal_widget_append(wl, wt);
 	wl->func=gui_internal_cmd_pois_more;
-	wl->data=GUINT_TO_POINTER(param.i);
+	wl->data=paramnew;
+	wl->data_free=gui_internal_poi_param_free;
 	wl->state |= STATE_SENSITIVE;
 	wl->c = wm->c;
 	row = gui_internal_widget_table_row_new(this,
@@ -2537,7 +2765,8 @@
 		}
 	}
 	gui_internal_menu_render(this);
-
+        if(param_free)
+        	g_free(param);
 }
 #endif /* _MSC_VER */
 
Index: navit/search.c
===================================================================
--- navit/search.c	(revision 4525)
+++ navit/search.c	(working copy)
@@ -428,7 +428,8 @@
 {
 	struct pcoord *ret=g_new(struct pcoord, 1);
 	ret->pro = map_projection(item->map);
-	if (item_is_point(*item)) {
+	dbg(0,"%s\n",item_to_name(item->type));
+	if (item->type<type_house_number_interpolation_even || item->type>type_house_number_interpolation_alphabetic) {
 		struct coord c;
 		if (item_coord_get(item, &c, 1)) {
 			ret->x=c.x;
@@ -472,7 +473,9 @@
 			dbg(1,"remaining distance=%d from %d\n",hn_distance,distances[i]);
 			ret->x=(c[i+1].x-c[i].x)*hn_distance/distances[i]+c[i].x;
 			ret->y=(c[i+1].y-c[i].y)*hn_distance/distances[i]+c[i].y;
+			g_free(distances);
 		}
+		g_free(c);
 	}
 	return ret;
 }
@@ -772,7 +775,8 @@
 				this_->item=NULL;
 				break;
 			case 3:
-				dbg(0,"case 3 HOUSENUMBER");
+				dbg(0,"case 3 HOUSENUMBER\n");
+				has_street_name=0;
 
 				// if this housenumber has a streetname tag, set the name now
 				if (item_attr_get(this_->item, attr_street_name, &attr2))
@@ -780,7 +784,7 @@
 					dbg(0,"streetname: %s\n",attr2.u.str);
 					has_street_name=1;
 				}
-
+				
 				p=search_list_house_number_new(this_->item, &this_->inter, le->attr->u.str, le->partial);
 				if (!p)
 				{
@@ -788,28 +792,43 @@
 					this_->item=NULL;
 					continue;
 				}
+
 				this_->result.house_number=p;
 				if (!this_->result.house_number->interpolation)
 				{
 					this_->item=NULL;
+				} else {
+					dbg(0,"interpolation!\n");
 				}
+				
+				if(le->parent && has_street_name) {
+					struct search_list_street *street=this_->levels[level-1].last->data;
+					char *s1,*s2;
+					int cmpres;
+					s1=g_utf8_casefold(street->name,-1);
+					s2=g_utf8_casefold(attr2.u.str,-1);
+					cmpres=strcmp(s1,s2);
+					dbg(1,"Compared %s with %s, got %d\n",s1,s2,cmpres);
+					g_free(s1);
+					g_free(s2);
+					if(cmpres) {
+						search_list_house_number_destroy(p);
+						//this_->item=NULL;
+						continue;
+					}
+				}
 
+
 				this_->result.house_number->common.parent=this_->levels[2].last->data;
 				this_->result.street=this_->result.house_number->common.parent;
 				this_->result.town=this_->result.street->common.parent;
 				this_->result.country=this_->result.town->common.parent;
 				this_->result.c=this_->result.house_number->common.c;
 
-				if (has_street_name==1)
-				{
-					gchar *tmp_name=g_strdup(attr2.u.str);
-					this_->result.street->name=tmp_name;
-					//dbg(0,"res streetname=%s\n",this_->result.street->name);
+				if(!has_street_name) {
+					static struct search_list_street null_street;
+					this_->result.street=&null_street;
 				}
-				else
-				{
-					this_->result.street->name=NULL;
-				}
 			}
 			if (p)
 			{

