Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Clitherow <aphex@nildram.co.uk>2003-05-22 22:06:25 +0400
committerSimon Clitherow <aphex@nildram.co.uk>2003-05-22 22:06:25 +0400
commitd617df479310b39c8f0ba8f1cbd57bc29d95a8f9 (patch)
treedd944f5543f13d11b4fbf6be3357685b508bb88f
parentb8f2835ba28e7dec09086599127c48b54c9fd3e7 (diff)
- fixed 'double-click on blend file' errors on Windows -- INTERNATIONAL stuff now also checks the installation directory for /.blender, etc
- registering .blend files for WinNT/2000/XP now works correctly (settings remain after a reboot).
-rw-r--r--projectfiles/blender/blenlib/BLI_blenlib.dsp6
-rw-r--r--source/blender/blenlib/BLI_blenlib.h4
-rw-r--r--source/blender/blenlib/intern/Makefile2
-rw-r--r--source/blender/blenlib/intern/winstuff.c44
-rw-r--r--source/blender/ftfont/intern/FTF_TTFont.cpp12
-rw-r--r--source/blender/src/language.c19
6 files changed, 74 insertions, 13 deletions
diff --git a/projectfiles/blender/blenlib/BLI_blenlib.dsp b/projectfiles/blender/blenlib/BLI_blenlib.dsp
index 7e33db88453..12564e4f24c 100644
--- a/projectfiles/blender/blenlib/BLI_blenlib.dsp
+++ b/projectfiles/blender/blenlib/BLI_blenlib.dsp
@@ -44,8 +44,7 @@ RSC=rc.exe
# PROP Target_Dir ""
LINK32=link.exe -lib
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\..\lib\windows\guardedalloc\include" /I "..\..\..\..\lib\windows\freetype\include" /I "..\..\..\source\blender\include" /I "..\..\..\source\blender\blenlib" /I "..\..\..\source\blender\bpython\include" /I "..\..\..\source\blender\makesdna" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "WITH_FREETYPE2" /J /FD /c
-# SUBTRACT CPP /YX
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\..\lib\windows\guardedalloc\include" /I "..\..\..\..\lib\windows\freetype\include" /I "..\..\..\source\blender\include" /I "..\..\..\source\blender\blenlib" /I "..\..\..\source\blender\blenkernel" /I "..\..\..\source\blender\bpython\include" /I "..\..\..\source\blender\makesdna" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "WITH_FREETYPE2" /J /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
@@ -69,8 +68,7 @@ LIB32=link.exe -lib
# PROP Target_Dir ""
LINK32=link.exe -lib
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\..\lib\windows\guardedalloc\include" /I "..\..\..\source\blender\blenlib" /I "..\..\..\source\blender\bpython\include" /I "..\..\..\source\blender\makesdna" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /J /FD /GZ /c
-# SUBTRACT CPP /Fr /YX
+# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\..\lib\windows\guardedalloc\include" /I "..\..\..\source\blender\blenlib" /I "..\..\..\source\blender\blenkernel" /I "..\..\..\source\blender\bpython\include" /I "..\..\..\source\blender\makesdna" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /J /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h
index 8d07c7668f8..e56b44902d7 100644
--- a/source/blender/blenlib/BLI_blenlib.h
+++ b/source/blender/blenlib/BLI_blenlib.h
@@ -211,6 +211,10 @@ void BLI_where_am_i(char *fullname, char *name);
#ifdef __APPLE__
char* BLI_getbundle(void);
#endif
+
+#ifdef WIN32
+int BLI_getInstallationDir( char * str );
+#endif
/* BLI_storage.h */
int BLI_filesize(int file);
diff --git a/source/blender/blenlib/intern/Makefile b/source/blender/blenlib/intern/Makefile
index 9067b98d270..7ce3441d875 100644
--- a/source/blender/blenlib/intern/Makefile
+++ b/source/blender/blenlib/intern/Makefile
@@ -51,6 +51,8 @@ CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
# path to freetype font stuff
CPPFLAGS += -I$(NAN_FREETYPE)/include
CPPFLAGS += -I$(NAN_FREETYPE)/include/freetype2
+# path to blenkernel
+CPPFLAGS += -I$(SRCHOME)/blender/blenkernel
CPPFLAGS += -I../../include/
ifdef WITH_FREETYPE2
diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c
index a0fb005e992..2a69bf0b1e5 100644
--- a/source/blender/blenlib/intern/winstuff.c
+++ b/source/blender/blenlib/intern/winstuff.c
@@ -46,15 +46,53 @@
#include "BLI_util.h"
#include "BLI_winstuff.h"
+#include "BKE_utildefines.h" /* FILE_MAXDIR + FILE_MAXFILE */
+
+int BLI_getInstallationDir( char * str ) {
+ LONG lresult;
+ HKEY hkey = 0;
+ LONG type;
+ char buffer[FILE_MAXDIR+FILE_MAXFILE];
+ DWORD size;
+
+ size = sizeof(buffer);
+
+ lresult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\BlenderFoundation", 0,
+ KEY_ALL_ACCESS, &hkey);
+
+ if (lresult == ERROR_SUCCESS) {
+ lresult = RegQueryValueEx(hkey, "Install_Dir", 0, NULL, (LPBYTE)buffer, &size);
+ strcpy(str, buffer);
+ RegCloseKey(hkey);
+ return 1;
+ }
+ else
+ return 0;
+}
+
void RegisterBlendExtension(char * str) {
LONG lresult;
HKEY hkey = 0;
DWORD dwd = 0;
+ char *dir;
char buffer[128];
+
+ /* Add installation dir to registry --aphex */
+
+ strncpy(dir, str, strlen(str)-11);
+
+ lresult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\BlenderFoundation", 0,
+ "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
+
+ if (lresult == ERROR_SUCCESS) {
+ if (dwd != REG_OPENED_EXISTING_KEY)
+ lresult = RegSetValueEx(hkey, "Install_Dir", 0, REG_SZ, dir, strlen(dir)+1);
+ RegCloseKey(hkey);
+ }
lresult = RegCreateKeyEx(HKEY_CLASSES_ROOT, "blendfile\\shell\\open\\command", 0,
- "", REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
+ "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
if (lresult == ERROR_SUCCESS) {
sprintf(buffer, "\"%s\" \"%%1\"", str);
@@ -63,7 +101,7 @@ void RegisterBlendExtension(char * str) {
}
lresult = RegCreateKeyEx(HKEY_CLASSES_ROOT, "blendfile\\DefaultIcon", 0,
- "", REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
+ "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
if (lresult == ERROR_SUCCESS) {
sprintf(buffer, "\"%s\",1", str);
@@ -72,7 +110,7 @@ void RegisterBlendExtension(char * str) {
}
lresult = RegCreateKeyEx(HKEY_CLASSES_ROOT, ".blend", 0,
- "", REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
+ "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
if (lresult == ERROR_SUCCESS) {
sprintf(buffer, "%s", "blendfile");
diff --git a/source/blender/ftfont/intern/FTF_TTFont.cpp b/source/blender/ftfont/intern/FTF_TTFont.cpp
index 50839c44063..6f50c2e0841 100644
--- a/source/blender/ftfont/intern/FTF_TTFont.cpp
+++ b/source/blender/ftfont/intern/FTF_TTFont.cpp
@@ -43,8 +43,6 @@
#include "BKE_utildefines.h"
#endif
-#include "BLI_blenlib.h"
-
#define DOMAIN_NAME "blender"
#define SYSTEM_ENCODING_DEFAULT "UTF-8"
@@ -117,6 +115,13 @@ FTF_TTFont::FTF_TTFont(void)
BLI_make_file_string("/", messagepath, BLI_gethome(), ".blender/locale");
if(BLI_exist(messagepath) == NULL) { // locale not in home dir
+
+#ifdef WIN32
+ /* message catalogs are stored in the installation dir */
+ BLI_getInstallationDir(messagepath);
+ strcat(messagepath, "/.blender/locale");
+ if(BLI_exist(messagepath) == NULL) {
+#endif
#ifdef __APPLE__
/* message catalogs are stored inside the application bundle */
bundlepath = BLI_getbundle();
@@ -129,6 +134,9 @@ FTF_TTFont::FTF_TTFont(void)
if(BLI_exist(messagepath) == NULL) { // locale not in LOCALEDIR
strcpy(messagepath, "message"); // old compatibility as last
}
+#ifdef WIN32
+ }
+#endif
#ifdef __APPLE__
}
#endif
diff --git a/source/blender/src/language.c b/source/blender/src/language.c
index 416b87f8a28..75973174154 100644
--- a/source/blender/src/language.c
+++ b/source/blender/src/language.c
@@ -41,6 +41,7 @@
#include "BLI_blenlib.h"
#include "BLI_linklist.h" /* linknode */
+#include "BLI_winstuff.h"
#include "BIF_language.h"
#include "BIF_space.h" /* allqueue() */
@@ -174,7 +175,7 @@ void start_interface_font(void) {
U.fontsize= 11;
U.encoding= 0;
-#ifdef __APPLE__
+#if defined (__APPLE__)
bundlepath = BLI_getbundle();
strcpy(tstr, bundlepath);
strcat(tstr, "/Contents/Resources/");
@@ -182,6 +183,12 @@ void start_interface_font(void) {
result = FTF_SetFont(tstr, U.fontsize);
sprintf(U.fontname, ".blender/.bfont.ttf\0");
+#elif defined (WIN32)
+ BLI_getInstallationDir(tstr);
+ strcat(tstr, "/.blender/.bfont.ttf\0");
+ result = FTF_SetFont(tstr, U.fontsize);
+
+ sprintf(U.fontname, ".blender/.bfont.ttf\0");
#else
sprintf(U.fontname, ".blender/.bfont.ttf\0");
@@ -273,10 +280,14 @@ int read_languagefile(void) {
if(lines == NULL) {
/* If not found in home, try current dir
* (Resources folder of app bundle on OS X) */
-#ifdef __APPLE__
+#if defined (__APPLE__)
char *bundlePath = BLI_getbundle();
strcpy(name, bundlePath);
strcat(name, "/Contents/Resources/.Blanguages");
+#elif defined (WIN32)
+ /* Check the installation dir in Windows */
+ BLI_getInstallationDir(name);
+ strcat(name,"/.blender/.Blanguages");
#else
strcpy(name, ".blender/.Blanguages");
#endif
@@ -287,8 +298,8 @@ int read_languagefile(void) {
strcpy(name, ".Blanguages");
lines= BLI_read_file_as_lines(name);
if(lines == NULL) {
- error("File \".Blanguages\" not found");
- return 0;
+ error("File \".Blanguages\" not found");
+ return 0;
}
}
}