23#include <proto/exec.h>
25#include <proto/intuition.h>
26#include <proto/utility.h>
27#include <proto/icon.h>
29#include <proto/application.h>
32#include <workbench/icon.h>
34#include <proto/window.h>
35#include <proto/layout.h>
37#include <proto/fuelgauge.h>
38#include <classes/window.h>
39#include <gadgets/fuelgauge.h>
40#include <gadgets/layout.h>
42#include <reaction/reaction_macros.h>
71#ifndef APPNOTIFY_DisplayTime
72#define APPNOTIFY_DisplayTime ( TAG_USER + 13 )
75#ifndef APPNOTIFY_Percentage
76#define APPNOTIFY_Percentage ( TAG_USER + 14 )
79#ifndef APPNOTIFY_StopBackMsg
80#define APPNOTIFY_StopBackMsg ( TAG_USER + 17 )
145 ASLFR_SleepWindow, TRUE,
148 ASLFR_InitialFile, dl_filename,
173 va[1] = (APTR)dw->
size;
176 if(!(dw->
fh =
FOpen((STRPTR)&dw->
fname,MODE_NEWFILE,0)))
184 snprintf(bkm, 1030,
"STOP %p", dw);
187 APPNOTIFY_PubScreenName,
"FRONT",
188 APPNOTIFY_Text, dw->
fname,
198 WA_DepthGadget, TRUE,
200 WA_CloseGadget, FALSE,
205 WINDOW_IconifyGadget, FALSE,
206 WINDOW_LockHeight,TRUE,
207 WINDOW_Position, WPOS_CENTERSCREEN,
216 FUELGAUGE_ShortTicks,TRUE,
217 FUELGAUGE_VarArgs,va,
218 FUELGAUGE_Percent,FALSE,
219 FUELGAUGE_Justification,FGJ_CENTER,
221 CHILD_NominalSize,TRUE,
222 CHILD_WeightedHeight,0,
232 dw->win = (
struct Window *)RA_OpenWindow(dw->objects[
OID_D_MAIN]);
246 const char *data,
unsigned int size)
251 FWrite(dw->
fh,data,1,size);
256 va[1] = (APTR)dw->
size;
270 FUELGAUGE_VarArgs, va,
285 FUELGAUGE_VarArgs, va,
295 struct dlnode *dln,*dln2 = NULL;
297 bool queuedl =
false;
307 APPNOTIFY_Update, TRUE,
314 snprintf(bkm, 1030,
"OPEN %s", dw->
fname);
317 APPNOTIFY_PubScreenName,
"FRONT",
318 APPNOTIFY_BackMsg, bkm,
319 APPNOTIFY_CloseOnDC, TRUE,
320 APPNOTIFY_Text, dw->
fname,
329 if((dln!=dln2) && (dln2)) queuedl =
true;
332 Remove((
struct Node *)dln);
365 const char *error_msg)
387 if(dw == NULL)
return FALSE;
391 switch(
result & WMHI_CLASSMASK)
394 switch(
result & WMHI_GADGETMASK)
413 if(IsListEmpty(dllist))
return;
420 free(
node->node.ln_Name);
421 free(
node->filename);
422 Remove((
struct Node *)
node);
423 free((
struct Node *)
node);
424 }
while((
node=nnode));
431 STRPTR openurlstring,linkname;
432 struct DiskObject *dobj = NULL;
438 ASLFR_SleepWindow, TRUE,
441 ASLFR_InitialFile, linkname,
444 strlcpy(fname,
savereq->fr_Drawer, 1024);
445 AddPart(fname,
savereq->fr_File,1024);
453 if((fh =
FOpen(fname,MODE_NEWFILE,0)))
457 FWrite(fh,openurlstring,1,strlen(openurlstring));
459 FreeVec(openurlstring);
462 dobj = GetIconTags(NULL,ICONGETA_GetDefaultName,
"url",
463 ICONGETA_GetDefaultType,WBPROJECT,
466 dobj->do_DefaultTool =
"IconX";
468 PutIconTags(fname,dobj,
469 ICONPUTA_NotifyWorkbench,TRUE,
472 FreeDiskObject(dobj);
490 lock = Lock(file, ACCESS_READ);
498 if((fh = OpenFromLock(lock))) {
502 overwritetext =
ASPrintf(
"%s\n\n%s %s\n%s %s",
512 FreeVec(overwritetext);
516 if(res == 1)
return TRUE;
522 if((backmsg[0] ==
'O') && (backmsg[1] ==
'P') && (backmsg[2] ==
'E') && (backmsg[3] ==
'N')) {
523 OpenWorkbenchObjectA((backmsg + 5), NULL);
struct Window * ami_gui_get_window(struct gui_window *gw)
Get window from gui_window.
struct Screen * ami_gui_get_screen(void)
Get a pointer to the screen NetSurf is running on.
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)
uint32 ami_gui_get_app_id(void)
Get the application.library ID NetSurf is registered as.
void ami_set_pointer(struct gui_window_2 *gwin, gui_pointer_shape shape, bool update)
void ami_reset_pointer(struct gui_window_2 *gwin)
STRPTR ami_gui_get_screen_title(void)
Get the string for NetSurf's screen titlebar.
struct List * ami_gui_get_download_list(struct gui_window *gw)
Get download list from gui_window.
void ami_gui_win_list_remove(void *win)
Remove a window from the NetSurf window list.
struct browser_window * ami_gui_get_browser_window(struct gui_window *gw)
Get browser window from gui_window.
struct gui_window_2 * ami_gui_get_gui_window_2(struct gui_window *gw)
Get gui_window_2 from gui_window.
struct MsgPort * ami_gui_get_shared_msgport(void)
Get shared message port.
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.
Browser window creation and manipulation interface.
nserror browser_window_navigate(struct browser_window *bw, struct nsurl *url, struct nsurl *referrer, enum browser_window_nav_flags flags, char *post_urlenc, struct fetch_multipart_data *post_multipart, struct hlcache_handle *parent)
Start fetching a page in a browser window.
@ BW_NAVIGATE_DOWNLOAD
download rather than render the uri
void download_context_destroy(download_context *ctx)
Destroy a download context.
nsurl * download_context_get_url(const download_context *ctx)
Retrieve the URL for a download.
const char * download_context_get_filename(const download_context *ctx)
Retrieve the filename for a download.
void download_context_abort(download_context *ctx)
Abort a download fetch.
unsigned long long int download_context_get_total_length(const download_context *ctx)
Retrieve total byte length of download.
Core download context (interface)
nserror
Enumeration of error codes.
@ NSERROR_SAVE_FAILED
Failed to save data.
static struct gui_download_table download_table
static const struct ami_win_event_table ami_download_table
static nserror gui_download_window_data(struct gui_download_window *dw, const char *data, unsigned int size)
static struct gui_download_window * gui_download_window_create(download_context *ctx, struct gui_window *gui)
static BOOL ami_download_window_event(void *w)
void ami_free_download_list(struct List *dllist)
BOOL ami_download_check_overwrite(const char *file, struct Window *win, ULONG size)
nserror gui_window_save_link(struct gui_window *g, nsurl *url, const char *title)
static void gui_download_window_error(struct gui_download_window *dw, const char *error_msg)
#define APPNOTIFY_Percentage
static void gui_download_window_done(struct gui_download_window *dw)
struct gui_download_table * amiga_download_table
static int downloads_in_progress
static void ami_download_window_abort(void *w)
void ami_download_parse_backmsg(const char *backmsg)
#define APPNOTIFY_DisplayTime
#define APPNOTIFY_StopBackMsg
struct FileRequester * savereq
void ami_utf8_free(char *ptr)
char * ami_utf8_easy(const char *string)
Content for image/ico (interface).
Content for image/x-amiga-icon (icon.library interface).
Interface to platform-specific download operations.
Core mouse and pointer states.
Interface to platform-specific graphical user interface window operations.
const char * messages_get(const char *key)
Fast lookup of a message by key from the standard Messages hash.
Localised message support (interface).
NetSurf URL handling (interface).
nserror nsurl_create(const char *const url_s, nsurl **url)
Create a NetSurf URL object from a URL string.
void nsurl_unref(nsurl *url)
Drop a reference to a NetSurf URL object.
const char * nsurl_access(const nsurl *url)
Access a NetSurf URL object as a string.
struct nsurl nsurl
NetSurf URL object.
char * ASPrintf(const char *fmt,...)
int64 GetFileSize(BPTR fh)
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)
Save HTML document with dependencies (interface).
Interface to utility string handling.
char * human_friendly_bytesize(unsigned long long int bytesize)
Create a human readable representation of a size in bytes.
struct browser_window * bw
A context for a download.
function table for download windows.
struct gui_download_window *(* create)(struct download_context *ctx, struct gui_window *parent)
context for each download.
struct ami_generic_window w
unsigned int total_size
Size of resource, or 0 if unknown.
struct browser_window * bw
struct download_context * ctx
Associated context, or 0 if the fetch has completed or aborted.
Object * objects[GID_D_LAST]
first entry in window list
Option reading and saving interface.
#define nsoption_bool(OPTION)
Get the value of a boolean option.
Interface to a number of general purpose functionality.