wip II
[sdk] / ide / src / designer / CodeEditor.ec
index b8024f5..8704e27 100644 (file)
@@ -31,13 +31,13 @@ SyntaxColorScheme colorScheme
 */
 
 // The new nice dark scheme -- so peaceful on my brain
-
+/*
 FontResource panelFont { $"Courier New", 10 };
 FontResource codeFont { $"Courier New", 10 };
-/*
+*/
 FontResource panelFont { $"Consolas", 12 };
 FontResource codeFont { $"Consolas", 12 };
-*/
+
 Color selectionColor = lightYellow;
 Color selectionText = Color { 30, 40, 50 };
 Color viewsBackground = Color { 30, 40, 50 };
@@ -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()
@@ -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:
@@ -373,12 +398,12 @@ 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);
+         ((void (*)(void *, void *))(void *)prop.Get)(selected.instance, dataForm);
+         ((void (*)(void *, void *))(void *)prop.Get)(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))
          {
-            prop.Set(test, dataForm);
+            ((void (*)(void *, void *))(void *)prop.Set)(test, dataForm);
             result = true;
          }
          delete dataForm;
@@ -388,12 +413,12 @@ bool Code_IsPropertyModified(Instance test, ObjectInfo selected, Property prop)
       {
          void * dataForm, * dataTest;
    
-         dataForm = (void *)prop.Get(selected.instance);
-         dataTest = (void *)prop.Get(test);
+         dataForm = ((void *(*)(void *))(void *)prop.Get)(selected.instance);
+         dataTest = ((void *(*)(void *))(void *)prop.Get)(test);
    
-         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))
          {
-            prop.Set(test, dataForm);
+            ((void (*)(void *, void *))(void *)prop.Set)(test, dataForm);
             result = true;
          }
       }
@@ -404,7 +429,7 @@ bool Code_IsPropertyModified(Instance test, ObjectInfo selected, Property prop)
          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,7 +437,7 @@ 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;
@@ -666,6 +691,10 @@ class CodeEditor : Window
 
    Designer designer { codeEditor = this, visible = false, saveDialog = codeEditorFormFileDialog };
 
+   bool noParsing;
+
+   property bool parsing { get { return editBox.syntaxHighlighting && !noParsing && !ide.noParsing; } };
+
    void ProcessCaretMove(EditBox editBox, int line, int charPos)
    {
       char temp[512];
@@ -769,7 +798,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;
@@ -784,7 +813,7 @@ class CodeEditor : Window
       textVertScroll = true, multiLine = true, /*lineNumbers = ideSettings.showLineNumbers,*/
       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;
@@ -1357,7 +1386,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 +1401,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", 
                      $"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;
                }
@@ -1474,37 +1505,48 @@ class CodeEditor : Window
             (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 
             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)
       {
@@ -1570,16 +1612,17 @@ class CodeEditor : Window
       
       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)
       {
@@ -1658,7 +1701,7 @@ class CodeEditor : Window
             surface.WriteText(x, y, "(", 1);
             x += parW;
 
-            if(methodType && !methodType.staticMethod)
+            if(methodType && !methodType.staticMethod && methodType.methodClass)
             {
                int tw = 0, width;
 
@@ -1705,7 +1748,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)
                {
@@ -1878,48 +1921,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 +1965,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 +2004,8 @@ class CodeEditor : Window
             if(CloseConfirmation(false))
             {
                visible = false;
-               OnFileModified({ modified = true }, null);
+               if(modifiedDocument)
+                  OnFileModified({ modified = true }, null);
             }
             debugClosing = false;
             return false;
@@ -2077,7 +2087,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 +2106,7 @@ class CodeEditor : Window
       */
       if(active && directActivation)
       {
+         AdjustDebugMenus();
          if(openedFileInfo)
             openedFileInfo.Activate();
          if(designer)
@@ -2147,6 +2158,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;
    }
 
@@ -2172,7 +2202,7 @@ class CodeEditor : Window
          editBox.Save(f, false);
          modifiedDocument = false;
          
-         delete(f);
+         delete f;
          return true;
       }
       return false;
@@ -2182,7 +2212,7 @@ class CodeEditor : Window
    {
       bool reload = false;
       if(visible == false && inUseDebug == true)
-         reload = true;
+         ide.debugger.WatchesReleaseCodeEditor();
       else
       {
          char message[2048];
@@ -2225,7 +2255,7 @@ class CodeEditor : Window
             }
             modifiedDocument = false;
 
-            delete(f);
+            delete f;
          }
       }
       return true;
@@ -2339,16 +2369,20 @@ 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;
          {
             int spaceW;
             display.FontExtent(font.font, " ", 1, &spaceW, null);
@@ -2387,18 +2421,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 +2464,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 +2494,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 +2544,7 @@ class CodeEditor : Window
       char * fileName;
       ImportedModule module;
       char extension[MAX_EXTENSION];
+      PathBackup pathBackup { };
 #ifdef _TIMINGS
       Time parseCodeStart = GetTime();
       Time startTime, startFindClass;
@@ -2539,8 +2588,8 @@ class CodeEditor : Window
 
       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 +2629,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;
 
@@ -2645,6 +2696,8 @@ class CodeEditor : Window
          ast = null;
          //SetAST(null);
       }
+      defines.Free(FreeModuleDefine);
+      imports.Free(FreeModuleImport);
 
       FreeContext(this.globalContext);
       FreeExcludedSymbols(this.excludedSymbols);
@@ -2668,10 +2721,10 @@ class CodeEditor : Window
       if(ide.workspace)
       {
          CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
-         SetTargetBits(compiler.supportsBitDepth ? 32 : GetHostBits());
+         SetTargetBits(ide.workspace.bitDepth ? ide.workspace.bitDepth : GetHostBits());
          delete compiler;
       }
