gui elements starting to work again..

master
steffen 13 years ago
parent aecda8e878
commit 322630948e

@ -157,6 +157,7 @@ clean:
for i in $(NCURSESDIRS); do make -C $$i clean; done for i in $(NCURSESDIRS); do make -C $$i clean; done
for i in $(GTKDIRS); do make -C $$i clean; done for i in $(GTKDIRS); do make -C $$i clean; done
for i in $(WINCEDIRS); do make -C $$i clean; done for i in $(WINCEDIRS); do make -C $$i clean; done
for i in $(SDLGLDIRS); do make -C $$i clean; done
for i in $(ANDROIDDIRS); do rm -f android/jni/$$i; done for i in $(ANDROIDDIRS); do rm -f android/jni/$$i; done
cd android; make clean; cd .. cd android; make clean; cd ..
rm -rf Makefile.rules rm -rf Makefile.rules

@ -1,4 +1,4 @@
/* $Id: gui.c,v 1.5 2013/02/18 00:06:44 steffen Exp $ */ /* $Id: gui.c,v 1.6 2013/02/21 23:07:19 steffen Exp $ */
/*************************************************************************** /***************************************************************************
* gui.c * gui.c
* *
@ -65,7 +65,9 @@ void gui_draw () {
if (currentwin == NULL) gui_buttons_show (); if (currentwin == NULL) gui_buttons_show ();
if (currentwin->screen == NULL) { if (currentwin->screen == NULL) {
currentwin->screen = gfx_img_alloc (currentwin->w, currentwin->h); currentwin->screen = gfx_img_alloc (currentwin->w, currentwin->h);
currentwin->screen_changed = 1;
} }
// d_printf ("GUI draw: %p %s screen:%p(changed:%d) pos: %d,%d size:%d,%d", currentwin, currentwin->title, currentwin->screen, currentwin->screen_changed, currentwin->x, currentwin->y, currentwin->w, currentwin->h); // d_printf ("GUI draw: %p %s screen:%p(changed:%d) pos: %d,%d size:%d,%d", currentwin, currentwin->title, currentwin->screen, currentwin->screen_changed, currentwin->x, currentwin->y, currentwin->w, currentwin->h);
if (currentwin && (currentwin->screen_changed || now-1 > lastupdate || now < lastupdate)) { if (currentwin && (currentwin->screen_changed || now-1 > lastupdate || now < lastupdate)) {
lastupdate = now; lastupdate = now;

@ -153,7 +153,7 @@ extern GUIButton *gui_button_new (char *name, int x, int y, int w, int h);
/* label functions */ /* label functions */
extern void gui_label_draw (GUILabel *label); extern void gui_label_draw (GUILabel *label);
extern GUILabel *gui_label_new (char *name, int x, int y); extern GUILabel *gui_label_new (char *text, int x, int y);
/* entry functions */ /* entry functions */
extern void gui_entry_draw (GUIEntry *entry); extern void gui_entry_draw (GUIEntry *entry);

