ide/Project: (#241) Seeing GCC warnings when building from IDE
[sdk] / extras / html / lines.ec
index 7d09e8f..0274d14 100644 (file)
@@ -31,26 +31,35 @@ Block GetNextBlock(Block block)
       {
          if(block.type == FONT || block.type == ANCHOR)
          {
-            surface.TextFont(block.prevFont.font.font);
+            surface.TextFont(block.parent.font.font);
             if(flags.render)
-               surface.SetForeground(block.prevFont.textColor);
+               surface.SetForeground(block.parent.textColor);
          }
          block = block.next;
          break;
       }
 
+      //if(block)
+      {
+         if(block.type == FONT || block.type == ANCHOR)
+         {
+            surface.TextFont(block.parent.font.font);
+            if(flags.render)
+               surface.SetForeground(block.parent.textColor);
+         }
+      }
       block = block.parent;
 
       // Getting out of a block
       if(block)
       {
-         if(block.type == FONT || block.type == ANCHOR)
+         /*if(block.type == FONT || block.type == ANCHOR)
          {
             surface.TextFont(block.prevFont.font.font);
             if(flags.render)
                surface.SetForeground(block.prevFont.textColor);
          }
-         else if(block.type == CENTER)
+         else */if(block.type == CENTER)
          {
             if(centered)
                (*centered)--;
@@ -72,7 +81,7 @@ Block GetNextBlock(Block block)
    return block;
 }
 
-int ComputeLine(Surface surface, Block startBlock, int startTextPos, Block * nextBlock, int * nextTextPos, int * centered, int * w, 
+int ComputeLine(Surface surface, Block startBlock, int startTextPos, Block * nextBlock, int * nextTextPos, int * centered, int * w,
    int maxW, int maxH, uint flags, int y, OldList leftObjects, OldList rightObjects, bool * changeLine, bool computeStartY, int sy, int sx)
 {
    int h = 0;
@@ -106,7 +115,7 @@ int ComputeLine(Surface surface, Block startBlock, int startTextPos, Block * nex
             if(block.window)
             {
                width += block.window.size.w;
-               height = Max(height, block.window.size.h);
+               height = Max(height, Max(26, block.window.size.h));
             }
             break;
          }
@@ -161,7 +170,6 @@ int ComputeLine(Surface surface, Block startBlock, int startTextPos, Block * nex
             surface.TextExtent(" ", 1, null, &th);
             height = Max(height, th);
 
-
             for(; textPos<block.textLen && !lineComplete;)
             {
                int w;
@@ -172,7 +180,7 @@ int ComputeLine(Surface surface, Block startBlock, int startTextPos, Block * nex
                   len = (nextSpace - (text + textPos)) + 1;
                else
                   len = block.textLen - textPos;
-               
+
                surface.TextExtent(text + textPos, len, &w, &th);
 
                if(x + width + w > maxW && x > 0)
@@ -231,9 +239,11 @@ int ComputeLine(Surface surface, Block startBlock, int startTextPos, Block * nex
             }
             else if(block.halign == left || block.halign == right)
             {
+               Font font = surface.font;
                ComputeTable(surface, block, textPos, &width, &height, maxW, maxH, flags, y + sy, x + sx);
+               surface.font = font;
                x += width;
-            
+
                *nextBlock = NextBlockUp(surface, block, centered, flags);
                *nextTextPos = 0;
                h = Max(h, height);
@@ -252,7 +262,9 @@ int ComputeLine(Surface surface, Block startBlock, int startTextPos, Block * nex
             }
             else
             {
+               Font font = surface.font;
                ComputeTable(surface, block, textPos, &width, &height, maxW, maxH, flags, y + sy, x + sx);
+               surface.font = font;
                lineComplete = true;
                *nextBlock = NextBlockUp(surface, block, centered, flags);
                *nextTextPos = 0;
@@ -304,7 +316,6 @@ void RenderLine(HTMLView browser, Surface surface, int x, int y, int w, int h, B
 {
    int textPos = startTextPos;
    Block block = startBlock;
-   bool lineComplete = false;
    int startSel, endSel;
    Block startSelBlock = null, endSelBlock = null;
    if(browser.textBlock != browser.selBlock || browser.curPosition != browser.selPosition)
@@ -373,7 +384,7 @@ void RenderLine(HTMLView browser, Surface surface, int x, int y, int w, int h, B
             {
                surface.Bevel(false, dx, dy, bw, bh);
                if(browser.missing.bitmap)
-                  surface.Blit(browser.missing.bitmap, dx + 5, dy + 5, 0,0, 
+                  surface.Blit(browser.missing.bitmap, dx + 5, dy + 5, 0,0,
                      browser.missing.bitmap.width, browser.missing.bitmap.height);
             }
             surface.SetForeground(fg);
@@ -445,7 +456,6 @@ void RenderLine(HTMLView browser, Surface surface, int x, int y, int w, int h, B
             break;
         case TABLE:
             RenderTable(browser, surface, x, y, w, h, left, right, block);
-            lineComplete = true;
             block = NextBlockUp(surface, block, null, RenderFlags { render = true });
             textPos = 0;
             break;
@@ -462,13 +472,12 @@ void RenderLine(HTMLView browser, Surface surface, int x, int y, int w, int h, B
    }
 }
 
-bool PickLine(HTMLView browser, Surface surface, int x, int y, int w, int h, Block startBlock, int startTextPos, 
+bool PickLine(HTMLView browser, Surface surface, int x, int y, int w, int h, Block startBlock, int startTextPos,
               Block endBlock, int endTextPos, int left, int right, int pickX, int pickY, Block* pickBlock, int * pickTextPos)
 {
    bool result = false;
    int textPos = startTextPos;
    Block block = startBlock;
-   bool lineComplete = false;
 
    for(;!result;)
    {
@@ -553,7 +562,6 @@ bool PickLine(HTMLView browser, Surface surface, int x, int y, int w, int h, Blo
             break;
         case TABLE:
             result = PickTable(browser, surface, x, y, w, h, left, right, block, pickX, pickY, pickBlock, pickTextPos);
-            lineComplete = true;
             block = NextBlockUp(surface, block, null, RenderFlags { render = true });
             textPos = 0;
             break;
@@ -571,13 +579,12 @@ bool PickLine(HTMLView browser, Surface surface, int x, int y, int w, int h, Blo
    return result;
 }
 
-              
-void PositionLine(HTMLView browser, Surface surface, int x, int y, int w, int h, Block startBlock, int startTextPos, 
+
+void PositionLine(HTMLView browser, Surface surface, int x, int y, int w, int h, Block startBlock, int startTextPos,
                   Block endBlock, int endTextPos, int left, int right)
 {
    int textPos = startTextPos;
    Block block = startBlock;
-   bool lineComplete = false;
 
    for(;;)
    {
@@ -592,22 +599,18 @@ void PositionLine(HTMLView browser, Surface surface, int x, int y, int w, int h,
             {
                Window parent = block.window.parent;
                block.window.Move(
-                  x + parent.scroll.x, y + parent.scroll.y, 
+                  x + parent.scroll.x, y + parent.scroll.y,
                   block.window.size.w, block.window.size.h);
                //block.window.visible = false;
                x += block.window.size.w;
-               if(block.inputType == text)
-               {
-                  printf("");
-               }
             }
             break;
          }
          case IMAGE:
          {
             int bw = block.pWidth ? (w * block.pWidth / 100) : block.w;
-            int bh = block.pHeight ? (h * block.pHeight / 100) : block.h;
-            int dx, dy;
+            //int bh = block.pHeight ? (h * block.pHeight / 100) : block.h;
+            int dx;//, dy;
 
             switch(block.halign)
             {
@@ -625,12 +628,14 @@ void PositionLine(HTMLView browser, Surface surface, int x, int y, int w, int h,
                   break;
             }
 
+            /*
             switch(block.valign)
             {
                case bottom: dy = y + h - bh; break;
                case top: dy = y; break;
                case middle: dy = y + (h - bh) / 2; break;
             }
+            */
 
             x += bw;
             break;
@@ -655,7 +660,6 @@ void PositionLine(HTMLView browser, Surface surface, int x, int y, int w, int h,
             break;
         case TABLE:
             PositionTable(browser, surface, x, y, w, h, left, right, block);
-            lineComplete = true;
             block = NextBlockUp(surface, block, null, RenderFlags { render = true });
             textPos = 0;
             break;