-      this.privateModule = __ecere_COM_Initialize(false, 1, null);
+      this.privateModule = __ecere_COM_Initialize(false | ((GetTargetBits() == sizeof(uintptr) *8) ? 0 : GetTargetBits() == 64 ? 2 : 4), 1, null);
 
       SetPrivateModule(privateModule);
 
@@ -2722,8 +2775,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);
@@ -2972,7 +3028,7 @@ class CodeEditor : Window
                                                             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)
@@ -2985,7 +3041,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;
                                                    }
                                                    else
@@ -3012,7 +3068,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;
                                                       }
                                                    }
@@ -3145,7 +3201,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;
                                                                   }
@@ -3191,7 +3247,7 @@ class CodeEditor : Window
                                                                                        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)
@@ -3210,7 +3266,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
@@ -3220,7 +3276,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;
                                                                                           }
@@ -3242,7 +3298,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;
                                                                                              }
@@ -3274,7 +3330,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
@@ -3298,13 +3354,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;
                                                                                  }
                                                                               }
@@ -3476,6 +3532,8 @@ class CodeEditor : Window
 #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)
@@ -3507,10 +3565,10 @@ class CodeEditor : Window
                      void * dataForm = new0 byte[dataType.structSize];
                      void * dataTest = new0 byte[dataType.structSize];
                
-                     ((void (*)())(void *)prop.Get)(control, dataForm);
-                     prop.Get(test, dataTest);
+                     ((void (*)(void *, void *))(void *)prop.Get)(control, dataForm);
+                     ((void (*)(void *, void *))(void *)prop.Get)(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 tempString[1024] = "";
                         char * string = "";
@@ -3518,9 +3576,9 @@ class CodeEditor : Window
                         if(*prev)
                            f.Printf(", ");
                   
-                        prop.Set(test, dataForm);
+                        ((void (*)(void *, void *))(void *)prop.Set)(test, dataForm);
                   
-                        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);
                         
                         eClass_FindNextMember(_class, curClass, curMember, null, null);
                         if(*curMember != (DataMember)prop)
@@ -3543,17 +3601,17 @@ class CodeEditor : Window
                   {
                      void * dataForm, * dataTest;
                
-                     dataForm = (void *)prop.Get(control);
-                     dataTest = (void *)prop.Get(test);
+                     dataForm = ((void *(*)(void *))(void *)prop.Get)(control);
+                     dataTest = ((void *(*)(void *))(void *)prop.Get)(test);
                
-                     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 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)
@@ -3585,7 +3643,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);
                                  }
                               }
@@ -3594,7 +3652,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 *"))
                            {
@@ -3618,7 +3676,7 @@ class CodeEditor : Window
                      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] = "";
@@ -3644,7 +3702,7 @@ 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])
                            {
@@ -3676,7 +3734,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
@@ -4255,15 +4313,15 @@ class CodeEditor : Window
                   void * dataForm = new0 byte[dataType.structSize];
                   void * dataTest = new0 byte[dataType.structSize];
                
-                  prop.Get(classObject.instance, dataForm);
-                  prop.Get(test, dataTest);
+                  ((void (*)(void *, void *))(void *)prop.Get)(classObject.instance, dataForm);
+                  ((void (*)(void *, void *))(void *)prop.Get)(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))
                   {
                      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
@@ -4276,14 +4334,14 @@ class CodeEditor : Window
                {
                   void * dataForm, * dataTest;
                
-                  dataForm = (void *)prop.Get(classObject.instance);
-                  dataTest = (void *)prop.Get(test);
+                  dataForm = ((void *(*)(void *))(void *)prop.Get)(classObject.instance);
+                  dataTest = ((void *(*)(void *))(void *)prop.Get)(test);
                
-                  if(dataType._vTbl[__ecereVMethodID_class_OnCompare](dataType, dataForm, dataTest))
+                  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)
                      {
@@ -4294,7 +4352,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 *"))
                         {
@@ -4316,13 +4374,13 @@ class CodeEditor : Window
                   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])
@@ -4347,7 +4405,7 @@ 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])
@@ -4363,7 +4421,8 @@ class CodeEditor : Window
    void UpdateFormCode()
    {
       if(!this) return;
-         
+      if(!parsing) return;
+
       updatingCode++;
       if(codeModified)
       {
@@ -5324,7 +5383,7 @@ class CodeEditor : Window
 
    void EnsureUpToDate()
    {
-      if(sheet && codeModified)
+      if(sheet && codeModified && parsing)
          ParseCode();
    }
 
@@ -5628,11 +5687,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;
@@ -5670,7 +5729,7 @@ 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);
                
@@ -5752,7 +5811,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];
@@ -5852,7 +5911,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 { };
@@ -5954,7 +6014,7 @@ class CodeEditor : Window
          ListEnumValues(destType._class.registered);
 
          if(insideClass)
-            ListClassPropertiesAndVirtual(insideClass);
+            ListClassPropertiesAndVirtual(insideClass, null);
 
          listedEnums = true;
       }
@@ -5969,13 +6029,13 @@ 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])
@@ -6231,6 +6291,7 @@ class CodeEditor : Window
       Expression memberExp = null;
       Identifier realIdentifier = null;
 
+      if(!parsing) return true;
       if(!privateModule) return !didOverride;
 
       insideFunction = null;
@@ -6605,6 +6666,8 @@ class CodeEditor : Window
       EditLine l1, l2;
       int x1,y1, x2,y2;
 
+      if(!parsing) return;
+
       charPos = editBox.charPos + 1;
       EnsureUpToDate();