ide: move windows specific code (setEcereLanguageInWinRegEnvironment) to process...
authorRejean Loyer <redj@ecere.com>
Fri, 6 Nov 2015 06:01:17 +0000 (01:01 -0500)
committerJerome St-Louis <jerome@ecere.com>
Thu, 28 Jul 2016 22:23:34 +0000 (18:23 -0400)
documentor/Makefile
documentor/documentor.epj
epj2make/Makefile
epj2make/epj2make.epj
ide/Makefile
ide/ide.epj
ide/src/IDESettings.ec
ide/src/debugger/process.ec
ide/src/project/Project.ec
ide/src/project/ProjectConfig.ec
ide/src/project/ProjectNode.ec

index 85ea4ac..98e9a10 100644 (file)
@@ -85,7 +85,8 @@ LIBS += \
 endif
 
 PRJ_CFLAGS += \
-        $(if $(DEBUG), -g, -O2 -ffast-math) $(FPIC) -w
+        $(if $(DEBUG), -g, -O2 -ffast-math) $(FPIC) -w \
+                        -DECERE_DOCUMENTOR
 
 ECFLAGS += -module $(MODULE)
 ECFLAGS += \
index bdc453a..006bff6 100644 (file)
@@ -2,6 +2,9 @@
    "Version" : 0.2,
    "ModuleName" : "documentor",
    "Options" : {
+      "PreprocessorDefinitions" : [
+         "ECERE_DOCUMENTOR"
+      ],
       "TargetFileName" : "documentor",
       "Libraries" : [
          "ecere"
index 4290681..1e02373 100644 (file)
@@ -85,7 +85,7 @@ endif
 
 PRJ_CFLAGS += \
         $(if $(DEBUG), -g, -O2 -ffast-math) $(FPIC) -w \
-                        -DMAKEFILE_GENERATOR
+                        -DECERE_EPJ2MAKE
 
 ECFLAGS += -module $(MODULE)
 ECFLAGS += \
index 7889ca9..6c77221 100644 (file)
@@ -4,7 +4,7 @@
    "Options" : {
       "Warnings" : "All",
       "PreprocessorDefinitions" : [
-         "MAKEFILE_GENERATOR"
+         "ECERE_EPJ2MAKE"
       ],
       "TargetType" : "Executable",
       "TargetFileName" : "epj2make",
index 74a39bd..7377d01 100644 (file)
@@ -212,7 +212,8 @@ PRJ_CFLAGS += \
         $(if $(DEBUG), -g, -O2 -ffast-math) $(FPIC) -w \
                         $(FVISIBILITY) \
                         -DREPOSITORY_VERSION="\"$(REPOSITORY_VER)\"" \
-                        -I../extras/include
+                        -I../extras/include \
+                        -DECERE_IDE
 
 ECFLAGS += -module $(MODULE)
 ECFLAGS += \
index 21b5d85..cd859e7 100644 (file)
@@ -4,7 +4,8 @@
    "Options" : {
       "Warnings" : "All",
       "PreprocessorDefinitions" : [
-         "GDB_DEBUG_GUI"
+         "GDB_DEBUG_GUI",
+         "ECERE_IDE"
       ],
       "IncludeDirs" : [
          "../extras/include"
index 1fedfa4..ee5a3f8 100644 (file)
@@ -1,10 +1,3 @@
-#if defined(__WIN32__)
-#define MessageBox _MessageBox
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef MessageBox
-#endif
-
 #ifdef ECERE_STATIC
 public import static "ecere"
 #else
@@ -27,6 +20,10 @@ import "StringsBox"
 
 import "OldIDESettings"
 
+#if !defined(ECERE_DOCUMENTOR) && !defined(ECERE_EPJ2MAKE)
+import "process"
+#endif
+
 define MaxRecent = 9;
 
 enum DirTypes { includes, libraries, executables };
@@ -1203,6 +1200,7 @@ public:
    }
 }
 
+#if !defined(ECERE_DOCUMENTOR) && !defined(ECERE_EPJ2MAKE)
 struct LanguageOption
 {
    const String name;
@@ -1382,23 +1380,7 @@ bool LanguageRestart(const char * code, Application app, IDESettings settings, I
          settings.language = code;
          settingsContainer.Save();
 
-#if defined(__WIN32__)
-         // Set LANGUAGE environment variable
-         {
-            HKEY key = null;
-            uint16 wLanguage[256];
-            DWORD status;
-            wLanguage[0] = 0;
-
-            RegCreateKeyEx(HKEY_CURRENT_USER, "Environment", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, null, &key, &status);
-            if(key)
-            {
-               UTF8toUTF16Buffer(code, wLanguage, sizeof(wLanguage) / sizeof(uint16));
-               RegSetValueExW(key, L"ECERE_LANGUAGE", 0, REG_EXPAND_SZ, (byte *)wLanguage, (uint)(wcslen(wLanguage)+1) * 2);
-               RegCloseKey(key);
-            }
-         }
-#endif
+         setEcereLanguageInWinRegEnvironment(code);
 
          if(eClass_IsDerived(app._class, class(GuiApplication)))
          {
@@ -1441,3 +1423,4 @@ bool LanguageRestart(const char * code, Application app, IDESettings settings, I
    delete command;
    return restart;
 }
+#endif
index 70e85f0..8c6481e 100644 (file)
@@ -46,7 +46,7 @@ default:
 
 private:
 
-import "ide"
+import "ecere"
 
 #ifdef __WIN32__
 static bool CALLBACK EnumWindowsBringToTop(HWND hwnd, LPARAM lParam)
@@ -355,3 +355,21 @@ int Process_GetChildExeProcessId(const int parentProcessId, const char * exeFile
    return pid;
 #endif
 }
+
+void setEcereLanguageInWinRegEnvironment(const char * languageCode)
+{
+#ifdef __WIN32__
+   HKEY key = null;
+   uint16 wLanguage[256];
+   DWORD status;
+   wLanguage[0] = 0;
+
+   RegCreateKeyEx(HKEY_CURRENT_USER, "Environment", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, null, &key, &status);
+   if(key)
+   {
+      UTF8toUTF16Buffer(languageCode, wLanguage, sizeof(wLanguage) / sizeof(uint16));
+      RegSetValueExW(key, L"ECERE_LANGUAGE", 0, REG_EXPAND_SZ, (byte *)wLanguage, (uint)(wcslen(wLanguage)+1) * 2);
+      RegCloseKey(key);
+   }
+#endif
+}
index 4b03347..dfc93e4 100644 (file)
@@ -6,7 +6,7 @@ public import "ecere"
 
 import "DynamicString"
 
-#ifndef MAKEFILE_GENERATOR
+#if !defined(ECERE_DOCUMENTOR) && !defined(ECERE_EPJ2MAKE)
 import "ide"
 // We should have the .sln/.vcproj generation even on other platforms
 // e.g. detect from an environment variable pointing to a Windows drive
@@ -42,7 +42,7 @@ IDESettingsContainer settingsContainer
 
    void OnLoad(GlobalSettingsData data)
    {
-#ifndef MAKEFILE_GENERATOR
+#if !defined(ECERE_DOCUMENTOR) && !defined(ECERE_EPJ2MAKE)
       IDESettings settings = (IDESettings)data;
       globalSettingsDialog.ideSettings = settings;
       ide.updateRecentMenus();
@@ -51,7 +51,7 @@ IDESettingsContainer settingsContainer
    }
 };
 
-#ifdef MAKEFILE_GENERATOR
+#if defined(ECERE_DOCUMENTOR) || defined(ECERE_EPJ2MAKE)
 CompilerConfig defaultCompiler;
 #endif
 
@@ -679,7 +679,7 @@ void CamelCase(char * string)
 
 CompilerConfig GetCompilerConfig()
 {
-#ifndef MAKEFILE_GENERATOR
+#if !defined(ECERE_DOCUMENTOR) && !defined(ECERE_EPJ2MAKE)
    CompilerConfig compiler = null;
    if(ide && ide.workspace)
       compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
@@ -692,10 +692,10 @@ CompilerConfig GetCompilerConfig()
 
 int GetBitDepth()
 {
-#ifdef MAKEFILE_GENERATOR
-   return 0; // todo: improve this somehow? add bit depth command line option?
-#else
+#if !defined(ECERE_DOCUMENTOR) && !defined(ECERE_EPJ2MAKE)
    return ide.workspace ? ide.workspace.bitDepth : 0;
+#else
+   return 0; // todo: improve this somehow? add bit depth command line option?
 #endif
 }
 
@@ -883,7 +883,7 @@ private:
 
    Map<String, Map<String, NameCollisionInfo>> configsNameCollisions { };
 
-#ifndef MAKEFILE_GENERATOR
+#if !defined(ECERE_DOCUMENTOR) && !defined(ECERE_EPJ2MAKE)
    FileMonitor fileMonitor
    {
       this, FileChange { modified = true };
@@ -1192,7 +1192,7 @@ private:
 
    bool GetConfigIsInActiveDebugSession(ProjectConfig config)
    {
-#ifndef MAKEFILE_GENERATOR
+#if !defined(ECERE_DOCUMENTOR) && !defined(ECERE_EPJ2MAKE)
       return ide.project == this && ide.debugger && ide.debugger.prjConfig == config && ide.debugger.isActive;
 #else
       return false;
@@ -1201,7 +1201,7 @@ private:
 
    bool GetConfigIsInDebugSession(ProjectConfig config)
    {
-#ifndef MAKEFILE_GENERATOR
+#if !defined(ECERE_DOCUMENTOR) && !defined(ECERE_EPJ2MAKE)
       return ide.project == this && ide.debugger && ide.debugger.prjConfig == config && ide.debugger.isPrepared;
 #else
       return false;
@@ -1210,12 +1210,12 @@ private:
 
    void SetPath(bool projectsDirs, CompilerConfig compiler, ProjectConfig config, int bitDepth)
    {
-#ifndef MAKEFILE_GENERATOR
+#if !defined(ECERE_DOCUMENTOR) && !defined(ECERE_EPJ2MAKE)
       ide.SetPath(projectsDirs, compiler, config, bitDepth);
 #endif
    }
 
-#ifndef MAKEFILE_GENERATOR
+#if !defined(ECERE_DOCUMENTOR) && !defined(ECERE_EPJ2MAKE)
    bool Save(const char * fileName)
    {
       File f;
@@ -1356,7 +1356,7 @@ private:
       sprintf(string, "%s%s%s.Makefile", projectName, config ? "-" : "", config ? config.name : "");
    }
 
-#ifndef MAKEFILE_GENERATOR
+#if !defined(ECERE_DOCUMENTOR) && !defined(ECERE_EPJ2MAKE)
    ProjectNode GetObjectFileNode(const char * filePath, const char * objectFileExt)
    {
       ProjectNode node = null;
@@ -4739,7 +4739,7 @@ Project LoadProject(const char * filePath, const char * activeConfigName)
    return project;
 }
 
-#ifndef MAKEFILE_GENERATOR
+#if !defined(ECERE_DOCUMENTOR) && !defined(ECERE_EPJ2MAKE)
 static GccVersionInfo GetGccVersionInfo(CompilerConfig compiler, const String compilerCommand)
 {
    GccVersionInfo result = unknown;
index f70e061..2bf6a64 100644 (file)
@@ -1,4 +1,4 @@
-#ifndef MAKEFILE_GENERATOR
+#if !defined(ECERE_DOCUMENTOR) && !defined(ECERE_EPJ2MAKE)
 import "ide"
 #endif
 
index bbb7c7f..a8f5b37 100644 (file)
@@ -1,4 +1,4 @@
-#ifndef MAKEFILE_GENERATOR
+#if !defined(ECERE_DOCUMENTOR) && !defined(ECERE_EPJ2MAKE)
 import "ide"
 #else
 #ifdef ECERE_STATIC
@@ -10,17 +10,17 @@ import "ecere"
 import "Project"
 
 static define app = ((GuiApplication)__thisModule);
-#endif // #ifndef MAKEFILE_GENERATOR
+#endif
 
 #define OPTION(x) ((uint)(uintptr)(&((ProjectOptions)0).x))
 
 static void OutputLog(const char * string)
 {
-#ifdef MAKEFILE_GENERATOR
-   printf("%s", string);
-#else
+#if !defined(ECERE_DOCUMENTOR) && !defined(ECERE_EPJ2MAKE)
    ide.outputView.buildBox.Log(string);
-#endif // #ifdef MAKEFILE_GENERATOR
+#else
+   printf("%s", string);
+#endif
 }
 
 bool eString_PathInsideOfMore(const char * path, const char * of, char * pathRest)
@@ -1318,7 +1318,7 @@ private:
       return node;
    }
 
-#ifndef MAKEFILE_GENERATOR
+#if !defined(ECERE_DOCUMENTOR) && !defined(ECERE_EPJ2MAKE)
    void OnDisplay(Surface surface, int x, int y, int width, ProjectView projectView, Alignment alignment, DataDisplayFlags displayFlags)
    {
       char label[MAX_FILENAME];
@@ -1422,7 +1422,7 @@ private:
          }
       }
    }
-#endif // #ifndef MAKEFILE_GENERATOR
+#endif
 
    int OnCompare(ProjectNode b)
    {