summaryrefslogtreecommitdiff
path: root/src/core/stdmsg
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-06-01 20:56:10 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-06-01 20:56:17 +0300
commit6a706392797340cd94386352e862ec47f57b63e6 (patch)
treef1fb2c4975805810b9137afb5781c14cd1445cd3 /src/core/stdmsg
parent22f1d8788b73e0a3f9b74fe2e3a021da9bcf75ee (diff)
fixed #1369 (StdMsg: option "Use the contact's status icon as the window icon" is restored back)
Diffstat (limited to 'src/core/stdmsg')
-rw-r--r--src/core/stdmsg/res/resource.rc18
-rw-r--r--src/core/stdmsg/src/chat_window.cpp2
-rw-r--r--src/core/stdmsg/src/globals.cpp1
-rw-r--r--src/core/stdmsg/src/globals.h1
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp14
-rw-r--r--src/core/stdmsg/src/msgoptions.cpp4
-rw-r--r--src/core/stdmsg/src/resource.h1
-rw-r--r--src/core/stdmsg/src/tabs.cpp10
8 files changed, 36 insertions, 15 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_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index 8b2aa83de4..46f2a522e8 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -297,6 +297,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;
diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp
index 968e845c0d..43e116e720 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 8a9524e3b4..e12e853190 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -619,7 +619,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 +656,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];
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp
index 99f034c6fa..f64e0361d6 100644
--- a/src/core/stdmsg/src/msgoptions.cpp
+++ b/src/core/stdmsg/src/msgoptions.cpp
@@ -153,7 +153,7 @@ statusValues[] =
class COptionMainDlg : public CDlgBase
{
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/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/tabs.cpp b/src/core/stdmsg/src/tabs.cpp
index eee76499a3..f9e706c472 100644
--- a/src/core/stdmsg/src/tabs.cpp
+++ b/src/core/stdmsg/src/tabs.cpp
@@ -309,7 +309,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);
}
}
@@ -412,12 +417,13 @@ void CTabbedWindow::TabClicked()
g_clistApi.pfnRemoveEvent(s->hContact, GC_FAKE_EVENT);
}
- FixTabIcons(pDlg);
if (!s->pDlg) {
g_chatApi.ShowRoom(s);
SendMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
}
}
+
+ FixTabIcons(pDlg);
}
/////////////////////////////////////////////////////////////////////////////////////////