documentor; extras/html: Made it easier to position caret at beginning or end of...
[sdk] / documentor / src / Documentor.ec
index 2b67f4e..7dfc77e 100644 (file)
@@ -5,6 +5,14 @@ import "HTMLView"
 import "IDESettings"
 import "SettingsDialog"
 
+IDESettings ideSettings;
+
+IDESettingsContainer settingsContainer
+{
+   dataOwner = &ideSettings;
+   dataClass = class(IDESettings);
+};
+
 static Context globalContext { };
 static OldList defines { };
 static OldList imports { };
@@ -46,15 +54,6 @@ static const char * iconNames[CodeObjectType] =
    "<:ecere>constructs/propertyPrivate.png"
 };
 
-IDESettings settings { }; // instantiate the IDESettings class from the IDESettings.ec file. Do this at a global level so that all methods can access settings.
-
-IDESettingsContainer settingsContainer
-{
-   driver = "JSON";
-   data = settings;
-   dataOwner = &settings;
-};
-
 void GetTemplateString(Class c, char * templateString)
 {
    Module m = c.module.application;
@@ -590,7 +589,7 @@ static void FigureFilePath(char * path, Module module, DocumentationType type, v
    ChangeExtension(docPath, "econ", docPath);
 
    path[0] = 0;
-   strcpy(path, settings.docDir);
+   strcpy(path, ideSettings.docDir);
    PathCatSlash(path, docPath);
 }
 
@@ -732,7 +731,7 @@ ItemDoc getDoc(char * filePath, Module module, DocumentationType type, void * ob
       File f = FileOpen(filePath, read);
       if(f)
       {
-         eCONParser parser { f = f };
+         ECONParser parser { f = f };
          JSONResult jsonResult = parser.GetObject(cl ? class(ClassDoc) : class(NamespaceDoc), &doc);
          delete parser;
          delete f;
@@ -839,17 +838,18 @@ class APIPageNameSpace : APIPage
          char * desc = ReadDoc(module, nameSpaceDoc, nameSpace, description, null);
          if(desc)
          {
-            f.Printf($"<H3>Description</H3><br><br>\n");
+            f.Printf($"<H3>Description</H3><BR>\n");
             if(editing)
             {
                char fileName[MAX_LOCATION];
                FigureFileName(fileName, module, nameSpaceDoc, nameSpace, description, null);
                f.Printf("<a style=\"text-decoration:none;\" href=\"edit://%s\">", fileName);
                f.Puts(desc);
-               f.Printf("</a><br><br>");
+               f.Printf("</a>");
             }
             else
-               f.Printf("%s<br><br>", desc);
+               f.Printf("%s", desc);
+            f.Printf("<br><br><br>");
             delete desc;
          }
       }
@@ -862,7 +862,7 @@ class APIPageNameSpace : APIPage
             char * desc = ReadDoc(module, nameSpaceDoc, ns, description, null);
             if(first)
             {
-               f.Printf($"<H3>Sub Namespaces</H3><br><br>\n");
+               f.Printf($"<H3>Sub Namespaces</H3><BR>\n");
                f.Printf("<TABLE>\n");
                first = false;
             }
@@ -885,7 +885,7 @@ class APIPageNameSpace : APIPage
             f.Printf("</TR><br>\n");
          }
          if(!first)
-            f.Printf("</TABLE><br>\n");
+            f.Printf("</TABLE><br><br>\n");
       }
 
       if(nameSpace->classes.first)
@@ -894,13 +894,14 @@ class APIPageNameSpace : APIPage
          for(link = (BTNamedLink)nameSpace->classes.first; link; link = (BTNamedLink)((BTNode)link).next)
          {
             Class cl = link.data;
-            if(!cl.templateClass)
+            Module module = cl.module ? cl.module  : this.module;
+            if(!cl.templateClass) // && !cl.internalDecl)
             {
                char * desc = ReadDoc(module, classDoc, cl, description, null);
 
                if(first)
                {
-                  f.Printf($"<a name=Classes></a><H3>Classes</H3><br><br>\n");
+                  f.Printf($"<a name=Classes></a><H3>Classes</H3><BR>\n");
                   f.Printf("<TABLE>\n");
                   first = false;
                }
@@ -926,7 +927,7 @@ class APIPageNameSpace : APIPage
             }
          }
          if(!first)
