From 3ebf60d9fcbde65dee4cd70d02aba97d20e5d21e Mon Sep 17 00:00:00 2001 From: Richard Wilson Date: Fri, 6 Jan 2006 21:25:34 +0000 Subject: [project @ 2006-01-06 21:25:34 by rjw] Simplify code and make tree windows defined in the templates. svn path=/import/netsurf/; revision=1999 --- !NetSurf/Resources/de/Templates,fec | Bin 11659 -> 12658 bytes !NetSurf/Resources/fr/Templates,fec | Bin 11786 -> 12785 bytes !NetSurf/Resources/nl/Templates,fec | Bin 11688 -> 12687 bytes riscos/dialog.c | 23 ++++++++++--- riscos/global_history.c | 53 +++--------------------------- riscos/gui.c | 16 ++------- riscos/hotlist.c | 63 +++--------------------------------- 7 files changed, 29 insertions(+), 126 deletions(-) diff --git a/!NetSurf/Resources/de/Templates,fec b/!NetSurf/Resources/de/Templates,fec index afda601d3..cf7676fcd 100755 Binary files a/!NetSurf/Resources/de/Templates,fec and b/!NetSurf/Resources/de/Templates,fec differ diff --git a/!NetSurf/Resources/fr/Templates,fec b/!NetSurf/Resources/fr/Templates,fec index b7fb83c99..ce92b9ecc 100644 Binary files a/!NetSurf/Resources/fr/Templates,fec and b/!NetSurf/Resources/fr/Templates,fec differ diff --git a/!NetSurf/Resources/nl/Templates,fec b/!NetSurf/Resources/nl/Templates,fec index fa5c20fe5..d252ef742 100644 Binary files a/!NetSurf/Resources/nl/Templates,fec and b/!NetSurf/Resources/nl/Templates,fec differ diff --git a/riscos/dialog.c b/riscos/dialog.c index 1e44b5719..700067a0c 100644 --- a/riscos/dialog.c +++ b/riscos/dialog.c @@ -25,6 +25,7 @@ #include "netsurf/render/font.h" #include "netsurf/riscos/configure.h" #include "netsurf/riscos/dialog.h" +#include "netsurf/riscos/global_history.h" #include "netsurf/riscos/gui.h" #include "netsurf/riscos/menus.h" #include "netsurf/riscos/options.h" @@ -72,17 +73,29 @@ static bool ro_gui_dialog_zoom_apply(wimp_w w); void ro_gui_dialog_init(void) { - dialog_tooltip = ro_gui_dialog_create("tooltip"); - - /* configure window */ - ro_gui_configure_initialise(); - /* warning dialog */ dialog_warning = ro_gui_dialog_create("warning"); ro_gui_wimp_event_register_ok(dialog_warning, ICON_WARNING_CONTINUE, NULL); ro_gui_wimp_event_set_help_prefix(dialog_debug, "HelpWarning"); + /* tooltip for history */ + dialog_tooltip = ro_gui_dialog_create("tooltip"); + + /* configure window */ + ro_gui_configure_initialise(); + + /* 401 login window */ +#ifdef WITH_AUTH + ro_gui_401login_init(); +#endif + + /* hotlist window */ + ro_gui_hotlist_initialise(); + + /* global history window */ + ro_gui_global_history_initialise(); + /* theme installation */ dialog_theme_install = ro_gui_dialog_create("theme_inst"); ro_gui_wimp_event_register_cancel(dialog_theme_install, diff --git a/riscos/global_history.c b/riscos/global_history.c index e87577ef9..a42ee148d 100644 --- a/riscos/global_history.c +++ b/riscos/global_history.c @@ -53,39 +53,6 @@ static void ro_gui_global_history_initialise_node(const char *title, static struct node *ro_gui_global_history_find(const char *url); -/* A basic window for the history -*/ -static wimp_window history_window_definition = { - {0, 0, 600, 800}, - 0, - 0, - wimp_TOP, - wimp_WINDOW_NEW_FORMAT | wimp_WINDOW_MOVEABLE | wimp_WINDOW_BACK_ICON | - wimp_WINDOW_CLOSE_ICON | wimp_WINDOW_TITLE_ICON | - wimp_WINDOW_TOGGLE_ICON | wimp_WINDOW_SIZE_ICON | - wimp_WINDOW_VSCROLL | wimp_WINDOW_IGNORE_XEXTENT | - wimp_WINDOW_IGNORE_YEXTENT, - wimp_COLOUR_BLACK, - wimp_COLOUR_LIGHT_GREY, - wimp_COLOUR_LIGHT_GREY, - wimp_COLOUR_WHITE, - wimp_COLOUR_DARK_GREY, - wimp_COLOUR_MID_LIGHT_GREY, - wimp_COLOUR_CREAM, - 0, - {0, -16384, 16384, 0}, - wimp_ICON_TEXT | wimp_ICON_INDIRECTED | wimp_ICON_HCENTRED | - wimp_ICON_VCENTRED, - wimp_BUTTON_DOUBLE_CLICK_DRAG << wimp_ICON_BUTTON_TYPE_SHIFT, - wimpspriteop_AREA, - 1, - 1, - {""}, - 0, - {} -}; - - /* The history window, toolbar and plot origins */ static wimp_w global_history_window; @@ -102,22 +69,10 @@ void ro_gui_global_history_initialise(void) { struct url_content **url_block; int i = 0; - /* Create our window - */ - title = messages_get("GlobalHistory"); - history_window_definition.title_data.indirected_text.text = - strdup(title); - history_window_definition.title_data.indirected_text.validation = - (char *) -1; - history_window_definition.title_data.indirected_text.size = - strlen(title); - error = xwimp_create_window(&history_window_definition, - &global_history_window); - if (error) { - LOG(("xwimp_create_window: 0x%x: %s", - error->errnum, error->errmess)); - die(error->errmess); - } + /* create our window */ + global_history_window = ro_gui_dialog_create("tree"); + ro_gui_set_window_title(global_history_window, + messages_get("GlobalHistory")); ro_gui_wimp_event_register_redraw_window(global_history_window, ro_gui_tree_redraw); ro_gui_wimp_event_register_open_window(global_history_window, diff --git a/riscos/gui.c b/riscos/gui.c index 1ce6426af..0c74bb915 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -245,7 +245,6 @@ void gui_init(int argc, char** argv) char path[40]; os_error *error; int length; - struct theme_descriptor *descriptor = NULL; char *nsdir_temp; /* re-enable all FPU exceptions/traps except inexact operations, @@ -361,26 +360,15 @@ void gui_init(int argc, char** argv) error->errnum, error->errmess)); die(error->errmess); } + ro_gui_theme_initialise(); /* initialise themes before dialogs */ ro_gui_dialog_init(); /* must be done after sprite loading */ ro_gui_download_init(); ro_gui_menu_init(); ro_gui_query_init(); -#ifdef WITH_AUTH - ro_gui_401login_init(); -#endif ro_gui_history_init(); wimp_close_template(); - ro_gui_tree_initialise(); /* must be done after sprite loading */ - ro_gui_hotlist_initialise(); - ro_gui_global_history_initialise(); - /* Load our chosen theme - */ - ro_gui_theme_initialise(); - descriptor = ro_gui_theme_find(option_theme); - if (!descriptor) - descriptor = ro_gui_theme_find("Aletheia"); - ro_gui_theme_apply(descriptor); + ro_gui_tree_initialise(); /* must be done after sprite loading */ #ifndef ncos ro_gui_icon_bar_create(); diff --git a/riscos/hotlist.c b/riscos/hotlist.c index 13c2a56bf..f0c762ecb 100644 --- a/riscos/hotlist.c +++ b/riscos/hotlist.c @@ -14,20 +14,13 @@ #include #include #include -#include -#include "libxml/HTMLparser.h" -#include "libxml/HTMLtree.h" -#include "oslib/colourtrans.h" -#include "oslib/dragasprite.h" #include "oslib/osfile.h" #include "oslib/wimp.h" -#include "oslib/wimpspriteop.h" #include "netsurf/content/content.h" #include "netsurf/desktop/tree.h" -#include "netsurf/riscos/gui.h" +#include "netsurf/riscos/dialog.h" #include "netsurf/riscos/menus.h" #include "netsurf/riscos/theme.h" -#include "netsurf/riscos/tinct.h" #include "netsurf/riscos/treeview.h" #include "netsurf/riscos/wimp.h" #include "netsurf/riscos/wimp_event.h" @@ -41,38 +34,6 @@ static void ro_gui_hotlist_visited(struct content *content, struct tree *tree, struct node *node); static bool ro_gui_hotlist_click(wimp_pointer *pointer); -/* A basic window for the hotlist -*/ -static wimp_window hotlist_window_definition = { - {0, 0, 600, 800}, - 0, - 0, - wimp_TOP, - wimp_WINDOW_NEW_FORMAT | wimp_WINDOW_MOVEABLE | wimp_WINDOW_BACK_ICON | - wimp_WINDOW_CLOSE_ICON | wimp_WINDOW_TITLE_ICON | - wimp_WINDOW_TOGGLE_ICON | wimp_WINDOW_SIZE_ICON | - wimp_WINDOW_VSCROLL | wimp_WINDOW_IGNORE_XEXTENT | - wimp_WINDOW_IGNORE_YEXTENT, - wimp_COLOUR_BLACK, - wimp_COLOUR_LIGHT_GREY, - wimp_COLOUR_LIGHT_GREY, - wimp_COLOUR_WHITE, - wimp_COLOUR_DARK_GREY, - wimp_COLOUR_MID_LIGHT_GREY, - wimp_COLOUR_CREAM, - 0, - {0, -16384, 16384, 0}, - wimp_ICON_TEXT | wimp_ICON_INDIRECTED | wimp_ICON_HCENTRED | - wimp_ICON_VCENTRED, - wimp_BUTTON_DOUBLE_CLICK_DRAG << wimp_ICON_BUTTON_TYPE_SHIFT, - wimpspriteop_AREA, - 1, - 1, - {""}, - 0, - {} -}; - /* The hotlist window, toolbar and plot origins */ @@ -88,27 +49,13 @@ struct node *dialog_entry_node; void ro_gui_hotlist_initialise(void) { FILE *fp; - const char *title; - os_error *error; struct node *node; struct url_content *data; - /* Create our window - */ - title = messages_get("Hotlist"); - hotlist_window_definition.title_data.indirected_text.text = - strdup(title); - hotlist_window_definition.title_data.indirected_text.validation = - (char *) -1; - hotlist_window_definition.title_data.indirected_text.size = - strlen(title); - error = xwimp_create_window(&hotlist_window_definition, - &hotlist_window); - if (error) { - LOG(("xwimp_create_window: 0x%x: %s", - error->errnum, error->errmess)); - die(error->errmess); - } + /* create our window */ + hotlist_window = ro_gui_dialog_create("tree"); + ro_gui_set_window_title(hotlist_window, + messages_get("Hotlist")); ro_gui_wimp_event_register_redraw_window(hotlist_window, ro_gui_tree_redraw); ro_gui_wimp_event_register_open_window(hotlist_window, -- cgit v1.2.3