diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2008-12-11 23:31:03 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2008-12-11 23:31:03 +0100 |
commit | c320585dddc168f79fe502dfa504fcec188b2329 (patch) | |
tree | 13a7c70e8b63d4c9f7e8868ada8048c416486318 /src | |
parent | 8e34df3e95fb93b1857c9881d49b6aca46e159e9 (diff) |
always use shaded colors
This makes things much simpler and improves sharing of colors.
If computing two more shades really proves to be a performance
issue, we can shade on demand without exposing this optimization
to the interface.
Diffstat (limited to 'src')
-rw-r--r-- | src/form.cc | 10 | ||||
-rw-r--r-- | src/html.cc | 13 | ||||
-rw-r--r-- | src/plain.cc | 4 | ||||
-rw-r--r-- | src/styleengine.cc | 28 | ||||
-rw-r--r-- | src/web.cc | 4 |
5 files changed, 27 insertions, 32 deletions
diff --git a/src/form.cc b/src/form.cc index d822f9e4..b1f54c02 100644 --- a/src/form.cc +++ b/src/form.cc @@ -537,7 +537,7 @@ void Html_tag_open_input(DilloHtml *html, const char *tag, int tagsize) if (prefs.standard_widget_colors) bg = NULL; else - bg = Color::createShaded(HT2LT(html), S_TOP(html)->current_bg_color); + bg = Color::create (HT2LT(html), S_TOP(html)->current_bg_color); HTML_SET_TOP_ATTR(html, backgroundColor, bg); DW2TB(html->dw)->addWidget (embed, html->styleEngine->style ()); @@ -587,7 +587,7 @@ void Html_tag_open_isindex(DilloHtml *html, const char *tag, int tagsize) if (prefs.standard_widget_colors) bg = NULL; else - bg = Color::createShaded(HT2LT(html), S_TOP(html)->current_bg_color); + bg = Color::create (HT2LT(html), S_TOP(html)->current_bg_color); HTML_SET_TOP_ATTR(html, backgroundColor, bg); DW2TB(html->dw)->addWidget (embed, html->styleEngine->style ()); @@ -655,7 +655,7 @@ void Html_tag_open_textarea(DilloHtml *html, const char *tag, int tagsize) if (prefs.standard_widget_colors) bg = NULL; else - bg = Color::createShaded(HT2LT(html), S_TOP(html)->current_bg_color); + bg = Color::create (HT2LT(html), S_TOP(html)->current_bg_color); HTML_SET_TOP_ATTR(html, backgroundColor, bg); DW2TB(html->dw)->addWidget (embed, html->styleEngine->style ()); @@ -866,7 +866,7 @@ void Html_tag_open_button(DilloHtml *html, const char *tag, int tagsize) style_attrs.borderWidth.setVal(0); style_attrs.padding.setVal(0); style_attrs.backgroundColor = - Color::createShaded(HT2LT(html), S_TOP(html)->current_bg_color); + Color::create (HT2LT(html), S_TOP(html)->current_bg_color); style = Style::create (HT2LT(html), &style_attrs); page = new Textblock (prefs.limit_text_width); @@ -1911,7 +1911,7 @@ static Embed *Html_input_image(DilloHtml *html, const char *tag, int tagsize) style_attrs = *html->styleEngine->style (); style_attrs.cursor = CURSOR_POINTER; style_attrs.backgroundColor = - style::Color::createShaded(HT2LT(html), S_TOP(html)->current_bg_color); + style::Color::create (HT2LT(html), S_TOP(html)->current_bg_color); /* create new image and add it to the button */ if ((Image = a_Html_add_new_image(html, tag, tagsize, url, &style_attrs, diff --git a/src/html.cc b/src/html.cc index 72bc7cca..4cb05756 100644 --- a/src/html.cc +++ b/src/html.cc @@ -1766,9 +1766,9 @@ static void Html_tag_open_frame (DilloHtml *html, const char *tag, int tagsize) if (a_Capi_get_flags(url) & CAPI_IsCached) { /* visited frame */ style_attrs.color = - Color::createSimple (HT2LT(html), html->visited_color); + Color::create (HT2LT(html), html->visited_color); } else { /* unvisited frame */ - style_attrs.color = Color::createSimple (HT2LT(html), html->link_color); + style_attrs.color = Color::create (HT2LT(html), html->link_color); } style_attrs.textDecoration |= TEXT_DECORATION_UNDERLINE; style_attrs.x_link = Html_set_new_link(html, &url); @@ -2136,10 +2136,10 @@ static void Html_tag_open_img(DilloHtml *html, const char *tag, int tagsize) if (html->styleEngine->style ()->x_link != -1) { /* In this case we can use the text color */ style_attrs.setBorderColor ( - Color::createShaded (HT2LT(html), style_attrs.color->getColor())); + Color::create (HT2LT(html), style_attrs.color->getColor())); } else { style_attrs.setBorderColor ( - Color::createShaded (HT2LT(html), html->link_color)); + Color::create (HT2LT(html), html->link_color)); } style_attrs.setBorderStyle (BORDER_SOLID); style_attrs.borderWidth.setVal (border); @@ -2336,7 +2336,7 @@ static void Html_tag_open_object(DilloHtml *html, const char *tag, int tagsize) style_attrs = *html->styleEngine->style (); if (a_Capi_get_flags(url) & CAPI_IsCached) { - style_attrs.color = Color::createSimple ( + style_attrs.color = Color::create ( HT2LT(html), html->visited_color /* @@ -2348,8 +2348,7 @@ static void Html_tag_open_object(DilloHtml *html, const char *tag, int tagsize) */ ); } else { - style_attrs.color = Color::createSimple(HT2LT(html), - html->link_color); + style_attrs.color = Color::create (HT2LT(html), html->link_color); } style_attrs.textDecoration |= TEXT_DECORATION_UNDERLINE; diff --git a/src/plain.cc b/src/plain.cc index b75dbea5..8826dafe 100644 --- a/src/plain.cc +++ b/src/plain.cc @@ -108,9 +108,9 @@ DilloPlain::DilloPlain(BrowserWindow *p_bw, const DilloUrl *p_url) styleAttrs.initValues (); styleAttrs.margin.setVal (5); styleAttrs.font = style::Font::create (layout, &fontAttrs); - styleAttrs.color = style::Color::createSimple (layout, prefs.text_color); + styleAttrs.color = style::Color::create (layout, prefs.text_color); styleAttrs.backgroundColor = - style::Color::createSimple (layout, prefs.bg_color); + style::Color::create (layout, prefs.bg_color); widgetStyle = style::Style::create (layout, &styleAttrs); /* The context menu */ diff --git a/src/styleengine.cc b/src/styleengine.cc index 79343e88..3f1df608 100644 --- a/src/styleengine.cc +++ b/src/styleengine.cc @@ -35,8 +35,8 @@ StyleEngine::StyleEngine (dw::core::Layout *layout) { style_attrs.initValues (); style_attrs.font = Font::create (layout, &font_attrs); - style_attrs.color = Color::createSimple (layout, 0); - style_attrs.backgroundColor = Color::createSimple (layout, 0xffffff); + style_attrs.color = Color::create (layout, 0); + style_attrs.backgroundColor = Color::create (layout, 0xffffff); n->style = Style::create (layout, &style_attrs); } @@ -196,23 +196,23 @@ void StyleEngine::apply (StyleAttrs *attrs, CssPropertyList *props) { /* \todo missing cases */ case CssProperty::CSS_PROPERTY_BACKGROUND_COLOR: attrs->backgroundColor = - Color::createSimple (layout, p->value.intVal); + Color::create (layout, p->value.intVal); break; case CssProperty::CSS_PROPERTY_BORDER_TOP_COLOR: attrs->borderColor.top = - Color::createShaded (layout, p->value.intVal); + Color::create (layout, p->value.intVal); break; case CssProperty::CSS_PROPERTY_BORDER_BOTTOM_COLOR: attrs->borderColor.bottom = - Color::createShaded (layout, p->value.intVal); + Color::create (layout, p->value.intVal); break; case CssProperty::CSS_PROPERTY_BORDER_LEFT_COLOR: attrs->borderColor.left = - Color::createShaded (layout, p->value.intVal); + Color::create (layout, p->value.intVal); break; case CssProperty::CSS_PROPERTY_BORDER_RIGHT_COLOR: attrs->borderColor.right = - Color::createShaded (layout, p->value.intVal); + Color::create (layout, p->value.intVal); break; case CssProperty::CSS_PROPERTY_BORDER_BOTTOM_STYLE: attrs->borderStyle.bottom = (BorderStyle) p->value.intVal; @@ -243,7 +243,7 @@ void StyleEngine::apply (StyleAttrs *attrs, CssPropertyList *props) { computeValue (&attrs->vBorderSpacing, p->value.intVal, attrs->font); break; case CssProperty::CSS_PROPERTY_COLOR: - attrs->color = Color::createSimple (layout, p->value.intVal); + attrs->color = Color::create (layout, p->value.intVal); break; case CssProperty::CSS_PROPERTY_CURSOR: attrs->cursor = (Cursor) p->value.intVal; @@ -307,17 +307,13 @@ void StyleEngine::apply (StyleAttrs *attrs, CssPropertyList *props) { /* make sure border colors are set */ if (attrs->borderColor.top == NULL) - attrs->borderColor.top = Color::createShaded (layout, - attrs->color->getColor ()); + attrs->borderColor.top = attrs->color; if (attrs->borderColor.bottom == NULL) - attrs->borderColor.bottom = Color::createShaded (layout, - attrs->color->getColor ()); + attrs->borderColor.bottom = attrs->color; if (attrs->borderColor.left == NULL) - attrs->borderColor.left = Color::createShaded (layout, - attrs->color->getColor ()); + attrs->borderColor.left = attrs->color; if (attrs->borderColor.right == NULL) - attrs->borderColor.right = Color::createShaded (layout, - attrs->color->getColor ()); + attrs->borderColor.right = attrs->color; } @@ -80,9 +80,9 @@ int a_Web_dispatch_by_type (const char *Type, DilloWeb *Web, styleAttrs.initValues (); styleAttrs.margin.setVal (5); styleAttrs.font = style::Font::create (layout, &fontAttrs); - styleAttrs.color = style::Color::createSimple (layout, 0xff0000); + styleAttrs.color = style::Color::create (layout, 0xff0000); styleAttrs.backgroundColor = - style::Color::createSimple (layout, prefs.bg_color); + style::Color::create (layout, prefs.bg_color); widgetStyle = style::Style::create (layout, &styleAttrs); dw->setStyle (widgetStyle); widgetStyle->unref (); |