/* $Id: wnd_routing.c,v 1.3 2013/06/20 21:28:04 steffen Exp $ */
/***************************************************************************
 * wnd_routing.c
 *
 *  Created on: 18.06.2013
 *  Copyright (C) 2011  Steffen Pohle
 *  steffen@gulpe.de
 ****************************************************************************/

/*
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * main.c is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU  General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "osmroute.h"
#include "draw.h"
#include "gui.h"
#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 () {
	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 ();
};

