summaryrefslogtreecommitdiff
path: root/plugins/PluginUpdater/src/Common.h
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-09-30 11:50:38 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-09-30 11:50:38 +0000
commitc2c8016a4f56b10299b279c64370e304265e7c3b (patch)
tree30058c8f2d56f01dfd2099f8636e022d01e00bb7 /plugins/PluginUpdater/src/Common.h
parent40d145149e5d95415fde7c3927706f9dd447902c (diff)
source code unification
git-svn-id: http://svn.miranda-ng.org/main/trunk@1726 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/PluginUpdater/src/Common.h')
-rw-r--r--plugins/PluginUpdater/src/Common.h88
1 files changed, 85 insertions, 3 deletions
diff --git a/plugins/PluginUpdater/src/Common.h b/plugins/PluginUpdater/src/Common.h
index 9efa4740be..28c899e9d7 100644
--- a/plugins/PluginUpdater/src/Common.h
+++ b/plugins/PluginUpdater/src/Common.h
@@ -19,8 +19,6 @@ Boston, MA 02111-1307, USA.
#define _CRT_SECURE_NO_WARNINGS
-#define MIRANDA_VER 0x0A00
-
// Windows Header Files:
#include <time.h>
#include <stdio.h>
@@ -138,7 +136,6 @@ int OptInit(WPARAM, LPARAM);
void DoCheck(int iFlag);
BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal);
void ShowPopup(HWND hDlg, LPCTSTR Title, LPCTSTR Text, int Number, int ActType);
-void __stdcall ExitMe(void*);
void __stdcall RestartMe(void*);
BOOL AllowUpdateOnStartup();
void InitTimer();
@@ -150,3 +147,88 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
INT_PTR CALLBACK DlgMsgPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
bool unzip(const TCHAR* ptszZipFile, TCHAR* ptszDestPath, TCHAR* ptszBackPath);
+
+#if MIRANDA_VER < 0x0A00
+
+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; }
+};
+
+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);
+void CreatePathToFileT(TCHAR* szFilePath);
+
+#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