-            f.Printf("</TABLE><br>\n");
+            f.Printf("</TABLE><br><br>\n");
       }
 
       if(nameSpace->functions.first)
@@ -935,12 +936,13 @@ class APIPageNameSpace : APIPage
          for(link = (BTNamedLink)nameSpace->functions.first; link; link = (BTNamedLink)((BTNode)link).next)
          {
             GlobalFunction function = link.data;
+            Module module = function.module ? function.module  : this.module;
             char * desc = ReadDoc(module, functionDoc, function, description, null);
             const char * name = RSearchString(function.name, "::", strlen(function.name), true, false);
             if(name) name += 2; else name = function.name;
             if(first)
             {
-               f.Printf($"<a name=Functions></a><H3>Functions</H3><br><br>\n");
+               f.Printf($"<a name=Functions></a><H3>Functions</H3><BR>\n");
                f.Printf("<TABLE>\n");
                first = false;
             }
@@ -963,7 +965,7 @@ class APIPageNameSpace : APIPage
             f.Printf("</TR><br>\n");
          }
          if(!first)
-            f.Printf("</TABLE><br>\n");
+            f.Printf("</TABLE><br><br>\n");
       }
 
       if(nameSpace->defines.first)
@@ -975,7 +977,7 @@ class APIPageNameSpace : APIPage
             char * desc = ReadDoc(module, nameSpaceDoc, nameSpace, definition, def);
             if(first)
             {
-               f.Printf($"<a name=Definitions></a><H3>Definitions</H3><br><br>\n");
+               f.Printf($"<a name=Definitions></a><H3>Definitions</H3><BR>\n");
                f.Printf("<TABLE>\n");
                first = false;
             }
@@ -999,7 +1001,7 @@ class APIPageNameSpace : APIPage
             f.Printf("</TR><br>\n");
          }
          if(!first)
-            f.Printf("</TABLE><br>\n");
+            f.Printf("</TABLE><br><br>\n");
       }
 
       f.Printf("</FONT></BODY></HTML>\n");
@@ -1093,17 +1095,18 @@ class APIPageClass : APIPage
          char * desc = ReadDoc(module, classDoc, cl, description, null);
          if(desc)
          {
-            f.Printf($"<br><H3>Description</H3><br><br>\n");
+            f.Printf($"<br><H3>Description</H3><BR>\n");
             if(editing)
             {
                char fileName[MAX_LOCATION];
                FigureFileName(fileName, module, classDoc, cl, description, null);
                f.Printf("<a style=\"text-decoration:none;\" href=\"edit://%s\">", fileName);
                f.Puts(desc);
-               f.Printf("</a><br><br>");
+               f.Printf("</a>");
             }
             else
-               f.Printf("%s<br><br>", desc);
+               f.Printf("%s", desc);
+            f.Printf("<br><br><br>");
             delete desc;
          }
       }
@@ -1115,7 +1118,7 @@ class APIPageClass : APIPage
          {
             NamedLink item;
 
-            f.Printf($"<a name=EnumerationValues></a><H3>Enumeration Values</H3><br><br>\n");
+            f.Printf($"<a name=EnumerationValues></a><H3>Enumeration Values</H3><BR>\n");
             f.Printf("<TABLE>\n");
 
             for(item = enumeration.values.first; item; item = item.next)
@@ -1184,7 +1187,7 @@ class APIPageClass : APIPage
 
       if(cl.conversions.first)
       {
-         f.Printf($"<a name=Conversions></a><H3>Conversions</H3><br><br>\n");
+         f.Printf($"<a name=Conversions></a><H3>Conversions</H3><BR>\n");
          f.Printf("<TABLE>\n");
          for(prop = cl.conversions.first; prop; prop = prop.next)
          {
@@ -1222,7 +1225,7 @@ class APIPageClass : APIPage
                FreeType(type);
             }
          }
-         f.Printf("</TABLE><br>\n");
+         f.Printf("</TABLE><br><br>\n");
       }
 
       if(cl.membersAndProperties.first)
