summaryrefslogtreecommitdiff
path: root/atari/search.c
diff options
context:
space:
mode:
authorOle Loots <ole@monochrom.net>2013-01-22 22:28:20 +0100
committerOle Loots <ole@monochrom.net>2013-01-22 22:28:20 +0100
commit577ff3cffc5fb99041c5da2d828b1f25cfb13dc9 (patch)
treee9d187909281089c7e18cf84ef778a69af006f6b /atari/search.c
parent985e4ce6be424aec5e797d92c09e0ee22cde7874 (diff)
downloadnetsurf-577ff3cffc5fb99041c5da2d828b1f25cfb13dc9.tar.gz
netsurf-577ff3cffc5fb99041c5da2d828b1f25cfb13dc9.tar.bz2
The Window toolbar now have independet AES objects,
which means no state restore is required before redraw.
Diffstat (limited to 'atari/search.c')
-rw-r--r--atari/search.c40
1 files changed, 33 insertions, 7 deletions
diff --git a/atari/search.c b/atari/search.c
index 02462505b..17241d1ae 100644
--- a/atari/search.c
+++ b/atari/search.c
@@ -39,6 +39,7 @@
#include "atari/gui.h"
#include "atari/rootwin.h"
#include "atari/misc.h"
+#include "atari/toolbar.h"
#include "atari/search.h"
#include "atari/gemtk/gemtk.h"
#include "atari/res/netsurf.rsh"
@@ -110,11 +111,24 @@ void nsatari_search_add_recent(const char *string, void *p)
*/
void nsatari_search_set_forward_state(bool active, void *p)
-{
+{
+ struct gui_window *gw;
+ OBJECT *toolbar;
+ GRECT area;
SEARCH_FORM_SESSION s = (SEARCH_FORM_SESSION)p;
/* deactivate back cb */
LOG(("%p: set forward state: %d\n", p, active));
- // TODO: update gui
+
+ gw = s->bw->window;
+
+ toolbar = toolbar_get_form(gw->root->toolbar);
+ if(active)
+ toolbar[TOOLBAR_BT_SEARCH_FWD].ob_state &= ~OS_DISABLED;
+ else
+ toolbar[TOOLBAR_BT_SEARCH_FWD].ob_state |= OS_DISABLED;
+ window_get_grect(gw->root, BROWSER_AREA_SEARCH, &area);
+ window_schedule_redraw_grect(gw->root, &area);
+
}
/**
@@ -125,12 +139,23 @@ void nsatari_search_set_forward_state(bool active, void *p)
void nsatari_search_set_back_state(bool active, void *p)
{
+ struct gui_window *gw;
+ OBJECT *toolbar;
+ GRECT area;
SEARCH_FORM_SESSION s = (SEARCH_FORM_SESSION)p;
/* deactivate back cb */
LOG(("%p: set back state: %d\n", p, active));
- s->state.back_avail = true;
- // TODO: update gui
+ s->state.back_avail = active;
+ gw = s->bw->window;
+
+ toolbar = toolbar_get_form(gw->root->toolbar);
+ if(active)
+ toolbar[TOOLBAR_BT_SEARCH_BACK].ob_state &= ~OS_DISABLED;
+ else
+ toolbar[TOOLBAR_BT_SEARCH_BACK].ob_state |= OS_DISABLED;
+ window_get_grect(gw->root, BROWSER_AREA_SEARCH, &area);
+ window_schedule_redraw_grect(gw->root, &area);
}
@@ -204,7 +229,7 @@ void nsatari_search_session_destroy(struct s_search_form_session *s)
}
}
-/* checks for search parameters changes */
+/** checks for search parameters changes */
static bool search_session_compare(struct s_search_form_session *s, OBJECT *obj)
{
bool check;
@@ -240,10 +265,11 @@ void nsatari_search_perform(struct s_search_form_session *s, OBJECT *obj,
bool fwd;
search_flags_t flags = f;
- assert(s!=null);
+ assert(s!=null);
+ assert(input_window->browser->bw == s->bw);
+
if(search_session_compare(s, obj)){
- printf("reset search form\n");
browser_window_search_destroy_context(s->bw);
apply_form(obj, &s->state);
} else {