summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-09-04 15:01:54 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-09-04 15:01:54 +0300
commitd2b4dacd31b51c7319d8d96460a6c4fad8cd0274 (patch)
tree125f005d8a369bd8bd379d98074b244a7f41d1db /plugins/TabSRMM/src
parent753974985ea1e5f468bbb084afa507352e87b46f (diff)
history manager built into CHAT_MANAGER isn't needed anymore
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r--plugins/TabSRMM/src/chat_window.cpp78
-rw-r--r--plugins/TabSRMM/src/contactcache.cpp135
-rw-r--r--plugins/TabSRMM/src/contactcache.h20
-rw-r--r--plugins/TabSRMM/src/globals.cpp2
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp14
-rw-r--r--plugins/TabSRMM/src/msgs.cpp8
-rw-r--r--plugins/TabSRMM/src/msgs.h221
7 files changed, 175 insertions, 303 deletions
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp
index 1eac103c3e..a447a4db17 100644
--- a/plugins/TabSRMM/src/chat_window.cpp
+++ b/plugins/TabSRMM/src/chat_window.cpp
@@ -460,7 +460,7 @@ static void __cdecl phase2(SESSION_INFO *si)
// which is usually a (tabbed) child of a container class window.
CMsgDialog::CMsgDialog(SESSION_INFO *si)
- : CTabBaseDlg(IDD_CHANNEL, si),
+ : CSuper(IDD_CHANNEL, si),
m_btnOk(this, IDOK)
{
m_szProto = GetContactProto(m_hContact);
@@ -498,7 +498,7 @@ void CMsgDialog::tabClearLog()
bool CMsgDialog::OnInitDialog()
{
- CTabBaseDlg::OnInitDialog();
+ CSuper::OnInitDialog();
m_si->pDlg = this;
@@ -612,7 +612,6 @@ void CMsgDialog::OnDestroy()
if (m_pContainer->m_dwFlags & CNT_SIDEBAR)
m_pContainer->m_pSideBar->removeSession(this);
- mir_free(m_enteredText);
CSuper::OnDestroy();
}
@@ -623,12 +622,14 @@ void CMsgDialog::onClick_OK(CCtrlButton*)
return;
ptrA pszRtf(m_message.GetRichTextRtf());
- g_chatApi.SM_AddCommand(m_si->ptszID, m_si->pszModule, pszRtf);
+ if (pszRtf == nullptr)
+ return;
CMStringW ptszText(ptrW(mir_utf8decodeW(pszRtf)));
if (ptszText.IsEmpty())
return;
+ m_cache->saveHistory();
DoRtfToTags(ptszText);
ptszText.Trim();
@@ -1296,72 +1297,13 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
return 0;
}
- if (wParam == VK_UP && isCtrl && !isAlt) {
- char *lpPrevCmd = g_chatApi.SM_GetPrevCommand(m_si->ptszID, m_si->pszModule);
-
- if (!m_si->lpCurrentCommand || !m_si->lpCurrentCommand->last) {
- // Next command is not defined. It means currently entered text is not saved in the history and it
- // need to be saved in the window context.
- char *enteredText = m_message.GetRichTextRtf();
- if (m_enteredText)
- mir_free(m_enteredText);
-
- m_enteredText = enteredText;
- }
-
- m_message.SendMsg(WM_SETREDRAW, FALSE, 0);
-
- LOGFONTA lf;
- LoadLogfont(FONTSECTION_IM, MSGFONTID_MESSAGEAREA, &lf, nullptr, FONTMODULE);
-
- SETTEXTEX ste;
- ste.flags = ST_DEFAULT;
- ste.codepage = CP_ACP;
- if (lpPrevCmd)
- m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)lpPrevCmd);
- else
- m_message.SetText(L"");
-
- GETTEXTLENGTHEX gtl = { 0 };
- gtl.flags = GTL_PRECISE;
- gtl.codepage = CP_ACP;
- int iLen = m_message.SendMsg(EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
- m_message.SendMsg(EM_SCROLLCARET, 0, 0);
- m_message.SendMsg(WM_SETREDRAW, TRUE, 0);
- RedrawWindow(m_message.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE);
- m_message.SendMsg(EM_SETSEL, iLen, iLen);
+ // input history scrolling (ctrl-up / down)
+ if (isCtrl && !isAlt && !isShift && (wParam == VK_UP || wParam == VK_DOWN)) {
m_iLastEnterTime = 0;
+ m_cache->inputHistoryEvent(wParam);
return 0;
}
- if (wParam == VK_DOWN && isCtrl && !isAlt) {
- m_message.SendMsg(WM_SETREDRAW, FALSE, 0);
-
- SETTEXTEX ste;
- ste.flags = ST_DEFAULT;
- ste.codepage = CP_ACP;
-
- char *lpPrevCmd = g_chatApi.SM_GetNextCommand(m_si->ptszID, m_si->pszModule);
- if (lpPrevCmd)
- m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)lpPrevCmd);
- else if (m_enteredText) {
- // If we cannot load the message from history, load the last edited text.
- m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)m_enteredText);
- mir_free(m_enteredText);
- m_enteredText = nullptr;
- }
-
- GETTEXTLENGTHEX gtl = { 0 };
- gtl.flags = GTL_PRECISE;
- gtl.codepage = CP_ACP;
- int iLen = m_message.SendMsg(EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
- m_message.SendMsg(EM_SCROLLCARET, 0, 0);
- m_message.SendMsg(WM_SETREDRAW, TRUE, 0);
- RedrawWindow(m_message.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE);
- m_message.SendMsg(EM_SETSEL, iLen, iLen);
- m_iLastEnterTime = 0;
- return 0;
- }
__fallthrough;
case WM_LBUTTONDOWN:
@@ -1678,7 +1620,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
GetClientRect(m_hwnd, &rc);
int cx = rc.right;
- CTabBaseDlg::DlgProc(uMsg, 0, 0); // call basic window resizer
+ CSuper::DlgProc(uMsg, 0, 0); // call basic window resizer
BB_SetButtonsPos();
@@ -2357,7 +2299,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
VerifyProxy();
break;
}
- return CTabBaseDlg::DlgProc(uMsg, wParam, lParam);
+ return CSuper::DlgProc(uMsg, wParam, lParam);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp
index 25206acf8d..790f7c197b 100644
--- a/plugins/TabSRMM/src/contactcache.cpp
+++ b/plugins/TabSRMM/src/contactcache.cpp
@@ -35,7 +35,8 @@ static OBJLIST<CContactCache> arContacts(50, NumericKeySortT);
static DBCachedContact ccInvalid;
-CContactCache::CContactCache(MCONTACT hContact)
+CContactCache::CContactCache(MCONTACT hContact) :
+ m_history(10)
{
m_hContact = hContact;
@@ -199,13 +200,11 @@ void CContactCache::updateStats(int iType, size_t value)
//
// @param dat: CSrmmWindow* - window data structure
-void CContactCache::setWindowData(CSrmmWindow *dat)
+void CContactCache::setWindowData(CTabBaseDlg *dat)
{
m_dat = dat;
if (dat) {
- if (m_history == nullptr)
- allocHistory();
updateStatusMsg();
}
else {
@@ -220,55 +219,17 @@ void CContactCache::setWindowData(CSrmmWindow *dat)
// saves message to the input history.
// it's using streamout in UTF8 format - no unicode "issues" and all RTF formatting is saved to the history.
-void CContactCache::saveHistory(int iHistorySize)
+void CContactCache::saveHistory()
{
if (m_dat == nullptr)
return;
- int oldTop = 0;
- if (iHistorySize) {
- oldTop = m_iHistoryTop;
- m_iHistoryTop = iHistorySize;
- }
-
CCtrlRichEdit &pEntry = m_dat->GetEntry();
ptrA szFromStream(pEntry.GetRichTextRtf());
if (szFromStream != nullptr) {
- size_t iLength, iStreamLength;
- iLength = iStreamLength = mir_strlen(szFromStream) + 1;
-
- if (iLength > 0 && m_history != nullptr) { // XXX: iLength > 1 ?
- if (m_iHistoryTop == m_iHistorySize && oldTop == 0) { // shift the stack down...
- TInputHistory ihTemp = m_history[0];
- m_iHistoryTop--;
- ::memmove((void*)&m_history[0], (void*)&m_history[1], (m_iHistorySize - 1) * sizeof(TInputHistory));
- m_history[m_iHistoryTop] = ihTemp;
- }
- if (iLength > m_history[m_iHistoryTop].lLen) {
- if (m_history[m_iHistoryTop].szText == nullptr) {
- if (iLength < HISTORY_INITIAL_ALLOCSIZE)
- iLength = HISTORY_INITIAL_ALLOCSIZE;
- m_history[m_iHistoryTop].szText = (wchar_t*)mir_alloc(iLength);
- m_history[m_iHistoryTop].lLen = iLength;
- }
- else {
- if (iLength > m_history[m_iHistoryTop].lLen) {
- m_history[m_iHistoryTop].szText = (wchar_t*)mir_realloc(m_history[m_iHistoryTop].szText, iLength);
- m_history[m_iHistoryTop].lLen = iLength;
- }
- }
- }
- ::memcpy(m_history[m_iHistoryTop].szText, szFromStream, iStreamLength);
- if (!oldTop) {
- if (m_iHistoryTop < m_iHistorySize) {
- m_iHistoryTop++;
- m_iHistoryCurrent = m_iHistoryTop;
- }
- }
- }
+ m_iHistoryCurrent = -1;
+ m_history.insert(szFromStream.detach());
}
- if (oldTop)
- m_iHistoryTop = oldTop;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -280,67 +241,39 @@ void CContactCache::inputHistoryEvent(WPARAM wParam)
if (m_dat == nullptr)
return;
- if (m_history != nullptr && m_history[0].szText != nullptr) { // at least one entry needs to be alloced, otherwise we get a nice infinite loop ;)
- CCtrlRichEdit &pEntry = m_dat->GetEntry();
-
- SETTEXTEX stx = { ST_DEFAULT, CP_UTF8 };
-
- if (m_dat->m_dwFlags & MWF_NEEDHISTORYSAVE) {
- m_iHistoryCurrent = m_iHistoryTop;
- if (::GetWindowTextLength(pEntry.GetHwnd()) > 0)
- saveHistory(m_iHistorySize);
- else
- m_history[m_iHistorySize].szText[0] = (wchar_t)'\0';
- }
+ CCtrlRichEdit &pEntry = m_dat->GetEntry();
+ if (m_history.getCount() > 0) {
+ char *pszText;
if (wParam == VK_UP) {
if (m_iHistoryCurrent == 0)
return;
- m_iHistoryCurrent--;
+
+ if (m_iHistoryCurrent < 0)
+ m_iHistoryCurrent = m_history.getCount()-1;
+ else
+ m_iHistoryCurrent--;
+ pszText = m_history[m_iHistoryCurrent];
}
else {
- m_iHistoryCurrent++;
- if (m_iHistoryCurrent > m_iHistoryTop)
- m_iHistoryCurrent = m_iHistoryTop;
- }
- if (m_iHistoryCurrent == m_iHistoryTop) {
- if (m_history[m_iHistorySize].szText != nullptr) { // replace the temp buffer
- pEntry.SetText(L"");
- pEntry.SendMsg(EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)m_history[m_iHistorySize].szText);
- pEntry.SendMsg(EM_SETSEL, -1, -1);
+ if (m_iHistoryCurrent == -1)
+ return;
+
+ if (m_iHistoryCurrent == m_history.getCount() - 1) {
+ m_iHistoryCurrent = -1;
+ pszText = "";
}
- }
- else {
- pEntry.SetText(L"");
- if (m_history[m_iHistoryCurrent].szText != nullptr) {
- pEntry.SendMsg(EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)m_history[m_iHistoryCurrent].szText);
- pEntry.SendMsg(EM_SETSEL, -1, -1);
+ else {
+ m_iHistoryCurrent++;
+ pszText = m_history[m_iHistoryCurrent];
}
}
- pEntry.OnChange(&pEntry);
- m_dat->m_dwFlags &= ~MWF_NEEDHISTORYSAVE;
- }
-}
-/////////////////////////////////////////////////////////////////////////////////////////
-// allocate the input history(on - demand, when it is requested by
-// opening a message window for this contact).
-//
-// note: it allocs historysize + 1 elements, because the + 1 is used
-// for the temporary buffer which saves the current input line when
-// using input history scrolling.
+ SETTEXTEX stx = { ST_DEFAULT, CP_UTF8 };
+ pEntry.SendMsg(EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)pszText);
+ pEntry.SendMsg(EM_SETSEL, -1, -1);
+ }
-void CContactCache::allocHistory()
-{
- m_iHistorySize = M.GetByte("historysize", 15);
- if (m_iHistorySize < 10)
- m_iHistorySize = 10;
- m_history = (TInputHistory *)mir_alloc(sizeof(TInputHistory) * (m_iHistorySize + 1));
- m_iHistoryCurrent = 0;
- m_iHistoryTop = 0;
- if (m_history)
- memset(m_history, 0, (sizeof(TInputHistory) * m_iHistorySize));
- m_history[m_iHistorySize].szText = (wchar_t*)mir_alloc((HISTORY_INITIAL_ALLOCSIZE + 1) * sizeof(wchar_t));
- m_history[m_iHistorySize].lLen = HISTORY_INITIAL_ALLOCSIZE;
+ pEntry.OnChange(&pEntry);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -353,13 +286,9 @@ void CContactCache::releaseAlloced()
m_stats = nullptr;
}
- if (m_history) {
- for (int i = 0; i <= m_iHistorySize; i++)
- mir_free(m_history[i].szText);
-
- mir_free(m_history);
- m_history = nullptr;
- }
+ for (auto &it : m_history)
+ mir_free(it);
+ m_history.destroy();
mir_free(m_szStatusMsg);
m_szStatusMsg = nullptr;
diff --git a/plugins/TabSRMM/src/contactcache.h b/plugins/TabSRMM/src/contactcache.h
index fd67ebe706..aeafd8f1e2 100644
--- a/plugins/TabSRMM/src/contactcache.h
+++ b/plugins/TabSRMM/src/contactcache.h
@@ -32,12 +32,6 @@
#define C_INVALID_ACCOUNT L"<account error>"
#define HISTORY_INITIAL_ALLOCSIZE 300
-struct TInputHistory
-{
- wchar_t* szText;
- size_t lLen;
-};
-
struct TSessionStats : public MZeroedObject
{
enum {
@@ -70,15 +64,15 @@ class CContactCache : public MZeroedObject
bool m_isMeta;
bool m_isValid;
int m_nMax;
- int m_iHistoryCurrent, m_iHistoryTop, m_iHistorySize;
- CSrmmWindow *m_dat;
+ CTabBaseDlg *m_dat;
TSessionStats *m_stats;
- TInputHistory *m_history;
DBCachedContact *cc;
+ LIST<char> m_history;
+ int m_iHistoryCurrent;
+
void initPhaseTwo();
- void allocHistory();
void releaseAlloced();
public:
@@ -112,7 +106,7 @@ public:
__forceinline DWORD getSessionStart() const { return m_stats->started; }
__forceinline int getSessionMsgCount() const { return (int)m_stats->messageCount; }
- __forceinline CSrmmWindow* getDat() const { return m_dat; }
+ __forceinline CTabBaseDlg* getDat() const { return m_dat; }
size_t getMaxMessageLength();
void updateStats(int iType, size_t value = 0);
@@ -124,7 +118,7 @@ public:
void updateMeta();
bool updateUIN();
void updateStatusMsg(const char *szKey = nullptr);
- void setWindowData(CSrmmWindow *dat = nullptr);
+ void setWindowData(CTabBaseDlg *dat = nullptr);
void resetMeta();
void closeWindow();
void deletedHandler();
@@ -133,7 +127,7 @@ public:
HICON getIcon(int& iSize) const;
// input history
- void saveHistory(int iHistorySize = 0);
+ void saveHistory();
void inputHistoryEvent(WPARAM wParam);
static CContactCache* getContactCache(MCONTACT hContact);
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp
index ba5d2cedba..60d681e88d 100644
--- a/plugins/TabSRMM/src/globals.cpp
+++ b/plugins/TabSRMM/src/globals.cpp
@@ -530,7 +530,7 @@ void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c)
if (c == nullptr)
return;
- CSrmmWindow *dat = c->getDat();
+ CTabBaseDlg *dat = c->getDat();
if (dat == nullptr || !c->isValid())
return;
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 5f8699b3a1..5f57d9b34e 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -563,7 +563,7 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
/////////////////////////////////////////////////////////////////////////////////////////
CSrmmWindow::CSrmmWindow()
- : CTabBaseDlg(IDD_MSGSPLITNEW),
+ : CSuper(IDD_MSGSPLITNEW),
m_btnOk(this, IDOK),
m_btnAdd(this, IDC_ADD),
m_btnQuote(this, IDC_QUOTE),
@@ -605,9 +605,7 @@ CThumbBase* CSrmmWindow::tabCreateThumb(CProxyWindow *pProxy) const
bool CSrmmWindow::OnInitDialog()
{
- CTabBaseDlg::OnInitDialog();
-
- m_cache->setWindowData(this);
+ CSuper::OnInitDialog();
m_szProto = const_cast<char *>(m_cache->getProto());
m_bIsMeta = m_cache->isMeta();
@@ -858,7 +856,7 @@ void CSrmmWindow::OnDestroy()
PostMessage(m_pContainer->m_hwnd, WM_SIZE, 0, 1);
if (m_pContainer->m_dwFlags & CNT_SIDEBAR)
m_pContainer->m_pSideBar->removeSession(this);
- m_cache->setWindowData();
+
if (m_hContact && M.GetByte("deletetemp", 0))
if (db_get_b(m_hContact, "CList", "NotOnList", 0))
db_delete_contact(m_hContact);
@@ -1268,7 +1266,7 @@ void CSrmmWindow::onChange_Message(CCtrlEdit*)
{
if (m_pContainer->m_hwndActive == m_hwnd)
UpdateReadChars();
- m_dwFlags |= MWF_NEEDHISTORYSAVE;
+
m_dwLastActivity = GetTickCount();
m_pContainer->m_dwLastActivity = m_dwLastActivity;
UpdateSaveAndSendButton();
@@ -2270,7 +2268,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
GetClientRect(m_hwnd, &rc);
- CTabBaseDlg::DlgProc(uMsg, 0, 0); // call basic window resizer
+ CSuper::DlgProc(uMsg, 0, 0); // call basic window resizer
BB_SetButtonsPos();
@@ -2986,5 +2984,5 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
return 0;
}
- return CTabBaseDlg::DlgProc(uMsg, wParam, lParam);
+ return CSuper::DlgProc(uMsg, wParam, lParam);
}
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index 9066819205..e3f1619744 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -154,11 +154,19 @@ bool CTabBaseDlg::OnInitDialog()
m_cache = CContactCache::getContactCache(m_hContact);
m_cache->updateNick();
m_cache->updateUIN();
+ m_cache->setWindowData(this);
m_bIsAutosizingInput = IsAutoSplitEnabled();
return true;
}
+void CTabBaseDlg::OnDestroy()
+{
+ m_cache->setWindowData();
+
+ CSuper::OnDestroy();
+}
+
INT_PTR CTabBaseDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h
index d370ef6af5..1604b40ec6 100644
--- a/plugins/TabSRMM/src/msgs.h
+++ b/plugins/TabSRMM/src/msgs.h
@@ -35,13 +35,14 @@
#define MSGERROR_RETRY 1
#define MSGERROR_SENDLATER 2
+#define EVENT_QUEUE_SIZE 10
+
#define CONTAINER_NAMELEN 25
#define TITLE_FORMATLEN 30
#define MWF_SAVEBTN_SAV 2
#define MWF_DEFERREDSCROLL 4
-#define MWF_NEEDHISTORYSAVE 8
#define MWF_WASBACKGROUNDCREATE 16
//#define MWF_MOUSEDOWN 32
#define MWF_ERRORSTATE 128
@@ -244,122 +245,121 @@ class CTabBaseDlg : public CSrmmBaseDialog
friend class CInfoPanel;
protected:
- void CloseTab() override;
- void LoadSettings() override;
- void SetStatusText(const wchar_t*, HICON) override;
-
- void DM_AddDivider();
- void DM_DismissTip(const POINT& pt);
- void DM_ErrorDetected(int type, int flag);
- bool DM_GenericHotkeysCheck(MSG *message);
- int DM_SplitterGlobalEvent(WPARAM wParam, LPARAM lParam);
- void DM_UpdateLastMessage() const;
-
- void DetermineMinHeight();
- void FindFirstEvent();
- int FindRTLLocale();
- void GetSendFormat();
- bool IsAutoSplitEnabled() const;
- void ReplaceIcons(LONG startAt, int fAppend, BOOL isSent);
- void ResizeIeView();
- void ShowPopupMenu(const CCtrlBase&, POINT pt);
- void VerifyProxy();
- LRESULT WMCopyHandler(UINT uMsg, WPARAM wParam, LPARAM lParam);
-
- WORD m_wStatus, m_wOldStatus;
- size_t m_iSendBufferSize;
- int m_iSendLength; // message length in utf-8 octets
- HICON m_hSmileyIcon;
- HWND m_hwndContactPic, m_hwndPanelPic, m_hwndPanelPicParent;
- UINT m_bbLSideWidth, m_bbRSideWidth;
- BYTE kstate[256];
-
- RECT m_rcNick, m_rcUIN, m_rcStatus, m_rcPic;
- int m_originalSplitterY;
- SIZE m_minEditBoxSize;
- int m_nTypeMode;
- DWORD m_nLastTyping;
- DWORD m_lastMessage;
- DWORD m_dwTickLastEvent;
- HBITMAP m_hOwnPic;
- SIZE m_pic;
+ void CloseTab() override;
+ void LoadSettings() override;
+ void SetStatusText(const wchar_t*, HICON) override;
+
+ void DM_AddDivider();
+ void DM_DismissTip(const POINT& pt);
+ void DM_ErrorDetected(int type, int flag);
+ bool DM_GenericHotkeysCheck(MSG *message);
+ int DM_SplitterGlobalEvent(WPARAM wParam, LPARAM lParam);
+ void DM_UpdateLastMessage() const;
+
+ void DetermineMinHeight();
+ void FindFirstEvent();
+ int FindRTLLocale();
+ void GetSendFormat();
+ bool IsAutoSplitEnabled() const;
+ void ReplaceIcons(LONG startAt, int fAppend, BOOL isSent);
+ void ResizeIeView();
+ void ShowPopupMenu(const CCtrlBase&, POINT pt);
+ void VerifyProxy();
+ LRESULT WMCopyHandler(UINT uMsg, WPARAM wParam, LPARAM lParam);
+
+ WORD m_wStatus, m_wOldStatus;
+ size_t m_iSendBufferSize;
+ int m_iSendLength; // message length in utf-8 octets
+ HICON m_hSmileyIcon;
+ HWND m_hwndContactPic, m_hwndPanelPic, m_hwndPanelPicParent;
+ UINT m_bbLSideWidth, m_bbRSideWidth;
+ BYTE kstate[256];
+
+ RECT m_rcNick, m_rcUIN, m_rcStatus, m_rcPic;
+ int m_originalSplitterY;
+ SIZE m_minEditBoxSize;
+ int m_nTypeMode;
+ DWORD m_nLastTyping;
+ DWORD m_lastMessage;
+ DWORD m_dwTickLastEvent;
+ HBITMAP m_hOwnPic;
+ SIZE m_pic;
CMStringW m_szStatusText;
HICON m_szStatusIcon;
bool m_bStatusSet;
- bool m_bShowInfoAvatar, m_bShowUIElements;
- bool m_bUseOffset;
- bool m_bkeyProcessed;
- bool m_fLimitedUpdate;
- bool m_bClrAdded;
- bool m_bInsertMode;
-
- int m_iRealAvatarHeight;
- int m_iButtonBarReallyNeeds;
- DWORD m_dwLastActivity;
- MEVENT m_hFlashingEvent;
- int m_SendFormat;
- MEVENT *m_hQueuedEvents;
- int m_iNextQueuedEvent;
-#define EVENT_QUEUE_SIZE 10
- int m_iEventQueueSize;
- LCID m_lcid;
- wchar_t m_lcID[10];
- int m_iPanelAvatarX, m_iPanelAvatarY;
- HWND m_hwndTip;
- TOOLINFO ti;
- DWORD m_panelStatusCX;
- int m_textLen; // current text len
- LONG m_ipFieldHeight;
- WPARAM m_wParam; // used for "delayed" actions like moved splitters in minimized windows
- LPARAM m_lParam;
- int m_iHaveRTLLang;
-
- DWORD m_iSplitterSaved;
- POINT m_ptTipActivation;
- char *m_enteredText; // Used for history in chats.
+ bool m_bShowInfoAvatar, m_bShowUIElements;
+ bool m_bUseOffset;
+ bool m_bkeyProcessed;
+ bool m_fLimitedUpdate;
+ bool m_bClrAdded;
+ bool m_bInsertMode;
+
+ MEVENT *m_hQueuedEvents;
+ int m_iNextQueuedEvent;
+ int m_iEventQueueSize;
+
+ int m_iRealAvatarHeight;
+ int m_iButtonBarReallyNeeds;
+ DWORD m_dwLastActivity;
+ MEVENT m_hFlashingEvent;
+ int m_SendFormat;
+ LCID m_lcid;
+ wchar_t m_lcID[10];
+ int m_iPanelAvatarX, m_iPanelAvatarY;
+ HWND m_hwndTip;
+ TOOLINFO ti;
+ DWORD m_panelStatusCX;
+ int m_textLen; // current text len
+ LONG m_ipFieldHeight;
+ WPARAM m_wParam; // used for "delayed" actions like moved splitters in minimized windows
+ LPARAM m_lParam;
+ int m_iHaveRTLLang;
+
+ DWORD m_iSplitterSaved;
+ POINT m_ptTipActivation;
public:
- char *m_szProto;
- int m_iTabID;
- BYTE m_bShowTyping;
- bool m_bIsHistory, m_bNotOnList;
- bool m_bActualHistory;
- bool m_bIsAutosizingInput;
- bool m_bCanFlashTab, m_bTabFlash;
- bool m_bEditNotesActive;
- bool m_bShowAvatar;
- int m_sendMode;
- HKL m_hkl; // keyboard layout identifier
- DWORD m_isAutoRTL;
- DWORD m_idle;
- DWORD m_dwFlags, m_dwFlagsEx;
- DWORD m_dwUnread;
- HANDLE m_hTheme, m_hThemeIP, m_hThemeToolbar;
- HWND m_hwndIEView, m_hwndIWebBrowserControl, m_hwndHPP;
- HICON m_hXStatusIcon, m_hTabStatusIcon, m_hTabIcon, m_iFlashIcon, m_hTaskbarIcon, m_hClientIcon;
- MEVENT m_hDbEventFirst, m_hDbEventLast;
- HANDLE m_hTimeZone;
- MEVENT *m_hHistoryEvents;
- time_t m_lastEventTime;
- int m_iLastEventType;
- int m_nTypeSecs;
- int m_iOpenJobs;
- int m_iInputAreaHeight;
- int m_maxHistory, m_curHistory;
- int m_iCurrentQueueError;
- int m_iSplitterY, m_dynaSplitter;
- int m_savedSplitterY, m_savedDynaSplit;
- char *m_sendBuffer;
- int m_nMax; // max message size
-
- wchar_t m_wszMyNickname[130];
- wchar_t m_wszStatus[50];
- wchar_t m_wszTitle[130]; // tab title...
- wchar_t m_myUin[80];
- wchar_t m_wszStatusBar[100];
- char m_szMicroLf[128];
+ char *m_szProto;
+ int m_iTabID;
+ BYTE m_bShowTyping;
+ bool m_bIsHistory, m_bNotOnList;
+ bool m_bActualHistory;
+ bool m_bIsAutosizingInput;
+ bool m_bCanFlashTab, m_bTabFlash;
+ bool m_bEditNotesActive;
+ bool m_bShowAvatar;
+ int m_sendMode;
+ HKL m_hkl; // keyboard layout identifier
+ DWORD m_isAutoRTL;
+ DWORD m_idle;
+ DWORD m_dwFlags, m_dwFlagsEx;
+ DWORD m_dwUnread;
+ HANDLE m_hTheme, m_hThemeIP, m_hThemeToolbar;
+ HWND m_hwndIEView, m_hwndIWebBrowserControl, m_hwndHPP;
+ HICON m_hXStatusIcon, m_hTabStatusIcon, m_hTabIcon, m_iFlashIcon, m_hTaskbarIcon, m_hClientIcon;
+ MEVENT m_hDbEventFirst, m_hDbEventLast;
+ HANDLE m_hTimeZone;
+ MEVENT *m_hHistoryEvents;
+ time_t m_lastEventTime;
+ int m_iLastEventType;
+ int m_nTypeSecs;
+ int m_iOpenJobs;
+ int m_iInputAreaHeight;
+ int m_maxHistory, m_curHistory;
+ int m_iCurrentQueueError;
+ int m_iSplitterY, m_dynaSplitter;
+ int m_savedSplitterY, m_savedDynaSplit;
+ char *m_sendBuffer;
+ int m_nMax; // max message size
+
+ wchar_t m_wszMyNickname[130];
+ wchar_t m_wszStatus[50];
+ wchar_t m_wszTitle[130]; // tab title...
+ wchar_t m_myUin[80];
+ wchar_t m_wszStatusBar[100];
+ char m_szMicroLf[128];
CInfoPanel m_pPanel;
CContactCache *m_cache;
@@ -373,6 +373,7 @@ public:
virtual ~CTabBaseDlg();
bool OnInitDialog() override;
+ void OnDestroy() override;
INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
virtual CThumbBase* tabCreateThumb(CProxyWindow*) const = 0;