@@ -1234,7 +1237,7 @@ class APIPageClass : APIPage
             {
                if(first)
                {
-                  f.Printf($"<a name=Members></a><H3>Properties and Members</H3><br><br>\n");
+                  f.Printf($"<a name=Members></a><H3>Properties and Members</H3><BR>\n");
                   f.Printf("<TABLE>\n");
                   first = false;
                }
@@ -1274,7 +1277,7 @@ class APIPageClass : APIPage
             }
          }
          if(!first)
-            f.Printf("</TABLE><br>\n");
+            f.Printf("</TABLE><br><br>\n");
       }
 
       if(cl.methods.first)
@@ -1288,7 +1291,7 @@ class APIPageClass : APIPage
                char * desc = ReadDoc(module, methodDoc, method, description, null);
                if(first)
                {
-                  f.Printf($"<a name=VirtualMethods></a><H3>Virtual Methods</H3><br><br>\n");
+                  f.Printf($"<a name=VirtualMethods></a><H3>Virtual Methods</H3><BR>\n");
                   f.Printf("<TABLE>\n");
                   first = false;
                }
@@ -1315,7 +1318,7 @@ class APIPageClass : APIPage
             }
          }
          if(!first)
-            f.Printf("</TABLE><br>\n");
+            f.Printf("</TABLE><br><br>\n");
 
          // Non-Virtual Methods
          first = true;
@@ -1326,7 +1329,7 @@ class APIPageClass : APIPage
                char * desc = ReadDoc(module, methodDoc, method, description, null);
                if(first)
                {
-                  f.Printf($"<a name=Methods></a><H3>Non-Virtual Methods</H3><br><br>\n");
+                  f.Printf($"<a name=Methods></a><H3>Non-Virtual Methods</H3><BR>\n");
                   f.Printf("<TABLE>\n");
                   first = false;
                }
@@ -1355,13 +1358,13 @@ class APIPageClass : APIPage
             }
          }
          if(!first)
-            f.Printf("</TABLE><br>\n");
+            f.Printf("</TABLE><br><br>\n");
       }
       {
          char * usageDoc = ReadDoc(module, classDoc, cl, usage, null);
          if(usageDoc)
          {
-            f.Printf($"<H3>Usage</H3><br>\n");
+            f.Printf($"<H3>Usage</H3><BR>\n");
             if(editing)
             {
                char fileName[MAX_LOCATION];
@@ -1372,7 +1375,7 @@ class APIPageClass : APIPage
             }
             else
                f.Printf("<br>%s\n", usageDoc);
-            f.Printf("<br><br>\n");
+            f.Printf("<br><br><br>\n");
             delete usageDoc;
          }
       }
@@ -1380,7 +1383,7 @@ class APIPageClass : APIPage
          char * exampleDoc = ReadDoc(module, classDoc, cl, example, null);
          if(exampleDoc)
          {
-            f.Printf($"<H3>Example</H3><br>\n");
+            f.Printf($"<H3>Example</H3><BR>\n");
             f.Printf($"<FONT face=\"Courier New\">\n");
             f.Printf("<br><TABLE>\n");
             if(editing)
@@ -1395,7 +1398,7 @@ class APIPageClass : APIPage
                f.Printf("<TR><TD><CODE>%s</CODE></TD></TR>\n", exampleDoc);   // bgcolor=#CFC9C0
 
             f.Printf("</TABLE></FONT>\n");
-            f.Printf("<br>\n");
+            f.Printf("<br><br>\n");
             delete exampleDoc;
          }
       }
