cleaned all trailing white space from source files.
[sdk] / ide / src / designer / CodeEditor.ec
index ea1a4a6..a283f58 100644 (file)
@@ -91,7 +91,7 @@ static Array<FileType> fileTypes
    { $"Text Files", "txt", never }
 ] };
 
-static char * iconNames[] = 
+static char * iconNames[] =
 {
    "<:ecere>constructs/class.png",
    "<:ecere>constructs/data.png",
@@ -117,6 +117,14 @@ extern int __ecereVMethodID_class_OnCopy;
 extern int __ecereVMethodID_class_OnSaveEdit;
 extern int __ecereVMethodID___ecereNameSpace__ecere__com__Module_OnLoad;
 
+class RTCMenuBits
+{
+public:
+   bool ignoreBreakpoints:1;
+   bool atSameLevel:1;
+   bool oldImplementation:1;
+};
+
 class EditFileDialog : FileDialog
 {
    bool OnCreate()
@@ -146,10 +154,10 @@ define CloseBracket = '}';
 
 enum MethodAction
 {
-   actionAddMethod = 1, 
-   actionDeleteMethod = 2, 
-   actionDetachMethod = 3, 
-   actionAttachMethod = 4, 
+   actionAddMethod = 1,
+   actionDeleteMethod = 2,
+   actionDetachMethod = 3,
+   actionAttachMethod = 4,
    actionReattachMethod = 5
 };
 
@@ -190,7 +198,7 @@ static void OutputString(File f, char * string)
          f.Puts("\\\\");
       else
          f.Putc(string[c]);
-   }                              
+   }
 }
 
 void OutputType(File f, Type type, bool outputName)
@@ -229,9 +237,26 @@ void OutputType(File f, Type type, bool outputName)
             f.Printf("double");
             break;
          case classType:
-            // ADD CODE TO DECIDE WHETHER TO OUTPUT FULLY QUAlIFIED OR NOT:
-            f.Printf(type._class.shortName ? type._class.shortName : type._class.string);
+         {
+            if(type._class && !strcmp(type._class.string, "class"))
+            {
+               switch(type.classObjectType)
+               {
+                  case anyObject:
+                     f.Printf("any_object");
+                     break;
+                  default:
+                     f.Printf("typed_object");
+                     break;
+               }
+               if(type.byReference)
+                  f.Printf(" &");
+            }
+            else
+               // ADD CODE TO DECIDE WHETHER TO OUTPUT FULLY QUAlIFIED OR NOT:
+               f.Printf(type._class.shortName ? type._class.shortName : type._class.string);
             break;
+         }
          case structType:
             break;
          case unionType:
