Merge branch 'master' of git://git.netsurf-browser.org/netsurf

This commit is contained in:
Michael Drake 2013-05-31 20:58:39 +01:00
commit e684218169
7 changed files with 73 additions and 29 deletions

View File

@ -443,6 +443,22 @@ colour_option_from_pen(struct nsoption_s *opts,
return NSERROR_OK;
}
static void ami_set_screen_defaults(struct Screen *scrn)
{
if((nsoption_int(window_x) == 0) &&
(nsoption_int(window_y) == 0) &&
(nsoption_int(window_width) == 0) &&
(nsoption_int(window_height) == 0)) {
nsoption_set_int(window_x, 0);
nsoption_set_int(window_y, scrn->BarHeight + 1);
nsoption_set_int(window_width, scrn->Width);
nsoption_set_int(window_height, scrn->Height - scrn->BarHeight - 1);
}
/* TODO: Update screen colour defaults here */
}
/**
* Set option defaults for amiga frontend
*
@ -531,9 +547,6 @@ static nserror ami_set_options(struct nsoption_s *defaults)
tree_set_icon_dir(strdup("ENV:Sys"));
if(!nsoption_int(window_width)) nsoption_set_int(window_width, 800);
if(!nsoption_int(window_height)) nsoption_set_int(window_height, 600);
#ifndef __amigaos4__
nsoption_set_bool(download_notify, false);
nsoption_set_bool(context_menu, false);
@ -745,10 +758,7 @@ void ami_openscreen(void)
dri = GetScreenDrawInfo(scrn);
ami_font_setdevicedpi(id);
/* TODO: Reset system colours so they are correct for the new screen
gui_system_colour_finalize();
gui_system_colour_init();
*/
ami_set_screen_defaults(scrn);
//ami_help_new_screen(scrn);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2008-9 Chris Young <chris@unsatisfactorysoftware.co.uk>
* Copyright 2008-9,2013 Chris Young <chris@unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@ -64,17 +64,6 @@
#include "utils/messages.h"
#include "utils/schedule.h"
#define IMAGE_MENU_ITEM(n, i, t) \
gwin->menulab[n] = LabelObject, \
LABEL_DrawInfo, dri, \
LABEL_DisposeImage, TRUE, \
LABEL_Image, BitMapObject, \
BITMAP_Screen, scrn, \
BITMAP_SourceFile, i, \
BitMapEnd, \
LABEL_Text, t, \
LabelEnd;
BOOL menualreadyinit;
const char * const netsurf_version;
const char * const verdate;
@ -169,7 +158,33 @@ static void ami_menu_alloc_item(struct gui_window_2 *gwin, int num, UBYTE type,
gwin->menulab[num] = ami_utf8_easy(messages_get(label));
}
}
if((GadToolsBase->lib_Version > 53) ||
((GadToolsBase->lib_Version == 53) && (GadToolsBase->lib_Revision >= 5))) {
/* GadTools 53.5+ only. For now we will only create the menu
using label.image if there's a bitmap associated with the item. */
if(bm != NULL) {
struct DrawInfo *dri = GetScreenDrawInfo(scrn);
struct BitMap *menu_icon = ami_bitmap_get_native(bm, 16, 16, NULL);
gwin->menuobj[num] = LabelObject,
LABEL_DrawInfo, dri,
LABEL_DisposeImage, TRUE,
LABEL_Image, BitMapObject,
BITMAP_Screen, scrn,
BITMAP_BitMap, menu_icon,
BITMAP_Width, 16,
BITMAP_Height, 16,
BitMapEnd,
LABEL_Text, gwin->menulab[num],
LabelEnd;
gwin->menutype[num] |= MENU_IMAGE;
FreeScreenDrawInfo(scrn, dri);
}
}
if(key) gwin->menukey[num] = key;
if(func) gwin->menu_hook[num].h_Entry = (HOOKFUNC)func;
if(hookdata) gwin->menu_hook[num].h_Data = hookdata;
@ -178,7 +193,6 @@ static void ami_menu_alloc_item(struct gui_window_2 *gwin, int num, UBYTE type,
void ami_init_menulabs(struct gui_window_2 *gwin)
{
int i;
struct DrawInfo *dri = GetScreenDrawInfo(scrn);
gwin->menutype = AllocVec(AMI_MENU_AREXX_MAX + 1, MEMF_PRIVATE | MEMF_CLEAR);
@ -290,8 +304,6 @@ void ami_init_menulabs(struct gui_window_2 *gwin)
ami_menu_item_arexx_execute, NULL);
ami_menu_alloc_item(gwin, M_BAR_A1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
gwin->menutype[AMI_MENU_AREXX_MAX] = NM_END;
FreeScreenDrawInfo(scrn, dri);
}
/* Menu refresh for hotlist */
@ -458,7 +470,8 @@ void ami_menu_scan_2(struct tree *tree, struct node *root, WORD *gen,
if(*gen == 1) menu_type = NM_ITEM;
if(*gen == 2) menu_type = NM_SUB;
ami_menu_alloc_item(gwin, *item, menu_type, tree_url_node_get_title(node), 0, NULL,
ami_menu_alloc_item(gwin, *item, menu_type, tree_url_node_get_title(node),
0, tree_url_node_get_icon(node),
ami_menu_item_hotlist_entries, (void *)tree_url_node_get_url(node));
if(tree_node_is_folder(node) && (!tree_node_get_child(node)))
gwin->menu[*item].nm_Flags = NM_ITEMDISABLED;

View File

@ -102,9 +102,6 @@ const struct plotter_table amiplot = {
.option_knockout = true,
};
colour ami_abgr_to_argb(colour c) {
return ns_color_to_nscss(c);
}
#ifdef NS_AMIGA_CAIRO
void ami_cairo_set_colour(cairo_t *cr,colour c)
@ -288,7 +285,7 @@ static void ami_plot_setapen(ULONG colour)
{
if(palette_mapped == false) {
SetRPAttrs(glob->rp, RPTAG_APenColor,
ami_abgr_to_argb(colour),
ns_color_to_nscss(colour),
TAG_DONE);
} else {
ULONG pen = ami_plot_obtain_pen(glob->shared_pens, colour);
@ -300,7 +297,7 @@ static void ami_plot_setopen(ULONG colour)
{
if(palette_mapped == false) {
SetRPAttrs(glob->rp, RPTAG_OPenColor,
ami_abgr_to_argb(colour),
ns_color_to_nscss(colour),
TAG_DONE);
} else {
ULONG pen = ami_plot_obtain_pen(glob->shared_pens, colour);

View File

@ -1654,6 +1654,17 @@ const char *tree_node_element_get_text(struct node_element *element)
}
/**
* Returns the node element's icon
*
* \return the node element's icon
*/
struct bitmap *tree_node_element_get_icon(struct node_element *element)
{
return element->bitmap;
}
/**
* Get the root node of a tree
*

View File

@ -200,6 +200,7 @@ void tree_update_node_element(struct tree *tree, struct node_element *element,
const char *text, void *bitmap);
bool tree_update_element_text(struct tree *tree, struct node_element *element, char *text);
const char *tree_node_element_get_text(struct node_element *element);
struct bitmap *tree_node_element_get_icon(struct node_element *element);
struct node *tree_get_root(struct tree *tree);
bool tree_is_edited(struct tree *tree);
tree_drag_type tree_drag_status(struct tree *tree);

View File

@ -339,6 +339,17 @@ const char *tree_url_node_get_url(struct node *node)
return tree_node_element_get_text(element);
}
struct bitmap *tree_url_node_get_icon(struct node *node)
{
struct node_element *element;
element = tree_node_find_element(node, TREE_ELEMENT_TITLE, NULL);
if (element == NULL)
return NULL;
return tree_node_element_get_icon(element);
}
void tree_url_node_edit_title(struct tree *tree, struct node *node)
{
struct node_element *element;

View File

@ -43,6 +43,7 @@ void tree_update_URL_node(struct tree *tree, struct node *node,
nsurl *url, const struct url_data *data);
const char *tree_url_node_get_title(struct node *node);
const char *tree_url_node_get_url(struct node *node);
struct bitmap *tree_url_node_get_icon(struct node *node);
void tree_url_node_edit_title(struct tree *tree, struct node *node);
void tree_url_node_edit_url(struct tree *tree, struct node *node);