parent
3c01d729cd
commit
e93500869a
@ -0,0 +1,100 @@
|
||||
/* $Id: wnd_mapcontext.c,v 1.1 2014/02/12 21:21:08 steffen Exp $ */
|
||||
/***************************************************************************
|
||||
* wnd_mapcontext.c
|
||||
*
|
||||
* 2014-02-12
|
||||
* Copyright (C) 2014 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.
|
||||
*
|
||||
* sposmroute 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"
|
||||
#include "routing.h"
|
||||
|
||||
void wnd_mapcontext_close ();
|
||||
void wnd_mapcontext_addfav ();
|
||||
void wnd_mapcontext_setdest ();
|
||||
|
||||
GUIItem *mcbtn_close = NULL;
|
||||
GUIItem *mcbtn_addfav = NULL;
|
||||
GUIItem *mcbtn_setdest = NULL;
|
||||
|
||||
static GUIWindow wmmapc = {0};
|
||||
|
||||
void wnd_mapcontext_show () {
|
||||
if (wmmapc.screen == NULL) gui_window_new (&wmmapc, 200, 200, _("Map Menu"));
|
||||
wmmapc.screen_changed = 1;
|
||||
wmmapc.style = WGUI_S_VCENTER | WGUI_S_HCENTER;
|
||||
|
||||
/* add buttons */
|
||||
if (mcbtn_addfav == NULL) mcbtn_addfav = gui_button_new (_("Add Favorites"), 5, 30, 110, 20);
|
||||
if (mcbtn_setdest == NULL) mcbtn_setdest = gui_button_new (_("Set Destination"), 5, 60, 110, 20);
|
||||
|
||||
if (select_enabled) {
|
||||
GUI_BUTTON_T(mcbtn_setdest)->col = GUI_BUTTON_T(mcbtn_addfav)->col = &color[COLOR_white][1];
|
||||
GUI_BUTTON_T(mcbtn_setdest)->textcol = GUI_BUTTON_T(mcbtn_addfav)->textcol = &color[COLOR_white][3];
|
||||
|
||||
GUI_BUTTON_T(mcbtn_addfav)->callback_clicked = (void*)wnd_mapcontext_addfav;
|
||||
GUI_BUTTON_T(mcbtn_setdest)->callback_clicked = (void*)wnd_mapcontext_setdest;
|
||||
}
|
||||
else {
|
||||
GUI_BUTTON_T(mcbtn_setdest)->col = GUI_BUTTON_T(mcbtn_addfav)->col = &color[COLOR_white][1];
|
||||
GUI_BUTTON_T(mcbtn_setdest)->textcol = GUI_BUTTON_T(mcbtn_addfav)->textcol = &color[COLOR_white][2];
|
||||
|
||||
GUI_BUTTON_T(mcbtn_addfav)->callback_clicked = NULL;
|
||||
GUI_BUTTON_T(mcbtn_setdest)->callback_clicked = NULL;
|
||||
}
|
||||
gui_window_item_add (&wmmapc, mcbtn_addfav);
|
||||
gui_window_item_add (&wmmapc, mcbtn_setdest);
|
||||
|
||||
if (mcbtn_close == NULL) {
|
||||
mcbtn_close = gui_button_new (_("Close"), 5, 90, 110, 20);
|
||||
GUI_BUTTON_T(mcbtn_close)->callback_clicked = (void*)wnd_mapcontext_close;
|
||||
}
|
||||
gui_window_item_add (&wmmapc, mcbtn_close);
|
||||
|
||||
gui_show (&wmmapc);
|
||||
};
|
||||
|
||||
void wnd_mapcontext_close () {
|
||||
d_printf ("gui_mapcontext_close");
|
||||
gui_close ();
|
||||
};
|
||||
|
||||
void wnd_mapcontext_setdest () {
|
||||
static int _setdest = 0;
|
||||
|
||||
d_printf ("gui_mapcontext_setdest");
|
||||
d_printf ("set destination routing start");
|
||||
|
||||
gui_close ();
|
||||
if (select_enabled == 0) d_printf ("no destination selected.");
|
||||
if (_setdest == 1) d_printf ("routing already active");
|
||||
else {
|
||||
_setdest = 1;
|
||||
route_start (select_pos);
|
||||
_setdest = 0;
|
||||
}
|
||||
};
|
||||
|
||||
void wnd_mapcontext_addfav () {
|
||||
d_printf ("gui_mapcontext_addfav");
|
||||
gui_close ();
|
||||
};
|
||||
Loading…
Reference in new issue