Changes required for new-cache

svn path=/trunk/netsurf/; revision=10186
This commit is contained in:
Chris Young 2010-03-28 15:51:05 +00:00
parent 5d074feaf2
commit 5bb5cedec5
24 changed files with 205 additions and 178 deletions

View File

@ -148,15 +148,18 @@ STATIC VOID rx_open(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unu
STATIC VOID rx_save(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
{
BPTR fh = 0;
ULONG source_size;
char *source_data;
if(!curbw) return;
ami_update_pointer(curbw->window->shared->win,GUI_POINTER_WAIT);
if(fh = FOpen(cmd->ac_ArgList[0],MODE_NEWFILE,0))
{
FWrite(fh,curbw->current_content->source_data,1,curbw->current_content->source_size);
if(source_data = content_get_source_data(curbw->current_content, &source_size))
FWrite(fh, source_data, 1, source_size);
FClose(fh);
SetComment(cmd->ac_ArgList[0],curbw->current_content->url);
SetComment(cmd->ac_ArgList[0], content_get_url(curbw->current_content));
}
ami_update_pointer(curbw->window->shared->win,GUI_POINTER_DEFAULT);
@ -176,7 +179,7 @@ STATIC VOID rx_geturl(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((u
{
if(curbw && curbw->current_content)
{
strcpy(result,curbw->current_content->url);
strcpy(result, content_get_url(curbw->current_content));
}
else
{

View File

@ -248,13 +248,17 @@ bool ami_easy_clipboard_bitmap(struct bitmap *bitmap)
}
#ifdef WITH_NS_SVG
bool ami_easy_clipboard_svg(struct content *c)
bool ami_easy_clipboard_svg(struct hlcache_handle *c)
{
if(c->type != CONTENT_SVG) return false;
char *source_data;
ULONG source_size;
if(content_get_type(c) != CONTENT_SVG) return false;
if((source_data = content_get_source_data(c, &source_size)) == NULL) return false;
if(!(OpenIFF(iffh,IFFF_WRITE)))
{
ami_svg_to_dr2d(iffh,c->source_data,c->source_size,c->url);
ami_svg_to_dr2d(iffh, source_data, source_size, content_get_url(c));
CloseIFF(iffh);
}

View File

@ -24,6 +24,6 @@ void ami_clipboard_free(void);
bool ami_easy_clipboard(char *text);
bool ami_easy_clipboard_bitmap(struct bitmap *bitmap);
#ifdef WITH_NS_SVG
bool ami_easy_clipboard_svg(struct content *c);
bool ami_easy_clipboard_svg(struct hlcache_handle *c);
#endif
#endif

View File

@ -73,14 +73,14 @@ void ami_context_menu_free(void)
void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
{
struct content *cc = gwin->bw->current_content;
struct hlcache_handle *cc = gwin->bw->current_content;
struct box *curbox;
int box_x=0;
int box_y=0;
bool menuhascontent = false;
if(!cc) return;
if(cc->type != CONTENT_HTML) return;
if(content_get_type(cc) != CONTENT_HTML) return;
if(gwin->objects[OID_MENU]) DisposeObject(gwin->objects[OID_MENU]);
@ -91,7 +91,7 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
PMA_MenuHandler, &gwin->popuphook,
TAG_DONE);
curbox = gwin->bw->current_content->data.html.layout;
curbox = html_get_box_tree(gwin->bw->current_content);
while(curbox = box_at_point(curbox,x,y,&box_x,&box_y,&cc))
{
@ -139,12 +139,12 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
PMA_AddItem,NewObject(POPUPMENU_GetItemClass(), NULL,
PMIA_Title, (ULONG)ctxmenulab[CMID_SHOWOBJ],
PMIA_ID,CMID_SHOWOBJ,
PMIA_UserData,curbox->object->url,
PMIA_UserData, content_get_url(curbox->object),
TAG_DONE),
PMA_AddItem,NewObject(POPUPMENU_GetItemClass(), NULL,
PMIA_Title, (ULONG)ctxmenulab[CMID_COPYOBJ],
PMIA_ID,CMID_COPYOBJ,
PMIA_UserData,curbox->object->url,
PMIA_UserData, content_get_url(curbox->object),
TAG_DONE),
PMA_AddItem,NewObject(POPUPMENU_GetItemClass(), NULL,
PMIA_Title, (ULONG)ctxmenulab[CMID_CLIPOBJ],
@ -222,7 +222,10 @@ uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved)
struct gui_window_2 *gwin = hook->h_Data;
APTR userdata = NULL;
struct browser_window *bw;
struct content *object;
struct hlcache_handle *object;
char *source_data;
ULONG source_size;
struct bitmap *bm;
if(GetAttrs(item,PMIA_ID,&itemid,
PMIA_UserData,&userdata,
@ -267,31 +270,35 @@ uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved)
break;
case CMID_URLOPENWIN:
bw = browser_window_create(userdata,gwin->bw, gwin->bw->current_content->url, true, false);
bw = browser_window_create(userdata, gwin->bw,
content_get_url(gwin->bw->current_content), true, false);
break;
case CMID_URLOPENTAB:
bw = browser_window_create(userdata,gwin->bw, gwin->bw->current_content->url, true, true);
bw = browser_window_create(userdata, gwin->bw,
content_get_url(gwin->bw->current_content), true, true);
break;
case CMID_SAVEURL:
browser_window_download(gwin->bw,userdata,gwin->bw->current_content->url);
browser_window_download(gwin->bw, userdata,
content_get_url(gwin->bw->current_content));
break;
case CMID_SHOWOBJ:
browser_window_go(gwin->bw,userdata,gwin->bw->current_content->url,true);
browser_window_go(gwin->bw, userdata,
content_get_url(gwin->bw->current_content), true);
break;
case CMID_CLIPOBJ:
object = (struct content *)userdata;
if(object->bitmap)
object = (struct hlcache_handle *)userdata;
if((bm = content_get_bitmap(object)))
{
object->bitmap->url = object->url;
object->bitmap->title = object->title;
ami_easy_clipboard_bitmap(object->bitmap);
bm->url = content_get_url(object);
bm->title = content_get_title(object);
ami_easy_clipboard_bitmap(bm);
}
#ifdef WITH_NS_SVG
else if(object->type == CONTENT_SVG)
else if(content_get_type(object) == CONTENT_SVG)
{
ami_easy_clipboard_svg(object);
}
@ -299,12 +306,12 @@ uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved)
break;
case CMID_SAVEOBJ:
object = (struct content *)userdata;
object = (struct hlcache_handle *)userdata;
if(AslRequestTags(savereq,
ASLFR_TitleText,messages_get("NetSurf"),
ASLFR_Screen,scrn,
ASLFR_InitialFile,FilePart(object->url),
ASLFR_InitialFile,FilePart(content_get_url(object)),
TAG_DONE))
{
BPTR fh = 0;
@ -314,40 +321,43 @@ uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved)
ami_update_pointer(gwin->win,GUI_POINTER_WAIT);
if(fh = FOpen(fname,MODE_NEWFILE,0))
{
FWrite(fh,object->source_data,1,object->source_size);
if((source_data = content_get_source_data(object, &source_size)))
FWrite(fh, source_data, 1, source_size);
FClose(fh);
SetComment(fname,object->url);
SetComment(fname, content_get_url(object));
}
ami_update_pointer(gwin->win,GUI_POINTER_DEFAULT);
}
break;
case CMID_SAVEIFFOBJ:
object = (struct content *)userdata;
object = (struct hlcache_handle *)userdata;
if(AslRequestTags(savereq,
ASLFR_TitleText,messages_get("NetSurf"),
ASLFR_Screen,scrn,
ASLFR_InitialFile,FilePart(object->url),
ASLFR_InitialFile,FilePart(content_get_url(object)),
TAG_DONE))
{
BPTR fh = 0;
char fname[1024];
strlcpy(&fname,savereq->fr_Drawer,1024);
AddPart(fname,savereq->fr_File,1024);
if(object->bitmap)
if((bm = content_get_bitmap(object)))
{
object->bitmap->url = object->url;
object->bitmap->title = object->title;
bitmap_save(object->bitmap,fname,0);
bm->url = content_get_url(object);
bm->title = content_get_title(object);
bitmap_save(bm, fname, 0);
}
#ifdef WITH_NS_SVG
else if(object->type == CONTENT_SVG)
else if(content_get_type(object) == CONTENT_SVG)
{
ami_save_svg(object,fname);
}
#endif
SetComment(fname,object->url);
SetComment(fname, content_get_url(object));
ami_update_pointer(gwin->win,GUI_POINTER_DEFAULT);
}
break;

View File

@ -296,7 +296,7 @@ gui_window_save_link(struct gui_window *g, const char *url, const char *title)
}
}
void gui_drag_save_object(gui_save_type type, struct content *c,
void gui_drag_save_object(gui_save_type type, hlcache_handle *c,
struct gui_window *g)
{
if(strcmp(option_use_pubscreen,"Workbench")) return;
@ -320,6 +320,8 @@ void ami_drag_save(struct Window *win)
{
ULONG which,type;
char path[1025],dpath[1025];
char *source_data;
ULONG source_size;
which = WhichWorkbenchObject(NULL,scrn->MouseX,scrn->MouseY,
WBOBJA_Type,&type,
@ -354,15 +356,17 @@ void ami_drag_save(struct Window *win)
case GUI_SAVE_OBJECT_ORIG: // object
case GUI_SAVE_SOURCE:
{
struct content *c = drag_save_data;
struct hlcache_handle *c = drag_save_data;
BPTR fh = 0;
AddPart(path,c->title,1024);
AddPart(path, content_get_title(c), 1024);
if(fh = FOpen(path,MODE_NEWFILE,0))
{
FWrite(fh,c->source_data,1,c->source_size);
if((source_data = content_get_source_data(c, &source_size)))
FWrite(fh, source_data, 1, source_size);
FClose(fh);
SetComment(path,c->url);
SetComment(path, content_get_url(c));
}
}
break;
@ -374,15 +378,15 @@ void ami_drag_save(struct Window *win)
case GUI_SAVE_COMPLETE:
{
struct content *c = drag_save_data;
struct hlcache_handle *c = drag_save_data;
BPTR lock = 0;
AddPart(path,c->title,1024);
AddPart(path, content_get_title(c), 1024);
if(lock = CreateDir(path))
{
UnLock(lock);
save_complete(c,path);
SetComment(path,c->url);
SetComment(path, content_get_url(c));
}
ami_superimpose_favicon(path,
drag_save_gui->favicon, NULL);
@ -391,18 +395,20 @@ void ami_drag_save(struct Window *win)
case GUI_SAVE_OBJECT_NATIVE:
{
struct content *c = drag_save_data;
AddPart(path,c->title,1024);
if(c->bitmap)
hlcache_handle *c = drag_save_data;
struct bitmap *bm;
AddPart(path, content_get_title(c), 1024);
if(bm = content_get_bitmap(c))
{
c->bitmap->url = c->url;
c->bitmap->title = c->title;
bitmap_save(c->bitmap,path,0);
bm->url = content_get_url(c);
bm->title = content_get_title(c);
bitmap_save(bm, path, 0);
}
#ifdef WITH_NS_SVG
else if(c->type == CONTENT_SVG)
else if(content_get_type(c) == CONTENT_SVG)
{
ami_save_svg(c,path);
ami_save_svg(c, path);
}
#endif
}
@ -414,7 +420,7 @@ void ami_drag_save(struct Window *win)
ami_update_pointer(win,GUI_POINTER_DEFAULT);
}
void ami_superimpose_favicon(STRPTR path, struct content *icon, STRPTR type)
void ami_superimpose_favicon(STRPTR path, struct hlcache_handle *icon, STRPTR type)
{
struct DiskObject *dobj = NULL;
struct BitMap *bm = NULL;
@ -449,14 +455,14 @@ void ami_superimpose_favicon(STRPTR path, struct content *icon, STRPTR type)
* and OS4 default icons should all be truecolour anyway. */
if(format == IDFMT_DIRECTMAPPED)
{
if ((icon != NULL) && (icon->type == CONTENT_ICO))
if ((icon != NULL) && (content_get_type(icon) == CONTENT_ICO))
{
nsico_set_bitmap_from_size(icon, 16, 16);
}
if ((icon != NULL) && (icon->bitmap != NULL))
if ((icon != NULL) && (content_get_bitmap(icon) != NULL))
{
bm = ami_getcachenativebm(icon->bitmap, 16, 16, NULL);
bm = ami_getcachenativebm(content_get_bitmap(icon), 16, 16, NULL);
}
if(bm)

View File

@ -49,5 +49,5 @@ struct gui_window *drag_save_gui;
void ami_download_window_abort(struct gui_download_window *dw);
void ami_drag_save(struct Window *win);
void ami_free_download_list(struct List *dllist);
void ami_superimpose_favicon(STRPTR path, struct content *icon, STRPTR type);
void ami_superimpose_favicon(STRPTR path, struct hlcache_handle *icon, STRPTR type);
#endif

View File

@ -49,7 +49,6 @@ struct ami_file_fetch_info {
int httpcode;
int64 len;
char *mimetype;
struct cache_data cachedata;
};
static bool ami_fetch_file_initialise(const char *scheme);
@ -170,16 +169,6 @@ bool ami_fetch_file_start(void *vfetch)
/* LOG(("ami file fetcher start")); */
fetch->cachedata.req_time = time(NULL);
fetch->cachedata.res_time = time(NULL);
fetch->cachedata.date = 0;
fetch->cachedata.expires = 0;
fetch->cachedata.age = INVALID_AGE;
fetch->cachedata.max_age = 0;
fetch->cachedata.no_cache = true;
fetch->cachedata.etag = NULL;
fetch->cachedata.last_modified = 0;
return true;
}
@ -268,7 +257,7 @@ void ami_fetch_file_poll(const char *scheme_ignored)
if((len<1024) && (!fetch->aborted))
{
ami_fetch_file_send_callback(FETCH_FINISHED,
fetch, &fetch->cachedata, 0,
fetch, NULL, 0,
errorcode);
fetch->aborted = true;

View File

@ -404,7 +404,12 @@ void ami_amiupdate(void)
int main(int argc, char** argv)
{
setbuf(stderr, NULL);
return netsurf_main(argc, argv);
netsurf_init(argc, argv);
netsurf_main_loop();
netsurf_exit();
return 0;
}
void gui_init(int argc, char** argv)
@ -1341,8 +1346,8 @@ void ami_handle_msg(void)
case KEY_TEXT_END: // end
gui_window_set_scroll(gwin->bw->window,
gwin->bw->current_content->width,
gwin->bw->current_content->height);
content_get_width(gwin->bw->current_content),
content_get_height(gwin->bw->current_content));
break;
case KEY_WORD_RIGHT: // alt+right
@ -1476,7 +1481,7 @@ void ami_handle_appmsg(void)
struct WBArg *appwinargs;
STRPTR filename;
struct box *box,*file_box=0,*text_box=0;
struct content *content;
hlcache_handle *content;
int box_x=0,box_y=0;
BPTR fh = 0;
char *utf8text,*urlfilename;
@ -1522,7 +1527,9 @@ void ami_handle_appmsg(void)
AddPart(filename,appwinargs->wa_Name,1024);
if((!gwin->bw->current_content || gwin->bw->current_content->type != CONTENT_HTML) || (!((x>=xs) && (y>=ys) && (x<width+xs) && (y<height+ys))))
if((!gwin->bw->current_content ||
content_get_type(gwin->bw->current_content) != CONTENT_HTML) ||
(!((x>=xs) && (y>=ys) && (x<width+xs) && (y<height+ys))))
{
urlfilename = path_to_url(filename);
browser_window_go(gwin->bw,urlfilename,NULL,true);
@ -1531,7 +1538,7 @@ void ami_handle_appmsg(void)
else
{
content = gwin->bw->current_content;
box = content->data.html.layout;
box = html_get_box_tree(content);
while ((box = box_at_point(box, x, y, &box_x, &box_y, &content)))
{
if (box->style && css_computed_visibility(box->style) == CSS_VISIBILITY_HIDDEN) continue;
@ -1824,8 +1831,8 @@ void ami_switch_tab(struct gui_window_2 *gwin,bool redraw)
gui_window_set_scroll(gwin->bw->window,gwin->bw->window->scrollx,gwin->bw->window->scrolly);
gwin->redraw_scroll = false;
browser_window_refresh_url_bar(gwin->bw,gwin->bw->current_content->url,
gwin->bw->frag_id);
browser_window_refresh_url_bar(gwin->bw,
content_get_url(gwin->bw->current_content), gwin->bw->frag_id);
}
}
@ -2915,7 +2922,7 @@ void gui_window_set_title(struct gui_window *g, const char *title)
* \param sy vertical scroller position
*/
void ami_do_redraw_limits(struct gui_window *g, struct content *c,int x0, int y0, int x1, int y1, ULONG sx, ULONG sy)
void ami_do_redraw_limits(struct gui_window *g, hlcache_handle *c,int x0, int y0, int x1, int y1, ULONG sx, ULONG sy)
{
ULONG xoffset,yoffset,width=800,height=600;
ULONG htemp,vtemp;
@ -2935,7 +2942,7 @@ void ami_do_redraw_limits(struct gui_window *g, struct content *c,int x0, int y0
GetAttr(SPACE_AreaBox, g->shared->objects[GID_BROWSER], (ULONG *)&bbox);
if(!c) return;
if (c->locked) return;
// if (c->locked) return;
current_redraw_browser = g->shared->bw;
@ -2995,7 +3002,7 @@ void ami_do_redraw_limits(struct gui_window *g, struct content *c,int x0, int y0
void gui_window_redraw(struct gui_window *g, int x0, int y0, int x1, int y1)
{
ULONG sx,sy;
struct content *c;
hlcache_handle *c;
c = g->shared->bw->current_content;
ami_get_hscroll_pos(g->shared, (ULONG *)&sx);
@ -3038,7 +3045,7 @@ void ami_do_redraw(struct gui_window_2 *g)
{
struct Region *reg = NULL;
struct Rectangle rect;
struct content *c;
hlcache_handle *c;
ULONG hcurrent,vcurrent,xoffset,yoffset,width=800,height=600,x0=0,y0=0;
struct IBox *bbox;
ULONG oldh=g->oldh,oldv=g->oldv;
@ -3051,7 +3058,7 @@ void ami_do_redraw(struct gui_window_2 *g)
c = g->bw->current_content;
if(!c) return;
if (c->locked) return;
// if (c->locked) return;
current_redraw_browser = g->bw;
// currp = &browserglob.rp;
@ -3080,7 +3087,7 @@ void ami_do_redraw(struct gui_window_2 *g)
// if (c->type == CONTENT_HTML) scale = 1;
if(g->redraw_scroll && c->type == CONTENT_HTML)
if(g->redraw_scroll && content_get_type(c) == CONTENT_HTML)
{
g->bw->window->c_h_temp = g->bw->window->c_h;
gui_window_remove_caret(g->bw->window);
@ -3127,7 +3134,7 @@ void ami_do_redraw(struct gui_window_2 *g)
ami_clg(0xffffff);
glob->scale = g->bw->scale;
if(c->type == CONTENT_HTML)
if(content_get_type(c) == CONTENT_HTML)
{
content_redraw(c, -hcurrent,
-vcurrent,
@ -3143,8 +3150,8 @@ void ami_do_redraw(struct gui_window_2 *g)
-vcurrent /* * g->bw->scale */,
(width / g->bw->scale) - hcurrent,
(height / g->bw->scale) - vcurrent,
0,0,c->width /* * g->bw->scale */,
c->height /* * g->bw->scale */,
0,0, content_get_width(c) /* * g->bw->scale */,
content_get_height(c) /* * g->bw->scale */,
g->bw->scale,0xFFFFFF);
}
@ -3199,8 +3206,8 @@ void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
if(sx<0) sx=0;
if(sy<0) sy=0;
if(!g->shared->bw || !g->shared->bw->current_content) return;
if(sx > g->shared->bw->current_content->width) sx = g->shared->bw->current_content->width;
if(sy > g->shared->bw->current_content->height) sy = g->shared->bw->current_content->height;
if(sx > content_get_width(g->shared->bw->current_content)) sx = content_get_width(g->shared->bw->current_content);
if(sy > content_get_height(g->shared->bw->current_content)) sy = content_get_height(g->shared->bw->current_content);
if(g->tab_node && (g->shared->tabs > 1))
GetAttr(CLICKTAB_Current,
@ -3289,7 +3296,7 @@ void gui_window_update_extent(struct gui_window *g)
(ULONG *)&bbox);
RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[OID_VSCROLL],g->shared->win,NULL,
SCROLLER_Total, (ULONG)(g->shared->bw->current_content->height * g->shared->bw->scale),
SCROLLER_Total, (ULONG)(content_get_height(g->shared->bw->current_content) * g->shared->bw->scale),
SCROLLER_Visible, bbox->Height,
TAG_DONE);
@ -3297,7 +3304,7 @@ void gui_window_update_extent(struct gui_window *g)
{
RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[GID_HSCROLL],
g->shared->win, NULL,
PGA_Total, (ULONG)(g->shared->bw->current_content->width * g->shared->bw->scale),
PGA_Total, (ULONG)(content_get_width(g->shared->bw->current_content) * g->shared->bw->scale),
PGA_Visible, bbox->Width,
TAG_DONE);
}
@ -3305,7 +3312,7 @@ void gui_window_update_extent(struct gui_window *g)
{
RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[OID_HSCROLL],
g->shared->win, NULL,
SCROLLER_Total, (ULONG)(g->shared->bw->current_content->width * g->shared->bw->scale),
SCROLLER_Total, (ULONG)(content_get_width(g->shared->bw->current_content) * g->shared->bw->scale),
SCROLLER_Visible, bbox->Width,
TAG_DONE);
}
@ -3373,7 +3380,7 @@ void gui_window_set_url(struct gui_window *g, const char *url)
/**
* function to add retrieved favicon to gui
*/
void gui_window_set_icon(struct gui_window *g, struct content *icon)
void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
{
struct BitMap *bm = NULL;
struct IBox *bbox;
@ -3387,17 +3394,17 @@ void gui_window_set_icon(struct gui_window *g, struct content *icon)
(ULONG *)&cur_tab);
if ((icon != NULL) &&
(icon->status != CONTENT_STATUS_READY) &&
(icon->status != CONTENT_STATUS_DONE)) return;
(content_get_status(icon) != CONTENT_STATUS_READY) &&
(content_get_status(icon) != CONTENT_STATUS_DONE)) return;
if ((icon != NULL) && (icon->type == CONTENT_ICO))
if ((icon != NULL) && (content_get_type(icon) == CONTENT_ICO))
{
nsico_set_bitmap_from_size(icon, 16, 16);
}
if ((icon != NULL) && (icon->bitmap != NULL))
if ((icon != NULL) && (content_get_bitmap(icon) != NULL))
{
bm = ami_getcachenativebm(icon->bitmap, 16, 16,
bm = ami_getcachenativebm(content_get_bitmap(icon), 16, 16,
g->shared->win->RPort->BitMap);
}
@ -3434,7 +3441,7 @@ void gui_window_set_icon(struct gui_window *g, struct content *icon)
* \param ico may be NULL for local calls; then access current cache from
* search_web_ico()
*/
void gui_window_set_search_ico(struct content *ico)
void gui_window_set_search_ico(hlcache_handle *ico)
{
struct BitMap *bm = NULL;
struct IBox *bbox;
@ -3447,14 +3454,14 @@ void gui_window_set_search_ico(struct content *ico)
if(option_kiosk_mode == true) return;
if (ico == NULL) ico = search_web_ico();
if ((ico != NULL) && (ico->type == CONTENT_ICO))
if ((ico != NULL) && (content_get_type(ico) == CONTENT_ICO))
{
nsico_set_bitmap_from_size(ico, 16, 16);
}
if ((ico != NULL) && (ico->bitmap != NULL))
if ((ico != NULL) && (content_get_bitmap(ico) != NULL))
{
bm = ami_getcachenativebm(ico->bitmap, 16, 16, NULL);
bm = ami_getcachenativebm(content_get_bitmap(ico), 16, 16, NULL);
}
node = (struct nsObject *)GetHead((struct List *)window_list);
@ -3543,7 +3550,7 @@ void gui_window_remove_caret(struct gui_window *g)
void gui_window_new_content(struct gui_window *g)
{
struct content *c;
hlcache_handle *c;
if(g && g->shared && g->shared->bw && g->shared->bw->current_content)
c = g->shared->bw->current_content;
@ -3560,7 +3567,7 @@ void gui_window_new_content(struct gui_window *g)
if(g->shared->bw->browser_window_type != BROWSER_WINDOW_NORMAL ||
option_kiosk_mode == true) return;
if(c->type <= CONTENT_CSS)
if(content_get_type(c) <= CONTENT_CSS)
{
OnMenu(g->shared->win,AMI_MENU_SAVEAS_TEXT);
OnMenu(g->shared->win,AMI_MENU_SAVEAS_COMPLETE);
@ -3583,9 +3590,9 @@ void gui_window_new_content(struct gui_window *g)
OffMenu(g->shared->win,AMI_MENU_FIND);
#ifdef WITH_NS_SVG
if(c->bitmap || c->type == CONTENT_SVG)
if(content_get_bitmap(c) || content_get_type(c) == CONTENT_SVG)
#else
if(c->bitmap)
if(content_get_bitmap(c))
#endif
{
OnMenu(g->shared->win,AMI_MENU_COPY);

View File

@ -117,7 +117,7 @@ struct gui_window
int scrolly;
struct history_window *hw;
struct List dllist;
struct content *favicon;
hlcache_handle *favicon;
bool throbbing;
char *tabtitle;
};

View File

@ -1611,8 +1611,8 @@ BOOL ami_gui_opts_event(void)
case GID_OPTS_HOMEPAGE_CURRENT:
if(curbw) RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_HOMEPAGE],
gow->win,NULL,STRINGA_TextVal,
curbw->current_content->url,TAG_DONE);
gow->win, NULL, STRINGA_TextVal,
content_get_url(curbw->current_content), TAG_DONE);
break;
case GID_OPTS_FROMLOCALE:

View File

@ -24,7 +24,7 @@
#include "amiga/hotlist.h"
#include "amiga/tree.h"
void ami_gui_hotlist_visited(struct content *content, struct tree *tree,
void ami_gui_hotlist_visited(hlcache_handle *content, struct tree *tree,
struct node *node);
static const struct {
@ -43,9 +43,9 @@ static const struct {
};
#define ENTRIES_COUNT (sizeof(default_entries) / sizeof(default_entries[0]))
void hotlist_visited(struct content *content)
void hotlist_visited(hlcache_handle *content)
{
if ((!content) || (!content->url) || (!hotlist))
if ((!content) || (!content_get_url(content)) || (!hotlist))
return;
ami_gui_hotlist_visited(content, hotlist, hotlist->root);
}
@ -57,7 +57,7 @@ void hotlist_visited(struct content *content)
* \param tree the tree to find the URL data from
* \param node the node to update siblings and children of
*/
void ami_gui_hotlist_visited(struct content *content, struct tree *tree,
void ami_gui_hotlist_visited(hlcache_handle *content, struct tree *tree,
struct node *node)
{
struct node_element *element;
@ -66,8 +66,8 @@ void ami_gui_hotlist_visited(struct content *content, struct tree *tree,
if (!node->folder) {
element = tree_find_element(node, TREE_ELEMENT_URL);
if ((element) && (!strcmp(element->text,
content->url))) {
tree_update_URL_node(node, content->url, NULL);
content_get_url(content)))) {
tree_update_URL_node(node, content_get_url(content), NULL);
tree_handle_node_changed(tree, node, true,
false);
}
@ -129,21 +129,21 @@ void ami_hotlist_init(struct tree **hotlist)
tree_initialise(hotlist_tree);
}
void ami_hotlist_add(struct node *node,struct content *c)
void ami_hotlist_add(struct node *node, struct hlcache_handle *c)
{
const struct url_data *data;
data = urldb_get_url_data(c->url);
data = urldb_get_url_data(content_get_url(c));
if (!data)
{
urldb_add_url(c->url);
urldb_set_url_persistence(c->url,true);
data = urldb_get_url_data(c->url);
urldb_add_url(content_get_url(c));
urldb_set_url_persistence(content_get_url(c),true);
data = urldb_get_url_data(content_get_url(c));
}
if (data)
{
tree_create_URL_node(node,c->url,data,c->title);
tree_create_URL_node(node,content_get_url(c),data,content_get_title(c));
}
tree_handle_node_changed(hotlist,node,false,true);

View File

@ -21,7 +21,7 @@
#include "desktop/tree.h"
void ami_hotlist_init(struct tree **hotlist);
void ami_hotlist_add(struct node *node,struct content *c);
void ami_hotlist_add(struct node *node, struct hlcache_handle *c);
struct tree *hotlist;
#endif

View File

@ -301,9 +301,11 @@ bool ami_svg_to_dr2d(struct IFFHandle *iffh,char *buffer, uint32 size, char *url
}
#ifndef AMIGA_DR2D_STANDALONE
bool ami_save_svg(struct content *c,char *filename)
bool ami_save_svg(struct hlcache_handle *c,char *filename)
{
struct IFFHandle *iffh;
char *source_data;
ULONG source_size;
if(iffh = AllocIFF())
{
@ -316,7 +318,8 @@ bool ami_save_svg(struct content *c,char *filename)
if((OpenIFF(iffh,IFFF_WRITE))) return false;
ami_svg_to_dr2d(iffh,c->source_data,c->source_size,c->url);
if((source_data = content_get_source_data(c, &source_size)))
ami_svg_to_dr2d(iffh, source_data, source_size, content_get_url(c));
if(iffh) CloseIFF(iffh);
if(iffh->iff_Stream) Close((BPTR)iffh->iff_Stream);

View File

@ -97,9 +97,9 @@ struct dash_struct {
// IEEE Dashes[NumDashes]; /* On-off pattern */
};
bool ami_svg_to_dr2d(struct IFFHandle *iffh,char *buffer, uint32 size, char *url);
bool ami_svg_to_dr2d(struct IFFHandle *iffh, char *buffer, uint32 size, char *url);
#ifndef AMIGA_DR2D_STANDALONE
bool ami_save_svg(struct content *c,char *filename);
bool ami_save_svg(struct hlcache_handle *c, char *filename);
#endif
#endif // AMIGA_IFF_DR2D_H
#endif // WITH_NS_SVG

View File

@ -39,15 +39,15 @@
#include <images/label.h>
#include <reaction/reaction_macros.h>
void gui_401login_open(struct browser_window *bw, struct content *c,
void gui_401login_open(struct browser_window *bw, hlcache_handle *c,
const char *realm)
{
struct gui_login_window *lw = AllocVec(sizeof(struct gui_login_window),MEMF_PRIVATE | MEMF_CLEAR);
char *host;
url_host(c->url, &host);
url_host(content_get_url(c), &host);
lw->host = host;
lw->url = c->url;
lw->url = content_get_url(c);
lw->realm = (char *)realm;
lw->bw = bw;

View File

@ -416,6 +416,9 @@ void ami_menupick(ULONG code,struct gui_window_2 *gwin,struct MenuItem *item)
bool opentab=true;
char *temp;
BPTR lock = 0;
char *source_data;
ULONG source_size;
struct bitmap *bm;
tgw.tab_node = NULL;
tgw.tab = 0;
@ -427,7 +430,7 @@ void ami_menupick(ULONG code,struct gui_window_2 *gwin,struct MenuItem *item)
switch(itemnum)
{
case 0: // new window
bw = browser_window_create(NULL, gwin->bw, 0, true, openwin);
bw = browser_window_create(option_homepage_url, gwin->bw, 0, true, openwin);
break;
case 1: // new tab
@ -468,7 +471,7 @@ void ami_menupick(ULONG code,struct gui_window_2 *gwin,struct MenuItem *item)
if(AslRequestTags(savereq,
ASLFR_TitleText,messages_get("NetSurf"),
ASLFR_Screen,scrn,
ASLFR_InitialFile,FilePart(gwin->bw->current_content->url),
ASLFR_InitialFile,FilePart(content_get_url(gwin->bw->current_content)),
TAG_DONE))
{
strlcpy(&fname,savereq->fr_Drawer,1024);
@ -476,9 +479,10 @@ void ami_menupick(ULONG code,struct gui_window_2 *gwin,struct MenuItem *item)
ami_update_pointer(gwin->win,GUI_POINTER_WAIT);
if(fh = FOpen(fname,MODE_NEWFILE,0))
{
FWrite(fh,gwin->bw->current_content->source_data,1,gwin->bw->current_content->source_size);
if((source_data = content_get_source_data(gwin->bw->current_content, &source_size)))
FWrite(fh,source_data, 1, source_size);
FClose(fh);
SetComment(fname,gwin->bw->current_content->url);
SetComment(fname, content_get_url(gwin->bw->current_content));
}
ami_update_pointer(gwin->win,GUI_POINTER_DEFAULT);
}
@ -488,14 +492,14 @@ void ami_menupick(ULONG code,struct gui_window_2 *gwin,struct MenuItem *item)
if(AslRequestTags(savereq,
ASLFR_TitleText,messages_get("NetSurf"),
ASLFR_Screen,scrn,
ASLFR_InitialFile,FilePart(gwin->bw->current_content->url),
ASLFR_InitialFile,FilePart(content_get_url(gwin->bw->current_content)),
TAG_DONE))
{
strlcpy(&fname,savereq->fr_Drawer,1024);
AddPart(fname,savereq->fr_File,1024);
ami_update_pointer(gwin->win,GUI_POINTER_WAIT);
save_as_text(gwin->bw->current_content,fname);
SetComment(fname,gwin->bw->current_content->url);
SetComment(fname,content_get_url(gwin->bw->current_content));
ami_update_pointer(gwin->win,GUI_POINTER_DEFAULT);
}
break;
@ -504,7 +508,7 @@ void ami_menupick(ULONG code,struct gui_window_2 *gwin,struct MenuItem *item)
if(AslRequestTags(savereq,
ASLFR_TitleText,messages_get("NetSurf"),
ASLFR_Screen,scrn,
ASLFR_InitialFile,FilePart(gwin->bw->current_content->url),
ASLFR_InitialFile,FilePart(content_get_url(gwin->bw->current_content)),
TAG_DONE))
{
strlcpy(&fname,savereq->fr_Drawer,1024);
@ -514,7 +518,7 @@ void ami_menupick(ULONG code,struct gui_window_2 *gwin,struct MenuItem *item)
{
UnLock(lock);
save_complete(gwin->bw->current_content,fname);
SetComment(fname,gwin->bw->current_content->url);
SetComment(fname,content_get_url(gwin->bw->current_content));
ami_superimpose_favicon(fname,
gwin->bw->window->favicon, NULL);
}
@ -527,14 +531,14 @@ void ami_menupick(ULONG code,struct gui_window_2 *gwin,struct MenuItem *item)
if(AslRequestTags(savereq,
ASLFR_TitleText,messages_get("NetSurf"),
ASLFR_Screen,scrn,
ASLFR_InitialFile,FilePart(gwin->bw->current_content->url),
ASLFR_InitialFile,FilePart(content_get_url(gwin->bw->current_content)),
TAG_DONE))
{
strlcpy(&fname,savereq->fr_Drawer,1024);
AddPart(fname,savereq->fr_File,1024);
ami_update_pointer(gwin->win,GUI_POINTER_WAIT);
save_as_pdf(gwin->bw->current_content,fname);
SetComment(fname,gwin->bw->current_content->url);
SetComment(fname, content_get_url(gwin->bw->current_content));
ami_superimpose_favicon(fname,
gwin->bw->window->favicon, "pdf");
ami_update_pointer(gwin->win,GUI_POINTER_DEFAULT);
@ -546,25 +550,25 @@ void ami_menupick(ULONG code,struct gui_window_2 *gwin,struct MenuItem *item)
if(AslRequestTags(savereq,
ASLFR_TitleText,messages_get("NetSurf"),
ASLFR_Screen,scrn,
ASLFR_InitialFile,FilePart(gwin->bw->current_content->url),
ASLFR_InitialFile,FilePart(content_get_url(gwin->bw->current_content)),
TAG_DONE))
{
strlcpy(&fname,savereq->fr_Drawer,1024);
AddPart(fname,savereq->fr_File,1024);
ami_update_pointer(gwin->win,GUI_POINTER_WAIT);
if(gwin->bw->current_content->bitmap)
if((bm = content_get_bitmap(gwin->bw->current_content)))
{
gwin->bw->current_content->bitmap->url = gwin->bw->current_content->url;
gwin->bw->current_content->bitmap->title = gwin->bw->current_content->title;
bitmap_save(gwin->bw->current_content->bitmap,fname,0);
bm->url = content_get_url(gwin->bw->current_content);
bm->title = content_get_title(gwin->bw->current_content);
bitmap_save(bm, fname, 0);
}
#ifdef WITH_NS_SVG
else if(gwin->bw->current_content->type == CONTENT_SVG)
else if(content_get_type(gwin->bw->current_content) == CONTENT_SVG)
{
ami_save_svg(gwin->bw->current_content,fname);
}
#endif
SetComment(fname,gwin->bw->current_content->url);
SetComment(fname, content_get_url(gwin->bw->current_content));
ami_update_pointer(gwin->win,GUI_POINTER_DEFAULT);
}
break;
@ -625,19 +629,19 @@ void ami_menupick(ULONG code,struct gui_window_2 *gwin,struct MenuItem *item)
switch(itemnum)
{
case 0: // copy
if(gwin->bw->current_content->type <= CONTENT_CSS)
if(content_get_type(gwin->bw->current_content) <= CONTENT_CSS)
{
browser_window_key_press(gwin->bw, KEY_COPY_SELECTION);
browser_window_key_press(gwin->bw, KEY_CLEAR_SELECTION);
}
else if(gwin->bw->current_content->bitmap)
else if(bm = content_get_bitmap(gwin->bw->current_content))
{
gwin->bw->current_content->bitmap->url = gwin->bw->current_content->url;
gwin->bw->current_content->bitmap->title = gwin->bw->current_content->title;
ami_easy_clipboard_bitmap(gwin->bw->current_content->bitmap);
bm->url = content_get_url(gwin->bw->current_content);
bm->title = content_get_title(gwin->bw->current_content);
ami_easy_clipboard_bitmap(bm);
}
#ifdef WITH_NS_SVG
else if(gwin->bw->current_content->type == CONTENT_SVG)
else if(content_get_type(gwin->bw->current_content) == CONTENT_SVG)
{
ami_easy_clipboard_svg(gwin->bw->current_content);
}

View File

@ -73,7 +73,7 @@ struct ami_printer_info
struct PrinterData *PD;
struct PrinterExtendedData *PED;
struct MsgPort *msgport;
struct content *c;
struct hlcache_handle *c;
struct print_settings *ps;
int page;
int pages;
@ -206,7 +206,7 @@ BOOL ami_print_readunit(CONST_STRPTR filename, char name[],
return TRUE;
}
void ami_print_ui(struct content *c)
void ami_print_ui(struct hlcache_handle *c)
{
char filename[30];
int i;
@ -328,7 +328,7 @@ BOOL ami_print_event(struct ami_print_window *pw)
/* return TRUE if window destroyed */
ULONG class,result;
uint16 code;
struct content *c;
struct hlcache_handle *c;
int copies;
while((result = RA_HandleInput(pw->objects[OID_MAIN],&code)) != WMHI_LASTMSG)
@ -368,7 +368,7 @@ BOOL ami_print_event(struct ami_print_window *pw)
return FALSE;
}
void ami_print(struct content *c, int copies)
void ami_print(struct hlcache_handle *c, int copies)
{
double height, print_height;
float scale = option_print_scale / 100.0;
@ -392,7 +392,7 @@ void ami_print(struct content *c, int copies)
ami_print_info.PD = (struct PrinterData *)ami_print_info.PReq->io_Device;
ami_print_info.PED = &ami_print_info.PD->pd_SegmentData->ps_PED;
ami_print_info.ps = print_make_settings(PRINT_DEFAULT, c->url, &nsfont);
ami_print_info.ps = print_make_settings(PRINT_DEFAULT, content_get_url(c), &nsfont);
ami_print_info.ps->page_width = ami_print_info.PED->ped_MaxXDots;
ami_print_info.ps->page_height = ami_print_info.PED->ped_MaxYDots;
ami_print_info.ps->scale = scale;

View File

@ -27,11 +27,11 @@ struct ami_print_window {
Object *objects[OID_LAST];
struct Gadget *gadgets[GID_LAST];
struct nsObject *node;
struct content *c;
struct hlcache_handle *c;
};
void ami_print(struct content *c, int copies);
void ami_print_ui(struct content *c);
void ami_print(struct hlcache_handle *c, int copies);
void ami_print_ui(struct hlcache_handle *c);
BOOL ami_print_event(struct ami_print_window *pw);
bool ami_print_cont(void);
struct MsgPort *ami_print_init(void);

View File

@ -27,6 +27,6 @@
#include "content/content.h"
void save_complete_init(void);
bool save_complete(struct content *c, const char *path);
bool save_complete(hlcache_handle *c, const char *path);
#endif

View File

@ -40,7 +40,7 @@
* \param path path to save PDF as
* \return true on success, false on error and error reported
*/
bool save_as_pdf(struct content *c, const char *path)
bool save_as_pdf(struct hlcache_handle *c, const char *path)
{
struct print_settings *psettings;

View File

@ -16,15 +16,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _NETSURF_RISCOS_SAVE_PDF_H_
#define _NETSURF_RISCOS_SAVE_PDF_H_
#ifndef _NETSURF_AMIGA_SAVE_PDF_H_
#define _NETSURF_AMIGA_SAVE_PDF_H_
#include "utils/config.h"
#ifdef WITH_PDF_EXPORT
struct content;
bool save_as_pdf(struct content *c, const char *path);
bool save_as_pdf(struct hlcache_handle *c, const char *path);
#endif /* WITH_PDF_EXPORT */

View File

@ -99,11 +99,11 @@ static struct search_callbacks ami_search_callbacks = {
*/
void ami_search_open(struct gui_window *gwin)
{
struct content *c = gwin->shared->bw->current_content;
struct hlcache_handle *c = gwin->shared->bw->current_content;
/* only handle html/textplain contents */
if ((!c) || (c->type != CONTENT_HTML &&
c->type != CONTENT_TEXTPLAIN))
if ((!c) || (content_get_type(c) != CONTENT_HTML &&
content_get_type(c) != CONTENT_TEXTPLAIN))
return;
if (gwin->shared->bw->search_context == NULL)

View File

@ -47,7 +47,7 @@ struct session_cert {
void ami_gui_cert_close(struct session_data *data);
bool ami_gui_cert_apply(struct session_data *session);
void gui_cert_verify(struct browser_window *bw, struct content *c,
void gui_cert_verify(struct browser_window *bw, hlcache_handle *c,
const struct ssl_cert_info *certs, unsigned long num)
{
const struct ssl_cert_info *from;
@ -68,7 +68,7 @@ void gui_cert_verify(struct browser_window *bw, struct content *c,
warn_user("NoMemory", 0);
return;
}
data->url = strdup(c->url);
data->url = strdup(content_get_url(c));
if (!data->url) {
free(data);
warn_user("NoMemory", 0);

View File

@ -28,7 +28,7 @@
#include "content/urldb.h"
#include "desktop/plotters.h"
bool thumbnail_create(struct content *content, struct bitmap *bitmap,
bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap,
const char *url)
{
struct BitScaleArgs bsa;
@ -42,8 +42,9 @@ bool thumbnail_create(struct content *content, struct bitmap *bitmap,
ami_clearclipreg(&browserglob);
current_redraw_browser = curbw;
plot = amiplot;
content_redraw(content, 0, 0, content->width, content->width,
0, 0, content->width, content->width, 1.0, 0xFFFFFF);
content_redraw(content, 0, 0, content_get_width(content),
content_get_width(content), 0, 0, content_get_width(content),
content_get_width(content), 1.0, 0xFFFFFF);
current_redraw_browser = NULL;
if(GfxBase->lib_Version >= 53) // AutoDoc says v52, but this function isn't in OS4.0, so checking for v53 (OS4.1)
@ -52,8 +53,8 @@ bool thumbnail_create(struct content *content, struct bitmap *bitmap,
if(option_scale_quality) flags |= COMPFLAG_SrcFilter;
CompositeTags(COMPOSITE_Src,browserglob.bm,bitmap->nativebm,
COMPTAG_ScaleX,COMP_FLOAT_TO_FIX(bitmap->width/content->width),
COMPTAG_ScaleY,COMP_FLOAT_TO_FIX(bitmap->height/content->width),
COMPTAG_ScaleX,COMP_FLOAT_TO_FIX(bitmap->width/content_get_width(content)),
COMPTAG_ScaleY,COMP_FLOAT_TO_FIX(bitmap->height/content_get_width(content)),
COMPTAG_Flags,flags,
COMPTAG_DestX,0,
COMPTAG_DestY,0,
@ -67,15 +68,15 @@ bool thumbnail_create(struct content *content, struct bitmap *bitmap,
{
bsa.bsa_SrcX = 0;
bsa.bsa_SrcY = 0;
bsa.bsa_SrcWidth = content->width;
bsa.bsa_SrcHeight = content->width;
bsa.bsa_SrcWidth = content_get_width(content);
bsa.bsa_SrcHeight = content_get_width(content);
bsa.bsa_DestX = 0;
bsa.bsa_DestY = 0;
// bsa.bsa_DestWidth = width;
// bsa.bsa_DestHeight = height;
bsa.bsa_XSrcFactor = content->width;
bsa.bsa_XSrcFactor = content_get_width(content);
bsa.bsa_XDestFactor = bitmap->width;
bsa.bsa_YSrcFactor = content->width;
bsa.bsa_YSrcFactor = content_get_width(content);
bsa.bsa_YDestFactor = bitmap->height;
bsa.bsa_SrcBitMap = browserglob.bm;
bsa.bsa_DestBitMap = bitmap->nativebm;