diff options
-rw-r--r-- | plugins/Scriver/src/input.cpp | 6 | ||||
-rw-r--r-- | plugins/Scriver/src/msgdialog.cpp | 121 | ||||
-rw-r--r-- | plugins/Scriver/src/msgs.cpp | 5 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 10 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 28 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.cpp | 5 | ||||
-rw-r--r-- | src/mir_app/src/srmm_base.cpp | 8 |
7 files changed, 96 insertions, 87 deletions
diff --git a/plugins/Scriver/src/input.cpp b/plugins/Scriver/src/input.cpp index e6e64db44d..6c95b288bf 100644 --- a/plugins/Scriver/src/input.cpp +++ b/plugins/Scriver/src/input.cpp @@ -181,12 +181,6 @@ int CMsgDialog::InputAreaShortcuts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP return 0;
}
- if (wParam == 'I' && isCtrl) // ctrl-i (italics)
- return FALSE;
-
- if (wParam == VK_SPACE && isCtrl) // ctrl-space (paste clean text)
- return FALSE;
-
if (wParam == 'R' && isCtrl && isShift) { // ctrl-shift-r
ToggleRtl();
return FALSE;
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index ff8c9b9a98..5fbaf8855d 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -291,62 +291,69 @@ void CMsgDialog::onClick_Ok(CCtrlButton *pButton) if (!pButton->Enabled() || m_hContact == 0)
return;
- PARAFORMAT2 pf2;
- memset(&pf2, 0, sizeof(pf2));
- pf2.cbSize = sizeof(pf2);
- pf2.dwMask = PFM_RTLPARA;
- m_message.SendMsg(EM_GETPARAFORMAT, 0, (LPARAM)&pf2);
-
- SendQueue::Item msi = {};
- if (pf2.wEffects & PFE_RTLPARA)
- msi.flags |= DBEF_RTL;
-
- msi.sendBuffer = m_message.GetRichTextRtf(true);
- msi.sendBufferSize = (int)mir_strlen(msi.sendBuffer);
- if (msi.sendBufferSize == 0)
+ ptrA streamOut(m_message.GetRichTextRtf(!m_bSendFormat));
+ if (streamOut == nullptr)
return;
- if (Utils_IsRtl(ptrW(mir_utf8decodeW(msi.sendBuffer))))
- msi.flags |= DBEF_RTL;
-
- // Store messaging history
- TCmdList *cmdListNew = tcmdlist_last(cmdList);
- while (cmdListNew != nullptr && cmdListNew->temporary) {
- cmdList = tcmdlist_remove(cmdList, cmdListNew);
- cmdListNew = tcmdlist_last(cmdList);
- }
- if (msi.sendBuffer != nullptr)
- cmdList = tcmdlist_append(cmdList, mir_strdup(rtrim(msi.sendBuffer)), 20, FALSE);
+ CMStringW wszText(ptrW(mir_utf8decodeW(streamOut)));
+ if (wszText.IsEmpty())
+ return;
- cmdListCurrent = nullptr;
+ if (m_bSendFormat)
+ DoRtfToTags(wszText);
+ wszText.TrimRight();
if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON)
NotifyTyping(PROTOTYPE_SELFTYPING_OFF);
- m_message.SetText(L"");
- m_btnOk.Disable();
- if (g_plugin.bAutoMin)
- ShowWindow(m_hwndParent, SW_MINIMIZE);
-
if (isChat()) {
- CMStringW ptszText(ptrW(mir_utf8decodeW(msi.sendBuffer)));
- DoRtfToTags(ptszText);
- ptszText.Trim();
-
if (m_si->pMI->bAckMsg) {
EnableWindow(m_message.GetHwnd(), FALSE);
m_message.SendMsg(EM_SETREADONLY, TRUE, 0);
}
else m_message.SetText(L"");
- Chat_DoEventHook(m_si, GC_USER_MESSAGE, nullptr, ptszText, 0);
+ Chat_DoEventHook(m_si, GC_USER_MESSAGE, nullptr, wszText, 0);
}
else {
+ PARAFORMAT2 pf2;
+ memset(&pf2, 0, sizeof(pf2));
+ pf2.cbSize = sizeof(pf2);
+ pf2.dwMask = PFM_RTLPARA;
+ m_message.SendMsg(EM_GETPARAFORMAT, 0, (LPARAM)&pf2);
+
+ SendQueue::Item msi = {};
+ if (pf2.wEffects & PFE_RTLPARA)
+ msi.flags |= DBEF_RTL;
+
+ msi.sendBuffer = mir_utf8encodeW(wszText);
+ msi.sendBufferSize = (int)mir_strlen(msi.sendBuffer);
+
+ if (Utils_IsRtl(wszText))
+ msi.flags |= DBEF_RTL;
+
+ // Store messaging history
+ TCmdList *cmdListNew = tcmdlist_last(cmdList);
+ while (cmdListNew != nullptr && cmdListNew->temporary) {
+ cmdList = tcmdlist_remove(cmdList, cmdListNew);
+ cmdListNew = tcmdlist_last(cmdList);
+ }
+ if (msi.sendBuffer != nullptr)
+ cmdList = tcmdlist_append(cmdList, mir_strdup(rtrim(msi.sendBuffer)), 20, FALSE);
+
+ cmdListCurrent = nullptr;
+
if (pButton == nullptr)
m_pParent->MessageSend(msi);
else
MessageSend(msi);
}
+
+ m_message.SetText(L"");
+ m_btnOk.Disable();
+ if (g_plugin.bAutoMin)
+ ShowWindow(m_hwndParent, SW_MINIMIZE);
+
m_btnCloseQuote.Click();
}
@@ -708,12 +715,27 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) return result;
switch (msg) {
+ case EM_ACTIVATE:
+ SetActiveWindow(m_hwnd);
+ break;
+
+ case WM_SYSCHAR:
+ if ((wParam == 's' || wParam == 'S') && (GetKeyState(VK_MENU) & 0x8000)) {
+ PostMessage(m_hwnd, WM_COMMAND, IDOK, 0);
+ return 0;
+ }
+ break;
+
+ case WM_CONTEXTMENU:
+ InputAreaContextMenu(m_message.GetHwnd(), wParam, lParam, m_hContact);
+ return TRUE;
+
case WM_KEYDOWN:
- if (isChat()) {
- bool isShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0;
- bool isCtrl = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
- bool isAlt = (GetKeyState(VK_MENU) & 0x8000) != 0;
+ bool isShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0;
+ bool isCtrl = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
+ bool isAlt = (GetKeyState(VK_MENU) & 0x8000) != 0;
+ if (isChat()) {
if (wParam == VK_TAB && isShift && !isCtrl) { // SHIFT-TAB (go to nick list)
SetFocus(m_nickList.GetHwnd());
return TRUE;
@@ -726,7 +748,7 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) RedrawWindow(m_nickList.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE);
return 0;
}
-
+
if (wParam != VK_RIGHT && wParam != VK_LEFT) {
replaceStrW(m_wszSearchQuery, nullptr);
replaceStrW(m_wszSearchResult, nullptr);
@@ -753,26 +775,11 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) m_btnChannelMgr.Click();
return TRUE;
}
-
- if (ProcessHotkeys(wParam, isShift, isCtrl, isAlt))
- return TRUE;
}
- break;
-
- case EM_ACTIVATE:
- SetActiveWindow(m_hwnd);
- break;
- case WM_SYSCHAR:
- if ((wParam == 's' || wParam == 'S') && (GetKeyState(VK_MENU) & 0x8000)) {
- PostMessage(m_hwnd, WM_COMMAND, IDOK, 0);
- return 0;
- }
+ if (ProcessHotkeys(wParam, isShift, isCtrl, isAlt))
+ return TRUE;
break;
-
- case WM_CONTEXTMENU:
- InputAreaContextMenu(m_message.GetHwnd(), wParam, lParam, m_hContact);
- return TRUE;
}
return CSuper::WndProc_Message(msg, wParam, lParam);
}
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index a111e894bf..c404105eb3 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -394,8 +394,8 @@ int RegisterToolbarIcons(WPARAM, LPARAM) bbd.pwszTooltip = LPGENW("View user's history (Ctrl+H)");
g_plugin.addButton(&bbd);
- // chat buttons
- bbd.bbbFlags = BBBF_ISPUSHBUTTON | BBBF_ISCHATBUTTON | BBBF_CREATEBYID | BBBF_NOREADONLY;
+ // format buttons
+ bbd.bbbFlags = BBBF_ISPUSHBUTTON | BBBF_ISCHATBUTTON | BBBF_ISIMBUTTON | BBBF_CREATEBYID | BBBF_NOREADONLY;
bbd.dwButtonID = IDC_SRMM_BOLD;
bbd.dwDefPos = 10;
bbd.hIcon = g_plugin.getIconHandle(IDI_BBOLD);
@@ -431,6 +431,7 @@ int RegisterToolbarIcons(WPARAM, LPARAM) bbd.pwszTooltip = LPGENW("Select a background color for the text (Ctrl+L)");
g_plugin.addButton(&bbd);
+ // chat buttons
bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID;
bbd.dwButtonID = IDC_SRMM_CHANMGR;
bbd.dwDefPos = 30;
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index d9fd2c3804..dd10c1934d 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -791,10 +791,12 @@ void CMsgDialog::onClick_Ok(CCtrlButton *) if (decoded.IsEmpty())
return;
+ if (final_sendformat)
+ DoRtfToTags(decoded);
+ decoded.TrimRight();
+
if (isChat()) {
m_cache->saveHistory();
- DoRtfToTags(decoded);
- decoded.Trim();
if (m_si->pMI->bAckMsg) {
m_message.Enable(false);
@@ -820,10 +822,6 @@ void CMsgDialog::onClick_Ok(CCtrlButton *) Skin_PlaySound("SendMsg");
}
else {
- if (final_sendformat)
- DoRtfToTags(decoded);
- decoded.TrimRight();
-
T2Utf utfResult(decoded);
size_t memRequired = mir_strlen(utfResult) + 1;
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index b7cdfbdc3c..a9a7b46e66 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -314,16 +314,20 @@ void CMsgDialog::onClick_Ok(CCtrlButton *pButton) if (!pButton->Enabled())
return;
- ptrA msgText(m_message.GetRichTextRtf(true));
- if (msgText == nullptr)
+ ptrA streamOut(m_message.GetRichTextRtf(!m_bSendFormat));
+ if (streamOut == nullptr)
return;
- if (isChat()) {
- CMStringW ptszText(ptrW(mir_utf8decodeW(msgText)));
- DoRtfToTags(ptszText);
- ptszText.Trim();
+ CMStringW wszText(ptrW(mir_utf8decodeW(streamOut)));
+ if (wszText.IsEmpty())
+ return;
+
+ if (m_bSendFormat)
+ DoRtfToTags(wszText);
+ wszText.TrimRight();
- m_cmdList.insert(mir_wstrdup(ptszText));
+ if (isChat()) {
+ m_cmdList.insert(mir_wstrdup(wszText));
m_cmdListInd = -1;
if (m_si->pMI->bAckMsg) {
@@ -332,16 +336,12 @@ void CMsgDialog::onClick_Ok(CCtrlButton *pButton) }
else m_message.SetText(L"");
- Chat_DoEventHook(m_si, GC_USER_MESSAGE, nullptr, ptszText, 0);
+ Chat_DoEventHook(m_si, GC_USER_MESSAGE, nullptr, wszText, 0);
}
else {
- ptrW temp(mir_utf8decodeW(msgText));
- if (!temp[0])
- return;
-
- int sendId = SendMessageDirect(m_hContact, m_hQuoteEvent, rtrimw(temp));
+ int sendId = SendMessageDirect(m_hContact, m_hQuoteEvent, wszText);
if (sendId) {
- m_cmdList.insert(temp.detach());
+ m_cmdList.insert(wszText.Detach());
m_cmdListInd = -1;
if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON)
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index cba06ad66e..b4583d9020 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -354,8 +354,8 @@ int RegisterToolbarIcons(WPARAM, LPARAM) bbd.pwszTooltip = LPGENW("View user's history (Ctrl+H)");
g_plugin.addButton(&bbd);
- // chat buttons
- bbd.bbbFlags = BBBF_ISPUSHBUTTON | BBBF_ISCHATBUTTON | BBBF_CREATEBYID | BBBF_NOREADONLY;
+ // format buttons
+ bbd.bbbFlags = BBBF_ISPUSHBUTTON | BBBF_ISCHATBUTTON | BBBF_ISIMBUTTON | BBBF_CREATEBYID | BBBF_NOREADONLY;
bbd.dwButtonID = IDC_SRMM_BOLD;
bbd.dwDefPos = 10;
bbd.hIcon = g_plugin.getIconHandle(IDI_BBOLD);
@@ -391,6 +391,7 @@ int RegisterToolbarIcons(WPARAM, LPARAM) bbd.pwszTooltip = LPGENW("Select a background color for the text (Ctrl+L)");
g_plugin.addButton(&bbd);
+ // chat buttons
bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID;
bbd.dwButtonID = IDC_SRMM_CHANMGR;
bbd.dwDefPos = 30;
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp index 6788f1f424..7a3aa5456d 100644 --- a/src/mir_app/src/srmm_base.cpp +++ b/src/mir_app/src/srmm_base.cpp @@ -545,6 +545,14 @@ bool CSrmmBaseDialog::OnInitDialog() // three buttons below are initiated inside this call, so button creation must precede subclassing
Srmm_CreateToolbarIcons(this, isChat() ? BBBF_ISCHATBUTTON : BBBF_ISIMBUTTON);
+ if (!m_bSendFormat) {
+ m_btnBold.Disable();
+ m_btnItalic.Disable();
+ m_btnUnderline.Disable();
+ m_btnColor.Disable();
+ m_btnBkColor.Disable();
+ }
+
mir_subclassWindow(m_btnFilter.GetHwnd(), stubButtonSubclassProc);
mir_subclassWindow(m_btnColor.GetHwnd(), stubButtonSubclassProc);
mir_subclassWindow(m_btnBkColor.GetHwnd(), stubButtonSubclassProc);
|