From 58973a21a30bf95427fd43c456e41e35c386218c Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Fri, 15 Jun 2012 18:52:16 +0000 Subject: another portion of "#ifsef Unicode" removal git-svn-id: http://svn.miranda-ng.org/main/trunk@434 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Boltun/Engine/Mind.cpp | 22 +++-- plugins/Boltun/Engine/Mind.h | 3 +- plugins/Boltun/Engine/MyCodeCvt.cpp | 4 - plugins/Boltun/actionQueue.cpp | 14 ++- plugins/Boltun/boltun.cpp | 6 +- plugins/Boltun/boltun.h | 10 +-- plugins/BossKeyPlus/BossKey.cpp | 4 +- plugins/CSList/cslist.h | 9 +- plugins/CSList/strpos.h | 26 ++---- plugins/Clist_nicer/INCLUDE/clist.h | 7 +- plugins/Clist_nicer/SRC/clc.cpp | 8 +- plugins/Clist_nicer/SRC/clcitems.cpp | 19 ++-- plugins/Clist_nicer/SRC/clcpaint.cpp | 19 +--- plugins/Clist_nicer/SRC/clcutils.cpp | 6 +- plugins/Clist_nicer/SRC/clistevents.cpp | 6 +- plugins/Clist_nicer/SRC/extBackg.cpp | 18 ++-- plugins/Clist_nicer/SRC/init.cpp | 4 +- plugins/Clist_nicer/skineditor/skinedit.rc | 18 +--- plugins/Console/Console.c | 20 +---- plugins/CountryFlags/icons.c | 10 +-- plugins/CountryFlags/version.h | 6 +- plugins/Dbx_mmap_SA/Dbtool/dbtool.h | 12 +-- plugins/Dbx_mmap_SA/Dbtool/encryption.cpp | 8 +- plugins/Dbx_mmap_SA/Dbtool/langpack.cpp | 6 +- plugins/Dbx_mmap_SA/Dbtool/modulechain.cpp | 6 +- plugins/Dbx_mmap_SA/Import_SA/encryption.c | 7 +- plugins/Dbx_mmap_SA/Import_SA/progress.c | 5 +- plugins/Dbx_tree/DataBase.cpp | 8 +- plugins/Dbx_tree/Logger.h | 11 +-- plugins/FavContacts/src/contact_cache.cpp | 3 +- plugins/FavContacts/src/headers.h | 4 - plugins/FavContacts/src/http_api.cpp | 4 +- plugins/FingerPrintModPlus/src/fingerprint.cpp | 108 ++++++----------------- plugins/FingerPrintModPlus/src/utilities.h | 15 +--- plugins/HistoryLinkListPlus/linklist_fct.c | 8 +- plugins/IEView/TemplateHTMLBuilder.cpp | 5 +- plugins/IEView/ieview_common.h | 4 +- plugins/MenuItemEx/main.c | 13 +-- plugins/MenuItemEx/version.h | 4 - plugins/NewXstatusNotify/main.cpp | 42 +++------ plugins/NewXstatusNotify/xstatus.cpp | 10 +-- plugins/Nudge/main.cpp | 22 ++--- plugins/PackUpdater/Src/Common.h | 12 +-- plugins/Popup/src/actions.cpp | 7 +- plugins/Popup/src/avatars_gif.cpp | 13 +-- plugins/Popup/src/avatars_simple.cpp | 14 +-- plugins/Popup/src/bitmap_funcs.cpp | 12 +-- plugins/Popup/src/common.h | 45 +--------- plugins/Popup/src/config.cpp | 24 ------ plugins/Popup/src/config.h | 29 ------- plugins/Popup/src/history.cpp | 22 +---- plugins/Popup/src/main.cpp | 67 -------------- plugins/Popup/src/opt_adv.cpp | 55 +++--------- plugins/Popup/src/opt_gen.cpp | 16 +--- plugins/Popup/src/opt_skins.cpp | 21 +---- plugins/Popup/src/opttree.cpp | 28 +----- plugins/Popup/src/popup_thread.cpp | 16 +--- plugins/Popup/src/popup_wnd2.cpp | 103 ++++------------------ plugins/Popup/src/skin.cpp | 115 ++++--------------------- plugins/mTextControl/src/FormattedTextDraw.cpp | 18 ++-- plugins/mTextControl/src/headers.h | 11 --- plugins/mTextControl/src/richeditutils.cpp | 6 +- plugins/mTextControl/src/services.cpp | 12 +-- plugins/mTextControl/src/textcontrol.cpp | 8 +- 64 files changed, 238 insertions(+), 960 deletions(-) diff --git a/plugins/Boltun/Engine/Mind.cpp b/plugins/Boltun/Engine/Mind.cpp index 667e1faf1a..fc4520de55 100644 --- a/plugins/Boltun/Engine/Mind.cpp +++ b/plugins/Boltun/Engine/Mind.cpp @@ -26,9 +26,7 @@ #include -#ifdef UNICODE #include "MyCodeCvt.h" -#endif using namespace std; @@ -108,19 +106,19 @@ void Mind::Load(tstring filename) { basic_ifstream > file; setlocale(LC_ALL, ""); -#ifdef UNICODE + locale ulocale(locale(), new MyCodeCvt); file.imbue(ulocale); -#endif + file.open(filename.c_str(), ios_base::in | ios_base::binary); tstring s1, st; TCHAR *c, *co; size_t count; int error = 0; int line = 1; -#ifdef UNICODE + bool start = true; -#endif + try { while (file.good()) @@ -129,7 +127,7 @@ void Mind::Load(tstring filename) if (st.empty()) break; line++; -#ifdef UNICODE + if (start) { if (st[0] == 65279) @@ -141,7 +139,7 @@ void Mind::Load(tstring filename) fileTypeMark = false; start = false; } -#endif + format(st); count = st.length(); c = co = new TCHAR[count+1]; @@ -317,15 +315,15 @@ void Mind::Load(tstring filename) void Mind::Save(tstring filename) const { basic_ofstream > file; -#ifdef UNICODE + locale ulocale(locale(), new MyCodeCvt); file.imbue(ulocale); -#endif + file.open(filename.c_str(), ios_base::out | ios_base::binary); -#ifdef UNICODE + if (fileTypeMark) file << TCHAR(65279); -#endif + for (string_mmap::iterator it = data->study.begin(); it != data->study.end(); it++) { file << (*it).first << _T('\r') << endl; diff --git a/plugins/Boltun/Engine/Mind.h b/plugins/Boltun/Engine/Mind.h index ecf3f5d199..23e0a41bd3 100644 --- a/plugins/Boltun/Engine/Mind.h +++ b/plugins/Boltun/Engine/Mind.h @@ -59,9 +59,8 @@ class Mind { private: MindData *data; -#ifdef UNICODE bool fileTypeMark; -#endif + std::vector Parse(tstring s); public: Mind(); diff --git a/plugins/Boltun/Engine/MyCodeCvt.cpp b/plugins/Boltun/Engine/MyCodeCvt.cpp index 49722e6f7b..5d7baf4d88 100644 --- a/plugins/Boltun/Engine/MyCodeCvt.cpp +++ b/plugins/Boltun/Engine/MyCodeCvt.cpp @@ -18,8 +18,6 @@ // //*********************************************************** -#ifdef UNICODE - #include "MyCodeCvt.h" using namespace std; @@ -81,5 +79,3 @@ int MyCodeCvt::do_encoding() const _THROW0() { return 2; } - -#endif \ No newline at end of file diff --git a/plugins/Boltun/actionQueue.cpp b/plugins/Boltun/actionQueue.cpp index b627d8abc4..c464c92f39 100644 --- a/plugins/Boltun/actionQueue.cpp +++ b/plugins/Boltun/actionQueue.cpp @@ -95,7 +95,7 @@ static bool NotifyTyping(HANDLE hContact) static char *MsgServiceName(HANDLE hContact) { -#ifdef _UNICODE + char szServiceName[100]; char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0); if (szProto == NULL) @@ -104,7 +104,7 @@ static char *MsgServiceName(HANDLE hContact) mir_snprintf(szServiceName, sizeof(szServiceName), "%s%sW", szProto, PSS_MESSAGE); if (ServiceExists(szServiceName)) return PSS_MESSAGE "W"; -#endif + return PSS_MESSAGE; } @@ -114,7 +114,7 @@ static void TimerAnswer(HANDLE hContact, const TalkBot::MessageInfo* info) int size = (int)info->Answer.length() + 1; int bufsize = size; char* msg; -#ifdef UNICODE + bufsize *= sizeof(TCHAR) + 1; msg = new char[bufsize]; //msg[size - 1] = '\0'; @@ -123,9 +123,7 @@ static void TimerAnswer(HANDLE hContact, const TalkBot::MessageInfo* info) NULL, NULL)) FillMemory(msg, size - 1, '-'); //In case of fault return "----" in ANSI part CopyMemory(msg + size, info->Answer.c_str(), size * 2); -#else - msg = respItem->szMes; -#endif + CallContactService(hContact, MsgServiceName(hContact), PREF_TCHAR, (LPARAM)msg); @@ -142,9 +140,9 @@ static void TimerAnswer(HANDLE hContact, const TalkBot::MessageInfo* info) CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&ldbei); bot->AnswerGiven(hContact, *info); delete info; -#ifdef UNICODE + delete msg; -#endif + typingContactsLock.Enter(); typingContacts.erase(hContact); typingContactsLock.Leave(); diff --git a/plugins/Boltun/boltun.cpp b/plugins/Boltun/boltun.cpp index a26b68c862..9d7d9b6fb5 100644 --- a/plugins/Boltun/boltun.cpp +++ b/plugins/Boltun/boltun.cpp @@ -81,11 +81,9 @@ static HANDLE hMenuItemAutoChat; static HANDLE hMenuItemNotToChat; static HANDLE hMenuItemStartChatting; -#ifdef UNICODE + #define MIND_DIALOG_FILTER _T("%s (*.mindw)\1*.mindw\1%s (*.*)\1*.*\1") -#else -#define MIND_DIALOG_FILTER "%s (*.mind)\1*.mind\1%s (*.*)\1*.*\1" -#endif + #ifdef DEBUG_LOAD_TIME #include diff --git a/plugins/Boltun/boltun.h b/plugins/Boltun/boltun.h index 6063dc2310..914869387c 100644 --- a/plugins/Boltun/boltun.h +++ b/plugins/Boltun/boltun.h @@ -23,11 +23,9 @@ //Should use different keys in UNICODE and ANSI builds, because usage of plugin //with old (another) configs will cause crashes. -#ifdef _UNICODE -#define BOLTUN_KEY "BoltunW" -#else + #define BOLTUN_KEY "Boltun" -#endif + //Service names #define SERV_CONTACT_AUTO_CHAT "Boltun/ContactAutoChat" @@ -43,11 +41,7 @@ #define BOLTUN_GROUP "Message sessions" //Filename depends on UNICODE -#ifdef UNICODE #define DEFAULT_MIND_FILE _T("boltun.mindw") -#else -#define DEFAULT_MIND_FILE _T("boltun.mind") -#endif //=============================================== // These are strings for translation: diff --git a/plugins/BossKeyPlus/BossKey.cpp b/plugins/BossKeyPlus/BossKey.cpp index 8cf8e3cfdc..9a89bb372d 100644 --- a/plugins/BossKeyPlus/BossKey.cpp +++ b/plugins/BossKeyPlus/BossKey.cpp @@ -758,9 +758,7 @@ int MirandaLoaded(WPARAM wParam,LPARAM lParam) RegisterCoreHotKeys(); -#ifndef _UNICODE - if (IsWinVer2000Plus()) -#endif + g_hWinHook = SetWinEventHook(EVENT_OBJECT_CREATE, EVENT_OBJECT_SHOW, NULL, WinEventProc, GetCurrentProcessId(), 0, 0); diff --git a/plugins/CSList/cslist.h b/plugins/CSList/cslist.h index 652c8f7195..9fd1b5a5c9 100644 --- a/plugins/CSList/cslist.h +++ b/plugins/CSList/cslist.h @@ -43,16 +43,11 @@ #ifndef __CSLIST_H #define __CSLIST_H 1 -#if defined UNICODE + #define WINVER 0x501 #define _WIN32_WINNT 0x501 #define _WIN32_IE 0x600 -#else -#define WINVER 0x400 -#define _WIN32_WINNT 0x400 -#define _WIN32_IE 0x400 -#define LVIF_GROUPID 0 -#endif + #define MIRANDA_VER 0x0A00 #pragma warning( disable: 4996 ) diff --git a/plugins/CSList/strpos.h b/plugins/CSList/strpos.h index aaffa3988b..210bfddf0a 100644 --- a/plugins/CSList/strpos.h +++ b/plugins/CSList/strpos.h @@ -31,15 +31,12 @@ * You might want to place this next block in a header file somewhere: */ -#ifndef UNICODE -# define TCHAR char -# define STRING char * -#else + # ifndef TCHAR # define TCHAR wchar_t # endif /* TCHAR */ # define STRING wchar_t * -#endif /* UNICODE */ + @@ -52,32 +49,21 @@ int strpos( STRING haystack, STRING needle ) TCHAR lpBuf[1024]; #endif /* def DEBUG_VERBOSE */ - #ifndef UNICODE - pDest = (STRING) strstr( haystack, needle ); - #else - pDest = (STRING) wcsstr( haystack, needle ); - #endif /* UNICODE */ + pDest = (STRING) wcsstr( haystack, needle ); + if ( pDest ) position = pDest - haystack; else { #ifdef DEBUG_VERBOSE -# ifdef UNICODE - printf( L"strpos(): Could not find '%s' in '%s'.\tFAIL.", needle, haystack ); -# else - printf( "strpos(): Could not find '%s' in '%s'.\tFAIL.", needle, haystack ); -# endif /* def UNICODE */ + printf( L"strpos(): Could not find '%s' in '%s'.\tFAIL.", needle, haystack ); #endif /* def DEBUG_VERBOSE */ return -1; } #ifdef DEBUG_VERBOSE -# ifdef UNICODE - printf( L"strpos(): Found '%s' at position: %d.\t\tOK.", needle, position ); -# else - printf( "strpos(): Found '%s' at position: %d.\t\tOK.", needle, position ); -# endif /* def UNICODE */ + printf( L"strpos(): Found '%s' at position: %d.\t\tOK.", needle, position ); #endif /* def DEBUG_VERBOSE */ return position; diff --git a/plugins/Clist_nicer/INCLUDE/clist.h b/plugins/Clist_nicer/INCLUDE/clist.h index a4d956ba3c..f4cabd2419 100644 --- a/plugins/Clist_nicer/INCLUDE/clist.h +++ b/plugins/Clist_nicer/INCLUDE/clist.h @@ -47,10 +47,7 @@ void SortContacts(void); #define CLVM_INCLUDED_UNGROUPED 8 #define CLVM_USELASTMSG 16 -#if defined(_UNICODE) - #define CLVM_MODULE "CLVM_W" -#else - #define CLVM_MODULE "CLVM" -#endif +#define CLVM_MODULE "CLVM_W" + diff --git a/plugins/Clist_nicer/SRC/clc.cpp b/plugins/Clist_nicer/SRC/clc.cpp index 9e7e907bcc..439221be8d 100644 --- a/plugins/Clist_nicer/SRC/clc.cpp +++ b/plugins/Clist_nicer/SRC/clc.cpp @@ -449,9 +449,9 @@ LBL_Def: if (!FindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL)) break; lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HANDLE)wParam, 0), safe_sizeof(contact->szText)); -#if defined(_UNICODE) + RTL_DetectAndSet(contact, 0); -#endif + dat->bNeedSort = TRUE; PostMessage(hwnd, INTM_SORTCLC, 0, 0); goto LBL_Def; @@ -537,9 +537,9 @@ LBL_Def: contact->proto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0); CallService(MS_CLIST_INVALIDATEDISPLAYNAME, wParam, 0); lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HANDLE)wParam, 0), safe_sizeof(contact->szText)); -#if defined(_UNICODE) + RTL_DetectAndSet(contact, 0); -#endif + dat->bNeedSort = TRUE; PostMessage(hwnd, INTM_SORTCLC, 0, 0); goto LBL_Def; diff --git a/plugins/Clist_nicer/SRC/clcitems.cpp b/plugins/Clist_nicer/SRC/clcitems.cpp index 34b3a66405..009a57a36d 100644 --- a/plugins/Clist_nicer/SRC/clcitems.cpp +++ b/plugins/Clist_nicer/SRC/clcitems.cpp @@ -76,13 +76,10 @@ struct ClcGroup *AddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, D { struct ClcGroup *p = saveAddGroup( hwnd, dat, szName, flags, groupId, calcTotalMembers); - #if defined(_UNICODE) + if ( p && p->parent ) RTL_DetectGroupName( p->parent->cl.items[ p->parent->cl.count-1] ); - #else - if ( p && p->parent ) - p->parent->cl.items[ p->parent->cl.count -1]->isRtl = 0; - #endif + return p; } @@ -166,9 +163,9 @@ int AddContactToGroup(struct ClcData *dat, struct ClcGroup *group, HANDLE hConta // notify other plugins to re-supply their extra images (icq for xstatus, mBirthday etc...) NotifyEventHooks(hExtraImageApplying, (WPARAM)hContact, 0); } -#if defined(_UNICODE) + RTL_DetectAndSet( p, p->hContact); -#endif + p->avatarLeft = p->extraIconRightBegin = -1; p->flags |= cfg::getByte(p->hContact, "CList", "Priority", 0) ? CONTACTF_PRIORITY : 0; @@ -342,7 +339,7 @@ BYTE GetCachedStatusMsg(int iExtraCacheEntry, char *szProto) if ( !result ) DBFreeVariant( &dbv ); -#if defined(_UNICODE) + if(cEntry->bStatusMsgValid != STATUSMSG_NOTFOUND) { WORD infoTypeC2[12]; int iLen, i @@ -358,7 +355,7 @@ BYTE GetCachedStatusMsg(int iExtraCacheEntry, char *szProto) } } } -#endif + if(cEntry->hTimeZone == NULL) TZ_LoadTimeZone(hContact, cEntry, szProto); return cEntry->bStatusMsgValid;; @@ -397,7 +394,7 @@ void ReloadExtraInfo(HANDLE hContact) * autodetect RTL property of the nickname, evaluates the first 10 characters of the nickname only */ -#if defined(_UNICODE) + void RTL_DetectAndSet(struct ClcContact *contact, HANDLE hContact) { WORD infoTypeC2[12]; @@ -447,7 +444,7 @@ void RTL_DetectGroupName(struct ClcContact *group) } } } -#endif + /* * check for exteneded user information - email, phone numbers, homepage * set extra icons accordingly diff --git a/plugins/Clist_nicer/SRC/clcpaint.cpp b/plugins/Clist_nicer/SRC/clcpaint.cpp index 7d3d799992..ef7cf12932 100644 --- a/plugins/Clist_nicer/SRC/clcpaint.cpp +++ b/plugins/Clist_nicer/SRC/clcpaint.cpp @@ -497,7 +497,7 @@ void __inline PaintItem(HDC hdcMem, struct ClcGroup *group, struct ClcContact *c else cEntry = cfg::eCache; -#if defined(_UNICODE) + if(dat->bisEmbedded) goto set_bg_l; @@ -525,16 +525,7 @@ void __inline PaintItem(HDC hdcMem, struct ClcGroup *group, struct ClcContact *c bg_indent_l = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0; set_bg_l: -#else - if(type == CLCIT_GROUP && cfg::dat.bGroupAlign == CLC_GROUPALIGN_RIGHT && !dat->bisEmbedded && API::pfnSetLayout != 0) { - g_RTL = TRUE; - bg_indent_r = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0; - } - else { - g_RTL = FALSE; - bg_indent_l = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0; - } -#endif + g_hottrack = dat->exStyle & CLS_EX_TRACKSELECT && type == CLCIT_CONTACT && dat->iHotTrack == index; if (g_hottrack == selected) @@ -1276,11 +1267,9 @@ nodisplay: if ((dwFlags & CLUI_FRAME_SHOWSTATUSMSG && smsgValid > STATUSMSG_XSTATUSID) || smsgValid == STATUSMSG_XSTATUSNAME) szText = cEntry->statusMsg; else -#if defined(_UNICODE) + szText = &statusNames[cstatus - ID_STATUS_OFFLINE][0]; -#else - szText = statusNames[cstatus - ID_STATUS_OFFLINE]; -#endif + if(cEntry->dwCFlags & ECF_RTLSTATUSMSG && cfg::dat.bUseDCMirroring == 3) dt_2ndrowflags |= (DT_RTLREADING | DT_RIGHT); diff --git a/plugins/Clist_nicer/SRC/clcutils.cpp b/plugins/Clist_nicer/SRC/clcutils.cpp index e4aee0fda9..f41b091517 100644 --- a/plugins/Clist_nicer/SRC/clcutils.cpp +++ b/plugins/Clist_nicer/SRC/clcutils.cpp @@ -542,7 +542,7 @@ void BeginRenameSelection(HWND hwnd, struct ClcData *dat) for (i=0; i <= FONTID_LAST; i++) if (hfontInfo[i].fontHeight+2) h=dat->fontInfo[i].fontHeight+2; } -#if defined(_UNICODE) + dat->hwndRenameEdit = CreateWindowEx(0, _T("RichEdit20W"),contact->szText,WS_CHILD|WS_BORDER|ES_MULTILINE|ES_AUTOHSCROLL,x,y,clRect.right-x,h,hwnd,NULL,g_hInst,NULL); { if ((contact->type == CLCIT_CONTACT && cfg::eCache[contact->extraCacheEntry].dwCFlags & ECF_RTLNICK) || (contact->type == CLCIT_GROUP && contact->isRtl)) { @@ -556,9 +556,7 @@ void BeginRenameSelection(HWND hwnd, struct ClcData *dat) SetWindowText(dat->hwndRenameEdit, contact->szText); } } -#else - dat->hwndRenameEdit = CreateWindow(_T("EDIT"),contact->szText,WS_CHILD|WS_BORDER|ES_MULTILINE|ES_AUTOHSCROLL,x,y,clRect.right-x,h,hwnd,NULL,g_hInst,NULL); -#endif + //dat->hwndRenameEdit = CreateWindow(_T("EDIT"), contact->szText, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, x, y, clRect.right - x, dat->rowHeight, hwnd, NULL, g_hInst, NULL); OldRenameEditWndProc = (WNDPROC) SetWindowLongPtr(dat->hwndRenameEdit, GWLP_WNDPROC, (LONG_PTR) RenameEditSubclassProc); SendMessage(dat->hwndRenameEdit, WM_SETFONT, (WPARAM) (contact->type == CLCIT_GROUP ? dat->fontInfo[FONTID_GROUPS].hFont : dat->fontInfo[FONTID_CONTACTS].hFont), 0); diff --git a/plugins/Clist_nicer/SRC/clistevents.cpp b/plugins/Clist_nicer/SRC/clistevents.cpp index 953877c27d..93b90c34ce 100644 --- a/plugins/Clist_nicer/SRC/clistevents.cpp +++ b/plugins/Clist_nicer/SRC/clistevents.cpp @@ -283,14 +283,12 @@ struct CListEvent* AddEvent(CLISTEVENT *cle) if (nmi) { TCHAR szBuffer[128]; TCHAR* szStatus = pcli->pfnGetStatusModeDescription(cfg::getWord(p->cle.hContact, szProto, "Status", ID_STATUS_OFFLINE), 0); -#if defined(_UNICODE) + TCHAR szwProto[64]; MultiByteToWideChar(CP_ACP, 0, szProto, -1, szwProto, 64); szwProto[63] = 0; _snwprintf(szBuffer, SIZEOF(szBuffer), L"%s: %s (%s)", szwProto, szName, szStatus); -#else - _snprintf(szBuffer, SIZEOF(szBuffer), "%s: %s (%s)", szProto, szName, szStatus); -#endif + szBuffer[127] = 0; AppendMenu(cfg::dat.hMenuNotify, MF_BYCOMMAND | MF_STRING, cfg::dat.wNextMenuID, szBuffer); mii.hbmpItem = HBMMENU_CALLBACK; diff --git a/plugins/Clist_nicer/SRC/extBackg.cpp b/plugins/Clist_nicer/SRC/extBackg.cpp index ce3295866b..0aa2b32265 100644 --- a/plugins/Clist_nicer/SRC/extBackg.cpp +++ b/plugins/Clist_nicer/SRC/extBackg.cpp @@ -1208,12 +1208,10 @@ static void BTN_ReadItem(char *itemName, char *file) GetPrivateProfileStringA(itemName, "Tip", "None", szBuffer, 1000, file); if(strcmp(szBuffer, "None")) { -#if defined(_UNICODE) + MultiByteToWideChar(cfg::dat.langPackCP, 0, szBuffer, -1, tmpItem.szTip, 256); tmpItem.szTip[255] = 0; -#else - mir_snprintf(tmpItem.szTip, 256, "%s", szBuffer); -#endif + } else tmpItem.szTip[0] = 0; @@ -1318,13 +1316,11 @@ void LoadPerContactSkins(TCHAR *tszFileName) StatusItems_t *items = NULL, *this_item; HANDLE hContact; int i = 1; -#if defined(_UNICODE) + char file[MAX_PATH]; WideCharToMultiByte(CP_ACP, 0, tszFileName, MAX_PATH, file, MAX_PATH, 0, 0); file[MAX_PATH - 1] = 0; -#else - char *file = tszFileName; -#endif + ReadItem(&default_item, "%Default", file); ZeroMemory(szSections, 3000); @@ -1546,11 +1542,9 @@ static void ApplyCLUISkin() char szFinalName[MAX_PATH]; if (!cfg::getTString(NULL, "CLC", "AdvancedSkin", &dbv)) { MY_pathToAbsolute(dbv.ptszVal, tszFinalName); -#if defined(_UNICODE) + WideCharToMultiByte(CP_ACP, 0, tszFinalName, MAX_PATH, szFinalName, MAX_PATH, 0, 0); -#else - mir_sntprintf(szFinalName, MAX_PATH, _T("%s"), tszFinalName); -#endif + if(cfg::getByte("CLUI", "skin_changed", 0)) { extbk_import(szFinalName, 0); SaveCompleteStructToDB(); diff --git a/plugins/Clist_nicer/SRC/init.cpp b/plugins/Clist_nicer/SRC/init.cpp index 0c02af384e..e606f3320f 100644 --- a/plugins/Clist_nicer/SRC/init.cpp +++ b/plugins/Clist_nicer/SRC/init.cpp @@ -118,7 +118,7 @@ PLUGININFOEX pluginInfo = {0x8f79b4ee, 0xeb48, 0x4a03, { 0x87, 0x3e, 0x27, 0xbe, 0x6b, 0x7e, 0x9a, 0x25 }} //{8F79B4EE-EB48-4a03-873E-27BE6B7E9A25} }; -#if defined(_UNICODE) + void _DebugTraceW(const wchar_t *fmt, ...) { #ifdef _DEBUG @@ -133,7 +133,7 @@ void _DebugTraceW(const wchar_t *fmt, ...) OutputDebugStringW(debug); #endif } -#endif + void _DebugTraceA(const char *fmt, ...) { diff --git a/plugins/Clist_nicer/skineditor/skinedit.rc b/plugins/Clist_nicer/skineditor/skinedit.rc index 25f67d316c..760d20b00d 100644 --- a/plugins/Clist_nicer/skineditor/skinedit.rc +++ b/plugins/Clist_nicer/skineditor/skinedit.rc @@ -101,7 +101,7 @@ VS_VERSION_INFO VERSIONINFO FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" -#if defined(UNICODE) + BEGIN BLOCK "0c0704b0" BEGIN @@ -115,21 +115,7 @@ BEGIN VALUE "ProductVersion", "0, 0, 0, 2" END END -#else - BEGIN - BLOCK "0c0704b0" - BEGIN - VALUE "FileDescription", "Skin Editor (ANSI)" - VALUE "FileVersion", "0, 0, 0, 2" - VALUE "InternalName", "CLN SkinEdit (ANSI)" - VALUE "LegalCopyright", "Copyright (C) 2006" - VALUE "LegalTrademarks", "GPL" - VALUE "OriginalFilename", "cln_skinedit.dll" - VALUE "ProductName", "Clist Nicer+ skin editor" - VALUE "ProductVersion", "0, 0, 0, 2" - END - END -#endif + BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0xc07, 1200 diff --git a/plugins/Console/Console.c b/plugins/Console/Console.c index 7692260239..f6c451b5dd 100644 --- a/plugins/Console/Console.c +++ b/plugins/Console/Console.c @@ -602,11 +602,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARA pchData = (TCHAR*)GlobalLock(hClipboardData); _tcscpy(pchData, buf); GlobalUnlock(hClipboardData); - #ifdef UNICODE - SetClipboardData(CF_UNICODETEXT,hClipboardData); - #else - SetClipboardData(CF_TEXT,hClipboardData); - #endif + SetClipboardData(CF_UNICODETEXT,hClipboardData); } CloseClipboard(); } @@ -790,14 +786,11 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,L { tci.mask = TCIF_PARAM | TCIF_TEXT; tci.lParam = (LPARAM)lw; -#ifdef _UNICODE + tci.pszText = mir_a2u(lw->Module); idx = TabCtrl_InsertItem(hTabs, tabCount, &tci); mir_free(tci.pszText); -#else - tci.pszText = lw->Module; - idx = TabCtrl_InsertItem(hTabs, tabCount, &tci); -#endif + tabCount++; } @@ -1067,7 +1060,6 @@ static int OnFastDump(WPARAM wParam,LPARAM lParam) strncpy(dumpMsg->szModule, ((NETLIBUSER*)wParam)->szDescriptiveName, sizeof(dumpMsg->szModule))[ sizeof(dumpMsg->szModule)-1 ] = 0; -#ifdef _UNICODE { wchar_t *ucs2; @@ -1083,13 +1075,7 @@ static int OnFastDump(WPARAM wParam,LPARAM lParam) wcscat( str, ucs2 ); mir_free( ucs2 ); } -#else - memcpy( str, logMsg->pszHead, headlen ); - memcpy( str + headlen, logMsg->pszMsg, msglen + 1 ); - // try to detect utf8 - mir_utf8decode( str + headlen, NULL ); -#endif InMsgs++; PostMessage(hwndConsole, HM_DUMP, 0, (LPARAM)dumpMsg); } diff --git a/plugins/CountryFlags/icons.c b/plugins/CountryFlags/icons.c index 607308b57a..4558fbd5ca 100644 --- a/plugins/CountryFlags/icons.c +++ b/plugins/CountryFlags/icons.c @@ -231,11 +231,11 @@ void InitIcons(void) char szId[20]; int i,index; HICON hIcon; -#if defined(_UNICODE) + WCHAR szName[64]; LCID locale; locale=(LCID)CallService(MS_LANGPACK_GETLOCALE,0,0); -#endif + /* register icons */ ZeroMemory(&sid,sizeof(sid)); @@ -252,13 +252,11 @@ void InitIcons(void) phIconHandles=(HANDLE*)mir_alloc(nCountriesCount*sizeof(HANDLE)); if(phIconHandles!=NULL) for(i=0;i @@ -116,13 +113,8 @@ __inline LPSTR Translate(LPSTR source) { return ( LPSTR )LangPackTranslateString( source, 0 ); } -#if defined( _UNICODE ) - #define TranslateT(s) (TCHAR*)LangPackTranslateString((LPCSTR)_T(s),1) - #define TranslateTS(s) (TCHAR*)LangPackTranslateString((LPCSTR)s,1) -#else - #define TranslateT(s) LangPackTranslateString(s,0) - #define TranslateTS(s) LangPackTranslateString(s,0) -#endif +#define TranslateT(s) (TCHAR*)LangPackTranslateString((LPCSTR)_T(s),1) +#define TranslateTS(s) (TCHAR*)LangPackTranslateString((LPCSTR)s,1) char* Utf8DecodeCP(char* str, int codepage, wchar_t** ucs2); char* Utf8EncodeUcs2(const wchar_t* src); diff --git a/plugins/Dbx_mmap_SA/Dbtool/encryption.cpp b/plugins/Dbx_mmap_SA/Dbtool/encryption.cpp index cab515864c..3d00d70880 100644 --- a/plugins/Dbx_mmap_SA/Dbtool/encryption.cpp +++ b/plugins/Dbx_mmap_SA/Dbtool/encryption.cpp @@ -88,15 +88,11 @@ void InitSecurity() Modules[ModulesCount]->hLib = hLib; _snprintf(buf,SIZEOF(buf),"%d.%d.%d.%d", HIBYTE(HIWORD(Modules[ModulesCount]->cryptor->Version)), LOBYTE(HIWORD(Modules[ModulesCount]->cryptor->Version)), HIBYTE(LOWORD(Modules[ModulesCount]->cryptor->Version)), LOBYTE(LOWORD(Modules[ModulesCount]->cryptor->Version))); -#ifdef _UNICODE + mbstowcs(Name, Modules[ModulesCount]->cryptor->Name, 100); mbstowcs(Version, buf, 100); mbstowcs(DllName, Modules[ModulesCount]->dllname, 100); -#else - strcpy(Name, Modules[ModulesCount]->cryptor->Name); - strcpy(Version, buf); - strcpy(DllName, Modules[ModulesCount]->dllname); -#endif + AddToStatus(STATUS_MESSAGE,TranslateT("Cryptor loaded: %s [%s] (%s)"), Name, Version, DllName); ModulesCount++; diff --git a/plugins/Dbx_mmap_SA/Dbtool/langpack.cpp b/plugins/Dbx_mmap_SA/Dbtool/langpack.cpp index d76cea33e0..7f2627cd11 100644 --- a/plugins/Dbx_mmap_SA/Dbtool/langpack.cpp +++ b/plugins/Dbx_mmap_SA/Dbtool/langpack.cpp @@ -317,11 +317,7 @@ char *LangPackTranslateString(const char *szEnglish, const int W) return W ? (char *)entry->wlocal : entry->local; } -#if defined( _UNICODE ) - #define FLAGS 1 -#else - #define FLAGS 0 -#endif +#define FLAGS 1 static void TranslateWindow( HWND hwnd ) { diff --git a/plugins/Dbx_mmap_SA/Dbtool/modulechain.cpp b/plugins/Dbx_mmap_SA/Dbtool/modulechain.cpp index a93f1720e6..2b91059176 100644 --- a/plugins/Dbx_mmap_SA/Dbtool/modulechain.cpp +++ b/plugins/Dbx_mmap_SA/Dbtool/modulechain.cpp @@ -98,13 +98,11 @@ int WorkModuleChain(int firstTime) } if (n) { TCHAR *pszModuleName; -#ifdef UNICODE + TCHAR szModuleName[257]; MultiByteToWideChar(CP_ACP, 0, modChain[iCurrentModName].name, -1, szModuleName, sizeof(szModuleName) / sizeof(TCHAR)); pszModuleName = szModuleName; -#else - pszModuleName = modChain[iCurrentModName].name; -#endif + AddToStatus(STATUS_WARNING,TranslateT("Module name '%s' is not unique: %d duplicates found)"), pszModuleName, n); } } diff --git a/plugins/Dbx_mmap_SA/Import_SA/encryption.c b/plugins/Dbx_mmap_SA/Import_SA/encryption.c index f261581041..ede73c006a 100644 --- a/plugins/Dbx_mmap_SA/Import_SA/encryption.c +++ b/plugins/Dbx_mmap_SA/Import_SA/encryption.c @@ -93,16 +93,11 @@ void InitSecurity() _snprintf(buf,SIZEOF(buf),"%d.%d.%d.%d", HIBYTE(HIWORD(Modules[ModulesCount]->cryptor->Version)), LOBYTE(HIWORD(Modules[ModulesCount]->cryptor->Version)), HIBYTE(LOWORD(Modules[ModulesCount]->cryptor->Version)), LOBYTE(LOWORD(Modules[ModulesCount]->cryptor->Version))); // Unsane: none /* -#ifdef _UNICODE + mbstowcs(Name, Modules[ModulesCount]->cryptor->Name, 100); mbstowcs(Version, buf, 100); mbstowcs(DllName, Modules[ModulesCount]->dllname, 100); -#else - strcpy(Name, Modules[ModulesCount]->cryptor->Name); - strcpy(Version, buf); - strcpy(DllName, Modules[ModulesCount]->dllname); -#endif */ AddMessage(LPGEN("Cryptor loaded: %s [%s] (%s)"), Modules[ModulesCount]->cryptor->Name, buf, Modules[ModulesCount]->dllname); diff --git a/plugins/Dbx_mmap_SA/Import_SA/progress.c b/plugins/Dbx_mmap_SA/Import_SA/progress.c index 1417868947..f3f4e9f08a 100644 --- a/plugins/Dbx_mmap_SA/Import_SA/progress.c +++ b/plugins/Dbx_mmap_SA/Import_SA/progress.c @@ -92,12 +92,9 @@ void AddMessage( const char* fmt, ... ) } #endif - #if defined( _UNICODE ) + { TCHAR* str = mir_a2t( msgBuf ); SendMessage( hdlgProgress, PROGM_ADDMESSAGE, 0, ( LPARAM )str ); mir_free( str ); } - #else - SendMessage( hdlgProgress, PROGM_ADDMESSAGE, 0, ( LPARAM )msgBuf ); - #endif } diff --git a/plugins/Dbx_tree/DataBase.cpp b/plugins/Dbx_tree/DataBase.cpp index 85a9d67ccb..101d4b5d34 100644 --- a/plugins/Dbx_tree/DataBase.cpp +++ b/plugins/Dbx_tree/DataBase.cpp @@ -32,16 +32,12 @@ CDataBase *gDataBase = NULL; CDataBase::CDataBase(const char* FileName) { int len; -#ifdef UNICODE + len = MultiByteToWideChar(CP_ACP, 0, FileName, -1, NULL, 0); m_FileName[0] = new TCHAR[len + 1]; MultiByteToWideChar(CP_ACP, 0, FileName, -1, m_FileName[0], len + 1); m_FileName[0][len] = 0; -#else - len = strlen(FileName); - m_FileName[0] = new TCHAR[len + 1]; - strcpy_s(m_FileName[0], len + 1, FileName); -#endif + TCHAR * tmp = _tcsrchr(m_FileName[0], '.'); if (tmp) diff --git a/plugins/Dbx_tree/Logger.h b/plugins/Dbx_tree/Logger.h index 5c88cc7ebf..a97b928555 100644 --- a/plugins/Dbx_tree/Logger.h +++ b/plugins/Dbx_tree/Logger.h @@ -31,13 +31,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define __WFILE__ WIDEN(__FILE__) #define __WFUNCTION__ WIDEN(__FUNCTION__) -#ifdef UNICODE - #define LOG(Level, Message, ...) CLogger::Instance().Append(__WFILE__, __WFUNCTION__, __LINE__, 0, CLogger:: ## Level, Message, __VA_ARGS__) - #define LOGSYS(Level, Message, ...) CLogger::Instance().Append(__WFILE__, __WFUNCTION__, __LINE__, GetLastError(), CLogger:: ## Level, Message, __VA_ARGS__) -#else - #define LOG(Level, Message, ...) CLogger::Instance().Append(__FILE__, __FUNCTION__, __LINE__, 0, CLogger:: ## Level, Message, __VA_ARGS__) - #define LOGSYS(Level, Message, ...) CLogger::Instance().Append(__FILE__, __FUNCTION__, __LINE__, GetLastError(), CLogger:: ## Level, Message, __VA_ARGS__) -#endif + +#define LOG(Level, Message, ...) CLogger::Instance().Append(__WFILE__, __WFUNCTION__, __LINE__, 0, CLogger:: ## Level, Message, __VA_ARGS__) +#define LOGSYS(Level, Message, ...) CLogger::Instance().Append(__WFILE__, __WFUNCTION__, __LINE__, GetLastError(), CLogger:: ## Level, Message, __VA_ARGS__) + #define CHECK(Assertion, Level, Message, ...) if (!(Assertion)) LOG(Level, Message, __VA_ARGS__) #define CHECKSYS(Assertion, Level, Message, ...) if (!(Assertion)) LOGSYS(Level, Message, __VA_ARGS__) diff --git a/plugins/FavContacts/src/contact_cache.cpp b/plugins/FavContacts/src/contact_cache.cpp index c61635cc26..9464c22a77 100644 --- a/plugins/FavContacts/src/contact_cache.cpp +++ b/plugins/FavContacts/src/contact_cache.cpp @@ -135,9 +135,8 @@ static bool AppendInfo(TCHAR *buf, int size, HANDLE hContact, int info) ci.cbSize = sizeof(ci); ci.hContact = hContact; ci.dwFlag = info; -#if defined(UNICODE) || defined(_UNICODE) ci.dwFlag |= CNF_UNICODE; -#endif + bool ret = false; diff --git a/plugins/FavContacts/src/headers.h b/plugins/FavContacts/src/headers.h index 677decedcb..59d3693926 100644 --- a/plugins/FavContacts/src/headers.h +++ b/plugins/FavContacts/src/headers.h @@ -20,10 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define _CRT_SECURE_NO_DEPRECATE -#if defined(UNICODE) && !defined(_UNICODE) - #define _UNICODE -#endif - #include #define _WIN32_WINNT 0x0501 #include diff --git a/plugins/FavContacts/src/http_api.cpp b/plugins/FavContacts/src/http_api.cpp index ac9171f9c5..9b2ac3f3c3 100644 --- a/plugins/FavContacts/src/http_api.cpp +++ b/plugins/FavContacts/src/http_api.cpp @@ -97,14 +97,14 @@ public: m_socket->Send(s); } -#ifdef UNICODE + void Send(WCHAR *ws) { char *s = mir_utf8encodeW(ws); m_socket->Send(s); mir_free(s); } -#endif + void Send(int i) { diff --git a/plugins/FingerPrintModPlus/src/fingerprint.cpp b/plugins/FingerPrintModPlus/src/fingerprint.cpp index 79e9309cd1..429e9defb6 100644 --- a/plugins/FingerPrintModPlus/src/fingerprint.cpp +++ b/plugins/FingerPrintModPlus/src/fingerprint.cpp @@ -49,10 +49,9 @@ int OnPreShutdown(WPARAM wParam, LPARAM lParam); INT_PTR ServiceSameClientsA(WPARAM wParam, LPARAM lParam); INT_PTR ServiceGetClientIconA(WPARAM wParam, LPARAM lParam); -#ifdef UNICODE INT_PTR ServiceSameClientsW(WPARAM wParam, LPARAM lParam); INT_PTR ServiceGetClientIconW(WPARAM wParam, LPARAM lParam); -#endif // !UNICODE + HICON FASTCALL CreateJoinedIcon(HICON hBottom, HICON hTop); HBITMAP __inline CreateBitmap32(int cx, int cy); @@ -65,13 +64,8 @@ BOOL FASTCALL WildCompareW(LPWSTR name, LPWSTR mask); BOOL __inline WildCompareProcA(LPSTR name, LPSTR mask); BOOL __inline WildCompareProcW(LPWSTR name, LPWSTR mask); -#ifdef UNICODE - #define WildCompare WildCompareW - #define GetIconsIndexes GetIconsIndexesW -#else - #define WildCompare WildCompareA - #define GetIconsIndexes GetIconsIndexesA -#endif // !UNICODE +#define WildCompare WildCompareW +#define GetIconsIndexes GetIconsIndexesW HINSTANCE g_hInst; PLUGINLINK* pluginLink; @@ -92,11 +86,11 @@ HANDLE hExtraIconClick = NULL; // hook event handle for ME_CLIST_EXTRA_CLICK HANDLE compClientServA = NULL; HANDLE getClientIconA = NULL; -#ifdef UNICODE + HANDLE compClientServW = NULL; HANDLE getClientIconW = NULL; LPSTR g_szClientDescription = NULL; -#endif // !UNICODE + HANDLE hStaticHooks[1] = { NULL }; HANDLE hExtraIcon = NULL; HANDLE hFolderChanged = NULL, hIconFolder = NULL; @@ -170,10 +164,10 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK* link) hPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); compClientServA = CreateServiceFunction(MS_FP_SAMECLIENTS, ServiceSameClientsA); getClientIconA = CreateServiceFunction(MS_FP_GETCLIENTICON, ServiceGetClientIconA); -#ifdef UNICODE + compClientServW = CreateServiceFunction(MS_FP_SAMECLIENTSW, ServiceSameClientsW); getClientIconW = CreateServiceFunction(MS_FP_GETCLIENTICONW, ServiceGetClientIconW); -#endif // !UNICODE + hHeap = HeapCreate(HEAP_NO_SERIALIZE, 0, 0); gbUnicodeAPI = IsWinVerNT(); return 0; @@ -182,9 +176,9 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK* link) extern "C" int __declspec(dllexport) Unload() { size_t i; -#ifdef UNICODE + if(g_szClientDescription != NULL) mir_free(g_szClientDescription); -#endif // !UNICODE + HeapDestroy(hHeap); ClearFI(); @@ -403,10 +397,9 @@ int OnPreShutdown(WPARAM wParam, LPARAM lParam) UnhookEvent(hFolderChanged); DestroyServiceFunction(compClientServA); DestroyServiceFunction(getClientIconA); -#ifdef UNICODE DestroyServiceFunction(compClientServW); DestroyServiceFunction(getClientIconW); -#endif // !UNICODE + return 0; } @@ -534,7 +527,7 @@ int OnContactSettingChanged(WPARAM wParam, LPARAM lParam) { if(cws->value.type == DBVT_UTF8) { -#ifdef UNICODE + LPWSTR wszVal = NULL; int iValLen; @@ -546,31 +539,11 @@ int OnContactSettingChanged(WPARAM wParam, LPARAM lParam) } ApplyFingerprintImage((HANDLE)wParam, wszVal); mir_free(wszVal); -#else - LPSTR szVal = NULL; - int iValLenW; - int iValLenA; - iValLenW = MultiByteToWideChar(CP_UTF8, 0, cws->value.pszVal, -1, NULL, 0); - if(iValLenW > 0) - { - LPWSTR wszVal = (LPWSTR)mir_alloc(iValLenW * sizeof(WCHAR)); - MultiByteToWideChar(CP_UTF8, 0, cws->value.pszVal, -1, wszVal, iValLenW); - mir_free(wszVal); - iValLenA = WideCharToMultiByte(g_LPCodePage, 0, wszVal, -1, NULL, 0, NULL, NULL); - if(iValLenA > 0) - { - szVal = (LPSTR)mir_alloc(iValLenA * sizeof(CHAR)); - WideCharToMultiByte(g_LPCodePage, 0, wszVal, -1, szVal, iValLenA, NULL, NULL); - } - } - ApplyFingerprintImage((HANDLE)wParam, szVal); - mir_free(szVal); -#endif // !UNICODE } else if(cws->value.type == DBVT_ASCIIZ) { -#ifdef UNICODE + LPWSTR wszVal = NULL; int iValLen; @@ -582,27 +555,13 @@ int OnContactSettingChanged(WPARAM wParam, LPARAM lParam) } ApplyFingerprintImage((HANDLE)wParam, wszVal); mir_free(wszVal); -#else - ApplyFingerprintImage((HANDLE)wParam, cws->value.pszVal); -#endif // !UNICODE + } else if(cws->value.type == DBVT_WCHAR) { -#ifdef UNICODE + ApplyFingerprintImage((HANDLE)wParam, cws->value.pwszVal); -#else - LPSTR szVal = NULL; - int iValLen; - iValLen = WideCharToMultiByte(g_LPCodePage, 0, cws->value.pwszVal, -1, NULL, 0, NULL, NULL); - if(iValLen > 0) - { - szVal = (LPSTR)mir_alloc(iValLen * sizeof(CHAR)); - WideCharToMultiByte(g_LPCodePage, 0, cws->value.pwszVal, -1, szVal, iValLen, NULL, NULL); - } - ApplyFingerprintImage((HANDLE)wParam, szVal); - mir_free(szVal); -#endif // !UNICODE } else ApplyFingerprintImage((HANDLE)wParam, NULL); @@ -1063,17 +1022,13 @@ void FASTCALL GetIconsIndexesA(LPSTR szMirVer, short *base, short *overlay,short return; } -#ifdef UNICODE + iMirVerUpLen = MultiByteToWideChar(g_LPCodePage, 0, szMirVer, -1, NULL, 0); -#else - iMirVerUpLen = strlen(szMirVer) + 1; -#endif // !UNICODE + tszMirVerUp = (LPTSTR)mir_alloc(iMirVerUpLen * sizeof(TCHAR)); -#ifdef UNICODE + MultiByteToWideChar(g_LPCodePage, 0, szMirVer, -1, tszMirVerUp, iMirVerUpLen); -#else - _tcscpy_s(tszMirVerUp, iMirVerUpLen, szMirVer); -#endif // !UNICODE + _tcsupr_s(tszMirVerUp, iMirVerUpLen); while(i < DEFAULT_KN_FP_MASK_COUNT) @@ -1140,7 +1095,7 @@ void FASTCALL GetIconsIndexesA(LPSTR szMirVer, short *base, short *overlay,short /* GetIconsIndexesW * Retrieves Icons indexes by Mirver */ -#ifdef UNICODE + void FASTCALL GetIconsIndexesW(LPWSTR wszMirVer, short *base, short *overlay,short *overlay2,short *overlay3) { LPWSTR wszMirVerUp; @@ -1222,7 +1177,7 @@ void FASTCALL GetIconsIndexesW(LPWSTR wszMirVer, short *base, short *overlay,sho mir_free(wszMirVerUp); } -#endif // !UNICODE + /* * CreateIconFromIndexes @@ -1347,22 +1302,16 @@ INT_PTR ServiceSameClientsA(WPARAM wParam, LPARAM lParam) { LPTSTR tszMirVerFirstUp, tszMirVerSecondUp; int iMirVerFirstUpLen, iMirVerSecondUpLen; -#ifdef UNICODE + iMirVerFirstUpLen = MultiByteToWideChar(g_LPCodePage, 0, szMirVerFirst, -1, NULL, 0); iMirVerSecondUpLen = MultiByteToWideChar(g_LPCodePage, 0, szMirVerSecond, -1, NULL, 0); -#else - iMirVerFirstUpLen = strlen(szMirVerFirst) + 1; - iMirVerSecondUpLen = strlen(szMirVerSecond) + 1; -#endif // !UNICODE + tszMirVerFirstUp = (LPTSTR)mir_alloc(iMirVerFirstUpLen * sizeof(TCHAR)); tszMirVerSecondUp = (LPTSTR)mir_alloc(iMirVerSecondUpLen * sizeof(TCHAR)); -#ifdef UNICODE + MultiByteToWideChar(g_LPCodePage, 0, szMirVerFirst, -1, tszMirVerFirstUp, iMirVerFirstUpLen); MultiByteToWideChar(g_LPCodePage, 0, szMirVerSecond, -1, tszMirVerSecondUp, iMirVerSecondUpLen); -#else - strcpy_s(tszMirVerFirstUp, iMirVerFirstUpLen, szMirVerFirst); - strcpy_s(tszMirVerSecondUp, iMirVerSecondUpLen, szMirVerSecond); -#endif // !UNICODE + _tcsupr_s(tszMirVerFirstUp, iMirVerFirstUpLen); _tcsupr_s(tszMirVerSecondUp, iMirVerSecondUpLen); @@ -1390,7 +1339,7 @@ INT_PTR ServiceSameClientsA(WPARAM wParam, LPARAM lParam) if(firstIndex == secondIndex && firstIndex < DEFAULT_KN_FP_MASK_COUNT) { -#ifdef UNICODE + int iClientDescriptionLen = WideCharToMultiByte(g_LPCodePage, 0, def_kn_fp_mask[firstIndex].szClientDescription, -1, NULL, 0, NULL, NULL); if(iClientDescriptionLen > 0) g_szClientDescription = (LPSTR)mir_realloc(g_szClientDescription, iClientDescriptionLen * sizeof(CHAR)); @@ -1398,9 +1347,7 @@ INT_PTR ServiceSameClientsA(WPARAM wParam, LPARAM lParam) return (INT_PTR)NULL; WideCharToMultiByte(g_LPCodePage, 0, def_kn_fp_mask[firstIndex].szClientDescription, -1, g_szClientDescription, iClientDescriptionLen, NULL, NULL); return (INT_PTR)g_szClientDescription; -#else - return (INT_PTR)def_kn_fp_mask[firstIndex].szClientDescription; -#endif // !UNICODE + } } return (INT_PTR)NULL; @@ -1413,7 +1360,7 @@ INT_PTR ServiceSameClientsA(WPARAM wParam, LPARAM lParam) * lParam - int noCopy - if wParam is equal to "1" will return icon handler without copiing icon. * ICON IS ALWAYS COPIED!!! */ -#ifdef UNICODE + INT_PTR ServiceGetClientIconW(WPARAM wParam, LPARAM lParam) { LPWSTR wszMirVer = (LPWSTR)wParam; // MirVer value to get client for. @@ -1509,7 +1456,6 @@ INT_PTR ServiceSameClientsW(WPARAM wParam, LPARAM lParam) } return (INT_PTR)NULL; } -#endif // !UNICODE /****************************************************************************** * Futher routines is for creating joined 'overlay' icons. diff --git a/plugins/FingerPrintModPlus/src/utilities.h b/plugins/FingerPrintModPlus/src/utilities.h index 945fbab7d9..bc748d9d51 100644 --- a/plugins/FingerPrintModPlus/src/utilities.h +++ b/plugins/FingerPrintModPlus/src/utilities.h @@ -27,20 +27,7 @@ LRESULT ComboBoxAddStringW(HWND hCombo, LPCWSTR szString, DWORD data); LRESULT ListBoxAddStringUtf(HWND hList, const char* szString); LRESULT ListBoxAddStringW(HWND hList, LPCWSTR szString); -#ifdef UNICODE #define ControlAddString ControlAddStringW -#else -#define ControlAddString ControlAddStringUtf -#endif // !UNICODE - -#ifdef UNICODE #define ComboBoxAddString ComboBoxAddStringW -#else -#define ComboBoxAddString ComboBoxAddStringUtf -#endif // !UNICODE - -#ifdef UNICODE #define ListBoxAddString ListBoxAddStringW -#else -#define ListBoxAddString ListBoxAddStringUtf -#endif // !UNICODE + diff --git a/plugins/HistoryLinkListPlus/linklist_fct.c b/plugins/HistoryLinkListPlus/linklist_fct.c index ed0816ba1f..da7771e8c0 100644 --- a/plugins/HistoryLinkListPlus/linklist_fct.c +++ b/plugins/HistoryLinkListPlus/linklist_fct.c @@ -90,9 +90,9 @@ int ExtractURI(DBEVENTINFO *dbei, HANDLE hEvent, LISTELEMENT *listStart) { break; } -#ifndef _UNICODE + if(IsDBCSLeadByte(msg[i]) && msg[i+1]) i++; -#endif + i++; if ( msg[i] != _T('\n') ) charCount++; } @@ -103,10 +103,10 @@ int ExtractURI(DBEVENTINFO *dbei, HANDLE hEvent, LISTELEMENT *listStart) while ( msg[i] && !_istspace(msg[i]) ) { -#ifndef _UNICODE + if ( IsDBCSLeadByte(msg[i] ) && msg[i+1]) i++; else -#endif + if ( _istalnum(msg[i]) || msg[i]==_T('/') ) { cpLastAlphaNum = charCount; diff --git a/plugins/IEView/TemplateHTMLBuilder.cpp b/plugins/IEView/TemplateHTMLBuilder.cpp index f5c49bc6b4..7c8ce86562 100644 --- a/plugins/IEView/TemplateHTMLBuilder.cpp +++ b/plugins/IEView/TemplateHTMLBuilder.cpp @@ -63,9 +63,8 @@ char *TemplateHTMLBuilder::getAvatar(HANDLE hContact, const char * szProto) { result = ace->szFilename; else { // compatibility: in M0.9 it will always be char* - #if defined( _UNICODE ) - MultiByteToWideChar( CP_ACP, 0, (char*)ace->szFilename, -1, tmpPath, SIZEOF(tmpPath)); - #endif + MultiByteToWideChar( CP_ACP, 0, (char*)ace->szFilename, -1, tmpPath, SIZEOF(tmpPath)); + } } } diff --git a/plugins/IEView/ieview_common.h b/plugins/IEView/ieview_common.h index 4be574b7d7..a403121279 100644 --- a/plugins/IEView/ieview_common.h +++ b/plugins/IEView/ieview_common.h @@ -18,9 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#if defined( UNICODE ) && !defined( _UNICODE ) - #define _UNICODE -#endif + #ifdef __MINGW32__ #define WINVER 0x500 #define _WIN32_IE 0x500 diff --git a/plugins/MenuItemEx/main.c b/plugins/MenuItemEx/main.c index 537d277262..8c65f0a8bc 100644 --- a/plugins/MenuItemEx/main.c +++ b/plugins/MenuItemEx/main.c @@ -314,11 +314,9 @@ void CopyToClipboard(HWND hwnd,LPSTR pszMsg, LPTSTR ptszMsg) OpenClipboard(NULL); EmptyClipboard(); -#ifdef _UNICODE + SetClipboardData(CF_UNICODETEXT, hglbCopy); -#else - SetClipboardData(CF_TEXT, hglbCopy); -#endif + CloseClipboard(); } @@ -500,7 +498,7 @@ INT_PTR CALLBACK AuthReqWndProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) case IDOK: { char szReason[256] = {0}; -#ifdef _UNICODE + WCHAR wszReason[256] = {0}; if (CallService(MS_SYSTEM_GETVERSION, 0, 0) < 0x00090007) @@ -513,10 +511,7 @@ INT_PTR CALLBACK AuthReqWndProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) GetDlgItemText(hdlg,IDC_REASON,wszReason,255); CallContactService(hcontact,PSS_AUTHREQUESTW,0,(LPARAM)wszReason); } -#else - GetDlgItemTextA(hdlg,IDC_REASON,szReason,255); - CallContactService(hcontact,PSS_AUTHREQUEST,0,(LPARAM)szReason); -#endif + } // fall through case IDCANCEL: DestroyWindow(hdlg); diff --git a/plugins/MenuItemEx/version.h b/plugins/MenuItemEx/version.h index 07b9cf78ef..59d1c2358c 100644 --- a/plugins/MenuItemEx/version.h +++ b/plugins/MenuItemEx/version.h @@ -10,10 +10,6 @@ #define __PLUGIN_NAME "MenuItemEx (Unicode) plugin for Miranda IM" #define __PLUGIN_ID 4036 #define __PLUGIN_ID_STR "4036" -#else -#define __PLUGIN_NAME "MenuItemEx plugin for Miranda IM" -#define __PLUGIN_ID 4303 -#define __PLUGIN_ID_STR "4303" #endif #define __WEB "http://addons.miranda-im.org/details.php?action=viewfile&id=" diff --git a/plugins/NewXstatusNotify/main.cpp b/plugins/NewXstatusNotify/main.cpp index ab6677e0cb..36fe374c5e 100644 --- a/plugins/NewXstatusNotify/main.cpp +++ b/plugins/NewXstatusNotify/main.cpp @@ -298,7 +298,6 @@ static int __inline CheckStr(char *str, int not_empty, int empty) { return not_empty; } -#ifdef UNICODE static int __inline CheckStrW(WCHAR *str, int not_empty, int empty) { if (str == NULL || str[0] == L'\0') @@ -307,7 +306,6 @@ static int __inline CheckStrW(WCHAR *str, int not_empty, int empty) { return not_empty; } -#endif WCHAR *mir_dupToUnicodeEx(char *ptr, UINT CodePage) { @@ -334,7 +332,7 @@ static int CompareStatusMsg(STATUSMSGINFO *smi, DBCONTACTWRITESETTING *cws_new) smi->newstatusmsg = NULL; break; case DBVT_ASCIIZ: -#ifdef UNICODE + smi->newstatusmsg = (CheckStr(cws_new->value.pszVal, 0, 1) ? NULL : mir_dupToUnicodeEx(cws_new->value.pszVal, CP_ACP)); break; case DBVT_UTF8: @@ -342,9 +340,7 @@ static int CompareStatusMsg(STATUSMSGINFO *smi, DBCONTACTWRITESETTING *cws_new) break; case DBVT_WCHAR: smi->newstatusmsg = (CheckStrW(cws_new->value.pwszVal, 0, 1) ? NULL : mir_wstrdup(cws_new->value.pwszVal)); -#else - smi->newstatusmsg = (CheckStr(cws_new->value.pszVal, 0, 1) ? NULL : mir_strdup(cws_new->value.pszVal)); -#endif + break; default: smi->newstatusmsg = NULL; @@ -352,17 +348,15 @@ static int CompareStatusMsg(STATUSMSGINFO *smi, DBCONTACTWRITESETTING *cws_new) } if (! -#ifdef UNICODE + DBGetContactSettingW(smi->hContact, "UserOnline", "OldStatusMsg", &dbv_old) -#else - DBGetContactSetting(smi->hContact, "UserOnline", "OldStatusMsg", &dbv_old) -#endif + ) { switch (dbv_old.type) { case DBVT_ASCIIZ: -#ifdef UNICODE + smi->oldstatusmsg = (CheckStr(dbv_old.pszVal, 0, 1) ? NULL : mir_dupToUnicodeEx(dbv_old.pszVal, CP_ACP)); break; case DBVT_UTF8: @@ -370,9 +364,7 @@ static int CompareStatusMsg(STATUSMSGINFO *smi, DBCONTACTWRITESETTING *cws_new) break; case DBVT_WCHAR: smi->oldstatusmsg = (CheckStrW(dbv_old.pwszVal, 0, 1) ? NULL : mir_wstrdup(dbv_old.pwszVal)); -#else - smi->oldstatusmsg = (CheckStr(dbv_old.pszVal, 0, 1) ? NULL : mir_strdup(dbv_old.pszVal)); -#endif + break; default: smi->oldstatusmsg = NULL; @@ -381,29 +373,27 @@ static int CompareStatusMsg(STATUSMSGINFO *smi, DBCONTACTWRITESETTING *cws_new) if (cws_new->value.type == DBVT_DELETED) if ( -#ifdef UNICODE + dbv_old.type == DBVT_WCHAR) ret = CheckStrW(dbv_old.pwszVal, 2, 0); else if (dbv_old.type == DBVT_UTF8 || -#endif + dbv_old.type == DBVT_ASCIIZ) ret = CheckStr(dbv_old.pszVal, 2, 0); else ret = 2; else if (dbv_old.type != cws_new->value.type) -#ifdef UNICODE + ret = (lstrcmpW(smi->newstatusmsg, smi->oldstatusmsg) ? CheckStrW(smi->newstatusmsg, 1, 2) : 0); -#else - ret = 1; -#endif; + else if (dbv_old.type == DBVT_ASCIIZ) ret = (lstrcmpA(cws_new->value.pszVal, dbv_old.pszVal) ? CheckStr(cws_new->value.pszVal, 1, 2) : 0); -#ifdef UNICODE + else if (dbv_old.type == DBVT_UTF8) ret = (lstrcmpA(cws_new->value.pszVal, dbv_old.pszVal) ? CheckStr(cws_new->value.pszVal, 1, 2) : 0); else if (dbv_old.type == DBVT_WCHAR) ret = (lstrcmpW(cws_new->value.pwszVal, dbv_old.pwszVal) ? CheckStrW(cws_new->value.pwszVal, 1, 2) : 0); -#endif + DBFreeVariant(&dbv_old); } else @@ -411,11 +401,11 @@ static int CompareStatusMsg(STATUSMSGINFO *smi, DBCONTACTWRITESETTING *cws_new) if (cws_new->value.type == DBVT_DELETED) ret = 0; else if ( -#ifdef UNICODE + cws_new->value.type == DBVT_WCHAR) ret = CheckStrW(cws_new->value.pwszVal, 1, 0); else if (cws_new->value.type == DBVT_UTF8 || -#endif + cws_new->value.type == DBVT_ASCIIZ) ret = CheckStr(cws_new->value.pszVal, 1, 0); else @@ -1219,11 +1209,7 @@ void InitUpdaterSupport() update.szComponentName = pluginInfoEx.shortName; update.pbVersion = (BYTE *)CreateVersionString(pluginInfoEx.version, szVersion); update.cpbVersion = strlen((char *)update.pbVersion); -#ifdef _UNICODE update.szUpdateURL = "http://miranda-easy.net/addons/updater/nxsn-ym.zip"; -#else - update.szUpdateURL = "http://miranda-easy.net/addons/updater/nxsn-ym_ansi.zip"; -#endif update.szVersionURL = "http://miranda-easy.net/addons/updater/nxsn_version.txt"; update.pbVersionPrefix = (BYTE *)"NewXstatusNotify YM "; update.cpbVersionPrefix = strlen((char *)update.pbVersionPrefix); diff --git a/plugins/NewXstatusNotify/xstatus.cpp b/plugins/NewXstatusNotify/xstatus.cpp index d6f4997e13..c427a8d427 100644 --- a/plugins/NewXstatusNotify/xstatus.cpp +++ b/plugins/NewXstatusNotify/xstatus.cpp @@ -289,11 +289,9 @@ void LogToMessageWindow(XSTATUSCHANGE *xsc, BOOL opening) DBWriteContactSettingTString(xsc->hContact, MODULE, DB_LASTLOG, stzLogText); char *blob; -#ifdef _UNICODE + blob = mir_utf8encodeT(stzLogText); -#else - blob = mir_strdup(stzLogText); -#endif + DBEVENTINFO dbei = {0}; dbei.cbSize = sizeof(dbei); @@ -301,9 +299,9 @@ void LogToMessageWindow(XSTATUSCHANGE *xsc, BOOL opening) dbei.pBlob = (PBYTE) blob; dbei.eventType = EVENTTYPE_STATUSCHANGE; dbei.flags = DBEF_READ; -#ifdef _UNICODE + dbei.flags |= DBEF_UTF; -#endif + dbei.timestamp = (DWORD)time(NULL); dbei.szModule = xsc->szProto; HANDLE hDBEvent = (HANDLE)CallService(MS_DB_EVENT_ADD, (WPARAM)xsc->hContact, (LPARAM)&dbei); diff --git a/plugins/Nudge/main.cpp b/plugins/Nudge/main.cpp index 5500451eff..ca8e18857e 100644 --- a/plugins/Nudge/main.cpp +++ b/plugins/Nudge/main.cpp @@ -14,9 +14,9 @@ CShake shake; CNudge GlobalNudge; MM_INTERFACE mmi; -#ifdef UNICODE + UTF8_INTERFACE utfi; -#endif + int hLangpack = 0; @@ -512,13 +512,13 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) MessageBox(NULL,_T("Cannot retrieve Miranda Memory Manager Interface.\nYou need to update Miranda IM to the latest version."),_T("Nudge Plugin"),MB_OK); return 1; } -#ifdef UNICODE + if(mir_getUTFI(&utfi)) { MessageBox(NULL,_T("Cannot retrieve Miranda UTF8 Interface.\nYou need to update Miranda IM to the latest version."),_T("Nudge Plugin"),MB_OK); return 1; } -#endif + mir_getLP(&pluginInfo); g_hEventModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED,ModulesLoaded); @@ -696,13 +696,10 @@ void Nudge_SentStatus(CNudgeElement n, HANDLE hContact) NudgeEvent.cbSize = sizeof(NudgeEvent); NudgeEvent.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); -#ifdef _UNICODE + char *buff = mir_utf8encodeT(n.senText); NudgeEvent.flags = DBEF_SENT | DBEF_UTF; -#else - char *buff = mir_strdup(n.senText); - NudgeEvent.flags = DBEF_SENT; -#endif + NudgeEvent.timestamp = ( DWORD )time(NULL); NudgeEvent.eventType = EVENTTYPE_STATUSCHANGE; NudgeEvent.cbBlob = (DWORD)strlen(buff) + 1; @@ -726,13 +723,10 @@ void Nudge_ShowStatus(CNudgeElement n, HANDLE hContact, DWORD timestamp) NudgeEvent.cbSize = sizeof(NudgeEvent); NudgeEvent.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); -#ifdef _UNICODE + char *buff = mir_utf8encodeT(n.recText); NudgeEvent.flags = DBEF_UTF; -#else - char *buff = mir_strdup(n.recText); - NudgeEvent.flags = 0; -#endif + NudgeEvent.timestamp = timestamp; NudgeEvent.eventType = EVENTTYPE_STATUSCHANGE; NudgeEvent.cbBlob = (DWORD)strlen(buff) + 1; diff --git a/plugins/PackUpdater/Src/Common.h b/plugins/PackUpdater/Src/Common.h index fa180a6e78..3e38692d49 100644 --- a/plugins/PackUpdater/Src/Common.h +++ b/plugins/PackUpdater/Src/Common.h @@ -52,15 +52,9 @@ Boston, MA 02111-1307, USA. #define MODNAME "PackUpdater" #define MODULEA "Pack Updater" #define MODULEW L"Pack Updater" -#ifdef _UNICODE - #define DEFAULT_UPDATES_FOLDER L"Pack Updates" - typedef std::wstring tString; - #define MODULE MODULEW -#else - #define DEFAULT_UPDATES_FOLDER "Pack Updates" - typedef std::string tString; - #define MODULE MODULEA -#endif +#define DEFAULT_UPDATES_FOLDER L"Pack Updates" +typedef std::wstring tString; +#define MODULE MODULEW struct FILEURL { diff --git a/plugins/Popup/src/actions.cpp b/plugins/Popup/src/actions.cpp index 32ad120bcd..9aa0506d21 100644 --- a/plugins/Popup/src/actions.cpp +++ b/plugins/Popup/src/actions.cpp @@ -155,13 +155,10 @@ DWORD MouseOverride(HWND hCombo, int number) } // options -#if defined(_UNICODE) + #define ListView_InsertItemW(hwnd, pitem) \ (int)SendMessageW((hwnd), LVM_INSERTITEMW, 0, (LPARAM)(const LVITEMW *)(pitem)) -#else -#define ListView_InsertItemW(hwnd, pitem) \ - (int)MySendMessageW((hwnd), LVM_INSERTITEMW, 0, (LPARAM)(const LVITEMW *)(pitem)) -#endif + void LoadOption_Actions() { PopUpOptions.actions = DBGetContactSettingDword(NULL, MODULNAME, "Actions", diff --git a/plugins/Popup/src/avatars_gif.cpp b/plugins/Popup/src/avatars_gif.cpp index 24ee798e93..8ef662b882 100644 --- a/plugins/Popup/src/avatars_gif.cpp +++ b/plugins/Popup/src/avatars_gif.cpp @@ -97,7 +97,7 @@ void GifAvatar::draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS *op SelectObject(hdcTmp, hBitmap); SetStretchBltMode(bmp->getDC(), HALFTONE); -#if defined(_UNICODE) + if (av->dwFlags & AVS_PREMULTIPLIED) { BLENDFUNCTION bf; @@ -106,16 +106,7 @@ void GifAvatar::draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS *op bf.SourceConstantAlpha = 255; bf.AlphaFormat = AC_SRC_ALPHA; AlphaBlend(bmp->getDC(), x, y, w, h, hdcTmp, frameSize.cx*activeFrame, 0, frameSize.cx, frameSize.cy, bf); -#else - if (MyAlphaBlend && (av->dwFlags & AVS_PREMULTIPLIED)) - { - BLENDFUNCTION bf; - bf.BlendOp = AC_SRC_OVER; - bf.BlendFlags = 0; - bf.SourceConstantAlpha = 255; - bf.AlphaFormat = AC_SRC_ALPHA; - MyAlphaBlend(bmp->getDC(), x, y, w, h, hdcTmp, frameSize.cx*activeFrame, 0, frameSize.cx, frameSize.cy, bf); -#endif + if (options->avatarBorders && options->avatarPNGBorders) { HBRUSH hbr = CreateSolidBrush(fonts.clAvatarBorder); diff --git a/plugins/Popup/src/avatars_simple.cpp b/plugins/Popup/src/avatars_simple.cpp index 2c3b3341cb..b152afdc47 100644 --- a/plugins/Popup/src/avatars_simple.cpp +++ b/plugins/Popup/src/avatars_simple.cpp @@ -104,7 +104,7 @@ void SimpleAvatar::draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS SelectObject(hdcTmp, av->hbmPic); SetStretchBltMode(bmp->getDC(), HALFTONE); -#if defined(_UNICODE) + if (av->dwFlags & AVS_HASTRANSPARENCY) { BLENDFUNCTION bf; @@ -113,17 +113,7 @@ void SimpleAvatar::draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS bf.SourceConstantAlpha = 255; bf.AlphaFormat = AC_SRC_ALPHA; AlphaBlend(bmp->getDC(), x, y, w, h, hdcTmp, 0, 0, av->bmWidth, av->bmHeight, bf); -#else -// if (MyAlphaBlend && (av->dwFlags & AVS_PREMULTIPLIED)) - if (MyAlphaBlend && (av->dwFlags & AVS_HASTRANSPARENCY)) - { - BLENDFUNCTION bf; - bf.BlendOp = AC_SRC_OVER; - bf.BlendFlags = 0; - bf.SourceConstantAlpha = 255; - bf.AlphaFormat = AC_SRC_ALPHA; - MyAlphaBlend(bmp->getDC(), x, y, w, h, hdcTmp, 0, 0, av->bmWidth, av->bmHeight, bf); -#endif + if (options->avatarBorders && options->avatarPNGBorders) { HBRUSH hbr = CreateSolidBrush(fonts.clAvatarBorder); diff --git a/plugins/Popup/src/bitmap_funcs.cpp b/plugins/Popup/src/bitmap_funcs.cpp index 4cb013a378..22f60786fb 100644 --- a/plugins/Popup/src/bitmap_funcs.cpp +++ b/plugins/Popup/src/bitmap_funcs.cpp @@ -687,22 +687,12 @@ void MyBitmap::Draw_TextA(char *str, int x, int y) void MyBitmap::Draw_TextW(WCHAR *str, int x, int y) { -#if defined(_UNICODE) + SIZE sz; GetTextExtentPoint32W(this->getDC(), str, lstrlenW(str), &sz); RECT rc; SetRect(&rc, x, y, x+10000, y+10000); this->saveAlpha(x,y,sz.cx,sz.cy); DrawTextW(this->getDC(), str, lstrlenW(str), &rc, DT_LEFT | DT_TOP | DT_SINGLELINE | DT_NOPREFIX); this->restoreAlpha(x,y,sz.cx,sz.cy); -#else - if (MyGetTextExtentPoint32W && MyDrawTextW) - { - SIZE sz; MyGetTextExtentPoint32W(this->getDC(), str, lstrlenW(str), &sz); - RECT rc; SetRect(&rc, x, y, x+10000, y+10000); - this->saveAlpha(x,y,sz.cx,sz.cy); - MyDrawTextW(this->getDC(), str, lstrlenW(str), &rc, DT_LEFT | DT_TOP | DT_SINGLELINE | DT_NOPREFIX); - this->restoreAlpha(x,y,sz.cx,sz.cy); - } -#endif } // based on code by Yuriy Zaporozhets from: diff --git a/plugins/Popup/src/common.h b/plugins/Popup/src/common.h index 3b5ecae721..5319bc236d 100644 --- a/plugins/Popup/src/common.h +++ b/plugins/Popup/src/common.h @@ -143,7 +143,7 @@ inline INT_PTR DBGetContactSettingStringX(HANDLE hContact, const char *ModuleNam } /* not used -#if !defined(_UNICODE) + inline void SetWindowTextTraslated(HWND hwnd, const char *text) { if (!(hwnd && text)) return; @@ -160,7 +160,7 @@ inline void SetWindowTextTraslated(HWND hwnd, const char *text) SetWindowTextA(hwnd, Translate(text)); } } -#endif + */ /*/dedrecatet (tricky thing to minimize memory fragmentation) inline wchar_t* a2u( char* src ) @@ -204,7 +204,7 @@ inline wchar_t* a2u( char* src ) inline void AddTooltipTranslated(HWND hwndToolTip, HWND hwnd, int id, RECT rc, char *text) { -#if defined(_UNICODE) + TOOLINFO ti = {0}; ti.cbSize = sizeof(TOOLINFO); @@ -224,45 +224,6 @@ inline void AddTooltipTranslated(HWND hwndToolTip, HWND hwnd, int id, RECT rc, c mir_free(wtext); -#else - if (g_popup.isOsUnicode && MySendMessageW) - { - TOOLINFOW ti = {0}; - ti.cbSize = sizeof(TOOLINFO); - - ti.hwnd = hwnd; - ti.uId = id; - MySendMessageW(hwndToolTip, TTM_DELTOOLW, 0, (LPARAM) (LPTOOLINFOW) &ti); - - LPWSTR wtext = mir_a2u(text); - - ti.uFlags = TTF_SUBCLASS; - ti.hwnd = hwnd; - ti.uId = id; - ti.hinst = hInst; - ti.lpszText = TranslateW(wtext); - ti.rect = rc; - MySendMessageW(hwndToolTip, TTM_ADDTOOLW, 0, (LPARAM) (LPTOOLINFOW) &ti); - - mir_free(wtext); - } else - { - TOOLINFOA ti = {0}; - ti.cbSize = sizeof(TOOLINFO); - - ti.hwnd = hwnd; - ti.uId = id; - SendMessage(hwndToolTip, TTM_DELTOOLA, 0, (LPARAM) (LPTOOLINFOA) &ti); - - ti.uFlags = TTF_SUBCLASS; - ti.hwnd = hwnd; - ti.uId = id; - ti.hinst = hInst; - ti.lpszText = Translate(text); - ti.rect = rc; - SendMessage(hwndToolTip, TTM_ADDTOOLA, 0, (LPARAM) (LPTOOLINFOA) &ti); - } -#endif } /* not used diff --git a/plugins/Popup/src/config.cpp b/plugins/Popup/src/config.cpp index 169f6a7630..b013ecb3dc 100644 --- a/plugins/Popup/src/config.cpp +++ b/plugins/Popup/src/config.cpp @@ -75,30 +75,6 @@ PLUGININFOEX pluginInfoEx = POPUP_UUID }; -// MLU layer for ansi release -#if !defined(_UNICODE) -BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD); -BOOL (WINAPI *MyAnimateWindow)(HWND hWnd,DWORD dwTime,DWORD dwFlags); -BOOL (WINAPI *MyGetMonitorInfo)(HMONITOR hMonitor, LPMONITORINFO lpmi); -BOOL (WINAPI *MyUpdateLayeredWindow) - (HWND hwnd, HDC hdcDST, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc, - COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags); -HMONITOR (WINAPI *MyMonitorFromWindow)(HWND hWnd, DWORD dwFlags); -BOOL (WINAPI *MyTransparentBlt)(HDC, int, int, int, int, HDC, int, int, int, int, UINT); -BOOL (WINAPI *MyAlphaBlend)(HDC, int, int, int, int, HDC, int, int, int, int, BLENDFUNCTION); - -// gdi32.dll -BOOL (WINAPI *MyGetTextExtentPoint32W)(HDC, LPCWSTR, int, LPSIZE); - -//user32.dll -int (WINAPI *MyDrawTextW)(HDC, LPCWSTR, int, LPRECT, UINT); -int (WINAPI *MyDrawTextExW)(HDC, LPCWSTR, int, LPRECT, UINT, LPDRAWTEXTPARAMS); -BOOL (WINAPI *MySetWindowTextW)(HWND, LPCWSTR); -LRESULT (WINAPI *MySendMessageW)(HWND, UINT, WPARAM, LPARAM); -LRESULT (WINAPI *MyCallWindowProcW)(WNDPROC, HWND, UINT, WPARAM, LPARAM); -HWND (WINAPI *MyCreateWindowExW)(DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID); - -#endif HRESULT (WINAPI *MyDwmEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurBehind); diff --git a/plugins/Popup/src/config.h b/plugins/Popup/src/config.h index 6b293ba10d..3fe8e7facc 100644 --- a/plugins/Popup/src/config.h +++ b/plugins/Popup/src/config.h @@ -196,35 +196,6 @@ extern PLUGININFOEX pluginInfoEx; #define INVALID_FILE_ATTRIBUTES (DWORD (-1)) #endif -// MLU layer for ansi release -#if !defined(_UNICODE) -//===== DLLs ===== -extern HMODULE hUserDll; -extern HMODULE hMsimgDll; -extern HMODULE hKernelDll; -extern HMODULE hGdiDll; -extern HMODULE hDwmapiDll; - -extern BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD); -extern BOOL (WINAPI *MyAnimateWindow)(HWND hWnd,DWORD dwTime,DWORD dwFlags); -extern BOOL (WINAPI *MyGetMonitorInfo)(HMONITOR hMonitor, LPMONITORINFO lpmi); -extern BOOL (WINAPI *MyUpdateLayeredWindow) - (HWND hwnd, HDC hdcDST, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc, - COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags); -extern HMONITOR (WINAPI* MyMonitorFromWindow)(HWND hWnd, DWORD dwFlags); -extern BOOL (WINAPI *MyTransparentBlt)(HDC, int, int, int, int, HDC, int, int, int, int, UINT); -extern BOOL (WINAPI *MyAlphaBlend)(HDC, int, int, int, int, HDC, int, int, int, int, BLENDFUNCTION); - -extern BOOL (WINAPI *MyGetTextExtentPoint32W)(HDC, LPCWSTR, int, LPSIZE); -extern int (WINAPI *MyDrawTextW)(HDC, LPCWSTR, int, LPRECT, UINT); -extern int (WINAPI *MyDrawTextExW)(HDC, LPCWSTR, int, LPRECT, UINT, LPDRAWTEXTPARAMS); -extern BOOL (WINAPI *MySetWindowTextW)(HWND, LPCWSTR); -extern LRESULT (WINAPI *MySendMessageW)(HWND, UINT, WPARAM, LPARAM); -extern LRESULT (WINAPI *MyCallWindowProcW)(WNDPROC, HWND, UINT, WPARAM, LPARAM); -extern HWND (WINAPI *MyCreateWindowExW)(DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID); - -#endif - #define DWM_BB_ENABLE 0x00000001 #define DWM_BB_BLURREGION 0x00000002 #define DWM_BB_TRANSITIONONMAXIMIZED 0x00000004 diff --git a/plugins/Popup/src/history.cpp b/plugins/Popup/src/history.cpp index baf5e1797d..22529426b8 100644 --- a/plugins/Popup/src/history.cpp +++ b/plugins/Popup/src/history.cpp @@ -358,7 +358,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA int width = wndPreview->getContent()->getWidth(); int height = wndPreview->getContent()->getHeight(); -#if defined(_UNICODE) + { BLENDFUNCTION bf; bf.BlendOp = AC_SRC_OVER; @@ -369,25 +369,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA wndPreview->getContent()->getDC(), 0, 0, width, height, bf); } -#else - if (MyAlphaBlend) - { - BLENDFUNCTION bf; - bf.BlendOp = AC_SRC_OVER; - bf.BlendFlags = 0; - bf.SourceConstantAlpha = 255; - bf.AlphaFormat = AC_SRC_ALPHA; - MyAlphaBlend(lpdis->hDC, lpdis->rcItem.left+5, lpdis->rcItem.top+3, width, height, - wndPreview->getContent()->getDC(), - 0, 0, width, height, bf); - } - else { - BitBlt(lpdis->hDC, - lpdis->rcItem.left+5, lpdis->rcItem.top+5, lpdis->rcItem.left+5+width, lpdis->rcItem.top+3+height, - wndPreview->getContent()->getDC(), - 0, 0, SRCCOPY); - } -#endif + } return TRUE; diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index debafada7a..268226de9c 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -553,73 +553,6 @@ MIRAPI int Load(PLUGINLINK *link) osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); bResult = GetVersionEx(&osvi); -// MLU layer for ansi release -#if !defined(_UNICODE) - MySetLayeredWindowAttributes = 0; - MyUpdateLayeredWindow = 0; - MyAnimateWindow = 0; - MyDrawTextW = 0; - MyDrawTextExW = 0; - MySetWindowTextW = 0; - MySendMessageW = 0; - MyCallWindowProcW = 0; - MyCreateWindowExW = 0; - - MyGetMonitorInfo = 0; - MyMonitorFromWindow = 0; - - hUserDll = LoadLibrary(_T("user32.dll")); - if (hUserDll) { - MySetLayeredWindowAttributes = (BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))GetProcAddress(hUserDll, "SetLayeredWindowAttributes"); - MyUpdateLayeredWindow = (BOOL (WINAPI *)(HWND, HDC, POINT *, SIZE *, HDC, POINT *, COLORREF, BLENDFUNCTION *, DWORD))GetProcAddress(hUserDll, "UpdateLayeredWindow"); - MyAnimateWindow = (BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(hUserDll,"AnimateWindow"); - MyDrawTextW = (int (WINAPI *)(HDC, LPCWSTR, int, LPRECT, UINT))GetProcAddress(hUserDll,"DrawTextW"); - MyDrawTextExW = (int (WINAPI*)(HDC,LPCWSTR,int,LPRECT,UINT,LPDRAWTEXTPARAMS))GetProcAddress(hUserDll,"DrawTextExW"); - MySetWindowTextW = (BOOL (WINAPI*)(HWND, LPCWSTR))GetProcAddress(hUserDll,"SetWindowTextW"); - MySendMessageW = (LRESULT (WINAPI *)(HWND, UINT, WPARAM, LPARAM))GetProcAddress(hUserDll,"SendMessageW"); - MyCallWindowProcW = (LRESULT (WINAPI *)(WNDPROC, HWND, UINT, WPARAM, LPARAM))GetProcAddress(hUserDll,"CallWindowProcW"); - MyCreateWindowExW = (HWND (WINAPI*)(DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID))GetProcAddress(hUserDll,"CreateWindowExW"); - - if (LOWORD(GetVersion())!=4) { //Windows 98, ME, 2000, XP, and later support multimonitor configuration. - if (bResult) { - if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) - { //2000 or XP - #ifdef UNICODE - MyGetMonitorInfo = (BOOL (WINAPI*)(HMONITOR,LPMONITORINFO))GetProcAddress(hUserDll,("GetMonitorInfoW")); - #else - MyGetMonitorInfo = (BOOL (WINAPI*)(HMONITOR,LPMONITORINFO))GetProcAddress(hUserDll,("GetMonitorInfoA")); - #endif //UNICODE - } else - { //98 or ME - // attempt to fix multimonitor on 9x - MyGetMonitorInfo = (BOOL (WINAPI*)(HMONITOR,LPMONITORINFO))GetProcAddress(hUserDll,("GetMonitorInfoA")); - if (!MyGetMonitorInfo) - MyGetMonitorInfo = (BOOL (WINAPI*)(HMONITOR,LPMONITORINFO))GetProcAddress(hUserDll,("GetMonitorInfo")); - } - } //There's no need for an else branch. - if (MyGetMonitorInfo) - MyMonitorFromWindow = (HMONITOR (WINAPI*)(HWND,DWORD))GetProcAddress(hUserDll, ("MonitorFromWindow")); - } - } - - hGdiDll = LoadLibrary(_T("gdi32.dll")); - if (hGdiDll) { - MyGetTextExtentPoint32W = (BOOL (WINAPI *)(HDC, LPCWSTR, int, LPSIZE))GetProcAddress(hGdiDll,"GetTextExtentPoint32W"); - } - else{ - MyGetTextExtentPoint32W = 0; - } - hMsimgDll = LoadLibrary(_T("msimg32.dll")); - MyAlphaBlend = 0; - MyTransparentBlt = 0; - if (hMsimgDll) - { - MyTransparentBlt = (BOOL (WINAPI *)(HDC, int, int, int, int, HDC, int, int, int, int, UINT)) - GetProcAddress(hMsimgDll, "TransparentBlt"); - MyAlphaBlend = (BOOL (WINAPI *)(HDC, int, int, int, int, HDC, int, int, int, int, BLENDFUNCTION)) - GetProcAddress(hMsimgDll, "AlphaBlend"); - } -#endif hDwmapiDll = LoadLibrary(_T("dwmapi.dll")); MyDwmEnableBlurBehindWindow = 0; diff --git a/plugins/Popup/src/opt_adv.cpp b/plugins/Popup/src/opt_adv.cpp index ef831df123..52cc033ba3 100644 --- a/plugins/Popup/src/opt_adv.cpp +++ b/plugins/Popup/src/opt_adv.cpp @@ -144,14 +144,9 @@ INT_PTR CALLBACK DlgProcPopUpAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM //Group: Monitor { BOOL bMonitor = 0; -#if defined(_UNICODE) + bMonitor = GetSystemMetrics(SM_CMONITORS)>1; -#else - if(MyGetMonitorInfo) { - //os support multimonitor, check if monitor > 1 - bMonitor = GetSystemMetrics(SM_CMONITORS)>1; - } -#endif + CheckDlgButton(hwnd, IDC_MIRANDAWND, bMonitor ? (PopUpOptions.Monitor == MN_MIRANDA) : TRUE); CheckDlgButton(hwnd, IDC_ACTIVEWND, bMonitor ? (PopUpOptions.Monitor == MN_ACTIVE) : FALSE); EnableWindow(GetDlgItem(hwnd, IDC_GRP_MULTIMONITOR), bMonitor); @@ -175,11 +170,9 @@ INT_PTR CALLBACK DlgProcPopUpAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM SetDlgItemText(hwnd, IDC_TRANS_PERCENT, tstr); CheckDlgButton(hwnd, IDC_TRANS_OPAQUEONHOVER, PopUpOptions.OpaqueOnHover); { -#if defined(_UNICODE) + BOOL how = TRUE; -#else - BOOL how = (BOOL)(MySetLayeredWindowAttributes); -#endif + EnableWindow(GetDlgItem(hwnd, IDC_TRANS) ,how); EnableWindow(GetDlgItem(hwnd, IDC_TRANS_TXT1) ,how && PopUpOptions.UseTransparency); EnableWindow(GetDlgItem(hwnd, IDC_TRANS_SLIDER) ,how && PopUpOptions.UseTransparency); @@ -214,11 +207,9 @@ INT_PTR CALLBACK DlgProcPopUpAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM { DWORD dwItem, dwActiveItem = 0; -#if defined(_UNICODE) + BOOL how = TRUE; -#else - BOOL how = (BOOL)(MySetLayeredWindowAttributes) /*&& !PopUpOptions.UseAnimations*/; -#endif + EnableWindow(GetDlgItem(hwnd, IDC_EFFECT), how); EnableWindow(GetDlgItem(hwnd, IDC_EFFECT_TXT), how); @@ -336,11 +327,9 @@ INT_PTR CALLBACK DlgProcPopUpAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDC_TRANS: { PopUpOptions.UseTransparency = !PopUpOptions.UseTransparency; -#if defined(_UNICODE) + BOOL how = TRUE; -#else - BOOL how = (BOOL)(MySetLayeredWindowAttributes); -#endif + EnableWindow(GetDlgItem(hwnd, IDC_TRANS_TXT1) ,how && PopUpOptions.UseTransparency); EnableWindow(GetDlgItem(hwnd, IDC_TRANS_SLIDER) ,how && PopUpOptions.UseTransparency); EnableWindow(GetDlgItem(hwnd, IDC_TRANS_PERCENT) ,how && PopUpOptions.UseTransparency); @@ -709,7 +698,7 @@ INT_PTR CALLBACK AlphaTrackBarWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARA int newVal = (BYTE)SendMessage(hwnd, TBM_GETPOS, 0, 0); if (oldVal != newVal) { -#if defined(_UNICODE) + if (oldVal < 0) { SetWindowLongPtr(hwndBox, GWLP_USERDATA, 1); @@ -721,37 +710,17 @@ INT_PTR CALLBACK AlphaTrackBarWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARA } SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE) | WS_EX_LAYERED); SetLayeredWindowAttributes(hwndBox, NULL, newVal, LWA_ALPHA); -#else - if (MySetLayeredWindowAttributes) - { - if (oldVal < 0) - { - SetWindowLongPtr(hwndBox, GWLP_USERDATA, 1); - RECT rc; GetWindowRect(hwnd, &rc); - SetWindowPos(hwndBox, NULL, - (rc.left+rc.right-170)/2, rc.bottom+2, 170, 50, - SWP_NOACTIVATE|SWP_DEFERERASE|SWP_NOSENDCHANGING|SWP_SHOWWINDOW); - SetWindowRgn(hwndBox, NULL, TRUE); - } - SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE) | WS_EX_LAYERED); - MySetLayeredWindowAttributes(hwndBox, NULL, newVal, LWA_ALPHA); - } -#endif + oldVal = newVal; } break; } case WM_MOUSELEAVE: { -#if defined(_UNICODE) + SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE) & ~WS_EX_LAYERED); SetLayeredWindowAttributes(hwndBox, NULL, 255, LWA_ALPHA); -#else - if (MySetLayeredWindowAttributes) { - SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE) & ~WS_EX_LAYERED); - MySetLayeredWindowAttributes(hwndBox, NULL, 255, LWA_ALPHA); - } -#endif + ShowWindow(hwndBox, SW_HIDE); oldVal = -1; break; diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp index 4538e2b9fa..e124702f80 100644 --- a/plugins/Popup/src/opt_gen.cpp +++ b/plugins/Popup/src/opt_gen.cpp @@ -349,7 +349,7 @@ INT_PTR CALLBACK DlgProcPopUpGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM rcBox.right-rcBox.left, rcBox.bottom-rcBox.top, FALSE); -#if defined(_UNICODE) + SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE)|WS_EX_LAYERED); SetLayeredWindowAttributes(hwndBox, NULL, 0, LWA_ALPHA); ShowWindow(hwndBox, SW_SHOW); @@ -359,19 +359,7 @@ INT_PTR CALLBACK DlgProcPopUpGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM Sleep(1); } SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE)&~WS_EX_LAYERED); -#else - if (MySetLayeredWindowAttributes) { - SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE)|WS_EX_LAYERED); - MySetLayeredWindowAttributes(hwndBox, NULL, 0, LWA_ALPHA); - ShowWindow(hwndBox, SW_SHOW); - for (int i = 0; i <= 255; i += 15) { - MySetLayeredWindowAttributes(hwndBox, NULL, i, LWA_ALPHA); - UpdateWindow(hwndBox); - Sleep(1); - } - SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE)&~WS_EX_LAYERED); - } -#endif + ShowWindow(hwndBox, SW_SHOW); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp index 033c26c6a7..207c817401 100644 --- a/plugins/Popup/src/opt_skins.cpp +++ b/plugins/Popup/src/opt_skins.cpp @@ -143,7 +143,7 @@ static void DrawPreview(HWND hwnd, HDC hdc) int left = (rc.right - width) / 2; int top = (rc.bottom - height) / 2; -#if defined(_UNICODE) + BLENDFUNCTION bf; bf.BlendOp = AC_SRC_OVER; bf.BlendFlags = 0; @@ -152,24 +152,7 @@ static void DrawPreview(HWND hwnd, HDC hdc) AlphaBlend(hdc, left, top, width, height, wndPreview->getContent()->getDC(), 0, 0, width, height, bf); -#else - if (MyAlphaBlend) { - BLENDFUNCTION bf; - bf.BlendOp = AC_SRC_OVER; - bf.BlendFlags = 0; - bf.SourceConstantAlpha = 255; - bf.AlphaFormat = AC_SRC_ALPHA; - MyAlphaBlend(hdc, left, top, width, height, - wndPreview->getContent()->getDC(), - 0, 0, width, height, bf); - } - else { - BitBlt(hdc, - left, top, left+width, top+height, - wndPreview->getContent()->getDC(), - 0, 0, SRCCOPY); - } -#endif + } FrameRect(hdc, &rc, GetStockBrush(LTGRAY_BRUSH)); diff --git a/plugins/Popup/src/opttree.cpp b/plugins/Popup/src/opttree.cpp index d6d81c8103..8aa6a737e0 100644 --- a/plugins/Popup/src/opttree.cpp +++ b/plugins/Popup/src/opttree.cpp @@ -40,7 +40,7 @@ static void OptTree_TranslateItem(HWND hwndTree, HTREEITEM hItem) WCHAR unicode[64]; } buf; -#if defined(_UNICODE) + TVITEMW tvi = {0}; tvi.mask = TVIF_HANDLE|TVIF_TEXT; tvi.hItem = hItem; @@ -50,32 +50,6 @@ static void OptTree_TranslateItem(HWND hwndTree, HTREEITEM hItem) tvi.pszText = TranslateW(tvi.pszText); tvi.cchTextMax = lstrlenW(tvi.pszText); SendMessageW(hwndTree, TVM_SETITEMW, 0, (LPARAM)&tvi); - -#else - if (g_popup.isOsUnicode && MySendMessageW) - { - TVITEMW tvi = {0}; - tvi.mask = TVIF_HANDLE|TVIF_TEXT; - tvi.hItem = hItem; - tvi.pszText = buf.unicode; - tvi.cchTextMax = SIZEOF(buf.unicode); - MySendMessageW(hwndTree, TVM_GETITEMW, 0, (LPARAM)&tvi); - tvi.pszText = TranslateW(tvi.pszText); - tvi.cchTextMax = lstrlenW(tvi.pszText); - MySendMessageW(hwndTree, TVM_SETITEMW, 0, (LPARAM)&tvi); - } - else { - TVITEMA tvi = {0}; - tvi.mask = TVIF_HANDLE|TVIF_TEXT; - tvi.hItem = hItem; - tvi.pszText = buf.ansi; - tvi.cchTextMax = SIZEOF(buf.ansi); - SendMessageA(hwndTree, TVM_GETITEMA, 0, (LPARAM)&tvi); - tvi.pszText = Translate(tvi.pszText); - tvi.cchTextMax = lstrlenA(tvi.pszText); - SendMessageA(hwndTree, TVM_SETITEMA, 0, (LPARAM)&tvi); - } -#endif } void OptTree_Translate(HWND hwndTree) diff --git a/plugins/Popup/src/popup_thread.cpp b/plugins/Popup/src/popup_thread.cpp index 2376653cba..3ee85fa4d3 100644 --- a/plugins/Popup/src/popup_thread.cpp +++ b/plugins/Popup/src/popup_thread.cpp @@ -138,14 +138,7 @@ bool UpdatePopupPosition(PopupWnd2 *prev, PopupWnd2 *wnd) RECT rc; // SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0); -#if !defined(_UNICODE) - //Win95 or NT don't have the support for multi monitor. - if (!MyGetMonitorInfo) { - SystemParametersInfo(SPI_GETWORKAREA,0,&rc,0); - } - //Windows 98/ME/2000/XP do have it. - else -#endif + if (GetSystemMetrics(SM_CMONITORS)==1) { //we have only one monitor (cant check it together with 1.if) SystemParametersInfo(SPI_GETWORKAREA,0,&rc,0); } @@ -161,13 +154,10 @@ bool UpdatePopupPosition(PopupWnd2 *prev, PopupWnd2 *wnd) mnti.cbSize = sizeof(MONITORINFOEX); -#if defined(_UNICODE) + hMonitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY); if (GetMonitorInfo(hMonitor, (LPMONITORINFO)&mnti) == TRUE) //It worked -#else - hMonitor = MyMonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY); - if (MyGetMonitorInfo(hMonitor, (LPMONITORINFO)&mnti) == TRUE) //It worked -#endif + CopyMemory(&rc, &(mnti.rcWork), sizeof(RECT)); else SystemParametersInfo(SPI_GETWORKAREA,0,&rc,0); diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index f8ef1cf3b2..93fc5f428f 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -87,15 +87,10 @@ bool LoadPopupWnd2() // register custom class for edit box with drop-shadow attribute if (IsWinVerXPPlus()) { - #if defined(_UNICODE) || defined(_WIN64) + #define MyRegisterClassExW RegisterClassExW #define MyGetClassInfoExW GetClassInfoExW - #else - ATOM (WINAPI *MyRegisterClassExW)(CONST WNDCLASSEXW *); - MyRegisterClassExW = (ATOM (WINAPI *)(CONST WNDCLASSEXW *))GetProcAddress(hUserDll, "RegisterClassExW"); - BOOL (WINAPI *MyGetClassInfoExW)(HINSTANCE, LPCWSTR, LPWNDCLASSEXW); - MyGetClassInfoExW = (BOOL (WINAPI *)(HINSTANCE, LPCWSTR, LPWNDCLASSEXW))GetProcAddress(hUserDll, "GetClassInfoExW"); - #endif + WNDCLASSEXW wclw = {0}; wclw.cbSize = sizeof(wclw); if (!MyGetClassInfoExW(NULL, L"EDIT", &wclw)) @@ -262,7 +257,7 @@ void PopupWnd2::create() void PopupWnd2::updateLayered(BYTE opacity) { if (!m_hwnd) return; -#if defined(_UNICODE) + if (SetWindowLongPtr(m_hwnd, GWL_EXSTYLE, GetWindowLongPtr(m_hwnd, GWL_EXSTYLE) | WS_EX_LAYERED)) { RECT rc; GetWindowRect(m_hwnd, &rc); POINT ptDst = {rc.left, rc.top}; @@ -280,28 +275,7 @@ void PopupWnd2::updateLayered(BYTE opacity) UpdateWindow(m_hwnd); } -#else - if (MyUpdateLayeredWindow) { - if (SetWindowLongPtr(m_hwnd, GWL_EXSTYLE, GetWindowLongPtr(m_hwnd, GWL_EXSTYLE) | WS_EX_LAYERED)) - { - RECT rc; GetWindowRect(m_hwnd, &rc); - POINT ptDst = {rc.left, rc.top}; - POINT ptSrc = {0, 0}; - - BLENDFUNCTION blend; - blend.BlendOp = AC_SRC_OVER; - blend.BlendFlags = 0; - blend.SourceConstantAlpha = opacity; //m_options->UseTransparency ? opacity : 255; - blend.AlphaFormat = AC_SRC_ALPHA; - MyUpdateLayeredWindow(m_hwnd, NULL, &ptDst, &m_sz, - m_bmpAnimate ? m_bmpAnimate->getDC() : m_bmp->getDC(), - &ptSrc, 0xffffffff, &blend, ULW_ALPHA); - - UpdateWindow(m_hwnd); - } - } -#endif } SIZE PopupWnd2::measure() @@ -380,16 +354,10 @@ void PopupWnd2::animate() if (m_bReshapeWindow) { m_bReshapeWindow = false; -#if defined(_UNICODE) + if (m_hwnd && m_bmp && m_options->DropShadow && PopUpOptions.EnableFreeformShadows /*DoWeNeedRegionForThisSkin()*/) SetWindowRgn(m_hwnd, m_bmp->buildOpaqueRgn(skin->getShadowRegionOpacity()), FALSE); -#else - if (!MyUpdateLayeredWindow && m_hwnd && m_bmp && PopUpOptions.Enable9xTransparency) - SetWindowRgn(m_hwnd, m_bmp->buildOpaqueRgn(skin->getLegacyRegionOpacity()), FALSE); - if (MyUpdateLayeredWindow && m_hwnd && m_bmp && m_options->DropShadow && PopUpOptions.EnableFreeformShadows /*DoWeNeedRegionForThisSkin()*/) - SetWindowRgn(m_hwnd, m_bmp->buildOpaqueRgn(skin->getShadowRegionOpacity()), FALSE); -#endif if (MyDwmEnableBlurBehindWindow && PopUpOptions.EnableAeroGlass) { @@ -1146,11 +1114,9 @@ LRESULT CALLBACK ReplyEditWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM { WCHAR msg[2048]; LPWSTR bufW = NULL; -#if defined(_UNICODE) + SendMessageW(hwnd, WM_GETTEXT, SIZEOF(msg), (LPARAM)msg); -#else - MySendMessageW(hwnd, WM_GETTEXT, SIZEOF(msg), (LPARAM)msg); -#endif + if(wcslen(msg)==0){ DestroyWindow(hwnd); return 0; @@ -1220,13 +1186,9 @@ LRESULT CALLBACK ReplyEditWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM if (oldWndProc) { -#if defined(_UNICODE) + return CallWindowProcW(oldWndProc, hwnd, message, wParam, lParam); -#else - if (IsWindowUnicode(hwnd) && MyCallWindowProcW) - return MyCallWindowProcW(oldWndProc, hwnd, message, wParam, lParam); - return CallWindowProc(oldWndProc, hwnd, message, wParam, lParam); -#endif + } return DefWindowProc(hwnd, message, wParam, lParam); @@ -1294,41 +1256,21 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara //RECT rc = renderInfo.textRect; //MapWindowPoints(hwnd, NULL, (LPPOINT)&rc, 2); RECT rc; GetWindowRect(m_hwnd, &rc); -#if defined(_UNICODE) + HWND hwndEditBox = CreateWindowExW(WS_EX_TOOLWINDOW|WS_EX_TOPMOST, g_wndClass.cPopupEditBox ? L"PopupEditBox" : L"EDIT", NULL, WS_BORDER|WS_POPUP|WS_VISIBLE|ES_AUTOVSCROLL|ES_LEFT|ES_MULTILINE|ES_NOHIDESEL|ES_WANTRETURN, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, NULL, NULL, hInst, NULL); -#else - HWND hwndEditBox = 0; - if(MyCreateWindowExW && g_popup.isMirUnicode) { - //create unicode window only if miranda is unicode - //coz many protocol make trouble with unicode text on utf8 send inside ansi release - hwndEditBox = MyCreateWindowExW(WS_EX_TOOLWINDOW|WS_EX_TOPMOST, - g_wndClass.cPopupEditBox ? L"PopupEditBox" : L"EDIT", - NULL, - WS_BORDER|WS_POPUP|WS_VISIBLE|ES_AUTOVSCROLL|ES_LEFT|ES_MULTILINE|ES_NOHIDESEL|ES_WANTRETURN, - rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, NULL, NULL, hInst, NULL); - } - else { - hwndEditBox = CreateWindowExA(WS_EX_TOOLWINDOW|WS_EX_TOPMOST, - g_wndClass.cPopupEditBox ? "PopupEditBox" : "EDIT", - NULL, - WS_BORDER|WS_POPUP|WS_VISIBLE|ES_AUTOVSCROLL|ES_LEFT|ES_MULTILINE|ES_NOHIDESEL|ES_WANTRETURN, - rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, NULL, NULL, hInst, NULL); - } -#endif + ReplyEditData *dat = (ReplyEditData *)mir_alloc(sizeof(ReplyEditData)); dat->oldWndProc = (WNDPROC)GetWindowLongPtr(hwndEditBox, (LONG_PTR)GWLP_WNDPROC); dat->hwndPopup = m_hwnd; dat->hContact = m_hContact; if(IsWindowUnicode(hwndEditBox)) { -#if defined(_UNICODE) + SendMessageW(hwndEditBox, WM_SETFONT, (WPARAM)fonts.text, TRUE); -#else - MySendMessageW(hwndEditBox, WM_SETFONT, (WPARAM)fonts.text, TRUE); -#endif + SetWindowLongPtrW(hwndEditBox, GWLP_USERDATA, (LONG_PTR)dat); SetWindowLongPtrW(hwndEditBox, GWLP_WNDPROC, (LONG_PTR)ReplyEditWndProc); } @@ -1382,11 +1324,8 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara break; case ACT_DEF_COPY: { - #ifdef UNICODE - #define CF_TCHAR CF_UNICODETEXT - #else - #define CF_TCHAR CF_TEXT - #endif + #define CF_TCHAR CF_UNICODETEXT + HGLOBAL clipbuffer; static TCHAR * buffer, *text; char* sztext; @@ -1658,13 +1597,10 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara tme.hwndTrack = m_hwnd; _TrackMouseEvent(&tme); if (!m_customPopup) PopupThreadLock(); -#if defined(_UNICODE) + if (m_options->OpaqueOnHover) updateLayered(255); -#else - if (MySetLayeredWindowAttributes && m_options->OpaqueOnHover) - updateLayered(255); -#endif + m_bIsHovered = true; break; } @@ -1676,13 +1612,10 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara animate(); if (!m_bIsHovered) break; -#if defined(_UNICODE) + if (m_options->OpaqueOnHover) updateLayered(m_options->UseTransparency ? m_options->Alpha : 255); -#else - if (MySetLayeredWindowAttributes && m_options->OpaqueOnHover) - updateLayered(m_options->UseTransparency ? m_options->Alpha : 255); -#endif + if (!m_customPopup) PopupThreadUnlock(); m_bIsHovered = false; break; diff --git a/plugins/Popup/src/skin.cpp b/plugins/Popup/src/skin.cpp index c18dcde07f..6cd3f7df14 100644 --- a/plugins/Popup/src/skin.cpp +++ b/plugins/Popup/src/skin.cpp @@ -75,25 +75,13 @@ SIZE PopupSkin::measureAction(HDC hdc, POPUPACTION *act) const SIZE szText, szSpace; -#if defined(_UNICODE) + LPWSTR wname = mir_a2u(name); WCHAR *str = TranslateW(wname); GetTextExtentPoint32W(hdc, str, lstrlenW(str), &szText); mir_free(wname); GetTextExtentPoint32W(hdc, L" ", 1, &szSpace); -#else - if (g_popup.isOsUnicode && MyGetTextExtentPoint32W) { - LPWSTR wname = mir_a2u(name); - WCHAR *str = TranslateW(wname); - MyGetTextExtentPoint32W(hdc, str, lstrlenW(str), &szText); - mir_free(wname); - } - else { - char *str = Translate(name); - GetTextExtentPoint32A(hdc, str, lstrlenA(str), &szText); - } - GetTextExtentPoint32A(hdc, " ", 1, &szSpace); -#endif + sz.cy = max(sz.cy, szText.cy); sz.cx += szSpace.cx; sz.cx += szText.cx; @@ -154,7 +142,7 @@ void PopupSkin::drawAction(MyBitmap *bmp, POPUPACTION *act, int x, int y, bool h GetTextExtentPoint32A(bmp->getDC(), " ", 1, &szSpace); -#if defined(_UNICODE) + LPWSTR wname = mir_a2u(name); WCHAR *str = TranslateW(wname); GetTextExtentPoint32W(bmp->getDC(), str, lstrlenW(str), &szText); @@ -165,31 +153,7 @@ void PopupSkin::drawAction(MyBitmap *bmp, POPUPACTION *act, int x, int y, bool h y+2 + (((PopUpOptions.actions&ACT_LARGE) ? 32 : 16) - szText.cy)/2 )); mir_free(wname); -#else - if (g_popup.isOsUnicode && MyGetTextExtentPoint32W) - { - LPWSTR wname = mir_a2u(name); - WCHAR *str = TranslateW(wname); - MyGetTextExtentPoint32W(bmp->getDC(), str, lstrlenW(str), &szText); - bmp->Draw_TextW(str, - (PopUpOptions.actions&ACT_LARGE) ? (x+szSpace.cx+32) : (x+szSpace.cx+16), - max( - y+2, - y+2 + (((PopUpOptions.actions&ACT_LARGE) ? 32 : 16) - szText.cy)/2 - )); - mir_free(wname); - } - else { - char *str = Translate(name); - GetTextExtentPoint32A(bmp->getDC(), str, lstrlenA(str), &szText); - bmp->Draw_TextA(str, - (PopUpOptions.actions&ACT_LARGE) ? (x+szSpace.cx+32) : (x+szSpace.cx+16), - max( - y+2, - y+2 + (((PopUpOptions.actions&ACT_LARGE) ? 32 : 16) - szText.cy)/2 - )); - } -#endif + SelectObject(bmp->getDC(), hFntSave); } else { @@ -322,22 +286,13 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options } case PopupWnd2::TT_UNICODE: { -#if defined(_UNICODE) + RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0); DrawTextExW(hdc, wnd->getTextW(), lstrlenW(wnd->getTextW()), &rc, DT_CALCRECT|DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL); szNew.cx = rc.right; szNew.cy = rc.bottom; -#else - if (g_popup.isOsUnicode && MyDrawTextExW) - { - RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0); - MyDrawTextExW(hdc, wnd->getTextW(), lstrlenW(wnd->getTextW()), &rc, - DT_CALCRECT|DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL); - szNew.cx = rc.right; - szNew.cy = rc.bottom; - } -#endif + break; } case PopupWnd2::TT_MTEXT: @@ -390,22 +345,13 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options } case PopupWnd2::TT_UNICODE: { -#if defined(_UNICODE) + RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0); DrawTextExW(hdc, wnd->getTitleW(), lstrlenW(wnd->getTitleW()), &rc, DT_CALCRECT|DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL); szNew.cx = rc.right; szNew.cy = rc.bottom; -#else - if (g_popup.isOsUnicode && MyDrawTextExW) - { - RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0); - MyDrawTextExW(hdc, wnd->getTitleW(), lstrlenW(wnd->getTitleW()), &rc, - DT_CALCRECT|DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL); - szNew.cx = rc.right; - szNew.cy = rc.bottom; - } -#endif + break; } case PopupWnd2::TT_MTEXT: @@ -665,18 +611,11 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o } case PopupWnd2::TT_UNICODE: { -#if defined(_UNICODE) + RECT rc; SetRect(&rc, pos.x, pos.y, pos.x+sz.cx, pos.y+sz.cy); DrawTextExW(hdc, wnd->getTextW(), lstrlenW(wnd->getTextW()), &rc, DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL); -#else - if (g_popup.isOsUnicode && MyDrawTextExW) - { - RECT rc; SetRect(&rc, pos.x, pos.y, pos.x+sz.cx, pos.y+sz.cy); - MyDrawTextExW(hdc, wnd->getTextW(), lstrlenW(wnd->getTextW()), &rc, - DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL); - } -#endif + break; } case PopupWnd2::TT_MTEXT: @@ -738,22 +677,13 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o } case PopupWnd2::TT_UNICODE: { -#if defined(_UNICODE) + HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.title); RECT rc; SetRect(&rc, pos.x, pos.y, pos.x+sz.cx, pos.y+sz.cy); DrawTextExW(hdc, wnd->getTitleW(), lstrlenW(wnd->getTitleW()), &rc, DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL); SelectObject(hdc, hFntSave); -#else - if (g_popup.isOsUnicode && MyDrawTextExW) - { - HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.title); - RECT rc; SetRect(&rc, pos.x, pos.y, pos.x+sz.cx, pos.y+sz.cy); - MyDrawTextExW(hdc, wnd->getTitleW(), lstrlenW(wnd->getTitleW()), &rc, - DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL); - SelectObject(hdc, hFntSave); - } -#endif + break; } case PopupWnd2::TT_MTEXT: @@ -1153,15 +1083,10 @@ void PopupSkin::loadSkin(std::istream &f) void PopupSkin::loadSkin(LPCTSTR fn) { if (!fn) return; -#if defined (_UNICODE) && _MSC_VER <= 1200 - char* temp= mir_t2a(fn); - std::ifstream theFile; - theFile.open(temp, std::ios::in); - mir_free(temp); -#else + std::ifstream theFile; theFile.open(fn, std::ios::in); -#endif + if (!theFile) return; loadSkin(theFile); theFile.close(); @@ -1350,22 +1275,18 @@ void PopupSkin::freeSkin(SKINELEMENT *head) void PopupSkin::saveOpts() const { char buf[128]; -#if defined( _UNICODE ) + mir_snprintf(buf, sizeof(buf), "skin.%.120S", m_name); -#else - mir_snprintf(buf, sizeof(buf), "skin.%.120s", m_name); -#endif + DBWriteContactSettingDword(NULL, MODULNAME, buf, m_flags); } void PopupSkin::loadOpts() const { char buf[128]; -#if defined( _UNICODE ) + mir_snprintf(buf, sizeof(buf), "skin.%.120S", m_name); -#else - mir_snprintf(buf, sizeof(buf), "skin.%.120s", m_name); -#endif + m_flags = DBGetContactSettingDword(NULL, MODULNAME, buf, m_flags); } diff --git a/plugins/mTextControl/src/FormattedTextDraw.cpp b/plugins/mTextControl/src/FormattedTextDraw.cpp index be42fade65..f40edb1d00 100644 --- a/plugins/mTextControl/src/FormattedTextDraw.cpp +++ b/plugins/mTextControl/src/FormattedTextDraw.cpp @@ -78,7 +78,7 @@ HRESULT CFormattedTextDraw::putRTFTextA(char *newVal) HRESULT CFormattedTextDraw::putRTFTextW(WCHAR *newVal) { -#ifdef UNICODE + HRESULT hr; LRESULT lResult = 0; EDITSTREAM editStream; @@ -95,9 +95,7 @@ HRESULT CFormattedTextDraw::putRTFTextW(WCHAR *newVal) editStream.pfnCallback = (EDITSTREAMCALLBACK)EditStreamInCallback; hr = m_spTextServices->TxSendMessage(EM_STREAMIN, (WPARAM)(SF_RTF|SF_UNICODE), (LPARAM)&editStream, &lResult); return S_OK; -#else - return E_FAIL; -#endif + } HRESULT CFormattedTextDraw::putTextA(char *newVal) @@ -130,7 +128,7 @@ HRESULT CFormattedTextDraw::putTextA(char *newVal) HRESULT CFormattedTextDraw::putTextW(WCHAR *newVal) { -#ifdef UNICODE + HRESULT hr; LRESULT lResult = 0; EDITSTREAM editStream; @@ -155,9 +153,7 @@ HRESULT CFormattedTextDraw::putTextW(WCHAR *newVal) m_spTextServices->TxSendMessage(EM_SETCHARFORMAT, (WPARAM)(SCF_ALL), (LPARAM)&cf, &lResult); return S_OK; -#else - return E_FAIL; -#endif + } HRESULT CFormattedTextDraw::Draw(void *hdcDraw, RECT *prc) @@ -510,11 +506,9 @@ HRESULT CFormattedTextDraw::CharFormatFromHFONT(CHARFORMAT2W* pCF, HFONT hFont) pCF->bCharSet = lf.lfCharSet; pCF->bPitchAndFamily = lf.lfPitchAndFamily; -#ifdef UNICODE + lstrcpyW(pCF->szFaceName, lf.lfFaceName); -#else - MultiByteToWideChar(CP_ACP, 0, lf.lfFaceName, LF_FACESIZE, pCF->szFaceName, LF_FACESIZE); -#endif + return S_OK; } diff --git a/plugins/mTextControl/src/headers.h b/plugins/mTextControl/src/headers.h index a2ff0df6ab..cbe1d455c1 100644 --- a/plugins/mTextControl/src/headers.h +++ b/plugins/mTextControl/src/headers.h @@ -20,17 +20,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #ifndef __headers_h__ #define __headers_h__ -#if defined(UNICODE) && !defined(_UNICODE) - #define _UNICODE -#elif defined(_UNICODE) && !defined(UNICODE) - #define UNICODE -#endif - -#ifndef UNICODE - #define OLE2ANSI -#elif defined(OLE2ANSI) - #undef OLE2ANSI -#endif #define _CRT_SECURE_NO_DEPRECATE diff --git a/plugins/mTextControl/src/richeditutils.cpp b/plugins/mTextControl/src/richeditutils.cpp index 28a267654b..ca361bc371 100644 --- a/plugins/mTextControl/src/richeditutils.cpp +++ b/plugins/mTextControl/src/richeditutils.cpp @@ -83,11 +83,9 @@ public: MultiByteToWideChar(CP_ACP, 0, szName, -1, szwName, sizeof(szwName) / sizeof(szwName[0])); if (this->pictStg == NULL) return STG_E_MEDIUMFULL; -#ifdef UNICODE + return this->pictStg->CreateStorage(szwName, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, lplpstg); -#else - return this->pictStg->CreateStorage(szName, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, lplpstg); -#endif + } HRESULT STDMETHODCALLTYPE QueryAcceptData(LPDATAOBJECT lpdataobj, CLIPFORMAT * lpcfFormat, DWORD reco, BOOL fReally, HGLOBAL hMetaPict) diff --git a/plugins/mTextControl/src/services.cpp b/plugins/mTextControl/src/services.cpp index 8970969ec4..3d2a9c0bee 100644 --- a/plugins/mTextControl/src/services.cpp +++ b/plugins/mTextControl/src/services.cpp @@ -143,7 +143,7 @@ INT_PTR MText_Create(WPARAM wParam, LPARAM lParam) { // allocate text object (unicode) HANDLE DLL_CALLCONV MTI_MTextCreateW (HANDLE userHandle, WCHAR *text) { -#ifdef UNICODE + TextObject *result = new TextObject; result->options = TextUserGetOptions(userHandle); result->ftd = new CFormattedTextDraw; @@ -155,19 +155,15 @@ MTI_MTextCreateW (HANDLE userHandle, WCHAR *text) { MText_InitFormatting1(result); return (HANDLE)result; -#else - return 0; -#endif + } INT_PTR MText_CreateW(WPARAM wParam, LPARAM lParam) { -#ifdef UNICODE + //HANDLE userHandle = (HANDLE)wParam; //WCHAR *wtext = (WCHAR *)lParam; return (INT_PTR)(HANDLE)MTI_MTextCreateW ((HANDLE)wParam, (WCHAR *)lParam); -#else - return 0; -#endif + } //--------------------------------------------------------------------------- diff --git a/plugins/mTextControl/src/textcontrol.cpp b/plugins/mTextControl/src/textcontrol.cpp index 29caf2eb0a..19b837349c 100644 --- a/plugins/mTextControl/src/textcontrol.cpp +++ b/plugins/mTextControl/src/textcontrol.cpp @@ -84,12 +84,8 @@ LRESULT CALLBACK MTextControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM int textLength = GetWindowTextLength(hwnd); data->text = new TCHAR[textLength+1]; GetWindowText(hwnd, data->text, textLength+1); - #if defined(UNICODE) || defined (_UNICODE) - data->mtext = MTI_MTextCreateW(data->htu, data->text); - #else - data->mtext = MTI_MTextCreate(data->htu, data->text); - #endif - + data->mtext = MTI_MTextCreateW(data->htu, data->text); + RECT rc; GetClientRect(hwnd, &rc); MTI_MTextSetParent(data->mtext, hwnd, rc); -- cgit v1.2.3