diff options
-rw-r--r-- | plugins/PluginUpdater/PluginUpdaterIM_10.vcxproj | 8 | ||||
-rw-r--r-- | plugins/PluginUpdater/PluginUpdaterIM_10.vcxproj.filters | 8 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Common.h | 108 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/DlgListNew.cpp | 12 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Utils.cpp | 4 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/compat.h | 121 |
6 files changed, 148 insertions, 113 deletions
diff --git a/plugins/PluginUpdater/PluginUpdaterIM_10.vcxproj b/plugins/PluginUpdater/PluginUpdaterIM_10.vcxproj index 1fca0515fd..13e7f9345c 100644 --- a/plugins/PluginUpdater/PluginUpdaterIM_10.vcxproj +++ b/plugins/PluginUpdater/PluginUpdaterIM_10.vcxproj @@ -86,6 +86,7 @@ <RandomizedBaseAddress>false</RandomizedBaseAddress>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
<AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
+ <AdditionalDependencies>comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
@@ -108,6 +109,7 @@ <RandomizedBaseAddress>false</RandomizedBaseAddress>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
<AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
+ <AdditionalDependencies>comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
@@ -133,6 +135,7 @@ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
+ <AdditionalDependencies>comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
@@ -158,6 +161,7 @@ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
+ <AdditionalDependencies>comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
@@ -169,6 +173,7 @@ <ResourceCompile Include="res\Version.rc" />
</ItemGroup>
<ItemGroup>
+ <ClInclude Include="src\compat.h" />
<ClInclude Include="src\Minizip\crypt.h" />
<ClInclude Include="src\Minizip\ioapi.h" />
<ClInclude Include="src\Minizip\iowin32.h" />
@@ -183,6 +188,8 @@ </ItemGroup>
<ItemGroup>
<ClCompile Include="src\checksum.cpp" />
+ <ClCompile Include="src\DlgListNew.cpp" />
+ <ClCompile Include="src\DlgUpdate.cpp" />
<ClCompile Include="src\Events.cpp" />
<ClCompile Include="src\Minizip\ioapi.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">NotUsing</PrecompiledHeader>
@@ -207,7 +214,6 @@ <ClCompile Include="src\PluginUpdater.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
- <ClCompile Include="src\Scanner.cpp" />
<ClCompile Include="src\unzipfile.cpp" />
<ClCompile Include="src\Utils.cpp" />
</ItemGroup>
diff --git a/plugins/PluginUpdater/PluginUpdaterIM_10.vcxproj.filters b/plugins/PluginUpdater/PluginUpdaterIM_10.vcxproj.filters index 595ed68903..88af02372f 100644 --- a/plugins/PluginUpdater/PluginUpdaterIM_10.vcxproj.filters +++ b/plugins/PluginUpdater/PluginUpdaterIM_10.vcxproj.filters @@ -59,6 +59,9 @@ <ClInclude Include="src\Minizip\zlib.h">
<Filter>Source Files\Minizip</Filter>
</ClInclude>
+ <ClInclude Include="src\compat.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Notifications.cpp">
@@ -91,7 +94,10 @@ <ClCompile Include="src\Minizip\unzip.c">
<Filter>Source Files\Minizip</Filter>
</ClCompile>
- <ClCompile Include="src\Scanner.cpp">
+ <ClCompile Include="src\DlgListNew.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\DlgUpdate.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
diff --git a/plugins/PluginUpdater/src/Common.h b/plugins/PluginUpdater/src/Common.h index ffdb9a0557..1066fb126e 100644 --- a/plugins/PluginUpdater/src/Common.h +++ b/plugins/PluginUpdater/src/Common.h @@ -48,6 +48,10 @@ Boston, MA 02111-1307, USA. #include "resource.h"
#include "Notifications.h"
+#if MIRANDA_VER < 0x0A00
+#include "compat.h"
+#endif
+
// Enable Visual Style
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
@@ -201,107 +205,3 @@ int SafeCopyFile(const TCHAR *ptszSrc, const TCHAR *ptszDst); int SafeMoveFile(const TCHAR *ptszSrc, const TCHAR *ptszDst);
int SafeDeleteFile(const TCHAR *ptszSrc);
int SafeCreateFilePath(TCHAR *pFolder);
-
-#if MIRANDA_VER < 0x0A00
-
-#define db_free(A) DBFreeVariant(A)
-
-#define db_get_b(A,B,C,D) DBGetContactSettingByte(A,B,C,D)
-#define db_get_dw(A,B,C,D) DBGetContactSettingDword(A,B,C,D)
-#define db_get_s(A,B,C,D) DBGetContactSettingString(A,B,C,D)
-#define db_get_ts(A,B,C,D) DBGetContactSettingTString(A,B,C,D)
-
-#define db_set_b(A,B,C,D) DBWriteContactSettingByte(A,B,C,D)
-#define db_set_dw(A,B,C,D) DBWriteContactSettingDword(A,B,C,D)
-#define db_set_s(A,B,C,D) DBWriteContactSettingString(A,B,C,D)
-#define db_set_ts(A,B,C,D) DBWriteContactSettingTString(A,B,C,D)
-
-template<class T> class mir_ptr
-{
- T *data;
-
-public:
- __inline mir_ptr() : data((T*)mir_calloc(sizeof(T))) {}
- __inline mir_ptr(T *_p) : data(_p) {}
- __inline ~mir_ptr() { mir_free(data); }
- __inline T *operator = (T *_p) { if (data) mir_free(data); data = _p; return data; }
- __inline T *operator->() const { return data; }
- __inline operator T*() const { return data; }
- __inline operator INT_PTR() const { return (INT_PTR)data; }
-};
-
-struct VARST : public ptrT
-{
- __forceinline VARST(const TCHAR *str) :
- ptrT( Utils_ReplaceVarsT(str))
- {}
-};
-
-class _A2T
-{
- TCHAR *buf;
-
-public:
- __forceinline _A2T(const char *s) : buf(mir_a2t(s)) {}
- __forceinline _A2T(const char *s, int cp) : buf(mir_a2t_cp(s, cp)) {}
- ~_A2T() { mir_free(buf); }
-
- __forceinline operator TCHAR*() const
- { return buf;
- }
-};
-
-class _T2A
-{
- char *buf;
-
-public:
- __forceinline _T2A(const TCHAR *s) : buf(mir_t2a(s)) {}
- __forceinline _T2A(const TCHAR *s, int cp) : buf(mir_t2a_cp(s, cp)) {}
- __forceinline ~_T2A() { mir_free(buf); }
-
- __forceinline operator char*() const
- { return buf;
- }
-};
-
-__forceinline INT_PTR Options_Open(OPENOPTIONSDIALOG *ood)
-{
- return CallService("Opt/OpenOptions", 0, (LPARAM)ood);
-}
-
-__forceinline INT_PTR Options_AddPage(WPARAM wParam, OPTIONSDIALOGPAGE *odp)
-{
- return CallService("Opt/AddPage", wParam, (LPARAM)odp);
-}
-
-char *rtrim(char *str);
-int CreatePathToFileT(const TCHAR *ptszPath);
-
-#define NEWTSTR_ALLOCA(A) (A == NULL)?NULL:_tcscpy((TCHAR*)alloca((_tcslen(A)+1) *sizeof(TCHAR)), A)
-
-__forceinline HANDLE Skin_GetIconHandle(const char *szIconName)
-{ return (HANDLE)CallService(MS_SKIN2_GETICONHANDLE, 0, (LPARAM)szIconName);
-}
-
-__forceinline HICON Skin_GetIcon(const char *szIconName, int size=0)
-{ return (HICON)CallService(MS_SKIN2_GETICON, size, (LPARAM)szIconName);
-}
-
-__forceinline HGENMENU Menu_AddMainMenuItem(CLISTMENUITEM *mi)
-{ return (HGENMENU)CallService("CList/AddMainMenuItem", 0, (LPARAM)mi);
-}
-
-__forceinline INT_PTR Hotkey_Register(HOTKEYDESC *hk)
-{ return CallService("CoreHotkeys/Register", 0, (LPARAM)hk);
-}
-
-__forceinline INT_PTR CreateDirectoryTreeT(const TCHAR *ptszPath)
-{ return CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)ptszPath);
-}
-
-__forceinline HANDLE Skin_AddIcon(SKINICONDESC *si)
-{ return (HANDLE)CallService("Skin2/Icons/AddIcon", 0, (LPARAM)si);
-}
-
-#endif
\ No newline at end of file diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp index 2af4a24747..0561b4cf60 100644 --- a/plugins/PluginUpdater/src/DlgListNew.cpp +++ b/plugins/PluginUpdater/src/DlgListNew.cpp @@ -123,6 +123,8 @@ static void ApplyDownloads(void *param) /////////////////////////////////////////////////////////////////////////////////////////
+static WNDPROC oldWndProc = NULL;
+
static LRESULT CALLBACK PluginListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (msg == WM_LBUTTONDOWN) {
@@ -135,20 +137,20 @@ static LRESULT CALLBACK PluginListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LP lvi.stateMask = -1;
lvi.iItem = hi.iItem;
if (ListView_GetItem(hwnd, &lvi) && lvi.iGroupId == 1) {
- TCHAR link[MAX_PATH];
FILEINFO *info = (FILEINFO *)lvi.lParam;
TCHAR tszFileName[MAX_PATH];
_tcscpy(tszFileName, _tcsrchr(info->tszNewName, L'\\') + 1);
TCHAR *p = _tcschr(tszFileName, L'.'); *p = 0;
- mir_sntprintf(link, MAX_PATH, L"http://wiki.miranda-ng.org/index.php?title=Plugin:%s", tszFileName);
- CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM) link);
+ char link[MAX_PATH];
+ mir_snprintf(link, MAX_PATH, "http://wiki.miranda-ng.org/index.php?title=Plugin:%s", _T2A(tszFileName));
+ CallService(MS_UTILS_OPENURL, 0, (LPARAM) link);
}
}
}
- return mir_callNextSubclass(hwnd, PluginListWndProc, msg, wParam, lParam);
+ return CallWindowProc(oldWndProc, hwnd, msg, wParam, lParam);
}
static int ListDlg_Resize(HWND, LPARAM, UTILRESIZECONTROL *urc)
@@ -172,7 +174,7 @@ INT_PTR CALLBACK DlgList(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_INITDIALOG:
hwndDialog = hDlg;
TranslateDialogDefault( hDlg );
- mir_subclassWindow(hwndList, PluginListWndProc);
+ oldWndProc = (WNDPROC)SetWindowLongPtr(hwndList, GWLP_WNDPROC, (LONG_PTR)PluginListWndProc);
SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIcon("plg_list", 1));
SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_GetIcon("plg_list"));
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index bb572b2489..f98f990ce7 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -443,6 +443,8 @@ void __stdcall RestartMe(void*) CallService(MS_SYSTEM_RESTART, db_get_b(NULL,MODNAME,"RestartCurrentProfile",1) ? 1 : 0, 0);
}
+#endif
+
void __stdcall OpenPluginOptions(void*)
{
OPENOPTIONSDIALOG ood = {0};
@@ -451,8 +453,6 @@ void __stdcall OpenPluginOptions(void*) Options_Open(&ood);
}
-#endif
-
// FUNCTION: IsRunAsAdmin()
//
// PURPOSE: The function checks whether the current process is run as
diff --git a/plugins/PluginUpdater/src/compat.h b/plugins/PluginUpdater/src/compat.h new file mode 100644 index 0000000000..371ceef1c0 --- /dev/null +++ b/plugins/PluginUpdater/src/compat.h @@ -0,0 +1,121 @@ +#define db_free(A) DBFreeVariant(A)
+
+#define db_get_b(A,B,C,D) DBGetContactSettingByte(A,B,C,D)
+#define db_get_dw(A,B,C,D) DBGetContactSettingDword(A,B,C,D)
+#define db_get_s(A,B,C,D) DBGetContactSettingString(A,B,C,D)
+#define db_get_ts(A,B,C,D) DBGetContactSettingTString(A,B,C,D)
+
+#define db_set_b(A,B,C,D) DBWriteContactSettingByte(A,B,C,D)
+#define db_set_dw(A,B,C,D) DBWriteContactSettingDword(A,B,C,D)
+#define db_set_s(A,B,C,D) DBWriteContactSettingString(A,B,C,D)
+#define db_set_ts(A,B,C,D) DBWriteContactSettingTString(A,B,C,D)
+
+#define db_get_sa DBGetStringA
+#define db_get_wsa DBGetStringW
+#define db_get_tsa DBGetStringT
+
+template<class T> class mir_ptr
+{
+ T *data;
+
+public:
+ __inline mir_ptr() : data((T*)mir_calloc(sizeof(T))) {}
+ __inline mir_ptr(T *_p) : data(_p) {}
+ __inline ~mir_ptr() { mir_free(data); }
+ __inline T *operator = (T *_p) { if (data) mir_free(data); data = _p; return data; }
+ __inline T *operator->() const { return data; }
+ __inline operator T*() const { return data; }
+ __inline operator INT_PTR() const { return (INT_PTR)data; }
+};
+
+typedef mir_ptr<TCHAR> ptrT;
+
+struct VARST : public ptrT
+{
+ __forceinline VARST(const TCHAR *str) :
+ ptrT( Utils_ReplaceVarsT(str))
+ {}
+};
+
+class _A2T
+{
+ TCHAR *buf;
+
+public:
+ __forceinline _A2T(const char *s) : buf(mir_a2t(s)) {}
+ __forceinline _A2T(const char *s, int cp) : buf(mir_a2t_cp(s, cp)) {}
+ ~_A2T() { mir_free(buf); }
+
+ __forceinline operator TCHAR*() const
+ { return buf;
+ }
+};
+
+class _T2A
+{
+ char *buf;
+
+public:
+ __forceinline _T2A(const TCHAR *s) : buf(mir_t2a(s)) {}
+ __forceinline _T2A(const TCHAR *s, int cp) : buf(mir_t2a_cp(s, cp)) {}
+ __forceinline ~_T2A() { mir_free(buf); }
+
+ __forceinline operator char*() const
+ { return buf;
+ }
+};
+
+__forceinline INT_PTR Options_Open(OPENOPTIONSDIALOG *ood)
+{
+ return CallService("Opt/OpenOptions", 0, (LPARAM)ood);
+}
+
+__forceinline INT_PTR Options_AddPage(WPARAM wParam, OPTIONSDIALOGPAGE *odp)
+{
+ return CallService("Opt/AddPage", wParam, (LPARAM)odp);
+}
+
+char *rtrim(char *str);
+int CreatePathToFileT(const TCHAR *ptszPath);
+
+#define NEWTSTR_ALLOCA(A) (A == NULL)?NULL:_tcscpy((TCHAR*)alloca((_tcslen(A)+1) *sizeof(TCHAR)), A)
+
+__forceinline HANDLE Skin_AddIcon(SKINICONDESC *si)
+{ return (HANDLE)CallService("Skin2/Icons/AddIcon", 0, (LPARAM)si);
+}
+
+__forceinline HICON Skin_GetIconByHandle(HANDLE hIcolibIcon, int size=0)
+{ return (HICON)CallService(MS_SKIN2_GETICONBYHANDLE, size, (LPARAM)hIcolibIcon);
+}
+
+__forceinline HANDLE Skin_GetIconHandle(const char *szIconName)
+{ return (HANDLE)CallService(MS_SKIN2_GETICONHANDLE, 0, (LPARAM)szIconName);
+}
+
+__forceinline HICON Skin_GetIcon(const char *szIconName, int size=0)
+{ return (HICON)CallService(MS_SKIN2_GETICON, size, (LPARAM)szIconName);
+}
+
+__forceinline void Skin_ReleaseIcon(const char* szIconName)
+{ CallService(MS_SKIN2_RELEASEICON, 0, (LPARAM)szIconName);
+}
+
+__forceinline void Skin_ReleaseIcon(HICON hIcon)
+{ CallService(MS_SKIN2_RELEASEICON, (WPARAM)hIcon, 0);
+}
+
+__forceinline HGENMENU Menu_AddMainMenuItem(CLISTMENUITEM *mi)
+{ return (HGENMENU)CallService("CList/AddMainMenuItem", 0, (LPARAM)mi);
+}
+
+__forceinline INT_PTR Hotkey_Register(HOTKEYDESC *hk)
+{ return CallService("CoreHotkeys/Register", 0, (LPARAM)hk);
+}
+
+__forceinline INT_PTR CreateDirectoryTreeT(const TCHAR *ptszPath)
+{ return CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)ptszPath);
+}
+
+int __forceinline PUDeletePopup(HWND hWndPopup)
+{ return (int)SendMessage(hWndPopup, UM_DESTROYPOPUP, 0, 0);
+}
|