changeset 925:f3a156cbce61

API cleanup: a_Html_add_new_image() loses the boolean parameter. This patch cleans things up by renaming a_Html_add_new_image() to a_Html_image_new(), removing the boolean parameter and making the caller add the image (or not) as appropriate.
author Jeremy Henty <onepoint@starurchin.org>
date Sun, 08 Feb 2009 18:32:52 -0300
parents 7fbcb380ee4d
children caf45b6c8535
files src/form.cc src/html.cc src/html_common.hh
diffstat 3 files changed, 8 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/form.cc	Sun Feb 08 18:22:24 2009 -0300
+++ b/src/form.cc	Sun Feb 08 18:32:52 2009 -0300
@@ -1911,7 +1911,7 @@
       html->styleEngine->setPseudoLink ();
 
       /* create new image and add it to the button */
-      if ((Image = a_Html_add_new_image(html, tag, tagsize, url, false))) {
+      if ((Image = a_Html_image_new(html, tag, tagsize, url))) {
          IM2DW(Image)->setStyle (html->styleEngine->style ());
          ResourceFactory *factory = HT2LT(html)->getResourceFactory();
          ComplexButtonResource *complex_b_r =
--- a/src/html.cc	Sun Feb 08 18:22:24 2009 -0300
+++ b/src/html.cc	Sun Feb 08 18:32:52 2009 -0300
@@ -1931,9 +1931,8 @@
  * Read image-associated tag attributes,
  * create new image and add it to the html page (if add is TRUE).
  */
-DilloImage *a_Html_add_new_image(DilloHtml *html, const char *tag,
-                                 int tagsize, DilloUrl *url,
-                                 bool add)
+DilloImage *a_Html_image_new(DilloHtml *html, const char *tag,
+                             int tagsize, DilloUrl *url)
 {
    const int MAX_W = 6000, MAX_H = 6000;
 
@@ -1973,7 +1972,7 @@
       dFree(width_ptr);
       dFree(height_ptr);
       width_ptr = height_ptr = NULL;
-      MSG("a_Html_add_new_image: suspicious image size request %dx%d\n", w, h);
+      MSG("a_Html_image_new: suspicious image size request %dx%d\n", w, h);
    } else {
       if (CSS_LENGTH_TYPE(l_w) != CSS_LENGTH_TYPE_AUTO)
          props.set (CSS_PROPERTY_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE, l_w);
@@ -2041,10 +2040,6 @@
 
    /* Add a new image widget to this page */
    Image = a_Image_new(0, 0, alt_ptr, 0);
-   if (add) {
-      DW2TB(html->dw)->addWidget((Widget*)Image->dw,
-                                 html->styleEngine->style());
-   }
    if (DW2TB(html->dw)->getBgColor())
       Image->bg_color = DW2TB(html->dw)->getBgColor()->getColor();
 
@@ -2107,7 +2102,8 @@
       /* TODO: usemap URLs outside of the document are not used. */
       usemap_url = a_Html_url_new(html, attrbuf, NULL, 0);
 
-   Image = a_Html_add_new_image(html, tag, tagsize, url, true);
+   Image = a_Html_image_new(html, tag, tagsize, url);
+   DW2TB(html->dw)->addWidget((Widget*)Image->dw, html->styleEngine->style());
 
    /* Image maps */
    if (a_Html_get_attr(html, tag, tagsize, "ismap")) {
--- a/src/html_common.hh	Sun Feb 08 18:22:24 2009 -0300
+++ b/src/html_common.hh	Sun Feb 08 18:32:52 2009 -0300
@@ -257,9 +257,8 @@
                          const char *url_str, const char *base_url,
                          int use_base_url);
 
-DilloImage *a_Html_add_new_image(DilloHtml *html, const char *tag,
-                                 int tagsize, DilloUrl *url,
-                                 bool add);
+DilloImage *a_Html_image_new(DilloHtml *html, const char *tag,
+                             int tagsize, DilloUrl *url);
 
 char *a_Html_parse_entities(DilloHtml *html, const char *token, int toksize);
 void a_Html_pop_tag(DilloHtml *html, int TagIdx);