NetSurf
hotlist.c
Go to the documentation of this file.
1/*
2 * Copyright 2008-2025 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 */
71 /* Edit menu */
82};
83
84/**
85 * Amiga hotlist viewer window context
86 */
88 /** Amiga core window context */
90
92 struct Menu *imenu; /* Intuition menu */
93};
94
95static struct ami_hotlist_window *hotlist_window = NULL;
96
98 void *userdata;
99 int level;
100 int item;
101 const char *folder; /* folder we're interested in */
102 bool in_menu; /* set if we are in that folder */
103 bool found; /* set if the folder is found */
104 bool (*cb)(void *userdata, int level, int item, const char *title, nsurl *url, bool folder);
105};
106
107/** hotlist scanner */
108static nserror ami_hotlist_folder_enter_cb(void *ctx, const char *title)
109{
110 struct ami_hotlist_ctx *menu_ctx = (struct ami_hotlist_ctx *)ctx;
111
112 if(menu_ctx->in_menu == true) {
113 if(menu_ctx->cb(menu_ctx->userdata, menu_ctx->level, menu_ctx->item, title, NULL, true) == true)
114 menu_ctx->item++;
115 } else {
116 if((menu_ctx->level == 0) && (strcmp(title, menu_ctx->folder) == 0)) {
117 menu_ctx->in_menu = true;
118 menu_ctx->found = true;
119 }
120 }
121 menu_ctx->level++;
122 return NSERROR_OK;
123}
124
125static nserror ami_hotlist_address_cb(void *ctx, nsurl *url, const char *title)
126{
127 struct ami_hotlist_ctx *menu_ctx = (struct ami_hotlist_ctx *)ctx;
128
129 if(menu_ctx->in_menu == true) {
130 if(menu_ctx->cb(menu_ctx->userdata, menu_ctx->level, menu_ctx->item, title, url, false) == true)
131 menu_ctx->item++;
132 }
133
134 return NSERROR_OK;
135}
136
138{
139 struct ami_hotlist_ctx *menu_ctx = (struct ami_hotlist_ctx *)ctx;
140
141 menu_ctx->level--;
142
143 if((menu_ctx->in_menu == true) && (menu_ctx->level == 0))
144 menu_ctx->in_menu = false;
145
146 return NSERROR_OK;
147}
148
149nserror ami_hotlist_scan(void *userdata, int first_item, const char *folder,
150 bool (*cb_add_item)(void *userdata, int level, int item, const char *title, nsurl *url, bool folder))
151{
152 nserror error;
153 struct ami_hotlist_ctx ctx;
154
155 ctx.level = 0;
156 ctx.item = first_item;
157 ctx.folder = folder;
158 ctx.in_menu = false;
159 ctx.userdata = userdata;
160 ctx.cb = cb_add_item;
161 ctx.found = false;
162
163 error = hotlist_iterate(&ctx,
167
168 if((error == NSERROR_OK) && (ctx.found == false))
169 hotlist_add_folder(folder, false, 0);
170
171 return error;
172}
173
174
175/**
176 * callback for mouse action for hotlist viewer on core window
177 *
178 * \param ami_cw The Amiga core window structure.
179 * \param mouse_state netsurf mouse state on event
180 * \param x location of event
181 * \param y location of event
182 * \return NSERROR_OK on success otherwise apropriate error code
183 */
184static nserror
186 browser_mouse_state mouse_state,
187 int x, int y)
188{
189 hotlist_mouse_action(mouse_state, x, y);
190
191 return NSERROR_OK;
192}
193
194/**
195 * callback for keypress for hotlist viewer on core window
196 *
197 * \param ami_cw The Amiga core window structure.
198 * \param nskey The netsurf key code
199 * \return NSERROR_OK on success otherwise apropriate error code
200 */
201static nserror
202ami_hotlist_key(struct ami_corewindow *ami_cw, uint32_t nskey)
203{
204 if (hotlist_keypress(nskey)) {
205 return NSERROR_OK;
206 }
208}
209
210/**
211 * callback on draw event for hotlist viewer on core window
212 *
213 * \param ami_cw The Amiga core window structure.
214 * \param x The x coordinate of hotlist area to redraw
215 * \param y The y coordinate of hotlist area to redraw
216 * \param r The rectangle of the window that needs updating.
217 * \param ctx The drawing context
218 * \return NSERROR_OK on success otherwise apropriate error code
219 */
220static nserror
222 int x, int y, struct rect *r, struct redraw_context *ctx)
223{
224 hotlist_redraw(x, y, r, ctx);
225
226 return NSERROR_OK;
227}
228
229/**
230 * callback for drag end on Amiga core window
231 * ie. a drag *from* this window has ended
232 *
233 * \param ami_cw The Amiga core window structure.
234 * \param x mouse x co-ordinate
235 * \param y mouse y co-ordinate
236 * \return NSERROR_OK on success otherwise apropriate error code
237 */
238static nserror
239ami_hotlist_drag_end(struct ami_corewindow *ami_cw, int x, int y)
240{
241 nsurl *url = NULL;
242 const char *title = NULL;
243 bool ok = false;
244 struct gui_window_2 *gwin;
245 struct ami_corewindow *cw;
246
248 ok = hotlist_get_selection(&url, &title);
249 }
250
251 if((ok == false) || (url == NULL)) {
252 ami_gui_beep();
253 } else if(url) {
254 if((gwin = ami_window_at_pointer(AMINS_WINDOW))) {
256 url,
257 NULL,
259 NULL,
260 NULL,
261 NULL);
262 } else if((cw = (struct ami_corewindow *)ami_window_at_pointer(AMINS_COREWINDOW)) &&
263 (ami_cw->icon_drop != NULL)) {
264 cw->icon_drop(cw, url, title, x, y);
265 }
266 }
267 return NSERROR_OK;
268}
269
270/**
271 * callback for icon drop on Amiga core window
272 * ie. a drag has ended *above* this window
273 * \todo this may not be very flexible but serves our current purposes
274 *
275 * \param ami_cw The Amiga core window structure.
276 * \param url url of dropped icon
277 * \param title title of dropped icon
278 * \param x mouse x co-ordinate
279 * \param y mouse y co-ordinate
280 * \return NSERROR_OK on success otherwise apropriate error code
281 */
282static nserror
283ami_hotlist_icon_drop(struct ami_corewindow *ami_cw, struct nsurl *url, const char *title, int x, int y)
284{
285 hotlist_add_entry(url, title, true, y);
286 return NSERROR_OK;
287}
288
289/**
290 * menu stuff
291 */
292
293static void
295{
296 SetAttrs(hotlist_win->core.objects[GID_CW_WIN],
297 WINDOW_MenuStrip, NULL,
298 TAG_DONE);
299
300 ami_menu_free_menu(hotlist_win->menu_data, AMI_HOTLIST_M_LAST, hotlist_win->imenu);
301}
302
303 /* menu hook functions */
304HOOKF(void, ami_hotlist_menu_item_project_export, APTR, window, struct IntuiMessage *)
305{
306 char fname[1024];
307 struct ami_corewindow *ami_cw;
308 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
309
310 if(AslRequestTags(savereq,
311 ASLFR_Window, ami_cw->win,
312 ASLFR_SleepWindow, TRUE,
313 ASLFR_TitleText, messages_get("NetSurf"),
314 ASLFR_Screen, ami_gui_get_screen(),
315 ASLFR_InitialFile, "hotlist.html",
316 TAG_DONE)) {
317 strlcpy(fname, savereq->fr_Drawer, 1024);
318 AddPart(fname, savereq->fr_File, 1024);
320 hotlist_export(fname, NULL);
322 }
323}
324
325HOOKF(void, ami_hotlist_menu_item_project_expand_all, APTR, window, struct IntuiMessage *)
326{
327 hotlist_expand(false);
328}
329
330HOOKF(void, ami_hotlist_menu_item_project_expand_folders, APTR, window, struct IntuiMessage *)
331{
332 hotlist_expand(true);
333}
334
335HOOKF(void, ami_hotlist_menu_item_project_expand_links, APTR, window, struct IntuiMessage *)
336{
337 hotlist_expand(false);
338}
339
340HOOKF(void, ami_hotlist_menu_item_project_collapse_all, APTR, window, struct IntuiMessage *)
341{
342 hotlist_contract(true);
343}
344
345HOOKF(void, ami_hotlist_menu_item_project_collapse_folders, APTR, window, struct IntuiMessage *)
346{
347 hotlist_contract(true);
348}
349
350HOOKF(void, ami_hotlist_menu_item_project_collapse_links, APTR, window, struct IntuiMessage *)
351{
352 hotlist_contract(false);
353}
354
355HOOKF(void, ami_hotlist_menu_item_project_close, APTR, window, struct IntuiMessage *)
356{
357 struct ami_corewindow *ami_cw;
358 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
359
360 ami_cw->close_window = true;
361}
362
363HOOKF(void, ami_hotlist_menu_item_edit_newfolder, APTR, window, struct IntuiMessage *)
364{
365 hotlist_add_folder(NULL, false, 0);
366}
367
368HOOKF(void, ami_hotlist_menu_item_edit_newlink, APTR, window, struct IntuiMessage *)
369{
370 hotlist_add_entry(NULL, NULL, false, 0);
371}
372
373HOOKF(void, ami_hotlist_menu_item_edit_edit, APTR, window, struct IntuiMessage *)
374{
376}
377
378HOOKF(void, ami_hotlist_menu_item_edit_select_all, APTR, window, struct IntuiMessage *)
379{
381}
382
383HOOKF(void, ami_hotlist_menu_item_edit_clear, APTR, window, struct IntuiMessage *)
384{
386}
387
388HOOKF(void, ami_hotlist_menu_item_edit_delete, APTR, window, struct IntuiMessage *)
389{
391}
392
393
394/* menu setup */
395
396static void ami_hotlist_menulabs(struct ami_menu_data **md)
397{
398 ami_menu_alloc_item(md, AMI_HOTLIST_M_PROJECT, NM_TITLE, "Tree", NULL, NULL, NULL, NULL, 0);
399 ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPORT, NM_ITEM, "TreeExport", "S", "TBImages:list_save",
400 ami_hotlist_menu_item_project_export, NULL, 0);
401 ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_P1, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
402 ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPAND, NM_ITEM, "Expand", NULL, "TBImages:list_folderunfold", NULL, NULL, 0);
403 ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPAND_ALL, NM_SUB, "All", "+", NULL,
404 ami_hotlist_menu_item_project_expand_all, NULL, 0);
405 ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPAND_FOLDERS, NM_SUB, "Folders", NULL, NULL,
406 ami_hotlist_menu_item_project_expand_folders, NULL, 0);
407 ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPAND_LINKS, NM_SUB, "Links", NULL, NULL,
408 ami_hotlist_menu_item_project_expand_links, NULL, 0);
409 ami_menu_alloc_item(md, AMI_HOTLIST_M_COLLAPSE, NM_ITEM, "Collapse", NULL, "TBImages:list_folderfold", NULL, NULL, 0);
410 ami_menu_alloc_item(md, AMI_HOTLIST_M_COLLAPSE_ALL, NM_SUB, "All", "-", NULL,
411 ami_hotlist_menu_item_project_collapse_all, NULL, 0);
412 ami_menu_alloc_item(md, AMI_HOTLIST_M_COLLAPSE_FOLDERS, NM_SUB, "Folders", NULL, NULL,
413 ami_hotlist_menu_item_project_collapse_folders, NULL, 0);
414 ami_menu_alloc_item(md, AMI_HOTLIST_M_COLLAPSE_LINKS, NM_SUB, "Links", NULL, NULL,
415 ami_hotlist_menu_item_project_collapse_links, NULL, 0);
416 ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_P2, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
417 ami_menu_alloc_item(md, AMI_HOTLIST_M_CLOSE, NM_ITEM, "CloseWindow", "K", "TBImages:list_cancel",
418 ami_hotlist_menu_item_project_close, NULL, 0);
419
420 ami_menu_alloc_item(md, AMI_HOTLIST_M_EDIT, NM_TITLE, "Edit", NULL, NULL, NULL, NULL, 0);
421
422 ami_menu_alloc_item(md, AMI_HOTLIST_M_NEWFOLDER, NM_ITEM, "TreeNewFolder", "N", "TBImages:list_drawer",
423 ami_hotlist_menu_item_edit_newfolder, NULL, 0);
424 ami_menu_alloc_item(md, AMI_HOTLIST_M_NEWLINK, NM_ITEM, "TreeNewLink", NULL, "TBImages:list_favouriteadd",
425 ami_hotlist_menu_item_edit_newlink, NULL, 0);
426 ami_menu_alloc_item(md, AMI_HOTLIST_M_EDIT_EDIT, NM_ITEM, "TreeEdit", "E", "TBImages:list_edit",
427 ami_hotlist_menu_item_edit_edit, NULL, 0);
428 ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_E1, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
429 ami_menu_alloc_item(md, AMI_HOTLIST_M_SELECTALL, NM_ITEM, "SelectAllNS", "A", NSA_SPACE,
430 ami_hotlist_menu_item_edit_select_all, NULL, 0);
431 ami_menu_alloc_item(md, AMI_HOTLIST_M_CLEAR, NM_ITEM, "ClearNS", NULL, NSA_SPACE,
432 ami_hotlist_menu_item_edit_clear, NULL, 0);
433 ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_E2, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
434 ami_menu_alloc_item(md, AMI_HOTLIST_M_DELETE, NM_ITEM, "TreeDelete", "Del", "TBImages:list_delete",
435 ami_hotlist_menu_item_edit_delete, NULL, 0);
436
437 ami_menu_alloc_item(md, AMI_HOTLIST_M_LAST, NM_END, NULL, NULL, NULL, NULL, NULL, 0);
438}
439
440static struct Menu *
442{
443 ami_hotlist_menulabs(hotlist_win->menu_data);
444 hotlist_win->imenu = ami_menu_layout(hotlist_win->menu_data, AMI_HOTLIST_M_LAST);
445 if(hotlist_win->imenu == NULL) return NULL;
446
447 return hotlist_win->imenu;
448}
449
450
451static nserror
453{
454 struct ami_corewindow *ami_cw = (struct ami_corewindow *)&hotlist_win->core;
455 ULONG refresh_mode = WA_SmartRefresh;
456
457 if(nsoption_bool(window_simple_refresh) == true) {
458 refresh_mode = WA_SimpleRefresh;
459 }
460
461 ami_cw->objects[GID_CW_WIN] = WindowObj,
462 WA_ScreenTitle, ami_gui_get_screen_title(),
463 WA_Title, ami_cw->wintitle,
464 WA_Activate, TRUE,
465 WA_DepthGadget, TRUE,
466 WA_DragBar, TRUE,
467 WA_CloseGadget, TRUE,
468 WA_SizeGadget, TRUE,
469 WA_SizeBRight, TRUE,
470 WA_Width, 150,
471 WA_Height, 200,
472 WA_PubScreen, ami_gui_get_screen(),
473 WA_ReportMouse, TRUE,
474 refresh_mode, TRUE,
475 WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
476 IDCMP_RAWKEY | IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
477 IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY | IDCMP_REFRESHWINDOW,
478 WINDOW_IDCMPHook, &ami_cw->idcmp_hook,
479 WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE |
480 IDCMP_SIZEVERIFY | IDCMP_REFRESHWINDOW,
481 WINDOW_SharedPort, ami_gui_get_shared_msgport(),
482 WINDOW_HorizProp, 1,
483 WINDOW_VertProp, 1,
484 WINDOW_UserData, hotlist_win,
485 WINDOW_MenuStrip, ami_hotlist_menu_create(hotlist_win),
486 WINDOW_MenuUserData, WGUD_HOOK,
487 WINDOW_IconifyGadget, FALSE,
488#ifdef __amigaos4__
489 WINDOW_UniqueID, "NS_HOTLIST_WIN",
490 WINDOW_PopupGadget, TRUE,
491#endif
492 WINDOW_Position, WPOS_CENTERSCREEN,
493 WINDOW_ParentGroup, ami_cw->objects[GID_CW_MAIN] = LayoutVObj,
494 LAYOUT_AddChild, ami_cw->objects[GID_CW_DRAW] = SpaceObj,
495 GA_ID, GID_CW_DRAW,
496 SPACE_Transparent, TRUE,
497 SPACE_BevelStyle, BVS_DISPLAY,
498 SPACE_MinWidth, 50,
499 SPACE_MinHeight, 16,
500 GA_RelVerify, TRUE,
501 SpaceEnd,
502 EndGroup,
503 EndWindow;
504
505 if(ami_cw->objects[GID_CW_WIN] == NULL) {
506 return NSERROR_NOMEM;
507 }
508
509 return NSERROR_OK;
510}
511
512/**
513 * destroy a previously created hotlist view
514 */
515static void
517{
518 nserror res;
519
520 if(hotlist_window == NULL)
521 return;
522
523 res = hotlist_manager_fini();
524 if (res == NSERROR_OK) {
526 res = ami_corewindow_fini(&hotlist_window->core); /* closes the window for us, frees hotlist_win */
527 hotlist_window = NULL;
528 }
529
531}
532
533
534/* exported interface documented in amiga/hotlist.h */
536{
537 struct ami_hotlist_window *ncwin;
538 nserror res;
539
540 if(hotlist_window != NULL) {
541 //windowtofront()
542 return NSERROR_OK;
543 }
544
545 ncwin = calloc(1, sizeof(struct ami_hotlist_window));
546 if (ncwin == NULL) {
547 return NSERROR_NOMEM;
548 }
549
550 ncwin->core.wintitle = ami_utf8_easy((char *)messages_get("Hotlist"));
551
552 res = ami_hotlist_create_window(ncwin);
553 if (res != NSERROR_OK) {
554 NSLOG(netsurf, INFO, "SSL UI builder init failed");
556 free(ncwin);
557 return res;
558 }
559
560 /* initialise Amiga core window */
561 ncwin->core.draw = ami_hotlist_draw;
562 ncwin->core.key = ami_hotlist_key;
565 ncwin->core.event = NULL;
568
569 res = ami_corewindow_init(&ncwin->core);
570 if (res != NSERROR_OK) {
572 DisposeObject(ncwin->core.objects[GID_CW_WIN]);
573 free(ncwin);
574 return res;
575 }
576
577 res = hotlist_manager_init((struct core_window *)ncwin);
578 if (res != NSERROR_OK) {
580 DisposeObject(ncwin->core.objects[GID_CW_WIN]);
581 free(ncwin);
582 return res;
583 }
584
585 hotlist_window = ncwin;
586
587 return NSERROR_OK;
588}
589
590/* exported interface documented in amiga/hotlist.h */
592{
594}
595
nserror ami_corewindow_fini(struct ami_corewindow *ami_cw)
finalise elements of Amiga core window.
Definition: corewindow.c:987
nserror ami_corewindow_init(struct ami_corewindow *ami_cw)
initialise elements of Amiga core window.
Definition: corewindow.c:928
@ GID_CW_MAIN
Definition: corewindow.h:35
@ GID_CW_WIN
Definition: corewindow.h:34
@ GID_CW_DRAW
Definition: corewindow.h:36
struct Screen * ami_gui_get_screen(void)
Get a pointer to the screen NetSurf is running on.
Definition: gui.c:404
void ami_gui_hotlist_update_all(void)
Update hotlist toolbar and recreate the menu for all windows.
Definition: gui.c:4226
void * ami_window_at_pointer(int type)
undocumented, or internal, or documented elsewhere
Definition: gui.c:683
struct browser_window * ami_gui2_get_browser_window(struct gui_window_2 *gwin)
Get browser window from gui_window_2.
Definition: gui.c:426
STRPTR ami_gui_get_screen_title(void)
Get the string for NetSurf's screen titlebar.
Definition: gui.c:1018
void ami_gui_beep(void)
Beep.
Definition: gui.c:415
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:1695
bool hotlist_has_selection(void)
Determine whether there is a selection.
Definition: hotlist.c:1702
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:1621
void hotlist_mouse_action(browser_mouse_state mouse, int x, int y)
Handles all kinds of mouse action.
Definition: hotlist.c:1688
nserror hotlist_manager_init(void *core_window_handle)
Initialise the hotlist manager.
Definition: hotlist.c:1353
nserror hotlist_manager_fini(void)
Finalise the hotlist manager.
Definition: hotlist.c:1371
void hotlist_redraw(int x, int y, struct rect *clip, const struct redraw_context *ctx)
Redraw the hotlist.
Definition: hotlist.c:1680
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_add_folder(const char *title, bool at_y, int y)
Add a folder to the hotlist.
Definition: hotlist.c:1658
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:1738
void hotlist_edit_selection(void)
Edit the first selected node.
Definition: hotlist.c:1731
bool hotlist_get_selection(nsurl **url, const char **title)
Get the first selected node.
Definition: hotlist.c:1709
nserror hotlist_contract(bool all)
Contract the treeview's nodes.
Definition: hotlist.c:1745
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:516
static nserror ami_hotlist_folder_leave_cb(void *ctx)
Definition: hotlist.c:137
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:239
static struct Menu * ami_hotlist_menu_create(struct ami_hotlist_window *hotlist_win)
Definition: hotlist.c:441
static nserror ami_hotlist_address_cb(void *ctx, nsurl *url, const char *title)
Definition: hotlist.c:125
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:185
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:149
HOOKF(void, ami_hotlist_menu_item_project_export, APTR, window, struct IntuiMessage *)
Definition: hotlist.c:304
static void ami_hotlist_menulabs(struct ami_menu_data **md)
Definition: hotlist.c:396
void ami_hotlist_close(void)
Close the hotlist viewer normally this shouldn't be used; only exists for ARexx use.
Definition: hotlist.c:591
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:283
static nserror ami_hotlist_create_window(struct ami_hotlist_window *hotlist_win)
Definition: hotlist.c:452
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:221
static nserror ami_hotlist_folder_enter_cb(void *ctx, const char *title)
hotlist scanner
Definition: hotlist.c:108
nserror ami_hotlist_present(void)
Open the hotlist viewer.
Definition: hotlist.c:535
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:202
static void ami_hotlist_menu_free(struct ami_hotlist_window *hotlist_win)
menu stuff
Definition: hotlist.c:294
static struct ami_hotlist_window * hotlist_window
Definition: hotlist.c:95
@ AMI_HOTLIST_M_BAR_E1
Definition: hotlist.c:76
@ AMI_HOTLIST_M_COLLAPSE_ALL
Definition: hotlist.c:66
@ AMI_HOTLIST_M_COLLAPSE
Definition: hotlist.c:65
@ AMI_HOTLIST_M_LAST
Definition: hotlist.c:81
@ AMI_HOTLIST_M_BAR_P1
Definition: hotlist.c:60
@ AMI_HOTLIST_M_EXPAND_FOLDERS
Definition: hotlist.c:63
@ AMI_HOTLIST_M_NEWLINK
Definition: hotlist.c:74
@ AMI_HOTLIST_M_EXPAND
Definition: hotlist.c:61
@ AMI_HOTLIST_M_BAR_E2
Definition: hotlist.c:79
@ AMI_HOTLIST_M_PROJECT
Definition: hotlist.c:58
@ AMI_HOTLIST_M_BAR_P2
Definition: hotlist.c:69
@ AMI_HOTLIST_M_NEWFOLDER
Definition: hotlist.c:73
@ AMI_HOTLIST_M_DELETE
Definition: hotlist.c:80
@ AMI_HOTLIST_M_SELECTALL
Definition: hotlist.c:77
@ AMI_HOTLIST_M_COLLAPSE_FOLDERS
Definition: hotlist.c:67
@ AMI_HOTLIST_M_CLEAR
Definition: hotlist.c:78
@ AMI_HOTLIST_M_EDIT
Definition: hotlist.c:72
@ AMI_HOTLIST_M_CLOSE
Definition: hotlist.c:70
@ 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:75
@ 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: 1 is primary mouse button.
Definition: mouse.h:52
@ GUI_POINTER_WAIT
Definition: mouse.h:127
@ GUI_POINTER_DEFAULT
Definition: mouse.h:113
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:256
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:47
void(* close)(struct ami_corewindow *ami_cw)
callback to close an Amiga core window
Definition: corewindow.h:164
Object * objects[GID_CW_LAST]
Definition: corewindow.h:54
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:157
bool close_window
Definition: corewindow.h:67
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:120
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:97
nserror(* key)(struct ami_corewindow *ami_cw, uint32_t nskey)
callback for keypress on Amiga core window
Definition: corewindow.h:109
struct Window * win
Definition: corewindow.h:53
BOOL(* event)(struct ami_corewindow *ami_cw, ULONG result)
callback for unknown events on Amiga core window eg.
Definition: corewindow.h:132
nserror(* drag_end)(struct ami_corewindow *ami_cw, int x, int y)
callback for drag end on Amiga core window ie.
Definition: corewindow.h:143
struct Hook idcmp_hook
Definition: corewindow.h:56
char * wintitle
window title, must be allocated wth ami_utf8 function
Definition: corewindow.h:78
const char * folder
Definition: hotlist.c:101
bool(* cb)(void *userdata, int level, int item, const char *title, nsurl *url, bool folder)
Definition: hotlist.c:104
void * userdata
Definition: hotlist.c:98
Amiga hotlist viewer window context.
Definition: hotlist.c:87
struct ami_menu_data * menu_data[AMI_HOTLIST_M_LAST+1]
Definition: hotlist.c:91
struct Menu * imenu
Definition: hotlist.c:92
struct ami_corewindow core
Amiga core window context.
Definition: hotlist.c:89
Rectangle coordinates.
Definition: types.h:40
Redraw context.
Definition: plotters.h:51
Option reading and saving interface.
#define nsoption_bool(OPTION)
Get the value of a boolean option.
Definition: nsoption.h:308