@@ -274,10 +299,10 @@ void DeleteJunkBefore(EditBoxStream f, int pos, int * position)
 {
    char ch;
    int before = 0;
-   
+
    if(position)
       f.Seek(pos - *position, current);
-                                                      
+
    // Try to delete spaces and \n before...
    f.Seek(-1, current);
    for(;f.Getc(&ch);)
@@ -329,7 +354,7 @@ void GetLocText(EditBox editBox, File f, int position, Location loc, char ** tex
    editBox.GetSelPos(&l1, &y1, &x1, &l2, &y2, &x2, false);
 
    // Cut & Paste function
-   
+
    {
       EditLine l1, l2;
       int y1,x1,y2,x2;
@@ -348,7 +373,7 @@ void GetLocText(EditBox editBox, File f, int position, Location loc, char ** tex
       *text = new char[*size+1 + (y2-y1+1) * linePad + pad]; // Add pad for tabs and new name
       editBox.GetSel(*text, false);
    }
-   
+
    editBox.SetSelPos(l1, y1, x1, l2, y2, x2);
    f.Printf(""); // Make the stream point to where the editbox is
 }
@@ -372,13 +397,13 @@ bool Code_IsPropertyModified(Instance test, ObjectInfo selected, Property prop)
       {
          void * dataForm = new0 byte[dataType.structSize];
          void * dataTest = new0 byte[dataType.structSize];
-   
-         prop.Get(selected.instance, dataForm);
-         prop.Get(test, dataTest);
 
-         if((prop.IsSet && !prop.IsSet(test)) || dataType._vTbl[__ecereVMethodID_class_OnCompare](dataType, dataForm, dataTest))
+         ((void (*)(void *, void *))(void *)prop.Get)(selected.instance, dataForm);
+         ((void (*)(void *, void *))(void *)prop.Get)(test, dataTest);
+
+         if((prop.IsSet && !prop.IsSet(test)) || ((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, dataForm, dataTest))
          {
-            prop.Set(test, dataForm);
+            ((void (*)(void *, void *))(void *)prop.Set)(test, dataForm);
             result = true;
          }
          delete dataForm;
@@ -387,24 +412,24 @@ bool Code_IsPropertyModified(Instance test, ObjectInfo selected, Property prop)
       else if(dataType && dataType._vTbl && (dataType.type == normalClass || dataType.type == noHeadClass))
       {
          void * dataForm, * dataTest;
-   
-         dataForm = (void *)prop.Get(selected.instance);
-         dataTest = (void *)prop.Get(test);
-   
-         if((prop.IsSet && !prop.IsSet(test)) || dataType._vTbl[__ecereVMethodID_class_OnCompare](dataType, dataForm, dataTest))
+
+         dataForm = ((void *(*)(void *))(void *)prop.Get)(selected.instance);
+         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))
          {
-            prop.Set(test, dataForm);
+            ((void (*)(void *, void *))(void *)prop.Set)(test, dataForm);
             result = true;
          }
       }
       else if(dataType && dataType._vTbl)
       {
          DataValue dataForm, dataTest;
-   
+
          GetProperty(prop, selected.instance, &dataForm);
          GetProperty(prop, test, &dataTest);
-   
-         if((prop.IsSet && !prop.IsSet(test)) || dataType._vTbl[__ecereVMethodID_class_OnCompare](dataType, &dataForm, &dataTest))
+
+         if((prop.IsSet && !prop.IsSet(test)) || ((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, &dataForm, &dataTest))
          {
             SetProperty(prop, test, dataForm);
 
@@ -412,11 +437,11 @@ bool Code_IsPropertyModified(Instance test, ObjectInfo selected, Property prop)
             if(strcmp(prop.name, "name"))
             {
                GetProperty(prop, selected.instance, &dataTest);
-               if(dataType._vTbl[__ecereVMethodID_class_OnCompare](dataType, &dataForm, &dataTest))
+               if(((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, &dataForm, &dataTest))
                   SetProperty(prop, selected.instance, dataForm);
             }
             result = true;
-         }                                          
+         }
       }
    }
    return result;
@@ -427,7 +452,7 @@ bool Code_IsPropertyDisabled(ObjectInfo selected, char * name)
    bool disabled = false;
    if(selected.oClass == selected)
    {
-      ClassDef def;                  
+      ClassDef def;
       if(selected.classDefinition)
       {
          for(def = selected.classDefinition.definitions->first; def; def = def.next)
@@ -484,7 +509,7 @@ bool Code_IsPropertyDisabled(ObjectInfo selected, char * name)
 
 static bool CheckCompatibleMethod(Method method, Type type, Class regClass, bool isForm, Symbol selectedClass)
 {
-   bool result = false;   
+   bool result = false;
    bool reset = false;
    if(!method.dataType)
       method.dataType = ProcessTypeString(method.dataTypeString, false);
@@ -517,7 +542,7 @@ bool Code_IsFunctionEmpty(ClassFunction function, Method method, ObjectInfo obje
          method.dataType = ProcessTypeString(method.dataTypeString, false);
 
       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
       {
@@ -544,7 +569,7 @@ bool Code_IsFunctionEmpty(ClassFunction function, Method method, ObjectInfo obje
          else
          {
             if(stmt)
-               confirmation = true;        
+               confirmation = true;
          }
       }
       else
@@ -561,7 +586,7 @@ bool Code_IsFunctionEmpty(ClassFunction function, Method method, ObjectInfo obje
          }
 
          if(!exp || exp.type != callExp || exp.call.exp.type != identifierExp)
-            confirmation = true;        
+            confirmation = true;
          else
          {
             Identifier id = exp.call.exp.identifier;
@@ -587,7 +612,7 @@ bool Code_IsFunctionEmpty(ClassFunction function, Method method, ObjectInfo obje
                      arg = arg ?arg.next : null;
                   }
                }
-            }                  
+            }
          }
       }
    }
@@ -605,8 +630,8 @@ class CodeEditor : Window
    isActiveClient = true;
    anchor = Anchor { left = 300, right = 150, top = 0, bottom = 0 };
    menu = Menu { };
-   
-   // eWindow_SetX(A_CASCADE); eWindow_SetY(A_CASCADE); 
+
+   // eWindow_SetX(A_CASCADE); eWindow_SetY(A_CASCADE);
    // eWindow_SetWidth(A_RELATIVE|80); eWindow_SetHeight(A_RELATIVE|80);
 
    SheetType sheetSelected;
@@ -623,7 +648,7 @@ class CodeEditor : Window
    OldList classes;
    bool codeModified;
    bool formModified;
-   
+
    ObjectInfo selected;
    ObjectInfo oClass;
 
@@ -651,7 +676,7 @@ class CodeEditor : Window
    bool expectingMove;
 
    BitmapResource icons[CodeObjectType];
-   
+
    FontResource boldFont { $"Tahoma", 8.25f, bold = true, window = this };
    FontResource normalFont { $"Tahoma", 8.25f, window = this };
 
@@ -666,6 +691,11 @@ class CodeEditor : Window
 
    Designer designer { codeEditor = this, visible = false, saveDialog = codeEditorFormFileDialog };
 
+   bool noParsing;
+   int maxLineNumberLength;
+
+   property bool parsing { get { return editBox.syntaxHighlighting && !noParsing && !ide.noParsing; } };
+
    void ProcessCaretMove(EditBox editBox, int line, int charPos)
    {
       char temp[512];
@@ -678,7 +708,7 @@ class CodeEditor : Window
          ide.pos.text = temp;
       }
       if(sheet.codeEditor != this) return;
-      
+
       if(!updatingCode)
       {
          for(classItem = classes.first; classItem; classItem = classItem.next)
@@ -769,7 +799,7 @@ class CodeEditor : Window
       ProjectView projectView = ide.projectView;
       if(projectView)
       {
-         ProjectNode node = projectView.GetNodeFromWindow(this, null);
+         ProjectNode node = projectView.GetNodeFromWindow(this, null, true, false);
          if(node)
          {
             node.modified = modifiedDocument;
@@ -782,9 +812,9 @@ class CodeEditor : Window
    EditBox editBox
    {
       textVertScroll = true, multiLine = true, /*lineNumbers = ideSettings.showLineNumbers,*/
-      freeCaret = ideSettings.useFreeCaret, caretFollowsScrolling = ideSettings.caretFollowsScrolling, 
+      freeCaret = ideSettings.useFreeCaret, caretFollowsScrolling = ideSettings.caretFollowsScrolling,
       tabKey = true, smartHome = true;
-      tabSelection = true, maxLineSize = 65536, parent = this, hasHorzScroll = true, hasVertScroll = true;
+      tabSelection = true, /*maxLineSize = 65536, */parent = this, hasHorzScroll = true, hasVertScroll = true;
       selectionColor = selectionColor, selectionText = selectionText,
       background = codeEditorBG, foreground = codeEditorFG, syntaxColorScheme = colorScheme,
       font = font, borderStyle = none;
@@ -869,6 +899,7 @@ class CodeEditor : Window
                */
             }
             Update({ 0, 0, editBox.position.x, clientSize.h });
+            UpdateMarginSize();
          }
 
          if(!updatingCode)
@@ -922,7 +953,7 @@ class CodeEditor : Window
                            hide = true;
                            break;
                         }
-                        if(!isSpace) 
+                        if(!isSpace)
                            firstChar = false;
                         else if(firstChar)
                         {
@@ -1013,14 +1044,14 @@ class CodeEditor : Window
 
                      editBox.GetCaretPosition(&caret);
 
-                     
+
 
                      // Go back in the buffer until no space before
                      //yydebug = true;
                      codeModified = true;
                      EnsureUpToDate();
                      SetYydebug(false);
-                     { 
+                     {
                         EditBoxStream f { editBox = editBox };
                         oldCharPos = x1;
                         x1--;
@@ -1090,7 +1121,7 @@ class CodeEditor : Window
 
                               membersList.position = { x, y };
                            }
-         
+
                            membersLine = l1;
                            membersLoc.start.line = line - 1;
                            membersLoc.start.charPos = oldCharPos;
@@ -1130,13 +1161,13 @@ class CodeEditor : Window
                   }
                   else if(ch == ')' || ch == '}' || ch == ';')
                   {
-                     codeModified = true;               
+                     codeModified = true;
                      skipModified = true;
                      if(paramsShown)
                         InvokeParameters(false, true, false);
                      skipModified = false;
                   }
-                  else 
+                  else
                   {
                      bool back = codeModified;
                      codeModified = false;
@@ -1172,6 +1203,7 @@ class CodeEditor : Window
             if(projectView && fileName)
                ide.debugger.MoveIcons(fileName, before.y + 1, before.y - after.y, before.x == 0);
             Update({ 0, 0, editBox.position.x, clientSize.h });
+            UpdateMarginSize();
          }
 
          if(!updatingCode)
@@ -1188,7 +1220,7 @@ class CodeEditor : Window
                   {
                      loc = &object.instCode.loc;
 
-                     if((before.y+1 < loc->start.line || (before.y+1 == loc->start.line && before.x+1 <= loc->start.charPos)) && 
+                     if((before.y+1 < loc->start.line || (before.y+1 == loc->start.line && before.x+1 <= loc->start.charPos)) &&
                         (after.y+1 > loc->end.line    || (after.y+1 == loc->end.line && after.x+1 >= loc->end.charPos)))
                      {
                         object.instCode = null;
@@ -1203,7 +1235,7 @@ class CodeEditor : Window
                if(oClass.classDefinition)
                {
                   loc = &oClass.classDefinition.loc;
-                  if((before.y+1 < loc->start.line || (before.y+1 == loc->start.line && before.x+1 <= loc->start.charPos)) && 
+                  if((before.y+1 < loc->start.line || (before.y+1 == loc->start.line && before.x+1 <= loc->start.charPos)) &&
                      (after.y+1 > loc->end.line    || (after.y+1 == loc->end.line && after.x+1 >= loc->end.charPos)))
                   {
                      oClass.classDefinition = null;
@@ -1346,7 +1378,7 @@ class CodeEditor : Window
                designer.DroppedObject(control, object, false, classObject.instance);
 
                sheet.AddObject(object, object.name, typeData /* className*/, true);
-               
+
                UpdateFormCode();
                //codeModified = true;
                EnsureUpToDate();
@@ -1357,7 +1389,7 @@ class CodeEditor : Window
 
       bool NotifyKeyDown(EditBox editBox, Key key, unichar ch)
       {
-         if(key == Key { space, ctrl = true })
+         if(key == ctrlSpace)
          {
             membersList.Destroy(0);
             membersListShown = false;
@@ -1372,13 +1404,15 @@ class CodeEditor : Window
          {
             if(ide.projectView)
             {
-               ProjectNode node = ide.projectView.GetNodeFromWindow(this, null);
+               ProjectNode node = ide.projectView.GetNodeFromWindow(this, null, true, false);
+               if(!node)
+                  node = ide.projectView.GetNodeFromWindow(this, null, true, true);
                if(!node)
                {
                   char * s;
-                  s = PrintString($"The ", fileName, $" file is not part of any project.\n", 
+                  s = PrintString($"The ", fileName, $" file is not part of any project.\n",
                      $"It can't be compiled.");
-                  MessageBox { type = ok, parent = ide, master = ide, text = $"File not in project error", contents = s }.Modal();
+                  MessageBox { type = ok, /*parent = ide, */master = ide, text = $"File not in project error", contents = s }.Modal();
                   delete s;
                   return false;
                }
@@ -1470,41 +1504,52 @@ class CodeEditor : Window
       bool OnKeyDown(Key key, unichar ch)
       {
          CodeEditor editor = (CodeEditor) master;
-         if(key == escape || key == leftAlt || key == rightAlt || 
-            (key.ctrl && key.code != left && key.code != right && 
+         if(key == escape || key == leftAlt || key == rightAlt ||
+            (key.ctrl && key.code != left && key.code != right &&
              key.code != leftShift && key.code != rightShift && key.code != space))
          {
+            bool result = true;
             if(editor.paramsShown)
+            {
+               if(key == escape)
+                  result = false;
                editor.paramsList.Destroy(0);
+               editor.paramsShown = false;
+            }
             if(editor.membersListShown)
+            {
+               if(key == escape)
+                  result = false;
                editor.membersList.Destroy(0);
+               editor.membersListShown = false;
+            }
 
-            editor.paramsShown = false;
             FreeType(editor.functionType);
-            FreeType(editor.instanceType);
-
             editor.functionType = null;
+
+            FreeType(editor.instanceType);
             editor.instanceType = null;
+
             editor.paramsID = -1;
 
-            editor.membersListShown = false;
-            return true;
+            return result;
          }
-         else 
+         else
             return editor.editBox.OnKeyDown(key, ch);
          return false;
       }
 
-      bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
+      /*bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
       {
          CodeEditor editor = (CodeEditor)master;
-         if(!active)
+         Window rw = previous ? previous.rootWindow : null;
+         if(!active && rw != editor.paramsList)
          {
             Destroy(0);
             editor.membersListShown = false;
          }
          return ListBox::OnActivate(active, previous, goOnWithActivation, direct);
-      }
+      }*/
 
       bool OnKeyHit(Key key, unichar ch)
       {
@@ -1560,26 +1605,27 @@ class CodeEditor : Window
 
    Window paramsList
    {
-      master = this, 
+      master = this,
       interim = true,
       clickThrough = true,
       autoCreate = false,
       borderStyle = contour,
       cursor = null,
       background = { 255,255,225 },
-      
+
       OnKeyDown = membersList.OnKeyDown;
 
-      bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
+      /*bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
       {
          CodeEditor editor = (CodeEditor)master;
-         if(!active)
+         Window rw = previous ? previous.rootWindow : null;
+         if(!active && previous != editor.editBox && rw != editor.membersList)
          {
             Destroy(0);
-            editor.membersListShown = false;
+            editor.paramsShown = false;
          }
          return Window::OnActivate(active, previous, goOnWithActivation, direct);
-      }
+      }*/
 
       bool OnKeyHit(Key key, unichar ch)
       {
@@ -1645,7 +1691,7 @@ class CodeEditor : Window
                display.FontExtent(boldFont, instanceName, strlen(instanceName), &nameW, null);
             totalW = functionW + nameW;
             surface.TextFont(boldFont);
-         }   
+         }
 
          surface.WriteText(x, y, string, strlen(string));
          x += functionW + spaceW;
@@ -1658,13 +1704,13 @@ class CodeEditor : Window
             surface.WriteText(x, y, "(", 1);
             x += parW;
 
-            if(methodType && !methodType.staticMethod)
+            if(methodType && !methodType.staticMethod && methodType.methodClass)
             {
                int tw = 0, width;
 
                if(id == editor.paramsID)
                   surface.TextFont(boldFont);
-               
+
                if(methodType.methodClass)
                   surface.TextExtent(methodType.methodClass.name, strlen(methodType.methodClass.name), &tw, null);
 
@@ -1693,7 +1739,7 @@ class CodeEditor : Window
                {
                   surface.WriteText(x, y, ",", 1);
                   x += ((id ==  editor.paramsID) ? commaWB : commaW);
-               }      
+               }
 
                lineW += width;
 
@@ -1705,7 +1751,7 @@ class CodeEditor : Window
                id ++;
             }
 
-            if(!methodType || methodType.staticMethod || !type.params.first || ((Type)type.params.first).kind != voidType || type.params.count > 1)
+            if(!methodType || (methodType.staticMethod || !methodType.methodClass) || !type.params.first || ((Type)type.params.first).kind != voidType || type.params.count > 1)
             {
                for(param = type.params.first; param; param = param.next)
                {
@@ -1739,7 +1785,7 @@ class CodeEditor : Window
                   {
                      surface.WriteText(x, y, ",", 1);
                      x += ((id ==  editor.paramsID) ? commaWB : commaW);
-                  }      
+                  }
 
                   lineW += width;
 
@@ -1811,7 +1857,7 @@ class CodeEditor : Window
                display.FontExtent(boldFont, instanceName, strlen(instanceName), &nameW, null);
             totalW = functionW + nameW + spaceW;
          }
-            
+
          if(editor.functionType)
          {
             if(methodType)
@@ -1849,7 +1895,7 @@ class CodeEditor : Window
                   paramString[0] = 0;
                   PrintType(param, paramString, true, true);
                   display.FontExtent((id == editor.paramsID || param.kind == ellipsisType) ? boldFont : font, paramString, strlen(paramString), &width, null);
-                  if(param.next) 
+                  if(param.next)
                      width += ((id == editor.paramsID) ? commaWB : commaW);
 
                   if(!height)
@@ -1878,48 +1924,40 @@ class CodeEditor : Window
       }
    };
 
-   Menu fileMenu { menu, $"File", f };  // MenuPlacement?
+   Menu fileMenu { menu, $"File", f };
    MenuItem { fileMenu, $"Save", s, Key { s, ctrl = true }, NotifySelect = MenuFileSave };
    MenuItem { fileMenu, $"Save As...", a, NotifySelect = MenuFileSaveAs };
 
-   Menu debugMenu { menu, $"Debug", d };  // MenuPlacement?
-   MenuItem debugRunToCursor
-   {
-      debugMenu, $"Run To Cursor", c, Key { f10, ctrl = true };
-      bool NotifySelect(MenuItem selection, Modifiers mods)
-      {
-         ProjectView projectView = ide.projectView;
-         if(!projectView.buildInProgress)
-         {
-            int line = editBox.lineNumber + 1;
-            if(projectView)
-            {
-               CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
-               ProjectConfig config = projectView.project.config;
-               ide.debugger.RunToCursor(compiler, config, fileName, line, false);
-               delete compiler;
-            }
-         }
-         return true;
-      }
-   };
-   MenuItem debugSkipRunToCursor
+   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; };
+   MenuItem debugRunToCursorAtSameLevel     { debugMenu, $"Run To Cursor At Same Level", l, altF10,                                                     id = RTCMenuBits { false, true,  false }, NotifySelect = RTCMenu_NotifySelect; };
+   MenuItem debugSkipRunToCursorAtSameLevel { debugMenu, $"Run To Cursor At Same Level Skipping Breakpoints", g, Key { f10, shift = true, alt = true }, id = RTCMenuBits { true,  true,  false }, NotifySelect = RTCMenu_NotifySelect; };
+#if 0
+   MenuItem debugBpRunToCursor                { debugMenu, $"BP Run To Cursor"/*, c, ctrlF10*/,                                                                  id = RTCMenuBits { false, false, true  }, NotifySelect = RTCMenu_NotifySelect; };
+   MenuItem debugBpSkipRunToCursor            { debugMenu, $"BP Run To Cursor Skipping Breakpoints"/*, u, Key { f10, ctrl = true, shift = true }*/,              id = RTCMenuBits { true,  false, true  }, NotifySelect = RTCMenu_NotifySelect; };
+   MenuItem debugBpRunToCursorAtSameLevel     { debugMenu, $"BP Run To Cursor At Same Level"/*, l, altF10*/,                                                     id = RTCMenuBits { false, true,  true  }, NotifySelect = RTCMenu_NotifySelect; };
+   MenuItem debugBpSkipRunToCursorAtSameLevel { debugMenu, $"BP Run To Cursor At Same Level Skipping Breakpoints"/*, g, Key { f10, shift = true, alt = true }*/, id = RTCMenuBits { true,  true,  true  }, NotifySelect = RTCMenu_NotifySelect; };
+#endif
+   bool RTCMenu_NotifySelect(MenuItem selection, Modifiers mods)
    {
-      debugMenu, $"Run To Cursor Skipping Breakpoints", u, Key { f10, ctrl = true, shift = true };
-      bool NotifySelect(MenuItem selection, Modifiers mods)
+      ProjectView projectView = ide.projectView;
+      if(!projectView.buildInProgress)
       {
-         ProjectView projectView = ide.projectView;
+         RTCMenuBits bits = (RTCMenuBits)selection.id;
          int line = editBox.lineNumber + 1;
          if(projectView)
          {
             CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
             ProjectConfig config = projectView.project.config;
-            ide.debugger.RunToCursor(compiler, config, fileName, line, true);
+            int bitDepth = ide.workspace.bitDepth;
+            bool useValgrind = ide.workspace.useValgrind;
+            ide.debugger.RunToCursor(compiler, config, bitDepth, useValgrind, fileName, line, bits.ignoreBreakpoints, bits.atSameLevel, bits.oldImplementation);
             delete compiler;
          }
-         return true;
       }
-   };
+      return true;
+   }
    MenuDivider { debugMenu };
    MenuItem debugToggleBreakpoint
    {
@@ -1930,33 +1968,7 @@ class CodeEditor : Window
          if(projectView && fileName)
          {
             int line = editBox.lineNumber + 1;
-            char name[MAX_LOCATION];
-            Project prj = null;
-            // TOFIX: This only looks at the filename...
-            GetLastDirectory(fileName, name);
-            if(ide && ide.workspace)
-            {
-               for(p : ide.workspace.projects)
-               {
-                  if(p.topNode.Find(name, false))
-                  {
-                     prj = p;
-                     break;
-                  }
-               }
-               if(!prj)
-               {
-                  for(p : ide.workspace.projects)
-                  {
-                     if(IsPathInsideOf(fileName, p.topNode.path))
-                     {
-                        prj = p;
-                        break;
-                     }
-                  }
-               }
-            }
-            ide.debugger.ToggleBreakpoint(fileName, line, prj);
+            ide.debugger.ToggleBreakpoint(fileName, line);
             Update(null);
          }
          return true;
@@ -1995,7 +2007,8 @@ class CodeEditor : Window
             if(CloseConfirmation(false))
             {
                visible = false;
-               OnFileModified({ modified = true }, null);
+               if(modifiedDocument)
+                  OnFileModified({ modified = true }, null);
             }
             debugClosing = false;
             return false;
@@ -2037,7 +2050,7 @@ class CodeEditor : Window
       for(oClass = (classes).first, next = oClass ? oClass.next : null; oClass; oClass = next, next = next ? (next.next) : null)
       {
          ObjectInfo object, next;
-         
+
          for(object = oClass.instances.first; object; object = next)
          {
             next = object.next;
@@ -2077,7 +2090,7 @@ class CodeEditor : Window
          ProjectView projectView = ide.projectView;
          if(projectView)
          {
-            ProjectNode node = projectView.GetNodeFromWindow(this, null);
+            ProjectNode node = projectView.GetNodeFromWindow(this, null, false, false);
             if(node && node.modified)
             {
                node.modified = false;
@@ -2096,6 +2109,7 @@ class CodeEditor : Window
       */
       if(active && directActivation)
       {
+         AdjustDebugMenus();
          if(openedFileInfo)
             openedFileInfo.Activate();
          if(designer)
@@ -2147,6 +2161,25 @@ class CodeEditor : Window
             ProcessCaretMove(editBox, line, charPos);
          }
       }
+      if(!active)
+      {
+         if(membersListShown)
+         {
+            membersList.Destroy(0);
+            membersListShown = false;
+         }
+         if(paramsShown)
+         {
+            paramsList.Destroy(0);
+            paramsShown = false;
+            FreeType(functionType);
+            FreeType(instanceType);
+
+            functionType = null;
+            instanceType = null;
+            paramsID = -1;
+         }
+      }
       return true;
    }
 
@@ -2171,8 +2204,8 @@ class CodeEditor : Window
          }
          editBox.Save(f, false);
          modifiedDocument = false;
-         
-         delete(f);
+
+         delete f;
          return true;
       }
       return false;
@@ -2182,7 +2215,7 @@ class CodeEditor : Window
    {
       bool reload = false;
       if(visible == false && inUseDebug == true)
-         reload = true;
+         ide.debugger.WatchesReleaseCodeEditor();
       else
       {
          char message[2048];
@@ -2225,7 +2258,7 @@ class CodeEditor : Window
             }
             modifiedDocument = false;
 
-            delete(f);
+            delete f;
          }
       }
       return true;
@@ -2240,6 +2273,7 @@ class CodeEditor : Window
       {
          int currentLineNumber;
          int i;
+         char lineFormat[16];
          char lineText[256];
          int spaceH;
 
@@ -2247,6 +2281,7 @@ class CodeEditor : Window
          surface.font = font.font;
          surface.TextExtent(" ", 1, null, &spaceH);
          currentLineNumber = editBox.scroll.y / spaceH + 1;
+         sprintf(lineFormat, " %%%du", maxLineNumberLength);
 
          surface.SetForeground(lineNumbersColor);
          for(i = 0; i < editBox.clientSize.h - 4; i += spaceH)
@@ -2258,10 +2293,9 @@ class CodeEditor : Window
                surface.Area(0, i, editBox.anchor.left.distance, i+spaceH-1);
                surface.SetBackground(marginColor);
             }
-            sprintf(lineText,"%5u ", currentLineNumber % 100000);
+            sprintf(lineText, lineFormat, currentLineNumber);
             if(currentLineNumber <= editBox.numLines)
-               surface.WriteText(editBox.syntaxHighlighting * 20, i+1,lineText,6);
-            
+               surface.WriteText(editBox.syntaxHighlighting * 20, i+1,lineText,maxLineNumberLength+1);
             currentLineNumber++;
          }
       }
@@ -2294,7 +2328,7 @@ class CodeEditor : Window
                }
                else
                   bmpRes = breakpointEnabled[i] ? ide.bmpBp : ide.bmpBpDisabled;
-               
+
                DrawLineMarginIcon(surface, bmpRes, breakpointLines[i], lineH, scrollY, boxH);
             }
          }
@@ -2339,37 +2373,48 @@ class CodeEditor : Window
       if(fileName)
       {
          GetExtension(fileName, ext);
-         if(!strcmpi(ext, "ec"))
+
+         if(!strcmpi(ext, "ec") || !strcmpi(ext, "eh") || !strcmpi(ext, "c") || !strcmpi(ext, "h") || !strcmpi(ext, "cpp") ||
+               !strcmpi(ext, "hpp") || !strcmpi(ext, "cxx") || !strcmpi(ext, "hxx") || !strcmpi(ext, "cc") || !strcmpi(ext, "hh") ||
+               !strcmpi(ext, "m") || !strcmpi(ext, "mm") || !strcmpi(ext, "cs") || !strcmpi(ext, "java") || !strcmpi(ext, "y") || !strcmpi(ext, "l"))
+            editBox.syntaxHighlighting = true;
+         else
+            editBox.syntaxHighlighting = false;
+
+         if(parsing && !strcmpi(ext, "ec"))
          {
             codeModified = true;
             EnsureUpToDate();
          }
 
-         if(!strcmpi(ext, "ec") || !strcmpi(ext, "c") || !strcmpi(ext, "cc") || !strcmpi(ext, "cpp") || !strcmpi(ext, "eh") || !strcmpi(ext, "hh") || !strcmpi(ext, "hpp") || !strcmpi(ext, "h") || !strcmpi(ext, "hxx") || !strcmpi(ext, "cxx"))
-            editBox.syntaxHighlighting = true;
-         else
-            editBox.syntaxHighlighting = false;
+         UpdateMarginSize();
+      }
+   };
+
+   bool UpdateMarginSize()
+   {
+      static int lineCount = -1;
+      if(editBox.numLines != lineCount)
+      {
+         int digitWidth;
+         lineCount = editBox.numLines;
+         if(nofdigits(lineCount) != maxLineNumberLength)
          {
-            int spaceW;
-            display.FontExtent(font.font, " ", 1, &spaceW, null);
+            maxLineNumberLength = nofdigits(lineCount);
+            display.FontExtent(font.font, "0", 1, &digitWidth, null);
             editBox.anchor = Anchor
             {
-               left = (editBox.syntaxHighlighting ? 20 : 0) + (ideSettings.showLineNumbers ? (6 * spaceW) : 0),
+               left = editBox.syntaxHighlighting * 20 + (ideSettings.showLineNumbers ? ((maxLineNumberLength+2) * digitWidth) : 0),
                right = 0, top = 0, bottom = 0
             };
          }
       }
-   };
+      return true;
+   }
 
    bool OnPostCreate()
    {
-      int spaceW;
-      display.FontExtent(font.font, " ", 1, &spaceW, null);
-      editBox.anchor = Anchor
-      {
-         left = (editBox.syntaxHighlighting ? 20 : 0) + (ideSettings.showLineNumbers ? (6 * spaceW) : 0),
-         right = 0, top = 0, bottom = 0
-      };
+      UpdateMarginSize();
       return true;
    }
 
@@ -2378,7 +2423,7 @@ class CodeEditor : Window
       File f = FileOpen(filePath, read);
       if(f)
       {
-         // Added this here... 
+         // Added this here...
          fileName = filePath;
          loadingFile = true;
          updatingCode = true;
@@ -2387,18 +2432,30 @@ class CodeEditor : Window
          loadingFile = false;
          Create();
 
-         delete(f);
+         delete f;
          return true;
       }
       return false;
    }
 
-   void DebugMenusDisabled()
+   void AdjustDebugMenus()
    {
-      bool debugMenusDisabled = ide.GetDebugMenusDisabled();
-      debugRunToCursor.disabled = debugMenusDisabled;
-      debugSkipRunToCursor.disabled = debugMenusDisabled;
-      debugToggleBreakpoint.disabled = debugMenusDisabled;
+      bool unavailable = ide.areDebugMenusUnavailable;
+      bool isNotNotRunning    = unavailable || ide.isDebuggerRunning;
+      bool isNotStopped       = unavailable || !ide.isDebuggerStopped;
+      bool noBreakpointToggle = ide.isBreakpointTogglingUnavailable;
+
+      debugRunToCursor.disabled                = isNotNotRunning;
+      debugSkipRunToCursor.disabled            = isNotNotRunning;
+      debugRunToCursorAtSameLevel.disabled     = isNotStopped;
+      debugSkipRunToCursorAtSameLevel.disabled = isNotStopped;
+#if 0
+      debugBpRunToCursor.disabled                = isNotNotRunning;
+      debugBpSkipRunToCursor.disabled            = isNotNotRunning;
+      debugBpRunToCursorAtSameLevel.disabled     = isNotStopped;
+      debugBpSkipRunToCursorAtSameLevel.disabled = isNotStopped;
+#endif
+      debugToggleBreakpoint.disabled           = noBreakpointToggle;
    }
 
    CodeEditor()
@@ -2418,7 +2475,7 @@ class CodeEditor : Window
          designer.fileName = title;
       }
 
-      DebugMenusDisabled();
+      AdjustDebugMenus();
 
       for(c = 0; c < CodeObjectType::enumSize; c++)
          icons[c] = BitmapResource { iconNames[c], window = this };
@@ -2448,18 +2505,20 @@ class CodeEditor : Window
    ****************************************************************************/
    void FreeParser()
    {
-      this.defines.Free(FreeModuleDefine);
-      this.imports.Free(FreeModuleImport);
-      
       if(ast != null)
       {
          FreeASTTree(ast);
          ast = null;
       }
+      this.defines.Free(FreeModuleDefine);
+      this.imports.Free(FreeModuleImport);   // Moved this after FreeAST because Debug printing causes ModuleImports to be created
+
       FreeExcludedSymbols(this.excludedSymbols);
       FreeContext(this.globalContext);
       FreeIncludeFiles();
       FreeGlobalData(&this.globalData);
+      FindCtx_Terminate();
+      FindParams_Terminate();
 
       if(GetGlobalContext() == globalContext)
       {
@@ -2496,6 +2555,7 @@ class CodeEditor : Window
       char * fileName;
       ImportedModule module;
       char extension[MAX_EXTENSION];
+      PathBackup pathBackup { };
 #ifdef _TIMINGS
       Time parseCodeStart = GetTime();
       Time startTime, startFindClass;
@@ -2533,14 +2593,14 @@ class CodeEditor : Window
                }
             }
          }
-         else 
+         else
             selectedPos = -1;
       }
 
       editBox.GetSelPos(&l1, &y1, &x1, &l2, &y2, &x2, false);
 
-      defines.Free(FreeModuleDefine);
-      imports.Free(FreeModuleImport);
+      FindCtx_Terminate();
+      FindParams_Terminate();
 
       SetGlobalData(&globalData);
       SetGlobalContext(globalContext);
@@ -2580,6 +2640,8 @@ class CodeEditor : Window
 
       // TOCHECK: COULDN'T WE CALL FreeParser here?
       // Clear everything
+      FreeType(this.functionType);
+      FreeType(this.instanceType);
       this.functionType = null;
       this.instanceType = null;
 
@@ -2597,13 +2659,13 @@ class CodeEditor : Window
       if(this.oClass)
       {
          ObjectInfo _class, next;
-         
+
          for(_class = classes.first; _class; _class = next)
          {
             ObjectInfo object;
 
             next = _class.next;
-            
+
             for(;object = _class.instances.first;)
             {
                if(object.instance)
@@ -2645,6 +2707,8 @@ class CodeEditor : Window
          ast = null;
          //SetAST(null);
       }
+      defines.Free(FreeModuleDefine);
+      imports.Free(FreeModuleImport);
 
       FreeContext(this.globalContext);
       FreeExcludedSymbols(this.excludedSymbols);
@@ -2665,7 +2729,13 @@ class CodeEditor : Window
       printf("classes.count: %d\n", globalContext.classes.count);
 #endif
 
-      this.privateModule = __ecere_COM_Initialize(false, 1, null);
+      if(ide.workspace)
+      {
+         CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
+         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);
 
       SetPrivateModule(privateModule);
 
@@ -2698,7 +2768,7 @@ class CodeEditor : Window
       }
       if(!project)
          project = ide.project;
-         
+
       GetWorkingDir(oldWorkDir, MAX_LOCATION);
       if(project)
          ChangeWorkingDir(project.topNode.path);
@@ -2716,8 +2786,11 @@ class CodeEditor : Window
       {
          CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
          ProjectConfig config = project.config;
-         DirExpression objDir = project.GetObjDir(compiler, config);
+         int bitDepth = ide.workspace.bitDepth;
+         DirExpression objDir = project.GetObjDir(compiler, config, bitDepth);
          SetSymbolsDir(objDir.dir);
+         ide.SetPath(true, compiler, config, bitDepth);
+
          delete objDir;
          delete compiler;
          // SetIncludeDirs(ide.projectView.project.config.includeDirs);
@@ -2730,7 +2803,7 @@ class CodeEditor : Window
             case win32: SetSymbolsDir("obj/debug.win32"); break;
             case tux:   SetSymbolsDir("obj/debug.linux"); break;
             case apple: SetSymbolsDir("obj/debug.apple"); break;
-         }         
+         }
          SetIncludeDirs(null);
          SetSysIncludeDirs(null);
       }
@@ -2751,7 +2824,7 @@ class CodeEditor : Window
                }
             }
          }
