NetSurf
hotlist.c
Go to the documentation of this file.
1/*
2 * Copyright 2010, 2013 Stephen Fryatt <stevef@netsurf-browser.org>
3 * Copyright 2016 Vincent Sanders <vince@netsurf-browser.org>
4 *
5 * This file is part of NetSurf, http://www.netsurf-browser.org/
6 *
7 * NetSurf is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * NetSurf is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20/**
21 * \file
22 * Implementation of RISC OS hotlist manager.
23 */
24
25#include <stdint.h>
26#include <stdlib.h>
27#include <oslib/osmodule.h>
28#include <oslib/wimp.h>
29
30#include "utils/log.h"
31#include "utils/messages.h"
32#include "utils/nsoption.h"
33#include "utils/nsurl.h"
34#include "netsurf/url_db.h"
35#include "netsurf/window.h"
36#include "netsurf/plotters.h"
37#include "netsurf/keypress.h"
38#include "desktop/hotlist.h"
39
40#include "riscos/gui.h"
41#include "riscos/dialog.h"
42#include "riscos/message.h"
43#include "riscos/save.h"
44#include "riscos/toolbar.h"
45#include "riscos/wimp.h"
46#include "riscos/wimp_event.h"
47#include "riscos/query.h"
48#include "riscos/menus.h"
49#include "riscos/corewindow.h"
50#include "riscos/hotlist.h"
51
52/**
53 * Hotlist window container for RISC OS.
54 */
57 wimp_menu *menu;
58};
59
60/** hotlist window singleton */
61static struct ro_hotlist_window *hotlist_window = NULL;
62
63/** riscos template for hotlist window */
64static wimp_window *dialog_hotlist_template;
65
66/** Hotlist Query Handler. */
69
70/**
71 * URL adding hotlist protocol message block.
72 *
73 * Message block is not currently in OSLib.
74 */
76 wimp_MESSAGE_HEADER_MEMBERS /**< The standard message header. */
77 char *url; /**< Pointer to the URL in RMA. */
78 char *title; /**< Pointer to the title in RMA. */
79 char appname[32]; /**< The application name. */
80};
81
82/**
83 * change hotlist protocol message block.
84 *
85 * Message block is not currently in OSLib.
86 */
88 wimp_MESSAGE_HEADER_MEMBERS /**< The standard message header. */
89};
90
91/** URL area claimed from RMA. */
92static char *hotlist_url = NULL;
93/** Title area claimed from RMA. */
94static char *hotlist_title = NULL;
95
96
97/**
98 * callback to draw on drawable area of ro hotlist window
99 *
100 * \param ro_cw The riscos core window structure.
101 * \param r The rectangle of the window that needs updating.
102 * \param originx The risc os plotter x origin.
103 * \param originy The risc os plotter y origin.
104 * \return NSERROR_OK on success otherwise apropriate error code
105 */
106static nserror
108 int originx,
109 int originy,
110 struct rect *r)
111{
112 struct redraw_context ctx = {
113 .interactive = true,
114 .background_images = true,
115 .plot = &ro_plotters
116 };
117
118 ro_plot_origin_x = originx;
119 ro_plot_origin_y = originy;
120 no_font_blending = true;
121 hotlist_redraw(0, 0, r, &ctx);
122 no_font_blending = false;
123
124 return NSERROR_OK;
125}
126
127
128/**
129 * callback for keypress on ro hotlist window
130 *
131 * \param ro_cw The ro core window structure.
132 * \param nskey The netsurf key code.
133 * \return NSERROR_OK if key processed,
134 * NSERROR_NOT_IMPLEMENTED if key not processed
135 * otherwise apropriate error code
136 */
137static nserror hotlist_key(struct ro_corewindow *ro_cw, uint32_t nskey)
138{
139 if (hotlist_keypress(nskey)) {
140 return NSERROR_OK;
141 }
143}
144
145
146/**
147 * callback for mouse event on ro hotlist window
148 *
149 * \param ro_cw The ro core window structure.
150 * \param mouse_state mouse state
151 * \param x location of event
152 * \param y location of event
153 * \return NSERROR_OK on sucess otherwise apropriate error code.
154 */
155static nserror
157 browser_mouse_state mouse_state,
158 int x, int y)
159{
160 hotlist_mouse_action(mouse_state, x, y);
161
162 return NSERROR_OK;
163}
164
165
166/**
167 * handle clicks in ro hotlist window toolbar.
168 *
169 * \param ro_cw The ro core window structure.
170 * \param action The button bar action.
171 * \return NSERROR_OK if config saved, otherwise apropriate error code
172 */
173static nserror
175{
176 switch (action) {
180 break;
181
183 hotlist_expand(false);
184 break;
185
187 hotlist_contract(false);
188 break;
189
191 hotlist_expand(true);
192 break;
193
195 hotlist_contract(true);
196 break;
197
200 break;
201
203 hotlist_add_folder(NULL, false, 0);
204 break;
205
206 default:
207 break;
208 }
209
210 return NSERROR_OK;
211}
212
213
214/**
215 * Handle updating state of buttons in ro core window toolbar.
216 *
217 * \param ro_cw The ro core window structure.
218 * \return NSERROR_OK if config saved, otherwise apropriate error code
219 */
221{
222 bool has_selection;
223
224 has_selection = hotlist_has_selection();
225
228 !has_selection);
229
232 !has_selection);
233
234 return NSERROR_OK;
235}
236
237
238/**
239 * callback for saving of toolbar state in ro hotlist window
240 *
241 * \param ro_cw The ro core window structure.
242 * \param config The new toolbar configuration.
243 * \return NSERROR_OK if config saved, otherwise apropriate error code
244 */
245static nserror hotlist_toolbar_save(struct ro_corewindow *ro_cw, char *config)
246{
247 nsoption_set_charp(toolbar_hotlist, config);
249
250 return NSERROR_OK;
251}
252
253
254/**
255 * Prepare the hotlist menu for display
256 *
257 * \param w The window owning the menu.
258 * \param i The icon owning the menu.
259 * \param menu The menu from which the selection was made.
260 * \param pointer The pointer shape
261 * \return true if action accepted; else false.
262 */
263static bool
264hotlist_menu_prepare(wimp_w w, wimp_i i, wimp_menu *menu, wimp_pointer *pointer)
265{
266 bool selection;
267 struct ro_hotlist_window *hotlistw;
268
270
271 if ((hotlistw == NULL) ||
272 (menu != hotlistw->menu)) {
273 return false;
274 }
275
277
280
282 NULL, NULL, NULL, NULL);
283
288
293
294 return true;
295}
296
297
298/**
299 * Handle submenu warnings for the hotlist menu
300 *
301 * \param w The window owning the menu.
302 * \param i The icon owning the menu.
303 * \param menu The menu to which the warning applies.
304 * \param selection The wimp menu selection data.
305 * \param action The selected menu action.
306 */
307static void
309 wimp_i i,
310 wimp_menu *menu,
311 wimp_selection *selection,
312 menu_action action)
313{
314 /* Do nothing */
315}
316
317
318/**
319 * Handle selections from the hotlist menu
320 *
321 * \param w The window owning the menu.
322 * \param i The icon owning the menu.
323 * \param menu The menu from which the selection was made.
324 * \param selection The wimp menu selection data.
325 * \param action The selected menu action.
326 * \return true if action accepted; else false.
327 */
328static bool
330 wimp_i i,
331 wimp_menu *menu,
332 wimp_selection *selection,
333 menu_action action)
334{
335 struct ro_hotlist_window *hotlistw;
336
338
339 if ((hotlistw == NULL) ||
340 (menu != hotlistw->menu)) {
341 return false;
342 }
343
344 switch (action) {
345 case HOTLIST_EXPORT:
347 return true;
348
349 case TREE_NEW_FOLDER:
350 hotlist_add_folder(NULL, false, 0);
351 return true;
352
353 case TREE_NEW_LINK:
354 hotlist_add_entry(NULL, NULL, false, 0);
355 return true;
356
357 case TREE_EXPAND_ALL:
358 hotlist_expand(false);
359 return true;
360
362 hotlist_expand(true);
363 return true;
364
366 hotlist_expand(false);
367 return true;
368
370 hotlist_contract(true);
371 return true;
372
374 hotlist_contract(true);
375 return true;
376
378 hotlist_contract(false);
379 return true;
380
383 return true;
384
387 return true;
388
392 return true;
393
394 case TREE_SELECT_ALL:
396 return true;
397
400 return true;
401
402 case TOOLBAR_BUTTONS:
405 return true;
406
407 case TOOLBAR_EDIT:
409 return true;
410
411 default:
412 return false;
413 }
414
415 return false;
416}
417
418
419/**
420 * Creates the window for the hotlist tree.
421 *
422 * \return NSERROR_OK on success else appropriate error code on faliure.
423 */
425{
426 os_error *error;
427 struct ro_hotlist_window *ncwin;
428 nserror res;
429 static const struct ns_menu hotlist_menu_def = {
430 "Hotlist", {
431 { "Hotlist", NO_ACTION, 0 },
432 { "Hotlist.New", NO_ACTION, 0 },
433 { "Hotlist.New.Folder", TREE_NEW_FOLDER, 0 },
434 { "Hotlist.New.Link", TREE_NEW_LINK, 0 },
435 { "_Hotlist.Export", HOTLIST_EXPORT, &dialog_saveas },
436 { "Hotlist.Expand", TREE_EXPAND_ALL, 0 },
437 { "Hotlist.Expand.All", TREE_EXPAND_ALL, 0 },
438 { "Hotlist.Expand.Folders", TREE_EXPAND_FOLDERS, 0 },
439 { "Hotlist.Expand.Links", TREE_EXPAND_LINKS, 0 },
440 { "Hotlist.Collapse", TREE_COLLAPSE_ALL, 0 },
441 { "Hotlist.Collapse.All", TREE_COLLAPSE_ALL, 0 },
442 { "Hotlist.Collapse.Folders", TREE_COLLAPSE_FOLDERS, 0 },
443 { "Hotlist.Collapse.Links", TREE_COLLAPSE_LINKS, 0 },
444 { "Hotlist.Toolbars", NO_ACTION, 0 },
445 { "_Hotlist.Toolbars.ToolButtons", TOOLBAR_BUTTONS, 0 },
446 { "Hotlist.Toolbars.EditToolbar", TOOLBAR_EDIT, 0 },
447 { "Selection", TREE_SELECTION, 0 },
448 { "Selection.Edit", TREE_SELECTION_EDIT, 0 },
449 { "Selection.Launch", TREE_SELECTION_LAUNCH, 0 },
450 { "Selection.Delete", TREE_SELECTION_DELETE, 0 },
451 { "SelectAll", TREE_SELECT_ALL, 0 },
452 { "Clear", TREE_CLEAR_SELECTION, 0 },
453 { NULL, 0, 0}
454 }
455 };
456
457 static const struct button_bar_buttons hotlist_toolbar_buttons[] = {
458 { "delete", TOOLBAR_BUTTON_DELETE, TOOLBAR_BUTTON_NONE, '0', "0" },
459 { "expand", TOOLBAR_BUTTON_EXPAND, TOOLBAR_BUTTON_COLLAPSE, '1', "1" },
460 { "open", TOOLBAR_BUTTON_OPEN, TOOLBAR_BUTTON_CLOSE, '2', "2" },
461 { "launch", TOOLBAR_BUTTON_LAUNCH, TOOLBAR_BUTTON_NONE, '3', "3" },
462 { "create", TOOLBAR_BUTTON_CREATE, TOOLBAR_BUTTON_NONE, '4', "4" },
463 { NULL, TOOLBAR_BUTTON_NONE, TOOLBAR_BUTTON_NONE, '\0', "" }
464 };
465
466 if (hotlist_window != NULL) {
467 return NSERROR_OK;
468 }
469
470 ncwin = calloc(1, sizeof(*ncwin));
471 if (ncwin == NULL) {
472 return NSERROR_NOMEM;
473 }
474
475 /* create window from template */
476 error = xwimp_create_window(dialog_hotlist_template, &ncwin->core.wh);
477 if (error) {
478 NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s",
479 error->errnum, error->errmess);
480 ro_warn_user("WimpError", error->errmess);
481 free(ncwin);
482 return NSERROR_NOMEM;
483 }
484
485 ro_gui_set_window_title(ncwin->core.wh, messages_get("Hotlist"));
486
487 /* Set up callback handlers */
488 ncwin->core.draw = hotlist_draw;
489 ncwin->core.key = hotlist_key;
490 ncwin->core.mouse = hotlist_mouse;
493 /* update is not valid untill hotlist manager is initialised */
494 ncwin->core.toolbar_update = NULL;
495
496 /* initialise core window */
497 res = ro_corewindow_init(&ncwin->core,
498 hotlist_toolbar_buttons,
499 nsoption_charp(toolbar_hotlist),
501 "HelpHotToolbar");
502 if (res != NSERROR_OK) {
503 free(ncwin);
504 return res;
505 }
506
507 res = hotlist_manager_init((struct core_window *)ncwin);
508 if (res != NSERROR_OK) {
509 free(ncwin);
510 return res;
511 }
512
513 /* setup toolbar update post hotlist manager initialisation */
516
517 /* Build the hotlist window menu. */
518 ncwin->menu = ro_gui_menu_define_menu(&hotlist_menu_def);
519
521 ncwin->menu, false, false);
528
529 /* memoise window so it can be re-presented when necessary
530 * instead of recreating every time.
531 */
532 hotlist_window = ncwin;
533
534 return NSERROR_OK;
535}
536
537
538/* exported interface documented in riscos/hotlist.h */
540{
541 nserror res;
542
543 /* deal with external hotlist handler */
544 if (nsoption_bool(external_hotlists) &&
545 (nsoption_charp(external_hotlist_app) != NULL) &&
546 (*nsoption_charp(external_hotlist_app) != '\0')) {
547 char command[2048];
548 os_error *error;
549
550 snprintf(command, sizeof(command), "Filer_Run %s",
551 nsoption_charp(external_hotlist_app));
552 error = xos_cli(command);
553
554 if (error == NULL) {
555 return NSERROR_OK;
556 }
557
558 NSLOG(netsurf, INFO, "xos_cli: 0x%x: %s", error->errnum,
559 error->errmess);
560 ro_warn_user("Failed to launch external hotlist: %s",
561 error->errmess);
562 }
563
564 res = ro_hotlist_init();
565 if (res == NSERROR_OK) {
566 NSLOG(netsurf, INFO, "Presenting");
569 600, 800);
570 } else {
571 NSLOG(netsurf, INFO, "Failed presenting code %d", res);
572 }
573
574 return res;
575}
576
577
578/* exported interface documented in riscos/hotlist.h */
580{
582}
583
584
585/* exported interface documented in riscos/hotlist.h */
587{
588 nserror res;
589
590 if (hotlist_window == NULL) {
591 return NSERROR_OK;
592 }
593
594 res = hotlist_fini();
595 if (res == NSERROR_OK) {
597
598 free(hotlist_window);
599 hotlist_window = NULL;
600 }
601
602 return res;
603}
604
605
606/* exported interface documented in riscos/hotlist.h */
608{
609 if ((hotlist_window != NULL) &&
610 (hotlist_window->core.wh == wh)) {
611 return true;
612 }
613 return false;
614}
615
616
617/* exported interface documented in riscos/hotlist.h */
618bool ro_gui_hotlist_check_menu(wimp_menu *menu)
619{
620 if ((hotlist_window != NULL) &&
621 (hotlist_window->menu == menu)) {
622 return true;
623 }
624 return false;
625}
626
627
628/**
629 * Callback to schedule for the next available Null poll, by which point
630 * a hotlist client will have claimed the Message_HotlistAddURL and any
631 * details in RMA can safely be discarded.
632 *
633 * \param p Unused data pointer.
634 */
636{
638}
639
640
641/**
642 * Handle bounced Message_HotlistAddURL, so that RMA storage can be freed.
643 *
644 * \param message The bounced message content.
645 */
646static void ro_gui_hotlist_addurl_bounce(wimp_message *message)
647{
648 if (hotlist_url != NULL) {
649 nsurl *nsurl;
650
652 return;
653
656 }
657
659
660 /* There's no longer any need to listen for the next Null poll. */
661
663}
664
665
666/* exported interface documented in riscos/hotlist.h */
668{
669 const struct url_data *data;
670 wimp_message message;
671 struct ro_hotlist_message_hotlist_addurl *add_url =
672 (struct ro_hotlist_message_hotlist_addurl *) &message;
673
674 if (url == NULL) {
675 return;
676 }
677
678 /* If we're not using external hotlists, add the page to NetSurf's
679 * own hotlist and return...
680 */
681 if (!nsoption_bool(external_hotlists)) {
683 return;
684 }
685
686 /* ...otherwise try broadcasting the details to any other
687 * interested parties. If no-one answers, we'll fall back to
688 * NetSurf's hotlist anyway when the message bounces.
689 */
690
692
693 data = urldb_get_url_data(url);
694 if (data == NULL)
695 return;
696
697 hotlist_url = osmodule_alloc(nsurl_length(url) + 1);
698 hotlist_title = osmodule_alloc(strlen(data->title) + 1);
699
700 if (hotlist_url == NULL || hotlist_title == NULL) {
702 return;
703 }
704
705 strcpy(hotlist_url, nsurl_access(url));
706 strcpy(hotlist_title, data->title);
707
708 add_url->size = 60;
709 add_url->your_ref = 0;
710 add_url->action = message_HOTLIST_ADD_URL;
711 add_url->url = hotlist_url;
712 add_url->title = hotlist_title;
713 strcpy(add_url->appname, "NetSurf");
714
715 if (!ro_message_send_message(wimp_USER_MESSAGE_RECORDED,
716 &message,
717 0,
720 }
721
722 /* Listen for the next Null poll, as an indication that the
723 * message didn't bounce.
724 */
726}
727
728
729/* exported interface documented in riscos/hotlist.h */
731{
732 if (hotlist_url != NULL) {
733 osmodule_free(hotlist_url);
734 hotlist_url = NULL;
735 }
736
737 if (hotlist_title != NULL) {
738 osmodule_free(hotlist_title);
739 hotlist_title = NULL;
740 }
741}
742
743
744/**
745 * Callback confirming a URL delete query.
746 *
747 * \param id The ID of the query calling us.
748 * \param res The user's response to the query.
749 * \param p Callback data (always NULL).
750 */
751static void
753{
756
758 hotlist_delete_url = NULL;
760}
761
762
763/**
764 * Callback cancelling a URL delete query.
765 *
766 * \param id The ID of the query calling us.
767 * \param res The user's response to the query.
768 * \param p Callback data (always NULL).
769 */
770static void
772{
774 hotlist_delete_url = NULL;
776}
777
778
779/**
780 * removal query dialog callbacks.
781 */
785};
786
787
788/* exported interface documented in riscos/hotlist.h */
790{
791 if ((url == NULL) ||
792 nsoption_bool(external_hotlists) ||
794 return;
795 }
796
797 /* Clean up any existing delete attempts before continuing. */
801 }
802
803 if (hotlist_delete_url != NULL) {
805 hotlist_delete_url = NULL;
806 }
807
808 /* Check with the user before removing the URL, unless they don't
809 * want us to be careful in which case just do it.
810 */
811 if (nsoption_bool(confirm_hotlist_remove)) {
812 hotlist_query = query_user("RemoveHotlist", NULL,
813 &remove_funcs, NULL,
814 messages_get("Remove"),
815 messages_get("DontRemove"));
816
818 } else {
821 }
822}
823
824
825/* exported interface documented in riscos/hotlist.h */
827{
828 if ((url == NULL) ||
829 nsoption_bool(external_hotlists)) {
830 return false;
831 }
832
833 return hotlist_has_url(url);
834}
menu_action
Definition: scaffolding.h:77
@ TREE_EXPAND_FOLDERS
Definition: scaffolding.h:157
@ TREE_EXPAND_ALL
Definition: scaffolding.h:156
@ TREE_COLLAPSE_FOLDERS
Definition: scaffolding.h:160
@ TREE_SELECTION
Definition: scaffolding.h:162
@ TREE_SELECTION_LAUNCH
Definition: scaffolding.h:164
@ TREE_NEW_FOLDER
Definition: scaffolding.h:154
@ TREE_SELECT_ALL
Definition: scaffolding.h:166
@ TREE_CLEAR_SELECTION
Definition: scaffolding.h:167
@ TREE_SELECTION_EDIT
Definition: scaffolding.h:163
@ TREE_EXPAND_LINKS
Definition: scaffolding.h:158
@ TOOLBAR_BUTTONS
Definition: scaffolding.h:170
@ HOTLIST_EXPORT
Definition: scaffolding.h:127
@ TREE_SELECTION_DELETE
Definition: scaffolding.h:165
@ TOOLBAR_EDIT
Definition: scaffolding.h:173
@ TREE_COLLAPSE_ALL
Definition: scaffolding.h:159
@ TREE_COLLAPSE_LINKS
Definition: scaffolding.h:161
@ TREE_NEW_LINK
Definition: scaffolding.h:155
button_bar_action
Definition: button_bar.h:32
@ TOOLBAR_BUTTON_NONE
Definition: button_bar.h:33
@ TOOLBAR_BUTTON_CLOSE
Definition: button_bar.h:57
@ TOOLBAR_BUTTON_LAUNCH
Definition: button_bar.h:58
@ TOOLBAR_BUTTON_DELETE
Definition: button_bar.h:53
@ TOOLBAR_BUTTON_COLLAPSE
Definition: button_bar.h:55
@ TOOLBAR_BUTTON_CREATE
Definition: button_bar.h:59
@ TOOLBAR_BUTTON_OPEN
Definition: button_bar.h:56
@ TOOLBAR_BUTTON_EXPAND
Definition: button_bar.h:54
bool hotlist_keypress(uint32_t key)
Key press handling.
Definition: hotlist.c:1697
bool hotlist_has_selection(void)
Determine whether there is a selection.
Definition: hotlist.c:1704
nserror hotlist_add_entry(nsurl *url, const char *title, bool at_y, int y)
Add an entry to the hotlist for given Title/URL.
Definition: hotlist.c:1623
void hotlist_mouse_action(browser_mouse_state mouse, int x, int y)
Handles all kinds of mouse action.
Definition: hotlist.c:1690
nserror hotlist_fini(void)
Finalise the hotlist.
Definition: hotlist.c:1387
nserror hotlist_add_url(nsurl *url)
Add an entry to the hotlist for given URL.
Definition: hotlist.c:1430
nserror hotlist_manager_init(void *core_window_handle)
Initialise the hotlist manager.
Definition: hotlist.c:1354
void hotlist_redraw(int x, int y, struct rect *clip, const struct redraw_context *ctx)
Redraw the hotlist.
Definition: hotlist.c:1682
nserror hotlist_add_folder(const char *title, bool at_y, int y)
Add a folder to the hotlist.
Definition: hotlist.c:1660
nserror hotlist_expand(bool only_folders)
Expand the treeview's nodes.
Definition: hotlist.c:1740
void hotlist_edit_selection(void)
Edit the first selected node.
Definition: hotlist.c:1733
bool hotlist_has_url(nsurl *url)
Check whether given URL is present in hotlist.
Definition: hotlist.c:1493
void hotlist_remove_url(nsurl *url)
Remove any entries matching the given URL from the hotlist.
Definition: hotlist.c:1535
nserror hotlist_contract(bool all)
Contract the treeview's nodes.
Definition: hotlist.c:1747
wimp_w dialog_saveas
Definition: dialog.c:75
void ro_gui_dialog_open_persistent(wimp_w parent, wimp_w w, bool pointer)
Open a persistent dialog box relative to the pointer.
Definition: dialog.c:591
wimp_window * ro_gui_dialog_load_template(const char *template_name)
Load a template without creating a window.
Definition: dialog.c:242
void ro_gui_save_options(void)
Save the current options.
Definition: dialog.c:670
bool ro_gui_dialog_open_top(wimp_w w, struct toolbar *toolbar, int width, int height)
Moves a window to the top of the stack.
Definition: dialog.c:413
nserror
Enumeration of error codes.
Definition: errors.h:29
@ NSERROR_NOT_IMPLEMENTED
Functionality is not implemented.
Definition: errors.h:61
@ NSERROR_NOMEM
Memory exhaustion.
Definition: errors.h:32
@ NSERROR_OK
No error.
Definition: errors.h:30
bool no_font_blending
Definition: font.c:48
static nserror hotlist_draw(struct ro_corewindow *ro_cw, int originx, int originy, struct rect *r)
callback to draw on drawable area of ro hotlist window
Definition: hotlist.c:107
static nserror hotlist_key(struct ro_corewindow *ro_cw, uint32_t nskey)
callback for keypress on ro hotlist window
Definition: hotlist.c:137
static char * hotlist_url
URL area claimed from RMA.
Definition: hotlist.c:92
bool ro_gui_hotlist_has_page(nsurl *url)
Report whether the hotlist contains a given URL.
Definition: hotlist.c:826
static void hotlist_menu_warning(wimp_w w, wimp_i i, wimp_menu *menu, wimp_selection *selection, menu_action action)
Handle submenu warnings for the hotlist menu.
Definition: hotlist.c:308
void ro_gui_hotlist_remove_page(nsurl *url)
Remove a URL from the hotlist.
Definition: hotlist.c:789
nserror ro_gui_hotlist_present(void)
make the cookie window visible.
Definition: hotlist.c:539
static nserror hotlist_toolbar_save(struct ro_corewindow *ro_cw, char *config)
callback for saving of toolbar state in ro hotlist window
Definition: hotlist.c:245
static void ro_gui_hotlist_scheduled_callback(void *p)
Callback to schedule for the next available Null poll, by which point a hotlist client will have clai...
Definition: hotlist.c:635
static void ro_gui_hotlist_addurl_bounce(wimp_message *message)
Handle bounced Message_HotlistAddURL, so that RMA storage can be freed.
Definition: hotlist.c:646
void ro_gui_hotlist_add_page(nsurl *url)
Add a URL to the hotlist.
Definition: hotlist.c:667
static query_id hotlist_query
Hotlist Query Handler.
Definition: hotlist.c:67
static struct ro_hotlist_window * hotlist_window
hotlist window singleton
Definition: hotlist.c:61
static nsurl * hotlist_delete_url
Definition: hotlist.c:68
static bool hotlist_menu_prepare(wimp_w w, wimp_i i, wimp_menu *menu, wimp_pointer *pointer)
Prepare the hotlist menu for display.
Definition: hotlist.c:264
bool ro_gui_hotlist_check_window(wimp_w wh)
Definition: hotlist.c:607
static nserror hotlist_toolbar_update(struct ro_corewindow *ro_cw)
Handle updating state of buttons in ro core window toolbar.
Definition: hotlist.c:220
static char * hotlist_title
Title area claimed from RMA.
Definition: hotlist.c:94
bool ro_gui_hotlist_check_menu(wimp_menu *menu)
Definition: hotlist.c:618
void ro_gui_hotlist_add_cleanup(void)
Clean up RMA storage used by the Message_HotlistAddURL protocol.
Definition: hotlist.c:730
static nserror ro_hotlist_init(void)
Creates the window for the hotlist tree.
Definition: hotlist.c:424
static const query_callback remove_funcs
removal query dialog callbacks.
Definition: hotlist.c:782
static nserror hotlist_toolbar_click(struct ro_corewindow *ro_cw, button_bar_action action)
handle clicks in ro hotlist window toolbar.
Definition: hotlist.c:174
void ro_gui_hotlist_initialise(void)
initialise the hotlist window template ready for subsequent use.
Definition: hotlist.c:579
static wimp_window * dialog_hotlist_template
riscos template for hotlist window
Definition: hotlist.c:64
static void ro_gui_hotlist_remove_cancelled(query_id id, enum query_response res, void *p)
Callback cancelling a URL delete query.
Definition: hotlist.c:771
static bool hotlist_menu_select(wimp_w w, wimp_i i, wimp_menu *menu, wimp_selection *selection, menu_action action)
Handle selections from the hotlist menu.
Definition: hotlist.c:329
nserror ro_gui_hotlist_finalise(void)
Free any resources allocated for the cookie window.
Definition: hotlist.c:586
static void ro_gui_hotlist_remove_confirmed(query_id id, enum query_response res, void *p)
Callback confirming a URL delete query.
Definition: hotlist.c:752
static nserror hotlist_mouse(struct ro_corewindow *ro_cw, browser_mouse_state mouse_state, int x, int y)
callback for mouse event on ro hotlist window
Definition: hotlist.c:156
Hotlist (interface).
#define message_HOTLIST_ADD_URL
Definition: hotlist.h:30
@ THEME_STYLE_HOTLIST_TOOLBAR
Definition: theme.h:34
#define NO_ACTION
Definition: idna.c:695
browser_mouse_state
Mouse state: 1 is primary mouse button.
Definition: mouse.h:52
Target independent plotting interface.
Interface to platform-specific graphical user interface window operations.
@ GUI_SAVE_HOTLIST_EXPORT_HTML
Definition: window.h:50
Interface to key press operations.
@ NS_KEY_CR
Definition: keypress.h:40
@ NS_KEY_SELECT_ALL
Definition: keypress.h:32
@ NS_KEY_CLEAR_SELECTION
Definition: keypress.h:45
@ NS_KEY_DELETE_LEFT
Definition: keypress.h:35
#define NSLOG(catname, level, logmsg, args...)
Definition: log.h:116
void ro_gui_menu_set_entry_ticked(wimp_menu *menu, menu_action action, bool ticked)
Sets an action within a menu as having a specific ticked status.
Definition: menus.c:831
void ro_gui_menu_set_entry_shaded(wimp_menu *menu, menu_action action, bool shaded)
Sets an action within a menu as having a specific ticked status.
Definition: menus.c:804
wimp_menu * ro_gui_menu_define_menu(const struct ns_menu *menu)
Creates a wimp_menu and adds it to the list to handle actions for.
Definition: menus.c:510
bool ro_message_send_message(wimp_event_no event, wimp_message *message, wimp_t task, void(*callback)(wimp_message *message))
Sends a message and registers a return route for a bounce.
Definition: message.c:57
Automated RISC OS message routing (interface).
const char * messages_get(const char *key)
Fast lookup of a message by key from the standard Messages hash.
Definition: messages.c:241
Localised message support (interface).
NetSurf URL handling (interface).
nserror nsurl_create(const char *const url_s, nsurl **url)
Create a NetSurf URL object from a URL string.
void nsurl_unref(nsurl *url)
Drop a reference to a NetSurf URL object.
const char * nsurl_access(const nsurl *url)
Access a NetSurf URL object as a string.
size_t nsurl_length(const nsurl *url)
Find the length of a NetSurf URL object's URL, as returned by nsurl_access.
nsurl * nsurl_ref(nsurl *url)
Increment the reference count to a NetSurf URL object.
struct nsurl nsurl
NetSurf URL object.
Definition: nsurl.h:31
void query_close(query_id id)
Close a query window without waiting for a response from the user.
Definition: query.c:293
query_id query_user(const char *query, const char *detail, const query_callback *cb, void *pw, const char *yes, const char *no)
Display a query to the user, requesting a response, near the current pointer position to keep the req...
Definition: query.c:112
query_response
Definition: query.h:25
#define QUERY_INVALID
Definition: query.h:34
int query_id
Definition: query.h:32
nserror ro_corewindow_fini(struct ro_corewindow *ro_cw)
finalise elements of ro core window.
Definition: corewindow.c:1078
nserror ro_corewindow_init(struct ro_corewindow *ro_cw, const struct button_bar_buttons *tb_buttons, char *tb_order, theme_style tb_style, const char *tb_help)
initialise elements of riscos core window.
Definition: corewindow.c:1003
RISC OS core window interface.
nserror ro_warn_user(const char *warning, const char *detail)
Display a warning for a serious problem (eg memory exhaustion).
Definition: gui.c:2077
int ro_plot_origin_x
Definition: plotters.c:40
nserror riscos_schedule(int t, void(*callback)(void *p), void *p)
Schedule a callback.
Definition: schedule.c:93
int ro_plot_origin_y
Definition: plotters.c:41
const struct plotter_table ro_plotters
RISC OS plotter operation table.
Definition: plotters.c:727
File/object/selection saving (Interface).
void ro_toolbar_set_display_buttons(struct toolbar *toolbar, bool display)
Set the display button bar state for a toolbar.
Definition: toolbar.c:1703
bool ro_toolbar_toggle_edit(struct toolbar *toolbar)
Toggle toolbar edit mode on the given toolbar.
Definition: toolbar.c:1780
void ro_toolbar_set_button_shaded_state(struct toolbar *toolbar, button_bar_action action, bool shaded)
Set the shaded state of a toolbar button.
Definition: toolbar.c:1586
void ro_toolbar_update_all_hotlists(void)
Update the state of the URL Bar hotlist icons in all open toolbars.
Definition: toolbar.c:1630
bool ro_toolbar_get_display_buttons(struct toolbar *toolbar)
Return true or false depending on whether the given toolbar is set to display the button bar.
Definition: toolbar.c:1745
Window toolbars (interface).
#define ro_toolbar_menu_edit_tick(toolbar)
Definition: toolbar.h:97
#define ro_toolbar_menu_option_shade(toolbar)
Definition: toolbar.h:82
#define ro_toolbar_menu_buttons_tick(toolbar)
Definition: toolbar.h:85
#define ro_toolbar_menu_edit_shade(toolbar)
Definition: toolbar.h:95
void ro_gui_save_prepare(gui_save_type save_type, struct hlcache_handle *h, char *s, const nsurl *url, const char *title)
Prepares the save box to reflect gui_save_type and a content, and opens it.
Definition: save.c:437
Definition: menus.h:159
Rectangle coordinates.
Definition: types.h:40
Redraw context.
Definition: plotters.h:51
bool interactive
Redraw to show interactive features.
Definition: plotters.h:59
ro core window state
Definition: corewindow.h:39
nserror(* toolbar_click)(struct ro_corewindow *ro_cw, button_bar_action action)
callback for clicks in ro core window toolbar.
Definition: corewindow.h:98
nserror(* mouse)(struct ro_corewindow *ro_cw, browser_mouse_state mouse_state, int x, int y)
callback for mouse event on ro core window
Definition: corewindow.h:89
nserror(* toolbar_save)(struct ro_corewindow *ro_cw, char *config)
callback for saving ro core window toolbar state.
Definition: corewindow.h:115
wimp_w wh
window handle
Definition: corewindow.h:41
nserror(* key)(struct ro_corewindow *ro_cw, uint32_t nskey)
callback for keypress on ro core window
Definition: corewindow.h:78
nserror(* draw)(struct ro_corewindow *ro_cw, int originx, int originy, struct rect *r)
callback to draw on drawable area of ro core window
Definition: corewindow.h:67
nserror(* toolbar_update)(struct ro_corewindow *ro_cw)
callback for updating state of buttons in ro core window toolbar.
Definition: corewindow.h:106
struct toolbar * toolbar
toolbar
Definition: corewindow.h:44
URL adding hotlist protocol message block.
Definition: hotlist.c:75
char * title
Pointer to the title in RMA.
Definition: hotlist.c:78
wimp_MESSAGE_HEADER_MEMBERS char * url
< The standard message header.
Definition: hotlist.c:77
char appname[32]
The application name.
Definition: hotlist.c:79
change hotlist protocol message block.
Definition: hotlist.c:87
Hotlist window container for RISC OS.
Definition: hotlist.c:55
struct ro_corewindow core
Definition: hotlist.c:56
wimp_menu * menu
Definition: hotlist.c:57
const char * title
Resource title.
Definition: url_db.h:37
Unified URL information database public interface.
const struct url_data * urldb_get_url_data(struct nsurl *url)
Find data for an URL.
Definition: urldb.c:3309
Option reading and saving interface.
#define nsoption_charp(OPTION)
Get the value of a string option.
Definition: nsoption.h:331
#define nsoption_set_charp(OPTION, VALUE)
set string option in default table
Definition: nsoption.h:372
#define nsoption_bool(OPTION)
Get the value of a boolean option.
Definition: nsoption.h:304
void ro_gui_set_window_title(wimp_w w, const char *text)
Set a window title.
Definition: wimp.c:675
General RISC OS WIMP/OS library functions (interface).
void * ro_gui_wimp_event_get_user_data(wimp_w w)
Gets the user data associated with a window.
Definition: wimp_event.c:486
bool ro_gui_wimp_event_register_menu_selection(wimp_w w, bool(*callback)(wimp_w w, wimp_i i, wimp_menu *m, wimp_selection *s, menu_action a))
Register a function to be called following a menu selection.
Definition: wimp_event.c:1581
bool ro_gui_wimp_event_register_menu_prepare(wimp_w w, bool(*callback)(wimp_w w, wimp_i i, wimp_menu *m, wimp_pointer *p))
Register a function to be called before a menu is (re-)opened.
Definition: wimp_event.c:1559
bool ro_gui_wimp_event_register_menu_warning(wimp_w w, void(*callback)(wimp_w w, wimp_i i, wimp_menu *m, wimp_selection *s, menu_action a))
Register a function to be called when a sub-menu warning is received.
Definition: wimp_event.c:1603
bool ro_gui_wimp_event_register_menu(wimp_w w, wimp_menu *m, bool menu_auto, bool position_ibar)
Register a window menu to be (semi-)automatically handled.
Definition: wimp_event.c:1270
Automated RISC OS WIMP event handling (interface).