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 | |
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')
-rw-r--r-- | plugins/TabSRMM/src/chat/window.cpp | 6 | ||||
-rw-r--r-- | plugins/TabSRMM/src/generic_msghandlers.cpp | 5 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 5 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgutils.cpp | 20 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.cpp | 41 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.h | 2 |
6 files changed, 48 insertions, 31 deletions
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index e509d05ed1..6b3ea4b366 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -1873,6 +1873,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar si->iSplitterY = GetDefaultMinimumInputHeight(dat); #endif dat->pWnd = 0; + dat->sbCustom = 0; CProxyWindow::add(dat); dat->fInsertMode = FALSE; @@ -3645,6 +3646,11 @@ LABEL_SHOWWINDOW: delete dat->pWnd; dat->pWnd = 0; } + if (dat->sbCustom) { + delete dat->sbCustom; + dat->sbCustom = 0; + } + //MAD M.RemoveWindow(hwndDlg); diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index f0fb3246ed..f9cb6bcfe0 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -1077,6 +1077,11 @@ void TSAPI DM_UpdateLastMessage(const TWindowData *dat) SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, (LPARAM)PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING]); mir_sntprintf(szBuf, SIZEOF(szBuf), TranslateT("%s is typing a message..."), dat->cache->getNick()); } + else if (dat->sbCustom) { + SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, (LPARAM)dat->sbCustom->hIcon); + SendMessage(dat->pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)dat->sbCustom->tszText); + return; + } else { SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, 0); diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 1d92b1aacb..66c5d7d6e3 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -1254,6 +1254,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP M.AddWindow(hwndDlg, dat->hContact);
BroadCastContainer(m_pContainer, DM_REFRESHTABINDEX, 0, 0);
dat->pWnd = 0;
+ dat->sbCustom = 0;
CProxyWindow::add(dat);
dat->szProto = const_cast<char *>(dat->cache->getProto());
dat->bIsMeta = dat->cache->isMeta();
@@ -3515,6 +3516,10 @@ quote_from_last: delete dat->pWnd;
dat->pWnd = 0;
}
+ if (dat->sbCustom) {
+ delete dat->sbCustom;
+ dat->sbCustom = 0;
+ }
break;
case WM_DWMCOMPOSITIONCHANGED:
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index b26a8f977a..7a82c97bcf 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -493,20 +493,28 @@ void TSAPI UpdateStatusBar(const TWindowData *dat) {
if (dat && dat->pContainer->hwndStatus && dat->pContainer->hwndActive == dat->hwnd) {
if (dat->bType == SESSIONTYPE_IM) {
- /*if (dat->szStatusBarCustom[0]) {
- SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, 0);
- SendMessage(dat->pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)dat->szStatusBarCustom);
- } else*/ if (dat->szStatusBar[0]) {
+ if (dat->szStatusBar[0]) {
SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, (LPARAM)PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING]);
SendMessage(dat->pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)dat->szStatusBar);
}
+ else if (dat->sbCustom) {
+ SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, (LPARAM)dat->sbCustom->hIcon);
+ SendMessage(dat->pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)dat->sbCustom->tszText);
+ }
else {
SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, 0);
DM_UpdateLastMessage(dat);
}
}
- else
- SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, 0);
+ else {
+ if (dat->sbCustom) {
+ SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, (LPARAM)dat->sbCustom->hIcon);
+ SendMessage(dat->pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)dat->sbCustom->tszText);
+ }
+ else {
+ SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, 0);
+ }
+ }
UpdateReadChars(dat);
InvalidateRect(dat->pContainer->hwndStatus, NULL, TRUE);
SendMessage(dat->pContainer->hwndStatus, WM_USER + 101, 0, (LPARAM)dat);
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; } diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index b72f5cd47d..053d098c03 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -247,7 +247,7 @@ struct TWindowData char *szProto;
TCHAR szMyNickname[130];
TCHAR szStatusBar[100];
- TCHAR szStatusBarCustom[100];
+ StatusTextData *sbCustom;
TCHAR newtitle[130]; // tab title...
TCHAR szStatus[50];
WORD wStatus;
|