ide: add recent files to workspace for the recent files menu when a workspace is...
[sdk] / ide / src / designer / CodeEditor.ec
index 4228de1..a24e939 100644 (file)
@@ -91,7 +91,7 @@ static Array<FileType> fileTypes
    { $"Text Files", "txt", never }
 ] };
 
-static char * iconNames[] =
+static const char * iconNames[] =
 {
    "<:ecere>constructs/class.png",
    "<:ecere>constructs/data.png",
@@ -176,7 +176,7 @@ Expression paramsInsideExp;
 ClassFunction insideFunction;
 ClassDef insideDef;
 Type instanceType;
-char * instanceName;
+const char * instanceName;
 Type functionType;
 int paramsID;
 bool insideInstance;
@@ -185,7 +185,7 @@ bool insideInstance;
                               GENERATING
 ****************************************************************************/
 
-static void OutputString(File f, char * string)
+static void OutputString(File f, const char * string)
 {
    int c;
    for(c = 0; string[c]; c++)
@@ -205,10 +205,13 @@ static void OutputString(File f, char * string)
    }
 }
 
+// Consider merging with PrintType ?
 void OutputType(File f, Type type, bool outputName)
 {
    if(type)
    {
+      if(type.kind != pointerType && type.constant)
+         f.Printf("const ");
       switch(type.kind)
       {
          case voidType:
@@ -273,6 +276,8 @@ void OutputType(File f, Type type, bool outputName)
          case pointerType:
             OutputType(f, type.type, false);
             f.Printf(" *");
+            if(type.constant)
+               f.Printf(" const");
             break;
          case ellipsisType:
             f.Printf("...");
@@ -382,6 +387,39 @@ void GetLocText(EditBox editBox, File f, int position, Location loc, char ** tex
    f.Printf(""); // Make the stream point to where the editbox is
 }
 
+static int64 GetI64EnumValue(Class dataType, DataValue dataForm)
+{
+   int64 i64Value = 0;
+   switch(dataType.typeSize)
+   {
+      case 1:
+         if(!strcmp(dataType.dataTypeString, "byte"))
+            i64Value = dataForm.uc;
+         else
+            i64Value = dataForm.c;
+         break;
+      case 2:
+         if(!strcmp(dataType.dataTypeString, "uint16"))
+            i64Value = dataForm.us;
+         else
+            i64Value = dataForm.s;
+         break;
+      case 4:
+         if(!strcmp(dataType.dataTypeString, "uint"))
+            i64Value = dataForm.ui;
+         else
+            i64Value = dataForm.i;
+         break;
+      case 8:
+         if(!strcmp(dataType.dataTypeString, "uint64"))
+            i64Value = *(int64 *)&dataForm.ui64;
+         else
+            i64Value = dataForm.i64;
+         break;
+   }
+   return i64Value;
+}
+
 void Code_FixProperty(Property prop, Instance object)
 {
    Designer::FixProperty(prop, object);
@@ -483,7 +521,7 @@ bool Code_IsPropertyModified(Instance test, ObjectInfo selected, Property prop)
    return result;
 }
 
-bool Code_IsPropertyDisabled(ObjectInfo selected, char * name)
+bool Code_IsPropertyDisabled(ObjectInfo selected, const char * name)
 {
    bool disabled = false;
    if(selected.oClass == selected)
@@ -555,7 +593,7 @@ static bool CheckCompatibleMethod(Method method, Type type, Class regClass, bool
       method.dataType.thisClass = selectedClass;
    }
    //result = MatchTypes(method.dataType, type, null, regClass, regClass, false);
-   result = MatchTypes(type, method.dataType, null, regClass, regClass, false, true, true, false);
+   result = MatchTypes(type, method.dataType, null, regClass, regClass, false, true, true, false, true);
    if(reset)
       method.dataType.thisClass = null;
    return result;
@@ -568,7 +606,7 @@ bool Code_IsFunctionEmpty(ClassFunction function, Method method, ObjectInfo obje
    // Check if it contains any code
    if((!body.compound.declarations || !body.compound.declarations->count) && (!body.compound.statements || body.compound.statements->count <= 1))
    {
-      Class moduleClass = eSystem_FindClass(object.instance._class.module, "Module");
+      // Class moduleClass = eSystem_FindClass(object.instance._class.module, "Module");
       Statement stmt = body.compound.statements ? body.compound.statements->first : null;
       Type dataType = method.dataType;
       Type returnType = dataType.returnType;
@@ -580,7 +618,7 @@ bool Code_IsFunctionEmpty(ClassFunction function, Method method, ObjectInfo obje
       confirmation = false;
 
       // Check if default function should be calling base class:
-      if(object.instance._class._vTbl[method.vid] == moduleClass._vTbl[__ecereVMethodID___ecereNameSpace__ecere__com__Module_OnLoad]) // Temp Check for DefaultFunction
+      if(object.instance._class._vTbl[method.vid] == null /*moduleClass._vTbl[__ecereVMethodID___ecereNameSpace__ecere__com__Module_OnLoad]*/) // Temp Check for DefaultFunction
       {
          if(returnType.kind != voidType)
          {
@@ -676,7 +714,7 @@ class CodeEditor : Window
 
    OldList * ast;
    Context globalContext { };
-   OldList excludedSymbols { offset = (uint)&((Symbol)0).left };
+   OldList excludedSymbols { offset = (uint)(uintptr)&((Symbol)0).left };
 
    OldList defines;
    OldList imports;
@@ -722,7 +760,7 @@ class CodeEditor : Window
    bool inUseDebug;
    OpenedFileInfo openedFileInfo;
 
-   FontResource font { codeFont.faceName, codeFont.size };
+   FontResource font { codeFont.faceName, codeFont.size, codeFont.bold, codeFont.italic };
    saveDialog = codeEditorFileDialog;
 
    Designer designer { codeEditor = this, visible = false, saveDialog = codeEditorFormFileDialog };
@@ -791,14 +829,13 @@ class CodeEditor : Window
                   hide = true;
                else
                {
-                  char * buffer = membersLine.text;
                   int c;
 
                   if(charPos - 1 < membersLoc.start.charPos)
                      hide = true;
                   else if(charPos - 1 > membersLoc.end.charPos)
                   {
-                     char * buffer = membersLine.text;
+                     const char * buffer = membersLine.text;
                      //if(membersList.currentRow)
                      //   hide = true;
                      //else
@@ -875,11 +912,11 @@ class CodeEditor : Window
          int oldLine = lastLine;
          display.FontExtent(font.font, " ", 1, null, &spaceH);
          {
-            Box box { 0, (Min(oldLine,oldLine)-1) * spaceH - editBox.scroll.y, editBox.anchor.left.distance, (Max(oldLine, oldLine))*spaceH-1 - editBox.scroll.y };
+            Box box { 0, (oldLine-1) * spaceH - editBox.scroll.y, editBox.anchor.left.distance, oldLine*spaceH-1 - editBox.scroll.y };
             Update(box);
          }
          {
-            Box box { 0, (Min(line,line)-1) * spaceH - editBox.scroll.y, editBox.anchor.left.distance, (Max(line, line))*spaceH-1 - editBox.scroll.y };
+            Box box { 0, (line-1) * spaceH - editBox.scroll.y, editBox.anchor.left.distance, line*spaceH-1 - editBox.scroll.y };
             Update(box);
          }
          lastLine = line;
@@ -923,7 +960,7 @@ class CodeEditor : Window
             {
                int c;
                // HOW WE MIGHT WANT TO DO IT:
-               char * text = before.line.text;
+               const char * text = before.line.text;
                for(c = Min(before.line.count, before.x-1); c>= 0; c--)
                   if(!isspace(text[c]))
                      break;
@@ -974,7 +1011,7 @@ class CodeEditor : Window
                      hide = true;
                   else
                   {
-                     char * buffer = membersLine.text;
+                     const char * buffer = membersLine.text;
                      int c;
                      bool firstChar = true;
                      bool addedChar = false;
@@ -1040,7 +1077,7 @@ class CodeEditor : Window
                      // Accept current string if hiding typing char
                      if(hide && row && row.selected)
                      {
-                        char * string = row.string;
+                        const char * string = row.string;
                         int len = strlen(string);
                         membersLoc.end.charPos -= after.x - before.x;
                         editBox.GoToPosition(membersLine, membersLoc.start.line, membersLoc.start.charPos);
@@ -1062,7 +1099,7 @@ class CodeEditor : Window
                if(/*after.x - before.x == 1 && */after.y == before.y && !membersListShown)
                {
                   EditLine line = editBox.line;
-                  char * text = line.text;
+                  const char * text = line.text;
                   char ch = text[after.x-1];
                   if(ch == '.' || (ch == '>' && after.x-1 > 0 && text[after.x-1-1] == '-') || (ch == ':' && after.x-1 > 0 && text[after.x-1-1] == ':'))
                   {
@@ -1295,7 +1332,7 @@ class CodeEditor : Window
                   hide = true;
                else
                {
-                  char * buffer = membersLine.text;
+                  const char * buffer = membersLine.text;
                   int c;
                   bool firstChar = true;
                   char string[1024];
@@ -1527,7 +1564,7 @@ class CodeEditor : Window
          DataRow row = listBox.currentRow;
          if(row)
          {
-            char * string = row.string;
+            const char * string = row.string;
 
             editBox.GoToPosition(membersLine, membersLoc.start.line, membersLoc.start.charPos);
             editBox.Delete(
@@ -1602,7 +1639,7 @@ class CodeEditor : Window
                DataRow row = currentRow;
                if(row && row.selected)
                {
-                  char * string = row.string;
+                  const char * string = row.string;
 
                   editor.editBox.GoToPosition(editor.membersLine, editor.membersLoc.start.line, editor.membersLoc.start.charPos);
                   editor.editBox.Delete(
@@ -1715,7 +1752,7 @@ class CodeEditor : Window
          display.FontExtent(font, ")", 1, &parW, null);
 
          string[0] = 0;
-         if(editor.functionType)
+         if(editor.functionType && type.kind == functionType)
          {
             PrintType(type.returnType, string, true, true);
             display.FontExtent(font, string, strlen(string), &functionW, null);
@@ -1881,7 +1918,7 @@ class CodeEditor : Window
          display.FontExtent(font, ")", 1, &parW, null);
 
          string[0] = 0;
-         if(editor.functionType && type)
+         if(editor.functionType && type && type.kind == functionType)
          {
             PrintType(type.returnType, string, true, true);
             display.FontExtent(font, string, strlen(string), &functionW, null);
@@ -1982,7 +2019,7 @@ class CodeEditor : Window
          editBox.recordUndoEvent = true;
          for(line = editBox.firstLine; line; line = line.next, y++)
          {
-            String buffer = line.text;
+            const String buffer = line.text;
             int count = line.count, i = count-1;
             while(i >= 0 && isspace(buffer[i])) i--;
             if(i < count - 1)
@@ -2013,7 +2050,7 @@ class CodeEditor : Window
          int line = editBox.lineNumber + 1;
          if(projectView)
          {
-            CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
+            CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
             ProjectConfig config = projectView.project.config;
             int bitDepth = ide.workspace.bitDepth;
             bool useValgrind = ide.workspace.useValgrind;
@@ -2064,7 +2101,7 @@ class CodeEditor : Window
       if(!parentClosing)
       {
          if(ide.workspace && fileName)
-            ide.workspace.UpdateOpenedFileInfo(fileName, closed);
+            ide.workspace.UpdateOpenedFileInfo(fileName, closed, false);
          if(inUseDebug && !debugClosing)
          {
             debugClosing = true;
@@ -2099,7 +2136,7 @@ class CodeEditor : Window
    void OnDestroy(void)
    {
       ObjectInfo oClass, next;
-      Class windowClass = eSystem_FindClass(this.privateModule, "ecere::gui::Window");
+      // Class windowClass = eSystem_FindClass(this.privateModule, "ecere::gui::Window");
 
       FreeType(this.functionType);
       FreeType(this.instanceType);
@@ -2148,9 +2185,6 @@ class CodeEditor : Window
          classes.Delete(oClass);
       }
 
-      if(windowClass && windowClass.data)
-         UnapplySkin(windowClass);
-
       FreeParser();
 
       if(sheet.codeEditor == this)
@@ -2258,7 +2292,7 @@ class CodeEditor : Window
       return true;
    }
 
-   bool OnSaveFile(char * fileName)
+   bool OnSaveFile(const char * fileName)
    {
       File f;
       if(designer)
@@ -2287,7 +2321,7 @@ class CodeEditor : Window
       return false;
    }
 
-   bool OnFileModified(FileChange fileChange, char * param)
+   bool OnFileModified(FileChange fileChange, const char * param)
    {
       bool reload = false;
       if(visible == false && inUseDebug == true)
@@ -2298,7 +2332,7 @@ class CodeEditor : Window
 
          sprintf(message, $"The document %s was modified by another application.\n"
             "Would you like to reload it and lose your changes?", fileName);
-         if(MessageBox { type = yesNo, master = /*parent = */parent, text = $"Document has been modified",
+         if(MessageBox { creationActivation = flash, type = yesNo, master = /*parent = */parent, text = $"Document has been modified",
             contents = message }.Modal() == yes)
             reload = true;
       }
@@ -2378,7 +2412,7 @@ class CodeEditor : Window
 
       if(editBox.syntaxHighlighting && fileName && ide.projectView)
       {
-         bool error, bpOnCursor, bpOnTopFrame, breakpointEnabled[128];
+         bool error, bpOnTopFrame, breakpointEnabled[128];
          int lineCursor, lineTopFrame, breakpointLines[128];
          int count, i, lineH, boxH, scrollY; //, firstLine; firstLine = editBox.firstLine;
          Debugger debugger = ide.debugger;
@@ -2388,7 +2422,7 @@ class CodeEditor : Window
          scrollY = editBox.scroll.y;
          displaySystem.FontExtent(editBox.font.font, " ", 1, null, &lineH);
 
-         bpOnCursor = bpOnTopFrame = false;
+         bpOnTopFrame = false;
          count = debugger.GetMarginIconsLineNumbers(fileName, breakpointLines, breakpointEnabled, 128, &error, &lineCursor, &lineTopFrame);
          if(count)
          {
@@ -2397,8 +2431,6 @@ class CodeEditor : Window
                if(breakpointLines[i] == lineCursor || breakpointLines[i] == lineTopFrame)
                {
                   bmpRes = breakpointEnabled[i] ? ide.bmpBpHalf : ide.bmpBpHalfDisabled;
-                  if(breakpointLines[i] == lineCursor)
-                     bpOnCursor = true;
                   if(breakpointLines[i] == lineTopFrame)
                      bpOnTopFrame = true;
                }
@@ -2440,7 +2472,7 @@ class CodeEditor : Window
    watch(fileName)
    {
       char ext[MAX_EXTENSION];
-      char * fileName = property::fileName;
+      const char * fileName = property::fileName;
 
       if(SearchString(fileName, 0, "Makefile", false, true))
          editBox.useTab = true;
@@ -2500,7 +2532,7 @@ class CodeEditor : Window
       return true;
    }
 
-   bool LoadFile(char * filePath)
+   bool LoadFile(const char * filePath)
    {
       File f = FileOpen(filePath, read);
       if(f)
@@ -2543,7 +2575,6 @@ class CodeEditor : Window
    CodeEditor()
    {
       CodeObjectType c;
-      ProjectView projectView = ide.projectView;
 
       globalData.classes.CompareKey = (void *)BinaryTree::CompareString;
       globalData.defines.CompareKey = (void *)BinaryTree::CompareString;
@@ -2579,6 +2610,7 @@ class CodeEditor : Window
 
    void ModifyCode()
    {
+      fixCaret = true;
       selected.modified = true;
       selected.oClass.modified = true;
 
@@ -2592,19 +2624,25 @@ class CodeEditor : Window
    ****************************************************************************/
    void FreeParser()
    {
+      {
+         Class windowClass = eSystem_FindClass(privateModule, "ecere::gui::Window");
+         if(windowClass && windowClass.data)
+            UnapplySkin(windowClass);
+      }
+
       SetCurrentNameSpace(null);
-      if(ast != null)
+      if(ast)
       {
          FreeASTTree(ast);
          ast = null;
       }
-      this.defines.Free(FreeModuleDefine);
-      this.imports.Free(FreeModuleImport);   // Moved this after FreeAST because Debug printing causes ModuleImports to be created
+      defines.Free(FreeModuleDefine);
+      imports.Free(FreeModuleImport);   // Moved this after FreeAST because Debug printing causes ModuleImports to be created
 
-      FreeExcludedSymbols(this.excludedSymbols);
-      FreeContext(this.globalContext);
+      FreeExcludedSymbols(excludedSymbols);
+      FreeContext(globalContext);
       FreeIncludeFiles();
-      FreeGlobalData(&this.globalData);
+      FreeGlobalData(&globalData);
       FindCtx_Terminate();
       FindParams_Terminate();
 
@@ -2620,11 +2658,26 @@ class CodeEditor : Window
          SetPrivateModule(null);
       }
 
+      // Note: This code should probably be merged with FreeParser()
+      if(ast)
+      {
+         FreeASTTree(ast);
+         ast = null;
+         //SetAST(null);
+      }
+      defines.Free(FreeModuleDefine);
+      imports.Free(FreeModuleImport);
+
+      FreeContext(this.globalContext);
+      FreeExcludedSymbols(this.excludedSymbols);
+
+      FreeIncludeFiles();
+      FreeGlobalData(&this.globalData);
+
       if(this.privateModule)
       {
          FreeTypeData(this.privateModule);
          delete this.privateModule;
-         this.privateModule = null;
       }
    }
 
@@ -2640,7 +2693,7 @@ class CodeEditor : Window
       Designer backDesigner;
       char oldWorkDir[MAX_LOCATION];
       char mainModuleName[MAX_FILENAME] = "";
-      char * fileName;
+      const char * fileName;
       ImportedModule module;
       char extension[MAX_EXTENSION];
       PathBackup pathBackup { };
@@ -2687,18 +2740,6 @@ class CodeEditor : Window
 
       editBox.GetSelPos(&l1, &y1, &x1, &l2, &y2, &x2, false);
 
-      FindCtx_Terminate();
-      FindParams_Terminate();
-
-      SetGlobalData(&globalData);
-      SetGlobalContext(globalContext);
-      SetExcludedSymbols(&excludedSymbols);
-      SetTopContext(globalContext);
-      SetCurrentContext(globalContext);
-      SetDefines(&defines);
-      SetImports(&imports);
-      SetCurrentNameSpace(null);
-
       /*
       sprintf(command, "C:\\Program Files\\Microsoft Visual Studio\\VC98\\Bin\\cl "
          "/nologo /D \"MSC\" /D \"WIN32\" /D \"NDEBUG\" /D \"_WINDOWS\" /D \"_MBCS\" "
@@ -2754,7 +2795,7 @@ class CodeEditor : Window
 
             next = _class.next;
 
-            for(;object = _class.instances.first;)
+            while((object = _class.instances.first))
             {
                if(object.instance)
                {
@@ -2787,38 +2828,21 @@ class CodeEditor : Window
          this.oClass = null;
       }
 
-      {
-         Class windowClass = eSystem_FindClass(this.privateModule, "ecere::gui::Window");
-         if(windowClass && windowClass.data)
-            UnapplySkin(windowClass);
-      }
-
       designer = backDesigner;
 
       SetEchoOn(true);
       fileInput = editFile = EditBoxStream { editBox = editBox };
       SetFileInput(fileInput);
 
-      if(ast)
-      {
-         FreeASTTree(ast);
-         ast = null;
-         //SetAST(null);
-      }
-      defines.Free(FreeModuleDefine);
-      imports.Free(FreeModuleImport);
-
-      FreeContext(this.globalContext);
-      FreeExcludedSymbols(this.excludedSymbols);
-
-      FreeIncludeFiles();
-      FreeGlobalData(&this.globalData);
+      FreeParser();
 
-      if(this.privateModule)
-      {
-         FreeTypeData(this.privateModule);
-         delete this.privateModule;
-      }
+      SetGlobalData(&globalData);
+      SetGlobalContext(globalContext);
+      SetExcludedSymbols(&excludedSymbols);
+      SetTopContext(globalContext);
+      SetCurrentContext(globalContext);
+      SetDefines(&defines);
+      SetImports(&imports);
 
 #ifdef _TIMINGS
       startTime = GetTime();
@@ -2829,11 +2853,11 @@ class CodeEditor : Window
 
       if(ide.workspace)
       {
-         CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
+         CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
          SetTargetBits(ide.workspace.bitDepth ? ide.workspace.bitDepth : GetHostBits());
          delete compiler;
       }
-      this.privateModule = __ecere_COM_Initialize(false | ((GetTargetBits() == sizeof(uintptr) *8) ? 0 : GetTargetBits() == 64 ? 2 : 4), 1, null);
+      this.privateModule = __ecere_COM_Initialize((bool)(false | ((GetTargetBits() == sizeof(uintptr) *8) ? 0 : GetTargetBits() == 64 ? 2 : 4)), 1, null);
 
       SetPrivateModule(privateModule);
 
@@ -2882,11 +2906,12 @@ class CodeEditor : Window
       // TODO: Get symbolsDir from project settings instead...
       if(ide.projectView)
       {
-         CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
+         CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
          ProjectConfig config = project.config;
          int bitDepth = ide.workspace.bitDepth;
          DirExpression objDir = project.GetObjDir(compiler, config, bitDepth);
          SetSymbolsDir(objDir.dir);
+         SetDefaultNameSpace(project.GetDefaultNameSpace(config));
          ide.SetPath(true, compiler, config, bitDepth);
 
          delete objDir;
@@ -2896,7 +2921,7 @@ class CodeEditor : Window
       }
       else
       {
-         switch(GetRuntimePlatform())
+         switch(__runtimePlatform)
          {
             case win32: SetSymbolsDir("obj/debug.win32"); break;
             case tux:   SetSymbolsDir("obj/debug.linux"); break;
@@ -2904,6 +2929,7 @@ class CodeEditor : Window
          }
          SetIncludeDirs(null);
          SetSysIncludeDirs(null);
+         SetDefaultNameSpace(null);
       }
 
       {
@@ -3087,7 +3113,6 @@ class CodeEditor : Window
                            classDefinition = _class;
                            oClass = classObject;
                         };
-                        Symbol symbol;
                         classes.Add(classObject);
 
                         incref instance;
@@ -3321,7 +3346,7 @@ class CodeEditor : Window
                                                                {
                                                                   Property prop = (Property) curMember;
                                                                   Class propertyClass = prop.dataTypeClass;
-                                                                  bool variable = false;
+                                                                  bool variable = true;
                                                                   if(!propertyClass)
                                                                      propertyClass = prop.dataTypeClass = eSystem_FindClass(this.privateModule, prop.dataTypeString);
 
@@ -3400,16 +3425,19 @@ class CodeEditor : Window
                                                                                           ObjectInfo check;
                                                                                           if(!strcmp(name, "this"))
                                                                                           {
-                                                                                             char * name = computed.member.member.string;
-                                                                                             ObjectInfo check;
-                                                                                             for(check = classObject.instances.first; check; check = check.next)
-                                                                                                if(check.name && !strcmp(name, check.name))
-                                                                                                {
-                                                                                                   if(prop.Set)
-                                                                                                      ((void (*)(void *, void *))(void *)prop.Set)(control, check.instance);
-                                                                                                   variable = false;
-                                                                                                   break;
-                                                                                                }
+                                                                                             if(computed.member.member)
+                                                                                             {
+                                                                                                char * name = computed.member.member.string;
+                                                                                                ObjectInfo check;
+                                                                                                for(check = classObject.instances.first; check; check = check.next)
+                                                                                                   if(check.name && !strcmp(name, check.name))
+                                                                                                   {
+                                                                                                      if(prop.Set)
+                                                                                                         ((void (*)(void *, void *))(void *)prop.Set)(control, check.instance);
+                                                                                                      variable = false;
+                                                                                                      break;
+                                                                                                   }
+                                                                                             }
                                                                                           }
                                                                                           else
                                                                                           {
@@ -3554,7 +3582,6 @@ class CodeEditor : Window
          if(selectedName)
          {
             ObjectInfo check;
-            int pos = 0;
 
             for(check = this.oClass.instances.first; check; check = check.next)
             {
@@ -3668,7 +3695,7 @@ class CodeEditor : Window
                      if((prop.IsSet && !prop.IsSet(test)) || ((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, dataForm, dataTest))
                      {
                         char tempString[1024] = "";
-                        char * string = "";
+                        const char * string = "";
                         bool needClass = true;
                         if(*prev)
                            f.Printf(", ");
@@ -3722,7 +3749,7 @@ class CodeEditor : Window
                      if((prop.IsSet && !prop.IsSet(test)) || ((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, dataForm, dataTest))
                      {
                         char tempString[1024] = "";
-                        char * string = "";
+                        const char * string = "";
                         if(*prev)
                            f.Printf(", ");
 
@@ -3773,7 +3800,7 @@ class CodeEditor : Window
                            {
                               Map<String, bool> i18nStrings = object.i18nStrings;
                               bool i18n = true;
-                              if(i18nStrings && i18nStrings.GetAtPosition(prop.name, false))
+                              if(i18nStrings && i18nStrings.GetAtPosition(prop.name, false, null))
                                  i18n = false;
 
                               f.Printf("%s\"", i18n ? "$" : "");
@@ -3801,7 +3828,7 @@ class CodeEditor : Window
 
                      if((prop.IsSet && !prop.IsSet(test)) || ((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, &dataForm, &dataTest))
                      {
-                        char * string;
+                        char * string = null;
                         char tempString[1024] = "";
                         SetProperty(prop, test, dataForm);
 
@@ -3811,13 +3838,14 @@ class CodeEditor : Window
 
                            if(dataType.type == enumClass)
                            {
-                              NamedLink value;
+                              NamedLink64 value;
                               Class enumClass = eSystem_FindClass(privateModule, "enum");
                               EnumClassData e = ACCESS_CLASSDATA(dataType, enumClass);
+                              int64 i64Value = GetI64EnumValue(dataType, dataForm);
 
                               for(value = e.values.first; value; value = value.next)
                               {
-                                 if((int)value.data == dataForm.i)
+                                 if(value.data == i64Value)
                                  {
                                     string = value.name;
                                     break;
@@ -3879,9 +3907,7 @@ class CodeEditor : Window
       Window control = (Window)object.instance;
       bool prev = false;
       bool methodPresent = false;
-      Class _class;
       bool lastIsMethod = true;
-      ObjectInfo classObject = object.oClass;
 
       if(inst)
       {
@@ -3963,7 +3989,7 @@ class CodeEditor : Window
                {
                   int count = 0;
                   int toDelete = 0;
-                  int toAdd = 0;
+                  //int toAdd = 0;
 
                   f.Seek(-1, current);
                   DeleteJunkBefore(f, position, &position);
@@ -3989,8 +4015,8 @@ class CodeEditor : Window
                            toDelete += count - 6;
                            count = 6;
                         }
-                        else
-                           toAdd = 6 - count;
+                        /*else
+                           toAdd = 6 - count;*/
                         break;
                      }
                   }
@@ -4139,7 +4165,6 @@ class CodeEditor : Window
                   if(!keptMember || !members.next)
                   {
                      char ch = 0;
-                     int count = 0;
 
                      if(keptMember && lastKept != members.dataMembers->last)
                      {
@@ -4333,7 +4358,7 @@ class CodeEditor : Window
                }
                else
                {
-                  Class moduleClass = eSystem_FindClass(this.privateModule, "Module");
+                  // Class moduleClass = eSystem_FindClass(this.privateModule, "Module");
 
                   // ADDING METHOD HERE
                   f.Printf("\n      ");
@@ -4362,7 +4387,7 @@ class CodeEditor : Window
                   f.Printf(")\n");
                   f.Printf("      %c\n\n", OpenBracket);
 
-                  if(control._class._vTbl[method.vid] == moduleClass._vTbl[__ecereVMethodID___ecereNameSpace__ecere__com__Module_OnLoad]) // Temp Check for DefaultFunction
+                  if(control._class._vTbl[method.vid] == null /*moduleClass._vTbl[__ecereVMethodID___ecereNameSpace__ecere__com__Module_OnLoad]*/) // Temp Check for DefaultFunction
                   {
                      if(returnType.kind == classType && !strcmp(returnType._class.string, "bool"))
                         f.Printf("         return true;\n");
@@ -4421,7 +4446,7 @@ class CodeEditor : Window
             {
                Class dataType = prop.dataTypeClass;
                char tempString[1024] = "";
-               char * string;
+               char * string = null;
                bool specify = false;
                DataMember member;
 
@@ -4482,7 +4507,7 @@ class CodeEditor : Window
                   if(((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, dataForm, dataTest))
                   {
                      char tempString[1024] = "";
-                     char * string;
+                     char * string = null;
                      ((void (*)(void *, void *))(void *)prop.Set)(test, dataForm);
 
                      if(eClass_IsDerived(classObject.instance._class, dataType) && classObject.instance == dataForm)
@@ -4500,7 +4525,7 @@ class CodeEditor : Window
                         {
                            Map<String, bool> i18nStrings = classObject.i18nStrings;
                            bool i18n = true;
-                           if(i18nStrings && i18nStrings.GetAtPosition(prop.name, false))
+                           if(i18nStrings && i18nStrings.GetAtPosition(prop.name, false, null))
                               i18n = false;
 
                            f.Printf("\n   %s%s = %s\"", specify ? "property::" : "", prop.name, i18n ? "$" : "");
@@ -4540,13 +4565,14 @@ class CodeEditor : Window
                         bool needClass = true;
                         if(dataType.type == enumClass)
                         {
-                           NamedLink value;
+                           NamedLink64 value;
                            Class enumClass = eSystem_FindClass(privateModule, "enum");
                            EnumClassData e = ACCESS_CLASSDATA(dataType, enumClass);
+                           int64 i64Value = GetI64EnumValue(dataType, dataForm);
 
                            for(value = e.values.first; value; value = value.next)
                            {
-                              if((int)value.data == dataForm.i)
+                              if(value.data == i64Value)
                               {
                                  string = value.name;
                                  break;
@@ -4600,7 +4626,6 @@ class CodeEditor : Window
 
          for(classObject = classes.first; classObject; classObject = classObject.next)
          {
-            Class _class;
             ClassDefinition classDef = classObject.classDefinition;
             Class regClass = eSystem_FindClass(this.privateModule, ((Specifier)classDef.baseSpecs->first).name);
             Instance test;
@@ -4719,7 +4744,6 @@ class CodeEditor : Window
                      if(!keptMember)
                      {
                         char ch = 0;
-                        int count = 0;
                         f.Seek(def.loc.end.pos - position - 1, current);
                         f.Getc(&ch);
 
@@ -4947,7 +4971,7 @@ class CodeEditor : Window
                   Type dataType = method.dataType;
                   Type returnType = dataType.returnType;
                   Type param;
-                  Class moduleClass = eSystem_FindClass(this.privateModule, "Module");
+                  // Class moduleClass = eSystem_FindClass(this.privateModule, "Module");
 
                   f.Printf("\n\n");
                   f.Printf("   ");
@@ -4973,7 +4997,7 @@ class CodeEditor : Window
                   f.Printf(")\n");
                   f.Printf("   %c\n\n", OpenBracket);
 
-                  if(test._class._vTbl[method.vid] == moduleClass._vTbl[__ecereVMethodID___ecereNameSpace__ecere__com__Module_OnLoad]) // Temp Check for DefaultFunction
+                  if(test._class._vTbl[method.vid] == null /*moduleClass._vTbl[__ecereVMethodID___ecereNameSpace__ecere__com__Module_OnLoad]*/) // Temp Check for DefaultFunction
                   {
                      if(returnType && returnType.kind == classType && !strcmp(returnType._class.string, "bool"))
                         f.Printf("      return true;\n");
@@ -5030,7 +5054,7 @@ class CodeEditor : Window
       method = null;
    }
 
-   int FindMethod(char * methodName /*Method method*/, ClassFunction*functionPtr, Location propLoc)
+   int FindMethod(const char * methodName /*Method method*/, ClassFunction*functionPtr, Location propLoc)
    {
       int found = 0;
       ClassFunction function = null;
@@ -5181,7 +5205,7 @@ class CodeEditor : Window
       return found;
    }
 
-   void GoToMethod(char * methodName /*Method method*/)
+   void GoToMethod(const char * methodName /*Method method*/)
    {
       if(methodName)
       {
@@ -5617,7 +5641,7 @@ class CodeEditor : Window
          sheet.DeleteObject(object);
    }
 
-   void RenameObject(ObjectInfo object, char * name)
+   void RenameObject(ObjectInfo object, const char * name)
    {
       bool valid = false;
 
@@ -5681,7 +5705,7 @@ class CodeEditor : Window
 
                if(subMember.dataType && subMember.dataType.kind == classType && subMember.dataType._class)
                {
-                  char * bitmapName = (char *)eClass_GetProperty(subMember.dataType._class.registered, "icon");
+                  char * bitmapName = (char *)(intptr)eClass_GetProperty(subMember.dataType._class.registered, "icon");
                   if(bitmapName)
                   {
                      bitmap = { bitmapName };
@@ -5779,7 +5803,7 @@ class CodeEditor : Window
 
                      if(member.dataType && member.dataType.kind == classType && member.dataType._class)
                      {
-                        char * bitmapName = (char *)eClass_GetProperty(member.dataType._class.registered, "icon");
+                        char * bitmapName = (char *)(intptr)eClass_GetProperty(member.dataType._class.registered, "icon");
                         if(bitmapName)
                         {
                            bitmap = { bitmapName };
@@ -5810,8 +5834,6 @@ class CodeEditor : Window
       for(_class = whatClass; _class && _class.type != systemClass; _class = _class.base)
       {
          Method method;
-         Property prop;
-         DataMember member;
 
          for(method = (Method)_class.methods.first; method; method = (Method)((BTNode)method).next)
          {
@@ -5822,7 +5844,7 @@ class CodeEditor : Window
                   if(!method.dataType)
                      method.dataType = ProcessTypeString(method.dataTypeString, false);
 
-                  if(MatchTypes(method.dataType, methodType, null, whatClass, /*null, */whatClass, false, true, false, false))
+                  if(MatchTypes(method.dataType, methodType, null, whatClass, /*null, */whatClass, false, true, false, false, true))
                   {
                      DataRow row = membersList.FindString(method.name);
                      if(!row)
@@ -5842,14 +5864,13 @@ class CodeEditor : Window
       }
    }
 
-   void ListClassPropertiesAndVirtual(Class whatClass, String curString)
+   void ListClassPropertiesAndVirtual(Class whatClass, const String curString)
    {
       Class _class;
       bool isPrivate = false;
       for(_class = whatClass; _class /*&& _class.type != systemClass*/; _class = _class.base)
       {
          Method method;
-         Property prop;
          DataMember member;
 
          for(method = (Method)_class.methods.first; method; method = (Method)((BTNode)method).next)
@@ -5894,7 +5915,7 @@ class CodeEditor : Window
 
                   if(member.dataType && member.dataType.kind == classType && member.dataType._class)
                   {
-                     char * bitmapName = (char *)eClass_GetProperty(member.dataType._class.registered, "icon");
+                     char * bitmapName = (char *)(intptr)eClass_GetProperty(member.dataType._class.registered, "icon");
                      if(bitmapName)
                      {
                         bitmap = { bitmapName };
@@ -5919,8 +5940,6 @@ class CodeEditor : Window
    {
       if(type && (type.kind == classType || type.kind == structType || type.kind == unionType))
       {
-         Class _class;
-
          if(type.kind == classType)
          {
             if(type._class)
@@ -5976,14 +5995,14 @@ class CodeEditor : Window
 
       for(link = (BTNamedLink)nameSpace.defines.first; link; link = (BTNamedLink)((BTNode)link).next )
       {
-         DefinedExpression definedExp = link.data;
+         //DefinedExpression definedExp = link.data;
          DataRow row = membersList.AddString(link /*definedExp*/.name);
          row.icon = icons[typeData];
       }
 
       for(link = (BTNamedLink)nameSpace.functions.first; link; link = (BTNamedLink)((BTNode)link).next)
       {
-         GlobalFunction function = link.data;
+         //GlobalFunction function = link.data;
          DataRow row = membersList.AddString(link /*function*/.name);
          row.icon = icons[typeMethod];
       }
@@ -6013,7 +6032,7 @@ class CodeEditor : Window
       for(_class : classes)
       {
          EnumClassData enumeration = (EnumClassData)_class.data;
-         NamedLink item;
+         NamedLink64 item;
          for(item = enumeration.values.first; item; item = item.next)
          {
             DataRow row = membersList.AddString(item.name);
@@ -6038,7 +6057,7 @@ class CodeEditor : Window
       return result;
    }
 
-   void ListNameSpaceByString(Module mainModule, char * string)
+   void ListNameSpaceByString(Module mainModule, const char * string)
    {
       NameSpace * nameSpace;
       Module module;
@@ -6066,14 +6085,14 @@ class CodeEditor : Window
       for(link = (BTNamedLink)nameSpace.classes.first; link; link = (BTNamedLink)((BTNode)link).next)
       {
          Class _class = link.data;
-         if(_class.type == enumClass && (dest.kind != classType || ((!dest._class || !dest._class.registered || (dest._class.registered != _class && strcmp(dest._class.registered.dataTypeString, "char *"))) && !dest.classObjectType)) &&
+         if(_class.type == enumClass && (dest.kind != classType || ((!dest._class || !dest._class.registered || (dest._class.registered != _class && strcmp(dest._class.registered.dataTypeString, "char *") && strcmp(dest._class.string, "bool"))) && !dest.classObjectType)) &&
             dest.kind != pointerType && dest.kind != ellipsisType)
          {
             OldList conversions { };
             Type type { };
             type.kind = classType;
             type._class = FindClass(_class.name);
-            if(MatchTypes(type, dest, &conversions, null, null, true, false, false, false))
+            if(MatchTypes(type, dest, &conversions, null, null, true, false, false, false, true))
             {
                ListEnumValues(_class);
                result = true;
@@ -6089,7 +6108,7 @@ class CodeEditor : Window
       return result;
    }
 
-   NameSpace * FindNameSpace(NameSpace nameSpace, char * name)
+   NameSpace * FindNameSpace(NameSpace nameSpace, const char * name)
    {
       int start = 0, c;
       char ch;
@@ -6117,7 +6136,7 @@ class CodeEditor : Window
       return (NameSpace *)nameSpace;
    }
 
-   void ListSymbols(Expression exp, bool enumOnly, char * string, Identifier realIdentifier)
+   void ListSymbols(Expression exp, bool enumOnly, const char * string, Identifier realIdentifier)
    {
       bool listedEnums = false;
       Type destType = (exp && exp.destType && !exp.destType.truth) ? exp.destType : null;
@@ -6177,7 +6196,7 @@ class CodeEditor : Window
       }
       else if(destType && destType.kind == enumType)
       {
-         NamedLink value;
+         NamedLink64 value;
 
          for(value = destType.members.first; value; value = value.next)
          {
@@ -6239,7 +6258,7 @@ class CodeEditor : Window
                         BitmapResource bitmap = null;
                         if(symbol.type && symbol.type.kind == classType && symbol.type._class && symbol.type._class)
                         {
-                           char * bitmapName = (char *)eClass_GetProperty(symbol.type._class.registered, "icon");
+                           char * bitmapName = (char *)(intptr)eClass_GetProperty(symbol.type._class.registered, "icon");
                            if(bitmapName)
                            {
                               bitmap = { bitmapName };
@@ -6331,7 +6350,7 @@ class CodeEditor : Window
    void OverrideVirtualFunction(ClassFunction function, Method method, Class _class, bool isInstance, bool extraIndent)
    {
       EditBoxStream f { editBox = editBox };
-      uint position = 0;
+      int position = 0;
       EditLine l1, l2;
       int x1,y1,x2,y2;
 
@@ -6348,7 +6367,7 @@ class CodeEditor : Window
          Type dataType = method.dataType;
          Type returnType = dataType.returnType;
          Type param;
-         Class moduleClass = eSystem_FindClass(this.privateModule, "Module");
+         // Class moduleClass = eSystem_FindClass(this.privateModule, "Module");
 
          if(insideDef.prev)
              f.Printf("\n\n");
@@ -6390,7 +6409,7 @@ class CodeEditor : Window
 
          if(!_class ||
             (
-               (isInstance ? _class : _class.base)._vTbl[method.vid] == moduleClass._vTbl[__ecereVMethodID___ecereNameSpace__ecere__com__Module_OnLoad] ||
+               (isInstance ? _class : _class.base)._vTbl[method.vid] == null /*moduleClass._vTbl[__ecereVMethodID___ecereNameSpace__ecere__com__Module_OnLoad]*/ ||
                (isInstance ? _class : _class.base)._vTbl[method.vid] == DummyMethod)) // Temp Check for DefaultFunction
          {
             if(returnType && returnType.kind == classType && !strcmp(returnType._class.string, "bool"))
@@ -6439,7 +6458,6 @@ class CodeEditor : Window
    {
       bool didOverride = false;
       EditLine line = editBox.line;
-      char * text = line.text;
       int lineNum, charPos;
       Expression exp = null;
       EditLine l1, l2;
@@ -6541,11 +6559,12 @@ class CodeEditor : Window
          int rowCount;
          char tempString[1024];
          char * string = null;
-         CodePosition idStart, idEnd;
+         CodePosition idStart { };
+         CodePosition idEnd { };
 
          if(membersListShown)
          {
-            char * buffer = membersLine.text;
+            const char * buffer = membersLine.text;
             int c;
             bool firstChar = true;
             int len = 0;
@@ -6577,7 +6596,7 @@ class CodeEditor : Window
             }
             string[len] = 0;
             */
-            int x, y;
+            int x = 0, y;
             int len = 0;
             EditLine editLine = editBox.line;
             bool firstChar = true;
@@ -6586,7 +6605,7 @@ class CodeEditor : Window
             string = tempString;
             for(y = lineNum-1; y >= 0; y--)
             {
-               char * buffer = editLine.text;
+               const char * buffer = editLine.text;
                int lineCount = editLine.count;
                for(x = (y == lineNum-1) ? (Min(charPos, lineCount) - 1 ): lineCount-1; x >= 0; x--)
                {
@@ -6711,7 +6730,7 @@ class CodeEditor : Window
                DataRow row = string ? membersList.FindSubString(string) : null;
                if(row && !membersList.FindSubStringAfter(row, string) && !caretMove)
                {
-                  char * newString = row.string;
+                  const char * newString = row.string;
                   if(!membersListShown)
                   {
                      membersLoc.start.line = idStart.line-1;
@@ -6816,10 +6835,7 @@ class CodeEditor : Window
 
    void InvokeParameters(bool exact, bool reposition, bool caretMove)
    {
-      EditLine line = editBox.line;
-      char * text = line.text;
       int lineNum, charPos;
-      Expression exp = null;
       EditLine l1, l2;
       int x1,y1, x2,y2;