@@ -1404,7 +1407,7 @@ class APIPageClass : APIPage
 
          if(remarksDoc)
          {
-            f.Printf($"<H3>Remarks</H3><br>\n");
+            f.Printf($"<H3>Remarks</H3><BR>\n");
             if(editing)
             {
                char fileName[MAX_LOCATION];
@@ -1415,7 +1418,7 @@ class APIPageClass : APIPage
             }
             else
                f.Printf("<br>%s\n", remarksDoc);
-            f.Printf("<br><br>\n");
+            f.Printf("<br><br><br>\n");
             delete remarksDoc;
          }
       }
@@ -1432,8 +1435,7 @@ class APIPageClass : APIPage
             {
                if(first)
                {
-                  f.Printf($"<H3>Derived Classes</H3><br>\n");
-                  f.Printf("<br>");
+                  f.Printf($"<H3>Derived Classes</H3><BR>\n");
                   first = false;
                }
                else
@@ -1448,7 +1450,7 @@ class APIPageClass : APIPage
          char * seeAlsoDoc = ReadDoc(module, classDoc, cl, seeAlso, null);
          if(seeAlsoDoc)
          {
-            f.Printf($"<H3>See Also</H3><br>\n");
+            f.Printf($"<H3>See Also</H3>\n");
             if(editing)
             {
                char fileName[MAX_LOCATION];
@@ -1527,7 +1529,7 @@ class APIPageMethod : APIPage
          char * desc = ReadDoc(module, methodDoc, method, description, null);
          if(desc)
          {
-            f.Printf($"<br><br><H3>Description</H3><br><br>\n");
+            f.Printf($"<br><br><H3>Description</H3><BR>\n");
             if(editing)
             {
                char fileName[MAX_LOCATION];
@@ -1538,6 +1540,7 @@ class APIPageMethod : APIPage
             }
             else
                f.Printf("%s", desc);
+            f.Printf("<BR><BR>");
             delete desc;
          }
       }
@@ -1545,7 +1548,7 @@ class APIPageMethod : APIPage
       f.Printf("<br><br>\n");
       if(method.dataType.params.first && ((Type)method.dataType.params.first).kind != voidType)
       {
-         f.Printf($"<H3>Parameters</H3><br><br>\n");
+         f.Printf($"<H3>Parameters</H3><BR>\n");
       }
       if((method.dataType.returnType && method.dataType.returnType.kind != voidType) ||
          (method.dataType.params.first && ((Type)method.dataType.params.first).kind != voidType))
@@ -1621,7 +1624,7 @@ class APIPageMethod : APIPage
          char * usageDoc = ReadDoc(module, methodDoc, method, usage, null);
          if(usageDoc)
          {
-            f.Printf($"<H3>Usage</H3><br>\n");
+            f.Printf($"<H3>Usage</H3><BR>\n");
             if(editing)
             {
                char fileName[MAX_LOCATION];
@@ -1632,7 +1635,7 @@ class APIPageMethod : APIPage
             }
             else
                f.Printf("<br>%s\n", usageDoc);
-            f.Printf("<br><br>\n");
+            f.Printf("<br><br><br>\n");
             delete usageDoc;
          }
       }
@@ -1640,7 +1643,7 @@ class APIPageMethod : APIPage
          char * exampleDoc = ReadDoc(module, methodDoc, method, example, null);
          if(exampleDoc)
          {
-            f.Printf($"<H3>Example</H3><br>\n");
+            f.Printf($"<H3>Example</H3><BR>\n");
             f.Printf($"<FONT face=\"Courier New\">\n");
             f.Printf("<br><TABLE>\n");
             if(editing)
@@ -1654,7 +1657,7 @@ class APIPageMethod : APIPage
             else
                f.Printf("<TR><TD><CODE>%s</CODE></TD></TR>\n", exampleDoc);   // bgcolor=#CFC9C0
             f.Printf("</TABLE></FONT>\n");
-            f.Printf("<br>\n");
+            f.Printf("<br><br>\n");
             delete exampleDoc;
          }
       }
