[project @ 2004-08-05 23:10:24 by rjw]

Added home and search toolbar buttons. Fixed homepage menu entry to open in same window.

svn path=/import/netsurf/; revision=1185
This commit is contained in:
Richard Wilson 2004-08-05 23:10:24 +00:00
parent fc50ed2eca
commit 1d76b7efae
3 changed files with 33 additions and 16 deletions

View File

@ -803,19 +803,14 @@ void ro_gui_menu_selection(wimp_selection *selection)
case MENU_NAVIGATE:
switch (selection->items[1]) {
case 0: /* Home */
/* Open the homepage based on our the user options. */
if (!(option_homepage_url == NULL)){
browser_window_create(option_homepage_url, NULL);
}
else {
if ((length = snprintf(url, sizeof(url),
"file:/<NetSurf$Dir>/Docs/intro_%s",
option_language)) >= 0 && length < (int)sizeof(url))
browser_window_create(url, NULL);
}
if (option_homepage_url && option_homepage_url[0]) {
browser_window_go_post(current_gui->bw, option_homepage_url, 0, 0, true);
} else {
snprintf(url, sizeof url,
"file:/<NetSurf$Dir>/Docs/intro_%s",
option_language);
browser_window_go_post(current_gui->bw, url, 0, 0, true);
}
break;
case 1: /* Back */
history_back(current_gui->bw,

View File

@ -125,10 +125,10 @@ struct toolbar *ro_toolbar_create(osspriteop_area *sprite_area, char *url_buffer
ro_toolbar_add_icon(toolbar, ro_toolbar_initialise_icon(sprite_area, "forward", ICON_TOOLBAR_FORWARD));
ro_toolbar_add_icon(toolbar, ro_toolbar_initialise_icon(sprite_area, "stop", ICON_TOOLBAR_STOP));
ro_toolbar_add_icon(toolbar, ro_toolbar_initialise_icon(sprite_area, "reload", ICON_TOOLBAR_RELOAD));
ro_toolbar_add_icon(toolbar, ro_toolbar_initialise_icon(sprite_area, "home", ICON_TOOLBAR_HOME));
ro_toolbar_add_icon(toolbar, ro_toolbar_create_separator());
/* ro_toolbar_add_icon(toolbar, ro_toolbar_initialise_icon(sprite_area, "home", ICON_TOOLBAR_HOME)); */
/* ro_toolbar_add_icon(toolbar, ro_toolbar_initialise_icon(sprite_area, "up", ICON_TOOLBAR_UP)); */
/* ro_toolbar_add_icon(toolbar, ro_toolbar_initialise_icon(sprite_area, "search", ICON_TOOLBAR_SEARCH)); */
ro_toolbar_add_icon(toolbar, ro_toolbar_initialise_icon(sprite_area, "search", ICON_TOOLBAR_SEARCH));
ro_toolbar_add_icon(toolbar, ro_toolbar_initialise_icon(sprite_area, "history", ICON_TOOLBAR_HISTORY));
ro_toolbar_add_icon(toolbar, ro_toolbar_initialise_icon(sprite_area, "scale", ICON_TOOLBAR_SCALE));
ro_toolbar_add_icon(toolbar, ro_toolbar_create_separator());

View File

@ -983,6 +983,7 @@ void ro_gui_window_mouse_at(struct gui_window *g, wimp_pointer *pointer)
void ro_gui_toolbar_click(struct gui_window *g, wimp_pointer *pointer)
{
char url[80];
os_error *error;
/* Reject Menu clicks
@ -1016,7 +1017,28 @@ void ro_gui_toolbar_click(struct gui_window *g, wimp_pointer *pointer)
g->bw->history,
pointer->pos.x, pointer->pos.y);
break;
case ICON_TOOLBAR_HOME:
if (option_homepage_url && option_homepage_url[0]) {
if (pointer->buttons == wimp_CLICK_SELECT) {
browser_window_go_post(g->bw, option_homepage_url,
0, 0, true);
} else {
browser_window_create(option_homepage_url, NULL);
}
} else {
snprintf(url, sizeof url,
"file:/<NetSurf$Dir>/Docs/intro_%s",
option_language);
if (pointer->buttons == wimp_CLICK_SELECT) {
browser_window_go_post(g->bw, url, 0, 0, true);
} else {
browser_window_create(url, NULL);
}
}
break;
case ICON_TOOLBAR_SEARCH:
ro_gui_search_open(g, 0, 0, false, true);
break;
case ICON_TOOLBAR_SCALE:
current_gui = g;
ro_gui_menu_prepare_scale();