summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-10 22:17:04 +0200
committerGeorge Hazan <ghazan@miranda.im>2018-05-10 22:17:04 +0200
commit8f281c8de4a2b3c9cc000673cc63b015c6ce3d62 (patch)
tree885ee1759becc17c4dd6603a7f7cc05be62071ae /src/core
parent32e1155026a444bc9aa753257b717bf0c81bc0d7 (diff)
StdMsg:
- tab icon look standardized with all another SRMM plugins; - fixes #1343 (StdMsg: wrong status icon as the window icon)
Diffstat (limited to 'src/core')
-rw-r--r--src/core/stdmsg/res/resource.rc2
-rw-r--r--src/core/stdmsg/src/chat_manager.cpp28
-rw-r--r--src/core/stdmsg/src/chat_window.cpp2
-rw-r--r--src/core/stdmsg/src/globals.cpp2
-rw-r--r--src/core/stdmsg/src/globals.h1
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp47
-rw-r--r--src/core/stdmsg/src/msgoptions.cpp4
-rw-r--r--src/core/stdmsg/src/stdafx.h9
-rw-r--r--src/core/stdmsg/src/tabs.cpp15
9 files changed, 36 insertions, 74 deletions
diff --git a/src/core/stdmsg/res/resource.rc b/src/core/stdmsg/res/resource.rc
index bbe30e819d..9acdd24f88 100644
--- a/src/core/stdmsg/res/resource.rc
+++ b/src/core/stdmsg/res/resource.rc
@@ -41,8 +41,6 @@ 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,74,289,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
diff --git a/src/core/stdmsg/src/chat_manager.cpp b/src/core/stdmsg/src/chat_manager.cpp
index a4e4697f3e..d55671f558 100644
--- a/src/core/stdmsg/src/chat_manager.cpp
+++ b/src/core/stdmsg/src/chat_manager.cpp
@@ -60,33 +60,26 @@ CHAT_MANAGER *pci;
HMENU g_hMenu = nullptr;
BOOL SmileyAddInstalled = FALSE, PopupInstalled = FALSE;
-HIMAGELIST hIconsList;
GlobalLogSettings g_Settings;
static void OnDestroyModule(MODULEINFO *mi)
{
- if (mi->hOnlineIcon) DestroyIcon(mi->hOnlineIcon);
- if (mi->hOnlineTalkIcon) DestroyIcon(mi->hOnlineTalkIcon);
- if (mi->hOfflineIcon) DestroyIcon(mi->hOfflineIcon);
- if (mi->hOfflineTalkIcon) DestroyIcon(mi->hOfflineTalkIcon);
+ if (mi->hOnlineIcon)
+ DestroyIcon(mi->hOnlineIcon);
+ if (mi->hOfflineIcon)
+ DestroyIcon(mi->hOfflineIcon);
}
static void OnCreateModule(MODULEINFO *mi)
{
OnDestroyModule(mi);
- mi->OnlineIconIndex = ImageList_AddIcon(hIconsList, Skin_LoadProtoIcon(mi->pszModule, ID_STATUS_ONLINE));
- mi->hOnlineIcon = ImageList_GetIcon(hIconsList, mi->OnlineIconIndex, ILD_TRANSPARENT);
- mi->hOnlineTalkIcon = ImageList_GetIcon(hIconsList, mi->OnlineIconIndex, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
- ImageList_AddIcon(hIconsList, mi->hOnlineTalkIcon);
+ mi->OnlineIconIndex = pcli->pfnIconFromStatusMode(mi->pszModule, ID_STATUS_ONLINE, 0);
+ mi->hOnlineIcon = ImageList_GetIcon(Clist_GetImageList(), mi->OnlineIconIndex, ILD_TRANSPARENT);
- mi->OfflineIconIndex = ImageList_AddIcon(hIconsList, Skin_LoadProtoIcon(mi->pszModule, ID_STATUS_OFFLINE));
- mi->hOfflineIcon = ImageList_GetIcon(hIconsList, mi->OfflineIconIndex, ILD_TRANSPARENT);
- mi->hOfflineTalkIcon = ImageList_GetIcon(hIconsList, mi->OfflineIconIndex, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
- ImageList_AddIcon(hIconsList, mi->hOfflineTalkIcon);
-
- g_iMessageIconIndex = ImageList_AddIcon(hIconsList, Skin_LoadIcon(SKINICON_EVENT_MESSAGE));
+ mi->OfflineIconIndex = pcli->pfnIconFromStatusMode(mi->pszModule, ID_STATUS_OFFLINE, 0);
+ mi->hOfflineIcon = ImageList_GetIcon(Clist_GetImageList(), mi->OfflineIconIndex, ILD_TRANSPARENT);
}
static void OnReplaceSession(SESSION_INFO *si)
@@ -257,11 +250,6 @@ void Load_ChatModule()
g_hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU));
- hIconsList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 0, 100);
- ImageList_AddIcon(hIconsList, Skin_LoadIcon(SKINICON_EVENT_MESSAGE));
- ImageList_AddIcon(hIconsList, LoadIconEx("overlay", FALSE));
- ImageList_SetOverlayImage(hIconsList, 1, 1);
-
HookEvent(ME_SYSTEM_MODULELOAD, OnCheckPlugins);
}
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index 222792be60..d0104e61c9 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -288,8 +288,6 @@ 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 1516d7582d..353bd8bf17 100644
--- a/src/core/stdmsg/src/globals.cpp
+++ b/src/core/stdmsg/src/globals.cpp
@@ -47,7 +47,6 @@ static int OnShutdown(WPARAM, LPARAM)
si->pDlg->Close();
UninitTabs();
- ImageList_Destroy(hIconsList);
return 0;
}
@@ -129,7 +128,6 @@ GlobalMessageData::GlobalMessageData() :
bSendOnCtrlEnter(SRMMMOD, "SendOnCtrlEnter", false),
bDeleteTempCont(SRMMMOD, "DeleteTempCont", false),
bSavePerContact(SRMMMOD, "SavePerContact", false),
- bUseStatusWinIcon(SRMMMOD, "UseStatusWinIcon", false),
bDoNotStealFocus(SRMMMOD, "DoNotStealFocus", false),
bLimitAvatarHeight(SRMMMOD, "AvatarLimitHeight", true),
diff --git a/src/core/stdmsg/src/globals.h b/src/core/stdmsg/src/globals.h
index 34df8e639b..a0ad036b01 100644
--- a/src/core/stdmsg/src/globals.h
+++ b/src/core/stdmsg/src/globals.h
@@ -49,7 +49,6 @@ struct GlobalMessageData
CMOption<bool> bCtrlSupport;
CMOption<bool> bShowFormat;
CMOption<bool> bSavePerContact;
- CMOption<bool> bUseStatusWinIcon;
CMOption<bool> bDoNotStealFocus;
CMOption<bool> bCascade;
CMOption<bool> bDeleteTempCont;
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index edfd5d73c8..a29fd0e2a6 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -316,8 +316,7 @@ void CSrmmWindow::OnActivate()
UpdateLastMessage();
if (KillTimer(m_hwnd, TIMERID_FLASHWND))
FlashWindow(m_pOwner->GetHwnd(), FALSE);
- if (g_dat.bUseStatusWinIcon)
- SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0);
+ SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -597,19 +596,23 @@ void CSrmmWindow::UpdateIcon(WPARAM wParam)
if (!m_hContact || !m_szProto)
return;
+ bool bIsStatus = false;
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)wParam;
- if (!cws || (!mir_strcmp(cws->szModule, m_szProto) && !mir_strcmp(cws->szSetting, "Status"))) {
- if (m_szProto) {
- HICON hIcon = Skin_LoadProtoIcon(m_szProto, m_wStatus);
- if (hIcon) {
- if (m_hStatusIcon)
- IcoLib_ReleaseIcon(m_hStatusIcon);
- m_hStatusIcon = hIcon;
- SendDlgItemMessage(m_hwnd, IDC_USERMENU, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
- }
+ if (cws && !mir_strcmp(cws->szModule, m_szProto) && !mir_strcmp(cws->szSetting, "Status")) {
+ bIsStatus = true;
+ m_wStatus = cws->value.wVal;
+ }
+
+ if (!cws || bIsStatus) {
+ HICON hIcon = Skin_LoadProtoIcon(m_szProto, m_wStatus);
+ if (hIcon) {
+ if (m_hStatusIcon)
+ IcoLib_ReleaseIcon(m_hStatusIcon);
+ m_hStatusIcon = hIcon;
+ SendDlgItemMessage(m_hwnd, IDC_USERMENU, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
}
- if (g_dat.bUseStatusWinIcon)
- SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0);
+
+ SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0);
}
}
@@ -646,13 +649,7 @@ void CSrmmWindow::UpdateTitle()
m_wStatus = db_get_w(m_hContact, m_szProto, "Status", ID_STATUS_OFFLINE);
wchar_t *contactName = Clist_GetContactDisplayName(m_hContact);
- 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"));
- }
-
+ mir_snwprintf(newtitle, L"%s - %s", contactName, TranslateT("Message session"));
m_wOldStatus = m_wStatus;
}
else mir_wstrncpy(newtitle, TranslateT("Message session"), _countof(newtitle));
@@ -1046,15 +1043,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
break;
case DM_UPDATEWINICON:
- if (g_dat.bUseStatusWinIcon) {
- Window_FreeIcon_IcoLib(m_pOwner->GetHwnd());
-
- if (m_szProto) {
- Window_SetProtoIcon_IcoLib(m_pOwner->GetHwnd(), m_szProto, Contact_GetStatus(m_hContact));
- break;
- }
- }
- Window_SetSkinIcon_IcoLib(m_pOwner->GetHwnd(), SKINICON_EVENT_MESSAGE);
+ m_pOwner->FixTabIcons(this);
break;
case DM_USERNAMETOCLIP:
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp
index b5e3112a34..6c62b74d07 100644
--- a/src/core/stdmsg/src/msgoptions.cpp
+++ b/src/core/stdmsg/src/msgoptions.cpp
@@ -154,7 +154,7 @@ class COptionMainDlg : public CPluginDlgBase
{
CCtrlEdit edtNFlash, edtAvatarH, edtSecs;
CCtrlCheck chkAutoMin, chkAutoClose, chkSavePerContact, chkDoNotStealFocus;
- CCtrlCheck chkDelTemp, chkCascade, chkCharCount, chkStatusWin, chkCtrlSupport;
+ CCtrlCheck chkDelTemp, chkCascade, chkCharCount, chkCtrlSupport;
CCtrlCheck chkAvatar, chkLimitAvatar;
CCtrlCheck chkSendOnEnter, chkSendOnDblEnter, chkSendOnCtrlEnter, chkShowSend, chkShowButtons;
@@ -204,7 +204,6 @@ public:
chkCascade(this, IDC_CASCADE),
chkShowSend(this, IDC_SHOWSENDBTN),
chkAutoClose(this, IDC_AUTOCLOSE),
- chkStatusWin(this, IDC_STATUSWIN),
chkCharCount(this, IDC_CHARCOUNT),
chkLimitAvatar(this, IDC_LIMITAVATARH),
chkShowButtons(this, IDC_SHOWBUTTONLINE),
@@ -235,7 +234,6 @@ 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/stdafx.h b/src/core/stdmsg/src/stdafx.h
index 28f6e257fd..c9f458a840 100644
--- a/src/core/stdmsg/src/stdafx.h
+++ b/src/core/stdmsg/src/stdafx.h
@@ -88,11 +88,8 @@ extern HINSTANCE g_hInst;
struct MODULEINFO : public GCModuleInfoBase
{
- HICON hOnlineIcon, hOnlineTalkIcon;
- HICON hOfflineIcon, hOfflineTalkIcon;
-
- int OnlineIconIndex;
- int OfflineIconIndex;
+ HICON hOnlineIcon, hOfflineIcon;
+ int OnlineIconIndex, OfflineIconIndex;
};
struct SESSION_INFO : public GCSessionInfoBase {};
@@ -112,11 +109,9 @@ struct GlobalLogSettings : public GlobalLogSettingsBase
extern GlobalLogSettings g_Settings;
extern HMENU g_hMenu;
-extern HIMAGELIST hIconsList;
extern HINSTANCE g_hInst;
extern BOOL SmileyAddInstalled, PopupInstalled;
-extern int g_iMessageIconIndex;
// main.cpp
void LoadIcons(void);
diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp
index c6d0f21f14..ba2e2670c5 100644
--- a/src/core/stdmsg/src/tabs.cpp
+++ b/src/core/stdmsg/src/tabs.cpp
@@ -42,7 +42,6 @@ void TB_SaveSession(SESSION_INFO *si)
}
CTabbedWindow *g_pTabDialog = nullptr;
-int g_iMessageIconIndex;
/////////////////////////////////////////////////////////////////////////////////////////
@@ -85,7 +84,7 @@ static LRESULT CALLBACK TabSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
MODULEINFO *mi = pci->MM_FindModule(si->pszModule);
bDragging = true;
iBeginIndex = idx;
- ImageList_BeginDrag(hIconsList, bOnline ? mi->OnlineIconIndex : mi->OfflineIconIndex, 8, 8);
+ ImageList_BeginDrag(Clist_GetImageList(), bOnline ? mi->OnlineIconIndex : mi->OfflineIconIndex, 8, 8);
ImageList_DragEnter(hwnd, tci.pt.x, tci.pt.y);
SetCapture(hwnd);
}
@@ -192,7 +191,7 @@ void CTabbedWindow::OnInitDialog()
SetWindowLongPtr(m_tab.GetHwnd(), GWL_STYLE, mask);
TabCtrl_SetMinTabWidth(m_tab.GetHwnd(), 80);
- TabCtrl_SetImageList(m_tab.GetHwnd(), hIconsList);
+ TabCtrl_SetImageList(m_tab.GetHwnd(), Clist_GetImageList());
// restore previous tabs
if (g_Settings.bTabRestore) {
@@ -273,9 +272,8 @@ void CTabbedWindow::AddPage(SESSION_INFO *si, int insertAt)
CChatRoomDlg *pDlg = new CChatRoomDlg(this, si);
pDlg->SetParent(m_hwnd);
m_tab.AddPage(szTemp, nullptr, pDlg);
- FixTabIcons(pDlg);
-
m_tab.ActivatePage(m_tab.GetCount() - 1);
+ FixTabIcons(pDlg);
}
else if (insertAt == -1)
m_tab.ActivatePage(indexfound);
@@ -295,11 +293,9 @@ void CTabbedWindow::FixTabIcons(CSrmmBaseDialog *pDlg)
if (!(si->wState & GC_EVENT_HIGHLIGHT)) {
MODULEINFO *mi = pci->MM_FindModule(si->pszModule);
image = (si->wStatus == ID_STATUS_ONLINE) ? mi->OnlineIconIndex : mi->OfflineIconIndex;
- if (si->wState & STATE_TALK)
- image++;
}
}
- else image = g_iMessageIconIndex;
+ else image = pcli->pfnIconFromStatusMode(GetContactProto(pDlg->m_hContact), Contact_GetStatus(pDlg->m_hContact), pDlg->m_hContact);
TCITEM tci = {};
tci.mask = TCIF_IMAGE;
@@ -308,6 +304,9 @@ void CTabbedWindow::FixTabIcons(CSrmmBaseDialog *pDlg)
tci.iImage = image;
TabCtrl_SetItem(m_tab.GetHwnd(), idx, &tci);
}
+
+ if (pDlg == m_tab.GetActivePage())
+ SendMessage(m_hwnd, WM_SETICON, 0, (LPARAM)ImageList_GetIcon(Clist_GetImageList(), image, 0));
}
void CTabbedWindow::SaveWindowPosition(bool bUpdateSession)