Set svn:eol-style

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36400 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2010-11-20 01:49:10 +00:00
parent bc05bc2c59
commit 6105773453

View File

@ -13,60 +13,60 @@ diff -riwbBuN -Xex aspell-0.60.4/common/aspell_win.cpp aspell-0.60.4-modified/co
--- aspell-0.60.4/common/aspell_win.cpp Thu Jan 1 01:00:00 1970
+++ aspell-0.60.4-modified/common/aspell_win.cpp Fri Jun 16 01:19:04 2006
@@ -0,0 +1,54 @@
+#ifdef _WIN32
+
+#include <windows.h>
+#include "string.hpp"
+
+namespace acommon {
+
+ String ReadRegString(HKEY hive, String key, String name)
+ {
+
+ // Reads a string from the Windows registry (used to get paths)
+
+ HKEY hKey;
+ unsigned long lType;
+ DWORD dwSize;
+ unsigned char* szValue = NULL;
+
+ if (::RegOpenKeyEx(hive, key.c_str(), 0, KEY_READ, &hKey) == ERROR_SUCCESS)
+ {
+ if(::RegQueryValueEx(hKey, name.c_str(), NULL, &lType, NULL, &dwSize) == ERROR_SUCCESS)
+ {
+ szValue = new unsigned char[dwSize + 1];
+ ::RegQueryValueEx(hKey, name.c_str(), NULL, &lType, szValue, &dwSize);
+ String RegistryReturn((char*)szValue);
+ delete[] szValue;
+ return RegistryReturn;
+ } else {
+ return "";
+ }
+ } else {
+ return "";
+ }
+
+ }
+
+ HKEY GetRegHive()
+ {
+
+ // Check whether Aspell is installed for the current user or for all users
+
+ String value;
+
+ if (ReadRegString(HKEY_LOCAL_MACHINE, "Software\\Aspell", "Dictionary Path") == "")
+ {
+ return HKEY_CURRENT_USER;
+ } else {
+ return HKEY_LOCAL_MACHINE;
+ }
+
+ }
+
+}
+
+#endif
+#ifdef _WIN32
+
+#include <windows.h>
+#include "string.hpp"
+
+namespace acommon {
+
+ String ReadRegString(HKEY hive, String key, String name)
+ {
+
+ // Reads a string from the Windows registry (used to get paths)
+
+ HKEY hKey;
+ unsigned long lType;
+ DWORD dwSize;
+ unsigned char* szValue = NULL;
+
+ if (::RegOpenKeyEx(hive, key.c_str(), 0, KEY_READ, &hKey) == ERROR_SUCCESS)
+ {
+ if(::RegQueryValueEx(hKey, name.c_str(), NULL, &lType, NULL, &dwSize) == ERROR_SUCCESS)
+ {
+ szValue = new unsigned char[dwSize + 1];
+ ::RegQueryValueEx(hKey, name.c_str(), NULL, &lType, szValue, &dwSize);
+ String RegistryReturn((char*)szValue);
+ delete[] szValue;
+ return RegistryReturn;
+ } else {
+ return "";
+ }
+ } else {
+ return "";
+ }
+
+ }
+
+ HKEY GetRegHive()
+ {
+
+ // Check whether Aspell is installed for the current user or for all users
+
+ String value;
+
+ if (ReadRegString(HKEY_LOCAL_MACHINE, "Software\\Aspell", "Dictionary Path") == "")
+ {
+ return HKEY_CURRENT_USER;
+ } else {
+ return HKEY_LOCAL_MACHINE;
+ }
+
+ }
+
+}
+
+#endif
diff -riwbBuN -Xex aspell-0.60.4/common/aspell_win.hpp aspell-0.60.4-modified/common/aspell_win.hpp
--- aspell-0.60.4/common/aspell_win.hpp Thu Jan 1 01:00:00 1970
+++ aspell-0.60.4-modified/common/aspell_win.hpp Thu Jun 15 15:33:58 2006
@ -96,7 +96,7 @@ diff -riwbBuN -Xex aspell-0.60.4/common/config.cpp aspell-0.60.4-modified/common
#include "string_list.hpp"
#include "gettext.h"
+#undef printf
+#undef printf
#include "iostream.hpp"
@ -107,7 +107,7 @@ diff -riwbBuN -Xex aspell-0.60.4/common/convert.cpp aspell-0.60.4-modified/commo
#include "iostream.hpp"
#include "gettext.h"
+#undef printf
+#undef printf
namespace acommon {
@ -118,7 +118,7 @@ diff -riwbBuN -Xex aspell-0.60.4/common/file_util.cpp aspell-0.60.4-modified/com
#ifdef WIN32
+# include "asc_ctype.hpp"
+# include "asc_ctype.hpp"
# include <io.h>
# define ACCESS _access
# include <windows.h>
@ -126,16 +126,16 @@ diff -riwbBuN -Xex aspell-0.60.4/common/gettext_init.cpp aspell-0.60.4-modified/
--- aspell-0.60.4/common/gettext_init.cpp Tue Nov 9 09:20:24 2004
+++ aspell-0.60.4-modified/common/gettext_init.cpp Thu Jun 15 15:31:02 2006
@@ -1,5 +1,13 @@
+#include "settings.h"
+#include "string.hpp"
+
+#ifdef _WIN32
+ #include <windows.h>
+ #include "aspell_win.hpp"
+#endif
+#include "settings.h"
+#include "string.hpp"
+
+#ifdef _WIN32
+ #include <windows.h>
+ #include "aspell_win.hpp"
+#endif
#include "gettext.h"
+#undef printf
+#undef printf
#if ENABLE_NLS
@ -148,21 +148,21 @@ diff -riwbBuN -Xex aspell-0.60.4/common/gettext_init.cpp aspell-0.60.4-modified/
if (did_init) return;
did_init = true;
- }
+
+#ifdef _WIN32
+ // Registry key for Locale Path
+
+ acommon::String value;
+ HKEY hive;
+
+ hive = acommon::GetRegHive();
+ value = acommon::ReadRegString(hive, "Software\\Aspell", "Locale Path");
+ if (value == "") value = LOCALEDIR;
+
+ bindtextdomain("aspell", value.c_str());
+#else
+
+#ifdef _WIN32
+ // Registry key for Locale Path
+
+ acommon::String value;
+ HKEY hive;
+
+ hive = acommon::GetRegHive();
+ value = acommon::ReadRegString(hive, "Software\\Aspell", "Locale Path");
+ if (value == "") value = LOCALEDIR;
+
+ bindtextdomain("aspell", value.c_str());
+#else
bindtextdomain("aspell", LOCALEDIR);
+#endif
+#endif
}
#else
@ -173,11 +173,11 @@ diff -riwbBuN -Xex aspell-0.60.4/common/info.cpp aspell-0.60.4-modified/common/i
/* BSDi defines u_intXX_t types in machine/types.h */
#include <machine/types.h>
#endif
+
+
#ifdef WIN32
# include <windows.h>
# include <winbase.h>
+#include "aspell_win.hpp"
+#include "aspell_win.hpp"
#endif
#include "iostream.hpp"
@ -185,7 +185,7 @@ diff -riwbBuN -Xex aspell-0.60.4/common/info.cpp aspell-0.60.4-modified/common/i
#include "string_map.hpp"
#include "gettext.h"
+#undef printf
+#undef printf
namespace acommon {
@ -193,23 +193,23 @@ diff -riwbBuN -Xex aspell-0.60.4/common/info.cpp aspell-0.60.4-modified/common/i
void get_data_dirs (Config * config,
StringList & lst)
{
+ String dictpath;
+ HKEY hive;
+
+ String dictpath;
+ HKEY hive;
+
lst.clear();
- lst.add(config->retrieve("data-dir"));
+
+ hive = GetRegHive();
+
+#ifdef _WIN32
+ // Registry key for dictionary path
+ dictpath = ReadRegString(hive, "Software\\Aspell", "Dictionary Path");;
+ if (dictpath == "") dictpath = config->retrieve("data-dir");
+#else
+ dictpath = config->retrieve("data-dir");
+#endif
+
+ lst.add(dictpath);
+
+ hive = GetRegHive();
+
+#ifdef _WIN32
+ // Registry key for dictionary path
+ dictpath = ReadRegString(hive, "Software\\Aspell", "Dictionary Path");;
+ if (dictpath == "") dictpath = config->retrieve("data-dir");
+#else
+ dictpath = config->retrieve("data-dir");
+#endif
+
+ lst.add(dictpath);
lst.add(config->retrieve("dict-dir"));
}
@ -220,7 +220,7 @@ diff -riwbBuN -Xex aspell-0.60.4/common/posib_err.cpp aspell-0.60.4-modified/com
#include "posib_err.hpp"
#include "gettext.h"
+#undef printf
+#undef printf
namespace acommon {
@ -232,11 +232,11 @@ diff -riwbBuN -Xex aspell-0.60.4/modules/speller/default/language.cpp aspell-0.6
#ifdef ENABLE_NLS
-# include <langinfo.h>
+//#include <langinfo.h>
+//#include <langinfo.h>
#endif
#include "gettext.h"
+#undef printf
+#undef printf
namespace aspeller {
@ -247,7 +247,7 @@ diff -riwbBuN -Xex aspell-0.60.4/prog/aspell.cpp aspell-0.60.4-modified/prog/asp
#include "hash_fun.hpp"
#include "gettext.h"
+#undef printf
+#undef printf
using namespace acommon;