NetSurf
gui_menu.c
Go to the documentation of this file.
1/*
2 * Copyright 2017-2024 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#include "amiga/os3support.h"
20
21#include <string.h>
22#include <stdlib.h>
23
24#include <proto/dos.h>
25#include <proto/asl.h>
26#include <proto/exec.h>
27#include <proto/gadtools.h>
28#include <proto/intuition.h>
29#include <proto/utility.h>
30#ifdef __amigaos4__
31#include <dos/anchorpath.h>
32#include <dos/obsolete.h> /* Needed for ExAll() */
33#endif
34
35#include <libraries/gadtools.h>
36#ifdef __amigaos4__
37#include <intuition/menuclass.h>
38#endif
39
40#include <classes/window.h>
41#include <proto/label.h>
42#include <images/label.h>
43#include <proto/bitmap.h>
44#include <images/bitmap.h>
45
46#include <reaction/reaction_macros.h>
47
48#include "utils/nsoption.h"
49#include "utils/messages.h"
50#include "utils/log.h"
51#include "utils/utils.h"
52#include "utils/nsurl.h"
54#include "netsurf/mouse.h"
55#include "netsurf/window.h"
56#include "netsurf/content.h"
57#include "netsurf/keypress.h"
58#include "desktop/hotlist.h"
59#include "desktop/version.h"
60
61#include "amiga/arexx.h"
62#include "amiga/bitmap.h"
63#include "amiga/clipboard.h"
64#include "amiga/cookies.h"
65#include "amiga/file.h"
66#include "amiga/filetype.h"
67#include "amiga/gui.h"
68#include "amiga/gui_menu.h"
69#include "amiga/gui_options.h"
70#include "amiga/history.h"
71#include "amiga/history_local.h"
72#include "amiga/hotlist.h"
73#include "amiga/libs.h"
74#include "amiga/menu.h"
75#include "amiga/misc.h"
76#include "amiga/nsoption.h"
77#include "amiga/print.h"
78#include "amiga/search.h"
79#include "amiga/theme.h"
80#include "amiga/utf8.h"
81#include "amiga/schedule.h"
82
83#ifdef __amigaos4__
84static struct Menu *restrict gui_menu = NULL;
85static int gui_menu_count = 0;
86struct ami_menu_data *gui_menu_data[AMI_MENU_AREXX_MAX + 1];
87#endif
88
89static bool ami_menu_check_toggled = false;
90static bool menu_quit = false;
91
92const char * const netsurf_version;
93const char * const verdate;
94
95static nserror ami_menu_scan(struct ami_menu_data **md);
96void ami_menu_arexx_scan(struct ami_menu_data **md);
97
98/*
99 * The below functions are called automatically by window.class when menu items are selected.
100 */
101
102HOOKF(void, ami_menu_item_project_newwin, APTR, window, struct IntuiMessage *)
103{
104 nsurl *url;
105 nserror error;
106
107 error = nsurl_create(nsoption_charp(homepage_url), &url);
108 if (error == NSERROR_OK) {
110 url,
111 NULL,
112 NULL,
113 NULL);
114 nsurl_unref(url);
115 }
116 if (error != NSERROR_OK) {
118 }
119}
120
121HOOKF(void, ami_menu_item_project_newtab, APTR, window, struct IntuiMessage *)
122{
123 struct gui_window_2 *gwin;
124
125 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
127}
128
129HOOKF(void, ami_menu_item_project_open, APTR, window, struct IntuiMessage *)
130{
131 struct gui_window_2 *gwin;
132 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
133
134 ami_file_open(gwin);
135}
136
137HOOKF(void, ami_menu_item_project_save, APTR, window, struct IntuiMessage *)
138{
139 struct gui_window_2 *gwin;
140 ULONG type = (ULONG)hook->h_Data;
141
142 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
143
145}
146
147HOOKF(void, ami_menu_item_project_closetab, APTR, window, struct IntuiMessage *)
148{
149 struct gui_window_2 *gwin;
150 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
151
153}
154
155HOOKF(void, ami_menu_item_project_closewin, APTR, window, struct IntuiMessage *)
156{
157 struct gui_window_2 *gwin;
158 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
159
160 ami_gui2_set_closed(gwin, true);
161}
162
163HOOKF(void, ami_menu_item_project_print, APTR, window, struct IntuiMessage *)
164{
165 struct gui_window_2 *gwin;
166 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
167
168 ami_set_pointer(gwin, GUI_POINTER_WAIT, false);
170 ami_reset_pointer(gwin);
171}
172
173HOOKF(void, ami_menu_item_project_about, APTR, window, struct IntuiMessage *)
174{
175 struct gui_window_2 *gwin;
176 char *temp, *temp2;
177 int sel;
178 nsurl *url = NULL;
179 nserror error = NSERROR_OK;
180
181 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
182
183 ami_set_pointer(gwin, GUI_POINTER_WAIT, false);
184
185 temp = ASPrintf("%s|%s|%s", messages_get("OK"),
186 messages_get("HelpCredits"),
187 messages_get("HelpLicence"));
188
189 temp2 = ami_utf8_easy(temp);
190 FreeVec(temp);
191#ifdef __amigaos4__
192 sel = TimedDosRequesterTags(TDR_ImageType,TDRIMAGE_INFO,
193 TDR_TitleString, messages_get("NetSurf"),
194 TDR_Window, ami_gui2_get_window(gwin),
195 TDR_GadgetString, temp2,
196 TDR_FormatString,"NetSurf %s\nBuild date %s\n\nhttp://www.netsurf-browser.org",
197 TDR_Arg1,netsurf_version,
198 TDR_Arg2,verdate,
199 TAG_DONE);
200#else
201 struct EasyStruct about_req = {
202 sizeof(struct EasyStruct),
203 0,
204 "NetSurf",
205 "NetSurf %s\nBuild date %s\n\nhttp://www.netsurf-browser.org",
206 temp2,
207 };
208
209 sel = EasyRequest(ami_gui2_get_window(gwin), &about_req, NULL, netsurf_version, verdate);
210#endif
211 free(temp2);
212
213 if(sel == 2) {
214 error = nsurl_create("about:credits", &url);
215 } else if(sel == 0) {
216 error = nsurl_create("about:licence", &url);
217 }
218
219 if(url) {
220 if (error == NSERROR_OK) {
222 url,
223 NULL,
224 NULL,
225 NULL);
226 nsurl_unref(url);
227 }
228 if (error != NSERROR_OK) {
230 }
231 }
232
233 ami_reset_pointer(gwin);
234}
235
236HOOKF(void, ami_menu_item_project_quit, APTR, window, struct IntuiMessage *)
237{
238 menu_quit = true;
239}
240
241HOOKF(void, ami_menu_item_edit_cut, APTR, window, struct IntuiMessage *)
242{
243 struct gui_window_2 *gwin;
244 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
245
247}
248
249HOOKF(void, ami_menu_item_edit_copy, APTR, window, struct IntuiMessage *)
250{
251 struct bitmap *bm;
252 struct gui_window_2 *gwin;
253 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
254
258 }
260 /** @todo It should be checked that the lifetime of
261 * the objects containing the values returned (and the
262 * constness cast away) is safe.
263 */
267 }
268#ifdef WITH_NS_SVG
270 ami_easy_clipboard_svg(browser_window_get_content(ami_gui2_get_browser_window(gwin)));
271 }
272#endif
273}
274
275HOOKF(void, ami_menu_item_edit_paste, APTR, window, struct IntuiMessage *)
276{
277 struct gui_window_2 *gwin;
278 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
279
281}
282
283HOOKF(void, ami_menu_item_edit_selectall, APTR, window, struct IntuiMessage *)
284{
285 struct gui_window_2 *gwin;
286 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
287
290}
291
292HOOKF(void, ami_menu_item_edit_clearsel, APTR, window, struct IntuiMessage *)
293{
294 struct gui_window_2 *gwin;
295 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
296
298}
299
300HOOKF(void, ami_menu_item_edit_undo, APTR, window, struct IntuiMessage *)
301{
302 struct gui_window_2 *gwin;
303 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
304
306}
307
308HOOKF(void, ami_menu_item_edit_redo, APTR, window, struct IntuiMessage *)
309{
310 struct gui_window_2 *gwin;
311 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
312
314}
315
316HOOKF(void, ami_menu_item_browser_find, APTR, window, struct IntuiMessage *)
317{
318 struct gui_window_2 *gwin;
319 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
320
322}
323
324HOOKF(void, ami_menu_item_browser_localhistory, APTR, window, struct IntuiMessage *)
325{
326 struct gui_window_2 *gwin;
327 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
328
330}
331
332HOOKF(void, ami_menu_item_browser_globalhistory, APTR, window, struct IntuiMessage *)
333{
335}
336
337HOOKF(void, ami_menu_item_browser_cookies, APTR, window, struct IntuiMessage *)
338{
340}
341
342HOOKF(void, ami_menu_item_browser_foreimg, APTR, window, struct IntuiMessage *)
343{
344 struct Menu *menustrip;
345 bool checked = false;
346
347 GetAttr(WINDOW_MenuStrip, (Object *)window, (ULONG *)&menustrip);
348 checked = ami_menu_get_selected(menustrip, msg);
349
350 nsoption_set_bool(foreground_images, checked);
352}
353
354HOOKF(void, ami_menu_item_browser_backimg, APTR, window, struct IntuiMessage *)
355{
356 struct Menu *menustrip;
357 bool checked = false;
358
359 GetAttr(WINDOW_MenuStrip, (Object *)window, (ULONG *)&menustrip);
360 checked = ami_menu_get_selected(menustrip, msg);
361
362 nsoption_set_bool(background_images, checked);
364}
365
366HOOKF(void, ami_menu_item_browser_enablejs, APTR, window, struct IntuiMessage *)
367{
368 struct Menu *menustrip;
369 bool checked = false;
370
371 GetAttr(WINDOW_MenuStrip, (Object *)window, (ULONG *)&menustrip);
372 checked = ami_menu_get_selected(menustrip, msg);
373
374 nsoption_set_bool(enable_javascript, checked);
376}
377
378HOOKF(void, ami_menu_item_browser_enablecss, APTR, window, struct IntuiMessage *)
379{
380 struct Menu *menustrip;
381 bool checked = false;
382
383 GetAttr(WINDOW_MenuStrip, (Object *)window, (ULONG *)&menustrip);
384 checked = ami_menu_get_selected(menustrip, msg);
385
386 nsoption_set_bool(author_level_css, checked);
388}
389
390HOOKF(void, ami_menu_item_browser_scale_decrease, APTR, window, struct IntuiMessage *)
391{
392 struct gui_window_2 *gwin;
393 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
394
396}
397
398HOOKF(void, ami_menu_item_browser_scale_normal, APTR, window, struct IntuiMessage *)
399{
400 struct gui_window_2 *gwin;
401 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
402
404}
405
406HOOKF(void, ami_menu_item_browser_scale_increase, APTR, window, struct IntuiMessage *)
407{
408 struct gui_window_2 *gwin;
409 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
410
412}
413
414HOOKF(void, ami_menu_item_browser_redraw, APTR, window, struct IntuiMessage *)
415{
416 struct gui_window_2 *gwin;
417 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
418
419 ami_schedule_redraw(gwin, true);
420 ami_gui2_set_new_content(gwin, true);
421}
422
423HOOKF(void, ami_menu_item_hotlist_add, APTR, window, struct IntuiMessage *)
424{
425 struct browser_window *bw;
426 struct gui_window_2 *gwin;
427 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
428
430
431 if (bw == NULL || browser_window_has_content(bw) == false)
432 return;
433
436}
437
438HOOKF(void, ami_menu_item_hotlist_show, APTR, window, struct IntuiMessage *)
439{
441}
442
443HOOKF(void, ami_menu_item_hotlist_entries, APTR, window, struct IntuiMessage *)
444{
445 nsurl *url = hook->h_Data;
446 struct gui_window_2 *gwin;
447 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
448
449 if(url == NULL) return;
450
452 url,
453 NULL,
455 NULL,
456 NULL,
457 NULL);
458}
459
460HOOKF(void, ami_menu_item_settings_edit, APTR, window, struct IntuiMessage *)
461{
463}
464
465HOOKF(void, ami_menu_item_settings_snapshot, APTR, window, struct IntuiMessage *)
466{
467 struct gui_window_2 *gwin;
468 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
469
470 nsoption_set_int(window_x, ami_gui2_get_window(gwin)->LeftEdge);
471 nsoption_set_int(window_y, ami_gui2_get_window(gwin)->TopEdge);
472 nsoption_set_int(window_width, ami_gui2_get_window(gwin)->Width);
473 nsoption_set_int(window_height, ami_gui2_get_window(gwin)->Height);
474}
475
476HOOKF(void, ami_menu_item_settings_save, APTR, window, struct IntuiMessage *)
477{
479}
480
481HOOKF(void, ami_menu_item_arexx_execute, APTR, window, struct IntuiMessage *)
482{
483 char *temp;
484 struct gui_window_2 *gwin;
485 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
486
487 if(AslRequestTags(filereq,
488 ASLFR_Window, ami_gui2_get_window(gwin),
489 ASLFR_SleepWindow, TRUE,
490 ASLFR_TitleText, messages_get("NetSurf"),
491 ASLFR_Screen, ami_gui_get_screen(),
492 ASLFR_DoSaveMode, FALSE,
493 ASLFR_InitialDrawer, nsoption_charp(arexx_dir),
494 ASLFR_InitialPattern, "#?.nsrx",
495 TAG_DONE)) {
496 if((temp = malloc(1024))) {
497 strlcpy(temp, filereq->fr_Drawer, 1024);
498 AddPart(temp, filereq->fr_File, 1024);
500 free(temp);
501 }
502 }
503}
504
505HOOKF(void, ami_menu_item_arexx_entries, APTR, window, struct IntuiMessage *)
506{
507 char *script = hook->h_Data;
508 char *temp;
509 struct gui_window_2 *gwin;
510 GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
511
512 if(script) {
513 if((temp = malloc(1024))) {
514 BPTR lock;
515 if((lock = Lock(nsoption_charp(arexx_dir), SHARED_LOCK))) {
516 DevNameFromLock(lock, temp, 1024, DN_FULLPATH);
517 AddPart(temp, script, 1024);
519 UnLock(lock);
520 }
521 free(temp);
522 }
523 }
524}
525
526/* normal GUI-specific menu functions */
527
528ULONG ami_gui_menu_number(int item)
529{
530 /* horrible, horrible, horrible */
531 ULONG menu_num;
532
533 switch(item) {
534 case M_SAVETXT:
535 menu_num = FULLMENUNUM(0,4,1);
536 break;
537
538 case M_SAVECOMP:
539 menu_num = FULLMENUNUM(0,4,2);
540 break;
541
542 case M_SAVEIFF:
543 menu_num = FULLMENUNUM(0,4,3);
544 break;
545#ifdef WITH_PDF_EXPORT
546 case M_SAVEPDF:
547 menu_num = FULLMENUNUM(0,4,4);
548 break;
549#endif
550 case M_CLOSETAB:
551 menu_num = FULLMENUNUM(0,8,0);
552 break;
553
554 case M_CUT:
555 menu_num = FULLMENUNUM(1,0,0);
556 break;
557
558 case M_COPY:
559 menu_num = FULLMENUNUM(1,1,0);
560 break;
561
562 case M_PASTE:
563 menu_num = FULLMENUNUM(1,2,0);
564 break;
565
566 case M_SELALL:
567 menu_num = FULLMENUNUM(1,4,0);
568 break;
569
570 case M_CLEAR:
571 menu_num = FULLMENUNUM(1,5,0);
572 break;
573
574 case M_UNDO:
575 menu_num = FULLMENUNUM(1,8,0);
576 break;
577
578 case M_REDO:
579 menu_num = FULLMENUNUM(1,9,0);
580 break;
581
582 case M_FIND:
583 menu_num = FULLMENUNUM(2,0,0);
584 break;
585
586 case M_IMGFORE:
587 menu_num = FULLMENUNUM(2,8,0);
588 break;
589
590 case M_IMGBACK:
591 menu_num = FULLMENUNUM(2,8,1);
592 break;
593
594 case M_JS:
595 menu_num = FULLMENUNUM(2,9,0);
596 break;
597
598 case M_CSS:
599 menu_num = FULLMENUNUM(2,10,0);
600 break;
601
602 default:
603 NSLOG(netsurf, INFO,
604 "WARNING: Unrecognised menu item %d", item);
605 menu_num = 0;
606 break;
607 }
608
609 return menu_num;
610}
611
612#ifdef __amigaos4__
613static void ami_gui_menu_set_checked_mc(struct Menu *menu, int item, bool check)
614{
615 ULONG check_state = MS_CHECKED;
616
617 if(check == false) {
618 check_state = 0;
619 }
620
621 if(menu == NULL) {
622 menu = gui_menu;
623 }
624
625 IDoMethod((Object *)menu, MM_SETSTATE, 0, item, MS_CHECKED, check_state);
626}
627#endif
628
629static void ami_gui_menu_set_checked_gt(struct Menu *menu, int item, bool check)
630{
631 if(menu == NULL) {
632 return;
633 }
634
635 if(check == true) {
636 if((ItemAddress(menu, ami_gui_menu_number(item))->Flags & CHECKED) == 0)
637 ItemAddress(menu, ami_gui_menu_number(item))->Flags ^= CHECKED;
638 } else {
639 if(ItemAddress(menu, ami_gui_menu_number(item))->Flags & CHECKED)
640 ItemAddress(menu, ami_gui_menu_number(item))->Flags ^= CHECKED;
641 }
642}
643
644void ami_gui_menu_set_checked(struct Menu *menu, int item, bool check)
645{
646 if(LIB_IS_AT_LEAST((struct Library *)IntuitionBase, 54, 6)) {
647#ifdef __amigaos4__
648 return ami_gui_menu_set_checked_mc(menu, item, check);
649#endif
650 } else {
651 return ami_gui_menu_set_checked_gt(menu, item, check);
652 }
653}
654
655#ifdef __amigaos4__
656static void ami_gui_menu_set_disabled_mc(struct Window *win, struct Menu *menu, int item, bool disable)
657{
658 ULONG disable_state = MS_DISABLED;
659
660 if(disable == false) {
661 disable_state = 0;
662 }
663
664 IDoMethod((Object *)menu, MM_SETSTATE, 0, item, MS_DISABLED, disable_state);
665}
666#endif
667
668static void ami_gui_menu_set_disabled_gt(struct Window *win, struct Menu *menu, int item, bool disable)
669{
670 ULONG menu_num = ami_gui_menu_number(item);
671
672 if(disable == false) {
673 OnMenu(win, menu_num);
674 } else {
675 OffMenu(win, menu_num);
676 }
677}
678
679void ami_gui_menu_set_disabled(struct Window *win, struct Menu *menu, int item, bool disable)
680{
681 if(LIB_IS_AT_LEAST((struct Library *)IntuitionBase, 54, 6)) {
682#ifdef __amigaos4__
683 return ami_gui_menu_set_disabled_mc(win, menu, item, disable);
684#endif
685 } else {
686 return ami_gui_menu_set_disabled_gt(win, menu, item, disable);
687 }
688}
689
690
692{
693 if(LIB_IS_AT_LEAST((struct Library *)IntuitionBase, 54, 6)) {
694 /* Irrelevant when using MenuClass */
695 return;
696 }
697
698 struct Menu *menustrip;
699
700 GetAttr(WINDOW_MenuStrip, ami_gui2_get_object(gwin, AMI_WIN_MAIN), (ULONG *)&menustrip);
701 if(!menustrip) return;
702 if(nsoption_bool(enable_javascript) == true) {
703 if((ItemAddress(menustrip, ami_gui_menu_number(M_JS))->Flags & CHECKED) == 0)
704 ItemAddress(menustrip, ami_gui_menu_number(M_JS))->Flags ^= CHECKED;
705 } else {
706 if(ItemAddress(menustrip, ami_gui_menu_number(M_JS))->Flags & CHECKED)
707 ItemAddress(menustrip, ami_gui_menu_number(M_JS))->Flags ^= CHECKED;
708 }
709 if(nsoption_bool(author_level_css) == true) {
710 if((ItemAddress(menustrip, ami_gui_menu_number(M_CSS))->Flags & CHECKED) == 0)
711 ItemAddress(menustrip, ami_gui_menu_number(M_CSS))->Flags ^= CHECKED;
712 } else {
713 if(ItemAddress(menustrip, ami_gui_menu_number(M_CSS))->Flags & CHECKED)
714 ItemAddress(menustrip, ami_gui_menu_number(M_CSS))->Flags ^= CHECKED;
715 }
716 if(nsoption_bool(foreground_images) == true) {
717 if((ItemAddress(menustrip, ami_gui_menu_number(M_IMGFORE))->Flags & CHECKED) == 0)
718 ItemAddress(menustrip, ami_gui_menu_number(M_IMGFORE))->Flags ^= CHECKED;
719 } else {
720 if(ItemAddress(menustrip, ami_gui_menu_number(M_IMGFORE))->Flags & CHECKED)
721 ItemAddress(menustrip, ami_gui_menu_number(M_IMGFORE))->Flags ^= CHECKED;
722 }
723
724 if(nsoption_bool(background_images) == true) {
725 if((ItemAddress(menustrip, ami_gui_menu_number(M_IMGBACK))->Flags & CHECKED) == 0)
726 ItemAddress(menustrip, ami_gui_menu_number(M_IMGBACK))->Flags ^= CHECKED;
727 } else {
728 if(ItemAddress(menustrip, ami_gui_menu_number(M_IMGBACK))->Flags & CHECKED)
729 ItemAddress(menustrip, ami_gui_menu_number(M_IMGBACK))->Flags ^= CHECKED;
730 }
731
732 ResetMenuStrip(ami_gui2_get_window(gwin), menustrip);
733}
734
736{
737 struct Window *win = ami_gui_get_window(g);
738
739 if(nsoption_bool(kiosk_mode) == true) return;
740
742 {
745#ifdef WITH_PDF_EXPORT
746 ami_gui_menu_set_disabled(win, ami_gui_get_menu(g), M_SAVEPDF, false);
747#endif
748#if 0
750 OnMenu(win,AMI_MENU_COPY);
751 OnMenu(win,AMI_MENU_CLEAR);
752 } else {
753 OffMenu(win,AMI_MENU_COPY);
754 OffMenu(win,AMI_MENU_CLEAR);
755 }
756
758 OnMenu(win,AMI_MENU_CUT);
759 else
760 OffMenu(win,AMI_MENU_CUT);
761
763 OnMenu(win,AMI_MENU_PASTE);
764 else
765 OffMenu(win,AMI_MENU_PASTE);
766#else
771#endif
775 }
776 else
777 {
781
784#ifdef WITH_PDF_EXPORT
785 ami_gui_menu_set_disabled(win, ami_gui_get_menu(g), M_SAVEPDF, true);
786#endif
787
790
791#ifdef WITH_NS_SVG
792 if(content_get_bitmap(c) || (ami_mime_compare(c, "svg") == true))
793#else
794 if(content_get_bitmap(c))
795#endif
796 {
799 }
800 else
801 {
804 }
805 }
806}
807
809{
810 if(LIB_IS_AT_LEAST((struct Library *)IntuitionBase, 54, 6)) {
811 /* Irrelevant when using MenuClass */
812 return;
813 }
814
816}
817
819{
820 if(LIB_IS_AT_LEAST((struct Library *)IntuitionBase, 54, 6)) {
821 /* Irrelevant when using MenuClass */
822 return false;
823 }
824
825 bool check_toggled = ami_menu_check_toggled;
827 return check_toggled;
828}
829
831{
832 /**\todo Rewrite this to not use ExAll() **/
833 int item = AMI_MENU_AREXX;
834 BPTR lock = 0;
835 UBYTE *buffer;
836 struct ExAllControl *ctrl;
837 char matchpatt[16];
838 LONG cont;
839 struct ExAllData *ead;
840 char *menu_lab;
841
842 if((lock = Lock(nsoption_charp(arexx_dir), SHARED_LOCK))) {
843 if((buffer = malloc(1024))) {
844 if((ctrl = AllocDosObject(DOS_EXALLCONTROL,NULL))) {
845 ctrl->eac_LastKey = 0;
846
847 if(ParsePatternNoCase("#?.nsrx",(char *)&matchpatt,16) != -1) {
848 ctrl->eac_MatchString = (char *)&matchpatt;
849 }
850
851 do {
852 cont = ExAll(lock,(struct ExAllData *)buffer,1024,ED_COMMENT,ctrl);
853 if((!cont) && (IoErr() != ERROR_NO_MORE_ENTRIES)) break;
854 if(!ctrl->eac_Entries) continue;
855
856 for(ead = (struct ExAllData *)buffer; ead; ead = ead->ed_Next) {
857 if(item >= AMI_MENU_AREXX_MAX) continue;
858 if(EAD_IS_FILE(ead)) {
859 if(ead->ed_Comment[0] != '\0')
860 menu_lab = ead->ed_Comment;
861 else
862 menu_lab = ead->ed_Name;
863
864 ami_menu_alloc_item(md, item, NM_ITEM, menu_lab, NULL, NSA_SPACE,
865 ami_menu_item_arexx_entries, (void *)strdup(ead->ed_Name), 0);
866
867 item++;
868 }
869 }
870 } while(cont);
871 FreeDosObject(DOS_EXALLCONTROL,ctrl);
872 }
873 free(buffer);
874 }
875 UnLock(lock);
876 }
877
878 ami_menu_alloc_item(md, item, NM_END, NULL, NULL, NULL, NULL, NULL, 0);
879}
880
881static bool ami_menu_hotlist_add(void *userdata, int level, int item, const char *title, nsurl *url, bool is_folder)
882{
883 UBYTE type;
884 STRPTR icon;
885 UWORD flags = 0;
886 struct ami_menu_data **md = (struct ami_menu_data **)userdata;
887
888 if(item >= AMI_MENU_HOTLIST_MAX) return false;
889
890 switch(level) {
891 case 1:
892 type = NM_ITEM;
893 break;
894 case 2:
895 type = NM_SUB;
896 break;
897 default:
898 if(LIB_IS_AT_LEAST((struct Library *)IntuitionBase, 54, 6)) {
899 type = NM_SUB + (level - 2);
900 } else {
901 /* entries not at level 1 or 2 are not able to be added */
902 return false;
903 }
904 break;
905 }
906
907 if(is_folder == true) {
908 icon = ASPrintf("icons/directory.png");
909 } else {
910 icon = ami_gui_get_cache_favicon_name(url, true);
911 if (icon == NULL) icon = ASPrintf("icons/content.png");
912 }
913
914 if(!LIB_IS_AT_LEAST((struct Library *)IntuitionBase, 54, 6)) {
915 if((is_folder == true) && (type == NM_SUB)) {
916 flags = NM_ITEMDISABLED;
917 }
918 }
919
920 ami_menu_alloc_item(md, item, type, title,
921 NULL, icon, ami_menu_item_hotlist_entries, (void *)url, flags);
922
923 if(icon) FreeVec(icon);
924
925 return true;
926}
927
929{
930 ami_menu_alloc_item(md, M_HLADD, NM_ITEM, "HotlistAdd", "B", "TBImages:list_favouriteadd",
931 ami_menu_item_hotlist_add, NULL, 0);
932 ami_menu_alloc_item(md, M_HLSHOW, NM_ITEM,"HotlistShowNS", "H", "TBImages:list_favourite",
933 ami_menu_item_hotlist_show, NULL, 0);
934 ami_menu_alloc_item(md, M_BAR_H1, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
935
936 return ami_hotlist_scan((void *)md, AMI_MENU_HOTLIST, messages_get("HotlistMenu"), ami_menu_hotlist_add);
937}
938
939static void ami_init_menulabs(struct ami_menu_data **md)
940{
941 UWORD js_flags = CHECKIT | MENUTOGGLE;
942 if(nsoption_bool(enable_javascript) == true)
943 js_flags |= CHECKED;
944
945 UWORD css_flags = CHECKIT | MENUTOGGLE;
946 if(nsoption_bool(author_level_css) == true)
947 css_flags |= CHECKED;
948
949 UWORD imgfore_flags = CHECKIT | MENUTOGGLE;
950 if(nsoption_bool(foreground_images) == true)
951 imgfore_flags |= CHECKED;
952
953 UWORD imgback_flags = CHECKIT | MENUTOGGLE;
954 if(nsoption_bool(background_images) == true)
955 imgback_flags |= CHECKED;
956
957 ami_menu_alloc_item(md, M_PROJECT, NM_TITLE, "Project", NULL, NULL, NULL, NULL, 0);
958 ami_menu_alloc_item(md, M_NEWWIN, NM_ITEM, "NewWindowNS", "N", "TBImages:list_app",
959 ami_menu_item_project_newwin, NULL, 0);
960 ami_menu_alloc_item(md, M_NEWTAB, NM_ITEM, "NewTab", "T", "TBImages:list_tab",
961 ami_menu_item_project_newtab, NULL, 0);
962 ami_menu_alloc_item(md, M_BAR_P1, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
963 ami_menu_alloc_item(md, M_OPEN, NM_ITEM, "OpenFile", "O", "TBImages:list_folder_misc",
964 ami_menu_item_project_open, NULL, 0);
965 ami_menu_alloc_item(md, M_SAVEAS, NM_ITEM, "SaveAsNS", NULL, "TBImages:list_saveas", NULL, NULL, 0);
966 ami_menu_alloc_item(md, M_SAVESRC, NM_SUB, "Source", "S", NULL,
967 ami_menu_item_project_save, (void *)AMINS_SAVE_SOURCE, 0);
968 ami_menu_alloc_item(md, M_SAVETXT, NM_SUB, "TextNS", NULL, NULL,
969 ami_menu_item_project_save, (void *)AMINS_SAVE_TEXT, 0);
970 ami_menu_alloc_item(md, M_SAVECOMP, NM_SUB, "SaveCompNS", NULL, NULL,
971 ami_menu_item_project_save, (void *)AMINS_SAVE_COMPLETE, 0);
972#ifdef WITH_PDF_EXPORT
973 ami_menu_alloc_item(md, M_SAVEPDF, NM_SUB, "PDFNS", NULL, NULL,
974 ami_menu_item_project_save, (void *)AMINS_SAVE_PDF, 0);
975#endif
976 ami_menu_alloc_item(md, M_SAVEIFF, NM_SUB, "IFF", NULL, NULL,
977 ami_menu_item_project_save, (void *)AMINS_SAVE_IFF, 0);
978 ami_menu_alloc_item(md, M_BAR_P2, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
979 ami_menu_alloc_item(md, M_PRINT, NM_ITEM, "PrintNS", "P", "TBImages:list_print",
980 ami_menu_item_project_print, NULL, NM_ITEMDISABLED);
981 ami_menu_alloc_item(md, M_BAR_P3, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
982 ami_menu_alloc_item(md, M_CLOSETAB, NM_ITEM, "CloseTab", "K", "TBImages:list_remove",
983 ami_menu_item_project_closetab, NULL, 0);
984 ami_menu_alloc_item(md, M_CLOSEWIN, NM_ITEM, "CloseWindow", NULL, "TBImages:list_cancel",
985 ami_menu_item_project_closewin, NULL, 0);
986 ami_menu_alloc_item(md, M_BAR_P4, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
987 ami_menu_alloc_item(md, M_ABOUT, NM_ITEM, "About", "?", "TBImages:list_info",
988 ami_menu_item_project_about, NULL, 0);
989 ami_menu_alloc_item(md, M_BAR_P5, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
990 ami_menu_alloc_item(md, M_QUIT, NM_ITEM, "Quit", "Q", "TBImages:list_warning",
991 ami_menu_item_project_quit, NULL, 0);
992
993 ami_menu_alloc_item(md, M_EDIT, NM_TITLE, "Edit", NULL, NULL, NULL, NULL, 0);
994 ami_menu_alloc_item(md, M_CUT, NM_ITEM, "CutNS", "X", "TBImages:list_cut",
995 ami_menu_item_edit_cut, NULL, 0);
996 ami_menu_alloc_item(md, M_COPY, NM_ITEM, "CopyNS", "C", "TBImages:list_copy",
997 ami_menu_item_edit_copy, NULL, 0);
998 ami_menu_alloc_item(md, M_PASTE, NM_ITEM, "PasteNS", "V", "TBImages:list_paste",
999 ami_menu_item_edit_paste, NULL, 0);
1000 ami_menu_alloc_item(md, M_BAR_E1, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
1001 ami_menu_alloc_item(md, M_SELALL, NM_ITEM, "SelectAllNS", "A", NSA_SPACE,
1002 ami_menu_item_edit_selectall, NULL, 0);
1003 ami_menu_alloc_item(md, M_CLEAR, NM_ITEM, "ClearNS", NULL, NSA_SPACE,
1004 ami_menu_item_edit_clearsel, NULL, 0);
1005 ami_menu_alloc_item(md, M_BAR_E2, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
1006 ami_menu_alloc_item(md, M_UNDO, NM_ITEM, "Undo", "Z", "TBImages:list_undo",
1007 ami_menu_item_edit_undo, NULL, 0);
1008 ami_menu_alloc_item(md, M_REDO, NM_ITEM, "Redo", "Y", "TBImages:list_redo",
1009 ami_menu_item_edit_redo, NULL, 0);
1010
1011 ami_menu_alloc_item(md, M_BROWSER, NM_TITLE, "Browser", NULL, NULL, NULL, NULL, 0);
1012 ami_menu_alloc_item(md, M_FIND, NM_ITEM, "FindTextNS", "F", "TBImages:list_search",
1013 ami_menu_item_browser_find, NULL, 0);
1014 ami_menu_alloc_item(md, M_BAR_B1, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
1015 ami_menu_alloc_item(md, M_HISTLOCL, NM_ITEM, "HistLocalNS", NULL, "TBImages:list_history",
1016 ami_menu_item_browser_localhistory, NULL, 0);
1017 ami_menu_alloc_item(md, M_HISTGLBL, NM_ITEM, "HistGlobalNS", NULL, "TBImages:list_history",
1018 ami_menu_item_browser_globalhistory, NULL, 0);
1019 ami_menu_alloc_item(md, M_BAR_B2, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
1020 ami_menu_alloc_item(md, M_COOKIES, NM_ITEM, "ShowCookiesNS",NULL, "TBImages:list_internet",
1021 ami_menu_item_browser_cookies, NULL, 0);
1022 ami_menu_alloc_item(md, M_BAR_B3, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
1023 ami_menu_alloc_item(md, M_SCALE, NM_ITEM, "ScaleNS", NULL, "TBImages:list_preview", NULL, NULL, 0);
1024 ami_menu_alloc_item(md, M_SCALEDEC, NM_SUB, "ScaleDec", "-", "TBImages:list_zoom_out",
1025 ami_menu_item_browser_scale_decrease, NULL, 0);
1026 ami_menu_alloc_item(md, M_SCALENRM, NM_SUB, "ScaleNorm", "=", "TBImages:list_zoom_100",
1027 ami_menu_item_browser_scale_normal, NULL, 0);
1028 ami_menu_alloc_item(md, M_SCALEINC, NM_SUB, "ScaleInc", "+", "TBImages:list_zoom_in",
1029 ami_menu_item_browser_scale_increase, NULL, 0);
1030 ami_menu_alloc_item(md, M_IMAGES, NM_ITEM, "Images", NULL, "TBImages:list_image", NULL, NULL, 0);
1031 ami_menu_alloc_item(md, M_IMGFORE, NM_SUB, "ForeImg", NULL, NULL,
1032 ami_menu_item_browser_foreimg, NULL, imgfore_flags);
1033 ami_menu_alloc_item(md, M_IMGBACK, NM_SUB, "BackImg", NULL, NULL,
1034 ami_menu_item_browser_backimg, NULL, imgback_flags);
1035 ami_menu_alloc_item(md, M_JS, NM_ITEM, "EnableJS", NULL, NULL,
1036 ami_menu_item_browser_enablejs, NULL, js_flags);
1037 ami_menu_alloc_item(md, M_CSS, NM_ITEM, "EnableCSS", NULL, NULL,
1038 ami_menu_item_browser_enablecss, NULL, css_flags);
1039 ami_menu_alloc_item(md, M_BAR_B4, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
1040 ami_menu_alloc_item(md, M_REDRAW, NM_ITEM, "Redraw", NULL, "TBImages:list_wand",
1041 ami_menu_item_browser_redraw, NULL, 0);
1042
1043 ami_menu_alloc_item(md, M_HOTLIST, NM_TITLE, "Hotlist", NULL, NULL, NULL, NULL, 0);
1044 /* see ami_menu_scan for the rest of this menu */
1045
1046 ami_menu_alloc_item(md, M_PREFS, NM_TITLE, "Settings", NULL, NULL, NULL, NULL, 0);
1047 ami_menu_alloc_item(md, M_PREDIT, NM_ITEM, "SettingsEdit", NULL, "TBImages:list_prefs",
1048 ami_menu_item_settings_edit, NULL, 0);
1049 ami_menu_alloc_item(md, M_BAR_S1, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
1050 ami_menu_alloc_item(md, M_SNAPSHOT, NM_ITEM, "SnapshotWindow",NULL, "TBImages:list_hold",
1051 ami_menu_item_settings_snapshot, NULL, 0);
1052 ami_menu_alloc_item(md, M_PRSAVE, NM_ITEM, "SettingsSave", NULL, "TBImages:list_use",
1053 ami_menu_item_settings_save, NULL, 0);
1054
1055 ami_menu_alloc_item(md, M_AREXX, NM_TITLE, "ARexx", NULL, NULL, NULL, NULL, 0);
1056 ami_menu_alloc_item(md, M_AREXXEX, NM_ITEM, "ARexxExecute", "E", "TBImages:list_arexx",
1057 ami_menu_item_arexx_execute, NULL, 0);
1058 ami_menu_alloc_item(md, M_BAR_A1, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
1059 ami_menu_alloc_item(md, AMI_MENU_AREXX_MAX, NM_END, NULL, NULL, NULL, NULL, NULL, 0);
1060}
1061
1062struct Menu *ami_gui_menu_create(struct gui_window_2 *gwin)
1063{
1064 if(LIB_IS_AT_LEAST((struct Library *)IntuitionBase, 54, 6)) {
1065#ifdef __amigaos4__
1066 if(gui_menu != NULL) {
1067 ami_gui2_set_menu(gwin, gui_menu);
1068 gui_menu_count++;
1069 return gui_menu;
1070 }
1071 ami_init_menulabs(gui_menu_data);
1072 ami_menu_scan(gui_menu_data);
1073 ami_menu_arexx_scan(gui_menu_data);
1074 gui_menu = ami_menu_layout(gui_menu_data, AMI_MENU_AREXX_MAX);
1075
1076 ami_gui2_set_menu(gwin, gui_menu);
1077 gui_menu_count++;
1078 return gui_menu;
1079#endif
1080 } else {
1081 struct Menu *temp_menu;
1082 struct ami_menu_data **md = ami_gui2_get_menu_data(gwin);
1083
1085 ami_menu_scan(md);
1087 temp_menu = ami_menu_layout(md, AMI_MENU_AREXX_MAX);
1088 ami_gui2_set_menu(gwin, temp_menu);
1089 return temp_menu;
1090 }
1091
1092 return NULL; // shouldn't get this far
1093}
1094
1095static void ami_free_menulabs(struct ami_menu_data **md)
1096{
1097 int i;
1098
1099 for(i=0;i<=AMI_MENU_AREXX_MAX;i++) {
1100 if(md[i] == NULL) continue;
1101 if(md[i]->menulab &&
1102 (md[i]->menulab != NM_BARLABEL) &&
1103 (md[i]->menulab != ML_SEPARATOR)) {
1104 if(md[i]->menutype & MENU_IMAGE) {
1105 if(md[i]->menuobj) DisposeObject(md[i]->menuobj);
1106 }
1107
1108 ami_utf8_free(md[i]->menulab);
1109
1110 if(i >= AMI_MENU_AREXX) {
1111 if(md[i]->menu_hook.h_Data) free(md[i]->menu_hook.h_Data);
1112 md[i]->menu_hook.h_Data = NULL;
1113 }
1114 }
1115
1116 if(md[i]->menukey != NULL) free(md[i]->menukey);
1117
1118 md[i]->menulab = NULL;
1119 md[i]->menuobj = NULL;
1120 md[i]->menukey = NULL;
1121 md[i]->menutype = 0;
1122 free(md[i]);
1123 md[i] = NULL;
1124 }
1125}
1126
1127void ami_gui_menu_freemenus(struct Menu *menu, struct ami_menu_data **md)
1128{
1129 if(menu != NULL) {
1130 FreeMenus(menu);
1131 }
1132
1133 if(md != NULL) {
1135 }
1136}
1137
1139{
1140 if(LIB_IS_AT_LEAST((struct Library *)IntuitionBase, 54, 6)) {
1141#ifdef __amigaos4__
1142 gui_menu_count--;
1143
1144 SetAttrs(ami_gui2_get_object(gwin, AMI_WIN_MAIN), WINDOW_MenuStrip, NULL, TAG_DONE);
1145
1146 if(gui_menu_count == 0) {
1147 ami_free_menulabs(gui_menu_data);
1148 // if we detach our menu from the window we need to do this manually
1149 DisposeObject((Object *)gui_menu);
1150 gui_menu = NULL;
1151 }
1152#endif
1153 } else {
1154 ami_gui2_set_menu(gwin, NULL);
1155 }
1156}
1157
1159{
1160 return menu_quit;
1161}
1162
1164{
1165#ifdef __amigaos4__
1167#endif
1168}
1169
void gui_start_selection(struct gui_window *g)
Definition: clipboard.c:87
bool ami_easy_clipboard_bitmap(struct bitmap *bitmap)
Definition: clipboard.c:338
nserror ami_cookies_present(const char *search_term)
Open the cookie viewer.
Definition: cookies.c:348
bool ami_mime_compare(struct hlcache_handle *c, const char *type)
Compare the MIME type of an hlcache_handle to a DefIcons type.
Definition: filetype.c:614
struct Window * ami_gui_get_window(struct gui_window *gw)
Get window from gui_window.
Definition: gui.c:577
struct Screen * ami_gui_get_screen(void)
Get a pointer to the screen NetSurf is running on.
Definition: gui.c:404
void ami_gui2_set_new_content(struct gui_window_2 *gwin, bool new_content)
Set new_content in gui_window_2 Indicates the window needs redrawing.
Definition: gui.c:635
struct Menu * ami_gui_get_menu(struct gui_window *gw)
Get imenu from gui_window.
Definition: gui.c:583
void ami_set_pointer(struct gui_window_2 *gwin, gui_pointer_shape shape, bool update)
Definition: gui.c:689
void ami_gui_adjust_scale(struct gui_window *gw, float adjustment)
Adjust scale by specified amount.
Definition: gui.c:4373
struct browser_window * ami_gui2_get_browser_window(struct gui_window_2 *gwin)
Get browser window from gui_window_2.
Definition: gui.c:426
void ami_reset_pointer(struct gui_window_2 *gwin)
Definition: gui.c:697
struct ami_menu_data ** ami_gui2_get_menu_data(struct gui_window_2 *gwin)
Get menu_data from gui_window_2.
Definition: gui.c:599
nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin)
Definition: gui.c:4392
void ami_gui2_set_menu(struct gui_window_2 *gwin, struct Menu *menu)
Set imenu to gui_window_2.
Definition: gui.c:590
void ami_gui2_set_closed(struct gui_window_2 *gwin, bool closed)
Set closed in gui_window_2.
Definition: gui.c:629
Object * ami_gui2_get_object(struct gui_window_2 *gwin, int object_type)
Get object from gui_window.
Definition: gui.c:535
struct gui_window * ami_gui2_get_gui_window(struct gui_window_2 *gwin)
Get gui_window from gui_window_2.
Definition: gui.c:444
void ami_gui_set_scale(struct gui_window *gw, float scale)
Set the scale of a gui window.
Definition: gui.c:4367
void ami_gui_update_hotlist_button(struct gui_window_2 *gwin)
Definition: gui.c:3991
void ami_schedule_redraw(struct gui_window_2 *gwin, bool full_redraw)
Schedule a redraw of the browser window - Amiga-specific function.
Definition: gui.c:5642
struct Window * ami_gui2_get_window(struct gui_window_2 *gwin)
Get window from gui_window_2.
Definition: gui.c:571
struct browser_window * ami_gui_get_browser_window(struct gui_window *gw)
Get browser window from gui_window.
Definition: gui.c:420
char * ami_gui_get_cache_favicon_name(nsurl *url, bool only_if_avail)
Definition: gui.c:3961
@ AMI_WIN_MAIN
Definition: gui.h:47
nserror ami_history_global_present(void)
Open the global history viewer.
Definition: history.c:422
void ami_menu_refresh(struct Menu *menu, struct ami_menu_data **md, int menu_item, int max, nserror(*cb)(struct ami_menu_data **md))
Definition: menu.c:440
struct Menu * ami_menu_layout(struct ami_menu_data **md, int max)
Definition: menu.c:419
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
bool ami_menu_get_selected(struct Menu *menu, struct IntuiMessage *msg)
Get the selected state of a menu item.
Definition: menu.c:63
#define NSA_SPACE
empty space
Definition: menu.h:37
nserror amiga_warn_user(const char *warning, const char *detail)
Warn the user of an event.
Definition: misc.c:79
void ami_arexx_execute(char *script)
Definition: arexx.c:172
Browser window creation and manipulation interface.
bool browser_window_can_select(struct browser_window *bw)
Find out if given browser window content is selectable.
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.
bool browser_window_has_content(struct browser_window *bw)
Find out if a browser window is currently showing a content.
void browser_window_destroy(struct browser_window *bw)
Close and destroy a browser window.
@ BW_EDITOR_CAN_PASTE
Can paste, input.
@ BW_EDITOR_CAN_CUT
Selection not read-only.
@ BW_EDITOR_CAN_COPY
Have selection.
struct nsurl * browser_window_access_url(const struct browser_window *bw)
Access a browser window's URL.
const char * browser_window_get_title(struct browser_window *bw)
Get the title of a browser_window.
nserror browser_window_create(enum browser_window_create_flags flags, struct nsurl *url, struct nsurl *referrer, struct browser_window *existing, struct browser_window **bw)
Create and open a new root browser window with the given page.
struct hlcache_handle * browser_window_get_content(struct browser_window *bw)
Get a cache handle for the content within a browser window.
browser_editor_flags browser_window_get_editor_flags(struct browser_window *bw)
Check whether browser window can accept a cut/copy/paste, or has a selection that could be saved.
@ BW_CREATE_HISTORY
this will form a new history node (don't set for back/reload/etc)
@ BW_NAVIGATE_HISTORY
this will form a new history node (don't set for back/reload/etc)
static osspriteop_area * buffer
The buffer characteristics.
Definition: buffer.c:55
@ CONTENT_CSS
content is CSS
Definition: content_type.h:64
nserror hotlist_add_url(nsurl *url)
Add an entry to the hotlist for given URL.
Definition: hotlist.c:1430
nserror
Enumeration of error codes.
Definition: errors.h:29
@ NSERROR_OK
No error.
Definition: errors.h:30
const char * type
Definition: filetype.cpp:44
void ami_bitmap_set_url(struct bitmap *bm, struct nsurl *url)
Set bitmap URL.
Definition: bitmap.c:734
void ami_bitmap_set_title(struct bitmap *bm, const char *title)
Set bitmap title.
Definition: bitmap.c:740
void ami_file_save_req(int type, struct gui_window_2 *gwin, struct hlcache_handle *object)
Definition: file.c:225
struct FileRequester * filereq
Definition: file.c:52
void ami_file_open(struct gui_window_2 *gwin)
Definition: file.c:83
@ AMINS_SAVE_IFF
Definition: file.h:32
@ AMINS_SAVE_PDF
Definition: file.h:31
@ AMINS_SAVE_TEXT
Definition: file.h:29
@ AMINS_SAVE_SOURCE
Definition: file.h:28
@ AMINS_SAVE_COMPLETE
Definition: file.h:30
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
nserror ami_hotlist_present(void)
Open the hotlist viewer.
Definition: hotlist.c:547
nserror ami_nsoption_write(void)
Definition: nsoption.c:34
void ami_print_ui(struct hlcache_handle *c)
Definition: print.c:243
void ami_search_open(struct gui_window *gwin)
Change the displayed search status.
Definition: search.c:140
void ami_utf8_free(char *ptr)
Definition: utf8.c:104
char * ami_utf8_easy(const char *string)
Definition: utf8.c:109
void ami_gui_menu_update_checked(struct gui_window_2 *gwin)
Definition: gui_menu.c:691
void ami_gui_menu_refresh_hotlist(void)
Refresh the Hotlist menu.
Definition: gui_menu.c:1163
void ami_gui_menu_update_disabled(struct gui_window *g, struct hlcache_handle *c)
Definition: gui_menu.c:735
HOOKF(void, ami_menu_item_project_newwin, APTR, window, struct IntuiMessage *)
Definition: gui_menu.c:102
static nserror ami_menu_scan(struct ami_menu_data **md)
Definition: gui_menu.c:928
void ami_menu_arexx_scan(struct ami_menu_data **md)
Definition: gui_menu.c:830
static bool ami_menu_check_toggled
Definition: gui_menu.c:89
struct Menu * ami_gui_menu_create(struct gui_window_2 *gwin)
Definition: gui_menu.c:1062
void ami_gui_menu_set_check_toggled(void)
Sets that an item linked to a toggle menu item has been changed.
Definition: gui_menu.c:808
static void ami_gui_menu_set_checked_gt(struct Menu *menu, int item, bool check)
Definition: gui_menu.c:629
static void ami_init_menulabs(struct ami_menu_data **md)
Definition: gui_menu.c:939
static bool ami_menu_hotlist_add(void *userdata, int level, int item, const char *title, nsurl *url, bool is_folder)
Definition: gui_menu.c:881
static void ami_free_menulabs(struct ami_menu_data **md)
Definition: gui_menu.c:1095
bool ami_gui_menu_get_check_toggled(void)
Gets if the menu needs updating because an item linked to a toggle menu item has been changed.
Definition: gui_menu.c:818
void ami_gui_menu_freemenus(struct Menu *menu, struct ami_menu_data **md)
Frees a menu.
Definition: gui_menu.c:1127
bool ami_gui_menu_quit_selected(void)
Gets if NetSurf has been quit from the menu.
Definition: gui_menu.c:1158
ULONG ami_gui_menu_number(int item)
Definition: gui_menu.c:528
static void ami_gui_menu_set_disabled_gt(struct Window *win, struct Menu *menu, int item, bool disable)
Definition: gui_menu.c:668
void ami_gui_menu_free(struct gui_window_2 *gwin)
Definition: gui_menu.c:1138
void ami_gui_menu_set_disabled(struct Window *win, struct Menu *menu, int item, bool disable)
Set disabled state of a menu item almost generic, but not quite.
Definition: gui_menu.c:679
const char *const verdate
Definition: gui_menu.c:93
const char *const netsurf_version
User friendly version string.
Definition: gui_menu.c:92
void ami_gui_menu_set_checked(struct Menu *menu, int item, bool check)
Set checked state of a menu item almost generic, but not quite.
Definition: gui_menu.c:644
static bool menu_quit
Definition: gui_menu.c:90
@ M_SAVECOMP
Definition: gui_menu.h:39
@ M_BAR_A1
Definition: gui_menu.h:100
@ AMI_MENU_AREXX
Definition: gui_menu.h:101
@ M_PRSAVE
Definition: gui_menu.h:96
@ AMI_MENU_AREXX_MAX
Definition: gui_menu.h:102
@ M_QUIT
Definition: gui_menu.h:52
@ M_CLOSETAB
Definition: gui_menu.h:47
@ M_HISTGLBL
Definition: gui_menu.h:69
@ M_IMGFORE
Definition: gui_menu.h:78
@ M_SCALEDEC
Definition: gui_menu.h:74
@ M_PASTE
Definition: gui_menu.h:57
@ M_REDO
Definition: gui_menu.h:63
@ M_HISTLOCL
Definition: gui_menu.h:68
@ M_AREXXEX
Definition: gui_menu.h:99
@ M_NEWTAB
Definition: gui_menu.h:33
@ M_BAR_B2
Definition: gui_menu.h:70
@ M_REDRAW
Definition: gui_menu.h:83
@ M_SCALENRM
Definition: gui_menu.h:75
@ M_CLOSEWIN
Definition: gui_menu.h:48
@ M_BAR_E1
Definition: gui_menu.h:58
@ M_HOTLIST
Definition: gui_menu.h:85
@ M_PRINT
Definition: gui_menu.h:45
@ M_BAR_S1
Definition: gui_menu.h:94
@ M_EDIT
Definition: gui_menu.h:54
@ M_SNAPSHOT
Definition: gui_menu.h:95
@ M_IMAGES
Definition: gui_menu.h:77
@ M_HLSHOW
Definition: gui_menu.h:87
@ M_BAR_B1
Definition: gui_menu.h:67
@ M_SAVEIFF
Definition: gui_menu.h:40
@ M_SAVESRC
Definition: gui_menu.h:37
@ M_JS
Definition: gui_menu.h:80
@ M_IMGBACK
Definition: gui_menu.h:79
@ M_BAR_E2
Definition: gui_menu.h:61
@ M_BAR_B3
Definition: gui_menu.h:72
@ M_BAR_P1
Definition: gui_menu.h:34
@ M_PROJECT
Definition: gui_menu.h:31
@ M_BAR_H1
Definition: gui_menu.h:88
@ M_BAR_P2
Definition: gui_menu.h:44
@ M_OPEN
Definition: gui_menu.h:35
@ M_CSS
Definition: gui_menu.h:81
@ M_SELALL
Definition: gui_menu.h:59
@ M_UNDO
Definition: gui_menu.h:62
@ M_CUT
Definition: gui_menu.h:55
@ M_AREXX
Definition: gui_menu.h:98
@ M_PREDIT
Definition: gui_menu.h:93
@ M_NEWWIN
Definition: gui_menu.h:32
@ M_BROWSER
Definition: gui_menu.h:65
@ M_COOKIES
Definition: gui_menu.h:71
@ M_SCALE
Definition: gui_menu.h:73
@ M_CLEAR
Definition: gui_menu.h:60
@ M_ABOUT
Definition: gui_menu.h:50
@ M_BAR_P5
Definition: gui_menu.h:51
@ M_BAR_P4
Definition: gui_menu.h:49
@ M_FIND
Definition: gui_menu.h:66
@ M_SAVETXT
Definition: gui_menu.h:38
@ M_COPY
Definition: gui_menu.h:56
@ M_SCALEINC
Definition: gui_menu.h:76
@ AMI_MENU_HOTLIST_MAX
Definition: gui_menu.h:90
@ M_SAVEAS
Definition: gui_menu.h:36
@ M_BAR_B4
Definition: gui_menu.h:82
@ AMI_MENU_HOTLIST
Definition: gui_menu.h:89
@ M_HLADD
Definition: gui_menu.h:86
@ M_BAR_P3
Definition: gui_menu.h:46
@ M_PREFS
Definition: gui_menu.h:92
void ami_gui_opts_open(void)
Definition: gui_options.c:527
nserror ami_history_local_present(struct gui_window *gw)
Open the global history viewer.
Public content interface.
struct bitmap * content_get_bitmap(struct hlcache_handle *h)
Retrieve the bitmap contained in an image content.
Definition: content.c:1264
content_type content_get_type(struct hlcache_handle *h)
Retrieve computed type of content.
Definition: content.c:1061
Core mouse and pointer states.
@ GUI_POINTER_WAIT
Definition: mouse.h:127
Interface to platform-specific graphical user interface window operations.
Interface to key press operations.
@ NS_KEY_REDO
Definition: keypress.h:71
@ NS_KEY_SELECT_ALL
Definition: keypress.h:32
@ NS_KEY_PASTE
Definition: keypress.h:43
@ NS_KEY_COPY_SELECTION
Definition: keypress.h:33
@ NS_KEY_CUT_SELECTION
Definition: keypress.h:44
@ NS_KEY_UNDO
Definition: keypress.h:70
@ NS_KEY_CLEAR_SELECTION
Definition: keypress.h:45
bool browser_window_key_press(struct browser_window *bw, uint32_t key)
Handle key presses in a browser window.
Definition: textinput.c:107
#define NSLOG(catname, level, logmsg, args...)
Definition: log.h:116
const char * messages_get_errorcode(nserror code)
lookup of a message by errorcode from the standard Messages hash.
Definition: messages.c:248
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.
struct nsurl nsurl
NetSurf URL object.
Definition: nsurl.h:31
char * ASPrintf(const char *fmt,...)
Definition: os3support.c:139
Minimal compatibility header for AmigaOS 3.
#define LIB_IS_AT_LEAST(B, V, R)
Definition: os3support.h:55
#define DN_FULLPATH
Definition: os3support.h:123
#define IDoMethod
Definition: os3support.h:169
#define DevNameFromLock(A, B, C, D)
Definition: os3support.h:162
#define EAD_IS_FILE(E)
Definition: os3support.h:57
#define ML_SEPARATOR
Definition: os3support.h:127
Interface to utility string handling.
Object *restrict menuobj
Definition: menu.h:28
char *restrict menulab
Definition: menu.h:27
UBYTE menutype
Definition: menu.h:32
char *restrict menukey
Definition: menu.h:29
UWORD flags
Definition: menu.h:33
struct Hook menu_hook
Definition: menu.h:31
RISC OS wimp toolkit bitmap.
Definition: bitmap.c:68
Browser window data.
struct browser_window * bw
int temp
Definition: gui.c:264
struct Window * win
Definition: gui.c:248
first entry in window list
Definition: gui.c:297
High-level cache handle.
Definition: hlcache.c:66
Option reading and saving interface.
#define nsoption_charp(OPTION)
Get the value of a string option.
Definition: nsoption.h:331
#define nsoption_set_int(OPTION, VALUE)
set an integer option in the default table
Definition: nsoption.h:348
#define nsoption_set_bool(OPTION, VALUE)
set a boolean option in the default table
Definition: nsoption.h:344
#define nsoption_bool(OPTION)
Get the value of a boolean option.
Definition: nsoption.h:304
Interface to a number of general purpose functionality.
Version information interface.