@@ -1662,7 +1665,7 @@ class APIPageMethod : APIPage
          char * remarksDoc = ReadDoc(module, methodDoc, method, remarks, null);
          if(remarksDoc)
          {
-            f.Printf($"<H3>Remarks</H3><br>\n");
+            f.Printf($"<H3>Remarks</H3><BR>\n");
             if(editing)
             {
                char fileName[MAX_LOCATION];
@@ -1673,7 +1676,7 @@ class APIPageMethod : APIPage
             }
             else
                f.Printf("<br>%s\n", method, remarksDoc);
-            f.Printf("<br><br>\n");
+            f.Printf("<br><br><br>\n");
             delete remarksDoc;
          }
       }
@@ -1681,7 +1684,7 @@ class APIPageMethod : APIPage
          char * seeAlsoDoc = ReadDoc(module, methodDoc, method, seeAlso, null);
          if(seeAlsoDoc)
          {
-            f.Printf($"<H3>See Also</H3><br>\n");
+            f.Printf($"<H3>See Also</H3><BR>\n");
             if(editing)
             {
                char fileName[MAX_LOCATION];
@@ -1693,7 +1696,7 @@ class APIPageMethod : APIPage
             else
                f.Printf("<br>%s\n", method, seeAlsoDoc);
 
-            f.Printf("<br><br>\n");
+            f.Printf("<br><br><br>\n");
             delete seeAlsoDoc;
          }
       }
@@ -1760,7 +1763,7 @@ class APIPageFunction : APIPage
          char * desc = ReadDoc(module, functionDoc, function, description, null);
          if(desc)
          {
-            f.Printf($"<br><br><H3>Description</H3><br><br>\n");
+            f.Printf($"<br><br><H3>Description</H3><BR>\n");
             if(editing)
             {
                char fileName[MAX_LOCATION];
@@ -1772,12 +1775,13 @@ class APIPageFunction : APIPage
             else
                f.Printf("%s", desc);
             delete desc;
+            f.Printf("<BR><BR>");
          }
       }
       f.Printf("<br><br>\n");
       if(function.dataType.params.first && ((Type)function.dataType.params.first).kind != voidType)
       {
-         f.Printf($"<H3>Parameters</H3><br><br>\n");
+         f.Printf($"<H3>Parameters</H3><BR>\n");
       }
       if((function.dataType.returnType && function.dataType.returnType.kind != voidType) ||
          (function.dataType.params.first && ((Type)function.dataType.params.first).kind != voidType))
@@ -1853,7 +1857,7 @@ class APIPageFunction : APIPage
          char * usageDoc = ReadDoc(module, functionDoc, function, usage, null);
          if(usageDoc)
          {
-            f.Printf($"<H3>Usage</H3><br>\n");
+            f.Printf($"<H3>Usage</H3><BR>\n");
             if(editing)
             {
                char fileName[MAX_LOCATION];
@@ -1864,7 +1868,7 @@ class APIPageFunction : APIPage
             }
             else
                f.Printf("<br>%s\n", usageDoc);
-            f.Printf("<br><br>\n");
+            f.Printf("<br><br><br>\n");
             delete usageDoc;
          }
       }
@@ -1872,7 +1876,7 @@ class APIPageFunction : APIPage
          char * exampleDoc = ReadDoc(module, functionDoc, function, example, null);
          if(exampleDoc)
          {
-            f.Printf($"<H3>Example</H3><br>\n");
+            f.Printf($"<H3>Example</H3><BR>\n");
             f.Printf($"<FONT face=\"Courier New\">\n");
             f.Printf("<br><TABLE>\n");
             if(editing)
@@ -1886,7 +1890,7 @@ class APIPageFunction : APIPage
             else
                f.Printf("<TR><TD><CODE>%s</CODE></TD></TR>\n", exampleDoc);   // bgcolor=#CFC9C0
             f.Printf("</TABLE></FONT>\n");
-            f.Printf("<br>\n");
+            f.Printf("<br><br>\n");
             delete exampleDoc;
          }
       }
