diff options
author | Richard Wilson <rjw@netsurf-browser.org> | 2004-07-21 20:02:13 +0000 |
---|---|---|
committer | Richard Wilson <rjw@netsurf-browser.org> | 2004-07-21 20:02:13 +0000 |
commit | d89753a11ba1125efb23079eae3372f8812ff442 (patch) | |
tree | 28556a5509def83540ee9763aa763b70dc789cab | |
parent | 0383834501d86df607f632d856bf757ac6dac172 (diff) | |
download | netsurf-d89753a11ba1125efb23079eae3372f8812ff442.tar.gz netsurf-d89753a11ba1125efb23079eae3372f8812ff442.tar.bz2 |
[project @ 2004-07-21 20:02:13 by rjw]
Less compiler warnings. Fixed create_folder window title indirection from being too small. Support for help keys for greyed out menu items/icons.
svn path=/import/netsurf/; revision=1135
-rw-r--r-- | !NetSurf/Resources/en/Messages | 13 | ||||
-rw-r--r-- | !NetSurf/Resources/en/Templates,fec | bin | 7141 -> 7144 bytes | |||
-rw-r--r-- | !NetSurf/Resources/fr/Messages | 13 | ||||
-rw-r--r-- | !NetSurf/Resources/fr/Templates,fec | bin | 7220 -> 7223 bytes | |||
-rw-r--r-- | riscos/help.c | 63 | ||||
-rw-r--r-- | riscos/menus.c | 18 | ||||
-rw-r--r-- | riscos/toolbar.c | 2 | ||||
-rw-r--r-- | riscos/wimp.c | 17 | ||||
-rw-r--r-- | riscos/wimp.h | 6 |
9 files changed, 104 insertions, 28 deletions
diff --git a/!NetSurf/Resources/en/Messages b/!NetSurf/Resources/en/Messages index c23ba0af4..bad2e7391 100644 --- a/!NetSurf/Resources/en/Messages +++ b/!NetSurf/Resources/en/Messages @@ -264,10 +264,16 @@ HelpBrowserMenu3-2-0:\Stoggle the display of the toolbar buttons.|MURL bar uses HelpBrowserMenu3-2-1:\Stoggle the display of the address (URL) bar. HelpBrowserMenu3-2-2:\Stoggle the display of the throbber.|MURL bar uses the remaining space. HelpBrowserMenu3-2-3:\Stoggle the display of the status bar.|MHorizontal scroll bar uses the remaining width. -HelpBrowserMenu3-3:\Smake your local display options the default options for NetSurf. +HelpBrowserMenu3-3:\Scontrol the manner the display is rendered. +HelpBrowserMenu3-3-0:\Stoggle whether text is blended to the background. +HelpBrowserMenu3-3-1:\Stoggle whether animations are not displayed until all calculations are complete. +HelpBrowserMenu3-3-2:\Stoggle whether everything is not displayed until all calculations are complete. +HelpBrowserMenu3-4:\Smake your local display options the default options for NetSurf. HelpBrowserMenu4:\Rto access NetSurf's built in utilities.|MUtilities are tools such as the hotlist, history tree and setup options. HelpBrowserMenu4-1:\Rcontrol the default window positioning. HelpBrowserMenu4-1-0:\Sto make the current window position the default. +HelpBrowserMenu4-1-1:\Sto toggle whether subsequent windows are staggered down the screen. +HelpBrowserMenu4-1-2:\Sto toggle whether child windows are opened at the size of the parent. HelpBrowserMenu4-1-3:\Sto return to the default window positioning. HelpBrowserMenu5:\Rsee the help resources available. HelpBrowserMenu5-0:\Sopen the documentation contents page in a new \w. @@ -330,7 +336,10 @@ HelpHotlistMenu0-4-0:\Sclose all directories and hide all entry details. HelpHotlistMenu0-4-1:\Sclose all directories. HelpHotlistMenu0-4-2:\Shide all entry details. HelpHotlistMenu1:\Roperate on the current selection. -#HelpHotlistMenu1-0:\Rsave the current selection. +HelpHotlistMenu1-0:\Rsave the current selection. +HelpHotlistMenu1-0-0:\Rto save the current address in Acorn URI format. +HelpHotlistMenu1-0-1:\Rto save the current address in Ant URL format. +HelpHotlistMenu1-0-2:\Rto save the current selection as HTML. HelpHotlistMenu1-1:\Redit the current item. HelpHotlistMenu1-2:\Slaunch the current selection. HelpHotlistMenu1-3:\Sdelete the current selection from the hotlist. diff --git a/!NetSurf/Resources/en/Templates,fec b/!NetSurf/Resources/en/Templates,fec Binary files differindex f93850f5f..50b848552 100644 --- a/!NetSurf/Resources/en/Templates,fec +++ b/!NetSurf/Resources/en/Templates,fec diff --git a/!NetSurf/Resources/fr/Messages b/!NetSurf/Resources/fr/Messages index c7973f32f..73d325102 100644 --- a/!NetSurf/Resources/fr/Messages +++ b/!NetSurf/Resources/fr/Messages @@ -264,10 +264,16 @@ HelpBrowserMenu3-2-0:\Stoggle the display of the toolbar buttons.|MURL bar uses HelpBrowserMenu3-2-1:\Stoggle the display of the address (URL) bar. HelpBrowserMenu3-2-2:\Stoggle the display of the throbber.|MURL bar uses the remaining space. HelpBrowserMenu3-2-3:\Stoggle the display of the status bar.|MHorizontal scroll bar uses the remaining width. -HelpBrowserMenu3-3:\Smake your local display options the default options for NetSurf. +HelpBrowserMenu3-3:\Scontrol the manner the display is rendered. +HelpBrowserMenu3-3-0:\Stoggle whether text is blended to the background. +HelpBrowserMenu3-3-1:\Stoggle whether animations are not displayed until all calculations are complete. +HelpBrowserMenu3-3-2:\Stoggle whether everything is not displayed until all calculations are complete. +HelpBrowserMenu3-4:\Smake your local display options the default options for NetSurf. HelpBrowserMenu4:\Rto access NetSurf's built in utilities.|MUtilities are tools such as the hotlist, history tree and setup options. HelpBrowserMenu4-1:\Rcontrol the default window positioning. HelpBrowserMenu4-1-0:\Sto make the current window position the default. +HelpBrowserMenu4-1-1:\Sto toggle whether subsequent windows are staggered down the screen. +HelpBrowserMenu4-1-2:\Sto toggle whether child windows are opened at the size of the parent. HelpBrowserMenu4-1-3:\Sto return to the default window positioning. HelpBrowserMenu5:\Rsee the help resources available. HelpBrowserMenu5-0:\Sopen the documentation contents page in a new \w. @@ -330,7 +336,10 @@ HelpHotlistMenu0-4-0:\Sclose all directories and hide all entry details. HelpHotlistMenu0-4-1:\Sclose all directories. HelpHotlistMenu0-4-2:\Shide all entry details. HelpHotlistMenu1:\Roperate on the current selection. -#HelpHotlistMenu1-0:\Rsave the current selection. +HelpHotlistMenu1-0:\Rsave the current selection. +HelpHotlistMenu1-0-0:\Rto save the current address in Acorn URI format. +HelpHotlistMenu1-0-1:\Rto save the current address in Ant URL format. +HelpHotlistMenu1-0-2:\Rto save the current selection as HTML. HelpHotlistMenu1-1:\Redit the current item. HelpHotlistMenu1-2:\Slaunch the current selection. HelpHotlistMenu1-3:\Sdelete the current selection from the hotlist. diff --git a/!NetSurf/Resources/fr/Templates,fec b/!NetSurf/Resources/fr/Templates,fec Binary files differindex de6d1115b..072b6f328 100644 --- a/!NetSurf/Resources/fr/Templates,fec +++ b/!NetSurf/Resources/fr/Templates,fec diff --git a/riscos/help.c b/riscos/help.c index 2aa4bf7a6..d247f51b4 100644 --- a/riscos/help.c +++ b/riscos/help.c @@ -19,6 +19,7 @@ #include "netsurf/riscos/gui.h" #include "netsurf/riscos/help.h" #include "netsurf/riscos/toolbar.h" +#include "netsurf/riscos/wimp.h" #include "netsurf/utils/messages.h" #include "netsurf/utils/log.h" @@ -50,6 +51,10 @@ of numbers representing the menu structure (eg 'HelpBrowserMenu3-1-2'). If '<key><identifier>' is not available, then simply '<key>' is then used. For example if 'HelpToolbar7' is not available then 'HelpToolbar' is then tried. + + If an item is greyed out then a suffix of 'g' is added (eg 'HelpToolbar7g'). For this to + work, windows must have bit 4 of the window flag byte set and the user must be running + RISC OS 5.03 or greater. For items marked with an asterisk [*] a call must be made to determine the required help text as the window does not contain any icons. An example of this is the hotlist @@ -73,6 +78,8 @@ void ro_gui_interactive_help_request(wimp_message *message) { wimp_i icon; struct gui_window *g; unsigned int index; + bool greyed = false; + wimp_menu *test_menu; /* Ensure we have a help request */ @@ -130,6 +137,14 @@ void ro_gui_interactive_help_request(wimp_message *message) { /* If we've managed to find something so far then we broadcast it */ if (message_token[0] != 0x00) { + /* Check to see if we are greyed out + */ + if ((icon >= 0) && (ro_gui_get_icon_shaded_state(window, icon))) { + strcat(message_token, "g"); + } + + /* Broadcast out message + */ ro_gui_interactive_help_broadcast(message, &message_token[0]); return; } @@ -162,7 +177,15 @@ void ro_gui_interactive_help_request(wimp_message *message) { /* Decode the menu */ index = 0; + test_menu = current_menu; while (menu_tree.items[index] != -1) { + /* Check if we're greyed out + */ + greyed |= test_menu->entries[menu_tree.items[index]].icon_flags & wimp_ICON_SHADED; + test_menu = test_menu->entries[menu_tree.items[index]].sub_menu; + + /* Continue adding the entries + */ if (index == 0) { sprintf(menu_buffer, "%i", menu_tree.items[index]); } else { @@ -171,6 +194,7 @@ void ro_gui_interactive_help_request(wimp_message *message) { strcat(message_token, menu_buffer); index++; } + if (greyed) strcat(message_token, "g"); /* Finally, broadcast the menu help */ @@ -185,31 +209,36 @@ void ro_gui_interactive_help_request(wimp_message *message) { * \param token the token to look up */ static void ro_gui_interactive_help_broadcast(wimp_message *message, char *token) { - char *translated_token; + const char *translated_token; help_full_message_reply *reply; + char *base_token; /* Check if the message exists */ - translated_token = (char *)messages_get(token); + translated_token = messages_get(token); if (translated_token == token) { - char *base_token; - - /* Find the key from the token. + /* We must never provide default help for a 'g' suffix. */ - base_token = translated_token; - while (base_token[0] != 0x00) { - if ((base_token[0] == '-') || - ((base_token[0] >= '0') && (base_token[0] <= '9'))) { - base_token[0] = 0x00; - } else { - ++base_token; + if (token[strlen(token) - 1] == 'g') { + token[0] = '\0'; + } else { + /* Find the key from the token. + */ + base_token = token; + while (base_token[0] != 0x00) { + if ((base_token[0] == '-') || + ((base_token[0] >= '0') && (base_token[0] <= '9'))) { + base_token[0] = 0x00; + } else { + ++base_token; + } } - } - /* Check if the base key exists - */ - translated_token = (char *)messages_get(token); - if (translated_token == token) return; + /* Check if the base key exists and use an empty string if not + */ + translated_token = messages_get(token); + if (translated_token == token) token[0] = '\0'; + } } /* Copy our message string diff --git a/riscos/menus.c b/riscos/menus.c index 0ac547a65..535fe22a3 100644 --- a/riscos/menus.c +++ b/riscos/menus.c @@ -333,13 +333,12 @@ static wimp_MENU(3) hotlist_collapse = { }; -static wimp_MENU(4) hotlist_save = { +static wimp_MENU(3) hotlist_save = { { "SaveSelect" }, 7,2,7,0, 200, 44, 0, { { wimp_MENU_GIVE_WARNING, (wimp_menu*)1, DEFAULT_FLAGS, { "URI" } }, { wimp_MENU_GIVE_WARNING, (wimp_menu*)1, DEFAULT_FLAGS, { "URL" } }, - { wimp_MENU_GIVE_WARNING, (wimp_menu*)1, DEFAULT_FLAGS, { "HTML" } }, - { wimp_MENU_LAST | wimp_MENU_GIVE_WARNING, (wimp_menu*)1, DEFAULT_FLAGS, { "LinkText" } } + { wimp_MENU_LAST | wimp_MENU_GIVE_WARNING, (wimp_menu*)1, DEFAULT_FLAGS, { "HTML" } }, } }; @@ -1133,6 +1132,19 @@ void ro_gui_menu_hotlist_warning(wimp_message_menu_warning *warning) warning->pos.x, warning->pos.y); break; case 0: /* Save-> */ + switch (warning->selection.items[2]) { + case -1: /* No sub-menu */ + ro_gui_menu_prepare_hotlist(); + error = xwimp_create_sub_menu(hotlist_save_menu, + warning->pos.x, warning->pos.y); + break; + case 1: /* URI */ + break; + case 2: /* URL */ + break; + case 3: /* HTML */ + break; + } break; case 1: /* Edit-> */ hotlist_insert = true; diff --git a/riscos/toolbar.c b/riscos/toolbar.c index ba922e453..3b2edddc6 100644 --- a/riscos/toolbar.c +++ b/riscos/toolbar.c @@ -62,7 +62,7 @@ static wimp_window empty_window = { wimp_COLOUR_DARK_GREY, wimp_COLOUR_MID_LIGHT_GREY, wimp_COLOUR_CREAM, - wimp_WINDOW_NEVER3D, + wimp_WINDOW_NEVER3D | 0x16u /* RISC OS 5.03+ - greyed icons detected for interactive help */, {0, 0, 16384, 16384}, 0, 0, diff --git a/riscos/wimp.c b/riscos/wimp.c index 03d78a2ff..fcb5bcd9f 100644 --- a/riscos/wimp.c +++ b/riscos/wimp.c @@ -223,7 +223,7 @@ void ro_gui_set_icon_integer(wimp_w w, wimp_i i, int value) { * \param w window handle * \param i icon handle */ -int ro_gui_get_icon_selected_state(wimp_w w, wimp_i i) { +bool ro_gui_get_icon_selected_state(wimp_w w, wimp_i i) { wimp_icon_state ic; ic.w = w; ic.i = i; @@ -243,6 +243,21 @@ int ro_gui_get_icon_selected_state(wimp_w w, wimp_i i) { /** + * Gets the shaded state of an icon. + * + * \param w window handle + * \param i icon handle + */ +bool ro_gui_get_icon_shaded_state(wimp_w w, wimp_i i) { + wimp_icon_state ic; + ic.w = w; + ic.i = i; + xwimp_get_icon_state(&ic); + return (ic.icon.flags & wimp_ICON_SHADED) != 0; +} + + +/** * Set a window title (does *not* redraw the title) * * \param w window handle diff --git a/riscos/wimp.h b/riscos/wimp.h index 6ba7ecf76..daa386e15 100644 --- a/riscos/wimp.h +++ b/riscos/wimp.h @@ -14,9 +14,10 @@ #define _NETSURF_RISCOS_WIMP_H_ #include <assert.h> -#include <string.h> +#include <stdbool.h> #include <stdlib.h> #include <stdio.h> +#include <string.h> #include "oslib/os.h" #include "oslib/wimp.h" @@ -37,8 +38,9 @@ char *ro_gui_get_icon_string(wimp_w w, wimp_i i); void ro_gui_set_icon_string(wimp_w w, wimp_i i, const char *text); void ro_gui_set_icon_integer(wimp_w w, wimp_i i, int value); #define ro_gui_set_icon_selected_state(w, i, state) xwimp_set_icon_state(w, i, (state ? wimp_ICON_SELECTED : 0), wimp_ICON_SELECTED) -int ro_gui_get_icon_selected_state(wimp_w w, wimp_i i); +bool ro_gui_get_icon_selected_state(wimp_w w, wimp_i i); #define ro_gui_set_icon_shaded_state(w, i, state) xwimp_set_icon_state(w, i, (state ? wimp_ICON_SHADED : 0), wimp_ICON_SHADED) +bool ro_gui_get_icon_shaded_state(wimp_w w, wimp_i i); void ro_gui_set_window_title(wimp_w w, const char *title); void ro_gui_set_caret_first(wimp_w w); void ro_gui_open_window_centre(wimp_w parent, wimp_w child); |