@ -1,4 +1,4 @@
/* $Id: gui_button.c,v 1.1 2013/02/17 00:52:20 steffen Exp $ */ /* $Id: gui_button.c,v 1.2 2013/02/21 23:07:19 steffen Exp $ */
/*************************************************************************** /***************************************************************************
* gui_button.c * gui_button.c
* *
@ -46,3 +46,21 @@ void gui_button_draw (GUIButton *button) {
draw_polygonfinish (currentwin->screen, ls, *button->col, 1); draw_polygonfinish (currentwin->screen, ls, *button->col, 1);
gfx_draw_text (currentwin->screen, button->x + 2, button->y + 2, button->caption, button->textcol); gfx_draw_text (currentwin->screen, button->x + 2, button->y + 2, button->caption, button->textcol);
}; };
GUIButton *gui_button_new (char *caption, int x, int y, int w, int h) {
GUIButton *item = (GUIButton*) ml_malloc (sizeof (GUIButton));
if (caption == NULL) item->caption[0] = 0;
else strncpy (item->caption, caption, GUI_TEXTLEN);
item->x = x;
item->y = y;
item->w = w;
item->h = h;
item->col = &color[COLOR_white][1];
item->textcol = &color[COLOR_white][3];
item->callback_clicked = NULL;
item->callback_draw = NULL;
return item;
};

@ -1,4 +1,4 @@
/* $Id: gui_entry.c,v 1.1 2013/02/17 00:52:20 steffen Exp $ */ /* $Id: gui_entry.c,v 1.2 2013/02/21 23:07:19 steffen Exp $ */
/*************************************************************************** /***************************************************************************
* gui_entry.c * gui_entry.c
* *
@ -110,3 +110,17 @@ void gui_entry_event (GUIEntry *entry, GUIEvent *event) {
}; };
GUIEntry *gui_entry_new (char *text, int x, int y, int w, int h) {
GUIEntry *item = (GUIEntry*) ml_malloc (sizeof (GUIEntry));
if (text == NULL) item->text[0] = 0;
else strncpy (item->text, text, GUI_TEXTLEN);
item->x = x;
item->y = y;
item->w = w;
item->h = h;
item->callback_changed = NULL;
item->callback_enter = NULL;
return item;
};

@ -1,4 +1,4 @@
/* $Id: gui_label.c,v 1.1 2013/02/17 00:52:20 steffen Exp $ */ /* $Id: gui_label.c,v 1.2 2013/02/21 23:07:19 steffen Exp $ */
/*************************************************************************** /***************************************************************************
* gui_label.c * gui_label.c
* *
@ -40,3 +40,17 @@ void gui_label_draw (GUILabel *label) {
gfx_draw_text (currentwin->screen, label->x, label->y, label->text, label->textcol); gfx_draw_text (currentwin->screen, label->x, label->y, label->text, label->textcol);
}; };
GUILabel *gui_label_new (char *text, int x, int y) {
GUILabel *item = (GUILabel*) ml_malloc (sizeof (GUILabel));
if (text == NULL) item->text[0] = 0;
else strncpy (item->text, text, GUI_TEXTLEN);
item->x = x;
item->y = y;
item->textcol = &color[COLOR_white][2];
return item;
};

@ -1,4 +1,4 @@
/* $Id: gui_list.c,v 1.2 2013/02/18 00:06:44 steffen Exp $ */ /* $Id: gui_list.c,v 1.3 2013/02/21 23:07:19 steffen Exp $ */
/*************************************************************************** /***************************************************************************
* gui_list.c * gui_list.c
* *
@ -82,7 +82,7 @@ void gui_list_event (GUIList *list, GUIEvent *event) {
/* set focus */ /* set focus */
if (event->event == EGUI_MOUSERELEASED && x >= 0 && x <= list->w && y >= 0 && y <= list->h) { if (event->event == EGUI_MOUSERELEASED && x >= 0 && x <= list->w && y >= 0 && y <= list->h) {
currentwin->focus = list; currentwin->focus = (void *) list;
if (y <= 5 && x >= list->w - 10) list->vs--; if (y <= 5 && x >= list->w - 10) list->vs--;
else if (y >= list->h - 5 && x >= list->w - 10) list->vs++; else if (y >= list->h - 5 && x >= list->w - 10) list->vs++;
@ -96,3 +96,18 @@ void gui_list_event (GUIList *list, GUIEvent *event) {
currentwin->screen_changed = 1; currentwin->screen_changed = 1;
draw (); draw ();
}; };
GUIList *gui_list_new (int x, int y, int w, int h) {
GUIList *item = (GUIList*) ml_malloc (sizeof (GUIList));
item->x = x;
item->y = y;
item->w = w;
item->h = h;
item->data = NULL;
item->selected = -1;
item->vs = 0;
item->callback_selectitem = NULL;
return item;
};

@ -1,4 +1,4 @@
/* $Id: gui_window.c,v 1.3 2013/02/18 23:09:11 steffen Exp $ */ /* $Id: gui_window.c,v 1.4 2013/02/21 23:07:19 steffen Exp $ */
/*************************************************************************** /***************************************************************************
* gui_window.c * gui_window.c
* *
@ -40,7 +40,8 @@ void gui_window_new (GUIWindow *win, int w, int h, char *title) {
win->items[i].type = GUI_NONE; win->items[i].type = GUI_NONE;
} }
strncpy (win->title, title, GUI_TEXTLEN); if (title == NULL) win->title[0] = 0;
else strncpy (win->title, title, GUI_TEXTLEN);
win->screen = NULL; win->screen = NULL;
win->screen_changed = 1; win->screen_changed = 1;
@ -48,7 +49,7 @@ void gui_window_new (GUIWindow *win, int w, int h, char *title) {
win->w = w; win->w = w;
win->focus = NULL; win->focus = NULL;
d_printf ("guiwindow_new %p width:%d height:%d", win, w, h); d_printf ("gui_window_new [%s] %p width:%d height:%d", title, win, w, h);
}; };
@ -56,20 +57,13 @@ void gui_window_new (GUIWindow *win, int w, int h, char *title) {
* closes the window, but does not free the memory. * closes the window, but does not free the memory.
*/ */
void gui_window_close (GUIWindow *win) { void gui_window_close (GUIWindow *win) {
int i; d_printf ("gui_window_close [%s] %p", win->title, win);
for (i = 0; i < GUI_MAX_ITEM; i++) {
win->items[i].type = GUI_NONE;
win->items[i].item = NULL;
}
win->title[0] = 0;
gfx_img_free (win->screen); /* delete screen so we know it's disabled.. */
if (win->screen) gfx_img_free (win->screen);
win->screen = NULL; win->screen = NULL;
win->screen_changed = 1; win->screen_changed = 1;
win->h = 0; if (currentwin == win) currentwin = NULL;
win->w = 0;
}; };

@ -53,9 +53,6 @@ void gui_buttons_fav();
void gui_buttons_show () { void gui_buttons_show () {
d_printf ("GUI: buttons show screen:%p", wbutton.screen);
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;
@ -65,35 +62,39 @@ void gui_buttons_show () {
btn_zoomin = gui_button_new (_("+"), 0, 0, 31, 31); btn_zoomin = gui_button_new (_("+"), 0, 0, 31, 31);
btn_zoomin->callback_clicked = (void*)gui_buttons_zoomin; btn_zoomin->callback_clicked = (void*)gui_buttons_zoomin;
btn_zoomin->callback_draw = (void*)gui_buttons_draw; btn_zoomin->callback_draw = (void*)gui_buttons_draw;
gui_window_item_add (&wbutton, GUI_BUTTON, btn_zoomin);
} }
if (btn_zoomout == NULL) { if (btn_zoomout == NULL) {
btn_zoomout = gui_button_new (_("-"), 40, 0, 31, 31); btn_zoomout = gui_button_new (_("-"), 40, 0, 31, 31);
btn_zoomout->callback_clicked = (void*)gui_buttons_zoomout; btn_zoomout->callback_clicked = (void*)gui_buttons_zoomout;
btn_zoomout->callback_draw = (void*)gui_buttons_draw; btn_zoomout->callback_draw = (void*)gui_buttons_draw;
gui_window_item_add (&wbutton, GUI_BUTTON, btn_zoomout);
} }
if (btn_gps == NULL) { if (btn_gps == NULL) {
btn_gps = gui_button_new (_("GPS"), 80, 0, 31, 31); btn_gps = gui_button_new (_("GPS"), 80, 0, 31, 31);
btn_gps->callback_clicked = (void*)gui_buttons_gps; btn_gps->callback_clicked = (void*)gui_buttons_gps;
btn_gps->callback_draw = (void*)gui_buttons_draw; btn_gps->callback_draw = (void*)gui_buttons_draw;
gui_window_item_add (&wbutton, GUI_BUTTON, btn_gps);
} }
if (btn_menu == NULL) { if (btn_menu == NULL) {
btn_menu = gui_button_new (_("M"), 120, 0, 31, 31); btn_menu = gui_button_new (_("M"), 120, 0, 31, 31);
btn_menu->callback_clicked = (void*)gui_buttons_menu; btn_menu->callback_clicked = (void*)gui_buttons_menu;
btn_menu->callback_draw = (void*)gui_buttons_draw; btn_menu->callback_draw = (void*)gui_buttons_draw;
gui_window_item_add (&wbutton, GUI_BUTTON, btn_menu);
} }
if (btn_fav == NULL) { if (btn_fav == NULL) {
btn_menu = gui_button_new (_("F"), 160, 0, 31, 31); btn_fav = gui_button_new (_("F"), 160, 0, 31, 31);
btn_menu->callback_clicked = (void*)gui_buttons_fav; btn_fav->callback_clicked = (void*)gui_buttons_fav;
btn_menu->callback_draw = (void*)gui_buttons_draw; btn_fav->callback_draw = (void*)gui_buttons_draw;
}
if (wbutton.screen == NULL) {
gui_window_new (&wbutton, 192, 32, NULL);
gui_window_item_add (&wbutton, GUI_BUTTON, btn_fav); gui_window_item_add (&wbutton, GUI_BUTTON, btn_fav);
gui_window_item_add (&wbutton, GUI_BUTTON, btn_zoomin);
gui_window_item_add (&wbutton, GUI_BUTTON, btn_zoomout);
gui_window_item_add (&wbutton, GUI_BUTTON, btn_gps);
gui_window_item_add (&wbutton, GUI_BUTTON, btn_menu);
} }
gui_show (&wbutton); gui_show (&wbutton);

@ -1,3 +1,4 @@
/* $Id: gui_mainmenu.c,v 1.4 2013/02/21 23:07:19 steffen Exp $ */
/*************************************************************************** /***************************************************************************
* gui_mainmenu.c * gui_mainmenu.c
* *
@ -27,121 +28,36 @@
#include "system.h" #include "system.h"
#include "routing.h" #include "routing.h"
enum {
MMENWIN_UNDEF = 0,
MMENWIN_SEARCH,
MMENWIN_MAPREFRESH,
MMENWIN_IDXREFRESH,
MMENWIN_GPSCONFIG,
MMENWIN_GPSSTARTSTOP,
MMENWIN_MAPCONFIG,
MMENWIN_CLOSE,
MMENWIN_SETDEST,
MMENWIN_DEBUG,
MMENWIN_QUIT
};
void gui_mainmenu_close (); void gui_mainmenu_close ();
void gui_mainmenu_search (); void gui_mainmenu_search ();
void gui_mainmenu_quit (); void gui_mainmenu_quit ();
void gui_mainmenu_refresh (); void gui_mainmenu_gps ();
void gui_mainmenu_refreshidx (); void gui_mainmenu_map ();
void gui_mainmenu_gpsconfig (); void gui_mainmenu_routing ();
void gui_mainmenu_gpsstartstop (); void gui_mainmenu_config ();
void gui_mainmenu_mapconfig ();
void gui_mainmenu_setdest (); GUIButton *mbtn_close = NULL;
void gui_mainmenu_debug (); GUIButton *mbtn_quit = NULL;
GUIButton *mbtn_gps = NULL;
GUIButton *mbtn_map= NULL;
GUIButton *mbtn_search = NULL;
GUIButton *mbtn_routing= NULL;
GUIButton *mbtn_config= NULL;
static GUIWindow wmmenu = {0}; static GUIWindow wmmenu = {0};
void gui_mainmenu_show () { void gui_mainmenu_show () {
int item = 0;
if (wmmenu.screen == NULL) gui_window_new (&wmmenu, 175, 200, _("OSMroute Menu")); if (wmmenu.screen == NULL) gui_window_new (&wmmenu, 175, 200, _("OSMroute Menu"));
wmmenu.screen_changed = 1; wmmenu.screen_changed = 1;
wmmenu.style = WGUI_S_VCENTER | WGUI_S_HCENTER; wmmenu.style = WGUI_S_VCENTER | WGUI_S_HCENTER;
/* add buttons */ /* add buttons */
strncpy (wmmenu.buttons[item].caption, _("Close"), GUI_TEXTLEN); if (mbtn_close == NULL) {
wmmenu.buttons[item].callback_clicked = (void*)gui_mainmenu_close; mbtn_close = gui_button_new (_("Close"), 5, 155, 190, 20);
wmmenu.buttons[item].id = MMENWIN_CLOSE; mbtn_close->callback_clicked = (void*)gui_mainmenu_close;
wmmenu.buttons[item].w = 80; gui_window_item_add (&wmmenu, GUI_BUTTON, mbtn_close);
wmmenu.buttons[item].h = 25; }
wmmenu.buttons[item].x = 5;
wmmenu.buttons[item].y = 170;
strncpy (wmmenu.buttons[++item].caption, _("Quit"), GUI_TEXTLEN);
wmmenu.buttons[item].callback_clicked = (void*)gui_mainmenu_quit;
wmmenu.buttons[item].id = MMENWIN_QUIT;
wmmenu.buttons[item].w = 80;
wmmenu.buttons[item].h = 25;
wmmenu.buttons[item].x = 90;
wmmenu.buttons[item].y = 170;
strncpy (wmmenu.buttons[++item].caption, _("GPS Config"), GUI_TEXTLEN);
wmmenu.buttons[item].callback_clicked = (void*)gui_mainmenu_gpsconfig;
wmmenu.buttons[item].id = MMENWIN_GPSCONFIG;
wmmenu.buttons[item].w = 80;
wmmenu.buttons[item].h = 25;
wmmenu.buttons[item].x = 5;
wmmenu.buttons[item].y = 140;
strncpy (wmmenu.buttons[++item].caption, _("GPS On/Off"), GUI_TEXTLEN);
wmmenu.buttons[item].callback_clicked = (void*)gui_mainmenu_gpsstartstop;
wmmenu.buttons[item].id = MMENWIN_GPSSTARTSTOP;
wmmenu.buttons[item].w = 80;
wmmenu.buttons[item].h = 25;
wmmenu.buttons[item].x = 5;
wmmenu.buttons[item].y = 110;
strncpy (wmmenu.buttons[++item].caption, _("MAP Config"), GUI_TEXTLEN);
wmmenu.buttons[item].callback_clicked = (void*)gui_mainmenu_mapconfig;
wmmenu.buttons[item].id = MMENWIN_MAPCONFIG;
wmmenu.buttons[item].w = 80;
wmmenu.buttons[item].h = 25;
wmmenu.buttons[item].x = 90;
wmmenu.buttons[item].y = 140;
strncpy (wmmenu.buttons[++item].caption, _("MAP Refresh"), GUI_TEXTLEN);
wmmenu.buttons[item].callback_clicked = (void*)gui_mainmenu_refresh;
wmmenu.buttons[item].id = MMENWIN_MAPREFRESH;
wmmenu.buttons[item].w = 80;
wmmenu.buttons[item].h = 25;
wmmenu.buttons[item].x = 90;
wmmenu.buttons[item].y = 110;
strncpy (wmmenu.buttons[++item].caption, _("Debug"), GUI_TEXTLEN);
wmmenu.buttons[item].callback_clicked = (void*)gui_mainmenu_debug;
wmmenu.buttons[item].id = MMENWIN_DEBUG;
wmmenu.buttons[item].w = 80;
wmmenu.buttons[item].h = 25;
wmmenu.buttons[item].x = 5;
wmmenu.buttons[item].y = 80;
strncpy (wmmenu.buttons[++item].caption, _("IDX Refresh"), GUI_TEXTLEN);
wmmenu.buttons[item].callback_clicked = (void*)gui_mainmenu_refreshidx;
wmmenu.buttons[item].id = MMENWIN_IDXREFRESH;
wmmenu.buttons[item].w = 80;
wmmenu.buttons[item].h = 25;
wmmenu.buttons[item].x = 90;
wmmenu.buttons[item].y = 80;
strncpy (wmmenu.buttons[++item].caption, _("Set Destination"), GUI_TEXTLEN);
wmmenu.buttons[item].callback_clicked = (void*)gui_mainmenu_setdest;
wmmenu.buttons[item].id = MMENWIN_SETDEST;
wmmenu.buttons[item].w = 165;
wmmenu.buttons[item].h = 25;
wmmenu.buttons[item].x = 5;
wmmenu.buttons[item].y = 15;
strncpy (wmmenu.buttons[++item].caption, _("Search"), GUI_TEXTLEN);
wmmenu.buttons[item].callback_clicked = (void*)gui_mainmenu_search;
wmmenu.buttons[item].id = MMENWIN_SEARCH;
wmmenu.buttons[item].w = 165;
wmmenu.buttons[item].h = 25;
wmmenu.buttons[item].x = 5;
wmmenu.buttons[item].y = 45;
gui_show (&wmmenu); gui_show (&wmmenu);
}; };

