From b02f6fa9a0608187cb85752be81bde90071e8b7e Mon Sep 17 00:00:00 2001 From: Andrew Timmins Date: Sun, 25 Jul 2004 19:25:26 +0000 Subject: [project @ 2004-07-25 19:25:26 by atimmins] Updated to support paned config dialog. svn path=/import/netsurf/; revision=1143 --- riscos/dialog.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++----- riscos/gui.c | 2 +- riscos/gui.h | 8 ++++-- riscos/menus.c | 2 +- utils/config.h | 4 +-- 5 files changed, 88 insertions(+), 14 deletions(-) diff --git a/riscos/dialog.c b/riscos/dialog.c index 80386c530..2449fb011 100644 --- a/riscos/dialog.c +++ b/riscos/dialog.c @@ -6,6 +6,7 @@ * Copyright 2004 James Bursa * Copyright 2003 John M Bell * Copyright 2004 Richard Wilson + * Copyright 2004 Andrew Timmins */ #include @@ -392,10 +393,10 @@ void ro_gui_dialog_click_config(wimp_pointer *pointer) set_theme_choices(); break; case ICON_CONFIG_BROWSER: - ro_gui_dialog_open(dialog_config_br); + ro_gui_dialog_update_config(dialog_config_br); break; case ICON_CONFIG_PROXY: - ro_gui_dialog_open(dialog_config_prox); + ro_gui_dialog_update_config(dialog_config_prox); break; case ICON_CONFIG_THEME: ro_gui_dialog_open_config_th(); @@ -410,12 +411,19 @@ void ro_gui_dialog_click_config(wimp_pointer *pointer) void ro_gui_save_options(void) { + /* NCOS doesnt have the fancy Universal Boot vars; so select + * the path to the choices file based on the build options */ + #ifndef NCOS xosfile_create_dir(".WWW", 0); xosfile_create_dir(".WWW.NetSurf", 0); options_write(".WWW.NetSurf.Choices"); + #else + xosfile_create_dir(".Choices.NetSurf", 0); + xosfile_create_dir(".Choices.NetSurf.Choices", 0); + options_write(".Choices.NetSurf.Choices"); + #endif } - /** * Handle clicks in the Browser Choices dialog. */ @@ -497,6 +505,71 @@ void ro_gui_dialog_click_config_prox(wimp_pointer *pointer) } } +/** + * Prepare and open the Choices dialog. + */ + +void ro_gui_dialog_open_config(void) +{ + wimp_window_state state; + + ro_gui_dialog_open(dialog_config); + + state.w = dialog_config; + xwimp_get_window_state(&state); + state.w = dialog_config_prox; + state.visible.x0 += 0; + state.visible.y1 -= 0; + state.xscroll = 0; + state.yscroll = 0; + state.next = wimp_TOP; + if (xwimp_open_window_nested((wimp_open *)&state, dialog_config, + wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT + << wimp_CHILD_XORIGIN_SHIFT | + wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT + << wimp_CHILD_YORIGIN_SHIFT | + wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT + << wimp_CHILD_LS_EDGE_SHIFT | + wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT + << wimp_CHILD_BS_EDGE_SHIFT | + wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT + << wimp_CHILD_RS_EDGE_SHIFT | + wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT << wimp_CHILD_TS_EDGE_SHIFT)) { + LOG(("Unable to open config proxy pane window")); + } +} + +/** + * Update the pane in the Choices dialog. + */ + +void ro_gui_dialog_update_config(wimp_w w) +{ + wimp_window_state state; + + state.w = dialog_config; + xwimp_get_window_state(&state); + state.w = w; + state.visible.x0 += 0; + state.visible.y1 -= 0; + state.xscroll = 0; + state.yscroll = 0; + state.next = wimp_TOP; + if (xwimp_open_window_nested((wimp_open *)&state, dialog_config, + wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT + << wimp_CHILD_XORIGIN_SHIFT | + wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT + << wimp_CHILD_YORIGIN_SHIFT | + wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT + << wimp_CHILD_LS_EDGE_SHIFT | + wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT + << wimp_CHILD_BS_EDGE_SHIFT | + wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT + << wimp_CHILD_RS_EDGE_SHIFT | + wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT << wimp_CHILD_TS_EDGE_SHIFT)) { + LOG(("Unable to update config pane window")); + } +} /** * Prepare and open the Theme Choices dialog. @@ -512,13 +585,12 @@ void ro_gui_dialog_open_config_th(void) if (!theme_list) return; - ro_gui_dialog_open(dialog_config_th); -// ro_gui_dialog_open(dialog_config_th_pane); + ro_gui_dialog_update_config(dialog_config_th); state.w = dialog_config_th; xwimp_get_window_state(&state); state.w = dialog_config_th_pane; - state.visible.x0 += 24; + state.visible.x0 += 12; state.visible.y1 -= 12; state.xscroll = 0; state.yscroll = 0; @@ -694,7 +766,7 @@ void ro_gui_redraw_config_th_pane_plot(wimp_draw *redraw) if (error) break; error = xos_plot(os_PLOT_RECTANGLE | os_PLOT_BY, - 600, -THEME_HEIGHT); + 705, -THEME_HEIGHT); if (error) break; error = xwimptextop_set_colour(os_COLOUR_BLACK, diff --git a/riscos/gui.c b/riscos/gui.c index 0d374148f..afd4d97a3 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -183,7 +183,7 @@ void gui_init(int argc, char** argv) messages_load(path); messages_load(".Resources.LangNames"); - /* Totally pedantic But base the taskname on the buid options! + /* Totally pedantic, but base the taskname on the buid options. */ #ifndef ncos error = xwimp_initialise(wimp_VERSION_RO38, "NetSurf", diff --git a/riscos/gui.h b/riscos/gui.h index 64d48dee5..152da4826 100644 --- a/riscos/gui.h +++ b/riscos/gui.h @@ -4,6 +4,7 @@ * http://www.opensource.org/licenses/gpl-license * Copyright 2003 Phil Mellor * Copyright 2004 James Bursa + * Copyright 2004 Andrew Timmins */ #ifndef _NETSURF_RISCOS_GUI_H_ @@ -266,9 +267,10 @@ void ro_gui_debugwin_redraw(wimp_draw *redraw); #define ICON_CONFIG_SAVE 0 #define ICON_CONFIG_CANCEL 1 -#define ICON_CONFIG_BROWSER 2 -#define ICON_CONFIG_PROXY 3 -#define ICON_CONFIG_THEME 4 +#define ICON_CONFIG_BROWSER 7 +#define ICON_CONFIG_PROXY 6 +#define ICON_CONFIG_THEME 8 +#define ICON_CONFIG_MISC 9 #define ICON_CONFIG_BR_OK 0 #define ICON_CONFIG_BR_CANCEL 1 diff --git a/riscos/menus.c b/riscos/menus.c index 535fe22a3..651962416 100644 --- a/riscos/menus.c +++ b/riscos/menus.c @@ -592,7 +592,7 @@ void ro_gui_menu_selection(wimp_selection *selection) ro_gui_open_help_page("docs"); break; case 2: /* Choices */ - ro_gui_dialog_open(dialog_config); + ro_gui_dialog_open_config(); break; case 3: /* Quit */ netsurf_quit = true; diff --git a/utils/config.h b/utils/config.h index ba84f3b9b..5bc039a3d 100644 --- a/utils/config.h +++ b/utils/config.h @@ -42,14 +42,14 @@ #define WITH_URI /* ANT URL protocol support */ #define WITH_URL + /* Keyboard navigation support */ + #define WITH_KEYBOARD_NAVIGATION #endif #ifdef ncos /* Kiosk style browsing support */ #define WITH_KIOSK_BROWSING /* Kiosk style browsing themes support */ #define WITH_KIOSK_THEMES - /* Keyboard navigation support */ - #define WITH_KEYBOARD_NAVIGATION #endif #if defined(riscos) || defined(ncos) || defined(debug) -- cgit v1.2.3