|
|
|
@ -38,6 +38,11 @@ enum {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static GUIWindow wbutton = {0};
|
|
|
|
static GUIWindow wbutton = {0};
|
|
|
|
|
|
|
|
static GUIButton *btn_zoomin = NULL,
|
|
|
|
|
|
|
|
*btn_zoomout = NULL,
|
|
|
|
|
|
|
|
*btn_gps = NULL,
|
|
|
|
|
|
|
|
*btn_menu = NULL,
|
|
|
|
|
|
|
|
*btn_fav = NULL;
|
|
|
|
void gui_buttons_closecallback ();
|
|
|
|
void gui_buttons_closecallback ();
|
|
|
|
void gui_buttons_draw (GUIButton *btn);
|
|
|
|
void gui_buttons_draw (GUIButton *btn);
|
|
|
|
void gui_buttons_zoomin();
|
|
|
|
void gui_buttons_zoomin();
|
|
|
|
@ -49,61 +54,42 @@ void gui_buttons_fav();
|
|
|
|
|
|
|
|
|
|
|
|
void gui_buttons_show () {
|
|
|
|
void gui_buttons_show () {
|
|
|
|
d_printf ("GUI: buttons show screen:%p", wbutton.screen);
|
|
|
|
d_printf ("GUI: buttons show screen:%p", wbutton.screen);
|
|
|
|
if (wbutton.screen == NULL) guiwindow_new (&wbutton, 192, 32);
|
|
|
|
if (wbutton.screen == NULL) gui_window_new (&wbutton, 192, 32, NULL);
|
|
|
|
|
|
|
|
|
|
|
|
wbutton.screen_changed = 1;
|
|
|
|
wbutton.screen_changed = 1;
|
|
|
|
wbutton.callback_close = (void*)gui_buttons_closecallback;
|
|
|
|
wbutton.callback_close = (void*)gui_buttons_closecallback;
|
|
|
|
wbutton.style = WGUI_S_VCENTER | WGUI_S_HTOP;
|
|
|
|
wbutton.style = WGUI_S_VCENTER | WGUI_S_HTOP;
|
|
|
|
|
|
|
|
|
|
|
|
/* add buttons */
|
|
|
|
/* add buttons */
|
|
|
|
strncpy (wbutton.buttons[0].caption, _("+"), GUI_TEXTLEN);
|
|
|
|
if (btn_zoomin == NULL) {
|
|
|
|
wbutton.buttons[0].callback_clicked = (void*)gui_buttons_zoomin;
|
|
|
|
btn_zoomin = gui_button_new (_("+"), 0, 0, 31, 31);
|
|
|
|
wbutton.buttons[0].callback_draw = (void*)gui_buttons_draw;
|
|
|
|
btn_zoomin->callback_clicked = (void*)gui_buttons_zoomin;
|
|
|
|
wbutton.buttons[0].id = BTNWIN_ZIN;
|
|
|
|
btn_zoomin->callback_draw = (void*)gui_buttons_draw;
|
|
|
|
wbutton.buttons[0].w = 31;
|
|
|
|
}
|
|
|
|
wbutton.buttons[0].h = 31;
|
|
|
|
|
|
|
|
wbutton.buttons[0].x = 0;
|
|
|
|
if (btn_zoomout == NULL) {
|
|
|
|
wbutton.buttons[0].y = 0;
|
|
|
|
btn_zoomout = gui_button_new (_("-"), 40, 0, 31, 31);
|
|
|
|
|
|
|
|
btn_zoomout->callback_clicked = (void*)gui_buttons_zoomout;
|
|
|
|
|
|
|
|
btn_zoomout->callback_draw = (void*)gui_buttons_draw;
|
|
|
|
strncpy (wbutton.buttons[1].caption, _("-"), GUI_TEXTLEN);
|
|
|
|
}
|
|
|
|
wbutton.buttons[1].callback_clicked = (void*)gui_buttons_zoomout;
|
|
|
|
|
|
|
|
wbutton.buttons[1].callback_draw = (void*)gui_buttons_draw;
|
|
|
|
if (btn_gps == NULL) {
|
|
|
|
wbutton.buttons[1].id = BTNWIN_ZOUT;
|
|
|
|
btn_gps = gui_button_new (_("GPS"), 80, 0, 31, 31);
|
|
|
|
wbutton.buttons[1].w = 31;
|
|
|
|
btn_gps->callback_clicked = (void*)gui_buttons_gps;
|
|
|
|
wbutton.buttons[1].h = 31;
|
|
|
|
btn_gps->callback_draw = (void*)gui_buttons_draw;
|
|
|
|
wbutton.buttons[1].x = 40;
|
|
|
|
}
|
|
|
|
wbutton.buttons[1].y = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if (btn_menu == NULL) {
|
|
|
|
|
|
|
|
btn_menu = gui_button_new (_("M"), 120, 0, 31, 31);
|
|
|
|
strncpy (wbutton.buttons[2].caption, _("GPS"), GUI_TEXTLEN);
|
|
|
|
btn_menu->callback_clicked = (void*)gui_buttons_menu;
|
|
|
|
wbutton.buttons[2].callback_clicked = (void*)gui_buttons_gps;
|
|
|
|
btn_menu->callback_draw = (void*)gui_buttons_draw;
|
|
|
|
wbutton.buttons[2].callback_draw = (void*)gui_buttons_draw;
|
|
|
|
}
|
|
|
|
wbutton.buttons[2].id = BTNWIN_GPS;
|
|
|
|
|
|
|
|
wbutton.buttons[2].w = 31;
|
|
|
|
if (btn_fav == NULL) {
|
|
|
|
wbutton.buttons[2].h = 31;
|
|
|
|
btn_menu = gui_button_new (_("F"), 160, 0, 31, 31);
|
|
|
|
wbutton.buttons[2].x = 80;
|
|
|
|
btn_menu->callback_clicked = (void*)gui_buttons_fav;
|
|
|
|
wbutton.buttons[2].y = 0;
|
|
|
|
btn_menu->callback_draw = (void*)gui_buttons_draw;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
strncpy (wbutton.buttons[3].caption, _("M"), GUI_TEXTLEN);
|
|
|
|
|
|
|
|
wbutton.buttons[3].callback_clicked = (void*)gui_buttons_menu;
|
|
|
|
|
|
|
|
wbutton.buttons[3].callback_draw = (void*)gui_buttons_draw;
|
|
|
|
|
|
|
|
wbutton.buttons[3].id = BTNWIN_MENU;
|
|
|
|
|
|
|
|
wbutton.buttons[3].w = 31;
|
|
|
|
|
|
|
|
wbutton.buttons[3].h = 31;
|
|
|
|
|
|
|
|
wbutton.buttons[3].x = 120;
|
|
|
|
|
|
|
|
wbutton.buttons[3].y = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strncpy (wbutton.buttons[4].caption, _("Fav"), GUI_TEXTLEN);
|
|
|
|
|
|
|
|
wbutton.buttons[4].callback_clicked = (void*)gui_buttons_fav;
|
|
|
|
|
|
|
|
wbutton.buttons[4].callback_draw = (void*)gui_buttons_draw;
|
|
|
|
|
|
|
|
wbutton.buttons[4].id = BTNWIN_FAV;
|
|
|
|
|
|
|
|
wbutton.buttons[4].w = 31;
|
|
|
|
|
|
|
|
wbutton.buttons[4].h = 31;
|
|
|
|
|
|
|
|
wbutton.buttons[4].x = 160;
|
|
|
|
|
|
|
|
wbutton.buttons[4].y = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gui_show (&wbutton);
|
|
|
|
gui_show (&wbutton);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
@ -112,14 +98,14 @@ void gui_buttons_show () {
|
|
|
|
|
|
|
|
|
|
|
|
void gui_buttons_closecallback () {
|
|
|
|
void gui_buttons_closecallback () {
|
|
|
|
d_printf ("GUI: buttons close");
|
|
|
|
d_printf ("GUI: buttons close");
|
|
|
|
guiwindow_close (&wbutton);
|
|
|
|
gui_window_close (&wbutton);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void gui_buttons_draw (GUIButton *btn) {
|
|
|
|
void gui_buttons_draw (GUIButton *btn) {
|
|
|
|
int j;
|
|
|
|
int j;
|
|
|
|
|
|
|
|
|
|
|
|
if (btn->id == BTNWIN_GPS) {
|
|
|
|
if (btn == btn_gps) {
|
|
|
|
j = gps_isrunning ();
|
|
|
|
j = gps_isrunning ();
|
|
|
|
if (j == 0) btn->col = &color[COLOR_white][2];
|
|
|
|
if (j == 0) btn->col = &color[COLOR_white][2];
|
|
|
|
else if (j < 0) btn->col = &color[COLOR_red][2];
|
|
|
|
else if (j < 0) btn->col = &color[COLOR_red][2];
|
|
|
|
|