Various fixes for Android
[sdk] / ide / src / project / Workspace.ec
index 12f0242..bf868e4 100644 (file)
@@ -26,12 +26,12 @@ enum ValgrindLeakCheck
 {
    no, summary, yes, full;
 
-   property char *
+   property const char *
    {
       get { return OnGetString(null, null, null); }
    }
 
-   char * OnGetString(char * tempString, void * fieldData, bool * needClass)
+   const char * OnGetString(char * tempString, void * fieldData, bool * needClass)
    {
       if(this >= no && this <= full)
       {
@@ -108,13 +108,13 @@ public:
    char * workspaceFile;
    char * workspaceDir;
    char * commandLineArgs;
-   property char * commandLineArgs { set { delete commandLineArgs; if(value) commandLineArgs = CopyString(value); } }
+   property const char * commandLineArgs { set { delete commandLineArgs; if(value) commandLineArgs = CopyString(value); } }
    char * debugDir;
-   property char * debugDir { set { delete debugDir; if(value) debugDir = CopyString(value); } }
+   property const char * debugDir { set { delete debugDir; if(value) debugDir = CopyString(value); } }
 
    int bpCount;
 
-   property char * compiler
+   property const char * compiler
    {
       set { delete compiler; if(value && value[0]) compiler = CopyString(value); }
       get { return compiler && compiler[0] ? compiler : null; }
@@ -143,7 +143,7 @@ public:
       }
    };
 
-   property char * workspaceFile
+   property const char * workspaceFile
    {
       set
       {
@@ -157,7 +157,7 @@ public:
       get { return workspaceFile; }
    }
 
-   property char * projectDir
+   property const char * projectDir
    {
       get
       {
@@ -358,7 +358,7 @@ public:
       }
    }
 
-   char * GetAbsolutePathFromRelative(char * relative)
+   char * GetAbsolutePathFromRelative(const char * relative)
    {
       char name[MAX_LOCATION];
       char absolute[MAX_LOCATION];
@@ -368,7 +368,7 @@ public:
       GetLastDirectory(relative, name);
       for(p : projects)
       {
-         if(node = p.topNode.Find(name, false))
+         if((node = p.topNode.Find(name, false)))
          {
             prj = p;
             break;
@@ -412,7 +412,7 @@ public:
       return null;
    }
 
-   char * GetPathWorkspaceRelativeOrAbsolute(char * path)
+   char * GetPathWorkspaceRelativeOrAbsolute(const char * path)
    {
       if(IsPathInsideOf(path, workspaceDir))
       {
@@ -424,7 +424,7 @@ public:
          return CopyUnixPath(path);
    }
 
-   Array<ProjectNode> GetAllProjectNodes(char *fullPath, bool skipExcluded)
+   Array<ProjectNode> GetAllProjectNodes(const char *fullPath, bool skipExcluded)
    {
       Array<ProjectNode> nodes = null;
       for(project : projects)
@@ -442,7 +442,7 @@ public:
       return nodes;
    }
 
-   OpenedFileInfo UpdateOpenedFileInfo(char * fileName, OpenedFileState state)
+   OpenedFileInfo UpdateOpenedFileInfo(const char * fileName, OpenedFileState state)
    {
       char filePath[MAX_LOCATION];
       OpenedFileInfo ofi = null;
@@ -479,9 +479,6 @@ public:
 
    void UpdateSourceDirsArray(Array<String> dirs)
    {
-      byte * tokens[256];
-      int c, numTokens;
-
       sourceDirs.Free();
 
       for(s : dirs)
@@ -508,7 +505,7 @@ public:
       delete project;
    }
 
-   void SelectActiveConfig(char * configName)
+   void SelectActiveConfig(const char * configName)
    {
       bool change = false;
       for(prj : ide.workspace.projects)
@@ -530,9 +527,10 @@ public:
          ide.projectView.Update(null);
          Save();
       }
+      ide.AdjustDebugMenus();
    }
 
-   bool FindPath(ProjectNode node, char * path)
+   bool FindPath(ProjectNode node, const char * path)
    {
       if(node.type == file)
       {
@@ -556,9 +554,9 @@ public:
       return false;
    }
 
-   void ChangeBreakpoint(DataRow row, char * location)
+   void ChangeBreakpoint(DataRow row, const char * location)
    {
-      Breakpoint bp = (Breakpoint)row.tag;
+      Breakpoint bp = (Breakpoint)(intptr)row.tag;
       if(bp)
       {
          char * currentLoc = bp.CopyUserLocationString();
@@ -593,7 +591,7 @@ public:
 
    void ChangeBreakpointIgnore(DataRow row, int ignore)
    {
-      Breakpoint bp = (Breakpoint)row.tag;
+      Breakpoint bp = (Breakpoint)(intptr)row.tag;
       if(bp)
       {
          bp.ignore = ignore;
@@ -603,7 +601,7 @@ public:
 
    void ChangeBreakpointLevel(DataRow row, int level)
    {
-      Breakpoint bp = (Breakpoint)row.tag;
+      Breakpoint bp = (Breakpoint)(intptr)row.tag;
       if(bp)
       {
          bp.level = level;
@@ -611,9 +609,9 @@ public:
       }
    }
 
-   void ChangeBreakpointCondition(DataRow row, char * condition)
+   void ChangeBreakpointCondition(DataRow row, const char * condition)
    {
-      Breakpoint bp = (Breakpoint)row.tag;
+      Breakpoint bp = (Breakpoint)(intptr)row.tag;
       if(bp && !(!bp.condition && !(condition && condition[0])))
       {
          if(!bp.condition)
@@ -652,11 +650,11 @@ public:
          Window document;
          for(document = ide.firstChild; document; document = document.next)
          {
-            char * fileName = document.fileName;
+            const char * fileName = document.fileName;
             if(document.isDocument && fileName && document.created)
             {
                char winFilePath[MAX_LOCATION];
-               char * slashPath = GetSlashPathBuffer(winFilePath, fileName);
+               const char * slashPath = GetSlashPathBuffer(winFilePath, fileName);
 
                if(!fstrcmp(slashPath, bp.absoluteFilePath))
                {
@@ -687,7 +685,7 @@ public:
       Link bpLink, next;
       for(bpLink = breakpoints.first; bpLink; bpLink = next)
       {
-         Breakpoint bp = (Breakpoint)bpLink.data;
+         Breakpoint bp = (Breakpoint)(intptr)bpLink.data;
          next = bpLink.next;
 
          if(bp.type == user)
@@ -793,7 +791,7 @@ public:
 
 }
 
-Workspace LoadWorkspace(char * filePath, char * fromProjectFile)
+Workspace LoadWorkspace(const char * filePath, const char * fromProjectFile)
 {
    File file;
    Workspace workspace = null;
@@ -813,10 +811,9 @@ Workspace LoadWorkspace(char * filePath, char * fromProjectFile)
       {
          char buffer[65536];
          char * equal;
-         int len;
 
          Watch wh;
-         Breakpoint bp;
+         Breakpoint bp = null;
 
          file.GetLine(buffer, 65536 - 1);
          TrimLSpaces(buffer, buffer);
@@ -1278,8 +1275,7 @@ Workspace LoadWorkspace(char * filePath, char * fromProjectFile)
    else if(fromProjectFile)
    {
       //MessageBox { type = Ok, master = ide, contents = "Worspace load file failed", text = "Worspace Load File Error" }.Modal();
-
-      char projectFile[MAX_LOCATION];
+      //char projectFile[MAX_LOCATION];
       Project newProject;
 
       //strcpy(projectFile, filePath);