From 70e0c09fcffa5520d3cfdc4708c81248b135c796 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 1 Dec 2014 12:56:22 +0000 Subject: - more warning fixes; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@11191 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Popup/src/actions.cpp | 6 +- plugins/Popup/src/bitmap_funcs.cpp | 4 +- plugins/Popup/src/config.cpp | 32 ++-- plugins/Popup/src/def_settings.h | 12 +- plugins/Popup/src/effects.cpp | 1 - plugins/Popup/src/font.cpp | 9 +- plugins/Popup/src/history.cpp | 2 +- plugins/Popup/src/icons.cpp | 2 +- plugins/Popup/src/main.cpp | 193 +++++++++++------------ plugins/Popup/src/notifications.cpp | 6 +- plugins/Popup/src/opt_adv.cpp | 98 ++++++------ plugins/Popup/src/opt_class.cpp | 90 +++++------ plugins/Popup/src/opt_contacts.cpp | 8 +- plugins/Popup/src/opt_gen.cpp | 84 +++++----- plugins/Popup/src/opt_skins.cpp | 96 ++++++------ plugins/Popup/src/opttree.cpp | 12 +- plugins/Popup/src/popup_gdiplus.cpp | 34 ++--- plugins/Popup/src/popup_thread.cpp | 19 ++- plugins/Popup/src/popup_wnd2.cpp | 84 +++++----- plugins/Popup/src/services.cpp | 14 +- plugins/Popup/src/skin.cpp | 24 +-- plugins/Popup/src/version.h | 2 +- plugins/mTextControl/src/FormattedTextDraw.cpp | 204 +++++++++++-------------- plugins/mTextControl/src/FormattedTextDraw.h | 7 +- plugins/mTextControl/src/dataobject.cpp | 128 +++++++--------- plugins/mTextControl/src/enumformat.cpp | 78 ++++------ plugins/mTextControl/src/fancy_rtf.cpp | 132 +++++++--------- plugins/mTextControl/src/richeditutils.cpp | 42 +++-- plugins/mTextControl/src/services.cpp | 143 +++++++++-------- plugins/mTextControl/src/textusers.cpp | 26 ++-- 30 files changed, 758 insertions(+), 834 deletions(-) diff --git a/plugins/Popup/src/actions.cpp b/plugins/Popup/src/actions.cpp index 9bd52deea2..f92a72bfdf 100644 --- a/plugins/Popup/src/actions.cpp +++ b/plugins/Popup/src/actions.cpp @@ -44,7 +44,7 @@ void LoadActions() { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_CLOSE, 0), "General/Dismiss popup", 0}, { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_COPY, 0), "General/Copy to clipboard", 0}, - //remove popup action + // remove popup action #if defined(_DEBUG) { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_POPUP_ON, 0), "Popup Plus/Test action", PAF_ENABLED}, { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_CLOSE, 0), "Popup Plus/Second test action", 0}, @@ -246,7 +246,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM group.mask = LVGF_HEADER | LVGF_GROUPID; LPTSTR wszGroup = mir_a2t(szGroup); group.pszHeader = TranslateTS(wszGroup); - group.cchHeader = mir_tstrlen(wszGroup); + group.cchHeader = (int)mir_tstrlen(wszGroup); grpId = group.iGroupId = groups.getCount(); int grpId = ListView_InsertGroup(hwndList, -1, &group); mir_free(wszGroup); @@ -357,7 +357,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM db_set_b(NULL, "PopupActions", gActions[i]->lpzTitle, (gActions[i]->flags & PAF_ENABLED) ? 1 : 0); } - //overrideActions + // overrideActions db_set_dw(NULL, MODULNAME, "OverrideLeft", PopupOptions.overrideLeft); db_set_dw(NULL, MODULNAME, "OverrideMiddle", PopupOptions.overrideMiddle); db_set_dw(NULL, MODULNAME, "OverrideRight", PopupOptions.overrideRight); diff --git a/plugins/Popup/src/bitmap_funcs.cpp b/plugins/Popup/src/bitmap_funcs.cpp index fe3a281f32..ae34336679 100644 --- a/plugins/Popup/src/bitmap_funcs.cpp +++ b/plugins/Popup/src/bitmap_funcs.cpp @@ -596,10 +596,10 @@ void MyBitmap::DrawIcon(HICON hic, int x, int y, int w, int h) void MyBitmap::Draw_Text(TCHAR *str, int x, int y) { - SIZE sz; GetTextExtentPoint32(this->getDC(), str, mir_tstrlen(str), &sz); + SIZE sz; GetTextExtentPoint32(this->getDC(), str, (int)mir_tstrlen(str), &sz); RECT rc; SetRect(&rc, x, y, x + 10000, y + 10000); this->saveAlpha(x, y, sz.cx, sz.cy); - DrawText(this->getDC(), str, mir_tstrlen(str), &rc, DT_LEFT | DT_TOP | DT_SINGLELINE | DT_NOPREFIX); + DrawText(this->getDC(), str, (int)mir_tstrlen(str), &rc, DT_LEFT | DT_TOP | DT_SINGLELINE | DT_NOPREFIX); this->restoreAlpha(x, y, sz.cx, sz.cy); } diff --git a/plugins/Popup/src/config.cpp b/plugins/Popup/src/config.cpp index 33374c027f..c3f5a44151 100644 --- a/plugins/Popup/src/config.cpp +++ b/plugins/Popup/src/config.cpp @@ -23,10 +23,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "headers.h" -//===== General Plugin ===== +// ===== General Plugin ===== HINSTANCE hInst; HANDLE hMainThread; -//MNOTIFYLINK *notifyLink; //deprecatet +// MNOTIFYLINK *notifyLink; // deprecatet HANDLE hSemaphore; BOOL closing = FALSE; @@ -35,17 +35,17 @@ HANDLE folderId; BOOL gbPopupLoaded = FALSE; BOOL gbHppInstalled = FALSE; -//===== Brushes, Colours and Fonts ===== +// ===== Brushes, Colours and Fonts ===== HBITMAP hbmNoAvatar; -//===== Options ===== +// ===== Options ===== POPUPOPTIONS PopupOptions; -//SKINELEMENT *skin; -//SKINELEMENT *w_skin; -//SKINELEMENT *n_skin; +// SKINELEMENT *skin; +// SKINELEMENT *w_skin; +// SKINELEMENT *n_skin; -//===== Plugin information ===== +// ===== Plugin information ===== PLUGININFOEX pluginInfoEx = { @@ -58,23 +58,23 @@ PLUGININFOEX pluginInfoEx = __COPYRIGHT, __AUTHORWEB, UNICODE_AWARE, - // {26A9125D-7863-4E01-AF0E-D14EF95C5054} + // {26A9125D-7863-4E01-AF0E-D14EF95C5054} {0x26a9125d, 0x7863, 0x4e01, {0xaf, 0xe, 0xd1, 0x4e, 0xf9, 0x5c, 0x50, 0x54}} }; HRESULT (WINAPI *MyDwmEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurBehind); -//====== Common Vars ======================== +// ====== Common Vars ======================== -// common funcs +// common funcs void LoadOptions() { memset(&PopupOptions, 0, sizeof(PopupOptions)); #if defined(_DEBUG) PopupOptions.debug = db_get_b(NULL, MODULNAME, "debug", FALSE); #endif - //Load Popup Options + // Load Popup Options if (!OptionLoaded){ LoadOption_General(); LoadOption_Skins(); @@ -106,7 +106,7 @@ void PopupPreview() ppd.lptzText = lptzText1Eng; ppd.lchIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE); CallService(MS_POPUP_ADDPOPUP2, (WPARAM)&ppd, APF_NO_HISTORY); - if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME*2)/3); //Pause + if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME*2)/3); // Pause memset(&ppd, 0, sizeof(ppd)); ppd.cbSize = sizeof(ppd); @@ -117,13 +117,13 @@ void PopupPreview() ppd.hbmAvatar = hbmNoAvatar; CallService(MS_POPUP_ADDPOPUP2, (WPARAM)&ppd, APF_NO_HISTORY); - if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME*2)/3); //Pause + if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME*2)/3); // Pause PUShowMessageT(TranslateT("This is a notification message"), (DWORD)SM_NOTIFY|0x80000000); - if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME*2)/3); //Pause + if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME*2)/3); // Pause PUShowMessageT(TranslateT("This is a warning message"), (DWORD)SM_WARNING|0x80000000); - if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME*2)/3); //Pause + if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME*2)/3); // Pause PUShowMessageT(TranslateT("This is an error message"), (DWORD)SM_ERROR|0x80000000); } diff --git a/plugins/Popup/src/def_settings.h b/plugins/Popup/src/def_settings.h index 9d09e9f9ee..2bfc5d7cf1 100644 --- a/plugins/Popup/src/def_settings.h +++ b/plugins/Popup/src/def_settings.h @@ -28,7 +28,7 @@ enum STYLE_FC_BEVELED, STYLE_FC_FLAT, - //ranges: + // ranges: STYLE_FC_MIN = STYLE_FC_BEVELED, STYLE_FC_MAX = STYLE_FC_FLAT }; @@ -46,7 +46,7 @@ enum // STYLE_SZ_CLOCKW = 7, // STYLE_SZ_CLOCK = 2 + 3 + 4 * STYLE_SZ_CLOCKW + 2, - //Text and Name are style dependant. + // Text and Name are style dependant. STYLE_SZ_TEXTW_FLAT = 146, STYLE_SZ_NAMEW_FLAT = 101, STYLE_SZ_TEXTW_BEVELED = 125, @@ -66,7 +66,7 @@ enum POS_UPPERRIGHT, POS_CENTER, - //ranges + // ranges POS_MINVALUE = POS_UPPERLEFT, POS_MAXVALUE = POS_CENTER }; @@ -92,8 +92,8 @@ enum }; enum { - TIMER_TIMETOLIVE = 26378, //My Birthday, send me something 8) - TIMER_TESTCHANGE = 60477, //You know who you are. + TIMER_TIMETOLIVE = 26378, // My Birthday, send me something 8) + TIMER_TESTCHANGE = 60477, // You know who you are. ANIM_TIME = 250, FADE_TIME = (ANIM_TIME), @@ -105,7 +105,7 @@ enum UM_SETDLGITEMINT = 5674 }; -//Defaults: +// Defaults: enum { SETTING_BACKCOLOUR_DEFAULT = RGB(173,206,247), diff --git a/plugins/Popup/src/effects.cpp b/plugins/Popup/src/effects.cpp index 42fc307b16..1d1b329af9 100644 --- a/plugins/Popup/src/effects.cpp +++ b/plugins/Popup/src/effects.cpp @@ -74,7 +74,6 @@ public: virtual void destroy() { delete this; } }; -//template static int svcCreateEffect(WPARAM, LPARAM) { return (int)(new T); } static INT_PTR svcCreateEffect_MyTestEffect(WPARAM, LPARAM) { return (INT_PTR)(new MyTestEffect); } void PopupEfectsInitialize() diff --git a/plugins/Popup/src/font.cpp b/plugins/Popup/src/font.cpp index 4e821502c4..716472f9fd 100644 --- a/plugins/Popup/src/font.cpp +++ b/plugins/Popup/src/font.cpp @@ -46,27 +46,22 @@ void InitFonts() { mir_tstrncpy(fid.name, _T(PU_FNT_NAME_CLOCK), SIZEOF(fid.name)); mir_snprintf(fid.prefix, SIZEOF(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_CLOCK); - //fid.deffontsettings.style = DBFONTF_BOLD; - //fid.deffontsettings.colour = RGB(0, 0, 0); FontRegisterT(&fid); mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TEXT), SIZEOF(fid.name)); mir_snprintf(fid.prefix, SIZEOF(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_TEXT); - fid.deffontsettings.style = 0; - //fid.deffontsettings.colour = RGB(0, 0, 0); + fid.deffontsettings.style = 0; FontRegisterT(&fid); mir_tstrncpy(fid.name, _T(PU_FNT_NAME_ACTION), SIZEOF(fid.name)); mir_snprintf(fid.prefix, SIZEOF(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_ACTION); fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS; - //fid.deffontsettings.style = 0; fid.deffontsettings.colour = RGB(0, 0, 255); FontRegisterT(&fid); mir_tstrncpy(fid.name, _T(PU_FNT_NAME_HOVERED_ACTION), SIZEOF(fid.name)); mir_snprintf(fid.prefix, SIZEOF(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_HOVERED_ACTION); fid.deffontsettings.style = DBFONTF_UNDERLINE; - //fid.deffontsettings.colour = RGB(0, 0, 255); FontRegisterT(&fid); ColourIDT cid = {0}; @@ -131,7 +126,7 @@ void ReloadFonts() mir_tstrncpy(cid.name, PU_COL_AVAT_NAME, SIZEOF(cid.name)); fonts.clAvatarBorder = (COLORREF)CallService(MS_COLOUR_GETT, (WPARAM)&cid, (LPARAM)&lf); - //update class popupps(only temp at this point, must rework) + // update class popupps(only temp at this point, must rework) char setting[256]; for (int i = 0; i < gTreeData.getCount(); i++) { if (gTreeData[i]->typ == 2) { diff --git a/plugins/Popup/src/history.cpp b/plugins/Popup/src/history.cpp index b9c52023b1..edc3a66d0b 100644 --- a/plugins/Popup/src/history.cpp +++ b/plugins/Popup/src/history.cpp @@ -416,5 +416,5 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow); } } - return FALSE; //DefWindowProc(hwnd, msg, wParam, lParam); + return FALSE; // DefWindowProc(hwnd, msg, wParam, lParam); } diff --git a/plugins/Popup/src/icons.cpp b/plugins/Popup/src/icons.cpp index 8beaa5ef7f..5d9432a700 100644 --- a/plugins/Popup/src/icons.cpp +++ b/plugins/Popup/src/icons.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static IconItem iconList[] = { - //toolbar + // toolbar { LPGEN("Popups are enabled"), ICO_TB_POPUP_ON, IDI_POPUP }, { LPGEN("Popups are disabled"), ICO_TB_POPUP_OFF, IDI_NOPOPUP }, diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index 8272df4782..3680e6ee42 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -29,82 +29,72 @@ WORD SETTING_MAXIMUMWIDTH_MAX = GetSystemMetrics(SM_CXSCREEN); HANDLE hEventNotify; -//===== MessageBoxes ===== -//void MB(char*); //This one is for Debug purposes -//void Log(char*); //This one is used to notify the user -//void HigherLower(int, int); //Used for integer input boxes (out of bound values). -//void NotifyError(DWORD, char*, int, char*); //Used to notify an error giving some error codes to report. - -//===== Options ===== +//===== Options ========================================================================= static int OptionsInitialize(WPARAM,LPARAM); void UpgradeDb(); -//===== Initializations ===== +//===== Initializations ================================================================= static int OkToExit(WPARAM,LPARAM); bool OptionLoaded = false; int hLangpack = 0; -//===== Global variables ===== -//===== DLLs ===== -HMODULE hUserDll = 0; -HMODULE hMsimgDll = 0; -HMODULE hKernelDll = 0; -HMODULE hGdiDll = 0; -HMODULE hDwmapiDll = 0; +//===== Global variables ================================================================ +HMODULE hUserDll = 0; +HMODULE hMsimgDll = 0; +HMODULE hKernelDll = 0; +HMODULE hGdiDll = 0; +HMODULE hDwmapiDll = 0; -//===== User wnd class ===== GLOBAL_WND_CLASSES g_wndClass = {0}; -//===== MTextControl ==== -HANDLE htuText; -HANDLE htuTitle; +HANDLE htuText; +HANDLE htuTitle; -//===== Menu item ===== HGENMENU hMenuRoot; HGENMENU hMenuItem; HGENMENU hMenuItemHistory; -//===== Event Handles ===== -HANDLE hTTButton; +HANDLE hTTButton; + +//===== Options pages =================================================================== -//===== Options pages ===== static int OptionsInitialize(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { sizeof(odp) }; - odp.position = 100000000; + odp.position = 100000000; odp.groupPosition = 910000000; - odp.hInstance = hInst; - odp.flags = ODPF_BOLDGROUPS; - odp.pszTitle = MODULNAME_PLU; + odp.hInstance = hInst; + odp.flags = ODPF_BOLDGROUPS; + odp.pszTitle = MODULNAME_PLU; - odp.pszTab = LPGEN("General"); - odp.pfnDlgProc = DlgProcPopupGeneral; + odp.pszTab = LPGEN("General"); + odp.pfnDlgProc = DlgProcPopupGeneral; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_POPUP_GENERAL); Options_AddPage(wParam, &odp); - odp.pszTab = LPGEN("Classes"); - odp.pfnDlgProc = DlgProcOptsClasses; + odp.pszTab = LPGEN("Classes"); + odp.pfnDlgProc = DlgProcOptsClasses; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_NOTIFICATIONS); Options_AddPage(wParam, &odp); - odp.pszTab = LPGEN("Actions"); - odp.pfnDlgProc = DlgProcPopupActions; + odp.pszTab = LPGEN("Actions"); + odp.pfnDlgProc = DlgProcPopupActions; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ACTIONS); Options_AddPage(wParam, &odp); - odp.pszTab = LPGEN("Contacts"); - odp.pfnDlgProc = DlgProcContactOpts; + odp.pszTab = LPGEN("Contacts"); + odp.pfnDlgProc = DlgProcContactOpts; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CONTACTS); Options_AddPage(wParam, &odp); - odp.pszTab = LPGEN("Advanced"); - odp.pfnDlgProc = DlgProcPopupAdvOpts; + odp.pszTab = LPGEN("Advanced"); + odp.pfnDlgProc = DlgProcPopupAdvOpts; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_POPUP_ADVANCED); Options_AddPage(wParam, &odp); - odp.pszGroup = LPGEN("Skins"); - odp.pszTab = LPGEN(MODULNAME_PLU); - odp.pfnDlgProc = DlgProcPopSkinsOpts; + odp.pszGroup = LPGEN("Skins"); + odp.pszTab = LPGEN(MODULNAME_PLU); + odp.pfnDlgProc = DlgProcPopSkinsOpts; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SKIN2); Options_AddPage(wParam, &odp); return 0; @@ -121,12 +111,12 @@ static int IconsChanged(WPARAM, LPARAM) LoadActions(); CLISTMENUITEM mi = { sizeof(mi) }; - if (PopupOptions.ModuleIsEnabled == TRUE) { //The module is enabled. - //The action to do is "disable popups" (show disabled) and we must write "enable popup" in the new item. + if (PopupOptions.ModuleIsEnabled == TRUE) { // The module is enabled. + // The action to do is "disable popups" (show disabled) and we must write "enable popup" in the new item. mi.hIcon = IcoLib_GetIcon(ICO_POPUP_ON, 0); } - else { //The module is disabled. - //The action to do is enable popups (show enabled), then write "disable popup" in the new item. + else { // The module is disabled. + // The action to do is enable popups (show enabled), then write "disable popup" in the new item. mi.hIcon = IcoLib_GetIcon(ICO_POPUP_OFF, 0); } mi.flags = CMIM_ICON; @@ -156,21 +146,21 @@ static int TTBLoaded(WPARAM, LPARAM) return 0; } -//===== EnableDisableMenuCommand ===== +//===== EnableDisableMenuCommand ======================================================== INT_PTR svcEnableDisableMenuCommand(WPARAM, LPARAM) { CLISTMENUITEM mi = { sizeof(mi) }; if (PopupOptions.ModuleIsEnabled) { - //The module is enabled. - //The action to do is "disable popups" (show disabled) and we must write "enable popup" in the new item. + // The module is enabled. + // The action to do is "disable popups" (show disabled) and we must write "enable popup" in the new item. PopupOptions.ModuleIsEnabled = FALSE; db_set_b(NULL, "Popup", "ModuleIsEnabled", FALSE); mi.ptszName = LPGENT("Enable Popups"); mi.hIcon = IcoLib_GetIcon(ICO_POPUP_OFF,0); } else { - //The module is disabled. - //The action to do is enable popups (show enabled), then write "disable popup" in the new item. + // The module is disabled. + // The action to do is enable popups (show enabled), then write "disable popup" in the new item. PopupOptions.ModuleIsEnabled = TRUE; db_set_b(NULL, "Popup", "ModuleIsEnabled", TRUE); mi.ptszName = LPGENT("Disable Popups"); @@ -197,42 +187,40 @@ void InitMenuItems(void) { CLISTMENUITEM mi = { sizeof(mi) }; // support new genmenu style - mi.flags = CMIF_ROOTHANDLE|CMIF_TCHAR; - mi.hParentMenu = HGENMENU_ROOT; + mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.hParentMenu = HGENMENU_ROOT; // Build main menu - mi.position = -1000000000 /*1000001*/; - mi.ptszName = LPGENT(MODULNAME_PLU); - mi.hIcon = IcoLib_GetIcon(PopupOptions.ModuleIsEnabled ? ICO_POPUP_ON : ICO_POPUP_OFF ,0); - hMenuRoot = Menu_AddMainMenuItem(&mi); + mi.position = -1000000000 /*1000001*/; + mi.ptszName = LPGENT(MODULNAME_PLU); + mi.hIcon = IcoLib_GetIcon(PopupOptions.ModuleIsEnabled ? ICO_POPUP_ON : ICO_POPUP_OFF, 0); + hMenuRoot = Menu_AddMainMenuItem(&mi); // Add item to main menu - mi.hParentMenu = (HGENMENU)hMenuRoot; + mi.hParentMenu = (HGENMENU)hMenuRoot; CreateServiceFunction(MENUCOMMAND_SVC, svcEnableDisableMenuCommand); - mi.ptszName = PopupOptions.ModuleIsEnabled ? LPGENT("Disable Popups") : LPGENT("Enable Popups"); - mi.pszService = MENUCOMMAND_SVC; - hMenuItem = Menu_AddMainMenuItem(&mi); + mi.ptszName = PopupOptions.ModuleIsEnabled ? LPGENT("Disable Popups") : LPGENT("Enable Popups"); + mi.pszService = MENUCOMMAND_SVC; + hMenuItem = Menu_AddMainMenuItem(&mi); // Popup History CreateServiceFunction(MENUCOMMAND_HISTORY, svcShowHistory); - mi.position = 1000000000; - mi.popupPosition = 1999990000; - mi.ptszName = LPGENT("Popup History"); - mi.hIcon = IcoLib_GetIcon(ICO_HISTORY, 0); - mi.pszService = MENUCOMMAND_HISTORY; - hMenuItemHistory = Menu_AddMainMenuItem(&mi); - + mi.position = 1000000000; + mi.popupPosition = 1999990000; + mi.ptszName = LPGENT("Popup History"); + mi.hIcon = IcoLib_GetIcon(ICO_HISTORY, 0); + mi.pszService = MENUCOMMAND_HISTORY; + hMenuItemHistory = Menu_AddMainMenuItem(&mi); } -//===== GetStatus ===== +//===== GetStatus ======================================================================= INT_PTR GetStatus(WPARAM, LPARAM) { return PopupOptions.ModuleIsEnabled; } - -//register Hotkey +// register Hotkey void LoadHotkey() { HOTKEYDESC hk = { sizeof(hk) }; @@ -250,40 +238,42 @@ void LoadHotkey() Hotkey_Register(&hk); } -//menu -//Function which makes the initializations +// menu +// Function which makes the initializations static int ModulesLoaded(WPARAM,LPARAM) { - //check if History++ is installed + // check if History++ is installed gbHppInstalled = ServiceExists(MS_HPP_GETVERSION) && ServiceExists(MS_HPP_EG_WINDOW) && (CallService(MS_HPP_GETVERSION, 0, 0) >= PLUGIN_MAKE_VERSION(1,5,0,112)); - //check if MText plugin is installed + + // check if MText plugin is installed + mir_getMTI(&MText); if (MText.Register) { htuText = MText.Register("Popup Plus/Text", MTEXT_FANCY_DEFAULT); htuTitle = MText.Register("Popup Plus/Title",MTEXT_FANCY_DEFAULT); } else htuTitle = htuText = NULL; - //check if OptionLoaded + // check if OptionLoaded if (!OptionLoaded) LoadOptions(); - //Uninstalling purposes + // Uninstalling purposes if (ServiceExists("PluginSweeper/Add")) CallService("PluginSweeper/Add", (WPARAM)Translate(MODULNAME), (LPARAM)MODULNAME); - //load fonts / create hook + // load fonts / create hook InitFonts(); HookEvent(ME_FONT_RELOAD, FontsChanged); - //load actions and notifications + // load actions and notifications LoadActions(); LoadNotifications(); - //hook TopToolBar + // hook TopToolBar HookEvent(ME_TTB_MODULELOADED, TTBLoaded); - //Folder plugin support + // Folder plugin support folderId = FoldersRegisterCustomPathT(LPGEN("Skins"), LPGEN("Popup Plus"), MIRANDA_PATHT _T("\\Skins\\Popup")); - //load skin + // load skin skins.load(_T("dir")); const PopupSkin *skin; if (skin = skins.getSkin(PopupOptions.SkinPack)) { @@ -291,35 +281,35 @@ static int ModulesLoaded(WPARAM,LPARAM) PopupOptions.SkinPack = mir_tstrdup(skin->getName()); skin->loadOpts(); } - //init PopupEfects + // init PopupEfects PopupEfectsInitialize(); - //MessageAPI support + // MessageAPI support SrmmMenu_Load(); - //Hotkey + // Hotkey LoadHotkey(); gbPopupLoaded = TRUE; return 0; } -//=== DllMain ===== -//DLL entry point, Required to store the instance handle +//=== DllMain =========================================================================== +// DLL entry point, Required to store the instance handle BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { hInst = hinstDLL; return TRUE; } -//===== MirandaPluginInfo ===== -//Called by Miranda to get the information associated to this plugin. -//It only returns the PLUGININFOEX structure, without any test on the version -//@param mirandaVersion - The version of the application calling this function +//===== MirandaPluginInfo =============================================================== +// Called by Miranda to get the information associated to this plugin. +// It only returns the PLUGININFOEX structure, without any test on the version +// @param mirandaVersion - The version of the application calling this function MIRAPI PLUGININFOEX* MirandaPluginInfoEx(DWORD) { return &pluginInfoEx; } -//called before the app goes into shutdown routine to make sure everyone is happy to exit +// called before the app goes into shutdown routine to make sure everyone is happy to exit static int OkToExit(WPARAM, LPARAM) { closing = TRUE; @@ -334,14 +324,13 @@ static int OnShutdown(WPARAM, LPARAM) return 0; } -//===== Load ===== -//Initializes the services provided and the link to those needed -//Called when the plugin is loaded into Miranda +//===== Load ============================================================================ +// Initializes the services provided and the link to those needed +// Called when the plugin is loaded into Miranda MIRAPI int Load(void) { DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hMainThread, THREAD_SET_CONTEXT, FALSE, 0); - mir_getMTI(&MText); mir_getLP(&pluginInfoEx); CreateServiceFunction(MS_POPUP_GETSTATUS, GetStatus); @@ -353,7 +342,7 @@ MIRAPI int Load(void) #endif LoadGDIPlus(); - //Transparent and animation routines + // Transparent and animation routines hDwmapiDll = LoadLibrary(_T("dwmapi.dll")); MyDwmEnableBlurBehindWindow = 0; if (hDwmapiDll) @@ -363,7 +352,7 @@ MIRAPI int Load(void) LoadPopupThread(); if (!LoadPopupWnd2()) { MessageBox(0, TranslateT("Error: I could not register the Popup Window class.\r\nThe plugin will not operate."), _T(MODULNAME_LONG), MB_ICONSTOP | MB_OK); - return 0; //We couldn't register our Window Class, don't hook any event: the plugin will act as if it was disabled. + return 0; // We couldn't register our Window Class, don't hook any event: the plugin will act as if it was disabled. } RegisterOptPrevBox(); @@ -380,7 +369,7 @@ MIRAPI int Load(void) if (!OptionLoaded) LoadOptions(); - //Service Functions + // Service Functions hEventNotify = CreateHookableEvent(ME_POPUP_FILTER); CreateServiceFunction(MS_POPUP_ADDPOPUP, Popup_AddPopup); @@ -410,18 +399,18 @@ MIRAPI int Load(void) CreateServiceFunction(MS_POPUP_UNREGISTERCLASS, Popup_UnregisterPopupClass); CreateServiceFunction(MS_POPUP_ADDPOPUPCLASS, Popup_CreateClassPopup); - //load icons / create hook + // load icons / create hook InitIcons(); HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged); - //add menu items + // add menu items InitMenuItems(); return 0; } -//===== Unload ===== -//Prepare the plugin to stop -//Called by Miranda when it will exit or when the plugin gets deselected +//===== Unload ========================================================================== +// Prepare the plugin to stop +// Called by Miranda when it will exit or when the plugin gets deselected MIRAPI int Unload(void) { diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index 0008852e25..a789b56e56 100644 --- a/plugins/Popup/src/notifications.cpp +++ b/plugins/Popup/src/notifications.cpp @@ -251,14 +251,14 @@ void FillNotificationData(POPUPDATA2 *ppd, DWORD *disableWhen) ppd->iSeconds = ptd->timeoutValue; *disableWhen = ptd->enabled ? ptd->disableWhen : 0xFFFFFFFF; - LOGFONTA lf; //dummy to make FS happy (use LOGFONTA coz we use MS_FONT_GET) - FontID fontid = {0}; //use ansi version of fontID coz POPUPNOTIFICATION use char + LOGFONTA lf; // dummy to make FS happy (use LOGFONTA coz we use MS_FONT_GET) + FontID fontid = {0}; // use ansi version of fontID coz POPUPNOTIFICATION use char fontid.cbSize = sizeof(fontid); mir_snprintf(fontid.group, SIZEOF(fontid.group), PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup); mir_snprintf(fontid.name, SIZEOF(fontid.name), "%s (colors only)", ptd->notification.lpzName); ppd->colorText = (COLORREF)CallService(MS_FONT_GET, (WPARAM)&fontid, (LPARAM)&lf); - ColourID colourid = {0}; //use ansi version of ColourID coz POPUPNOTIFICATION use char + ColourID colourid = {0}; // use ansi version of ColourID coz POPUPNOTIFICATION use char colourid.cbSize = sizeof(colourid); mir_snprintf(colourid.group, SIZEOF(colourid.group), PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup); mir_snprintf(colourid.name, SIZEOF(colourid.name), "%s (colors only)", ptd->notification.lpzName); diff --git a/plugins/Popup/src/opt_adv.cpp b/plugins/Popup/src/opt_adv.cpp index 40728b454f..1b9adc6327 100644 --- a/plugins/Popup/src/opt_adv.cpp +++ b/plugins/Popup/src/opt_adv.cpp @@ -28,7 +28,7 @@ HWND hwndBox = NULL; LRESULT CALLBACK AvatarTrackBarWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK AlphaTrackBarWndProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -//effekt name for drop down box +// effekt name for drop down box LIST g_lstPopupVfx(5, _tcsicmp); void OptAdv_RegisterVfx(char *name) { @@ -42,66 +42,66 @@ void OptAdv_UnregisterVfx() g_lstPopupVfx.destroy(); } -//Main Dialog Proc +// Main Dialog Proc void LoadOption_AdvOpts() { - //History + // History PopupOptions.EnableHistory = db_get_b(NULL, MODULNAME, "EnableHistory", TRUE); PopupOptions.HistorySize = db_get_w(NULL, MODULNAME, "HistorySize", SETTING_HISTORYSIZE_DEFAULT); PopupOptions.UseHppHistoryLog = db_get_b(NULL, MODULNAME, "UseHppHistoryLog", TRUE); - //Avatars + // Avatars PopupOptions.avatarBorders = db_get_b(NULL, MODULNAME, "AvatarBorders", TRUE); PopupOptions.avatarPNGBorders = db_get_b(NULL, MODULNAME, "AvatarPNGBorders", FALSE); PopupOptions.avatarRadius = db_get_b(NULL, MODULNAME, "AvatarRadius", 2); PopupOptions.avatarSize = db_get_w(NULL, MODULNAME, "AvatarSize", SETTING_AVTSIZE_DEFAULT); PopupOptions.EnableAvatarUpdates = db_get_b(NULL, MODULNAME, "EnableAvatarUpdates", FALSE); - //Monitor + // Monitor PopupOptions.Monitor = db_get_b(NULL, MODULNAME, "Monitor", SETTING_MONITOR_DEFAULT); - //Transparency + // Transparency PopupOptions.UseTransparency = db_get_b(NULL, MODULNAME, "UseTransparency", TRUE); PopupOptions.Alpha = db_get_b(NULL, MODULNAME, "Alpha", SETTING_ALPHA_DEFAULT); PopupOptions.OpaqueOnHover = db_get_b(NULL, MODULNAME, "OpaqueOnHover", TRUE); - //Effects + // Effects PopupOptions.UseAnimations = db_get_b(NULL, MODULNAME, "UseAnimations", TRUE); PopupOptions.UseEffect = db_get_b(NULL, MODULNAME, "Fade", TRUE); PopupOptions.Effect = (LPTSTR)DBGetContactSettingStringX(NULL, MODULNAME, "Effect", "", DBVT_TCHAR); PopupOptions.FadeIn = db_get_dw(NULL, MODULNAME, "FadeInTime", SETTING_FADEINTIME_DEFAULT); PopupOptions.FadeOut = db_get_dw(NULL, MODULNAME, "FadeOutTime", SETTING_FADEOUTTIME_DEFAULT); - //other old stuff + // other old stuff PopupOptions.MaxPopups = db_get_w(NULL, MODULNAME, "MaxPopups", 20); } INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { TCHAR tstr[64]; - static bool bDlgInit = false; //some controls send WM_COMMAND before or during WM_INITDIALOG + static bool bDlgInit = false; // some controls send WM_COMMAND before or during WM_INITDIALOG UINT idCtrl; switch (msg) { case WM_INITDIALOG: - //Create preview box: + // Create preview box: { hwndBox = CreateWindowEx( - WS_EX_TOOLWINDOW|WS_EX_TOPMOST, // dwStyleEx - _T(BOXPREVIEW_WNDCLASS), // Class name - NULL, // Title - DS_SETFONT|DS_FIXEDSYS|WS_POPUP, // dwStyle - CW_USEDEFAULT, // x - CW_USEDEFAULT, // y - CW_USEDEFAULT, // Width - CW_USEDEFAULT, // Height - HWND_DESKTOP, // Parent - NULL, // menu handle - hInst, // Instance + WS_EX_TOOLWINDOW|WS_EX_TOPMOST, // dwStyleEx + _T(BOXPREVIEW_WNDCLASS), // Class name + NULL, // Title + DS_SETFONT|DS_FIXEDSYS|WS_POPUP, // dwStyle + CW_USEDEFAULT, // x + CW_USEDEFAULT, // y + CW_USEDEFAULT, // Width + CW_USEDEFAULT, // Height + HWND_DESKTOP, // Parent + NULL, // menu handle + hInst, // Instance (LPVOID)0); ShowWindow(hwndBox, SW_HIDE); } - //Group: History + // Group: History { CheckDlgButton(hwnd, IDC_ENABLE_HISTORY, PopupOptions.EnableHistory); SetDlgItemInt(hwnd, IDC_HISTORYSIZE, PopupOptions.HistorySize, FALSE); @@ -121,16 +121,16 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM EnableWindow(GetDlgItem(hwnd, IDC_SHOWHISTORY), PopupOptions.EnableHistory); EnableWindow(GetDlgItem(hwnd, IDC_HPPLOG), PopupOptions.EnableHistory && gbHppInstalled); } - //Group: Avatars + // Group: Avatars { - //Borders + // Borders CheckDlgButton(hwnd, IDC_AVT_BORDER, PopupOptions.avatarBorders); CheckDlgButton(hwnd, IDC_AVT_PNGBORDER, PopupOptions.avatarPNGBorders); EnableWindow(GetDlgItem(hwnd, IDC_AVT_PNGBORDER), PopupOptions.avatarBorders); - //Radius + // Radius SetDlgItemInt(hwnd, IDC_AVT_RADIUS, PopupOptions.avatarRadius, FALSE); SendDlgItemMessage(hwnd, IDC_AVT_RADIUS_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG((PopupOptions.avatarSize / 2), 0)); - //Size + // Size mir_subclassWindow(GetDlgItem(hwnd, IDC_AVT_SIZE_SLIDE), AvatarTrackBarWndProc); SendDlgItemMessage(hwnd, IDC_AVT_SIZE_SLIDE, TBM_SETRANGE, FALSE, @@ -138,10 +138,10 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM SendDlgItemMessage(hwnd, IDC_AVT_SIZE_SLIDE, TBM_SETPOS, TRUE, max(PopupOptions.avatarSize, SETTING_AVTSIZE_MIN)); SetDlgItemInt(hwnd, IDC_AVT_SIZE, PopupOptions.avatarSize, FALSE); - //Request avatars + // Request avatars CheckDlgButton(hwnd, IDC_AVT_REQUEST, PopupOptions.EnableAvatarUpdates); } - //Group: Monitor + // Group: Monitor { BOOL bMonitor = 0; @@ -154,9 +154,9 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM EnableWindow(GetDlgItem(hwnd, IDC_MIRANDAWND), bMonitor); EnableWindow(GetDlgItem(hwnd, IDC_ACTIVEWND), bMonitor); } - //Group: Transparency + // Group: Transparency { - //win2k+ + // win2k+ CheckDlgButton(hwnd, IDC_TRANS, PopupOptions.UseTransparency); SendDlgItemMessage(hwnd, IDC_TRANS_SLIDER, TBM_SETRANGE, FALSE, MAKELONG(1, 255)); SendDlgItemMessage(hwnd, IDC_TRANS_SLIDER, TBM_SETPOS, TRUE, PopupOptions.Alpha); @@ -175,11 +175,11 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM } ShowWindow(GetDlgItem(hwnd, IDC_TRANS), SW_SHOW); } - //Group: Effects + // Group: Effects { - //Use Animations + // Use Animations CheckDlgButton(hwnd, IDC_USEANIMATIONS, PopupOptions.UseAnimations); - //Fade + // Fade SetDlgItemInt(hwnd, IDC_FADEIN, PopupOptions.FadeIn, FALSE); SetDlgItemInt(hwnd, IDC_FADEOUT, PopupOptions.FadeOut, FALSE); UDACCEL aAccels[] = {{0,50},{1,100},{3,500}}; @@ -197,7 +197,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT), how); EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT_SPIN), how); EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT_TXT2), how); - //effects drop down + // effects drop down { DWORD dwItem, dwActiveItem = 0; @@ -220,11 +220,11 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM } } - //later check stuff + // later check stuff SetDlgItemInt(hwnd, IDC_MAXPOPUPS, PopupOptions.MaxPopups, FALSE); SendDlgItemMessage(hwnd, IDC_MAXPOPUPS_SPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwnd, IDC_MAXPOPUPS), 0); SendDlgItemMessage(hwnd, IDC_MAXPOPUPS_SPIN, UDM_SETRANGE, 0, MAKELONG(999, 1)); - TranslateDialogDefault(hwnd); //do it on end of WM_INITDIALOG + TranslateDialogDefault(hwnd); // do it on end of WM_INITDIALOG bDlgInit = true; return TRUE; @@ -249,7 +249,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_COMMAND: idCtrl = LOWORD(wParam); switch (HIWORD(wParam)) { - case BN_CLICKED: //Button controls + case BN_CLICKED: // Button controls switch (idCtrl) { case IDC_ENABLE_HISTORY: PopupOptions.EnableHistory = !PopupOptions.EnableHistory; @@ -337,7 +337,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case CBN_SELCHANGE: - //lParam = Handle to the control + // lParam = Handle to the control switch (idCtrl) { case IDC_EFFECT: { @@ -361,9 +361,9 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM } break; - case EN_CHANGE: //Edit controls change + case EN_CHANGE: // Edit controls change if (!bDlgInit) break; - //lParam = Handle to the control + // lParam = Handle to the control switch (idCtrl) { case IDC_MAXPOPUPS: { @@ -413,8 +413,8 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM } break; - case EN_KILLFOCUS: //Edit controls lost fokus - //lParam = Handle to the control + case EN_KILLFOCUS: // Edit controls lost fokus + // lParam = Handle to the control switch (idCtrl) { case IDC_MAXPOPUPS: { @@ -423,7 +423,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM PopupOptions.MaxPopups = 20; if (maxPop != PopupOptions.MaxPopups) { SetDlgItemInt(hwnd, idCtrl, PopupOptions.MaxPopups, FALSE); - //ErrorMSG(1); + // ErrorMSG(1); SetFocus((HWND)lParam); } } @@ -494,31 +494,31 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return TRUE; case PSN_APPLY: - //History + // History db_set_b(NULL, MODULNAME, "EnableHistory", (BYTE)PopupOptions.EnableHistory); db_set_w(NULL, MODULNAME, "HistorySize", PopupOptions.HistorySize); PopupHistoryResize(); db_set_b(NULL, MODULNAME, "UseHppHistoryLog", PopupOptions.UseHppHistoryLog); - //Avatars + // Avatars db_set_b(NULL, MODULNAME, "AvatarBorders", PopupOptions.avatarBorders); db_set_b(NULL, MODULNAME, "AvatarPNGBorders", PopupOptions.avatarPNGBorders); db_set_b(NULL, MODULNAME, "AvatarRadius", PopupOptions.avatarRadius); db_set_w(NULL, MODULNAME, "AvatarSize", PopupOptions.avatarSize); db_set_b(NULL, MODULNAME, "EnableAvatarUpdates", PopupOptions.EnableAvatarUpdates); - //Monitor + // Monitor db_set_b(NULL, MODULNAME, "Monitor", PopupOptions.Monitor); - //Transparency + // Transparency db_set_b(NULL, MODULNAME, "UseTransparency", PopupOptions.UseTransparency); db_set_b(NULL, MODULNAME, "Alpha", PopupOptions.Alpha); db_set_b(NULL, MODULNAME, "OpaqueOnHover", PopupOptions.OpaqueOnHover); - //Effects + // Effects db_set_b(NULL, MODULNAME, "UseAnimations", PopupOptions.UseAnimations); db_set_b(NULL, MODULNAME, "Fade", PopupOptions.UseEffect); db_set_ts(NULL, MODULNAME, "Effect", PopupOptions.Effect); db_set_dw(NULL, MODULNAME, "FadeInTime", PopupOptions.FadeIn); db_set_dw(NULL, MODULNAME, "FadeOutTime", PopupOptions.FadeOut); - //other old stuff + // other old stuff db_set_w(NULL, MODULNAME, "MaxPopups", (BYTE)PopupOptions.MaxPopups); } return TRUE; diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp index 3410671606..a2f007d906 100644 --- a/plugins/Popup/src/opt_class.cpp +++ b/plugins/Popup/src/opt_class.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "headers.h" //--------------------------------------------------------------------------- -//Workaround for MS bug ComboBox_SelectItemData +// Workaround for MS bug ComboBox_SelectItemData int ComboBox_SelectItem(HWND hwndCtl, int indexStart, char* data) { int i=0; for ( i ; i < ComboBox_GetCount(hwndCtl); i++) { @@ -37,7 +37,7 @@ int ComboBox_SelectItem(HWND hwndCtl, int indexStart, char* data) { } //--------------------------------------------------------------------------- -//Dialog Proc +// Dialog Proc struct { UINT idCtrl; @@ -62,7 +62,7 @@ static ctrlsAll[] = { {IDC_TXT_RACTION ,0 ,1 ,1}, {IDC_RACTION ,0 ,1 ,1}, - {IDC_CHECKWINDOW ,0 ,0 ,0}, //may be delete ?? + {IDC_CHECKWINDOW ,0 ,0 ,0}, // may be delete ?? {IDC_TXT_TITLE3 ,0 ,1 ,0}, {IDC_SOFFLINE ,0 ,1 ,0}, @@ -174,26 +174,26 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case WM_INITDIALOG: TranslateDialogDefault( hwnd ); { - //Treeview + // Treeview HWND hwndTree = GetDlgItem(hwnd, IDC_TREE1); int iconIndex = 0; char iconName[MAXMODULELABELLENGTH]; TCHAR itemName[MAXMODULELABELLENGTH]; TreeView_DeleteAllItems(hwndTree); - //Treeview create image list + // Treeview create image list HIMAGELIST hImgLst = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR|ILC_COLOR32|ILC_MASK, 5, num_classes+1); ImageList_ReplaceIcon(hImgLst, -1, IcoLib_GetIcon(ICO_OPT_GROUP,0)); TreeView_SetImageList(hwndTree, hImgLst, TVSIL_NORMAL); for (i=0; i < gTreeData.getCount(); ++i) { switch (gTreeData[i]->typ) { - case 1: //Treeview part for typ 1 (notification) + case 1: // Treeview part for typ 1 (notification) mir_snprintf(iconName, SIZEOF(iconName), "%s_%S_%S", MODULNAME, gTreeData[i]->pszTreeRoot, gTreeData[i]->pszDescription); iconIndex = ImageList_ReplaceIcon(hImgLst, -1, IcoLib_GetIcon(iconName)); mir_sntprintf(itemName, SIZEOF(itemName), _T("%s/%s"), gTreeData[i]->pszTreeRoot, gTreeData[i]->pszDescription); break; - case 2: //Treeview part typ 2 (popup class api) + case 2: // Treeview part typ 2 (popup class api) iconIndex = ImageList_ReplaceIcon(hImgLst, -1, gTreeData[i]->pupClass.hIcon); mir_sntprintf(itemName, SIZEOF(itemName), _T("%s/%s"), LPGENT("CLASS Plugins")/*gTreeData[i]->pszTreeRoot*/, gTreeData[i]->pszDescription); break; @@ -202,7 +202,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l } OptTree_Translate(hwndTree); - //Bold Title + // Bold Title for (i = 0; i < SIZEOF(titleIds); ++i) { LOGFONT lf; GetObject((HFONT)SendDlgItemMessage(hwnd, titleIds[i], WM_GETFONT, 0, 0), sizeof(lf), &lf); @@ -210,10 +210,10 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l SendDlgItemMessage(hwnd, titleIds[i], WM_SETFONT, (WPARAM)CreateFontIndirect(&lf), TRUE); } - //spindown for Timeout + // spindown for Timeout SendDlgItemMessage(hwnd, IDC_TIMEOUT_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_LIFETIME_MAX, SETTING_LIFETIME_INFINITE)); SetDlgItemInt(hwnd,IDC_TIMEOUT, (UINT)0, TRUE); - //status buttons + // status buttons for (i = 0; i < SIZEOF(statusButtons); ++i) { SendDlgItemMessage(hwnd, statusButtons[i].idCtrl, BUTTONSETASFLATBTN, TRUE, 0); SendDlgItemMessage(hwnd, statusButtons[i].idCtrl, BUTTONSETASPUSHBTN, TRUE, 0); @@ -222,11 +222,11 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l SendDlgItemMessage(hwnd, statusButtons[i].idCtrl, BUTTONADDTOOLTIP, (WPARAM)Translate(statusButtons[i].title), 0); } - //info icon + // info icon SendDlgItemMessage(hwnd, IDC_ICO_INFO, STM_SETICON, (WPARAM)IcoLib_GetIcon(ICO_MISC_NOTIFY,0), 0); - //more button + // more button EnableWindow(GetDlgItem(hwnd, IDC_MORE), FALSE); - //preview button + // preview button ShowWindow(GetDlgItem(hwnd, IDC_CHECKWINDOW), SW_HIDE); SendMessage(hwnd, WM_USER, 0, 0); @@ -236,7 +236,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case WM_USER: { HWND hTV = GetDlgItem(hwnd, IDC_TREE1); - //get TreeView selection + // get TreeView selection TVITEM tvi = { 0 }; tvi.hItem = TreeView_GetSelection(hTV); tvi.mask = TVIF_PARAM|TVIF_HANDLE|TVIF_TEXT; @@ -247,33 +247,33 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l POPUPTREEDATA* ptd = (POPUPTREEDATA *)tvi.lParam; LPTSTR psztSelect = NULL; int index = 0; - //combo left action (default) + // combo left action (default) HWND hCtrl = GetDlgItem(hwnd, IDC_LACTION); ComboBox_ResetContent(hCtrl); ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT(POPUP_ACTION_DISMISS)),POPUP_ACTION_DISMISS); ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT(POPUP_ACTION_NOTHING)),POPUP_ACTION_NOTHING); - //combo right action (default) + // combo right action (default) hCtrl = GetDlgItem(hwnd, IDC_RACTION); ComboBox_ResetContent(hCtrl); ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT(POPUP_ACTION_DISMISS)),POPUP_ACTION_DISMISS); ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT(POPUP_ACTION_NOTHING)),POPUP_ACTION_NOTHING); - //element typ1 (Notification) + // element typ1 (Notification) if (ptd->typ == 1) { LPTSTR psztAction = NULL; - //Timeout + // Timeout SetDlgItemInt(hwnd,IDC_TIMEOUT, (UINT)ptd->timeoutValue, TRUE); SendDlgItemMessage(hwnd, IDC_TIMEOUT_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(250, -1)); - //combo left action (EXTRA) + // combo left action (EXTRA) hCtrl = GetDlgItem(hwnd, IDC_LACTION); for (i = 0; i < ptd->notification.actionCount; ++i) { psztAction = mir_a2t(ptd->notification.lpActions[i].lpzTitle); ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateTS(psztAction)),ptd->notification.lpActions[i].lpzTitle); mir_free(psztAction); psztAction = NULL; } - //combo right action (EXTRA) + // combo right action (EXTRA) hCtrl = GetDlgItem(hwnd, IDC_RACTION); psztAction = NULL; for (i = 0; i < ptd->notification.actionCount; ++i) { @@ -281,43 +281,43 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateTS(psztAction)),ptd->notification.lpActions[i].lpzTitle); mir_free(psztAction); psztAction = NULL; } - //enable all controls + // enable all controls for (i = 0; i < SIZEOF(ctrlsAll); ++i){ ShowWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp1 ? SW_SHOW : SW_HIDE); EnableWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp1); } - //enable or disable controls ctrlsEnable + // enable or disable controls ctrlsEnable for (i = 0; i < SIZEOF(ctrlsEnable); ++i) EnableWindow(GetDlgItem(hwnd, ctrlsEnable[i]), ptd->enabled ? TRUE : FALSE); - //show or hide controls ctrlsContact + // show or hide controls ctrlsContact for (i = 0; i < SIZEOF(ctrlsContact); ++i) ShowWindow(GetDlgItem(hwnd, ctrlsContact[i]), ptd->notification.dwFlags&PNF_CONTACT ? SW_SHOW : SW_HIDE); - //statusButtons state + // statusButtons state for (i = 0; i < SIZEOF(statusButtons); ++i) CheckDlgButton(hwnd, statusButtons[i].idCtrl, ptd->disableWhen & statusButtons[i].disableWhenFlag ? TRUE : FALSE); } - //element typ2 (CLASS Plugins) + // element typ2 (CLASS Plugins) else if (ptd->typ == 2) { - //Timeout + // Timeout SetDlgItemInt(hwnd,IDC_TIMEOUT, (UINT)ptd->timeoutValue, TRUE); SendDlgItemMessage(hwnd, IDC_TIMEOUT_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(250, -1)); - //enable ctrls + // enable ctrls for (i = 0; i < SIZEOF(ctrlsAll); ++i){ ShowWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp2 ? SW_SHOW : SW_HIDE); EnableWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp2); } } - //checkbox enable notify + // checkbox enable notify CheckDlgButton(hwnd, IDC_ENABLE, ptd->enabled ? TRUE : FALSE); - //combo left action (SELECT) + // combo left action (SELECT) hCtrl = GetDlgItem(hwnd, IDC_LACTION); - ComboBox_SelectItem (hCtrl, -1, ptd->leftAction); //use Workaround for MS bug ComboBox_SelectItemData - //combo right action (SELECT) + ComboBox_SelectItem (hCtrl, -1, ptd->leftAction); // use Workaround for MS bug ComboBox_SelectItemData + // combo right action (SELECT) hCtrl = GetDlgItem(hwnd, IDC_RACTION); - ComboBox_SelectItem (hCtrl, -1, ptd->rightAction); //use Workaround for MS bug ComboBox_SelectItemData - } //end if (tvi.lParam) + ComboBox_SelectItem (hCtrl, -1, ptd->rightAction); // use Workaround for MS bug ComboBox_SelectItemData + } // end if (tvi.lParam) else { - //enable / disable controls + // enable / disable controls for (int i=0; i < SIZEOF(ctrlsAll); ++i) { ShowWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp0 ? SW_SHOW : SW_HIDE); EnableWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp0); @@ -332,7 +332,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l POPUPTREEDATA* ptd = (POPUPTREEDATA *)GetWindowLongPtr(hwnd, GWLP_USERDATA); if (!ptd) break; switch (HIWORD(wParam)) { - case BN_CLICKED: //Button controls + case BN_CLICKED: // Button controls switch(idCtrl) { case IDC_ENABLE: ptd->enabled = (BYTE)Button_GetCheck((HWND)lParam); @@ -353,13 +353,13 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l ppd.colorText = ptd->colorText; POPUPTREEDATA *ptdPrev = NULL; if (ptd->typ == 1) { - //we work with a copy for preview + // we work with a copy for preview ptdPrev = (POPUPTREEDATA *)mir_alloc(sizeof(POPUPTREEDATA)); memcpy(ptdPrev, ptd, sizeof(POPUPTREEDATA)); ptdPrev->enabled = ptd->enabled; ptdPrev->timeoutValue = ptd->timeoutValue; - strcpy(ptdPrev->leftAction, ptd->leftAction); //geht noch nicht?? - strcpy(ptdPrev->rightAction, ptd->rightAction); //geht noch nicht?? + strcpy(ptdPrev->leftAction, ptd->leftAction); // geht noch nicht?? + strcpy(ptdPrev->rightAction, ptd->rightAction); // geht noch nicht?? ptdPrev->disableWhen = ptd->disableWhen; ppd.lchNotification = (HANDLE)ptdPrev; @@ -394,7 +394,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l } break; - case CBN_SELCHANGE: //ComboBox controls + case CBN_SELCHANGE: // ComboBox controls switch(idCtrl) { case IDC_LACTION: mir_strncpy(ptd->leftAction, @@ -411,7 +411,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l } break; - case EN_CHANGE: //Edit controls + case EN_CHANGE: // Edit controls switch(idCtrl) { case IDC_TIMEOUT: int seconds = GetDlgItemInt(hwnd, idCtrl, NULL, TRUE); @@ -422,7 +422,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l } break; - case EN_KILLFOCUS: //Edit controls lost fokus + case EN_KILLFOCUS: // Edit controls lost fokus switch(idCtrl) { case IDC_TIMEOUT: int seconds = GetDlgItemInt(hwnd, idCtrl, NULL, TRUE); @@ -450,7 +450,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case 1: LoadNotificationSettings(gTreeData[i], "PopupNotifications"); break; - case 2: //not finish + case 2: // not finish LoadClassSettings(gTreeData[i], PU_MODULCLASS); gTreeData[i]->timeoutValue = gTreeData[i]->pupClass.iSeconds; break; @@ -465,7 +465,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l gTreeData[i]->notification.iSeconds = gTreeData[i]->timeoutValue; SaveNotificationSettings(gTreeData[i],"PopupNotifications"); break; - case 2: //not finish + case 2: // not finish gTreeData[i]->pupClass.iSeconds = gTreeData[i]->timeoutValue; SaveClassSettings(gTreeData[i],"PopupCLASS"); break; @@ -507,12 +507,12 @@ void LoadClassSettings(POPUPTREEDATA *ptd, char* szModul) ptd->pupClass.iSeconds ? ptd->pupClass.iSeconds : PopupOptions.Seconds); mir_snprintf(setting, SIZEOF(setting), "%s/leftAction", ptd->pupClass.pszName); - szTmp = db_get_s(NULL, szModul, setting, POPUP_ACTION_NOTHING); //standart ?? + szTmp = db_get_s(NULL, szModul, setting, POPUP_ACTION_NOTHING); // standart ?? mir_strncpy(ptd->leftAction, szTmp, sizeof(ptd->leftAction)); mir_free(szTmp); szTmp = NULL; mir_snprintf(setting, SIZEOF(setting), "%s/rightAction", ptd->pupClass.pszName); - szTmp = db_get_s(NULL, szModul, setting, POPUP_ACTION_DISMISS); //standart ?? + szTmp = db_get_s(NULL, szModul, setting, POPUP_ACTION_DISMISS); // standart ?? mir_strncpy(ptd->rightAction, szTmp, sizeof(ptd->rightAction)); mir_free(szTmp); szTmp = NULL; diff --git a/plugins/Popup/src/opt_contacts.cpp b/plugins/Popup/src/opt_contacts.cpp index 6540d9e645..9bf3b9024b 100644 --- a/plugins/Popup/src/opt_contacts.cpp +++ b/plugins/Popup/src/opt_contacts.cpp @@ -34,8 +34,8 @@ static void sttSetAllContactIcons(HWND hwndList) HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0); DWORD dwMode = db_get_b(hContact, MODULNAME, "ShowMode", 0); for (int i = 0; i < 4 /*SIZEOF(sttIcons)*/; ++i) - //hIml element [0] = SKINICON_OTHER_SMALLDOT - //hIml element [1..5] = IcoLib_GetIcon(....) ~ old sttIcons + // hIml element [0] = SKINICON_OTHER_SMALLDOT + // hIml element [1..5] = IcoLib_GetIcon(....) ~ old sttIcons SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, (dwMode == i) ? i + 1 : 0)); } } @@ -87,8 +87,8 @@ INT_PTR CALLBACK DlgProcContactOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l int iImage = SendDlgItemMessage(hwnd,IDC_LIST,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(nm->iColumn,0)); if (iImage != EMPTY_EXTRA_ICON) { for (int i=0; i < 4 /*SIZEOF(sttIcons)*/; ++i) - //hIml element [0] = SKINICON_OTHER_SMALLDOT - //hIml element [1..5] = IcoLib_GetIcon(....) ~ old sttIcons + // hIml element [0] = SKINICON_OTHER_SMALLDOT + // hIml element [1..5] = IcoLib_GetIcon(....) ~ old sttIcons SendDlgItemMessage(hwnd, IDC_LIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, (i==nm->iColumn)?i+1:0)); } SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp index 5b39304862..78a4d160ba 100644 --- a/plugins/Popup/src/opt_gen.cpp +++ b/plugins/Popup/src/opt_gen.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. INT_PTR CALLBACK PositionBoxDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -//Helper for Status Tree +// Helper for Status Tree static int CountStatusModes(DWORD flags) { int res = 0; @@ -38,7 +38,7 @@ static int CountStatusModes(DWORD flags) if (flags & PF2_FREECHAT) ++res; if (flags & PF2_OUTTOLUNCH) ++res; if (flags & PF2_ONTHEPHONE) ++res; - if (res) ++res; // Offline + if (res) ++res; // Offline return res; } @@ -85,49 +85,49 @@ int AddStatusModes(OPTTREE_OPTION *options, int pos, LPTSTR prefix, DWORD flags) } -//Main Dialog Proc +// Main Dialog Proc void LoadOption_General() { - //Seconds + // Seconds PopupOptions.InfiniteDelay = db_get_b(NULL, MODULNAME, "InfiniteDelay", FALSE); PopupOptions.Seconds = DBGetContactSettingRangedWord(NULL, MODULNAME, "Seconds", SETTING_LIFETIME_DEFAULT, SETTING_LIFETIME_MIN, SETTING_LIFETIME_MAX); PopupOptions.LeaveHovered = db_get_b(NULL, MODULNAME, "LeaveHovered", TRUE); - //Dynamic Resize + // Dynamic Resize PopupOptions.DynamicResize = db_get_b(NULL, MODULNAME, "DynamicResize", FALSE); PopupOptions.UseMinimumWidth = db_get_b(NULL, MODULNAME, "UseMinimumWidth", TRUE); PopupOptions.MinimumWidth = db_get_w(NULL, MODULNAME, "MinimumWidth", 160); PopupOptions.UseMaximumWidth = db_get_b(NULL, MODULNAME, "UseMaximumWidth", TRUE); PopupOptions.MaximumWidth = db_get_w(NULL, MODULNAME, "MaximumWidth", 300); - //Position + // Position PopupOptions.Position = DBGetContactSettingRangedByte(NULL, MODULNAME, "Position", POS_LOWERRIGHT, POS_MINVALUE, POS_MAXVALUE); - //Configure popup area + // Configure popup area PopupOptions.gapTop = db_get_w(NULL, MODULNAME, "gapTop", 5); PopupOptions.gapBottom = db_get_w(NULL, MODULNAME, "gapBottom", 5); PopupOptions.gapLeft = db_get_w(NULL, MODULNAME, "gapLeft", 5); PopupOptions.gapRight = db_get_w(NULL, MODULNAME, "gapRight", 5); PopupOptions.spacing = db_get_w(NULL, MODULNAME, "spacing", 5); - //Spreading + // Spreading PopupOptions.Spreading = DBGetContactSettingRangedByte(NULL, MODULNAME, "Spreading", SPREADING_VERTICAL, SPREADING_MINVALUE, SPREADING_MAXVALUE); - //miscellaneous + // miscellaneous PopupOptions.ReorderPopups = db_get_b(NULL, MODULNAME, "ReorderPopups", TRUE); PopupOptions.ReorderPopupsWarning = db_get_b(NULL, MODULNAME, "ReorderPopupsWarning", TRUE); - //disable When + // disable When PopupOptions.ModuleIsEnabled = db_get_b(NULL, "Popup", "ModuleIsEnabled", TRUE); PopupOptions.DisableWhenFullscreen = db_get_b(NULL, MODULNAME, "DisableWhenFullscreen", TRUE); } INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - static bool bDlgInit = false; //some controls send WM_COMMAND before or during WM_INITDIALOG + static bool bDlgInit = false; // some controls send WM_COMMAND before or during WM_INITDIALOG static OPTTREE_OPTION *statusOptions = NULL; static int statusOptionsCount = 0; @@ -139,7 +139,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM switch (msg) { case WM_INITDIALOG: - //Seconds of delay + // Seconds of delay CheckDlgButton(hwnd, IDC_INFINITEDELAY, PopupOptions.InfiniteDelay); CheckDlgButton(hwnd, IDC_LEAVEHOVERED, PopupOptions.LeaveHovered); EnableWindow(GetDlgItem(hwnd, IDC_SECONDS), !PopupOptions.InfiniteDelay); @@ -149,26 +149,26 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM SetDlgItemInt(hwnd, IDC_SECONDS, PopupOptions.Seconds, FALSE); SendDlgItemMessage(hwnd, IDC_SECONDS_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_LIFETIME_MAX, SETTING_LIFETIME_MIN)); - //Dynamic Resize + // Dynamic Resize CheckDlgButton(hwnd, IDC_DYNAMICRESIZE, PopupOptions.DynamicResize); SetDlgItemText(hwnd, IDC_USEMAXIMUMWIDTH, PopupOptions.DynamicResize ? LPGENT("Maximum width") : LPGENT("Width")); - //Minimum Width + // Minimum Width CheckDlgButton(hwnd, IDC_USEMINIMUMWIDTH, PopupOptions.UseMinimumWidth); SendDlgItemMessage(hwnd, IDC_MINIMUMWIDTH_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_MAXIMUMWIDTH_MAX, SETTING_MINIMUMWIDTH_MIN)); SetDlgItemInt(hwnd, IDC_MINIMUMWIDTH, PopupOptions.MinimumWidth, FALSE); - //Maximum Width + // Maximum Width PopupOptions.UseMaximumWidth = PopupOptions.DynamicResize ? PopupOptions.UseMaximumWidth : TRUE; CheckDlgButton(hwnd, IDC_USEMAXIMUMWIDTH, PopupOptions.UseMaximumWidth); SendDlgItemMessage(hwnd, IDC_MAXIMUMWIDTH_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_MAXIMUMWIDTH_MAX, SETTING_MINIMUMWIDTH_MIN)); SetDlgItemInt(hwnd, IDC_MAXIMUMWIDTH, PopupOptions.MaximumWidth, FALSE); - //And finally let's enable/disable them. + // And finally let's enable/disable them. EnableWindow(GetDlgItem(hwnd, IDC_USEMINIMUMWIDTH), PopupOptions.DynamicResize); EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH), PopupOptions.DynamicResize && PopupOptions.UseMinimumWidth); EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH_SPIN), PopupOptions.DynamicResize && PopupOptions.UseMinimumWidth); EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH), PopupOptions.UseMaximumWidth); EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH_SPIN), PopupOptions.UseMaximumWidth); - //Position combobox. + // Position combobox. { HWND hCtrl = GetDlgItem(hwnd, IDC_WHERE); ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Upper left corner")), POS_UPPERLEFT); @@ -177,30 +177,30 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Upper right corner")), POS_UPPERRIGHT); SendDlgItemMessage(hwnd, IDC_WHERE, CB_SETCURSEL, PopupOptions.Position, 0); } - //Configure popup area + // Configure popup area { HWND hCtrl = GetDlgItem(hwnd, IDC_CUSTOMPOS); SendMessage(hCtrl, BUTTONSETASFLATBTN, TRUE, 0); SendMessage(hCtrl, BUTTONADDTOOLTIP, (WPARAM)_T("Popup area"), BATF_TCHAR); SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_OPT_RESIZE, 0)); } - //Spreading combobox + // Spreading combobox { HWND hCtrl = GetDlgItem(hwnd, IDC_LAYOUT); ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Horizontal")), SPREADING_HORIZONTAL); ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Vertical")), SPREADING_VERTICAL); SendDlgItemMessage(hwnd, IDC_LAYOUT, CB_SETCURSEL, PopupOptions.Spreading, 0); } - //miscellaneous + // miscellaneous CheckDlgButton(hwnd, IDC_REORDERPOPUPS, PopupOptions.ReorderPopups); - //Popup enabled + // Popup enabled CheckDlgButton(hwnd, IDC_POPUPENABLED, PopupOptions.ModuleIsEnabled ? BST_UNCHECKED : BST_CHECKED); CheckDlgButton(hwnd, IDC_DISABLEINFS, PopupOptions.DisableWhenFullscreen); EnableWindow(GetDlgItem(hwnd, IDC_DISABLEINFS), PopupOptions.ModuleIsEnabled); EnableWindow(GetDlgItem(hwnd, IDC_STATUSES), PopupOptions.ModuleIsEnabled); - //new status options + // new status options { int protocolCount = 0; PROTOACCOUNT **protocols; @@ -244,13 +244,13 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM OptTree_SetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, db_get_dw(NULL, MODULNAME, "Global Status", 0), LPGENT("Global Status")); } - TranslateDialogDefault(hwnd); //do it on end of WM_INITDIALOG + TranslateDialogDefault(hwnd); // do it on end of WM_INITDIALOG bDlgInit = true; return TRUE; case WM_COMMAND: switch (HIWORD(wParam)) { - case BN_CLICKED: //Button controls + case BN_CLICKED: // Button controls switch (LOWORD(wParam)) { case IDC_INFINITEDELAY: PopupOptions.InfiniteDelay = !PopupOptions.InfiniteDelay; @@ -291,7 +291,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDC_USEMAXIMUMWIDTH: PopupOptions.UseMaximumWidth = Button_GetCheck((HWND)lParam); - if (!PopupOptions.DynamicResize) { //ugly - set always on if DynamicResize = off + if (!PopupOptions.DynamicResize) { // ugly - set always on if DynamicResize = off CheckDlgButton(hwnd, LOWORD(wParam), BST_CHECKED); PopupOptions.UseMaximumWidth = TRUE; } @@ -357,9 +357,9 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM } break; - case CBN_SELCHANGE: //ComboBox controls + case CBN_SELCHANGE: // ComboBox controls switch (LOWORD(wParam)) { - //lParam = Handle to the control + // lParam = Handle to the control case IDC_WHERE: PopupOptions.Position = ComboBox_GetItemData((HWND)lParam, ComboBox_GetCurSel((HWND)lParam)); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); @@ -371,10 +371,10 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM } break; - case EN_CHANGE: //Edit controls change + case EN_CHANGE: // Edit controls change if (!bDlgInit) break; switch (LOWORD(wParam)) { - //lParam = Handle to the control + // lParam = Handle to the control case IDC_SECONDS: { int seconds = GetDlgItemInt(hwnd, LOWORD(wParam), NULL, FALSE); @@ -408,12 +408,12 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM } } break; - }//end switch(idCtrl) + }// end switch(idCtrl) break; - case EN_KILLFOCUS: //Edit controls lost fokus + case EN_KILLFOCUS: // Edit controls lost fokus switch (LOWORD(wParam)) { - //lParam = Handle to the control + // lParam = Handle to the control case IDC_SECONDS: { int seconds = GetDlgItemInt(hwnd, LOWORD(wParam), NULL, FALSE); @@ -480,38 +480,38 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return TRUE; case PSN_APPLY: - //Seconds + // Seconds db_set_b(NULL, MODULNAME, "InfiniteDelay", PopupOptions.InfiniteDelay); db_set_w(NULL, MODULNAME, "Seconds", (WORD)PopupOptions.Seconds); db_set_b(NULL, MODULNAME, "LeaveHovered", PopupOptions.LeaveHovered); - //Dynamic Resize + // Dynamic Resize db_set_b(NULL, MODULNAME, "DynamicResize", PopupOptions.DynamicResize); db_set_b(NULL, MODULNAME, "UseMinimumWidth", PopupOptions.UseMinimumWidth); db_set_w(NULL, MODULNAME, "MinimumWidth", PopupOptions.MinimumWidth); db_set_b(NULL, MODULNAME, "UseMaximumWidth", PopupOptions.UseMaximumWidth); db_set_w(NULL, MODULNAME, "MaximumWidth", PopupOptions.MaximumWidth); - //Position + // Position db_set_b(NULL, MODULNAME, "Position", (BYTE)PopupOptions.Position); - //Configure popup area + // Configure popup area db_set_w(NULL, MODULNAME, "gapTop", (WORD)PopupOptions.gapTop); db_set_w(NULL, MODULNAME, "gapBottom", (WORD)PopupOptions.gapBottom); db_set_w(NULL, MODULNAME, "gapLeft", (WORD)PopupOptions.gapLeft); db_set_w(NULL, MODULNAME, "gapRight", (WORD)PopupOptions.gapRight); db_set_w(NULL, MODULNAME, "spacing", (WORD)PopupOptions.spacing); - //Spreading + // Spreading db_set_b(NULL, MODULNAME, "Spreading", (BYTE)PopupOptions.Spreading); - //miscellaneous - Check_ReorderPopups(hwnd); //this save also PopupOptions.ReorderPopups + // miscellaneous + Check_ReorderPopups(hwnd); // this save also PopupOptions.ReorderPopups - //disable When + // disable When db_set_b(NULL, MODULNAME, "DisableWhenFullscreen", PopupOptions.DisableWhenFullscreen); - //new status options + // new status options { int protocolCount; PROTOACCOUNT **protocols; @@ -586,7 +586,7 @@ void Check_ReorderPopups(HWND hwnd) { switch (res) { case IDYES: PopupOptions.ReorderPopups = TRUE; - //Reset warning for next option change !!! + // Reset warning for next option change !!! PopupOptions.ReorderPopupsWarning = TRUE; break; case IDNO: diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp index c859e7f620..6fa00b6af1 100644 --- a/plugins/Popup/src/opt_skins.cpp +++ b/plugins/Popup/src/opt_skins.cpp @@ -40,7 +40,7 @@ void RegisterOptPrevBox() wcl.hInstance = hInst; wcl.hIcon = NULL; wcl.hCursor = LoadCursor(NULL, IDC_ARROW); - wcl.hbrBackground = NULL; //(HBRUSH)GetStockObject(LTGRAY_BRUSH); + wcl.hbrBackground = NULL; // (HBRUSH)GetStockObject(LTGRAY_BRUSH); wcl.lpszMenuName = NULL; wcl.lpszClassName = _T(BOXPREVIEW_WNDCLASS); wcl.hIconSm = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_POPUP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR); @@ -52,8 +52,8 @@ void RegisterOptPrevBox() MSGERROR(msg); } - // register custom class for dialog box with drop-shadow attribute - // "#32770" stays for class name of default system dialog box + // register custom class for dialog box with drop-shadow attribute + // "#32770" stays for class name of default system dialog box GetClassInfoEx(hInst, _T("#32770"), &wcl); wcl.hInstance = hInst; wcl.lpszClassName = _T("PopupPlusDlgBox"); @@ -189,9 +189,9 @@ int SkinOptionList_AddSkin(OPTTREE_OPTION* &options, int *OptionsCount, int pos options[pos].pszOptionName = (LPTSTR)mir_alloc(sizeof(TCHAR)*( mir_tstrlen(options[pos].pszSettingName)+ mir_strlen(skin->getFlagName(i)) +10 )); - wsprintf(options[pos].pszOptionName, _T("%s/%hs"), options[pos].pszSettingName, skin->getFlagName(i)); //!!!!!!!!!!!!! + wsprintf(options[pos].pszOptionName, _T("%s/%hs"), options[pos].pszSettingName, skin->getFlagName(i)); // !!!!!!!!!!!!! options[pos].bState = skin->getFlag(i) ? TRUE : FALSE; - options[pos].Data = i; //skin flag index + options[pos].Data = i; // skin flag index *dwGlobalOptions |= skin->getFlag(i) ? (1 << (i-1)) : 0; pos++; } @@ -199,7 +199,7 @@ int SkinOptionList_AddSkin(OPTTREE_OPTION* &options, int *OptionsCount, int pos return pos; } -///////////////////////////////////////////////////////////////////////////////////////// +// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // / static LPTSTR mainOption [] = { LPGENT("Show clock"), @@ -250,7 +250,7 @@ int SkinOptionList_AddMain(OPTTREE_OPTION* &options, int *OptionsCount, int pos, options[pos].pszOptionName = (LPTSTR)mir_alloc(sizeof(TCHAR)*( mir_tstrlen(options[pos].pszSettingName)+ mir_tstrlen(mainOption[i]) + 10)); - wsprintf(options[pos].pszOptionName, _T("%s/%s"), options[pos].pszSettingName, mainOption[i]); //!!!!!!!!!!!!! + wsprintf(options[pos].pszOptionName, _T("%s/%s"), options[pos].pszSettingName, mainOption[i]); // !!!!!!!!!!!!! options[pos].bState = bCheck; pos++; } @@ -269,23 +269,23 @@ bool SkinOptionList_Update (OPTTREE_OPTION* &options, int *OptionsCount, HWND hw options = NULL; *OptionsCount = 0; } - //add "Global options" + // add "Global options" DWORD dwGlobalOptions = 0; int pos = SkinOptionList_AddMain(options, OptionsCount, 0, &dwGlobalOptions); - //add "Skin options" + // add "Skin options" DWORD dwSkinOptions = 0; pos = SkinOptionList_AddSkin(options, OptionsCount, pos, &dwSkinOptions); - //generate treeview + // generate treeview int index = -1; OptTree_ProcessMessage(hwndDlg, WM_INITDIALOG, 0, 0, &index, IDC_SKIN_LIST_OPT, options, *OptionsCount); - //check "Skin options" state + // check "Skin options" state char prefix[128]; mir_snprintf(prefix, SIZEOF(prefix),"skin.%S", PopupOptions.SkinPack); OptTree_SetOptions(hwndDlg, IDC_SKIN_LIST_OPT, options, *OptionsCount, db_get_dw(NULL, MODULNAME, prefix, dwSkinOptions), _T("Skin options")); - //check "Global Settings" + // check "Global Settings" OptTree_SetOptions(hwndDlg, IDC_SKIN_LIST_OPT, options, *OptionsCount, dwGlobalOptions, _T("Global settings")); @@ -293,9 +293,9 @@ bool SkinOptionList_Update (OPTTREE_OPTION* &options, int *OptionsCount, HWND hw } void LoadOption_Skins() { - //skin pack + // skin pack PopupOptions.SkinPack = (LPTSTR)DBGetContactSettingStringX(NULL,MODULNAME, "SkinPack", "* Popup Classic",DBVT_TCHAR); - //more Skin options + // more Skin options PopupOptions.DisplayTime = db_get_b(NULL,MODULNAME, "DisplayTime", TRUE); PopupOptions.DropShadow = db_get_b(NULL,MODULNAME, "DropShadow", TRUE); PopupOptions.EnableFreeformShadows = db_get_b(NULL,MODULNAME, "EnableShadowRegion", 1); @@ -306,7 +306,7 @@ void LoadOption_Skins() { INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - static bool bDlgInit = false; //some controls send WM_COMMAND before or during WM_INITDIALOG + static bool bDlgInit = false; // some controls send WM_COMMAND before or during WM_INITDIALOG static HANDLE hhkFontsReload = 0; static OPTTREE_OPTION *skinOptions = NULL; static int skinOptionsCount = 0; @@ -354,7 +354,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR HWND hCtrl = NULL; DWORD dwIndex = 0; - //Skin List + // Skin List hCtrl = GetDlgItem(hwndDlg, IDC_SKINLIST); ListBox_ResetContent(hCtrl); LPTSTR Temp = NULL; @@ -365,19 +365,19 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } ListBox_SetCurSel(hCtrl, ListBox_FindString(hCtrl, 0, PopupOptions.SkinPack)); - //Skin List reload button + // Skin List reload button SendMessage(GetDlgItem(hwndDlg, IDC_BTN_RELOAD), BUTTONSETASFLATBTN, TRUE, 0); SendMessage(GetDlgItem(hwndDlg, IDC_BTN_RELOAD), BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_OPT_RELOAD,0)); SendMessage(GetDlgItem(hwndDlg, IDC_BTN_RELOAD), BUTTONADDTOOLTIP, (WPARAM)Translate("Refresh List"), 0); - //Skin Option List + // Skin Option List SkinOptionList_Update (skinOptions, &skinOptionsCount, hwndDlg); - //PreviewBox + // PreviewBox mir_subclassWindow(GetDlgItem(hwndDlg, IDC_PREVIEWBOX), WndProcPreviewBox); updatePreviewImage(GetDlgItem(hwndDlg, IDC_PREVIEWBOX)); - //hooks + // hooks hhkFontsReload = HookEventMessage(ME_FONT_RELOAD, hwndDlg, WM_USER); TranslateDialogDefault(hwndDlg); @@ -394,11 +394,11 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR HWND hCtrl = NULL; UINT idCtrl = LOWORD(wParam); switch (HIWORD(wParam)) { - case BN_KILLFOCUS: //Button controls - case BN_SETFOCUS: //Button controls + case BN_KILLFOCUS: // Button controls + case BN_SETFOCUS: // Button controls return TRUE; break; - case BN_CLICKED: //Button controls + case BN_CLICKED: // Button controls switch(idCtrl) { case IDC_PREVIEW: PopupPreview(); @@ -419,7 +419,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR ListBox_SetItemData(hCtrl, dwIndex, sl->name); } ListBox_SetCurSel(hCtrl, ListBox_FindString(hCtrl, 0, PopupOptions.SkinPack)); - //make shure we have select skin (ListBox_SetCurSel may be fail) + // make shure we have select skin (ListBox_SetCurSel may be fail) ListBox_GetText(hCtrl, ListBox_GetCurSel(hCtrl), &szNewSkin); if (mir_tstrcmp(pszOldSkin, szNewSkin) != 0) { mir_free(PopupOptions.SkinPack); @@ -429,25 +429,25 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR const PopupSkin *skin = 0; if (skin = skins.getSkin(PopupOptions.SkinPack)) { - //update Skin Option List from reload SkinPack + // update Skin Option List from reload SkinPack bDlgInit = false; bDlgInit = SkinOptionList_Update (skinOptions, &skinOptionsCount, hwndDlg); } SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - }//end IDC_BTN_RELOAD: + }// end IDC_BTN_RELOAD: break; case IDC_GETSKINS: - CallService(MS_UTILS_OPENURL,0,(LPARAM)"http://miranda-ng.org/addons/category/13"); + CallService(MS_UTILS_OPENURL,0,(LPARAM)"http:// miranda-ng.org/addons/category/13"); break; - }//end switch(idCtrl) + }// end switch(idCtrl) updatePreviewImage(GetDlgItem(hwndDlg, IDC_PREVIEWBOX)); break; - case CBN_SELCHANGE: //combo box controls + case CBN_SELCHANGE: // combo box controls switch(idCtrl) { case IDC_SKINLIST: { - //Skin list change + // Skin list change mir_free(PopupOptions.SkinPack); PopupOptions.SkinPack = mir_tstrdup((TCHAR *)SendDlgItemMessage( hwndDlg, @@ -460,7 +460,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR mir_free(PopupOptions.SkinPack); PopupOptions.SkinPack = mir_tstrdup(skin->getName()); - //update Skin Option List + // update Skin Option List bDlgInit = false; bDlgInit = SkinOptionList_Update (skinOptions, &skinOptionsCount, hwndDlg); } @@ -468,11 +468,11 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; - }//end switch(idCtrl) + }// end switch(idCtrl) break; - }//end switch (HIWORD(wParam)) + }// end switch (HIWORD(wParam)) break; - }// end WM_COMMAND + }// end WM_COMMAND return FALSE; case WM_NOTIFY: @@ -486,24 +486,24 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case PSN_APPLY: { - //skin pack + // skin pack db_set_ts(NULL, MODULNAME, "SkinPack", PopupOptions.SkinPack); - //skin options + // skin options const PopupSkin *skin = 0; if (skin = skins.getSkin(PopupOptions.SkinPack)) skin->saveOpts(); skins.freeAllButActive(); - //more Skin options + // more Skin options db_set_b(NULL, MODULNAME, "DisplayTime", PopupOptions.DisplayTime); db_set_b(NULL, MODULNAME, "DropShadow", PopupOptions.DropShadow); db_set_b(NULL, MODULNAME, "EnableShadowRegion", PopupOptions.EnableFreeformShadows); db_set_b(NULL, MODULNAME, "EnableAeroGlass", PopupOptions.EnableAeroGlass); db_set_b(NULL, MODULNAME, "UseMText", PopupOptions.UseMText); - }//end PSN_APPLY: + }// end PSN_APPLY: return TRUE; - }//switch (((LPNMHDR)lParam)->code) + }// switch (((LPNMHDR)lParam)->code) break; - }//end switch (((LPNMHDR)lParam)->idFrom) + }// end switch (((LPNMHDR)lParam)->idFrom) return FALSE; case WM_DESTROY: @@ -523,7 +523,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR skinOptionsCount = 0; } return TRUE; - }//end switch (msg) + }// end switch (msg) return FALSE; } @@ -533,7 +533,7 @@ static void BoxPreview_OnPaint(HWND hwnd, HDC mydc, int mode) switch (mode) { case 0: - { // Avatar + { // Avatar HDC hdcAvatar = CreateCompatibleDC(mydc); HBITMAP hbmSave = (HBITMAP)SelectObject(hdcAvatar, hbmNoAvatar); GetClientRect(hwnd, &rc); @@ -548,7 +548,7 @@ static void BoxPreview_OnPaint(HWND hwnd, HDC mydc, int mode) break; } case 1: - { // Opacity + { // Opacity HBRUSH hbr = CreateSolidBrush(fonts.clBack); HFONT hfnt = (HFONT)SelectObject(mydc, fonts.title); GetClientRect(hwnd, &rc); @@ -556,15 +556,15 @@ static void BoxPreview_OnPaint(HWND hwnd, HDC mydc, int mode) DrawIconEx(mydc, 10, (rc.bottom-rc.top-16)/2, IcoLib_GetIcon(ICO_POPUP_ON,0), 16, 16, 0, hbr, DI_NORMAL); SetBkMode(mydc, TRANSPARENT); GetClientRect(hwnd, &rc); - rc.left += 30; // 10+16+4 -- icon + rc.left += 30; // 10+16+4 -- icon rc.right -= (rc.right-rc.left)/3; rc.bottom -= (rc.bottom-rc.top)/3; - DrawText(mydc, _T(MODULNAME_LONG), mir_tstrlen(_T(MODULNAME_LONG)), &rc, DT_CENTER|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER); + DrawText(mydc, _T(MODULNAME_LONG), (int)mir_tstrlen(_T(MODULNAME_LONG)), &rc, DT_CENTER | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER); GetClientRect(hwnd, &rc); - rc.left += 30; // 10+16+4 -- icon + rc.left += 30; // 10+16+4 -- icon rc.left += (rc.right-rc.left)/3; rc.top += (rc.bottom-rc.top)/3; - DrawText(mydc, _T(MODULNAME_LONG), mir_tstrlen(_T(MODULNAME_LONG)), &rc, DT_CENTER|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER); + DrawText(mydc, _T(MODULNAME_LONG), (int)mir_tstrlen(_T(MODULNAME_LONG)), &rc, DT_CENTER | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER); GetClientRect(hwnd, &rc); FrameRect(mydc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH)); SelectObject(mydc, hfnt); @@ -573,7 +573,7 @@ static void BoxPreview_OnPaint(HWND hwnd, HDC mydc, int mode) break; case 2: - { // Position + { // Position HBRUSH hbr = CreateSolidBrush(GetSysColor(COLOR_WINDOW)); GetClientRect(hwnd, &rc); FillRect(mydc, &rc, hbr); diff --git a/plugins/Popup/src/opttree.cpp b/plugins/Popup/src/opttree.cpp index 515e13256e..dd85cc81d0 100644 --- a/plugins/Popup/src/opttree.cpp +++ b/plugins/Popup/src/opttree.cpp @@ -105,12 +105,12 @@ HTREEITEM OptTree_AddItem(HWND hwndTree, LPTSTR name, LPARAM lParam, int iconInd sectionName = itemName; while (sectionName) { - // allow multi-level tree + // allow multi-level tree TCHAR *pItemName = sectionName; HTREEITEM hItem; if (sectionName = _tcschr(sectionName, '/')) { - // one level deeper + // one level deeper *sectionName = 0; sectionName++; } @@ -121,7 +121,7 @@ HTREEITEM OptTree_AddItem(HWND hwndTree, LPTSTR name, LPARAM lParam, int iconInd TVINSERTSTRUCT tvis = {0}; tvis.hParent = hSection; - tvis.hInsertAfter = TVI_LAST;//TVI_SORT; + tvis.hInsertAfter = TVI_LAST;// TVI_SORT; tvis.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE; tvis.item.pszText = pItemName; tvis.item.state = tvis.item.stateMask = TVIS_EXPANDED; @@ -180,12 +180,12 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, i sectionName = itemName; while (sectionName) { - // allow multi-level tree + // allow multi-level tree TCHAR *pItemName = sectionName; HTREEITEM hItem; if (sectionName = _tcschr(sectionName, '/')) { - // one level deeper + // one level deeper *sectionName = 0; sectionName++; } @@ -196,7 +196,7 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, i TVINSERTSTRUCT tvis = {0}; tvis.hParent = hSection; - tvis.hInsertAfter = TVI_LAST;//TVI_SORT; + tvis.hInsertAfter = TVI_LAST;// TVI_SORT; tvis.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvis.item.pszText = pItemName; tvis.item.state = tvis.item.stateMask = TVIS_EXPANDED; diff --git a/plugins/Popup/src/popup_gdiplus.cpp b/plugins/Popup/src/popup_gdiplus.cpp index 9a4b4ed96f..c85f756c75 100644 --- a/plugins/Popup/src/popup_gdiplus.cpp +++ b/plugins/Popup/src/popup_gdiplus.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #undef Translate -// fix for old SDK and new GDI+ +// fix for old SDK and new GDI+ #define ULONG_PTR unsigned long #include "gdiplus.h" @@ -56,7 +56,7 @@ void UnloadGDIPlus() Gdiplus::GdiplusShutdown(g_gdiplusToken); } __except ( EXCEPTION_EXECUTE_HANDLER ) { - // do nothing + // do nothing } gbGdiPlusLoaded = true; g_gdiplusToken = 0; @@ -64,10 +64,10 @@ void UnloadGDIPlus() using namespace Gdiplus; -///////////////////////////////////////////////////////////////////////////////// -// GDIPlus_IsAnimatedGIF and GDIPlus_ExtractAnimatedGIF -// based on routine from http://www.codeproject.com/vcpp/gdiplus/imageexgdi.asp -// +// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // / +// GDIPlus_IsAnimatedGIF and GDIPlus_ExtractAnimatedGIF +// based on routine from http:// www.codeproject.com/vcpp/gdiplus/imageexgdi.asp +// HBITMAP SkinEngine_CreateDIB32(int cx, int cy) { @@ -78,11 +78,11 @@ HBITMAP SkinEngine_CreateDIB32(int cx, int cy) BITMAPINFO RGB32BitsBITMAPINFO; memset(&RGB32BitsBITMAPINFO, 0, sizeof(BITMAPINFO)); RGB32BitsBITMAPINFO.bmiHeader.biSize=sizeof(BITMAPINFOHEADER); - RGB32BitsBITMAPINFO.bmiHeader.biWidth=cx;//bm.bmWidth; - RGB32BitsBITMAPINFO.bmiHeader.biHeight=cy;//bm.bmHeight; + RGB32BitsBITMAPINFO.bmiHeader.biWidth=cx;// bm.bmWidth; + RGB32BitsBITMAPINFO.bmiHeader.biHeight=cy;// bm.bmHeight; RGB32BitsBITMAPINFO.bmiHeader.biPlanes=1; RGB32BitsBITMAPINFO.bmiHeader.biBitCount=32; - // pointer used for direct Bitmap pixels access + // pointer used for direct Bitmap pixels access UINT *ptPixels; @@ -107,10 +107,10 @@ BOOL GDIPlus_IsAnimatedGIF(TCHAR * szName) UINT count = image.GetFrameDimensionsCount(); GUID* pDimensionIDs = new GUID[count]; - // Get the list of frame dimensions from the Image object. + // Get the list of frame dimensions from the Image object. image.GetFrameDimensionsList(pDimensionIDs, count); - // Get the number of frames in the first dimension. + // Get the number of frames in the first dimension. nFrameCount = image.GetFrameCount(&pDimensionIDs[0]); delete []pDimensionIDs; @@ -137,17 +137,17 @@ void GDIPlus_ExtractAnimatedGIF(TCHAR * szName, int width, int height, HBITMAP * count = image.GetFrameDimensionsCount(); GUID* pDimensionIDs = new GUID[count]; - // Get the list of frame dimensions from the Image object. + // Get the list of frame dimensions from the Image object. image.GetFrameDimensionsList(pDimensionIDs, count); - // Get the number of frames in the first dimension. + // Get the number of frames in the first dimension. nFrameCount = image.GetFrameCount(&pDimensionIDs[0]); - // Assume that the image has a property item of type PropertyItemEquipMake. - // Get the size of that property item. + // Assume that the image has a property item of type PropertyItemEquipMake. + // Get the size of that property item. int nSize = image.GetPropertyItemSize(PropertyTagFrameDelay); - // Allocate a buffer to receive the property item. + // Allocate a buffer to receive the property item. pPropertyItem = (PropertyItem*) mir_alloc(nSize); image.GetPropertyItem(PropertyTagFrameDelay, nSize, pPropertyItem); @@ -175,7 +175,7 @@ void GDIPlus_ExtractAnimatedGIF(TCHAR * szName, int width, int height, HBITMAP * 0.0f, 0.0f, 0.0f, ((float)255)/255, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }; - //attr.SetColorMatrix(&ClrMatrix, ColorMatrixFlagsDefault,ColorAdjustTypeBitmap); + // attr.SetColorMatrix(&ClrMatrix, ColorMatrixFlagsDefault,ColorAdjustTypeBitmap); graphics.SetInterpolationMode(InterpolationModeHighQualityBicubic); int * delays=(int*)mir_alloc(nFrameCount*sizeof(int)); diff --git a/plugins/Popup/src/popup_thread.cpp b/plugins/Popup/src/popup_thread.cpp index 2c34d7e610..d4eec8539a 100644 --- a/plugins/Popup/src/popup_thread.cpp +++ b/plugins/Popup/src/popup_thread.cpp @@ -23,9 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "headers.h" #include -//#include -// globals +// globals static int gIdleRequests = 0; static bool gTerminating = false; static HWND gHwndManager = 0; @@ -35,10 +34,10 @@ static HANDLE hThread = 0; static LIST popupList(3); -// forwards +// forwards enum { - // message id's + // message id's UTM_PT_FIRST = WM_USER+1607, UTM_STOP_THREAD, UTM_ADD_WINDOW, @@ -62,15 +61,15 @@ bool UpdatePopupPosition(PopupWnd2 *prev, PopupWnd2 *wnd) if (prev) prevSize = prev->getSize(); - //we have only one monitor (cant check it together with 1.if) + // we have only one monitor (cant check it together with 1.if) RECT rc; if ( GetSystemMetrics(SM_CMONITORS) == 1) SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0); - else { //Multimonitor stuff (we have more then 1) + else { // Multimonitor stuff (we have more then 1) HWND hWnd; if (PopupOptions.Monitor == MN_MIRANDA) hWnd = (HWND)CallService(MS_CLUI_GETHWND,0,0); - else // PopupOptions.Monitor == MN_ACTIVE + else // PopupOptions.Monitor == MN_ACTIVE hWnd = GetForegroundWindow(); HMONITOR hMonitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY); @@ -202,10 +201,10 @@ static LRESULT CALLBACK PopupThreadManagerWndProc(HWND hwnd, UINT message, WPARA return DefWindowProc(hwnd, message, wParam, lParam); } -// thread func +// thread func static unsigned __stdcall PopupThread(void *arg) { - // Create manager window + // Create manager window DWORD err; WNDCLASSEX wcl; wcl.cbSize = sizeof(wcl); @@ -257,7 +256,7 @@ void StopPopupThread() void UnloadPopupThread() { - // We won't waint for thread to exit, Miranda's thread unsind mechanism will do that for us. + // We won't waint for thread to exit, Miranda's thread unsind mechanism will do that for us. WaitForSingleObject(hThread, INFINITE); CloseHandle(hThread); diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index e56281bd37..6eeef7e451 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -86,18 +86,18 @@ bool LoadPopupWnd2() if (!g_wndClass.cPopupEditBox) { TCHAR msg[2048]; mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to register custom edit box window class.\r\n\r\ncbSize: %i\r\nstyle: %p\r\nlpfnWndProc: %i\r\ncbClsExtra: %i\r\ncbWndExtra: %i\r\nhInstance: %i\r\nhIcon: %i\r\nhCursor: %i\r\nhbrBackground: %i\r\nlpszMenuName: %s\r\nlpszClassName: %s\r\nhIconSm: %i\r\n"), - wclw.cbSize, //UINT cbSize; - wclw.style, //UINT style; - wclw.lpfnWndProc, //WNDPROC lpfnWndProc; - wclw.cbClsExtra, //int cbClsExtra; - wclw.cbWndExtra, //int cbWndExtra; - wclw.hInstance, //HINSTANCE hInstance; - wclw.hIcon, //HICON hIcon; - wclw.hCursor, //HCURSOR hCursor; - wclw.hbrBackground, //HBRUSH hbrBackground; - wclw.lpszMenuName, //LPCWSTR lpszMenuName; - wclw.lpszClassName, //LPCWSTR lpszClassName; - wclw.hIconSm //HICON hIconSm; + wclw.cbSize, // UINT cbSize; + wclw.style, // UINT style; + wclw.lpfnWndProc, // WNDPROC lpfnWndProc; + wclw.cbClsExtra, // int cbClsExtra; + wclw.cbWndExtra, // int cbWndExtra; + wclw.hInstance, // HINSTANCE hInstance; + wclw.hIcon, // HICON hIcon; + wclw.hCursor, // HCURSOR hCursor; + wclw.hbrBackground, // HBRUSH hbrBackground; + wclw.lpszMenuName, // LPCWSTR lpszMenuName; + wclw.lpszClassName, // LPCWSTR lpszClassName; + wclw.hIconSm // HICON hIconSm; ); MSGERROR(msg); @@ -183,21 +183,21 @@ void PopupWnd2::startThread() void PopupWnd2::create() { m_hwnd = CreateWindowEx( - WS_EX_TRANSPARENT| // prevents unwanted clicks - WS_EX_TOOLWINDOW|WS_EX_TOPMOST, // dwStyleEx - _T(POPUP_WNDCLASS), // Class name - NULL, // Title - DS_SETFONT|DS_FIXEDSYS|WS_POPUP, // dwStyle - CW_USEDEFAULT, // x - CW_USEDEFAULT, // y - CW_USEDEFAULT, // Width - CW_USEDEFAULT, // Height - HWND_DESKTOP, // Parent - NULL, // menu handle - hInst, // Instance + WS_EX_TRANSPARENT| // prevents unwanted clicks + WS_EX_TOOLWINDOW|WS_EX_TOPMOST, // dwStyleEx + _T(POPUP_WNDCLASS), // Class name + NULL, // Title + DS_SETFONT|DS_FIXEDSYS|WS_POPUP, // dwStyle + CW_USEDEFAULT, // x + CW_USEDEFAULT, // y + CW_USEDEFAULT, // Width + CW_USEDEFAULT, // Height + HWND_DESKTOP, // Parent + NULL, // menu handle + hInst, // Instance (LPVOID)this); - // Shadows + // Shadows ULONG_PTR style = GetClassLongPtr(m_hwnd, GCL_STYLE); if (m_options->DropShadow && !(style & CS_DROPSHADOW)) style |= CS_DROPSHADOW; @@ -206,7 +206,7 @@ void PopupWnd2::create() SetClassLongPtr(m_hwnd, GCL_STYLE, style); - // tooltips + // tooltips m_hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, @@ -229,7 +229,7 @@ void PopupWnd2::updateLayered(BYTE opacity) BLENDFUNCTION blend; blend.BlendOp = AC_SRC_OVER; blend.BlendFlags = 0; - blend.SourceConstantAlpha = opacity; //m_options->UseTransparency ? opacity : 255; + blend.SourceConstantAlpha = opacity; // m_options->UseTransparency ? opacity : 255; blend.AlphaFormat = AC_SRC_ALPHA; UpdateLayeredWindow(m_hwnd, NULL, &ptDst, &m_sz, @@ -256,22 +256,22 @@ void PopupWnd2::update() const PopupSkin *skin = skins.getSkin(m_lpzSkin?m_lpzSkin:m_options->SkinPack); if (!skin) return; - // update avatar + // update avatar fixAvatar(); - // destroy content bitmap so animate() can reallocate it if needed + // destroy content bitmap so animate() can reallocate it if needed if (m_bmp) { delete m_bmp; m_bmp = NULL; } - // measure popup + // measure popup if (m_bmpBase) delete m_bmpBase; if (m_bmpAnimate) delete m_bmpAnimate; m_bmpBase = new MyBitmap(1,1); skin->measure(m_bmpBase->getDC(), this, m_options->UseMaximumWidth ? m_options->MaximumWidth : SETTING_MAXIMUMWIDTH_MAX, m_options); - // render popup + // render popup m_bmpBase->allocate(m_sz.cx, m_sz.cy); HDC hdc = m_bmpBase->getDC(); if (!skin) return; @@ -282,7 +282,7 @@ void PopupWnd2::update() { SetTextColor(hdc, m_clClock); HFONT hfnSave = (HFONT)SelectObject(m_bmpBase->getDC(), fonts.clock); - SIZE sz; GetTextExtentPoint32(m_bmpBase->getDC(), m_time, mir_tstrlen(m_time), &sz); + SIZE sz; GetTextExtentPoint32(m_bmpBase->getDC(), m_time, (int)mir_tstrlen(m_time), &sz); m_bmpBase->Draw_Text(m_time, this->m_sz.cx - sz.cx - STYLE_SZ_GAP - skin->getRightGap(), STYLE_SZ_GAP); SelectObject(m_bmpBase->getDC(), hfnSave); } @@ -310,7 +310,7 @@ void PopupWnd2::animate() m_bmpBase = NULL; } - // update layered window if supported + // update layered window if supported updateLayered((m_options->UseTransparency && !(m_bIsHovered && m_options->OpaqueOnHover)) ? m_options->Alpha : 255); if (m_bReshapeWindow) @@ -330,7 +330,7 @@ void PopupWnd2::animate() DeleteObject(bb.hRgnBlur); } - // update tooltips + // update tooltips for (int i=0; i < m_actionCount; ++i) { char *title = strchr(m_actions[i].actionA.lpzTitle, '/'); if (title) title++; @@ -338,8 +338,8 @@ void PopupWnd2::animate() AddTooltipTranslated(m_hwndToolTip, m_hwnd, i, m_actions[i].rc, title); } -// if (!customPopup && hwnd /*&& IsWindowVisible(hwnd)*/) -// PopupThreadUpdateWindow(this); +// if (!customPopup && hwnd /*&& IsWindowVisible(hwnd)*/) +// PopupThreadUpdateWindow(this); } } @@ -436,7 +436,7 @@ void PopupWnd2::show() m_bSlide = m_bFade = false; updateLayered((m_options->UseTransparency && !(m_bIsHovered && m_options->OpaqueOnHover)) ? m_options->Alpha : 255); - //updateLayered(m_options->UseTransparency ? m_options->Alpha : 255); + // updateLayered(m_options->UseTransparency ? m_options->Alpha : 255); SetWindowPos(m_hwnd, 0, m_pos.x, m_pos.y, 0, 0, SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE|SWP_DEFERERASE|SWP_NOSENDCHANGING|SWP_SHOWWINDOW); } @@ -867,7 +867,7 @@ BOOL IsUtfSendAvailable(MCONTACT hContact) { char* szProto = GetContactProto(hContact); if (szProto == NULL) return FALSE; - //check for MetaContact and get szProto from subcontact + // check for MetaContact and get szProto from subcontact if (!strcmp(szProto, META_PROTO)) { MCONTACT hSubContact = db_mc_getDefault(hContact); if (!hSubContact) @@ -886,9 +886,9 @@ void AddMessageToDB(MCONTACT hContact, char *msg, int flag/*bool utf*/) dbei.szModule = GetContactProto(hContact); dbei.timestamp = time(NULL); if ( !((flag & PREF_UTF) == PREF_UTF) && (flag & PREF_UNICODE) == PREF_UNICODE) - dbei.cbBlob = (mir_tstrlen((LPTSTR)msg) + 1)*sizeof(TCHAR); + dbei.cbBlob = ((int)mir_tstrlen((LPTSTR)msg) + 1)*sizeof(TCHAR); else - dbei.cbBlob = mir_strlen(msg) + 1; + dbei.cbBlob = (int)mir_strlen(msg) + 1; dbei.pBlob = (PBYTE)msg; db_event_add(hContact, &dbei); } @@ -1005,8 +1005,8 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara case ACT_DEF_REPLY: { if (!m_customPopup) PopupThreadLock(); - //RECT rc = renderInfo.textRect; - //MapWindowPoints(hwnd, NULL, (LPPOINT)&rc, 2); + // RECT rc = renderInfo.textRect; + // MapWindowPoints(hwnd, NULL, (LPPOINT)&rc, 2); RECT rc; GetWindowRect(m_hwnd, &rc); HWND hwndEditBox = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp index 6c2fd14c6d..d1a71e5752 100644 --- a/plugins/Popup/src/services.cpp +++ b/plugins/Popup/src/services.cpp @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "headers.h" -int num_classes = 0; //for core class api support +int num_classes = 0; // for core class api support //===== Popup/AddPopup INT_PTR Popup_AddPopup(WPARAM wParam, LPARAM lParam) @@ -260,7 +260,7 @@ INT_PTR Popup_ShowMessageW(WPARAM wParam, LPARAM lParam) ppd2.lchNotification = g_hntfNotification; ppd2.lptzTitle = TranslateT("Notify"); break; - default: //No no no... you must give me a good value. + default: // No no no... you must give me a good value. return -1; } return Popup_AddPopup2((WPARAM)&ppd2, (LPARAM)((lParam & 0x80000000)?APF_NO_HISTORY:0)); @@ -285,14 +285,14 @@ INT_PTR Popup_Query(WPARAM wParam, LPARAM) switch (wParam) { case PUQS_ENABLEPOPUPS: { - if (PopupOptions.ModuleIsEnabled) return 1; //They're already ON!!! - else { //Module was disabled. + if (PopupOptions.ModuleIsEnabled) return 1; // They're already ON!!! + else { // Module was disabled. svcEnableDisableMenuCommand(0,0); return 0; } } case PUQS_DISABLEPOPUPS: { - if (!(PopupOptions.ModuleIsEnabled)) return 1; //They're already OFF!!! + if (!(PopupOptions.ModuleIsEnabled)) return 1; // They're already OFF!!! else { svcEnableDisableMenuCommand(0,0); return 0; @@ -376,7 +376,7 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam) } LoadClassSettings(ptd, PU_MODULCLASS); - //we ignore pc->colorText and use fonts.text as default (if no setting found in DB) + // we ignore pc->colorText and use fonts.text as default (if no setting found in DB) mir_snprintf(setting, 256, "%s/TextCol", ptd->pupClass.pszName); ptd->pupClass.colorText = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, fonts.clText/*pc->colorText*/); FontIDT fid = {0}; @@ -394,7 +394,7 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam) fid.deffontsettings.colour = fonts.clText; FontRegisterT(&fid); - //we ignore pc->colorBack and use fonts.clBack as default (if no setting found in DB) + // we ignore pc->colorBack and use fonts.clBack as default (if no setting found in DB) mir_snprintf(setting, 256, "%s/BgCol", ptd->pupClass.pszName); ptd->pupClass.colorBack = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/); ColourIDT cid = {0}; diff --git a/plugins/Popup/src/skin.cpp b/plugins/Popup/src/skin.cpp index d9010f4af4..40526579e9 100644 --- a/plugins/Popup/src/skin.cpp +++ b/plugins/Popup/src/skin.cpp @@ -63,7 +63,7 @@ SIZE PopupSkin::measureAction(HDC hdc, POPUPACTION *act) const SIZE szText, szSpace; LPTSTR wname = mir_a2t(name); TCHAR *str = TranslateTS(wname); - GetTextExtentPoint32(hdc, str, mir_tstrlen(str), &szText); + GetTextExtentPoint32(hdc, str, (int)mir_tstrlen(str), &szText); mir_free(wname); GetTextExtentPoint32(hdc, _T(" "), 1, &szSpace); @@ -126,7 +126,7 @@ void PopupSkin::drawAction(MyBitmap *bmp, POPUPACTION *act, int x, int y, bool h LPTSTR wname = mir_a2t(name); TCHAR *str = TranslateTS(wname); - GetTextExtentPoint32(bmp->getDC(), str, mir_tstrlen(str), &szText); + GetTextExtentPoint32(bmp->getDC(), str, (int)mir_tstrlen(str), &szText); bmp->Draw_Text(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)); @@ -180,7 +180,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options if ((head->type & ST_TYPEMASK) == ST_CLOCK) break; - if (head && head->myBmp) {//layerd clock + if (head && head->myBmp) { // layerd clock SIZE szNew; szNew.cx = head->clocksize[CLOCK_LEFT] + head->clocksize[CLOCK_RIGHT]; szNew.cy = head->myBmp->getHeight(); @@ -194,9 +194,9 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options wnd->getArgs()->add("clock.height", szNew.cy); STYLE_SZ_CLOCK = szNew.cx; } - else { //normal clock + else { // normal clock HFONT hfnSave = (HFONT)SelectObject(hdc, fonts.clock); - SIZE sz; GetTextExtentPoint32(hdc, wnd->getTime(), mir_tstrlen(wnd->getTime()), &sz); + SIZE sz; GetTextExtentPoint32(hdc, wnd->getTime(), (int)mir_tstrlen(wnd->getTime()), &sz); SelectObject(hdc, hfnSave); wnd->getArgs()->add("clock.width", sz.cx + 2 * STYLE_SZ_GAP); wnd->getArgs()->add("clock.height", sz.cy); @@ -239,7 +239,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options case PopupWnd2::TT_UNICODE: { RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0); - DrawTextEx(hdc, wnd->getText(), mir_tstrlen(wnd->getText()), &rc, + DrawTextEx(hdc, wnd->getText(), (int)mir_tstrlen(wnd->getText()), &rc, DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL); szNew.cx = rc.right; szNew.cy = rc.bottom; @@ -282,7 +282,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options case PopupWnd2::TT_UNICODE: { RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0); - DrawTextEx(hdc, wnd->getTitle(), mir_tstrlen(wnd->getTitle()), &rc, + DrawTextEx(hdc, wnd->getTitle(), (int)mir_tstrlen(wnd->getTitle()), &rc, DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL); szNew.cx = rc.right; szNew.cy = rc.bottom; @@ -344,7 +344,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options } else { HFONT hfnSave = (HFONT)SelectObject(hdc, fonts.clock); - SIZE sz; GetTextExtentPoint32(hdc, wnd->getTime(), mir_tstrlen(wnd->getTime()), &sz); + SIZE sz; GetTextExtentPoint32(hdc, wnd->getTime(), (int)mir_tstrlen(wnd->getTime()), &sz); SelectObject(hdc, hfnSave); wnd->getArgs()->add("clock.width", sz.cx + 2 * STYLE_SZ_GAP); wnd->getArgs()->add("clock.height", sz.cy); @@ -438,7 +438,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o } else { HFONT hfnSave = (HFONT)SelectObject(hdc, fonts.clock); - SIZE sz; GetTextExtentPoint32(hdc, wnd->getTime(), mir_tstrlen(wnd->getTime()), &sz); + SIZE sz; GetTextExtentPoint32(hdc, wnd->getTime(), (int)mir_tstrlen(wnd->getTime()), &sz); SelectObject(hdc, hfnSave); STYLE_SZ_CLOCK = sz.cx + 2 * STYLE_SZ_GAP; } @@ -502,7 +502,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o case PopupWnd2::TT_UNICODE: { RECT rc; SetRect(&rc, pos.x, pos.y, pos.x + sz.cx, pos.y + sz.cy); - DrawTextEx(hdc, wnd->getText(), mir_tstrlen(wnd->getText()), &rc, + DrawTextEx(hdc, wnd->getText(), (int)mir_tstrlen(wnd->getText()), &rc, DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL); } break; @@ -551,7 +551,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o { HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.title); RECT rc; SetRect(&rc, pos.x, pos.y, pos.x + sz.cx, pos.y + sz.cy); - DrawTextEx(hdc, wnd->getTitle(), mir_tstrlen(wnd->getTitle()), &rc, + DrawTextEx(hdc, wnd->getTitle(), (int)mir_tstrlen(wnd->getTitle()), &rc, DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL); SelectObject(hdc, hFntSave); } @@ -691,7 +691,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o SetTextColor(hdc, wnd->getClockColor()); HFONT hfnSave = (HFONT)SelectObject(bmp->getDC(), fonts.clock); - SIZE sz; GetTextExtentPoint32(bmp->getDC(), wnd->getTime(), mir_tstrlen(wnd->getTime()), &sz); + SIZE sz; GetTextExtentPoint32(bmp->getDC(), wnd->getTime(), (int)mir_tstrlen(wnd->getTime()), &sz); bmp->Draw_Text(wnd->getTime(), x, y); SelectObject(bmp->getDC(), hfnSave); } diff --git a/plugins/Popup/src/version.h b/plugins/Popup/src/version.h index 445ddb4096..8c2bd1831c 100644 --- a/plugins/Popup/src/version.h +++ b/plugins/Popup/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 2 #define __MINOR_VERSION 1 #define __RELEASE_NUM 1 -#define __BUILD_NUM 9 +#define __BUILD_NUM 10 #include diff --git a/plugins/mTextControl/src/FormattedTextDraw.cpp b/plugins/mTextControl/src/FormattedTextDraw.cpp index 6555e8d0a0..6a9e2d2cdc 100644 --- a/plugins/mTextControl/src/FormattedTextDraw.cpp +++ b/plugins/mTextControl/src/FormattedTextDraw.cpp @@ -30,25 +30,25 @@ static const IID IID_ITextDocument = { ///////////////////////////////////////////////////////////////////////////// // CallBack functions + DWORD CALLBACK EditStreamInCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb) { - PCOOKIE pCookie = (PCOOKIE) dwCookie; - if (pCookie->isUnicode) - { - if ((pCookie->dwSize - pCookie->dwCount)*sizeof(WCHAR) < (DWORD)cb) - *pcb = (pCookie->dwSize - pCookie->dwCount)*sizeof(WCHAR); + COOKIE *pCookie = (COOKIE*)dwCookie; + if (pCookie->isUnicode) { + if ((pCookie->cbSize - pCookie->cbCount)*sizeof(WCHAR) < (size_t)cb) + *pcb = LONG(pCookie->cbSize - pCookie->cbCount)*sizeof(WCHAR); else - *pcb = cb&~1UL; - CopyMemory(pbBuff, pCookie->unicode+pCookie->dwCount, *pcb); - pCookie->dwCount += *pcb/sizeof(WCHAR); - } else - { - if(pCookie->dwSize - pCookie->dwCount < (DWORD)cb) - *pcb = pCookie->dwSize - pCookie->dwCount; + *pcb = cb & ~1UL; + CopyMemory(pbBuff, pCookie->unicode + pCookie->cbCount, *pcb); + pCookie->cbCount += *pcb / sizeof(WCHAR); + } + else { + if (pCookie->cbSize - pCookie->cbCount < (DWORD)cb) + *pcb = LONG(pCookie->cbSize - pCookie->cbCount); else *pcb = cb; - CopyMemory(pbBuff, pCookie->ansi+pCookie->dwCount, *pcb); - pCookie->dwCount += *pcb; + CopyMemory(pbBuff, pCookie->ansi + pCookie->cbCount, *pcb); + pCookie->cbCount += *pcb; } return 0; // callback succeeded - no errors @@ -56,69 +56,69 @@ DWORD CALLBACK EditStreamInCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, ///////////////////////////////////////////////////////////////////////////// // CFormattedTextDraw + HRESULT CFormattedTextDraw::putRTFTextA(char *newVal) { - HRESULT hr; - LRESULT lResult = 0; - EDITSTREAM editStream; - - if (!m_spTextServices) + if (!m_spTextServices) return S_FALSE; m_editCookie.isUnicode = false; m_editCookie.ansi = newVal; - m_editCookie.dwSize = mir_strlen(m_editCookie.ansi); - m_editCookie.dwCount = 0; - editStream.dwCookie = (DWORD_PTR) &m_editCookie; + m_editCookie.cbSize = mir_strlen(m_editCookie.ansi); + m_editCookie.cbCount = 0; + + EDITSTREAM editStream; + editStream.dwCookie = (DWORD_PTR)&m_editCookie; editStream.dwError = 0; editStream.pfnCallback = (EDITSTREAMCALLBACK)EditStreamInCallback; - hr = m_spTextServices->TxSendMessage(EM_STREAMIN, (WPARAM)(SF_RTF), (LPARAM)&editStream, &lResult); + + LRESULT lResult = 0; + HRESULT hr = m_spTextServices->TxSendMessage(EM_STREAMIN, (WPARAM)(SF_RTF), (LPARAM)&editStream, &lResult); return S_OK; } HRESULT CFormattedTextDraw::putRTFTextW(WCHAR *newVal) { - - HRESULT hr; - LRESULT lResult = 0; - EDITSTREAM editStream; - - if (!m_spTextServices) + if (!m_spTextServices) return S_FALSE; m_editCookie.isUnicode = true; m_editCookie.unicode = newVal; - m_editCookie.dwSize = mir_wstrlen(m_editCookie.unicode); - m_editCookie.dwCount = 0; - editStream.dwCookie = (DWORD_PTR) &m_editCookie; + m_editCookie.cbSize = mir_wstrlen(m_editCookie.unicode); + m_editCookie.cbCount = 0; + + EDITSTREAM editStream; + editStream.dwCookie = (DWORD_PTR)&m_editCookie; editStream.dwError = 0; editStream.pfnCallback = (EDITSTREAMCALLBACK)EditStreamInCallback; - hr = m_spTextServices->TxSendMessage(EM_STREAMIN, (WPARAM)(SF_RTF|SF_UNICODE), (LPARAM)&editStream, &lResult); + + LRESULT lResult = 0; + HRESULT hr = m_spTextServices->TxSendMessage(EM_STREAMIN, (WPARAM)(SF_RTF | SF_UNICODE), (LPARAM)&editStream, &lResult); return S_OK; } HRESULT CFormattedTextDraw::putTextA(char *newVal) { - HRESULT hr; - LRESULT lResult = 0; - EDITSTREAM editStream; - - if (!m_spTextServices) + if (!m_spTextServices) return S_FALSE; m_editCookie.isUnicode = false; m_editCookie.ansi = newVal; - m_editCookie.dwSize = mir_strlen(m_editCookie.ansi); - m_editCookie.dwCount = 0; - editStream.dwCookie = (DWORD_PTR) &m_editCookie; + m_editCookie.cbSize = mir_strlen(m_editCookie.ansi); + m_editCookie.cbCount = 0; + + EDITSTREAM editStream; + editStream.dwCookie = (DWORD_PTR)&m_editCookie; editStream.dwError = 0; editStream.pfnCallback = (EDITSTREAMCALLBACK)EditStreamInCallback; - hr = m_spTextServices->TxSendMessage(EM_STREAMIN, (WPARAM)(SF_TEXT), (LPARAM)&editStream, &lResult); - + + LRESULT lResult = 0; + HRESULT hr = m_spTextServices->TxSendMessage(EM_STREAMIN, (WPARAM)(SF_TEXT), (LPARAM)&editStream, &lResult); + CHARFORMAT cf; cf.cbSize = sizeof(cf); - cf.dwMask = CFM_FACE|CFM_BOLD; + cf.dwMask = CFM_FACE | CFM_BOLD; cf.dwEffects = 0; mir_sntprintf(cf.szFaceName, SIZEOF(cf.szFaceName), _T("MS Shell Dlg")); m_spTextServices->TxSendMessage(EM_SETCHARFORMAT, (WPARAM)(SCF_ALL), (LPARAM)&cf, &lResult); @@ -128,32 +128,29 @@ HRESULT CFormattedTextDraw::putTextA(char *newVal) HRESULT CFormattedTextDraw::putTextW(WCHAR *newVal) { - - HRESULT hr; - LRESULT lResult = 0; - EDITSTREAM editStream; - - if (!m_spTextServices) + if (!m_spTextServices) return S_FALSE; m_editCookie.isUnicode = true; m_editCookie.unicode = newVal; - m_editCookie.dwSize = mir_wstrlen(m_editCookie.unicode); - m_editCookie.dwCount = 0; - editStream.dwCookie = (DWORD_PTR) &m_editCookie; + m_editCookie.cbSize = mir_wstrlen(m_editCookie.unicode); + m_editCookie.cbCount = 0; + + EDITSTREAM editStream; + editStream.dwCookie = (DWORD_PTR)&m_editCookie; editStream.dwError = 0; editStream.pfnCallback = (EDITSTREAMCALLBACK)EditStreamInCallback; - hr = m_spTextServices->TxSendMessage(EM_STREAMIN, (WPARAM)(SF_TEXT|SF_UNICODE), (LPARAM)&editStream, &lResult); - + + LRESULT lResult = 0; + HRESULT hr = m_spTextServices->TxSendMessage(EM_STREAMIN, (WPARAM)(SF_TEXT | SF_UNICODE), (LPARAM)&editStream, &lResult); + CHARFORMAT cf; cf.cbSize = sizeof(cf); - cf.dwMask = CFM_FACE|CFM_BOLD; + cf.dwMask = CFM_FACE | CFM_BOLD; cf.dwEffects = 0; mir_sntprintf(cf.szFaceName, SIZEOF(cf.szFaceName), _T("MS Shell Dlg")); m_spTextServices->TxSendMessage(EM_SETCHARFORMAT, (WPARAM)(SCF_ALL), (LPARAM)&cf, &lResult); - return S_OK; - } HRESULT CFormattedTextDraw::Draw(void *hdcDraw, RECT *prc) @@ -164,12 +161,12 @@ HRESULT CFormattedTextDraw::Draw(void *hdcDraw, RECT *prc) LRESULT lResult; CHARFORMAT cf; cf.cbSize = sizeof(cf); - cf.dwMask = CFM_FACE/*|CFM_COLOR*/|CFM_CHARSET|CFM_SIZE| - (lf.lfWeight>=FW_BOLD?CFM_BOLD:0)| - (lf.lfItalic?CFM_ITALIC:0)| - (lf.lfUnderline?CFM_UNDERLINE:0)| - (lf.lfStrikeOut?CFM_STRIKEOUT:0); - cf.dwEffects = CFE_BOLD|CFE_ITALIC|CFE_STRIKEOUT|CFE_UNDERLINE; + cf.dwMask = CFM_FACE/*|CFM_COLOR*/ | CFM_CHARSET | CFM_SIZE | + (lf.lfWeight >= FW_BOLD ? CFM_BOLD : 0) | + (lf.lfItalic ? CFM_ITALIC : 0) | + (lf.lfUnderline ? CFM_UNDERLINE : 0) | + (lf.lfStrikeOut ? CFM_STRIKEOUT : 0); + cf.dwEffects = CFE_BOLD | CFE_ITALIC | CFE_STRIKEOUT | CFE_UNDERLINE; cf.crTextColor = GetTextColor((HDC)hdcDraw); cf.bCharSet = lf.lfCharSet; cf.yHeight = 1440 * abs(lf.lfHeight) / GetDeviceCaps((HDC)hdcDraw, LOGPIXELSY); @@ -177,15 +174,15 @@ HRESULT CFormattedTextDraw::Draw(void *hdcDraw, RECT *prc) m_spTextServices->TxSendMessage(EM_SETCHARFORMAT, (WPARAM)(SCF_ALL), (LPARAM)&cf, &lResult); m_spTextServices->TxDraw( - DVASPECT_CONTENT, // Draw Aspect + DVASPECT_CONTENT, // Draw Aspect 0, // Lindex NULL, // Info for drawing optimization NULL, // target device information - (HDC) hdcDraw, // Draw device HDC + (HDC)hdcDraw, // Draw device HDC NULL, // Target device HDC - (RECTL *) prc, // Bounding client rectangle + (RECTL *)prc, // Bounding client rectangle NULL, // Clipping rectangle for metafiles - (RECT *) NULL, // Update rectangle + (RECT *)NULL, // Update rectangle NULL, // Call back function NULL, // Call back parameter TXTVIEW_INACTIVE); // What view of the object could be TXTVIEW_ACTIVE @@ -205,12 +202,12 @@ HRESULT CFormattedTextDraw::get_NaturalSize(void *hdcDraw, long *Width, long *He LRESULT lResult; CHARFORMAT cf; cf.cbSize = sizeof(cf); - cf.dwMask = CFM_FACE/*|CFM_COLOR*/|CFM_CHARSET|CFM_SIZE| - (lf.lfWeight>=FW_BOLD?CFM_BOLD:0)| - (lf.lfItalic?CFM_ITALIC:0)| - (lf.lfUnderline?CFM_UNDERLINE:0)| - (lf.lfStrikeOut?CFM_STRIKEOUT:0); - cf.dwEffects = CFE_BOLD|CFE_ITALIC|CFE_STRIKEOUT|CFE_UNDERLINE; + cf.dwMask = CFM_FACE/*|CFM_COLOR*/ | CFM_CHARSET | CFM_SIZE | + (lf.lfWeight >= FW_BOLD ? CFM_BOLD : 0) | + (lf.lfItalic ? CFM_ITALIC : 0) | + (lf.lfUnderline ? CFM_UNDERLINE : 0) | + (lf.lfStrikeOut ? CFM_STRIKEOUT : 0); + cf.dwEffects = CFE_BOLD | CFE_ITALIC | CFE_STRIKEOUT | CFE_UNDERLINE; cf.crTextColor = GetTextColor((HDC)hdcDraw); cf.bCharSet = lf.lfCharSet; cf.yHeight = 1440 * abs(lf.lfHeight) / GetDeviceCaps((HDC)hdcDraw, LOGPIXELSY); @@ -221,24 +218,20 @@ HRESULT CFormattedTextDraw::get_NaturalSize(void *hdcDraw, long *Width, long *He m_spTextServices->TxSendMessage(EM_SETCHARFORMAT, (WPARAM)(SCF_ALL), (LPARAM)&cf, &lResult); - SIZEL szExtent; -// HDC hdcDraw; -// hdcDraw = GetDC(NULL); *Height = 1; + + SIZEL szExtent; szExtent.cx = *Width; szExtent.cy = *Height; if (m_spTextServices->TxGetNaturalSize(DVASPECT_CONTENT, (HDC)hdcDraw, NULL, NULL, TXTNS_FITTOCONTENT, &szExtent, Width, Height) != S_OK) - { -// ReleaseDC(NULL, hdcDraw); return S_FALSE; - } -// ReleaseDC(NULL, hdcDraw); return S_OK; } ///////////////////////////////////////////////////////////////////////////// // ITextHost functions + HDC CFormattedTextDraw::TxGetDC() { return NULL; @@ -270,12 +263,10 @@ BOOL CFormattedTextDraw::TxSetScrollPos(INT fnBar, INT nPos, BOOL fRedraw) } void CFormattedTextDraw::TxInvalidateRect(LPCRECT prc, BOOL fMode) -{ -} +{} void CFormattedTextDraw::TxViewChange(BOOL fUpdate) -{ -} +{} BOOL CFormattedTextDraw::TxCreateCaret(HBITMAP hbmp, INT xWidth, INT yHeight) { @@ -313,33 +304,26 @@ void CFormattedTextDraw::TxSetFocus() { } - void CFormattedTextDraw::TxSetCursor(HCURSOR hcur, BOOL fText) { if (fText) - { SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW))); - } else - { + else SetCursor(hcur); - } } BOOL CFormattedTextDraw::TxScreenToClient(LPPOINT lppt) { if (!m_hwndParent) return FALSE; -// BOOL result = ScreenToClient(m_hwndParent, lppt); -// lppt->x -= m_rcClient.left; -// lppt->y -= m_rcClient.left; return ScreenToClient(m_hwndParent, lppt); } BOOL CFormattedTextDraw::TxClientToScreen(LPPOINT lppt) { if (!m_hwndParent) return FALSE; -// BOOL result = ; -// lppt->x -= m_rcClient.left; -// lppt->y -= m_rcClient.left; + // BOOL result = ; + // lppt->x -= m_rcClient.left; + // lppt->y -= m_rcClient.left; return ClientToScreen(m_hwndParent, lppt); } @@ -445,8 +429,7 @@ HIMC CFormattedTextDraw::TxImmGetContext() } void CFormattedTextDraw::TxImmReleaseContext(HIMC himc) -{ -} +{} HRESULT CFormattedTextDraw::TxGetSelectionBarWidth(LONG *lSelBarWidth) { @@ -460,17 +443,12 @@ HRESULT CFormattedTextDraw::TxGetSelectionBarWidth(LONG *lSelBarWidth) HRESULT CFormattedTextDraw::CharFormatFromHFONT(CHARFORMAT2W* pCF, HFONT hFont) // Takes an HFONT and fills in a CHARFORMAT2W structure with the corresponding info { - - HWND hWnd; - LOGFONT lf; - HDC hDC; - LONG yPixPerInch; - // Get LOGFONT for default font if (!hFont) - hFont = (HFONT) GetStockObject(SYSTEM_FONT); + hFont = (HFONT)GetStockObject(SYSTEM_FONT); // Get LOGFONT for passed hfont + LOGFONT lf; if (!GetObject(hFont, sizeof(LOGFONT), &lf)) return E_FAIL; @@ -478,9 +456,9 @@ HRESULT CFormattedTextDraw::CharFormatFromHFONT(CHARFORMAT2W* pCF, HFONT hFont) memset(pCF, 0, sizeof(CHARFORMAT2W)); pCF->cbSize = sizeof(CHARFORMAT2W); - hWnd = GetDesktopWindow(); - hDC = GetDC(hWnd); - yPixPerInch = GetDeviceCaps(hDC, LOGPIXELSY); + HWND hWnd = GetDesktopWindow(); + HDC hDC = GetDC(hWnd); + LONG yPixPerInch = GetDeviceCaps(hDC, LOGPIXELSY); pCF->yHeight = -lf.lfHeight * LY_PER_INCH / yPixPerInch; ReleaseDC(hWnd, hDC); @@ -490,7 +468,7 @@ HRESULT CFormattedTextDraw::CharFormatFromHFONT(CHARFORMAT2W* pCF, HFONT hFont) pCF->dwEffects = CFM_EFFECTS | CFE_AUTOBACKCOLOR; pCF->dwEffects &= ~(CFE_PROTECTED | CFE_LINK | CFE_AUTOCOLOR); - if(lf.lfWeight < FW_BOLD) + if (lf.lfWeight < FW_BOLD) pCF->dwEffects &= ~CFE_BOLD; if (!lf.lfItalic) @@ -506,10 +484,7 @@ HRESULT CFormattedTextDraw::CharFormatFromHFONT(CHARFORMAT2W* pCF, HFONT hFont) pCF->bCharSet = lf.lfCharSet; pCF->bPitchAndFamily = lf.lfPitchAndFamily; - mir_wstrcpy(pCF->szFaceName, lf.lfFaceName); - - return S_OK; } @@ -531,10 +506,8 @@ HRESULT CFormattedTextDraw::InitDefaultParaFormat() HRESULT CFormattedTextDraw::CreateTextServicesObject() { - HRESULT hr; IUnknown *spUnk; - - hr = MyCreateTextServices(NULL, static_cast(this), &spUnk); + HRESULT hr = MyCreateTextServices(NULL, static_cast(this), &spUnk); if (hr == S_OK) { hr = spUnk->QueryInterface(IID_ITextServices, (void**)&m_spTextServices); hr = spUnk->QueryInterface(IID_ITextDocument, (void**)&m_spTextDocument); @@ -542,4 +515,3 @@ HRESULT CFormattedTextDraw::CreateTextServicesObject() } return hr; } - diff --git a/plugins/mTextControl/src/FormattedTextDraw.h b/plugins/mTextControl/src/FormattedTextDraw.h index 3ea2e2faee..bfadbb918f 100644 --- a/plugins/mTextControl/src/FormattedTextDraw.h +++ b/plugins/mTextControl/src/FormattedTextDraw.h @@ -11,7 +11,7 @@ #define HOST_BORDER 0 #endif -typedef struct tagCOOKIE +struct COOKIE { bool isUnicode; union @@ -19,9 +19,8 @@ typedef struct tagCOOKIE char *ansi; WCHAR *unicode; }; - DWORD dwSize; - DWORD dwCount; -} COOKIE, *PCOOKIE; + size_t cbSize, cbCount; +}; extern HRESULT (WINAPI *MyCreateTextServices)(IUnknown *punkOuter, ITextHost *pITextHost, IUnknown **ppUnk); diff --git a/plugins/mTextControl/src/dataobject.cpp b/plugins/mTextControl/src/dataobject.cpp index 99e0348bc6..c8f4f50e8f 100644 --- a/plugins/mTextControl/src/dataobject.cpp +++ b/plugins/mTextControl/src/dataobject.cpp @@ -63,16 +63,15 @@ private: // // Constructor // -CDataObject::CDataObject(const FORMATETC *fmtetc, const STGMEDIUM *stgmed, int count) +CDataObject::CDataObject(const FORMATETC *fmtetc, const STGMEDIUM *stgmed, int count) { - m_lRefCount = 1; + m_lRefCount = 1; m_nNumFormats = count; - - m_pFormatEtc = new FORMATETC[count]; - m_pStgMedium = new STGMEDIUM[count]; - for(int i = 0; i < count; i++) - { + m_pFormatEtc = new FORMATETC[count]; + m_pStgMedium = new STGMEDIUM[count]; + + for (int i = 0; i < count; i++) { m_pFormatEtc[i] = fmtetc[i]; m_pStgMedium[i] = stgmed[i]; } @@ -84,13 +83,12 @@ CDataObject::CDataObject(const FORMATETC *fmtetc, const STGMEDIUM *stgmed, int c CDataObject::~CDataObject() { // cleanup - for (int i = 0; i < m_nNumFormats; i++) - { -// ReleaseStgMedium(&m_pStgMedium[i]); + for (int i = 0; i < m_nNumFormats; i++) { + // ReleaseStgMedium(&m_pStgMedium[i]); } - if(m_pFormatEtc) delete[] m_pFormatEtc; - if(m_pStgMedium) delete[] m_pStgMedium; + if (m_pFormatEtc) delete[] m_pFormatEtc; + if (m_pStgMedium) delete[] m_pStgMedium; } // @@ -98,8 +96,8 @@ CDataObject::~CDataObject() // ULONG __stdcall CDataObject::AddRef(void) { - // increment object reference count - return InterlockedIncrement(&m_lRefCount); + // increment object reference count + return InterlockedIncrement(&m_lRefCount); } // @@ -107,18 +105,15 @@ ULONG __stdcall CDataObject::AddRef(void) // ULONG __stdcall CDataObject::Release(void) { - // decrement object reference count + // decrement object reference count LONG count = InterlockedDecrement(&m_lRefCount); - - if(count == 0) - { + + if (count == 0) { delete this; return 0; } - else - { - return count; - } + + return count; } // @@ -126,28 +121,23 @@ ULONG __stdcall CDataObject::Release(void) // HRESULT __stdcall CDataObject::QueryInterface(REFIID iid, void **ppvObject) { - // check to see what interface has been requested - if(iid == IID_IDataObject || iid == IID_IUnknown) - { - AddRef(); - *ppvObject = this; - return S_OK; - } - else - { - *ppvObject = 0; - return E_NOINTERFACE; - } + // check to see what interface has been requested + if (iid == IID_IDataObject || iid == IID_IUnknown) { + AddRef(); + *ppvObject = this; + return S_OK; + } + + *ppvObject = 0; + return E_NOINTERFACE; } int CDataObject::LookupFormatEtc(FORMATETC *pFormatEtc) { - for (int i = 0; i < m_nNumFormats; i++) - { - if ((pFormatEtc->tymed & m_pFormatEtc[i].tymed) && - pFormatEtc->cfFormat == m_pFormatEtc[i].cfFormat && - pFormatEtc->dwAspect == m_pFormatEtc[i].dwAspect) - { + for (int i = 0; i < m_nNumFormats; i++) { + if ((pFormatEtc->tymed & m_pFormatEtc[i].tymed) && + pFormatEtc->cfFormat == m_pFormatEtc[i].cfFormat && + pFormatEtc->dwAspect == m_pFormatEtc[i].dwAspect) { return i; } } @@ -158,35 +148,33 @@ int CDataObject::LookupFormatEtc(FORMATETC *pFormatEtc) // // IDataObject::GetData // -HRESULT __stdcall CDataObject::GetData (FORMATETC *pFormatEtc, STGMEDIUM *pMedium) +HRESULT __stdcall CDataObject::GetData(FORMATETC *pFormatEtc, STGMEDIUM *pMedium) { int idx; // // try to match the requested FORMATETC with one of our supported formats // - if ((idx = LookupFormatEtc(pFormatEtc)) == -1) - { + if ((idx = LookupFormatEtc(pFormatEtc)) == -1) { return DV_E_FORMATETC; } // // found a match! transfer the data into the supplied storage-medium // - pMedium->tymed = m_pFormatEtc[idx].tymed; - pMedium->pUnkForRelease = 0; - - switch (pMedium->tymed) - { - case TYMED_HGLOBAL: - case TYMED_GDI: - case TYMED_ENHMF: -// pMedium->hBitmap = (HBITMAP)OleDuplicateData(m_pStgMedium[idx].hBitmap, pFormatEtc->cfFormat, 0); - pMedium->hBitmap = m_pStgMedium[idx].hBitmap; - break; - - default: - return DV_E_FORMATETC; + pMedium->tymed = m_pFormatEtc[idx].tymed; + pMedium->pUnkForRelease = 0; + + switch (pMedium->tymed) { + case TYMED_HGLOBAL: + case TYMED_GDI: + case TYMED_ENHMF: + // pMedium->hBitmap = (HBITMAP)OleDuplicateData(m_pStgMedium[idx].hBitmap, pFormatEtc->cfFormat, 0); + pMedium->hBitmap = m_pStgMedium[idx].hBitmap; + break; + + default: + return DV_E_FORMATETC; } if (pMedium->hBitmap == NULL) return STG_E_MEDIUMFULL; @@ -196,7 +184,7 @@ HRESULT __stdcall CDataObject::GetData (FORMATETC *pFormatEtc, STGMEDIUM *pMediu // // IDataObject::GetDataHere // -HRESULT __stdcall CDataObject::GetDataHere (FORMATETC *pFormatEtc, STGMEDIUM *pMedium) +HRESULT __stdcall CDataObject::GetDataHere(FORMATETC *pFormatEtc, STGMEDIUM *pMedium) { // GetDataHere is only required for IStream and IStorage mediums // It is an error to call GetDataHere for things like HGLOBAL and other clipboard formats @@ -211,7 +199,7 @@ HRESULT __stdcall CDataObject::GetDataHere (FORMATETC *pFormatEtc, STGMEDIUM *pM // // Called to see if the IDataObject supports the specified format of data // -HRESULT __stdcall CDataObject::QueryGetData (FORMATETC *pFormatEtc) +HRESULT __stdcall CDataObject::QueryGetData(FORMATETC *pFormatEtc) { return (LookupFormatEtc(pFormatEtc) == -1) ? DV_E_FORMATETC : S_OK; } @@ -219,7 +207,7 @@ HRESULT __stdcall CDataObject::QueryGetData (FORMATETC *pFormatEtc) // // IDataObject::GetCanonicalFormatEtc // -HRESULT __stdcall CDataObject::GetCanonicalFormatEtc (FORMATETC *pFormatEct, FORMATETC *pFormatEtcOut) +HRESULT __stdcall CDataObject::GetCanonicalFormatEtc(FORMATETC *pFormatEct, FORMATETC *pFormatEtcOut) { // Apparently we have to set this field to NULL even though we don't do anything else pFormatEtcOut->ptd = NULL; @@ -229,7 +217,7 @@ HRESULT __stdcall CDataObject::GetCanonicalFormatEtc (FORMATETC *pFormatEct, FOR // // IDataObject::SetData // -HRESULT __stdcall CDataObject::SetData (FORMATETC *pFormatEtc, STGMEDIUM *pMedium, BOOL fRelease) +HRESULT __stdcall CDataObject::SetData(FORMATETC *pFormatEtc, STGMEDIUM *pMedium, BOOL fRelease) { return E_NOTIMPL; } @@ -237,16 +225,14 @@ HRESULT __stdcall CDataObject::SetData (FORMATETC *pFormatEtc, STGMEDIUM *pMediu // // IDataObject::EnumFormatEtc // -HRESULT __stdcall CDataObject::EnumFormatEtc (DWORD dwDirection, IEnumFORMATETC **ppEnumFormatEtc) +HRESULT __stdcall CDataObject::EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC **ppEnumFormatEtc) { - if(dwDirection == DATADIR_GET) - { + if (dwDirection == DATADIR_GET) { // for Win2k+ you can use the SHCreateStdEnumFmtEtc API call, however // to support all Windows platforms we need to implement IEnumFormatEtc ourselves. return CreateEnumFormatEtc(m_nNumFormats, m_pFormatEtc, ppEnumFormatEtc); } - else - { + else { // the direction specified is not support for drag+drop return E_NOTIMPL; } @@ -255,7 +241,7 @@ HRESULT __stdcall CDataObject::EnumFormatEtc (DWORD dwDirection, IEnumFORMATETC // // IDataObject::DAdvise // -HRESULT __stdcall CDataObject::DAdvise (FORMATETC *pFormatEtc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection) +HRESULT __stdcall CDataObject::DAdvise(FORMATETC *pFormatEtc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection) { return OLE_E_ADVISENOTSUPPORTED; } @@ -263,7 +249,7 @@ HRESULT __stdcall CDataObject::DAdvise (FORMATETC *pFormatEtc, DWORD advf, IAdvi // // IDataObject::DUnadvise // -HRESULT __stdcall CDataObject::DUnadvise (DWORD dwConnection) +HRESULT __stdcall CDataObject::DUnadvise(DWORD dwConnection) { return OLE_E_ADVISENOTSUPPORTED; } @@ -271,7 +257,7 @@ HRESULT __stdcall CDataObject::DUnadvise (DWORD dwConnection) // // IDataObject::EnumDAdvise // -HRESULT __stdcall CDataObject::EnumDAdvise (IEnumSTATDATA **ppEnumAdvise) +HRESULT __stdcall CDataObject::EnumDAdvise(IEnumSTATDATA **ppEnumAdvise) { return OLE_E_ADVISENOTSUPPORTED; } @@ -279,9 +265,9 @@ HRESULT __stdcall CDataObject::EnumDAdvise (IEnumSTATDATA **ppEnumAdvise) // // Helper function // -HRESULT CreateDataObject (const FORMATETC *fmtetc, const STGMEDIUM *stgmeds, UINT count, IDataObject **ppDataObject) +HRESULT CreateDataObject(const FORMATETC *fmtetc, const STGMEDIUM *stgmeds, UINT count, IDataObject **ppDataObject) { - if(ppDataObject == 0) + if (ppDataObject == 0) return E_INVALIDARG; *ppDataObject = new CDataObject(fmtetc, stgmeds, count); diff --git a/plugins/mTextControl/src/enumformat.cpp b/plugins/mTextControl/src/enumformat.cpp index 7daac154d7..9aa3895e05 100644 --- a/plugins/mTextControl/src/enumformat.cpp +++ b/plugins/mTextControl/src/enumformat.cpp @@ -21,7 +21,6 @@ class CEnumFormatEtc : public IEnumFORMATETC { public: - // // IUnknown members // @@ -56,7 +55,7 @@ private: // HRESULT CreateEnumFormatEtc(UINT nNumFormats, FORMATETC *pFormatEtc, IEnumFORMATETC **ppEnumFormatEtc) { - if(nNumFormats == 0 || pFormatEtc == 0 || ppEnumFormatEtc == 0) + if (nNumFormats == 0 || pFormatEtc == 0 || ppEnumFormatEtc == 0) return E_INVALIDARG; *ppEnumFormatEtc = new CEnumFormatEtc(pFormatEtc, nNumFormats); @@ -71,9 +70,8 @@ static void DeepCopyFormatEtc(FORMATETC *dest, FORMATETC *source) { // copy the source FORMATETC into dest *dest = *source; - - if(source->ptd) - { + + if (source->ptd) { // allocate memory for the DVTARGETDEVICE if necessary dest->ptd = (DVTARGETDEVICE*)CoTaskMemAlloc(sizeof(DVTARGETDEVICE)); @@ -87,14 +85,13 @@ static void DeepCopyFormatEtc(FORMATETC *dest, FORMATETC *source) // CEnumFormatEtc::CEnumFormatEtc(FORMATETC *pFormatEtc, int nNumFormats) { - m_lRefCount = 1; - m_nIndex = 0; + m_lRefCount = 1; + m_nIndex = 0; m_nNumFormats = nNumFormats; - m_pFormatEtc = new FORMATETC[nNumFormats]; - + m_pFormatEtc = new FORMATETC[nNumFormats]; + // copy the FORMATETC structures - for(int i = 0; i < nNumFormats; i++) - { + for (int i = 0; i < nNumFormats; i++) { DeepCopyFormatEtc(&m_pFormatEtc[i], &pFormatEtc[i]); } } @@ -104,11 +101,9 @@ CEnumFormatEtc::CEnumFormatEtc(FORMATETC *pFormatEtc, int nNumFormats) // CEnumFormatEtc::~CEnumFormatEtc() { - if(m_pFormatEtc) - { - for(ULONG i = 0; i < m_nNumFormats; i++) - { - if(m_pFormatEtc[i].ptd) + if (m_pFormatEtc) { + for (ULONG i = 0; i < m_nNumFormats; i++) { + if (m_pFormatEtc[i].ptd) CoTaskMemFree(m_pFormatEtc[i].ptd); } @@ -121,8 +116,8 @@ CEnumFormatEtc::~CEnumFormatEtc() // ULONG __stdcall CEnumFormatEtc::AddRef(void) { - // increment object reference count - return InterlockedIncrement(&m_lRefCount); + // increment object reference count + return InterlockedIncrement(&m_lRefCount); } // @@ -130,16 +125,14 @@ ULONG __stdcall CEnumFormatEtc::AddRef(void) // ULONG __stdcall CEnumFormatEtc::Release(void) { - // decrement object reference count + // decrement object reference count LONG count = InterlockedDecrement(&m_lRefCount); - - if(count == 0) - { + + if (count == 0) { delete this; return 0; } - else - { + else { return count; } } @@ -149,18 +142,16 @@ ULONG __stdcall CEnumFormatEtc::Release(void) // HRESULT __stdcall CEnumFormatEtc::QueryInterface(REFIID iid, void **ppvObject) { - // check to see what interface has been requested - if(iid == IID_IEnumFORMATETC || iid == IID_IUnknown) - { - AddRef(); - *ppvObject = this; - return S_OK; - } - else - { - *ppvObject = 0; - return E_NOINTERFACE; - } + // check to see what interface has been requested + if (iid == IID_IEnumFORMATETC || iid == IID_IUnknown) { + AddRef(); + *ppvObject = this; + return S_OK; + } + else { + *ppvObject = 0; + return E_NOINTERFACE; + } } // @@ -171,22 +162,21 @@ HRESULT __stdcall CEnumFormatEtc::QueryInterface(REFIID iid, void **ppvObject) // HRESULT __stdcall CEnumFormatEtc::Next(ULONG celt, FORMATETC *pFormatEtc, ULONG * pceltFetched) { - ULONG copied = 0; + ULONG copied = 0; // validate arguments - if(celt == 0 || pFormatEtc == 0) + if (celt == 0 || pFormatEtc == 0) return E_INVALIDARG; // copy FORMATETC structures into caller's buffer - while(m_nIndex < m_nNumFormats && copied < celt) - { + while (m_nIndex < m_nNumFormats && copied < celt) { DeepCopyFormatEtc(&pFormatEtc[copied], &m_pFormatEtc[m_nIndex]); copied++; m_nIndex++; } // store result - if(pceltFetched != 0) + if (pceltFetched != 0) *pceltFetched = copied; // did we copy all that was requested? @@ -221,12 +211,10 @@ HRESULT __stdcall CEnumFormatEtc::Clone(IEnumFORMATETC ** ppEnumFormatEtc) // make a duplicate enumerator hResult = CreateEnumFormatEtc(m_nNumFormats, m_pFormatEtc, ppEnumFormatEtc); - if(hResult == S_OK) - { + if (hResult == S_OK) { // manually set the index state - ((CEnumFormatEtc *) *ppEnumFormatEtc)->m_nIndex = m_nIndex; + ((CEnumFormatEtc *)*ppEnumFormatEtc)->m_nIndex = m_nIndex; } return hResult; } - diff --git a/plugins/mTextControl/src/fancy_rtf.cpp b/plugins/mTextControl/src/fancy_rtf.cpp index 01ad6bc0f3..e5325bd706 100644 --- a/plugins/mTextControl/src/fancy_rtf.cpp +++ b/plugins/mTextControl/src/fancy_rtf.cpp @@ -14,38 +14,37 @@ enum { BBS_BOLD_S, BBS_BOLD_E, BBS_ITALIC_S, BBS_ITALIC_E, BBS_UNDERLINE_S, BBS_ static bool bbCodeSimpleFunc(IFormattedTextDraw *ftd, CHARRANGE range, TCHAR *txt, DWORD cookie) { - CHARFORMAT cf = {0}; + CHARFORMAT cf = { 0 }; cf.cbSize = sizeof(cf); - switch (cookie) - { - case BBS_BOLD_S: - cf.dwMask = CFM_BOLD; - cf.dwEffects = CFE_BOLD; - break; - case BBS_BOLD_E: - cf.dwMask = CFM_BOLD; - break; - case BBS_ITALIC_S: - cf.dwMask = CFM_ITALIC; - cf.dwEffects = CFE_ITALIC; - break; - case BBS_ITALIC_E: - cf.dwMask = CFM_ITALIC; - break; - case BBS_UNDERLINE_S: - cf.dwMask = CFM_UNDERLINE; - cf.dwEffects = CFE_UNDERLINE; - break; - case BBS_UNDERLINE_E: - cf.dwMask = CFM_UNDERLINE; - break; - case BBS_STRIKEOUT_S: - cf.dwMask = CFM_STRIKEOUT; - cf.dwEffects = CFE_STRIKEOUT; - break; - case BBS_STRIKEOUT_E: - cf.dwMask = CFM_STRIKEOUT; - break; + switch (cookie) { + case BBS_BOLD_S: + cf.dwMask = CFM_BOLD; + cf.dwEffects = CFE_BOLD; + break; + case BBS_BOLD_E: + cf.dwMask = CFM_BOLD; + break; + case BBS_ITALIC_S: + cf.dwMask = CFM_ITALIC; + cf.dwEffects = CFE_ITALIC; + break; + case BBS_ITALIC_E: + cf.dwMask = CFM_ITALIC; + break; + case BBS_UNDERLINE_S: + cf.dwMask = CFM_UNDERLINE; + cf.dwEffects = CFE_UNDERLINE; + break; + case BBS_UNDERLINE_E: + cf.dwMask = CFM_UNDERLINE; + break; + case BBS_STRIKEOUT_S: + cf.dwMask = CFM_STRIKEOUT; + cf.dwEffects = CFE_STRIKEOUT; + break; + case BBS_STRIKEOUT_E: + cf.dwMask = CFM_STRIKEOUT; + break; } ITextServices *ts = ftd->getTextService(); @@ -66,20 +65,11 @@ static bool bbCodeImageFunc(IFormattedTextDraw *ftd, CHARRANGE range, TCHAR *txt long cnt; LRESULT lResult; -/* - TEXTRANGE trg; - trg.chrg = range; - trg.lpstrText = new TCHAR[trg.chrg.cpMax - trg.chrg.cpMin + 1]; - ts->TxSendMessage(EM_GETTEXTRANGE, 0, (LPARAM)&trg, &lResult); - MessageBox(0, txt, trg.lpstrText, MB_OK); -*/ ts->TxSendMessage(EM_SETSEL, range.cpMin, range.cpMax, &lResult); IRichEditOle* RichEditOle; ts->TxSendMessage(EM_GETOLEINTERFACE, 0, (LPARAM)&RichEditOle, &lResult); td->Freeze(&cnt); -// HDC emfdc = CreateEnhMetaFile(NULL, NULL, NULL, _T("icon")); -// DrawIconEx(emfdc, 0, 0, (HICON)_ttol(txt), 16, 16, 0, NULL, DI_NORMAL); -// InsertBitmap(RichEditOle, CloseEnhMetaFile(emfdc)); + #ifdef _WIN64 bool res = InsertBitmap(RichEditOle, CacheIconToEmf((HICON)_tstoi64(txt))); #else @@ -93,24 +83,24 @@ static bool bbCodeImageFunc(IFormattedTextDraw *ftd, CHARRANGE range, TCHAR *txt static BBCodeInfo bbCodes[] = { - { _T("[b]"), 0, bbCodeSimpleFunc, BBS_BOLD_S }, - { _T("[/b]"), 0, bbCodeSimpleFunc, BBS_BOLD_E }, - { _T("[i]"), 0, bbCodeSimpleFunc, BBS_ITALIC_S }, - { _T("[/i]"), 0, bbCodeSimpleFunc, BBS_ITALIC_E }, - { _T("[u]"), 0, bbCodeSimpleFunc, BBS_UNDERLINE_S }, - { _T("[/u]"), 0, bbCodeSimpleFunc, BBS_UNDERLINE_E }, - { _T("[s]"), 0, bbCodeSimpleFunc, BBS_STRIKEOUT_S }, - { _T("[/s]"), 0, bbCodeSimpleFunc, BBS_STRIKEOUT_E }, - -// { _T("[color="), _T("]"), bbCodeSimpleFunc, BBS_COLOR_S }, -// { _T("[/color]"), 0, bbCodeSimpleFunc, BBS_COLOR_E } - - { _T("[$hicon="), _T("$]"), bbCodeImageFunc, 0 } - -// { _T("[url]"), _T("[/url]"), bbCodeSimpleFunc, BBS_URL1 }, -// { _T("[url="), _T("]"), bbCodeSimpleFunc, BBS_URL2 }, -// { _T("[url]"), _T("[/url]"), bbCodeSimpleFunc, BBS_IMG1 }, -// { _T("[url="), _T("]"), bbCodeSimpleFunc, BBS_IMG2 }, + { _T("[b]"), 0, bbCodeSimpleFunc, BBS_BOLD_S }, + { _T("[/b]"), 0, bbCodeSimpleFunc, BBS_BOLD_E }, + { _T("[i]"), 0, bbCodeSimpleFunc, BBS_ITALIC_S }, + { _T("[/i]"), 0, bbCodeSimpleFunc, BBS_ITALIC_E }, + { _T("[u]"), 0, bbCodeSimpleFunc, BBS_UNDERLINE_S }, + { _T("[/u]"), 0, bbCodeSimpleFunc, BBS_UNDERLINE_E }, + { _T("[s]"), 0, bbCodeSimpleFunc, BBS_STRIKEOUT_S }, + { _T("[/s]"), 0, bbCodeSimpleFunc, BBS_STRIKEOUT_E }, + + // { _T("[color="), _T("]"), bbCodeSimpleFunc, BBS_COLOR_S }, + // { _T("[/color]"), 0, bbCodeSimpleFunc, BBS_COLOR_E } + + { _T("[$hicon="), _T("$]"), bbCodeImageFunc, 0 } + + // { _T("[url]"), _T("[/url]"), bbCodeSimpleFunc, BBS_URL1 }, + // { _T("[url="), _T("]"), bbCodeSimpleFunc, BBS_URL2 }, + // { _T("[url]"), _T("[/url]"), bbCodeSimpleFunc, BBS_IMG1 }, + // { _T("[url="), _T("]"), bbCodeSimpleFunc, BBS_IMG2 }, }; static int bbCodeCount = sizeof(bbCodes) / sizeof(*bbCodes); @@ -120,15 +110,13 @@ void bbCodeParse(IFormattedTextDraw *ftd) LRESULT lResult; int pos = 0; - for (bool found = true; found; ) - { + for (bool found = true; found;) { found = false; CHARRANGE fRange; fRange.cpMin = -1; TCHAR *fText = 0; BBCodeInfo *fBBCode; - for (int i = 0; i < bbCodeCount; i++) - { + for (int i = 0; i < bbCodeCount; i++) { CHARRANGE range; FINDTEXTEX fte; @@ -141,8 +129,7 @@ void bbCodeParse(IFormattedTextDraw *ftd) continue; range = fte.chrgText; - if (bbCodes[i].end) - { + if (bbCodes[i].end) { fte.chrg.cpMin = fte.chrgText.cpMax; fte.lpstrText = bbCodes[i].end; ts->TxSendMessage(EM_FINDTEXTEX, (WPARAM)FR_DOWN, (LPARAM)&fte, &lResult); @@ -151,15 +138,13 @@ void bbCodeParse(IFormattedTextDraw *ftd) range.cpMax = fte.chrgText.cpMax; } - if ((fRange.cpMin == -1) || (fRange.cpMin > range.cpMin)) - { + if ((fRange.cpMin == -1) || (fRange.cpMin > range.cpMin)) { fRange = range; - fBBCode = bbCodes+i; + fBBCode = bbCodes + i; found = true; - if (fText) delete [] fText; - if (bbCodes[i].end) - { + if (fText) delete[] fText; + if (bbCodes[i].end) { TEXTRANGE trg; trg.chrg.cpMin = fte.chrg.cpMin; trg.chrg.cpMax = fte.chrgText.cpMin; @@ -170,10 +155,9 @@ void bbCodeParse(IFormattedTextDraw *ftd) } } - if (found) - { + if (found) { found = fBBCode->func(ftd, fRange, fText, fBBCode->cookie); - if (fText) delete [] fText; + if (fText) delete[] fText; } } } diff --git a/plugins/mTextControl/src/richeditutils.cpp b/plugins/mTextControl/src/richeditutils.cpp index 043ab81675..7ffa31c1bd 100644 --- a/plugins/mTextControl/src/richeditutils.cpp +++ b/plugins/mTextControl/src/richeditutils.cpp @@ -1,6 +1,6 @@ #include "headers.h" -class CREOleCallback: public IRichEditOleCallback +class CREOleCallback : public IRichEditOleCallback { private: unsigned refCount; @@ -16,8 +16,7 @@ public: HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, LPVOID * ppvObj) { - if (IsEqualIID(riid, IID_IRichEditOleCallback)) - { + if (IsEqualIID(riid, IID_IRichEditOleCallback)) { *ppvObj = this; this->AddRef(); return S_OK; @@ -30,49 +29,49 @@ public: { if (this->refCount == 0) { if (S_OK != StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &this->pictStg)) - this->pictStg = NULL; + this->pictStg = NULL; this->nextStgId = 0; - } - return ++this->refCount; + } + return ++this->refCount; } ULONG STDMETHODCALLTYPE Release() { - if (--this->refCount == 0) { - if (this->pictStg) + if (--this->refCount == 0) { + if (this->pictStg) this->pictStg->Release(); - } - return this->refCount; + } + return this->refCount; } HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode) { - return S_OK; + return S_OK; } HRESULT STDMETHODCALLTYPE DeleteObject(LPOLEOBJECT lpoleobj) { - return S_OK; + return S_OK; } HRESULT STDMETHODCALLTYPE GetClipboardData(CHARRANGE * lpchrg, DWORD reco, LPDATAOBJECT * lplpdataobj) { - return E_NOTIMPL; + return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE GetContextMenu(WORD seltype, LPOLEOBJECT lpoleobj, CHARRANGE * lpchrg, HMENU * lphmenu) { - return E_INVALIDARG; + return E_INVALIDARG; } HRESULT STDMETHODCALLTYPE GetDragDropEffect(BOOL fDrag, DWORD grfKeyState, LPDWORD pdwEffect) { - return S_OK; + return S_OK; } HRESULT STDMETHODCALLTYPE GetInPlaceContext(LPOLEINPLACEFRAME * lplpFrame, LPOLEINPLACEUIWINDOW * lplpDoc, LPOLEINPLACEFRAMEINFO lpFrameInfo) { - return E_INVALIDARG; + return E_INVALIDARG; } HRESULT STDMETHODCALLTYPE GetNewStorage(LPSTORAGE * lplpstg) @@ -82,7 +81,7 @@ public: if (this->pictStg == NULL) return STG_E_MEDIUMFULL; - return this->pictStg->CreateStorage(sztName, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, lplpstg); + return this->pictStg->CreateStorage(sztName, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, lplpstg); } @@ -93,12 +92,12 @@ public: HRESULT STDMETHODCALLTYPE QueryInsertObject(LPCLSID lpclsid, LPSTORAGE lpstg, LONG cp) { - return S_OK; + return S_OK; } HRESULT STDMETHODCALLTYPE ShowContainerUI(BOOL fShow) { - return S_OK; + return S_OK; } }; @@ -113,8 +112,7 @@ void InitRichEdit(ITextServices *ts) LRESULT CALLBACK RichEditProxyWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { ITextServices *ts = (ITextServices *)GetWindowLongPtr(hwnd, GWLP_USERDATA); - if (ts && (msg != WM_DESTROY)) - { + if (ts && (msg != WM_DESTROY)) { LRESULT lResult; ts->TxSendMessage(msg, wParam, lParam, &lResult); return lResult; @@ -139,7 +137,7 @@ void LoadRichEdit() wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH); wcl.lpszMenuName = NULL; wcl.lpszClassName = _T("NBRichEditProxyWndClass"); - wcl.hIconSm = 0; + wcl.hIconSm = 0; RegisterClassEx(&wcl); } diff --git a/plugins/mTextControl/src/services.cpp b/plugins/mTextControl/src/services.cpp index 109431f846..b649d69b00 100644 --- a/plugins/mTextControl/src/services.cpp +++ b/plugins/mTextControl/src/services.cpp @@ -43,21 +43,23 @@ struct TextObject //--------------------------------------------------------------------------- // elper functions -void MText_InitFormatting0(IFormattedTextDraw *ftd, DWORD options) { +void MText_InitFormatting0(IFormattedTextDraw *ftd, DWORD options) +{ LRESULT lResult; // urls ftd->getTextService()->TxSendMessage(EM_AUTOURLDETECT, TRUE, 0, &lResult); } -void MText_InitFormatting1(TextObject *text) { +void MText_InitFormatting1(TextObject *text) +{ // bbcodes bbCodeParse(text->ftd); // smilies -// HWND hwnd = (HWND)CallServiceSync(MS_TEXT_CREATEPROXY, (WPARAM)text, 0); + // HWND hwnd = (HWND)CallServiceSync(MS_TEXT_CREATEPROXY, (WPARAM)text, 0); HWND hwnd = CreateProxyWindow(text->ftd->getTextService()); - SMADD_RICHEDIT3 sm = {0}; + SMADD_RICHEDIT3 sm = { 0 }; sm.cbSize = sizeof(sm); sm.hwndRichEditControl = hwnd; sm.rangeToReplace = 0; @@ -66,18 +68,18 @@ void MText_InitFormatting1(TextObject *text) { CallService(MS_SMILEYADD_REPLACESMILEYS, RGB(0xff, 0xff, 0xff), (LPARAM)&sm); DestroyWindow(hwnd); -// text->ftd->getTextService()->TxSendMessage(EM_SETSEL, 0, -1, &lResult); -/* - // rtl stuff - PARAFORMAT2 pf2; - pf2.cbSize = sizeof(pf2); - pf2.dwMask = PFM_ALIGNMENT|PFM_RTLPARA; - pf2.wEffects = PFE_RTLPARA; - pf2.wAlignment = PFA_RIGHT; - text->ftd->getTextService()->TxSendMessage(EM_SETSEL, 0, -1, &lResult); - text->ftd->getTextService()->TxSendMessage(EM_SETPARAFORMAT, 0, (LPARAM)&pf2, &lResult); - text->ftd->getTextService()->TxSendMessage(EM_SETSEL, 0, 0, &lResult); -*/ + // text->ftd->getTextService()->TxSendMessage(EM_SETSEL, 0, -1, &lResult); + /* + // rtl stuff + PARAFORMAT2 pf2; + pf2.cbSize = sizeof(pf2); + pf2.dwMask = PFM_ALIGNMENT|PFM_RTLPARA; + pf2.wEffects = PFE_RTLPARA; + pf2.wAlignment = PFA_RIGHT; + text->ftd->getTextService()->TxSendMessage(EM_SETSEL, 0, -1, &lResult); + text->ftd->getTextService()->TxSendMessage(EM_SETPARAFORMAT, 0, (LPARAM)&pf2, &lResult); + text->ftd->getTextService()->TxSendMessage(EM_SETSEL, 0, 0, &lResult); + */ } //--------------------------------------------------------------------------- @@ -118,8 +120,9 @@ INT_PTR MText_Register(WPARAM wParam, LPARAM lParam) //--------------------------------------------------------------------------- // allocate text object (unicode) -HANDLE DLL_CALLCONV -MTI_MTextCreateW (HANDLE userHandle, WCHAR *text) { +HANDLE DLL_CALLCONV +MTI_MTextCreateW(HANDLE userHandle, WCHAR *text) +{ TextObject *result = new TextObject; result->options = TextUserGetOptions(userHandle); @@ -135,18 +138,20 @@ MTI_MTextCreateW (HANDLE userHandle, WCHAR *text) { } -INT_PTR MText_CreateW(WPARAM wParam, LPARAM lParam) { +INT_PTR MText_CreateW(WPARAM wParam, LPARAM lParam) +{ //HANDLE userHandle = (HANDLE)wParam; //WCHAR *wtext = (WCHAR *)lParam; - return (INT_PTR)(HANDLE)MTI_MTextCreateW ((HANDLE)wParam, (WCHAR *)lParam); + return (INT_PTR)(HANDLE)MTI_MTextCreateW((HANDLE)wParam, (WCHAR *)lParam); } //--------------------------------------------------------------------------- // allocate text object (advanced) -HANDLE DLL_CALLCONV -MTI_MTextCreateEx (HANDLE userHandle, MCONTACT hContact, void *text, DWORD flags) { +HANDLE DLL_CALLCONV +MTI_MTextCreateEx(HANDLE userHandle, MCONTACT hContact, void *text, DWORD flags) +{ TextObject *result = new TextObject; result->options = TextUserGetOptions(userHandle); result->ftd = new CFormattedTextDraw; @@ -161,47 +166,51 @@ MTI_MTextCreateEx (HANDLE userHandle, MCONTACT hContact, void *text, DWORD flags return 0; } -INT_PTR MText_CreateEx(WPARAM wParam, LPARAM lParam) { +INT_PTR MText_CreateEx(WPARAM wParam, LPARAM lParam) +{ HANDLE userHandle = (HANDLE)wParam; MTEXTCREATE *textCreate = (MTEXTCREATE *)lParam; - MTI_MTextCreateEx (userHandle, textCreate->hContact, textCreate->text, textCreate->flags); + MTI_MTextCreateEx(userHandle, textCreate->hContact, textCreate->text, textCreate->flags); return 0; } //--------------------------------------------------------------------------- // measure text object -int DLL_CALLCONV -MTI_MTextMeasure (HDC dc, SIZE *sz, HANDLE text) { +int DLL_CALLCONV +MTI_MTextMeasure(HDC dc, SIZE *sz, HANDLE text) +{ if (!text) return 0; - long lWidth=sz->cx, lHeight=sz->cy; + long lWidth = sz->cx, lHeight = sz->cy; ((TextObject *)text)->ftd->get_NaturalSize(dc, &lWidth, &lHeight); sz->cx = lWidth; sz->cy = lHeight; -// FancyMeasure(((TextObject *)text)->fancy, displayInfo); + // FancyMeasure(((TextObject *)text)->fancy, displayInfo); return 0; } -INT_PTR MText_Measure(WPARAM wParam, LPARAM lParam) { +INT_PTR MText_Measure(WPARAM wParam, LPARAM lParam) +{ LPMTEXTDISPLAY displayInfo = (LPMTEXTDISPLAY)wParam; if (!displayInfo) return 0; if (!(TextObject *)displayInfo->text) return 0; - MTI_MTextMeasure (displayInfo->dc, &displayInfo->sz, displayInfo->text); + MTI_MTextMeasure(displayInfo->dc, &displayInfo->sz, displayInfo->text); return 0; } -int DLL_CALLCONV +int DLL_CALLCONV //--------------------------------------------------------------------------- // display text object -MTI_MTextDisplay (HDC dc, POINT pos, SIZE sz, HANDLE text) { +MTI_MTextDisplay(HDC dc, POINT pos, SIZE sz, HANDLE text) +{ if (!text) return 0; COLORREF cl = GetTextColor(dc); -// if (GetTextColor(dc)&0xffffff != 0) + // if (GetTextColor(dc)&0xffffff != 0) { LRESULT lResult; - CHARFORMAT cf = {0}; + CHARFORMAT cf = { 0 }; cf.cbSize = sizeof(cf); cf.dwMask = CFM_COLOR; cf.crTextColor = cl; @@ -210,7 +219,7 @@ MTI_MTextDisplay (HDC dc, POINT pos, SIZE sz, HANDLE text) { SetBkMode(dc, TRANSPARENT); - long lWidth=sz.cx, lHeight; + long lWidth = sz.cx, lHeight; ((TextObject *)text)->ftd->get_NaturalSize(dc, &lWidth, &lHeight); RECT rt; rt.left = pos.x; @@ -222,36 +231,40 @@ MTI_MTextDisplay (HDC dc, POINT pos, SIZE sz, HANDLE text) { return 0; } -INT_PTR MText_Display(WPARAM wParam, LPARAM lParam) { +INT_PTR MText_Display(WPARAM wParam, LPARAM lParam) +{ LPMTEXTDISPLAY displayInfo = (LPMTEXTDISPLAY)wParam; if (!displayInfo) return 0; if (!displayInfo->text) return 0; - MTI_MTextDisplay (displayInfo->dc, displayInfo->pos, displayInfo->sz, displayInfo->text); + MTI_MTextDisplay(displayInfo->dc, displayInfo->pos, displayInfo->sz, displayInfo->text); return 0; } -int DLL_CALLCONV +int DLL_CALLCONV //--------------------------------------------------------------------------- // set parent window for text object (this is required for mouse handling, etc) -MTI_MTextSetParent (HANDLE text, HWND hwnd, RECT rect) { +MTI_MTextSetParent(HANDLE text, HWND hwnd, RECT rect) +{ if (!text) return 0; ((TextObject *)text)->ftd->setParentWnd(hwnd, rect); return 0; } -INT_PTR MText_SetParent(WPARAM wParam, LPARAM lParam) { +INT_PTR MText_SetParent(WPARAM wParam, LPARAM lParam) +{ LPMTEXTSETPARENT info = (LPMTEXTSETPARENT)wParam; //TextObject *text = (TextObject *)info->text; if (!info) return 0; if (!info->text) return 0; - MTI_MTextSetParent (info->text, info->hwnd, info->rc); + MTI_MTextSetParent(info->text, info->hwnd, info->rc); return 0; } //--------------------------------------------------------------------------- // send message to an object -int DLL_CALLCONV -MTI_MTextSendMessage (HWND hwnd, HANDLE text, UINT msg, WPARAM wParam, LPARAM lParam) { +int DLL_CALLCONV +MTI_MTextSendMessage(HWND hwnd, HANDLE text, UINT msg, WPARAM wParam, LPARAM lParam) +{ LRESULT lResult; if (!text) return 0; ((TextObject *)text)->ftd->getTextService()->TxSendMessage(msg, wParam, lParam, &lResult); @@ -265,37 +278,42 @@ MTI_MTextSendMessage (HWND hwnd, HANDLE text, UINT msg, WPARAM wParam, LPARAM lP return lResult; } -INT_PTR MText_SendMessage(WPARAM wParam, LPARAM lParam) { +INT_PTR MText_SendMessage(WPARAM wParam, LPARAM lParam) +{ LPMTEXTMESSAGE message = (LPMTEXTMESSAGE)wParam; TextObject *text = (TextObject *)message->text; if (!message->text) return 0; - return (INT_PTR)MTI_MTextSendMessage (message->hwnd, message->text, message->msg, message->wParam, message->lParam); + return (INT_PTR)MTI_MTextSendMessage(message->hwnd, message->text, message->msg, message->wParam, message->lParam); } //--------------------------------------------------------------------------- // create a proxy window -HWND DLL_CALLCONV -MTI_MTextCreateProxy (HANDLE text) { +HWND DLL_CALLCONV +MTI_MTextCreateProxy(HANDLE text) +{ if (!text) return 0; return CreateProxyWindow(((TextObject *)text)->ftd->getTextService()); } -INT_PTR MText_CreateProxy(WPARAM wParam, LPARAM lParam) { +INT_PTR MText_CreateProxy(WPARAM wParam, LPARAM lParam) +{ if (!wParam) return 0; return (INT_PTR)MTI_MTextCreateProxy((HANDLE)wParam); } -int DLL_CALLCONV +int DLL_CALLCONV //--------------------------------------------------------------------------- // destroy text object -MTI_MTextDestroy (HANDLE text) { +MTI_MTextDestroy(HANDLE text) +{ //HANDLE textHandle = (HANDLE)wParam; //TextObject *text = (TextObject *)textHandle; if (text) delete (TextObject *)text; return 0; } -INT_PTR MText_Destroy(WPARAM wParam, LPARAM lParam) { +INT_PTR MText_Destroy(WPARAM wParam, LPARAM lParam) +{ HANDLE textHandle = (HANDLE)wParam; TextObject *text = (TextObject *)textHandle; if (text) delete text; @@ -304,21 +322,22 @@ INT_PTR MText_Destroy(WPARAM wParam, LPARAM lParam) { //--------------------------------------------------------------------------- // populate the interface -INT_PTR MText_GetInterface(WPARAM wParam, LPARAM lParam) { +INT_PTR MText_GetInterface(WPARAM wParam, LPARAM lParam) +{ MTEXT_INTERFACE *MText = (MTEXT_INTERFACE *)lParam; - if ( MText == NULL ) + if (MText == NULL) return CALLSERVICE_NOTFOUND; - MText->version = pluginInfoEx.version; - MText->Register = MTI_TextUserAdd; - MText->Create = MTI_MTextCreateW; - MText->CreateEx = MTI_MTextCreateEx; - MText->Measure = MTI_MTextMeasure; - MText->Display = MTI_MTextDisplay; - MText->SetParent = MTI_MTextSetParent; - MText->SendMsg = MTI_MTextSendMessage; + MText->version = pluginInfoEx.version; + MText->Register = MTI_TextUserAdd; + MText->Create = MTI_MTextCreateW; + MText->CreateEx = MTI_MTextCreateEx; + MText->Measure = MTI_MTextMeasure; + MText->Display = MTI_MTextDisplay; + MText->SetParent = MTI_MTextSetParent; + MText->SendMsg = MTI_MTextSendMessage; MText->CreateProxy = MTI_MTextCreateProxy; - MText->Destroy = MTI_MTextDestroy; + MText->Destroy = MTI_MTextDestroy; return S_OK; } diff --git a/plugins/mTextControl/src/textusers.cpp b/plugins/mTextControl/src/textusers.cpp index 96dad7d8c6..a5a5e89897 100644 --- a/plugins/mTextControl/src/textusers.cpp +++ b/plugins/mTextControl/src/textusers.cpp @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA HANDLE htuDefault = 0; -TextUser *textUserFirst=0; -TextUser *textUserLast=0; +TextUser *textUserFirst = 0; +TextUser *textUserLast = 0; void LoadTextUsers() { @@ -31,34 +31,30 @@ void LoadTextUsers() void UnloadTextUsers() { - while (textUserFirst) - { - delete [] textUserFirst->name; + while (textUserFirst) { + delete[] textUserFirst->name; TextUser *next = textUserFirst->next; - delete [] textUserFirst; + delete[] textUserFirst; textUserFirst = next; } } -HANDLE DLL_CALLCONV -MTI_TextUserAdd(const char *userTitle, DWORD options) +HANDLE DLL_CALLCONV MTI_TextUserAdd(const char *userTitle, DWORD options) { TextUser *textUserNew = new TextUser; - textUserNew->name = new char [mir_strlen(userTitle)+1]; + textUserNew->name = new char[mir_strlen(userTitle) + 1]; mir_strcpy(textUserNew->name, userTitle); textUserNew->options = (db_get_dw(0, MODULNAME, userTitle, options)&MTEXT_FANCY_MASK) | (textUserNew->options&MTEXT_SYSTEM_MASK); db_set_dw(0, MODULNAME, userTitle, textUserNew->options); textUserNew->prev = textUserLast; textUserNew->next = 0; - if (textUserLast) - { + if (textUserLast) { textUserLast->next = textUserNew; textUserLast = textUserNew; - } else - { - textUserFirst = textUserLast = textUserNew; } + else textUserFirst = textUserLast = textUserNew; + return (HANDLE)textUserNew; } @@ -84,5 +80,5 @@ void TextUsersReset() { for (TextUser *textUser = textUserFirst; textUser; textUser = textUser->next) textUser->options = - (db_get_dw(0, MODULNAME, textUser->name, 0)&MTEXT_FANCY_MASK) | (textUser->options&MTEXT_SYSTEM_MASK); + (db_get_dw(0, MODULNAME, textUser->name, 0)&MTEXT_FANCY_MASK) | (textUser->options&MTEXT_SYSTEM_MASK); } -- cgit v1.2.3