compiler/libec; ecere: Support for checking platform as a compile time constant
[sdk] / ide / src / designer / CodeEditor.ec
index 37e4348..4625601 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",
@@ -168,8 +168,6 @@ File output;
 
 File fileInput;
 
-bool parseError = false;
-
 int returnCode;
 
 Class insideClass;
@@ -178,7 +176,7 @@ Expression paramsInsideExp;
 ClassFunction insideFunction;
 ClassDef insideDef;
 Type instanceType;
-char * instanceName;
+const char * instanceName;
 Type functionType;
 int paramsID;
 bool insideInstance;
@@ -187,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++)
@@ -196,15 +194,24 @@ static void OutputString(File f, char * string)
          f.Puts("\\\"");
       else if(string[c] == '\\')
          f.Puts("\\\\");
+      else if(string[c] == '\n')
+      {
+         f.Puts("\\n");
+         if(c > 30)
+            f.Puts("\"\n   \"");
+      }
       else
          f.Putc(string[c]);
    }
 }
 
+// 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:
@@ -269,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("...");
@@ -378,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);
@@ -412,15 +454,47 @@ bool Code_IsPropertyModified(Instance test, ObjectInfo selected, Property prop)
       else if(dataType && dataType._vTbl && (dataType.type == normalClass || dataType.type == noHeadClass))
       {
          void * dataForm, * dataTest;
+         bool isEditBoxContents = false;
+         bool freeDataForm = false, freeDataTest = false;
 
-         dataForm = ((void *(*)(void *))(void *)prop.Get)(selected.instance);
-         dataTest = ((void *(*)(void *))(void *)prop.Get)(test);
+         // Because contents property is broken for mutiline EditBox at the moment
+         if(!strcmp(prop.name, "contents") && !strcmp(prop._class.name, "EditBox"))
+            isEditBoxContents = true;
+
+         if(isEditBoxContents && ((EditBox)selected.instance).multiLine)
+         {
+            dataForm = ((EditBox)selected.instance).multiLineContents;
+            freeDataForm = true;
+         }
+         else
+            dataForm = ((void *(*)(void *))(void *)prop.Get)(selected.instance);
+         if(isEditBoxContents && ((EditBox)test).multiLine)
+         {
+            dataTest = ((EditBox)test).multiLineContents;
+            freeDataTest = true;
+         }
+         else
+            dataTest = ((void *(*)(void *))(void *)prop.Get)(test);
 
          if((prop.IsSet && !prop.IsSet(test)) || ((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, dataForm, dataTest))
          {
             ((void (*)(void *, void *))(void *)prop.Set)(test, dataForm);
             result = true;
          }
+
+         // Temporary work around until we standardize how properties should manage memory
+         if(!strcmp(prop.name, "strings") && !strcmp(prop._class.name, "DirectoriesBox"))
+            freeDataForm = freeDataTest = true;
+         if(dataType.type == normalClass && dataType.structSize)
+         {
+            if(freeDataForm) eInstance_Delete(dataForm);
+            if(freeDataTest) eInstance_Delete(dataTest);
+         }
+         else
+         {
+            if(freeDataForm) delete dataForm;
+            if(freeDataTest) delete dataTest;
+         }
       }
       else if(dataType && dataType._vTbl)
       {
@@ -447,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)
@@ -519,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;
@@ -640,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;
@@ -755,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
@@ -808,6 +881,7 @@ class CodeEditor : Window
                node.modified = modifiedDocument;
             projectView.Update(null);
          }
+         delete nodes;
       }
    };
 
@@ -855,7 +929,7 @@ class CodeEditor : Window
 
       void NotifyOvrToggle(EditBox editBox, bool overwrite)
       {
-         ide.ovr.color = overwrite ? black : Color { 128, 128, 128 };
+         ide.UpdateStateLight(ide.ovr, overwrite);
       }
 
       void NotifyUpdate(EditBox editBox)
@@ -886,8 +960,8 @@ class CodeEditor : Window
             {
                int c;
                // HOW WE MIGHT WANT TO DO IT:
-               char * text = before.line.text;
-               for(c = before.x-1; c>= 0; c--)
+               const char * text = before.line.text;
+               for(c = Min(before.line.count, before.x-1); c>= 0; c--)
                   if(!isspace(text[c]))
                      break;
                ide.debugger.MoveIcons(fileName, before.y + (((!pasteOperation && c > -1) || !after.line.count) ? 1 : 0), after.y - before.y, false);
@@ -937,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;
@@ -1003,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);
@@ -1025,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] == ':'))
                   {
@@ -1258,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];
@@ -1361,9 +1435,11 @@ class CodeEditor : Window
             ObjectInfo object;
             ObjectInfo classObject;
 
-            //editBox.NotifyCaretMove(this, editBox, y, x);
             editBox.GoToLineNum(y);
+            x = Min(x, editBox.line.count);
             editBox.GoToPosition(editBox.line, y, x);
+            // Note: Uncommented this to drag objects after the member instance on which they are dropped
+            editBox.NotifyCaretMove(this, editBox, y+1, x+1);
 
             classObject = selected ? selected.oClass : null;
 
