[project @ 2004-07-26 20:13:45 by atimmins]

Updated to support new config options (homepage, open on startup).  Bug fixes with new config pane window (sticky selected radio icon bug!).  Also includes up-to-date French templates.

svn path=/import/netsurf/; revision=1150
This commit is contained in:
Andrew Timmins 2004-07-26 20:13:45 +00:00
parent 8e7d298c65
commit b59616c9ab
12 changed files with 92 additions and 7 deletions

Binary file not shown.

Binary file not shown.

View File

@ -4,6 +4,7 @@
* http://www.opensource.org/licenses/gpl-license * http://www.opensource.org/licenses/gpl-license
* Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net> * Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
* Copyright 2004 James Bursa <bursa@users.sourceforge.net> * Copyright 2004 James Bursa <bursa@users.sourceforge.net>
* Copyright 2004 Andrew Timmins <atimmins@blueyonder.co.uk>
*/ */
/** \file /** \file

View File

@ -4,6 +4,7 @@
* http://www.opensource.org/licenses/gpl-license * http://www.opensource.org/licenses/gpl-license
* Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net> * Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
* Copyright 2004 James Bursa <bursa@users.sourceforge.net> * Copyright 2004 James Bursa <bursa@users.sourceforge.net>
* Copyright 2004 Andrew Timmins <atimmins@blueyonder.co.uk>
*/ */
#include <locale.h> #include <locale.h>
@ -13,7 +14,11 @@
#include "netsurf/utils/config.h" #include "netsurf/utils/config.h"
#include "netsurf/content/fetch.h" #include "netsurf/content/fetch.h"
#include "netsurf/content/fetchcache.h" #include "netsurf/content/fetchcache.h"
#include "netsurf/desktop/options.h" #ifdef riscos
#include "netsurf/riscos/options.h"
#else
#include "netsurf/desktop/options.h"
#endif
#include "netsurf/desktop/netsurf.h" #include "netsurf/desktop/netsurf.h"
#include "netsurf/desktop/browser.h" #include "netsurf/desktop/browser.h"
#include "netsurf/desktop/gui.h" #include "netsurf/desktop/gui.h"
@ -38,12 +43,27 @@ static void lib_init(void);
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
char url[80];
int length;
netsurf_init(argc, argv); netsurf_init(argc, argv);
#ifdef WITH_KIOSK_BROWSING #ifdef WITH_KIOSK_BROWSING
browser_window_create("file:/<NetSurf$Dir>/Docs/Intro_En", NULL); browser_window_create("file:/<NetSurf$Dir>/Docs/Intro_En", NULL);
#endif #endif
if (option_open_browser_at_startup == true){
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);
}
}
while (!netsurf_quit) while (!netsurf_quit)
netsurf_poll(); netsurf_poll();

View File