@ -53,9 +53,7 @@ static GUIWindow wsearch = {0};
void gui_search_show () { void gui_search_show () {
int btn = 0; if (wsearch.screen == NULL) gui_window_new (&wsearch, 220, 60, _("Search.."));
if (wsearch.screen == NULL) guiwindow_new (&wsearch, 220, 60);
wsearch.screen_changed = 1; wsearch.screen_changed = 1;
// wmmenu.callback_close = (void*)gui_mainmenu_closecallback; // wmmenu.callback_close = (void*)gui_mainmenu_closecallback;
@ -63,67 +61,6 @@ void gui_search_show () {
wsearch.style = WGUI_S_VCENTER | WGUI_S_HTOP; wsearch.style = WGUI_S_VCENTER | WGUI_S_HTOP;
wsearch.title[0] = 0; wsearch.title[0] = 0;
/* search buttons */
strncpy (wsearch.buttons[btn].caption, _("<"), GUI_TEXTLEN);
wsearch.buttons[btn].callback_clicked = (void*)gui_search_prev;
wsearch.buttons[btn].id = SEARCHWIN_PREV;
wsearch.buttons[btn].w = 20;
wsearch.buttons[btn].h = 20;
wsearch.buttons[btn].x = 5;
wsearch.buttons[btn].y = 35;
strncpy (wsearch.buttons[++btn].caption, _(">"), GUI_TEXTLEN);
wsearch.buttons[btn].callback_clicked = (void*)gui_search_next;
wsearch.buttons[btn].id = SEARCHWIN_NEXT;
wsearch.buttons[btn].w = 20;
wsearch.buttons[btn].h = 20;
wsearch.buttons[btn].x = 85;
wsearch.buttons[btn].y = 35;
strncpy (wsearch.buttons[++btn].caption, _("Search"), GUI_TEXTLEN);
wsearch.buttons[btn].callback_clicked = (void*)gui_search_search;
wsearch.buttons[btn].id = SEARCHWIN_SEARCH;
wsearch.buttons[btn].w = 50;
wsearch.buttons[btn].h = 20;
wsearch.buttons[btn].x = 110;
wsearch.buttons[btn].y = 35;
strncpy (wsearch.buttons[++btn].caption, _("Ref"), GUI_TEXTLEN);
wsearch.buttons[btn].callback_clicked = (void*)gui_search_refresh;
wsearch.buttons[btn].id = SEARCHWIN_REFRESH;
wsearch.buttons[btn].w = 30;
wsearch.buttons[btn].h = 20;
wsearch.buttons[btn].x = 165;
wsearch.buttons[btn].y = 35;
strncpy (wsearch.buttons[++btn].caption, _("X"), GUI_TEXTLEN);
wsearch.buttons[btn].callback_clicked = (void*)gui_search_close;
wsearch.buttons[btn].id = SEARCHWIN_CLOSE;
wsearch.buttons[btn].w = 15;
wsearch.buttons[btn].h = 20;
wsearch.buttons[btn].x = 200;
wsearch.buttons[btn].y = 35;
/* add label */
btn = 0;
strncpy (wsearch.labels[btn].text, "0/0", GUI_TEXTLEN);
wsearch.labels[btn].x = 35;
wsearch.labels[btn].y = 37;
wsearch.labels[btn].id = SEARCHWIN_LABEL;
wsearch.labels[btn].textcol = &color[COLOR_white][3];
/* add entry box */
btn = 0;
strncpy (wsearch.entrys[btn].text, "", GUI_TEXTLEN);
wsearch.entrys[btn].id = SEARCHWIN_TEXT;
wsearch.entrys[btn].x = 5;
wsearch.entrys[btn].y = 5;
wsearch.entrys[btn].w = 210;
wsearch.entrys[btn].h = 20;
wsearch.entrys[btn].curpos = 4;
wsearch.entrys[btn].overwrite = 0;
wsearch.entrys[btn].callback_enter = (void*)gui_search_search;
gui_show (&wsearch); gui_show (&wsearch);
}; };
@ -155,9 +92,8 @@ void gui_search_next () {
void gui_search_search () { void gui_search_search () {
d_printf ("search for %s", wsearch.entrys[0].text); char text[] = "ttttt...";
search_data_cnt = map_search (text, search_data, SEARCH_MAXRESULT);
search_data_cnt = map_search (wsearch.entrys[0].text, search_data, SEARCH_MAXRESULT);
gui_search_switch (0); gui_search_switch (0);
}; };
@ -168,7 +104,7 @@ void gui_search_switch (int pos) {
if (search_data_cnt <= 0) search_data_cur = -1; if (search_data_cnt <= 0) search_data_cur = -1;
else if (search_data_cur >= search_data_cnt) search_data_cur = 0; else if (search_data_cur >= search_data_cnt) search_data_cur = 0;
else if (search_data_cur < 0) search_data_cur = search_data_cnt - 1; else if (search_data_cur < 0) search_data_cur = search_data_cnt - 1;
/*
if (search_data_cur == -1) strncpy (wsearch.labels[0].text, _("0"), GUI_TEXTLEN); if (search_data_cur == -1) strncpy (wsearch.labels[0].text, _("0"), GUI_TEXTLEN);
else { else {
snprintf (wsearch.labels[0].text, GUI_TEXTLEN, _("%d of %d"), search_data_cur+1, search_data_cnt); snprintf (wsearch.labels[0].text, GUI_TEXTLEN, _("%d of %d"), search_data_cur+1, search_data_cnt);
@ -178,5 +114,5 @@ void gui_search_switch (int pos) {
wsearch.screen_changed = 1; wsearch.screen_changed = 1;
wsearch.entrys[0].curpos = strlen (wsearch.entrys[0].text); wsearch.entrys[0].curpos = strlen (wsearch.entrys[0].text);
draw (); draw ();
} } */
}; };

@ -43,14 +43,14 @@ void gpswin_btnclose(int x, int y);
void gpswin_show () { void gpswin_show () {
d_printf ("GUI: gps file screen"); d_printf ("GUI: gps file screen");
if (gpswin.screen == NULL) guiwindow_new (&gpswin, 250, 32); if (gpswin.screen == NULL) gui_window_new (&gpswin, 250, 32, _("GPS"));
gpswin.screen_changed = 1; gpswin.screen_changed = 1;
gpswin.callback_close = (void*)gpswin_closecallback; gpswin.callback_close = (void*)gpswin_closecallback;
gpswin.style = WGUI_S_VCENTER | WGUI_S_HBOTTOM; gpswin.style = WGUI_S_VCENTER | WGUI_S_HBOTTOM;
/* add buttons */ /* add buttons */
strncpy (gpswin.buttons[0].caption, _("P"), GUI_TEXTLEN); /* strncpy (gpswin.buttons[0].caption, _("P"), GUI_TEXTLEN);
gpswin.buttons[0].callback_clicked = (void*)gpswin_btnpauseplay; gpswin.buttons[0].callback_clicked = (void*)gpswin_btnpauseplay;
gpswin.buttons[0].id = GPSWIN_PAUSEPLAY; gpswin.buttons[0].id = GPSWIN_PAUSEPLAY;
gpswin.buttons[0].callback_draw = (void*)gpswin_btndraw; gpswin.buttons[0].callback_draw = (void*)gpswin_btndraw;
@ -75,7 +75,7 @@ void gpswin_show () {
gpswin.buttons[2].h = 31; gpswin.buttons[2].h = 31;
gpswin.buttons[2].x = 250-32; gpswin.buttons[2].x = 250-32;
gpswin.buttons[2].y = 0; gpswin.buttons[2].y = 0;
*/
gui_show (&gpswin); gui_show (&gpswin);
}; };
@ -83,13 +83,12 @@ void gpswin_show () {
void gpswin_closecallback () { void gpswin_closecallback () {
d_printf ("GUI: gps win close"); d_printf ("GUI: gps win close");
guiwindow_close (&gpswin); gui_window_close (&gpswin);
}; };
void gpswin_btndraw (GUIButton *btn) { void gpswin_btndraw (GUIButton *btn) {
int i; /* if (btn->id == GPSWIN_PAUSEPLAY) {
if (btn->id == GPSWIN_PAUSEPLAY) {
i = gps_file_get_state (); i = gps_file_get_state ();
if (i == GPSF_END) btn->col = &color[COLOR_white][1]; if (i == GPSF_END) btn->col = &color[COLOR_white][1];
else if (i == GPSF_INIT) btn->col = &color[COLOR_green][0]; else if (i == GPSF_INIT) btn->col = &color[COLOR_green][0];
@ -125,6 +124,7 @@ void gpswin_btndraw (GUIButton *btn) {
draw_line (currentwin->screen, btn->x + x, btn->y, btn->x + x, btn->y + btn->h, ls); draw_line (currentwin->screen, btn->x + x, btn->y, btn->x + x, btn->y + btn->h, ls);
} }
*/
}; };

@ -86,6 +86,7 @@
#include "map.h" #include "map.h"
#include "system.h" #include "system.h"
#include "memoryleak.h"
enum { /* what we're doing at the moment */ enum { /* what we're doing at the moment */
APPSTATUS_nothing, APPSTATUS_nothing,

Loading…
Cancel
Save