@@ -1407,9 +1483,7 @@ class CodeEditor : Window
          {
             if(ide.projectView)
             {
-               ProjectNode node = ide.projectView.GetNodeFromWindow(this, null, true, false);
-               if(!node)
-                  node = ide.projectView.GetNodeFromWindow(this, null, true, true);
+               ProjectNode node = ide.projectView.GetNodeForCompilationFromWindow(this, false, null, null);
                if(!node)
                {
                   char * s;
@@ -1490,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(
@@ -1565,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(
@@ -1931,6 +2005,31 @@ class CodeEditor : Window
    MenuItem { fileMenu, $"Save", s, Key { s, ctrl = true }, NotifySelect = MenuFileSave };
    MenuItem { fileMenu, $"Save As...", a, NotifySelect = MenuFileSaveAs };
 
+   Menu editMenu { menu, $"Edit", e };
+   MenuDivider { editMenu };
+   MenuItem clearTrailingSpacesItem
+   {
+      editMenu, $"Clear trailing spaces", t, Key { t, ctrl = true, shift = true };
+
+      bool NotifySelect(MenuItem selection, Modifiers mods)
+      {
+         // Nuke trailing spaces
+         EditLine line;
+         int y = 0;
+         editBox.recordUndoEvent = true;
+         for(line = editBox.firstLine; line; line = line.next, y++)
+         {
+            const String buffer = line.text;
+            int count = line.count, i = count-1;
+            while(i >= 0 && isspace(buffer[i])) i--;
+            if(i < count - 1)
+               editBox.Delete(line, y, i + 1, line, y, count);
+         }
+         editBox.recordUndoEvent = false;
+         return true;
+      }
+   };
+
    Menu debugMenu { menu, $"Debug", d };
    MenuItem debugRunToCursor                { debugMenu, $"Run To Cursor", c, ctrlF10,                                                                  id = RTCMenuBits { false, false, false }, NotifySelect = RTCMenu_NotifySelect; };
    MenuItem debugSkipRunToCursor            { debugMenu, $"Run To Cursor Skipping Breakpoints", u, Key { f10, ctrl = true, shift = true },              id = RTCMenuBits { true,  false, false }, NotifySelect = RTCMenu_NotifySelect; };
@@ -2062,6 +2161,11 @@ class CodeEditor : Window
                Designer::DestroyObject(object.instance);
                delete object.instance;
             }
+            if(object.i18nStrings)
+            {
+               Map<String, bool> i18nStrings = object.i18nStrings;
+               delete i18nStrings;
+            }
             sheet.DeleteObject(object);
             delete object.name;
             oClass.instances.Delete(object);
@@ -2071,6 +2175,11 @@ class CodeEditor : Window
             Designer::DestroyObject(oClass.instance);
             delete oClass.instance;
          }
+         if(oClass.i18nStrings)
+         {
+            Map<String, bool> i18nStrings = oClass.i18nStrings;
+            delete i18nStrings;
+         }
          sheet.DeleteObject(oClass);
          delete oClass.name;
          classes.Delete(oClass);
@@ -2093,7 +2202,7 @@ class CodeEditor : Window
          ProjectView projectView = ide.projectView;
          if(projectView)
          {
-            ProjectNode node = projectView.GetNodeFromWindow(this, null, false, false);
+            ProjectNode node = projectView.GetNodeFromWindow(this, null, true, false, null);
             if(node && node.modified)
             {
                node.modified = false;
@@ -2186,7 +2295,7 @@ class CodeEditor : Window
       return true;
    }
 
-   bool OnSaveFile(char * fileName)
+   bool OnSaveFile(const char * fileName)
    {
       File f;
       if(designer)
@@ -2205,6 +2314,7 @@ class CodeEditor : Window
             designer.fileName = fileName;
             designer.modifiedDocument = false;
          }
+
          editBox.Save(f, false);
          modifiedDocument = false;
 
@@ -2214,7 +2324,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)
@@ -2305,7 +2415,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;
@@ -2315,7 +2425,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)
          {
@@ -2324,8 +2434,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;
                }
@@ -2367,7 +2475,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;
@@ -2427,7 +2535,7 @@ class CodeEditor : Window
       return true;
    }
 
-   bool LoadFile(char * filePath)
+   bool LoadFile(const char * filePath)
    {
       File f = FileOpen(filePath, read);
       if(f)
@@ -2470,7 +2578,11 @@ class CodeEditor : Window
    CodeEditor()
    {
       CodeObjectType c;
-      ProjectView projectView = ide.projectView;
+
+      globalData.classes.CompareKey = (void *)BinaryTree::CompareString;
+      globalData.defines.CompareKey = (void *)BinaryTree::CompareString;
+      globalData.functions.CompareKey = (void *)BinaryTree::CompareString;
+      globalData.nameSpaces.CompareKey = (void *)BinaryTree::CompareString;
 
       /*if(fileName)
          designer.fileName = fileName;
@@ -2514,6 +2626,7 @@ class CodeEditor : Window
    ****************************************************************************/
    void FreeParser()
    {
+      SetCurrentNameSpace(null);
       if(ast != null)
       {
          FreeASTTree(ast);
@@ -2561,7 +2674,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 { };
@@ -2675,13 +2788,18 @@ class CodeEditor : Window
 
             next = _class.next;
 
-            for(;object = _class.instances.first;)
+            while((object = _class.instances.first))
             {
                if(object.instance)
                {
                   Designer::DestroyObject(object.instance);
                   delete object.instance;
                }
+               if(object.i18nStrings)
+               {
+                  Map<String, bool> i18nStrings = object.i18nStrings;
+                  delete i18nStrings;
+               }
                sheet.DeleteObject(object);
                delete object.name;
                _class.instances.Delete(object);
@@ -2691,6 +2809,11 @@ class CodeEditor : Window
                Designer::DestroyObject(_class.instance);
                delete _class.instance;
             }
+            if(_class.i18nStrings)
+            {
+               Map<String, bool> i18nStrings = _class.i18nStrings;
+               delete i18nStrings;
+            }
             sheet.DeleteObject(_class);
             delete _class.name;
             classes.Delete(_class);
@@ -2807,7 +2930,7 @@ class CodeEditor : Window
       }
       else
       {
-         switch(GetRuntimePlatform())
+         switch(__runtimePlatform)
          {
             case win32: SetSymbolsDir("obj/debug.win32"); break;
             case tux:   SetSymbolsDir("obj/debug.linux"); break;
@@ -2998,7 +3121,6 @@ class CodeEditor : Window
                            classDefinition = _class;
                            oClass = classObject;
                         };
-                        Symbol symbol;
                         classes.Add(classObject);
 
                         incref instance;
@@ -3031,76 +3153,72 @@ class CodeEditor : Window
                                                 propertyClass = prop.dataTypeClass = eSystem_FindClass(this.privateModule, prop.dataTypeString);
                                              if(prop.compiled && prop.Set && prop.Get && propertyClass && propDef.initializer && propDef.initializer.type == expInitializer && propDef.initializer.exp)
                                              {
+                                                Expression computed;
+                                                bool variable = true;
+
                                                 FreeType(propDef.initializer.exp.destType);
                                                 propDef.initializer.exp.destType = MkClassType(propertyClass.name);
                                                 ProcessExpressionType(propDef.initializer.exp);
 
-                                                if(propertyClass.type == structClass || propertyClass.type == noHeadClass || propertyClass.type == normalClass)
+                                                computed = CopyExpression(propDef.initializer.exp);
+                                                ComputeExpression(computed);
+                                                if(computed.isConstant)
                                                 {
-                                                   Expression computed = CopyExpression(propDef.initializer.exp);
-                                                   ComputeExpression(computed);
-
-                                                   if(computed.isConstant && computed.type == instanceExp && !id.next)
+                                                   switch(computed.type)
                                                    {
-                                                      if(prop.Set)
-                                                      {
-                                                         if(computed.instance._class && computed.instance._class.symbol &&
-                                                            computed.instance._class.symbol.registered &&
-                                                            eClass_IsDerived(computed.instance._class.symbol.registered, propertyClass))
+                                                      case stringExp:
+                                                         if(propertyClass.dataTypeString && strstr(propertyClass.dataTypeString, "char *"))
                                                          {
-                                                            ((void (*)(void *, void *))(void *)prop.Set)(instance, computed.instance.data);
+                                                            String temp = new char[strlen(computed.string)+1];
+                                                            ReadString(temp, computed.string);
+                                                            ((void (*)(void *, void *))(void *)prop.Set)(instance, temp);
+                                                            delete temp;
 
-                                                            // This was saved in the control and shouldn't be freed by FreeExpression...
-                                                            // (Not doing this anymore, incrementing refCount in pass15 instead)
-                                                            /*if(propertyClass.type == normalClass)
-                                                               computed.instance.data = null;*/
+                                                            if(!propDef.initializer.exp.intlString)
+                                                            {
+                                                               Map<String, bool> i18nStrings = classObject.i18nStrings;
+                                                               if(!i18nStrings)
+                                                                  classObject.i18nStrings = i18nStrings = { };
+                                                               i18nStrings[prop.name] = false;
+                                                            }
+                                                            variable = false;
                                                          }
-                                                      }
-                                                   }
-                                                   // MOVED THIS UP NOW THAT char * IS A NORMAL CLASS
-                                                   else if(computed.type == stringExp && propertyClass.dataTypeString && strstr(propertyClass.dataTypeString, "char *"))
-                                                   {
-                                                      String temp = new char[strlen(computed.string)+1];
-                                                      ReadString(temp, computed.string);
-                                                      ((void (*)(void *, void *))(void *)prop.Set)(instance, temp);
-                                                      delete temp;
-                                                   }
-                                                   else
-                                                      propDef.variable = true;
-
-                                                   FreeExpression(computed);
-                                                }
-                                                else
-                                                {
-                                                   Expression computed = CopyExpression(propDef.initializer.exp);
-                                                   ComputeExpression(computed);
-                                                   if(computed.isConstant)
-                                                   {
-                                                      //if(computed.type == memberExp) computed = computed.member.exp;
+                                                         break;
+                                                      case instanceExp:
+                                                         if((propertyClass.type == structClass || propertyClass.type == noHeadClass || propertyClass.type == normalClass) && !id.next)
+                                                         {
+                                                            if(prop.Set)
+                                                            {
+                                                               if(computed.instance._class && computed.instance._class.symbol &&
+                                                                  computed.instance._class.symbol.registered &&
+                                                                  eClass_IsDerived(computed.instance._class.symbol.registered, propertyClass))
+                                                               {
+                                                                  ((void (*)(void *, void *))(void *)prop.Set)(instance, computed.instance.data);
 
-                                                      if(computed.type == constantExp)
+                                                                  // This was saved in the control and shouldn't be freed by FreeExpression...
+                                                                  // (Not doing this anymore, incrementing refCount in pass15 instead)
+                                                                  /*if(propertyClass.type == normalClass)
+                                                                     computed.instance.data = null;*/
+                                                               }
+                                                            }
+                                                            variable = false;
+                                                         }
+                                                         break;
+                                                      case constantExp:
                                                       {
                                                          Operand value = GetOperand(computed);
                                                          DataValue valueData;
                                                          valueData.i64 = value.i64;
                                                          SetProperty(prop, instance, valueData);
-                                                      }
-                                                      else if(computed.type == stringExp && propertyClass.dataTypeString && strstr(propertyClass.dataTypeString, "char *"))
-                                                      {
-                                                         String temp = new char[strlen(computed.string)+1];
-                                                         ReadString(temp, computed.string);
-                                                         ((void (*)(void *, void *))(void *)prop.Set)(instance, temp);
-                                                         delete temp;
+                                                         variable = false;
+                                                         break;
                                                       }
                                                    }
-                                                   else
-                                                      propDef.variable = true;
-
-                                                   FreeExpression(computed);
                                                 }
+                                                if(variable)
+                                                   propDef.variable = true;
+                                                FreeExpression(computed);
                                              }
-                                             else
-                                                propDef.variable = true;
                                           }
                                           else
                                           {
@@ -3236,6 +3354,7 @@ class CodeEditor : Window
                                                                {
                                                                   Property prop = (Property) curMember;
                                                                   Class propertyClass = prop.dataTypeClass;
+                                                                  bool variable = false;
                                                                   if(!propertyClass)
                                                                      propertyClass = prop.dataTypeClass = eSystem_FindClass(this.privateModule, prop.dataTypeString);
 
@@ -3245,75 +3364,53 @@ class CodeEditor : Window
                                                                      member.initializer.exp.destType = MkClassType(propertyClass.name);
                                                                      if(propertyClass)
                                                                      {
+                                                                        Expression computed;
+
                                                                         ProcessExpressionType(member.initializer.exp);
 
-                                                                        if(propertyClass.type == structClass || propertyClass.type == normalClass || propertyClass.type == noHeadClass)
+                                                                        computed = CopyExpression(member.initializer.exp);
+                                                                        if(computed)
                                                                         {
-                                                                           Expression computed;
+                                                                           bool isClass = propertyClass.type == structClass || propertyClass.type == normalClass || propertyClass.type == noHeadClass;
+                                                                           {
 #ifdef _DEBUG
-                                                                           /*char debugExpString[4096];
-                                                                           debugExpString[0] = '\0';
-                                                                           PrintExpression(member.initializer.exp, debugExpString);*/
+                                                                              /*char debugExpString[4096];
+                                                                              debugExpString[0] = '\0';
+                                                                              PrintExpression(member.initializer.exp, debugExpString);*/
 #endif
-                                                                           computed = CopyExpression(member.initializer.exp);
-                                                                           if(computed)
-                                                                           {
                                                                               ComputeExpression(computed);
 
-                                                                              if(computed.type == instanceExp && computed.isConstant && computed.isConstant)
+                                                                              switch(computed.type)
                                                                               {
-                                                                                 if(computed.instance.data)
-                                                                                 {
-                                                                                    if(computed.instance._class && computed.instance._class.symbol &&
-                                                                                       computed.instance._class.symbol.registered &&
-                                                                                       eClass_IsDerived(computed.instance._class.symbol.registered, propertyClass))
+                                                                                 case instanceExp:
+                                                                                    if(isClass && computed.isConstant && computed.instance.data)
                                                                                     {
-                                                                                       ((void (*)(void *, void *))(void *)prop.Set)(control, computed.instance.data);
-
-                                                                                       // This was saved in the control and shouldn't be freed by FreeExpression...
-                                                                                       // (Not doing this anymore, incrementing refCount in pass15 instead)
-                                                                                       /*if(propertyClass.type == normalClass)
-                                                                                          computed.instance.data = null;*/
-                                                                                    }
-                                                                                 }
-                                                                              }
-                                                                              else if(computed.type == identifierExp)
-                                                                              {
-                                                                                 member.variable = true;
+                                                                                       if(computed.instance._class && computed.instance._class.symbol &&
+                                                                                          computed.instance._class.symbol.registered &&
+                                                                                          eClass_IsDerived(computed.instance._class.symbol.registered, propertyClass))
+                                                                                       {
+                                                                                          ((void (*)(void *, void *))(void *)prop.Set)(control, computed.instance.data);
 
-                                                                                 if(eClass_GetDesigner(propertyClass))
-                                                                                 //if(prop.Set)
-                                                                                 {
-                                                                                    char * name = computed.identifier.string;
-                                                                                    if(!strcmp(name, "this"))
-                                                                                    {
-                                                                                       if(prop.Set)
-                                                                                          ((void (*)(void *, void *))(void *)prop.Set)(control, instance);
-                                                                                       member.variable = false;
-                                                                                    }
-                                                                                    else
-                                                                                    {
-                                                                                       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);
-                                                                                             member.variable = false;
-                                                                                             break;
-                                                                                          }
+                                                                                          // This was saved in the control and shouldn't be freed by FreeExpression...
+                                                                                          // (Not doing this anymore, incrementing refCount in pass15 instead)
+                                                                                          /*if(propertyClass.type == normalClass)
+                                                                                             computed.instance.data = null;*/
+                                                                                       }
+                                                                                       variable = false;
                                                                                     }
-                                                                                 }
-                                                                              }
-                                                                              else if(computed.type == memberExp)
-                                                                              {
-                                                                                 member.variable = true;
-                                                                                 if(computed.member.exp.type == identifierExp)
-                                                                                 {
-                                                                                    char * name = computed.member.exp.identifier.string;
-                                                                                    if(!strcmp(name, "this"))
+                                                                                    break;
+                                                                                 case identifierExp:
+                                                                                    if(isClass && eClass_GetDesigner(propertyClass))
+                                                                                    //if(prop.Set)
                                                                                     {
-                                                                                       char * name = computed.member.member.string;
+                                                                                       char * name = computed.identifier.string;
+                                                                                       if(!strcmp(name, "this"))
+                                                                                       {
+                                                                                          if(prop.Set)
+                                                                                             ((void (*)(void *, void *))(void *)prop.Set)(control, instance);
+                                                                                          variable = false;
+                                                                                       }
+                                                                                       else
                                                                                        {
                                                                                           ObjectInfo check;
                                                                                           for(check = classObject.instances.first; check; check = check.next)
@@ -3321,80 +3418,91 @@ class CodeEditor : Window
                                                                                              {
                                                                                                 if(prop.Set)
                                                                                                    ((void (*)(void *, void *))(void *)prop.Set)(control, check.instance);
-                                                                                                member.variable = false;
+                                                                                                variable = false;
                                                                                                 break;
                                                                                              }
                                                                                        }
                                                                                     }
-                                                                                    else
+                                                                                    break;
+                                                                                 case memberExp:
+                                                                                    if(isClass)
                                                                                     {
-                                                                                       ObjectInfo check;
-                                                                                       for(check = classObject.instances.first; check; check = check.next)
+                                                                                       if(computed.member.exp.type == identifierExp)
                                                                                        {
-                                                                                          if(check.name && !strcmp(name, check.name))
+                                                                                          char * name = computed.member.exp.identifier.string;
+                                                                                          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;
+                                                                                                }
+                                                                                          }
+                                                                                          else
                                                                                           {
-                                                                                             Property getProperty = eClass_FindProperty(check.instance._class, computed.member.member.string, this.privateModule);
-                                                                                             if(getProperty)
+                                                                                             for(check = classObject.instances.first; check; check = check.next)
                                                                                              {
-                                                                                                DataValue value { };
-                                                                                                GetProperty(getProperty, check.instance, &value);
-                                                                                                SetProperty(prop, control, value);
-                                                                                                member.variable = false;
+                                                                                                if(check.name && !strcmp(name, check.name))
+                                                                                                {
+                                                                                                   Property getProperty = eClass_FindProperty(check.instance._class, computed.member.member.string, this.privateModule);
+                                                                                                   if(getProperty)
+                                                                                                   {
+                                                                                                      DataValue value { };
+                                                                                                      GetProperty(getProperty, check.instance, &value);
+                                                                                                      SetProperty(prop, control, value);
+                                                                                                      variable = false;
+                                                                                                   }
+                                                                                                   break;
+                                                                                                }
                                                                                              }
-                                                                                             break;
                                                                                           }
                                                                                        }
                                                                                     }
-                                                                                 }
-                                                                              }
-                                                                              // MOVED THIS UP NOW THAT char * IS A NORMAL CLASS
-                                                                              else if(computed.isConstant && computed.type == stringExp && propertyClass.dataTypeString && strstr(propertyClass.dataTypeString, "char *"))
-                                                                              {
-                                                                                 String temp = new char[strlen(computed.string)+1];
-                                                                                 ReadString(temp, computed.string);
-                                                                                 ((void (*)(void *, void *))(void *)prop.Set)(control, temp);
-                                                                                 delete temp;
-                                                                              }
-                                                                              else
-                                                                                 member.variable = true;
+                                                                                    break;
+                                                                                 case stringExp:
+                                                                                    if(propertyClass.dataTypeString && strstr(propertyClass.dataTypeString, "char *"))
+                                                                                    {
+                                                                                       String temp = new char[strlen(computed.string)+1];
+                                                                                       ReadString(temp, computed.string);
+                                                                                       ((void (*)(void *, void *))(void *)prop.Set)(control, temp);
+                                                                                       delete temp;
 
-                                                                              FreeExpression(computed);
-                                                                           }
-                                                                        }
-                                                                        else
-                                                                        {
-                                                                           Expression computed = CopyExpression(member.initializer.exp);
-                                                                           if(computed)
-                                                                           {
-                                                                              ComputeExpression(computed);
-                                                                              if(computed.isConstant)
-                                                                              {
-                                                                                 if(computed.type == constantExp && (!propertyClass.dataTypeString || strcmp(propertyClass.dataTypeString, "char *"))) //(strcmp(propertyClass.name, "char *") && (strcmp(propertyClass.name, "String"))))
-                                                                                 {
-                                                                                    if(!strcmp(propertyClass.dataTypeString, "float"))
-                                                                                       ((void (*)(void *, float))(void *)prop.Set)(control, (float)strtod(computed.constant, null));
-                                                                                    else if(!strcmp(propertyClass.dataTypeString, "double"))
-                                                                                       ((void (*)(void *, double))(void *)prop.Set)(control, strtod(computed.constant, null));
-                                                                                    else
-                                                                                       ((void (*)(void *, int))(void *)prop.Set)(control, strtol(computed.constant, null, 0));
-                                                                                 }
-                                                                                 else if(computed.type == stringExp  && propertyClass.dataTypeString && strstr(propertyClass.dataTypeString, "char *"))
-                                                                                 {
-                                                                                    String temp = new char[strlen(computed.string)+1];
-                                                                                    ReadString(temp, computed.string);
-                                                                                    ((void (*)(void *, void *))(void *)prop.Set)(control, temp);
-                                                                                    delete temp;
-                                                                                 }
-                                                                              }
-                                                                              else
-                                                                                 member.variable = true;
+                                                                                       if(!member.initializer.exp.intlString)
+                                                                                       {
+                                                                                          Map<String, bool> i18nStrings = object.i18nStrings;
+                                                                                          if(!i18nStrings)
+                                                                                             object.i18nStrings = i18nStrings = { };
+                                                                                          i18nStrings[prop.name] = false;
+                                                                                       }
 
-                                                                              FreeExpression(computed);
+                                                                                       variable = false;
+                                                                                    }
+                                                                                    break;
+                                                                                 case constantExp:
+                                                                                    if(!isClass && computed.isConstant)
+                                                                                    {
+                                                                                       if(!strcmp(propertyClass.dataTypeString, "float"))
+                                                                                          ((void (*)(void *, float))(void *)prop.Set)(control, (float)strtod(computed.constant, null));
+                                                                                       else if(!strcmp(propertyClass.dataTypeString, "double"))
+                                                                                          ((void (*)(void *, double))(void *)prop.Set)(control, strtod(computed.constant, null));
+                                                                                       else
+                                                                                          ((void (*)(void *, int))(void *)prop.Set)(control, strtol(computed.constant, null, 0));
+                                                                                       variable = false;
+                                                                                    }
+                                                                                    break;
+                                                                              }
                                                                            }
                                                                         }
+                                                                        FreeExpression(computed);
                                                                      }
                                                                   }
-                                                                  else
+                                                                  if(variable)
                                                                      member.variable = true;
                                                                }
                                                                else if(ident && member.initializer && member.initializer.type == expInitializer && member.initializer.exp &&
@@ -3479,7 +3587,6 @@ class CodeEditor : Window
          if(selectedName)
          {
             ObjectInfo check;
-            int pos = 0;
 
             for(check = this.oClass.instances.first; check; check = check.next)
             {
@@ -3593,7 +3700,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(", ");
@@ -3622,14 +3729,32 @@ class CodeEditor : Window
                   else if(dataType.type == normalClass || dataType.type == noHeadClass)
                   {
                      void * dataForm, * dataTest;
+                     bool isEditBoxContents = false;
+                     bool freeDataForm = false, freeDataTest = false;
 
-                     dataForm = ((void *(*)(void *))(void *)prop.Get)(control);
-                     dataTest = ((void *(*)(void *))(void *)prop.Get)(test);
+                     // Because contents property is broken for mutiline EditBox at the moment
+                     if(!strcmp(prop.name, "contents") && !strcmp(prop._class.name, "EditBox"))
+                        isEditBoxContents = true;
+
+                     if(isEditBoxContents && ((EditBox)control).multiLine)
+                     {
+                        dataForm = ((EditBox)control).multiLineContents;
+                        freeDataForm = true;
+                     }
+                     else
+                        dataForm = ((void *(*)(void *))(void *)prop.Get)(control);
+                     if(isEditBoxContents && ((EditBox)test).multiLine)
+                     {
+                        dataTest = ((EditBox)test).multiLineContents;
+                        freeDataTest = true;
+                     }
+                     else
+                        dataTest = ((void *(*)(void *))(void *)prop.Get)(test);
 
                      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(", ");
 
@@ -3678,7 +3803,12 @@ class CodeEditor : Window
 
                            if(!strcmp(dataType.dataTypeString, "char *"))
                            {
-                              f.Printf("\"");
+                              Map<String, bool> i18nStrings = object.i18nStrings;
+                              bool i18n = true;
+                              if(i18nStrings && i18nStrings.GetAtPosition(prop.name, false))
+                                 i18n = false;
+
+                              f.Printf("%s\"", i18n ? "$" : "");
                               OutputString(f, string);
                               f.Puts("\"");
                            }
@@ -3690,6 +3820,9 @@ class CodeEditor : Window
                         *prev = true;
                         *lastIsMethod = false;
                      }
+
+                     if(freeDataForm) delete dataForm;
+                     if(freeDataTest) delete dataTest;
                   }
                   else
                   {
@@ -3710,13 +3843,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;
@@ -3778,9 +3912,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)
       {
@@ -3862,9 +3994,10 @@ class CodeEditor : Window
                {
                   int count = 0;
                   int toDelete = 0;
-                  int toAdd = 0;
+                  //int toAdd = 0;
 
                   f.Seek(-1, current);
+                  DeleteJunkBefore(f, position, &position);
                   f.Puts("\n   ");
                   f.Seek(1, current);
                   //f.Puts("\n");
@@ -3887,8 +4020,8 @@ class CodeEditor : Window
                            toDelete += count - 6;
                            count = 6;
                         }
-                        else
-                           toAdd = 6 - count;
+                        /*else
+                           toAdd = 6 - count;*/
                         break;
                      }
                   }
@@ -3898,20 +4031,25 @@ class CodeEditor : Window
                      f.DeleteBytes(toDelete);
                      f.Seek(count, current);
                   }
