28#include <proto/application.h>
31#include <proto/datatypes.h>
32#include <proto/diskfont.h>
34#include <proto/exec.h>
35#include <proto/graphics.h>
36#include <proto/icon.h>
37#include <proto/intuition.h>
38#include <proto/keymap.h>
39#include <proto/layers.h>
40#include <proto/locale.h>
41#include <proto/utility.h>
46#include <proto/bsdsocket.h>
47#define waitselect WaitSelect
51#include <datatypes/textclass.h>
52#include <devices/inputevent.h>
53#include <graphics/gfxbase.h>
54#include <graphics/rpattr.h>
56#include <diskfont/diskfonttag.h>
57#include <graphics/blitattr.h>
58#include <intuition/gui.h>
59#include <libraries/application.h>
60#include <libraries/keymap.h>
62#include <intuition/icclass.h>
63#include <intuition/screens.h>
64#include <libraries/gadtools.h>
65#include <workbench/workbench.h>
68#include <proto/bevel.h>
69#include <proto/bitmap.h>
70#include <proto/button.h>
71#include <proto/chooser.h>
72#include <proto/clicktab.h>
73#include <proto/label.h>
74#include <proto/layout.h>
75#include <proto/listbrowser.h>
76#include <proto/scroller.h>
77#include <proto/space.h>
78#include <proto/speedbar.h>
79#include <proto/string.h>
80#include <proto/window.h>
82#include <classes/window.h>
83#include <gadgets/button.h>
84#include <gadgets/chooser.h>
85#include <gadgets/clicktab.h>
86#include <gadgets/layout.h>
87#include <gadgets/listbrowser.h>
88#include <gadgets/scroller.h>
89#include <gadgets/space.h>
90#include <gadgets/speedbar.h>
91#include <gadgets/string.h>
92#include <images/bevel.h>
93#include <images/bitmap.h>
94#include <images/label.h>
96#include <reaction/reaction_macros.h>
166#define AMINS_SCROLLERPEN NUMDRIPENS
167#define NSA_KBD_SCROLL_PX 10
168#define NSA_MAX_HOTLIST_BUTTON_LEN 20
170#define SCROLL_TOP INT_MIN
171#define SCROLL_PAGE_UP (INT_MIN + 1)
172#define SCROLL_PAGE_DOWN (INT_MAX - 1)
173#define SCROLL_BOTTOM (INT_MAX)
176#define SIDEDOWN (IECODE_4TH_BUTTON)
177#define SIDEUP (IECODE_4TH_BUTTON | IECODE_UP_PREFIX)
178#define EXTRADOWN (IECODE_5TH_BUTTON)
179#define EXTRAUP (IECODE_5TH_BUTTON | IECODE_UP_PREFIX)
182#define NSA_QUAL_SHIFT (IEQUALIFIER_RSHIFT | IEQUALIFIER_LSHIFT)
183#define NSA_QUAL_ALT (IEQUALIFIER_RALT | IEQUALIFIER_LALT)
186#define NSA_STATUS_TEXT GA_Text
188#define NSA_STATUS_TEXT STRINGA_TextVal
192#define BOOL_MISMATCH(a,b) ((a == FALSE) && (b != FALSE)) || ((a != FALSE) && (b == FALSE))
194#define BOOL_MISMATCH(a,b) (1)
328static struct Screen *
scrn = NULL;
337static Class *urlStringClass;
355#define USERS_DIR "PROGDIR:Users"
362const char *
const versvn;
372 const char *restrict file,
const char *restrict map);
382HOOKF(
uint32, ami_set_favicon_render_hook, APTR, space,
struct gpRender *);
383HOOKF(
uint32, ami_set_throbber_render_hook, APTR, space,
struct gpRender *);
384HOOKF(
uint32, ami_gui_browser_render_hook, APTR, space,
struct gpRender *);
387#define nsoption_default_set_int(OPTION, VALUE) \
388 if (nsoptions_default[NSOPTION_##OPTION].value.i == nsoptions[NSOPTION_##OPTION].value.i) \
389 nsoptions[NSOPTION_##OPTION].value.i = VALUE; \
390 nsoptions_default[NSOPTION_##OPTION].value.i = VALUE
395 assert(
sport != NULL);
428 assert(gwin != NULL);
446 assert(gwin != NULL);
453 assert(gw->
shared != NULL);
471 assert(gwin != NULL);
477 assert(gwin != NULL);
539 assert(gwin != NULL);
541 switch(object_type) {
573 assert(gwin != NULL);
586 assert(gw->
shared != NULL);
601 assert(gwin != NULL);
607 assert(gwin != NULL);
613 assert(gwin != NULL);
619 assert(gwin != NULL);
625 assert(gwin != NULL);
631 assert(gwin != NULL);
637 assert(gwin != NULL);
644static void *ami_find_gwin_by_id(
struct Window *win,
uint32 type)
662 }
while((node = nnode));
672 LockLayerInfo(&
scrn->LayerInfo);
674 layer = WhichLayer(&
scrn->LayerInfo,
scrn->MouseX,
scrn->MouseY);
676 UnlockLayerInfo(&
scrn->LayerInfo);
678 if(layer)
return ami_find_gwin_by_id(layer->Window,
type);
705 struct Locale *locale;
706 STRPTR acceptlangs = NULL;
707 char *remapped = NULL;
709 if((locale = OpenLocale(NULL)))
711 if(codeset != NULL) *codeset = locale->loc_CodeSet;
713 for(
int i = 0; i < 10; i++)
715 if(locale->loc_PrefLanguages[i])
718 locale->loc_PrefLanguages[i],
"LangNames"))
722 STRPTR acceptlangs2 = acceptlangs;
723 acceptlangs =
ASPrintf(
"%s, %s",acceptlangs2, remapped);
724 FreeVec(acceptlangs2);
729 acceptlangs =
ASPrintf(
"%s", remapped);
732 if(remapped != NULL) free(remapped);
745 const char *restrict file,
const char *restrict map)
748 char *mapfile = NULL;
749 size_t mapfile_size = 0;
751 char *restrict realfname;
756 if(mapfile == NULL)
return false;
758 fh =
FOpen(mapfile, MODE_OLDFILE, 0);
761 while(FGets(fh,
buffer, 1024) != 0)
765 (
buffer[0] ==
'\0'))
continue;
767 realfname = strchr(
buffer,
':');
770 if(strncmp(
buffer, file, strlen(file)) == 0)
772 if(realfname[strlen(realfname)-1] ==
'\n')
773 realfname[strlen(realfname)-1] =
'\0';
774 *remapped = strdup(realfname + 1);
783 if(found ==
false) *remapped = strdup(file);
784 else NSLOG(netsurf, INFO,
785 "Remapped %s to %s in path %s using %s", file,
786 *remapped,
path, map);
798 size_t fullpath_len = 1024;
803 lock = Lock(fullpath, ACCESS_READ);
809 if(found)
NSLOG(netsurf, INFO,
"Found %s", fullpath);
817 struct Locale *locale;
820 char *remapped = NULL;
821 size_t fullpath_len = 1024;
828 if(found)
return true;
835 if(found)
return true;
840 locale = OpenLocale(NULL);
843 strcpy(fullpath,
"PROGDIR:Resources/");
845 if(locale->loc_PrefLanguages[i]) {
847 locale->loc_PrefLanguages[i],
"LangNames") ==
true) {
863 strcpy(fullpath,
"PROGDIR:Resources/en/");
872 strcpy(fullpath,
"PROGDIR:Resources/");
897 TAG_DONE)))
return false;
901 TAG_DONE)))
return false;
905 TAG_DONE)))
return false;
919 LONG scrollerfillpen = FALSE;
921 GetGUIAttrs(NULL, drinfo, GUIA_PropKnobColor, &scrollerfillpen, TAG_DONE);
923 if(scrollerfillpen)
return FILLPEN;
924 else return FOREGROUNDPEN;
937nscolour_from_pen(
struct Screen *screen, UWORD pen,
colour sel_colour)
940 struct DrawInfo *drinfo;
942 drinfo = GetScreenDrawInfo(screen);
944 if (drinfo != NULL) {
950 GetRGB32(screen->ViewPort.ColorMap,
951 drinfo->dri_Pens[pen],
956 sel_colour = ((colr[0] & 0xff000000) >> 24) |
957 ((colr[1] & 0xff000000) >> 16) |
958 ((colr[2] & 0xff000000) >> 8);
960 FreeScreenDrawInfo(screen, drinfo);
969static nserror system_colours_from_pen(
struct Screen *screen)
971 #define MAP_SIZE (19)
979 struct pcm pen_colour_map[MAP_SIZE] = {
980 {NSOPTION_sys_colour_AccentColor, FILLPEN, 0x00000000},
981 {NSOPTION_sys_colour_AccentColorText, TEXTPEN, 0x00000000},
982 {NSOPTION_sys_colour_ActiveText, TEXTPEN, 0x00000000},
983 {NSOPTION_sys_colour_ButtonBorder, FILLPEN, 0x00000000},
984 {NSOPTION_sys_colour_ButtonFace, FOREGROUNDPEN, 0x00aaaaaa},
985 {NSOPTION_sys_colour_ButtonText, TEXTPEN, 0x00000000},
986 {NSOPTION_sys_colour_Canvas, BACKGROUNDPEN, 0x00aaaaaa},
987 {NSOPTION_sys_colour_CanvasText, TEXTPEN, 0x00000000},
988 {NSOPTION_sys_colour_Field, BACKGROUNDPEN, 0x00aaaaaa},
989 {NSOPTION_sys_colour_FieldText, TEXTPEN, 0x00000000},
991 {NSOPTION_sys_colour_Highlight, SELECTPEN, 0x00ee0000},
992 {NSOPTION_sys_colour_HighlightText, SELECTTEXTPEN, 0x00000000},
993 {NSOPTION_sys_colour_LinkText, TEXTPEN, 0x00000000},
994 {NSOPTION_sys_colour_Mark, FILLPEN, 0x00000000},
995 {NSOPTION_sys_colour_MarkText, TEXTPEN, 0x00000000},
996 {NSOPTION_sys_colour_SelectedItem, FILLPEN, 0x00000000},
997 {NSOPTION_sys_colour_SelectedItemText, TEXTPEN, 0x00000000},
998 {NSOPTION_sys_colour_VisitedText, TEXTPEN, 0x00000000},
1002 for (mapidx=0; mapidx < MAP_SIZE; mapidx++) {
1003 entry = &pen_colour_map[mapidx];
1004 sel_colour = nscolour_from_pen(screen, entry->pen, entry->def_colour);
1036 system_colours_from_pen(screen);
1049 STRPTR tempacceptlangs;
1059 if(ClickTabBase->lib_Version < 53)
1069 (
char *)strdup(tempacceptlangs));
1070 FreeVec(tempacceptlangs);
1081 if(codeset == 0) codeset = 4;
1096 (
char *)strdup(temp));
1100 (
char *)strdup(temp));
1104 (
char *)strdup(temp));
1108 (
char *)strdup(temp));
1111 (
char *)strdup(
"PROGDIR:Resources/ca-bundle"));
1120 if((lock = Lock(
"FONTS:Code2000.otag", ACCESS_READ)))
1124 (
char *)strdup(
"Code2000"));
1126 else if((lock = Lock(
"FONTS:Bitstream Cyberbit.otag", ACCESS_READ)))
1130 (
char *)strdup(
"Bitstream Cyberbit"));
1140 if((lock = Lock(
"FONTS:Symbola.otag", ACCESS_READ))) {
1143 (
char *)strdup(
"Symbola"));
1156 if(((lock = Lock(
"ENVARC:AppPaths",SHARED_LOCK)) == 0))
1158 lock = CreateDir(
"ENVARC:AppPaths");
1163 if((lock = Lock(
"PROGDIR:", ACCESS_READ)))
1165 char filename[1024];
1170 if((amiupdatefh =
FOpen(
"ENVARC:AppPaths/NetSurf", MODE_NEWFILE, 0))) {
1171 FPuts(amiupdatefh, (CONST_STRPTR)&filename);
1192HOOKF(
void, ami_gui_newprefs_hook, APTR, window, APTR)
1215 struct ScreenModeRequester *screenmodereq = NULL;
1217 if((screenmodereq = AllocAslRequest(ASL_ScreenModeRequest,NULL))) {
1218 if(AslRequestTags(screenmodereq,
1223 char *modeid = malloc(20);
1224 id = screenmodereq->sm_DisplayID;
1225 sprintf(modeid,
"0x%lx",
id);
1229 FreeAslRequest(screenmodereq);
1235 scrn = OpenScreenTags(NULL,
1239 SA_Type, PUBLICSCREEN,
1240 SA_PubName,
"NetSurf",
1242 SA_PubTask, FindTask(0),
1243 SA_LikeWorkbench, TRUE,
1249 PubScreenStatus(
scrn,0);
1256 if((
scrn = LockPubScreen(
"NetSurf")))
1263 strdup(
"Workbench"));
1274 scrn = LockPubScreen(
"Workbench");
1292 int *restrict nargc,
char ** nargv)
1294 struct RDArgs *args;
1295 CONST_STRPTR
template =
"-v/S,NSOPTS/M,URL/K,USERSDIR/K,FORCE/S";
1296 long rarray[] = {0,0,0,0,0};
1306 if(*argc == 0)
return NULL;
1308 if((args = ReadArgs(
template, rarray, NULL))) {
1310 NSLOG(netsurf, INFO,
1311 "URL %s specified on command line",
1312 (
char *)rarray[A_URL]);
1316 if(rarray[A_USERSDIR]) {
1317 NSLOG(netsurf, INFO,
1318 "USERSDIR %s specified on command line",
1319 (
char *)rarray[A_USERSDIR]);
1323 if(rarray[A_FORCE]) {
1324 NSLOG(netsurf, INFO,
1325 "FORCE specified on command line");
1329 if(rarray[A_NSOPTS]) {
1345 NSLOG(netsurf, INFO,
"ReadArgs failed to parse command line");
1354 struct DiskObject *dobj;
1357 char *current_user = NULL;
1359 if((*wbarg->wa_Name) && (dobj = GetDiskObject(wbarg->wa_Name))) {
1360 toolarray = (STRPTR *)dobj->do_ToolTypes;
1362 if((s = (
char *)FindToolType(toolarray,
"USERSDIR")))
users_dir =
ASPrintf(
"%s", s);
1363 if((s = (
char *)FindToolType(toolarray,
"USER"))) current_user =
ASPrintf(
"%s", s);
1365 FreeDiskObject(dobj);
1367 return current_user;
1372 struct WBStartup *WBenchMsg;
1373 struct WBArg *wbarg;
1375 char *current_user = NULL;
1376 char *cur_user = NULL;
1379 WBenchMsg = (
struct WBStartup *)argv;
1380 for(i = 0, wbarg = WBenchMsg->sm_ArgList; i < WBenchMsg->sm_NumArgs; i++,wbarg++) {
1382 if((wbarg->wa_Lock) && (*wbarg->wa_Name))
1386 if(cur_user != NULL) {
1387 if(current_user != NULL) FreeVec(current_user);
1388 current_user = cur_user;
1395 return current_user;
1400 struct Screen *screen;
1401 BOOL notalreadyrunning;
1410 if((screen = LockPubScreen(
"Workbench"))) {
1412 UnlockPubScreen(NULL, screen);
1423 if (notalreadyrunning &&
1428 notalreadyrunning = TRUE;
1449 struct WBStartup *WBenchMsg = (
struct WBStartup *)argv;
1450 struct WBArg *wbarg;
1452 char fullpath[1024];
1454 for(i=0,wbarg=WBenchMsg->sm_ArgList;i<WBenchMsg->sm_NumArgs;i++,wbarg++)
1457 if((wbarg->wa_Lock)&&(*wbarg->wa_Name))
1460 AddPart(fullpath,wbarg->wa_Name,1024);
1470 if(notalreadyrunning)
1510 if(!notalreadyrunning)
1512 STRPTR sendcmd = NULL;
1513 char newtab[11] =
"\0";
1516 strcpy(newtab,
"TAB ACTIVE");
1540 ULONG noicon = TAG_IGNORE;
1543 noicon = REGAPP_NoIcon;
1546 REGAPP_URLIdentifier,
"netsurf-browser.org",
1547 REGAPP_WBStartup, (
struct WBStartup *)argv,
1549 REGAPP_HasPrefsWindow, TRUE,
1550 REGAPP_CanCreateNewDocs, TRUE,
1551 REGAPP_UniqueApplication, TRUE,
1559 REGAPP_URLIdentifier,
"netsurf-browser.org",
1560 REGAPP_FileName, argv[0],
1561 REGAPP_NoIcon, TRUE,
1562 REGAPP_HasPrefsWindow, TRUE,
1563 REGAPP_CanCreateNewDocs, TRUE,
1564 REGAPP_UniqueApplication, TRUE,
1591 long back=FALSE, forward=FALSE, tabclose=FALSE, stop=FALSE,
reload=FALSE;
1592 long s_back, s_forward, s_tabclose, s_stop, s_reload;
1607 if(gwin->
tabs <= 1) {
1622 gwin->
win, NULL, GA_Disabled, back, TAG_DONE);
1626 gwin->
win, NULL, GA_Disabled, forward, TAG_DONE);
1630 gwin->
win, NULL, GA_Disabled,
reload, TAG_DONE);
1634 gwin->
win, NULL, GA_Disabled, stop, TAG_DONE);
1636 if(ClickTabBase->lib_Version < 53) {
1637 if(gwin->
tabs <= 1) tabclose = TRUE;
1643 gwin->
win, NULL, GA_Disabled, tabclose, TAG_DONE);
1669 int nskey = 0, chars;
1673 if(keycode >= IECODE_UP_PREFIX)
return 0;
1755 if((chars = MapRawKey(ie,
buffer,20,NULL)) > 0) {
1760 if(ie->ie_Qualifier & IEQUALIFIER_RCOMMAND) {
1794 GetAttr(WINDOW_Qualifier, win_obj, (
uint32 *)&quals);
1796#warning qualifier needs fixing for OS3
1803 if(quals & IEQUALIFIER_CONTROL) {
1822 struct IBox *ib = AllocVec(
sizeof(
struct IBox),
MEMF_PRIVATE);
1826 GetAttr(SPACE_RenderBox, obj, (ULONG *)ib);
1831 GetAttr(SPACE_AreaBox, obj, (ULONG *)&t_ib);
1837 CopyMem(t_ib, ib,
sizeof(
struct IBox));
1848 if(bbox != NULL) FreeVec(bbox);
1852 int *restrict x,
int *restrict y,
int space_x,
int space_y)
1876 ns_x = (ULONG)(
mouse_x - bbox->Left);
1877 ns_y = (ULONG)(
mouse_y - bbox->Top);
1879 if((ns_x < 0) || (ns_x > bbox->Width) || (ns_y < 0) || (ns_y > bbox->Height)) {
1972 struct IBox *bbox, *ibox;
1974 ibox = malloc(
sizeof(
struct IBox));
1975 if(ibox == NULL)
return NULL;
1983 ibox->Left = gwin->
win->MouseX + (
rect->
x0);
1984 ibox->Top = gwin->
win->MouseY + (
rect->
y0);
1989 if(ibox->Left < bbox->Left) ibox->Left = bbox->Left;
1990 if(ibox->Top < bbox->Top) ibox->Top = bbox->Top;
1992 if((ibox->Left > (bbox->Left + bbox->Width)) ||
1993 (ibox->Top > (bbox->Top + bbox->Height)) ||
1994 (ibox->Width < 0) || (ibox->Height < 0))
2018 SetWindowAttrs(gwin->
win, WA_GrabFocus, 10,
2019 WA_MouseLimits, gwin->
ptr_lock, TAG_DONE);
2044 }
while((node = nnode));
2058 int *restrict
width,
2071 *
width = bbox->Width;
2083 struct TagItem attrs[2];
2087 attrs[0].ti_Tag = CHILD_MinWidth;
2088 attrs[0].ti_Data = 0;
2089 attrs[1].ti_Tag = TAG_DONE;
2090 attrs[1].ti_Data = 0;
2095 SCROLLER_Orientation, SORIENT_HORIZ,
2096 ICA_TARGET, ICTARGET_IDCMP,
2132 struct TagItem attrs[2];
2136 attrs[0].ti_Tag = CHILD_MinWidth;
2137 attrs[0].ti_Data = 0;
2138 attrs[1].ti_Tag = TAG_DONE;
2139 attrs[1].ti_Data = 0;
2144 ICA_TARGET, ICTARGET_IDCMP,
2185 int h = 1, w = 1, wh = 0, ww = 0;
2186 bool rethinkv =
false;
2187 bool rethinkh =
false;
2216 if(rethinkv || rethinkh) {
2219 gwin->
win, NULL, TRUE);
2247 struct TagItem attrs[2];
2251 attrs[0].ti_Tag = CHILD_MinHeight;
2252 attrs[0].ti_Data = 50;
2253 attrs[1].ti_Tag = TAG_DONE;
2254 attrs[1].ti_Data = 0;
2259 LISTBROWSER_ColumnTitles, TRUE,
2260 LISTBROWSER_Labels, &g->
loglist,
2321 LISTBROWSER_Labels, &g->
loglist,
2333 const char *src_text;
2334 const char *level_text;
2337 ULONG fgpen = TEXTPEN;
2338 ULONG lbflags = LBFLG_READONLY;
2339 char timestamp[256];
2340 time_t now = time(NULL);
2341 struct tm *timedata = localtime(&now);
2343 strftime(timestamp, 256,
"%c", timedata);
2345 if(foldable) lbflags |= LBFLG_HASCHILDREN;
2349 src_text =
"client-input";
2352 src_text =
"scripting-error";
2355 src_text =
"scripting-console";
2358 assert(0 &&
"Unknown scripting source");
2359 src_text =
"unknown";
2365 level_text =
"DEBUG";
2367 lbflags |= LBFLG_CUSTOMPENS;
2372 lbflags |= LBFLG_CUSTOMPENS;
2375 level_text =
"INFO";
2378 level_text =
"WARN";
2381 level_text =
"ERROR";
2385 assert(0 &&
"Unknown console logging level");
2386 level_text =
"unknown";
2392 LISTBROWSER_Labels, NULL,
2397 if((node = AllocListBrowserNode(4,
2398 LBNA_Flags, lbflags,
2402 LBNCA_CopyText, TRUE,
2403 LBNCA_Text, timestamp,
2407 LBNCA_CopyText, TRUE,
2408 LBNCA_Text, src_text,
2412 LBNCA_CopyText, TRUE,
2413 LBNCA_Text, level_text,
2417 LBNCA_CopyText, TRUE,
2425 LISTBROWSER_Labels, &g->
loglist,
2430 DebugPrintF(
"NETSURF: CONSOLE_LOG SOURCE %s %sFOLDABLE %s %.*s\n",
2431 src_text, foldable ?
"" :
"NOT-", level_text,
2442 struct BitMap *bm = NULL;
2444 struct bitmap *icon_bitmap = NULL;
2461 ULONG tag, tag_data, minterm;
2480 EraseRect(g->
shared->
win->RPort, bbox->Left, bbox->Top,
2481 bbox->Left + 16, bbox->Top + 16);
2484 BltBitMapTags(BLITA_SrcX, 0,
2486 BLITA_DestX, bbox->Left,
2487 BLITA_DestY, bbox->Top,
2492 BLITA_SrcType, BLITT_BITMAP,
2493 BLITA_DestType, BLITT_RASTPORT,
2494 BLITA_Minterm, minterm,
2499 BltMaskBitMapRastPort(bm, 0, 0, g->
shared->
win->RPort,
2500 bbox->Left, bbox->Top, 16, 16, minterm, tag_data);
2502 BltBitMapRastPort(bm, 0, 0, g->
shared->
win->RPort,
2503 bbox->Left, bbox->Top, 16, 16, 0xc0);
2523static ULONG ami_get_border_gadget_size(
struct gui_window_2 *gwin,
2526 static ULONG sz_gad_width = 0;
2527 static ULONG sz_gad_height = 0;
2528 ULONG available_width;
2530 if((sz_gad_width == 0) || (sz_gad_height == 0)) {
2531 struct DrawInfo *dri = GetScreenDrawInfo(
scrn);
2532 GetGUIAttrs(NULL, dri,
2533 GUIA_SizeGadgetWidth, &sz_gad_width,
2534 GUIA_SizeGadgetHeight, &sz_gad_height,
2536 FreeScreenDrawInfo(
scrn, dri);
2538 available_width = gwin->
win->Width -
scrn->WBorLeft - sz_gad_width;
2540 *
width = available_width;
2543 return sz_gad_width;
2553 ami_get_border_gadget_size(gwin, &size1, &size2);
2560 RefreshWindowFrame(gwin->
win);
2569 BOOL win_closed = FALSE;
2583 if(w == NULL)
continue;
2586 if((win_closed = w->
tbl->
event(w))) {
2597 }
while((node = nnode));
2616 struct InputEvent *ie;
2617 struct Node *tabnode;
2619 struct timeval curtime;
2620 static int drag_x_move = 0, drag_y_move = 0;
2623 BOOL win_closed = FALSE;
2626 switch(
result & WMHI_CLASSMASK)
2628 case WMHI_MOUSEMOVE:
2639 x = (ULONG)((gwin->
win->MouseX - bbox->Left));
2640 y = (ULONG)((gwin->
win->MouseY - bbox->Top));
2654 if((gwin->
win->MouseX < bbox->Left) &&
2656 drag_x_move = gwin->
win->MouseX - bbox->Left;
2657 if((gwin->
win->MouseX > (bbox->Left + bbox->Width)) &&
2659 drag_x_move = gwin->
win->MouseX - (bbox->Left + bbox->Width);
2660 if((gwin->
win->MouseY < bbox->Top) &&
2662 drag_y_move = gwin->
win->MouseY - bbox->Top;
2663 if((gwin->
win->MouseY > (bbox->Top + bbox->Height)) &&
2665 drag_y_move = gwin->
win->MouseY - (bbox->Top + bbox->Height);
2671 if((x>=xs) && (y>=ys) && (x<
width+xs) && (y<
height+ys))
2694 case WMHI_MOUSEBUTTONS:
2700 x = (ULONG)(gwin->
win->MouseX - bbox->Left);
2701 y = (ULONG)(gwin->
win->MouseY - bbox->Top);
2716 if((x>=xs) && (y>=ys) && (x<
width+xs) && (y<
height+ys))
2742 CurrentTime((ULONG *)&curtime.tv_sec, (ULONG *)&curtime.tv_usec);
2750 curtime.tv_sec, curtime.tv_usec)) {
2769 gwin->
lastclick.tv_sec = curtime.tv_sec;
2770 gwin->
lastclick.tv_usec = curtime.tv_usec;
2784 CurrentTime((ULONG *)&curtime.tv_sec, (ULONG *)&curtime.tv_usec);
2792 curtime.tv_sec, curtime.tv_usec)) {
2811 gwin->
lastclick.tv_sec = curtime.tv_sec;
2812 gwin->
lastclick.tv_usec = curtime.tv_usec;
2838 switch(
result & WMHI_GADGETMASK)
2842 if(ClickTabBase->lib_Version >= 53) {
2852 GetClickTabNodeAttrs(tabnode,
2853 TNA_UserData, &closedgw,
2858 GetAttr(CLICKTAB_CurrentNode, (Object *)gwin->
objects[
GID_TABS], (ULONG *)&tabnode);
2875 GetAttr(STRINGA_TextVal,
2907 if(storage != NULL) {
2908 GetChooserNodeAttrs((
struct Node *)storage, CNA_Text, (ULONG *)&prov, TAG_DONE);
2923 GetAttr(STRINGA_TextVal,
2996 ULONG w_top, w_left;
2997 ULONG g_top, g_left, g_height;
3008 NSLOG(netsurf, INFO,
"Unable to open page info window");
3014 GetAttr(STRINGA_TextVal,
3038 storage =
result & WMHI_GADGETMASK;
3039 if(storage >= IECODE_UP_PREFIX)
break;
3045 if((ie->ie_Qualifier & IEQUALIFIER_RCOMMAND) &&
3046 ((31 < nskey) && (nskey < 127))) {
3164 case WMHI_CLOSEWINDOW:
3171 struct bitmap *bm = NULL;
3177 HideWindow(gwin->
win);
3189 0, gwin->dobj, NULL);
3206 case WMHI_INTUITICK:
3223 if(drag_x_move || drag_y_move)
3239 if(gwin->
closed ==
true) {
3265 if((gwin == NULL) || (gwin->
gw != gw))
return NSERROR_OK;
3300 BUTTON_RenderImage, gwin->
objects[bm_idx],
3309 struct AppMessage *appmsg;
3312 struct WBArg *appwinargs;
3316 while((appmsg = (
struct AppMessage *)GetMsg(
appport)))
3320 if(appmsg->am_Type == AMTYPE_APPICON)
3324 ActivateWindow(gwin->
win);
3326 else if(appmsg->am_Type == AMTYPE_APPWINDOW)
3328 for(i = 0; i < appmsg->am_NumArgs; ++i)
3330 if((appwinargs = &appmsg->am_ArgList[i]))
3332 if((filename = malloc(1024)))
3334 if(appwinargs->wa_Lock)
3336 NameFromLock(appwinargs->wa_Lock, filename, 1024);
3339 AddPart(filename, appwinargs->wa_Name, 1024);
3342 appmsg->am_MouseX, appmsg->am_MouseY) ==
false)
3361 ActivateWindow(gwin->
win);
3397 ActivateWindow(gwin->
win);
3418 ReplyMsg((
struct Message *)appmsg);
3425 struct ApplicationMsg *applibmsg;
3432 while((applibmsg=(
struct ApplicationMsg *)GetMsg(
applibport)))
3434 switch (applibmsg->type)
3436 case APPLIBMT_NewBlankDoc:
3454 case APPLIBMT_OpenDoc:
3456 struct ApplicationOpenPrintDocMsg *applibopdmsg =
3457 (
struct ApplicationOpenPrintDocMsg *)applibmsg;
3474 case APPLIBMT_ToFront:
3477 ScreenToFront(
scrn);
3483 case APPLIBMT_OpenPrefs:
3484 ScreenToFront(
scrn);
3489 case APPLIBMT_ForceQuit:
3493 case APPLIBMT_CustomMsg:
3495 struct ApplicationCustomMsg *applibcustmsg =
3496 (
struct ApplicationCustomMsg *)applibmsg;
3497 NSLOG(netsurf, INFO,
3498 "Ringhio BackMsg received: %s",
3499 applibcustmsg->customMsg);
3505 ReplyMsg((
struct Message *)applibmsg);
3512 ULONG winsignal = 1L <<
sport->mp_SigBit;
3513 ULONG appsig = 1L <<
appport->mp_SigBit;
3515 ULONG ctrlcsig = SIGBREAKF_CTRL_C;
3517 fd_set read_fd_set, write_fd_set, except_fd_set;
3522 if(printmsgport) printsig = 1L << printmsgport->mp_SigBit;
3523 uint32 signalmask = winsignal | appsig | schedulesig |
rxsig |
3531 if (waitselect(max_fd + 1, &read_fd_set, &write_fd_set, &except_fd_set,
3532 NULL, (
unsigned int *)&signalmask) != -1) {
3533 signal = signalmask;
3535 NSLOG(netsurf, INFO,
"waitselect() returned error");
3546 signalmask |= ctrlcsig;
3547 signal = Wait(signalmask);
3550 if(signal & winsignal)
3562 if(signal & printsig) {
3563 while(GetMsg(printmsgport));
3567 if(signal & schedulesig) {
3571 if(signal & helpsignal)
3574 if(signal & ctrlcsig)
3581 struct Node *ptab = NULL;
3583 if(gwin->
tabs <= 1)
return;
3594 CLICKTAB_CurrentNode, ptab,
3604 char *restrict utf8title;
3618 CLICKTAB_Labels, ~0,
3624 SetClickTabNodeAttrs(node, TNA_Text, g->
tabtitle,
3633 if(ClickTabBase->lib_Version < 53)
3655 if(!g || !g->
bw)
return;
3668 SCROLLER_Total, (ULONG)(
height),
3669 SCROLLER_Visible, bbox->Height,
3678 SCROLLER_Total, (ULONG)(
width),
3679 SCROLLER_Visible, bbox->Width,
3702 struct rect *restrict deferred_rect;
3714 sizeof(
struct rect));
3715 CopyMem(
rect, deferred_rect,
sizeof(
struct rect));
3719 NSLOG(netsurf, INFO,
3720 "Ignoring duplicate or subset of queued box redraw");
3731 struct Node *tabnode;
3737 if(gwin->
tabs == 0)
return;
3744 GetClickTabNodeAttrs(tabnode,
3745 TNA_UserData, &gwin->
gw,
3758 gwin->
win, NULL, STRINGA_TextVal,
"", TAG_DONE);
3820 }
while((node = nnode));
3840 res = TimedDosRequesterTags(TDR_ImageType, TDRIMAGE_INFO,
3842 TDR_FormatString, utf8text,
3843 TDR_GadgetString, utf8gadgets,
3858 if(
scrn == NULL)
return;
3861 UnlockPubScreen(NULL,
scrn);
3868 if(CloseScreen(
scrn) == TRUE) {
3876 if(donotwait == TRUE)
return;
3879 NSLOG(netsurf, INFO,
3880 "Waiting for visitor windows to close... (signal)");
3883 while (CloseScreen(
scrn) == FALSE) {
3884 NSLOG(netsurf, INFO,
3885 "Waiting for visitor windows to close... (polling)");
3927 NSLOG(netsurf, INFO,
"Freeing menu items");
3931 NSLOG(netsurf, INFO,
"Freeing mouse pointers");
3945 NSLOG(netsurf, INFO,
"Closing screen");
3952 STRPTR filename = NULL;
3955 NSLOG(netsurf, INFO,
"favicon cache location: %s", filename);
3957 if (only_if_avail ==
true) {
3959 if((lock = Lock(filename, ACCESS_READ))) {
3972 STRPTR filename = NULL;
3985 GetAttr(STRINGA_TextVal,
4010 const char *title,
nsurl *url,
bool is_folder)
4013 struct Node *speed_button_node;
4014 char menu_icon[1024];
4015 char *utf8title = NULL;
4017 if(level != 1)
return false;
4019 if(is_folder ==
true)
return false;
4027 if (iconname == NULL) iconname =
ASPrintf(
"icons/content.png");
4032 BITMAP_Screen,
scrn,
4033 BITMAP_SourceFile, menu_icon,
4034 BITMAP_Masking, TRUE,
4045 LABEL_DisposeImage, TRUE,
4048 LABEL_Text, utf8title,
4053 speed_button_node = AllocSpeedButtonNode(item,
4054 SBNA_Image, lab_item,
4056 SBNA_UserData, (
void *)url,
4059 AddTail(tb_userdata->
sblist, speed_button_node);
4061 tb_userdata->
items++;
4069 userdata.
sblist = speed_button_list;
4073 return userdata.
items;
4078 struct TagItem attrs[2];
4080 attrs[0].ti_Tag = CHILD_MinWidth;
4081 attrs[0].ti_Data = 0;
4082 attrs[1].ti_Tag = TAG_DONE;
4083 attrs[1].ti_Data = 0;
4092 ICA_TARGET, ICTARGET_IDCMP,
4093 SPEEDBAR_BevelStyle, BVS_NONE,
4099 BEVEL_Style, BVS_SBAR_VERT,
4120 gwin->
win, NULL, TRUE);
4134 if(IsListEmpty(speed_button_list))
return;
4135 node =
GetHead(speed_button_list);
4140 FreeSpeedButtonNode(node);
4141 }
while((node = nnode));
4170 gwin->
win, NULL, TRUE);
4185 SPEEDBAR_Buttons, ~0,
4222 }
while((node = nnode));
4227 if(ClickTabBase->lib_Version < 53)
return;
4230 struct TagItem attrs[3];
4232 attrs[0].ti_Tag = CHILD_WeightedWidth;
4233 attrs[0].ti_Data = 0;
4234 attrs[1].ti_Tag = CHILD_WeightedHeight;
4235 attrs[1].ti_Data = 0;
4236 attrs[2].ti_Tag = TAG_DONE;
4237 attrs[2].ti_Data = 0;
4249 CLICKTAB_EvenSize, FALSE,
4277 gwin->
win, NULL, TRUE);
4279 if (gwin->
gw && gwin->
gw->
bw) {
4303 if(gwin->
tabs == 1) {
4311 }
while((node = nnode));
4338 if(window == windows) *
tabs = gwin->
tabs;
4340 }
while((node = nnode));
4415 width += (left - sx);
4419 if(((top - sy) +
height) > bbox->Height)
4420 height = bbox->Height - (top - sy);
4422 if(((left - sx) +
width) > bbox->Width)
4423 width = bbox->Width - (left - sx);
4425 if(
width <= 0)
return;
4430 for(y = top; y < (top +
height); y += tile_size_y) {
4432 clip.y1 = tile_size_y;
4434 if(((y - sy) +
clip.y1) > bbox->Height)
4435 clip.y1 = bbox->Height - (y - sy);
4437 for(x = left; x < (left +
width); x += tile_size_x) {
4439 clip.x1 = tile_size_x;
4441 if(((x - sx) +
clip.x1) > bbox->Width)
4442 clip.x1 = bbox->Width - (x - sx);
4451 BltBitMapTags(BLITA_SrcType, BLITT_BITMAP,
4455 BLITA_DestType, BLITT_RASTPORT,
4456 BLITA_Dest, gwin->
win->RPort,
4457 BLITA_DestX, bbox->Left + (
int)(x - sx),
4458 BLITA_DestY, bbox->Top + (
int)(y - sy),
4459 BLITA_Width, (
int)(
clip.x1),
4460 BLITA_Height, (
int)(
clip.y1),
4464 bbox->Left + (
int)(x - sx),
4465 bbox->Top + (
int)(y - sy),
4466 (
int)(
clip.x1), (
int)(
clip.y1), 0xC0);
4489 int x0,
int y0,
int x1,
int y1)
4496 .background_images =
true,
4515 x1 - x0, y1 - y0, sx, sy, bbox, &ctx);
4529 struct RegionRectangle *regrect;
4542 BeginRefresh(gwin->
win);
4544 r.
x0 = (gwin->
win->RPort->Layer->DamageList->bounds.MinX - bbox->Left) + sx - 1;
4545 r.
x1 = (gwin->
win->RPort->Layer->DamageList->bounds.MaxX - bbox->Left) + sx + 2;
4546 r.
y0 = (gwin->
win->RPort->Layer->DamageList->bounds.MinY - bbox->Top) + sy - 1;
4547 r.
y1 = (gwin->
win->RPort->Layer->DamageList->bounds.MaxY - bbox->Top) + sy + 2;
4549 regrect = gwin->
win->RPort->Layer->DamageList->RegionRectangle;
4555 r.
x0 = (regrect->bounds.MinX - bbox->Left) + sx - 1;
4556 r.
x1 = (regrect->bounds.MaxX - bbox->Left) + sx + 2;
4557 r.
y0 = (regrect->bounds.MinY - bbox->Top) + sy - 1;
4558 r.
y1 = (regrect->bounds.MaxY - bbox->Top) + sy + 2;
4560 regrect = regrect->Next;
4565 EndRefresh(gwin->
win, TRUE);
4571HOOKF(
void, ami_scroller_hook, Object *,
object,
struct IntuiMessage *)
4575 struct IntuiWheelData *wheel;
4576 struct Node *node = NULL;
4581 case IDCMP_IDCMPUPDATE:
4582 gid = GetTagData( GA_ID, 0, msg->IAddress );
4595 if((node = (
struct Node *)GetTagData(SPEEDBAR_SelectedNode, 0, msg->IAddress))) {
4596 GetSpeedButtonNodeAttrs(node, SBNA_UserData, (ULONG *)&url, TAG_DONE);
4620 if(msg->Code == IMSGCODE_INTUIWHEELDATA)
4622 wheel = (
struct IntuiWheelData *)msg->IAddress;
4628 case IDCMP_SIZEVERIFY:
4631 case IDCMP_REFRESHWINDOW:
4636 NSLOG(netsurf, INFO,
4637 "IDCMP hook unhandled event: %ld", msg->Class);
4681 struct Window *ref = NULL;
4682 char nav_west[100],nav_west_s[100],nav_west_g[100];
4683 char nav_east[100],nav_east_s[100],nav_east_g[100];
4684 char stop[100],stop_s[100],stop_g[100];
4686 char home[100],home_s[100],home_g[100];
4687 char closetab[100],closetab_s[100],closetab_g[100];
4688 char addtab[100],addtab_s[100],addtab_g[100];
4689 char fave[100], unfave[100];
4690 char pi_insecure[100], pi_internal[100], pi_local[100], pi_secure[100], pi_warning[100];
4691 char tabthrobber[100];
4692 ULONG refresh_mode = WA_SmartRefresh;
4693 ULONG defer_layout = TRUE;
4694 ULONG idcmp_sizeverify = IDCMP_SIZEVERIFY;
4696 NSLOG(netsurf, INFO,
"Creating window");
4701 if (
nsoption_bool(resize_with_contents)) idcmp_sizeverify = 0;
4725 LBCIA_Title,
"time",
4727 LBCIA_DraggableSeparator, TRUE,
4728 LBCIA_Separator, TRUE,
4731 LBCIA_Title,
"source",
4733 LBCIA_DraggableSeparator, TRUE,
4734 LBCIA_Separator, TRUE,
4737 LBCIA_Title,
"level",
4739 LBCIA_DraggableSeparator, TRUE,
4740 LBCIA_Separator, TRUE,
4743 LBCIA_Title,
"message",
4745 LBCIA_DraggableSeparator, TRUE,
4746 LBCIA_Separator, TRUE,
4764 CLICKTAB_Labels, ~0,
4773 struct Node *insert_after = existing->
tab_node;
4789 CLICKTAB_Current, g->
tab,
4793 if(ClickTabBase->lib_Version < 53) {
4839 refresh_mode = WA_SimpleRefresh;
4840 defer_layout = FALSE;
4843 refresh_mode = WA_SmartRefresh;
4844 defer_layout = TRUE;
4849 ULONG addtabclosegadget = TAG_IGNORE;
4850 ULONG iconifygadget = FALSE;
4857 iconifygadget = TRUE;
4860 NSLOG(netsurf, INFO,
"Creating menu");
4937 BITMAP_SourceFile, fave,
4938 BITMAP_Screen,
scrn,
4939 BITMAP_Masking, TRUE,
4943 BITMAP_SourceFile, unfave,
4944 BITMAP_Screen,
scrn,
4945 BITMAP_Masking, TRUE,
4950 struct DrawInfo *dri = GetScreenDrawInfo(
scrn);
4952 SYSIA_Which, TABCLOSEIMAGE,
4953 SYSIA_DrawInfo, dri,
4956 FreeScreenDrawInfo(
scrn, dri);
4960 BITMAP_SourceFile, closetab,
4961 BITMAP_SelectSourceFile, closetab_s,
4963 BITMAP_Screen,
scrn,
4964 BITMAP_Masking, TRUE,
4969 BITMAP_SourceFile, pi_insecure,
4970 BITMAP_Screen,
scrn,
4971 BITMAP_Masking, TRUE,
4975 BITMAP_SourceFile, pi_internal,
4976 BITMAP_Screen,
scrn,
4977 BITMAP_Masking, TRUE,
4981 BITMAP_SourceFile, pi_local,
4982 BITMAP_Screen,
scrn,
4983 BITMAP_Masking, TRUE,
4987 BITMAP_SourceFile, pi_secure,
4988 BITMAP_Screen,
scrn,
4989 BITMAP_Masking, TRUE,
4993 BITMAP_SourceFile, pi_warning,
4994 BITMAP_Screen,
scrn,
4995 BITMAP_Masking, TRUE,
5006 if(ClickTabBase->lib_Version < 53)
5008 addtabclosegadget = LAYOUT_AddChild;
5026 BITMAP_SourceFile, tabthrobber,
5028 BITMAP_Masking,TRUE,
5032 NSLOG(netsurf, INFO,
"Creating window object");
5037 WA_DepthGadget, TRUE,
5039 WA_CloseGadget, TRUE,
5040 WA_SizeGadget, TRUE,
5042 WA_ReportMouse,TRUE,
5044 WA_SizeBBottom, TRUE,
5046 WA_IDCMP, IDCMP_MENUPICK | IDCMP_MOUSEMOVE |
5047 IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
5048 IDCMP_RAWKEY | idcmp_sizeverify |
5049 IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
5050 IDCMP_REFRESHWINDOW |
5052 WINDOW_Position, WPOS_FULLSCREEN,
5053 WINDOW_RefWindow, ref,
5054 WINDOW_IconifyGadget, iconifygadget,
5055 WINDOW_MenuStrip, menu,
5056 WINDOW_MenuUserData, WGUD_HOOK,
5059 WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_REFRESHWINDOW |
5061 WINDOW_SharedPort,
sport,
5063 WINDOW_GadgetHelp, TRUE,
5065 WINDOW_UniqueID,
"NS_MAIN_WIN",
5066 WINDOW_PopupGadget, TRUE,
5068 WINDOW_UserData, g->
shared,
5070 LAYOUT_DeferLayout, defer_layout,
5071 LAYOUT_SpaceOuter, TRUE,
5073 LAYOUT_VertAlignment, LALIGN_CENTER,
5081 BITMAP_SourceFile,nav_west,
5082 BITMAP_SelectSourceFile,nav_west_s,
5085 BITMAP_Masking,TRUE,
5088 CHILD_WeightedWidth,0,
5089 CHILD_WeightedHeight,0,
5097 BITMAP_SourceFile,nav_east,
5098 BITMAP_SelectSourceFile,nav_east_s,
5101 BITMAP_Masking,TRUE,
5104 CHILD_WeightedWidth,0,
5105 CHILD_WeightedHeight,0,
5111 BITMAP_SourceFile,stop,
5112 BITMAP_SelectSourceFile,stop_s,
5115 BITMAP_Masking,TRUE,
5118 CHILD_WeightedWidth,0,
5119 CHILD_WeightedHeight,0,
5125 BITMAP_SourceFile,
reload,
5126 BITMAP_SelectSourceFile,reload_s,
5129 BITMAP_Masking,TRUE,
5132 CHILD_WeightedWidth,0,
5133 CHILD_WeightedHeight,0,
5139 BITMAP_SourceFile,home,
5140 BITMAP_SelectSourceFile,home_s,
5143 BITMAP_Masking,TRUE,
5146 CHILD_WeightedWidth,0,
5147 CHILD_WeightedHeight,0,
5149 LAYOUT_VertAlignment, LALIGN_CENTER,
5153 SPACE_MinHeight, 16,
5154 SPACE_Transparent, TRUE,
5157 CHILD_WeightedWidth, 0,
5158 CHILD_WeightedHeight, 0,
5165 CHILD_WeightedWidth, 0,
5166 CHILD_WeightedHeight, 0,
5173 STRINGA_MaxChars, 2000,
5189 CHILD_WeightedWidth, 0,
5190 CHILD_WeightedHeight, 0,
5195 LAYOUT_WeightBar, TRUE,
5197 LAYOUT_VertAlignment, LALIGN_CENTER,
5201 CHOOSER_DropDown, TRUE,
5203 CHOOSER_MaxLabels, 40,
5205 CHILD_WeightedWidth,0,
5206 CHILD_WeightedHeight,0,
5209 STRINGA_TextVal, NULL,
5219 SPACE_Transparent,TRUE,
5222 CHILD_WeightedWidth,0,
5223 CHILD_WeightedHeight,0,
5225 CHILD_WeightedHeight,0,
5227 BEVEL_Style, BVS_SBAR_VERT,
5229 CHILD_WeightedHeight, 0,
5231 LAYOUT_SpaceInner, FALSE,
5233 CHILD_WeightedHeight,0,
5235 LAYOUT_SpaceInner,FALSE,
5237 CHILD_WeightedWidth,0,
5238 CHILD_WeightedHeight,0,
5241 CHILD_CacheDomain,FALSE,
5243 CHILD_WeightedHeight,0,
5250 SPACE_Transparent,TRUE,
5252 SPACE_MinHeight, 16,
5261 CHILD_WeightedHeight, 0,
5266 STRINGA_TextVal, NULL,
5284 WA_DepthGadget, FALSE,
5286 WA_CloseGadget, FALSE,
5291 WA_Width,
scrn->Width,
5292 WA_Height,
scrn->Height,
5293 WA_SizeGadget, FALSE,
5295 WA_ReportMouse, TRUE,
5297 WA_IDCMP, IDCMP_MENUPICK | IDCMP_MOUSEMOVE |
5298 IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
5299 IDCMP_RAWKEY | IDCMP_REFRESHWINDOW |
5300 IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
5303 WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE |
5305 WINDOW_SharedPort,
sport,
5306 WINDOW_UserData,g->
shared,
5309 LAYOUT_DeferLayout, defer_layout,
5310 LAYOUT_SpaceOuter, TRUE,
5315 SPACE_Transparent,TRUE,
5323 NSLOG(netsurf, INFO,
"Opening window");
5327 NSLOG(netsurf, INFO,
"Window opened, adding border gadgets");
5344 struct DrawInfo *dri = GetScreenDrawInfo(
scrn);
5346 ami_get_border_gadget_size(g->
shared,
5353 GA_Left,
scrn->WBorLeft + 2,
5355 GA_BottomBorder, TRUE,
5365 IA_Top, (
int)(- ceil((
scrn->WBorBottom +
height) / 2)),
5375 (UWORD)~0, -1, NULL);
5387 FreeScreenDrawInfo(
scrn, dri);
5402 UnlockPubScreen(NULL,
scrn);
5406 ScreenToFront(
scrn);
5420 if(res == 0)
return;
5428 GetClickTabNodeAttrs(
tab,
5432 if(gw &&((other_tabs ==
false) || (gwin->
gw != gw))) {
5435 }
while((
tab=ntab));
5454 struct Node *ptab = NULL;
5494 CLICKTAB_CurrentNode, ptab,
5497 if(ClickTabBase->lib_Version < 53)
5508 FreeListBrowserList(&g->
loglist);
5550 FreeListBrowserList(&g->
loglist);
5560 for(gid = 0; gid <
GID_LAST; gid++)
5629 NSLOG(netsurf, INFO,
"Ignoring deferred box redraw queue");
5643 }
while((node = nnode));
5649 const struct rect *restrict new_rect, APTR mempool)
5663 if((
rect->
x0 <= new_rect->x0) &&
5664 (
rect->
y0 <= new_rect->y0) &&
5665 (
rect->
x1 >= new_rect->x1) &&
5666 (
rect->
y1 >= new_rect->y1)) {
5670 if ((new_rect->x0 <=
rect->
x0) &&
5671 (new_rect->y0 <=
rect->
y0) &&
5672 (new_rect->x1 >=
rect->
x1) &&
5673 (new_rect->y1 >=
rect->
y1)) {
5674 NSLOG(netsurf, INFO,
5675 "Removing queued redraw that is a subset of new box redraw");
5680 }
while((node = nnode));
5688 ULONG hcurrent,vcurrent,xoffset,yoffset,
width=800,
height=600;
5690 ULONG oldh = gwin->
oldh, oldv=gwin->
oldv;
5712 if((abs(vcurrent-oldv) >
height) || (abs(hcurrent-oldh) >
width))
5725 ScrollWindowRaster(gwin->
win, hcurrent - oldh, vcurrent - oldv,
5726 xoffset, yoffset, xoffset +
width - 1, yoffset +
height - 1);
5736 else if(vcurrent<oldv)
5749 else if(hcurrent<oldh)
5760 .background_images =
true,
5773 gwin->
oldh = hcurrent;
5774 gwin->
oldv = vcurrent;
5852 if(sx >=
width - bbox->Width)
5853 sx =
width - bbox->Width;
5854 if(sy >=
height - bbox->Height)
5855 sy =
height - bbox->Height;
5857 if(width <= bbox->Width) sx = 0;
5858 if(height <= bbox->Height) sy = 0;
5866 SCROLLER_Top, (ULONG)(sy),
5874 SCROLLER_Top, (ULONG)(sx),
5894 struct TextExtent textex;
5902 if(utf8text == NULL)
return;
5905 chars = TextFit(&
scrn->RastPort, utf8text, (UWORD)strlen(utf8text),
5906 &textex, NULL, 1, size - 4,
scrn->RastPort.TxHeight);
5908 utf8text[chars] = 0;
5926 char *idn_url_s = NULL;
5927 char *url_lc = NULL;
5945 if(idn_url_s) free(idn_url_s);
5954HOOKF(
uint32, ami_set_favicon_render_hook, APTR, space,
struct gpRender *)
5968 struct bitmap *ico_bitmap)
5970 struct BitMap *bm = NULL;
5978 if (ico_bitmap != NULL) {
5995 ULONG bm_masking_tag = TAG_IGNORE;
5999 bm_masking_tag = BITMAP_Masking;
6003 BITMAP_Screen,
scrn,
6008 bm_masking_tag, TRUE,
6017 }
while((node = nnode));
6022HOOKF(
uint32, ami_set_throbber_render_hook, APTR, space,
struct gpRender *)
6029HOOKF(
uint32, ami_gui_browser_render_hook, APTR, space,
struct gpRender *)
6033 NSLOG(netsurf, DEBUG,
"Render hook called with %ld (REDRAW=1)", msg->gpr_Redraw);
6035 if(msg->gpr_Redraw != GREDRAW_REDRAW)
return 0;
6062 if((y-ys+
height) > (bbox->Height))
height = bbox->Height-y+ys;
6064 if(((x-xs) <= 0) || ((x-xs+2) >= (bbox->Width)) || ((y-ys) <= 0) || ((y-ys) >= (bbox->Height))) {
6071 SetDrMd(g->
shared->
win->RPort,COMPLEMENT);
6072 RectFill(g->
shared->
win->RPort, x + bbox->Left - xs, y + bbox->Top - ys,
6073 x + bbox->Left + g->
c_w - xs, y+bbox->Top +
height - ys);
6089 if(g->
c_h == 0)
return;
6130 SetWindowAttrs(g->
shared->
win, WA_GrabFocus, 0,
6131 WA_MouseLimits, NULL, TAG_DONE);
6158 *x = *x - (bbox->Left) +xs;
6161 *y = *y - (bbox->Top) + ys;
6184 if((x >= left) && (x <= (left +
width)) && (y >= top) && (y <= (top +
height)))
6191 Object *restrict win_obj, *restrict bm_obj;
6193 struct Screen *wbscreen = LockPubScreen(
"Workbench");
6194 uint32 top = 0, left = 0;
6195 struct TextAttr tattr;
6196 struct TextFont *tfont;
6202 WA_Borderless, TRUE,
6203 WA_BusyPointer, TRUE,
6204 WINDOW_Position, WPOS_CENTERSCREEN,
6205 WINDOW_LockWidth, TRUE,
6206 WINDOW_LockHeight, TRUE,
6209 BITMAP_SourceFile,
"PROGDIR:Resources/splash.png",
6210 BITMAP_Screen, wbscreen,
6211 BITMAP_Precision, PRECISION_IMAGE,
6216 if(win_obj == NULL) {
6217 NSLOG(netsurf, INFO,
"Splash window object not created");
6221 NSLOG(netsurf, INFO,
"Attempting to open splash window...");
6222 win = RA_OpenWindow(win_obj);
6225 NSLOG(netsurf, INFO,
"Splash window did not open");
6229 if(bm_obj == NULL) {
6230 NSLOG(netsurf, INFO,
"BitMap object not created");
6238 SetDrMd(win->RPort, JAM1);
6241 tattr.ta_Name =
"DejaVu Serif Italic.font";
6243 SetAPen(win->RPort, 3);
6244 tattr.ta_Name =
"ruby.font";
6246 tattr.ta_YSize = 24;
6252 SetFont(win->RPort, tfont);
6256 tattr.ta_Name =
"DejaVu Serif Oblique.font";
6258 SetFont(win->RPort, tfont);
6261 Move(win->RPort, left + 5, top + 25);
6262 Text(win->RPort,
"Initialising...", strlen(
"Initialising..."));
6267 tattr.ta_Name =
"DejaVu Sans.font";
6269 tattr.ta_Name =
"helvetica.font";
6271 tattr.ta_YSize = 16;
6276 SetFont(win->RPort, tfont);
6278 Move(win->RPort, left + 185, top + 220);
6283 UnlockPubScreen(NULL, wbscreen);
6290 if(win_obj == NULL)
return;
6292 NSLOG(netsurf, INFO,
"Closing splash window");
6293 DisposeObject(win_obj);
6299 NSLOG(netsurf, INFO,
"File open dialog request for %p/%p", g, gadget);
6303 ASLFR_SleepWindow, TRUE,
6306 ASLFR_DoSaveMode, FALSE,
6309 strlcpy(fname,
filereq->fr_Drawer, 1024);
6310 AddPart(fname,
filereq->fr_File, 1024);
6330 if(current_user == NULL) {
6331 user = GetVar(
"user", temp, 1024, GVF_GLOBAL_ONLY);
6332 current_user =
ASPrintf(
"%s", (user == -1) ?
"Default" : temp);
6334 NSLOG(netsurf, INFO,
"User: %s", current_user);
6340 FreeVec(current_user);
6347 struct InfoData *infodata = AllocDosObject(DOS_INFODATA, 0);
6348 if(infodata == NULL) {
6350 FreeVec(current_user);
6353 GetDiskInfoTags(GDI_StringNameInput,
users_dir,
6354 GDI_InfoData, infodata,
6356 if(infodata->id_DiskState == ID_DISKSTATE_WRITE_PROTECTED) {
6357 FreeDosObject(DOS_INFODATA, infodata);
6359 FreeVec(current_user);
6362 FreeDosObject(DOS_INFODATA, infodata);
6364#warning FIXME for OS3 and older OS4
6370 int len = strlen(current_user);
6377 FreeVec(current_user);
6384 FreeVec(current_user);
6497 setbuf(stderr, NULL);
6501 STRPTR current_user_cache = NULL;
6502 STRPTR current_user = NULL;
6525 signal(SIGINT, SIG_IGN);
6577#ifdef WITH_AMIGA_DATATYPES
6579 if(DataTypesBase->lib_Version >= 45)
6611 if((lock =
CreateDirTree(current_user_cache))) UnLock(lock);
6615 if(current_user_cache != NULL) FreeVec(current_user_cache);
6657 NSLOG(netsurf, INFO,
"Entering main loop");
void ami_clipboard_free(void)
void ami_clipboard_init(void)
struct gui_clipboard_table * amiga_clipboard_table
void gui_start_selection(struct gui_window *g)
nserror ami_cookies_present(const char *search_term)
Open the cookie viewer.
struct core_window_table * amiga_core_window_table
const char * fetch_filetype(const char *unix_path)
Determine the MIME type of a local file.
nserror ami_mime_init(const char *mimefile)
static void ami_gui_close_tabs(struct gui_window_2 *gwin, bool other_tabs)
static void ami_gui_splash_close(Object *win_obj)
static nserror gui_window_get_dimensions(struct gui_window *gw, int *restrict width, int *restrict height)
Find the current dimensions of a amiga browser window content area.
static void ami_refresh_window(struct gui_window_2 *gwin)
static void ami_gui_console_log_remove(struct gui_window *g)
bool ami_gui_window_update_box_deferred_check(struct MinList *deferred_rects, const struct rect *restrict new_rect, APTR mempool)
Check rect is not already queued for redraw.
struct ami_history_local_window * ami_gui_get_history_window(struct gui_window *gw)
Get local history window from gui_window.
static void ami_update_buttons(struct gui_window_2 *gwin)
static void ami_gui_hotlist_toolbar_add(struct gui_window_2 *gwin)
static STRPTR nsscreentitle
struct Window * ami_gui_get_window(struct gui_window *gw)
Get window from gui_window.
static void gui_window_set_status(struct gui_window *g, const char *text)
static nsurl * gui_get_resource_url(const char *path)
static nserror gui_window_event(struct gui_window *gw, enum gui_window_event event)
process miscellaneous window events
static void gui_window_destroy(struct gui_window *g)
static void ami_gui_refresh_favicon(void *p)
static void gui_window_remove_caret(struct gui_window *g)
static void ami_gui_cache_favicon(nsurl *url, struct bitmap *favicon)
int ami_key_to_nskey(ULONG keycode, struct InputEvent *ie)
static void ami_gui_scroller_update(struct gui_window_2 *gwin)
Check the scroll bar requirements for a browser window, and add/remove the vertical scroller as appro...
void ami_gui_set_find_window(struct gui_window *gw, struct find_window *fw)
Set search window in gui_window.
static const __attribute__((used))
static void gui_window_update_extent(struct gui_window *g)
static nserror ami_set_options(struct nsoption_s *defaults)
Set option defaults for amiga frontend.
static void ami_set_border_gadget_size(struct gui_window_2 *gwin)
int ami_gui2_get_ctxmenu_history_tmp(struct gui_window_2 *gwin)
Get ctxmenu history tmp from gui_window_2.
static void ami_gui_appicon_remove(struct gui_window_2 *gwin)
struct Screen * ami_gui_get_screen(void)
Get a pointer to the screen NetSurf is running on.
struct gui_utf8_table * amiga_utf8_table
struct Node * ami_gui_get_tab_node(struct gui_window *gw)
Get tab node from gui_window.
void ami_gui_hotlist_update_all(void)
Update hotlist toolbar and recreate the menu for all windows.
void ami_gui_close_inactive_tabs(struct gui_window_2 *gwin)
Close all tabs in a window except the active one.
static void ami_gui_console_log_switch(struct gui_window *g)
static void ami_gui_console_log_add(struct gui_window *g)
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.
static void ami_amiupdate(void)
static struct Screen * scrn
static bool ami_gui_map_filename(char **remapped, const char *restrict path, const char *restrict file, const char *restrict map)
static struct gui_misc_table amiga_misc_table
@ GID_PAGEINFO_INSECURE_BM
@ GID_PAGEINFO_INTERNAL_BM
@ GID_PAGEINFO_WARNING_BM
void ami_gui2_set_ctxmenu_history_tmp(struct gui_window_2 *gwin, int temp)
Set ctxmenu history tmp in gui_window_2.
static void ami_gui_hotlist_toolbar_remove(struct gui_window_2 *gwin)
static struct gui_window * gui_window_create(struct browser_window *bw, struct gui_window *existing, gui_window_create_flags flags)
static void ami_gui_hotlist_toolbar_update(struct gui_window_2 *gwin)
int main(int argc, char **argv)
Normal entry point from OS.
nserror ami_gui_win_list_add(void *win, int type, const struct ami_win_event_table *table)
Add a window to the NetSurf window list (to enable event processing)
static nserror gui_search_web_provider_update(const char *provider_name, struct bitmap *ico_bitmap)
Gui callback when search provider details are updated.
static void ami_update_quals(struct gui_window_2 *gwin)
static void ami_handle_appmsg(void)
uint32 ami_gui_get_app_id(void)
Get the application.library ID NetSurf is registered as.
static void ami_toggletabbar(struct gui_window_2 *gwin, bool show)
static STRPTR temp_homepage_url
static struct IBox * ami_ns_rect_to_ibox(struct gui_window_2 *gwin, const struct rect *rect)
void ami_gui_history(struct gui_window_2 *gwin, bool back)
static void ami_set_screen_defaults(struct Screen *screen)
bool ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *restrict x, ULONG *restrict y)
void * ami_window_at_pointer(int type)
undocumented, or internal, or documented elsewhere
void ami_gui_close_window(void *w)
Close a window and all tabs attached to it.
static nserror amiga_window_invalidate_area(struct gui_window *g, const struct rect *restrict rect)
Invalidates an area of an amiga browser window.
struct Menu * ami_gui_get_menu(struct gui_window *gw)
Get imenu from gui_window.
static void gui_file_gadget_open(struct gui_window *g, struct hlcache_handle *hl, struct form_control *gadget)
void ami_gui_set_throbbing(struct gui_window *gw, bool throbbing)
Set throbbing status in gui_window.
void ami_set_pointer(struct gui_window_2 *gwin, gui_pointer_shape shape, bool update)
static void ami_do_redraw(struct gui_window_2 *gwin)
static void ami_get_vscroll_pos(struct gui_window_2 *gwin, ULONG *ys)
static nserror gui_window_set_url(struct gui_window *g, nsurl *url)
static UWORD ami_system_colour_scrollbar_fgpen(struct DrawInfo *drinfo)
void ami_gui_adjust_scale(struct gui_window *gw, float adjustment)
Adjust scale by specified amount.
static struct MinList * window_list
bool ami_locate_resource(char *fullpath, const char *file)
static bool ami_gui_vscroll_add(struct gui_window_2 *gwin)
bool ami_gui_get_throbbing(struct gui_window *gw)
Get throbbing status from gui_window.
struct gui_window * ami_gui_get_active_gw(void)
Get a pointer to the gui_window which NetSurf considers to be the current/active one.
static void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool busy, int left, int top, int width, int height, int sx, int sy, struct IBox *bbox, struct redraw_context *ctx)
struct browser_window * ami_gui2_get_browser_window(struct gui_window_2 *gwin)
Get browser window from gui_window_2.
static void gui_init2(int argc, char **argv)
static bool ami_gui_console_log_toggle(struct gui_window *g)
static BOOL locked_screen
static Object * ami_gui_splash_open(void)
void ami_reset_pointer(struct gui_window_2 *gwin)
static bool ami_gui_resources_open(void)
void ami_gui2_set_ctxmenu_history(struct gui_window_2 *gwin, ULONG direction, Object *ctx_hist)
Set ctxmenu history in gui_window_2.
static bool ami_gui_vscroll_remove(struct gui_window_2 *gwin)
static struct MsgPort * applibport
static void gui_quit(void)
static struct gui_fetch_table amiga_fetch_table
STRPTR ami_gui_get_screen_title(void)
Get the string for NetSurf's screen titlebar.
static bool ami_gui_hscroll_remove(struct gui_window_2 *gwin)
static void ami_redraw_callback(void *p)
static void ami_change_tab(struct gui_window_2 *gwin, int direction)
static void gui_window_set_title(struct gui_window *g, const char *restrict title)
struct ami_menu_data ** ami_gui2_get_menu_data(struct gui_window_2 *gwin)
Get menu_data from gui_window_2.
static struct gui_globals * browserglob
nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin)
static void ami_schedule_redraw_remove(struct gui_window_2 *gwin)
static char * ami_gui_read_tooltypes(struct WBArg *wbarg)
void ami_gui2_set_menu(struct gui_window_2 *gwin, struct Menu *menu)
Set imenu to gui_window_2.
static struct MsgPort * sport
static void gui_window_place_caret(struct gui_window *g, int x, int y, int height, const struct rect *clip)
void ami_gui2_set_closed(struct gui_window_2 *gwin, bool closed)
Set closed in gui_window_2.
nserror ami_gui_get_space_box(Object *obj, struct IBox **bbox)
Compatibility function to get space.gadget render area.
Object * ami_gui2_get_object(struct gui_window_2 *gwin, int object_type)
Get object from gui_window.
const char * ami_gui_get_win_title(struct gui_window *gw)
Get window title from gui_window.
static void ami_gui_window_update_box_deferred(struct gui_window *g, bool draw)
static int ami_gui_hotlist_scan(struct List *speed_button_list, struct gui_window_2 *gwin)
static struct gui_window * cur_gw
#define NSA_KBD_SCROLL_PX
static nserror gui_window_set_scroll(struct gui_window *g, const struct rect *rect)
Set the scroll position of a amiga browser window.
int ami_gui_get_throbber_frame(struct gui_window *gw)
Get throbbing frame from gui_window.
const char * ami_gui_get_tab_title(struct gui_window *gw)
Get tab title from gui_window.
static void gui_window_set_icon(struct gui_window *g, struct hlcache_handle *icon)
function to add retrieved favicon to gui
static char * current_user_dir
static void ami_gui_resources_free(void)
void ami_gui_set_history_window(struct gui_window *gw, struct ami_history_local_window *hw)
Set local history window in gui_window.
struct gui_window * ami_gui2_get_gui_window(struct gui_window_2 *gwin)
Get gui_window from gui_window_2.
static void ami_handle_applib(void)
STRPTR ami_locale_langs(int *codeset)
struct List * ami_gui_get_download_list(struct gui_window *gw)
Get download list from gui_window.
Object * ami_gui2_get_ctxmenu_history(struct gui_window_2 *gwin, ULONG direction)
Get ctxmenu history from gui_window_2.
static void gui_window_new_content(struct gui_window *g)
static bool gui_window_get_scroll(struct gui_window *g, int *restrict sx, int *restrict sy)
#define AMINS_SCROLLERPEN
#define BOOL_MISMATCH(a, b)
static bool ami_spacebox_to_ns_coords(struct gui_window_2 *gwin, int *restrict x, int *restrict y, int space_x, int space_y)
static void ami_openscreen(void)
static struct Hook newprefs_hook
ULONG ami_gui2_get_tabs(struct gui_window_2 *gwin)
Get tabs from gui_window_2.
void ami_gui_beep(void)
Beep.
void ami_gui_free_space_box(struct IBox *bbox)
Free any data obtained via ami_gui_get_space_box().
bool ami_mouse_to_ns_coords(struct gui_window_2 *gwin, int *restrict x, int *restrict y, int mouse_x, int mouse_y)
static bool ami_gui_hotlist_add(void *userdata, int level, int item, const char *title, nsurl *url, bool is_folder)
static void ami_switch_tab(struct gui_window_2 *gwin, bool redraw)
static void ami_gui_trap_mouse(struct gui_window_2 *gwin)
static void ami_gui_hotlist_toolbar_free(struct gui_window_2 *gwin, struct List *speed_button_list)
struct hlcache_handle * ami_gui_get_favicon(struct gui_window *gw)
Get favicon from gui_window.
HOOKF(void, ami_gui_newprefs_hook, APTR, window, APTR)
static void ami_do_redraw_limits(struct gui_window *g, struct browser_window *bw, bool busy, int x0, int y0, int x1, int y1)
Redraw an area of the browser window - Amiga-specific function.
void ami_gui_set_scale(struct gui_window *gw, float scale)
Set the scale of a gui window.
struct List * ami_gui2_get_tab_list(struct gui_window_2 *gwin)
Get tab list from gui_window_2.
static const struct ami_win_event_table ami_gui_table
void ami_gui_win_list_remove(void *win)
Remove a window from the NetSurf window list.
int ami_gui_count_windows(int window, int *tabs)
Count windows, and optionally tabs.
static BOOL ami_gui_event(void *w)
static bool win_destroyed
static void ami_quit_netsurf_delayed(void)
int ami_gui_get_quals(Object *win_obj)
Get which qualifier keys are being pressed.
static BOOL ami_handle_msg(void)
void ami_gui_update_hotlist_button(struct gui_window_2 *gwin)
static nserror gui_page_info_change(struct gui_window *gw)
void ami_schedule_redraw(struct gui_window_2 *gwin, bool full_redraw)
Schedule a redraw of the browser window - Amiga-specific function.
static bool gui_window_drag_start(struct gui_window *g, gui_drag_type type, const struct rect *rect)
static void gui_window_console_log(struct gui_window *g, browser_window_console_source src, const char *msg, size_t msglen, browser_window_console_flags flags)
static void ami_openscreenfirst(void)
static bool ami_gui_check_resource(char *fullpath, const char *file)
static void ami_gui_menu_update_all(void)
static void ami_gui_close_screen(struct Screen *scrn, BOOL locked_screen, BOOL donotwait)
static bool ami_gui_hscroll_add(struct gui_window_2 *gwin)
struct Window * ami_gui2_get_window(struct gui_window_2 *gwin)
Get window from gui_window_2.
struct browser_window * ami_gui_get_browser_window(struct gui_window *gw)
Get browser window from gui_window.
static struct MsgPort * schedulermsgport
static struct MsgPort * appport
static struct RDArgs * ami_gui_commandline(int *restrict argc, char **argv, int *restrict nargc, char **nargv)
static char * current_user_faviconcache
static struct gui_window_table amiga_window_table
struct MinList * ami_gui_get_window_list(void)
Get the window list.
char * ami_gui_get_cache_favicon_name(nsurl *url, bool only_if_avail)
struct gui_window_2 * ami_gui_get_gui_window_2(struct gui_window *gw)
Get gui_window_2 from gui_window.
static struct gui_search_web_table amiga_search_web_table
void ami_gui_tabs_toggle_all(void)
static STRPTR ami_gui_read_all_tooltypes(int argc, char **argv)
static void ami_gui_scroll_internal(struct gui_window_2 *gwin, int xs, int ys)
static char * ami_gui_get_user_dir(STRPTR current_user)
BOOL ami_gadget_hit(Object *obj, int x, int y)
#define nsoption_default_set_int(OPTION, VALUE)
void ami_gui_set_throbber_frame(struct gui_window *gw, int frame)
Set throbbing frame in gui_window.
static void ami_get_hscroll_pos(struct gui_window_2 *gwin, ULONG *xs)
void ami_quit_netsurf(void)
#define NSA_MAX_HOTLIST_BUTTON_LEN
#define AMI_GUI_TOOLBAR_MAX
struct MsgPort * ami_gui_get_shared_msgport(void)
Get shared message port.
void ami_help_new_screen(struct Screen *screen)
ULONG ami_help_signal(void)
void ami_help_process(void)
void ami_help_open(ULONG node, struct Screen *screen)
void ami_misc_fatal_error(const char *message)
int32 amiga_warn_user_multi(const char *body, const char *opt1, const char *opt2, struct Window *win)
nserror amiga_warn_user(const char *warning, const char *detail)
Warn the user of an event.
char * translate_escape_chars(const char *s)
returns a string with escape chars translated and string converted to local charset (based on remove_...
struct gui_file_table * amiga_file_table
nserror ami_pageinfo_open(struct browser_window *bw, ULONG left, ULONG top)
Open the page info window.
const struct plotter_table amiplot
bool ami_plot_screen_is_palettemapped(void)
void ami_plot_ra_free(struct gui_globals *gg)
Free a plotter render area.
struct BitMap * ami_plot_ra_get_bitmap(struct gui_globals *gg)
Get a drawing BitMap associated with a render area.
void ami_plot_clear_bbox(struct RastPort *rp, struct IBox *bbox)
void ami_plot_ra_set_pen_list(struct gui_globals *gg, struct MinList *pen_list)
Set a list of shared pens for a render area to use Only relevant for palette-mapped screens.
void ami_plot_ra_get_size(struct gui_globals *gg, int *width, int *height)
Get size of BitMap associated with a render area.
void ami_clearclipreg(struct gui_globals *gg)
struct gui_globals * ami_plot_ra_alloc(ULONG width, ULONG height, bool force32bit, bool alloc_pen_list)
Alloc a plotter render area.
void ami_plot_release_pens(struct MinList *shared_pens)
void ami_schedule_free(void)
Finalise amiga scheduler.
nserror ami_schedule(int t, void(*callback)(void *p), void *p)
Schedule a callback.
void ami_schedule_handle(struct MsgPort *nsmsgport)
Handle a message received from the scheduler process.
nserror ami_schedule_create(struct MsgPort *msgport)
Initialise amiga scheduler.
void ami_mouse_pointers_free(void)
void ami_theme_throbber_free(void)
int ami_theme_throbber_get_width(void)
void ami_theme_init(void)
void ami_init_mouse_pointers(void)
void ami_theme_throbber_setup(void)
void ami_throbber_redraw_schedule(int t, struct gui_window *g)
int ami_theme_throbber_get_height(void)
void ami_update_pointer(struct Window *win, gui_pointer_shape shape)
void ami_get_theme_filename(char *filename, const char *themestring, bool protocol)
void ami_arexx_cleanup(void)
bool ami_arexx_init(ULONG *rxsig)
void ami_arexx_self(const char *cmd)
void ami_arexx_execute(char *script)
void ami_arexx_handle(void)
void gui_window_set_pointer(struct gui_window *gw, gui_pointer_shape shape)
set the pointer shape
Low-level source data cache backing store interface.
struct gui_llcache_table * filesystem_llcache_table
nserror browser_window_history_get_thumbnail(struct browser_window *bw, struct bitmap **bitmap_out)
Get the thumbnail bitmap for the current history entry.
nserror browser_window_history_forward(struct browser_window *bw, bool new_window)
Go forward in the history.
nserror browser_window_history_back(struct browser_window *bw, bool new_window)
Go back in the history.
Interface to browser history operations.
Browser window creation and manipulation interface.
nserror browser_window_schedule_reformat(struct browser_window *bw)
Reformat the browser window contents in a safe context.
bool browser_window_redraw_ready(struct browser_window *bw)
Check whether browser window is ready for redraw.
nserror browser_window_refresh_url_bar(struct browser_window *bw)
Update URL bar for a given browser window to bw's content's URL.
nserror browser_window_get_features(struct browser_window *bw, int x, int y, struct browser_window_features *data)
Get access to any page features at the given coordinates.
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_redraw(struct browser_window *bw, int x, int y, const struct rect *clip, const struct redraw_context *ctx)
Redraw an area of a window.
bool browser_window_has_content(struct browser_window *bw)
Find out if a browser window is currently showing a content.
bool browser_window_back_available(struct browser_window *bw)
Check availability of Back action for a given browser window.
nserror browser_window_get_scrollbar_type(struct browser_window *bw, browser_scrolling *h, browser_scrolling *v)
Get the browser window's scrollbar details.
void browser_window_mouse_click(struct browser_window *bw, browser_mouse_state mouse, int x, int y)
Handle mouse clicks in a browser window.
bool browser_window_scroll_at_point(struct browser_window *bw, int x, int y, int scrx, int scry)
Send a scroll request to a browser window at a particular point.
void browser_window_destroy(struct browser_window *bw)
Close and destroy a browser window.
nserror browser_window_reload(struct browser_window *bw, bool all)
Reload the page in a browser window.
bool browser_window_reload_available(struct browser_window *bw)
Check availability of Reload action for a given browser window.
bool browser_window_forward_available(struct browser_window *bw)
Check availability of Forward action for a given browser window.
browser_window_page_info_state
Browser window page information states.
@ PAGE_STATE_INSECURE
Insecure page load.
@ PAGE_STATE_SECURE_ISSUES
Secure load, but has insecure elements.
@ PAGE_STATE_SECURE
Secure load.
@ PAGE_STATE_SECURE_OVERRIDE
Secure load, but had to override.
@ PAGE_STATE_LOCAL
Page loaded from file:/// etc.
@ PAGE_STATE_INTERNAL
Page loaded from internal handler.
const char * browser_window_get_title(struct browser_window *bw)
Get the title of a browser_window.
nserror browser_window_get_extents(struct browser_window *bw, bool scaled, int *width, int *height)
Get a browser window's content extents.
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.
void browser_window_stop(struct browser_window *bw)
Stop all fetching activity in a browser window.
bool browser_window_is_frameset(struct browser_window *bw)
Find out if a browser window contains a frameset.
nserror browser_window_set_scale(struct browser_window *bw, float scale, bool absolute)
Sets the scale of a browser window.
browser_window_page_info_state browser_window_get_page_info_state(const struct browser_window *bw)
Request the current browser window page info state.
struct hlcache_handle * browser_window_get_content(struct browser_window *bw)
Get a cache handle for the content within a browser window.
@ BW_CREATE_HISTORY
this will form a new history node (don't set for back/reload/etc)
@ BW_CREATE_TAB
New gui_window to be tab in same window as "existing" gui_window.
@ BW_CREATE_FOREGROUND
Request foreground opening.
@ BW_CREATE_CLONE
New gui_window to be clone of "existing" gui_window.
bool browser_window_stop_available(struct browser_window *bw)
Check availability of Stop action for a given browser window.
bool browser_window_drop_file_at_point(struct browser_window *bw, int x, int y, char *file)
Drop a file onto a browser window at a particular point, or determine if a file may be dropped onto t...
@ BW_NAVIGATE_HISTORY
this will form a new history node (don't set for back/reload/etc)
void browser_window_mouse_track(struct browser_window *bw, browser_mouse_state mouse, int x, int y)
Handle non-click mouse action in a browser window.
void browser_window_set_gadget_filename(struct browser_window *bw, struct form_control *gadget, const char *fn)
set filename on form control.
static osspriteop_area * buffer
The buffer characteristics.
browser_window_console_source
Sources of messages which end up in the browser window console.
@ BW_CS_SCRIPT_CONSOLE
Logging from some running script.
@ BW_CS_INPUT
Input from the client.
@ BW_CS_SCRIPT_ERROR
Error from some running script.
browser_window_console_flags
Flags for browser window console logging.
@ BW_CS_FLAG_LEVEL_LOG
Logged at the 'log' level, please only use one of the LEVEL flags.
@ BW_CS_FLAG_LEVEL_DEBUG
Logged at the 'debug' level, please use only one of the LEVEL flags.
@ BW_CS_FLAG_LEVEL_INFO
Logged at the 'info' level, please use only one of the LEVEL flags.
@ BW_CS_FLAG_LEVEL_MASK
Mask for the error level to allow easy comparison using the above.
@ BW_CS_FLAG_LEVEL_WARN
Logged at the 'warn' level, please use only one of the LEVEL flags.
@ BW_CS_FLAG_LEVEL_ERROR
Logged at the 'error' level, please use only one of the LEVEL flags.
@ BW_CS_FLAG_FOLDABLE
The log entry is foldable.
nserror fetch_fdset(fd_set *read_fd_set, fd_set *write_fd_set, fd_set *except_fd_set, int *maxfd_out)
Get the set of file descriptors the fetchers are currently using.
Fetching of data from a URL (interface).
Unified cookie database public interface.
void urldb_save_cookies(const char *filename)
Save persistent cookies to file.
void urldb_load_cookies(const char *filename)
Load a cookie file into the database.
#define amiga_datatypes_init()
nserror hotlist_fini(void)
Finalise the hotlist.
nserror hotlist_add_url(nsurl *url)
Add an entry to the hotlist for given URL.
nserror hotlist_init(const char *load_path, const char *save_path)
Initialise the hotlist.
bool hotlist_has_url(nsurl *url)
Check whether given URL is present in hotlist.
void hotlist_remove_url(nsurl *url)
Remove any entries matching the given URL from the hotlist.
nserror search_web_omni(const char *term, enum search_web_omni_flags flags, struct nsurl **url_out)
Generate a nsurl from a search term.
nserror search_web_init(const char *provider_fname)
Initialise the web search operations.
nserror search_web_select_provider(const char *selection)
Change the currently selected web search provider.
const char *const netsurf_version
User friendly version string.
Version information interface.
bool ami_drag_has_data(void)
void gui_drag_save_selection(struct gui_window *g, const char *selection)
void ami_drag_save(struct Window *win)
bool ami_drag_icon_move(void)
void gui_drag_save_object(struct gui_window *g, struct hlcache_handle *c, gui_save_type type)
#define AMI_DRAG_THRESHOLD
nserror
Enumeration of error codes.
@ NSERROR_BAD_PARAMETER
Bad Parameter.
@ NSERROR_NOMEM
Memory exhaustion.
static void gui_window_start_throbber(struct gui_window *g)
static void gui_window_stop_throbber(struct gui_window *gw)
void ami_bitmap_fini(void)
Cleanup bitmap allocations.
bool amiga_bitmap_save(void *bitmap, const char *path, unsigned flags)
Save a bitmap in the platform's native format.
PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width, int height, struct BitMap *n_bm)
struct BitMap * ami_bitmap_get_native(struct bitmap *bitmap, int width, int height, bool palette_mapped, struct BitMap *friendbm, colour bg)
struct gui_bitmap_table * amiga_bitmap_table
bool amiga_bitmap_get_opaque(void *bitmap)
Gets whether a bitmap should be plotted opaque.
#define AMI_BITMAP_SCALE_ICON
void ami_free_download_list(struct List *dllist)
nserror gui_window_save_link(struct gui_window *g, nsurl *url, const char *title)
struct gui_download_table * amiga_download_table
void ami_download_parse_backmsg(const char *backmsg)
struct FileRequester * filereq
void ami_file_req_free(void)
void ami_file_req_init(void)
struct TextFont * ami_font_open_disk_font(struct TextAttr *tattr)
void ami_font_close_disk_font(struct TextFont *tfont)
struct gui_layout_table * ami_layout_table
void ami_font_setdevicedpi(int id)
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.
nserror ami_nsoption_read(void)
nserror ami_nsoption_set_location(const char *current_user_dir)
void ami_nsoption_free(void)
nserror ami_nsoption_write(void)
struct MinList * ami_AllocMinList(void)
List abstraction as OS3 appears to have problems with NewMinList()
struct MinList * NewObjList(void)
void FreeObjList(struct MinList *objlist)
void ami_object_fini(void)
bool ami_object_init(void)
Initialisation for itempool.
void DelObject(struct nsObject *dtzo)
struct nsObject * AddObject(struct MinList *objlist, ULONG otype)
void DelObjectNoFree(struct nsObject *dtzo)
bool ami_print_cont(void)
struct MsgPort * ami_print_get_msgport(void)
struct gui_window * ami_search_get_gwin(struct find_window *fw)
Obtain gui window associated with find window.
struct gui_search_table * amiga_search_table
void ami_search_close(void)
Close search.
void ami_utf8_free(char *ptr)
nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
char * ami_to_utf8_easy(const char *string)
char * ami_utf8_easy(const char *string)
nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
static CONST_STRPTR tabs[OPTS_MAX_TABS]
void ami_gui_opts_websearch_free(struct List *websearchlist)
struct List * ami_gui_opts_websearch(int *idx)
void ami_gui_opts_open(void)
nserror ami_history_local_destroy(struct ami_history_local_window *history_local_win)
destroy a previously created local history view
struct DiskObject * amiga_icon_from_bitmap(struct bitmap *bm)
void amiga_icon_free(struct DiskObject *dobj)
void amiga_icon_superimpose_favicon_internal(struct hlcache_handle *icon, struct DiskObject *dobj)
Content for image/x-amiga-icon (icon.library interface).
#define amiga_icon_init()
struct fbtk_bitmap reload_g
struct fbtk_bitmap reload
Public content interface.
struct bitmap * content_get_bitmap(struct hlcache_handle *h)
Retrieve the bitmap contained in an image content.
Interface to platform-specific fetcher operations.
Interface to platform-specific miscellaneous browser operation table.
Core mouse and pointer states.
browser_mouse_state
Mouse state: 1 is primary mouse button.
@ BROWSER_MOUSE_PRESS_1
primary button pressed
@ BROWSER_MOUSE_CLICK_2
button 2 clicked.
@ BROWSER_MOUSE_PRESS_2
auxillary button pressed
@ BROWSER_MOUSE_TRIPLE_CLICK
button triple clicked
@ BROWSER_MOUSE_CLICK_1
button 1 clicked.
@ BROWSER_MOUSE_MOD_2
2nd modifier key pressed (eg.
@ BROWSER_MOUSE_DOUBLE_CLICK
button double clicked
@ BROWSER_MOUSE_MOD_3
3rd modifier key pressed (eg.
@ BROWSER_MOUSE_MOD_1
1st modifier key pressed (eg.
@ BROWSER_MOUSE_DRAG_1
start of button 1 drag
@ BROWSER_MOUSE_HOLDING_2
during button 2 drag
@ BROWSER_MOUSE_HOLDING_1
during button 1 drag
@ BROWSER_MOUSE_DRAG_ON
a drag operation was started and a mouse button is still pressed
@ BROWSER_MOUSE_DRAG_2
start of button 2 drag
Interface to platform-specific graphical user interface window operations.
gui_window_create_flags
Window creation control flags.
@ GW_CREATE_TAB
Create tab in same window as existing.
@ GW_CREATE_FOREGROUND
Request this window/tab is foregrounded.
gui_window_event
Window events.
@ GW_EVENT_PAGE_INFO_CHANGE
Page status has changed and so the padlock should be updated.
@ GW_EVENT_REMOVE_CARET
Remove the caret, if present.
@ GW_EVENT_NEW_CONTENT
Called when the gui_window has new content.
@ GW_EVENT_STOP_THROBBER
stop the navigation throbber.
@ GW_EVENT_UPDATE_EXTENT
Update the extent of the inside of a browser window to that of the current content.
@ GW_EVENT_START_SELECTION
selection started
@ GW_EVENT_START_THROBBER
start the navigation throbber.
Interface to key press operations.
@ NS_KEY_DELETE_LINE_START
bool browser_window_key_press(struct browser_window *bw, uint32_t key)
Handle key presses in a browser window.
void ami_openurl_open(void)
Initialise the fetcher.
void ami_openurl_close(void)
Fetching of data from a URL (Registration).
void ami_libs_close(void)
nserror nslog_init(nslog_ensure_t *ensure, int *pargc, char **argv)
Initialise the logging system.
void nslog_finalise(void)
Shut down the logging system.
#define NSLOG(catname, level, logmsg, args...)
void ami_memory_fini(struct Interrupt *memhandler)
struct Interrupt * ami_memory_init(void)
#define ami_memory_itempool_create(s)
#define ami_memory_itempool_alloc(p, s)
#define ami_memory_itempool_free(p, i, s)
#define ami_memory_itempool_delete(p)
nserror messages_add_from_file(const char *path)
Read keys and values from messages file into the standard Messages hash.
const char * messages_get_errorcode(nserror code)
lookup of a message by errorcode from the standard Messages hash.
const char * messages_get(const char *key)
Fast lookup of a message by key from the standard Messages hash.
Localised message support (interface).
NetSurf core interface registration, construction and destruction.
void netsurf_exit(void)
Finalise NetSurf core.
nserror netsurf_init(const char *store_path)
Initialise netsurf core.
nserror netsurf_register(struct netsurf_table *table)
Register operation table.
NetSurf URL handling (interface).
nserror nsurl_get_utf8(const nsurl *url, char **url_s, size_t *url_l)
Get a UTF-8 string (for human readable IDNs) from a NetSurf URL object.
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.
uint32_t nsurl_hash(const nsurl *url)
Get a URL's hash value.
const char * nsurl_access(const nsurl *url)
Access a NetSurf URL object as a string.
struct nsurl nsurl
NetSurf URL object.
struct Node * GetPred(struct Node *node)
void FreeSysObject(ULONG type, APTR obj)
APTR NewObject(struct IClass *classPtr, CONST_STRPTR classID, ULONG tagList,...)
char * ASPrintf(const char *fmt,...)
uint32 GetAttrs(Object *obj, Tag tag1,...)
struct Node * GetHead(struct List *list)
ULONG RefreshSetGadgetAttrs(struct Gadget *g, struct Window *w, struct Requester *r, Tag tag1,...)
struct Node * GetSucc(struct Node *node)
#define AllocSysObjectTags(A, B, C, D)
#define LIB_IS_AT_LEAST(B, V, R)
#define CLICKTAB_LabelTruncate
#define WINDOW_NewPrefsHook
#define WA_ContextMenuHook
#define WINDOW_BuiltInScroll
#define CLICKTAB_FlagImage
#define CLICKTAB_CloseImage
#define IDCMP_EXTENDEDMOUSE
#define BLITA_UseSrcAlpha
#define CLICKTAB_NodeClosed
#define DevNameFromLock(A, B, C, D)
#define BITMAP_DisabledSourceFile
#define ObtainCharsetInfo(A, B, C)
#define IsMinListEmpty(L)
#define LISTBROWSER_Striping
nserror amiga_plugin_hack_init(void)
static nserror gui_launch_url(struct nsurl *url)
Broadcast an URL that we can't handle.
void save_complete_init(void)
Initialise save complete module.
Save HTML document with dependencies (interface).
core web search facilities interface.
@ SEARCH_WEB_OMNI_NONE
no changes to default operation
@ SEARCH_WEB_OMNI_SEARCHONLY
The search does not attempt to interpret the url as a url before using it as a search term.
Interface to utility string handling.
Class * MakeStringClass(void)
#define STRINGVIEW_Header
void FreeStringClass(Class *)
const struct ami_win_event_table * tbl
Amiga local history viewing window context.
struct gui_window * gw
Amiga GUI stuff.
RISC OS wimp toolkit bitmap.
Page features at a specific spatial location.
enum browser_window_features::@56 form_features
type of form feature.
struct browser_window * bw
function table for fetcher operations.
const char *(* filetype)(const char *unix_path)
Determine the MIME type of a local file.
Graphical user interface browser misc function table.
nserror(* schedule)(int t, void(*callback)(void *p), void *p)
Schedule a callback.
Graphical user interface browser web search function table.
nserror(* provider_update)(const char *provider_name, struct bitmap *ico_bitmap)
called when the search provider details are updated.
User interface utf8 characterset conversion routines.
browser_mouse_state mouse_state
char *restrict helphints[GID_LAST]
browser_mouse_state prev_mouse_state
Object *restrict objects[GID_LAST]
struct List hotlist_toolbar_list
Object *restrict hotlist_toolbar_lab[AMI_GUI_TOOLBAR_MAX]
struct ami_menu_data * menu_data[AMI_MENU_AREXX_MAX+1]
gui_pointer_shape mouse_pointer
struct Node * new_tab_tab
browser_mouse_state key_state
struct find_window * searchwin
struct Hook * ctxmenu_hook
struct Hook throbber_hook
Object * clicktab_ctxmenu
struct ami_generic_window w
struct List * web_search_list
ULONG throbber_update_count
struct Node * last_new_tab
Object *restrict history_ctxmenu[2]
struct AppWindow * appwin
struct MinList * shared_pens
Graphical user interface window function table.
struct gui_window *(* create)(struct browser_window *bw, struct gui_window *existing, gui_window_create_flags flags)
Create and open a gui window for a browsing context.
first entry in window list
struct gui_window_2 * shared
bool throbbing
whether currently throbbing
struct ColumnInfo * logcolumns
struct MinList * deferred_rects
int scrollx
current scroll location
struct hlcache_handle * favicon
struct ami_history_local_window * hw
int scrolly
current scroll location
struct browser_window * bw
The 'content' window that is rendered in the gui_window.
NetSurf operation function table.
struct gui_misc_table * misc
Browser table.
union nsoption_s::@149 value
bool interactive
Redraw to show interactive features.
void * priv
Private context.
uint32_t colour
Colour type: XBGR.
struct rect rect
Rectangle coordinates.
Unified URL information database public interface.
nserror urldb_save(const char *filename)
Export the current database to file.
nserror urldb_load(const char *filename)
Import an URL database from file, replacing any existing database.
struct List * URLHistory_GetList(void)
nserror netsurf_path_to_nsurl(const char *path, struct nsurl **url)
Create a nsurl from a path.
nserror netsurf_mkpath(char **str, size_t *size, size_t nelm,...)
Generate a path from one or more component elemnts.
Default operations table for files.
struct nsoption_s * nsoptions_default
global default option table.
static struct nsoption_s defaults[]
The table of compiled in default options.
struct nsoption_s * nsoptions
global active option table.
nserror nsoption_commandline(int *pargc, char **argv, struct nsoption_s *opts)
Process commandline and set options approriately.
nserror nsoption_init(nsoption_set_default_t *set_defaults, struct nsoption_s **popts, struct nsoption_s **pdefs)
Initialise option system.
nserror nsoption_finalise(struct nsoption_s *opts, struct nsoption_s *defs)
Finalise option system.
Option reading and saving interface.
#define nsoption_charp(OPTION)
Get the value of a string option.
#define nsoption_setnull_charp(OPTION, VALUE)
set string option in default table if currently unset
#define nsoption_int(OPTION)
Get the value of an integer option.
#define nsoption_set_int(OPTION, VALUE)
set an integer option in the default table
#define nsoption_set_bool(OPTION, VALUE)
set a boolean option in the default table
#define nsoption_set_charp(OPTION, VALUE)
set string option in default table
#define nsoption_colour(OPTION)
Get the value of a netsurf colour option.
#define nsoption_bool(OPTION)
Get the value of a boolean option.
uint32_t utf8_to_ucs4(const char *s_in, size_t l)
Convert a UTF-8 multibyte sequence into a single UCS4 character.
size_t utf8_char_byte_length(const char *s)
Calculate the length (in bytes) of a UTF-8 character.
UTF-8 manipulation functions (interface).
Interface to a number of general purpose functionality.
static nserror path(const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, const float transform[6])
Plots a path.
static nserror text(const struct redraw_context *ctx, const struct plot_font_style *fstyle, int x, int y, const char *text, size_t length)
Text plotting.
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.