NetSurf
hotlist.c
Go to the documentation of this file.
1/*
2 * Copyright 2008, 2009, 2017 Chris Young <chris@unsatisfactorysoftware.co.uk>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/**
20 * \file
21 * Implementation of Amiga hotlist viewer using core windows.
22 */
23
24#include <stdint.h>
25#include <stdlib.h>
26#include <stdbool.h>
27#include <string.h>
28
29#include <proto/asl.h>
30#include <proto/dos.h>
31#include <proto/intuition.h>
32
33#include <classes/window.h>
34#include <gadgets/layout.h>
35#include <gadgets/space.h>
36
37#include <reaction/reaction_macros.h>
38
39#include "desktop/hotlist.h"
41#include "netsurf/keypress.h"
42#include "netsurf/plotters.h"
43#include "utils/log.h"
44#include "utils/messages.h"
45#include "utils/nsoption.h"
46
47#include "amiga/corewindow.h"
48#include "amiga/drag.h"
49#include "amiga/file.h"
50#include "amiga/hotlist.h"
51#include "amiga/libs.h"
52#include "amiga/menu.h"
53#include "amiga/theme.h"
54#include "amiga/utf8.h"
55
56enum {
57 /* Project menu */
73 /* Edit menu */
84};
85
86/**
87 * Amiga hotlist viewer window context
88 */
90 /** Amiga core window context */
92
94 struct Menu *imenu; /* Intuition menu */
95};
96
97static struct ami_hotlist_window *hotlist_window = NULL;
98
100 void *userdata;
101 int level;
102 int item;
103 const char *folder; /* folder we're interested in */
104 bool in_menu; /* set if we are in that folder */
105 bool found; /* set if the folder is found */
106 bool (*cb)(void *userdata, int level, int item, const char *title, nsurl *url, bool folder);
107};
108
109/** hotlist scanner */
110static nserror ami_hotlist_folder_enter_cb(void *ctx, const char *title)
111{
112 struct ami_hotlist_ctx *menu_ctx = (struct ami_hotlist_ctx *)ctx;
113
114 if(menu_ctx->in_menu == true) {
115 if(menu_ctx->cb(menu_ctx->userdata, menu_ctx->level, menu_ctx->item, title, NULL, true) == true)
116 menu_ctx->item++;
117 } else {
118 if((menu_ctx->level == 0) && (strcmp(title, menu_ctx->folder) == 0)) {
119 menu_ctx->in_menu = true;
120 menu_ctx->found = true;
121 }
122 }
123 menu_ctx->level++;
124 return NSERROR_OK;
125}
126
127static nserror ami_hotlist_address_cb(void *ctx, nsurl *url, const char *title)
128{
129 struct ami_hotlist_ctx *menu_ctx = (struct ami_hotlist_ctx *)ctx;
130
131 if(menu_ctx->in_menu == true) {
132 if(menu_ctx->cb(menu_ctx->userdata, menu_ctx->level, menu_ctx->item, title, url, false) == true)
133 menu_ctx->item++;
134 }
135
136 return NSERROR_OK;
137}
138
140{
141 struct ami_hotlist_ctx *menu_ctx = (struct ami_hotlist_ctx *)ctx;
142
143 menu_ctx->level--;
144
145 if((menu_ctx->in_menu == true) && (menu_ctx->level == 0))
146 menu_ctx->in_menu = false;
147
148 return NSERROR_OK;
149}
150
151nserror ami_hotlist_scan(void *userdata, int first_item, const char *folder,
152 bool (*cb_add_item)(void *userdata, int level, int item, const char *title, nsurl *url, bool folder))
153{
154 nserror error;
155 struct ami_hotlist_ctx ctx;
156
157 ctx.level = 0;
158 ctx.item = first_item;
159 ctx.folder = folder;
160 ctx.in_menu = false;
161 ctx.userdata = userdata;
162 ctx.cb = cb_add_item;
163 ctx.found = false;
164
165 error = hotlist_iterate(&ctx,
169
170 if((error == NSERROR_OK) && (ctx.found == false))
171 hotlist_add_folder(folder, false, 0);
172
173 return error;
174}
175
176
177/**
178 * callback for mouse action for hotlist viewer on core window
179 *
180 * \param ami_cw The Amiga core window structure.
181 * \param mouse_state netsurf mouse state on event
182 * \param x location of event
183 * \param y location of event
184 * \return NSERROR_OK on success otherwise apropriate error code
185 */
186static nserror
188 browser_mouse_state mouse_state,
189 int x, int y)
190{
191 hotlist_mouse_action(mouse_state, x, y);
192
193 return NSERROR_OK;
194}
195
196/**
197 * callback for keypress for hotlist viewer on core window
198 *
199 * \param ami_cw The Amiga core window structure.
200 * \param nskey The netsurf key code
201 * \return NSERROR_OK on success otherwise apropriate error code
202 */
203static nserror
204ami_hotlist_key(struct ami_corewindow *ami_cw, uint32_t nskey)
205{
206 if (hotlist_keypress(nskey)) {
207 return NSERROR_OK;
208 }
210}
211
212/**
213 * callback on draw event for hotlist viewer on core window
214 *
215 * \param ami_cw The Amiga core window structure.
216 * \param x The x coordinate of hotlist area to redraw
217 * \param y The y coordinate of hotlist area to redraw
218 * \param r The rectangle of the window that needs updating.
219 * \param ctx The drawing context
220 * \return NSERROR_OK on success otherwise apropriate error code
221 */
222static nserror
224 int x, int y, struct rect *r, struct redraw_context *ctx)
225{
226 hotlist_redraw(x, y, r, ctx);
227
228 return NSERROR_OK;
229}
230
231/**
232 * callback for drag end on Amiga core window
233 * ie. a drag *from* this window has ended
234 *
235 * \param ami_cw The Amiga core window structure.
236 * \param x mouse x co-ordinate
237 * \param y mouse y co-ordinate
238 * \return NSERROR_OK on success otherwise apropriate error code
239 */
240static nserror
241ami_hotlist_drag_end(struct ami_corewindow *ami_cw, int x, int y)
242{
243 nsurl *url = NULL;
244 const char *title = NULL;
245 bool ok = false;
246 struct gui_window_2 *gwin;
247 struct ami_corewindow *cw;
248
250 ok = hotlist_get_selection(&url, &title);
251 }
252
253 if((ok == false) || (url == NULL)) {
254 ami_gui_beep();
255 } else if(url) {
256 if((gwin = ami_window_at_pointer(AMINS_WINDOW))) {
258 url,
259 NULL,
261 NULL,
262 NULL,
263 NULL);
264 } else if((cw = (struct ami_corewindow *)ami_window_at_pointer(AMINS_COREWINDOW)) &&
265 (ami_cw->icon_drop != NULL)) {
266 cw->icon_drop(cw, url, title, x, y);
267 }
268 }
269 return NSERROR_OK;
270}
271
272/**
273 * callback for icon drop on Amiga core window
274 * ie. a drag has ended *above* this window
275 * \todo this may not be very flexible but serves our current purposes
276 *
277 * \param ami_cw The Amiga core window structure.
278 * \param url url of dropped icon
279 * \param title title of dropped icon
280 * \param x mouse x co-ordinate
281 * \param y mouse y co-ordinate
282 * \return NSERROR_OK on success otherwise apropriate error code
283 */
284static nserror
285ami_hotlist_icon_drop(struct ami_corewindow *ami_cw, struct nsurl *url, const char *title, int x, int y)
286{
287 hotlist_add_entry(url, title, true, y);
288 return NSERROR_OK;
289}
290
291/**
292 * menu stuff
293 */
294
295static void
297{
298 SetAttrs(hotlist_win->core.objects[GID_CW_WIN],
299 WINDOW_MenuStrip, NULL,
300 TAG_DONE);
301
302 ami_menu_free_menu(hotlist_win->menu_data, AMI_HOTLIST_M_LAST, hotlist_win->imenu);
303}
304
305 /* menu hook functions */
306HOOKF(void, ami_hotlist_menu_item_project_export, APTR, window, struct IntuiMessage *)
307{
308 char fname[1024];
309 struct ami_corewindow *ami_cw;
310 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
311
312 if(AslRequestTags(savereq,
313 ASLFR_Window, ami_cw->win,
314 ASLFR_SleepWindow, TRUE,
315 ASLFR_TitleText, messages_get("NetSurf"),
316 ASLFR_Screen, ami_gui_get_screen(),
317 ASLFR_InitialFile, "hotlist.html",
318 TAG_DONE)) {
319 strlcpy(fname, savereq->fr_Drawer, 1024);
320 AddPart(fname, savereq->fr_File, 1024);
322 hotlist_export(fname, NULL);
324 }
325}
326
327HOOKF(void, ami_hotlist_menu_item_project_expand_all, APTR, window, struct IntuiMessage *)
328{
329 hotlist_expand(false);
330}
331
332HOOKF(void, ami_hotlist_menu_item_project_expand_folders, APTR, window, struct IntuiMessage *)
333{
334 hotlist_expand(true);
335}
336
337HOOKF(void, ami_hotlist_menu_item_project_expand_links, APTR, window, struct IntuiMessage *)
338{
339 hotlist_expand(false);
340}
341
342HOOKF(void, ami_hotlist_menu_item_project_collapse_all, APTR, window, struct IntuiMessage *)
343{
344 hotlist_contract(true);
345}
346
347HOOKF(void, ami_hotlist_menu_item_project_collapse_folders, APTR, window, struct IntuiMessage *)
348{
349 hotlist_contract(true);
350}
351
352HOOKF(void, ami_hotlist_menu_item_project_collapse_links, APTR, window, struct IntuiMessage *)
353{
354 hotlist_contract(false);
355}
356
357HOOKF(void, ami_hotlist_menu_item_project_snapshot, APTR, window, struct IntuiMessage *)
358{
359 struct ami_corewindow *ami_cw;
360 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
361
362 nsoption_set_int(hotlist_window_ypos, ami_cw->win->TopEdge);
363 nsoption_set_int(hotlist_window_xpos, ami_cw->win->LeftEdge);
364 nsoption_set_int(hotlist_window_xsize, ami_cw->win->Width);
365 nsoption_set_int(hotlist_window_ysize, ami_cw->win->Height);
366}
367
368HOOKF(void, ami_hotlist_menu_item_project_close, APTR, window, struct IntuiMessage *)
369{
370 struct ami_corewindow *ami_cw;
371 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
372
373 ami_cw->close_window = true;
374}
375
376HOOKF(void, ami_hotlist_menu_item_edit_newfolder, APTR, window, struct IntuiMessage *)
377{
378 hotlist_add_folder(NULL, false, 0);
379}
380
381HOOKF(void, ami_hotlist_menu_item_edit_newlink, APTR, window, struct IntuiMessage *)
382{
383 hotlist_add_entry(NULL, NULL, false, 0);
384}
385
386HOOKF(void, ami_hotlist_menu_item_edit_edit, APTR, window, struct IntuiMessage *)
387{
389}
390
391HOOKF(void, ami_hotlist_menu_item_edit_select_all, APTR, window, struct IntuiMessage *)
392{
394}
395
396HOOKF(void, ami_hotlist_menu_item_edit_clear, APTR, window, struct IntuiMessage *)
397{
399}
400
401HOOKF(void, ami_hotlist_menu_item_edit_delete, APTR, window, struct IntuiMessage *)
402{
404}
405
406
407/* menu setup */
408
409static void ami_hotlist_menulabs(struct ami_menu_data **md)
410{
411 ami_menu_alloc_item(md, AMI_HOTLIST_M_PROJECT, NM_TITLE, "Tree", NULL, NULL, NULL, NULL, 0);
412 ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPORT, NM_ITEM, "TreeExport", "S", "TBImages:list_save",
413 ami_hotlist_menu_item_project_export, NULL, 0);
414 ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_P1, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
415 ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPAND, NM_ITEM, "Expand", NULL, "TBImages:list_folderunfold", NULL, NULL, 0);
416 ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPAND_ALL, NM_SUB, "All", "+", NULL,
417 ami_hotlist_menu_item_project_expand_all, NULL, 0);
418 ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPAND_FOLDERS, NM_SUB, "Folders", NULL, NULL,
419 ami_hotlist_menu_item_project_expand_folders, NULL, 0);
420 ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPAND_LINKS, NM_SUB, "Links", NULL, NULL,
421 ami_hotlist_menu_item_project_expand_links, NULL, 0);
422 ami_menu_alloc_item(md, AMI_HOTLIST_M_COLLAPSE, NM_ITEM, "Collapse", NULL, "TBImages:list_folderfold", NULL, NULL, 0);
423 ami_menu_alloc_item(md, AMI_HOTLIST_M_COLLAPSE_ALL, NM_SUB, "All", "-", NULL,
424 ami_hotlist_menu_item_project_collapse_all, NULL, 0);
425 ami_menu_alloc_item(md, AMI_HOTLIST_M_COLLAPSE_FOLDERS, NM_SUB, "Folders", NULL, NULL,
426 ami_hotlist_menu_item_project_collapse_folders, NULL, 0);
427 ami_menu_alloc_item(md, AMI_HOTLIST_M_COLLAPSE_LINKS, NM_SUB, "Links", NULL, NULL,
428 ami_hotlist_menu_item_project_collapse_links, NULL, 0);
429 ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_P2, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
430 ami_menu_alloc_item(md, AMI_HOTLIST_M_SNAPSHOT, NM_ITEM, "SnapshotWindow", NULL, "TBImages:list_hold",
431 ami_hotlist_menu_item_project_snapshot, NULL, 0);
432 ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_P3, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
433 ami_menu_alloc_item(md, AMI_HOTLIST_M_CLOSE, NM_ITEM, "CloseWindow", "K", "TBImages:list_cancel",
434 ami_hotlist_menu_item_project_close, NULL, 0);
435
436 ami_menu_alloc_item(md, AMI_HOTLIST_M_EDIT, NM_TITLE, "Edit", NULL, NULL, NULL, NULL, 0);
437
438 ami_menu_alloc_item(md, AMI_HOTLIST_M_NEWFOLDER, NM_ITEM, "TreeNewFolder", "N", "TBImages:list_drawer",
439 ami_hotlist_menu_item_edit_newfolder, NULL, 0);
440 ami_menu_alloc_item(md, AMI_HOTLIST_M_NEWLINK, NM_ITEM, "TreeNewLink", NULL, "TBImages:list_favouriteadd",
441 ami_hotlist_menu_item_edit_newlink, NULL, 0);
442 ami_menu_alloc_item(md, AMI_HOTLIST_M_EDIT_EDIT, NM_ITEM, "TreeEdit", "E", "TBImages:list_edit",
443 ami_hotlist_menu_item_edit_edit, NULL, 0);
444 ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_E1, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
445 ami_menu_alloc_item(md, AMI_HOTLIST_M_SELECTALL, NM_ITEM, "SelectAllNS", "A", NSA_SPACE,
446 ami_hotlist_menu_item_edit_select_all, NULL, 0);
447 ami_menu_alloc_item(md, AMI_HOTLIST_M_CLEAR, NM_ITEM, "ClearNS", NULL, NSA_SPACE,
448 ami_hotlist_menu_item_edit_clear, NULL, 0);
449 ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_E2, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
450 ami_menu_alloc_item(md, AMI_HOTLIST_M_DELETE, NM_ITEM, "TreeDelete", "Del", "TBImages:list_delete",
451 ami_hotlist_menu_item_edit_delete, NULL, 0);
452
453 ami_menu_alloc_item(md, AMI_HOTLIST_M_LAST, NM_END, NULL, NULL, NULL, NULL, NULL, 0);
454}
455
456static struct Menu *
458{
459 ami_hotlist_menulabs(hotlist_win->menu_data);
460 hotlist_win->imenu = ami_menu_layout(hotlist_win->menu_data, AMI_HOTLIST_M_LAST);
461 if(hotlist_win->imenu == NULL) return NULL;
462
463 return hotlist_win->imenu;
464}
465
466
467static nserror
469{
470 struct ami_corewindow *ami_cw = (struct ami_corewindow *)&hotlist_win->core;
471 ULONG refresh_mode = WA_SmartRefresh;
472
473 if(nsoption_bool(window_simple_refresh) == true) {
474 refresh_mode = WA_SimpleRefresh;
475 }
476
477 ami_cw->objects[GID_CW_WIN] = WindowObj,
478 WA_ScreenTitle, ami_gui_get_screen_title(),
479 WA_Title, ami_cw->wintitle,
480 WA_Activate, TRUE,
481 WA_DepthGadget, TRUE,
482 WA_DragBar, TRUE,
483 WA_CloseGadget, TRUE,
484 WA_SizeGadget, TRUE,
485 WA_SizeBRight, TRUE,
486 WA_Top, nsoption_int(hotlist_window_ypos),
487 WA_Left, nsoption_int(hotlist_window_xpos),
488 WA_Width, nsoption_int(hotlist_window_xsize),
489 WA_Height, nsoption_int(hotlist_window_ysize),
490 WA_PubScreen, ami_gui_get_screen(),
491 WA_ReportMouse, TRUE,
492 refresh_mode, TRUE,
493 WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
494 IDCMP_RAWKEY | IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
495 IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY | IDCMP_REFRESHWINDOW,
496 WINDOW_IDCMPHook, &ami_cw->idcmp_hook,
497 WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE |
498 IDCMP_SIZEVERIFY | IDCMP_REFRESHWINDOW,
499 WINDOW_SharedPort, ami_gui_get_shared_msgport(),
500 WINDOW_HorizProp, 1,
501 WINDOW_VertProp, 1,
502 WINDOW_UserData, hotlist_win,
503 WINDOW_MenuStrip, ami_hotlist_menu_create(hotlist_win),
504 WINDOW_MenuUserData, WGUD_HOOK,
505 WINDOW_IconifyGadget, FALSE,
506 WINDOW_Position, WPOS_CENTERSCREEN,
507 WINDOW_ParentGroup, ami_cw->objects[GID_CW_MAIN] = LayoutVObj,
508 LAYOUT_AddChild, ami_cw->objects[GID_CW_DRAW] = SpaceObj,
509 GA_ID, GID_CW_DRAW,
510 SPACE_Transparent, TRUE,
511 SPACE_BevelStyle, BVS_DISPLAY,
512 GA_RelVerify, TRUE,
513 SpaceEnd,
514 EndGroup,
515 EndWindow;
516
517 if(ami_cw->objects[GID_CW_WIN] == NULL) {
518 return NSERROR_NOMEM;
519 }
520
521 return NSERROR_OK;
522}
523
524/**
525 * destroy a previously created hotlist view
526 */
527static void
529{
530 nserror res;
531
532 if(hotlist_window == NULL)
533 return;
534
535 res = hotlist_manager_fini();
536 if (res == NSERROR_OK) {
538 res = ami_corewindow_fini(&hotlist_window->core); /* closes the window for us, frees hotlist_win */
539 hotlist_window = NULL;
540 }
541
543}
544
545
546/* exported interface documented in amiga/hotlist.h */
548{
549 struct ami_hotlist_window *ncwin;
550 nserror res;
551
552 if(hotlist_window != NULL) {
553 //windowtofront()
554 return NSERROR_OK;
555 }
556
557 ncwin = calloc(1, sizeof(struct ami_hotlist_window));
558 if (ncwin == NULL) {
559 return NSERROR_NOMEM;
560 }
561
562 ncwin->core.wintitle = ami_utf8_easy((char *)messages_get("Hotlist"));
563
564 res = ami_hotlist_create_window(ncwin);
565 if (res != NSERROR_OK) {
566 NSLOG(netsurf, INFO, "SSL UI builder init failed");
568 free(ncwin);
569 return res;
570 }
571
572 /* initialise Amiga core window */
573 ncwin->core.draw = ami_hotlist_draw;
574 ncwin->core.key = ami_hotlist_key;
577 ncwin->core.event = NULL;
580
581 res = ami_corewindow_init(&ncwin->core);
582 if (res != NSERROR_OK) {
584 DisposeObject(ncwin->core.objects[GID_CW_WIN]);
585 free(ncwin);
586 return res;
587 }
588
589 res = hotlist_manager_init(ncwin->core.cb_table, (struct core_window *)ncwin);
590 if (res != NSERROR_OK) {
592 DisposeObject(ncwin->core.objects[GID_CW_WIN]);
593 free(ncwin);
594 return res;
595 }
596
597 hotlist_window = ncwin;
598
599 return NSERROR_OK;
600}
601
602/* exported interface documented in amiga/hotlist.h */
604{
606}
607
nserror ami_corewindow_fini(struct ami_corewindow *ami_cw)
finalise elements of Amiga core window.
Definition: corewindow.c:986
nserror ami_corewindow_init(struct ami_corewindow *ami_cw)
initialise elements of Amiga core window.
Definition: corewindow.c:926
@ GID_CW_MAIN
Definition: corewindow.h:33
@ GID_CW_WIN
Definition: corewindow.h:32
@ GID_CW_DRAW
Definition: corewindow.h:34
struct Screen * ami_gui_get_screen(void)
Get a pointer to the screen NetSurf is running on.
Definition: gui.c:403
void ami_gui_hotlist_update_all(void)
Update hotlist toolbar and recreate the menu for all windows.
Definition: gui.c:4195
void * ami_window_at_pointer(int type)
undocumented, or internal, or documented elsewhere
Definition: gui.c:682
struct browser_window * ami_gui2_get_browser_window(struct gui_window_2 *gwin)
Get browser window from gui_window_2.
Definition: gui.c:425
STRPTR ami_gui_get_screen_title(void)
Get the string for NetSurf's screen titlebar.
Definition: gui.c:974
void ami_gui_beep(void)
Beep.
Definition: gui.c:414
struct MsgPort * ami_gui_get_shared_msgport(void)
Get shared message port.
struct Menu * ami_menu_layout(struct ami_menu_data **md, int max)
Definition: menu.c:419
void ami_menu_free_menu(struct ami_menu_data **md, int max, struct Menu *imenu)
Definition: menu.c:430
void ami_menu_alloc_item(struct ami_menu_data **md, int num, UBYTE type, const char *restrict label, const char *restrict key, const char *restrict icon, void *restrict func, void *restrict hookdata, UWORD flags)
Definition: menu.c:115
#define NSA_SPACE
empty space
Definition: menu.h:37
void ami_update_pointer(struct Window *win, gui_pointer_shape shape)
Definition: theme.c:221
Browser window creation and manipulation interface.
nserror browser_window_navigate(struct browser_window *bw, struct nsurl *url, struct nsurl *referrer, enum browser_window_nav_flags flags, char *post_urlenc, struct fetch_multipart_data *post_multipart, struct hlcache_handle *parent)
Start fetching a page in a browser window.
@ BW_NAVIGATE_HISTORY
this will form a new history node (don't set for back/reload/etc)
bool hotlist_keypress(uint32_t key)
Key press handling.
Definition: hotlist.c:1698
bool hotlist_has_selection(void)
Determine whether there is a selection.
Definition: hotlist.c:1705
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:1624
void hotlist_mouse_action(browser_mouse_state mouse, int x, int y)
Handles all kinds of mouse action.
Definition: hotlist.c:1691
nserror hotlist_manager_fini(void)
Finalise the hotlist manager.
Definition: hotlist.c:1373
void hotlist_redraw(int x, int y, struct rect *clip, const struct redraw_context *ctx)
Redraw the hotlist.
Definition: hotlist.c:1683
nserror hotlist_iterate(void *ctx, hotlist_folder_enter_cb enter_cb, hotlist_address_cb address_cb, hotlist_folder_leave_cb leave_cb)
Walk (depth first) the hotlist, calling callbacks on entering folders, address nodes,...
Definition: hotlist.c:1164
nserror hotlist_manager_init(struct core_window_callback_table *cw_t, void *core_window_handle)
Initialise the hotlist manager.
Definition: hotlist.c:1354
nserror hotlist_add_folder(const char *title, bool at_y, int y)
Add a folder to the hotlist.
Definition: hotlist.c:1661
nserror hotlist_export(const char *path, const char *title)
Save hotlist to file.
Definition: hotlist.c:1086
nserror hotlist_expand(bool only_folders)
Expand the treeview's nodes.
Definition: hotlist.c:1741
void hotlist_edit_selection(void)
Edit the first selected node.
Definition: hotlist.c:1734
bool hotlist_get_selection(nsurl **url, const char **title)
Get the first selected node.
Definition: hotlist.c:1712
nserror hotlist_contract(bool all)
Contract the treeview's nodes.
Definition: hotlist.c:1748
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
struct FileRequester * savereq
Definition: file.c:53
static void ami_hotlist_destroy(struct ami_corewindow *ami_cw)
destroy a previously created hotlist view
Definition: hotlist.c:528
static nserror ami_hotlist_folder_leave_cb(void *ctx)
Definition: hotlist.c:139
static nserror ami_hotlist_drag_end(struct ami_corewindow *ami_cw, int x, int y)
callback for drag end on Amiga core window ie.
Definition: hotlist.c:241
static struct Menu * ami_hotlist_menu_create(struct ami_hotlist_window *hotlist_win)
Definition: hotlist.c:457
static nserror ami_hotlist_address_cb(void *ctx, nsurl *url, const char *title)
Definition: hotlist.c:127
static nserror ami_hotlist_mouse(struct ami_corewindow *ami_cw, browser_mouse_state mouse_state, int x, int y)
callback for mouse action for hotlist viewer on core window
Definition: hotlist.c:187
nserror ami_hotlist_scan(void *userdata, int first_item, const char *folder, bool(*cb_add_item)(void *userdata, int level, int item, const char *title, nsurl *url, bool folder))
Scan the hotlist.
Definition: hotlist.c:151
HOOKF(void, ami_hotlist_menu_item_project_export, APTR, window, struct IntuiMessage *)
Definition: hotlist.c:306
static void ami_hotlist_menulabs(struct ami_menu_data **md)
Definition: hotlist.c:409
void ami_hotlist_close(void)
Close the hotlist viewer normally this shouldn't be used; only exists for ARexx use.
Definition: hotlist.c:603
static nserror ami_hotlist_icon_drop(struct ami_corewindow *ami_cw, struct nsurl *url, const char *title, int x, int y)
callback for icon drop on Amiga core window ie.
Definition: hotlist.c:285
static nserror ami_hotlist_create_window(struct ami_hotlist_window *hotlist_win)
Definition: hotlist.c:468
static nserror ami_hotlist_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect *r, struct redraw_context *ctx)
callback on draw event for hotlist viewer on core window
Definition: hotlist.c:223
static nserror ami_hotlist_folder_enter_cb(void *ctx, const char *title)
hotlist scanner
Definition: hotlist.c:110
nserror ami_hotlist_present(void)
Open the hotlist viewer.
Definition: hotlist.c:547
static nserror ami_hotlist_key(struct ami_corewindow *ami_cw, uint32_t nskey)
callback for keypress for hotlist viewer on core window
Definition: hotlist.c:204
static void ami_hotlist_menu_free(struct ami_hotlist_window *hotlist_win)
menu stuff
Definition: hotlist.c:296
static struct ami_hotlist_window * hotlist_window
Definition: hotlist.c:97
@ AMI_HOTLIST_M_BAR_E1
Definition: hotlist.c:78
@ AMI_HOTLIST_M_COLLAPSE_ALL
Definition: hotlist.c:66
@ AMI_HOTLIST_M_COLLAPSE
Definition: hotlist.c:65
@ AMI_HOTLIST_M_LAST
Definition: hotlist.c:83
@ AMI_HOTLIST_M_BAR_P1
Definition: hotlist.c:60
@ AMI_HOTLIST_M_BAR_P3
Definition: hotlist.c:71
@ AMI_HOTLIST_M_EXPAND_FOLDERS
Definition: hotlist.c:63
@ AMI_HOTLIST_M_SNAPSHOT
Definition: hotlist.c:70
@ AMI_HOTLIST_M_NEWLINK
Definition: hotlist.c:76
@ AMI_HOTLIST_M_EXPAND
Definition: hotlist.c:61
@ AMI_HOTLIST_M_BAR_E2
Definition: hotlist.c:81
@ AMI_HOTLIST_M_PROJECT
Definition: hotlist.c:58
@ AMI_HOTLIST_M_BAR_P2
Definition: hotlist.c:69
@ AMI_HOTLIST_M_NEWFOLDER
Definition: hotlist.c:75
@ AMI_HOTLIST_M_DELETE
Definition: hotlist.c:82
@ AMI_HOTLIST_M_SELECTALL
Definition: hotlist.c:79
@ AMI_HOTLIST_M_COLLAPSE_FOLDERS
Definition: hotlist.c:67
@ AMI_HOTLIST_M_CLEAR
Definition: hotlist.c:80
@ AMI_HOTLIST_M_EDIT
Definition: hotlist.c:74
@ AMI_HOTLIST_M_CLOSE
Definition: hotlist.c:72
@ AMI_HOTLIST_M_EXPORT
Definition: hotlist.c:59
@ AMI_HOTLIST_M_EXPAND_LINKS
Definition: hotlist.c:64
@ AMI_HOTLIST_M_COLLAPSE_LINKS
Definition: hotlist.c:68
@ AMI_HOTLIST_M_EDIT_EDIT
Definition: hotlist.c:77
@ AMI_HOTLIST_M_EXPAND_ALL
Definition: hotlist.c:62
@ AMINS_WINDOW
Definition: object.h:28
@ AMINS_COREWINDOW
Definition: object.h:36
void ami_utf8_free(char *ptr)
Definition: utf8.c:104
char * ami_utf8_easy(const char *string)
Definition: utf8.c:109
browser_mouse_state
Mouse state.
Definition: mouse.h:43
@ GUI_POINTER_WAIT
Definition: mouse.h:104
@ GUI_POINTER_DEFAULT
Definition: mouse.h:90
Target independent plotting interface.
Interface to key press operations.
@ 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 WindowObj
Definition: libs.h:77
#define LayoutVObj
Definition: libs.h:65
#define SpaceObj
Definition: libs.h:74
#define NSLOG(catname, level, logmsg, args...)
Definition: log.h:116
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).
struct nsurl nsurl
NetSurf URL object.
Definition: nsurl.h:31
#define IDCMP_EXTENDEDMOUSE
Definition: os3support.h:121
#define BVS_DISPLAY
Definition: os3support.h:120
Interface to utility string handling.
Amiga core window state.
Definition: corewindow.h:45
void(* close)(struct ami_corewindow *ami_cw)
callback to close an Amiga core window
Definition: corewindow.h:165
Object * objects[GID_CW_LAST]
Definition: corewindow.h:52
nserror(* icon_drop)(struct ami_corewindow *ami_cw, struct nsurl *url, const char *title, int x, int y)
callback for icon drop on Amiga core window ie.
Definition: corewindow.h:158
struct core_window_callback_table * cb_table
table of callbacks for core window operations
Definition: corewindow.h:86
bool close_window
Definition: corewindow.h:65
nserror(* mouse)(struct ami_corewindow *ami_cw, browser_mouse_state mouse_state, int x, int y)
callback for mouse event on Amiga core window
Definition: corewindow.h:121
nserror(* draw)(struct ami_corewindow *ami_cw, int x, int y, struct rect *r, struct redraw_context *ctx)
callback to draw on drawable area of Amiga core window
Definition: corewindow.h:98
nserror(* key)(struct ami_corewindow *ami_cw, uint32_t nskey)
callback for keypress on Amiga core window
Definition: corewindow.h:110
struct Window * win
Definition: corewindow.h:51
BOOL(* event)(struct ami_corewindow *ami_cw, ULONG result)
callback for unknown events on Amiga core window eg.
Definition: corewindow.h:133
nserror(* drag_end)(struct ami_corewindow *ami_cw, int x, int y)
callback for drag end on Amiga core window ie.
Definition: corewindow.h:144
struct Hook idcmp_hook
Definition: corewindow.h:54
char * wintitle
window title, must be allocated wth ami_utf8 function
Definition: corewindow.h:76
const char * folder
Definition: hotlist.c:103
bool(* cb)(void *userdata, int level, int item, const char *title, nsurl *url, bool folder)
Definition: hotlist.c:106
void * userdata
Definition: hotlist.c:100
Amiga hotlist viewer window context.
Definition: hotlist.c:89
struct ami_menu_data * menu_data[AMI_HOTLIST_M_LAST+1]
Definition: hotlist.c:93
struct Menu * imenu
Definition: hotlist.c:94
struct ami_corewindow core
Amiga core window context.
Definition: hotlist.c:91
Rectangle coordinates.
Definition: types.h:40
Redraw context.
Definition: plotters.h:51
Option reading and saving interface.
#define nsoption_int(OPTION)
Get the value of an integer option.
Definition: nsoption.h:279
#define nsoption_set_int(OPTION, VALUE)
set an integer option in the default table
Definition: nsoption.h:314
#define nsoption_bool(OPTION)
Get the value of a boolean option.
Definition: nsoption.h:270