diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdmsg/res/resource.rc | 18 | ||||
-rw-r--r-- | src/core/stdmsg/src/chat_manager.cpp | 16 | ||||
-rw-r--r-- | src/core/stdmsg/src/chat_window.cpp | 17 | ||||
-rw-r--r-- | src/core/stdmsg/src/globals.cpp | 1 | ||||
-rw-r--r-- | src/core/stdmsg/src/globals.h | 1 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 46 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgoptions.cpp | 4 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.cpp | 39 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.h | 15 | ||||
-rw-r--r-- | src/core/stdmsg/src/resource.h | 1 | ||||
-rw-r--r-- | src/core/stdmsg/src/stdafx.h | 9 | ||||
-rw-r--r-- | src/core/stdmsg/src/tabs.cpp | 62 | ||||
-rw-r--r-- | src/mir_app/src/chat_tools.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/proto_opts.cpp | 4 | ||||
-rw-r--r-- | src/mir_core/src/CCtrlBase.cpp | 3 | ||||
-rw-r--r-- | src/mir_core/src/CDlgBase.cpp | 5 |
16 files changed, 140 insertions, 103 deletions
diff --git a/src/core/stdmsg/res/resource.rc b/src/core/stdmsg/res/resource.rc index 78770d7b6a..4e1be5d546 100644 --- a/src/core/stdmsg/res/resource.rc +++ b/src/core/stdmsg/res/resource.rc @@ -41,19 +41,21 @@ BEGIN CONTROL "Close the message window on send",IDC_AUTOCLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,50,289,10
CONTROL "Minimize the message window on send",IDC_AUTOMIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,62,289,10
+ CONTROL "Use the contact's status icon as the window icon",IDC_STATUSWIN,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,75,290,10
CONTROL "Save the window size and location individually for each contact",IDC_SAVEPERCONTACT,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,86,289,10
- CONTROL "Cascade new windows",IDC_CASCADE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,98,289,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,88,289,10
+ CONTROL "Cascade new windows",IDC_CASCADE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,100,289,10
CONTROL "Support CTRL+Up/Down in message area to show previously sent messages",IDC_CTRLSUPPORT,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,110,289,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,112,289,10
CONTROL "Delete temporary contacts when closing message window",IDC_DELTEMP,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,122,287,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,124,287,10
CONTROL "Enable avatar support in the message window",IDC_AVATARSUPPORT,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,135,289,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,137,289,10
- CONTROL "Limit avatar height to",IDC_LIMITAVATARH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,149,126,10
- EDITTEXT IDC_AVATARHEIGHT,148,148,28,13,ES_AUTOHSCROLL
- LTEXT "pixels",IDC_STATIC,181,150,35,8
+ CONTROL "Limit avatar height to",IDC_LIMITAVATARH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,151,126,10
+ EDITTEXT IDC_AVATARHEIGHT,148,150,28,13,ES_AUTOHSCROLL
+ LTEXT "pixels",IDC_STATIC,181,152,35,8
CONTROL "Show 'Send' button",IDC_SHOWSENDBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,166,135,10
CONTROL "Show character count",IDC_CHARCOUNT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,179,135,10
diff --git a/src/core/stdmsg/src/chat_manager.cpp b/src/core/stdmsg/src/chat_manager.cpp index fd0bf8cf8a..b4b8c880c3 100644 --- a/src/core/stdmsg/src/chat_manager.cpp +++ b/src/core/stdmsg/src/chat_manager.cpp @@ -90,24 +90,24 @@ static void OnReplaceSession(SESSION_INFO *si) static void OnFlashHighlight(SESSION_INFO *si, int bInactive) { - if (!bInactive) + if (!bInactive || si->pDlg == nullptr) return; - if (!g_Settings.bTabsEnable && si->pDlg && g_Settings.bFlashWindowHighlight) - SetTimer(si->pDlg->GetHwnd(), TIMERID_FLASHWND, 900, nullptr); - if (g_Settings.bTabsEnable && si->pDlg) + if (g_Settings.bTabsEnable) g_pTabDialog->SetMessageHighlight(si->pDlg); + else if (g_Settings.bFlashWindowHighlight) + si->pDlg->StartFlash(); } static void OnFlashWindow(SESSION_INFO *si, int bInactive) { - if (!bInactive) + if (!bInactive || si->pDlg == nullptr) return; - if (!g_Settings.bTabsEnable && si->pDlg && g_Settings.bFlashWindow) - SetTimer(si->pDlg->GetHwnd(), TIMERID_FLASHWND, 900, nullptr); - if (g_Settings.bTabsEnable && si->pDlg) + if (g_Settings.bTabsEnable) g_pTabDialog->SetTabHighlight(si->pDlg); + else if (g_Settings.bFlashWindow) + si->pDlg->StartFlash(); } static BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce) diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index 61600f5619..99c2e2fd1e 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -28,9 +28,8 @@ static wchar_t szTrimString[] = L":;,.!?\'\"><()[]- \r\n"; ///////////////////////////////////////////////////////////////////////////////////////// -CChatRoomDlg::CChatRoomDlg(CTabbedWindow *pContainer, SESSION_INFO *si) : - CSuper(IDD_CHANNEL, si), - m_pOwner(pContainer), +CChatRoomDlg::CChatRoomDlg(CTabbedWindow *pOwner, SESSION_INFO *si) : + CSuper(pOwner, IDD_CHANNEL, si), m_btnOk(this, IDOK), m_splitterX(this, IDC_SPLITTERX), @@ -100,8 +99,7 @@ void CChatRoomDlg::OnActivate() pci->SetActiveSession(m_si); UpdateStatusBar(); - if (KillTimer(m_hwnd, TIMERID_FLASHWND)) - FlashWindow(m_pOwner->GetHwnd(), FALSE); + StopFlash(); if (db_get_w(m_hContact, m_si->pszModule, "ApparentMode", 0) != 0) db_set_w(m_hContact, m_si->pszModule, "ApparentMode", 0); if (pcli->pfnGetEvent(m_hContact, 0)) @@ -199,7 +197,7 @@ void CChatRoomDlg::onSplitterY(CSplitter *pSplitter) int CChatRoomDlg::GetImageId() const { - if (m_si->wState & GC_EVENT_HIGHLIGHT) + if ((m_si->wState & GC_EVENT_HIGHLIGHT) && (m_nFlash & 1)) return 0; MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule); @@ -297,6 +295,8 @@ void CChatRoomDlg::UpdateOptions() SendMessage(m_pOwner->m_hwndStatus, SB_SETICON, 0, (LPARAM)hIcon); + Window_SetIcon_IcoLib(m_pOwner->GetHwnd(), GetIconHandle("window")); + m_log.SendMsg(EM_SETBKGNDCOLOR, 0, g_Settings.crLogBackground); CHARFORMAT2 cf; @@ -1100,11 +1100,6 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) } break; - case WM_TIMER: - if (wParam == TIMERID_FLASHWND) - FlashWindow(m_pOwner->GetHwnd(), TRUE); - break; - case WM_ACTIVATE: if (LOWORD(wParam) == WA_INACTIVE) { if (g_Settings.bTabsEnable) { diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp index 4a3632a363..88ba9ea8e8 100644 --- a/src/core/stdmsg/src/globals.cpp +++ b/src/core/stdmsg/src/globals.cpp @@ -129,6 +129,7 @@ GlobalMessageData::GlobalMessageData() : bDeleteTempCont(SRMMMOD, "DeleteTempCont", false),
bSavePerContact(SRMMMOD, "SavePerContact", false),
bDoNotStealFocus(SRMMMOD, "DoNotStealFocus", false),
+ bUseStatusWinIcon(SRMMMOD, "UseStatusWinIcon", true),
bLimitAvatarHeight(SRMMMOD, "AvatarLimitHeight", true),
iAvatarHeight(SRMMMOD, "AvatarHeight", 60),
diff --git a/src/core/stdmsg/src/globals.h b/src/core/stdmsg/src/globals.h index a0ad036b01..78148da5cd 100644 --- a/src/core/stdmsg/src/globals.h +++ b/src/core/stdmsg/src/globals.h @@ -52,6 +52,7 @@ struct GlobalMessageData CMOption<bool> bDoNotStealFocus;
CMOption<bool> bCascade;
CMOption<bool> bDeleteTempCont;
+ CMOption<bool> bUseStatusWinIcon;
CMOption<bool> bLimitAvatarHeight;
CMOption<WORD> iAvatarHeight;
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 3413431016..572ae73bec 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -85,12 +85,11 @@ static void SetEditorText(HWND hwnd, const wchar_t* txt) /////////////////////////////////////////////////////////////////////////////////////////
CSrmmWindow::CSrmmWindow(CTabbedWindow *pOwner, MCONTACT hContact) :
- CSuper(IDD_MSG),
+ CSuper(pOwner, IDD_MSG),
m_splitter(this, IDC_SPLITTERY),
m_avatar(this, IDC_AVATAR),
m_cmdList(20),
- m_bNoActivate(g_dat.bDoNotStealFocus),
- m_pOwner(pOwner)
+ m_bNoActivate(g_dat.bDoNotStealFocus)
{
m_hContact = hContact;
@@ -242,7 +241,7 @@ void CSrmmWindow::OnInitDialog() if (m_bNoActivate) {
SetWindowPos(m_hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW);
- SetTimer(m_hwnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, nullptr);
+ StartFlash();
}
else {
SetWindowPos(m_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
@@ -314,8 +313,7 @@ void CSrmmWindow::OnActivate() SetFocus(m_message.GetHwnd());
UpdateTitle();
UpdateLastMessage();
- if (KillTimer(m_hwnd, TIMERID_FLASHWND))
- FlashWindow(m_pOwner->GetHwnd(), FALSE);
+ StopFlash();
SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0);
}
@@ -455,6 +453,9 @@ void CSrmmWindow::OnSplitterMoved(CSplitter *pSplitter) int CSrmmWindow::GetImageId() const
{
+ if (m_nFlash & 1)
+ return 0;
+
return (WORD)pcli->pfnIconFromStatusMode(m_szProto, m_wStatus, m_hContact);
}
@@ -619,7 +620,8 @@ void CSrmmWindow::UpdateIcon(WPARAM wParam) m_hStatusIcon = hIcon;
}
- SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0);
+ if (g_dat.bUseStatusWinIcon)
+ SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0);
}
}
@@ -655,12 +657,17 @@ void CSrmmWindow::UpdateTitle() if (m_hContact && m_szProto) {
m_wStatus = db_get_w(m_hContact, m_szProto, "Status", ID_STATUS_OFFLINE);
wchar_t *contactName = Clist_GetContactDisplayName(m_hContact);
- wchar_t *szStatus = Clist_GetStatusModeDescription(m_wStatus, 0);
- mir_snwprintf(newtitle, L"%s (%s): %s", contactName, szStatus, TranslateT("Message session"));
+
+ if (g_dat.bUseStatusWinIcon)
+ mir_snwprintf(newtitle, L"%s - %s", contactName, TranslateT("Message session"));
+ else {
+ wchar_t *szStatus = Clist_GetStatusModeDescription(m_szProto == nullptr ? ID_STATUS_OFFLINE : db_get_w(m_hContact, m_szProto, "Status", ID_STATUS_OFFLINE), 0);
+ mir_snwprintf(newtitle, L"%s (%s): %s", contactName, szStatus, TranslateT("Message session"));
+ }
m_wOldStatus = m_wStatus;
}
- else mir_wstrncpy(newtitle, TranslateT("Message session"), _countof(newtitle));
+ else wcsncpy_s(newtitle, TranslateT("Message session"), _TRUNCATE);
if (this == m_pOwner->CurrPage()) {
wchar_t oldtitle[256];
@@ -1146,6 +1153,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
bool isMessage = (dbei.eventType == EVENTTYPE_MESSAGE), isSent = ((dbei.flags & DBEF_SENT) != 0);
+ bool isActive = IsActive();
if (DbEventIsShown(&dbei)) {
// Sounds *only* for sent messages, not for custom events
if (isMessage && !isSent) {
@@ -1165,17 +1173,17 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) // Flash window *only* for messages, not for custom events
if (isMessage && !isSent) {
- if (GetActiveWindow() == m_pOwner->GetHwnd() && GetForegroundWindow() == m_pOwner->GetHwnd()) {
+ if (isActive) {
if (GetWindowLongPtr(m_log.GetHwnd(), GWL_STYLE) & WS_VSCROLL) {
SCROLLINFO si = {};
si.cbSize = sizeof(si);
si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS;
GetScrollInfo(m_log.GetHwnd(), SB_VERT, &si);
if ((si.nPos + (int)si.nPage + 5) < si.nMax)
- SetTimer(m_hwnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, nullptr);
+ StartFlash();
}
}
- else SetTimer(m_hwnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, nullptr);
+ else StartFlash();
}
}
}
@@ -1188,13 +1196,8 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_TIMER:
if (wParam == TIMERID_FLASHWND) {
- FlashWindow(m_pOwner->GetHwnd(), TRUE);
- if (m_nFlash > 2 * g_dat.nFlashMax) {
- KillTimer(m_hwnd, TIMERID_FLASHWND);
- FlashWindow(m_pOwner->GetHwnd(), FALSE);
- m_nFlash = 0;
- }
- m_nFlash++;
+ if (m_nFlash > 2 * g_dat.nFlashMax)
+ StopFlash();
}
else if (wParam == TIMERID_TYPE) {
ShowTime(false);
@@ -1382,8 +1385,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS;
GetScrollInfo((HWND)lParam, SB_VERT, &si);
if ((si.nPos + (int)si.nPage + 5) >= si.nMax)
- if (KillTimer(m_hwnd, TIMERID_FLASHWND))
- FlashWindow(m_pOwner->GetHwnd(), FALSE);
+ StopFlash();
}
break;
}
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index 6c62b74d07..917de61ce3 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -153,7 +153,7 @@ statusValues[] = class COptionMainDlg : public CPluginDlgBase
{
CCtrlEdit edtNFlash, edtAvatarH, edtSecs;
- CCtrlCheck chkAutoMin, chkAutoClose, chkSavePerContact, chkDoNotStealFocus;
+ CCtrlCheck chkAutoMin, chkAutoClose, chkSavePerContact, chkDoNotStealFocus, chkStatusWin;
CCtrlCheck chkDelTemp, chkCascade, chkCharCount, chkCtrlSupport;
CCtrlCheck chkAvatar, chkLimitAvatar;
CCtrlCheck chkSendOnEnter, chkSendOnDblEnter, chkSendOnCtrlEnter, chkShowSend, chkShowButtons;
@@ -205,6 +205,7 @@ public: chkShowSend(this, IDC_SHOWSENDBTN),
chkAutoClose(this, IDC_AUTOCLOSE),
chkCharCount(this, IDC_CHARCOUNT),
+ chkStatusWin(this, IDC_STATUSWIN),
chkLimitAvatar(this, IDC_LIMITAVATARH),
chkShowButtons(this, IDC_SHOWBUTTONLINE),
chkCtrlSupport(this, IDC_CTRLSUPPORT),
@@ -234,6 +235,7 @@ public: CreateLink(chkAutoClose, g_dat.bAutoClose);
CreateLink(chkShowSend, g_dat.bSendButton);
CreateLink(chkCharCount, g_dat.bShowReadChar);
+ CreateLink(chkStatusWin, g_dat.bUseStatusWinIcon);
CreateLink(chkShowButtons, g_dat.bShowButtons);
CreateLink(chkCtrlSupport, g_dat.bCtrlSupport);
CreateLink(chkSendOnEnter, g_dat.bSendOnEnter);
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 0901f60c96..e94b2386b5 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -24,9 +24,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /////////////////////////////////////////////////////////////////////////////////////////
-CMsgDialog::CMsgDialog(int iDialogId, SESSION_INFO *si)
- : CSuper(g_hInst, iDialogId, si),
- m_btnOk(this, IDOK)
+CMsgDialog::CMsgDialog(CTabbedWindow *pOwner, int iDialogId, SESSION_INFO *si) :
+ CSuper(g_hInst, iDialogId, si),
+ m_btnOk(this, IDOK),
+ m_pOwner(pOwner)
{
m_autoClose = 0;
m_forceResizable = true;
@@ -49,6 +50,14 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) OnActivate();
break;
+ case WM_TIMER:
+ if (wParam == TIMERID_FLASHWND) {
+ m_pOwner->FixTabIcons(this);
+ FlashWindow(m_pOwner->GetHwnd(), TRUE);
+ m_nFlash++;
+ }
+ break;
+
case WM_MOUSEACTIVATE:
OnActivate();
SetFocus(m_message.GetHwnd());
@@ -58,6 +67,30 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) return CSuper::DlgProc(uMsg, wParam, lParam);
}
+bool CMsgDialog::IsActive() const
+{
+ bool bRes = m_pOwner->IsActive();
+ if (g_Settings.bTabsEnable && bRes)
+ bRes &= m_pOwner->m_tab.GetActivePage() == this;
+
+ return bRes;
+}
+
+void CMsgDialog::StartFlash()
+{
+ ::SetTimer(m_hwnd, TIMERID_FLASHWND, 900, nullptr);
+}
+
+void CMsgDialog::StopFlash()
+{
+ if (::KillTimer(m_hwnd, TIMERID_FLASHWND)) {
+ ::FlashWindow(m_pOwner->GetHwnd(), FALSE);
+
+ m_nFlash = 0;
+ m_pOwner->FixTabIcons(this);
+ }
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
int OnCheckPlugins(WPARAM, LPARAM);
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 07917e2736..7ae389fab0 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -50,10 +50,10 @@ class CMsgDialog : public CSrmmBaseDialog protected:
CCtrlButton m_btnOk;
+ CTabbedWindow *m_pOwner;
+ DWORD m_nFlash = 0;
- CMsgDialog(int idDialog, SESSION_INFO *si = nullptr);
-
- virtual int GetImageId() const PURE;
+ CMsgDialog(CTabbedWindow *pOwner, int idDialog, SESSION_INFO *si = nullptr);
virtual const char* GetProto() const PURE;
virtual int GetStatus() const PURE;
@@ -63,7 +63,13 @@ protected: INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
public:
+ virtual int GetImageId() const PURE;
+
void CloseTab() override;
+ bool IsActive() const override;
+
+ void StartFlash();
+ void StopFlash();
__forceinline SESSION_INFO* getChat() const { return m_si; }
};
@@ -96,7 +102,6 @@ class CSrmmWindow : public CMsgDialog RECT m_minEditInit;
int m_windowWasCascaded;
- DWORD m_nFlash;
int m_nTypeSecs, m_nTypeMode;
int m_limitAvatarH;
DWORD m_nLastTyping;
@@ -118,7 +123,6 @@ public: HBITMAP m_avatarPic;
wchar_t *m_wszInitialText;
- CTabbedWindow *m_pOwner;
public:
CSrmmWindow(CTabbedWindow*, MCONTACT hContact);
@@ -174,7 +178,6 @@ class CChatRoomDlg : public CMsgDialog CCtrlButton m_btnOk;
CSplitter m_splitterX, m_splitterY;
- CTabbedWindow *m_pOwner;
int m_iSplitterX, m_iSplitterY;
diff --git a/src/core/stdmsg/src/resource.h b/src/core/stdmsg/src/resource.h index 92b72236fb..affe1f1b02 100644 --- a/src/core/stdmsg/src/resource.h +++ b/src/core/stdmsg/src/resource.h @@ -136,6 +136,7 @@ #define IDC_ERRORTEXT 1596
#define IDC_MSGTEXT 1597
#define IDC_SHOWNOTIFY 1600
+#define IDC_STATUSWIN 1601
#define IDC_TYPEWIN 1602
#define IDC_CHARCOUNT 1603
#define IDC_TYPETRAY 1603
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h index 099a07c086..00b1304b57 100644 --- a/src/core/stdmsg/src/stdafx.h +++ b/src/core/stdmsg/src/stdafx.h @@ -155,13 +155,18 @@ public: CTabbedWindow();
+ bool IsActive() const
+ {
+ return GetActiveWindow() == m_hwnd && GetForegroundWindow() == m_hwnd;
+ }
+
CTabbedWindow* AddPage(MCONTACT hContact, wchar_t *pwszText = nullptr, int iActivate = -1);
CMsgDialog* CurrPage() const;
void AddPage(SESSION_INFO*, int insertAt = -1);
void FixTabIcons(CMsgDialog*);
- void SetMessageHighlight(CChatRoomDlg*);
- void SetTabHighlight(CChatRoomDlg*);
+ void SetMessageHighlight(CMsgDialog*);
+ void SetTabHighlight(CMsgDialog*);
void TabClicked();
virtual void OnInitDialog() override;
diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp index 8f4595fc1a..67544cb86f 100644 --- a/src/core/stdmsg/src/tabs.cpp +++ b/src/core/stdmsg/src/tabs.cpp @@ -78,16 +78,11 @@ static LRESULT CALLBACK TabSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR if (idx != -1) { CMsgDialog *pDlg = (CMsgDialog*)pOwner->m_tab.GetNthPage(idx); if (pDlg) { - SESSION_INFO *si = pDlg->getChat(); - if (si != nullptr) { - bool bOnline = db_get_w(si->hContact, si->pszModule, "Status", ID_STATUS_OFFLINE) == ID_STATUS_ONLINE; - MODULEINFO *mi = pci->MM_FindModule(si->pszModule); - bDragging = true; - iBeginIndex = idx; - ImageList_BeginDrag(Clist_GetImageList(), bOnline ? mi->OnlineIconIndex : mi->OfflineIconIndex, 8, 8); - ImageList_DragEnter(hwnd, tci.pt.x, tci.pt.y); - SetCapture(hwnd); - } + bDragging = true; + iBeginIndex = idx; + ImageList_BeginDrag(Clist_GetImageList(), pDlg->GetImageId(), 8, 8); + ImageList_DragEnter(hwnd, tci.pt.x, tci.pt.y); + SetCapture(hwnd); } return TRUE; } @@ -309,7 +304,12 @@ void CTabbedWindow::FixTabIcons(CMsgDialog *pDlg) // set the container's icon only if we're processing the current page if (pDlg == CurrPage()) { Window_FreeIcon_IcoLib(m_hwnd); - Window_SetProtoIcon_IcoLib(m_hwnd, pDlg->GetProto(), pDlg->GetStatus()); + if (g_dat.bUseStatusWinIcon) + Window_SetProtoIcon_IcoLib(m_hwnd, pDlg->GetProto(), pDlg->GetStatus()); + else if (pDlg->isChat()) + Window_SetIcon_IcoLib(m_hwnd, GetIconHandle("window")); + else + Window_SetSkinIcon_IcoLib(m_hwnd, SKINICON_EVENT_MESSAGE); } } @@ -332,31 +332,25 @@ void CTabbedWindow::SaveWindowPosition(bool bUpdateSession) } } -void CTabbedWindow::SetMessageHighlight(CChatRoomDlg *pDlg) +void CTabbedWindow::SetMessageHighlight(CMsgDialog *pDlg) { - if (pDlg != nullptr) { - if (m_tab.GetDlgIndex(pDlg) == -1) - return; + if (m_tab.GetDlgIndex(pDlg) == -1) + return; - pDlg->m_si->wState |= GC_EVENT_HIGHLIGHT; - FixTabIcons(pDlg); - if (g_Settings.bFlashWindowHighlight && GetActiveWindow() != m_hwnd && GetForegroundWindow() != m_hwnd) - SetTimer(m_hwnd, TIMERID_FLASHWND, 900, nullptr); - } - else RedrawWindow(m_tab.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE); + pDlg->m_si->wState |= GC_EVENT_HIGHLIGHT; + FixTabIcons(pDlg); + if (g_Settings.bFlashWindowHighlight && pDlg != m_tab.GetActivePage()) + pDlg->StartFlash(); } -void CTabbedWindow::SetTabHighlight(CChatRoomDlg *pDlg) +void CTabbedWindow::SetTabHighlight(CMsgDialog *pDlg) { - if (pDlg != nullptr) { - if (m_tab.GetDlgIndex(pDlg) == -1) - return; + if (m_tab.GetDlgIndex(pDlg) == -1) + return; - FixTabIcons(pDlg); - if (g_Settings.bFlashWindow && GetActiveWindow() != m_hwnd && GetForegroundWindow() != m_hwnd) - SetTimer(m_hwnd, TIMERID_FLASHWND, 900, nullptr); - } - else RedrawWindow(m_tab.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE); + FixTabIcons(pDlg); + if (g_Settings.bFlashWindow && pDlg != m_tab.GetActivePage()) + pDlg->StartFlash(); } void CTabbedWindow::SetWindowPosition() @@ -412,12 +406,13 @@ void CTabbedWindow::TabClicked() pcli->pfnRemoveEvent(s->hContact, GC_FAKE_EVENT); } - FixTabIcons(pDlg); if (!s->pDlg) { pci->ShowRoom(s); SendMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0); } } + + FixTabIcons(pDlg); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -535,11 +530,6 @@ INT_PTR CTabbedWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) } break; - case WM_TIMER: - if (wParam == TIMERID_FLASHWND) - FlashWindow(m_hwnd, TRUE); - break; - case WM_MOVE: SaveWindowPosition(false); break; diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp index 71d0a830ea..4da02f7426 100644 --- a/src/mir_app/src/chat_tools.cpp +++ b/src/mir_app/src/chat_tools.cpp @@ -284,7 +284,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight if (!gce || !si || gce->bIsMe || si->iType == GCW_SERVER)
return FALSE;
- BOOL bInactive = si->pDlg == nullptr || !ContainsWindow(GetForegroundWindow(), si->pDlg->GetHwnd());
+ BOOL bInactive = si->pDlg == nullptr || !si->pDlg->IsActive();
int iEvent = gce->iType;
diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp index 884577650e..f09febbc07 100644 --- a/src/mir_app/src/proto_opts.cpp +++ b/src/mir_app/src/proto_opts.cpp @@ -622,10 +622,8 @@ public: int idx = m_accList.GetCurSel();
if (idx != -1) {
PROTOACCOUNT *pa = (PROTOACCOUNT*)m_accList.GetItemData(idx);
- if (pa) {
+ if (pa)
pa->bAccMgrUIChanged = true;
- NotifyChange();
- }
}
}
};
diff --git a/src/mir_core/src/CCtrlBase.cpp b/src/mir_core/src/CCtrlBase.cpp index e0532b68a7..83d7243ab6 100644 --- a/src/mir_core/src/CCtrlBase.cpp +++ b/src/mir_core/src/CCtrlBase.cpp @@ -96,8 +96,7 @@ void CCtrlBase::NotifyChange() m_bChanged = true; if (m_parentWnd && !m_bSilent) - if (m_parentWnd->IsInitialized()) - ::SendMessage(::GetParent(m_parentWnd->GetHwnd()), PSM_CHANGED, 0, 0); + m_parentWnd->NotifyChange(); OnChange(this); } diff --git a/src/mir_core/src/CDlgBase.cpp b/src/mir_core/src/CDlgBase.cpp index ed3de8d553..e1eee42d94 100644 --- a/src/mir_core/src/CDlgBase.cpp +++ b/src/mir_core/src/CDlgBase.cpp @@ -90,6 +90,11 @@ void CDlgBase::EndModal(INT_PTR nResult) void CDlgBase::NotifyChange(void) { + if (!m_initialized) + return; + + OnChange(); + if (m_hwndParent) SendMessage(m_hwndParent, PSM_CHANGED, (WPARAM)m_hwnd, 0); } |