From 3576b67db9fa0a3d8d5c1747cc3560504d31d125 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 5 Mar 2014 12:52:30 +0000 Subject: - adaptation for standard Windows ways of handling Unicode; - obsoleted code removed; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@8407 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/HistoryStats/src/mu_common.h | 163 ++++++----------------------------- 1 file changed, 25 insertions(+), 138 deletions(-) (limited to 'plugins/HistoryStats/src/mu_common.h') diff --git a/plugins/HistoryStats/src/mu_common.h b/plugins/HistoryStats/src/mu_common.h index 5c103743fd..c599d15f61 100644 --- a/plugins/HistoryStats/src/mu_common.h +++ b/plugins/HistoryStats/src/mu_common.h @@ -1,108 +1,6 @@ #if !defined(HISTORYSTATS_GUARD_MU_COMMON_H) #define HISTORYSTATS_GUARD_MU_COMMON_H -/* - * mu = miranda unified services - */ - -#define _WIN32_WINDOWS 0x0500 // for WM_MOUSEWHEEL -#define _WIN32_WINNT 0x0501 // for WM_THEMECHANGED - -#include -#include -#include - -/* - * include miranda headers - */ - -#define MIRANDA_VER 0x0A00 - -#include - -#include // not used -#include // not used -#include // not used -#include -#include -#include // not used -#include // not used -#include -#include -#include // not used -#include // not used -#include // not used -#include // not used -#include // not used -#include // not used -#include -#include // not used -#include // not used -#include -#include // not used -#include // not used -#include -#include -#include // not used -#include -#include // not used -#include -#include -#include -#include // not used -#include // not used -#include // not used -#include - -#include // not used, depends on m_protosvc.h -#include // depends on m_protosvc.h - -#include -#include // our own header - -/* - * basic defines - */ - -#if defined(_UNICODE) - #undef MU_ANSI - #define MU_WIDE -#else - #define MU_ANSI - #undef MU_WIDE -#endif - -/* - * helper macros to avoid many "#if defined(MU_WIDE) ... #else ... #endif" constructs - */ - -#if defined(MU_WIDE) - #define MU_DO_BOTH(ansi, wide) wide - #define MU_DO_WIDE(wide) wide - #define MU_DO_ANSI(ansi) (void) 0 -#else - #define MU_DO_BOTH(ansi, wide) ansi - #define MU_DO_WIDE(wide) (void) 0 - #define MU_DO_ANSI(ansi) ansi -#endif - -/* - * common types mu_wide/mu_ansi/mu_text - */ - -typedef wchar_t mu_wide; -typedef char mu_ansi; -typedef MU_DO_BOTH(char, wchar_t) mu_text; - -/* - * common macros for wrapping text - */ - -#define muC(x) x -#define muW(x) L##x -#define muA(x) x -#define muT(x) MU_DO_BOTH(muA(x), muW(x)) - /* * helper functions */ @@ -115,11 +13,11 @@ namespace mu namespace clist { - HANDLE addMainMenuItem(const mu_text* pszName, DWORD flags, int position, HICON hIcon, const mu_ansi* pszService, const mu_text* pszPopupName = NULL, int popupPosition = 0, DWORD hotKey = 0); - HANDLE addContactMenuItem(const mu_text* pszName, DWORD flags, int position, HICON hIcon, const mu_ansi* pszService, DWORD hotKey = 0, const mu_ansi* pszContactOwner = NULL); - int modifyMenuItem(HANDLE hMenuItem, DWORD toModify, const mu_text* pszName = NULL, DWORD flags = 0, HICON hIcon = NULL, DWORD hotKey = 0); - const mu_text* getContactDisplayName(MCONTACT hContact); - const mu_text* getStatusModeDescription(int nStatusMode); + HANDLE addMainMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, const TCHAR* pszPopupName = NULL, int popupPosition = 0, DWORD hotKey = 0); + HANDLE addContactMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, DWORD hotKey = 0, const char* pszContactOwner = NULL); + int modifyMenuItem(HANDLE hMenuItem, DWORD toModify, const TCHAR* pszName = NULL, DWORD flags = 0, HICON hIcon = NULL, DWORD hotKey = 0); + const TCHAR* getContactDisplayName(MCONTACT hContact); + const TCHAR* getStatusModeDescription(int nStatusMode); } /* @@ -128,8 +26,8 @@ namespace mu namespace db { - int getProfilePath(int cbName, mu_text* pszName); - int getProfileName(int cbName, mu_text* pszName); + int getProfilePath(int cbName, TCHAR* pszName); + int getProfileName(int cbName, TCHAR* pszName); void setSafetyMode(bool safetyMode); } @@ -139,7 +37,7 @@ namespace mu namespace db_contact { - int enumSettings(MCONTACT hContact, const mu_ansi* szModule, DBSETTINGENUMPROC pEnumProc, LPARAM lProcParam); + int enumSettings(MCONTACT hContact, const char* szModule, DBSETTINGENUMPROC pEnumProc, LPARAM lProcParam); int getCount(); } @@ -159,20 +57,9 @@ namespace mu namespace icolib { bool _available(); - void addIcon(const mu_text* szSection, const mu_text* szDescription, const mu_ansi* szIconName, const mu_ansi* szDefaultFile, int iDefaultIndex, int cx = 16, int cy = 16); - void addIcon(const mu_text* szSection, const mu_text* szDescription, const mu_ansi* szIconName, HICON hDefaultIcon, int cx = 16, int cy = 16); - HICON getIcon(const mu_ansi* szIconName); - } - - /* - * langpack - */ - - namespace langpack - { - int translateDialog(HWND hwndDlg, DWORD flags = 0, const int* ignoreControls = NULL); - const mu_text* translateString(const mu_text* szEnglish); - UINT getCodePage(); + void addIcon(const TCHAR* szSection, const TCHAR* szDescription, const char* szIconName, const char* szDefaultFile, int iDefaultIndex, int cx = 16, int cy = 16); + void addIcon(const TCHAR* szSection, const TCHAR* szDescription, const char* szIconName, HICON hDefaultIcon, int cx = 16, int cy = 16); + HICON getIcon(const char* szIconName); } /* @@ -192,7 +79,7 @@ namespace mu namespace opt { - void addPage(WPARAM addInfo, const mu_text* pszGroup, const mu_text* pszTitle, const mu_text* pszTab, DLGPROC pfnDlgProc, const mu_ansi* pszTemplate, HINSTANCE hInstance, DWORD flags = ODPF_BOLDGROUPS); + void addPage(WPARAM addInfo, const TCHAR* pszGroup, const TCHAR* pszTitle, const TCHAR* pszTab, DLGPROC pfnDlgProc, const char* pszTemplate, HINSTANCE hInstance, DWORD flags = ODPF_BOLDGROUPS); } /* @@ -212,7 +99,7 @@ namespace mu namespace proto { int enumProtocols(int* numProtocols, PROTOACCOUNT*** ppProtoDescriptors); - const mu_ansi* getContactBaseProto(MCONTACT hContact); + const char* getContactBaseProto(MCONTACT hContact); } /* @@ -221,9 +108,9 @@ namespace mu namespace protosvc { - DWORD getCaps(const mu_ansi* szProto, int flagNum); - int getName(const mu_ansi* szProto, int cchName, mu_text* szName); - HICON loadIcon(const mu_ansi* szProto, int whichIcon); + DWORD getCaps(const char* szProto, int flagNum); + //int getName(const char* szProto, int cchName, char* szName); + HICON loadIcon(const char* szProto, int whichIcon); } /* @@ -242,7 +129,7 @@ namespace mu namespace system { DWORD getVersion(); - int getVersionText(int cchVersion, mu_ansi* szVersion); + int getVersionText(int cchVersion, char* szVersion); int terminated(); } @@ -262,8 +149,8 @@ namespace mu namespace utils { - int pathToRelative(const mu_text* pszPath, mu_text* pszNewPath); - int pathToAbsolute(const mu_text* pszPath, mu_text* pszNewPath); + int pathToRelative(const TCHAR* pszPath, TCHAR* pszNewPath); + int pathToAbsolute(const TCHAR* pszPath, TCHAR* pszNewPath); } /* @@ -280,12 +167,12 @@ namespace mu * string handling */ - mu_ansi* wideToAnsiDup(const mu_wide* pszWide, UINT uCP = CP_ACP); - mu_wide* ansiToWideDup(const mu_ansi* pszAnsi, UINT uCP = CP_ACP); - mu_ansi* wideToAnsi(const mu_wide* pszWide, mu_ansi* pszRes, int maxLen, UINT uCP = CP_ACP); - mu_wide* ansiToWide(const mu_ansi* pszAnsi, mu_wide* pszRes, int maxLen, UINT uCP = CP_ACP); - inline void freeWide(mu_wide* pszWide) { free(pszWide); } - inline void freeAnsi(mu_ansi* pszAnsi) { free(pszAnsi); } + char* wideToAnsiDup(const WCHAR* pszWide, UINT uCP = CP_ACP); + WCHAR* ansiToWideDup(const char* pszAnsi, UINT uCP = CP_ACP); + char* wideToAnsi(const WCHAR* pszWide, char* pszRes, int maxLen, UINT uCP = CP_ACP); + WCHAR* ansiToWide(const char* pszAnsi, WCHAR* pszRes, int maxLen, UINT uCP = CP_ACP); + inline void freeWide(WCHAR* pszWide) { free(pszWide); } + inline void freeAnsi(char* pszAnsi) { free(pszAnsi); } } #endif // HISTORYSTATS_GUARD_MU_COMMON_H -- cgit v1.2.3