+#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
if(path)
{
int len;
- len = strlen(path);
+ len = (int)strlen(path);
copy = CopyString(path);
if(len)
{
void RemoveTrailingPathSeparator(char *path)
{
int len;
- len = strlen(path);
+ len = (int)strlen(path);
if(len>1 && path[len-1] == DIR_SEP)
path[--len] = '\0';
}
void OnAskReloadSettings()
{
- /*if(MessageBox { type = YesNo, master = this,
- text = "Global Settings Modified Externally",
- contents = "The global settings were modified by another instance.\n"
- "Would you like to reload them?" }.Modal() == Yes)*/
+ FileSize newSettingsFileSize;
+
+ if(OpenAndLock(&newSettingsFileSize))
{
- double o, n;
- FileSize newSettingsFileSize;
- FileGetSize(settingsFilePath, &newSettingsFileSize);
- o = settingsFileSize;
- n = newSettingsFileSize;
- if(o - n < 2048)
+ if((double)settingsFileSize - (double)newSettingsFileSize < 2048)
Load();
else
{
GuiApplication app = ((GuiApplication)__thisModule.application);
Window w;
for(w = app.desktop.firstChild; w && (!w.created || !w.visible); w = w.next);
- MessageBox { master = w, type = ok,
+
+ CloseAndMonitor();
+
+ MessageBox { master = w, type = ok, isModal = true,
text = "Global Settings Modified Externally",
contents = "The global settings were modified by another process and a drastic shrinking of the settings file was detected.\n"
"The new settings will not be loaded to prevent loss of your ide settings.\n"
"Please check your settings file and make sure to save this IDE's global settings if your settings file has been compromised."
}.Create();
- //Save();
}
}
}
delete projectDefaultIntermediateObjDir;
delete compilerConfigsDir;
delete defaultCompiler;
+ delete language;
delete ideFileDialogLocation;
delete ideProjectFileDialogLocation;
{
if(value)
{
- Platform c;
+ CompilerType c;
for(c = firstCompilerType; c <= lastCompilerType; c++)
if(!strcmpi(value, compilerTypeNames[c]))
return c;
{ "English", ":countryCode/gb.png", "" },
{ "汉语", ":countryCode/cn.png", "zh_CN" },
{ "Español", ":countryCode/es.png", "es" },
+ { "Português (Brazil)", ":countryCode/br.png", "pt_BR" },
{ "Русский (43%)", ":countryCode/ru.png", "ru" },
- { "Português (28%)", ":countryCode/pt.png", "pt_BR" },
{ "Nederlandse (13%)", ":countryCode/nl.png", "nl" },
{ "Tiếng Việt (12%)", ":countryCode/vn.png", "vi" },
{ "मराठी (10%)", ":countryCode/in.png", "mr" },
String GetLanguageString()
{
- String language = getenv("LANGUAGE");
+ char * dot, * colon;
+ static char lang[256];
+ String language = getenv("ECERE_LANGUAGE");
+ if(!language) language = getenv("LANGUAGE");
if(!language) language = getenv("LC_ALL");
if(!language) language = getenv("LC_MESSAGES");
if(!language) language = getenv("LANG");
if(!language) language = "";
+ if(language && (colon = strchr(language, ':')))
+ {
+ if(lang != language)
+ strncpy(lang, language, sizeof(lang));
+ lang[sizeof(lang)-1] = 0;
+ lang[colon - language] = 0;
+ language = lang;
+ }
+ if(language && (dot = strchr(language, '.')))
+ {
+ if(lang != language)
+ strncpy(lang, language, sizeof(lang));
+ lang[sizeof(lang)-1] = 0;
+ lang[dot - language] = 0;
+ language = lang;
+ }
return language;
}
{
bool restart = true;
String command = null;
- int arg0Len = strlen(app.argv[0]);
+ int arg0Len = (int)strlen(app.argv[0]);
int len = arg0Len;
int j;
char ch;
strcat(command, " ");
len++;
ReplaceSpaces(command + len, name);
- len = strlen(command);
+ len = (int)strlen(command);
}
}
}
{
settings.language = code;
settingsContainer.Save();
+
+#if defined(__WIN32__)
+ // Set LANGUAGE environment variable
+ {
+ HKEY key = null;
+ uint16 wLanguage[256];
+ HRESULT status;
+ wLanguage[0] = 0;
+
+ RegCreateKeyEx(HKEY_CURRENT_USER, "Environment", 0, "", 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
+
if(eClass_IsDerived(app._class, class(GuiApplication)))
{
GuiApplication guiApp = (GuiApplication)app;
strcat(command, " ");
len++;
ReplaceSpaces(command + len, app.argv[i]);
- len = strlen(command);
+ len = (int)strlen(command);
}
}
if(restart)
{
- SetEnvironment("LANGUAGE", code);
+ SetEnvironment("ECERE_LANGUAGE", code);
if(wait)
ExecuteWait(command);
else