@@ -1894,7 +1898,7 @@ class APIPageFunction : APIPage
          char * remarksDoc = ReadDoc(module, functionDoc, function, remarks, null);
          if(remarksDoc)
          {
-            f.Printf($"<H3>Remarks</H3><br>\n");
+            f.Printf($"<H3>Remarks</H3><BR>\n");
             if(editing)
             {
                char fileName[MAX_LOCATION];
@@ -1905,7 +1909,7 @@ class APIPageFunction : APIPage
             }
             else
                f.Printf("<br>%s\n", remarksDoc);
-            f.Printf("<br><br>\n");
+            f.Printf("<br><br><br>\n");
             delete remarksDoc;
          }
       }
@@ -1913,7 +1917,7 @@ class APIPageFunction : APIPage
          char * seeAlsoDoc = ReadDoc(module, functionDoc, function, seeAlso, null);
          if(seeAlsoDoc)
          {
-            f.Printf($"<H3>See Also</H3><br>\n");
+            f.Printf($"<H3>See Also</H3><BR>\n");
             if(editing)
             {
                char fileName[MAX_LOCATION];
@@ -1924,7 +1928,7 @@ class APIPageFunction : APIPage
             }
             else
                f.Printf("<br>%s\n", seeAlsoDoc);
-            f.Printf("<br><br>\n");
+            f.Printf("<br><br><br>\n");
             delete seeAlsoDoc;
          }
       }
