summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-03-14 21:31:42 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-03-14 21:31:42 +0000
commit68f067fecf589ad0637229ce4a2e1185f140465a (patch)
tree906d6995e104872ccb81bb96edd8a0ce31e43d80
parent50944d3a2afb0f19b0f7a0182f9cab6294a954ba (diff)
LangMan:
- all langpacks stored in Languages folders - langpacks from root will be moved in Languages folders - added langpack changing at runtime - added langpack loading on miranda start git-svn-id: http://svn.miranda-ng.org/main/trunk@8607 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/LangMan/langman_10.vcxproj2
-rw-r--r--plugins/LangMan/langman_10.vcxproj.filters6
-rw-r--r--plugins/LangMan/langman_12.vcxproj2
-rw-r--r--plugins/LangMan/langman_12.vcxproj.filters6
-rw-r--r--plugins/LangMan/res/resource.rc209
-rw-r--r--plugins/LangMan/src/common.h1
-rw-r--r--plugins/LangMan/src/langpack.cpp177
-rw-r--r--plugins/LangMan/src/langpack.h15
-rw-r--r--plugins/LangMan/src/main.cpp121
-rw-r--r--plugins/LangMan/src/options.cpp96
-rw-r--r--plugins/LangMan/src/resource.h9
-rw-r--r--plugins/LangMan/src/utils.cpp67
-rw-r--r--plugins/LangMan/src/utils.h23
-rw-r--r--plugins/LangMan/src/version.h18
14 files changed, 225 insertions, 527 deletions
diff --git a/plugins/LangMan/langman_10.vcxproj b/plugins/LangMan/langman_10.vcxproj
index 05fd96e8be..1d01ab5cb7 100644
--- a/plugins/LangMan/langman_10.vcxproj
+++ b/plugins/LangMan/langman_10.vcxproj
@@ -197,13 +197,11 @@
</ClCompile>
<ClCompile Include="src\options.cpp" />
<ClCompile Include="src\main.cpp" />
- <ClCompile Include="src\utils.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\common.h" />
<ClInclude Include="src\langpack.h" />
<ClInclude Include="src\options.h" />
- <ClInclude Include="src\utils.h" />
<ClInclude Include="src\resource.h" />
<ClInclude Include="src\version.h" />
</ItemGroup>
diff --git a/plugins/LangMan/langman_10.vcxproj.filters b/plugins/LangMan/langman_10.vcxproj.filters
index 6d7cbca488..31f26531ec 100644
--- a/plugins/LangMan/langman_10.vcxproj.filters
+++ b/plugins/LangMan/langman_10.vcxproj.filters
@@ -24,9 +24,6 @@
<ClCompile Include="src\options.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\utils.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -41,9 +38,6 @@
<ClInclude Include="src\options.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="src\utils.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="src\version.h">
<Filter>Header Files</Filter>
</ClInclude>
diff --git a/plugins/LangMan/langman_12.vcxproj b/plugins/LangMan/langman_12.vcxproj
index b012762b20..860d6ce922 100644
--- a/plugins/LangMan/langman_12.vcxproj
+++ b/plugins/LangMan/langman_12.vcxproj
@@ -200,13 +200,11 @@
</ClCompile>
<ClCompile Include="src\options.cpp" />
<ClCompile Include="src\main.cpp" />
- <ClCompile Include="src\utils.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\common.h" />
<ClInclude Include="src\langpack.h" />
<ClInclude Include="src\options.h" />
- <ClInclude Include="src\utils.h" />
<ClInclude Include="src\resource.h" />
<ClInclude Include="src\version.h" />
</ItemGroup>
diff --git a/plugins/LangMan/langman_12.vcxproj.filters b/plugins/LangMan/langman_12.vcxproj.filters
index 6d7cbca488..31f26531ec 100644
--- a/plugins/LangMan/langman_12.vcxproj.filters
+++ b/plugins/LangMan/langman_12.vcxproj.filters
@@ -24,9 +24,6 @@
<ClCompile Include="src\options.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\utils.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -41,9 +38,6 @@
<ClInclude Include="src\options.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="src\utils.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="src\version.h">
<Filter>Header Files</Filter>
</ClInclude>
diff --git a/plugins/LangMan/res/resource.rc b/plugins/LangMan/res/resource.rc
index a5a527d59d..ac2d4a14c2 100644
--- a/plugins/LangMan/res/resource.rc
+++ b/plugins/LangMan/res/resource.rc
@@ -1,4 +1,4 @@
-//Microsoft Developer Studio generated resource script.
+// Microsoft Visual C++ generated resource script.
//
#include "..\src\resource.h"
@@ -13,179 +13,100 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-// Englisch (GB) resources
+// Neutral resources
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
-#pragma code_page(1252)
-#endif //_WIN32
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+#pragma code_page(1251)
-#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
-// TEXTINCLUDE
+// Dialog
//
-1 TEXTINCLUDE
+IDD_OPT_LANG DIALOGEX 0, 0, 301, 232
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- "..\\src\\resource.h\0"
+ CONTROL "",IDC_LANGLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_GROUP | WS_TABSTOP,2,43,299,61
+ GROUPBOX "",IDC_LANGINFOFRAME,2,108,298,95,WS_GROUP
+ RTEXT "Author(s):",IDC_LANGAUTHORSLABEL,5,118,76,9,SS_NOPREFIX
+ EDITTEXT IDC_LANGAUTHORS,86,118,208,18,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | NOT WS_BORDER | WS_VSCROLL
+ RTEXT "E-mail:",IDC_LANGEMAILLABEL,5,139,76,8,SS_NOPREFIX
+ CONTROL "",IDC_LANGEMAIL,"Hyperlink",WS_TABSTOP,86,139,208,10
+ RTEXT "Last modified using:",IDC_LANGMODUSINGLABEL,9,152,72,9,SS_NOPREFIX
+ EDITTEXT IDC_LANGMODUSING,86,152,196,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ RTEXT "Date:",IDC_LANGDATELABEL,5,165,76,9,SS_NOPREFIX
+ EDITTEXT IDC_LANGDATE,86,165,66,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ RTEXT "Version:",IDC_LANGVERSIONLABEL,161,165,39,9,SS_NOPREFIX | NOT WS_VISIBLE
+ EDITTEXT IDC_LANGVERSION,205,165,77,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_VISIBLE | NOT WS_BORDER
+ RTEXT "Locale:",IDC_LANGLOCALELABEL,5,177,76,9,SS_NOPREFIX
+ EDITTEXT IDC_LANGLOCALE,86,177,196,12,ES_READONLY | NOT WS_BORDER
+ CONTROL "Download more Language Packs",IDC_MORELANG,"Hyperlink",WS_GROUP | WS_TABSTOP | 0x1,2,207,299,10
+ CTEXT "Please restart Miranda NG for your changes to take full effect.",IDC_RESTART,5,218,296,9,SS_NOPREFIX | NOT WS_VISIBLE
+ LTEXT "Static",IDC_LANGROOTFOLDER,7,10,277,25
+ GROUPBOX "Langpack root folder",IDC_STATIC,2,0,299,39
END
-2 TEXTINCLUDE
-BEGIN
- "#include <winres.h>\r\n"
- "\0"
-END
-3 TEXTINCLUDE
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
BEGIN
- "\r\n"
- "\0"
+ IDD_OPT_LANG, DIALOG
+ BEGIN
+ VERTGUIDE, 2
+ VERTGUIDE, 81
+ VERTGUIDE, 86
+ VERTGUIDE, 282
+ VERTGUIDE, 294
+ BOTTOMMARGIN, 227
+ END
END
-
#endif // APSTUDIO_INVOKED
+#endif // Neutral resources
/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-IDI_RELOAD ICON "reload.ico"
/////////////////////////////////////////////////////////////////////////////
+// English (United Kingdom) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
+#pragma code_page(1252)
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
//
-// Dialog
+// TEXTINCLUDE
//
-/*IDD_UPDATENOTIFY DIALOGEX 0, 0, 259, 115
-STYLE DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE |
- WS_CAPTION | WS_SYSMENU
-CAPTION "Language Pack Update Now Available"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
+1 TEXTINCLUDE
BEGIN
- LTEXT "A new version of a Language Pack is now available. Click the install button to download and install this new update.",
- IDC_STATIC, 8, 7, 243, 21, SS_NOPREFIX
- CONTROL "Language:", IDC_LANGUAGELABEL, "Static", SS_SIMPLE |
- SS_NOPREFIX | WS_GROUP, 8, 29, 65, 8
- EDITTEXT IDC_LANGUAGE, 78, 29, 173, 8, ES_AUTOHSCROLL | ES_READONLY |
- NOT WS_BORDER
- CONTROL "Current:", IDC_STATIC, "Static", SS_SIMPLE | SS_NOPREFIX |
- WS_GROUP, 8, 43, 65, 8
- EDITTEXT IDC_CURRENTVERSION, 78, 43, 173, 8, ES_AUTOHSCROLL |
- ES_READONLY | NOT WS_BORDER
- CONTROL "New:", IDC_NEWVERSIONLABEL, "Static", SS_SIMPLE |
- SS_NOPREFIX | WS_GROUP, 8, 58, 65, 8
- EDITTEXT IDC_NEWVERSION, 78, 58, 173, 8, ES_AUTOHSCROLL | ES_READONLY |
- NOT WS_BORDER
- PUSHBUTTON "&Install Now", IDOK, 7, 73, 66, 15, WS_GROUP
- CONTROL "", IDC_STATIC, "Static", SS_ETCHEDHORZ, 7, 92, 245, 1
- DEFPUSHBUTTON "Close", IDCANCEL, 202, 96, 50, 15
+ "..\\src\\resource.h\0"
END
-IDD_DOWNLOADLANG DIALOG DISCARDABLE 0, 0, 200, 126
-STYLE DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE |
- WS_CAPTION | WS_SYSMENU
-CAPTION "Select your language"
-FONT 8, "MS Shell Dlg"
-BEGIN
- LTEXT "Miranda NG is available in many languages.\nHere is a list of all available languages of the file listing, please select your native &language:",
- IDC_STATIC, 5, 5, 189, 26
- COMBOBOX IDC_LANGCOMBO, 46, 36, 106, 126, CBS_DROPDOWNLIST |
- CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP
- CONTROL "Download &all languages", IDC_DOWNLOADALL, "Button",
- BS_AUTOCHECKBOX | WS_TABSTOP, 46, 53, 148, 10
- LTEXT "Note: This will download and install the newest language pack available for the selected language. There might be language packs from other authors available on the file listing.",
- IDC_STATIC, 5, 69, 189, 34, SS_NOPREFIX | WS_DISABLED
- CTEXT "", IDC_LOADING, 1, 109, 86, 8, SS_NOPREFIX | SS_CENTERIMAGE |
- NOT WS_VISIBLE
- PUSHBUTTON "OK", IDOK, 89, 106, 50, 14, WS_DISABLED
- DEFPUSHBUTTON "Cancel", IDCANCEL, 144, 106, 50, 15
-END*/
-
-IDD_OPT_LANG DIALOGEX 0, 0, 301, 227
-STYLE DS_FIXEDSYS | WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg"
+2 TEXTINCLUDE
BEGIN
- CONTROL "", IDC_LANGLIST, "SysListView32", LVS_REPORT |
- LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER |
- WS_BORDER | WS_GROUP | WS_TABSTOP, 2, 3, 299, 61
- GROUPBOX "", IDC_LANGINFOFRAME, 2, 68, 298, 119, WS_GROUP
- RTEXT "Author(s):", IDC_LANGAUTHORSLABEL, 5, 78, 66, 9, SS_NOPREFIX
- EDITTEXT IDC_LANGAUTHORS, 74, 78, 220, 18, ES_MULTILINE |
- ES_AUTOVSCROLL | ES_READONLY | NOT WS_BORDER |
- WS_VSCROLL
- RTEXT "E-mail:", IDC_LANGEMAILLABEL, 5, 99, 66, 8, SS_NOPREFIX
- CONTROL "", IDC_LANGEMAIL, "Hyperlink", WS_TABSTOP, 76, 99, 207, 10
- RTEXT "Last modified using:", IDC_LANGMODUSINGLABEL, 5, 112, 66, 9,
- SS_NOPREFIX
- EDITTEXT IDC_LANGMODUSING, 75, 112, 207, 12, ES_AUTOHSCROLL |
- ES_READONLY | NOT WS_BORDER
- RTEXT "Date:", IDC_LANGDATELABEL, 5, 125, 66, 9, SS_NOPREFIX
- EDITTEXT IDC_LANGDATE, 75, 125, 66, 12, ES_AUTOHSCROLL | ES_READONLY |
- NOT WS_BORDER
- RTEXT "Version:", IDC_LANGVERSIONLABEL, 150, 125, 39, 9, SS_NOPREFIX |
- NOT WS_VISIBLE
- EDITTEXT IDC_LANGVERSION, 194, 125, 88, 12, ES_AUTOHSCROLL |
- ES_READONLY | NOT WS_VISIBLE | NOT WS_BORDER
- RTEXT "Locale:", IDC_LANGLOCALELABEL, 5, 137, 66, 9, SS_NOPREFIX
- EDITTEXT IDC_LANGLOCALE, 75, 137, 207, 12, ES_READONLY | NOT WS_BORDER
- /* RTEXT "Not included:", IDC_LANGNOTINCLUDEDLABEL, 5, 150, 66, 10,
- SS_NOPREFIX
- LISTBOX IDC_LANGNOTINCLUDED, 75, 150, 219, 33, NOT LBS_NOTIFY |
- LBS_SORT | LBS_HASSTRINGS | LBS_USETABSTOPS |
- LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | NOT
- WS_BORDER | WS_VSCROLL | WS_TABSTOP, WS_EX_TRANSPARENT*/
- CONTROL "Download more Language Packs", IDC_MORELANG, "Hyperlink",
- WS_GROUP | WS_TABSTOP | 0x1, 2, 189, 299, 10
- CTEXT "Please restart Miranda NG for your changes to take effect.",
- IDC_RESTART, 5, 200, 296, 9, SS_NOPREFIX | NOT WS_VISIBLE
- /* CONTROL "Check for new &versions of Language Packs periodically",
- IDC_ENABLEAUTOUPDATES, "Button", BS_AUTOCHECKBOX |
- WS_GROUP | WS_TABSTOP, 2, 214, 209, 10
- PUSHBUTTON "&Download Language", IDC_DOWNLOADLANG, 213, 213, 86, 14,
- WS_GROUP*/
+ "#include <winres.h>\r\n"
+ "\0"
END
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO MOVEABLE PURE
+3 TEXTINCLUDE
BEGIN
- /* IDD_UPDATENOTIFY, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 252
- VERTGUIDE, 74
- TOPMARGIN, 7
- END
-
- IDD_DOWNLOADLANG, DIALOG
- BEGIN
- VERTGUIDE, 5
- VERTGUIDE, 46
- VERTGUIDE, 194
- HORZGUIDE, 106
- HORZGUIDE, 121
- END*/
-
- IDD_OPT_LANG, DIALOG
- BEGIN
- VERTGUIDE, 2
- VERTGUIDE, 70
- VERTGUIDE, 75
- VERTGUIDE, 282
- VERTGUIDE, 294
- HORZGUIDE, 160
- END
+ "\r\n"
+ "\0"
END
+
#endif // APSTUDIO_INVOKED
-#endif // Englisch (GB) resources
+#endif // English (United Kingdom) resources
/////////////////////////////////////////////////////////////////////////////
@@ -196,5 +117,7 @@ END
// Generated from the TEXTINCLUDE 3 resource.
//
+
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
+
diff --git a/plugins/LangMan/src/common.h b/plugins/LangMan/src/common.h
index d3cd0a1397..2afafaff9d 100644
--- a/plugins/LangMan/src/common.h
+++ b/plugins/LangMan/src/common.h
@@ -38,7 +38,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "langpack.h"
#include "options.h"
-#include "utils.h"
#include "resource.h"
#include "version.h"
diff --git a/plugins/LangMan/src/langpack.cpp b/plugins/LangMan/src/langpack.cpp
index 1fb31928de..cab1a6d116 100644
--- a/plugins/LangMan/src/langpack.cpp
+++ b/plugins/LangMan/src/langpack.cpp
@@ -128,8 +128,8 @@ static void CleanupLastModifiedUsing(char *szLastModifiedUsing, int nSize)
if (p!=NULL) MoveMemory(p+1, p+2, lstrlenA(p+2)+1);
/* default if empty */
if (!szLastModifiedUsing[0]) {
- lstrcpynA(szLastModifiedUsing, MIRANDANAME" ", nSize);
- CallService(MS_SYSTEM_GETVERSIONTEXT, nSize-lstrlenA(szLastModifiedUsing), (LPARAM)szLastModifiedUsing+lstrlenA(szLastModifiedUsing));
+ DWORD v = CallService(MS_SYSTEM_GETVERSION, 0, 0);
+ mir_snprintf(szLastModifiedUsing, nSize, "%d.%d.%d.%d", ((v >> 24) & 0xFF), ((v >> 16) & 0xFF), ((v >> 8) & 0xFF), (v & 0xFF));
}
}
@@ -246,7 +246,7 @@ BOOL GetPackPath(TCHAR *pszPath, int nSize, BOOL fEnabledPacks, const TCHAR *psz
/* subdirectory */
if (!fEnabledPacks) {
if (nSize<(lstrlen(pszPath)+10)) return FALSE;
- lstrcat(pszPath, _T("Plugins\\Language\\"));
+ lstrcat(pszPath, _T("Languages\\"));
}
/* file name */
if (pszFile!=NULL) {
@@ -258,7 +258,7 @@ BOOL GetPackPath(TCHAR *pszPath, int nSize, BOOL fEnabledPacks, const TCHAR *psz
// callback is allowed to be NULL
// returns TRUE if any pack exists except default
-BOOL EnumPacks(ENUM_PACKS_CALLBACK callback, const TCHAR *pszFilePattern, const char *pszFileVersionHeader, BOOL fEnglishDefault, WPARAM wParam, LPARAM lParam)
+BOOL EnumPacks(ENUM_PACKS_CALLBACK callback, const TCHAR *pszFilePattern, const char *pszFileVersionHeader, WPARAM wParam, LPARAM lParam)
{
BOOL fPackFound = FALSE;
BOOL res = FALSE;
@@ -266,6 +266,8 @@ BOOL EnumPacks(ENUM_PACKS_CALLBACK callback, const TCHAR *pszFilePattern, const
WIN32_FIND_DATA wfd;
HANDLE hFind;
+ mir_ptr<TCHAR> langpack(db_get_tsa(NULL, "LangMan", "Langpack"));
+
/* enabled packs */
if (GetPackPath(pack.szFileName, SIZEOF(pack.szFileName), TRUE, pszFilePattern)) {
hFind = FindFirstFile(pack.szFileName, &wfd);
@@ -279,8 +281,10 @@ BOOL EnumPacks(ENUM_PACKS_CALLBACK callback, const TCHAR *pszFilePattern, const
if (LoadPackData(&pack, TRUE, pszFileVersionHeader)) {
pack.ftFileDate = wfd.ftLastWriteTime;
/* enabled? */
- if (!fPackFound) pack.flags |= LPF_ENABLED;
- fPackFound = TRUE;
+ if (!langpack) {
+ if (!fPackFound) pack.flags |= LPF_ENABLED;
+ fPackFound = TRUE;
+ }
/* callback */
if (callback!=NULL) res = callback(&pack, wParam, lParam);
if (!res) { FindClose(hFind); return FALSE; }
@@ -290,30 +294,6 @@ BOOL EnumPacks(ENUM_PACKS_CALLBACK callback, const TCHAR *pszFilePattern, const
}
}
- /* default: English (GB) */
- if (fEnglishDefault && callback!=NULL) {
- ZeroMemory(&pack, sizeof(pack));
- pack.Locale = LOCALE_USER_DEFAULT; /* miranda uses default locale in this case */
- lstrcpy(pack.szLanguage, _T("English (default)")); /* buffer safe */
- lstrcpyA(pack.szAuthors, "Miranda NG Development Team"); /* buffer safe */
- lstrcpyA(pack.szAuthorEmail, "project-info at miranda-ng.org"); /* buffer safe */
- CleanupEmail(pack.szAuthorEmail); /* correct " at " */
- CleanupLastModifiedUsing(pack.szLastModifiedUsing, sizeof(pack.szLastModifiedUsing));
- /* file date */
- if (GetModuleFileName(NULL, pack.szFileName, SIZEOF(pack.szFileName))) {
- HANDLE hFile;
- hFile = CreateFile(pack.szFileName, 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
- if (hFile!=INVALID_HANDLE_VALUE) {
- GetFileTime(hFile, NULL, NULL, &pack.ftFileDate);
- CloseHandle(hFile);
- }
- }
- pack.flags = LPF_NOLOCALE|LPF_DEFAULT;
- if (!fPackFound) pack.flags |= LPF_ENABLED;
- /* callback */
- if (!callback(&pack, wParam, lParam)) return FALSE;
- }
-
/* disabled packs */
if (GetPackPath(pack.szFileName, SIZEOF(pack.szFileName), FALSE, pszFilePattern)) {
hFind = FindFirstFile(pack.szFileName, &wfd);
@@ -326,7 +306,13 @@ BOOL EnumPacks(ENUM_PACKS_CALLBACK callback, const TCHAR *pszFilePattern, const
lstrcpy(pack.szFileName, CharLower(wfd.cFileName)); /* buffer safe */
if (LoadPackData(&pack, FALSE, pszFileVersionHeader)) {
pack.ftFileDate = wfd.ftLastWriteTime;
- fPackFound = TRUE;
+ /* enabled? */
+ if (langpack) {
+ if (!_tcscmp(pack.szFileName, langpack)) {
+ if (!fPackFound) pack.flags |= LPF_ENABLED;
+ fPackFound = TRUE;
+ }
+ }
/* callback */
if (callback!=NULL) res = callback(&pack, wParam, lParam);
if (!res) { FindClose(hFind); return FALSE; }
@@ -335,65 +321,36 @@ BOOL EnumPacks(ENUM_PACKS_CALLBACK callback, const TCHAR *pszFilePattern, const
FindClose(hFind);
}
}
- return fPackFound;
-}
-
-BOOL IsPluginIncluded(const LANGPACK_INFO *pack, char *pszFileBaseName)
-{
- char *p;
- if (!lstrcmpiA(pszFileBaseName, "png2dib") || !lstrcmpiA(pszFileBaseName, "loadavatars"))
- return TRUE; /* workaround: does not need no translation */
- for(p = (char*)pack->szPluginsIncluded;;) {
- p = strstr(p, CharLowerA(pszFileBaseName));
- if (p == NULL) return FALSE;
- if (p == pack->szPluginsIncluded || *(p-1) == ' ' || *(p-1) == ',') {
- p+=lstrlenA(pszFileBaseName)+1;
- if (*p == ',' || *p == ' ' || *p == 0) return TRUE;
- }
- else p+=lstrlenA(pszFileBaseName)+1;
- }
-}
-
-/************************* Switch *************************************/
-BOOL EnablePack(const LANGPACK_INFO *pack, const TCHAR *pszFilePattern)
-{
- TCHAR szFrom[MAX_PATH], szDest[MAX_PATH];
- HANDLE hFind;
- WIN32_FIND_DATA wfd;
-
- /* disable previous pack */
- if (GetPackPath(szFrom, SIZEOF(szFrom), TRUE, pszFilePattern)) {
- hFind = FindFirstFile(szFrom, &wfd);
- if (hFind!=INVALID_HANDLE_VALUE) {
- do {
- if (wfd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) continue;
- if (lstrlen(wfd.cFileName)<4 || wfd.cFileName[lstrlen(wfd.cFileName)-4]!=_T('.')) continue;
- /* ensure dir exists */
- if (GetPackPath(szFrom, SIZEOF(szFrom), FALSE, NULL))
- CreateDirectory(szFrom, NULL);
- /* move file */
- if (GetPackPath(szFrom, SIZEOF(szFrom), TRUE, wfd.cFileName))
- if (GetPackPath(szDest, SIZEOF(szDest), FALSE, wfd.cFileName))
- if (!MoveFile(szFrom, szDest) && GetLastError() == ERROR_ALREADY_EXISTS) {
- DeleteFile(szDest);
- MoveFile(szFrom, szDest);
- }
- break;
- } while(FindNextFile(hFind, &wfd));
- FindClose(hFind);
+ /* default: English (GB) */
+ if (callback!=NULL) {
+ ZeroMemory(&pack, sizeof(pack));
+ pack.Locale = LOCALE_USER_DEFAULT; /* miranda uses default locale in this case */
+ lstrcpy(pack.szLanguage, _T("English (default)")); /* buffer safe */
+ lstrcpyA(pack.szAuthors, "Miranda NG Development Team"); /* buffer safe */
+ lstrcpyA(pack.szAuthorEmail, "project-info at miranda-ng.org"); /* buffer safe */
+ CleanupEmail(pack.szAuthorEmail); /* correct " at " */
+ CleanupLastModifiedUsing(pack.szLastModifiedUsing, sizeof(pack.szLastModifiedUsing));
+ /* file date */
+ if (GetModuleFileName(NULL, pack.szFileName, SIZEOF(pack.szFileName))) {
+ HANDLE hFile;
+ hFile = CreateFile(pack.szFileName, 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
+ if (hFile!=INVALID_HANDLE_VALUE) {
+ GetFileTime(hFile, NULL, NULL, &pack.ftFileDate);
+ CloseHandle(hFile);
+ }
}
+ pack.flags = LPF_NOLOCALE|LPF_DEFAULT;
+ pack.Locale = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT);
+ if (!fPackFound) pack.flags |= LPF_ENABLED;
+ /* callback */
+ if (!callback(&pack, wParam, lParam)) return FALSE;
}
- /* enable current pack */
- if (pack->flags&LPF_DEFAULT) return TRUE;
- if (GetPackPath(szFrom, SIZEOF(szFrom), FALSE, pack->szFileName))
- if (GetPackPath(szDest, SIZEOF(szDest), TRUE, pack->szFileName))
- return MoveFile(szFrom, szDest);
- return FALSE;
+ return fPackFound;
}
-void CorrectPacks(const TCHAR *pszFilePattern, BOOL fDisableAll)
+void MovePacks(const TCHAR *pszFilePattern)
{
TCHAR szFrom[MAX_PATH], szDest[MAX_PATH], szDir[MAX_PATH], *pszFile;
BOOL fDirCreated = FALSE;
@@ -403,52 +360,34 @@ void CorrectPacks(const TCHAR *pszFilePattern, BOOL fDisableAll)
/* main path */
if (!GetModuleFileName(NULL, szDir, SIZEOF(szDir))) return;
pszFile = _tcsrchr(szDir, _T('\\'));
- if (pszFile!=NULL) *pszFile = _T('\0');
+ if (pszFile != NULL) *pszFile = _T('\0');
- /* move wrongly placed packs from 'Plugins' to 'Language' */
- mir_sntprintf(szFrom, SIZEOF(szFrom), _T("%s\\Plugins\\%s"), szDir, pszFilePattern);
+ if (!GetPackPath(szDest, SIZEOF(szDest), FALSE, _T(""))) return;
+
+ /* move wrongly placed packs from 'root' to 'Language' */
+ mir_sntprintf(szFrom, SIZEOF(szFrom), _T("%s\\%s"), szDir, pszFilePattern);
hFind = FindFirstFile(szFrom, &wfd);
- if (hFind!=INVALID_HANDLE_VALUE) {
+ if (hFind != INVALID_HANDLE_VALUE) {
do {
if (wfd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) continue;
- if (lstrlen(wfd.cFileName)<4 || wfd.cFileName[lstrlen(wfd.cFileName)-4]!=_T('.')) continue;
+ if (lstrlen(wfd.cFileName)<4 || wfd.cFileName[lstrlen(wfd.cFileName) - 4] != _T('.')) continue;
+ /* set first lp ad default */
+ mir_ptr<TCHAR> langpack(db_get_tsa(NULL, "LangMan", "Langpack"));
+ if (!langpack)
+ db_set_ws(NULL, "LangMan", "Langpack", wfd.cFileName);
/* ensure dir exists */
- if (!fDirCreated && GetPackPath(szFrom, SIZEOF(szFrom), FALSE, NULL))
- fDirCreated = CreateDirectory(szFrom, NULL);
+ if (!fDirCreated)
+ fDirCreated = CreateDirectory(szDest, NULL);
/* move file */
- if (GetPackPath(szDest, SIZEOF(szDest), FALSE, wfd.cFileName)) {
- mir_sntprintf(szFrom, SIZEOF(szFrom), _T("%s\\Plugins\\%s"), szDir, wfd.cFileName);
+ if (GetPackPath(szDest, SIZEOF(szDest), FALSE, wfd.cFileName))
+ {
+ mir_sntprintf(szFrom, SIZEOF(szFrom), _T("%s\\%s"), szDir, wfd.cFileName);
if (!MoveFile(szFrom, szDest) && GetLastError() == ERROR_ALREADY_EXISTS) {
DeleteFile(szDest);
MoveFile(szFrom, szDest);
}
}
- } while(FindNextFile(hFind, &wfd));
+ } while (FindNextFile(hFind, &wfd));
FindClose(hFind);
}
-
- /* disable all packs except one */
- if (GetPackPath(szFrom, SIZEOF(szFrom), TRUE, pszFilePattern)) {
- hFind = FindFirstFile(szFrom, &wfd);
- if (hFind!=INVALID_HANDLE_VALUE) {
- do {
- if (wfd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) continue;
- if (lstrlen(wfd.cFileName)<4 || wfd.cFileName[lstrlen(wfd.cFileName)-4]!=_T('.')) continue;
- /* skip first file */
- if (!fDisableAll) { fDisableAll = TRUE; continue; }
- /* ensure dir exists */
- if (!fDirCreated && GetPackPath(szFrom, SIZEOF(szFrom), FALSE, NULL))
- fDirCreated = CreateDirectory(szFrom, NULL);
- /* move file */
- if (GetPackPath(szFrom, SIZEOF(szFrom), TRUE, wfd.cFileName))
- if (GetPackPath(szDest, SIZEOF(szDest), FALSE, wfd.cFileName)) {
- if (!MoveFile(szFrom, szDest) && GetLastError() == ERROR_ALREADY_EXISTS) {
- DeleteFile(szDest);
- MoveFile(szFrom, szDest);
- }
- }
- } while(FindNextFile(hFind, &wfd));
- FindClose(hFind);
- }
- }
} \ No newline at end of file
diff --git a/plugins/LangMan/src/langpack.h b/plugins/LangMan/src/langpack.h
index 354286b405..0468340c55 100644
--- a/plugins/LangMan/src/langpack.h
+++ b/plugins/LangMan/src/langpack.h
@@ -19,6 +19,10 @@ along with this program (LangMan-License.txt); if not, write to the Free Softwar
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#define LPF_ENABLED 0x01 // pack is enabled
+#define LPF_NOLOCALE 0x02 // pack has no valid locale
+#define LPF_DEFAULT 0x04 // pack is the english default (no langpack)
+
/* Langpack Info */
typedef struct {
TCHAR szLanguage[64];
@@ -34,16 +38,9 @@ typedef struct {
TCHAR szFileName[MAX_PATH]; /* just the file name itself */
BYTE flags; /* see LPIF_* flags */
} LANGPACK_INFO;
-#define LPF_ENABLED 0x01 // pack is enabled
-#define LPF_NOLOCALE 0x02 // pack has no valid locale
-#define LPF_DEFAULT 0x04 // pack is the english default (no langpack)
/* Enum */
BOOL GetPackPath(TCHAR *pszPath, int nSize, BOOL fEnabledPacks, const TCHAR *pszFile);
typedef BOOL (*ENUM_PACKS_CALLBACK)(LANGPACK_INFO *pack, WPARAM wParam, LPARAM lParam);
-BOOL EnumPacks(ENUM_PACKS_CALLBACK callback, const TCHAR *pszFilePattern, const char *pszFileVersionHeader, BOOL fEnglishDefault, WPARAM wParam, LPARAM lParam);
-BOOL IsPluginIncluded(const LANGPACK_INFO *pack, char *pszFileBaseName);
-
-/* Switch */
-BOOL EnablePack(const LANGPACK_INFO *pack, const TCHAR *pszFilePattern);
-void CorrectPacks(const TCHAR *pszFilePattern, BOOL fDisableAll);
+BOOL EnumPacks(ENUM_PACKS_CALLBACK callback, const TCHAR *pszFilePattern, const char *pszFileVersionHeader, WPARAM wParam, LPARAM lParam);
+void MovePacks(const TCHAR *pszFilePattern); \ No newline at end of file
diff --git a/plugins/LangMan/src/main.cpp b/plugins/LangMan/src/main.cpp
index e25e2cabc7..124a35427f 100644
--- a/plugins/LangMan/src/main.cpp
+++ b/plugins/LangMan/src/main.cpp
@@ -39,90 +39,95 @@ static PLUGININFOEX pluginInfo = {
{0xd4bdd1eb, 0x56f1, 0x4a87, {0xa1, 0x87, 0x67, 0x24, 0x6e, 0xe9, 0x19, 0xa2}},
};
-///////////////////////////////////////////////////////////////////////////////
-
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, void*)
{
hInst = hinstDLL;
return TRUE;
}
-///////////////////////////////////////////////////////////////////////////////
+extern "C" __declspec(dllexport) const PLUGININFOEX* MirandaPluginInfoEx(DWORD)
+{
+ return &pluginInfo;
+}
-static void InstallFile(const TCHAR *pszFileName, const TCHAR *pszDestSubDir)
+BOOL IsRunAsAdmin()
{
- TCHAR szFileFrom[MAX_PATH+1], szFileTo[MAX_PATH+1];
- if ( !GetModuleFileName(hInst, szFileFrom, SIZEOF(szFileFrom) - lstrlen(pszFileName)))
- return;
-
- TCHAR *p = _tcsrchr(szFileFrom, _T('\\'));
- if ( p != NULL ) *(++p) = 0;
- lstrcat(szFileFrom, pszFileName); /* buffer safe */
-
- HANDLE hFile = CreateFile(szFileFrom, 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
- if ( hFile == INVALID_HANDLE_VALUE ) return;
- CloseHandle(hFile);
-
- if ( !GetModuleFileName(NULL, szFileTo, SIZEOF(szFileTo) - lstrlen(pszDestSubDir) - lstrlen(pszFileName)))
- return;
-
- p = _tcsrchr(szFileTo, _T('\\'));
- if ( p != NULL ) *(++p) = 0;
- lstrcat(szFileTo, pszDestSubDir); /* buffer safe */
- CreateDirectory(szFileTo, NULL);
- lstrcat(szFileTo, pszFileName); /* buffer safe */
-
- if ( !MoveFile(szFileFrom, szFileTo) && GetLastError() == ERROR_ALREADY_EXISTS) {
- DeleteFile(szFileTo);
- MoveFile(szFileFrom, szFileTo);
+ BOOL fIsRunAsAdmin = FALSE;
+ DWORD dwError = ERROR_SUCCESS;
+ PSID pAdministratorsGroup = NULL;
+
+ // Allocate and initialize a SID of the administrators group.
+ SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
+ if (!AllocateAndInitializeSid(
+ &NtAuthority,
+ 2,
+ SECURITY_BUILTIN_DOMAIN_RID,
+ DOMAIN_ALIAS_RID_ADMINS,
+ 0, 0, 0, 0, 0, 0,
+ &pAdministratorsGroup))
+ {
+ dwError = GetLastError();
+ goto Cleanup;
}
-}
-///////////////////////////////////////////////////////////////////////////////
+ // Determine whether the SID of administrators group is enabled in
+ // the primary access token of the process.
+ if (!CheckTokenMembership(NULL, pAdministratorsGroup, &fIsRunAsAdmin))
+ {
+ dwError = GetLastError();
+ goto Cleanup;
+ }
-extern "C" __declspec(dllexport) const PLUGININFOEX* MirandaPluginInfoEx(DWORD)
-{
- return &pluginInfo;
-}
+Cleanup:
+ // Centralized cleanup for all allocated resources.
+ if (pAdministratorsGroup)
+ {
+ FreeSid(pAdministratorsGroup);
+ pAdministratorsGroup = NULL;
+ }
-///////////////////////////////////////////////////////////////////////////////
+ // Throw the error if something failed in the function.
+ if (ERROR_SUCCESS != dwError)
+ {
+ throw dwError;
+ }
+
+ return fIsRunAsAdmin;
+}
extern "C" __declspec(dllexport) int Load(void)
{
-
mir_getLP( &pluginInfo );
-
- /* existance of MS_SYSTEM_GETVERSION and MS_LANGPACK_TRANSLATESTRING
- * is checked in MirandaPluginInfo().
- * Not placed in MirandaPluginInfo() to avoid MessageBoxes on plugin options.
- * Using ANSI as LANG_UNICODE might not be supported. */
- INITCOMMONCONTROLSEX icc;
+ if (!IsRunAsAdmin())
+ MovePacks(_T("langpack_*.txt"));
+
+ /*INITCOMMONCONTROLSEX icc;
icc.dwSize = sizeof(icc);
icc.dwICC = ICC_TREEVIEW_CLASSES|ICC_USEREX_CLASSES;
- InitCommonControlsEx(&icc);
- InitOptions();
-
- /* menu item */
+ InitCommonControlsEx(&icc);*/
+
+ TCHAR *langpack = db_get_tsa(NULL, "LangMan", "Langpack");
+ if (langpack)
+ {
+ TCHAR szPath[MAX_PATH], szFile[MAX_PATH];
+ mir_sntprintf(szFile, MAX_PATH, _T("Languages\\%s"), langpack);
+ GetPackPath(szPath, SIZEOF(szPath), TRUE, CharLower(szFile));
+
+ DWORD dwAttrib = GetFileAttributes(szPath);
+ if (dwAttrib != INVALID_FILE_ATTRIBUTES && !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY))
+ CallService(MS_LANGPACK_RELOAD, 0, (LPARAM)szPath);
+ mir_free(langpack);
+ }
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.position = 2000089999;
- mi.icolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_RELOAD));
- mi.pszName = LPGEN("Reload langpack");
- mi.pszService = MS_LANGPACK_RELOAD;
- Menu_AddMainMenuItem(&mi);
+ InitOptions();
- /* installation */
- InstallFile(_T("LangMan-Readme.txt"), _T("Docs\\"));
- InstallFile(_T("LangMan-License.txt"), _T("Docs\\"));
- InstallFile(_T("LangMan-SDK.zip"), _T("Docs\\"));
return 0;
}
-///////////////////////////////////////////////////////////////////////////////
-
extern "C" __declspec(dllexport) int Unload(void)
{
UninitOptions();
+
return 0;
} \ No newline at end of file
diff --git a/plugins/LangMan/src/options.cpp b/plugins/LangMan/src/options.cpp
index c191f55fa0..6abdf153c5 100644
--- a/plugins/LangMan/src/options.cpp
+++ b/plugins/LangMan/src/options.cpp
@@ -148,78 +148,8 @@ static void CleanupPluginName(char *szShortName)
szShortName[--len] = 0;
}
-static void DisplayNotIncludedPlugins(HWND hwndListBox, const LANGPACK_INFO *pack)
-{
- /* enum plugins */
- TCHAR szDir[MAX_PATH];
- if (!(pack->flags & LPF_DEFAULT) && GetModuleFileName(NULL, szDir, SIZEOF(szDir))) {
- TCHAR *p = _tcsrchr(szDir, _T('\\'));
- if (p != NULL)
- *p = _T('\0');
-
- TCHAR szSearch[MAX_PATH];
- mir_sntprintf(szSearch, SIZEOF(szSearch), _T("%s\\Plugins\\*.dll"), szDir);
- WIN32_FIND_DATA wfd;
- HANDLE hFind = FindFirstFile(szSearch, &wfd);
- if (hFind != INVALID_HANDLE_VALUE) {
- DWORD mirandaVersion = CallService(MS_SYSTEM_GETVERSION, 0, 0);
- SendMessage(hwndListBox, LB_SETLOCALE, CallService(MS_LANGPACK_GETLOCALE, 0, 0), 0); /* for sort order */
- SendMessage(hwndListBox, LB_INITSTORAGE, 128, lstrlenA(pack->szPluginsIncluded)); /* speed up */
- do {
- if (wfd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) continue;
- if ((lstrlen(wfd.cFileName) < 4) || (wfd.cFileName[lstrlen(wfd.cFileName) - 4] != _T('.'))) continue;
- /* file name */
- lstrcpy(szSearch, wfd.cFileName); /* buffer safe */
- p = _tcsrchr(szSearch, _T('.'));
- if (p != NULL)
- *p = _T('\0');
-
- char cFileNameA[MAX_PATH];
- cFileNameA[0] = '\0';
- WideCharToMultiByte(CP_ACP, 0, szSearch, -1, cFileNameA, sizeof(cFileNameA), NULL, NULL);
- if (IsPluginIncluded(pack, cFileNameA))
- continue;
-
- /* friendly name of the plugin */
- mir_sntprintf(szSearch, SIZEOF(szSearch), _T("%s\\Plugins\\%s"), szDir, wfd.cFileName);
- HMODULE hModule = GetModuleHandle(szSearch);
- bool fNeedsFree = (hModule == NULL);
- if (hModule == NULL) {
- hModule = LoadLibrary(szSearch);
- if (hModule == NULL) continue;
- }
-
- /* plugin info */
- pfnMirandaPluginInfo pFunc = (pfnMirandaPluginInfo)GetProcAddress(hModule, "MirandaPluginInfoEx");
- if (pFunc != NULL) { /* both structs have the same header */
- PLUGININFOEX *pluginInfo = pFunc(mirandaVersion);
- if (pluginInfo != NULL && pluginInfo->cbSize >= sizeof(PLUGININFOEX) && pluginInfo->shortName != NULL) {
- char buf[128];
- lstrcpynA(buf, pluginInfo->shortName, sizeof(buf)); /* buffer safe */
- CleanupPluginName(buf);
-
- TCHAR buf2[128];
- mir_sntprintf(buf2, SIZEOF(buf2), _T("%hs (%s)"), buf, CharLower(wfd.cFileName));
- SendMessage(hwndListBox, LB_ADDSTRING, 0, (LPARAM)buf2);
- }
- }
- if (fNeedsFree)
- FreeLibrary(hModule);
- }
- while (FindNextFile(hFind, &wfd));
- FindClose(hFind);
- }
- }
- /* all are included? */
- if (!SendMessage(hwndListBox, LB_GETCOUNT, 0, 0))
- SendMessage(hwndListBox, LB_ADDSTRING, 0, (LPARAM)TranslateT("All installed plugins are included."));
-}
-
static void DisplayPackInfo(HWND hwndDlg, const LANGPACK_INFO *pack)
{
- /* compute not-included from included list */
- SendDlgItemMessage(hwndDlg, IDC_LANGNOTINCLUDED, LB_RESETCONTENT, 0, 0);
- DisplayNotIncludedPlugins(GetDlgItem(hwndDlg, IDC_LANGNOTINCLUDED), pack);
/* locale string */
if (!(pack->flags & LPF_NOLOCALE)) {
TCHAR szLocaleName[128];
@@ -381,8 +311,11 @@ static INT_PTR CALLBACK LangOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
}
if ( ServiceExists(MS_FLAGS_LOADFLAGICON))
ListView_SetImageList(hwndList, ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR24, 8, 8), LVSIL_SMALL);
- CorrectPacks(_T("langpack_*.txt"), FALSE);
- CheckDlgButton(hwndDlg, IDC_ENABLEAUTOUPDATES, db_get_b(NULL, "LangMan", "EnableAutoUpdates", SETTING_ENABLEAUTOUPDATES_DEFAULT)!=0);
+
+ TCHAR szPath[MAX_PATH];
+ GetPackPath(szPath, SIZEOF(szPath), FALSE, _T(""));
+ SetDlgItemText(hwndDlg, IDC_SKINROOTFOLDER, szPath);
+
SendMessage(hwndDlg, M_RELOADLIST, 0, 0);
SendMessage(hwndDlg, M_SHOWFILECOL, 0, 1);
return TRUE;
@@ -395,10 +328,10 @@ static INT_PTR CALLBACK LangOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
HIMAGELIST himl = ListView_GetImageList(hwndList, LVSIL_SMALL);
ImageList_RemoveAll(himl);
/* enum all packs */
- EnumPacks(InsertPackItemEnumProc, _T("langpack_*.txt"), "Miranda Language Pack Version 1", TRUE, (WPARAM)hwndList, (LPARAM)himl);
+ EnumPacks(InsertPackItemEnumProc, _T("langpack_*.txt"), "Miranda Language Pack Version 1", (WPARAM)hwndList, (LPARAM)himl);
/* make it use current langpack locale for sort */
ListView_SortItems(hwndList, CompareListItem, CallService(MS_LANGPACK_GETLOCALE, 0, 0));
- CheckDlgButton(hwndDlg, IDC_ENABLEAUTOUPDATES, db_get_b(NULL, "LangMan", "EnableAutoUpdates", SETTING_ENABLEAUTOUPDATES_DEFAULT) != 0);
+ //CheckDlgButton(hwndDlg, IDC_ENABLEAUTOUPDATES, db_get_b(NULL, "LangMan", "EnableAutoUpdates", SETTING_ENABLEAUTOUPDATES_DEFAULT) != 0);
/* show selection */
int iItem = ListView_GetNextItem(hwndList, -1, LVNI_SELECTED);
if (iItem != -1)
@@ -596,13 +529,20 @@ static INT_PTR CALLBACK LangOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
lvi.iSubItem = 0;
for (lvi.iItem = 0; ListView_GetItem(hwndList, &lvi); ++lvi.iItem) {
LANGPACK_INFO *pack = (LANGPACK_INFO*)lvi.lParam;
- if (lvi.state&INDEXTOSTATEIMAGEMASK(2)) {
- EnablePack(pack, _T("langpack_*.txt"));
+ if (lvi.state&INDEXTOSTATEIMAGEMASK(2) && !(pack->flags & LPF_ENABLED)) {
+ if(!(pack->flags & LPF_DEFAULT))
+ db_set_ws(NULL, "LangMan", "Langpack", pack->szFileName);
+ else
+ db_unset(NULL, "LangMan", "Langpack");
+ TCHAR szPath[MAX_PATH];
+ GetPackPath(szPath, SIZEOF(szPath), FALSE, pack->szFileName);
+ CallService(MS_LANGPACK_RELOAD, 0, (LPARAM)szPath);
pack->flags |= LPF_ENABLED;
+ CloseWindow(GetParent(hwndDlg));
+ DestroyWindow(GetParent(hwndDlg));
}
else pack->flags &= ~LPF_ENABLED;
}
- db_set_b(NULL, "LangMan", "EnableAutoUpdates", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ENABLEAUTOUPDATES) != 0));
return TRUE;
}
}
@@ -639,7 +579,7 @@ void InitOptions(void)
{
hwndLangOpt = NULL;
hHookOptInit = HookEvent(ME_OPT_INITIALISE, LangOptInit);
- CorrectPacks(_T("langpack_*.txt"), FALSE);
+ //CorrectPacks(_T("langpack_*.txt"), FALSE);
}
void UninitOptions(void)
diff --git a/plugins/LangMan/src/resource.h b/plugins/LangMan/src/resource.h
index 983f304ffb..bc7f8958ec 100644
--- a/plugins/LangMan/src/resource.h
+++ b/plugins/LangMan/src/resource.h
@@ -1,11 +1,10 @@
//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by resource.rc
+// Microsoft Visual C++ generated include file.
+// Used by E:\Projects\C++\MirandaNG\plugins\LangMan\res\resource.rc
//
#define IDD_OPT_LANG 101
#define IDD_UPDATENOTIFY 102
#define IDD_DOWNLOADLANG 103
-#define IDI_RELOAD 104
#define IDC_LANGLIST 1001
#define IDC_LANGINFOFRAME 1002
#define IDC_LANGAUTHORSLABEL 1003
@@ -35,9 +34,11 @@
#define IDC_CURRENTVERSION 1026
#define IDC_NEWVERSION 1027
#define IDC_NEWVERSIONLABEL 1028
+#define IDC_SKINROOTFOLDER 1439
+#define IDC_LANGROOTFOLDER 1439
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
diff --git a/plugins/LangMan/src/utils.cpp b/plugins/LangMan/src/utils.cpp
deleted file mode 100644
index c67b9813a8..0000000000
--- a/plugins/LangMan/src/utils.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
-
-'Language Pack Manager'-Plugin for Miranda IM
-
-Copyright (C) 2005-2007 H. Herkenrath
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program (LangMan-License.txt); if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-#include "common.h"
-
-/************************* Error Output ***************************/
-
-static void MessageBoxIndirectFree(MSGBOXPARAMSA *mbp)
-{
- MessageBoxIndirectA(mbp);
- mir_free((char*)mbp->lpszCaption); /* does NULL check */
- mir_free((char*)mbp->lpszText); /* does NULL check */
- mir_free(mbp);
-}
-
-void ShowInfoMessage(BYTE flags, const char *pszTitle, const char *pszTextFmt, ...)
-{
- va_list va;
- va_start(va, pszTextFmt);
- char szText[256]; /* max for systray */
- mir_vsnprintf(szText, SIZEOF(szText), pszTextFmt, va);
- va_end(va);
-
- if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) {
- MIRANDASYSTRAYNOTIFY msn;
- msn.cbSize = sizeof(msn);
- msn.szProto = NULL;
- msn.szInfoTitle = (char*)pszTitle;
- msn.szInfo = (char*)szText;
- msn.uTimeout = 30000; /* max timeout */
- msn.dwInfoFlags = flags;
- if (!CallServiceSync(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)&msn))
- return; /* success */
- }
-
- MSGBOXPARAMSA *mbp = (MSGBOXPARAMSA*)mir_calloc(sizeof(*mbp));
- if (mbp == NULL) return;
- mbp->cbSize = sizeof(*mbp);
- mbp->lpszCaption = mir_strdup(pszTitle);
- mbp->lpszText = mir_strdup(szText);
- mbp->dwStyle = MB_OK|MB_SETFOREGROUND|MB_TASKMODAL;
- mbp->dwLanguageId = LANGIDFROMLCID((LCID)CallService(MS_LANGPACK_GETLOCALE, 0, 0));
- switch(flags&NIIF_ICON_MASK) {
- case NIIF_INFO: mbp->dwStyle |= MB_ICONINFORMATION; break;
- case NIIF_WARNING: mbp->dwStyle |= MB_ICONWARNING; break;
- case NIIF_ERROR: mbp->dwStyle |= MB_ICONERROR;
- }
- mir_forkthread(( pThreadFunc )MessageBoxIndirectFree, mbp);
-}
diff --git a/plugins/LangMan/src/utils.h b/plugins/LangMan/src/utils.h
deleted file mode 100644
index 8c4e299ebb..0000000000
--- a/plugins/LangMan/src/utils.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-
-'Language Pack Manager'-Plugin for Miranda IM
-
-Copyright (C) 2005-2007 H. Herkenrath
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program (LangMan-License.txt); if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-/* Error Output */
-void ShowInfoMessage(BYTE flags, const char *pszTitle, const char *pszTextFmt, ...);
diff --git a/plugins/LangMan/src/version.h b/plugins/LangMan/src/version.h
index a82809373c..c95c154578 100644
--- a/plugins/LangMan/src/version.h
+++ b/plugins/LangMan/src/version.h
@@ -1,14 +1,14 @@
-#define __MAJOR_VERSION 1
-#define __MINOR_VERSION 0
-#define __RELEASE_NUM 2
-#define __BUILD_NUM 3
+#define __MAJOR_VERSION 0
+#define __MINOR_VERSION 11
+#define __RELEASE_NUM 0
+#define __BUILD_NUM 1
#include <stdver.h>
#define __PLUGIN_NAME "Language pack manager"
#define __FILENAME "LangMan.dll"
-#define __DESCRIPTION "Helps you manage Language Packs of different languages."
-#define __AUTHOR "H. Herkenrath"
-#define __AUTHOREMAIL "hrathh@users.sourceforge.net"
-#define __AUTHORWEB "http://miranda-ng.org/p/LangMan/"
-#define __COPYRIGHT "© 2005-2007 H. Herkenrath"
+#define __DESCRIPTION "Helps you manage language packs of different languages."
+#define __AUTHOR "H. Herkenrath"
+#define __AUTHOREMAIL ""
+#define __AUTHORWEB "http://miranda-ng.org/p/LangMan/"
+#define __COPYRIGHT "© 2005-2007 H. Herkenrath, 2014 Miranda NG project"