From 3da123901eb43f8358daa98993fa2fead3852e56 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> Date: Sun, 12 Dec 2010 23:57:30 +0000 Subject: Fixes for ANSI version git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@581 4f64403b-2f21-0410-a795-97e2b3489a10 --- yapp/options.cpp | 5 +---- yapp/popup_history.cpp | 4 ++-- yapp/popup_history_dlg.cpp | 7 +++++-- yapp/popups2.cpp | 18 ++++++++---------- yapp/popups2.dsp | 9 +++++---- yapp/popups2_9.vcproj | 14 +++----------- yapp/popwin.cpp | 45 +++++++++++++++++++++++++-------------------- 7 files changed, 49 insertions(+), 53 deletions(-) diff --git a/yapp/options.cpp b/yapp/options.cpp index ea49116..f039c0e 100644 --- a/yapp/options.cpp +++ b/yapp/options.cpp @@ -473,22 +473,19 @@ int OptInit(WPARAM wParam, LPARAM lParam) { OPTIONSDIALOGPAGE odp = { 0 }; odp.cbSize = sizeof(odp); odp.flags = ODPF_BOLDGROUPS; - //odp.flags |= ODPF_UNICODE; odp.position = -790000000; odp.hInstance = hInst; odp.pszTitle = LPGEN("PopUps"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT1); odp.pszTab = LPGEN("Settings"); - odp.nIDBottomSimpleControl = 0; odp.pfnDlgProc = DlgProcOpts1; CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp ); odp.pszTemplate = MAKEINTRESOURCEA(IDD_CLASSES); odp.pszTab = LPGEN("Classes"); - odp.nIDBottomSimpleControl = 0; odp.pfnDlgProc = DlgProcOptsClasses; - CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp ); + CallService( MS_OPT_ADDPAGE, wParam, (LPARAM)&odp ); return 0; } diff --git a/yapp/popup_history.cpp b/yapp/popup_history.cpp index 8658d6f..db0c53f 100644 --- a/yapp/popup_history.cpp +++ b/yapp/popup_history.cpp @@ -71,8 +71,8 @@ void PopupHistoryList::Add(wchar_t *title, wchar_t *message, time_t timestamp) PopupHistoryData item = {0}; //create an unicode history item item.flags = PHDF_UNICODE; //mark it as unicode item.timestamp = timestamp; - item.titleW = mir_wstrdup(title); - item.messageW = mir_wstrdup(message); + item.titleT = mir_u2t(title); + item.messageT = mir_u2t(message); AddItem(item); //add it } diff --git a/yapp/popup_history_dlg.cpp b/yapp/popup_history_dlg.cpp index ebf80bf..fda9589 100644 --- a/yapp/popup_history_dlg.cpp +++ b/yapp/popup_history_dlg.cpp @@ -338,9 +338,12 @@ IEVIEWEVENTDATA *CreateAndFillEventData(PopupHistoryData *popupItem) eventData->iType = IEED_EVENT_MESSAGE; #ifdef UNICODE eventData->dwFlags = IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT | IEEDF_UNICODE_TEXT2; + eventData->pszNickW = popupItem->titleT; + eventData->pszTextW = popupItem->messageT; +#else + eventData->pszNick = popupItem->titleT; + eventData->pszText = popupItem->messageT; #endif - eventData->pszNickW = popupItem->titleW; - eventData->pszTextW = popupItem->messageW; eventData->time = (DWORD) popupItem->timestamp; eventData->next = NULL; } diff --git a/yapp/popups2.cpp b/yapp/popups2.cpp index 2b7cdf1..53b45e9 100644 --- a/yapp/popups2.cpp +++ b/yapp/popups2.cpp @@ -55,7 +55,7 @@ LIST_INTERFACE li; extern "C" BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { hInst = hModule; - //DisableThreadLibraryCalls(hInst); + DisableThreadLibraryCalls(hInst); return TRUE; } @@ -139,7 +139,9 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) { // before the version that we use to locate it on the page // (note that if the update URL and the version URL point to standard file listing entries, the backend xml // data will be used to check for updates rather than the actual web page - this is not true for beta urls) - update.szBetaUpdateURL = "http://www.scottellis.com.au/miranda_plugins/yapp.zip"; +#ifdef _WIN64 + update.szBetaUpdateURL = "http://www.scottellis.com.au/miranda_plugins/yapp_x64.zip"; +#endif update.szBetaVersionURL = "http://www.scottellis.com.au/miranda_plugins/ver_yapp.html"; update.pbBetaVersionPrefix = (BYTE *)"YAPP version "; @@ -148,6 +150,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) { CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update); } +#ifdef _UNICODE if(ServiceExists(MS_FONT_REGISTERW)) { font_id_firstlinew.cbSize = sizeof(FontIDW); @@ -219,7 +222,9 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) { hEventReloadFont = HookEvent(ME_FONT_RELOAD, ReloadFont); } - else if(ServiceExists(MS_FONT_REGISTER)) + else +#endif + if(ServiceExists(MS_FONT_REGISTER)) { font_id_firstline.cbSize = sizeof(FontID); font_id_firstline.flags = FIDF_ALLOWEFFECTS; @@ -329,13 +334,6 @@ extern "C" int POPUPS2_API Load(PLUGINLINK *link) { mir_getLI(&li); mir_getMMI(&mmi); - INITCOMMONCONTROLSEX icex; - - // Ensure that the common control DLL is loaded (for listview) - icex.dwSize = sizeof(INITCOMMONCONTROLSEX); - icex.dwICC = ICC_LISTVIEW_CLASSES; - InitCommonControlsEx(&icex); - InitMessagePump(); InitOptions(); InitNotify(); diff --git a/yapp/popups2.dsp b/yapp/popups2.dsp index 1cc1426..db8f286 100644 --- a/yapp/popups2.dsp +++ b/yapp/popups2.dsp @@ -97,11 +97,12 @@ LINK32=link.exe # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release_Unicode" # PROP Intermediate_Dir "Release_Unicode" -# PROP Ignore_Export_Lib 0 +# PROP Ignore_Export_Lib 1 # PROP Target_Dir "" # ADD BASE CPP /nologo /MD /W3 /GX /Zi /O1 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NO_GZIP" /D "PNG_NO_STDIO" /D "PNG_NO_CONSOLE_IO" /FD /c # SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MD /W3 /Zi /O1 /I "../../../include" /I "." /I "docs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "UNICODE" /D "_USRDLL" /D "POPUPS2_EXPORTS" /Yu"common.h" /FD /c +# ADD CPP /nologo /MD /W3 /O1 /I "../../../include" /I "." /I "docs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "UNICODE" /D "_USRDLL" /D "POPUPS2_EXPORTS" /FR /Yu"common.h" /FD /c +# SUBTRACT CPP /Z # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x419 /d "NDEBUG" @@ -112,8 +113,8 @@ BSC32=bscmake.exe LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /map /debug /machine:I386 /out:"../../bin/Release/Plugins/yapp.dll" /filealign:512 # SUBTRACT BASE LINK32 /pdb:none /incremental:yes -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib /nologo /dll /map /debug /machine:I386 /out:"../../bin/Release Unicode/Plugins/yapp.dll" /filealign:512 -# SUBTRACT LINK32 /pdb:none /incremental:yes +# ADD LINK32 unicows.lib kernel32.lib user32.lib gdi32.lib /nologo /dll /map /machine:I386 /nodefaultlib:"kernel32.lib user32.lib gdi32.lib" /out:"../../bin/Release Unicode/Plugins/yapp.dll" /filealign:512 +# SUBTRACT LINK32 /pdb:none /incremental:yes /debug !ELSEIF "$(CFG)" == "yapp - Win32 Debug Unicode" diff --git a/yapp/popups2_9.vcproj b/yapp/popups2_9.vcproj index 94543e6..baa1239 100644 --- a/yapp/popups2_9.vcproj +++ b/yapp/popups2_9.vcproj @@ -456,14 +456,9 @@ /> @@ -626,8 +618,8 @@ /> custom_col) SetTextColor(ps.hdc, pd->colorText); else SetTextColor(ps.hdc, colFirstLine); - DrawTextW(ps.hdc, pd->pwzTitle, (int)wcslen(pd->pwzTitle), &tr, DT_VCENTER | DT_LEFT | DT_END_ELLIPSIS | DT_SINGLELINE | DT_NOPREFIX); + TCHAR *title = mir_u2t(pd->pwzTitle); + DrawText(ps.hdc, title, (int)_tcslen(title), &tr, DT_VCENTER | DT_LEFT | DT_END_ELLIPSIS | DT_SINGLELINE | DT_NOPREFIX); + mir_free(title); // title underline RECT tur; @@ -501,8 +504,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa FillRect(ps.hdc, &tur, pwd->underlineBrush); // second line(s) - int len_second = (int)wcslen(pd->pwzText); - if(len_second) { + if(pd->pwzText[0]) { if(hFontSecondLine) SelectObject(ps.hdc, (HGDIOBJ)hFontSecondLine); if(!pwd->custom_col) SetTextColor(ps.hdc, colSecondLine); @@ -511,8 +513,10 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if(options.av_layout != PAV_NONE && options.time_layout == PT_WITHAV && pwd->time_height <= pwd->tb_height && !pwd->have_av) GetClientRect(hwnd, &r); + TCHAR *text = mir_u2t(pd->pwzText); tr.left = r.left + options.padding + options.text_indent; tr.right = r.right - options.padding; tr.top = tr.bottom + options.padding; tr.bottom = r.bottom - options.padding; - DrawTextW(ps.hdc, pd->pwzText, len_second, &tr, DT_NOPREFIX | DT_WORDBREAK | DT_EXTERNALLEADING | DT_TOP | DT_LEFT | DT_WORD_ELLIPSIS); + DrawText(ps.hdc, text, (int)_tcslen(text), &tr, DT_NOPREFIX | DT_WORDBREAK | DT_EXTERNALLEADING | DT_TOP | DT_LEFT | DT_WORD_ELLIPSIS); + mir_free(text); } EndPaint(hwnd, &ps); @@ -638,8 +642,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa } // text height - int len_second = (int)wcslen(pd->pwzText); - if(len_second) { + if (pd->pwzText[0]) { RECT r; r.left = r.top = 0; r.right = options.win_width - 2 * options.padding - options.text_indent; @@ -651,8 +654,10 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa r.right -= pwd->time_width + options.padding; if(hFontSecondLine) SelectObject(hdc, (HGDIOBJ)hFontSecondLine); - DrawTextW(hdc, pd->pwzText, len_second, &r, DT_CALCRECT | DT_NOPREFIX | DT_WORDBREAK | DT_EXTERNALLEADING | DT_TOP | DT_LEFT | DT_WORD_ELLIPSIS); + TCHAR *text = mir_u2t(pd->pwzText); + DrawText(hdc, text, (int)_tcslen(text), &r, DT_CALCRECT | DT_NOPREFIX | DT_WORDBREAK | DT_EXTERNALLEADING | DT_TOP | DT_LEFT | DT_WORD_ELLIPSIS); pwd->text_height = r.bottom; + mir_free(text); } ReleaseDC(hwnd, hdc); -- cgit v1.2.3