aboutsummaryrefslogtreecommitdiff
path: root/src/web.cc
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2010-08-20 23:24:19 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2010-08-20 23:24:19 +0200
commitf5c598b518d1f906148534d015f50075d3e8242d (patch)
tree21dd70add5b366c3dd80641b77f6b18e0baa009e /src/web.cc
parente98d02a01ffeb18ede86af025e51ae1ec011c75a (diff)
parent5f0fc0e48b8cbee7e1795935da0abff6627fd498 (diff)
merge
Diffstat (limited to 'src/web.cc')
-rw-r--r--src/web.cc45
1 files changed, 16 insertions, 29 deletions
diff --git a/src/web.cc b/src/web.cc
index b9141913..17302b1c 100644
--- a/src/web.cc
+++ b/src/web.cc
@@ -9,10 +9,6 @@
* (at your option) any later version.
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h> /* for rint */
-
#include "msg.h"
#include "nav.h"
@@ -22,7 +18,7 @@
#include "IO/mime.h"
#include "dw/core.hh"
-#include "prefs.h"
+#include "styleengine.hh"
#include "web.hh"
// Platform independent part
@@ -54,9 +50,6 @@ int a_Web_dispatch_by_type (const char *Type, DilloWeb *Web,
CA_Callback_t *Call, void **Data)
{
Widget *dw = NULL;
- style::StyleAttrs styleAttrs;
- style::Style *widgetStyle;
- style::FontAttrs fontAttrs;
_MSG("a_Web_dispatch_by_type\n");
@@ -67,25 +60,17 @@ int a_Web_dispatch_by_type (const char *Type, DilloWeb *Web,
if (Web->flags & WEB_RootUrl) {
/* We have RootUrl! */
+
+ /* Set a style for the widget */
+ StyleEngine styleEngine (layout);
+ styleEngine.startElement ("body");
+ Web->bgColor= styleEngine.backgroundStyle()->backgroundColor->getColor();
+
dw = (Widget*) a_Mime_set_viewer(Type, Web, Call, Data);
if (dw == NULL)
return -1;
- /* Set a style for the widget */
- fontAttrs.name = prefs.vw_fontname;
- fontAttrs.size = (int) rint(14.0 * prefs.font_factor);
- fontAttrs.weight = 400;
- fontAttrs.style = style::FONT_STYLE_NORMAL;
-
- styleAttrs.initValues ();
- styleAttrs.margin.setVal (5);
- styleAttrs.font = style::Font::create (layout, &fontAttrs);
- styleAttrs.color = style::Color::createSimple (layout, 0xff0000);
- styleAttrs.backgroundColor =
- style::Color::createSimple (layout, prefs.bg_color);
- widgetStyle = style::Style::create (layout, &styleAttrs);
- dw->setStyle (widgetStyle);
- widgetStyle->unref ();
+ dw->setStyle (styleEngine.style ());
/* This method frees the old dw if any */
layout->setWidget(dw);
@@ -118,19 +103,21 @@ int a_Web_dispatch_by_type (const char *Type, DilloWeb *Web,
/*
* Allocate and set safe values for a DilloWeb structure
*/
-DilloWeb* a_Web_new(const DilloUrl *url)
+DilloWeb* a_Web_new(const DilloUrl *url, const DilloUrl *requester)
{
DilloWeb *web= dNew(DilloWeb, 1);
_MSG(" a_Web_new: ValidWebs ==> %d\n", dList_length(ValidWebs));
web->url = a_Url_dup(url);
+ web->requester = a_Url_dup(requester);
web->bw = NULL;
web->flags = 0;
web->Image = NULL;
web->filename = NULL;
web->stream = NULL;
web->SavedBytes = 0;
-
+ web->bgColor = 0x000000; /* Dummy value will be overwritten
+ * in a_Web_dispatch_by_type. */
dList_append(ValidWebs, (void *)web);
return web;
}
@@ -149,12 +136,12 @@ int a_Web_valid(DilloWeb *web)
void a_Web_free(DilloWeb *web)
{
if (!web) return;
- if (web->url)
- a_Url_free(web->url);
- if (web->Image)
- a_Image_unref(web->Image);
+ a_Url_free(web->url);
+ a_Url_free(web->requester);
+ a_Image_unref(web->Image);
dFree(web->filename);
dList_remove(ValidWebs, (void *)web);
+ _MSG("a_Web_free: ValidWebs=%d\n", dList_length(ValidWebs));
dFree(web);
}