diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-06-14 17:31:23 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-06-14 17:31:23 +0000 |
commit | 469640071ddd9581b45f70f3dc2b9c4c2cc31199 (patch) | |
tree | 3a5356d0471bbd160e7e37aaf20f3ab376cb902d /plugins/TabSRMM/src/msgs.cpp | |
parent | c3a49bd95dce1276b4b02e0c236146f2184e31cc (diff) |
MS_MSG_SETSTATUSTEXT improvements
- clear statusbar by using NULL as lParam
- TabSRMM: remember custom statusbar text when switching between tabs
git-svn-id: http://svn.miranda-ng.org/main/trunk@9481 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src/msgs.cpp')
-rw-r--r-- | plugins/TabSRMM/src/msgs.cpp | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index a1457a036e..8fa4965b25 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -120,39 +120,32 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam) static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam) { - StatusTextData *st = (StatusTextData*)lParam; - if (st == NULL) - return 1; - - if (st->cbSize != sizeof(StatusTextData)) - return 1; - - TContainerData *pContainer; + TWindowData *dat; HWND hwnd = M.FindWindow(wParam); if (hwnd != NULL) { - TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA); - if (dat == NULL || (pContainer = dat->pContainer) == NULL) - return 1; - - if (st->tszText == NULL) { - DM_UpdateLastMessage(dat); - return 0; - } - - _tcsncpy(dat->szStatusBar, (TCHAR*)st->tszText, SIZEOF(dat->szStatusBar)); - - if (pContainer->hwndActive != dat->hwnd) - return 1; + dat = (TWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA); } else { SESSION_INFO *si = SM_FindSessionByHCONTACT(wParam); - if (si == NULL || si->hWnd == 0 || (pContainer = si->pContainer) == NULL || pContainer->hwndActive != si->hWnd) + if (si == NULL) return 1; + + dat = si->dat; } - SendMessage(pContainer->hwndStatus, SB_SETICON, 0, (LPARAM)st->hIcon); - SendMessage(pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)st->tszText); + // delete old custom data + if (dat->sbCustom) { + delete dat->sbCustom; + dat->sbCustom = NULL; + } + + StatusTextData *st = (StatusTextData*)lParam; + if (st != NULL && st->cbSize == sizeof(StatusTextData)) + dat->sbCustom = new StatusTextData(*st); + + UpdateStatusBar(dat); + return 0; } |