changeset 1729:44b04d308585

bring back bg_color dillorc option
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Fri, 24 Sep 2010 23:08:24 +0200
parents ea58555667ac
children 2c90a2e90866
files dillorc dw/widget.cc src/html.cc src/plain.cc src/prefs.c src/prefs.h src/prefsparser.cc
diffstat 7 files changed, 21 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/dillorc	Fri Sep 17 23:17:00 2010 +0200
+++ b/dillorc	Fri Sep 24 23:08:24 2010 +0200
@@ -46,6 +46,11 @@
 #                           RENDERING SECTION
 #-------------------------------------------------------------------------
 
+# Set the background color
+# bg_color=gray
+# bg_color=0xd6d6c0
+#bg_color=0xdcd1ba
+
 # Default fonts:
 #
 # If FLTK2 has been configured with Xft enabled (the default), you can
--- a/dw/widget.cc	Fri Sep 17 23:17:00 2010 +0200
+++ b/dw/widget.cc	Fri Sep 24 23:08:24 2010 +0200
@@ -337,9 +337,7 @@
       widget = widget->parent;
    }
 
-   MSG_WARN("No background color found!\n");
-   return NULL;
-
+   return layout->getBgColor ();
 }
 
 
--- a/src/html.cc	Fri Sep 17 23:17:00 2010 +0200
+++ b/src/html.cc	Fri Sep 24 23:08:24 2010 +0200
@@ -1785,6 +1785,8 @@
     */
    if (!bgColor)
       bgColor = html->styleEngine->style ()->backgroundColor;
+   if (!bgColor)
+      bgColor = style::Color::create (HT2LT(html), prefs.bg_color);
 
    HT2LT(html)->setBgColor(bgColor);  
 
--- a/src/plain.cc	Fri Sep 17 23:17:00 2010 +0200
+++ b/src/plain.cc	Fri Sep 24 23:08:24 2010 +0200
@@ -85,6 +85,8 @@
  */
 DilloPlain::DilloPlain(BrowserWindow *p_bw)
 {
+   style::Color *bgColor;
+
    /* Init event receiver */
    plainReceiver.plain = this;
 
@@ -95,6 +97,8 @@
    state = ST_SeekingEol;
 
    Layout *layout = (Layout*) bw->render_layout;
+   bgColor = style::Color::create (layout, prefs.bg_color);
+   layout->setBgColor(bgColor);
    StyleEngine styleEngine (layout);
 
    styleEngine.startElement ("body");
--- a/src/prefs.c	Fri Sep 17 23:17:00 2010 +0200
+++ b/src/prefs.c	Fri Sep 24 23:08:24 2010 +0200
@@ -36,6 +36,7 @@
 void a_Prefs_init(void)
 {
    prefs.allow_white_bg = TRUE;
+   prefs.bg_color = 0xdcd1ba;
    prefs.buffered_drawing = 1;
    prefs.contrast_visited_color = TRUE;
    prefs.enterpress_forces_submit = FALSE;
--- a/src/prefs.h	Fri Sep 17 23:17:00 2010 +0200
+++ b/src/prefs.h	Fri Sep 24 23:08:24 2010 +0200
@@ -46,6 +46,7 @@
    DilloUrl *start_page;
    DilloUrl *home;
    bool_t allow_white_bg;
+   int32_t bg_color;
    bool_t contrast_visited_color;
    bool_t show_tooltip;
    int panel_size;
--- a/src/prefsparser.cc	Fri Sep 17 23:17:00 2010 +0200
+++ b/src/prefsparser.cc	Fri Sep 24 23:08:24 2010 +0200
@@ -16,11 +16,13 @@
 #include "prefs.h"
 #include "misc.h"
 #include "msg.h"
+#include "colors.h"
 
 #include "prefsparser.hh"
 
 typedef enum {
    PREFS_BOOL,
+   PREFS_COLOR,
    PREFS_STRING,
    PREFS_URL,
    PREFS_INT32,
@@ -43,10 +45,12 @@
 {
    const SymNode_t *node;
    uint_t i;
+   int st;
 
    /* Symbol array, sorted alphabetically */
    const SymNode_t symbols[] = {
       { "allow_white_bg", &prefs.allow_white_bg, PREFS_BOOL },
+      { "bg_color", &prefs.bg_color, PREFS_COLOR },
       { "buffered_drawing", &prefs.buffered_drawing, PREFS_INT32 },
       { "contrast_visited_color", &prefs.contrast_visited_color, PREFS_BOOL },
       { "enterpress_forces_submit", &prefs.enterpress_forces_submit,
@@ -122,6 +126,9 @@
       *(bool_t *)node->pref = (!dStrcasecmp(value, "yes") ||
                                !dStrcasecmp(value, "true"));
       break;
+   case PREFS_COLOR:
+      *(int32_t *)node->pref = a_Color_parse(value, *(int32_t*)node->pref,&st);
+      break;
    case PREFS_STRING:
       dFree(*(char **)node->pref);
       *(char **)node->pref = dStrdup(value);