From c8e8e884a6a632c5766eddab2d84c6a6b2216d6c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 6 Dec 2016 14:22:46 +0300 Subject: StdMsg & Scriver: - switched to the toolbar buttons instead of the fixed button set; - switched to the shared windows list --- src/core/stdmsg/res/resource.rc | 14 -- src/core/stdmsg/src/chat_window.cpp | 126 ++++++------ src/core/stdmsg/src/globals.cpp | 13 +- src/core/stdmsg/src/globals.h | 1 - src/core/stdmsg/src/msgdialog.cpp | 384 +++++++++++++++++++----------------- src/core/stdmsg/src/msgoptions.cpp | 11 +- src/core/stdmsg/src/msgs.cpp | 113 +++++++++-- src/core/stdmsg/src/msgtimedout.cpp | 4 +- src/core/stdmsg/src/resource.h | 1 - src/core/stdmsg/src/srmm.cpp | 4 +- src/core/stdmsg/src/statusicon.cpp | 4 +- 11 files changed, 388 insertions(+), 287 deletions(-) (limited to 'src/core') diff --git a/src/core/stdmsg/res/resource.rc b/src/core/stdmsg/res/resource.rc index 9a0800758c..8871c47a48 100644 --- a/src/core/stdmsg/res/resource.rc +++ b/src/core/stdmsg/res/resource.rc @@ -87,10 +87,6 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN CONTROL "",IDC_PROTOCOL,"Button",BS_OWNERDRAW,2,5,12,12 CONTROL "User &details",IDC_NAME,"MButtonClass",WS_TABSTOP,15,2,95,14,WS_EX_NOACTIVATE | 0x10000000L - CONTROL "&Add",IDC_ADD,"MButtonClass",WS_TABSTOP,110,2,16,14,WS_EX_NOACTIVATE | 0x10000000L - CONTROL "&User menu",IDC_USERMENU,"MButtonClass",WS_TABSTOP,128,2,16,14,WS_EX_NOACTIVATE | 0x10000000L - CONTROL "&Details",IDC_DETAILS,"MButtonClass",WS_TABSTOP,146,2,16,14,WS_EX_NOACTIVATE | 0x10000000L - CONTROL "&History",IDC_HISTORY,"MButtonClass",WS_TABSTOP,164,2,16,14,WS_EX_NOACTIVATE | 0x10000000L CONTROL "",IDC_MESSAGE,"RichEdit50W",ES_MULTILINE | ES_AUTOVSCROLL | ES_NOHIDESEL | ES_WANTRETURN | WS_VSCROLL | WS_TABSTOP,1,49,141,13,WS_EX_ACCEPTFILES | WS_EX_STATICEDGE DEFPUSHBUTTON "&Send",IDOK,143,48,39,15 PUSHBUTTON "Close",IDCANCEL,129,0,54,15,NOT WS_VISIBLE @@ -211,16 +207,6 @@ BEGIN ES_NUMBER | WS_VSCROLL | WS_TABSTOP,0,128,127,12, WS_EX_STATICEDGE PUSHBUTTON "&Send",IDOK,136,126,115,14,WS_DISABLED - CONTROL "&Emoticons",IDC_SMILEY,"MButtonClass",WS_DISABLED | WS_TABSTOP,112,108,15,13,0x18000000L - CONTROL "&Bold",IDC_BOLD,"MButtonClass",WS_DISABLED | WS_TABSTOP,8,108,15,13,0x18000000L - CONTROL "&Italic",IDC_ITALICS,"MButtonClass",WS_DISABLED | WS_TABSTOP,24,108,15,13,0x18000000L - CONTROL "&Underline",IDC_UNDERLINE,"MButtonClass",WS_DISABLED | WS_TABSTOP,40,108,15,13,0x18000000L - CONTROL "&Color",IDC_COLOR,"MButtonClass",WS_DISABLED | WS_TABSTOP,68,108,15,13,0x18000000L - CONTROL "&Background color",IDC_BKGCOLOR,"MButtonClass",WS_DISABLED | WS_TABSTOP,84,108,15,13,0x18000000L - CONTROL "&History",IDC_HISTORY,"MButtonClass",WS_TABSTOP,188,108,15,13,0x18000000L - CONTROL "&Filter",IDC_FILTER,"MButtonClass",WS_TABSTOP,220,108,15,13,0x18000000L - CONTROL "&Room settings",IDC_CHANMGR,"MButtonClass",WS_DISABLED | WS_TABSTOP,204,108,15,13,0x18000000L - CONTROL "&Show/Hide nick list",IDC_SHOWNICKLIST,"MButtonClass",WS_TABSTOP,236,108,15,13,0x18000000L CONTROL "",IDC_LOG,"RichEdit50W",ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | ES_NUMBER | WS_VSCROLL | WS_TABSTOP,8,23, 164,73,WS_EX_STATICEDGE diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index 61e9fbb0f5..6bfa86272b 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -66,46 +66,12 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, static void InitButtons(HWND hwndDlg, SESSION_INFO *si) { - SendDlgItemMessage(hwndDlg, IDC_SMILEY, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("smiley", FALSE)); - SendDlgItemMessage(hwndDlg, IDC_BOLD, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("bold", FALSE)); - SendDlgItemMessage(hwndDlg, IDC_ITALICS, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("italics", FALSE)); - SendDlgItemMessage(hwndDlg, IDC_UNDERLINE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("underline", FALSE)); - SendDlgItemMessage(hwndDlg, IDC_COLOR, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("fgcol", FALSE)); - SendDlgItemMessage(hwndDlg, IDC_BKGCOLOR, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("bkgcol", FALSE)); - SendDlgItemMessage(hwndDlg, IDC_HISTORY, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("history", FALSE)); - SendDlgItemMessage(hwndDlg, IDC_CHANMGR, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("settings", FALSE)); SendDlgItemMessage(hwndDlg, IDC_CLOSE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("close", FALSE)); - SendDlgItemMessage(hwndDlg, IDC_SHOWNICKLIST, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(si->bNicklistEnabled ? "nicklist" : "nicklist2", FALSE)); - SendDlgItemMessage(hwndDlg, IDC_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(si->bFilterEnabled ? "filter" : "filter2", FALSE)); - - SendDlgItemMessage(hwndDlg, IDC_SMILEY, BUTTONSETASFLATBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_BOLD, BUTTONSETASFLATBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_ITALICS, BUTTONSETASFLATBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_UNDERLINE, BUTTONSETASFLATBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_BKGCOLOR, BUTTONSETASFLATBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_COLOR, BUTTONSETASFLATBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_HISTORY, BUTTONSETASFLATBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_SHOWNICKLIST, BUTTONSETASFLATBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_CHANMGR, BUTTONSETASFLATBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_FILTER, BUTTONSETASFLATBTN, TRUE, 0); SendDlgItemMessage(hwndDlg, IDC_CLOSE, BUTTONSETASFLATBTN, TRUE, 0); - - SendDlgItemMessage(hwndDlg, IDC_SMILEY, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Insert a smiley"), 0); - SendDlgItemMessage(hwndDlg, IDC_BOLD, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text bold (CTRL+B)"), 0); - SendDlgItemMessage(hwndDlg, IDC_ITALICS, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text italicized (CTRL+I)"), 0); - SendDlgItemMessage(hwndDlg, IDC_UNDERLINE, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text underlined (CTRL+U)"), 0); - SendDlgItemMessage(hwndDlg, IDC_BKGCOLOR, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Select a background color for the text (CTRL+L)"), 0); - SendDlgItemMessage(hwndDlg, IDC_COLOR, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Select a foreground color for the text (CTRL+K)"), 0); - SendDlgItemMessage(hwndDlg, IDC_HISTORY, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Show the history (CTRL+H)"), 0); - SendDlgItemMessage(hwndDlg, IDC_SHOWNICKLIST, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Show/hide the nick list (CTRL+N)"), 0); - SendDlgItemMessage(hwndDlg, IDC_CHANMGR, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Control this room (CTRL+O)"), 0); - SendDlgItemMessage(hwndDlg, IDC_FILTER, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Enable/disable the event filter (CTRL+F)"), 0); SendDlgItemMessage(hwndDlg, IDC_CLOSE, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Close current tab (CTRL+F4)"), 0); - SendDlgItemMessage(hwndDlg, IDC_BOLD, BUTTONSETASPUSHBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_ITALICS, BUTTONSETASPUSHBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_UNDERLINE, BUTTONSETASPUSHBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_COLOR, BUTTONSETASPUSHBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_BKGCOLOR, BUTTONSETASPUSHBTN, TRUE, 0); + + SendDlgItemMessage(hwndDlg, IDC_SHOWNICKLIST, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(si->bNicklistEnabled ? "nicklist" : "nicklist2", FALSE)); + SendDlgItemMessage(hwndDlg, IDC_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(si->bFilterEnabled ? "filter" : "filter2", FALSE)); MODULEINFO *pInfo = pci->MM_FindModule(si->pszModule); if (pInfo) { @@ -136,7 +102,6 @@ static int RoomWndResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc) int TabHeight = rcTabs.bottom - rcTabs.top; TabCtrl_AdjustRect(GetDlgItem(hwndDlg, IDC_TAB), FALSE, &rcTabs); TabHeight -= (rcTabs.bottom - rcTabs.top); - ShowWindow(GetDlgItem(hwndDlg, IDC_SMILEY), (SmileyAddInstalled && bFormat) ? SW_SHOW : SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDC_BOLD), bFormat ? SW_SHOW : SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDC_UNDERLINE), bFormat ? SW_SHOW : SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDC_ITALICS), bFormat ? SW_SHOW : SW_HIDE); @@ -220,7 +185,6 @@ static int RoomWndResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc) urc->rcItem.bottom = urc->dlgNewSize.cy - (rc.bottom - rc.top) - 1; return RD_ANCHORX_LEFT | RD_ANCHORY_CUSTOM; - case IDC_SMILEY: case IDC_ITALICS: case IDC_BOLD: case IDC_UNDERLINE: @@ -1108,6 +1072,51 @@ static void __cdecl phase2(void * lParam) PostMessage(si->hWnd, GC_REDRAWLOG3, 0, 0); } +static void SetButtonsPos(HWND hwndDlg) +{ + HDWP hdwp = BeginDeferWindowPos(Srmm_GetButtonCount()); + + RECT rc; + GetWindowRect(GetDlgItem(hwndDlg, IDC_SPLITTERY), &rc); + POINT pt = { 0, rc.bottom }; + ScreenToClient(hwndDlg, &pt); + pt.y -= 2; + + GetClientRect(hwndDlg, &rc); + int iLeftX = 2, iRightX = rc.right - 2; + int iGap = db_get_b(NULL, SRMSGMOD, "ButtonsBarGap", 1); + + for (int i = 0;; i++) { + CustomButtonData *cbd = Srmm_GetNthButton(i); + if (cbd == NULL || cbd->m_bRSided) + break; + + HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID); + if (hwndButton == NULL) + continue; + + int width = iGap + ((cbd->m_dwArrowCID) ? 34 : 22); + hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iLeftX, pt.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + iLeftX += width; + } + + for (int i = Srmm_GetButtonCount() - 1; i >= 0; i--) { + CustomButtonData *cbd = Srmm_GetNthButton(i); + if (!cbd->m_bRSided) + break; + + HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID); + if (hwndButton == NULL) + continue; + + int width = iGap + ((cbd->m_dwArrowCID) ? 34 : 22); + iRightX -= width; + hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iRightX, pt.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + } + + EndDeferWindowPos(hdwp); +} + INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { SESSION_INFO *s, *si = (SESSION_INFO*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); @@ -1121,6 +1130,21 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar si = (SESSION_INFO*)lParam; TranslateDialogDefault(hwndDlg); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)si); + + CustomButtonData *cbd; + for (int i = 0; cbd = Srmm_GetNthButton(i); i++) { + if (!cbd->m_bChatButton) + continue; + + int width = (cbd->m_dwArrowCID) ? 34 : 22; + HWND hwndButton = CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, width, 22, hwndDlg, (HMENU)cbd->m_dwButtonCID, g_hInst, NULL); + SendMessage(hwndButton, BUTTONSETASFLATBTN, TRUE, 0); + if (cbd->m_pwszTooltip) + SendMessage(hwndButton, BUTTONADDTOOLTIP, LPARAM(cbd->m_pwszTooltip), BATF_UNICODE); + if (cbd->m_hIcon) + SendMessage(hwndButton, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIconByHandle(cbd->m_hIcon)); + } + mir_subclassWindow(GetDlgItem(hwndDlg, IDC_SPLITTERX), SplitterSubclassProc); mir_subclassWindow(GetDlgItem(hwndDlg, IDC_SPLITTERY), SplitterSubclassProc); mir_subclassWindow(hNickList, NicklistSubclassProc); @@ -1156,8 +1180,6 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar TabM_RemoveAll(); - EnableWindow(GetDlgItem(hwndDlg, IDC_SMILEY), TRUE); - SendDlgItemMessage(hwndDlg, IDC_LOG, EM_HIDESELECTION, TRUE, 0); SendMessage(hwndDlg, GC_SETWNDPROPS, 0, 0); @@ -1169,7 +1191,6 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar case GC_SETWNDPROPS: { - // LoadGlobalSettings(); !!!!!!!!!!!!!!!!!!!!!! InitButtons(hwndDlg, si); // stupid hack to make icons show. I dunno why this is needed currently @@ -1343,6 +1364,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SendMessage(si->hwndStatus, WM_SIZE, 0, 0); Utils_ResizeDialog(hwndDlg, g_hInst, MAKEINTRESOURCEA(IDD_CHANNEL), RoomWndResize, (LPARAM)si); + SetButtonsPos(hwndDlg); InvalidateRect(si->hwndStatus, NULL, TRUE); RedrawWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), NULL, NULL, RDW_INVALIDATE); @@ -1838,7 +1860,6 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar { POINT pt; RECT rcLog; - BOOL bFormat = IsWindowVisible(GetDlgItem(hwndDlg, IDC_SMILEY)); static int x = 0; @@ -1858,6 +1879,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar g_Settings.iSplitterX = si->iSplitterX; } else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTERY)) { + BOOL bFormat = IsWindowVisible(GetDlgItem(hwndDlg, IDC_BOLD)); int oldSplitterY; GetClientRect(hwndDlg, &rc); pt.x = 0; pt.y = wParam; @@ -2304,24 +2326,6 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar EnableWindow(GetDlgItem(hwndDlg, IDOK), GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE)) != 0); break; - case IDC_SMILEY: - GetWindowRect(GetDlgItem(hwndDlg, IDC_SMILEY), &rc); - - if (SmileyAddInstalled) { - SMADD_SHOWSEL3 smaddInfo = { sizeof(smaddInfo) }; - smaddInfo.hwndTarget = GetDlgItem(hwndDlg, IDC_MESSAGE); - smaddInfo.targetMessage = EM_REPLACESEL; - smaddInfo.targetWParam = TRUE; - smaddInfo.Protocolname = si->pszModule; - smaddInfo.Direction = 3; - smaddInfo.xPosition = rc.left + 3; - smaddInfo.yPosition = rc.top - 1; - smaddInfo.hContact = si->hContact; - smaddInfo.hwndParent = hwndDlg; - CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM)&smaddInfo); - } - break; - case IDC_HISTORY: if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_HISTORY))) { MODULEINFO *pInfo = pci->MM_FindModule(si->pszModule); diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp index 0523308b66..55b2214d7f 100644 --- a/src/core/stdmsg/src/globals.cpp +++ b/src/core/stdmsg/src/globals.cpp @@ -44,9 +44,6 @@ static int IconsChanged(WPARAM, LPARAM) static int OnShutdown(WPARAM, LPARAM) { - WindowList_Destroy(g_dat.hMessageWindowList); - g_dat.hMessageWindowList = NULL; - for (SESSION_INFO *si = pci->wndList; si; si = si->next) SendMessage(si->hWnd, WM_CLOSE, 0, 0); @@ -58,7 +55,7 @@ static int OnShutdown(WPARAM, LPARAM) static int OnMetaChanged(WPARAM hMeta, LPARAM) { if (hMeta) { - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hMeta); + HWND hwnd = WindowList_Find(pci->hWindowList, hMeta); if (hwnd != NULL) SendMessage(hwnd, DM_GETAVATAR, 0, 0); } @@ -68,13 +65,13 @@ static int OnMetaChanged(WPARAM hMeta, LPARAM) static int dbaddedevent(WPARAM hContact, LPARAM hDbEvent) { if (hContact) { - HWND h = WindowList_Find(g_dat.hMessageWindowList, hContact); + HWND h = WindowList_Find(pci->hWindowList, hContact); if (h) SendMessage(h, HM_DBEVENTADDED, hContact, hDbEvent); MCONTACT hEventContact = db_event_getContact(hDbEvent); if (hEventContact != hContact) - if ((h = WindowList_Find(g_dat.hMessageWindowList, hEventContact)) != NULL) + if ((h = WindowList_Find(pci->hWindowList, hEventContact)) != NULL) SendMessage(h, HM_DBEVENTADDED, hEventContact, hDbEvent); } return 0; @@ -94,7 +91,7 @@ static int ackevent(WPARAM, LPARAM lParam) int AvatarChanged(WPARAM hContact, LPARAM lParam) { - HWND h = WindowList_Find(g_dat.hMessageWindowList, hContact); + HWND h = WindowList_Find(pci->hWindowList, hContact); if (h) SendMessage(h, HM_AVATARACK, hContact, lParam); return 0; @@ -157,8 +154,6 @@ void ReloadGlobals() void InitGlobals() { - g_dat.hMessageWindowList = WindowList_Create(); - HookEvent(ME_DB_EVENT_ADDED, dbaddedevent); HookEvent(ME_PROTO_ACK, ackevent); HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged); diff --git a/src/core/stdmsg/src/globals.h b/src/core/stdmsg/src/globals.h index a6e0c43682..1b8dfb1aaa 100644 --- a/src/core/stdmsg/src/globals.h +++ b/src/core/stdmsg/src/globals.h @@ -50,7 +50,6 @@ struct SrmmFlags struct GlobalMessageData { SrmmFlags flags; - MWindowList hMessageWindowList; DWORD openFlags; DWORD msgTimeout; DWORD nFlashMax; diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 0209a74695..da30d9a647 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -34,7 +34,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static void UpdateReadChars(HWND hwndDlg, HWND hwndStatus); static const UINT infoLineControls[] = { IDC_PROTOCOL, IDC_NAME }; -static const UINT buttonLineControls[] = { IDC_ADD, IDC_USERMENU, IDC_DETAILS, IDC_HISTORY }; static const UINT sendControls[] = { IDC_MESSAGE }; static void NotifyLocalWinEvent(MCONTACT hContact, HWND hwnd, unsigned int type) @@ -103,8 +102,7 @@ static void AddToFileList(wchar_t ***pppFiles, int *totalCount, const wchar_t* s if (!mir_wstrcmp(fd.cFileName, L".") || !mir_wstrcmp(fd.cFileName, L"..")) continue; mir_snwprintf(szPath, L"%s\\%s", szFilename, fd.cFileName); AddToFileList(pppFiles, totalCount, szPath); - } - while (FindNextFile(hFind, &fd)); + } while (FindNextFile(hFind, &fd)); FindClose(hFind); } } @@ -177,14 +175,21 @@ static void SetDialogToType(HWND hwndDlg) else ShowMultipleControls(hwndDlg, infoLineControls, _countof(infoLineControls), SW_HIDE); - if (dat->hContact) { - ShowMultipleControls(hwndDlg, buttonLineControls, _countof(buttonLineControls), g_dat.flags.bShowButtons ? SW_SHOW : SW_HIDE); - if (!db_get_b(dat->hContact, "CList", "NotOnList", 0)) - ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE); + CustomButtonData *cbd; + for (int i = 0; cbd = Srmm_GetNthButton(i); i++) { + HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID); + if (hwndButton == NULL) + continue; + + if (dat->hContact) { + if (cbd->m_dwButtonCID == IDC_ADD && !db_get_b(dat->hContact, "CList", "NotOnList", 0)) + ShowWindow(hwndButton, SW_HIDE); + else + ShowWindow(hwndButton, g_dat.flags.bShowButtons ? SW_SHOW : SW_HIDE); + } + else ShowWindow(hwndButton, SW_HIDE); } - else ShowMultipleControls(hwndDlg, buttonLineControls, _countof(buttonLineControls), SW_HIDE); - ShowMultipleControls(hwndDlg, sendControls, _countof(sendControls), SW_SHOW); if (!dat->hwndStatus) { int grip = (GetWindowLongPtr(hwndDlg, GWL_STYLE) & WS_THICKFRAME) ? SBARS_SIZEGRIP : 0; dat->hwndStatus = CreateWindowEx(0, STATUSCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | grip, 0, 0, 0, 0, hwndDlg, NULL, g_hInst, NULL); @@ -265,7 +270,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar else dat->lastEnterTime = 0; if (((wParam == VK_INSERT && (GetKeyState(VK_SHIFT) & 0x8000)) || (wParam == 'V' && (GetKeyState(VK_CONTROL) & 0x8000))) && - !(GetKeyState(VK_MENU) & 0x8000)) { // ctrl-v (paste clean text) + !(GetKeyState(VK_MENU) & 0x8000)) { // ctrl-v (paste clean text) SendMessage(hwnd, WM_PASTE, 0, 0); return 0; } @@ -317,104 +322,104 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar break; case WM_CONTEXTMENU: - { - static const CHARRANGE all = { 0, -1 }; - - MessageWindowPopupData mwpd = { 0 }; - mwpd.cbSize = sizeof(mwpd); - mwpd.uType = MSG_WINDOWPOPUP_SHOWING; - mwpd.uFlags = MSG_WINDOWPOPUP_INPUT; - mwpd.hContact = pdat->hContact; - mwpd.hwnd = hwnd; - - HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT)); - - mwpd.hMenu = GetSubMenu(hMenu, 2); - TranslateMenu(mwpd.hMenu); - - CHARRANGE sel; - SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel); - if (sel.cpMin == sel.cpMax) { - EnableMenuItem(mwpd.hMenu, IDM_CUT, MF_BYCOMMAND | MF_GRAYED); - EnableMenuItem(mwpd.hMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED); - EnableMenuItem(mwpd.hMenu, IDM_DELETE, MF_BYCOMMAND | MF_GRAYED); - } - if (!SendMessage(hwnd, EM_CANUNDO, 0, 0)) - EnableMenuItem(mwpd.hMenu, IDM_UNDO, MF_BYCOMMAND | MF_GRAYED); + { + static const CHARRANGE all = { 0, -1 }; + + MessageWindowPopupData mwpd = { 0 }; + mwpd.cbSize = sizeof(mwpd); + mwpd.uType = MSG_WINDOWPOPUP_SHOWING; + mwpd.uFlags = MSG_WINDOWPOPUP_INPUT; + mwpd.hContact = pdat->hContact; + mwpd.hwnd = hwnd; + + HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT)); + + mwpd.hMenu = GetSubMenu(hMenu, 2); + TranslateMenu(mwpd.hMenu); + + CHARRANGE sel; + SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel); + if (sel.cpMin == sel.cpMax) { + EnableMenuItem(mwpd.hMenu, IDM_CUT, MF_BYCOMMAND | MF_GRAYED); + EnableMenuItem(mwpd.hMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED); + EnableMenuItem(mwpd.hMenu, IDM_DELETE, MF_BYCOMMAND | MF_GRAYED); + } + if (!SendMessage(hwnd, EM_CANUNDO, 0, 0)) + EnableMenuItem(mwpd.hMenu, IDM_UNDO, MF_BYCOMMAND | MF_GRAYED); - if (!SendMessage(hwnd, EM_CANREDO, 0, 0)) - EnableMenuItem(mwpd.hMenu, IDM_REDO, MF_BYCOMMAND | MF_GRAYED); + if (!SendMessage(hwnd, EM_CANREDO, 0, 0)) + EnableMenuItem(mwpd.hMenu, IDM_REDO, MF_BYCOMMAND | MF_GRAYED); - if (!SendMessage(hwnd, EM_CANPASTE, 0, 0)) { - if (!IsClipboardFormatAvailable(CF_HDROP)) - EnableMenuItem(mwpd.hMenu, IDM_PASTE, MF_BYCOMMAND | MF_GRAYED); - EnableMenuItem(mwpd.hMenu, IDM_PASTESEND, MF_BYCOMMAND | MF_GRAYED); - } + if (!SendMessage(hwnd, EM_CANPASTE, 0, 0)) { + if (!IsClipboardFormatAvailable(CF_HDROP)) + EnableMenuItem(mwpd.hMenu, IDM_PASTE, MF_BYCOMMAND | MF_GRAYED); + EnableMenuItem(mwpd.hMenu, IDM_PASTESEND, MF_BYCOMMAND | MF_GRAYED); + } - if (lParam == 0xFFFFFFFF) { - SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM)&mwpd.pt, (LPARAM)sel.cpMax); - ClientToScreen(hwnd, &mwpd.pt); - } - else { - mwpd.pt.x = GET_X_LPARAM(lParam); - mwpd.pt.y = GET_Y_LPARAM(lParam); - } + if (lParam == 0xFFFFFFFF) { + SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM)&mwpd.pt, (LPARAM)sel.cpMax); + ClientToScreen(hwnd, &mwpd.pt); + } + else { + mwpd.pt.x = GET_X_LPARAM(lParam); + mwpd.pt.y = GET_Y_LPARAM(lParam); + } - // First notification - NotifyEventHooks(hHookWinPopup, 0, (LPARAM)&mwpd); + // First notification + NotifyEventHooks(hHookWinPopup, 0, (LPARAM)&mwpd); - // Someone added items? - if (GetMenuItemCount(mwpd.hMenu) > 0) { - SetCursor(LoadCursor(NULL, IDC_ARROW)); - mwpd.selection = TrackPopupMenu(mwpd.hMenu, TPM_RETURNCMD, mwpd.pt.x, mwpd.pt.y, 0, hwnd, NULL); - } + // Someone added items? + if (GetMenuItemCount(mwpd.hMenu) > 0) { + SetCursor(LoadCursor(NULL, IDC_ARROW)); + mwpd.selection = TrackPopupMenu(mwpd.hMenu, TPM_RETURNCMD, mwpd.pt.x, mwpd.pt.y, 0, hwnd, NULL); + } - // Second notification - mwpd.uType = MSG_WINDOWPOPUP_SELECTED; - NotifyEventHooks(hHookWinPopup, 0, (LPARAM)&mwpd); + // Second notification + mwpd.uType = MSG_WINDOWPOPUP_SELECTED; + NotifyEventHooks(hHookWinPopup, 0, (LPARAM)&mwpd); - switch (mwpd.selection) { - case IDM_UNDO: - SendMessage(hwnd, WM_UNDO, 0, 0); - break; + switch (mwpd.selection) { + case IDM_UNDO: + SendMessage(hwnd, WM_UNDO, 0, 0); + break; - case IDM_REDO: - SendMessage(hwnd, EM_REDO, 0, 0); - break; + case IDM_REDO: + SendMessage(hwnd, EM_REDO, 0, 0); + break; - case IDM_CUT: - SendMessage(hwnd, WM_CUT, 0, 0); - break; + case IDM_CUT: + SendMessage(hwnd, WM_CUT, 0, 0); + break; - case IDM_COPY: - SendMessage(hwnd, WM_COPY, 0, 0); - break; + case IDM_COPY: + SendMessage(hwnd, WM_COPY, 0, 0); + break; - case IDM_PASTE: - SendMessage(hwnd, WM_PASTE, 0, 0); - break; + case IDM_PASTE: + SendMessage(hwnd, WM_PASTE, 0, 0); + break; - case IDM_PASTESEND: - SendMessage(hwnd, EM_PASTESPECIAL, CF_TEXT, 0); - PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0); - break; + case IDM_PASTESEND: + SendMessage(hwnd, EM_PASTESPECIAL, CF_TEXT, 0); + PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0); + break; - case IDM_DELETE: - SendMessage(hwnd, EM_REPLACESEL, TRUE, 0); - break; + case IDM_DELETE: + SendMessage(hwnd, EM_REPLACESEL, TRUE, 0); + break; - case IDM_SELECTALL: - SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&all); - break; + case IDM_SELECTALL: + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&all); + break; - case IDM_CLEAR: - SetWindowText(hwnd, L""); - break; + case IDM_CLEAR: + SetWindowText(hwnd, L""); + break; + } + DestroyMenu(hMenu); + return 0; } - DestroyMenu(hMenu); - return 0; - } case WM_PASTE: if (IsClipboardFormatAvailable(CF_HDROP)) { @@ -468,46 +473,68 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return mir_callNextSubclass(hwnd, SplitterSubclassProc, msg, wParam, lParam); } -static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * urc) +static void SetButtonsPos(SrmmWindowData *dat, HWND hwndDlg) { - SrmmWindowData *dat = (SrmmWindowData *)lParam; + HDWP hdwp = BeginDeferWindowPos(Srmm_GetButtonCount()); - if (!g_dat.flags.bShowInfo && !g_dat.flags.bShowButtons) { - for (int i = 0; i < _countof(buttonLineControls); i++) - if (buttonLineControls[i] == urc->wId) - OffsetRect(&urc->rcItem, 0, -dat->lineHeight); + RECT rc; + GetClientRect(GetDlgItem(hwndDlg, IDC_PROTOCOL), &rc); + int iButtonY = rc.top + 4; + if (!g_dat.flags.bShowInfo && !g_dat.flags.bShowButtons) + iButtonY -= dat->lineHeight; + + GetClientRect(hwndDlg, &rc); + int iButtonX = rc.right - 2; + int iGap = db_get_b(NULL, SRMSGMOD, "ButtonsBarGap", 1); + bool bIsRight = true; + + for (int i = Srmm_GetButtonCount()-1; i >= 0; i--) { + CustomButtonData *cbd = Srmm_GetNthButton(i); + int width = iGap + ((cbd->m_dwArrowCID) ? 34 : 22); + + HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID); + if (NULL != hwndButton) /* Wine fix. */ { + iButtonX -= width; + hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iButtonX, iButtonY, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + } + + if (bIsRight && !cbd->m_bRSided) { + bIsRight = false; + iButtonX -= 8; // draw gap + } } + EndDeferWindowPos(hdwp); +} + +static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc) +{ + SrmmWindowData *dat = (SrmmWindowData *)lParam; + switch (urc->wId) { case IDC_NAME: - { - HWND h = GetDlgItem(hwndDlg, IDC_NAME); - int len = GetWindowTextLength(h); - if (len > 0) { - wchar_t buf[256]; - GetWindowText(h, buf, _countof(buf)); - - HDC hdc = GetDC(h); - HFONT hFont = (HFONT)SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, IDOK, WM_GETFONT, 0, 0)); - - SIZE textSize; - GetTextExtentPoint32(hdc, buf, (int)mir_wstrlen(buf), &textSize); - urc->rcItem.right = urc->rcItem.left + textSize.cx + 10; - if (g_dat.flags.bShowButtons && urc->rcItem.right > urc->dlgNewSize.cx - dat->nLabelRight) - urc->rcItem.right = urc->dlgNewSize.cx - dat->nLabelRight; - SelectObject(hdc, hFont); - ReleaseDC(h, hdc); + { + HWND h = GetDlgItem(hwndDlg, IDC_NAME); + int len = GetWindowTextLength(h); + if (len > 0) { + wchar_t buf[256]; + GetWindowText(h, buf, _countof(buf)); + + HDC hdc = GetDC(h); + HFONT hFont = (HFONT)SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, IDOK, WM_GETFONT, 0, 0)); + + SIZE textSize; + GetTextExtentPoint32(hdc, buf, (int)mir_wstrlen(buf), &textSize); + urc->rcItem.right = urc->rcItem.left + textSize.cx + 10; + if (g_dat.flags.bShowButtons && urc->rcItem.right > urc->dlgNewSize.cx - dat->nLabelRight) + urc->rcItem.right = urc->dlgNewSize.cx - dat->nLabelRight; + SelectObject(hdc, hFont); + ReleaseDC(h, hdc); + } } - } case IDC_PROTOCOL: return RD_ANCHORX_LEFT | RD_ANCHORY_TOP; - case IDC_ADD: - case IDC_USERMENU: - case IDC_DETAILS: - case IDC_HISTORY: - return RD_ANCHORX_RIGHT | RD_ANCHORY_TOP; - case IDC_LOG: if (!(g_dat.flags.bShowInfo) && !(g_dat.flags.bShowButtons)) urc->rcItem.top -= dat->lineHeight; @@ -621,7 +648,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SetDlgItemText(hwndDlg, IDC_MESSAGE, (wchar_t*)newData->szInitialText); else SetDlgItemTextA(hwndDlg, IDC_MESSAGE, newData->szInitialText); - + int len = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE)); PostMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), EM_SETSEL, len, len); } @@ -644,29 +671,35 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SetTimer(hwndDlg, TIMERID_TYPE, 1000, NULL); { RECT rc, rc2; - GetWindowRect(GetDlgItem(hwndDlg, IDC_USERMENU), &rc); + GetWindowRect(GetDlgItem(hwndDlg, IDC_PROTOCOL), &rc); GetWindowRect(hwndDlg, &rc2); dat->nLabelRight = rc2.right - rc.left; POINT pt; - GetWindowRect(GetDlgItem(hwndDlg, IDC_SPLITTER), &rc); + GetClientRect(GetDlgItem(hwndDlg, IDC_SPLITTER), &rc); pt.y = (rc.top + rc.bottom) / 2; pt.x = 0; - ScreenToClient(hwndDlg, &pt); dat->originalSplitterPos = pt.y; if (dat->splitterPos == -1) dat->splitterPos = dat->originalSplitterPos;// + 60; - GetWindowRect(GetDlgItem(hwndDlg, IDC_ADD), &rc); - dat->lineHeight = rc.bottom - rc.top + 3; + + CustomButtonData *cbd; + for (int i = 0; cbd = Srmm_GetNthButton(i); i++) { + if (!cbd->m_bIMButton) + continue; + + int width = (cbd->m_dwArrowCID) ? 34 : 22; + HWND hwndButton = CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, width, 22, hwndDlg, (HMENU)cbd->m_dwButtonCID, g_hInst, NULL); + if (cbd->m_pwszTooltip) + SendMessage(hwndButton, BUTTONADDTOOLTIP, LPARAM(cbd->m_pwszTooltip), BATF_UNICODE); + if (cbd->m_hIcon) + SendMessage(hwndButton, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIconByHandle(cbd->m_hIcon)); + } } - WindowList_Add(g_dat.hMessageWindowList, hwndDlg, dat->hContact); + WindowList_Add(pci->hWindowList, hwndDlg, dat->hContact); GetWindowRect(GetDlgItem(hwndDlg, IDC_MESSAGE), &dat->minEditInit); SendMessage(hwndDlg, DM_UPDATESIZEBAR, 0, 0); dat->hwndStatus = NULL; - Button_SetIcon_IcoLib(hwndDlg, IDC_ADD, SKINICON_OTHER_ADDCONTACT, LPGEN("Add contact permanently to list")); - Button_SetIcon_IcoLib(hwndDlg, IDC_DETAILS, SKINICON_OTHER_USERDETAILS, LPGEN("View user's details")); - Button_SetIcon_IcoLib(hwndDlg, IDC_HISTORY, SKINICON_OTHER_HISTORY, LPGEN("View user's history")); - Button_SetIcon_IcoLib(hwndDlg, IDC_USERMENU, SKINICON_OTHER_DOWNARROW, LPGEN("User menu")); SendDlgItemMessage(hwndDlg, IDC_NAME, BUTTONSETASFLATBTN, TRUE, 0); EnableWindow(GetDlgItem(hwndDlg, IDC_PROTOCOL), FALSE); @@ -749,8 +782,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l PostMessage(hwndDlg, DM_UPDATELASTMESSAGE, 0, 0); break; } - } - while (hdbEvent = db_event_prev(dat->hContact, hdbEvent)); + } while (hdbEvent = db_event_prev(dat->hContact, hdbEvent)); } SendMessage(hwndDlg, DM_OPTIONSAPPLIED, 1, 0); @@ -780,7 +812,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l else SetWindowPos(hwndDlg, 0, 0, 0, 450, 300, SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW); } if (!savePerContact && db_get_b(NULL, SRMMMOD, SRMSGSET_CASCADE, SRMSGDEFSET_CASCADE)) - WindowList_Broadcast(g_dat.hMessageWindowList, DM_CASCADENEWWINDOW, (WPARAM)hwndDlg, (LPARAM)& dat->windowWasCascaded); + WindowList_Broadcast(pci->hWindowList, DM_CASCADENEWWINDOW, (WPARAM)hwndDlg, (LPARAM)& dat->windowWasCascaded); } if (newData->noActivate) { SetWindowPos(hwndDlg, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW); @@ -825,7 +857,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l wchar_t szFilename[MAX_PATH]; HDROP hDrop = (HDROP)wParam; int fileCount = DragQueryFile(hDrop, -1, NULL, 0), totalCount = 0, i; - wchar_t** ppFiles = NULL; + wchar_t **ppFiles = NULL; for (i = 0; i < fileCount; i++) { DragQueryFile(hDrop, i, szFilename, _countof(szFilename)); AddToFileList(&ppFiles, &totalCount, szFilename); @@ -915,7 +947,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l ptrW id(Contact_GetInfo(CNF_UNIQUEID, dat->hContact, dat->szProto)); if (id != NULL && OpenClipboard(hwndDlg)) { EmptyClipboard(); - HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, mir_wstrlen(id) * sizeof(wchar_t)+1); + HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, mir_wstrlen(id) * sizeof(wchar_t) + 1); mir_wstrcpy((wchar_t*)GlobalLock(hData), id); GlobalUnlock(hData); SetClipboardData(CF_UNICODETEXT, hData); @@ -993,41 +1025,38 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l break; case DM_UPDATETITLE: - { - wchar_t newtitle[256]; - if (dat->hContact && dat->szProto) { - int statusIcon = db_get_b(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON); - - dat->wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE); - wchar_t *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0); + wchar_t newtitle[256]; + if (dat->hContact && dat->szProto) { + int statusIcon = db_get_b(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON); - ptrW id(Contact_GetInfo(CNF_DISPLAYUID, dat->hContact, dat->szProto)); - SetDlgItemText(hwndDlg, IDC_NAME, (id) ? id : contactName); + dat->wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE); + wchar_t *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0); - wchar_t *szStatus = pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE), 0); - if (statusIcon) - mir_snwprintf(newtitle, L"%s - %s", contactName, TranslateT("Message session")); - else - mir_snwprintf(newtitle, L"%s (%s): %s", contactName, szStatus, TranslateT("Message session")); - - DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)wParam; - if (!cws || (!mir_strcmp(cws->szModule, dat->szProto) && !mir_strcmp(cws->szSetting, "Status"))) { - InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOCOL), NULL, TRUE); - if (statusIcon) - SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0); - } + ptrW id(Contact_GetInfo(CNF_DISPLAYUID, dat->hContact, dat->szProto)); + SetDlgItemText(hwndDlg, IDC_NAME, (id) ? id : contactName); - dat->wOldStatus = dat->wStatus; - } + wchar_t *szStatus = pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE), 0); + if (statusIcon) + mir_snwprintf(newtitle, L"%s - %s", contactName, TranslateT("Message session")); else - mir_wstrncpy(newtitle, TranslateT("Message session"), _countof(newtitle)); + mir_snwprintf(newtitle, L"%s (%s): %s", contactName, szStatus, TranslateT("Message session")); - wchar_t oldtitle[256]; - GetWindowText(hwndDlg, oldtitle, _countof(oldtitle)); - if (mir_wstrcmp(newtitle, oldtitle)) { //swt() flickers even if the title hasn't actually changed - SetWindowText(hwndDlg, newtitle); - SendMessage(hwndDlg, WM_SIZE, 0, 0); + DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)wParam; + if (!cws || (!mir_strcmp(cws->szModule, dat->szProto) && !mir_strcmp(cws->szSetting, "Status"))) { + InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOCOL), NULL, TRUE); + if (statusIcon) + SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0); } + + dat->wOldStatus = dat->wStatus; + } + else mir_wstrncpy(newtitle, TranslateT("Message session"), _countof(newtitle)); + + wchar_t oldtitle[256]; + GetWindowText(hwndDlg, oldtitle, _countof(oldtitle)); + if (mir_wstrcmp(newtitle, oldtitle)) { //swt() flickers even if the title hasn't actually changed + SetWindowText(hwndDlg, newtitle); + SendMessage(hwndDlg, WM_SIZE, 0, 0); } break; @@ -1039,8 +1068,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l case DM_GETWINDOWSTATE: { - UINT state = 0; - state |= MSG_WINDOW_STATE_EXISTS; + UINT state = MSG_WINDOW_STATE_EXISTS; if (IsWindowVisible(hwndDlg)) state |= MSG_WINDOW_STATE_VISIBLE; if (GetForegroundWindow() == hwndDlg) @@ -1077,7 +1105,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l case WM_GETMINMAXINFO: { - MINMAXINFO* mmi = (MINMAXINFO *)lParam; + MINMAXINFO *mmi = (MINMAXINFO *)lParam; RECT rcWindow, rcLog; GetWindowRect(hwndDlg, &rcWindow); GetWindowRect(GetDlgItem(hwndDlg, IDC_LOG), &rcLog); @@ -1104,6 +1132,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l } Utils_ResizeDialog(hwndDlg, g_hInst, MAKEINTRESOURCEA(IDD_MSG), MessageDialogResize, (LPARAM)dat); + SetButtonsPos(dat, hwndDlg); // The statusbar sometimes draws over these 2 controls so // redraw them @@ -1318,7 +1347,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SetStretchBltMode(dis->hDC, HALFTONE); StretchBlt(dis->hDC, 1, 1, dat->avatarWidth - 2, dat->avatarHeight - 2, hdcMem, 0, 0, - bminfo.bmWidth, bminfo.bmHeight, SRCCOPY); + bminfo.bmWidth, bminfo.bmHeight, SRCCOPY); SelectObject(hdcMem, hbmMem); DeleteDC(hdcMem); @@ -1331,6 +1360,13 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (!lParam && Clist_MenuProcessCommand(LOWORD(wParam), MPCF_CONTACTMENU, dat->hContact)) break; + // custom button handling + if (HIWORD(wParam) == BN_CLICKED) + if (LOWORD(wParam) >= MIN_CBUTTONID && LOWORD(wParam) <= MAX_CBUTTONID) { + Srmm_ClickToolbarIcon(dat->hContact, LOWORD(wParam), GetDlgItem(hwndDlg, LOWORD(wParam)), 0); + break; + } + switch (LOWORD(wParam)) { case IDOK: if (IsWindowEnabled(GetDlgItem(hwndDlg, IDOK))) { @@ -1436,7 +1472,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l switch (((LPNMHDR)lParam)->code) { case EN_MSGFILTER: switch (((MSGFILTER *)lParam)->msg) { - HCURSOR hCur; + HCURSOR hCur; case WM_LBUTTONDOWN: hCur = GetCursor(); if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE) || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE)) { @@ -1600,7 +1636,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l mir_free(dat->cmdList[i]); dat->cmdList.destroy(); - WindowList_Remove(g_dat.hMessageWindowList, hwndDlg); + WindowList_Remove(pci->hWindowList, hwndDlg); db_set_dw(bSavePerContact ? dat->hContact : NULL, SRMMMOD, "splitterPos", dat->splitterPos); if (dat->hFont) { @@ -1624,10 +1660,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (db_get_b(dat->hContact, "CList", "NotOnList", 0)) db_delete_contact(dat->hContact); - Button_FreeIcon_IcoLib(hwndDlg, IDC_ADD); - Button_FreeIcon_IcoLib(hwndDlg, IDC_DETAILS); - Button_FreeIcon_IcoLib(hwndDlg, IDC_HISTORY); - Button_FreeIcon_IcoLib(hwndDlg, IDC_USERMENU); Window_FreeIcon_IcoLib(hwndDlg); delete dat; } diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index 3f43915736..c7b6095213 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -312,7 +312,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP db_set_dw(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, msgTimeout); ReloadGlobals(); - WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0); + WindowList_Broadcast(pci->hWindowList, DM_OPTIONSAPPLIED, 0, 0); return TRUE; } } @@ -407,7 +407,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, FreeMsgLogIcons(); LoadMsgLogIcons(); ReloadGlobals(); - WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0); + WindowList_Broadcast(pci->hWindowList, DM_OPTIONSAPPLIED, 0, 0); return TRUE; } break; @@ -536,7 +536,7 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY)); db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY)); ReloadGlobals(); - WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0); + WindowList_Broadcast(pci->hWindowList, DM_OPTIONSAPPLIED, 0, 0); } } break; @@ -549,11 +549,12 @@ static int OptInitialise(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 }; odp.position = 910000000; odp.hInstance = g_hInst; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGDLG); odp.szTab.a = LPGEN("Messaging"); + odp.flags = ODPF_BOLDGROUPS; + + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGDLG); odp.szTitle.a = LPGEN("Message sessions"); odp.pfnDlgProc = DlgProcOptions; - odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wParam, &odp); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGLOG); diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 7c68133a7c..43f1c0fa5c 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -62,7 +62,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam) pcli->pfnRemoveEvent(hContact, 1); /* does a window for the contact exist? */ - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact); + HWND hwnd = WindowList_Find(pci->hWindowList, hContact); if (hwnd) { if (!db_get_b(NULL, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, SRMSGDEFSET_DONOTSTEALFOCUS)) { ShowWindow(hwnd, SW_RESTORE); @@ -113,7 +113,7 @@ INT_PTR SendMessageCmd(MCONTACT hContact, char *msg, int isWchar) hContact = db_mc_tryMeta(hContact); - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact); + HWND hwnd = WindowList_Find(pci->hWindowList, hContact); if (hwnd) { if (msg) { SendDlgItemMessage(hwnd, IDC_MESSAGE, EM_SETSEL, -1, SendDlgItemMessage(hwnd, IDC_MESSAGE, WM_GETTEXTLENGTH, 0, 0)); @@ -164,7 +164,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam) SkinPlaySound((lParam) ? "TNStart" : "TNStop"); - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact); + HWND hwnd = WindowList_Find(pci->hWindowList, hContact); if (hwnd) SendMessage(hwnd, DM_TYPING, 0, lParam); else if (lParam && g_dat.flags.bShowTypingTray) { @@ -197,14 +197,14 @@ static int MessageSettingChanged(WPARAM hContact, LPARAM lParam) return 0; if (!strcmp(cws->szModule, "CList")) - WindowList_Broadcast(g_dat.hMessageWindowList, DM_UPDATETITLE, (WPARAM)cws, 0); + WindowList_Broadcast(pci->hWindowList, DM_UPDATETITLE, (WPARAM)cws, 0); else if (hContact) { if (cws->szSetting && !strcmp(cws->szSetting, "Timezone")) - WindowList_Broadcast(g_dat.hMessageWindowList, DM_NEWTIMEZONE, (WPARAM)cws, 0); + WindowList_Broadcast(pci->hWindowList, DM_NEWTIMEZONE, (WPARAM)cws, 0); else { char *szProto = GetContactProto(hContact); if (szProto && !strcmp(cws->szModule, szProto)) - WindowList_Broadcast(g_dat.hMessageWindowList, DM_UPDATETITLE, (WPARAM)cws, 0); + WindowList_Broadcast(pci->hWindowList, DM_UPDATETITLE, (WPARAM)cws, 0); } } return 0; @@ -213,7 +213,7 @@ static int MessageSettingChanged(WPARAM hContact, LPARAM lParam) // If a contact gets deleted, close its message window if there is any static int ContactDeleted(WPARAM wParam, LPARAM) { - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, wParam); + HWND hwnd = WindowList_Find(pci->hWindowList, wParam); if (hwnd) SendMessage(hwnd, WM_CLOSE, 0, 0); @@ -246,7 +246,7 @@ static void RestoreUnreadMessageAlerts(void) dbei.cbBlob = 0; db_event_get(hDbEvent, &dbei); if (!(dbei.flags & (DBEF_SENT | DBEF_READ)) && (dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei))) { - int windowAlreadyExists = WindowList_Find(g_dat.hMessageWindowList, hContact) != NULL; + int windowAlreadyExists = WindowList_Find(pci->hWindowList, hContact) != NULL; if (windowAlreadyExists) continue; @@ -284,9 +284,93 @@ static void RestoreUnreadMessageAlerts(void) void RegisterSRMMFonts(void); +int RegisterToolbarIcons(WPARAM, LPARAM) +{ + BBButton bbd = {}; + bbd.pszModuleName = "SRMM"; + bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_CREATEBYID; + + bbd.dwButtonID = IDC_ADD; + bbd.dwDefPos = 10; + bbd.hIcon = Skin_GetIconHandle(SKINICON_OTHER_ADDCONTACT); + bbd.pwszTooltip = LPGENW("Add contact permanently to list"); + Srmm_AddButton(&bbd); + + bbd.dwButtonID = IDC_USERMENU; + bbd.dwDefPos = 20; + bbd.hIcon = Skin_GetIconHandle(SKINICON_OTHER_DOWNARROW); + bbd.pwszTooltip = LPGENW("User menu"); + Srmm_AddButton(&bbd); + + bbd.dwButtonID = IDC_DETAILS; + bbd.dwDefPos = 30; + bbd.hIcon = Skin_GetIconHandle(SKINICON_OTHER_USERDETAILS); + bbd.pwszTooltip = LPGENW("View user's details"); + Srmm_AddButton(&bbd); + + bbd.bbbFlags |= BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON; + bbd.dwButtonID = IDC_HISTORY; + bbd.dwDefPos = 40; + bbd.hIcon = Skin_GetIconHandle(SKINICON_OTHER_HISTORY); + bbd.pwszTooltip = LPGENW("View user's history"); + Srmm_AddButton(&bbd); + + // chat buttons + bbd.bbbFlags = BBBF_ISPUSHBUTTON | BBBF_ISCHATBUTTON | BBBF_CREATEBYID; + bbd.dwButtonID = IDC_BOLD; + bbd.dwDefPos = 10; + bbd.hIcon = GetIconHandle("bold"); + bbd.pwszTooltip = LPGENW("Make the text bold(CTRL + B)"); + Srmm_AddButton(&bbd); + + bbd.dwButtonID = IDC_ITALICS; + bbd.dwDefPos = 15; + bbd.hIcon = GetIconHandle("italics"); + bbd.pwszTooltip = LPGENW("Make the text italicized (CTRL+I)"); + Srmm_AddButton(&bbd); + + bbd.dwButtonID = IDC_UNDERLINE; + bbd.dwDefPos = 20; + bbd.hIcon = GetIconHandle("underline"); + bbd.pwszTooltip = LPGENW("Make the text underlined (CTRL+U)"); + Srmm_AddButton(&bbd); + + bbd.dwButtonID = IDC_COLOR; + bbd.dwDefPos = 25; + bbd.hIcon = GetIconHandle("fgcol"); + bbd.pwszTooltip = LPGENW("Select a foreground color for the text (CTRL+K)"); + Srmm_AddButton(&bbd); + + bbd.dwButtonID = IDC_BKGCOLOR; + bbd.dwDefPos = 30; + bbd.hIcon = GetIconHandle("bkgcol"); + bbd.pwszTooltip = LPGENW("Select a background color for the text"); + Srmm_AddButton(&bbd); + + bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID; + bbd.dwButtonID = IDC_CHANMGR; + bbd.dwDefPos = 30; + bbd.hIcon = GetIconHandle("settings"); + bbd.pwszTooltip = LPGENW("Control this room (CTRL+O)"); + Srmm_AddButton(&bbd); + + bbd.dwButtonID = IDC_SHOWNICKLIST; + bbd.dwDefPos = 20; + bbd.hIcon = GetIconHandle("nicklist"); + bbd.pwszTooltip = LPGENW("Show/hide the nick list (CTRL+N)"); + Srmm_AddButton(&bbd); + + bbd.dwButtonID = IDC_FILTER; + bbd.dwDefPos = 10; + bbd.hIcon = GetIconHandle("filter"); + bbd.pwszTooltip = LPGENW("Enable/disable the event filter (CTRL+F)"); + Srmm_AddButton(&bbd); + return 0; +} + static int FontsChanged(WPARAM, LPARAM) { - WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0); + WindowList_Broadcast(pci->hWindowList, DM_OPTIONSAPPLIED, 0, 0); return 0; } @@ -306,6 +390,7 @@ static int SplitmsgModulesLoaded(WPARAM, LPARAM) hMsgMenuItem = Menu_AddContactMenuItem(&mi); HookEvent(ME_FONT_RELOAD, FontsChanged); + HookEvent(ME_MSG_TOOLBARLOADED, RegisterToolbarIcons); RestoreUnreadMessageAlerts(); return 0; @@ -313,7 +398,7 @@ static int SplitmsgModulesLoaded(WPARAM, LPARAM) int PreshutdownSendRecv(WPARAM, LPARAM) { - WindowList_Broadcast(g_dat.hMessageWindowList, WM_CLOSE, 0, 0); + WindowList_Broadcast(pci->hWindowList, WM_CLOSE, 0, 0); DeinitStatusIcons(); return 0; @@ -323,9 +408,9 @@ static int IconsChanged(WPARAM, LPARAM) { FreeMsgLogIcons(); LoadMsgLogIcons(); - WindowList_Broadcast(g_dat.hMessageWindowList, DM_REMAKELOG, 0, 0); + WindowList_Broadcast(pci->hWindowList, DM_REMAKELOG, 0, 0); // change all the icons - WindowList_Broadcast(g_dat.hMessageWindowList, DM_UPDATEWINICON, 0, 0); + WindowList_Broadcast(pci->hWindowList, DM_UPDATEWINICON, 0, 0); return 0; } @@ -361,7 +446,7 @@ static INT_PTR GetWindowClass(WPARAM wParam, LPARAM lParam) static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam) { - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, wParam); + HWND hwnd = WindowList_Find(pci->hWindowList, wParam); if (hwnd == NULL) return 1; @@ -389,7 +474,7 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam) if(mwd == NULL || (mwd->cbSize != sizeof(MessageWindowData))) return 1; - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, mwid->hContact); + HWND hwnd = WindowList_Find(pci->hWindowList, mwid->hContact); mwd->uFlags = MSG_WINDOW_UFLAG_MSG_BOTH; mwd->hwndWindow = hwnd; mwd->local = 0; diff --git a/src/core/stdmsg/src/msgtimedout.cpp b/src/core/stdmsg/src/msgtimedout.cpp index 2a39135e88..22a09500ad 100644 --- a/src/core/stdmsg/src/msgtimedout.cpp +++ b/src/core/stdmsg/src/msgtimedout.cpp @@ -93,11 +93,11 @@ void MessageFailureProcess(TMsgQueue *item, const char* err) { MCONTACT hContact = db_mc_tryMeta(item->hContact); - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact); + HWND hwnd = WindowList_Find(pci->hWindowList, hContact); if (hwnd == NULL) { // If message window doesn't already exist, open a new one SendMessageCmd(item->hContact, NULL, 0); - hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact); + hwnd = WindowList_Find(pci->hWindowList, hContact); } else SendMessage(hwnd, DM_REMAKELOG, 0, 0); diff --git a/src/core/stdmsg/src/resource.h b/src/core/stdmsg/src/resource.h index 197b67b769..3e90360cb3 100644 --- a/src/core/stdmsg/src/resource.h +++ b/src/core/stdmsg/src/resource.h @@ -67,7 +67,6 @@ #define IDC_AUTOCLOSE 1004 #define IDC_AUTOMIN 1005 #define IDC_DONOTSTEALFOCUS 1006 -#define IDC_SMILEY 1007 #define IDC_SPLITTERY 1008 #define IDC_SPLITTER 1008 #define IDC_NAME 1009 diff --git a/src/core/stdmsg/src/srmm.cpp b/src/core/stdmsg/src/srmm.cpp index 434d561160..d534862607 100644 --- a/src/core/stdmsg/src/srmm.cpp +++ b/src/core/stdmsg/src/srmm.cpp @@ -38,7 +38,7 @@ PLUGININFOEX pluginInfo = { __COPYRIGHT, __AUTHORWEB, UNICODE_AWARE, - {0x657fe89b, 0xd121, 0x40c2, { 0x8a, 0xc9, 0xb9, 0xfa, 0x57, 0x55, 0xb3, 0x0D }} //{657FE89B-D121-40c2-8AC9-B9FA5755B30D} + { 0x657fe89b, 0xd121, 0x40c2, { 0x8a, 0xc9, 0xb9, 0xfa, 0x57, 0x55, 0xb3, 0x0D } } //{657FE89B-D121-40c2-8AC9-B9FA5755B30D} }; BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) @@ -47,7 +47,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) return TRUE; } -extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD) +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { return &pluginInfo; } diff --git a/src/core/stdmsg/src/statusicon.cpp b/src/core/stdmsg/src/statusicon.cpp index fc3be1fe4e..50ee08084e 100644 --- a/src/core/stdmsg/src/statusicon.cpp +++ b/src/core/stdmsg/src/statusicon.cpp @@ -27,9 +27,9 @@ HANDLE hHookIconPressedEvt; static int OnSrmmIconChanged(WPARAM hContact, LPARAM) { if (hContact == NULL) - WindowList_Broadcast(g_dat.hMessageWindowList, DM_STATUSICONCHANGE, 0, 0); + WindowList_Broadcast(pci->hWindowList, DM_STATUSICONCHANGE, 0, 0); else { - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact); + HWND hwnd = WindowList_Find(pci->hWindowList, hContact); if (hwnd != NULL) PostMessage(hwnd, DM_STATUSICONCHANGE, 0, 0); } -- cgit v1.2.3