23#include <oslib/wimp.h>
24#include <oslib/help.h>
25#include <oslib/taskmanager.h>
91 char message_token[32];
93 wimp_selection menu_tree;
94 help_full_message_request *message_data;
101 const char *auto_text;
109 if ((!message) || (message->action != message_HELP_REQUEST))
116 message_token[0] = 0x00;
117 message_data = (help_full_message_request *)message;
118 window = message_data->w;
119 icon = message_data->i;
123 if (auto_text != NULL) {
125 window, icon, &message_data->pos,
126 message_data->buttons);
128 if (auto_suffix == NULL)
129 sprintf(message_token,
"%s%i", auto_text, (
int)icon);
131 sprintf(message_token,
"%s%s", auto_text, auto_suffix);
132 }
else if (window == wimp_ICON_BAR)
133 sprintf(message_token,
"HelpIconbar");
136 sprintf(message_token,
137 (i >= 0) ?
"HelpTree%i" :
"HelpHotlist%i", i);
139 message->data.data_xfer.w)) {
141 sprintf(message_token,
142 (i >= 0) ?
"HelpTree%i" :
"HelpGHistory%i", i);
145 sprintf(message_token,
146 (i >= 0) ?
"HelpTree%i" :
"HelpCookies%i", i);
148 sprintf(message_token,
"HelpBrowser%i", (
int)icon);
151 if (message_token[0]) {
154 strcat(message_token,
"g");
156 (
char *)message_token);
162 if (icon == wimp_ICON_WINDOW)
166 error = xwimp_get_menu_state(wimp_GIVEN_WINDOW_AND_ICON,
167 &menu_tree, window, icon);
169 NSLOG(netsurf, INFO,
"xwimp_get_menu_state: 0x%x: %s",
170 error->errnum, error->errmess);
174 if (menu_tree.items[0] == -1)
179 sprintf(message_token,
"HelpIconMenu");
181 sprintf(message_token,
"HelpBrowserMenu");
183 sprintf(message_token,
"HelpHotlistMenu");
185 sprintf(message_token,
"HelpGHistoryMenu");
187 sprintf(message_token,
"HelpCookiesMenu");
194 while (menu_tree.items[index] != -1) {
195 greyed |= test_menu->entries[menu_tree.items[index]].icon_flags
197 test_menu = test_menu->entries[menu_tree.items[index]].sub_menu;
199 sprintf(menu_buffer,
"%i", menu_tree.items[index]);
201 sprintf(menu_buffer,
"-%i", menu_tree.items[index]);
202 strcat(message_token, menu_buffer);
206 strcat(message_token,
"g");
220 const char *translated_token;
221 help_full_message_reply *reply;
226 reply = (help_full_message_reply *)message;
227 reply->reply[0] =
'\0';
231 if (translated_token == token) {
233 if (token[strlen(token) - 1] !=
'g') {
235 char *base_token = token;
236 while (base_token[0] != 0x00) {
237 if ((base_token[0] ==
'-') ||
238 ((base_token[0] >=
'0') &&
239 (base_token[0] <=
'9')))
240 base_token[0] = 0x00;
249 if (translated_token != token) {
257 strncpy(reply->reply, translated_token, 235);
260 strncpy(reply->reply, local_token, 235);
263 reply->reply[235] =
'\0';
268 reply->action = message_HELP_REPLY;
269 reply->your_ref = reply->my_ref;
270 error = xwimp_send_message(wimp_USER_MESSAGE, (wimp_message *)reply,
273 NSLOG(netsurf, INFO,
"xwimp_send_message: 0x%x: %s",
274 error->errnum, error->errmess);
287 taskmanager_task task;
292 xos_read_monotonic_time(&time);
299 error = xtaskmanager_enumerate_tasks(context, &task,
300 sizeof(taskmanager_task), &context, 0);
303 "xtaskmanager_enumerate_tasks: 0x%x: %s",
310 if (!strncmp(task.name,
"Help", 4) &&
313 else if (!strncmp(task.name,
"Bubble Help", 11) &&
314 (task.name[11] < 32))
316 else if (!strncmp(task.name,
"Floating Help", 13) &&
317 (task.name[13] < 32))
319 }
while (context >= 0);
338 help_start = getenv(
"Help$Start");
339 if ((help_start) && (help_start[0])) {
340 error = xwimp_start_task(
"<Help$Start>", &task);
342 NSLOG(netsurf, INFO,
"xwimp_start_tast: 0x%x: %s",
343 error->errnum, error->errmess);
351 error = xwimp_start_task(
"Resources:$.Apps.!Help", &task);
353 NSLOG(netsurf, INFO,
"xwimp_start_tast: 0x%x: %s",
354 error->errnum, error->errmess);
362 error = xos_read_monotonic_time(&
help_time);
365 "xwimp_read_monotonic_time: 0x%x: %s",
nserror
Enumeration of error codes.
@ NSERROR_BAD_ENCODING
The character set is unknown.
nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
bool ro_gui_global_history_check_menu(wimp_menu *menu)
check if menu handle is for the global history menu
bool ro_gui_global_history_check_window(wimp_w wh)
check if window handle is for the global history window
RISc OS global history interface.
bool ro_gui_hotlist_check_window(wimp_w wh)
bool ro_gui_hotlist_check_menu(wimp_menu *menu)
Browser window handling (interface).
bool ro_gui_iconbar_check_menu(wimp_menu *menu)
Check if a particular menu handle is the iconbar menu.
Iconbar icon and menus (interface).
Core mouse and pointer states.
Interface to platform-specific graphical user interface window operations.
#define NSLOG(catname, level, logmsg, args...)
const char * messages_get(const char *key)
Fast lookup of a message by key from the standard Messages hash.
Localised message support (interface).
bool ro_gui_cookies_check_window(wimp_w wh)
check if window handle is for the cookies window
bool ro_gui_cookies_check_menu(wimp_menu *menu)
check if menu handle is for the cookies menu
Interface to riscos cookie viewing using riscos core window.
nserror ro_warn_user(const char *warning, const char *detail)
Display a warning for a serious problem (eg memory exhaustion).
bool ro_gui_interactive_help_available(void)
Checks if interactive help is running.
void ro_gui_interactive_help_start(void)
Launches interactive help.
void ro_gui_interactive_help_request(wimp_message *message)
Attempts to process an interactive help message request.
static void ro_gui_interactive_help_broadcast(wimp_message *message, char *token)
Broadcasts a help reply.
Interactive help (interface).
bool ro_gui_window_check_menu(wimp_menu *menu)
Check if a particular menu handle is a browser window menu.
struct gui_window * ro_gui_window_lookup(wimp_w window)
Convert a RISC OS window handle to a gui_window.
UCS conversion tables (interface) This is only used if nothing claims Service_International,...
Option reading and saving interface.
#define nsoption_bool(OPTION)
Get the value of a boolean option.
UTF-8 manipulation functions (interface).
bool ro_gui_get_icon_shaded_state(wimp_w w, wimp_i i)
Gets the shaded state of an icon.
General RISC OS WIMP/OS library functions (interface).
const char * ro_gui_wimp_event_get_help_prefix(wimp_w w)
Get the associated help prefix.
const char * ro_gui_wimp_event_get_help_suffix(wimp_w w, wimp_i i, os_coord *pos, wimp_mouse_state buttons)
Get the associated help suffix.
Automated RISC OS WIMP event handling (interface).