@@ -1991,7 +1995,7 @@ static void AddNameSpace(DataRow parentRow, Module module, NameSpace mainNameSpa
             for(link = (BTNamedLink)nameSpace->classes.first; link; link = (BTNamedLink)((BTNode)link).next)
             {
                cl = link.data;
-               if(!cl.templateClass && (!module || cl.module == module || (!cl.module.name && !strcmp(module.name, "ecere"))))
+               if(!cl.templateClass /*&& !cl.internalDecl*/ && (!module || cl.module == module || (!cl.module.name && !strcmp(module.name, "ecere"))))
                {
                   if(!classesRow) { classesRow = row.AddRow(); classesRow.SetData(null, APIPage { $"Classes", page = page }); classesRow.collapsed = true; classesRow.icon = mainForm.icons[typeClass]; classesRow.tag = 1; }
                   AddClass(classesRow, module, cl, nsName, showPrivate);
@@ -2554,6 +2558,16 @@ class MainForm : Window
    bool dontRecordHistory;
    Module homeModule;
 
+   bool OnKeyHit(Key key, unichar ch)
+   {
+      switch(key)
+      {
+         case altLeft: Back(); return false;
+         case altRight: Forward(); return false;
+      }
+      return true;
+   }
+
    bool Forward()
    {
       if(historyPos < history.count-1)
@@ -2637,7 +2651,7 @@ class HelpView : HTMLView
          {
             char docDir[MAX_LOCATION];
             readOnly = true;
-            strcpy(docDir, settings.docDir);
+            strcpy(docDir, ideSettings.docDir);
             if(FileExists(docDir).isDirectory)
             {
                PathCatSlash(docDir, "___docWriteTest");
@@ -3243,6 +3257,9 @@ class HelpView : HTMLView
          // dialog.Create();
          edit = true;
          // PositionCaret(true);
+
+         // TOCHECK: Adding this here seemed to fixed caret positioning bugs
+         ComputeSizes();
       }
       return true;
    }
@@ -4140,6 +4157,7 @@ class HelpView : HTMLView
          char * text = textBlock.text;
          int maxW;
          Block block = textBlock;
+         int xOffset = 0;
          while(block && block.type != TD) block = block.parent;
          if(block)
          {
@@ -4155,11 +4173,19 @@ class HelpView : HTMLView
 
          display.FontExtent(textBlock.font.font, " ", 1, null, &th);
 
+         // Work around to re-align with first line having different indentation because of &nbsp;&nbsp; before <A> of current block
+         {
+            Block parent = textBlock.parent;
+            while(parent && parent.type == ANCHOR) parent = parent.parent;
+            if(parent && parent.subBlocks.first && ((Block)parent.subBlocks.first).type == TEXT)
+               xOffset = sx - ((Block)parent.subBlocks.first).startX;
+         }
+
          while(textPos < textBlock.textLen)
          {
             int startPos = textPos;
             int width = 0;
-            int x = 0;
+            int x = xOffset;
             bool lineComplete = false;
 
             for(; textPos<textBlock.textLen && !lineComplete;)
@@ -4198,12 +4224,12 @@ class HelpView : HTMLView
                break;
             }
             sy += th;
-            sx = textBlock.startX;
+            sx = textBlock.startX - xOffset;
          }
          if(setCaretX)
             caretX = sx;
          caretY = sy;
-         SetCaret(sx, sy, th);
+         SetCaret(sx-1, sy, th);
          {
             Point scrollPos = scroll;
             bool doScroll = false;
@@ -4255,6 +4281,7 @@ class HelpView : HTMLView
          int maxW;
          Block b = textBlock;
          int space;
+         int xOffset = 0;
 
          if(textBlock.type != TEXT) continue;
 
@@ -4271,6 +4298,14 @@ class HelpView : HTMLView
          else
             maxW = clientSize.w - 10 - sx;
 
+         // Work around to re-align with first line having different indentation because of &nbsp;&nbsp; before <A> of current block
+         {
+            Block parent = textBlock.parent;
+            while(parent && parent.type == ANCHOR) parent = parent.parent;
+            if(parent && parent.subBlocks.first && ((Block)parent.subBlocks.first).type == TEXT)
+               xOffset = sx - ((Block)parent.subBlocks.first).startX;
+         }
+
          display.FontExtent(textBlock.font.font, " ", 1, &space, &th);
          //space = space/2+2;
          space = 2;
@@ -4278,7 +4313,7 @@ class HelpView : HTMLView
          while(textPos < textBlock.textLen)
          {
             int width = 0;
-            int x = 0;
+            int x = xOffset;
             bool lineComplete = false;
 
             for(; textPos<textBlock.textLen && !lineComplete;)
@@ -4294,7 +4329,7 @@ class HelpView : HTMLView
 
                display.FontExtent(textBlock.font.font, text + textPos, len, &w, &th);
 
-               sx = x + textBlock.startX;
+               sx = x + textBlock.startX - xOffset;
                if(/*py >= sy && */py < sy + th && /*px >= sx-space && */px < sx + w-space)
                {
                   int c, numBytes;
@@ -4355,9 +4390,9 @@ class Documentor : GuiApplication
 
       SetGlobalData(globalData);
 
-      settingsContainer.dataOwner = &settings;
+      settingsContainer.dataOwner = &ideSettings;
       settingsContainer.Load();
-      if(!settings.docDir || !settings.docDir[0] )
+      if(!ideSettings.docDir || !ideSettings.docDir[0] )
       {
          if(os == win32) // if Windows OS then
          {
@@ -4371,23 +4406,23 @@ class Documentor : GuiApplication
             if(GetEnvironment("ProgramFiles", programFilesDir, MAX_LOCATION))
             {
                PathCat(programFilesDir, "ECERE SDK\\doc");
-               settings.docDir = programFilesDir;
+               ideSettings.docDir = programFilesDir;
             }
             else if(homeDrive[0])
             {
                PathCat(homeDrive, "ECERE SDK\\doc");
-               settings.docDir = homeDrive;
+               ideSettings.docDir = homeDrive;
             }
             else if(winDir[0])
             {
                PathCat(winDir, "..\\ECERE SDK\\doc");
-               settings.docDir = winDir;
+               ideSettings.docDir = winDir;
             }
             else
-               settings.docDir = "C:\\ECERE SDK\\doc";
+               ideSettings.docDir = "C:\\ECERE SDK\\doc";
          }
          else // if Os is Linux, or Mac OSX or something else
-            settings.docDir = "/usr/share/ecere/doc/";
+            ideSettings.docDir = "/usr/share/ecere/doc/";
          settingsContainer.Save();
       }