@ -537,6 +537,16 @@ void ro_gui_dialog_open_config(void)
wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT << wimp_CHILD_TS_EDGE_SHIFT)) { wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT << wimp_CHILD_TS_EDGE_SHIFT)) {
LOG(("Unable to open config proxy pane window")); LOG(("Unable to open config proxy pane window"));
} }
/* Always reset the selected panes to the default option */
ro_gui_set_icon_selected_state(dialog_config, ICON_CONFIG_PROXY,
true);
ro_gui_set_icon_selected_state(dialog_config, ICON_CONFIG_BROWSER,
false);
ro_gui_set_icon_selected_state(dialog_config, ICON_CONFIG_THEME,
false);
ro_gui_set_icon_selected_state(dialog_config, ICON_CONFIG_MISC,
false);
} }
/** /**
@ -952,6 +962,12 @@ void set_browser_choices(void) {
ro_gui_set_icon_string(dialog_config_br, ICON_CONFIG_BR_ALANG, ro_gui_set_icon_string(dialog_config_br, ICON_CONFIG_BR_ALANG,
language_name(option_accept_language ? language_name(option_accept_language ?
option_accept_language : "en")); option_accept_language : "en"));
ro_gui_set_icon_string(dialog_config_br, ICON_CONFIG_BR_HOMEPAGE_URL,
option_homepage_url);
ro_gui_set_icon_selected_state(dialog_config_br, ICON_CONFIG_BR_OPENBROWSER,
option_open_browser_at_startup);
} }
@ -962,6 +978,10 @@ void set_browser_choices(void) {
void get_browser_choices(void) { void get_browser_choices(void) {
option_font_size = font_size; option_font_size = font_size;
option_font_min_size = font_min_size; option_font_min_size = font_min_size;
option_homepage_url = ro_gui_get_icon_string(dialog_config_br,
ICON_CONFIG_BR_HOMEPAGE_URL);
option_open_browser_at_startup = ro_gui_get_icon_selected_state(dialog_config_br,
ICON_CONFIG_BR_OPENBROWSER);
} }

View File

@ -807,10 +807,18 @@ void ro_gui_icon_bar_click(wimp_pointer *pointer)
char url[80]; char url[80];
int length; int length;
if ((length = snprintf(url, sizeof(url), /* 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", "file:/<NetSurf$Dir>/Docs/intro_%s",
option_language)) >= 0 && length < (int)sizeof(url)) option_language)) >= 0 && length < (int)sizeof(url))
browser_window_create(url, NULL); browser_window_create(url, NULL);
}
} else if (pointer->buttons == wimp_CLICK_ADJUST) { } else if (pointer->buttons == wimp_CLICK_ADJUST) {
/* I've no idea what the correct way to scan for keys is when in the /* I've no idea what the correct way to scan for keys is when in the
desktop, so I've used os_byte to scan directly. This may cause some desktop, so I've used os_byte to scan directly. This may cause some
@ -995,7 +1003,7 @@ void ro_msg_dataload(wimp_message *message)
url = ro_gui_url_file_parse(message->data.data_xfer.file_name); url = ro_gui_url_file_parse(message->data.data_xfer.file_name);
else if (file_type == 0xfaf || else if (file_type == 0xfaf ||
file_type == 0xf78 || file_type == 0xf78 ||
file_type == 0xf83 || file_type == 0xf83 ||
file_type == 0x695 || file_type == 0x695 ||
file_type == 0xaff || file_type == 0xaff ||
file_type == 0xb60 || file_type == 0xb60 ||

View File

@ -284,6 +284,11 @@ void ro_gui_debugwin_redraw(wimp_draw *redraw);
#define ICON_CONFIG_BR_LANG_PICK 12 #define ICON_CONFIG_BR_LANG_PICK 12
#define ICON_CONFIG_BR_ALANG 15 #define ICON_CONFIG_BR_ALANG 15
#define ICON_CONFIG_BR_ALANG_PICK 16 #define ICON_CONFIG_BR_ALANG_PICK 16
#define ICON_CONFIG_BR_HOMEPAGE_URL 20
#define ICON_CONFIG_BR_HOMEPAGE_CURRENT 21
#define ICON_CONFIG_BR_HOMEPAGE_DEFAULT 22
#define ICON_CONFIG_BR_HOMEPAGE_BLANK 23
#define ICON_CONFIG_BR_OPENBROWSER 24
#define ICON_CONFIG_PROX_OK 0 #define ICON_CONFIG_PROX_OK 0
#define ICON_CONFIG_PROX_CANCEL 1 #define ICON_CONFIG_PROX_CANCEL 1

View File

@ -571,6 +571,8 @@ void ro_gui_popup_menu(wimp_menu *menu, wimp_w w, wimp_i i)
void ro_gui_menu_selection(wimp_selection *selection) void ro_gui_menu_selection(wimp_selection *selection)
{ {
char url[80];
int length;
wimp_pointer pointer; wimp_pointer pointer;
wimp_window_state state; wimp_window_state state;
os_error *error; os_error *error;
@ -720,6 +722,19 @@ void ro_gui_menu_selection(wimp_selection *selection)
case MENU_NAVIGATE: case MENU_NAVIGATE:
switch (selection->items[1]) { switch (selection->items[1]) {
case 0: /* Home */ 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);
}
break; break;
case 1: /* Back */ case 1: /* Back */
history_back(current_gui->bw, history_back(current_gui->bw,

View File

@ -45,6 +45,8 @@ extern bool option_background_images;
extern bool option_background_blending; extern bool option_background_blending;
extern bool option_buffer_animations; extern bool option_buffer_animations;
extern bool option_buffer_everything; extern bool option_buffer_everything;
extern char *option_homepage_url;
extern bool option_open_browser_at_startup;
#define EXTRA_OPTION_DEFINE \ #define EXTRA_OPTION_DEFINE \
bool option_use_mouse_gestures = false;\ bool option_use_mouse_gestures = false;\
@ -75,7 +77,9 @@ int option_minimum_gif_delay = 10; \
bool option_background_images = true; \ bool option_background_images = true; \
bool option_background_blending = true; \ bool option_background_blending = true; \
bool option_buffer_animations = true; \ bool option_buffer_animations = true; \
bool option_buffer_everything = false; bool option_buffer_everything = false; \
char *option_homepage_url =0;\
bool option_open_browser_at_startup = false;
#define EXTRA_OPTION_TABLE \ #define EXTRA_OPTION_TABLE \
{ "use_mouse_gestures", OPTION_BOOL, &option_use_mouse_gestures },\ { "use_mouse_gestures", OPTION_BOOL, &option_use_mouse_gestures },\
@ -106,6 +110,7 @@ bool option_buffer_everything = false;
{ "background_images", OPTION_BOOL, &option_background_images }, \ { "background_images", OPTION_BOOL, &option_background_images }, \
{ "background_blending", OPTION_BOOL, &option_background_blending }, \ { "background_blending", OPTION_BOOL, &option_background_blending }, \
{ "buffer_animations", OPTION_BOOL, &option_buffer_animations }, \ { "buffer_animations", OPTION_BOOL, &option_buffer_animations }, \
{ "buffer_everything", OPTION_BOOL, &option_buffer_animations } { "buffer_everything", OPTION_BOOL, &option_buffer_animations }, \
{ "homepage_url", OPTION_STRING, &option_homepage_url }, \
{ "open_browser_at_startup",OPTION_BOOL, &option_open_browser_at_startup }
#endif #endif

View File

@ -1258,10 +1258,21 @@ bool ro_gui_window_keypress(struct gui_window *g, int key, bool toolbar)
ro_gui_open_help_page("docs"); ro_gui_open_help_page("docs");
return true; return true;
case wimp_KEY_F5: /* Refresh. */
browser_window_reload(g->bw, false);
return true;
case wimp_KEY_F6: /* Help. */ case wimp_KEY_F6: /* Help. */
ro_gui_hotlist_show(); ro_gui_hotlist_show();
return true; return true;
case wimp_KEY_F7: /* Toggle fullscreen browsing. */
return true;
case wimp_KEY_F8: /* View source. */ case wimp_KEY_F8: /* View source. */
ro_gui_view_source(content); ro_gui_view_source(content);
return true; return true;