+
+                  DeleteJunkBefore(f, position, &position);
+
+                  // Removed this here as it was adding trailing spaces when adding a method
+                  /*
                   if(toAdd)
                   {
                      int c;
                      for(c = 0; c<toAdd; c++)
                         f.Putc(' ');
                   }
+                  */
                }
             }
             else
                methodPresent = multiLine;
 
-            if(!prev)
+            //if(!prev) -- always false
                f.Printf(methodPresent ? "\n      " : " ");
-
          }
       }
       else
@@ -3968,7 +4106,7 @@ class CodeEditor : Window
          DeleteJunkBefore(f, position, &position);
 
          // Instance already there, clear out the properties
-         for(members = inst.members->first; members; members = members.next)
+         for(members = inst.members ? inst.members->first : null; members; members = members.next)
          {
             if(members.type == dataMembersInit)
             {
@@ -4032,7 +4170,6 @@ class CodeEditor : Window
                   if(!keptMember || !members.next)
                   {
                      char ch = 0;
-                     int count = 0;
 
                      if(keptMember && lastKept != members.dataMembers->last)
                      {
@@ -4283,12 +4420,7 @@ class CodeEditor : Window
       }
 
       if(!object.instCode)
-      {
-         if(methodPresent)
-            f.Printf("   %c;\n", CloseBracket);
-         else
-            f.Printf("%c;\n", CloseBracket);
-      }
+         f.Printf(methodPresent ? "   %c;" : "%c;", CloseBracket);
       else if(!object.deleted)
       {
          // Turn this into a multiline instance when adding a method
@@ -4355,9 +4487,27 @@ class CodeEditor : Window
                else if(dataType && (dataType.type == normalClass || dataType.type == noHeadClass))
                {
                   void * dataForm, * dataTest;
+                  bool isEditBoxContents = false;
+                  bool freeDataForm = false, freeDataTest = false;
+
+                  // Because contents property is broken for mutiline EditBox at the moment
+                  if(!strcmp(prop.name, "contents") && !strcmp(prop._class.name, "EditBox"))
+                     isEditBoxContents = true;
 
-                  dataForm = ((void *(*)(void *))(void *)prop.Get)(classObject.instance);
-                  dataTest = ((void *(*)(void *))(void *)prop.Get)(test);
+                  if(isEditBoxContents && ((EditBox)classObject.instance).multiLine)
+                  {
+                     dataForm = ((EditBox)classObject.instance).multiLineContents;
+                     freeDataForm = true;
+                  }
+                  else
+                     dataForm = ((void *(*)(void *))(void *)prop.Get)(classObject.instance);
+                  if(isEditBoxContents && ((EditBox)test).multiLine)
+                  {
+                     dataTest = ((EditBox)test).multiLineContents;
+                     freeDataTest = true;
+                  }
+                  else
+                     dataTest = ((void *(*)(void *))(void *)prop.Get)(test);
 
                   if(((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, dataForm, dataTest))
                   {
@@ -4378,7 +4528,12 @@ class CodeEditor : Window
 
                         if(!strcmp(dataType.dataTypeString, "char *"))
                         {
-                           f.Printf("\n   %s%s = \"", specify ? "property::" : "", prop.name);
+                           Map<String, bool> i18nStrings = classObject.i18nStrings;
+                           bool i18n = true;
+                           if(i18nStrings && i18nStrings.GetAtPosition(prop.name, false))
+                              i18n = false;
+
+                           f.Printf("\n   %s%s = %s\"", specify ? "property::" : "", prop.name, i18n ? "$" : "");
                            OutputString(f, string);
                            f.Puts("\";");
                         }
@@ -4388,6 +4543,8 @@ class CodeEditor : Window
                            f.Printf("\n   %s%s = %s;", specify ? "property::" : "", prop.name, string);
                      }
                   }
+                  if(freeDataForm) delete dataForm;
+                  if(freeDataTest) delete dataTest;
                }
                else if(dataType)
                {
@@ -4413,13 +4570,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;
@@ -4462,6 +4620,8 @@ class CodeEditor : Window
 
           updatingCode++;
 
+         editBox.recordUndoEvent = true;
+
          if(moveAttached)
          {
             movedFuncId = GetDeclId(function.declarator);
@@ -4471,7 +4631,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;
@@ -4541,7 +4700,9 @@ class CodeEditor : Window
 
                      lastIsDecl = false;
                      DeleteJunkBefore(f, def.loc.start.pos, &position);
-                     f.Printf("\n   ");
+
+                     // This was adding blank spaces between comment and properties -- What was it for?
+                     // f.Printf("\n   ");
 
                      for(propDef = def.defProperties->first; propDef; propDef = propDef.next)
                      {
@@ -4588,7 +4749,6 @@ class CodeEditor : Window
                      if(!keptMember)
                      {
                         char ch = 0;
-                        int count = 0;
                         f.Seek(def.loc.end.pos - position - 1, current);
                         f.Getc(&ch);
 
@@ -4878,6 +5038,8 @@ class CodeEditor : Window
             delete test;
          }
 
+         editBox.recordUndoEvent = false;
+
          updatingCode--;
          delete f;
 
@@ -4897,7 +5059,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;
@@ -5048,7 +5210,7 @@ class CodeEditor : Window
       return found;
    }
 
-   void GoToMethod(char * methodName /*Method method*/)
+   void GoToMethod(const char * methodName /*Method method*/)
    {
       if(methodName)
       {
@@ -5484,7 +5646,7 @@ class CodeEditor : Window
          sheet.DeleteObject(object);
    }
 
-   void RenameObject(ObjectInfo object, char * name)
+   void RenameObject(ObjectInfo object, const char * name)
    {
       bool valid = false;
 
@@ -5677,8 +5839,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)
          {
@@ -5689,7 +5849,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)
@@ -5709,14 +5869,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)
@@ -5786,8 +5945,6 @@ class CodeEditor : Window
    {
       if(type && (type.kind == classType || type.kind == structType || type.kind == unionType))
       {
-         Class _class;
-
          if(type.kind == classType)
          {
             if(type._class)
@@ -5843,14 +6000,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];
       }
@@ -5880,7 +6037,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);
@@ -5905,7 +6062,7 @@ class CodeEditor : Window
       return result;
    }
 
-   void ListNameSpaceByString(Module mainModule, char * string)
+   void ListNameSpaceByString(Module mainModule, const char * string)
    {
       NameSpace * nameSpace;
       Module module;
@@ -5940,7 +6097,7 @@ class CodeEditor : Window
             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;
@@ -5956,7 +6113,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;
@@ -5984,7 +6141,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;
@@ -6026,7 +6183,9 @@ class CodeEditor : Window
          }
       }
 
-      if(this.privateModule && destType && (destType.kind != pointerType || destType.type.kind != voidType) && destType.kind != ellipsisType)
+      if(this.privateModule && destType && (destType.kind == _BoolType || destType.kind == classType || destType.kind == enumType || destType.kind == structType || destType.kind == templateType || destType.kind == thisClassType || destType.kind == unionType ||
+         (destType.kind == pointerType && destType.type.kind != voidType)))
+      //if(this.privateModule && destType && (destType.kind != pointerType || destType.type.kind != voidType) && destType.kind != ellipsisType)
       {
          listedEnums = ListEnumsModule(this.privateModule, destType);
       }
@@ -6042,7 +6201,7 @@ class CodeEditor : Window
       }
       else if(destType && destType.kind == enumType)
       {
-         NamedLink value;
+         NamedLink64 value;
 
          for(value = destType.members.first; value; value = value.next)
          {
@@ -6196,7 +6355,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;
 
@@ -6304,7 +6463,6 @@ class CodeEditor : Window
    {
       bool didOverride = false;
       EditLine line = editBox.line;
-      char * text = line.text;
       int lineNum, charPos;
       Expression exp = null;
       EditLine l1, l2;
@@ -6410,7 +6568,7 @@ class CodeEditor : Window
 
          if(membersListShown)
          {
-            char * buffer = membersLine.text;
+            const char * buffer = membersLine.text;
             int c;
             bool firstChar = true;
             int len = 0;
@@ -6451,7 +6609,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--)
                {
@@ -6576,7 +6734,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;
@@ -6681,10 +6839,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;