diff options
author | George Hazan <george.hazan@gmail.com> | 2014-12-12 15:51:22 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-12-12 15:51:22 +0000 |
commit | 6dc4fd2f8e7505ee9ed4e58401b1f3b7c3438efd (patch) | |
tree | 1967619a9d24d247f25f361806e29a9bf2dfaa2f /plugins/TabSRMM | |
parent | 9f8496a5ceeaa15fc355877fbf6401f05597383d (diff) |
- fix for drawing status bar icons;
- fix for the Unicode window procedure
git-svn-id: http://svn.miranda-ng.org/main/trunk@11348 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r-- | plugins/TabSRMM/src/container.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/generic_msghandlers.cpp | 175 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.h | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/tabctrl.cpp | 418 |
4 files changed, 270 insertions, 329 deletions
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 194f14fc89..ea04f9eebd 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -834,7 +834,7 @@ panel_found: TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA); SendMessage(pContainer->hwndStatus, SB_GETRECT, nPanel, (LPARAM)&rc); if (dat) - SI_CheckStatusIconClick(dat, pContainer->hwndStatus, nm->pt, rc, 2, ((LPNMHDR)lParam)->code); + CheckStatusIconClick(dat, pContainer->hwndStatus, nm->pt, rc, 2, ((LPNMHDR)lParam)->code); } else if (((LPNMHDR)lParam)->code == NM_RCLICK) { POINT pt; diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 492ab6b0ec..2ddf7b3d2a 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -125,7 +125,7 @@ void TSAPI DM_DismissTip(TWindowData *dat, const POINT& pt) void TSAPI DM_InitTip(TWindowData *dat) { dat->hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_NOPREFIX | TTS_BALLOON, CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, dat->hwnd, NULL, g_hInst, (LPVOID) NULL); + CW_USEDEFAULT, CW_USEDEFAULT, dat->hwnd, NULL, g_hInst, (LPVOID)NULL); memset(&dat->ti, 0, sizeof(dat->ti)); dat->ti.cbSize = sizeof(dat->ti); @@ -149,7 +149,7 @@ LRESULT TSAPI DM_GenericHotkeysCheck(MSG *message, TWindowData *dat) LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)message, (LPARAM)(TABSRMM_HK_SECTION_GENERIC)); HWND hwndDlg = dat->hwnd; - switch(mim_hotkey_check) { + switch (mim_hotkey_check) { case TABSRMM_HK_PASTEANDSEND: HandlePasteAndSend(dat); return 1; @@ -198,7 +198,7 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer, int iSelection; HMENU submenu; - switch(cmd) { + switch (cmd) { case IDC_FONTBOLD: case IDC_FONTITALIC: case IDC_FONTUNDERLINE: @@ -228,15 +228,18 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer, cf.dwEffects = isBold ? 0 : CFE_BOLD; cf.dwMask = CFM_BOLD; CheckDlgButton(hwndDlg, IDC_FONTBOLD, !isBold); - } else if (cmd == IDC_FONTITALIC) { + } + else if (cmd == IDC_FONTITALIC) { cf.dwEffects = isItalic ? 0 : CFE_ITALIC; cf.dwMask = CFM_ITALIC; CheckDlgButton(hwndDlg, IDC_FONTITALIC, !isItalic); - } else if (cmd == IDC_FONTUNDERLINE) { + } + else if (cmd == IDC_FONTUNDERLINE) { cf.dwEffects = isUnderline ? 0 : CFE_UNDERLINE; cf.dwMask = CFM_UNDERLINE; CheckDlgButton(hwndDlg, IDC_FONTUNDERLINE, !isUnderline); - } else if (cmd == IDC_FONTSTRIKEOUT) { + } + else if (cmd == IDC_FONTSTRIKEOUT) { cf.dwEffects = isStrikeout ? 0 : CFM_STRIKEOUT; cf.dwMask = CFM_STRIKEOUT; CheckDlgButton(hwndDlg, IDC_FONTSTRIKEOUT, !isStrikeout); @@ -263,14 +266,14 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer, } if (iSelection == ID_FONT_DEFAULTCOLOR) { cf.crTextColor = M.GetDword(FONTMODULE, "Font16Col", 0); - for (int i=0; i < Utils::rtf_ctable_size; i++) + for (int i = 0; i < Utils::rtf_ctable_size; i++) if (Utils::rtf_ctable[i].clr == cf.crTextColor) cf.crTextColor = RGB(GetRValue(cf.crTextColor), GetGValue(cf.crTextColor), GetBValue(cf.crTextColor) == 0 ? GetBValue(cf.crTextColor) + 1 : GetBValue(cf.crTextColor) - 1); SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); break; } - for (int i=0; i < RTF_CTABLE_DEFSIZE; i++) + for (int i = 0; i < RTF_CTABLE_DEFSIZE; i++) if (Utils::rtf_ctable[i].menuid == iSelection) { cf.crTextColor = Utils::rtf_ctable[i].clr; SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); @@ -301,7 +304,7 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer, if (dat->bShowSmileys && PluginConfig.g_SmileyAddAvail) { MCONTACT hContact = dat->cache->getActiveContact(); if (CheckValidSmileyPack(dat->cache->getProto(), hContact) != 0) { - SMADD_SHOWSEL3 smaddInfo = {0}; + SMADD_SHOWSEL3 smaddInfo = { 0 }; if (lParam == 0) GetWindowRect(GetDlgItem(hwndDlg, IDC_SMILEYBTN), &rc); @@ -417,7 +420,7 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer, iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, hwndDlg, NULL); - switch(iSelection) { + switch (iSelection) { case ID_FAVORITES_ADDCONTACTTOFAVORITES: db_set_b(dat->hContact, SRMSGMOD_T, "isFavorite", 1); AddContactToFavorites(dat->hContact, dat->cache->getNick(), dat->cache->getProto(), dat->szStatus, dat->wStatus, LoadSkinnedProtoIcon(dat->cache->getProto(), dat->cache->getStatus()), 1, PluginConfig.g_hMenuFavorites); @@ -464,7 +467,7 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer, break; case ID_SENDMENU_SENDTOCONTAINER: dat->sendMode ^= SMODE_CONTAINER; - RedrawWindow(hwndDlg, 0, 0, RDW_ERASENOW|RDW_UPDATENOW); + RedrawWindow(hwndDlg, 0, 0, RDW_ERASENOW | RDW_UPDATENOW); break; case ID_SENDMENU_FORCEANSISEND: dat->sendMode ^= SMODE_FORCEANSI; @@ -473,7 +476,7 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer, if (sendLater->isAvail()) dat->sendMode ^= SMODE_SENDLATER; else - CWarning::show(CWarning::WARN_NO_SENDLATER, MB_OK|MB_ICONINFORMATION, TranslateT("Configuration issue|The unattended send feature is disabled. The \\b1 send later\\b0 and \\b1 send to multiple contacts\\b0 features depend on it.\n\nYou must enable it under \\b1Options->Message Sessions->Advanced tweaks\\b0. Changing this option requires a restart.")); + CWarning::show(CWarning::WARN_NO_SENDLATER, MB_OK | MB_ICONINFORMATION, TranslateT("Configuration issue|The unattended send feature is disabled. The \\b1 send later\\b0 and \\b1 send to multiple contacts\\b0 features depend on it.\n\nYou must enable it under \\b1Options->Message Sessions->Advanced tweaks\\b0. Changing this option requires a restart.")); break; case ID_SENDMENU_SENDWITHOUTTIMEOUTS: dat->sendMode ^= SMODE_NOACK; @@ -487,16 +490,16 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer, db_set_b(dat->hContact, SRMSGMOD_T, "forceansi", (BYTE)(dat->sendMode & SMODE_FORCEANSI ? 1 : 0)); SetWindowPos(GetDlgItem(hwndDlg, IDC_MESSAGE), 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE); if (dat->sendMode & SMODE_MULTIPLE || dat->sendMode & SMODE_CONTAINER) { - SetWindowPos(GetDlgItem(hwndDlg, IDC_MESSAGE), 0, 0, 0, 0, 0, SWP_DRAWFRAME|SWP_FRAMECHANGED|SWP_NOZORDER| - SWP_NOMOVE|SWP_NOSIZE|SWP_NOCOPYBITS); - RedrawWindow(hwndDlg, 0, 0, RDW_INVALIDATE|RDW_ERASE|RDW_UPDATENOW|RDW_ALLCHILDREN); + SetWindowPos(GetDlgItem(hwndDlg, IDC_MESSAGE), 0, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOZORDER | + SWP_NOMOVE | SWP_NOSIZE | SWP_NOCOPYBITS); + RedrawWindow(hwndDlg, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN); } else { if (IsWindow(GetDlgItem(hwndDlg, IDC_CLIST))) DestroyWindow(GetDlgItem(hwndDlg, IDC_CLIST)); - SetWindowPos(GetDlgItem(hwndDlg, IDC_MESSAGE), 0, 0, 0, 0, 0, SWP_DRAWFRAME|SWP_FRAMECHANGED|SWP_NOZORDER| - SWP_NOMOVE|SWP_NOSIZE|SWP_NOCOPYBITS); - RedrawWindow(hwndDlg, 0, 0, RDW_INVALIDATE|RDW_ERASE|RDW_UPDATENOW|RDW_ALLCHILDREN); + SetWindowPos(GetDlgItem(hwndDlg, IDC_MESSAGE), 0, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOZORDER | + SWP_NOMOVE | SWP_NOSIZE | SWP_NOCOPYBITS); + RedrawWindow(hwndDlg, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN); } SendMessage(hwndContainer, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc); SendMessage(hwndDlg, WM_SIZE, 0, 0); @@ -527,7 +530,7 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer, SendMessage(hwndDlg, WM_SIZE, 1, 1); } - DBVARIANT dbv = {0}; + DBVARIANT dbv = { 0 }; if (0 == db_get_ts(dat->hContact, "UserInfo", "MyNotes", &dbv)) { SetDlgItemText(hwndDlg, IDC_MESSAGE, dbv.ptszVal); @@ -548,12 +551,12 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer, DM_ScrollToBottom(dat, 0, 1); } } - SetWindowPos(GetDlgItem(hwndDlg, IDC_MESSAGE), 0, 0, 0, 0, 0, SWP_DRAWFRAME|SWP_FRAMECHANGED|SWP_NOZORDER| - SWP_NOMOVE|SWP_NOSIZE|SWP_NOCOPYBITS); - RedrawWindow(hwndDlg, 0, 0, RDW_INVALIDATE|RDW_ERASE|RDW_FRAME|RDW_UPDATENOW|RDW_ALLCHILDREN); + SetWindowPos(GetDlgItem(hwndDlg, IDC_MESSAGE), 0, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOZORDER | + SWP_NOMOVE | SWP_NOSIZE | SWP_NOCOPYBITS); + RedrawWindow(hwndDlg, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); if (dat->fEditNotesActive) - CWarning::show(CWarning::WARN_EDITUSERNOTES, MB_OK|MB_ICONINFORMATION); + CWarning::show(CWarning::WARN_EDITUSERNOTES, MB_OK | MB_ICONINFORMATION); break; case IDM_CLEAR: @@ -561,7 +564,7 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer, break; case IDC_PROTOCOL: - submenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, dat->hContact, 0); + submenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, dat->hContact, 0); if (lParam == 0) GetWindowRect(GetDlgItem(hwndDlg, IDC_PROTOCOL), &rc); else @@ -574,7 +577,7 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer, DestroyMenu(submenu); break; - // error control + // error control case IDC_CANCELSEND: SendMessage(hwndDlg, DM_ERRORDECIDED, MSGERROR_CANCEL, 0); break; @@ -655,7 +658,7 @@ LRESULT TSAPI DM_ContainerCmdHandler(TContainerData *pContainer, UINT cmd, WPARA HWND hwndDlg = pContainer->hwnd; TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA); - switch(cmd) { + switch (cmd) { case IDC_CLOSE: SendMessage(hwndDlg, WM_SYSCOMMAND, SC_CLOSE, 0); break; @@ -736,17 +739,17 @@ LRESULT TSAPI DM_ContainerCmdHandler(TContainerData *pContainer, UINT cmd, WPARA ApplyContainerSetting(pContainer, (CNT_NOFLASH | CNT_FLASHALWAYS), 0, false); return 0; case ID_OPTIONS_SAVECURRENTWINDOWPOSITIONASDEFAULT: - { - WINDOWPLACEMENT wp = {0}; - wp.length = sizeof(wp); - if (GetWindowPlacement(hwndDlg, &wp)) { - db_set_dw(0, SRMSGMOD_T, "splitx", wp.rcNormalPosition.left); - db_set_dw(0, SRMSGMOD_T, "splity", wp.rcNormalPosition.top); - db_set_dw(0, SRMSGMOD_T, "splitwidth", wp.rcNormalPosition.right - wp.rcNormalPosition.left); - db_set_dw(0, SRMSGMOD_T, "splitheight", wp.rcNormalPosition.bottom - wp.rcNormalPosition.top); - } + { + WINDOWPLACEMENT wp = { 0 }; + wp.length = sizeof(wp); + if (GetWindowPlacement(hwndDlg, &wp)) { + db_set_dw(0, SRMSGMOD_T, "splitx", wp.rcNormalPosition.left); + db_set_dw(0, SRMSGMOD_T, "splity", wp.rcNormalPosition.top); + db_set_dw(0, SRMSGMOD_T, "splitwidth", wp.rcNormalPosition.right - wp.rcNormalPosition.left); + db_set_dw(0, SRMSGMOD_T, "splitheight", wp.rcNormalPosition.bottom - wp.rcNormalPosition.top); } - return 0; + } + return 0; case ID_VIEW_INFOPANEL: if (dat) { @@ -759,8 +762,8 @@ LRESULT TSAPI DM_ContainerCmdHandler(TContainerData *pContainer, UINT cmd, WPARA } return 0; - // commands from the message log popup will be routed to the - // message log menu handler + // commands from the message log popup will be routed to the + // message log menu handler case ID_MESSAGELOGSETTINGS_FORTHISCONTACT: case ID_MESSAGELOGSETTINGS_GLOBAL: if (dat) { @@ -788,7 +791,7 @@ void TSAPI DM_InitRichEdit(TWindowData *dat) char *szStreamOut = NULL; bool fIsChat = ((dat->bType == SESSIONTYPE_CHAT) ? true : false); HWND hwndLog = GetDlgItem(dat->hwnd, !fIsChat ? IDC_LOG : IDC_CHAT_LOG); - HWND hwndEdit= GetDlgItem(dat->hwnd, !fIsChat ? IDC_MESSAGE : IDC_CHAT_MESSAGE); + HWND hwndEdit = GetDlgItem(dat->hwnd, !fIsChat ? IDC_MESSAGE : IDC_CHAT_MESSAGE); HWND hwndDlg = dat->hwnd; dat->inputbg = fIsChat ? M.GetDword(FONTMODULE, "inputbg", SRMSGDEFSET_BKGCOLOUR) : dat->pContainer->theme.inputbg; @@ -825,7 +828,7 @@ void TSAPI DM_InitRichEdit(TWindowData *dat) LOGFONTA lf = dat->pContainer->theme.logFonts[MSGFONTID_MESSAGEAREA]; inputcharcolor = dat->pContainer->theme.fontColors[MSGFONTID_MESSAGEAREA]; - for (int i=0; i < Utils::rtf_ctable_size; i++) + for (int i = 0; i < Utils::rtf_ctable_size; i++) if (Utils::rtf_ctable[i].clr == inputcharcolor) inputcharcolor = RGB(GetRValue(inputcharcolor), GetGValue(inputcharcolor), GetBValue(inputcharcolor) == 0 ? GetBValue(inputcharcolor) + 1 : GetBValue(inputcharcolor) - 1); @@ -833,7 +836,7 @@ void TSAPI DM_InitRichEdit(TWindowData *dat) cf2.crTextColor = inputcharcolor; cf2.bCharSet = lf.lfCharSet; strncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE); - cf2.dwEffects = ((lf.lfWeight >= FW_BOLD) ? CFE_BOLD : 0) | (lf.lfItalic ? CFE_ITALIC : 0)|(lf.lfUnderline ? CFE_UNDERLINE : 0)|(lf.lfStrikeOut ? CFE_STRIKEOUT : 0); + cf2.dwEffects = ((lf.lfWeight >= FW_BOLD) ? CFE_BOLD : 0) | (lf.lfItalic ? CFE_ITALIC : 0) | (lf.lfUnderline ? CFE_UNDERLINE : 0) | (lf.lfStrikeOut ? CFE_STRIKEOUT : 0); cf2.wWeight = (WORD)lf.lfWeight; cf2.bPitchAndFamily = lf.lfPitchAndFamily; cf2.yHeight = abs(lf.lfHeight) * 15; @@ -883,7 +886,7 @@ void TSAPI DM_InitRichEdit(TWindowData *dat) SetWindowText(hwndEdit, _T("")); } if (szStreamOut != NULL) { - SETTEXTEX stx = {ST_DEFAULT, CP_UTF8}; + SETTEXTEX stx = { ST_DEFAULT, CP_UTF8 }; SendMessage(hwndEdit, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szStreamOut); mir_free(szStreamOut); } @@ -1004,10 +1007,10 @@ void TSAPI DM_LoadLocale(TWindowData *dat) return; DBVARIANT dbv; - if ( !db_get_ts(dat->hContact, SRMSGMOD_T, "locale", &dbv)) + if (!db_get_ts(dat->hContact, SRMSGMOD_T, "locale", &dbv)) db_free(&dbv); else { - TCHAR szKLName[KL_NAMELENGTH+1]; + TCHAR szKLName[KL_NAMELENGTH + 1]; if (!PluginConfig.m_dontUseDefaultKbd) { TCHAR szBuf[20]; GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_ILANGUAGE, szBuf, 20); @@ -1134,13 +1137,13 @@ err_out: HWND TSAPI DM_CreateClist(TWindowData *dat) { if (!sendLater->isAvail()) { - CWarning::show(CWarning::WARN_NO_SENDLATER, MB_OK|MB_ICONINFORMATION, TranslateT("Configuration issue|The unattended send feature is disabled. The \\b1 send later\\b0 and \\b1 send to multiple contacts\\b0 features depend on it.\n\nYou must enable it under \\b1Options->Message Sessions->Advanced tweaks\\b0. Changing this option requires a restart.")); + CWarning::show(CWarning::WARN_NO_SENDLATER, MB_OK | MB_ICONINFORMATION, TranslateT("Configuration issue|The unattended send feature is disabled. The \\b1 send later\\b0 and \\b1 send to multiple contacts\\b0 features depend on it.\n\nYou must enable it under \\b1Options->Message Sessions->Advanced tweaks\\b0. Changing this option requires a restart.")); dat->sendMode &= ~SMODE_MULTIPLE; return 0; } HWND hwndClist = CreateWindowExA(0, "CListControl", "", WS_TABSTOP | WS_VISIBLE | WS_CHILD | 0x248, - 184, 0, 30, 30, dat->hwnd, (HMENU)IDC_CLIST, g_hInst, NULL); + 184, 0, 30, 30, dat->hwnd, (HMENU)IDC_CLIST, g_hInst, NULL); SendMessage(hwndClist, WM_TIMER, 14, 0); HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_FINDCONTACT, dat->hContact, 0); @@ -1164,7 +1167,7 @@ HWND TSAPI DM_CreateClist(TWindowData *dat) SendMessage(hwndClist, CLM_FIRST + 106, 0, 1); SendMessage(hwndClist, CLM_AUTOREBUILD, 0, 0); if (hwndClist) - RedrawWindow(hwndClist, 0, 0, RDW_INVALIDATE|RDW_ERASE|RDW_UPDATENOW); + RedrawWindow(hwndClist, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW); return hwndClist; } @@ -1404,7 +1407,7 @@ void TSAPI DM_Typing(TWindowData *dat, bool fForceOff) SendMessage(hwndStatus, SB_SETTEXT, 0, (LPARAM)dat->szStatusBar); } SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0); - HandleIconFeedback(dat, (HICON) - 1); + HandleIconFeedback(dat, (HICON)-1); TWindowData *dat_active = (TWindowData*)GetWindowLongPtr(dat->pContainer->hwndActive, GWLP_USERDATA); if (dat_active && dat_active->bType == SESSIONTYPE_IM) SendMessage(hwndContainer, DM_UPDATETITLE, 0, 0); @@ -1535,7 +1538,7 @@ int TSAPI DM_SplitterGlobalEvent(TWindowData *dat, WPARAM wParam, LPARAM lParam) AdjustBottomAvatarDisplay(dat); DM_RecalcPictureSize(dat); SendMessage(dat->hwnd, WM_SIZE, 0, 0); - DM_ScrollToBottom(dat, 1,1); + DM_ScrollToBottom(dat, 1, 1); if (dat != srcDat) CSkin::UpdateToolbarBG(dat); } @@ -1626,21 +1629,21 @@ void TSAPI DM_EventAdded(TWindowData *dat, WPARAM hContact, LPARAM lParam) // handle tab flashing if (!bDisableNotify && !bIsStatusChangeEvent) - if ((TabCtrl_GetCurSel(hwndTab) != dat->iTabID) && !(dbei.flags & DBEF_SENT)) { - switch (dbei.eventType) { - case EVENTTYPE_MESSAGE: - dat->iFlashIcon = PluginConfig.g_IconMsgEvent; - break; - case EVENTTYPE_FILE: - dat->iFlashIcon = PluginConfig.g_IconFileEvent; - break; - default: - dat->iFlashIcon = PluginConfig.g_IconMsgEvent; - break; + if ((TabCtrl_GetCurSel(hwndTab) != dat->iTabID) && !(dbei.flags & DBEF_SENT)) { + switch (dbei.eventType) { + case EVENTTYPE_MESSAGE: + dat->iFlashIcon = PluginConfig.g_IconMsgEvent; + break; + case EVENTTYPE_FILE: + dat->iFlashIcon = PluginConfig.g_IconFileEvent; + break; + default: + dat->iFlashIcon = PluginConfig.g_IconMsgEvent; + break; + } + SetTimer(hwndDlg, TIMERID_FLASHWND, TIMEOUT_FLASHWND, NULL); + dat->mayFlashTab = TRUE; } - SetTimer(hwndDlg, TIMERID_FLASHWND, TIMEOUT_FLASHWND, NULL); - dat->mayFlashTab = TRUE; - } // try to flash the contact list... if (!bDisableNotify) @@ -1665,12 +1668,12 @@ void TSAPI DM_EventAdded(TWindowData *dat, WPARAM hContact, LPARAM lParam) // flash window if it is not focused if (!bDisableNotify && !bIsStatusChangeEvent) - if ((GetActiveWindow() != hwndContainer || GetForegroundWindow() != hwndContainer || dat->pContainer->hwndActive != hwndDlg) && !(dbei.flags & DBEF_SENT)) { - if (!(m_pContainer->dwFlags & CNT_NOFLASH) && (GetActiveWindow() != hwndContainer || GetForegroundWindow() != hwndContainer)) - FlashContainer(m_pContainer, 1, 0); - SendMessage(hwndContainer, DM_SETICON, (WPARAM)dat, (LPARAM)LoadSkinnedIcon(SKINICON_EVENT_MESSAGE)); - m_pContainer->dwFlags |= CNT_NEED_UPDATETITLE; - } + if ((GetActiveWindow() != hwndContainer || GetForegroundWindow() != hwndContainer || dat->pContainer->hwndActive != hwndDlg) && !(dbei.flags & DBEF_SENT)) { + if (!(m_pContainer->dwFlags & CNT_NOFLASH) && (GetActiveWindow() != hwndContainer || GetForegroundWindow() != hwndContainer)) + FlashContainer(m_pContainer, 1, 0); + SendMessage(hwndContainer, DM_SETICON, (WPARAM)dat, (LPARAM)LoadSkinnedIcon(SKINICON_EVENT_MESSAGE)); + m_pContainer->dwFlags |= CNT_NEED_UPDATETITLE; + } // play a sound if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & (DBEF_SENT))) @@ -1754,7 +1757,7 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam) bool bHasName = (dat->cache->getUIN()[0] != 0); dat->idle = dat->cache->getIdleTS(); - dat->dwFlagsEx = dat->idle ? dat->dwFlagsEx | MWF_SHOW_ISIDLE : dat->dwFlagsEx & ~MWF_SHOW_ISIDLE; + dat->dwFlagsEx = dat->idle ? dat->dwFlagsEx | MWF_SHOW_ISIDLE : dat->dwFlagsEx & ~MWF_SHOW_ISIDLE; dat->wStatus = dat->cache->getStatus(); _tcsncpy_s(dat->szStatus, pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : dat->wStatus, 0), _TRUNCATE); @@ -1772,7 +1775,8 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam) mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s (%s)"), newcontactname, dat->szStatus); else _tcsncpy_s(newtitle, newcontactname, _TRUNCATE); - } else + } + else _tcsncpy_s(newtitle, _T("Forward"), _TRUNCATE); item.mask |= TCIF_TEXT; @@ -1782,12 +1786,12 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam) TCHAR fulluin[256]; if (dat->bIsMeta) mir_sntprintf(fulluin, SIZEOF(fulluin), - TranslateT("UID: %s (SHIFT click -> copy to clipboard)\nClick for User's Details\nRight click for metacontact control\nClick dropdown to add or remove user from your favorites."), - bHasName ? dat->cache->getUIN() : TranslateT("No UID")); + TranslateT("UID: %s (SHIFT click -> copy to clipboard)\nClick for User's Details\nRight click for metacontact control\nClick dropdown to add or remove user from your favorites."), + bHasName ? dat->cache->getUIN() : TranslateT("No UID")); else mir_sntprintf(fulluin, SIZEOF(fulluin), - TranslateT("UID: %s (SHIFT click -> copy to clipboard)\nClick for User's Details\nClick dropdown to change this contact's favorite status."), - bHasName ? dat->cache->getUIN() : TranslateT("No UID")); + TranslateT("UID: %s (SHIFT click -> copy to clipboard)\nClick for User's Details\nClick dropdown to change this contact's favorite status."), + bHasName ? dat->cache->getUIN() : TranslateT("No UID")); SendMessage(GetDlgItem(hwndDlg, IDC_NAME), BUTTONADDTOOLTIP, (WPARAM)fulluin, BATF_TCHAR); } @@ -1802,7 +1806,7 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam) if (dat->pWnd) dat->pWnd->updateTitle(dat->cache->getNick()); } - if (dat->iTabID >= 0) { + if (dat->iTabID >= 0) { TabCtrl_SetItem(hwndTab, dat->iTabID, &item); if (m_pContainer->dwFlags & CNT_SIDEBAR) m_pContainer->SideBar->updateSession(dat); @@ -1813,16 +1817,17 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam) UpdateTrayMenuState(dat, TRUE); if (dat->cache->isFavorite()) AddContactToFavorites(dat->hContact, dat->cache->getNick(), szActProto, dat->szStatus, dat->wStatus, - LoadSkinnedProtoIcon(dat->cache->getProto(), dat->cache->getStatus()), 0, PluginConfig.g_hMenuFavorites); + LoadSkinnedProtoIcon(dat->cache->getProto(), dat->cache->getStatus()), 0, PluginConfig.g_hMenuFavorites); if (dat->cache->isRecent()) AddContactToFavorites(dat->hContact, dat->cache->getNick(), szActProto, dat->szStatus, dat->wStatus, - LoadSkinnedProtoIcon(dat->cache->getProto(), dat->cache->getStatus()), 0, PluginConfig.g_hMenuRecent); + LoadSkinnedProtoIcon(dat->cache->getProto(), dat->cache->getStatus()), 0, PluginConfig.g_hMenuRecent); dat->Panel->Invalidate(); if (dat->pWnd) dat->pWnd->Invalidate(); } + // care about MetaContacts and update the statusbar icon with the currently "most online" contact... if (dat->bIsMeta) { PostMessage(hwndDlg, DM_UPDATEMETACONTACTINFO, 0, 0); @@ -1850,19 +1855,19 @@ static int OnSrmmIconChanged(WPARAM hContact, LPARAM) return 0; } -void DrawStatusIcons(TWindowData *dat, HDC hDC, RECT r, int gap) +void DrawStatusIcons(TWindowData *dat, HDC hDC, const RECT &rc, int gap) { HICON hIcon = NULL; - int x = r.left; LONG cx_icon = PluginConfig.m_smcxicon; LONG cy_icon = PluginConfig.m_smcyicon; - LONG y = (r.top + r.bottom - cx_icon) >> 1; + int x = rc.left; + LONG y = (rc.top + rc.bottom - cx_icon) >> 1; SetBkMode(hDC, TRANSPARENT); int nIcon = 0; while (StatusIconData *si = Srmm_GetNthIcon(dat->hContact, nIcon++)) { - if ( !strcmp(si->szModule, MSG_ICON_MODULE)) { + if (!strcmp(si->szModule, MSG_ICON_MODULE)) { if (si->dwId == MSG_ICON_SOUND) { DrawIconEx(hDC, x, y, PluginConfig.g_buttonBarIcons[ICON_DEFAULT_SOUNDS], cx_icon, cy_icon, 0, NULL, DI_NORMAL); @@ -1900,7 +1905,7 @@ void DrawStatusIcons(TWindowData *dat, HDC hDC, RECT r, int gap) } } -void SI_CheckStatusIconClick(TWindowData *dat, HWND hwndFrom, POINT pt, RECT r, int gap, int code) +void CheckStatusIconClick(TWindowData *dat, HWND hwndFrom, POINT pt, const RECT &rc, int gap, int code) { if (dat && (code == NM_CLICK || code == NM_RCLICK)) { POINT ptScreen; @@ -1909,12 +1914,12 @@ void SI_CheckStatusIconClick(TWindowData *dat, HWND hwndFrom, POINT pt, RECT r, return; } - UINT iconNum = (pt.x - (r.left + 0)) / (PluginConfig.m_smcxicon + gap), list_icons = 0; + UINT iconNum = (pt.x - (rc.left + 0)) / (PluginConfig.m_smcxicon + gap), list_icons = 0; StatusIconData *si = Srmm_GetNthIcon((dat) ? dat->hContact : 0, iconNum); if (si == NULL) return; - if ( !strcmp(si->szModule, MSG_ICON_MODULE)) { + if (!strcmp(si->szModule, MSG_ICON_MODULE)) { if (si->dwId == MSG_ICON_SOUND && code != NM_RCLICK) { if (GetKeyState(VK_SHIFT) & 0x8000) { for (TContainerData *p = pFirstContainer; p; p = p->pNext) { diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index ece91eba46..36b0280310 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -981,8 +981,8 @@ int SI_InitStatusIcons(); int SI_DeinitStatusIcons();
int GetStatusIconsCount();
-void DrawStatusIcons(TWindowData *dat, HDC hdc, RECT r, int gap);
-void SI_CheckStatusIconClick(TWindowData *dat, HWND hwndFrom, POINT pt, RECT rc, int gap, int code);
+void DrawStatusIcons(TWindowData *dat, HDC hdc, const RECT &r, int gap);
+void CheckStatusIconClick(TWindowData *dat, HWND hwndFrom, POINT pt, const RECT &rc, int gap, int code);
struct SKINDESC
{
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp index 42e88c3b89..b90419cf5e 100644 --- a/plugins/TabSRMM/src/tabctrl.cpp +++ b/plugins/TabSRMM/src/tabctrl.cpp @@ -35,7 +35,7 @@ static WNDPROC OldTabControlClassProc; static int TabCtrl_TestForCloseButton(const TabControlData *tabdat, HWND hwnd, POINT& pt)
{
- TCHITTESTINFO tci = {0};
+ TCHITTESTINFO tci = { 0 };
tci.pt.x = pt.x;
tci.pt.y = pt.y;
int iTab;
@@ -65,19 +65,17 @@ static int TabCtrl_TestForCloseButton(const TabControlData *tabdat, HWND hwnd, P return -1;
}
-/*
- * tabctrl helper function
- * Finds leftmost down item.
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// tabctrl helper function
+// Finds leftmost down item.
static UINT FindLeftDownItem(HWND hwnd)
{
- RECT rctLeft = {100000, 0, 0, 0}, rctCur;
+ RECT rctLeft = { 100000, 0, 0, 0 }, rctCur;
int nCount = TabCtrl_GetItemCount(hwnd) - 1;
UINT nItem = 0;
- int i;
- for (i=0;i < nCount;i++) {
+ for (int i = 0; i < nCount; i++) {
TabCtrl_GetItemRect(hwnd, i, &rctCur);
if (rctCur.left > 0 && rctCur.left <= rctLeft.left) {
if (rctCur.bottom > rctLeft.bottom) {
@@ -89,11 +87,11 @@ static UINT FindLeftDownItem(HWND hwnd) return nItem;
}
-/*
- * tab control color definitions, including the database setting key names
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// tab control color definitions, including the database setting key names
-static struct colOptions {
+static struct colOptions
+{
UINT defclr;
char *szKey;
char *szSkinnedKey;
@@ -109,9 +107,8 @@ static struct colOptions { 0, 0, NULL, NULL
};
-/*
- * hints for drawing functions
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// hints for drawing functions
#define HINT_ACTIVATE_RIGHT_SIDE 1
#define HINT_ACTIVE_ITEM 2
@@ -147,12 +144,11 @@ void TSAPI FillTabBackground(const HDC hdc, int iStateId, const TWindowData *dat CSkin::FillBack(hdc, rc);
}
-/*
- * draws the item contents (icon and label)
- * it obtains the label and icon handle directly from the message window data
- * no image list is used and necessary, the message window dialog procedure has to provide a valid
- * icon handle in dat->hTabIcon
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// draws the item contents (icon and label)
+// it obtains the label and icon handle directly from the message window data
+// no image list is used and necessary, the message window dialog procedure has to provide a valid
+// icon handle in dat->hTabIcon
static void DrawItem(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint, int nItem, TWindowData *dat)
{
@@ -204,7 +200,7 @@ static void DrawItem(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint, in CSkin::m_default_bf.SourceConstantAlpha = 150;
GdiAlphaBlend(dc, rcItem->right - 16 - tabdat->m_xpad, (rcItem->bottom + rcItem->top - 16) / 2, 16, 16, CSkin::m_tabCloseHDC,
- 0, 0, 16, 16, CSkin::m_default_bf);
+ 0, 0, 16, 16, CSkin::m_default_bf);
rcItem->right -= (18 + tabdat->m_xpad);
CSkin::m_default_bf.SourceConstantAlpha = 255;
@@ -213,7 +209,7 @@ static void DrawItem(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint, in if (dat->mayFlashTab == FALSE || (dat->mayFlashTab == TRUE && dat->bTabFlash != 0) || !(dat->pContainer->dwFlagsEx & TCF_FLASHLABEL)) {
DWORD dwTextFlags = DT_SINGLELINE | DT_VCENTER;
HFONT oldFont = (HFONT)SelectObject(dc, (HFONT)SendMessage(tabdat->hwnd, WM_GETFONT, 0, 0));
- if (tabdat->dwStyle & TCS_BUTTONS || !(tabdat->dwStyle & TCS_MULTILINE)) { // || (tabdat->m_moderntabs && leftMost)) {
+ if (tabdat->dwStyle & TCS_BUTTONS || !(tabdat->dwStyle & TCS_MULTILINE)) {
rcItem->right -= tabdat->m_xpad;
dwTextFlags |= DT_WORD_ELLIPSIS;
}
@@ -224,11 +220,10 @@ static void DrawItem(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint, in SetBkMode(dc, oldMode);
}
-/*
- * draws the item rect (the "tab") in *classic* style (no visual themes
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// draws the item rect (the "tab") in *classic* style (no visual themes
-static RECT rcTabPage = {0};
+static RECT rcTabPage = { 0 };
static void DrawItemRect(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint, int iItem, const TWindowData *dat)
{
@@ -238,11 +233,8 @@ static void DrawItemRect(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint rcItem->bottom -= 1;
if (rcItem->left >= 0) {
- /*
- * draw "button style" tabs... raised edge for hottracked, sunken edge for active (pushed)
- * otherwise, they get a normal border
- */
-
+ // draw "button style" tabs... raised edge for hottracked, sunken edge for active (pushed)
+ // otherwise, they get a normal border
if (dwStyle & TCS_BUTTONS) {
BOOL bClassicDraw = (tabdat->m_VisualStyles == FALSE);
@@ -285,10 +277,12 @@ static void DrawItemRect(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint if (!item->IGNORED) {
CSkin::SkinDrawBG(tabdat->hwnd, tabdat->pContainer->hwnd, tabdat->pContainer, rcItem, dc);
CSkin::DrawItem(dc, rcItem, item);
- } else
+ }
+ else
goto b_nonskinned;
- } else {
-b_nonskinned:
+ }
+ else {
+ b_nonskinned:
if (nHint & HINT_ACTIVE_ITEM)
DrawEdge(dc, rcItem, EDGE_ETCHED, BF_RECT | BF_SOFT);
else if (nHint & HINT_HOTTRACK)
@@ -296,7 +290,8 @@ b_nonskinned: else
DrawEdge(dc, rcItem, EDGE_RAISED, BF_RECT | BF_SOFT);
}
- } else {
+ }
+ else {
if (M.isAero() && !(dwStyle & TCS_BOTTOM))
FillRect(dc, rcItem, CSkin::m_BrushBack);
else
@@ -312,7 +307,8 @@ b_nonskinned: if (!CSkin::m_skinEnabled)
CSkin::FillBack(dc, rcItem);
rcItem->bottom += 2;
- } else {
+ }
+ else {
rcItem->bottom += 2;
if (!CSkin::m_skinEnabled)
CSkin::FillBack(dc, rcItem);
@@ -333,13 +329,12 @@ b_nonskinned: }
if (CSkin::m_skinEnabled) {
CSkinItem *item = &SkinItems[dwStyle & TCS_BOTTOM ? (nHint & HINT_HOTTRACK ? ID_EXTBKTABITEMHOTTRACKBOTTOM : ID_EXTBKTABITEMBOTTOM) :
- (nHint & HINT_HOTTRACK ? ID_EXTBKTABITEMHOTTRACK : ID_EXTBKTABITEM)];
+ (nHint & HINT_HOTTRACK ? ID_EXTBKTABITEMHOTTRACK : ID_EXTBKTABITEM)];
if (!item->IGNORED) {
if (dwStyle & TCS_BOTTOM)
rcItem->top = (rcItem->top > rcTabPage.bottom + 5) ? --rcItem->top : rcItem->top;
else
rcItem->bottom++;
- //rcItem->bottom = (rcItem->bottom < rcTabPage.top - 5) ? ++rcItem->bottom : rcItem->bottom;
rcItem->left += item->MARGIN_LEFT;
rcItem->right -= item->MARGIN_RIGHT;
@@ -360,8 +355,9 @@ b_nonskinned: SelectObject(dc, PluginConfig.tabConfig.m_hPenItemShadow);
LineTo(dc, rcItem->right - 2, rcItem->bottom - 1);
MoveToEx(dc, rcItem->right - 3, rcItem->bottom - 1, &pt);
- LineTo(dc, rcItem->left + 2, rcItem->bottom - 1);
- } else {
+ LineTo(dc, rcItem->left + 2, rcItem->bottom - 1);
+ }
+ else {
MoveToEx(dc, rcItem->left, rcItem->bottom, &pt);
LineTo(dc, rcItem->left, rcItem->top + 2);
LineTo(dc, rcItem->left + 2, rcItem->top);
@@ -414,9 +410,9 @@ static HRESULT DrawThemesPartWithAero(const TabControlData *tabdat, HDC hDC, int return hResult;
}
-/*
- * draws a theme part (identifier in uiPartNameID) using the given clipping rectangle
- */
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// draws a theme part (identifier in uiPartNameID) using the given clipping rectangle
static HRESULT DrawThemesPart(const TabControlData *tabdat, HDC hDC, int iPartId, int iStateId, LPRECT prcBox)
{
@@ -428,69 +424,58 @@ static HRESULT DrawThemesPart(const TabControlData *tabdat, HDC hDC, int iPartId return hResult;
}
-/*
- * draw a themed tab item. either a tab or the body pane
- * handles image mirroring for tabs at the bottom
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// draw a themed tab item. either a tab or the body pane
+// handles image mirroring for tabs at the bottom
static void DrawThemesXpTabItem(HDC pDC, int ixItem, RECT *rcItem, UINT uiFlag, TabControlData *tabdat, TWindowData *dat)
{
- BOOL bBody = (uiFlag & 1) ? TRUE : FALSE;
- BOOL bSel = (uiFlag & 2) ? TRUE : FALSE;
- BOOL bHot = (uiFlag & 4) ? TRUE : FALSE;
+ BOOL bBody = (uiFlag & 1) ? TRUE : FALSE;
+ BOOL bSel = (uiFlag & 2) ? TRUE : FALSE;
+ BOOL bHot = (uiFlag & 4) ? TRUE : FALSE;
BOOL bBottom = (uiFlag & 8) ? TRUE : FALSE; // mirror
- SIZE szBmp;
- HDC dcMem;
- HBITMAP bmpMem, pBmpOld;
- RECT rcMem;
- BITMAPINFO biOut;
- BITMAPINFOHEADER *bihOut;
- int nBmpWdtPS;
- int nSzBuffPS;
- LPBYTE pcImg = NULL, pcImg1 = NULL;
+ LPBYTE pcImg = NULL;
int nStart = 0, nLenSub = 0;
+
+ SIZE szBmp;
szBmp.cx = rcItem->right - rcItem->left;
szBmp.cy = rcItem->bottom - rcItem->top;
- /*
- * for top row tabs, it's easy. Just draw to the provided dc (it's a mem dc already)
- */
-
+ // for top row tabs, it's easy. Just draw to the provided dc (it's a mem dc already)
if (!bBottom) {
if (bBody) {
if (PluginConfig.m_bIsVista) {
- rcItem->right += 2; // hide right tab sheet shadow (only draw the actual border line)
+ rcItem->right += 2; // hide right tab sheet shadow (only draw the actual border line)
rcItem->bottom += 1;
}
DrawThemesPart(tabdat, pDC, 9, 0, rcItem); // TABP_PANE id = 9
- } else {
- int iStateId = bSel ? 3 : (bHot ? 2 : 1); // leftmost item has different part id
+ }
+ else {
+ int iStateId = bSel ? 3 : (bHot ? 2 : 1); // leftmost item has different part id
DrawThemesPartWithAero(tabdat, pDC, rcItem->left < 20 ? 2 : 1, iStateId, rcItem, dat);
}
return;
}
else if (tabdat->fAeroTabs && !bBody) {
- int iStateId = bSel ? 3 : (bHot ? 2 : 1); // leftmost item has different part id
+ int iStateId = bSel ? 3 : (bHot ? 2 : 1); // leftmost item has different part id
DrawThemesPartWithAero(tabdat, pDC, rcItem->left < 20 ? 2 : 1, iStateId, rcItem, dat);
return;
}
- /*
- * remaining code is for bottom tabs only.
- */
-
- dcMem = CreateCompatibleDC(pDC);
- bmpMem = CreateCompatibleBitmap(pDC, szBmp.cx, szBmp.cy);
-
- pBmpOld = (HBITMAP)SelectObject(dcMem, bmpMem);
+ // remaining code is for bottom tabs only.
+ HDC dcMem = CreateCompatibleDC(pDC);
+ HBITMAP bmpMem = CreateCompatibleBitmap(pDC, szBmp.cx, szBmp.cy);
+ HBITMAP pBmpOld = (HBITMAP)SelectObject(dcMem, bmpMem);
+ RECT rcMem;
rcMem.left = rcMem.top = 0;
rcMem.right = szBmp.cx;
rcMem.bottom = szBmp.cy;
+ BITMAPINFO biOut;
memset(&biOut, 0, sizeof(BITMAPINFO)); // Fill local pixel arrays
- bihOut = &biOut.bmiHeader;
-
+
+ BITMAPINFOHEADER *bihOut = &biOut.bmiHeader;
bihOut->biSize = sizeof(BITMAPINFOHEADER);
bihOut->biCompression = BI_RGB;
bihOut->biPlanes = 1;
@@ -498,28 +483,22 @@ static void DrawThemesXpTabItem(HDC pDC, int ixItem, RECT *rcItem, UINT uiFlag, bihOut->biWidth = szBmp.cx;
bihOut->biHeight = szBmp.cy;
- nBmpWdtPS = DWordAlign(szBmp.cx * 3);
- nSzBuffPS = ((nBmpWdtPS * szBmp.cy) / 8 + 2) * 8;
-
- /*
- * blit the background to the memory dc, so that transparent tabs will draw properly
- * for bottom tabs, it's more complex, because the background part must not be mirrored
- * the body part does not need that (filling with the background color is much faster
- * and sufficient for the tab "page" part.
- */
+ int nBmpWdtPS = DWordAlign(szBmp.cx * 3);
+ int nSzBuffPS = ((nBmpWdtPS * szBmp.cy) / 8 + 2) * 8;
+ // blit the background to the memory dc, so that transparent tabs will draw properly
+ // for bottom tabs, it's more complex, because the background part must not be mirrored
+ // the body part does not need that (filling with the background color is much faster
+ // and sufficient for the tab "page" part.
if (!bSel)
CSkin::FillBack(dcMem, &rcMem);
else {
- /*
- * mirror the background horizontally for bottom selected tabs (they can overwrite others)
- * needed, because after drawing the theme part the images will again be mirrored
- * to "flip" the tab item.
- */
+ // mirror the background horizontally for bottom selected tabs (they can overwrite others)
+ // needed, because after drawing the theme part the images will again be mirrored
+ // to "flip" the tab item.
BitBlt(dcMem, 0, 0, szBmp.cx, szBmp.cy, pDC, rcItem->left, rcItem->top, SRCCOPY);
- pcImg1 = (BYTE *)mir_alloc(nSzBuffPS);
-
+ BYTE *pcImg1 = (BYTE*)mir_alloc(nSzBuffPS);
if (pcImg1) {
GetDIBits(pDC, bmpMem, nStart, szBmp.cy - nLenSub, pcImg1, &biOut, DIB_RGB_COLORS);
bihOut->biHeight = -szBmp.cy; // to mirror bitmap is eough to use negative height between Get/SetDIBits
@@ -528,17 +507,14 @@ static void DrawThemesXpTabItem(HDC pDC, int ixItem, RECT *rcItem, UINT uiFlag, }
}
- /*
- * body may be *large* so rotating the final image can be very slow.
- * workaround: draw the skin item (tab pane) into a small dc, rotate this (small) image and render
- * it to the final DC with the IMG_RenderItem() routine.
- */
-
+ // body may be *large* so rotating the final image can be very slow.
+ // workaround: draw the skin item (tab pane) into a small dc, rotate this (small) image and render
+ // it to the final DC with the IMG_RenderItem() routine.
if (bBody) {
HDC hdcTemp = CreateCompatibleDC(pDC);
HBITMAP hbmTemp = CreateCompatibleBitmap(pDC, 100, 50);
HBITMAP hbmTempOld = (HBITMAP)SelectObject(hdcTemp, hbmTemp);
- RECT rcTemp = {0};
+ RECT rcTemp = { 0 };
rcTemp.right = 100;
rcTemp.bottom = 50;
@@ -552,18 +528,17 @@ static void DrawThemesXpTabItem(HDC pDC, int ixItem, RECT *rcItem, UINT uiFlag, CSkin::FillBack(hdcTemp, &rcTemp);
DrawThemesPart(tabdat, hdcTemp, 9, 0, &rcTemp); // TABP_PANE id = 9
pcImg = (BYTE *)mir_alloc(nSzBuffPS);
- if (pcImg) { // get bits:
+ if (pcImg) { // get bits:
GetDIBits(hdcTemp, hbmTemp, nStart, 50 - nLenSub, pcImg, &biOut, DIB_RGB_COLORS);
bihOut->biHeight = -50;
SetDIBits(hdcTemp, hbmTemp, nStart, 50 - nLenSub, pcImg, &biOut, DIB_RGB_COLORS);
mir_free(pcImg);
}
CImageItem tempItem(10, 10, 10, 10, hdcTemp, 0, IMAGE_FLAG_DIVIDED | IMAGE_FILLSOLID,
- GetSysColorBrush(COLOR_3DFACE), 255, 30, 80, 50, 100);
+ GetSysColorBrush(COLOR_3DFACE), 255, 30, 80, 50, 100);
- if (PluginConfig.m_bIsVista) { // hide right tab sheet shadow (only draw the actual border line)
+ if (PluginConfig.m_bIsVista) // hide right tab sheet shadow (only draw the actual border line)
rcItem->right += 2;
- }
tempItem.Render(pDC, rcItem, true);
tempItem.Clear();
@@ -575,7 +550,8 @@ static void DrawThemesXpTabItem(HDC pDC, int ixItem, RECT *rcItem, UINT uiFlag, DeleteObject(bmpMem);
DeleteDC(dcMem);
return;
- } else {
+ }
+ else {
int iStateId = bSel ? 3 : (bHot ? 2 : 1);
DrawThemesPart(tabdat, dcMem, rcItem->left < 20 ? 2 : 1, iStateId, &rcMem);
}
@@ -583,33 +559,30 @@ static void DrawThemesXpTabItem(HDC pDC, int ixItem, RECT *rcItem, UINT uiFlag, bihOut->biHeight = szBmp.cy;
pcImg = (BYTE *)mir_alloc(nSzBuffPS);
- if (pcImg) { // get bits:
+ if (pcImg) { // get bits:
GetDIBits(pDC, bmpMem, nStart, szBmp.cy - nLenSub, pcImg, &biOut, DIB_RGB_COLORS);
bihOut->biHeight = -szBmp.cy;
SetDIBits(pDC, bmpMem, nStart, szBmp.cy - nLenSub, pcImg, &biOut, DIB_RGB_COLORS);
mir_free(pcImg);
}
- /*
- * finally, blit the result to the destination dc
- */
-
+ // finally, blit the result to the destination dc
BitBlt(pDC, rcItem->left, rcItem->top, szBmp.cx, szBmp.cy, dcMem, 0, 0, SRCCOPY);
SelectObject(dcMem, pBmpOld);
DeleteObject(bmpMem);
DeleteDC(dcMem);
}
-static POINT ptMouseT = {0};
+static POINT ptMouseT = { 0 };
static void PaintWorker(HWND hwnd, TabControlData *tabdat)
{
PAINTSTRUCT ps;
HDC hdc;
RECT rectTemp, rctPage, rctActive, rcItem, rctClip, rctOrig;
- RECT rectUpDn = {0, 0, 0, 0};
+ RECT rectUpDn = { 0, 0, 0, 0 };
int nCount = TabCtrl_GetItemCount(hwnd), i;
- TCITEM item = {0};
+ TCITEM item = { 0 };
int iActive, hotItem;
POINT pt;
DWORD dwStyle = tabdat->dwStyle;
@@ -620,7 +593,7 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat) bool isAero = M.isAero();
HANDLE hpb = 0;
BOOL bClassicDraw = !isAero && (tabdat->m_VisualStyles == FALSE || CSkin::m_skinEnabled);
- if ( GetUpdateRect(hwnd, NULL, TRUE) == 0)
+ if (GetUpdateRect(hwnd, NULL, TRUE) == 0)
return;
item.mask = TCIF_PARAM;
@@ -636,19 +609,16 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat) else
tabdat->fAeroTabs = 0;
- tabdat->helperItem = (dwStyle & TCS_BOTTOM) ? CSkin::m_tabBottom : CSkin::m_tabTop;
+ tabdat->helperItem = (dwStyle & TCS_BOTTOM) ? CSkin::m_tabBottom : CSkin::m_tabTop;
tabdat->helperGlowItem = (dwStyle & TCS_BOTTOM) ? CSkin::m_tabGlowBottom : CSkin::m_tabGlowTop;
}
else tabdat->fAeroTabs = FALSE;
HDC hdcreal = BeginPaint(hwnd, &ps);
- /*
- * switchbar is active, don't paint a single pixel, the tab control won't be visible at all
- * same when we have only ONE tab and do not want it to be visible because of the container
- * option "Show tab bar only when needed".
- */
-
+ // switchbar is active, don't paint a single pixel, the tab control won't be visible at all
+ // same when we have only ONE tab and do not want it to be visible because of the container
+ // option "Show tab bar only when needed".
if ((tabdat->pContainer->dwFlags & CNT_SIDEBAR) || (nCount == 1 && tabdat->pContainer->dwFlags & CNT_HIDETABS)) {
if (nCount == 0)
FillRect(hdcreal, &ps.rcPaint, GetSysColorBrush(COLOR_3DFACE)); // avoid flickering/ugly black background during container creation
@@ -663,10 +633,7 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat) int cx = rctPage.right - rctPage.left;
int cy = rctPage.bottom - rctPage.top;
- /*
- * draw everything to a memory dc to avoid flickering
- */
-
+ // draw everything to a memory dc to avoid flickering
if (CMimAPI::m_haveBufferedPaint)
hpb = tabdat->hbp = CSkin::InitiateBufferedPaint(hdcreal, rctPage, hdc);
else {
@@ -713,10 +680,8 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat) else memset(&rctClip, 0, sizeof(RECT));
HPEN hPenOld = (HPEN)SelectObject(hdc, PluginConfig.tabConfig.m_hPenLight);
- /*
- * visual style support
- */
+ // visual style support
CopyRect(&rcTabPage, &rctPage);
if (!tabdat->bRefreshWithoutClip)
ExcludeClipRect(hdc, rctClip.left, rctClip.top, rctClip.right, rctClip.bottom);
@@ -727,7 +692,8 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat) if (dwStyle & TCS_BOTTOM) {
rcClient.bottom = rctPage.bottom;
uiFlags |= uiBottom;
- } else
+ }
+ else
rcClient.top = rctPage.top;
if (PluginConfig.m_fillColor)
DrawCustomTabPage(hdc, rcClient);
@@ -736,13 +702,11 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat) if (tabdat->bRefreshWithoutClip)
goto skip_tabs;
}
- else if ( IntersectRect(&rectTemp, &rctPage, &ps.rcPaint)) {
+ else if (IntersectRect(&rectTemp, &rctPage, &ps.rcPaint)) {
if (CSkin::m_skinEnabled) {
CSkinItem *item = &SkinItems[ID_EXTBKTABPAGE];
-
if (!item->IGNORED) {
- DrawAlpha(hdc, &rctPage, item->COLOR, item->ALPHA, item->COLOR2, item->COLOR2_TRANSPARENT,
- item->GRADIENT, item->CORNER, item->BORDERSTYLE, item->imageItem);
+ DrawAlpha(hdc, &rctPage, item->COLOR, item->ALPHA, item->COLOR2, item->COLOR2_TRANSPARENT, item->GRADIENT, item->CORNER, item->BORDERSTYLE, item->imageItem);
goto page_done;
}
}
@@ -825,14 +789,10 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat) }
}
page_done:
- /*
- * if aero is active _and_ the infopanel is visible in the current window, we "flatten" out the top area
- * of the tab page by overpainting it black (thus it will appear transparent)
- */
+ // if aero is active _and_ the infopanel is visible in the current window, we "flatten" out the top area
+ // of the tab page by overpainting it black (thus it will appear transparent)
if (isAero && tabdat->helperDat) {
- RECT rcLog, rcPage;
- POINT pt;
-
+ RECT rcLog, rcPage;
GetClientRect(hwnd, &rcPage);
if (dwStyle & TCS_BOTTOM) {
GetWindowRect(tabdat->helperDat->hwnd, &rcLog);
@@ -844,6 +804,8 @@ page_done: rcPage.top = 0;
}
GetWindowRect(GetDlgItem(tabdat->helperDat->hwnd, tabdat->helperDat->bType == SESSIONTYPE_IM ? IDC_LOG : IDC_CHAT_LOG), &rcLog);
+
+ POINT pt;
pt.y = rcLog.top;
pt.x = rcLog.left;
ScreenToClient(hwnd, &pt);
@@ -852,10 +814,8 @@ page_done: }
uiFlags = 0;
- /*
- * figure out hottracked item (if any)
- */
+ // figure out hottracked item (if any)
if (tabdat->bRefreshWithoutClip)
goto skip_tabs;
@@ -863,7 +823,7 @@ page_done: ScreenToClient(hwnd, &hti.pt);
hti.flags = 0;
hotItem = TabCtrl_HitTest(hwnd, &hti);
- for (i=0; i < nCount; i++) {
+ for (i = 0; i < nCount; i++) {
TWindowData *dat = 0;
if (i != iActive) {
@@ -892,9 +852,7 @@ page_done: }
}
- /*
- * draw the active item
- */
+ // draw the active item
if (!bClassicDraw && uiBottom) {
rctActive.top -= PluginConfig.tabConfig.m_bottomAdjust;
rctActive.bottom -= PluginConfig.tabConfig.m_bottomAdjust;
@@ -937,9 +895,7 @@ skip_tabs: if (hPenOld)
SelectObject(hdc, hPenOld);
- /*
- * finally, bitblt the contents of the memory dc to the real dc
- */
+ // finally, bitblt the contents of the memory dc to the real dc
if (!tabdat->bRefreshWithoutClip)
ExcludeClipRect(hdcreal, rctClip.left, rctClip.top, rctClip.right, rctClip.bottom);
@@ -968,12 +924,12 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara switch (msg) {
case WM_NCCREATE:
{
- WNDCLASSEXA wcl = {0};
+ WNDCLASSEX wcl = { 0 };
wcl.cbSize = sizeof(wcl);
- GetClassInfoExA(g_hInst, "SysTabControl32", &wcl);
+ GetClassInfoEx(g_hInst, _T("SysTabControl32"), &wcl);
OldTabControlClassProc = wcl.lpfnWndProc;
- tabdat = (TabControlData *)mir_calloc(sizeof(TabControlData));
+ tabdat = (TabControlData*)mir_calloc(sizeof(TabControlData));
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)tabdat);
tabdat->hwnd = hwnd;
tabdat->cx = GetSystemMetrics(SM_CXSMICON);
@@ -999,27 +955,20 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara return 0;
case EM_SEARCHSCROLLER:
- {
- HWND hwndChild;
- /*
- * search the updown control (scroll arrows) to subclass it...
- * the control is dynamically created and may not exist as long as it is
- * not needed. So we have to search it everytime we need to paint. However,
- * it is sufficient to search it once. So this message is called, whenever
- * a new tab is inserted
- */
-
- if ((hwndChild = FindWindowEx(hwnd, 0, _T("msctls_updown32"), NULL)) != 0)
- DestroyWindow(hwndChild);
- }
+ // search the updown control (scroll arrows) to subclass it...
+ // the control is dynamically created and may not exist as long as it is
+ // not needed. So we have to search it everytime we need to paint. However,
+ // it is sufficient to search it once. So this message is called, whenever
+ // a new tab is inserted
+ HWND hwndChild;
+ if ((hwndChild = FindWindowEx(hwnd, 0, _T("msctls_updown32"), NULL)) != 0)
+ DestroyWindow(hwndChild);
+
return 0;
case EM_VALIDATEBOTTOM:
- {
- BOOL bClassicDraw = (tabdat->m_VisualStyles == FALSE);
- if ((tabdat->dwStyle & TCS_BOTTOM) && !bClassicDraw && PluginConfig.tabConfig.m_bottomAdjust != 0)
- InvalidateRect(hwnd, NULL, FALSE);
- }
+ if ((tabdat->dwStyle & TCS_BOTTOM) && tabdat->m_VisualStyles != 0 && PluginConfig.tabConfig.m_bottomAdjust != 0)
+ InvalidateRect(hwnd, NULL, FALSE);
break;
case EM_REFRESHWITHOUTCLIP:
@@ -1034,16 +983,14 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara case TCM_INSERTITEM:
case TCM_DELETEITEM:
tabdat->iHoveredCloseIcon = -1;
- if (!(tabdat->dwStyle & TCS_MULTILINE) || tabdat->dwStyle & TCS_BUTTONS) {
- LRESULT result;
- RECT rc;
+ if (!(tabdat->dwStyle & TCS_MULTILINE) || (tabdat->dwStyle & TCS_BUTTONS)) {
int iTabs = TabCtrl_GetItemCount(hwnd);
if (iTabs >= 1 && msg == TCM_INSERTITEM) {
+ RECT rc;
TabCtrl_GetItemRect(hwnd, 0, &rc);
TabCtrl_SetItemSize(hwnd, 10, rc.bottom - rc.top);
}
- result = CallWindowProc(OldTabControlClassProc, hwnd, msg, wParam, lParam);
- TabCtrl_GetItemRect(hwnd, 0, &rc);
+ LRESULT result = CallWindowProc(OldTabControlClassProc, hwnd, msg, wParam, lParam);
SendMessage(hwnd, WM_SIZE, 0, 0);
return result;
}
@@ -1073,7 +1020,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara case WM_SETCURSOR:
GetCursorPos(&pt);
SendMessage(GetParent(hwnd), msg, wParam, lParam);
- if (abs(pt.x - ptMouseT.x) < 4 && abs(pt.y - ptMouseT.y) < 4)
+ if (abs(pt.x - ptMouseT.x) < 4 && abs(pt.y - ptMouseT.y) < 4)
return 1;
ptMouseT = pt;
if (tabdat->fTipActive) {
@@ -1091,12 +1038,11 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara int iTabs = TabCtrl_GetItemCount(hwnd);
if (!(tabdat->dwStyle & TCS_MULTILINE)) {
- RECT rcClient, rc;
- DWORD newItemSize;
if (iTabs > (tabdat->pContainer->dwFlags & CNT_HIDETABS ? 1 : 0)) {
+ RECT rcClient, rc;
GetClientRect(hwnd, &rcClient);
TabCtrl_GetItemRect(hwnd, iTabs - 1, &rc);
- newItemSize = (rcClient.right - 6) - (tabdat->dwStyle & TCS_BUTTONS ? (iTabs) * 10 : 0);
+ DWORD newItemSize = (rcClient.right - 6) - (tabdat->dwStyle & TCS_BUTTONS ? (iTabs)* 10 : 0);
newItemSize = newItemSize / iTabs;
if (newItemSize < PluginConfig.tabConfig.m_fixedwidth)
TabCtrl_SetItemSize(hwnd, newItemSize, rc.bottom - rc.top);
@@ -1106,12 +1052,11 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara SendMessage(hwnd, EM_SEARCHSCROLLER, 0, 0);
}
}
- else if (tabdat->dwStyle & TCS_BUTTONS && iTabs > 0) {
+ else if ((tabdat->dwStyle & TCS_BUTTONS) && iTabs > 0) {
RECT rcClient, rcItem;
- int nrTabsPerLine;
GetClientRect(hwnd, &rcClient);
TabCtrl_GetItemRect(hwnd, 0, &rcItem);
- nrTabsPerLine = (rcClient.right) / PluginConfig.tabConfig.m_fixedwidth;
+ int nrTabsPerLine = (rcClient.right) / PluginConfig.tabConfig.m_fixedwidth;
if (iTabs >= nrTabsPerLine && nrTabsPerLine > 0)
TabCtrl_SetItemSize(hwnd, ((rcClient.right - 6) / nrTabsPerLine) - (tabdat->dwStyle & TCS_BUTTONS ? 8 : 0), rcItem.bottom - rcItem.top);
else
@@ -1121,8 +1066,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara break;
case WM_LBUTTONDBLCLK:
- if (!(tabdat->pContainer->settings->dwFlagsEx & TCF_CLOSEBUTTON))
- {
+ if (!(tabdat->pContainer->settings->dwFlagsEx & TCF_CLOSEBUTTON)) {
GetCursorPos(&pt);
SendMessage(GetParent(hwnd), DM_CLOSETABATMOUSE, 0, (LPARAM)&pt);
}
@@ -1140,15 +1084,14 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara tabdat->fTipActive = FALSE;
if (GetKeyState(VK_CONTROL) & 0x8000) {
- TCHITTESTINFO tci = {0};
+ TCHITTESTINFO tci = { 0 };
tci.pt.x = (short)LOWORD(GetMessagePos());
tci.pt.y = (short)HIWORD(GetMessagePos());
if (DragDetect(hwnd, tci.pt) && TabCtrl_GetItemCount(hwnd) > 1) {
- int i;
tci.flags = TCHT_ONITEM;
ScreenToClient(hwnd, &tci.pt);
- i = TabCtrl_HitTest(hwnd, &tci);
+ int i = TabCtrl_HitTest(hwnd, &tci);
if (i != -1) {
TCITEM tc;
TWindowData *dat = NULL;
@@ -1156,7 +1099,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara tc.mask = TCIF_PARAM;
TabCtrl_GetItem(hwnd, i, &tc);
dat = (TWindowData*)GetWindowLongPtr((HWND)tc.lParam, GWLP_USERDATA);
- if (dat) {
+ if (dat) {
tabdat->bDragging = TRUE;
tabdat->iBeginIndex = i;
tabdat->hwndDrag = (HWND)tc.lParam;
@@ -1174,7 +1117,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara }
if (GetKeyState(VK_MENU) & 0x8000) {
- TCHITTESTINFO tci = {0};
+ TCHITTESTINFO tci = { 0 };
tci.pt.x = (short)LOWORD(GetMessagePos());
tci.pt.y = (short)HIWORD(GetMessagePos());
if (DragDetect(hwnd, tci.pt) && TabCtrl_GetItemCount(hwnd) > 1) {
@@ -1185,12 +1128,11 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara i = TabCtrl_HitTest(hwnd, &tci);
if (i != -1) {
TCITEM tc;
- TWindowData *dat = NULL;
-
tc.mask = TCIF_PARAM;
TabCtrl_GetItem(hwnd, i, &tc);
- dat = (TWindowData*)GetWindowLongPtr((HWND)tc.lParam, GWLP_USERDATA);
- if (dat) {
+
+ TWindowData *dat = (TWindowData*)GetWindowLongPtr((HWND)tc.lParam, GWLP_USERDATA);
+ if (dat) {
tabdat->bDragging = TRUE;
tabdat->iBeginIndex = i;
tabdat->hwndDrag = (HWND)tc.lParam;
@@ -1227,15 +1169,15 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara case WM_MOUSEMOVE:
if (tabdat->bDragging) {
- TCHITTESTINFO tci = {0};
+ TCHITTESTINFO tci = { 0 };
tci.pt.x = (short)LOWORD(GetMessagePos());
tci.pt.y = (short)HIWORD(GetMessagePos());
ScreenToClient(hwnd, &tci.pt);
ImageList_DragMove(tci.pt.x, tci.pt.y);
}
+
if (tabdat->fCloseButton) {
POINT pt;
-
GetCursorPos(&pt);
int iOldHovered = tabdat->iHoveredCloseIcon;
tabdat->iHoveredCloseIcon = TabCtrl_TestForCloseButton(tabdat, hwnd, pt);
@@ -1247,7 +1189,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara case WM_LBUTTONUP:
CallWindowProc(OldTabControlClassProc, hwnd, msg, wParam, lParam);
if (tabdat->bDragging && ReleaseCapture()) {
- TCHITTESTINFO tci = {0};
+ TCHITTESTINFO tci = { 0 };
int i;
tci.pt.x = (short)LOWORD(GetMessagePos());
tci.pt.y = (short)HIWORD(GetMessagePos());
@@ -1260,7 +1202,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara i = TabCtrl_HitTest(hwnd, &tci);
if (i != -1 && i != tabdat->iBeginIndex)
RearrangeTab(tabdat->hwndDrag, tabdat->dragDat, MAKELONG(i, 0xffff), tabdat->fSavePos);
- tabdat->hwndDrag = (HWND) - 1;
+ tabdat->hwndDrag = (HWND)-1;
tabdat->dragDat = NULL;
if (tabdat->himlDrag) {
ImageList_RemoveAll(tabdat->himlDrag);
@@ -1288,16 +1230,16 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara case WM_TIMER:
if (wParam == TIMERID_HOVER_T && M.GetByte("d_tooltips", 0)) {
- POINT pt;
- CLCINFOTIP ti = {0};
- ti.cbSize = sizeof(ti);
-
KillTimer(hwnd, TIMERID_HOVER_T);
+
+ POINT pt;
GetCursorPos(&pt);
if (abs(pt.x - ptMouseT.x) < 5 && abs(pt.y - ptMouseT.y) < 5) {
+ CLCINFOTIP ti = { 0 };
+ ti.cbSize = sizeof(ti);
ti.ptCursor = pt;
- TCITEM item = {0};
+ TCITEM item = { 0 };
item.mask = TCIF_PARAM;
int nItem = GetTabItemFromMouse(hwnd, &pt);
if (nItem >= 0 && nItem < TabCtrl_GetItemCount(hwnd)) {
@@ -1341,9 +1283,8 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara return CallWindowProc(OldTabControlClassProc, hwnd, msg, wParam, lParam);
}
-/*
-* load the tab control configuration data (colors, fonts, flags...
-*/
+/////////////////////////////////////////////////////////////////////////////////////////
+// load the tab control configuration data (colors, fonts, flags...
void TSAPI ReloadTabConfig()
{
@@ -1384,16 +1325,15 @@ void TSAPI FreeTabConfig() if (PluginConfig.tabConfig.m_hMenuFont)
DeleteObject(PluginConfig.tabConfig.m_hMenuFont);
- for (int i=0; i < SIZEOF(PluginConfig.tabConfig.m_brushes); i++)
+ for (int i = 0; i < SIZEOF(PluginConfig.tabConfig.m_brushes); i++)
if (PluginConfig.tabConfig.m_brushes[i])
DeleteObject(PluginConfig.tabConfig.m_brushes[i]);
memset(&PluginConfig.tabConfig, 0, sizeof(PluginConfig.tabConfig));
}
-/*
-* options dialog for setting up tab options
-*/
+/////////////////////////////////////////////////////////////////////////////////////////
+// options dialog for setting up tab options
static bool tconfig_init = false;
@@ -1439,36 +1379,33 @@ INT_PTR CALLBACK DlgProcTabConfig(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM return 0;
case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
+ switch (((LPNMHDR)lParam)->idFrom) {
case 0:
- switch (((LPNMHDR) lParam)->code) {
+ switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- {
- BOOL translated;
-
- db_set_b(0, SRMSGMOD_T, "y-pad", (BYTE)(GetDlgItemInt(hwndDlg, IDC_TABPADDING, NULL, FALSE)));
- db_set_b(0, SRMSGMOD_T, "x-pad", (BYTE)(GetDlgItemInt(hwndDlg, IDC_HTABPADDING, NULL, FALSE)));
- db_set_b(0, SRMSGMOD_T, "tborder", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDER, &translated, FALSE));
- db_set_b(0, SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_left" : "tborder_outer_left", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTER, &translated, FALSE));
- db_set_b(0, SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_right" : "tborder_outer_right", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTERRIGHT, &translated, FALSE));
- db_set_b(0, SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_top" : "tborder_outer_top", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTERTOP, &translated, FALSE));
- db_set_b(0, SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_bottom" : "tborder_outer_bottom", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTERBOTTOM, &translated, FALSE));
- db_set_dw(0, SRMSGMOD_T, "bottomadjust", GetDlgItemInt(hwndDlg, IDC_BOTTOMTABADJUST, &translated, TRUE));
-
- int fixedWidth = GetDlgItemInt(hwndDlg, IDC_TABWIDTH, &translated, FALSE);
- fixedWidth = (fixedWidth < 60 ? 60 : fixedWidth);
- db_set_dw(0, SRMSGMOD_T, "fixedwidth", fixedWidth);
- FreeTabConfig();
- ReloadTabConfig();
-
- for (TContainerData *p = pFirstContainer; p; p = p->pNext) {
- TabCtrl_SetPadding(GetDlgItem(p->hwnd, IDC_MSGTABS), GetDlgItemInt(hwndDlg, IDC_HTABPADDING, NULL, FALSE), GetDlgItemInt(hwndDlg, IDC_TABPADDING, NULL, FALSE));
- RedrawWindow(GetDlgItem(p->hwnd, IDC_MSGTABS), NULL, NULL, RDW_INVALIDATE | RDW_ERASE);
- }
- return TRUE;
+ BOOL translated;
+
+ db_set_b(0, SRMSGMOD_T, "y-pad", (BYTE)(GetDlgItemInt(hwndDlg, IDC_TABPADDING, NULL, FALSE)));
+ db_set_b(0, SRMSGMOD_T, "x-pad", (BYTE)(GetDlgItemInt(hwndDlg, IDC_HTABPADDING, NULL, FALSE)));
+ db_set_b(0, SRMSGMOD_T, "tborder", (BYTE)GetDlgItemInt(hwndDlg, IDC_TABBORDER, &translated, FALSE));
+ db_set_b(0, SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_left" : "tborder_outer_left", (BYTE)GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTER, &translated, FALSE));
+ db_set_b(0, SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_right" : "tborder_outer_right", (BYTE)GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTERRIGHT, &translated, FALSE));
+ db_set_b(0, SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_top" : "tborder_outer_top", (BYTE)GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTERTOP, &translated, FALSE));
+ db_set_b(0, SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_bottom" : "tborder_outer_bottom", (BYTE)GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTERBOTTOM, &translated, FALSE));
+ db_set_dw(0, SRMSGMOD_T, "bottomadjust", GetDlgItemInt(hwndDlg, IDC_BOTTOMTABADJUST, &translated, TRUE));
+
+ int fixedWidth = GetDlgItemInt(hwndDlg, IDC_TABWIDTH, &translated, FALSE);
+ fixedWidth = (fixedWidth < 60 ? 60 : fixedWidth);
+ db_set_dw(0, SRMSGMOD_T, "fixedwidth", fixedWidth);
+ FreeTabConfig();
+ ReloadTabConfig();
+
+ for (TContainerData *p = pFirstContainer; p; p = p->pNext) {
+ TabCtrl_SetPadding(GetDlgItem(p->hwnd, IDC_MSGTABS), GetDlgItemInt(hwndDlg, IDC_HTABPADDING, NULL, FALSE), GetDlgItemInt(hwndDlg, IDC_TABPADDING, NULL, FALSE));
+ RedrawWindow(GetDlgItem(p->hwnd, IDC_MSGTABS), NULL, NULL, RDW_INVALIDATE | RDW_ERASE);
}
+ return TRUE;
}
- break;
}
break;
@@ -1482,7 +1419,7 @@ INT_PTR CALLBACK DlgProcTabConfig(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case IDC_TABBORDEROUTERBOTTOM:
case IDC_TABBORDEROUTERRIGHT:
case IDC_TABBORDEROUTERTOP:
- if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
+ if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())
return TRUE;
break;
}
@@ -1496,9 +1433,8 @@ INT_PTR CALLBACK DlgProcTabConfig(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM return FALSE;
}
-/*
- * register the new tab control as a window class (TSTabCtrlClass)
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// register the new tab control as a window class (TSTabCtrlClass)
int TSAPI RegisterTabCtrlClass(void)
{
|