From b180dd1a1198375765b30d0ddc3b773d432c5f99 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 28 Mar 2009 15:43:12 +0000 Subject: Stop cursor drawing off the page Implement gui_window_save_as_link Fix warnings svn path=/trunk/netsurf/; revision=6970 --- amiga/download.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++----- amiga/gui.c | 11 +++++----- 2 files changed, 66 insertions(+), 12 deletions(-) diff --git a/amiga/download.c b/amiga/download.c index af9072e6e..10b66cba5 100644 --- a/amiga/download.c +++ b/amiga/download.c @@ -21,10 +21,22 @@ #include #include #include +#include +#include + +#include #include "amiga/download.h" #include "amiga/object.h" #include "amiga/options.h" +#include "amiga/save_complete.h" + +#include "desktop/selection.h" + +#include "utils/messages.h" +#include "utils/utils.h" + +#include #include #include @@ -46,7 +58,7 @@ struct gui_download_window *gui_download_window_create(const char *url, DebugPrintF("%s\n%lx\n",url,gui); - if((!IsListEmpty(&gui->dllist)) && (dw->dln = FindName(&gui->dllist,url))) + if((!IsListEmpty(&gui->dllist)) && (dw->dln = (struct dlnode *)FindName(&gui->dllist,url))) { DebugPrintF("%lx node\n",dw->dln); strcpy(fname,dw->dln->filename); @@ -175,11 +187,11 @@ void gui_download_window_done(struct gui_download_window *dw) if(dln = dw->dln) { - dln2 = GetSucc(dln); + dln2 = (struct dlnode *)GetSucc((struct Node *)dln); if(dln != dln2) queuedl = true; free(dln->filename); - Remove(dln); + Remove((struct Node *)dln); FreeVec(dln); } @@ -197,17 +209,60 @@ void ami_free_download_list(struct List *dllist) node = (struct dlnode *)GetHead((struct List *)dllist); - while(nnode=(struct dlnode *)GetSucc((struct dlnode *)node)) + while(nnode=(struct dlnode *)GetSucc((struct Node *)node)) { free(node->node.ln_Name); free(node->filename); - Remove(node); - FreeVec(node); + Remove((struct Node *)node); + FreeVec((struct Node *)node); node=nnode; } } +void gui_window_save_as_link(struct gui_window *g, struct content *c) +{ + BPTR fh = 0; + char fname[1024]; + STRPTR openurlstring,linkname; + struct DiskObject *dobj = NULL; + + linkname = ASPrintf("Link_to_%s",FilePart(c->url)); + + if(AslRequestTags(savereq, + ASLFR_TitleText,messages_get("NetSurf"), + ASLFR_Screen,scrn, + ASLFR_InitialFile,linkname, + TAG_DONE)) + { + strlcpy(&fname,savereq->fr_Drawer,1024); + AddPart(fname,savereq->fr_File,1024); + ami_update_pointer(g->shared->win,GUI_POINTER_WAIT); + if(fh = FOpen(fname,MODE_NEWFILE,0)) + { + openurlstring = ASPrintf("openurl \"%s\"\n",c->url); + FWrite(fh,openurlstring,1,strlen(openurlstring)); + FClose(fh); + FreeVec(openurlstring); + SetComment(fname,c->url); + + dobj = GetIconTags(NULL,ICONGETA_GetDefaultName,"url", + ICONGETA_GetDefaultType,WBPROJECT, + TAG_DONE); + + dobj->do_DefaultTool = "IconX"; + + PutIconTags(fname,dobj, + ICONPUTA_NotifyWorkbench,TRUE, + TAG_DONE); + + FreeDiskObject(dobj); + } + FreeVec(linkname); + ami_update_pointer(g->shared->win,GUI_POINTER_DEFAULT); + } +} + void gui_drag_save_object(gui_save_type type, struct content *c, struct gui_window *g) { diff --git a/amiga/gui.c b/amiga/gui.c index 0339f9fdc..80912a861 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -2185,6 +2185,7 @@ DebugPrintF("%ld %ld calc\n",(y1-y0)+(yoffset+y0-vcurrent),(y0-(int)vcurrent)); BltBitMapRastPort(glob.bm,x0-hcurrent,y0-vcurrent,g->shared->win->RPort,xoffset+x0-hcurrent,yoffset+y0-vcurrent,x1-x0,y1-y0,0x0C0); +/* DebugPrintF("%ld %ld %ld %ld draw area\n%ld %ld %ld %ld clip rect\n%ld %ld bitmap src\n%ld %ld %ld %ld bitmap dest\n\n",-hcurrent,-vcurrent,width-hcurrent,height-vcurrent, (ULONG)floorf((x0 * g->shared->bw->scale)-(int)hcurrent), @@ -2192,7 +2193,7 @@ DebugPrintF("%ld %ld calc\n",(y1-y0)+(yoffset+y0-vcurrent),(y0-(int)vcurrent)); g->shared->bw->scale)-(int)vcurrent), (ULONG)x1-hcurrent, (ULONG)y1-vcurrent,x0-hcurrent,y0-vcurrent,xoffset+x0-hcurrent,yoffset+y0-vcurrent,x1-x0,y1-y0); - +*/ } void gui_window_redraw(struct gui_window *g, int x0, int y0, int x1, int y1) @@ -2706,7 +2707,9 @@ void gui_window_place_caret(struct gui_window *g, int x, int y, int height) SetAPen(g->shared->win->RPort,3); -// if(((x-xs) < bbox->Left) || ((x-xs) > (bbox->Left+bbox->Width)) || ((y-ys) < bbox->Top) || ((y-ys) > (bbox->Top+bbox->Height))) return; + if((y-ys+height) > (bbox->Height)) height = bbox->Height-y+ys; + + if(((x-xs) <= 0) || ((x-xs+2) >= (bbox->Width)) || ((y-ys) <= 0) || ((y-ys) >= (bbox->Height))) return; RectFill(g->shared->win->RPort,x+bbox->Left-xs,y+bbox->Top-ys,x+bbox->Left+2-xs,y+bbox->Top+height-ys); @@ -2752,10 +2755,6 @@ bool gui_window_frame_resize_start(struct gui_window *g) printf("resize frame\n"); } -void gui_window_save_as_link(struct gui_window *g, struct content *c) -{ -} - void gui_window_set_scale(struct gui_window *g, float scale) { printf("set scale\n"); -- cgit v1.2.3