-         
+
          if(!(strcmpi(mainModuleName, "instance.ec") && strcmpi(mainModuleName, "BinaryTree.ec") &&
             strcmpi(mainModuleName, "dataTypes.ec") && strcmpi(mainModuleName, "OldList.ec") &&
             strcmpi(mainModuleName, "String.ec") && strcmpi(mainModuleName, "BTNode.ec") &&
@@ -2775,7 +2848,7 @@ class CodeEditor : Window
 
             strcpy(symLocation, GetSymbolsDir());
             PathCat(symLocation, symFile);
-            
+
             // if(!GetEcereImported() && !GetBuildingEcereCom())
             if(!strcmp(extension, "ec") || !strcmp(extension, "eh"))
             {
@@ -2841,7 +2914,7 @@ class CodeEditor : Window
 
       SetIncludeDirs(null);
       SetSysIncludeDirs(null);
-      
+
       delete editFile;
       fileInput = null;
       SetFileInput(null);
@@ -2849,7 +2922,7 @@ class CodeEditor : Window
       if(GetAST())
       {
          ast = GetAST();
-         
+
 #ifdef _TIMINGS
          startTime = GetTime();
 #endif
@@ -2909,7 +2982,7 @@ class CodeEditor : Window
                      if(eClass_GetDesigner(regClass) && !GetBuildingEcereComModule())
                      {
                         Instance instance = eInstance_New(regClass);
-                        ObjectInfo classObject 
+                        ObjectInfo classObject
                         {
                            name = CopyString(_class._class.name);
                            instance = instance;
@@ -2952,7 +3025,7 @@ class CodeEditor : Window
                                                 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)
                                                 {
                                                    Expression computed = CopyExpression(propDef.initializer.exp);
@@ -2963,14 +3036,15 @@ class CodeEditor : Window
                                                       if(prop.Set)
                                                       {
                                                          if(computed.instance._class && computed.instance._class.symbol &&
-                                                            computed.instance._class.symbol.registered && 
+                                                            computed.instance._class.symbol.registered &&
                                                             eClass_IsDerived(computed.instance._class.symbol.registered, propertyClass))
                                                          {
-                                                            prop.Set(instance, computed.instance.data);
+                                                            ((void (*)(void *, void *))(void *)prop.Set)(instance, computed.instance.data);
 
                                                             // This was saved in the control and shouldn't be freed by FreeExpression...
-                                                            if(propertyClass.type == normalClass)
-                                                               computed.instance.data = null;
+                                                            // (Not doing this anymore, incrementing refCount in pass15 instead)
+                                                            /*if(propertyClass.type == normalClass)
+                                                               computed.instance.data = null;*/
                                                          }
                                                       }
                                                    }
@@ -2979,12 +3053,12 @@ class CodeEditor : Window
                                                    {
                                                       String temp = new char[strlen(computed.string)+1];
                                                       ReadString(temp, computed.string);
-                                                      prop.Set(instance, temp);
+                                                      ((void (*)(void *, void *))(void *)prop.Set)(instance, temp);
                                                       delete temp;
                                                    }
                                                    else
                                                       propDef.variable = true;
-                                                   
+
                                                    FreeExpression(computed);
                                                 }
                                                 else
@@ -3006,7 +3080,7 @@ class CodeEditor : Window
                                                       {
                                                          String temp = new char[strlen(computed.string)+1];
                                                          ReadString(temp, computed.string);
-                                                         prop.Set(instance, temp);
+                                                         ((void (*)(void *, void *))(void *)prop.Set)(instance, temp);
                                                          delete temp;
                                                       }
                                                    }
@@ -3022,7 +3096,7 @@ class CodeEditor : Window
                                           else
                                           {
                                              Method method = eClass_FindMethod(regClass, id.string, this.privateModule);
-                                             if(method && method.type == virtualMethod && propDef.initializer && propDef.initializer.type == expInitializer && 
+                                             if(method && method.type == virtualMethod && propDef.initializer && propDef.initializer.type == expInitializer &&
                                                 propDef.initializer.exp && propDef.initializer.exp.type == identifierExp)
                                              {
                                                 ClassDef def;
@@ -3038,7 +3112,7 @@ class CodeEditor : Window
                                                       }
                                                    }
                                                 }
-                                             }                                          
+                                             }
                                           }
                                        }
                                     }
