diff --git a/gui/gui.h b/gui/gui.h index 08ed049..bb48a18 100644 --- a/gui/gui.h +++ b/gui/gui.h @@ -112,6 +112,7 @@ struct { int curpos; int overwrite; void (*callback_enter) (); + void (*callback_esc) (); void (*callback_changed) (); } typedef GUIEntry; diff --git a/gui/gui_entry.c b/gui/gui_entry.c index db63f4c..8d1a2ce 100644 --- a/gui/gui_entry.c +++ b/gui/gui_entry.c @@ -1,4 +1,4 @@ -/* $Id: gui_entry.c,v 1.17 2013/06/14 23:03:05 steffen Exp $ */ +/* $Id: gui_entry.c,v 1.18 2013/06/20 21:28:04 steffen Exp $ */ /*************************************************************************** * gui_entry.c * @@ -107,7 +107,8 @@ int gui_entry_event (GUIItem *item, GUIEvent *event) { } } else if (event->key == 0x1b) { // esc - gui_close (); + d_printf ("gui_entry:esc"); + if (entry->callback_esc) entry->callback_esc (); } else if (event->key == 0x0d) { // enter d_printf ("gui_entry:enter"); @@ -148,6 +149,7 @@ GUIItem *gui_entry_new (char *text, int x, int y, int w, int h) { item->type = GUI_ENTRY; entry->callback_changed = NULL; entry->callback_enter = NULL; + entry->callback_esc = NULL; return item; }; diff --git a/main/wnd_routing.c b/main/wnd_routing.c index 6c892d8..358fdd9 100644 --- a/main/wnd_routing.c +++ b/main/wnd_routing.c @@ -1,3 +1,4 @@ +/* $Id: wnd_routing.c,v 1.3 2013/06/20 21:28:04 steffen Exp $ */ /*************************************************************************** * wnd_routing.c * @@ -27,11 +28,85 @@ #include "system.h" static GUIWindow wrouting = {0}; +GUIItem *wr_label[5] = { NULL }; +GUIItem *wr_entrytxt = NULL; +GUIItem *wr_entrylon = NULL; +GUIItem *wr_entrylat = NULL; +GUIItem *wr_labellon = NULL; +GUIItem *wr_labellat = NULL; +GUIItem *wr_labeldest = NULL; +GUIItem *wr_btnfav = NULL; +GUIItem *wr_btnsearch = NULL; +GUIItem *wr_btnnavigate = NULL; +GUIItem *wr_btnclose = NULL; + +void wnd_routing_search (); +void wnd_routing_navigate (); +void wnd_routing_close (); +void wnd_routing_fav (); void wnd_routing_show () { - if (wrouting.screen == NULL) gui_window_new (&wrouting, 220, 260, _("Routing..")); + char text[128]; + + if (wrouting.screen == NULL) gui_window_new (&wrouting, 220, 130, NULL); wrouting.screen_changed = 1; wrouting.style = WGUI_S_VCENTER | WGUI_S_HCENTER; + if (wr_label[0] == NULL) wr_label[0] = gui_label_new (_("destination:"), 5, 5); + gui_window_item_add (&wrouting, wr_label[0]); + + if (wr_entrytxt == NULL) wr_entrytxt = gui_entry_new ("", 80, 5, 100, 20); + gui_window_item_add (&wrouting, wr_entrytxt); + + if (wr_btnsearch == NULL) wr_btnsearch = gui_button_new (_("Search"), 25, 55, 70, 20); + GUI_BUTTON_T(wr_btnsearch)->callback_clicked = wnd_routing_search; + gui_window_item_add (&wrouting, wr_btnsearch); + + if (wr_btnfav == NULL) wr_btnfav = gui_button_new (_("Favorites"), 100, 55, 70, 20); + GUI_BUTTON_T(wr_btnfav)->callback_clicked = wnd_routing_fav; + gui_window_item_add (&wrouting, wr_btnfav); + + if (wr_label[1] == NULL) wr_label[1] = gui_label_new (_("lon:"), 5, 30); + gui_window_item_add (&wrouting, wr_label[1]); + if (wr_entrylon == NULL) { + sprintf (text, "%9.6f", view_lon); + wr_entrylon = gui_entry_new (text, 30, 30, 75, 20); + } + gui_window_item_add (&wrouting, wr_entrylon); + + if (wr_label[2] == NULL) wr_label[2] = gui_label_new (_("lat:"), 110, 30); + gui_window_item_add (&wrouting, wr_label[2]); + if (wr_entrylat == NULL) { + sprintf (text, "%9.6f", view_lat); + wr_entrylat = gui_entry_new (text, 135, 30, 75, 20); + } + gui_window_item_add (&wrouting, wr_entrylat); + + if (wr_btnnavigate == NULL) wr_btnnavigate = gui_button_new (_("Navigate"), 60, 105, 75, 20); + GUI_BUTTON_T(wr_btnnavigate)->callback_clicked = wnd_routing_navigate; + gui_window_item_add (&wrouting, wr_btnnavigate); + + if (wr_btnclose == NULL) wr_btnclose = gui_button_new (_("Close"), 140, 105, 75, 20); + GUI_BUTTON_T(wr_btnclose)->callback_clicked = wnd_routing_close; + gui_window_item_add (&wrouting, wr_btnclose); + gui_show (&wrouting); }; + + +void wnd_routing_fav () { +}; + + +void wnd_routing_search () { +}; + + +void wnd_routing_navigate () { +}; + + +void wnd_routing_close () { + gui_close (); +}; +