diff options
Diffstat (limited to 'plugins/TabSRMM/src/msgdlgutils.cpp')
-rw-r--r-- | plugins/TabSRMM/src/msgdlgutils.cpp | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 74a02425a0..2f16a2a7cc 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -438,6 +438,33 @@ void CTabBaseDlg::UpdateReadChars() const InvalidateRect(m_pContainer->hwndStatus, nullptr, FALSE);
}
+void CTabBaseDlg::UpdateSaveAndSendButton()
+{
+ GETTEXTLENGTHEX gtxl = { 0 };
+ gtxl.codepage = CP_UTF8;
+ gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMBYTES;
+
+ int len = SendDlgItemMessage(m_hwnd, IDC_SRMM_MESSAGE, EM_GETTEXTLENGTHEX, (WPARAM)>xl, 0);
+ if (len && GetSendButtonState(m_hwnd) == PBS_DISABLED)
+ EnableSendButton(true);
+ else if (len == 0 && GetSendButtonState(m_hwnd) != PBS_DISABLED)
+ EnableSendButton(false);
+
+ if (len) { // looks complex but avoids flickering on the button while typing.
+ if (!(m_dwFlags & MWF_SAVEBTN_SAV)) {
+ SendDlgItemMessage(m_hwnd, IDC_SAVE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)PluginConfig.g_buttonBarIcons[ICON_BUTTON_SAVE]);
+ SendDlgItemMessage(m_hwnd, IDC_SAVE, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Save and close session"), BATF_UNICODE);
+ m_dwFlags |= MWF_SAVEBTN_SAV;
+ }
+ }
+ else {
+ SendDlgItemMessage(m_hwnd, IDC_SAVE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)PluginConfig.g_buttonBarIcons[ICON_BUTTON_CANCEL]);
+ SendDlgItemMessage(m_hwnd, IDC_SAVE, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Close session"), BATF_UNICODE);
+ m_dwFlags &= ~MWF_SAVEBTN_SAV;
+ }
+ m_textLen = len;
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// update all status bar fields and force a redraw of the status bar.
@@ -1600,11 +1627,9 @@ HICON CTabBaseDlg::GetXStatusIcon() const LRESULT TSAPI GetSendButtonState(HWND hwnd)
{
HWND hwndIDok = GetDlgItem(hwnd, IDOK);
-
if (hwndIDok)
- return(SendMessage(hwndIDok, BUTTONGETSTATEID, TRUE, 0));
- else
- return 0;
+ return SendMessage(hwndIDok, BUTTONGETSTATEID, TRUE, 0);
+ return 0;
}
void CTabBaseDlg::EnableSendButton(bool bMode) const
@@ -1617,6 +1642,13 @@ void CTabBaseDlg::EnableSendButton(bool bMode) const SendMessage(hwndOK, BUTTONSETASNORMAL, bMode, 0);
}
+void CTabBaseDlg::EnableSending(bool bMode) const
+{
+ m_message.SendMsg(EM_SETREADONLY, !bMode, 0);
+ Utils::enableDlgControl(m_hwnd, IDC_CLIST, bMode);
+ EnableSendButton(bMode);
+}
+
void CTabBaseDlg::SendNudge() const
{
if (ProtoServiceExists(m_cache->getActiveProto(), PS_SEND_NUDGE) && ServiceExists(MS_NUDGE_SEND))
|