@@ -3102,8 +3176,8 @@ class CodeEditor : Window
                                           {
                                              Instance control;
                                              object = object ? object.next : classObject.instances.first;
-                                             control = object.instance;                                             
-                                             
+                                             control = object.instance;
+
                                              if(inst.members)
                                              {
                                                 MembersInit members;
@@ -3139,7 +3213,7 @@ class CodeEditor : Window
                                                                   {
                                                                      curMember = thisMember;
                                                                      curClass = curMember._class;
-                                                                     memcpy(subMemberStack, _subMemberStack, sizeof(int) * _subMemberStackPos);
+                                                                     memcpy(subMemberStack, _subMemberStack, sizeof(DataMember) * _subMemberStackPos);
                                                                      subMemberStackPos = _subMemberStackPos;
                                                                      found = true;
                                                                   }
@@ -3163,7 +3237,7 @@ class CodeEditor : Window
                                                                      if(propertyClass)
                                                                      {
                                                                         ProcessExpressionType(member.initializer.exp);
-                                       
+
                                                                         if(propertyClass.type == structClass || propertyClass.type == normalClass || propertyClass.type == noHeadClass)
                                                                         {
                                                                            Expression computed;
@@ -3176,20 +3250,21 @@ class CodeEditor : Window
                                                                            if(computed)
                                                                            {
                                                                               ComputeExpression(computed);
-                                                                              
+
                                                                               if(computed.type == instanceExp && computed.isConstant && computed.isConstant)
                                                                               {
                                                                                  if(computed.instance.data)
                                                                                  {
                                                                                     if(computed.instance._class && computed.instance._class.symbol &&
-                                                                                       computed.instance._class.symbol.registered && 
+                                                                                       computed.instance._class.symbol.registered &&
                                                                                        eClass_IsDerived(computed.instance._class.symbol.registered, propertyClass))
                                                                                     {
-                                                                                       prop.Set(control, 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...
-                                                                                       if(propertyClass.type == normalClass)
-                                                                                          computed.instance.data = null;
+                                                                                       // (Not doing this anymore, incrementing refCount in pass15 instead)
+                                                                                       /*if(propertyClass.type == normalClass)
+                                                                                          computed.instance.data = null;*/
                                                                                     }
                                                                                  }
                                                                               }
@@ -3204,7 +3279,7 @@ class CodeEditor : Window
                                                                                     if(!strcmp(name, "this"))
                                                                                     {
                                                                                        if(prop.Set)
-                                                                                          prop.Set(control, instance);
+                                                                                          ((void (*)(void *, void *))(void *)prop.Set)(control, instance);
                                                                                        member.variable = false;
                                                                                     }
                                                                                     else
@@ -3214,7 +3289,7 @@ class CodeEditor : Window
                                                                                           if(check.name && !strcmp(name, check.name))
                                                                                           {
                                                                                              if(prop.Set)
-                                                                                                prop.Set(control, check.instance);
+                                                                                                ((void (*)(void *, void *))(void *)prop.Set)(control, check.instance);
                                                                                              member.variable = false;
                                                                                              break;
                                                                                           }
@@ -3236,7 +3311,7 @@ class CodeEditor : Window
                                                                                              if(check.name && !strcmp(name, check.name))
                                                                                              {
                                                                                                 if(prop.Set)
-                                                                                                   prop.Set(control, check.instance);
+                                                                                                   ((void (*)(void *, void *))(void *)prop.Set)(control, check.instance);
                                                                                                 member.variable = false;
                                                                                                 break;
                                                                                              }
@@ -3268,7 +3343,7 @@ class CodeEditor : Window
                                                                               {
                                                                                  String temp = new char[strlen(computed.string)+1];
                                                                                  ReadString(temp, computed.string);
-                                                                                 prop.Set(control, temp);
+                                                                                 ((void (*)(void *, void *))(void *)prop.Set)(control, temp);
                                                                                  delete temp;
                                                                               }
                                                                               else
@@ -3292,13 +3367,13 @@ class CodeEditor : Window
                                                                                     else if(!strcmp(propertyClass.dataTypeString, "double"))
                                                                                        ((void (*)(void *, double))(void *)prop.Set)(control, strtod(computed.constant, null));
                                                                                     else
-                                                                                       prop.Set(control, strtol(computed.constant, null, 0));
+                                                                                       ((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);
-                                                                                    prop.Set(control, temp);
+                                                                                    ((void (*)(void *, void *))(void *)prop.Set)(control, temp);
                                                                                     delete temp;
                                                                                  }
                                                                               }
@@ -3313,7 +3388,7 @@ class CodeEditor : Window
                                                                   else
                                                                      member.variable = true;
                                                                }
-                                                               else if(ident && member.initializer && member.initializer.type == expInitializer && member.initializer.exp && 
+                                                               else if(ident && member.initializer && member.initializer.type == expInitializer && member.initializer.exp &&
                                                                   member.initializer.exp.type == memberExp) // identifierExp
                                                                {
                                                                   Method method = eClass_FindMethod(instClass, ident.string, this.privateModule);
@@ -3342,7 +3417,7 @@ class CodeEditor : Window
                                                          break;
                                                       }
                                                    }
-                                                }                                          
+                                                }
                                              }
 
                                              designer.PostCreateObject(object.instance, object, false, classObject.instance);
@@ -3396,7 +3471,7 @@ class CodeEditor : Window
          {
             ObjectInfo check;
             int pos = 0;
-         
+
             for(check = this.oClass.instances.first; check; check = check.next)
             {
                if(check.name && !strcmp(check.name, selectedName))
@@ -3465,11 +3540,13 @@ class CodeEditor : Window
       printf("Total MkExternalImport time is %.3f seconds\n\n", externalImportTotalTime);
       printf("Total FindSymbol time is %.3f seconds\n\n", findSymbolTotalTime);
       // printf("Total Class Members Find time is %.3f seconds\n\n", GetClassFindTime());
-      
+
       printf("Whole ParseCode function took %.3f seconds\n\n", GetTime() - parseCodeStart);
 #endif
       if(inUseDebug && ide.projectView)
          ide.debugger.EvaluateWatches();
+
+      delete pathBackup;
    }
 
    void UpdateInstanceCodeClass(Class _class, ObjectInfo object, EditBoxStream f, Instance test, bool * prev, bool * lastIsMethod, DataMember * curMember, Class * curClass)
@@ -3488,34 +3565,34 @@ class CodeEditor : Window
          if(prop && prop.isProperty && !prop.conversion && eClass_FindProperty(object.instance._class, prop.name, privateModule))
          {
             if(prop.Set && prop.Get && prop.dataTypeString && strcmp(prop.name, "name") && !Code_IsPropertyDisabled(object, prop.name) &&
-               (!prop.IsSet || prop.IsSet(control)))
+               prop.compiled && (!prop.IsSet || prop.IsSet(control)))
             {
                Class dataType = prop.dataTypeClass;
                if(!dataType)
                   dataType = prop.dataTypeClass = eSystem_FindClass(this.privateModule, prop.dataTypeString);
-         
+
                if(dataType)
                {
                   if(dataType.type == structClass)
                   {
                      void * dataForm = new0 byte[dataType.structSize];
                      void * dataTest = new0 byte[dataType.structSize];
-               
-                     ((void (*)())(void *)prop.Get)(control, dataForm);
-                     prop.Get(test, dataTest);
-               
-                     if((prop.IsSet && !prop.IsSet(test)) || dataType._vTbl[__ecereVMethodID_class_OnCompare](dataType, dataForm, dataTest))
+
+                     ((void (*)(void *, void *))(void *)prop.Get)(control, dataForm);
+                     ((void (*)(void *, void *))(void *)prop.Get)(test, dataTest);
+
+                     if((prop.IsSet && !prop.IsSet(test)) || ((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, dataForm, dataTest))
                      {
                         char tempString[1024] = "";
                         char * string = "";
                         bool needClass = true;
                         if(*prev)
                            f.Printf(", ");
-                  
-                        prop.Set(test, dataForm);
-                  
-                        string = (char *)dataType._vTbl[__ecereVMethodID_class_OnGetString](dataType, dataForm, tempString, null, &needClass);
-                        
+
+                        ((void (*)(void *, void *))(void *)prop.Set)(test, dataForm);
+
+                        string = ((char * (*)(void *, void *, void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, dataForm, tempString, null, &needClass);
+
                         eClass_FindNextMember(_class, curClass, curMember, null, null);
                         if(*curMember != (DataMember)prop)
                            f.Printf("%s = ", prop.name);
@@ -3536,19 +3613,19 @@ class CodeEditor : Window
                   else if(dataType.type == normalClass || dataType.type == noHeadClass)
                   {
                      void * dataForm, * dataTest;
-               
-                     dataForm = (void *)prop.Get(control);
-                     dataTest = (void *)prop.Get(test);
-               
-                     if((prop.IsSet && !prop.IsSet(test)) || dataType._vTbl[__ecereVMethodID_class_OnCompare](dataType, dataForm, dataTest))
+
+                     dataForm = ((void *(*)(void *))(void *)prop.Get)(control);
+                     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 = "";
                         if(*prev)
                            f.Printf(", ");
-                  
-                        prop.Set(test, dataForm);
-                  
+
+                        ((void (*)(void *, void *))(void *)prop.Set)(test, dataForm);
+
                         eClass_FindNextMember(_class, curClass, curMember, null, null);
                         if(*curMember != (DataMember)prop)
                            f.Printf("%s = ", prop.name);
@@ -3579,7 +3656,7 @@ class CodeEditor : Window
                                  if(!object)
                                  {
                                     bool needClass = true;
-                                    string = (char *)dataType._vTbl[__ecereVMethodID_class_OnGetString](dataType, dataForm, tempString, null, &needClass);
+                                    string = ((char * (*)(void *, void *, void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, dataForm, tempString, null, &needClass);
                                     f.Printf("%s", string);
                                  }
                               }
@@ -3588,7 +3665,7 @@ class CodeEditor : Window
                         else
                         {
                            bool needClass = true;
-                           string = (char *)dataType._vTbl[__ecereVMethodID_class_OnGetString](dataType, dataForm, tempString, null, &needClass);
+                           string = ((char * (*)(void *, void *, void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, dataForm, tempString, null, &needClass);
 
                            if(!strcmp(dataType.dataTypeString, "char *"))
                            {
@@ -3608,16 +3685,16 @@ class CodeEditor : Window
                   else
                   {
                      DataValue dataForm, dataTest;
-               
+
                      GetProperty(prop, control, &dataForm);
                      GetProperty(prop, test, &dataTest);
-               
-                     if((prop.IsSet && !prop.IsSet(test)) || dataType._vTbl[__ecereVMethodID_class_OnCompare](dataType, &dataForm, &dataTest))
+
+                     if((prop.IsSet && !prop.IsSet(test)) || ((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, &dataForm, &dataTest))
                      {
                         char * string;
                         char tempString[1024] = "";
                         SetProperty(prop, test, dataForm);
-                  
+
                         if(dataType.type != bitClass)
                         {
                            bool needClass = true;
@@ -3638,8 +3715,8 @@ class CodeEditor : Window
                               }
                            }
                            else
-                              string = (char *)dataType._vTbl[__ecereVMethodID_class_OnGetString](dataType, &dataForm, tempString, null, &needClass);
-                     
+                              string = ((char * (*)(void *, void *, void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, &dataForm, tempString, null, &needClass);
+
                            if(string && string[0])
                            {
                               if(*prev)
@@ -3670,7 +3747,7 @@ class CodeEditor : Window
                            *curMember = (DataMember)prop;
                            *curClass = curMember->_class;
 
-                           string = (char *)dataType._vTbl[__ecereVMethodID_class_OnGetString](dataType, &dataForm.ui, tempString, null, &needClass);
+                           string = ((char * (*)(void *, void *, void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, &dataForm.ui, tempString, null, &needClass);
                            if(needClass)
                               f.Printf("%c %s %c", /*dataType.name, */OpenBracket, string, CloseBracket);
                            else
@@ -3695,7 +3772,7 @@ class CodeEditor : Window
       Class _class;
       bool lastIsMethod = true;
       ObjectInfo classObject = object.oClass;
-      
+
       if(inst)
       {
          if(object.deleted)
@@ -3737,7 +3814,7 @@ class CodeEditor : Window
                char ch;
                f.Seek(pos - position, current);
                while(f.Getc(&ch))
-               {  
+               {
                   if(isspace(ch))
                   {
                      f.Seek(-1, current);
@@ -3798,12 +3875,12 @@ class CodeEditor : Window
                         position--;
                         if(count > 6)
                         {
-                           toDelete += count - 6; 
+                           toDelete += count - 6;
                            count = 6;
                         }
-                        else 
+                        else
                            toAdd = 6 - count;
-                        break;                              
+                        break;
                      }
                   }
                   if(toDelete)
@@ -3828,7 +3905,7 @@ class CodeEditor : Window
 
          }
       }
-      else 
+      else
       {
          // Instance not there, create a brand new one
          DeleteJunkBefore(f, position, &position);
@@ -3880,7 +3957,7 @@ class CodeEditor : Window
          Class instClass = eSystem_FindClass(this.privateModule, inst._class.name);
 
          DeleteJunkBefore(f, position, &position);
-         
+
          // Instance already there, clear out the properties
          for(members = inst.members->first; members; members = members.next)
          {
@@ -3914,7 +3991,7 @@ class CodeEditor : Window
                            else
                            {
                               Method method = eClass_FindMethod(instClass, ident.string, this.privateModule);
-                              if(method && method.type == virtualMethod && member.initializer && member.initializer.type == expInitializer && member.initializer.exp && 
+                              if(method && method.type == virtualMethod && member.initializer && member.initializer.type == expInitializer && member.initializer.exp &&
                                  member.initializer.exp.type == memberExp /*ExpIdentifier*/)
                               {
                                  if(((this.methodAction == actionDetachMethod || this.methodAction == actionReattachMethod) && this.method == method && this.selected == object) ||
@@ -3925,7 +4002,7 @@ class CodeEditor : Window
                                     position = member.loc.end.pos;
                                     deleted = true;
                                  }
-                              }                                          
+                              }
                            }
                         }
                      }
@@ -3937,12 +4014,12 @@ class CodeEditor : Window
                         //f.Seek(member.loc.start.pos - position, current);
                         //position = member.loc.start.pos;
                         DeleteJunkBefore(f, member.loc.start.pos, &position);
-                        if(prev) f.Printf(", "); 
+                        if(prev) f.Printf(", ");
                         else if(keptMember) f.Printf(" ");
                         prev = false;
                      }
-                  } 
-               
+                  }
+
                   if(!keptMember || !members.next)
                   {
                      char ch = 0;
@@ -3974,7 +4051,7 @@ class CodeEditor : Window
 
                      f.Seek(members.loc.end.pos - position, current);
                      f.Getc(&ch);
-            
+
                      if(ch == ';')
                      {
                         f.Seek(-1, current);
@@ -4032,7 +4109,7 @@ class CodeEditor : Window
                      */
                      prev = true;
                      lastIsMethod = false;
-                     
+
                   }
                }
                else
@@ -4050,7 +4127,7 @@ class CodeEditor : Window
                   methodPresent = true;
 
                // Delete instance method here
-               if((this.methodAction == actionDeleteMethod || (this.methodAction == actionDetachMethod && this.moveAttached)) && 
+               if((this.methodAction == actionDeleteMethod || (this.methodAction == actionDetachMethod && this.moveAttached)) &&
                   members.function == function)
                {
                   if(this.moveAttached && !*text)
@@ -4069,7 +4146,7 @@ class CodeEditor : Window
 
                   DeleteJunkBefore(f, members.loc.start.pos, &position);
                   lastIsMethod = true;
-                  f.Printf("\n\n      ");               
+                  f.Printf("\n\n      ");
                }
 
                f.Seek(members.loc.end.pos - position, current);
@@ -4115,7 +4192,7 @@ class CodeEditor : Window
                   memmove(*text + movedFuncIdPos + newLen, *text + movedFuncIdPos + movedFuncIdLen, *textSize - movedFuncIdPos - movedFuncIdLen + 1);
                   *textSize += newLen - movedFuncIdLen;
                   memcpy(*text + movedFuncIdPos, method.name, newLen);
-                                          
+
                   // Second, tab right
                   {
                      int c;
@@ -4145,7 +4222,7 @@ class CodeEditor : Window
                   // ADDING METHOD HERE
                   f.Printf("\n      ");
                   OutputType(f, returnType, false);
-            
+
                   f.Printf(" ");
                   if(dataType.thisClass)
                   {
@@ -4166,7 +4243,7 @@ class CodeEditor : Window
                      if(param.next)
                         f.Printf(", ");
                   }
-                  f.Printf(")\n");                  
+                  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
@@ -4220,15 +4297,15 @@ class CodeEditor : Window
    {
       Property propIt;
       Class regClass = eSystem_FindClass(privateModule, classObject.name);
-     
+
       if(_class.base && _class.base.type != systemClass) OutputClassProperties(_class.base, classObject, f, test);
-      
+
       for(propIt = _class.membersAndProperties.first; propIt; propIt = propIt.next)
       {
          Property prop = eClass_FindProperty(selected.instance._class, propIt.name, privateModule);
          if(prop && prop.isProperty && !prop.conversion)
          {
-            if(prop.Set && prop.Get && prop.dataTypeString && strcmp(prop.name, "name") && !Code_IsPropertyDisabled(classObject, prop.name) && 
+            if(prop.Set && prop.Get && prop.dataTypeString && strcmp(prop.name, "name") && !Code_IsPropertyDisabled(classObject, prop.name) &&
                (!prop.IsSet || prop.IsSet(classObject.instance)))
             {
                Class dataType = prop.dataTypeClass;
@@ -4243,21 +4320,21 @@ class CodeEditor : Window
 
                if(!dataType)
                   dataType = prop.dataTypeClass = eSystem_FindClass(this.privateModule, prop.dataTypeString);
-            
+
                if(dataType && dataType.type == structClass)
                {
                   void * dataForm = new0 byte[dataType.structSize];
                   void * dataTest = new0 byte[dataType.structSize];
-               
-                  prop.Get(classObject.instance, dataForm);
-                  prop.Get(test, dataTest);
 
-                  if(dataType._vTbl[__ecereVMethodID_class_OnCompare](dataType, dataForm, dataTest))
+                  ((void (*)(void *, void *))(void *)prop.Get)(classObject.instance, dataForm);
+                  ((void (*)(void *, void *))(void *)prop.Get)(test, dataTest);
+
+                  if(((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, dataForm, dataTest))
                   {
                      bool needClass = true;
-                     
-                     string = (char *)dataType._vTbl[__ecereVMethodID_class_OnGetString](dataType, dataForm, tempString, null, &needClass);
-                     prop.Set(test, dataForm);
+
+                     string = ((char * (*)(void *, void *, void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, dataForm, tempString, null, &needClass);
+                     ((void (*)(void *, void *))(void *)prop.Set)(test, dataForm);
                      if(needClass)
                         f.Printf("\n   %s%s = %c %s %c;", specify ? "property::" : "", prop.name, /*dataType.name, */OpenBracket, string, CloseBracket);
                      else
@@ -4269,16 +4346,16 @@ class CodeEditor : Window
                else if(dataType && (dataType.type == normalClass || dataType.type == noHeadClass))
                {
                   void * dataForm, * dataTest;
-               
-                  dataForm = (void *)prop.Get(classObject.instance);
-                  dataTest = (void *)prop.Get(test);
-               
-                  if(dataType._vTbl[__ecereVMethodID_class_OnCompare](dataType, dataForm, dataTest))
+
+                  dataForm = ((void *(*)(void *))(void *)prop.Get)(classObject.instance);
+                  dataTest = ((void *(*)(void *))(void *)prop.Get)(test);
+
+                  if(((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, dataForm, dataTest))
                   {
                      char tempString[1024] = "";
                      char * string;
-                     prop.Set(test, dataForm);
-                  
+                     ((void (*)(void *, void *))(void *)prop.Set)(test, dataForm);
+
                      if(eClass_IsDerived(classObject.instance._class, dataType) && classObject.instance == dataForm)
                      {
                         // Shouldn't go here ...
@@ -4288,7 +4365,7 @@ class CodeEditor : Window
                      {
                         bool needClass = true;
 
-                        string = (char *)dataType._vTbl[__ecereVMethodID_class_OnGetString](dataType, dataForm, tempString, null, &needClass);
+                        string = ((char * (*)(void *, void *, void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, dataForm, tempString, null, &needClass);
 
                         if(!strcmp(dataType.dataTypeString, "char *"))
                         {
@@ -4306,17 +4383,17 @@ class CodeEditor : Window
                else if(dataType)
                {
                   DataValue dataForm, dataTest;
-               
+
                   GetProperty(prop, classObject.instance, &dataForm);
                   GetProperty(prop, test, &dataTest);
-               
-                  if(dataType._vTbl[__ecereVMethodID_class_OnCompare](dataType, &dataForm, &dataTest))
+
+                  if(((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, &dataForm, &dataTest))
                   {
                      SetProperty(prop, test, dataForm);
                      if(dataType.type == bitClass)
                      {
                         bool needClass = true;
-                        string = (char *)dataType._vTbl[__ecereVMethodID_class_OnGetString](dataType, &dataForm, tempString, null, &needClass);
+                        string = ((char * (*)(void *, void *, void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, &dataForm, tempString, null, &needClass);
                         if(needClass)
                            f.Printf("\n   %s%s = %c %s %c;", specify ? "property::" : "", prop.name, /*dataType.name, */OpenBracket, string, CloseBracket);
                         else if(string[0])
@@ -4341,13 +4418,13 @@ class CodeEditor : Window
                            }
                         }
                         else
-                           string = (char *)dataType._vTbl[__ecereVMethodID_class_OnGetString](dataType, &dataForm, tempString, null, &needClass);
+                           string = ((char * (*)(void *, void *, void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, &dataForm, tempString, null, &needClass);
                         if(!strcmp(dataType.dataTypeString, "float") && strchr(string, '.'))
                            f.Printf("\n   %s%s = %sf;", specify ? "property::" : "", prop.name, string);
                         else if(string[0])
                            f.Printf("\n   %s%s = %s;", specify ? "property::" : "", prop.name, string);
                      }
-                  }                                          
+                  }
                }
             }
          }
@@ -4357,7 +4434,8 @@ class CodeEditor : Window
    void UpdateFormCode()
    {
       if(!this) return;
-         
+      if(!parsing) return;
+
       updatingCode++;
       if(codeModified)
       {
@@ -4369,7 +4447,7 @@ class CodeEditor : Window
          int position = 0;
          char * text = null;
          int textSize;
-         Identifier movedFuncId; 
+         Identifier movedFuncId;
          int movedFuncIdLen = 0, movedFuncIdPos = 0;
          ObjectInfo classObject;
 
@@ -4400,7 +4478,7 @@ class CodeEditor : Window
 
             // Put it in the same desktop window...
             designer.PrepareTestObject(test);
-            
+
             //f.Printf("class %s : %s\n", classObject.name, classObject.oClass.name);
             //f.Printf("%c\n\n", OpenBracket);
 
@@ -4417,7 +4495,7 @@ class CodeEditor : Window
                int back = 0;
                f.Seek(classDef.blockStart.end.pos - position, current);
                position = classDef.blockStart.end.pos;
-               
+
                for(; f.Getc(&ch); count++)
                {
                   if(!isspace(ch))
@@ -4425,15 +4503,15 @@ class CodeEditor : Window
                      f.Seek(-1, current);
                      break;
                   }
-               
+
                   if(ch == '\n')
                      back = 0;
                   else
                      back++;
                }
-            
+
                f.Seek(-count, current);
-            
+
                f.DeleteBytes(count-back);
                //f.Printf("\n");
                position += count-back;
@@ -4451,7 +4529,7 @@ class CodeEditor : Window
                      bool keptMember = false;
                      MemberInit propDef;
                      MemberInit lastKept = null;
-                     
+
                      lastIsDecl = false;
                      DeleteJunkBefore(f, def.loc.start.pos, &position);
                      f.Printf("\n   ");
@@ -4487,7 +4565,7 @@ class CodeEditor : Window
                                        position = propDef.loc.end.pos;
                                        deleted = true;
                                     }
-                                 }                                          
+                                 }
                               }
                            }
                         }
@@ -4497,14 +4575,14 @@ class CodeEditor : Window
                            lastKept = propDef;
                         }
                      }
-                  
+
                      if(!keptMember)
                      {
                         char ch = 0;
                         int count = 0;
                         f.Seek(def.loc.end.pos - position - 1, current);
                         f.Getc(&ch);
-                        
+
                         if(ch == ';')
                         {
                            f.Seek(-1, current);
@@ -4518,7 +4596,7 @@ class CodeEditor : Window
                         {
                            char ch;
                            int count = 0;
-                           
+
                            f.Seek(-1, current);
                            for(;f.Getc(&ch);)
                            {
@@ -4541,7 +4619,7 @@ class CodeEditor : Window
                         {
                            f.Seek(def.loc.end.pos - position, current);
                            position = def.loc.end.pos;
-                        }                
+                        }
                      }
                      break;
                   }
@@ -4596,7 +4674,7 @@ class CodeEditor : Window
                      f.Printf("\n\n   ");
 
                      // Delete _class methods
-                     if((methodAction == actionDeleteMethod || (moveAttached && selected != classObject)) && 
+                     if((methodAction == actionDeleteMethod || (moveAttached && selected != classObject)) &&
                         def.function == function)
                      {
                         char ch;
@@ -4631,7 +4709,7 @@ class CodeEditor : Window
                         position = function.loc.start.pos + movedFuncIdPos + movedFuncIdLen;
                      }
 
-                     if((methodAction == actionAttachMethod || methodAction == actionReattachMethod) && selected == classObject && moveAttached && 
+                     if((methodAction == actionAttachMethod || methodAction == actionReattachMethod) && selected == classObject && moveAttached &&
                         function == def.function)
                      {
                         // In case of attaching methods in the _class, simply rename the method
@@ -4653,7 +4731,7 @@ class CodeEditor : Window
                         firstObject = false;
                         lastIsDecl = true;
                      }
-                     else           
+                     else
                      {
                         f.Printf("\n   ");
                         lastIsDecl = false;
@@ -4670,7 +4748,7 @@ class CodeEditor : Window
                DeleteJunkBefore(f, position, &position);
                f.Printf("\n   %s = %s;\n", method.name, function.declarator.symbol.string);
             }
-            
+
             // ********** INSTANCES ***************
             for(; object; object = object.next)
             {
@@ -4734,7 +4812,7 @@ class CodeEditor : Window
                   f.Printf("\n\n");
                   f.Printf("   ");
                   OutputType(f, returnType, false);
-               
+
                   f.Printf(" ");
                   if(dataType.thisClass && !dataType.classObjectType)
                   {
@@ -4752,7 +4830,7 @@ class CodeEditor : Window
                      if(param.next)
                         f.Printf(", ");
                   }
-                  f.Printf(")\n");                  
+                  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
@@ -4817,7 +4895,7 @@ class CodeEditor : Window
       if(methodName)
       {
          ObjectInfo object = this.selected;
-         
+
          if(object && object == this.oClass)
          {
             ClassDefinition classDef = object.oClass.classDefinition;
@@ -5075,7 +5153,7 @@ class CodeEditor : Window
                   {
                      if(!testMethod.dataType)
                         testMethod.dataType = ProcessTypeString(testMethod.dataTypeString, false);
-                        
+
                      //if(CheckCompatibleMethod(method, testMethod.dataType, &regClass, false, selectedClass)) // this.selected == this.oClass, selectedClass))
                      if(CheckCompatibleMethod(method, testMethod.dataType, this.oClass.instance._class, false, selectedClass)) // this.selected == this.oClass, selectedClass))
                      //if(CheckCompatibleMethod(method, testMethod.dataType, &regClass, this.selected == this.oClass, FindClass(this.oClass.oClass.name)))
@@ -5111,7 +5189,7 @@ class CodeEditor : Window
             this.method = method;
             ModifyCode();
          }
-         UpdateFormCode();         
+         UpdateFormCode();
          GoToMethod(methodName);
       }
    }
@@ -5123,7 +5201,7 @@ class CodeEditor : Window
          methodAction = actionDeleteMethod;
          this.function = function;
          ModifyCode();
-         UpdateFormCode(); 
+         UpdateFormCode();
 
          Update(null);
       }
@@ -5165,7 +5243,7 @@ class CodeEditor : Window
          this.method = method;
          this.function = function;
          ModifyCode();
-         UpdateFormCode(); 
+         UpdateFormCode();
          Update(null);
       }
    }
@@ -5195,7 +5273,7 @@ class CodeEditor : Window
             {
                char title[1024];
                sprintf(title, $"Attach %s", function.declarator.symbol.string);
-               if(MessageBox { type = yesNo, master = parent, text = title, 
+               if(MessageBox { type = yesNo, master = parent, text = title,
                   contents = $"Method is unused. Move method inside instance?" }.Modal() == yes)
                {
                   moveAttached = true;
@@ -5207,7 +5285,7 @@ class CodeEditor : Window
          this.method = method;
          this.function = function;
          ModifyCode();
-         UpdateFormCode(); 
+         UpdateFormCode();
          Update(null);
       }
    }
@@ -5220,7 +5298,7 @@ class CodeEditor : Window
       {
          Window dialog
          {
-            hasClose = true, borderStyle = sizable, minClientSize = { 300, 55 }, 
+            hasClose = true, borderStyle = sizable, minClientSize = { 300, 55 },
             master = sheet, text = $"Name detached method", background = formColor
          };
          Button cancelButton
@@ -5266,7 +5344,7 @@ class CodeEditor : Window
                strcat(name, this.methodName);
                strcpy(this.methodName, name);
             }
-            
+
             this.moveAttached = true;
          }
 
@@ -5274,7 +5352,7 @@ class CodeEditor : Window
          this.method = method;
          this.function = function;
          ModifyCode();
-         UpdateFormCode(); 
+         UpdateFormCode();
          Update(null);
       }
    }
@@ -5294,11 +5372,11 @@ class CodeEditor : Window
          ObjectInfo check;
          sprintf(name, "%c%s%d", tolower(instance._class.name[0]), instance._class.name+1, id);
 
-         // if(strcmp(name, this.oClass.instance.name)) 
-         
+         // if(strcmp(name, this.oClass.instance.name))
+
          {
             for(check = oClass.instances.first; check; check = check.next)
-               if(!check.deleted && check.name && !strcmp(name, check.name)) 
+               if(!check.deleted && check.name && !strcmp(name, check.name))
                   break;
             if(!check)
             {
@@ -5306,7 +5384,7 @@ class CodeEditor : Window
                break;
             }
          }
-      }            
+      }
       toolBox.controlClass = null;
 
       ModifyCode();
@@ -5318,7 +5396,7 @@ class CodeEditor : Window
 
    void EnsureUpToDate()
    {
-      if(sheet && codeModified)
+      if(sheet && codeModified && parsing)
          ParseCode();
    }
 
@@ -5372,9 +5450,9 @@ class CodeEditor : Window
          ObjectInfo select = object;
 
          for(;;)
-         {            
+         {
             select = select.prev;
-            if(!select) 
+            if(!select)
             {
                if(looped) break;
                select = object.oClass.instances.last;
@@ -5458,7 +5536,7 @@ class CodeEditor : Window
                BitmapResource bitmap = null;
                if(!subMember.dataType)
                   subMember.dataType = ProcessTypeString(subMember.dataTypeString, false);
-            
+
                if(subMember.dataType && subMember.dataType.kind == classType && subMember.dataType._class)
                {
                   char * bitmapName = (char *)eClass_GetProperty(subMember.dataType._class.registered, "icon");
@@ -5552,11 +5630,11 @@ class CodeEditor : Window
                   else if(member.name && !membersList.FindString(member.name))
                   {
                      DataRow row = membersList.AddString(member.name);
-               
+
                      BitmapResource bitmap = null;
                      if(!member.dataType)
                         member.dataType = ProcessTypeString(member.dataTypeString, false);
-               
+
                      if(member.dataType && member.dataType.kind == classType && member.dataType._class)
                      {
                         char * bitmapName = (char *)eClass_GetProperty(member.dataType._class.registered, "icon");
@@ -5622,11 +5700,11 @@ class CodeEditor : Window
       }
    }
 
-   void ListClassPropertiesAndVirtual(Class whatClass)
+   void ListClassPropertiesAndVirtual(Class whatClass, String curString)
    {
       Class _class;
       bool isPrivate = false;
-      for(_class = whatClass; _class && _class.type != systemClass; _class = _class.base)
+      for(_class = whatClass; _class /*&& _class.type != systemClass*/; _class = _class.base)
       {
          Method method;
          Property prop;
@@ -5664,14 +5742,14 @@ class CodeEditor : Window
                      row.icon = icons[(member.memberAccess == publicAccess && !isPrivate) ? typeProperty : typePropertyPrivate];
                   }
                }
-               else if(member.name)
+               else if(member.name && (!curString || strcmp(curString, member.name)))
                {
                   DataRow row = membersList.AddString(member.name);
-               
+
                   BitmapResource bitmap = null;
                   if(!member.dataType)
                      member.dataType = ProcessTypeString(member.dataTypeString, false);
-               
+
                   if(member.dataType && member.dataType.kind == classType && member.dataType._class)
                   {
                      char * bitmapName = (char *)eClass_GetProperty(member.dataType._class.registered, "icon");
@@ -5700,7 +5778,7 @@ class CodeEditor : Window
       if(type && (type.kind == classType || type.kind == structType || type.kind == unionType))
       {
          Class _class;
-         
+
          if(type.kind == classType)
          {
             if(type._class)
@@ -5746,7 +5824,7 @@ class CodeEditor : Window
          for(link = (BTNamedLink)nameSpace.classes.first; link; link = (BTNamedLink)((BTNode)link).next)
          {
             Class _class = link.data;
-            if(_class.type != systemClass)
+            if(_class.type != systemClass && !_class.templateClass)  // Omit templatized classes
             {
                DataRow row = membersList.AddString(_class.name);
                row.icon = (_class.type == unitClass || _class.type == enumClass) ? icons[typeDataType] : icons[typeClass];
@@ -5846,7 +5924,8 @@ 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 != _class))
+         if(_class.type == enumClass && (dest.kind != classType || ((!dest._class || !dest._class.registered || (dest._class.registered != _class && strcmp(dest._class.registered.dataTypeString, "char *"))) && !dest.classObjectType)) &&
+            dest.kind != pointerType && dest.kind != ellipsisType)
          {
             OldList conversions { };
             Type type { };
@@ -5948,7 +6027,7 @@ class CodeEditor : Window
          ListEnumValues(destType._class.registered);
 
          if(insideClass)
-            ListClassPropertiesAndVirtual(insideClass);
+            ListClassPropertiesAndVirtual(insideClass, null);
 
          listedEnums = true;
       }
@@ -5963,22 +6042,22 @@ class CodeEditor : Window
          }
 
          if(insideClass)
-            ListClassPropertiesAndVirtual(insideClass);
+            ListClassPropertiesAndVirtual(insideClass, null);
 
          listedEnums = true;
       }
       else if(insideClass && !enumOnly)
       {
-         ListClassPropertiesAndVirtual(insideClass);
+         ListClassPropertiesAndVirtual(insideClass, string);
       }
 
       if(listedEnums && string && string[0])
       {
          DataRow row = membersList.FindSubString(string);
          if(!row)
-            listedEnums = false;      
+            listedEnums = false;
       }
-      
+
       if(!insideClass && exp && exp.destType && exp.destType.kind == functionType && GetThisClass())
       {
          ListClassMembersMatch(GetThisClass(), exp.destType);
@@ -5989,7 +6068,7 @@ class CodeEditor : Window
          Symbol symbol = null;
          {
             if(GetThisClass())
-            { 
+            {
                ListClassMembers(GetThisClass(), false);
             }
 
@@ -6011,7 +6090,7 @@ class CodeEditor : Window
                      {
                         row.icon = icons[typeEnumValue];
                      }
-                     else 
+                     else
                      {
                         BitmapResource bitmap = null;
                         if(symbol.type && symbol.type.kind == classType && symbol.type._class && symbol.type._class)
@@ -6069,7 +6148,7 @@ class CodeEditor : Window
                      {
                         row.icon = icons[typeEnumValue];
                      }
-                     else 
+                     else
                      {
                         BitmapResource bitmap = null;
                         if(data.dataType && data.dataType.kind == classType && data.dataType._class && data.dataType._class)
@@ -6136,7 +6215,7 @@ class CodeEditor : Window
          OutputType(f, returnType, false);
 
          f.Printf(" ");
-         
+
          if(dataType.thisClass && !dataType.classObjectType && (!isInstance || !insideClass || !eClass_IsDerived(insideClass, dataType.thisClass.registered)))
          {
             if(dataType.thisClass.shortName)
@@ -6157,7 +6236,7 @@ class CodeEditor : Window
                   f.Printf(", ");
             }
          }
-         f.Printf(")\n");                  
+         f.Printf(")\n");
          if(extraIndent) f.Printf("   ");
          f.Printf("   %c\n", OpenBracket);
 
@@ -6165,7 +6244,10 @@ class CodeEditor : Window
 
          f.Printf("\n");
 
-         if(!_class || (isInstance ? _class : _class.base)._vTbl[method.vid] == moduleClass._vTbl[__ecereVMethodID___ecereNameSpace__ecere__com__Module_OnLoad]) // Temp Check for DefaultFunction
+         if(!_class ||
+            (
+               (isInstance ? _class : _class.base)._vTbl[method.vid] == 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"))
             {
@@ -6222,6 +6304,7 @@ class CodeEditor : Window
       Expression memberExp = null;
       Identifier realIdentifier = null;
 
+      if(!parsing) return true;
       if(!privateModule) return !didOverride;
 
       insideFunction = null;
@@ -6233,7 +6316,7 @@ class CodeEditor : Window
       }
 
       editBox.GetSelPos(&l1, &y1, &x1, &l2, &y2, &x2, false);
-      { 
+      {
          EditBoxStream f { editBox = editBox };
 
          updatingCode = true;
@@ -6264,7 +6347,7 @@ class CodeEditor : Window
          else if(!pointer)
          {
             editBox.GetSelPos(&l1, &y1, &x1, &l2, &y2, &x2, false);
-            { 
+            {
                EditBoxStream f { editBox = editBox };
                char ch = 0;
 
@@ -6529,7 +6612,7 @@ class CodeEditor : Window
                         editBox.SetSelPos(l1, y1, idStart.charPos-1, l2, y2, idStart.charPos-1);
                      editBox.GetCaretPosition(caret);
                      editBox.SetSelPos(l1, y1, x1, l2, y2, x2);
-               
+
                      membersList.master = this;
 
                      caret.y += editBox.GetCaretSize();
@@ -6576,7 +6659,7 @@ class CodeEditor : Window
                   }
                   if(row)
                      membersList.SetScrollPosition(0, row.index * membersList.rowHeight);
-               }            
+               }
             }
          }
       }
@@ -6596,11 +6679,13 @@ class CodeEditor : Window
       EditLine l1, l2;
       int x1,y1, x2,y2;
 
+      if(!parsing) return;
+
       charPos = editBox.charPos + 1;
       EnsureUpToDate();
 
       editBox.GetSelPos(&l1, &y1, &x1, &l2, &y2, &x2, false);
-      { 
+      {
          EditBoxStream f { editBox = editBox };
          char ch;
 
@@ -6635,7 +6720,7 @@ class CodeEditor : Window
          delete f;
          updatingCode = false;
       }
-      
+
       charPos = Min(charPos, l1.count + 1);
       if(!caretMove)
          FindParamsTree(ast, lineNum, charPos);
@@ -6657,7 +6742,7 @@ class CodeEditor : Window
          if(this.functionType != ::functionType || this.instanceType != ::instanceType)
             reposition = false;
 
-         if(!this.paramsShown || reposition || paramsInsideExp != functionExp || ::instanceType) // Added instanceType here, otherwise instance popups never reposition... 
+         if(!this.paramsShown || reposition || paramsInsideExp != functionExp || ::instanceType) // Added instanceType here, otherwise instance popups never reposition...
                                                                                                           // ( Dummy exp: always ends up with same memory)
          {
             editBox.GetSelPos(&l1, &y1, &x1, &l2, &y2, &x2, false);
@@ -6741,3 +6826,38 @@ CodeEditor NewCodeEditor(Window parent, WindowState state, bool modified)
    document.Create();
    return document;
 }
+
+static int nofdigits(int v)
+{
+   if(v == MININT) return 10 + 1;
+   if(v < 0) return nofdigits(-v) + 1;
+   if(v >= 10000)
+   {
+      if(v >= 10000000)
+      {
+         if(v >= 100000000)
+         {
+            if(v >= 1000000000)
+               return 10;
+            return 9;
+         }
+         return 8;
+      }
+      if(v >= 100000)
+      {
+         if(v >= 1000000)
+            return 7;
+         return 6;
+      }
+      return 5;
+   }
+   if(v >= 100)
+   {
+      if(v >= 1000)
+         return 4;
+      return 3;
+   }
+   if(v >= 10)
+      return 2;
+   return 1;
+}