summaryrefslogtreecommitdiff
path: root/plugins/SmileyAdd
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/SmileyAdd')
-rw-r--r--plugins/SmileyAdd/general.cpp24
-rw-r--r--plugins/SmileyAdd/general.h21
-rw-r--r--plugins/SmileyAdd/imagecache.cpp6
-rw-r--r--plugins/SmileyAdd/main.cpp18
-rw-r--r--plugins/SmileyAdd/services.cpp19
-rw-r--r--plugins/SmileyAdd/smileyroutines.cpp48
-rw-r--r--plugins/SmileyAdd/smileys.cpp10
7 files changed, 23 insertions, 123 deletions
diff --git a/plugins/SmileyAdd/general.cpp b/plugins/SmileyAdd/general.cpp
index 03164e5c44..9e97737f8c 100644
--- a/plugins/SmileyAdd/general.cpp
+++ b/plugins/SmileyAdd/general.cpp
@@ -26,9 +26,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
#include "m_popup.h"
-#if defined _UNICODE || defined UNICODE
-#include "m_popupw.h"
-#endif
*/
static ULONG_PTR g_gdiplusToken = 0;
static bool gdiPlusFail = false;
@@ -278,22 +275,18 @@ void ReportError(const TCHAR* errmsg)
{
static const TCHAR title[] = _T("Miranda SmileyAdd");
/*
-#if defined _UNICODE || defined UNICODE
+
POPUPDATAW pd = {0};
-#else
- POPUPDATAEX pd = {0};
-#endif
+
_tcscpy(pd.lpwzContactName, title);
_tcscpy(pd.lpwzText, errmsg);
pd.iSeconds = -1;
-#if defined _UNICODE || defined UNICODE
+
bool popupFail = PUAddPopUpW(&pd) != CALLSERVICE_NOTFOUND;
-#else
- bool popupFail = PUAddPopUpEx(&pd) != CALLSERVICE_NOTFOUND;
-#endif
+
if (popupFail)
*/
MessageBox(NULL, errmsg, title, MB_OK | MB_ICONWARNING | MB_TOPMOST);
@@ -302,14 +295,5 @@ void ReportError(const TCHAR* errmsg)
#pragma warning( disable : 4786 )
#undef _MT
-#if defined _UNICODE || defined UNICODE
-
#include <wcpattern.cpp>
#include <wcmatcher.cpp>
-
-#else
-
-#include <pattern.cpp>
-#include <matcher.cpp>
-
-#endif
diff --git a/plugins/SmileyAdd/general.h b/plugins/SmileyAdd/general.h
index 72bdc217ba..8cc13c5619 100644
--- a/plugins/SmileyAdd/general.h
+++ b/plugins/SmileyAdd/general.h
@@ -51,8 +51,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma warning( disable : 4275 )
#pragma warning( disable : 4390 )
-#if defined _UNICODE || defined UNICODE
-
#include <wcpattern.h>
#include <wcmatcher.h>
@@ -60,17 +58,6 @@ typedef WCPattern _TPattern;
typedef WCMatcher _TMatcher;
#define createTMatcher createWCMatcher
-#else
-
-#include <pattern.h>
-#include <matcher.h>
-
-typedef Pattern _TPattern;
-typedef Matcher _TMatcher;
-#define createTMatcher createMatcher
-
-#endif
-
#pragma warning( pop )
#define _MT
@@ -164,18 +151,10 @@ public:
operator char*() const { return m_psz; }
};
-#if defined _UNICODE || defined UNICODE
#define T2A_SM (char*)W2A_SM
#define T2W_SM(p1) (wchar_t*)p1
#define A2T_SM (wchar_t*)A2W_SM
#define W2T_SM(p1) (TCHAR*)p1
-#else
-#define T2A_SM(p1) (char*)p1
-#define T2W_SM A2W_SM
-#define A2T_SM(p1) (TCHAR*)p1
-#define W2T_SM W2A_SM
-#endif
-
template<class T> struct SMOBJLIST : public OBJLIST<T>
{
diff --git a/plugins/SmileyAdd/imagecache.cpp b/plugins/SmileyAdd/imagecache.cpp
index b771c4941b..8fdcea9003 100644
--- a/plugins/SmileyAdd/imagecache.cpp
+++ b/plugins/SmileyAdd/imagecache.cpp
@@ -75,11 +75,9 @@ static HMODULE LoadDll(const bkstring& file)
{
FreeLibrary(lastmodule);
lastdllname = file;
-#if (defined _UNICODE || defined UNICODE)
+
lastmodule = LoadLibraryEx(file.c_str(), NULL, LOAD_LIBRARY_AS_DATAFILE);
-#else
- lastmodule = LoadLibraryEx(file.c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES);
-#endif
+
}
laststamp = time(NULL);
diff --git a/plugins/SmileyAdd/main.cpp b/plugins/SmileyAdd/main.cpp
index e0965d8655..92a7285a45 100644
--- a/plugins/SmileyAdd/main.cpp
+++ b/plugins/SmileyAdd/main.cpp
@@ -56,11 +56,7 @@ static const PLUGININFOEX pluginInfoEx =
"Copyright© 2004 - 2012 Boris Krasnovskiy, portions by Rein-Peter de Boer",
"http://code.google.com/p/mirandaimplugins/downloads/list",
// "http://addons.miranda-im.org/index.php?action=display&id=2152",
-#if defined(UNICODE) | defined(_UNICODE)
UNICODE_AWARE, //not transient
-#else
- 0,
-#endif
0, //doesn't replace anything built-in
// {BD542BB4-5AE4-4d0e-A435-BA8DBE39607F}
{ 0xbd542bb4, 0x5ae4, 0x4d0e, { 0xa4, 0x35, 0xba, 0x8d, 0xbe, 0x39, 0x60, 0x7f } }
@@ -145,19 +141,13 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link)
char temp[80];
CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)SIZEOF(temp), (LPARAM)temp);
-#ifdef _UNICODE
+
if (strstr(temp, "Unicode") == NULL)
{
ReportError(TranslateT("Please update SmileyAdd to ANSI Version"));
return 1;
}
-#else
- if (strstr(temp, "Unicode") != NULL)
- {
- ReportError(Translate("Please update SmileyAdd to Unicode Version"));
- return 1;
- }
-#endif
+
InitImageCache();
@@ -190,9 +180,9 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link)
hService[10] = CreateServiceFunction(MS_SMILEYADD_RELOAD, ReloadPack);
hService[11] = CreateServiceFunction(MS_SMILEYADD_LOADCONTACTSMILEYS, LoadContactSmileys);
-#if defined(UNICODE) | defined(_UNICODE)
+
hService[12] = CreateServiceFunction(MS_SMILEYADD_PARSEW, ParseTextW);
-#endif
+
return 0;
}
diff --git a/plugins/SmileyAdd/services.cpp b/plugins/SmileyAdd/services.cpp
index 1993e7e733..fed1b4c7ad 100644
--- a/plugins/SmileyAdd/services.cpp
+++ b/plugins/SmileyAdd/services.cpp
@@ -253,7 +253,7 @@ INT_PTR ParseText(WPARAM, LPARAM lParam)
return TRUE;
}
-#if defined(UNICODE) | defined(_UNICODE)
+
INT_PTR ParseTextW(WPARAM, LPARAM lParam)
{
SMADD_PARSEW* smre = (SMADD_PARSEW*) lParam;
@@ -294,7 +294,7 @@ INT_PTR ParseTextW(WPARAM, LPARAM lParam)
return TRUE;
}
-#endif
+
INT_PTR ParseTextBatch(WPARAM, LPARAM lParam)
{
@@ -341,11 +341,8 @@ INT_PTR ParseTextBatch(WPARAM, LPARAM lParam)
}
smre->numSmileys = smllist.getCount();
-#if defined(UNICODE) | defined(_UNICODE)
+
smre->oflag = smre->flag | SAFL_UNICODE;
-#else
- smre->oflag = smre->flag & ~SAFL_UNICODE;
-#endif
return (INT_PTR)res;
}
@@ -363,16 +360,14 @@ INT_PTR RegisterPack(WPARAM, LPARAM lParam)
if (smre == NULL || smre->cbSize < sizeof(SMADD_REGCAT)) return FALSE;
if (IsBadStringPtrA(smre->name, 50) || IsBadStringPtrA(smre->dispname, 50)) return FALSE;
-#if (defined _UNICODE || defined UNICODE)
+
unsigned lpcp = (unsigned)CallService(MS_LANGPACK_GETCODEPAGE, 0, 0);
if (lpcp == CALLSERVICE_NOTFOUND) lpcp = CP_ACP;
-#endif
-#if (defined _UNICODE || defined UNICODE)
+
+
bkstring nmd(A2W_SM(smre->dispname, lpcp));
-#else
- bkstring nmd(smre->dispname);
-#endif
+
bkstring nm(A2T_SM(smre->name));
g_SmileyCategories.AddAndLoad(nm, nmd);
diff --git a/plugins/SmileyAdd/smileyroutines.cpp b/plugins/SmileyAdd/smileyroutines.cpp
index c5e6e46d8a..ba136d7ed5 100644
--- a/plugins/SmileyAdd/smileyroutines.cpp
+++ b/plugins/SmileyAdd/smileyroutines.cpp
@@ -29,12 +29,9 @@ ISmileyBase* CreateSmileyObject(SmileyType* sml);
ISmileyBase* CreateAniSmileyObject(SmileyType* sml, COLORREF clr, bool ishpp);
-#ifdef _UNICODE
+
bool g_HiddenTextSupported = true;
-#else
-int RichEditVersion(void);
-bool g_HiddenTextSupported = (RichEditVersion() == 3);
-#endif
+
// {8CC497C0-A1DF-11CE-8098-00AA0047BE5D}
const GUID IID_ITextDocument =
@@ -272,11 +269,6 @@ void ReplaceSmileys(HWND hwnd, SmileyPackType* smp, SmileyPackCType* smcp, const
SmileysQueueType smllist;
-#if !defined(_UNICODE) && !defined(UNICODE)
- size_t len = SysStringLen(btxt);
- for (unsigned i=0; i<len; ++i)
- if (btxt[i] == 65532) btxt[i] = L' ';
-#endif
LookupAllSmileys(smp, smcp, W2T_SM(btxt), smllist, false);
@@ -616,39 +608,3 @@ void ReplaceSmileysWithText(HWND hwnd, CHARRANGE& sel, bool keepFrozen)
TextDocument->Release();
RichEditOle->Release();
}
-
-
-#if !defined(_UNICODE) && !defined(UNICODE)
-int RichEditVersion(void)
-{
- int ret = -1;
-
- HMODULE hLib = GetModuleHandle(_T("riched20.dll"));
- HRSRC hVersion = FindResource(hLib, MAKEINTRESOURCE(VS_VERSION_INFO), RT_VERSION);
- if (hVersion != NULL)
- {
- HGLOBAL hGlobal = LoadResource(hLib, hVersion);
- if (hGlobal != NULL)
- {
- LPVOID versionInfo = LockResource(hGlobal);
- if (versionInfo != NULL)
- {
- int vl = *(unsigned short*)versionInfo;
- unsigned *res = (unsigned*)versionInfo;
- while (*res != 0xfeef04bd && ((char*)res - (char*)versionInfo) < vl) ++res;
-
- if (((char*)res - (char*)versionInfo) < vl)
- {
- VS_FIXEDFILEINFO *vsInfo = (VS_FIXEDFILEINFO*)res;
- ret = LOWORD(vsInfo->dwFileVersionMS) ? 3 : 2;
- }
- }
- UnlockResource(hGlobal);
- FreeResource(hGlobal);
- }
- }
- return ret;
-}
-#endif
-
-
diff --git a/plugins/SmileyAdd/smileys.cpp b/plugins/SmileyAdd/smileys.cpp
index c23467812d..84dc16b6a9 100644
--- a/plugins/SmileyAdd/smileys.cpp
+++ b/plugins/SmileyAdd/smileys.cpp
@@ -993,10 +993,10 @@ void SmileyCategoryListType::AddAllProtocolsAsCategory(void)
const bkstring& defaultFile = GetSmileyCategory(tname)->GetFilename();
-#if (defined _UNICODE || defined UNICODE)
+
unsigned lpcp = (unsigned)CallService(MS_LANGPACK_GETCODEPAGE, 0, 0);
if (lpcp == CALLSERVICE_NOTFOUND) lpcp = CP_ACP;
-#endif
+
PROTOCOLDESCRIPTOR **protoList;
PROTOACCOUNT **accList;
@@ -1029,11 +1029,9 @@ void SmileyCategoryListType::AddAllProtocolsAsCategory(void)
char protoName[128];
CallProtoService(protoList[i]->szName, PS_GETNAME, sizeof(protoName), (LPARAM)protoName);
-#if (defined _UNICODE || defined UNICODE)
+
displayName = A2W_SM(protoName, lpcp);
-#else
- displayName = protoName;
-#endif
+
tname = A2T_SM(protoList[i]->szName);
AddCategory(tname, displayName, smcProto, paths);
}