diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/stdmsg/res/resource.rc | 35 | ||||
-rw-r--r-- | src/core/stdmsg/src/chat_manager.cpp | 28 | ||||
-rw-r--r-- | src/core/stdmsg/src/chat_options.cpp | 2 | ||||
-rw-r--r-- | src/core/stdmsg/src/chat_window.cpp | 30 | ||||
-rw-r--r-- | src/core/stdmsg/src/globals.cpp | 3 | ||||
-rw-r--r-- | src/core/stdmsg/src/globals.h | 2 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 84 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgoptions.cpp | 8 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.cpp | 38 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.h | 66 | ||||
-rw-r--r-- | src/core/stdmsg/src/resource.h | 14 | ||||
-rw-r--r-- | src/core/stdmsg/src/stdafx.h | 9 | ||||
-rw-r--r-- | src/core/stdmsg/src/tabs.cpp | 51 |
13 files changed, 165 insertions, 205 deletions
diff --git a/src/core/stdmsg/res/resource.rc b/src/core/stdmsg/res/resource.rc index dbdc5bcf2b..9acdd24f88 100644 --- a/src/core/stdmsg/res/resource.rc +++ b/src/core/stdmsg/res/resource.rc @@ -33,36 +33,39 @@ EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
LTEXT "Automatically popup window when:",IDC_STATIC,7,7,141,13
- CONTROL "Tree1",IDC_POPLIST,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | TVS_NOHSCROLL | TVS_NONEVENHEIGHT | WS_BORDER | WS_HSCROLL | WS_TABSTOP,199,6,98,42
+ CONTROL "Tree1",IDC_POPLIST,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | TVS_NOHSCROLL | TVS_NONEVENHEIGHT | WS_BORDER | WS_TABSTOP,199,6,98,42
CONTROL "In background",IDC_DONOTSTEALFOCUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,21,130,10
+
+ LTEXT "Maximum number of flashes",IDC_STATIC,7,35,141,8
+ EDITTEXT IDC_NFLASHES,148,33,25,12,ES_AUTOHSCROLL | ES_NUMBER
+
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
- CONTROL "Show 'Send' button",IDC_SHOWSENDBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,166,135,10
- CONTROL "Show toolbar buttons on top row",IDC_SHOWBUTTONLINE,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,192,137,10
- CONTROL "Send message on double 'Enter'",IDC_SENDONDBLENTER,
- "Button", BS_AUTORADIOBUTTON | WS_TABSTOP,148,166,149,10
- CONTROL "Send message on 'Enter'",IDC_SENDONENTER,"Button", BS_AUTORADIOBUTTON | WS_TABSTOP,148,179,152,10
- CONTROL "Show character count",IDC_CHARCOUNT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,148,192,149,10
- LTEXT "Show warning when message has not been received after",IDC_STATIC,8,208,211,8
- EDITTEXT IDC_SECONDS,223,206,25,12,ES_AUTOHSCROLL
- LTEXT "seconds",IDC_STATIC,253,208,44,8
CONTROL "Support CTRL+Up/Down in message area to show previously sent messages",IDC_CTRLSUPPORT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,110,289,10
CONTROL "Delete temporary contacts when closing message window",IDC_DELTEMP,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,122,287,10
CONTROL "Enable avatar support in the message window",IDC_AVATARSUPPORT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,135,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
- LTEXT "Maximum number of flashes",IDC_STATIC,7,35,141,8
- EDITTEXT IDC_NFLASHES,148,33,25,12,ES_AUTOHSCROLL | ES_NUMBER
+
+ 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
+ CONTROL "Show toolbar buttons on top row",IDC_SHOWBUTTONLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,192,137,10
+
+ CONTROL "Send message on double 'Enter'",IDC_SENDONDBLENTER,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,148,166,149,10
+ CONTROL "Send message on 'Enter'",IDC_SENDONENTER,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,148,179,152,10
+ CONTROL "Send message on 'Ctrl-Enter'",IDC_SENDONCTRLENTER, "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,148,192,152,10
+
+ LTEXT "Show warning when message has not been received after",IDC_STATIC,8,208,211,8
+ EDITTEXT IDC_SECONDS,223,206,25,12,ES_AUTOHSCROLL
+ LTEXT "seconds",IDC_STATIC,253,208,44,8
END
IDD_MSGSENDERROR DIALOGEX 0, 0, 187, 110
@@ -242,7 +245,7 @@ BEGIN CONTROL "Custom2",IDC_BKG,"ColourPicker",WS_TABSTOP,201,93,50,14,WS_EX_NOACTIVATE | 0x10000000L
EDITTEXT IDC_TIMEOUT,132,134,38,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
CONTROL "Spin1",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,169,135,11,14
- GROUPBOX "Popups for the Chat plugin",IDC_STATIC,0,0,277,174
+ GROUPBOX "Popups for the StdMsg plugin",IDC_STATIC,0,0,277,174
LTEXT "Timeout (s)",IDC_STATIC,33,138,92,8
LTEXT "Text",IDC_STATIC,141,83,49,8
LTEXT "Background",IDC_STATIC,201,83,67,8
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_options.cpp b/src/core/stdmsg/src/chat_options.cpp index 96bdb59659..2764e3c528 100644 --- a/src/core/stdmsg/src/chat_options.cpp +++ b/src/core/stdmsg/src/chat_options.cpp @@ -31,8 +31,6 @@ struct branch_t }; static branch_t branch1[] = { - { LPGENW("Send message by pressing the 'Enter' key"), "SendOnEnter", 0, true }, - { LPGENW("Send message by pressing the 'Enter' key twice"), "SendOnDblEnter", 0, false }, { LPGENW("Flash window when someone speaks"), "FlashWindow", 0, false }, { LPGENW("Flash window when a word is highlighted"), "FlashWindowHighlight", 0, true }, { LPGENW("Show list of users in the chat room"), "ShowNicklist", 0, true }, diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index 4767d84312..a015311e85 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -58,7 +58,7 @@ void CChatRoomDlg::OnInitDialog() if (g_Settings.bTabsEnable) SetWindowLongPtr(m_hwnd, GWL_EXSTYLE, GetWindowLongPtr(m_hwnd, GWL_EXSTYLE) | WS_EX_APPWINDOW); else - onActivate(); + OnActivate(); m_log.SendMsg(EM_AUTOURLDETECT, 1, 0); @@ -86,7 +86,7 @@ void CChatRoomDlg::OnDestroy() CSuper::OnDestroy(); } -void CChatRoomDlg::onActivate() +void CChatRoomDlg::OnActivate() { WINDOWPLACEMENT wp = {}; wp.length = sizeof(wp); @@ -286,13 +286,8 @@ void CChatRoomDlg::UpdateOptions() hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIcon : mi->hOfflineIcon; } - if (g_Settings.bTabsEnable) - g_pTabDialog->FixTabIcons(nullptr); - 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; @@ -341,10 +336,6 @@ void CChatRoomDlg::UpdateStatusBar() } SendMessage(m_pOwner->m_hwndStatus, SB_SETICON, 0, (LPARAM)hIcon); - - if (g_Settings.bTabsEnable) - g_pTabDialog->FixTabIcons(nullptr); - SendMessage(m_pOwner->m_hwndStatus, SB_SETTEXT, 0, (LPARAM)ptszDispName); SendMessage(m_pOwner->m_hwndStatus, SB_SETTEXT, 1, (LPARAM)(m_si->ptszStatusbarText ? m_si->ptszStatusbarText : L"")); SendMessage(m_pOwner->m_hwndStatus, SB_SETTIPTEXT, 1, (LPARAM)(m_si->ptszStatusbarText ? m_si->ptszStatusbarText : L"")); @@ -635,11 +626,11 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) return TRUE; if (wParam == '\n' || wParam == '\r') { - if ((isCtrl != 0) ^ (0 != db_get_b(0, CHAT_MODULE, "SendOnEnter", 1))) { + if ((isCtrl && g_dat.bSendOnCtrlEnter) || (!isCtrl && g_dat.bSendOnEnter)) { m_btnOk.OnClick(&m_btnOk); return 0; } - if (db_get_b(0, CHAT_MODULE, "SendOnDblEnter", 0)) { + if (g_dat.bSendOnDblEnter) { if (m_iLastEnterTime + 2 < time(0)) m_iLastEnterTime = time(0); else { @@ -667,10 +658,10 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) bool isAlt = (GetKeyState(VK_MENU) & 0x8000) != 0; if (wParam == VK_RETURN) { szTabSave[0] = '\0'; - if ((isCtrl != 0) ^ (0 != db_get_b(0, CHAT_MODULE, "SendOnEnter", 1))) + if ((isCtrl && g_dat.bSendOnCtrlEnter) || (!isCtrl && g_dat.bSendOnEnter)) return 0; - if (db_get_b(0, CHAT_MODULE, "SendOnDblEnter", 0)) + if (g_dat.bSendOnDblEnter) if (m_iLastEnterTime + 2 >= time(0)) return 0; @@ -1110,17 +1101,8 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (g_Settings.bTabsEnable) { m_si->wState &= ~GC_EVENT_HIGHLIGHT; m_si->wState &= ~STATE_TALK; - g_pTabDialog->FixTabIcons(nullptr); } - break; } - if (LOWORD(wParam) == WA_ACTIVE) - onActivate(); - break; - - case WM_MOUSEACTIVATE: - onActivate(); - SetFocus(m_message.GetHwnd()); break; case WM_NOTIFY: diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp index 01aa85af7b..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;
}
@@ -126,9 +125,9 @@ GlobalMessageData::GlobalMessageData() : bCtrlSupport(SRMMMOD, "SupportCtrlUpDn", true),
bShowReadChar(SRMMMOD, "ShowCharCount", false),
bSendOnDblEnter(SRMMMOD, "SendOnDblEnter", false),
+ 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 fef2a2a44f..a0ad036b01 100644 --- a/src/core/stdmsg/src/globals.h +++ b/src/core/stdmsg/src/globals.h @@ -41,6 +41,7 @@ struct GlobalMessageData CMOption<bool> bShowReadChar;
CMOption<bool> bSendOnEnter;
CMOption<bool> bSendOnDblEnter;
+ CMOption<bool> bSendOnCtrlEnter;
CMOption<bool> bAutoClose;
CMOption<bool> bAutoMin;
CMOption<bool> bTypingNew;
@@ -48,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 0a5ef46008..a65857539a 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -308,6 +308,17 @@ void CSrmmWindow::OnDestroy() db_delete_contact(m_hContact);
}
+void CSrmmWindow::OnActivate()
+{
+ SetupStatusBar();
+ SetFocus(m_message.GetHwnd());
+ UpdateTitle();
+ UpdateLastMessage();
+ if (KillTimer(m_hwnd, TIMERID_FLASHWND))
+ FlashWindow(m_pOwner->GetHwnd(), FALSE);
+ SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
void CSrmmWindow::onClick_Ok(CCtrlButton *pButton)
@@ -353,12 +364,12 @@ void CSrmmWindow::OnOptionsApplied(bool bUpdateAvatar) continue;
bool bShow = false;
- if (m_hContact) {
+ if (m_hContact && g_dat.bShowButtons) {
if (cbd->m_dwButtonCID == IDC_ADD) {
bShow = 0 != db_get_b(m_hContact, "CList", "NotOnList", 0);
cbd->m_bHidden = !bShow;
}
- else bShow = g_dat.bShowButtons;
+ else bShow = true;
}
ShowWindow(hwndButton, (bShow) ? SW_SHOW : SW_HIDE);
}
@@ -585,19 +596,22 @@ 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;
}
- if (g_dat.bUseStatusWinIcon)
- SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0);
+
+ SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0);
}
}
@@ -634,23 +648,15 @@ 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));
wchar_t oldtitle[256];
GetWindowText(m_pOwner->GetHwnd(), oldtitle, _countof(oldtitle));
- if (mir_wstrcmp(newtitle, oldtitle)) { //swt() flickers even if the title hasn't actually changed
+ if (mir_wstrcmp(newtitle, oldtitle)) //swt() flickers even if the title hasn't actually changed
SetWindowText(m_pOwner->GetHwnd(), newtitle);
- Resize();
- }
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -737,7 +743,11 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) isAlt = (GetKeyState(VK_MENU) & 0x8000) != 0;
if (wParam == VK_RETURN) {
- if (!isShift && isCtrl != g_dat.bSendOnEnter) {
+ if (!isShift && !isCtrl && g_dat.bSendOnEnter) {
+ onClick_Ok(&m_btnOk);
+ return 0;
+ }
+ if (!isShift && isCtrl && g_dat.bSendOnCtrlEnter) {
onClick_Ok(&m_btnOk);
return 0;
}
@@ -1032,15 +1042,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:
@@ -1080,22 +1082,6 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) }
break;
- case WM_ACTIVATE:
- if (LOWORD(wParam) != WA_ACTIVE)
- break;
-
- __fallthrough;
-
- case WM_MOUSEACTIVATE:
- SetFocus(m_message.GetHwnd());
- UpdateTitle();
- UpdateLastMessage();
- if (KillTimer(m_hwnd, TIMERID_FLASHWND))
- FlashWindow(m_pOwner->GetHwnd(), FALSE);
- if (g_dat.bUseStatusWinIcon)
- SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0);
- break;
-
case WM_CBD_LOADICONS:
Srmm_UpdateToolbarIcons(m_hwnd);
break;
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index 5168b2933c..6c62b74d07 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -154,9 +154,9 @@ 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, chkShowSend, chkShowButtons;
+ CCtrlCheck chkSendOnEnter, chkSendOnDblEnter, chkSendOnCtrlEnter, chkShowSend, chkShowButtons;
CCtrlTreeView tree;
@@ -204,13 +204,13 @@ 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),
chkCtrlSupport(this, IDC_CTRLSUPPORT),
chkSendOnEnter(this, IDC_SENDONENTER),
chkSendOnDblEnter(this, IDC_SENDONDBLENTER),
+ chkSendOnCtrlEnter(this, IDC_SENDONCTRLENTER),
chkSavePerContact(this, IDC_SAVEPERCONTACT),
chkDoNotStealFocus(this, IDC_DONOTSTEALFOCUS)
{
@@ -234,11 +234,11 @@ 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);
CreateLink(chkSendOnDblEnter, g_dat.bSendOnDblEnter);
+ CreateLink(chkSendOnCtrlEnter, g_dat.bSendOnCtrlEnter);
CreateLink(chkSavePerContact, g_dat.bSavePerContact);
CreateLink(chkDoNotStealFocus, g_dat.bDoNotStealFocus);
}
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 1b8a5f9727..a95501bf69 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -41,6 +41,23 @@ void CMsgDialog::CloseTab() else SendMessage(m_hwndParent, WM_CLOSE, 0, 0);
}
+INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch (uMsg) {
+ case WM_ACTIVATE:
+ if (LOWORD(wParam) == WA_ACTIVE)
+ OnActivate();
+ break;
+
+ case WM_MOUSEACTIVATE:
+ OnActivate();
+ SetFocus(m_message.GetHwnd());
+ break;
+ }
+
+ return CSuper::DlgProc(uMsg, wParam, lParam);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
int OnCheckPlugins(WPARAM, LPARAM);
@@ -409,27 +426,20 @@ void SetButtonsPos(HWND hwndDlg, bool bIsChat) GetClientRect(hwndDlg, &rc);
int iLeftX = 2, iRightX = rc.right - 2;
- bool bShow = (bIsChat) ? true : g_dat.bShowButtons;
-
CustomButtonData *cbd;
for (int i = 0; cbd = Srmm_GetNthButton(i); i++) {
HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID);
if (hwndButton == nullptr || cbd->m_bHidden)
continue;
- if (bShow) {
- ShowWindow(hwndButton, SW_SHOW);
-
- if (cbd->m_bRSided) {
- iRightX -= g_dat.iGap + cbd->m_iButtonWidth;
- hdwp = DeferWindowPos(hdwp, hwndButton, nullptr, iRightX, yPos, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
- }
- else {
- hdwp = DeferWindowPos(hdwp, hwndButton, nullptr, iLeftX, yPos, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
- iLeftX += g_dat.iGap + cbd->m_iButtonWidth;
- }
+ if (cbd->m_bRSided) {
+ iRightX -= g_dat.iGap + cbd->m_iButtonWidth;
+ hdwp = DeferWindowPos(hdwp, hwndButton, nullptr, iRightX, yPos, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ }
+ else {
+ hdwp = DeferWindowPos(hdwp, hwndButton, nullptr, iLeftX, yPos, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ iLeftX += g_dat.iGap + cbd->m_iButtonWidth;
}
- else ShowWindow(hwndButton, SW_HIDE);
}
EndDeferWindowPos(hdwp);
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 75c64c69cb..3d5e443517 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -53,8 +53,12 @@ protected: CMsgDialog(int idDialog, SESSION_INFO *si = nullptr);
+ virtual void OnActivate() PURE;
+
+ INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
+
public:
- virtual void CloseTab() override;
+ void CloseTab() override;
__forceinline SESSION_INFO* getChat() const { return m_si; }
};
@@ -63,8 +67,8 @@ class CSrmmWindow : public CMsgDialog {
typedef CMsgDialog CSuper;
- virtual LRESULT WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam) override;
- virtual LRESULT WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) override;
+ LRESULT WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam) override;
+ LRESULT WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) override;
CCtrlBase m_avatar;
CSplitter m_splitter;
@@ -114,16 +118,17 @@ public: public:
CSrmmWindow(CTabbedWindow*, MCONTACT hContact);
- virtual void OnInitDialog() override;
- virtual void OnDestroy() override;
+ void OnInitDialog() override;
+ void OnDestroy() override;
+ void OnActivate() override;
- virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
- virtual int Resizer(UTILRESIZECONTROL *urc) override;
+ INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
+ int Resizer(UTILRESIZECONTROL *urc) override;
- virtual void LoadSettings() override {}
- virtual void ScrollToBottom() override;
- virtual void SetStatusText(const wchar_t*, HICON) override;
- virtual void UpdateTitle() override;
+ void LoadSettings() override {}
+ void ScrollToBottom() override;
+ void SetStatusText(const wchar_t*, HICON) override;
+ void UpdateTitle() override;
void OnSplitterMoved(CSplitter*);
@@ -152,9 +157,9 @@ class CChatRoomDlg : public CMsgDialog static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
- virtual LRESULT WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam) override;
- virtual LRESULT WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) override;
- virtual LRESULT WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam) override;
+ LRESULT WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam) override;
+ LRESULT WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) override;
+ LRESULT WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam) override;
wchar_t szTabSave[20];
@@ -164,26 +169,25 @@ class CChatRoomDlg : public CMsgDialog int m_iSplitterX, m_iSplitterY;
- void onActivate(void);
-
public:
CChatRoomDlg(CTabbedWindow*, SESSION_INFO*);
- virtual void OnInitDialog() override;
- virtual void OnDestroy() override;
-
- virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
- virtual int Resizer(UTILRESIZECONTROL *urc) override;
-
- virtual void LoadSettings() override;
- virtual void RedrawLog() override;
- virtual void StreamInEvents(LOGINFO *lin, bool bRedraw) override;
- virtual void ScrollToBottom() override;
- virtual void ShowFilterMenu() override;
- virtual void UpdateNickList() override;
- virtual void UpdateOptions() override;
- virtual void UpdateStatusBar() override;
- virtual void UpdateTitle() override;
+ void OnInitDialog() override;
+ void OnDestroy() override;
+ void OnActivate() override;
+
+ INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
+ int Resizer(UTILRESIZECONTROL *urc) override;
+
+ void LoadSettings() override;
+ void RedrawLog() override;
+ void StreamInEvents(LOGINFO *lin, bool bRedraw) override;
+ void ScrollToBottom() override;
+ void ShowFilterMenu() override;
+ void UpdateNickList() override;
+ void UpdateOptions() override;
+ void UpdateStatusBar() override;
+ void UpdateTitle() override;
void onClick_Ok(CCtrlButton*);
diff --git a/src/core/stdmsg/src/resource.h b/src/core/stdmsg/src/resource.h index fda43c6d1e..92b72236fb 100644 --- a/src/core/stdmsg/src/resource.h +++ b/src/core/stdmsg/src/resource.h @@ -1,4 +1,4 @@ -//{{NO_DEPENDENCIES}}
+//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by resource.rc
//
@@ -60,7 +60,6 @@ #define IDI_INCOMING 276
#define IDI_OUTGOING 277
#define IDI_EXCL 282
-
#define IDC_SPLITTERX 1003
#define IDC_AUTOCLOSE 1004
#define IDC_AUTOMIN 1005
@@ -88,6 +87,7 @@ #define IDC_SENDONDBLENTER 1044
#define IDC_LOADTIMEN 1045
#define IDC_LOADTIMESPIN 1046
+#define IDC_SENDONCTRLENTER 1046
#define IDC_LOADTIME 1047
#define IDC_STMINSOLD 1048
#define IDC_SPIN1 1049
@@ -130,14 +130,12 @@ #define IDC_HIGHLIGHT 1089
#define IDC_TEXTO 1090
#define IDC_LOGGING 1091
-
+#define IDC_STMSGLOGGROUP 1442
#define IDC_DETAILS 1469
#define IDC_USERMENU 1471
-#define IDC_STMSGLOGGROUP 1442
#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
@@ -158,7 +156,6 @@ #define IDC_CLOSETABS 1621
#define IDC_RESTORETABS 1622
#define IDC_TABSBOTTOM 1623
-
#define IDM_CUT 40000
#define IDM_COPY 40001
#define IDM_PASTE 40002
@@ -169,17 +166,16 @@ #define IDM_COPYALL 40011
#define IDM_SELECTALL 40012
#define IDM_CLEAR 40013
-
#define ID_MESS 40021
#define ID_COPYALL 40026
#define ID_CLEARLOG 40029
+#define ID_MESSAGE_PASTE 40030
#define ID_MESSAGE_UNDO 40033
#define ID_MESSAGE_COPY 40034
#define ID_MESSAGE_CUT 40035
#define ID_MESSAGE_CLEAR 40037
#define ID_MESSAGE_SELECTALL 40038
#define ID_MESSAGE_REDO 40039
-#define ID_MESSAGE_PASTE 40030
#define ID_CLOSE 40042
#define ID_CLOSEOTHER 40043
#define ID_LOCKPOSITION 40044
@@ -190,7 +186,7 @@ //
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 290
+#define _APS_NEXT_RESOURCE_VALUE 291
#define _APS_NEXT_COMMAND_VALUE 40019
#define _APS_NEXT_CONTROL_VALUE 1620
#define _APS_NEXT_SYMED_VALUE 101
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 c244f0dd24..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); @@ -283,31 +281,32 @@ void CTabbedWindow::AddPage(SESSION_INFO *si, int insertAt) void CTabbedWindow::FixTabIcons(CSrmmBaseDialog *pDlg) { - if (pDlg != nullptr) { - int idx = m_tab.GetDlgIndex(pDlg); - if (idx == -1) - return; + if (pDlg == nullptr) + return; - int image = 0; - if (SESSION_INFO *si = ((CChatRoomDlg*)pDlg)->m_si) { - 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; + int idx = m_tab.GetDlgIndex(pDlg); + if (idx == -1) + return; - TCITEM tci = {}; - tci.mask = TCIF_IMAGE; - TabCtrl_GetItem(m_tab.GetHwnd(), idx, &tci); - if (tci.iImage != image) { - tci.iImage = image; - TabCtrl_SetItem(m_tab.GetHwnd(), idx, &tci); + int image = 0; + if (SESSION_INFO *si = ((CChatRoomDlg*)pDlg)->m_si) { + if (!(si->wState & GC_EVENT_HIGHLIGHT)) { + MODULEINFO *mi = pci->MM_FindModule(si->pszModule); + image = (si->wStatus == ID_STATUS_ONLINE) ? mi->OnlineIconIndex : mi->OfflineIconIndex; } } - else RedrawWindow(m_tab.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE); + else image = pcli->pfnIconFromStatusMode(GetContactProto(pDlg->m_hContact), Contact_GetStatus(pDlg->m_hContact), pDlg->m_hContact); + + TCITEM tci = {}; + tci.mask = TCIF_IMAGE; + TabCtrl_GetItem(m_tab.GetHwnd(), idx, &tci); + if (tci.iImage != image) { + 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) |